Small matches, nothing super special (#400)

Signed-off-by: Taggerung <tyler.taggerung@email.com>
This commit is contained in:
Tyler McGavran
2023-09-05 17:49:55 -04:00
committed by GitHub
parent 7f7ecc5854
commit 9c661125be
10 changed files with 162 additions and 478 deletions
-25
View File
@@ -2186,31 +2186,6 @@ void func_8005C6B4(s8 arg0, s16* arg1, s16* arg2, s16* arg3) {
}
}
void func_8005C674(s8, s16*, s16*, s16*);
void func_8005C980();
extern s32 D_80165590;
extern s32 D_80165594;
extern s32 D_80165598;
extern s32 D_8016559C;
extern s32 D_801655A4;
extern s32 D_801655AC;
extern s32 D_801655B4;
extern s32 D_801655BC;
extern s32 D_801655C4;
extern s32 D_801655CC;
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 s8 D_801658A8;
extern s32 D_8018D2AC;
extern s32 D_8018D400;
extern s32 D_8018D40C;
extern s32 D_8018D410;
void func_8005C728(void) {
s16 sp26;
s16 sp24;
+24
View File
@@ -83,6 +83,7 @@ void func_8005C654(s32*);
void func_8005C65C(s32);
void func_8005C6B4(s8, s16*, s16*, s16*);
void func_8005C728(void);
void func_8005C980(void);
void func_8005CB60(s32, s32);
void func_8005D0FC(s32);
@@ -312,6 +313,29 @@ extern s16 D_8018CF98[];
extern Camera *D_8018CF14;
extern Player *D_8018CF1C;
extern s32 D_80165590;
extern s32 D_80165594;
extern s32 D_80165598;
extern s32 D_8016559C;
extern s32 D_801655A4;
extern s32 D_801655AC;
extern s32 D_801655B4;
extern s32 D_801655BC;
extern s32 D_801655C4;
extern s32 D_801655CC;
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 s8 D_801658A8;
extern s32 D_8018D2AC;
extern s32 D_8018D400;
extern s32 D_8018D40C;
extern s32 D_8018D410;
extern s32 D_8018D120;
extern s32 D_8018D170;
extern s32 D_8018D178;
+74 -191
View File
@@ -3773,24 +3773,11 @@ u8 func_8007AF78(UNUSED s32 arg0, s16 arg1) {
return gen_random_item(arg1, 1);
}
/**
* todo: verify that these two variables are fake ptrs.
* As seen below, they were replaced with gLapCountByPlayerId and gGPCurrentRaceRankByPlayerId
*
* Notice how matching with the two variables below required two s16s. The lapcount gets cast to s16 to match.
typedef struct {
s16 val;
s16 pad;
} a;
extern a D_80164392[];
extern a D_801643BA[];
*/
s16 func_8007AFB0(s32 objectIndex, s32 arg1) {
UNUSED s32 pad[3];
s16 randomItem;
randomItem = (s16) func_8007AF40((s16) gLapCountByPlayerId[arg1], (s16) gGPCurrentRaceRankByPlayerId[arg1]);
randomItem = func_8007AF40(gLapCountByPlayerId[arg1], gGPCurrentRaceRankByPlayerId[arg1]);
if (D_8018CA70[arg1].itemOverride != 0) {
randomItem = (s16) D_8018CA70[arg1].itemOverride;
@@ -3802,83 +3789,61 @@ s16 func_8007AFB0(s32 objectIndex, s32 arg1) {
return randomItem;
}
#ifdef MIPS_TO_C
//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
extern ? D_80164392;
extern ? D_801643BA;
extern s32 gItemWindowObjectByPlayerId;
#ifdef NON_MATCHING
// https://decomp.me/scratch/yWKlx
// More stupid register allocation nonsense
s32 func_8007B040(s32 objectIndex, s32 arg1) {
s32 sp64;
s32 sp60;
Player *sp38;
s16 temp_a1;
s16 temp_t0_2;
s32 *var_a0;
s32 temp_a0;
s32 temp_t0;
s32 temp_v0;
s32 func_8007B040(s32 objectIndex, s32 playerId) {
s16 stackPadding;
s32 temp_v1;
s32 var_a3;
s32 var_t3;
s32 temp_a0;
s32 var_v1;
s32 sp50[4];
s32 sp40[4];
s32 var_v1_2;
struct_80165C18_entry *temp_a3;
struct_80165C18_entry *temp_a3_2;
struct_80165C18_entry *temp_s0;
u16 temp_v0_2;
u8 var_v1;
Player *sp38;
s16 temp_a1;
var_a3 = 0;
var_t3 = 0;
if (gModeSelection == GRAND_PRIX) {
if (random_int(0x0064U) < 0x51) {
temp_v0 = arg1 * 4;
var_v1 = func_8007AF40((s32) *(&D_80164392 + temp_v0), *(&D_801643BA + temp_v0));
var_v1 = func_8007AF40(gLapCountByPlayerId[playerId], gGPCurrentRaceRankByPlayerId[playerId]);
} else {
sp60 = 0;
func_800C9060(arg1 & 0xFF, 0x1900A058U);
var_v1 = (u8) sp60;
var_v1 = 0;
func_800C9060(playerId, 0x1900A058U);
}
var_t3 = 1;
temp_a3 = &D_80165C18[objectIndex];
temp_a3->unk_0A2 = (s16) var_v1;
temp_a3->unk_0D2 = (s8) var_v1;
D_80165C18[objectIndex].unk_0A2 = var_v1;
D_80165C18[objectIndex].unk_0D2 = var_v1;
} else {
temp_t0 = gPlayerCountSelection1;
var_v1_2 = 0;
if (temp_t0 > 0) {
var_a0 = &gItemWindowObjectByPlayerId;
do {
if (var_v1_2 != arg1) {
temp_a1 = D_80165C18[*var_a0].unk_0A4;
if (temp_a1 != 0) {
(&sp50[0])[var_a3] = var_v1_2;
(&sp40[0])[var_a3] = (s32) temp_a1;
var_a3 += 1;
}
for (var_v1_2 = 0; var_v1_2 < gPlayerCountSelection1; var_v1_2++) {
temp_a0 = gItemWindowObjectByPlayerId[var_v1_2];
if (var_v1_2 != playerId) {
if (D_80165C18[temp_a0].unk_0A4 != 0) {
sp50[var_a3] = var_v1_2;
sp40[var_a3] = D_80165C18[temp_a0].unk_0A4;
var_a3 += 1;
}
var_v1_2 += 1;
var_a0 += 4;
} while (var_v1_2 < temp_t0);
}
}
if (var_a3 != 0) {
temp_v0_2 = random_int(var_a3 & 0xFFFF);
temp_v1 = (&sp50[0])[temp_v0_2];
temp_t0_2 = (&sp40[0])[temp_v0_2].unk2;
temp_a3_2 = &D_80165C18[objectIndex];
temp_a3_2->unk_0D1 = (s8) temp_v1;
temp_a3_2->unk_0A2 = temp_t0_2;
temp_a3_2->unk_0D2 = (s8) temp_t0_2;
temp_a0 = (&gItemWindowObjectByPlayerId)[temp_v1];
var_v1 = random_int(var_a3);
temp_v1 = sp50[var_v1];
D_80165C18[objectIndex].unk_0D1 = temp_v1;
temp_a1 = sp40[var_v1];
D_80165C18[objectIndex].unk_0A2 = temp_a1;
D_80165C18[objectIndex].unk_0D2 = temp_a1;
temp_a0 = gItemWindowObjectByPlayerId[temp_v1];
sp38 = &gPlayerOne[temp_v1];
sp64 = temp_a0;
func_800722A4(temp_a0, 1);
temp_s0 = &D_80165C18[temp_a0];
temp_s0->unk_0A4 = 0;
D_80165C18[temp_a0].unk_0A4 = 0;
sp38->unk_010 = 0;
if (func_80072320(temp_a0, 2) != 0) {
func_800722CC(sp64, 2);
temp_s0->unk_098 = 0;
func_800722CC(temp_a0, 2);
D_80165C18[temp_a0].unk_098 = 0;
}
var_t3 = 1;
}
@@ -3931,50 +3896,11 @@ GLOBAL_ASM("asm/non_matchings/code_80071F00/func_8007B254.s")
#endif
#ifdef MIPS_TO_C
//generated by m2c commit 44f261a363c51a295be8efe3d7ca7f4d2c967e9b on Dec-30-2022
? func_8007AC9C(s32); /* extern */
s8 func_8007AFB0(s32, s32); /* extern */
s32 func_8007B040(s32, s32); /* extern */
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Sep-05-2023
? func_8007B254(s32, s32); /* extern */
? func_800C8F80(u8, ?); /* extern */
? func_800C9018(u8, ?); /* extern */
extern s8 D_80165888;
static s32 *gItemWindowTLUTs[0x10] = {
(s32 *) gTLUTItemWindowNone,
(s32 *) gTLUTItemWindowBanana,
(s32 *) gTLUTItemWindowBananaBunch,
(s32 *) gTLUTItemWindowGreenShell,
(s32 *) gTLUTItemWindowTripleGreenShell,
(s32 *) gTLUTItemWindowRedShell,
(s32 *) gTLUTItemWindowTripleRedShell,
(s32 *) gTLUTItemWindowBlueShell,
(s32 *) gTLUTItemWindowThunderBolt,
(s32 *) gTLUTItemWindowFakeItemBox,
(s32 *) gTLUTItemWindowStar,
(s32 *) gTLUTItemWindowBoo,
(s32 *) gTLUTItemWindowMushroom,
(s32 *) gTLUTItemWindowDoubleMushroom,
(s32 *) gTLUTItemWindowTripleMushroom,
(s32 *) gTLUTItemWindowSuperMushroom,
};
static s8 *gItemWindowTextures[0x10] = {
gTextureItemWindowNone,
gTextureItemWindowBanana,
gTextureItemWindowBananaBunch,
gTextureItemWindowGreenShell,
gTextureItemWindowTripleGreenShell,
gTextureItemWindowRedShell,
gTextureItemWindowTripleRedShell,
gTextureItemWindowBlueShell,
gTextureItemWindowThunderBolt,
gTextureItemWindowFakeItemBox,
gTextureItemWindowStar,
gTextureItemWindowBoo,
gTextureItemWindowMushroom,
gTextureItemWindowDoubleMushroom,
gTextureItemWindowTripleMushroom,
gTextureItemWindowSuperMushroom,
};
static u8 *gItemWindowTLUTs[0x10];
static u8 *gItemWindowTextures[0x10];
void func_8007B34C(s32 playerId) {
s32 sp40;
@@ -4080,7 +4006,7 @@ void func_8007B34C(s32 playerId) {
break;
case 11:
if (gActiveScreenMode == 0) {
if (s16_step_down_towards((playerId * 0x84) + 0x48 + D_8018CA70, 0, 4) != 0) {
if (s16_step_down_towards(&D_8018CA70[playerId].slideItemBoxY, 0, 4) != 0) {
func_80072488(temp_s0);
}
} else if (gActiveScreenMode == 3) {
@@ -4099,7 +4025,7 @@ void func_8007B34C(s32 playerId) {
func_80072488(temp_s0);
}
}
} else if (s16_step_down_towards((playerId * 0x84) + 0x46 + D_8018CA70, 0, 8) != 0) {
} else if (s16_step_down_towards(&D_8018CA70[playerId].slideItemBoxX, 0, 8) != 0) {
func_80072488(temp_s0);
}
break;
@@ -4145,7 +4071,7 @@ void func_8007B34C(s32 playerId) {
break;
}
if (func_80072320(temp_s0, 2) != 0) {
temp_v0 = (u16) sp2C->unk_098;
temp_v0 = sp2C->unk_098;
if (temp_v0 == 0) {
func_8007AC9C(playerId);
} else {
@@ -4753,52 +4679,36 @@ void func_8007CA70(void) {
GLOBAL_ASM("asm/non_matchings/code_80071F00/func_8007CA70.s")
#endif
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-09-2023
? func_8007CA70(); /* extern */
extern ? D_8018BFD0;
static Vtx D_800E4470; /* unable to generate initializer */
static Vtx D_800E44B0; /* unable to generate initializer */
void func_8007CC00(void) {
Player *temp_s3;
f32 temp_f20;
f32 temp_f20_2;
s32 *var_s4;
s32 temp_s2;
s32 temp_t4;
s8 temp_v0;
struct_80165C18_entry *temp_s0;
u16 temp_t4;
s32 someIndex;
s32 objectIndex;
Player *player;
Camera *camera;
struct_80165C18_entry *object;
func_8007CA70();
var_s4 = D_8018BFA8;
do {
temp_s2 = *var_s4;
temp_s0 = &D_80165C18[temp_s2];
if (temp_s0->unk_0A6 != 0) {
func_8007C684(temp_s2);
func_8008B78C(temp_s2);
temp_v0 = temp_s0->unk_0D1;
temp_t4 = (0x8000 - camera1[temp_v0].rot[1]) & 0xFFFF;
temp_s3 = &gPlayerOne[temp_v0];
temp_f20 = coss(temp_t4 & 0xFFFF);
temp_s0->pos[0] = (temp_s3->pos[0] + (temp_f20 * (temp_s0->unk_010[0] + temp_s0->unk_028[0]))) - ((temp_s0->unk_028[2] + temp_s0->unk_010[2]) * sins(temp_t4 & 0xFFFF));
temp_s0->pos[1] = (f32) ((f64) temp_s0->unk_028[1] + (6.5 + (f64) temp_s3->unk_074 + (f64) temp_s0->unk_010[1]));
temp_f20_2 = sins(temp_t4 & 0xFFFF);
temp_s0->pos[2] = ((temp_s0->unk_028[2] + temp_s0->unk_010[2]) * coss(temp_t4 & 0xFFFF)) + (temp_s3->pos[2] + (temp_f20_2 * (temp_s0->unk_010[0] + temp_s0->unk_028[0])));
func_8007C550(temp_s2);
if (func_8007223C(temp_s2, 0x00000080) != 0) {
temp_s0->unk_074 = &D_800E44B0;
for (someIndex = 0; someIndex < NUM_BOOS; someIndex++) {
objectIndex = D_8018BFA8[someIndex];
object = &D_80165C18[objectIndex];
if (object->unk_0A6 != 0) {
func_8007C684(objectIndex);
func_8008B78C(objectIndex);
player = &gPlayerOne[object->unk_0D1];
camera = &camera1[object->unk_0D1];
temp_t4 = (0x8000 - camera->rot[1]);
object->pos[0] = player->pos[0] + (coss(temp_t4) * (object->unk_010[0] + object->unk_028[0])) - (sins(temp_t4) * (object->unk_010[2] + object->unk_028[2]));
object->pos[1] = 6.5 + player->unk_074 + object->unk_010[1] + object->unk_028[1];
object->pos[2] = player->pos[2] + (sins(temp_t4) * (object->unk_010[0] + object->unk_028[0])) + (coss(temp_t4) * (object->unk_010[2] + object->unk_028[2]));
func_8007C550(objectIndex);
if (func_8007223C(objectIndex, 0x00000080) != 0) {
object->unk_074 = D_800E44B0;
} else {
temp_s0->unk_074 = &D_800E4470;
object->unk_074 = D_800E4470;
}
}
var_s4 += 4;
} while (var_s4 != &D_8018BFD0);
}
}
#else
GLOBAL_ASM("asm/non_matchings/code_80071F00/func_8007CC00.s")
#endif
void func_8007CE0C(s32 objectIndex) {
struct_80165C18_entry *temp_s0;
@@ -7232,35 +7142,17 @@ void func_80082E5C(void) {
}
}
#ifdef MIPS_TO_C
//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc
struct _struct_D_800E5DF4_0x8 {
/* 0x0 */ s16 unk0; /* inferred */
/* 0x2 */ s16 unk2; /* inferred */
/* 0x4 */ s16 unk4; /* inferred */
/* 0x6 */ u16 unk6; /* inferred */
}; /* size = 0x8 */
extern ? D_06014794;
extern ? D_06014798;
extern f32 D_8018D01C;
static struct _struct_D_800E5DF4_0x8 D_800E5DF4[0]; /* unable to generate initializer */
#ifdef NON_MATCHING
// https://decomp.me/scratch/RquH0
// Gollygee I sure love register allocation :^)
void func_80082F1C(s32 objectIndex, s32 arg1) {
struct _struct_D_800E5DF4_0x8 *sp24;
struct _struct_D_800E5DF4_0x8 *temp_v0_2;
struct_80165C18_entry *temp_v0;
temp_v0 = &D_80165C18[objectIndex];
temp_v0->unk_070 = (s32) &D_06014798;
temp_v0->unk_074 = (s32) &D_06014794;
temp_v0->sizeScaling = 0.027f;
D_80165C18[objectIndex].unk_070 = D_06014798;
D_80165C18[objectIndex].unk_074 = D_06014794;
D_80165C18[objectIndex].sizeScaling = 0.027f;
func_80072488(objectIndex);
temp_v0_2 = &D_800E5DF4[arg1];
sp24 = temp_v0_2;
func_8008B7D4(objectIndex, (f32) temp_v0_2->unk0 * D_8018D01C, (f32) temp_v0_2->unk2, (f32) temp_v0_2->unk4);
func_8008B7D4(objectIndex, D_800E5DF4[arg1].pos[0] * D_8018D01C, D_800E5DF4[arg1].pos[1], D_800E5DF4[arg1].pos[2]);
func_8008B80C(objectIndex, 0.0f, 0.0f, 0.0f);
func_8008B888(objectIndex, 0U, temp_v0_2->unk6, 0U);
func_8008B888(objectIndex, 0U, D_800E5DF4[arg1].rot, 0U);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80071F00/func_80082F1C.s")
@@ -7285,7 +7177,7 @@ void func_80083080(void) {
s32 objectIndex;
s32 var_s1;
for (var_s1 = 0; var_s1 < 4; var_s1++) {
for (var_s1 = 0; var_s1 < NUM_YV_FLAG_POLES; var_s1++) {
objectIndex = D_80183EA0[var_s1];
if (D_80165C18[objectIndex].unk_0A6 != 0) {
func_80083018(objectIndex, var_s1);
@@ -8159,17 +8051,11 @@ void func_80085878(s32 objectIndex, s32 arg1) {
func_80072488(objectIndex);
}
#ifdef MIPS_TO_C
//generated by m2c commit eefca95b040d7ee0c617bc58f9ac6cd1cf7bce87 on Aug-10-2023
extern s32 D_8018D40C;
void func_800859C8(s32 objectIndex, s32 arg1) {
s16 temp_v0;
struct_80165C18_entry *temp_s0;
temp_s0 = &D_80165C18[objectIndex];
temp_v0 = temp_s0->unk_0A6;
switch (temp_v0) { /* irregular */
switch (temp_s0->unk_0A6) { /* irregular */
case 0:
break;
case 1:
@@ -8184,9 +8070,6 @@ void func_800859C8(s32 objectIndex, s32 arg1) {
}
func_80074344(objectIndex, &temp_s0->unk_044, -0.8f, 0.8f, 0.03f, 0, -1);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80071F00/func_800859C8.s")
#endif
void func_80085AA8(void) {
s32 temp_s2;
+17 -1
View File
@@ -5,6 +5,8 @@
#include "common_structs.h"
#include "camera.h"
#define NUM_YV_FLAG_POLES 4
// This struct is used by a lot of different objects
// Stars, clouds, exahust smoke (I think?)
typedef struct {
@@ -12,6 +14,11 @@ typedef struct {
u16 id;
} StarSpawn;
typedef struct {
Vec3s pos;
u16 rot;
} YVFlagPoleSpawn;
void func_80077D5C(s32);
s32 find_unused_obj_index(s32*);
void func_80071F6C(s32*);
@@ -204,6 +211,8 @@ void func_8007AC9C(s32);
u8 gen_random_item(s16, s16);
u8 func_8007AF40(s16, s16);
u8 func_8007AF78(s32, s16);
s16 func_8007AFB0(s32, s32);
s32 func_8007B040(s32, s32);
void func_8007B34C(s32);
void func_8007BB9C(s32);
void func_8007BBBC(s32);
@@ -212,6 +221,7 @@ void func_8007BDA8(void);
void func_8007BDE0(s32);
void func_8007BEC8(s32);
void func_8007BFB0(s32);
void func_8007CA70(void);
void func_8007CC00(void);
void func_8007C280(void);
void func_8007C2F8(s32);
@@ -393,6 +403,8 @@ extern u8 d_course_moo_moo_farm_mole_frames[][2048];
// From Yoshi Valley course data, haven't created a .h file for it yet
extern u8 gTLUTHedgehog[];
extern animation_type_2 *D_06014794[];
extern u32 D_06014798[];
extern u8 gTextureHedgehog[];
// From Frappe Snowland course data, haven't created a .h file for it yet
@@ -404,7 +416,7 @@ extern u8 gTextureSnowmanBody[];
// From Sherbet Land course data, haven't created a .h file for it yet
extern u32 D_06008EB0[]; // d_course_sherbet_land_unk_data1
extern animation_type_2 D_06009AC8[]; // d_course_sherbet_land_unk_data11
extern animation_type_2 *D_06009AC8[]; // d_course_sherbet_land_unk_data11
extern u8 d_course_sherbet_land_ice[];
// From Rainbow Road course data, haven't created a .h file for it yet
@@ -429,6 +441,8 @@ extern u8 *D_8018C028;
// I think the entires in this array are way over-sized
extern u8 D_80183FA8[4][0x2000];
extern YVFlagPoleSpawn D_800E5DF4[NUM_YV_FLAG_POLES];
// Something related to the rotation(?) of ice in Sherbet Land
extern u16 D_801657A2;
@@ -464,5 +478,7 @@ extern Gfx D_0B008A90[];
// The other entries appear to be unused.
// data/data_code_80071F00_2.s
extern Vec3s D_800E634C[3]; // static?
extern Vtx D_800E4470[];
extern Vtx D_800E44B0[];
#endif