From b3f4b8a9cb17229a64bfbca9b20aee3b8cbe2bc3 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Sat, 15 Jul 2023 06:33:58 +1000 Subject: [PATCH] Animation Cleanup: En_B* Actors (#1326) * En_B * more cleanup * another if (1) fixed * more cleanup * more cleanup * rot * PR Suggestions * fix vtx * rm more Draw * Update assets/xml/objects/object_yb.xml Co-authored-by: Isghj <42048411+isghj5@users.noreply.github.com> * Update assets/xml/objects/object_bigpo.xml Co-authored-by: Tom Overton --------- Co-authored-by: Isghj <42048411+isghj5@users.noreply.github.com> Co-authored-by: Tom Overton --- assets/xml/objects/object_ani.xml | 10 +- assets/xml/objects/object_bigpo.xml | 100 +++++---- assets/xml/objects/object_ds2n.xml | 8 +- assets/xml/objects/object_hs.xml | 6 +- assets/xml/objects/object_po_sisters.xml | 25 +-- assets/xml/objects/object_ru2.xml | 4 +- assets/xml/objects/object_yb.xml | 9 +- src/overlays/actors/ovl_En_Baba/z_en_baba.c | 72 ++++--- src/overlays/actors/ovl_En_Baguo/z_en_baguo.c | 30 +-- src/overlays/actors/ovl_En_Baguo/z_en_baguo.h | 2 +- .../actors/ovl_En_Baisen/z_en_baisen.c | 47 ++-- .../actors/ovl_En_Baisen/z_en_baisen.h | 7 +- src/overlays/actors/ovl_En_Bb/z_en_bb.c | 34 ++- .../actors/ovl_En_Bba_01/z_en_bba_01.c | 3 + .../actors/ovl_En_Bbfall/z_en_bbfall.c | 2 +- src/overlays/actors/ovl_En_Bee/z_en_bee.c | 8 +- src/overlays/actors/ovl_En_Bee/z_en_bee.h | 4 +- src/overlays/actors/ovl_En_Bh/z_en_bh.c | 16 +- src/overlays/actors/ovl_En_Bh/z_en_bh.h | 2 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.c | 8 +- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c | 82 +++---- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h | 22 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 18 +- .../actors/ovl_En_Bigslime/z_en_bigslime.h | 2 +- .../actors/ovl_En_Bji_01/z_en_bji_01.c | 48 +++-- src/overlays/actors/ovl_En_Bjt/z_en_bjt.c | 23 +- .../actors/ovl_En_Boj_01/z_en_boj_01.c | 3 + .../actors/ovl_En_Boj_02/z_en_boj_02.c | 3 + .../actors/ovl_En_Boj_03/z_en_boj_03.c | 3 + .../actors/ovl_En_Boj_04/z_en_boj_04.c | 3 + .../actors/ovl_En_Boj_05/z_en_boj_05.c | 3 + .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 156 ++++++++++---- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h | 9 +- .../actors/ovl_En_Bombers/z_en_bombers.c | 118 +++++++--- .../actors/ovl_En_Bombers/z_en_bombers.h | 9 +- .../actors/ovl_En_Bombers2/z_en_bombers2.c | 92 +++++--- .../actors/ovl_En_Bombers2/z_en_bombers2.h | 5 +- .../actors/ovl_En_Bomjima/z_en_bomjima.c | 203 ++++++++++++------ .../actors/ovl_En_Bomjima/z_en_bomjima.h | 7 +- .../actors/ovl_En_Bomjimb/z_en_bomjimb.c | 173 ++++++++++----- .../actors/ovl_En_Bomjimb/z_en_bomjimb.h | 9 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 34 +-- src/overlays/actors/ovl_En_Butte/z_en_butte.c | 2 +- src/overlays/actors/ovl_En_Butte/z_en_butte.h | 5 +- src/overlays/actors/ovl_En_Famos/z_en_famos.c | 20 +- src/overlays/actors/ovl_En_Famos/z_en_famos.h | 4 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 68 +++--- .../actors/ovl_En_Kakasi/z_en_kakasi.h | 4 +- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 8 +- src/overlays/actors/ovl_En_Niw/z_en_niw.h | 2 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 2 +- src/overlays/actors/ovl_En_Raf/z_en_raf.c | 18 +- src/overlays/actors/ovl_En_Raf/z_en_raf.h | 2 +- tools/disasm/functions.txt | 8 +- tools/disasm/variables.txt | 8 +- 55 files changed, 967 insertions(+), 606 deletions(-) diff --git a/assets/xml/objects/object_ani.xml b/assets/xml/objects/object_ani.xml index fb17e4e750..2900ff7234 100644 --- a/assets/xml/objects/object_ani.xml +++ b/assets/xml/objects/object_ani.xml @@ -15,18 +15,18 @@ - + - + - + - + - + diff --git a/assets/xml/objects/object_bigpo.xml b/assets/xml/objects/object_bigpo.xml index e10052e3c6..858ad4a879 100644 --- a/assets/xml/objects/object_bigpo.xml +++ b/assets/xml/objects/object_bigpo.xml @@ -1,47 +1,63 @@  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_ds2n.xml b/assets/xml/objects/object_ds2n.xml index da6ce5e875..52284c224c 100644 --- a/assets/xml/objects/object_ds2n.xml +++ b/assets/xml/objects/object_ds2n.xml @@ -7,10 +7,10 @@ - + - + @@ -80,10 +80,10 @@ - + - + diff --git a/assets/xml/objects/object_hs.xml b/assets/xml/objects/object_hs.xml index 19ea49b6b7..500ba389f7 100644 --- a/assets/xml/objects/object_hs.xml +++ b/assets/xml/objects/object_hs.xml @@ -30,12 +30,12 @@ - + - + - + diff --git a/assets/xml/objects/object_po_sisters.xml b/assets/xml/objects/object_po_sisters.xml index cc00b50a1f..6b0755905d 100644 --- a/assets/xml/objects/object_po_sisters.xml +++ b/assets/xml/objects/object_po_sisters.xml @@ -15,14 +15,12 @@ - - - - - - - - + + + + + + @@ -51,14 +49,11 @@ - - + - - - - - + + + diff --git a/assets/xml/objects/object_ru2.xml b/assets/xml/objects/object_ru2.xml index 72510149c0..89d00e9d7c 100644 --- a/assets/xml/objects/object_ru2.xml +++ b/assets/xml/objects/object_ru2.xml @@ -74,12 +74,12 @@ - + - + diff --git a/assets/xml/objects/object_yb.xml b/assets/xml/objects/object_yb.xml index 3bbfc7cce7..d00a611707 100644 --- a/assets/xml/objects/object_yb.xml +++ b/assets/xml/objects/object_yb.xml @@ -19,10 +19,10 @@ - + - + @@ -47,12 +47,13 @@ + - + - + diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c index ee42446bd2..11dcd5a552 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -35,15 +35,6 @@ void EnBaba_DoNothing(EnBaba* this, PlayState* play); void EnBaba_Walk(EnBaba* this, PlayState* play); void EnBaba_FaceForward(EnBaba* this, PlayState* play); -typedef enum { - /* 0 */ BOMB_SHOP_LADY_ANIM_IDLE_HOLDING_BAG, - /* 1 */ BOMB_SHOP_LADY_ANIM_IDLE, - /* 2 */ BOMB_SHOP_LADY_ANIM_WALKING_HOLDING_BAG, - /* 3 */ BOMB_SHOP_LADY_ANIM_KNOCKED_OVER, - /* 4 */ BOMB_SHOP_LADY_ANIM_LYING_DOWN, - /* 5 */ BOMB_SHOP_LADY_ANIM_SWAY -} BombShopLadyAnimation; - typedef enum { /* 0 */ BOMB_SHOP_LADY_SCH_NONE, /* 1 */ BOMB_SHOP_LADY_SCH_KNOCKED_OVER, @@ -62,13 +53,23 @@ ActorInit En_Baba_InitVars = { (ActorFunc)EnBaba_Draw, }; -static AnimationInfo sAnimationInfo[] = { - { &gBbaIdleHoldingBagAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gBbaIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gBbaWalkingHoldingBagAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gBbaKnockedOverAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, - { &gBbaLyingDownAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, - { &gBbaSwayAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, +typedef enum { + /* 0 */ BOMB_SHOP_LADY_ANIM_IDLE_HOLDING_BAG, + /* 1 */ BOMB_SHOP_LADY_ANIM_IDLE, + /* 2 */ BOMB_SHOP_LADY_ANIM_WALKING_HOLDING_BAG, + /* 3 */ BOMB_SHOP_LADY_ANIM_KNOCKED_OVER, + /* 4 */ BOMB_SHOP_LADY_ANIM_LYING_DOWN, + /* 5 */ BOMB_SHOP_LADY_ANIM_SWAY, + /* 6 */ BOMB_SHOP_LADY_ANIM_MAX +} BombShopLadyAnimation; + +static AnimationInfo sAnimationInfo[BOMB_SHOP_LADY_ANIM_MAX] = { + { &gBbaIdleHoldingBagAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // BOMB_SHOP_LADY_ANIM_IDLE_HOLDING_BAG + { &gBbaIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // BOMB_SHOP_LADY_ANIM_IDLE + { &gBbaWalkingHoldingBagAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // BOMB_SHOP_LADY_ANIM_WALKING_HOLDING_BAG + { &gBbaKnockedOverAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f }, // BOMB_SHOP_LADY_ANIM_KNOCKED_OVER + { &gBbaLyingDownAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // BOMB_SHOP_LADY_ANIM_LYING_DOWN + { &gBbaSwayAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, 0.0f }, // BOMB_SHOP_LADY_ANIM_SWAY }; static ColliderCylinderInit sCylinderInit = { @@ -184,7 +185,9 @@ void EnBaba_HandleConversation(EnBaba* this, PlayState* play) { // Can't stock Bomb Bags tomorrow this->textId = 0x2A32; break; - } else if (player->transformation == PLAYER_FORM_DEKU) { + } + + if (player->transformation == PLAYER_FORM_DEKU) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_79_20)) { SET_WEEKEVENTREG(WEEKEVENTREG_79_20); this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; @@ -197,7 +200,9 @@ void EnBaba_HandleConversation(EnBaba* this, PlayState* play) { this->textId = 0x2A38; } break; - } else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { + } + + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_33_08)) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_73_01)) { // Thought could sell Big Bomb Bags this->textId = 0x660; @@ -206,16 +211,16 @@ void EnBaba_HandleConversation(EnBaba* this, PlayState* play) { // Can't judge people this->textId = 0x662; break; - } else { - if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_73_02)) { - // Someone helped me out - this->textId = 0x65A; - break; - } - // Buy Big Bomb Bag - this->textId = 0x65E; + } + + if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_73_02)) { + // Someone helped me out + this->textId = 0x65A; break; } + + // Buy Big Bomb Bag + this->textId = 0x65E; break; case 0x660: @@ -287,6 +292,9 @@ void EnBaba_HandleConversation(EnBaba* this, PlayState* play) { case 0x2A31: this->stateFlags |= BOMB_SHOP_LADY_STATE_END_CONVERSATION; break; + + default: + break; } Message_StartTextbox(play, this->textId, &this->actor); @@ -404,10 +412,6 @@ s32 EnBaba_ProcessScheduleOutput(EnBaba* this, PlayState* play, ScheduleOutput* s32 success; switch (scheduleOutput->result) { - default: - success = false; - break; - case BOMB_SHOP_LADY_SCH_FOLLOW_TIME_PATH: success = EnBaba_InitTimePath(this, play, scheduleOutput); break; @@ -415,7 +419,12 @@ s32 EnBaba_ProcessScheduleOutput(EnBaba* this, PlayState* play, ScheduleOutput* case BOMB_SHOP_LADY_SCH_KNOCKED_OVER: success = true; break; + + default: + success = false; + break; } + return success; } @@ -491,6 +500,9 @@ void EnBaba_HandleSchedule(EnBaba* this, PlayState* play) { Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, this->animIndex); this->actionFunc = EnBaba_KnockedOver; break; + + default: + break; } Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 4, 0x1554); } diff --git a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c index 45639f46fa..17eb5c9ef9 100644 --- a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c +++ b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.c @@ -159,7 +159,7 @@ void EnBaguo_Destroy(Actor* thisx, PlayState* play) { void EnBaguo_UndergroundIdle(EnBaguo* this, PlayState* play) { this->action = NEJIRON_ACTION_INACTIVE; - if (this->actor.xzDistToPlayer < 200.0f && Player_GetMask(play) != PLAYER_MASK_STONE) { + if ((this->actor.xzDistToPlayer < 200.0f) && (Player_GetMask(play) != PLAYER_MASK_STONE)) { this->actor.draw = EnBaguo_DrawBody; Actor_PlaySfx(&this->actor, NA_SE_EN_BAKUO_APPEAR); this->actor.world.rot.z = 0; @@ -247,7 +247,7 @@ void EnBaguo_Roll(EnBaguo* this, PlayState* play) { this->actionFunc = EnBaguo_Idle; this->actor.speed = 0.0f; } else { - if (!this->bouncedFlag && this->collider.base.atFlags & AT_BOUNCED) { + if (!this->bouncedFlag && (this->collider.base.atFlags & AT_BOUNCED)) { this->zRollDirection ^= 1; this->bouncedFlag = 1; this->actor.speed = -7.0f; @@ -318,7 +318,7 @@ void EnBaguo_CheckForDetonation(EnBaguo* this, PlayState* play) { i = false; if (this->action != NEJIRON_ACTION_EXPLODING && this->action != NEJIRON_ACTION_RETREATING) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && - this->actor.world.pos.y < (this->actor.home.pos.y - 100.0f)) { + (this->actor.world.pos.y < (this->actor.home.pos.y - 100.0f))) { // Force a detonation if we're off the ground and have fallen // below our home position (e.g., we rolled off a ledge). i = true; @@ -328,9 +328,9 @@ void EnBaguo_CheckForDetonation(EnBaguo* this, PlayState* play) { // Force a detonation if we're too far below the water's surface. i = true; } - if ((this->collider.base.acFlags & AC_HIT || i)) { + if ((this->collider.base.acFlags & AC_HIT) || i) { this->collider.base.acFlags &= ~AC_HIT; - if (i || this->actor.colChkInfo.damageEffect == NEJIRON_DMGEFF_KILL) { + if (i || (this->actor.colChkInfo.damageEffect == NEJIRON_DMGEFF_KILL)) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); this->action = NEJIRON_ACTION_EXPLODING; this->actor.speed = 0.0f; @@ -376,7 +376,7 @@ void EnBaguo_Update(Actor* thisx, PlayState* play) { DECR(this->blinkTimer); DECR(this->timer); - if (this->action != NEJIRON_ACTION_EXPLODING && this->action != NEJIRON_ACTION_INACTIVE) { + if ((this->action != NEJIRON_ACTION_EXPLODING) && (this->action != NEJIRON_ACTION_INACTIVE)) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } @@ -450,9 +450,9 @@ void EnBaguo_InitializeEffect(EnBaguo* this, Vec3f* pos, Vec3f* velocity, Vec3f* effect->accel = *accel; effect->scale = scale; effect->timer = timer; - effect->rotation.x = (s16)(s32)Rand_CenteredFloat(0x7530); - effect->rotation.y = (s16)(s32)Rand_CenteredFloat(0x7530); - effect->rotation.z = (s16)(s32)Rand_CenteredFloat(0x7530); + effect->rot.x = (s16)(s32)Rand_CenteredFloat(0x7530); + effect->rot.y = (s16)(s32)Rand_CenteredFloat(0x7530); + effect->rot.z = (s16)(s32)Rand_CenteredFloat(0x7530); return; } } @@ -467,9 +467,9 @@ void EnBaguo_UpdateEffects(EnBaguo* this, PlayState* play) { effect->pos.x += effect->velocity.x; effect->pos.y += effect->velocity.y; effect->pos.z += effect->velocity.z; - effect->rotation.x += 0xBB8; - effect->rotation.y += 0xBB8; - effect->rotation.z += 0xBB8; + effect->rot.x += 0xBB8; + effect->rot.y += 0xBB8; + effect->rot.z += 0xBB8; effect->velocity.x += effect->accel.x; effect->velocity.y += effect->accel.y; effect->velocity.z += effect->accel.z; @@ -501,9 +501,9 @@ void EnBaguo_DrawEffects(EnBaguo* this, PlayState* play) { for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { if (effect->isEnabled) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); - Matrix_RotateXS(effect->rotation.x, MTXMODE_APPLY); - Matrix_RotateYS(effect->rotation.y, MTXMODE_APPLY); - Matrix_RotateZS(effect->rotation.z, MTXMODE_APPLY); + Matrix_RotateXS(effect->rot.x, MTXMODE_APPLY); + Matrix_RotateYS(effect->rot.y, MTXMODE_APPLY); + Matrix_RotateZS(effect->rot.z, MTXMODE_APPLY); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.h b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.h index d6eb2173c9..132095bd17 100644 --- a/src/overlays/actors/ovl_En_Baguo/z_en_baguo.h +++ b/src/overlays/actors/ovl_En_Baguo/z_en_baguo.h @@ -17,7 +17,7 @@ typedef struct NejironEffect { /* 0x04 */ Vec3f pos; /* 0x10 */ Vec3f velocity; /* 0x1C */ Vec3f accel; - /* 0x28 */ Vec3s rotation; + /* 0x28 */ Vec3s rot; /* 0x30 */ f32 scale; /* 0x34 */ s16 timer; } NejironEffect; // size = 0x38 diff --git a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c index 7ff5da288d..606c880d3e 100644 --- a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c +++ b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.c @@ -57,16 +57,31 @@ static ColliderCylinderInit sCylinderInit = { static u16 sTextIds[] = { 0x2ABD, 0x2ABB, 0x2AD5, 0x2AD6, 0x2AD7, 0x2AD8, 0x2AC6 }; -static AnimationHeader* sAnimations[] = { &object_bai_Anim_0011C0, &object_bai_Anim_0008B4, &object_bai_Anim_008198 }; +typedef enum { + /* 0 */ ENBAISEN_ANIM_0, + /* 1 */ ENBAISEN_ANIM_1, + /* 2 */ ENBAISEN_ANIM_2, + /* 3 */ ENBAISEN_ANIM_MAX +} EnBaisenAnimation; -static u8 sAnimationModes[] = { ANIMMODE_LOOP, ANIMMODE_LOOP }; +static AnimationHeader* sAnimations[ENBAISEN_ANIM_MAX] = { + &object_bai_Anim_0011C0, // ENBAISEN_ANIM_0 + &object_bai_Anim_0008B4, // ENBAISEN_ANIM_1 + &object_bai_Anim_008198, // ENBAISEN_ANIM_2 +}; + +static u8 sAnimationModes[ENBAISEN_ANIM_MAX] = { + ANIMMODE_LOOP, // ENBAISEN_ANIM_0 + ANIMMODE_LOOP, // ENBAISEN_ANIM_1 + ANIMMODE_LOOP, // ENBAISEN_ANIM_2 +}; void EnBaisen_Init(Actor* thisx, PlayState* play) { EnBaisen* this = THIS; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_bai_Skel_007908, &object_bai_Anim_0011C0, this->jointTable, - this->morphTable, 20); + this->morphTable, OBJECT_BAI_LIMB_MAX); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->paramCopy = this->actor.params; if (this->actor.params == 0) { @@ -100,8 +115,8 @@ void EnBaisen_Destroy(Actor* thisx, PlayState* play) { void EnBaisen_ChangeAnim(EnBaisen* this, s32 animIndex) { this->animIndex = animIndex; - this->frameCount = Animation_GetLastFrame(sAnimations[animIndex]); - Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->frameCount, + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame, sAnimationModes[this->animIndex], -10.0f); } @@ -136,10 +151,10 @@ void func_80BE87B0(EnBaisen* this, PlayState* play) { void func_80BE87FC(EnBaisen* this) { if (this->paramCopy == 0) { this->textIdIndex = 2; - EnBaisen_ChangeAnim(this, 2); + EnBaisen_ChangeAnim(this, ENBAISEN_ANIM_2); this->unk29E = this->actor.world.rot.y; } else { - EnBaisen_ChangeAnim(this, 0); + EnBaisen_ChangeAnim(this, ENBAISEN_ANIM_0); } this->actor.textId = sTextIds[this->textIdIndex]; @@ -187,13 +202,13 @@ void func_80BE895C(EnBaisen* this, PlayState* play) { void func_80BE89D8(EnBaisen* this, PlayState* play) { if (&this->actor == this->unk2A4) { this->unk29E = this->actor.world.rot.y; - if (this->animIndex == 0) { - EnBaisen_ChangeAnim(this, 1); + if (this->animIndex == ENBAISEN_ANIM_0) { + EnBaisen_ChangeAnim(this, ENBAISEN_ANIM_1); } } else { this->unk29E = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk2A4->world.pos); - if (this->animIndex != 0) { - EnBaisen_ChangeAnim(this, 0); + if (this->animIndex != ENBAISEN_ANIM_0) { + EnBaisen_ChangeAnim(this, ENBAISEN_ANIM_0); } } if ((play->msgCtx.currentTextId == 0x2AC6) || (play->msgCtx.currentTextId == 0x2AC7) || @@ -209,15 +224,15 @@ void func_80BE89D8(EnBaisen* this, PlayState* play) { void func_80BE8AAC(EnBaisen* this, PlayState* play) { if ((this->textIdIndex % 2) != 0) { this->unk29E = this->actor.world.rot.y; - if (this->animIndex == 0) { - EnBaisen_ChangeAnim(this, 1); + if (this->animIndex == ENBAISEN_ANIM_0) { + EnBaisen_ChangeAnim(this, ENBAISEN_ANIM_1); } } else { if (this->unk2A4 != NULL) { this->unk29E = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk2A4->world.pos); } - if (this->animIndex != 0) { - EnBaisen_ChangeAnim(this, 0); + if (this->animIndex != ENBAISEN_ANIM_0) { + EnBaisen_ChangeAnim(this, ENBAISEN_ANIM_0); } } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { @@ -269,7 +284,7 @@ void EnBaisen_Update(Actor* thisx, PlayState* play) { s32 EnBaisen_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBaisen* this = THIS; - if (limbIndex == 9) { + if (limbIndex == OBJECT_BAI_LIMB_09) { rot->x += this->headRotX; rot->y += this->headRotY; rot->z += this->headRotZ; diff --git a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.h b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.h index 4c0ced24f5..25e747e381 100644 --- a/src/overlays/actors/ovl_En_Baisen/z_en_baisen.h +++ b/src/overlays/actors/ovl_En_Baisen/z_en_baisen.h @@ -2,6 +2,7 @@ #define Z_EN_BAISEN_H #include "global.h" +#include "objects/object_bai/object_bai.h" struct EnBaisen; @@ -10,8 +11,8 @@ typedef void (*EnBaisenActionFunc)(struct EnBaisen*, PlayState*); typedef struct EnBaisen { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[20]; - /* 0x200 */ Vec3s morphTable[20]; + /* 0x188 */ Vec3s jointTable[OBJECT_BAI_LIMB_MAX]; + /* 0x200 */ Vec3s morphTable[OBJECT_BAI_LIMB_MAX]; /* 0x278 */ EnBaisenActionFunc actionFunc; /* 0x27C */ s16 headRotY; /* 0x27E */ s16 headRotX; @@ -22,7 +23,7 @@ typedef struct EnBaisen { /* 0x28C */ s32 paramCopy; /* 0x290 */ s32 unk290; /* 0x294 */ s16 unusedCounter; - /* 0x298 */ f32 frameCount; + /* 0x298 */ f32 animEndFrame; /* 0x29C */ s16 unk29C; /* 0x29E */ s16 unk29E; /* 0x2A0 */ s16 textIdIndex; diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index 40e83dd4c4..f6e2eb5d5c 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -124,7 +124,7 @@ static InitChainEntry sInitChain[] = { * in the bodyPartsPos/Velocity arrays. An index of -1 indicates that the * limb is not part of the bodyParts arrays. */ -static s8 sLimbIndexToBodyPartsIndex[] = { +static s8 sLimbIndexToBodyPartsIndex[BUBBLE_LIMB_MAX] = { -1, -1, -1, -1, 0, -1, -1, -1, 1, -1, -1, -1, -1, 2, -1, 3, }; @@ -554,27 +554,25 @@ void EnBb_UpdateDamage(EnBb* this, PlayState* play) { CLEAR_TAG_PARAMS(CLEAR_TAG_SMALL_LIGHT_RAYS)); } } - } else { - if (this->collider.base.atFlags & AT_BOUNCED) { - this->collider.base.atFlags &= ~(AT_HIT | AT_BOUNCED); - if (this->actionFunc != EnBb_Down) { - this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; - this->actor.shape.rot.y = this->actor.world.rot.y; - EnBb_SetupDown(this); - } - } else if (this->collider.base.atFlags & AT_HIT) { - this->collider.base.atFlags &= ~AT_HIT; + } else if (this->collider.base.atFlags & AT_BOUNCED) { + this->collider.base.atFlags &= ~(AT_HIT | AT_BOUNCED); + if (this->actionFunc != EnBb_Down) { this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; this->actor.shape.rot.y = this->actor.world.rot.y; - Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_BITE); + EnBb_SetupDown(this); + } + } else if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~AT_HIT; + this->actor.world.rot.y = this->actor.yawTowardsPlayer + 0x8000; + this->actor.shape.rot.y = this->actor.world.rot.y; + Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_BITE); - if (this->flameScaleX > 0.0f) { - gSaveContext.jinxTimer = 1200; - } + if (this->flameScaleX > 0.0f) { + gSaveContext.jinxTimer = 1200; + } - if (this->actionFunc == EnBb_Attack) { - EnBb_SetupFlyIdle(this); - } + if (this->actionFunc == EnBb_Attack) { + EnBb_SetupFlyIdle(this); } } } diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c index 297445c66d..b8e42ff66c 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c @@ -205,6 +205,9 @@ void EnBba01_Talk(EnHy* this, PlayState* play) { this->actionFunc = this->prevActionFunc; this->prevActionFunc = NULL; break; + + default: + break; } } diff --git a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c index 9778bd7852..d9fb276c5d 100644 --- a/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c +++ b/src/overlays/actors/ovl_En_Bbfall/z_en_bbfall.c @@ -153,7 +153,7 @@ static InitChainEntry sInitChain[] = { * in the bodyPartsPos/Velocity arrays. An index of -1 indicates that the * limb is not part of the bodyParts arrays. */ -static s8 sLimbIndexToBodyPartsIndex[] = { +static s8 sLimbIndexToBodyPartsIndex[BUBBLE_LIMB_MAX] = { -1, -1, -1, -1, 0, -1, -1, -1, 1, -1, -1, -1, -1, 2, -1, 3, }; diff --git a/src/overlays/actors/ovl_En_Bee/z_en_bee.c b/src/overlays/actors/ovl_En_Bee/z_en_bee.c index 1c2d1ed0f0..0e8727c457 100644 --- a/src/overlays/actors/ovl_En_Bee/z_en_bee.c +++ b/src/overlays/actors/ovl_En_Bee/z_en_bee.c @@ -94,7 +94,7 @@ void EnBee_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = 10; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); - SkelAnime_Init(play, &this->skelAnime, &gBeeSkel, &gBeeFlyingAnim, this->morphTable, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gBeeSkel, &gBeeFlyingAnim, this->jointTable, this->morphTable, OBJECT_BEE_LIMB_MAX); this->actor.colChkInfo.health = 1; this->actor.colChkInfo.damageTable = &sDamageTable; @@ -123,7 +123,8 @@ void EnBee_SetupFlyIdle(EnBee* this) { Vec3f tempPos; s16 yawOffset; - Animation_Change(&this->skelAnime, &gBeeFlyingAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBeeFlyingAnim), 0, -10.0f); + Animation_Change(&this->skelAnime, &gBeeFlyingAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBeeFlyingAnim), + ANIMMODE_LOOP, -10.0f); Math_Vec3f_Copy(&tempPos, &this->actor.home.pos); yawOffset = (this->instanceId * 0x700) + 0x2000; @@ -181,7 +182,8 @@ void EnBee_FlyIdle(EnBee* this, PlayState* play) { } void EnBee_SetupAttack(EnBee* this) { - Animation_Change(&this->skelAnime, &gBeeFlyingAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBeeFlyingAnim), 0, -10.0f); + Animation_Change(&this->skelAnime, &gBeeFlyingAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gBeeFlyingAnim), + ANIMMODE_LOOP, -10.0f); this->isHostile = true; this->actionFunc = EnBee_Attack; } diff --git a/src/overlays/actors/ovl_En_Bee/z_en_bee.h b/src/overlays/actors/ovl_En_Bee/z_en_bee.h index b1773a5ca6..5266ca4444 100644 --- a/src/overlays/actors/ovl_En_Bee/z_en_bee.h +++ b/src/overlays/actors/ovl_En_Bee/z_en_bee.h @@ -16,8 +16,8 @@ typedef enum { typedef struct EnBee { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s morphTable[OBJECT_BEE_LIMB_MAX]; - /* 0x1C4 */ Vec3s jointTable[OBJECT_BEE_LIMB_MAX]; + /* 0x188 */ Vec3s jointTable[OBJECT_BEE_LIMB_MAX]; + /* 0x1C4 */ Vec3s morphTable[OBJECT_BEE_LIMB_MAX]; /* 0x200 */ EnBeeActionFunc actionFunc; /* 0x204 */ s16 attackDelayTimer; /* 0x206 */ s16 sfxHitTimer; diff --git a/src/overlays/actors/ovl_En_Bh/z_en_bh.c b/src/overlays/actors/ovl_En_Bh/z_en_bh.c index f73657d4d0..9e5641aad3 100644 --- a/src/overlays/actors/ovl_En_Bh/z_en_bh.c +++ b/src/overlays/actors/ovl_En_Bh/z_en_bh.c @@ -34,9 +34,9 @@ void EnBh_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_1; Actor_SetScale(&this->actor, 0.01f); - SkelAnime_InitFlex(play, &this->skelanime, &gBhSkel, &gBhFlyingAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gBhSkel, &gBhFlyingAnim, this->jointTable, this->morphTable, OBJECT_BH_LIMB_MAX); - Animation_PlayLoop(&this->skelanime, &gBhFlyingAnim); + Animation_PlayLoop(&this->skelAnime, &gBhFlyingAnim); this->actionFunc = func_80C22DEC; } @@ -80,17 +80,17 @@ void func_80C22DEC(EnBh* this, PlayState* play) { Math_ApproachS(&this->actor.world.rot.z, -zRot, 0xA, this->step); Math_ApproachS(&this->step, 0x200, 1, 0x10); - if ((s32)this->skelanime.playSpeed == 0) { + if ((s32)this->skelAnime.playSpeed == 0) { if (this->timer == 0) { - this->skelanime.playSpeed = 1.0f; + this->skelAnime.playSpeed = 1.0f; this->timer = Rand_ZeroFloat(70.0f) + 50.0f; } else if (((this->timer & 7) == 7) && (Rand_ZeroOne() < 0.5f)) { this->unk1E4 = Rand_CenteredFloat(3000.0f); } } else { - SkelAnime_Update(&this->skelanime); - if ((this->timer == 0) && Animation_OnFrame(&this->skelanime, 6.0f)) { - this->skelanime.playSpeed = 0.0f; + SkelAnime_Update(&this->skelAnime); + if ((this->timer == 0) && Animation_OnFrame(&this->skelAnime, 6.0f)) { + this->skelAnime.playSpeed = 0.0f; this->timer = Rand_ZeroFloat(50.0f) + 50.0f; } } @@ -116,6 +116,6 @@ void EnBh_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL25_Opa(play->state.gfxCtx); Matrix_RotateZS(this->unk1E2, MTXMODE_APPLY); - SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, NULL, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, &this->actor); } diff --git a/src/overlays/actors/ovl_En_Bh/z_en_bh.h b/src/overlays/actors/ovl_En_Bh/z_en_bh.h index a3c88fb589..9876182f05 100644 --- a/src/overlays/actors/ovl_En_Bh/z_en_bh.h +++ b/src/overlays/actors/ovl_En_Bh/z_en_bh.h @@ -10,7 +10,7 @@ typedef void (*EnBhActionFunc)(struct EnBh*, PlayState*); typedef struct EnBh { /* 0x000 */ Actor actor; - /* 0x144 */ SkelAnime skelanime; + /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ Vec3s jointTable[OBJECT_BH_LIMB_MAX]; /* 0x1AC */ Vec3s morphTable[OBJECT_BH_LIMB_MAX]; /* 0x1D0 */ Vec3f pos; diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 6088b541e3..0323e29c78 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -564,11 +564,11 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec EnBigokuta* this = THIS; s32 envColor; s16 rotX; - f32 lastFrame; + f32 endFrame; if (this->actionFunc == EnBigokuta_PlayDeathEffects) { - lastFrame = Animation_GetLastFrame(&gBigOctoDeathAnim); - envColor = ((255.0f / lastFrame) * (lastFrame - this->skelAnime.curFrame)); + endFrame = Animation_GetLastFrame(&gBigOctoDeathAnim); + envColor = ((255.0f / endFrame) * (endFrame - this->skelAnime.curFrame)); } else { envColor = 255; } @@ -628,7 +628,7 @@ s32 EnBigokuta_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec } void EnBigokuta_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { - static s8 D_80AC45BC[] = { + static s8 D_80AC45BC[BIGOKUTA_LIMB_MAX] = { -1, -1, -1, 0, -1, 1, -1, 2, -1, 3, 8, 4, -1, 5, -1, -1, -1, -1, 6, 7, }; static Vec3f D_80AC45D0[] = { diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index b1e08cd7e5..4752db039a 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -161,7 +161,7 @@ static InitChainEntry sInitChain[] = { static Vec3f D_80B6506C = { 0.0f, 3.0f, 0.0f }; // bytes per limb, used in draw func? bit over my head -static u8 D_80B65078[] = { +static u8 D_80B65078[BIG_POE_LIMB_MAX] = { -1, 4, -1, 0, -1, 1, -1, 2, 5, 3, }; @@ -180,9 +180,9 @@ void EnBigpo_Init(Actor* thisx, PlayState* play2) { Actor_ProcessInitChain(&this->actor, sInitChain); - this->switchFlags = BIGPO_GET_SWITCHFLAGS(thisx); + this->switchFlags = BIG_POE_GET_SWITCHFLAGS(thisx); thisx->params &= 0xFF; - if (thisx->params == ENBIGPO_POSSIBLEFIRE) { + if (thisx->params == BIG_POE_TYPE_POSSIBLE_FIRE) { if (Flags_GetSwitch(play, this->switchFlags)) { Actor_Kill(&this->actor); return; @@ -193,8 +193,8 @@ void EnBigpo_Init(Actor* thisx, PlayState* play2) { return; } - SkelAnime_Init(play, &this->skelAnime, &gBigpoSkeleton, &gBigpoFloatAnim, this->jointTable, this->morphTable, - ENBIGPO_LIMBCOUNT); + SkelAnime_Init(play, &this->skelAnime, &gBigPoeSkeleton, &gBigPoeFloatAnim, this->jointTable, this->morphTable, + BIG_POE_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); @@ -218,11 +218,11 @@ void EnBigpo_Init(Actor* thisx, PlayState* play2) { Actor_Kill(&this->actor); } - if (thisx->params == ENBIGPO_REGULAR) { // the well poe, starts immediately - thisx->flags &= ~ACTOR_FLAG_10; // always update OFF + if (thisx->params == BIG_POE_TYPE_REGULAR) { // the well poe, starts immediately + thisx->flags &= ~ACTOR_FLAG_10; // always update OFF this->storePrevBgm = true; EnBigpo_InitWellBigpo(this); - } else if (thisx->params == ENBIGPO_SUMMONED) { // dampe type + } else if (thisx->params == BIG_POE_TYPE_SUMMONED) { // dampe type EnBigpo_InitDampeMainPo(this); } } @@ -232,10 +232,9 @@ void EnBigpo_Destroy(Actor* thisx, PlayState* play2) { EnBigpo* this = THIS; s32 fireCount; - if ((this->actor.params != ENBIGPO_POSSIBLEFIRE) && (this->actor.params != ENBIGPO_CHOSENFIRE) && - (this->actor.params != ENBIGPO_REVEALEDFIRE) && (this->actor.params != ENBIGPO_UNK5)) { - // if NOT a fire type, *ENBIGPO_REGULAR and ENBIGPO_SUMMONED (combat types only) - if (1) {} + if ((thisx->params != BIG_POE_TYPE_POSSIBLE_FIRE) && (thisx->params != BIG_POE_TYPE_CHOSEN_FIRE) && + (thisx->params != BIG_POE_TYPE_REVEALED_FIRE) && (thisx->params != BIG_POE_TYPE_UNK5)) { + // if NOT a fire type, *BIG_POE_TYPE_REGULAR and BIG_POE_TYPE_SUMMONED (combat types only) for (fireCount = 0; fireCount < ARRAY_COUNT(this->fires); fireCount++) { LightContext_RemoveLight(play, &play->lightCtx, this->fires[fireCount].light); } @@ -303,9 +302,9 @@ void EnBigpo_WaitCutsceneQueue(EnBigpo* this, PlayState* play) { CutsceneManager_Start(this->actor.csId, &this->actor); func_800B724C(play, &this->actor, PLAYER_CSMODE_WAIT); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId); - if (this->actor.params == ENBIGPO_REGULAR) { // and SUMMONED, got switched earlier + if (this->actor.params == BIG_POE_TYPE_REGULAR) { // and SUMMONED, got switched earlier EnBigpo_SpawnCutsceneStage1(this, play); - } else { // ENBIGPO_REVEALEDFIRE + } else { // BIG_POE_TYPE_REVEALED_FIRE EnBigpo_SetupFlameCirclePositions(this, play); } } else { @@ -392,7 +391,7 @@ void EnBigpo_SpawnCutsceneStage4(EnBigpo* this, PlayState* play) { * big poe starts to visibly appear */ void EnBigpo_SpawnCutsceneStage5(EnBigpo* this) { - Animation_PlayLoop(&this->skelAnime, &gBigpoAwakenStretchAnim); + Animation_PlayLoop(&this->skelAnime, &gBigPoeAwakenStretchAnim); this->actor.draw = EnBigpo_DrawMainBigpo; Actor_SetScale(&this->actor, 0.014f); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_APPEAR); @@ -460,7 +459,7 @@ void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, PlayState* play) { subCam = Play_GetCamera(play, this->subCamId); Play_SetCameraAtEye(play, CAM_ID_MAIN, &subCam->at, &subCam->eye); this->subCamId = SUB_CAM_ID_DONE; - if (this->actor.params == ENBIGPO_SUMMONED) { + if (this->actor.params == BIG_POE_TYPE_SUMMONED) { dampe = SubS_FindActor(play, NULL, ACTORCAT_NPC, ACTOR_EN_TK); if (dampe != NULL) { // if dampe exists, switch to viewing his running away cutscene @@ -468,7 +467,7 @@ void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, PlayState* play) { } else { CutsceneManager_Stop(this->actor.csId); } - } else { // ENBIGPO_REGULAR + } else { // BIG_POE_TYPE_REGULAR CutsceneManager_Stop(this->actor.csId); } func_800B724C(play, &this->actor, PLAYER_CSMODE_END); @@ -506,7 +505,7 @@ void EnBigpo_SetupWarpIn(EnBigpo* this, PlayState* play) { s16 randomYaw = ((s32)Rand_Next() >> 0x14) + this->actor.yawTowardsPlayer; Actor_PlaySfx(&this->actor, NA_SE_EN_STALKIDS_APPEAR); - Animation_PlayLoop(&this->skelAnime, &gBigpoAwakenStretchAnim); + Animation_PlayLoop(&this->skelAnime, &gBigPoeAwakenStretchAnim); this->rotVelocity = 0x2000; this->actor.world.pos.x = (Math_SinS(randomYaw) * distance) + player->actor.world.pos.x; this->actor.world.pos.z = (Math_CosS(randomYaw) * distance) + player->actor.world.pos.z; @@ -533,7 +532,7 @@ void EnBigpo_WarpingIn(EnBigpo* this, PlayState* play) { } void EnBigpo_SetupIdleFlying(EnBigpo* this) { - Animation_MorphToLoop(&this->skelAnime, &gBigpoFloatAnim, -5.0f); + Animation_MorphToLoop(&this->skelAnime, &gBigPoeFloatAnim, -5.0f); // if poe missed attack, idle 4 seconds, otherwise its reappearing: attack immediately this->idleTimer = (this->actionFunc == EnBigpo_SpinningDown) ? 80 : 0; this->hoverHeightCycleTimer = 40; @@ -644,7 +643,7 @@ void EnBigpo_SpinningDown(EnBigpo* this, PlayState* play) { * called by EnBigpo_ApplyDamage */ void EnBigpo_HitStun(EnBigpo* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gBigpoShockAnim, -6.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gBigPoeShockAnim, -6.0f); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 16); this->collider.base.acFlags &= ~AC_ON; func_800BE504(&this->actor, &this->collider); @@ -754,7 +753,7 @@ void EnBigpo_LanternFalling(EnBigpo* this, PlayState* play) { } EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, 6.0f, 0, 1, 1, 15, OBJECT_BIGPO, 10, - gBigpoDrawLanternFallingDL); + gBigPoeLanternFallingDL); EnBigpo_SpawnScoopSoul(this); } } @@ -860,7 +859,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, PlayState* play) { // count the number of possible fires we can find (4 in vanilla) for (enemyPtr = GET_FIRST_ENEMY(play); enemyPtr != NULL; enemyPtr = enemyPtr->next) { - if ((enemyPtr->id == ACTOR_EN_BIGPO) && (enemyPtr->params == ENBIGPO_POSSIBLEFIRE)) { + if ((enemyPtr->id == ACTOR_EN_BIGPO) && (enemyPtr->params == BIG_POE_TYPE_POSSIBLE_FIRE)) { fireCount++; } } @@ -881,10 +880,10 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, PlayState* play) { randomIndex = ((s32)Rand_ZeroFloat(fireCount)) % fireCount; while (enemyPtr != NULL) { - if ((enemyPtr->id == ACTOR_EN_BIGPO) && (enemyPtr->params == ENBIGPO_POSSIBLEFIRE)) { + if ((enemyPtr->id == ACTOR_EN_BIGPO) && (enemyPtr->params == BIG_POE_TYPE_POSSIBLE_FIRE)) { if (randomIndex == 0) { randomFirePo = (EnBigpo*)enemyPtr; - randomFirePo->actor.params = ENBIGPO_CHOSENFIRE; + randomFirePo->actor.params = BIG_POE_TYPE_CHOSEN_FIRE; Math_Vec3f_Copy(&this->fires[fireIndex].pos, &randomFirePo->actor.world.pos); randomFirePo->actor.parent = (Actor*)this; randomFirePo->actor.update = EnBigpo_UpdateFire; @@ -901,9 +900,9 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, PlayState* play) { this->actor.child = &randomFirePo->actor; } break; - } else { - randomIndex--; } + + randomIndex--; } enemyPtr = enemyPtr->next; } @@ -911,7 +910,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, PlayState* play) { // remove unused fires for (enemyPtr = GET_FIRST_ENEMY(play); enemyPtr != NULL; enemyPtr = enemyPtr->next) { - if (enemyPtr->id == ACTOR_EN_BIGPO && enemyPtr->params == ENBIGPO_POSSIBLEFIRE) { + if ((enemyPtr->id == ACTOR_EN_BIGPO) && (enemyPtr->params == BIG_POE_TYPE_POSSIBLE_FIRE)) { randomFirePo = (EnBigpo*)enemyPtr; randomFirePo->actionFunc = EnBigpo_Die; randomFirePo->actor.update = EnBigpo_UpdateFire; @@ -934,7 +933,7 @@ void EnBigpo_FireCounting(EnBigpo* this, PlayState* play) { s32 activatedFireCount = 0; for (firePo = (EnBigpo*)this->actor.child; firePo; firePo = (EnBigpo*)firePo->actor.child) { - if (firePo->actor.params == ENBIGPO_REVEALEDFIRE && firePo->actionFunc == EnBigpo_RevealedFireIdle) { + if ((firePo->actor.params == BIG_POE_TYPE_REVEALED_FIRE) && (firePo->actionFunc == EnBigpo_RevealedFireIdle)) { activatedFireCount++; } } @@ -973,10 +972,10 @@ void EnBigpo_InitHiddenFire(EnBigpo* this) { /* * idle until dampe finds this file by - * changing this file params from ENBIGPO_POSSIBLEFIRE into ENBIGPO_REVEALEDFIRE + * changing this file params from BIG_POE_TYPE_POSSIBLE_FIRE into BIG_POE_TYPE_REVEALED_FIRE */ void EnBigpo_WaitingForDampe(EnBigpo* this, PlayState* play) { - if (this->actor.params == ENBIGPO_REVEALEDFIRE) { + if (this->actor.params == BIG_POE_TYPE_REVEALED_FIRE) { EnBigpo_SetupFireRevealed(this); } } @@ -1011,11 +1010,11 @@ void EnBigpo_RevealedFireIdle(EnBigpo* this, PlayState* play) { if (this->idleTimer > 0) { if (this->idleTimer == 0) { //! @bug: unreachable code - this->actor.params = ENBIGPO_UNK5; + this->actor.params = BIG_POE_TYPE_UNK5; } } else { if (Math_StepToF(&this->actor.scale.x, 0.0f, 0.001f)) { - this->actor.params = ENBIGPO_CHOSENFIRE; + this->actor.params = BIG_POE_TYPE_CHOSEN_FIRE; EnBigpo_InitHiddenFire(this); } this->actor.scale.z = this->actor.scale.x; @@ -1124,7 +1123,7 @@ s32 EnBigpo_ApplyDamage(EnBigpo* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_1; // targetable OFF Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DEAD); Enemy_StartFinishingBlow(play, &this->actor); - if (this->actor.params == ENBIGPO_SUMMONED) { // dampe type + if (this->actor.params == BIG_POE_TYPE_SUMMONED) { // dampe type Audio_RestorePrevBgm(); } } else { @@ -1205,7 +1204,7 @@ void EnBigpo_Update(Actor* thisx, PlayState* play) { this->drawDmgEffAlpha = this->mainColor.a * (1.0f / 255.0f); } } - this->drawDmgEffScale = ((this->drawDmgEffAlpha + 1.0f) * 0.5f); + this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.5f; this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 1.0f); } } @@ -1224,7 +1223,7 @@ s32 EnBigpo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* Gfx** gfx) { EnBigpo* this = THIS; // not fully invisible - if ((this->mainColor.a == 0) || (limbIndex == 7) || + if ((this->mainColor.a == 0) || (limbIndex == BIG_POE_LIMB_LANTERN) || ((this->actionFunc == EnBigpo_BurnAwayDeath) && (this->idleTimer >= 2))) { *dList = NULL; } @@ -1241,12 +1240,13 @@ void EnBigpo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro OPEN_DISPS(play->state.gfxCtx); - if ((this->actionFunc == EnBigpo_BurnAwayDeath) && (this->idleTimer >= 2) && (limbIndex == 8)) { + if ((this->actionFunc == EnBigpo_BurnAwayDeath) && (this->idleTimer >= 2) && + (limbIndex == BIG_POE_LIMB_HAT_AND_CLOAK)) { gSPMatrix((*gfx)++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList((*gfx)++, &gBigpoDrawCrispyBodyDL); + gSPDisplayList((*gfx)++, &gBigPoeCrispyBodyDL); } - if (limbIndex == 7) { + if (limbIndex == BIG_POE_LIMB_LANTERN) { // we scale the vec3f... then do nothing with it? Matrix_MultVecY(1400.0f, &unusedVec); if ((this->actionFunc == EnBigpo_BurnAwayDeath) && (this->idleTimer > 18)) { @@ -1347,7 +1347,7 @@ void EnBigpo_DrawScoopSoul(Actor* thisx, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_XLU_DISP++, &gBigpoDrawSoulDL); + gSPDisplayList(POLY_XLU_DISP++, &gBigPoeSoulDL); CLOSE_DISPS(play->state.gfxCtx); } @@ -1393,9 +1393,9 @@ void EnBigpo_DrawLantern(Actor* thisx, PlayState* play) { gSPMatrix(&dispHead[3], Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(&dispHead[4], &gBigpoDrawLanternMainDL); + gSPDisplayList(&dispHead[4], &gBigPoeLanternMainDL); - gSPDisplayList(&dispHead[5], &gBigpoDrawLanternPurpleTopDL); + gSPDisplayList(&dispHead[5], &gBigPoeLanternPurpleTopDL); // fully transparent OR fully invisible if ((this->mainColor.a == 255) || (this->mainColor.a == 0)) { diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h index b532d6d089..d622abc0fb 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.h @@ -2,6 +2,7 @@ #define Z_EN_BIGPO_H #include "global.h" +#include "objects/object_bigpo/object_bigpo.h" struct EnBigpo; @@ -13,9 +14,6 @@ typedef struct EnBigpoFireEffect { /* 0x10 */ LightInfo info; // size 0xE } EnBigpoFireEffect; // size = 0x20 -#define ENBIGPO_LIMBCOUNT 10 - - // idleTimer gets reused: // * after dampe reveals a fire, 8 minutes of frames before it goes away again // * used by flames and regular bigpo to count frames during the appearance cutscene @@ -27,8 +25,8 @@ typedef struct EnBigpoFireEffect { typedef struct EnBigpo { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[ENBIGPO_LIMBCOUNT]; - /* 0x1C4 */ Vec3s morphTable[ENBIGPO_LIMBCOUNT]; + /* 0x188 */ Vec3s jointTable[BIG_POE_LIMB_MAX]; + /* 0x1C4 */ Vec3s morphTable[BIG_POE_LIMB_MAX]; /* 0x200 */ EnBigPoActionFunc actionFunc; /* 0x204 */ u8 storePrevBgm; /* 0x206 */ s16 idleTimer; // frame counter @@ -56,14 +54,14 @@ typedef struct EnBigpo { // well version is "regular" (spawns automatically), dampe basement version is "summoned" // on room enter, 3 "possiblefire" are turned into "chosenfire" at random typedef enum EnBigpoType { - /* 0 */ ENBIGPO_REGULAR, - /* 1 */ ENBIGPO_SUMMONED, - /* 2 */ ENBIGPO_POSSIBLEFIRE, - /* 3 */ ENBIGPO_CHOSENFIRE, - /* 4 */ ENBIGPO_REVEALEDFIRE, - /* 5 */ ENBIGPO_UNK5 + /* 0 */ BIG_POE_TYPE_REGULAR, + /* 1 */ BIG_POE_TYPE_SUMMONED, + /* 2 */ BIG_POE_TYPE_POSSIBLE_FIRE, + /* 3 */ BIG_POE_TYPE_CHOSEN_FIRE, + /* 4 */ BIG_POE_TYPE_REVEALED_FIRE, + /* 5 */ BIG_POE_TYPE_UNK5 } EnBigpoType; -#define BIGPO_GET_SWITCHFLAGS(thisx) (u8)((thisx)->params >> 0x8) +#define BIG_POE_GET_SWITCHFLAGS(thisx) (u8)((thisx)->params >> 0x8) #endif // Z_EN_BIGPO_H diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 1c68504dd5..43a48f2b2e 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -953,7 +953,7 @@ void EnBigslime_SetupCutsceneStartBattle(EnBigslime* this, PlayState* play) { } void EnBigslime_CutsceneStartBattle(EnBigslime* this, PlayState* play) { - if (this->isAnimUpdate) { + if (this->isAnimFinished) { EnBigslime_SetupCutsceneNoticePlayer(this); } else if (!this->isInitJump && Math_ScaledStepToS(&this->gekkoRot.y, this->actor.yawTowardsPlayer, 0x200)) { Animation_PlayOnce(&this->skelAnime, &gGekkoSurpriseJumpAnim); @@ -1004,7 +1004,7 @@ void EnBigslime_CallMinislime(EnBigslime* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_1; EnBigslime_SetupIdleNoticePlayer(this); } - } else if (this->isAnimUpdate) { + } else if (this->isAnimFinished) { Animation_PlayLoop(&this->skelAnime, &gGekkoNervousIdleAnim); EnBigslime_UpdateCameraIntroCs(this, play, 25); Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); @@ -1610,7 +1610,7 @@ void EnBigslime_AttackPlayerInBigslime(EnBigslime* this, PlayState* play) { EnBigslime_Scale(this, pitch, ((this->scaleFactor * 0.08f) + 0.2f) * 0.15f, ((this->scaleFactor * 0.08f) + 0.2f) * 0.05f); player->actor.world.pos.y = this->actor.world.pos.y + (this->actor.scale.y * -500.0f); - if (this->isAnimUpdate) { + if (this->isAnimFinished) { this->numGekkoMeleeAttacks--; if (this->numGekkoMeleeAttacks == 0) { this->numGekkoPosGrabPlayer--; @@ -2102,7 +2102,7 @@ void EnBigslime_IdleLookAround(EnBigslime* this, PlayState* play) { s16 yawDiff; this->idleTimer--; - if (this->isAnimUpdate) { + if (this->isAnimFinished) { if (Rand_ZeroOne() < 0.25f) { Animation_PlayOnce(&this->skelAnime, &gGekkoLookAroundAnim); } else { @@ -2138,7 +2138,7 @@ void EnBigslime_IdleNoticePlayer(EnBigslime* this, PlayState* play) { if (this->skelAnime.curFrame > 10.0f) { Math_ScaledStepToS(yaw, this->gekkoYaw, 0x800); } - if (this->isAnimUpdate) { + if (this->isAnimFinished) { EnBigslime_SetupJumpGekko(this); } } @@ -2159,7 +2159,7 @@ void EnBigslime_ThrowMinislime(EnBigslime* this, PlayState* play) { EnBigslime_GekkoSfxOutsideBigslime(this, NA_SE_EN_FROG_THROW_SLIME); this->minislimeToThrow->actor.params = MINISLIME_GEKKO_THROW; } - if (this->isAnimUpdate) { + if (this->isAnimFinished) { jumpTimerStored = this->jumpTimer; // Stores jumpTimer so it doesn't get overwritten back to 100 EnBigslime_SetupJumpGekko(this); this->jumpTimer = jumpTimerStored; @@ -2287,7 +2287,7 @@ void EnBigslime_FormBigslime(EnBigslime* this, PlayState* play) { Animation_PlayLoop(&this->skelAnime, &gGekkoSwimForwardAnim); this->formBigslimeCutsceneTimer--; Actor_PlaySfx(&this->actor, NA_SE_EN_B_SLIME_COMBINE); - } else if (this->isAnimUpdate) { + } else if (this->isAnimFinished) { this->formBigslimeCutsceneTimer--; if (this->formBigslimeCutsceneTimer == 0) { Animation_PlayLoop(&this->skelAnime, &gGekkoSwimUpAnim); @@ -2783,7 +2783,7 @@ void EnBigslime_UpdateBigslime(Actor* thisx, PlayState* play) { Audio_SetSfxUnderwaterReverb(true); this->dynamicVtxState ^= 1; EnBigslime_DynamicVtxCopyState(this); - this->isAnimUpdate = SkelAnime_Update(&this->skelAnime); + this->isAnimFinished = SkelAnime_Update(&this->skelAnime); if (this->actionFunc != EnBigslime_PlayCutscene) { EnBigslime_ApplyDamageEffectBigslime(this, play); } else { @@ -2826,7 +2826,7 @@ void EnBigslime_UpdateGekko(Actor* thisx, PlayState* play) { } Audio_SetSfxUnderwaterReverb(false); - this->isAnimUpdate = SkelAnime_Update(&this->skelAnime); + this->isAnimFinished = SkelAnime_Update(&this->skelAnime); if (this->actionFunc != EnBigslime_PlayCutscene) { EnBigslime_ApplyDamageEffectGekko(this, play); } else { diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h index 8f2b5bee31..2f7183e45e 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.h @@ -57,7 +57,7 @@ typedef struct EnBigslime { /* 0x0220 */ Vec3s morphTable[GEKKO_LIMB_MAX]; /* 0x02B0 */ u8 minislimeState; /* 0x02B1 */ u8 dynamicVtxState; // Toggles between two states of dynamic Vtx - /* 0x02B2 */ u8 isAnimUpdate; + /* 0x02B2 */ u8 isAnimFinished; /* 0x02B3 */ union { u8 formBigslimeTimer; // Bigslime will start forming when timer reaches 0 u8 minislimeCounter; diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index 01bf4a5224..8eb598c043 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -15,20 +15,15 @@ void EnBji01_Destroy(Actor* thisx, PlayState* play); void EnBji01_Update(Actor* thisx, PlayState* play); void EnBji01_Draw(Actor* thisx, PlayState* play); -void func_809CCE98(EnBji01* this, PlayState* play); void func_809CCEE8(EnBji01* this, PlayState* play); void func_809CD028(EnBji01* this, PlayState* play); void EnBji01_DialogueHandler(EnBji01* this, PlayState* play); -void func_809CCDE0(EnBji01* this, PlayState* play); void func_809CD634(EnBji01* this, PlayState* play); void EnBji01_DoNothing(EnBji01* this, PlayState* play); void func_809CD6C0(EnBji01* this, PlayState* play); void func_809CD70C(EnBji01* this, PlayState* play); void func_809CD77C(EnBji01* this, PlayState* play); -s32 EnBji01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx); -void EnBji01_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx); - ActorInit En_Bji_01_InitVars = { ACTOR_EN_BJI_01, ACTORCAT_NPC, @@ -61,12 +56,20 @@ static ColliderCylinderInit sCylinderInit = { { 18, 64, 0, { 0, 0, 0 } }, }; -/* Animations struct */ -static AnimationSpeedInfo sAnimationInfo[] = { - { &object_bji_Anim_000FDC, 1.0f, ANIMMODE_LOOP, 0.0f }, /* Looking through telescope */ - { &object_bji_Anim_005B58, 1.0f, ANIMMODE_LOOP, 10.0f }, /* Breathing? Unused? */ - { &object_bji_Anim_000AB0, 1.0f, ANIMMODE_LOOP, 0.0f }, /* Talking */ - { &object_bji_Anim_00066C, 1.0f, ANIMMODE_ONCE, -5.0f }, /* Scratching chin? */ +typedef enum { + /* -1 */ SHIKASHI_ANIM_NONE = -1, + /* 0 */ SHIKASHI_ANIM_LOOK_THROUGH_TELESCOPE, + /* 1 */ SHIKASHI_ANIM_BREATHE, + /* 2 */ SHIKASHI_ANIM_TALK, + /* 3 */ SHIKASHI_ANIM_SCRATCH_CHIN, + /* 4 */ SHIKASHI_ANIM_MAX +} ShikashiAnimation; + +static AnimationSpeedInfo sAnimationSpeedInfo[SHIKASHI_ANIM_MAX] = { + { &object_bji_Anim_000FDC, 1.0f, ANIMMODE_LOOP, 0.0f }, // SHIKASHI_ANIM_LOOK_THROUGH_TELESCOPE + { &object_bji_Anim_005B58, 1.0f, ANIMMODE_LOOP, 10.0f }, // SHIKASHI_ANIM_BREATHE + { &object_bji_Anim_000AB0, 1.0f, ANIMMODE_LOOP, 0.0f }, // SHIKASHI_ANIM_TALK + { &object_bji_Anim_00066C, 1.0f, ANIMMODE_ONCE, -5.0f }, // SHIKASHI_ANIM_SCRATCH_CHIN }; void func_809CCDE0(EnBji01* this, PlayState* play) { @@ -82,7 +85,8 @@ void func_809CCDE0(EnBji01* this, PlayState* play) { } void func_809CCE98(EnBji01* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 0, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, SHIKASHI_ANIM_LOOK_THROUGH_TELESCOPE, + &this->animIndex); this->actor.textId = 0; this->actionFunc = func_809CCEE8; } @@ -208,7 +212,7 @@ void func_809CD028(EnBji01* this, PlayState* play) { default: break; } - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 2, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, SHIKASHI_ANIM_TALK, &this->animIndex); this->actionFunc = EnBji01_DialogueHandler; } @@ -265,7 +269,8 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_10000; switch (play->msgCtx.currentTextId) { case 0x5DE: - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 3, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, + SHIKASHI_ANIM_SCRATCH_CHIN, &this->animIndex); Message_ContinueTextbox(play, 0x5DF); break; @@ -328,8 +333,8 @@ void EnBji01_DialogueHandler(EnBji01* this, PlayState* play) { default: break; } - if ((this->animIndex == 3) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 2, &this->animIndex); + if ((this->animIndex == SHIKASHI_ANIM_SCRATCH_CHIN) && (this->skelAnime.curFrame == this->skelAnime.endFrame)) { + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, SHIKASHI_ANIM_TALK, &this->animIndex); } } @@ -348,7 +353,7 @@ void EnBji01_DoNothing(EnBji01* this, PlayState* play) { } void func_809CD6C0(EnBji01* this, PlayState* play) { - SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationInfo, 2, &this->animIndex); + SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimationSpeedInfo, SHIKASHI_ANIM_TALK, &this->animIndex); this->actionFunc = func_809CD70C; } @@ -378,7 +383,7 @@ void EnBji01_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.targetMode = 0; this->actor.child = NULL; - this->animIndex = -1; + this->animIndex = SHIKASHI_ANIM_NONE; Actor_SetScale(&this->actor, 0.01f); SubS_FillCutscenesList(&this->actor, this->csIdList, ARRAY_COUNT(this->csIdList)); @@ -421,7 +426,8 @@ void EnBji01_Update(Actor* thisx, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->blinkTimer-- <= 0) { - if (--this->blinkSeqIndex < 0) { + this->blinkSeqIndex--; + if (this->blinkSeqIndex < 0) { this->blinkSeqIndex = 4; this->blinkTimer = (Rand_ZeroOne() * 60.0f) + 20.0f; } else { @@ -450,10 +456,14 @@ s32 EnBji01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* rot->x += this->torsoXRotStep; rot->z += this->torsoZRotStep; break; + case SHIKASHI_LIMB_HEAD: rot->x += this->headXRotStep; rot->z += this->headZRotStep; break; + + default: + break; } return false; } diff --git a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c index dbcd864b17..09f70d0690 100644 --- a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c +++ b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c @@ -87,16 +87,17 @@ typedef enum { /* 2 */ TOILET_HAND_ANIM_WAGGING_FINGER, // Wrong /* 3 */ TOILET_HAND_ANIM_THUMBS_UP, // Right /* 4 */ TOILET_HAND_ANIM_OPEN_HAND, - /* 5 */ TOILET_HAND_ANIM_FIST // i.e. holding the reward + /* 5 */ TOILET_HAND_ANIM_FIST, // i.e. holding the reward + /* 6 */ TOILET_HAND_ANIM_MAX } ToiletHandAnimation; -static AnimationInfoS sAnimationInfo[] = { - /* 0 */ { &gToiletHandWaitingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, - /* 1 */ { &gToiletHandWaitingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - /* 2 */ { &gToiletHandWaggingFingerAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - /* 3 */ { &gToiletHandThumbsUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - /* 4 */ { &gToiletHandOpenHandAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, - /* 5 */ { &gToiletHandFistAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, +static AnimationInfoS sAnimationInfo[TOILET_HAND_ANIM_MAX] = { + { &gToiletHandWaitingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // TOILET_HAND_ANIM_WAITING + { &gToiletHandWaitingAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // TOILET_HAND_ANIM_WAITING_MORPH + { &gToiletHandWaggingFingerAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // TOILET_HAND_ANIM_WAGGING_FINGER + { &gToiletHandThumbsUpAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // TOILET_HAND_ANIM_THUMBS_UP + { &gToiletHandOpenHandAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // TOILET_HAND_ANIM_OPEN_HAND + { &gToiletHandFistAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // TOILET_HAND_ANIM_FIST }; void EnBjt_UpdateSkelAnime(EnBjt* this) { @@ -106,7 +107,7 @@ void EnBjt_UpdateSkelAnime(EnBjt* this) { s32 EnBjt_ChangeAnim(EnBjt* this, s32 animIndex) { s32 changeAnim = false; - s32 changed = false; + s32 didAnimChange = false; if ((animIndex == TOILET_HAND_ANIM_WAITING) || (animIndex == TOILET_HAND_ANIM_WAITING_MORPH)) { if ((this->animIndex != TOILET_HAND_ANIM_WAITING) && (this->animIndex != TOILET_HAND_ANIM_WAITING_MORPH)) { @@ -118,11 +119,11 @@ s32 EnBjt_ChangeAnim(EnBjt* this, s32 animIndex) { if (changeAnim) { this->animIndex = animIndex; - changed = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); + didAnimChange = SubS_ChangeAnimationByInfoS(&this->skelAnime, sAnimationInfo, animIndex); this->animPlaySpeed = this->skelAnime.playSpeed; } - return changed; + return didAnimChange; } void EnBjt_UpdateCollision(EnBjt* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Boj_01/z_en_boj_01.c b/src/overlays/actors/ovl_En_Boj_01/z_en_boj_01.c index bd4b0e499e..1dc8270575 100644 --- a/src/overlays/actors/ovl_En_Boj_01/z_en_boj_01.c +++ b/src/overlays/actors/ovl_En_Boj_01/z_en_boj_01.c @@ -29,9 +29,12 @@ ActorInit En_Boj_01_InitVars = { void EnBoj01_Init(Actor* thisx, PlayState* play) { } + void EnBoj01_Destroy(Actor* thisx, PlayState* play) { } + void EnBoj01_Update(Actor* thisx, PlayState* play) { } + void EnBoj01_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Boj_02/z_en_boj_02.c b/src/overlays/actors/ovl_En_Boj_02/z_en_boj_02.c index 89f6ba0cb6..c5cff183aa 100644 --- a/src/overlays/actors/ovl_En_Boj_02/z_en_boj_02.c +++ b/src/overlays/actors/ovl_En_Boj_02/z_en_boj_02.c @@ -29,9 +29,12 @@ ActorInit En_Boj_02_InitVars = { void EnBoj02_Init(Actor* thisx, PlayState* play) { } + void EnBoj02_Destroy(Actor* thisx, PlayState* play) { } + void EnBoj02_Update(Actor* thisx, PlayState* play) { } + void EnBoj02_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Boj_03/z_en_boj_03.c b/src/overlays/actors/ovl_En_Boj_03/z_en_boj_03.c index 0c55b79a6b..f72a5c081b 100644 --- a/src/overlays/actors/ovl_En_Boj_03/z_en_boj_03.c +++ b/src/overlays/actors/ovl_En_Boj_03/z_en_boj_03.c @@ -29,9 +29,12 @@ ActorInit En_Boj_03_InitVars = { void EnBoj03_Init(Actor* thisx, PlayState* play) { } + void EnBoj03_Destroy(Actor* thisx, PlayState* play) { } + void EnBoj03_Update(Actor* thisx, PlayState* play) { } + void EnBoj03_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Boj_04/z_en_boj_04.c b/src/overlays/actors/ovl_En_Boj_04/z_en_boj_04.c index 7fe308520b..efb7e96dfe 100644 --- a/src/overlays/actors/ovl_En_Boj_04/z_en_boj_04.c +++ b/src/overlays/actors/ovl_En_Boj_04/z_en_boj_04.c @@ -29,9 +29,12 @@ ActorInit En_Boj_04_InitVars = { void EnBoj04_Init(Actor* thisx, PlayState* play) { } + void EnBoj04_Destroy(Actor* thisx, PlayState* play) { } + void EnBoj04_Update(Actor* thisx, PlayState* play) { } + void EnBoj04_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Boj_05/z_en_boj_05.c b/src/overlays/actors/ovl_En_Boj_05/z_en_boj_05.c index da6816840a..2a6991922c 100644 --- a/src/overlays/actors/ovl_En_Boj_05/z_en_boj_05.c +++ b/src/overlays/actors/ovl_En_Boj_05/z_en_boj_05.c @@ -29,9 +29,12 @@ ActorInit En_Boj_05_InitVars = { void EnBoj05_Init(Actor* thisx, PlayState* play) { } + void EnBoj05_Destroy(Actor* thisx, PlayState* play) { } + void EnBoj05_Update(Actor* thisx, PlayState* play) { } + void EnBoj05_Draw(Actor* thisx, PlayState* play) { } diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 19f2e1d9b1..5c98a27630 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -49,16 +49,75 @@ ActorInit En_Bom_Bowl_Man_InitVars = { (ActorFunc)EnBomBowlMan_Draw, }; -static AnimationHeader* sAnimations[] = { - &gBomberIdleAnim, &object_cs_Anim_00FAF4, &object_cs_Anim_0057C8, &object_cs_Anim_0053F4, - &object_cs_Anim_002044, &object_cs_Anim_01007C, &object_cs_Anim_00349C, &object_cs_Anim_004960, - &object_cs_Anim_005128, &object_cs_Anim_004C1C, &object_cs_Anim_001A1C, &object_cs_Anim_003EE4, - &object_cs_Anim_00478C, &object_cs_Anim_00433C, &object_cs_Anim_0060E8, &object_cs_Anim_001708, - &object_cs_Anim_005DC4, &object_cs_Anim_0026B0, &object_cs_Anim_0036B0, &object_cs_Anim_0031C4, +typedef enum { + /* -1 */ ENBOMBOWLMAN_ANIM_NONE = -1, + /* 0x00 */ ENBOMBOWLMAN_ANIM_0, + /* 0x01 */ ENBOMBOWLMAN_ANIM_1, + /* 0x02 */ ENBOMBOWLMAN_ANIM_2, + /* 0x03 */ ENBOMBOWLMAN_ANIM_3, + /* 0x04 */ ENBOMBOWLMAN_ANIM_4, + /* 0x05 */ ENBOMBOWLMAN_ANIM_5, + /* 0x06 */ ENBOMBOWLMAN_ANIM_6, + /* 0x07 */ ENBOMBOWLMAN_ANIM_7, + /* 0x08 */ ENBOMBOWLMAN_ANIM_8, + /* 0x09 */ ENBOMBOWLMAN_ANIM_9, + /* 0x0A */ ENBOMBOWLMAN_ANIM_10, + /* 0x0B */ ENBOMBOWLMAN_ANIM_11, + /* 0x0C */ ENBOMBOWLMAN_ANIM_12, + /* 0x0D */ ENBOMBOWLMAN_ANIM_13, + /* 0x0E */ ENBOMBOWLMAN_ANIM_14, + /* 0x0F */ ENBOMBOWLMAN_ANIM_15, + /* 0x10 */ ENBOMBOWLMAN_ANIM_16, + /* 0x11 */ ENBOMBOWLMAN_ANIM_17, + /* 0x12 */ ENBOMBOWLMAN_ANIM_18, + /* 0x13 */ ENBOMBOWLMAN_ANIM_19, + /* 0x14 */ ENBOMBOWLMAN_ANIM_MAX +} EnBomBowlManAnimation; + +static AnimationHeader* sAnimations[ENBOMBOWLMAN_ANIM_MAX] = { + &gBomberIdleAnim, // ENBOMBOWLMAN_ANIM_0 + &object_cs_Anim_00FAF4, // ENBOMBOWLMAN_ANIM_1 + &object_cs_Anim_0057C8, // ENBOMBOWLMAN_ANIM_2 + &object_cs_Anim_0053F4, // ENBOMBOWLMAN_ANIM_3 + &object_cs_Anim_002044, // ENBOMBOWLMAN_ANIM_4 + &object_cs_Anim_01007C, // ENBOMBOWLMAN_ANIM_5 + &object_cs_Anim_00349C, // ENBOMBOWLMAN_ANIM_6 + &object_cs_Anim_004960, // ENBOMBOWLMAN_ANIM_7 + &object_cs_Anim_005128, // ENBOMBOWLMAN_ANIM_8 + &object_cs_Anim_004C1C, // ENBOMBOWLMAN_ANIM_9 + &object_cs_Anim_001A1C, // ENBOMBOWLMAN_ANIM_10 + &object_cs_Anim_003EE4, // ENBOMBOWLMAN_ANIM_11 + &object_cs_Anim_00478C, // ENBOMBOWLMAN_ANIM_12 + &object_cs_Anim_00433C, // ENBOMBOWLMAN_ANIM_13 + &object_cs_Anim_0060E8, // ENBOMBOWLMAN_ANIM_14 + &object_cs_Anim_001708, // ENBOMBOWLMAN_ANIM_15 + &object_cs_Anim_005DC4, // ENBOMBOWLMAN_ANIM_16 + &object_cs_Anim_0026B0, // ENBOMBOWLMAN_ANIM_17 + &object_cs_Anim_0036B0, // ENBOMBOWLMAN_ANIM_18 + &object_cs_Anim_0031C4, // ENBOMBOWLMAN_ANIM_19 }; -u8 D_809C6178[] = { - 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 0, 0, +static u8 sAnimationModes[ENBOMBOWLMAN_ANIM_MAX] = { + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_0 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_1 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_2 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_3 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_4 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_5 + ANIMMODE_ONCE, // ENBOMBOWLMAN_ANIM_6 + ANIMMODE_ONCE, // ENBOMBOWLMAN_ANIM_7 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_8 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_9 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_10 + ANIMMODE_ONCE, // ENBOMBOWLMAN_ANIM_11 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_12 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_13 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_14 + ANIMMODE_ONCE, // ENBOMBOWLMAN_ANIM_15 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_16 + ANIMMODE_ONCE, // ENBOMBOWLMAN_ANIM_17 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_18 + ANIMMODE_LOOP, // ENBOMBOWLMAN_ANIM_19 }; u16 D_809C618C[] = { 0x710, 0x711, 0x715, 0x716, 0x717, 0x718 }; @@ -77,7 +136,7 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); this->actor.gravity = -3.0f; SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, - this->morphTable, 21); + this->morphTable, OBJECT_CS_LIMB_MAX); this->unk_2F6 = ENBOMBOWLMAN_GET_F0(&this->actor); this->unk_2F4 = ENBOMBOWLMAN_GET_F(&this->actor); this->actor.targetMode = 6; @@ -112,37 +171,37 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play) { void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play) { } -void func_809C493C(EnBomBowlMan* this, s32 arg1, f32 arg2) { - this->unk_2F8 = arg1; - this->unk_2C4 = Animation_GetLastFrame(sAnimations[arg1]); - Animation_Change(&this->skelAnime, sAnimations[this->unk_2F8], arg2, 0.0f, this->unk_2C4, D_809C6178[this->unk_2F8], - -4.0f); +void EnBomBowlMan_ChangeAnim(EnBomBowlMan* this, s32 animIndex, f32 playSpeed) { + this->animIndex = animIndex; + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animEndFrame, + sAnimationModes[this->animIndex], -4.0f); } void func_809C49CC(EnBomBowlMan* this) { - if ((this->unk_2F8 == 5) && + if ((this->animIndex == ENBOMBOWLMAN_ANIM_5) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2F8 == 0xB) && + if ((this->animIndex == ENBOMBOWLMAN_ANIM_11) && (Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 8.0f) || Animation_OnFrame(&this->skelAnime, 12.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2F8 == 0x12) && + if ((this->animIndex == ENBOMBOWLMAN_ANIM_18) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2F8 == 0xF) && Animation_OnFrame(&this->skelAnime, 15.0f)) { + if ((this->animIndex == ENBOMBOWLMAN_ANIM_15) && Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } - if ((this->unk_2F8 == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { + if ((this->animIndex == ENBOMBOWLMAN_ANIM_6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } } @@ -171,7 +230,7 @@ void func_809C4BC4(EnBomBowlMan* this, PlayState* play) { s8 code; func_809C4B50(this); - func_809C493C(this, 0, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_0, 1.0f); for (i = 0; i < ARRAY_COUNT(gSaveContext.save.saveInfo.bomberCode); i++) { Math_Vec3f_Copy(&sp7C, &this->actor.home.pos); @@ -199,7 +258,7 @@ void func_809C4BC4(EnBomBowlMan* this, PlayState* play) { CutsceneManager_Queue(this->csId1); } - func_809C493C(this, 3, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_3, 1.0f); this->unk_2D4 = this->actor.yawTowardsPlayer; this->unk_290 = this->actor.yawTowardsPlayer; CLEAR_WEEKEVENTREG(WEEKEVENTREG_73_10); @@ -252,12 +311,12 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { &this->unk_2D8[0]->actor); this->unk_2D4 = 0; this->unk_2BC = 10; - func_809C493C(this, 17, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_17, 1.0f); break; case 1: D_809C6104 = 0; - func_809C493C(this, 3, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_3, 1.0f); this->unk_2D4 = this->actor.yawTowardsPlayer; this->unk_2C0 = 2; if ((player->transformation == PLAYER_FORM_HUMAN) && CHECK_QUEST_ITEM(QUEST_BOMBERS_NOTEBOOK)) { @@ -274,7 +333,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { } else { this->unk_2C0 = 3; play->msgCtx.msgLength = 0; - func_809C493C(this, 1, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_1, 1.0f); D_809C6100 = 1; if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { CutsceneManager_Stop(CS_ID_GLOBAL_TALK); @@ -302,7 +361,7 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { CutsceneManager_Stop(this->csId1); } play->msgCtx.msgLength = 0; - func_809C493C(this, 1, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_1, 1.0f); D_809C6100 = 1; this->actionFunc = func_809C5B1C; sp28 = true; @@ -315,6 +374,9 @@ void func_809C4DA4(EnBomBowlMan* this, PlayState* play) { this->actionFunc = func_809C51B4; sp28 = true; break; + + default: + break; } if (!sp28) { @@ -378,7 +440,7 @@ void func_809C53A4(EnBomBowlMan* this) { this->actor.draw = EnBomBowlMan_Draw; this->actor.world.pos.x = 1360.0f; this->actor.world.pos.z = -1870.0f; - func_809C493C(this, 18, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_18, 1.0f); this->unk_29C = 3; this->actionFunc = func_809C5408; } @@ -404,7 +466,7 @@ void func_809C5524(EnBomBowlMan* this, PlayState* play) { if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02)) { this->actor.textId = 0x72F; } - func_809C493C(this, 3, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_3, 1.0f); Message_StartTextbox(play, this->actor.textId, &this->actor); this->actionFunc = func_809C5598; } @@ -424,14 +486,14 @@ void func_809C5598(EnBomBowlMan* this, PlayState* play) { this->actor.textId = 0x715; } else if (this->actor.textId == 0x715) { func_800B7298(play, &this->actor, PLAYER_CSMODE_END); - func_809C493C(this, 17, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_17, 1.0f); func_809C59A4(this, play); return; } else if (this->actor.textId == 0x716) { this->actor.textId = 0x735; } else if (this->actor.textId == 0x735) { this->unk_2C2 = 0; - func_809C493C(this, 17, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_17, 1.0f); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_LEARNED_SECRET_CODE); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_RECEIVED_BOMBERS_NOTEBOOK); Message_BombersNotebookQueueEvent(play, BOMBERS_NOTEBOOK_EVENT_MET_BOMBERS); @@ -460,7 +522,7 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) { } else { CutsceneManager_StartWithPlayerCs(this->csId3, &this->actor); this->unk_2C2 = 2; - func_809C493C(this, 18, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_18, 1.0f); } } } else if (this->unk_2C2 == 1) { @@ -472,7 +534,7 @@ void func_809C5738(EnBomBowlMan* this, PlayState* play) { } else { CutsceneManager_StartWithPlayerCs(this->csId3, &this->actor); this->unk_2C2 = 2; - func_809C493C(this, 18, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_18, 1.0f); } } else { Math_SmoothStepToS(&this->actor.world.rot.y, yaw, 1, 2000, 10); @@ -543,33 +605,33 @@ void func_809C5B1C(EnBomBowlMan* this, PlayState* play) { void func_809C5BA0(EnBomBowlMan* this) { if (this->unk_2F4 != 0) { - func_809C493C(this, 0, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_0, 1.0f); } else { - this->unk_2F8 = 0; + this->animIndex = ENBOMBOWLMAN_ANIM_0; } this->unk_29C = 2; this->actionFunc = func_809C5BF4; } void func_809C5BF4(EnBomBowlMan* this, PlayState* play) { - f32 sp2C = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; Camera* subCam; - if ((D_809C6104 != 0) && (this->unk_2F8 != 15)) { - func_809C493C(this, 15, 1.0f); + if ((D_809C6104 != 0) && (this->animIndex != ENBOMBOWLMAN_ANIM_15)) { + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_15, 1.0f); } - if ((this->unk_2F8 == 15) && (this->unk_2C4 <= sp2C)) { - func_809C493C(this, 0, 1.0f); + if ((this->animIndex == ENBOMBOWLMAN_ANIM_15) && (curFrame >= this->animEndFrame)) { + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_0, 1.0f); } if (D_809C6100 != 0) { - if ((this->unk_2F8 == 0) && (D_809C6100 == (this->unk_2F4 + 1))) { - func_809C493C(this, 11, 1.0f); + if ((this->animIndex == ENBOMBOWLMAN_ANIM_0) && (D_809C6100 == (this->unk_2F4 + 1))) { + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_11, 1.0f); } - if ((this->unk_2F8 == 11) && (this->unk_2C4 <= sp2C)) { - func_809C493C(this, 12, 1.0f); + if ((this->animIndex == ENBOMBOWLMAN_ANIM_11) && (curFrame >= this->animEndFrame)) { + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_12, 1.0f); D_809C6100++; } @@ -581,7 +643,7 @@ void func_809C5BF4(EnBomBowlMan* this, PlayState* play) { Message_CloseTextbox(play); Camera_SetTargetActor(subCam, &this->unk_2D8[0]->actor); - func_809C493C(this, 13, 1.0f); + EnBomBowlMan_ChangeAnim(this, ENBOMBOWLMAN_ANIM_13, 1.0f); D_809C6100 = 0; if (player->transformation == PLAYER_FORM_HUMAN) { this->unk_2C0 = 5; @@ -638,19 +700,19 @@ void EnBomBowlMan_Update(Actor* thisx, PlayState* play) { s32 EnBomBowlMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBomBowlMan* this = THIS; - if (limbIndex == 15) { + if (limbIndex == OBJECT_CS_LIMB_0F) { *dList = NULL; } - if (limbIndex == 17) { + if (limbIndex == OBJECT_CS_LIMB_11) { rot->x += this->unk_28A; } - if ((limbIndex == 19) && (this->unk_2F6 == ENBOMBOWLMAN_F0_2)) { + if ((limbIndex == OBJECT_CS_LIMB_13) && (this->unk_2F6 == ENBOMBOWLMAN_F0_2)) { *dList = NULL; } - if ((limbIndex == 20) && (this->unk_2F6 == ENBOMBOWLMAN_F0_0)) { + if ((limbIndex == OBJECT_CS_LIMB_14) && (this->unk_2F6 == ENBOMBOWLMAN_F0_0)) { *dList = NULL; } return false; diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h index df515ef4fe..b6b7490766 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h @@ -2,6 +2,7 @@ #define Z_EN_BOM_BOWL_MAN_H #include "global.h" +#include "objects/object_cs/object_cs.h" struct EnBomBowlMan; @@ -19,8 +20,8 @@ typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, PlayState*); typedef struct EnBomBowlMan { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[21]; - /* 0x206 */ Vec3s morphTable[21]; + /* 0x188 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; + /* 0x206 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX]; /* 0x284 */ EnBomBowlManActionFunc actionFunc; /* 0x288 */ s16 unk_288; /* 0x28A */ s16 unk_28A; @@ -41,7 +42,7 @@ typedef struct EnBomBowlMan { /* 0x2BE */ UNK_TYPE1 unk2BE[2]; /* 0x2C0 */ s16 unk_2C0; /* 0x2C2 */ s16 unk_2C2; - /* 0x2C4 */ f32 unk_2C4; + /* 0x2C4 */ f32 animEndFrame; /* 0x2C8 */ f32 unk_2C8; /* 0x2CC */ s16 csIdList[2]; /* 0x2D0 */ s16 csId1; @@ -54,7 +55,7 @@ typedef struct EnBomBowlMan { /* 0x2F2 */ s16 unk_2F2; /* 0x2F4 */ s16 unk_2F4; /* 0x2F6 */ s16 unk_2F6; - /* 0x2F8 */ s32 unk_2F8; + /* 0x2F8 */ s32 animIndex; } EnBomBowlMan; // size = 0x2FC #endif // Z_EN_BOM_BOWL_MAN_H diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c index a1c0810ce5..88ce2bf92e 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.c @@ -6,7 +6,6 @@ #include "z_en_bombers.h" #include "overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h" -#include "objects/object_cs/object_cs.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) @@ -57,18 +56,66 @@ static ColliderCylinderInit sCylinderInit = { { 10, 30, 0, { 0, 0, 0 } }, }; -AnimationHeader* D_80C0479C[] = { - &gBomberIdleAnim, &object_cs_Anim_0053F4, &object_cs_Anim_01007C, &object_cs_Anim_00349C, - &object_cs_Anim_004960, &object_cs_Anim_005128, &object_cs_Anim_004C1C, &object_cs_Anim_001A1C, - &object_cs_Anim_003EE4, &object_cs_Anim_00478C, &object_cs_Anim_00433C, &object_cs_Anim_0060E8, - &object_cs_Anim_001708, &object_cs_Anim_005DC4, &object_cs_Anim_0026B0, &object_cs_Anim_0036B0, - &object_cs_Anim_0031C4, +typedef enum { + /* -1 */ ENBOMBERS_ANIM_NONE = -1, + /* 0x00 */ ENBOMBERS_ANIM_0, + /* 0x01 */ ENBOMBERS_ANIM_1, + /* 0x02 */ ENBOMBERS_ANIM_2, + /* 0x03 */ ENBOMBERS_ANIM_3, + /* 0x04 */ ENBOMBERS_ANIM_4, + /* 0x05 */ ENBOMBERS_ANIM_5, + /* 0x06 */ ENBOMBERS_ANIM_6, + /* 0x07 */ ENBOMBERS_ANIM_7, + /* 0x08 */ ENBOMBERS_ANIM_8, + /* 0x09 */ ENBOMBERS_ANIM_9, + /* 0x0A */ ENBOMBERS_ANIM_10, + /* 0x0B */ ENBOMBERS_ANIM_11, + /* 0x0C */ ENBOMBERS_ANIM_12, + /* 0x0D */ ENBOMBERS_ANIM_13, + /* 0x0E */ ENBOMBERS_ANIM_14, + /* 0x0F */ ENBOMBERS_ANIM_15, + /* 0x10 */ ENBOMBERS_ANIM_16, + /* 0x11 */ ENBOMBERS_ANIM_MAX +} EnBombersAnimation; + +static AnimationHeader* sAnimations[ENBOMBERS_ANIM_MAX] = { + &gBomberIdleAnim, // ENBOMBERS_ANIM_0 + &object_cs_Anim_0053F4, // ENBOMBERS_ANIM_1 + &object_cs_Anim_01007C, // ENBOMBERS_ANIM_2 + &object_cs_Anim_00349C, // ENBOMBERS_ANIM_3 + &object_cs_Anim_004960, // ENBOMBERS_ANIM_4 + &object_cs_Anim_005128, // ENBOMBERS_ANIM_5 + &object_cs_Anim_004C1C, // ENBOMBERS_ANIM_6 + &object_cs_Anim_001A1C, // ENBOMBERS_ANIM_7 + &object_cs_Anim_003EE4, // ENBOMBERS_ANIM_8 + &object_cs_Anim_00478C, // ENBOMBERS_ANIM_9 + &object_cs_Anim_00433C, // ENBOMBERS_ANIM_10 + &object_cs_Anim_0060E8, // ENBOMBERS_ANIM_11 + &object_cs_Anim_001708, // ENBOMBERS_ANIM_12 + &object_cs_Anim_005DC4, // ENBOMBERS_ANIM_13 + &object_cs_Anim_0026B0, // ENBOMBERS_ANIM_14 + &object_cs_Anim_0036B0, // ENBOMBERS_ANIM_15 + &object_cs_Anim_0031C4, // ENBOMBERS_ANIM_16 }; -u8 D_80C047E0[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, - ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, - ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, +static u8 sAnimationModes[ENBOMBERS_ANIM_MAX] = { + ANIMMODE_LOOP, // ENBOMBERS_ANIM_0 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_1 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_2 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_3 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_4 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_5 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_6 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_7 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_8 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_9 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_10 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_11 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_12 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_13 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_14 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_15 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_16 }; #include "overlays/ovl_En_Bombers/ovl_En_Bombers.c" @@ -95,7 +142,7 @@ void EnBombers_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); this->actor.gravity = -1.0f; SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, - this->morphtable, 21); + this->morphtable, OBJECT_CS_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.targetMode = 0; Actor_SetScale(&this->actor, 0.01f); @@ -154,21 +201,21 @@ void EnBombers_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80C03824(EnBombers* this, s32 arg1, f32 arg2) { - this->unk_2C4 = arg1; - this->unk_2B0 = Animation_GetLastFrame(D_80C0479C[arg1]); - Animation_Change(&this->skelAnime, D_80C0479C[this->unk_2C4], arg2, 0.0f, this->unk_2B0, D_80C047E0[this->unk_2C4], - -10.0f); +void EnBombers_ChangeAnim(EnBombers* this, s32 animIndex, f32 playSpeed) { + this->animIndex = animIndex; + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animEndFrame, + sAnimationModes[this->animIndex], -10.0f); } void func_80C038B4(EnBombers* this) { - if ((this->unk_2C4 == 2) && + if ((this->animIndex == ENBOMBERS_ANIM_2) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2C4 == 15) && + if ((this->animIndex == ENBOMBERS_ANIM_15) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); @@ -210,6 +257,9 @@ void func_80C039A8(EnBombers* this, PlayState* play) { this->actor.textId = 0x744; } break; + + default: + break; } } @@ -242,7 +292,7 @@ void func_80C03AF4(EnBombers* this, PlayState* play) { abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp60))); if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp60, &sp6C, &colPoly, true, false, false, true, &sp48)) { - func_80C03824(this, 2, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_2, 1.0f); Math_Vec3f_Copy(&this->unk_294, &sp60); this->unk_2AA = Rand_S16Offset(30, 50); this->unk_2A0++; @@ -265,9 +315,9 @@ void func_80C03AF4(EnBombers* this, PlayState* play) { false, true, &sp48)) { this->unk_2A8 = 0; if (Rand_ZeroOne() < 0.5f) { - func_80C03824(this, 16, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_16, 1.0f); } else { - func_80C03824(this, 0, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_0, 1.0f); } this->unk_2A0 = 0; this->unk_2B4 = 0.0f; @@ -281,9 +331,9 @@ void func_80C03AF4(EnBombers* this, PlayState* play) { if ((this->unk_2AA == 0) || (sqrtf(SQ(x) + SQ(z)) < 4.0f)) { this->unk_2A8 = Rand_S16Offset(20, 20); if (!(this->unk_2A8 & 1)) { - func_80C03824(this, 16, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_16, 1.0f); } else { - func_80C03824(this, 0, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_0, 1.0f); } this->unk_2A0 = 0; this->unk_2B4 = 0.0f; @@ -293,6 +343,9 @@ void func_80C03AF4(EnBombers* this, PlayState* play) { Math_ApproachF(&this->unk_2B4, 1.0f, 0.3f, 0.5f); } break; + + default: + break; } if (Text_GetFaceReaction(play, FACE_REACTION_SET_BOMBERS) == 0) { @@ -314,7 +367,7 @@ void func_80C03AF4(EnBombers* this, PlayState* play) { void func_80C03F64(EnBombers* this) { this->unk_2A4 = this->actor.yawTowardsPlayer; - func_80C03824(this, 1, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_1, 1.0f); this->unk_2C0 = 1; this->actionFunc = func_80C03FAC; } @@ -334,6 +387,9 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { case PLAYER_FORM_ZORA: this->unk_28E = -0x1770; break; + + default: + break; } if ((this->unk_2A6 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { @@ -373,7 +429,7 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { } else { Audio_PlaySfx_MessageDecide(); this->actor.textId = 0x74D; - func_80C03824(this, 14, 1.0f); + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_14, 1.0f); sp2A = 1; } } else if (this->actor.textId == 0x744) { @@ -409,6 +465,9 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { case ENBOMBERS_F_4: SET_WEEKEVENTREG(WEEKEVENTREG_74_08); break; + + default: + break; } SET_WEEKEVENTREG(WEEKEVENTREG_73_40); } @@ -422,13 +481,16 @@ void func_80C03FAC(EnBombers* this, PlayState* play) { case 1: Message_ContinueTextbox(play, this->actor.textId); break; + + default: + break; } } } void func_80C042F8(EnBombers* this) { - if (this->unk_2C4 != 6) { - func_80C03824(this, 6, 1.0f); + if (this->animIndex != ENBOMBERS_ANIM_6) { + EnBombers_ChangeAnim(this, ENBOMBERS_ANIM_6, 1.0f); } this->actor.textId = 0x72D; this->unk_28E = 0x1F40; diff --git a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h index 1585613ced..76013781b2 100644 --- a/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h +++ b/src/overlays/actors/ovl_En_Bombers/z_en_bombers.h @@ -2,6 +2,7 @@ #define Z_EN_BOMBERS_H #include "global.h" +#include "objects/object_cs/object_cs.h" struct EnBombers; @@ -23,8 +24,8 @@ typedef enum { typedef struct EnBombers { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[21]; - /* 0x206 */ Vec3s morphtable[21]; + /* 0x188 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; + /* 0x206 */ Vec3s morphtable[OBJECT_CS_LIMB_MAX]; /* 0x284 */ EnBombersActionFunc actionFunc; /* 0x288 */ s16 unk_288; /* 0x28A */ s16 unk_28A; @@ -39,14 +40,14 @@ typedef struct EnBombers { /* 0x2A8 */ s16 unk_2A8; /* 0x2AA */ s16 unk_2AA; /* 0x2AC */ s16 unk_2AC; - /* 0x2B0 */ f32 unk_2B0; + /* 0x2B0 */ f32 animEndFrame; /* 0x2B4 */ f32 unk_2B4; /* 0x2B8 */ s16 unk_2B8; /* 0x2BA */ s16 unk_2BA; /* 0x2BC */ s16 unk_2BC; /* 0x2BE */ s16 unk_2BE; /* 0x2C0 */ s16 unk_2C0; - /* 0x2C4 */ s32 unk_2C4; + /* 0x2C4 */ s32 animIndex; /* 0x2C8 */ ColliderCylinder collider; } EnBombers; // size = 0x314 diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c index c29916d3a0..ae7cacff7b 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c @@ -19,7 +19,6 @@ void func_80C04BA0(EnBombers2* this, PlayState* play); void func_80C04D8C(EnBombers2* this, PlayState* play); void func_80C0520C(EnBombers2* this, PlayState* play); void func_80C04B40(EnBombers2* this); -void EnBombers2_ChangeAnim(EnBombers2* this, s32 animIndex, f32 playSpeed); void func_80C04D00(EnBombers2* this); void func_80C050B8(EnBombers2* this, PlayState* play); @@ -59,14 +58,36 @@ static ColliderCylinderInit sCylinderInit = { { 35, 30, 0, { 0, 0, 0 } }, }; -static AnimationHeader* sAnimations[] = { - &gBomberIdleAnim, &object_cs_Anim_0053F4, &object_cs_Anim_01007C, &object_cs_Anim_00349C, - &object_cs_Anim_0060E8, &object_cs_Anim_005DC4, &object_cs_Anim_0026B0, +typedef enum { + /* -1 */ ENBOMBERS_ANIM_NONE = -1, + /* 0 */ ENBOMBERS_ANIM_0, + /* 1 */ ENBOMBERS_ANIM_1, + /* 2 */ ENBOMBERS_ANIM_2, + /* 3 */ ENBOMBERS_ANIM_3, + /* 4 */ ENBOMBERS_ANIM_4, + /* 5 */ ENBOMBERS_ANIM_5, + /* 6 */ ENBOMBERS_ANIM_6, + /* 7 */ ENBOMBERS_ANIM_MAX +} EnBombersAnimation; + +static AnimationHeader* sAnimations[ENBOMBERS_ANIM_MAX] = { + &gBomberIdleAnim, // ENBOMBERS_ANIM_0 + &object_cs_Anim_0053F4, // ENBOMBERS_ANIM_1 + &object_cs_Anim_01007C, // ENBOMBERS_ANIM_2 + &object_cs_Anim_00349C, // ENBOMBERS_ANIM_3 + &object_cs_Anim_0060E8, // ENBOMBERS_ANIM_4 + &object_cs_Anim_005DC4, // ENBOMBERS_ANIM_5 + &object_cs_Anim_0026B0, // ENBOMBERS_ANIM_6 }; -static u8 sAnimationModes[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, +static u8 sAnimationModes[ENBOMBERS_ANIM_MAX] = { + ANIMMODE_LOOP, // ENBOMBERS_ANIM_0 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_1 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_2 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_3 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_4 + ANIMMODE_LOOP, // ENBOMBERS_ANIM_5 + ANIMMODE_ONCE, // ENBOMBERS_ANIM_6 }; static Gfx sSetPrimColorDL[] = { @@ -90,8 +111,8 @@ void EnBombers2_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 19.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->morphTable, - this->jointTable, OBJECT_CS_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &object_cs_Skel_00F82C, &gBomberIdleAnim, this->jointTable, + this->morphTable, OBJECT_CS_LIMB_MAX); this->actor.targetMode = 6; Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -115,20 +136,20 @@ void EnBombers2_Destroy(Actor* thisx, PlayState* play) { } void EnBombers2_ChangeAnim(EnBombers2* this, s32 animIndex, f32 playSpeed) { - f32 lastFrame; + f32 endFrame; this->animIndex = animIndex; - lastFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); - this->lastAnimFrame = lastFrame; - Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, lastFrame, + endFrame = Animation_GetLastFrame(sAnimations[this->animIndex]); + this->lastAnimFrame = endFrame; + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, endFrame, sAnimationModes[this->animIndex], -10.0f); } void func_80C04B40(EnBombers2* this) { if (this->unk_2AC == 0) { - EnBombers2_ChangeAnim(this, 4, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_4, 1.0f); } else { - EnBombers2_ChangeAnim(this, 0, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_0, 1.0f); } this->unk_2C0 = 0; this->actionFunc = func_80C04BA0; @@ -149,11 +170,15 @@ void func_80C04BA0(EnBombers2* this, PlayState* play) { this->textIdIndex = 1; this->talkState = TEXT_STATE_5; break; + case PLAYER_FORM_DEKU: case PLAYER_FORM_HUMAN: this->textIdIndex = 2; this->talkState = TEXT_STATE_5; break; + + default: + break; } if (this->unk_2AC != 0) { this->textIdIndex = 7; @@ -177,14 +202,14 @@ void func_80C04BA0(EnBombers2* this, PlayState* play) { void func_80C04D00(EnBombers2* this) { if ((this->textIdIndex == 0) || (this->textIdIndex == 1)) { - EnBombers2_ChangeAnim(this, 5, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_5, 1.0f); } else { - EnBombers2_ChangeAnim(this, 1, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_1, 1.0f); } this->unk_2A8 = 0; if (this->unk_2AC != 0) { - EnBombers2_ChangeAnim(this, 6, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_6, 1.0f); } this->unk_2C0 = 1; this->actionFunc = func_80C04D8C; @@ -192,13 +217,13 @@ void func_80C04D00(EnBombers2* this) { void func_80C04D8C(EnBombers2* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 temp = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; - if ((this->unk_2AC == 0) && (this->lastAnimFrame <= temp)) { + if ((this->unk_2AC == 0) && (curFrame >= this->lastAnimFrame)) { if (!(this->unk_2A8 & 1)) { - EnBombers2_ChangeAnim(this, 1, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_1, 1.0f); } else { - EnBombers2_ChangeAnim(this, 5, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_5, 1.0f); } this->unk_2A8++; this->unk_2A8 &= 1; @@ -207,10 +232,12 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { case PLAYER_FORM_HUMAN: this->unk_28E = -0xFA0; break; + case PLAYER_FORM_GORON: case PLAYER_FORM_ZORA: this->unk_28E = -0x1770; break; + default: break; } @@ -256,12 +283,14 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { Message_CloseTextbox(play); func_80C04B40(this); break; + case 2: this->textIdIndex = 3; this->actor.textId = sTextIds[this->textIdIndex]; Message_ContinueTextbox(play, this->actor.textId); this->talkState = TEXT_STATE_15; break; + case 3: for (j = 0; j < ARRAY_COUNT(this->correctDigitSlots); j++) { this->correctDigitSlots[j] = false; @@ -272,16 +301,21 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { Message_ContinueTextbox(play, this->actor.textId); this->talkState = TEXT_STATE_5; break; + case 4: this->textIdIndex = 5; this->actor.textId = sTextIds[this->textIdIndex]; Message_ContinueTextbox(play, this->actor.textId); this->talkState = TEXT_STATE_5; break; + case 6: play->msgCtx.msgLength = 0; func_80C050B8(this, play); break; + + default: + break; } } } @@ -291,7 +325,7 @@ void func_80C050B8(EnBombers2* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 homeYawToPlayer; - EnBombers2_ChangeAnim(this, 2, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_2, 1.0f); this->unk_2A8 = 0; homeYawToPlayer = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); Math_Vec3f_Copy(&this->unk_29C, &this->actor.world.pos); @@ -328,7 +362,7 @@ void func_80C0520C(EnBombers2* this, PlayState* play) { Message_CloseTextbox(play); this->talkState = TEXT_STATE_5; this->textIdIndex = 7; - EnBombers2_ChangeAnim(this, 6, 1.0f); + EnBombers2_ChangeAnim(this, ENBOMBERS_ANIM_6, 1.0f); this->unk_2A8 = 0; this->unk_2C0 = 1; SET_WEEKEVENTREG(WEEKEVENTREG_73_80); @@ -355,7 +389,7 @@ void EnBombers2_Update(Actor* thisx, PlayState* play) { if (this->unk_2B2 != 0) { this->unk_2B2--; } - if ((this->animIndex == 2) && + if ((this->animIndex == ENBOMBERS_ANIM_2) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); @@ -392,11 +426,11 @@ void EnBombers2_Update(Actor* thisx, PlayState* play) { this->actor.world.pos.x = (Math_SinS((this->actor.world.rot.y + 0x8000)) * 26.0f) + sp34.x; temp_f4 = Math_CosS(this->actor.world.rot.y + 0x8000) * 26.0f; this->actor.world.pos.z = temp_f4 + sp34.z; - this->collider.dim.radius = 0x23; - this->collider.dim.height = 0x1E; + this->collider.dim.radius = 35; + this->collider.dim.height = 30; } else { - this->collider.dim.radius = 0xA; - this->collider.dim.height = 0x19; + this->collider.dim.radius = 10; + this->collider.dim.height = 25; } Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h index 9e6f6b5776..f02c5eccbb 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h @@ -2,7 +2,6 @@ #define Z_EN_BOMBERS2_H #include "global.h" - #include "objects/object_cs/object_cs.h" struct EnBombers2; @@ -12,8 +11,8 @@ typedef void (*EnBombers2ActionFunc)(struct EnBombers2*, PlayState*); typedef struct EnBombers2 { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; - /* 0x188 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX]; - /* 0x206 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; + /* 0x188 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; + /* 0x206 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX]; /* 0x284 */ EnBombers2ActionFunc actionFunc; /* 0x288 */ s16 unk_288; /* 0x28A */ s16 unk_28A; diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c index 548091daa0..21103d464a 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -6,7 +6,6 @@ #include "overlays/actors/ovl_En_Bombal/z_en_bombal.h" #include "z_en_bomjima.h" -#include "objects/object_cs/object_cs.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10) @@ -99,18 +98,75 @@ u16 D_80C00A70[] = { u16 D_80C00A8C[] = { 0x736, 0x737, 0x738, 0x74E }; -static AnimationHeader* sAnimations[] = { - &gBomberIdleAnim, &object_cs_Anim_00FAF4, &object_cs_Anim_0057C8, &object_cs_Anim_0053F4, - &object_cs_Anim_002044, &object_cs_Anim_01007C, &object_cs_Anim_00349C, &object_cs_Anim_004960, - &object_cs_Anim_005128, &object_cs_Anim_004C1C, &object_cs_Anim_001A1C, &object_cs_Anim_003EE4, - &object_cs_Anim_00478C, &object_cs_Anim_00433C, &object_cs_Anim_0060E8, &object_cs_Anim_001708, - &object_cs_Anim_005DC4, &object_cs_Anim_0026B0, &object_cs_Anim_0036B0, &object_cs_Anim_0031C4, +typedef enum { + /* -1 */ ENBOMJIMA_ANIM_NONE = -1, + /* 0x00 */ ENBOMJIMA_ANIM_0, + /* 0x01 */ ENBOMJIMA_ANIM_1, + /* 0x02 */ ENBOMJIMA_ANIM_2, + /* 0x03 */ ENBOMJIMA_ANIM_3, + /* 0x04 */ ENBOMJIMA_ANIM_4, + /* 0x05 */ ENBOMJIMA_ANIM_5, + /* 0x06 */ ENBOMJIMA_ANIM_6, + /* 0x07 */ ENBOMJIMA_ANIM_7, + /* 0x08 */ ENBOMJIMA_ANIM_8, + /* 0x09 */ ENBOMJIMA_ANIM_9, + /* 0x0A */ ENBOMJIMA_ANIM_10, + /* 0x0B */ ENBOMJIMA_ANIM_11, + /* 0x0C */ ENBOMJIMA_ANIM_12, + /* 0x0D */ ENBOMJIMA_ANIM_13, + /* 0x0E */ ENBOMJIMA_ANIM_14, + /* 0x0F */ ENBOMJIMA_ANIM_15, + /* 0x10 */ ENBOMJIMA_ANIM_16, + /* 0x11 */ ENBOMJIMA_ANIM_17, + /* 0x12 */ ENBOMJIMA_ANIM_18, + /* 0x13 */ ENBOMJIMA_ANIM_19, + /* 0x16 */ ENBOMJIMA_ANIM_MAX +} EnBomjimaAnimation; + +static AnimationHeader* sAnimations[ENBOMJIMA_ANIM_MAX] = { + &gBomberIdleAnim, // ENBOMJIMA_ANIM_0 + &object_cs_Anim_00FAF4, // ENBOMJIMA_ANIM_1 + &object_cs_Anim_0057C8, // ENBOMJIMA_ANIM_2 + &object_cs_Anim_0053F4, // ENBOMJIMA_ANIM_3 + &object_cs_Anim_002044, // ENBOMJIMA_ANIM_4 + &object_cs_Anim_01007C, // ENBOMJIMA_ANIM_5 + &object_cs_Anim_00349C, // ENBOMJIMA_ANIM_6 + &object_cs_Anim_004960, // ENBOMJIMA_ANIM_7 + &object_cs_Anim_005128, // ENBOMJIMA_ANIM_8 + &object_cs_Anim_004C1C, // ENBOMJIMA_ANIM_9 + &object_cs_Anim_001A1C, // ENBOMJIMA_ANIM_10 + &object_cs_Anim_003EE4, // ENBOMJIMA_ANIM_11 + &object_cs_Anim_00478C, // ENBOMJIMA_ANIM_12 + &object_cs_Anim_00433C, // ENBOMJIMA_ANIM_13 + &object_cs_Anim_0060E8, // ENBOMJIMA_ANIM_14 + &object_cs_Anim_001708, // ENBOMJIMA_ANIM_15 + &object_cs_Anim_005DC4, // ENBOMJIMA_ANIM_16 + &object_cs_Anim_0026B0, // ENBOMJIMA_ANIM_17 + &object_cs_Anim_0036B0, // ENBOMJIMA_ANIM_18 + &object_cs_Anim_0031C4, // ENBOMJIMA_ANIM_19 }; -u8 D_80C00AE4[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, - ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, - ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, +static u8 sAnimationModes[ENBOMJIMA_ANIM_MAX] = { + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_0 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_1 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_2 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_3 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_4 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_5 + ANIMMODE_ONCE, // ENBOMJIMA_ANIM_6 + ANIMMODE_ONCE, // ENBOMJIMA_ANIM_7 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_8 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_9 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_10 + ANIMMODE_ONCE, // ENBOMJIMA_ANIM_11 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_12 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_13 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_14 + ANIMMODE_ONCE, // ENBOMJIMA_ANIM_15 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_16 + ANIMMODE_ONCE, // ENBOMJIMA_ANIM_17 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_18 + ANIMMODE_LOOP, // ENBOMJIMA_ANIM_19 }; s16 D_80C00AF8[] = { @@ -205,34 +261,37 @@ void func_80BFE32C(EnBomjima* this, PlayState* play, s32 arg2) { case 3: this->actor.textId = D_80C00A8C[this->unk_2C8]; break; + + default: + break; } } -void func_80BFE494(EnBomjima* this, s32 animIndex, f32 playSpeed) { +void EnBomjima_ChangeAnim(EnBomjima* this, s32 animIndex, f32 playSpeed) { this->animIndex = animIndex; - this->animLastFrame = Animation_GetLastFrame(sAnimations[animIndex]); - Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animLastFrame, - D_80C00AE4[this->animIndex], -4.0f); + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animEndFrame, + sAnimationModes[this->animIndex], -4.0f); } void func_80BFE524(EnBomjima* this) { - if ((this->animIndex == 5) && + if ((this->animIndex == ENBOMJIMA_ANIM_5) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->animIndex == 18) && + if ((this->animIndex == ENBOMJIMA_ANIM_18) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->animIndex == 15) && Animation_OnFrame(&this->skelAnime, 15.0f)) { + if ((this->animIndex == ENBOMJIMA_ANIM_15) && Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } - if ((this->animIndex == 6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { + if ((this->animIndex == ENBOMJIMA_ANIM_6) && Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } } @@ -247,7 +306,7 @@ void func_80BFE65C(EnBomjima* this) { } void func_80BFE67C(EnBomjima* this, PlayState* play) { - f32 sp84 = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; f32 x; f32 z; s16 abs; @@ -272,7 +331,7 @@ void func_80BFE67C(EnBomjima* this, PlayState* play) { abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp54))); if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp54, &sp6C, &sp50, true, false, false, true, &sp4C)) { - func_80BFE494(this, 5, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_5, 1.0f); Math_Vec3f_Copy(&this->unk_2A4, &sp54); this->unk_2BE = Rand_S16Offset(30, 50); this->unk_2A2++; @@ -281,7 +340,7 @@ void func_80BFE67C(EnBomjima* this, PlayState* play) { break; case 1: - if (sp84 >= 0.0f) { + if (curFrame >= 0.0f) { this->unk_2DC = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_2A4); Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 10, 2000, 20); } @@ -297,9 +356,9 @@ void func_80BFE67C(EnBomjima* this, PlayState* play) { false, true, &sp4C)) { this->unk_2C0 = 0; if (Rand_ZeroOne() < 0.5f) { - func_80BFE494(this, 19, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_19, 1.0f); } else { - func_80BFE494(this, 0, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_0, 1.0f); } this->unk_2A2 = 0; this->unk_2D0 = 0.0f; @@ -313,13 +372,13 @@ void func_80BFE67C(EnBomjima* this, PlayState* play) { if ((this->unk_2BE == 0) || (sqrtf(SQ(x) + SQ(z)) < 4.0f)) { this->unk_2C0 = Rand_S16Offset(20, 20); if (!(this->unk_2C0 & 1)) { - func_80BFE494(this, 19, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_19, 1.0f); } else { - func_80BFE494(this, 0, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_0, 1.0f); } this->unk_2A2 = 0; this->unk_2D0 = 0.0f; - } else if (sp84 >= 0.0f) { + } else if (curFrame >= 0.0f) { Math_ApproachF(&this->actor.world.pos.x, this->unk_2A4.x, 0.3f, this->unk_2D0); Math_ApproachF(&this->actor.world.pos.z, this->unk_2A4.z, 0.3f, this->unk_2D0); Math_ApproachF(&this->unk_2D0, 1.0f, 0.3f, 0.5f); @@ -349,7 +408,7 @@ void func_80BFEA94(EnBomjima* this, PlayState* play) { } void func_80BFEB1C(EnBomjima* this) { - func_80BFE494(this, 1, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_1, 1.0f); func_80BFE65C(this); this->action = EN_BOMJIMA_ACTION_0; this->actionFunc = func_80BFEB64; @@ -400,7 +459,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { switch (this->unk_2A2) { case 0: - func_80BFE494(this, 4, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_4, 1.0f); this->unk_29A = -7000; this->unk_2A2++; break; @@ -430,7 +489,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { this->unk_2BC++; if (((s16)Rand_ZeroFloat(2.0f) + 3) < this->unk_2BC) { - func_80BFE494(this, 5, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_5, 1.0f); this->unk_29A = 0; Math_Vec3f_Copy(&this->unk_2A4, &this->actor.home.pos); this->unk_2A4.x += Rand_CenteredFloat(150.0f); @@ -456,7 +515,7 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) { void func_80BFEFF0(EnBomjima* this) { this->bombal = NULL; - func_80BFE494(this, 19, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_19, 1.0f); func_80BFE65C(this); this->action = EN_BOMJIMA_ACTION_1; this->actionFunc = func_80BFF03C; @@ -483,14 +542,14 @@ void func_80BFF03C(EnBomjima* this, PlayState* play) { void func_80BFF120(EnBomjima* this) { func_80BFE65C(this); this->cutsceneTimer = 30; - func_80BFE494(this, 6, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_6, 1.0f); this->cutsceneEnded = false; this->action = EN_BOMJIMA_ACTION_2; this->actionFunc = func_80BFF174; } void func_80BFF174(EnBomjima* this, PlayState* play) { - f32 sp2C = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; Player* player = GET_PLAYER(play); if (this->cutsceneTimer == 1) { @@ -510,10 +569,10 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); - if ((this->animLastFrame <= sp2C) && (this->unk_2BC < 5)) { + if ((curFrame >= this->animEndFrame) && (this->unk_2BC < 5)) { this->unk_2BC++; - if (this->animIndex != 19) { - func_80BFE494(this, 19, 1.0f); + if (this->animIndex != ENBOMJIMA_ANIM_19) { + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_19, 1.0f); } } @@ -562,7 +621,7 @@ void func_80BFF174(EnBomjima* this, PlayState* play) { } void func_80BFF3F0(EnBomjima* this) { - func_80BFE494(this, 15, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_15, 1.0f); this->action = EN_BOMJIMA_ACTION_3; this->actionFunc = func_80BFF430; } @@ -570,7 +629,7 @@ void func_80BFF3F0(EnBomjima* this) { void func_80BFF430(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if (this->animLastFrame <= curFrame) { + if (curFrame >= this->animEndFrame) { EnBombal* bombal = (EnBombal*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBAL, this->unk_2B0.x, this->unk_2B0.y, this->unk_2B0.z, 0, 0, 0, 0); @@ -610,7 +669,7 @@ void func_80BFF52C(EnBomjima* this, PlayState* play) { } Message_ContinueTextbox(play, this->actor.textId); Audio_PlaySfx(NA_SE_SY_FOUND); - func_80BFE494(this, 15, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_15, 1.0f); this->action = EN_BOMJIMA_ACTION_5; this->actionFunc = func_80BFF6CC; } else { @@ -635,10 +694,10 @@ void func_80BFF52C(EnBomjima* this, PlayState* play) { void func_80BFF6CC(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if (this->animLastFrame <= curFrame) { + if (curFrame >= this->animEndFrame) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - func_80BFE494(this, 1, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_1, 1.0f); this->actionFunc = func_80BFF754; } } @@ -727,7 +786,7 @@ void func_80BFF9B0(EnBomjima* this, PlayState* play) { gSaveContext.save.saveInfo.bombersCaughtOrder[3] = 0; gSaveContext.save.saveInfo.bombersCaughtOrder[4] = 0; - func_80BFE494(this, 3, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_3, 1.0f); this->unk_2C8 = 9; if (player->transformation == PLAYER_FORM_DEKU) { @@ -743,7 +802,7 @@ void func_80BFF9B0(EnBomjima* this, PlayState* play) { void func_80BFFB40(EnBomjima* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - func_80BFE494(this, 15, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_15, 1.0f); D_80C009F0 = 100; this->unk_2DC = 0; this->actionFunc = func_80BFFBC4; @@ -753,8 +812,8 @@ void func_80BFFB40(EnBomjima* this, PlayState* play) { void func_80BFFBC4(EnBomjima* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if ((this->animIndex != 1) && (this->animLastFrame <= curFrame)) { - func_80BFE494(this, 1, 1.0f); + if ((this->animIndex != ENBOMJIMA_ANIM_1) && (curFrame >= this->animEndFrame)) { + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_1, 1.0f); } if ((D_80C009F4 != 0) && (this->unk_2C2 == 0)) { @@ -780,7 +839,7 @@ void func_80BFFBC4(EnBomjima* this, PlayState* play) { void func_80BFFCFC(EnBomjima* this) { func_80BFE65C(this); - func_80BFE494(this, 18, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_18, 1.0f); this->action = EN_BOMJIMA_ACTION_6; this->actionFunc = func_80BFFD48; } @@ -795,7 +854,7 @@ void func_80BFFD48(EnBomjima* this, PlayState* play) { if (sqrtf(SQ(this->actor.world.pos.x - this->unk_2A4.x) + SQ(this->actor.world.pos.z - this->unk_2A4.z)) < 4.0f) { D_80C009F0++; this->unk_2DC = this->actor.parent->world.rot.y; - func_80BFE494(this, 0, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_0, 1.0f); this->actionFunc = func_80BFFE48; } } @@ -807,7 +866,7 @@ void func_80BFFE48(EnBomjima* this, PlayState* play) { if (D_80C009F0 >= 100) { if (this->unk_2E4 != 4) { - func_80BFE494(this, 15, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_15, 1.0f); this->unk_2DC = 0; func_80BFE65C(this); this->actionFunc = func_80BFFF54; @@ -815,7 +874,7 @@ void func_80BFFE48(EnBomjima* this, PlayState* play) { Math_SmoothStepToS(&this->unk_290, 10000, 1, 5000, 0); if (D_80C009F0 >= 103) { this->unk_2DC = 0; - func_80BFE494(this, 15, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_15, 1.0f); func_80BFE65C(this); this->actionFunc = func_80BFFF54; } @@ -837,22 +896,22 @@ void func_80BFFF54(EnBomjima* this, PlayState* play) { } if (this->unk_2E4 != 4) { - if ((this->animIndex != 0) && (this->animLastFrame <= curFrame)) { + if ((this->animIndex != ENBOMJIMA_ANIM_0) && (curFrame >= this->animEndFrame)) { D_80C009F0++; - func_80BFE494(this, 0, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_0, 1.0f); } - } else if ((this->animIndex != 8) && (this->animLastFrame <= curFrame)) { - func_80BFE494(this, 8, 1.0f); + } else if ((this->animIndex != ENBOMJIMA_ANIM_8) && (curFrame >= this->animEndFrame)) { + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_8, 1.0f); D_80C009F4 = 1; } - if (this->animIndex == 8) { + if (this->animIndex == ENBOMJIMA_ANIM_8) { if ((D_80C009F4 == 1) && Animation_OnFrame(&this->skelAnime, 7.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_HUMAN_BOUND); D_80C009F4 = 2; } - if ((this->animLastFrame <= curFrame) && (this->unk_2C0 == 0)) { + if ((curFrame >= this->animEndFrame) && (this->unk_2C0 == 0)) { this->unk_2C0 = 10; } @@ -864,7 +923,7 @@ void func_80BFFF54(EnBomjima* this, PlayState* play) { void func_80C0011C(EnBomjima* this) { func_80BFE65C(this); - func_80BFE494(this, 0, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_0, 1.0f); this->action = EN_BOMJIMA_ACTION_7; this->actionFunc = func_80C00168; } @@ -894,7 +953,7 @@ void func_80C00168(EnBomjima* this, PlayState* play) { } void func_80C00234(EnBomjima* this) { - func_80BFE494(this, 3, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_3, 1.0f); this->collider.dim.radius = 15; this->collider.dim.height = 40; func_80BFE65C(this); @@ -903,16 +962,16 @@ void func_80C00234(EnBomjima* this) { void func_80C00284(EnBomjima* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 sp28 = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2DC, 1, 5000, 0); if (((this->action == EN_BOMJIMA_ACTION_0) || (this->unk_2C8 == 10) || (this->unk_2C8 == 11) || (this->unk_2CA == 1)) && - (this->animLastFrame <= sp28)) { + (curFrame >= this->animEndFrame)) { if (!(this->unk_2BC & 1)) { - func_80BFE494(this, 3, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_3, 1.0f); } else { - func_80BFE494(this, 16, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_16, 1.0f); } this->unk_2BC++; this->unk_2BC &= 1; @@ -927,6 +986,9 @@ void func_80C00284(EnBomjima* this, PlayState* play) { case PLAYER_FORM_ZORA: this->unk_28E = -0x1770; break; + + default: + break; } if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) { @@ -966,10 +1028,10 @@ void func_80C00284(EnBomjima* this, PlayState* play) { if (this->unk_2C8 == 10) { func_80BFE65C(this); this->unk_28E = 0; - func_80BFE494(this, 1, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_1, 1.0f); this->action = EN_BOMJIMA_ACTION_2; this->actionFunc = func_80BFF174; - return; + break; } this->unk_2C8++; @@ -995,9 +1057,12 @@ void func_80C00284(EnBomjima* this, PlayState* play) { this->actor.textId = D_80C00A8C[this->unk_2C8]; Message_ContinueTextbox(play, this->actor.textId); if (this->unk_2C8 >= 2) { - func_80BFE494(this, 17, 1.0f); + EnBomjima_ChangeAnim(this, ENBOMJIMA_ANIM_17, 1.0f); } break; + + default: + break; } } } @@ -1055,24 +1120,24 @@ void EnBomjima_Update(Actor* thisx, PlayState* play) { s32 EnBomjima_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBomjima* this = THIS; - if (limbIndex == 8) { + if (limbIndex == OBJECT_CS_LIMB_08) { rot->z += this->unk_294; } - if ((limbIndex == 15) && (this->unk_2E6 == 2)) { + if ((limbIndex == OBJECT_CS_LIMB_0F) && (this->unk_2E6 == 2)) { *dList = NULL; } - if (limbIndex == 17) { + if (limbIndex == OBJECT_CS_LIMB_11) { rot->x += this->unk_28A; rot->z += this->unk_288; } - if ((limbIndex == 19) && (this->unk_2E6 == 2)) { + if ((limbIndex == OBJECT_CS_LIMB_13) && (this->unk_2E6 == 2)) { *dList = NULL; } - if ((limbIndex == 20) && (this->unk_2E6 == 0)) { + if ((limbIndex == OBJECT_CS_LIMB_14) && (this->unk_2E6 == 0)) { *dList = NULL; } diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h index b8196b3448..15b4b10fb2 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.h @@ -2,6 +2,7 @@ #define Z_EN_BOMJIMA_H #include "global.h" +#include "objects/object_cs/object_cs.h" struct EnBomjima; @@ -13,8 +14,8 @@ typedef void (*EnBomjimaActionFunc)(struct EnBomjima*, PlayState*); typedef struct EnBomjima { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[21]; - /* 0x206 */ Vec3s morphTable[21]; + /* 0x188 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; + /* 0x206 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX]; /* 0x284 */ EnBomjimaActionFunc actionFunc; /* 0x288 */ s16 unk_288; /* 0x28A */ s16 unk_28A; @@ -38,7 +39,7 @@ typedef struct EnBomjima { /* 0x2C6 */ s16 unk_2C6; /* 0x2C8 */ s16 unk_2C8; /* 0x2CA */ s16 unk_2CA; - /* 0x2CC */ f32 animLastFrame; + /* 0x2CC */ f32 animEndFrame; /* 0x2D0 */ f32 unk_2D0; /* 0x2D4 */ s16 csIdList[2]; /* 0x2D8 */ UNK_TYPE1 unk2D8[4]; // maybe a part of the above? diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c index f82efe6d8f..84b548f996 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.c @@ -6,7 +6,6 @@ #include "z_en_bomjimb.h" #include "overlays/actors/ovl_En_Niw/z_en_niw.h" -#include "objects/object_cs/object_cs.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8) @@ -72,20 +71,81 @@ static ColliderCylinderInit sCylinderInit = { { 20, 30, 0, { 0, 0, 0 } }, }; -static AnimationHeader* sAnimations[] = { - &gBomberIdleAnim, &object_cs_Anim_00FAF4, &object_cs_Anim_0057C8, &object_cs_Anim_0053F4, - &object_cs_Anim_002044, &object_cs_Anim_01007C, &object_cs_Anim_00349C, &object_cs_Anim_004960, - &object_cs_Anim_005128, &object_cs_Anim_004C1C, &object_cs_Anim_002930, &object_cs_Anim_001A1C, - &object_cs_Anim_003EE4, &object_cs_Anim_00478C, &object_cs_Anim_00433C, &object_cs_Anim_0060E8, - &object_cs_Anim_001708, &object_cs_Anim_005DC4, &object_cs_Anim_0026B0, &object_cs_Anim_0036B0, - &object_cs_Anim_0031C4, &object_cs_Anim_010B68, +typedef enum { + /* -1 */ ENBOMJIMB_ANIM_NONE = -1, + /* 0x00 */ ENBOMJIMB_ANIM_0, + /* 0x01 */ ENBOMJIMB_ANIM_1, + /* 0x02 */ ENBOMJIMB_ANIM_2, + /* 0x03 */ ENBOMJIMB_ANIM_3, + /* 0x04 */ ENBOMJIMB_ANIM_4, + /* 0x05 */ ENBOMJIMB_ANIM_5, + /* 0x06 */ ENBOMJIMB_ANIM_6, + /* 0x07 */ ENBOMJIMB_ANIM_7, + /* 0x08 */ ENBOMJIMB_ANIM_8, + /* 0x09 */ ENBOMJIMB_ANIM_9, + /* 0x0A */ ENBOMJIMB_ANIM_10, + /* 0x0B */ ENBOMJIMB_ANIM_11, + /* 0x0C */ ENBOMJIMB_ANIM_12, + /* 0x0D */ ENBOMJIMB_ANIM_13, + /* 0x0E */ ENBOMJIMB_ANIM_14, + /* 0x0F */ ENBOMJIMB_ANIM_15, + /* 0x10 */ ENBOMJIMB_ANIM_16, + /* 0x11 */ ENBOMJIMB_ANIM_17, + /* 0x12 */ ENBOMJIMB_ANIM_18, + /* 0x13 */ ENBOMJIMB_ANIM_19, + /* 0x14 */ ENBOMJIMB_ANIM_20, + /* 0x15 */ ENBOMJIMB_ANIM_21, + /* 0x16 */ ENBOMJIMB_ANIM_MAX +} EnBomjimbAnimation; + +static AnimationHeader* sAnimations[ENBOMJIMB_ANIM_MAX] = { + &gBomberIdleAnim, // ENBOMJIMB_ANIM_0 + &object_cs_Anim_00FAF4, // ENBOMJIMB_ANIM_1 + &object_cs_Anim_0057C8, // ENBOMJIMB_ANIM_2 + &object_cs_Anim_0053F4, // ENBOMJIMB_ANIM_3 + &object_cs_Anim_002044, // ENBOMJIMB_ANIM_4 + &object_cs_Anim_01007C, // ENBOMJIMB_ANIM_5 + &object_cs_Anim_00349C, // ENBOMJIMB_ANIM_6 + &object_cs_Anim_004960, // ENBOMJIMB_ANIM_7 + &object_cs_Anim_005128, // ENBOMJIMB_ANIM_8 + &object_cs_Anim_004C1C, // ENBOMJIMB_ANIM_9 + &object_cs_Anim_002930, // ENBOMJIMB_ANIM_10 + &object_cs_Anim_001A1C, // ENBOMJIMB_ANIM_11 + &object_cs_Anim_003EE4, // ENBOMJIMB_ANIM_12 + &object_cs_Anim_00478C, // ENBOMJIMB_ANIM_13 + &object_cs_Anim_00433C, // ENBOMJIMB_ANIM_14 + &object_cs_Anim_0060E8, // ENBOMJIMB_ANIM_15 + &object_cs_Anim_001708, // ENBOMJIMB_ANIM_16 + &object_cs_Anim_005DC4, // ENBOMJIMB_ANIM_17 + &object_cs_Anim_0026B0, // ENBOMJIMB_ANIM_18 + &object_cs_Anim_0036B0, // ENBOMJIMB_ANIM_19 + &object_cs_Anim_0031C4, // ENBOMJIMB_ANIM_20 + &object_cs_Anim_010B68, // ENBOMJIMB_ANIM_21 }; -static u8 sAnimationModes[] = { - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, - ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, - ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, - ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, +static u8 sAnimationModes[ENBOMJIMB_ANIM_MAX] = { + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_0 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_1 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_2 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_3 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_4 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_5 + ANIMMODE_ONCE, // ENBOMJIMB_ANIM_6 + ANIMMODE_ONCE, // ENBOMJIMB_ANIM_7 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_8 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_9 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_10 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_11 + ANIMMODE_ONCE, // ENBOMJIMB_ANIM_12 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_13 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_14 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_15 + ANIMMODE_ONCE, // ENBOMJIMB_ANIM_16 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_17 + ANIMMODE_ONCE, // ENBOMJIMB_ANIM_18 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_19 + ANIMMODE_LOOP, // ENBOMJIMB_ANIM_20 + ANIMMODE_ONCE, // ENBOMJIMB_ANIM_21 }; void EnBomjimb_Init(Actor* thisx, PlayState* play) { @@ -151,6 +211,9 @@ void EnBomjimb_Init(Actor* thisx, PlayState* play) { return; } break; + + default: + break; } } @@ -174,30 +237,30 @@ void EnBomjimb_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80C0113C(EnBomjimb* this, s32 arg1, f32 arg2) { - this->unk_2DC = arg1; - this->unk_2B8 = Animation_GetLastFrame(sAnimations[arg1]); - Animation_Change(&this->skelAnime, sAnimations[this->unk_2DC], arg2, 0.0f, this->unk_2B8, - sAnimationModes[this->unk_2DC], -4.0f); +void EnBomjimb_ChangeAnim(EnBomjimb* this, s32 animIndex, f32 playSpeed) { + this->animIndex = animIndex; + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], playSpeed, 0.0f, this->animEndFrame, + sAnimationModes[this->animIndex], -4.0f); } void func_80C011CC(EnBomjimb* this) { - if ((this->unk_2DC == 5) && + if ((this->animIndex == ENBOMJIMB_ANIM_5) && (Animation_OnFrame(&this->skelAnime, 9.0f) || Animation_OnFrame(&this->skelAnime, 10.0f) || Animation_OnFrame(&this->skelAnime, 17.0f) || Animation_OnFrame(&this->skelAnime, 18.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2DC == 19) && + if ((this->animIndex == ENBOMJIMB_ANIM_19) && (Animation_OnFrame(&this->skelAnime, 2.0f) || Animation_OnFrame(&this->skelAnime, 6.0f))) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } - if ((this->unk_2DC == 18) && Animation_OnFrame(&this->skelAnime, 15.0f)) { + if ((this->animIndex == ENBOMJIMB_ANIM_18) && Animation_OnFrame(&this->skelAnime, 15.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } - if ((this->unk_2DC == 7) && Animation_OnFrame(&this->skelAnime, 8.0f)) { + if ((this->animIndex == ENBOMJIMB_ANIM_7) && Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_LAND); } } @@ -281,7 +344,7 @@ void func_80C014E4(EnBomjimb* this, PlayState* play) { abs = ABS_ALT(BINANG_SUB(this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &sp48))); if ((abs < 0x4000) && !BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp48, &sp60, &colPoly, true, false, false, true, &sp44)) { - func_80C0113C(this, 5, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_5, 1.0f); Math_Vec3f_Copy(&this->unk_294, &sp48); this->unk_2B0 = Rand_S16Offset(30, 50); this->unk_2CC++; @@ -303,9 +366,9 @@ void func_80C014E4(EnBomjimb* this, PlayState* play) { false, true, &sp44)) { this->unk_2AE = 0; if (Rand_ZeroOne() < 0.5f) { - func_80C0113C(this, 20, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_20, 1.0f); } else { - func_80C0113C(this, 0, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_0, 1.0f); } this->unk_2CC = 0; this->unk_2B4 = 0.0f; @@ -319,9 +382,9 @@ void func_80C014E4(EnBomjimb* this, PlayState* play) { if ((this->unk_2B0 == 0) || (sqrtf(SQ(x) + SQ(z)) < 4.0f)) { this->unk_2AE = Rand_S16Offset(20, 20); if (!(this->unk_2AE & 1)) { - func_80C0113C(this, 20, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_20, 1.0f); } else { - func_80C0113C(this, 0, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_0, 1.0f); } this->unk_2CC = 0; this->unk_2B4 = 0.0f; @@ -331,6 +394,9 @@ void func_80C014E4(EnBomjimb* this, PlayState* play) { Math_ApproachF(&this->unk_2B4, 1.0f, 0.3f, 0.5f); } break; + + default: + break; } if (player->stateFlags3 != PLAYER_STATE3_1000000) { @@ -353,7 +419,7 @@ void func_80C01984(EnBomjimb* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x, this->actor.world.pos.y + 30.0f, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 2); if (this->unk_2E4 != NULL) { - func_80C0113C(this, 11, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_11, 1.0f); } this->unk_2CA = 0; this->actionFunc = func_80C01A24; @@ -425,7 +491,7 @@ void func_80C01C18(EnBomjimb* this, PlayState* play) { } void func_80C01CD0(EnBomjimb* this, PlayState* play) { - f32 sp3C = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; s32 pad[2]; if ((this->unk_2E4 != NULL) && ((this->unk_2E4->update == NULL) || Actor_HasParent(this->unk_2E4, play))) { @@ -436,17 +502,17 @@ void func_80C01CD0(EnBomjimb* this, PlayState* play) { return; } - if (this->unk_2DC != 7) { + if (this->animIndex != ENBOMJIMB_ANIM_7) { Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_294), 1, 3000, 0); Math_ApproachF(&this->actor.world.pos.x, this->unk_294.x, 0.3f, 2.0f); Math_ApproachF(&this->actor.world.pos.z, this->unk_294.z, 0.3f, 2.0f); if (sqrtf(SQ(this->actor.world.pos.x - this->unk_294.x) + SQ(this->actor.world.pos.z - this->unk_294.z)) < 3.0f) { - func_80C0113C(this, 7, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_7, 1.0f); Math_Vec3f_Copy(&this->actor.world.pos, &this->unk_294); } - } else if (this->unk_2B8 <= sp3C) { + } else if (curFrame >= this->animEndFrame) { this->actor.draw = NULL; } @@ -487,7 +553,7 @@ void func_80C01CD0(EnBomjimb* this, PlayState* play) { void func_80C01FD4(EnBomjimb* this) { this->actor.textId = 0x72D; - func_80C0113C(this, 9, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_9, 1.0f); this->unk_2CA = 4; this->actionFunc = func_80C0201C; } @@ -514,7 +580,7 @@ void func_80C0201C(EnBomjimb* this, PlayState* play) { } void func_80C02108(EnBomjimb* this) { - func_80C0113C(this, 6, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_6, 1.0f); this->unk_2D6 = BINANG_ROT180(this->actor.yawTowardsPlayer); this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80C012E0(this); @@ -544,11 +610,11 @@ void func_80C0217C(EnBomjimb* this, PlayState* play) { return; } - if (this->unk_2DC == 6) { + if (this->animIndex == ENBOMJIMB_ANIM_6) { f32 curFrame = this->skelAnime.curFrame; - if (this->unk_2B8 <= curFrame) { - func_80C0113C(this, 19, 2.0f); + if (curFrame >= this->animEndFrame) { + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_19, 2.0f); } return; } @@ -609,7 +675,7 @@ void func_80C0217C(EnBomjimb* this, PlayState* play) { } void func_80C0250C(EnBomjimb* this) { - func_80C0113C(this, 15, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_15, 1.0f); this->unk_2D4 = 0; this->actor.speed = 0.0f; this->unk_2D6 = BINANG_ROT180(this->actor.yawTowardsPlayer); @@ -629,7 +695,7 @@ void func_80C02570(EnBomjimb* this, PlayState* play) { if (this->actor.xzDistToPlayer < 200.0f) { this->unk_2D6 = BINANG_ROT180(this->actor.yawTowardsPlayer); - func_80C0113C(this, 19, 2.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_19, 2.0f); this->actionFunc = func_80C0217C; } else if ((player->stateFlags3 == PLAYER_STATE3_1000000) || (this->actor.xzDistToPlayer > 410.0f)) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 3000, 0); @@ -639,7 +705,7 @@ void func_80C02570(EnBomjimb* this, PlayState* play) { void func_80C0267C(EnBomjimb* this) { func_80C012E0(this); - func_80C0113C(this, 8, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_8, 1.0f); this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->unk_2AE = 40; @@ -662,9 +728,9 @@ void func_80C02740(EnBomjimb* this, PlayState* play) { Player* player = GET_PLAYER(play); func_80C012E0(this); - func_80C0113C(this, 21, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_21, 1.0f); if ((player->transformation != PLAYER_FORM_DEKU) && (player->transformation != PLAYER_FORM_HUMAN)) { - func_80C0113C(this, 17, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_17, 1.0f); Message_StartTextbox(play, 0x72E, &this->actor); player->stateFlags1 |= PLAYER_STATE1_10000000; player->actor.freezeTimer = 3; @@ -676,7 +742,7 @@ void func_80C02740(EnBomjimb* this, PlayState* play) { if (((player->transformation == PLAYER_FORM_DEKU) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_73_10)) || ((player->transformation == PLAYER_FORM_HUMAN) && !CHECK_WEEKEVENTREG(WEEKEVENTREG_85_02))) { - func_80C0113C(this, 17, 1.0f); + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_17, 1.0f); Message_StartTextbox(play, 0x72E, &this->actor); player->stateFlags1 |= PLAYER_STATE1_10000000; player->actor.freezeTimer = 3; @@ -722,6 +788,9 @@ void func_80C02740(EnBomjimb* this, PlayState* play) { SET_WEEKEVENTREG(WEEKEVENTREG_76_10); SET_WEEKEVENTREG(WEEKEVENTREG_11_10); break; + + default: + break; } if (!Play_InCsMode(play)) { @@ -738,15 +807,15 @@ void func_80C02A14(EnBomjimb* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; - if (this->unk_2DC == 21) { + if (this->animIndex == ENBOMJIMB_ANIM_21) { player->actor.freezeTimer = 3; - if (this->unk_2B8 <= curFrame) { - func_80C0113C(this, 9, 1.0f); + if (curFrame >= this->animEndFrame) { + EnBomjimb_ChangeAnim(this, ENBOMJIMB_ANIM_9, 1.0f); } return; } - if ((this->unk_2CA == 8) && (this->unk_2DC == 9)) { + if ((this->unk_2CA == 8) && (this->animIndex == ENBOMJIMB_ANIM_9)) { player->actor.freezeTimer = 3; if (this->unk_2E0 == 0) { if (Animation_OnFrame(&this->skelAnime, 7.0f)) { @@ -756,7 +825,7 @@ void func_80C02A14(EnBomjimb* this, PlayState* play) { } } - if ((this->unk_2DC == 15) && (this->unk_2CA == 8)) { + if ((this->animIndex == ENBOMJIMB_ANIM_15) && (this->unk_2CA == 8)) { player->actor.freezeTimer = 3; } @@ -873,20 +942,20 @@ void EnBomjimb_Update(Actor* thisx, PlayState* play2) { s32 EnBomjimb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { EnBomjimb* this = THIS; - if (limbIndex == 15) { + if (limbIndex == OBJECT_CS_LIMB_0F) { *dList = NULL; } - if (limbIndex == 17) { + if (limbIndex == OBJECT_CS_LIMB_11) { rot->x += this->unk_28A; rot->z += this->unk_288; } - if ((limbIndex == 19) && (this->unk_2C8 != ENBOMJIMB_F_0)) { + if ((limbIndex == OBJECT_CS_LIMB_13) && (this->unk_2C8 != ENBOMJIMB_F_0)) { *dList = NULL; } - if ((limbIndex == 20) && (this->unk_2C8 == ENBOMJIMB_F_0)) { + if ((limbIndex == OBJECT_CS_LIMB_14) && (this->unk_2C8 == ENBOMJIMB_F_0)) { *dList = NULL; } diff --git a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.h b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.h index a784e335d1..9e2bb9cc59 100644 --- a/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.h +++ b/src/overlays/actors/ovl_En_Bomjimb/z_en_bomjimb.h @@ -2,6 +2,7 @@ #define Z_EN_BOMJIMB_H #include "global.h" +#include "objects/object_cs/object_cs.h" struct EnBomjimb; @@ -28,8 +29,8 @@ typedef enum { typedef struct EnBomjimb { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[21]; - /* 0x206 */ Vec3s morphTable[21]; + /* 0x188 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; + /* 0x206 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX]; /* 0x284 */ EnBomjimbActionFunc actionFunc; /* 0x288 */ s16 unk_288; /* 0x28A */ s16 unk_28A; @@ -42,7 +43,7 @@ typedef struct EnBomjimb { /* 0x2B0 */ s16 unk_2B0; /* 0x2B2 */ s16 unk_2B2; /* 0x2B4 */ f32 unk_2B4; - /* 0x2B8 */ f32 unk_2B8; + /* 0x2B8 */ f32 animEndFrame; /* 0x2BC */ UNK_TYPE1 unk2BC[4]; /* 0x2C0 */ s16 unk_2C0; /* 0x2C2 */ s16 unk_2C2; @@ -55,7 +56,7 @@ typedef struct EnBomjimb { /* 0x2D4 */ s16 unk_2D4; /* 0x2D6 */ s16 unk_2D6; /* 0x2D8 */ UNK_TYPE1 unk2D8[4]; - /* 0x2DC */ s32 unk_2DC; + /* 0x2DC */ s32 animIndex; /* 0x2E0 */ u8 unk_2E0; /* 0x2E4 */ Actor* unk_2E4; /* 0x2E8 */ ColliderCylinder collider; diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 333ca42761..7e173bb564 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -180,12 +180,12 @@ void EnBox_Init(Actor* thisx, PlayState* play) { EnBox* this = THIS; s16 csId; CollisionHeader* colHeader; - f32 animFrame; - f32 animFrameEnd; + f32 startFrame; + f32 endFrame; colHeader = NULL; - animFrame = 0.0f; - animFrameEnd = Animation_GetLastFrame(&gBoxChestOpenAnim); + startFrame = 0.0f; + endFrame = Animation_GetLastFrame(&gBoxChestOpenAnim); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gBoxChestCol, &colHeader); @@ -216,7 +216,7 @@ void EnBox_Init(Actor* thisx, PlayState* play) { this->iceSmokeTimer = 100; EnBox_SetupAction(this, EnBox_Open); this->movementFlags |= ENBOX_MOVE_STICK_TO_GROUND; - animFrame = animFrameEnd; + startFrame = endFrame; } else if (((this->type == ENBOX_TYPE_BIG_SWITCH_FLAG_FALL) || (this->type == ENBOX_TYPE_SMALL_SWITCH_FLAG_FALL)) && !Flags_GetSwitch(play, this->switchFlag)) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); @@ -272,7 +272,7 @@ void EnBox_Init(Actor* thisx, PlayState* play) { SkelAnime_Init(play, &this->skelAnime, &gBoxChestSkel, &gBoxChestOpenAnim, this->jointTable, this->morphTable, OBJECT_BOX_CHEST_LIMB_MAX); - Animation_Change(&this->skelAnime, &gBoxChestOpenAnim, 1.5f, animFrame, animFrameEnd, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &gBoxChestOpenAnim, 1.5f, startFrame, endFrame, ANIMMODE_ONCE, 0.0f); if (Actor_IsSmallChest(this)) { Actor_SetScale(&this->dyna.actor, 0.0075f); Actor_SetFocus(&this->dyna.actor, 20.0f); @@ -449,17 +449,17 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) { &gBoxBigChestOpenChildAnim, // PLAYER_FORM_HUMAN }; s32 pad; - AnimationHeader* animHeader; - f32 frameCount; - f32 playbackSpeed; + AnimationHeader* anim; + f32 endFrame; + f32 playSpeed; this->alpha = 255; this->movementFlags |= ENBOX_MOVE_IMMOBILE; if ((this->unk_1EC != 0) && ((this->csId2 < 0) || (CutsceneManager_GetCurrentCsId() == this->csId2) || (CutsceneManager_GetCurrentCsId() == CS_ID_NONE))) { if (this->unk_1EC < 0) { - animHeader = &gBoxChestOpenAnim; - playbackSpeed = 1.5f; + anim = &gBoxChestOpenAnim; + playSpeed = 1.5f; } else { f32 sPlaybackSpeeds[PLAYER_FORM_MAX] = { 1.5f, // PLAYER_FORM_FIERCE_DEITY @@ -469,12 +469,12 @@ void EnBox_WaitOpen(EnBox* this, PlayState* play) { 1.5f, // PLAYER_FORM_HUMAN }; - animHeader = sBigChestAnimations[GET_PLAYER_FORM]; - playbackSpeed = sPlaybackSpeeds[GET_PLAYER_FORM]; + anim = sBigChestAnimations[GET_PLAYER_FORM]; + playSpeed = sPlaybackSpeeds[GET_PLAYER_FORM]; } - frameCount = Animation_GetLastFrame(animHeader); - Animation_Change(&this->skelAnime, animHeader, playbackSpeed, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); + endFrame = Animation_GetLastFrame(anim); + Animation_Change(&this->skelAnime, anim, playSpeed, 0.0f, endFrame, ANIMMODE_ONCE, 0.0f); EnBox_SetupAction(this, EnBox_Open); if (this->unk_1EC > 0) { Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_DEMO_TRE_LGT, @@ -557,8 +557,8 @@ void EnBox_Open(EnBox* this, PlayState* play) { if (sfxId != NA_SE_NONE) { Audio_PlaySfx_AtPos(&this->dyna.actor.projectedPos, sfxId); } - if (this->skelAnime.jointTable[3].z > 0) { - this->unk_1A8 = (0x7D00 - this->skelAnime.jointTable[3].z) * 0.00006f; + if (this->skelAnime.jointTable[OBJECT_BOX_CHEST_LIMB_03].z > 0) { + this->unk_1A8 = (0x7D00 - this->skelAnime.jointTable[OBJECT_BOX_CHEST_LIMB_03].z) * 0.00006f; if (this->unk_1A8 < 0.0f) { this->unk_1A8 = 0.0f; } else if (this->unk_1A8 > 1.0f) { diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index e65e489290..0d7b608230 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -178,7 +178,7 @@ void EnButte_Init(Actor* thisx, PlayState* play) { } SkelAnime_Init(play, &this->skelAnime, &gameplay_field_keep_Skel_002FA0, &gameplay_field_keep_Anim_001D20, - this->jointTable, this->morphTable, 8); + this->jointTable, this->morphTable, BUTTERFLY_LIMB_MAX); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colldierElements); diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.h b/src/overlays/actors/ovl_En_Butte/z_en_butte.h index 4bcaf440c3..b035d2845d 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.h +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.h @@ -2,6 +2,7 @@ #define Z_EN_BUTTE_H #include "global.h" +#include "objects/gameplay_field_keep/gameplay_field_keep.h" struct EnButte; @@ -19,8 +20,8 @@ typedef struct EnButte { /* 0x144 */ ColliderJntSph collider; /* 0x164 */ ColliderJntSphElement colldierElements[1]; /* 0x1A4 */ SkelAnime skelAnime; - /* 0x1E8 */ Vec3s jointTable[8]; - /* 0x218 */ Vec3s morphTable[8]; + /* 0x1E8 */ Vec3s jointTable[BUTTERFLY_LIMB_MAX]; + /* 0x218 */ Vec3s morphTable[BUTTERFLY_LIMB_MAX]; /* 0x248 */ EnButteActionFunc actionFunc; /* 0x24C */ s16 unk_24C; /* 0x24E */ u8 unk_24E; diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.c b/src/overlays/actors/ovl_En_Famos/z_en_famos.c index eb73aecfb6..2fe21ebc74 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.c +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.c @@ -232,9 +232,9 @@ void EnFamos_SetupAttackDebris(EnFamos* this) { rock->velocity.x = randFloat * Math_CosS(randOffset) * Math_SinS(randVelDirection); rock->velocity.y = Math_SinS(randOffset) * randFloat + 3.0f; rock->velocity.z = randFloat * Math_CosS(randOffset) * Math_CosS(randVelDirection); - rock->rotation.x = (s32)Rand_Next() >> 0x10; - rock->rotation.y = (s32)Rand_Next() >> 0x10; - rock->rotation.z = (s32)Rand_Next() >> 0x10; + rock->rot.x = (s32)Rand_Next() >> 0x10; + rock->rot.y = (s32)Rand_Next() >> 0x10; + rock->rot.z = (s32)Rand_Next() >> 0x10; rock->pos.x = (Math_SinS(randVelDirection) * 20.0f) + this->actor.world.pos.x; rock->pos.y = this->actor.floorHeight; rock->pos.z = (Math_CosS(randVelDirection) * 20.0f) + this->actor.world.pos.z; @@ -261,9 +261,9 @@ void EnFamos_SetupDeathDebris(EnFamos* this) { rock->velocity.x = randFloat * Math_CosS(randSmaller) * Math_SinS(randVelDirection); rock->velocity.y = Math_SinS(randSmaller) * randFloat + 4.5f; rock->velocity.z = randFloat * Math_CosS(randSmaller) * Math_CosS(randVelDirection); - rock->rotation.x = (s32)Rand_Next() >> 0x10; - rock->rotation.y = (s32)Rand_Next() >> 0x10; - rock->rotation.z = (s32)Rand_Next() >> 0x10; + rock->rot.x = (s32)Rand_Next() >> 0x10; + rock->rot.y = (s32)Rand_Next() >> 0x10; + rock->rot.z = (s32)Rand_Next() >> 0x10; rock->pos.x = Math_SinS(randVelDirection) * 20.0f + this->actor.world.pos.x; rock->pos.y = Rand_CenteredFloat(60.0f) + (this->actor.world.pos.y + 40.0f); rock->pos.z = Math_CosS(randVelDirection) * 20.0f + this->actor.world.pos.z; @@ -736,9 +736,9 @@ void EnFamos_UpdateDebrisPosRot(EnFamos* this) { for (i = 0; i < ARRAY_COUNT(this->rocks); i++, rock++) { rock->velocity.y -= 1.0f; Math_Vec3f_Sum(&rock->pos, &rock->velocity, &rock->pos); - rock->rotation.x += (s16)((Rand_Next() >> 0x17) + 0x700); - rock->rotation.y += (s16)((Rand_Next() >> 0x17) + 0x900); - rock->rotation.z += (s16)((Rand_Next() >> 0x17) + 0xB00); + rock->rot.x += (s16)((Rand_Next() >> 0x17) + 0x700); + rock->rot.y += (s16)((Rand_Next() >> 0x17) + 0x900); + rock->rot.z += (s16)((Rand_Next() >> 0x17) + 0xB00); } } @@ -842,7 +842,7 @@ void EnFamos_DrawDebris(EnFamos* this, PlayState* play) { rock = &this->rocks[0]; for (i = 0; i < ARRAY_COUNT(this->rocks); i++, rock++) { - Matrix_SetTranslateRotateYXZ(rock->pos.x, rock->pos.y, rock->pos.z, &rock->rotation); + Matrix_SetTranslateRotateYXZ(rock->pos.x, rock->pos.y, rock->pos.z, &rock->rot); Matrix_Scale(rock->scale, rock->scale, rock->scale, MTXMODE_APPLY); gSPMatrix(&dispOpa[3 + i * 2], Matrix_NewMtx(play->state.gfxCtx), diff --git a/src/overlays/actors/ovl_En_Famos/z_en_famos.h b/src/overlays/actors/ovl_En_Famos/z_en_famos.h index 468356376e..955b4b31fd 100644 --- a/src/overlays/actors/ovl_En_Famos/z_en_famos.h +++ b/src/overlays/actors/ovl_En_Famos/z_en_famos.h @@ -11,8 +11,8 @@ typedef void (*EnFamosActionFunc)(struct EnFamos*, PlayState*); typedef struct EnFamosRock { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f velocity; - /* 0x18 */ Vec3s rotation; - /* 0x20 */ f32 scale; + /* 0x18 */ Vec3s rot; + /* 0x20 */ f32 scale; } EnFamosRock; // size = 0x24 #define FAMOS_GET_PATH_INDEX(thisx) ((thisx)->params) diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 93bf9a81b5..99a255ec2c 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -147,7 +147,7 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { s32 i; Collider_InitAndSetCylinder(play, &this->collider, &this->picto.actor, &D_80971D80); - SkelAnime_InitFlex(play, &this->skelanime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, 0, 0, 0); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, 0, 0, 0); this->songSummonDist = KAKASI_GET_SUMMON_DISTANCE(&this->picto.actor) * 20.0f; if (this->songSummonDist < 40.0f) { @@ -197,9 +197,9 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { void EnKakasi_ChangeAnim(EnKakasi* this, s32 animIndex) { this->animIndex = animIndex; - this->animeFrameCount = Animation_GetLastFrame(&sAnimations[this->animIndex]->common); + this->animEndFrame = Animation_GetLastFrame(&sAnimations[this->animIndex]->common); // 1: regular playback speed, 0: starting frame - Animation_Change(&this->skelanime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animeFrameCount, + Animation_Change(&this->skelAnime, sAnimations[this->animIndex], 1.0f, 0.0f, this->animEndFrame, sAnimationModes[this->animIndex], -4.0f); } @@ -209,24 +209,24 @@ s32 EnKakasi_ValidatePictograph(PlayState* play, Actor* thisx) { void EnKakasi_CheckAnimationSfx(EnKakasi* this) { if ((this->animIndex == ENKAKASI_ANIM_SIDEWAYS_SHAKING) || (this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_STILL)) { - if (Animation_OnFrame(&this->skelanime, 1.0f) || Animation_OnFrame(&this->skelanime, 8.0f)) { + if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); } } if ((this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR) || (this->animIndex == ENKAKASI_ANIM_SLOWROLL)) { - if (Animation_OnFrame(&this->skelanime, 4.0f) || Animation_OnFrame(&this->skelanime, 8.0f)) { + if (Animation_OnFrame(&this->skelAnime, 4.0f) || Animation_OnFrame(&this->skelAnime, 8.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASHI_SWING); } - if (Animation_OnFrame(&this->skelanime, 1.0f) || Animation_OnFrame(&this->skelanime, 9.0f) || - Animation_OnFrame(&this->skelanime, 16.0f)) { + if (Animation_OnFrame(&this->skelAnime, 1.0f) || Animation_OnFrame(&this->skelAnime, 9.0f) || + Animation_OnFrame(&this->skelAnime, 16.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_IT_KAKASHI_JUMP); } - if (Animation_OnFrame(&this->skelanime, 18.0f)) { + if (Animation_OnFrame(&this->skelAnime, 18.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASHI_ROLL); } } if ((this->animIndex == ENKAKASI_ANIM_SPIN_REACH_OFFER) || (this->animIndex == ENKAKASI_ANIM_TWIRL)) { - if (Animation_OnFrame(&this->skelanime, 1.0f)) { + if (Animation_OnFrame(&this->skelAnime, 1.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EV_KAKASH_LONGI_ROLL); } } @@ -286,7 +286,7 @@ void func_8096FBB8(EnKakasi* this, PlayState* play) { this->unk190 = 8; } if (this->unk190 != 0) { - Math_ApproachF(&this->skelanime.playSpeed, 1.0f, 0.1f, 0.2f); + Math_ApproachF(&this->skelAnime.playSpeed, 1.0f, 0.1f, 0.2f); this->picto.actor.shape.rot.y += 0x800; } } @@ -330,19 +330,19 @@ void EnKakasi_SetupIdleStanding(EnKakasi* this) { } void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) { - u32 saveContextDay = gSaveContext.save.day; + u32 day = gSaveContext.save.day; s16 x; s16 y; // first talk to scarecrow dialogue this->picto.actor.textId = 0x1644; if (func_800B8718(&this->picto.actor, &play->state)) { - this->skelanime.playSpeed = 1.0f; + this->skelAnime.playSpeed = 1.0f; EnKakasi_SetupSongTeach(this, play); return; } if (Actor_ProcessTalkRequest(&this->picto.actor, &play->state)) { - this->skelanime.playSpeed = 1.0f; + this->skelAnime.playSpeed = 1.0f; EnKakasi_SetupDialogue(this); return; } @@ -352,15 +352,15 @@ void EnKakasi_IdleStanding(EnKakasi* this, PlayState* play) { (y < SCREEN_HEIGHT) && (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING)) { // faster shaking EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); - this->skelanime.playSpeed = 2.0f; + this->skelAnime.playSpeed = 2.0f; } } else if (Player_GetMask(play) == PLAYER_MASK_KAMARO) { if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); - this->skelanime.playSpeed = 2.0f; + this->skelAnime.playSpeed = 2.0f; } - } else if ((saveContextDay == 3) && gSaveContext.save.isNight) { - this->skelanime.playSpeed = 1.0f; + } else if ((day == 3) && gSaveContext.save.isNight) { + this->skelAnime.playSpeed = 1.0f; if (this->animIndex != ENKAKASI_ANIM_SIDEWAYS_SHAKING) { EnKakasi_ChangeAnim(this, 1); } @@ -386,12 +386,12 @@ void EnKakasi_SetupDialogue(EnKakasi* this) { } void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { - u32 saveContextDay = gSaveContext.save.day; - f32 currentAnimeFrame = this->skelanime.curFrame; + u32 day = gSaveContext.save.day; + f32 curFrame = this->skelAnime.curFrame; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 5, 2000, 0); // if first dialogue - if ((this->picto.actor.textId != 0x1644) && (this->animeFrameCount <= currentAnimeFrame) && + if ((this->picto.actor.textId != 0x1644) && (curFrame >= this->animEndFrame) && (this->animIndex == ENKAKASI_ANIM_SLOWROLL)) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); @@ -400,7 +400,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { // if dialogue: oh sorry come back again if ((this->picto.actor.textId == 0x1651) || (this->picto.actor.textId == 0x1659)) { - if ((this->animeFrameCount <= currentAnimeFrame) && (this->animIndex != ENKAKASI_ANIM_SPIN_REACH_OFFER)) { + if ((curFrame >= this->animEndFrame) && (this->animIndex != ENKAKASI_ANIM_SPIN_REACH_OFFER)) { if (++this->unkCounter1A4 >= 2) { this->unkCounter1A4 = 0; EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); @@ -517,7 +517,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, PlayState* play) { this->picto.actor.textId = 0x1658; } else if (this->picto.actor.textId == 0x165C) { this->picto.actor.textId = 0x165E; - } else if ((saveContextDay == 3) && gSaveContext.save.isNight) { + } else if ((day == 3) && gSaveContext.save.isNight) { this->picto.actor.textId = 0x164F; } else { this->picto.actor.textId = 0x1652; @@ -631,7 +631,7 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { } else if (play->msgCtx.ocarinaMode == 3) { // song success this->postTeachTimer = 30; - this->skelanime.playSpeed = 2.0f; + this->skelAnime.playSpeed = 2.0f; EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_HOPPING_REGULAR); this->actionFunc = EnKakasi_PostSongLearnTwirl; } @@ -639,14 +639,13 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { } void EnKakasi_PostSongLearnTwirl(EnKakasi* this, PlayState* play) { - f32 animeFrame = this->skelanime.curFrame; + f32 curFrame = this->skelAnime.curFrame; if ((this->postTeachTimer == 0) && (this->animIndex != ENKAKASI_ANIM_TWIRL)) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_TWIRL); - this->skelanime.playSpeed = 2.0f; + this->skelAnime.playSpeed = 2.0f; } - if ((this->postTeachTimer == 0) && (this->animIndex == ENKAKASI_ANIM_TWIRL) && - (this->animeFrameCount <= animeFrame)) { + if ((this->postTeachTimer == 0) && (this->animIndex == ENKAKASI_ANIM_TWIRL) && (curFrame >= this->animEndFrame)) { EnKakasi_SetupPostSongLearnDialogue(this, play); } } @@ -667,7 +666,7 @@ void EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, PlayState* play) { void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 tempAnimFrame = this->skelanime.curFrame; + f32 curFrame = this->skelAnime.curFrame; Vec3f vec3fCopy; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 1, 3000, 0); @@ -683,7 +682,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { } if ((this->picto.actor.textId == 0x1648) && (this->animIndex == ENKAKASI_ANIM_HOPPING_REGULAR) && - (this->animeFrameCount <= tempAnimFrame)) { + (curFrame >= this->animEndFrame)) { this->unkCounter1A4++; if (this->unkCounter1A4 >= 2) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_ARMS_CROSSED_ROCKING); @@ -691,7 +690,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { } if ((this->picto.actor.textId == 0x164B) && (this->animIndex == ENKAKASI_ANIM_ARMS_CROSSED_ROCKING) && - (this->animeFrameCount <= tempAnimFrame)) { + (curFrame >= this->animEndFrame)) { this->unkCounter1A4++; if (this->unkCounter1A4 >= 2) { EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SPIN_REACH_OFFER); @@ -818,11 +817,10 @@ void EnKakasi_SetupDanceNightAway(EnKakasi* this) { } void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { - f32 currentFrame; + f32 curFrame = this->skelAnime.curFrame; Vec3f localVec3f; Player* player; - currentFrame = this->skelanime.curFrame; EnKakasi_CheckPlayerPosition(this, play); Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.home.rot.y, 1, 3000, 0); this->unk22C.y = this->picto.actor.home.pos.y + 50.0f; @@ -856,7 +854,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { case 1: // end of twirl, start shaking back and forth - if ((this->unk204 == 0) && (this->animeFrameCount <= currentFrame)) { + if ((this->unk204 == 0) && (curFrame >= this->animEndFrame)) { this->unk204 = 0x14; this->unk190++; EnKakasi_ChangeAnim(this, ENKAKASI_ANIM_SIDEWAYS_SHAKING); @@ -1117,7 +1115,7 @@ void EnKakasi_Update(Actor* thisx, PlayState* play) { EnKakasi* this = THIS; s32 pad; - SkelAnime_Update(&this->skelanime); + SkelAnime_Update(&this->skelAnime); if (this->picto.actor.draw != NULL) { EnKakasi_CheckAnimationSfx(this); } @@ -1162,6 +1160,6 @@ void EnKakasi_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r void EnKakasi_Draw(Actor* thisx, PlayState* play) { EnKakasi* this = THIS; Gfx_SetupDL25_Opa(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, NULL, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, EnKakasi_PostLimbDraw, &this->picto.actor); } diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h index cff35d1830..689e475b2d 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h @@ -11,7 +11,7 @@ typedef void (*EnKakasiActionFunc)(struct EnKakasi*, PlayState*); typedef struct EnKakasi { /* 0x000 */ PictoActor picto; /* 0x148 */ EnKakasiActionFunc actionFunc; - /* 0x14C */ SkelAnime skelanime; + /* 0x14C */ SkelAnime skelAnime; /* 0x190 */ s16 unk190; // camera index for song teaching angles? /* 0x192 */ s16 postTeachTimer; /* 0x194 */ s16 aboveGroundStatus; // from params, changed to 2 in init @@ -22,7 +22,7 @@ typedef struct EnKakasi { /* 0x1A8 */ s32 unkState1A8; /* 0x1AC */ s16 talkState; /* 0x1AE */ s16 csIdList[3]; - /* 0x1B4 */ f32 animeFrameCount; + /* 0x1B4 */ f32 animEndFrame; /* 0x1B8 */ f32 unkHeight; /* 0x1BC */ Vec3f unk1BC; // set by post limbdraw func for one limb /* 0x1C8 */ UNK_TYPE1 pad1C8[0x3C]; diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 0e96590d54..d3edbce769 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -108,7 +108,7 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_InitFlex(play, &this->skelanime, &gNiwSkeleton, &gNiwIdleAnim, this->jointTable, this->morphTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gNiwSkeleton, &gNiwIdleAnim, this->jointTable, this->morphTable, NIW_LIMB_MAX); Math_Vec3f_Copy(&this->unk2A4, &this->actor.world.pos); Math_Vec3f_Copy(&this->unk2B0, &this->actor.world.pos); @@ -331,7 +331,7 @@ void EnNiw_UpdateRunning(EnNiw* this, PlayState* play, s32 isStormCucco) { } void EnNiw_SetupIdle(EnNiw* this) { - Animation_Change(&this->skelanime, &gNiwIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwIdleAnim), ANIMMODE_LOOP, + Animation_Change(&this->skelAnime, &gNiwIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwIdleAnim), ANIMMODE_LOOP, -10.0f); this->niwState = NIW_STATE_IDLE; this->actionFunc = EnNiw_Idle; @@ -636,7 +636,7 @@ void EnNiw_CuccoStorm(EnNiw* this, PlayState* play) { } void EnNiw_SetupRunAway(EnNiw* this) { - Animation_Change(&this->skelanime, &gNiwIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwIdleAnim), ANIMMODE_LOOP, + Animation_Change(&this->skelAnime, &gNiwIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gNiwIdleAnim), ANIMMODE_LOOP, -10.0f); this->isRunningRight = Rand_ZeroFloat(1.99f); this->niwState = NIW_STATE_RUNNING; @@ -943,7 +943,7 @@ void EnNiw_Draw(Actor* thisx, PlayState* play) { EnNiw* this = THIS; Gfx_SetupDL25_Opa(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->skelanime.skeleton, this->skelanime.jointTable, this->skelanime.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnNiw_OverrideLimbDraw, NULL, &this->actor); EnNiw_DrawFeathers(this, play); } diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.h b/src/overlays/actors/ovl_En_Niw/z_en_niw.h index 06f4878003..769a67c17a 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -24,7 +24,7 @@ typedef struct { typedef struct EnNiw { /* 0x000 */ Actor actor; - /* 0x144 */ SkelAnime skelanime; + /* 0x144 */ SkelAnime skelAnime; /* 0x188 */ Vec3s jointTable[NIW_LIMB_MAX]; /* 0x1E8 */ Vec3s morphTable[NIW_LIMB_MAX]; /* 0x248 */ EnNiwActionFunc actionFunc; diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 43b61cfb4b..f4e938d44a 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -1228,7 +1228,7 @@ void EnPoSisters_Draw(Actor* thisx, PlayState* play) { Matrix_Put(&this->mtxf); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(POLY_OPA_DISP++, gPoeSistersDrawTorchDL); + gSPDisplayList(POLY_OPA_DISP++, gPoeSistersTorchDL); } gSPSegment( diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.c b/src/overlays/actors/ovl_En_Raf/z_en_raf.c index db0ee5e82e..ebede99a3f 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.c +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.c @@ -896,9 +896,9 @@ void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* acc effect->accel = *accel; effect->scale = scale; effect->timer = timer; - effect->rotation.x = Rand_CenteredFloat(30000.0f); - effect->rotation.y = Rand_CenteredFloat(30000.0f); - effect->rotation.z = Rand_CenteredFloat(30000.0f); + effect->rot.x = Rand_CenteredFloat(30000.0f); + effect->rot.y = Rand_CenteredFloat(30000.0f); + effect->rot.z = Rand_CenteredFloat(30000.0f); return; } } @@ -913,9 +913,9 @@ void EnRaf_UpdateEffects(EnRaf* this, PlayState* play) { effect->pos.x += effect->velocity.x; effect->pos.y += effect->velocity.y; effect->pos.z += effect->velocity.z; - effect->rotation.x += 0xBB8; - effect->rotation.y += 0xBB8; - effect->rotation.z += 0xBB8; + effect->rot.x += 0xBB8; + effect->rot.y += 0xBB8; + effect->rot.z += 0xBB8; effect->velocity.x += effect->accel.x; effect->velocity.y += effect->accel.y; effect->velocity.z += effect->accel.z; @@ -954,9 +954,9 @@ void EnRaf_DrawEffects(EnRaf* this, PlayState* play) { if (effect->isEnabled) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); - Matrix_RotateXS(effect->rotation.x, MTXMODE_APPLY); - Matrix_RotateYS(effect->rotation.y, MTXMODE_APPLY); - Matrix_RotateZS(effect->rotation.z, MTXMODE_APPLY); + Matrix_RotateXS(effect->rot.x, MTXMODE_APPLY); + Matrix_RotateYS(effect->rot.y, MTXMODE_APPLY); + Matrix_RotateZS(effect->rot.z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gCarnivorousLilyPadParticleDL); diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.h b/src/overlays/actors/ovl_En_Raf/z_en_raf.h index f4659f48be..a025046ab3 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.h +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.h @@ -23,7 +23,7 @@ typedef struct { /* 0x04 */ Vec3f pos; /* 0x10 */ Vec3f velocity; /* 0x1C */ Vec3f accel; - /* 0x28 */ Vec3s rotation; + /* 0x28 */ Vec3s rot; /* 0x30 */ f32 scale; /* 0x34 */ s16 timer; } EnRafEffect; // size = 0x38 diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 61418e6564..39c385914c 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -9057,7 +9057,7 @@ 0x809C467C:("EnEncount4_Update",), 0x809C4790:("EnBomBowlMan_Init",), 0x809C492C:("EnBomBowlMan_Destroy",), - 0x809C493C:("func_809C493C",), + 0x809C493C:("EnBomBowlMan_ChangeAnim",), 0x809C49CC:("func_809C49CC",), 0x809C4B50:("func_809C4B50",), 0x809C4B6C:("func_809C4B6C",), @@ -16454,7 +16454,7 @@ 0x80BFE170:("EnBomjima_Init",), 0x80BFE300:("EnBomjima_Destroy",), 0x80BFE32C:("func_80BFE32C",), - 0x80BFE494:("func_80BFE494",), + 0x80BFE494:("EnBomjima_ChangeAnim",), 0x80BFE524:("func_80BFE524",), 0x80BFE65C:("func_80BFE65C",), 0x80BFE67C:("func_80BFE67C",), @@ -16487,7 +16487,7 @@ 0x80C008B4:("EnBomjima_Draw",), 0x80C00EA0:("EnBomjimb_Init",), 0x80C01110:("EnBomjimb_Destroy",), - 0x80C0113C:("func_80C0113C",), + 0x80C0113C:("EnBomjimb_ChangeAnim",), 0x80C011CC:("func_80C011CC",), 0x80C012E0:("func_80C012E0",), 0x80C012FC:("func_80C012FC",), @@ -16519,7 +16519,7 @@ 0x80C03034:("EnBomjimb_Draw",), 0x80C03530:("EnBombers_Init",), 0x80C037F8:("EnBombers_Destroy",), - 0x80C03824:("func_80C03824",), + 0x80C03824:("EnBombers_ChangeAnim",), 0x80C038B4:("func_80C038B4",), 0x80C039A8:("func_80C039A8",), 0x80C03ACC:("func_80C03ACC",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 6c743d181b..6d6a74981e 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -9784,7 +9784,7 @@ 0x809C6104:("D_809C6104","UNK_TYPE4","",0x4), 0x809C6108:("En_Bom_Bowl_Man_InitVars","UNK_TYPE1","",0x1), 0x809C6128:("D_809C6128","UNK_TYPE1","",0x1), - 0x809C6178:("D_809C6178","UNK_TYPE1","",0x1), + 0x809C6178:("sAnimationModes","UNK_TYPE1","",0x1), 0x809C618C:("D_809C618C","UNK_TYPE2","",0x2), 0x809C6198:("D_809C6198","UNK_TYPE2","",0x2), 0x809C61A0:("D_809C61A0","UNK_TYPE1","",0x1), @@ -16174,7 +16174,7 @@ 0x80C00A70:("D_80C00A70","UNK_TYPE1","",0x1), 0x80C00A8C:("D_80C00A8C","UNK_TYPE1","",0x1), 0x80C00A94:("D_80C00A94","UNK_TYPE1","",0x1), - 0x80C00AE4:("D_80C00AE4","UNK_TYPE1","",0x1), + 0x80C00AE4:("sAnimationModes","UNK_TYPE1","",0x1), 0x80C00AF8:("D_80C00AF8","UNK_TYPE2","",0x2), 0x80C00B08:("D_80C00B08","UNK_TYPE1","",0x1), 0x80C00B18:("D_80C00B18","UNK_TYPE1","",0x1), @@ -16202,8 +16202,8 @@ 0x80C032C8:("jtbl_80C032C8","UNK_PTR","",0x4), 0x80C04750:("En_Bombers_InitVars","UNK_TYPE1","",0x1), 0x80C04770:("D_80C04770","UNK_TYPE1","",0x1), - 0x80C0479C:("D_80C0479C","UNK_TYPE1","",0x1), - 0x80C047E0:("D_80C047E0","UNK_TYPE1","",0x1), + 0x80C0479C:("sAnimations","UNK_TYPE1","",0x1), + 0x80C047E0:("sAnimationModes","UNK_TYPE1","",0x1), 0x80C047F8:("D_80C047F8","UNK_TYPE1","",0x1), 0x80C04808:("D_80C04808","UNK_TYPE1","",0x1), 0x80C04818:("D_80C04818","UNK_PTR","",0x4),