summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorengineer124 <47598039+engineer124@users.noreply.github.com>2022-09-24 13:43:21 -0400
committerGitHub <noreply@github.com>2022-09-24 14:43:21 -0300
commitcdee1fc45b5b327a4169ecb3aa899174ddcfc851 (patch)
tree793f320946e774b2c0560ed5267b0552550cb9c0
parent71a18d70cf85970dd73c3bdb0fa18c0ccad5131d (diff)
`z_kaleido_prompt.c` Ok and Documented (Pause Menu Save/Continue Prompt. Unused) (#1045)
* kaleido prompt ok * fix pauseCtx
-rw-r--r--include/z64.h4
-rw-r--r--spec1
-rw-r--r--src/code/z_kaleido_setup.c2
-rw-r--r--src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_mask.c10
-rw-r--r--src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_prompt.c49
-rw-r--r--src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h3
-rw-r--r--tools/disasm/functions.txt2
-rw-r--r--tools/disasm/variables.txt6
8 files changed, 61 insertions, 16 deletions
diff --git a/include/z64.h b/include/z64.h
index cf4643d53..4128a2b38 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 334ff6bbb..dcdf27862 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 fa490dbca..a2742c746 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 aa24bf2e2..f8f61c5dc 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 000000000..53453e8e7
--- /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 f4c91e9e8..b4d2a192f 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 eaeb2f69d..70850a769 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 94a59d695..32ae1dd5e 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),