1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-02-23 15:55:47 +00:00

Add IS_PAUSED macro

This commit is contained in:
Dragorn421 2022-11-16 21:45:22 +01:00
parent f752add633
commit c8d0ca5499
No known key found for this signature in database
GPG key ID: 32B53D2D16FC4118
9 changed files with 37 additions and 41 deletions

View file

@ -771,6 +771,9 @@ typedef enum {
#define IS_PAUSE_STATE_GAMEOVER(pauseCtx) \
(((pauseCtx)->state >= PAUSE_STATE_8) && ((pauseCtx)->state <= PAUSE_STATE_17))
#define IS_PAUSED(pauseCtx) \
(((pauseCtx)->state != PAUSE_STATE_OFF) || ((pauseCtx)->debugState != 0))
// Sub-states of PAUSE_STATE_MAIN
typedef enum {
/* 0 */ PAUSE_MAIN_STATE_IDLE,

View file

@ -3218,10 +3218,7 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) {
dynaActor = DynaPoly_GetActor(dynaRaycastDown->colCtx, *dynaRaycastDown->bgId);
if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycastDown->play != NULL)) {
pauseState = dynaRaycastDown->play->pauseCtx.state != PAUSE_STATE_OFF;
if (!pauseState) {
pauseState = dynaRaycastDown->play->pauseCtx.debugState != 0;
}
pauseState = IS_PAUSED(&dynaRaycastDown->play->pauseCtx);
if (!pauseState && (dynaRaycastDown->colCtx->dyna.bgActorFlags[*dynaRaycastDown->bgId] & BGACTOR_1)) {
curTransform = &dynaRaycastDown->dyna->bgActors[*dynaRaycastDown->bgId].curTransform;
polyMin =

View file

@ -56,7 +56,7 @@ void KaleidoScopeCall_Update(PlayState* play) {
KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
PauseContext* pauseCtx = &play->pauseCtx;
if ((pauseCtx->state != PAUSE_STATE_OFF) || (pauseCtx->debugState != 0)) {
if (IS_PAUSED(pauseCtx)) {
if (pauseCtx->state == PAUSE_STATE_WAIT_LETTERBOX) {
if (Letterbox_GetSize() == 0) {
HREG(80) = 7;
@ -101,7 +101,7 @@ void KaleidoScopeCall_Update(PlayState* play) {
if (gKaleidoMgrCurOvl == kaleidoScopeOvl) {
sKaleidoScopeUpdateFunc(play);
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugState == 0)) {
if (!IS_PAUSED(&play->pauseCtx)) {
osSyncPrintf(VT_FGCOL(GREEN));
// "Kaleido area Kaleidoscope Emission"
osSyncPrintf("カレイド領域 カレイドスコープ排出\n");

View file

@ -42,11 +42,11 @@ void KaleidoSetup_Update(PlayState* play) {
PauseContext* pauseCtx = &play->pauseCtx;
Input* input = &play->state.input[0];
if (pauseCtx->state == PAUSE_STATE_OFF && pauseCtx->debugState == 0 &&
play->gameOverCtx.state == GAMEOVER_INACTIVE && play->transitionTrigger == TRANS_TRIGGER_OFF &&
play->transitionMode == TRANS_MODE_OFF && gSaveContext.cutsceneIndex < 0xFFF0 &&
gSaveContext.nextCutsceneIndex < 0xFFF0 && !Play_InCsMode(play) && play->shootingGalleryStatus <= 1 &&
gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY && gSaveContext.magicState != MAGIC_STATE_FILL &&
if (!IS_PAUSED(pauseCtx) && play->gameOverCtx.state == GAMEOVER_INACTIVE &&
play->transitionTrigger == TRANS_TRIGGER_OFF && play->transitionMode == TRANS_MODE_OFF &&
gSaveContext.cutsceneIndex < 0xFFF0 && gSaveContext.nextCutsceneIndex < 0xFFF0 && !Play_InCsMode(play) &&
play->shootingGalleryStatus <= 1 && gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY &&
gSaveContext.magicState != MAGIC_STATE_FILL &&
(play->sceneId != SCENE_BOWLING || !Flags_GetSwitch(play, 0x38))) {
if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) {

View file

@ -887,7 +887,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
}
if (pauseCtx->state == PAUSE_STATE_OFF) {
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugState == 0)) {
if (!IS_PAUSED(&play->pauseCtx)) {
if (play->skyboxId == SKYBOX_NORMAL_SKY) {
play->skyboxCtx.rot.y -= 0.001f;
} else if (play->skyboxId == SKYBOX_CUTSCENE_MAP) {

View file

@ -506,8 +506,7 @@ void Health_UpdateBeatingHeart(PlayState* play) {
if (interfaceCtx->beatingHeartOscillator <= 0) {
interfaceCtx->beatingHeartOscillator = 0;
interfaceCtx->beatingHeartOscillatorDirection = 0;
if (!Player_InCsMode(play) && (play->pauseCtx.state == PAUSE_STATE_OFF) &&
(play->pauseCtx.debugState == 0) && Health_IsCritical() && !Play_InCsMode(play)) {
if (!Player_InCsMode(play) && !IS_PAUSED(&play->pauseCtx) && Health_IsCritical() && !Play_InCsMode(play)) {
func_80078884(NA_SE_SY_HITPOINT_ALARM);
}
}

View file

@ -522,7 +522,7 @@ void Map_Update(PlayState* play) {
s16 floor;
s16 i;
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugState == 0)) {
if (!IS_PAUSED(&play->pauseCtx)) {
switch (play->sceneId) {
case SCENE_YDAN:
case SCENE_DDAN:

View file

@ -2517,10 +2517,9 @@ void Magic_Update(PlayState* play) {
case MAGIC_STATE_CONSUME_LENS:
// Slowly consume magic while lens is on
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugState == 0) &&
(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.magic == 0) ||
((Player_GetEnvironmentalHazard(play) >= PLAYER_ENV_HAZARD_UNDERWATER_FLOOR) &&
(Player_GetEnvironmentalHazard(play) <= PLAYER_ENV_HAZARD_UNDERWATER_FREE)) ||
@ -2774,7 +2773,7 @@ void Interface_DrawItemButtons(PlayState* play) {
G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(3) << 1, R_ITEM_BTN_DD(3) << 1);
if (!IS_PAUSE_STATE_GAMEOVER(pauseCtx)) {
if ((play->pauseCtx.state != PAUSE_STATE_OFF) || (play->pauseCtx.debugState != 0)) {
if (IS_PAUSED(&play->pauseCtx)) {
// Start Button Texture, Color & Label
gDPPipeSync(OVERLAY_DISP++);
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 120, 120, interfaceCtx->startAlpha);
@ -2802,8 +2801,7 @@ void Interface_DrawItemButtons(PlayState* play) {
}
}
if (interfaceCtx->naviCalling && (play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugState == 0) &&
(play->csCtx.state == CS_STATE_IDLE)) {
if (interfaceCtx->naviCalling && !IS_PAUSED(&play->pauseCtx) && (play->csCtx.state == CS_STATE_IDLE)) {
if (!sCUpInvisible) {
// C-Up Button Texture, Color & Label (Navi Text)
gDPPipeSync(OVERLAY_DISP++);
@ -3383,7 +3381,7 @@ void Interface_Draw(PlayState* play) {
Gfx_SetupDL_39Overlay(play->state.gfxCtx);
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugState == 0)) {
if (!IS_PAUSED(&play->pauseCtx)) {
if (gSaveContext.minigameState != 1) {
// Carrots rendering if the action corresponds to riding a horse
if (interfaceCtx->unk_1EE == 8) {
@ -3480,11 +3478,11 @@ void Interface_Draw(PlayState* play) {
}
}
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugState == 0) &&
(play->gameOverCtx.state == GAMEOVER_INACTIVE) && (msgCtx->msgMode == MSGMODE_NONE) &&
!(player->stateFlags2 & PLAYER_STATE2_24) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
(play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play) && (gSaveContext.minigameState != 1) &&
(play->shootingGalleryStatus <= 1) && !((play->sceneId == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38))) {
if (!IS_PAUSED(&play->pauseCtx) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) &&
(msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & PLAYER_STATE2_24) &&
(play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) &&
!Play_InCsMode(play) && (gSaveContext.minigameState != 1) && (play->shootingGalleryStatus <= 1) &&
!((play->sceneId == SCENE_BOWLING) && Flags_GetSwitch(play, 0x38))) {
timerId = TIMER_ID_MAIN;
@ -3936,7 +3934,7 @@ void Interface_Update(PlayState* play) {
osSyncPrintf("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
}
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugState == 0)) {
if (!IS_PAUSED(&play->pauseCtx)) {
if ((gSaveContext.minigameState == 1) || !IS_CUTSCENE_LAYER ||
((play->sceneId == SCENE_SPOT20) && (gSaveContext.sceneLayer == 4))) {
if ((msgCtx->msgMode == MSGMODE_NONE) ||
@ -4081,10 +4079,10 @@ void Interface_Update(PlayState* play) {
Health_UpdateMeter(play);
if ((gSaveContext.timerState >= TIMER_STATE_ENV_HAZARD_MOVE) && (play->pauseCtx.state == PAUSE_STATE_OFF) &&
(play->pauseCtx.debugState == 0) && (msgCtx->msgMode == MSGMODE_NONE) &&
!(player->stateFlags2 & PLAYER_STATE2_24) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
(play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) {}
if ((gSaveContext.timerState >= TIMER_STATE_ENV_HAZARD_MOVE) && !IS_PAUSED(&play->pauseCtx) &&
(msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & PLAYER_STATE2_24) &&
(play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) &&
!Play_InCsMode(play)) {}
if (gSaveContext.rupeeAccumulator != 0) {
if (gSaveContext.rupeeAccumulator > 0) {
@ -4167,10 +4165,9 @@ void Interface_Update(PlayState* play) {
WREG(7) = interfaceCtx->unk_1F4;
// Update Magic
if ((play->pauseCtx.state == PAUSE_STATE_OFF) && (play->pauseCtx.debugState == 0) &&
(msgCtx->msgMode == MSGMODE_NONE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
(play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionMode == TRANS_MODE_OFF) &&
((play->csCtx.state == CS_STATE_IDLE) || !Player_InCsMode(play))) {
if (!IS_PAUSED(&play->pauseCtx) && (msgCtx->msgMode == MSGMODE_NONE) &&
(play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) &&
(play->transitionMode == TRANS_MODE_OFF) && ((play->csCtx.state == CS_STATE_IDLE) || !Player_InCsMode(play))) {
if (gSaveContext.isMagicAcquired && (gSaveContext.magicLevel == 0)) {
gSaveContext.magicLevel = gSaveContext.isDoubleMagicAcquired + 1;

View file

@ -839,7 +839,7 @@ void Play_Update(PlayState* this) {
}
PLAY_LOG(3551);
isPaused = (this->pauseCtx.state != PAUSE_STATE_OFF) || (this->pauseCtx.debugState != 0);
isPaused = IS_PAUSED(&this->pauseCtx);
PLAY_LOG(3555);
AnimationContext_Reset(&this->animationCtx);
@ -916,7 +916,7 @@ void Play_Update(PlayState* this) {
if (this->viewpoint != VIEWPOINT_NONE) {
if (CHECK_BTN_ALL(input[0].press.button, BTN_CUP)) {
if ((this->pauseCtx.state != PAUSE_STATE_OFF) || (this->pauseCtx.debugState != 0)) {
if (IS_PAUSED(&this->pauseCtx)) {
// "Changing viewpoint is prohibited due to the kaleidoscope"
osSyncPrintf(VT_FGCOL(CYAN) "カレイドスコープ中につき視点変更を禁止しております\n" VT_RST);
} else if (Player_InCsMode(this)) {
@ -940,7 +940,7 @@ void Play_Update(PlayState* this) {
PLAY_LOG(3716);
if ((this->pauseCtx.state != PAUSE_STATE_OFF) || (this->pauseCtx.debugState != 0)) {
if (IS_PAUSED(&this->pauseCtx)) {
PLAY_LOG(3721);
KaleidoScopeCall_Update(this);
} else if (this->gameOverCtx.state != GAMEOVER_INACTIVE) {
@ -1003,7 +1003,7 @@ skip:
}
void Play_DrawOverlayElements(PlayState* this) {
if ((this->pauseCtx.state != PAUSE_STATE_OFF) || (this->pauseCtx.debugState != 0)) {
if (IS_PAUSED(&this->pauseCtx)) {
KaleidoScopeCall_Draw(this);
}