From 6d2e828520ef9b84318de58c9ab7eb3f07e5de30 Mon Sep 17 00:00:00 2001 From: Stardust Sauce Date: Sat, 2 Apr 2022 23:42:14 -0400 Subject: [PATCH] Assetized all remaining variables for N64-ification --- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 62 ++++++++++++------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index a5c160700..089092b3a 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -14,6 +14,8 @@ #include "vt.h" #include "SohHooks.h" +#include + static void* sEquipmentFRATexs[] = { gPauseEquipment00FRATex, gPauseEquipment01Tex, gPauseEquipment02Tex, gPauseEquipment03Tex, gPauseEquipment04Tex, gPauseEquipment10FRATex, gPauseEquipment11Tex, gPauseEquipment12Tex, gPauseEquipment13Tex, gPauseEquipment14Tex, @@ -713,6 +715,8 @@ static s16 D_8082ABA4 = 0; static s16 sInDungeonScene = false; +static Color_RGB8 savePromptColor; + static f32 D_8082ABAC[] = { -4.0f, 4.0f, 4.0f, 4.0f, 4.0f, -4.0f, -4.0f, -4.0f, }; @@ -754,11 +758,7 @@ static void* sCursorTexs[] = { gPauseMenuCursorBottomRightTex, }; -static s16 sCursorColors[][3] = { - { 255, 255, 255 }, - { 255, 255, 0 }, - { 0, 255, 50 }, -}; +static Color_RGB8 sCursorColors[3]; static void* sSavePromptTexs[] = { gPauseSavePromptENGTex, @@ -991,6 +991,13 @@ void KaleidoScope_DrawCursor(GlobalContext* globalCtx, u16 pageIndex) { PauseContext* pauseCtx = &globalCtx->pauseCtx; u16 temp; + // Initiailize static cursor variables + if (sCursorColors[0].r == NULL) { + sCursorColors[0] = *(Color_RGB8*)ResourceMgr_LoadBlobByName(colorPauseCursorNoEquip); + sCursorColors[1] = *(Color_RGB8*)ResourceMgr_LoadBlobByName(colorPauseCursorCEquip); + sCursorColors[2] = *(Color_RGB8*)ResourceMgr_LoadBlobByName(colorPauseCursorAEquip); + } + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_scope_PAL.c", 955); temp = pauseCtx->unk_1E4; @@ -1005,9 +1012,9 @@ void KaleidoScope_DrawCursor(GlobalContext* globalCtx, u16 pageIndex) { gDPPipeSync(POLY_KAL_DISP++); gDPSetCombineLERP(POLY_KAL_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, sCursorColors[pauseCtx->cursorColorSet >> 2][0], - sCursorColors[pauseCtx->cursorColorSet >> 2][1], - sCursorColors[pauseCtx->cursorColorSet >> 2][2], 255); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, sCursorColors[pauseCtx->cursorColorSet >> 2].r, + sCursorColors[pauseCtx->cursorColorSet >> 2].g, + sCursorColors[pauseCtx->cursorColorSet >> 2].b, 255); gDPSetEnvColor(POLY_KAL_DISP++, D_8082AB8C, D_8082AB90, D_8082AB94, 255); gSPVertex(POLY_KAL_DISP++, pauseCtx->cursorVtx, 16, 0); @@ -1061,9 +1068,16 @@ Gfx* KaleidoScope_DrawPageSections(Gfx* gfx, Vtx* vertices, void** textures) { } void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { - static s16 D_8082ACF4[][3] = { - { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 255, 255, 0 }, { 0, 0, 0 }, - { 0, 0, 0 }, { 255, 255, 0 }, { 0, 255, 50 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 255, 50 }, + // Initiailize static cursor variables + if (sCursorColors[0].r == NULL) { + sCursorColors[0] = *(Color_RGB8*)ResourceMgr_LoadBlobByName(colorPauseCursorNoEquip); + sCursorColors[1] = *(Color_RGB8*)ResourceMgr_LoadBlobByName(colorPauseCursorCEquip); + sCursorColors[2] = *(Color_RGB8*)ResourceMgr_LoadBlobByName(colorPauseCursorAEquip); + } + + Color_RGB8 D_8082ACF4[] = { + { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, sCursorColors[1], { 0, 0, 0 }, + { 0, 0, 0 }, sCursorColors[1], sCursorColors[2], { 0, 0, 0 }, { 0, 0, 0 }, sCursorColors[2], }; static s16 D_8082AD3C = 20; static s16 D_8082AD40 = 0; @@ -1080,20 +1094,20 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { if ((pauseCtx->state < 8) || (pauseCtx->state > 0x11)) { if (pauseCtx->state != 7) { - stepR = ABS(D_8082AB8C - D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][0]) / D_8082AD3C; - stepG = ABS(D_8082AB90 - D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][1]) / D_8082AD3C; - stepB = ABS(D_8082AB94 - D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][2]) / D_8082AD3C; - if (D_8082AB8C >= D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][0]) { + stepR = ABS(D_8082AB8C - D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40].r) / D_8082AD3C; + stepG = ABS(D_8082AB90 - D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40].g) / D_8082AD3C; + stepB = ABS(D_8082AB94 - D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40].b) / D_8082AD3C; + if (D_8082AB8C >= D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40].r) { D_8082AB8C -= stepR; } else { D_8082AB8C += stepR; } - if (D_8082AB90 >= D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][1]) { + if (D_8082AB90 >= D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40].g) { D_8082AB90 -= stepG; } else { D_8082AB90 += stepG; } - if (D_8082AB94 >= D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][2]) { + if (D_8082AB94 >= D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40].b) { D_8082AB94 -= stepB; } else { D_8082AB94 += stepB; @@ -1101,9 +1115,9 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { D_8082AD3C--; if (D_8082AD3C == 0) { - D_8082AB8C = D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][0]; - D_8082AB90 = D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][1]; - D_8082AB94 = D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][2]; + D_8082AB8C = D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40].r; + D_8082AB90 = D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40].g; + D_8082AB94 = D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40].b; D_8082AD3C = ZREG(28 + D_8082AD40); D_8082AD40++; if (D_8082AD40 >= 4) { @@ -1386,13 +1400,17 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { gSPVertex(POLY_KAL_DISP++, &pauseCtx->saveVtx[60], 32, 0); + if (savePromptColor.r == NULL) { + savePromptColor = *(Color_RGB8*) ResourceMgr_LoadBlobByName(colorPauseSavePrompt); + } + if (((pauseCtx->state == 7) && (pauseCtx->unk_1EC < 4)) || (pauseCtx->state == 0xE)) { POLY_KAL_DISP = KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, sSavePromptTexs[gSaveContext.language], 152, 16, 0); gDPSetCombineLERP(POLY_KAL_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 100, 255, 100, VREG(61)); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, savePromptColor.r, savePromptColor.g, savePromptColor.b, VREG(61)); if (pauseCtx->promptChoice == 0) { gSPDisplayList(POLY_KAL_DISP++, gPromptCursorLeftDL); @@ -1416,7 +1434,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { gDPSetCombineLERP(POLY_KAL_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 100, 255, 100, VREG(61)); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, savePromptColor.r, savePromptColor.g, savePromptColor.b, VREG(61)); if (pauseCtx->promptChoice == 0) { gSPDisplayList(POLY_KAL_DISP++, gPromptCursorLeftDL);