HUD Editor support for minigame counters (#363)

This commit is contained in:
Archez
2024-05-22 09:05:04 -05:00
committed by Garrett Cox
parent 0287fa2fef
commit 8670cf5957
3 changed files with 32 additions and 2 deletions
+2
View File
@@ -18,6 +18,7 @@ HudEditorElement hudEditorElements[HUD_EDITOR_ELEMENT_MAX] = {
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_MINIGAME_COUNTER, "Minigames", "Minigames", 20, 67, 255, 255, 255, 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),
@@ -142,6 +143,7 @@ void HudEditorWindow::DrawElement() {
CVarSetInteger(hudEditorElements[HUD_EDITOR_ELEMENT_START].modeCvar, HUD_EDITOR_ELEMENT_MODE_MOVABLE_RIGHT);
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_MINIGAME_COUNTER].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);
+1
View File
@@ -33,6 +33,7 @@ typedef enum {
HUD_EDITOR_ELEMENT_START,
HUD_EDITOR_ELEMENT_MAGIC_METER,
HUD_EDITOR_ELEMENT_HEARTS,
HUD_EDITOR_ELEMENT_MINIGAME_COUNTER,
HUD_EDITOR_ELEMENT_RUPEE_COUNTER,
HUD_EDITOR_ELEMENT_KEY_COUNTER,
HUD_EDITOR_ELEMENT_SKULLTULA_COUNTER,
+29 -2
View File
@@ -7662,8 +7662,33 @@ void Interface_DrawMinigameIcons(PlayState* play) {
G_TX_NOLOD, G_TX_NOLOD);
}
gSPTextureRectangle(OVERLAY_DISP++, (rectX << 2), (rectY << 2), ((rectX + width) << 2),
((rectY + height) << 2), G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
// #region 2S2H [Cosmetic] Hud Editor
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_MINIGAME_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 {
s16 newRectX = rectX;
s16 newRectY = rectY;
s16 newWidth = width;
s16 newHeight = height;
u16 dsdx = 512;
u16 dtdy = 512;
HudEditor_ModifyDrawValues(&newRectX, &newRectY, &newWidth, &newHeight, &dsdx, &dtdy);
hudEditorActiveElement = HUD_EDITOR_ELEMENT_NONE;
gSPWideTextureRectangle(OVERLAY_DISP++, (newRectX << 2), (newRectY << 2),
((newRectX + newWidth) << 2), ((newRectY + newHeight) << 2),
G_TX_RENDERTILE, 0, 0, dsdx << 1, dtdy << 1);
}
} else {
// #endregion
gSPTextureRectangle(OVERLAY_DISP++, (rectX << 2), (rectY << 2), ((rectX + width) << 2),
((rectY + height) << 2), G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
}
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->bAlpha);
gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0,
@@ -7682,6 +7707,8 @@ void Interface_DrawMinigameIcons(PlayState* play) {
for (i = 0, numDigitsDrawn = 0; i < 4; i++) {
if ((sMinigameScoreDigits[i] != 0) || (numDigitsDrawn != 0) || (i >= 3)) {
// 2S2H [Cosmetic] Hud Editor
HudEditor_SetActiveElement(HUD_EDITOR_ELEMENT_MINIGAME_COUNTER);
OVERLAY_DISP = Gfx_DrawTexRectI8(OVERLAY_DISP, sCounterTextures[sMinigameScoreDigits[i]], 8, 0x10,
rectX, rectY - 2, 9, 0xFA, 0x370, 0x370);
rectX += 9;