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

@ -125,7 +125,23 @@ static f32 D_80A482D8[14][2] = {
{ 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f }, { 20.0f, 20.0f },
};
static struct_80034EC0_Entry sAnimations[] = {
typedef enum {
/* 0 */ ENGO2_ANIM_0,
/* 1 */ ENGO2_ANIM_1,
/* 2 */ ENGO2_ANIM_2,
/* 3 */ ENGO2_ANIM_3,
/* 4 */ ENGO2_ANIM_4,
/* 5 */ ENGO2_ANIM_5,
/* 6 */ ENGO2_ANIM_6,
/* 7 */ ENGO2_ANIM_7,
/* 8 */ ENGO2_ANIM_8,
/* 9 */ ENGO2_ANIM_9,
/* 10 */ ENGO2_ANIM_10,
/* 11 */ ENGO2_ANIM_11,
/* 12 */ ENGO2_ANIM_12
} EnGo2Animation;
static AnimationInfo sAnimationInfo[] = {
{ &gGoronAnim_004930, 0.0f, 0.0f, -1.0f, 0x00, 0.0f }, { &gGoronAnim_004930, 0.0f, 0.0f, -1.0f, 0x00, -8.0f },
{ &gGoronAnim_0029A8, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_010590, 1.0f, 0.0f, -1.0f, 0x00, -8.0f },
{ &gGoronAnim_003768, 1.0f, 0.0f, -1.0f, 0x00, -8.0f }, { &gGoronAnim_0038E4, 1.0f, 0.0f, -1.0f, 0x02, -8.0f },
@ -1097,11 +1113,11 @@ void func_80A454CC(EnGo2* this) {
case GORON_CITY_ENTRANCE:
case GORON_CITY_STAIRWELL:
case GORON_DMT_FAIRY_HINT:
func_80034EC0(&this->skelAnime, sAnimations, 9);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_9);
break;
case GORON_DMT_BIGGORON:
if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_SWORD_BROKEN && INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_EYEDROPS) {
func_80034EC0(&this->skelAnime, sAnimations, 4);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_4);
break;
}
default:
@ -1265,10 +1281,10 @@ void EnGo2_GetDustData(EnGo2* this, s32 index2) {
void EnGo2_RollingAnimation(EnGo2* this, GlobalContext* globalCtx) {
if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) {
this->actor.flags &= ~ACTOR_FLAG_0;
func_80034EC0(&this->skelAnime, sAnimations, 10);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10);
this->skelAnime.playSpeed = -0.5f;
} else {
func_80034EC0(&this->skelAnime, sAnimations, 1);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1);
this->skelAnime.playSpeed = -1.0f;
}
EnGo2_SwapInitialFrameAnimFrameCount(this);
@ -1288,17 +1304,17 @@ void EnGo2_WakeUp(EnGo2* this, GlobalContext* globalCtx) {
}
if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) {
OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, MAIN_CAM);
func_80034EC0(&this->skelAnime, sAnimations, 10);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10);
this->skelAnime.playSpeed = 0.5f;
} else {
func_80034EC0(&this->skelAnime, sAnimations, 1);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1);
this->skelAnime.playSpeed = 1.0f;
}
this->actionFunc = func_80A46B40;
}
void EnGo2_GetItemAnimation(EnGo2* this, GlobalContext* globalCtx) {
func_80034EC0(&this->skelAnime, sAnimations, 1);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1);
this->unk_211 = true;
this->actionFunc = func_80A46B40;
this->skelAnime.playSpeed = 0.0f;
@ -1361,7 +1377,7 @@ s32 EnGo2_IsGoronDmtBombFlower(EnGo2* this) {
return false;
}
func_80034EC0(&this->skelAnime, sAnimations, 3);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_3);
this->unk_194.unk_00 = 0;
this->isAwake = false;
this->unk_26E = 1;
@ -1409,13 +1425,13 @@ s32 EnGo2_IsRolling(EnGo2* this) {
}
void EnGo2_GoronLinkAnimation(EnGo2* this, GlobalContext* globalCtx) {
s32 animation = 13;
s32 animation = ARRAY_COUNT(sAnimationInfo);
if ((this->actor.params & 0x1F) == GORON_CITY_LINK) {
if ((this->actor.textId == 0x3035 && this->unk_20C == 0) ||
(this->actor.textId == 0x3036 && this->unk_20C == 0)) {
if (this->skelAnime.animation != &gGoronAnim_000D5C) {
animation = 12;
animation = ENGO2_ANIM_12;
this->eyeMouthTexState = 0;
}
}
@ -1423,7 +1439,7 @@ void EnGo2_GoronLinkAnimation(EnGo2* this, GlobalContext* globalCtx) {
if ((this->actor.textId == 0x3032 && this->unk_20C == 12) || (this->actor.textId == 0x3033) ||
(this->actor.textId == 0x3035 && this->unk_20C == 6)) {
if (this->skelAnime.animation != &gGoronAnim_000750) {
animation = 11;
animation = ENGO2_ANIM_11;
this->eyeMouthTexState = 1;
}
}
@ -1434,8 +1450,8 @@ void EnGo2_GoronLinkAnimation(EnGo2* this, GlobalContext* globalCtx) {
}
}
if (animation != 13) {
func_80034EC0(&this->skelAnime, sAnimations, animation);
if (animation != ARRAY_COUNT(sAnimationInfo)) {
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, animation);
}
}
}
@ -1501,7 +1517,7 @@ void EnGo2_Init(Actor* thisx, GlobalContext* globalCtx) {
EnGo2_SetColliderDim(this);
EnGo2_SetShape(this);
func_80034EC0(&this->skelAnime, sAnimations, 0);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_0);
this->actor.gravity = -1.0f;
this->alpha = this->actor.shape.shadowAlpha = 0;
this->reverse = 0;
@ -1783,7 +1799,7 @@ void EnGo2_SetGetItem(EnGo2* this, GlobalContext* globalCtx) {
void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) {
switch (this->goronState) {
case 0:
func_80034EC0(&this->skelAnime, sAnimations, 5);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_5);
this->actor.flags &= ~ACTOR_FLAG_0;
this->actor.shape.rot.y += 0x5B0;
this->unk_26E = 1;
@ -1802,7 +1818,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) {
}
} else {
func_800F4524(&D_801333D4, NA_SE_EN_GOLON_GOOD_BIG, 60);
func_80034EC0(&this->skelAnime, sAnimations, 6);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_6);
Message_ContinueTextbox(globalCtx, 0x305A);
this->eyeMouthTexState = 3;
this->goronState++;
@ -1814,7 +1830,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) {
this->eyeMouthTexState = 0;
}
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
func_80034EC0(&this->skelAnime, sAnimations, 1);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_1);
this->actor.flags |= ACTOR_FLAG_0;
this->unk_26E = 2;
this->skelAnime.playSpeed = 0.0f;
@ -1865,7 +1881,7 @@ void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) {
EnGo2_GoronFireCamera(this, globalCtx);
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
func_80034EC0(&this->skelAnime, sAnimations, 2);
Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_2);
this->waypoint = 1;
this->skelAnime.playSpeed = 2.0f;
func_80A44D84(this);