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
8 changed files with 61 additions and 16 deletions
+1 -1
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);
}
@@ -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")
@@ -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;
}
}
}
@@ -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);