From 5bef89a6ff33c3e84ad58d201bd1996a0d9f7db4 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Sat, 23 Mar 2024 22:04:07 +1100 Subject: [PATCH] Misc Cleanup 2 (#1521) * begin cleanup * more cleanup * more cleanup * more cleanup * more cleanup * more cleanup * fake matches * more cleanup * more cleanup * small thing * PR Review * PR Review --- src/audio/code_8019AF00.c | 6 +- src/audio/lib/load.c | 10 +- src/audio/lib/playback.c | 12 +- src/audio/lib/seqplayer.c | 6 +- src/boot/fault_drawer.c | 6 +- src/code/PreRender.c | 79 ++++--- src/code/z_camera.c | 10 +- src/code/z_collision_check.c | 2 +- src/code/z_en_hy_code.c | 4 +- src/code/z_play.c | 3 +- src/code/z_player_lib.c | 14 +- src/code/z_skin_matrix.c | 2 +- src/code/z_sram_NES.c | 2 +- src/code/z_sub_s.c | 4 +- src/libultra/libc/xlitob.c | 6 +- src/libultra/libc/xprintf.c | 27 ++- .../ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c | 6 +- .../ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c | 18 +- .../ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c | 10 +- .../actors/ovl_Bg_F40_Block/z_bg_f40_block.c | 12 +- .../ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c | 14 +- .../z_bg_ikana_bombwall.c | 24 +-- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 26 +-- src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c | 24 ++- src/overlays/actors/ovl_Dm_An/z_dm_an.c | 20 +- src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c | 14 +- src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c | 20 +- src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c | 24 ++- src/overlays/actors/ovl_En_Ah/z_en_ah.c | 28 +-- src/overlays/actors/ovl_En_Al/z_en_al.c | 34 ++- src/overlays/actors/ovl_En_An/z_en_an.c | 34 +-- src/overlays/actors/ovl_En_Box/z_en_box.c | 2 +- .../actors/ovl_En_Bubble/z_en_bubble.c | 10 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 34 +-- src/overlays/actors/ovl_En_Crow/z_en_crow.c | 2 +- .../actors/ovl_En_Dekunuts/z_en_dekunuts.c | 8 +- src/overlays/actors/ovl_En_Dnp/z_en_dnp.c | 15 +- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 14 +- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 14 +- src/overlays/actors/ovl_En_Fish2/z_en_fish2.c | 14 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 193 +++++++++--------- src/overlays/actors/ovl_En_Gb2/z_en_gb2.c | 14 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 49 +++-- src/overlays/actors/ovl_En_Go/z_en_go.c | 4 +- src/overlays/actors/ovl_En_Ig/z_en_ig.c | 26 ++- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 10 +- src/overlays/actors/ovl_En_Ik/z_en_ik.h | 2 +- src/overlays/actors/ovl_En_In/z_en_in.c | 10 +- .../actors/ovl_En_Kendo_Js/z_en_kendo_js.c | 6 +- src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c | 8 +- .../actors/ovl_En_Minislime/z_en_minislime.c | 10 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 19 +- src/overlays/actors/ovl_En_Paper/z_en_paper.c | 22 +- src/overlays/actors/ovl_En_Paper/z_en_paper.h | 2 +- src/overlays/actors/ovl_En_Pm/z_en_pm.c | 50 ++--- src/overlays/actors/ovl_En_Pr2/z_en_pr2.c | 22 +- src/overlays/actors/ovl_En_Rg/z_en_rg.c | 17 +- src/overlays/actors/ovl_En_Slime/z_en_slime.c | 6 +- .../actors/ovl_En_Snowman/z_en_snowman.c | 3 + src/overlays/actors/ovl_En_Ssh/z_en_ssh.c | 8 +- .../actors/ovl_En_Suttari/z_en_suttari.c | 20 +- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 33 ++- src/overlays/actors/ovl_En_Tab/z_en_tab.c | 25 ++- src/overlays/actors/ovl_En_Test3/z_en_test3.c | 3 +- .../actors/ovl_En_Thiefbird/z_en_thiefbird.c | 4 + src/overlays/actors/ovl_En_Tk/z_en_tk.c | 1 + .../actors/ovl_En_Tru_Mt/z_en_tru_mt.c | 20 +- src/overlays/actors/ovl_En_Tsn/z_en_tsn.c | 9 +- .../actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c | 26 +-- .../ovl_En_Water_Effect/z_en_water_effect.c | 21 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 21 +- src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c | 14 +- .../actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c | 4 +- .../actors/ovl_Obj_Iceblock/z_obj_iceblock.c | 21 +- src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c | 10 +- .../ovl_Obj_Lightswitch/z_obj_lightswitch.c | 6 +- .../ovl_Obj_Snowball2/z_obj_snowball2.c | 37 ++-- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 74 ++++--- src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c | 2 +- src/overlays/actors/ovl_TG_Sw/z_tg_sw.c | 33 +-- .../actors/ovl_player_actor/z_player.c | 10 +- .../ovl_file_choose/z_file_choose_NES.c | 2 - tools/disasm/functions.txt | 16 +- tools/disasm/variables.txt | 2 +- 84 files changed, 746 insertions(+), 763 deletions(-) diff --git a/src/audio/code_8019AF00.c b/src/audio/code_8019AF00.c index 6bf126dd1e..f1e0c10572 100644 --- a/src/audio/code_8019AF00.c +++ b/src/audio/code_8019AF00.c @@ -5721,11 +5721,7 @@ void Audio_SetSequenceMode(u8 seqMode) { if (seqMode != (sPrevSeqMode & 0x7F)) { if (seqMode == SEQ_MODE_ENEMY) { // If only seqMode = SEQ_MODE_ENEMY (Start) - if (gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume < 0) { - volumeFadeInTimer = -(gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume); - } else { - volumeFadeInTimer = gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume; - } + volumeFadeInTimer = ABS_ALT(gActiveSeqs[SEQ_PLAYER_BGM_SUB].volScales[1] - sBgmEnemyVolume); AudioSeq_SetVolumeScale(SEQ_PLAYER_BGM_SUB, VOL_SCALE_INDEX_BGM_SUB, sBgmEnemyVolume, volumeFadeInTimer); diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index adc6769994..3d6dacbd90 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -139,7 +139,7 @@ void* AudioLoad_DmaSampleData(uintptr_t devAddr, size_t size, s32 arg2, u8* dmaI s32 bufferPos; u32 i; - if ((arg2 != 0) || (*dmaIndexRef >= gAudioCtx.sampleDmaListSize1)) { + if (arg2 || (*dmaIndexRef >= gAudioCtx.sampleDmaListSize1)) { for (i = gAudioCtx.sampleDmaListSize1; i < gAudioCtx.sampleDmaCount; i++) { dma = &gAudioCtx.sampleDmas[i]; bufferPos = devAddr - dma->devAddr; @@ -162,11 +162,11 @@ void* AudioLoad_DmaSampleData(uintptr_t devAddr, size_t size, s32 arg2, u8* dmaI } } - if (arg2 == 0) { + if (!arg2) { goto search_short_lived; } - if (gAudioCtx.sampleDmaReuseQueue2RdPos != gAudioCtx.sampleDmaReuseQueue2WrPos && arg2 != 0) { + if ((gAudioCtx.sampleDmaReuseQueue2RdPos != gAudioCtx.sampleDmaReuseQueue2WrPos) && arg2) { // Allocate a DMA from reuse queue 2, unless full. dmaIndex = gAudioCtx.sampleDmaReuseQueue2[gAudioCtx.sampleDmaReuseQueue2RdPos]; gAudioCtx.sampleDmaReuseQueue2RdPos++; @@ -1073,7 +1073,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData, s32 loadStatus; SoundFont* soundFont; u32 realId = AudioLoad_GetRealTableIndex(tableType, id); - u32 pad; + s32 pad; switch (tableType) { case SEQUENCE_TABLE: @@ -1638,7 +1638,7 @@ void AudioLoad_ProcessAsyncLoadUnkMedium(AudioAsyncLoad* asyncLoad, s32 resetSta void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) { u32 retMsg = asyncLoad->retMsg; u32 fontId; - u32 pad; + s32 pad; OSMesg doneMsg; u32 sampleBankId1; u32 sampleBankId2; diff --git a/src/audio/lib/playback.c b/src/audio/lib/playback.c index db59eaec5a..c997d3872c 100644 --- a/src/audio/lib/playback.c +++ b/src/audio/lib/playback.c @@ -27,13 +27,13 @@ void AudioPlayback_InitSampleState(Note* note, NoteSampleState* sampleState, Not u64 pad; u8 strongLeft; u8 strongRight; - f32 vel; + f32 velocity; u8 pan; u8 targetReverbVol; StereoData stereoData; s32 stereoHeadsetEffects = note->playbackState.stereoHeadsetEffects; - vel = subAttrs->velocity; + velocity = subAttrs->velocity; pan = subAttrs->pan; targetReverbVol = subAttrs->targetReverbVol; stereoData = subAttrs->stereoData; @@ -116,11 +116,11 @@ void AudioPlayback_InitSampleState(Note* note, NoteSampleState* sampleState, Not volRight = gDefaultPanVolume[0x7F - pan]; } - vel = 0.0f > vel ? 0.0f : vel; - vel = 1.0f < vel ? 1.0f : vel; + velocity = 0.0f > velocity ? 0.0f : velocity; + velocity = 1.0f < velocity ? 1.0f : velocity; - sampleState->targetVolLeft = (s32)((vel * volLeft) * (0x1000 - 0.001f)); - sampleState->targetVolRight = (s32)((vel * volRight) * (0x1000 - 0.001f)); + sampleState->targetVolLeft = (s32)((velocity * volLeft) * (0x1000 - 0.001f)); + sampleState->targetVolRight = (s32)((velocity * volRight) * (0x1000 - 0.001f)); sampleState->gain = subAttrs->gain; sampleState->filter = subAttrs->filter; diff --git a/src/audio/lib/seqplayer.c b/src/audio/lib/seqplayer.c index 7fc88f6e67..3b0fc33b0d 100644 --- a/src/audio/lib/seqplayer.c +++ b/src/audio/lib/seqplayer.c @@ -821,7 +821,7 @@ s32 AudioScript_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) { u8 semitone = cmd; u16 sfxId; s32 semitone2; - s32 vel; + s32 velocity; f32 time; f32 tuning; s32 speed2; @@ -896,10 +896,10 @@ s32 AudioScript_SeqLayerProcessScriptStep4(SequenceLayer* layer, s32 cmd) { if (layer->portamento.mode != PORTAMENTO_MODE_OFF) { portamento = &layer->portamento; - vel = (semitone > layer->portamentoTargetNote) ? semitone : layer->portamentoTargetNote; + velocity = (semitone > layer->portamentoTargetNote) ? semitone : layer->portamentoTargetNote; if (instrument != NULL) { - tunedSample = AudioPlayback_GetInstrumentTunedSample(instrument, vel); + tunedSample = AudioPlayback_GetInstrumentTunedSample(instrument, velocity); sameTunedSample = (layer->tunedSample == tunedSample); layer->tunedSample = tunedSample; tuning = tunedSample->tuning; diff --git a/src/boot/fault_drawer.c b/src/boot/fault_drawer.c index 03025fd460..1917e16641 100644 --- a/src/boot/fault_drawer.c +++ b/src/boot/fault_drawer.c @@ -95,11 +95,11 @@ void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 col s32 ySize = yEnd - yStart + 1; if ((xDiff > 0) && (yDiff > 0)) { - if (xDiff < xSize) { + if (xSize > xDiff) { xSize = xDiff; } - if (yDiff < ySize) { + if (ySize > yDiff) { ySize = yDiff; } @@ -220,7 +220,7 @@ void* FaultDrawer_FormatStringFunc(void* arg, const char* str, size_t count) { for (; count > 0; count--, str++) { if (sFaultDrawerInstance->escCode) { sFaultDrawerInstance->escCode = false; - if (*str >= '1' && *str <= '9') { + if ((*str >= '1') && (*str <= '9')) { FaultDrawer_SetForeColor(sFaultDrawerInstance->printColors[*str - '0']); } } else { diff --git a/src/code/PreRender.c b/src/code/PreRender.c index 011b07f1ff..6d4e52cf47 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -449,59 +449,58 @@ void PreRender_AntiAliasFilterPixel(PreRender* this, s32 x, s32 y) { // For each neighbor for (i = 1; i < 5 * 3; i += 2) { // Only sample fully covered pixels - if (buffCvg[i] == 7) { - // Determine "Penultimate Maximum" Value + if (buffCvg[i] != 7) { + continue; + } + // Determine "Penultimate Maximum" Value - // If current maximum is less than this neighbor - if (pmaxR < buffR[i]) { - // For each neighbor (again) - for (j = 1; j < 5 * 3; j += 2) { - // If not the neighbor we were at before, and this neighbor has a larger value and this pixel is - // fully covered, that means the neighbor at `i` is the "penultimate maximum" - if ((i != j) && (buffR[j] >= buffR[i]) && (buffCvg[j] == 7)) { - pmaxR = buffR[i]; - } + // If current maximum is less than this neighbor + if (pmaxR < buffR[i]) { + // For each neighbor (again) + for (j = 1; j < 5 * 3; j += 2) { + // If not the neighbor we were at before, and this neighbor has a larger value and this pixel is + // fully covered, that means the neighbor at `i` is the "penultimate maximum" + if ((i != j) && (buffR[j] >= buffR[i]) && (buffCvg[j] == 7)) { + pmaxR = buffR[i]; } } - if (pmaxG < buffG[i]) { - for (j = 1; j < 5 * 3; j += 2) { - if ((i != j) && (buffG[j] >= buffG[i]) && (buffCvg[j] == 7)) { - pmaxG = buffG[i]; - } + } + if (pmaxG < buffG[i]) { + for (j = 1; j < 5 * 3; j += 2) { + if ((i != j) && (buffG[j] >= buffG[i]) && (buffCvg[j] == 7)) { + pmaxG = buffG[i]; } } - if (pmaxB < buffB[i]) { - for (j = 1; j < 5 * 3; j += 2) { - if ((i != j) && (buffB[j] >= buffB[i]) && (buffCvg[j] == 7)) { - pmaxB = buffB[i]; - } + } + if (pmaxB < buffB[i]) { + for (j = 1; j < 5 * 3; j += 2) { + if ((i != j) && (buffB[j] >= buffB[i]) && (buffCvg[j] == 7)) { + pmaxB = buffB[i]; } } + } - if (1) {} + // Determine "Penultimate Minimum" Value - // Determine "Penultimate Minimum" Value - - // Same as above with inverted conditions - if (pminR > buffR[i]) { - for (j = 1; j < 5 * 3; j += 2) { - if ((i != j) && (buffR[j] <= buffR[i]) && (buffCvg[j] == 7)) { - pminR = buffR[i]; - } + // Same as above with inverted conditions + if (pminR > buffR[i]) { + for (j = 1; j < 5 * 3; j += 2) { + if ((i != j) && (buffR[j] <= buffR[i]) && (buffCvg[j] == 7)) { + pminR = buffR[i]; } } - if (pminG > buffG[i]) { - for (j = 1; j < 5 * 3; j += 2) { - if ((i != j) && (buffG[j] <= buffG[i]) && (buffCvg[j] == 7)) { - pminG = buffG[i]; - } + } + if (pminG > buffG[i]) { + for (j = 1; j < 5 * 3; j += 2) { + if ((i != j) && (buffG[j] <= buffG[i]) && (buffCvg[j] == 7)) { + pminG = buffG[i]; } } - if (pminB > buffB[i]) { - for (j = 1; j < 5 * 3; j += 2) { - if ((i != j) && (buffB[j] <= buffB[i]) && (buffCvg[j] == 7)) { - pminB = buffB[i]; - } + } + if (pminB > buffB[i]) { + for (j = 1; j < 5 * 3; j += 2) { + if ((i != j) && (buffB[j] <= buffB[i]) && (buffCvg[j] == 7)) { + pminB = buffB[i]; } } } diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 5e04f1613e..d33864f349 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -1075,7 +1075,7 @@ Vec3f Camera_CalcUpVec(s16 pitch, s16 yaw, s16 roll) { Vec3f rollMtxRow1; Vec3f rollMtxRow2; Vec3f rollMtxRow3; - f32 pad; + s32 pad; // Axis to roll around u.x = cosP * sinY; @@ -1391,7 +1391,7 @@ s32 Camera_CalcAtForNormal1(Camera* camera, VecGeo* arg1, f32 yOffset, f32 forwa */ s32 Camera_CalcAtForParallel(Camera* camera, VecGeo* arg1, f32 yOffset, f32 xzOffsetMax, f32* focalActorPosY, s16 flags) { - f32 pad; + s32 pad; Vec3f focalActorAtOffsetTarget; Vec3f atTarget; f32 fovHeight; @@ -2477,9 +2477,7 @@ s32 Camera_Normal3(Camera* camera) { sp62 = BINANG_SUB(focalActorPosRot->rot.y, BINANG_ROT180(sp68.yaw)); sp78 = OLib_Vec3fToVecGeo(&camera->unk_0F0); phi_v1_2 = focalActorPosRot->rot.y - sp78.yaw; - if (phi_v1_2 < 0) { - phi_v1_2 *= -1; - } + phi_v1_2 = ABS_ALT(phi_v1_2); if (phi_v1_2 < 0x555A) { temp_f2 = 1.0f; @@ -3299,7 +3297,7 @@ s32 Camera_Jump3(Camera* camera) { f32 phi_f2_2; f32 temp_f0; f32 temp1; - f32 pad; + s32 pad; Jump3ReadOnlyData* roData = &camera->paramData.jump3.roData; Jump3ReadWriteData* rwData = &camera->paramData.jump3.rwData; f32 focalActorHeight = Camera_GetFocalActorHeight(camera); diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 869b3fd74f..11c3865e1e 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -2941,7 +2941,7 @@ s32 CollisionCheck_GetMassType(u8 mass) { */ void CollisionCheck_SetOCvsOC(PlayState* play, Collider* left, ColliderInfo* leftInfo, Vec3f* leftPos, Collider* right, ColliderInfo* rightInfo, Vec3f* rightPos, f32 overlap) { - f32 pad; + s32 pad; f32 leftDispRatio; f32 rightDispRatio; f32 xzDist; diff --git a/src/code/z_en_hy_code.c b/src/code/z_en_hy_code.c index 20dff4ae31..cee1d9466d 100644 --- a/src/code/z_en_hy_code.c +++ b/src/code/z_en_hy_code.c @@ -116,8 +116,7 @@ EnDoor* EnHy_FindNearestDoor(Actor* actor, PlayState* play) { f32 minDist = 0.0f; do { - doorIter = SubS_FindActor(play, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR); - door = (EnDoor*)doorIter; + door = (EnDoor*)SubS_FindActor(play, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR); dist = Actor_WorldDistXYZToActor(actor, &door->knobDoor.dyna.actor); if (!isSetup || (dist < minDist)) { nearestDoor = door; @@ -127,6 +126,7 @@ EnDoor* EnHy_FindNearestDoor(Actor* actor, PlayState* play) { doorIter = door->knobDoor.dyna.actor.next; } while (doorIter != NULL); + //! FAKE: if (1) {} return nearestDoor; diff --git a/src/code/z_play.c b/src/code/z_play.c index ed549b9546..56055fafba 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1302,7 +1302,8 @@ void Play_DrawMain(PlayState* this) { Lights_Draw(lights, gfxCtx); if (1) { - u32 roomDrawFlags = ((1) ? 1 : 0) | (((void)0, 1) ? 2 : 0); // FAKE: + //! FAKE: + u32 roomDrawFlags = ((1) ? 1 : 0) | (((void)0, 1) ? 2 : 0); Scene_Draw(this); if (this->roomCtx.unk78) { diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index ebd3e21ede..bfe41894e5 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -2262,7 +2262,7 @@ s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** if (sPlayerRightHandType == PLAYER_MODELTYPE_RH_SHIELD) { if (player->transformation == PLAYER_FORM_HUMAN) { if (player->currentShield != PLAYER_SHIELD_NONE) { - //! FAKE + //! FAKE: rightHandDLists = &gPlayerHandHoldingShields[2 * ((player->currentShield - 1) ^ 0)]; } } @@ -2870,7 +2870,7 @@ void Player_DrawCircusLeadersMask(PlayState* play, Player* player) { Matrix_MultVec3f(&D_801C0B90[i], &D_801F59B0[i]); - //! FAKE + //! FAKE: if (1) {} D_801F59B0[i].y += -10.0f * scaleY; @@ -3607,7 +3607,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G } } } else if (limbIndex == PLAYER_LIMB_HEAD) { - //! FAKE + //! FAKE: if (((*dList1 != NULL) && ((((void)0, player->currentMask)) != (((void)0, PLAYER_MASK_NONE)))) && (((player->transformation == PLAYER_FORM_HUMAN) && ((player->skelAnime.animation != &gPlayerAnim_cl_setmask) || (player->skelAnime.curFrame >= 12.0f))) || @@ -3702,17 +3702,15 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G } temp = &player->arr_AF0[1]; - for (i = 0; i < ARRAY_COUNT(spF0); i++) { + for (i = 0; i < ARRAY_COUNT(spF0); i++, temp++) { *temp = spF0[0].x; - temp++; } } else { temp = &player->arr_AF0[1]; - for (i = 0; i < ARRAY_COUNT(spF0); i++) { + for (i = 0; i < ARRAY_COUNT(spF0); i++, temp++) { spF0[i].x = *temp; spF0[i].y = *temp; spF0[i].z = *temp; - temp++; } } @@ -3731,7 +3729,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G Matrix_Scale(spF0[i].x, spF0[i].y, spF0[i].z, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - //! FAKE (yes, all of them are required) + //! FAKE: (yes, all of them are required) // https://decomp.me/scratch/AdU3G if (1) {} if (1) {} diff --git a/src/code/z_skin_matrix.c b/src/code/z_skin_matrix.c index 8f96355081..211bc16317 100644 --- a/src/code/z_skin_matrix.c +++ b/src/code/z_skin_matrix.c @@ -602,7 +602,7 @@ void SkinMatrix_SetRotateAroundVec(MtxF* mf, s16 a, f32 x, f32 y, f32 z) { f32 xy; f32 yz; f32 xz; - f32 pad; + s32 pad; sinA = Math_SinS(a); cosA = Math_CosS(a); diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c index d66fee9c35..18f4d76f1b 100644 --- a/src/code/z_sram_NES.c +++ b/src/code/z_sram_NES.c @@ -1581,7 +1581,7 @@ void func_801457CC(GameState* gameState, SramContext* sramCtx) { } gSaveContext.save.saveInfo.checksum = 0; - // FAKE: [sp64 + 0]? + //! FAKE: [sp64 + 0]? gSaveContext.save.saveInfo.checksum = Sram_CalcChecksum(&gSaveContext, gFlashSaveSizes[sp64 + 0]); for (sp7A = 0; sp7A < ARRAY_COUNT(gSaveContext.save.saveInfo.playerData.newf); sp7A++) { diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index cdfd9273a7..7117e1da21 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -25,7 +25,7 @@ EnDoor* SubS_FindDoor(PlayState* play, s32 switchFlag) { actor = SubS_FindActor(play, actor, ACTORCAT_DOOR, ACTOR_EN_DOOR); door = (EnDoor*)actor; - if (actor == NULL) { + if (door == NULL) { break; } @@ -541,7 +541,7 @@ s32 SubS_ChangeAnimationByInfoS(SkelAnime* skelAnime, AnimationInfoS* animationI endFrame = Animation_GetLastFrame(&animationInfo->animation->common); } startFrame = animationInfo->startFrame; - if (startFrame >= endFrame || startFrame < 0) { + if ((startFrame >= endFrame) || (startFrame < 0)) { return false; } if (animationInfo->playSpeed < 0.0f) { diff --git a/src/libultra/libc/xlitob.c b/src/libultra/libc/xlitob.c index 9eb0e98d1b..40596271a9 100644 --- a/src/libultra/libc/xlitob.c +++ b/src/libultra/libc/xlitob.c @@ -21,11 +21,11 @@ void _Litob(_Pft* args, u8 type) { numMap = ldigs; } - base = (type == 'o') ? 8 : ((type != 'x' && type != 'X') ? 10 : 16); + base = (type == 'o') ? 8 : (((type != 'x') && (type != 'X')) ? 10 : 16); idx = BUFF_LEN; num = args->v.ll; - if ((type == 'd' || type == 'i') && args->v.ll < 0) { + if (((type == 'd') || (type == 'i')) && (args->v.ll < 0)) { num = -num; } @@ -49,7 +49,7 @@ void _Litob(_Pft* args, u8 type) { args->nz0 = args->prec - args->n1; } - if ((args->prec < 0) && (args->flags & (FLAGS_ZERO | FLAGS_MINUS)) == FLAGS_ZERO) { + if ((args->prec < 0) && ((args->flags & (FLAGS_ZERO | FLAGS_MINUS)) == FLAGS_ZERO)) { idx = args->width - args->n0 - args->nz0 - args->n1; if (idx > 0) { args->nz0 += idx; diff --git a/src/libultra/libc/xprintf.c b/src/libultra/libc/xprintf.c index a4094833fa..b644516f4c 100644 --- a/src/libultra/libc/xprintf.c +++ b/src/libultra/libc/xprintf.c @@ -1,10 +1,11 @@ #include "ultra64.h" #include "libc/string.h" -#define ATOI(i, a) \ - for (i = 0; *a >= '0' && *a <= '9'; a++) \ - if (i < 999) \ +#define ATOI(i, a) \ + for (i = 0; (*a >= '0') && (*a <= '9'); a++) \ + if (i < 999) \ i = *a + i * 10 - '0'; + #define _PROUT(fmt, _size) \ if (_size > 0) { \ arg = (void*)pfn(arg, fmt, _size); \ @@ -13,8 +14,9 @@ else \ return x.nchar; \ } + #define _PAD(m, src, extracond) \ - if (extracond && m > 0) { \ + if (extracond && (m > 0)) { \ int i; \ int j; \ for (j = m; j > 0; j -= i) { \ @@ -84,7 +86,7 @@ int _Printf(PrintCallback pfn, void* arg, const char* fmt, va_list ap) { x.qual = 0; } - if (x.qual == 'l' && *s == 'l') { + if ((x.qual == 'l') && (*s == 'l')) { x.qual = 'L'; s++; } @@ -106,7 +108,6 @@ void _Putfld(_Pft* px, va_list* pap, unsigned char code, unsigned char* ac) { px->n0 = px->nz0 = px->n1 = px->nz1 = px->n2 = px->nz2 = 0; switch (code) { - case 'c': ac[px->n0++] = va_arg(*pap, u32); break; @@ -158,7 +159,7 @@ void _Putfld(_Pft* px, va_list* pap, unsigned char code, unsigned char* ac) { if (px->flags & FLAGS_HASH) { ac[px->n0++] = '0'; - if (code == 'x' || code == 'X') { + if ((code == 'x') || (code == 'X')) { ac[px->n0++] = code; } @@ -172,16 +173,14 @@ void _Putfld(_Pft* px, va_list* pap, unsigned char code, unsigned char* ac) { case 'g': case 'E': case 'G': - px->v.ld = px->qual == 'L' ? va_arg(*pap, f64) : va_arg(*pap, f64); + px->v.ld = (px->qual == 'L') ? va_arg(*pap, f64) : va_arg(*pap, f64); if (*(u16*)&px->v.ll & 0x8000) { ac[px->n0++] = '-'; - } else { - if (px->flags & FLAGS_PLUS) { - ac[px->n0++] = '+'; - } else if (px->flags & FLAGS_SPACE) { - ac[px->n0++] = ' '; - } + } else if (px->flags & FLAGS_PLUS) { + ac[px->n0++] = '+'; + } else if (px->flags & FLAGS_SPACE) { + ac[px->n0++] = ' '; } px->s = (char*)&ac[px->n0]; diff --git a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c index a48bf5663a..73de1eea4f 100644 --- a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c @@ -87,8 +87,10 @@ void BgAstrBombwall_InitCollider(ColliderTrisInit* init, Vec3f* pos, Vec3s* rot, Matrix_RotateZS(rot->z, MTXMODE_APPLY); for (i = 0; i < init->count; i++) { - for (j = 0; j < 3; j++) { // https://decomp.me/scratch/JrEnl - Matrix_MultVec3f(&(init->elements + i)->dim.vtx[j], &sp54[j]); //! FAKE MATCH: + for (j = 0; j < 3; j++) { + //! FAKE: + // https://decomp.me/scratch/JrEnl + Matrix_MultVec3f(&(init->elements + i)->dim.vtx[j], &sp54[j]); Math_Vec3f_Sum(&sp54[j], pos, &sp54[j]); } Collider_SetTrisVertices(collider, i, &sp54[0], &sp54[1], &sp54[2]); diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c index 9cb8c9b9d9..97d805e768 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c @@ -294,20 +294,20 @@ void BgDblueMovebg_Destroy(Actor* thisx, PlayState* play) { } void func_80A2A128(BgDblueMovebg* this, PlayState* play) { - Actor* phi_s0 = NULL; + Actor* actorIter = NULL; while (true) { - phi_s0 = SubS_FindActor(play, phi_s0, ACTORCAT_BG, ACTOR_OBJ_HUNSUI); - if (phi_s0 != NULL) { - if ((OBJHUNSUI_GET_F000(phi_s0) == 5) && (phi_s0->update != NULL)) { - this->unk_2F8[1] = phi_s0; - } else if ((OBJHUNSUI_GET_F000(phi_s0) == 6) && (phi_s0->update != NULL)) { - this->unk_2F8[0] = phi_s0; + actorIter = SubS_FindActor(play, actorIter, ACTORCAT_BG, ACTOR_OBJ_HUNSUI); + if (actorIter != NULL) { + if ((OBJHUNSUI_GET_F000(actorIter) == 5) && (actorIter->update != NULL)) { + this->unk_2F8[1] = actorIter; + } else if ((OBJHUNSUI_GET_F000(actorIter) == 6) && (actorIter->update != NULL)) { + this->unk_2F8[0] = actorIter; } - phi_s0 = phi_s0->next; + actorIter = actorIter->next; } - if (phi_s0 == NULL) { + if (actorIter == NULL) { break; } } diff --git a/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c b/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c index bbbd847a4e..1cf798e2e6 100644 --- a/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c +++ b/src/overlays/actors/ovl_Bg_Dkjail_Ivy/z_bg_dkjail_ivy.c @@ -63,7 +63,7 @@ void BgDkjailIvy_IvyCutEffects(BgDkjailIvy* this, PlayState* play) { s32 i; Vec3f spD4; Vec3f pos; - Vec3f vel; + Vec3f velocity; Vec3f accel; s16 angle; @@ -84,15 +84,15 @@ void BgDkjailIvy_IvyCutEffects(BgDkjailIvy* this, PlayState* play) { Matrix_MultVec3f(&spD4, &pos); - vel.x = (Rand_ZeroOne() - 0.5f) + (pos.x * 0.075f); - vel.y = 2.0f * Rand_ZeroOne(); - vel.z = (Rand_ZeroOne() - 0.5f) + (pos.z * 0.075f); + velocity.x = (Rand_ZeroOne() - 0.5f) + (pos.x * 0.075f); + velocity.y = 2.0f * Rand_ZeroOne(); + velocity.z = (Rand_ZeroOne() - 0.5f) + (pos.z * 0.075f); pos.x += this->dyna.actor.world.pos.x; pos.y += this->dyna.actor.world.pos.y; pos.z += this->dyna.actor.world.pos.z; - EffectSsKakera_Spawn(play, &pos, &vel, &pos, -0x82, 0x40, 0x28, 0, 0, sLeafScales[i & 3], 0, 0, 44, -1, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -0x82, 0x40, 0x28, 0, 0, sLeafScales[i & 3], 0, 0, 44, -1, GAMEPLAY_KEEP, sLeafDlists[(s32)Rand_Next() > 0]); if ((i > 20) && ((i % 2) != 0)) { diff --git a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c index 6beb993872..4750cc9d31 100644 --- a/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c +++ b/src/overlays/actors/ovl_Bg_F40_Block/z_bg_f40_block.c @@ -180,7 +180,7 @@ s32 func_80BC3D08(BgF40Block* this, PlayState* play, s32 arg2) { return false; } - if (arg2 != 0) { + if (arg2) { sp48.x = (D_80BC4620[this->unk_168].x * ((800.0f * this->dyna.actor.scale.x) - (this->dyna.actor.speed * 0.5f))) + this->dyna.actor.world.pos.x; @@ -205,7 +205,7 @@ s32 func_80BC3D08(BgF40Block* this, PlayState* play, s32 arg2) { } if (BgCheck_AnyLineTest1(&play->colCtx, &sp48, &sp3C, &sp30, &sp54, true)) { - if (arg2 == 0) { + if (!arg2) { this->dyna.actor.world.pos.x -= sp3C.x - sp30.x; this->dyna.actor.world.pos.y -= sp3C.y - sp30.y; this->dyna.actor.world.pos.z -= sp3C.z - sp30.z; @@ -260,7 +260,7 @@ void BgF40Block_Destroy(Actor* thisx, PlayState* play) { } void func_80BC41AC(BgF40Block* this, PlayState* play) { - if (func_80BC3D08(this, play, 1)) { + if (func_80BC3D08(this, play, true)) { if (!Flags_GetSwitch(play, BGF40BLOCK_GET_SWITCH_FLAG(&this->dyna.actor))) { func_80BC4038(this); this->actionFunc = func_80BC44F4; @@ -282,7 +282,7 @@ void func_80BC4228(BgF40Block* this, PlayState* play) { } } - if (func_80BC3D08(this, play, 0)) { + if (func_80BC3D08(this, play, false)) { CutsceneManager_Stop(this->dyna.actor.csId); this->actionFunc = func_80BC41AC; Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_F); @@ -320,7 +320,7 @@ void func_80BC4380(BgF40Block* this, PlayState* play) { } void func_80BC43CC(BgF40Block* this, PlayState* play) { - if (func_80BC3D08(this, play, 1)) { + if (func_80BC3D08(this, play, true)) { if (Flags_GetSwitch(play, BGF40BLOCK_GET_SWITCH_FLAG(&this->dyna.actor))) { func_80BC4038(this); this->actionFunc = func_80BC4344; @@ -342,7 +342,7 @@ void func_80BC4448(BgF40Block* this, PlayState* play) { } } - if (func_80BC3D08(this, play, 0)) { + if (func_80BC3D08(this, play, false)) { CutsceneManager_Stop(this->dyna.actor.csId); this->actionFunc = func_80BC43CC; Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_IKANA_BLOCK_STOP_F); diff --git a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c index bd5053f633..8680a57aa4 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Haka_Bombwall/z_bg_haka_bombwall.c @@ -78,9 +78,9 @@ s32 func_80BD5E00(BgHakaBombwall* this) { void func_80BD5E6C(BgHakaBombwall* this, PlayState* play) { u32 i; Vec3f pos; - Vec3f vel; + Vec3f velocity; Vec3f posOffset; - Vec3f velOffset; + Vec3f velocityOffset; f32 offsetPosX; f32 offsetPosY; s16 scale; @@ -107,12 +107,12 @@ void func_80BD5E6C(BgHakaBombwall* this, PlayState* play) { posOffset.y = offsetPosY; posOffset.z = (Rand_ZeroOne() * 20.0f) - 10.0f; - velOffset.x = ((Rand_ZeroOne() - 0.5f) * 5.0f) + (offsetPosX * (4.0f / 75.0f)); - velOffset.y = (Rand_ZeroOne() * 7.0f) - 2.0f; - velOffset.z = (Rand_ZeroOne() * 4.0f) - 2.0f; + velocityOffset.x = ((Rand_ZeroOne() - 0.5f) * 5.0f) + (offsetPosX * (4.0f / 75.0f)); + velocityOffset.y = (Rand_ZeroOne() * 7.0f) - 2.0f; + velocityOffset.z = (Rand_ZeroOne() * 4.0f) - 2.0f; Matrix_MultVec3f(&posOffset, &pos); - Matrix_MultVec3f(&velOffset, &vel); + Matrix_MultVec3f(&velocityOffset, &velocity); pos.x += this->dyna.actor.world.pos.x; pos.y += this->dyna.actor.world.pos.y; @@ -146,7 +146,7 @@ void func_80BD5E6C(BgHakaBombwall* this, PlayState* play) { gravity = -450; } - EffectSsKakera_Spawn(play, &pos, &vel, &pos, gravity, phi_s0, 30, 0, 0, scale, phi_t0, 0, 50, -1, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, gravity, phi_s0, 30, 0, 0, scale, phi_t0, 0, 50, -1, OBJECT_HAKA_OBJ, object_haka_obj_DL_001680); } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c b/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c index 7472691796..6c533e6993 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Bombwall/z_bg_ikana_bombwall.c @@ -99,9 +99,9 @@ Gfx* D_80BD52E0[] = { void func_80BD4720(BgIkanaBombwall* this, PlayState* play) { s32 i; Vec3f pos; - Vec3f vel; + Vec3f velocity; Vec3f posOffset; - Vec3f velOffset; + Vec3f velocityOffset; f32 offsetPosX; f32 offsetPosY; s16 scale; @@ -126,12 +126,12 @@ void func_80BD4720(BgIkanaBombwall* this, PlayState* play) { posOffset.y = offsetPosY; posOffset.z = (Rand_ZeroOne() * 20.0f) - 10.0f; - velOffset.x = ((Rand_ZeroOne() - 0.5f) * 5.0f) + (offsetPosX * (4.0f / 75.0f)); - velOffset.y = (Rand_ZeroOne() * 7.0f) - 2.0f; - velOffset.z = (Rand_ZeroOne() * 4.0f) - 2.0f; + velocityOffset.x = ((Rand_ZeroOne() - 0.5f) * 5.0f) + (offsetPosX * (4.0f / 75.0f)); + velocityOffset.y = (Rand_ZeroOne() * 7.0f) - 2.0f; + velocityOffset.z = (Rand_ZeroOne() * 4.0f) - 2.0f; Matrix_MultVec3f(&posOffset, &pos); - Matrix_MultVec3f(&velOffset, &vel); + Matrix_MultVec3f(&velocityOffset, &velocity); pos.x += this->dyna.actor.world.pos.x; pos.y += this->dyna.actor.world.pos.y; @@ -165,7 +165,7 @@ void func_80BD4720(BgIkanaBombwall* this, PlayState* play) { gravity = -450; } - EffectSsKakera_Spawn(play, &pos, &vel, &pos, gravity, phi_s0, 30, 0, 0, scale, phi_t0, 0, 50, -1, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, gravity, phi_s0, 30, 0, 0, scale, phi_t0, 0, 50, -1, OBJECT_IKANA_OBJ, object_ikana_obj_DL_000288); } @@ -175,7 +175,7 @@ void func_80BD4720(BgIkanaBombwall* this, PlayState* play) { void func_80BD4A14(BgIkanaBombwall* this, PlayState* play) { s32 i; Vec3f pos; - Vec3f vel; + Vec3f velocity; f32 temp_fs0; f32 temp_fs1; f32 temp_fs3; @@ -200,9 +200,9 @@ void func_80BD4A14(BgIkanaBombwall* this, PlayState* play) { pos.y = this->dyna.actor.world.pos.y; pos.z = (temp_fs1 * temp_fs3) + this->dyna.actor.world.pos.z; - vel.x = ((Rand_ZeroOne() - 0.5f) * 3.0f * temp_fs0) + ((temp_fs0 * temp_fs3) * (1.0f / 30.0f)); - vel.y = (Rand_ZeroOne() * 18.0f) + 4.0f; - vel.z = ((Rand_ZeroOne() - 0.5f) * 3.0f * temp_fs1) + ((temp_fs1 * temp_fs3) * (1.0f / 30.0f)); + velocity.x = ((Rand_ZeroOne() - 0.5f) * 3.0f * temp_fs0) + ((temp_fs0 * temp_fs3) * (1.0f / 30.0f)); + velocity.y = (Rand_ZeroOne() * 18.0f) + 4.0f; + velocity.z = ((Rand_ZeroOne() - 0.5f) * 3.0f * temp_fs1) + ((temp_fs1 * temp_fs3) * (1.0f / 30.0f)); scale = (Rand_Next() & 3) + (i >> 1) + 6; @@ -221,7 +221,7 @@ void func_80BD4A14(BgIkanaBombwall* this, PlayState* play) { gravity = -400; } - EffectSsKakera_Spawn(play, &pos, &vel, &pos, gravity, phi_v0, 30, 0, 0, scale, phi_v1, 0, 50, -1, + EffectSsKakera_Spawn(play, &pos, &velocity, &pos, gravity, phi_v0, 30, 0, 0, scale, phi_v1, 0, 50, -1, OBJECT_IKANA_OBJ, object_ikana_obj_DL_000288); if ((i & 3) == 0) { diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 18f4500d48..3969e782ad 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -16,7 +16,7 @@ void BgIngate_Destroy(Actor* thisx, PlayState* play); void BgIngate_Update(Actor* thisx, PlayState* play); void BgIngate_Draw(Actor* thisx, PlayState* play); -Actor* BgIngate_FindActor(BgIngate* this, PlayState* play, u8 actorCat, s16 actorId); +Actor* BgIngate_FindActor(BgIngate* this, PlayState* play, u8 actorCategory, s16 actorId); s32 func_80953BEC(BgIngate* this); void func_80953B40(BgIngate* this); void func_80953F8C(BgIngate* this, PlayState* play); @@ -43,30 +43,32 @@ ActorInit Bg_Ingate_InitVars = { * * @param this * @param play - * @param actorCat - Category of Actor + * @param actorCategory - Category of Actor * @param actorId - ID of actor to search for * @return Actor* */ -Actor* BgIngate_FindActor(BgIngate* this, PlayState* play, u8 actorCat, s16 actorId) { - Actor* foundActor = NULL; - Actor* tempActor; +Actor* BgIngate_FindActor(BgIngate* this, PlayState* play, u8 actorCategory, s16 actorId) { + Actor* actorIter = NULL; while (true) { - foundActor = SubS_FindActor(play, foundActor, actorCat, actorId); + actorIter = SubS_FindActor(play, actorIter, actorCategory, actorId); - if ((foundActor == NULL) || (((this != (BgIngate*)foundActor)) && (foundActor->update != NULL))) { + if (actorIter == NULL) { break; } - tempActor = foundActor->next; - if (tempActor == NULL) { - foundActor = NULL; + if ((this != (BgIngate*)actorIter) && (actorIter->update != NULL)) { break; } - foundActor = tempActor; + + if (actorIter->next == NULL) { + actorIter = NULL; + break; + } + actorIter = actorIter->next; } - return foundActor; + return actorIter; } void func_80953B40(BgIngate* this) { diff --git a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c index cf3d93e951..434b969c35 100644 --- a/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c +++ b/src/overlays/actors/ovl_Dm_Ah/z_dm_ah.c @@ -108,25 +108,27 @@ s32 func_80C1D6E0(DmAh* this, PlayState* play) { return true; } -Actor* func_80C1D78C(PlayState* play) { - Actor* tempActor; - Actor* foundActor = NULL; +Actor* DmAh_FindAnjuActor(PlayState* play) { + Actor* actorIter = NULL; while (true) { - foundActor = SubS_FindActor(play, foundActor, ACTORCAT_NPC, ACTOR_DM_AN); + actorIter = SubS_FindActor(play, actorIter, ACTORCAT_NPC, ACTOR_DM_AN); - if ((foundActor == NULL) || (foundActor->update != NULL)) { + if (actorIter == NULL) { break; } - tempActor = foundActor->next; - if ((tempActor == NULL) || false) { - foundActor = NULL; + if (actorIter->update != NULL) { break; } - foundActor = tempActor; + + if ((actorIter->next == NULL) || false) { + actorIter = NULL; + break; + } + actorIter = actorIter->next; } - return foundActor; + return actorIter; } void DmAh_HandleCutscene(DmAh* this, PlayState* play) { @@ -172,7 +174,7 @@ void DmAh_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); this->unk_27C |= 1; if ((play->sceneId == SCENE_YADOYA) && (play->curSpawn == 4)) { - this->unk_280 = func_80C1D78C(play); + this->unk_280 = DmAh_FindAnjuActor(play); DmAh_ChangeAnim(this, DMAH_ANIM_1); this->actionFunc = DmAh_DoNothing; } else { diff --git a/src/overlays/actors/ovl_Dm_An/z_dm_an.c b/src/overlays/actors/ovl_Dm_An/z_dm_an.c index f3b49aa9dd..43077f3095 100644 --- a/src/overlays/actors/ovl_Dm_An/z_dm_an.c +++ b/src/overlays/actors/ovl_Dm_An/z_dm_an.c @@ -200,24 +200,26 @@ s32 DmAn_UpdateAttention(DmAn* this, PlayState* play) { } Actor* DmAn_FindAnjusMotherActor(PlayState* play) { - Actor* tempActor; - Actor* foundActor = NULL; + Actor* actorIter = NULL; while (true) { - foundActor = SubS_FindActor(play, foundActor, ACTORCAT_NPC, ACTOR_DM_AH); + actorIter = SubS_FindActor(play, actorIter, ACTORCAT_NPC, ACTOR_DM_AH); - if ((foundActor == NULL) || (foundActor->update != NULL)) { + if (actorIter == NULL) { break; } - tempActor = foundActor->next; - if ((tempActor == NULL) || false) { - foundActor = NULL; + if (actorIter->update != NULL) { break; } - foundActor = tempActor; + + if ((actorIter->next == NULL) || false) { + actorIter = NULL; + break; + } + actorIter = actorIter->next; } - return foundActor; + return actorIter; } void DmAn_WaitForObject(DmAn* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c index bf43729624..43bd0f5894 100644 --- a/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c +++ b/src/overlays/actors/ovl_Dm_Bal/z_dm_bal.c @@ -163,11 +163,11 @@ void DmBal_UpdateEyes(DmBal* this) { } } -void DmBal_SpawnPaper(DmBal* this, PlayState* play, Vec3f* pos, Vec3f* vel, f32 gravity) { +void DmBal_SpawnPaper(DmBal* this, PlayState* play, Vec3f* pos, Vec3f* velocity, f32 gravity) { Actor* paper = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PAPER, pos->x, pos->y, pos->z, 0, 0, 0, 0); if (paper != NULL) { - paper->velocity = *vel; + paper->velocity = *velocity; paper->gravity = gravity; } } @@ -179,15 +179,15 @@ void DmBal_Update(Actor* thisx, PlayState* play) { // Throw confetti if (Animation_OnFrame(&this->skelAnime, 29.0f) && (this->skelAnime.animation == &gTingleFloatThrowConfettiAnim)) { Vec3f pos = this->actor.world.pos; - Vec3f vel = { 0.0f, 9.0f, 0.0f }; + Vec3f velocity = { 0.0f, 9.0f, 0.0f }; pos.x += 7.0f * Math_SinS(this->actor.shape.rot.y); pos.y += 2.5f; pos.z += 7.0f * Math_CosS(this->actor.shape.rot.y); - vel.x = Math_SinS(this->actor.shape.rot.y) * 5.0f; - vel.z = Math_CosS(this->actor.shape.rot.y) * 5.0f; - DmBal_SpawnPaper(this, play, &pos, &vel, -0.4f); - DmBal_SpawnPaper(this, play, &pos, &vel, -0.5f); + velocity.x = Math_SinS(this->actor.shape.rot.y) * 5.0f; + velocity.z = Math_CosS(this->actor.shape.rot.y) * 5.0f; + DmBal_SpawnPaper(this, play, &pos, &velocity, -0.4f); + DmBal_SpawnPaper(this, play, &pos, &velocity, -0.5f); } this->actionFunc(this, play); DmBal_HandleCutscene(this, play); diff --git a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c index 594bb3ba32..cebfc624ae 100644 --- a/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c +++ b/src/overlays/actors/ovl_Dm_Gm/z_dm_gm.c @@ -200,24 +200,26 @@ s32 DmGm_UpdateAttention(DmGm* this, PlayState* play) { } Actor* DmGm_FindAnjusMotherActor(PlayState* play) { - Actor* tempActor; - Actor* foundActor = NULL; + Actor* actorIter = NULL; while (true) { - foundActor = SubS_FindActor(play, foundActor, ACTORCAT_NPC, ACTOR_DM_AH); + actorIter = SubS_FindActor(play, actorIter, ACTORCAT_NPC, ACTOR_DM_AH); - if ((foundActor == NULL) || (foundActor->update != NULL)) { + if (actorIter == NULL) { break; } - tempActor = foundActor->next; - if ((tempActor == NULL) || false) { - foundActor = NULL; + if (actorIter->update != NULL) { break; } - foundActor = tempActor; + + if ((actorIter->next == NULL) || false) { + actorIter = NULL; + break; + } + actorIter = actorIter->next; } - return foundActor; + return actorIter; } void DmGm_WaitForObject(DmGm* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c index bcbf35da7e..24c03bb1ee 100644 --- a/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c +++ b/src/overlays/actors/ovl_Dm_Tag/z_dm_tag.c @@ -46,23 +46,27 @@ s32 D_80C22C30[] = { 0x10000000, }; -Actor* func_80C22350(DmTag* this, PlayState* play, u8 actorCat, s16 actorId) { - Actor* foundActor = NULL; +Actor* DmTag_FindActor(DmTag* this, PlayState* play, u8 actorCategory, s16 actorId) { + Actor* actorIter = NULL; while (true) { - foundActor = SubS_FindActor(play, foundActor, actorCat, actorId); + actorIter = SubS_FindActor(play, actorIter, actorCategory, actorId); - if ((foundActor == NULL) || (((this != (DmTag*)foundActor)) && (foundActor->update != NULL))) { + if (actorIter == NULL) { break; } - if (foundActor->next == NULL) { - foundActor = NULL; + if ((this != (DmTag*)actorIter) && (actorIter->update != NULL)) { break; } - foundActor = foundActor->next; + + if (actorIter->next == NULL) { + actorIter = NULL; + break; + } + actorIter = actorIter->next; } - return foundActor; + return actorIter; } s32 func_80C22400(DmTag* this, s16 csId) { @@ -98,8 +102,8 @@ s32 func_80C224D8(DmTag* this, PlayState* play) { s16 csId = this->actor.csId; s32 ret = false; - sp30 = func_80C22350(this, play, ACTORCAT_NPC, ACTOR_EN_AN); - sp2C = func_80C22350(this, play, ACTORCAT_NPC, ACTOR_EN_AH); + sp30 = DmTag_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AN); + sp2C = DmTag_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AH); switch (this->unk_1A4) { case 0: diff --git a/src/overlays/actors/ovl_En_Ah/z_en_ah.c b/src/overlays/actors/ovl_En_Ah/z_en_ah.c index 26f4417d5d..6699c75944 100644 --- a/src/overlays/actors/ovl_En_Ah/z_en_ah.c +++ b/src/overlays/actors/ovl_En_Ah/z_en_ah.c @@ -96,26 +96,28 @@ TexturePtr D_80BD3F14[] = { object_ah_Tex_006D70, object_ah_Tex_007570, object_ah_Tex_007D70, object_ah_Tex_007570, object_ah_Tex_008570, }; -Actor* func_80BD2A30(EnAh* this, PlayState* play, u8 actorCat, s16 actorId) { - Actor* tempActor; - Actor* foundActor = NULL; +Actor* EnAh_FindActor(EnAh* this, PlayState* play, u8 actorCategory, s16 actorId) { + Actor* actorIter = NULL; while (true) { - foundActor = SubS_FindActor(play, foundActor, actorCat, actorId); + actorIter = SubS_FindActor(play, actorIter, actorCategory, actorId); - if ((foundActor == NULL) || (((EnAh*)foundActor != this) && (foundActor->update != NULL))) { + if (actorIter == NULL) { break; } - tempActor = foundActor->next; - if (tempActor == NULL) { - foundActor = NULL; + if ((this != (EnAh*)actorIter) && (actorIter->update != NULL)) { break; } - foundActor = tempActor; + + if (actorIter->next == NULL) { + actorIter = NULL; + break; + } + actorIter = actorIter->next; } - return foundActor; + return actorIter; } void EnAh_UpdateSkelAnime(EnAh* this) { @@ -367,10 +369,10 @@ s32* func_80BD3294(EnAh* this, PlayState* play) { return NULL; } -s32 func_80BD3320(EnAh* this, PlayState* play, u8 actorCat, s16 actorId) { +s32 func_80BD3320(EnAh* this, PlayState* play, u8 actorCategory, s16 actorId) { s32 pad; s32 ret = false; - Actor* temp_v0 = func_80BD2A30(this, play, actorCat, actorId); + Actor* temp_v0 = EnAh_FindActor(this, play, actorCategory, actorId); if (temp_v0 != NULL) { this->actor.child = temp_v0; @@ -514,7 +516,7 @@ void func_80BD3768(EnAh* this, PlayState* play) { void EnAh_Init(Actor* thisx, PlayState* play) { EnAh* this = THIS; - if (func_80BD2A30(this, play, ACTORCAT_NPC, ACTOR_EN_AH)) { + if (EnAh_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AH)) { Actor_Kill(&this->actor); return; } diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.c b/src/overlays/actors/ovl_En_Al/z_en_al.c index 75cdfc300d..f19a68fd48 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.c +++ b/src/overlays/actors/ovl_En_Al/z_en_al.c @@ -133,29 +133,27 @@ Gfx* D_80BE007C[] = { gMadameAromaShawlRightLowerMiddleDL, gMadameAromaShawlRightLowerDL, }; -Actor* func_80BDE1A0(EnAl* this, PlayState* play, u8 arg0, s16 arg1) { - Actor* foundActor = NULL; - Actor* temp; +Actor* EnAl_FindActor(EnAl* this, PlayState* play, u8 actorCategory, s16 actorId) { + Actor* actorIter = NULL; while (true) { - foundActor = SubS_FindActor(play, foundActor, arg0, arg1); + actorIter = SubS_FindActor(play, actorIter, actorCategory, actorId); - if (foundActor == NULL) { + if (actorIter == NULL) { break; } - if ((this != (EnAl*)foundActor) && (foundActor->update != NULL)) { + if ((this != (EnAl*)actorIter) && (actorIter->update != NULL)) { break; } - temp = foundActor->next; - if (temp == NULL) { - foundActor = NULL; + if (actorIter->next == NULL) { + actorIter = NULL; break; } - foundActor = temp; + actorIter = actorIter->next; } - return foundActor; + return actorIter; } void EnAl_UpdateSkelAnime(EnAl* this) { @@ -200,7 +198,7 @@ Actor* func_80BDE384(EnAl* this, PlayState* play) { switch (this->unk_35C) { case 2: if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_89_08) && CHECK_WEEKEVENTREG(WEEKEVENTREG_85_80)) { - actor = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_PM); + actor = EnAl_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_PM); } else { actor = &GET_PLAYER(play)->actor; } @@ -361,8 +359,8 @@ s32 func_80BDE7FC(EnAl* this, PlayState* play) { s32 func_80BDE92C(EnAl* this, PlayState* play) { s32 pad[2]; - Actor* sp1C = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_GM); - Actor* temp_v0 = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); + Actor* sp1C = EnAl_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_GM); + Actor* temp_v0 = EnAl_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); if ((sp1C == NULL) || (sp1C->update == NULL) || (temp_v0 == NULL) || (temp_v0->update == NULL)) { this->unk_4E6++; @@ -581,8 +579,8 @@ void func_80BDEFE4(EnAl* this, PlayState* play) { s32 func_80BDF064(EnAl* this, PlayState* play) { Player* player = GET_PLAYER(play); u16 sp22 = play->msgCtx.currentTextId; - Actor* sp1C = func_80BDE1A0(this, play, 4, 0xA4); - Actor* temp_v0 = func_80BDE1A0(this, play, 4, 0x234); + Actor* sp1C = EnAl_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_GM); + Actor* temp_v0 = EnAl_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); if (player->stateFlags1 & PLAYER_STATE1_40) { this->unk_4C2 |= 0x400; @@ -649,8 +647,8 @@ s32 func_80BDF064(EnAl* this, PlayState* play) { s32 func_80BDF244(EnAl* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; - Actor* sp20 = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_GM); - Actor* temp_v0 = func_80BDE1A0(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); + Actor* sp20 = EnAl_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_GM); + Actor* temp_v0 = EnAl_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); if ((sp20 != NULL) && (sp20->update != NULL) && (temp_v0 != NULL) && (temp_v0->update != NULL)) { EnAl_ChangeAnim(this, ENAL_ANIM_0); diff --git a/src/overlays/actors/ovl_En_An/z_en_an.c b/src/overlays/actors/ovl_En_An/z_en_an.c index d908d17c0c..713833c25b 100644 --- a/src/overlays/actors/ovl_En_An/z_en_an.c +++ b/src/overlays/actors/ovl_En_An/z_en_an.c @@ -392,56 +392,56 @@ s32 EnAn_InitObjectSlots(EnAn* this, PlayState* play) { } Actor* EnAn_FindActor(EnAn* this, PlayState* play, u8 actorCategory, s16 actorId) { - Actor* foundActor = NULL; + Actor* actorIter = NULL; while (true) { - foundActor = SubS_FindActor(play, foundActor, actorCategory, actorId); + actorIter = SubS_FindActor(play, actorIter, actorCategory, actorId); - if (foundActor == NULL) { + if (actorIter == NULL) { break; } - if ((this != (EnAn*)foundActor) && (foundActor->update != NULL)) { + if ((this != (EnAn*)actorIter) && (actorIter->update != NULL)) { break; } - if (foundActor->next == NULL) { - foundActor = NULL; + if (actorIter->next == NULL) { + actorIter = NULL; break; } - foundActor = foundActor->next; + actorIter = actorIter->next; } - return foundActor; + return actorIter; } // Name after ENAN_8000 Actor* func_80B53A7C(EnAn* this, PlayState* play, u8 actorCategory, s16 actorId) { - Actor* foundActor = NULL; + Actor* actorIter = NULL; while (true) { - foundActor = SubS_FindActor(play, foundActor, actorCategory, actorId); + actorIter = SubS_FindActor(play, actorIter, actorCategory, actorId); - if (foundActor == NULL) { + if (actorIter == NULL) { break; } - if ((this != (EnAn*)foundActor) && (foundActor->update != NULL)) { - if (!ENAN_GET_8000(foundActor)) { + if ((this != (EnAn*)actorIter) && (actorIter->update != NULL)) { + if (!ENAN_GET_8000(actorIter)) { break; } } - if (foundActor->next == NULL) { - foundActor = NULL; + if (actorIter->next == NULL) { + actorIter = NULL; break; } - foundActor = foundActor->next; + actorIter = actorIter->next; } - return foundActor; + return actorIter; } EnDoor* EnAn_FindDoor(PlayState* play, AnjuScheduleResult scheduleOutputResult) { diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 2cf81e94ea..a2ee63e8c1 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -107,7 +107,7 @@ void func_80867C14(struct_80867BDC_a0* arg0, PlayState* play) { void func_80867C8C(struct_80867BDC_a0* arg0, PlayState* play) { s32 temp_s6 = arg0->unk_18 - arg0->unk_1C; s32 i; - f32 pad; + s32 pad; if (temp_s6 > 0) { OPEN_DISPS(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index 88f0115537..d677e6b91e 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -121,7 +121,7 @@ s32 EnBubble_Explosion(EnBubble* this, PlayState* play) { static Color_RGBA8 sEffectEnvColor = { 150, 150, 150, 0 }; s32 i; Vec3f effectAccel = { 0.0f, -0.5f, 0.0f }; - Vec3f effectVel; + Vec3f effectVelocity; Vec3f effectPos; Math_SmoothStepToF(&this->modelWidth, 4.0f, 0.1f, 1000.0f, 0.0f); @@ -137,10 +137,10 @@ s32 EnBubble_Explosion(EnBubble* this, PlayState* play) { effectPos.y = this->actor.world.pos.y + this->actor.shape.yOffset; effectPos.z = this->actor.world.pos.z; for (i = 0; i < 20; i++) { - effectVel.x = (Rand_ZeroOne() - 0.5f) * 7.0f; - effectVel.y = Rand_ZeroOne() * 7.0f; - effectVel.z = (Rand_ZeroOne() - 0.5f) * 7.0f; - EffectSsDtBubble_SpawnCustomColor(play, &effectPos, &effectVel, &effectAccel, &sEffectPrimColor, + effectVelocity.x = (Rand_ZeroOne() - 0.5f) * 7.0f; + effectVelocity.y = Rand_ZeroOne() * 7.0f; + effectVelocity.z = (Rand_ZeroOne() - 0.5f) * 7.0f; + EffectSsDtBubble_SpawnCustomColor(play, &effectPos, &effectVelocity, &effectAccel, &sEffectPrimColor, &sEffectEnvColor, Rand_S16Offset(100, 50), 25, 0); } Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, 0x50); diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 226dc567bb..15bf3a10c0 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -419,7 +419,7 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { f32 lightRayMaxScale; u8 i; Vec3f pos; - Vec3f vel; + Vec3f velocity; Vec3f accel; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; @@ -441,12 +441,12 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { sLightRayMaxScale[thisx->params] + Rand_ZeroFloat(sLightRayMaxScale[thisx->params]); Matrix_RotateYF(Rand_ZeroFloat(M_PI * 2), MTXMODE_NEW); Matrix_RotateXFApply(Rand_ZeroFloat(M_PI * 2)); - Matrix_MultVecZ(lightRayMaxScale, &vel); - accel.x = vel.x * -0.03f; - accel.y = vel.y * -0.03f; - accel.z = vel.z * -0.03f; + Matrix_MultVecZ(lightRayMaxScale, &velocity); + accel.x = velocity.x * -0.03f; + accel.y = velocity.y * -0.03f; + accel.z = velocity.z * -0.03f; EnClearTag_CreateIsolatedLightRayEffect( - this, &pos, &vel, &accel, + this, &pos, &velocity, &accel, sLightRayScale[thisx->params] + Rand_ZeroFloat(sLightRayScale[thisx->params] * 0.5f), sLightRayMaxScaleTarget[thisx->params], this->actor.world.rot.z, Rand_ZeroFloat(10.0f) + 20.0f); } @@ -490,17 +490,17 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { if (thisx->params != CLEAR_TAG_POP) { pos.y = this->actor.world.pos.y; for (i = 0; i < 18; i++) { - vel.x = sinf(i * (33.0f / 40.0f)) * i * .5f; - vel.z = cosf(i * (33.0f / 40.0f)) * i * .5f; - vel.y = Rand_ZeroFloat(8.0f) + 7.0f; + velocity.x = sinf(i * (33.0f / 40.0f)) * i * .5f; + velocity.z = cosf(i * (33.0f / 40.0f)) * i * .5f; + velocity.y = Rand_ZeroFloat(8.0f) + 7.0f; - vel.x += Rand_CenteredFloat(0.5f); - vel.z += Rand_CenteredFloat(0.5f); + velocity.x += Rand_CenteredFloat(0.5f); + velocity.z += Rand_CenteredFloat(0.5f); accel.x = 0.0f; accel.y = -1.0f; accel.z = 0.0f; - EnClearTag_CreateDebrisEffect(this, &pos, &vel, &accel, + EnClearTag_CreateDebrisEffect(this, &pos, &velocity, &accel, sDebrisScale[thisx->params] + Rand_ZeroFloat(sDebrisScale[thisx->params]), this->actor.floorHeight); @@ -514,11 +514,11 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { lightRayMaxScale = sLightRayMaxScale[thisx->params] + Rand_ZeroFloat(sLightRayMaxScale[thisx->params]); Matrix_RotateYF(Rand_ZeroFloat(2 * M_PI), MTXMODE_NEW); Matrix_RotateXFApply(Rand_ZeroFloat(2 * M_PI)); - Matrix_MultVecZ(lightRayMaxScale, &vel); - accel.x = vel.x * -0.03f; - accel.y = vel.y * -0.03f; - accel.z = vel.z * -0.03f; - EnClearTag_CreateLightRayEffect(this, &pos, &vel, &accel, + Matrix_MultVecZ(lightRayMaxScale, &velocity); + accel.x = velocity.x * -0.03f; + accel.y = velocity.y * -0.03f; + accel.z = velocity.z * -0.03f; + EnClearTag_CreateLightRayEffect(this, &pos, &velocity, &accel, sLightRayScale[thisx->params] + Rand_ZeroFloat(sLightRayScale[thisx->params] * 0.5f), sLightRayMaxScaleTarget[thisx->params], Rand_ZeroFloat(10.0f) + 20.0f); diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index bdd60af09d..6c61680cd3 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -489,7 +489,7 @@ void EnCrow_UpdateDamage(EnCrow* this, PlayState* play) { } void EnCrow_Update(Actor* thisx, PlayState* play) { - f32 pad; + s32 pad; EnCrow* this = THIS; f32 height; f32 scale; diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index 45391eefc1..a70e7490af 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -470,7 +470,7 @@ void func_808BE294(EnDekunuts* this, s32 arg1) { Animation_MorphToPlayOnce(&this->skelAnime, &gDekuScrubDamageAnim, -3.0f); if (this->actor.params == ENDEKUNUTS_GET_FF00_0) { this->actor.speed = 10.0f; - if (arg1 != 0) { + if (arg1) { func_800BE504(&this->actor, &this->collider); } } @@ -511,7 +511,7 @@ void func_808BE3FC(EnDekunuts* this, PlayState* play) { if (this->actor.params == ENDEKUNUTS_GET_FF00_1) { func_808BDCF0(this); } else if (this->actor.colChkInfo.health == 0) { - func_808BE294(this, 0); + func_808BE294(this, false); } else { this->actor.world.rot.y = this->actor.shape.rot.y; func_808BDF60(this); @@ -618,7 +618,7 @@ void func_808BE73C(EnDekunuts* this, PlayState* play) { this->drawDmgEffScale = 0.55f; } - func_808BE294(this, 1); + func_808BE294(this, true); } else if (this->actor.params == ENDEKUNUTS_GET_FF00_0) { func_808BDE7C(this); } @@ -632,7 +632,7 @@ void func_808BE73C(EnDekunuts* this, PlayState* play) { } else if (this->actor.colChkInfo.health != 0) { this->actor.colChkInfo.health = 0; Enemy_StartFinishingBlow(play, &this->actor); - func_808BE294(this, 0); + func_808BE294(this, false); } } } diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index 2955c2c076..de02c52980 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -487,8 +487,8 @@ s32 func_80B3D974(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4, s32 ar Matrix_Get(&sp2C); Matrix_MtxFToYXZRot(&sp2C, &sp6C, false); *arg2 = sp74; - if (arg4 == 0) { - if (arg5 != 0) { + if (!arg4) { + if (arg5) { sp6C.z = arg0; sp6C.y = arg1; } @@ -509,17 +509,18 @@ void EnDnp_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void EnDnp_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnDnp* this = THIS; - s32 phi_v1 = 1; + s32 phi_v1; s32 phi_v0; if (this->unk_322 & 0x10) { - phi_v0 = 0; + phi_v1 = true; + phi_v0 = false; } else { - phi_v1 = 0; + phi_v1 = false; if (this->unk_322 & 0x40) { - phi_v0 = 1; + phi_v0 = true; } else { - phi_v0 = 0; + phi_v0 = false; } } diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index a76f95fad0..0b1076a275 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -570,8 +570,8 @@ s32 func_8092D954(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4, s32 ar Matrix_MtxFToYXZRot(&sp2C, &sp6C, false); *arg2 = sp74; - if (arg4 == 0) { - if (arg5 != 0) { + if (!arg4) { + if (arg5) { sp6C.z = arg0; sp6C.y = arg1; } @@ -602,14 +602,14 @@ void EnDns_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, s32 phi_v0; if (this->unk_2C6 & 0x10) { - phi_v1 = 1; - phi_v0 = 0; + phi_v1 = true; + phi_v0 = false; } else { - phi_v1 = 0; + phi_v1 = false; if (this->unk_2C6 & 0x20) { - phi_v0 = 1; + phi_v0 = true; } else { - phi_v0 = 0; + phi_v0 = false; } } diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index f4b223813e..644a7c8236 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -146,20 +146,20 @@ Actor* func_8091D944(EnFish* this, PlayState* play) { f32 distSq; Actor* retActor = NULL; f32 minDistSq = FLT_MAX; - Actor* foundActor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; + Actor* actorIter = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].first; - while (foundActor != NULL) { - if ((foundActor->id == ACTOR_EN_FISH) && (foundActor->params == ENFISH_2) && - (foundActor->room == this->actor.room)) { - distSq = Math3D_Vec3fDistSq(&foundActor->world.pos, &this->actor.world.pos); + while (actorIter != NULL) { + if ((actorIter->id == ACTOR_EN_FISH) && (actorIter->params == ENFISH_2) && + (actorIter->room == this->actor.room)) { + distSq = Math3D_Vec3fDistSq(&actorIter->world.pos, &this->actor.world.pos); if (retActor == NULL) { - retActor = foundActor; + retActor = actorIter; minDistSq = distSq; } else if (distSq < minDistSq) { minDistSq = distSq; } } - foundActor = foundActor->next; + actorIter = actorIter->next; } return retActor; diff --git a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c index 03c44b0181..723984249f 100644 --- a/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c +++ b/src/overlays/actors/ovl_En_Fish2/z_en_fish2.c @@ -253,7 +253,7 @@ void func_80B287F4(EnFish2* this, s32 arg1) { this->unk_2C4++; } this->unk_338 = 440.0f - this->unk_2C4; - if (arg1 == 0) { + if (!arg1) { this->unk_338 = 410.0f - this->unk_2C4; } Math_ApproachF(&this->unk_350->speed, (D_80B2B380[0] - this->unk_330) * this->unk_338, 0.1f, 0.4f); @@ -270,7 +270,7 @@ s32 func_80B288E8(EnFish2* this, Vec3f vec, s32 arg2) { f32 dist = sqrtf(SQ(temp_f2) + SQ(temp_f12) + SQ(temp_f14)); f32 phi_f2; - if (arg2 == 0) { + if (!arg2) { phi_f2 = 40.0f; } else { phi_f2 = this->unk_330 * 2000.0f; @@ -492,9 +492,9 @@ void func_80B29250(EnFish2* this, PlayState* play) { this->actor.speed = 2.0f; } - func_80B287F4(this, 0); + func_80B287F4(this, false); func_80B289DC(this, play); - if (func_80B288E8(this, this->unk_300, 0) && + if (func_80B288E8(this, this->unk_300, false) && (((this->unk_2C8 == 0) && (D_80B2B2E4 == 1)) || (this->unk_2C8 != 0))) { Math_Vec3f_Copy(&this->unk_30C, &this->unk_350->world.pos); func_80B2938C(this); @@ -512,7 +512,7 @@ void func_80B293C4(EnFish2* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; if (!func_80B28478(this)) { - func_80B287F4(this, 1); + func_80B287F4(this, true); Math_ApproachF(&this->actor.speed, (*D_80B2B380 - this->unk_330) * 1000.0f, 0.3f, 0.3f); if (this->actor.speed > 3.0f) { @@ -530,7 +530,7 @@ void func_80B293C4(EnFish2* this, PlayState* play) { } } else { func_80B289DC(this, play); - if (func_80B288E8(this, this->unk_318, 1)) { + if (func_80B288E8(this, this->unk_318, true)) { func_80B2951C(this); } } @@ -797,7 +797,7 @@ void func_80B29EE4(EnFish2* this, PlayState* play) { Math_Vec3f_Copy(&sp2C, &this->unk_350->world.pos); this->unk_34A = Math_Vec3f_Yaw(&this->actor.world.pos, &sp2C); this->unk_348 = Math_Vec3f_Pitch(&this->actor.world.pos, &sp2C); - if (func_80B288E8(this, this->unk_300, 0)) { + if (func_80B288E8(this, this->unk_300, false)) { Math_Vec3f_Copy(&this->unk_30C, &this->unk_350->world.pos); func_80B2938C(this); } diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 8b5144991d..4841b18920 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -46,7 +46,7 @@ typedef enum { typedef struct { /* 0x00 */ Vec3f pos; - /* 0x0C */ Vec3f vel; + /* 0x0C */ Vec3f velocity; /* 0x18 */ Vec3f accel; /* 0x24 */ u8 type; /* 0x25 */ u8 timer; @@ -225,8 +225,8 @@ u8 D_8090CCFC = 0; s32 D_8090CD00 = 0; s16 D_8090CD04 = 0; u8 D_8090CD08 = 0; -u8 D_8090CD0C = 0; -u8 D_8090CD10 = 0; +u8 D_8090CD0C = false; +u8 D_8090CD10 = false; s16 D_8090CD14 = 0; Vec3f sFishMouthOffset = { 500.0f, 500.0f, 0.0f }; u8 D_8090CD24 = 0; @@ -457,7 +457,7 @@ void EnFishing_SpawnRipple(Vec3f* projectedPos, FishingEffect* effect, Vec3f* po if (effect->type == FS_EFF_NONE) { effect->type = FS_EFF_RIPPLE; effect->pos = *pos; - effect->vel = sZeroVec; + effect->velocity = sZeroVec; effect->accel = sZeroVec; effect->unk_30 = arg3 * 0.0025f; effect->unk_34 = arg4 * 0.0025f; @@ -479,7 +479,7 @@ void EnFishing_SpawnRipple(Vec3f* projectedPos, FishingEffect* effect, Vec3f* po } } -void EnFishing_SpawnDustSplash(Vec3f* projectedPos, FishingEffect* effect, Vec3f* pos, Vec3f* vel, f32 scale) { +void EnFishing_SpawnDustSplash(Vec3f* projectedPos, FishingEffect* effect, Vec3f* pos, Vec3f* velocity, f32 scale) { s16 i; Vec3f accel = { 0.0f, -1.0f, 0.0f }; @@ -492,7 +492,7 @@ void EnFishing_SpawnDustSplash(Vec3f* projectedPos, FishingEffect* effect, Vec3f (effect->type == FS_EFF_RAIN_RIPPLE) || (effect->type == FS_EFF_RAIN_SPLASH)) { effect->type = FS_EFF_DUST_SPLASH; effect->pos = *pos; - effect->vel = *vel; + effect->velocity = *velocity; effect->accel = accel; effect->alpha = 100 + Rand_ZeroFloat(100.0f); effect->unk_30 = scale; @@ -515,7 +515,7 @@ void EnFishing_SpawnWaterDust(Vec3f* projectedPos, FishingEffect* effect, Vec3f* if (effect->type == FS_EFF_NONE) { effect->type = FS_EFF_WATER_DUST; effect->pos = *pos; - effect->vel = sZeroVec; + effect->velocity = sZeroVec; effect->accel = accel; effect->alpha = 255; effect->timer = Rand_ZeroFloat(100.0f); @@ -530,7 +530,7 @@ void EnFishing_SpawnWaterDust(Vec3f* projectedPos, FishingEffect* effect, Vec3f* void EnFishing_SpawnBubble(Vec3f* projectedPos, FishingEffect* effect, Vec3f* pos, f32 scale, u8 arg4) { s16 i; - Vec3f vel = { 0.0f, 1.0f, 0.0f }; + Vec3f velocity = { 0.0f, 1.0f, 0.0f }; if ((projectedPos != NULL) && ((projectedPos->z > 500.0f) || (projectedPos->z < 0.0f))) { return; @@ -540,7 +540,7 @@ void EnFishing_SpawnBubble(Vec3f* projectedPos, FishingEffect* effect, Vec3f* po if (effect->type == FS_EFF_NONE) { effect->type = FS_EFF_BUBBLE; effect->pos = *pos; - effect->vel = vel; + effect->velocity = velocity; effect->accel = sZeroVec; effect->timer = Rand_ZeroFloat(100.0f); effect->unk_30 = scale; @@ -554,11 +554,11 @@ void EnFishing_SpawnBubble(Vec3f* projectedPos, FishingEffect* effect, Vec3f* po void EnFishing_SpawnRainDrop(FishingEffect* effect, Vec3f* pos, Vec3f* rot) { s16 i; - Vec3f velSrc; + Vec3f velocity; - velSrc.x = 0.0f; - velSrc.y = 0.0f; - velSrc.z = 300.0f; + velocity.x = 0.0f; + velocity.y = 0.0f; + velocity.z = 300.0f; effect += 30; @@ -572,7 +572,7 @@ void EnFishing_SpawnRainDrop(FishingEffect* effect, Vec3f* pos, Vec3f* rot) { effect->unk_3C = rot->z; Matrix_RotateYF(rot->y, MTXMODE_NEW); Matrix_RotateXFApply(rot->x); - Matrix_MultVec3f(&velSrc, &effect->vel); + Matrix_MultVec3f(&velocity, &effect->velocity); break; } @@ -808,7 +808,7 @@ void EnFishing_Init(Actor* thisx, PlayState* play2) { s16 i; FishingGroupFish* fish; - D_809171C8 = 0; + D_809171C8 = false; sFishingMain = this; Collider_InitJntSph(play, &sFishingMain->collider); Collider_SetJntSph(play, &sFishingMain->collider, thisx, &sJntSphInit, sFishingMain->colliderElements); @@ -865,10 +865,10 @@ void EnFishing_Init(Actor* thisx, PlayState* play2) { D_809171D1 = (HIGH_SCORE(HS_FISHING) & 0xFF0000) >> 0x10; if ((D_809171D1 & 7) == 7) { play->roomCtx.unk7A[0] = 90; - D_809171CA = 1; + D_809171CA = true; } else { play->roomCtx.unk7A[0] = 40; - D_809171CA = 0; + D_809171CA = false; } if ((D_809171D1 & 7) == 6) { @@ -1001,10 +1001,10 @@ void EnFishing_UpdateEffects(FishingEffect* effect, PlayState* play) { for (i = 0; i < EFFECT_COUNT; i++) { if (effect->type) { effect->timer++; - effect->pos.x += effect->vel.x; - effect->pos.y += effect->vel.y; - effect->pos.z += effect->vel.z; - effect->vel.y += effect->accel.y; + effect->pos.x += effect->velocity.x; + effect->pos.y += effect->velocity.y; + effect->pos.z += effect->velocity.z; + effect->velocity.y += effect->accel.y; if (effect->type == FS_EFF_RIPPLE) { Math_ApproachF(&effect->unk_30, effect->unk_34, 0.2f, effect->unk_38); @@ -1029,7 +1029,7 @@ void EnFishing_UpdateEffects(FishingEffect* effect, PlayState* play) { if (effect->pos.y > (WATER_SURFACE_Y(play) - 5.0f)) { effect->accel.y = 0.0f; - effect->vel.y = 0.0f; + effect->velocity.y = 0.0f; effect->alpha -= 5; } @@ -1053,8 +1053,8 @@ void EnFishing_UpdateEffects(FishingEffect* effect, PlayState* play) { } } } else if (effect->type == FS_EFF_DUST_SPLASH) { - if (effect->vel.y < -20.0f) { - effect->vel.y = -20.0f; + if (effect->velocity.y < -20.0f) { + effect->velocity.y = -20.0f; effect->accel.y = 0.0f; } @@ -1062,6 +1062,7 @@ void EnFishing_UpdateEffects(FishingEffect* effect, PlayState* play) { effect->type = FS_EFF_NONE; if (Rand_ZeroOne() < 0.5f) { Vec3f pos = effect->pos; + pos.y = WATER_SURFACE_Y(play); EnFishing_SpawnRipple(NULL, play->specialEffects, &pos, 40.0f, 110.0f, 150, 90); } @@ -1080,14 +1081,14 @@ void EnFishing_UpdateEffects(FishingEffect* effect, PlayState* play) { effect->timer = 0; if (Rand_ZeroOne() < 0.75f) { effect->type = FS_EFF_RAIN_RIPPLE; - effect->vel = sZeroVec; + effect->velocity = sZeroVec; effect->unk_30 = 30 * 0.001f; } else { effect->type = FS_EFF_NONE; } } - effect->vel = sZeroVec; + effect->velocity = sZeroVec; } } else if (effect->type >= FS_EFF_RAIN_RIPPLE) { effect->unk_30 += (KREG(18) + 30) * 0.001f; @@ -1114,6 +1115,7 @@ void EnFishing_UpdateEffects(FishingEffect* effect, PlayState* play) { if ((effect->timer % 16) == 0) { Vec3f pos = effect->pos; + pos.y = WATER_SURFACE_Y(play); EnFishing_SpawnRipple(NULL, play->specialEffects, &pos, 30.0f, 300.0f, 150, 90); } @@ -1545,7 +1547,7 @@ void EnFishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookI Matrix_Push(); - if ((D_8090CD14 == 3) && ((pos->y > WATER_SURFACE_Y(play)) || ((D_8090CD0C != 0) && hookIndex))) { + if ((D_8090CD14 == 3) && ((pos->y > WATER_SURFACE_Y(play)) || (D_8090CD0C && ((u32)hookIndex != 0)))) { offsetY = 0.0f; } else if (pos->y < WATER_SURFACE_Y(play)) { offsetY = -1.0f; @@ -1590,12 +1592,12 @@ void EnFishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookI gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, gFishingLureHookDL); - if ((hookIndex == 1) && (D_8090CD0C != 0)) { + if ((hookIndex == 1) && D_8090CD0C) { Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); Matrix_Translate(250.0f, 0.0f, -1400.0f, MTXMODE_APPLY); Matrix_Push(); - if (D_8090CD10 != 0) { + if (D_8090CD10) { FishingEffect* effect = play->specialEffects; MtxF mf; @@ -1603,12 +1605,12 @@ void EnFishing_DrawLureHook(PlayState* play, Vec3f* pos, Vec3f* refPos, u8 hookI Matrix_Get(&mf); Matrix_MtxFToYXZRot(&mf, &sEffOwnerHatRot, false); - D_8090CD10 = 0; - D_8090CD0C = 0; + D_8090CD10 = false; + D_8090CD0C = false; effect->type = FS_EFF_OWNER_HAT; effect->unk_2C = 0; - effect->vel = sZeroVec; + effect->velocity = sZeroVec; effect->accel = sZeroVec; } @@ -1824,7 +1826,7 @@ void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) gDPSetCombineMode(POLY_XLU_DISP++, G_CC_PRIMITIVE, G_CC_PRIMITIVE); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 55); - if ((D_8090CD14 == 4) && ((D_80917274 != 0) || (D_80917206 != 2))) { + if ((D_8090CD14 == 4) && (D_80917274 || (D_80917206 != 2))) { f32 rx; f32 ry; f32 dist; @@ -1855,13 +1857,9 @@ void EnFishing_DrawLureAndLine(PlayState* play, Vec3f* linePos, Vec3f* lineRot) f32 rx; f32 ry; f32 dist; - f32 dx; - f32 dy; - f32 dz; - - dx = D_80917218.x - (linePos + i)->x; - dy = D_80917218.y - (linePos + i)->y; - dz = D_80917218.z - (linePos + i)->z; + f32 dx = D_80917218.x - (linePos + i)->x; + f32 dy = D_80917218.y - (linePos + i)->y; + f32 dz = D_80917218.z - (linePos + i)->z; ry = Math_FAtan2F(dx, dz); dist = sqrtf(SQ(dx) + SQ(dz)); @@ -1929,7 +1927,7 @@ void EnFishing_DrawRod(PlayState* play) { } else { s16 target = 0; - if ((D_8090CD14 == 4) && (D_80917274 != 0)) { + if ((D_8090CD14 == 4) && D_80917274) { target = Math_SinS(D_809171FE * 25600) * 1500.0f; } else { Math_ApproachZeroF(&D_8090CD40, 0.1f, 10.0f); @@ -2195,10 +2193,10 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { D_80917238.y += D_80917248.y; D_80917238.z += D_80917248.z; - if (CHECK_BTN_ALL(input->cur.button, BTN_A) || (D_8090CD0C != 0)) { + if (CHECK_BTN_ALL(input->cur.button, BTN_A) || D_8090CD0C) { D_80917238.x *= 0.9f; D_80917238.z *= 0.9f; - if (D_8090CD0C == 0) { + if (!D_8090CD0C) { Audio_PlaySfx(NA_SE_IT_FISHING_REEL_HIGH - SFX_FLAG); } } @@ -2336,15 +2334,15 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { break; case 3: { - f32 pad; + s32 pad; f32 sp70; Vec3f sp64; Vec3f sp58; D_80911F20 = 0; - if ((D_8090CD0C != 0) && ((SQ(sLurePos.x) + SQ(sLurePos.z)) < SQ(500.0f))) { - D_8090CD10 = 1; + if (D_8090CD0C && ((SQ(sLurePos.x) + SQ(sLurePos.z)) < SQ(500.0f))) { + D_8090CD10 = true; } player->unk_B28 = 2; @@ -2381,7 +2379,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { sp70 = 0.5f; } - if (D_8090CD0C != 0) { + if (D_8090CD0C) { if (sp70 > 0.3f) { sp70 = 0.3f; } @@ -2594,7 +2592,7 @@ void EnFishing_UpdateLure(EnFishing* this, PlayState* play) { } if ((D_809171FE & 0x1F) == 0) { - if ((D_80917274 != 0) || (D_80917206 != 2)) { + if (D_80917274 || (D_80917206 != 2)) { D_8090CD24 = 5; } } @@ -2620,7 +2618,7 @@ s32 func_809033F0(EnFishing* this, PlayState* play, u8 ignorePosCheck) { s16 count; f32 scale; Vec3f pos; - Vec3f vel; + Vec3f velocity; f32 speedXZ; f32 angle; @@ -2643,16 +2641,16 @@ s32 func_809033F0(EnFishing* this, PlayState* play, u8 ignorePosCheck) { speedXZ = (Rand_ZeroFloat(1.5f) + 0.5f) * scale; angle = Rand_ZeroFloat(6.28f); - vel.x = sinf(angle) * speedXZ; - vel.z = cosf(angle) * speedXZ; - vel.y = (Rand_ZeroFloat(3.0f) + 3.0f) * scale; + velocity.x = sinf(angle) * speedXZ; + velocity.z = cosf(angle) * speedXZ; + velocity.y = (Rand_ZeroFloat(3.0f) + 3.0f) * scale; pos = this->actor.world.pos; - pos.x += vel.x * 3.0f; + pos.x += velocity.x * 3.0f; pos.y = WATER_SURFACE_Y(play); - pos.z += vel.z * 3.0f; + pos.z += velocity.z * 3.0f; - EnFishing_SpawnDustSplash(&this->actor.projectedPos, play->specialEffects, &pos, &vel, + EnFishing_SpawnDustSplash(&this->actor.projectedPos, play->specialEffects, &pos, &velocity, (Rand_ZeroFloat(0.02f) + 0.025f) * scale); } @@ -2671,7 +2669,7 @@ void func_809036BC(EnFishing* this, PlayState* play) { s16 i; f32 scale; Vec3f pos; - Vec3f vel; + Vec3f velocity; f32 speedXZ; f32 angle; @@ -2690,16 +2688,16 @@ void func_809036BC(EnFishing* this, PlayState* play) { speedXZ = (Rand_ZeroFloat(1.5f) + 0.5f) * scale; angle = Rand_ZeroFloat(6.28f); - vel.x = sinf(angle) * speedXZ; - vel.z = cosf(angle) * speedXZ; - vel.y = Rand_ZeroFloat(2.0f) + 2.0f; + velocity.x = sinf(angle) * speedXZ; + velocity.z = cosf(angle) * speedXZ; + velocity.y = Rand_ZeroFloat(2.0f) + 2.0f; pos = this->actor.world.pos; - pos.x += (vel.x * 3.0f); - pos.y += (vel.y * 3.0f); - pos.z += (vel.z * 3.0f); + pos.x += (velocity.x * 3.0f); + pos.y += (velocity.y * 3.0f); + pos.z += (velocity.z * 3.0f); - EnFishing_SpawnDustSplash(&this->actor.projectedPos, play->specialEffects, &pos, &vel, + EnFishing_SpawnDustSplash(&this->actor.projectedPos, play->specialEffects, &pos, &velocity, (Rand_ZeroFloat(0.02f) + 0.025f) * scale); } } @@ -2715,7 +2713,7 @@ void func_809038A4(EnFishing* this, Input* input) { sp24 = SQ(sp34.x) + SQ(sp34.y) + SQ(sp34.z); - if ((D_8090CD14 == 3) && (this->unk_19A == 0) && (D_8090CD0C == 0)) { + if ((D_8090CD14 == 3) && (this->unk_19A == 0) && !D_8090CD0C) { Matrix_RotateYF(BINANG_TO_RAD_ALT(-this->actor.shape.rot.y), MTXMODE_NEW); Matrix_MultVec3f(&sp34, &sp28); @@ -2745,7 +2743,7 @@ void func_809038A4(EnFishing* this, Input* input) { } } } - } else if ((D_8090CD14 == 4) && (D_80917274 != 0) && (sp24 < SQ(100.0f)) && (this->unk_150 >= 10)) { + } else if ((D_8090CD14 == 4) && D_80917274 && (sp24 < SQ(100.0f)) && (this->unk_150 >= 10)) { this->unk_152 = 0; this->unk_150 = 1; this->unk_19C = 1000; @@ -2773,7 +2771,7 @@ void func_80903C60(EnFishing* this, u8 arg1) { temp = 2.0f * this->unk_1A4; } - if (arg1 == 0) { + if (!arg1) { if (temp >= 50) { sfxId = NA_SE_EV_DIVE_INTO_WATER; } else if (temp >= 40) { @@ -3311,7 +3309,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { multiplier *= 1.75f; } else if ((CURRENT_TIME >= CLOCK_TIME(5, 0)) && (CURRENT_TIME <= CLOCK_TIME(7, 0))) { multiplier *= 1.5f; - } else if (D_809171CA != 0) { + } else if (D_809171CA) { multiplier *= 1.5f; } else if ((u8)D_8090CCD0 != 0) { multiplier *= 3.0f; @@ -3417,7 +3415,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { s16 phi_v0; if (func_809033F0(this, play, false)) { - func_80903C60(this, 0); + func_80903C60(this, false); } this->unk_150 = 5; @@ -3460,7 +3458,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { Rumble_Override(0.0f, 180, phi_v0 * 3, 10); } - D_80917274 = 0; + D_80917274 = false; D_80917266 = 100; D_809171D4 = 0; } @@ -3506,7 +3504,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { Rumble_Override(0.0f, 180, 90, 10); } - D_80917274 = 0; + D_80917274 = false; D_80917266 = 100; D_809171D4 = 0; } @@ -3541,7 +3539,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_190 = 1.7f; this->unk_194 = 7000.0f; - D_80917274 = 1; + D_80917274 = true; SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_ENEMY | 0x800 | SEQ_FLAG_ASYNC); D_809171F6 = 0; @@ -3646,7 +3644,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { Math_ApproachF(&this->actor.speed, 7.5f, 1.0f, 1.0f); Math_ApproachS(&this->unk_168, 0x4E20, 2, 0xFA0); } else { - if ((D_80917274 == 0) && (D_80917206 == 2)) { + if (!D_80917274 && (D_80917206 == 2)) { this->unk_188 = 1.0f; this->unk_18C = 2000.0f; Math_ApproachF(&this->actor.speed, 3.0f, 1.0f, 0.2f); @@ -3694,7 +3692,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } } - if (D_809171C8 != 0) { + if (D_809171C8) { D_8091726C = 0.0f; } @@ -3739,12 +3737,12 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } } - if ((D_8090CD14 < 3) || ((D_809171C8 != 0) && (D_809171D4 > 50)) || (D_809171D4 >= 6000) || - ((D_80917272 == 0) && (D_80917274 == 0)) || (D_80917266 == 0) || + if ((D_8090CD14 < 3) || (D_809171C8 && (D_809171D4 > 50)) || (D_809171D4 >= 6000) || + ((D_80917272 == 0) && !D_80917274) || (D_80917266 == 0) || (((D_809171FE & 0x7F) == 0) && (Rand_ZeroOne() < 0.05f) && (D_80917206 != 2))) { // Assignment of OoT's D_80B7A67C here removed in MM - if ((D_80917272 == 0) && (D_80917274 == 0)) { + if ((D_80917272 == 0) && !D_80917274) { // Assignment of OoT's D_80B7E086 here removed in MM if (((sLinkAge == 1) && (HIGH_SCORE(HS_FISHING) & 0x400)) || ((sLinkAge != 1) && (HIGH_SCORE(HS_FISHING) & 0x800))) { @@ -3786,7 +3784,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->unk_194 = 5000.0f; if (this->actor.world.pos.y <= WATER_SURFACE_Y(play)) { - func_80903C60(this, 1); + func_80903C60(this, true); func_809033F0(this, play, true); } goto case_6; @@ -3880,6 +3878,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { } else { f32 temp1 = D_8090CCF0; s16 temp2 = D_809171D0; + D_8090CCF0 = this->unk_1A4; D_809171D0 = this->unk_148; D_809171D2 = D_80917206; @@ -3902,6 +3901,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if (play->msgCtx.choiceIndex != 0) { f32 temp1 = D_8090CCF0; s16 temp2 = D_809171D0; + D_8090CCF0 = this->unk_1A4; D_809171D2 = D_80917206; this->unk_1A4 = temp1; @@ -4034,8 +4034,6 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->actor.world.pos.y += (this->unk_17C * 1.5f); - if (1) {} - if (this->unk_14A != 0) { this->unk_160 = this->unk_14C; this->unk_14A--; @@ -4070,7 +4068,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { if ((this->unk_150 != -1) && (this->unk_150 != -2) && (this->unk_150 != -25)) { if ((this->actor.world.pos.y > WATER_SURFACE_Y(play)) && (this->actor.prevPos.y <= WATER_SURFACE_Y(play))) { func_809033F0(this, play, true); - func_80903C60(this, 1); + func_80903C60(this, true); this->unk_17C = this->actor.velocity.y; this->actor.velocity.y = 0.0f; this->unk_162 = TRUNCF_BINANG(Rand_CenteredFloat(0x8000)); @@ -4082,7 +4080,7 @@ void EnFishing_UpdateFish(Actor* thisx, PlayState* play2) { this->actor.world.rot.x = -0xFA0; func_809033F0(this, play, true); this->unk_1CA = 20; - func_80903C60(this, 0); + func_80903C60(this, false); } } @@ -4700,7 +4698,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { } else { this->actor.textId = 0x407B; } - } else if (D_8090CD0C == 0) { + } else if (!D_8090CD0C) { this->actor.textId = 0x4084; } else { this->actor.textId = 0x4097; @@ -4810,7 +4808,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { break; case 10: - if (D_8090CD0C != 0) { + if (D_8090CD0C) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); @@ -4818,7 +4816,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { case 0: Message_ContinueTextbox(play, 0x40B2); D_8090CD08 = 1; - D_8090CD0C = 0; + D_8090CD0C = false; this->unk_154 = 20; break; @@ -4864,7 +4862,7 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { D_8090CD00 = 30000; Message_ContinueTextbox(play, 0x4088); } else { - if (D_809171CA == 0) { + if (!D_809171CA) { if (D_809171D6 == 0) { D_809171D6++; } @@ -5018,9 +5016,9 @@ void EnFishing_HandleOwnerDialog(EnFishing* this, PlayState* play) { case 22: if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { this->unk_154 = 0; - if (D_8090CD0C != 0) { + if (D_8090CD0C) { D_8090CD08 = 1; - D_8090CD0C = 0; + D_8090CD0C = false; } D_809171FC = 0; play->interfaceCtx.unk_27E = 0; @@ -5125,14 +5123,14 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { D_8090CD04--; } - if ((D_8090CD0C == 0) && (D_80917206 != 2) && (D_8090CD14 > 0) && (D_8090CD08 == 1) && (D_8090CD04 == 0)) { + if (!D_8090CD0C && (D_80917206 != 2) && (D_8090CD14 > 0) && (D_8090CD08 == 1) && (D_8090CD04 == 0)) { f32 dx = sOwnerHeadPos.x - sLurePos.x; f32 dy = sOwnerHeadPos.y - sLurePos.y; f32 dz = sOwnerHeadPos.z - sLurePos.z; if ((sqrtf(SQ(dx) + SQ(dy) + SQ(dz)) < 25.0f)) { D_8090CD08 = 0; - D_8090CD0C = 1; + D_8090CD0C = true; Message_StartTextbox(play, 0x4087, NULL); } } @@ -5475,7 +5473,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { if (sSubCamEye.y <= (WATER_SURFACE_Y(play) + 1.0f)) { Environment_EnableUnderwaterLights(play, 1); - if (D_809171CA != 0) { + if (D_809171CA) { play->envCtx.adjLightSettings.fogNear = -178; } else { play->envCtx.adjLightSettings.fogNear = -46; @@ -5504,22 +5502,23 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { for (i = 0; i < 10; i++) { Vec3f pos; - Vec3f vel; + Vec3f velocity; f32 speedXZ; f32 angle; speedXZ = Rand_ZeroFloat(1.5f) + 1.5f; angle = Rand_ZeroFloat(6.28f); - vel.x = sinf(angle) * speedXZ; - vel.z = cosf(angle) * speedXZ; - vel.y = Rand_ZeroFloat(3.0f) + 2.0f; + velocity.x = sinf(angle) * speedXZ; + velocity.z = cosf(angle) * speedXZ; + velocity.y = Rand_ZeroFloat(3.0f) + 2.0f; pos = player->actor.world.pos; - pos.x += 2.0f * vel.x; + pos.x += 2.0f * velocity.x; pos.y = WATER_SURFACE_Y(play); - pos.z += 2.0f * vel.z; - EnFishing_SpawnDustSplash(NULL, play->specialEffects, &pos, &vel, Rand_ZeroFloat(0.01f) + 0.020000001f); + pos.z += 2.0f * velocity.z; + EnFishing_SpawnDustSplash(NULL, play->specialEffects, &pos, &velocity, + Rand_ZeroFloat(0.01f) + 0.020000001f); } } diff --git a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c index 43331cf575..0b867203b3 100644 --- a/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c +++ b/src/overlays/actors/ovl_En_Gb2/z_en_gb2.c @@ -95,24 +95,22 @@ void func_80B0F5E0(EnGb2* this, PlayState* play) { } s32 func_80B0F660(EnGb2* this, PlayState* play) { - Actor* temp_v0; - Actor* phi_s0 = NULL; + Actor* actorIter = NULL; while (true) { - temp_v0 = SubS_FindActor(play, phi_s0, ACTORCAT_NPC, ACTOR_EN_GB2); - if (temp_v0 == NULL) { + actorIter = SubS_FindActor(play, actorIter, ACTORCAT_NPC, ACTOR_EN_GB2); + if (actorIter == NULL) { break; } - if ((EnGb2*)temp_v0 != this) { + if ((EnGb2*)actorIter != this) { return true; } - temp_v0 = temp_v0->next; - if (temp_v0 == NULL) { + if (actorIter->next == NULL) { break; } - phi_s0 = temp_v0; + actorIter = actorIter->next; }; return false; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index cc4519884c..1616111939 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -146,30 +146,29 @@ static AnimationInfoS sAnimationInfo[ENGM_ANIM_MAX] = { { &object_in2_Anim_00B990, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENGM_ANIM_12 }; -Actor* func_8094DEE0(EnGm* this, PlayState* play, u8 arg2, s16 arg3) { - Actor* foundActor = NULL; - Actor* actor; +Actor* EnGm_FindActor(EnGm* this, PlayState* play, u8 actorCategory, s16 actorId) { + Actor* actorIter = NULL; while (true) { - actor = SubS_FindActor(play, foundActor, arg2, arg3); - foundActor = actor; - if (actor == NULL) { + actorIter = SubS_FindActor(play, actorIter, actorCategory, actorId); + + if (actorIter == NULL) { break; } - if ((this != (EnGm*)foundActor) && (foundActor->update != NULL)) { + if ((this != (EnGm*)actorIter) && (actorIter->update != NULL)) { break; } - actor = actor->next; - if (actor == NULL) { - foundActor = NULL; + if (actorIter->next == NULL) { + actorIter = NULL; break; } - foundActor = actor; + + actorIter = actorIter->next; } - return foundActor; + return actorIter; } EnDoor* func_8094DF90(PlayState* play, s32 arg1) { @@ -509,8 +508,8 @@ s32 func_8094EA34(EnGm* this, PlayState* play) { Actor* al; Actor* toto; - al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); - toto = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); + al = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AL); + toto = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); if ((al == NULL) || (al->update == NULL) || (toto == NULL) || (toto->update == NULL)) { this->unk_3E0++; return true; @@ -712,7 +711,7 @@ Actor* func_8094F074(EnGm* this, PlayState* play) { switch (this->unk_258) { case 1: - actor = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL); + actor = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL); break; case 2: @@ -720,7 +719,7 @@ Actor* func_8094F074(EnGm* this, PlayState* play) { break; case 3: - actor = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_TAB); + actor = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_TAB); break; default: @@ -817,8 +816,8 @@ s32 func_8094F4EC(EnGm* this, PlayState* play) { s32 func_8094F53C(EnGm* this, PlayState* play) { Player* player = GET_PLAYER(play); u16 sp32 = play->msgCtx.currentTextId; - Actor* al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); - Actor* toto = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); + Actor* al = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AL); + Actor* toto = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); if (player->stateFlags1 & (PLAYER_STATE1_40 | PLAYER_STATE1_400)) { this->unk_3A4 |= 0x400; @@ -902,7 +901,7 @@ s32 func_8094F53C(EnGm* this, PlayState* play) { return false; } -s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput, u8 arg3, s16 arg4) { +s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput, u8 actorCategory, s16 actorId) { u8 pathIndex = ENGM_GET_PATH_INDEX(&this->actor); Vec3s* sp48; Vec3f sp3C; @@ -912,7 +911,7 @@ s32 func_8094F7D0(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput, u s32 ret = false; this->timePath = NULL; - actor = func_8094DEE0(this, play, arg3, arg4); + actor = EnGm_FindActor(this, play, actorCategory, actorId); if (D_80951A0C[scheduleOutput->result] >= 0) { this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80951A0C[scheduleOutput->result]); @@ -1062,7 +1061,7 @@ s32 func_8094FE10(EnGm* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; Actor* al; - al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); + al = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AL); if (func_8094F7D0(this, play, scheduleOutput, ACTORCAT_NPC, ACTOR_EN_TOTO) && (al != NULL) && (al->update != NULL)) { EnGm_ChangeAnim(this, play, ENGM_ANIM_11); @@ -1341,8 +1340,8 @@ s32 func_80950690(EnGm* this, PlayState* play) { switch (this->unk_258) { case 2: - al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); - toto = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); + al = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AL); + toto = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); if ((al != NULL) && (al->update != NULL) && (toto != NULL) && (toto->update != NULL) && !(player->stateFlags1 & PLAYER_STATE1_40)) { if (DECR(this->unk_3B8) == 0) { @@ -1542,7 +1541,7 @@ void func_80950DB8(EnGm* this, PlayState* play) { if (func_8010BF58(&this->actor, play, this->unk_264, this->unk_3E4, &this->unk_25C)) { SubS_SetOfferMode(&this->unk_3A4, SUBS_OFFER_MODE_ONSCREEN, SUBS_OFFER_MODE_MASK); - al = func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); + al = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AL); if ((this->unk_258 == 2) && (al != NULL) && (al->update != NULL)) { this->unk_268 = al; this->unk_3B8 = Rand_S16Offset(60, 60); @@ -1600,7 +1599,7 @@ void func_80950F2C(EnGm* this, PlayState* play) { void EnGm_Init(Actor* thisx, PlayState* play) { EnGm* this = THIS; - if (func_8094DEE0(this, play, ACTORCAT_NPC, ACTOR_EN_GM)) { + if (EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_GM)) { Actor_Kill(&this->actor); return; } 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 ae206c3480..f1f0ee365e 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -436,7 +436,7 @@ void EnGo_DrawSteam(EnGoEffect effect[ENGO_EFFECT_COUNT], PlayState* play2) { * @param maxFrames Maximum number of frames the effect will last. Actual lifetime will be 1/3 * maxFrames -> maxFrames * @param parentEffectType Type of the parent effect, determines which of the possible dust effects correspond */ -void EnGo_InitDust(EnGoEffect effect[ENGO_OTHER_EFFECT_COUNT], Vec3f pos, Vec3f accel, Vec3f vel, f32 scale, +void EnGo_InitDust(EnGoEffect effect[ENGO_OTHER_EFFECT_COUNT], Vec3f pos, Vec3f accel, Vec3f velocity, f32 scale, f32 deltaScale, s32 maxFrames, EnGoEffectType parentEffectType) { s32 i; @@ -451,7 +451,7 @@ void EnGo_InitDust(EnGoEffect effect[ENGO_OTHER_EFFECT_COUNT], Vec3f pos, Vec3f effect->alphaNumer = effect->alphaDenom; effect->pos = pos; effect->accel = accel; - effect->velocity = vel; + effect->velocity = velocity; effect->scaleXY = scale; effect->scaleXYDelta = deltaScale; break; diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c index 7e7913aee2..a254dc64ac 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -132,30 +132,28 @@ static AnimationInfoS sAnimationInfo[ENIG_ANIM_MAX] = { { &object_dai_Anim_0040E0, 1.0f, 0, -1, ANIMMODE_LOOP, -4 }, // ENIG_ANIM_9 }; -Actor* func_80BF1150(EnIg* this, PlayState* play, u8 actorCat, s16 actorId) { - Actor* foundActor = NULL; - Actor* temp_v0; +Actor* EnIg_FindActor(EnIg* this, PlayState* play, u8 actorCategory, s16 actorId) { + Actor* actorIter = NULL; while (true) { - foundActor = SubS_FindActor(play, foundActor, actorCat, actorId); + actorIter = SubS_FindActor(play, actorIter, actorCategory, actorId); - if (foundActor == NULL) { + if (actorIter == NULL) { break; } - if ((this != (EnIg*)foundActor) && (foundActor->update != NULL)) { + if ((this != (EnIg*)actorIter) && (actorIter->update != NULL)) { break; } - temp_v0 = foundActor->next; - if (temp_v0 == NULL) { - foundActor = NULL; + if (actorIter->next == NULL) { + actorIter = NULL; break; } - foundActor = temp_v0; + actorIter = actorIter->next; } - return foundActor; + return actorIter; } EnDoor* func_80BF1200(PlayState* play, s32 arg1) { @@ -241,7 +239,7 @@ Actor* func_80BF146C(EnIg* this, PlayState* play) { Actor* retActor; if (this->scheduleResult == 3) { - retActor = func_80BF1150(this, play, ACTORCAT_NPC, ACTOR_EN_AN); + retActor = EnIg_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AN); } else { retActor = &GET_PLAYER(play)->actor; } @@ -482,7 +480,7 @@ s32 func_80BF1B40(EnIg* this, PlayState* play) { return false; } -s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput, s32 arg3, s32 arg4) { +s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput, s32 actorCategory, s32 actorId) { u8 pathIndex = ENIG_GET_PATH_INDEX(&this->actor); Vec3s* sp48; Vec3f sp3C; @@ -491,7 +489,7 @@ s32 func_80BF1C44(EnIg* this, PlayState* play, ScheduleOutput* scheduleOutput, s s32 pad; s32 sp24 = false; - sp2C = func_80BF1150(this, play, arg3, arg4); + sp2C = EnIg_FindActor(this, play, actorCategory, actorId); this->timePath = NULL; if (D_80BF3318[scheduleOutput->result] >= 0) { 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 6be2ad6954..6c157f013c 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -850,8 +850,8 @@ void EnIk_UpdateArmor(EnIk* this, PlayState* play) { ikEffect = &this->effects[i]; if (ikEffect->enabled) { - Math_Vec3f_Sum(&ikEffect->pos, &ikEffect->vel, &ikEffect->pos); - ikEffect->vel.y += -1.5f; + Math_Vec3f_Sum(&ikEffect->pos, &ikEffect->velocity, &ikEffect->pos); + ikEffect->velocity.y += -1.5f; if (ikEffect->pos.y < this->actor.floorHeight) { ikEffect->enabled = false; ikEffect->pos.y = this->actor.floorHeight; @@ -1038,9 +1038,9 @@ void EnIk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, ikEffect->enabled = true; sp76 = sIronKnuckleArmorMarkings[armorBodyPart].unk04 + (((s32)Rand_Next() >> 0x13) + this->actor.shape.rot.y); - ikEffect->vel.x = Math_SinS(sp76) * 5.0f; - ikEffect->vel.y = 6.0f; - ikEffect->vel.z = Math_CosS(sp76) * 5.0f; + ikEffect->velocity.x = Math_SinS(sp76) * 5.0f; + ikEffect->velocity.y = 6.0f; + ikEffect->velocity.z = Math_CosS(sp76) * 5.0f; ikEffect->dList = *dList; } if (limbIndex == IRON_KNUCKLE_LIMB_WAIST) { diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.h b/src/overlays/actors/ovl_En_Ik/z_en_ik.h index a6d56bca6f..55bc0eb68d 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -19,7 +19,7 @@ typedef enum { typedef struct { /* 0x00 */ Gfx* dList; /* 0x04 */ Vec3f pos; - /* 0x10 */ Vec3f vel; + /* 0x10 */ Vec3f velocity; /* 0x1C */ Vec3s rot; /* 0x24 */ s32 enabled; } IronKnuckleEffect; // size = 0x28 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 d01d03a3d2..0be5836e9d 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -631,13 +631,13 @@ s32 func_808F4270(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx, if (gSaveContext.save.saveInfo.playerData.rupees >= fee) { Rupees_ChangeBy(-fee); if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_57_01)) { - if (arg4 != 0) { + if (arg4) { Actor_ContinueText(play, &this->actor, 0x3474); } else { func_808F4108(this, play, 0x3474); } } else { - if (arg4 != 0) { + if (arg4) { Actor_ContinueText(play, &this->actor, 0x3475); } else { func_808F4108(this, play, 0x3475); @@ -645,7 +645,7 @@ s32 func_808F4270(PlayState* play, EnIn* this, s32 arg2, MessageContext* msgCtx, } } else { Audio_PlaySfx(NA_SE_SY_ERROR); - if (arg4 != 0) { + if (arg4) { Actor_ContinueText(play, &this->actor, 0x3473); } else { func_808F4108(this, play, 0x3473); @@ -1248,7 +1248,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { case 0x349B: if (msgCtx->choiceIndex == 0) { - func_808F4270(play, this, arg2, msgCtx, 1); + func_808F4270(play, this, arg2, msgCtx, true); ret = false; } else { Audio_PlaySfx_MessageCancel(); @@ -1283,7 +1283,7 @@ s32 func_808F4414(PlayState* play, EnIn* this, s32 arg2) { break; case 0x3471: - func_808F4270(play, this, arg2, msgCtx, 0); + func_808F4270(play, this, arg2, msgCtx, false); ret = false; break; diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index d4cc0a819b..2c53afc4b6 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -145,7 +145,7 @@ void EnKendoJs_Init(Actor* thisx, PlayState* play) { this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 30.0f; this->actor.child = NULL; - this->unk_28A = 0; + this->unk_28A = false; this->unk_28C = 0; this->unk_28E = 0; this->unk_286 = 0; @@ -207,8 +207,8 @@ void func_80B2654C(EnKendoJs* this, PlayState* play) { Message_StartTextbox(play, sp2E, &this->actor); this->unk_288 = sp2E; } else { - if (this->unk_28A == 0) { - this->unk_28A = 1; + if (!this->unk_28A) { + this->unk_28A = true; phi_v0 = 0; } else { phi_v0 = 1; diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c index 7a482c2087..88d63af9d9 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c @@ -86,7 +86,7 @@ static ColliderCylinderInit sCylinderInit = { { 6, 44, 0, { 0, 0, 0 } }, }; -u8 D_80A5EAEC = 1; +u8 D_80A5EAEC = true; s16 D_80A5EAF0 = 0; Vec3s D_80A5EAF4 = { 0, 0, 0 }; Vec3s D_80A5EAFC = { 0, 0, 0 }; @@ -411,7 +411,9 @@ EnKusa2UnkBssSubStruct2* func_80A5C0B8(EnKusa2UnkBssStruct* arg0) { for (i = 1; i < ARRAY_COUNT(D_80A5F1C0.unk_0480); i++) { if (phi_v1->unk_2C > arg0->unk_0480[i].unk_2C) { phi_v1 = &arg0->unk_0480[i]; + //! FAKE: if (1) {} + if (phi_v1->unk_2C <= 0) { break; } @@ -866,8 +868,8 @@ void EnKusa2_Init(Actor* thisx, PlayState* play) { this->actor.flags |= ACTOR_FLAG_20; Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BG); this->unk_1BE = 0; - if (D_80A5EAEC != 0) { - D_80A5EAEC = 0; + if (D_80A5EAEC) { + D_80A5EAEC = false; D_80A60900 = play->gameplayFrames; func_80A5CAD4(&D_80A5F1C0); D_80A60B08 = Rand_Next() >> 0x10; diff --git a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c index 9cf7b0a4cd..b83a375513 100644 --- a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c +++ b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c @@ -207,15 +207,15 @@ void EnMinislime_AddIceShardEffect(EnMinislime* this) { void EnMinislime_AddIceSmokeEffect(EnMinislime* this, PlayState* play) { Vec3f pos; - Vec3f vel; + Vec3f velocity; pos.x = (Rand_CenteredFloat(200.0f) * this->actor.scale.x) + this->actor.world.pos.x; pos.y = CLAMP_MIN(this->actor.world.pos.y, GBT_ROOM_5_MIN_Y + 30.0f); pos.z = (Rand_CenteredFloat(200.0f) * this->actor.scale.z) + this->actor.world.pos.z; - vel.x = Rand_CenteredFloat(1.5f); - vel.z = Rand_CenteredFloat(1.5f); - vel.y = 2.0f; - EffectSsIceSmoke_Spawn(play, &pos, &vel, &gZeroVec3f, 500); + velocity.x = Rand_CenteredFloat(1.5f); + velocity.z = Rand_CenteredFloat(1.5f); + velocity.y = 2.0f; + EffectSsIceSmoke_Spawn(play, &pos, &velocity, &gZeroVec3f, 500); } void EnMinislime_SetupDisappear(EnMinislime* this) { 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 fe1a203429..f2bb78d400 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -103,29 +103,28 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; Actor* EnNb_FindActor(EnNb* this, PlayState* play, u8 actorCategory, s16 actorId) { - Actor* thisx; - Actor* actor = NULL; + Actor* actorIter = NULL; while (true) { - actor = SubS_FindActor(play, actor, actorCategory, actorId); - if (actor == NULL) { + actorIter = SubS_FindActor(play, actorIter, actorCategory, actorId); + + if (actorIter == NULL) { break; } - thisx = &this->actor; - if ((actor != thisx) && (actor->update != NULL)) { + if ((this != (EnNb*)actorIter) && (actorIter->update != NULL)) { break; } - if (actor->next == NULL) { - actor = NULL; + if (actorIter->next == NULL) { + actorIter = NULL; break; } - actor = actor->next; + actorIter = actorIter->next; } - return actor; + return actorIter; } void EnNb_UpdateSkelAnime(EnNb* this) { diff --git a/src/overlays/actors/ovl_En_Paper/z_en_paper.c b/src/overlays/actors/ovl_En_Paper/z_en_paper.c index e16077094b..6508bec9c5 100644 --- a/src/overlays/actors/ovl_En_Paper/z_en_paper.c +++ b/src/overlays/actors/ovl_En_Paper/z_en_paper.c @@ -99,10 +99,10 @@ void EnPaper_InitConfettiPiece(EnPaper* this, EnPaperConfetto* piece) { // copy actor velocity and distrbute uniformly in a cuboid with sides 9, 6, 9 with actor.velocity in the middle // of the base. - piece->vel = this->actor.velocity; - piece->vel.x += Rand_Centered() * 9.0f; - piece->vel.y += Rand_ZeroOne() * 6.0f; - piece->vel.z += Rand_Centered() * 9.0f; + piece->velocity = this->actor.velocity; + piece->velocity.x += Rand_Centered() * 9.0f; + piece->velocity.y += Rand_ZeroOne() * 6.0f; + piece->velocity.z += Rand_Centered() * 9.0f; // Choose random starting angle and angular velocity piece->angle = Rand_Next(); @@ -140,20 +140,20 @@ void EnPaper_FlyConfettiPiece(EnPaper* this, EnPaperConfetto* piece) { } // acceleration due to gravity - piece->vel.y += this->actor.gravity; + piece->velocity.y += this->actor.gravity; // drag and wind force: normal is used to simulate cross-section size of piece, although - piece->vel.x -= 0.2f * fabsf(piece->normal.x) * (piece->vel.x + this->windForce.x); - piece->vel.y -= 0.2f * fabsf(piece->normal.y) * (piece->vel.y + this->windForce.y); - piece->vel.z -= 0.2f * fabsf(piece->normal.z) * (piece->vel.z + this->windForce.z); + piece->velocity.x -= 0.2f * fabsf(piece->normal.x) * (piece->velocity.x + this->windForce.x); + piece->velocity.y -= 0.2f * fabsf(piece->normal.y) * (piece->velocity.y + this->windForce.y); + piece->velocity.z -= 0.2f * fabsf(piece->normal.z) * (piece->velocity.z + this->windForce.z); // rotate around axis piece->angle += piece->angVel; // move - piece->pos.x += piece->vel.x; - piece->pos.y += piece->vel.y; - piece->pos.z += piece->vel.z; + piece->pos.x += piece->velocity.x; + piece->pos.y += piece->velocity.y; + piece->pos.z += piece->velocity.z; // Rotate unit Z vector about `axis` by `angle` to get forward direction. This is the same calculation as at the // bottom of EnPaper_InitConfettiPiece(), but done manually instead of using any matrix functions. diff --git a/src/overlays/actors/ovl_En_Paper/z_en_paper.h b/src/overlays/actors/ovl_En_Paper/z_en_paper.h index a48c6ae881..539beb7aea 100644 --- a/src/overlays/actors/ovl_En_Paper/z_en_paper.h +++ b/src/overlays/actors/ovl_En_Paper/z_en_paper.h @@ -13,7 +13,7 @@ typedef struct { /* 0x00 */ Vec3f normal; // normal to the plane of the confetti piece /* 0x0C */ Vec3f rotAxis; // axis to spin around /* 0x18 */ Vec3f pos; - /* 0x24 */ Vec3f vel; + /* 0x24 */ Vec3f velocity; /* 0x30 */ s16 angle; // angle to rotate around `rotAxis` /* 0x32 */ s16 angVel; // angular velocity of `angle` } EnPaperConfetto; // size = 0x34 diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index a53352736a..9e554f02d8 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -238,32 +238,29 @@ s32 func_80AF7BAC(EnPm* this) { return true; } -Actor* func_80AF7CB0(EnPm* this, PlayState* play, u8 actorCat, s16 actorId) { - Actor* phi_s0 = NULL; - Actor* actor; +Actor* EnPm_FindActor(EnPm* this, PlayState* play, u8 actorCategory, s16 actorId) { + Actor* actorIter = NULL; while (true) { - actor = SubS_FindActor(play, phi_s0, actorCat, actorId); - phi_s0 = actor; + actorIter = SubS_FindActor(play, actorIter, actorCategory, actorId); - if (actor == NULL) { + if (actorIter == NULL) { break; } - if (((EnPm*)phi_s0 != this) && (actor->update != NULL)) { + if ((this != (EnPm*)actorIter) && (actorIter->update != NULL)) { break; } - actor = actor->next; - if (actor == NULL) { - phi_s0 = NULL; + if (actorIter->next == NULL) { + actorIter = NULL; break; } - phi_s0 = actor; + actorIter = actorIter->next; } - return phi_s0; + return actorIter; } EnDoor* func_80AF7D60(PlayState* play, s32 arg1) { @@ -299,31 +296,28 @@ EnDoor* func_80AF7D60(PlayState* play, s32 arg1) { } Actor* func_80AF7DC4(EnPm* this, PlayState* play, s32 arg2) { - Actor* phi_s0 = NULL; - Actor* actor; + Actor* actorIter = NULL; while (true) { - actor = SubS_FindActor(play, phi_s0, ACTORCAT_PROP, ACTOR_EN_PST); - phi_s0 = actor; + actorIter = SubS_FindActor(play, actorIter, ACTORCAT_PROP, ACTOR_EN_PST); - if (actor == NULL) { + if (actorIter == NULL) { break; } - if (((EnPm*)actor != this) && (actor->update != NULL) && (actor->params == (s16)arg2)) { + if ((this != (EnPm*)actorIter) && (actorIter->update != NULL) && (actorIter->params == (s16)arg2)) { break; } - actor = actor->next; - if (actor == NULL) { - phi_s0 = NULL; + if (actorIter->next == NULL) { + actorIter = NULL; break; } - phi_s0 = actor; + actorIter = actorIter->next; } - return phi_s0; + return actorIter; } void func_80AF7E6C(EnPm* this) { @@ -395,15 +389,15 @@ Actor* func_80AF8040(EnPm* this, PlayState* play) { switch (this->unk_258) { case 16: - actor = func_80AF7CB0(this, play, ACTORCAT_NPC, ACTOR_EN_AN); + actor = EnPm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AN); break; case 17: - actor = func_80AF7CB0(this, play, ACTORCAT_NPC, ACTOR_EN_TEST3); + actor = EnPm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_TEST3); break; case 28: - actor = func_80AF7CB0(this, play, ACTORCAT_NPC, ACTOR_EN_AL); + actor = EnPm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AL); break; case 3: @@ -842,7 +836,7 @@ s32 func_80AF8DD4(EnPm* this, PlayState* play) { return 0; } -s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput, u8 actorCat, s16 actorId) { +s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput, u8 actorCategory, s16 actorId) { u8 pathIndex = ENPM_GET_PATH_INDEX(&this->actor); Vec3s* sp48; Vec3f sp3C; @@ -852,7 +846,7 @@ s32 func_80AF8ED4(EnPm* this, PlayState* play, ScheduleOutput* scheduleOutput, u s32 ret = false; this->timePath = NULL; - sp2C = func_80AF7CB0(this, play, actorCat, actorId); + sp2C = EnPm_FindActor(this, play, actorCategory, actorId); if (D_80AFB430[scheduleOutput->result] >= 0) { this->timePath = SubS_GetAdditionalPath(play, pathIndex, D_80AFB430[scheduleOutput->result]); } diff --git a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c index 07f597773c..80c3fb9a2f 100644 --- a/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c +++ b/src/overlays/actors/ovl_En_Pr2/z_en_pr2.c @@ -650,28 +650,14 @@ void EnPr2_Update(Actor* thisx, PlayState* play) { EnPr2* this = THIS; f32 rand; - //! FAKE: - if (thisx) {} - Actor_SetScale(&this->actor, this->unk_204); this->actionFunc(this, play); - if (this->unk_1DA != 0) { - this->unk_1DA--; - } - - if (this->unk_1D8 != 0) { - this->unk_1D8--; - } - - if (this->unk_1DC != 0) { - this->unk_1DC--; - } - - if (this->unk_1DE != 0) { - this->unk_1DE--; - } + DECR(this->unk_1DA); + DECR(this->unk_1D8); + DECR(this->unk_1DC); + DECR(this->unk_1DE); Actor_SetFocus(&this->actor, 10.0f); func_80A755D8(this, play); diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.c b/src/overlays/actors/ovl_En_Rg/z_en_rg.c index b9b85211fd..301df98e47 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c @@ -534,25 +534,24 @@ void func_80BF4964(EnRg* this) { void func_80BF4AB8(EnRg* this, PlayState* play) { Player* player = GET_PLAYER(play); - Actor* phi_s0; + Actor* actorIter = NULL; - phi_s0 = NULL; if (!(this->unk_310 & 0x800)) { if (this->unk_320 == 0) { do { - phi_s0 = SubS_FindActor(play, phi_s0, 6, ACTOR_OBJ_TSUBO); - if (phi_s0 != NULL) { - if (func_80BF4220(this, play, phi_s0) && (phi_s0->update != NULL)) { - this->unk_18C = phi_s0; + actorIter = SubS_FindActor(play, actorIter, ACTORCAT_PROP, ACTOR_OBJ_TSUBO); + if (actorIter != NULL) { + if (func_80BF4220(this, play, actorIter) && (actorIter->update != NULL)) { + this->unk_18C = actorIter; this->unk_310 |= 0x800; break; } - phi_s0 = phi_s0->next; + actorIter = actorIter->next; } - } while (phi_s0 != NULL); + } while (actorIter != NULL); } - if ((phi_s0 == NULL) && !D_80BF5C10 && (this->unk_326 == 0) && (player->stateFlags3 & PLAYER_STATE3_80000) && + if ((actorIter == NULL) && !D_80BF5C10 && (this->unk_326 == 0) && (player->stateFlags3 & PLAYER_STATE3_80000) && (player->invincibilityTimer == 0) && func_80BF4220(this, play, &player->actor)) { this->unk_18C = &player->actor; this->unk_310 |= 0x800; diff --git a/src/overlays/actors/ovl_En_Slime/z_en_slime.c b/src/overlays/actors/ovl_En_Slime/z_en_slime.c index 3fc168705c..a22b4d3bef 100644 --- a/src/overlays/actors/ovl_En_Slime/z_en_slime.c +++ b/src/overlays/actors/ovl_En_Slime/z_en_slime.c @@ -857,11 +857,7 @@ void EnSlime_IceBlock(EnSlime* this, PlayState* play) { } } else { this->actor.colorFilterTimer = 10; - if ((this->iceBlockTimer - 5) < 0) { - this->iceBlockTimer = 0; - } else { - this->iceBlockTimer -= 5; - } + this->iceBlockTimer = CLAMP_MIN(this->iceBlockTimer - 5, 0); } } diff --git a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c index 85a76a7e55..0324d7a47e 100644 --- a/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c +++ b/src/overlays/actors/ovl_En_Snowman/z_en_snowman.c @@ -227,7 +227,10 @@ void EnSnowman_Init(Actor* thisx, PlayState* play) { thisx->parent->child = thisx; thisx->child->child = thisx->parent; thisx->parent->parent = thisx->child; + + //! FAKE: if (1) {} + Actor_SetScale(thisx, 0.02f); } diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index b20a03042b..0e429da99f 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -416,8 +416,8 @@ s32 EnSsh_IsCloseToLink(EnSsh* this, PlayState* play) { } s32 EnSsh_IsCloseToHome(EnSsh* this) { - f32 vel = this->actor.velocity.y; - f32 nextY = this->actor.world.pos.y + vel * 2.0f; + f32 velocityY = this->actor.velocity.y; + f32 nextY = this->actor.world.pos.y + velocityY * 2.0f; if (this->actor.home.pos.y <= nextY) { return true; @@ -426,8 +426,8 @@ s32 EnSsh_IsCloseToHome(EnSsh* this) { } s32 EnSsh_IsCloseToGround(EnSsh* this) { - f32 vel = this->actor.velocity.y; - f32 nextY = this->actor.world.pos.y + vel * 2.0f; + f32 velocityY = this->actor.velocity.y; + f32 nextY = this->actor.world.pos.y + velocityY * 2.0f; if ((nextY - this->actor.floorHeight) <= this->floorHeightOffset) { return true; diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index c7ce46ff2e..b3686700be 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -431,9 +431,9 @@ void func_80BAAF1C(EnSuttari* this) { void func_80BAAFDC(EnSuttari* this, PlayState* play) { if ((this->actor.xzDistToPlayer < 500.0f) && (this->actor.playerHeightRel < 100.0f)) { - Vec3f effectVelOffset = { 0.0f, 0.0f, 0.0f }; + Vec3f effectVelocityOffset = { 0.0f, 0.0f, 0.0f }; Vec3f effectPos; - Vec3f effectVel; + Vec3f effectVelocity; Math_Vec3f_Copy(&effectPos, &this->actor.world.pos); effectPos.x += Math_SinS(this->actor.world.rot.y + this->unk3F4) * 10.0f; @@ -441,11 +441,11 @@ void func_80BAAFDC(EnSuttari* this, PlayState* play) { effectPos.z += Math_CosS(this->actor.world.rot.y + this->unk3F4) * 10.0f; Matrix_Push(); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW); - effectVelOffset.z = 20.0f; - Matrix_MultVec3f(&effectVelOffset, &effectVel); + effectVelocityOffset.z = 20.0f; + Matrix_MultVec3f(&effectVelocityOffset, &effectVelocity); Matrix_Pop(); if (!this->playerDetected) { - EffectSsSolderSrchBall_Spawn(play, &effectPos, &effectVel, &gZeroVec3f, 50, &this->playerDetected, + EffectSsSolderSrchBall_Spawn(play, &effectPos, &effectVelocity, &gZeroVec3f, 50, &this->playerDetected, SOLDERSRCHBALL_INVISIBLE); } if (this->playerDetected == true) { @@ -464,9 +464,9 @@ void func_80BAAFDC(EnSuttari* this, PlayState* play) { void func_80BAB1A0(EnSuttari* this, PlayState* play) { if ((this->actor.xzDistToPlayer < 500.0f) && (this->actor.playerHeightRel < 100.0f)) { - Vec3f effectVelOffset = { 0.0f, 0.0f, 0.0f }; + Vec3f effectVelocityOffset = { 0.0f, 0.0f, 0.0f }; Vec3f effectPos; - Vec3f effectVel; + Vec3f effectVelocity; Math_Vec3f_Copy(&effectPos, &this->actor.world.pos); effectPos.x += Math_SinS(this->actor.world.rot.y + this->unk3F4) * 350.0f; @@ -474,11 +474,11 @@ void func_80BAB1A0(EnSuttari* this, PlayState* play) { effectPos.z += Math_CosS(this->actor.world.rot.y + this->unk3F4) * 350.0f; Matrix_Push(); Matrix_RotateYS(this->actor.shape.rot.y, MTXMODE_NEW); - effectVelOffset.z = 20.0f; - Matrix_MultVec3f(&effectVelOffset, &effectVel); + effectVelocityOffset.z = 20.0f; + Matrix_MultVec3f(&effectVelocityOffset, &effectVelocity); Matrix_Pop(); if (!this->playerDetected) { - EffectSsSolderSrchBall_Spawn(play, &effectPos, &effectVel, &gZeroVec3f, 50, &this->playerDetected, + EffectSsSolderSrchBall_Spawn(play, &effectPos, &effectVelocity, &gZeroVec3f, 50, &this->playerDetected, SOLDERSRCHBALL_INVISIBLE); } if (this->playerDetected == true) { diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 6ac89a6f1f..5c56ba2e7a 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -292,18 +292,19 @@ void func_808D90F0(EnSw* this, s32 arg1, s16 arg2) { Math3D_CrossProduct(&this->unk_368, &this->unk_350, &this->unk_35C); } -s32 func_808D91C4(EnSw* this, CollisionPoly* arg1) { +s32 func_808D91C4(EnSw* this, CollisionPoly* floorPoly) { f32 sp4C; f32 temp_f12; f32 temp_f0; Vec3f sp38; Vec3f sp2C; - this->actor.floorPoly = arg1; - if (arg1 != 0) { - sp38.x = COLPOLY_GET_NORMAL(arg1->normal.x); - sp38.y = COLPOLY_GET_NORMAL(arg1->normal.y); - sp38.z = COLPOLY_GET_NORMAL(arg1->normal.z); + this->actor.floorPoly = floorPoly; + + if (floorPoly != NULL) { + sp38.x = COLPOLY_GET_NORMAL(floorPoly->normal.x); + sp38.y = COLPOLY_GET_NORMAL(floorPoly->normal.y); + sp38.z = COLPOLY_GET_NORMAL(floorPoly->normal.z); } else { return false; } @@ -636,7 +637,7 @@ void func_808D9F08(EnSw* this) { } void func_808D9F78(EnSw* this, PlayState* play, s32 arg2) { - if (arg2 != 0) { + if (arg2) { Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); } Actor_SetScale(&this->actor, 0.02f); @@ -1111,7 +1112,7 @@ void func_808DB2E0(EnSw* this, PlayState* play) { f32 temp_f2; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - func_808D9F78(this, play, 0); + func_808D9F78(this, play, false); temp_f2 = fabsf(this->actor.velocity.y) * 0.6f; this->actor.velocity.x *= 0.5f; this->actor.velocity.y = temp_f2; @@ -1169,7 +1170,7 @@ void EnSw_Init(Actor* thisx, PlayState* play) { switch (ENSW_GET_3(&this->actor)) { case 0: - func_808D9F78(this, play, 1); + func_808D9F78(this, play, true); this->actionFunc = func_808DA350; break; @@ -1177,11 +1178,7 @@ void EnSw_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.flags |= ACTOR_FLAG_10; - if (this->actor.world.rot.z < 0) { - this->unk_460 = -thisx->world.rot.z; - } else { - this->unk_460 = thisx->world.rot.z; - } + this->unk_460 = ABS_ALT(thisx->world.rot.z); if (this->actor.world.rot.z >= 0) { this->unk_410 |= 8; @@ -1198,17 +1195,13 @@ void EnSw_Init(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.flags |= ACTOR_FLAG_10; - if (this->actor.world.rot.z < 0) { - this->unk_460 = -thisx->world.rot.z; - } else { - this->unk_460 = thisx->world.rot.z; - } + this->unk_460 = ABS_ALT(thisx->world.rot.z); if (this->actor.world.rot.z >= 0) { this->unk_410 |= 8; } - func_808D9F78(this, play, 1); + func_808D9F78(this, play, true); if (this->path != NULL) { this->unk_49C = 1; func_808D9F08(this); diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.c b/src/overlays/actors/ovl_En_Tab/z_en_tab.c index 6534bc5d96..dcaa8a8d31 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -106,25 +106,28 @@ TexturePtr D_80BE1B24[] = { object_tab_Tex_006928, }; -EnGm* func_80BE04E0(EnTab* this, PlayState* play, u8 actorCat, s16 actorId) { - Actor* foundActor = NULL; - Actor* tempActor; +Actor* EnTab_FindActor(EnTab* this, PlayState* play, u8 actorCategory, s16 actorId) { + Actor* actorIter = NULL; while (true) { - foundActor = SubS_FindActor(play, foundActor, actorCat, actorId); - if ((foundActor == NULL) || (((EnTab*)foundActor != this) && (foundActor->update != NULL))) { + actorIter = SubS_FindActor(play, actorIter, actorCategory, actorId); + + if (actorIter == NULL) { break; } - tempActor = foundActor->next; - if (tempActor == NULL) { - foundActor = NULL; + if ((this != (EnTab*)actorIter) && (actorIter->update != NULL)) { break; } - foundActor = tempActor; + + if (actorIter->next == NULL) { + actorIter = NULL; + break; + } + actorIter = actorIter->next; }; - return (EnGm*)foundActor; + return actorIter; } void func_80BE0590(EnTab* this) { @@ -351,7 +354,7 @@ s32* func_80BE0E04(EnTab* this, PlayState* play) { s32 func_80BE0F04(EnTab* this, PlayState* play, ScheduleOutput* scheduleOutput) { s32 ret = false; - EnGm* sp28 = func_80BE04E0(this, play, ACTORCAT_NPC, ACTOR_EN_GM); + EnGm* sp28 = (EnGm*)EnTab_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_GM); if (sp28) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80BE1AF0); diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index 76fb8c392f..59507d3287 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -760,7 +760,8 @@ s32 func_80A3FF10(EnTest3* this, PlayState* play, struct_80A41828* arg2, Schedul this->player.actor.home.rot.y = -0x2AAB; this->player.actor.shape.rot.y = -0x2AAB; this->player.currentYaw = -0x2AAB; - if (1) {} // macro? + //! FAKE: + if (1) {} return true; } else { func_80A3F15C(this, play, arg2); diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index df7d2eab8e..236748be69 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -333,6 +333,7 @@ s32 func_80C10E98(PlayState* play) { if (AMMO(ITEM_BOMB) >= 5) { spB0 = 1; dropItem00Ids[1] = ITEM00_BOMBS_B; + //! FAKE: if (1) {} } else { spB0 = 0; @@ -361,7 +362,10 @@ s32 func_80C10E98(PlayState* play) { } i = sp5C - phi_s0_2; + + //! FAKE: if (i) {} + sp5C = phi_s0_2 * 50; sp98 -= sp5C; diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index adc5e91854..cba5445795 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -370,6 +370,7 @@ void func_80AECB6C(EnTk* this, PlayState* play) { void func_80AECE0C(EnTk* this, PlayState* play) { if (this->unk_3CC != 0) { + //! FAKE: if (1) {} func_80AECE60(this, play); } diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c index 91dd7f019c..8db978465a 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c @@ -218,25 +218,23 @@ s32 func_80B76368(EnTruMt* this, PlayState* play) { } s32 func_80B763C4(EnTruMt* this, PlayState* play) { - Actor* foundActor; - Actor* actor = NULL; + Actor* actorIter = NULL; while (true) { - foundActor = SubS_FindActor(play, actor, ACTORCAT_NPC, ACTOR_EN_TRU_MT); + actorIter = SubS_FindActor(play, actorIter, ACTORCAT_NPC, ACTOR_EN_TRU_MT); - if (foundActor == NULL) { + if (actorIter == NULL) { break; } - if ((EnTruMt*)foundActor != this) { + if ((EnTruMt*)actorIter != this) { return true; } - foundActor = foundActor->next; - if (foundActor == NULL) { + if (actorIter->next == NULL) { break; } - actor = foundActor; + actorIter = actorIter->next; }; return false; @@ -478,7 +476,7 @@ void func_80B76ED4(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4) { *arg2 = sp7C; - if (arg4 != 0) { + if (arg4) { sp68.x += arg0; sp68.y += arg1; Math_SmoothStepToS(&arg3->x, sp68.x, 4, 0x1FFE, 1); @@ -512,9 +510,9 @@ void EnTruMt_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro if (limbIndex == KOUME_LIMB_HEAD) { if (this->unk_328 & 0x10) { - phi_v0 = 1; + phi_v0 = true; } else { - phi_v0 = 0; + phi_v0 = false; } func_80B76ED4(this->unk_348, this->unk_34A, &this->unk_33C, &this->unk_336, phi_v0); Matrix_Translate(this->unk_33C.x, this->unk_33C.y, this->unk_33C.z, MTXMODE_NEW); diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c index 6b894a797b..a64532085c 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -61,10 +61,6 @@ static ColliderCylinderInit sCylinderInit = { { 30, 40, 0, { 0, 0, 0 } }, }; -Vec3f D_80AE11BC = { 0.0f, 0.0f, 0.0f }; - -TexturePtr D_80AE11C8[] = { object_tsn_Tex_0073B8, object_tsn_Tex_0085B8 }; - EnTsn* func_80ADFCA0(PlayState* play) { Actor* npc = play->actorCtx.actorLists[ACTORCAT_NPC].first; @@ -617,14 +613,15 @@ s32 EnTsn_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p void EnTsn_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { EnTsn* this = THIS; - Vec3f sp18 = D_80AE11BC; + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; if (limbIndex == 15) { - Matrix_MultVec3f(&sp18, &this->actor.focus.pos); + Matrix_MultVec3f(&zeroVec, &this->actor.focus.pos); } } void EnTsn_Draw(Actor* thisx, PlayState* play) { + static TexturePtr D_80AE11C8[] = { object_tsn_Tex_0073B8, object_tsn_Tex_0085B8 }; s32 pad; EnTsn* this = THIS; diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index c50e82377b..9a65105b60 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -90,7 +90,7 @@ void EnTuboTrap_SpawnEffectsOnLand(EnTuboTrap* this, PlayState* play) { f32 sin; f32 cos; Vec3f pos; - Vec3f vel; + Vec3f velocity; s32 arg5; s16 var; s32 i; @@ -103,9 +103,9 @@ void EnTuboTrap_SpawnEffectsOnLand(EnTuboTrap* this, PlayState* play) { pos.y = (Rand_ZeroOne() * 5.0f) + 2.0f; pos.z = cos * 8.0f; - vel.x = pos.x * 0.23f; - vel.y = (Rand_ZeroOne() * 5.0f) + 2.0f; - vel.z = pos.z * 0.23f; + velocity.x = pos.x * 0.23f; + velocity.y = (Rand_ZeroOne() * 5.0f) + 2.0f; + velocity.z = pos.z * 0.23f; pos.x += actorPos->x; pos.y += actorPos->y; @@ -119,8 +119,9 @@ void EnTuboTrap_SpawnEffectsOnLand(EnTuboTrap* this, PlayState* play) { } else { arg5 = 0x20; } - EffectSsKakera_Spawn(play, &pos, &vel, actorPos, -0xF0, arg5, 0x14, 0, 0, ((Rand_ZeroOne() * 85.0f) + 15.0f), 0, - 0, 0x3C, -1, GAMEPLAY_DANGEON_KEEP, gameplay_dangeon_keep_DL_018090); + EffectSsKakera_Spawn(play, &pos, &velocity, actorPos, -0xF0, arg5, 0x14, 0, 0, + ((Rand_ZeroOne() * 85.0f) + 15.0f), 0, 0, 0x3C, -1, GAMEPLAY_DANGEON_KEEP, + gameplay_dangeon_keep_DL_018090); } func_800BBFB0(play, actorPos, 30.0f, 4, 0x14, 0x32, 0); @@ -131,7 +132,7 @@ void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, PlayState* play) { f32 sin; f32 cos; Vec3f pos; - Vec3f vel; + Vec3f velocity; s16 var; s32 arg5; s32 i; @@ -149,9 +150,9 @@ void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, PlayState* play) { pos.y = (Rand_ZeroOne() * 5.0f) + 2.0f; pos.z = cos * 8.0f; - vel.x = pos.x * 0.20f; - vel.y = (Rand_ZeroOne() * 4.0f) + 2.0f; - vel.z = pos.z * 0.20f; + velocity.x = pos.x * 0.20f; + velocity.y = (Rand_ZeroOne() * 4.0f) + 2.0f; + velocity.z = pos.z * 0.20f; pos.x += actorPos->x; pos.y += actorPos->y; @@ -164,8 +165,9 @@ void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, PlayState* play) { arg5 = 32; } - EffectSsKakera_Spawn(play, &pos, &vel, actorPos, -0xAA, arg5, 0x32, 5, 0, ((Rand_ZeroOne() * 85.0f) + 15.0f), 0, - 0, 0x46, -1, GAMEPLAY_DANGEON_KEEP, gameplay_dangeon_keep_DL_018090); + EffectSsKakera_Spawn(play, &pos, &velocity, actorPos, -0xAA, arg5, 0x32, 5, 0, + ((Rand_ZeroOne() * 85.0f) + 15.0f), 0, 0, 0x46, -1, GAMEPLAY_DANGEON_KEEP, + gameplay_dangeon_keep_DL_018090); } } diff --git a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c index 83b9e965ac..a75e4ef210 100644 --- a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c +++ b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c @@ -43,8 +43,7 @@ ActorInit En_Water_Effect_InitVars = { /**/ EnWaterEffect_Draw, }; -static Vec3f D_80A5AFB0 = { 0.0f, 0.0f, 0.0f }; -static Vec3f D_80A5AFBC = { 0.0f, -1.0f, 0.0f }; +static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; void func_80A587A0(EnWaterEffect* this, Vec3f* arg1, u8 arg2) { s16 i; @@ -54,8 +53,8 @@ void func_80A587A0(EnWaterEffect* this, Vec3f* arg1, u8 arg2) { if (!ptr->unk_00) { ptr->unk_00 = true; ptr->unk_04 = *arg1; - ptr->unk_10 = D_80A5AFB0; - ptr->unk_1C = D_80A5AFB0; + ptr->unk_10 = sZeroVec; + ptr->unk_1C = sZeroVec; ptr->unk_2C.x = 0.1f; ptr->unk_2C.y = 0.0f; ptr->unk_2C.z = Rand_ZeroFloat(M_PI * 2); @@ -67,7 +66,7 @@ void func_80A587A0(EnWaterEffect* this, Vec3f* arg1, u8 arg2) { } void func_80A58908(EnWaterEffect* this, Vec3f* arg1, Vec3f* arg2, u8 arg3) { - Vec3f sp2C = D_80A5AFBC; + Vec3f sp2C = { 0.0f, -1.0f, 0.0f }; EnWaterEffectStruct* ptr = &this->unk_144[0]; s16 i; @@ -218,8 +217,8 @@ void EnWaterEffect_Update(Actor* thisx, PlayState* play2) { ptr->unk_00 = 3; ptr->unk_2C.x = 0.1f; ptr->unk_2C.y = 0.6f; - ptr->unk_10 = D_80A5AFB0; - ptr->unk_1C = D_80A5AFB0; + ptr->unk_10 = sZeroVec; + ptr->unk_1C = sZeroVec; ptr->unk_3C = 200; ptr->unk_28 = 9; Math_Vec3f_Copy(&sp98, &ptr->unk_04); @@ -256,8 +255,8 @@ void EnWaterEffect_Update(Actor* thisx, PlayState* play2) { ptr->unk_00 = 3; ptr->unk_2C.x = 0.05f; ptr->unk_2C.y = 0.2f; - ptr->unk_10 = D_80A5AFB0; - ptr->unk_1C = D_80A5AFB0; + ptr->unk_10 = sZeroVec; + ptr->unk_1C = sZeroVec; ptr->unk_3C = 150; ptr->unk_28 = Rand_ZeroFloat(5.0f) + 7.0f; } else { @@ -359,8 +358,8 @@ void func_80A599E8(EnWaterEffect* this, Vec3f* arg1, u8 arg2) { ptr->unk_00 = 4; ptr->unk_04 = *arg1; - ptr->unk_1C = D_80A5AFB0; - ptr->unk_10 = D_80A5AFB0; + ptr->unk_1C = sZeroVec; + ptr->unk_10 = sZeroVec; if ((arg2 == 0) || (arg2 == 2)) { ptr->unk_1C.y = -1.0f; 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 929f571452..e736c1c413 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -446,7 +446,7 @@ s32 func_80990948(PlayState* play, EnWf* this, s16 arg2) { return true; } - if (arg2 != 0) { + if (arg2) { if (!Actor_IsFacingPlayer(&this->actor, 7000)) { func_80992A74(this, play); return true; @@ -615,7 +615,7 @@ void func_80991280(EnWf* this, PlayState* play) { this->unk_298 = 0; } - if (!func_8099408C(play, this) && !func_80990948(play, this, 0)) { + if (!func_8099408C(play, this) && !func_80990948(play, this, false)) { phi_v1 = ABS_ALT(BINANG_SUB(player->actor.shape.rot.y, this->actor.shape.rot.y)); if ((this->actor.xzDistToPlayer < 80.0f) && (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) && (phi_v1 >= 0x1F40)) { @@ -679,7 +679,7 @@ void func_8099149C(EnWf* this, PlayState* play) { } SkelAnime_Update(&this->skelAnime); - if (!func_80990948(play, this, 0)) { + if (!func_80990948(play, this, false)) { if (!Actor_IsFacingPlayer(&this->actor, 0x11C7)) { if (Rand_ZeroOne() > 0.5f) { func_80991948(this); @@ -717,7 +717,7 @@ void func_8099177C(EnWf* this, PlayState* play) { f32 phi_f2; f32 phi_f12; - if (!func_8099408C(play, this) && !func_80990948(play, this, 0)) { + if (!func_8099408C(play, this) && !func_80990948(play, this, false)) { temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (temp_v0 > 0) { phi_v1 = (temp_v0 * 0.25f) + 2000.0f; @@ -777,7 +777,8 @@ void func_809919F4(EnWf* this, PlayState* play) { s16 temp_v0; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->unk_29A, 0x9C4); - if (!func_8099408C(play, this) && !func_80990948(play, this, 0)) { + + if (!func_8099408C(play, this) && !func_80990948(play, this, false)) { this->actor.world.rot.y = this->actor.shape.rot.y; sp26 = BINANG_ROT180(player->actor.shape.rot.y + this->unk_29A); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { @@ -868,7 +869,7 @@ void func_80991C80(EnWf* this, PlayState* play) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80991948(this); } else { - func_80990948(play, this, 1); + func_80990948(play, this, true); } } else { func_80991948(this); @@ -916,7 +917,7 @@ void func_80992068(EnWf* this, PlayState* play) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80991948(this); } else { - func_80990948(play, this, 1); + func_80990948(play, this, true); } } else { func_80991948(this); @@ -970,7 +971,7 @@ void func_809923E4(EnWf* this, PlayState* play) { if (this->actor.colChkInfo.health == 0) { func_80992D6C(this); } else { - func_80990948(play, this, 1); + func_80990948(play, this, true); } } } @@ -1002,7 +1003,7 @@ void func_809924EC(EnWf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { sp26 = this->actor.wallYaw - this->actor.shape.rot.y; - if (func_80990948(play, this, 0)) { + if (func_80990948(play, this, false)) { return; } @@ -1131,7 +1132,7 @@ void func_80992B8C(EnWf* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; SkelAnime_Update(&this->skelAnime); - if (!func_80990948(play, this, 0)) { + if (!func_80990948(play, this, false)) { this->unk_2A0--; if (this->unk_2A0 == 0) { sp28 = ABS_ALT(BINANG_SUB(player->actor.shape.rot.y, this->actor.yawTowardsPlayer)); diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index cb2aeea09d..7d397a1c06 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -106,15 +106,15 @@ void func_80ACB7F4(ObjAqua* this, PlayState* play) { void func_80ACB940(ObjAqua* this, PlayState* play) { s32 pad; Vec3f effectPos; - Vec3f effectVel; + Vec3f effectVelocity; - effectVel.x = Rand_ZeroOne() - 0.5f; - effectVel.y = 2.0f; - effectVel.z = Rand_ZeroOne() - 0.5f; - effectPos.x = this->actor.world.pos.x + (effectVel.x * 40.0f); + effectVelocity.x = Rand_ZeroOne() - 0.5f; + effectVelocity.y = 2.0f; + effectVelocity.z = Rand_ZeroOne() - 0.5f; + effectPos.x = this->actor.world.pos.x + (effectVelocity.x * 40.0f); effectPos.y = this->actor.world.pos.y; - effectPos.z = this->actor.world.pos.z + (effectVel.z * 40.0f); - EffectSsIceSmoke_Spawn(play, &effectPos, &effectVel, &gZeroVec3f, (s32)(Rand_ZeroOne() * 24.0f) + 70); + effectPos.z = this->actor.world.pos.z + (effectVelocity.z * 40.0f); + EffectSsIceSmoke_Spawn(play, &effectPos, &effectVelocity, &gZeroVec3f, (s32)(Rand_ZeroOne() * 24.0f) + 70); } void func_80ACBA10(ObjAqua* this) { diff --git a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c index 29e0956b3d..3c3a2d8bc1 100644 --- a/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c +++ b/src/overlays/actors/ovl_Obj_Hakaisi/z_obj_hakaisi.c @@ -223,7 +223,7 @@ void func_80B14648(ObjHakaisi* this, PlayState* play) { if ((this->unk_19E > 20) && (this->dyna.actor.colChkInfo.health <= 20)) { func_80B14A24(this, play, this->unk_160[this->unk_194]); func_80B14A24(this, play, this->unk_160[this->unk_194]); - func_80B14F4C(this, play, 0); + func_80B14F4C(this, play, false); func_80B14B6C(this, play, this->unk_160[this->unk_194], 40); this->unk_194 = 1; } else if ((this->unk_19E > 10) && (this->dyna.actor.colChkInfo.health <= 10)) { @@ -319,7 +319,7 @@ void func_80B14CF8(PlayState* play, Vec3f vec, s16 arg2, s16 arg3, s32 arg4) { } void func_80B14F4C(ObjHakaisi* this, PlayState* play, s32 arg2) { - if (arg2 == 0) { + if (!arg2) { Actor_Spawn(&play->actorCtx, play, ACTOR_OBJ_HAKAISI, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 55.0f, this->dyna.actor.world.pos.z - 10.0f, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, 4); diff --git a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c index 5d0c7ede64..523155cec5 100644 --- a/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c +++ b/src/overlays/actors/ovl_Obj_Iceblock/z_obj_iceblock.c @@ -1194,7 +1194,6 @@ void func_80A25FD4(ObjIceblock* this, PlayState* play) { s32 pad; s32 sp30; s32 sp2C; - Vec3f sp20; func_80A23690(this); func_80A23F90(this, play); @@ -1204,16 +1203,18 @@ void func_80A25FD4(ObjIceblock* this, PlayState* play) { if (sp2C == -1) { sp30 = false; - } else if (!(this->unk_1B0 & 2) && (this->unk_26E[sp2C] >= 11) && !func_80A24118(this, play, 2.0f, &sp20) && - !Player_InCsMode(play)) { - func_80A23370(this, sp2C); - func_80A260E8(this); - sp30 = false; - Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, PLAYER_CSACTION_WAIT); - this->unk_1B0 |= 1; - } + } else { + Vec3f sp20; - if (this) {} + if (!(this->unk_1B0 & 2) && (this->unk_26E[sp2C] >= 11) && !func_80A24118(this, play, 2.0f, &sp20) && + !Player_InCsMode(play)) { + func_80A23370(this, sp2C); + func_80A260E8(this); + sp30 = false; + Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, PLAYER_CSACTION_WAIT); + this->unk_1B0 |= 1; + } + } if (sp30) { func_80A2541C(this, play); diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index 1ca9d95d0e..4a939bd6b4 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -58,7 +58,7 @@ static f32 yOffsets[] = { -18.0f, -9.0f }; void func_8093D3C0(ObjLift* this, PlayState* play) { Vec3f pos; - Vec3f vel; + Vec3f velocity; Vec3f* actorPos = &this->dyna.actor.world.pos; s32 i; s32 rand; @@ -69,9 +69,9 @@ void func_8093D3C0(ObjLift* this, PlayState* play) { pos.y = actorPos->y; pos.z = (D_8093DD60[i].z * this->dyna.actor.scale.z) + actorPos->z; - vel.x = D_8093DD60[i].x * this->dyna.actor.scale.x * 0.8f; - vel.y = (Rand_ZeroOne() * 10.0f) + 6.0f; - vel.z = D_8093DD60[i].z * this->dyna.actor.scale.z * 0.8f; + velocity.x = D_8093DD60[i].x * this->dyna.actor.scale.x * 0.8f; + velocity.y = (Rand_ZeroOne() * 10.0f) + 6.0f; + velocity.z = D_8093DD60[i].z * this->dyna.actor.scale.z * 0.8f; if ((s32)Rand_Next() > 0) { rand = 0x40; @@ -79,7 +79,7 @@ void func_8093D3C0(ObjLift* this, PlayState* play) { rand = 0x20; } - EffectSsKakera_Spawn(play, &pos, &vel, actorPos, -0x100, rand, 15, 15, 0, + EffectSsKakera_Spawn(play, &pos, &velocity, actorPos, -0x100, rand, 15, 15, 0, ((Rand_ZeroOne() * 50.0f) + 50.0f) * this->dyna.actor.scale.x, 0, 32, 50, -1, OBJECT_D_LIFT, gDampeGraveBrownElevatorDL); } diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index dc5b112a5f..c0714d49b8 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -97,12 +97,12 @@ void ObjLightswitch_InitCollider(ObjLightswitch* this, PlayState* play) { } void ObjLightswitch_UpdateSwitchFlags(ObjLightswitch* this, PlayState* play, s32 set) { - if (this) {} + Actor* thisx = &this->actor; if (set) { - Flags_SetSwitch(play, LIGHTSWITCH_GET_SWITCH_FLAG(&this->actor)); + Flags_SetSwitch(play, LIGHTSWITCH_GET_SWITCH_FLAG(thisx)); } else { - Flags_UnsetSwitch(play, LIGHTSWITCH_GET_SWITCH_FLAG(&this->actor)); + Flags_UnsetSwitch(play, LIGHTSWITCH_GET_SWITCH_FLAG(thisx)); } } diff --git a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c index ce2507b397..15e0f4534f 100644 --- a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c +++ b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c @@ -538,41 +538,41 @@ void func_80B3A498(ObjSnowball2* this) { } void func_80B3A500(ObjSnowball2* this, PlayState* play) { + Actor* thisx = &this->actor; f32 phi_f0; - s32 pad; - f32 temp_f14 = this->actor.home.pos.y - this->actor.world.pos.y; - f32 temp_f12 = this->actor.scale.y * 600.0f; + f32 temp_f14 = thisx->home.pos.y - thisx->world.pos.y; + f32 temp_f12 = thisx->scale.y * 600.0f; this->unk_1AC--; - this->actor.speed *= 0.7f; + thisx->speed *= 0.7f; this->unk_1A8 >>= 1; this->unk_1AA >>= 1; - this->actor.shape.rot.x += this->unk_1A8; - this->actor.shape.rot.y += this->unk_1AA; + thisx->shape.rot.x += this->unk_1A8; + thisx->shape.rot.y += this->unk_1AA; if (temp_f14 < -temp_f12) { - this->actor.gravity = this->actor.scale.y * -40.0f; + thisx->gravity = thisx->scale.y * -40.0f; phi_f0 = 0.94f; } else if (temp_f12 < temp_f14) { - this->actor.gravity = this->actor.scale.y * 24.0f; + thisx->gravity = thisx->scale.y * 24.0f; phi_f0 = 0.8f; } else if (temp_f12 > 0.001f) { - this->actor.gravity = (((1.6f * temp_f14) / temp_f12) + -1.0f + 0.6f) * 0.5f * 40.0f * this->actor.scale.y; + thisx->gravity = (((1.6f * temp_f14) / temp_f12) + -1.0f + 0.6f) * 0.5f * 40.0f * thisx->scale.y; phi_f0 = (((-0.13999999f * temp_f14) / temp_f12) + 0.94f + 0.8f) * 0.5f; } else { - this->actor.gravity = 0.0f; + thisx->gravity = 0.0f; phi_f0 = 1.0f; } - this->actor.velocity.y *= phi_f0; - this->actor.velocity.y += this->actor.gravity; - this->actor.world.pos.y += this->actor.velocity.y; + thisx->velocity.y *= phi_f0; + thisx->velocity.y += thisx->gravity; + thisx->world.pos.y += thisx->velocity.y; if (((play->gameplayFrames % 16) == 0) || ((Rand_Next() >> 0x10) == 0)) { - func_80B395C4(play, &this->actor.home.pos); + func_80B395C4(play, &thisx->home.pos); } if (this->unk_1AC <= 0) { @@ -581,13 +581,12 @@ void func_80B3A500(ObjSnowball2* this, PlayState* play) { } if (this->unk_1AC < 20) { - this->actor.scale.x -= 0.00125f; - if (this) {} - this->actor.scale.y = this->actor.scale.x; - this->actor.scale.z = this->actor.scale.x; + thisx->scale.x -= 0.00125f; + thisx->scale.y = thisx->scale.x; + thisx->scale.z = thisx->scale.x; if ((this->unk_1AC >= 6) && (temp_f14 < temp_f12)) { - func_80B39638(play, &this->actor.home.pos); + func_80B39638(play, &thisx->home.pos); } if (this->unk_1AC == 10) { diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index db45b7a79e..3bf31dba9f 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -206,7 +206,7 @@ void ObjTsubo_Init(Actor* thisx, PlayState* play) { } void ObjTsubo_Destroy(Actor* thisx, PlayState* play2) { - PlayState* play = (PlayState*)play2; + PlayState* play = play2; ObjTsubo* this = (ObjTsubo*)thisx; Collider_DestroyCylinder(play, &this->cylinderCollider); @@ -218,7 +218,7 @@ void ObjTsubo_PotBreak1(ObjTsubo* this, PlayState* play) { s32 phi_s0; s32 pad; Vec3f pos; - Vec3f vel; + Vec3f velocity; ObjTsuboData* typeData = &sPotTypeData[OBJ_TSUBO_GET_TYPE(&this->actor)]; f32 randf; f32 sin; @@ -232,9 +232,9 @@ void ObjTsubo_PotBreak1(ObjTsubo* this, PlayState* play) { pos.x = sin * 8.0f; pos.y = Rand_ZeroOne() * 12.0f + 2.0f; pos.z = cos * 8.0f; - vel.x = pos.x * 0.23f; - vel.y = Rand_ZeroOne() * 5.0f + 2.5f; - vel.z = pos.z * 0.23f; + velocity.x = pos.x * 0.23f; + velocity.y = Rand_ZeroOne() * 5.0f + 2.5f; + velocity.z = pos.z * 0.23f; Math_Vec3f_Sum(&pos, &this->actor.world.pos, &pos); randf = Rand_ZeroOne(); if (randf < 0.2f) { @@ -245,7 +245,7 @@ void ObjTsubo_PotBreak1(ObjTsubo* this, PlayState* play) { phi_s0 = 0x20; } scale = Rand_ZeroOne() * 110.0f + 15.0f; - EffectSsKakera_Spawn(play, &pos, &vel, &this->actor.world.pos, -260, phi_s0, 20, 0, 0, scale, 0, 0, 50, -1, + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -260, phi_s0, 20, 0, 0, scale, 0, 0, 50, -1, typeData->objectId, typeData->shardDL); } func_800BBFB0(play, &this->actor.world.pos, 30.0f, 2, 20, 50, true); @@ -258,7 +258,7 @@ void ObjTsubo_MagicPotBreak1(ObjTsubo* this, PlayState* play) { s32 i; ObjTsuboData* typeData = &sPotTypeData[OBJ_TSUBO_GET_TYPE(&this->actor)]; Vec3f pos; - Vec3f vel; + Vec3f velocity; f32 randf; f32 sin; f32 cos; @@ -271,9 +271,9 @@ void ObjTsubo_MagicPotBreak1(ObjTsubo* this, PlayState* play) { pos.x = sin * 10.0f; pos.y = Rand_ZeroOne() * 20.0f + 2.0f; pos.z = cos * 10.0f; - vel.x = pos.x * 0.3f; - vel.y = Rand_ZeroOne() * 10.0f + 2.0f; - vel.z = pos.z * 0.3f; + velocity.x = pos.x * 0.3f; + velocity.y = Rand_ZeroOne() * 10.0f + 2.0f; + velocity.z = pos.z * 0.3f; Math_Vec3f_Sum(&pos, &this->actor.world.pos, &pos); randf = Rand_ZeroOne(); if (randf < 0.2f) { @@ -284,7 +284,7 @@ void ObjTsubo_MagicPotBreak1(ObjTsubo* this, PlayState* play) { phi_s0 = 0xA0; } scale = Rand_ZeroOne() * 160.0f + 15.0f; - EffectSsKakera_Spawn(play, &pos, &vel, &this->actor.world.pos, -340, phi_s0, 20, 0, 0, scale, 0, 0, 50, -1, + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -340, phi_s0, 20, 0, 0, scale, 0, 0, 50, -1, typeData->objectId, typeData->shardDL); } func_800BBFB0(play, &this->actor.world.pos, 50.0f, 2, 40, 50, true); @@ -292,12 +292,12 @@ void ObjTsubo_MagicPotBreak1(ObjTsubo* this, PlayState* play) { } void ObjTsubo_PotBreak2(ObjTsubo* this, PlayState* play2) { - PlayState* play = (PlayState*)play2; + PlayState* play = play2; s16 rot; s32 i; s32 phi_s0; Vec3f pos; - Vec3f vel; + Vec3f velocity; Vec3f* worldPos = &this->actor.world.pos; ObjTsuboData* typeData = &sPotTypeData[OBJ_TSUBO_GET_TYPE(&this->actor)]; f32 sin; @@ -320,9 +320,9 @@ void ObjTsubo_PotBreak2(ObjTsubo* this, PlayState* play2) { pos.x = sin * 8.0f; pos.y = (Rand_ZeroOne() * 5.0f) + 2.0f; pos.z = cos * 8.0f; - vel.x = pos.x * 0.2f; - vel.y = (Rand_ZeroOne() * 4.0f) + 2.0f; - vel.z = pos.z * 0.2f; + velocity.x = pos.x * 0.2f; + velocity.y = (Rand_ZeroOne() * 4.0f) + 2.0f; + velocity.z = pos.z * 0.2f; Math_Vec3f_Sum(&pos, worldPos, &pos); if (Rand_ZeroOne() < .2f) { phi_s0 = 0x40; @@ -330,18 +330,18 @@ void ObjTsubo_PotBreak2(ObjTsubo* this, PlayState* play2) { phi_s0 = 0x20; } scale = Rand_ZeroOne() * 105.0f + 10.0f; - EffectSsKakera_Spawn(play, &pos, &vel, worldPos, -170, phi_s0, 50, 5, 0, scale, 0, 0, 70, -1, + EffectSsKakera_Spawn(play, &pos, &velocity, worldPos, -170, phi_s0, 50, 5, 0, scale, 0, 0, 70, -1, typeData->objectId, typeData->shardDL); } } void ObjTsubo_MagicPotBreak2(ObjTsubo* this, PlayState* play2) { - PlayState* play = (PlayState*)play2; + PlayState* play = play2; s32 pad; s16 rot; s32 i; Vec3f pos; - Vec3f vel; + Vec3f velocity; ObjTsuboData* typeData = &sPotTypeData[OBJ_TSUBO_GET_TYPE(&this->actor)]; Vec3f* worldPos = &this->actor.world.pos; f32 sin; @@ -365,9 +365,9 @@ void ObjTsubo_MagicPotBreak2(ObjTsubo* this, PlayState* play2) { pos.x = sin * 10.0f; pos.y = (Rand_ZeroOne() * 15.0f) + 2.0f; pos.z = cos * 10.0f; - vel.x = pos.x * 0.3f; - vel.y = (Rand_ZeroOne() * 4.0f) + 2.0f; - vel.z = pos.z * 0.3f; + velocity.x = pos.x * 0.3f; + velocity.y = (Rand_ZeroOne() * 4.0f) + 2.0f; + velocity.z = pos.z * 0.3f; Math_Vec3f_Sum(&pos, worldPos, &pos); if (Rand_ZeroOne() < 0.2f) { phi_s0 = 0xC0; @@ -375,48 +375,54 @@ void ObjTsubo_MagicPotBreak2(ObjTsubo* this, PlayState* play2) { phi_s0 = 0xA0; } scale = (Rand_ZeroOne() * 150.0f) + 10.0f; - EffectSsKakera_Spawn(play, &pos, &vel, worldPos, -170, phi_s0, 50, 5, 0, scale, 0, 0, 70, -1, + EffectSsKakera_Spawn(play, &pos, &velocity, worldPos, -170, phi_s0, 50, 5, 0, scale, 0, 0, 70, -1, typeData->objectId, typeData->shardDL); } } void ObjTsubo_PotBreak3(ObjTsubo* this, PlayState* play2) { - PlayState* play = (PlayState*)play2; - s32 i; + PlayState* play = play2; + Actor* thisx = &this->actor; s16 rot; s32 phi_s0; Vec3f pos; - Vec3f vel; + Vec3f velocity; ObjTsuboData* typeData = &sPotTypeData[OBJ_TSUBO_GET_TYPE(&this->actor)]; f32 randf; f32 temp_f20; f32 cos; f32 sin; + s32 i; for (i = 0, rot = 0; i < 13; i++, rot += 0x4E20) { randf = Rand_ZeroOne(); temp_f20 = (1.0f - SQ(randf)) * 4.8f + 3.2f; - if (this) {} sin = Math_SinS(rot); cos = Math_CosS(rot); + pos.x = sin * temp_f20; pos.y = (Rand_ZeroOne() * 15.0f) + 2.0f; pos.z = cos * temp_f20; - vel.x = pos.x * 0.4f; - vel.y = (Rand_ZeroOne() * 4.0f) + 4.0f; - vel.z = pos.z * 0.4f; + + velocity.x = pos.x * 0.4f; + velocity.y = (Rand_ZeroOne() * 4.0f) + 4.0f; + velocity.z = pos.z * 0.4f; + Math_Vec3f_Sum(&pos, &this->actor.world.pos, &pos); + if (Rand_ZeroOne() < 0.2f) { phi_s0 = 0x40; } else { phi_s0 = 0x20; } - EffectSsKakera_Spawn(play, &pos, &vel, &this->actor.world.pos, -170, phi_s0, 50, 3, 0, + + EffectSsKakera_Spawn(play, &pos, &velocity, &this->actor.world.pos, -170, phi_s0, 50, 3, 0, (Rand_ZeroOne() * 105.0f) + 10.0f, 0, 0, 70, -1, typeData->objectId, typeData->shardDL); } + for (i = 0; i < 7; i++) { - EffectSsBubble_Spawn(play, &this->actor.world.pos, 20.0f, 30.0f, 40.0f, (Rand_ZeroOne() * 0.06f) + 0.09f); - EffectSsBubble_Spawn(play, &this->actor.world.pos, 10.0f, 10.0f, 10.0f, (Rand_ZeroOne() * 0.08f) + 0.09f); + EffectSsBubble_Spawn(play, &thisx->world.pos, 20.0f, 30.0f, 40.0f, (Rand_ZeroOne() * 0.06f) + 0.09f); + EffectSsBubble_Spawn(play, &thisx->world.pos, 10.0f, 10.0f, 10.0f, (Rand_ZeroOne() * 0.08f) + 0.09f); } } @@ -692,7 +698,7 @@ void ObjTsubo_Update(Actor* thisx, PlayState* play) { } void ObjTsubo_Draw(Actor* thisx, PlayState* play2) { - PlayState* play = (PlayState*)play2; + PlayState* play = play2; Gfx_DrawDListOpa(play, sPotTypeData[OBJ_TSUBO_GET_TYPE(thisx)].modelDL); } diff --git a/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c b/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c index a998431203..75375d8173 100644 --- a/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c +++ b/src/overlays/actors/ovl_Obj_Wind/z_obj_wind.c @@ -132,7 +132,7 @@ void ObjWind_Update(Actor* thisx, PlayState* play) { } temp_ft0 = ((f32)entry->unk_6 / 100.0f) * (upXZ / entry->unk_2 * var_fa0); if (upXZ != 0.0f) { - // FAKE: + //! FAKE: if (1) {} upXZ = 1.0f / upXZ; } diff --git a/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c b/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c index 2a15d11c96..8af51f0695 100644 --- a/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c +++ b/src/overlays/actors/ovl_TG_Sw/z_tg_sw.c @@ -51,38 +51,39 @@ void TGSw_ActionDecider(TGSw* this, PlayState* play) { } void TGSw_ActionExecuteOneShot(TGSw* this, PlayState* play) { - Actor* actor = NULL; + Actor* actorIter = NULL; + // FAKE: if (1) {} do { - actor = SubS_FindActor(play, actor, ACTORCAT_ENEMY, ACTOR_EN_SW); - if (actor == NULL) { + actorIter = SubS_FindActor(play, actorIter, ACTORCAT_ENEMY, ACTOR_EN_SW); + if (actorIter == NULL) { break; } - if ((((this->actor.params & 0xFC) >> 2) & 0xFF) == (((actor->params & 0xFC) >> 2) & 0xFF)) { - actor->parent = &this->actor; - actor->speed = ABS_ALT(this->actor.world.rot.x); + if ((((this->actor.params & 0xFC) >> 2) & 0xFF) == (((actorIter->params & 0xFC) >> 2) & 0xFF)) { + actorIter->parent = &this->actor; + actorIter->speed = ABS_ALT(this->actor.world.rot.x); break; } - actor = actor->next; - } while (actor != NULL); + actorIter = actorIter->next; + } while (actorIter != NULL); - actor = NULL; + actorIter = NULL; do { - actor = SubS_FindActor(play, actor, ACTORCAT_NPC, ACTOR_EN_SW); + actorIter = SubS_FindActor(play, actorIter, ACTORCAT_NPC, ACTOR_EN_SW); - if (actor == NULL) { + if (actorIter == NULL) { break; } - if ((((this->actor.params & 0xFC) >> 2) & 0xFF) == (((actor->params & 0xFC) >> 2) & 0xFF)) { - actor->parent = &this->actor; - actor->speed = ABS_ALT(this->actor.world.rot.x); + if ((((this->actor.params & 0xFC) >> 2) & 0xFF) == (((actorIter->params & 0xFC) >> 2) & 0xFF)) { + actorIter->parent = &this->actor; + actorIter->speed = ABS_ALT(this->actor.world.rot.x); break; } - actor = actor->next; - } while (actor != NULL); + actorIter = actorIter->next; + } while (actorIter != NULL); Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index e5b049233b..8e2a77a1fe 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -9799,7 +9799,7 @@ void func_8083F358(Player* this, s32 arg1, PlayState* play) { Math_ScaledStepToS(&this->unk_B70, var_a1, 0x190); if ((this->modelAnimType == PLAYER_ANIMTYPE_3) || ((this->unk_B70 == 0) && (this->unk_AB8 <= 0.0f))) { - if (arg1 == 0) { + if (!arg1) { PlayerAnimation_LoadToJoint(play, &this->skelAnime, D_8085BE84[PLAYER_ANIMGROUP_walk][this->modelAnimType], this->unk_B38); } else { @@ -9827,7 +9827,7 @@ void func_8083F358(Player* this, s32 arg1, PlayState* play) { climbAnim = &gPlayerAnim_link_normal_climb_up; } - if (arg1 == 0) { + if (!arg1) { PlayerAnimation_BlendToJoint(play, &this->skelAnime, D_8085BE84[PLAYER_ANIMGROUP_walk][this->modelAnimType], this->unk_B38, climbAnim, this->unk_B38, var_fv1, this->blendTableBuffer); } else { @@ -9859,7 +9859,7 @@ void func_8083F57C(Player* this, PlayState* play) { if (temp_fv0 < 0.0f) { var_fs0 = 1.0f; func_8083EA44(this, (REG(35) / 1000.0f) + ((REG(36) / 1000.0f) * this->linearVelocity)); - func_8083F358(this, 0, play); + func_8083F358(this, false, play); } else { var_fs0 = (REG(37) / 1000.0f) * temp_fv0; if (var_fs0 < 1.0f) { @@ -9868,7 +9868,7 @@ void func_8083F57C(Player* this, PlayState* play) { var_fs0 = 1.0f; func_8083EA44(this, (REG(39) / 100.0f) + ((REG(38) / 1000.0f) * temp_fv0)); } - func_8083F358(this, 1, play); + func_8083F358(this, true, play); PlayerAnimation_LoadToJoint(play, &this->skelAnime, func_8082EEE0(this), this->unk_B38 * (20.0f / 29.0f)); } } @@ -19105,7 +19105,7 @@ void Player_Action_96(Player* this, PlayState* play) { } if (spB8 != 0.0f) { - f32 pad; + s32 pad; f32 sp54 = spB8 - 0.3f; sp54 = CLAMP_MIN(sp54, 0.0f); diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c index 0c0cd14477..088c253c25 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c @@ -1661,8 +1661,6 @@ void FileSelect_DrawWindowContents(GameState* thisx) { s16 i; s16 quadVtxIndex; - if (1) {} - OPEN_DISPS(this->state.gfxCtx); // draw title label diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index f803eb10cd..5362e5e49a 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -7578,7 +7578,7 @@ 0x809495D8:("EnClearTag_Draw",), 0x809495F8:("EnClearTag_UpdateEffects",), 0x80949BD4:("EnClearTag_DrawEffects",), - 0x8094DEE0:("func_8094DEE0",), + 0x8094DEE0:("EnGm_FindActor",), 0x8094DF90:("func_8094DF90",), 0x8094DFF8:("EnGm_UpdateSkelAnime",), 0x8094E054:("EnGm_ChangeAnim",), @@ -12728,7 +12728,7 @@ 0x80AF79B0:("EnSnowwd_Draw",), 0x80AF7B40:("func_80AF7B40",), 0x80AF7BAC:("func_80AF7BAC",), - 0x80AF7CB0:("func_80AF7CB0",), + 0x80AF7CB0:("EnPm_FindActor",), 0x80AF7D60:("func_80AF7D60",), 0x80AF7DC4:("func_80AF7DC4",), 0x80AF7E6C:("func_80AF7E6C",), @@ -15733,7 +15733,7 @@ 0x80BD2380:("EnZov_OverrideLimbDraw",), 0x80BD2404:("EnZov_PostLimbDraw",), 0x80BD24B4:("EnZov_Draw",), - 0x80BD2A30:("func_80BD2A30",), + 0x80BD2A30:("EnAh_FindActor",), 0x80BD2AE0:("EnAh_UpdateSkelAnime",), 0x80BD2B0C:("EnAh_ChangeAnim",), 0x80BD2BA4:("func_80BD2BA4",), @@ -15999,7 +15999,7 @@ 0x80BDE058:("func_80BDE058",), 0x80BDE090:("func_80BDE090",), 0x80BDE11C:("EnTalk_Update",), - 0x80BDE1A0:("func_80BDE1A0",), + 0x80BDE1A0:("EnAl_FindActor",), 0x80BDE250:("EnAl_UpdateSkelAnime",), 0x80BDE27C:("EnAl_ChangeAnim",), 0x80BDE318:("func_80BDE318",), @@ -16033,7 +16033,7 @@ 0x80BDF950:("EnAl_PostLimbDraw",), 0x80BDFA34:("EnAl_TransformLimbDraw",), 0x80BDFB30:("EnAl_Draw",), - 0x80BE04E0:("func_80BE04E0",), + 0x80BE04E0:("EnTab_FindActor",), 0x80BE0590:("func_80BE0590",), 0x80BE05BC:("func_80BE05BC",), 0x80BE0620:("func_80BE0620",), @@ -16281,7 +16281,7 @@ 0x80BF0DE0:("func_80BF0DE0",), 0x80BF0EEC:("EffStk_Update",), 0x80BF0F10:("EffStk_Draw",), - 0x80BF1150:("func_80BF1150",), + 0x80BF1150:("EnIg_FindActor",), 0x80BF1200:("func_80BF1200",), 0x80BF1258:("EnIg_UpdateSkelAnime",), 0x80BF1284:("EnIg_ChangeAnim",), @@ -16958,7 +16958,7 @@ 0x80C1D458:("func_80C1D458",), 0x80C1D4D0:("func_80C1D4D0",), 0x80C1D6E0:("func_80C1D6E0",), - 0x80C1D78C:("func_80C1D78C",), + 0x80C1D78C:("DmAh_FindAnjuActor",), 0x80C1D7FC:("DmAh_HandleCutscene",), 0x80C1D92C:("DmAh_DoNothing",), 0x80C1D93C:("DmAh_Init",), @@ -17049,7 +17049,7 @@ 0x80C21858:("EnHintSkb_OverrideLimbDraw",), 0x80C219D4:("EnHintSkb_PostLimbDraw",), 0x80C21B9C:("EnHintSkb_Draw",), - 0x80C22350:("func_80C22350",), + 0x80C22350:("DmTag_FindActor",), 0x80C22400:("func_80C22400",), 0x80C2247C:("func_80C2247C",), 0x80C224D8:("func_80C224D8",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 12f669bad2..188ff2c1d8 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -11589,7 +11589,7 @@ 0x80A58524:("D_80A58524","f32","",0x4), 0x80A58528:("D_80A58528","f32","",0x4), 0x80A5AF90:("En_Water_Effect_InitVars","UNK_TYPE1","",0x1), - 0x80A5AFB0:("D_80A5AFB0","UNK_TYPE4","",0x4), + 0x80A5AFB0:("sZeroVec","UNK_TYPE4","",0x4), 0x80A5AFBC:("D_80A5AFBC","UNK_TYPE4","",0x4), 0x80A5AFD0:("D_80A5AFD0","f32","",0x4), 0x80A5AFD4:("D_80A5AFD4","f32","",0x4),