1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-23 07:21:19 +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:
Dragorn421 2022-02-19 03:16:19 +01:00 committed by GitHub
parent 251d90301c
commit 67f294774b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
121 changed files with 711 additions and 652 deletions

View file

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