summaryrefslogtreecommitdiff
path: root/src/render_objects.c
diff options
context:
space:
mode:
authorTyler McGavran <tyler.taggerung@gmail.com>2024-04-02 15:00:35 -0400
committerGitHub <noreply@github.com>2024-04-02 13:00:35 -0600
commit6af653ad3decee10076179d8c2e869b604087fc5 (patch)
treea89313f8199ad0864a51915095f14407783212dd /src/render_objects.c
parent893ecbe83862528e98b674532cf6024b30df6a54 (diff)
Update some attempts, got a couple matches (#591)
* Update some attempts, got a couple matches * More matches and updates Signed-off-by: Taggerung <tyler.taggerung@email.com>
Diffstat (limited to 'src/render_objects.c')
-rw-r--r--src/render_objects.c141
1 files changed, 70 insertions, 71 deletions
diff --git a/src/render_objects.c b/src/render_objects.c
index 8696dc912..8cef03f3c 100644
--- a/src/render_objects.c
+++ b/src/render_objects.c
@@ -1642,52 +1642,47 @@ void func_8004C628(s32 arg0, s32 arg1, u32 arg2, u32 arg3, u8 *texture) {
gSPDisplayList(gDisplayListHead++, D_0D007EB8);
}
-#ifdef MIPS_TO_C
-//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b
-void func_8004C6FC(s16 arg0, s16 arg1, s8 *arg2, u32 arg3, u32 arg4) {
- Gfx *temp_v0;
- Gfx *temp_v0_2;
- Gfx *temp_v0_4;
- s32 temp_t5;
+#ifdef NON_MATCHING
+// https://decomp.me/scratch/TqXqn
+// There's a weird fakematch concerning `athing`, don't know that to make of. Can't quite get it over the finish line though
+void func_8004C6FC(s16 arg0, s16 arg1, u8 *texture, u32 width, u32 arg4) {
s32 temp_v0_3;
s32 var_s3;
s32 var_s4;
- s8 *var_s5;
- u32 temp_t3;
+ s32 athing;
+ s32 temp_t3;
u32 temp_t8;
- u32 var_s0;
- u32 var_s6;
- u32 var_t2;
+ s32 heigth;
+ s32 var_s6;
+ u8 *textureCopy;
- var_s4 = arg1 - (arg4 >> 1);
+ athing = arg0 - (width / 2);
+ var_s4 = arg1 - (arg4 / 2);
+ textureCopy = texture;
gSPDisplayList(gDisplayListHead++, D_0D007EF8);
- temp_t8 = arg3 * arg4 * 4;
- temp_t3 = temp_t8 >> 0xC;
- var_s5 = arg2;
- var_s6 = temp_t8;
- var_t2 = temp_t3;
gDPSetRenderMode(gDisplayListHead++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
- if (temp_t8 & 0xFFF) {
- var_t2 = temp_t3 + 1;
- }
- var_s0 = arg4 / var_t2;
- var_s3 = 0;
- if ((s32) var_t2 > 0) {
- do {
- temp_t5 = arg3 * var_s0 * 4;
- load_texture_tile_rgba32_nomirror(var_s5, (s32) arg3, (s32) var_s0);
- func_8004B950(arg0 - (arg3 >> 1), var_s4, (s32) arg3, (s32) var_s0, 1);
- temp_v0_3 = var_s6 - temp_t5;
- var_s5 += temp_t5;
- if (temp_v0_3 < 0) {
- var_s0 = var_s6 / arg3;
- } else {
- var_s6 = (u32) temp_v0_3;
- }
- var_s3 += 1;
- var_s4 += var_s0;
- } while (var_s3 < (s32) var_t2);
+ temp_t8 = width * arg4 * 4;
+ temp_t3 = temp_t8 / 4096;
+ if (temp_t8 % 4096) {
+ temp_t3++;
+ }
+ heigth = arg4 / temp_t3;
+ var_s6 = temp_t3;
+ for (var_s3 = 0; var_s3 < var_s6; var_s3++) {
+ load_texture_tile_rgba32_nomirror(textureCopy, width, heigth);
+ func_8004B950(athing, var_s4, width, heigth, 1);
+ temp_v0_3 = temp_t8 - (width * heigth * 4);
+ textureCopy += (width * heigth * 4);
+ if (temp_v0_3 < 0) {
+ heigth = temp_t8 / width;
+ } else {
+ temp_t8 = temp_v0_3;
+ }
+ // Weird fakematch that is a HUGE improvement
+ athing += var_s4 * 0;
+ var_s4 += heigth;
}
+
gSPDisplayList(gDisplayListHead++, D_0D007EB8);
}
#else
@@ -1893,30 +1888,22 @@ void func_8004D4E8(s32 arg0, s32 arg1, u8 *texture, s32 arg3, s32 arg4, s32 arg5
}
}
-#ifdef NON_MATCHING
-//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b
-//? func_80044F34(s8 *, s32, s32); /* extern */
-
-UNUSED void func_8004D654(s32 arg0, s32 arg1, u8 *texture, f32 arg3, s32 arg4, s32 arg5, s32 arg6, UNUSED s32 arg7, s32 width, s32 arg9, UNUSED s32 argA, s32 height) {
- u8 *img;
- s32 var_s3;
+void func_8004D654(s32 arg0, s32 arg1, u8 *texture, f32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 width, s32 arg9, s32 argA, s32 height) {
s32 i;
- // Something weird with (width / 2).
- var_s3 = arg1 - (width / 2);
- img = texture;
+ s32 var_s3;
+ u8 *textureCopy;
+
+ var_s3 = arg1 - (arg9 / 2);
+ textureCopy = texture;
gSPDisplayList(gDisplayListHead++, D_0D008000);
func_8004B480(arg4, arg5, arg6);
-
- for (i = 0; i < arg9 / height; i++) {
- func_80044F34(img, width, height);
- func_8004BB3C(arg0, var_s3, width, arg9, arg3);
- img += (width * height) / 2;
+ for (i = 0; i < (arg9 / height); i++) {
+ func_80044F34(textureCopy, width, height);
+ func_8004BB3C(arg0, arg1, width, arg9, arg3);
+ textureCopy += (width * height) / 2;
var_s3 += height;
}
}
-#else
-GLOBAL_ASM("asm/non_matchings/render_objects/func_8004D654.s")
-#endif
void func_8004D7B4(s32 arg0, s32 arg1, u8 *texture, s32 arg3, s32 arg4) {
s32 sp5C;
@@ -2331,36 +2318,47 @@ void func_8004F020(s32 arg0) {
}
#ifdef NON_MATCHING
-//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Dec-20-2023
+// https://decomp.me/scratch/FxA1w
/**
* characterId of 8 appears to be a type of null check or control flow alteration.
*/
+#define EXPLICIT_AND 1
void func_8004F168(s32 arg0, s32 playerId, s32 characterId) {
+ f32 thing0;
+ f32 thing1;
+ s16 temp_a0;
+ s16 temp_a1;
Player *player = &gPlayerOne[playerId];
- s32 temp_a0;
- s32 temp_a1;
- if (gPlayerOne->type & PLAYER_EXISTS) {
- temp_a0 = ((D_8018D2C0[arg0] + D_8018D2F0) - ((s16) D_8018D2B0 / 2)) + D_8018D2E0 + (s32) (player->pos[0] * D_8018D2A0);
- temp_a1 = ((D_8018D2D8[arg0] + D_8018D2F8) - ((s16) D_8018D2B8 / 2)) + D_8018D2E8 + (s32) (player->pos[2] * D_8018D2A0);
+ if (player->type & (1 << 15)) {
+ thing0 = player->pos[0] * D_8018D2A0;
+ thing1 = player->pos[2] * D_8018D2A0;
+ temp_a0 = ((D_8018D2C0[arg0] + D_8018D2F0) - (D_8018D2B0 / 2)) + D_8018D2E0 + (s16)(thing0);
+ temp_a1 = ((D_8018D2D8[arg0] + D_8018D2F8) - (D_8018D2B8 / 2)) + D_8018D2E8 + (s16)(thing1);
if (characterId != 8) {
- if ((gGPCurrentRaceRankByPlayerId[playerId] == 0) && (gModeSelection != BATTLE) && (gModeSelection != TIME_TRIALS)) {
- func_80046424((s32) temp_a0, (s32) temp_a1, (player->rotation[1] + 0x8000) & 0xFFFF, 1.0f, (u8 *) common_texture_minimap_kart_character[characterId], common_vtx_player_minimap_icon, 8, 8, 8, 8);
- // return;
+ if ((gGPCurrentRaceRankByPlayerId[playerId] == 0) && (gModeSelection != 3) && (gModeSelection != 1)) {
+ #if EXPLICIT_AND == 1
+ func_80046424(temp_a0, temp_a1, (player->rotation[1] + 0x8000) & 0xFFFF, 1.0f, common_texture_minimap_kart_character[characterId], common_vtx_player_minimap_icon, 8, 8, 8, 8);
+ #else
+ func_80046424(temp_a0, temp_a1, player->rotation[1] + 0x8000, 1.0f, common_texture_minimap_kart_character[characterId], common_vtx_player_minimap_icon, 8, 8, 8, 8);
+ #endif
} else {
- func_800463B0((s32) temp_a0, (s32) temp_a1, (player->rotation[1] + 0x8000) & 0xFFFF, 1.0f, (u8 *) common_texture_minimap_kart_character[characterId], common_vtx_player_minimap_icon, 8, 8, 8, 8);
+ #if EXPLICIT_AND == 1
+ func_800463B0(temp_a0, temp_a1, (player->rotation[1] + 0x8000) & 0xFFFF, 1.0f, common_texture_minimap_kart_character[characterId], common_vtx_player_minimap_icon, 8, 8, 8, 8);
+ #else
+ func_800463B0(temp_a0, temp_a1, player->rotation[1] + 0x8000, 1.0f, common_texture_minimap_kart_character[characterId], common_vtx_player_minimap_icon, 8, 8, 8, 8);
+ #endif
}
- //return;
} else {
if (gGPCurrentRaceRankByPlayerId[playerId] == 0) {
- func_8004C450((s32) temp_a0, (s32) temp_a1, 8, 8, (u8 *) common_texture_minimap_progress_dot);
- //return;
+ func_8004C450(temp_a0, temp_a1, 8, 8, (u8 *) common_texture_minimap_progress_dot);
} else {
- draw_hud_2d_texture((s32) temp_a0, (s32) temp_a1, 8, 8, (u8 *) common_texture_minimap_progress_dot);
+ func_8004C364(temp_a0, temp_a1, 8, 8, (u8 *) common_texture_minimap_progress_dot);
}
}
}
}
+#undef EXPLICIT_AND
#else
GLOBAL_ASM("asm/non_matchings/render_objects/func_8004F168.s")
#endif
@@ -2798,6 +2796,7 @@ void func_80050C68(void) {
// Something about the handling of the `player` variable is weird.
// All commands are present and correct, 2 of them are out of position
+// https://decomp.me/scratch/PvJ5D
void func_80050E34(s32 playerId, s32 arg1) {
s32 objectIndex;
s32 spD0;
@@ -3802,7 +3801,7 @@ void func_80054E10(s32 objectIndex) {
void func_80054EB8(UNUSED s32 unused) {
s32 someIndex;
- for (someIndex = 0; someIndex < NUM_MAX_MOLES; someIndex++) {
+ for (someIndex = 0; someIndex < NUM_TOTAL_MOLES; someIndex++) {
func_80054E10(gObjectParticle1[someIndex]);
}
}