From 4b6fcc9079a45801475ab57c0f82831b9c3cbc63 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Thu, 5 Jun 2025 15:50:05 -0400 Subject: [PATCH 1/2] cucco doc pass --- include/z64actor.h | 2 +- include/z64save.h | 2 +- src/code/z_actor.c | 18 +- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 202 +++++++++--------- src/overlays/actors/ovl_En_Niw/z_en_niw.h | 24 ++- .../actors/ovl_En_Niw_Lady/z_en_niw_lady.c | 18 +- src/overlays/actors/ovl_En_Ta/z_en_ta.c | 23 +- 7 files changed, 155 insertions(+), 134 deletions(-) diff --git a/include/z64actor.h b/include/z64actor.h index 14defad5ee..17665e30e1 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -754,7 +754,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, struct PlayState* play, f32 distanc s32 Actor_IsLockedOn(struct PlayState* play, Actor* actor); s32 Actor_OtherIsLockedOn(struct PlayState* play, Actor* actor); f32 func_80033AEC(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5); -void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, struct PlayState* play); +void func_80033C30(Vec3f* pos, Vec3f* scale, u8 alpha, struct PlayState* play); void Actor_RequestQuake(struct PlayState* play, s16 y, s16 duration); void Actor_RequestQuakeWithSpeed(struct PlayState* play, s16 y, s16 duration, s16 speed); void Actor_RequestQuakeAndRumble(Actor* actor, struct PlayState* play, s16 quakeY, s16 quakeDuration); diff --git a/include/z64save.h b/include/z64save.h index 71b1414052..2fdaa8775d 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -875,7 +875,7 @@ typedef enum LinkAge { #define INFTABLE_198 0x198 // INFTABLE 0x199-0x19F -#define INFTABLE_INDEX_199_19A_19B_19C_19D_19E_19F 25 +#define INFTABLE_INDEX_KAKARIKO_CUCCO 25 #define INFTABLE_199 0x199 #define INFTABLE_19A 0x19A #define INFTABLE_19B 0x19B diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 15138b3e5a..c24e1f1aa5 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -4036,8 +4036,8 @@ f32 func_80033AEC(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4, f32 ar return ret; } -void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) { - MtxF sp60; +void func_80033C30(Vec3f* pos, Vec3f* scale, u8 alpha, PlayState* play) { + MtxF shadowMtxF; f32 yIntersect; Vec3f checkPos; CollisionPoly* groundPoly; @@ -4048,20 +4048,20 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, alpha); - checkPos.x = arg0->x; - checkPos.y = arg0->y + 1.0f; - checkPos.z = arg0->z; + checkPos.x = pos->x; + checkPos.y = pos->y + 1.0f; + checkPos.z = pos->z; yIntersect = BgCheck_EntityRaycastDown2(play, &play->colCtx, &groundPoly, &checkPos); if (groundPoly != NULL) { - func_80038A28(groundPoly, arg0->x, yIntersect, arg0->z, &sp60); - Matrix_Put(&sp60); + func_80038A28(groundPoly, pos->x, yIntersect, pos->z, &shadowMtxF); + Matrix_Put(&shadowMtxF); } else { - Matrix_Translate(arg0->x, arg0->y, arg0->z, MTXMODE_NEW); + Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_NEW); } - Matrix_Scale(arg1->x, 1.0f, arg1->z, MTXMODE_APPLY); + Matrix_Scale(scale->x, 1.0f, scale->z, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_actor.c", 8149); gSPDisplayList(POLY_OPA_DISP++, gCircleShadowDL); 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 71cc497e10..991d4f8292 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -39,24 +39,24 @@ void EnNiw_Update(Actor* thisx, PlayState* play); void EnNiw_Draw(Actor* thisx, PlayState* play); void EnNiw_ResetAction(EnNiw* this, PlayState* play); -void func_80AB6324(EnNiw* this, PlayState* play); -void func_80AB63A8(EnNiw* this, PlayState* play); -void func_80AB6450(EnNiw* this, PlayState* play); -void func_80AB6570(EnNiw* this, PlayState* play); +void EnNiw_IdleSuperCucco(EnNiw* this, PlayState* play); +void EnNiw_SuperCuccoFallingIntoPosition(EnNiw* this, PlayState* play); +void EnNiw_IdleKakarikoCrate(EnNiw* this, PlayState* play); +void EnNiw_IdleWalk(EnNiw* this, PlayState* play); void func_80AB6A38(EnNiw* this, PlayState* play); -void func_80AB6BF8(EnNiw* this, PlayState* play); -void func_80AB6D08(EnNiw* this, PlayState* play); -void func_80AB6EB4(EnNiw* this, PlayState* play); -void func_80AB70F8(EnNiw* this, PlayState* play); +void EnNiw_PlayerCarrying(EnNiw* this, PlayState* play); +void EnNiw_PlayerReleased(EnNiw* this, PlayState* play); +void EnNiw_PlayerReleaseSuperCucco(EnNiw* this, PlayState* play); +void EnNiw_AngryCutsceneWait(EnNiw* this, PlayState* play); void func_80AB714C(EnNiw* this, PlayState* play); -void func_80AB7204(EnNiw* this, PlayState* play); -void func_80AB7290(EnNiw* this, PlayState* play); -void func_80AB7328(EnNiw* this, PlayState* play); +void EnNiw_SetupAttackPlayer(EnNiw* this, PlayState* play); +void EnNiw_SetupFleePlayer(EnNiw* this, PlayState* play); +void EnNiw_FleePlayer(EnNiw* this, PlayState* play); void EnNiw_SpawnFeather(EnNiw* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, f32 scale); void EnNiw_UpdateEffects(EnNiw* this, PlayState* play); void EnNiw_DrawEffects(EnNiw* this, PlayState* play); -static s16 D_80AB85E0 = 0; +static s16 sHasAttackStarted = false; ActorProfile En_Niw_Profile = { /**/ ACTOR_EN_NIW, @@ -92,7 +92,6 @@ static s16 sKakarikoFlagList[] = { }; static u8 sLowerRiverSpawned = false; - static u8 sUpperRiverSpawned = false; static ColliderCylinderInit sCylinderInit1 = { @@ -147,11 +146,11 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { s32 i; if (this->actor.params < 0) { - this->actor.params = 0; + this->actor.params = EN_NIW_TYPE_0; } // Cucco at at the very beginning of Zora's River - if (this->actor.params == 0xB) { + if (this->actor.params == EN_NIW_TYPE_ZORA_RIVER_LOWER) { if (sLowerRiverSpawned) { Actor_Kill(&this->actor); PRINTF(VT_FGCOL(YELLOW) @@ -163,7 +162,7 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { } // Cucco at tall platform in the first room of Zora's River - if (this->actor.params == 0xC) { + if (this->actor.params == EN_NIW_TYPE_ZORA_RIVER_UPPER) { if (sUpperRiverSpawned) { Actor_Kill(&this->actor); PRINTF(VT_FGCOL(YELLOW) @@ -183,14 +182,13 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { for (i = 0; i < ARRAY_COUNT(sKakarikoPosList); i++) { if (fabsf(this->actor.world.pos.x - sKakarikoPosList[i].x) < 40.0f && fabsf(this->actor.world.pos.z - sKakarikoPosList[i].z) < 40.0f) { - this->unk_2AA = i; - PRINTF(VT_FGCOL(YELLOW) T(" 通常鶏index %d\n", " Normal chicken index %d\n") VT_RST, this->unk_2AA); - if (gSaveContext.save.info.infTable[INFTABLE_INDEX_199_19A_19B_19C_19D_19E_19F] & - sKakarikoFlagList[i]) { + this->kakarikoIdx = i; + PRINTF(VT_FGCOL(YELLOW) T(" 通常鶏index %d\n", " Normal chicken index %d\n") VT_RST, this->kakarikoIdx); + if (gSaveContext.save.info.infTable[INFTABLE_INDEX_KAKARIKO_CUCCO] & sKakarikoFlagList[i]) { this->actor.world.pos.x = 300.0f; this->actor.world.pos.y = 100.0f; this->actor.world.pos.z = 1530.0f; - this->actor.params = 0; + this->actor.params = EN_NIW_TYPE_0; } } } @@ -200,46 +198,46 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { Math_Vec3f_Copy(&this->unk_2B8, &this->actor.world.pos); this->unk_304 = 10.0f; Actor_SetScale(&this->actor, 0.01f); - this->unk_2A4 = (s16)Rand_ZeroFloat(3.99f) + 5; + this->health = (s16)Rand_ZeroFloat(3.99f) + 5; - if (this->unk_2A4 < 0) { - this->unk_2A4 = 1; + if (this->health < 0) { + this->health = 1; } switch (this->actor.params) { - case 2: + case EN_NIW_TYPE_2: if (IS_DAY) { Actor_Kill(&this->actor); } break; - case 1: + case EN_NIW_TYPE_1: if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { Actor_Kill(&this->actor); } break; - case 3: + case EN_NIW_TYPE_3: if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) { Actor_Kill(&this->actor); } break; - case 5: + case EN_NIW_TYPE_5: if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { Actor_Kill(&this->actor); } break; - case 7: + case EN_NIW_TYPE_7: if (!GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) { Actor_Kill(&this->actor); } break; - case 0xD: + case EN_NIW_TYPE_SUPER_CUCCO: this->actor.gravity = 0.0f; FALLTHROUGH; - case 0xE: + case EN_NIW_TYPE_TALON_CUCCO: this->actor.colChkInfo.mass = 0; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; break; - case 4: + case EN_NIW_TYPE_KAKARIKO_CRATE: this->actor.gravity = 0.0f; break; } @@ -247,11 +245,11 @@ void EnNiw_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); switch (this->actor.params) { - case 0xA: + case EN_NIW_TYPE_A: this->actor.colChkInfo.mass = MASS_IMMOVABLE; FALLTHROUGH; - case 0xD: - case 0xE: + case EN_NIW_TYPE_SUPER_CUCCO: + case EN_NIW_TYPE_TALON_CUCCO: Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit2); if (play->sceneId == SCENE_LINKS_HOUSE && !GET_EVENTCHKINF(EVENTCHKINF_HORSE_RACE_COW_UNLOCK)) { Actor_Kill(&this->actor); @@ -277,7 +275,7 @@ void EnNiw_Destroy(Actor* thisx, PlayState* play) { void func_80AB5BF8(EnNiw* this, PlayState* play, s16 arg2) { f32 factor = 1.0f; - if (this->actor.params == 0xD) { + if (this->actor.params == EN_NIW_TYPE_SUPER_CUCCO) { factor = 2.0f; } if (this->timer1 == 0) { @@ -436,28 +434,28 @@ void EnNiw_ResetAction(EnNiw* this, PlayState* play) { -10.0f); switch (this->actor.params) { - case 4: - this->actionFunc = func_80AB6450; + case EN_NIW_TYPE_KAKARIKO_CRATE: + this->actionFunc = EnNiw_IdleKakarikoCrate; break; - case 0xD: - this->actionFunc = func_80AB6324; + case EN_NIW_TYPE_SUPER_CUCCO: + this->actionFunc = EnNiw_IdleSuperCucco; break; default: - this->actionFunc = func_80AB6570; + this->actionFunc = EnNiw_IdleWalk; break; } } -void func_80AB6324(EnNiw* this, PlayState* play) { - if (this->unk_308 != 0) { +void EnNiw_IdleSuperCucco(EnNiw* this, PlayState* play) { + if (this->isSuperCuccoThrown) { this->actor.velocity.y = Rand_ZeroFloat(2.0f) + 4.0f; this->actor.speed = Rand_ZeroFloat(2.0f) + 3.0f; - this->actionFunc = func_80AB63A8; + this->actionFunc = EnNiw_SuperCuccoFallingIntoPosition; } func_80AB5BF8(this, play, 1); } -void func_80AB63A8(EnNiw* this, PlayState* play) { +void EnNiw_SuperCuccoFallingIntoPosition(EnNiw* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && this->actor.velocity.y < 0.0f) { this->unk_2AC.x = this->unk_2B8.x = this->actor.world.pos.x; this->unk_2AC.y = this->unk_2B8.y = this->actor.world.pos.y; @@ -467,19 +465,19 @@ void func_80AB63A8(EnNiw* this, PlayState* play) { 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->actionFunc = func_80AB6570; + this->actionFunc = EnNiw_IdleWalk; } else { func_80AB5BF8(this, play, 2); } } -void func_80AB6450(EnNiw* this, PlayState* play) { +void EnNiw_IdleKakarikoCrate(EnNiw* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->actor.xzDistToPlayer < 30.0f && fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 5.0f) { this->timer6 = 100; this->actor.gravity = -2.0f; - this->actionFunc = func_80AB7290; + this->actionFunc = EnNiw_SetupFleePlayer; } else if (Actor_HasParent(&this->actor, play)) { this->actor.gravity = -2.0f; Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); @@ -488,7 +486,7 @@ void func_80AB6450(EnNiw* this, PlayState* play) { this->timer4 = 30; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.speed = 0.0f; - this->actionFunc = func_80AB6BF8; + this->actionFunc = EnNiw_PlayerCarrying; } else { // GI_NONE in this case allows the player to lift the actor Actor_OfferGetItem(&this->actor, play, GI_NONE, 25.0f, 10.0f); @@ -496,13 +494,13 @@ void func_80AB6450(EnNiw* this, PlayState* play) { } } -void func_80AB6570(EnNiw* this, PlayState* play) { +void EnNiw_IdleWalk(EnNiw* this, PlayState* play) { s32 pad[2]; f32 posY = Rand_CenteredFloat(100.0f); f32 posZ = Rand_CenteredFloat(100.0f); s16 tmp; - if (this->actor.params != 0xA) { + if (this->actor.params != EN_NIW_TYPE_A) { if (Actor_HasParent(&this->actor, play)) { Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); this->sfxTimer1 = 30; @@ -510,7 +508,7 @@ void func_80AB6570(EnNiw* this, PlayState* play) { this->timer4 = 30; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.speed = 0.0f; - this->actionFunc = func_80AB6BF8; + this->actionFunc = EnNiw_PlayerCarrying; return; } Actor_OfferCarry(&this->actor, play); @@ -546,7 +544,7 @@ void func_80AB6570(EnNiw* this, PlayState* play) { if (this->unk_29E >= 8) { this->timer5 = Rand_ZeroFloat(30.0f); this->unk_29E = Rand_ZeroFloat(3.99f); - if (this->actor.params != 0xA && this->actor.params != 8) { + if (this->actor.params != EN_NIW_TYPE_A && this->actor.params != EN_NIW_TYPE_8) { if (posY < 0.0f) { posY -= 100.0f; } else { @@ -648,7 +646,7 @@ void func_80AB6A38(EnNiw* this, PlayState* play) { } } -void func_80AB6BF8(EnNiw* this, PlayState* play) { +void EnNiw_PlayerCarrying(EnNiw* this, PlayState* play) { if (this->timer4 == 0) { this->unk_2A6 = 2; this->timer4 = 10; @@ -659,10 +657,10 @@ void func_80AB6BF8(EnNiw* this, PlayState* play) { this->actor.shape.rot.z = Rand_CenteredFloat(5000.0f); if (Actor_HasNoParent(&this->actor, play)) { - if (this->actor.params == 0xD) { + if (this->actor.params == EN_NIW_TYPE_SUPER_CUCCO) { this->sfxTimer1 = 0; this->unk_2A6 = 1; - this->actionFunc = func_80AB6EB4; + this->actionFunc = EnNiw_PlayerReleaseSuperCucco; this->actor.velocity.y = 4.0f; return; } @@ -670,17 +668,17 @@ void func_80AB6BF8(EnNiw* this, PlayState* play) { this->actor.shape.rot.y = this->actor.shape.rot.z; this->actor.shape.rot.x = this->actor.shape.rot.z; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - this->actionFunc = func_80AB6D08; + this->actionFunc = EnNiw_PlayerReleased; } func_80AB5BF8(this, play, 2); } -void func_80AB6D08(EnNiw* this, PlayState* play) { +void EnNiw_PlayerReleased(EnNiw* this, PlayState* play) { if (this->path == 0) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { return; } - if (this->actor.params == 0xE) { + if (this->actor.params == EN_NIW_TYPE_TALON_CUCCO) { this->unk_2AC.x = this->unk_2B8.x = this->actor.world.pos.x; 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; @@ -707,7 +705,7 @@ void func_80AB6D08(EnNiw* this, PlayState* play) { this->timer6 = 100; this->timer4 = 0; this->path = 0; - this->actionFunc = func_80AB7290; + this->actionFunc = EnNiw_SetupFleePlayer; return; } } @@ -719,7 +717,7 @@ void func_80AB6D08(EnNiw* this, PlayState* play) { this->timer4 = 30; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.speed = 0.0f; - this->actionFunc = func_80AB6BF8; + this->actionFunc = EnNiw_PlayerCarrying; } else { if (this->timer5 >= 6) { Actor_OfferCarry(&this->actor, play); @@ -728,7 +726,7 @@ void func_80AB6D08(EnNiw* this, PlayState* play) { } } -void func_80AB6EB4(EnNiw* this, PlayState* play) { +void EnNiw_PlayerReleaseSuperCucco(EnNiw* this, PlayState* play) { if (this->actor.world.pos.y > 400.0f) { Actor_Kill(&this->actor); } @@ -739,7 +737,7 @@ void func_80AB6EB4(EnNiw* this, PlayState* play) { void func_80AB6F04(EnNiw* this, PlayState* play) { Vec3f pos; - if (this->unk_2A8 != 0) { + if (this->isAngry) { EnNiw_SpawnAttackCucco(this, play); } @@ -776,10 +774,10 @@ void func_80AB6F04(EnNiw* this, PlayState* play) { this->timer6 = 100; this->timer4 = 0; this->actor.velocity.y = 0.0f; - if (this->unk_2A8 == 0) { - this->actionFunc = func_80AB7290; + if (!this->isAngry) { + this->actionFunc = EnNiw_SetupFleePlayer; } else { - this->actionFunc = func_80AB7204; + this->actionFunc = EnNiw_SetupAttackPlayer; } } } @@ -787,14 +785,14 @@ void func_80AB6F04(EnNiw* this, PlayState* play) { func_80AB5BF8(this, play, 2); } -void func_80AB70A0(EnNiw* this, PlayState* play) { +void EnNiw_AngryCutsceneStart(EnNiw* this, PlayState* play) { OnePointCutscene_Init(play, 2290, -99, &this->actor, CAM_ID_MAIN); this->timer5 = 100; this->unk_2A2 = 1; - this->actionFunc = func_80AB70F8; + this->actionFunc = EnNiw_AngryCutsceneWait; } -void func_80AB70F8(EnNiw* this, PlayState* play) { +void EnNiw_AngryCutsceneWait(EnNiw* this, PlayState* play) { this->sfxTimer1 = 100; if (this->timer5 == 0) { @@ -825,13 +823,13 @@ void func_80AB714C(EnNiw* this, PlayState* play) { this->timer7 = 10; this->unk_2E4 = this->actor.yawTowardsPlayer; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->actionFunc = func_80AB7204; + this->actionFunc = EnNiw_SetupAttackPlayer; } func_80AB5BF8(this, play, this->unk_2A2); } -void func_80AB7204(EnNiw* this, PlayState* play) { +void EnNiw_SetupAttackPlayer(EnNiw* this, PlayState* play) { EnNiw_SpawnAttackCucco(this, play); if (this->timer7 < 2) { @@ -845,15 +843,15 @@ void func_80AB7204(EnNiw* this, PlayState* play) { } } -void func_80AB7290(EnNiw* this, PlayState* play) { +void EnNiw_SetupFleePlayer(EnNiw* this, PlayState* play) { Animation_Change(&this->skelAnime, &gCuccoAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gCuccoAnim), ANIMMODE_LOOP, -10.0f); this->unk_2A0 = Rand_ZeroFloat(1.99f); this->actor.speed = 4.0f; - this->actionFunc = func_80AB7328; + this->actionFunc = EnNiw_FleePlayer; } -void func_80AB7328(EnNiw* this, PlayState* play) { +void EnNiw_FleePlayer(EnNiw* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->timer6 == 0) { @@ -863,8 +861,8 @@ void func_80AB7328(EnNiw* this, PlayState* play) { 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; - if (this->actor.params == 4) { - this->actor.params = 0; + if (this->actor.params == EN_NIW_TYPE_KAKARIKO_CRATE) { + this->actor.params = EN_NIW_TYPE_0; } this->actionFunc = EnNiw_ResetAction; } else { @@ -877,24 +875,24 @@ void func_80AB7328(EnNiw* this, PlayState* play) { void func_80AB7420(EnNiw* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk_2A4 = (s16)Rand_ZeroFloat(3.99f) + 5; + this->health = (s16)Rand_ZeroFloat(3.99f) + 5; this->actionFunc = EnNiw_ResetAction; } } void func_80AB747C(EnNiw* this, PlayState* play) { - if (this->unk_2A8 == 0 && this->actor.params != 0xA && this->actionFunc != func_80AB6450 && + if (this->isAngry == 0 && this->actor.params != EN_NIW_TYPE_A && this->actionFunc != EnNiw_IdleKakarikoCrate && this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; this->sfxTimer1 = 30; - if (this->unk_2A4 > 0 && D_80AB85E0 == 0) { - this->unk_2A4--; + if (this->health > 0 && sHasAttackStarted == false) { + this->health--; } this->unk_2A6 = 1; Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); this->timer6 = 100; this->path = 0; - this->actionFunc = func_80AB7290; + this->actionFunc = EnNiw_SetupFleePlayer; } } @@ -917,7 +915,7 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { this->unk_294++; - if (this->actionFunc != func_80AB6570) { + if (this->actionFunc != EnNiw_IdleWalk) { this->unk_26C[9] = 0.0f; } if (this->unk_2A6) { @@ -972,7 +970,8 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->actor, this->unk_304); Actor_MoveXZGravity(&this->actor); - if (this->actionFunc != func_80AB6EB4 && this->actionFunc != func_80AB6450 && play->sceneId != SCENE_ZORAS_RIVER) { + if (this->actionFunc != EnNiw_PlayerReleaseSuperCucco && this->actionFunc != EnNiw_IdleKakarikoCrate && + play->sceneId != SCENE_ZORAS_RIVER) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); @@ -1034,20 +1033,21 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { this->unk_2C4 = 0.0f; this->unk_2DC = 0.0f; this->unk_2E0 = 0.0f; - this->unk_2A8 = this->unk_294 = this->unk_298 = this->unk_2A6 = this->unk_29E = this->unk_2A0 = this->unk_2A2 = + this->isAngry = this->unk_294 = this->unk_298 = this->unk_2A6 = this->unk_29E = this->unk_2A0 = this->unk_2A2 = 0; for (i = 0; i < ARRAY_COUNT(this->unk_26C); i++) { this->unk_26C[i] = 0; } - this->unk_2A8 = 0; + this->isAngry = false; this->actionFunc = func_80AB7420; return; } if ((thisx->bgCheckFlags & BGCHECKFLAG_WATER) && thisx->depthInWater > 15.0f && this->actionFunc != func_80AB6F04 && - thisx->params != 0xD && thisx->params != 0xE && thisx->params != 0xA) { + thisx->params != EN_NIW_TYPE_SUPER_CUCCO && thisx->params != EN_NIW_TYPE_TALON_CUCCO && + thisx->params != EN_NIW_TYPE_A) { thisx->velocity.y = 0.0f; thisx->gravity = 0.0f; Math_Vec3f_Copy(&pos, &thisx->world.pos); @@ -1062,11 +1062,12 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { return; } - if (D_80AB85E0 == 0 && this->unk_2A4 <= 0 && thisx->params != 0xD && thisx->params != 0xE && thisx->params != 0xA) { + if (sHasAttackStarted == false && this->health <= 0 && thisx->params != EN_NIW_TYPE_SUPER_CUCCO && + thisx->params != EN_NIW_TYPE_TALON_CUCCO && thisx->params != EN_NIW_TYPE_A) { this->timer6 = 100; if (thisx->xzDistToPlayer > 10.0f) { - D_80AB85E0 = 1; + sHasAttackStarted = true; this->timer5 = this->timer4 = this->unk_29E = 0; thisx->speed = 0.0f; this->unk_2FC = 0.0f; @@ -1076,11 +1077,11 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { this->unk_26C[6] = 0.0f; this->unk_26C[8] = 0.0f; this->sfxTimer1 = 10000; - this->unk_2A8 = 1; + this->isAngry = true; this->unk_2AC.x = this->unk_2B8.x = thisx->world.pos.x; this->unk_2AC.y = this->unk_2B8.y = thisx->world.pos.y; this->unk_2AC.z = this->unk_2B8.z = thisx->world.pos.z; - this->actionFunc = func_80AB70A0; + this->actionFunc = EnNiw_AngryCutsceneStart; return; } } @@ -1088,9 +1089,9 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { dist = 20.0f; #if OOT_VERSION < NTSC_1_1 - if (this->unk_2A8 != 0 && thisx->xyzDistToPlayerSq < SQ(dist) && !(player->stateFlags1 & PLAYER_STATE1_26)) + if (this->isAngry && thisx->xyzDistToPlayerSq < SQ(dist) && !(player->stateFlags1 & PLAYER_STATE1_26)) #else - if (this->unk_2A8 != 0 && thisx->xyzDistToPlayerSq < SQ(dist) && player->invincibilityTimer == 0) + if (this->isAngry && thisx->xyzDistToPlayerSq < SQ(dist) && player->invincibilityTimer == 0) #endif { Actor_SetPlayerKnockbackLarge(play, &this->actor, 2.0f, thisx->world.rot.y, 0.0f, 0x10); @@ -1098,12 +1099,12 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { func_80AB747C(this, play); - if (this->sfxTimer2 == 0 && this->actionFunc == func_80AB6BF8) { + if (this->sfxTimer2 == 0 && this->actionFunc == EnNiw_PlayerCarrying) { this->sfxTimer2 = 7; Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_WAKEUP); } if (this->sfxTimer1 == 0) { - if (this->actionFunc != func_80AB6570) { + if (this->actionFunc != EnNiw_IdleWalk) { this->sfxTimer1 = 30; Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_A); } else { @@ -1111,15 +1112,16 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_N); } } - if (this->unk_2A8 == 0) { + if (!this->isAngry) { Collider_UpdateCylinder(&this->actor, &this->collider); - if (thisx->params != 0xA && thisx->params != 0xD && thisx->params != 0xE && thisx->params != 4) { + if (thisx->params != EN_NIW_TYPE_A && thisx->params != EN_NIW_TYPE_SUPER_CUCCO && + thisx->params != EN_NIW_TYPE_TALON_CUCCO && thisx->params != EN_NIW_TYPE_KAKARIKO_CRATE) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - if (this->actionFunc != func_80AB6BF8 && this->actionFunc != func_80AB6D08 && - this->actionFunc != func_80AB6324 && this->actionFunc != func_80AB63A8 && - this->actionFunc != func_80AB6450) { + if (this->actionFunc != EnNiw_PlayerCarrying && this->actionFunc != EnNiw_PlayerReleased && + this->actionFunc != EnNiw_IdleSuperCucco && this->actionFunc != EnNiw_SuperCuccoFallingIntoPosition && + this->actionFunc != EnNiw_IdleKakarikoCrate) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -1158,7 +1160,7 @@ void EnNiw_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnNiw_OverrideLimbDraw, NULL, this); - if (this->actionFunc == func_80AB6450) { + if (this->actionFunc == EnNiw_IdleKakarikoCrate) { func_80033C30(&this->actor.world.pos, &scale, 255, 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 a0f58d0a35..2f0b73c208 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.h +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.h @@ -8,6 +8,22 @@ struct EnNiw; typedef void (*EnNiwActionFunc)(struct EnNiw*, struct PlayState*); +typedef enum EnNiwType { + EN_NIW_TYPE_0, + EN_NIW_TYPE_1, + EN_NIW_TYPE_2, + EN_NIW_TYPE_3, + EN_NIW_TYPE_KAKARIKO_CRATE, + EN_NIW_TYPE_5, + EN_NIW_TYPE_7 = 7, + EN_NIW_TYPE_8, + EN_NIW_TYPE_A = 10, + EN_NIW_TYPE_ZORA_RIVER_LOWER, + EN_NIW_TYPE_ZORA_RIVER_UPPER, + EN_NIW_TYPE_SUPER_CUCCO, + EN_NIW_TYPE_TALON_CUCCO +} EnNiwType; + typedef struct EnNiwEffect { /* 0x0000 */ u8 type; /* 0x0004 */ Vec3f pos; @@ -49,10 +65,10 @@ typedef struct EnNiw { /* 0x029E */ s16 unk_29E; /* 0x02A0 */ s16 unk_2A0; /* 0x02A2 */ s16 unk_2A2; - /* 0x02A4 */ s16 unk_2A4; + /* 0x02A4 */ s16 health; /* 0x02A6 */ s16 unk_2A6; - /* 0x02A8 */ s16 unk_2A8; - /* 0x02AA */ s16 unk_2AA; + /* 0x02A8 */ s16 isAngry; + /* 0x02AA */ s16 kakarikoIdx; // identifier for Kakariko cuccos /* 0x02AC */ Vec3f unk_2AC; /* 0x02B8 */ Vec3f unk_2B8; /* 0x02C4 */ f32 unk_2C4; @@ -73,7 +89,7 @@ typedef struct EnNiw { /* 0x02FC */ f32 unk_2FC; /* 0x0300 */ f32 unk_300; /* 0x0304 */ f32 unk_304; - /* 0x0308 */ u8 unk_308; + /* 0x0308 */ u8 isSuperCuccoThrown; /* 0x030C */ ColliderCylinder collider; /* 0x0358 */ EnNiwEffect effects[EN_NIW_EFFECT_COUNT]; } EnNiw; // size = 0x07B8 diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 1ea6397096..e78d0c6e7c 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -58,7 +58,7 @@ static s16 sMissingCuccoTextIds[] = { 0x5036, 0x5070, 0x5072, 0x5037, 0x5038, 0x5039, 0x503A, 0x503B, 0x503D, 0x503C, }; -static s16 D_80ABB3B4[] = { +static s16 sMissingCuccoFlags[] = { INFTABLE_MASK(INFTABLE_199), INFTABLE_MASK(INFTABLE_19A), INFTABLE_MASK(INFTABLE_19B), INFTABLE_MASK(INFTABLE_19C), INFTABLE_MASK(INFTABLE_19D), INFTABLE_MASK(INFTABLE_19E), INFTABLE_MASK(INFTABLE_19F), }; @@ -227,18 +227,18 @@ void func_80ABA244(EnNiwLady* this, PlayState* play) { if ((fabsf(currentCucco->actor.world.pos.x - 330.0f) < 90.0f) && (fabsf(currentCucco->actor.world.pos.z - 1610.0f) < 190.0f)) { if (this->unk_26C == 0) { - gSaveContext.save.info.infTable[INFTABLE_INDEX_199_19A_19B_19C_19D_19E_19F] |= - D_80ABB3B4[currentCucco->unk_2AA]; + gSaveContext.save.info.infTable[INFTABLE_INDEX_KAKARIKO_CUCCO] |= + sMissingCuccoFlags[currentCucco->kakarikoIdx]; if (BREG(1) != 0) { PRINTF(VT_FGCOL(GREEN) T("☆ 鶏柵内GET!☆ %x\n", "☆ GET inside the chicken fence! ☆ %x\n") VT_RST, - D_80ABB3B4[currentCucco->unk_2AA]); + sMissingCuccoFlags[currentCucco->kakarikoIdx]); } } this->cuccosInPen++; } else if (this->unk_26C == 0) { - gSaveContext.save.info.infTable[INFTABLE_INDEX_199_19A_19B_19C_19D_19E_19F] &= - ~D_80ABB3B4[currentCucco->unk_2AA]; + gSaveContext.save.info.infTable[INFTABLE_INDEX_KAKARIKO_CUCCO] &= + ~sMissingCuccoFlags[currentCucco->kakarikoIdx]; } } currentCucco = (EnNiw*)currentCucco->actor.next; @@ -304,14 +304,14 @@ void func_80ABA244(EnNiwLady* this, PlayState* play) { this->unk_26A = this->cuccosInPen; PRINTF(VT_FGCOL(CYAN) T("☆☆☆☆☆ 柵内BIT変更前 ☆☆ %x\n", "☆☆☆☆☆ Before changing the fence BIT ☆☆ %x\n") VT_RST, - gSaveContext.save.info.infTable[INFTABLE_INDEX_199_19A_19B_19C_19D_19E_19F]); - gSaveContext.save.info.infTable[INFTABLE_INDEX_199_19A_19B_19C_19D_19E_19F] &= + gSaveContext.save.info.infTable[INFTABLE_INDEX_KAKARIKO_CUCCO]); + gSaveContext.save.info.infTable[INFTABLE_INDEX_KAKARIKO_CUCCO] &= (u16) ~(INFTABLE_MASK(INFTABLE_199) | INFTABLE_MASK(INFTABLE_19A) | INFTABLE_MASK(INFTABLE_19B) | INFTABLE_MASK(INFTABLE_19C) | INFTABLE_MASK(INFTABLE_19D) | INFTABLE_MASK(INFTABLE_19E) | INFTABLE_MASK(INFTABLE_19F)); PRINTF(VT_FGCOL(CYAN) T("☆☆☆☆☆ 柵内BIT変更後 ☆☆ %x\n", "☆☆☆☆☆ After changing the BIT inside the fence ☆☆ %x\n") VT_RST, - gSaveContext.save.info.infTable[INFTABLE_INDEX_199_19A_19B_19C_19D_19E_19F]); + gSaveContext.save.info.infTable[INFTABLE_INDEX_KAKARIKO_CUCCO]); PRINTF("\n\n"); this->actionFunc = func_80ABA654; return; diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index fd4f5b91c1..0a69e08055 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -240,15 +240,18 @@ void EnTa_Init(Actor* thisx, PlayState* play2) { if (IS_DAY) { this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; this->superCuccoTimers[0] = this->superCuccoTimers[1] = this->superCuccoTimers[2] = 7; - this->superCuccos[0] = (EnNiw*)Actor_Spawn( - &play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x + 5.0f, - this->actor.world.pos.y + 3.0f, this->actor.world.pos.z + 26.0f, 0, 0, 0, 0xD); - this->superCuccos[1] = (EnNiw*)Actor_Spawn( - &play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x - 20.0f, - this->actor.world.pos.y + 40.0f, this->actor.world.pos.z - 30.0f, 0, 0, 0, 0xD); - this->superCuccos[2] = (EnNiw*)Actor_Spawn( - &play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x + 20.0f, - this->actor.world.pos.y + 40.0f, this->actor.world.pos.z - 30.0f, 0, 0, 0, 0xD); + this->superCuccos[0] = + (EnNiw*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x + 5.0f, + this->actor.world.pos.y + 3.0f, this->actor.world.pos.z + 26.0f, 0, 0, + 0, EN_NIW_TYPE_SUPER_CUCCO); + this->superCuccos[1] = + (EnNiw*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x - 20.0f, + this->actor.world.pos.y + 40.0f, this->actor.world.pos.z - 30.0f, 0, 0, + 0, EN_NIW_TYPE_SUPER_CUCCO); + this->superCuccos[2] = + (EnNiw*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x + 20.0f, + this->actor.world.pos.y + 40.0f, this->actor.world.pos.z - 30.0f, 0, 0, + 0, EN_NIW_TYPE_SUPER_CUCCO); EnTa_SetTextForTalkInLonLonHouse(this, play); if (GET_EVENTINF(EVENTINF_CUCCO_GAME_FINISHED)) { @@ -861,7 +864,7 @@ void EnTa_ThrowSuperCuccos(EnTa* this, PlayState* play) { // Mark the cucco as a super cucco, this will cause the cucco // to set random xz and y velocities - niw->unk_308 = 1; + niw->isSuperCuccoThrown = true; niw->actor.gravity = 0.0f; } } From 0c5107580a39f1b685ddd3c84a285a19176311bc Mon Sep 17 00:00:00 2001 From: mzxrules Date: Sun, 21 Dec 2025 03:31:08 -0500 Subject: [PATCH 2/2] 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;