1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-23 07:21:19 +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

@ -60,7 +60,14 @@ static ColliderCylinderInit sCylinderInit = {
static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
static struct_D_80AA1678 sAnimationInfo[] = {
typedef enum {
/* 0 */ ENMA1_ANIM_0,
/* 1 */ ENMA1_ANIM_1,
/* 2 */ ENMA1_ANIM_2,
/* 3 */ ENMA1_ANIM_3
} EnMa1Animation;
static AnimationFrameCountInfo sAnimationInfo[] = {
{ &gMalonChildIdleAnim, 1.0f, ANIMMODE_LOOP, 0.0f },
{ &gMalonChildIdleAnim, 1.0f, ANIMMODE_LOOP, -10.0f },
{ &gMalonChildSingAnim, 1.0f, ANIMMODE_LOOP, 0.0f },
@ -214,11 +221,11 @@ void EnMa1_UpdateEyes(EnMa1* this) {
}
}
void EnMa1_ChangeAnimation(EnMa1* this, UNK_TYPE idx) {
f32 frameCount = Animation_GetLastFrame(sAnimationInfo[idx].animation);
void EnMa1_ChangeAnim(EnMa1* this, s32 index) {
f32 frameCount = Animation_GetLastFrame(sAnimationInfo[index].animation);
Animation_Change(&this->skelAnime, sAnimationInfo[idx].animation, 1.0f, 0.0f, frameCount, sAnimationInfo[idx].mode,
sAnimationInfo[idx].transitionRate);
Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, frameCount,
sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames);
}
void func_80AA0AF4(EnMa1* this, GlobalContext* globalCtx) {
@ -275,10 +282,10 @@ void EnMa1_Init(Actor* thisx, GlobalContext* globalCtx) {
if (!(gSaveContext.eventChkInf[1] & 0x10) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
this->actionFunc = func_80AA0D88;
EnMa1_ChangeAnimation(this, 2);
EnMa1_ChangeAnim(this, ENMA1_ANIM_2);
} else {
this->actionFunc = func_80AA0F44;
EnMa1_ChangeAnimation(this, 2);
EnMa1_ChangeAnim(this, ENMA1_ANIM_2);
}
}
@ -292,11 +299,11 @@ void EnMa1_Destroy(Actor* thisx, GlobalContext* globalCtx) {
void func_80AA0D88(EnMa1* this, GlobalContext* globalCtx) {
if (this->unk_1E8.unk_00 != 0) {
if (this->skelAnime.animation != &gMalonChildIdleAnim) {
EnMa1_ChangeAnimation(this, 1);
EnMa1_ChangeAnim(this, ENMA1_ANIM_1);
}
} else {
if (this->skelAnime.animation != &gMalonChildSingAnim) {
EnMa1_ChangeAnimation(this, 3);
EnMa1_ChangeAnim(this, ENMA1_ANIM_3);
}
}
@ -334,11 +341,11 @@ void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) {
if (this->unk_1E8.unk_00 != 0) {
if (this->skelAnime.animation != &gMalonChildIdleAnim) {
EnMa1_ChangeAnimation(this, 1);
EnMa1_ChangeAnim(this, ENMA1_ANIM_1);
}
} else {
if (this->skelAnime.animation != &gMalonChildSingAnim) {
EnMa1_ChangeAnimation(this, 3);
EnMa1_ChangeAnim(this, ENMA1_ANIM_3);
}
}