diff --git a/assets/xml/objects/object_boss03.xml b/assets/xml/objects/object_boss03.xml index 14d7d3498e..5cf4ad2b8a 100644 --- a/assets/xml/objects/object_boss03.xml +++ b/assets/xml/objects/object_boss03.xml @@ -1,93 +1,138 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c index 86bc7d6a81..ba49ab93e1 100644 --- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c +++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.c @@ -12,6 +12,12 @@ #define THIS ((EnTanron3*)thisx) +#define WORK_TIMER_PICK_NEW_DEVIATION 0 +#define WORK_TIMER_DIE 0 +#define WORK_TIMER_OUT_OF_WATER 1 +#define WORK_TIMER_ATTACK 2 +#define WORK_TIMER_WAIT 2 + void EnTanron3_Init(Actor* thisx, GlobalContext* globalCtx); void EnTanron3_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnTanron3_Update(Actor* thisx, GlobalContext* globalCtx); @@ -107,8 +113,8 @@ void EnTanron3_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; Collider_InitAndSetCylinder(globalCtx, &this->atCollider, &this->actor, &sCylinderInit); Collider_InitAndSetCylinder(globalCtx, &this->acCollider, &this->actor, &sCylinderInit); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_boss03_Skel_00DA20, &object_boss03_Anim_00DAAC, - this->jointTable, this->morphTable, 10); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gGyorgSmallFishSkel, &gGyorgSmallFishSwimAnim, this->jointTable, + this->morphTable, GYORG_SMALL_FISH_LIMB_MAX); Actor_SetScale(&this->actor, 0.02f); EnTanron3_SetupLive(this, globalCtx); this->actor.flags &= ~1; @@ -142,10 +148,10 @@ void EnTanron3_SpawnBubbles(EnTanron3* this, GlobalContext* globalCtx) { void EnTanron3_SetupLive(EnTanron3* this, GlobalContext* globalCtx) { this->actionFunc = EnTanron3_Live; - Animation_MorphToLoop(&this->skelAnime, &object_boss03_Anim_00DAAC, -10.0f); + Animation_MorphToLoop(&this->skelAnime, &gGyorgSmallFishSwimAnim, -10.0f); this->rotationStep = 0; this->rotationScale = 5; - this->workTimer[TANRON3_WORK_TIMER_PICK_NEW_DEVIATION] = 50; + this->workTimer[WORK_TIMER_PICK_NEW_DEVIATION] = 50; this->actor.speedXZ = 5.0f; this->speedMaxStep = 0.5f; this->deviation.x = randPlusMinusPoint5Scaled(500.0f); @@ -176,13 +182,13 @@ void EnTanron3_Live(EnTanron3* this, GlobalContext* globalCtx) { if ((player->actor.bgCheckFlags & 1) && player->actor.shape.feetPos[0].y >= 438.0f) { // Player is standing on the central platform, so stop chasing them this->isNonHostile = true; - } else if (this->isNonHostile && this->workTimer[TANRON3_WORK_TIMER_WAIT] == 0 && !(this->timer & 0x1F)) { + } else if (this->isNonHostile && this->workTimer[WORK_TIMER_WAIT] == 0 && !(this->timer & 0x1F)) { xDistance = this->targetPos.x - player->actor.world.pos.x; zDistance = this->targetPos.z - player->actor.world.pos.z; if (sqrtf(SQ(xDistance) + SQ(zDistance)) < 500.0f) { // Player is in the water and close enough, so start chasing them this->isNonHostile = false; - this->workTimer[TANRON3_WORK_TIMER_ATTACK] = 150; + this->workTimer[WORK_TIMER_ATTACK] = 150; } } @@ -204,8 +210,8 @@ void EnTanron3_Live(EnTanron3* this, GlobalContext* globalCtx) { // If the player gets eaten by Gyorg, or if the attack timer ran out, // stop chasing the player for a little bit. - if (this->workTimer[TANRON3_WORK_TIMER_ATTACK] == 0 || (player->stateFlags2 & 0x80)) { - this->workTimer[TANRON3_WORK_TIMER_WAIT] = 150; + if (this->workTimer[WORK_TIMER_ATTACK] == 0 || (player->stateFlags2 & 0x80)) { + this->workTimer[WORK_TIMER_WAIT] = 150; this->isNonHostile = true; } break; @@ -234,9 +240,9 @@ void EnTanron3_Live(EnTanron3* this, GlobalContext* globalCtx) { break; } - if (this->workTimer[TANRON3_WORK_TIMER_OUT_OF_WATER] == 0) { - if (this->workTimer[TANRON3_WORK_TIMER_PICK_NEW_DEVIATION] == 0 && this->actor.speedXZ > 1.0f) { - this->workTimer[TANRON3_WORK_TIMER_PICK_NEW_DEVIATION] = Rand_ZeroFloat(20.0f); + if (this->workTimer[WORK_TIMER_OUT_OF_WATER] == 0) { + if (this->workTimer[WORK_TIMER_PICK_NEW_DEVIATION] == 0 && this->actor.speedXZ > 1.0f) { + this->workTimer[WORK_TIMER_PICK_NEW_DEVIATION] = Rand_ZeroFloat(20.0f); this->deviation.x = randPlusMinusPoint5Scaled(100.0f); this->deviation.y = randPlusMinusPoint5Scaled(50.0f + extraScaleY); this->deviation.z = randPlusMinusPoint5Scaled(100.0f); @@ -266,7 +272,7 @@ void EnTanron3_Live(EnTanron3* this, GlobalContext* globalCtx) { // Fish is above water but hasn't touched land before this->actor.gravity = -1.0f; this->targetPosWithDeviation.y = this->waterSurfaceYPos - 50.0f; - this->workTimer[TANRON3_WORK_TIMER_OUT_OF_WATER] = 25; + this->workTimer[WORK_TIMER_OUT_OF_WATER] = 25; Math_ApproachS(&this->actor.world.rot.x, 0x3000, 5, 0xBD0); if (this->actor.bgCheckFlags & 8) { this->actor.speedXZ = 0.0f; @@ -318,9 +324,9 @@ void EnTanron3_Live(EnTanron3* this, GlobalContext* globalCtx) { } this->currentRotationAngle += this->nextRotationAngle; - this->trunkRotation = Math_SinS(this->currentRotationAngle) * 5000.0f; - this->bodyRotation = Math_SinS(this->currentRotationAngle + 0x6978) * 5000.0f; this->tailRotation = Math_SinS(this->currentRotationAngle) * 5000.0f; + this->bodyRotation = Math_SinS(this->currentRotationAngle + 0x6978) * 5000.0f; + this->trunkRotation = Math_SinS(this->currentRotationAngle) * 5000.0f; if (!this->isBeached) { this->actor.shape.rot = this->actor.world.rot; } @@ -338,14 +344,14 @@ void EnTanron3_SetupDie(EnTanron3* this, GlobalContext* globalCtx) { zDistance = this->actor.world.pos.z - player->actor.world.pos.z; this->actor.world.rot.x = Math_FAtan2F(sqrtf(SQ(xDistance) + SQ(zDistance)), -yDistance); this->actor.world.rot.y = Math_FAtan2F(zDistance, xDistance); - this->workTimer[TANRON3_WORK_TIMER_DIE] = 6; + this->workTimer[WORK_TIMER_DIE] = 6; this->actor.speedXZ = 10.0f; Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_KONB_MINI_DEAD); } void EnTanron3_Die(EnTanron3* this, GlobalContext* globalCtx) { Actor_MoveWithoutGravityReverse(&this->actor); - if (this->workTimer[TANRON3_WORK_TIMER_DIE] == 0) { + if (this->workTimer[WORK_TIMER_DIE] == 0) { EnTanron3_SpawnBubbles(this, globalCtx); Actor_MarkForDeath(&this->actor); if (Rand_ZeroOne() < 0.3f) { @@ -418,7 +424,7 @@ void EnTanron3_Update(Actor* thisx, GlobalContext* globalCtx) { if ((s8)sGyorg->actor.colChkInfo.health <= 0 && this->actionFunc != EnTanron3_Die) { EnTanron3_SetupDie(this, globalCtx); - this->workTimer[TANRON3_WORK_TIMER_DIE] = 0; + this->workTimer[WORK_TIMER_DIE] = 0; } } @@ -426,15 +432,18 @@ s32 EnTanron3_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL Actor* thisx) { EnTanron3* this = THIS; - if (limbIndex == 1) { + if (limbIndex == GYORG_SMALL_FISH_LIMB_ROOT) { rot->y += this->bodyRotation; } - if (limbIndex == 3) { - rot->y += this->tailRotation; - } - if (limbIndex == 4) { + + if (limbIndex == GYORG_SMALL_FISH_LIMB_TRUNK_ROOT) { rot->y += this->trunkRotation; } + + if (limbIndex == GYORG_SMALL_FISH_LIMB_TAIL_FIN) { + rot->y += this->tailRotation; + } + return false; } @@ -442,6 +451,7 @@ void EnTanron3_Draw(Actor* thisx, GlobalContext* globalCtx) { EnTanron3* this = THIS; OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C28C(globalCtx->state.gfxCtx); if ((this->fogTimer % 2) != 0) { POLY_OPA_DISP = Gfx_SetFog(POLY_OPA_DISP, 255, 0, 0, 255, 900, 1099); @@ -449,5 +459,6 @@ void EnTanron3_Draw(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTanron3_OverrideLimbDraw, NULL, &this->actor); POLY_OPA_DISP = func_801660B8(globalCtx, POLY_OPA_DISP); + CLOSE_DISPS(globalCtx->state.gfxCtx); } diff --git a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.h b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.h index 9a2cb25da7..9d67154df6 100644 --- a/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.h +++ b/src/overlays/actors/ovl_En_Tanron3/z_en_tanron3.h @@ -2,16 +2,12 @@ #define Z_EN_TANRON3_H #include "global.h" +#include "objects/object_boss03/object_boss03.h" struct EnTanron3; typedef void (*EnTanron3ActionFunc)(struct EnTanron3*, GlobalContext*); -#define TANRON3_WORK_TIMER_PICK_NEW_DEVIATION 0 -#define TANRON3_WORK_TIMER_DIE 0 -#define TANRON3_WORK_TIMER_OUT_OF_WATER 1 -#define TANRON3_WORK_TIMER_ATTACK 2 -#define TANRON3_WORK_TIMER_WAIT 2 #define TANRON3_WORK_TIMER_MAX 3 typedef struct { @@ -28,8 +24,8 @@ typedef struct { typedef struct EnTanron3 { /* 0x000 */ Actor actor; /* 0x144 */ SkelAnime skelAnime; - /* 0x188 */ Vec3s jointTable[10]; - /* 0x1C4 */ Vec3s morphTable[10]; + /* 0x188 */ Vec3s jointTable[GYORG_SMALL_FISH_LIMB_MAX]; + /* 0x1C4 */ Vec3s morphTable[GYORG_SMALL_FISH_LIMB_MAX]; /* 0x200 */ s16 timer; /* 0x202 */ u8 isNonHostile; // If true, the fish will not move towards the player to attack them /* 0x203 */ u8 isBeached; // If true, the fish is on the central platform flopping around @@ -48,8 +44,8 @@ typedef struct EnTanron3 { /* 0x248 */ Vec3s targetShapeRotation; /* 0x250 */ s32 currentRotationAngle; /* 0x254 */ s32 nextRotationAngle; - /* 0x258 */ s16 tailRotation; - /* 0x25A */ s16 trunkRotation; + /* 0x258 */ s16 trunkRotation; + /* 0x25A */ s16 tailRotation; /* 0x25C */ s16 bodyRotation; /* 0x260 */ ColliderCylinder atCollider; /* 0x2AC */ ColliderCylinder acCollider;