mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-21 14:31:17 +00:00
Defines for Actor#bgCheckFlags
(#1126)
* First pass, tool assisted bgCheckFlags * Few manual bgCheckFlags * Run formatter * Remove fake bgCheckFlags 10-15 * Move existing documentation to the defines * Comment on `bgCheckFlags` and rephrase some doc * Name obvious flags, and some cleanup * Comment on flag 9 being wall-interaction-related (thanks engineer and fig) * Run formatter * `BGCHECKFLAG_7` -> `BGCHECKFLAG_GROUND_STRICT` * Touch up water-related bgcheckflags doc * `BGCHECKFLAG_9` -> `BGCHECKFLAG_PLAYER_WALL_INTERACT`
This commit is contained in:
parent
251d90301c
commit
67f294774b
121 changed files with 711 additions and 652 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue