From 75eb3c5c81bb713a846107eb8dbf968c54b4eede Mon Sep 17 00:00:00 2001 From: blackgamma7 Date: Mon, 19 Dec 2022 09:18:51 -0500 Subject: [PATCH] `z_en_reeba` doc (#1442) * `z_en_reeba` doc Fields and funcs now ID'd. * Update z_en_reeba.c one more func ID'd. * `z_en_reeba`: change name of "rotYSwitch" * `z_en_reeba`: added enums, changed stunTimer also added translation for an osSyncPrintf * Update z_en_reeba.c revised DMGEFF enum * `z_en_reeba` revised * `z_en_reeba`: merge, case-switch whitespacing * `z_en_reeba`: revisions switch case formatted `isBig` bool to `type` enum --- .../actors/ovl_En_Encount1/z_en_encount1.c | 8 +- src/overlays/actors/ovl_En_Reeba/z_en_reeba.c | 377 +++++++++--------- src/overlays/actors/ovl_En_Reeba/z_en_reeba.h | 32 +- 3 files changed, 220 insertions(+), 197 deletions(-) diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index d665b37045..05f22fca8e 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -118,13 +118,13 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, PlayState* play) { while ((this->curNumSpawn < this->maxCurSpawns) && (this->curNumSpawn < spawnLimit) && (this->timer == 0)) { spawnDist = sLeeverDists[this->leeverIndex]; spawnAngle = sLeeverAngles[this->leeverIndex] + player->actor.shape.rot.y; - spawnParams = LEEVER_SMALL; + spawnParams = LEEVER_TYPE_SMALL; if ((this->killCount >= 10) && (this->bigLeever == NULL)) { this->killCount = this->numLeeverSpawns = 0; spawnAngle = sLeeverAngles[0]; spawnDist = sLeeverDists[2]; - spawnParams = LEEVER_BIG; + spawnParams = LEEVER_TYPE_BIG; } spawnPos.x = player->actor.world.pos.x + Math_SinS(spawnAngle) * spawnDist; @@ -144,7 +144,7 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, PlayState* play) { if (1) {} if (leever != NULL) { this->curNumSpawn++; - leever->unk_280 = this->leeverIndex++; + leever->aimType = this->leeverIndex++; if (this->leeverIndex >= 5) { this->leeverIndex = 0; } @@ -153,7 +153,7 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, PlayState* play) { this->timer = 150; this->numLeeverSpawns = 0; } - if (spawnParams != LEEVER_SMALL) { + if (spawnParams != LEEVER_TYPE_SMALL) { this->timer = 300; this->bigLeever = leever; } diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index ac8d239b3b..d981235b87 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -17,52 +17,62 @@ void EnReeba_Destroy(Actor* thisx, PlayState* play); void EnReeba_Update(Actor* thisx, PlayState* play2); void EnReeba_Draw(Actor* thisx, PlayState* play); -void func_80AE4F40(EnReeba* this, PlayState* play); -void func_80AE5054(EnReeba* this, PlayState* play); -void func_80AE5270(EnReeba* this, PlayState* play); -void func_80AE5688(EnReeba* this, PlayState* play); -void func_80AE56E0(EnReeba* this, PlayState* play); -void func_80AE538C(EnReeba* this, PlayState* play); -void func_80AE53AC(EnReeba* this, PlayState* play); -void func_80AE5E48(EnReeba* this, PlayState* play); -void func_80AE5854(EnReeba* this, PlayState* play); -void func_80AE5C38(EnReeba* this, PlayState* play); -void func_80AE5938(EnReeba* this, PlayState* play); -void func_80AE5A9C(EnReeba* this, PlayState* play); +void EnReeba_SetupSurface(EnReeba* this, PlayState* play); +void EnReeba_Surface(EnReeba* this, PlayState* play); +void EnReeba_Move(EnReeba* this, PlayState* play); +void EnReeba_SetupSink(EnReeba* this, PlayState* play); +void EnReeba_Sink(EnReeba* this, PlayState* play); +void EnReeba_SetupMoveBig(EnReeba* this, PlayState* play); +void EnReeba_MoveBig(EnReeba* this, PlayState* play); +void EnReeba_StunRecover(EnReeba* this, PlayState* play); +void EnReeba_Damaged(EnReeba* this, PlayState* play); +void EnReeba_Die(EnReeba* this, PlayState* play); +void EnReeba_Stunned(EnReeba* this, PlayState* play); +void EnReeba_StunDie(EnReeba* this, PlayState* play); + +typedef enum { + /* 0x00 */ LEEVER_DMGEFF_NONE, // used by anything that cant kill the Leever + /* 0x01 */ LEEVER_DMGEFF_UNK, // used by "unknown 1" attack + /* 0x03 */ LEEVER_DMGEFF_ICE = 3, + /* 0x0B */ LEEVER_DMGEFF_UNUSED = 11, // not used in the damage table, but still checked for. + /* 0x0C */ LEEVER_DMGEFF_BOOMERANG, + /* 0x0D */ LEEVER_DMGEFF_HOOKSHOT, + /* 0x0E */ LEEVER_DMGEFF_OTHER +} LeeverDamageEffect; static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, 0x0), - /* Deku stick */ DMG_ENTRY(2, 0xE), - /* Slingshot */ DMG_ENTRY(1, 0xE), - /* Explosive */ DMG_ENTRY(2, 0xE), - /* Boomerang */ DMG_ENTRY(1, 0xC), - /* Normal arrow */ DMG_ENTRY(2, 0xE), - /* Hammer swing */ DMG_ENTRY(2, 0xE), - /* Hookshot */ DMG_ENTRY(2, 0xD), - /* Kokiri sword */ DMG_ENTRY(1, 0xE), - /* Master sword */ DMG_ENTRY(4, 0xE), - /* Giant's Knife */ DMG_ENTRY(6, 0xE), - /* Fire arrow */ DMG_ENTRY(2, 0xE), - /* Ice arrow */ DMG_ENTRY(4, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0xE), - /* Unk arrow 1 */ DMG_ENTRY(2, 0xE), - /* Unk arrow 2 */ DMG_ENTRY(2, 0xE), - /* Unk arrow 3 */ DMG_ENTRY(2, 0xE), - /* Fire magic */ DMG_ENTRY(0, 0x0), - /* Ice magic */ DMG_ENTRY(4, 0x3), - /* Light magic */ DMG_ENTRY(0, 0x0), - /* Shield */ DMG_ENTRY(0, 0x0), - /* Mirror Ray */ DMG_ENTRY(0, 0x0), - /* Kokiri spin */ DMG_ENTRY(2, 0xE), - /* Giant spin */ DMG_ENTRY(8, 0xE), - /* Master spin */ DMG_ENTRY(4, 0xE), - /* Kokiri jump */ DMG_ENTRY(2, 0xE), - /* Giant jump */ DMG_ENTRY(8, 0xE), - /* Master jump */ DMG_ENTRY(4, 0xE), - /* Unknown 1 */ DMG_ENTRY(0, 0x1), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* Hammer jump */ DMG_ENTRY(0, 0x0), - /* Unknown 2 */ DMG_ENTRY(0, 0x0), + /* Deku nut */ DMG_ENTRY(0, LEEVER_DMGEFF_NONE), + /* Deku stick */ DMG_ENTRY(2, LEEVER_DMGEFF_OTHER), + /* Slingshot */ DMG_ENTRY(1, LEEVER_DMGEFF_OTHER), + /* Explosive */ DMG_ENTRY(2, LEEVER_DMGEFF_OTHER), + /* Boomerang */ DMG_ENTRY(1, LEEVER_DMGEFF_BOOMERANG), + /* Normal arrow */ DMG_ENTRY(2, LEEVER_DMGEFF_OTHER), + /* Hammer swing */ DMG_ENTRY(2, LEEVER_DMGEFF_OTHER), + /* Hookshot */ DMG_ENTRY(2, LEEVER_DMGEFF_HOOKSHOT), + /* Kokiri sword */ DMG_ENTRY(1, LEEVER_DMGEFF_OTHER), + /* Master sword */ DMG_ENTRY(4, LEEVER_DMGEFF_OTHER), + /* Giant's Knife */ DMG_ENTRY(6, LEEVER_DMGEFF_OTHER), + /* Fire arrow */ DMG_ENTRY(2, LEEVER_DMGEFF_OTHER), + /* Ice arrow */ DMG_ENTRY(4, LEEVER_DMGEFF_ICE), + /* Light arrow */ DMG_ENTRY(2, LEEVER_DMGEFF_OTHER), + /* Unk arrow 1 */ DMG_ENTRY(2, LEEVER_DMGEFF_OTHER), + /* Unk arrow 2 */ DMG_ENTRY(2, LEEVER_DMGEFF_OTHER), + /* Unk arrow 3 */ DMG_ENTRY(2, LEEVER_DMGEFF_OTHER), + /* Fire magic */ DMG_ENTRY(0, LEEVER_DMGEFF_NONE), + /* Ice magic */ DMG_ENTRY(4, LEEVER_DMGEFF_ICE), + /* Light magic */ DMG_ENTRY(0, LEEVER_DMGEFF_NONE), + /* Shield */ DMG_ENTRY(0, LEEVER_DMGEFF_NONE), + /* Mirror Ray */ DMG_ENTRY(0, LEEVER_DMGEFF_NONE), + /* Kokiri spin */ DMG_ENTRY(2, LEEVER_DMGEFF_OTHER), + /* Giant spin */ DMG_ENTRY(8, LEEVER_DMGEFF_OTHER), + /* Master spin */ DMG_ENTRY(4, LEEVER_DMGEFF_OTHER), + /* Kokiri jump */ DMG_ENTRY(2, LEEVER_DMGEFF_OTHER), + /* Giant jump */ DMG_ENTRY(8, LEEVER_DMGEFF_OTHER), + /* Master jump */ DMG_ENTRY(4, LEEVER_DMGEFF_OTHER), + /* Unknown 1 */ DMG_ENTRY(0, LEEVER_DMGEFF_UNK), + /* Unblockable */ DMG_ENTRY(0, LEEVER_DMGEFF_NONE), + /* Hammer jump */ DMG_ENTRY(0, LEEVER_DMGEFF_NONE), + /* Unknown 2 */ DMG_ENTRY(0, LEEVER_DMGEFF_NONE), }; ActorInit En_Reeba_InitVars = { @@ -112,13 +122,14 @@ void EnReeba_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.health = 4; Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->isBig = this->actor.params; + this->type = this->actor.params; this->scale = 0.04f; - if (this->isBig) { + if (this->type != LEEVER_TYPE_SMALL) { this->collider.dim.radius = 35; this->collider.dim.height = 45; this->scale *= 1.5f; + // "Reeba Boss Appears %f" osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ リーバぼす登場 ☆☆☆☆☆ %f\n" VT_RST, this->scale); this->actor.colChkInfo.health = 20; this->collider.info.toucher.effect = 4; @@ -126,7 +137,7 @@ void EnReeba_Init(Actor* thisx, PlayState* play) { Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } - this->actor.shape.yOffset = this->unk_284 = this->scale * -27500.0f; + this->actor.shape.yOffset = this->yOffsetTarget = this->scale * -27500.0f; ActorShape_Init(&this->actor.shape, this->actor.shape.yOffset, ActorShadow_DrawCircle, 0.0f); this->actor.colChkInfo.damageTable = &sDamageTable; Actor_UpdateBgCheckInfo(play, &this->actor, 35.0f, 60.0f, 60.0f, @@ -140,7 +151,7 @@ void EnReeba_Init(Actor* thisx, PlayState* play) { return; } - this->actionfunc = func_80AE4F40; + this->actionfunc = EnReeba_SetupSurface; } void EnReeba_Destroy(Actor* thisx, PlayState* play) { @@ -156,7 +167,7 @@ void EnReeba_Destroy(Actor* thisx, PlayState* play) { if (spawner->curNumSpawn > 0) { spawner->curNumSpawn--; } - if (this->isBig) { + if (this->type != LEEVER_TYPE_SMALL) { spawner->bigLeever = NULL; spawner->timer = 600; } @@ -164,7 +175,7 @@ void EnReeba_Destroy(Actor* thisx, PlayState* play) { } } -void func_80AE4F40(EnReeba* this, PlayState* play) { +void EnReeba_SetupSurface(EnReeba* this, PlayState* play) { f32 frames = Animation_GetLastFrame(&object_reeba_Anim_0001E4); Player* player = GET_PLAYER(play); s16 playerSpeed; @@ -172,27 +183,28 @@ void func_80AE4F40(EnReeba* this, PlayState* play) { Animation_Change(&this->skelanime, &object_reeba_Anim_0001E4, 2.0f, 0.0f, frames, ANIMMODE_LOOP, -10.0f); playerSpeed = fabsf(player->linearVelocity); - this->unk_278 = 20 - playerSpeed * 2; - if (this->unk_278 < 0) { - this->unk_278 = 2; + this->waitTimer = 20 - playerSpeed * 2; + if (this->waitTimer < 0) { + this->waitTimer = 2; } - if (this->unk_278 > 20) { - this->unk_278 = 20; + if (this->waitTimer > 20) { + this->waitTimer = 20; } this->actor.flags &= ~ACTOR_FLAG_27; this->actor.world.pos.y = this->actor.floorHeight; - if (this->isBig) { + + if (this->type != LEEVER_TYPE_SMALL) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_BIG_APPEAR); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_APPEAR); } - this->actionfunc = func_80AE5054; + this->actionfunc = EnReeba_Surface; } -void func_80AE5054(EnReeba* this, PlayState* play) { +void EnReeba_Surface(EnReeba* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 playerLinearVel; @@ -203,17 +215,17 @@ void func_80AE5054(EnReeba* this, PlayState* play) { 500, 10, true); } - if (this->unk_278 == 0) { + if (this->waitTimer == 0) { Math_ApproachF(&this->actor.shape.shadowScale, 12.0f, 1.0f, 1.0f); if (this->actor.shape.yOffset < 0.0f) { - Math_ApproachZeroF(&this->actor.shape.yOffset, 1.0f, this->unk_288); - Math_ApproachF(&this->unk_288, 300.0f, 1.0f, 5.0f); + Math_ApproachZeroF(&this->actor.shape.yOffset, 1.0f, this->yOffsetStep); + Math_ApproachF(&this->yOffsetStep, 300.0f, 1.0f, 5.0f); } else { - this->unk_288 = 0.0f; + this->yOffsetStep = 0.0f; this->actor.shape.yOffset = 0.0f; playerLinearVel = player->linearVelocity; - switch (this->unk_280) { + switch (this->aimType) { case 0: this->actor.world.rot.y = this->actor.yawTowardsPlayer; break; @@ -231,18 +243,18 @@ void func_80AE5054(EnReeba* this, PlayState* play) { break; } - if (this->isBig) { - this->actionfunc = func_80AE538C; + if (this->type != LEEVER_TYPE_SMALL) { + this->actionfunc = EnReeba_SetupMoveBig; } else { - this->unk_272 = 130; + this->moveTimer = 130; this->actor.speedXZ = Rand_ZeroFloat(4.0f) + 6.0f; - this->actionfunc = func_80AE5270; + this->actionfunc = EnReeba_Move; } } } } -void func_80AE5270(EnReeba* this, PlayState* play) { +void EnReeba_Move(EnReeba* this, PlayState* play) { s32 surfaceType; SkelAnime_Update(&this->skelanime); @@ -255,22 +267,22 @@ void func_80AE5270(EnReeba* this, PlayState* play) { if ((surfaceType != FLOOR_TYPE_4) && (surfaceType != FLOOR_TYPE_7)) { this->actor.speedXZ = 0.0f; - this->actionfunc = func_80AE5688; - } else if ((this->unk_272 == 0) || (this->actor.xzDistToPlayer < 30.0f) || (this->actor.xzDistToPlayer > 400.0f) || - (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { - this->actionfunc = func_80AE5688; - } else if (this->unk_274 == 0) { + this->actionfunc = EnReeba_SetupSink; + } else if ((this->moveTimer == 0) || (this->actor.xzDistToPlayer < 30.0f) || + (this->actor.xzDistToPlayer > 400.0f) || (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { + this->actionfunc = EnReeba_SetupSink; + } else if (this->sfxTimer == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_MOVE); - this->unk_274 = 10; + this->sfxTimer = 10; } } -void func_80AE538C(EnReeba* this, PlayState* play) { +void EnReeba_SetupMoveBig(EnReeba* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2; - this->actionfunc = func_80AE53AC; + this->actionfunc = EnReeba_MoveBig; } -void func_80AE53AC(EnReeba* this, PlayState* play) { +void EnReeba_MoveBig(EnReeba* this, PlayState* play) { f32 speed; s16 yawDiff; s16 yaw; @@ -286,10 +298,10 @@ void func_80AE53AC(EnReeba* this, PlayState* play) { if (((surfaceType != FLOOR_TYPE_4) && (surfaceType != FLOOR_TYPE_7)) || (this->actor.xzDistToPlayer > 400.0f) || (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { - this->actionfunc = func_80AE5688; + this->actionfunc = EnReeba_SetupSink; } else { - if ((this->actor.xzDistToPlayer < 70.0f) && (this->unk_270 == 0)) { - this->unk_270 = 30; + if ((this->actor.xzDistToPlayer < 70.0f) && (this->bigLeeverTimer == 0)) { + this->bigLeeverTimer = 30; } speed = (this->actor.xzDistToPlayer - 20.0f) / ((Rand_ZeroOne() * 50.0f) + 150.0f); @@ -301,136 +313,136 @@ void func_80AE53AC(EnReeba* this, PlayState* play) { this->actor.speedXZ = -3.0f; } - yawDiff = (this->unk_270 == 0) ? this->actor.yawTowardsPlayer : -this->actor.yawTowardsPlayer; + yawDiff = (this->bigLeeverTimer == 0) ? this->actor.yawTowardsPlayer : -this->actor.yawTowardsPlayer; yawDiff -= this->actor.world.rot.y; yaw = (yawDiff > 0) ? ((yawDiff / 31.0f) + 10.0f) : ((yawDiff / 31.0f) - 10.0f); this->actor.world.rot.y += yaw * 2.0f; - if (this->unk_274 == 0) { + if (this->sfxTimer == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_MOVE); - this->unk_274 = 20; + this->sfxTimer = 20; } } } -void func_80AE561C(EnReeba* this, PlayState* play) { +void EnReeba_Bumped(EnReeba* this, PlayState* play) { Math_ApproachZeroF(&this->actor.speedXZ, 1.0f, 0.3f); - if (this->unk_272 == 0) { - if (this->isBig) { - this->actionfunc = func_80AE538C; + if (this->moveTimer == 0) { + if (this->type != LEEVER_TYPE_SMALL) { + this->actionfunc = EnReeba_SetupMoveBig; } else { - this->actionfunc = func_80AE5688; + this->actionfunc = EnReeba_SetupSink; } } } -void func_80AE5688(EnReeba* this, PlayState* play) { - this->unk_27E = 0; +void EnReeba_SetupSink(EnReeba* this, PlayState* play) { + this->stunType = LEEVER_STUN_NONE; Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->actor.flags |= ACTOR_FLAG_27; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); - this->actionfunc = func_80AE56E0; + this->actionfunc = EnReeba_Sink; } -void func_80AE56E0(EnReeba* this, PlayState* play) { +void EnReeba_Sink(EnReeba* this, PlayState* play) { Math_ApproachZeroF(&this->actor.shape.shadowScale, 1.0f, 0.3f); Math_ApproachZeroF(&this->actor.speedXZ, 0.1f, 0.3f); SkelAnime_Update(&this->skelanime); - if ((this->unk_284 + 10.0f) <= this->actor.shape.yOffset) { + if ((this->yOffsetTarget + 10.0f) <= this->actor.shape.yOffset) { if ((play->gameplayFrames % 4) == 0) { Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1, 8.0f, 500, 10, true); } - Math_ApproachF(&this->actor.shape.yOffset, this->unk_284, 1.0f, this->unk_288); - Math_ApproachF(&this->unk_288, 300.0f, 1.0f, 5.0f); + Math_ApproachF(&this->actor.shape.yOffset, this->yOffsetTarget, 1.0f, this->yOffsetStep); + Math_ApproachF(&this->yOffsetStep, 300.0f, 1.0f, 5.0f); } else { Actor_Kill(&this->actor); } } -void func_80AE57F0(EnReeba* this, PlayState* play) { - this->unk_276 = 14; +void EnReeba_SetupDamaged(EnReeba* this, PlayState* play) { + this->damagedTimer = 14; this->actor.speedXZ = -8.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - this->actionfunc = func_80AE5854; + this->actionfunc = EnReeba_Damaged; } -void func_80AE5854(EnReeba* this, PlayState* play) { +void EnReeba_Damaged(EnReeba* this, PlayState* play) { SkelAnime_Update(&this->skelanime); if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 1.0f; } - if (this->unk_276 == 0) { - if (this->isBig) { - this->unk_270 = 30; - this->actionfunc = func_80AE538C; + if (this->damagedTimer == 0) { + if (this->type != LEEVER_TYPE_SMALL) { + this->bigLeeverTimer = 30; + this->actionfunc = EnReeba_SetupMoveBig; } else { - this->actionfunc = func_80AE5688; + this->actionfunc = EnReeba_SetupSink; } } } -void func_80AE58EC(EnReeba* this, PlayState* play) { - this->unk_278 = 14; +void EnReeba_SetupStunned(EnReeba* this, PlayState* play) { + this->waitTimer = 14; this->actor.world.rot.y = this->actor.yawTowardsPlayer; this->actor.speedXZ = -8.0f; this->actor.flags |= ACTOR_FLAG_27; this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); - this->actionfunc = func_80AE5938; + this->actionfunc = EnReeba_Stunned; } -void func_80AE5938(EnReeba* this, PlayState* play) { +void EnReeba_Stunned(EnReeba* this, PlayState* play) { Vec3f pos; f32 scale; - if (this->unk_278 != 0) { + if (this->waitTimer != 0) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 1.0f; } } else { this->actor.speedXZ = 0.0f; - if ((this->unk_27E == 4) || (this->actor.colChkInfo.health != 0)) { - if (this->unk_27E == 2) { + if ((this->stunType == LEEVER_STUN_OTHER) || (this->actor.colChkInfo.health != 0)) { + if (this->stunType == LEEVER_STUN_ICE) { pos.x = this->actor.world.pos.x + Rand_CenteredFloat(20.0f); pos.y = this->actor.world.pos.y + Rand_CenteredFloat(20.0f); pos.z = this->actor.world.pos.z + Rand_CenteredFloat(20.0f); scale = 3.0f; - if (this->isBig) { + if (this->type != LEEVER_TYPE_SMALL) { scale = 6.0f; } EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, scale); } - this->unk_278 = 66; - this->actionfunc = func_80AE5E48; + this->waitTimer = 66; + this->actionfunc = EnReeba_StunRecover; } else { - this->unk_278 = 30; - this->actionfunc = func_80AE5A9C; + this->waitTimer = 30; + this->actionfunc = EnReeba_StunDie; } } } -void func_80AE5A9C(EnReeba* this, PlayState* play) { +void EnReeba_StunDie(EnReeba* this, PlayState* play) { Vec3f pos; f32 scale; - if (this->unk_278 != 0) { - if ((this->unk_27E == 2) && ((this->unk_278 & 0xF) == 0)) { + if (this->waitTimer != 0) { + if ((this->stunType == LEEVER_STUN_ICE) && ((this->waitTimer & 0xF) == 0)) { pos.x = this->actor.world.pos.x + Rand_CenteredFloat(20.0f); pos.y = this->actor.world.pos.y + Rand_CenteredFloat(20.0f); pos.z = this->actor.world.pos.z + Rand_CenteredFloat(20.0f); scale = 3.0f; - if (this->isBig) { + if (this->type != LEEVER_TYPE_SMALL) { scale = 6.0f; } @@ -439,25 +451,25 @@ void func_80AE5A9C(EnReeba* this, PlayState* play) { } else { Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_DEAD); Enemy_StartFinishingBlow(play, &this->actor); - this->actionfunc = func_80AE5C38; + this->actionfunc = EnReeba_Die; } } -void func_80AE5BC4(EnReeba* this, PlayState* play) { +void EnReeba_SetupDie(EnReeba* this, PlayState* play) { this->actor.speedXZ = -8.0f; this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - this->unk_278 = 14; + this->waitTimer = 14; this->actor.flags &= ~ACTOR_FLAG_0; - this->actionfunc = func_80AE5C38; + this->actionfunc = EnReeba_Die; } -void func_80AE5C38(EnReeba* this, PlayState* play) { +void EnReeba_Die(EnReeba* this, PlayState* play) { Vec3f pos; Vec3f accel = { 0.0f, 0.0f, 0.0f }; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; - if (this->unk_278 != 0) { + if (this->waitTimer != 0) { if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 1.0f; } @@ -474,7 +486,7 @@ void func_80AE5C38(EnReeba* this, PlayState* play) { EffectSsDeadDb_Spawn(play, &pos, &velocity, &accel, 120, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true); - if (!this->isBig) { + if (this->type == LEEVER_TYPE_SMALL) { Item_DropCollectibleRandom(play, &this->actor, &pos, 0xE0); } else { Item_DropCollectibleRandom(play, &this->actor, &pos, 0xC0); @@ -483,7 +495,7 @@ void func_80AE5C38(EnReeba* this, PlayState* play) { if (this->actor.parent != NULL) { EnEncount1* spawner = (EnEncount1*)this->actor.parent; - if ((spawner->actor.update != NULL) && !this->isBig) { + if ((spawner->actor.update != NULL) && this->type == LEEVER_TYPE_SMALL) { if (spawner->killCount < 10) { spawner->killCount++; } @@ -499,81 +511,87 @@ void func_80AE5C38(EnReeba* this, PlayState* play) { } } -void func_80AE5E48(EnReeba* this, PlayState* play) { - if (this->unk_278 < 37) { +void EnReeba_StunRecover(EnReeba* this, PlayState* play) { + if (this->waitTimer < 37) { this->actor.shape.rot.x = Rand_CenteredFloat(3000.0f); this->actor.shape.rot.z = Rand_CenteredFloat(3000.0f); - if (this->unk_278 == 0) { - if (this->isBig) { - this->actionfunc = func_80AE538C; + if (this->waitTimer == 0) { + if (this->type != LEEVER_TYPE_SMALL) { + this->actionfunc = EnReeba_SetupMoveBig; } else { - this->actionfunc = func_80AE5688; + this->actionfunc = EnReeba_SetupSink; } } } } -void func_80AE5EDC(EnReeba* this, PlayState* play) { +void EnReeba_CheckDamage(EnReeba* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - if ((this->actionfunc != func_80AE5C38) && (this->actionfunc != func_80AE5854)) { + if ((this->actionfunc != EnReeba_Die) && (this->actionfunc != EnReeba_Damaged)) { this->actor.shape.rot.x = this->actor.shape.rot.z = 0; - this->unk_27E = 0; + this->stunType = LEEVER_STUN_NONE; switch (this->actor.colChkInfo.damageEffect) { - case 11: // none - case 12: // boomerang - if ((this->actor.colChkInfo.health > 1) && (this->unk_27E != 4)) { - this->unk_27E = 4; + + case LEEVER_DMGEFF_UNUSED: + case LEEVER_DMGEFF_BOOMERANG: + if ((this->actor.colChkInfo.health > 1) && (this->stunType != LEEVER_STUN_OTHER)) { + this->stunType = LEEVER_STUN_OTHER; Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 80); - this->actionfunc = func_80AE58EC; + this->actionfunc = EnReeba_SetupStunned; break; } FALLTHROUGH; - case 13: // hookshot/longshot - if ((this->actor.colChkInfo.health > 2) && (this->unk_27E != 4)) { - this->unk_27E = 4; + case LEEVER_DMGEFF_HOOKSHOT: + if ((this->actor.colChkInfo.health > 2) && (this->stunType != LEEVER_STUN_OTHER)) { + this->stunType = LEEVER_STUN_OTHER; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 80); Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - this->actionfunc = func_80AE58EC; + this->actionfunc = EnReeba_SetupStunned; break; } FALLTHROUGH; - case 14: - this->unk_27C = 6; + case LEEVER_DMGEFF_OTHER: + this->unkDamageField = 6; Actor_ApplyDamage(&this->actor); if (this->actor.colChkInfo.health == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_DEAD); Enemy_StartFinishingBlow(play, &this->actor); - this->actionfunc = func_80AE5BC4; + this->actionfunc = EnReeba_SetupDie; } else { - if (this->actionfunc == func_80AE5E48) { + if (this->actionfunc == EnReeba_StunRecover) { this->actor.shape.rot.x = this->actor.shape.rot.z = 0; } Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_DAMAGE); - this->actionfunc = func_80AE57F0; + this->actionfunc = EnReeba_SetupDamaged; } break; - case 3: // ice arrows/ice magic + + case LEEVER_DMGEFF_ICE: Actor_ApplyDamage(&this->actor); - this->unk_27C = 2; - this->unk_27E = 2; + this->unkDamageField = 2; + this->stunType = LEEVER_STUN_ICE; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 80); - this->actionfunc = func_80AE58EC; + this->actionfunc = EnReeba_SetupStunned; break; - case 1: // unknown - if (this->unk_27E != 4) { - this->unk_27E = 4; + + case LEEVER_DMGEFF_UNK: + if (this->stunType != LEEVER_STUN_OTHER) { + this->stunType = LEEVER_STUN_OTHER; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 80); - this->actionfunc = func_80AE58EC; + this->actionfunc = EnReeba_SetupStunned; } break; + + default: + break; } } } @@ -584,28 +602,28 @@ void EnReeba_Update(Actor* thisx, PlayState* play2) { EnReeba* this = (EnReeba*)thisx; Player* player = GET_PLAYER(play); - func_80AE5EDC(this, play); + EnReeba_CheckDamage(this, play); this->actionfunc(this, play); Actor_SetScale(&this->actor, this->scale); - if (this->unk_270 != 0) { - this->unk_270--; + if (this->bigLeeverTimer != 0) { + this->bigLeeverTimer--; } - if (this->unk_272 != 0) { - this->unk_272--; + if (this->moveTimer != 0) { + this->moveTimer--; } - if (this->unk_278 != 0) { - this->unk_278--; + if (this->waitTimer != 0) { + this->waitTimer--; } - if (this->unk_274 != 0) { - this->unk_274--; + if (this->sfxTimer != 0) { + this->sfxTimer--; } - if (this->unk_276 != 0) { - this->unk_276--; + if (this->damagedTimer != 0) { + this->damagedTimer--; } Actor_MoveForward(&this->actor); @@ -616,25 +634,26 @@ void EnReeba_Update(Actor* thisx, PlayState* play2) { if (this->collider.base.atFlags & AT_BOUNCED) { this->collider.base.atFlags &= ~AT_BOUNCED; - if ((this->actionfunc == func_80AE5270) || (this->actionfunc == func_80AE53AC)) { + if ((this->actionfunc == EnReeba_Move) || (this->actionfunc == EnReeba_MoveBig)) { this->actor.speedXZ = 8.0f; this->actor.world.rot.y *= -1.0f; - this->unk_272 = 14; - this->actionfunc = func_80AE561C; + this->moveTimer = 14; + this->actionfunc = EnReeba_Bumped; return; } } if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - if ((this->collider.base.at == &player->actor) && !this->isBig && (this->actionfunc != func_80AE56E0)) { - this->actionfunc = func_80AE5688; + if ((this->collider.base.at == &player->actor) && this->type == LEEVER_TYPE_SMALL && + (this->actionfunc != EnReeba_Sink)) { + this->actionfunc = EnReeba_SetupSink; } } this->actor.focus.pos = this->actor.world.pos; - if (!this->isBig) { + if (this->type == LEEVER_TYPE_SMALL) { this->actor.focus.pos.y += 15.0f; } else { this->actor.focus.pos.y += 30.0f; @@ -643,13 +662,13 @@ void EnReeba_Update(Actor* thisx, PlayState* play2) { Collider_UpdateCylinder(&this->actor, &this->collider); if ((this->actor.shape.yOffset >= -700.0f) && (this->actor.colChkInfo.health > 0) && - (this->actionfunc != func_80AE56E0)) { + (this->actionfunc != EnReeba_Sink)) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (!(this->actor.shape.yOffset < 0.0f)) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - if ((this->actionfunc == func_80AE5270) || (this->actionfunc == func_80AE53AC)) { + if ((this->actionfunc == EnReeba_Move) || (this->actionfunc == EnReeba_MoveBig)) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } @@ -664,7 +683,7 @@ void EnReeba_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - if (this->isBig) { + if (this->type != LEEVER_TYPE_SMALL) { gDPSetPrimColor(POLY_OPA_DISP++, 0x0, 0x01, 155, 55, 255, 255); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0x0, 0x01, 255, 255, 255, 255); diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h index 61ff9666c3..06bb946d2c 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.h @@ -15,24 +15,28 @@ typedef struct EnReeba { /* 0x01FC */ Vec3s morphTable[18]; /* 0x0268 */ char unk_268[0x4]; /* 0x026C */ EnReebaActionFunc actionfunc; - /* 0x0270 */ s16 unk_270; - /* 0x0272 */ s16 unk_272; - /* 0x0274 */ s16 unk_274; - /* 0x0276 */ s16 unk_276; - /* 0x0278 */ s16 unk_278; - /* 0x027A */ s16 isBig; - /* 0x027C */ s16 unk_27C; - /* 0x027E */ s16 unk_27E; - /* 0x0280 */ s16 unk_280; - /* 0x0284 */ f32 unk_284; - /* 0x0288 */ f32 unk_288; + /* 0x0270 */ s16 bigLeeverTimer; // big Leever uses to close and make distance from Link. + /* 0x0272 */ s16 moveTimer; + /* 0x0274 */ s16 sfxTimer; // delay between moving sfx. 2x if big Leever. + /* 0x0276 */ s16 damagedTimer; + /* 0x0278 */ s16 waitTimer; + /* 0x027A */ s16 type; + /* 0x027C */ s16 unkDamageField; // set when hit with ice and most other weapons. Never read. + /* 0x027E */ s16 stunType; + /* 0x0280 */ s16 aimType; // incremented by the spawner. Dictates rotateY modification + /* 0x0284 */ f32 yOffsetTarget; + /* 0x0288 */ f32 yOffsetStep; /* 0x028C */ f32 scale; /* 0x0290 */ ColliderCylinder collider; } EnReeba; // size = 0x02DC typedef enum { - /* 0 */ LEEVER_SMALL, - /* 1 */ LEEVER_BIG -} LeeverParam; + /* 0 */ LEEVER_TYPE_SMALL, + /* 1 */ LEEVER_TYPE_BIG +} LeeverType; + +#define LEEVER_STUN_NONE 0 +#define LEEVER_STUN_ICE 2 +#define LEEVER_STUN_OTHER 4 #endif