More matches in code_80005FD0 (#502)

Signed-off-by: Taggerung <tyler.taggerung@email.com>
This commit is contained in:
Tyler McGavran
2023-12-18 23:02:13 -05:00
committed by GitHub
parent 6b9f36bbb0
commit b7b494f9d8
7 changed files with 103 additions and 563 deletions
+98 -178
View File
@@ -27,6 +27,7 @@
#include "menus.h"
#include "code_80091750.h"
#include "audio/external.h"
#include "ending/podium_ceremony_actors.h"
extern UnkCommonTextureStruct0 *D_800DC720[];
@@ -524,10 +525,6 @@ s32 func_800061DC(Vec3f arg0, f32 arg1, s32 arg2) {
return var_v1;
}
extern u16 D_80163258[];
extern u16 D_80163270[];
extern s32 D_80163288[];
void func_800065D0(s32 playerId, Player *player) {
s16 temp_t2;
s16 var_t1;
@@ -2858,81 +2855,70 @@ f32 func_8000D3B8(s32 playerId) {
return var_f2;
}
#ifdef MIPS_TO_C
//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Nov-26-2023
extern s16 D_8016344A;
void func_8000D438(s32 arg0, u16 arg1) {
s32 stackPadding0;
f32 sp48;
f32 sp44;
s32 stackPadding1;
s32 stackPadding2;
s32 stackPadding3;
f32 stackPadding4;
f32 stackPadding5;
f32 sp2C;
s32 sp28;
s16 sp26;
s32 sp1C;
f32 temp_f0;
s16 *temp_v1_2;
s16 temp_v0;
s16 temp_v1;
s32 temp_hi;
s32 var_a2;
s32 var_a2_2;
u16 temp_a3;
s16 temp_v1;
u16 thing;
temp_a3 = arg1 & 0xFFFF;
temp_v1 = D_801645E0[temp_a3];
sp28 = 6;
sp1C = temp_a3 * 2;
arg1 = temp_a3;
sp26 = temp_v1;
temp_v1 = D_801645E0[arg1];
var_a2 = 6;
sp2C = func_8000D3B8(arg0);
if (gCurrentCourseId != 4) {
if (gCurrentCourseId != 0x000A) {
if (gCurrentCourseId == 0x0014) {
var_a2 = 1;
} else if (temp_v1 < 6) {
var_a2 = 8;
} else if (temp_v1 >= 0x15) {
var_a2 = 0x00000014;
}
} else {
var_a2 = 7;
thing = arg1;
switch(gCurrentCourseId) {
case COURSE_AWARD_CEREMONY:
var_a2 = 1;
break;
case COURSE_TOADS_TURNPIKE:
var_a2 = 7;
break;
case COURSE_YOSHI_VALLEY:
break;
default:
if (temp_v1 < 6) {
var_a2 = 8;
} else if (temp_v1 >= 0x15) {
var_a2 = 20;
}
break;
}
if (var_a2 >= 8) {
temp_f0 = D_80163068[arg0];
if ((temp_f0 > 0.75f) && (D_801631D8[temp_a3] == 0)) {
if ((D_80163068[arg0] > 0.75f) && (D_801631D8[thing] == 0)) {
var_a2 = 7;
}
if ((temp_f0 < -0.75f) && (D_801631D8[temp_a3] == 1)) {
if ((D_80163068[arg0] < -0.75f) && (D_801631D8[thing] == 1)) {
var_a2 = 7;
}
}
sp28 = var_a2;
var_a2_2 = var_a2;
if (func_8000B820(arg0) == 1) {
var_a2_2 = 5;
var_a2 = 5;
}
temp_v1_2 = &D_80163380[arg0];
temp_v0 = *temp_v1_2;
if (temp_v0 < var_a2_2) {
*temp_v1_2 = temp_v0 + 1;
if (D_80163380[arg0] < var_a2) {
D_80163380[arg0]++;
}
if (var_a2_2 < *temp_v1_2) {
*temp_v1_2 -= 1;
if (var_a2 < D_80163380[arg0]) {
D_80163380[arg0]--;
}
temp_hi = (s32) (*temp_v1_2 + arg1) % (s32) D_80164430;
arg1 = (u16) temp_hi;
func_8000BBD8(temp_hi & 0xFFFF, sp2C, D_8016344A);
sp48 = D_80162FA0->unk0;
sp44 = D_80162FA0->unk8;
func_8000BBD8(((s32) (arg1 + 1) % (s32) D_80164430) & 0xFFFF, sp2C, D_8016344A);
D_80162FA0->unk0 = (sp48 + D_80162FA0->unk0) * 0.5f;
D_80162FA0->unk8 = (f32) ((sp44 + D_80162FA0->unk8) * 0.5f);
arg1 = (D_80163380[arg0] + arg1) % D_80164430;
func_8000BBD8(arg1, sp2C, D_80163448);
sp48 = D_80162FA0[0];
sp44 = D_80162FA0[2];
func_8000BBD8(((arg1 + 1) % D_80164430) & 0xFFFF, sp2C, D_80163448);
stackPadding5 = D_80162FA0[0];
D_80162FA0[0] = (sp48 + stackPadding5) * 0.5f;
stackPadding4 = D_80162FA0[2];
D_80162FA0[2] = (sp44 + stackPadding4) * 0.5f;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000D438.s")
#endif
#ifdef NON_MATCHING
// Something about the handling of D_80162FA0 is really off, can't figure out what
@@ -2998,12 +2984,15 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000D6D0.s")
#endif
#ifdef NON_MATCHING
// Something about the handling of D_80162FA0 is really off, can't figure out what
// Something about ordering of the math regarding x/y/zdiff is off, can't figure out why
s16 func_8000D940(f32 *arg0, s16 *waypointIndex, f32 arg2, f32 arg3, s16 pathIndex) {
UNUSED s32 pad[4];
s16 waypoint2;
s16 waypoint1;
UNUSED s32 pad2[4];
f32 pad2;
f32 pad3;
f32 pad4;
s32 pad5;
f32 distance;
f32 temp_f20;
f32 temp_f22;
@@ -3017,7 +3006,7 @@ s16 func_8000D940(f32 *arg0, s16 *waypointIndex, f32 arg2, f32 arg3, s16 pathInd
f32 ydiff;
f32 zdiff;
Vec3f sp54;
UNUSED s32 pad3;
s32 pad6;
TrackWaypoint *path;
sp54[0] = arg0[0];
@@ -3032,10 +3021,12 @@ s16 func_8000D940(f32 *arg0, s16 *waypointIndex, f32 arg2, f32 arg3, s16 pathInd
waypoint1 = ((temp_v0 + waypointCount) - 3) % waypointCount;
waypoint2 = ((temp_v0 + waypointCount) - 4) % waypointCount;
func_8000BBD8(waypoint1, arg3, pathIndex);
pad2 = D_80162FA0[0];
pad3 = D_80162FA0[2];
func_8000BBD8(waypoint2, arg3, pathIndex);
ydiff = ((D_80164550[pathIndex][waypoint2].posY + D_80164550[pathIndex][waypoint1].posY) * 0.5f) - temp_f22;
xdiff = ((D_80162FA0[0] + D_80162FA0[0]) * 0.5f) - temp_f20;
zdiff = ((D_80162FA0[2] + D_80162FA0[2]) * 0.5f) - temp_f24;
xdiff = ((pad2 + D_80162FA0[0]) * 0.5f) - temp_f20;
zdiff = ((pad3 + D_80162FA0[2]) * 0.5f) - temp_f24;
distance = sqrtf((xdiff * xdiff) + (ydiff * ydiff) + (zdiff * zdiff));
if (distance > 0.01f) {
var_f2 = ((xdiff * arg2) / distance) + temp_f20;
@@ -3697,30 +3688,6 @@ void func_8000F2DC(void) {
func_8000EEDC();
}
// static f32 D_800DCAA0[21] = {
// 0.3f,
// 0.3f,
// 0.2f,
// 0.4f,
// 0.0f,
// 0.3f,
// 0.5f,
// 0.4f,
// 0.7f,
// 0.5f,
// 0.5f,
// 0.3f,
// 0.3f,
// 0.4f,
// 0.6f,
// 0.1f,
// 0.5f,
// 0.5f,
// 0.1f,
// 0.5f,
// 0.5f,
// };
void func_8000F628(void) {
Camera *camera;
@@ -4405,15 +4372,10 @@ void func_80011AE4(s32 index) {
}
#ifdef MIPS_TO_C
//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-10-2023
? func_80011EC0(s32, u16); /* extern */
//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Dec-17-2023
extern ? D_80162EB8;
extern ? D_801630E8;
extern void *D_801632B0;
extern ? D_80163350;
extern ? D_801633F8;
extern ? D_801634FC;
s16 gCurrentCourseId; /* unable to generate initializer */
void func_80011B14(s32 playerId, Player *player) {
u16 sp2E;
@@ -4422,12 +4384,10 @@ void func_80011B14(s32 playerId, Player *player) {
s16 *temp_a3;
s16 temp_t1;
s32 temp_t3;
s32 temp_v1;
u16 temp_a2;
void *temp_t0;
void *temp_t6;
temp_v1 = playerId * 2;
temp_a3 = &D_801632B8[playerId];
temp_a2 = (u16) *temp_a3;
temp_t0 = *(&D_80162EB8 + (gCurrentCourseId * 4));
@@ -4447,13 +4407,13 @@ void func_80011B14(s32 playerId, Player *player) {
*temp_a3 = temp_a2 + 1;
switch (temp_t3) {
case 1:
func_80011EC0((s32) player->unk_07C >> 0x10, sp2E);
func_80011EC0(playerId, player, (s32) player->unk_07C >> 0x10, (s32) sp2E);
return;
case 2:
sp1C = temp_v1;
sp1C = playerId * 2;
func_8002AA50(player);
player->effects &= ~0x10;
*(&D_801630E8 + temp_v1) = 0;
D_801630E8[playerId] = 0;
return;
case 3:
*(&D_801634FC + (playerId * 0x10)) = 0.0f;
@@ -4465,25 +4425,25 @@ void func_80011B14(s32 playerId, Player *player) {
*(&D_801634FC + (playerId * 0x10)) = 0.6f;
return;
case 6:
*(&D_80163350 + temp_v1) = 0;
D_80163350[playerId] = 0;
return;
case 7:
*(&D_80163350 + temp_v1) = 1;
D_80163350[playerId] = 1;
return;
case 8:
*(&D_80163350 + temp_v1) = 2;
D_80163350[playerId] = (s16) 2U;
return;
case 11:
*(&D_80163350 + temp_v1) = 3;
D_80163350[playerId] = 3;
return;
case 9:
*(&D_801633F8 + temp_v1) = 1;
D_801633F8[playerId] = 1;
D_801631E0[playerId] = 0;
temp_v0 = &gPlayers[playerId];
temp_v0->effects &= ~0x1000;
return;
case 10:
*(&D_801633F8 + temp_v1) = 0;
D_801633F8[playerId] = 0;
break;
}
} else {
@@ -7816,23 +7776,13 @@ loop_34:
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001A588.s")
#endif
#ifdef MIPS_TO_C
//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-10-2023
extern ? D_801646D0;
void func_8001AAAC(s16 arg0, s16 arg1, s16 arg2) {
void *temp_v0;
temp_v0 = (arg0 * 8) + &D_801646D0;
if (temp_v0->unk0 == 0) {
temp_v0->unk0 = 1;
temp_v0->unk2 = arg1;
temp_v0->unk4 = arg2;
if (D_801646D0[arg0].unk0 == 0) {
D_801646D0[arg0].unk0 = 1;
D_801646D0[arg0].unk2 = arg1;
D_801646D0[arg0].unk4 = arg2;
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001AAAC.s")
#endif
void func_8001AB00(void) {
s32 var_v1;
@@ -8409,84 +8359,54 @@ void func_8001C05C(void) {
D_80163438[3] = -355.253997803;
}
#ifdef MIPS_TO_C
//generated by m2c commit 08138748803d75e73e4a94bb0c619a273754ee9c on Oct-11-2023
extern ? D_80163418;
extern ? D_80163438;
extern s16 D_8016347C;
extern s16 D_8016347E;
extern s32 D_80163480;
extern s32 D_80163484;
extern u16 D_80163E2C;
void func_8001C14C(void) {
Player *temp_s0;
f32 temp_f0;
f32 temp_f2;
s32 temp_t3;
s32 temp_v0;
s32 var_s1;
u16 temp_v1;
Player *temp_s0;
if (D_8016347C == 1) {
D_80163480 += 1;
}
if ((D_8016347E == 1) && (D_80163E2C == 0) && (D_802874D8.unk1D >= 3)) {
temp_t3 = D_80163484 + 1;
D_80163484 = temp_t3;
if (temp_t3 >= 0xF) {
if ((D_8016347E == 1) && (gBombKarts[0].state == 0) && (D_802874D8.unk1D >= 3)) {
D_80163484++;
if (D_80163484 >= 0xF) {
D_80163484 = 0;
D_8016347E = 2;
func_8009265C();
}
}
var_s1 = 0;
loop_8:
if (var_s1 == 3) {
if (D_8016347C != 0) {
goto block_12;
}
return;
}
block_12:
temp_s0 = &gPlayerOne[var_s1];
func_80009B60(var_s1);
temp_v1 = temp_s0->type;
temp_v0 = var_s1 * 4;
if (!(temp_v1 & 0x2000)) {
temp_f0 = *(&D_80163418 + temp_v0) - temp_s0->pos[0];
temp_f2 = *(&D_80163438 + temp_v0) - temp_s0->pos[2];
if ((f64) ((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) < 1.0) {
if (var_s1 != 3) {
if (D_8016347C == 0) {
temp_s0->type = temp_v1 | 0x2000;
} else {
temp_s0->type = temp_v1 & 0xDFFF;
for (var_s1 = 0; var_s1 < 4; var_s1++) {
if ((var_s1 == 3) && (D_8016347C == 0)) break;
temp_s0 = &gPlayerOne[var_s1];
func_80009B60(var_s1);
if (!(temp_s0->type & 0x2000)) {
temp_f0 = D_80163418[var_s1] - temp_s0->pos[0];
temp_f2 = D_80163438[var_s1] - temp_s0->pos[2];
if ((f64) ((temp_f0 * temp_f0) + (temp_f2 * temp_f2)) < 1.0) {
if (var_s1 != 3) {
if (1) {}
// Why oh why is a ternary required here? Who does that?
(D_8016347C == 0) ? (temp_s0->type |= 0x2000) : (temp_s0->type &= ~0x2000);
if ((gPlayerOne->type & 0x2000) && (gPlayerTwo->type & 0x2000) && (gPlayerThree->type & 0x2000)) {
D_8016347C = 1;
D_80163480 = 0;
}
} else if (D_8016347E == 0) {
if (!(temp_s0->effects & 0x01000000)) {
temp_s0->type |= 0x2000;
}
D_8016347E = 1;
D_80163484 = 0;
} else if (!(temp_s0->effects & 0x01000000)) {
temp_s0->type |= 0x2000;
}
if ((gPlayerOne->type & 0x2000) && (gPlayerTwo->type & 0x2000) && (gPlayerThree->type & 0x2000)) {
D_8016347C = 1;
D_80163480 = 0;
}
} else if (D_8016347E == 0) {
if (!(temp_s0->effects & 0x01000000)) {
temp_s0->type = temp_v1 | 0x2000;
}
D_8016347E = 1;
D_80163484 = 0;
} else if (!(temp_s0->effects & 0x01000000)) {
temp_s0->type = temp_v1 | 0x2000;
}
}
}
var_s1 += 1;
if (var_s1 == 4) {
return;
}
goto loop_8;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001C14C.s")
#endif
void func_8001C3C4(s32 arg0) {
if (gCurrentCourseId == COURSE_AWARD_CEREMONY) {