`z_kaleido_prompt.c` Ok and Documented (Pause Menu Save/Continue Prompt. Unused) (#1045)

* kaleido prompt ok

* fix pauseCtx
This commit is contained in:
engineer124 2022-09-24 13:43:21 -04:00 committed by GitHub
parent 71a18d70cf
commit cdee1fc45b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 61 additions and 16 deletions

View File

@ -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;

1
spec
View File

@ -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"

View File

@ -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);
}

View File

@ -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")

View File

@ -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;
}
}
}

View File

@ -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);

View File

@ -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",),

View File

@ -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),