diff --git a/include/functions.h b/include/functions.h index fdd61205e1..8e819af55f 100644 --- a/include/functions.h +++ b/include/functions.h @@ -294,11 +294,6 @@ void GetItem_Draw(PlayState* play, s16 drawId); u16 QuestHint_GetTatlTextId(PlayState* play); -void func_800F4A10(PlayState* play); -void KaleidoSetup_Update(PlayState* play); -void KaleidoSetup_Init(PlayState* play); -void KaleidoSetup_Destroy(PlayState* play); - void Font_LoadChar(PlayState* play, u16 codePointIndex, s32 offset); void Font_LoadCharNES(PlayState* play, u8 codePointIndex, s32 offset); void Font_LoadMessageBoxEndIcon(Font* font, u16 icon); @@ -518,18 +513,6 @@ void Inventory_IncrementSkullTokenCount(s16 sceneIndex); s16 Inventory_GetSkullTokenCount(s16 sceneIndex); void Inventory_SaveLotteryCodeGuess(PlayState* play); -uintptr_t KaleidoManager_FaultAddrConv(uintptr_t address, void* param); -void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl); -void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl); -void KaleidoManager_Init(PlayState* play); -void KaleidoManager_Destroy(void); -void* KaleidoManager_GetRamAddr(void* vram); -void KaleidoScopeCall_LoadPlayer(void); -void KaleidoScopeCall_Init(PlayState* play); -void KaleidoScopeCall_Destroy(PlayState* play); -void KaleidoScopeCall_Update(PlayState* play); -void KaleidoScopeCall_Draw(PlayState* play); - void Play_SetMotionBlurAlpha(u32 alpha); void Play_EnableMotionBlur(u32 alpha); void Play_DisableMotionBlur(void); diff --git a/include/regs.h b/include/regs.h index bc518e6ba8..ea0a853874 100644 --- a/include/regs.h +++ b/include/regs.h @@ -84,7 +84,7 @@ extern RegEditor* gRegEditor; #define R_MOTION_BLUR_ENABLED SREG(91) #define R_MOTION_BLUR_PRIORITY_ALPHA SREG(92) #define R_MOTION_BLUR_PRIORITY_ENABLED SREG(93) -#define R_PAUSE_BG_PRERENDER_STATE SREG(94) +#define R_PAUSE_BG_PRERENDER_STATE SREG(94) // PauseBgPreRenderState enum #define R_PLAY_FILL_SCREEN_ON MREG(64) #define R_PLAY_FILL_SCREEN_R MREG(65) diff --git a/include/variables.h b/include/variables.h index deab22f859..6b2d2eb662 100644 --- a/include/variables.h +++ b/include/variables.h @@ -38,9 +38,6 @@ extern RomFile gObjectTable[OBJECT_ID_MAX]; extern SceneTableEntry gSceneTable[SCENE_MAX]; -extern KaleidoMgrOverlay gKaleidoMgrOverlayTable[2]; -extern KaleidoMgrOverlay* gKaleidoMgrCurOvl; - extern s32 gDbgCamEnabled; extern Vec3f gZeroVec3f; @@ -82,6 +79,7 @@ extern u8 gSequenceTable[]; extern u8 gSampleBankTable[]; // bss + extern s32 gTransitionTileState; extern Color_RGBA8_u32 gPlayVisMonoColor; diff --git a/include/z64.h b/include/z64.h index 8eb6e9beb0..b4d805ea68 100644 --- a/include/z64.h +++ b/include/z64.h @@ -56,6 +56,7 @@ #include "z64message.h" #include "z64object.h" #include "z64ocarina.h" +#include "z64pause_menu.h" #include "z64player.h" #include "z64prerender.h" #include "z64save.h" @@ -72,105 +73,6 @@ #include "regs.h" -typedef struct PauseContext { - /* 0x000 */ View view; - /* 0x168 */ u8* iconItemSegment; - /* 0x16C */ u8* iconItem24Segment; - /* 0x170 */ u8* iconItemAltSegment; - /* 0x174 */ u8* iconItemLangSegment; - /* 0x178 */ u8* nameSegment; - /* 0x17C */ u8* iconItemVtxSegment; - /* 0x180 */ Vtx* itemPageVtx; - /* 0x184 */ Vtx* mapPageVtx; - /* 0x188 */ Vtx* questPageVtx; - /* 0x18C */ Vtx* maskPageVtx; - /* 0x190 */ Vtx* itemVtx; - /* 0x194 */ Vtx* mapVtx; // inferred - /* 0x198 */ Vtx* questVtx; - /* 0x19C */ Vtx* maskVtx; - /* 0x1A0 */ Vtx* promptPageVtx; - /* 0x1A4 */ Vtx* infoPanelVtx; - /* 0x1A8 */ Vtx* cursorVtx; - /* 0x1AC */ OcarinaStaff* ocarinaStaff; - /* 0x1B0 */ UNK_TYPE1 unk_1B0[0x20]; - /* 0x1D0 */ OSMesgQueue loadQueue; - /* 0x1E8 */ OSMesg loadMsg; - /* 0x1EC */ u16 state; - /* 0x1EE */ u16 debugEditor; - /* 0x1F0 */ u8 bombersNotebookOpen; - /* 0x1F4 */ Vec3f eye; - /* 0x200 */ u16 mainState; - /* 0x202 */ u16 nextPageMode; // (2 * prev pageIndex) + (scroll left ? 1 : 0) - /* 0x204 */ u16 pageIndex; - /* 0x206 */ u16 switchPageTimer; - /* 0x208 */ u16 savePromptState; - /* 0x20C */ f32 unk_20C; // set to 936.0f, unused remnant from OoT - /* 0x210 */ f32 itemPageRoll; // rotation (-z) of the item page into the screen - /* 0x214 */ f32 mapPageRoll; // rotation (+x) of the map page into the screen - /* 0x218 */ f32 questPageRoll; // rotation (+z) of the quest page into the screen - /* 0x21C */ f32 maskPageRoll; // rotation (-z) of the mask page into the screen - /* 0x220 */ f32 roll; - /* 0x224 */ u16 alpha; - /* 0x226 */ s16 offsetY; - /* 0x228 */ UNK_TYPE1 unk_228[0x8]; - /* 0x230 */ s32 stickAdjX; - /* 0x234 */ s32 stickAdjY; - /* 0x238 */ s16 cursorPoint[5]; - /* 0x242 */ s16 cursorXIndex[5]; - /* 0x24C */ s16 cursorYIndex[5]; - /* 0x256 */ s16 unk_256; // Uses DungeonItem enum - /* 0x258 */ s16 cursorSpecialPos; - /* 0x25A */ s16 pageSwitchInputTimer; // Used to introduce a delay before switching page when arriving on the "scroll left/right" positions while holding stick left/right. - /* 0x25C */ u16 namedItem; - /* 0x25E */ u16 cursorItem[5]; - /* 0x268 */ u16 cursorSlot[5]; - /* 0x272 */ u16 equipTargetItem; - /* 0x274 */ u16 equipTargetSlot; - /* 0x276 */ u16 equipTargetCBtn; - /* 0x278 */ s16 equipAnimX; - /* 0x27A */ s16 equipAnimY; - /* 0x27C */ s16 equipAnimAlpha; - /* 0x27E */ s16 infoPanelOffsetY; - /* 0x280 */ u16 nameDisplayTimer; - /* 0x282 */ u16 nameColorSet; - /* 0x284 */ s16 cursorColorSet; - /* 0x286 */ s16 cursorSpinPhase; - /* 0x288 */ f32 cursorX; - /* 0x28C */ f32 cursorY; - /* 0x290 */ f32 cursorWidth; - /* 0x294 */ f32 cursorHeight; - /* 0x298 */ f32 cursorShrinkRate; - /* 0x29C */ s16 promptChoice; // save/continue choice: 0 = yes; 4 = no - /* 0x29E */ s16 promptAlpha; - /* 0x2A0 */ s16 ocarinaSongIndex; - /* 0x2A2 */ u8 worldMapPoints[20]; - /* 0x2B6 */ u8 unk_2B6; // unused red? - /* 0x2B7 */ u8 unk_2B7; // unused green? - /* 0x2B8 */ u8 unk_2B8; // unused blue? - /* 0x2B9 */ u8 itemDescriptionOn; // helpful description of item given through a message box - /* 0x2BA */ s16 equipAnimScale; // scale of item icon while moving being equipped to c-button - /* 0x2BC */ s16 equipAnimShrinkRate; // rate the scale is shrinking for the item icon while moving being equipped to c-button - /* 0x2BE */ s16 ocarinaButtonsY[5]; - /* 0x2C8 */ u16 unk_2C8; // Uses PauseMenuPage enum for Owl Warp. Never set. - /* 0x2CA */ s16 unk_2CA; // Uses OwlWarpId enum for Owl Warp. Never set. -} PauseContext; // size = 0x2D0 - -typedef struct { - /* 0x00 */ void* loadedRamAddr; - /* 0x04 */ uintptr_t vromStart; - /* 0x08 */ uintptr_t vromEnd; - /* 0x0C */ void* vramStart; - /* 0x10 */ void* vramEnd; - /* 0x14 */ uintptr_t offset; // loadedRamAddr - vramStart - /* 0x18 */ const char* name; -} KaleidoMgrOverlay; // size = 0x1C - -typedef enum { - /* 0x00 */ KALEIDO_OVL_KALEIDO_SCOPE, - /* 0x01 */ KALEIDO_OVL_PLAYER_ACTOR, - /* 0x02 */ KALEID_OVL_MAX -} KaleidoMgrOverlayType; - typedef struct { /* 0x0 */ u8 seqId; /* 0x1 */ u8 ambienceId; diff --git a/include/z64pause_menu.h b/include/z64pause_menu.h new file mode 100644 index 0000000000..ec69f17344 --- /dev/null +++ b/include/z64pause_menu.h @@ -0,0 +1,248 @@ +#ifndef Z64PAUSE_MENU_H +#define Z64PAUSE_MENU_H + +#include "ultra64.h" +#include "z64math.h" +#include "z64view.h" +#include "unk.h" + +struct OcarinaStaff; +struct PlayState; + +typedef enum PauseMenuPage { + /* 0 */ PAUSE_ITEM, + /* 1 */ PAUSE_MAP, + /* 2 */ PAUSE_QUEST, + /* 3 */ PAUSE_MASK, + /* 4 */ PAUSE_WORLD_MAP, + /* 5 */ PAUSE_PAGE_MAX +} PauseMenuPage; + +typedef enum PauseState { + /* 0x00 */ PAUSE_STATE_OFF, + /* 0x01 */ PAUSE_STATE_OPENING_0, + /* 0x02 */ PAUSE_STATE_OPENING_1, + /* 0x03 */ PAUSE_STATE_OPENING_2, + /* 0x04 */ PAUSE_STATE_OPENING_3, + /* 0x05 */ PAUSE_STATE_OPENING_4, + /* 0x06 */ PAUSE_STATE_MAIN, // Pause menu ready for player inputs. + /* 0x07 */ PAUSE_STATE_SAVEPROMPT, + /* 0x08 */ PAUSE_STATE_GAMEOVER_0, + /* 0x09 */ PAUSE_STATE_GAMEOVER_1, + /* 0x0A */ PAUSE_STATE_GAMEOVER_2, + /* 0x0B */ PAUSE_STATE_GAMEOVER_3, + /* 0x0C */ PAUSE_STATE_GAMEOVER_4, + /* 0x0D */ PAUSE_STATE_GAMEOVER_5, + /* 0x0E */ PAUSE_STATE_GAMEOVER_SAVE_PROMPT, + /* 0x0F */ PAUSE_STATE_GAMEOVER_7, + /* 0x10 */ PAUSE_STATE_GAMEOVER_8, + /* 0x11 */ PAUSE_STATE_GAMEOVER_CONTINUE_PROMPT, + /* 0x12 */ PAUSE_STATE_GAMEOVER_10, + /* 0x13 */ PAUSE_STATE_OWL_WARP_0, + /* 0x14 */ PAUSE_STATE_OWL_WARP_1, + /* 0x15 */ PAUSE_STATE_OWL_WARP_2, + /* 0x16 */ PAUSE_STATE_OWL_WARP_3, + /* 0x17 */ PAUSE_STATE_OWL_WARP_SELECT, // Selecting the destination + /* 0x18 */ PAUSE_STATE_OWL_WARP_CONFIRM, // Confirming the choice given + /* 0x19 */ PAUSE_STATE_OWL_WARP_6, + /* 0x1A */ PAUSE_STATE_UNPAUSE_SETUP, // Unpause + /* 0x1B */ PAUSE_STATE_UNPAUSE_CLOSE +} PauseState; + +typedef enum PauseMainState { + /* 0x00 */ PAUSE_MAIN_STATE_IDLE, // Await input for the next action + /* 0x01 */ PAUSE_MAIN_STATE_SWITCHING_PAGE, + /* 0x02 */ PAUSE_MAIN_STATE_SONG_PLAYBACK, + /* 0x03 */ PAUSE_MAIN_STATE_EQUIP_ITEM, + /* 0x04 */ PAUSE_MAIN_STATE_SONG_PROMPT_INIT, + /* 0x05 */ PAUSE_MAIN_STATE_SONG_PROMPT, + /* 0x06 */ PAUSE_MAIN_STATE_SONG_PROMPT_DONE, + /* 0x07 */ PAUSE_MAIN_STATE_SONG_PROMPT_UNUSED, + /* 0x08 */ PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG, // Await input but the cursor is on a song + /* 0x09 */ PAUSE_MAIN_STATE_SONG_PLAYBACK_INIT, + /* 0x0F */ PAUSE_MAIN_STATE_EQUIP_MASK = 0xF, + /* 0x10 */ PAUSE_MAIN_STATE_BOMBERS_NOTEBOOK_OPEN, + /* 0x11 */ PAUSE_MAIN_STATE_UNK +} PauseMainState; + +typedef enum PauseSavePromptState { + /* 0x00 */ PAUSE_SAVEPROMPT_STATE_APPEARING, + /* 0x01 */ PAUSE_SAVEPROMPT_STATE_1, + /* 0x02 */ PAUSE_SAVEPROMPT_STATE_RETURN_TO_MENU, + /* 0x03 */ PAUSE_SAVEPROMPT_STATE_3, + /* 0x04 */ PAUSE_SAVEPROMPT_STATE_4, + /* 0x05 */ PAUSE_SAVEPROMPT_STATE_5, + /* 0x06 */ PAUSE_SAVEPROMPT_STATE_6, + /* 0x07 */ PAUSE_SAVEPROMPT_STATE_7 +} PauseSavePromptState; + +typedef enum DebugEditor { + /* 0 */ DEBUG_EDITOR_NONE, + /* 1 */ DEBUG_EDITOR_INVENTORY_INIT, + /* 2 */ DEBUG_EDITOR_INVENTORY, + /* 3 */ DEBUG_EDITOR_EVENTS +} DebugEditor; + +typedef enum PauseBgPreRenderState { + /* 0 */ PAUSE_BG_PRERENDER_OFF, + /* 1 */ PAUSE_BG_PRERENDER_SETUP, // The current frame is only drawn for the purpose of serving as the pause background. + /* 2 */ PAUSE_BG_PRERENDER_PROCESS, // The previous frame was PAUSE_BG_PRERENDER_DRAW, now apply prerender filters. + /* 3 */ PAUSE_BG_PRERENDER_READY, // The pause background is ready to be used. + /* 4 */ PAUSE_BG_PRERENDER_UNK4, + /* 5 */ PAUSE_BG_PRERENDER_MAX +} PauseBgPreRenderState; + +typedef struct PauseContext { + /* 0x000 */ View view; + /* 0x168 */ u8* iconItemSegment; + /* 0x16C */ u8* iconItem24Segment; + /* 0x170 */ u8* iconItemAltSegment; + /* 0x174 */ u8* iconItemLangSegment; + /* 0x178 */ u8* nameSegment; + /* 0x17C */ u8* iconItemVtxSegment; + /* 0x180 */ Vtx* itemPageVtx; + /* 0x184 */ Vtx* mapPageVtx; + /* 0x188 */ Vtx* questPageVtx; + /* 0x18C */ Vtx* maskPageVtx; + /* 0x190 */ Vtx* itemVtx; + /* 0x194 */ Vtx* mapVtx; // inferred + /* 0x198 */ Vtx* questVtx; + /* 0x19C */ Vtx* maskVtx; + /* 0x1A0 */ Vtx* promptPageVtx; + /* 0x1A4 */ Vtx* infoPanelVtx; + /* 0x1A8 */ Vtx* cursorVtx; + /* 0x1AC */ struct OcarinaStaff* ocarinaStaff; + /* 0x1B0 */ UNK_TYPE1 unk_1B0[0x20]; + /* 0x1D0 */ OSMesgQueue loadQueue; + /* 0x1E8 */ OSMesg loadMsg; + /* 0x1EC */ u16 state; // PauseState enum + /* 0x1EE */ u16 debugEditor; // DebugEditor enum + /* 0x1F0 */ u8 bombersNotebookOpen; + /* 0x1F4 */ Vec3f eye; + /* 0x200 */ u16 mainState; // PauseMainState enum + /* 0x202 */ u16 nextPageMode; // (2 * prev pageIndex) + (scroll left ? 1 : 0) + /* 0x204 */ u16 pageIndex; // PauseMenuPage enum + /* 0x206 */ u16 switchPageTimer; + /* 0x208 */ u16 savePromptState; // PauseSavePromptState enum + /* 0x20C */ f32 unk_20C; // set to 936.0f, unused remnant from OoT + /* 0x210 */ f32 itemPageRoll; // rotation (-z) of the item page into the screen + /* 0x214 */ f32 mapPageRoll; // rotation (+x) of the map page into the screen + /* 0x218 */ f32 questPageRoll; // rotation (+z) of the quest page into the screen + /* 0x21C */ f32 maskPageRoll; // rotation (-z) of the mask page into the screen + /* 0x220 */ f32 roll; + /* 0x224 */ u16 alpha; + /* 0x226 */ s16 offsetY; + /* 0x228 */ UNK_TYPE1 unk_228[0x8]; + /* 0x230 */ s32 stickAdjX; + /* 0x234 */ s32 stickAdjY; + /* 0x238 */ s16 cursorPoint[PAUSE_PAGE_MAX]; // indexed by PauseMenuPage enum + /* 0x242 */ s16 cursorXIndex[PAUSE_PAGE_MAX]; // indexed by PauseMenuPage enum + /* 0x24C */ s16 cursorYIndex[PAUSE_PAGE_MAX]; // indexed by PauseMenuPage enum + /* 0x256 */ s16 unk_256; // Uses DungeonItem enum + /* 0x258 */ s16 cursorSpecialPos; + /* 0x25A */ s16 pageSwitchInputTimer; // Used to introduce a delay before switching page when arriving on the "scroll left/right" positions while holding stick left/right. + /* 0x25C */ u16 namedItem; + /* 0x25E */ u16 cursorItem[PAUSE_PAGE_MAX]; // indexed by PauseMenuPage enum + /* 0x268 */ u16 cursorSlot[PAUSE_PAGE_MAX]; // indexed by PauseMenuPage enum + /* 0x272 */ u16 equipTargetItem; + /* 0x274 */ u16 equipTargetSlot; + /* 0x276 */ u16 equipTargetCBtn; // PauseEquipCButton enum + /* 0x278 */ s16 equipAnimX; + /* 0x27A */ s16 equipAnimY; + /* 0x27C */ s16 equipAnimAlpha; + /* 0x27E */ s16 infoPanelOffsetY; + /* 0x280 */ u16 nameDisplayTimer; + /* 0x282 */ u16 nameColorSet; + /* 0x284 */ s16 cursorColorSet; + /* 0x286 */ s16 cursorSpinPhase; + /* 0x288 */ f32 cursorX; + /* 0x28C */ f32 cursorY; + /* 0x290 */ f32 cursorWidth; + /* 0x294 */ f32 cursorHeight; + /* 0x298 */ f32 cursorShrinkRate; + /* 0x29C */ s16 promptChoice; // save/continue choice: 0 = yes; 4 = no + /* 0x29E */ s16 promptAlpha; + /* 0x2A0 */ s16 ocarinaSongIndex; + /* 0x2A2 */ u8 worldMapPoints[20]; + /* 0x2B6 */ u8 unk_2B6; // unused red? + /* 0x2B7 */ u8 unk_2B7; // unused green? + /* 0x2B8 */ u8 unk_2B8; // unused blue? + /* 0x2B9 */ u8 itemDescriptionOn; // helpful description of item given through a message box + /* 0x2BA */ s16 equipAnimScale; // scale of item icon while moving being equipped to c-button + /* 0x2BC */ s16 equipAnimShrinkRate; // rate the scale is shrinking for the item icon while moving being equipped to c-button + /* 0x2BE */ s16 ocarinaButtonsY[5]; + /* 0x2C8 */ u16 unk_2C8; // Uses PauseMenuPage enum for Owl Warp. Never set. + /* 0x2CA */ s16 unk_2CA; // Uses OwlWarpId enum for Owl Warp. Never set. +} PauseContext; // size = 0x2D0 + +#define IS_PAUSE_STATE_GAMEOVER(pauseCtx) \ + (((pauseCtx)->state >= PAUSE_STATE_GAMEOVER_0) && ((pauseCtx)->state <= PAUSE_STATE_GAMEOVER_10)) + +#define IS_PAUSE_STATE_OWL_WARP(pauseCtx) \ + (((pauseCtx)->state >= PAUSE_STATE_OWL_WARP_2) && ((pauseCtx)->state <= PAUSE_STATE_OWL_WARP_6)) + +#define IS_PAUSE_MAIN_STATE_SONG_PROMPT(pauseCtx) \ + (((pauseCtx)->mainState >= PAUSE_MAIN_STATE_SONG_PROMPT_INIT) && \ + ((pauseCtx)->mainState <= PAUSE_MAIN_STATE_SONG_PROMPT_DONE)) + +#define IS_PAUSED(pauseCtx) \ + (((pauseCtx)->state != PAUSE_STATE_OFF) || ((pauseCtx)->debugEditor != DEBUG_EDITOR_NONE)) + + +typedef enum KaleidoMgrOverlayType { + /* 0 */ KALEIDO_OVL_KALEIDO_SCOPE, + /* 1 */ KALEIDO_OVL_PLAYER_ACTOR, + /* 2 */ KALEIDO_OVL_MAX +} KaleidoMgrOverlayType; + +typedef struct KaleidoMgrOverlay { + /* 0x00 */ void* loadedRamAddr; + /* 0x04 */ uintptr_t vromStart; + /* 0x08 */ uintptr_t vromEnd; + /* 0x0C */ void* vramStart; + /* 0x10 */ void* vramEnd; + /* 0x14 */ uintptr_t offset; // loadedRamAddr - vramStart + /* 0x18 */ const char* name; +} KaleidoMgrOverlay; // size = 0x1C + + +// z_kaleido_setup.c + +void func_800F4A10(struct PlayState* play); +void KaleidoSetup_Update(struct PlayState* play); +void KaleidoSetup_Init(struct PlayState* play); +void KaleidoSetup_Destroy(struct PlayState* play); + + +// z_kaleido_manager.c + +void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl); +void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl); +void KaleidoManager_Init(struct PlayState* play); +void KaleidoManager_Destroy(void); +void* KaleidoManager_GetRamAddr(void* vram); + +extern KaleidoMgrOverlay gKaleidoMgrOverlayTable[KALEIDO_OVL_MAX]; +extern KaleidoMgrOverlay* gKaleidoMgrCurOvl; + + +// z_kaleido_scope_call.c + +void KaleidoScopeCall_LoadPlayer(void); +void KaleidoScopeCall_Init(struct PlayState* play); +void KaleidoScopeCall_Destroy(struct PlayState* play); +void KaleidoScopeCall_Update(struct PlayState* play); +void KaleidoScopeCall_Draw(struct PlayState* play); + + +// Item macros + +#define ITEM_GRID_ROWS 4 +#define ITEM_GRID_COLS 6 +#define MASK_GRID_ROWS 4 +#define MASK_GRID_COLS 6 + +#define ITEM_NUM_SLOTS (ITEM_GRID_ROWS * ITEM_GRID_COLS) +#define MASK_NUM_SLOTS (MASK_GRID_ROWS * MASK_GRID_COLS) + +#endif diff --git a/include/z64view.h b/include/z64view.h index 19bb4492ca..92375e1589 100644 --- a/include/z64view.h +++ b/include/z64view.h @@ -3,6 +3,7 @@ #include "PR/ultratypes.h" #include "PR/gbi.h" +#include "main.h" #include "z64math.h" #include "unk.h" diff --git a/src/code/flg_set.c b/src/code/flg_set.c index d437fd8b67..9929cbb476 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -9,8 +9,8 @@ * B: exit * Hold Start and press B: clear all weekEventReg and eventInf flags */ + #include "global.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" typedef struct FlagSetEntry { /* 0x0 */ u8* value; diff --git a/src/code/game.c b/src/code/game.c index 908a0c315a..434337615b 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -8,7 +8,6 @@ #include "z64speed_meter.h" #include "z64vimode.h" #include "z64vis.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #include "debug.h" s32 gFramerateDivisor = 1; diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 7a1cf4c746..b27310b3f0 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,5 +1,5 @@ -#include "prevent_bss_reordering.h" #include "z64bgcheck.h" +#include "global.h" #include "libc64/fixed_point.h" #include "libc64/sprintf.h" @@ -8,8 +8,6 @@ #include "vt.h" #include "z64actor.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" - #define DYNA_RAYCAST_FLOORS 1 #define DYNA_RAYCAST_WALLS 2 #define DYNA_RAYCAST_CEILINGS 4 diff --git a/src/code/z_demo.c b/src/code/z_demo.c index e9264ec847..7527cc3a10 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -17,6 +17,7 @@ s16 gDungeonBossWarpSceneId; #include "z64quake.h" #include "z64rumble.h" #include "z64shrink_window.h" + #include "overlays/gamestates/ovl_daytelop/z_daytelop.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c index 6598eb19fa..83256b8163 100644 --- a/src/code/z_kaleido_manager.c +++ b/src/code/z_kaleido_manager.c @@ -1,3 +1,5 @@ +#include "z64pause_menu.h" + #include "global.h" #include "fault.h" #include "loadfragment.h" @@ -8,13 +10,14 @@ SEGMENT_END(ovl_##name), 0, #name, \ } -KaleidoMgrOverlay gKaleidoMgrOverlayTable[] = { +KaleidoMgrOverlay gKaleidoMgrOverlayTable[KALEIDO_OVL_MAX] = { KALEIDO_OVERLAY(kaleido_scope), KALEIDO_OVERLAY(player_actor), }; void* sKaleidoAreaPtr = NULL; KaleidoMgrOverlay* gKaleidoMgrCurOvl = NULL; + FaultAddrConvClient sKaleidoMgrFaultAddrConvClient; uintptr_t KaleidoManager_FaultAddrConv(uintptr_t address, void* param) { @@ -71,7 +74,7 @@ void KaleidoManager_Init(PlayState* play) { Fault_AddAddrConvClient(&sKaleidoMgrFaultAddrConvClient, KaleidoManager_FaultAddrConv, NULL); } -void KaleidoManager_Destroy() { +void KaleidoManager_Destroy(void) { Fault_RemoveAddrConvClient(&sKaleidoMgrFaultAddrConvClient); if (gKaleidoMgrCurOvl != NULL) { diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 36d45c02b0..34e55f2446 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,6 +1,7 @@ -#include "global.h" +#include "z64pause_menu.h" + +#include "z64.h" #include "z64shrink_window.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" void (*sKaleidoScopeUpdateFunc)(PlayState* play); void (*sKaleidoScopeDrawFunc)(PlayState* play); @@ -8,7 +9,7 @@ void (*sKaleidoScopeDrawFunc)(PlayState* play); extern void KaleidoScope_Update(PlayState* play); extern void KaleidoScope_Draw(PlayState* play); -void KaleidoScopeCall_LoadPlayer() { +void KaleidoScopeCall_LoadPlayer(void) { KaleidoMgrOverlay* playerActorOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR]; if (gKaleidoMgrCurOvl != playerActorOvl) { @@ -34,40 +35,42 @@ void KaleidoScopeCall_Update(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; - if ((play->pauseCtx.state != PAUSE_STATE_OFF) || (play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { - if ((pauseCtx->state == PAUSE_STATE_OPENING_0) || (pauseCtx->state == PAUSE_STATE_OWL_WARP_0)) { - if (ShrinkWindow_Letterbox_GetSize() == 0) { - R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; - pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; - pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_APPEARING; - pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; - } - } else if (pauseCtx->state == PAUSE_STATE_GAMEOVER_0) { + if (!IS_PAUSED(&play->pauseCtx)) { + return; + } + + if ((pauseCtx->state == PAUSE_STATE_OPENING_0) || (pauseCtx->state == PAUSE_STATE_OWL_WARP_0)) { + if (ShrinkWindow_Letterbox_GetSize() == 0) { R_PAUSE_BG_PRERENDER_STATE = PAUSE_BG_PRERENDER_SETUP; pauseCtx->mainState = PAUSE_MAIN_STATE_IDLE; pauseCtx->savePromptState = PAUSE_SAVEPROMPT_STATE_APPEARING; pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; - } else if ((pauseCtx->state == PAUSE_STATE_OPENING_1) || (pauseCtx->state == PAUSE_STATE_GAMEOVER_1) || - (pauseCtx->state == PAUSE_STATE_OWL_WARP_1)) { - if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_READY) { - pauseCtx->state++; - } - } else if (pauseCtx->state != PAUSE_STATE_OFF) { - if (gKaleidoMgrCurOvl != kaleidoScopeOvl) { - if (gKaleidoMgrCurOvl != NULL) { - KaleidoManager_ClearOvl(gKaleidoMgrCurOvl); - } - - KaleidoManager_LoadOvl(kaleidoScopeOvl); + } + } 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_APPEARING; + pauseCtx->state = (pauseCtx->state & 0xFFFF) + 1; + } else if ((pauseCtx->state == PAUSE_STATE_OPENING_1) || (pauseCtx->state == PAUSE_STATE_GAMEOVER_1) || + (pauseCtx->state == PAUSE_STATE_OWL_WARP_1)) { + if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_READY) { + pauseCtx->state++; + } + } else if (pauseCtx->state != PAUSE_STATE_OFF) { + if (gKaleidoMgrCurOvl != kaleidoScopeOvl) { + if (gKaleidoMgrCurOvl != NULL) { + KaleidoManager_ClearOvl(gKaleidoMgrCurOvl); } - if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { - sKaleidoScopeUpdateFunc(play); + KaleidoManager_LoadOvl(kaleidoScopeOvl); + } - if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { - KaleidoManager_ClearOvl(kaleidoScopeOvl); - KaleidoScopeCall_LoadPlayer(); - } + if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { + sKaleidoScopeUpdateFunc(play); + + if (!IS_PAUSED(&play->pauseCtx)) { + KaleidoManager_ClearOvl(kaleidoScopeOvl); + KaleidoScopeCall_LoadPlayer(); } } } diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 3b1ff5cfca..d19f960598 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -1,7 +1,9 @@ -#include "global.h" +#include "z64pause_menu.h" + +#include "z64.h" #include "z64rumble.h" #include "z64shrink_window.h" -#include "z64view.h" + #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" s16 sKaleidoSetupRightPageIndex[] = { @@ -10,12 +12,14 @@ s16 sKaleidoSetupRightPageIndex[] = { 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 @@ -89,39 +93,52 @@ void KaleidoSetup_Update(PlayState* play) { if (msgCtx && msgCtx) {} } - 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.cutsceneIndex < 0xFFF0) && (gSaveContext.nextCutsceneIndex < 0xFFF0)) { - if (!Play_InCsMode(play) || ((msgCtx->msgMode != MSGMODE_NONE) && (msgCtx->currentTextId == 0xFF))) { - if ((play->unk_1887C < 2) && (gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY) && - (gSaveContext.magicState != MAGIC_STATE_FILL)) { - if (!CHECK_EVENTINF(EVENTINF_17) && !(player->stateFlags1 & PLAYER_STATE1_20)) { - if (!(play->actorCtx.flags & ACTORCTX_FLAG_TELESCOPE_ON) && - !(play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON)) { - if (!play->actorCtx.isOverrideInputOn && - CHECK_BTN_ALL(input->press.button, BTN_START)) { - gSaveContext.prevHudVisibility = gSaveContext.hudVisibility; - pauseCtx->itemDescriptionOn = false; - pauseCtx->state = PAUSE_STATE_OPENING_0; - func_800F4A10(play); - // Set next page mode to scroll left - pauseCtx->nextPageMode = pauseCtx->pageIndex * 2 + 1; - Audio_SetPauseState(true); - } + if (IS_PAUSED(pauseCtx) || (play->gameOverCtx.state != GAMEOVER_INACTIVE)) { + return; + } - if (pauseCtx->state == PAUSE_STATE_OPENING_0) { - GameState_SetFramerateDivisor(&play->state, 2); - if (ShrinkWindow_Letterbox_GetSizeTarget() != 0) { - ShrinkWindow_Letterbox_SetSizeTarget(0); - } - Audio_PlaySfx_PauseMenuOpenOrClose(SFX_PAUSE_MENU_OPEN); - } - } - } - } - } + if ((play->transitionTrigger != TRANS_TRIGGER_OFF) || (play->transitionMode != TRANS_MODE_OFF)) { + return; + } + + if ((gSaveContext.save.cutsceneIndex >= 0xFFF0) || (gSaveContext.nextCutsceneIndex >= 0xFFF0)) { + return; + } + + if (!Play_InCsMode(play) || ((msgCtx->msgMode != MSGMODE_NONE) && (msgCtx->currentTextId == 0xFF))) { + if (play->unk_1887C >= 2) { + return; + } + + if ((gSaveContext.magicState == MAGIC_STATE_STEP_CAPACITY) || (gSaveContext.magicState == MAGIC_STATE_FILL)) { + return; + } + + if (CHECK_EVENTINF(EVENTINF_17) || (player->stateFlags1 & PLAYER_STATE1_20)) { + return; + } + + if ((play->actorCtx.flags & ACTORCTX_FLAG_TELESCOPE_ON) || + (play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON)) { + return; + } + + if (!play->actorCtx.isOverrideInputOn && CHECK_BTN_ALL(input->press.button, BTN_START)) { + gSaveContext.prevHudVisibility = gSaveContext.hudVisibility; + pauseCtx->itemDescriptionOn = false; + pauseCtx->state = PAUSE_STATE_OPENING_0; + func_800F4A10(play); + // Set next page mode to scroll left + pauseCtx->nextPageMode = pauseCtx->pageIndex * 2 + 1; + Audio_SetPauseState(true); + } + + if (pauseCtx->state == PAUSE_STATE_OPENING_0) { + GameState_SetFramerateDivisor(&play->state, 2); + if (ShrinkWindow_Letterbox_GetSizeTarget() != 0) { + ShrinkWindow_Letterbox_SetSizeTarget(0); } + Audio_PlaySfx_PauseMenuOpenOrClose(SFX_PAUSE_MENU_OPEN); } } } diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 94d7b5563d..4bb5afa5e0 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -60,12 +60,13 @@ u8 sGameOverLightsIntensity; Gfx* sSkyboxStarsDList; #include "z64environment.h" + #include "global.h" +#include "libc/string.h" #include "sys_cfb.h" + #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_field_keep/gameplay_field_keep.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" -#include "libc/string.h" // Data f32 sSandstormLerpScale = 0.0f; @@ -1168,8 +1169,7 @@ void Environment_WipeRumbleRequests(void) { } void Environment_UpdateSkyboxRotY(PlayState* play) { - if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && - ((play->skyboxId == SKYBOX_NORMAL_SKY) || (play->skyboxId == SKYBOX_3))) { + if (!IS_PAUSED(&play->pauseCtx) && ((play->skyboxId == SKYBOX_NORMAL_SKY) || (play->skyboxId == SKYBOX_3))) { play->skyboxCtx.rot.y -= R_TIME_SPEED * 1.0e-4f; } } diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index d9abe151d6..9f4f6c47ee 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -1,6 +1,5 @@ #include "prevent_bss_reordering.h" #include "global.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #include "interface/parameter_static/parameter_static.h" s16 sHeartsPrimColors[3][3] = { { 255, 70, 50 }, { 255, 190, 0 }, { 100, 100, 255 } }; @@ -406,8 +405,8 @@ void LifeMeter_UpdateSizeAndBeep(PlayState* play) { if (interfaceCtx->lifeSizeChange <= 0) { interfaceCtx->lifeSizeChange = 0; interfaceCtx->lifeSizeChangeDirection = 0; - if (!Player_InCsMode(play) && (play->pauseCtx.state == PAUSE_STATE_OFF) && - (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && LifeMeter_IsCritical() && !Play_InCsMode(play)) { + if (!Player_InCsMode(play) && !IS_PAUSED(&play->pauseCtx) && LifeMeter_IsCritical() && + !Play_InCsMode(play)) { Audio_PlaySfx(NA_SE_SY_HITPOINT_ALARM); } } diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index f04562e036..49e525b9dd 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -1,5 +1,4 @@ #include "global.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" s16 sMinimapInitPosX = 0; s16 sMinimapInitPosZ = 0; @@ -240,7 +239,7 @@ void Map_Update(PlayState* play) { func_80105B34(play); - if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { + if (!IS_PAUSED(&play->pauseCtx)) { if (Map_IsInDungeonArea(play)) { floor = func_80109124(player->actor.world.pos.y); if (floor != -1) { diff --git a/src/code/z_message.c b/src/code/z_message.c index 21205ddabd..92059146ff 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -1,12 +1,13 @@ #include "z64message.h" -#include "message_data_static.h" +#include "global.h" +#include "message_data_static.h" #include "padmgr.h" +#include "segment_symbols.h" #include "z64actor.h" #include "z64horse.h" #include "z64shrink_window.h" - -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" +#include "z64save.h" #include "interface/parameter_static/parameter_static.h" diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c index d33de3ced6..de3213fd12 100644 --- a/src/code/z_message_nes.c +++ b/src/code/z_message_nes.c @@ -1,7 +1,6 @@ #include "global.h" #include "message_data_fmt_nes.h" #include "message_data_static.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" f32 sNESFontWidths[160] = { 8.0f, 8.0f, 6.0f, 9.0f, 9.0f, 14.0f, 12.0f, 3.0f, 7.0f, 7.0f, 7.0f, 9.0f, 4.0f, 6.0f, 4.0f, 9.0f, diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index f292f6d903..8b2284fdee 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -11,7 +11,6 @@ #include "interface/do_action_static/do_action_static.h" #include "misc/story_static/story_static.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #include "overlays/actors/ovl_En_Mm3/z_en_mm3.h" typedef enum { @@ -3676,10 +3675,9 @@ void Magic_Update(PlayState* play) { case MAGIC_STATE_CONSUME_LENS: // Slowly consume magic while Lens of Truth is active - if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && - (msgCtx->msgMode == MSGMODE_NONE) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && - (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && - !Play_InCsMode(play)) { + if (!IS_PAUSED(&play->pauseCtx) && (msgCtx->msgMode == MSGMODE_NONE) && + (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && + (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) { if ((gSaveContext.save.saveInfo.playerData.magic == 0) || ((Player_GetEnvironmentalHazard(play) >= PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) && @@ -3719,9 +3717,9 @@ void Magic_Update(PlayState* play) { gSaveContext.magicState = MAGIC_STATE_CONSUME_GORON_ZORA; // fallthrough case MAGIC_STATE_CONSUME_GORON_ZORA: - if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == 0) && - (msgCtx->msgMode == MSGMODE_NONE) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && - (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { + if (!IS_PAUSED(&play->pauseCtx) && (msgCtx->msgMode == MSGMODE_NONE) && + (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) { @@ -3741,9 +3739,9 @@ void Magic_Update(PlayState* play) { break; case MAGIC_STATE_CONSUME_GIANTS_MASK: - if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && - (msgCtx->msgMode == MSGMODE_NONE) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && - (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF)) { + if (!IS_PAUSED(&play->pauseCtx) && (msgCtx->msgMode == MSGMODE_NONE) && + (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) { @@ -3933,8 +3931,8 @@ void Interface_DrawItemButtons(PlayState* play) { D_801BF9E4[EQUIP_SLOT_C_RIGHT] * 2, D_801BF9E4[EQUIP_SLOT_C_RIGHT] * 2, 255, 240, 0, interfaceCtx->cRightAlpha); - if (!IS_PAUSE_STATE_GAMEOVER) { - if ((play->pauseCtx.state != PAUSE_STATE_OFF) || (play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { + if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { + if (IS_PAUSED(&play->pauseCtx)) { OVERLAY_DISP = Gfx_DrawRect_DropShadow(OVERLAY_DISP, 0x88, 0x11, 0x16, 0x16, 0x5B6, 0x5B6, 0xFF, 0x82, 0x3C, interfaceCtx->startAlpha); // Start Button Texture, Color & Label @@ -3950,8 +3948,7 @@ void Interface_DrawItemButtons(PlayState* play) { } } - if (interfaceCtx->tatlCalling && (play->pauseCtx.state == PAUSE_STATE_OFF) && - (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && (play->csCtx.state == CS_STATE_IDLE) && + if (interfaceCtx->tatlCalling && !IS_PAUSED(&play->pauseCtx) && (play->csCtx.state == CS_STATE_IDLE) && (sPictoState == PICTO_BOX_STATE_OFF)) { if (sCUpInvisible == 0) { // C-Up Button Texture, Color & Label (Tatl Text) @@ -4471,7 +4468,7 @@ void Interface_DrawClock(PlayState* play) { sClockAlphaTimer1 = 0; } - if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { + if (!IS_PAUSED(&play->pauseCtx)) { Gfx_SetupDL39_Overlay(play->state.gfxCtx); /** @@ -5526,8 +5523,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 == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && - (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + if (!IS_PAUSED(&play->pauseCtx) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && ((msgCtx->msgMode == MSGMODE_NONE) || ((msgCtx->msgMode != MSGMODE_NONE) && (msgCtx->currentTextId >= 0x1BB2) && (msgCtx->currentTextId <= 0x1BB6))) && !(player->stateFlags1 & PLAYER_STATE1_200) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && @@ -5976,8 +5972,7 @@ void Interface_UpdateBottleTimers(PlayState* play) { s32 pad[2]; // Not satisfying any of these conditions will pause the bottle timer - if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE) && - (play->gameOverCtx.state == GAMEOVER_INACTIVE) && + if (!IS_PAUSED(&play->pauseCtx) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && ((msgCtx->msgMode == MSGMODE_NONE) || ((msgCtx->currentTextId >= 0x100) && (msgCtx->currentTextId <= 0x200)) || ((msgCtx->currentTextId >= 0x1BB2) && (msgCtx->currentTextId <= 0x1BB6))) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && @@ -6049,7 +6044,7 @@ void Interface_DrawMinigameIcons(PlayState* play) { Gfx_SetupDL39_Overlay(play->state.gfxCtx); - if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { + if (!IS_PAUSED(&play->pauseCtx)) { // Carrots rendering if the action corresponds to riding a horse if (interfaceCtx->unk_212 == DO_ACTION_FASTER) { // Load Carrot Icon @@ -6446,7 +6441,7 @@ void Interface_Draw(PlayState* play) { Interface_DrawPauseMenuEquippingIcons(play); // Draw either the minigame countdown or the three-day clock - if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { + if (!IS_PAUSED(&play->pauseCtx)) { if ((interfaceCtx->minigameState != MINIGAME_STATE_NONE) && (interfaceCtx->minigameState < MINIGAME_STATE_NO_COUNTDOWN_SETUP)) { // Minigame Countdown @@ -6648,7 +6643,7 @@ void Interface_Update(PlayState* play) { u16 aButtonDoAction; // Update buttons - if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { + if (!IS_PAUSED(&play->pauseCtx)) { if (play->gameOverCtx.state == GAMEOVER_INACTIVE) { Interface_UpdateButtonsPart1(play); } @@ -6827,7 +6822,7 @@ void Interface_Update(PlayState* play) { } // Update perfect letters - if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { + if (!IS_PAUSED(&play->pauseCtx)) { if (interfaceCtx->perfectLettersOn) { if (interfaceCtx->perfectLettersType == PERFECT_LETTERS_TYPE_1) { Interface_UpdatePerfectLettersType1(play); @@ -6840,7 +6835,7 @@ void Interface_Update(PlayState* play) { } // Update minigame State - if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) { + if (!IS_PAUSED(&play->pauseCtx)) { if ((u32)interfaceCtx->minigameState != MINIGAME_STATE_NONE) { switch (interfaceCtx->minigameState) { case MINIGAME_STATE_COUNTDOWN_SETUP_3: diff --git a/src/code/z_play.c b/src/code/z_play.c index 56055fafba..70b2417599 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -33,7 +33,6 @@ u8 sMotionBlurStatus; #include "overlays/gamestates/ovl_daytelop/z_daytelop.h" #include "overlays/gamestates/ovl_opening/z_opening.h" #include "overlays/gamestates/ovl_file_choose/z_file_select.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #include "debug.h" s32 gDbgCamEnabled = false; @@ -973,7 +972,7 @@ void Play_UpdateMain(PlayState* this) { KaleidoSetup_Update(this); } - sp5C = (this->pauseCtx.state != 0) || (this->pauseCtx.debugEditor != DEBUG_EDITOR_NONE); + sp5C = IS_PAUSED(&this->pauseCtx); AnimationContext_Reset(&this->animationCtx); Object_UpdateEntries(&this->objectCtx); @@ -1015,7 +1014,7 @@ void Play_UpdateMain(PlayState* this) { Room_Noop(this, &this->roomCtx.prevRoom, &input[1], 1); Skybox_Update(&this->skyboxCtx); - if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { + if (IS_PAUSED(&this->pauseCtx)) { KaleidoScopeCall_Update(this); } else if (this->gameOverCtx.state != GAMEOVER_INACTIVE) { GameOver_Update(this); @@ -1087,7 +1086,7 @@ void Play_Update(PlayState* this) { } void Play_PostWorldDraw(PlayState* this) { - if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { + if (IS_PAUSED(&this->pauseCtx)) { KaleidoScopeCall_Draw(this); } @@ -1095,8 +1094,7 @@ void Play_PostWorldDraw(PlayState* this) { Interface_Draw(this); } - if (((this->pauseCtx.state == 0) && (this->pauseCtx.debugEditor == DEBUG_EDITOR_NONE)) || - (this->msgCtx.currentTextId != 0xFF)) { + if (!IS_PAUSED(&this->pauseCtx) || (this->msgCtx.currentTextId != 0xFF)) { Message_Draw(this); } diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index 017520cde8..fdfe4c7dca 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -1,5 +1,6 @@ #include "prevent_bss_reordering.h" #include "global.h" +#include "z64pause_menu.h" #define FLAGS \ (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_200000 | \ diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 67bd44c180..11736a1760 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -1,6 +1,5 @@ #include "global.h" #include "sys_cfb.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" Gfx gSetupDLs[SETUPDL_MAX][6] = { { diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 18f4d76f1b..af75b9a1d4 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -1,7 +1,6 @@ #include "global.h" #include "z64horse.h" #include "overlays/gamestates/ovl_file_choose/z_file_select.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" void Sram_SyncWriteToFlash(SramContext* sramCtx, s32 curPage, s32 numPages); void func_80147314(SramContext* sramCtx, s32 fileNum); diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index 9dc32de4e3..fde9797bf4 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -49,6 +49,7 @@ * - Seaweed */ +#include "prevent_bss_reordering.h" #include "z_boss_03.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" #include "overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h" diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 196841cdfc..e933029c3d 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -5,7 +5,6 @@ */ #include "z_en_okarina_effect.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_2000000) diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index 236748be69..36dd20ed81 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -6,7 +6,6 @@ #include "z_en_thiefbird.h" #include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" #define FLAGS \ (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_200 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_80000000) diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 8e2a77a1fe..ea179c4685 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -3,6 +3,7 @@ * Overlay: ovl_player_actor * Description: Player */ + #include "global.h" #include "z64horse.h" #include "z64malloc.h" diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c index ed4af43e82..8edfe04ae9 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_NES.c @@ -4,6 +4,7 @@ * Description: Entering name on a new file, selecting options from the options menu */ +#include "prevent_bss_reordering.h" #include "z_file_select.h" #include "z64rumble.h" #include "misc/title_static/title_static.h" diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c index 4c49f5b45f..13cfd2a9c7 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_collect.c @@ -393,7 +393,8 @@ void KaleidoScope_DrawQuestStatus(PlayState* play) { POLY_OPA_DISP, sOcarinaButtonTextures[sQuestSongPlayedOcarinaButtons[i]], 16, 16, 0); } } - } else if (IS_PAUSE_MAIN_STATE_SONG_PROMPT || (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) { + } else if (IS_PAUSE_MAIN_STATE_SONG_PROMPT(pauseCtx) || + (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG)) { // Draw the buttons for playing a song sp1C8 = pauseCtx->ocarinaSongIndex; sp1CA = gOcarinaSongButtons[sp1C8].numButtons; diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c index 02f011807e..2ea96c2013 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_item.c @@ -317,7 +317,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { if (pauseCtx->pageIndex == PAUSE_ITEM) { if ((pauseCtx->state == PAUSE_STATE_MAIN) && ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (pauseCtx->mainState == PAUSE_MAIN_STATE_EQUIP_ITEM)) && - (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) && !IS_PAUSE_STATE_GAMEOVER) { + (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) && !IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { Gfx_SetupDL39_Opa(play->state.gfxCtx); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c index 3af7105d73..c6afc184b1 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_map.c @@ -173,7 +173,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { // If (pauseCtx->state == PAUSE_STATE_MAIN), then the other conditions are redundant and // always return true if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) && - !IS_PAUSE_STATE_GAMEOVER) { + !IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { KaleidoScope_SetView(pauseCtx, 0.0f, 0.0f, 64.0f); if (!sStrayFairyIconAlphaScaleState) { @@ -274,7 +274,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play) { // If (pauseCtx->state == PAUSE_STATE_MAIN), then the other conditions are redundant and always return // true if ((pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) && - !IS_PAUSE_STATE_GAMEOVER) { + !IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { Gfx_SetupDL39_Opa(play->state.gfxCtx); @@ -549,7 +549,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { // Draw the world map image if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->state == PAUSE_STATE_MAIN) && ((pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) || (pauseCtx->mainState == PAUSE_MAIN_STATE_EQUIP_ITEM)) && - YREG(6) && (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) && !IS_PAUSE_STATE_GAMEOVER) { + YREG(6) && (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) && !IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { // Draw the world map image flat // Because it is flat, the texture is loaded by filling it in 8 rows at a time. @@ -661,7 +661,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { } } - if (IS_PAUSE_STATE_OWL_WARP) { + if (IS_PAUSE_STATE_OWL_WARP(pauseCtx)) { gDPPipeSync(POLY_OPA_DISP++); gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF, G_RM_XLU_SURF2); gDPSetCombineMode(POLY_OPA_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); @@ -671,7 +671,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { Gfx_SetupDL42_Opa(play->state.gfxCtx); - if (!IS_PAUSE_STATE_OWL_WARP) { + if (!IS_PAUSE_STATE_OWL_WARP(pauseCtx)) { // Browsing the world map regions on the pause menu gDPLoadTextureBlock(POLY_OPA_DISP++, gWorldMapDotTex, G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, @@ -746,7 +746,7 @@ void KaleidoScope_DrawWorldMap(PlayState* play) { // and always return true if ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->mainState == PAUSE_MAIN_STATE_IDLE) && (pauseCtx->state == PAUSE_STATE_MAIN) && (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) && - !IS_PAUSE_STATE_GAMEOVER) { + !IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { j = 0; n = 0; diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h index fc7b531078..63bda86152 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h @@ -2,20 +2,13 @@ #define Z_KALEIDO_SCOPE_H #include "global.h" +#include "z64pause_menu.h" #define PAUSE_ITEM_NONE 999 #define PAUSE_CURSOR_PAGE_LEFT 10 #define PAUSE_CURSOR_PAGE_RIGHT 11 -typedef enum { - /* 0 */ PAUSE_ITEM, - /* 1 */ PAUSE_MAP, - /* 2 */ PAUSE_QUEST, - /* 3 */ PAUSE_MASK, - /* 4 */ PAUSE_WORLD_MAP -} PauseMenuPage; - // Direction of pause pages #define PAUSE_ITEM_X (0) #define PAUSE_ITEM_Z (-1) @@ -28,104 +21,20 @@ typedef enum { #define PAUSE_EYE_DIST (64.0f) -typedef enum { - /* 0x00 */ PAUSE_STATE_OFF, - /* 0x01 */ PAUSE_STATE_OPENING_0, - /* 0x02 */ PAUSE_STATE_OPENING_1, - /* 0x03 */ PAUSE_STATE_OPENING_2, - /* 0x04 */ PAUSE_STATE_OPENING_3, - /* 0x05 */ PAUSE_STATE_OPENING_4, - /* 0x06 */ PAUSE_STATE_MAIN, // Pause menu ready for player inputs. - /* 0x07 */ PAUSE_STATE_SAVEPROMPT, - /* 0x08 */ PAUSE_STATE_GAMEOVER_0, - /* 0x09 */ PAUSE_STATE_GAMEOVER_1, - /* 0x0A */ PAUSE_STATE_GAMEOVER_2, - /* 0x0B */ PAUSE_STATE_GAMEOVER_3, - /* 0x0C */ PAUSE_STATE_GAMEOVER_4, - /* 0x0D */ PAUSE_STATE_GAMEOVER_5, - /* 0x0E */ PAUSE_STATE_GAMEOVER_SAVE_PROMPT, - /* 0x0F */ PAUSE_STATE_GAMEOVER_7, - /* 0x10 */ PAUSE_STATE_GAMEOVER_8, - /* 0x11 */ PAUSE_STATE_GAMEOVER_CONTINUE_PROMPT, - /* 0x12 */ PAUSE_STATE_GAMEOVER_10, - /* 0x13 */ PAUSE_STATE_OWL_WARP_0, - /* 0x14 */ PAUSE_STATE_OWL_WARP_1, - /* 0x15 */ PAUSE_STATE_OWL_WARP_2, - /* 0x16 */ PAUSE_STATE_OWL_WARP_3, - /* 0x17 */ PAUSE_STATE_OWL_WARP_SELECT, // Selecting the destination - /* 0x18 */ PAUSE_STATE_OWL_WARP_CONFIRM, // Confirming the choice given - /* 0x19 */ PAUSE_STATE_OWL_WARP_6, - /* 0x1A */ PAUSE_STATE_UNPAUSE_SETUP, // Unpause - /* 0x1B */ PAUSE_STATE_UNPAUSE_CLOSE -} PauseState; - -typedef enum { - /* 0x00 */ PAUSE_MAIN_STATE_IDLE, // Await input for the next action - /* 0x01 */ PAUSE_MAIN_STATE_SWITCHING_PAGE, - /* 0x02 */ PAUSE_MAIN_STATE_SONG_PLAYBACK, - /* 0x03 */ PAUSE_MAIN_STATE_EQUIP_ITEM, - /* 0x04 */ PAUSE_MAIN_STATE_SONG_PROMPT_INIT, - /* 0x05 */ PAUSE_MAIN_STATE_SONG_PROMPT, - /* 0x06 */ PAUSE_MAIN_STATE_SONG_PROMPT_DONE, - /* 0x07 */ PAUSE_MAIN_STATE_SONG_PROMPT_UNUSED, - /* 0x08 */ PAUSE_MAIN_STATE_IDLE_CURSOR_ON_SONG, // Await input but the cursor is on a song - /* 0x09 */ PAUSE_MAIN_STATE_SONG_PLAYBACK_INIT, - /* 0x0F */ PAUSE_MAIN_STATE_EQUIP_MASK = 0xF, - /* 0x10 */ PAUSE_MAIN_STATE_BOMBERS_NOTEBOOK_OPEN, - /* 0x11 */ PAUSE_MAIN_STATE_UNK -} PauseMainState; - -typedef enum { - /* 0x00 */ PAUSE_SAVEPROMPT_STATE_APPEARING, - /* 0x01 */ PAUSE_SAVEPROMPT_STATE_1, - /* 0x02 */ PAUSE_SAVEPROMPT_STATE_RETURN_TO_MENU, - /* 0x03 */ PAUSE_SAVEPROMPT_STATE_3, - /* 0x04 */ PAUSE_SAVEPROMPT_STATE_4, - /* 0x05 */ PAUSE_SAVEPROMPT_STATE_5, - /* 0x06 */ PAUSE_SAVEPROMPT_STATE_6, - /* 0x07 */ PAUSE_SAVEPROMPT_STATE_7 -} PauseSavePromptState; - -#define IS_PAUSE_STATE_GAMEOVER \ - ((pauseCtx->state >= PAUSE_STATE_GAMEOVER_0) && (pauseCtx->state <= PAUSE_STATE_GAMEOVER_10)) - -#define IS_PAUSE_STATE_OWL_WARP \ - ((pauseCtx->state >= PAUSE_STATE_OWL_WARP_2) && (pauseCtx->state <= PAUSE_STATE_OWL_WARP_6)) - -#define IS_PAUSE_MAIN_STATE_SONG_PROMPT \ - ((pauseCtx->mainState >= PAUSE_MAIN_STATE_SONG_PROMPT_INIT) && \ - (pauseCtx->mainState <= PAUSE_MAIN_STATE_SONG_PROMPT_DONE)) - -typedef enum { +typedef enum PauseEquipCButton { /* 0 */ PAUSE_EQUIP_C_LEFT, /* 1 */ PAUSE_EQUIP_C_DOWN, /* 2 */ PAUSE_EQUIP_C_RIGHT } PauseEquipCButton; -typedef enum { +typedef enum EquipState { /* 0 */ EQUIP_STATE_MAGIC_ARROW_GROW_ORB, /* 1 */ EQUIP_STATE_MAGIC_ARROW_MOVE_TO_BOW_SLOT, /* 2 */ EQUIP_STATE_MAGIC_ARROW_HOVER_OVER_BOW_SLOT, /* 3 */ EQUIP_STATE_MOVE_TO_C_BTN } EquipState; -typedef enum { - /* 0 */ DEBUG_EDITOR_NONE, - /* 1 */ DEBUG_EDITOR_INVENTORY_INIT, - /* 2 */ DEBUG_EDITOR_INVENTORY, - /* 3 */ DEBUG_EDITOR_EVENTS -} DebugEditor; - -typedef enum { - /* 0 */ PAUSE_BG_PRERENDER_OFF, - /* 1 */ PAUSE_BG_PRERENDER_SETUP, // The current frame is only drawn for the purpose of serving as the pause background. - /* 2 */ PAUSE_BG_PRERENDER_PROCESS, // The previous frame was PAUSE_BG_PRERENDER_DRAW, now apply prerender filters. - /* 3 */ PAUSE_BG_PRERENDER_READY, // The pause background is ready to be used. - /* 4 */ PAUSE_BG_PRERENDER_UNK4, - /* 5 */ PAUSE_BG_PRERENDER_MAX -} PauseBgPreRenderState; - -typedef enum { +typedef enum VtxPage { /* 0 */ VTX_PAGE_MASK, /* 1 */ VTX_PAGE_ITEM, /* 2 */ VTX_PAGE_MAP_DUNGEON, @@ -152,8 +61,6 @@ typedef enum { // === ITEM === // -#define ITEM_GRID_ROWS 4 -#define ITEM_GRID_COLS 6 #define ITEM_GRID_CELL_WIDTH 32 #define ITEM_GRID_CELL_HEIGHT 32 #define ITEM_GRID_QUAD_MARGIN 2 @@ -167,9 +74,7 @@ typedef enum { #define ITEM_GRID_SELECTED_QUAD_HEIGHT (ITEM_GRID_QUAD_HEIGHT - (2 * ITEM_GRID_SELECTED_QUAD_MARGIN)) #define ITEM_GRID_SELECTED_QUAD_TEX_SIZE 32 // both width and height -#define ITEM_NUM_SLOTS (ITEM_GRID_ROWS * ITEM_GRID_COLS) - -typedef enum { +typedef enum ItemPageQuad { // 0..59 are the 15 background textures /* 0 */ QUAD_ITEM_PAGE_BG_FIRST, /* 14 */ QUAD_ITEM_PAGE_BG_LAST = PAGE_BG_QUADS - 1, @@ -177,7 +82,7 @@ typedef enum { /* 15 */ QUAD_ITEM_PAGE_MAX } ItemPageQuad; -typedef enum { +typedef enum ItemQuad { // 0..23 are the ITEM_GRID_ROWS*ITEM_GRID_COLS item grid // The values follow the `InventorySlot` enum /* 0 */ QUAD_ITEM_GRID_FIRST, @@ -191,8 +96,6 @@ typedef enum { // === MASK === // -#define MASK_GRID_ROWS 4 -#define MASK_GRID_COLS 6 #define MASK_GRID_CELL_WIDTH 32 #define MASK_GRID_CELL_HEIGHT 32 #define MASK_GRID_QUAD_MARGIN 2 @@ -206,9 +109,8 @@ typedef enum { #define MASK_GRID_SELECTED_QUAD_HEIGHT (MASK_GRID_QUAD_HEIGHT - (2 * MASK_GRID_SELECTED_QUAD_MARGIN)) #define MASK_GRID_SELECTED_QUAD_TEX_SIZE 32 // both width and height -#define MASK_NUM_SLOTS (MASK_GRID_ROWS * MASK_GRID_COLS) -typedef enum { +typedef enum MaskPageQuad { // 0..59 are the 15 background textures /* 0 */ QUAD_MASK_PAGE_BG_FIRST, /* 14 */ QUAD_MASK_PAGE_BG_LAST = PAGE_BG_QUADS - 1, @@ -216,7 +118,7 @@ typedef enum { /* 15 */ QUAD_MASK_PAGE_MAX } MaskPageQuad; -typedef enum { +typedef enum MaskQuad { // 0..23 are the MASK_GRID_ROWS*MASK_GRID_COLS item grid // The values follow the `InventorySlot` enum offset by ITEM_NUM_SLOTS /* 0 */ QUAD_MASK_GRID_FIRST, @@ -230,7 +132,7 @@ typedef enum { // === QUEST === // -typedef enum { +typedef enum QuestPageQuad { // 0..59 are the 15 background textures /* 0 */ QUAD_QUEST_PAGE_BG_FIRST, /* 14 */ QUAD_QUEST_PAGE_BG_LAST = PAGE_BG_QUADS - 1, @@ -238,7 +140,7 @@ typedef enum { /* 15 */ QUAD_QUEST_PAGE_MAX } QuestPageQuad; -typedef enum { +typedef enum QuestQuad { // 0 to 24 matches the `QuestItem` enum // Notes showing the correct song /* 25 */ QUAD_QUEST_SONG_NOTE_A1 = QUEST_HEART_PIECE + 1, @@ -263,7 +165,7 @@ typedef enum { // === DUNGEON MAP === // -typedef enum { +typedef enum DungeonMapPageQuad { // 0..59 are the 15 background textures /* 0 */ QUAD_MAP_PAGE_DUNGEON_BG_FIRST, /* 14 */ QUAD_MAP_PAGE_DUNGEON_BG_LAST = PAGE_BG_QUADS - 1, @@ -284,7 +186,7 @@ typedef enum { #define WORLD_MAP_IMAGE_FRAG_NUM (((WORLD_MAP_IMAGE_HEIGHT - 1) / WORLD_MAP_IMAGE_FRAG_HEIGHT) + 1) #define WORLD_MAP_NUM_CLOUDS 15 -typedef enum { +typedef enum WorldMapPageQuad { // 0..59 are the 15 background textures /* 0 */ QUAD_MAP_PAGE_WORLD_BG_FIRST, /* 14 */ QUAD_MAP_PAGE_WORLD_BG_LAST = PAGE_BG_QUADS - 1, @@ -337,13 +239,13 @@ typedef enum { #define PAUSE_CURSOR_COLOR_SET_BLUE 4 // To be used for Item-Page cursor and Mask-Page cursor -typedef enum { +typedef enum PauseMoveCursorResult { /* 0 */ PAUSE_CURSOR_RESULT_NONE, /* 1 */ PAUSE_CURSOR_RESULT_SLOT, /* 2 */ PAUSE_CURSOR_RESULT_SPECIAL_POS } PauseMoveCursorResult; -typedef enum { +typedef enum PauseCursorQuad { /* 0 */ PAUSE_QUAD_CURSOR_0, /* 1 */ PAUSE_QUAD_CURSOR_1, /* 2 */ PAUSE_QUAD_CURSOR_2, @@ -385,7 +287,7 @@ typedef enum { #define PAUSE_PROMPT_YES 0 #define PAUSE_PROMPT_NO 4 -typedef enum { +typedef enum PromptQuad { /* 0 */ QUAD_PROMPT_MESSAGE, /* 1 */ QUAD_PROMPT_CURSOR_LEFT, /* 2 */ QUAD_PROMPT_CURSOR_RIGHT, diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index a23a73a809..52d90d8ebf 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -449,7 +449,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx); - if (!IS_PAUSE_STATE_GAMEOVER) { + if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { if (pauseCtx->state != PAUSE_STATE_SAVEPROMPT) { stepR = @@ -1743,7 +1743,7 @@ s16 KaleidoScope_SetPageVertices(PlayState* play, Vtx* vtx, s16 vtxPage, s16 num vtx[k + 1].v.ob[0] = vtx[k + 3].v.ob[0] = vtx[k + 0].v.ob[0] + quadsWidth[i]; - if (!IS_PAUSE_STATE_GAMEOVER) { + if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { vtx[k + 0].v.ob[1] = vtx[k + 1].v.ob[1] = quadsY[i] + pauseCtx->offsetY; } else if (gameOverCtx->state == GAMEOVER_INACTIVE) { vtx[k + 0].v.ob[1] = vtx[k + 1].v.ob[1] = quadsY[i] + pauseCtx->offsetY; @@ -2301,7 +2301,7 @@ void KaleidoScope_SetVertices(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->infoPanelVtx = GRAPH_ALLOC(gfxCtx, 28 * sizeof(Vtx)); - if ((pauseCtx->state == PAUSE_STATE_SAVEPROMPT) || IS_PAUSE_STATE_GAMEOVER) { + if ((pauseCtx->state == PAUSE_STATE_SAVEPROMPT) || IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { pauseCtx->promptPageVtx = GRAPH_ALLOC(gfxCtx, ((PAGE_BG_QUADS + VTX_PAGE_SAVE_QUADS) * 4) * sizeof(Vtx)); KaleidoScope_SetPageVertices(play, pauseCtx->promptPageVtx, VTX_PAGE_PROMPT, VTX_PAGE_SAVE_QUADS); } @@ -2474,14 +2474,14 @@ void KaleidoScope_UpdateCursorSize(PlayState* play) { case PAUSE_MAP: if (!sInDungeonScene) { - if (IS_PAUSE_STATE_OWL_WARP) { + if (IS_PAUSE_STATE_OWL_WARP(pauseCtx)) { pauseCtx->cursorX = sOwlWarpWorldMapCursorsX[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]; pauseCtx->cursorY = sOwlWarpWorldMapCursorsY[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]; } else { pauseCtx->cursorX = sWorldMapCursorsX[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]; pauseCtx->cursorY = sWorldMapCursorsY[pauseCtx->cursorPoint[PAUSE_WORLD_MAP]]; } - if (!IS_PAUSE_STATE_OWL_WARP) { + if (!IS_PAUSE_STATE_OWL_WARP(pauseCtx)) { pauseCtx->cursorHeight = 10.0f; pauseCtx->cursorWidth = 10.0f; } else { @@ -2685,7 +2685,7 @@ void KaleidoScope_Draw(PlayState* play) { KaleidoScope_SetView(pauseCtx, pauseCtx->eye.x, pauseCtx->eye.y, pauseCtx->eye.z); Gfx_SetupDL42_Opa(play->state.gfxCtx); - if (!IS_PAUSE_STATE_OWL_WARP) { + if (!IS_PAUSE_STATE_OWL_WARP(pauseCtx)) { // Draw Default or Game Over Menus KaleidoScope_SetVertices(play, play->state.gfxCtx); KaleidoScope_DrawPages(play, play->state.gfxCtx); @@ -2696,7 +2696,7 @@ void KaleidoScope_Draw(PlayState* play) { KaleidoScope_SetView(pauseCtx, 0.0f, 0.0f, 64.0f); - if (!IS_PAUSE_STATE_GAMEOVER) { + if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { KaleidoScope_DrawInfoPanel(play); } @@ -3620,7 +3620,7 @@ void KaleidoScope_Update(PlayState* play) { // If stickAdj is held, set a delay to allow the cursor to read the next input. // The first delay is given a longer time than all subsequent delays. - if (!IS_PAUSE_STATE_GAMEOVER && (pauseCtx->state != PAUSE_STATE_SAVEPROMPT)) { + if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx) && (pauseCtx->state != PAUSE_STATE_SAVEPROMPT)) { if (pauseCtx->stickAdjX < -30) { if (sStickXRepeatState == -1) { sStickXRepeatTimer--; @@ -3692,10 +3692,10 @@ void KaleidoScope_Update(PlayState* play) { // Process the Cursor input if ((R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_READY) && (pauseCtx->debugEditor == DEBUG_EDITOR_NONE) && - !IS_PAUSE_STATE_OWL_WARP && + !IS_PAUSE_STATE_OWL_WARP(pauseCtx) && (((pauseCtx->state >= PAUSE_STATE_OPENING_3) && (pauseCtx->state <= PAUSE_STATE_SAVEPROMPT)) || ((pauseCtx->state >= PAUSE_STATE_GAMEOVER_2) && (pauseCtx->state <= PAUSE_STATE_UNPAUSE_SETUP)))) { - if (!IS_PAUSE_STATE_GAMEOVER) { + if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) { switch (pauseCtx->pageIndex) { case PAUSE_ITEM: KaleidoScope_UpdateItemCursor(play);