summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorengineer124 <47598039+engineer124@users.noreply.github.com>2023-11-22 20:19:31 +1100
committerGitHub <noreply@github.com>2023-11-22 04:19:31 -0500
commitf2c06ce441a38a032202b9024fdfa57bb36a67c2 (patch)
treebb924e2c2b577db8138ac67a6e44a00b5f15b1f8 /src/code
parent2aaa286cf85a51a46bbf1e4ad8f8a36588fd22ad (diff)
Misc Cleanup (#1585)
* misc cleanup * more fake matches * revert for sym
Diffstat (limited to 'src/code')
-rw-r--r--src/code/code_800FCE80.c4
-rw-r--r--src/code/graph.c1
-rw-r--r--src/code/z_camera.c13
-rw-r--r--src/code/z_eff_blure.c4
-rw-r--r--src/code/z_effect.c18
-rw-r--r--src/code/z_kankyo.c8
-rw-r--r--src/code/z_lights.c2
-rw-r--r--src/code/z_message_PAL.c19
-rw-r--r--src/code/z_player_lib.c2
9 files changed, 32 insertions, 39 deletions
diff --git a/src/code/code_800FCE80.c b/src/code/code_800FCE80.c
index 17b2bc4e5..8ac46833d 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 fd79efac5..8a0057c7b 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 f2b706301..9d7bf8a73 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 75f8d80bc..d7d17af12 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 dd5436bc2..0ff1392a4 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 996a334d7..a160ba863 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 f01c49df2..53b22cb39 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 36a1333ed..8313c667a 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 c694221d8..feee098ca 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;