summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorengineer124 <47598039+engineer124@users.noreply.github.com>2024-03-23 22:04:07 +1100
committerGitHub <noreply@github.com>2024-03-23 08:04:07 -0300
commit5bef89a6ff33c3e84ad58d201bd1996a0d9f7db4 (patch)
tree39cc7a06f0ea32f31ab88096e7da179ceeef7571 /src/code
parenta7fa8cc241d7f6e08d3744644cf8e93599f190a0 (diff)
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
Diffstat (limited to 'src/code')
-rw-r--r--src/code/PreRender.c81
-rw-r--r--src/code/z_camera.c10
-rw-r--r--src/code/z_collision_check.c2
-rw-r--r--src/code/z_en_hy_code.c4
-rw-r--r--src/code/z_play.c3
-rw-r--r--src/code/z_player_lib.c14
-rw-r--r--src/code/z_skin_matrix.c2
-rw-r--r--src/code/z_sram_NES.c2
-rw-r--r--src/code/z_sub_s.c4
9 files changed, 59 insertions, 63 deletions
diff --git a/src/code/PreRender.c b/src/code/PreRender.c
index 011b07f1f..6d4e52cf4 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 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 (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 (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 5e04f1613..d33864f34 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 869b3fd74..11c3865e1 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 20dff4ae3..cee1d9466 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 ed549b954..56055fafb 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 ebd3e21ed..bfe41894e 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 8f9635508..211bc1631 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 d66fee9c3..18f4d76f1 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 cdfd9273a..7117e1da2 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) {