1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 23:14:37 +00:00

Use defines for actor flags (#873)

* Add ACTOR_FLAG_ defines

* Add ACTOR_FLAGS_ALL macro and use ACTOR_FLAG_* constants everywhere

* Remove unused ACTOR_FLAG_* constants

* actor flags in bigokuta & ko

* actor flags in obj_mure

* actor flags in stalfos, twinrova & ganon2

* actor flags in morpha & barinade

* name some previously missed actor flags

* found some comments using hex for actor flags

* Actor flags in ovl_En_Ganon_Mant

* Actor flags in EnWf

* Flags in en_zf

* Actor flags in BossGanon (FeelsOKMan)

* Remove `ACTOR_FLAG_NONE`

* Wrap expansion of `FLAGS` in parentheses

* `ACTOR_FLAGS_ALL` -> `CHECK_FLAG_ALL`

* Move `CHECK_FLAG_ALL` to `macros.h`

* Run formatter
This commit is contained in:
Dragorn421 2021-12-06 01:11:38 +01:00 committed by GitHub
parent 79220ba58a
commit a9284494f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
439 changed files with 1342 additions and 1304 deletions

View file

@ -391,7 +391,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) {
}
actor = targetCtx->unk_94;
if ((actor != NULL) && !(actor->flags & 0x8000000)) {
if ((actor != NULL) && !(actor->flags & ACTOR_FLAG_27)) {
NaviColor* naviColor = &sNaviColorList[actor->category];
POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x7);
@ -484,7 +484,8 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Gl
targetCtx->unk_48 = 0;
}
lockOnSfxId = ((actorArg->flags & 5) == 5) ? NA_SE_SY_LOCK_ON : NA_SE_SY_LOCK_ON_HUMAN;
lockOnSfxId = CHECK_FLAG_ALL(actorArg->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) ? NA_SE_SY_LOCK_ON
: NA_SE_SY_LOCK_ON_HUMAN;
func_80078884(lockOnSfxId);
}
@ -762,7 +763,7 @@ s32 func_8002D53C(GlobalContext* globalCtx, TitleCardContext* titleCtx) {
void Actor_Kill(Actor* actor) {
actor->draw = NULL;
actor->update = NULL;
actor->flags &= ~0x1;
actor->flags &= ~ACTOR_FLAG_0;
}
void Actor_SetWorldToHome(Actor* actor) {
@ -999,8 +1000,8 @@ void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) {
hookshot->grabbedDistDiff.x = 0.0f;
hookshot->grabbedDistDiff.y = 0.0f;
hookshot->grabbedDistDiff.z = 0.0f;
actorB->flags |= 0x2000;
actorA->flags &= ~0x2000;
actorB->flags |= ACTOR_FLAG_13;
actorA->flags &= ~ACTOR_FLAG_13;
}
void func_8002DE74(GlobalContext* globalCtx, Player* player) {
@ -1435,7 +1436,7 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) {
s16 yawTempAbs = ABS(yawTemp);
if (player->unk_664 != NULL) {
if ((yawTempAbs > 0x4000) || (actor->flags & 0x8000000)) {
if ((yawTempAbs > 0x4000) || (actor->flags & ACTOR_FLAG_27)) {
return FLT_MAX;
} else {
f32 ret =
@ -1471,7 +1472,7 @@ u32 func_8002F090(Actor* actor, f32 arg1) {
}
s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) {
if ((actor->update == NULL) || !(actor->flags & 1)) {
if ((actor->update == NULL) || !(actor->flags & ACTOR_FLAG_0)) {
return true;
}
@ -1493,8 +1494,8 @@ s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) {
}
u32 Actor_ProcessTalkRequest(Actor* actor, GlobalContext* globalCtx) {
if (actor->flags & 0x100) {
actor->flags &= ~0x100;
if (actor->flags & ACTOR_FLAG_8) {
actor->flags &= ~ACTOR_FLAG_8;
return true;
}
@ -1505,7 +1506,7 @@ s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u3
Player* player = GET_PLAYER(globalCtx);
// This is convoluted but it seems like it must be a single if statement to match
if ((player->actor.flags & 0x100) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(globalCtx)) ||
if ((player->actor.flags & ACTOR_FLAG_8) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(globalCtx)) ||
(!actor->isTargeted &&
((arg3 < fabsf(actor->yDistToPlayer)) || (player->targetActorDistance < actor->xzDistToPlayer) ||
(arg2 < actor->xzDistToPlayer)))) {
@ -1708,30 +1709,30 @@ void func_8002F850(GlobalContext* globalCtx, Actor* actor) {
void func_8002F8F0(Actor* actor, u16 sfxId) {
actor->sfx = sfxId;
actor->flags |= 0x80000;
actor->flags &= ~0x10300000;
actor->flags |= ACTOR_FLAG_19;
actor->flags &= ~(ACTOR_FLAG_20 | ACTOR_FLAG_21 | ACTOR_FLAG_28);
}
void func_8002F91C(Actor* actor, u16 sfxId) {
actor->sfx = sfxId;
actor->flags |= 0x100000;
actor->flags &= ~0x10280000;
actor->flags |= ACTOR_FLAG_20;
actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_21 | ACTOR_FLAG_28);
}
void func_8002F948(Actor* actor, u16 sfxId) {
actor->sfx = sfxId;
actor->flags |= 0x200000;
actor->flags &= ~0x10180000;
actor->flags |= ACTOR_FLAG_21;
actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_20 | ACTOR_FLAG_28);
}
void func_8002F974(Actor* actor, u16 sfxId) {
actor->flags &= ~0x10380000;
actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_20 | ACTOR_FLAG_21 | ACTOR_FLAG_28);
actor->sfx = sfxId;
}
void func_8002F994(Actor* actor, s32 arg1) {
actor->flags |= 0x10000000;
actor->flags &= ~0x00380000;
actor->flags |= ACTOR_FLAG_28;
actor->flags &= ~(ACTOR_FLAG_19 | ACTOR_FLAG_20 | ACTOR_FLAG_21);
if (arg1 < 40) {
actor->sfx = NA_SE_PL_WALK_DIRT - SFX_FLAG;
} else if (arg1 < 100) {
@ -2029,7 +2030,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) {
sp80 = &D_80116068[0];
if (player->stateFlags2 & 0x8000000) {
unkFlag = 0x2000000;
unkFlag = ACTOR_FLAG_25;
}
if ((player->stateFlags1 & 0x40) && ((player->actor.textId & 0xFF00) != 0x600)) {
@ -2076,9 +2077,9 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) {
actor->xyzDistToPlayerSq = SQ(actor->xzDistToPlayer) + SQ(actor->yDistToPlayer);
actor->yawTowardsPlayer = Actor_WorldYawTowardActor(actor, &player->actor);
actor->flags &= ~0x1000000;
actor->flags &= ~ACTOR_FLAG_24;
if ((DECR(actor->freezeTimer) == 0) && (actor->flags & 0x50)) {
if ((DECR(actor->freezeTimer) == 0) && (actor->flags & (ACTOR_FLAG_4 | ACTOR_FLAG_6))) {
if (actor == player->unk_664) {
actor->isTargeted = true;
} else {
@ -2160,10 +2161,10 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) {
lights = LightContext_NewLights(&globalCtx->lightCtx, globalCtx->state.gfxCtx);
Lights_BindAll(lights, globalCtx->lightCtx.listHead, (actor->flags & 0x400000) ? NULL : &actor->world.pos);
Lights_BindAll(lights, globalCtx->lightCtx.listHead, (actor->flags & ACTOR_FLAG_22) ? NULL : &actor->world.pos);
Lights_Draw(lights, globalCtx->state.gfxCtx);
if (actor->flags & 0x1000) {
if (actor->flags & ACTOR_FLAG_12) {
func_800D1694(actor->world.pos.x + globalCtx->mainCamera.skyboxOffset.x,
actor->world.pos.y +
(f32)((actor->shape.yOffset * actor->scale.y) + globalCtx->mainCamera.skyboxOffset.y),
@ -2217,13 +2218,13 @@ void Actor_Draw(GlobalContext* globalCtx, Actor* actor) {
}
void func_80030ED8(Actor* actor) {
if (actor->flags & 0x80000) {
if (actor->flags & ACTOR_FLAG_19) {
Audio_PlaySoundGeneral(actor->sfx, &actor->projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
} else if (actor->flags & 0x100000) {
} else if (actor->flags & ACTOR_FLAG_20) {
func_80078884(actor->sfx);
} else if (actor->flags & 0x200000) {
} else if (actor->flags & ACTOR_FLAG_21) {
func_800788CC(actor->sfx);
} else if (actor->flags & 0x10000000) {
} else if (actor->flags & ACTOR_FLAG_28) {
func_800F4C58(&D_801333D4, NA_SE_SY_TIMER - SFX_FLAG, (s8)(actor->sfx - 1));
} else {
func_80078914(&actor->projectedPos, actor->sfx);
@ -2372,17 +2373,17 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) {
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) {
if (func_800314B0(globalCtx, actor)) {
actor->flags |= 0x40;
actor->flags |= ACTOR_FLAG_6;
} else {
actor->flags &= ~0x40;
actor->flags &= ~ACTOR_FLAG_6;
}
}
actor->isDrawn = false;
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) {
if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & 0x60)) {
if ((actor->flags & 0x80) &&
if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & (ACTOR_FLAG_5 | ACTOR_FLAG_6))) {
if ((actor->flags & ACTOR_FLAG_7) &&
((globalCtx->roomCtx.curRoom.showInvisActors == 0) || (globalCtx->actorCtx.unk_03 != 0) ||
(actor->room != globalCtx->roomCtx.curRoom.num))) {
ASSERT(invisibleActorCounter < INVISIBLE_ACTOR_MAX,
@ -2889,11 +2890,11 @@ void func_800328D4(GlobalContext* globalCtx, ActorContext* actorCtx, Player* pla
sp84 = player->unk_664;
while (actor != NULL) {
if ((actor->update != NULL) && ((Player*)actor != player) && ((actor->flags & 1) == 1)) {
if ((actor->update != NULL) && ((Player*)actor != player) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0)) {
// This block below is for determining the closest actor to player in determining the volume
// used while playing enemy bgm music
if ((actorCategory == ACTORCAT_ENEMY) && ((actor->flags & 5) == 5) &&
if ((actorCategory == ACTORCAT_ENEMY) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_0 | ACTOR_FLAG_2) &&
(actor->xyzDistToPlayerSq < SQ(500.0f)) && (actor->xyzDistToPlayerSq < sbgmEnemyDistSq)) {
actorCtx->targetCtx.bgmEnemy = actor;
sbgmEnemyDistSq = actor->xyzDistToPlayerSq;
@ -3845,10 +3846,10 @@ s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) {
}
if (arg3 < var) {
actor->flags &= ~1;
actor->flags &= ~ACTOR_FLAG_0;
Math_SmoothStepToS(&arg2, 0, 6, 0x14, 1);
} else {
actor->flags |= 1;
actor->flags |= ACTOR_FLAG_0;
Math_SmoothStepToS(&arg2, 0xFF, 6, 0x14, 1);
}