From b40e51d8c85d156850290cce654647a46a86a615 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 24 Aug 2024 06:44:16 +0200 Subject: [PATCH] [ntsc-1.2] Match kaleido_collect.c, kaleido_scope.c (#2070) * Match kaleido_{collect,scope} * review --- include/n64dd.h | 3 +- .../ovl_kaleido_scope/z_kaleido_collect.c | 75 ++++++++------- .../misc/ovl_kaleido_scope/z_kaleido_scope.c | 91 +++++++++++++------ tools/disasm/ntsc-1.2/variables.txt | 4 + 4 files changed, 113 insertions(+), 60 deletions(-) diff --git a/include/n64dd.h b/include/n64dd.h index 8c756ce692..85ffc02263 100644 --- a/include/n64dd.h +++ b/include/n64dd.h @@ -25,7 +25,8 @@ typedef struct n64ddStruct_80121AF0 { char unk_08[0x34]; void (*unk_3C)(void); void (*unk_40)(void); - char unk_44[0x28]; + s32 (*unk_44)(struct PlayState*); + char unk_48[0x24]; void (*unk_6C)(struct PlayState*, SceneDrawConfigFunc*); } n64ddStruct_80121AF0; // size = ? diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index 1a809fa970..db2b3558ec 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -2,6 +2,16 @@ #include "assets/textures/parameter_static/parameter_static.h" #include "assets/textures/icon_item_static/icon_item_static.h" +#if PLATFORM_N64 +#define KALEIDO_COLOR_COLLECT_UNK_R 80 +#define KALEIDO_COLOR_COLLECT_UNK_G 150 +#define KALEIDO_COLOR_COLLECT_UNK_B 255 +#else +#define KALEIDO_COLOR_COLLECT_UNK_R 80 +#define KALEIDO_COLOR_COLLECT_UNK_G 255 +#define KALEIDO_COLOR_COLLECT_UNK_B 150 +#endif + void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { static s16 D_8082A070[][4] = { { 255, 0, 0, 255 }, @@ -71,7 +81,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { s16 sp21A; s16 sp218; s16 sp216; - s16 pad1; + s16 phi_s7; s16 phi_v1; s16 pad2; s16 cursorItem; @@ -186,9 +196,9 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->ocarinaSongIdx = gOcarinaSongItemMap[sp216 - QUEST_SONG_MINUET]; D_8082A120 = 10; - for (phi_s3 = 0; phi_s3 < 8; phi_s3++) { - D_8082A124[phi_s3] = 0xFF; - D_8082A150[phi_s3] = 0; + for (phi_s7 = 0; phi_s7 < 8; phi_s7++) { + D_8082A124[phi_s7] = 0xFF; + D_8082A150[phi_s7] = 0; } D_8082A11C = 0; @@ -267,9 +277,9 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->cursorColorSet = 8; if (--D_8082A120 == 0) { - for (phi_s3 = 0; phi_s3 < 8; phi_s3++) { - D_8082A124[phi_s3] = 0xFF; - D_8082A150[phi_s3] = 0; + for (phi_s7 = 0; phi_s7 < 8; phi_s7++) { + D_8082A124[phi_s7] = 0xFF; + D_8082A150[phi_s7] = 0; } D_8082A11C = 0; @@ -490,7 +500,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { D_8082A124[pauseCtx->ocarinaStaff->pos - 1] = pauseCtx->ocarinaStaff->buttonIndex; } - for (sp218 = 0, phi_s3 = 0; sp218 < 8; sp218++, phi_s3 += 4, sp21A += 4) { + for (sp218 = 0, phi_s7 = 0; sp218 < 8; sp218++, phi_s7 += 4, sp21A += 4) { if (D_8082A124[sp218] == 0xFF) { break; } @@ -511,7 +521,8 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gDPPipeSync(POLY_OPA_DISP++); if (D_8082A124[sp218] == 0) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 80, 255, 150, D_8082A150[sp218]); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, KALEIDO_COLOR_COLLECT_UNK_R, KALEIDO_COLOR_COLLECT_UNK_G, + KALEIDO_COLOR_COLLECT_UNK_B, D_8082A150[sp218]); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, D_8082A150[sp218]); } @@ -531,9 +542,9 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { sp224 = pauseCtx->ocarinaSongIdx; sp226 = gOcarinaSongButtons[sp224].numButtons; - for (sp218 = sp21A, phi_s3 = 0; phi_s3 < sp226; phi_s3++, sp21A += 4) { + for (sp218 = sp21A, phi_s7 = 0; phi_s7 < sp226; phi_s7++, sp21A += 4) { pauseCtx->questVtx[sp21A + 0].v.ob[1] = pauseCtx->questVtx[sp21A + 1].v.ob[1] = - VREG(21 + gOcarinaSongButtons[sp224].buttonsIndex[phi_s3]); + VREG(21 + gOcarinaSongButtons[sp224].buttonsIndex[phi_s7]); pauseCtx->questVtx[sp21A + 2].v.ob[1] = pauseCtx->questVtx[sp21A + 3].v.ob[1] = pauseCtx->questVtx[sp21A + 0].v.ob[1] - 12; @@ -541,8 +552,9 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gDPPipeSync(POLY_OPA_DISP++); if (pauseCtx->mainState == PAUSE_MAIN_STATE_8) { - if (gOcarinaSongButtons[sp224].buttonsIndex[phi_s3] == OCARINA_BTN_A) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 80, 255, 150, 200); + if (gOcarinaSongButtons[sp224].buttonsIndex[phi_s7] == OCARINA_BTN_A) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, KALEIDO_COLOR_COLLECT_UNK_R, KALEIDO_COLOR_COLLECT_UNK_G, + KALEIDO_COLOR_COLLECT_UNK_B, 200); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, 200); } @@ -554,7 +566,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0); - gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[gOcarinaSongButtons[sp224].buttonsIndex[phi_s3]], + gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[gOcarinaSongButtons[sp224].buttonsIndex[phi_s7]], G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 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); @@ -576,37 +588,38 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { } sp21A = sp218 + 32; - phi_s3 = 0; - for (; phi_s3 < 8; phi_s3++, sp21A += 4) { - if (D_8082A124[phi_s3] == 0xFF) { + phi_s7 = 0; + for (; phi_s7 < 8; phi_s7++, sp21A += 4) { + if (D_8082A124[phi_s7] == 0xFF) { continue; } - if (D_8082A150[phi_s3] != 255) { - D_8082A150[phi_s3] += VREG(50); - if (D_8082A150[phi_s3] >= 255) { - D_8082A150[phi_s3] = 255; + if (D_8082A150[phi_s7] != 255) { + D_8082A150[phi_s7] += VREG(50); + if (D_8082A150[phi_s7] >= 255) { + D_8082A150[phi_s7] = 255; } } pauseCtx->questVtx[sp21A + 0].v.ob[1] = pauseCtx->questVtx[sp21A + 1].v.ob[1] = - VREG(21 + D_8082A124[phi_s3]); + VREG(21 + D_8082A124[phi_s7]); pauseCtx->questVtx[sp21A + 2].v.ob[1] = pauseCtx->questVtx[sp21A + 3].v.ob[1] = pauseCtx->questVtx[sp21A + 0].v.ob[1] - 12; gDPPipeSync(POLY_OPA_DISP++); - if (D_8082A124[phi_s3] == 0) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 80, 255, 150, D_8082A150[phi_s3]); + if (D_8082A124[phi_s7] == 0) { + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, KALEIDO_COLOR_COLLECT_UNK_R, KALEIDO_COLOR_COLLECT_UNK_G, + KALEIDO_COLOR_COLLECT_UNK_B, D_8082A150[phi_s7]); } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, D_8082A150[phi_s3]); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 50, D_8082A150[phi_s7]); } gDPSetEnvColor(POLY_OPA_DISP++, 10, 10, 10, 0); gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[sp21A], 4, 0); - gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[D_8082A124[phi_s3]], G_IM_FMT_IA, G_IM_SIZ_8b, 16, + gDPLoadTextureBlock(POLY_OPA_DISP++, D_8082A130[D_8082A124[phi_s7]], G_IM_FMT_IA, G_IM_SIZ_8b, 16, 16, 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); @@ -614,9 +627,9 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { } if (pauseCtx->mainState == PAUSE_MAIN_STATE_4) { - for (phi_s3 = 0; phi_s3 < 8; phi_s3++) { - D_8082A124[phi_s3] = 0xFF; - D_8082A150[phi_s3] = 0; + for (phi_s7 = 0; phi_s7 < 8; phi_s7++) { + D_8082A124[phi_s7] = 0xFF; + D_8082A150[phi_s7] = 0; } D_8082A11C = 0; @@ -652,8 +665,8 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { gSPVertex(POLY_OPA_DISP++, &pauseCtx->questVtx[164], 24, 0); - for (phi_s3 = 0, sp218 = 0, sp21A = 0; phi_s3 < 2; phi_s3++) { - if (phi_s3 == 0) { + for (phi_s7 = 0, sp218 = 0, sp21A = 0; phi_s7 < 2; phi_s7++) { + if (phi_s7 == 0) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, pauseCtx->alpha); } else if (gSaveContext.save.info.inventory.gsTokens == 100) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 200, 50, 50, pauseCtx->alpha); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index fc55446e3a..ecac60d641 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -1,3 +1,6 @@ +#if PLATFORM_N64 +#include "n64dd.h" +#endif #include "z_kaleido_scope.h" #include "assets/textures/icon_item_static/icon_item_static.h" #include "assets/textures/icon_item_24_static/icon_item_24_static.h" @@ -12,6 +15,16 @@ #include "assets/textures/icon_item_gameover_static/icon_item_gameover_static.h" #include "terminal.h" +#if PLATFORM_N64 +#define KALEIDO_COLOR_PROMPT_UNK_R 100 +#define KALEIDO_COLOR_PROMPT_UNK_G 100 +#define KALEIDO_COLOR_PROMPT_UNK_B 255 +#else +#define KALEIDO_COLOR_PROMPT_UNK_R 100 +#define KALEIDO_COLOR_PROMPT_UNK_G 255 +#define KALEIDO_COLOR_PROMPT_UNK_B 100 +#endif + #if OOT_NTSC // Japanese @@ -1422,7 +1435,8 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { gDPSetCombineLERP(POLY_OPA_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 255, 100, VREG(61)); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, KALEIDO_COLOR_PROMPT_UNK_R, KALEIDO_COLOR_PROMPT_UNK_G, + KALEIDO_COLOR_PROMPT_UNK_B, VREG(61)); if (pauseCtx->promptChoice == 0) { gSPDisplayList(POLY_OPA_DISP++, gPromptCursorLeftDL); @@ -1439,32 +1453,36 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sPromptChoiceTexs[gSaveContext.language][1], 48, 16, 16); - } else if ((pauseCtx->state != PAUSE_STATE_SAVE_PROMPT) || (pauseCtx->unk_1EC < 4)) { - if ((pauseCtx->state != PAUSE_STATE_15) && - ((pauseCtx->state == PAUSE_STATE_16) || (pauseCtx->state == PAUSE_STATE_17))) { - POLY_OPA_DISP = - KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sContinuePromptTexs[gSaveContext.language], 152, 16, 0); + } else if (((pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) && (pauseCtx->unk_1EC >= 4)) || + pauseCtx->state == PAUSE_STATE_15) { +#if PLATFORM_N64 + POLY_OPA_DISP = + KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sSaveConfirmationTexs[gSaveContext.language], 152, 16, 0); +#endif + } else if (((pauseCtx->state == PAUSE_STATE_16) || (pauseCtx->state == PAUSE_STATE_17))) { + POLY_OPA_DISP = + KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sContinuePromptTexs[gSaveContext.language], 152, 16, 0); - gDPSetCombineLERP(POLY_OPA_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, - TEXEL0, 0, PRIMITIVE, 0); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 255, 100, VREG(61)); + gDPSetCombineLERP(POLY_OPA_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, + 0, PRIMITIVE, 0); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, KALEIDO_COLOR_PROMPT_UNK_R, KALEIDO_COLOR_PROMPT_UNK_G, + KALEIDO_COLOR_PROMPT_UNK_B, VREG(61)); - if (pauseCtx->promptChoice == 0) { - gSPDisplayList(POLY_OPA_DISP++, gPromptCursorLeftDL); - } else { - gSPDisplayList(POLY_OPA_DISP++, gPromptCursorRightDL); - } - - gDPPipeSync(POLY_OPA_DISP++); - gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA, G_CC_MODULATEIA); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); - - POLY_OPA_DISP = - KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sPromptChoiceTexs[gSaveContext.language][0], 48, 16, 12); - - POLY_OPA_DISP = - KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sPromptChoiceTexs[gSaveContext.language][1], 48, 16, 16); + if (pauseCtx->promptChoice == 0) { + gSPDisplayList(POLY_OPA_DISP++, gPromptCursorLeftDL); + } else { + gSPDisplayList(POLY_OPA_DISP++, gPromptCursorRightDL); } + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA, G_CC_MODULATEIA); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, pauseCtx->alpha); + + POLY_OPA_DISP = + KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sPromptChoiceTexs[gSaveContext.language][0], 48, 16, 12); + + POLY_OPA_DISP = + KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sPromptChoiceTexs[gSaveContext.language][1], 48, 16, 16); } gDPPipeSync(POLY_OPA_DISP++); @@ -3050,7 +3068,7 @@ void KaleidoScope_UpdateCursorSize(PlayState* play) { void KaleidoScope_LoadDungeonMap(PlayState* play) { InterfaceContext* interfaceCtx = &play->interfaceCtx; -#if OOT_PAL +#if PLATFORM_N64 || OOT_PAL s32 pad; #endif @@ -3069,7 +3087,16 @@ void KaleidoScope_UpdateDungeonMap(PlayState* play) { PRINTF("MAP DMA = %d\n", play->interfaceCtx.mapPaletteIndex); +#if PLATFORM_N64 + if (B_80121AF0 != NULL && B_80121AF0->unk_44 != NULL && B_80121AF0->unk_44(play)) { + + } else { + KaleidoScope_LoadDungeonMap(play); + } +#else KaleidoScope_LoadDungeonMap(play); +#endif + Map_SetFloorPalettesData(play, pauseCtx->dungeonMapSlot - 3); if ((play->sceneId >= SCENE_DEKU_TREE) && (play->sceneId <= SCENE_TREASURE_BOX_SHOP)) { @@ -3567,7 +3594,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->state = PAUSE_STATE_CLOSING; WREG(2) = -6240; func_800F64E0(0); -#if OOT_NTSC +#if PLATFORM_GC && OOT_NTSC AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); #endif } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { @@ -3715,7 +3742,7 @@ void KaleidoScope_Update(PlayState* play) { WREG(2) = -6240; YREG(8) = pauseCtx->unk_204; func_800F64E0(0); -#if OOT_NTSC +#if PLATFORM_GC && OOT_NTSC AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); #endif } else { @@ -3726,7 +3753,11 @@ void KaleidoScope_Update(PlayState* play) { gSaveContext.save.info.playerData.savedSceneId = play->sceneId; Sram_WriteSave(&play->sramCtx); pauseCtx->unk_1EC = 4; +#if PLATFORM_N64 + D_8082B25C = 90; +#else D_8082B25C = 3; +#endif } } else if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_B)) { @@ -3739,7 +3770,7 @@ void KaleidoScope_Update(PlayState* play) { gSaveContext.buttonStatus[3] = BTN_ENABLED; gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); -#if OOT_NTSC +#if PLATFORM_GC && OOT_NTSC AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); #endif } @@ -3983,7 +4014,11 @@ void KaleidoScope_Update(PlayState* play) { gSaveContext.save.info.playerData.savedSceneId = play->sceneId; Sram_WriteSave(&play->sramCtx); pauseCtx->state = PAUSE_STATE_15; +#if PLATFORM_N64 + D_8082B25C = 90; +#else D_8082B25C = 3; +#endif } } break; diff --git a/tools/disasm/ntsc-1.2/variables.txt b/tools/disasm/ntsc-1.2/variables.txt index b949848748..e03651359f 100644 --- a/tools/disasm/ntsc-1.2/variables.txt +++ b/tools/disasm/ntsc-1.2/variables.txt @@ -22,3 +22,7 @@ _n64ddSegmentRomEnd = 0x00B9DA70; D_801DA410 = 0x801DA410; D_801E8090 = 0x801E8090; D_800FF4B0 = 0x800FF4B0; // size:0xB0 type:n64ddStruct_800FF4B0_pointers +gBitFlags = 0x800F9240; // size:0x80 type:u32[32] +gSfxDefaultPos = 0x801049D4; // size:0xC type:Vec3f +gSfxDefaultFreqAndVolScale = 0x801049E0; // size:0x4 type:f32 +gSfxDefaultReverb = 0x801049E8; // size:0x1 type:s8