mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-14 21:40:03 +00:00
Document pause page switching (#1550)
* Document pause page switching * document initial scroll left setup, when opening the pause menu * `PAUSE_MAIN_STATE_1` -> `PAUSE_MAIN_STATE_SWITCHING_PAGE` * try a diagram of the pages layout in world space as a comment * expand `nextPageMode` comment * touch up pause camera header comments * expand comment on irrelevant init `mainState = PAUSE_MAIN_STATE_SWITCHING_PAGE` * expand doc on `sKaleidoSetup*` data * expand docs on `gPageSwitchNextButtonStatus` * add some doc on `sPageSwitch*` arrays * SwitchPage -> PageSwitch * add `PAGE_SWITCH_NSTEPS` * `SWITCH_PAGE_*_PT` -> `PAGE_SWITCH_PT_*` * peepoArtist --------- Co-authored-by: fig02 <fig02srl@gmail.com>
This commit is contained in:
parent
87a6e75242
commit
05c87518e7
4 changed files with 232 additions and 76 deletions
|
@ -109,6 +109,7 @@
|
|||
#define R_C_UP_ICON_Y YREG(89)
|
||||
#define R_EPONAS_SONG_PLAYED DREG(53)
|
||||
#define R_MAGIC_FILL_COLOR(i) ZREG(0 + (i))
|
||||
#define R_PAUSE_PAGE_SWITCH_FRAME_ADVANCE_ON ZREG(13)
|
||||
#define R_C_BTN_COLOR(i) ZREG(39 + (i))
|
||||
#define R_B_BTN_COLOR(i) ZREG(43 + (i))
|
||||
#define R_START_LABEL_DD(i) ZREG(48 + (i))
|
||||
|
|
|
@ -20,6 +20,33 @@ typedef enum {
|
|||
/* 0x04 */ PAUSE_WORLD_MAP
|
||||
} PauseMenuPage;
|
||||
|
||||
// The XZ coordinates in which direction each pause page is at
|
||||
// e.g. the item page is in the -z direction
|
||||
/*
|
||||
* < item >
|
||||
*
|
||||
* ^ ^
|
||||
* x
|
||||
* equip o--> map
|
||||
* |
|
||||
* v z v v
|
||||
*
|
||||
* < quest >
|
||||
*/
|
||||
#define PAUSE_ITEM_X (0)
|
||||
#define PAUSE_ITEM_Z (-1)
|
||||
#define PAUSE_MAP_X (1)
|
||||
#define PAUSE_MAP_Z (0)
|
||||
#define PAUSE_QUEST_X (0)
|
||||
#define PAUSE_QUEST_Z (1)
|
||||
#define PAUSE_EQUIP_X (-1)
|
||||
#define PAUSE_EQUIP_Z (0)
|
||||
|
||||
// The pause camera looks at x=0,z=0,
|
||||
// with the eye being PAUSE_EYE_DIST away in the direction opposite to the active page,
|
||||
// which results in the camera being pointed (through x=0,z=0) towards the active page.
|
||||
#define PAUSE_EYE_DIST (64.0f)
|
||||
|
||||
#define PAUSE_EQUIP_PLAYER_WIDTH 64
|
||||
#define PAUSE_EQUIP_PLAYER_HEIGHT 112
|
||||
|
||||
|
@ -58,7 +85,7 @@ typedef enum {
|
|||
// Sub-states of PAUSE_STATE_MAIN
|
||||
typedef enum {
|
||||
/* 0 */ PAUSE_MAIN_STATE_IDLE,
|
||||
/* 1 */ PAUSE_MAIN_STATE_1,
|
||||
/* 1 */ PAUSE_MAIN_STATE_SWITCHING_PAGE,
|
||||
/* 2 */ PAUSE_MAIN_STATE_2,
|
||||
/* 3 */ PAUSE_MAIN_STATE_3,
|
||||
/* 4 */ PAUSE_MAIN_STATE_4,
|
||||
|
@ -98,9 +125,9 @@ typedef struct {
|
|||
/* 0x01D6 */ u16 debugState;
|
||||
/* 0x01D8 */ Vec3f eye;
|
||||
/* 0x01E4 */ u16 mainState;
|
||||
/* 0x01E6 */ u16 mode;
|
||||
/* 0x01E6 */ u16 nextPageMode; // During a page switch, indicates the page before switching and the direction to scroll in. Value is `(2 * prev pageIndex) + (scroll left ? 1 : 0)`
|
||||
/* 0x01E8 */ u16 pageIndex; // "kscp_pos"
|
||||
/* 0x01EA */ u16 unk_1EA;
|
||||
/* 0x01EA */ u16 pageSwitchTimer;
|
||||
/* 0x01EC */ u16 unk_1EC;
|
||||
/* 0x01F0 */ f32 unk_1F0;
|
||||
/* 0x01F4 */ f32 unk_1F4;
|
||||
|
|
|
@ -1,12 +1,58 @@
|
|||
#include "global.h"
|
||||
|
||||
s16 sKaleidoSetupKscpPos0[] = { PAUSE_QUEST, PAUSE_EQUIP, PAUSE_ITEM, PAUSE_MAP };
|
||||
f32 sKaleidoSetupEyeX0[] = { 0.0f, 64.0f, 0.0f, -64.0f };
|
||||
f32 sKaleidoSetupEyeZ0[] = { -64.0f, 0.0f, 64.0f, 0.0f };
|
||||
/*
|
||||
* The following three arrays are effectively unused.
|
||||
* They are partly equivalent to the `sKaleidoSetupRightPage*` arrays below,
|
||||
* but make each page correspond to the opposite page instead of the page to the right.
|
||||
*/
|
||||
|
||||
s16 sKaleidoSetupKscpPos1[] = { PAUSE_MAP, PAUSE_QUEST, PAUSE_EQUIP, PAUSE_ITEM };
|
||||
f32 sKaleidoSetupEyeX1[] = { -64.0f, 0.0f, 64.0f, 0.0f };
|
||||
f32 sKaleidoSetupEyeZ1[] = { 0.0f, -64.0f, 0.0f, 64.0f };
|
||||
s16 sKaleidoSetupUnusedPageIndex[] = {
|
||||
PAUSE_QUEST, // PAUSE_ITEM
|
||||
PAUSE_EQUIP, // PAUSE_MAP
|
||||
PAUSE_ITEM, // PAUSE_QUEST
|
||||
PAUSE_MAP, // PAUSE_EQUIP
|
||||
};
|
||||
|
||||
f32 sKaleidoSetupUnusedEyeX[] = {
|
||||
PAUSE_EYE_DIST * -PAUSE_QUEST_X, // PAUSE_ITEM
|
||||
PAUSE_EYE_DIST * -PAUSE_EQUIP_X, // PAUSE_MAP
|
||||
PAUSE_EYE_DIST * -PAUSE_ITEM_X, // PAUSE_QUEST
|
||||
PAUSE_EYE_DIST * -PAUSE_MAP_X, // PAUSE_EQUIP
|
||||
};
|
||||
|
||||
f32 sKaleidoSetupUnusedEyeZ[] = {
|
||||
PAUSE_EYE_DIST * -PAUSE_QUEST_Z, // PAUSE_ITEM
|
||||
PAUSE_EYE_DIST * -PAUSE_EQUIP_Z, // PAUSE_MAP
|
||||
PAUSE_EYE_DIST * -PAUSE_ITEM_Z, // PAUSE_QUEST
|
||||
PAUSE_EYE_DIST * -PAUSE_MAP_Z, // PAUSE_EQUIP
|
||||
};
|
||||
|
||||
/*
|
||||
* The following three arrays are used when opening the pause menu to set up a page switch such that scrolling left
|
||||
* brings to the initial page.
|
||||
* For example to open the menu on page PAUSE_ITEM, the menu would open on PAUSE_MAP and scroll left to PAUSE_ITEM.
|
||||
*/
|
||||
|
||||
s16 sKaleidoSetupRightPageIndex[] = {
|
||||
PAUSE_MAP, // PAUSE_ITEM
|
||||
PAUSE_QUEST, // PAUSE_MAP
|
||||
PAUSE_EQUIP, // PAUSE_QUEST
|
||||
PAUSE_ITEM, // PAUSE_EQUIP
|
||||
};
|
||||
|
||||
f32 sKaleidoSetupRightPageEyeX[] = {
|
||||
PAUSE_EYE_DIST * -PAUSE_MAP_X, // PAUSE_ITEM
|
||||
PAUSE_EYE_DIST * -PAUSE_QUEST_X, // PAUSE_MAP
|
||||
PAUSE_EYE_DIST * -PAUSE_EQUIP_X, // PAUSE_QUEST
|
||||
PAUSE_EYE_DIST * -PAUSE_ITEM_X, // PAUSE_EQUIP
|
||||
};
|
||||
|
||||
f32 sKaleidoSetupRightPageEyeZ[] = {
|
||||
PAUSE_EYE_DIST * -PAUSE_MAP_Z, // PAUSE_ITEM
|
||||
PAUSE_EYE_DIST * -PAUSE_QUEST_Z, // PAUSE_MAP
|
||||
PAUSE_EYE_DIST * -PAUSE_EQUIP_Z, // PAUSE_QUEST
|
||||
PAUSE_EYE_DIST * -PAUSE_ITEM_Z, // PAUSE_EQUIP
|
||||
};
|
||||
|
||||
void KaleidoSetup_Update(PlayState* play) {
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
|
@ -30,24 +76,33 @@ void KaleidoSetup_Update(PlayState* play) {
|
|||
WREG(16) = -175;
|
||||
WREG(17) = 155;
|
||||
|
||||
pauseCtx->unk_1EA = 0;
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_1;
|
||||
pauseCtx->pageSwitchTimer = 0;
|
||||
|
||||
if (ZREG(48) == 0) {
|
||||
pauseCtx->eye.x = sKaleidoSetupEyeX0[pauseCtx->pageIndex];
|
||||
pauseCtx->eye.z = sKaleidoSetupEyeZ0[pauseCtx->pageIndex];
|
||||
pauseCtx->pageIndex = sKaleidoSetupKscpPos0[pauseCtx->pageIndex];
|
||||
// Setting mainState here is irrelevant, mainState is only used under PAUSE_STATE_MAIN,
|
||||
// which isn't involved in the initial pause menu opening page scrolling animation.
|
||||
// mainState is also overwritten later before being used.
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_SWITCHING_PAGE;
|
||||
|
||||
//! @bug REG collision
|
||||
if (R_START_LABEL_DD(0) == 0) {
|
||||
// Never reached, unused, and the data would be wrong anyway
|
||||
// (scrolling left from this would not bring to the initial page)
|
||||
pauseCtx->eye.x = sKaleidoSetupUnusedEyeX[pauseCtx->pageIndex];
|
||||
pauseCtx->eye.z = sKaleidoSetupUnusedEyeZ[pauseCtx->pageIndex];
|
||||
pauseCtx->pageIndex = sKaleidoSetupUnusedPageIndex[pauseCtx->pageIndex];
|
||||
} else {
|
||||
pauseCtx->eye.x = sKaleidoSetupEyeX1[pauseCtx->pageIndex];
|
||||
pauseCtx->eye.z = sKaleidoSetupEyeZ1[pauseCtx->pageIndex];
|
||||
pauseCtx->pageIndex = sKaleidoSetupKscpPos1[pauseCtx->pageIndex];
|
||||
// Set eye position and pageIndex such that scrolling left brings to the desired page
|
||||
pauseCtx->eye.x = sKaleidoSetupRightPageEyeX[pauseCtx->pageIndex];
|
||||
pauseCtx->eye.z = sKaleidoSetupRightPageEyeZ[pauseCtx->pageIndex];
|
||||
pauseCtx->pageIndex = sKaleidoSetupRightPageIndex[pauseCtx->pageIndex];
|
||||
}
|
||||
|
||||
pauseCtx->mode = (u16)(pauseCtx->pageIndex * 2) + 1;
|
||||
// Set next page mode to scroll left
|
||||
pauseCtx->nextPageMode = (u16)(pauseCtx->pageIndex * 2) + 1;
|
||||
pauseCtx->state = PAUSE_STATE_WAIT_LETTERBOX;
|
||||
|
||||
PRINTF("Mode=%d eye.x=%f, eye.z=%f kscp_pos=%d\n", pauseCtx->mode, pauseCtx->eye.x, pauseCtx->eye.z,
|
||||
pauseCtx->pageIndex);
|
||||
PRINTF("Mode=%d eye.x=%f, eye.z=%f kscp_pos=%d\n", pauseCtx->nextPageMode, pauseCtx->eye.x,
|
||||
pauseCtx->eye.z, pauseCtx->pageIndex);
|
||||
}
|
||||
|
||||
if (pauseCtx->state == PAUSE_STATE_WAIT_LETTERBOX) {
|
||||
|
@ -77,7 +132,7 @@ void KaleidoSetup_Init(PlayState* play) {
|
|||
pauseCtx->alpha = 0;
|
||||
|
||||
// mainState = PAUSE_MAIN_STATE_IDLE , pageIndex = PAUSE_ITEM
|
||||
pauseCtx->unk_1EA = pauseCtx->mainState = pauseCtx->mode = pauseCtx->pageIndex = 0;
|
||||
pauseCtx->pageSwitchTimer = pauseCtx->mainState = pauseCtx->nextPageMode = pauseCtx->pageIndex = 0;
|
||||
|
||||
pauseCtx->unk_204 = -314.0f;
|
||||
|
||||
|
|
|
@ -135,12 +135,45 @@ s16 D_8082AB2C[] = {
|
|||
24, 72, 13, 22, 19, 20, 19, 27, 14, 26, 22, 21, 49, 32, 45, 60, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 32, 8,
|
||||
};
|
||||
|
||||
static u8 D_8082AB6C[][5] = {
|
||||
/**
|
||||
* Contains the status of buttons for each page.
|
||||
*
|
||||
* Indexed by `pageIndex + pt` values,
|
||||
* where pageIndex is from the `PauseMenuPage` enum
|
||||
* and pt is 0 or 2 (respectively `PAGE_SWITCH_PT_LEFT` and `PAGE_SWITCH_PT_RIGHT`).
|
||||
*
|
||||
* `PauseMenuPage` enum values are ordered clockwise, starting at PAUSE_ITEM. That means adding 1 to a page index
|
||||
* produces (modulo 4) the index of the page to the right, and similar with subtracting 1 for the left page.
|
||||
* The indexing of this array relies on this property, but without modulo operations. Instead, the data for the first
|
||||
* and last pages (PAUSE_ITEM, PAUSE_EQUIP) is duplicated.
|
||||
*
|
||||
* For example when scrolling left from the quest page PAUSE_QUEST (so, to PAUSE_MAP),
|
||||
* the index is `PAUSE_QUEST + PAGE_SWITCH_PT_LEFT` and the data is button status for the map page.
|
||||
*/
|
||||
static u8 gPageSwitchNextButtonStatus[][5] = {
|
||||
// PAUSE_ITEM + PAGE_SWITCH_PT_LEFT
|
||||
//
|
||||
// -> PAUSE_EQUIP
|
||||
{ BTN_ENABLED, BTN_DISABLED, BTN_DISABLED, BTN_DISABLED, BTN_ENABLED },
|
||||
// PAUSE_MAP + PAGE_SWITCH_PT_LEFT
|
||||
//
|
||||
// -> PAUSE_ITEM
|
||||
{ BTN_ENABLED, BTN_ENABLED, BTN_ENABLED, BTN_ENABLED, BTN_DISABLED },
|
||||
// PAUSE_QUEST + PAGE_SWITCH_PT_LEFT
|
||||
// PAUSE_ITEM + PAGE_SWITCH_PT_RIGHT
|
||||
// -> PAUSE_MAP
|
||||
{ BTN_ENABLED, BTN_DISABLED, BTN_DISABLED, BTN_DISABLED, BTN_DISABLED },
|
||||
// PAUSE_EQUIP + PAGE_SWITCH_PT_LEFT
|
||||
// PAUSE_MAP + PAGE_SWITCH_PT_RIGHT
|
||||
// -> PAUSE_QUEST
|
||||
{ BTN_ENABLED, BTN_DISABLED, BTN_DISABLED, BTN_DISABLED, BTN_ENABLED },
|
||||
//
|
||||
// PAUSE_QUEST + PAGE_SWITCH_PT_RIGHT
|
||||
// -> PAUSE_EQUIP
|
||||
{ BTN_ENABLED, BTN_DISABLED, BTN_DISABLED, BTN_DISABLED, BTN_ENABLED },
|
||||
//
|
||||
// PAUSE_EQUIP + PAGE_SWITCH_PT_RIGHT
|
||||
// -> PAUSE_ITEM
|
||||
{ BTN_ENABLED, BTN_ENABLED, BTN_ENABLED, BTN_ENABLED, BTN_DISABLED },
|
||||
};
|
||||
|
||||
|
@ -155,16 +188,49 @@ static s16 D_8082ABA4 = 0;
|
|||
|
||||
static s16 sInDungeonScene = false;
|
||||
|
||||
static f32 D_8082ABAC[] = {
|
||||
-4.0f, 4.0f, 4.0f, 4.0f, 4.0f, -4.0f, -4.0f, -4.0f,
|
||||
/*
|
||||
* The following three `sPageSwitch*` arrays are indexed by nextPageMode values,
|
||||
* which encode the page to switch from and the scroll direction.
|
||||
*
|
||||
* sPageSwitchEyeDx/Dz describe how to move the camera eye so that the pages appear scrolling and the next active page
|
||||
* is switched into view.
|
||||
*
|
||||
* sPageSwitchNextPageIndex contains the page a nextPageMode leads to once scrolling is done.
|
||||
*/
|
||||
|
||||
#define PAGE_SWITCH_NSTEPS 16
|
||||
|
||||
static f32 sPageSwitchEyeDx[] = {
|
||||
-PAUSE_EYE_DIST * (PAUSE_MAP_X - PAUSE_ITEM_X) / PAGE_SWITCH_NSTEPS, // PAUSE_ITEM right
|
||||
-PAUSE_EYE_DIST*(PAUSE_EQUIP_X - PAUSE_ITEM_X) / PAGE_SWITCH_NSTEPS, // PAUSE_ITEM left
|
||||
-PAUSE_EYE_DIST*(PAUSE_QUEST_X - PAUSE_MAP_X) / PAGE_SWITCH_NSTEPS, // PAUSE_MAP right
|
||||
-PAUSE_EYE_DIST*(PAUSE_ITEM_X - PAUSE_MAP_X) / PAGE_SWITCH_NSTEPS, // PAUSE_MAP left
|
||||
-PAUSE_EYE_DIST*(PAUSE_EQUIP_X - PAUSE_QUEST_X) / PAGE_SWITCH_NSTEPS, // PAUSE_QUEST right
|
||||
-PAUSE_EYE_DIST*(PAUSE_MAP_X - PAUSE_QUEST_X) / PAGE_SWITCH_NSTEPS, // PAUSE_QUEST left
|
||||
-PAUSE_EYE_DIST*(PAUSE_ITEM_X - PAUSE_EQUIP_X) / PAGE_SWITCH_NSTEPS, // PAUSE_EQUIP right
|
||||
-PAUSE_EYE_DIST*(PAUSE_QUEST_X - PAUSE_EQUIP_X) / PAGE_SWITCH_NSTEPS, // PAUSE_EQUIP left
|
||||
};
|
||||
|
||||
static f32 D_8082ABCC[] = {
|
||||
-4.0f, -4.0f, -4.0f, 4.0f, 4.0f, 4.0f, 4.0f, -4.0f,
|
||||
static f32 sPageSwitchEyeDz[] = {
|
||||
-PAUSE_EYE_DIST * (PAUSE_MAP_Z - PAUSE_ITEM_Z) / PAGE_SWITCH_NSTEPS, // PAUSE_ITEM right
|
||||
-PAUSE_EYE_DIST*(PAUSE_EQUIP_Z - PAUSE_ITEM_Z) / PAGE_SWITCH_NSTEPS, // PAUSE_ITEM left
|
||||
-PAUSE_EYE_DIST*(PAUSE_QUEST_Z - PAUSE_MAP_Z) / PAGE_SWITCH_NSTEPS, // PAUSE_MAP right
|
||||
-PAUSE_EYE_DIST*(PAUSE_ITEM_Z - PAUSE_MAP_Z) / PAGE_SWITCH_NSTEPS, // PAUSE_MAP left
|
||||
-PAUSE_EYE_DIST*(PAUSE_EQUIP_Z - PAUSE_QUEST_Z) / PAGE_SWITCH_NSTEPS, // PAUSE_QUEST right
|
||||
-PAUSE_EYE_DIST*(PAUSE_MAP_Z - PAUSE_QUEST_Z) / PAGE_SWITCH_NSTEPS, // PAUSE_QUEST left
|
||||
-PAUSE_EYE_DIST*(PAUSE_ITEM_Z - PAUSE_EQUIP_Z) / PAGE_SWITCH_NSTEPS, // PAUSE_EQUIP right
|
||||
-PAUSE_EYE_DIST*(PAUSE_QUEST_Z - PAUSE_EQUIP_Z) / PAGE_SWITCH_NSTEPS, // PAUSE_EQUIP left
|
||||
};
|
||||
|
||||
static u16 D_8082ABEC[] = {
|
||||
PAUSE_MAP, PAUSE_EQUIP, PAUSE_QUEST, PAUSE_ITEM, PAUSE_EQUIP, PAUSE_MAP, PAUSE_ITEM, PAUSE_QUEST,
|
||||
static u16 sPageSwitchNextPageIndex[] = {
|
||||
PAUSE_MAP, // PAUSE_ITEM right
|
||||
PAUSE_EQUIP, // PAUSE_ITEM left
|
||||
PAUSE_QUEST, // PAUSE_MAP right
|
||||
PAUSE_ITEM, // PAUSE_MAP left
|
||||
PAUSE_EQUIP, // PAUSE_QUEST right
|
||||
PAUSE_MAP, // PAUSE_QUEST left
|
||||
PAUSE_ITEM, // PAUSE_EQUIP right
|
||||
PAUSE_QUEST, // PAUSE_EQUIP left
|
||||
};
|
||||
|
||||
u8 gSlotAgeReqs[] = {
|
||||
|
@ -489,26 +555,29 @@ void KaleidoScope_SetDefaultCursor(PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) {
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_1;
|
||||
pauseCtx->unk_1EA = 0;
|
||||
#define PAGE_SWITCH_PT_LEFT 0
|
||||
#define PAGE_SWITCH_PT_RIGHT 2
|
||||
|
||||
if (!pt) {
|
||||
pauseCtx->mode = pauseCtx->pageIndex * 2 + 1;
|
||||
void KaleidoScope_SetupPageSwitch(PauseContext* pauseCtx, u8 pt) {
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_SWITCHING_PAGE;
|
||||
pauseCtx->pageSwitchTimer = 0;
|
||||
|
||||
if (!pt) { // PAGE_SWITCH_PT_LEFT
|
||||
pauseCtx->nextPageMode = pauseCtx->pageIndex * 2 + 1;
|
||||
Audio_PlaySfxGeneral(NA_SE_SY_WIN_SCROLL_LEFT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
pauseCtx->cursorSpecialPos = PAUSE_CURSOR_PAGE_RIGHT;
|
||||
} else {
|
||||
pauseCtx->mode = pauseCtx->pageIndex * 2;
|
||||
} else { // PAGE_SWITCH_PT_RIGHT
|
||||
pauseCtx->nextPageMode = pauseCtx->pageIndex * 2;
|
||||
Audio_PlaySfxGeneral(NA_SE_SY_WIN_SCROLL_RIGHT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
pauseCtx->cursorSpecialPos = PAUSE_CURSOR_PAGE_LEFT;
|
||||
}
|
||||
|
||||
gSaveContext.buttonStatus[1] = D_8082AB6C[pauseCtx->pageIndex + pt][1];
|
||||
gSaveContext.buttonStatus[2] = D_8082AB6C[pauseCtx->pageIndex + pt][2];
|
||||
gSaveContext.buttonStatus[3] = D_8082AB6C[pauseCtx->pageIndex + pt][3];
|
||||
gSaveContext.buttonStatus[4] = D_8082AB6C[pauseCtx->pageIndex + pt][4];
|
||||
gSaveContext.buttonStatus[1] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex + pt][1];
|
||||
gSaveContext.buttonStatus[2] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex + pt][2];
|
||||
gSaveContext.buttonStatus[3] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex + pt][3];
|
||||
gSaveContext.buttonStatus[4] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex + pt][4];
|
||||
|
||||
PRINTF("kscope->kscp_pos+pt = %d\n", pauseCtx->pageIndex + pt);
|
||||
|
||||
|
@ -525,12 +594,12 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) {
|
|||
}
|
||||
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_R)) {
|
||||
KaleidoScope_SwitchPage(pauseCtx, 2);
|
||||
KaleidoScope_SetupPageSwitch(pauseCtx, PAGE_SWITCH_PT_RIGHT);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_Z)) {
|
||||
KaleidoScope_SwitchPage(pauseCtx, 0);
|
||||
KaleidoScope_SetupPageSwitch(pauseCtx, PAGE_SWITCH_PT_LEFT);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -538,7 +607,7 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) {
|
|||
if (pauseCtx->stickAdjX < -30) {
|
||||
pauseCtx->pageSwitchInputTimer++;
|
||||
if ((pauseCtx->pageSwitchInputTimer >= 10) || (pauseCtx->pageSwitchInputTimer == 0)) {
|
||||
KaleidoScope_SwitchPage(pauseCtx, 0);
|
||||
KaleidoScope_SetupPageSwitch(pauseCtx, PAGE_SWITCH_PT_LEFT);
|
||||
}
|
||||
} else {
|
||||
pauseCtx->pageSwitchInputTimer = -1;
|
||||
|
@ -547,7 +616,7 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) {
|
|||
if (pauseCtx->stickAdjX > 30) {
|
||||
pauseCtx->pageSwitchInputTimer++;
|
||||
if ((pauseCtx->pageSwitchInputTimer >= 10) || (pauseCtx->pageSwitchInputTimer == 0)) {
|
||||
KaleidoScope_SwitchPage(pauseCtx, 2);
|
||||
KaleidoScope_SetupPageSwitch(pauseCtx, PAGE_SWITCH_PT_RIGHT);
|
||||
}
|
||||
} else {
|
||||
pauseCtx->pageSwitchInputTimer = -1;
|
||||
|
@ -1533,21 +1602,21 @@ void KaleidoScope_UpdateNamePanel(PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
void func_808237B4(PlayState* play, Input* input) {
|
||||
void KaleidoScope_UpdatePageSwitch(PlayState* play, Input* input) {
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
s32 cond = false;
|
||||
s32 mode;
|
||||
s32 frameAdvanceFreeze = false;
|
||||
s32 nextPageMode;
|
||||
|
||||
if (ZREG(13) && !CHECK_BTN_ALL(input->press.button, BTN_L)) {
|
||||
cond = true;
|
||||
if (R_PAUSE_PAGE_SWITCH_FRAME_ADVANCE_ON && !CHECK_BTN_ALL(input->press.button, BTN_L)) {
|
||||
frameAdvanceFreeze = true;
|
||||
}
|
||||
|
||||
if (!cond) {
|
||||
mode = pauseCtx->mode;
|
||||
pauseCtx->eye.x += D_8082ABAC[mode];
|
||||
pauseCtx->eye.z += D_8082ABCC[mode];
|
||||
if (!frameAdvanceFreeze) {
|
||||
nextPageMode = pauseCtx->nextPageMode;
|
||||
pauseCtx->eye.x += sPageSwitchEyeDx[nextPageMode];
|
||||
pauseCtx->eye.z += sPageSwitchEyeDz[nextPageMode];
|
||||
|
||||
if (pauseCtx->unk_1EA < 32) {
|
||||
if (pauseCtx->pageSwitchTimer < ((4 * PAGE_SWITCH_NSTEPS) / 2)) {
|
||||
WREG(16) -= WREG(25) / WREG(6);
|
||||
WREG(17) -= WREG(26) / WREG(6);
|
||||
} else {
|
||||
|
@ -1555,11 +1624,11 @@ void func_808237B4(PlayState* play, Input* input) {
|
|||
WREG(17) += WREG(26) / WREG(6);
|
||||
}
|
||||
|
||||
pauseCtx->unk_1EA += 4;
|
||||
pauseCtx->pageSwitchTimer += 4;
|
||||
|
||||
if (pauseCtx->unk_1EA == 64) {
|
||||
pauseCtx->unk_1EA = 0;
|
||||
pauseCtx->pageIndex = D_8082ABEC[pauseCtx->mode];
|
||||
if (pauseCtx->pageSwitchTimer == (4 * PAGE_SWITCH_NSTEPS)) {
|
||||
pauseCtx->pageSwitchTimer = 0;
|
||||
pauseCtx->pageIndex = sPageSwitchNextPageIndex[pauseCtx->nextPageMode];
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
|
||||
}
|
||||
}
|
||||
|
@ -2471,28 +2540,32 @@ void KaleidoScope_GrayOutTextureRGBA32(u32* texture, u16 pixelCount) {
|
|||
void KaleidoScope_UpdateOpening(PlayState* play) {
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
|
||||
pauseCtx->eye.x += D_8082ABAC[pauseCtx->mode] * ZREG(46);
|
||||
pauseCtx->eye.z += D_8082ABCC[pauseCtx->mode] * ZREG(46);
|
||||
pauseCtx->unk_1EA += 4 * ZREG(46);
|
||||
pauseCtx->eye.x += sPageSwitchEyeDx[pauseCtx->nextPageMode] * ZREG(46);
|
||||
pauseCtx->eye.z += sPageSwitchEyeDz[pauseCtx->nextPageMode] * ZREG(46);
|
||||
pauseCtx->pageSwitchTimer += 4 * ZREG(46);
|
||||
|
||||
if (pauseCtx->unk_1EA == (64 * ZREG(47))) {
|
||||
if (pauseCtx->pageSwitchTimer == (4 * PAGE_SWITCH_NSTEPS * ZREG(47))) {
|
||||
// Finished opening
|
||||
|
||||
func_80084BF4(play, 1);
|
||||
gSaveContext.buttonStatus[0] = D_8082AB6C[pauseCtx->pageIndex][0];
|
||||
gSaveContext.buttonStatus[1] = D_8082AB6C[pauseCtx->pageIndex][1];
|
||||
gSaveContext.buttonStatus[2] = D_8082AB6C[pauseCtx->pageIndex][2];
|
||||
gSaveContext.buttonStatus[3] = D_8082AB6C[pauseCtx->pageIndex][3];
|
||||
gSaveContext.buttonStatus[4] = D_8082AB6C[pauseCtx->pageIndex][4];
|
||||
pauseCtx->pageIndex = D_8082ABEC[pauseCtx->mode];
|
||||
|
||||
gSaveContext.buttonStatus[0] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex][0];
|
||||
gSaveContext.buttonStatus[1] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex][1];
|
||||
gSaveContext.buttonStatus[2] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex][2];
|
||||
gSaveContext.buttonStatus[3] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex][3];
|
||||
gSaveContext.buttonStatus[4] = gPageSwitchNextButtonStatus[pauseCtx->pageIndex][4];
|
||||
|
||||
pauseCtx->pageIndex = sPageSwitchNextPageIndex[pauseCtx->nextPageMode];
|
||||
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
|
||||
pauseCtx->state++; // PAUSE_STATE_MAIN
|
||||
|
||||
pauseCtx->alpha = 255;
|
||||
Interface_LoadActionLabelB(play, DO_ACTION_SAVE);
|
||||
} else if (pauseCtx->unk_1EA == 64) {
|
||||
} else if (pauseCtx->pageSwitchTimer == (4 * PAGE_SWITCH_NSTEPS * 1)) {
|
||||
// `ZREG(47)` is always 1 so this normally never happens
|
||||
pauseCtx->pageIndex = D_8082ABEC[pauseCtx->mode];
|
||||
pauseCtx->mode = (u16)(pauseCtx->pageIndex * 2) + 1;
|
||||
pauseCtx->pageIndex = sPageSwitchNextPageIndex[pauseCtx->nextPageMode];
|
||||
pauseCtx->nextPageMode = (u16)(pauseCtx->pageIndex * 2) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3071,7 +3144,7 @@ void KaleidoScope_Update(PlayState* play) {
|
|||
WREG(2) = -6240;
|
||||
func_800F64E0(0);
|
||||
} else if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
|
||||
pauseCtx->mode = 0;
|
||||
pauseCtx->nextPageMode = 0;
|
||||
pauseCtx->promptChoice = 0;
|
||||
Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
|
@ -3085,8 +3158,8 @@ void KaleidoScope_Update(PlayState* play) {
|
|||
}
|
||||
break;
|
||||
|
||||
case PAUSE_MAIN_STATE_1:
|
||||
func_808237B4(play, play->state.input);
|
||||
case PAUSE_MAIN_STATE_SWITCHING_PAGE:
|
||||
KaleidoScope_UpdatePageSwitch(play, play->state.input);
|
||||
break;
|
||||
|
||||
case PAUSE_MAIN_STATE_2:
|
||||
|
@ -3118,7 +3191,7 @@ void KaleidoScope_Update(PlayState* play) {
|
|||
} else if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
|
||||
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
|
||||
pauseCtx->mode = 0;
|
||||
pauseCtx->nextPageMode = 0;
|
||||
pauseCtx->promptChoice = 0;
|
||||
Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
|
@ -3168,7 +3241,7 @@ void KaleidoScope_Update(PlayState* play) {
|
|||
} else if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
|
||||
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
|
||||
pauseCtx->mode = 0;
|
||||
pauseCtx->nextPageMode = 0;
|
||||
pauseCtx->promptChoice = 0;
|
||||
Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
|
|
Loading…
Reference in a new issue