1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-23 07:21:19 +00:00

Fix misc 8 (#1150)

* Use `s32` as type instead of `StackStatus` enum type

* `bossLimbDl` -> `bossLimbDL`

* Fixup comment refering to `Actor.velocity` by struct offset

* Fixup `feetFloorFlags` doc and -> `feetFloorFlag`

* Fixup `xyzDistToPlayerSq` comment

* Make `SkelAnime.mode` comment refer to `AnimationMode` (<- `AnimationModes`)

* Use enum names to refer to anim modes and break long lines in z64animation.h

* `EnDha_OverridePostDraw` -> `EnDha_PostLimbDraw`

* ichains cleanup

* Scene command ids usage cleanup

* Properly name unkXXX members as unk_XXX

* change `gSceneCmdHandlers` length in variables.h too

* Revert Unknown flags to unk0 & unk1

* Remove "current scene" mention from `Flags_*Unknown` as they aren't saved or loaded so not scene-specific

* `Struct_8011FAF0`: unk_00, unk_04

* Run formatter

* Do not break long lines in headers

* Revert "Fixup `feetFloorFlags` doc and -> `feetFloorFlag`"

This reverts commit c45b3611e7.
This commit is contained in:
Dragorn421 2022-03-16 22:14:56 +01:00 committed by GitHub
parent 93096a45b6
commit b2a3fb2f7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 328 additions and 327 deletions

View file

@ -196,7 +196,7 @@ void EnPeehat_Init(Actor* thisx, GlobalContext* globalCtx) {
24);
ActorShape_Init(&this->actor.shape, 100.0f, ActorShadow_DrawCircle, 27.0f);
this->actor.focus.pos = this->actor.world.pos;
this->unk2D4 = 0;
this->unk_2D4 = 0;
this->actor.world.rot.y = 0;
this->actor.colChkInfo.mass = MASS_HEAVY;
this->actor.colChkInfo.health = 6;
@ -252,7 +252,7 @@ void EnPeehat_Destroy(Actor* thisx, GlobalContext* globalCtx) {
if (this->actor.params > 0) {
parent = (EnPeehat*)this->actor.parent;
if (parent != NULL && parent->actor.update != NULL) {
parent->unk2FA--;
parent->unk_2FA--;
}
}
}
@ -287,12 +287,12 @@ void EnPeehat_HitWhenGrounded(EnPeehat* this, GlobalContext* globalCtx) {
Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40);
Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40);
Item_DropCollectibleRandom(globalCtx, &this->actor, &itemDropPos, 0x40);
this->unk2D4 = 240;
this->unk_2D4 = 240;
} else {
s32 i;
this->colCylinder.base.acFlags &= ~AC_HIT;
for (i = MAX_LARVA - this->unk2FA; i > 0; i--) {
for (i = MAX_LARVA - this->unk_2FA; i > 0; i--) {
Actor* larva =
Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PEEHAT,
Rand_CenteredFloat(25.0f) + this->actor.world.pos.x,
@ -302,10 +302,10 @@ void EnPeehat_HitWhenGrounded(EnPeehat* this, GlobalContext* globalCtx) {
if (larva != NULL) {
larva->velocity.y = 6.0f;
larva->shape.rot.y = larva->world.rot.y = Rand_CenteredFloat(0xFFFF);
this->unk2FA++;
this->unk_2FA++;
}
}
this->unk2D4 = 8;
this->unk_2D4 = 8;
}
Audio_PlayActorSound2(&this->actor, NA_SE_EN_PIHAT_DAMAGE);
}
@ -314,8 +314,8 @@ void EnPeehat_Ground_SetStateGround(EnPeehat* this) {
Animation_Change(&this->skelAnime, &gPeehatRisingAnim, 0.0f, 3.0f, Animation_GetLastFrame(&gPeehatRisingAnim),
ANIMMODE_ONCE, 0.0f);
this->seekPlayerTimer = 600;
this->unk2D4 = 0;
this->unk2FA = 0;
this->unk_2D4 = 0;
this->unk_2FA = 0;
this->state = PEAHAT_STATE_3;
this->colCylinder.base.acFlags &= ~AC_HIT;
EnPeehat_SetupAction(this, EnPeehat_Ground_StateGround);
@ -335,9 +335,9 @@ void EnPeehat_Ground_StateGround(EnPeehat* this, GlobalContext* globalCtx) {
} else {
this->actor.flags &= ~ACTOR_FLAG_0;
Math_SmoothStepToF(&this->actor.shape.yOffset, -1000.0f, 1.0f, 50.0f, 0.0f);
if (this->unk2D4 != 0) {
this->unk2D4--;
if (this->unk2D4 & 4) {
if (this->unk_2D4 != 0) {
this->unk_2D4--;
if (this->unk_2D4 & 4) {
Math_SmoothStepToF(&this->scaleShift, 0.205f, 1.0f, 0.235f, 0.0f);
} else {
Math_SmoothStepToF(&this->scaleShift, 0.0f, 1.0f, 0.005f, 0.0f);
@ -352,8 +352,8 @@ void EnPeehat_Flying_SetStateGround(EnPeehat* this) {
Animation_Change(&this->skelAnime, &gPeehatRisingAnim, 0.0f, 3.0f, Animation_GetLastFrame(&gPeehatRisingAnim),
ANIMMODE_ONCE, 0.0f);
this->seekPlayerTimer = 400;
this->unk2D4 = 0;
this->unk2FA = 0; //! @bug: overwrites number of child larva spawned, allowing for more than MAX_LARVA spawns
this->unk_2D4 = 0;
this->unk_2FA = 0; //! @bug: overwrites number of child larva spawned, allowing for more than MAX_LARVA spawns
this->state = PEAHAT_STATE_4;
EnPeehat_SetupAction(this, EnPeehat_Flying_StateGrounded);
}
@ -365,9 +365,9 @@ void EnPeehat_Flying_StateGrounded(EnPeehat* this, GlobalContext* globalCtx) {
}
} else {
Math_SmoothStepToF(&this->actor.shape.yOffset, -1000.0f, 1.0f, 50.0f, 0.0f);
if (this->unk2D4 != 0) {
this->unk2D4--;
if (this->unk2D4 & 4) {
if (this->unk_2D4 != 0) {
this->unk_2D4--;
if (this->unk_2D4 & 4) {
Math_SmoothStepToF(&this->scaleShift, 0.205f, 1.0f, 0.235f, 0.0f);
} else {
Math_SmoothStepToF(&this->scaleShift, 0.0f, 1.0f, 0.005f, 0.0f);
@ -390,14 +390,14 @@ void EnPeehat_Flying_StateFly(EnPeehat* this, GlobalContext* globalCtx) {
if (!IS_DAY || this->xzDistToRise < this->actor.xzDistToPlayer) {
EnPeehat_Flying_SetStateLanding(this);
} else if (this->actor.xzDistToPlayer < this->xzDistMax) {
if (this->unk2FA < MAX_LARVA && (globalCtx->gameplayFrames & 7) == 0) {
if (this->unk_2FA < MAX_LARVA && (globalCtx->gameplayFrames & 7) == 0) {
Actor* larva = Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_PEEHAT,
Rand_CenteredFloat(25.0f) + this->actor.world.pos.x,
Rand_CenteredFloat(5.0f) + this->actor.world.pos.y,
Rand_CenteredFloat(25.0f) + this->actor.world.pos.z, 0, 0, 0, 1);
if (larva != NULL) {
larva->shape.rot.y = larva->world.rot.y = Rand_CenteredFloat(0xFFFF);
this->unk2FA++;
this->unk_2FA++;
}
}
}
@ -471,7 +471,7 @@ void EnPeehat_Flying_StateRise(EnPeehat* this, GlobalContext* globalCtx) {
}
if (SkelAnime_Update(&this->skelAnime) || this->animTimer == 0) {
//! @bug: overwrites number of child larva spawned, allowing for more than MAX_LARVA spawns
this->unk2FA = 0;
this->unk_2FA = 0;
EnPeehat_Flying_SetStateFly(this);
} else {
this->actor.world.pos.y += 18.0f;
@ -490,7 +490,7 @@ void EnPeehat_Flying_StateRise(EnPeehat* this, GlobalContext* globalCtx) {
void EnPeehat_Ground_SetStateSeekPlayer(EnPeehat* this) {
Animation_PlayLoop(&this->skelAnime, &gPeehatFlyingAnim);
this->state = PEAHAT_STATE_SEEK_PLAYER;
this->unk2E0 = 0.0f;
this->unk_2E0 = 0.0f;
EnPeehat_SetupAction(this, EnPeehat_Ground_StateSeekPlayer);
}
@ -507,7 +507,7 @@ void EnPeehat_Ground_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) {
}
if (IS_DAY && (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < this->xzDistMax)) {
Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 1000, 0);
if (this->unk2FA != 0) {
if (this->unk_2FA != 0) {
this->actor.shape.rot.y += 0x1C2;
} else {
this->actor.shape.rot.y -= 0x1C2;
@ -525,7 +525,7 @@ void EnPeehat_Ground_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) {
void EnPeehat_Larva_SetStateSeekPlayer(EnPeehat* this) {
Animation_PlayLoop(&this->skelAnime, &gPeehatFlyingAnim);
this->state = PEAHAT_STATE_SEEK_PLAYER;
this->unk2D4 = 0;
this->unk_2D4 = 0;
EnPeehat_SetupAction(this, EnPeehat_Larva_StateSeekPlayer);
}
@ -544,10 +544,10 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) {
} else {
Math_SmoothStepToF(&this->actor.velocity.y, -0.135f, 1.0f, 0.05f, 0.0f);
}
if (this->unk2D4 == 0) {
if (this->unk_2D4 == 0) {
Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 830, 0);
} else {
this->unk2D4--;
this->unk_2D4--;
}
this->actor.shape.rot.y += 0x15E;
SkelAnime_Update(&this->skelAnime);
@ -569,7 +569,7 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) {
} else {
this->actor.world.rot.y -= 0x2000;
}
this->unk2D4 = 40;
this->unk_2D4 = 40;
} else if (this->colCylinder.base.acFlags & AC_HIT || this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
Vec3f zeroVec = { 0, 0, 0 };
s32 i;
@ -650,7 +650,7 @@ void EnPeehat_Flying_StateLanding(EnPeehat* this, GlobalContext* globalCtx) {
void EnPeehat_Ground_SetStateHover(EnPeehat* this) {
Animation_PlayLoop(&this->skelAnime, &gPeehatFlyingAnim);
this->actor.speedXZ = Rand_ZeroOne() * 0.5f + 2.5f;
this->unk2D4 = Rand_ZeroOne() * 10 + 10;
this->unk_2D4 = Rand_ZeroOne() * 10 + 10;
this->state = PEAHAT_STATE_15;
EnPeehat_SetupAction(this, EnPeehat_Ground_StateHover);
}
@ -663,17 +663,17 @@ void EnPeehat_Ground_StateHover(EnPeehat* this, GlobalContext* globalCtx) {
if (this->actor.world.pos.y - this->actor.floorHeight > 75.0f) {
this->actor.world.pos.y -= 1.0f;
}
this->actor.world.pos.y += Math_CosF(this->unk2E0) * 1.4f;
cos = Math_CosF(this->unk2E0) * 0.18f;
this->unk2E0 += ((0.0f <= cos) ? cos : -cos) + 0.07f;
this->unk2D4--;
if (this->unk2D4 <= 0) {
this->actor.world.pos.y += Math_CosF(this->unk_2E0) * 1.4f;
cos = Math_CosF(this->unk_2E0) * 0.18f;
this->unk_2E0 += ((0.0f <= cos) ? cos : -cos) + 0.07f;
this->unk_2D4--;
if (this->unk_2D4 <= 0) {
this->actor.speedXZ = Rand_ZeroOne() * 0.5f + 2.5f;
this->unk2D4 = Rand_ZeroOne() * 10.0f + 10.0f;
this->unk2F4 = (Rand_ZeroOne() - 0.5f) * 1000.0f;
this->unk_2D4 = Rand_ZeroOne() * 10.0f + 10.0f;
this->unk_2F4 = (Rand_ZeroOne() - 0.5f) * 1000.0f;
}
SkelAnime_Update(&this->skelAnime);
this->actor.world.rot.y += this->unk2F4;
this->actor.world.rot.y += this->unk_2F4;
if (this->seekPlayerTimer <= 0) {
EnPeehat_Ground_SetStateLanding(this);
this->riseDelayTimer = 40;
@ -685,7 +685,7 @@ void EnPeehat_Ground_StateHover(EnPeehat* this, GlobalContext* globalCtx) {
if (IS_DAY && Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < this->xzDistMax) {
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
EnPeehat_Ground_SetStateSeekPlayer(this);
this->unk2FA = globalCtx->gameplayFrames & 1;
this->unk_2FA = globalCtx->gameplayFrames & 1;
} else {
EnPeehat_Ground_SetStateReturnHome(this);
}
@ -712,9 +712,9 @@ void EnPeehat_Ground_StateReturnHome(EnPeehat* this, GlobalContext* globalCtx) {
} else {
this->actor.world.pos.y += 1.0f;
}
this->actor.world.pos.y += Math_CosF(this->unk2E0) * 1.4f;
cos = Math_CosF(this->unk2E0) * 0.18f;
this->unk2E0 += ((0.0f <= cos) ? cos : -cos) + 0.07f;
this->actor.world.pos.y += Math_CosF(this->unk_2E0) * 1.4f;
cos = Math_CosF(this->unk_2E0) * 0.18f;
this->unk_2E0 += ((0.0f <= cos) ? cos : -cos) + 0.07f;
yRot = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos);
Math_SmoothStepToS(&this->actor.world.rot.y, yRot, 1, 600, 0);
Math_SmoothStepToS(&this->actor.shape.rot.x, 4500, 1, 600, 0);
@ -727,7 +727,7 @@ void EnPeehat_Ground_StateReturnHome(EnPeehat* this, GlobalContext* globalCtx) {
if (IS_DAY && Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < this->xzDistMax) {
this->seekPlayerTimer = 400;
EnPeehat_Ground_SetStateSeekPlayer(this);
this->unk2FA = (globalCtx->gameplayFrames & 1);
this->unk_2FA = (globalCtx->gameplayFrames & 1);
}
Audio_PlayActorSound2(&this->actor, NA_SE_EN_PIHAT_FLY - SFX_FLAG);
}
@ -762,7 +762,7 @@ void EnPeehat_StateAttackRecoil(EnPeehat* this, GlobalContext* globalCtx) {
EnPeehat_Ground_SetStateSeekPlayer(this);
// Is PEAHAT_TYPE_GROUNDED
if (this->actor.params < 0) {
this->unk2FA = (this->unk2FA != 0) ? 0 : 1;
this->unk_2FA = (this->unk_2FA != 0) ? 0 : 1;
}
}
}
@ -802,11 +802,11 @@ void EnPeehat_Adult_SetStateDie(EnPeehat* this) {
void EnPeehat_Adult_StateDie(EnPeehat* this, GlobalContext* globalCtx) {
if (this->isStateDieFirstUpdate) {
this->unk2D4--;
if (this->unk2D4 <= 0 || this->actor.colChkInfo.health == 0) {
this->unk_2D4--;
if (this->unk_2D4 <= 0 || this->actor.colChkInfo.health == 0) {
Animation_MorphToPlayOnce(&this->skelAnime, &gPeehatRecoilAnim, -4.0f);
this->bladeRotVel = 4000;
this->unk2D4 = 14;
this->unk_2D4 = 14;
this->actor.speedXZ = 0;
this->actor.velocity.y = 6;
this->isStateDieFirstUpdate = 0;
@ -834,8 +834,8 @@ void EnPeehat_Adult_StateDie(EnPeehat* this, GlobalContext* globalCtx) {
if (this->actor.speedXZ < 0) {
this->actor.speedXZ += 0.25f;
}
this->unk2D4--;
if (this->unk2D4 <= 0) {
this->unk_2D4--;
if (this->unk_2D4 <= 0) {
if (this->actor.colChkInfo.health == 0) {
EnPeehat_SetStateExplode(this);
// if PEAHAT_TYPE_GROUNDED
@ -853,7 +853,7 @@ void EnPeehat_SetStateExplode(EnPeehat* this) {
Animation_PlayLoop(&this->skelAnime, &gPeehatFlyingAnim);
this->state = PEAHAT_STATE_EXPLODE;
this->animTimer = 5;
this->unk2E0 = 0.0f;
this->unk_2E0 = 0.0f;
EnPeehat_SetupAction(this, EnPeehat_StateExplode);
}

View file

@ -23,19 +23,19 @@ typedef struct EnPeehat {
/* 0x02B4 */ s32 isStateDieFirstUpdate;
/* 0x02B8 */ EnPeehatActionFunc actionFunc;
/* 0x02BC */ Vec3f bladeTip[2]; // used to simulate the peahat's blades "digging up" earth
/* 0x02D4 */ s32 unk2D4;
/* 0x02D4 */ s32 unk_2D4;
/* 0x02D8 */ f32 xzDistMax; // max xz dist to follow Link (PEAHAT_TYPE_GROUNDED) or spawn larva (PEAHAT_TYPE_FLYING)
/* 0x02DC */ f32 xzDistToRise; // xz dist needed to rise from the ground
/* 0x02E0 */ f32 unk2E0; // rot?
/* 0x02E0 */ f32 unk_2E0; // rot?
/* 0x02E4 */ f32 jiggleRot;
/* 0x02E8 */ f32 jiggleRotInc;
/* 0x02EC */ f32 scaleShift; // 0.0f for no distortion. used for "jiggle" effect when stabbed on ground
/* 0x02F0 */ s16 bladeRotVel; // spinning blades rotational velocity
/* 0x02F2 */ s16 bladeRot; // spinning blades rotation component
/* 0x02F4 */ s16 unk2F4;
/* 0x02F4 */ s16 unk_2F4;
/* 0x02F6 */ s16 riseDelayTimer; // countdown timer until peahat is allowed to rise up from the ground
/* 0x02F8 */ s16 seekPlayerTimer; // number of frames the peahat should seek the player before landing to rest
/* 0x02FA */ s16 unk2FA; // larva count (PEAHAT_TYPE_FLYING, PEAHAT_TYPE_GROUNDED),
/* 0x02FA */ s16 unk_2FA; // larva count (PEAHAT_TYPE_FLYING, PEAHAT_TYPE_GROUNDED),
// shape rotation direction (PEAHAT_TYPE_GROUNDED)
/* 0x02FC */ s16 animTimer;
/* 0x0300 */ ColliderCylinder colCylinder;