diff options
| author | Tyler McGavran <tyler.taggerung@gmail.com> | 2022-11-01 17:07:35 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-01 15:07:35 -0600 |
| commit | 4647cdcd7e2a0f5b68265aac82d3a50d42aabfaa (patch) | |
| tree | c2bee6756a8492fa7d7b6b2a3a05162fec2c9134 /src | |
| parent | 1483ddaa0343c1614159c8a4e915d9f027abb8bc (diff) | |
Assorted, unrelated matches (#267)
* Assorted matches
Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/actors.h | 1 | ||||
| -rw-r--r-- | src/audio/external.h | 1 | ||||
| -rw-r--r-- | src/camera.c | 256 | ||||
| -rw-r--r-- | src/camera.h | 11 | ||||
| -rw-r--r-- | src/code_80005FD0.c | 487 | ||||
| -rw-r--r-- | src/code_80005FD0.h | 11 | ||||
| -rw-r--r-- | src/code_80027D00.c | 218 | ||||
| -rw-r--r-- | src/code_80027D00.h | 2 | ||||
| -rw-r--r-- | src/code_8006E9C0.c | 313 | ||||
| -rw-r--r-- | src/code_80071F00.c | 324 | ||||
| -rw-r--r-- | src/code_80071F00.h | 10 | ||||
| -rw-r--r-- | src/code_80091750.c | 877 | ||||
| -rw-r--r-- | src/code_80091750.h | 13 | ||||
| -rw-r--r-- | src/code_80280650.c | 120 | ||||
| -rw-r--r-- | src/code_80280650.h | 1 | ||||
| -rw-r--r-- | src/code_80281FA0.c | 25 | ||||
| -rw-r--r-- | src/memory.c | 1255 | ||||
| -rw-r--r-- | src/memory.h | 3 |
18 files changed, 1752 insertions, 2176 deletions
diff --git a/src/actors.h b/src/actors.h index 0c9603ae8..885f19c22 100644 --- a/src/actors.h +++ b/src/actors.h @@ -112,7 +112,6 @@ void update_simple_objects(); // audio/external.c extern void func_800C98B8(Vec3f, Vec3f, u32); -extern void func_800C9060(u8, s32); extern void func_800C90F4(u8, uintptr_t); extern void func_800C99E0(Vec3f, s32); extern void func_800C9D80(Vec3f, Vec3f, u32); diff --git a/src/audio/external.h b/src/audio/external.h index e2f290bbf..0cabd6841 100644 --- a/src/audio/external.h +++ b/src/audio/external.h @@ -6,6 +6,7 @@ void play_sound2(s32); void func_800C8EAC(u16); void func_800C8EF8(); +void func_800C9060(u8, u32); void func_800C90F4(u8, uintptr_t); void func_800CA008(u8, u8); void func_800CA0A0(); diff --git a/src/camera.c b/src/camera.c index d768b6562..d8a3ce6e6 100644 --- a/src/camera.c +++ b/src/camera.c @@ -4,6 +4,10 @@ #include <defines.h> #include "camera.h" #include "math_util.h" +#include "memory.h" +#include "waypoints.h" +#include "variables.h" +#include "code_8001F980.h" Camera cameras[4]; Camera *camera1 = &cameras[0]; @@ -11,6 +15,11 @@ Camera *camera2 = &cameras[1]; Camera *camera3 = &cameras[2]; Camera *camera4 = &cameras[3]; +// Future BSS section, replaces unknown amount of stuff in bss_8001C4D0.s +// f32 D_80164A30; +// s32 D_80164A2C; +// f32 D_8016524C; <- could maybe, maybe be part of spawn_players' bss stuff? + #ifdef MIPS_TO_C //generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de void func_80014DE4(s32, s32, s32, Camera *); /* extern */ @@ -67,7 +76,7 @@ void func_8001C4D0(f32 posX, f32 posY, f32 posZ, s16 rot, u32 arg4, s32 cameraId temp_a3->pos[0] = posX; temp_a3->pos[1] = posY; temp_a3->pos[2] = posZ; - temp_a3->rotZ = 0; + temp_a3->someBitFlags = 0; temp_a3->lookAt[2] = 150.0f; temp_a3->lookAt[1] = (f32) ((f64) posY - 3.0); temp_a3->lookAt[0] = 0.0f; @@ -221,74 +230,57 @@ void func_8001CA24(Player *player, f32 arg1) { camera->unk_94 = arg1; } -#ifdef MIPS_TO_C -//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 -void func_802B6540(f32 *, ?, f32, ?, s32); /* extern */ -extern f32 D_80164A30; -s16 gCurrentCourseId; /* unable to generate initializer */ - -void func_8001CA78(s32 arg0, Camera *camera, f32 *arg2, f32 *arg3, f32 *arg4, f32 *arg5) { - f32 sp74; - f32 sp70; - f32 sp6C; - f32 sp68; - f32 sp64; - f32 sp60; - f32 sp5C; - f32 sp4C; - f32 sp48; - f32 sp44; - f32 temp_f0; - f32 temp_f12; - f32 temp_f16; - f32 temp_f18; - f32 temp_f2; +void func_8001CA78(Player *player, Camera *camera, Vec3f arg2, f32 *arg3, f32 *arg4, f32 *arg5, s16 huh, s8 wut) { + Mat3 sp74; + Vec3f sp68; + Vec3f sp5C; + f32 posX; + f32 posY; + f32 posZ; f32 var_f14; - f32 var_f14_2; + f32 temp_f18; + f32 temp_f16; + s32 stackPadding0; struct TrackWayPoint *temp_s2; - sp68 = camera->unk_30[0]; - sp6C = camera->unk_30[1]; - sp70 = camera->unk_30[2]; - sp5C = camera->unk_3C[0]; - sp60 = camera->unk_3C[1]; - sp64 = camera->unk_3C[2]; - arg2->unk0 = camera->lookAt[0]; - temp_s2 = &(*D_80164550)[*gWaypointCountByPathIndex - 0xA]; - arg2->unk4 = (f32) camera->lookAt[1]; - arg2->unk8 = (f32) camera->lookAt[2]; - func_802B6540(&sp74, 0, 1.0f, 0, -0x00008000); - func_802B63B8(&sp5C, &sp74); - if (gCurrentCourseId == 0x000A) { - var_f14 = sp5C; + temp_s2 = &D_80164550[0][gWaypointCountByPathIndex[0] - 10]; + sp68[0] = camera->unk_30[0]; + sp68[1] = camera->unk_30[1]; + sp68[2] = camera->unk_30[2]; + sp5C[0] = camera->unk_3C[0]; + sp5C[1] = camera->unk_3C[1]; + sp5C[2] = camera->unk_3C[2]; + arg2[0] = camera->lookAt[0]; + arg2[1] = camera->lookAt[1]; + arg2[2] = camera->lookAt[2]; + func_802B6540(sp74, 0, 1, 0, -0x00008000); + func_802B63B8(sp5C, sp74); + if (gCurrentCourseId == COURSE_TOADS_TURNPIKE) { + var_f14 = sp5C[0]; } else { - var_f14 = sp5C + (f32) temp_s2->wayPointX; + var_f14 = sp5C[0] + temp_s2->wayPointX; } - arg2->unk0 += (var_f14 - camera->lookAt[0]) * 1.0f; - arg2->unk4 = (f32) (arg2->unk4 + (((sp60 + ((f32) temp_s2->wayPointY + D_80164A30)) - camera->lookAt[1]) * 1.0f)); - arg2->unk8 = (f32) (arg2->unk8 + (((sp64 + (bitwise f32) D_8016524C) - camera->lookAt[2]) * 1.0f)); - func_802B63B8(&sp68, &sp74); - if (gCurrentCourseId == 0x000A) { - var_f14_2 = sp68; + temp_f16 = sp5C[2] + D_8016524C; + temp_f18 = sp5C[1] + (temp_s2->wayPointY + D_80164A30); + arg2[0] += (var_f14 - camera->lookAt[0]) * 1; + arg2[1] += (temp_f18 - camera->lookAt[1]) * 1; + arg2[2] += (temp_f16 - camera->lookAt[2]) * 1; + func_802B63B8(sp68, sp74); + if (gCurrentCourseId == COURSE_TOADS_TURNPIKE) { + var_f14 = sp68[0]; } else { - var_f14_2 = sp68 + (f32) temp_s2->wayPointX; + var_f14 = sp68[0] + temp_s2->wayPointX; } - sp4C = var_f14_2; - temp_f16 = sp70 + (bitwise f32) D_8016524C; - sp44 = temp_f16; - temp_f18 = sp6C + ((f32) temp_s2->wayPointY + D_80164A30 + 6.0f); - sp48 = temp_f18; - move_f32_towards(&D_80164A30, 0.0f, 0.02f); - temp_f0 = camera->pos[0]; - *arg3 = ((var_f14_2 - temp_f0) * 1.0f) + temp_f0; - temp_f2 = camera->pos[1]; - *arg4 = ((temp_f18 - temp_f2) * 1.0f) + temp_f2; - temp_f12 = camera->pos[2]; - *arg5 = ((temp_f16 - temp_f12) * 1.0f) + temp_f12; + temp_f16 = sp68[2] + D_8016524C; + temp_f18 = sp68[1] + (temp_s2->wayPointY + D_80164A30 + 6.0f); + move_f32_towards(&D_80164A30, 0, 0.02f); + posX = camera->pos[0]; + *arg3 = ((var_f14 - posX) * 1) + posX; + posY = camera->pos[1]; + *arg4 = ((temp_f18 - posY) * 1) + posY; + posZ = camera->pos[2]; + *arg5 = ((temp_f16 - posZ) * 1) + posZ; } -#else -GLOBAL_ASM("asm/non_matchings/camera/func_8001CA78.s") -#endif #ifdef MIPS_TO_C //generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 @@ -496,13 +488,11 @@ GLOBAL_ASM("asm/non_matchings/camera/func_8001CCEC.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -void func_802B6540(f32 *, f32, ?, f32, s32); /* extern */ +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c extern ? D_80164A90; extern ? D_80164AA0; void func_8001D53C(Player *player, Camera *camera, f32 *arg2, f32 *arg3, f32 *arg4, f32 *arg5, s16 arg6, s16 arg7) { - f32 sp74; f32 sp70; f32 sp6C; f32 sp68; @@ -532,12 +522,12 @@ void func_8001D53C(Player *player, Camera *camera, f32 *arg2, f32 *arg3, f32 *ar arg2->unk4 = (f32) camera->lookAt[1]; arg2->unk8 = (f32) camera->lookAt[2]; sp38 = arg7 * 4; - func_802B6540(&sp74, 0.0f, 0x3F800000, 0.0f, (s32) arg6); - func_802B63B8(&sp5C, &sp74); + func_802B6540((f32 (*)[3]) &sp74[0], 0.0f, 1.0f, 0.0f, (s16) (s32) arg6); + func_802B63B8(&sp5C, (f32 (*)[3]) &sp74[0]); arg2->unk0 += ((sp5C + player->pos[0]) - camera->lookAt[0]) * 1.0f; arg2->unk8 = (f32) (arg2->unk8 + (((sp64 + player->pos[2]) - camera->lookAt[2]) * 1.0f)); arg2->unk4 = (f32) (arg2->unk4 + (((sp60 + player->pos[1]) - camera->lookAt[1]) * 1.0f)); - func_802B63B8(&sp68, &sp74); + func_802B63B8(&sp68, (f32 (*)[3]) &sp74[0]); var_f0 = (f32) ((f64) sp6C + ((f64) player->unk_074 + 1.5)); if ((player->unk_0CA & 1) == 1) { var_f0 = sp6C + (sp3C + 10.0f); @@ -776,79 +766,66 @@ void func_8001D944(Player *player, Camera *camera, f32 *arg2, f32 *arg3, f32 *ar GLOBAL_ASM("asm/non_matchings/camera/func_8001D944.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -void func_8001CA78(Player *, Camera *, f32 *, f32 *, f32 *, f32 *, s32, s32); /* extern */ - void func_8001E0C4(Camera *camera, Player *player, s8 arg2) { - f32 sp84; + s32 stackPadding0[6]; + f32 temp_f12; f32 sp80; - f32 sp7C; + f32 temp_f14; + s32 stackPadding1; f32 sp74; f32 sp70; f32 sp6C; - f32 sp60; - f32 temp_f0; - f32 temp_f12; - f32 temp_f14; - f32 temp_f2; - f32 temp_f2_2; - s16 temp_v0; + Vec3f sp60; + s16 temp_t7; s16 var_a2; + s32 stackPadding2[5]; + s32 stackPadding3[3]; + s32 test = 3; - temp_v0 = player->unk_078; - if (temp_v0 == 0) { + if (player->unk_078 == 0) { var_a2 = 0x0064; - } else if (temp_v0 < 0) { - var_a2 = 0x87 - (temp_v0 / 3); + } else if (player->unk_078 < 0) { + var_a2 = 0x87 - (player->unk_078 / 3); } else { - var_a2 = (temp_v0 / 3) + 0x87; + var_a2 = (player->unk_078 / 3) + 0x87; } func_800224F0(&camera->unk_2C, player->unk_02C[1], var_a2); - func_8001CA78(player, camera, &sp60, &sp74, &sp70, &sp6C, (s32) camera->unk_2C, (s32) arg2); - camera->rotZ = (u16) camera->rotZ & 0xFFFB; - func_802ADDC8(&camera->unk_54, (f32) 3, sp74, sp70, sp6C); - temp_f0 = camera->unk_54.unk44; - if (temp_f0 < 0.0f) { - sp74 += -camera->unk_54.unk60[0] * temp_f0 * 1.0f; - sp70 = (f32) ((f64) sp70 + ((f64) (-camera->unk_54.unk60[1] * camera->unk_54.unk44) * 0.5)); - sp6C += -camera->unk_54.unk60[2] * camera->unk_54.unk44 * 1.0f; + func_8001CA78(player, camera, sp60, &sp74, &sp70, &sp6C, camera->unk_2C, arg2); + camera->someBitFlags &= ~0x0004; + temp_t7 = func_802ADDC8(&camera->unk_54, test, sp74, sp70, sp6C); + if (camera->unk_54.unk3C[2] < 0.0f) { + sp74 += -camera->unk_54.unk60[0] * camera->unk_54.unk3C[2] * 1; + sp70 += -camera->unk_54.unk60[1] * camera->unk_54.unk3C[2] * 0.5; + sp6C += -camera->unk_54.unk60[2] * camera->unk_54.unk3C[2] * 1; } - temp_f2 = camera->unk_54.unk3C; - if (temp_f2 < 0.0f) { - camera->rotZ = (u16) camera->rotZ | 6; - sp74 = (f32) ((f64) sp74 + ((f64) (-camera->unk_54.unk48[0] * temp_f2) * 1.5)); - sp70 += -camera->unk_54.unk48[1] * camera->unk_54.unk3C * 1.0f; - sp6C = (f32) ((f64) sp6C + ((f64) (-camera->unk_54.unk48[2] * camera->unk_54.unk3C) * 1.5)); + if (camera->unk_54.unk3C[0] < 0.0f) { + camera->someBitFlags = camera->someBitFlags | 4 | 2; + sp74 += -camera->unk_54.unk48[0] * camera->unk_54.unk3C[0] * 1.5; + sp70 += -camera->unk_54.unk48[1] * camera->unk_54.unk3C[0] * 1; + sp6C += -camera->unk_54.unk48[2] * camera->unk_54.unk3C[0] * 1.5; } - temp_f2_2 = camera->unk_54.unk40; - if (temp_f2_2 < 0.0f) { - camera->rotZ = (u16) camera->rotZ | 6; - sp74 = (f32) ((f64) sp74 + ((f64) (-camera->unk_54.unk54[0] * temp_f2_2) * 1.5)); - sp70 += -camera->unk_54.unk54[1] * camera->unk_54.unk40 * 1.0f; - sp6C = (f32) ((f64) sp6C + ((f64) (-camera->unk_54.unk54[2] * camera->unk_54.unk40) * 1.5)); + if (camera->unk_54.unk3C[1] < 0.0f) { + camera->someBitFlags = camera->someBitFlags | 4 | 2; + sp74 += -camera->unk_54.unk54[0] * camera->unk_54.unk3C[1] * 1.5; + sp70 += -camera->unk_54.unk54[1] * camera->unk_54.unk3C[1] * 1; + sp6C += -camera->unk_54.unk54[2] * camera->unk_54.unk3C[1] * 1.5; } - if (((s16) M2C_ERROR(Read from unset register $v0) == 0) && (((u16) camera->rotZ & 2) != 2)) { + if ((temp_t7 == 0) && ((camera->someBitFlags & 2) != 2)) { camera->unk_AC = camera->unk_2C; } - camera->lookAt[0] = sp60; - camera->lookAt[1] = sp64; - camera->lookAt[2] = sp68; + camera->lookAt[0] = sp60[0]; + camera->lookAt[1] = sp60[1]; + camera->lookAt[2] = sp60[2]; camera->pos[0] = sp74; camera->pos[1] = sp70; - temp_f12 = camera->lookAt[0] - camera->pos[0]; camera->pos[2] = sp6C; + temp_f12 = camera->lookAt[0] - camera->pos[0]; sp80 = camera->lookAt[1] - camera->pos[1]; - sp84 = temp_f12; temp_f14 = camera->lookAt[2] - camera->pos[2]; - sp7C = temp_f14; camera->rot[1] = atan2s(temp_f12, temp_f14); - camera->rot[0] = atan2s(sqrtf((sp84 * sp84) + (temp_f14 * temp_f14)), sp80); + camera->rot[0] = atan2s(sqrtf((temp_f12 * temp_f12) + (temp_f14 * temp_f14)), sp80); camera->rot[2] = 0; } -#else -GLOBAL_ASM("asm/non_matchings/camera/func_8001E0C4.s") -#endif #ifdef MIPS_TO_C //generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de @@ -930,7 +907,7 @@ void func_8001E45C(Camera *camera, Player *player, s8 arg2) { func_800224F0(&camera->unk_2C, (s16) (player->unk_02C[1] + camera->unk_B0), var_a3); func_8001CCEC(player, camera, &sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2); } - camera->rotZ = (u16) camera->rotZ & 0xFFFB; + camera->someBitFlags = (u16) camera->someBitFlags & 0xFFFB; func_802ADDC8(&camera->unk_54, (f32) 3, sp84, sp80, sp7C); camera->pos[0] = sp84; camera->pos[1] = sp80; @@ -1069,7 +1046,7 @@ void func_8001EA0C(Camera *camera, Player *player, s8 arg2) { func_800224F0(&camera->unk_2C, (s16) (player->unk_02C[1] + camera->unk_B0), var_a3); func_8001D944(player, camera, &sp64, &sp84, &sp80, &sp7C, &sp58, (s32) camera->unk_2C, (s32) arg2); } - camera->rotZ = (u16) camera->rotZ & 0xFFFB; + camera->someBitFlags = (u16) camera->someBitFlags & 0xFFFB; func_802ADDC8(&camera->unk_54, (f32) 3, sp84, sp80, sp7C); camera->pos[0] = sp84; camera->pos[1] = sp80; @@ -1417,43 +1394,26 @@ block_66: GLOBAL_ASM("asm/non_matchings/camera/func_8001F394.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -extern u16 D_80152300; -extern s32 D_80164A2C; - void func_8001F87C(s32 cameraId) { - Camera *temp_v0_2; - Player *var_a2; - s32 var_a1; - u16 temp_v0; + s32 playerIndex; + // Why? + s32 test = cameraId; - if (gActiveScreenMode == SCREEN_MODE_1P) { - var_a1 = 0; - var_a2 = gPlayerOne; - if (gModeSelection == GRAND_PRIX) { -loop_3: - temp_v0 = var_a2->unk_000; - if (!(temp_v0 & 0x200) && !(temp_v0 & 0x80)) { - if (var_a1 == 0x60E8) { + if(gPlayerOne){} + if (gActiveScreenMode == 0) { + if (gModeSelection == 0) { + for (playerIndex = 0; playerIndex < 8; playerIndex++) { + if ((gPlayerOne[playerIndex].unk_000 & 0x200) || (gPlayerOne[playerIndex].unk_000 & 0x80)) break; + if (playerIndex == 7) { D_80164A2C += 1; } - if ((var_a1 == 0x60E8) && (D_80164A2C == 0x0000003C)) { + if ((playerIndex == 7) && (D_80164A2C == 0x0000003C)) { D_80164A28 = 2; - *(&D_80152300 + (cameraId * 2)) = 1; - temp_v0_2 = &cameras[cameraId]; - temp_v0_2->rot[1] = var_a2->unk_02E; - temp_v0_2->unk2C = (s16) var_a2->unk_02E; - } - var_a1 += 0xDD8; - var_a2 += 0xDD8; - if (var_a1 != 0x6EC0) { - goto loop_3; + D_80152300[test] = 1; + cameras[test].rot[1] = gPlayerOne[playerIndex].unk_02C[1]; + cameras[test].unk_2C = gPlayerOne[playerIndex].unk_02C[1]; } } } } } -#else -GLOBAL_ASM("asm/non_matchings/camera/func_8001F87C.s") -#endif diff --git a/src/camera.h b/src/camera.h index 0b4227671..143f89746 100644 --- a/src/camera.h +++ b/src/camera.h @@ -11,7 +11,7 @@ typedef struct { // I think these are the "nautical angles" between pos and lookAt // rot[0] = pitch, rot[1] = yaw, rot[2] = roll? /* 0x24 */ Vec3s rot; - /* 0x2A */ s16 rotZ; + /* 0x2A */ u16 someBitFlags; /* 0x2C */ s16 unk_2C; /* 0x2E */ s16 unk_2E; /* 0x30 */ Vec3f unk_30; @@ -41,7 +41,13 @@ typedef struct { void func_8001CA10(Camera*); void func_8001CA24(Player*, f32); +void func_8001CA78(Player*, Camera*, Vec3f, f32*, f32*, f32*, s16, s8); void func_8001D794(Player*, Camera*, Vec3f, f32*, f32*, f32*, s16); +void func_8001E0C4(Camera*, Player*, s8); +void func_8001F87C(s32); + +extern s32 D_80164A2C; +extern f32 D_80164A30; extern Camera cameras[]; extern Camera *camera1; @@ -53,4 +59,7 @@ extern Player *gPlayerTwo; extern Player *gPlayerThree; extern Player *gPlayerFour; +// Actually define in main.c, probably need to add to main.h +extern u16 D_80152300[]; + #endif diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index e86520a35..d062fdf09 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -3474,10 +3474,7 @@ s16 func_8000CC88(f32 posX, f32 posY, f32 posZ, Player *player, s32 playerId, s3 } #ifdef MIPS_TO_C -//generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 -extern s16 D_801631E0; -extern s32 D_80163488; - +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *player, s32 playerId, s32 pathIndex) { s16 sp5E; s32 sp48; @@ -3494,20 +3491,14 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe s16 temp_v0_6; s16 temp_v0_7; s16 var_v0; - s32 temp_t0; - s32 temp_t2; - s32 temp_t4; - s32 temp_t8; struct TrackWayPoint *temp_v1; - u16 temp_v0; - void *temp_v1_3; - void *temp_v1_4; + struct TrackWayPoint *temp_v1_3; + struct TrackWayPoint *temp_v1_4; - temp_v0 = player->unk_000; var_f24 = posZ; var_f20 = posX; var_f22 = posY; - if (((temp_v0 & 0x4000) != 0) && ((temp_v0 & 0x1000) == 0)) { + if ((player->unk_000 & 0x4000) && !(player->unk_000 & 0x1000)) { temp_v0_2 = func_8000C884(var_f20, var_f22, var_f24, wayPointIndex, pathIndex, (u16) func_802ABD40(player->unk_110.unk3A)); sp5E = temp_v0_2; if (temp_v0_2 == -1) { @@ -3515,11 +3506,10 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe } goto block_17; } - temp_t0 = playerId * 2; - sp48 = temp_t0; - if (*(&D_801631E0 + temp_t0) == 1) { + sp48 = playerId * 2; + if (D_801631E0[playerId] == 1) { temp_a0 = player->unk_0CA; - if ((temp_a0 & 1) != 0) { + if (temp_a0 & 1) { temp_v1 = &D_80164550[pathIndex][wayPointIndex]; player->pos[0] = (f32) temp_v1->wayPointX; player->pos[1] = (f32) temp_v1->wayPointY; @@ -3530,11 +3520,10 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe if (playerId == ((s32) D_80163488 % 8)) { func_802ADDC8(&player->unk_110, 10.0f, var_f20, var_f22, var_f24); temp_v0_3 = func_802ABD40(player->unk_110.unk3A); - temp_t8 = temp_v0_3 & 0xFFFF; temp_v1_2 = sp48 + D_80163318; *temp_v1_2 = temp_v0_3; sp44 = temp_v1_2; - var_v0 = func_8000C884(var_f20, var_f22, var_f24, wayPointIndex, pathIndex, (u16) temp_t8); + var_v0 = func_8000C884(var_f20, var_f22, var_f24, wayPointIndex, pathIndex, (u16) (temp_v0_3 & 0xFFFF)); sp5E = var_v0; if (var_v0 == -1) { sp44 = temp_v1_2; @@ -3543,25 +3532,23 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe } if (var_v0 == -1) { temp_v0_4 = func_8000C0BC(var_f20, var_f22, var_f24, (u16) *temp_v1_2, &pathIndex); - temp_t4 = temp_v0_4 * 8; sp5E = temp_v0_4; - temp_v1_3 = D_80164550[pathIndex] + temp_t4; - player->pos[0] = (f32) temp_v1_3->unk0; - player->pos[1] = (f32) temp_v1_3->unk2; - player->pos[2] = (f32) temp_v1_3->unk4; + temp_v1_3 = &D_80164550[pathIndex][temp_v0_4]; + player->pos[0] = (f32) temp_v1_3->wayPointX; + player->pos[1] = (f32) temp_v1_3->wayPointY; + player->pos[2] = (f32) temp_v1_3->wayPointZ; } } else { temp_v0_5 = func_8000C9DC(var_f20, var_f22, var_f24, wayPointIndex, pathIndex); sp5E = temp_v0_5; if (temp_v0_5 == -1) { temp_v0_6 = func_8000BD94(var_f20, var_f22, var_f24, pathIndex); - temp_t2 = temp_v0_6 * 8; sp5E = temp_v0_6; - temp_v1_4 = D_80164550[pathIndex] + temp_t2; - var_f20 = (f32) temp_v1_4->unk0; - var_f22 = (f32) temp_v1_4->unk2; + temp_v1_4 = &D_80164550[pathIndex][temp_v0_6]; + var_f20 = (f32) temp_v1_4->wayPointX; + var_f22 = (f32) temp_v1_4->wayPointY; player->pos[0] = var_f20; - var_f24 = (f32) temp_v1_4->unk4; + var_f24 = (f32) temp_v1_4->wayPointZ; player->pos[1] = var_f22; player->pos[2] = var_f24; func_802ADDC8(&player->unk_110, 10.0f, var_f20, var_f22, var_f24); @@ -6697,79 +6684,55 @@ loop_13: GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80012AC0.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -extern s16 D_801631E0; - void func_80012DC0(s32 playerId, Player *player) { - f32 sp84; - TrainCarStuff *temp_v0; - TrainCarStuff *temp_v0_2; - TrainStuff *var_s0; - TrainStuff *var_s6; - TrainStuff *var_s7; - f32 temp_f14; - f32 temp_f16; - f32 temp_f24; - f32 temp_f26; - f64 temp_f0; - f64 temp_f0_2; - f64 temp_f0_3; - f64 temp_f0_4; - s32 var_s1; - - if (*(&D_801631E0 + (playerId * 2)) != 1) { - var_s7 = D_801635A0; - var_s6 = D_801635A0; - if ((player->unk_0BC << 7) >= 0) { - temp_f24 = player->pos[0]; - temp_f26 = player->pos[2]; - do { - temp_f16 = var_s6->locomotive.position[0]; - temp_f14 = var_s6->locomotive.position[2]; - sp84 = temp_f16; - temp_f0 = (f64) (temp_f24 - temp_f16); - if ((temp_f0 > -100.0) && (temp_f0 < 100.0)) { - temp_f0_2 = (f64) (temp_f26 - temp_f14); - if ((temp_f0_2 > -100.0) && (temp_f0_2 < 100.0)) { - if (func_80006018(sp84, temp_f14, var_s6->locomotive.velocity[0], var_s6->locomotive.velocity[2], 60.0f, 20.0f, temp_f24, temp_f26) == (s32) 1U) { + TrainCarStuff *trainCar; + f32 playerPosX; + f32 playerPosZ; + f32 x_dist; + f32 z_dist; + s32 trainIndex; + s32 passengerCarIndex; + + if (D_801631E0[playerId] != 1) { + if (!(player->unk_0BC & 0x01000000)) { + playerPosX = player->pos[0]; + playerPosZ = player->pos[2]; + for (trainIndex = 0; trainIndex < NUM_TRAINS; trainIndex++) { + trainCar = &D_801635A0[trainIndex].locomotive; + x_dist = playerPosX - trainCar->position[0]; + z_dist = playerPosZ - trainCar->position[2]; + if ((x_dist > -100.0) && (x_dist < 100.0)) { + if ((z_dist > -100.0) && (z_dist < 100.0)) { + if (func_80006018(trainCar->position[0], trainCar->position[2], trainCar->velocity[0], trainCar->velocity[2], 60.0f, 20.0f, playerPosX, playerPosZ) == 1) { player->statusEffects |= 0x400000; } - temp_v0 = &var_s6->tender; - if ((var_s6->tender.isActive == (s16) 1U) && (func_80006018(temp_v0->position[0], temp_v0->position[2], temp_v0->velocity[0], temp_v0->velocity[2], 30.0f, 20.0f, temp_f24, temp_f26) == (s32) 1U)) { - player->statusEffects |= 0x400000; + trainCar = &D_801635A0[trainIndex].tender; + if (trainCar->isActive == 1) { + if (func_80006018(trainCar->position[0], trainCar->position[2], trainCar->velocity[0], trainCar->velocity[2], 30.0f, 20.0f, playerPosX, playerPosZ) == 1) { + player->statusEffects |= 0x400000; + } } } } - var_s1 = 0; - var_s0 = var_s7; -loop_13: - if (var_s0->passengerCars[0].isActive == (s16) 1U) { - temp_f0_3 = (f64) (temp_f24 - var_s0->passengerCars[0].position[0]); - if ((temp_f0_3 > -100.0) && (temp_f0_3 < 100.0)) { - temp_f0_4 = (f64) (temp_f26 - var_s0->passengerCars[0].position[2]); - if (temp_f0_4 > -100.0) { - temp_v0_2 = var_s0->passengerCars; - if ((temp_f0_4 < 100.0) && (func_80006018(temp_v0_2->position[0], temp_v0_2->position[2], temp_v0_2->velocity[0], temp_v0_2->velocity[2], 30.0f, 20.0f, temp_f24, temp_f26) == (s32) 1U)) { - player->statusEffects |= 0x400000; + + for (passengerCarIndex = 0; passengerCarIndex < NUM_PASSENGER_CAR_ENTRIES; passengerCarIndex++) { + trainCar = &D_801635A0[trainIndex].passengerCars[passengerCarIndex]; + x_dist = playerPosX - trainCar->position[0]; + z_dist = playerPosZ - trainCar->position[2]; + if (trainCar->isActive == 1) { + if ((x_dist > -100.0) && (x_dist < 100.0)) { + if ((z_dist > -100.0) && (z_dist < 100.0)) { + if (func_80006018(trainCar->position[0], trainCar->position[2], trainCar->velocity[0], trainCar->velocity[2], 30.0f, 20.0f, playerPosX, playerPosZ) == 1) { + player->statusEffects |= 0x400000; + } } } } } - var_s1 += 0x24; - var_s0 += 0x24; - if (var_s1 != 0xB4) { - goto loop_13; - } - var_s7 += 0x10C; - var_s6 += 0x10C; - } while (var_s7 != D_801637B8); + } } } } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80012DC0.s") -#endif #ifdef MIPS_TO_C //generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc @@ -7030,47 +6993,40 @@ void func_800133C4(void) { GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_800133C4.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -extern ? D_801637EC; +#ifdef NEEDS_RODATA +// data_0DD0A0_3.s +extern f64 D_800ED158;// = 300.0; +extern f64 D_800ED160;// = -300.0; void func_80013854(Player *player) { - f32 sp70; - PaddleWheelBoatStuff *var_s0; - f32 temp_f12; - f32 temp_f14; - f32 temp_f24; - f32 temp_f26; - f32 temp_f28; - f32 var_f18; - f64 temp_f0; - f64 temp_f0_2; - s32 temp_v0; - - temp_v0 = player->unk_0BC; - if (((temp_v0 << 7) >= 0) && ((temp_v0 << 6) >= 0)) { - temp_f26 = player->pos[0]; - var_f18 = player->pos[1]; - temp_f28 = player->pos[2]; - var_s0 = D_801637C0; - do { - if (var_s0->isActive == 1) { - temp_f12 = var_s0->position[0]; - temp_f14 = var_s0->position[2]; - temp_f24 = var_f18 - var_s0->position[1]; - temp_f0 = (f64) (temp_f26 - temp_f12); - if ((temp_f0 > -300.0) && (temp_f0 < 300.0)) { - temp_f0_2 = (f64) (temp_f28 - temp_f14); - if ((temp_f0_2 > -300.0) && (temp_f0_2 < 300.0)) { - sp70 = var_f18; - if ((func_80006018(temp_f12, temp_f14, var_s0->velocity[0], var_s0->velocity[2], 200.0f, 60.0f, temp_f26, temp_f28) == (s32) 1) && ((f64) temp_f24 < 60.0)) { + s32 someIndex; + PaddleWheelBoatStuff *tempPaddleWheelBoat; + f32 x_diff; + f32 y_diff; + f32 z_diff; + f32 playerX; + f32 playerZ; + f32 playerY; + + if (((player->unk_0BC << 7) >= 0) && ((player->unk_0BC << 6) >= 0)) { + playerX = player->pos[0]; + playerY = player->pos[1]; + playerZ = player->pos[2]; + for (someIndex = 0; someIndex < NUM_PADDLE_WHEEL_BOATS; someIndex++) { + tempPaddleWheelBoat = &D_801637C0[someIndex]; + if (tempPaddleWheelBoat->isActive == 1) { + x_diff = playerX - tempPaddleWheelBoat->position[0]; + y_diff = playerY - tempPaddleWheelBoat->position[1]; + z_diff = playerZ - tempPaddleWheelBoat->position[2]; + if ((x_diff > -300.0) && (x_diff < 300.0)) { + if ((z_diff > -300.0) && (z_diff < 300.0)) { + if ((func_80006018(tempPaddleWheelBoat->position[0], tempPaddleWheelBoat->position[2], tempPaddleWheelBoat->velocity[0], tempPaddleWheelBoat->velocity[2], 200.0f, 60.0f, playerX, playerZ) == 1) && (y_diff < 60.0)) { player->statusEffects |= 0x80000; } } } } - var_s0 += 0x2C; - } while (var_s0 != &D_801637EC); + } } } #else @@ -7892,75 +7848,69 @@ UNUSED void func_8001530C(void) { } -#ifdef NON_MATCHING -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -//void func_80015390(Camera *, Player *, ?, s32); /* extern */ -void func_80015390(Camera*, Player*, s32,s32); void func_80015314(s32 playerId, s32 arg1, s32 cameraId) { - Camera *temp_a0 = &camera1[cameraId]; - Player *player = &gPlayerOne[playerId]; + Camera *temp_a0; + Player *temp_a1; - //temp_a1 = &gPlayerOne[playerId]; - //temp_a0 = &camera1[cameraId]; - temp_a0->unk_2C = player->unk_02C[1]; - func_80015390(temp_a0, player, 0, playerId); + // wtf is up with the pointer accesses here? + // What aren't they just doing thing = &some_pointer[some_index]? + temp_a1 = gPlayerOne; + temp_a0 = camera1; + temp_a1 += playerId; + temp_a0 += cameraId; + temp_a0->unk_2C = temp_a1->unk_02C[1]; + func_80015390(temp_a0, temp_a1, 0); } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80015314.s") -#endif -#ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -void func_8001D794(Player *, Camera *, f32 *, f32 *, f32 *, f32 *, s32); /* extern */ - -void func_80015390(Camera *camera, s32 arg1, s32 arg2) { - f32 sp94; +void func_80015390(Camera *camera, Player *player, s32 arg2) { + s32 stackPadding0[3]; + s32 stackPadding1[3]; + f32 temp_f12; f32 sp90; - f32 sp8C; + f32 temp_f14; + Player *temp_s1; f32 sp84; f32 sp80; f32 sp7C; - f32 sp64; - Player *temp_s1; - f32 temp_f12; - f32 temp_f14; - s16 temp_v0; + s32 stackPadding2[3]; + Vec3f sp64; + s32 stackPadding3[3]; + s32 stackPadding4[3]; + s32 stackPadding5[3]; s16 var_a2; - s32 temp_v0_2; + /* + Doing the more sensible: temp_s1 = &gPlayerOne[camera->playerId]; - temp_v0 = temp_s1->unk_078; - if (temp_v0 == 0) { + leads to some regalloc differences + */ + temp_s1 = gPlayerOne; + temp_s1 += camera->playerId; + if (temp_s1->unk_078 == 0) { var_a2 = 0x0064; - } else if (temp_v0 < 0) { - var_a2 = 0xA0 - (temp_v0 / 16); + } else if (temp_s1->unk_078 < 0) { + var_a2 = 0xA0 - (temp_s1->unk_078 / 16); } else { - var_a2 = (temp_v0 / 16) + 0xA0; + var_a2 = 0xA0 + (temp_s1->unk_078 / 16); } - temp_v0_2 = temp_s1->unk_0BC; - if (!(temp_v0_2 & 0x80) && !(temp_v0_2 & 0x40)) { + if (!((temp_s1->unk_0BC & 0x80) || (temp_s1->unk_0BC & 0x40))) { func_800224F0(&camera->unk_2C, temp_s1->unk_02C[1], var_a2); } - func_8001D794(temp_s1, camera, &sp64, &sp84, &sp80, &sp7C, (s32) camera->unk_2C); + func_8001D794(temp_s1, camera, sp64, &sp84, &sp80, &sp7C, camera->unk_2C); func_802ADDC8(&camera->unk_54, 10.0f, sp84, sp80, sp7C); - camera->lookAt[0] = sp64; - camera->lookAt[1] = sp68; - camera->lookAt[2] = sp6C; + camera->lookAt[0] = sp64[0]; + camera->lookAt[1] = sp64[1]; + camera->lookAt[2] = sp64[2]; camera->pos[0] = sp84; camera->pos[1] = sp80; - temp_f12 = camera->lookAt[0] - camera->pos[0]; camera->pos[2] = sp7C; - sp90 = camera->lookAt[1] - camera->pos[1]; - sp94 = temp_f12; + temp_f12 = camera->lookAt[0] - camera->pos[0]; + sp90 = camera->lookAt[1] - camera->pos[1]; temp_f14 = camera->lookAt[2] - camera->pos[2]; - sp8C = temp_f14; camera->rot[1] = atan2s(temp_f12, temp_f14); - camera->rot[0] = atan2s(sqrtf((sp94 * sp94) + (temp_f14 * temp_f14)), sp90); + camera->rot[0] = atan2s(sqrtf((temp_f12 * temp_f12) + (temp_f14 * temp_f14)), sp90); camera->rot[2] = 0; } -#else -GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80015390.s") -#endif #ifdef MIPS_TO_C //generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de @@ -10727,20 +10677,17 @@ void func_8001ABEC(struct struct_801642D8 *arg0) { } #ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -void func_8001AB74(s32, void *, s32); /* extern */ -void func_8001ABE0(s32, void *, s32 *); /* extern */ -void func_8001ABEC(void *, s16); /* extern */ -s32 func_8007AF78(s16, s16, s32 *); /* extern */ -void func_800C92CC(s32, ?, s32, struct Actor *); /* extern */ -void func_800CAC60(s32); /* extern */ -void func_800CAD40(u8, s16); /* extern */ -extern s16 D_801631E0; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_8001AB74(s32, struct struct_801642D8 *, u8); /* extern */ +? func_800C92CC(s32, ?, s32, struct Actor *); /* extern */ +? func_800CAC60(s32); /* extern */ +? func_800CAD40(u8, s16); /* extern */ +extern ? D_801631E0; extern s16 D_80163478; extern ? D_801642D8; extern u16 D_801646CC; -void func_8001AC10(s32 playerId, s32 arg1, s32 *arg2) { +void func_8001AC10(s32 playerId) { Player *sp2C; struct Actor *sp28; Player *temp_t9; @@ -10755,7 +10702,6 @@ void func_8001AC10(s32 playerId, s32 arg1, s32 *arg2) { s16 temp_v1_8; s16 temp_v1_9; s16 var_v0; - s32 *var_a2; s32 temp_a0; s32 temp_v1; s32 var_v1; @@ -10773,22 +10719,21 @@ void func_8001AC10(s32 playerId, s32 arg1, s32 *arg2) { struct Actor *temp_a3_8; struct Actor *temp_a3_9; struct TrackWayPoint *temp_v0_2; + struct struct_801642D8 *temp_s0; u16 temp_v0; - void *temp_s0; - var_a2 = arg2; temp_t9 = &gPlayerOne[playerId]; sp2C = temp_t9; - if ((gModeSelection != (s32) TIME_TRIALS) && (D_801646CC != (u16) 1) && !(temp_t9->unk_000 & 0x800)) { + if ((gModeSelection != (s32) 1) && (D_801646CC != (u16) 1) && !(temp_t9->unk_000 & 0x800)) { temp_s0 = (playerId * 0x10) + &D_801642D8; temp_a1 = temp_s0->unk0; switch (temp_a1) { /* switch 1 */ case 0: /* switch 1 */ - temp_s0->unk2 = -1; - if ((((playerId * 0x14) + 0x64) < D_80164450[playerId]) && (temp_s0->unk4 >= 0x259) && (temp_s0->unk6 < 3) && (temp_v1 = gLapCountByPlayerId[playerId], var_a2 = gPlayerPositions, ((temp_v1 < 3) != 0))) { - func_8001AB74(playerId, temp_s0, func_8007AF78((s16) temp_v1, gPlayerPositions[playerId].unk2, gPlayerPositions)); + temp_s0->ffff = -1; + if ((((playerId * 0x14) + 0x64) < D_80164450[playerId]) && (temp_s0->timer >= 0x259) && (temp_s0->laps < 3) && (temp_v1 = gLapCountByPlayerId[playerId], ((temp_v1 < 3) != 0))) { + func_8001AB74(playerId, temp_s0, func_8007AF78((s32) (s16) temp_v1, gPlayerPositions[playerId].unk2)); } else { - func_8001ABE0(playerId, temp_s0, var_a2); + func_8001ABE0(playerId, (s32) temp_s0); } default: /* switch 1 */ break; @@ -10813,32 +10758,32 @@ void func_8001AC10(s32 playerId, s32 arg1, s32 *arg2) { break; } } else if (temp_a1 == 1) { - temp_s0->unk2 = func_802B2D70(sp2C); - temp_v1_3 = temp_s0->unk2; + temp_s0->ffff = func_802B2D70(sp2C); + temp_v1_3 = temp_s0->ffff; if ((temp_v1_3 >= 0) && (temp_v1_3 < 0x64)) { sp2C->statusEffects |= 0x40000; temp_s0->unk0 = 2; - temp_s0->unk4 = 0; - temp_s0->unk6 = (s16) (temp_s0->unk6 + 1); + temp_s0->timer = 0; + temp_s0->laps += 1; temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0xA); } else { temp_s0->unk0 = 0; - temp_s0->unk4 = 0; + temp_s0->timer = 0; } } break; case 2: /* switch 1 */ - temp_a3 = &gActorList[temp_s0->unk2]; + temp_a3 = &gActorList[temp_s0->ffff]; if (!(temp_a3->flags & 0x8000) || (temp_a3->type != 6) || (temp_a3->state != 0) || (playerId != temp_a3->rot[0])) { temp_s0->unk0 = 0; - temp_s0->unk4 = 0; + temp_s0->timer = 0; sp2C->statusEffects &= 0xFFFBFFFF; - } else if (temp_s0->unkE < temp_s0->unk4) { + } else if (temp_s0->unkE < temp_s0->timer) { temp_s0->unk0 = 3; } break; case 3: /* switch 1 */ - temp_a3_2 = &gActorList[temp_s0->unk2]; + temp_a3_2 = &gActorList[temp_s0->ffff]; if (!(temp_a3_2->flags & 0x8000) || (temp_a3_2->type != 6) || (temp_a3_2->state != 0) || (playerId != temp_a3_2->rot[0])) { if (playerId != temp_a3_2->rot[0]) { @@ -10854,19 +10799,19 @@ void func_8001AC10(s32 playerId, s32 arg1, s32 *arg2) { } } sp2C->statusEffects &= 0xFFFBFFFF; - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0; break; case 34: /* switch 1 */ - temp_s0->unk2 = func_802B2D70(sp2C); - temp_v1_4 = temp_s0->unk2; + temp_s0->ffff = func_802B2D70(sp2C); + temp_v1_4 = temp_s0->ffff; if ((temp_v1_4 >= 0) && (temp_v1_4 < 0x64)) { temp_a3_3 = &gActorList[temp_v1_4]; temp_a3_3->state = 4; sp2C->statusEffects |= 0x40000; temp_s0->unk0 = 0x0023; - temp_s0->unk4 = 0; - temp_s0->unk6 = (s16) (temp_s0->unk6 + 1); + temp_s0->timer = 0; + temp_s0->laps += 1; temp_a2 = D_80163478; temp_v0_2 = &D_80164550[*gPathIndexByPlayerId][(s32) (gNearestWaypointByPlayerId[temp_a2] + 0x1E) % (s32) gWaypointCountByPathIndex[gPathIndexByPlayerId[temp_a2]]]; temp_a3_3->velocity[0] = (f32) ((f64) ((f32) temp_v0_2->wayPointX - sp2C->pos[0]) / 20.0); @@ -10876,14 +10821,14 @@ void func_8001AC10(s32 playerId, s32 arg1, s32 *arg2) { func_800C92CC(playerId & 0xFF, 0x29008009, temp_a2 * 2, temp_a3_3); func_800C98B8(sp2C->pos, sp2C->unk_034, 0x19018014U); } else { - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0; } break; case 35: /* switch 1 */ - temp_a3_4 = &gActorList[temp_s0->unk2]; + temp_a3_4 = &gActorList[temp_s0->ffff]; if (!(temp_a3_4->flags & 0x8000) || (temp_a3_4->type != 6) || (temp_a3_4->state != 4) || (playerId != temp_a3_4->rot[0])) { - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0; sp2C->statusEffects &= 0xFFFBFFFF; } else { @@ -10891,13 +10836,13 @@ void func_8001AC10(s32 playerId, s32 arg1, s32 *arg2) { temp_a3_4->velocity[1] = (f32) ((f64) temp_a3_4->velocity[1] - 0.4); temp_a3_4->pos[2] += temp_a3_4->velocity[2]; temp_a3_4->pos[1] += temp_a3_4->velocity[1]; - if (temp_s0->unk4 >= 0x15) { + if (temp_s0->timer >= 0x15) { temp_s0->unk0 = 0x0024; } } break; case 36: /* switch 1 */ - temp_a3_5 = &gActorList[temp_s0->unk2]; + temp_a3_5 = &gActorList[temp_s0->ffff]; if (!(temp_a3_5->flags & 0x8000) || (temp_a3_5->type != 6) || (temp_a3_5->state != 4) || (playerId != temp_a3_5->rot[0])) { if (playerId != temp_a3_5->rot[0]) { @@ -10911,17 +10856,17 @@ void func_8001AC10(s32 playerId, s32 arg1, s32 *arg2) { temp_a3_5->pos[1] = func_802AE1C0(temp_a3_5->pos[0], (f32) ((f64) temp_a3_5->pos[1] + 30.0), temp_a3_5->pos[2]) + (temp_a3_5->boundingBoxSize + 1.0f); } sp2C->statusEffects &= 0xFFFBFFFF; - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0; break; case 4: /* switch 1 */ if ((s32) gNumActors < 0x50) { - temp_s0->unk2 = func_802B1C9C(sp2C); - temp_v1_5 = temp_s0->unk2; + temp_s0->ffff = func_802B1C9C(sp2C); + temp_v1_5 = temp_s0->ffff; if ((temp_v1_5 >= 0) && (temp_v1_5 < 0x64)) { temp_s0->unk0 = 5; - temp_s0->unk4 = 0; - temp_s0->unk6 = (s16) (temp_s0->unk6 + 1); + temp_s0->timer = 0; + temp_s0->laps += 1; temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0xA); } else { goto block_71; @@ -10932,34 +10877,34 @@ block_71: } break; case 5: /* switch 1 */ - temp_a3_6 = &gActorList[temp_s0->unk2]; + temp_a3_6 = &gActorList[temp_s0->ffff]; if (!(temp_a3_6->flags & 0x8000) || (temp_a3_6->type != 7) || (temp_a3_6->state != 0) || (playerId != temp_a3_6->rot[2])) { - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0; - } else if (temp_s0->unkE < temp_s0->unk4) { - temp_s0->unk4 = 0; + } else if (temp_s0->unkE < temp_s0->timer) { + temp_s0->timer = 0; temp_s0->unk0 = 6; } break; case 6: /* switch 1 */ - temp_a3_7 = &gActorList[temp_s0->unk2]; + temp_a3_7 = &gActorList[temp_s0->ffff]; if (!(temp_a3_7->flags & 0x8000) || (temp_a3_7->type != 7) || (temp_a3_7->state != 0) || (playerId != temp_a3_7->rot[2])) { temp_s0->unk0 = 0; - temp_s0->unk4 = 0; + temp_s0->timer = 0; } else { temp_a3_7->state = 1; - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0; } break; case 7: /* switch 1 */ if ((s32) gNumActors < 0x50) { - temp_s0->unk2 = func_802B1E48(sp2C); - temp_v1_6 = temp_s0->unk2; + temp_s0->ffff = func_802B1E48(sp2C); + temp_v1_6 = temp_s0->ffff; if ((temp_v1_6 >= 0) && (temp_v1_6 < 0x64)) { temp_s0->unk0 = 8; - temp_s0->unk4 = 0; - temp_s0->unk6 = (s16) (temp_s0->unk6 + 1); + temp_s0->timer = 0; + temp_s0->laps += 1; temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0xA); } else { goto block_92; @@ -10970,34 +10915,34 @@ block_92: } break; case 8: /* switch 1 */ - temp_a3_8 = &gActorList[temp_s0->unk2]; + temp_a3_8 = &gActorList[temp_s0->ffff]; if (!(temp_a3_8->flags & 0x8000) || (temp_a3_8->type != 8) || (temp_a3_8->state != 0) || (playerId != temp_a3_8->rot[2])) { - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0; - } else if (temp_s0->unkE < temp_s0->unk4) { + } else if (temp_s0->unkE < temp_s0->timer) { temp_s0->unk0 = 9; } break; case 9: /* switch 1 */ - func_8001ABEC(temp_s0, temp_a1); - temp_a3_9 = &gActorList[temp_s0->unk2]; + func_8001ABEC(temp_s0); + temp_a3_9 = &gActorList[temp_s0->ffff]; if (!(temp_a3_9->flags & 0x8000) || (temp_a3_9->type != 8) || (temp_a3_9->state != 0) || (playerId != temp_a3_9->rot[2])) { temp_s0->unk0 = 0; - temp_s0->unk4 = 0; + temp_s0->timer = 0; } else { temp_a3_9->state = 1; - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0; } break; case 10: /* switch 1 */ if ((s32) gNumActors < 0x50) { - temp_s0->unk2 = func_802B17F4(sp2C); - temp_v1_7 = temp_s0->unk2; + temp_s0->ffff = func_802B17F4(sp2C); + temp_v1_7 = temp_s0->ffff; if ((temp_v1_7 >= 0) && (temp_v1_7 < 0x64)) { temp_s0->unk0 = 0x000B; - temp_s0->unk4 = 0; - temp_s0->unk6 = (s16) (temp_s0->unk6 + 1); + temp_s0->timer = 0; + temp_s0->laps += 1; temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0x3C); } else { goto block_113; @@ -11008,7 +10953,7 @@ block_113: } break; case 11: /* switch 1 */ - temp_a3_10 = &gActorList[temp_s0->unk2]; + temp_a3_10 = &gActorList[temp_s0->ffff]; if (temp_a3_10->state == 6) { var_v1 = 0; if (temp_a3_10->unk1A != -1) { @@ -11030,20 +10975,20 @@ block_113: temp_s0->unk0 = 0; goto block_131; } - if (temp_s0->unkE < temp_s0->unk4) { + if (temp_s0->unkE < temp_s0->timer) { temp_s0->unk0 = 0x000C; temp_s0->unk8 = 0; block_131: - temp_s0->unk4 = 0; + temp_s0->timer = 0; } } break; case 12: /* switch 1 */ - if (((s16) temp_s0->unk4 % 10) == 0) { + if (((s16) temp_s0->timer % 10) == 0) { temp_v1_8 = temp_s0->unk8; if (temp_v1_8 < 5) { var_v0 = 0; - temp_a3_11 = &gActorList[temp_s0->unk2]; + temp_a3_11 = &gActorList[temp_s0->ffff]; switch (temp_v1_8) { /* switch 2 */ case 0: /* switch 2 */ if (temp_a3_11->unk1A != -1) { @@ -11077,34 +11022,34 @@ block_146: } temp_s0->unk8 = (s16) (temp_s0->unk8 + 1); } else { - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0; } } break; case 13: /* switch 1 */ - temp_s0->unk2 = func_802B2C40(sp2C); - temp_v1_9 = temp_s0->unk2; + temp_s0->ffff = func_802B2C40(sp2C); + temp_v1_9 = temp_s0->ffff; if ((temp_v1_9 >= 0) && (temp_v1_9 < 0x64)) { temp_s0->unk0 = 0x000E; - temp_s0->unk4 = 0; - temp_s0->unk6 = (s16) (temp_s0->unk6 + 1); + temp_s0->timer = 0; + temp_s0->laps += 1; temp_s0->unkE = (s16) ((random_int(3U) * 0x14) + 0xA); } else { temp_s0->unk0 = 0; } break; case 14: /* switch 1 */ - temp_a3_12 = &gActorList[temp_s0->unk2]; + temp_a3_12 = &gActorList[temp_s0->ffff]; if (!(temp_a3_12->flags & 0x8000) || (temp_a3_12->type != 0x000D) || (temp_a3_12->state != 0) || (playerId != (s32) temp_a3_12->velocity[0])) { - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0; - } else if (temp_s0->unkE < temp_s0->unk4) { + } else if (temp_s0->unkE < temp_s0->timer) { temp_s0->unk0 = 0x000F; } break; case 15: /* switch 1 */ - temp_a3_13 = &gActorList[temp_s0->unk2]; + temp_a3_13 = &gActorList[temp_s0->ffff]; if (!(temp_a3_13->flags & 0x8000) || (temp_a3_13->type != 0x000D) || (temp_a3_13->state != 0) || (playerId != (s32) temp_a3_13->velocity[0])) { if (playerId != temp_a3_13->rot[0]) { @@ -11117,88 +11062,88 @@ block_146: temp_a3_13->pos[1] = func_802AE1C0(temp_a3_13->pos[0], (f32) ((f64) temp_a3_13->pos[1] + 30.0), temp_a3_13->pos[2]) + temp_a3_13->boundingBoxSize; } } - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0; break; case 22: /* switch 1 */ func_802B2EBC(sp2C); func_800CAC60(playerId & 0xFF); func_8009E5BC(); - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0x0017; - temp_s0->unk6 = (s16) (temp_s0->unk6 + 1); + temp_s0->laps += 1; break; case 23: /* switch 1 */ - if (temp_s0->unk4 >= 0xF1) { + if (temp_s0->timer >= 0xF1) { func_800CAD40((u8) playerId, temp_a1); - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0; } break; case 25: /* switch 1 */ sp2C->statusEffects |= 0x2000; - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0x001A; - temp_s0->unk6 = (s16) (temp_s0->unk6 + 1); + temp_s0->laps += 1; break; case 26: /* switch 1 */ if (!(sp2C->unk_0BC & 0x200)) { temp_s0->unk0 = 0; } - temp_s0->unk4 = 0; + temp_s0->timer = 0; break; case 27: /* switch 1 */ sp2C->statusEffects |= 0x800; - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0x001C; - temp_s0->unk6 = (s16) (temp_s0->unk6 + 1); + temp_s0->laps += 1; break; case 28: /* switch 1 */ - if ((sp2C->unk_0BC << 0) >= 0) { + if (!(sp2C->unk_0BC & 0x80000000)) { temp_s0->unk0 = 0; } - temp_s0->unk4 = 0; + temp_s0->timer = 0; break; case 29: /* switch 1 */ sp2C->statusEffects |= 0x200; - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0; - temp_s0->unk6 = (s16) (temp_s0->unk6 + 1); + temp_s0->laps += 1; break; case 30: /* switch 1 */ - if (temp_s0->unk4 >= 0x3D) { + if (temp_s0->timer >= 0x3D) { sp2C->statusEffects |= 0x200; - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0x001D; } break; case 31: /* switch 1 */ - if (temp_s0->unk4 >= 0x3D) { + if (temp_s0->timer >= 0x3D) { sp2C->statusEffects |= 0x200; - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0x001E; } break; case 32: /* switch 1 */ - temp_s0->unk4 = 0; + temp_s0->timer = 0; temp_s0->unk0 = 0x0021; temp_s0->unkE = 0x0258; break; case 33: /* switch 1 */ - if (((s16) temp_s0->unk4 % 60) == 0) { + if (((s16) temp_s0->timer % 60) == 0) { sp2C->statusEffects |= 0x200; - if (temp_s0->unkE < temp_s0->unk4) { - temp_s0->unk4 = 0; + if (temp_s0->unkE < temp_s0->timer) { + temp_s0->timer = 0; temp_s0->unk0 = 0; } } break; } - if (temp_s0->unk4 < 0x2710) { - temp_s0->unk4 = (s16) (temp_s0->unk4 + 1); + if (temp_s0->timer < 0x2710) { + temp_s0->timer += 1; } if (sp2C->unk_0BC & 0x80002200) { - temp_s0->unk4 = 0; + temp_s0->timer = 0; } } } diff --git a/src/code_80005FD0.h b/src/code_80005FD0.h index 616e900e0..828fc1d3e 100644 --- a/src/code_80005FD0.h +++ b/src/code_80005FD0.h @@ -82,13 +82,15 @@ void func_80011AE4(s32); void func_80012220(VehicleStuff*); void func_800122D8(); void func_80012A48(TrainCarStuff*, s16); +void func_80012AC0(); +void func_80012DC0(s32, Player*); +void func_800133C4(); +void func_80013854(Player*); f32 func_80013C74(s16, s16); void func_80013D20(VehicleStuff*); void func_80013F7C(s32, Player*, VehicleStuff*, f32, f32, s32, u32); f32 func_800145A8(s16, f32, s16); void func_800146B8(s32, s32, VehicleStuff*); -void func_80012AC0(); -void func_800133C4(); void func_8001487C(); void func_800148C4(s32, Player*); void func_8001490C(s32); @@ -103,6 +105,8 @@ void func_80014CC0(s32, Player*); void func_80014D08(s32); void func_80014D30(s32, s32); void func_8001530C(); +void func_80015314(s32, s32, s32); +void func_80015390(Camera*, Player*, s32); void func_8001968C(); void func_8001C05C(); void func_80019DE4(); @@ -125,6 +129,9 @@ extern f32 D_800DCA4C[]; // See bss_80005FD0.s extern UnkActorInner D_80162E70; +extern s16 D_80162EB0; +extern u16 D_801631E0[8]; +extern s32 D_80163488; extern s32 D_8016337C; extern s32 gModeSelection; diff --git a/src/code_80027D00.c b/src/code_80027D00.c index e15be8bdb..8333e733d 100644 --- a/src/code_80027D00.c +++ b/src/code_80027D00.c @@ -757,10 +757,10 @@ void func_80029200(Player *player, s8 arg1) { } #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c static f32 D_800DDBD4[8] = { 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f }; -void func_8002934C(Player *player, struct Camera *arg1, s8 arg2, s8 arg3) { +void func_8002934C(Player *player, Camera *camera, s8 arg2, s8 arg3) { f32 sp50; f32 sp28; void *sp24; @@ -798,8 +798,8 @@ void func_8002934C(Player *player, struct Camera *arg1, s8 arg2, s8 arg3) { void *temp_a3; temp_a3 = player + (arg2 * 2); - temp_a3->unk48 = atan2s(player->pos[0] - arg1->unk0, player->pos[2] - arg1->unk8); - player->unk_244[arg2] = (u16) ((s32) ((player->unk_02E + (s16) temp_a3->unk48 + player->unk_0C0) & 0xFFFF) / 128); + player->unk_048[arg2] = atan2s(player->pos[0] - camera->pos[0], player->pos[2] - camera->pos[2]); + player->unk_244[arg2] = (u16) ((s32) ((player->unk_02C[1] + player->unk_048[arg2] + player->unk_0C0) & 0xFFFF) / 128); temp_v1 = player->unk_0BC; temp_f0 = player->unk_230 - player->unk_23C; temp_f2 = D_800DDBD4[player->characterId] * 18.0f * player->unk_224; @@ -835,7 +835,7 @@ void func_8002934C(Player *player, struct Camera *arg1, s8 arg2, s8 arg3) { } sp24 = temp_a3; func_80029200(player, arg2); - temp_a0 = (player->unk_02E + temp_a3->unk48 + player->unk_0C0) & 0xFFFF; + temp_a0 = (player->unk_02C[1] + temp_a3->unk48 + player->unk_0C0) & 0xFFFF; sp20 = temp_a0; sp28 = sins((u16) temp_a0); move_s16_towards(temp_a3 + 0x50, (s16) (s32) ((coss((u16) temp_a0) * (f32) temp_a3->unkCC) + ((f32) temp_a3->unkD4 * sp28)), 0.5f); @@ -868,7 +868,7 @@ block_28: if (((player->unk_0BC & 8) == 8) && ((player->unk_0CA & 2) == 2)) { temp_a3->unk50 = 0; } - temp_t9 = (player->unk_02E + temp_a3->unk48 + player->unk_0C0) & 0xFFFF; + temp_t9 = (player->unk_02C[1] + temp_a3->unk48 + player->unk_0C0) & 0xFFFF; if (((player->unk_0BC & 0x80) == 0x80) || ((player->unk_0BC & 0x40) == 0x40) || ((player->unk_0BC & 0x80000) == 0x80000) || ((player->unk_0BC & 0x800000) == 0x800000) || ((player->unk_0BC & 0x20000) == 0x20000) || (player->unk_044 & 0x800)) { if (temp_t9 >= 0x7FF9) { temp_t6 = ((s32) (-temp_t9 & 0xFFFF) / var_a1) & 0xFFFF; @@ -902,7 +902,7 @@ block_28: if (((temp_v1_5 & 0x80000) == 0x80000) || ((temp_v1_5 & 0x800000) == 0x800000) || (player->unk_044 & 0x800)) { temp_a3->unk24C = 4U; } - if (((player->unk_0BC & 0x400) == 0x400) || ((player->unk_0BC & 0x01000000) == 0x01000000) || ((player->unk_0BC & 0x02000000) == 0x02000000) || ((player->unk_0BC << 0xF) < 0) || (player->unk_0BC & 0x80) || (player->unk_0BC & 0x40)) { + if (((player->unk_0BC & 0x400) == 0x400) || ((player->unk_0BC & 0x01000000) == 0x01000000) || ((player->unk_0BC & 0x02000000) == 0x02000000) || (player->unk_0BC & 0x10000) || (player->unk_0BC & 0x80) || (player->unk_0BC & 0x40)) { var_a2 = 1 << temp_t3; player->unk_002 |= var_a2; temp_t9_2 = arg3 * 2; @@ -935,7 +935,6 @@ block_28: player->unk_002 |= var_a2; } } -/* Warning: struct Camera is not defined (only forward-declared) */ #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002934C.s") #endif @@ -5551,140 +5550,119 @@ void func_80036C5C(Player *arg0) { } } -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b void func_80036CB4(Player *player) { - s32 var_v0; - s32 var_v0_2; - s32 var_v1; + s32 test; - var_v0 = player->unk_0BC; - var_v1 = var_v0 & 0x10; - if ((var_v1 == 0x10) && ((player->unk_000 & 0x4000) == 0x4000)) { - var_v0_2 = (s16) player->unk_0C0 / 182; - if (var_v0_2 > 0) { - var_v0_2 = (s16) player->unk_0C0 / 182; - player->unk_07C = (((s32) ((((s32) player->unk_07C >> 0x10) * 0xD) + 0x2B1) / 106) + 0x28) << 0x10; + if (((player->unk_0BC & 0x10) == 0x10) && ((player->unk_000 & 0x4000) == 0x4000)) { + if ((player->unk_0C0 / 182) > 0) { + test = ((((player->unk_07C >> 0x10) * 0xD) + 0x2B1) / 106) + 0x28; + player->unk_07C = test << 0x10; } - if (var_v0_2 < 0) { - player->unk_07C = (((s32) ((((s32) player->unk_07C >> 0x10) * 0xD) + 0x2B1) / 106) - 0x35) << 0x10; + if ((player->unk_0C0 / 182) < 0) { + test = ((((player->unk_07C >> 0x10) * 0xD) + 0x2B1) / 106) - 0x35; + player->unk_07C = test << 0x10; } - var_v0 = player->unk_0BC & ~0x10; - player->unk_0BC = var_v0; - var_v1 = var_v0 & 0x10; + player->unk_0BC &= ~0x10; } - if ((var_v1 == 0x10) && ((player->unk_000 & 0x4000) != 0x4000)) { - player->unk_0BC = var_v0 & ~0x10; + if (((player->unk_0BC & 0x10) == 0x10) && ((player->unk_000 & 0x4000) != 0x4000)) { + player->unk_0BC &= ~0x10; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80036CB4.s") -#endif -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b -void func_80036DB4(Player *player, f32 *arg1, f32 *arg2) { +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0_0.s +extern f64 D_800EDD90;// = 0.02; +extern f64 D_800EDD98;// = 0.01; +extern f64 D_800EDDA0;// = 0.05; +extern f64 D_800EDDA8;// = 0.1; +extern f64 D_800EDDB0;// = 0.15; +extern f64 D_800EDDB8;// = 0.1; +extern f64 D_800EDDC0;// = 0.05; + +void func_80036DB4(Player *player, Vec3f arg1, Vec3f arg2) { + s16 thing; + s16 stackPadding0; f32 sp20; - f32 var_f14; f32 var_f18; - f32 var_f2; - f64 var_f10; - s16 var_v0; - s32 temp_a0; - s32 temp_t0; s32 temp_t6; - temp_t0 = player->unk_0BC; - if (((temp_t0 & 0x1000) == 0x1000) || ((temp_t0 & 0x20) == 0x20)) { - arg1->unk0 = 0.0f; - arg1->unk4 = 0.0f; - arg1->unk8 = 0.0f; - func_802B63B8(arg1, (f32 (*)[3]) player->unk_174[0]); + if (((player->unk_0BC & 0x1000) == 0x1000) || ((player->unk_0BC & 0x20) == 0x20)) { + arg1[0] = 0.0f; + arg1[1] = 0.0f; + arg1[2] = 0.0f; + func_802B63B8(arg1, player->unk_174); } else { - temp_a0 = temp_t0 & 0x10; - if ((temp_a0 == 0x10) && ((temp_t0 & 2) != 2)) { - var_f14 = -player->unk_20C; - var_f2 = -(player->unk_094 / 18.0f) * 216.0f; - var_f18 = player->unk_208 + (var_f2 * 3.0f) + (var_f14 * 10.0f); + if (((player->unk_0BC & 0x10) == 0x10) && ((player->unk_0BC & 2) != 2)) { + var_f18 = player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) * 3.0f) + (-player->unk_20C * 10.0f); sp20 = player->unk_084 * 3.0f; - } else if (!(temp_t0 & 0x800) && !(player->unk_044 & 0x4000)) { - var_v0 = player->unk_0FA; - if (var_v0 > 0) { - var_v0 *= -1; + } else if (!(player->unk_0BC & 0x800) && !(player->unk_044 & 0x4000)) { + thing = player->unk_0FA; + if (thing > 0) { + thing *= -1; } - temp_t6 = (s32) player->unk_07C >> 0x10; + temp_t6 = player->unk_07C >> 0x10; if ((temp_t6 < 0x15) && (temp_t6 >= -0x14)) { - if (var_v0 < 0x14) { - var_f14 = -player->unk_20C; - var_f2 = -(player->unk_094 / 18.0f) * 216.0f; - var_f10 = (f64) (player->unk_208 + (var_f2 / 3.0f)) + ((f64) -player->unk_09C * 0.02) + (f64) (var_f14 * 50.0f); - goto block_16; + if (thing < 0x14) { + var_f18 = (player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) / 3.0f)) + (-player->unk_09C * 0.02) + (-player->unk_20C * 50.0f); + } else { + var_f18 = (player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) / 3.0f)) + ((temp_t6 * 0.01) + (-player->unk_09C * 0.05)) + (-player->unk_20C * 50.0f); } - var_f14 = -player->unk_20C; - var_f2 = -(player->unk_094 / 18.0f) * 216.0f; - var_f18 = (f32) ((f64) (player->unk_208 + (var_f2 / 3.0f)) + (((f64) temp_t6 * 0.01) + ((f64) -player->unk_09C * 0.05)) + (f64) (var_f14 * 50.0f)); } else { - var_f14 = -player->unk_20C; - var_f2 = -(player->unk_094 / 18.0f) * 216.0f; - var_f10 = (f64) (player->unk_208 + (var_f2 / 3.0f)) + (((f64) temp_t6 * 0.1) + ((f64) -player->unk_09C * 0.15)) + (f64) (var_f14 * 50.0f); -block_16: - var_f18 = (f32) var_f10; + var_f18 = (player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) / 3.0f)) + ((temp_t6 * 0.1) + (-player->unk_09C * 0.15)) + (-player->unk_20C * 50.0f); } sp20 = player->unk_084; } else { - var_f14 = -player->unk_20C; - var_f2 = -(player->unk_094 / 18.0f) * 216.0f; + var_f18 = player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) * 1.5) + (((player->unk_07C >> 0x10) * 0.1) + (-player->unk_09C * 0.05)) + (-player->unk_20C * 50.0f); sp20 = player->unk_084; - var_f18 = (f32) ((f64) player->unk_208 + ((f64) var_f2 * 1.5) + (((f64) ((s32) player->unk_07C >> 0x10) * 0.1) + ((f64) -player->unk_09C * 0.05)) + (f64) (var_f14 * 50.0f)); } - if ((temp_t0 & 0x200) == 0x200) { - if ((temp_a0 == 0x10) && ((temp_t0 & 2) != 2)) { - var_f18 = player->unk_208 + (var_f2 * 3.0f) + (var_f14 * 10.0f); + if ((player->unk_0BC & 0x200) == 0x200) { + if (((player->unk_0BC & 0x10) == 0x10) && ((player->unk_0BC & 2) != 2)) { + var_f18 = player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) * 3.0f) + (-player->unk_20C * 10.0f); sp20 = player->unk_084 * 3.0f; } else { + var_f18 = player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) / 3.0f); sp20 = player->unk_084; - var_f18 = player->unk_208 + (var_f2 / 3.0f); } } - arg1->unk4 = 0.0f; - arg1->unk0 = (player->unk_090 + var_f18) * player->unk_094; - arg1->unk8 = (f32) (player->unk_094 * sp20); - func_802B63B8(arg1, (f32 (*)[3]) player->unk_174[0]); + arg1[0] = (player->unk_090 + var_f18) * player->unk_094; + arg1[1] = 0.0f; + arg1[2] = player->unk_094 * sp20; + func_802B63B8(arg1, player->unk_174); } - arg2->unk0 = arg1->unk0; - arg2->unk4 = (f32) arg1->unk4; - arg2->unk8 = (f32) arg1->unk8; + arg2[0] = arg1[0]; + arg2[1] = arg1[1]; + arg2[2] = arg1[2]; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_80036DB4.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0_0.s +extern f64 D_800EDDC8;// = 0.02; +extern f64 D_800EDDD0;// = 0.01; +extern f64 D_800EDDD8;// = 0.05; +extern f64 D_800EDDE0;// = 0.1; +extern f64 D_800EDDE8;// = 0.15; +extern f64 D_800EDDF0;// = 0.1; +extern f64 D_800EDDF8;// = 0.05; + void func_800371F4(Player *player, f32 *arg1, f32 *arg2) { + s16 var_v0; f32 sp20; - f32 var_f14; f32 var_f18; - f32 var_f2; - s16 var_v0; - s32 temp_a0; - s32 temp_t0; s32 temp_t6; - temp_t0 = player->unk_0BC; - if (((temp_t0 & 0x1000) == 0x1000) || ((temp_t0 & 0x20) == 0x20)) { - arg1->unk0 = 0.0f; - arg1->unk4 = 0.0f; - arg1->unk8 = 0.0f; - func_802B63B8(arg1, (f32 (*)[3]) player->unk_174[0]); + if (((player->unk_0BC & 0x1000) == 0x1000) || ((player->unk_0BC & 0x20) == 0x20)) { + arg1[0] = 0.0f; + arg1[1] = 0.0f; + arg1[2] = 0.0f; + func_802B63B8(arg1, player->unk_174); } else { - temp_a0 = temp_t0 & 0x10; - if ((temp_a0 == 0x10) && ((temp_t0 & 2) != 2)) { - var_f2 = -(player->unk_094 / 18.0f) * 216.0f; - var_f14 = -player->unk_20C * 50.0f; - var_f18 = player->unk_208 + (var_f2 * 3.0f) + var_f14; + if (((player->unk_0BC & 0x10) == 0x10) && ((player->unk_0BC & 2) != 2)) { + var_f18 = player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) * 3.0f) + (-player->unk_20C * 50.0f); sp20 = player->unk_084 * 3.0f; - } else if (!(temp_t0 & 0x800) && !(player->unk_044 & 0x4000)) { + } else if (!(player->unk_0BC & 0x800) && !(player->unk_044 & 0x4000)) { var_v0 = player->unk_0FA; if (var_v0 > 0) { var_v0 *= -1; @@ -5692,43 +5670,35 @@ void func_800371F4(Player *player, f32 *arg1, f32 *arg2) { temp_t6 = (s32) player->unk_07C >> 0x10; if ((temp_t6 < 0x15) && (temp_t6 >= -0x14)) { if (var_v0 < 0x14) { - var_f2 = -(player->unk_094 / 18.0f) * 216.0f; - var_f14 = -player->unk_20C * 50.0f; - var_f18 = (f32) ((f64) (player->unk_208 + (var_f2 / 3.0f)) + ((f64) -player->unk_09C * 0.02) + (f64) var_f14); + var_f18 = (player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) / 3.0f)) + (-player->unk_09C * 0.02) + (-player->unk_20C * 50.0f); } else { - var_f2 = -(player->unk_094 / 18.0f) * 216.0f; - var_f14 = -player->unk_20C * 50.0f; - var_f18 = (f32) (((f64) (player->unk_208 + (var_f2 / 3.0f)) - (((f64) temp_t6 * 0.01) + ((f64) player->unk_09C * 0.05))) + (f64) var_f14); + var_f18 = ((player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) / 3.0f)) - ((temp_t6 * 0.01) + (player->unk_09C * 0.05))) + (-player->unk_20C * 50.0f); } } else { - var_f2 = -(player->unk_094 / 18.0f) * 216.0f; - var_f14 = -player->unk_20C * 50.0f; - var_f18 = (f32) (((f64) (player->unk_208 + (var_f2 / 3.0f)) - (((f64) temp_t6 * 0.1) + ((f64) player->unk_09C * 0.15))) + (f64) var_f14); + var_f18 = ((player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) / 3.0f)) - ((temp_t6 * 0.1) + (player->unk_09C * 0.15))) + (-player->unk_20C * 50.0f); } sp20 = player->unk_084; } else { - var_f2 = -(player->unk_094 / 18.0f) * 216.0f; - var_f14 = -player->unk_20C * 50.0f; + var_f18 = ((player->unk_208 + ((f64) (-(player->unk_094 / 18.0f) * 216.0f) * 1.5)) - (((player->unk_07C >> 0x10) * 0.1) + (player->unk_09C * 0.05))) + (-player->unk_20C * 50.0f); sp20 = player->unk_084; - var_f18 = (f32) ((((f64) player->unk_208 + ((f64) var_f2 * 1.5)) - (((f64) ((s32) player->unk_07C >> 0x10) * 0.1) + ((f64) player->unk_09C * 0.05))) + (f64) var_f14); } - if ((temp_t0 & 0x200) == 0x200) { - if ((temp_a0 == 0x10) && ((temp_t0 & 2) != 2)) { - var_f18 = player->unk_208 + (var_f2 * 3.0f) + var_f14; + if ((player->unk_0BC & 0x200) == 0x200) { + if (((player->unk_0BC & 0x10) == 0x10) && ((player->unk_0BC & 2) != 2)) { + var_f18 = player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) * 3.0f) + (-player->unk_20C * 50.0f); sp20 = player->unk_084 * 3.0f; } else { + var_f18 = player->unk_208 + ((-(player->unk_094 / 18.0f) * 216.0f) / 3.0f); sp20 = player->unk_084; - var_f18 = player->unk_208 + (var_f2 / 3.0f); } } - arg1->unk4 = 0.0f; - arg1->unk0 = -(player->unk_090 + var_f18) * player->unk_094; - arg1->unk8 = (f32) (player->unk_094 * sp20); - func_802B63B8(arg1, (f32 (*)[3]) player->unk_174[0]); + arg1[0] = -(player->unk_090 + var_f18) * player->unk_094; + arg1[1] = 0.0f; + arg1[2] = player->unk_094 * sp20; + func_802B63B8(arg1, player->unk_174); } - arg2->unk0 = arg1->unk0; - arg2->unk4 = (f32) arg1->unk4; - arg2->unk8 = (f32) arg1->unk8; + arg2[0] = arg1[0]; + arg2[1] = arg1[1]; + arg2[2] = arg1[2]; } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_800371F4.s") diff --git a/src/code_80027D00.h b/src/code_80027D00.h index 26c7ae7f6..e63ce019c 100644 --- a/src/code_80027D00.h +++ b/src/code_80027D00.h @@ -51,6 +51,8 @@ void func_800332E8(Player*, s32); void func_800337CC(Player*, f32, s32); void func_80033850(Player*, f32); void func_80036C5C(Player*); +void func_80036CB4(Player*); +void func_80036DB4(Player*, Vec3f, Vec3f); void func_80037614(Player*, Vec3f, Vec3f); void func_8003777C(Player*, Vec3f, Vec3f); void func_800378E8(Player*, Vec3f, Vec3f); diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c index b6b101af4..a91c41249 100644 --- a/src/code_8006E9C0.c +++ b/src/code_8006E9C0.c @@ -190,25 +190,22 @@ void func_8006ED60() { } #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern OSMesgQueue gDmaMesgQueue; -extern void *gMainReceivedMesg; -extern OSIoMesg gDmaIoMesg; -extern s8 _other_texturesSegmentRomStart; +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +extern ? _other_texturesSegmentRomStart; -u8 *func_8006ED94(s32 arg0, u8 *arg1, u32 arg2, s32 arg3) { - void *sp28; - u32 temp_a1; - void *temp_a0; +s32 func_8006ED94(s32 *arg0, s32 arg1, s32 arg2, s32 arg3) { + u8 *sp28; + s32 temp_a1; + u8 *temp_a0; temp_a0 = arg1 + arg3; temp_a1 = (arg2 + 0xF) & ~0xF; arg2 = temp_a1; sp28 = temp_a0; - osInvalDCache(temp_a0, temp_a1); - osPiStartDma(&gDmaIoMesg, 0, 0, (arg0 & 0xFFFFFF) + &_other_texturesSegmentRomStart, sp28, arg2, &gDmaMesgQueue); + osInvalDCache(temp_a0, (u32) temp_a1); + osPiStartDma(&gDmaIoMesg, 0, 0, (u32) (((s32) arg0 & 0xFFFFFF) + &_other_texturesSegmentRomStart), sp28, (u32) arg2, &gDmaMesgQueue); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1); - mio0decode(temp_a0, arg1); + mio0decode(temp_a0, (u8 *) arg1); return arg1; } #else @@ -719,18 +716,25 @@ GLOBAL_ASM("asm/non_matchings/code_8006E9C0/func_8006F8CC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_8006F008(); // extern -void func_8006F8CC(); // extern +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b +typedef struct { + /* 0x00 */ char pad0[4]; + /* 0x04 */ f32 unk_04; + /* 0x08 */ f32 unk8; /* inferred */ + /* 0x0C */ f32 unk_0C; + /* 0x10 */ char pad10[0x10]; /* maybe part of unk_0C[5]? */ +} struct_D_8018CE10; /* size = 0x20 */ + +? func_8006F008(); /* extern */ +? func_8006F8CC(); /* extern */ extern s32 D_801655D8; extern s32 D_801655E8; extern s32 D_801655F8; extern s32 D_80165608; extern s32 D_80165618; extern s32 D_80165628; -extern s32 D_80165658; +extern ? D_80165658; extern s16 D_801656F0; -extern s16 D_80165730; extern s8 D_8016576A; extern s8 D_8016579C; extern s8 D_801657AE; @@ -754,14 +758,13 @@ extern s8 D_801658DC; extern s8 D_801658E4; extern s8 D_801658EC; extern s8 D_801658F4; -extern s8 D_801658FE; extern ? D_8018CF28; extern ? D_8018CF50; extern ? D_8018CFAC; extern ? D_8018CFB4; extern ? D_8018CFBC; extern ? D_8018CFC4; -extern f32 D_8018D050; +extern ? D_8018D050; extern ? D_8018D0F0; extern s32 D_8018D114; extern s32 D_8018D160; @@ -793,40 +796,35 @@ extern s32 D_8018D2A4; extern s32 D_8018D2AC; extern s32 D_8018D2B4; extern s32 D_8018D2BC; -extern s32 D_8018D2C8; +extern ? D_8018D2C8; extern s16 D_8018D2F0; extern s16 D_8018D2F8; extern s32 D_8018D320; void func_8006FA94(void) { - ? *temp_a1; - ? *temp_a2; - ? *temp_v1; - s16 temp_a0_2; + ? *var_a0_2; + ? *var_a1; + ? *var_a1_2; + ? *var_a2; + ? *var_a2_2; + ? *var_a3; + ? *var_t0; + ? *var_v1; + Player *temp_v0_3; + Player *temp_v0_4; + Player *temp_v0_5; + Player *var_v0; s16 temp_t7; + s16 var_a0; s32 temp_t6; s32 temp_v0; s32 temp_v0_2; s8 temp_ra; - u32 temp_a0; - void *temp_v0_3; - void *temp_v0_4; - void *temp_v0_5; - ? *phi_v1; - ? *phi_a1; - ? *phi_a2; - ? *phi_a0; - ? *phi_a1_2; - ? *phi_a2_2; - struct_D_8018CE10 *phi_v1_2; - s16 phi_a0_2; - ? *phi_a3; - Player *phi_v0; - ? *phi_t0; + struct_D_8018CE10 *var_v1_2; func_8006F8CC(); func_8006F008(); - osSetTime(0, 0); + osSetTime(/* u64+0x0 */ 0, /* u64+0x4 */ 0); D_8018D170 = 0; D_8018D190 = 0; D_8018D188 = 0; @@ -850,94 +848,95 @@ void func_8006FA94(void) { D_80165658.unk0 = 0; temp_ra = D_8018EDF3; D_801658BC = D_801658C6; - if (temp_ra != ONE_PLAYERS_SELECTED) { - if (temp_ra != TWO_PLAYERS_SELECTED) { - if (temp_ra != THREE_PLAYERS_SELECTED) { - if (temp_ra != FOUR_PLAYERS_SELECTED) { - - } else { - if (gModeSelection == VERSUS) { - D_8018D114 = 0xA; - D_8018D178 = 0x1E; - D_8018D180 = 0x1E; - } else { - D_8018D114 = 0xB; - D_8018D178 = 0x1E; - D_8018D180 = 0x1E; - } - D_8018D2AC = 0xA; - } - } else if (gModeSelection == VERSUS) { - D_8018D114 = 8; - D_8018D178 = 0x64; - D_8018D180 = 0x96; - D_8018D2AC = 0x3C; - } else { - D_8018D180 = 9; - D_8018D178 = 0x64; - D_8018D180 = 0x96; - D_8018D2AC = 0x3C; - } - } else if (gScreenModeSelection == SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL) { + switch (temp_ra) { /* irregular */ + case 1: + if (gModeSelection == 0) { + D_8018D114 = 0; + D_8018D178 = 0x00000096; + D_8018D114 = 0x000000F0; + } else { + D_8018D114 = 1; + D_8018D178 = 0x0000000A; + D_8018D180 = 0; + } + break; + case 2: + if (gScreenModeSelection == 1) { temp_v0 = gModeSelection; - if (temp_v0 == GRAND_PRIX) { + if (temp_v0 == 0) { D_8018D114 = 2; - D_8018D178 = 0x96; - D_8018D180 = 0xF0; - D_8018D2AC = 0x3C; - } else if (temp_v0 == VERSUS) { + D_8018D178 = 0x00000096; + D_8018D180 = 0x000000F0; + D_8018D2AC = 0x0000003C; + } else if (temp_v0 == 2) { D_8018D114 = 3; - D_8018D178 = 0x1E; - D_8018D180 = 0x1E; - D_8018D2AC = 0x3C; + D_8018D178 = 0x0000001E; + D_8018D180 = 0x0000001E; + D_8018D2AC = 0x0000003C; } else { D_8018D114 = 4; - D_8018D178 = 0x28; - D_8018D180 = 0x28; - D_8018D2AC = 0x3C; + D_8018D178 = 0x00000028; + D_8018D180 = 0x00000028; + D_8018D2AC = 0x0000003C; } } else { temp_v0_2 = gModeSelection; - if (temp_v0_2 == GRAND_PRIX) { + if (temp_v0_2 == 0) { D_8018D114 = 5; - } else if (temp_v0_2 == VERSUS) { + } else if (temp_v0_2 == 2) { D_8018D114 = 6; } else { D_8018D114 = 7; } } - } else if (gModeSelection == GRAND_PRIX) { - D_8018D114 = 0; - D_8018D178 = 0x96; - D_8018D114 = 0xF0; - } else { - D_8018D114 = 1; - D_8018D178 = 0xA; - D_8018D180 = 0; + break; + case 3: + if (gModeSelection == 2) { + D_8018D114 = 8; + D_8018D178 = 0x00000064; + D_8018D180 = 0x00000096; + D_8018D2AC = 0x0000003C; + } else { + D_8018D180 = 9; + D_8018D178 = 0x00000064; + D_8018D180 = 0x00000096; + D_8018D2AC = 0x0000003C; + } + break; + case 4: + if (gModeSelection == 2) { + D_8018D114 = 0x0000000A; + D_8018D178 = 0x0000001E; + D_8018D180 = 0x0000001E; + } else { + D_8018D114 = 0x0000000B; + D_8018D178 = 0x0000001E; + D_8018D180 = 0x0000001E; + } + D_8018D2AC = 0x0000000A; + break; } if (gEnableDebugMode == 0) { D_8016576A = 0; D_8016579C = 0; } + var_a0 = 0; if (temp_ra > 0) { - phi_v1 = &D_8018CFBC; - phi_a1 = &D_8018CFAC; - phi_a2 = &D_8018CFC4; - phi_a0 = &D_8018CFB4; + var_a0_2 = &D_8018CFB4; + var_a2 = &D_8018CFC4; + var_a1 = &D_8018CFAC; + var_v1 = &D_8018CFBC; do { - temp_a0 = phi_a0 + 1; - temp_v1 = phi_v1 + 1; - temp_a1 = phi_a1 + 1; - temp_a2 = phi_a2 + 1; - temp_v1->unk-1 = 0; - temp_a1->unk-1 = 0; - temp_a2->unk-1 = 0; - temp_a0->unk-1 = 0; - phi_v1 = temp_v1; - phi_a1 = temp_a1; - phi_a2 = temp_a2; - phi_a0 = temp_a0; - } while (temp_a0 < (temp_ra + &D_8018CFB4)); + var_a0_2 += 1; + var_v1 += 1; + var_a1 += 1; + var_a2 += 1; + var_v1->unk-1 = 0; + var_a1->unk-1 = 0; + var_a2->unk-1 = 0; + var_a0_2->unk-1 = 0; + } while ((u32) var_a0_2 < (u32) (temp_ra + &D_8018CFB4)); + var_a0 = 0; } D_8018D204 = 1; D_8018D1FC = 0; @@ -961,8 +960,8 @@ void func_8006FA94(void) { D_801656F0 = 0; D_801657B2 = 0; D_801657D8 = D_801657B2; - D_8018D214 = D_801657D8; - D_801657B0 = D_8018D214; + D_8018D214 = (s32) D_801657D8; + D_801657B0 = (s8) D_8018D214; D_801657AE = D_801657B0; D_8018D20C = 0; D_8018D2F8 = 0; @@ -987,58 +986,56 @@ void func_8006FA94(void) { D_8018D16C = temp_t7; D_8018D17C = temp_t7; D_8018D174 = temp_t7; - phi_a1_2 = &D_8018D050; - phi_a2_2 = &D_8018D0F0; - phi_v1_2 = D_8018CE10; - phi_a0_2 = 0; - phi_a3 = &D_8018CF50; - phi_v0 = gPlayerOne; - phi_t0 = &D_8018CF28; + var_v0 = gPlayerOne; + var_t0 = &D_8018CF28; + var_a3 = &D_8018CF50; + var_v1_2 = D_8018CE10; + var_a2_2 = &D_8018D0F0; + var_a1_2 = &D_8018D050; do { - phi_a1_2->unk0 = -32.0f; - phi_a2_2->unk0 = -32.0f; - phi_v1_2->unk_0C = 0.0f; - phi_v1_2->unk_08 = 0.0f; - phi_v1_2->unk_04 = 0.0f; - phi_a3->unk0 = phi_a0_2; - phi_t0->unk0 = phi_v0; - phi_v0->unk_040 = -1; - temp_v0_3 = phi_v0 + 0xDD8; - phi_t0->unk4 = temp_v0_3; - phi_a3->unk2 = phi_a0_2 + 1; - phi_v1_2->unk24 = 0.0f; - phi_v1_2->unk28 = 0.0f; - phi_v1_2->unk2C = 0.0f; - phi_a2_2->unk4 = -32.0f; - phi_a1_2->unk4 = -32.0f; - temp_v0_3->unk40 = -1; + var_a1_2->unk0 = -32.0f; + var_a2_2->unk0 = -32.0f; + var_v1_2->unk_0C = 0.0f; + var_v1_2->unk8 = 0.0f; + var_v1_2->unk_04 = 0.0f; + var_a3->unk0 = var_a0; + var_t0->unk0 = var_v0; + var_v0->unk_040 = -1; + temp_v0_3 = var_v0 + 0xDD8; + var_t0->unk4 = temp_v0_3; + var_a3->unk2 = (s16) (var_a0 + 1); + var_v1_2->unk24 = 0.0f; + var_v1_2->unk28 = 0.0f; + var_v1_2->unk2C = 0.0f; + var_a2_2->unk4 = -32.0f; + var_a1_2->unk4 = -32.0f; + temp_v0_3->unk_040 = -1; temp_v0_4 = temp_v0_3 + 0xDD8; - phi_a3->unk4 = phi_a0_2 + 2; - phi_t0->unk8 = temp_v0_4; - phi_v1_2->unk44 = 0.0f; - phi_v1_2->unk48 = 0.0f; - phi_v1_2->unk4C = 0.0f; - phi_a2_2->unk8 = -32.0f; - phi_a1_2->unk8 = -32.0f; - temp_v0_4->unk40 = -1; + var_a3->unk4 = (s16) (var_a0 + 2); + var_t0->unk8 = temp_v0_4; + var_v1_2->unk44 = 0.0f; + var_v1_2->unk48 = 0.0f; + var_v1_2->unk4C = 0.0f; + var_a2_2->unk8 = -32.0f; + var_a1_2->unk8 = -32.0f; + temp_v0_4->unk_040 = -1; temp_v0_5 = temp_v0_4 + 0xDD8; - phi_t0->unkC = temp_v0_5; - phi_a3->unk6 = phi_a0_2 + 3; - temp_a0_2 = phi_a0_2 + 4; - phi_v1_2->unk64 = 0.0f; - phi_v1_2->unk68 = 0.0f; - phi_v1_2->unk6C = 0.0f; - phi_a2_2->unkC = -32.0f; - phi_a1_2->unkC = -32.0f; - temp_v0_5->unk40 = -1; - phi_a1_2 += 0x10; - phi_a2_2 += 0x10; - phi_v1_2 += 0x80; - phi_a0_2 = temp_a0_2; - phi_a3 += 8; - phi_v0 = temp_v0_5 + 0xDD8; - phi_t0 += 0x10; - } while (temp_a0_2 != 8); + var_t0->unkC = temp_v0_5; + var_a3->unk6 = (s16) (var_a0 + 3); + var_a0 += 4; + var_v1_2->unk64 = 0.0f; + var_v1_2->unk68 = 0.0f; + var_v1_2->unk6C = 0.0f; + var_a2_2->unkC = -32.0f; + var_a1_2->unkC = -32.0f; + temp_v0_5->unk_040 = -1; + var_v0 = temp_v0_5 + 0xDD8; + var_a1_2 += 0x10; + var_a2_2 += 0x10; + var_v1_2 += 0x80; + var_a3 += 8; + var_t0 += 0x10; + } while (var_a0 != (s16) 8); } #else GLOBAL_ASM("asm/non_matchings/code_8006E9C0/func_8006FA94.s") diff --git a/src/code_80071F00.c b/src/code_80071F00.c index 30506df05..49778d1a8 100644 --- a/src/code_80071F00.c +++ b/src/code_80071F00.c @@ -10,6 +10,7 @@ #include "code_80057C60.h" #include "code_80071F00.h" #include "code_80086E70.h" +#include "common_textures.h" s32 find_unused_obj_index(s32* arg0) { s32 temp_v0; @@ -34,25 +35,12 @@ s32 find_unused_obj_index(s32* arg0) { return temp_v1; } -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -//void func_80072428(s32, s32 *); // extern -extern s8 D_80165CE2[]; - -void func_80071F6C(s32 arg0, s32 arg1) { - s32 temp_a0; - s32 temp_a1; - - temp_a1 = arg0; - temp_a0 = arg0; - arg0 = temp_a1; - func_80072428(arg0); - D_80165CE2[0xE0] = 0; - arg0 = -1; +// Not actually sure about the pointer type, but its definitely SOME type of pointer +void func_80071F6C(s32 *arg0) { + func_80072428(*arg0); + D_80165C18[*arg0].unk_0CA = 0; + *arg0 = -1; } -#else -GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80071F6C.s") -#endif #ifdef MIPS_TO_C //generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc @@ -147,7 +135,7 @@ loop_3: GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80072044.s") #endif -void func_80072100(s32 arg0) { +void func_80072100(s32 *arg0) { func_80071F6C(arg0); } @@ -2776,62 +2764,50 @@ void func_80077428(s32 arg0) { func_80086E70(arg0); } -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc void func_80077450(s32 objectIndex) { + s16 stackPadding0; s16 sp3C; s16 sp3A; s16 sp38; - s16 temp_v0; - struct_80165C18_entry *temp_s0; - temp_s0 = &D_80165C18[objectIndex]; - temp_v0 = temp_s0->unk_0A6; - switch (temp_v0) { /* irregular */ + switch (D_80165C18[objectIndex].unk_0A6) { case 0: break; case 1: func_80077428(objectIndex); break; case 2: - f32_step_up_towards(&temp_s0->unk_000, 0.1f, 0.01f); - if ((temp_s0->unk_004[1] <= (f32) temp_s0->unk_084[5]) && (func_80073B00(objectIndex, &temp_s0->unk_0A0, 0x000000FF, 0, 0x00000010, 0, 0) != 0)) { + f32_step_up_towards(&D_80165C18[objectIndex].unk_000, 0.1f, 0.01f); + if ((D_80165C18[objectIndex].unk_004[1] <= D_80165C18[objectIndex].unk_084[5]) && (func_80073B00(objectIndex, &D_80165C18[objectIndex].unk_0A0, 0x000000FF, 0, 0x00000010, 0, 0) != 0)) { func_80086F60(objectIndex); func_80072428(objectIndex); } break; } - if (temp_s0->unk_048 != 0) { - temp_s0->unk_084[4] = (s16) ((s32) (temp_s0->unk_084[4] + 1) % 3); - func_8005C6B4(temp_s0->unk8D, &sp3C, &sp3A, &sp38); - temp_s0->unk_084[0] = sp3C; - temp_s0->unk_084[1] = sp3A; - temp_s0->unk_084[2] = sp38; + if (D_80165C18[objectIndex].unk_048 != 0) { + D_80165C18[objectIndex].unk_084[4] = (s16) ((s32) (D_80165C18[objectIndex].unk_084[4] + 1) % 3); + func_8005C6B4(D_80165C18[objectIndex].unk_084[4], &sp3C, &sp3A, &sp38); + D_80165C18[objectIndex].unk_084[0] = sp3C; + D_80165C18[objectIndex].unk_084[1] = sp3A; + D_80165C18[objectIndex].unk_084[2] = sp38; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80077450.s") -#endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +#ifdef NEEDS_RODATA + void func_80077584(s32 objectIndex) { - f64 temp_f0; - s16 temp_v1; struct_80165C18_entry *temp_v0; temp_v0 = &D_80165C18[objectIndex]; - temp_v1 = temp_v0->unk_0AE; - if ((temp_v1 != 0) && (temp_v1 == 1) && ((u8) temp_v0->unk_0D8 != 0)) { - temp_f0 = (f64) temp_v0->unk_038[1]; - if (temp_f0 >= -0.5) { - temp_v0->unk_038[1] = (f32) (temp_f0 - 0.15); + if ((temp_v0->unk_0AE != 0) && (temp_v0->unk_0AE == 1) && ((u8) temp_v0->unk_0D8 != 0)) { + if (temp_v0->unk_038[1] >= -0.5) { + temp_v0->unk_038[1] -= 0.15; } else { temp_v0->unk_038[2] = 0.0f; temp_v0->unk_038[0] = 0.0f; } } - temp_v0->unk_0B2[2] = (u16) temp_v0->unk_0B2[2] + temp_v0->unk_084[3]; + temp_v0->unk_0B2[2] += temp_v0->unk_084[3]; func_80087710(objectIndex); func_8008BF18(objectIndex); } @@ -2840,9 +2816,7 @@ GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80077584.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -void func_80077450(s32); /* extern */ -void func_80077584(s32); /* extern */ +//generated by m2c commit b7eac665cffd02361f73cec283ef16d0a35a0e5b extern s32 D_8018C630; extern ? D_8018C830; @@ -2860,7 +2834,7 @@ void func_80077640(void) { func_80077450(temp_s0); func_80077584(temp_s0); if (temp_s2->unk_0A6 == 0) { - func_80072100((s32) var_s1); + func_80072100(var_s1); } } } @@ -2871,83 +2845,73 @@ void func_80077640(void) { GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80077640.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -extern s32 D_0D028DD8; -s16 gCurrentCourseId; /* unable to generate initializer */ +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0.s +extern f32 D_800EEB38;// = 0.1f; -void func_80077700(s32 objectIndex, f32 *arg1, s32 arg2) { +void func_80077700(s32 objectIndex, Vec3f arg1, s32 arg2) { + s32 stackPadding1; + u16 stackPadding0; + u16 temp_s0; u16 sp3E; u16 sp3C; - struct_80165C18_entry *sp34; - s16 temp_v1; - s32 temp_s0; - struct_80165C18_entry *temp_v0; func_800723A4(objectIndex, 0); - temp_v0 = &D_80165C18[objectIndex]; - temp_v0->unk_0D5 = 7; - temp_v0->unk_060 = &D_0D028DD8; - temp_v0->unk_068 = &D_0D028DD8; - temp_v0->unk_000 = 0.1f; - temp_v0->unk_044 = arg1->unk4; - temp_v1 = gCurrentCourseId; - switch (temp_v1) { /* irregular */ - case 0: - sp34 = temp_v0; - func_8008BD14(objectIndex, (s16) (s32) arg1->unk0, (s16) (s32) ((f64) arg1->unk4 + 25.0), (s16) (s32) arg1->unk8, (u16) 0x00000014, (u16) 0x0000001E, (u16) 0x00000014); - temp_v0->unk_034 = 1.5f; - temp_v0->unk_038[1] = 1.5f; - break; - case 4: - sp34 = temp_v0; - func_8008BD14(objectIndex, (s16) (s32) arg1->unk0, (s16) (s32) ((f64) arg1->unk4 + 25.0), (s16) (s32) arg1->unk8, (u16) 0x00000014, (u16) 0x0000001E, (u16) 0x00000014); - temp_v0->unk_034 = 2.0f; - temp_v0->unk_038[1] = 2.0f; - break; - case 7: - sp34 = temp_v0; - func_8008BD14(objectIndex, (s16) (s32) arg1->unk0, (s16) (s32) ((f64) arg1->unk4 + 30.0), (s16) (s32) arg1->unk8, (u16) 0x00000010, (u16) 0x00000028, (u16) 0x00000010); - temp_v0->unk_034 = 2.0f; - temp_v0->unk_038[1] = 2.0f; - break; - case 8: - sp34 = temp_v0; - func_8008BD14(objectIndex, (s16) (s32) arg1->unk0, (s16) (s32) ((f64) arg1->unk4 + 25.0), (s16) (s32) arg1->unk8, (u16) 0x00000014, (u16) 0x0000001E, (u16) 0x00000014); - temp_v0->unk_034 = 1.5f; - temp_v0->unk_038[1] = 1.0f; - break; - } - temp_s0 = (random_int(0x0010U) << 0xC) & 0xFFFF; + D_80165C18[objectIndex].unk_0D5 = 7; + D_80165C18[objectIndex].unk_060 = (s32 *) D_0D028DD8; + D_80165C18[objectIndex].unk_068 = (s32 *) D_0D028DD8; + D_80165C18[objectIndex].unk_000 = 0.1f; + D_80165C18[objectIndex].unk_044 = arg1[1]; + switch (gCurrentCourseId) { + case COURSE_MARIO_RACEWAY: + func_8008BD14(objectIndex, arg1[0], arg1[1] + 25.0, arg1[2], 0x00000014, 0x0000001E, 0x00000014); + D_80165C18[objectIndex].unk_034 = 1.5f; + D_80165C18[objectIndex].unk_038[1] = 1.5f; + break; + case COURSE_YOSHI_VALLEY: + func_8008BD14(objectIndex, arg1[0], arg1[1] + 25.0, arg1[2], 0x00000014, 0x0000001E, 0x00000014); + D_80165C18[objectIndex].unk_034 = 2.0f; + D_80165C18[objectIndex].unk_038[1] = 2.0f; + break; + case COURSE_ROYAL_RACEWAY: + func_8008BD14(objectIndex, arg1[0], arg1[1] + 30.0, arg1[2], 0x00000010, 0x00000028, 0x00000010); + D_80165C18[objectIndex].unk_034 = 2.0f; + D_80165C18[objectIndex].unk_038[1] = 2.0f; + break; + case COURSE_LUIGI_RACEWAY: + func_8008BD14(objectIndex, arg1[0], arg1[1] + 25.0, arg1[2], 0x00000014, 0x0000001E, 0x00000014); + D_80165C18[objectIndex].unk_034 = 1.5f; + D_80165C18[objectIndex].unk_038[1] = 1.0f; + break; + } + temp_s0 = random_int(0x0010U) << 0xC; sp3E = random_int(0x0010U) << 0xC; sp3C = random_int(0x0010U) << 0xC; - func_8008B888(objectIndex, 0U, ((s32) (arg2 * 0xFFFF) / 20) & 0xFFFF, 0U); - func_8008B8BC(objectIndex, temp_s0 & 0xFFFF, sp3E, sp3C); + func_8008B888(objectIndex, 0U, (arg2 * 0xFFFF) / 20, 0U); + func_8008B8BC(objectIndex, temp_s0, sp3E, sp3C); } #else GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80077700.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_80072044(? *, ? *, ?); // extern -void func_80077700(s32, s32, s32); // extern +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c extern s32 D_80183E7C; extern s32 D_8018C970; -s32 func_80077A54(s32 arg0, s32 arg1) { +s32 func_80077A54(Vec3f arg0, s32 arg1) { s32 sp1C; s32 temp_v0; - s32 phi_a0; + s32 var_a0; - temp_v0 = func_80072044(&D_8018C970, &D_80183E7C, 0x40); - phi_a0 = temp_v0; + temp_v0 = func_80072044(&D_8018C970, &D_80183E7C, 0x00000040); + var_a0 = temp_v0; if (temp_v0 != -1) { sp1C = temp_v0; - func_80077700(temp_v0, arg0, arg1); - phi_a0 = sp1C; + func_80077700(var_a0, arg0, arg1); + var_a0 = sp1C; } - return phi_a0; + return var_a0; } #else GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80077A54.s") @@ -3081,22 +3045,20 @@ loop_3: GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80077D5C.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -extern Vtx D_0D005770; -extern s32 D_0D0293D8; +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0.s +extern f32 D_800EEB3C;// = 0.15f; void func_80077E20(s32 objectIndex) { - struct_80165C18_entry *sp18; struct_80165C18_entry *temp_v0; temp_v0 = &D_80165C18[objectIndex]; - temp_v0->unk_064 = &D_0D0293D8; - temp_v0->unk_06C = (s32) &D_0D0293D8; - temp_v0->unk_074 = (s32) &D_0D005770; + temp_v0->unk_064 = D_0D0293D8; + temp_v0->unk_06C = D_0D0293D8; + // There's something up with the handling of D_0D005770 and the loading of 0x10 right here + temp_v0->unk_074 = D_0D005770; temp_v0->unk_0DA = 0x10; - temp_v0->unk_0D9 = 0x10; - sp18 = temp_v0; + temp_v0->unk_0D9 = temp_v0->unk_0DA; temp_v0->unk_000 = 0.15f; func_800721C0(objectIndex, 0x00000010); func_80086EF0(objectIndex); @@ -3250,10 +3212,9 @@ void func_80078170(s32 arg0, ? arg1) { GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80078170.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -extern Vtx D_0D005770; -extern s32 D_0D0293D8; +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0.x +extern f32 D_800EEB48;// = 0.15f; void func_80078220(s32 objectIndex) { struct_80165C18_entry *temp_v0; @@ -3271,7 +3232,7 @@ GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80078220.s") #endif #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c extern s32 gGamestate; void func_80078288(s32 objectIndex) { @@ -5547,19 +5508,18 @@ GLOBAL_ASM("asm/non_matchings/code_80071F00/func_8007C280.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_8007BDA8(); // extern -void func_8007C280(); // extern +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_8007C280(); /* extern */ void func_8007C2F8(s32 arg0) { - if (arg0 != 0) { - if (arg0 != 1) { - return; - } + switch (arg0) { /* irregular */ + case 0: + func_8007BDA8(); + return; + case 1: func_8007C280(); return; } - func_8007BDA8(); } #else GLOBAL_ASM("asm/non_matchings/code_80071F00/func_8007C2F8.s") @@ -5625,7 +5585,7 @@ UNUSED void func_8007C49C(void) { } #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c void func_8007C4A4(s32 objectIndex) { struct_80165C18_entry *sp20; s32 sp1C; @@ -6282,10 +6242,8 @@ GLOBAL_ASM("asm/non_matchings/code_80071F00/func_8007D6A8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_80072044(? *, ? *, ?); // extern -void func_800723A4(s32, ?); // extern -void func_8007D6A8(s32, s32); // extern +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_8007D6A8(s32, s32); /* extern */ extern s32 D_80183E4C; extern s32 D_80183E5C; extern s32 D_8018C3F0; @@ -6293,17 +6251,17 @@ extern s32 D_8018C630; void func_8007D714(s32 arg0) { s32 sp1C; - s32 phi_v0; + s32 var_v0; if (arg0 == 1) { - phi_v0 = func_80072044(&D_8018C3F0, &D_80183E4C, 0x28); + var_v0 = func_80072044(&D_8018C3F0, &D_80183E4C, 0x00000028); } else { - phi_v0 = func_80072044(&D_8018C630, &D_80183E5C, 0x1E); + var_v0 = func_80072044(&D_8018C630, &D_80183E5C, 0x0000001E); } - if (phi_v0 != -1) { - sp1C = phi_v0; - func_800723A4(phi_v0, 0); - func_8007D6A8(phi_v0, arg0); + if (var_v0 != -1) { + sp1C = var_v0; + func_800723A4(var_v0, 0); + func_8007D6A8(var_v0, arg0); } } #else @@ -8109,28 +8067,17 @@ void func_80080A14(s32 objectIndex, Player *player) { } } -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc void func_80080A4C(s32 objectIndex, s32 cameraPlayerId) { - Camera *sp1C; - Player *sp18; - Player *temp_a3; - struct_80165C18_entry *temp_v0; + Camera *camera = &camera1[cameraPlayerId]; + Player *player = &gPlayerOne[cameraPlayerId]; - sp1C = &camera1[cameraPlayerId]; - temp_a3 = &gPlayerOne[cameraPlayerId]; if (gScreenModeSelection != 3) { - sp18 = temp_a3; - if ((func_80072320(objectIndex, 0x00000010) != 0) && (func_80088A58(objectIndex, temp_a3, 500.0f) != 0)) { - func_8001CA10(sp1C); - temp_v0 = &D_80165C18[objectIndex]; - func_800C98B8(temp_v0->unk_004, temp_v0->unk_038, 0x1900800FU); + if ((func_80072320(objectIndex, 0x00000010) != 0) && (func_80088A58(objectIndex, player, 500.0f) != 0)) { + func_8001CA10(camera); + func_800C98B8(D_80165C18[objectIndex].unk_004, D_80165C18[objectIndex].unk_038, 0x1900800FU); } } } -#else -GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80080A4C.s") -#endif #ifdef MIPS_TO_C //generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc @@ -10897,21 +10844,18 @@ GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80085F74.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80073444(s32, void *, void *, ?, s32); // extern -void func_80085BB4(s32); // extern -void func_8008B7D4(f32, s32, s32); // extern +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c extern ? D_06007200; extern ? D_0600B000; -extern ? D_800E6734; extern f32 D_8018D01C; +f32 D_800E6734[0][3]; /* unable to generate initializer */ void func_80086074(s32 arg0, s32 arg1) { - void *temp_v0; + f32 *temp_v0; - temp_v0 = (arg1 * 0xC) + &D_800E6734; - func_8008B7D4(temp_v0->unk0 * D_8018D01C, temp_v0->unk4, temp_v0->unk8); - func_80073444(arg0, (arg1 << 9) + &D_06007200, (arg1 << 0xC) + &D_0600B000, 0x40, 0x40); + temp_v0 = D_800E6734[arg1]; + func_8008B7D4(arg0, temp_v0->unk0 * D_8018D01C, temp_v0->unk4, temp_v0->unk8); + func_80073444(arg0, (arg1 << 9) + &D_06007200, (arg1 << 0xC) + &D_0600B000, 0x40U, (u16) 0x00000040); func_80085BB4(arg0); } #else @@ -10936,40 +10880,26 @@ GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80086110.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_80085CA0(s32, s32); // extern -void func_80085E38(s32, s32); // extern -void func_80085F74(s32, s32); // extern -void func_80086110(s32, s32, s32); // extern +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +? func_80085CA0(s32, s32); /* extern */ +? func_80085E38(s32, s32); /* extern */ +? func_80085F74(s32, s32); /* extern */ +? func_80086110(s32, s32, s32); /* extern */ void func_80086158(s32 arg0, s32 arg1) { - s32 temp_a2; - s32 phi_a2; - - temp_a2 = arg1; - phi_a2 = temp_a2; - if (arg1 != 0) { - if (arg1 != 1) { - if (arg1 != 2) { - - } else { - arg1 = temp_a2; - func_80085F74(arg0, temp_a2); - goto block_7; - } - } else { - arg1 = temp_a2; - func_80085E38(arg0, temp_a2); - goto block_7; - } - } else { - arg1 = temp_a2; - func_80085CA0(arg0, temp_a2); -block_7: - phi_a2 = arg1; + switch (arg1) { /* irregular */ + case 0: + func_80085CA0(arg0, arg1); + break; + case 1: + func_80085E38(arg0, arg1); + break; + case 2: + func_80085F74(arg0, arg1); + break; } - if (phi_a2 >= 3) { - func_80086110(arg0, phi_a2 - 3, phi_a2); + if (arg1 >= 3) { + func_80086110(arg0, arg1 - 3, arg1); } } #else diff --git a/src/code_80071F00.h b/src/code_80071F00.h index 63ed36530..394629583 100644 --- a/src/code_80071F00.h +++ b/src/code_80071F00.h @@ -5,9 +5,9 @@ #include "camera.h" s32 find_unused_obj_index(s32*); -void func_80071F6C(s32); +void func_80071F6C(s32*); s32 func_80072044(s32*, s32*, s32); -void func_80072100(s32); +void func_80072100(s32*); void func_800721C0(s32, s32); void func_800721E8(s32, s32); void func_80072214(s32, s32); @@ -126,11 +126,16 @@ void func_80076E14(s32); void func_80076ED8(s32); void func_800773D8(s32, s32); void func_80077428(s32); +void func_80077450(s32); +void func_80077584(s32); void func_80077640(); +void func_80077700(s32, Vec3f, s32); void func_80077AB0(Vec3f, s32); void func_80077B14(s32); void func_80077B3C(s32); void func_80077BCC(s32); +void func_80077E20(s32); +void func_80078220(s32); void func_80078C68(); void func_80078C70(s32); void func_80078F64(); @@ -167,6 +172,7 @@ void func_800806BC(s32); void func_8008078C(s32); void func_8008085C(s32); void func_80080A14(s32, Player*); +void func_80080A4C(s32, s32); void func_80081208(); void func_80081210(); void func_80081790(s32); diff --git a/src/code_80091750.c b/src/code_80091750.c index 15de55d73..797bbb4a4 100644 --- a/src/code_80091750.c +++ b/src/code_80091750.c @@ -1308,7 +1308,7 @@ void func_800940EC(s32 arg0) { } #ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c f32 D_800E8530 = 0.0f; f32 D_800E8534 = 3.0f; @@ -6469,20 +6469,25 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_8009E2A8.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 draw_box(s32, s32, s32, s32, u32, s32, s32, s32, s32); // extern -extern ? D_800E7AC8; -extern ? D_800F0B28; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +struct _struct_D_800E7AC8_0x8 { + /* 0x0 */ u16 unk0; /* inferred */ + /* 0x2 */ u16 unk2; /* inferred */ + /* 0x4 */ u16 unk4; /* inferred */ + /* 0x6 */ u16 unk6; /* inferred */ +}; /* size = 0x8 */ + extern ? D_8018E7E8; extern ? D_8018E810; extern s8 D_8018E838; -extern s32 D_8018E840; -extern s32 gDisplayListHead; +extern ? D_8018E840; +static struct _struct_D_800E7AC8_0x8 D_800E7AC8[0]; /* unable to generate initializer */ +static ? D_800F0B28; /* unable to generate initializer; const */ void func_8009E2F0(s32 arg0) { s32 sp38; - f32 temp_f4; - f64 temp_f6; + f32 var_f4; + f64 var_f6; s16 temp_t2; s16 temp_t2_2; s16 temp_t4; @@ -6493,6 +6498,7 @@ void func_8009E2F0(s32 arg0) { s32 temp_t8; s32 temp_v1; s8 temp_t7; + struct _struct_D_800E7AC8_0x8 *temp_v0; u16 temp_t6_3; u32 *temp_s0; u32 temp_ra; @@ -6501,49 +6507,44 @@ void func_8009E2F0(s32 arg0) { void *temp_t0_2; void *temp_t1; void *temp_t1_2; - void *temp_v0; - f32 phi_f4; - f64 phi_f6; temp_s0 = (arg0 * 4) + &D_8018E840; temp_ra = *temp_s0; temp_t7 = *(&D_800F0B28 + temp_ra); - sp38 = temp_t7; + sp38 = (s32) temp_t7; if (temp_t7 != 0) { - if (temp_ra < 0x1B) { + if (temp_ra < 0x1BU) { temp_v1 = arg0 * 8; temp_t1 = temp_v1 + &D_8018E810; temp_t0 = temp_v1 + &D_8018E7E8; temp_t4 = temp_t0->unk2; temp_t2 = temp_t0->unk0; - temp_t6 = temp_t1->unk0 / 2; - temp_t8 = temp_t1->unk2 / 2; - temp_v0 = (temp_t7 * 8) + &D_800E7AC8; - gDisplayListHead = draw_box(gDisplayListHead, temp_t2 - temp_t6, temp_t4 - temp_t8, temp_t2 + temp_t6, temp_t4 + temp_t8, temp_v0->unk0, temp_v0->unk2, temp_v0->unk4, temp_v0->unk6); + temp_t6 = (s16) temp_t1->unk0 / 2; + temp_t8 = (s16) temp_t1->unk2 / 2; + temp_v0 = &D_800E7AC8[temp_t7]; + gDisplayListHead = draw_box(gDisplayListHead, temp_t2 - temp_t6, temp_t4 - temp_t8, temp_t2 + temp_t6, temp_t4 + temp_t8, (s32) temp_v0->unk0, (s32) temp_v0->unk2, (s32) temp_v0->unk4, (s32) temp_v0->unk6); } else { temp_t7_2 = 0x26 - temp_ra; - temp_f6 = temp_t7_2; - phi_f6 = temp_f6; + var_f6 = (f64) temp_t7_2; if (temp_t7_2 < 0) { - phi_f6 = temp_f6 + 4294967296.0; + var_f6 += 4294967296.0; } temp_t6_2 = arg0 * 8; temp_t1_2 = temp_t6_2 + &D_8018E810; temp_t0_2 = temp_t6_2 + &D_8018E7E8; temp_t2_2 = temp_t0_2->unk0; - temp_t7_3 = temp_t1_2->unk0 / 2; - temp_t6_3 = ((sp38 * 8) + &D_800E7AC8)->unk6; - temp_f4 = temp_t6_3; - phi_f4 = temp_f4; - if (temp_t6_3 < 0) { - phi_f4 = temp_f4 + 4294967296.0f; + temp_t7_3 = (s16) temp_t1_2->unk0 / 2; + temp_t6_3 = D_800E7AC8[sp38].unk6; + var_f4 = (f32) temp_t6_3; + if ((s32) temp_t6_3 < 0) { + var_f4 += 4294967296.0f; } - gDisplayListHead = draw_box(gDisplayListHead, temp_t2_2 - temp_t7_3, temp_t0_2->unk2 - (temp_t1_2->unk2 / 2), temp_t2_2 + temp_t7_3, phi_f4 * (phi_f6 / 11.0)); + gDisplayListHead = draw_box(gDisplayListHead, temp_t2_2 - temp_t7_3, temp_t0_2->unk2 - ((s16) temp_t1_2->unk2 / 2), temp_t2_2 + temp_t7_3, M2C_ERROR(Unable to find stack arg 0x10 in block), M2C_ERROR(Unable to find stack arg 0x14 in block), M2C_ERROR(Unable to find stack arg 0x18 in block), M2C_ERROR(Unable to find stack arg 0x1c in block), (s32) (u32) (var_f4 * (f32) (var_f6 / 11.0))); } } temp_t7_4 = *temp_s0 + 1; *temp_s0 = temp_t7_4; - if (temp_t7_4 >= 0x26) { + if (temp_t7_4 >= 0x26U) { D_8018E838 = 0; D_8018E838 = 0; D_8018E838 = 0; @@ -8392,33 +8393,36 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A0FA4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 0ca3d5f5fa5e3d957908269ac1535e7d4f12bce9 -extern s8 *D_800E7940[0x13]; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +static ? D_800E7940; /* unable to generate initializer */ void func_800A10CC(struct_8018D9E0_entry *arg0) { - s32 temp_s1; s32 temp_s3; s32 temp_v0; - s32 phi_s0; - s8 **phi_s2; - s32 phi_s1; + s32 var_s0; + s32 var_s1; + s8 **var_s2; temp_v0 = arg0->unk4; - if ((temp_v0 == 2) || (temp_v0 == 3) || (temp_v0 == 4) || (temp_v0 == 5)) { - gDisplayListHead = func_80098C18(gDisplayListHead, 0x1E, 0x32, 0x122, 0x6E, 0, 0, 0, 0xFF); - temp_s3 = arg0->unk4 - 2; - set_text_color(3); - phi_s0 = 0x41; - phi_s2 = (temp_s3 * 0x10) + D_800E7940; - phi_s1 = 0; - do { - func_80093324(0x23, phi_s0, *phi_s2, 0, 0.65f, 0.65f); - temp_s1 = phi_s1 + 4; - phi_s0 += 0xD; - phi_s2 += 4; - phi_s1 = temp_s1; - } while (temp_s1 != 0x10); + if ((temp_v0 != 2) && (temp_v0 != 3) && (temp_v0 != 4)) { + if (temp_v0 == 5) { + goto block_6; + } + return; } +block_6: + gDisplayListHead = func_80098C18(gDisplayListHead, 0x0000001E, 0x00000032, 0x00000122, 0x0000006E, 0, 0, 0, 0x000000FF); + temp_s3 = arg0->unk4 - 2; + set_text_color(3); + var_s2 = (temp_s3 * 0x10) + &D_800E7940; + var_s0 = 0x00000041; + var_s1 = 0; + do { + func_80093324(0x00000023, var_s0, *var_s2, 0, 0.65f, 0.65f); + var_s1 += 4; + var_s0 += 0xD; + var_s2 += 4; + } while (var_s1 != 0x10); } #else GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A10CC.s") @@ -8745,16 +8749,17 @@ void func_800A1DE0(struct_8018D9E0_entry *arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A1DE0.s") #endif -#ifdef NON_MATCHING -// Equivalent functionality, but the arguments to func_80093324 are -// handled in a slightly different order +#ifdef NEEDS_RODATA +// data_0DD0A0_2_0.s +extern char *D_800E7860[2];// = { "UNABLE TO ERASE ", "GHOST DATA" }; + void func_800A1F30(struct_8018D9E0_entry *unused) { s32 row; - char **text; + s32 text; set_text_color(TEXT_RED); - for(row = 0x49, text = D_800E7860; row < 0x69; row += 0x10, text++){ - func_80093324(0x2A, row, *text, 0, 0.75f, 0.75f); + for(row = 0x49, text = 0; row < 0x69; row += 0x10, text++){ + func_80093324(0x2A, row, D_800E7860[text], 0, 0.75f, 0.75f); } } #else @@ -9255,56 +9260,37 @@ loop_80: GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A1FB0.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -extern s8 D_8018EE08; - void func_800A2D1C(struct_8018D9E0_entry *arg0) { - Gfx *temp_v0_2; - Gfx *temp_v0_3; - Gfx *temp_v0_4; - s32 temp_t0; - s32 temp_t8; - s32 temp_v0; - - temp_v0 = D_80164A28; - switch (temp_v0) { /* irregular */ + switch (D_80164A28) { case 1: - temp_v0_2 = func_80098FC8(gDisplayListHead, 0, 0, 0x13F, 0x28); - gDisplayListHead = temp_v0_2; - gDisplayListHead = func_80098FC8(temp_v0_2, 0, 0xC7, 0x13F, 0xEF); + gDisplayListHead = func_80098FC8(gDisplayListHead, 0, 0, 0x13F, 0x28); + gDisplayListHead = func_80098FC8(gDisplayListHead, 0, 0xC7, 0x13F, 0xEF); arg0->unk1C = 0x28; - return; + break; case 2: - temp_t0 = arg0->unk1C - 2; - arg0->unk1C = temp_t0; - if (temp_t0 > 0) { - temp_v0_3 = func_80098FC8(gDisplayListHead, 0, 0, 0x13F, temp_t0); - gDisplayListHead = temp_v0_3; - gDisplayListHead = func_80098FC8(temp_v0_3, 0, 0xEF - arg0->unk1C, 0x13F, 0xEF); - return; + arg0->unk1C -= 2; + if (arg0->unk1C > 0) { + gDisplayListHead = func_80098FC8(gDisplayListHead, 0, 0, 0x13F, arg0->unk1C); + gDisplayListHead = func_80098FC8(gDisplayListHead, 0, 0xEF - arg0->unk1C, 0x13F, 0xEF); + } else { + arg0->type = 0; } -block_13: - arg0->type = 0; - return; + break; default: if ((gModeSelection != GRAND_PRIX) || (gPlayerCountSelection1 != 1) || (D_8018EE08 != 0)) { - goto block_13; - } - temp_t8 = arg0->unk1C - 2; - arg0->unk1C = temp_t8; - if (temp_t8 > 0) { - temp_v0_4 = func_80098FC8(gDisplayListHead, 0, 0, 0x13F, temp_t8); - gDisplayListHead = temp_v0_4; - gDisplayListHead = func_80098FC8(temp_v0_4, 0, 0xEF - arg0->unk1C, 0x13F, 0xEF); - return; + arg0->type = 0; + } else { + arg0->unk1C -= 2; + if (arg0->unk1C > 0) { + gDisplayListHead = func_80098FC8(gDisplayListHead, 0, 0, 0x13F, arg0->unk1C); + gDisplayListHead = func_80098FC8(gDisplayListHead, 0, 0xEF - arg0->unk1C, 0x13F, 0xEF); + } else { + arg0->type = 0; + } } - goto block_13; + break; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A2D1C.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda @@ -10201,23 +10187,26 @@ block_21: GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A474C.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0.s +extern f32 D_800F1DCC;// = 0.85f; +extern f32 D_800F1DD0;// = 0.85f; +// data_0DD0A0_2_0.s +extern char D_800E7780[];// = "NOW-MEET THE COURSE GHOST!!!"; + void func_800A4A24(struct_8018D9E0_entry *arg0) { - s32 sp38; - s32 sp34; + s32 stackPadding0; s32 temp_t0; s32 temp_t1; s32 temp_t2; + f32 someMultiplier = 0.85f; + s32 thing = 24.0f * someMultiplier; - temp_t1 = arg0->row; temp_t0 = 0x140 - arg0->column; - sp38 = temp_t0; - arg0 = arg0; - sp34 = temp_t1; - temp_t2 = (s32) ((f32) (get_string_width("NOW-MEET THE COURSE GHOST!!!") + 8) * 0.85f) / 2; - gDisplayListHead = draw_box(gDisplayListHead, temp_t0 - temp_t2, (temp_t1 - (s32) (24.0f * 0.85f)) + 4, temp_t2 + temp_t0, temp_t1 + 4, 0, 0, 0, 0x64); - set_text_color(4); + temp_t1 = arg0->row; + temp_t2 = (s32) ((get_string_width("NOW-MEET THE COURSE GHOST!!!") + 8) * someMultiplier) / 2; + gDisplayListHead = draw_box(gDisplayListHead, temp_t0 - temp_t2, (temp_t1 - thing) + 4, temp_t2 + temp_t0, temp_t1 + 4, 0, 0, 0, 0x00000064); + set_text_color(TEXT_BLUE_GREEN_RED_CYCLE_1); draw_text(arg0->column - 3, arg0->row, "NOW-MEET THE COURSE GHOST!!!", 0, 0.85f, 0.85f); } #else @@ -11380,41 +11369,35 @@ void func_800A6E94(s32 arg0, s32 arg1, s32 arg2) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A6E94.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de -static s8 *D_800E7A34[2] = { "RACE DATA CANNOT ", "BE SAVED FOR GHOST" }; +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0.s +extern f32 D_800F1F2C;// = 0x45f; +// data_0DD0A0_2_0.s +extern char *D_800E7A34[2];// = { "RACE DATA CANNOT ", "BE SAVED FOR GHOST" }; void func_800A70E8(struct_8018D9E0_entry *arg0) { - Gfx *temp_v0; - s32 temp_f6; - s32 var_a1; s32 var_s0; - s32 var_s0_2; - s8 **var_s1; + s32 temp_f6; + s32 alpha; + s32 loopIndex; + s32 stringIndex; if (arg0->unk4 == 1) { - var_s0 = (s32) ((f32) get_string_width(D_800E7A34->unk0) * 0.45f); - temp_f6 = (s32) ((f32) get_string_width(D_800E7A34->unk4) * 0.45f); + var_s0 = get_string_width(D_800E7A34[0]) * 0.45f; + temp_f6 = get_string_width(D_800E7A34[1]) * 0.45f; if (var_s0 < temp_f6) { var_s0 = temp_f6; } gDisplayListHead = draw_box(gDisplayListHead, 0x000000C0, 0x00000022, var_s0 + 0xC6, 0x00000039, 0, 0, 0, 0x00000096); - var_a1 = 0x180 - (((s32) arg0->unk1C % 32) * 8); - if (var_a1 >= 0x100) { - var_a1 = 0xFF; + alpha = 0x180 - ((arg0->unk1C % 32) * 8); + if (alpha >= 0x100) { + alpha = 0xFF; + } + gDPSetPrimColor(gDisplayListHead++, 0, 0, 0x00, 0x00, 0x00, alpha); + set_text_color(TEXT_RED); + for (loopIndex = 0x2C, stringIndex = 0; loopIndex < 0x40; loopIndex += 0xA, stringIndex++) { + func_80093358(0x000000C0, loopIndex, D_800E7A34[stringIndex], 0, 0.45f, 0.45f); } - temp_v0 = gDisplayListHead; - gDisplayListHead = temp_v0 + 8; - temp_v0->words.w1 = var_a1 & 0xFF; - temp_v0->words.w0 = 0xFA000000; - set_text_color(2); - var_s1 = D_800E7A34; - var_s0_2 = 0x0000002C; - do { - func_80093358(0x000000C0, var_s0_2, *var_s1, 0, 0.45f, 0.45f); - var_s0_2 += 0xA; - var_s1 += 4; - } while (var_s0_2 != 0x00000040); } } #else @@ -12202,63 +12185,59 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A8270.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c extern s8 D_8018EDEE; extern s8 gMainMenuSelectionDepth; void func_800A8564(struct_8018D9E0_entry *arg0) { s32 sp34; s32 sp30; + Gfx *var_v0; MkTexture *temp_v0_4; + MkTexture *var_a0; s32 temp_a2; s32 temp_t0; s32 temp_v0; s32 temp_v0_3; + s32 var_a1; s8 temp_v0_2; s8 temp_v0_5; - s32 phi_a1; - MkTexture *phi_a0; - Gfx *phi_v0; temp_v0 = arg0->type; - phi_a1 = 0; + var_a1 = 0; switch (temp_v0) { /* irregular */ case 0xF: temp_v0_2 = gMainMenuSelectionDepth; - phi_a0 = D_0200487C; - phi_a0 = D_0200487C; - if ((temp_v0_2 == CONFIRM_OK_SELECTION) || (temp_v0_2 == CONFIRM_OK_SELECTION_FROM_BACK_OUT)) { + var_a0 = D_0200487C; + if ((temp_v0_2 == 6) || (temp_v0_2 == 7)) { block_11: - phi_a1 = 1; + var_a1 = 1; } block_12: temp_v0_3 = arg0->unk1C; if (temp_v0_3 < 0x20) { sp34 = (s32) (temp_v0_3 << 5) / 64; - sp30 = phi_a1; - arg0 = arg0; - temp_v0_4 = segmented_to_virtual_dupe(phi_a0); + sp30 = var_a1; + temp_v0_4 = segmented_to_virtual_dupe(var_a0); temp_t0 = arg0->column + temp_v0_4->dX; temp_a2 = arg0->row + temp_v0_4->dY; - if (phi_a1 != 0) { - phi_v0 = func_800959A0(gDisplayListHead, temp_t0 + sp34, temp_a2, (temp_t0 - sp34) + 0x1E, temp_a2 + 0x12); + if (var_a1 != 0) { + var_v0 = func_800959A0(gDisplayListHead, temp_t0 + sp34, temp_a2, (temp_t0 - sp34) + 0x1E, temp_a2 + 0x12); } else { - phi_v0 = func_80098C18(gDisplayListHead, temp_t0 + sp34, temp_a2, (temp_t0 - sp34) + 0x1E, temp_a2 + 0x12, 1, 1, 1, 0xFF); + var_v0 = func_80098C18(gDisplayListHead, temp_t0 + sp34, temp_a2, (temp_t0 - sp34) + 0x1E, temp_a2 + 0x12, 1, 1, 1, 0x000000FF); } - gDisplayListHead = phi_v0; + gDisplayListHead = var_v0; } return; case 0x33: temp_v0_5 = D_8018EDEE; - phi_a0 = D_02004B74; - phi_a0 = D_02004B74; + var_a0 = D_02004B74; if ((temp_v0_5 == 2) || (temp_v0_5 == 3)) { goto block_11; } goto block_12; case 0x5D: - phi_a0 = D_02004E80; - phi_a0 = D_02004E80; + var_a0 = D_02004E80; if (D_8018EDEC == 3) { goto block_11; } @@ -12916,7 +12895,7 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800A97BC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c extern s8 D_8018EDEE; extern s8 gMainMenuSelectionDepth; static ? D_800F0CA7; /* unable to generate initializer; const */ @@ -12928,29 +12907,29 @@ void func_800A9A98(struct_8018D9E0_entry *arg0) { s32 temp_v0; s32 temp_v0_2; s32 temp_v0_3; - s32 phi_v0; + s32 var_v0; temp_v0 = arg0->type; switch (temp_v0) { /* irregular */ default: - phi_v0 = sp4; + var_v0 = sp4; break; case 0xF: - phi_v0 = (s32) *("\"\0\x03\x03\x03\x02\0\x02\x02" /* not null-terminated */ + 3 + gMainMenuSelectionDepth); + var_v0 = (s32) *("\"\0\x03\x03\x03\x02\0\x02\x02" /* not null-terminated */ + 3 + gMainMenuSelectionDepth); break; case 0x5D: - phi_v0 = (s32) *(&D_800F0CAB + D_8018EDEC); + var_v0 = (s32) *(&D_800F0CAB + D_8018EDEC); break; case 0x33: - phi_v0 = (s32) *(&D_800F0CA7 + D_8018EDEE); + var_v0 = (s32) *(&D_800F0CA7 + D_8018EDEE); break; } - switch (phi_v0) { /* switch 1; irregular */ + switch (var_v0) { /* switch 1; irregular */ case 0: /* switch 1 */ arg0->unk1C = 0; return; case 1: /* switch 1 */ - arg0->unk1C = 0x20; + arg0->unk1C = 0x00000020; return; case 2: /* switch 1 */ temp_v0_2 = arg0->unk1C; @@ -12969,7 +12948,7 @@ void func_800A9A98(struct_8018D9E0_entry *arg0) { if (temp_v0_3 < 0x20) { arg0->unk1C = temp_t4; if (temp_t4 >= 0x20) { - arg0->unk1C = 0x20; + arg0->unk1C = 0x00000020; } } break; @@ -13433,13 +13412,9 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AA2EC.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 -s32 func_800AAFCC(s32); /* extern */ -s32 random_int(?, s32); /* extern */ +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c extern ? D_8018DEE4; -extern s8 D_8018EDE8; - -// head selection +extern ? D_8018EDE8; static MkAnimation *D_800E8360[8] = { D_02006708, D_020068F0, @@ -13449,20 +13424,7 @@ static MkAnimation *D_800E8360[8] = { D_02007280, D_02007468, D_02006AD8, -}; /* const */ - -static MkAnimation *gCharacterCelebrateAnimation[8] = { - D_02006718, - D_02006900, - D_02006CD0, - D_02006EB8, - D_020070A0, - D_02007290, - D_02007478, - D_02006AE8, -}; /* const */ - -// celebrate end +}; static MkAnimation *D_800E83A0[8] = { D_02006778, D_02006960, @@ -13472,8 +13434,39 @@ static MkAnimation *D_800E83A0[8] = { D_020072F0, D_020074D8, D_02006B48, -}; /* const */ - +}; +static s32 D_800E8440[8] = { + 0x0000000A, + 0x0000000A, + 0x0000000A, + 0x0000000A, + 0x0000000A, + 0x0000000A, + 0x0000000A, + 0x0000000A, +}; +static s32 D_800E8460[8] = { 9, 9, 9, 9, 0x0000000A, 9, 9, 9 }; +static s32 D_800E8480[8] = { 9, 9, 9, 9, 9, 9, 9, 9 }; +static s32 D_800E84A0[8] = { + 0x00000013, + 0x00000013, + 0x00000013, + 0x00000013, + 0x00000013, + 0x00000013, + 0x00000013, + 0x00000013, +}; +static MkAnimation *gCharacterCelebrateAnimation[8] = { + D_02006718, + D_02006900, + D_02006CD0, + D_02006EB8, + D_020070A0, + D_02007290, + D_02007478, + D_02006AE8, +}; static MkAnimation *gCharacterDeselectAnimation[8] = { D_02006788, D_02006970, @@ -13483,19 +13476,7 @@ static MkAnimation *gCharacterDeselectAnimation[8] = { D_02007300, D_020074E8, D_02006B58, -}; /* const */ - -static MkAnimation *gCharacterSingleBlinkAnimation[8] = { - D_020067E0, - D_020069C8, - D_02006D98, - D_02006F80, - D_02007170, - D_02007358, - D_02007540, - D_02006CB0, -}; /* const */ - +}; static MkAnimation *gCharacterDoubleBlinkAnimation[8] = { D_02006838, D_02006A20, @@ -13505,9 +13486,8 @@ static MkAnimation *gCharacterDoubleBlinkAnimation[8] = { D_020073B0, D_02007598, D_02006C08, -}; /* const */ - -static MkAnimation *D_800E8420[8] = { +}; +static MkAnimation *gCharacterSingleBlinkAnimation[8] = { D_020067E0, D_020069C8, D_02006D98, @@ -13515,12 +13495,8 @@ static MkAnimation *D_800E8420[8] = { D_02007170, D_02007358, D_02007540, - D_02006CB0, -}; /* const */ -static s32 D_800E8440[8] = { 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA }; /* const */ -static s32 D_800E8460[8] = { 9, 9, 9, 9, 0xA, 9, 9, 9 }; /* const */ -static s32 D_800E8480[8] = { 9, 9, 9, 9, 9, 9, 9, 9 }; /* const */ -static s32 D_800E84A0[8] = { 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13, 0x13 }; /* const */ + D_02006BB0, +}; void func_800AA69C(struct_8018D9E0_entry *arg0) { s32 sp30; @@ -13530,98 +13506,96 @@ void func_800AA69C(struct_8018D9E0_entry *arg0) { s32 temp_a0; s32 temp_a0_2; s32 temp_a0_3; - s32 temp_a1; s32 temp_v0; s32 temp_v0_2; s32 temp_v1; - s32 phi_a0; - s32 phi_v0; - s32 phi_v1; + s32 var_a0; + s32 var_v0; + s32 var_v1; temp_a0 = arg0->type - 0x2B; sp30 = temp_a0; temp_v0 = func_800AAFCC(temp_a0); - temp_a1 = sp30; if (temp_v0 >= 0) { - phi_a0 = 1; + var_a0 = 1; } else { - phi_a0 = 0; + var_a0 = 0; } temp_v1 = arg0->unk8; switch (temp_v1) { case 0: - if ((*(&D_8018EDE8 + temp_v0) != 0) && (phi_a0 != 0)) { + if ((*(&D_8018EDE8 + temp_v0) != 0) && (var_a0 != 0)) { arg0->unk8 = 1; - func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(gCharacterCelebrateAnimation[temp_a1])); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(gCharacterCelebrateAnimation[sp30])); return; } - sp30 = temp_a1; - temp_v0_2 = random_int(0xC8, temp_a1); + sp30 = sp30; + temp_v0_2 = random_int(0x00C8U); if (temp_v0_2 >= 0xC6) { arg0->unk8 = 4; - func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(gCharacterSingleBlinkAnimation[temp_a1])); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(gCharacterSingleBlinkAnimation[sp30])); return; } if (temp_v0_2 >= 0xC5) { arg0->unk8 = 5; - func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(gCharacterDoubleBlinkAnimation[temp_a1])); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(gCharacterDoubleBlinkAnimation[sp30])); return; } default: return; case 1: - if (*(&D_8018DEE4 + (arg0->D_8018DEE0_index * 0x18)) >= D_800E8440[temp_a1]) { + if (*(&D_8018DEE4 + (arg0->D_8018DEE0_index * 0x18)) >= D_800E8440[sp30]) { arg0->unk8 = 2; - func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(D_800E83A0[temp_a1])); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(D_800E83A0[sp30])); return; } - if ((*(&D_8018EDE8 + temp_v0) == 0) && (phi_a0 != 0)) { + if ((*(&D_8018EDE8 + temp_v0) == 0) && (var_a0 != 0)) { arg0->unk8 = 3; - sp24 = temp_a1 * 4; + sp24 = sp30 * 4; temp_a0_2 = arg0->D_8018DEE0_index; - func_8009A594(temp_a0_2, D_800E8460[temp_a1] - *(&D_8018DEE4 + (temp_a0_2 * 0x18)), segmented_to_virtual_dupe_2(gCharacterDeselectAnimation[temp_a1])); + func_8009A594(temp_a0_2, D_800E8460[sp30] - *(&D_8018DEE4 + (temp_a0_2 * 0x18)), segmented_to_virtual_dupe_2(gCharacterDeselectAnimation[sp30])); return; } break; case 2: - if ((*(&D_8018EDE8 + temp_v0) == 0) && (phi_a0 != 0)) { + if ((*(&D_8018EDE8 + temp_v0) == 0) && (var_a0 != 0)) { arg0->unk8 = 3; - func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(gCharacterDeselectAnimation[temp_a1])); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(gCharacterDeselectAnimation[sp30])); return; } break; case 3: - temp_a3 = &D_800E8460[temp_a1]; + temp_a3 = &D_800E8460[sp30]; if (*(&D_8018DEE4 + (arg0->D_8018DEE0_index * 0x18)) >= *temp_a3) { arg0->unk8 = 0; - func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(D_800E8360[temp_a1])); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(D_800E8360[sp30])); return; } - if ((*(&D_8018EDE8 + temp_v0) != 0) && (phi_a0 != 0)) { + if ((*(&D_8018EDE8 + temp_v0) != 0) && (var_a0 != 0)) { arg0->unk8 = 1; sp20 = temp_a3; temp_a0_3 = arg0->D_8018DEE0_index; - func_8009A594(temp_a0_3, *temp_a3 - *(&D_8018DEE4 + (temp_a0_3 * 0x18)), segmented_to_virtual_dupe_2(gCharacterCelebrateAnimation[temp_a1])); + func_8009A594(temp_a0_3, *temp_a3 - *(&D_8018DEE4 + (temp_a0_3 * 0x18)), segmented_to_virtual_dupe_2(gCharacterCelebrateAnimation[sp30])); return; } break; case 4: case 5: - if ((*(&D_8018EDE8 + temp_v0) != 0) && (phi_a0 != 0)) { + if ((*(&D_8018EDE8 + temp_v0) != 0) && (var_a0 != 0)) { arg0->unk8 = 1; - func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(gCharacterCelebrateAnimation[temp_a1])); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(gCharacterCelebrateAnimation[sp30])); return; } if (temp_v1 == 4) { - phi_v0 = D_800E8480[temp_a1]; - phi_v1 = temp_a1 * 4; + var_v1 = sp30 * 4; + var_v0 = D_800E8480[sp30]; } else { - phi_v0 = D_800E84A0[temp_a1]; - phi_v1 = temp_a1 * 4; + var_v1 = sp30 * 4; + var_v0 = D_800E84A0[sp30]; } - if (*(&D_8018DEE4 + (arg0->D_8018DEE0_index * 0x18)) >= phi_v0) { + if (*(&D_8018DEE4 + (arg0->D_8018DEE0_index * 0x18)) >= var_v0) { arg0->unk8 = 0; - func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(*(D_800E8360 + phi_v1))); + func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(*(D_800E8360 + var_v1))); } break; } @@ -13630,57 +13604,44 @@ void func_800AA69C(struct_8018D9E0_entry *arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AA69C.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 -s32 func_800AAFCC(s32, struct_8018D9E0_entry *); /* extern */ -extern s8 D_8018EDEE; +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0.s +// jpt_800F25B8 void func_800AAA9C(struct_8018D9E0_entry *arg0) { - s32 temp_a0; - s32 temp_t2; - s32 temp_t6; - s32 temp_v0; - struct_8018D9E0_entry *temp_a1; - - temp_t6 = arg0->unk4; - temp_a1 = arg0; - switch (temp_t6) { + switch (arg0->unk4) { case 3: - temp_a1->unk4 = 1; + arg0->unk4 = 1; /* fallthrough */ case 1: if (D_8018EDEE == 3) { - temp_a1->unk1C = 0x20; + arg0->unk1C = 0x00000020; } else { - temp_v0 = temp_a1->unk1C; - if (temp_v0 < 0x20) { - temp_t2 = temp_v0 + (temp_v0 / 12) + 2; - temp_a1->unk1C = temp_t2; - if (temp_t2 >= 0x20) { - temp_a1->unk1C = 0x20; + if (arg0->unk1C < 0x20) { + arg0->unk1C += (arg0->unk1C / 12) + 2; + if (arg0->unk1C >= 0x20) { + arg0->unk1C = 0x00000020; } } } /* fallthrough */ case 0: - temp_a0 = temp_a1->type; - arg0 = temp_a1; - if (func_800AAFCC(temp_a0 - 0x2B, temp_a1) >= 0) { + if (func_800AAFCC(arg0->type - 0x2B) >= 0) { arg0->unk4 = 2; -block_13: arg0->unk1C = 0; - default: - return; + } else { + arg0->unk4 = 1; } - arg0->unk4 = 1; - return; + break; case 4: - arg0 = temp_a1; - if (func_800AAFCC(temp_a1->type - 0x2B, temp_a1) >= 0) { + if (func_800AAFCC(arg0->type - 0x2B) >= 0) { arg0->unk4 = 2; - goto block_13; + arg0->unk1C = 0; } break; + case 2: + default: + break; } } #else @@ -13722,19 +13683,16 @@ GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AAB90.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c struct _struct_D_800E7108_0x8 { /* 0x0 */ s16 unk0; /* inferred */ /* 0x2 */ s16 unk2; /* inferred */ /* 0x4 */ char pad4[4]; /* maybe part of unk2[3]? */ }; /* size = 0x8 */ -void func_800A91D8(struct_8018D9E0_entry *, s16, s16, struct_8018D9E0_entry *); /* extern */ -s32 func_800AAFCC(s32, s32, s32, struct_8018D9E0_entry *); /* extern */ extern s8 D_8018EDEE; -extern s32 gScreenModeSelection; -static struct _struct_D_800E7108_0x8 D_800E7108[0]; /* unable to generate initializer; const */ -static ? D_800E7188; /* unable to generate initializer; const */ +static struct _struct_D_800E7108_0x8 D_800E7108[0]; /* unable to generate initializer */ +static ? D_800E7188; /* unable to generate initializer */ static MkAnimation *D_800E8340[8] = { D_02006778, D_02006960, @@ -13744,43 +13702,33 @@ static MkAnimation *D_800E8340[8] = { D_020072F0, D_020074D8, D_02006B48, -}; /* const */ +}; void func_800AAC18(struct_8018D9E0_entry *arg0) { s32 sp24; struct _struct_D_800E7108_0x8 *sp18; - s32 temp_a0; s32 temp_a1; s32 temp_v0; s32 temp_v0_3; - s32 temp_v1; + s32 var_v1; struct _struct_D_800E7108_0x8 *temp_v0_2; struct _struct_D_800E7108_0x8 *temp_v0_4; - struct_8018D9E0_entry *temp_a3; + struct _struct_D_800E7108_0x8 *var_t0; void *temp_t0; - s32 phi_v1; - struct_8018D9E0_entry *phi_a3; - struct _struct_D_800E7108_0x8 *phi_t0; - temp_v1 = arg0->unk4; - temp_a3 = arg0; + var_v1 = arg0->unk4; temp_a1 = arg0->type - 0x2B; - phi_v1 = temp_v1; - phi_a3 = temp_a3; - switch (temp_v1) { + switch (var_v1) { case 0: - temp_a0 = temp_a1; if (D_8018EDEE == 3) { sp24 = temp_a1; - arg0 = temp_a3; - temp_v0 = func_800AAFCC(temp_a0, temp_a1); + temp_v0 = func_800AAFCC(temp_a1); if (temp_v0 >= 0) { temp_t0 = (gScreenModeSelection << 5) + (temp_v0 * 8) + &D_800E7188; arg0->column = (s32) temp_t0->unk0; arg0->unk4 = 2; arg0->unk8 = 2; arg0->row = (s32) temp_t0->unk2; - arg0 = arg0; func_8009A594(arg0->D_8018DEE0_index, 0, segmented_to_virtual_dupe_2(D_800E8340[temp_a1])); return; } @@ -13790,31 +13738,29 @@ void func_800AAC18(struct_8018D9E0_entry *arg0) { case 1: case 3: temp_v0_2 = &D_800E7108[temp_a1]; - temp_a3->column = (s32) temp_v0_2->unk0; - temp_a3->row = (s32) temp_v0_2->unk2; + arg0->column = (s32) temp_v0_2->unk0; + arg0->row = (s32) temp_v0_2->unk2; return; case 2: case 4: - if (temp_v1 == 2) { - arg0 = temp_a3; - temp_v0_3 = func_800AAFCC(temp_a1, temp_a1, 2, temp_a3); - phi_a3 = arg0; + if (var_v1 == 2) { + temp_v0_3 = func_800AAFCC(temp_a1); if (temp_v0_3 >= 0) { sp18 = (gScreenModeSelection << 5) + (temp_v0_3 * 8) + &D_800E7188; } - phi_v1 = arg0->unk4; - phi_t0 = sp18; + var_t0 = sp18; + var_v1 = arg0->unk4; goto block_13; } temp_v0_4 = &D_800E7108[temp_a1]; - phi_t0 = temp_v0_4; - if ((temp_a3->column == temp_v0_4->unk0) && (temp_a3->row == temp_v0_4->unk2)) { - temp_a3->unk4 = 0; + var_t0 = temp_v0_4; + if ((arg0->column == temp_v0_4->unk0) && (arg0->row == temp_v0_4->unk2)) { + arg0->unk4 = 0; return; } block_13: - if ((phi_v1 != 2) || (phi_a3->unk8 != 1)) { - func_800A91D8(phi_a3, phi_t0->unk0, phi_t0->unk2, phi_a3); + if ((var_v1 != 2) || (arg0->unk8 != 1)) { + func_800A91D8(arg0, (s32) var_t0->unk0, (s32) var_t0->unk2); } break; } @@ -14603,41 +14549,16 @@ block_13: GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ABEAC.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 054f217e0ef630f2a2a76ec70a84ce37369571c0 -void func_800A9208(struct_8018D9E0_entry *, s32); /* extern */ -s16 gCurrentCourseId; /* unable to generate initializer */ -s8 *D_800E7524[0x14] = { - "mario raceway", - "choco mountain", - "bowser's castle", - "banshee boardwalk", - "yoshi valley", - "frappe snowland", - "koopa troopa beach", - "royal raceway", - "luigi raceway", - "moo moo farm", - "toad's turnpike", - "kalimari desert", - "sherbet land", - "rainbow road", - "wario stadium", - "block fort", - "skyscraper", - "double deck", - "d.k.'s jungle parkway", - "big donut", -}; /* const */ +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0.s +extern f64 D_800F2648;// = 0.05; +extern f64 D_800F2650;// = 0.0085; +extern f64 D_800F2658;// = 0.4; +// this is plain data? +extern char *D_800E7524[0x14]; void func_800ABF68(struct_8018D9E0_entry *arg0) { - f64 temp_f0; - s32 temp_t3; - s32 temp_t3_2; - s32 temp_v0; - - temp_v0 = arg0->unk4; - switch (temp_v0) { /* irregular */ + switch (arg0->unk4) { case 0: arg0->column = 0x140; arg0->unk4 = 1; @@ -14645,26 +14566,22 @@ void func_800ABF68(struct_8018D9E0_entry *arg0) { /* fallthrough */ case 1: func_800A9208(arg0, arg0->unk20); - temp_t3 = (s32) (arg0->column - arg0->unk20) / 4; - arg0->unk1C = temp_t3; - if (temp_t3 >= 9) { + arg0->unk1C = (arg0->column - arg0->unk20) / 4; + if (arg0->unk1C >= 9) { arg0->unk1C = 8; } - arg0->unk24 = (f32) (((f64) arg0->unk1C * 0.05) + 1.0); + arg0->unk24 = (arg0->unk1C * 0.05) + 1.0; if ((arg0->unk20 + 0x14) >= arg0->column) { arg0->unk4 = 2; arg0->D_8018DEE0_index = 0; - return; } - return; + break; case 2: func_800A9208(arg0, arg0->unk20); - temp_t3_2 = arg0->D_8018DEE0_index + 1; - temp_f0 = (f64) (temp_t3_2 - 0xA); - arg0->unk1C = (s32) (arg0->column - arg0->unk20) / 4; - arg0->D_8018DEE0_index = temp_t3_2; - arg0->unk24 = (f32) ((temp_f0 * 0.0085 * temp_f0) + 0.4); - if ((temp_t3_2 >= 9) && ((f64) arg0->unk24 > 1.0)) { + arg0->unk1C = (arg0->column - arg0->unk20) / 4; + arg0->D_8018DEE0_index++; + arg0->unk24 = ((arg0->D_8018DEE0_index - 0xA) * 0.0085 * (arg0->D_8018DEE0_index - 0xA)) + 0.4; + if ((arg0->D_8018DEE0_index >= 9) && ((f64) arg0->unk24 > 1.0)) { arg0->unk24 = 1.0f; } break; @@ -14674,66 +14591,97 @@ void func_800ABF68(struct_8018D9E0_entry *arg0) { GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ABF68.s") #endif +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0.s +extern f64 D_800F2660;// = 0.07; +extern f64 D_800F2668;// = 0.6; +extern f64 D_800F2670;// = 0.004; +extern f64 D_800F2678;// = 0.8; +extern f64 D_800F2680;// = 0.002; + +void func_800AC128(struct_8018D9E0_entry *arg0) { + switch (arg0->unk4) { + case 0: + arg0->column = 0x00000140; + arg0->unk4 = 1; + /* fallthrough */ + case 1: + func_800A940C(arg0, 0x00000064); + arg0->unk1C = (s32) (arg0->column - 0x64) / 6; + if (arg0->unk1C >= 9) { + arg0->unk1C = 8; + } + arg0->unk24 = (f32) (((f64) arg0->unk1C * 0.07) + 0.6); + if (arg0->column == 0x00000064) { + arg0->unk4 = 2; + arg0->D_8018DEE0_index = 0; + } + break; + case 2: + arg0->D_8018DEE0_index++; + arg0->unk1C = 0; + arg0->unk24 = (f32) (1.5 - ((arg0->D_8018DEE0_index - 0xF) * 0.004 * (arg0->D_8018DEE0_index - 0xF))); + if ((arg0->D_8018DEE0_index >= 0x10) && ((f64) arg0->unk24 < 0.8)) { + arg0->unk4 = 3; + arg0->D_8018DEE0_index = 0; + } + break; + case 3: + arg0->D_8018DEE0_index++; + arg0->unk1C = 0; + arg0->unk24 = (f32) (1.25 - ((arg0->D_8018DEE0_index - 0xF) * 0.002 * (arg0->D_8018DEE0_index - 0xF))); + if ((arg0->D_8018DEE0_index >= 0xD) && ((f64) arg0->unk24 < 1.0)) { + arg0->unk24 = 1.0f; + } + break; + } +} +#else +GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AC128.s") +#endif + void func_800AC300(struct_8018D9E0_entry *arg0) { if (arg0->unk20 < ++arg0->unk1C) { arg0->type = 0; } } -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -void func_800A9208(struct_8018D9E0_entry *, ?); /* extern */ -extern s8 D_8018D9D8; -static s32 D_800DDB24 = 1; - void func_800AC324(struct_8018D9E0_entry *arg0) { - s32 temp_t1; - s32 temp_v0; - s32 temp_v0_2; - - temp_v0 = arg0->unk4; - switch (temp_v0) { /* irregular */ + switch (arg0->unk4) { case 0: arg0->column = 0x14A; arg0->unk4 = 1; func_800921B4(); - return; + break; case 1: func_800A9208(arg0, 0xA0); if (arg0->column == 0xA0) { arg0->unk4 = 2; arg0->unk20 = 0; - return; } - return; + break; case 2: - temp_t1 = arg0->unk20 + 1; - arg0->unk20 = temp_t1; - if (((D_8018D9D8 != 0) || (temp_t1 >= 0x5B)) && (D_800DDB24 != 0)) { + arg0->unk20++; + if (((D_8018D9D8 != 0) || (arg0->unk20 >= 0x5B)) && (D_800DDB24 != 0)) { arg0->unk4 = 3; arg0->unk1C = arg0->column; add_8018D9E0_entry(0xAB, 0, 0, 0); - return; } break; case 3: - temp_v0_2 = arg0->unk1C; - arg0->column = temp_v0_2; - if (temp_v0_2 < 0x14A) { + arg0->column = arg0->unk1C; + if (arg0->unk1C < 0x14A) { if (D_8018D9D8 != 0) { - arg0->unk1C = temp_v0_2 + 0x20; - return; + arg0->unk1C += 0x20; + } else { + arg0->unk1C += 0x10; } - arg0->unk1C = temp_v0_2 + 0x10; - return; + } else { + arg0->type = 0; } - arg0->type = 0; break; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AC324.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda @@ -15374,39 +15322,29 @@ block_11: GLOBAL_ASM("asm/non_matchings/code_80091750/func_800ACF40.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda -void func_800A9208(struct_8018D9E0_entry *, ?); /* extern */ -extern s8 D_8018D9D8; +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0.s +// jpt_800F273C void func_800AD1A4(struct_8018D9E0_entry *arg0) { - s32 temp_t2; - s32 temp_t6; - s32 temp_v0; - - temp_t6 = arg0->unk4; - switch (temp_t6) { + switch (arg0->unk4) { case 0: - arg0->column = 0x14A; + arg0->column = 0x0000014A; arg0->unk4 = 1; func_800921B4(); - add_8018D9E0_entry(0xBB, 0, 0, 0); - return; + add_8018D9E0_entry(0x000000BB, 0, 0, 0); + break; case 1: - func_800A9208(arg0, 0xA0); - if (arg0->column == 0xA0) { + func_800A9208(arg0, 0x000000A0); + if (arg0->column == 0x000000A0) { arg0->unk4 = 2; arg0->unk20 = 0; - return; } - default: - return; + break; case 2: - temp_t2 = arg0->unk20 + 1; - arg0->unk20 = temp_t2; - if (temp_t2 >= 0x15) { + arg0->unk20++; + if (arg0->unk20 >= 0x15) { arg0->unk4 = 3; - return; } break; case 3: @@ -15414,22 +15352,22 @@ void func_800AD1A4(struct_8018D9E0_entry *arg0) { func_800921B4(); arg0->unk4 = 4; arg0->unk1C = arg0->column; - add_8018D9E0_entry(0xBA, 0, 0, 0); - return; + add_8018D9E0_entry(0x000000BA, 0, 0, 0); } break; case 4: - temp_v0 = arg0->unk1C; - arg0->column = temp_v0; - if (temp_v0 < 0x14A) { + arg0->column = arg0->unk1C; + if (arg0->unk1C < 0x14A) { if (D_8018D9D8 != 0) { - arg0->unk1C = temp_v0 + 0x20; - return; + arg0->unk1C += 0x20; + } else { + arg0->unk1C += 0x10; } - arg0->unk1C = temp_v0 + 0x10; - return; + } else { + arg0->type = 0; } - arg0->type = 0; + break; + default: break; } } @@ -16233,84 +16171,49 @@ block_107: GLOBAL_ASM("asm/non_matchings/code_80091750/func_800AE218.s") #endif -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -static s8 D_800E7780[0x1D] = { - 0x4E, - 0x4F, - 0x57, - 0x2D, - 0x4D, - 0x45, - 0x45, - 0x54, - 0x20, - 0x54, - 0x48, - 0x45, - 0x20, - 0x43, - 0x4F, - 0x55, - 0x52, - 0x53, - 0x45, - 0x20, - 0x47, - 0x48, - 0x4F, - 0x53, - 0x54, - 0x21, - 0x21, - 0x21, - 0, -}; +#ifdef NEEDS_RODATA +// data_0DD0A0_3_0.s +// jpt_800F2A88 +// data_0DD0A0_2_0.s +extern char D_800E7780[];// = "NOW-MEET THE COURSE GHOST!!!"; void func_800AEC54(struct_8018D9E0_entry *arg0) { - s32 temp_t5; - s32 temp_t6; - s32 temp_t9; - - temp_t6 = arg0->unk4; - switch (temp_t6) { + switch (arg0->unk4) { case 0: arg0->column = (get_string_width("NOW-MEET THE COURSE GHOST!!!") / 2) + 0x140; arg0->row = 0x000000DA; arg0->unk4 = 1; func_800C90F4(0U, (D_80162DE4 * 0x10) + 0x29008001); - return; + break; case 1: func_800A9208(arg0, 0x000000A0); if (arg0->column == 0x000000A0) { arg0->unk4 = 2; arg0->unk1C = 0; - return; } - default: - return; + break; case 2: - temp_t5 = arg0->unk1C + 1; - arg0->unk1C = temp_t5; - if (temp_t5 >= 0x3D) { + arg0->unk1C++; + if (arg0->unk1C >= 0x3D) { arg0->unk4 = 3; arg0->unk1C = 0; - return; } break; case 4: - temp_t9 = arg0->unk1C + 1; - arg0->unk1C = temp_t9; - if (temp_t9 >= 6) { + arg0->unk1C++; + if (arg0->unk1C >= 6) { arg0->type = 0; - return; + break; } + // Purposeful fallthrough case 3: func_800A94C8(arg0, 0x000000A0, -1); if (((arg0->column + 0x14) == -(get_string_width("NOW-MEET THE COURSE GHOST!!!") / 2)) && (arg0->unk4 == 3)) { arg0->unk4 = 4; } break; + default: + break; } } #else @@ -16687,68 +16590,60 @@ void func_800AF480(struct_8018D9E0_entry *arg0) { } } -#ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc +#ifdef NEEDS_RODATA +// Needs jpt_800F2AD0 +extern f64 D_800F2AE8;// 0.05; +extern f64 D_800F2AF0;// 0.0085; +extern f64 D_800F2AF8;// 0.4; void func_800AF4DC(struct_8018D9E0_entry *arg0) { - struct_802850C0_entry *sp20; - f64 temp_f0; - s32 temp_t6; - s32 temp_t6_2; - s32 temp_t9; + s32 pad; s32 temp_v0; struct_802850C0_entry *temp_v1; - temp_t9 = arg0->unk4; temp_v0 = arg0->type - 0x190; temp_v1 = &D_802850C0[temp_v0]; - arg0->row = (s32) temp_v1->row; - switch (temp_t9) { + arg0->row = temp_v1->row; + switch (arg0->unk4) { case 0: + arg0->column = temp_v1->startingColumn; arg0->unk4 = 1; - arg0->column = (s32) temp_v1->startingColumn; - sp20 = temp_v1; - arg0->unk20 = (s32) ((((f32) get_string_width(D_802854B0[temp_v0]) * temp_v1->textScaling) / 2.0f) + (f32) temp_v1->columnExtra); + arg0->unk20 = temp_v1->columnExtra + (get_string_width(D_802854B0[temp_v0]) * temp_v1->textScaling / 2); /* fallthrough */ case 1: func_800A9208(arg0, arg0->unk20); - temp_t6 = (s32) (arg0->unk20 - arg0->column) / 4; - arg0->unk1C = temp_t6; - if (temp_t6 >= 9) { + arg0->unk1C = (s32) (arg0->unk20 - arg0->column) / 4; + if (arg0->unk1C >= 9) { arg0->unk1C = 8; } - arg0->unk24 = (f32) (((f64) arg0->unk1C * 0.05) + 1.0); + arg0->unk24 = (arg0->unk1C * 0.05) + 1.0; if (arg0->column >= (arg0->unk20 - 0x14)) { arg0->unk4 = 2; arg0->D_8018DEE0_index = 0; - return; } - default: - return; + break; case 2: func_800A9208(arg0, arg0->unk20); - temp_t6_2 = arg0->D_8018DEE0_index + 1; - temp_f0 = (f64) (temp_t6_2 - 0xA); - arg0->unk1C = (s32) (arg0->unk20 - arg0->column) / 4; - arg0->D_8018DEE0_index = temp_t6_2; - arg0->unk24 = (f32) ((temp_f0 * 0.0085 * temp_f0) + 0.4); - if ((temp_t6_2 >= 9) && ((f64) arg0->unk24 > 1.0)) { - arg0->unk4 = 3; + arg0->unk1C = (arg0->unk20 - arg0->column) / 4; + arg0->D_8018DEE0_index += 1; + arg0->unk24 = ((arg0->D_8018DEE0_index - 0xA) * 0.0085 * (arg0->D_8018DEE0_index - 0xA)) + 0.4; + if ((arg0->D_8018DEE0_index >= 9) && ((f64) arg0->unk24 > 1)) { arg0->unk24 = 1.0f; - return; + arg0->unk4 = 3; } break; case 3: if ((u8) D_8018ED91 != 0) { arg0->unk4 = 4; - return; } break; case 4: func_800A94C8(arg0, arg0->unk20, 1); - if ((f64) arg0->row > 480.0) { + if (arg0->row > 480.0) { arg0->type = 0; } break; + default: + break; } } #else diff --git a/src/code_80091750.h b/src/code_80091750.h index b9958fb6b..a3695ecd6 100644 --- a/src/code_80091750.h +++ b/src/code_80091750.h @@ -155,9 +155,12 @@ void func_800A11D0(struct_8018D9E0_entry*, s32, s32); void func_800A15EC(struct_8018D9E0_entry*); void func_800A1924(struct_8018D9E0_entry*); void func_800A1A20(struct_8018D9E0_entry*); +void func_800A1F30(struct_8018D9E0_entry*); +void func_800A2D1C(struct_8018D9E0_entry*); void func_800A3C84(struct_8018D9E0_entry*); void func_800A4550(s32, s32, s32); void func_800A474C(s32, s32, s32); +void func_800A4A24(struct_8018D9E0_entry*); void func_800A4B38(struct_8018D9E0_entry*); void func_800A4BC8(struct_8018D9E0_entry*); void func_800A4EF8(struct_8018D9E0_entry*); @@ -165,6 +168,7 @@ void func_800A5084(struct_8018D9E0_entry*); void func_800A5360(struct_8018D9E0_entry*); void func_800A54EC(); void func_800A6034(struct_8018D9E0_entry*); +void func_800A70E8(struct_8018D9E0_entry*); void func_800A7258(struct_8018D9E0_entry*); void func_800A72FC(struct_8018D9E0_entry*); void func_800A7448(struct_8018D9E0_entry*); @@ -203,7 +207,12 @@ void func_800AB020(struct_8018D9E0_entry*); void func_800AB098(struct_8018D9E0_entry*); void func_800AB260(struct_8018D9E0_entry*); void func_800AB290(struct_8018D9E0_entry*); +void func_800ABF68(struct_8018D9E0_entry*); +void func_800AC128(struct_8018D9E0_entry*); +void func_800AC324(struct_8018D9E0_entry*); void func_800AC978(struct_8018D9E0_entry*); +void func_800AD1A4(struct_8018D9E0_entry*); +void func_800AEC54(struct_8018D9E0_entry*); void func_800AEE90(struct_8018D9E0_entry*); void func_800AEEBC(struct_8018D9E0_entry*); void func_800AEEE8(struct_8018D9E0_entry*); @@ -225,6 +234,8 @@ void func_80057CE4(); extern Gfx D_06009410[]; +extern s32 D_800DDB24; + extern Gfx *D_800E84CC[]; extern Gfx *D_800E84EC[]; extern Gfx *D_800E850C[]; @@ -271,6 +282,7 @@ extern f32 D_800F24B8; extern f64 D_800F24C0; extern s32 D_80165754; extern s32 D_8018D9B0; +extern s8 D_8018D9D8; extern s8 D_8018D9D9; extern struct_8018D9E0_entry D_8018D9E0[D_8018D9E0_SIZE]; // D_8018D9E0 extern struct_8018DEE0_entry D_8018DEE0[D_8018DEE0_SIZE]; // D_8018DEE0 @@ -294,6 +306,7 @@ extern f32 D_8018EDD0; extern f32 D_8018EDD4; extern f32 D_8018EDD8; extern f32 D_8018EDDC; +extern s8 D_8018EE08; extern s8 D_802874F5; extern u8 _textures_0aSegmentRomStart[]; diff --git a/src/code_80280650.c b/src/code_80280650.c index d8c5c1e6f..44f59dc70 100644 --- a/src/code_80280650.c +++ b/src/code_80280650.c @@ -4,7 +4,9 @@ #include <common_structs.h> #include "main.h" #include "variables.h" +#include "common_textures.h" #include "code_8001F980.h" +#include "code_800431B0.h" #include "code_80280650.h" void func_80280650(void) { @@ -177,100 +179,32 @@ void func_80280A28(Vec3f arg0, Vec3s arg1, f32 arg2) { gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(&gGfxPool->mtxPool[D_80164AF0 + 0x3EB]), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); } -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -//void func_8004B35C(s16, s16, s16, s16); // extern -//void func_80280A28(?, f32 *, s16 *, ?); // extern -extern u8 D_0D008DB8; -extern u8 D_0D008E48; -extern s16 D_80164AF0; -extern s32 D_8018D48C; - -struct UnkStruct80280B50 { - s32 unk0; - s32 unk4; - s32 unk8; -}; -extern Camera *camera1; - -void func_80280B50(struct UnkStruct80280B50 *arg0, s32 arg1, s32 arg2, s16 arg3) { - f32 sp54 = arg0->unk8; - f32 sp50 = arg0->unk4; - f32 sp4C = arg0->unk0; - s16 sp48 = 0; - s32 sp46 = camera1->unk26; - s16 sp44 = 0; - void *sp1C; - //s16 *temp_a1 = &sp44; - - //sp4C = arg0->unk0; - //temp_a1 = &sp44; - //sp50 = arg0->unk4; - //sp44 = 0; - //sp54 = arg0->unk8; - //sp48 = 0; - //sp46 = camera1->unk26; - func_80280A28(arg1, &sp4C, &sp44, arg1); - +#ifdef NON_MATCHING +extern u32 D_8018D48C; + +void func_80280B50(Vec3f arg0, f32 arg1, s32 rgb, s16 alpha) { + Vec3f sp4C; + Vec3s sp44; + s16 red; + s16 green; + s16 blue; + + sp4C[0] = arg0[0]; + sp4C[1] = arg0[1]; + sp4C[2] = arg0[2]; + sp44[0] = 0; + sp44[1] = camera1->rot[1]; + sp44[2] = 0; + func_80280A28(sp4C, sp44, arg1); gSPDisplayList(gDisplayListHead++, D_0D008DB8); - gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, D_8018D48C); - gDPSetTile(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPLoadSync(gDisplayListHead++); - gDPLoadBlock(gDisplayListHead++, 1, 0, 0, 4082, 0); - gDPPipeSync(gDisplayListHead++); - gDPSetTile(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_8b, 4, 0x0000, G_TX_RENDERTILE, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD); - gDPSetTileSize(gDisplayListHead++, G_TX_RENDERTILE, 0, 0, 0x7C0, 0x7C0); - - func_8004B35C((arg2 >> 0x10) & 0xFF, (arg2 >> 8) & 0xFF, arg2 & 0xFF, arg3); - - gSPDisplayList(gDisplayListHead, D_0D008E48); - D_80164AF0++; -/* - temp_v0 = gDisplayListHead; - gDisplayListHead = temp_v0 + 8; - temp_v0->unk0 = 0x6000000; - temp_v0->unk4 = &D_0D008DB8; - temp_v0_2 = gDisplayListHead; - gDisplayListHead = temp_v0_2 + 8; - temp_v0_2->unk0 = 0xFD700000; - temp_v0_2->unk4 = D_8018D48C; - temp_v0_3 = gDisplayListHead; - gDisplayListHead = temp_v0_3 + 8; - temp_v0_3->unk4 = 0x7000000; - temp_v0_3->unk0 = 0xF5700000; - temp_v0_4 = gDisplayListHead; - gDisplayListHead = temp_v0_4 + 8; - temp_v0_4->unk4 = 0; - temp_v0_4->unk0 = 0xE6000000; - temp_v0_5 = gDisplayListHead; - gDisplayListHead = temp_v0_5 + 8; - temp_v0_5->unk4 = 0x71FF200; - temp_v0_5->unk0 = 0xF3000000; - temp_v0_6 = gDisplayListHead; - gDisplayListHead = temp_v0_6 + 8; - temp_v0_6->unk4 = 0; - temp_v0_6->unk0 = 0xE7000000; - temp_v0_7 = gDisplayListHead; - gDisplayListHead = temp_v0_7 + 8; - temp_v0_7->unk4 = 0; - temp_v0_7->unk0 = 0xF5680800; - temp_v0_8 = gDisplayListHead; - - - gDisplayListHead = temp_v0_8 + 8; - sp1C = temp_v0_8; - temp_v0_8->unk4 = 0x7C07C; - temp_v0_8->unk0 = 0xF2000000; - - - func_8004B35C((arg2 >> 0x10) & 0xFF, (arg2 >> 8) & 0xFF, arg2 & 0xFF, arg3); - - - temp_v0_9 = gDisplayListHead; - gDisplayListHead = temp_v0_9 + 8; - temp_v0_9->unk0 = 0x6000000; - temp_v0_9->unk4 = &D_0D008E48; - */; + gDPLoadTextureBlock(gDisplayListHead++, D_8018D48C, G_IM_FMT_IA, G_IM_SIZ_8b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + // The exact order of operations for red/green/blue is slightly wrong... + red = (rgb >> 0x10) & 0xFF; + green = (rgb >> 0x08) & 0xFF; + blue = (rgb >> 0x00) & 0xFF; + func_8004B35C(red, green, blue, alpha); + gSPDisplayList(gDisplayListHead++, D_0D008E48); + D_80164AF0 += 1; } #else GLOBAL_ASM("asm/non_matchings/code_80280650/func_80280B50.s") diff --git a/src/code_80280650.h b/src/code_80280650.h index b8e8c0f47..e73e3e4e7 100644 --- a/src/code_80280650.h +++ b/src/code_80280650.h @@ -76,6 +76,7 @@ f32 func_80280850(f32); void func_80280884(); void func_8028093C(struct UnkStruct_80280658*); void func_80280A28(Vec3f, Vec3s, f32 ); +void func_80280B50(Vec3f, f32, s32, s16); void func_80280FA0(s32); void func_80280FA8(s32); void func_80280FB0(); diff --git a/src/code_80281FA0.c b/src/code_80281FA0.c index f68465e12..3a97c973f 100644 --- a/src/code_80281FA0.c +++ b/src/code_80281FA0.c @@ -503,30 +503,19 @@ GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_802830B4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_80282364(void *, ?, s16, void *); // extern -f32 coss(s32, void *); // extern - +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c void func_80283100(void *arg0, f32 *arg1) { f32 temp_f4; - s32 temp_a0; - void *temp_a3; - void *phi_a3; - temp_a3 = arg0; - phi_a3 = temp_a3; if (arg0->unk60 != 0) { - temp_a0 = arg0->unk64 & 0xFFFF; - arg0 = temp_a3; - temp_f4 = (coss(temp_a0, temp_a3) * arg0->unk60) / 256.0f; - arg0->unk64 = arg0->unk64 + arg0->unk68; - arg0->unk6E = temp_f4; - func_80282364(arg0 + 0x60, 0, arg0->unk6C, arg0); - phi_a3 = arg0; + temp_f4 = (coss((u32) arg0->unk64 & 0xFFFF) * (f32) arg0->unk60) / 256.0f; + arg0->unk64 = (f32) (arg0->unk64 + arg0->unk68); + arg0->unk6E = (s16) (s32) temp_f4; + func_80282364(arg0 + 0x60, 0, arg0->unk6C); } else { - temp_a3->unk64 = 0.0f; + arg0->unk64 = 0.0f; } - *arg1 = phi_a3->unk20 + phi_a3->unk6E; + *arg1 = arg0->unk20 + (f32) arg0->unk6E; } #else GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_80283100.s") diff --git a/src/memory.c b/src/memory.c index 36eb9408a..d16ca8f61 100644 --- a/src/memory.c +++ b/src/memory.c @@ -1589,10 +1589,10 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802AAB4C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -extern f32 D_802B9E48; +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +static f32 D_802B9E48 = -0.9f; -s32 func_802AAE4C(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) { +s32 func_802AAE4C(UnkActorInner *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) { f32 sp6C; f32 sp64; f32 sp3C; @@ -1606,6 +1606,9 @@ s32 func_802AAE4C(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) f32 sp10; f32 spC; f32 sp8; + Vtx *temp_a0; + Vtx *temp_a2; + Vtx *temp_a3; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_3; @@ -1622,54 +1625,48 @@ s32 func_802AAE4C(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) f32 temp_f2_3; f32 temp_f4; f32 temp_f8; - void *temp_a0; - void *temp_a2; - void *temp_a3; - void *temp_v1; - s32 phi_v0; - f32 phi_f18; - s32 phi_v0_2; + mk64_surface_map_ram *temp_v1; + s32 var_v0; + s32 var_v0_2; - temp_v1 = (arg5 * 0x2C) + D_8015F580; - temp_f0 = temp_v1->unk20; - phi_v0 = 1; - phi_v0_2 = 1; + temp_v1 = &D_8015F580[arg5]; + temp_f0 = temp_v1->gravity; + var_v0_2 = 1; if (temp_f0 < D_802B9E48) { return 0; } - if (arg2 < temp_v1->unk4) { + if (arg2 < (f32) temp_v1->vtx3[0]) { return 0; } - if (arg4 < temp_v1->unk8) { + if (arg4 < (f32) temp_v1->vtx3[2]) { return 0; } - if (temp_v1->unkA < arg2) { + if ((f32) temp_v1->vtx2[0] < arg2) { return 0; } - if (temp_v1->unkE < arg4) { + if ((f32) temp_v1->vtx2[2] < arg4) { return 0; } sp2C = temp_f0; - arg2 = arg2; - if (arg3 < (temp_v1->unk6 - (arg1 * 3.0f))) { + if (arg3 < ((f32) temp_v1->vtx3[1] - (arg1 * 3.0f))) { return 0; } - temp_a0 = temp_v1->unk10; - temp_a3 = temp_v1->unk18; - temp_a2 = temp_v1->unk14; - sp6C = temp_a3->unk0; + temp_a0 = temp_v1->vtxs[0]; + temp_a3 = temp_v1->vtxs[2]; + temp_a2 = temp_v1->vtxs[1]; + sp6C = (f32) temp_a3->v.ob[0]; sp8 = arg4; sp10 = arg2; - temp_f8 = temp_a0->unk4 - arg4; - sp64 = temp_a3->unk4; - temp_f4 = temp_a2->unk0 - arg2; + temp_f8 = (f32) temp_a0->v.ob[2] - arg4; + sp64 = (f32) temp_a3->v.ob[2]; + temp_f4 = (f32) temp_a2->v.ob[0] - arg2; sp28 = temp_f8; sp24 = temp_f4; - sp20 = temp_a0->unk0 - arg2; + sp20 = (f32) temp_a0->v.ob[0] - arg2; temp_f0_2 = temp_f8 * temp_f4; sp8 = temp_f8; spC = temp_f4; - sp1C = temp_a2->unk4 - arg4; + sp1C = (f32) temp_a2->v.ob[2] - arg4; temp_f2 = sp20 * sp1C; temp_f10 = temp_f0_2 - temp_f2; sp18 = temp_f10; @@ -1678,9 +1675,8 @@ s32 func_802AAE4C(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) sp14 = arg4; temp_f0_3 = sp6C - sp10; temp_f2_2 = sp64 - arg4; - phi_f18 = 0.0f; if ((((sp1C * temp_f0_3) - (spC * temp_f2_2)) * ((temp_f2_2 * sp20) - (temp_f0_3 * sp8))) < 0.0f) { - goto block_22; + var_v0_2 = 0; } } else { temp_f2_3 = sp64 - arg4; @@ -1688,61 +1684,56 @@ s32 func_802AAE4C(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) temp_f14 = sp24 * temp_f2_3; temp_f12 = sp1C * temp_f0_4; if (temp_f14 == temp_f12) { - phi_f18 = 0.0f; if ((sp3C * ((temp_f2_3 * sp20) - (temp_f0_4 * sp28))) < 0.0f) { - goto block_22; + var_v0_2 = 0; } } else { temp_f16 = temp_f12 - temp_f14; if ((sp18 * temp_f16) < 0.0f) { - goto block_22; - } - temp_f14_2 = temp_f0_4 * sp28; - temp_f12_2 = temp_f2_3 * sp20; - phi_f18 = 0.0f; - if (temp_f14_2 != temp_f12_2) { - phi_f18 = 0.0f; - if ((temp_f16 * (temp_f12_2 - temp_f14_2)) < 0.0f) { -block_22: - phi_v0 = 0; - phi_f18 = 0.0f; + var_v0_2 = 0; + } else { + temp_f14_2 = temp_f0_4 * sp28; + temp_f12_2 = temp_f2_3 * sp20; + if ((temp_f14_2 != temp_f12_2) && ((temp_f16 * (temp_f12_2 - temp_f14_2)) < 0.0f)) { + var_v0_2 = 0; } } } } - if (phi_v0 == 0) { + if (var_v0_2 == 0) { return 0; } - temp_f0_5 = ((temp_v1->unk1C * arg2) + (sp2C * arg3) + (temp_v1->unk24 * arg4) + temp_v1->unk28) - arg1; - if (phi_f18 < temp_f0_5) { - if (temp_f0_5 < arg0->unk14) { - arg0->unk4 = 1; - arg0->unkA = arg5; - arg0->unk14 = temp_f0_5; - arg0->unk30 = temp_v1->unk1C; - arg0->unk34 = temp_v1->unk20; - arg0->unk38 = temp_v1->unk24; + temp_f0_5 = ((temp_v1->height * arg2) + (sp2C * arg3) + (temp_v1->rotation * arg4) + temp_v1->height2) - arg1; + if (temp_f0_5 > 0.0f) { + if (temp_f0_5 < arg0->unk3C[2]) { + arg0->unk34 = 1; + arg0->unk3A = arg5; + arg0->unk3C[2] = temp_f0_5; + arg0->unk60[0] = temp_v1->height; + arg0->unk60[1] = temp_v1->gravity; + arg0->unk60[2] = temp_v1->rotation; } return 0; } - phi_v0_2 = 0; + var_v0 = 0; if (temp_f0_5 > -16.0f) { - arg0->unk4 = 1; - arg0->unkA = arg5; - arg0->unk14 = temp_f0_5; - arg0->unk30 = temp_v1->unk1C; - arg0->unk34 = temp_v1->unk20; - arg0->unk38 = temp_v1->unk24; - } - return phi_v0_2; + arg0->unk34 = 1; + arg0->unk3A = arg5; + arg0->unk3C[2] = temp_f0_5; + var_v0 = 1; + arg0->unk60[0] = temp_v1->height; + arg0->unk60[1] = temp_v1->gravity; + arg0->unk60[2] = temp_v1->rotation; + } + return var_v0; } #else GLOBAL_ASM("asm/non_matchings/memory/func_802AAE4C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_802AB288(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) { +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +s32 func_802AB288(UnkActorInner *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) { f32 sp70; f32 sp6C; f32 sp3C; @@ -1755,6 +1746,9 @@ s32 func_802AB288(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) f32 sp10; f32 spC; f32 sp8; + Vtx *temp_a0; + Vtx *temp_a2; + Vtx *temp_a3; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_3; @@ -1771,54 +1765,47 @@ s32 func_802AB288(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) f32 temp_f4; f32 temp_f6; f32 temp_f8; - void *temp_a0; - void *temp_a2; - void *temp_a3; - void *temp_v1; - s32 phi_v0; - f32 phi_f18; - s32 phi_v0_2; + mk64_surface_map_ram *temp_v1; + s32 var_v0; + s32 var_v0_2; - temp_v1 = (arg5 * 0x2C) + D_8015F580; - phi_v0 = 1; - phi_v0_2 = 1; - if (arg2 < temp_v1->unk4) { + temp_v1 = &D_8015F580[arg5]; + var_v0_2 = 1; + if (arg2 < (f32) temp_v1->vtx3[0]) { return 0; } - if (temp_v1->unkA < arg2) { + if ((f32) temp_v1->vtx2[0] < arg2) { return 0; } - if (temp_v1->unkC < arg3) { + if ((f32) temp_v1->vtx2[1] < arg3) { return 0; } - if (arg3 < temp_v1->unk6) { + if (arg3 < (f32) temp_v1->vtx3[1]) { return 0; } temp_f2 = arg1 * 3.0f; - if (arg4 < (temp_v1->unk8 - temp_f2)) { + if (arg4 < ((f32) temp_v1->vtx3[2] - temp_f2)) { return 0; } - arg2 = arg2; - arg3 = arg3; - if ((temp_v1->unkE + temp_f2) < arg4) { + if (((f32) temp_v1->vtx2[2] + temp_f2) < arg4) { return 0; } - temp_a0 = temp_v1->unk10; - temp_a3 = temp_v1->unk18; - temp_a2 = temp_v1->unk14; - sp70 = temp_a3->unk0; + temp_a0 = temp_v1->vtxs[0]; + temp_a3 = temp_v1->vtxs[2]; + temp_a2 = temp_v1->vtxs[1]; + sp70 = (f32) temp_a3->v.ob[0]; sp8 = arg3; sp10 = arg2; - temp_f4 = temp_a0->unk2 - arg3; - sp6C = temp_a3->unk2; - temp_f8 = temp_a2->unk0 - arg2; + temp_f4 = (f32) temp_a0->v.ob[1] - arg3; + sp6C = (f32) temp_a3->v.ob[1]; + temp_f8 = (f32) temp_a2->v.ob[0] - arg2; sp2C = temp_f4; sp28 = temp_f8; - sp24 = temp_a0->unk0 - arg2; + sp24 = (f32) temp_a0->v.ob[0] - arg2; temp_f0 = temp_f4 * temp_f8; sp8 = temp_f4; spC = temp_f8; - sp20 = temp_a2->unk2 - arg3; + sp20 = (f32) temp_a2->v.ob[1] - arg3; temp_f2_2 = sp24 * sp20; temp_f6 = temp_f0 - temp_f2_2; sp1C = temp_f6; @@ -1827,9 +1814,8 @@ s32 func_802AB288(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) sp14 = arg3; temp_f0_2 = sp70 - sp10; temp_f2_3 = sp6C - arg3; - phi_f18 = 0.0f; if ((((sp20 * temp_f0_2) - (spC * temp_f2_3)) * ((temp_f2_3 * sp24) - (temp_f0_2 * sp8))) < 0.0f) { - goto block_22; + var_v0_2 = 0; } } else { temp_f2_4 = sp6C - arg3; @@ -1837,61 +1823,56 @@ s32 func_802AB288(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) temp_f14 = sp28 * temp_f2_4; temp_f12 = sp20 * temp_f0_3; if (temp_f14 == temp_f12) { - phi_f18 = 0.0f; if ((sp3C * ((temp_f2_4 * sp24) - (temp_f0_3 * sp2C))) < 0.0f) { - goto block_22; + var_v0_2 = 0; } } else { temp_f16 = temp_f12 - temp_f14; if ((sp1C * temp_f16) < 0.0f) { - goto block_22; - } - temp_f14_2 = temp_f0_3 * sp2C; - temp_f12_2 = temp_f2_4 * sp24; - phi_f18 = 0.0f; - if (temp_f14_2 != temp_f12_2) { - phi_f18 = 0.0f; - if ((temp_f16 * (temp_f12_2 - temp_f14_2)) < 0.0f) { -block_22: - phi_v0 = 0; - phi_f18 = 0.0f; + var_v0_2 = 0; + } else { + temp_f14_2 = temp_f0_3 * sp2C; + temp_f12_2 = temp_f2_4 * sp24; + if ((temp_f14_2 != temp_f12_2) && ((temp_f16 * (temp_f12_2 - temp_f14_2)) < 0.0f)) { + var_v0_2 = 0; } } } } - if (phi_v0 == 0) { + if (var_v0_2 == 0) { return 0; } - temp_f0_4 = ((temp_v1->unk1C * arg2) + (temp_v1->unk20 * arg3) + (temp_v1->unk24 * arg4) + temp_v1->unk28) - arg1; - if (phi_f18 < temp_f0_4) { - if (temp_f0_4 < arg0->unkC) { - arg0->unk0 = 1; - arg0->unk6 = arg5; - arg0->unkC = temp_f0_4; - arg0->unk18 = temp_v1->unk1C; - arg0->unk1C = temp_v1->unk20; - arg0->unk20 = temp_v1->unk24; + temp_f0_4 = ((temp_v1->height * arg2) + (temp_v1->gravity * arg3) + (temp_v1->rotation * arg4) + temp_v1->height2) - arg1; + if (temp_f0_4 > 0.0f) { + if (temp_f0_4 < arg0->unk3C[0]) { + arg0->unk30 = 1; + arg0->unk36 = arg5; + arg0->unk3C[0] = temp_f0_4; + arg0->unk48[0] = temp_v1->height; + arg0->unk48[1] = temp_v1->gravity; + arg0->unk48[2] = temp_v1->rotation; } return 0; } - phi_v0_2 = 0; + var_v0 = 0; if (temp_f0_4 > -16.0f) { - arg0->unk0 = 1; - arg0->unk6 = arg5; - arg0->unkC = temp_f0_4; - arg0->unk18 = temp_v1->unk1C; - arg0->unk1C = temp_v1->unk20; - arg0->unk20 = temp_v1->unk24; - } - return phi_v0_2; + arg0->unk30 = 1; + arg0->unk36 = arg5; + arg0->unk3C[0] = temp_f0_4; + var_v0 = 1; + arg0->unk48[0] = temp_v1->height; + arg0->unk48[1] = temp_v1->gravity; + arg0->unk48[2] = temp_v1->rotation; + } + return var_v0; } #else GLOBAL_ASM("asm/non_matchings/memory/func_802AB288.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_802AB6C4(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) { +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +s32 func_802AB6C4(UnkActorInner *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) { f32 sp68; f32 sp64; f32 sp38; @@ -1904,6 +1885,9 @@ s32 func_802AB6C4(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) f32 sp10; f32 spC; f32 sp8; + Vtx *temp_a0; + Vtx *temp_a2; + Vtx *temp_a3; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_3; @@ -1920,53 +1904,47 @@ s32 func_802AB6C4(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) f32 temp_f2_3; f32 temp_f4; f32 temp_f6; - void *temp_a0; - void *temp_a2; - void *temp_a3; - void *temp_v1; - s32 phi_v0; - f32 phi_f18; - s32 phi_v0_2; + mk64_surface_map_ram *temp_v1; + s32 var_v0; + s32 var_v0_2; - temp_v1 = (arg5 * 0x2C) + D_8015F580; - phi_v0 = 1; - phi_v0_2 = 1; - if (arg4 < temp_v1->unk8) { + temp_v1 = &D_8015F580[arg5]; + var_v0_2 = 1; + if (arg4 < (f32) temp_v1->vtx3[2]) { return 0; } - if (temp_v1->unkE < arg4) { + if ((f32) temp_v1->vtx2[2] < arg4) { return 0; } - if (temp_v1->unkC < arg3) { + if ((f32) temp_v1->vtx2[1] < arg3) { return 0; } - if (arg3 < temp_v1->unk6) { + if (arg3 < (f32) temp_v1->vtx3[1]) { return 0; } temp_f0 = arg1 * 3.0f; - if (arg2 < (temp_v1->unk4 - temp_f0)) { + if (arg2 < ((f32) temp_v1->vtx3[0] - temp_f0)) { return 0; } - arg3 = arg3; - if ((temp_v1->unkA + temp_f0) < arg2) { + if (((f32) temp_v1->vtx2[0] + temp_f0) < arg2) { return 0; } - temp_a0 = temp_v1->unk10; - temp_a3 = temp_v1->unk18; - temp_a2 = temp_v1->unk14; - sp64 = temp_a3->unk4; + temp_a0 = temp_v1->vtxs[0]; + temp_a3 = temp_v1->vtxs[2]; + temp_a2 = temp_v1->vtxs[1]; + sp64 = (f32) temp_a3->v.ob[2]; sp8 = arg3; sp10 = arg4; - temp_f6 = temp_a0->unk2 - arg3; - sp68 = temp_a3->unk2; - temp_f10 = temp_a2->unk4 - arg4; + temp_f6 = (f32) temp_a0->v.ob[1] - arg3; + sp68 = (f32) temp_a3->v.ob[1]; + temp_f10 = (f32) temp_a2->v.ob[2] - arg4; sp2C = temp_f6; sp28 = temp_f10; - sp24 = temp_a0->unk4 - arg4; + sp24 = (f32) temp_a0->v.ob[2] - arg4; temp_f0_2 = temp_f6 * temp_f10; sp8 = temp_f6; spC = temp_f10; - sp20 = temp_a2->unk2 - arg3; + sp20 = (f32) temp_a2->v.ob[1] - arg3; temp_f2 = sp24 * sp20; temp_f4 = temp_f0_2 - temp_f2; sp1C = temp_f4; @@ -1975,9 +1953,8 @@ s32 func_802AB6C4(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) sp14 = arg3; temp_f0_3 = sp64 - sp10; temp_f2_2 = sp68 - arg3; - phi_f18 = 0.0f; if ((((sp20 * temp_f0_3) - (spC * temp_f2_2)) * ((temp_f2_2 * sp24) - (temp_f0_3 * sp8))) < 0.0f) { - goto block_22; + var_v0_2 = 0; } } else { temp_f2_3 = sp68 - arg3; @@ -1985,60 +1962,55 @@ s32 func_802AB6C4(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5) temp_f14 = sp28 * temp_f2_3; temp_f12 = sp20 * temp_f0_4; if (temp_f14 == temp_f12) { - phi_f18 = 0.0f; if ((sp38 * ((temp_f2_3 * sp24) - (temp_f0_4 * sp2C))) < 0.0f) { - goto block_22; + var_v0_2 = 0; } } else { temp_f16 = temp_f12 - temp_f14; if ((sp1C * temp_f16) < 0.0f) { - goto block_22; - } - temp_f14_2 = temp_f0_4 * sp2C; - temp_f12_2 = temp_f2_3 * sp24; - phi_f18 = 0.0f; - if (temp_f14_2 != temp_f12_2) { - phi_f18 = 0.0f; - if ((temp_f16 * (temp_f12_2 - temp_f14_2)) < 0.0f) { -block_22: - phi_v0 = 0; - phi_f18 = 0.0f; + var_v0_2 = 0; + } else { + temp_f14_2 = temp_f0_4 * sp2C; + temp_f12_2 = temp_f2_3 * sp24; + if ((temp_f14_2 != temp_f12_2) && ((temp_f16 * (temp_f12_2 - temp_f14_2)) < 0.0f)) { + var_v0_2 = 0; } } } } - if (phi_v0 == 0) { + if (var_v0_2 == 0) { return 0; } - temp_f0_5 = ((temp_v1->unk1C * arg2) + (temp_v1->unk20 * arg3) + (temp_v1->unk24 * arg4) + temp_v1->unk28) - arg1; - if (phi_f18 < temp_f0_5) { - if (temp_f0_5 < arg0->unk10) { - arg0->unk2 = 1; - arg0->unk8 = arg5; - arg0->unk10 = temp_f0_5; - arg0->unk24 = temp_v1->unk1C; - arg0->unk28 = temp_v1->unk20; - arg0->unk2C = temp_v1->unk24; + temp_f0_5 = ((temp_v1->height * arg2) + (temp_v1->gravity * arg3) + (temp_v1->rotation * arg4) + temp_v1->height2) - arg1; + if (temp_f0_5 > 0.0f) { + if (temp_f0_5 < arg0->unk3C[1]) { + arg0->unk32 = 1; + arg0->unk38 = arg5; + arg0->unk3C[1] = temp_f0_5; + arg0->unk54[0] = temp_v1->height; + arg0->unk54[1] = temp_v1->gravity; + arg0->unk54[2] = temp_v1->rotation; } return 0; } - phi_v0_2 = 0; + var_v0 = 0; if (temp_f0_5 > -16.0f) { - arg0->unk2 = 1; - arg0->unk8 = arg5; - arg0->unk10 = temp_f0_5; - arg0->unk24 = temp_v1->unk1C; - arg0->unk28 = temp_v1->unk20; - arg0->unk2C = temp_v1->unk24; - } - return phi_v0_2; + arg0->unk32 = 1; + arg0->unk38 = arg5; + arg0->unk3C[1] = temp_f0_5; + var_v0 = 1; + arg0->unk54[0] = temp_v1->height; + arg0->unk54[1] = temp_v1->gravity; + arg0->unk54[2] = temp_v1->rotation; + } + return var_v0; } #else GLOBAL_ASM("asm/non_matchings/memory/func_802AB6C4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c s32 func_802ABB04(f32 arg0, f32 arg1, s32 arg2) { f32 sp6C; f32 sp64; @@ -2048,6 +2020,9 @@ s32 func_802ABB04(f32 arg0, f32 arg1, s32 arg2) { f32 sp28; f32 sp20; f32 sp1C; + Vtx *temp_a0; + Vtx *temp_a1; + Vtx *temp_a3; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_3; @@ -2063,36 +2038,33 @@ s32 func_802ABB04(f32 arg0, f32 arg1, s32 arg2) { f32 temp_f2_2; f32 temp_f2_3; f32 temp_f6; - void *temp_a0; - void *temp_a1; - void *temp_a3; - void *temp_v0; - ? phi_v1; - - temp_v0 = ((arg2 & 0xFFFF) * 0x2C) + D_8015F580; - temp_a1 = temp_v0->unk14; - temp_a0 = temp_v0->unk10; - sp60 = temp_a1->unk0; - temp_f20 = temp_a0->unk4 - arg1; - sp58 = temp_a1->unk4; - temp_a3 = temp_v0->unk18; - temp_f22 = temp_a0->unk0 - arg0; - sp6C = temp_a3->unk0; + mk64_surface_map_ram *temp_v0; + s32 var_v1; + + temp_v0 = &D_8015F580[arg2 & 0xFFFF]; + temp_a1 = temp_v0->vtxs[1]; + temp_a0 = temp_v0->vtxs[0]; + var_v1 = 1; + sp60 = (f32) temp_a1->v.ob[0]; + temp_f20 = (f32) temp_a0->v.ob[2] - arg1; + sp58 = (f32) temp_a1->v.ob[2]; + temp_a3 = temp_v0->vtxs[2]; + temp_f22 = (f32) temp_a0->v.ob[0] - arg0; + sp6C = (f32) temp_a3->v.ob[0]; temp_f10 = sp60 - arg0; temp_f0 = temp_f20 * temp_f10; sp28 = temp_f10; - sp64 = temp_a3->unk4; + sp64 = (f32) temp_a3->v.ob[2]; temp_f6 = sp58 - arg1; temp_f2 = temp_f22 * temp_f6; sp20 = temp_f6; sp1C = temp_f0 - temp_f2; sp3C = sp1C; - phi_v1 = 1; if (temp_f2 == temp_f0) { temp_f0_2 = sp6C - arg0; temp_f2_2 = sp64 - arg1; if ((((temp_f6 * temp_f0_2) - (temp_f10 * temp_f2_2)) * ((temp_f2_2 * temp_f22) - (temp_f0_2 * temp_f20))) < 0.0f) { - goto block_10; + var_v1 = 0; } } else { temp_f2_3 = sp64 - arg1; @@ -2101,22 +2073,22 @@ s32 func_802ABB04(f32 arg0, f32 arg1, s32 arg2) { temp_f16 = sp20 * temp_f0_3; if (temp_f18 == temp_f16) { if ((sp3C * ((temp_f2_3 * temp_f22) - (temp_f0_3 * temp_f20))) < 0.0f) { - goto block_10; + var_v1 = 0; } } else { temp_f12 = temp_f16 - temp_f18; if ((sp1C * temp_f12) < 0.0f) { - goto block_10; - } - temp_f16_2 = temp_f0_3 * temp_f20; - temp_f14 = temp_f2_3 * temp_f22; - if ((temp_f16_2 != temp_f14) && ((temp_f12 * (temp_f14 - temp_f16_2)) < 0.0f)) { -block_10: - phi_v1 = 0; + var_v1 = 0; + } else { + temp_f16_2 = temp_f0_3 * temp_f20; + temp_f14 = temp_f2_3 * temp_f22; + if ((temp_f16_2 != temp_f14) && ((temp_f12 * (temp_f14 - temp_f16_2)) < 0.0f)) { + var_v1 = 0; + } } } } - return phi_v1; + return var_v1; } #else GLOBAL_ASM("asm/non_matchings/memory/func_802ABB04.s") @@ -2431,8 +2403,8 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802AC22C.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_802AC760(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, f32 arg6, f32 arg7, f32 arg8) { +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +s32 func_802AC760(UnkActorInner *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, f32 arg6, f32 arg7, f32 arg8) { f32 sp6C; f32 sp64; f32 sp38; @@ -2444,6 +2416,9 @@ s32 func_802AC760(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, f32 sp10; f32 spC; f32 sp8; + Vtx *temp_a0; + Vtx *temp_a2; + Vtx *temp_a3; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_3; @@ -2464,47 +2439,43 @@ s32 func_802AC760(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, f32 temp_f2_4; f32 temp_f4; f32 temp_f6; - void *temp_a0; - void *temp_a2; - void *temp_a3; - void *temp_v1; - s32 phi_v0; + mk64_surface_map_ram *temp_v1; + s32 var_v0; - temp_v1 = (arg5 * 0x2C) + D_8015F580; - phi_v0 = 1; - if (arg2 < temp_v1->unk4) { + temp_v1 = &D_8015F580[arg5]; + var_v0 = 1; + if (arg2 < (f32) temp_v1->vtx3[0]) { return 0; } - if (arg4 < temp_v1->unk8) { + if (arg4 < (f32) temp_v1->vtx3[2]) { return 0; } - if (temp_v1->unkA < arg2) { + if ((f32) temp_v1->vtx2[0] < arg2) { return 0; } - if (temp_v1->unkE < arg4) { + if ((f32) temp_v1->vtx2[2] < arg4) { return 0; } - arg2 = arg2; - if (arg3 < (temp_v1->unk6 - (arg1 * 3.0f))) { + if (arg3 < ((f32) temp_v1->vtx3[1] - (arg1 * 3.0f))) { return 0; } - temp_a0 = temp_v1->unk10; - temp_a3 = temp_v1->unk18; - temp_a2 = temp_v1->unk14; - sp6C = temp_a3->unk0; + temp_a0 = temp_v1->vtxs[0]; + temp_a3 = temp_v1->vtxs[2]; + temp_a2 = temp_v1->vtxs[1]; + sp6C = (f32) temp_a3->v.ob[0]; sp8 = arg4; sp10 = arg2; - temp_f6 = temp_a0->unk4 - arg4; - sp64 = temp_a3->unk4; - temp_f4 = temp_a2->unk0 - arg2; + temp_f6 = (f32) temp_a0->v.ob[2] - arg4; + sp64 = (f32) temp_a3->v.ob[2]; + temp_f4 = (f32) temp_a2->v.ob[0] - arg2; sp28 = temp_f6; sp24 = temp_f4; - sp20 = temp_a0->unk0 - arg2; + sp20 = (f32) temp_a0->v.ob[0] - arg2; temp_f0 = temp_f6 * temp_f4; sp8 = temp_f6; spC = temp_f4; temp_f18 = sp8; - sp1C = temp_a2->unk4 - arg4; + sp1C = (f32) temp_a2->v.ob[2] - arg4; temp_f2 = sp20 * sp1C; temp_f10 = temp_f0 - temp_f2; sp18 = temp_f10; @@ -2514,7 +2485,7 @@ s32 func_802AC760(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, temp_f0_2 = sp6C - sp10; temp_f2_2 = sp64 - arg4; if ((((sp1C * temp_f0_2) - (spC * temp_f2_2)) * ((temp_f2_2 * sp20) - (temp_f0_2 * temp_f18))) < 0.0f) { - goto block_20; + var_v0 = 0; } } else { temp_f2_3 = sp64 - arg4; @@ -2523,49 +2494,49 @@ s32 func_802AC760(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, temp_f12 = sp1C * temp_f0_3; if (temp_f14 == temp_f12) { if ((sp38 * ((temp_f2_3 * sp20) - (temp_f0_3 * sp28))) < 0.0f) { - goto block_20; + var_v0 = 0; } } else { temp_f16 = temp_f12 - temp_f14; if ((sp18 * temp_f16) < 0.0f) { - goto block_20; - } - temp_f14_2 = temp_f0_3 * sp28; - temp_f12_2 = temp_f2_3 * sp20; - if ((temp_f14_2 != temp_f12_2) && ((temp_f16 * (temp_f12_2 - temp_f14_2)) < 0.0f)) { -block_20: - phi_v0 = 0; + var_v0 = 0; + } else { + temp_f14_2 = temp_f0_3 * sp28; + temp_f12_2 = temp_f2_3 * sp20; + if ((temp_f14_2 != temp_f12_2) && ((temp_f16 * (temp_f12_2 - temp_f14_2)) < 0.0f)) { + var_v0 = 0; + } } } } - if (phi_v0 == 0) { + if (var_v0 == 0) { return 0; } - temp_f2_4 = temp_v1->unk1C; - temp_f12_3 = temp_v1->unk20; - temp_f14_3 = temp_v1->unk24; - temp_f16_2 = temp_v1->unk28; + temp_f2_4 = temp_v1->height; + temp_f12_3 = temp_v1->gravity; + temp_f14_3 = temp_v1->rotation; + temp_f16_2 = temp_v1->height2; temp_f0_4 = (temp_f2_4 * arg2) + (temp_f12_3 * arg3) + (temp_f14_3 * arg4) + temp_f16_2; if (arg1 < temp_f0_4) { - if (temp_f0_4 < arg0->unk14) { - arg0->unk4 = 1; - arg0->unkA = arg5; - arg0->unk14 = temp_f0_4 - arg1; - arg0->unk30 = temp_v1->unk1C; - arg0->unk34 = temp_v1->unk20; - arg0->unk38 = temp_v1->unk24; + if (temp_f0_4 < arg0->unk3C[2]) { + arg0->unk34 = 1; + arg0->unk3A = arg5; + arg0->unk3C[2] = temp_f0_4 - arg1; + arg0->unk60[0] = temp_v1->height; + arg0->unk60[1] = temp_v1->gravity; + arg0->unk60[2] = temp_v1->rotation; } return 0; } if (((temp_f2_4 * arg6) + (temp_f12_3 * arg7) + (temp_f14_3 * arg8) + temp_f16_2) < 0.0f) { return 0; } - arg0->unk4 = 1; - arg0->unkA = arg5; - arg0->unk14 = temp_f0_4 - arg1; - arg0->unk30 = temp_v1->unk1C; - arg0->unk34 = temp_v1->unk20; - arg0->unk38 = temp_v1->unk24; + arg0->unk34 = 1; + arg0->unk3A = arg5; + arg0->unk3C[2] = temp_f0_4 - arg1; + arg0->unk60[0] = temp_v1->height; + arg0->unk60[1] = temp_v1->gravity; + arg0->unk60[2] = temp_v1->rotation; return 1; } #else @@ -2573,8 +2544,8 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802AC760.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_802ACBA4(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, f32 arg6, f32 arg7, f32 arg8) { +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +s32 func_802ACBA4(UnkActorInner *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, f32 arg6, f32 arg7, f32 arg8) { f32 sp70; f32 sp6C; f32 sp48; @@ -2588,6 +2559,9 @@ s32 func_802ACBA4(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, f32 sp10; f32 spC; f32 sp8; + Vtx *temp_a0; + Vtx *temp_a2; + Vtx *temp_a3; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_3; @@ -2611,53 +2585,47 @@ s32 func_802ACBA4(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, f32 temp_f4_2; f32 temp_f6; f32 temp_f8; - void *temp_a0; - void *temp_a2; - void *temp_a3; - void *temp_v1; - s32 phi_v0; - f32 phi_f18; - f32 phi_f10; + f32 var_f10; + mk64_surface_map_ram *temp_v1; + s32 var_v0; - temp_v1 = (arg5 * 0x2C) + D_8015F580; - phi_v0 = 1; - if (arg2 < temp_v1->unk4) { + temp_v1 = &D_8015F580[arg5]; + var_v0 = 1; + if (arg2 < (f32) temp_v1->vtx3[0]) { return 0; } - if (temp_v1->unkA < arg2) { + if ((f32) temp_v1->vtx2[0] < arg2) { return 0; } - if (temp_v1->unkC < arg3) { + if ((f32) temp_v1->vtx2[1] < arg3) { return 0; } - if (arg3 < temp_v1->unk6) { + if (arg3 < (f32) temp_v1->vtx3[1]) { return 0; } temp_f2 = arg1 * 3.0f; - if (arg4 < (temp_v1->unk8 - temp_f2)) { + if (arg4 < ((f32) temp_v1->vtx3[2] - temp_f2)) { return 0; } - arg2 = arg2; - arg3 = arg3; - if ((temp_v1->unkE + temp_f2) < arg4) { + if (((f32) temp_v1->vtx2[2] + temp_f2) < arg4) { return 0; } - temp_a0 = temp_v1->unk10; - temp_a3 = temp_v1->unk18; - temp_a2 = temp_v1->unk14; - sp70 = temp_a3->unk0; + temp_a0 = temp_v1->vtxs[0]; + temp_a3 = temp_v1->vtxs[2]; + temp_a2 = temp_v1->vtxs[1]; + sp70 = (f32) temp_a3->v.ob[0]; sp8 = arg3; sp10 = arg2; - temp_f10 = temp_a0->unk2 - arg3; - sp6C = temp_a3->unk2; - temp_f6 = temp_a2->unk0 - arg2; + temp_f10 = (f32) temp_a0->v.ob[1] - arg3; + sp6C = (f32) temp_a3->v.ob[1]; + temp_f6 = (f32) temp_a2->v.ob[0] - arg2; sp2C = temp_f10; sp28 = temp_f6; - sp24 = temp_a0->unk0 - arg2; + sp24 = (f32) temp_a0->v.ob[0] - arg2; temp_f0 = temp_f10 * temp_f6; sp8 = temp_f10; spC = temp_f6; - sp20 = temp_a2->unk2 - arg3; + sp20 = (f32) temp_a2->v.ob[1] - arg3; temp_f2_2 = sp24 * sp20; temp_f4 = temp_f0 - temp_f2_2; sp1C = temp_f4; @@ -2666,9 +2634,8 @@ s32 func_802ACBA4(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, sp14 = arg3; temp_f0_2 = sp70 - sp10; temp_f2_3 = sp6C - arg3; - phi_f18 = 0.0f; if ((((sp20 * temp_f0_2) - (spC * temp_f2_3)) * ((temp_f2_3 * sp24) - (temp_f0_2 * sp8))) < 0.0f) { - goto block_22; + var_v0 = 0; } } else { temp_f2_4 = sp6C - arg3; @@ -2676,126 +2643,122 @@ s32 func_802ACBA4(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, temp_f14 = sp28 * temp_f2_4; temp_f12 = sp20 * temp_f0_3; if (temp_f14 == temp_f12) { - phi_f18 = 0.0f; if ((sp3C * ((temp_f2_4 * sp24) - (temp_f0_3 * sp2C))) < 0.0f) { - goto block_22; + var_v0 = 0; } } else { temp_f16 = temp_f12 - temp_f14; if ((sp1C * temp_f16) < 0.0f) { - goto block_22; - } - temp_f14_2 = temp_f0_3 * sp2C; - temp_f12_2 = temp_f2_4 * sp24; - phi_f18 = 0.0f; - if (temp_f14_2 != temp_f12_2) { - phi_f18 = 0.0f; - if ((temp_f16 * (temp_f12_2 - temp_f14_2)) < 0.0f) { -block_22: - phi_v0 = 0; - phi_f18 = 0.0f; + var_v0 = 0; + } else { + temp_f14_2 = temp_f0_3 * sp2C; + temp_f12_2 = temp_f2_4 * sp24; + if ((temp_f14_2 != temp_f12_2) && ((temp_f16 * (temp_f12_2 - temp_f14_2)) < 0.0f)) { + var_v0 = 0; } } } } - if (phi_v0 == 0) { + if (var_v0 == 0) { return 0; } - temp_f2_5 = temp_v1->unk1C; - temp_f12_3 = temp_v1->unk20; - temp_f14_3 = temp_v1->unk24; - temp_f16_2 = temp_v1->unk28; + temp_f2_5 = temp_v1->height; + temp_f12_3 = temp_v1->gravity; + temp_f14_3 = temp_v1->rotation; + temp_f16_2 = temp_v1->height2; temp_f0_4 = (temp_f2_5 * arg2) + (temp_f12_3 * arg3) + (temp_f14_3 * arg4) + temp_f16_2; - if ((temp_v1->unk0 & 0x200) != 0) { + if (temp_v1->flags & 0x200) { temp_f4_2 = (temp_f2_5 * arg6) + (temp_f12_3 * arg7) + (temp_f14_3 * arg8) + temp_f16_2; sp48 = temp_f4_2; - if ((phi_f18 < temp_f0_4) && (phi_f18 < temp_f4_2)) { + if ((temp_f0_4 > 0.0f) && (temp_f4_2 > 0.0f)) { if (temp_f0_4 < arg1) { - arg0->unk0 = 1; - arg0->unk6 = arg5; - arg0->unkC = temp_f0_4 - arg1; - arg0->unk18 = temp_v1->unk1C; - arg0->unk1C = temp_v1->unk20; - arg0->unk20 = temp_v1->unk24; + arg0->unk30 = 1; + arg0->unk36 = arg5; + arg0->unk3C[0] = temp_f0_4 - arg1; + arg0->unk48[0] = temp_v1->height; + arg0->unk48[1] = temp_v1->gravity; + arg0->unk48[2] = temp_v1->rotation; return 1; } return 0; } - if ((temp_f0_4 < phi_f18) && (sp48 < phi_f18)) { + if ((temp_f0_4 < 0.0f) && (sp48 < 0.0f)) { temp_f0_5 = temp_f0_4 * -1.0f; if (temp_f0_5 < arg1) { - arg0->unk0 = 1; - arg0->unk6 = arg5; - arg0->unkC = temp_f0_5 - arg1; - arg0->unk18 = -temp_v1->unk1C; - arg0->unk1C = -temp_v1->unk20; - arg0->unk20 = -temp_v1->unk24; + arg0->unk30 = 1; + arg0->unk36 = arg5; + arg0->unk3C[0] = temp_f0_5 - arg1; + arg0->unk48[0] = -temp_v1->height; + arg0->unk48[1] = -temp_v1->gravity; + arg0->unk48[2] = -temp_v1->rotation; return 1; } return 0; } - if ((phi_f18 < temp_f0_4) && (sp48 < phi_f18)) { - arg0->unk0 = 1; - arg0->unk6 = arg5; - arg0->unkC = -(temp_f0_4 + arg1); - arg0->unk18 = -temp_v1->unk1C; - arg0->unk1C = -temp_v1->unk20; - phi_f10 = -temp_v1->unk24; - goto block_54; + if ((temp_f0_4 > 0.0f) && (sp48 < 0.0f)) { + arg0->unk30 = 1; + arg0->unk36 = arg5; + arg0->unk3C[0] = -(temp_f0_4 + arg1); + arg0->unk48[0] = -temp_v1->height; + arg0->unk48[1] = -temp_v1->gravity; + var_f10 = -temp_v1->rotation; + arg0->unk48[2] = var_f10; + return 1; } - if ((temp_f0_4 < phi_f18) && (phi_f18 < sp48)) { - arg0->unk0 = 1; - arg0->unk6 = arg5; - arg0->unkC = temp_f0_4 + arg1; - arg0->unk18 = temp_v1->unk1C; - arg0->unk1C = temp_v1->unk20; - arg0->unk20 = temp_v1->unk24; + if ((temp_f0_4 < 0.0f) && (sp48 > 0.0f)) { + arg0->unk30 = 1; + arg0->unk36 = arg5; + arg0->unk3C[0] = temp_f0_4 + arg1; + arg0->unk48[0] = temp_v1->height; + arg0->unk48[1] = temp_v1->gravity; + arg0->unk48[2] = temp_v1->rotation; return 1; } - if (temp_f0_4 == phi_f18) { - if (phi_f18 <= sp48) { - arg0->unk0 = 1; - arg0->unk6 = arg5; - arg0->unkC = sp48 + arg1; - arg0->unk18 = temp_v1->unk1C; - arg0->unk1C = temp_v1->unk20; - arg0->unk20 = temp_v1->unk24; + if (temp_f0_4 == 0.0f) { + if (sp48 >= 0.0f) { + arg0->unk30 = 1; + arg0->unk36 = arg5; + arg0->unk3C[0] = sp48 + arg1; + arg0->unk48[0] = temp_v1->height; + arg0->unk48[1] = temp_v1->gravity; + arg0->unk48[2] = temp_v1->rotation; return 1; } - arg0->unk0 = 1; - arg0->unk6 = arg5; - arg0->unkC = -(sp48 + arg1); - arg0->unk18 = temp_v1->unk1C; - arg0->unk1C = temp_v1->unk20; - phi_f10 = temp_v1->unk24; - goto block_54; + arg0->unk30 = 1; + arg0->unk36 = arg5; + arg0->unk3C[0] = -(sp48 + arg1); + arg0->unk48[0] = temp_v1->height; + arg0->unk48[1] = temp_v1->gravity; + var_f10 = temp_v1->rotation; + arg0->unk48[2] = var_f10; + return 1; } return 0; } if (arg1 < temp_f0_4) { - if (temp_f0_4 < arg0->unkC) { - arg0->unk0 = 1; - arg0->unk6 = arg5; - arg0->unkC = temp_f0_4 - arg1; - arg0->unk18 = temp_v1->unk1C; - arg0->unk1C = temp_v1->unk20; - arg0->unk20 = temp_v1->unk24; + if (temp_f0_4 < arg0->unk3C[0]) { + arg0->unk30 = 1; + arg0->unk36 = arg5; + arg0->unk3C[0] = temp_f0_4 - arg1; + arg0->unk48[0] = temp_v1->height; + arg0->unk48[1] = temp_v1->gravity; + arg0->unk48[2] = temp_v1->rotation; } return 0; } temp_f8 = (temp_f2_5 * arg6) + (temp_f12_3 * arg7) + (temp_f14_3 * arg8) + temp_f16_2; sp48 = temp_f8; - if (temp_f8 < phi_f18) { + if (temp_f8 < 0.0f) { return 0; } - arg0->unk0 = 1; - arg0->unk6 = arg5; - arg0->unkC = temp_f0_4 - arg1; - arg0->unk18 = temp_v1->unk1C; - arg0->unk1C = temp_v1->unk20; - phi_f10 = temp_v1->unk24; + arg0->unk30 = 1; + arg0->unk36 = arg5; + arg0->unk3C[0] = temp_f0_4 - arg1; + arg0->unk48[0] = temp_v1->height; + arg0->unk48[1] = temp_v1->gravity; + var_f10 = temp_v1->rotation; block_54: - arg0->unk20 = phi_f10; + arg0->unk48[2] = var_f10; return 1; } #else @@ -2803,8 +2766,8 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802ACBA4.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -s32 func_802AD278(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, f32 arg6, f32 arg7, f32 arg8) { +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c +s32 func_802AD278(UnkActorInner *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, f32 arg6, f32 arg7, f32 arg8) { f32 sp68; f32 sp64; f32 sp44; @@ -2818,6 +2781,9 @@ s32 func_802AD278(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, f32 sp10; f32 spC; f32 sp8; + Vtx *temp_a0; + Vtx *temp_a2; + Vtx *temp_a3; f32 temp_f0; f32 temp_f0_2; f32 temp_f0_3; @@ -2841,52 +2807,47 @@ s32 func_802AD278(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, f32 temp_f4; f32 temp_f6; f32 temp_f8; - void *temp_a0; - void *temp_a2; - void *temp_a3; - void *temp_v1; - s32 phi_v0; - f32 phi_f18; - f32 phi_f8; + f32 var_f8; + mk64_surface_map_ram *temp_v1; + s32 var_v0; - temp_v1 = (arg5 * 0x2C) + D_8015F580; - phi_v0 = 1; - if (arg4 < temp_v1->unk8) { + temp_v1 = &D_8015F580[arg5]; + var_v0 = 1; + if (arg4 < (f32) temp_v1->vtx3[2]) { return 0; } - if (temp_v1->unkE < arg4) { + if ((f32) temp_v1->vtx2[2] < arg4) { return 0; } - if (temp_v1->unkC < arg3) { + if ((f32) temp_v1->vtx2[1] < arg3) { return 0; } - if (arg3 < temp_v1->unk6) { + if (arg3 < (f32) temp_v1->vtx3[1]) { return 0; } temp_f0 = arg1 * 3.0f; - if (arg2 < (temp_v1->unk4 - temp_f0)) { + if (arg2 < ((f32) temp_v1->vtx3[0] - temp_f0)) { return 0; } - arg3 = arg3; - if ((temp_v1->unkA + temp_f0) < arg2) { + if (((f32) temp_v1->vtx2[0] + temp_f0) < arg2) { return 0; } - temp_a0 = temp_v1->unk10; - temp_a3 = temp_v1->unk18; - temp_a2 = temp_v1->unk14; - sp64 = temp_a3->unk4; + temp_a0 = temp_v1->vtxs[0]; + temp_a3 = temp_v1->vtxs[2]; + temp_a2 = temp_v1->vtxs[1]; + sp64 = (f32) temp_a3->v.ob[2]; sp8 = arg3; sp10 = arg4; - temp_f8 = temp_a0->unk2 - arg3; - sp68 = temp_a3->unk2; - temp_f6 = temp_a2->unk4 - arg4; + temp_f8 = (f32) temp_a0->v.ob[1] - arg3; + sp68 = (f32) temp_a3->v.ob[1]; + temp_f6 = (f32) temp_a2->v.ob[2] - arg4; sp2C = temp_f8; sp28 = temp_f6; - sp24 = temp_a0->unk4 - arg4; + sp24 = (f32) temp_a0->v.ob[2] - arg4; temp_f0_2 = temp_f8 * temp_f6; sp8 = temp_f8; spC = temp_f6; - sp20 = temp_a2->unk2 - arg3; + sp20 = (f32) temp_a2->v.ob[1] - arg3; temp_f2 = sp24 * sp20; temp_f10 = temp_f0_2 - temp_f2; sp1C = temp_f10; @@ -2895,9 +2856,8 @@ s32 func_802AD278(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, sp14 = arg3; temp_f0_3 = sp64 - sp10; temp_f2_2 = sp68 - arg3; - phi_f18 = 0.0f; if ((((sp20 * temp_f0_3) - (spC * temp_f2_2)) * ((temp_f2_2 * sp24) - (temp_f0_3 * sp8))) < 0.0f) { - goto block_22; + var_v0 = 0; } } else { temp_f2_3 = sp68 - arg3; @@ -2905,126 +2865,121 @@ s32 func_802AD278(void *arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, u16 arg5, temp_f14 = sp28 * temp_f2_3; temp_f12 = sp20 * temp_f0_4; if (temp_f14 == temp_f12) { - phi_f18 = 0.0f; if ((sp38 * ((temp_f2_3 * sp24) - (temp_f0_4 * sp2C))) < 0.0f) { - goto block_22; + var_v0 = 0; } } else { temp_f16 = temp_f12 - temp_f14; if ((sp1C * temp_f16) < 0.0f) { - goto block_22; - } - temp_f14_2 = temp_f0_4 * sp2C; - temp_f12_2 = temp_f2_3 * sp24; - phi_f18 = 0.0f; - if (temp_f14_2 != temp_f12_2) { - phi_f18 = 0.0f; - if ((temp_f16 * (temp_f12_2 - temp_f14_2)) < 0.0f) { -block_22: - phi_v0 = 0; - phi_f18 = 0.0f; + var_v0 = 0; + } else { + temp_f14_2 = temp_f0_4 * sp2C; + temp_f12_2 = temp_f2_3 * sp24; + if ((temp_f14_2 != temp_f12_2) && ((temp_f16 * (temp_f12_2 - temp_f14_2)) < 0.0f)) { + var_v0 = 0; } } } } - if (phi_v0 == 0) { + if (var_v0 == 0) { return 0; } - temp_f2_4 = temp_v1->unk1C; - temp_f12_3 = temp_v1->unk20; - temp_f14_3 = temp_v1->unk24; - temp_f16_2 = temp_v1->unk28; + temp_f2_4 = temp_v1->height; + temp_f12_3 = temp_v1->gravity; + temp_f14_3 = temp_v1->rotation; + temp_f16_2 = temp_v1->height2; temp_f0_5 = (temp_f2_4 * arg2) + (temp_f12_3 * arg3) + (temp_f14_3 * arg4) + temp_f16_2; - if ((temp_v1->unk0 & 0x200) != 0) { + if (temp_v1->flags & 0x200) { temp_f10_2 = (temp_f2_4 * arg6) + (temp_f12_3 * arg7) + (temp_f14_3 * arg8) + temp_f16_2; sp44 = temp_f10_2; - if ((phi_f18 < temp_f0_5) && (phi_f18 < temp_f10_2)) { + if ((temp_f0_5 > 0.0f) && (temp_f10_2 > 0.0f)) { if (temp_f0_5 < arg1) { - arg0->unk2 = 1; - arg0->unk8 = arg5; - arg0->unk10 = temp_f0_5 - arg1; - arg0->unk24 = temp_v1->unk1C; - arg0->unk28 = temp_v1->unk20; - arg0->unk2C = temp_v1->unk24; + arg0->unk32 = 1; + arg0->unk38 = arg5; + arg0->unk3C[1] = temp_f0_5 - arg1; + arg0->unk54[0] = temp_v1->height; + arg0->unk54[1] = temp_v1->gravity; + arg0->unk54[2] = temp_v1->rotation; return 1; } return 0; } - if ((temp_f0_5 < phi_f18) && (sp44 < phi_f18)) { + if ((temp_f0_5 < 0.0f) && (sp44 < 0.0f)) { temp_f0_6 = temp_f0_5 * -1.0f; if (temp_f0_6 < arg1) { - arg0->unk2 = 1; - arg0->unk8 = arg5; - arg0->unk10 = temp_f0_6 - arg1; - arg0->unk24 = -temp_v1->unk1C; - arg0->unk28 = -temp_v1->unk20; - arg0->unk2C = -temp_v1->unk24; + arg0->unk32 = 1; + arg0->unk38 = arg5; + arg0->unk3C[1] = temp_f0_6 - arg1; + arg0->unk54[0] = -temp_v1->height; + arg0->unk54[1] = -temp_v1->gravity; + arg0->unk54[2] = -temp_v1->rotation; return 1; } return 0; } - if ((phi_f18 < temp_f0_5) && (sp44 < phi_f18)) { - arg0->unk2 = 1; - arg0->unk8 = arg5; - arg0->unk10 = -(temp_f0_5 + arg1); - arg0->unk24 = -temp_v1->unk1C; - arg0->unk28 = -temp_v1->unk20; - phi_f8 = -temp_v1->unk24; - goto block_54; + if ((temp_f0_5 > 0.0f) && (sp44 < 0.0f)) { + arg0->unk32 = 1; + arg0->unk38 = arg5; + arg0->unk3C[1] = -(temp_f0_5 + arg1); + arg0->unk54[0] = -temp_v1->height; + arg0->unk54[1] = -temp_v1->gravity; + var_f8 = -temp_v1->rotation; + arg0->unk54[2] = var_f8; + return 1; } - if ((temp_f0_5 < phi_f18) && (phi_f18 < sp44)) { - arg0->unk2 = 1; - arg0->unk8 = arg5; - arg0->unk10 = temp_f0_5 + arg1; - arg0->unk24 = temp_v1->unk1C; - arg0->unk28 = temp_v1->unk20; - arg0->unk2C = temp_v1->unk24; + if ((temp_f0_5 < 0.0f) && (sp44 > 0.0f)) { + arg0->unk32 = 1; + arg0->unk38 = arg5; + arg0->unk3C[1] = temp_f0_5 + arg1; + arg0->unk54[0] = temp_v1->height; + arg0->unk54[1] = temp_v1->gravity; + arg0->unk54[2] = temp_v1->rotation; return 1; } - if (temp_f0_5 == phi_f18) { - if (phi_f18 <= sp44) { - arg0->unk2 = 1; - arg0->unk8 = arg5; - arg0->unk10 = sp44 + arg1; - arg0->unk24 = temp_v1->unk1C; - arg0->unk28 = temp_v1->unk20; - arg0->unk2C = temp_v1->unk24; + if (temp_f0_5 == 0.0f) { + if (sp44 >= 0.0f) { + arg0->unk32 = 1; + arg0->unk38 = arg5; + arg0->unk3C[1] = sp44 + arg1; + arg0->unk54[0] = temp_v1->height; + arg0->unk54[1] = temp_v1->gravity; + arg0->unk54[2] = temp_v1->rotation; return 1; } - arg0->unk2 = 1; - arg0->unk8 = arg5; - arg0->unk10 = -(sp44 + arg1); - arg0->unk24 = temp_v1->unk1C; - arg0->unk28 = temp_v1->unk20; - phi_f8 = temp_v1->unk24; - goto block_54; + arg0->unk32 = 1; + arg0->unk38 = arg5; + arg0->unk3C[1] = -(sp44 + arg1); + arg0->unk54[0] = temp_v1->height; + arg0->unk54[1] = temp_v1->gravity; + var_f8 = temp_v1->rotation; + arg0->unk54[2] = var_f8; + return 1; } return 0; } if (arg1 < temp_f0_5) { - if (temp_f0_5 < arg0->unk10) { - arg0->unk2 = 1; - arg0->unk8 = arg5; - arg0->unk10 = temp_f0_5 - arg1; - arg0->unk24 = temp_v1->unk1C; - arg0->unk28 = temp_v1->unk20; - arg0->unk2C = temp_v1->unk24; + if (temp_f0_5 < arg0->unk3C[1]) { + arg0->unk32 = 1; + arg0->unk38 = arg5; + arg0->unk3C[1] = temp_f0_5 - arg1; + arg0->unk54[0] = temp_v1->height; + arg0->unk54[1] = temp_v1->gravity; + arg0->unk54[2] = temp_v1->rotation; } return 0; } temp_f4 = (temp_f2_4 * arg6) + (temp_f12_3 * arg7) + (temp_f14_3 * arg8) + temp_f16_2; sp44 = temp_f4; - if (temp_f4 < phi_f18) { + if (temp_f4 < 0.0f) { return 0; } - arg0->unk2 = 1; - arg0->unk8 = arg5; - arg0->unk10 = temp_f0_5 - arg1; - arg0->unk24 = temp_v1->unk1C; - arg0->unk28 = temp_v1->unk20; - phi_f8 = temp_v1->unk24; -block_54: - arg0->unk2C = phi_f8; + arg0->unk32 = 1; + arg0->unk38 = arg5; + arg0->unk3C[1] = temp_f0_5 - arg1; + arg0->unk54[0] = temp_v1->height; + arg0->unk54[1] = temp_v1->gravity; + var_f8 = temp_v1->rotation; + arg0->unk54[2] = var_f8; return 1; } #else @@ -3355,14 +3310,12 @@ GLOBAL_ASM("asm/non_matchings/memory/func_802AE1C0.s") #endif #ifdef MIPS_TO_C -//generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda +//generated by m2c commit 0927f17aac197848d4ebdf0c6bbad74b01f0851c extern s32 D_8015F59C; extern s32 D_8015F5A0; extern s32 D_8015F5A4; extern s16 D_8015F6E8; extern s16 D_8015F6EA; -extern s16 D_8015F6EC; -extern s16 D_8015F6EE; extern s16 D_8015F6F0; extern s16 D_8015F6F2; extern s16 D_8015F6FA; @@ -3405,35 +3358,31 @@ void func_802AE434(Vtx *arg0, Vtx *arg1, Vtx *arg2, s8 arg3, u16 arg4) { f64 temp_f4; f64 temp_f8; mk64_surface_map_ram *temp_t0; - s16 temp_a0; - s16 temp_a1; - s16 temp_t3; - s16 temp_t4; - s32 temp_a0_2; - s32 temp_a1_2; + s16 var_a0; + s16 var_a1; + s16 var_a2; + s16 var_a3; + s16 var_t1; + s16 var_t2; + s16 var_t3; + s16 var_t4; + s16 var_t5; + s16 var_v0; + s16 var_v1; + s32 temp_a0; + s32 temp_a1; s32 temp_a2; s32 temp_a3; s32 temp_v0; s32 temp_v1; - u16 temp_a0_3; + u16 temp_a0_2; u16 temp_a3_2; u16 temp_v1_2; - s32 phi_a0; - s32 phi_t3; - s32 phi_t5; - s32 phi_a1; - s32 phi_t4; - s32 phi_v1; - s32 phi_a2; - s32 phi_a3; - s32 phi_v0; - s16 phi_t1; - s16 phi_t2; - u16 phi_a1_2; - u16 phi_t9; - u16 phi_t8; + u16 var_a1_2; + u16 var_t8; + u16 var_t9; - temp_t0 = &(*D_8015F580)[D_8015F588]; + temp_t0 = &D_8015F580[D_8015F588]; temp_t0->vtxs[0] = arg0; temp_t0->vtxs[1] = arg1; temp_t0->vtxs[2] = arg2; @@ -3442,151 +3391,148 @@ void func_802AE434(Vtx *arg0, Vtx *arg1, Vtx *arg2, s8 arg3, u16 arg4) { sp1C = temp_t6; temp_t1 = temp_t0->vtxs[1]; temp_t2 = temp_t0->vtxs[2]; - temp_a0 = temp_t6->v.ob[0]; - temp_t3 = temp_t1->v.ob[0]; - temp_a1 = temp_t6->v.ob[2]; - temp_t4 = temp_t1->v.ob[2]; - phi_a0 = (s32) temp_a0; - phi_t3 = (s32) temp_t3; - phi_t5 = (s32) temp_t2->v.ob[0]; - phi_a1 = (s32) temp_a1; - phi_t4 = (s32) temp_t4; - phi_v1 = (s32) temp_t2->v.ob[2]; - phi_a2 = (s32) temp_t6->v.ob[1]; - phi_a3 = (s32) temp_t1->v.ob[1]; - phi_v0 = (s32) temp_t2->v.ob[1]; - if ((temp_a0 == temp_t3) && (temp_a1 == temp_t4)) { + var_a0 = temp_t6->v.ob[0]; + var_t3 = temp_t1->v.ob[0]; + var_a2 = temp_t6->v.ob[1]; + var_a1 = temp_t6->v.ob[2]; + var_a3 = temp_t1->v.ob[1]; + var_t4 = temp_t1->v.ob[2]; + var_t5 = temp_t2->v.ob[0]; + var_v0 = temp_t2->v.ob[1]; + var_v1 = temp_t2->v.ob[2]; + if ((var_a0 == var_t3) && (var_a1 == var_t4)) { temp_t0->vtxs[2] = arg1; temp_t0->vtxs[1] = arg2; - phi_a0 = (s32) arg0->v.ob[0]; - phi_t3 = (s32) arg1->v.ob[0]; - phi_t5 = (s32) arg2->v.ob[0]; - phi_a1 = (s32) arg0->v.ob[2]; - phi_t4 = (s32) arg1->v.ob[2]; - phi_v1 = (s32) arg2->v.ob[2]; - phi_a2 = (s32) arg0->v.ob[1]; - phi_a3 = (s32) arg1->v.ob[1]; - phi_v0 = (s32) arg2->v.ob[1]; + var_a0 = arg0->v.ob[0]; + var_a2 = arg0->v.ob[1]; + var_a1 = arg0->v.ob[2]; + var_t3 = arg1->v.ob[0]; + var_a3 = arg1->v.ob[1]; + var_t4 = arg1->v.ob[2]; + var_t5 = arg2->v.ob[0]; + var_v0 = arg2->v.ob[1]; + var_v1 = arg2->v.ob[2]; } - if (phi_a0 >= phi_t3) { - if (phi_a0 >= phi_t5) { - sp4A = (s16) phi_a0; + if (var_a0 >= var_t3) { + if (var_a0 >= var_t5) { + sp4A = var_a0; } else { goto block_12; } - } else if (phi_t3 >= phi_t5) { - sp4A = (s16) phi_t3; + } else if (var_t3 >= var_t5) { + sp4A = var_t3; } else { block_12: - sp4A = (s16) phi_t5; + sp4A = var_t5; } - if (phi_a1 >= phi_t4) { - if (phi_a1 >= phi_v1) { - sp48 = (s16) phi_a1; + if (var_a1 >= var_t4) { + if (var_a1 >= var_v1) { + sp48 = var_a1; } else { goto block_19; } - } else if (phi_t4 >= phi_v1) { - sp48 = (s16) phi_t4; + } else if (var_t4 >= var_v1) { + sp48 = var_t4; } else { block_19: - sp48 = (s16) phi_v1; + sp48 = var_v1; } - if (phi_a2 >= phi_a3) { - if (phi_a2 >= phi_v0) { - sp42 = (s16) phi_a2; + if (var_a2 >= var_a3) { + if (var_a2 >= var_v0) { + sp42 = var_a2; } else { goto block_26; } - } else if (phi_a3 >= phi_v0) { - sp42 = (s16) phi_a3; + } else if (var_a3 >= var_v0) { + sp42 = var_a3; } else { block_26: - sp42 = (s16) phi_v0; + sp42 = var_v0; } - if (phi_t3 >= phi_a0) { - if (phi_t5 >= phi_a0) { - sp44 = (s16) phi_a0; + if (var_t3 >= var_a0) { + if (var_t5 >= var_a0) { + sp44 = var_a0; } else { goto block_33; } - } else if (phi_t5 >= phi_t3) { - sp44 = (s16) phi_t3; + } else if (var_t5 >= var_t3) { + sp44 = var_t3; } else { block_33: - sp44 = (s16) phi_t5; + sp44 = var_t5; } - if (phi_a3 >= phi_a2) { - if (phi_v0 >= phi_a2) { - phi_t2 = (s16) phi_a2; + if (var_a3 >= var_a2) { + if (var_v0 >= var_a2) { + var_t2 = var_a2; } else { - phi_t2 = (s16) phi_v0; + var_t2 = var_v0; } - } else if (phi_v0 >= phi_a3) { - phi_t2 = (s16) phi_a3; + } else if (var_v0 >= var_a3) { + var_t2 = var_a3; } else { - phi_t2 = (s16) phi_v0; + var_t2 = var_v0; } - if (phi_t4 >= phi_a1) { - if (phi_v1 >= phi_a1) { - phi_t1 = (s16) phi_a1; + if (var_t4 >= var_a1) { + if (var_v1 >= var_a1) { + var_t1 = var_a1; } else { - phi_t1 = (s16) phi_v1; + var_t1 = var_v1; } - } else if (phi_v1 >= phi_t4) { - phi_t1 = (s16) phi_t4; + } else if (var_v1 >= var_t4) { + var_t1 = var_t4; } else { - phi_t1 = (s16) phi_v1; + var_t1 = var_v1; } - spAA = (s16) phi_v1; - spB8 = (s16) phi_a2; - spB2 = (s16) phi_a3; - spAC = (s16) phi_v0; + spAA = var_v1; + spB8 = var_a2; + spB2 = var_a3; + spAC = var_v0; temp_v0 = spB2 - spB8; - temp_v1 = spAA - phi_t4; - spB6 = (s16) phi_a1; - spBA = (s16) phi_a0; - temp_a0_2 = phi_t4 - spB6; - temp_a1_2 = spAC - spB2; - temp_a2 = phi_t5 - phi_t3; - temp_a3 = phi_t3 - spBA; - temp_f12 = (f64) ((temp_v0 * temp_v1) - (temp_a0_2 * temp_a1_2)); + temp_v1 = spAA - var_t4; + spB6 = var_a1; + spBA = var_a0; + temp_a0 = var_t4 - spB6; + temp_a1 = spAC - spB2; + temp_a2 = var_t5 - var_t3; + temp_a3 = var_t3 - spBA; + temp_f12 = (f64) ((temp_v0 * temp_v1) - (temp_a0 * temp_a1)); temp_f18 = temp_f12 * temp_f12; sp10 = temp_f18; - temp_f14 = (f64) ((temp_a0_2 * temp_a2) - (temp_a3 * temp_v1)); + temp_f14 = (f64) ((temp_a0 * temp_a2) - (temp_a3 * temp_v1)); temp_f8 = temp_f14 * temp_f14; sp8 = temp_f8; - temp_f16 = (f64) ((temp_a3 * temp_a1_2) - (temp_v0 * temp_a2)); + temp_f16 = (f64) ((temp_a3 * temp_a1) - (temp_v0 * temp_a2)); temp_f4 = temp_f16 * temp_f16; sp0 = temp_f4; temp_f2 = (f64) sqrtf((f32) (temp_f18 + temp_f8 + temp_f4)); if ((temp_f2 != 0.0) && ((temp_f0 = (f32) ((f64) (f32) temp_f12 / temp_f2), sp58 = temp_f0, temp_f4_2 = (f32) ((f64) (f32) temp_f14 / temp_f2), sp1C = temp_f4_2, sp54 = temp_f4_2, temp_f18_2 = (f32) ((f64) (f32) temp_f16 / temp_f2), sp50 = temp_f18_2, sp4C = -(((f32) spBA * temp_f0) + (temp_f4_2 * (f32) spB8) + (temp_f18_2 * (f32) spB6)), (D_8015F59C == 0)) || (!(temp_f4_2 < D_802B9E64) && !(D_802B9E68 < temp_f4_2))) && ((D_8015F5A0 == 0) || !(sp1C < D_802B9E6C) || !(D_802B9E70 < sp1C))) { temp_t0->vtx2[0] = sp4A; - temp_t0->vtx3[2] = phi_t1; - temp_t0->vtx3[1] = phi_t2; + temp_t0->vtx3[2] = var_t1; + temp_t0->vtx3[1] = var_t2; temp_t0->vtx3[0] = sp44; temp_t0->vtx2[1] = sp42; temp_t0->vtx2[2] = sp48; - if ((s32) sp44 < (s32) D_8015F6EA) { + if (sp44 < D_8015F6EA) { D_8015F6EA = sp44; } - if ((s32) phi_t2 < (s32) D_8015F6EE) { - D_8015F6EE = phi_t2; + if (var_t2 < D_8015F6EE) { + D_8015F6EE = var_t2; } - if ((s32) phi_t1 < (s32) D_8015F6F2) { - D_8015F6F2 = phi_t1; + if (var_t1 < D_8015F6F2) { + D_8015F6F2 = var_t1; } - if ((s32) D_8015F6E8 < (s32) sp4A) { + if (D_8015F6E8 < sp4A) { D_8015F6E8 = sp4A; } - if ((s32) D_8015F6EC < (s32) sp42) { + if (D_8015F6EC < sp42) { D_8015F6EC = sp42; } - if ((s32) D_8015F6F0 < (s32) sp48) { + if (D_8015F6F0 < sp48) { D_8015F6F0 = sp48; } temp_t0->height = sp58; temp_t0->gravity = sp54; + var_a1_2 = arg4; temp_t0->rotation = sp50; temp_t0->height2 = sp4C; temp_t0->surfaceType = (u16) arg3; @@ -3594,24 +3540,23 @@ block_33: D_8015F6FC = 0; temp_a3_2 = temp_t0->vtxs[0]->v.flag; temp_v1_2 = temp_t0->vtxs[1]->v.flag; - temp_a0_3 = temp_t0->vtxs[2]->v.flag; - phi_a1_2 = arg4; - if ((temp_a3_2 == 1) && (temp_v1_2 == 1) && (temp_a0_3 == 1)) { - phi_t8 = (arg4 | 0x400) & 0xFFFF; + temp_a0_2 = temp_t0->vtxs[2]->v.flag; + if ((temp_a3_2 == 1) && (temp_v1_2 == 1) && (temp_a0_2 == 1)) { + var_t8 = (arg4 | 0x400) & 0xFFFF; goto block_81; } - if ((temp_a3_2 == 2) && (temp_v1_2 == 2) && (temp_a0_3 == 2)) { - phi_a1_2 = (arg4 | 0x800) & 0xFFFF; - } else if ((temp_a3_2 == 3) && (temp_v1_2 == 3) && (temp_a0_3 == 3)) { - phi_a1_2 = (arg4 | 0x1000) & 0xFFFF; + if ((temp_a3_2 == 2) && (temp_v1_2 == 2) && (temp_a0_2 == 2)) { + var_a1_2 = (arg4 | 0x800) & 0xFFFF; + } else if ((temp_a3_2 == 3) && (temp_v1_2 == 3) && (temp_a0_2 == 3)) { + var_a1_2 = (arg4 | 0x1000) & 0xFFFF; } else if (D_8015F5A4 != 0) { - phi_t8 = (arg4 | 0x200) & 0xFFFF; + var_t8 = (arg4 | 0x200) & 0xFFFF; block_81: - phi_a1_2 = phi_t8; + var_a1_2 = var_t8; } - temp_t0->flags = phi_a1_2; + temp_t0->flags = var_a1_2; if (sp10 <= sp8) { - phi_t9 = phi_a1_2 | 0x4000; + var_t9 = var_a1_2 | 0x4000; if (sp0 <= sp8) { goto block_89; } @@ -3619,11 +3564,11 @@ block_81: if ((sp8 < sp10) && (sp0 <= sp10)) { temp_t0->flags |= 0x8000; } else { - phi_t9 = temp_t0->flags | 0x2000; + var_t9 = temp_t0->flags | 0x2000; block_89: - temp_t0->flags = phi_t9; + temp_t0->flags = var_t9; } - D_8015F588 = D_8015F588 + 1; + D_8015F588 += 1; } } } @@ -3761,23 +3706,13 @@ block_5: GLOBAL_ASM("asm/non_matchings/memory/func_802AED6C.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 s32 func_802AEE1C(s16 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7) { f32 temp_f0; - f32 temp_f0_2; - f32 temp_f12; - f32 temp_f12_2; - f32 temp_f14; - f32 temp_f14_2; - f32 temp_f16; - f32 temp_f16_2; f32 temp_f18; - f32 temp_f18_2; - f32 temp_f18_3; f32 temp_f2; temp_f0 = arg6 - arg4; + temp_f2 = arg7 - arg5; if (temp_f0 == 0.0f) { if (arg4 < arg0) { return 0; @@ -3785,67 +3720,49 @@ s32 func_802AEE1C(s16 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s1 if (arg1 < arg4) { return 0; } - if ((arg7 - arg5) > 0.0f) { + if (temp_f2 > 0.0f) { if ((arg5 < arg2) && (arg3 < arg7)) { return 1; } - // Duplicate return node #36. Try simplifying control flow for better match - return 0; - } - if ((arg7 < arg2) && (arg3 < arg5)) { + } else if ((arg7 < arg2) && (arg3 < arg5)) { return 1; } - // Duplicate return node #36. Try simplifying control flow for better match - return 0; - } - temp_f2 = arg7 - arg5; - if (temp_f2 == 0.0f) { - if (arg5 < arg2) { - return 0; - } - if (arg3 < arg5) { - return 0; - } - if (temp_f0 > 0.0f) { - if ((arg4 < arg0) && (arg1 < arg6)) { + } else { + if (temp_f2 == 0.0f) { + if (arg5 < arg2) { + return 0; + } + if (arg3 < arg5) { + return 0; + } + if (temp_f0 > 0.0f) { + if ((arg4 < arg0) && (arg1 < arg6)) { + return 1; + } + } else if ((arg6 < arg0) && (arg1 < arg4)) { + return 1; + } + } else { + temp_f18 = ((temp_f0 / temp_f2) * (arg2 - arg5)) + arg4; + if ((arg0 <= temp_f18) && (temp_f18 <= arg1)) { + return 1; + } + temp_f18 = ((temp_f0 / temp_f2) * (arg3 - arg5)) + arg4; + if ((arg0 <= temp_f18) && (temp_f18 <= arg1)) { + return 1; + } + temp_f18 = ((temp_f2 / temp_f0) * (arg0 - arg4)) + arg5; + if ((arg2 <= temp_f18) && (temp_f18 <= arg3)) { + return 1; + } + temp_f18 = ((temp_f2 / temp_f0) * (arg1 - arg4)) + arg5; + if ((arg2 <= temp_f18) && (temp_f18 <= arg3)) { return 1; } - // Duplicate return node #36. Try simplifying control flow for better match - return 0; - } - if ((arg6 < arg0) && (arg1 < arg4)) { - return 1; } - // Duplicate return node #36. Try simplifying control flow for better match - return 0; - } - temp_f16 = temp_f0 / temp_f2; - temp_f12 = arg4; - temp_f14 = arg0; - temp_f18 = (temp_f16 * (arg2 - arg5)) + temp_f12; - if ((temp_f14 <= temp_f18) && (temp_f18 <= arg1)) { - return 1; - } - temp_f18_2 = (temp_f16 * (arg3 - arg5)) + temp_f12; - if ((temp_f14 <= temp_f18_2) && (temp_f18_2 <= arg1)) { - return 1; - } - temp_f16_2 = temp_f2 / temp_f0; - temp_f12_2 = arg5; - temp_f14_2 = arg2; - temp_f18_3 = (temp_f16_2 * (arg0 - arg4)) + temp_f12_2; - if ((temp_f14_2 <= temp_f18_3) && (temp_f18_3 <= arg3)) { - return 1; - } - temp_f0_2 = (temp_f16_2 * (arg1 - arg4)) + temp_f12_2; - if ((temp_f14_2 <= temp_f0_2) && (temp_f0_2 <= arg3)) { - return 1; } return 0; } -#else -GLOBAL_ASM("asm/non_matchings/memory/func_802AEE1C.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 06ada559d7a32fdab49fa2d619cdfa027615bcda diff --git a/src/memory.h b/src/memory.h index 04597e7bf..ae89464bc 100644 --- a/src/memory.h +++ b/src/memory.h @@ -99,8 +99,9 @@ void process_shell_collision(Vec3f, f32, Vec3f, f32); void func_802AC098(UnkActorInner*, f32*); void func_802AC114(Vec3f, f32, Vec3f, f32); void func_802AD950(UnkActorInner*, f32, f32, f32, f32, f32, f32, f32); -void func_802ADDC8(UnkActorInner*, f32, f32, f32, f32); +s32 func_802ADDC8(UnkActorInner*, f32, f32, f32, f32); f32 func_802AE1C0(f32, f32, f32); +s32 func_802AEE1C(s16, s16, s16, s16, s16, s16, s16, s16); void func_802AF314(); void func_802AF588(s32); void func_802AF5AC(s32, s8); |
