summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2022-10-04 19:13:40 +0200
committerGitHub <noreply@github.com>2022-10-04 13:13:40 -0400
commit9771afdc6945f174a8d2d2b5b3564010686aeafa (patch)
tree56fd789c36594f133c62c7d3fde46f98992b1f07
parent1cb00350d94b98a70574545ebb5d858fd8532fe6 (diff)
Some pause menu inputs doc (#1370)
* `PauseContext.pageSwitchTimer` -> `delaySwitchPageInputTimer` * Document stick input repeat in the pause menu * format * `delaySwitchPageInputTimer` -> `pageSwitchInputTimer` * Fix swapped delay and delay_first, oops * Move timer incrs on their own lines Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
-rw-r--r--include/regs.h2
-rw-r--r--include/z64.h2
-rw-r--r--src/code/z_construct.c4
-rw-r--r--src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c70
4 files changed, 42 insertions, 36 deletions
diff --git a/include/regs.h b/include/regs.h
index a873e34c9..7c58c035c 100644
--- a/include/regs.h
+++ b/include/regs.h
@@ -106,6 +106,8 @@
#define R_TRANS_DBG_TYPE CREG(12)
#define R_ENV_WIND_DIR(i) CREG(16 + (i))
#define R_ENV_WIND_SPEED CREG(19)
+#define R_PAUSE_STICK_REPEAT_DELAY XREG(6)
+#define R_PAUSE_STICK_REPEAT_DELAY_FIRST XREG(8)
#define R_A_BTN_Y XREG(16)
#define R_A_BTN_X XREG(17)
#define R_A_ICON_Y XREG(19)
diff --git a/include/z64.h b/include/z64.h
index d6d5e7ba1..2d8e08757 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -786,7 +786,7 @@ typedef struct {
/* 0x022C */ s16 cursorY[5]; // "cur_ypt"
/* 0x0236 */ s16 dungeonMapSlot;
/* 0x0238 */ s16 cursorSpecialPos; // "key_angle"
- /* 0x023A */ s16 pageSwitchTimer;
+ /* 0x023A */ s16 pageSwitchInputTimer; // Used to introduce a delay before switching page when arriving on the "scroll left/right" positions while holding stick left/right.
/* 0x023C */ u16 namedItem; // "zoom_name"
/* 0x023E */ u16 cursorItem[4]; // "select_name"
/* 0x0246 */ u16 cursorSlot[4];
diff --git a/src/code/z_construct.c b/src/code/z_construct.c
index 440949b42..9a40a3391 100644
--- a/src/code/z_construct.c
+++ b/src/code/z_construct.c
@@ -345,9 +345,9 @@ void func_80111070(void) {
XREG(3) = -4;
XREG(4) = 3;
XREG(5) = 0;
- XREG(6) = 2;
+ R_PAUSE_STICK_REPEAT_DELAY = 2;
XREG(7) = 30;
- XREG(8) = 10;
+ R_PAUSE_STICK_REPEAT_DELAY_FIRST = 10;
XREG(9) = 0;
XREG(10) = -9550;
XREG(11) = 9950;
diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c
index 2fbad6a1f..0cac739ac 100644
--- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c
+++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c
@@ -313,7 +313,7 @@ void KaleidoScope_MoveCursorToSpecialPos(PlayState* play, u16 specialPos) {
PauseContext* pauseCtx = &play->pauseCtx;
pauseCtx->cursorSpecialPos = specialPos;
- pauseCtx->pageSwitchTimer = 0;
+ pauseCtx->pageSwitchInputTimer = 0;
Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultReverb);
@@ -409,21 +409,21 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) {
if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) {
if (pauseCtx->stickAdjX < -30) {
- pauseCtx->pageSwitchTimer++;
- if ((pauseCtx->pageSwitchTimer >= 10) || (pauseCtx->pageSwitchTimer == 0)) {
+ pauseCtx->pageSwitchInputTimer++;
+ if ((pauseCtx->pageSwitchInputTimer >= 10) || (pauseCtx->pageSwitchInputTimer == 0)) {
KaleidoScope_SwitchPage(pauseCtx, 0);
}
} else {
- pauseCtx->pageSwitchTimer = -1;
+ pauseCtx->pageSwitchInputTimer = -1;
}
} else if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) {
if (pauseCtx->stickAdjX > 30) {
- pauseCtx->pageSwitchTimer++;
- if ((pauseCtx->pageSwitchTimer >= 10) || (pauseCtx->pageSwitchTimer == 0)) {
+ pauseCtx->pageSwitchInputTimer++;
+ if ((pauseCtx->pageSwitchInputTimer >= 10) || (pauseCtx->pageSwitchInputTimer == 0)) {
KaleidoScope_SwitchPage(pauseCtx, 2);
}
} else {
- pauseCtx->pageSwitchTimer = -1;
+ pauseCtx->pageSwitchInputTimer = -1;
}
}
}
@@ -508,10 +508,10 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
};
static s16 D_8082AD3C = 20;
static s16 D_8082AD40 = 0;
- static s16 D_8082AD44 = 0;
- static s16 D_8082AD48 = 0;
- static s16 D_8082AD4C = 0;
- static s16 D_8082AD50 = 0;
+ static s16 sStickXRepeatTimer = 0;
+ static s16 sStickYRepeatTimer = 0;
+ static s16 sStickXRepeatState = 0;
+ static s16 sStickYRepeatState = 0;
PauseContext* pauseCtx = &play->pauseCtx;
s16 stepR;
s16 stepG;
@@ -553,55 +553,59 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
}
if (pauseCtx->stickAdjX < -30) {
- if (D_8082AD4C == -1) {
- if (--D_8082AD44 < 0) {
- D_8082AD44 = XREG(6);
+ if (sStickXRepeatState == -1) {
+ sStickXRepeatTimer--;
+ if (sStickXRepeatTimer < 0) {
+ sStickXRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY;
} else {
pauseCtx->stickAdjX = 0;
}
} else {
- D_8082AD44 = XREG(8);
- D_8082AD4C = -1;
+ sStickXRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY_FIRST;
+ sStickXRepeatState = -1;
}
} else if (pauseCtx->stickAdjX > 30) {
- if (D_8082AD4C == 1) {
- if (--D_8082AD44 < 0) {
- D_8082AD44 = XREG(6);
+ if (sStickXRepeatState == 1) {
+ sStickXRepeatTimer--;
+ if (sStickXRepeatTimer < 0) {
+ sStickXRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY;
} else {
pauseCtx->stickAdjX = 0;
}
} else {
- D_8082AD44 = XREG(8);
- D_8082AD4C = 1;
+ sStickXRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY_FIRST;
+ sStickXRepeatState = 1;
}
} else {
- D_8082AD4C = 0;
+ sStickXRepeatState = 0;
}
if (pauseCtx->stickAdjY < -30) {
- if (D_8082AD50 == -1) {
- if (--D_8082AD48 < 0) {
- D_8082AD48 = XREG(6);
+ if (sStickYRepeatState == -1) {
+ sStickYRepeatTimer--;
+ if (sStickYRepeatTimer < 0) {
+ sStickYRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY;
} else {
pauseCtx->stickAdjY = 0;
}
} else {
- D_8082AD48 = XREG(8);
- D_8082AD50 = -1;
+ sStickYRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY_FIRST;
+ sStickYRepeatState = -1;
}
} else if (pauseCtx->stickAdjY > 30) {
- if (D_8082AD50 == 1) {
- if (--D_8082AD48 < 0) {
- D_8082AD48 = XREG(6);
+ if (sStickYRepeatState == 1) {
+ sStickYRepeatTimer--;
+ if (sStickYRepeatTimer < 0) {
+ sStickYRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY;
} else {
pauseCtx->stickAdjY = 0;
}
} else {
- D_8082AD48 = XREG(8);
- D_8082AD50 = 1;
+ sStickYRepeatTimer = R_PAUSE_STICK_REPEAT_DELAY_FIRST;
+ sStickYRepeatState = 1;
}
} else {
- D_8082AD50 = 0;
+ sStickYRepeatState = 0;
}
}