1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-22 06:52:03 +00:00

Cleanup around some generic animation info structs (#1059)

* Name generic anim info structs and cleanup usage

* Make `EnDaiku` use generic struct

* Add `/* decimalid */` comments to all added enums

* small fixes

* Two more generic animinfo structs

* Cleanup usage of newly generic structs

* Cleanup x2 usage of newly generic structs

* `transitionRate` -> `morphFrames`

* Properly name generic anim structs (attempt to at least)

* `anim` -> `animation`

* fixes

* run formatter

* Use consistent prototypes for each actor's ChangeAnim helper

* run formatter

* minor cleanup

* Run formatter

* `Animation_ChangeInfo` -> `Animation_ChangeByInfo`
This commit is contained in:
Dragorn421 2022-01-12 03:10:43 +01:00 committed by GitHub
parent d3a8ade6ba
commit 11917bf640
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 675 additions and 467 deletions

View file

@ -104,7 +104,18 @@ static ColliderJntSphInit sJntSphInit = {
sJntSphElementsInit,
};
static struct_80034EC0_Entry sAnimations[] = {
typedef enum {
/* 0 */ ENST_ANIM_0,
/* 1 */ ENST_ANIM_1,
/* 2 */ ENST_ANIM_2,
/* 3 */ ENST_ANIM_3,
/* 4 */ ENST_ANIM_4,
/* 5 */ ENST_ANIM_5,
/* 6 */ ENST_ANIM_6,
/* 7 */ ENST_ANIM_7
} EnStAnimation;
static AnimationInfo sAnimationInfo[] = {
{ &object_st_Anim_000304, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP_INTERP, 0.0f },
{ &object_st_Anim_005B98, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -8.0f },
{ &object_st_Anim_000304, 4.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -8.0f },
@ -234,24 +245,24 @@ void EnSt_AddBlurSpace(EnSt* this) {
}
void EnSt_SetWaitingAnimation(EnSt* this) {
func_80034EC0(&this->skelAnime, sAnimations, 3);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_3);
}
void EnSt_SetReturnToCeilingAnimation(EnSt* this) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_UP);
func_80034EC0(&this->skelAnime, sAnimations, 2);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_2);
}
void EnSt_SetLandAnimation(EnSt* this) {
this->actor.world.pos.y = this->actor.floorHeight + this->floorHeightOffset;
func_80034EC0(&this->skelAnime, sAnimations, 4);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_4);
this->sfxTimer = 0;
this->animFrames = this->skelAnime.animLength;
}
void EnSt_SetDropAnimAndVel(EnSt* this) {
if (this->takeDamageSpinTimer == 0) {
func_80034EC0(&this->skelAnime, sAnimations, 4);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_4);
this->animFrames = this->skelAnime.animLength;
}
this->sfxTimer = 0;
@ -440,7 +451,7 @@ s32 EnSt_CheckHitBackside(EnSt* this, GlobalContext* globalCtx) {
this->swayTimer = this->stunTimer = 0;
this->gaveDamageSpinTimer = 1;
func_80034EC0(&this->skelAnime, sAnimations, 3);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_3);
this->takeDamageSpinTimer = this->skelAnime.animLength;
Actor_SetColorFilter(&this->actor, 0x4000, 0xC8, 0, this->takeDamageSpinTimer);
if (Actor_ApplyDamage(&this->actor)) {
@ -769,7 +780,7 @@ void EnSt_Init(Actor* thisx, GlobalContext* globalCtx) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 14.0f);
SkelAnime_Init(globalCtx, &this->skelAnime, &object_st_Skel_005298, NULL, this->jointTable, this->morphTable, 30);
func_80034EC0(&this->skelAnime, sAnimations, 0);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_0);
this->blureIdx = EnSt_CreateBlureEffect(globalCtx);
EnSt_InitColliders(this, globalCtx);
if (thisx->params == 2) {
@ -817,14 +828,14 @@ void EnSt_WaitOnGround(EnSt* this, GlobalContext* globalCtx) {
if (this->takeDamageSpinTimer != 0) {
this->takeDamageSpinTimer--;
if (this->takeDamageSpinTimer == 0) {
func_80034EC0(&this->skelAnime, sAnimations, 3);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_3);
}
}
if (this->animFrames != 0) {
this->animFrames--;
if (this->animFrames == 0) {
func_80034EC0(&this->skelAnime, sAnimations, 3);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_3);
}
}
@ -849,14 +860,14 @@ void EnSt_LandOnGround(EnSt* this, GlobalContext* globalCtx) {
if (this->animFrames != 0) {
this->animFrames--;
if (this->animFrames == 0) {
func_80034EC0(&this->skelAnime, sAnimations, 3);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_3);
}
}
if (this->takeDamageSpinTimer != 0) {
this->takeDamageSpinTimer--;
if (this->takeDamageSpinTimer == 0) {
func_80034EC0(&this->skelAnime, sAnimations, 3);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_3);
}
}
@ -879,7 +890,7 @@ void EnSt_MoveToGround(EnSt* this, GlobalContext* globalCtx) {
if (this->takeDamageSpinTimer != 0) {
this->takeDamageSpinTimer--;
if (this->takeDamageSpinTimer == 0) {
func_80034EC0(&this->skelAnime, sAnimations, 5);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENST_ANIM_5);
}
}