From 0c5107580a39f1b685ddd3c84a285a19176311bc Mon Sep 17 00:00:00 2001 From: mzxrules Date: Sun, 21 Dec 2025 03:31:08 -0500 Subject: [PATCH] name limb rotation vars --- .../ovl_En_Attack_Niw/z_en_attack_niw.c | 164 ++++++++---------- .../ovl_En_Attack_Niw/z_en_attack_niw.h | 33 ++-- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 155 +++++++++-------- src/overlays/actors/ovl_En_Niw/z_en_niw.h | 26 ++- 4 files changed, 197 insertions(+), 181 deletions(-) diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index a7fd550149..fd0e84fc43 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -85,14 +85,14 @@ void EnAttackNiw_Destroy(Actor* thisx, PlayState* play) { void func_809B5268(EnAttackNiw* this, PlayState* play, s16 arg2) { if (this->unk_254 == 0) { if (arg2 == 0) { - this->unk_264 = 0.0f; + this->limb13TargetRotY = 0.0f; } else { - this->unk_264 = -10000.0f; + this->limb13TargetRotY = -10000.0f; } this->unk_28E++; this->unk_254 = 3; if ((this->unk_28E & 1) == 0) { - this->unk_264 = 0.0f; + this->limb13TargetRotY = 0.0f; if (arg2 == 0) { this->unk_254 = Rand_ZeroFloat(30.0f); } @@ -104,35 +104,33 @@ void func_809B5268(EnAttackNiw* this, PlayState* play, s16 arg2) { this->unk_292 &= 1; switch (arg2) { case 0: - this->unk_26C = 0.0f; - this->unk_268 = 0.0f; + this->limb11TargetRotZ = this->limb7TargetRotZ = 0.0f; break; case 1: this->unk_258 = 3; - this->unk_26C = 7000.0f; - this->unk_268 = 7000.0f; + this->limb11TargetRotZ = this->limb7TargetRotZ = 7000.0f; + if (this->unk_292 == 0) { - this->unk_26C = 0.0f; - this->unk_268 = 0.0f; + this->limb11TargetRotZ = this->limb7TargetRotZ = 0.0f; } break; case 2: this->unk_258 = 2; - this->unk_268 = this->unk_26C = -10000.0f; - this->unk_280 = this->unk_278 = 25000.0f; - this->unk_284 = this->unk_27C = 6000.0f; + this->limb11TargetRotZ = this->limb7TargetRotZ = -10000.0f; + this->limb7TargetRotY = this->limb11TargetRotY = 25000.0f; + this->limb7TargetRotX = this->limb11TargetRotX = 6000.0f; if (this->unk_292 == 0) { - this->unk_278 = 8000.0f; - this->unk_280 = 8000.0f; + this->limb11TargetRotY = 8000.0f; + this->limb7TargetRotY = 8000.0f; } break; case 3: this->unk_258 = 2; - this->unk_278 = 10000.0f; - this->unk_280 = 10000.0f; + this->limb11TargetRotY = 10000.0f; + this->limb7TargetRotY = 10000.0f; if (this->unk_292 == 0) { - this->unk_278 = 3000.0f; - this->unk_280 = 3000.0f; + this->limb11TargetRotY = 3000.0f; + this->limb7TargetRotY = 3000.0f; } break; case 4: @@ -140,39 +138,39 @@ void func_809B5268(EnAttackNiw* this, PlayState* play, s16 arg2) { break; case 5: this->unk_258 = 5; - this->unk_278 = 14000.0f; - this->unk_280 = 14000.0f; + this->limb11TargetRotY = 14000.0f; + this->limb7TargetRotY = 14000.0f; if (this->unk_292 == 0) { - this->unk_278 = 10000.0f; - this->unk_280 = 10000.0f; + this->limb11TargetRotY = 10000.0f; + this->limb7TargetRotY = 10000.0f; } break; } } - if (this->unk_288 != this->unk_2C0) { - Math_ApproachF(&this->unk_2C0, this->unk_288, 0.5f, 4000.0f); + if (this->limb15TargetRotY != this->limb15RotY) { + Math_ApproachF(&this->limb15RotY, this->limb15TargetRotY, 0.5f, 4000.0f); } - if (this->unk_264 != this->unk_2BC) { - Math_ApproachF(&this->unk_2BC, this->unk_264, 0.5f, 4000.0f); + if (this->limb13TargetRotY != this->limb13RotY) { + Math_ApproachF(&this->limb13RotY, this->limb13TargetRotY, 0.5f, 4000.0f); } - if (this->unk_26C != this->unk_2A4.x) { - Math_ApproachF(&this->unk_2A4.x, this->unk_26C, 0.8f, 7000.0f); + if (this->limb7TargetRotZ != this->limb7RotZ) { + Math_ApproachF(&this->limb7RotZ, this->limb7TargetRotZ, 0.8f, 7000.0f); } - if (this->unk_280 != this->unk_2A4.y) { - Math_ApproachF(&this->unk_2A4.y, this->unk_280, 0.8f, 7000.0f); + if (this->limb7TargetRotY != this->limb7RotY) { + Math_ApproachF(&this->limb7RotY, this->limb7TargetRotY, 0.8f, 7000.0f); } - if (this->unk_284 != this->unk_2A4.z) { - Math_ApproachF(&this->unk_2A4.z, this->unk_284, 0.8f, 7000.0f); + if (this->limb7TargetRotX != this->limb7RotX) { + Math_ApproachF(&this->limb7RotX, this->limb7TargetRotX, 0.8f, 7000.0f); } - if (this->unk_268 != this->unk_2B0.x) { - Math_ApproachF(&this->unk_2B0.x, this->unk_268, 0.8f, 7000.0f); + if (this->limb11TargetRotZ != this->limb11RotZ) { + Math_ApproachF(&this->limb11RotZ, this->limb11TargetRotZ, 0.8f, 7000.0f); } - if (this->unk_278 != this->unk_2B0.y) { - Math_ApproachF(&this->unk_2B0.y, this->unk_278, 0.8f, 7000.0f); + if (this->limb11TargetRotY != this->limb11RotY) { + Math_ApproachF(&this->limb11RotY, this->limb11TargetRotY, 0.8f, 7000.0f); } - if (this->unk_27C != this->unk_2B0.z) { - Math_ApproachF(&this->unk_2B0.z, this->unk_27C, 0.8f, 7000.0f); + if (this->limb11TargetRotX != this->limb11RotX) { + Math_ApproachF(&this->limb11RotX, this->limb11TargetRotX, 0.8f, 7000.0f); } } @@ -222,13 +220,13 @@ void func_809B5670(EnAttackNiw* this, PlayState* play) { this->unk_2D4 = this->actor.yawTowardsPlayer; this->unk_2D0 = this->actor.world.rot.x - 3000.0f; this->unk_2DC = 0.0f; - this->unk_284 = 0.0f; - this->unk_27C = 0.0f; + this->limb7TargetRotX = 0.0f; + this->limb11TargetRotX = 0.0f; this->unk_254 = this->unk_256 = this->unk_258 = this->unk_25A = 0; - this->unk_25C = 0x64; + this->unk_25C = 100; this->actor.gravity = -0.2f; this->unk_2E0 = 5.0f; - this->unk_288 = 0.0f; + this->limb15TargetRotY = 0.0f; this->actionFunc = func_809B59B0; } else if (((this->actor.projectedPos.z > 0.0f) && (fabsf(sp34.x - this->actor.world.pos.x) < 50.0f) && (fabsf(sp34.y - this->actor.world.pos.y) < 50.0f) && @@ -238,17 +236,17 @@ void func_809B5670(EnAttackNiw* this, PlayState* play) { this->unk_2D4 = this->actor.yawTowardsPlayer; this->unk_2D0 = this->actor.world.rot.x - 2000.0f; this->unk_2DC = 0.0f; - this->unk_27C = 0.0f; - this->unk_284 = 0.0f; + this->limb11TargetRotX = 0.0f; + this->limb7TargetRotX = 0.0f; this->unk_254 = this->unk_256 = this->unk_258 = this->unk_25A = 0; this->actor.gravity = -0.2f; this->unk_2E0 = 5.0f; - this->unk_288 = 0.0f; + this->limb15TargetRotY = 0.0f; this->actionFunc = func_809B59B0; } else { this->unk_254 = 10; - this->unk_264 = -10000.0f; - this->unk_288 = -3000.0f; + this->limb13TargetRotY = -10000.0f; + this->limb15TargetRotY = -3000.0f; func_809B5268(this, play, 2); } } @@ -265,15 +263,16 @@ void func_809B59B0(EnAttackNiw* this, PlayState* play) { this->actor.velocity.y = 3.5f; } if (this->actor.gravity != -2.0f) { - this->unk_280 = this->unk_278 = 14000.0f; - this->unk_2D0 = this->unk_26C = this->unk_268 = this->unk_284 = this->unk_27C = 0.0f; + this->limb7TargetRotY = this->limb11TargetRotY = 14000.0f; + this->unk_2D0 = this->limb7TargetRotZ = this->limb11TargetRotZ = this->limb7TargetRotX = + this->limb11TargetRotX = 0.0f; this->unk_2D4 = this->actor.yawTowardsPlayer; - this->unk_262 = 0x32; - this->unk_25C = 0x64; + this->unk_262 = 50; + this->unk_25C = 100; this->actor.gravity = -2.0f; } } - if (this->unk_25C == 0x32) { + if (this->unk_25C == 50) { this->unk_2D4 = Rand_CenteredFloat(200.0f) + this->actor.yawTowardsPlayer; } Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2D4, 2, this->unk_2DC, 0); @@ -313,27 +312,13 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) { PlayState* play2 = play; this->unk_28C++; - if (this->unk_254 != 0) { - this->unk_254--; - } - if (this->unk_258 != 0) { - this->unk_258--; - } - if (this->unk_25A != 0) { - this->unk_25A--; - } - if (this->unk_25E != 0) { - this->unk_25E--; - } - if (this->unk_260 != 0) { - this->unk_260--; - } - if (this->unk_25C != 0) { - this->unk_25C--; - } - if (this->unk_262 != 0) { - this->unk_262--; - } + DECR(this->unk_254); + DECR(this->unk_258); + DECR(this->unk_25A); + DECR(this->unk_25E); + DECR(this->unk_260); + DECR(this->unk_25C); + DECR(this->unk_262); this->actor.shape.rot = this->actor.world.rot; this->actor.shape.shadowScale = 15.0f; @@ -354,12 +339,12 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) { } if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actionFunc != func_809B5C18)) { - Vec3f sp30; + Vec3f splashPos; s32 pad; - Math_Vec3f_Copy(&sp30, &this->actor.world.pos); - sp30.y += this->actor.depthInWater; - EffectSsGSplash_Spawn(play, &sp30, NULL, NULL, 0, 0x190); + Math_Vec3f_Copy(&splashPos, &this->actor.world.pos); + splashPos.y += this->actor.depthInWater; + EffectSsGSplash_Spawn(play, &splashPos, NULL, NULL, 0, 400); this->unk_2DC = 0.0f; this->actor.gravity = 0.0f; this->unk_2E0 = 0.0f; @@ -373,6 +358,9 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) { cucco = (EnNiw*)this->actor.parent; if ((this->actor.parent->update != NULL) && (this->actor.parent != NULL) && (cucco != NULL) && (cucco->timer9 == 0) && + //! @bug In certain scenarios like getting cornered against the wall, the PLAYER_STATE1_26 will be flushed + //! before the player has regained control of Link. This can result in the player being softlocked by a cucco + //! attack. #if OOT_VERSION < NTSC_1_1 !(player->stateFlags1 & PLAYER_STATE1_26) #else @@ -380,7 +368,7 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) { #endif ) { Actor_SetPlayerKnockbackLarge(play, &this->actor, 2.0f, this->actor.world.rot.y, 0.0f, 0x10); - cucco->timer9 = 0x46; + cucco->timer9 = 70; } } if (this->unk_25E == 0) { @@ -393,25 +381,25 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) { } } -s32 func_809B5F98(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnAttackNiw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnAttackNiw* this = (EnAttackNiw*)thisx; Vec3f sp0 = { 0.0f, 0.0f, 0.0f }; if (limbIndex == 13) { - rot->y += (s16)this->unk_2BC; + rot->y += (s16)this->limb13RotY; } if (limbIndex == 15) { - rot->z += (s16)this->unk_2C0; + rot->z += (s16)this->limb15RotY; } if (limbIndex == 11) { - rot->x += (s16)this->unk_2B0.z; - rot->y += (s16)this->unk_2B0.y; - rot->z += (s16)this->unk_2B0.x; + rot->x += (s16)this->limb11RotX; + rot->y += (s16)this->limb11RotY; + rot->z += (s16)this->limb11RotZ; } if (limbIndex == 7) { - rot->x += (s16)this->unk_2A4.z; - rot->y += (s16)this->unk_2A4.y; - rot->z += (s16)this->unk_2A4.x; + rot->x += (s16)this->limb7RotX; + rot->y += (s16)this->limb7RotY; + rot->z += (s16)this->limb7RotZ; } return 0; } @@ -421,5 +409,5 @@ void EnAttackNiw_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_809B5F98, NULL, this); + EnAttackNiw_OverrideLimbDraw, NULL, this); } diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h index d460a43d9f..1d6d48f2c3 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.h @@ -22,15 +22,17 @@ typedef struct EnAttackNiw { /* 0x025E */ s16 unk_25E; /* 0x0260 */ s16 unk_260; /* 0x0262 */ s16 unk_262; - /* 0x0264 */ f32 unk_264; - /* 0x0268 */ f32 unk_268; - /* 0x026C */ f32 unk_26C; - /* 0x0270 */ char unk_270[0x8]; - /* 0x0278 */ f32 unk_278; - /* 0x027C */ f32 unk_27C; - /* 0x0280 */ f32 unk_280; - /* 0x0284 */ f32 unk_284; - /* 0x0284 */ f32 unk_288; + + /* 0x0264 */ f32 limb13TargetRotY; + /* 0x0268 */ f32 limb11TargetRotZ; + /* 0x026C */ f32 limb7TargetRotZ; + /* 0x0270 */ f32 unused_270[2]; //part of an array starting at 0x264 + /* 0x0278 */ f32 limb11TargetRotY; + /* 0x027C */ f32 limb11TargetRotX; + /* 0x0280 */ f32 limb7TargetRotY; + /* 0x0284 */ f32 limb7TargetRotX; + /* 0x0284 */ f32 limb15TargetRotY; + /* 0x028C */ s16 unk_28C; /* 0x028E */ s16 unk_28E; /* 0x0290 */ char unk_290[0x2]; @@ -38,10 +40,15 @@ typedef struct EnAttackNiw { /* 0x0294 */ char unk_294[0x2]; /* 0x0296 */ s16 unk_296; /* 0x0298 */ Vec3f unk_298; - /* 0x02A4 */ Vec3f unk_2A4; - /* 0x02B0 */ Vec3f unk_2B0; - /* 0x02BC */ f32 unk_2BC; - /* 0x02C0 */ f32 unk_2C0; + + /* 0x02A4 */ f32 limb7RotZ; + /* 0x02A8 */ f32 limb7RotY; + /* 0x02AC */ f32 limb7RotX; + /* 0x02B0 */ f32 limb11RotZ; + /* 0x02B4 */ f32 limb11RotY; + /* 0x02B8 */ f32 limb11RotX; + /* 0x02BC */ f32 limb13RotY; + /* 0x02C0 */ f32 limb15RotY; /* 0x02C4 */ char unk_2C4[0xC]; /* 0x02D0 */ f32 unk_2D0; /* 0x02D4 */ f32 unk_2D4; 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 7b6eb9c54b..389e99e1e5 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -94,7 +94,7 @@ static s16 sKakarikoFlagList[] = { static u8 sLowerRiverSpawned = false; static u8 sUpperRiverSpawned = false; -static ColliderCylinderInit sCylinderInit1 = { +static ColliderCylinderInit sAttackableBodyCylinderInit = { { COL_MATERIAL_HIT5, AT_NONE, @@ -114,7 +114,7 @@ static ColliderCylinderInit sCylinderInit1 = { { 15, 25, 4, { 0, 0, 0 } }, }; -static ColliderCylinderInit sCylinderInit2 = { +static ColliderCylinderInit sNpcBodyCylinderInit = { { COL_MATERIAL_NONE, AT_NONE, @@ -250,13 +250,13 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { FALLTHROUGH; case EN_NIW_TYPE_SUPER_CUCCO: case EN_NIW_TYPE_TALON_CUCCO: - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit2); + Collider_SetCylinder(play, &this->collider, &this->actor, &sNpcBodyCylinderInit); if (play->sceneId == SCENE_LINKS_HOUSE && !GET_EVENTCHKINF(EVENTCHKINF_HORSE_RACE_COW_UNLOCK)) { Actor_Kill(&this->actor); } break; default: - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit1); + Collider_SetCylinder(play, &this->collider, &this->actor, &sAttackableBodyCylinderInit); break; } @@ -280,14 +280,14 @@ void func_80AB5BF8(EnNiw* this, PlayState* play, s16 arg2) { } if (this->timer1 == 0) { if (arg2 == 0) { - this->unk_26C[0] = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB13_TARGET_ROT_Y] = 0.0f; } else { - this->unk_26C[0] = -10000.0f * factor; + this->unk_26C[OBJECT_NIW_LIMB13_TARGET_ROT_Y] = -10000.0f * factor; } this->unk_298++; this->timer1 = 3; if (!(this->unk_298 & 1)) { - this->unk_26C[0] = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB13_TARGET_ROT_Y] = 0.0f; if (arg2 == 0) { this->timer1 = Rand_ZeroFloat(30.0f); @@ -300,32 +300,36 @@ void func_80AB5BF8(EnNiw* this, PlayState* play, s16 arg2) { switch (arg2) { case 0: - this->unk_26C[1] = this->unk_26C[2] = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Z] = this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Z] = 0.0f; break; case 1: this->timer2 = 3; - this->unk_26C[1] = this->unk_26C[2] = 7000.0f * factor; + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Z] = this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Z] = + 7000.0f * factor; if (this->unk_29C == 0) { - this->unk_26C[1] = this->unk_26C[2] = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Z] = this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Z] = 0.0f; } break; case 2: this->timer2 = 2; - this->unk_26C[1] = this->unk_26C[2] = -10000.0f; - this->unk_26C[7] = this->unk_26C[5] = 25000.0f; - this->unk_26C[8] = this->unk_26C[6] = 6000.0f; + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Z] = this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Z] = + -10000.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y] = this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y] = 25000.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_X] = this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_X] = 6000.0f; if (this->unk_29C == 0) { - this->unk_26C[5] = this->unk_26C[7] = 8000.0f; + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y] = this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y] = + 8000.0f; } break; case 3: this->timer2 = 2; - this->unk_26C[7] = this->unk_26C[5] = 10000.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y] = this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y] = 10000.0f; if (this->unk_29C == 0) { - this->unk_26C[7] = this->unk_26C[5] = 3000.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y] = this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y] = + 3000.0f; } break; case 4: @@ -333,36 +337,37 @@ void func_80AB5BF8(EnNiw* this, PlayState* play, s16 arg2) { break; case 5: this->timer2 = 5; - this->unk_26C[7] = this->unk_26C[5] = 14000.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y] = this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y] = 14000.0f; if (this->unk_29C == 0) { - this->unk_26C[7] = this->unk_26C[5] = 10000.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y] = this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y] = + 10000.0f; } break; } } - if (this->unk_2E0 != this->unk_26C[9]) { - Math_ApproachF(&this->unk_2E0, this->unk_26C[9], 0.5f, 4000.0f); + if (this->limb15RotY != this->unk_26C[OBJECT_NIW_LIMB15_TARGET_ROT_Y]) { + Math_ApproachF(&this->limb15RotY, this->unk_26C[OBJECT_NIW_LIMB15_TARGET_ROT_Y], 0.5f, 4000.0f); } - if (this->unk_2DC != this->unk_26C[0]) { - Math_ApproachF(&this->unk_2DC, this->unk_26C[0], 0.5f, 4000.0f); + if (this->limb13RotY != this->unk_26C[OBJECT_NIW_LIMB13_TARGET_ROT_Y]) { + Math_ApproachF(&this->limb13RotY, this->unk_26C[OBJECT_NIW_LIMB13_TARGET_ROT_Y], 0.5f, 4000.0f); } - if (this->unk_2C4 != this->unk_26C[2]) { - Math_ApproachF(&this->unk_2C4, this->unk_26C[2], 0.8f, 7000.0f); + if (this->limb7RotZ != this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Z]) { + Math_ApproachF(&this->limb7RotZ, this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Z], 0.8f, 7000.0f); } - if (this->unk_2C8 != this->unk_26C[7]) { - Math_ApproachF(&this->unk_2C8, this->unk_26C[7], 0.8f, 7000.0f); + if (this->limb7RotY != this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y]) { + Math_ApproachF(&this->limb7RotY, this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y], 0.8f, 7000.0f); } - if (this->unk_2CC != this->unk_26C[8]) { - Math_ApproachF(&this->unk_2CC, this->unk_26C[8], 0.8f, 7000.0f); + if (this->limb7RotX != this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_X]) { + Math_ApproachF(&this->limb7RotX, this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_X], 0.8f, 7000.0f); } - if (this->unk_2D0 != this->unk_26C[1]) { - Math_ApproachF(&this->unk_2D0, this->unk_26C[1], 0.8f, 7000.0f); + if (this->limb11RotZ != this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Z]) { + Math_ApproachF(&this->limb11RotZ, this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Z], 0.8f, 7000.0f); } - if (this->unk_2D4 != this->unk_26C[5]) { - Math_ApproachF(&this->unk_2D4, this->unk_26C[5], 0.8f, 7000.0f); + if (this->limb11RotY != this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y]) { + Math_ApproachF(&this->limb11RotY, this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y], 0.8f, 7000.0f); } - if (this->unk_2D8 != this->unk_26C[6]) { - Math_ApproachF(&this->unk_2D8, this->unk_26C[6], 0.8f, 7000.0f); + if (this->limb11RotX != this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_X]) { + Math_ApproachF(&this->limb11RotX, this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_X], 0.8f, 7000.0f); } } @@ -462,8 +467,9 @@ void EnNiw_SuperCuccoFallingIntoPosition(EnNiw* this, PlayState* play) { this->unk_2AC.z = this->unk_2B8.z = this->actor.world.pos.z; this->timer5 = this->timer4 = this->unk_29E = 0; - this->unk_26C[7] = this->unk_26C[5] = this->unk_26C[6] = this->unk_26C[8] = this->actor.speed = this->unk_2FC = - this->unk_300 = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y] = this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y] = + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_X] = this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_X] = + this->actor.speed = this->unk_2FC = this->unk_300 = 0.0f; this->actionFunc = EnNiw_IdleWalk; } else { @@ -535,7 +541,7 @@ void EnNiw_IdleWalk(EnNiw* this, PlayState* play) { this->unk_2E6++; this->unk_2E6 &= 1; } - Math_ApproachF(&this->unk_26C[9], D_80AB8604[this->unk_2E6], 0.5f, 4000.0f); + Math_ApproachF(&this->unk_26C[OBJECT_NIW_LIMB15_TARGET_ROT_Y], D_80AB8604[this->unk_2E6], 0.5f, 4000.0f); } if (this->timer5 == 0 && this->timer4 == 0) { @@ -585,7 +591,7 @@ void EnNiw_IdleWalk(EnNiw* this, PlayState* play) { } if (this->timer4 != 0) { - Math_ApproachZeroF(&this->unk_26C[9], 0.5f, 4000.0f); + Math_ApproachZeroF(&this->unk_26C[OBJECT_NIW_LIMB15_TARGET_ROT_Y], 0.5f, 4000.0f); tmp = 1; Math_ApproachF(&this->actor.world.pos.x, this->unk_2B8.x, 1.0f, this->unk_2FC); Math_ApproachF(&this->actor.world.pos.z, this->unk_2B8.z, 1.0f, this->unk_2FC); @@ -623,8 +629,9 @@ void func_80AB6A38(EnNiw* this, PlayState* play) { this->unk_2AC.y = this->unk_2B8.y = this->actor.world.pos.y; this->unk_2AC.z = this->unk_2B8.z = this->actor.world.pos.z; this->timer5 = this->timer4 = this->unk_29E = 0; - this->unk_26C[7] = this->unk_26C[5] = this->unk_26C[6] = this->unk_26C[8] = this->actor.speed = this->unk_2FC = - this->unk_300 = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y] = this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y] = + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_X] = this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_X] = + this->actor.speed = this->unk_2FC = this->unk_300 = 0.0f; this->actionFunc = EnNiw_ResetAction; } else { path = &play->pathList[pathIndex]; @@ -684,8 +691,9 @@ void EnNiw_PlayerReleased(EnNiw* this, PlayState* play) { this->unk_2AC.z = this->unk_2B8.z = this->actor.world.pos.z; this->timer5 = this->timer4 = this->unk_29E = 0; - this->unk_26C[7] = this->unk_26C[5] = this->unk_26C[6] = this->unk_26C[8] = this->actor.speed = - this->unk_2FC = this->unk_300 = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y] = this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y] = + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_X] = this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_X] = + this->actor.speed = this->unk_2FC = this->unk_300 = 0.0f; this->actionFunc = EnNiw_ResetAction; return; @@ -809,13 +817,13 @@ void func_80AB714C(EnNiw* this, PlayState* play) { this->sfxTimer1 = 100; if (this->timer5 == 40) { - this->unk_26C[0] = 10000.0f; - this->unk_26C[7] = 14000.0f; - this->unk_26C[5] = 14000.0f; - this->unk_26C[6] = 0.0f; - this->unk_26C[8] = 0.0f; - this->unk_26C[1] = 0.0f; - this->unk_26C[2] = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB13_TARGET_ROT_Y] = 10000.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y] = 14000.0f; + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y] = 14000.0f; + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_X] = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_X] = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Z] = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Z] = 0.0f; this->timer1 = 10; Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); } @@ -859,8 +867,9 @@ void EnNiw_FleePlayer(EnNiw* this, PlayState* play) { this->unk_2AC.y = this->unk_2B8.y = this->actor.world.pos.y; this->unk_2AC.z = this->unk_2B8.z = this->actor.world.pos.z; this->timer5 = this->timer4 = this->unk_29E = 0; - this->unk_26C[7] = this->unk_26C[5] = this->unk_26C[6] = this->unk_26C[8] = this->actor.speed = this->unk_2FC = - this->unk_300 = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y] = this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y] = + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_X] = this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_X] = + this->actor.speed = this->unk_2FC = this->unk_300 = 0.0f; if (this->actor.params == EN_NIW_TYPE_KAKARIKO_CRATE) { this->actor.params = EN_NIW_TYPE_0; } @@ -916,7 +925,7 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { this->unk_294++; if (this->actionFunc != EnNiw_IdleWalk) { - this->unk_26C[9] = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB15_TARGET_ROT_Y] = 0.0f; } if (this->unk_2A6) { featherCount = 20; @@ -1025,14 +1034,14 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { this->unk_2F0.z = 0.0f; this->unk_2F0.y = 0.0f; this->unk_2F0.x = 0.0f; - this->unk_2D8 = 0.0f; - this->unk_2D4 = 0.0f; - this->unk_2D0 = 0.0f; - this->unk_2CC = 0.0f; - this->unk_2C8 = 0.0f; - this->unk_2C4 = 0.0f; - this->unk_2DC = 0.0f; - this->unk_2E0 = 0.0f; + this->limb11RotX = 0.0f; + this->limb11RotY = 0.0f; + this->limb11RotZ = 0.0f; + this->limb7RotX = 0.0f; + this->limb7RotY = 0.0f; + this->limb7RotZ = 0.0f; + this->limb13RotY = 0.0f; + this->limb15RotY = 0.0f; this->isAngry = this->unk_294 = this->unk_298 = this->unk_2A6 = this->unk_29E = this->unk_2A0 = this->unk_2A2 = 0; @@ -1072,10 +1081,10 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { thisx->speed = 0.0f; this->unk_2FC = 0.0f; this->unk_300 = 0.0f; - this->unk_26C[7] = 0.0f; - this->unk_26C[5] = 0.0f; - this->unk_26C[6] = 0.0f; - this->unk_26C[8] = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_Y] = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_Y] = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB11_TARGET_ROT_X] = 0.0f; + this->unk_26C[OBJECT_NIW_LIMB7_TARGET_ROT_X] = 0.0f; this->sfxTimer1 = 10000; this->isAngry = true; this->unk_2AC.x = this->unk_2B8.x = thisx->world.pos.x; @@ -1088,6 +1097,8 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { dist = 20.0f; + //! @bug In certain scenarios like getting cornered against the wall, the PLAYER_STATE1_26 will be flushed before + //! the player has regained control of Link. This can result in the player being softlocked by a Cucco attack. #if OOT_VERSION < NTSC_1_1 if (this->isAngry && thisx->xyzDistToPlayerSq < SQ(dist) && !(player->stateFlags1 & PLAYER_STATE1_26)) #else @@ -1132,20 +1143,20 @@ s32 EnNiw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; if (limbIndex == 13) { - rot->y += (s16)this->unk_2DC; + rot->y += (s16)this->limb13RotY; } if (limbIndex == 15) { - rot->y += (s16)this->unk_2E0; + rot->y += (s16)this->limb15RotY; } if (limbIndex == 11) { - rot->x += (s16)this->unk_2D8; - rot->y += (s16)this->unk_2D4; - rot->z += (s16)this->unk_2D0; + rot->x += (s16)this->limb11RotX; + rot->y += (s16)this->limb11RotY; + rot->z += (s16)this->limb11RotZ; } if (limbIndex == 7) { - rot->x += (s16)this->unk_2CC; - rot->y += (s16)this->unk_2C8; - rot->z += (s16)this->unk_2C4; + rot->x += (s16)this->limb7RotX; + rot->y += (s16)this->limb7RotY; + rot->z += (s16)this->limb7RotZ; } return false; 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 e711fcccb9..f392fec5a1 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -56,7 +56,17 @@ typedef struct EnNiw { /* 0x0266 */ s16 timer7; /* 0x0268 */ s16 timer8; /* 0x026A */ s16 timer9; + /* 0x026C */ f32 unk_26C[10]; +#define OBJECT_NIW_LIMB13_TARGET_ROT_Y 0 +#define OBJECT_NIW_LIMB11_TARGET_ROT_Z 1 +#define OBJECT_NIW_LIMB7_TARGET_ROT_Z 2 +#define OBJECT_NIW_LIMB11_TARGET_ROT_Y 5 +#define OBJECT_NIW_LIMB11_TARGET_ROT_X 6 +#define OBJECT_NIW_LIMB7_TARGET_ROT_Y 7 +#define OBJECT_NIW_LIMB7_TARGET_ROT_X 8 +#define OBJECT_NIW_LIMB15_TARGET_ROT_Y 9 + /* 0x0294 */ s16 unk_294; /* 0x0296 */ s16 unk_296; /* 0x0298 */ s16 unk_298; @@ -71,14 +81,14 @@ typedef struct EnNiw { /* 0x02AA */ s16 kakarikoIdx; // identifier for Kakariko cuccos /* 0x02AC */ Vec3f unk_2AC; /* 0x02B8 */ Vec3f unk_2B8; - /* 0x02C4 */ f32 unk_2C4; - /* 0x02C8 */ f32 unk_2C8; - /* 0x02CC */ f32 unk_2CC; - /* 0x02D0 */ f32 unk_2D0; - /* 0x02D4 */ f32 unk_2D4; - /* 0x02D8 */ f32 unk_2D8; - /* 0x02DC */ f32 unk_2DC; - /* 0x02E0 */ f32 unk_2E0; + /* 0x02C4 */ f32 limb7RotZ; + /* 0x02C8 */ f32 limb7RotY; + /* 0x02CC */ f32 limb7RotX; + /* 0x02D0 */ f32 limb11RotZ; + /* 0x02D4 */ f32 limb11RotY; + /* 0x02D8 */ f32 limb11RotX; + /* 0x02DC */ f32 limb13RotY; + /* 0x02E0 */ f32 limb15RotY; /* 0x02E4 */ s16 unk_2E4; /* 0x02E6 */ s16 unk_2E6; /* 0x02E8 */ s16 path;