1
0
mirror of https://github.com/zeldaret/oot.git synced 2024-09-21 12:54:51 +00:00

Clean up SkelAnime_GetFrameCount usage (#245)

* fix colliderinit typo

* clean up SkelAnime_GetFrameCount usage

* line breaks
This commit is contained in:
fig02 2020-07-11 22:39:34 -04:00 committed by GitHub
parent 4fb01c6b21
commit c589285826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 60 additions and 40 deletions

View File

@ -170,7 +170,7 @@
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029DBC.s")
void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 arg4,
s16* linkDetected) {
s16* linkDetected) {
EffectSsSolderSrchBallInitParams initParams;
Math_Vec3f_Copy(&initParams.pos, pos);

View File

@ -192,7 +192,7 @@ void func_8098E6EC(DemoSa* this, GlobalContext* globalCtx, s32 actionIdx) {
void func_8098E76C(DemoSa* this, AnimationHeader* animationHeader, u8 arg2, f32 transitionRate, s32 arg4) {
s32 pad[2];
s16 frameCount = SkelAnime_GetFrameCount(&animationHeader->genericHeader);
f32 frameCount = SkelAnime_GetFrameCount(&animationHeader->genericHeader);
f32 playbackSpeed;
f32 unk0;
f32 fc;

View File

@ -212,8 +212,8 @@ void func_809B0994(EnAni* this, GlobalContext* globalCtx) {
AnimationHeader* objSegChangeAnime = &D_060070F0;
if (globalCtx->csCtx.npcActions[0]->action == 4) {
SkelAnime_ChangeAnim(&this->skelAnime, objSegChangeAnime, 1.0f, 0.0f,
(f32)SkelAnime_GetFrameCount(objSegFrameCount), 2, -4.0f);
SkelAnime_ChangeAnim(&this->skelAnime, objSegChangeAnime, 1.0f, 0.0f, SkelAnime_GetFrameCount(objSegFrameCount),
2, -4.0f);
this->unk_2AA += 1;
this->actor.shape.shadowDrawFunc = ActorShadow_DrawFunc_Circle;
}

View File

@ -343,10 +343,10 @@ void func_809DFE98(Actor* thisx, GlobalContext* globalCtx) {
if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) != 0) {
if (this->skelAnime.animCurrentSeg == &D_06004348) {
SkelAnime_ChangeAnim(&this->skelAnime, &D_06004E98, 1.0f, 0.0f,
(f32)SkelAnime_GetFrameCount(&D_06004E98.genericHeader), 2, 1.0f);
SkelAnime_GetFrameCount(&D_06004E98.genericHeader), 2, 1.0f);
} else {
SkelAnime_ChangeAnim(&this->skelAnime, &D_06004348, 1.0f, 0.0f,
(f32)SkelAnime_GetFrameCount(&D_06004348.genericHeader), 0, 1.0f);
SkelAnime_GetFrameCount(&D_06004348.genericHeader), 0, 1.0f);
}
}
this->actionFunc(this, globalCtx);

View File

@ -140,9 +140,10 @@ void EnHeishi1_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void EnHeishi1_SetupWalk(EnHeishi1* this, GlobalContext* globalCtx) {
s16 frameCount = (f32)SkelAnime_GetFrameCount(&D_06005880.genericHeader);
f32 frameCount = SkelAnime_GetFrameCount(&D_06005880.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005880, this->animSpeed, 0.0f, frameCount, 0, this->transitionRate);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005880, this->animSpeed, 0.0f, (s16)frameCount, 0,
this->transitionRate);
this->bodyTurnSpeed = 0.0f;
this->moveSpeed = 0.0f;
this->headDirection = Math_Rand_ZeroFloat(1.99f);
@ -223,9 +224,9 @@ void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx) {
}
void EnHeishi1_SetupMoveToLink(EnHeishi1* this, GlobalContext* globalCtx) {
s16 frameCount = (f32)SkelAnime_GetFrameCount(&D_06005880.genericHeader);
f32 frameCount = SkelAnime_GetFrameCount(&D_06005880.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005880, 3.0f, 0.0f, frameCount, 0, -3.0f);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005880, 3.0f, 0.0f, (s16)frameCount, 0, -3.0f);
this->bodyTurnSpeed = 0.0f;
this->moveSpeed = 0.0f;
func_8010B680(globalCtx, 0x702D, &this->actor);
@ -251,9 +252,10 @@ void EnHeishi1_MoveToLink(EnHeishi1* this, GlobalContext* globalCtx) {
void EnHeishi1_SetupWait(EnHeishi1* this, GlobalContext* globalCtx) {
s16 rand;
s16 frameCount = (f32)SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
f32 frameCount = SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, this->animSpeed, 0.0f, frameCount, 0, this->transitionRate);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, this->animSpeed, 0.0f, (s16)frameCount, 0,
this->transitionRate);
this->headBehaviorDecided = false;
this->headDirection = Math_Rand_ZeroFloat(1.99f);
rand = Math_Rand_ZeroFloat(50.0f);
@ -320,9 +322,9 @@ void EnHeishi1_Wait(EnHeishi1* this, GlobalContext* globalCtx) {
}
void EnHeishi1_SetupTurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx) {
s16 frameCount = (f32)SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
f32 frameCount = SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, frameCount, 0, -10.0f);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
this->kickTimer = 30;
this->actionFunc = EnHeishi1_TurnTowardLink;
}
@ -342,9 +344,9 @@ void EnHeishi1_TurnTowardLink(EnHeishi1* this, GlobalContext* globalCtx) {
}
void EnHeishi1_SetupKick(EnHeishi1* this, GlobalContext* globalCtx) {
s16 frameCount = (f32)SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
f32 frameCount = SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, frameCount, 0, -10.0f);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
this->actionFunc = EnHeishi1_Kick;
}
@ -368,9 +370,9 @@ void EnHeishi1_Kick(EnHeishi1* this, GlobalContext* globalCtx) {
}
void EnHeishi1_SetupWaitNight(EnHeishi1* this, GlobalContext* globalCtx) {
s16 frameCount = (f32)SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
f32 frameCount = SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, frameCount, 0, -10.0f);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
this->actionFunc = EnHeishi1_WaitNight;
}

