From 72334df180964f28ea911728011f8b386512ed1f Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Thu, 21 Sep 2023 00:54:44 +1000 Subject: [PATCH] improve matching (#1543) --- src/overlays/actors/ovl_En_Go/z_en_go.c | 45 +++++++++--------- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 41 +++++++++-------- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 25 +++++----- src/overlays/actors/ovl_En_In/z_en_in.c | 27 ++++++----- src/overlays/actors/ovl_En_Mm2/z_en_mm2.c | 31 +++++++------ .../actors/ovl_En_Niw_Lady/z_en_niw_lady.c | 46 ++++++++++--------- 6 files changed, 114 insertions(+), 101 deletions(-) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index e22c8177c1..a58b58e02d 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1200,29 +1200,32 @@ void EnGo_DrawEffects(EnGo* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_go.c", 2626); materialFlag = false; Gfx_SetupDL_25Xlu(play->state.gfxCtx); - if (1) {} + for (i = 0; i < EN_GO_EFFECT_COUNT; i++, dustEffect++) { - if (dustEffect->type) { - if (!materialFlag) { - POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); - gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD40); - gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); - materialFlag = true; - } - - alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); - gDPPipeSync(POLY_XLU_DISP++); - Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go.c", 2664), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - - index = dustEffect->timer * (8.0f / dustEffect->initialTimer); - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(dustTex[index])); - gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); + if (dustEffect->type == 0) { + continue; } + + if (!materialFlag) { + POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); + gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD40); + gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); + materialFlag = true; + } + + alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); + gDPPipeSync(POLY_XLU_DISP++); + Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go.c", 2664), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + index = dustEffect->timer * (8.0f / dustEffect->initialTimer); + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(dustTex[index])); + gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); } + CLOSE_DISPS(play->state.gfxCtx, "../z_en_go.c", 2678); } diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 1fa9e08913..c19355cbd5 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -225,29 +225,30 @@ void EnGo2_DrawEffects(EnGo2* this, PlayState* play) { materialFlag = false; Gfx_SetupDL_25Xlu(play->state.gfxCtx); - if (1) {} for (i = 0; i < EN_GO2_EFFECT_COUNT; i++, dustEffect++) { - if (dustEffect->type) { - if (!materialFlag) { - POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); - gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD40); - gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); - materialFlag = true; - } - - alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); - gDPPipeSync(POLY_XLU_DISP++); - Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); - Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); - gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go2_eff.c", 137), - G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - index = dustEffect->timer * (8.0f / dustEffect->initialTimer); - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sDustTex[index])); - gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); + if (dustEffect->type == 0) { + continue; } + + if (!materialFlag) { + POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_0); + gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD40); + gDPSetEnvColor(POLY_XLU_DISP++, 100, 60, 20, 0); + materialFlag = true; + } + + alpha = dustEffect->timer * (255.0f / dustEffect->initialTimer); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 130, 90, alpha); + gDPPipeSync(POLY_XLU_DISP++); + Matrix_Translate(dustEffect->pos.x, dustEffect->pos.y, dustEffect->pos.z, MTXMODE_NEW); + Matrix_ReplaceRotation(&play->billboardMtxF); + Matrix_Scale(dustEffect->scale, dustEffect->scale, 1.0f, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_go2_eff.c", 137), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + index = dustEffect->timer * (8.0f / dustEffect->initialTimer); + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sDustTex[index])); + gSPDisplayList(POLY_XLU_DISP++, gGoronDL_00FD50); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_go2_eff.c", 151); diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 3dd8a99fe9..6af9eed0a1 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -686,19 +686,20 @@ s32 EnHorse_Spawn(EnHorse* this, PlayState* play) { spawnPos.z = sHorseSpawns[i].pos.z; dist = Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &spawnPos); - if (play->sceneId) {} - if (!((minDist < dist) || func_80A5BBBC(play, this, &spawnPos))) { - minDist = dist; - this->actor.world.pos.x = sHorseSpawns[i].pos.x; - this->actor.world.pos.y = sHorseSpawns[i].pos.y; - this->actor.world.pos.z = sHorseSpawns[i].pos.z; - this->actor.prevPos = this->actor.world.pos; - this->actor.world.rot.y = sHorseSpawns[i].angle; - this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); - spawn = true; - SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->actor.world.pos, - &this->actor.projectedPos, &this->actor.projectedW); + if ((minDist < dist) || func_80A5BBBC(play, this, &spawnPos)) { + continue; } + + minDist = dist; + this->actor.world.pos.x = sHorseSpawns[i].pos.x; + this->actor.world.pos.y = sHorseSpawns[i].pos.y; + this->actor.world.pos.z = sHorseSpawns[i].pos.z; + this->actor.prevPos = this->actor.world.pos; + this->actor.world.rot.y = sHorseSpawns[i].angle; + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(play)->actor); + spawn = true; + SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->actor.world.pos, + &this->actor.projectedPos, &this->actor.projectedW); } } } diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 73698fd4aa..6c81b313cc 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -894,19 +894,22 @@ void func_80A7B024(EnIn* this, PlayState* play) { player->rideActor->freezeTimer = 10; } player->actor.freezeTimer = 10; - if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) { - if (1) {} - if (!GET_EVENTCHKINF(EVENTCHKINF_1B) && GET_INFTABLE(INFTABLE_AB)) { - SET_EVENTCHKINF(EVENTCHKINF_1B); - SET_INFTABLE(INFTABLE_AB); - } - func_80A79BAC(this, play, 0, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST)); - SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0); - SET_EVENTINF_HORSES_0F(1); - play->msgCtx.stateTimer = 4; - play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; - this->interactInfo.talkState = NPC_TALK_STATE_IDLE; + + if (this->interactInfo.talkState != NPC_TALK_STATE_ACTION) { + return; } + + if (!GET_EVENTCHKINF(EVENTCHKINF_1B) && GET_INFTABLE(INFTABLE_AB)) { + SET_EVENTCHKINF(EVENTCHKINF_1B); + SET_INFTABLE(INFTABLE_AB); + } + + func_80A79BAC(this, play, 0, TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST)); + SET_EVENTINF_HORSES_STATE(EVENTINF_HORSES_STATE_0); + SET_EVENTINF_HORSES_0F(1); + play->msgCtx.stateTimer = 4; + play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; + this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } void EnIn_Update(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c index be1f73d527..ea7d525d28 100644 --- a/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c +++ b/src/overlays/actors/ovl_En_Mm2/z_en_mm2.c @@ -215,14 +215,15 @@ void func_80AAF3C0(EnMm2* this, PlayState* play) { Message_ContinueTextbox(play, 0x6080); this->actor.textId = 0x6080; break; - }; + } + if (this->unk_1F4 & 4) { - if (1) {} this->unk_1F4 &= ~4; HIGH_SCORE(HS_MARATHON)++; } } - return; + break; + case 0x6081: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk_1F4 |= 4; @@ -230,18 +231,20 @@ void func_80AAF3C0(EnMm2* this, PlayState* play) { Message_ContinueTextbox(play, 0x607E); this->actor.textId = 0x607E; } - return; - } + break; - if (Actor_TextboxIsClosing(&this->actor, play)) { - if (this->actor.textId == 0x607F) { - Interface_SetSubTimer(0); - this->actionFunc = func_80AAF57C; - } else { - this->actionFunc = func_80AAF57C; - } - this->actionFunc = func_80AAF57C; - func_80AAEF70(this, play); + default: + if (Actor_TextboxIsClosing(&this->actor, play)) { + if (this->actor.textId == 0x607F) { + Interface_SetSubTimer(0); + this->actionFunc = func_80AAF57C; + } else { + this->actionFunc = func_80AAF57C; + } + this->actionFunc = func_80AAF57C; + func_80AAEF70(this, play); + } + break; } } 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 313def7542..efd92c36d8 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 @@ -518,29 +518,31 @@ void EnNiwLady_Update(Actor* thisx, PlayState* play) { SkelAnime_Update(&this->skelAnime); } this->aneObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_ANE); - if (this->aneObjectSlot >= 0) { - this->actionFunc(this, play); - if (this->unusedTimer2 != 0) { - this->unusedTimer2--; - } - if (this->unusedRandomTimer != 0) { - this->unusedRandomTimer--; - } - this->unusedTimer++; - if (this->unusedRandomTimer == 0) { - this->faceState++; - if (this->faceState >= 3) { - this->faceState = 0; - this->unusedRandomTimer = ((s16)Rand_ZeroFloat(60.0f) + 0x14); - } - } - Actor_UpdateBgCheckInfo(play, thisx, 20.0f, 20.0f, 60.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | - UPDBGCHECKINFO_FLAG_4); - Collider_UpdateCylinder(thisx, &this->collider); - if (1) {} - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + if (this->aneObjectSlot < 0) { + return; } + + this->actionFunc(this, play); + + if (this->unusedTimer2 != 0) { + this->unusedTimer2--; + } + if (this->unusedRandomTimer != 0) { + this->unusedRandomTimer--; + } + this->unusedTimer++; + if (this->unusedRandomTimer == 0) { + this->faceState++; + if (this->faceState >= 3) { + this->faceState = 0; + this->unusedRandomTimer = ((s16)Rand_ZeroFloat(60.0f) + 0x14); + } + } + Actor_UpdateBgCheckInfo(play, thisx, 20.0f, 20.0f, 60.0f, + UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | + UPDBGCHECKINFO_FLAG_4); + Collider_UpdateCylinder(thisx, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } }