summaryrefslogtreecommitdiff
path: root/mm/src/code
diff options
context:
space:
mode:
authorinspectredc <78732756+inspectredc@users.noreply.github.com>2024-05-06 22:51:43 +0100
committerGarrett Cox <garrettjcox@gmail.com>2024-05-22 09:05:03 -0500
commit5fe3e350fa6b72f2b7a16cf807600af3e1ec5e81 (patch)
tree3aa3127e6213a13393ae361305077b73e63dfc8b /mm/src/code
parent5a8989bdbe1372182a9c335785422ce5e2b8c07c (diff)
Fix Skulltula Counter Hud Editor (#308)
Diffstat (limited to 'mm/src/code')
-rw-r--r--mm/src/code/z_parameter.c66
1 files changed, 46 insertions, 20 deletions
diff --git a/mm/src/code/z_parameter.c b/mm/src/code/z_parameter.c
index d2490db83..2bba67637 100644
--- a/mm/src/code/z_parameter.c
+++ b/mm/src/code/z_parameter.c
@@ -6942,36 +6942,22 @@ 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[2]], 8, 16, 43, 191, 8,
16, 1 << 10, 1 << 10);
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
- gSPTextureRectangle(OVERLAY_DISP++, 168, 760, 200, 824, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
-
- sp2CA += 8;
- }
-
- 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);
-
- // #region 2S2H [Cosmetic] Hud Editor
+ // #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 rectLeft = 168 / 4;
s16 rectTop = 760 / 4;
- s16 rectWidth = 0x20 / 4;
+ s16 rectWidth = (200 / 4) - rectLeft;
s16 rectHeight = (824 / 4) - rectTop;
s16 dsdx = 512;
s16 dtdy = 512;
@@ -6986,9 +6972,49 @@ void Interface_Draw(PlayState* play) {
}
// #endregion
} else {
- gSPTextureRectangle(OVERLAY_DISP++, sp2CA * 4, 760, (sp2CA * 4) + 0x20, 824, G_TX_RENDERTILE, 0,
- 0, 1 << 10, 1 << 10);
+ gSPTextureRectangle(OVERLAY_DISP++, 168, 760, 200, 824, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
+ }
+
+ sp2CA += 8;
+ }
+
+ 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);
+
+ // #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: