From cdd24f2ac653513f21b9ffd82e3332a0a599cd24 Mon Sep 17 00:00:00 2001 From: cadmic Date: Mon, 26 Feb 2024 18:29:40 -0800 Subject: [PATCH] Match retail En actors V-Z (#1825) * Entity actors starting with Z * Use CS_STATE_IDLE * z -> playerPosZ * Remove comment --- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 8 +- src/overlays/actors/ovl_En_Vm/z_en_vm.c | 6 +- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 2 + .../actors/ovl_En_Weiyer/z_en_weiyer.c | 2 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 32 +++---- src/overlays/actors/ovl_En_Xc/z_en_xc.c | 60 +++++++++--- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 69 ++++++++------ src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 14 ++- src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 91 ++++++++++++------- 9 files changed, 184 insertions(+), 100 deletions(-) diff --git a/src/overlays/actors/ovl_En_Vali/z_en_vali.c b/src/overlays/actors/ovl_En_Vali/z_en_vali.c index 2af941834e..30ab7d6afb 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -572,10 +572,10 @@ void EnVali_Update(Actor* thisx, PlayState* play) { void EnVali_PulseOutside(EnVali* this, f32 curFrame, Vec3f* scale) { f32 scaleChange; + s32 scalePhase; if (this->actionFunc == EnVali_Attacked) { - s32 scalePhase = 20 - (this->lightningTimer % 20); - + scalePhase = 20 - (this->lightningTimer % 20); if (scalePhase >= 10) { scalePhase -= 10; } @@ -607,10 +607,10 @@ void EnVali_PulseOutside(EnVali* this, f32 curFrame, Vec3f* scale) { void EnVali_PulseInsides(EnVali* this, f32 curFrame, Vec3f* scale) { f32 scaleChange; + s32 scalePhase; if (this->actionFunc == EnVali_Attacked) { - s32 scalePhase = 20 - (this->lightningTimer % 20); - + scalePhase = 20 - (this->lightningTimer % 20); if (scalePhase >= 10) { scalePhase -= 10; } diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index d10ebe4539..e9cdcddabf 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -368,15 +368,13 @@ void EnVm_SetupDie(EnVm* this) { } void EnVm_Die(EnVm* this, PlayState* play) { - EnBom* bomb; - this->beamRot.x += 0x5DC; this->headRotY += 0x9C4; Actor_MoveXZGravity(&this->actor); if (--this->timer == 0) { - bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x6FF, BOMB_BODY); + EnBom* bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0x6FF, BOMB_BODY); if (bomb != NULL) { bomb->timer = 0; diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 11e0c9b11a..6793ae1cef 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -609,6 +609,8 @@ void EnWallmas_DrawXlu(EnWallmas* this, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_en_wallmas.c", 1421), G_MTX_LOAD); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_wallmas.c", 1426); } diff --git a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c index d5e321ff50..9ff20a2e51 100644 --- a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c +++ b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c @@ -199,9 +199,9 @@ void func_80B32724(EnWeiyer* this) { } void func_80B327B0(EnWeiyer* this) { - this->actor.colorFilterParams |= 0x2000; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; + this->actor.colorFilterParams |= 0x2000; this->actionFunc = func_80B33338; } diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index 27d1641141..9863713a19 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -285,7 +285,6 @@ s32 EnWf_ChangeAction(PlayState* play, EnWf* this, s16 mustChoose) { s32 pad; s16 wallYawDiff; s16 playerYawDiff; - Actor* explosive; wallYawDiff = this->actor.wallYaw - this->actor.shape.rot.y; wallYawDiff = ABS(wallYawDiff); @@ -321,26 +320,27 @@ s32 EnWf_ChangeAction(PlayState* play, EnWf* this, s16 mustChoose) { EnWf_SetupBackflipAway(this); return true; } - } + } else { + Actor* explosive = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); - explosive = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); + if (explosive != NULL) { + this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (explosive != NULL) { - this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - - if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (wallYawDiff < 0x2EE0)) || - (explosive->id == ACTOR_EN_BOM_CHU)) { - if ((explosive->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && - (s16)((this->actor.shape.rot.y - explosive->world.rot.y) + 0x8000) < 0x3E80) { - EnWf_SetupSomersaultAndAttack(this); - return true; + if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (wallYawDiff < 0x2EE0)) || + (explosive->id == ACTOR_EN_BOM_CHU)) { + if ((explosive->id == ACTOR_EN_BOM_CHU) && + (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && + (s16)((this->actor.shape.rot.y - explosive->world.rot.y) + 0x8000) < 0x3E80) { + EnWf_SetupSomersaultAndAttack(this); + return true; + } else { + EnWf_SetupSidestep(this, play); + return true; + } } else { - EnWf_SetupSidestep(this, play); + EnWf_SetupBackflipAway(this); return true; } - } else { - EnWf_SetupBackflipAway(this); - return true; } } diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index d6fb2b59b9..3df3e36bfb 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -226,8 +226,9 @@ void func_80B3C7D4(EnXc* this, s32 action1, s32 action2, s32 action3) { } } +#if OOT_DEBUG s32 EnXc_NoCutscenePlaying(PlayState* play) { - if (play->csCtx.state == 0) { + if (play->csCtx.state == CS_STATE_IDLE) { return true; } return false; @@ -244,6 +245,7 @@ void func_80B3C888(EnXc* this, PlayState* play) { func_80B3C820(this); } } +#endif void func_80B3C8CC(EnXc* this, PlayState* play) { SkelAnime* skelAnime = &this->skelAnime; @@ -280,6 +282,8 @@ void func_80B3C9EC(EnXc* this) { void func_80B3CA38(EnXc* this, PlayState* play) { // If Player is adult but hasn't learned Minuet of Forest if (!GET_EVENTCHKINF(EVENTCHKINF_50) && LINK_IS_ADULT) { + s32 pad; + this->action = SHEIK_ACTION_INIT; } else { Actor_Kill(&this->actor); @@ -287,12 +291,17 @@ void func_80B3CA38(EnXc* this, PlayState* play) { } s32 EnXc_MinuetCS(EnXc* this, PlayState* play) { - if (this->actor.params == SHEIK_TYPE_MINUET) { - Player* player = GET_PLAYER(play); - f32 z = player->actor.world.pos.z; + Player* player; + f32 playerPosZ; - if (z < -2225.0f) { + if (this->actor.params == SHEIK_TYPE_MINUET) { + player = GET_PLAYER(play); + playerPosZ = player->actor.world.pos.z; + + if (playerPosZ < -2225.0f) { if (!Play_InCsMode(play)) { + s32 pad; + play->csCtx.script = SEGMENTED_TO_VIRTUAL(gMinuetCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_50); @@ -308,6 +317,8 @@ s32 EnXc_MinuetCS(EnXc* this, PlayState* play) { void func_80B3CB58(EnXc* this, PlayState* play) { // If hasn't learned Bolero and Player is Adult if (!GET_EVENTCHKINF(EVENTCHKINF_51) && LINK_IS_ADULT) { + s32 pad; + this->action = SHEIK_ACTION_INIT; } else { Actor_Kill(&this->actor); @@ -324,6 +335,8 @@ s32 EnXc_BoleroCS(EnXc* this, PlayState* play) { if ((posRot->pos.x > -784.0f) && (posRot->pos.x < -584.0f) && (posRot->pos.y > 447.0f) && (posRot->pos.y < 647.0f) && (posRot->pos.z > -446.0f) && (posRot->pos.z < -246.0f) && !Play_InCsMode(play)) { + s32 pad; + play->csCtx.script = SEGMENTED_TO_VIRTUAL(gDeathMountainCraterBoleroCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_51); @@ -336,9 +349,10 @@ s32 EnXc_BoleroCS(EnXc* this, PlayState* play) { } void EnXc_SetupSerenadeAction(EnXc* this, PlayState* play) { - // Player is adult and does not have iron boots and has not learned Serenade - if (!CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && !GET_EVENTCHKINF(EVENTCHKINF_52) && + if (!(CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && OOT_DEBUG) && !GET_EVENTCHKINF(EVENTCHKINF_52) && LINK_IS_ADULT) { + s32 pad; + this->action = SHEIK_ACTION_SERENADE; PRINTF("水のセレナーデ シーク誕生!!!!!!!!!!!!!!!!!!\n"); } else { @@ -354,15 +368,18 @@ s32 EnXc_SerenadeCS(EnXc* this, PlayState* play) { if (CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && !GET_EVENTCHKINF(EVENTCHKINF_52) && !(stateFlags & PLAYER_STATE1_29) && !Play_InCsMode(play)) { + s32 pad; + Cutscene_SetScript(play, gIceCavernSerenadeCs); gSaveContext.cutsceneTrigger = 1; SET_EVENTCHKINF(EVENTCHKINF_52); // Learned Serenade of Water Flag Item_Give(play, ITEM_SONG_SERENADE); PRINTF("ブーツを取った!!!!!!!!!!!!!!!!!!\n"); return true; + } else { + PRINTF("はやくブーツを取るべし!!!!!!!!!!!!!!!!!!\n"); + return false; } - PRINTF("はやくブーツを取るべし!!!!!!!!!!!!!!!!!!\n"); - return false; } return true; } @@ -471,9 +488,10 @@ void EnXc_SetColossusWindSFX(PlayState* play) { if (D_80B41D90 != 0) { f32 speed = Math3D_Vec3f_DistXYZ(&D_80B42DB0, eye) / 7.058922f; +#if OOT_DEBUG sMaxSpeed = CLAMP_MIN(sMaxSpeed, speed); - PRINTF("MAX speed = %f\n", sMaxSpeed); +#endif speed = CLAMP_MAX(speed, 2.0f); func_800F436C(&sPos, NA_SE_EV_FLYING_AIR - SFX_FLAG, 0.6f + (0.4f * speed)); @@ -784,6 +802,8 @@ void EnXc_SetupHarpPutawayAction(EnXc* this, PlayState* play) { curFrame = this->skelAnime.curFrame; animFrameCount = this->skelAnime.endFrame; if (curFrame >= animFrameCount) { + s32 pad; + Animation_Change(&this->skelAnime, &gSheikInitialHarpAnim, -1.0f, Animation_GetLastFrame(&gSheikInitialHarpAnim), 0.0f, ANIMMODE_ONCE, 0.0f); this->action = SHEIK_ACTION_PUT_HARP_AWAY; @@ -873,6 +893,8 @@ void EnXc_SetupDisappear(EnXc* this, PlayState* play) { // Sheik fades away if end of Bolero CS, kill actor otherwise if (sceneId == SCENE_DEATH_MOUNTAIN_CRATER) { + s32 pad; + this->action = SHEIK_ACTION_FADE; this->drawMode = SHEIK_DRAW_NOTHING; this->actor.shape.shadowAlpha = 0; @@ -1666,7 +1688,9 @@ void EnXc_ActionFunc54(EnXc* this, PlayState* play) { EnXc_BgCheck(this, play); EnXc_SetEyePattern(this); EnXc_SetupShowTriforceAction(this, play); +#if OOT_DEBUG func_80B3C888(this, play); +#endif } void EnXc_ShowTriforce(EnXc* this, PlayState* play) { @@ -1677,7 +1701,9 @@ void EnXc_ShowTriforce(EnXc* this, PlayState* play) { EnXc_CalcTriforce(&this->actor, play); func_80B3FAE0(this); EnXc_SetupShowTriforceIdleAction(this, animFinished); +#if OOT_DEBUG func_80B3C888(this, play); +#endif } void EnXc_ShowTriforceIdle(EnXc* this, PlayState* play) { @@ -1814,11 +1840,13 @@ void EnXc_SetupDefenseStance(Actor* thisx) { } void EnXc_SetupContortions(EnXc* this, PlayState* play) { - s32 pad; + s32 pad[2]; SkelAnime* skelAnime = &this->skelAnime; - f32 frameCount = Animation_GetLastFrame(&gSheikIdleAnim); - Animation_Change(skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); +#if OOT_DEBUG + Animation_Change(skelAnime, &gSheikIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSheikIdleAnim), ANIMMODE_LOOP, + 0.0f); +#endif func_80B3C588(this, play, 4); func_80B3C964(this, play); Animation_Change(skelAnime, &gSheikContortionsAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gSheikContortionsAnim), @@ -2171,6 +2199,8 @@ void EnXc_InitTempleOfTime(EnXc* this, PlayState* play) { void EnXc_SetupDialogueAction(EnXc* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { + s32 pad; + this->action = SHEIK_ACTION_IN_DIALOGUE; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -2339,9 +2369,11 @@ void EnXc_Init(Actor* thisx, PlayState* play) { case SHEIK_TYPE_9: EnXc_InitTempleOfTime(this, play); break; +#if OOT_DEBUG case SHEIK_TYPE_0: EnXc_DoNothing(this, play); break; +#endif default: PRINTF(VT_FGCOL(RED) " En_Oa2 の arg_data がおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); EnXc_DoNothing(this, play); @@ -2353,6 +2385,8 @@ s32 EnXc_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if (this->unk_30C != 0) { if (limbIndex == 9) { + s32 pad; + rot->x += this->interactInfo.torsoRot.y; rot->y -= this->interactInfo.torsoRot.x; } else if (limbIndex == 16) { diff --git a/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/src/overlays/actors/ovl_En_Zf/z_en_zf.c index 9d1c93926f..ddf9af8e79 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -412,9 +412,12 @@ s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, P s16 curLoopPlatform = PLATFORM_INDEX_DOWNSTAIRS_INNER_MAX; // Will never retreat to the last two s16 minIndex = PLATFORM_INDEX_DOWNSTAIRS_MIN; f32 largeMaxRange = 99999.0f; - s16 altNextPlatform = -1; - s16 nextPlatform = -1; - s16 playerPlatform = EnZf_FindPlatform(&player->actor.world.pos, initialPlatform); + s16 nextPlatform; + s16 altNextPlatform; + s16 playerPlatform; + + altNextPlatform = nextPlatform = -1; + playerPlatform = EnZf_FindPlatform(&player->actor.world.pos, initialPlatform); // Set up search constraints // Upstairs @@ -436,9 +439,12 @@ s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, P if ((curLoopPlatform == initialPlatform) || (curLoopPlatform == playerPlatform)) { continue; } - if ((playerPlatform == -1) && - (Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]) < playerMaxDist)) { - continue; + if (playerPlatform == -1) { + s16 pad; + + if (Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]) < playerMaxDist) { + continue; + } } distToCurLoopPlatform = Math_Vec3f_DistXYZ(pos, &sPlatformPositions[curLoopPlatform]); @@ -490,6 +496,7 @@ s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, Pl f32 largeMaxRange = 99999.0f; s16 phi_s2 = curPlatform; s16 phi_s3 = arg2; + f32 curPlatformDistToPlayer; // Upstairs if (pos->y > 200.0f) { @@ -503,7 +510,7 @@ s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, Pl continue; } if (curLoopPlatform != nextPlatform) { - f32 curPlatformDistToPlayer = + curPlatformDistToPlayer = Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]); if (curPlatformDistToPlayer < smallMaxRange) { @@ -1783,27 +1790,31 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { if (this->unk_3F8) { this->actor.speed = -this->actor.speed; } - } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || - !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y + 0x3FFF)) { - if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - if (this->actor.speed >= 0.0f) { - phi_v0_4 = this->actor.shape.rot.y + 0x3FFF; + } else { + s16 pad; + + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y + 0x3FFF)) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + if (this->actor.speed >= 0.0f) { + phi_v0_4 = this->actor.shape.rot.y + 0x3FFF; + } else { + phi_v0_4 = this->actor.shape.rot.y - 0x3FFF; + } + + phi_v0_4 = this->actor.wallYaw - phi_v0_4; } else { - phi_v0_4 = this->actor.shape.rot.y - 0x3FFF; + this->actor.speed *= -0.8f; + phi_v0_4 = 0; } - phi_v0_4 = this->actor.wallYaw - phi_v0_4; - } else { - this->actor.speed *= -0.8f; - phi_v0_4 = 0; - } - - if (ABS(phi_v0_4) > 0x4000) { - this->actor.speed *= -0.8f; - if (this->actor.speed < 0.0f) { - this->actor.speed -= 0.5f; - } else { - this->actor.speed += 0.5f; + if (ABS(phi_v0_4) > 0x4000) { + this->actor.speed *= -0.8f; + if (this->actor.speed < 0.0f) { + this->actor.speed -= 0.5f; + } else { + this->actor.speed += 0.5f; + } } } } @@ -1873,6 +1884,8 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { } else if ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) && (D_80B4A1B4 == this->actor.params)) { EnZf_SetupHopAndTaunt(this); } else { + s16 pad; + this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && @@ -1889,10 +1902,8 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { this->unk_3F0--; } if (prevFrame != (s32)this->skelAnime.curFrame) { - s32 afterPrevFrame = absPlaySpeed + prevFrame; - - if (((beforeCurFrame < 14) && (afterPrevFrame >= 16)) || - ((beforeCurFrame < 27) && (afterPrevFrame >= 29))) { + if (((beforeCurFrame < 14) && (absPlaySpeed + prevFrame >= 16)) || + ((beforeCurFrame < 27) && (absPlaySpeed + prevFrame >= 29))) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } } diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index f888e79f2e..d518e4da43 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -337,7 +337,11 @@ void func_80B4EF64(EnZl2* this, s16 arg1, s32 arg2) { } if (arg2 == 2) { + s32 pad; + if ((this->action == 5) || (this->action == 30)) { + s32 temp_t0; + curFrame = this->skelAnime.curFrame; unk_278 = this->unk_278; temp_t0 = (s32)((3500.0f * curFrame) / unk_278) + phi_a0; @@ -346,13 +350,15 @@ void func_80B4EF64(EnZl2* this, s16 arg1, s32 arg2) { phi_v0 /= -2; } } else if ((this->action == 6) || (this->action == 31)) { - temp_t0 = phi_a0 + 0xDAC; + s32 temp_t0 = phi_a0 + 0xDAC; + if (temp_t0 >= temp_v1) { temp_v1 = temp_t0; phi_v0 /= -2; } } else if (this->action == 20) { - temp_t0 = phi_a0 - 0x3E8; + s32 temp_t0 = phi_a0 - 0x3E8; + if (temp_t0 >= temp_v1) { temp_v1 = temp_t0; phi_v0 /= -2; @@ -1566,9 +1572,11 @@ void func_80B52114(EnZl2* this, PlayState* play) { case 4: func_80B51D0C(this, play); break; +#if OOT_DEBUG case 0: func_80B4FD90(this, play); break; +#endif default: PRINTF(VT_FGCOL(RED) " En_Oa2 の arg_data がおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); func_80B4FD90(this, play); @@ -1581,10 +1589,12 @@ void func_80B521A0(EnZl2* this, PlayState* play) { s32 objectSlot = Object_GetSlot(objectCtx, OBJECT_ZL2_ANIME1); s32 pad2; +#if OOT_DEBUG if (objectSlot < 0) { PRINTF(VT_FGCOL(RED) "En_Zl2_main_bankアニメーションのバンクを読めない!!!!!!!!!!!!\n" VT_RST); return; } +#endif if (Object_IsLoaded(objectCtx, objectSlot)) { this->zl2Anime1ObjectSlot = objectSlot; diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index 24e97ebd1d..dc1f5ea812 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -271,7 +271,6 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { s32 temp_a0; s32 phi_v0; s32 phi_v1; - s32 phi_v1_2; if (idx == 2) { phi_a1 = 15000; @@ -315,18 +314,26 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (idx == 2 && (action == 5 || action == 24)) { if (phi_v1 != 0) { + s32 pad; + phi_v0 -= (phi_v1 - phi_v0) / 10; } } else if (idx == 2 && action == 22 && skelAnime->mode == 2) { if (phi_v1 != 0) { + s32 pad; + phi_v0 -= (phi_v1 - phi_v0) / 10; } } else if (idx == 2 && (action == 20 || action == 21) && skelAnime->mode == 2) { if (phi_v1 != 0) { + s32 pad; + phi_v0 -= (phi_v1 - phi_v0) / 10; } } else { if (phi_v1 != 0) { + s32 pad; + phi_v0 += (phi_v1 - phi_v0) / 16; } } @@ -352,8 +359,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E0 = this->unk_3E0; + s32 phi_v1_2 = (s32)(((unk_3E0 - curFrame) / unk_3E0) * -2000.0f) + phi_a1; - phi_v1_2 = (s32)(((unk_3E0 - curFrame) / unk_3E0) * -2000.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -365,8 +372,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E4 = this->unk_3E4; + s32 phi_v1_2 = (s32)((curFrame / unk_3E4) * -2000.0f) + phi_a1; - phi_v1_2 = (s32)((curFrame / unk_3E4) * -2000.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -374,7 +381,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 - 2000; + s32 phi_v1_2 = phi_a1 - 2000; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -386,6 +394,7 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3F4 = this->unk_3F4; + s32 phi_v1_2; if (curFrame <= 42.0f) { phi_v1_2 = phi_a1 - 2000; @@ -400,7 +409,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 + 4200; + s32 phi_v1_2 = phi_a1 + 4200; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -412,8 +422,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3EC = this->unk_3EC; + s32 phi_v1_2 = (s32)(((curFrame / unk_3EC) * -5200.0f) + 4200.0f) + phi_a1; - phi_v1_2 = (s32)(((curFrame / unk_3EC) * -5200.0f) + 4200.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -421,7 +431,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 - 2000; + s32 phi_v1_2 = phi_a1 - 2000; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -433,8 +444,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3F0 = this->unk_3F0; + s32 phi_v1_2 = (s32)(((curFrame / unk_3F0) * -7600.0f) + -2000.0f) + phi_a1; - phi_v1_2 = (s32)(((curFrame / unk_3F0) * -7600.0f) + -2000.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -442,7 +453,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 - 9600; + s32 phi_v1_2 = phi_a1 - 9600; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -454,8 +466,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E8 = this->unk_3E8; + s32 phi_v1_2 = (s32)(((curFrame / unk_3E8) * 21000.0f) + -9600.0f) + phi_a1; - phi_v1_2 = (s32)(((curFrame / unk_3E8) * 21000.0f) + -9600.0f) + phi_a1; if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -463,7 +475,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 + 11400; + s32 phi_v1_2 = phi_a1 + 11400; + if (phi_v1_2 >= temp_a0) { temp_a0 = phi_v1_2; if (phi_v0 < 0) { @@ -477,8 +490,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E0 = this->unk_3E0; + s32 phi_v1_2 = (s32)((curFrame / unk_3E0) * -7000.0f) + phi_a1; - phi_v1_2 = (s32)((curFrame / unk_3E0) * -7000.0f) + phi_a1; if (temp_a0 >= phi_v1_2) { temp_a0 = phi_v1_2; if (phi_v0 > 0) { @@ -486,7 +499,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { } } } else { - phi_v1_2 = phi_a1 - 7000; + s32 phi_v1_2 = phi_a1 - 7000; + if (temp_a0 >= phi_v1_2) { temp_a0 = phi_v1_2; if (phi_v0 > 0) { @@ -498,8 +512,8 @@ void func_80B53B64(EnZl3* this, s16 z, s32 idx) { if (skelAnime->mode == 2) { f32 curFrame = skelAnime->curFrame; f32 unk_3E4 = this->unk_3E4; + s32 phi_v1_2 = (s32)(((unk_3E4 - curFrame) / unk_3E4) * -7000.0f) + phi_a1; - phi_v1_2 = (s32)(((unk_3E4 - curFrame) / unk_3E4) * -7000.0f) + phi_a1; if (temp_a0 >= phi_v1_2) { temp_a0 = phi_v1_2; if (phi_v0 > 0) { @@ -582,17 +596,18 @@ void func_80B54360(EnZl3* this, s16 arg1, s32 arg2) { } s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { - s32 pad[3]; + s32 pad[2]; EnZl3* this = (EnZl3*)thisx; - s16* unk_28C = this->unk_28C; - Mtx* sp78; - MtxF sp38; - Vec3s sp30; Vec3s* headRot = &this->interactInfo.headRot; Vec3s* torsoRot = &this->interactInfo.torsoRot; if (limbIndex == 14) { - sp78 = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 7); + Mtx* sp78 = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 7); + MtxF sp38; + Vec3s sp30; + s16* unk_28C = this->unk_28C; + s32 pad2; + rot->x += headRot->y; rot->z += headRot->x; gSPSegment((*gfx)++, 0x0C, sp78); @@ -687,16 +702,16 @@ s32 func_80B5458C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s void EnZl3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnZl3* this = (EnZl3*)thisx; s32 pad; - Vec3f sp34; - s32 pad2; - Vec3f sp24; - Vec3f sp18; if (limbIndex == 13) { - sp34 = D_80B5A46C; + Vec3f sp34 = D_80B5A46C; + s32 pad2; + Matrix_MultVec3f(&sp34, &this->unk_31C); } else if (limbIndex == 14) { - sp24 = D_80B5A478; + Vec3f sp24 = D_80B5A478; + Vec3f sp18; + Matrix_MultVec3f(&sp24, &sp18); this->actor.focus.pos.x = sp18.x; this->actor.focus.pos.y = sp18.y; @@ -796,6 +811,8 @@ void func_80B55054(EnZl3* this) { f32* temp_v0 = &this->unk_2EC; if (*temp_v0 < 19.0f) { + s32 pad; + ((DoorWarp1*)child)->crystalAlpha = (20.0f - *temp_v0) * 12.75f; *temp_v0 += 1.0f; } else { @@ -1777,8 +1794,12 @@ void func_80B5764C(EnZl3* this, PlayState* play) { } s32 func_80B576C8(EnZl3* this, PlayState* play) { - if (func_80B575F0(this, play) && (this->unk_3D8 == 0)) { - return 1; + if (func_80B575F0(this, play)) { + s32 pad; + + if (this->unk_3D8 == 0) { + return 1; + } } return 0; } @@ -1986,6 +2007,8 @@ s32 func_80B57D80(EnZl3* this, PlayState* play) { void func_80B57EAC(EnZl3* this, PlayState* play) { if (func_80B57324(this, play)) { + s32 pad; + this->action = 26; } else { func_80B57350(this, play); @@ -2028,6 +2051,8 @@ void func_80B58014(EnZl3* this, PlayState* play) { this->action = 29; func_80B538B0(this); } else if (func_80B57C8C(this) && func_80B57F84(this, play)) { + s32 pad; + OnePointCutscene_Init(play, 4000, -99, &this->actor, CAM_ID_MAIN); this->unk_3D0 = 0; } else if (func_80B576C8(this, play) && func_80B575B0(this, play) && !Play_InCsMode(play)) { @@ -2129,7 +2154,7 @@ void func_80B584B4(EnZl3* this, PlayState* play) { } void func_80B58624(EnZl3* this, PlayState* play) { - s32 pad[4]; + s32 pad[3]; f32* unk_3CC = &this->unk_3CC; if (*unk_3CC == (kREG(18) + 10.0f)) { @@ -2137,6 +2162,8 @@ void func_80B58624(EnZl3* this, PlayState* play) { func_80B54E14(this, &gZelda2Anime2Anim_008050, 0, -12.0f, 0); func_80B5772C(this, play); } else if (*unk_3CC == kREG(19) + 20.0f) { + s32 pad2; + *unk_3CC += 1.0f; this->actor.textId = 0x71AC; Message_StartTextbox(play, this->actor.textId, NULL); @@ -2508,9 +2535,9 @@ s32 func_80B59768(EnZl3* this, PlayState* play) { } void func_80B59828(EnZl3* this, PlayState* play) { - if (func_80B59698(this, play) || (!func_80B56EE4(this, play) && func_80B57890(this, play))) { - s16 newRotY; + s16 newRotY; + if (func_80B59698(this, play) || (!func_80B56EE4(this, play) && func_80B57890(this, play))) { func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, 0.0f, 0); this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; func_80B56F10(this, play); @@ -2616,10 +2643,12 @@ void func_80B59DB8(EnZl3* this, PlayState* play) { s32 objectSlot = Object_GetSlot(objectCtx, OBJECT_ZL2_ANIME2); s32 pad2; +#if OOT_DEBUG if (objectSlot < 0) { PRINTF(VT_FGCOL(RED) "En_Zl3_main_bankアニメーションのバンクを読めない!!!!!!!!!!!!\n" VT_RST); return; } +#endif if (Object_IsLoaded(objectCtx, objectSlot)) { this->zl2Anime2ObjectSlot = objectSlot;