From f2c06ce441a38a032202b9024fdfa57bb36a67c2 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Wed, 22 Nov 2023 20:19:31 +1100 Subject: [PATCH] Misc Cleanup (#1585) * misc cleanup * more fake matches * revert for sym --- src/audio/lib/effects.c | 2 +- src/audio/lib/heap.c | 4 +- src/audio/lib/load.c | 40 ++++++++++--------- src/code/code_800FCE80.c | 4 +- src/code/graph.c | 1 - src/code/z_camera.c | 13 +++--- src/code/z_eff_blure.c | 4 +- src/code/z_effect.c | 18 ++++----- src/code/z_kankyo.c | 8 ++-- src/code/z_lights.c | 2 +- src/code/z_message_PAL.c | 19 ++++----- src/code/z_player_lib.c | 2 +- src/libultra/gu/rotate.c | 2 +- .../ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c | 7 +--- .../z_bg_spot06_objects.c | 2 +- .../z_bg_spot08_iceblock.c | 2 +- .../z_bg_spot16_bombstone.c | 2 +- .../ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c | 2 +- .../actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c | 2 +- .../actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c | 7 +--- src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c | 6 +-- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.c | 2 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 25 +++++------- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 2 +- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 10 ++--- src/overlays/actors/ovl_Boss_Va/z_boss_va.c | 2 +- src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c | 2 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 10 +---- src/overlays/actors/ovl_En_Boom/z_en_boom.c | 2 +- src/overlays/actors/ovl_En_Bx/z_en_bx.c | 3 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 2 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 2 +- .../actors/ovl_En_Floormas/z_en_floormas.c | 2 +- src/overlays/actors/ovl_En_Goma/z_en_goma.c | 4 +- .../actors/ovl_En_Heishi2/z_en_heishi2.c | 6 +-- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 28 ++++++------- .../actors/ovl_En_Peehat/z_en_peehat.c | 2 +- .../ovl_En_River_Sound/z_en_river_sound.c | 2 +- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 1 - src/overlays/actors/ovl_En_Sw/z_en_sw.c | 6 +-- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 10 ++--- .../actors/ovl_Obj_Switch/z_obj_switch.c | 1 - .../actors/ovl_player_actor/z_player.c | 8 ++-- .../z_eff_ss_g_ripple.c | 8 ++-- .../z_eff_ss_ice_piece.c | 6 +-- 45 files changed, 134 insertions(+), 161 deletions(-) diff --git a/src/audio/lib/effects.c b/src/audio/lib/effects.c index 6844d8ae57..8de03887e9 100644 --- a/src/audio/lib/effects.c +++ b/src/audio/lib/effects.c @@ -269,7 +269,7 @@ f32 Audio_AdsrUpdate(AdsrState* adsr) { adsr->delay = 1; } adsr->target = adsr->envelope[adsr->envIndex].arg / 32767.0f; - adsr->target = adsr->target * adsr->target; + adsr->target = SQ(adsr->target); adsr->velocity = (adsr->target - adsr->current) / adsr->delay; adsr->action.s.state = ADSR_STATE_FADE; adsr->envIndex++; diff --git a/src/audio/lib/heap.c b/src/audio/lib/heap.c index 4b586c8c5e..899cf912b9 100644 --- a/src/audio/lib/heap.c +++ b/src/audio/lib/heap.c @@ -1356,8 +1356,8 @@ void AudioHeap_ChangeStorage(StorageChange* change, Sample* sample) { u32 startAddr = change->oldAddr; u32 endAddr = change->oldAddr + change->size; - if (startAddr <= (u32)sample->sampleAddr && (u32)sample->sampleAddr < endAddr) { - sample->sampleAddr = sample->sampleAddr - startAddr + change->newAddr; + if (((u32)sample->sampleAddr >= startAddr) && ((u32)sample->sampleAddr < endAddr)) { + sample->sampleAddr += -startAddr + change->newAddr; sample->medium = change->newMedium; } } diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index f30527d971..b7b674a237 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -789,7 +789,7 @@ AudioTable* AudioLoad_GetLoadTable(s32 tableType) { * Also relocate offsets into pointers within this loaded soundFont * * @param fontId index of font being processed - * @param fontData ram address of raw soundfont binary loaded into cache + * @param fontDataStartAddr ram address of raw soundfont binary loaded into cache * @param sampleBankReloc information on the sampleBank containing raw audio samples */ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, SampleBankRelocInfo* sampleBankReloc) { @@ -811,7 +811,6 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample // The first u32 in fontData is an offset to a list of offsets to the drums soundListOffset = fontData[0]; - if (1) {} // If the soundFont has drums if ((soundListOffset != 0) && (numDrums != 0)) { @@ -824,20 +823,24 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample soundOffset = (u32)((Drum**)fontData[0])[i]; // Some drum data entries are empty, represented by an offset of 0 in the list of drum offsets - if (soundOffset != 0) { - soundOffset = RELOC_TO_RAM(soundOffset); - ((Drum**)fontData[0])[i] = drum = (Drum*)soundOffset; - - // The drum may be in the list multiple times and already relocated - if (!drum->isRelocated) { - AudioLoad_RelocateSample(&drum->tunedSample, fontDataStartAddr, sampleBankReloc); - - soundOffset = (u32)drum->envelope; - drum->envelope = (EnvelopePoint*)RELOC_TO_RAM(soundOffset); - - drum->isRelocated = true; - } + if (soundOffset == 0) { + continue; } + + soundOffset = RELOC_TO_RAM(soundOffset); + ((Drum**)fontData[0])[i] = drum = (Drum*)soundOffset; + + // The drum may be in the list multiple times and already relocated + if (drum->isRelocated) { + continue; + } + + AudioLoad_RelocateSample(&drum->tunedSample, fontDataStartAddr, sampleBankReloc); + + soundOffset = (u32)drum->envelope; + drum->envelope = (EnvelopePoint*)RELOC_TO_RAM(soundOffset); + + drum->isRelocated = true; } } @@ -845,7 +848,6 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample // The second u32 in fontData is an offset to the first sound effect entry soundListOffset = fontData[1]; - if (1) {} // If the soundFont has sound effects if ((soundListOffset != 0) && (numSfx != 0)) { @@ -859,9 +861,11 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample soundEffect = (SoundEffect*)soundOffset; // Check for NULL (note: the pointer is guaranteed to be in fontData and can never be NULL) - if ((soundEffect != NULL) && ((u32)soundEffect->tunedSample.sample != 0)) { - AudioLoad_RelocateSample(&soundEffect->tunedSample, fontDataStartAddr, sampleBankReloc); + if ((soundEffect == NULL) || ((u32)soundEffect->tunedSample.sample == 0)) { + continue; } + + AudioLoad_RelocateSample(&soundEffect->tunedSample, fontDataStartAddr, sampleBankReloc); } } diff --git a/src/code/code_800FCE80.c b/src/code/code_800FCE80.c index 17b2bc4e57..8ac46833d9 100644 --- a/src/code/code_800FCE80.c +++ b/src/code/code_800FCE80.c @@ -50,8 +50,8 @@ f32 Math_FAtanTaylorQF(f32 x) { if (poly + term == poly) { break; } - poly = poly + term; - exp = exp * sq; + poly += term; + exp *= sq; } return poly; diff --git a/src/code/graph.c b/src/code/graph.c index fd79efac5c..8a0057c7b5 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -181,7 +181,6 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) { R_HREG_MODE = HREG_MODE_UCODE_DISAS; R_UCODE_DISAS_TOGGLE = 1; R_UCODE_DISAS_LOG_LEVEL = 2; - sPrevTaskWorkBuffer = sPrevTaskWorkBuffer; Graph_DisassembleUCode(sPrevTaskWorkBuffer); } diff --git a/src/code/z_camera.c b/src/code/z_camera.c index f2b7063016..9d7bf8a73f 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -1120,7 +1120,7 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targetPos, f playerToTargetDir.r = (playerToTargetDir.r * CAM_DATA_SCALED(OREG(39))) - (((CAM_DATA_SCALED(OREG(39)) - CAM_DATA_SCALED(OREG(38))) * playerToTargetDir.r) * (playerToTargetDir.r / distance)); - playerToTargetDir.r = playerToTargetDir.r - (playerToTargetDir.r * temp_f0_2) * temp_f0_2; + playerToTargetDir.r -= (playerToTargetDir.r * temp_f0_2) * temp_f0_2; } if (flags & CAM_LOCKON_AT_FLAG_OFF_GROUND) { @@ -1160,7 +1160,7 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targetPos, f *yPosOffset = *yPosOffset + (yPosDelta + temp_f0_2); yPosDelta = -temp_f0_2; } - playerToAtOffsetTarget.y = playerToAtOffsetTarget.y - yPosDelta; + playerToAtOffsetTarget.y -= yPosDelta; } else { yPosDelta = playerPosRot->pos.y - *yPosOffset; temp_f0_2 = Math_FAtan2F(yPosDelta, OLib_Vec3fDistXZ(at, &camera->eye)); @@ -4318,10 +4318,9 @@ s32 Camera_Subj3(Camera* camera) { tGeo.pitch = rwData->pitch; if (rwData->animTimer != 0) { temp_f0_3 = (1.0f / rwData->animTimer); - pad2 = at; - at->x = at->x + (sp98.x - pad2->x) * temp_f0_3; - at->y = at->y + (sp98.y - pad2->y) * temp_f0_3; - at->z = at->z + (sp98.z - pad2->z) * temp_f0_3; + at->x = F32_LERPIMP(at->x, sp98.x, temp_f0_3); + at->y = F32_LERPIMP(at->y, sp98.y, temp_f0_3); + at->z = F32_LERPIMP(at->z, sp98.z, temp_f0_3); temp_f0_3 = (1.0f / R_CAM_DEFAULT_ANIM_TIME); sp58 = (tGeo.r - sp84.r) * temp_f0_3; @@ -6964,7 +6963,7 @@ s32 Camera_Special9(Camera* camera) { doorParams->timer2--; if (doorParams->timer2 <= 0) { camera->animState++; - rwData->targetYaw = rwData->targetYaw - 0x7FFF; + rwData->targetYaw -= 0x7FFF; } else { break; } diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index 75f8d80bc0..d7d17af126 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -973,14 +973,14 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) { vtx[j + 1].v.ob[2] = EffectSs_LerpS16(elem->p2.z, elem->p1.z, ratio); break; case 3: - ratio = ratio * 0.5f; + ratio *= 0.5f; vtx[j].v.ob[0] = EffectSs_LerpS16(elem->p1.x, elem->p2.x, ratio); vtx[j].v.ob[1] = EffectSs_LerpS16(elem->p1.y, elem->p2.y, ratio); vtx[j].v.ob[2] = EffectSs_LerpS16(elem->p1.z, elem->p2.z, ratio); vtx[j + 1].v.ob[0] = EffectSs_LerpS16(elem->p2.x, elem->p1.x, ratio); vtx[j + 1].v.ob[1] = EffectSs_LerpS16(elem->p2.y, elem->p1.y, ratio); vtx[j + 1].v.ob[2] = EffectSs_LerpS16(elem->p2.z, elem->p1.z, ratio); - ratio = ratio + ratio; + ratio *= 2.0f; break; case 0: default: diff --git a/src/code/z_effect.c b/src/code/z_effect.c index dd5436bc2a..0ff1392a40 100644 --- a/src/code/z_effect.c +++ b/src/code/z_effect.c @@ -160,24 +160,24 @@ void Effect_DrawAll(GraphicsContext* gfxCtx) { s32 i; for (i = 0; i < SPARK_COUNT; i++) { - if (sEffectContext.sparks[i].status.active) { - sEffectInfoTable[EFFECT_SPARK].draw(&sEffectContext.sparks[i].effect, gfxCtx); + if (!sEffectContext.sparks[i].status.active) { + continue; } + sEffectInfoTable[EFFECT_SPARK].draw(&sEffectContext.sparks[i].effect, gfxCtx); } for (i = 0; i < BLURE_COUNT; i++) { - if (sEffectContext.blures[i].status.active) { - sEffectInfoTable[EFFECT_BLURE1].draw(&sEffectContext.blures[i].effect, gfxCtx); + if (!sEffectContext.blures[i].status.active) { + continue; } - if (1) {} // Necessary to match - if (1) {} + sEffectInfoTable[EFFECT_BLURE1].draw(&sEffectContext.blures[i].effect, gfxCtx); } for (i = 0; i < SHIELD_PARTICLE_COUNT; i++) { - if (sEffectContext.shieldParticles[i].status.active) { - if (gfxCtx) {} // Necessary to match - sEffectInfoTable[EFFECT_SHIELD_PARTICLE].draw(&sEffectContext.shieldParticles[i].effect, gfxCtx); + if (!sEffectContext.shieldParticles[i].status.active) { + continue; } + sEffectInfoTable[EFFECT_SHIELD_PARTICLE].draw(&sEffectContext.shieldParticles[i].effect, gfxCtx); } } diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 996a334d79..a160ba8633 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -2419,17 +2419,17 @@ void Environment_DrawSandstorm(PlayState* play, u8 sandstormState) { if (ABS(primA - primA1) < 9) { primA = primA1; } else if (primA1 < primA) { - primA = primA - 9; + primA -= 9; } else { - primA = primA + 9; + primA += 9; } if (ABS(envA - envA1) < 9) { envA = envA1; } else if (envA1 < envA) { - envA = envA - 9; + envA -= 9; } else { - envA = envA + 9; + envA += 9; } play->envCtx.sandstormPrimA = primA; diff --git a/src/code/z_lights.c b/src/code/z_lights.c index f01c49df2a..53b22cb394 100644 --- a/src/code/z_lights.c +++ b/src/code/z_lights.c @@ -108,7 +108,7 @@ void Lights_BindPoint(Lights* lights, LightParams* params, Vec3f* vec) { if (light != NULL) { posDiff = sqrtf(posDiff); - if (1) {} + scale = posDiff / scale; scale = 1 - SQ(scale); diff --git a/src/code/z_message_PAL.c b/src/code/z_message_PAL.c index 36a1333ed3..8313c667a6 100644 --- a/src/code/z_message_PAL.c +++ b/src/code/z_message_PAL.c @@ -848,7 +848,7 @@ void Message_HandleOcarina(PlayState* play) { */ void Message_DrawText(PlayState* play, Gfx** gfxP) { MessageContext* msgCtx = &play->msgCtx; - u16 lookAheadCharacter; + s16 pad; u8 character; u16 j; u16 i; @@ -928,15 +928,13 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { msgCtx->msgMode < MSGMODE_SCARECROW_LONG_RECORDING_START))) { j = i; while (true) { - lookAheadCharacter = msgCtx->msgBufDecoded[j]; - if (lookAheadCharacter == MESSAGE_SHIFT) { + character = msgCtx->msgBufDecoded[j]; + if (character == MESSAGE_SHIFT) { j += 2; - } else if ((lookAheadCharacter != MESSAGE_QUICKTEXT_DISABLE) && - (lookAheadCharacter != MESSAGE_PERSISTENT) && - (lookAheadCharacter != MESSAGE_EVENT) && - (lookAheadCharacter != MESSAGE_BOX_BREAK_DELAYED) && - (lookAheadCharacter != MESSAGE_AWAIT_BUTTON_PRESS) && - (lookAheadCharacter != MESSAGE_BOX_BREAK) && (lookAheadCharacter != MESSAGE_END)) { + } else if ((character != MESSAGE_QUICKTEXT_DISABLE) && (character != MESSAGE_PERSISTENT) && + (character != MESSAGE_EVENT) && (character != MESSAGE_BOX_BREAK_DELAYED) && + (character != MESSAGE_AWAIT_BUTTON_PRESS) && (character != MESSAGE_BOX_BREAK) && + (character != MESSAGE_END)) { j++; } else { break; @@ -944,8 +942,6 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { } i = j - 1; msgCtx->textDrawPos = i + 1; - - if (character) {} } FALLTHROUGH; case MESSAGE_QUICKTEXT_DISABLE: @@ -1435,7 +1431,6 @@ void Message_Decode(PlayState* play) { digits[2]++; digits[3] -= 10; } - if (curChar) {} loadChar = false; for (i = 0; i < 4; i++) { diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index c694221d88..feee098caa 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1025,7 +1025,7 @@ void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* p sp50 = Math_FAtan2F(sp58, sp60); temp1 = RAD_TO_BINANG(M_PI - (Math_FAtan2F(sp5C, sp58) + ((M_PI / 2) - sp50))); - temp1 = temp1 - skelAnime->jointTable[shinLimbIndex].z; + temp1 -= skelAnime->jointTable[shinLimbIndex].z; if ((s16)(ABS(skelAnime->jointTable[shinLimbIndex].x) + ABS(skelAnime->jointTable[shinLimbIndex].y)) < 0) { temp1 += 0x8000; diff --git a/src/libultra/gu/rotate.c b/src/libultra/gu/rotate.c index 64d4bd6ac7..064006cdf4 100644 --- a/src/libultra/gu/rotate.c +++ b/src/libultra/gu/rotate.c @@ -14,7 +14,7 @@ void guRotateF(f32 m[4][4], f32 a, f32 x, f32 y, f32 z) { guNormalize(&x, &y, &z); - a = a * D_80134D10; + a *= D_80134D10; sine = sinf(a); cosine = cosf(a); diff --git a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c index 2295326c56..7374103639 100644 --- a/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c +++ b/src/overlays/actors/ovl_Bg_Haka_MeganeBG/z_bg_haka_meganebg.c @@ -139,12 +139,7 @@ void func_8087E040(BgHakaMeganeBG* this, PlayState* play) { void func_8087E10C(BgHakaMeganeBG* this, PlayState* play) { this->dyna.actor.velocity.y += 1.0f; - - if (this->dyna.actor.velocity.y > 20.0f) { - this->dyna.actor.velocity.y = 20.0f; - } else { - this->dyna.actor.velocity.y = this->dyna.actor.velocity.y; - } + this->dyna.actor.velocity.y = CLAMP_MAX(this->dyna.actor.velocity.y, 20.0f); if (this->unk_16A != 0) { this->unk_16A--; diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index 51cf8697d1..458845c9c4 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -354,7 +354,7 @@ void BgSpot06Objects_LockSwimToSurface(BgSpot06Objects* this, PlayState* play) { cos = Math_CosS(this->dyna.actor.shape.rot.x) * 4.3f; this->dyna.actor.world.pos.x += (cos * Math_SinS(this->dyna.actor.shape.rot.y)); this->dyna.actor.world.pos.z += (cos * Math_CosS(this->dyna.actor.shape.rot.y)); - this->dyna.actor.world.pos.y = this->dyna.actor.world.pos.y - 1.3f; + this->dyna.actor.world.pos.y -= 1.3f; BgSpot06Objects_LockSpawnWaterRipples(this, play, 0); if (Math_ScaledStepToS(&this->dyna.actor.shape.rot.x, 0, 0x260) != 0) { diff --git a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c index 6896ba9620..255f60a09b 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c +++ b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c @@ -373,7 +373,7 @@ void BgSpot08Iceblock_FloatRotating(BgSpot08Iceblock* this, PlayState* play) { BgSpot08Iceblock_Bobbing(this); BgSpot08Iceblock_SinkUnderPlayer(this); BgSpot08Iceblock_SetWaterline(this); - this->dyna.actor.world.rot.y = this->dyna.actor.world.rot.y + 0x190; + this->dyna.actor.world.rot.y += 0x190; this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y; BgSpot08Iceblock_Roll(this, play); } diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index 9f8b10ed65..7ad1b954d1 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -145,7 +145,7 @@ static s16 D_808B6088[] = { 0, 1, 2, 3, 4 }; void func_808B4C30(BgSpot16Bombstone* this) { this->switchFlag = (this->actor.params >> 8) & 0x3F; - this->actor.params = this->actor.params & 0xFF; + this->actor.params &= 0xFF; } void func_808B4C4C(BgSpot16Bombstone* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c index da478e534d..394c6a51ca 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c @@ -249,7 +249,7 @@ void func_808B7D50(BgSpot18Basket* this, PlayState* play) { Math_StepToS(&this->unk_210, 0xBB8, 0x64); } - this->dyna.actor.shape.rot.y = this->dyna.actor.shape.rot.y + this->unk_210; + this->dyna.actor.shape.rot.y += this->unk_210; if (this->unk_216 < 70) { Math_StepToF(&this->unk_208, 100.0f, 2.0f); diff --git a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c index 2a5e051c26..8b0c2ab43d 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c @@ -45,7 +45,7 @@ void BgYdanHasi_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(thisx, sInitChain); this->type = ((thisx->params >> 8) & 0x3F); - thisx->params = thisx->params & 0xFF; + thisx->params &= 0xFF; waterBox = &play->colCtx.colHeader->waterBoxes[1]; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); if (thisx->params == HASI_WATER) { diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index 81a4bd928e..2047230a58 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -168,7 +168,6 @@ void BgYdanSp_UpdateFloorWebCollision(BgYdanSp* this) { void BgYdanSp_BurnWeb(BgYdanSp* this, PlayState* play) { this->timer = 30; - this = this; Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); Flags_SetSwitch(play, this->isDestroyedSwitchFlag); if (this->dyna.actor.params == WEB_FLOOR) { @@ -312,11 +311,7 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, PlayState* play) { if (this->unk_16C < 0.1f) { this->timer = 14; } - if (this->unk_16C < 2.0f) { - this->unk_16C = 2.0f; - } else { - this->unk_16C = this->unk_16C; - } + this->unk_16C = CLAMP_MIN(this->unk_16C, 2.0f); } } if (this->timer != 0) { diff --git a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c index e6dc1c4b1b..1f44984100 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c @@ -107,9 +107,9 @@ void BgZg_Init(Actor* thisx, PlayState* play) { CollisionHeader_GetVirtual(&gTowerCollapseBarsCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if ((func_808C0CC8(this) == 8) || (func_808C0CC8(this) == 9)) { - this->dyna.actor.scale.x = this->dyna.actor.scale.x * 1.3f; - this->dyna.actor.scale.z = this->dyna.actor.scale.z * 1.3f; - this->dyna.actor.scale.y = this->dyna.actor.scale.y * 1.2f; + this->dyna.actor.scale.x *= 1.3f; + this->dyna.actor.scale.z *= 1.3f; + this->dyna.actor.scale.y *= 1.2f; } this->action = 0; diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 260bfebaf3..630758628a 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -1410,7 +1410,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, PlayState* play) { this->actor.velocity.y = 15.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_K_COLI2); if (this->unk_1A2 == 0) { - this->unk_1A0 = this->unk_1A0 + 1; + this->unk_1A0++; if (this->unk_1A0 >= 4) { this->unk_1A0 = 0; } diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 63be6589e7..909d50b131 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -1851,10 +1851,8 @@ void BossGanon_PoundFloor(BossGanon* this, PlayState* play) { switch (this->unk_1C2) { case 0: - targetPosX = Math_SinS(this->unk_1A2 * 1280); - targetPosX = targetPosX * this->fwork[GDF_CENTER_POS]; - targetPosZ = Math_CosS(this->unk_1A2 * 1792); - targetPosZ = targetPosZ * this->fwork[GDF_CENTER_POS]; + targetPosX = Math_SinS(this->unk_1A2 * 1280) * this->fwork[GDF_CENTER_POS]; + targetPosZ = Math_CosS(this->unk_1A2 * 1792) * this->fwork[GDF_CENTER_POS]; Math_ApproachF(&this->actor.world.pos.x, targetPosX, 0.05f, this->fwork[GDF_FWORK_0]); Math_ApproachF(&this->actor.world.pos.z, targetPosZ, 0.05f, this->fwork[GDF_FWORK_0]); @@ -1987,11 +1985,8 @@ void BossGanon_ChargeBigMagic(BossGanon* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - targetPosX = Math_SinS(this->unk_1A2 * 1280); - targetPosX = targetPosX * this->fwork[GDF_CENTER_POS]; - - targetPosZ = Math_CosS(this->unk_1A2 * 1792); - targetPosZ = targetPosZ * this->fwork[GDF_CENTER_POS]; + targetPosX = Math_SinS(this->unk_1A2 * 1280) * this->fwork[GDF_CENTER_POS]; + targetPosZ = Math_CosS(this->unk_1A2 * 1792) * this->fwork[GDF_CENTER_POS]; Math_ApproachF(&this->actor.world.pos.x, targetPosX, 0.05f, this->fwork[GDF_FWORK_0]); Math_ApproachF(&this->actor.world.pos.z, targetPosZ, 0.05, this->fwork[GDF_FWORK_0]); @@ -2556,7 +2551,7 @@ void BossGanon_Vulnerable(BossGanon* this, PlayState* play) { case 2: sCape->minDist = 0.0f; - this->actor.velocity.y = this->actor.velocity.y - 0.5f; + this->actor.velocity.y -= 0.5f; if (this->actor.world.pos.y < 40.0f) { this->actor.world.pos.y = 40.0f; @@ -3721,8 +3716,8 @@ void BossGanon_GenShadowTexture(u8* tex, BossGanon* this, PlayState* play) { Matrix_MultVec3f(&sp7C, &sp70); - sp70.x = sp70.x * 0.28f; - sp70.y = sp70.y * 0.28f; + sp70.x *= 0.28f; + sp70.y *= 0.28f; baseX = (s32)(sp70.x + 32.0f); baseY = (s16)sp70.y * 0x40; @@ -4436,9 +4431,9 @@ void func_808E2544(Actor* thisx, PlayState* play) { this->unk_1F0.y = Rand_CenteredFloat(200.0f) + dorf->unk_1FC.y; this->unk_1F0.z = Rand_CenteredFloat(700.0f) + dorf->unk_1FC.z; - this->unk_1F0.x = this->unk_1F0.x + ((this->unk_1F0.x - this->actor.world.pos.x) * 100.0f); - this->unk_1F0.y = this->unk_1F0.y + ((this->unk_1F0.y - this->actor.world.pos.y) * 100.0f); - this->unk_1F0.z = this->unk_1F0.z + ((this->unk_1F0.z - this->actor.world.pos.z) * 100.0f); + this->unk_1F0.x += (this->unk_1F0.x - this->actor.world.pos.x) * 100.0f; + this->unk_1F0.y += (this->unk_1F0.y - this->actor.world.pos.y) * 100.0f; + this->unk_1F0.z += (this->unk_1F0.z - this->actor.world.pos.z) * 100.0f; numEffects = 10; break; diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 1920aded17..6d70ecf02b 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -445,7 +445,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) { this->unk_39C = 14; this->unk_398 = 0; this->actor.world.pos.x = -200.0f; - this->actor.world.pos.y = this->actor.world.pos.y - 30.0f; + this->actor.world.pos.y -= 30.0f; this->actor.world.pos.z = -200.0f; SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_OPENING_GANON); } else { diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 7507ab62df..75644f0b48 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -2022,14 +2022,14 @@ void BossTw_TwinrovaIntroCS(BossTw* this, PlayState* play) { Actor_SetScale(&sKotakePtr->actor, 0.014999999f); } } else { - sKoumePtr->actor.shape.rot.y = sKoumePtr->actor.shape.rot.y + (s16)this->subCamYawStep; + sKoumePtr->actor.shape.rot.y += (s16)this->subCamYawStep; } } else { if ((this->work[CS_TIMER_1] % 8) == 0) { Actor_PlaySfx(&sKoumePtr->actor, NA_SE_EN_TWINROBA_ROLL); } - sKoumePtr->actor.shape.rot.y = sKoumePtr->actor.shape.rot.y + (s16)this->subCamYawStep; + sKoumePtr->actor.shape.rot.y += (s16)this->subCamYawStep; Math_ApproachF(&this->subCamYawStep, 12288.0f, 1.0f, 384.0f); if (Animation_OnFrame(&sKoumePtr->skelAnime, this->workf[ANIM_SW_TGT])) { @@ -2182,14 +2182,14 @@ void BossTw_TwinrovaIntroCS(BossTw* this, PlayState* play) { this->spawnPortalAlpha = 0.0f; } } else { - sKotakePtr->actor.shape.rot.y = sKotakePtr->actor.shape.rot.y + (s16)this->subCamYawStep; + sKotakePtr->actor.shape.rot.y += (s16)this->subCamYawStep; } } else { if ((this->work[CS_TIMER_1] % 8) == 0) { Actor_PlaySfx(&sKotakePtr->actor, NA_SE_EN_TWINROBA_ROLL); } - sKotakePtr->actor.shape.rot.y = sKotakePtr->actor.shape.rot.y + (s16)this->subCamYawStep; + sKotakePtr->actor.shape.rot.y += (s16)this->subCamYawStep; Math_ApproachF(&this->subCamYawStep, 12288.0f, 1.0f, 384.0f); if (Animation_OnFrame(&sKotakePtr->skelAnime, this->workf[ANIM_SW_TGT])) { @@ -3951,7 +3951,7 @@ void BossTw_BlastFire(BossTw* this, PlayState* play) { this->actor.world.pos.y = -2000.0f; Matrix_MtxFToYXZRotS(&player2->shieldMf, &blastDir, 0); blastDir.x = -blastDir.x; - blastDir.y = blastDir.y + 0x8000; + blastDir.y += 0x8000; Math_ApproachS(&this->magicDir.x, blastDir.x, 0xA, 0x800); Math_ApproachS(&this->magicDir.y, blastDir.y, 0xA, 0x800); diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 136d0548de..99ea011f4b 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -922,7 +922,7 @@ void BossVa_BodyIntro(BossVa* this, PlayState* play) { sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x; sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac; - sSubCamAtMaxVelFrac.z = sSubCamAtMaxVelFrac.z * 1.75f; + sSubCamAtMaxVelFrac.z *= 1.75f; this->timer--; if (this->timer == 0) { diff --git a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c index 4f2b85b39e..83bfcf1e6f 100644 --- a/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -1572,7 +1572,7 @@ void DemoGt_Draw7(DemoGt* this, PlayState* play) { sp64 = kREG(75); sp62 = kREG(74) + 0x7FEC; sp60 = kREG(74) + 0x7FEC; - sp60 = sp60 + 0x4000; + sp60 += 0x4000; sp5C = Graph_Alloc(gfxCtx, sizeof(Mtx)); sp40 = 1.0f - Math_CosS(sp6E); diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index 2353331605..ad130ae8ac 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -137,16 +137,10 @@ void func_809B05F0(EnAni* this, PlayState* play) { } void func_809B064C(EnAni* this, PlayState* play) { - u16 textId; + u16 textId = Text_GetFaceReaction(play, 0xA); s16 yawDiff; - u16 textId2; - textId2 = Text_GetFaceReaction(play, 0xA); - textId = textId2 & 0xFFFF; - - if (!textId) {} - - if (textId2 == 0) { + if (textId == 0) { textId = !IS_DAY ? 0x5051 : 0x5050; } diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index a3dcbd3a13..6103793a3f 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -242,7 +242,7 @@ void EnBoom_Update(Actor* thisx, PlayState* play) { if (!(player->stateFlags1 & PLAYER_STATE1_29)) { this->actionFunc(this, play); Actor_SetFocus(&this->actor, 0.0f); - this->activeTimer = this->activeTimer + 1; + this->activeTimer++; } } diff --git a/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/src/overlays/actors/ovl_En_Bx/z_en_bx.c index 4edc2e7abc..efe94eeec8 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -80,7 +80,8 @@ void EnBx_Init(Actor* thisx, PlayState* play) { thisx->scale.x = thisx->scale.z = 0.01f; thisx->scale.y = 0.03f; - thisx->world.pos.y = thisx->world.pos.y - 100.0f; + thisx->world.pos.y -= 100.0f; + for (i = 0; i < 4; i++) { this->unk_184[i] = sp48; if (i == 0) { diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index bc860f02bc..a2bbaf354c 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -696,7 +696,7 @@ void func_80A03610(EnElf* this, PlayState* play) { Math_SmoothStepToF(&this->unk_2B8, 30.0f, 0.1f, 4.0f, 1.0f); this->unk_28C.x = Math_CosS(this->unk_2AC) * this->unk_2B8; - this->unk_28C.y = this->unk_28C.y + this->unk_2B4; + this->unk_28C.y += this->unk_2B4; switch (this->unk_2AA) { case 0: diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 6ce01bfbf2..76f880f190 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -426,7 +426,7 @@ void EnFirefly_Fall(EnFirefly* this, PlayState* play) { this->actor.colorFilterTimer = 40; } else { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x6800, 0x200); - this->actor.shape.rot.y = this->actor.shape.rot.y - 0x300; + this->actor.shape.rot.y -= 0x300; if (this->timer != 0) { this->timer--; } diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 0ff5393789..7af9aa7357 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -242,7 +242,7 @@ void EnFloormas_SetupTurn(EnFloormas* this) { if (this->actor.scale.x > 0.004f) { this->actionTarget = (rotDelta * (2.0f / 30.0f)); } else { - this->skelAnime.playSpeed = this->skelAnime.playSpeed + this->skelAnime.playSpeed; + this->skelAnime.playSpeed *= 2.0f; this->actionTarget = rotDelta * (2.0f / 15.0f); } this->actionFunc = EnFloormas_Turn; diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/src/overlays/actors/ovl_En_Goma/z_en_goma.c index 2dfe53d505..813bfa582c 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -710,8 +710,8 @@ void EnGoma_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); Actor_MoveXZGravity(&this->actor); - this->actor.world.pos.x = this->actor.world.pos.x + this->shieldKnockbackVel.x; - this->actor.world.pos.z = this->actor.world.pos.z + this->shieldKnockbackVel.z; + this->actor.world.pos.x += this->shieldKnockbackVel.x; + this->actor.world.pos.z += this->shieldKnockbackVel.z; Math_ApproachZeroF(&this->shieldKnockbackVel.x, 1.0f, 3.0f); Math_ApproachZeroF(&this->shieldKnockbackVel.z, 1.0f, 3.0f); diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index c1df3c75e8..bd48316563 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -806,11 +806,11 @@ s32 EnHeishi2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 break; default: if (limbIndex == 9) { - rot->x = rot->x + this->unk_26C.y; + rot->x += this->unk_26C.y; } if (limbIndex == 16) { - rot->x = rot->x + this->unk_260.y; - rot->z = rot->z + this->unk_260.z; + rot->x += this->unk_260.y; + rot->z += this->unk_260.z; } } diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 91d391fe10..d205fb9eb4 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -562,15 +562,15 @@ void EnHorse_UpdateIngoRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceIn playerDist = this->actor.xzDistToPlayer; if (playerDist < 130.0f || this->jntSph.elements[0].info.ocElemFlags & OCELEM_HIT) { if (Math_SinS(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0.0f) { - this->actor.world.rot.y = this->actor.world.rot.y - 280; + this->actor.world.rot.y -= 280; } else { - this->actor.world.rot.y = this->actor.world.rot.y + 280; + this->actor.world.rot.y += 280; } } else if (playerDist < 300.0f) { if (Math_SinS(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0.0f) { - this->actor.world.rot.y = this->actor.world.rot.y + 280; + this->actor.world.rot.y += 280; } else { - this->actor.world.rot.y = this->actor.world.rot.y - 280; + this->actor.world.rot.y -= 280; } } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -750,7 +750,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { this->riderPos = this->actor.world.pos; this->noInputTimer = 0; this->noInputTimerMax = 0; - this->riderPos.y = this->riderPos.y + 70.0f; + this->riderPos.y += 70.0f; if (DREG(4) == 0) { DREG(4) = 70; @@ -1172,7 +1172,7 @@ void EnHorse_MountedTurn(EnHorse* this, PlayState* play) { EnHorse_StartReversingInterruptable(this); } else if (Math_CosS(stickAngle) <= 0.7071) { // cos(45 degrees) clampedYaw = CLAMP(stickAngle, -800.0f, 800.0f); - this->actor.world.rot.y = this->actor.world.rot.y + clampedYaw; + this->actor.world.rot.y += clampedYaw; this->actor.shape.rot.y = this->actor.world.rot.y; } else { EnHorse_StartWalkingInterruptable(this); @@ -1931,7 +1931,7 @@ void EnHorse_FollowPlayer(EnHorse* this, PlayState* play) { this->stateFlags &= ~ENHORSE_LAND2_SOUND; this->unk_21C = this->unk_228; } else if (this->stateFlags & ENHORSE_TURNING_TO_PLAYER) { - this->actor.world.rot.y = this->actor.world.rot.y + this->followPlayerTurnSpeed; + this->actor.world.rot.y += this->followPlayerTurnSpeed; this->actor.shape.rot.y = this->actor.world.rot.y; if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { @@ -2755,7 +2755,7 @@ void EnHorse_BridgeJumpInit(EnHorse* this, PlayState* play) { this->stateFlags |= ENHORSE_JUMPING; this->animationIdx = ENHORSE_ANIM_HIGH_JUMP; y = this->skin.skelAnime.jointTable->y; - y = y * 0.01f; + y *= 0.01f; this->bridgeJumpStart = this->actor.world.pos; this->bridgeJumpStart.y += y; this->bridgeJumpYVel = @@ -3106,7 +3106,7 @@ void EnHorse_BgCheckSlowMoving(EnHorse* this, PlayState* play) { yOffset = 40.0f; } Math_Vec3f_Copy(&start, &this->actor.world.pos); - start.y = start.y + yOffset; + start.y += yOffset; Math_Vec3f_Copy(&end, &start); end.x += 30.0f * Math_SinS(this->actor.world.rot.y); @@ -3370,7 +3370,7 @@ void EnHorse_RegenBoost(EnHorse* this, PlayState* play) { this->boostTimer++; if (this->boostRegenTime <= 0) { - this->numBoosts = this->numBoosts + 1; + this->numBoosts++; if (!EN_HORSE_CHECK_4(this)) { Audio_PlaySfxGeneral(NA_SE_SY_CARROT_RECOVER, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, @@ -3697,9 +3697,9 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { if (!(this->stateFlags & ENHORSE_CALC_RIDER_POS)) { Skin_GetLimbPos(skin, 30, &riderOffset, &this->riderPos); - this->riderPos.x = this->riderPos.x - this->actor.world.pos.x; - this->riderPos.y = this->riderPos.y - this->actor.world.pos.y; - this->riderPos.z = this->riderPos.z - this->actor.world.pos.z; + this->riderPos.x -= this->actor.world.pos.x; + this->riderPos.y -= this->actor.world.pos.y; + this->riderPos.z -= this->actor.world.pos.z; } else { this->stateFlags &= ~ENHORSE_CALC_RIDER_POS; } @@ -3712,7 +3712,7 @@ void EnHorse_PostDraw(Actor* thisx, PlayState* play, Skin* skin) { if (Rand_ZeroOne() < 0.6f) { this->dustFlags |= 1; Skin_GetLimbPos(skin, 28, &hoofOffset, &this->frontRightHoof); - this->frontRightHoof.y = this->frontRightHoof.y - 5.0f; + this->frontRightHoof.y -= 5.0f; } } else { if (this->action == ENHORSE_ACT_STOPPING) { diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 2272f235b8..4c969117ad 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -556,7 +556,7 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_PIHAT_SM_FLY - SFX_FLAG); if (this->colQuad.base.atFlags & AT_BOUNCED) { this->actor.colChkInfo.health = 0; - this->colQuad.base.acFlags = this->colQuad.base.acFlags & ~AC_BOUNCED; + this->colQuad.base.acFlags &= ~AC_BOUNCED; EnPeehat_SetStateAttackRecoil(this); } else if ((this->colQuad.base.atFlags & AT_HIT) || (this->colCylinder.base.acFlags & AC_HIT) || (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { diff --git a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c index e4a33a36b2..19b867eb8c 100644 --- a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c +++ b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c @@ -30,7 +30,7 @@ void EnRiverSound_Init(Actor* thisx, PlayState* play) { this->playSfx = false; this->pathIndex = (this->actor.params >> 8) & 0xFF; - this->actor.params = this->actor.params & 0xFF; + this->actor.params &= 0xFF; if (this->actor.params >= RS_GANON_TOWER_0) { // Incrementally increase volume of NA_BGM_GANON_TOWER for each new room during the climb of Ganon's Tower diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 83db11d987..a2035106e7 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -629,7 +629,6 @@ s32 func_80AFEDF8(EnSkj* this, PlayState* play) { s16 yawDiff; if (this->actor.xzDistToPlayer < this->unk_2EC) { - this = this; if (func_8002DDE4(play) != 0) { return 1; } 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 ffe7e1fc1e..78df133bd9 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -90,9 +90,9 @@ s32 func_80B0BE20(EnSw* this, CollisionPoly* poly) { if (temp_f0 < 0.001f) { return 0; } - this->unk_37C.x = this->unk_37C.x * (1.0f / temp_f0); - this->unk_37C.y = this->unk_37C.y * (1.0f / temp_f0); - this->unk_37C.z = this->unk_37C.z * (1.0f / temp_f0); + this->unk_37C.x *= 1.0f / temp_f0; + this->unk_37C.y *= 1.0f / temp_f0; + this->unk_37C.z *= 1.0f / temp_f0; this->unk_364 = polyNormal; this->unk_3D8.xx = this->unk_370.x; this->unk_3D8.yx = this->unk_370.y; diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index d0dd7ee76e..a93d6062f7 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -125,7 +125,7 @@ void EnWallmas_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); CollisionCheck_SetInfo(&thisx->colChkInfo, &sDamageTable, &sColChkInfoInit); this->switchFlag = (u8)(thisx->params >> 0x8); - thisx->params = thisx->params & 0xFF; + thisx->params &= 0xFF; if (thisx->params == WMT_FLAG) { if (Flags_GetSwitch(play, this->switchFlag) != 0) { @@ -365,7 +365,7 @@ void EnWallmas_ReturnToCeiling(EnWallmas* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->skelAnime.curFrame > 20.0f) { this->timer += 9; - this->actor.world.pos.y = this->actor.world.pos.y + 30.0f; + this->actor.world.pos.y += 30.0f; } if (Animation_OnFrame(&this->skelAnime, 20.0f) != 0) { @@ -437,9 +437,9 @@ void EnWallmas_TakePlayer(EnWallmas* this, PlayState* play) { player->actor.world.pos.z = this->actor.world.pos.z; if (this->timer < 0) { - this->actor.world.pos.y = this->actor.world.pos.y + 2.0f; + this->actor.world.pos.y += 2.0f; } else { - this->actor.world.pos.y = this->actor.world.pos.y + 10.0f; + this->actor.world.pos.y += 10.0f; } if (!LINK_IS_ADULT) { @@ -461,7 +461,7 @@ void EnWallmas_TakePlayer(EnWallmas* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_FALL_UP); } - this->timer = this->timer + 2; + this->timer += 2; } else { Math_StepToF(&this->actor.world.pos.y, player->actor.world.pos.y + (!LINK_IS_ADULT ? 30.0f : 50.0f), 5.0f); } diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index 7e74c2cfac..66f30f9688 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -677,7 +677,6 @@ void ObjSwitch_CrystalOn(ObjSwitch* this, PlayState* play) { if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->prevColFlags & AC_HIT) && this->disableAcTimer <= 0) { this->disableAcTimer = 10; - play = play; ObjSwitch_CrystalTurnOffInit(this); ObjSwitch_SetOff(this, play); } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index e03537ef05..68b57faca3 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -2659,7 +2659,7 @@ s32 func_8083499C(Player* this, PlayState* play) { /** * The actual sword weapon is not handled here. See `Player_ActionChange_7` for melee weapon usage. * This upper body action allows for shielding or changing held items while a sword is in hand. -*/ + */ s32 Player_UpperAction_Sword(Player* this, PlayState* play) { if (func_80834758(play, this) || func_8083499C(this, play)) { return 1; @@ -11274,7 +11274,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->cylinder.dim.yShift = phi_f12 - this->actor.world.pos.y; if (this->stateFlags1 & PLAYER_STATE1_22) { - this->cylinder.dim.height = this->cylinder.dim.height * 0.8f; + this->cylinder.dim.height *= 0.8f; } Collider_UpdateCylinder(&this->actor, &this->cylinder); @@ -11440,9 +11440,9 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, } D_8085486C = (-sp5C * 4) + 36; - D_8085486C = D_8085486C * D_8085486C; + D_8085486C = SQ(D_8085486C); D_8085486C = (s32)((Math_CosS(D_8085486C) * 100.0f) + 100.0f) + 55.0f; - D_8085486C = D_8085486C * (sp5C * (1.0f / 9.0f)); + D_8085486C *= sp5C * (1.0f / 9.0f); } Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + 2.0f, diff --git a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c index 4e7cf3138b..c629cecbad 100644 --- a/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c +++ b/src/overlays/effects/ovl_Effect_Ss_G_Ripple/z_eff_ss_g_ripple.c @@ -59,10 +59,10 @@ u32 EffectSsGRipple_Init(PlayState* play, u32 index, EffectSs* this, void* initP return 1; } -void EffectSsGRipple_DrawRipple(PlayState* play, EffectSs* this, void* segment) { - GraphicsContext* gfxCtx = play->state.gfxCtx; +void EffectSsGRipple_DrawRipple(PlayState* play2, EffectSs* this, void* segment) { + PlayState* play = play2; f32 radius; - s32 pad; + GraphicsContext* gfxCtx = play->state.gfxCtx; MtxF mfTrans; MtxF mfScale; MtxF mfResult; @@ -71,8 +71,6 @@ void EffectSsGRipple_DrawRipple(PlayState* play, EffectSs* this, void* segment) OPEN_DISPS(gfxCtx, "../z_eff_ss_g_ripple.c", 199); - if (play) {} - radius = this->rRadius * 0.0025f; if ((this->rWaterBoxNum != -1) && (this->rWaterBoxNum < play->colCtx.colHeader->numWaterBoxes)) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c index 92c3cc1793..ae25405ab8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c +++ b/src/overlays/effects/ovl_Effect_Ss_Ice_Piece/z_eff_ss_ice_piece.c @@ -80,7 +80,7 @@ void EffectSsIcePiece_Draw(PlayState* play, u32 index, EffectSs* this) { void EffectSsIcePiece_Update(PlayState* play, u32 index, EffectSs* this) { this->rPitch += this->rRotSpeed; - this->velocity.x = this->velocity.x * 0.85f; - this->velocity.y = this->velocity.y * 0.85f; - this->velocity.z = this->velocity.z * 0.85f; + this->velocity.x *= 0.85f; + this->velocity.y *= 0.85f; + this->velocity.z *= 0.85f; }