diff options
| author | engineer124 <47598039+engineer124@users.noreply.github.com> | 2022-09-24 15:29:21 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-24 16:29:21 -0300 |
| commit | 37a9b8e3c487f2798d0eb4aafbacfbe235b5fdc2 (patch) | |
| tree | 46b8d81c454b974fc1c15a9aa9b6a5e7af37ce86 /src/code | |
| parent | 6fab0f962c4a67c251387078c5373144b4a91c33 (diff) | |
ActorContext Flags (#1060)
* actor context flags
* bracket cleanup
* comment out recursive name-fixer
* Empty-Commit
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_actor.c | 46 | ||||
| -rw-r--r-- | src/code/z_kaleido_setup.c | 3 | ||||
| -rw-r--r-- | src/code/z_play.c | 22 | ||||
| -rw-r--r-- | src/code/z_sram_NES.c | 10 |
4 files changed, 41 insertions, 40 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c index c367e75e9..61e4dc807 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -692,7 +692,7 @@ void func_800B5814(TargetContext* targetCtx, Player* player, Actor* actor, GameS */ s32 Flags_GetSwitch(PlayState* play, s32 flag) { if (flag >= 0 && flag < 0x80) { - return play->actorCtx.flags.switches[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F)); + return play->actorCtx.sceneFlags.switches[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F)); } return 0; } @@ -702,7 +702,7 @@ s32 Flags_GetSwitch(PlayState* play, s32 flag) { */ void Flags_SetSwitch(PlayState* play, s32 flag) { if (flag >= 0 && flag < 0x80) { - play->actorCtx.flags.switches[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F); + play->actorCtx.sceneFlags.switches[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F); } } @@ -711,7 +711,7 @@ void Flags_SetSwitch(PlayState* play, s32 flag) { */ void Flags_UnsetSwitch(PlayState* play, s32 flag) { if (flag >= 0 && flag < 0x80) { - play->actorCtx.flags.switches[(flag & ~0x1F) >> 5] &= ~(1 << (flag & 0x1F)); + play->actorCtx.sceneFlags.switches[(flag & ~0x1F) >> 5] &= ~(1 << (flag & 0x1F)); } } @@ -719,70 +719,70 @@ void Flags_UnsetSwitch(PlayState* play, s32 flag) { * Tests if current scene chest flag is set. */ s32 Flags_GetTreasure(PlayState* play, s32 flag) { - return play->actorCtx.flags.chest & (1 << flag); + return play->actorCtx.sceneFlags.chest & (1 << flag); } /** * Sets current scene chest flag. */ void Flags_SetTreasure(PlayState* play, s32 flag) { - play->actorCtx.flags.chest |= (1 << flag); + play->actorCtx.sceneFlags.chest |= (1 << flag); } /** * Overrides the all the chest flags. */ void Flags_SetAllTreasure(PlayState* play, s32 flag) { - play->actorCtx.flags.chest = flag; + play->actorCtx.sceneFlags.chest = flag; } /** * Returns all the chest flags. */ s32 Flags_GetAllTreasure(PlayState* play) { - return play->actorCtx.flags.chest; + return play->actorCtx.sceneFlags.chest; } /** * Tests if current scene clear flag is set. */ s32 Flags_GetClear(PlayState* play, s32 roomNumber) { - return play->actorCtx.flags.clearedRoom & (1 << roomNumber); + return play->actorCtx.sceneFlags.clearedRoom & (1 << roomNumber); } /** * Sets current scene clear flag. */ void Flags_SetClear(PlayState* play, s32 roomNumber) { - play->actorCtx.flags.clearedRoom |= (1 << roomNumber); + play->actorCtx.sceneFlags.clearedRoom |= (1 << roomNumber); } /** * Unsets current scene clear flag. */ void Flags_UnsetClear(PlayState* play, s32 roomNumber) { - play->actorCtx.flags.clearedRoom &= ~(1 << roomNumber); + play->actorCtx.sceneFlags.clearedRoom &= ~(1 << roomNumber); } /** * Tests if current scene temp clear flag is set. */ s32 Flags_GetClearTemp(PlayState* play, s32 roomNumber) { - return play->actorCtx.flags.clearedRoomTemp & (1 << roomNumber); + return play->actorCtx.sceneFlags.clearedRoomTemp & (1 << roomNumber); } /** * Sets current scene temp clear flag. */ void Flags_SetClearTemp(PlayState* play, s32 roomNumber) { - play->actorCtx.flags.clearedRoomTemp |= (1 << roomNumber); + play->actorCtx.sceneFlags.clearedRoomTemp |= (1 << roomNumber); } /** * Unsets current scene temp clear flag. */ void Flags_UnsetClearTemp(PlayState* play, s32 roomNumber) { - play->actorCtx.flags.clearedRoomTemp &= ~(1 << roomNumber); + play->actorCtx.sceneFlags.clearedRoomTemp &= ~(1 << roomNumber); } /** @@ -790,7 +790,7 @@ void Flags_UnsetClearTemp(PlayState* play, s32 roomNumber) { */ s32 Flags_GetCollectible(PlayState* play, s32 flag) { if (flag > 0 && flag < 0x80) { - return play->actorCtx.flags.collectible[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F)); + return play->actorCtx.sceneFlags.collectible[(flag & ~0x1F) >> 5] & (1 << (flag & 0x1F)); } return 0; } @@ -800,7 +800,7 @@ s32 Flags_GetCollectible(PlayState* play, s32 flag) { */ void Flags_SetCollectible(PlayState* play, s32 flag) { if (flag > 0 && flag < 0x80) { - play->actorCtx.flags.collectible[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F); + play->actorCtx.sceneFlags.collectible[(flag & ~0x1F) >> 5] |= 1 << (flag & 0x1F); } } @@ -2249,14 +2249,14 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* acto overlayEntry++; } - actorCtx->flags.chest = cycleFlags->chest; - actorCtx->flags.switches[0] = cycleFlags->switch0; - actorCtx->flags.switches[1] = cycleFlags->switch1; + actorCtx->sceneFlags.chest = cycleFlags->chest; + actorCtx->sceneFlags.switches[0] = cycleFlags->switch0; + actorCtx->sceneFlags.switches[1] = cycleFlags->switch1; if (play->sceneNum == SCENE_INISIE_R) { cycleFlags = &gSaveContext.cycleSceneFlags[play->sceneNum]; } - actorCtx->flags.collectible[0] = cycleFlags->collectible; - actorCtx->flags.clearedRoom = cycleFlags->clearedRoom; + actorCtx->sceneFlags.collectible[0] = cycleFlags->collectible; + actorCtx->sceneFlags.clearedRoom = cycleFlags->clearedRoom; TitleCard_ContextInit(&play->state, &actorCtx->titleCtxt); func_800B6468(play); @@ -2976,9 +2976,9 @@ void func_800BA798(PlayState* play, ActorContext* actorCtx) { } CollisionCheck_ClearContext(play, &play->colChkCtx); - actorCtx->flags.clearedRoomTemp = 0; - actorCtx->flags.switches[3] = 0; - actorCtx->flags.collectible[3] = 0; + actorCtx->sceneFlags.clearedRoomTemp = 0; + actorCtx->sceneFlags.switches[3] = 0; + actorCtx->sceneFlags.collectible[3] = 0; play->msgCtx.unk_12030 = 0; } diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index a2742c746..b054dac74 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -78,7 +78,8 @@ void KaleidoSetup_Update(PlayState* play) { if ((play->unk_1887C < 2) && (gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY) && (gSaveContext.magicState != MAGIC_STATE_FILL)) { if (!(gSaveContext.eventInf[1] & 0x80) && !(player->stateFlags1 & 0x20)) { - if (!(play->actorCtx.unk5 & 2) && !(play->actorCtx.unk5 & 4)) { + if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) && + !(play->actorCtx.flags & ACTORCTX_FLAG_2)) { if ((play->actorCtx.unk268 == 0) && CHECK_BTN_ALL(input->press.button, BTN_START)) { gSaveContext.unk_3F26 = gSaveContext.unk_3F22; pauseCtx->unk_2B9 = 0; diff --git a/src/code/z_play.c b/src/code/z_play.c index c24a45b51..346f34692 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -345,16 +345,16 @@ void Play_SaveCycleSceneFlags(GameState* thisx) { CycleSceneFlags* cycleSceneFlags; cycleSceneFlags = &gSaveContext.cycleSceneFlags[Play_GetOriginalSceneNumber(this->sceneNum)]; - cycleSceneFlags->chest = this->actorCtx.flags.chest; - cycleSceneFlags->switch0 = this->actorCtx.flags.switches[0]; - cycleSceneFlags->switch1 = this->actorCtx.flags.switches[1]; + cycleSceneFlags->chest = this->actorCtx.sceneFlags.chest; + cycleSceneFlags->switch0 = this->actorCtx.sceneFlags.switches[0]; + cycleSceneFlags->switch1 = this->actorCtx.sceneFlags.switches[1]; if (this->sceneNum == SCENE_INISIE_R) { // Inverted Stone Tower Temple cycleSceneFlags = &gSaveContext.cycleSceneFlags[this->sceneNum]; } - cycleSceneFlags->collectible = this->actorCtx.flags.collectible[0]; - cycleSceneFlags->clearedRoom = this->actorCtx.flags.clearedRoom; + cycleSceneFlags->collectible = this->actorCtx.sceneFlags.collectible[0]; + cycleSceneFlags->clearedRoom = this->actorCtx.sceneFlags.clearedRoom; } void Play_SetRespawnData(GameState* thisx, s32 respawnMode, u16 entrance, s32 roomIndex, s32 playerParams, Vec3f* pos, @@ -366,9 +366,9 @@ void Play_SetRespawnData(GameState* thisx, s32 respawnMode, u16 entrance, s32 ro gSaveContext.respawn[respawnMode].pos = *pos; gSaveContext.respawn[respawnMode].yaw = yaw; gSaveContext.respawn[respawnMode].playerParams = playerParams; - gSaveContext.respawn[respawnMode].tempSwitchFlags = this->actorCtx.flags.switches[2]; - gSaveContext.respawn[respawnMode].unk_18 = this->actorCtx.flags.collectible[1]; - gSaveContext.respawn[respawnMode].tempCollectFlags = this->actorCtx.flags.collectible[2]; + gSaveContext.respawn[respawnMode].tempSwitchFlags = this->actorCtx.sceneFlags.switches[2]; + gSaveContext.respawn[respawnMode].unk_18 = this->actorCtx.sceneFlags.collectible[1]; + gSaveContext.respawn[respawnMode].tempCollectFlags = this->actorCtx.sceneFlags.collectible[2]; } void Play_SetupRespawnPoint(GameState* thisx, s32 respawnMode, s32 playerParams) { @@ -395,9 +395,9 @@ void func_80169ECC(PlayState* this) { void func_80169EFC(GameState* thisx) { PlayState* this = (PlayState*)thisx; - gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwitchFlags = this->actorCtx.flags.switches[2]; - gSaveContext.respawn[RESPAWN_MODE_DOWN].unk_18 = this->actorCtx.flags.collectible[1]; - gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = this->actorCtx.flags.collectible[2]; + gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwitchFlags = this->actorCtx.sceneFlags.switches[2]; + gSaveContext.respawn[RESPAWN_MODE_DOWN].unk_18 = this->actorCtx.sceneFlags.collectible[1]; + gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = this->actorCtx.sceneFlags.collectible[2]; this->nextEntrance = gSaveContext.respawn[RESPAWN_MODE_DOWN].entrance; gSaveContext.respawnFlag = 1; func_80169ECC(this); diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index 7b8b67443..781b623b2 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -267,11 +267,11 @@ void Sram_SaveEndOfCycle(PlayState* play) { sceneNum = Play_GetOriginalSceneNumber(play->sceneNum); Play_SaveCycleSceneFlags(&play->state); - play->actorCtx.flags.chest &= D_801C5FC0[sceneNum][2]; - play->actorCtx.flags.switches[0] &= D_801C5FC0[sceneNum][0]; - play->actorCtx.flags.switches[1] &= D_801C5FC0[sceneNum][1]; - play->actorCtx.flags.collectible[0] &= D_801C5FC0[sceneNum][3]; - play->actorCtx.flags.clearedRoom = 0; + play->actorCtx.sceneFlags.chest &= D_801C5FC0[sceneNum][2]; + play->actorCtx.sceneFlags.switches[0] &= D_801C5FC0[sceneNum][0]; + play->actorCtx.sceneFlags.switches[1] &= D_801C5FC0[sceneNum][1]; + play->actorCtx.sceneFlags.collectible[0] &= D_801C5FC0[sceneNum][3]; + play->actorCtx.sceneFlags.clearedRoom = 0; for (i = 0; i < SCENE_MAX; i++) { gSaveContext.cycleSceneFlags[i].switch0 = ((void)0, gSaveContext.cycleSceneFlags[i].switch0) & D_801C5FC0[i][0]; |
