From 93295a842bfeb039d3cf48f8ae1331b7dcb3457a Mon Sep 17 00:00:00 2001 From: cadmic Date: Thu, 22 Feb 2024 06:08:40 -0800 Subject: [PATCH] Match some entity actors H-N (#1827) --- .../actors/ovl_En_Heishi2/z_en_heishi2.c | 27 ++- .../actors/ovl_En_Heishi4/z_en_heishi4.c | 4 +- .../z_en_horse_game_check.c | 19 +- .../z_en_horse_link_child.c | 7 +- .../ovl_En_Horse_Normal/z_en_horse_normal.c | 32 +-- src/overlays/actors/ovl_En_Hy/z_en_hy.c | 4 +- .../actors/ovl_En_Ice_Hono/z_en_ice_hono.c | 4 + src/overlays/actors/ovl_En_Ik/z_en_ik.c | 13 +- .../actors/ovl_En_Jsjutan/z_en_jsjutan.c | 11 +- .../actors/ovl_En_Kanban/z_en_kanban.c | 206 +++++++++--------- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 22 +- src/overlays/actors/ovl_En_Ma2/z_en_ma2.c | 2 +- src/overlays/actors/ovl_En_Mb/z_en_mb.c | 4 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 4 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 16 ++ .../actors/ovl_En_Niw_Lady/z_en_niw_lady.c | 18 +- src/overlays/actors/ovl_En_Ny/z_en_ny.c | 5 +- 17 files changed, 219 insertions(+), 179 deletions(-) diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index c7e05bc863..7255fba4aa 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -17,7 +17,7 @@ void EnHeishi2_Init(Actor* thisx, PlayState* play); void EnHeishi2_Destroy(Actor* thisx, PlayState* play); void EnHeishi2_Update(Actor* thisx, PlayState* play); -void EnHeishi2_Draw(Actor* thisx, PlayState* play); +void EnHeishi2_Draw(Actor* thisx, PlayState* play2); void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play); void EnHeishi2_DoNothing1(EnHeishi2* this, PlayState* play); @@ -389,7 +389,6 @@ void func_80A5399C(EnHeishi2* this, PlayState* play) { void func_80A53AD4(EnHeishi2* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 exchangeItemId; s16 yawDiffTemp; s16 yawDiff; @@ -400,8 +399,10 @@ void func_80A53AD4(EnHeishi2* this, PlayState* play) { this->actor.textId = 0x200E; } this->unk_300 = TEXT_STATE_DONE; + if (Actor_TalkOfferAccepted(&this->actor, play)) { - exchangeItemId = func_8002F368(play); + s32 exchangeItemId = func_8002F368(play); + if (exchangeItemId == EXCH_ITEM_ZELDAS_LETTER) { Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); player->actor.textId = 0x2010; @@ -410,12 +411,14 @@ void func_80A53AD4(EnHeishi2* this, PlayState* play) { } else if (exchangeItemId != EXCH_ITEM_NONE) { player->actor.textId = 0x200F; } - } else { - yawDiffTemp = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - yawDiff = ABS(yawDiffTemp); - if (!(120.0f < this->actor.xzDistToPlayer) && (yawDiff < 0x4300)) { - Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 100.0f, EXCH_ITEM_ZELDAS_LETTER); - } + return; + } + + yawDiffTemp = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + yawDiff = ABS(yawDiffTemp); + + if (!(120.0f < this->actor.xzDistToPlayer) && (yawDiff < 0x4300)) { + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 100.0f, EXCH_ITEM_ZELDAS_LETTER); } } @@ -834,9 +837,9 @@ void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_en_heishi2.c", 1777); } -void EnHeishi2_Draw(Actor* thisx, PlayState* play) { +void EnHeishi2_Draw(Actor* thisx, PlayState* play2) { + PlayState* play = (PlayState*)play2; EnHeishi2* this = (EnHeishi2*)thisx; - Mtx* mtx; s32 linkChildObjectSlot; OPEN_DISPS(play->state.gfxCtx, "../z_en_heishi2.c", 1792); @@ -848,6 +851,8 @@ void EnHeishi2_Draw(Actor* thisx, PlayState* play) { if ((this->type == 5) && GET_INFTABLE(INFTABLE_77)) { linkChildObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_LINK_CHILD); if (linkChildObjectSlot >= 0) { + Mtx* mtx; + Matrix_Put(&this->mtxf_330); Matrix_Translate(-570.0f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateZ(DEG_TO_RAD(70), MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index b0a853b023..691f0bb641 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -211,6 +211,8 @@ void func_80A56614(EnHeishi4* this, PlayState* play) { } void func_80A5673C(EnHeishi4* this, PlayState* play) { + f32 frames; + if (GET_EVENTCHKINF(EVENTCHKINF_45)) { PRINTF(VT_FGCOL(YELLOW) " ☆☆☆☆☆ マスターソード祝入手! ☆☆☆☆☆ \n" VT_RST); Actor_Kill(&this->actor); @@ -219,7 +221,7 @@ void func_80A5673C(EnHeishi4* this, PlayState* play) { this->unk_284 = 0; if (GET_EVENTCHKINF(EVENTCHKINF_80)) { if (!GET_INFTABLE(INFTABLE_6C)) { - f32 frames = Animation_GetLastFrame(&gEnHeishiDyingGuardAnim_00C444); + frames = Animation_GetLastFrame(&gEnHeishiDyingGuardAnim_00C444); Animation_Change(&this->skelAnime, &gEnHeishiDyingGuardAnim_00C444, 1.0f, 0.0f, (s16)frames, ANIMMODE_LOOP, -10.0f); this->actor.textId = 0x7007; diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index ed63cd139b..53c09dc472 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -136,12 +136,14 @@ s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play) Player* player = GET_PLAYER(play); s32 i; EnHorse* ingoHorse; - EnHorse* horse; + Player* player2 = player; if ((this->startTimer > 50) && !(this->startFlags & INGORACE_SET_TIMER)) { this->startFlags |= INGORACE_SET_TIMER; Interface_SetTimer(0); } else if ((this->startTimer > 80) && (player->rideActor != NULL) && !(this->startFlags & INGORACE_PLAYER_MOVE)) { + EnHorse* horse; + this->startFlags |= INGORACE_PLAYER_MOVE; horse = (EnHorse*)player->rideActor; horse->inRace = 1; @@ -175,8 +177,6 @@ s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, PlayState* play) } if (this->result == INGORACE_NO_RESULT) { - Player* player2 = player; - if ((player2->rideActor != NULL) && (this->playerCheck[2] == 1) && AT_FINISH_LINE(player2->rideActor)) { this->playerFinish++; if (this->playerFinish > 0) { @@ -319,6 +319,8 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play s32 i; Player* player = GET_PLAYER(play); EnHorse* horse; + Player* player2 = player; + f32 dist; if (!(this->raceFlags & MALONRACE_PLAYER_ON_MARK) && AT_FINISH_LINE(player->rideActor)) { this->raceFlags |= MALONRACE_PLAYER_ON_MARK; @@ -330,10 +332,12 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play this->raceFlags |= MALONRACE_SET_TIMER; Interface_SetTimer(0); } else if ((this->startTimer > 80) && (player->rideActor != NULL) && !(this->raceFlags & MALONRACE_PLAYER_MOVE)) { - this->raceFlags |= MALONRACE_PLAYER_MOVE; - horse = (EnHorse*)player->rideActor; + EnHorse* rideHorse; - horse->inRace = 1; + this->raceFlags |= MALONRACE_PLAYER_MOVE; + rideHorse = (EnHorse*)player->rideActor; + + rideHorse->inRace = 1; } else if ((this->startTimer > 81) && !(this->raceFlags & MALONRACE_START_SFX)) { this->raceFlags |= MALONRACE_START_SFX; Audio_PlaySfxGeneral(NA_SE_SY_START_SHOT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -342,9 +346,6 @@ s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, PlayState* play this->startTimer++; if (this->result == MALONRACE_NO_RESULT) { - Player* player2 = player; - f32 dist; - for (i = 0; i < 16; i++) { if ((this->lapCount == 0) && (i >= 8)) { break; diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index 8c50ffc8de..2eedfd0b65 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -344,8 +344,6 @@ void func_80A6A068(EnHorseLinkChild* this, PlayState* play) { f32 distFromLink; s32 animationEnded; s32 newAnimationIdx; - f32 distFromHome; - f32 distLinkFromHome; func_80A69F5C(this, play); player = GET_PLAYER(play); @@ -369,8 +367,9 @@ void func_80A6A068(EnHorseLinkChild* this, PlayState* play) { animationEnded = SkelAnime_Update(&this->skin.skelAnime); if (animationEnded || (this->animationIdx == 1) || (this->animationIdx == 0)) { if (GET_EVENTCHKINF(EVENTCHKINF_TALKED_TO_CHILD_MALON_AT_RANCH)) { - distFromHome = Math3D_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos); - distLinkFromHome = Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &this->actor.home.pos); + f32 distFromHome = Math3D_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos); + f32 distLinkFromHome = Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &this->actor.home.pos); + if (distLinkFromHome > 250.0f) { if (distFromHome >= 300.0f) { newAnimationIdx = 4; diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c index 01a1ebc249..5b8aebc28b 100644 --- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c +++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c @@ -31,7 +31,7 @@ typedef enum { void EnHorseNormal_Init(Actor* thisx, PlayState* play); void EnHorseNormal_Destroy(Actor* thisx, PlayState* play); void EnHorseNormal_Update(Actor* thisx, PlayState* play); -void EnHorseNormal_Draw(Actor* thisx, PlayState* play); +void EnHorseNormal_Draw(Actor* thisx, PlayState* play2); void func_80A6B91C(EnHorseNormal* this, PlayState* play); void func_80A6BC48(EnHorseNormal* this); @@ -333,10 +333,10 @@ void EnHorseNormal_CycleAnimations(EnHorseNormal* this, PlayState* play) { void func_80A6BC48(EnHorseNormal* this) { this->action = HORSE_WANDER; this->animationIdx = 0; - this->unk_21C = 0; - this->unk_21E = 0; this->actor.speed = 0.0f; this->unk_218 = 0.0f; + this->unk_21C = 0; + this->unk_21E = 0; Animation_Change(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } @@ -484,10 +484,10 @@ void EnHorseNormal_Wander(EnHorseNormal* this, PlayState* play) { void func_80A6C4CC(EnHorseNormal* this) { this->action = HORSE_WAIT; this->animationIdx = 0; - this->unk_21C = 0; - this->unk_21E = 0; this->actor.speed = 0.0f; this->unk_218 = 0.0f; + this->unk_21C = 0; + this->unk_21E = 0; Animation_Change(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } @@ -516,11 +516,11 @@ void EnHorseNormal_Wait(EnHorseNormal* this, PlayState* play) { void func_80A6C6B0(EnHorseNormal* this) { this->action = HORSE_WAIT_CLONE; this->animationIdx = 0; + this->actor.speed = 0.0f; + this->unk_218 = 0.0f; this->unk_21C = 0; this->unk_21E = 0; this->actor.flags |= ACTOR_FLAG_4 | ACTOR_FLAG_5; - this->actor.speed = 0.0f; - this->unk_218 = 0.0f; Animation_Change(&this->skin.skelAnime, sAnimations[this->animationIdx], func_80A6B30C(this), 0.0f, Animation_GetLastFrame(sAnimations[this->animationIdx]), ANIMMODE_ONCE, 0.0f); } @@ -648,9 +648,9 @@ void func_80A6CC88(PlayState* play, EnHorseNormal* this, Vec3f* arg2) { } } -void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { +void EnHorseNormal_Draw(Actor* thisx, PlayState* play2) { EnHorseNormal* this = (EnHorseNormal*)thisx; - Mtx* mtx2; + PlayState* play = (PlayState*)play2; OPEN_DISPS(play->state.gfxCtx, "../z_en_horse_normal.c", 2224); @@ -662,7 +662,7 @@ void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { if (this->action == HORSE_WAIT_CLONE) { MtxF skinMtx; - Mtx* mtx1; + Mtx* mtx; Vec3f clonePos = { 0.0f, 0.0f, 0.0f }; s16 cloneRotY; f32 distFromGround = this->actor.world.pos.y - this->actor.floorHeight; @@ -702,12 +702,12 @@ void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { this->actor.shape.rot.x, cloneRotY, this->actor.shape.rot.z, clonePos.x, (this->actor.shape.yOffset * this->actor.scale.y) + clonePos.y, clonePos.z); - mtx1 = SkinMatrix_MtxFToNewMtx(play->state.gfxCtx, &skinMtx); - if (mtx1 == NULL) { + mtx = SkinMatrix_MtxFToNewMtx(play->state.gfxCtx, &skinMtx); + if (mtx == NULL) { return; } gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPMatrix(POLY_OPA_DISP++, mtx1, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPMatrix(POLY_OPA_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); func_800A63CC(&this->actor, play, &this->skin, NULL, NULL, true, 0, SKIN_DRAW_FLAG_CUSTOM_TRANSFORMS | SKIN_DRAW_FLAG_CUSTOM_MATRIX); this->cloneCollider.dim.pos.x = clonePos.x; @@ -720,9 +720,9 @@ void EnHorseNormal_Draw(Actor* thisx, PlayState* play) { temp_f0_4 = (1.0f - (distFromGround * 0.01f)) * this->actor.shape.shadowScale; Matrix_Scale(this->actor.scale.x * temp_f0_4, 1.0f, this->actor.scale.z * temp_f0_4, MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(cloneRotY), MTXMODE_APPLY); - mtx2 = MATRIX_NEW(play->state.gfxCtx, "../z_en_horse_normal.c", 2329); - if (mtx2 != NULL) { - gSPMatrix(POLY_XLU_DISP++, mtx2, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + mtx = MATRIX_NEW(play->state.gfxCtx, "../z_en_horse_normal.c", 2329); + if (mtx != NULL) { + gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gHorseShadowDL); } } diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index b0ae4a2353..7394b7c5d4 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -1106,8 +1106,6 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po u8 i; void* ptr; - if (1) {} - OPEN_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2170); if (limbIndex == 15) { @@ -1143,6 +1141,8 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po rot->z += Math_CosS(this->unk_23C[limbIndex]) * 200.0f; } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2228); return false; diff --git a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c index 10d4addaeb..1528f2b20e 100644 --- a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c +++ b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c @@ -356,9 +356,13 @@ void EnIceHono_Update(Actor* thisx, PlayState* play) { sin156 = Math_SinS(this->unk_156); sin154 = Math_SinS(this->unk_154); intensity = (Rand_ZeroOne() * 0.05f) + ((sin154 * 0.125f) + (sin156 * 0.1f)) + 0.425f; + +#if OOT_DEBUG if ((intensity > 0.7f) || (intensity < 0.2f)) { PRINTF("ありえない値(ratio = %f)\n", intensity); // "impossible value(ratio = %f)" } +#endif + Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, (s16)this->actor.world.pos.y + 10, this->actor.world.pos.z, (s32)(155.0f * intensity), (s32)(210.0f * intensity), (s32)(255.0f * intensity), 1400); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index ea075b0c8f..cc8dabe251 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -708,18 +708,13 @@ void EnIk_Die(EnIk* this, PlayState* play) { } void EnIk_UpdateDamage(EnIk* this, PlayState* play) { - f32 frames; - s16 pad; - u8 prevHealth; - s32 damageEffect; - Vec3f sparksPos; if ((this->unk_2F8 == 3) || (this->unk_2F8 == 2)) { return; } if (this->shieldCollider.base.acFlags & AC_BOUNCED) { - frames = Animation_GetLastFrame(&gIronKnuckleBlockAnim) - 2.0f; + f32 frames = Animation_GetLastFrame(&gIronKnuckleBlockAnim) - 2.0f; if (this->skelAnime.curFrame < frames) { this->skelAnime.curFrame = frames; @@ -728,7 +723,11 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { this->shieldCollider.base.acFlags &= ~AC_BOUNCED; this->bodyCollider.base.acFlags &= ~AC_HIT; } else if (this->bodyCollider.base.acFlags & AC_HIT) { - sparksPos = this->actor.world.pos; + s16 pad; + u8 prevHealth; + s32 damageEffect; + Vec3f sparksPos = this->actor.world.pos; + sparksPos.y += 50.0f; Actor_SetDropFlag(&this->actor, &this->bodyCollider.elem, true); diff --git a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index f8895308c9..f6fcd43c62 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -88,8 +88,8 @@ void func_80A89A6C(EnJsjutan* this, PlayState* play) { Vtx* phi_s0_2; Vec3f sp108; Vec3f spFC; - Actor* actorProfessor; - Actor* actorBeanGuy; + f32 rotX; + f32 rotZ; f32 dxVtx; f32 dyVtx; f32 dzVtx; @@ -148,6 +148,9 @@ void func_80A89A6C(EnJsjutan* this, PlayState* play) { // Credits scene. The magic carpet man is friends with the bean guy and the lakeside professor. if ((gSaveContext.save.entranceIndex == ENTR_LON_LON_RANCH_0) && (gSaveContext.sceneLayer == 8)) { + Actor* actorProfessor; + Actor* actorBeanGuy; + isInCreditsScene = true; actorProfessor = play->actorCtx.actorLists[ACTORCAT_NPC].head; @@ -320,10 +323,6 @@ void func_80A89A6C(EnJsjutan* this, PlayState* play) { // Fancy math to smooth each part of the wave considering its neighborhood. for (i = 0; i < ARRAY_COUNT(sCarpetOddVtx); i++, carpetVtx++) { - f32 rotX; - f32 rotZ; - s32 pad; - // Carpet size is 12x12. if ((i % 12) == 11) { // Last column. j = i - 1; diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index d14687b630..bd5edc270c 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -194,10 +194,14 @@ static u16 sCutFlags[] = { }; void EnKanban_SetFloorRot(EnKanban* this) { + f32 nx; + f32 ny; + f32 nz; + if (this->actor.floorPoly != NULL) { - f32 nx = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x); - f32 ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); - f32 nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); + nx = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.x); + ny = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.y); + nz = COLPOLY_GET_NORMAL(this->actor.floorPoly->normal.z); this->floorRot.x = -Math_FAtan2F(-nz * ny, 1.0f); this->floorRot.z = Math_FAtan2F(-nx * ny, 1.0f); @@ -437,7 +441,6 @@ void EnKanban_Update(Actor* thisx, PlayState* play2) { f32 tempY; f32 tempZ; f32 tempYDistToWater; - u8 onGround; Actor_MoveXZGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 30.0f, 30.0f, 50.0f, @@ -460,107 +463,112 @@ void EnKanban_Update(Actor* thisx, PlayState* play2) { this->actor.yDistToWater = tempYDistToWater; PRINTF(VT_RST); - onGround = (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); - if (this->spinXFlag) { - this->spinRot.x += this->spinVel.x; - this->spinVel.x -= 0x800; - if ((this->spinRot.x <= 0) && onGround) { - this->spinRot.x = 0; - this->spinVel.x = 0; + + if (1) { + u8 onGround = (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); + + if (this->spinXFlag) { + this->spinRot.x += this->spinVel.x; + this->spinVel.x -= 0x800; + if ((this->spinRot.x <= 0) && onGround) { + this->spinRot.x = 0; + this->spinVel.x = 0; + } + } else { + this->spinRot.x -= this->spinVel.x; + this->spinVel.x -= 0x800; + if ((this->spinRot.x >= 0) && onGround) { + this->spinRot.x = 0; + this->spinVel.x = 0; + } } - } else { - this->spinRot.x -= this->spinVel.x; - this->spinVel.x -= 0x800; - if ((this->spinRot.x >= 0) && onGround) { - this->spinRot.x = 0; - this->spinVel.x = 0; + if (this->spinVel.x < -0xC00) { + this->spinVel.x = -0xC00; } - } - if (this->spinVel.x < -0xC00) { - this->spinVel.x = -0xC00; - } - if (this->spinZFlag) { - this->spinRot.z += this->spinVel.z; - this->spinVel.z -= 0x800; - if ((this->spinRot.z <= 0) && onGround) { - this->spinRot.z = 0; - this->spinVel.z = 0; + if (this->spinZFlag) { + this->spinRot.z += this->spinVel.z; + this->spinVel.z -= 0x800; + if ((this->spinRot.z <= 0) && onGround) { + this->spinRot.z = 0; + this->spinVel.z = 0; + } + } else { + this->spinRot.z -= this->spinVel.z; + this->spinVel.z -= 0x800; + if ((this->spinRot.z >= 0) && onGround) { + this->spinRot.z = 0; + this->spinVel.z = 0; + } } - } else { - this->spinRot.z -= this->spinVel.z; - this->spinVel.z -= 0x800; - if ((this->spinRot.z >= 0) && onGround) { - this->spinRot.z = 0; - this->spinVel.z = 0; + if (this->spinVel.z < -0xC00) { + this->spinVel.z = -0xC00; + } + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + this->actor.speed *= -0.5f; + Actor_PlaySfx(&this->actor, NA_SE_EV_WOODPLATE_BOUND); + } + if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { + this->actionState = ENKANBAN_WATER; + Actor_PlaySfx(&this->actor, NA_SE_EV_BOMB_DROP_WATER); + this->bounceX = this->bounceZ = 0; + this->actor.world.pos.y += this->actor.yDistToWater; + EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 0, (this->partCount * 20) + 300); + EffectSsGRipple_Spawn(play, &this->actor.world.pos, 150, 650, 0); + EffectSsGRipple_Spawn(play, &this->actor.world.pos, 300, 800, 5); + this->actor.velocity.y = 0.0f; + this->actor.gravity = 0.0f; + PRINTF(" WAT Y = %f\n", this->actor.yDistToWater); + PRINTF(" POS Y = %f\n", this->actor.world.pos.y); + PRINTF(" GROUND Y = %f\n", this->actor.floorHeight); + break; + } + + if (onGround) { + if (this->bounceCount <= 0) { + this->bounceCount++; + this->actor.velocity.y *= -0.3f; + this->actor.world.rot.y += (s16)Rand_CenteredFloat(16384.0f); + } else { + this->actor.velocity.y = 0.0f; + } + this->actor.speed *= 0.7f; + if ((this->spinRot.x == 0) && (this->bounceX != 0)) { + this->spinVel.x = this->bounceX * 0x200; + if (this->bounceX != 0) { + this->bounceX -= 5; + if (this->bounceX <= 0) { + this->bounceX = 0; + } + } + if (Rand_ZeroOne() < 0.5f) { + this->spinXFlag = true; + } else { + this->spinXFlag = false; + } + bounced = true; + } + if ((this->spinRot.z == 0) && (this->bounceZ != 0)) { + this->spinVel.z = this->bounceZ * 0x200; + if (this->bounceZ != 0) { + this->bounceZ -= 5; + if (this->bounceZ <= 0) { + this->bounceZ = 0; + } + } + if (Rand_ZeroOne() < 0.5f) { + this->spinZFlag = true; + } else { + this->spinZFlag = false; + } + bounced = true; + } + Math_ApproachS(&this->actor.shape.rot.x, this->direction * 0x4000, 1, 0x2000); + } else { + this->actor.shape.rot.y += this->spinVel.y; + this->actor.shape.rot.x += this->direction * 0x7D0; } - } - if (this->spinVel.z < -0xC00) { - this->spinVel.z = -0xC00; - } - if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - this->actor.speed *= -0.5f; - Actor_PlaySfx(&this->actor, NA_SE_EV_WOODPLATE_BOUND); - } - if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { - this->actionState = ENKANBAN_WATER; - Actor_PlaySfx(&this->actor, NA_SE_EV_BOMB_DROP_WATER); - this->bounceX = this->bounceZ = 0; - this->actor.world.pos.y += this->actor.yDistToWater; - EffectSsGSplash_Spawn(play, &this->actor.world.pos, NULL, NULL, 0, (this->partCount * 20) + 300); - EffectSsGRipple_Spawn(play, &this->actor.world.pos, 150, 650, 0); - EffectSsGRipple_Spawn(play, &this->actor.world.pos, 300, 800, 5); - this->actor.velocity.y = 0.0f; - this->actor.gravity = 0.0f; - PRINTF(" WAT Y = %f\n", this->actor.yDistToWater); - PRINTF(" POS Y = %f\n", this->actor.world.pos.y); - PRINTF(" GROUND Y = %f\n", this->actor.floorHeight); - break; } - if (onGround) { - if (this->bounceCount <= 0) { - this->bounceCount++; - this->actor.velocity.y *= -0.3f; - this->actor.world.rot.y += (s16)Rand_CenteredFloat(16384.0f); - } else { - this->actor.velocity.y = 0.0f; - } - this->actor.speed *= 0.7f; - if ((this->spinRot.x == 0) && (this->bounceX != 0)) { - this->spinVel.x = this->bounceX * 0x200; - if (this->bounceX != 0) { - this->bounceX -= 5; - if (this->bounceX <= 0) { - this->bounceX = 0; - } - } - if (Rand_ZeroOne() < 0.5f) { - this->spinXFlag = true; - } else { - this->spinXFlag = false; - } - bounced = true; - } - if ((this->spinRot.z == 0) && (this->bounceZ != 0)) { - this->spinVel.z = this->bounceZ * 0x200; - if (this->bounceZ != 0) { - this->bounceZ -= 5; - if (this->bounceZ <= 0) { - this->bounceZ = 0; - } - } - if (Rand_ZeroOne() < 0.5f) { - this->spinZFlag = true; - } else { - this->spinZFlag = false; - } - bounced = true; - } - Math_ApproachS(&this->actor.shape.rot.x, this->direction * 0x4000, 1, 0x2000); - } else { - this->actor.shape.rot.y += this->spinVel.y; - this->actor.shape.rot.x += this->direction * 0x7D0; - } if (bounced) { s16 dustCount; s16 j; diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index 4b20f4018c..e1e6068017 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -47,13 +47,6 @@ static ColliderCylinderInit D_80AA0420 = { static u32 D_80AA044C[] = { DMG_SPIN_MASTER, DMG_SPIN_KOKIRI, DMG_SPIN_GIANT }; static u32 D_80AA0458[] = { DMG_JUMP_MASTER, DMG_JUMP_KOKIRI, DMG_JUMP_GIANT }; -static u16 sSfxIds[] = { - NA_SE_IT_ROLLING_CUT_LV2, - NA_SE_IT_ROLLING_CUT_LV1, - NA_SE_IT_ROLLING_CUT_LV2, - NA_SE_IT_ROLLING_CUT_LV1, -}; - // Setup action void func_80A9EFE0(EnMThunder* this, EnMThunderActionFunc actionFunc) { this->actionFunc = actionFunc; @@ -207,8 +200,19 @@ void func_80A9F408(EnMThunder* this, PlayState* play) { func_80A9EFE0(this, func_80A9F9B4); this->unk_1C4 = 8; - Audio_PlaySfxGeneral(sSfxIds[this->unk_1C6], &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + + { + static u16 sSfxIds[] = { + NA_SE_IT_ROLLING_CUT_LV2, + NA_SE_IT_ROLLING_CUT_LV1, + NA_SE_IT_ROLLING_CUT_LV2, + NA_SE_IT_ROLLING_CUT_LV1, + }; + + Audio_PlaySfxGeneral(sSfxIds[this->unk_1C6], &player->actor.projectedPos, 4, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + } + this->unk_1AC = 1.0f; return; } diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index 6265291986..99622ab6b9 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -264,8 +264,8 @@ void func_80AA204C(EnMa2* this, PlayState* play) { Player* player = GET_PLAYER(play); if (player->stateFlags2 & PLAYER_STATE2_24) { - player->unk_6A8 = &this->actor; player->stateFlags2 |= PLAYER_STATE2_25; + player->unk_6A8 = &this->actor; Message_StartOcarina(play, OCARINA_ACTION_CHECK_EPONA); this->actionFunc = func_80AA20E4; } else if (this->actor.xzDistToPlayer < 30.0f + this->collider.dim.radius) { diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 44f1e64336..621d2e4a95 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -1052,13 +1052,13 @@ void EnMb_ClubDamaged(EnMb* this, PlayState* play) { } void EnMb_ClubDamagedWhileKneeling(EnMb* this, PlayState* play) { - s32 pad; - if (SkelAnime_Update(&this->skelAnime)) { if (this->timer3 != 0) { this->timer3--; if (this->timer3 == 0) { if (this->timer1 == 0) { + s32 pad; + Animation_Change(&this->skelAnime, &gEnMbClubStandUpAnim, 3.0f, 0.0f, Animation_GetLastFrame(&gEnMbClubStandUpAnim), ANIMMODE_ONCE_INTERP, 0.0f); this->timer1 = 1; diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index 6ad429adbb..28202269f9 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -512,8 +512,6 @@ void EnMm_Draw(Actor* thisx, PlayState* play) { s32 pad; EnMm* this = (EnMm*)thisx; - if (0) {} - OPEN_DISPS(play->state.gfxCtx, "../z_en_mm.c", 1065); Gfx_SetupDL_25Opa(play->state.gfxCtx); @@ -560,6 +558,8 @@ void EnMm_Draw(Actor* thisx, PlayState* play) { } } + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_en_mm.c", 1141); } diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 8d1f9b51a8..3a5f4c187f 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -193,6 +193,7 @@ void EnNb_UpdateEyes(EnNb* this) { } } +#if OOT_DEBUG void func_80AB11EC(EnNb* this) { this->action = NB_ACTION_7; this->drawMode = NB_DRAW_NOTHING; @@ -220,6 +221,7 @@ void func_80AB1210(EnNb* this, PlayState* play) { } } } +#endif void func_80AB1284(EnNb* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_2); @@ -530,7 +532,9 @@ void EnNb_SetupLightOrb(EnNb* this, PlayState* play) { void EnNb_Hide(EnNb* this, PlayState* play) { EnNb_SetupHide(this, play); +#if OOT_DEBUG func_80AB1210(this, play); +#endif } void EnNb_Fade(EnNb* this, PlayState* play) { @@ -538,7 +542,9 @@ void EnNb_Fade(EnNb* this, PlayState* play) { EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_CheckToFade(this, play); +#if OOT_DEBUG func_80AB1210(this, play); +#endif } void EnNb_CreateLightOrb(EnNb* this, PlayState* play) { @@ -546,7 +552,9 @@ void EnNb_CreateLightOrb(EnNb* this, PlayState* play) { EnNb_UpdateSkelAnime(this); EnNb_UpdateEyes(this); EnNb_SetupLightOrb(this, play); +#if OOT_DEBUG func_80AB1210(this, play); +#endif } void EnNb_DrawTransparency(EnNb* this, PlayState* play) { @@ -1121,6 +1129,8 @@ void EnNb_CrawlspaceSpawnCheck(EnNb* this, PlayState* play) { this->action = NB_CROUCH_CRAWLSPACE; this->drawMode = NB_DRAW_DEFAULT; } else { + s32 pad; + EnNb_SetCurrentAnim(this, &gNabooruStandingHandsOnHipsAnim, 0, 0.0f, 0); this->headTurnFlag = 1; this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -1210,6 +1220,8 @@ void EnNb_SetupIdleCrawlspace(EnNb* this, s32 animFinished) { void func_80AB3838(EnNb* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { + s32 pad; + this->action = NB_IN_DIALOG; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -1302,6 +1314,8 @@ void func_80AB3A7C(EnNb* this, PlayState* play, s32 animFinished) { void func_80AB3B04(EnNb* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { + s32 pad; + this->action = NB_ACTION_30; } else { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3; @@ -1472,6 +1486,8 @@ s32 EnNb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po if (this->headTurnFlag != 0) { if (limbIndex == NB_LIMB_TORSO) { + s32 pad; + rot->x += interactInfo->torsoRot.y; rot->y -= interactInfo->torsoRot.x; ret = false; 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 847710b580..b48616a46d 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 @@ -11,7 +11,7 @@ void EnNiwLady_Destroy(Actor* thisx, PlayState* play); void EnNiwLady_Update(Actor* thisx, PlayState* play); void func_80AB9F24(EnNiwLady* this, PlayState* play); -void EnNiwLady_Draw(Actor* thisx, PlayState* play); +void EnNiwLady_Draw(Actor* thisx, PlayState* play2); void func_80ABA21C(EnNiwLady* this, PlayState* play); void func_80ABAD38(EnNiwLady* this, PlayState* play); void func_80ABA778(EnNiwLady* this, PlayState* play); @@ -199,6 +199,7 @@ void func_80ABA21C(EnNiwLady* this, PlayState* play) { void func_80ABA244(EnNiwLady* this, PlayState* play) { EnNiw* currentCucco; + s32 pad[2]; s32 phi_s1; this->cuccosInPen = 0; @@ -223,7 +224,7 @@ void func_80ABA244(EnNiwLady* this, PlayState* play) { } currentCucco = (EnNiw*)currentCucco->actor.next; } - if (BREG(7) != 0) { + if (OOT_DEBUG && BREG(7) != 0) { this->cuccosInPen = BREG(7) - 1; } phi_s1 = this->cuccosInPen; @@ -358,13 +359,13 @@ void func_80ABA778(EnNiwLady* this, PlayState* play) { void func_80ABA878(EnNiwLady* this, PlayState* play) { Player* player = GET_PLAYER(play); - s8 playerExchangeItemId; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) || (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE)) { this->unk_26E = 11; } if (Actor_TalkOfferAccepted(&this->actor, play)) { - playerExchangeItemId = func_8002F368(play); + s8 playerExchangeItemId = func_8002F368(play); + if ((playerExchangeItemId == EXCH_ITEM_POCKET_CUCCO) && GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO)) { Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); player->actor.textId = sTradeItemTextIds[5]; @@ -379,9 +380,10 @@ void func_80ABA878(EnNiwLady* this, PlayState* play) { this->unk_26E = this->unk_27A + 21; this->actionFunc = !this->unk_273 ? func_80ABA778 : func_80ABA9B8; } - } else { - Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 50.0f, EXCH_ITEM_POCKET_CUCCO); + return; } + + Actor_OfferTalkExchangeEquiCylinder(&this->actor, play, 50.0f, EXCH_ITEM_POCKET_CUCCO); } void func_80ABA9B8(EnNiwLady* this, PlayState* play) { @@ -573,10 +575,10 @@ s32 EnNiwLady_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 return false; } -void EnNiwLady_Draw(Actor* thisx, PlayState* play) { +void EnNiwLady_Draw(Actor* thisx, PlayState* play2) { static void* sEyeTextures[] = { gCuccoLadyEyeOpenTex, gCuccoLadyEyeHalfTex, gCuccoLadyEyeClosedTex }; EnNiwLady* this = (EnNiwLady*)thisx; - s32 pad; + PlayState* play = (PlayState*)play2; OPEN_DISPS(play->state.gfxCtx, "../z_en_niw_lady.c", 1347); if (this->unk_27E != 0) { diff --git a/src/overlays/actors/ovl_En_Ny/z_en_ny.c b/src/overlays/actors/ovl_En_Ny/z_en_ny.c index 0ec08037fe..126a99728a 100644 --- a/src/overlays/actors/ovl_En_Ny/z_en_ny.c +++ b/src/overlays/actors/ovl_En_Ny/z_en_ny.c @@ -139,8 +139,8 @@ void EnNy_Init(Actor* thisx, PlayState* play) { PRINTF("ダミーニュウ イニシャル[ %d ] !!\n", this->actor.params); PRINTF("En_Ny_actor_move2[ %x ] !!\n", EnNy_UpdateUnused); this->actor.colChkInfo.mass = 0xFF; - this->collider.base.colType = COLTYPE_METAL; this->actor.update = EnNy_UpdateUnused; + this->collider.base.colType = COLTYPE_METAL; } } @@ -368,7 +368,6 @@ void EnNy_Update(Actor* thisx, PlayState* play) { EnNy* this = (EnNy*)thisx; f32 temp_f20; f32 temp_f22; - s32 i; this->timer++; temp_f20 = this->unk_1E0 - 0.25f; @@ -391,6 +390,8 @@ void EnNy_Update(Actor* thisx, PlayState* play) { this->unk_1F0 = temp_f22; this->actor.world.pos.y += temp_f22; if (EnNy_CollisionCheck(this, play) != 0) { + s32 i; + for (i = 0; i < 8; i++) { this->unk_1F8[i].x = (Rand_CenteredFloat(20.0f) + this->actor.world.pos.x); this->unk_1F8[i].y = (Rand_CenteredFloat(20.0f) + this->actor.world.pos.y);