diff --git a/include/z64.h b/include/z64.h index cf4643d53d..4128a2b38b 100644 --- a/include/z64.h +++ b/include/z64.h @@ -469,8 +469,8 @@ typedef struct { /* 0x290 */ f32 unk_290; /* 0x294 */ f32 unk_294; /* 0x298 */ f32 unk_298; - /* 0x29C */ s16 unk_29C; - /* 0x29E */ s16 unk_29E; + /* 0x29C */ s16 promptChoice; // save/continue choice: 0 = yes; 4 = no + /* 0x29E */ s16 promptAlpha; /* 0x2A0 */ s16 unk_2A0; /* 0x2A2 */ u8 worldMapPoints[20]; /* 0x2B6 */ u8 unk_2B6; diff --git a/spec b/spec index 334ff6bbb8..dcdf27862f 100644 --- a/spec +++ b/spec @@ -703,6 +703,7 @@ beginseg include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.o" include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.o" include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.o" + include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.o" include "build/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.o" include "build/data/ovl_kaleido_scope/ovl_kaleido_scope.bss.o" include "build/data/ovl_kaleido_scope/ovl_kaleido_scope.reloc.o" diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index fa490dbca7..a2742c7469 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -138,7 +138,7 @@ void KaleidoSetup_Init(PlayState* play) { pauseCtx->unk_2A0 = -1; pauseCtx->unk_2BA = 320; pauseCtx->unk_2BC = 40; - pauseCtx->unk_29E = 100; + pauseCtx->promptAlpha = 100; View_Init(&pauseCtx->view, play->state.gfxCtx); } diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c index aa24bf2e22..f8f61c5dc4 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c @@ -50,18 +50,10 @@ s16 D_8082B6DC[] = { 0x0000, }; -s32 D_8082B6E4[] = { 0, 0, 0 }; - -s16 D_8082B6F0[] = { 100, 255 }; - -s32 D_8082B6F4 = 0; - -s16 D_8082B6F8[] = { 10, 0, 0, 0 }; +s16 D_8082B6E4 = 0; #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_8081FF80.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_808204AC.s") #pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80820FA4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_kaleido_scope/func_80821730.s") diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c new file mode 100644 index 0000000000..53453e8e78 --- /dev/null +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c @@ -0,0 +1,49 @@ +/* + * File: z_kaleido_prompt.c + * Overlay: ovl_kaleido_scope + * Description: Pause Menu - Save and Continue Prompt + */ + +#include "z_kaleido_scope.h" + +s16 sPromptAlphaTargets[] = { 100, 255 }; + +// Unused remnant of OoT +void KaleidoScope_UpdatePrompt(PlayState* play) { + static s16 sPromptAlphaTargetIndex = 0; + static s16 sPromptAlphaTimer = 10; + PauseContext* pauseCtx = &play->pauseCtx; + Input* input = CONTROLLER1(&play->state); + s8 relStickX = input->rel.stick_x; + s16 alphaStep; + + if (((pauseCtx->state == 7) && (pauseCtx->unk_208 == 1)) || (pauseCtx->state == 0xE) || (pauseCtx->state == 0x11)) { + + // Move the prompt + if ((pauseCtx->promptChoice == PAUSE_PROMPT_YES) && (relStickX >= 30)) { + // Move right to the no prompt + play_sound(NA_SE_SY_CURSOR); + pauseCtx->promptChoice = PAUSE_PROMPT_NO; + } else if ((pauseCtx->promptChoice != PAUSE_PROMPT_YES) && (relStickX <= -30)) { + // Move left to the yes prompt + play_sound(NA_SE_SY_CURSOR); + pauseCtx->promptChoice = PAUSE_PROMPT_YES; + } + + // Update the alpha for the green glowing orb above the prompt + alphaStep = ABS_ALT(pauseCtx->promptAlpha - sPromptAlphaTargets[sPromptAlphaTargetIndex]) / sPromptAlphaTimer; + + if (pauseCtx->promptAlpha >= sPromptAlphaTargets[sPromptAlphaTargetIndex]) { + pauseCtx->promptAlpha -= alphaStep; + } else { + pauseCtx->promptAlpha += alphaStep; + } + + sPromptAlphaTimer--; + if (sPromptAlphaTimer == 0) { + pauseCtx->promptAlpha = sPromptAlphaTargets[sPromptAlphaTargetIndex]; + sPromptAlphaTimer = sPromptAlphaTargetIndex + 20; + sPromptAlphaTargetIndex ^= 1; + } + } +} diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h index f4c91e9e88..b4d2a192fe 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h @@ -18,6 +18,9 @@ typedef enum { /* 3 */ DEBUG_EDITOR_EVENTS } DebugEditor; +#define PAUSE_PROMPT_YES 0 +#define PAUSE_PROMPT_NO 4 + // Debug void KaleidoScope_DrawInventoryEditor(PlayState* play); void KaleidoScope_UpdateInventoryEditor(PlayState* play); diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index eaeb2f69dd..70850a7691 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -4217,7 +4217,7 @@ 0x8081FF80:("func_8081FF80",), 0x808204AC:("func_808204AC",), 0x80820FA4:("func_80820FA4",), - 0x80821730:("func_80821730",), + 0x80821730:("KaleidoScope_UpdatePrompt",), 0x80821900:("func_80821900",), 0x8082192C:("func_8082192C",), 0x80821958:("func_80821958",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 94a59d6954..32ae1dd5e0 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -4734,9 +4734,9 @@ 0x8082B6D4:("D_8082B6D4","UNK_TYPE1","",0x1), 0x8082B6DC:("D_8082B6DC","UNK_TYPE1","",0x1), 0x8082B6E4:("D_8082B6E4","UNK_TYPE2","",0x2), - 0x8082B6F0:("D_8082B6F0","UNK_TYPE1","",0x1), - 0x8082B6F4:("D_8082B6F4","UNK_TYPE2","",0x2), - 0x8082B6F8:("D_8082B6F8","UNK_TYPE2","",0x2), + 0x8082B6F0:("sPromptAlphaTargets","UNK_TYPE1","",0x1), + 0x8082B6F4:("sPromptAlphaTargetIndex","UNK_TYPE2","",0x2), + 0x8082B6F8:("sPromptAlphaTimer","UNK_TYPE2","",0x2), 0x8082B700:("D_8082B700","UNK_TYPE1","",0x1), 0x8082B73C:("D_8082B73C","UNK_TYPE1","",0x1), 0x8082B778:("D_8082B778","UNK_TYPE1","",0x1),