Cosmetics Editor Fixes (#1287)

This commit is contained in:
Baoulettes 2022-08-25 01:28:27 +02:00 committed by GitHub
parent b70ad81f57
commit c0b9171f98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 216 additions and 109 deletions

View File

@ -251,9 +251,9 @@ extern "C" void CVar_Save()
auto keyStr = key.c_str();
Color_RGBA8 clr = cvar.second->value.valueRGBA;
pConf->setUInt(StringHelper::Sprintf("%s.R", keyStr), clr.r);
pConf->setUInt(StringHelper::Sprintf("%s.G", keyStr), clr.r);
pConf->setUInt(StringHelper::Sprintf("%s.B", keyStr), clr.r);
pConf->setUInt(StringHelper::Sprintf("%s.A", keyStr), clr.r);
pConf->setUInt(StringHelper::Sprintf("%s.G", keyStr), clr.g);
pConf->setUInt(StringHelper::Sprintf("%s.B", keyStr), clr.b);
pConf->setUInt(StringHelper::Sprintf("%s.A", keyStr), clr.a);
pConf->setString(StringHelper::Sprintf("%s.Type", keyStr), mercuryRGBAObjectType);
}
}

View File

@ -26,7 +26,7 @@ const char* RainbowColorCvarList[] = {
"gCCMapsPrim", "gCCQuestsPrim", "gCCSavePrim", "gCCGameoverPrim"
};
const char* MarginCvarList[] {
"gHearts", "gMagicBar", "gVSOA", "gBBtn", "gABtn", "gStartBtn",
"gHearts", "gHeartsCount", "gMagicBar", "gVSOA", "gBBtn", "gABtn", "gStartBtn",
"gCBtnU", "gCBtnD", "gCBtnL", "gCBtnR", "gDPad", "gMinimap",
"gSKC", "gRC", "gCarrots", "gTimers", "gAS", "gTCM", "gTCB"
};
@ -44,7 +44,6 @@ ImVec4 GetRandomValue(int MaximumPossible){
return NewColor;
}
void GetRandomColorRGB(CosmeticsColorSection* ColorSection, int SectionSize){
//std::random_shuffle(ColorSection, ColorSection + SectionSize);
for (int i = 0; i < SectionSize; i++){
CosmeticsColorIndividual* Element = ColorSection[i].Element;
ImVec4 colors = Element->ModifiedColor;
@ -477,7 +476,7 @@ void Draw_Placements(){
Table_InitHeader(false);
DrawUseMarginsSlider("Hearts counts", "gHearts");
DrawPositionsRadioBoxes("gHeartsCount");
DrawPositionSlider("gHeartsCount",-22,ImGui::GetWindowViewport()->Size.y,-25,ImGui::GetWindowViewport()->Size.x);
DrawPositionSlider("gHeartsCount",-22,ImGui::GetWindowViewport()->Size.y,-125,ImGui::GetWindowViewport()->Size.x);
DrawScaleSlider("gHeartsCount",0.7f);
ImGui::NewLine();
ImGui::EndTable();

View File

@ -3495,15 +3495,15 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
}
int CUp_factor = (1 << 10) * C_Up_BTN_Size / CUpScaled;
if (CVar_GetS32("gCBtnUPosType", 0) != 0) {
C_Up_BTN_Pos[1] = CVar_GetS32("gCBtnUPosY", 0)-(CUpScale*13)+Y_Margins_CU;
C_Up_BTN_Pos[1] = CVar_GetS32("gCBtnUPosY", 0)+Y_Margins_CU;
if (CVar_GetS32("gCBtnUPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gCBtnUUseMargins", 0) != 0) {X_Margins_CU = Left_HUD_Margin;};
C_Up_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnUPosX", 0)-(CUpScale*13)+X_Margins_CU);
C_Up_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnUPosX", 0)+X_Margins_CU);
} else if (CVar_GetS32("gCBtnUPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gCBtnUUseMargins", 0) != 0) {X_Margins_CU = Right_HUD_Margin;};
C_Up_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnUPosX", 0)-(CUpScale*13)+X_Margins_CU);
C_Up_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnUPosX", 0)+X_Margins_CU);
} else if (CVar_GetS32("gCBtnUPosType", 0) == 3) {//Anchor None
C_Up_BTN_Pos[0] = CVar_GetS32("gCBtnUPosX", 0)-(CUpScale*13);
C_Up_BTN_Pos[0] = CVar_GetS32("gCBtnUPosX", 0);
} else if (CVar_GetS32("gCBtnUPosType", 0) == 4) {//Hidden
C_Up_BTN_Pos[0] = -9999;
}
@ -3521,15 +3521,15 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
int CDown_factor = (1 << 10) * C_Down_BTN_Size / CDownScaled;
int PositionAdjustment = CDownScaled/2;
if (CVar_GetS32("gCBtnDPosType", 0) != 0) {
C_Down_BTN_Pos[1] = CVar_GetS32("gCBtnDPosY", 0)-PositionAdjustment+Y_Margins_CD;
C_Down_BTN_Pos[1] = CVar_GetS32("gCBtnDPosY", 0)+Y_Margins_CD;
if (CVar_GetS32("gCBtnDPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Left_HUD_Margin;};
C_Down_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnDPosX", 0)-PositionAdjustment+X_Margins_CD);
C_Down_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD);
} else if (CVar_GetS32("gCBtnDPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Right_HUD_Margin;};
C_Down_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnDPosX", 0)-PositionAdjustment+X_Margins_CD);
C_Down_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD);
} else if (CVar_GetS32("gCBtnDPosType", 0) == 3) {//Anchor None
C_Down_BTN_Pos[0] = CVar_GetS32("gCBtnDPosX", 0)-PositionAdjustment;
C_Down_BTN_Pos[0] = CVar_GetS32("gCBtnDPosX", 0);
} else if (CVar_GetS32("gCBtnDPosType", 0) == 4) {//Hidden
C_Down_BTN_Pos[0] = -9999;
}
@ -3567,9 +3567,9 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_L.r, C_button_L.g, C_button_L.b, interfaceCtx->cLeftAlpha);
}
gSPWideTextureRectangle(OVERLAY_DISP++, C_Left_BTN_Pos[0] << 2, C_Left_BTN_Pos[1] << 2,
(C_Left_BTN_Pos[0] + CLeftScaled) << 2,
(C_Left_BTN_Pos[1] + CLeftScaled) << 2,
G_TX_RENDERTILE, 0, 0, CLeft_factor, CLeft_factor);
(C_Left_BTN_Pos[0] + R_ITEM_BTN_WIDTH(1)) << 2,
(C_Left_BTN_Pos[1] + R_ITEM_BTN_WIDTH(1)) << 2,
G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(1) << 1, R_ITEM_BTN_DD(1) << 1);
// C-Down Button Color & Texture
if (CVar_GetS32("gHudColors", 1) == 0) {
@ -3582,9 +3582,9 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_D.r, C_button_D.g, C_button_D.b, interfaceCtx->cDownAlpha);
}
gSPWideTextureRectangle(OVERLAY_DISP++, C_Down_BTN_Pos[0] << 2, C_Down_BTN_Pos[1] << 2,
(C_Down_BTN_Pos[0] + CDownScaled) << 2,
(C_Down_BTN_Pos[1] + CDownScaled) << 2,
G_TX_RENDERTILE, 0, 0, CDown_factor, CDown_factor);
(C_Down_BTN_Pos[0] + R_ITEM_BTN_WIDTH(2)) << 2,
(C_Down_BTN_Pos[1] + R_ITEM_BTN_WIDTH(2)) << 2,
G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(2) << 1, R_ITEM_BTN_DD(2) << 1);
// C-Right Button Color & Texture
if (CVar_GetS32("gHudColors", 1) == 0) {
@ -3597,9 +3597,9 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_R.r, C_button_R.g, C_button_R.b, interfaceCtx->cRightAlpha);
}
gSPWideTextureRectangle(OVERLAY_DISP++, C_Right_BTN_Pos[0] << 2, C_Right_BTN_Pos[1] << 2,
(C_Right_BTN_Pos[0] + CRightScaled) << 2,
(C_Right_BTN_Pos[1] + CRightScaled) << 2,
G_TX_RENDERTILE, 0, 0, CRight_factor, CRight_factor);
(C_Right_BTN_Pos[0] + R_ITEM_BTN_WIDTH(3)) << 2,
(C_Right_BTN_Pos[1] + R_ITEM_BTN_WIDTH(3)) << 2,
G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(3) << 1, R_ITEM_BTN_DD(3) << 1);
if ((pauseCtx->state < 8) || (pauseCtx->state >= 18)) {
if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) {
@ -3896,43 +3896,16 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16
X_Margins_DPad_Items = 0;
Y_Margins_DPad_Items = 0;
}
const float ItemsScale_offset[8][2] = {
// Y X
{ 104.0f, 144.0f }, //B
{ 108.0f, 148.0f }, //C L
{ 108.0f, 148.0f }, //C D
{ 108.0f, 148.0f }, //C R
{ 112.0f, 152.0f }, //Dpad ^
{ 112.0f, 152.0f }, //Dpad V
{ 112.0f, 152.0f }, //Dpad <
{ 112.0f, 152.0f } //Dpad >
};
float ItemScale_ori[8] = {
1.0f, //B BTN
0.87f, 0.87f, 0.87f, //C BTNs L / D / R
0.6f, 0.6f, 0.6f, 0.6f //Dpad U/D/L/R
};
const s16 ItemIconPos_ori[8][2] = {
{ B_BUTTON_X+X_Margins_BtnB-ItemsScale_offset[0][1], B_BUTTON_Y+Y_Margins_BtnB-ItemsScale_offset[0][0] },
{ C_LEFT_BUTTON_X+X_Margins_CL-ItemsScale_offset[1][1], C_LEFT_BUTTON_Y+Y_Margins_CL-ItemsScale_offset[1][0] },
{ C_DOWN_BUTTON_X+X_Margins_CD-ItemsScale_offset[2][1], C_DOWN_BUTTON_Y+Y_Margins_CD-ItemsScale_offset[2][0] },
{ C_RIGHT_BUTTON_X+X_Margins_CR-ItemsScale_offset[3][1], C_RIGHT_BUTTON_Y+Y_Margins_CR-ItemsScale_offset[3][0] },
{ DPAD_UP_X+X_Margins_DPad_Items-ItemsScale_offset[4][1], DPAD_UP_Y+Y_Margins_DPad_Items-ItemsScale_offset[4][0] },
{ DPAD_DOWN_X+X_Margins_DPad_Items-ItemsScale_offset[5][1], DPAD_DOWN_Y+Y_Margins_DPad_Items-ItemsScale_offset[5][0] },
{ DPAD_LEFT_X+X_Margins_DPad_Items-ItemsScale_offset[6][1], DPAD_LEFT_Y+Y_Margins_DPad_Items-ItemsScale_offset[6][0] },
{ DPAD_RIGHT_X+X_Margins_DPad_Items-ItemsScale_offset[7][1], DPAD_RIGHT_Y+Y_Margins_DPad_Items-ItemsScale_offset[7][0] }
{ B_BUTTON_X+X_Margins_BtnB, B_BUTTON_Y+Y_Margins_BtnB },
{ C_LEFT_BUTTON_X+X_Margins_CL, C_LEFT_BUTTON_Y+Y_Margins_CL },
{ C_DOWN_BUTTON_X+X_Margins_CD, C_DOWN_BUTTON_Y+Y_Margins_CD },
{ C_RIGHT_BUTTON_X+X_Margins_CR, C_RIGHT_BUTTON_Y+Y_Margins_CR },
{ DPAD_UP_X+X_Margins_DPad_Items, DPAD_UP_Y+Y_Margins_DPad_Items },
{ DPAD_DOWN_X+X_Margins_DPad_Items, DPAD_DOWN_Y+Y_Margins_DPad_Items },
{ DPAD_LEFT_X+X_Margins_DPad_Items, DPAD_LEFT_Y+Y_Margins_DPad_Items },
{ DPAD_RIGHT_X+X_Margins_DPad_Items, DPAD_RIGHT_Y+Y_Margins_DPad_Items }
};
float ItemScale[8] = {
CVar_GetFloat("gBBtnScale", 1.0f),
CVar_GetFloat("gCBtnLScale", 0.87f),
CVar_GetFloat("gCBtnDScale", 0.87f),
CVar_GetFloat("gCBtnRScale", 0.87f),
CVar_GetFloat("gDPadScale", 0.425f),
CVar_GetFloat("gDPadScale", 0.425f),
CVar_GetFloat("gDPadScale", 0.425f),
CVar_GetFloat("gDPadScale", 0.425f),
};
float ItemScaleCurrent[8]; //Hold the array with modified scale
u16 ItemsSlotsAlpha[8] = {
interfaceCtx->bAlpha,
interfaceCtx->cLeftAlpha,
@ -3952,10 +3925,6 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16
s16 ItemIconPos[8][2]; //(X,Y)
//DPadItems
if (CVar_GetS32("gDPadPosType", 0) != 0) {
ItemScaleCurrent[4] = ItemScale[4];
ItemScaleCurrent[5] = ItemScale[5];
ItemScaleCurrent[6] = ItemScale[6];
ItemScaleCurrent[7] = ItemScale[7];
ItemIconPos[4][1] = CVar_GetS32("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[0][1];//Up
ItemIconPos[5][1] = CVar_GetS32("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[1][1];//Down
ItemIconPos[6][1] = CVar_GetS32("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[2][1];//Left
@ -3984,10 +3953,6 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16
ItemIconPos[7][0] = -9999;
}
} else {
ItemScaleCurrent[4] = ItemScale_ori[4];
ItemScaleCurrent[5] = ItemScale_ori[5];
ItemScaleCurrent[6] = ItemScale_ori[6];
ItemScaleCurrent[7] = ItemScale_ori[7];
ItemIconPos[4][0] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[4][0]);
ItemIconPos[5][0] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[5][0]);
ItemIconPos[6][0] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[6][0]);
@ -3999,81 +3964,73 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16
}
//B Button
if (CVar_GetS32("gBBtnPosType", 0) != 0) {
ItemScaleCurrent[0] = ItemScale[0];
ItemIconPos[0][1] = CVar_GetS32("gBBtnPosY", 0)+Y_Margins_BtnB-ItemsScale_offset[0][0];
ItemIconPos[0][1] = CVar_GetS32("gBBtnPosY", 0)+Y_Margins_BtnB;
if (CVar_GetS32("gBBtnPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB = Left_HUD_Margin;};
ItemIconPos[0][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gBBtnPosX", 0)+X_Margins_BtnB-ItemsScale_offset[0][1]);
ItemIconPos[0][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gBBtnPosX", 0)+X_Margins_BtnB);
} else if (CVar_GetS32("gBBtnPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB = Right_HUD_Margin;};
ItemIconPos[0][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gBBtnPosX", 0)+X_Margins_BtnB-ItemsScale_offset[0][1]);
ItemIconPos[0][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gBBtnPosX", 0)+X_Margins_BtnB);
} else if (CVar_GetS32("gBBtnPosType", 0) == 3) {//Anchor None
ItemIconPos[0][0] = CVar_GetS32("gBBtnPosX", 0)-ItemsScale_offset[0][1];
ItemIconPos[0][0] = CVar_GetS32("gBBtnPosX", 0);
} else if (CVar_GetS32("gBBtnPosType", 0) == 4) {//Hidden
ItemIconPos[0][0] = -9999;
}
} else {
ItemScaleCurrent[0] = ItemScale_ori[0];
ItemIconPos[0][0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[0][0]);
ItemIconPos[0][1] = ItemIconPos_ori[0][1];
}
//C button Left
if (CVar_GetS32("gCBtnLPosType", 0) != 0) {
ItemScaleCurrent[1] = ItemScale[1];
ItemIconPos[1][1] = CVar_GetS32("gCBtnLPosY", 0)+Y_Margins_CL-ItemsScale_offset[1][0];
ItemIconPos[1][1] = CVar_GetS32("gCBtnLPosY", 0)+Y_Margins_CL;
if (CVar_GetS32("gCBtnLPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Left_HUD_Margin;};
ItemIconPos[1][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL-ItemsScale_offset[1][1]);
ItemIconPos[1][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL);
} else if (CVar_GetS32("gCBtnLPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Right_HUD_Margin;};
ItemIconPos[1][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL-ItemsScale_offset[1][1]);
ItemIconPos[1][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL);
} else if (CVar_GetS32("gCBtnLPosType", 0) == 3) {//Anchor None
ItemIconPos[1][0] = CVar_GetS32("gCBtnLPosX", 0)-ItemsScale_offset[1][1];
ItemIconPos[1][0] = CVar_GetS32("gCBtnLPosX", 0);
} else if (CVar_GetS32("gCBtnLPosType", 0) == 4) {//Hidden
ItemIconPos[1][0] = -9999;
}
} else {
ItemScaleCurrent[1] = ItemScale_ori[1];
ItemIconPos[1][0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[1][0]);
ItemIconPos[1][1] = ItemIconPos_ori[1][1];
}
//C Button down
if (CVar_GetS32("gCBtnDPosType", 0) != 0) {
ItemScaleCurrent[2] = ItemScale[2];
ItemIconPos[2][1] = CVar_GetS32("gCBtnDPosY", 0)+Y_Margins_CD-ItemsScale_offset[2][0];
ItemIconPos[2][1] = CVar_GetS32("gCBtnDPosY", 0)+Y_Margins_CD;
if (CVar_GetS32("gCBtnDPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Left_HUD_Margin;};
ItemIconPos[2][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD-ItemsScale_offset[2][1]);
ItemIconPos[2][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD);
} else if (CVar_GetS32("gCBtnDPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Right_HUD_Margin;};
ItemIconPos[2][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD-ItemsScale_offset[2][1]);
ItemIconPos[2][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD);
} else if (CVar_GetS32("gCBtnDPosType", 0) == 3) {//Anchor None
ItemIconPos[2][0] = CVar_GetS32("gCBtnDPosX", 0)-ItemsScale_offset[2][1];
ItemIconPos[2][0] = CVar_GetS32("gCBtnDPosX", 0);
} else if (CVar_GetS32("gCBtnDPosType", 0) == 4) {//Hidden
ItemIconPos[2][0] = -9999;
}
} else {
ItemScaleCurrent[2] = ItemScale_ori[2];
ItemIconPos[2][0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[2][0]);
ItemIconPos[2][1] = ItemIconPos_ori[2][1];
}
//C button Right
if (CVar_GetS32("gCBtnRPosType", 0) != 0) {
ItemScaleCurrent[3] = ItemScale[3];
ItemIconPos[3][1] = CVar_GetS32("gCBtnRPosY", 0)+Y_Margins_CR-ItemsScale_offset[3][0];
ItemIconPos[3][1] = CVar_GetS32("gCBtnRPosY", 0)+Y_Margins_CR;
if (CVar_GetS32("gCBtnRPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Left_HUD_Margin;};
ItemIconPos[3][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR-ItemsScale_offset[3][1]);
ItemIconPos[3][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR);
} else if (CVar_GetS32("gCBtnRPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Right_HUD_Margin;};
ItemIconPos[3][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR-ItemsScale_offset[3][1]);
ItemIconPos[3][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR);
} else if (CVar_GetS32("gCBtnRPosType", 0) == 3) {//Anchor None
ItemIconPos[3][0] = CVar_GetS32("gCBtnRPosX", 0)-ItemsScale_offset[3][1];
ItemIconPos[3][0] = CVar_GetS32("gCBtnRPosX", 0);
} else if (CVar_GetS32("gCBtnRPosType", 0) == 4) {//Hidden
ItemIconPos[3][0] = -9999;
}
} else {
ItemScaleCurrent[3] = ItemScale_ori[3];
ItemIconPos[3][0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[3][0]);
ItemIconPos[3][1] = ItemIconPos_ori[3][1];
}
@ -4081,23 +4038,10 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16
gDPLoadTextureBlock(OVERLAY_DISP++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gDPPipeSync(OVERLAY_DISP++);
gSPSetGeometryMode(OVERLAY_DISP++, G_CULL_BACK);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, ItemsSlotsAlpha[button]);
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0);
Matrix_Translate(
ItemIconPos[button][0],
ItemIconPos[button][1] * -1, 1.0f, MTXMODE_NEW);
Matrix_Scale(
ItemScaleCurrent[button]/1,
ItemScaleCurrent[button]/1,
ItemScaleCurrent[button]/1, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[0], 4, 0);
gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0);
gDPPipeSync(OVERLAY_DISP++);
gSPWideTextureRectangle(OVERLAY_DISP++, ItemIconPos[button][0] << 2, ItemIconPos[button][1] << 2,
(ItemIconPos[button][0] + gItemIconWidth[button]) << 2,
(ItemIconPos[button][1] + gItemIconWidth[button]) << 2, G_TX_RENDERTILE, 0, 0,
gItemIconDD[button] << 1, gItemIconDD[button] << 1);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -568,6 +568,170 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) {
u16 offsetX;
u16 offsetY;
s16 Top_HUD_Margin = CVar_GetS32("gHUDMargin_T", 0);
s16 Left_HUD_Margin = CVar_GetS32("gHUDMargin_L", 0);
s16 Right_HUD_Margin = CVar_GetS32("gHUDMargin_R", 0);
s16 Bottom_HUD_Margin = CVar_GetS32("gHUDMargin_B", 0);
s16 X_Margins_CL;
s16 X_Margins_CR;
s16 X_Margins_CD;
s16 Y_Margins_CL;
s16 Y_Margins_CR;
s16 Y_Margins_CD;
s16 X_Margins_BtnB;
s16 Y_Margins_BtnB;
s16 X_Margins_DPad_Items;
s16 Y_Margins_DPad_Items;
if (CVar_GetS32("gBBtnUseMargins", 0) != 0) {
if (CVar_GetS32("gBBtnPosType", 0) == 0) {X_Margins_BtnB = Right_HUD_Margin;};
Y_Margins_BtnB = (Top_HUD_Margin*-1);
} else {
X_Margins_BtnB = 0;
Y_Margins_BtnB = 0;
}
if (CVar_GetS32("gCBtnLUseMargins", 0) != 0) {
if (CVar_GetS32("gCBtnLPosType", 0) == 0) {X_Margins_CL = Right_HUD_Margin;};
Y_Margins_CL = (Top_HUD_Margin*-1);
} else {
X_Margins_CL = 0;
Y_Margins_CL = 0;
}
if (CVar_GetS32("gCBtnRUseMargins", 0) != 0) {
if (CVar_GetS32("gCBtnRPosType", 0) == 0) {X_Margins_CR = Right_HUD_Margin;};
Y_Margins_CR = (Top_HUD_Margin*-1);
} else {
X_Margins_CR = 0;
Y_Margins_CR = 0;
}
if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {
if (CVar_GetS32("gCBtnDPosType", 0) == 0) {X_Margins_CD = Right_HUD_Margin;};
Y_Margins_CD = (Top_HUD_Margin*-1);
} else {
X_Margins_CD = 0;
Y_Margins_CD = 0;
}
if (CVar_GetS32("gDPadUseMargins", 0) != 0) {
if (CVar_GetS32("gDPadPosType", 0) == 0) {X_Margins_DPad_Items = Right_HUD_Margin;};
Y_Margins_DPad_Items = (Top_HUD_Margin*-1);
} else {
X_Margins_DPad_Items = 0;
Y_Margins_DPad_Items = 0;
}
const s16 ItemIconPos_ori[7][2] = {
{ C_LEFT_BUTTON_X+X_Margins_CL, C_LEFT_BUTTON_Y+Y_Margins_CL },
{ C_DOWN_BUTTON_X+X_Margins_CD, C_DOWN_BUTTON_Y+Y_Margins_CD },
{ C_RIGHT_BUTTON_X+X_Margins_CR, C_RIGHT_BUTTON_Y+Y_Margins_CR },
{ DPAD_UP_X+X_Margins_DPad_Items, DPAD_UP_Y+Y_Margins_DPad_Items },
{ DPAD_DOWN_X+X_Margins_DPad_Items, DPAD_DOWN_Y+Y_Margins_DPad_Items },
{ DPAD_LEFT_X+X_Margins_DPad_Items, DPAD_LEFT_Y+Y_Margins_DPad_Items },
{ DPAD_RIGHT_X+X_Margins_DPad_Items, DPAD_RIGHT_Y+Y_Margins_DPad_Items }
};
s16 DPad_ItemsOffset[4][2] = {
{ 7,-8},//Up
{ 7,24},//Down
{-9, 8},//Left
{23, 8},//Right
}; //(X,Y) Used with custom position to place it properly.
//DPadItems
if (CVar_GetS32("gDPadPosType", 0) != 0) {
sCButtonPosY[3] = CVar_GetS32("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[0][1];//Up
sCButtonPosY[4] = CVar_GetS32("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[1][1];//Down
sCButtonPosY[5] = CVar_GetS32("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[2][1];//Left
sCButtonPosY[6] = CVar_GetS32("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[3][1];//Right
if (CVar_GetS32("gDPadPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gDPadUseMargins", 0) != 0) {X_Margins_DPad_Items = Left_HUD_Margin;};
sCButtonPosX[3] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]);
sCButtonPosX[4] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]);
sCButtonPosX[5] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]);
sCButtonPosX[6] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]);
} else if (CVar_GetS32("gDPadPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gDPadUseMargins", 0) != 0) {X_Margins_DPad_Items = Right_HUD_Margin;};
sCButtonPosX[3] = OTRGetDimensionFromRightEdge(CVar_GetS32("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]);
sCButtonPosX[4] = OTRGetDimensionFromRightEdge(CVar_GetS32("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]);
sCButtonPosX[5] = OTRGetDimensionFromRightEdge(CVar_GetS32("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]);
sCButtonPosX[6] = OTRGetDimensionFromRightEdge(CVar_GetS32("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]);
} else if (CVar_GetS32("gDPadPosType", 0) == 3) {//Anchor None
sCButtonPosX[3] = CVar_GetS32("gDPadPosX", 0)+DPad_ItemsOffset[0][0];
sCButtonPosX[4] = CVar_GetS32("gDPadPosX", 0)+DPad_ItemsOffset[1][0];
sCButtonPosX[5] = CVar_GetS32("gDPadPosX", 0)+DPad_ItemsOffset[2][0];
sCButtonPosX[6] = CVar_GetS32("gDPadPosX", 0)+DPad_ItemsOffset[3][0];
}
} else {
sCButtonPosX[3] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[3][0]);
sCButtonPosX[4] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[4][0]);
sCButtonPosX[5] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[5][0]);
sCButtonPosX[6] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[6][0]);
sCButtonPosY[3] = ItemIconPos_ori[3][1];
sCButtonPosY[4] = ItemIconPos_ori[4][1];
sCButtonPosY[5] = ItemIconPos_ori[5][1];
sCButtonPosY[6] = ItemIconPos_ori[6][1];
}
//C button Left
if (CVar_GetS32("gCBtnLPosType", 0) != 0) {
sCButtonPosY[0] = CVar_GetS32("gCBtnLPosY", 0)+Y_Margins_CL;
if (CVar_GetS32("gCBtnLPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Left_HUD_Margin;};
sCButtonPosX[0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL);
} else if (CVar_GetS32("gCBtnLPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Right_HUD_Margin;};
sCButtonPosX[0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL);
} else if (CVar_GetS32("gCBtnLPosType", 0) == 3) {//Anchor None
sCButtonPosX[0] = CVar_GetS32("gCBtnLPosX", 0);
}
} else {
sCButtonPosX[0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[0][0]);
sCButtonPosY[0] = ItemIconPos_ori[0][1];
}
//C Button down
if (CVar_GetS32("gCBtnDPosType", 0) != 0) {
sCButtonPosY[1] = CVar_GetS32("gCBtnDPosY", 0)+Y_Margins_CD;
if (CVar_GetS32("gCBtnDPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Left_HUD_Margin;};
sCButtonPosX[1] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD);
} else if (CVar_GetS32("gCBtnDPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Right_HUD_Margin;};
sCButtonPosX[1] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD);
} else if (CVar_GetS32("gCBtnDPosType", 0) == 3) {//Anchor None
sCButtonPosX[1] = CVar_GetS32("gCBtnDPosX", 0);
}
} else {
sCButtonPosX[1] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[1][0]);
sCButtonPosY[1] = ItemIconPos_ori[1][1];
}
//C button Right
if (CVar_GetS32("gCBtnRPosType", 0) != 0) {
sCButtonPosY[2] = CVar_GetS32("gCBtnRPosY", 0)+Y_Margins_CR;
if (CVar_GetS32("gCBtnRPosType", 0) == 1) {//Anchor Left
if (CVar_GetS32("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Left_HUD_Margin;};
sCButtonPosX[2] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR);
} else if (CVar_GetS32("gCBtnRPosType", 0) == 2) {//Anchor Right
if (CVar_GetS32("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Right_HUD_Margin;};
sCButtonPosX[2] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR);
} else if (CVar_GetS32("gCBtnRPosType", 0) == 3) {//Anchor None
sCButtonPosX[2] = CVar_GetS32("gCBtnRPosX", 0);
}
} else {
sCButtonPosX[2] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[2][0]);
sCButtonPosY[2] = ItemIconPos_ori[2][1];
}
sCButtonPosX[0] = sCButtonPosX[0] - 160;
sCButtonPosY[0] = 120 - sCButtonPosY[0];
sCButtonPosX[1] = sCButtonPosX[1] - 160;
sCButtonPosY[1] = 120 - sCButtonPosY[1];
sCButtonPosX[2] = sCButtonPosX[2] - 160;
sCButtonPosY[2] = 120 - sCButtonPosY[2];
sCButtonPosX[3] = sCButtonPosX[3] - 160;
sCButtonPosY[3] = 120 - sCButtonPosY[3];
sCButtonPosX[4] = sCButtonPosX[4] - 160;
sCButtonPosY[4] = 120 - sCButtonPosY[4];
sCButtonPosX[5] = sCButtonPosX[5] - 160;
sCButtonPosY[5] = 120 - sCButtonPosY[5];
sCButtonPosX[6] = sCButtonPosX[6] - 160;
sCButtonPosY[6] = 120 - sCButtonPosY[6];
if (sEquipState == 0) {
pauseCtx->equipAnimAlpha += 14;
if (pauseCtx->equipAnimAlpha > 255) {
@ -598,7 +762,7 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) {
offsetX = ABS(pauseCtx->equipAnimX - bowItemVtx->v.ob[0] * 10) / sEquipMoveTimer;
offsetY = ABS(pauseCtx->equipAnimY - bowItemVtx->v.ob[1] * 10) / sEquipMoveTimer;
} else {
offsetX = ABS(pauseCtx->equipAnimX - OTRGetRectDimensionFromRightEdge(sCButtonPosX[pauseCtx->equipTargetCBtn]) * 10) / sEquipMoveTimer;
offsetX = ABS(pauseCtx->equipAnimX - sCButtonPosX[pauseCtx->equipTargetCBtn] * 10) / sEquipMoveTimer;
offsetY = ABS(pauseCtx->equipAnimY - sCButtonPosY[pauseCtx->equipTargetCBtn] * 10) / sEquipMoveTimer;
}
@ -628,7 +792,7 @@ void KaleidoScope_UpdateItemEquip(GlobalContext* globalCtx) {
pauseCtx->equipAnimY += offsetY;
}
} else {
if (pauseCtx->equipAnimX >= OTRGetRectDimensionFromRightEdge(sCButtonPosX[pauseCtx->equipTargetCBtn]) * 10) {
if (pauseCtx->equipAnimX >= sCButtonPosX[pauseCtx->equipTargetCBtn] * 10) {
pauseCtx->equipAnimX -= offsetX;
} else {
pauseCtx->equipAnimX += offsetX;