mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
ADD: More HUD Editor Widescreen Support (#179)
* ADD: Key Counter, Skultula Counter TODO: Check why SKulltula counter texture doesn't move, TextureBlock??? * ADD: Skulltula icon position * Tweak: Whitespace * TWEAK: Skulltula Y value * FIX: Tatl
This commit is contained in:
@@ -7,16 +7,18 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v);
|
||||
HudEditorElementID hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
|
||||
|
||||
HudEditorElement hudEditorElements[HUD_EDITOR_ELEMENT_MAX] = {
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_B, "B Button", "B", 167, 17, 100, 255, 120, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_C_LEFT, "C-Left Button", "CLeft", 227, 18, 255, 240, 0, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_C_DOWN, "C-Down Button", "CDown", 249, 34, 255, 240, 0, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_C_RIGHT, "C-Right Button", "CRight", 271, 18, 255, 240, 0, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_A, "A Button", "A", 191, 18, 100, 200, 255, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_C_UP, "C-Up Button", "CUp", 254, 16, 255, 240, 0, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_START, "Start Button", "Start", 136, 17, 255, 130, 60, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_MAGIC_METER, "Magic", "Magic", 18, 34, 0, 200, 0, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_HEARTS, "Hearts", "Hearts", 30, 26, 255, 70, 50, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_RUPEE_COUNTER, "Rupees", "Rupees", 26, 206, 200, 255, 100, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_B, "B Button", "B", 167, 17, 100, 255, 120, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_C_LEFT, "C-Left Button", "CLeft", 227, 18, 255, 240, 0, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_C_DOWN, "C-Down Button", "CDown", 249, 34, 255, 240, 0, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_C_RIGHT, "C-Right Button", "CRight", 271, 18, 255, 240, 0, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_A, "A Button", "A", 191, 18, 100, 200, 255, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_C_UP, "C-Up Button", "CUp", 254, 16, 255, 240, 0, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_START, "Start Button", "Start", 136, 17, 255, 130, 60, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_MAGIC_METER, "Magic", "Magic", 18, 34, 0, 200, 0, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_HEARTS, "Hearts", "Hearts", 30, 26, 255, 70, 50, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_RUPEE_COUNTER, "Rupees", "Rupees", 26, 206, 200, 255, 100, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_KEY_COUNTER, "Keys", "Keys", 26, 190, 255, 255, 255, 255),
|
||||
HUD_EDITOR_ELEMENT(HUD_EDITOR_ELEMENT_SKULLTULA_COUNTER, "Skulltulas", "Skulltulas", 26, 190, 255, 255, 255, 255),
|
||||
};
|
||||
|
||||
extern "C" bool HudEditor_ShouldOverrideDraw() {
|
||||
@@ -94,6 +96,8 @@ void HudEditorWindow::DrawElement() {
|
||||
CVarSetInteger(hudEditorElements[HUD_EDITOR_ELEMENT_MAGIC_METER].modeCvar, HUD_EDITOR_ELEMENT_MODE_MOVABLE_LEFT);
|
||||
CVarSetInteger(hudEditorElements[HUD_EDITOR_ELEMENT_HEARTS].modeCvar, HUD_EDITOR_ELEMENT_MODE_MOVABLE_LEFT);
|
||||
CVarSetInteger(hudEditorElements[HUD_EDITOR_ELEMENT_RUPEE_COUNTER].modeCvar, HUD_EDITOR_ELEMENT_MODE_MOVABLE_LEFT);
|
||||
CVarSetInteger(hudEditorElements[HUD_EDITOR_ELEMENT_KEY_COUNTER].modeCvar, HUD_EDITOR_ELEMENT_MODE_MOVABLE_LEFT);
|
||||
CVarSetInteger(hudEditorElements[HUD_EDITOR_ELEMENT_SKULLTULA_COUNTER].modeCvar, HUD_EDITOR_ELEMENT_MODE_MOVABLE_LEFT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ typedef enum {
|
||||
HUD_EDITOR_ELEMENT_MAGIC_METER,
|
||||
HUD_EDITOR_ELEMENT_HEARTS,
|
||||
HUD_EDITOR_ELEMENT_RUPEE_COUNTER,
|
||||
HUD_EDITOR_ELEMENT_KEY_COUNTER,
|
||||
HUD_EDITOR_ELEMENT_SKULLTULA_COUNTER,
|
||||
HUD_EDITOR_ELEMENT_MAX,
|
||||
} HudEditorElementID;
|
||||
|
||||
|
||||
+115
-7
@@ -4289,8 +4289,33 @@ void Interface_DrawItemButtons(PlayState* play) {
|
||||
gDPLoadTextureBlock_4b(OVERLAY_DISP++, cUpLabelTextures[gSaveContext.options.language], G_IM_FMT_IA, 32, 12,
|
||||
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);
|
||||
gSPTextureRectangle(OVERLAY_DISP++, 0x03DC, 0x0048, 0x045C, 0x0078, G_TX_RENDERTILE, 0, 0, 1 << 10,
|
||||
1 << 10);
|
||||
|
||||
// #region 2S2H [Cosmetic] Hud Editor
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_C_UP);
|
||||
if (HudEditor_ShouldOverrideDraw()) {
|
||||
if (CVarGetInteger(hudEditorElements[hudEditorActiveElement].modeCvar, HUD_EDITOR_ELEMENT_MODE_VANILLA) == HUD_EDITOR_ELEMENT_MODE_HIDDEN) {
|
||||
hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
|
||||
} else {
|
||||
// All of this information was derived from the original call to gSPTextureRectangle below
|
||||
s16 rectLeft = 0x03DC / 4;
|
||||
s16 rectTop = 0x0048 / 4;
|
||||
s16 rectWidth = 0x045C / 4;
|
||||
s16 rectHeight = (0x0078 / 4) - rectTop;
|
||||
s16 dsdx = 512;
|
||||
s16 dtdy = 512;
|
||||
|
||||
HudEditor_ModifyDrawValues(&rectLeft, &rectTop, &rectWidth, &rectHeight, &dsdx, &dtdy);
|
||||
|
||||
hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
|
||||
|
||||
gSPWideTextureRectangle(OVERLAY_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2,
|
||||
(rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, dsdx << 1, dtdy << 1);
|
||||
}
|
||||
} else {
|
||||
// #endregion
|
||||
gSPTextureRectangle(OVERLAY_DISP++, 0x03DC, 0x0048, 0x045C, 0x0078, G_TX_RENDERTILE, 0, 0, 1 << 10,
|
||||
1 << 10);
|
||||
}
|
||||
}
|
||||
|
||||
sCUpTimer--;
|
||||
@@ -6689,6 +6714,8 @@ void Interface_Draw(PlayState* play) {
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 230, 255, interfaceCtx->magicAlpha);
|
||||
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 20, 255);
|
||||
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_KEY_COUNTER);
|
||||
OVERLAY_DISP = Gfx_DrawTexRectIA8(OVERLAY_DISP, gSmallKeyCounterIconTex, 16, 16, 26, 190, 16, 16,
|
||||
1 << 10, 1 << 10);
|
||||
|
||||
@@ -6725,13 +6752,40 @@ void Interface_Draw(PlayState* play) {
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->magicAlpha);
|
||||
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_KEY_COUNTER);
|
||||
OVERLAY_DISP = Gfx_DrawTexRectI8(OVERLAY_DISP, sCounterTextures[counterDigits[3]], 8, 16, sp2CA + 1,
|
||||
191, 8, 16, 1 << 10, 1 << 10);
|
||||
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
|
||||
gSPTextureRectangle(OVERLAY_DISP++, sp2CA * 4, 760, (sp2CA * 4) + 0x20, 824, G_TX_RENDERTILE, 0, 0,
|
||||
1 << 10, 1 << 10);
|
||||
|
||||
// #region 2S2H [Cosmetic] Hud Editor
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_KEY_COUNTER);
|
||||
if (HudEditor_ShouldOverrideDraw()) {
|
||||
if (CVarGetInteger(hudEditorElements[hudEditorActiveElement].modeCvar, HUD_EDITOR_ELEMENT_MODE_VANILLA) == HUD_EDITOR_ELEMENT_MODE_HIDDEN) {
|
||||
hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
|
||||
} else {
|
||||
// All of this information was derived from the original call to gSPTextureRectangle below
|
||||
s16 rectLeft = sp2CA;
|
||||
s16 rectTop = 760 / 4;
|
||||
s16 rectWidth = 0x20 / 4;
|
||||
s16 rectHeight = (824 / 4) - rectTop;
|
||||
s16 dsdx = 512;
|
||||
s16 dtdy = 512;
|
||||
|
||||
HudEditor_ModifyDrawValues(&rectLeft, &rectTop, &rectWidth, &rectHeight, &dsdx, &dtdy);
|
||||
|
||||
hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
|
||||
|
||||
gSPWideTextureRectangle(OVERLAY_DISP++, rectLeft << 2, rectTop << 2,
|
||||
(rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2,
|
||||
G_TX_RENDERTILE, 0, 0, dsdx << 1, dtdy << 1);
|
||||
}
|
||||
// #endregion
|
||||
} else {
|
||||
gSPTextureRectangle(OVERLAY_DISP++, sp2CA * 4, 760, (sp2CA * 4) + 0x20, 824, G_TX_RENDERTILE, 0,
|
||||
0, 1 << 10, 1 << 10);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -6742,10 +6796,37 @@ void Interface_Draw(PlayState* play) {
|
||||
gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
|
||||
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255);
|
||||
|
||||
gDPLoadTextureBlock(OVERLAY_DISP++, gGoldSkulltulaCounterIconTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 24, 24, // 2S2H [Port] This last 24 was 18 in the minibuild, not sure why
|
||||
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);
|
||||
gSPTextureRectangle(OVERLAY_DISP++, 80, 748, 176, 820, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
|
||||
// #region 2S2H [Cosmetic] Hud Editor
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_SKULLTULA_COUNTER);
|
||||
if (HudEditor_ShouldOverrideDraw()) {
|
||||
if (CVarGetInteger(hudEditorElements[hudEditorActiveElement].modeCvar, HUD_EDITOR_ELEMENT_MODE_VANILLA) == HUD_EDITOR_ELEMENT_MODE_HIDDEN) {
|
||||
hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
|
||||
} else {
|
||||
// All of this information was derived from the original call to gSPTextureRectangle below
|
||||
s16 rectLeft = 80 / 4;
|
||||
s16 rectTop = 748 / 4;
|
||||
s16 rectWidth = 176 / 4;
|
||||
s16 rectHeight = (820 / 4) - rectTop;
|
||||
s16 dsdx = 512;
|
||||
s16 dtdy = 512;
|
||||
|
||||
HudEditor_ModifyDrawValues(&rectLeft, &rectTop, &rectWidth, &rectHeight, &dsdx, &dtdy);
|
||||
|
||||
hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
|
||||
|
||||
gSPWideTextureRectangle(OVERLAY_DISP++, rectLeft << 2, rectTop << 2,
|
||||
(rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2,
|
||||
G_TX_RENDERTILE, 0, 0, dsdx << 1, dtdy << 1);
|
||||
}
|
||||
} else {
|
||||
// #endregion
|
||||
gSPTextureRectangle(OVERLAY_DISP++, 80, 748, 176, 820, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
|
||||
}
|
||||
|
||||
// Gold Skulluta Counter
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
@@ -6779,13 +6860,40 @@ void Interface_Draw(PlayState* play) {
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->magicAlpha);
|
||||
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_SKULLTULA_COUNTER);
|
||||
OVERLAY_DISP = Gfx_DrawTexRectI8(OVERLAY_DISP, sCounterTextures[counterDigits[3]], 8, 16, sp2CA + 1, 191,
|
||||
8, 16, 1 << 10, 1 << 10);
|
||||
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
|
||||
gSPTextureRectangle(OVERLAY_DISP++, sp2CA * 4, 760, (sp2CA * 4) + 0x20, 824, G_TX_RENDERTILE, 0, 0,
|
||||
1 << 10, 1 << 10);
|
||||
|
||||
// #region 2S2H [Cosmetic] Hud Editor
|
||||
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_SKULLTULA_COUNTER);
|
||||
if (HudEditor_ShouldOverrideDraw()) {
|
||||
if (CVarGetInteger(hudEditorElements[hudEditorActiveElement].modeCvar, HUD_EDITOR_ELEMENT_MODE_VANILLA) == HUD_EDITOR_ELEMENT_MODE_HIDDEN) {
|
||||
hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
|
||||
} else {
|
||||
// All of this information was derived from the original call to gSPTextureRectangle below
|
||||
s16 rectLeft = sp2CA;
|
||||
s16 rectTop = 760 / 4;
|
||||
s16 rectWidth = 0x20 / 4;
|
||||
s16 rectHeight = (824 / 4) - rectTop;
|
||||
s16 dsdx = 512;
|
||||
s16 dtdy = 512;
|
||||
|
||||
HudEditor_ModifyDrawValues(&rectLeft, &rectTop, &rectWidth, &rectHeight, &dsdx, &dtdy);
|
||||
|
||||
hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
|
||||
|
||||
gSPWideTextureRectangle(OVERLAY_DISP++, rectLeft << 2, rectTop << 2,
|
||||
(rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2,
|
||||
G_TX_RENDERTILE, 0, 0, dsdx << 1, dtdy << 1);
|
||||
}
|
||||
// #endregion
|
||||
} else {
|
||||
gSPTextureRectangle(OVERLAY_DISP++, sp2CA * 4, 760, (sp2CA * 4) + 0x20, 824, G_TX_RENDERTILE, 0,
|
||||
0, 1 << 10, 1 << 10);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user