diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index 51e092017..5e2843f06 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -1,6 +1,7 @@ #include "z_kaleido_scope.h" #include "textures/icon_item_static/icon_item_static.h" #include "textures/parameter_static/parameter_static.h" +#include "soh/Enhancements/cosmetics/cosmeticsTypes.h" static u8 sChildUpgrades[] = { UPG_BULLET_BAG, UPG_BOMB_BAG, UPG_STRENGTH, UPG_SCALE }; static u8 sAdultUpgrades[] = { UPG_QUIVER, UPG_BOMB_BAG, UPG_STRENGTH, UPG_SCALE }; @@ -14,6 +15,15 @@ static u8 sEquipmentItemOffsets[] = { 0x00, 0x00, 0x01, 0x02, 0x00, 0x03, 0x04, 0x05, 0x00, 0x06, 0x07, 0x08, 0x00, 0x09, 0x0A, 0x0B, }; +// Vertices for A button indicator (coordinates 0.75x the texture size) +// pt (-97, -36) +static Vtx sStrengthAButtonVtx[] = { + VTX(-9, 6, 0, 0 << 5, 0 << 5, 0xFF, 0xFF, 0xFF, 0xFF), + VTX( 9, 6, 0, 24 << 5, 0 << 5, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(-9, -6, 0, 0 << 5, 16 << 5, 0xFF, 0xFF, 0xFF, 0xFF), + VTX( 9, -6, 0, 24 << 5, 16 << 5, 0xFF, 0xFF, 0xFF, 0xFF), +}; + static s16 sEquipTimer = 0; void KaleidoScope_DrawEquipmentImage(PlayState* play, void* source, u32 width, u32 height) { @@ -89,6 +99,30 @@ void KaleidoScope_DrawEquipmentImage(PlayState* play, void* source, u32 width, u CLOSE_DISPS(play->state.gfxCtx); } +void KaleidoScope_DrawAButton(PlayState* play, Vtx* vtx, int16_t xTranslate, int16_t yTranslate) { + PauseContext* pauseCtx = &play->pauseCtx; + OPEN_DISPS(play->state.gfxCtx); + Matrix_Push(); + + Matrix_Translate(xTranslate, yTranslate, 0, MTXMODE_APPLY); + gSPMatrix(POLY_KAL_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + Color_RGB8 aButtonColor = { 0, 100, 255 }; + if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { + aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor); + } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + aButtonColor = (Color_RGB8){ 0, 255, 100 }; + } + + gSPVertex(POLY_KAL_DISP++, vtx, 4, 0); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, aButtonColor.r, aButtonColor.g, aButtonColor.b, pauseCtx->alpha); + gDPLoadTextureBlock(POLY_KAL_DISP++, gABtnSymbolTex, G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 4, G_TX_NOLOD, G_TX_NOLOD); + gSP1Quadrangle(POLY_KAL_DISP++, 0, 2, 3, 1, 0); + Matrix_Pop(); + gSPMatrix(POLY_KAL_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + CLOSE_DISPS(play->state.gfxCtx); +} + Vec3s link_kaleido_rot = { 0, 32300, 0 }; // Default rotation link face us. void KaleidoScope_DrawPlayerWork(PlayState* play) { @@ -686,18 +720,18 @@ void KaleidoScope_DrawEquipment(PlayState* play) { // Add zoom effect to strength item if cursor is hovering over it when toggle option is on if ((pauseCtx->cursorX[PAUSE_EQUIP] == 0) && (pauseCtx->cursorY[PAUSE_EQUIP] == 2) && - CVarGetInteger("gToggleStrength", 0)) { - i = 2; // row - k = 0; // column - j = 16 * i + 4 * k; // vtx index - pauseCtx->equipVtx[j].v.ob[0] = pauseCtx->equipVtx[j + 2].v.ob[0] = - pauseCtx->equipVtx[j].v.ob[0] - 2; - pauseCtx->equipVtx[j + 1].v.ob[0] = pauseCtx->equipVtx[j + 3].v.ob[0] = - pauseCtx->equipVtx[j + 1].v.ob[0] + 4; - pauseCtx->equipVtx[j].v.ob[1] = pauseCtx->equipVtx[j + 1].v.ob[1] = - pauseCtx->equipVtx[j].v.ob[1] + 2; - pauseCtx->equipVtx[j + 2].v.ob[1] = pauseCtx->equipVtx[j + 3].v.ob[1] = - pauseCtx->equipVtx[j + 2].v.ob[1] - 4; + CVarGetInteger("gToggleStrength", 0) && pauseCtx->cursorSpecialPos == 0) { + u8 row = 2; + u8 column = 0; + u8 equipVtxIndex = 16 * row + 4 * column; + pauseCtx->equipVtx[equipVtxIndex].v.ob[0] = pauseCtx->equipVtx[equipVtxIndex + 2].v.ob[0] = + pauseCtx->equipVtx[equipVtxIndex].v.ob[0] - 2; + pauseCtx->equipVtx[equipVtxIndex + 1].v.ob[0] = pauseCtx->equipVtx[equipVtxIndex + 3].v.ob[0] = + pauseCtx->equipVtx[equipVtxIndex + 1].v.ob[0] + 4; + pauseCtx->equipVtx[equipVtxIndex].v.ob[1] = pauseCtx->equipVtx[equipVtxIndex + 1].v.ob[1] = + pauseCtx->equipVtx[equipVtxIndex].v.ob[1] + 2; + pauseCtx->equipVtx[equipVtxIndex + 2].v.ob[1] = pauseCtx->equipVtx[equipVtxIndex + 3].v.ob[1] = + pauseCtx->equipVtx[equipVtxIndex + 2].v.ob[1] - 4; } Gfx_SetupDL_42Opa(play->state.gfxCtx); @@ -765,6 +799,20 @@ void KaleidoScope_DrawEquipment(PlayState* play) { } } + // Render A button indicator when hovered over strength + if ((pauseCtx->cursorX[PAUSE_EQUIP] == 0) && (pauseCtx->cursorY[PAUSE_EQUIP] == 2) && + CVarGetInteger("gToggleStrength", 0) && pauseCtx->cursorSpecialPos == 0 + && pauseCtx->unk_1E4 == 0 && pauseCtx->state == 6) { + u8 row = 2; + u8 column = 0; + u8 equipVtxIndex = 16 * row + 4 * column; + // Get Bottom Bisector of the Quad + s16 translateX = (pauseCtx->equipVtx[equipVtxIndex].v.ob[0] + pauseCtx->equipVtx[equipVtxIndex + 1].v.ob[0]) / 2; + // Add 4 since the icon will be zoomed in on + s16 translateY = pauseCtx->equipVtx[equipVtxIndex + 2].v.ob[1] + 4; + KaleidoScope_DrawAButton(play, sStrengthAButtonVtx, translateX, translateY); + } + KaleidoScope_DrawPlayerWork(play); //if ((pauseCtx->unk_1E4 == 7) && (sEquipTimer == 10)) {