1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-02 22:14:33 +00:00

Document pause states (excluding gameover) (#1483)

* Document PauseContext.state

* Very light docs surrounding pause states

* PAUSE_STATE_UNPAUSE -> PAUSE_STATE_RESUME_GAMEPLAY and comment on purpose in the enum

* PAUSE_STATE_MAIN -> PAUSE_STATE_6

* format

* Player_InitDrawPause -> Player_InitPauseDrawData
This commit is contained in:
Dragorn421 2023-09-06 17:14:15 +02:00 committed by GitHub
parent 475b8a1eba
commit d314cfe923
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 174 additions and 139 deletions

View file

@ -72,7 +72,7 @@ void EnOkarinaEffect_TriggerStorm(EnOkarinaEffect* this, PlayState* play) {
void EnOkarinaEffect_ManageStorm(EnOkarinaEffect* this, PlayState* play) {
CutsceneFlags_Unset(play, 5);
if (((play->pauseCtx.state == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) &&
if (((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) &&
(play->msgCtx.msgLength == 0) && (!FrameAdvance_IsEnabled(play)) &&
((play->transitionMode == TRANS_MODE_OFF) || (gSaveContext.gameMode != GAMEMODE_NORMAL))) ||
(this->timer >= 250)) {

View file

@ -86,7 +86,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
if (pauseCtx->cursorSpecialPos == 0) {
pauseCtx->nameColorSet = 0;
if ((pauseCtx->state != 6) || ((pauseCtx->stickAdjX == 0) && (pauseCtx->stickAdjY == 0))) {
if ((pauseCtx->state != PAUSE_STATE_6) || ((pauseCtx->stickAdjX == 0) && (pauseCtx->stickAdjY == 0))) {
sp216 = pauseCtx->cursorSlot[PAUSE_QUEST];
} else {
phi_s3 = pauseCtx->cursorPoint[PAUSE_QUEST];
@ -178,7 +178,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
KaleidoScope_SetCursorVtx(pauseCtx, sp216 * 4, pauseCtx->questVtx);
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->cursorSpecialPos == 0)) {
if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->cursorSpecialPos == 0)) {
if ((sp216 >= QUEST_SONG_MINUET) && (sp216 < QUEST_KOKIRI_EMERALD)) {
if (CHECK_QUEST_ITEM(pauseCtx->cursorPoint[PAUSE_QUEST])) {
sp216 = pauseCtx->cursorSlot[PAUSE_QUEST];
@ -444,7 +444,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
if ((pauseCtx->state == 4) || (pauseCtx->state == 0x12)) {
if ((pauseCtx->state == PAUSE_STATE_OPENING_1) || (pauseCtx->state == PAUSE_STATE_CLOSING)) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, D_8082A070[0][0], D_8082A070[0][1], D_8082A070[0][2],
pauseCtx->alpha);
} else {
@ -462,7 +462,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) {
48, 48, 0);
}
if (pauseCtx->state == 6) {
if (pauseCtx->state == PAUSE_STATE_6) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);

View file

@ -152,7 +152,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
}
}
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_EQUIP)) {
if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_EQUIP)) {
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_EQUIP];
pauseCtx->cursorColorSet = 0;
@ -469,9 +469,9 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
KaleidoScope_SetCursorVtx(pauseCtx, cursorSlot * 4, pauseCtx->equipVtx);
if ((pauseCtx->cursorSpecialPos == 0) && (cursorItem != PAUSE_ITEM_NONE) && (pauseCtx->state == 6) &&
(pauseCtx->unk_1E4 == 0) && CHECK_BTN_ALL(input->press.button, BTN_A) &&
(pauseCtx->cursorX[PAUSE_EQUIP] != 0)) {
if ((pauseCtx->cursorSpecialPos == 0) && (cursorItem != PAUSE_ITEM_NONE) &&
(pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) &&
CHECK_BTN_ALL(input->press.button, BTN_A) && (pauseCtx->cursorX[PAUSE_EQUIP] != 0)) {
if ((gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] == 9) ||
(gEquipAgeReqs[pauseCtx->cursorY[PAUSE_EQUIP]][pauseCtx->cursorX[PAUSE_EQUIP]] ==

View file

@ -103,7 +103,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
pauseCtx->cursorColorSet = 0;
pauseCtx->nameColorSet = 0;
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM)) {
if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_ITEM)) {
moveCursorResult = 0;
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_ITEM];
@ -349,7 +349,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) {
index = cursorSlot * 4; // required to match?
KaleidoScope_SetCursorVtx(pauseCtx, index, pauseCtx->itemVtx);
if ((pauseCtx->debugState == 0) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) {
if ((pauseCtx->debugState == 0) && (pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0)) {
if (CHECK_BTN_ANY(input->press.button, BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) {
if (((gSlotAgeReqs[cursorSlot] == 9) ||
(gSlotAgeReqs[cursorSlot] == ((void)0, gSaveContext.save.linkAge))) &&

View file

@ -46,7 +46,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) {
OPEN_DISPS(gfxCtx, "../z_kaleido_map_PAL.c", 123);
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) {
if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) {
pauseCtx->cursorColorSet = 0;
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_MAP];
@ -410,7 +410,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) {
OPEN_DISPS(gfxCtx, "../z_kaleido_map_PAL.c", 556);
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) {
if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0) && (pauseCtx->pageIndex == PAUSE_MAP)) {
pauseCtx->cursorColorSet = 0;
oldCursorPoint = pauseCtx->cursorPoint[PAUSE_WORLD_MAP];

View file

@ -8,7 +8,8 @@ void KaleidoScope_UpdatePrompt(PlayState* play) {
s8 stickAdjX = input->rel.stick_x;
s16 step;
if (((pauseCtx->state == 7) && (pauseCtx->unk_1EC == 1)) || (pauseCtx->state == 0xE) || (pauseCtx->state == 0x10)) {
if (((pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) && (pauseCtx->unk_1EC == 1)) ||
(pauseCtx->state == PAUSE_STATE_14) || (pauseCtx->state == PAUSE_STATE_16)) {
if ((pauseCtx->promptChoice == 0) && (stickAdjX >= 30)) {
Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);

View file

@ -436,7 +436,7 @@ void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) {
temp = pauseCtx->unk_1E4;
if ((((pauseCtx->unk_1E4 == 0) || (temp == 8)) && (pauseCtx->state == 6)) ||
if ((((pauseCtx->unk_1E4 == 0) || (temp == 8)) && (pauseCtx->state == PAUSE_STATE_6)) ||
((pauseCtx->pageIndex == PAUSE_QUEST) && ((temp < 3) || (temp == 5) || (temp == 8)))) {
if (pauseCtx->pageIndex == pageIndex) {
@ -519,8 +519,8 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
OPEN_DISPS(gfxCtx, "../z_kaleido_scope_PAL.c", 1100);
if ((pauseCtx->state < 8) || (pauseCtx->state > 0x11)) {
if (pauseCtx->state != 7) {
if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) {
if (pauseCtx->state != PAUSE_STATE_SAVE_PROMPT) {
stepR = ABS(D_8082AB8C - D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][0]) / D_8082AD3C;
stepG = ABS(D_8082AB90 - D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][1]) / D_8082AD3C;
stepB = ABS(D_8082AB94 - D_8082ACF4[pauseCtx->cursorColorSet + D_8082AD40][2]) / D_8082AD3C;
@ -785,7 +785,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
Gfx_SetupDL_42Opa(gfxCtx);
if ((pauseCtx->state == 7) || ((pauseCtx->state >= 8) && (pauseCtx->state < 0x12))) {
if ((pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) || IS_PAUSE_STATE_GAMEOVER(pauseCtx)) {
KaleidoScope_UpdatePrompt(play);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA, G_CC_MODULATEIA);
@ -822,16 +822,17 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx, "../z_kaleido_scope_PAL.c", 1424),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if ((pauseCtx->state >= 8) && (pauseCtx->state <= 0x11)) {
if (IS_PAUSE_STATE_GAMEOVER(pauseCtx)) {
POLY_OPA_DISP = KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->saveVtx, sGameOverTexs);
} else {
} else { // PAUSE_STATE_SAVE_PROMPT
POLY_OPA_DISP =
KaleidoScope_DrawPageSections(POLY_OPA_DISP, pauseCtx->saveVtx, sSaveTexs[gSaveContext.language]);
}
gSPVertex(POLY_OPA_DISP++, &pauseCtx->saveVtx[60], 32, 0);
if (((pauseCtx->state == 7) && (pauseCtx->unk_1EC < 4)) || (pauseCtx->state == 0xE)) {
if (((pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) && (pauseCtx->unk_1EC < 4)) ||
(pauseCtx->state == PAUSE_STATE_14)) {
POLY_OPA_DISP =
KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sSavePromptTexs[gSaveContext.language], 152, 16, 0);
@ -854,8 +855,9 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
POLY_OPA_DISP =
KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sPromptChoiceTexs[gSaveContext.language][1], 48, 16, 16);
} else if ((pauseCtx->state != 7) || (pauseCtx->unk_1EC < 4)) {
if ((pauseCtx->state != 0xF) && ((pauseCtx->state == 0x10) || (pauseCtx->state == 0x11))) {
} else if ((pauseCtx->state != PAUSE_STATE_SAVE_PROMPT) || (pauseCtx->unk_1EC < 4)) {
if ((pauseCtx->state != PAUSE_STATE_15) &&
((pauseCtx->state == PAUSE_STATE_16) || (pauseCtx->state == PAUSE_STATE_17))) {
POLY_OPA_DISP =
KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, sContinuePromptTexs[gSaveContext.language], 152, 16, 0);
@ -885,7 +887,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) {
gDPSetCombineLERP(POLY_OPA_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
if ((pauseCtx->state != 0x10) && (pauseCtx->state != 0x11)) {
if ((pauseCtx->state != PAUSE_STATE_16) && (pauseCtx->state != PAUSE_STATE_17)) {
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 0, pauseCtx->alpha);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
}
@ -1119,7 +1121,8 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
gDPSetEnvColor(POLY_OPA_DISP++, 20, 30, 40, 0);
if ((pauseCtx->state == 6) && (pauseCtx->namedItem != PAUSE_ITEM_NONE) && (pauseCtx->nameDisplayTimer < WREG(89)) &&
if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->namedItem != PAUSE_ITEM_NONE) &&
(pauseCtx->nameDisplayTimer < WREG(89)) &&
(((u32)pauseCtx->unk_1E4 == 0) || (pauseCtx->unk_1E4 == 2) ||
((pauseCtx->unk_1E4 >= 4) && (pauseCtx->unk_1E4 <= 7)) || (pauseCtx->unk_1E4 == 8)) &&
(pauseCtx->cursorSpecialPos == 0)) {
@ -1198,7 +1201,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
gSPVertex(POLY_OPA_DISP++, &pauseCtx->infoPanelVtx[16], 8, 0);
if (pauseCtx->state == 7) {
if (pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) {
pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = WREG(61 + gSaveContext.language);
pauseCtx->infoPanelVtx[17].v.ob[0] = pauseCtx->infoPanelVtx[19].v.ob[0] =
@ -1223,7 +1226,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) {
POLY_OPA_DISP = KaleidoScope_QuadTextureIA8(POLY_OPA_DISP, D_8082AD60[gSaveContext.language],
D_8082ADE0[gSaveContext.language], 16, 4);
} else if (pauseCtx->cursorSpecialPos != 0) {
if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) {
if ((pauseCtx->state == PAUSE_STATE_6) && (pauseCtx->unk_1E4 == 0)) {
pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = -63;
pauseCtx->infoPanelVtx[17].v.ob[0] = pauseCtx->infoPanelVtx[19].v.ob[0] =
@ -1655,7 +1658,7 @@ s16 func_80823A0C(PlayState* play, Vtx* vtx, s16 arg2, s16 arg3) {
vtx[phi_t1 + 1].v.ob[0] = vtx[phi_t1 + 3].v.ob[0] = vtx[phi_t1 + 0].v.ob[0] + ptr2[phi_t3];
if (!((pauseCtx->state >= 8) && (pauseCtx->state <= 0x11))) {
if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) {
vtx[phi_t1 + 0].v.ob[1] = vtx[phi_t1 + 1].v.ob[1] = ptr3[phi_t3] + pauseCtx->offsetY;
} else {
vtx[phi_t1 + 0].v.ob[1] = vtx[phi_t1 + 1].v.ob[1] = YREG(60 + phi_t3) + pauseCtx->offsetY;
@ -1786,9 +1789,9 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) {
pauseCtx->offsetY = 0;
if ((pauseCtx->state == 4) || (pauseCtx->state >= 0x12) ||
((pauseCtx->state == 7) && ((pauseCtx->unk_1EC == 2) || (pauseCtx->unk_1EC == 5))) ||
((pauseCtx->state >= 8) && (pauseCtx->state <= 0xD))) {
if ((pauseCtx->state == PAUSE_STATE_OPENING_1) || (pauseCtx->state >= PAUSE_STATE_CLOSING) ||
((pauseCtx->state == PAUSE_STATE_SAVE_PROMPT) && ((pauseCtx->unk_1EC == 2) || (pauseCtx->unk_1EC == 5))) ||
((pauseCtx->state >= PAUSE_STATE_8) && (pauseCtx->state <= PAUSE_STATE_13))) {
pauseCtx->offsetY = 80;
}
@ -2296,12 +2299,12 @@ void KaleidoScope_Draw(PlayState* play) {
KaleidoScope_SetView(pauseCtx, 0.0f, 0.0f, 64.0f);
if (!((pauseCtx->state >= 8) && (pauseCtx->state <= 0x11))) {
if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) {
KaleidoScope_DrawInfoPanel(play);
}
}
if ((pauseCtx->state >= 0xB) && (pauseCtx->state <= 0x11)) {
if ((pauseCtx->state >= PAUSE_STATE_11) && (pauseCtx->state <= PAUSE_STATE_17)) {
KaleidoScope_DrawGameOver(play);
}
@ -2333,7 +2336,7 @@ void KaleidoScope_GrayOutTextureRGBA32(u32* texture, u16 pixelCount) {
}
}
void func_808265BC(PlayState* play) {
void KaleidoScope_UpdateOpening(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx;
pauseCtx->eye.x += D_8082ABAC[pauseCtx->mode] * ZREG(46);
@ -2341,6 +2344,8 @@ void func_808265BC(PlayState* play) {
pauseCtx->unk_1EA += 4 * ZREG(46);
if (pauseCtx->unk_1EA == (64 * ZREG(47))) {
// Finished opening
func_80084BF4(play, 1);
gSaveContext.buttonStatus[0] = D_8082AB6C[pauseCtx->pageIndex][0];
gSaveContext.buttonStatus[1] = D_8082AB6C[pauseCtx->pageIndex][1];
@ -2349,10 +2354,11 @@ void func_808265BC(PlayState* play) {
gSaveContext.buttonStatus[4] = D_8082AB6C[pauseCtx->pageIndex][4];
pauseCtx->pageIndex = D_8082ABEC[pauseCtx->mode];
pauseCtx->unk_1E4 = 0;
pauseCtx->state++;
pauseCtx->state++; // PAUSE_STATE_6
pauseCtx->alpha = 255;
Interface_LoadActionLabelB(play, DO_ACTION_SAVE);
} else if (pauseCtx->unk_1EA == 64) {
// `ZREG(47)` is always 1 so this normally never happens
pauseCtx->pageIndex = D_8082ABEC[pauseCtx->mode];
pauseCtx->mode = (u16)(pauseCtx->pageIndex * 2) + 1;
}
@ -2501,10 +2507,10 @@ void KaleidoScope_Update(PlayState* play) {
s32 pad;
if ((R_PAUSE_BG_PRERENDER_STATE >= PAUSE_BG_PRERENDER_READY) &&
(((pauseCtx->state >= 4) && (pauseCtx->state <= 7)) ||
((pauseCtx->state >= 0xA) && (pauseCtx->state <= 0x12)))) {
(((pauseCtx->state >= PAUSE_STATE_OPENING_1) && (pauseCtx->state <= PAUSE_STATE_SAVE_PROMPT)) ||
((pauseCtx->state >= PAUSE_STATE_10) && (pauseCtx->state <= PAUSE_STATE_CLOSING)))) {
if ((((u32)pauseCtx->unk_1E4 == 0) || (pauseCtx->unk_1E4 == 8)) && (pauseCtx->state == 6)) {
if ((((u32)pauseCtx->unk_1E4 == 0) || (pauseCtx->unk_1E4 == 8)) && (pauseCtx->state == PAUSE_STATE_6)) {
pauseCtx->stickAdjX = input->rel.stick_x;
pauseCtx->stickAdjY = input->rel.stick_y;
KaleidoScope_UpdateCursorSize(play);
@ -2513,13 +2519,13 @@ void KaleidoScope_Update(PlayState* play) {
KaleidoScope_UpdateCursorSize(play);
}
if (pauseCtx->state == 6) {
if (pauseCtx->state == PAUSE_STATE_6) {
KaleidoScope_UpdateNamePanel(play);
}
}
switch (pauseCtx->state) {
case 3:
case PAUSE_STATE_INIT:
D_808321A8[0] = gSaveContext.buttonStatus[0];
D_808321A8[1] = gSaveContext.buttonStatus[1];
D_808321A8[2] = gSaveContext.buttonStatus[2];
@ -2538,7 +2544,7 @@ void KaleidoScope_Update(PlayState* play) {
//! @bug messed up alignment, should match `ALIGN64`
pauseCtx->playerSegment = (void*)(((uintptr_t)play->objectCtx.spaceStart + 0x30) & ~0x3F);
size1 = func_80091738(play, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime);
size1 = Player_InitPauseDrawData(play, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime);
osSyncPrintf("プレイヤー size1%x\n", size1);
pauseCtx->iconItemSegment = (void*)ALIGN16((uintptr_t)pauseCtx->playerSegment + size1);
@ -2888,11 +2894,13 @@ void KaleidoScope_Update(PlayState* play) {
}
}
pauseCtx->state = 4;
pauseCtx->state = PAUSE_STATE_OPENING_1;
break;
case 4:
case PAUSE_STATE_OPENING_1:
if (pauseCtx->unk_1F4 == 160.0f) {
// First frame in this state
KaleidoScope_SetDefaultCursor(play);
KaleidoScope_ProcessPlayerPreRender();
}
@ -2908,26 +2916,27 @@ void KaleidoScope_Update(PlayState* play) {
if (pauseCtx->unk_1F4 == 0) {
interfaceCtx->startAlpha = 255;
WREG(2) = 0;
pauseCtx->state = 5;
pauseCtx->state = PAUSE_STATE_OPENING_2;
}
func_808265BC(play);
KaleidoScope_UpdateOpening(play);
break;
case 5:
case PAUSE_STATE_OPENING_2:
pauseCtx->alpha += (u16)(255 / (WREG(6) + WREG(4)));
func_808265BC(play);
if (pauseCtx->state == 6) {
KaleidoScope_UpdateOpening(play);
if (pauseCtx->state == PAUSE_STATE_6) {
KaleidoScope_UpdateNamePanel(play);
}
break;
case 6:
case PAUSE_STATE_6:
switch (pauseCtx->unk_1E4) {
case 0:
if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
Interface_SetDoAction(play, DO_ACTION_NONE);
pauseCtx->state = 0x12;
pauseCtx->state = PAUSE_STATE_CLOSING;
WREG(2) = -6240;
func_800F64E0(0);
} else if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
@ -2941,7 +2950,7 @@ void KaleidoScope_Update(PlayState* play) {
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
pauseCtx->unk_1EC = 0;
pauseCtx->state = 7;
pauseCtx->state = PAUSE_STATE_SAVE_PROMPT;
}
break;
@ -2970,7 +2979,7 @@ void KaleidoScope_Update(PlayState* play) {
if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
Interface_SetDoAction(play, DO_ACTION_NONE);
pauseCtx->state = 0x12;
pauseCtx->state = PAUSE_STATE_CLOSING;
WREG(2) = -6240;
func_800F64E0(0);
pauseCtx->unk_1E4 = 0;
@ -2988,7 +2997,7 @@ void KaleidoScope_Update(PlayState* play) {
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
pauseCtx->unk_1EC = 0;
pauseCtx->state = 7;
pauseCtx->state = PAUSE_STATE_SAVE_PROMPT;
} else if (pauseCtx->ocarinaStaff->state == pauseCtx->ocarinaSongIdx) {
Audio_PlaySfxGeneral(NA_SE_SY_TRE_BOX_APPEAR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
@ -3021,7 +3030,7 @@ void KaleidoScope_Update(PlayState* play) {
if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF);
Interface_SetDoAction(play, DO_ACTION_NONE);
pauseCtx->state = 0x12;
pauseCtx->state = PAUSE_STATE_CLOSING;
WREG(2) = -6240;
func_800F64E0(0);
pauseCtx->unk_1E4 = 0;
@ -3038,7 +3047,7 @@ void KaleidoScope_Update(PlayState* play) {
gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE;
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL);
pauseCtx->unk_1EC = 0;
pauseCtx->state = 7;
pauseCtx->state = PAUSE_STATE_SAVE_PROMPT;
}
break;
@ -3051,7 +3060,7 @@ void KaleidoScope_Update(PlayState* play) {
}
break;
case 7:
case PAUSE_STATE_SAVE_PROMPT:
switch (pauseCtx->unk_1EC) {
case 0:
pauseCtx->unk_204 -= 314.0f / WREG(6);
@ -3120,7 +3129,7 @@ void KaleidoScope_Update(PlayState* play) {
WREG(16) += WREG(25) / WREG(6);
WREG(17) += WREG(26) / WREG(6);
if (pauseCtx->unk_204 >= -314.0f) {
pauseCtx->state = 6;
pauseCtx->state = PAUSE_STATE_6;
pauseCtx->unk_1EC = 0;
pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 = 0.0f;
pauseCtx->unk_204 = -314.0f;
@ -3143,7 +3152,7 @@ void KaleidoScope_Update(PlayState* play) {
}
} else {
pauseCtx->debugState = 0;
pauseCtx->state = 0x13;
pauseCtx->state = PAUSE_STATE_RESUME_GAMEPLAY;
pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 = 160.0f;
pauseCtx->namedItem = PAUSE_ITEM_NONE;
pauseCtx->unk_1E4 = 0;
@ -3153,7 +3162,7 @@ void KaleidoScope_Update(PlayState* play) {
}
break;
case 0xA:
case PAUSE_STATE_10:
pauseCtx->cursorSlot[PAUSE_MAP] = pauseCtx->cursorPoint[PAUSE_MAP] = pauseCtx->dungeonMapSlot =
VREG(30) + 3;
WREG(16) = -175;
@ -3210,10 +3219,10 @@ void KaleidoScope_Update(PlayState* play) {
D_8082B260 = 30;
VREG(88) = 98;
pauseCtx->promptChoice = 0;
pauseCtx->state++;
pauseCtx->state++; // PAUSE_STATE_11
break;
case 0xB:
case PAUSE_STATE_11:
stepR = ABS(D_8082AB8C - 30) / D_8082B260;
stepG = ABS(D_8082AB90) / D_8082B260;
stepB = ABS(D_8082AB94) / D_8082B260;
@ -3269,19 +3278,19 @@ void KaleidoScope_Update(PlayState* play) {
D_8082ABA0 = 130;
D_8082ABA4 = 0;
pauseCtx->state++;
pauseCtx->state++; // PAUSE_STATE_12
D_8082B260 = 40;
}
break;
case 0xC:
case PAUSE_STATE_12:
D_8082B260--;
if (D_8082B260 == 0) {
pauseCtx->state = 0xD;
pauseCtx->state = PAUSE_STATE_13;
}
break;
case 0xD:
case PAUSE_STATE_13:
pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 = pauseCtx->unk_204 -=
160.0f / WREG(6);
pauseCtx->infoPanelOffsetY += 40 / WREG(6);
@ -3297,7 +3306,7 @@ void KaleidoScope_Update(PlayState* play) {
VREG(88) = 66;
WREG(2) = 0;
pauseCtx->alpha = 255;
pauseCtx->state = 0xE;
pauseCtx->state = PAUSE_STATE_14;
gSaveContext.save.info.playerData.deaths++;
if (gSaveContext.save.info.playerData.deaths > 999) {
gSaveContext.save.info.playerData.deaths = 999;
@ -3306,13 +3315,13 @@ void KaleidoScope_Update(PlayState* play) {
osSyncPrintf("kscope->angle_s = %f\n", pauseCtx->unk_204);
break;
case 0xE:
case PAUSE_STATE_14:
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
if (pauseCtx->promptChoice != 0) {
pauseCtx->promptChoice = 0;
Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
pauseCtx->state = 0x10;
pauseCtx->state = PAUSE_STATE_16;
gameOverCtx->state++;
} else {
Audio_PlaySfxGeneral(NA_SE_SY_PIECE_OF_HEART, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
@ -3321,26 +3330,26 @@ void KaleidoScope_Update(PlayState* play) {
Play_SaveSceneFlags(play);
gSaveContext.save.info.playerData.savedSceneId = play->sceneId;
Sram_WriteSave(&play->sramCtx);
pauseCtx->state = 0xF;
pauseCtx->state = PAUSE_STATE_15;
D_8082B25C = 3;
}
}
break;
case 0xF:
case PAUSE_STATE_15:
D_8082B25C--;
if (D_8082B25C == 0) {
pauseCtx->state = 0x10;
pauseCtx->state = PAUSE_STATE_16;
gameOverCtx->state++;
} else if ((D_8082B25C <= 80) &&
(CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START))) {
pauseCtx->state = 0x10;
pauseCtx->state = PAUSE_STATE_16;
gameOverCtx->state++;
func_800F64E0(0);
}
break;
case 0x10:
case PAUSE_STATE_16:
if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START)) {
if (pauseCtx->promptChoice == 0) {
Audio_PlaySfxGeneral(NA_SE_SY_PIECE_OF_HEART, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
@ -3406,16 +3415,16 @@ void KaleidoScope_Update(PlayState* play) {
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
pauseCtx->state = 0x11;
pauseCtx->state = PAUSE_STATE_17;
}
break;
case 0x11:
case PAUSE_STATE_17:
if (interfaceCtx->unk_244 != 255) {
interfaceCtx->unk_244 += 10;
if (interfaceCtx->unk_244 >= 255) {
interfaceCtx->unk_244 = 255;
pauseCtx->state = 0;
pauseCtx->state = PAUSE_STATE_OFF;
R_UPDATE_RATE = 3;
R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_OFF;
func_800981B8(&play->objectCtx);
@ -3449,7 +3458,7 @@ void KaleidoScope_Update(PlayState* play) {
}
break;
case 0x12:
case PAUSE_STATE_CLOSING:
if (pauseCtx->unk_1F4 != 160.0f) {
pauseCtx->unk_1F4 = pauseCtx->unk_1F8 = pauseCtx->unk_1FC = pauseCtx->unk_200 += 160.0f / WREG(6);
pauseCtx->infoPanelOffsetY -= 40 / WREG(6);
@ -3463,7 +3472,7 @@ void KaleidoScope_Update(PlayState* play) {
}
} else {
pauseCtx->debugState = 0;
pauseCtx->state = 0x13;
pauseCtx->state = PAUSE_STATE_RESUME_GAMEPLAY;
pauseCtx->unk_200 = 160.0f;
pauseCtx->unk_1FC = 160.0f;
pauseCtx->unk_1F8 = 160.0f;
@ -3473,10 +3482,11 @@ void KaleidoScope_Update(PlayState* play) {
}
break;
case 0x13:
pauseCtx->state = 0;
case PAUSE_STATE_RESUME_GAMEPLAY:
pauseCtx->state = PAUSE_STATE_OFF;
R_UPDATE_RATE = 3;
R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_OFF;
func_800981B8(&play->objectCtx);
func_800418D0(&play->colCtx, play);

View file

@ -80,7 +80,7 @@ void PauseMapMark_DrawForDungeon(PlayState* play) {
Matrix_Push();
if ((play->pauseCtx.state == 4) || (play->pauseCtx.state >= 0x12)) {
if ((play->pauseCtx.state == PAUSE_STATE_OPENING_1) || (play->pauseCtx.state >= PAUSE_STATE_CLOSING)) {
Matrix_Translate(-36.0f, 101.0f, 0.0f, MTXMODE_APPLY);
} else {
Matrix_Translate(-36.0f, 21.0f, 0.0f, MTXMODE_APPLY);