mirror of
https://github.com/zeldaret/mm.git
synced 2026-06-09 12:35:52 -04:00
Kaleido_Update OK and documented (#1113)
* Kaleido Update Co-authored-by: Derek-Hensley <hensley.derek58@gmail.com> * fill in enums * PR Suggestions * more PR Suggestions * missed one * pause state range macros * fix bss * PR suggestions, doc roll Co-authored-by: Derek-Hensley <hensley.derek58@gmail.com>
This commit is contained in:
+2
-1
@@ -1,6 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "system_malloc.h"
|
||||
#include "z64rumble.h"
|
||||
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
|
||||
|
||||
s32 gFramerateDivisor = 1;
|
||||
f32 gFramerateDivisorF = 1.0f;
|
||||
@@ -140,7 +141,7 @@ void Game_Update(GameState* gameState) {
|
||||
|
||||
gameState->main(gameState);
|
||||
|
||||
if (R_PAUSE_MENU_MODE != 2) {
|
||||
if (R_PAUSE_BG_PRERENDER_STATE != PAUSE_BG_PRERENDER_PROCESS) {
|
||||
GameState_Draw(gameState, gfxCtx);
|
||||
func_801736DC(gfxCtx);
|
||||
}
|
||||
|
||||
@@ -3318,7 +3318,7 @@ f32 BgCheck_RaycastFloorDyna(DynaRaycast* dynaRaycast) {
|
||||
|
||||
dynaActor = DynaPoly_GetActor(dynaRaycast->colCtx, *dynaRaycast->bgId);
|
||||
if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycast->play != NULL)) {
|
||||
pauseState = dynaRaycast->play->pauseCtx.state != 0;
|
||||
pauseState = (dynaRaycast->play->pauseCtx.state != PAUSE_STATE_OFF);
|
||||
if (!pauseState) {
|
||||
pauseState = dynaRaycast->play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE;
|
||||
}
|
||||
|
||||
@@ -35,24 +35,25 @@ void KaleidoScopeCall_Update(PlayState* play) {
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
|
||||
|
||||
if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) {
|
||||
if (pauseCtx->state == 1 || pauseCtx->state == 19) {
|
||||
if ((play->pauseCtx.state != PAUSE_STATE_OFF) || (play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) {
|
||||
if ((pauseCtx->state == PAUSE_STATE_OPENING_0) || (pauseCtx->state == PAUSE_STATE_OWLWARP_0)) {
|
||||
if (ShrinkWindow_Letterbox_GetSize() == 0) {
|
||||
R_PAUSE_MENU_MODE = 1;
|
||||
pauseCtx->unk_200 = 0;
|
||||
pauseCtx->unk_208 = 0;
|
||||
R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP;
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
|
||||
pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_0;
|
||||
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1;
|
||||
}
|
||||
} else if (pauseCtx->state == 8) {
|
||||
R_PAUSE_MENU_MODE = 1;
|
||||
pauseCtx->unk_200 = 0;
|
||||
pauseCtx->unk_208 = 0;
|
||||
} else if (pauseCtx->state == PAUSE_STATE_GAMEOVER_0) {
|
||||
R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP;
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE;
|
||||
pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_0;
|
||||
pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1;
|
||||
} else if ((pauseCtx->state == 2) || (pauseCtx->state == 9) || (pauseCtx->state == 20)) {
|
||||
if (R_PAUSE_MENU_MODE == 3) {
|
||||
} else if ((pauseCtx->state == PAUSE_STATE_OPENING_1) || (pauseCtx->state == PAUSE_STATE_GAMEOVER_1) ||
|
||||
(pauseCtx->state == PAUSE_STATE_OWLWARP_1)) {
|
||||
if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_DONE) {
|
||||
pauseCtx->state++;
|
||||
}
|
||||
} else if (pauseCtx->state != 0) {
|
||||
} else if (pauseCtx->state != PAUSE_STATE_OFF) {
|
||||
if (gKaleidoMgrCurOvl != kaleidoScopeOvl) {
|
||||
if (gKaleidoMgrCurOvl != NULL) {
|
||||
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
|
||||
@@ -64,7 +65,7 @@ void KaleidoScopeCall_Update(PlayState* play) {
|
||||
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
|
||||
sKaleidoScopeUpdateFunc(play);
|
||||
|
||||
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
|
||||
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
|
||||
KaleidoManager_ClearOvl(kaleidoScopeOvl);
|
||||
KaleidoScopeCall_LoadPlayer();
|
||||
}
|
||||
@@ -76,9 +77,9 @@ void KaleidoScopeCall_Update(PlayState* play) {
|
||||
void KaleidoScopeCall_Draw(PlayState* play) {
|
||||
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
|
||||
|
||||
if (R_PAUSE_MENU_MODE == 3) {
|
||||
if (((play->pauseCtx.state >= 4) && (play->pauseCtx.state <= 7)) ||
|
||||
((play->pauseCtx.state >= 11) && (play->pauseCtx.state <= 26))) {
|
||||
if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_DONE) {
|
||||
if (((play->pauseCtx.state >= PAUSE_STATE_OPENING_3) && (play->pauseCtx.state <= PAUSE_STATE_SAVEPROMPT)) ||
|
||||
((play->pauseCtx.state >= PAUSE_STATE_GAMEOVER_3) && (play->pauseCtx.state <= PAUSE_STATE_UNPAUSE_SETUP))) {
|
||||
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
|
||||
sKaleidoScopeDrawFunc(play);
|
||||
}
|
||||
|
||||
+37
-19
@@ -4,9 +4,24 @@
|
||||
#include "z64view.h"
|
||||
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
|
||||
|
||||
s16 D_801BDB00[] = { PAUSE_MAP, PAUSE_QUEST, PAUSE_MASK, PAUSE_ITEM };
|
||||
f32 sKaleidoSetupEyeX[] = { -64.0f, 0.0f, 64.0f, 0.0f };
|
||||
f32 sKaleidoSetupEyeZ[] = { 0.0f, -64.0f, 0.0f, 64.0f };
|
||||
s16 sKaleidoSetupRightPageIndex[] = {
|
||||
PAUSE_MAP, // PAUSE_ITEM
|
||||
PAUSE_QUEST, // PAUSE_MAP
|
||||
PAUSE_MASK, // PAUSE_QUEST
|
||||
PAUSE_ITEM, // PAUSE_MASK
|
||||
};
|
||||
f32 sKaleidoSetupRightPageEyeX[] = {
|
||||
PAUSE_EYE_DIST * -PAUSE_MAP_X, // PAUSE_ITEM
|
||||
PAUSE_EYE_DIST * -PAUSE_QUEST_X, // PAUSE_MAP
|
||||
PAUSE_EYE_DIST * -PAUSE_MASK_X, // PAUSE_QUEST
|
||||
PAUSE_EYE_DIST * -PAUSE_ITEM_X, // PAUSE_MASK
|
||||
};
|
||||
f32 sKaleidoSetupRightPageEyeZ[] = {
|
||||
PAUSE_EYE_DIST * -PAUSE_MAP_Z, // PAUSE_ITEM
|
||||
PAUSE_EYE_DIST * -PAUSE_QUEST_Z, // PAUSE_MAP
|
||||
PAUSE_EYE_DIST * -PAUSE_MASK_Z, // PAUSE_QUEST
|
||||
PAUSE_EYE_DIST * -PAUSE_ITEM_Z, // PAUSE_MASK
|
||||
};
|
||||
|
||||
void func_800F4A10(PlayState* play) {
|
||||
PauseContext* pauseCtx = &play->pauseCtx;
|
||||
@@ -14,18 +29,20 @@ void func_800F4A10(PlayState* play) {
|
||||
|
||||
Rumble_StateReset();
|
||||
|
||||
pauseCtx->unk_206 = 0;
|
||||
pauseCtx->unk_200 = 1;
|
||||
pauseCtx->eye.x = sKaleidoSetupEyeX[pauseCtx->pageIndex];
|
||||
pauseCtx->eye.z = sKaleidoSetupEyeZ[pauseCtx->pageIndex];
|
||||
pauseCtx->pageIndex = D_801BDB00[pauseCtx->pageIndex];
|
||||
pauseCtx->unk_27E = -40;
|
||||
pauseCtx->switchPageTimer = 0;
|
||||
pauseCtx->mainState = PAUSE_MAIN_STATE_SWITCHING_PAGE;
|
||||
|
||||
// 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->infoPanelOffsetY = -40;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(pauseCtx->worldMapPoints); i++) {
|
||||
pauseCtx->worldMapPoints[i] = false;
|
||||
}
|
||||
|
||||
if (pauseCtx->state == 1) {
|
||||
if (pauseCtx->state == PAUSE_STATE_OPENING_0) {
|
||||
for (i = 0; i < REGION_MAX; i++) {
|
||||
if ((gSaveContext.save.regionsVisited >> i) & 1) {
|
||||
pauseCtx->worldMapPoints[i] = true;
|
||||
@@ -72,7 +89,7 @@ void KaleidoSetup_Update(PlayState* play) {
|
||||
if (msgCtx && msgCtx) {}
|
||||
}
|
||||
|
||||
if ((pauseCtx->state == 0) && (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) &&
|
||||
if ((pauseCtx->state == PAUSE_STATE_OFF) && (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) &&
|
||||
(play->gameOverCtx.state == GAMEOVER_INACTIVE)) {
|
||||
if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) {
|
||||
if ((gSaveContext.save.cutscene < 0xFFF0) && (gSaveContext.nextCutsceneIndex < 0xFFF0)) {
|
||||
@@ -85,13 +102,14 @@ void KaleidoSetup_Update(PlayState* play) {
|
||||
if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) {
|
||||
gSaveContext.prevHudVisibility = gSaveContext.hudVisibility;
|
||||
pauseCtx->itemDescriptionOn = false;
|
||||
pauseCtx->state = 1;
|
||||
pauseCtx->state = PAUSE_STATE_OPENING_0;
|
||||
func_800F4A10(play);
|
||||
pauseCtx->mode = pauseCtx->pageIndex * 2 + 1;
|
||||
// Set next page mode to scroll left
|
||||
pauseCtx->nextPageMode = pauseCtx->pageIndex * 2 + 1;
|
||||
func_801A3A7C(1);
|
||||
}
|
||||
|
||||
if (pauseCtx->state == 1) {
|
||||
if (pauseCtx->state == PAUSE_STATE_OPENING_0) {
|
||||
Game_SetFramerateDivisor(&play->state, 2);
|
||||
if (ShrinkWindow_Letterbox_GetSizeTarget() != 0) {
|
||||
ShrinkWindow_Letterbox_SetSizeTarget(0);
|
||||
@@ -115,14 +133,14 @@ void KaleidoSetup_Init(PlayState* play) {
|
||||
|
||||
pauseCtx->pageIndex = PAUSE_ITEM;
|
||||
|
||||
pauseCtx->unk_21C = 160.0f;
|
||||
pauseCtx->unk_218 = 160.0f;
|
||||
pauseCtx->unk_214 = 160.0f;
|
||||
pauseCtx->unk_210 = 160.0f;
|
||||
pauseCtx->maskPageRoll = 160.0f;
|
||||
pauseCtx->questPageRoll = 160.0f;
|
||||
pauseCtx->mapPageRoll = 160.0f;
|
||||
pauseCtx->itemPageRoll = 160.0f;
|
||||
|
||||
pauseCtx->eye.x = -64.0f;
|
||||
pauseCtx->unk_20C = 936.0f;
|
||||
pauseCtx->unk_220 = -314.0f;
|
||||
pauseCtx->roll = -314.0f;
|
||||
|
||||
pauseCtx->cursorPoint[PAUSE_MAP] = R_REVERSE_FLOOR_INDEX + (DUNGEON_FLOOR_INDEX_4 - 1);
|
||||
|
||||
|
||||
@@ -399,7 +399,7 @@ void LifeMeter_UpdateSizeAndBeep(PlayState* play) {
|
||||
if (interfaceCtx->lifeSizeChange <= 0) {
|
||||
interfaceCtx->lifeSizeChange = 0;
|
||||
interfaceCtx->lifeSizeChangeDirection = 0;
|
||||
if (!Player_InCsMode(play) && (play->pauseCtx.state == 0) &&
|
||||
if (!Player_InCsMode(play) && (play->pauseCtx.state == PAUSE_STATE_OFF) &&
|
||||
(play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && LifeMeter_IsCritical() && !Play_InCsMode(play)) {
|
||||
play_sound(NA_SE_SY_HITPOINT_ALARM);
|
||||
}
|
||||
|
||||
@@ -226,8 +226,8 @@ void Map_Update(PlayState* play) {
|
||||
s16 floor;
|
||||
s32 pad2;
|
||||
|
||||
if ((play->pauseCtx.state < 4) && (CHECK_BTN_ALL(controller->press.button, BTN_L)) && (!Play_InCsMode(play)) &&
|
||||
(!func_80106530(play))) {
|
||||
if ((play->pauseCtx.state <= PAUSE_STATE_OPENING_2) && (CHECK_BTN_ALL(controller->press.button, BTN_L)) &&
|
||||
!Play_InCsMode(play) && !func_80106530(play)) {
|
||||
if (!R_MINIMAP_DISABLED) {
|
||||
play_sound(NA_SE_SY_CAMERA_ZOOM_UP);
|
||||
} else {
|
||||
@@ -239,7 +239,7 @@ void Map_Update(PlayState* play) {
|
||||
|
||||
func_80105B34(play);
|
||||
|
||||
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
|
||||
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) {
|
||||
if (Map_IsInDungeonArea(play)) {
|
||||
floor = func_80109124(player->actor.world.pos.y);
|
||||
if (floor != -1) {
|
||||
|
||||
@@ -2309,7 +2309,7 @@ void Magic_Update(PlayState* play) {
|
||||
|
||||
case MAGIC_STATE_CONSUME_LENS:
|
||||
// Slowly consume magic while Lens of Truth is active
|
||||
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) &&
|
||||
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) &&
|
||||
(msgCtx->msgMode == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) &&
|
||||
(play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) &&
|
||||
!Play_InCsMode(play)) {
|
||||
@@ -2352,9 +2352,9 @@ void Magic_Update(PlayState* play) {
|
||||
gSaveContext.magicState = MAGIC_STATE_CONSUME_GORON_ZORA;
|
||||
// fallthrough
|
||||
case MAGIC_STATE_CONSUME_GORON_ZORA:
|
||||
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == 0) && (msgCtx->msgMode == 0) &&
|
||||
(play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
|
||||
(play->transitionMode == TRANS_MODE_OFF)) {
|
||||
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == 0) &&
|
||||
(msgCtx->msgMode == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) &&
|
||||
(play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) {
|
||||
if (!Play_InCsMode(play)) {
|
||||
interfaceCtx->magicConsumptionTimer--;
|
||||
if (interfaceCtx->magicConsumptionTimer == 0) {
|
||||
@@ -2374,7 +2374,7 @@ void Magic_Update(PlayState* play) {
|
||||
break;
|
||||
|
||||
case MAGIC_STATE_CONSUME_GIANTS_MASK:
|
||||
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) &&
|
||||
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) &&
|
||||
(msgCtx->msgMode == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) &&
|
||||
(play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) {
|
||||
if (!Play_InCsMode(play)) {
|
||||
@@ -2680,7 +2680,7 @@ void Interface_DrawTimers(PlayState* play) {
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
// Not satisfying any of these conditions will pause the timer
|
||||
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) &&
|
||||
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) &&
|
||||
(play->gameOverCtx.state == GAMEOVER_INACTIVE) &&
|
||||
((msgCtx->msgMode == 0) ||
|
||||
((msgCtx->msgMode != 0) && (msgCtx->currentTextId >= 0x1BB2) && (msgCtx->currentTextId <= 0x1BB6))) &&
|
||||
@@ -3125,7 +3125,7 @@ void Interface_UpdateBottleTimers(PlayState* play) {
|
||||
s32 pad[2];
|
||||
|
||||
// Not satisfying any of these conditions will pause the bottle timer
|
||||
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) &&
|
||||
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) &&
|
||||
(play->gameOverCtx.state == GAMEOVER_INACTIVE) &&
|
||||
((msgCtx->msgMode == 0) || ((msgCtx->currentTextId >= 0x100) && (msgCtx->currentTextId <= 0x200)) ||
|
||||
((msgCtx->currentTextId >= 0x1BB2) && (msgCtx->currentTextId <= 0x1BB6))) &&
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h"
|
||||
|
||||
Gfx sSetupDL[438] = {
|
||||
/* 0x00 */
|
||||
@@ -1328,7 +1329,7 @@ void func_8012CF0C(GraphicsContext* gfxCtx, s32 clearFb, s32 clearZb, u8 r, u8 g
|
||||
}
|
||||
|
||||
void func_8012D374(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
|
||||
if ((R_PAUSE_MENU_MODE < 2) && (D_801F6D10 < 2)) {
|
||||
if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (D_801F6D10 < 2)) {
|
||||
func_8012CF0C(gfxCtx, true, true, r, g, b);
|
||||
} else {
|
||||
func_8012CF0C(gfxCtx, false, false, r, g, b);
|
||||
|
||||
Reference in New Issue
Block a user