Introduce BgCheckFlags Defines (#1195)

* flags

* cleanup

* adjust comment
This commit is contained in:
engineer124
2023-03-04 19:53:56 -03:00
committed by GitHub
parent 8b025badd1
commit 2cce8f6767
149 changed files with 719 additions and 672 deletions
+15 -15
View File
@@ -132,6 +132,20 @@ typedef struct {
/* 0x18 */ Vec3f feetPos[2]; // Update by using `Actor_SetFeetPos` in PostLimbDrawOpa
} ActorShape; // size = 0x30
#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) // Similar to BGCHECKFLAG_GROUND but with no velocity check and is cleared every frame
#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
#define BGCHECKFLAG_PLAYER_400 (1 << 10) //
#define BGCHECKFLAG_PLAYER_800 (1 << 11) //
#define BGCHECKFLAG_PLAYER_1000 (1 << 12) //
typedef struct Actor {
/* 0x000 */ s16 id; // Actor ID
/* 0x002 */ u8 category; // Actor category. Refer to the corresponding enum for values
@@ -160,7 +174,7 @@ typedef struct Actor {
/* 0x086 */ s16 wallYaw; // Y rotation of the wall polygon the actor is touching
/* 0x088 */ f32 floorHeight; // Y position of the floor polygon directly below the actor
/* 0x08C */ f32 depthInWater; // Directed distance to the surface of active waterbox. Negative value means water is below.
/* 0x090 */ u16 bgCheckFlags; // See comments below actor struct for wip docs. TODO: macros for these flags
/* 0x090 */ u16 bgCheckFlags; // Flags indicating how the actor is interacting with collision
/* 0x092 */ s16 yawTowardsPlayer; // Y rotation difference between the actor and the player
/* 0x094 */ f32 xyzDistToPlayerSq; // Squared distance between the actor and the player in the x,y,z axis
/* 0x098 */ f32 xzDistToPlayer; // Distance between the actor and the player in the XZ plane
@@ -198,20 +212,6 @@ typedef enum {
/* 1 */ FOOT_RIGHT
} ActorFootIndex;
/**
* BgCheckFlags WIP documentation (logical masks):
* 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 : Only set/used by player, related to interacting with walls
*/
typedef struct {
/* 0x000 */ Actor actor;
/* 0x144 */ s32 bgId;
+38 -37
View File
@@ -113,7 +113,7 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, PlayState* play, Gfx* dlist,
}
void ActorShadow_DrawCircle(Actor* actor, Lights* lights, PlayState* play) {
if (actor->bgCheckFlags & 0x400) {
if (actor->bgCheckFlags & BGCHECKFLAG_PLAYER_400) {
func_800B4AEC(play, actor, 50.0f);
}
@@ -121,7 +121,7 @@ void ActorShadow_DrawCircle(Actor* actor, Lights* lights, PlayState* play) {
}
void ActorShadow_DrawSquare(Actor* actor, Lights* lights, PlayState* play) {
if (actor->bgCheckFlags & 0x400) {
if (actor->bgCheckFlags & BGCHECKFLAG_PLAYER_400) {
func_800B4AEC(play, actor, 50.0f);
}
@@ -285,7 +285,7 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* mapper, PlayState* play) {
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;
@@ -336,7 +336,7 @@ void func_800B4B50(Actor* actor, Lights* mapper, PlayState* play) {
Light* phi_s0;
s32 lightNumMax;
if (actor->bgCheckFlags & 0x400) {
if (actor->bgCheckFlags & BGCHECKFLAG_PLAYER_400) {
func_800B4AEC(play, actor, 50.0f);
}
@@ -1497,9 +1497,9 @@ void Actor_GetSlopeDirection(CollisionPoly* floorPoly, Vec3f* slopeNormal, s16*
}
s32 func_800B761C(Actor* actor, f32 arg1, s32 arg2) {
if (actor->bgCheckFlags & 1) {
actor->bgCheckFlags &= ~1;
actor->bgCheckFlags |= 4;
if (actor->bgCheckFlags & BGCHECKFLAG_GROUND) {
actor->bgCheckFlags &= ~BGCHECKFLAG_GROUND;
actor->bgCheckFlags |= BGCHECKFLAG_GROUND_LEAVE;
if ((actor->velocity.y < 0.0f) && (arg2 & 0x10)) {
actor->velocity.y = 0.0f;
@@ -1517,21 +1517,22 @@ s32 func_800B7678(PlayState* play, Actor* actor, Vec3f* pos, s32 flags) {
pos->y += (flags & 0x800) ? 10.0f : 50.0f;
actor->floorHeight = BgCheck_EntityRaycastFloor5_2(play, &play->colCtx, &actor->floorPoly, &bgId, actor, pos);
actor->bgCheckFlags &= ~(0x80 | 0x04 | 0x02);
actor->bgCheckFlags &= ~(BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_GROUND_LEAVE | BGCHECKFLAG_GROUND_STRICT);
if (actor->floorHeight <= BGCHECK_Y_MIN) {
return func_800B761C(actor, BGCHECK_Y_MIN, flags);
}
distToFloor = actor->floorHeight - actor->world.pos.y;
actor->floorBgId = bgId;
if ((distToFloor >= 0.0f) || (((actor->bgCheckFlags & 1)) && !(actor->bgCheckFlags & 0x800) &&
(distToFloor >= -11.0f) && (actor->velocity.y < 0.0f))) {
actor->bgCheckFlags |= 0x80;
if ((distToFloor >= 0.0f) ||
(((actor->bgCheckFlags & BGCHECKFLAG_GROUND)) && !(actor->bgCheckFlags & BGCHECKFLAG_PLAYER_800) &&
(distToFloor >= -11.0f) && (actor->velocity.y < 0.0f))) {
actor->bgCheckFlags |= BGCHECKFLAG_GROUND_STRICT;
if (actor->bgCheckFlags & 0x10) {
if (actor->bgCheckFlags & BGCHECKFLAG_CEILING) {
if (bgId != D_801ED8B4) {
if (distToFloor > 15.0f) {
actor->bgCheckFlags |= 0x100;
actor->bgCheckFlags |= BGCHECKFLAG_CRUSHED;
}
} else {
actor->world.pos.x = actor->prevPos.x;
@@ -1542,15 +1543,15 @@ s32 func_800B7678(PlayState* play, Actor* actor, Vec3f* pos, s32 flags) {
actor->world.pos.y = actor->floorHeight;
if (actor->velocity.y <= 0.0f) {
if (!(actor->bgCheckFlags & 1)) {
actor->bgCheckFlags |= 2;
if (!(actor->bgCheckFlags & BGCHECKFLAG_GROUND)) {
actor->bgCheckFlags |= BGCHECKFLAG_GROUND_TOUCH;
} else if ((flags & 8) && (actor->gravity < 0.0f)) {
actor->velocity.y = -4.0f;
} else if (!(flags & 0x100)) {
actor->velocity.y = 0.0f;
}
actor->bgCheckFlags |= 1;
actor->bgCheckFlags |= BGCHECKFLAG_GROUND;
BgCheck2_AttachToMesh(&play->colCtx, actor, (s32)actor->floorBgId);
}
} else {
@@ -1566,14 +1567,14 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
s32 pad;
Vec3f pos;
if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & 1)) {
if ((actor->floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & BGCHECKFLAG_GROUND)) {
BgCheck2_UpdateActorAttachedToMesh(&play->colCtx, actor->floorBgId, actor);
}
if (flags & 1) {
s32 bgId;
actor->bgCheckFlags &= ~0x1000;
actor->bgCheckFlags &= ~BGCHECKFLAG_PLAYER_1000;
if ((!(flags & 0x80) &&
(BgCheck_EntitySphVsWall3(&play->colCtx, &pos, &actor->world.pos, &actor->prevPos, wallCheckRadius,
&actor->wallPoly, &bgId, actor, wallCheckHeight))) ||
@@ -1582,18 +1583,18 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
&actor->wallPoly, &bgId, actor, wallCheckHeight)))) {
CollisionPoly* sp7C = actor->wallPoly;
actor->bgCheckFlags |= 8;
if ((flags & 0x200) && (actor->bgCheckFlags & 0x1000) && ((s32)sp7C->normal.y > 0) &&
actor->bgCheckFlags |= BGCHECKFLAG_WALL;
if ((flags & 0x200) && (actor->bgCheckFlags & BGCHECKFLAG_PLAYER_1000) && ((s32)sp7C->normal.y > 0) &&
(sqrtf(SQXYZ(actor->colChkInfo.displacement)) < 10.0f)) {
actor->bgCheckFlags &= ~8;
} else if (actor->bgCheckFlags & 8) {
actor->bgCheckFlags &= ~BGCHECKFLAG_WALL;
} else if (actor->bgCheckFlags & BGCHECKFLAG_WALL) {
Math_Vec3f_Copy(&actor->world.pos, &pos);
}
actor->wallYaw = Math_Atan2S_XY(sp7C->normal.z, sp7C->normal.x);
actor->wallBgId = bgId;
} else {
actor->bgCheckFlags &= ~8;
actor->bgCheckFlags &= ~BGCHECKFLAG_WALL;
}
}
@@ -1605,10 +1606,10 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
pos.y = actor->prevPos.y + 4.0f;
if (BgCheck_EntityCheckCeiling(&play->colCtx, &y, &pos, (ceilingCheckHeight + sp94) - 4.0f, &D_801ED8B0,
&D_801ED8B4, actor)) {
actor->bgCheckFlags |= 0x10;
actor->bgCheckFlags |= BGCHECKFLAG_CEILING;
actor->world.pos.y = (y + sp94) - 4.0f;
} else {
actor->bgCheckFlags &= ~0x10;
actor->bgCheckFlags &= ~BGCHECKFLAG_CEILING;
}
}
if (flags & 4) {
@@ -1622,9 +1623,9 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
if (WaterBox_GetSurface1(play, &play->colCtx, actor->world.pos.x, actor->world.pos.z, &y, &waterbox)) {
actor->depthInWater = y - actor->world.pos.y;
if (actor->depthInWater <= 0.0f) {
actor->bgCheckFlags &= ~(0x40 | 0x20);
} else if (!(actor->bgCheckFlags & 0x20)) {
actor->bgCheckFlags |= (0x40 | 0x20);
actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH);
} else if (!(actor->bgCheckFlags & BGCHECKFLAG_WATER)) {
actor->bgCheckFlags |= (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH);
if (!(flags & 0x40)) {
Vec3f sp64;
@@ -1637,10 +1638,10 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
EffectSsGRipple_Spawn(play, &sp64, 100, 500, 8);
}
} else {
actor->bgCheckFlags &= ~0x40;
actor->bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH;
}
} else {
actor->bgCheckFlags &= ~(0x40 | 0x20);
actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH);
actor->depthInWater = BGCHECK_Y_MIN;
}
}
@@ -1653,9 +1654,9 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
actor->depthInWater = y - actor->world.pos.y;
if (actor->depthInWater < 0.0f) {
actor->bgCheckFlags &= ~(0x40 | 0x20);
} else if (!(actor->bgCheckFlags & 0x20)) {
actor->bgCheckFlags |= (0x40 | 0x20);
actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH);
} else if (!(actor->bgCheckFlags & BGCHECKFLAG_WATER)) {
actor->bgCheckFlags |= (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH);
if (!(flags & 0x40)) {
Vec3f sp50;
@@ -1668,10 +1669,10 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
EffectSsGRipple_Spawn(play, &sp50, 100, 500, 8);
}
} else {
actor->bgCheckFlags &= ~0x40;
actor->bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH;
}
} else {
actor->bgCheckFlags &= ~(0x40 | 0x20);
actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH);
actor->depthInWater = BGCHECK_Y_MIN;
}
}
@@ -2152,7 +2153,7 @@ void Actor_PlaySfx(Actor* actor, u16 sfxId) {
void func_800B8EF4(PlayState* play, Actor* actor) {
u32 sfxId;
if (actor->bgCheckFlags & 0x20) {
if (actor->bgCheckFlags & BGCHECKFLAG_WATER) {
if (actor->depthInWater < 20.0f) {
sfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG;
} else {
@@ -3680,7 +3681,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16
Actor_UpdateBgCheckInfo(play, actor, 0.0f, 0.0f, 0.0f, 4);
Math_Vec3f_Copy(&actor->world.pos, &actorPos);
ret = actor->bgCheckFlags & 1;
ret = actor->bgCheckFlags & BGCHECKFLAG_GROUND;
actor->bgCheckFlags = bgCheckFlags;
+2 -2
View File
@@ -1955,7 +1955,7 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul
}
posResult->z = posIntersect.z;
if (actor != NULL) {
actor->bgCheckFlags |= 0x1000;
actor->bgCheckFlags |= BGCHECKFLAG_PLAYER_1000;
}
}
// poly is wall
@@ -2001,7 +2001,7 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul
result = true;
if (poly->normal.y * COLPOLY_NORMAL_FRAC > 0.5f) {
if (actor != NULL) {
actor->bgCheckFlags |= 0x1000;
actor->bgCheckFlags |= BGCHECKFLAG_PLAYER_1000;
}
}
} else {
+1 -1
View File
@@ -254,7 +254,7 @@ s32 EnHy_PlayWalkingSound(EnHy* enHy, PlayState* play, f32 distAboveThreshold) {
u16 sfxId;
u8 isFootOnGround;
if (enHy->actor.bgCheckFlags & 0x20) {
if (enHy->actor.bgCheckFlags & BGCHECKFLAG_WATER) {
if (enHy->actor.depthInWater < 20.0f) {
waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG;
} else {
+4 -4
View File
@@ -362,7 +362,7 @@ void func_800A640C(EnItem00* this, PlayState* play) {
}
}
if ((this->actor.gravity != 0.0f) && !(this->actor.bgCheckFlags & 1)) {
if ((this->actor.gravity != 0.0f) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
this->actionFunc = func_800A6650;
}
}
@@ -387,12 +387,12 @@ void func_800A6650(EnItem00* this, PlayState* play) {
EffectSsKirakira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor);
}
if (this->actor.bgCheckFlags & 3) {
if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) {
if (this->actor.velocity.y > -2.0f) {
this->actionFunc = func_800A640C;
} else {
this->actor.velocity.y = this->actor.velocity.y * -0.8f;
this->actor.bgCheckFlags &= ~1;
this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND;
}
}
}
@@ -444,7 +444,7 @@ void func_800A6780(EnItem00* this, PlayState* play) {
EffectSsKirakira_SpawnSmall(play, &pos, &sEffectVelocity, &sEffectAccel, &sEffectPrimColor, &sEffectEnvColor);
}
if (this->actor.bgCheckFlags & 3) {
if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) {
this->actionFunc = func_800A640C;
this->actor.shape.rot.z = 0;
this->actor.speed = 0.0f;
+4 -3
View File
@@ -495,7 +495,8 @@ s32 func_801234D4(PlayState* play) {
return (player->stateFlags2 & PLAYER_STATE2_8) || (player->actor.speed != 0.0f) ||
((player->transformation != PLAYER_FORM_ZORA) && (player->stateFlags1 & PLAYER_STATE1_8000000)) ||
((player->transformation == PLAYER_FORM_ZORA) && (player->stateFlags1 & PLAYER_STATE1_8000000) &&
(!(player->actor.bgCheckFlags & 1) || (player->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER)));
(!(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) ||
(player->currentBoots < PLAYER_BOOTS_ZORA_UNDERWATER)));
}
s32 func_80123590(PlayState* play, Actor* actor) {
@@ -1274,7 +1275,7 @@ void func_80123DA4(Player* player) {
}
void func_80123DC0(Player* player) {
if ((player->actor.bgCheckFlags & 1) ||
if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) ||
(player->stateFlags1 & (PLAYER_STATE1_200000 | PLAYER_STATE1_800000 | PLAYER_STATE1_8000000)) ||
(!(player->stateFlags1 & (PLAYER_STATE1_40000 | PLAYER_STATE1_80000)) &&
((player->actor.world.pos.y - player->actor.floorHeight) < 100.0f))) {
@@ -1461,7 +1462,7 @@ s32 Player_GetEnvironmentalHazard(PlayState* play) {
envHazard = PLAYER_ENV_HAZARD_UNDERWATER_FREE - 1;
} else if (player->stateFlags1 & PLAYER_STATE1_8000000) {
if ((player->transformation == PLAYER_FORM_ZORA) && (player->currentBoots >= PLAYER_BOOTS_ZORA_UNDERWATER) &&
(player->actor.bgCheckFlags & 1)) {
(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
envHazard = PLAYER_ENV_HAZARD_UNDERWATER_FLOOR - 1;
} else {
envHazard = PLAYER_ENV_HAZARD_SWIMMING - 1;
@@ -163,9 +163,9 @@ void BgIcicle_Shiver(BgIcicle* this, PlayState* play) {
}
void BgIcicle_Fall(BgIcicle* this, PlayState* play) {
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;
@@ -119,7 +119,7 @@ void BgIkanaDharma_Init(Actor* thisx, PlayState* play2) {
this->dyna.actor.unk20, NULL);
}
this->dyna.actor.bgCheckFlags |= 1;
this->dyna.actor.bgCheckFlags |= BGCHECKFLAG_GROUND;
}
BgIkanaDharma_SetupWaitForHit(this);
@@ -227,7 +227,7 @@ void BgIkanaDharma_Update(Actor* thisx, PlayState* play) {
if (actorBelow == NULL) {
Actor_MoveWithGravity(&this->dyna.actor);
Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4);
if (this->dyna.actor.bgCheckFlags & 2) {
if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 21536);
@@ -647,7 +647,7 @@ void func_80B814B8(BgIkanaRotaryroom* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (ActorCutscene_GetCurrentIndex() == this->dyna.actor.cutscene) {
if (player->actor.bgCheckFlags & 0x100) {
if (player->actor.bgCheckFlags & BGCHECKFLAG_CRUSHED) {
Player_PlaySfx(player, NA_SE_VO_LI_DAMAGE_S + player->ageProperties->voiceSfxIdOffset);
func_80169EFC(&play->state);
Player_PlaySfx(player, NA_SE_VO_LI_TAKEN_AWAY + player->ageProperties->voiceSfxIdOffset);
@@ -228,7 +228,7 @@ void func_809541B8(BgIngate* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (this->unk160 & 0x4) {
if ((player->transformation == PLAYER_FORM_HUMAN) && (player->actor.bgCheckFlags & 1) &&
if ((player->transformation == PLAYER_FORM_HUMAN) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
(this->dyna.actor.xzDistToPlayer < 40.0f)) {
if (this->dyna.actor.playerHeightRel > 15.0f) {
func_800B7298(play, &this->dyna.actor, PLAYER_CSMODE_7);
@@ -283,7 +283,7 @@ void BgKin2Picture_Fall(BgKin2Picture* this, PlayState* play) {
Actor_MoveWithGravity(&this->dyna.actor);
Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4);
if (this->dyna.actor.bgCheckFlags & 1) {
if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
Math_StepToS(&this->step, 0x7D0, 0x78);
if (this->landTimer < 3) {
+1 -1
View File
@@ -996,7 +996,7 @@ void func_809DAB78(Boss02* this, PlayState* play) {
Actor_MoveWithGravity(&this->actor);
Actor_UpdateBgCheckInfo(play, &this->actor, 50.0f, 150.0f, 100.0f, 4);
if (this->actor.bgCheckFlags & 1) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
this->unk_0144 = 23;
this->actor.speed = 0.0f;
this->unk_0170 = this->unk_017C;
+15 -11
View File
@@ -584,7 +584,7 @@ void func_809E34B8(Boss03* this, PlayState* play) {
Math_ApproachF(&this->actor.speed, this->unk_278, 1.0f, this->unk_27C);
Math_ApproachF(&this->unk_260, sinf(this->skelAnime.curFrame * (M_PI / 5.0f)) * 10.0f * 0.01f, 0.5f, 1.0f);
if ((this->workTimer[WORK_TIMER_UNK2_A] == 0) && (this->actor.bgCheckFlags & 8)) {
if ((this->workTimer[WORK_TIMER_UNK2_A] == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) {
Matrix_MultVecZ(-500.0f, &this->unk_268);
this->unk_268.y = Rand_ZeroFloat(100.0f) + 150.0f;
this->workTimer[WORK_TIMER_UNK2_A] = 60;
@@ -618,7 +618,7 @@ void func_809E34B8(Boss03* this, PlayState* play) {
if (this->workTimer[WORK_TIMER_UNK1_A] == 0) {
// Player is above water && Player is standing on ground
if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) {
if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
Boss03_SetupPrepareCharge(this, play);
} else if ((player->transformation != PLAYER_FORM_GORON) && (player->transformation != PLAYER_FORM_DEKU)) {
if (KREG(70) == 0) {
@@ -678,7 +678,8 @@ void Boss03_ChasePlayer(Boss03* this, PlayState* play) {
// If either (Player is standing on ground && Player is above water) or (WORK_TIMER_CURRENT_ACTION timer runs out),
// then stop chasing
if (((player->actor.bgCheckFlags & 1) && (player->actor.shape.feetPos[0].y >= WATER_HEIGHT + 8.0f)) ||
if (((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
(player->actor.shape.feetPos[0].y >= WATER_HEIGHT + 8.0f)) ||
(this->workTimer[WORK_TIMER_CURRENT_ACTION] == 0)) {
if (&this->actor == player->actor.parent) {
player->unk_AE8 = 101;
@@ -773,7 +774,8 @@ void Boss03_CatchPlayer(Boss03* this, PlayState* play) {
// If either (Player is standing on ground && Player is above water) or (WORK_TIMER_CURRENT_ACTION timer runs out)
// then stop trying to catch Player
if (((player->actor.bgCheckFlags & 1) && (player->actor.shape.feetPos[FOOT_LEFT].y >= WATER_HEIGHT + 8.0f)) ||
if (((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
(player->actor.shape.feetPos[FOOT_LEFT].y >= WATER_HEIGHT + 8.0f)) ||
(this->workTimer[WORK_TIMER_CURRENT_ACTION] == 0)) {
if (&this->actor == player->actor.parent) {
player->unk_AE8 = 101;
@@ -985,7 +987,7 @@ void Boss03_PrepareCharge(Boss03* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
// Player is above water && Player is standing on ground
if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) {
if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
if (this->workTimer[WORK_TIMER_CURRENT_ACTION] == 0) {
Boss03_SetupCharge(this, play);
}
@@ -1046,14 +1048,14 @@ void Boss03_Charge(Boss03* this, PlayState* play) {
}
// Attack platform
if (this->actor.bgCheckFlags & 8) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) {
play_sound(NA_SE_IT_BIG_BOMB_EXPLOSION);
func_800BC848(&this->actor, play, 20, 15);
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, 0.0f, this->waterHeight, 0.0f, 0, 0, 0x96,
ENWATEREFFECT_TYPE_GYORG_SHOCKWAVE);
// Player is above water && Player is standing on ground
if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) {
if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
func_800B8D50(play, NULL, 7.0f, Math_Atan2S_XY(player->actor.world.pos.z, player->actor.world.pos.x),
7.0f, 0);
}
@@ -1451,7 +1453,8 @@ void Boss03_DeathCutscene(Boss03* this, PlayState* play) {
this->unk_2BE = Math_Atan2S_XY(this->actor.world.pos.z, this->actor.world.pos.x);
// Player is above water && Player is standing on ground
if ((this->waterHeight < player->actor.world.pos.y) && (player->actor.bgCheckFlags & 1)) {
if ((this->waterHeight < player->actor.world.pos.y) &&
(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
player->actor.world.pos.x = 0.0f;
player->actor.world.pos.z = -200.0f;
}
@@ -1768,7 +1771,7 @@ void Boss03_Stunned(Boss03* this, PlayState* play) {
if ((this->waterHeight + 30.0f) < this->actor.world.pos.y) {
this->actor.gravity = -2.0f;
Actor_MoveWithGravity(&this->actor);
if (this->actor.bgCheckFlags & 2) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
play_sound(NA_SE_IT_WALL_HIT_HARD);
func_800BC848(&this->actor, play, 10, 10);
}
@@ -2095,7 +2098,8 @@ void Boss03_Update(Actor* thisx, PlayState* play2) {
}
// Player is standing on ground && Player is above water
if ((player->actor.bgCheckFlags & 1) && (player->actor.shape.feetPos[FOOT_LEFT].y >= WATER_HEIGHT + 8.0f)) {
if ((player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) &&
(player->actor.shape.feetPos[FOOT_LEFT].y >= WATER_HEIGHT + 8.0f)) {
if (this->wetSpotEffectSpawnCount != 0) {
this->wetSpotEffectSpawnCount--;
@@ -2514,7 +2518,7 @@ void Boss03_SeaweedUpdate(Actor* thisx, PlayState* play) {
disturbanceFactor = player->actor.speed * 3.0f + 70.0f;
// Player is standing on ground
if (player->actor.bgCheckFlags & 1) {
if (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
maxBendSpeed = 0;
} else {
maxBendSpeed = player->actor.speed * 16.0f;
+3 -3
View File
@@ -323,7 +323,7 @@ void func_809EC568(Boss04* this, PlayState* play) {
Math_ApproachF(&this->subCamAt.x, this->actor.world.pos.x, 0.5f, 1000.0f);
Math_ApproachF(&this->subCamAt.y, this->actor.world.pos.y, 0.5f, 1000.0f);
Math_ApproachF(&this->subCamAt.z, this->actor.world.pos.z, 0.5f, 1000.0f);
if (this->actor.bgCheckFlags & 2) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
play_sound(NA_SE_IT_BIG_BOMB_EXPLOSION);
this->unk_6F4 = 15;
this->unk_708 = 13;
@@ -467,7 +467,7 @@ void func_809ECEF4(Boss04* this) {
void func_809ECF58(Boss04* this, PlayState* play) {
Vec3f sp3C;
if ((this->unk_1FE == 14) || ((this->actor.bgCheckFlags & 8) && (this->unk_1F8 == 0))) {
if ((this->unk_1FE == 14) || ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->unk_1F8 == 0))) {
this->unk_1F8 = 20;
if ((Rand_ZeroOne() < 0.2f) && (this->unk_1FE == 0)) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
@@ -479,7 +479,7 @@ void func_809ECF58(Boss04* this, PlayState* play) {
this->actor.speed = 0.0f;
if (this->actor.bgCheckFlags & 8) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) {
play_sound(NA_SE_IT_BIG_BOMB_EXPLOSION);
func_800BC848(&this->actor, play, 15, 10);
this->unk_6F4 = 15;
@@ -1529,7 +1529,7 @@ void func_80BEFAF0(EnAkindonuts* this, PlayState* play) {
if (this->path != NULL) {
sp34 = func_80BECEAC(this->path, this->unk_334, &this->actor.world.pos, &sp38);
if (this->actor.bgCheckFlags & 0x8) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) {
sp38.y = this->actor.wallYaw;
}
+5 -5
View File
@@ -265,7 +265,7 @@ void EnAm_ApplyEnemyTexture(EnAm* this, PlayState* play) {
void func_808B0208(EnAm* this, PlayState* play) {
// If the armos is against a wall, rotate and turn away from it
if ((this->actor.speed > 0.0f) && (this->actor.bgCheckFlags & 8)) {
if ((this->actor.speed > 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) {
this->actor.world.rot.y = (this->actor.wallYaw * 2) - this->actor.world.rot.y;
this->actor.world.pos.x += this->actor.speed * Math_SinS(this->actor.world.rot.y);
this->actor.world.pos.z += this->actor.speed * Math_CosS(this->actor.world.rot.y);
@@ -275,12 +275,12 @@ void func_808B0208(EnAm* this, PlayState* play) {
this->actor.speed = this->speed;
this->actor.velocity.y = 12.0f;
} else if (this->skelAnime.curFrame > 11.0f) {
if (!(this->actor.bgCheckFlags & 1)) {
if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
this->skelAnime.curFrame = 11.0f;
} else {
Math_ScaledStepToS(&this->actor.world.rot.y, this->armosYaw, 0x1F40);
this->actor.speed = 0.0f;
if (this->actor.bgCheckFlags & 2) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
EnAm_SpawnEffects(this, play);
}
}
@@ -302,7 +302,7 @@ void func_808B0358(EnAm* this) {
void func_808B03C0(EnAm* this, PlayState* play) {
this->armosYaw = this->actor.yawTowardsPlayer;
func_808B0208(this, play);
if (this->actor.bgCheckFlags & 2) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
this->explodeTimer--;
}
if (this->explodeTimer == 0) {
@@ -334,7 +334,7 @@ void func_808B04E4(EnAm* this) {
void func_808B0508(EnAm* this, PlayState* play) {
func_808B0208(this, play);
if (!(this->actor.bgCheckFlags & 1)) {
if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
Math_StepToF(&this->actor.world.pos.x, this->actor.home.pos.x, 2.0f);
Math_StepToF(&this->actor.world.pos.z, this->actor.home.pos.z, 2.0f);
}
+1 -1
View File
@@ -211,7 +211,7 @@ void EnAni_FallToGround(EnAni* this, PlayState* play) {
s32 pad;
s16 quakeIndex;
if (this->actor.bgCheckFlags & 1) { // hit the ground
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
this->actor.flags &= ~ACTOR_FLAG_10;
this->actionFunc = EnAni_LandOnFoot;
this->actor.velocity.x = 0.0f;
@@ -273,8 +273,8 @@ void func_8088AA98(EnArrow* this, PlayState* play) {
f32 temp_f0;
if (WaterBox_GetSurface1(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50, &sp54) &&
(this->actor.world.pos.y < sp50) && !(this->actor.bgCheckFlags & 0x20)) {
this->actor.bgCheckFlags |= 0x20;
(this->actor.world.pos.y < sp50) && !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) {
this->actor.bgCheckFlags |= BGCHECKFLAG_WATER;
Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.home.pos, &sp44);
@@ -236,7 +236,7 @@ void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, PlayState* play) {
Actor_SetFocus(&this->actor, this->targetHeight);
Actor_GetScreenPos(play, &this->actor, &posX, &posY);
if (this->actor.bgCheckFlags & 8) { // touching a wall
if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) {
this->targetRotY = this->actor.yawTowardsPlayer;
this->targetRotX = this->actor.world.rot.x - 3000.0f;
this->hopTimer = 0;
@@ -255,7 +255,7 @@ void EnAttackNiw_EnterViewFromOffscreen(EnAttackNiw* this, PlayState* play) {
} else if (((this->actor.projectedPos.z > 0.0f) && (fabsf(flightTarget.x - this->actor.world.pos.x) < 50.0f) &&
(fabsf(flightTarget.y - this->actor.world.pos.y) < 50.0f) &&
(fabsf(flightTarget.z - this->actor.world.pos.z) < 50.0f)) ||
(this->actor.bgCheckFlags & 1)) { // touching ground or with close distance of target
(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
// reset state
this->hopTimer = 0;
this->unkTimer250 = this->hopTimer;
@@ -286,7 +286,7 @@ void EnAttackNiw_AimAtPlayer(EnAttackNiw* this, PlayState* play) {
return;
}
if (this->actor.bgCheckFlags & 1) { // touching floor
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
if (this->hopTimer == 0) {
this->hopTimer = 3;
this->actor.velocity.y = 3.5f;
@@ -316,17 +316,16 @@ void EnAttackNiw_AimAtPlayer(EnAttackNiw* this, PlayState* play) {
Math_ApproachF(&this->rotStep, 10000.0f, 1.0f, 1000.0f);
Math_ApproachF(&this->actor.speed, this->targetXZSpeed, 0.9f, 1.0f);
if (this->actor.gravity == -2.0f && this->unkTimer25A == 0 &&
(this->actor.bgCheckFlags & 8 || this->randomAngleChangeTimer == 0)) {
if ((this->actor.gravity == -2.0f) && (this->unkTimer25A == 0) &&
((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || (this->randomAngleChangeTimer == 0))) {
this->targetXZSpeed = 0.0f;
this->actor.gravity = 0.0f;
this->rotStep = 0.0f;
this->targetRotX = this->actor.world.rot.x - 5000.0f;
this->actionFunc = EnAttackNiw_FlyAway;
} else if (this->actor.bgCheckFlags & 1) { // touching floor
} else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
EnAttackNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_SLOW_FORFLAPPING);
} else {
EnAttackNiw_AnimateWingHead(this, play, NIW_ANIM_PECKING_AND_WAVING);
}
@@ -380,8 +379,7 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) {
return;
}
if ((this->actor.bgCheckFlags & 0x20) && // on or below water
(this->actionFunc != EnAttackNiw_FlyAway)) {
if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actionFunc != EnAttackNiw_FlyAway)) {
Math_Vec3f_Copy(&splashPos, &this->actor.world.pos);
splashPos.y += this->actor.depthInWater;
EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, 400);
+10 -10
View File
@@ -274,7 +274,7 @@ void EnAz_Init(Actor* thisx, PlayState* play2) {
this->collider.dim.yShift *= 1.2f;
}
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, 5);
if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 22.0f)) {
if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.depthInWater > 22.0f)) {
this->unk_374 |= 0x100;
this->unk_376 |= 0x100;
}
@@ -560,7 +560,7 @@ s32 func_80A95B34(PlayState* play, ActorPathing* actorPathing) {
} else {
ret = func_80A958B0(play, actorPathing);
}
} else if (this->actor.bgCheckFlags & 1) {
} else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
if (this->unk_374 & 8) {
SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_WALK, &this->animIndex);
this->unk_374 &= ~8;
@@ -578,21 +578,21 @@ void func_80A95C5C(EnAz* this, PlayState* play) {
this->actor.gravity = -1.0f;
SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_IDLE, &this->animIndex);
this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8);
this->actor.bgCheckFlags &= ~0x21;
this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_WATER);
this->unk_3C0 = 0;
this->actionFunc = func_80A95CEC;
}
void func_80A95CEC(EnAz* this, PlayState* play) {
if (this->unk_374 & 0x8000) {
if (!(this->actor.bgCheckFlags & 1)) {
if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
this->actor.shape.rot.y = this->actor.world.rot.y;
this->actor.draw = EnAz_Draw;
Actor_MoveWithGravity(&this->actor);
func_800B9010(&this->actor, NA_SE_EV_HONEYCOMB_FALL - SFX_FLAG);
} else {
if (this->actor.bgCheckFlags & 2) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) {
Actor_PlaySfx(&this->actor, NA_SE_EN_GERUDOFT_DOWN);
}
if (SubS_StartActorCutscene(&this->actor, 0x7C, this->unk_3D0[0], SUBS_CUTSCENE_NORMAL)) {
@@ -613,7 +613,7 @@ void func_80A95DA0(EnAz* this, PlayState* play) {
SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, BEAVER_ANIM_SWIM_WITH_SPINNING_TAIL,
&this->animIndex);
this->actor.flags |= (ACTOR_FLAG_1 | ACTOR_FLAG_8);
this->actor.bgCheckFlags &= ~0x21;
this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_WATER);
this->unk_374 |= 0x1000;
Math_Vec3f_Copy(&this->actor.world.pos, &sp40->curPoint);
this->actionFunc = func_80A95E88;
@@ -668,7 +668,7 @@ void func_80A95FE8(EnAz* this, PlayState* play) {
this->actor.speed = 0.0f;
Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 3, 0x1000, 0x100);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 3, 0x1038, 0x100);
if (this->actor.bgCheckFlags & 1) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
this->actor.shape.rot.x = 0;
this->actor.gravity = 0.0f;
func_80A97C0C(this, play);
@@ -1517,7 +1517,7 @@ void func_80A97EAC(EnAz* this, PlayState* play) {
&this->animIndex);
this->actor.flags |= ACTOR_FLAG_8000000;
this->actor.flags &= ~(ACTOR_FLAG_1 | ACTOR_FLAG_8);
this->actor.bgCheckFlags &= ~0x21;
this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_WATER);
this->unk_374 |= 0x1000;
this->unk_3C2 = 0;
this->unk_3C4 = 0;
@@ -1589,7 +1589,7 @@ void func_80A982E0(PlayState* play, ActorPathing* actorPathing) {
Vec3f sp28;
actorPathing->curPoint.x = actorPathing->points[actorPathing->curPointIndex].x;
if (this->actor.bgCheckFlags & 1) {
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
actorPathing->curPoint.y = actorPathing->points[actorPathing->curPointIndex].y;
} else {
actorPathing->curPoint.y = actorPathing->points[actorPathing->curPointIndex].y - this->unk_3A4;
@@ -1627,7 +1627,7 @@ void EnAz_Update(Actor* thisx, PlayState* play2) {
EnAz* this = THIS;
this->unk_374 &= ~0x100;
if ((this->actor.bgCheckFlags & 0x20) && (this->actor.depthInWater > 22.0f)) {
if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.depthInWater > 22.0f)) {
if (!(this->unk_376 & 0x100)) {
this->unk_374 |= 0x200;
}

Some files were not shown because too many files have changed in this diff Show More