View File

@ -153,6 +153,7 @@ void EnHeishi2_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnHeishi2_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnHeishi2* this = THIS;
if ((this->collider.dim.radius != 0) || (this->collider.dim.height != 0)) {
Collider_DestroyCylinder(globalCtx, &this->collider);
}
@ -165,8 +166,9 @@ void func_80A531D8(EnHeishi2* this, GlobalContext* globalCtx) {
}
void func_80A531E4(EnHeishi2* this, GlobalContext* globalCtx) {
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f,
(s16)(f32)SkelAnime_GetFrameCount(&D_06005C30.genericHeader), 0, -10.0f);
f32 frameCount = SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
this->actionFunc = func_80A53278;
}
@ -262,14 +264,14 @@ void func_80A53538(EnHeishi2* this, GlobalContext* globalCtx) {
}
void func_80A535BC(EnHeishi2* this, GlobalContext* globalCtx) {
f32 frames = SkelAnime_GetFrameCount(&D_06005500.genericHeader);
this->unk_2EC = frames;
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005500, 1.0f, 0.0f, frames, 2, -10.0f);
f32 frameCount = SkelAnime_GetFrameCount(&D_06005500.genericHeader);
this->unk_2EC = frameCount;
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005500, 1.0f, 0.0f, frameCount, 2, -10.0f);
this->actionFunc = func_80A53638;
}
void func_80A53638(EnHeishi2* this, GlobalContext* globalCtx) {
Actor* thisx;
f32 frameCount;
BgSpot15Saku* actor;
@ -299,8 +301,9 @@ void func_80A53638(EnHeishi2* this, GlobalContext* globalCtx) {
}
void func_80A5372C(EnHeishi2* this, GlobalContext* globalCtx) {
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f,
(s16)(f32)SkelAnime_GetFrameCount(&D_06005C30.genericHeader), 0, -10.0f);
f32 frameCount = SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
this->unk_2F2[0] = 200;
this->cameraId = Gameplay_CreateSubCamera(globalCtx);
Gameplay_ChangeCameraStatus(globalCtx, 0, 1);
@ -319,6 +322,7 @@ void func_80A5372C(EnHeishi2* this, GlobalContext* globalCtx) {
void func_80A53850(EnHeishi2* this, GlobalContext* globalCtx) {
BgSpot15Saku* gate;
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
func_800C04D8(globalCtx, this->cameraId, &this->unk_280, &this->unk_28C);
gate = (BgSpot15Saku*)this->attachedGate;
@ -334,6 +338,7 @@ void func_80A53850(EnHeishi2* this, GlobalContext* globalCtx) {
void func_80A53908(EnHeishi2* this, GlobalContext* globalCtx) {
f32 frameCount = SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
this->actionFunc = func_80A5399C;
}
@ -426,6 +431,7 @@ void func_80A53C0C(EnHeishi2* this, GlobalContext* globalCtx) {
void func_80A53C90(EnHeishi2* this, GlobalContext* globalCtx) {
f32 frameCount = SkelAnime_GetFrameCount(&D_06005500.genericHeader);
this->unk_2EC = frameCount;
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005500, 1.0f, 0.0f, frameCount, 2, -10.0f);
this->actionFunc = func_80A53D0C;
@ -462,8 +468,9 @@ void func_80A53D0C(EnHeishi2* this, GlobalContext* globalCtx) {
}
void func_80A53DF8(EnHeishi2* this, GlobalContext* globalCtx) {
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f,
(s16)(f32)SkelAnime_GetFrameCount(&D_06005C30.genericHeader), 0, -10.0f);
f32 frameCount = SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
this->unk_2F2[0] = 200;
this->cameraId = Gameplay_CreateSubCamera(globalCtx);
Gameplay_ChangeCameraStatus(globalCtx, 0, 1);
@ -486,6 +493,7 @@ void func_80A53DF8(EnHeishi2* this, GlobalContext* globalCtx) {
void func_80A53F30(EnHeishi2* this, GlobalContext* globalCtx) {
BgGateShutter* gate;
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
func_800C04D8(globalCtx, this->cameraId, &this->unk_280, &this->unk_28C);
gate = (BgGateShutter*)this->attachedGate;
@ -586,6 +594,7 @@ void func_80A5427C(EnHeishi2* this, GlobalContext* globalCtx) {
void func_80A54320(EnHeishi2* this, GlobalContext* globalCtx) {
f32 frameCount = SkelAnime_GetFrameCount(&D_06005500.genericHeader);
this->unk_2EC = frameCount;
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005500, 1.0f, 0.0f, frameCount, 2, -10.0f);
this->audioFlag = 0;
@ -742,6 +751,7 @@ void func_80A5475C(EnHeishi2* this, GlobalContext* globalCtx) {
void func_80A54954(EnHeishi2* this, GlobalContext* globalCtx) {
f32 frameCount = SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
this->actionFunc = func_80A549E8;
}
@ -798,6 +808,7 @@ void EnHeishi2_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 EnHeishi2_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
Actor* thisx) {
EnHeishi2* this = THIS;
switch (this->initParams) {
case 1:
break;

View File

@ -78,12 +78,14 @@ void EnHeishi3_Init(Actor* thisx, GlobalContext* globalCtx) {
void EnHeishi3_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnHeishi3* this = THIS;
Collider_DestroyCylinder(globalCtx, &this->collider);
}
void EnHeishi3_SetupGuardType(EnHeishi3* this, GlobalContext* globalCtx) {
f32 frames = SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)(f32)frames, 0, -10.0f);
f32 frameCount = SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
if (this->unk_278 == 0) {
this->actionFunc = EnHeishi3_StandSentinelInGrounds;
} else {
@ -157,8 +159,9 @@ void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, GlobalContext* globalCtx)
}
void EnHeishi3_CatchStart(EnHeishi3* this, GlobalContext* globalCtx) {
f32 frames = SkelAnime_GetFrameCount(&D_06005880.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005880, 1.0f, 0.0f, (s16)(f32)frames, 0, -10.0f);
f32 frameCount = SkelAnime_GetFrameCount(&D_06005880.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005880, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
this->caughtTimer = 20;
this->actionFunc = func_80A55BD4;
this->actor.speedXZ = 2.5f;
@ -179,8 +182,9 @@ void func_80A55BD4(EnHeishi3* this, GlobalContext* globalCtx) {
}
void EnHeishi3_ResetAnimationToIdle(EnHeishi3* this, GlobalContext* globalCtx) {
f32 frames = SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)(f32)frames, 0, -10.0f);
f32 frameCount = SkelAnime_GetFrameCount(&D_06005C30.genericHeader);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06005C30, 1.0f, 0.0f, (s16)frameCount, 0, -10.0f);
this->actionFunc = func_80A55D00;
}
@ -200,6 +204,7 @@ void func_80A55D00(EnHeishi3* this, GlobalContext* globalCtx) {
void EnHeishi3_Update(Actor* thisx, GlobalContext* globalCtx) {
EnHeishi3* this = THIS;
s32 pad;
Actor_SetHeight(&this->actor, 60.0f);
this->unk_274 += 1;
if (this->caughtTimer != 0) {
@ -216,6 +221,7 @@ void EnHeishi3_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 EnHeishi3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
Actor* thisx) {
EnHeishi3* this = THIS;
if (limbIndex == 9) {
rot->x += this->unk_26E;
}
@ -230,6 +236,7 @@ s32 EnHeishi3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL
void EnHeishi3_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnHeishi3* this = THIS;
func_80093D18(globalCtx->state.gfxCtx);
SkelAnime_Draw(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, EnHeishi3_OverrideLimbDraw, NULL,
&this->actor);

View File

@ -514,7 +514,7 @@ void EnHintnuts_Update(Actor* thisx, GlobalContext* globalCtx) {
Actor_SetHeight(&this->actor, this->skelAnime.animCurrentFrame);
} else if (this->actionFunc == EnHintnuts_Burrow) {
Actor_SetHeight(&this->actor, 20.0f - ((this->skelAnime.animCurrentFrame * 20.0f) /
(f32)SkelAnime_GetFrameCount(&D_060024CC.genericHeader)));
SkelAnime_GetFrameCount(&D_060024CC.genericHeader)));
} else {
Actor_SetHeight(&this->actor, 20.0f);
}

View File

@ -137,10 +137,10 @@ void EnSb_SetupWaitOpen(EnSb* this) {
}
void EnSb_SetupLunge(EnSb* this) {
f32 frames = SkelAnime_GetFrameCount(&D_06000124.genericHeader);
f32 frameCount = SkelAnime_GetFrameCount(&D_06000124.genericHeader);
f32 playbackSpeed = this->actor.waterY > 0.0f ? 1.0f : 0.0f;
SkelAnime_ChangeAnim(&this->skelAnime, &D_06000124, playbackSpeed, 0.0f, frames, 2, 0);
SkelAnime_ChangeAnim(&this->skelAnime, &D_06000124, playbackSpeed, 0.0f, frameCount, 2, 0);
this->behavior = SHELLBLADE_LUNGE;
this->actionFunc = EnSb_Lunge;
Audio_PlayActorSound2(&this->actor, NA_SE_EN_SHELL_MOUTH);

View File

@ -141,7 +141,7 @@ void EnWallmas_SetupDrop(EnWallmas* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
AnimationHeader* objSegChangeAnime = &D_0600299C;
SkelAnime_ChangeAnim(&this->skelAnime, objSegChangeAnime, 0.0f, 20.0f, (f32)SkelAnime_GetFrameCount(&D_0600299C), 2,
SkelAnime_ChangeAnim(&this->skelAnime, objSegChangeAnime, 0.0f, 20.0f, SkelAnime_GetFrameCount(&D_0600299C), 2,
0.0f);
this->unk_2c4 = player->actor.posRot.pos.y;
@ -188,8 +188,8 @@ void EnWallmas_SetupReturnToCeiling(EnWallmas* this) {
this->timer = 0;
this->actor.speedXZ = 0.0f;
SkelAnime_ChangeAnim(&this->skelAnime, objSegChangeAnime, 3.0f, 0.0f,
(f32)SkelAnime_GetFrameCount(objSegFrameCount), 2, -3.0f);
SkelAnime_ChangeAnim(&this->skelAnime, objSegChangeAnime, 3.0f, 0.0f, SkelAnime_GetFrameCount(objSegFrameCount), 2,
-3.0f);
this->actionFunc = EnWallmas_ReturnToCeiling;
}