ActorContext Flags (#1060)

* actor context flags

* bracket cleanup

* comment out recursive name-fixer

* Empty-Commit
This commit is contained in:
engineer124 2022-09-24 15:29:21 -04:00 committed by GitHub
parent 6fab0f962c
commit 37a9b8e3c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 121 additions and 103 deletions

View File

@ -307,6 +307,16 @@ typedef enum {
/* 0x0C */ ACTORCAT_MAX
} ActorType;
#define ACTORCTX_FLAG_0 (1 << 0)
#define ACTORCTX_FLAG_1 (1 << 1)
#define ACTORCTX_FLAG_2 (1 << 2)
#define ACTORCTX_FLAG_3 (1 << 3)
#define ACTORCTX_FLAG_4 (1 << 4)
#define ACTORCTX_FLAG_5 (1 << 5)
#define ACTORCTX_FLAG_6 (1 << 6)
#define ACTORCTX_FLAG_7 (1 << 7)
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ f32 unkC;
@ -351,13 +361,13 @@ typedef struct ActorContext_unk_20C {
/* 0x4 */ void* ptr;
} ActorContext_unk_20C; // size = 0x8
typedef struct ActorContextFlags {
typedef struct ActorContextSceneFlags {
/* 0x00 */ u32 switches[4]; // First 0x40 are permanent, second 0x40 are temporary
/* 0x10 */ u32 chest;
/* 0x14 */ u32 clearedRoom;
/* 0x18 */ u32 clearedRoomTemp;
/* 0x1C */ u32 collectible[4]; // bitfield of 128 bits
} ActorContextFlags; // size = 0x2C
} ActorContextSceneFlags; // size = 0x2C
typedef struct ActorListEntry {
/* 0x0 */ s32 length; // number of actors loaded of this type
@ -374,7 +384,7 @@ typedef struct ActorContext {
/* 0x002 */ u8 unk2;
/* 0x003 */ u8 lensActive;
/* 0x004 */ s8 lensMaskSize; // The size of the circle when drawn the lens mask. Larger value leads to a smaller circle
/* 0x005 */ u8 unk5;
/* 0x005 */ u8 flags;
/* 0x006 */ UNK_TYPE1 pad6[0x5];
/* 0x00B */ s8 lensActorsDrawn;
/* 0x00C */ s16 unkC;
@ -383,7 +393,7 @@ typedef struct ActorContext {
/* 0x010 */ ActorListEntry actorLists[ACTORCAT_MAX];
/* 0x0A0 */ Actor* undrawnActors[32]; // Records the first 32 actors drawn each frame
/* 0x120 */ TargetContext targetContext;
/* 0x1B8 */ ActorContextFlags flags;
/* 0x1B8 */ ActorContextSceneFlags sceneFlags;
/* 0x1E4 */ TitleCardContext titleCtxt;
/* 0x1F4 */ u8 unk1F4;
/* 0x1F5 */ u8 unk1F5;

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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];

View File

@ -216,7 +216,7 @@ void func_80953F9C(BgIngate* this, PlayState* play) {
if (ActorCutscene_GetCurrentIndex() != -1) {
Camera_ChangeSetting(mainCam, CAM_SET_NORMAL0);
player->stateFlags1 |= 0x20;
play->actorCtx.unk5 &= ~0x4;
play->actorCtx.flags &= ~ACTORCTX_FLAG_2;
} else {
Camera_ChangeSetting(mainCam, CAM_SET_BOAT_CRUISE);
player->stateFlags1 &= ~0x20;

View File

@ -1089,7 +1089,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) {
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
} else if ((play->sceneNum == SCENE_00KEIKOKU) && (gSaveContext.sceneSetupIndex == 0)) {
if (!(play->actorCtx.unk5 & 2)) {
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
Actor_MarkForDeath(&this->actor);
}
@ -1632,7 +1632,7 @@ void DmStk_UpdateCutscenes(DmStk* this, PlayState* play) {
this->alpha = 0;
this->fadeOutState = SK_FADE_OUT_STATE_NONE;
gSaveContext.save.weekEventReg[12] |= 4;
if (!(play->actorCtx.unk5 & 2)) {
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
Actor_MarkForDeath(&this->actor);
} else {
this->shouldDraw = false;
@ -1813,9 +1813,10 @@ void DmStk_Update(Actor* thisx, PlayState* play) {
// This code is responsible for making in-game time pass while using the telescope in the Astral Observatory.
// Skull Kid is always loaded in the scene, even if he isn't visible, hence why time always passes.
if ((play->actorCtx.unk5 & 2) && (play->msgCtx.msgMode != 0) && (play->msgCtx.currentTextId == 0x5E6) &&
!FrameAdvance_IsEnabled(&play->state) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
(ActorCutscene_GetCurrentIndex() == -1) && (play->csCtx.state == 0)) {
if ((play->actorCtx.flags & ACTORCTX_FLAG_1) && (play->msgCtx.msgMode != 0) &&
(play->msgCtx.currentTextId == 0x5E6) && !FrameAdvance_IsEnabled(&play->state) &&
(play->transitionTrigger == TRANS_TRIGGER_OFF) && (ActorCutscene_GetCurrentIndex() == -1) &&
(play->csCtx.state == 0)) {
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)REG(15);
if (REG(15) != 0) {
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)((void)0, gSaveContext.save.daySpeed);

View File

@ -139,7 +139,7 @@ void EnBom_Init(Actor* thisx, PlayState* play) {
this->flashSpeedScale = 7;
this->isPowderKeg = ENBOM_GETX_1(&this->actor);
if (this->isPowderKeg) {
play->actorCtx.unk5 |= 1;
play->actorCtx.flags |= ACTORCTX_FLAG_0;
this->timer = gSaveContext.powderKegTimer;
} else {
this->timer = 70;
@ -188,7 +188,7 @@ void EnBom_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyJntSph(play, &this->collider2);
Collider_DestroyCylinder(play, &this->collider1);
if (this->isPowderKeg) {
play->actorCtx.unk5 &= ~1;
play->actorCtx.flags &= ~ACTORCTX_FLAG_0;
}
}

View File

@ -604,7 +604,7 @@ void EnBox_Update(Actor* thisx, PlayState* play) {
EnBox_ClipToGround(this, play);
}
if ((this->getItemId == GI_STRAY_FAIRY) && !Flags_GetTreasure(play, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) {
play->actorCtx.unk5 |= 8;
play->actorCtx.flags |= ACTORCTX_FLAG_3;
}
this->actionFunc(this, play);
if (this->movementFlags & ENBOX_MOVE_0x80) {

View File

@ -263,7 +263,7 @@ void EnElforg_MoveToTarget(EnElforg* this, Vec3f* targetPos) {
}
void func_80ACCBB8(EnElforg* this, PlayState* play) {
play->actorCtx.unk5 |= 8;
play->actorCtx.flags |= ACTORCTX_FLAG_3;
}
void EnElforg_TrappedByBubble(EnElforg* this, PlayState* play) {

View File

@ -279,7 +279,7 @@ void EnFall_Setup(EnFall* this, PlayState* play) {
this->actor.draw = NULL;
this->actionFunc = EnFall_MoonsTear_Fall;
Actor_SetScale(&this->actor, 0.02f);
if (!(play->actorCtx.unk5 & 2)) {
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
Actor_MarkForDeath(&this->actor);
}
moon = EnFall_MoonsTear_GetTerminaFieldMoon(play);

View File

@ -963,7 +963,8 @@ s32 func_8094F53C(EnGm* this, PlayState* play) {
this->unk_18C(this, play);
}
if ((this->unk_3E8 == 6) && !(play->actorCtx.unk5 & 0x20) && Animation_OnFrame(&this->skelAnime, 20.0f)) {
if ((this->unk_3E8 == 6) && !(play->actorCtx.flags & ACTORCTX_FLAG_5) &&
Animation_OnFrame(&this->skelAnime, 20.0f)) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_HANKO);
}

View File

@ -987,7 +987,7 @@ Actor* func_80A13400(EnGo* this, PlayState* play) {
}
void func_80A134B0(EnGo* this, PlayState* play, s32 arg2) {
if ((gSaveContext.save.weekEventReg[18] & 0x80) || (play->actorCtx.unk5 & 1) || arg2) {
if ((gSaveContext.save.weekEventReg[18] & 0x80) || (play->actorCtx.flags & ACTORCTX_FLAG_0) || arg2) {
this->colliderSphere.dim.modelSphere.radius = 300;
} else {
this->colliderSphere.dim.modelSphere.radius = 380;

View File

@ -346,7 +346,7 @@ void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) {
EnKakasi_SetupDialogue(this);
return;
}
if (play->actorCtx.unk5 & 0x4) {
if (play->actorCtx.flags & ACTORCTX_FLAG_2) {
Actor_GetScreenPos(play, &this->picto.actor, &x, &y);
if (this->picto.actor.projectedPos.z > -20.0f && x > 0 && x < SCREEN_WIDTH && y > 0 && y < SCREEN_HEIGHT &&
this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) {

View File

@ -52,7 +52,7 @@ void EnScopecoin_Init(Actor* thisx, PlayState* play) {
this->unk148 = 0;
}
if (play->actorCtx.unk5 & 2) {
if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
if (this->unk148 == 2 || this->unk148 == 6) {
if (Flags_GetCollectible(play, (this->actor.params & 0x7F0) >> 4)) {
Actor_MarkForDeath(&this->actor);

View File

@ -300,7 +300,7 @@ void EnScopecrow_Init(Actor* thisx, PlayState* play) {
return;
}
if (play->actorCtx.unk5 & 2) {
if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
SkelAnime_InitFlex(play, &this->skelAnime, &gGuaySkel, &gGuayFlyAnim, this->jointTable, this->morphTable,
OBJECT_CROW_LIMB_MAX);
ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f);

View File

@ -707,7 +707,7 @@ void EnScopenuts_Init(Actor* thisx, PlayState* play) {
if (ENSCOPENUTS_GET_3E0(&this->actor) == ENSCOPENUTS_3E0_0) {
if (gSaveContext.save.weekEventReg[52] & 0x40) {
Actor_MarkForDeath(&this->actor);
} else if (play->actorCtx.unk5 & 2) {
} else if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
this->path = SubS_GetPathByIndex(play, ENSCOPENUTS_GET_FC00(&this->actor), 0x3F);
this->actor.draw = NULL;
this->actionFunc = func_80BCAFA8;

View File

@ -103,7 +103,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) {
switch (ENSTH_GET_F(&this->actor)) {
case ENSTH_F_1:
if (play->actorCtx.unk5 & 2) {
if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
this->actor.flags |= (ACTOR_FLAG_10 | ACTOR_FLAG_20);
this->actionFunc = func_80B67958;
} else {

View File

@ -40,7 +40,7 @@ void EnSth2_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f);
this->unused = 0;
if (play->actorCtx.unk5 & 2) {
if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
this->actor.flags |= (ACTOR_FLAG_10 | ACTOR_FLAG_20);
} else {
Actor_MarkForDeath(&this->actor);

View File

@ -48,8 +48,8 @@ static s16 sCurrentCs;
void func_80A41D70(EnTest4* this, PlayState* play) {
if (this->unk_144 != 0) {
func_80151A68(play, sNightMessages1[CURRENT_DAY - 1]);
} else if ((sCutscenes[this->unk_144] < 0) || ((play->actorCtx.unk5 & 2) != 0)) {
if (play->actorCtx.unk5 & 2) {
} else if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) {
if (play->actorCtx.flags & ACTORCTX_FLAG_1) {
Sram_IncrementDay();
gSaveContext.save.time = CLOCK_TIME(6, 0);
func_80151A68(play, sDayMessages1[CURRENT_DAY - 1]);
@ -66,7 +66,7 @@ void func_80A41D70(EnTest4* this, PlayState* play) {
}
if (gSaveContext.cutsceneTrigger == 0) {
if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.unk5 & 2)) {
if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
this->actionFunc = func_80A42F20;
sCurrentCs = sCutscenes[this->unk_144];
this->transitionCsTimer = 0;
@ -91,7 +91,7 @@ void func_80A41D70(EnTest4* this, PlayState* play) {
void func_80A41FA4(EnTest4* this, PlayState* play) {
if (this->unk_144 != 0) {
func_80151A68(play, sNightMessages2[CURRENT_DAY - 1]);
} else if ((sCutscenes[this->unk_144] < 0) || ((play->actorCtx.unk5 & 2) != 0)) {
} else if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) {
Sram_IncrementDay();
gSaveContext.save.time = CLOCK_TIME(6, 0);
func_8010EE74(play, CURRENT_DAY);
@ -103,7 +103,7 @@ void func_80A41FA4(EnTest4* this, PlayState* play) {
}
if (gSaveContext.cutsceneTrigger == 0) {
if ((sCutscenes[this->unk_144] >= 0) && ((play->actorCtx.unk5 & 2) == 0)) {
if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
this->actionFunc = func_80A42F20;
sCurrentCs = sCutscenes[this->unk_144];
this->transitionCsTimer = 0;
@ -277,7 +277,7 @@ void func_80A425E4(EnTest4* this, PlayState* play) {
this->nextBellTime = CLOCK_TIME(17, 30);
}
if ((sCutscenes[this->unk_144] < 0) || ((play->actorCtx.unk5 & 2) != 0) || (CURRENT_DAY == 3) ||
if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1) || (CURRENT_DAY == 3) ||
(gSaveContext.save.time >= CLOCK_TIME(17, 0))) {
gSaveContext.screenScale = 1000.0f;
}
@ -335,7 +335,8 @@ void EnTest4_Init(Actor* thisx, PlayState* play) {
} else if (gSaveContext.save.time == CLOCK_TIME(6, 0)) {
this->unk_144 = 0;
func_80A41D70(this, play);
if ((gSaveContext.cutsceneTrigger == 0) && (sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.unk5 & 2)) {
if ((gSaveContext.cutsceneTrigger == 0) && (sCutscenes[this->unk_144] >= 0) &&
!(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
player->stateFlags1 |= 0x200;
}
} else {
@ -356,7 +357,7 @@ void EnTest4_Init(Actor* thisx, PlayState* play) {
}
this->lastBellTime = gSaveContext.save.time;
if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.unk5 & 2)) {
if ((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) {
gSaveContext.screenScaleFlag = 0;
gSaveContext.screenScale = 1000.0f;
}
@ -383,8 +384,8 @@ void func_80A42AB8(EnTest4* this, PlayState* play) {
if ((temp_a3 * temp_a2) <= 0) {
gSaveContext.unk_3CA7 = 1;
if (play->actorCtx.unk5 & 0x4) {
play->actorCtx.unk5 &= ~0x4;
if (play->actorCtx.flags & ACTORCTX_FLAG_2) {
play->actorCtx.flags &= ~ACTORCTX_FLAG_2;
}
if (temp_a0 != CLOCK_TIME(6, 0)) {
@ -394,7 +395,8 @@ void func_80A42AB8(EnTest4* this, PlayState* play) {
func_8011C808(play);
Actor_MarkForDeath(&this->actor);
gSaveContext.eventInf[1] |= 0x80;
} else if (((sCutscenes[this->unk_144] < 0) || (play->actorCtx.unk5 & 2)) && CURRENT_DAY != 3) {
} else if (((sCutscenes[this->unk_144] < 0) || (play->actorCtx.flags & ACTORCTX_FLAG_1)) &&
(CURRENT_DAY != 3)) {
func_80A41FA4(this, play);
} else {
gSaveContext.screenScale = 0.0f;
@ -419,7 +421,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) {
}
}
if ((sCutscenes[this->unk_144] >= 0) && ((play->actorCtx.unk5 & 2) == 0)) {
if ((sCutscenes[this->unk_144] >= 0) && !(play->actorCtx.flags & ACTORCTX_FLAG_1)) {
player->stateFlags1 |= 0x200;
this->unk_146 = gSaveContext.save.time;
} else {
@ -442,7 +444,7 @@ void func_80A42AB8(EnTest4* this, PlayState* play) {
s32 playerParams;
u32 entrance = gSaveContext.save.entrance;
if ((play->actorCtx.unk5 & 2)) {
if ((play->actorCtx.flags & ACTORCTX_FLAG_1)) {
playerParams = 0xCFF;
} else {
playerParams = 0xBFF;

View File

@ -315,7 +315,7 @@ void func_80BA3D38(EnToto* this, PlayState* play) {
this->cutscene = this->actor.cutscene;
this->text = ENTOTO_WEEK_EVENT_FLAGS ? D_80BA50BC : D_80BA5088;
func_80BA4C0C(this, play);
play->actorCtx.unk5 |= 0x20;
play->actorCtx.flags |= ACTORCTX_FLAG_5;
this->unk260[0] = 0;
}
@ -344,7 +344,7 @@ void func_80BA3DBC(EnToto* this, PlayState* play) {
func_80BA36C0(this, play, 0);
ActorCutscene_Stop(this->cutscene);
play->actorCtx.unk5 &= ~0x20;
play->actorCtx.flags &= ~ACTORCTX_FLAG_5;
}
s32 func_80BA3EC0(EnToto* this, PlayState* play) {

View File

@ -352,7 +352,7 @@ void func_80966FEC(EnWeatherTag* this, PlayState* play) {
}
// unique pirates fortress behavior?
if ((play->sceneNum == SCENE_KAIZOKU) && (play->actorCtx.unk5 & 2)) {
if ((play->sceneNum == SCENE_KAIZOKU) && (play->actorCtx.flags & ACTORCTX_FLAG_1)) {
EnWeatherTag_SetupAction(this, func_80967060);
}
}
@ -482,9 +482,10 @@ void EnWeatherTag_Update(Actor* thisx, PlayState* play) {
EnWeatherTag* this = THIS;
this->actionFunc(this, play);
if ((play->actorCtx.unk5 & 2) && (play->msgCtx.msgMode != 0) && (play->msgCtx.currentTextId == 0x5E6) &&
(!FrameAdvance_IsEnabled(&play->state)) && (play->transitionTrigger == TRANS_TRIGGER_OFF) &&
(ActorCutscene_GetCurrentIndex() == -1) && (play->csCtx.state == 0)) {
if ((play->actorCtx.flags & ACTORCTX_FLAG_1) && (play->msgCtx.msgMode != 0) &&
(play->msgCtx.currentTextId == 0x5E6) && !FrameAdvance_IsEnabled(&play->state) &&
(play->transitionTrigger == TRANS_TRIGGER_OFF) && (ActorCutscene_GetCurrentIndex() == -1) &&
(play->csCtx.state == 0)) {
gSaveContext.save.time = ((void)0, gSaveContext.save.time) + (u16)REG(15);
if (REG(15) != 0) {

View File

@ -545,7 +545,7 @@ void ObjComb_Update(Actor* thisx, PlayState* play) {
}
if (this->unk_1B7 != 0) {
play->actorCtx.unk5 |= 8;
play->actorCtx.flags |= ACTORCTX_FLAG_3;
this->actor.flags |= ACTOR_FLAG_10;
}
}

View File

@ -228,7 +228,7 @@ void ObjKibako2_Update(Actor* thisx, PlayState* play) {
ObjKibako2* this = THIS;
if (this->unk_1AC != 0) {
play->actorCtx.unk5 |= 8;
play->actorCtx.flags |= ACTORCTX_FLAG_3;
}
if (this->skulltulaNoiseTimer >= 0) {

View File

@ -164,14 +164,14 @@ void func_80BA2790(ObjNozoki* this) {
}
void func_80BA27C4(ObjNozoki* this, PlayState* play) {
if (!(play->actorCtx.unk5 & 0x20)) {
if (!(play->actorCtx.flags & ACTORCTX_FLAG_5)) {
if (OBJNOZOKI_GET_200(&this->dyna.actor)) {
if (!func_80BA2708(this, play)) {
return;
}
} else {
if (D_80BA36B0 != 0) {
play->actorCtx.unk5 |= 0x80;
play->actorCtx.flags |= ACTORCTX_FLAG_7;
}
if (!Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) {
@ -189,7 +189,7 @@ void func_80BA27C4(ObjNozoki* this, PlayState* play) {
if (this->unk_15E < 0) {
this->unk_15E = 50;
}
play->actorCtx.unk5 |= 0x10;
play->actorCtx.flags |= ACTORCTX_FLAG_4;
}
}
GET_PLAYER(play)->linearVelocity = 0.0f;
@ -204,7 +204,7 @@ void func_80BA28DC(ObjNozoki* this, PlayState* play) {
return;
}
if (!(play->actorCtx.unk5 & 0x20)) {
if (!(play->actorCtx.flags & ACTORCTX_FLAG_5)) {
Math_StepToF(&this->dyna.actor.velocity.y, 15.0f, 3.0f);
Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, this->dyna.actor.velocity.y);
@ -250,7 +250,7 @@ void func_80BA2AB4(ObjNozoki* this, PlayState* play) {
D_80BA36B0 = 1;
}
if (!(play->actorCtx.unk5 & 0x20)) {
if (!(play->actorCtx.flags & ACTORCTX_FLAG_5)) {
if (!(OBJNOZOKI_GET_200(&this->dyna.actor)) &&
Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) {
func_80BA2790(this);
@ -316,7 +316,7 @@ void func_80BA2C94(ObjNozoki* this, PlayState* play) {
Math_StepToF(&this->dyna.actor.speedXZ, D_80BA34E4[this->unk_15D], 0.1f);
if ((play->actorCtx.unk5 & 0x40) || (play->actorCtx.unk5 & 0x20)) {
if ((play->actorCtx.flags & ACTORCTX_FLAG_6) || (play->actorCtx.flags & ACTORCTX_FLAG_5)) {
temp_f0 = 0.5f;
} else {
temp_f0 = this->dyna.actor.speedXZ;
@ -326,20 +326,20 @@ void func_80BA2C94(ObjNozoki* this, PlayState* play) {
D_80BA36B8 += this->dyna.actor.speedXZ;
if (play->actorCtx.unk5 & 0x40) {
if (play->actorCtx.flags & ACTORCTX_FLAG_6) {
if (sp34 <= 5.0f) {
Actor_MarkForDeath(&this->dyna.actor);
}
} else if (!(play->actorCtx.unk5 & 0x20) && (GET_PLAYER(play)->actor.id == ACTOR_PLAYER) &&
} else if (!(play->actorCtx.flags & ACTORCTX_FLAG_5) && (GET_PLAYER(play)->actor.id == ACTOR_PLAYER) &&
Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG2(&this->dyna.actor)) && (sp38 < 20.0f)) {
static Vec3f D_80BA34F0 = { 0.0f, 0.0f, 50.0f };
play->actorCtx.unk5 |= 0x40;
play->actorCtx.flags |= ACTORCTX_FLAG_6;
Lib_Vec3f_TranslateAndRotateY(&this->dyna.actor.home.pos, this->dyna.actor.shape.rot.y, &D_80BA34F0,
&this->dyna.actor.world.pos);
this->dyna.actor.shape.rot.x = -0x1F40;
} else if (sp34 < 50.0f) {
play->actorCtx.unk5 |= 0x20;
play->actorCtx.flags |= ACTORCTX_FLAG_5;
if (sp34 < 20.0f) {
this->dyna.actor.velocity.y -= 0.4f;
@ -369,11 +369,11 @@ void func_80BA3044(ObjNozoki* this, PlayState* play) {
Vec3f* sp1C = &this->dyna.actor.focus.pos;
if (this->unk_15D == 0) {
if (play->actorCtx.unk5 & 0x40) {
if (play->actorCtx.flags & ACTORCTX_FLAG_6) {
this->unk_15D = 1;
this->unk_15E = 20;
Math_Vec3f_Copy(&this->dyna.actor.world.pos, sp1C);
} else if (!(play->actorCtx.unk5 & 0x20) &&
} else if (!(play->actorCtx.flags & ACTORCTX_FLAG_5) &&
Flags_GetSwitch(play, OBJNOZOKI_GET_SWITCHFLAG1(&this->dyna.actor))) {
sp1C = &this->dyna.actor.home.pos;
}

View File

@ -296,7 +296,7 @@ void ObjSwitch_FloorSwitchSnapPlayerToSwitchEdge(ObjSwitch* this, PlayState* pla
s16 yaw;
f32 cos;
if (play->actorCtx.unk5 & 0x80) {
if (play->actorCtx.flags & ACTORCTX_FLAG_7) {
player = GET_PLAYER(play);
// compute yawTowardsPlayer relative to model space
yaw = BINANG_SUB(this->dyna.actor.yawTowardsPlayer, this->dyna.actor.shape.rot.y);

View File

@ -310,7 +310,7 @@ void ObjTaru_Update(Actor* thisx, PlayState* play) {
if (!OBJ_TARU_GET_80(thisx)) {
if (this->unk_1AC != 0) {
play->actorCtx.unk5 |= 8;
play->actorCtx.flags |= ACTORCTX_FLAG_3;
}
if (this->unk_1AD >= 0) {
switch (this->unk_1AD) {

View File

@ -701,7 +701,7 @@ void ObjTokeidai_TowerClock_Idle(ObjTokeidai* this, PlayState* play) {
this->clockTime += 3;
this->actor.draw = ObjTokeidai_Clock_Draw;
} else {
if (!(play->actorCtx.unk5 & 2) &&
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) &&
OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_TOWER_CLOCK_TERMINA_FIELD &&
ActorCutscene_GetCurrentIndex() == -1) {
this->actor.draw = NULL;
@ -734,9 +734,9 @@ void ObjTokeidai_ExteriorGear_Idle(ObjTokeidai* this, PlayState* play) {
this->clockTime += 3;
this->actor.draw = ObjTokeidai_ExteriorGear_Draw;
} else {
if ((play->actorCtx.unk5 & 2) == 0 &&
OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_EXTERIOR_GEAR_TERMINA_FIELD &&
ActorCutscene_GetCurrentIndex() == -1) {
if (!(play->actorCtx.flags & ACTORCTX_FLAG_1) &&
(OBJ_TOKEIDAI_TYPE(&this->actor) == OBJ_TOKEIDAI_TYPE_EXTERIOR_GEAR_TERMINA_FIELD) &&
(ActorCutscene_GetCurrentIndex() == -1)) {
this->actor.draw = NULL;
}
this->clockTime = gSaveContext.save.time;

View File

@ -665,7 +665,7 @@ void ObjTsubo_Update(Actor* thisx, PlayState* play) {
}
if (!this->unk_197) {
if (this->unk_198) {
play->actorCtx.unk5 |= 8;
play->actorCtx.flags |= ACTORCTX_FLAG_3;
this->actor.flags |= ACTOR_FLAG_10;
}
if (this->unk_19A >= 0) {

View File

@ -707,6 +707,8 @@ wordReplace = {
"globalCtx->envCtx.unk_DC": "play->envCtx.lightBlend",
"globalCtx->interfaceCtx.unk_21E": "play->interfaceCtx.bButtonDoAction",
# "play->actorCtx.flags": "play->actorCtx.sceneFlags",
# "play->actorCtx.unk5": "play->actorCtx.flags",
"play->msgCtx.unk11F04": "play->msgCtx.currentTextId",
"play->msgCtx.unk11F10": "play->msgCtx.msgLength",
"play->msgCtx.unk11F22": "play->msgCtx.msgMode",