diff --git a/include/z64actor.h b/include/z64actor.h index 19ac9455ba..044ae80eb1 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -129,6 +129,17 @@ typedef struct { #define ACTOR_FLAG_27 (1 << 27) #define ACTOR_FLAG_28 (1 << 28) +#define BGCHECKFLAG_GROUND (1 << 0) // Standing on the ground +#define BGCHECKFLAG_GROUND_TOUCH (1 << 1) // Has touched the ground (only active for 1 frame) +#define BGCHECKFLAG_GROUND_LEAVE (1 << 2) // Has left the ground (only active for 1 frame) +#define BGCHECKFLAG_WALL (1 << 3) // Touching a wall +#define BGCHECKFLAG_CEILING (1 << 4) // Touching a ceiling +#define BGCHECKFLAG_WATER (1 << 5) // In water +#define BGCHECKFLAG_WATER_TOUCH (1 << 6) // Has touched water (reset when leaving water) +#define BGCHECKFLAG_GROUND_STRICT (1 << 7) // Strictly on ground (BGCHECKFLAG_GROUND has some leeway) +#define BGCHECKFLAG_CRUSHED (1 << 8) // Crushed between a floor and ceiling (triggers a void for player) +#define BGCHECKFLAG_PLAYER_WALL_INTERACT (1 << 9) // Only set/used by player, related to interacting with walls + typedef struct Actor { /* 0x000 */ s16 id; // Actor ID /* 0x002 */ u8 category; // Actor category. Refer to the corresponding enum for values @@ -154,7 +165,7 @@ typedef struct Actor { /* 0x07E */ s16 wallYaw; // Y rotation of the wall polygon the actor is touching /* 0x080 */ f32 floorHeight; // Y position of the floor polygon directly below the actor /* 0x084 */ f32 yDistToWater; // Distance to the surface of active waterbox. Negative value means above water - /* 0x088 */ u16 bgCheckFlags; // See comments below actor struct for wip docs. TODO: macros for these flags + /* 0x088 */ u16 bgCheckFlags; // Flags indicating how the actor is interacting with collision /* 0x08A */ s16 yawTowardsPlayer; // Y rotation difference between the actor and the player /* 0x08C */ f32 xyzDistToPlayerSq; // Squared distance between the actor and the player in the x,y,z axis /* 0x090 */ f32 xzDistToPlayer; // Distance between the actor and the player in the XZ plane @@ -193,20 +204,6 @@ typedef enum { /* 1 */ FOOT_RIGHT } ActorFootIndex; -/* -BgCheckFlags WIP documentation: -& 0x001 : Standing on the ground -& 0x002 : Has touched the ground (only active for 1 frame) -& 0x004 : Has left the ground (only active for 1 frame) -& 0x008 : Touching a wall -& 0x010 : Touching a ceiling -& 0x020 : On or below water surface -& 0x040 : Has touched water (actor is responsible for unsetting this the frame it touches the water) -& 0x080 : Similar to & 0x1 but with no velocity check and is cleared every frame -& 0x100 : Crushed between a floor and ceiling (triggers a void for player) -& 0x200 : Unknown (only set/used by player so far) -*/ - /* colorFilterParams WIP documentation & 0x8000 : white diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 112ff7db85..5cdb8b2938 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -188,7 +188,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, GlobalContext* globalCtx floorHeightPtr++; } - if (!(actor->bgCheckFlags & 1)) { + if (!(actor->bgCheckFlags & BGCHECKFLAG_GROUND)) { actor->shape.feetFloorFlags = 0; } else if (actor->shape.feetFloorFlags == 3) { f32 footDistY = actor->shape.feetPos[FOOT_LEFT].y - actor->shape.feetPos[FOOT_RIGHT].y; @@ -1153,9 +1153,9 @@ s32 Actor_ActorAIsFacingAndNearActorB(Actor* actorA, Actor* actorB, f32 range, s } s32 func_8002E234(Actor* actor, f32 arg1, s32 arg2) { - if ((actor->bgCheckFlags & 0x1) && (arg1 < -11.0f)) { - actor->bgCheckFlags &= ~0x1; - actor->bgCheckFlags |= 0x4; + if ((actor->bgCheckFlags & BGCHECKFLAG_GROUND) && (arg1 < -11.0f)) { + actor->bgCheckFlags &= ~BGCHECKFLAG_GROUND; + actor->bgCheckFlags |= BGCHECKFLAG_GROUND_LEAVE; if ((actor->velocity.y < 0.0f) && (arg2 & 0x10)) { actor->velocity.y = 0.0f; @@ -1175,7 +1175,7 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) actor->floorHeight = BgCheck_EntityRaycastFloor5(globalCtx, &globalCtx->colCtx, &actor->floorPoly, &floorBgId, actor, arg2); - actor->bgCheckFlags &= ~0x0086; + actor->bgCheckFlags &= ~(BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_GROUND_LEAVE | BGCHECKFLAG_GROUND_STRICT); if (actor->floorHeight <= BGCHECK_Y_MIN) { return func_8002E234(actor, BGCHECK_Y_MIN, arg3); @@ -1185,12 +1185,12 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) actor->floorBgId = floorBgId; if (floorHeightDiff >= 0.0f) { // actor is on or below the ground - actor->bgCheckFlags |= 0x80; + actor->bgCheckFlags |= BGCHECKFLAG_GROUND_STRICT; - if (actor->bgCheckFlags & 0x10) { + if (actor->bgCheckFlags & BGCHECKFLAG_CEILING) { if (floorBgId != sCurCeilingBgId) { if (floorHeightDiff > 15.0f) { - actor->bgCheckFlags |= 0x100; + actor->bgCheckFlags |= BGCHECKFLAG_CRUSHED; } } else { actor->world.pos.x = actor->prevPos.x; @@ -1201,19 +1201,19 @@ s32 func_8002E2AC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, s32 arg3) actor->world.pos.y = actor->floorHeight; if (actor->velocity.y <= 0.0f) { - if (!(actor->bgCheckFlags & 0x1)) { - actor->bgCheckFlags |= 0x2; + if (!(actor->bgCheckFlags & BGCHECKFLAG_GROUND)) { + actor->bgCheckFlags |= BGCHECKFLAG_GROUND_TOUCH; } else if ((arg3 & 0x8) && (actor->gravity < 0.0f)) { actor->velocity.y = -4.0f; } else { actor->velocity.y = 0.0f; } - actor->bgCheckFlags |= 0x1; + actor->bgCheckFlags |= BGCHECKFLAG_GROUND; func_80043334(&globalCtx->colCtx, actor, actor->floorBgId); } } else { // actor is above ground - if ((actor->bgCheckFlags & 0x1) && (floorHeightDiff >= -11.0f)) { + if ((actor->bgCheckFlags & BGCHECKFLAG_GROUND) && (floorHeightDiff >= -11.0f)) { func_80043334(&globalCtx->colCtx, actor, actor->floorBgId); } @@ -1237,7 +1237,7 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe sp74 = actor->world.pos.y - actor->prevPos.y; - if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & 1)) { + if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & BGCHECKFLAG_GROUND)) { func_800433A4(&globalCtx->colCtx, actor->floorBgId, actor); } @@ -1251,10 +1251,10 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe wallPoly = actor->wallPoly; Math_Vec3f_Copy(&actor->world.pos, &sp64); actor->wallYaw = Math_Atan2S(wallPoly->normal.z, wallPoly->normal.x); - actor->bgCheckFlags |= 8; + actor->bgCheckFlags |= BGCHECKFLAG_WALL; actor->wallBgId = bgId; } else { - actor->bgCheckFlags &= ~8; + actor->bgCheckFlags &= ~BGCHECKFLAG_WALL; } } @@ -1265,10 +1265,10 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe sp64.y = actor->prevPos.y + 10.0f; if (BgCheck_EntityCheckCeiling(&globalCtx->colCtx, &sp58, &sp64, (ceilingCheckHeight + sp74) - 10.0f, &sCurCeilingPoly, &sCurCeilingBgId, actor)) { - actor->bgCheckFlags |= 0x10; + actor->bgCheckFlags |= BGCHECKFLAG_CEILING; actor->world.pos.y = (sp58 + sp74) - 10.0f; } else { - actor->bgCheckFlags &= ~0x10; + actor->bgCheckFlags &= ~BGCHECKFLAG_CEILING; } } @@ -1280,10 +1280,10 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe &waterBoxYSurface, &waterBox)) { actor->yDistToWater = waterBoxYSurface - actor->world.pos.y; if (actor->yDistToWater < 0.0f) { - actor->bgCheckFlags &= ~0x60; + actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); } else { - if (!(actor->bgCheckFlags & 0x20)) { - actor->bgCheckFlags |= 0x40; + if (!(actor->bgCheckFlags & BGCHECKFLAG_WATER)) { + actor->bgCheckFlags |= BGCHECKFLAG_WATER_TOUCH; if (!(flags & 0x40)) { ripplePos.x = actor->world.pos.x; ripplePos.y = waterBoxYSurface; @@ -1293,10 +1293,10 @@ void Actor_UpdateBgCheckInfo(GlobalContext* globalCtx, Actor* actor, f32 wallChe EffectSsGRipple_Spawn(globalCtx, &ripplePos, 100, 500, 8); } } - actor->bgCheckFlags |= 0x20; + actor->bgCheckFlags |= BGCHECKFLAG_WATER; } } else { - actor->bgCheckFlags &= ~0x60; + actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH); actor->yDistToWater = BGCHECK_Y_MIN; } } @@ -1699,7 +1699,7 @@ void Audio_PlayActorSound2(Actor* actor, u16 sfxId) { void func_8002F850(GlobalContext* globalCtx, Actor* actor) { s32 sfxId; - if (actor->bgCheckFlags & 0x20) { + if (actor->bgCheckFlags & BGCHECKFLAG_WATER) { if (actor->yDistToWater < 20.0f) { sfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; } else { @@ -3420,7 +3420,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, GlobalContext* globalCtx, f32 dista Math_Vec3f_Copy(&actor->world.pos, &prevActorPos); - ret = actor->bgCheckFlags & 1; + ret = actor->bgCheckFlags & BGCHECKFLAG_GROUND; actor->bgCheckFlags = prevBgCheckFlags; return ret; @@ -3936,10 +3936,10 @@ s32 func_80035124(Actor* actor, GlobalContext* globalCtx) { case 0: if (Actor_HasParent(actor, globalCtx)) { actor->params = 1; - } else if (!(actor->bgCheckFlags & 1)) { + } else if (!(actor->bgCheckFlags & BGCHECKFLAG_GROUND)) { Actor_MoveForward(actor); Math_SmoothStepToF(&actor->speedXZ, 0.0f, 1.0f, 0.1f, 0.0f); - } else if ((actor->bgCheckFlags & 2) && (actor->velocity.y < -4.0f)) { + } else if ((actor->bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) && (actor->velocity.y < -4.0f)) { ret = 1; } else { actor->shape.rot.x = actor->shape.rot.z = 0; diff --git a/src/code/z_en_a_keep.c b/src/code/z_en_a_keep.c index 91f21648a0..20aa5d4d71 100644 --- a/src/code/z_en_a_keep.c +++ b/src/code/z_en_a_keep.c @@ -278,18 +278,18 @@ void EnAObj_BoulderFragment(EnAObj* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.x += this->dyna.actor.world.rot.x >> 1; this->dyna.actor.shape.rot.z += this->dyna.actor.world.rot.z >> 1; - if (this->dyna.actor.speedXZ != 0.0f && this->dyna.actor.bgCheckFlags & 0x8) { + if (this->dyna.actor.speedXZ != 0.0f && this->dyna.actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->dyna.actor.world.rot.y = this->dyna.actor.wallYaw - this->dyna.actor.world.rot.y + this->dyna.actor.wallYaw - 0x8000; if (1) {} - this->dyna.actor.bgCheckFlags &= ~0x8; + this->dyna.actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; } - if (this->dyna.actor.bgCheckFlags & 0x2) { + if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (this->dyna.actor.velocity.y < -8.0f) { this->dyna.actor.velocity.y *= -0.6f; this->dyna.actor.speedXZ *= 0.6f; - this->dyna.actor.bgCheckFlags &= ~0x3; + this->dyna.actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH); } else { Actor_Kill(&this->dyna.actor); } diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 794a626594..3a122b4cc4 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -597,7 +597,7 @@ void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) { } } - if ((this->actor.gravity != 0.0f) && !(this->actor.bgCheckFlags & 0x0001)) { + if ((this->actor.gravity != 0.0f) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { EnItem00_SetupAction(this, func_8001E1C8); } } @@ -618,14 +618,14 @@ void func_8001E1C8(EnItem00* this, GlobalContext* globalCtx) { &sEffectEnvColor); } - if (this->actor.bgCheckFlags & 0x0003) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { originalVelocity = this->actor.velocity.y; if (originalVelocity > -2.0f) { EnItem00_SetupAction(this, func_8001DFC8); this->actor.velocity.y = 0.0f; } else { this->actor.velocity.y = originalVelocity * -0.8f; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } } } @@ -677,7 +677,7 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { &sEffectEnvColor); } - if (this->actor.bgCheckFlags & 0x0003) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { EnItem00_SetupAction(this, func_8001DFC8); this->actor.shape.rot.z = 0; this->actor.velocity.y = 0.0f; @@ -746,7 +746,7 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.scale.y = this->actor.scale.x; if (this->actor.gravity) { - if (this->actor.bgCheckFlags & 0x0003) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { if (*temp != globalCtx->gameplayFrames) { D_80157D90 = globalCtx->gameplayFrames; D_80157D94[0] = 0; diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 7dec7c8dff..3571f01824 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -436,7 +436,7 @@ void func_8008EDF0(Player* this) { } void func_8008EE08(Player* this) { - if ((this->actor.bgCheckFlags & 1) || + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->stateFlags1 & (PLAYER_STATE1_21 | PLAYER_STATE1_23 | PLAYER_STATE1_27)) || (!(this->stateFlags1 & (PLAYER_STATE1_18 | PLAYER_STATE1_19)) && ((this->actor.world.pos.y - this->actor.floorHeight) < 100.0f))) { @@ -619,7 +619,7 @@ s32 func_8008F2F8(GlobalContext* globalCtx) { var = 0; } else if ((this->unk_840 > 80) && ((this->currentBoots == PLAYER_BOOTS_IRON) || (this->unk_840 >= 300))) { // Deep underwater - var = ((this->currentBoots == PLAYER_BOOTS_IRON) && (this->actor.bgCheckFlags & 1)) ? 1 : 3; + var = ((this->currentBoots == PLAYER_BOOTS_IRON) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) ? 1 : 3; } else if (this->stateFlags1 & PLAYER_STATE1_27) { // Swimming var = 2; } else { diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index 5d1ec35878..376ed105ff 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -248,7 +248,7 @@ void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx) { this->actionFunc = func_808802D8; } else if (D_80881018 == 3) { D_80881018 = 4; - player->actor.bgCheckFlags |= 0x100; + player->actor.bgCheckFlags |= BGCHECKFLAG_CRUSHED; } } diff --git a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c index d0300d8358..2bb23f60ac 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c +++ b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c @@ -204,11 +204,11 @@ void func_80882BDC(BgHakaZou* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.x += this->dyna.actor.world.rot.x; this->dyna.actor.shape.rot.z += this->dyna.actor.world.rot.z; - if (this->dyna.actor.bgCheckFlags & 2) { + if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (this->dyna.actor.velocity.y < -8.0f) { this->dyna.actor.velocity.y *= -0.6f; this->dyna.actor.velocity.y = CLAMP_MAX(this->dyna.actor.velocity.y, 10.0f); - this->dyna.actor.bgCheckFlags &= ~3; + this->dyna.actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH); this->dyna.actor.speedXZ = 2.0f; } else { Actor_Kill(&this->dyna.actor); diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index 4fcc16b09a..0eab728ffc 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -182,7 +182,7 @@ void BgHeavyBlock_MovePiece(BgHeavyBlock* this, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, thisx, 50.0f, 50.0f, 0.0f, 5); thisx->world.pos.y -= this->unk_164.y; thisx->prevPos.y -= this->unk_164.y; - if (thisx->bgCheckFlags & 1) { + if (thisx->bgCheckFlags & BGCHECKFLAG_GROUND) { this->pieceFlags |= PIECE_FLAG_HIT_FLOOR; thisx->velocity.y = Rand_ZeroFloat(4.0f) + 2.0f; thisx->velocity.x = Rand_CenteredFloat(8.0f); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c index 0796133df4..a30c591190 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c @@ -140,8 +140,8 @@ void BgHidanDalm_Wait(BgHidanDalm* this, GlobalContext* globalCtx) { func_8002DF54(globalCtx, &this->dyna.actor, 8); this->dyna.actor.flags |= ACTOR_FLAG_4; this->actionFunc = BgHidanDalm_Shrink; - this->dyna.actor.bgCheckFlags &= ~2; - this->dyna.actor.bgCheckFlags &= ~8; + this->dyna.actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; + this->dyna.actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; this->dyna.actor.speedXZ = 10.0f; Flags_SetSwitch(globalCtx, this->switchFlag); func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_IT_HAMMER_HIT); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index 0f79340d1b..8da9e0f6f7 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -240,7 +240,7 @@ void func_8088B69C(BgHidanRock* this, GlobalContext* globalCtx) { void func_8088B79C(BgHidanRock* this, GlobalContext* globalCtx) { this->timer--; - if (this->dyna.actor.bgCheckFlags & 2) { + if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (this->type == 0) { this->timer = 60; this->actionFunc = func_8088B5F4; diff --git a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c index fe2b8ed57a..389b3d496a 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c +++ b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c @@ -158,9 +158,9 @@ void BgIceTurara_Shiver(BgIceTurara* this, GlobalContext* globalCtx) { } void BgIceTurara_Fall(BgIceTurara* this, GlobalContext* globalCtx) { - if ((this->collider.base.atFlags & AT_HIT) || (this->dyna.actor.bgCheckFlags & 1)) { + if ((this->collider.base.atFlags & AT_HIT) || (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->collider.base.atFlags &= ~AT_HIT; - this->dyna.actor.bgCheckFlags &= ~1; + this->dyna.actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; if (this->dyna.actor.world.pos.y < this->dyna.actor.floorHeight) { this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } diff --git a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c index 1e636f163d..02e550c343 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c +++ b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c @@ -150,8 +150,9 @@ void BgJyaHaheniron_ChairCrumble(BgJyaHaheniron* this, GlobalContext* globalCtx) Actor_MoveForward(&this->actor); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 8.0f, 0.0f, 0x85); - if ((this->actor.bgCheckFlags & 9) || ((this->collider.base.atFlags & AT_HIT) && (this->collider.base.at != NULL) && - (this->collider.base.at->category == ACTORCAT_PLAYER))) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)) || + ((this->collider.base.atFlags & AT_HIT) && (this->collider.base.at != NULL) && + (this->collider.base.at->category == ACTORCAT_PLAYER))) { vec.x = -Rand_ZeroOne() * this->actor.velocity.x; vec.y = -Rand_ZeroOne() * this->actor.velocity.y; vec.z = -Rand_ZeroOne() * this->actor.velocity.z; diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c index 26f17c7528..c079b401aa 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashigo/z_bg_mori_hashigo.c @@ -245,7 +245,7 @@ void BgMoriHashigo_LadderFall(BgMoriHashigo* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; Actor_MoveForward(thisx); - if ((thisx->bgCheckFlags & 1) && (thisx->velocity.y < 0.0f)) { + if ((thisx->bgCheckFlags & BGCHECKFLAG_GROUND) && (thisx->velocity.y < 0.0f)) { if (this->bounceCounter >= ARRAY_COUNT(bounceSpeed)) { BgMoriHashigo_SetupLadderRest(this); } else { diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index e517070259..eca43a9a13 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -509,7 +509,8 @@ void func_808B5B6C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { return; } - if (actor->bgCheckFlags & 8 || (actor->bgCheckFlags & 1 && actor->velocity.y < 0.0f)) { + if ((actor->bgCheckFlags & BGCHECKFLAG_WALL) || + ((actor->bgCheckFlags & BGCHECKFLAG_GROUND) && actor->velocity.y < 0.0f)) { BgSpot16Bombstone_SpawnFragments(this, globalCtx); BgSpot16Bombstone_SpawnDust(this, globalCtx); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &actor->world.pos, 20, NA_SE_EV_ROCK_BROKEN); diff --git a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c index c2da1387ac..0d68235ed0 100644 --- a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c +++ b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c @@ -86,7 +86,7 @@ void BgSstFloor_Update(BgSstFloor* thisx, GlobalContext* globalCtx) { if (distFromRim > 350.0f) { distFromRim = 350.0f; } - player->actor.bgCheckFlags &= ~1; + player->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; player->actor.velocity.y = 9.0f * distFromRim * (1.0f / 350.0f); } } @@ -99,7 +99,7 @@ void BgSstFloor_Update(BgSstFloor* thisx, GlobalContext* globalCtx) { if (distFromRim > 350.0f) { distFromRim = 350.0f; } - item00->bgCheckFlags &= ~3; + item00->bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH); item00->velocity.y = 9.0f * distFromRim * (1.0f / 350.0f); } } diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 9ded449b28..d6a2723004 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -753,7 +753,7 @@ void BossDodongo_Roll(BossDodongo* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.world.pos.z, sp5C->z, 1.0f, this->unk_1E4, 0.0f); this->unk_1C4 += 2000; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_228 = 7700.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_ROLL - SFX_FLAG); diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index 617dfe0f5d..55acddb868 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -668,7 +668,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 2); if (this->timers[1] == 0) { osSyncPrintf("BGCHECKKKKKKKKKKKKKKKKKKKKKKK\n"); - if (this->actor.bgCheckFlags & 0x10) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) { this->fwork[BFD_CEILING_BOUNCE] = -18384.0f; this->timers[1] = 10; Audio_PlaySoundGeneral(NA_SE_EV_EXPLOSION, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 63d06f58fd..4af6111d5e 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -4069,7 +4069,7 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) { spBA = 4; } - if ((spBA != 0) || (this->actor.bgCheckFlags & 1)) { + if ((spBA != 0) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { f32 sp58; f32 sp54; f32 phi_f20; diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 641c65b7bd..510784f222 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -1021,7 +1021,7 @@ void func_808FFCFC(BossGanon2* this, GlobalContext* globalCtx) { this->unk_311 = false; func_80900580(this, globalCtx); Audio_StopSfxById(NA_SE_EN_MGANON_UNARI); - } else if ((this->actor.bgCheckFlags & 8) && func_808FFA24(this, globalCtx)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && func_808FFA24(this, globalCtx)) { this->unk_311 = false; func_80900580(this, globalCtx); Audio_StopSfxById(NA_SE_EN_MGANON_UNARI); @@ -1986,7 +1986,7 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot = this->actor.world.rot; if (this->unk_335 != 0) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 60.0f, 60.0f, 100.0f, 5); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.velocity.y < -5.0f) { func_80033E88(&this->actor, globalCtx, 5, 20); func_80078884(NA_SE_IT_BOMB_EXPLOSION); diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index b7b26299f8..85bd463d23 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -882,7 +882,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, 0x7D0); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actionState = 130; this->actor.velocity.y = 0.0f; Animation_Change(&this->skelanime, &gGohmaInitialLandingAnim, 1.0f, 0.0f, @@ -1431,7 +1431,7 @@ void BossGoma_FallJump(BossGoma* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, 0x7D0); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { BossGoma_SetupFloorLand(this); this->actor.velocity.y = 0.0f; BossGoma_PlayEffectsAndSfx(this, globalCtx, 0, 8); @@ -1448,7 +1448,7 @@ void BossGoma_FallStruckDown(BossGoma* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 3, 0x7D0); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { BossGoma_SetupFloorLandStruckDown(this); this->actor.velocity.y = 0.0f; BossGoma_PlayEffectsAndSfx(this, globalCtx, 0, 8); @@ -1635,11 +1635,11 @@ void BossGoma_FloorMain(BossGoma* this, GlobalContext* globalCtx) { } } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.velocity.y = 0.0f; } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { BossGoma_SetupWallClimb(this); } @@ -1686,7 +1686,7 @@ void BossGoma_CeilingMoveToCenter(BossGoma* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.x, -0x8000, 3, 0x3E8); // avoid walking into a wall? - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { angle = this->actor.shape.rot.y + 0x8000; if (angle < this->actor.wallYaw) { diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 67f4bc25b7..ca60c451af 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -431,7 +431,7 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { } Math_Vec3f_Copy(&sCameraAt, &player->actor.world.pos); - if (player->actor.bgCheckFlags & 2) { + if (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (!this->ready) { sFloor->dyna.actor.params = BONGOFLOOR_HIT; this->ready = true; @@ -1624,7 +1624,7 @@ void BossSst_HandPunch(BossSst* this, GlobalContext* globalCtx) { this->actor.world.pos.x += this->actor.speedXZ * Math_SinS(this->actor.shape.rot.y); this->actor.world.pos.z += this->actor.speedXZ * Math_CosS(this->actor.shape.rot.y); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { BossSst_HandSetupRetreat(this); } else if (this->colliderJntSph.base.atFlags & AT_HIT) { func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 407c1ed772..96e0c75ed2 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -1389,7 +1389,7 @@ void BossTw_HitByBeam(BossTw* this, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 4); this->actor.world.pos.y += 50.0f; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speedXZ = 0.0f; } @@ -3539,7 +3539,7 @@ void BossTw_Draw(Actor* thisx, GlobalContext* globalCtx2) { diff.y = this->groundBlastPos2.y - player->actor.world.pos.y; diff.z = this->groundBlastPos2.z - player->actor.world.pos.z; - if ((fabsf(diff.y) < 10.0f) && (player->actor.bgCheckFlags & 1) && + if ((fabsf(diff.y) < 10.0f) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (sqrtf(SQ(diff.x) + SQ(diff.z)) < (this->workf[UNK_F12] * 4600.0f)) && (sFreezeState == 0) && (this->workf[UNK_F11] > 200.0f)) { sFreezeState = 1; @@ -4057,7 +4057,7 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { yDiff = sKoumePtr->groundBlastPos2.y - player->actor.world.pos.y; zDiff = sKoumePtr->groundBlastPos2.z - player->actor.world.pos.z; - if (!player->isBurning && (player->actor.bgCheckFlags & 1) && (fabsf(yDiff) < 10.0f) && + if (!player->isBurning && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (fabsf(yDiff) < 10.0f) && (sqrtf(SQ(xDiff) + SQ(zDiff)) < (sKoumePtr->workf[UNK_F13] * 4550.0f))) { s16 j; @@ -5330,7 +5330,7 @@ void BossTw_TwinrovaStun(BossTw* this, GlobalContext* globalCtx) { Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_035030, 0.0f); } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.velocity.y = 0.0f; } diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 221d5ae915..d5b62168a3 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -1466,8 +1466,8 @@ void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { this->unk_1AC += 0xC31; this->unk_1A0 = (Math_CosS(this->unk_1AC) * 0.1f) + 1.0f; this->unk_1A4 = (Math_SinS(this->unk_1AC) * 0.05f) + 1.0f; - if (this->actor.bgCheckFlags & 8) { - this->actor.bgCheckFlags &= ~8; + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; this->actor.world.rot.y = (s16)Rand_CenteredFloat(30 * (0x10000 / 360)) + this->actor.wallYaw; } diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 760fa8df4c..701e2c3cd6 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -718,7 +718,7 @@ void func_8098652C(DemoIm* this, GlobalContext* globalCtx) { } void func_80986570(DemoIm* this, GlobalContext* globalCtx) { - if (Animation_OnFrame(&this->skelAnime, 7.0f) && (this->actor.bgCheckFlags & 1)) { + if (Animation_OnFrame(&this->skelAnime, 7.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { u32 sfxId = SFX_FLAG; sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 13a72e9db9..0d8144060f 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -596,7 +596,7 @@ void func_80997568(DoorShutter* this, GlobalContext* globalCtx) { void func_809975C0(DoorShutter* this, GlobalContext* globalCtx) { Actor_MoveForward(&this->dyna.actor); Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); - if (this->dyna.actor.bgCheckFlags & 1) { + if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { DoorShutter_SetupAction(this, func_809976B8); if (!(gSaveContext.eventChkInf[7] & 1)) { BossGoma* parent = (BossGoma*)this->dyna.actor.parent; diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index 6e6708e8fc..231fe4a773 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -192,7 +192,7 @@ s32 EnAm_CanMove(EnAm* this, GlobalContext* globalCtx, f32 distance, s16 yaw) { Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4); this->dyna.actor.world.pos = curPos; - ret = this->dyna.actor.bgCheckFlags & 1; + ret = this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND; if (!ret && (this->dyna.actor.floorHeight >= (this->dyna.actor.home.pos.y - 20.0f))) { ret = true; @@ -439,7 +439,7 @@ void EnAm_RotateToHome(EnAm* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->dyna.actor.world.rot.y, yawToHome, 1, 0x1F40, 0); this->dyna.actor.velocity.y = 12.0f; } else if (this->skelAnime.curFrame > 11.0f) { - if (!(this->dyna.actor.bgCheckFlags & 1)) { + if (!(this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->skelAnime.curFrame = 11; } else { EnAm_SpawnEffects(this, globalCtx); @@ -474,7 +474,7 @@ void EnAm_RotateToInit(EnAm* this, GlobalContext* globalCtx) { this->unk_258 = 2; this->dyna.actor.velocity.y = 12.0f; } else if (this->skelAnime.curFrame > 11.0f) { - if (!(this->dyna.actor.bgCheckFlags & 1)) { + if (!(this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->skelAnime.curFrame = 11; } else { this->unk_258 = 1; @@ -510,12 +510,12 @@ void EnAm_MoveToHome(EnAm* this, GlobalContext* globalCtx) { this->dyna.actor.velocity.y = 12.0f; this->dyna.actor.speedXZ = 6.0f; } else if (this->skelAnime.curFrame > 11.0f) { - if (!(this->dyna.actor.bgCheckFlags & 1)) { + if (!(this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->skelAnime.curFrame = 11; } else { Math_SmoothStepToS(&this->dyna.actor.world.rot.y, yawToHome, 1, 0xBB8, 0); - if (this->dyna.actor.bgCheckFlags & 2) { + if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->unk_258--; } @@ -531,7 +531,7 @@ void EnAm_MoveToHome(EnAm* this, GlobalContext* globalCtx) { } // turn away from a wall if touching one - if ((this->dyna.actor.speedXZ != 0.0f) && (this->dyna.actor.bgCheckFlags & 8)) { + if ((this->dyna.actor.speedXZ != 0.0f) && (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_WALL)) { this->dyna.actor.world.rot.y = this->dyna.actor.wallYaw; Actor_MoveForward(&this->dyna.actor); } @@ -573,7 +573,7 @@ void EnAm_Cooldown(EnAm* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 1, 0x1F40, 0); this->dyna.actor.velocity.y = 12.0f; } else if (this->skelAnime.curFrame > 11.0f) { - if (!(this->dyna.actor.bgCheckFlags & 1)) { + if (!(this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->skelAnime.curFrame = 11; } else { if (yawDiff < 3500) { @@ -614,12 +614,12 @@ void EnAm_Lunge(EnAm* this, GlobalContext* globalCtx) { this->unk_264 = 1; this->hitCollider.base.atFlags &= ~(AT_HIT | AT_BOUNCED); } else if (this->skelAnime.curFrame > 11.0f) { - if (!(this->dyna.actor.bgCheckFlags & 1)) { + if (!(this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->skelAnime.curFrame = 11; } else { Math_SmoothStepToS(&this->dyna.actor.world.rot.y, this->dyna.actor.yawTowardsPlayer, 1, 0x1770, 0); - if (this->dyna.actor.bgCheckFlags & 2) { + if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->unk_258--; } @@ -638,11 +638,11 @@ void EnAm_Lunge(EnAm* this, GlobalContext* globalCtx) { } // turn and move away from a wall if contact is made with one - if ((this->dyna.actor.speedXZ != 0.0f) && (this->dyna.actor.bgCheckFlags & 8)) { + if ((this->dyna.actor.speedXZ != 0.0f) && (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_WALL)) { this->dyna.actor.world.rot.y = (this->dyna.actor.wallYaw - this->dyna.actor.world.rot.y) + this->dyna.actor.wallYaw; Actor_MoveForward(&this->dyna.actor); - this->dyna.actor.bgCheckFlags &= ~8; + this->dyna.actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; } SkelAnime_Update(&this->skelAnime); @@ -683,7 +683,8 @@ void EnAm_Statue(EnAm* this, GlobalContext* globalCtx) { moveDir = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, &this->hurtCollider.base.oc->world.pos) - temp158f; } - if ((this->dyna.unk_150 == 0.0f) || (this->unk_258 == 0) || !(this->dyna.actor.bgCheckFlags & 1) || + if ((this->dyna.unk_150 == 0.0f) || (this->unk_258 == 0) || + !(this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) || !func_800435D8(globalCtx, &this->dyna, 0x14, (Math_SinS(this->unk_258) * (this->dyna.unk_150 * 0.5f)) + 40.0f, 0xA) || ((this->hurtCollider.base.ocFlags1 & OC1_HIT) && (ABS(moveDir) <= 0x2000))) { @@ -698,7 +699,7 @@ void EnAm_Statue(EnAm* this, GlobalContext* globalCtx) { this->dyna.actor.speedXZ = Math_SinS(this->unk_258) * (this->dyna.unk_150 * 0.5f); } - if (this->dyna.actor.bgCheckFlags & 2) { + if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } diff --git a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c index 61b3137ac7..1a3e7c93f1 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c @@ -347,7 +347,7 @@ void EnAnubice_Die(EnAnubice* this, GlobalContext* globalCtx) { Actor_SetColorFilter(&this->actor, 0x4000, 128, 0, 8); EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &rotatedFireEffectPos, 100, 0, 0, -1); - if ((this->animLastFrame <= curFrame) && (this->actor.bgCheckFlags & 1)) { + if ((this->animLastFrame <= curFrame) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Math_ApproachF(&this->actor.shape.yOffset, -4230.0f, 0.5f, 300.0f); if (this->actor.shape.yOffset < -2000.0f) { Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xC0); diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index 4bb8e25597..2bc760879a 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -205,7 +205,7 @@ void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, this->unk_2E4); Actor_GetScreenPos(globalCtx, &this->actor, &sp4E, &sp4C); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_2D4 = this->actor.yawTowardsPlayer; this->unk_2D0 = this->actor.world.rot.x - 3000.0f; this->unk_2DC = 0.0f; @@ -220,7 +220,7 @@ void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx) { } else if (((this->actor.projectedPos.z > 0.0f) && (fabsf(sp34.x - this->actor.world.pos.x) < 50.0f) && (fabsf(sp34.y - this->actor.world.pos.y) < 50.0f) && (fabsf(sp34.z - this->actor.world.pos.z) < 50.0f)) || - (this->actor.bgCheckFlags & 1)) { + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->unk_2D4 = this->actor.yawTowardsPlayer; this->unk_2D0 = this->actor.world.rot.x - 2000.0f; @@ -246,7 +246,7 @@ void func_809B59B0(EnAttackNiw* this, GlobalContext* globalCtx) { return; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->unk_25A == 0) { this->unk_25A = 3; this->actor.velocity.y = 3.5f; @@ -268,13 +268,13 @@ void func_809B59B0(EnAttackNiw* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk_2DC, 10000.0f, 1.0f, 1000.0f); Math_ApproachF(&this->actor.speedXZ, this->unk_2E0, 0.9f, 1.0f); if ((this->actor.gravity == -2.0f) && (this->unk_262 == 0) && - ((this->actor.bgCheckFlags & 8) || (this->unk_25C == 0))) { + ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->unk_25C == 0))) { this->unk_2E0 = 0.0f; this->actor.gravity = 0.0f; this->unk_2DC = 0.0f; this->unk_2D0 = this->actor.world.rot.x - 5000.0f; this->actionFunc = func_809B5C18; - } else if (this->actor.bgCheckFlags & 1) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_809B5268(this, globalCtx, 5); } else { func_809B5268(this, globalCtx, 2); @@ -340,7 +340,7 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - if ((this->actor.bgCheckFlags & 0x20) && (this->actionFunc != func_809B5C18)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actionFunc != func_809B5C18)) { Math_Vec3f_Copy(&sp30, &this->actor.world.pos); sp30.y += this->actor.yDistToWater; EffectSsGSplash_Spawn(globalCtx, &sp30, 0, 0, 0, 0x190); diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/src/overlays/actors/ovl_En_Ba/z_en_ba.c index 00bdafe232..a493b7de02 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -203,7 +203,7 @@ void EnBa_SetupFallAsBlob(EnBa* this) { * Action function of the pink fleshy blobs that spawn and fall to the floor when a tentacle dies */ void EnBa_FallAsBlob(EnBa* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.scale.y -= 0.001f; this->actor.scale.x += 0.0005f; this->actor.scale.z += 0.0005f; diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index 1d956553a3..a1e203eeac 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -507,7 +507,7 @@ void EnBb_SetupDamage(EnBb* this) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLE_DAMAGE); if (this->actor.params > ENBB_GREEN) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if ((this->actor.bgCheckFlags & 8) == 0) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { this->actor.speedXZ = -7.0f; } this->actor.shape.yOffset = 1500.0f; @@ -626,7 +626,7 @@ void EnBb_Blue(EnBb* this, GlobalContext* globalCtx) { } thisYawToWall = this->actor.wallYaw - this->actor.world.rot.y; moveYawToWall = this->actor.wallYaw - this->vMoveAngleY; - if ((this->targetActor == NULL) && (this->actor.bgCheckFlags & 8) && + if ((this->targetActor == NULL) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(thisYawToWall) > 0x4000 || ABS(moveYawToWall) > 0x4000)) { this->vMoveAngleY = this->actor.wallYaw + this->actor.wallYaw - this->actor.world.rot.y - 0x8000; Math_SmoothStepToS(&this->actor.world.rot.y, this->vMoveAngleY, 1, 0xBB8, 0); @@ -671,7 +671,7 @@ void EnBb_SetupDown(EnBb* this) { this->action = BB_DOWN; this->timer = 200; this->actor.colorFilterTimer = 0; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.speedXZ = 3.0f; this->flameScaleX = 0.0f; this->flameScaleY = 0.0f; @@ -684,13 +684,13 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { s16 yawDiff = this->actor.world.rot.y - this->actor.wallYaw; SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (ABS(yawDiff) > 0x4000) { this->actor.world.rot.y = this->actor.wallYaw + this->actor.wallYaw - this->actor.world.rot.y - 0x8000; } - this->actor.bgCheckFlags &= ~8; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; } - if (this->actor.bgCheckFlags & 3) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { if (this->actor.params == ENBB_RED) { s32 floorType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); @@ -710,7 +710,7 @@ void EnBb_Down(EnBb* this, GlobalContext* globalCtx) { } else { this->actor.velocity.y = 10.0f; } - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 7.0f, 2, 2.0f, 0, 0, false); Math_SmoothStepToS(&this->actor.world.rot.y, -this->actor.yawTowardsPlayer, 1, 0xBB8, 0); } @@ -753,7 +753,7 @@ void EnBb_SetupRed(GlobalContext* globalCtx, EnBb* this) { this->actionState = BBRED_ATTACK; this->timer = 0; this->moveMode = BBMOVE_NORMAL; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } else { this->actor.colChkInfo.health = 4; this->timer = 0; @@ -762,7 +762,7 @@ void EnBb_SetupRed(GlobalContext* globalCtx, EnBb* this) { this->actor.world.pos.y -= 80.0f; this->actor.home.pos = this->actor.world.pos; this->actor.velocity.y = this->actor.gravity = this->actor.speedXZ = 0.0f; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.flags &= ~ACTOR_FLAG_0; } this->action = BB_RED; @@ -789,7 +789,7 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) { this->actor.velocity.y = 18.0f; this->moveMode = BBMOVE_NOCLIP; this->timer = 7; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actionState++; EnBb_SpawnFlameTrail(globalCtx, this, false); } @@ -802,15 +802,15 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) { this->bobPhase += Rand_ZeroOne(); Math_SmoothStepToF(&this->flameScaleY, 80.0f, 1.0f, 10.0f, 0.0f); Math_SmoothStepToF(&this->flameScaleX, 100.0f, 1.0f, 10.0f, 0.0f); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { yawDiff = this->actor.world.rot.y - this->actor.wallYaw; if (ABS(yawDiff) > 0x4000) { this->actor.world.rot.y = this->actor.wallYaw + this->actor.wallYaw - this->actor.world.rot.y - 0x8000; } - this->actor.bgCheckFlags &= ~8; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { floorType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((floorType == 2) || (floorType == 3) || (floorType == 9)) { this->moveMode = BBMOVE_HIDDEN; @@ -824,7 +824,7 @@ void EnBb_Red(EnBb* this, GlobalContext* globalCtx) { } this->actor.world.rot.y = Math_SinF(this->bobPhase) * 65535.0f; } - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } this->actor.shape.rot.y = this->actor.world.rot.y; if (Actor_GetCollidedExplosive(globalCtx, &this->collider.base) != NULL) { @@ -1091,20 +1091,20 @@ void EnBb_SetupStunned(EnBb* this) { Actor_SetColorFilter(&this->actor, 0, 0xB4, 0, 0x50); break; } - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; EnBb_SetupAction(this, EnBb_Stunned); } void EnBb_Stunned(EnBb* this, GlobalContext* globalCtx) { s16 yawDiff = this->actor.world.rot.y - this->actor.wallYaw; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (ABS(yawDiff) > 0x4000) { this->actor.world.rot.y = this->actor.wallYaw + this->actor.wallYaw - this->actor.world.rot.y - 0x8000; } - this->actor.bgCheckFlags &= ~8; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); if (this->actor.velocity.y < -14.0f) { this->actor.velocity.y *= -0.4f; diff --git a/src/overlays/actors/ovl_En_Bili/z_en_bili.c b/src/overlays/actors/ovl_En_Bili/z_en_bili.c index f122ed99c3..2abd1784ea 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -316,7 +316,7 @@ void EnBili_UpdateFloating(EnBili* this) { this->actor.world.pos.y = this->actor.home.pos.y + (sinf(this->timer * (M_PI / 16)) * 3.0f); // Turn around if touching wall - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.world.rot.y = this->actor.wallYaw; } } @@ -518,7 +518,7 @@ void EnBili_Stunned(EnBili* this, GlobalContext* globalCtx) { this->timer--; } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } @@ -536,7 +536,7 @@ void EnBili_Frozen(EnBili* this, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; } - if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { this->actor.colorFilterTimer = 0; EnBili_SetupDie(this); } else { diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index f7df3a48bb..b630414b11 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -126,29 +126,29 @@ void EnBom_Move(EnBom* this, GlobalContext* globalCtx) { return; } - if ((this->actor.velocity.y > 0.0f) && (this->actor.bgCheckFlags & 0x10)) { + if ((this->actor.velocity.y > 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING)) { this->actor.velocity.y = -this->actor.velocity.y; } // rebound bomb off the wall it hits - if ((this->actor.speedXZ != 0.0f) && (this->actor.bgCheckFlags & 8)) { + if ((this->actor.speedXZ != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { if (ABS((s16)(this->actor.wallYaw - this->actor.world.rot.y)) > 0x4000) { this->actor.world.rot.y = ((this->actor.wallYaw - this->actor.world.rot.y) + this->actor.wallYaw) - 0x8000; } Audio_PlayActorSound2(&this->actor, NA_SE_EV_BOMB_BOUND); Actor_MoveForward(&this->actor); this->actor.speedXZ *= 0.7f; - this->actor.bgCheckFlags &= ~8; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; } - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.08f); } else { Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); - if ((this->actor.bgCheckFlags & 2) && (this->actor.velocity.y < -3.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) && (this->actor.velocity.y < -3.0f)) { func_8002F850(globalCtx, &this->actor); this->actor.velocity.y *= -0.3f; - this->actor.bgCheckFlags &= ~2; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; } else if (this->timer >= 4) { func_8002F580(&this->actor, globalCtx); } @@ -348,8 +348,8 @@ void EnBom_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor_Kill(thisx); return; } - if (thisx->bgCheckFlags & 0x40) { - thisx->bgCheckFlags &= ~0x40; + if (thisx->bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { + thisx->bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; Audio_PlayActorSound2(thisx, NA_SE_EV_BOMB_DROP_WATER); } } diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index b6c81a8f9b..b2197a7c45 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -455,22 +455,22 @@ void EnBomChu_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.yDistToWater = waterY - this->actor.world.pos.y; if (this->actor.yDistToWater < 0.0f) { - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { EnBomChu_SpawnRipples(this, globalCtx, waterY); } - this->actor.bgCheckFlags &= ~0x20; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER; } else { - if (!(this->actor.bgCheckFlags & 0x20) && (this->timer != 120)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->timer != 120)) { EnBomChu_SpawnRipples(this, globalCtx, waterY); } else { EffectSsBubble_Spawn(globalCtx, &this->actor.world.pos, 0.0f, 3.0f, 15.0f, 0.25f); } - this->actor.bgCheckFlags |= 0x20; + this->actor.bgCheckFlags |= BGCHECKFLAG_WATER; } } else { - this->actor.bgCheckFlags &= ~0x20; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER; this->actor.yDistToWater = BGCHECK_Y_MIN; } } diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index 2d098dbcee..f1e481eb4d 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -235,11 +235,11 @@ void EnBombf_Move(EnBombf* this, GlobalContext* globalCtx) { this->flowerBombScale = 1.0f; - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.025f, 0.0f); } else { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.5f, 0.0f); - if ((this->actor.bgCheckFlags & 2) && (this->actor.velocity.y < -6.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) && (this->actor.velocity.y < -6.0f)) { func_8002F850(globalCtx, &this->actor); this->actor.velocity.y *= -0.5f; } else if (this->timer >= 4) { @@ -345,12 +345,12 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { if (thisx->params == BOMBFLOWER_BODY) { - if ((thisx->velocity.y > 0.0f) && (thisx->bgCheckFlags & 0x10)) { + if ((thisx->velocity.y > 0.0f) && (thisx->bgCheckFlags & BGCHECKFLAG_CEILING)) { thisx->velocity.y = -thisx->velocity.y; } // rebound bomb off the wall it hits - if ((thisx->speedXZ != 0.0f) && (thisx->bgCheckFlags & 8)) { + if ((thisx->speedXZ != 0.0f) && (thisx->bgCheckFlags & BGCHECKFLAG_WALL)) { if (ABS((s16)(thisx->wallYaw - thisx->world.rot.y)) > 0x4000) { if (1) {} @@ -362,7 +362,7 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, thisx, 5.0f, 10.0f, 0.0f, 0x1F); DREG(6) = 0; thisx->speedXZ *= 0.7f; - thisx->bgCheckFlags &= ~8; + thisx->bgCheckFlags &= ~BGCHECKFLAG_WALL; } if ((this->bombCollider.base.acFlags & AC_HIT) || ((this->bombCollider.base.ocFlags1 & OC1_HIT) && @@ -457,8 +457,8 @@ void EnBombf_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_Kill(thisx); return; } - if (thisx->bgCheckFlags & 0x40) { - thisx->bgCheckFlags &= ~0x40; + if (thisx->bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { + thisx->bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; Audio_PlayActorSound2(thisx, NA_SE_EV_BOMB_DROP_WATER); } } diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index 6b324696c1..895cd8dc0a 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -180,7 +180,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { // Otherwise if it's a Skulltula Token, just set flags so he collides with it to collect it. if (target->id == ACTOR_EN_ITEM00) { target->gravity = -0.9f; - target->bgCheckFlags &= ~0x03; + target->bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH); } else { target->flags &= ~ACTOR_FLAG_13; } diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 3314e82335..03a6a862ec 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -232,7 +232,7 @@ void EnBox_Fall(EnBox* this, GlobalContext* globalCtx) { this->alpha = 255; this->movementFlags &= ~ENBOX_MOVE_IMMOBILE; - if (this->dyna.actor.bgCheckFlags & 1) { + if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->movementFlags |= ENBOX_MOVE_UNUSED; if (this->movementFlags & ENBOX_MOVE_FALL_ANGLE_SIDE) { this->movementFlags &= ~ENBOX_MOVE_FALL_ANGLE_SIDE; diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index e46d956575..511886f95d 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -253,7 +253,7 @@ void EnBubble_Fly(EnBubble* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_AWA_BOUND); this->graphicRotSpeed = 128.0f; this->graphicEccentricity = 0.48f; - } else if (this->actor.bgCheckFlags & 0x20 && sp54.y < 0.0f) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && sp54.y < 0.0f) { sp60.x = sp60.z = 0.0f; sp60.y = 1.0f; EnBubble_Vec3fNormalizedRelfect(&sp54, &sp60, &sp54); diff --git a/src/overlays/actors/ovl_En_Bw/z_en_bw.c b/src/overlays/actors/ovl_En_Bw/z_en_bw.c index b59f444cbb..e806d2db62 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -278,7 +278,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { } this->unk_222 = (Rand_ZeroOne() * 200.0f) + 200.0f; } - } else if ((this->actor.speedXZ != 0.0f) && (this->actor.bgCheckFlags & 8)) { + } else if ((this->actor.speedXZ != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { if (this->unk_236 != this->actor.wallYaw) { sp64 = 1; this->unk_236 = this->actor.wallYaw; @@ -288,7 +288,7 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { } else { this->unk_238 = -0x4000; } - this->actor.bgCheckFlags &= ~8; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; this->unk_222 = (Rand_ZeroOne() * 20.0f) + 160.0f; } else { if ((s16)(this->actor.yawTowardsPlayer - this->unk_236) >= 0) { @@ -362,7 +362,8 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { } break; case 1: - if (((sp64 == 0) && !(this->actor.bgCheckFlags & 8)) || Actor_IsFacingPlayer(&this->actor, 0x1C70)) { + if (((sp64 == 0) && !(this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) || + Actor_IsFacingPlayer(&this->actor, 0x1C70)) { if (Actor_IsFacingPlayer(&this->actor, 0x1C70)) { this->unk_238 = -this->unk_238; } @@ -451,7 +452,7 @@ void func_809CF984(EnBw* this, GlobalContext* globalCtx) { } } SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 3) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { floorPolyType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((floorPolyType == 2) || (floorPolyType == 3) || (floorPolyType == 9)) { Actor_Kill(&this->actor); @@ -483,14 +484,14 @@ void func_809CFC4C(EnBw* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0x7FFF, 1, 0xFA0, 0); Math_SmoothStepToF(&this->unk_248, 0.0f, 1.0f, 0.05f, 0.0f); SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 3) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { if ((globalCtx->gameplayFrames % 0x80) == 0) { this->unk_25C = (Rand_ZeroOne() * 0.25f) + 0.7f; } this->unk_221 = 4; this->unk_258 += this->unk_25C; Math_SmoothStepToF(&this->unk_260, 0.075f, 1.0f, 0.005f, 0.0f); - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } @@ -532,7 +533,7 @@ void func_809CFF10(EnBw* this) { this->actor.speedXZ = 0.0f; this->actor.velocity.y = 11.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_BUBLEWALK_REVERSE); - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; EnBw_SetupAction(this, func_809CFF98); } @@ -540,7 +541,7 @@ void func_809CFF98(EnBw* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 0xFA0, 0); Math_SmoothStepToF(&this->unk_248, 0.6f, 1.0f, 0.05f, 0.0f); SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 3) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); this->unk_222 = 0xBB8; this->unk_250 = 0.0f; @@ -675,7 +676,7 @@ void func_809D0424(EnBw* this, GlobalContext* globalCtx) { } void func_809D0584(EnBw* this, GlobalContext* globalCtx) { - if ((this->actor.bgCheckFlags & 0x10) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->unk_230 = 0; this->actor.scale.y -= 0.009f; Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 30.0f, 11, 4.0f, 0, 0, false); @@ -724,7 +725,7 @@ void func_809D0584(EnBw* this, GlobalContext* globalCtx) { } } if ((globalCtx->actorCtx.unk_02 != 0) && (this->actor.xzDistToPlayer <= 400.0f) && - (this->actor.bgCheckFlags & 1)) { + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->unk_220 == 5) { this->unk_23C = 0; func_809CFF10(this); diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 953f8ab351..5952828f0e 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -526,8 +526,8 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_BREATH - SFX_FLAG); - // Check if the Arwing has hit the ground. - if (this->actor.bgCheckFlags & 9) { + // Check if the Arwing has hit the ground or a wall. + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)) { this->shouldExplode = true; if (this->drawMode != CLEAR_TAG_DRAW_MODE_ARWING) { @@ -557,8 +557,9 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 80.0f, 100.0f, 5); - // Check if the laser has hit a target, timed out, or hit the ground. - if (this->actor.bgCheckFlags & 9 || hasAtHit || this->timers[CLEAR_TAG_TIMER_LASER_DEATH] == 0) { + // Check if the laser has hit a target, timed out, or hit the ground or a wall. + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)) || hasAtHit || + this->timers[CLEAR_TAG_TIMER_LASER_DEATH] == 0) { // Kill the laser. Actor_Kill(&this->actor); // Player laser sound effect if the laser did not time out. diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index 250a4752a5..2ebde0e4d1 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -151,7 +151,7 @@ void EnCrow_SetupDamaged(EnCrow* this, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, &gGuayFlyAnim, 0.4f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -3.0f); scale = this->actor.scale.x * 100.0f; this->actor.world.pos.y += 20.0f * scale; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.shape.yOffset = 0.0f; this->actor.targetArrowOffset = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_DEAD); @@ -234,7 +234,7 @@ void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx) { skelanimeUpdated = Animation_OnFrame(&this->skelAnime, 0.0f); this->actor.speedXZ = (Rand_ZeroOne() * 1.5f) + 3.0f; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->aimRotY = this->actor.wallYaw; } else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { this->aimRotY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); @@ -269,7 +269,7 @@ void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx) { this->aimRotX = CLAMP(this->aimRotX, -0x1000, 0x1000); } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_ScaledStepToS(&this->actor.shape.rot.x, -0x100, 0x400); } @@ -313,7 +313,8 @@ void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx) { } if ((this->timer == 0) || (Player_GetMask(globalCtx) == PLAYER_MASK_SKULL) || - (this->collider.base.atFlags & AT_HIT) || (this->actor.bgCheckFlags & 9) || + (this->collider.base.atFlags & AT_HIT) || + (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)) || (player->stateFlags1 & PLAYER_STATE1_23) || (this->actor.yDistToWater > -40.0f)) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; @@ -333,7 +334,7 @@ void EnCrow_Damaged(EnCrow* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4000, 0x200); this->actor.shape.rot.z += 0x1780; } - if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { EffectSsDeadDb_Spawn(globalCtx, &this->actor.world.pos, &sZeroVecAccel, &sZeroVecAccel, this->actor.scale.x * 10000.0f, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, 1); EnCrow_SetupDie(this); @@ -366,7 +367,7 @@ void EnCrow_Die(EnCrow* this, GlobalContext* globalCtx) { void EnCrow_TurnAway(EnCrow* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->aimRotY = this->actor.wallYaw; } else { this->aimRotY = this->actor.yawTowardsPlayer + 0x8000; diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 4c452b8ba7..82e790af99 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -951,7 +951,8 @@ void EnDekubaba_PrunedSomersault(EnDekubaba* this, GlobalContext* globalCtx) { EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, this->size * 3.0f, 0, this->size * 12.0f, this->size * 5.0f, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); - if ((this->actor.scale.x > 0.005f) && ((this->actor.bgCheckFlags & 2) || (this->actor.bgCheckFlags & 8))) { + if ((this->actor.scale.x > 0.005f) && + ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) || (this->actor.bgCheckFlags & BGCHECKFLAG_WALL))) { this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = 0.0f; this->actor.speedXZ = 0.0f; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); @@ -959,7 +960,7 @@ void EnDekubaba_PrunedSomersault(EnDekubaba* this, GlobalContext* globalCtx) { this->size * 5.0f, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); this->timer = 1; } diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index da4ac5a609..bb895fb8e0 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -359,9 +359,9 @@ void EnDekunuts_Run(EnDekunuts* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 7.5f, 1.0f); if (Math_SmoothStepToS(&this->actor.world.rot.y, this->runDirection, 1, 0xE38, 0xB6) == 0) { - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { this->runDirection = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->runDirection = this->actor.wallYaw; } else if (this->runAwayCount == 0) { diffRotInit = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); diff --git a/src/overlays/actors/ovl_En_Dh/z_en_dh.c b/src/overlays/actors/ovl_En_Dh/z_en_dh.c index 4d0043de64..2bd26d690a 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -400,7 +400,7 @@ void EnDh_Burrow(EnDh* this, GlobalContext* globalCtx) { void EnDh_SetupDamage(EnDh* this) { Animation_MorphToPlayOnce(&this->skelAnime, &object_dh_Anim_003D6C, -6.0f); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speedXZ = -1.0f; } Audio_PlayActorSound2(&this->actor, NA_SE_EN_DEADHAND_DAMAGE); diff --git a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c index eb1c9b1d7a..66497b9481 100644 --- a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c +++ b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c @@ -98,7 +98,7 @@ void EnDntJiji_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void EnDntJiji_SetFlower(EnDntJiji* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->flowerPos = this->actor.world.pos; this->actionFunc = EnDntJiji_SetupWait; } @@ -180,7 +180,7 @@ void EnDntJiji_Walk(EnDntJiji* this, GlobalContext* globalCtx) { this->sfxTimer = 5; Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK); } - if ((this->actor.bgCheckFlags & 8) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.velocity.y = 9.0f; this->actor.speedXZ = 3.0f; } @@ -344,7 +344,7 @@ void EnDntJiji_Return(EnDntJiji* this, GlobalContext* globalCtx) { dz = this->flowerPos.z - this->actor.world.pos.z; Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(dx, dz) * (0x8000 / M_PI), 1, 0xBB8, 0); this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->actor.bgCheckFlags & 8) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.velocity.y = 9.0f; this->actor.speedXZ = 3.0f; } diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c index cf88b2f55d..4a67e417f3 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c @@ -189,7 +189,7 @@ void EnDntNomal_WaitForObject(EnDntNomal* this, GlobalContext* globalCtx) { } void EnDntNomal_SetFlower(EnDntNomal* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->flowerPos = this->actor.world.pos; if (this->type == ENDNTNOMAL_TARGET) { this->actionFunc = EnDntNomal_SetupTargetWait; @@ -542,7 +542,7 @@ void EnDntNomal_StageCelebrate(EnDntNomal* this, GlobalContext* globalCtx) { } else if ((this->timer5 & 3) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK); } - if ((this->actor.bgCheckFlags & 8) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.velocity.y = 7.5f; } } diff --git a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c index 7eff2d70fa..043bfb62aa 100644 --- a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c +++ b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c @@ -144,7 +144,7 @@ s32 func_809F68B0(EnDodojr* this, GlobalContext* globalCtx) { return 0; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); this->dustPos = this->actor.world.pos; func_809F6510(this, globalCtx, 10); @@ -450,7 +450,7 @@ void func_809F758C(EnDodojr* this, GlobalContext* globalCtx) { this->actionFunc = func_809F799C; } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_DOWN); func_809F6BBC(this); this->actionFunc = func_809F7A00; diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index b8a5a53738..fe8bd85a6d 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -770,7 +770,7 @@ void EnDodongo_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); Actor_MoveForward(&this->actor); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 75.0f, 60.0f, 70.0f, 0x1D); - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_DOWN); } } diff --git a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c index 1f10e8370e..34ed5594ab 100644 --- a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c +++ b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c @@ -429,7 +429,7 @@ void EnEiyer_Glide(EnEiyer* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 1.5f, 0.03f); } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->targetYaw = this->actor.wallYaw; } @@ -477,7 +477,7 @@ void EnEiyer_DiveAttack(EnEiyer* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); this->actor.speedXZ *= 1.1f; - if (this->actor.bgCheckFlags & 8 || this->actor.bgCheckFlags & 1) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { EnEiyer_SetupLand(this); } @@ -494,11 +494,11 @@ void EnEiyer_Land(EnEiyer* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 7.0f, 1.0f); if (this->timer == -1) { - if (this->actor.bgCheckFlags & 8 || this->actor.bgCheckFlags & 1) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->timer = 10; SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_OCTAROCK_SINK); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 700); } } @@ -525,7 +525,7 @@ void EnEiyer_Hurt(EnEiyer* this, GlobalContext* globalCtx) { Math_ApproachF(&this->basePos.y, this->actor.floorHeight + 80.0f + 5.0f, 0.5f, this->actor.speedXZ); this->actor.world.pos.y = this->basePos.y - 5.0f; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->targetYaw = this->actor.wallYaw; } else { this->targetYaw = this->actor.yawTowardsPlayer + 0x8000; @@ -561,7 +561,7 @@ void EnEiyer_Die(EnEiyer* this, GlobalContext* globalCtx) { this->actor.world.rot.x = -this->actor.shape.rot.x; - if (this->timer == 0 || this->actor.bgCheckFlags & 0x10) { + if (this->timer == 0 || this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) { EnEiyer_SetupDead(this); } } @@ -588,7 +588,7 @@ void EnEiyer_Stunned(EnEiyer* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_EIER_FLUTTER); } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index ffb1716688..634a485ca4 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -242,7 +242,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCt while ((this->curNumSpawn < this->maxCurSpawns) && (this->totalNumSpawn < this->maxTotalSpawns)) { if (globalCtx->sceneNum == SCENE_SPOT00) { if ((player->unk_89E == 0) || (player->actor.floorBgId != BGCHECK_SCENE) || - !(player->actor.bgCheckFlags & 1) || (player->stateFlags1 & PLAYER_STATE1_27)) { + !(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (player->stateFlags1 & PLAYER_STATE1_27)) { this->fieldSpawnTimer = 60; break; diff --git a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c index 1ed9a7cb68..a96ee85684 100644 --- a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c +++ b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c @@ -213,7 +213,7 @@ void EnExRuppy_DropIntoWater(EnExRuppy* this, GlobalContext* globalCtx) { func_80078884(NA_SE_EV_RAINBOW_SHOWER - SFX_FLAG); divingGame = (EnDivingGame*)this->actor.parent; if ((divingGame != NULL) && (divingGame->actor.update != NULL) && - ((divingGame->unk_296 == 0) || (this->actor.bgCheckFlags & 0x20) || (this->timer == 0))) { + ((divingGame->unk_296 == 0) || (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) || (this->timer == 0))) { this->invisible = true; this->actor.speedXZ = 0.0f; this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; @@ -249,7 +249,7 @@ void EnExRuppy_Sink(EnExRuppy* this, GlobalContext* globalCtx) { Vec3f pos; s32 pad; - if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 15.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.yDistToWater > 15.0f)) { pos = this->actor.world.pos; pos.y += this->actor.yDistToWater; this->actor.velocity.y = -1.0f; diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 897160fdf5..bb7ce02b0b 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -501,7 +501,7 @@ void EnFd_SpinAndGrow(EnFd* this, GlobalContext* globalCtx) { } void EnFd_JumpToGround(EnFd* this, GlobalContext* globalCtx) { - if ((this->actor.bgCheckFlags & 1) && !(this->actor.velocity.y > 0.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(this->actor.velocity.y > 0.0f)) { this->actor.velocity.y = 0.0f; this->actor.speedXZ = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; diff --git a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c index b345994ee6..6e6c816aad 100644 --- a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c +++ b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c @@ -151,10 +151,10 @@ void func_80A0E70C(EnFdFire* this, GlobalContext* globalCtx) { targetPos.x += this->spawnRadius * Math_SinS(this->actor.world.rot.y); targetPos.z += this->spawnRadius * Math_CosS(this->actor.world.rot.y); EnFdFire_UpdatePos(this, &targetPos); - if (this->actor.bgCheckFlags & 1 && (!(this->actor.velocity.y > 0.0f))) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (!(this->actor.velocity.y > 0.0f))) { this->actor.velocity = velocity; this->actor.speedXZ = 0.0f; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; if (this->actor.params & 0x8000) { this->deathTimer = 200; this->actionFunc = EnFdFire_DanceTowardsPlayer; diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index 5f7894d73a..cf35c73c8b 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -302,7 +302,7 @@ void EnFhgFire_LightningShock(EnFhgFire* this, GlobalContext* globalCtx) { } Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 1); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Actor_Kill(&this->actor); } } @@ -588,7 +588,8 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { osSyncPrintf("fly_mode %d\n", bossGnd->flyMode); if (this->work[FHGFIRE_FX_TIMER] == 0) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 7); - if ((this->actor.bgCheckFlags & 0x19) || killMode) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING)) || + killMode) { u8 lightBallColor2 = FHGFLASH_LIGHTBALL_GREEN; s16 i4; Vec3f sp6C; diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index 60a21b266b..72d9946719 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -192,7 +192,7 @@ void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx) { } break; } - if ((this->actor.bgCheckFlags & 1) && (this->timer == 0)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->timer == 0)) { switch (this->type) { case FIRE_ROCK_SPAWNED_FALLING1: case FIRE_ROCK_SPAWNED_FALLING2: diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 05b653a25d..4cce4b161d 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -398,15 +398,16 @@ void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) { this->targetPitch = 0x2154; } } else { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->targetPitch = 0x954; - } else if ((this->actor.bgCheckFlags & 0x10) || (this->maxAltitude < this->actor.world.pos.y)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || + (this->maxAltitude < this->actor.world.pos.y)) { this->targetPitch = 0x2154; } } Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); } if ((this->timer == 0) && (this->actor.xzDistToPlayer < 200.0f) && @@ -431,7 +432,7 @@ void EnFirefly_Fall(EnFirefly* this, GlobalContext* globalCtx) { if (this->timer != 0) { this->timer--; } - if ((this->actor.bgCheckFlags & 1) || (this->timer == 0)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->timer == 0)) { EnFirefly_SetupDie(this); } } @@ -459,7 +460,7 @@ void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) { this->timer--; } Math_StepToF(&this->actor.speedXZ, 4.0f, 0.5f); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); } else if (Actor_IsFacingPlayer(&this->actor, 0x2800)) { @@ -478,10 +479,10 @@ void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) { if (this->actor.xzDistToPlayer > 80.0f) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xC00, 0x300); } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->targetPitch = 0x954; } - if ((this->actor.bgCheckFlags & 0x10) || (this->maxAltitude < this->actor.world.pos.y)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->maxAltitude < this->actor.world.pos.y)) { this->targetPitch = 0x2154; } else { this->targetPitch = 0x954; @@ -520,14 +521,14 @@ void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx) { return; } Math_StepToF(&this->actor.speedXZ, 3.0f, 0.3f); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->targetPitch = 0x954; - } else if ((this->actor.bgCheckFlags & 0x10) || (this->maxAltitude < this->actor.world.pos.y)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->maxAltitude < this->actor.world.pos.y)) { this->targetPitch = 0x2154; } else { this->targetPitch = 0x954; } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); } else { Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), @@ -554,7 +555,7 @@ void EnFirefly_Stunned(EnFirefly* this, GlobalContext* globalCtx) { } void EnFirefly_FrozenFall(EnFirefly* this, GlobalContext* globalCtx) { - if ((this->actor.bgCheckFlags & 1) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { this->actor.colorFilterTimer = 0; EnFirefly_SetupDie(this); } else { diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index ea9b2a81ba..1ccada4857 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -377,10 +377,10 @@ void EnFish_Dropped_Fall(EnFish* this, GlobalContext* globalCtx) { this->actor.shape.rot.z = this->actor.world.rot.z; SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 1) { // On floor + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->timer = 400; EnFish_Dropped_SetupFlopOnGround(this); - } else if (this->actor.bgCheckFlags & 0x20) { // In water + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { EnFish_Dropped_SetupSwimAway(this); } else if ((this->timer <= 0) && (this->actor.params == FISH_DROPPED) && (this->actor.floorHeight < BGCHECK_Y_MIN + 10.0f)) { @@ -464,9 +464,9 @@ void EnFish_Dropped_FlopOnGround(EnFish* this, GlobalContext* globalCtx) { } else { this->actor.draw = NULL; } - } else if (this->actor.bgCheckFlags & 0x20) { // In water + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { EnFish_Dropped_SetupSwimAway(this); - } else if (this->actor.bgCheckFlags & 1) { // On floor + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EnFish_Dropped_SetupFlopOnGround(this); } } @@ -489,7 +489,7 @@ void EnFish_Dropped_SwimAway(EnFish* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.speedXZ, 2.8f, 0.1f, 0.4f, 0.0f); // If touching wall or not in water, turn back and slow down for one frame. - if ((this->actor.bgCheckFlags & 8) || !(this->actor.bgCheckFlags & 0x20)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { this->actor.home.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); this->actor.speedXZ *= 0.5f; } @@ -501,7 +501,7 @@ void EnFish_Dropped_SwimAway(EnFish* this, GlobalContext* globalCtx) { this->actor.shape.rot = this->actor.world.rot; // Raise if on a floor. - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 4.0f, 2.0f); } else { Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 10.0f, 2.0f); diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index fbc515f18a..a64ae337b8 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -485,7 +485,7 @@ void EnFloormas_BigWalk(EnFloormas* this, GlobalContext* globalCtx) { if ((this->actor.xzDistToPlayer < 320.0f) && (Actor_IsFacingPlayer(&this->actor, 0x4000))) { EnFloormas_SetupRun(this); - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { // set target rotation to the colliding wall's rotation this->actionTarget = this->actor.wallYaw; EnFloormas_SetupTurn(this); @@ -514,7 +514,7 @@ void EnFloormas_Run(EnFloormas* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x71C); if ((this->actor.xzDistToPlayer < 280.0f) && Actor_IsFacingPlayer(&this->actor, 0x2000) && - !(this->actor.bgCheckFlags & 8)) { + !(this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { EnFloormas_SetupHover(this, globalCtx); } else if (this->actor.xzDistToPlayer > 400.0f) { EnFloormas_SetupBigWalk(this); @@ -605,7 +605,7 @@ void EnFloormas_Charge(EnFloormas* this, GlobalContext* globalCtx) { EnFloormas_Slide(this, globalCtx); } - if ((this->actor.bgCheckFlags & 8) || (this->actionTimer == 0)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actionTimer == 0)) { EnFloormas_SetupLand(this); } } @@ -613,8 +613,8 @@ void EnFloormas_Charge(EnFloormas* this, GlobalContext* globalCtx) { void EnFloormas_Land(EnFloormas* this, GlobalContext* globalCtx) { s32 isOnGround; - isOnGround = this->actor.bgCheckFlags & 1; - if (this->actor.bgCheckFlags & 2) { + isOnGround = this->actor.bgCheckFlags & BGCHECKFLAG_GROUND; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (this->actor.params != MERGE_MASTER) { EnFloormas_MakeVulnerable(this); } @@ -627,7 +627,7 @@ void EnFloormas_Land(EnFloormas* this, GlobalContext* globalCtx) { } } } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.speedXZ = 0.0f; } @@ -661,7 +661,7 @@ void EnFloormas_Land(EnFloormas* this, GlobalContext* globalCtx) { } void EnFloormas_Split(EnFloormas* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (SkelAnime_Update(&this->skelAnime)) { this->actor.flags |= ACTOR_FLAG_0; this->smActionTimer = 50; @@ -670,7 +670,7 @@ void EnFloormas_Split(EnFloormas* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 0.0f, 1.0f); } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SM_LAND); } } @@ -685,7 +685,7 @@ void EnFloormas_SmWalk(EnFloormas* this, GlobalContext* globalCtx) { if (this->smActionTimer == 0) { EnFloormas_SetupSmDecideAction(this); - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actionTarget = this->actor.wallYaw; EnFloormas_SetupTurn(this); } else if (this->actor.xzDistToPlayer < 120.0f) { @@ -701,7 +701,7 @@ void EnFloormas_SmDecideAction(EnFloormas* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 18.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SM_WALK); } - isAgainstWall = this->actor.bgCheckFlags & 8; + isAgainstWall = this->actor.bgCheckFlags & BGCHECKFLAG_WALL; if (isAgainstWall) { this->actionTarget = this->actor.wallYaw; EnFloormas_SetupTurn(this); @@ -747,7 +747,7 @@ void EnFloormas_JumpAtLink(EnFloormas* this, GlobalContext* globalCtx) { } else if (Animation_OnFrame(&this->skelAnime, 20.0f)) { this->actor.speedXZ = 5.0f; this->actor.velocity.y = 7.0f; - } else if (this->actor.bgCheckFlags & 2) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actionTimer = 0x32; this->actor.speedXZ = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SM_LAND); @@ -832,7 +832,7 @@ void EnFloormas_SmSlaveJumpAtMaster(EnFloormas* this, GlobalContext* globalCtx) } else if (this->actor.child->params == MERGE_MASTER) { primFloormas = this->actor.child; } else { - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.params = 0x10; EnFloormas_SetupLand(this); } @@ -848,7 +848,7 @@ void EnFloormas_SmSlaveJumpAtMaster(EnFloormas* this, GlobalContext* globalCtx) (fabsf(this->actor.world.pos.z - primFloormas->world.pos.z) < 10.0f)) { EnFloormas_SetupSmWait(this); this->collider.base.ocFlags1 |= OC1_ON; - } else if (this->actor.bgCheckFlags & 2) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_FLOORMASTER_SM_LAND); EnFloormas_SetupLand(this); diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c index 22100e2269..e3a876dabe 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -80,7 +80,7 @@ static AnimationInfo sAnimationInfo[] = { s32 EnFw_DoBounce(EnFw* this, s32 totalBounces, f32 yVelocity) { s16 temp_v1; - if (!(this->actor.bgCheckFlags & 1) || (this->actor.velocity.y > 0.0f)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.velocity.y > 0.0f)) { // not on the ground or moving upwards. return false; } @@ -267,7 +267,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) { return; } } else { - if (!(this->actor.bgCheckFlags & 1) || this->actor.velocity.y > 0.0f) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || this->actor.velocity.y > 0.0f) { Actor_SetColorFilter(&this->actor, 0x4000, 0xC8, 0, this->damageTimer); return; } @@ -348,7 +348,7 @@ void EnFw_TurnToParentInitPos(EnFw* this, GlobalContext* globalCtx) { } void EnFw_JumpToParentInitPos(EnFw* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 1 && this->actor.velocity.y <= 0.0f) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && this->actor.velocity.y <= 0.0f) { this->actor.parent->params |= 0x8000; Actor_Kill(&this->actor); } else { diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c index 7ec18b18a6..8f8ab14156 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c @@ -322,9 +322,9 @@ void EnFz_ApplyDamage(EnFz* this, GlobalContext* globalCtx) { Vec3f vec; if (this->isMoving && - ((this->actor.bgCheckFlags & 8) || + ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (Actor_TestFloorInDirection(&this->actor, globalCtx, 60.0f, this->actor.world.rot.y) == 0))) { - this->actor.bgCheckFlags &= ~8; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; this->isMoving = false; this->speedXZ = 0.0f; this->actor.speedXZ = 0.0f; diff --git a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c index 8127adb631..34bc6b5a47 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -292,7 +292,8 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) { } if (func_800354B4(globalCtx, thisx, 100.0f, 0x5DC0, 0x2AA8, thisx->shape.rot.y)) { thisx->shape.rot.y = thisx->world.rot.y = thisx->yawTowardsPlayer; - if ((thisx->bgCheckFlags & 8) && (ABS(angleToWall) < 0x2EE0) && (thisx->xzDistToPlayer < 90.0f)) { + if ((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 0x2EE0) && + (thisx->xzDistToPlayer < 90.0f)) { EnGeldB_SetupJump(this); return true; } else if (player->swordAnimation == 0x11) { @@ -307,7 +308,7 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) { } } else if ((bomb = Actor_FindNearby(globalCtx, thisx, -1, ACTORCAT_EXPLOSIVE, 80.0f)) != NULL) { thisx->shape.rot.y = thisx->world.rot.y = thisx->yawTowardsPlayer; - if (((thisx->bgCheckFlags & 8) && (angleToWall < 0x2EE0)) || (bomb->id == ACTOR_EN_BOM_CHU)) { + if (((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (angleToWall < 0x2EE0)) || (bomb->id == ACTOR_EN_BOM_CHU)) { if ((bomb->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(thisx, bomb) < 80.0f) && ((s16)(thisx->shape.rot.y - (bomb->world.rot.y - 0x8000)) < 0x3E80)) { EnGeldB_SetupJump(this); @@ -346,7 +347,7 @@ void EnGeldB_SetupWait(EnGeldB* this) { this->timer = 10; this->invisible = true; this->action = GELDB_WAIT; - this->actor.bgCheckFlags &= ~3; + this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH); this->actor.gravity = -2.0f; this->actor.flags &= ~ACTOR_FLAG_0; EnGeldB_SetupAction(this, EnGeldB_Wait); @@ -362,13 +363,13 @@ void EnGeldB_Wait(EnGeldB* this, GlobalContext* globalCtx) { this->actor.shape.shadowScale = 90.0f; func_800F5ACC(NA_BGM_MINI_BOSS); } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_DOWN); this->skelAnime.playSpeed = 1.0f; this->actor.world.pos.y = this->actor.floorHeight; this->actor.flags |= ACTOR_FLAG_0; this->actor.focus.pos = this->actor.world.pos; - this->actor.bgCheckFlags &= ~2; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.velocity.y = 0.0f; Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); @@ -666,9 +667,10 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) { this->actor.speedXZ = 8.0f; } } - if ((this->actor.bgCheckFlags & 8) || !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, - this->actor.shape.rot.y + 0x3E80)) { - if (this->actor.bgCheckFlags & 8) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || + !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, + this->actor.shape.rot.y + 0x3E80)) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { phi_v1 = this->actor.shape.rot.y + 0x3E80; } else { @@ -765,9 +767,9 @@ void EnGeldB_SpinDodge(EnGeldB* this, GlobalContext* globalCtx) { s32 nextKeyFrame; this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x3A98; - if ((this->actor.bgCheckFlags & 8) || + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) { - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { phi_v1 = this->actor.shape.rot.y + 0x3E80; } else { @@ -997,7 +999,7 @@ void EnGeldB_RollBack(EnGeldB* this, GlobalContext* globalCtx) { } void EnGeldB_SetupStunned(EnGeldB* this) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speedXZ = 0.0f; } if ((this->damageEffect != GELDB_DMG_FREEZE) || (this->action == GELDB_SPIN_ATTACK)) { @@ -1012,16 +1014,16 @@ void EnGeldB_SetupStunned(EnGeldB* this) { } void EnGeldB_Stunned(EnGeldB* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.05f; } this->invisible = false; } - if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { EnGeldB_SetupDefeated(this); } else { @@ -1032,7 +1034,7 @@ void EnGeldB_Stunned(EnGeldB* this, GlobalContext* globalCtx) { void EnGeldB_SetupDamaged(EnGeldB* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gGerudoRedDamageAnim, -4.0f); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->invisible = false; this->actor.speedXZ = -4.0f; } else { @@ -1048,10 +1050,10 @@ void EnGeldB_SetupDamaged(EnGeldB* this) { void EnGeldB_Damaged(EnGeldB* this, GlobalContext* globalCtx) { s16 angleToWall; - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.05f; } @@ -1059,9 +1061,10 @@ void EnGeldB_Damaged(EnGeldB* this, GlobalContext* globalCtx) { } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0) && - SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) { + SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { angleToWall = this->actor.wallYaw - this->actor.shape.rot.y; - if ((this->actor.bgCheckFlags & 8) && (ABS(angleToWall) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 0x2EE0) && + (this->actor.xzDistToPlayer < 90.0f)) { EnGeldB_SetupJump(this); } else if (!EnGeldB_DodgeRanged(globalCtx, this)) { if ((this->actor.xzDistToPlayer <= 45.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && @@ -1094,7 +1097,8 @@ void EnGeldB_Jump(EnGeldB* this, GlobalContext* globalCtx) { func_800355B8(globalCtx, &this->leftFootPos); func_800355B8(globalCtx, &this->rightFootPos); } - if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 3)) { + if (SkelAnime_Update(&this->skelAnime) && + (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.shape.rot.x = 0; this->actor.speedXZ = 0.0f; @@ -1214,9 +1218,9 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { this->actor.speedXZ -= 0.125f; } - if ((this->actor.bgCheckFlags & 8) || + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y + 0x3E80)) { - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { phi_v1 = this->actor.shape.rot.y + 0x3E80; } else { @@ -1307,7 +1311,7 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { void EnGeldB_SetupDefeated(EnGeldB* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gGerudoRedDefeatAnim, -4.0f); this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->invisible = false; this->actor.speedXZ = -6.0f; } else { @@ -1320,10 +1324,10 @@ void EnGeldB_SetupDefeated(EnGeldB* this) { } void EnGeldB_Defeated(EnGeldB* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); this->invisible = false; } diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 568cb67fcf..a3bea0770a 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -540,7 +540,7 @@ s32 EnGo_SpawnDust(EnGo* this, u8 initialTimer, f32 scale, f32 scaleStep, s32 nu } s32 EnGo_IsRollingOnGround(EnGo* this, s16 unkArg1, f32 unkArg2) { - if ((this->actor.bgCheckFlags & 1) == 0 || this->actor.velocity.y > 0.0f) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || this->actor.velocity.y > 0.0f) { return false; } else if (this->unk_1E0.unk_00 != 0) { return true; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 6fd1308794..a49a17b16d 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -969,7 +969,7 @@ s32 EnGo2_IsWakingUp(EnGo2* this) { } s32 EnGo2_IsRollingOnGround(EnGo2* this, s16 arg1, f32 arg2, s16 arg3) { - if ((this->actor.bgCheckFlags & 1) == 0 || this->actor.velocity.y > 0.0f) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || this->actor.velocity.y > 0.0f) { return false; } diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/src/overlays/actors/ovl_En_Goma/z_en_goma.c index d8e4fa58c7..b027a39421 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -212,7 +212,7 @@ void EnGoma_EggFallToGround(EnGoma* this, GlobalContext* globalCtx) { switch (this->hatchState) { case 0: - if (this->actor.bgCheckFlags & 1) { // floor + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.params < 6) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_BJR_EGG1); } else { @@ -258,7 +258,7 @@ void EnGoma_EggFallToGround(EnGoma* this, GlobalContext* globalCtx) { break; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_ApproachZeroF(&this->actor.speedXZ, 0.2f, 0.05f); } this->eggPitch += (this->actor.speedXZ * 0.1f); @@ -340,7 +340,7 @@ void EnGoma_SetupHurt(EnGoma* this, GlobalContext* globalCtx) { void EnGoma_Hurt(EnGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 2.0f); } @@ -372,7 +372,7 @@ void EnGoma_SetupDie(EnGoma* this) { void EnGoma_Die(EnGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 2.0f); } @@ -475,7 +475,7 @@ void EnGoma_SetupLand(EnGoma* this) { void EnGoma_Land(EnGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 2.0f); } if (this->actionTimer == 0) { @@ -501,7 +501,7 @@ void EnGoma_Jump(EnGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); Math_ApproachF(&this->actor.speedXZ, 10.0f, 0.5f, 5.0f); - if (this->actor.velocity.y <= 0.0f && (this->actor.bgCheckFlags & 1)) { + if (this->actor.velocity.y <= 0.0f && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { EnGoma_SetupLand(this); if (this->actor.params < 6) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_BJR_LAND2); @@ -538,7 +538,7 @@ void EnGoma_ChasePlayer(EnGoma* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 3, 2000); Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 2, 3000); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.velocity.y = 0.0f; } if (this->actor.xzDistToPlayer <= 150.0f) { @@ -567,7 +567,7 @@ void EnGoma_Stunned(EnGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.velocity.y = 0.0f; Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); } @@ -878,7 +878,7 @@ void EnGoma_BossLimb(EnGoma* this, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 4); this->actor.world.pos.y += 5.0f; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.velocity.y = 0.0f; } else if (this->actionTimer < 250) { this->actor.shape.rot.y += 2000; diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index a41a5e98fe..4a681038f4 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -643,7 +643,7 @@ void EnGoroiwa_SetupMoveAndFallToGround(EnGoroiwa* this) { void EnGoroiwa_MoveAndFallToGround(EnGoroiwa* this, GlobalContext* globalCtx) { EnGoroiwa_MoveAndFall(this, globalCtx); - if ((this->actor.bgCheckFlags & 1) && this->actor.velocity.y < 0.0f) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && this->actor.velocity.y < 0.0f) { if ((this->stateFlags & ENGOROIWA_PLAYER_IN_THE_WAY) && (this->actor.home.rot.z & 1) == 1) { EnGoroiwa_ReverseDirection(this); EnGoroiwa_FaceNextWaypoint(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 1572f6c8e0..cec8be9f3b 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -363,7 +363,7 @@ void func_80A4ED34(EnGs* this, GlobalContext* globalCtx) { if (this->unk_19F == 4) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 3); - if (this->actor.bgCheckFlags & 0x18) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING)) { bomb2Pos.x = this->actor.world.pos.x; bomb2Pos.y = this->actor.world.pos.y; bomb2Pos.z = this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c index 1db2f7c48b..4fa029e8e5 100644 --- a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c +++ b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c @@ -352,9 +352,9 @@ void EnHintnuts_Run(EnHintnuts* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 7.5f, 1.0f); if (Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_196, 1, 0xE38, 0xB6) == 0) { - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { this->unk_196 = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_196 = this->actor.wallYaw; } else if (this->animFlagAndTimer == 0) { diffRotInit = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); @@ -405,7 +405,7 @@ void EnHintnuts_Leave(EnHintnuts* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 6.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_NUTS_WALK); } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { temp_a1 = this->actor.wallYaw; } else { temp_a1 = this->actor.yawTowardsPlayer - Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - 0x8000; diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c index c233e7464f..fd8cf116ea 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -430,7 +430,7 @@ void EnHonotrap_FlameChase(EnHonotrap* this, GlobalContext* globalCtx) { this->actor.speedXZ *= 0.1f; this->actor.velocity.y *= 0.1f; EnHonotrap_SetupFlameVanish(this); - } else if ((this->actor.bgCheckFlags & 8) || (this->timer <= 0)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->timer <= 0)) { EnHonotrap_SetupFlameVanish(this); } else { EnHonotrap_FlameCollisionCheck(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 30406892b5..ac31a136a4 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -3122,7 +3122,8 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, GlobalContext* globalCtx) { } // void 0 trick required to match, but is surely not real. revisit at a later time - if (this->actor.bgCheckFlags & 8 && Math_CosS(this->actor.wallYaw - ((void)0, this->actor.world).rot.y) < -0.3f) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && + Math_CosS(this->actor.wallYaw - ((void)0, this->actor.world).rot.y) < -0.3f) { if (this->actor.speedXZ > 4.0f) { this->actor.speedXZ -= 1.0f; Audio_PlaySoundGeneral(NA_SE_EV_HORSE_SANDDUST, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c index 1fcf51d230..cae3aa9dd2 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c @@ -395,7 +395,7 @@ void EnHorseNormal_Wander(EnHorseNormal* this, GlobalContext* globalCtx) { this->actor.speedXZ = 8.0f; phi_t0 = 6; } - if (Rand_ZeroOne() < 0.1f || (this->unk_21E == 0 && ((this->actor.bgCheckFlags & 8) || + if (Rand_ZeroOne() < 0.1f || (this->unk_21E == 0 && ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->bodyCollider.base.ocFlags1 & OC1_HIT) || (this->headCollider.base.ocFlags1 & OC1_HIT)))) { this->unk_21E += (Rand_ZeroOne() * 30.0f) - 15.0f; diff --git a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c index b8c353dc35..01e82208df 100644 --- a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c +++ b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c @@ -231,7 +231,7 @@ void EnIceHono_SetupActionDroppedFlame(EnIceHono* this) { } void EnIceHono_DropFlame(EnIceHono* this, GlobalContext* globalCtx) { - u32 bgFlag = this->actor.bgCheckFlags & 1; + u32 bgFlag = this->actor.bgCheckFlags & BGCHECKFLAG_GROUND; Math_StepToF(&this->actor.scale.x, 0.0017f, 0.00008f); this->actor.scale.z = this->actor.scale.x; diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index b3736949f1..8d534751b6 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -369,7 +369,7 @@ void func_80A74BA4(EnIk* this, GlobalContext* globalCtx) { sp2E = 9; } temp_a1 = this->actor.wallYaw - this->actor.shape.rot.y; - if ((this->actor.bgCheckFlags & 8) && (ABS(temp_a1) >= 0x4000)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(temp_a1) >= 0x4000)) { temp_a1 = (this->actor.yawTowardsPlayer > 0) ? this->actor.wallYaw - 0x4000 : this->actor.wallYaw + 0x4000; Math_SmoothStepToS(&this->actor.world.rot.y, temp_a1, 1, phi_a3, 0); } else { diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.c b/src/overlays/actors/ovl_En_Insect/z_en_insect.c index f343cb2155..3158f71f4a 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -260,9 +260,10 @@ void func_80A7C3F4(EnInsect* this, GlobalContext* globalCtx) { } if (((this->unk_314 & 4) && this->unk_31C <= 0) || - ((sp2E == 2 || sp2E == 3) && (this->unk_314 & 1) && (this->actor.bgCheckFlags & 1) && D_80A7DEB8 >= 4)) { + ((sp2E == 2 || sp2E == 3) && (this->unk_314 & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + D_80A7DEB8 >= 4)) { func_80A7CBC8(this); - } else if ((this->unk_314 & 1) && (this->actor.bgCheckFlags & 0x40)) { + } else if ((this->unk_314 & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { func_80A7CE60(this); } else if (this->actor.xzDistToPlayer < 40.0f) { func_80A7C818(this); @@ -302,9 +303,10 @@ void func_80A7C5EC(EnInsect* this, GlobalContext* globalCtx) { } if (((this->unk_314 & 4) && this->unk_31C <= 0) || - ((sp34 == 2 || sp34 == 3) && (this->unk_314 & 1) && (this->actor.bgCheckFlags & 1) && D_80A7DEB8 >= 4)) { + ((sp34 == 2 || sp34 == 3) && (this->unk_314 & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + D_80A7DEB8 >= 4)) { func_80A7CBC8(this); - } else if ((this->unk_314 & 1) && (this->actor.bgCheckFlags & 0x40)) { + } else if ((this->unk_314 & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { func_80A7CE60(this); } else if (this->actor.xzDistToPlayer < 40.0f) { func_80A7C818(this); @@ -353,7 +355,7 @@ void func_80A7C86C(EnInsect* this, GlobalContext* globalCtx) { if (this->unk_31A <= 0 || !sp38) { func_80A7C3A0(this); - } else if ((this->unk_314 & 1) && (this->actor.bgCheckFlags & 0x40)) { + } else if ((this->unk_314 & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { func_80A7CE60(this); } } @@ -510,7 +512,7 @@ void func_80A7CEC0(EnInsect* this, GlobalContext* globalCtx) { if (this->unk_31A <= 0 || ((this->unk_314 & 4) && this->unk_31C <= 0) || ((sp4E == 2 || sp4E == 3) && (this->unk_314 & 1) && D_80A7DEB8 >= 4)) { func_80A7D1F4(this); - } else if (!(this->actor.bgCheckFlags & 0x40)) { + } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { if (this->unk_314 & 0x10) { func_80A7D39C(this); } else { @@ -634,7 +636,7 @@ void func_80A7D460(EnInsect* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, CLAMP_MAX(thisTemp->actor.scale.x + 0.0008f, 0.01f)); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.speedXZ, this->unk_324, 0.1f, 0.5f, 0.0f); Math_ScaledStepToS(&this->actor.world.rot.y, this->unk_328, 2000); sp50 = Math_ScaledStepToS(&this->actor.world.rot.x, 0, 2000); @@ -662,7 +664,7 @@ void func_80A7D460(EnInsect* this, GlobalContext* globalCtx) { } SkelAnime_Update(&this->skelAnime); - if (!(this->unk_314 & 0x40) && (this->unk_314 & 1) && (this->actor.bgCheckFlags & 1)) { + if (!(this->unk_314 & 0x40) && (this->unk_314 & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MUSI_LAND); this->unk_314 |= 0x40; } @@ -681,13 +683,13 @@ void func_80A7D460(EnInsect* this, GlobalContext* globalCtx) { } } - if ((this->unk_314 & 1) && (this->actor.bgCheckFlags & 0x40)) { + if ((this->unk_314 & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { func_80A7CE60(this); } else if (this->unk_314 & 0x10) { if (sp40 < 9.0f) { func_80A7CBC8(this); } else if (this->unk_31A <= 0 || this->unk_31C <= 0 || - ((this->unk_314 & 1) && (this->actor.bgCheckFlags & 1) && D_80A7DEB8 >= 4 && + ((this->unk_314 & 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && D_80A7DEB8 >= 4 && (sp3A == 2 || sp3A == 3))) { func_80A7CBC8(this); } else { @@ -736,7 +738,7 @@ void EnInsect_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); if (this->unk_314 & 0x100) { if (this->unk_314 & 1) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_80A7C058(this); } } else { diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index b69666737d..d2be218e50 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -145,11 +145,11 @@ void EnIshi_SpawnFragmentsSmall(EnIshi* this, GlobalContext* globalCtx) { pos.y = this->actor.world.pos.y + (Rand_ZeroOne() * 5.0f) + 5.0f; pos.z = this->actor.world.pos.z + (Rand_ZeroOne() - 0.5f) * 8.0f; Math_Vec3f_Copy(&velocity, &this->actor.velocity); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { velocity.x *= 0.8f; velocity.y *= -0.8f; velocity.z *= 0.8f; - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { velocity.x *= -0.8f; velocity.y *= 0.8f; velocity.z *= -0.8f; @@ -185,11 +185,11 @@ void EnIshi_SpawnFragmentsLarge(EnIshi* this, GlobalContext* globalCtx) { pos.y = this->actor.world.pos.y + (Rand_ZeroOne() * 40.0f) + 5.0f; pos.z = this->actor.world.pos.z + (Math_CosS(angle) * rand); Math_Vec3f_Copy(&velocity, &thisx->velocity); - if (thisx->bgCheckFlags & 1) { + if (thisx->bgCheckFlags & BGCHECKFLAG_GROUND) { velocity.x *= 0.9f; velocity.y *= -0.8f; velocity.z *= 0.9f; - } else if (thisx->bgCheckFlags & 8) { + } else if (thisx->bgCheckFlags & BGCHECKFLAG_WALL) { velocity.x *= -0.9f; velocity.y *= 0.8f; velocity.z *= -0.9f; @@ -217,11 +217,11 @@ void EnIshi_SpawnDustSmall(EnIshi* this, GlobalContext* globalCtx) { Vec3f pos; Math_Vec3f_Copy(&pos, &this->actor.world.pos); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { pos.x += 2.0f * this->actor.velocity.x; pos.y -= 2.0f * this->actor.velocity.y; pos.z += 2.0f * this->actor.velocity.z; - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { pos.x -= 2.0f * this->actor.velocity.x; pos.y += 2.0f * this->actor.velocity.y; pos.z -= 2.0f * this->actor.velocity.z; @@ -233,11 +233,11 @@ void EnIshi_SpawnDustLarge(EnIshi* this, GlobalContext* globalCtx) { Vec3f pos; Math_Vec3f_Copy(&pos, &this->actor.world.pos); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { pos.x += 2.0f * this->actor.velocity.x; pos.y -= 2.0f * this->actor.velocity.y; pos.z += 2.0f * this->actor.velocity.z; - } else if (this->actor.bgCheckFlags & 8) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { pos.x -= 2.0f * this->actor.velocity.x; pos.y += 2.0f * this->actor.velocity.y; pos.z -= 2.0f * this->actor.velocity.z; @@ -420,10 +420,10 @@ void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) { s32 quakeIdx; Vec3f contactPos; - if (this->actor.bgCheckFlags & 9) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)) { EnIshi_DropCollectible(this, globalCtx); sFragmentSpawnFuncs[type](this, globalCtx); - if (!(this->actor.bgCheckFlags & 0x20)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, sBreakSoundDurations[type], sBreakSounds[type]); sDustSpawnFuncs[type](this, globalCtx); @@ -438,7 +438,7 @@ void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) { Actor_Kill(&this->actor); return; } - if (this->actor.bgCheckFlags & 0x40) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { contactPos.x = this->actor.world.pos.x; contactPos.y = this->actor.world.pos.y + this->actor.yDistToWater; contactPos.z = this->actor.world.pos.z; @@ -456,7 +456,7 @@ void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) { sRotSpeedX >>= 2; sRotSpeedY >>= 2; SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); - this->actor.bgCheckFlags &= ~0x40; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; } Math_StepToF(&this->actor.shape.yOffset, 0.0f, 2.0f); EnIshi_Fall(this); diff --git a/src/overlays/actors/ovl_En_Js/z_en_js.c b/src/overlays/actors/ovl_En_Js/z_en_js.c index a82a9caccd..16837228d1 100644 --- a/src/overlays/actors/ovl_En_Js/z_en_js.c +++ b/src/overlays/actors/ovl_En_Js/z_en_js.c @@ -173,7 +173,7 @@ void EnJs_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(&this->actor); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) == 1) { Math_ApproachF(&this->actor.shape.yOffset, sREG(80) + -2000.0f, 1.0f, (sREG(81) / 10.0f) + 50.0f); } diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index d78e5306a6..2e0195fd25 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -140,7 +140,7 @@ void func_80A8F320(EnKakasi* this, GlobalContext* globalCtx, s16 arg) { if (this->unk_19A != 0) { this->actor.gravity = -1.0f; - if (this->unk_19A == 8 && (this->actor.bgCheckFlags & 1)) { + if (this->unk_19A == 8 && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.velocity.y = 3.0f; Audio_PlayActorSound2(&this->actor, NA_SE_IT_KAKASHI_JUMP); } diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index 1c62282cc5..00ccd15ee2 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -143,7 +143,7 @@ void func_80A90EBC(EnKakasi3* this, GlobalContext* globalCtx, s32 arg) { if (this->unk_19A != 0) { this->actor.gravity = -1.0f; - if (this->unk_19A == 8 && (this->actor.bgCheckFlags & 1)) { + if (this->unk_19A == 8 && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.velocity.y = 3.0f; Audio_PlayActorSound2(&this->actor, NA_SE_IT_KAKASHI_JUMP); } diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index 465f79e895..be8da1469e 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -445,7 +445,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.yDistToWater = tempYDistToWater; osSyncPrintf(VT_RST); - onGround = (this->actor.bgCheckFlags & 1); + onGround = (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); if (this->spinXFlag) { this->spinRot.x += this->spinVel.x; this->spinVel.x -= 0x800; @@ -482,11 +482,11 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->spinVel.z < -0xC00) { this->spinVel.z = -0xC00; } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.speedXZ *= -0.5f; Audio_PlayActorSound2(&this->actor, NA_SE_EV_WOODPLATE_BOUND); } - if (this->actor.bgCheckFlags & 0x40) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { this->actionState = ENKANBAN_WATER; Audio_PlayActorSound2(&this->actor, NA_SE_EV_BOMB_DROP_WATER); this->bounceX = this->bounceZ = 0; @@ -594,13 +594,13 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { this->spinVel.y = this->actor.speedXZ * -1000.0f; } } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speedXZ = 0.0f; } Actor_MoveForward(&this->actor); if (this->actor.speedXZ != 0.0f) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 50.0f, 5); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.speedXZ *= -0.5f; if (this->spinVel.y > 0) { this->spinVel.y = -0x7D0; diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index ec69c25984..b0e5b9213b 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -325,7 +325,8 @@ void EnKarebaba_Dying(EnKarebaba* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4800, 0x71C); EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 3.0f, 0, 12, 5, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); - if (this->actor.scale.x > 0.005f && ((this->actor.bgCheckFlags & 2) || (this->actor.bgCheckFlags & 8))) { + if (this->actor.scale.x > 0.005f && + ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) || (this->actor.bgCheckFlags & BGCHECKFLAG_WALL))) { this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = 0.0f; this->actor.speedXZ = 0.0f; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); @@ -333,7 +334,7 @@ void EnKarebaba_Dying(EnKarebaba* this, GlobalContext* globalCtx) { NULL); } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); this->actor.params = 1; } diff --git a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index bfe59cf2a2..bc3b39f88a 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -369,8 +369,8 @@ void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { s32 pad; Vec3f contactPos; - if (this->actor.bgCheckFlags & 0xB) { - if (!(this->actor.bgCheckFlags & 0x20)) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); } EnKusa_SpawnFragments(this, globalCtx); @@ -388,7 +388,7 @@ void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { return; } - if (this->actor.bgCheckFlags & 0x40) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { contactPos.x = this->actor.world.pos.x; contactPos.y = this->actor.world.pos.y + this->actor.yDistToWater; contactPos.z = this->actor.world.pos.z; @@ -401,7 +401,7 @@ void EnKusa_Fall(EnKusa* this, GlobalContext* globalCtx) { rotSpeedXtarget >>= 1; rotSpeedY >>= 1; rotSpeedYtarget >>= 1; - this->actor.bgCheckFlags &= ~0x40; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); } diff --git a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c index 04f4a18e2e..ff3a411fc7 100644 --- a/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c +++ b/src/overlays/actors/ovl_En_Lightbox/z_en_lightbox.c @@ -77,24 +77,24 @@ void EnLightbox_Update(Actor* thisx, GlobalContext* globalCtx) { this->dyna.unk_162++; } else { if (thisx->speedXZ) { - if (thisx->bgCheckFlags & 8) { + if (thisx->bgCheckFlags & BGCHECKFLAG_WALL) { thisx->world.rot.y = (thisx->world.rot.y + thisx->wallYaw) - thisx->world.rot.y; Audio_PlaySoundGeneral(NA_SE_EV_BOMB_BOUND, &thisx->projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); thisx->speedXZ *= 0.7f; - thisx->bgCheckFlags &= ~0x8; + thisx->bgCheckFlags &= ~BGCHECKFLAG_WALL; } } - if ((thisx->bgCheckFlags & 1) == 0) { + if (!(thisx->bgCheckFlags & BGCHECKFLAG_GROUND)) { Math_StepToF(&thisx->speedXZ, 0, IREG(57) / 100.0f); } else { Math_StepToF(&thisx->speedXZ, 0, IREG(58) / 100.0f); - if ((thisx->bgCheckFlags & 2) && (thisx->velocity.y < IREG(59) / 100.0f)) { + if ((thisx->bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) && (thisx->velocity.y < IREG(59) / 100.0f)) { Audio_PlaySoundGeneral(NA_SE_EV_BOMB_BOUND, &thisx->projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); thisx->velocity.y *= IREG(60) / 100.0f; - thisx->bgCheckFlags &= ~0x1; + thisx->bgCheckFlags &= ~BGCHECKFLAG_GROUND; } else { func_8002F580(thisx, globalCtx); } diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 25d7e49800..aea4e85a67 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -534,7 +534,7 @@ void EnMb_SetupSpearEndChargeQuick(EnMb* this) { void EnMb_SetupSpearPatrolEndCharge(EnMb* this) { Animation_PlayOnce(&this->skelAnime, &gEnMbSpearSlowDownAnim); this->state = ENMB_STATE_ATTACK_END; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->timer1 = 0; this->timer3 = 50; this->actor.speedXZ = -8.0f; @@ -725,7 +725,7 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx) { func_8002F71C(globalCtx, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.5f, 0.0f); if (this->actor.speedXZ > 1.0f) { diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 76bc2d827d..ec2d6574a2 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -373,7 +373,7 @@ void func_80AB6100(EnNiw* this, GlobalContext* globalCtx, s32 arg2) { if (this->timer4 == 0) { this->timer4 = 3; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.velocity.y = 3.5f; } } @@ -388,7 +388,7 @@ void func_80AB6100(EnNiw* this, GlobalContext* globalCtx, s32 arg2) { factor = -D_80AB860C[arg2]; } if (arg2 == 1) { - if (this->timer6 == 0 || this->actor.bgCheckFlags & 8) { + if (this->timer6 == 0 || this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->timer6 = 150; if (this->timer8 == 0) { this->timer8 = 70; @@ -429,7 +429,7 @@ void func_80AB6324(EnNiw* this, GlobalContext* globalCtx) { } void func_80AB63A8(EnNiw* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 1 && this->actor.velocity.y < 0.0f) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && this->actor.velocity.y < 0.0f) { this->unk_2AC.x = this->unk_2B8.x = this->actor.world.pos.x; this->unk_2AC.y = this->unk_2B8.y = this->actor.world.pos.y; this->unk_2AC.z = this->unk_2B8.z = this->actor.world.pos.z; @@ -550,7 +550,7 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) { this->unk_2B8.z = this->unk_2AC.z + posZ; } else { this->timer4 = 4; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speedXZ = 0.0f; this->actor.velocity.y = 3.5f; } @@ -648,7 +648,7 @@ void func_80AB6BF8(EnNiw* this, GlobalContext* globalCtx) { void func_80AB6D08(EnNiw* this, GlobalContext* globalCtx) { if (this->path == 0) { - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { return; } if (this->actor.params == 0xE) { @@ -669,7 +669,7 @@ void func_80AB6D08(EnNiw* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->actor.velocity.y = 4.0f; } else { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->sfxTimer1 = 0; this->actor.velocity.y = 4.0f; this->unk_2A6 = 1; @@ -716,7 +716,7 @@ void func_80AB6F04(EnNiw* this, GlobalContext* globalCtx) { this->actor.speedXZ = 2.0f; - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { this->actor.gravity = 0.0f; if (this->actor.yDistToWater > 15.0f) { @@ -728,21 +728,21 @@ void func_80AB6F04(EnNiw* this, GlobalContext* globalCtx) { pos.y += this->actor.yDistToWater; EffectSsGRipple_Spawn(globalCtx, &pos, 100, 500, 30); } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.velocity.y = 10.0f; this->actor.speedXZ = 1.0f; } } else { this->actor.gravity = -2.0f; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.velocity.y = 10.0f; this->actor.speedXZ = 1.0f; this->actor.gravity = 0.0f; } else { this->actor.speedXZ = 4.0f; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.gravity = -2.0f; this->timer6 = 100; this->timer4 = 0; @@ -848,7 +848,7 @@ void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) { } void func_80AB7420(EnNiw* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_2A4 = (s16)Rand_ZeroFloat(3.99f) + 5; this->actionFunc = EnNiw_ResetAction; } @@ -1031,7 +1031,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { return; } - if (thisx->bgCheckFlags & 0x20 && thisx->yDistToWater > 15.0f && this->actionFunc != func_80AB6F04 && + if ((thisx->bgCheckFlags & BGCHECKFLAG_WATER) && thisx->yDistToWater > 15.0f && this->actionFunc != func_80AB6F04 && thisx->params != 0xD && thisx->params != 0xE && thisx->params != 0xA) { thisx->velocity.y = 0.0f; thisx->gravity = 0.0f; diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 5151bb6c1d..77504413c0 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -108,8 +108,9 @@ void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) { this->actor.home.rot.z += 0x2AA8; - if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1) || (this->collider.base.atFlags & AT_HIT) || - (this->collider.base.acFlags & AC_HIT) || (this->collider.base.ocFlags1 & OC1_HIT)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + (this->collider.base.atFlags & AT_HIT) || (this->collider.base.acFlags & AC_HIT) || + (this->collider.base.ocFlags1 & OC1_HIT)) { // Checking if the player is using a shield that reflects projectiles // And if so, reflects the projectile on impact if ((player->currentShield == PLAYER_SHIELD_DEKU) || diff --git a/src/overlays/actors/ovl_En_Ny/z_en_ny.c b/src/overlays/actors/ovl_En_Ny/z_en_ny.c index 0cc2327fd8..1834d17e29 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -251,11 +251,11 @@ void EnNy_TurnToStone(EnNy* this, GlobalContext* globalCtx) { phi_f0 -= 2.0f; if (phi_f0 <= 0.25f) { phi_f0 = 0.25f; - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (!(this->unk_1F0 < this->actor.yDistToWater)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } - this->actor.bgCheckFlags &= ~2; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.speedXZ = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; func_80ABCE38(this); diff --git a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index ecb9abdc4f..6d365f8a02 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -476,14 +476,14 @@ void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; } this->actor.home.rot.z += 0x1554; - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { this->actor.gravity = -1.0f; this->actor.speedXZ -= 0.1f; this->actor.speedXZ = CLAMP_MIN(this->actor.speedXZ, 1.0f); } - if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1) || (this->collider.base.atFlags & AT_HIT) || - this->collider.base.acFlags & AC_HIT || this->collider.base.ocFlags1 & OC1_HIT || - this->actor.floorHeight == BGCHECK_Y_MIN) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + (this->collider.base.atFlags & AT_HIT) || this->collider.base.acFlags & AC_HIT || + this->collider.base.ocFlags1 & OC1_HIT || this->actor.floorHeight == BGCHECK_Y_MIN) { if ((player->currentShield == PLAYER_SHIELD_DEKU || (player->currentShield == PLAYER_SHIELD_HYLIAN && LINK_IS_ADULT)) && this->collider.base.atFlags & AT_HIT && this->collider.base.atFlags & AT_TYPE_ENEMY && @@ -603,17 +603,17 @@ void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) { Actor_MoveForward(&this->actor); Math_Vec3f_Copy(&sp38, &this->actor.world.pos); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 15.0f, 30.0f, 5); - if ((this->actor.bgCheckFlags & 8) && + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId)) { sp34 = true; - this->actor.bgCheckFlags &= ~8; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WALL; } - if ((this->actor.bgCheckFlags & 1) && + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && SurfaceType_IsIgnoredByProjectiles(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId)) { sp34 = true; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } - if (sp34 && !(this->actor.bgCheckFlags & 9)) { + if (sp34 && !(this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL))) { Math_Vec3f_Copy(&this->actor.world.pos, &sp38); } } diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.c b/src/overlays/actors/ovl_En_Part/z_en_part.c index 7fa8088604..4990f6a77c 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.c +++ b/src/overlays/actors/ovl_En_Part/z_en_part.c @@ -106,7 +106,7 @@ void func_80ACE13C(EnPart* this, GlobalContext* globalCtx) { if ((this->actor.params == 12) || (this->actor.params == 13)) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 15.0f, 0.0f, 0x1D); - if ((this->actor.bgCheckFlags & 1) || (this->actor.world.pos.y <= this->actor.floorHeight)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.world.pos.y <= this->actor.floorHeight)) { this->action = 4; this->actor.speedXZ = 0.0f; this->actor.gravity = 0.0f; @@ -247,8 +247,8 @@ void EnPart_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 5.0f, 15.0f, 0.0f, 5); if (this->actor.params >= 0) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); - if (thisx->bgCheckFlags & 1) { - thisx->bgCheckFlags &= ~1; + if (thisx->bgCheckFlags & BGCHECKFLAG_GROUND) { + thisx->bgCheckFlags &= ~BGCHECKFLAG_GROUND; thisx->velocity.y = 6.0f; } } diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 5d5214bd65..55eb1260ed 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -560,7 +560,7 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { this->colQuad.base.acFlags = this->colQuad.base.acFlags & ~AC_BOUNCED; EnPeehat_SetStateAttackRecoil(this); } else if ((this->colQuad.base.atFlags & AT_HIT) || (this->colCylinder.base.acFlags & AC_HIT) || - (this->actor.bgCheckFlags & 1)) { + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Player* player = GET_PLAYER(globalCtx); this->colQuad.base.atFlags &= ~AT_HIT; if (!(this->colCylinder.base.acFlags & AC_HIT) && &player->actor == this->colQuad.base.at) { @@ -570,7 +570,7 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { this->actor.world.rot.y -= 0x2000; } this->unk2D4 = 40; - } else if (this->colCylinder.base.acFlags & AC_HIT || this->actor.bgCheckFlags & 1) { + } else if (this->colCylinder.base.acFlags & AC_HIT || this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Vec3f zeroVec = { 0, 0, 0 }; s32 i; for (i = 4; i >= 0; i--) { @@ -583,7 +583,7 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { } } if (&player->actor != this->colQuad.base.at || this->colCylinder.base.acFlags & AC_HIT) { - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { EffectSsDeadSound_SpawnStationary(globalCtx, &this->actor.projectedPos, NA_SE_EN_PIHAT_SM_DEAD, 1, 1, 40); } diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index 0bc1bdf085..5e15e583e2 100644 --- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -606,7 +606,7 @@ void EnPoField_SoulIdle(EnPoField* this, GlobalContext* globalCtx) { if (this->actionTimer != 0) { this->actionTimer--; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, OBJECT_PO_FIELD, 10, gPoeFieldLanternDL); func_80AD42B0(this); diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 2e0057c538..5a42e90860 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -617,7 +617,7 @@ void func_80ADA530(EnPoSisters* this, GlobalContext* globalCtx) { } else if (this->unk_19A == 0 && Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f) != 0) { func_80AD9368(this); } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_ScaledStepToS(&this->actor.world.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x71C); } else if (Actor_WorldDistXZToPoint(&this->actor, &this->actor.home.pos) > 300.0f) { @@ -729,7 +729,7 @@ void func_80ADAC70(EnPoSisters* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, 0.0f) && this->unk_19A != 0) { this->unk_19A--; } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.world.rot.y = this->actor.shape.rot.y; this->unk_199 |= 2; func_80AD9718(this); diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 0ff3b6bc56..c4249278f6 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -719,7 +719,7 @@ void EnPoh_Death(EnPoh* this, GlobalContext* globalCtx) { if (this->unk_198 != 0) { this->unk_198--; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { objId = (this->infoIdx == EN_POH_INFO_COMPOSER) ? OBJECT_PO_COMPOSER : OBJECT_POH; EffectSsHahen_SpawnBurst(globalCtx, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, objId, 10, this->info->lanternDisplayList); diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index d5df0648be..2f60ff1f03 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -599,7 +599,7 @@ void func_80AE3A54(EnRd* this, GlobalContext* globalCtx) { void func_80AE3A8C(EnRd* this) { Animation_MorphToPlayOnce(&this->skelAnime, &object_rd_Anim_0074F0, -6.0f); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speedXZ = -2.0f; } diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index d5aadc6622..ec7a1ea6f1 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -255,7 +255,7 @@ void func_80AE5270(EnReeba* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->actionfunc = func_80AE5688; } else if ((this->unk_272 == 0) || (this->actor.xzDistToPlayer < 30.0f) || (this->actor.xzDistToPlayer > 400.0f) || - (this->actor.bgCheckFlags & 8)) { + (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { this->actionfunc = func_80AE5688; } else if (this->unk_274 == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIVA_MOVE); @@ -283,7 +283,7 @@ void func_80AE53AC(EnReeba* this, GlobalContext* globalCtx) { surfaceType = func_80041D4C(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); if (((surfaceType != 4) && (surfaceType != 7)) || (this->actor.xzDistToPlayer > 400.0f) || - (this->actor.bgCheckFlags & 8)) { + (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { this->actionfunc = func_80AE5688; } else { if ((this->actor.xzDistToPlayer < 70.0f) && (this->unk_270 == 0)) { diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index bd5d419f09..3b756e4e51 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -857,7 +857,7 @@ void func_80AEC780(EnRu1* this, GlobalContext* globalCtx) { if ((func_80AEC5FC(this, globalCtx)) && (!Gameplay_InCsMode(globalCtx)) && (!(player->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21))) && - (player->actor.bgCheckFlags & 1)) { + (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { globalCtx->csCtx.segment = &D_80AF0880; gSaveContext.cutsceneTrigger = 1; @@ -911,7 +911,7 @@ void func_80AEC9C4(EnRu1* this) { } void func_80AECA18(EnRu1* this) { - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->action = 13; this->unk_26C = 0.0f; this->actor.velocity.y = 0.0f; @@ -1317,7 +1317,7 @@ void func_80AEDAE0(EnRu1* this, GlobalContext* globalCtx) { DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); if (dynaPolyActor == NULL || dynaPolyActor->actor.id == ACTOR_EN_BOX) { - this->actor.bgCheckFlags &= ~0x19; + this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING); } } @@ -1332,7 +1332,7 @@ void func_80AEDB30(EnRu1* this, GlobalContext* globalCtx) { s32 temp_a0; s32 phi_v1; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { velocityY = &this->actor.velocity.y; dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, this->actor.floorBgId); if (*velocityY <= 0.0f) { @@ -1368,7 +1368,7 @@ void func_80AEDB30(EnRu1* this, GlobalContext* globalCtx) { func_80AED4FC(this); } } - if (this->actor.bgCheckFlags & 0x10) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) { speedXZ = &this->actor.speedXZ; velocityY = &this->actor.velocity.y; if (*speedXZ >= (kREG(27) * 0.01f) + 3.0f) { @@ -1381,7 +1381,7 @@ void func_80AEDB30(EnRu1* this, GlobalContext* globalCtx) { func_80AED4FC(this); } } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { speedXZ = &this->actor.speedXZ; if (*speedXZ != 0.0f) { rotY = this->actor.world.rot.y; @@ -1515,7 +1515,7 @@ void func_80AEE2F8(EnRu1* this, GlobalContext* globalCtx) { DynaPolyActor* dynaPolyActor; s32 floorBgId; - if ((this->actor.bgCheckFlags & 1) && (this->actor.floorBgId != BGCHECK_SCENE)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.floorBgId != BGCHECK_SCENE)) { floorBgId = this->actor.floorBgId; dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, floorBgId); if ((dynaPolyActor != NULL) && (dynaPolyActor->actor.id == ACTOR_BG_BDAN_SWITCH)) { @@ -1534,7 +1534,7 @@ s32 func_80AEE394(EnRu1* this, GlobalContext* globalCtx) { DynaPolyActor* dynaPolyActor; s32 floorBgId; - if ((this->actor.bgCheckFlags & 1) && this->actor.floorBgId != BGCHECK_SCENE) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && this->actor.floorBgId != BGCHECK_SCENE) { colCtx = &globalCtx->colCtx; floorBgId = this->actor.floorBgId; // necessary match, can't move this out of this block unfortunately dynaPolyActor = DynaPoly_GetActor(colCtx, floorBgId); @@ -1561,7 +1561,7 @@ void func_80AEE488(EnRu1* this, GlobalContext* globalCtx) { this->roomNum3 = curRoomNum; this->action = 31; func_80AED520(this, globalCtx); - } else if ((!func_80AEE394(this, globalCtx)) && (!(this->actor.bgCheckFlags & 1))) { + } else if (!func_80AEE394(this, globalCtx) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.minVelocityY = -((kREG(24) * 0.01f) + 6.8f); this->actor.gravity = -((kREG(23) * 0.01f) + 1.3f); this->action = 28; @@ -1570,7 +1570,8 @@ void func_80AEE488(EnRu1* this, GlobalContext* globalCtx) { void func_80AEE568(EnRu1* this, GlobalContext* globalCtx) { if (!func_80AEE394(this, globalCtx)) { - if ((this->actor.bgCheckFlags & 1) && (this->actor.speedXZ == 0.0f) && (this->actor.minVelocityY == 0.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speedXZ == 0.0f) && + (this->actor.minVelocityY == 0.0f)) { func_80AEE02C(this); func_8002F580(&this->actor, globalCtx); this->action = 27; @@ -1671,7 +1672,7 @@ void func_80AEE7C4(EnRu1* this, GlobalContext* globalCtx) { } s32 func_80AEEAC8(EnRu1* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_80AEE02C(this); func_8002F580(&this->actor, globalCtx); this->action = 27; diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index eb882bc0f1..016c3b9e6b 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -273,11 +273,11 @@ void EnSb_TurnAround(EnSb* this, GlobalContext* globalCtx) { void EnSb_Lunge(EnSb* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 0.0f, 0.2f); - if ((this->actor.velocity.y <= -0.1f) || ((this->actor.bgCheckFlags & 2))) { + if ((this->actor.velocity.y <= -0.1f) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH)) { if (!(this->actor.yDistToWater > 0.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } - this->actor.bgCheckFlags = this->actor.bgCheckFlags & ~2; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; EnSb_SetupBounce(this); } } @@ -306,8 +306,8 @@ void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx) { } EnSb_SpawnBubbles(globalCtx, this); EnSb_SetupLunge(this); - } else if (this->actor.bgCheckFlags & 1) { - this->actor.bgCheckFlags &= ~2; + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.speedXZ = 0.0f; this->timer = 1; EnSb_SetupWaitClosed(this); @@ -319,13 +319,13 @@ void EnSb_Bounce(EnSb* this, GlobalContext* globalCtx) { void EnSb_Cooldown(EnSb* this, GlobalContext* globalCtx) { if (this->timer != 0) { this->timer--; - if (this->actor.bgCheckFlags & 1) { - this->actor.bgCheckFlags &= ~1; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actor.speedXZ = 0.0f; } } else { - if (this->actor.bgCheckFlags & 1) { - this->actor.bgCheckFlags &= ~1; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->actionFunc = EnSb_WaitClosed; this->actor.speedXZ = 0.0f; } diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index e7d91fc944..34fa4e7bdb 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -336,7 +336,7 @@ void func_80AFD508(EnSkb* this, GlobalContext* globalCtx) { } void EnSkb_SetupStunned(EnSkb* this) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speedXZ = 0.0f; } Audio_PlayActorSound2(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); @@ -346,15 +346,15 @@ void EnSkb_SetupStunned(EnSkb* this) { } void func_80AFD59C(EnSkb* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.05f; } } - if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { func_80AFD7B4(this, globalCtx); } else { @@ -365,7 +365,7 @@ void func_80AFD59C(EnSkb* this, GlobalContext* globalCtx) { void func_80AFD644(EnSkb* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gStalchildDamagedAnim, -4.0f); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speedXZ = -4.0f; } this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -383,17 +383,17 @@ void func_80AFD6CC(EnSkb* this, GlobalContext* globalCtx) { if ((*new_var) != 0) { this->unk_283 = (*new_var) | 2; } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.05f; } } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); - if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) { + if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_80AFCD60(this); } } @@ -403,7 +403,7 @@ void func_80AFD7B4(EnSkb* this, GlobalContext* globalCtx) { Animation_MorphToPlayOnce(&this->skelAnime, &gStalchildDyingAnim, -4.0f); this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speedXZ = -6.0f; } this->unk_280 = 1; @@ -439,7 +439,8 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) { s16 phi_v1; Player* player; - if ((this->unk_280 != 1) && (this->actor.bgCheckFlags & 0x60) && (this->actor.yDistToWater >= 40.0f)) { + if ((this->unk_280 != 1) && (this->actor.bgCheckFlags & (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH)) && + (this->actor.yDistToWater >= 40.0f)) { this->actor.colChkInfo.health = 0; this->unk_281 = 0; func_80AFD7B4(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index e1597b737f..318e65a98a 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -670,8 +670,8 @@ void EnSkj_Fade(EnSkj* this, GlobalContext* globalCtx) { } if (this->actor.velocity.y <= 0.0f) { - if (this->actor.bgCheckFlags & 2) { - this->actor.bgCheckFlags &= ~2; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; func_80AFF2A0(this); } } @@ -1090,8 +1090,8 @@ void EnSkj_JumpFromStump(EnSkj* this) { void EnSkj_WaitForLanding(EnSkj* this, GlobalContext* globalCtx) { if (this->actor.velocity.y <= 0.0f) { - if (this->actor.bgCheckFlags & 2) { - this->actor.bgCheckFlags &= ~2; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.speedXZ = 0.0f; EnSkj_SetupWaitForLandAnimFinish(this); } diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index 37dd2c66d1..c2ad25f2e9 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -654,7 +654,7 @@ s32 EnSt_IsDoneBouncing(EnSt* this, GlobalContext* globalCtx) { return false; } - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { // the Skulltula is not on the ground. return false; } diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 82871ec9e7..fe17041fa6 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -639,13 +639,13 @@ void func_80B0DB00(EnSw* this, GlobalContext* globalCtx) { this->actor.shape.rot.z += 0x1000; Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 0.0f, 5); - if ((this->actor.bgCheckFlags & 1) && (!(0.0f <= this->actor.velocity.y))) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(0.0f <= this->actor.velocity.y)) { if (this->actor.floorHeight <= BGCHECK_Y_MIN || this->actor.floorHeight >= 32000.0f) { Actor_Kill(&this->actor); return; } - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; if (this->unk_38A == 0) { this->actionFunc = func_80B0DC7C; diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c index c9916626df..22eac5f5a6 100644 --- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c +++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c @@ -228,7 +228,7 @@ void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx) { f32 tmpf1; s16 sp4A; - if ((this->unk_29C != 0) && (this->unk_29E == 0) && (this->actor.bgCheckFlags & 1)) { + if ((this->unk_29C != 0) && (this->unk_29E == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->unk_29C = 0; this->actionFunc = func_80B123A8; return; @@ -298,7 +298,7 @@ void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx) { } } else { this->unk_25C = 4; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.velocity.y = 2.5f; if ((Rand_ZeroFloat(10.0f) < 1.0f) && (this->unk_29E == 0)) { this->unk_25C = 0xC; @@ -402,7 +402,7 @@ void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; } - if ((this->actor.bgCheckFlags & 1) && (this->actor.world.pos.z > 110.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.world.pos.z > 110.0f)) { this->actor.velocity.y = 0.0f; this->actor.gravity = 0.0f; this->unk_284 = 0.0f; @@ -532,7 +532,7 @@ void func_80B129EC(EnSyatekiNiw* this, GlobalContext* globalCtx) { this->unk_298++; this->unk_298 &= 1; this->unk_25C = (s16)Rand_CenteredFloat(4.0f) + 5; - if ((Rand_ZeroFloat(5.0f) < 1.0f) && (this->actor.bgCheckFlags & 1)) { + if ((Rand_ZeroFloat(5.0f) < 1.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.velocity.y = 4.0f; } } diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.c b/src/overlays/actors/ovl_En_Test/z_en_test.c index 9e1104c12d..b4eb63c91c 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -816,10 +816,10 @@ void func_80860F84(EnTest* this, GlobalContext* globalCtx) { } } - if ((this->actor.bgCheckFlags & 8) || + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || ((this->actor.params == STALFOS_TYPE_CEILING) && !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.world.rot.y))) { - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { newYaw = this->actor.shape.rot.y + 0x3FFF; } else { @@ -1222,8 +1222,9 @@ void func_808621D4(EnTest* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skelAnime)) { this->actor.speedXZ = 0.0f; - if ((this->actor.bgCheckFlags & 8) && ((ABS((s16)(this->actor.wallYaw - this->actor.shape.rot.y)) < 0x38A4) && - (this->actor.xzDistToPlayer < 80.0f))) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && + ((ABS((s16)(this->actor.wallYaw - this->actor.shape.rot.y)) < 0x38A4) && + (this->actor.xzDistToPlayer < 80.0f))) { EnTest_SetupJumpUp(this); } else if (!EnTest_ReactToProjectile(globalCtx, this)) { EnTest_ChooseAction(this, globalCtx); @@ -1233,8 +1234,9 @@ void func_808621D4(EnTest* this, GlobalContext* globalCtx) { } if (player->swordState != 0) { - if ((this->actor.bgCheckFlags & 8) && ((ABS((s16)(this->actor.wallYaw - this->actor.shape.rot.y)) < 0x38A4) && - (this->actor.xzDistToPlayer < 80.0f))) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && + ((ABS((s16)(this->actor.wallYaw - this->actor.shape.rot.y)) < 0x38A4) && + (this->actor.xzDistToPlayer < 80.0f))) { EnTest_SetupJumpUp(this); } else if ((Rand_ZeroOne() > 0.7f) && (this->actor.params != STALFOS_TYPE_CEILING) && (player->swordAnimation != 0x11)) { @@ -1272,8 +1274,9 @@ void func_80862418(EnTest* this, GlobalContext* globalCtx) { } if (player->swordState != 0) { - if ((this->actor.bgCheckFlags & 8) && ((ABS((s16)(this->actor.wallYaw - this->actor.shape.rot.y)) < 0x38A4) && - (this->actor.xzDistToPlayer < 80.0f))) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && + ((ABS((s16)(this->actor.wallYaw - this->actor.shape.rot.y)) < 0x38A4) && + (this->actor.xzDistToPlayer < 80.0f))) { EnTest_SetupJumpUp(this); } else if ((Rand_ZeroOne() > 0.7f) && (this->actor.params != STALFOS_TYPE_CEILING) && (player->swordAnimation != 0x11)) { @@ -1318,7 +1321,7 @@ void EnTest_Stunned(EnTest* this, GlobalContext* globalCtx) { if (this->actor.colChkInfo.health == 0) { func_80862FA8(this, globalCtx); } else if (player->swordState != 0) { - if ((this->actor.bgCheckFlags & 8) && + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && ((ABS((s16)(this->actor.wallYaw - this->actor.shape.rot.y)) < 0x38A4) && (this->actor.xzDistToPlayer < 80.0f))) { EnTest_SetupJumpUp(this); @@ -1387,10 +1390,10 @@ void func_808628C8(EnTest* this, GlobalContext* globalCtx) { } } - if ((this->actor.bgCheckFlags & 8) || + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || ((this->actor.params == STALFOS_TYPE_CEILING) && !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y + 0x3FFF))) { - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { newYaw = (this->actor.shape.rot.y + 0x3FFF); } else { @@ -1716,7 +1719,7 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.floorHeight <= this->actor.home.pos.y) { this->actor.floorHeight = this->actor.home.pos.y; } - } else if (this->actor.bgCheckFlags & 2) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { floorProperty = func_80041EA4(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); if ((floorProperty == 5) || (floorProperty == 0xC) || @@ -1993,7 +1996,7 @@ s32 EnTest_ReactToProjectile(GlobalContext* globalCtx, EnTest* this) { if (projectileActor != NULL) { yawToProjectile = Actor_WorldYawTowardActor(&this->actor, projectileActor) - (u16)this->actor.shape.rot.y; - if ((u8)(this->actor.bgCheckFlags & 8)) { + if ((u8)(this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { wallYawDiff = ((u16)this->actor.wallYaw - (u16)this->actor.shape.rot.y); touchingWall = true; } else { diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index a391a54f21..d53bb9bb21 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -230,7 +230,7 @@ void EnTite_Idle(EnTite* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); if (this->actor.params == TEKTITE_BLUE) { - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { // Float on water surface this->actor.gravity = 0.0f; Math_SmoothStepToF(&this->actor.velocity.y, 0.0f, 1.0f, 2.0f, 0.0f); @@ -240,7 +240,8 @@ void EnTite_Idle(EnTite* this, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; } } - if ((this->actor.bgCheckFlags & 3) && (this->actor.velocity.y <= 0.0f)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) && + (this->actor.velocity.y <= 0.0f)) { this->actor.velocity.y = 0.0f; } if (this->vIdleTimer > 0) { @@ -272,7 +273,7 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { case TEKTITE_BEGIN_LUNGE: // Snap to ground or water, then lunge into the air with some initial speed this->vAttackState = TEKTITE_MID_LUNGE; - if ((this->actor.params != TEKTITE_BLUE) || !(this->actor.bgCheckFlags & 0x20)) { + if ((this->actor.params != TEKTITE_BLUE) || !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { if (this->actor.floorHeight > BGCHECK_Y_MIN) { this->actor.world.pos.y = this->actor.floorHeight; } @@ -289,11 +290,11 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { // Continue trajectory until tektite has negative velocity and has landed on ground/water surface // Snap to ground/water surface, or if falling fast dip into the water and slow fall speed this->actor.flags |= ACTOR_FLAG_24; - if ((this->actor.bgCheckFlags & 3) || - ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20))) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) || + ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER))) { if (this->actor.velocity.y <= 0.0f) { this->vAttackState = TEKTITE_LANDED; - if ((this->actor.params != TEKTITE_BLUE) || !(this->actor.bgCheckFlags & 0x20)) { + if ((this->actor.params != TEKTITE_BLUE) || !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { if (BGCHECK_Y_MIN < this->actor.floorHeight) { this->actor.world.pos.y = this->actor.floorHeight; } @@ -356,7 +357,7 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { case TEKTITE_MID_LUNGE: // Generate sparkles at feet upon landing, set jumping animation and hurtbox and check if hit player if (this->actor.velocity.y >= 5.0f) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_800355B8(globalCtx, &this->frontLeftFootPos); func_800355B8(globalCtx, &this->frontRightFootPos); func_800355B8(globalCtx, &this->backRightFootPos); @@ -392,8 +393,8 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { break; } // Create ripples on water surface where tektite feet landed - if (this->actor.bgCheckFlags & 2) { - if (!(this->actor.bgCheckFlags & 0x20)) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); @@ -402,18 +403,18 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { } // if landed, kill XZ speed and play appropriate sounds if (this->actor.params == TEKTITE_BLUE) { - if (this->actor.bgCheckFlags & 0x40) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { this->actor.speedXZ = 0.0f; if (this->vAttackState == TEKTITE_SUBMERGED) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_LAND_WATER); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_LAND_WATER2); } - this->actor.bgCheckFlags &= ~0x40; - } else if (this->actor.bgCheckFlags & 2) { + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } - } else if (this->actor.bgCheckFlags & 2) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } @@ -422,7 +423,8 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { void EnTite_SetupTurnTowardPlayer(EnTite* this) { Animation_PlayLoop(&this->skelAnime, &object_tite_Anim_000A14); this->action = TEKTITE_TURN_TOWARD_PLAYER; - if ((this->actor.bgCheckFlags & 3) || ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20))) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) || + ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER))) { if (this->actor.velocity.y <= 0.0f) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; @@ -436,15 +438,15 @@ void EnTite_TurnTowardPlayer(EnTite* this, GlobalContext* globalCtx) { s16 angleToPlayer; s16 turnVelocity; - if (((this->actor.bgCheckFlags & 3) || - ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20))) && + if (((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) || + ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER))) && (this->actor.velocity.y <= 0.0f)) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->actor.speedXZ = 0.0f; } // Calculate turn velocity and animation speed based on angle to player - if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20)) { + if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { this->actor.world.pos.y += this->actor.yDistToWater; } angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; @@ -466,7 +468,7 @@ void EnTite_TurnTowardPlayer(EnTite* this, GlobalContext* globalCtx) { */ SkelAnime_Update(&this->skelAnime); if (((s16)this->skelAnime.curFrame & 7) == 0) { - if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20)) { + if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_WALK_WATER); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_WALK); @@ -493,7 +495,7 @@ void EnTite_SetupMoveTowardPlayer(EnTite* this) { this->actor.gravity = -1.0f; this->actor.speedXZ = 4.0f; this->vQueuedJumps = Rand_S16Offset(1, 3); - if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20)) { + if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_JUMP_WATER); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_JUMP); @@ -508,8 +510,8 @@ void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.1f, 1.0f, 0.0f); SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 0x42) { - if (!(this->actor.bgCheckFlags & 0x40)) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WATER_TOUCH)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); @@ -520,7 +522,8 @@ void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx) { } } - if ((this->actor.bgCheckFlags & 2) || ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x40))) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) || + ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH))) { if (this->vQueuedJumps != 0) { this->vQueuedJumps--; } else { @@ -528,19 +531,21 @@ void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx) { } } - if (((this->actor.bgCheckFlags & 3) || (this->actor.params == TEKTITE_BLUE && (this->actor.bgCheckFlags & 0x60))) && + if (((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) || + (this->actor.params == TEKTITE_BLUE && + (this->actor.bgCheckFlags & (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH)))) && (this->actor.velocity.y <= 0.0f)) { // slightly turn toward player upon landing and snap to ground or water. this->actor.speedXZ = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4000, 0); this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->actor.params != TEKTITE_BLUE) || !(this->actor.bgCheckFlags & 0x20)) { + if ((this->actor.params != TEKTITE_BLUE) || !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { if (this->actor.floorHeight > BGCHECK_Y_MIN) { this->actor.world.pos.y = this->actor.floorHeight; } - } else if (this->actor.bgCheckFlags & 0x40) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { Vec3f ripplePos = this->actor.world.pos; - this->actor.bgCheckFlags &= ~0x40; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; ripplePos.y += this->actor.yDistToWater; this->actor.gravity = 0.0f; this->actor.velocity.y *= 0.75f; @@ -568,7 +573,7 @@ void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx) { this->actor.speedXZ = 4.0f; this->actor.flags |= ACTOR_FLAG_24; this->actor.gravity = -1.0f; - if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20)) { + if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_JUMP_WATER); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_JUMP); @@ -579,7 +584,7 @@ void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx) { this->actor.speedXZ = 4.0f; this->actor.flags |= ACTOR_FLAG_24; this->actor.gravity = -1.0f; - if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20)) { + if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_JUMP_WATER); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_JUMP); @@ -591,7 +596,7 @@ void EnTite_MoveTowardPlayer(EnTite* this, GlobalContext* globalCtx) { this->actor.flags |= ACTOR_FLAG_24; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 1000, 0); if (this->actor.velocity.y >= 6.0f) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_800355B8(globalCtx, &this->frontLeftFootPos); func_800355B8(globalCtx, &this->frontRightFootPos); func_800355B8(globalCtx, &this->backRightFootPos); @@ -618,9 +623,10 @@ void EnTite_Recoil(EnTite* this, GlobalContext* globalCtx) { // Snap to ground or water surface upon landing Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); - if (((this->actor.bgCheckFlags & 3) || (this->actor.params == TEKTITE_BLUE && (this->actor.bgCheckFlags & 0x20))) && + if (((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) || + (this->actor.params == TEKTITE_BLUE && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER))) && (this->actor.velocity.y <= 0.0f)) { - if ((this->actor.params != TEKTITE_BLUE) || !(this->actor.bgCheckFlags & 0x20)) { + if ((this->actor.params != TEKTITE_BLUE) || !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { if (this->actor.floorHeight > BGCHECK_Y_MIN) { this->actor.world.pos.y = this->actor.floorHeight; } @@ -632,29 +638,30 @@ void EnTite_Recoil(EnTite* this, GlobalContext* globalCtx) { } // play sound and generate ripples - if (this->actor.bgCheckFlags & 0x42) { - if (!(this->actor.bgCheckFlags & 0x40)) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WATER_TOUCH)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); func_80033480(globalCtx, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } else { - this->actor.bgCheckFlags &= ~0x40; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_LAND_WATER2); } } // If player is far away, idle. Otherwise attack or move angleToPlayer = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y); - if ((this->actor.speedXZ == 0.0f) && ((this->actor.bgCheckFlags & 1) || ((this->actor.params == TEKTITE_BLUE) && - (this->actor.bgCheckFlags & 0x20)))) { + if ((this->actor.speedXZ == 0.0f) && + ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER)))) { this->actor.world.rot.y = this->actor.shape.rot.y; this->collider.base.atFlags &= ~AT_HIT; if ((this->actor.xzDistToPlayer > 300.0f) && (this->actor.yDistToPlayer > 80.0f) && (ABS(this->actor.shape.rot.x) < 4000) && (ABS(this->actor.shape.rot.z) < 4000) && - ((this->actor.bgCheckFlags & 1) || - ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20)))) { + ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER)))) { EnTite_SetupIdle(this); } else if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.yDistToPlayer <= 80.0f) && (ABS(angleToPlayer) <= 6000)) { @@ -687,10 +694,10 @@ void EnTite_Stunned(EnTite* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); // Snap to ground or water - if (((this->actor.bgCheckFlags & 3) || - ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20))) && + if (((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) || + ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER))) && (this->actor.velocity.y <= 0.0f)) { - if (((this->actor.params != TEKTITE_BLUE) || !(this->actor.bgCheckFlags & 0x20))) { + if (((this->actor.params != TEKTITE_BLUE) || !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER))) { if (this->actor.floorHeight > BGCHECK_Y_MIN) { this->actor.world.pos.y = this->actor.floorHeight; } @@ -701,23 +708,23 @@ void EnTite_Stunned(EnTite* this, GlobalContext* globalCtx) { } } // Play sounds and spawn dirt effects upon landing - if (this->actor.bgCheckFlags & 0x42) { - if (!(this->actor.bgCheckFlags & 0x40)) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WATER_TOUCH)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH)) { func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); func_80033480(globalCtx, &this->backLeftFootPos, 1.0f, 2, 80, 15, 1); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } else { - this->actor.bgCheckFlags &= ~0x40; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; Audio_PlayActorSound2(&this->actor, NA_SE_EN_TEKU_LAND_WATER2); } } // Decide on next action based on health, flip state and player distance angleToPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (((this->actor.colorFilterTimer == 0) && (this->actor.speedXZ == 0.0f)) && - ((this->actor.bgCheckFlags & 1) || - ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20)))) { + ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER)))) { this->actor.world.rot.y = this->actor.shape.rot.y; if (this->actor.colChkInfo.health == 0) { EnTite_SetupDeathCry(this); @@ -725,8 +732,8 @@ void EnTite_Stunned(EnTite* this, GlobalContext* globalCtx) { EnTite_SetupFlipUpright(this); } else if (((this->actor.xzDistToPlayer > 300.0f) && (this->actor.yDistToPlayer > 80.0f) && (ABS(this->actor.shape.rot.x) < 4000) && (ABS(this->actor.shape.rot.z) < 4000)) && - ((this->actor.bgCheckFlags & 1) || - ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20)))) { + ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & BGCHECKFLAG_WATER)))) { EnTite_SetupIdle(this); } else if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.yDistToPlayer <= 80.0f) && (ABS(angleToPlayer) <= 6000)) { @@ -795,9 +802,9 @@ void EnTite_FlipOnBack(EnTite* this, GlobalContext* globalCtx) { this->skelAnime.curFrame = Rand_ZeroOne() * 5.0f; } SkelAnime_Update(&this->skelAnime); - if (this->actor.bgCheckFlags & 3) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { // Upon landing, spawn dust and make noise - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->actor.world.pos, 20.0f, 11, 4.0f, 0, 0, false); Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } @@ -826,7 +833,7 @@ void EnTite_FlipUpright(EnTite* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 0xFA0, 0); SkelAnime_Update(&this->skelAnime); //! @bug flying tektite: the following condition is never met and tektite stays stuck in this action forever - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { func_80033480(globalCtx, &this->frontLeftFootPos, 1.0f, 2, 80, 15, 1); func_80033480(globalCtx, &this->frontRightFootPos, 1.0f, 2, 80, 15, 1); func_80033480(globalCtx, &this->backRightFootPos, 1.0f, 2, 80, 15, 1); @@ -874,7 +881,7 @@ void EnTite_CheckDamage(Actor* thisx, GlobalContext* globalCtx) { } // If hammer has recently hit the floor and player is close to tektite, flip over } else if ((thisx->colChkInfo.health != 0) && (globalCtx->actorCtx.unk_02 != 0) && - (thisx->xzDistToPlayer <= 400.0f) && (thisx->bgCheckFlags & 1)) { + (thisx->xzDistToPlayer <= 400.0f) && (thisx->bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->flipState == TEKTITE_FLIPPED) { EnTite_SetupFlipUpright(this); } else if ((this->action >= TEKTITE_IDLE) || (this->action >= TEKTITE_IDLE)) { @@ -898,7 +905,7 @@ void EnTite_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_MoveForward(thisx); Actor_UpdateBgCheckInfo(globalCtx, thisx, 25.0f, 40.0f, 20.0f, this->unk_2DC); // If on water, snap feet to surface and spawn ripples - if ((this->actor.params == TEKTITE_BLUE) && (thisx->bgCheckFlags & 0x20)) { + if ((this->actor.params == TEKTITE_BLUE) && (thisx->bgCheckFlags & BGCHECKFLAG_WATER)) { floorPoly = thisx->floorPoly; if ((((globalCtx->gameplayFrames % 8) == 0) || (thisx->velocity.y < 0.0f)) && (WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->backRightFootPos.x, @@ -932,7 +939,7 @@ void EnTite_Update(Actor* thisx, GlobalContext* globalCtx) { } // If on ground and currently flipped over, set tektite to be fully upside-down - if (thisx->bgCheckFlags & 3) { + if (thisx->bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { func_800359B8(thisx, thisx->shape.rot.y, &thisx->shape.rot); if (this->flipState >= TEKTITE_FLIPPED) { thisx->shape.rot.z += 0x7FFF; diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 8a32db6226..8b6d17c696 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -482,7 +482,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { } else if (sJumpslashFlag && (sAlpha == 255) && (this->actor.velocity.y > 0)) { input->cur.button |= BTN_B; - } else if (!sJumpslashFlag && (this->actor.bgCheckFlags & 1)) { + } else if (!sJumpslashFlag && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; sStickAngle = this->actor.yawTowardsPlayer; if (sAlpha != 255) { diff --git a/src/overlays/actors/ovl_En_Tp/z_en_tp.c b/src/overlays/actors/ovl_En_Tp/z_en_tp.c index 3522684c49..cc543f0108 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -672,7 +672,7 @@ void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { } // Turn away from wall - if ((this->actor.speedXZ != 0.0f) && (this->actor.bgCheckFlags & 8)) { + if ((this->actor.speedXZ != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { yawToWall = this->actor.wallYaw - this->actor.world.rot.y; if (ABS(yawToWall) > 0x4000) { diff --git a/src/overlays/actors/ovl_En_Trap/z_en_trap.c b/src/overlays/actors/ovl_En_Trap/z_en_trap.c index 13a05121d0..89f3477064 100644 --- a/src/overlays/actors/ovl_En_Trap/z_en_trap.c +++ b/src/overlays/actors/ovl_En_Trap/z_en_trap.c @@ -180,7 +180,7 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { if (thisx->params & SPIKETRAP_MODE_LINEAR) { this->vContinue = 1.0f; // If physically touching a wall and wall faces towards spike trap - if ((thisx->bgCheckFlags & 8) && (ABS(angleToWall) >= 0x6000)) { + if ((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) >= 0x6000)) { this->vContinue = 0.0f; } // If there is a collision poly between current position and a position 30 units ahead of spike trap @@ -224,7 +224,7 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { case DIR_FWD: if (!(thisx->params & SPIKETRAP_FOURWAY_FWD_ALLOWED)) { this->vMovementMetric = 0.0f; - } else if ((thisx->bgCheckFlags & 8) && (ABS(angleToWall) > 0x6000)) { + } else if ((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) > 0x6000)) { this->vMovementMetric = 0.0f; } if (touchingActor && (this->vMovementMetric != 0.0f) && (ABS(angleToCollidedActor) > 0x6000)) { @@ -243,7 +243,8 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { case DIR_LEFT: if (!(thisx->params & SPIKETRAP_FOURWAY_LEFT_ALLOWED)) { this->vMovementMetric = 0.0f; - } else if ((thisx->bgCheckFlags & 8) && (angleToWall < -0x2000) && (angleToWall > -0x6000)) { + } else if ((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (angleToWall < -0x2000) && + (angleToWall > -0x6000)) { this->vMovementMetric = 0.0f; break; } @@ -265,7 +266,7 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { case DIR_BACK: if (!(thisx->params & SPIKETRAP_FOURWAY_BACK_ALLOWED)) { this->vMovementMetric = 0.0f; - } else if ((thisx->bgCheckFlags & 8) && (ABS(angleToWall) < 0x2000)) { + } else if ((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 0x2000)) { this->vMovementMetric = 0.0f; break; } @@ -286,7 +287,8 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { case DIR_RIGHT: if (!(thisx->params & SPIKETRAP_FOURWAY_RIGHT_ALLOWED)) { this->vMovementMetric = 0.0f; - } else if ((thisx->bgCheckFlags & 8) && (angleToWall > 0x2000) && (angleToWall < 0x6000)) { + } else if ((thisx->bgCheckFlags & BGCHECKFLAG_WALL) && (angleToWall > 0x2000) && + (angleToWall < 0x6000)) { this->vMovementMetric = 0.0f; break; } @@ -324,7 +326,7 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { this->vClosestDirection = (Math_Vec3f_Yaw(&thisx->world.pos, &thisx->home.pos) + 0x2000) & 0xC000; switch (this->vClosestDirection) { case 0: // movement is closest to +z direction - if (thisx->bgCheckFlags & 8) { + if (thisx->bgCheckFlags & BGCHECKFLAG_WALL) { if (ABS(thisx->wallYaw) > 0x6000) { blockedOnReturn = true; } @@ -333,7 +335,7 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { } break; case 0x4000: // movement is closest to +x direction - if (thisx->bgCheckFlags & 8) { + if (thisx->bgCheckFlags & BGCHECKFLAG_WALL) { if ((thisx->wallYaw < -0x2000) && (thisx->wallYaw > -0x6000)) { blockedOnReturn = true; } @@ -343,7 +345,7 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { } break; case -0x8000: // movement is closest to -z direction - if (thisx->bgCheckFlags & 8) { + if (thisx->bgCheckFlags & BGCHECKFLAG_WALL) { if (ABS(thisx->wallYaw) < 0x2000) { blockedOnReturn = true; } @@ -352,7 +354,7 @@ void EnTrap_Update(Actor* thisx, GlobalContext* globalCtx) { } break; case -0x4000: // movement is closest to -x direction - if (thisx->bgCheckFlags & 8) { + if (thisx->bgCheckFlags & BGCHECKFLAG_WALL) { if ((thisx->wallYaw > 0x2000) && (thisx->wallYaw < 0x6000)) { blockedOnReturn = true; } diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index 82025e3781..f258c0d2d4 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -170,7 +170,7 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); Player* player2 = GET_PLAYER(globalCtx); - if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 15.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.yDistToWater > 15.0f)) { EnTuboTrap_SpawnEffectsInWater(this, globalCtx); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_BOMB_DROP_WATER); EnTuboTrap_DropCollectible(this, globalCtx); @@ -210,7 +210,7 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { } } - if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { EnTuboTrap_SpawnEffectsOnLand(this, globalCtx); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); EnTuboTrap_DropCollectible(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c index 7509c53ce6..919aab5b09 100644 --- a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c +++ b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c @@ -127,7 +127,7 @@ void EnVbBall_UpdateBones(EnVbBall* this, GlobalContext* globalCtx) { s16 i; Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 4); - if ((this->actor.bgCheckFlags & 1) && (this->actor.velocity.y <= 0.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.velocity.y <= 0.0f)) { this->xRotVel = Rand_CenteredFloat((f32)0x4000); this->yRotVel = Rand_CenteredFloat((f32)0x4000); angle = Math_FAtan2F(this->actor.world.pos.x, this->actor.world.pos.z); @@ -188,7 +188,7 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actor.world.pos.y -= radius; Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 50.0f, 50.0f, 100.0f, 4); this->actor.world.pos.y += radius; - if ((this->actor.bgCheckFlags & 1) && (this->actor.velocity.y <= 0.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.velocity.y <= 0.0f)) { if ((this->actor.params == 100) || (this->actor.params == 101)) { Actor_Kill(&this->actor); if (this->actor.params == 100) { diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 9432a42921..c3733d1956 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -304,7 +304,7 @@ void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) { } if ((player->stateFlags1 & PLAYER_STATE1_20) || (player->stateFlags1 & PLAYER_STATE1_27) || - !(player->actor.bgCheckFlags & 1) || + !(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || ((this->actor.params == 1) && (320.0f < Math_Vec3f_DistXZ(&this->actor.home.pos, playerPos)))) { Audio_StopSfxById(NA_SE_EN_FALL_AIM); this->timer = 0x82; @@ -561,7 +561,7 @@ void EnWallmas_Update(Actor* thisx, GlobalContext* globalCtx) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - if ((this->actionFunc != EnWallmas_TakeDamage) && (this->actor.bgCheckFlags & 1) != 0 && + if ((this->actionFunc != EnWallmas_TakeDamage) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.freezeTimer == 0)) { CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c index b71d7ff7f4..53a444e53f 100644 --- a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c +++ b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c @@ -248,7 +248,7 @@ void func_80B328E8(EnWeiyer* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.speedXZ, 1.3f, 0.03f); } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_196 = this->actor.wallYaw; this->unk_194 = 30; } @@ -280,7 +280,7 @@ void func_80B328E8(EnWeiyer* this, GlobalContext* globalCtx) { } else { Player* player = GET_PLAYER(globalCtx); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_280 = this->actor.home.pos.y - Rand_ZeroOne() * ((this->actor.home.pos.y - this->actor.floorHeight) / 2.0f); } else if (sp34 && (Rand_ZeroOne() < 0.1f)) { @@ -316,7 +316,7 @@ void func_80B32C2C(EnWeiyer* this, GlobalContext* globalCtx) { } func_80B32538(this); - } else if (this->actor.bgCheckFlags & 1) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_80B32494(this); } } @@ -415,7 +415,7 @@ void func_80B33018(EnWeiyer* this, GlobalContext* globalCtx) { this->unk_194--; } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_196 = this->actor.wallYaw; } @@ -443,7 +443,7 @@ void func_80B331CC(EnWeiyer* this, GlobalContext* globalCtx) { this->unk_194--; } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_196 = this->actor.wallYaw; } else { this->unk_196 = this->actor.yawTowardsPlayer + 0x8000; @@ -469,7 +469,7 @@ void func_80B332B4(EnWeiyer* this, GlobalContext* globalCtx) { this->unk_194--; } - if ((this->unk_194 == 0) || (this->actor.bgCheckFlags & 0x10)) { + if ((this->unk_194 == 0) || (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING)) { func_80B327B0(this); } } @@ -498,7 +498,7 @@ void func_80B333B8(EnWeiyer* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_EIER_FLUTTER); } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_M_GND); } } @@ -546,9 +546,9 @@ void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx) { Math_ScaledStepToS(&this->actor.shape.rot.x, phi_a1, 0x400); } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_80B32434(this); - } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.shape.rot.x > 0)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.shape.rot.x > 0)) { EffectSsGSplash_Spawn(globalCtx, &this->actor.world.pos, NULL, NULL, 1, 400); Audio_PlayActorSound2(&this->actor, NA_SE_EN_OCTAROCK_SINK); func_80B32538(this); diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index a05edfa448..e15290b2f9 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -307,7 +307,8 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { if (func_800354B4(globalCtx, &this->actor, 100.0f, 0x5DC0, 0x2AA8, this->actor.shape.rot.y)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if ((this->actor.bgCheckFlags & 8) && (ABS(wallYawDiff) < 0x2EE0) && (this->actor.xzDistToPlayer < 120.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(wallYawDiff) < 0x2EE0) && + (this->actor.xzDistToPlayer < 120.0f)) { EnWf_SetupSomersaultAndAttack(this); return true; } else if (player->swordAnimation == 0x11) { @@ -327,7 +328,8 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) { if (explosive != NULL) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (((this->actor.bgCheckFlags & 8) && (wallYawDiff < 0x2EE0)) || (explosive->id == ACTOR_EN_BOM_CHU)) { + if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (wallYawDiff < 0x2EE0)) || + (explosive->id == ACTOR_EN_BOM_CHU)) { if ((explosive->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && (s16)((this->actor.shape.rot.y - explosive->world.rot.y) + 0x8000) < 0x3E80) { EnWf_SetupSomersaultAndAttack(this); @@ -642,14 +644,14 @@ void EnWf_RunAroundPlayer(EnWf* this, GlobalContext* globalCtx) { angle1 = player->actor.shape.rot.y + this->runAngle + 0x8000; // Actor_TestFloorInDirection is useless here (see comment below) - if ((this->actor.bgCheckFlags & 8) || + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y)) { - angle2 = (this->actor.bgCheckFlags & 8) + angle2 = (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) ? (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->runAngle : 0; // This is probably meant to reverse direction if the edge of a floor is encountered, but does nothing - // unless bgCheckFlags & 8 anyway, since angle2 = 0 otherwise + // unless bgCheckFlags & BGCHECKFLAG_WALL anyway, since angle2 = 0 otherwise if (ABS(angle2) > 0x2EE0) { this->runAngle = -this->runAngle; } @@ -863,7 +865,7 @@ void EnWf_BackflipAway(EnWf* this, GlobalContext* globalCtx) { } void EnWf_SetupStunned(EnWf* this) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speedXZ = 0.0f; } @@ -874,11 +876,11 @@ void EnWf_SetupStunned(EnWf* this) { } void EnWf_Stunned(EnWf* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.05f; } @@ -886,7 +888,7 @@ void EnWf_Stunned(EnWf* this, GlobalContext* globalCtx) { this->unk_300 = false; } - if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { EnWf_SetupDie(this); } else { @@ -898,7 +900,7 @@ void EnWf_Stunned(EnWf* this, GlobalContext* globalCtx) { void EnWf_SetupDamaged(EnWf* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gWolfosDamagedAnim, -4.0f); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_300 = false; this->actor.speedXZ = -4.0f; } else { @@ -915,11 +917,11 @@ void EnWf_SetupDamaged(EnWf* this) { void EnWf_Damaged(EnWf* this, GlobalContext* globalCtx) { s16 angleToWall; - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.05f; } @@ -930,11 +932,12 @@ void EnWf_Damaged(EnWf* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4500, 0); if (!EnWf_ChangeAction(globalCtx, this, false) && SkelAnime_Update(&this->skelAnime)) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { angleToWall = this->actor.wallYaw - this->actor.shape.rot.y; angleToWall = ABS(angleToWall); - if ((this->actor.bgCheckFlags & 8) && (ABS(angleToWall) < 12000) && (this->actor.xzDistToPlayer < 120.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 12000) && + (this->actor.xzDistToPlayer < 120.0f)) { EnWf_SetupSomersaultAndAttack(this); } else if (!EnWf_DodgeRanged(globalCtx, this)) { if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsTargeted(globalCtx, &this->actor) && @@ -975,7 +978,8 @@ void EnWf_SomersaultAndAttack(EnWf* this, GlobalContext* globalCtx) { func_800355B8(globalCtx, &this->unk_4BC); } - if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & (1 | 2))) { + if (SkelAnime_Update(&this->skelAnime) && + (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.shape.rot.x = 0; this->actor.speedXZ = this->actor.velocity.y = 0.0f; @@ -1095,10 +1099,11 @@ void EnWf_Sidestep(EnWf* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->runAngle, 1, 3000, 1); // Actor_TestFloorInDirection is useless here (see comment below) - if ((this->actor.bgCheckFlags & 8) || + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y)) { - s16 angle = - (this->actor.bgCheckFlags & 8) ? (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->runAngle : 0; + s16 angle = (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) + ? (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->runAngle + : 0; // This is probably meant to reverse direction if the edge of a floor is encountered, but does nothing // unless bgCheckFlags & 8 anyway, since angle = 0 otherwise @@ -1180,7 +1185,7 @@ void EnWf_SetupDie(EnWf* this) { Animation_MorphToPlayOnce(&this->skelAnime, &gWolfosRearingUpFallingOverAnim, -4.0f); this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_300 = false; this->actor.speedXZ = -6.0f; } else { @@ -1195,11 +1200,11 @@ void EnWf_SetupDie(EnWf* this) { } void EnWf_Die(EnWf* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); this->unk_300 = false; } @@ -1305,7 +1310,7 @@ void EnWf_Update(Actor* thisx, GlobalContext* globalCtx) { func_80B36F40(this, globalCtx); } - if (this->actor.bgCheckFlags & (1 | 2)) { + if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { func_800359B8(&this->actor, this->actor.shape.rot.y, &this->actor.shape.rot); } else { Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 1000, 0); diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index 59351098b1..24354a02d6 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -371,7 +371,7 @@ void EnXc_SetWalkingSFX(EnXc* this, GlobalContext* globalCtx) { s32 pad2; if (Animation_OnFrame(&this->skelAnime, 11.0f) || Animation_OnFrame(&this->skelAnime, 23.0f)) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { sfxId = SFX_FLAG; sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); @@ -385,7 +385,7 @@ void EnXc_SetNutThrowSFX(EnXc* this, GlobalContext* globalCtx) { s32 pad2; if (Animation_OnFrame(&this->skelAnime, 7.0f)) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { sfxId = SFX_FLAG; sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); diff --git a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c index 92b3e58dcd..e4574072f5 100644 --- a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c +++ b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c @@ -118,7 +118,7 @@ void EnYukabyun_Update(Actor* thisx, GlobalContext* globalCtx) { if (((this->collider.base.atFlags & AT_HIT) || (this->collider.base.acFlags & AC_HIT) || ((this->collider.base.ocFlags1 & OC1_HIT) && !(this->collider.base.oc->id == ACTOR_EN_YUKABYUN))) || - ((this->actionfunc == func_80B43B6C) && (this->actor.bgCheckFlags & 8))) { + ((this->actionfunc == func_80B43B6C) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL))) { this->collider.base.atFlags &= ~AT_HIT; this->collider.base.acFlags &= ~AC_HIT; this->collider.base.ocFlags1 &= ~OC1_HIT; diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/src/overlays/actors/ovl_En_Zf/z_en_zf.c index a8d90a4a80..2cd9dc280a 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -236,7 +236,7 @@ s32 EnZf_PrimaryFloorCheck(EnZf* this, GlobalContext* globalCtx, f32 dist) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 0x1C); this->actor.world.pos = curPos; - ret = !(this->actor.bgCheckFlags & 1); + ret = !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); this->actor.bgCheckFlags = curBgCheckFlags; return ret; } @@ -267,7 +267,7 @@ s16 EnZf_SecondaryFloorCheck(EnZf* this, GlobalContext* globalCtx, f32 dist) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 0x1C); this->actor.world.pos = curPos; - ret = !(this->actor.bgCheckFlags & 1); + ret = !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); this->actor.bgCheckFlags = curBgCheckFlags; return ret; } @@ -582,7 +582,8 @@ s32 EnZf_ChooseAction(GlobalContext* globalCtx, EnZf* this) { if (func_800354B4(globalCtx, &this->actor, 100.0f, 0x5DC0, 0x2AA8, this->actor.shape.rot.y)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if ((this->actor.bgCheckFlags & 8) && (ABS(angleToWall) < 0x2EE0) && (this->actor.xzDistToPlayer < 80.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 0x2EE0) && + (this->actor.xzDistToPlayer < 80.0f)) { EnZf_SetupJumpUp(this); return true; } else if ((this->actor.xzDistToPlayer < 90.0f) && ((globalCtx->gameplayFrames % 2) != 0)) { @@ -598,7 +599,8 @@ s32 EnZf_ChooseAction(GlobalContext* globalCtx, EnZf* this) { if (explosive != NULL) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (((this->actor.bgCheckFlags & 8) && (angleToWall < 0x2EE0)) || (explosive->id == ACTOR_EN_BOM_CHU)) { + if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (angleToWall < 0x2EE0)) || + (explosive->id == ACTOR_EN_BOM_CHU)) { if ((explosive->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && ((s16)((this->actor.shape.rot.y - explosive->world.rot.y) + 0x8000) < 0x3E80)) { EnZf_SetupJumpUp(this); @@ -629,7 +631,7 @@ void EnZf_SetupDropIn(EnZf* this) { this->unk_3F0 = 10; this->hopAnimIndex = 1; this->action = ENZF_ACTION_DROP_IN; - this->actor.bgCheckFlags &= ~2; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.flags &= ~ACTOR_FLAG_0; this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnZf_SetupAction(this, EnZf_DropIn); @@ -659,11 +661,11 @@ void EnZf_DropIn(EnZf* this, GlobalContext* globalCtx) { this->alpha += 255 / 5; } - if ((this->actor.bgCheckFlags & 3) && (this->hopAnimIndex != 0)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) && (this->hopAnimIndex != 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_ONGND); Animation_Change(&this->skelAnime, &gZfLandingAnim, 1.0f, 0.0f, 17.0f, ANIMMODE_ONCE, 0.0f); this->hopAnimIndex = 0; - this->actor.bgCheckFlags &= ~2; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.world.pos.y = this->actor.floorHeight; this->actor.velocity.y = 0.0f; Actor_SpawnFloorDustRing(globalCtx, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); @@ -797,12 +799,12 @@ void EnZf_ApproachPlayer(EnZf* this, GlobalContext* globalCtx) { temp_v1 = ABS(temp_v1); if ((this->unk_3F8 && (this->actor.speedXZ > 0.0f)) || - ((this->actor.bgCheckFlags & 8) && (temp_v1 >= 0x5C19))) { + ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (temp_v1 >= 0x5C19))) { if ((Actor_WorldDistXZToPoint(&this->actor, &sPlatformPositions[this->nextPlatform]) < sp44) && !EnZf_PrimaryFloorCheck(this, globalCtx, 191.9956f)) { EnZf_SetupJumpForward(this); - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.velocity.y = 20.0f; } @@ -946,7 +948,8 @@ void EnZf_JumpForward(EnZf* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_CRY); } - if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & 3)) { + if ((this->actor.params == ENZF_TYPE_DINOLFOS) && + (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { if (EnZf_CanAttack(globalCtx, this)) { EnZf_SetupSlash(this); } else { @@ -1069,10 +1072,10 @@ void func_80B463E4(EnZf* this, GlobalContext* globalCtx) { if (this->unk_3F8) { this->actor.speedXZ = -this->actor.speedXZ; } - } else if ((this->actor.bgCheckFlags & 8) || + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y + 0x3FFF)) { - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { phi_v0_3 = this->actor.shape.rot.y + 0x3FFF; } else { @@ -1277,7 +1280,8 @@ void EnZf_JumpBack(EnZf* this, GlobalContext* globalCtx) { } void EnZf_SetupStunned(EnZf* this) { - if ((this->actor.bgCheckFlags & 1) && ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { this->actor.speedXZ = 0.0f; this->hopAnimIndex = 0; } else { @@ -1298,18 +1302,18 @@ void EnZf_SetupStunned(EnZf* this) { void EnZf_Stunned(EnZf* this, GlobalContext* globalCtx) { s16 angleToWall; - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.05f; } this->hopAnimIndex = 0; } - if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & 1)) { + if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { EnZf_SetupDie(this); } else if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(globalCtx, this)) { @@ -1319,7 +1323,7 @@ void EnZf_Stunned(EnZf* this, GlobalContext* globalCtx) { angleToWall = this->actor.wallYaw - this->actor.shape.rot.y; angleToWall = ABS(angleToWall); - if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & 8) && + if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { this->actor.world.rot.y = this->actor.shape.rot.y; EnZf_SetupJumpUp(this); @@ -1497,7 +1501,7 @@ void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { case 1: case 1 | 2: this->actor.velocity.y = 12.0f; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.velocity.y += 8.0f; } @@ -1530,7 +1534,8 @@ void EnZf_HopAway(EnZf* this, GlobalContext* globalCtx) { break; case 1: - if ((this->actor.bgCheckFlags & 2) || (this->actor.bgCheckFlags & 1)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) || + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_RIZA_ONGND); this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; @@ -1603,7 +1608,8 @@ void EnZf_SetupDamaged(EnZf* this) { Animation_Change(&this->skelAnime, &gZfKnockedBackAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gZfKnockedBackAnim), ANIMMODE_ONCE, -4.0f); - if ((this->actor.bgCheckFlags & 1) && ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { this->actor.speedXZ = -4.0f; this->hopAnimIndex = 0; } else { @@ -1626,11 +1632,11 @@ void EnZf_SetupDamaged(EnZf* this) { void EnZf_Damaged(EnZf* this, GlobalContext* globalCtx) { s16 wallYawDiff; - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.05f; } @@ -1640,7 +1646,7 @@ void EnZf_Damaged(EnZf* this, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4500, 0); if (((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(globalCtx, this)) && - SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & 1)) { + SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (D_80B4A1B4 != -1) { if (this->damageEffect == ENZF_DMGEFF_PROJECTILE) { @@ -1661,7 +1667,7 @@ void EnZf_Damaged(EnZf* this, GlobalContext* globalCtx) { wallYawDiff = this->actor.wallYaw - this->actor.shape.rot.y; wallYawDiff = ABS(wallYawDiff); - if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & 8) && + if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(wallYawDiff) < 12000) && (this->actor.xzDistToPlayer < 90.0f)) { EnZf_SetupJumpUp(this); } else if (!EnZf_DodgeRangedEngaging(globalCtx, this)) { @@ -1709,7 +1715,7 @@ void EnZf_JumpUp(EnZf* this, GlobalContext* globalCtx) { if (this->unk_3F0 == 0) { Animation_Change(&this->skelAnime, &gZfSlashAnim, 3.0f, 0.0f, 13.0f, ANIMMODE_ONCE, -4.0f); this->unk_3F0 = 10; - } else if (this->actor.bgCheckFlags & 3) { + } else if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { this->actor.velocity.y = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.speedXZ = 0.0f; @@ -1767,10 +1773,10 @@ void EnZf_CircleAroundPlayer(EnZf* this, GlobalContext* globalCtx) { if (this->unk_3F8) { this->actor.speedXZ = -this->actor.speedXZ; } - } else if ((this->actor.bgCheckFlags & 8) || + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, globalCtx, this->actor.speedXZ, this->actor.shape.rot.y + 0x3FFF)) { - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speedXZ >= 0.0f) { phi_v0_4 = this->actor.shape.rot.y + 0x3FFF; } else { @@ -1890,7 +1896,8 @@ void EnZf_SetupDie(EnZf* this) { Animation_Change(&this->skelAnime, &gZfDyingAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gZfDyingAnim), ANIMMODE_ONCE, -4.0f); - if ((this->actor.bgCheckFlags & 1) && ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { this->actor.speedXZ = 0.0f; this->hopAnimIndex = 0; } else { @@ -1923,11 +1930,11 @@ void EnZf_SetupDie(EnZf* this) { void EnZf_Die(EnZf* this, GlobalContext* globalCtx) { - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speedXZ = 0.0f; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.15f, 0.0f); this->hopAnimIndex = 0; } @@ -2042,7 +2049,7 @@ void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 25.0f, 30.0f, 60.0f, 0x1D); - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->hopAnimIndex = 1; } @@ -2071,7 +2078,7 @@ void EnZf_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->headRot, 0, 1, 2000, 0); if (this->action <= ENZF_ACTION_HOP_AND_TAUNT) { - if ((this->unk_3F4 == 1) && (this->actor.bgCheckFlags & 1)) { + if ((this->unk_3F4 == 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health > 0) { EnZf_SetupDrawSword(this, globalCtx); } diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index 5d5f2850a9..161d0cc306 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -1437,7 +1437,7 @@ void func_80B51D24(EnZl2* this, GlobalContext* globalCtx) { SkelAnime* skelAnime = &this->skelAnime; if (Animation_OnFrame(skelAnime, 6.0f) || Animation_OnFrame(skelAnime, 0.0f)) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { sfxId = SFX_FLAG; sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index 8f07b3ba49..dd04567c32 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -145,7 +145,7 @@ void func_80B5366C(EnZl3* this, GlobalContext* globalCtx) { } void func_80B536B4(EnZl3* this) { - this->actor.bgCheckFlags &= ~0x9; + this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL); } void func_80B536C4(EnZl3* this) { @@ -1554,7 +1554,8 @@ void func_80B56E38(EnZl3* this, GlobalContext* globalCtx) { s32 sfxId; SkelAnime* sp20 = &this->skelAnime; - if ((Animation_OnFrame(sp20, 6.0f) || Animation_OnFrame(sp20, 0.0f)) && (this->actor.bgCheckFlags & 1)) { + if ((Animation_OnFrame(sp20, 6.0f) || Animation_OnFrame(sp20, 0.0f)) && + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { sfxId = 0x800; sfxId += SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId); func_80078914(&this->actor.projectedPos, sfxId); @@ -2198,7 +2199,7 @@ s32 func_80B58938(EnZl3* this, GlobalContext* globalCtx) { } s32 func_80B5899C(EnZl3* this, GlobalContext* globalCtx) { - if ((this->actor.bgCheckFlags & 1)) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Player* player = GET_PLAYER(globalCtx); s8 invincibilityTimer = player->invincibilityTimer; diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 2fab40e8b0..f2657b5cbc 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -701,7 +701,7 @@ void EnZo_Dive(EnZo* this, GlobalContext* globalCtx) { return; } - if (this->actor.yDistToWater > 80.0f || this->actor.bgCheckFlags & 1) { + if (this->actor.yDistToWater > 80.0f || this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_ApproachF(&this->actor.velocity.y, -1.0f, 0.4f, 0.6f); Math_ApproachF(&this->alpha, 0.0f, 0.3f, 10.0f); } diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 4ba77ada34..32ccea6306 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -2277,10 +2277,10 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 15.0f, 30.0f, 30.0f, 0x43); this->actor.world.pos = sp80; - if (this->actor.bgCheckFlags & 0x10) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) { D_80B7E0E8.y = -0.5f; } - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (D_80B7E0E8.y > 0.0f) { D_80B7E0E8.y = 0.0f; } @@ -4138,11 +4138,11 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { this->actor.velocity.y = velocityY; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->unk_1A0 = 20; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.world.pos.y > WATER_SURFACE_Y(globalCtx)) { this->unk_184 = Rand_ZeroFloat(3.0f) + 3.0f; this->actor.velocity.x = this->actor.world.pos.x * -0.003f; diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index cdf7e8678d..a3c6f86834 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -164,7 +164,7 @@ void ItemEtcetera_SpawnSparkles(ItemEtcetera* this, GlobalContext* globalCtx) { void ItemEtcetera_MoveFireArrowDown(ItemEtcetera* this, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 0.0f, 5); Actor_MoveForward(&this->actor); - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { ItemEtcetera_SpawnSparkles(this, globalCtx); } this->actor.shape.rot.y += 0x400; diff --git a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c index 33d669a082..0514f0a54f 100644 --- a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c +++ b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c @@ -104,7 +104,7 @@ void func_80B86AC8(ItemShield* this, GlobalContext* globalCtx) { } func_8002F434(&this->actor, globalCtx, GI_SHIELD_DEKU, 30.0f, 50.0f); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, 10.0f, 0.0f, 5); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->timer--; if (this->timer < 60) { if (this->timer & 1) { @@ -167,7 +167,7 @@ void func_80B86CA8(ItemShield* this, GlobalContext* globalCtx) { this->unk_1A8[i].z = Rand_CenteredFloat(15.0f); } } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk_198 -= this->actor.shape.rot.x >> 1; this->unk_198 -= this->unk_198 >> 2; this->actor.shape.rot.x += this->unk_198; diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index ac98cd8cfc..1660334429 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -190,7 +190,7 @@ void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { ObjKibako_SetupHeld(this); - } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 19.0f)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.yDistToWater > 19.0f)) { ObjKibako_WaterBreak(this, globalCtx); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); ObjKibako_SpawnCollectible(this, globalCtx); @@ -252,12 +252,13 @@ void ObjKibako_Thrown(ObjKibako* this, GlobalContext* globalCtx) { s32 pad; s32 pad2; - if ((this->actor.bgCheckFlags & 0xB) || (this->collider.base.atFlags & AT_HIT)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) || + (this->collider.base.atFlags & AT_HIT)) { ObjKibako_AirBreak(this, globalCtx); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); ObjKibako_SpawnCollectible(this, globalCtx); Actor_Kill(&this->actor); - } else if (this->actor.bgCheckFlags & 0x40) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { ObjKibako_WaterBreak(this, globalCtx); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); ObjKibako_SpawnCollectible(this, globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index cb0c4b5d9c..f27eccaeac 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -241,7 +241,7 @@ void ObjTsubo_Idle(ObjTsubo* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { ObjTsubo_SetupLiftedUp(this); - } else if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 15.0f)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.yDistToWater > 15.0f)) { ObjTsubo_WaterBreak(this, globalCtx); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); ObjTsubo_SpawnCollectible(this, globalCtx); @@ -303,12 +303,13 @@ void ObjTsubo_SetupThrown(ObjTsubo* this) { void ObjTsubo_Thrown(ObjTsubo* this, GlobalContext* globalCtx) { s32 pad[2]; - if ((this->actor.bgCheckFlags & 0xB) || (this->collider.base.atFlags & AT_HIT)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) || + (this->collider.base.atFlags & AT_HIT)) { ObjTsubo_AirBreak(this, globalCtx); ObjTsubo_SpawnCollectible(this, globalCtx); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); Actor_Kill(&this->actor); - } else if (this->actor.bgCheckFlags & 0x40) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { ObjTsubo_WaterBreak(this, globalCtx); ObjTsubo_SpawnCollectible(this, globalCtx); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 94c2f582cd..c790bd1661 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -2244,7 +2244,7 @@ s32 func_80834D2C(Player* this, GlobalContext* globalCtx) { if (this->stateFlags1 & PLAYER_STATE1_23) { func_80832284(globalCtx, this, &gPlayerAnim_003380); - } else if ((this->actor.bgCheckFlags & 1) && !func_80833B54(this)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !func_80833B54(this)) { func_80832284(globalCtx, this, D_80853914[this->modelAnimType]); } @@ -2384,7 +2384,7 @@ s32 func_808351D4(Player* this, GlobalContext* globalCtx) { if (!func_808350A4(globalCtx, this)) { func_8002F7DC(&this->actor, D_808543DC[ABS(this->unk_860) - 1]); } - } else if (this->actor.bgCheckFlags & 1) { + } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_808350A4(globalCtx, this); } } @@ -2441,7 +2441,7 @@ s32 func_808353D8(Player* this, GlobalContext* globalCtx) { } s32 func_80835588(Player* this, GlobalContext* globalCtx) { - if (!(this->actor.bgCheckFlags & 1) || LinkAnimation_Update(globalCtx, &this->skelAnime2)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || LinkAnimation_Update(globalCtx, &this->skelAnime2)) { func_80833638(this, func_8083501C); } @@ -2451,7 +2451,8 @@ s32 func_80835588(Player* this, GlobalContext* globalCtx) { void func_808355DC(Player* this) { this->stateFlags1 |= PLAYER_STATE1_17; - if (!(this->skelAnime.moveFlags & 0x80) && (this->actor.bgCheckFlags & 0x200) && (D_80853608 < 0x2000)) { + if (!(this->skelAnime.moveFlags & 0x80) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && + (D_80853608 < 0x2000)) { this->currentYaw = this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; } @@ -2707,7 +2708,7 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { ((Player_ActionToSword(actionParam) != 0) || (actionParam == PLAYER_AP_NONE)))) { if ((actionParam == PLAYER_AP_NONE) || !(this->stateFlags1 & PLAYER_STATE1_27) || - ((this->actor.bgCheckFlags & 1) && + ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && ((actionParam == PLAYER_AP_HOOKSHOT) || (actionParam == PLAYER_AP_LONGSHOT)))) { if ((globalCtx->bombchuBowlingStatus == 0) && @@ -2850,7 +2851,7 @@ s32 func_80836670(Player* this, GlobalContext* globalCtx) { func_80832F54(globalCtx, this, 0x9B); func_80832224(this); this->currentYaw = this->actor.shape.rot.y; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->hoverBootsTimer = 0; this->unk_6AE |= 0x43; func_80832698(this, NA_SE_VO_LI_LASH); @@ -3430,7 +3431,7 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f if (!func_80837B18(globalCtx, this, 0 - this->actor.colChkInfo.damage)) { this->stateFlags2 &= ~PLAYER_STATE2_7; - if (!(this->actor.bgCheckFlags & 1) && !(this->stateFlags1 & PLAYER_STATE1_27)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(this->stateFlags1 & PLAYER_STATE1_27)) { func_80837B9C(this, globalCtx); } return; @@ -3469,7 +3470,7 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f sp2C = &gPlayerAnim_003320; func_80832698(this, NA_SE_VO_LI_DAMAGE_S); - } else if ((arg2 == 1) || (arg2 == 2) || !(this->actor.bgCheckFlags & 1) || + } else if ((arg2 == 1) || (arg2 == 2) || !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21))) { func_80835C58(globalCtx, this, func_8084377C, 0); @@ -3506,7 +3507,7 @@ void func_80837C0C(GlobalContext* globalCtx, Player* this, s32 arg2, f32 arg3, f } this->hoverBootsTimer = 0; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } else { if ((this->linearVelocity > 4.0f) && !func_8008E9C4(this)) { this->unk_890 = 20; @@ -3617,7 +3618,8 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { } else { sp68 = ((Player_GetHeight(this) - 8.0f) < (this->unk_6C4 * this->actor.scale.y)); - if (sp68 || (this->actor.bgCheckFlags & 0x100) || (D_808535E4 == 9) || (this->stateFlags2 & PLAYER_STATE2_31)) { + if (sp68 || (this->actor.bgCheckFlags & BGCHECKFLAG_CRUSHED) || (D_808535E4 == 9) || + (this->stateFlags2 & PLAYER_STATE2_31)) { func_80832698(this, NA_SE_VO_LI_DAMAGE_S); if (sp68) { @@ -3771,7 +3773,7 @@ void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, GlobalCont this->actor.velocity.y = arg2 * D_808535E8; this->hoverBootsTimer = 0; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; func_80832854(this); func_80832698(this, sfxId); @@ -3804,7 +3806,7 @@ s32 func_80838A14(Player* this, GlobalContext* globalCtx) { } else if ((this->currentBoots != PLAYER_BOOTS_IRON) || (this->unk_88C > 2)) { return 0; } - } else if (!(this->actor.bgCheckFlags & 1) || + } else if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || ((this->ageProperties->unk_14 <= this->wallHeight) && (this->stateFlags1 & PLAYER_STATE1_27))) { return 0; } @@ -3858,7 +3860,7 @@ s32 func_80838A14(Player* this, GlobalContext* globalCtx) { func_80832224(this); } - this->actor.bgCheckFlags |= 1; + this->actor.bgCheckFlags |= BGCHECKFLAG_GROUND; LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, sp38, 1.3f); AnimationContext_DisableQueue(globalCtx); @@ -3867,7 +3869,7 @@ s32 func_80838A14(Player* this, GlobalContext* globalCtx) { return 1; } - } else if ((this->actor.bgCheckFlags & 1) && (this->unk_88C == 1) && (this->unk_88D >= 3)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->unk_88C == 1) && (this->unk_88D >= 3)) { temp = (this->wallHeight * 0.08f) + 5.5f; func_808389E8(this, &gPlayerAnim_002FE0, temp, globalCtx); this->linearVelocity = 2.5f; @@ -3953,7 +3955,7 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u sp34 = this->unk_A84 - (s32)this->actor.world.pos.y; if (!(this->stateFlags1 & (PLAYER_STATE1_23 | PLAYER_STATE1_27 | PLAYER_STATE1_29)) && - !(this->actor.bgCheckFlags & 1) && (sp34 < 100) && (D_80853600 > 100.0f)) { + !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (sp34 < 100) && (D_80853600 > 100.0f)) { return 0; } @@ -3986,7 +3988,7 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u if (!(this->stateFlags1 & (PLAYER_STATE1_23 | PLAYER_STATE1_29)) && !(this->stateFlags2 & PLAYER_STATE2_18) && !func_808332B8(this) && (temp = func_80041D4C(&globalCtx->colCtx, poly, bgId), (temp != 10)) && - ((sp34 < 100) || (this->actor.bgCheckFlags & 1))) { + ((sp34 < 100) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) { if (temp == 11) { func_800788CC(NA_SE_OC_SECRET_HOLE_OUT); @@ -4015,7 +4017,7 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u func_80838E70(globalCtx, this, 400.0f, yaw); } } else { - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_80832210(this); } } @@ -4034,7 +4036,7 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u ((globalCtx->sceneNum != SCENE_HAKADAN) && (this->fallDistance > 200.0f)))) || ((globalCtx->sceneNum == SCENE_GANON_FINAL) && (this->fallDistance > 320.0f))) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->unk_A7A == 5) { Gameplay_TriggerRespawn(globalCtx); } else { @@ -4551,7 +4553,8 @@ void func_8083AA10(Player* this, GlobalContext* globalCtx) { this->fallDistance = this->fallStartHeight - (s32)this->actor.world.pos.y; - if (!(this->stateFlags1 & (PLAYER_STATE1_27 | PLAYER_STATE1_29)) && !(this->actor.bgCheckFlags & 1)) { + if (!(this->stateFlags1 & (PLAYER_STATE1_27 | PLAYER_STATE1_29)) && + !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (!func_80838FB8(globalCtx, this)) { if (D_80853604 == 8) { this->actor.world.pos.x = this->actor.prevPos.x; @@ -4581,9 +4584,9 @@ void func_8083AA10(Player* this, GlobalContext* globalCtx) { this->unk_89E = this->unk_A82; - if ((this->actor.bgCheckFlags & 4) && !(this->stateFlags1 & PLAYER_STATE1_27) && (D_80853604 != 6) && - (D_80853604 != 9) && (D_80853600 > 20.0f) && (this->swordState == 0) && (ABS(sp5C) < 0x2000) && - (this->linearVelocity > 3.0f)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_LEAVE) && !(this->stateFlags1 & PLAYER_STATE1_27) && + (D_80853604 != 6) && (D_80853604 != 9) && (D_80853600 > 20.0f) && (this->swordState == 0) && + (ABS(sp5C) < 0x2000) && (this->linearVelocity > 3.0f)) { if ((D_80853604 == 11) && !(this->stateFlags1 & PLAYER_STATE1_11)) { @@ -4707,8 +4710,8 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { GetItemEntry* giEntry; Actor* targetActor; - if ((this->unk_6AD != 0) && - (func_808332B8(this) || (this->actor.bgCheckFlags & 1) || (this->stateFlags1 & PLAYER_STATE1_23))) { + if ((this->unk_6AD != 0) && (func_808332B8(this) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + (this->stateFlags1 & PLAYER_STATE1_23))) { if (!func_8083ADD4(globalCtx, this)) { if (this->unk_6AD == 4) { @@ -4872,7 +4875,7 @@ s32 func_8083B644(Player* this, GlobalContext* globalCtx) { if (!(this->stateFlags1 & PLAYER_STATE1_11) || ((this->heldActor != NULL) && (sp28 || (sp34 == this->heldActor) || (sp2C == this->heldActor) || ((sp34 != NULL) && (sp34->flags & ACTOR_FLAG_16))))) { - if ((this->actor.bgCheckFlags & 1) || (this->stateFlags1 & PLAYER_STATE1_23) || + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->stateFlags1 & PLAYER_STATE1_23) || (func_808332B8(this) && !(this->stateFlags2 & PLAYER_STATE2_10))) { if (sp34 != NULL) { @@ -4923,7 +4926,7 @@ s32 func_8083B644(Player* this, GlobalContext* globalCtx) { s32 func_8083B8F4(Player* this, GlobalContext* globalCtx) { if (!(this->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_23)) && Camera_CheckValidMode(Gameplay_GetCamera(globalCtx, 0), 6)) { - if ((this->actor.bgCheckFlags & 1) || + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (func_808332B8(this) && (this->actor.yDistToWater < this->ageProperties->unk_2C))) { this->unk_6AD = 1; return 1; @@ -4960,7 +4963,7 @@ void func_8083BA90(GlobalContext* globalCtx, Player* this, s32 arg2, f32 xzVeloc this->linearVelocity = xzVelocity; this->actor.velocity.y = yVelocity; - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; this->hoverBootsTimer = 0; func_80832854(this); @@ -5209,7 +5212,8 @@ s32 func_8083C544(Player* this, GlobalContext* globalCtx) { } s32 func_8083C61C(GlobalContext* globalCtx, Player* this) { - if ((globalCtx->roomCtx.curRoom.unk_03 != 2) && (this->actor.bgCheckFlags & 1) && (AMMO(ITEM_NUT) != 0)) { + if ((globalCtx->roomCtx.curRoom.unk_03 != 2) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + (AMMO(ITEM_NUT) != 0)) { func_80835C58(globalCtx, this, func_8084E604, 0); func_80832264(globalCtx, this, &gPlayerAnim_003048); this->unk_6AD = 0; @@ -5246,7 +5250,7 @@ s32 func_8083C6B8(GlobalContext* globalCtx, Player* this) { sp24 = this->actor.world.pos; sp24.y += 50.0f; - if (!(this->actor.bgCheckFlags & 1) || (this->actor.world.pos.z > 1300.0f) || + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.world.pos.z > 1300.0f) || BgCheck_SphVsFirstPoly(&globalCtx->colCtx, &sp24, 20.0f)) { func_80078884(NA_SE_SY_ERROR); return 0; @@ -5512,7 +5516,7 @@ void func_8083D330(GlobalContext* globalCtx, Player* this) { } void func_8083D36C(GlobalContext* globalCtx, Player* this) { - if ((this->currentBoots != PLAYER_BOOTS_IRON) || !(this->actor.bgCheckFlags & 1)) { + if ((this->currentBoots != PLAYER_BOOTS_IRON) || !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_80832564(globalCtx, this); if ((this->currentBoots != PLAYER_BOOTS_IRON) && (this->stateFlags2 & PLAYER_STATE2_10)) { @@ -5524,7 +5528,8 @@ void func_8083D36C(GlobalContext* globalCtx, Player* this) { func_8083D330(globalCtx, this); } else { func_80835C58(globalCtx, this, func_8084D610, 1); - func_80832B0C(globalCtx, this, (this->actor.bgCheckFlags & 1) ? &gPlayerAnim_003330 : &gPlayerAnim_0032E0); + func_80832B0C(globalCtx, this, + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) ? &gPlayerAnim_003330 : &gPlayerAnim_0032E0); } } @@ -5560,7 +5565,7 @@ void func_8083D53C(GlobalContext* globalCtx, Player* this) { if ((func_80845668 != this->func_674) && (func_8084BDFC != this->func_674)) { if (this->ageProperties->unk_2C < this->actor.yDistToWater) { if (!(this->stateFlags1 & PLAYER_STATE1_27) || - (!((this->currentBoots == PLAYER_BOOTS_IRON) && (this->actor.bgCheckFlags & 1)) && + (!((this->currentBoots == PLAYER_BOOTS_IRON) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) && (func_8084E30C != this->func_674) && (func_8084E368 != this->func_674) && (func_8084D610 != this->func_674) && (func_8084D84C != this->func_674) && (func_8084DAB4 != this->func_674) && (func_8084DC48 != this->func_674) && @@ -5627,7 +5632,7 @@ void func_8083D6EC(GlobalContext* globalCtx, Player* this) { this->unk_6C4 = 0.0f; } - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (this->actor.yDistToWater < 50.0f) { temp4 = fabsf(this->bodyPartsPos[0].x - this->unk_A88.x) + fabsf(this->bodyPartsPos[0].y - this->unk_A88.y) + fabsf(this->bodyPartsPos[0].z - this->unk_A88.z); @@ -5656,7 +5661,7 @@ void func_8083D6EC(GlobalContext* globalCtx, Player* this) { s32 numBubbles = 0; s32 i; - if ((this->actor.velocity.y > -1.0f) || (this->actor.bgCheckFlags & 1)) { + if ((this->actor.velocity.y > -1.0f) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (Rand_ZeroOne() < 0.2f) { numBubbles = 1; } @@ -5783,7 +5788,7 @@ s32 func_8083E0FC(Player* this, GlobalContext* globalCtx) { func_80836898(globalCtx, this, func_8083A360); this->stateFlags1 |= PLAYER_STATE1_23; - this->actor.bgCheckFlags &= ~0x20; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER; if (this->mountSide < 0) { temp = 0; @@ -6102,7 +6107,7 @@ s32 func_8083EC18(Player* this, GlobalContext* globalCtx, u32 arg2) { if ((sp8C != 0) || (arg2 & 2)) { if ((this->unk_84F = sp8C) != 0) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { sp30 = &gPlayerAnim_002D80; } else { sp30 = &gPlayerAnim_002D68; @@ -6228,7 +6233,7 @@ s32 func_8083F360(GlobalContext* globalCtx, Player* this, f32 arg1, f32 arg2, f3 true, &sp78)) { wallPoly = this->actor.wallPoly; - this->actor.bgCheckFlags |= 0x200; + this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_WALL_INTERACT; this->actor.wallBgId = sp78; D_808535F0 = func_80041DB8(&globalCtx->colCtx, wallPoly, sp78); @@ -6245,7 +6250,7 @@ s32 func_8083F360(GlobalContext* globalCtx, Player* this, f32 arg1, f32 arg2, f3 return 1; } - this->actor.bgCheckFlags &= ~0x200; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_PLAYER_WALL_INTERACT; return 0; } @@ -6257,7 +6262,7 @@ s32 func_8083F524(GlobalContext* globalCtx, Player* this) { s32 func_8083F570(Player* this, GlobalContext* globalCtx) { s16 temp; - if ((this->linearVelocity != 0.0f) && (this->actor.bgCheckFlags & 8) && (D_808535F0 & 0x30)) { + if ((this->linearVelocity != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (D_808535F0 & 0x30)) { temp = this->actor.shape.rot.y - this->actor.wallYaw; if (this->linearVelocity < 0.0f) { @@ -6304,7 +6309,8 @@ void func_8083F72C(Player* this, LinkAnimationHeader* anim, GlobalContext* globa s32 func_8083F7BC(Player* this, GlobalContext* globalCtx) { DynaPolyActor* wallPolyActor; - if (!(this->stateFlags1 & PLAYER_STATE1_11) && (this->actor.bgCheckFlags & 0x200) && (D_80853608 < 0x3000)) { + if (!(this->stateFlags1 & PLAYER_STATE1_11) && (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && + (D_80853608 < 0x3000)) { if (((this->linearVelocity > 0.0f) && func_8083EC18(this, globalCtx, D_808535F0)) || func_8083F0C8(this, globalCtx, D_808535F0)) { @@ -6312,7 +6318,7 @@ s32 func_8083F7BC(Player* this, GlobalContext* globalCtx) { } if (!func_808332B8(this) && ((this->linearVelocity == 0.0f) || !(this->stateFlags2 & PLAYER_STATE2_2)) && - (D_808535F0 & 0x40) && (this->actor.bgCheckFlags & 1) && (this->wallHeight >= 39.0f)) { + (D_808535F0 & 0x40) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->wallHeight >= 39.0f)) { this->stateFlags2 |= PLAYER_STATE2_0; @@ -6352,7 +6358,7 @@ s32 func_8083F7BC(Player* this, GlobalContext* globalCtx) { } s32 func_8083F9D0(GlobalContext* globalCtx, Player* this) { - if ((this->actor.bgCheckFlags & 0x200) && + if ((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && ((this->stateFlags2 & PLAYER_STATE2_4) || CHECK_BTN_ALL(sControlInput->cur.button, BTN_A))) { DynaPolyActor* wallPolyActor = NULL; @@ -6394,7 +6400,8 @@ void func_8083FB7C(Player* this, GlobalContext* globalCtx) { } s32 func_8083FBC0(Player* this, GlobalContext* globalCtx) { - if (!CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && (this->actor.bgCheckFlags & 0x200) && + if (!CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && + (this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && ((D_808535F0 & 8) || (D_808535F0 & 2) || func_80041E4C(&globalCtx->colCtx, this->actor.wallPoly, this->actor.wallBgId))) { return 0; @@ -6541,7 +6548,8 @@ void func_8084029C(Player* this, f32 arg1) { if (1) {} - if ((this->currentBoots == PLAYER_BOOTS_HOVER) && !(this->actor.bgCheckFlags & 1) && (this->hoverBootsTimer != 0)) { + if ((this->currentBoots == PLAYER_BOOTS_HOVER) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + (this->hoverBootsTimer != 0)) { func_8002F8F0(&this->actor, NA_SE_PL_HOBBERBOOTS_LV - SFX_FLAG); } else if (func_8084021C(this->unk_868, arg1, 29.0f, 10.0f) || func_8084021C(this->unk_868, arg1, 29.0f, 24.0f)) { func_808327F8(this, this->linearVelocity); @@ -7752,7 +7760,7 @@ void func_8084377C(Player* this, GlobalContext* globalCtx) { } } - if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->actor.bgCheckFlags & 1)) { + if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->unk_850 != 0) { this->unk_850--; if (this->unk_850 == 0) { @@ -7773,7 +7781,7 @@ void func_8084377C(Player* this, GlobalContext* globalCtx) { } } - if (this->actor.bgCheckFlags & 2) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { func_80832770(this, NA_SE_PL_BOUND); } } @@ -7988,7 +7996,7 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { func_80837268(this, &sp4C, &sp4A, 0.0f, globalCtx); - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->stateFlags1 & PLAYER_STATE1_11) { Actor* heldActor = this->heldActor; @@ -8009,7 +8017,8 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { if (((this->stateFlags2 & PLAYER_STATE2_19) && (this->unk_84F == 2)) || !func_8083BBA0(this, globalCtx)) { if (this->actor.velocity.y < 0.0f) { if (this->unk_850 >= 0) { - if ((this->actor.bgCheckFlags & 8) || (this->unk_850 == 0) || (this->fallDistance > 0)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->unk_850 == 0) || + (this->fallDistance > 0)) { if ((D_80853600 > 800.0f) || (this->stateFlags1 & PLAYER_STATE1_2)) { func_80843E14(this, NA_SE_VO_LI_FALL_S); this->stateFlags1 &= ~PLAYER_STATE1_2; @@ -8025,7 +8034,8 @@ void func_8084411C(Player* this, GlobalContext* globalCtx) { func_80843E14(this, NA_SE_VO_LI_FALL_L); } - if ((this->actor.bgCheckFlags & 0x200) && !(this->stateFlags2 & PLAYER_STATE2_19) && + if ((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && + !(this->stateFlags2 & PLAYER_STATE2_19) && !(this->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_27)) && (this->linearVelocity > 0.0f)) { if ((this->wallHeight >= 150.0f) && (this->unk_84B[this->unk_846] == 0)) { func_8083EC18(this, globalCtx, D_808535F0); @@ -8122,7 +8132,7 @@ void func_80844708(Player* this, GlobalContext* globalCtx) { } } else { if (this->linearVelocity >= 7.0f) { - if (((this->actor.bgCheckFlags & 0x200) && (D_8085360C < 0x2000)) || + if (((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (D_8085360C < 0x2000)) || ((this->cylinder.base.ocFlags1 & OC1_HIT) && (cylinderOc = this->cylinder.base.oc, ((cylinderOc->id == ACTOR_EN_WOOD02) && @@ -8182,7 +8192,7 @@ void func_80844A44(Player* this, GlobalContext* globalCtx) { Math_StepToF(&this->linearVelocity, 0.0f, 0.05f); - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.colChkInfo.damage = 0x10; func_80837C0C(globalCtx, this, 1, 4.0f, 5.0f, this->actor.shape.rot.y, 20); } @@ -8200,7 +8210,7 @@ void func_80844AF4(Player* this, GlobalContext* globalCtx) { if (!func_80842DF4(globalCtx, this)) { func_8084285C(this, 6.0f, 7.0f, 99.0f); - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_80837268(this, &sp2C, &sp2A, 0.0f, globalCtx); func_8083DFE0(this, &sp2C, &this->currentYaw); return; @@ -8706,7 +8716,9 @@ void func_80846050(Player* this, GlobalContext* globalCtx) { this->heldActor = interactRangeActor; this->actor.child = interactRangeActor; interactRangeActor->parent = &this->actor; - interactRangeActor->bgCheckFlags &= 0xFF00; + interactRangeActor->bgCheckFlags &= + ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_GROUND_LEAVE | BGCHECKFLAG_WALL | + BGCHECKFLAG_CEILING | BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH | BGCHECKFLAG_GROUND_STRICT); this->unk_3BC.y = interactRangeActor->shape.rot.y - this->actor.shape.rot.y; } return; @@ -9293,7 +9305,7 @@ void func_808473D4(GlobalContext* globalCtx, Player* this) { doAction = DO_ACTION_ENTER; } else if ((this->stateFlags1 & PLAYER_STATE1_11) && (this->getItemId == GI_NONE) && (heldActor != NULL)) { - if ((this->actor.bgCheckFlags & 1) || (heldActor->id == ACTOR_EN_NIW)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (heldActor->id == ACTOR_EN_NIW)) { if (func_8083EAF0(this, heldActor) == 0) { doAction = DO_ACTION_DROP; } else { @@ -9362,11 +9374,11 @@ s32 func_80847A78(Player* this) { cond = (this->currentBoots == PLAYER_BOOTS_HOVER) && ((this->actor.yDistToWater >= 0.0f) || (func_80838144(D_808535E4) >= 0) || func_8083816C(D_808535E4)); - if (cond && (this->actor.bgCheckFlags & 1) && (this->hoverBootsTimer != 0)) { - this->actor.bgCheckFlags &= ~1; + if (cond && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->hoverBootsTimer != 0)) { + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (!cond) { this->hoverBootsTimer = 19; } @@ -9404,13 +9416,13 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { if (this->stateFlags1 & (PLAYER_STATE1_29 | PLAYER_STATE1_31)) { if (this->stateFlags1 & PLAYER_STATE1_31) { - this->actor.bgCheckFlags &= ~1; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; spA4 = 0x38; } else if ((this->stateFlags1 & PLAYER_STATE1_0) && ((this->unk_A84 - (s32)this->actor.world.pos.y) >= 100)) { spA4 = 0x39; } else if (!(this->stateFlags1 & PLAYER_STATE1_0) && ((func_80845EF8 == this->func_674) || (func_80845CA4 == this->func_674))) { - this->actor.bgCheckFlags &= ~0x208; + this->actor.bgCheckFlags &= ~(BGCHECKFLAG_WALL | BGCHECKFLAG_PLAYER_WALL_INTERACT); spA4 = 0x3C; } else { spA4 = 0x3F; @@ -9430,7 +9442,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { Math_Vec3f_Copy(&spB4, &this->actor.world.pos); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, spAC, spB0, spA8, spA4); - if (this->actor.bgCheckFlags & 0x10) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) { this->actor.velocity.y = 0.0f; } @@ -9443,7 +9455,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { this->unk_A7A = func_80041EA4(&globalCtx->colCtx, spC0, this->actor.floorBgId); this->unk_A82 = this->unk_89E; - if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { if (this->actor.yDistToWater < 20.0f) { this->unk_89E = 4; } else { @@ -9473,7 +9485,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { D_808535F8 = SurfaceType_IsConveyor(&globalCtx->colCtx, spC0, this->actor.floorBgId); if (((D_808535F8 == 0) && (this->actor.yDistToWater > 20.0f) && (this->currentBoots != PLAYER_BOOTS_IRON)) || - ((D_808535F8 != 0) && (this->actor.bgCheckFlags & 1))) { + ((D_808535F8 != 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND))) { D_808535FC = SurfaceType_GetConveyorDirection(&globalCtx->colCtx, spC0, this->actor.floorBgId) << 10; } else { D_808535F4 = 0; @@ -9483,9 +9495,9 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { func_80839034(globalCtx, this, spC0, this->actor.floorBgId); - this->actor.bgCheckFlags &= ~0x200; + this->actor.bgCheckFlags &= ~BGCHECKFLAG_PLAYER_WALL_INTERACT; - if (this->actor.bgCheckFlags & 8) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { CollisionPoly* spA0; s32 sp9C; s16 sp9A; @@ -9496,7 +9508,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { if (!(this->stateFlags2 & PLAYER_STATE2_18) && func_80839768(globalCtx, this, &D_80854798, &spA0, &sp9C, &D_80858AA8)) { - this->actor.bgCheckFlags |= 0x200; + this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_WALL_INTERACT; if (this->actor.wallPoly != spA0) { this->actor.wallPoly = spA0; this->actor.wallBgId = sp9C; @@ -9515,7 +9527,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { D_8085360C = ABS(sp9A); spB0 = D_8085360C * 0.00008f; - if (!(this->actor.bgCheckFlags & 1) || spB0 >= 1.0f) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || spB0 >= 1.0f) { this->unk_880 = R_RUN_SPEED_LIMIT / 100.0f; } else { spAC = (R_RUN_SPEED_LIMIT / 100.0f * spB0); @@ -9525,7 +9537,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { } } - if ((this->actor.bgCheckFlags & 0x200) && (D_80853608 < 0x3000)) { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_PLAYER_WALL_INTERACT) && (D_80853608 < 0x3000)) { CollisionPoly* wallPoly = this->actor.wallPoly; if (ABS(wallPoly->normal.y) < 600) { @@ -9597,7 +9609,7 @@ void func_80847BA0(GlobalContext* globalCtx, Player* this) { this->unk_88D = 0; } - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { D_808535E4 = func_80041D4C(&globalCtx->colCtx, spC0, this->actor.floorBgId); if (!func_80847A78(this)) { @@ -9941,7 +9953,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { } if (this->stateFlags2 & PLAYER_STATE2_15) { - if (!(this->actor.bgCheckFlags & 1)) { + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_80832210(this); Actor_MoveForward(&this->actor); } @@ -9961,7 +9973,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { } } else { if (this->stateFlags1 & PLAYER_STATE1_27) { - if ((this->prevBoots == PLAYER_BOOTS_IRON) || (this->actor.bgCheckFlags & 1)) { + if ((this->prevBoots == PLAYER_BOOTS_IRON) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_8083D36C(globalCtx, this); this->stateFlags2 &= ~PLAYER_STATE2_10; } @@ -10002,7 +10014,8 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { } if (!(this->skelAnime.moveFlags & 0x80)) { - if (((this->actor.bgCheckFlags & 1) && (D_808535E4 == 5) && (this->currentBoots != PLAYER_BOOTS_IRON)) || + if (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (D_808535E4 == 5) && + (this->currentBoots != PLAYER_BOOTS_IRON)) || ((this->currentBoots == PLAYER_BOOTS_HOVER) && !(this->stateFlags1 & (PLAYER_STATE1_27 | PLAYER_STATE1_29)))) { f32 sp70 = this->linearVelocity; @@ -10057,7 +10070,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { s32 sp58; Vec3f sp4C; - if (!(rideActor->actor.bgCheckFlags & 1)) { + if (!(rideActor->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_808396F4(globalCtx, this, &D_80854814, &sp4C, &sp5C, &sp58); } else { sp5C = rideActor->actor.floorPoly; @@ -10107,7 +10120,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) { if (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21)) { func_80832440(globalCtx, this); func_80837B9C(this, globalCtx); - } else if ((this->actor.bgCheckFlags & 1) || (this->stateFlags1 & PLAYER_STATE1_27)) { + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->stateFlags1 & PLAYER_STATE1_27)) { func_80836448(globalCtx, this, func_808332B8(this) ? &gPlayerAnim_003310 : (this->shockTimer != 0) ? &gPlayerAnim_002F08 @@ -10376,7 +10389,7 @@ void func_8084A0E8(GlobalContext* globalCtx, Player* this, s32 lod, Gfx* cullDLi gSPDisplayList(POLY_OPA_DISP++, sMaskDlists[this->currentMask - 1]); } - if ((this->currentBoots == PLAYER_BOOTS_HOVER) && !(this->actor.bgCheckFlags & 1) && + if ((this->currentBoots == PLAYER_BOOTS_HOVER) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(this->stateFlags1 & PLAYER_STATE1_23) && (this->hoverBootsTimer != 0)) { s32 sp5C; s32 hoverBootsTimer = this->hoverBootsTimer; @@ -11594,7 +11607,7 @@ void func_8084D610(Player* this, GlobalContext* globalCtx) { sp34 = 0.0f; sp32 = this->actor.shape.rot.y; - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { func_8083A098(this, D_80853A7C[this->modelAnimType], globalCtx); func_808328A0(this); } @@ -11756,7 +11769,8 @@ void func_8084DC48(Player* this, GlobalContext* globalCtx) { this->unk_6C2 = 16000; if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) && !func_8083E5A8(this, globalCtx) && - !(this->actor.bgCheckFlags & 1) && (this->actor.yDistToWater < D_80854784[CUR_UPG_VALUE(UPG_SCALE)])) { + !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && + (this->actor.yDistToWater < D_80854784[CUR_UPG_VALUE(UPG_SCALE)])) { func_8084DBC4(globalCtx, this, -2.0f); } else { this->unk_84F++; @@ -12418,7 +12432,7 @@ void func_8084F710(Player* this, GlobalContext* globalCtx) { } else if (D_80853600 < 150.0f) { if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { if (this->unk_850 == 0) { - if (this->actor.bgCheckFlags & 1) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; func_808328A0(this); this->unk_850 = 1; @@ -12952,7 +12966,7 @@ void func_80850AEC(Player* this, GlobalContext* globalCtx) { this->actor.velocity.y = 0.0f; func_80837B9C(this, globalCtx); this->stateFlags2 &= ~PLAYER_STATE2_10; - this->actor.bgCheckFlags |= 1; + this->actor.bgCheckFlags |= BGCHECKFLAG_GROUND; this->stateFlags1 |= PLAYER_STATE1_2; return; } @@ -13602,7 +13616,8 @@ void func_80851BE8(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg } void func_80851CA4(GlobalContext* globalCtx, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->unk_850 == 0) && (this->actor.bgCheckFlags & 1)) { + if (LinkAnimation_Update(globalCtx, &this->skelAnime) && (this->unk_850 == 0) && + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { func_80832264(globalCtx, this, &gPlayerAnim_002DB8); this->unk_850 = 1; }