Match a couple functions in code_80281FA0 (#189)

* Match a couple functions in code_80281FA0  and add a header file

Signed-off-by: Taggerung <tyler.taggerung@gmail.com>
This commit is contained in:
Tyler McGavran
2022-05-01 06:53:47 -04:00
committed by GitHub
parent 2b6dc2cb0b
commit 6ed26d9786
5 changed files with 158 additions and 273 deletions
+31 -115
View File
@@ -2,14 +2,8 @@
#include <macros.h>
#include <types.h>
#include <common_structs.h>
extern Player *gPlayerOne;
extern Player *gPlayerTwo;
extern Player *gPlayerThree;
extern Player *gPlayerFour;
extern s16 D_802876D2;
s32 func_802832C4(void (*)(s32), s32, s16, s16);
#include "variables.h"
#include "code_80281FA0.h"
void func_80281FA0(Vec3f arg0, f32 arg1, f32 arg2, f32 arg3) {
arg0[0] = arg1;
@@ -185,11 +179,6 @@ s32 func_80282364(s16* arg0, s16 arg1, s16 arg2) {
return 1;
}
extern f32 D_80287B18;
extern s16 D_80287B1C;
extern s16 D_80287B1E;
extern s8 D_80287B20;
void func_8028240C(void) {
D_80287B1C = 0;
D_80287B18 = 0.0f;
@@ -197,8 +186,6 @@ void func_8028240C(void) {
D_80287B20 = 0;
}
extern void func_8028240C(); // extern
void func_80282434(s32 arg0) {
func_8028240C();
}
@@ -501,9 +488,6 @@ loop_1:
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_80282C40.s")
#endif
extern s32 D_80287818;
extern s32 D_80287998;
s32 func_80282D90(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
s32 res;
@@ -639,8 +623,6 @@ void func_80283100(void *arg0, f32 *arg1) {
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_80283100.s")
#endif
extern s32 D_802876E0;
void func_80283240(s16 arg0) {
if (arg0 == 1) {
func_80282EAC(0, &D_802876E0, 0x100, 0x10, 0x4000);
@@ -656,11 +638,6 @@ s32 func_802832C4(void (*func_ptr)(s32), s32 arg1, s16 arg2, s16 arg3) {
return 0;
}
extern s16 D_802876D0;
extern s16 D_802876D2;
extern s32 D_802876D4;
extern s32 D_802876D8;
s32 func_80283330(s32 arg0) {
if (arg0 != D_802876D8) {
D_802876D8 = arg0;
@@ -932,14 +909,10 @@ void func_80283994(s32 arg0) {
func_80280FFC();
}
extern f32 D_802856B8;
void func_802839B4(s32 arg0) {
D_802856B8 = 52.0f;
}
extern f32 D_802856B8;
void func_802839CC(s32 arg0) {
D_802856B8 = 0.0f;
}
@@ -948,8 +921,6 @@ void func_802839E0(s32 arg0) {
func_80092C80();
}
extern u16 D_800DC5E4;
void func_80283A00(s32 arg0) {
if (D_800DC5E4 == 0) {
play_sound2(0x49009009);
@@ -1016,8 +987,6 @@ void func_80283C58(s32 arg0) {
func_800CB14C();
}
extern u16 D_800DC5E4;
void func_80283C78(s32 arg0) {
if (D_800DC5E4 == 0) {
func_800C8EF8(0x1C);
@@ -1028,8 +997,6 @@ void func_80283CA8(s32 arg0) {
func_800CA008(0, 3);
}
extern u16 D_800DC5E4;
void func_80283CD0(s32 arg0) {
if (D_800DC5E4 == 0) {
func_800CA008(0, 2);
@@ -1040,11 +1007,6 @@ void func_80283D04(s32 arg0) {
play_sound2(0x49008026);
}
extern f32 D_802856B8;
extern s32 D_802856DC;
extern s32 D_80285718;
extern s16 D_80285D14;
void func_80283D2C(s32 arg0) {
D_802856B8 = 120.0f;
func_802832C4(&func_80283CA8, arg0, 0, 0);
@@ -1062,9 +1024,6 @@ void func_80283D2C(s32 arg0) {
func_80282D90(arg0, &D_802856DC, &D_80285718, 0);
}
extern s32 D_80285754;
extern s32 D_80285784;
void func_80283EA0(s32 arg0) {
func_80282D90(arg0, &D_80285754, &D_80285784, 0);
}
@@ -1073,21 +1032,12 @@ void func_80283ED0(Vec3f arg0) {
func_80282008(arg0, &gPlayerTwo->pos[0]);
}
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
? func_802821A0(f32, f32, ?); // extern
void func_80283EF8(s32 arg0) {
func_802821A0(gPlayerTwo->pos[0], 0.12f);
func_802821A0((bitwise f32) (arg0 + 4), gPlayerTwo->pos[1], 0x3DF5C28F);
func_802821A0((bitwise f32) (arg0 + 8), gPlayerTwo->pos[2], 0x3DF5C28F);
void func_80283EF8(Vec3f arg0) {
func_802821A0(&arg0[0], gPlayerTwo->pos[0], 0.12f);
func_802821A0(&arg0[1], gPlayerTwo->pos[1], 0.12f);
func_802821A0(&arg0[2], gPlayerTwo->pos[2], 0.12f);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_80283EF8.s")
#endif
extern s32 D_802857B4;
extern void func_80283EF8();
void func_80283F6C(s32 arg0) {
func_802832C4(&func_80283ED0, arg0, 0, 0);
func_802832C4(&func_80283EF8, arg0, 0, -1);
@@ -1098,31 +1048,18 @@ void func_80283FCC(Vec3f arg0) {
func_80282008(arg0, &gPlayerThree->pos[0]);
}
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
//? func_802821A0(f32, f32, ?); // extern
void func_80283FF4(f32 arg0) {
func_802821A0(gPlayerThree->posX, 0.12f);
func_802821A0(arg0 + 4, gPlayerThree->posY, 0x3DF5C28F);
func_802821A0(arg0 + 8, gPlayerThree->posZ, 0x3DF5C28F);
void func_80283FF4(Vec3f arg0) {
func_802821A0(&arg0[0], gPlayerThree->pos[0], 0.12f);
func_802821A0(&arg0[1], gPlayerThree->pos[1], 0.12f);
func_802821A0(&arg0[2], gPlayerThree->pos[2], 0.12f);
}
#else
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_80283FF4.s")
#endif
extern s32 D_80283FCC;
extern s32 D_80283FF4;
extern s32 D_802857CC;
extern void func_80283FF4();
void func_80284068(s32 arg0) {
func_802832C4(&func_80283FCC, arg0, 0, 0);
func_802832C4(&func_80283FF4, arg0, 0, -1);
func_80282E58(arg0, &D_802857CC, 0);
}
extern s32 D_802876D8;
void func_802840C8(s32 arg0) {
func_802832C4(&func_80283C14, arg0, 5, 5);
@@ -1139,9 +1076,6 @@ void func_802840C8(s32 arg0) {
}
}
extern s32 D_80285910;
extern s32 D_80285928;
void func_80284154(s32 arg0) {
func_80282D90(arg0, &D_80285910, &D_80285928, 0);
}
@@ -1163,16 +1097,11 @@ void func_80284184(s32 *arg0) {
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_80284184.s")
#endif
extern s32 D_80285940;
void func_802841E8(Vec3f arg0) {
func_80282E58(arg0, &D_80285940, 0);
func_80281FA0(arg0, -3202.0f, 90.0f, -478.0f);
}
extern void func_802841E8();
extern void func_80284184();
void func_8028422C(s32 arg0) {
func_802832C4(&func_80283AF4, arg0, 6, 6);
func_802832C4(&func_80283B44, arg0, 0x1E, 0x1E);
@@ -1180,16 +1109,10 @@ void func_8028422C(s32 arg0) {
func_802832C4(&func_80284184, arg0, 6, -1);
}
extern s32 D_802858B0;
extern s32 D_802858C8;
void func_802842A8(s32 arg0) {
func_80282D90(arg0, &D_802858B0, &D_802858C8, 0);
}
extern s32 D_802857F0;
extern s32 D_80285850;
void func_802842D8(s32 arg0) {
func_80282D90(arg0, &D_802857F0, &D_80285850, 0);
}
@@ -1233,9 +1156,6 @@ void func_80284308(void *arg0) {
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_80284308.s")
#endif
extern s32 D_80285A10;
extern s32 D_80285A4C;
void func_80284418(s32 arg0) {
func_802832C4(&func_80283B1C, arg0, 0x52, 0x52);
func_802832C4(&func_80283B1C, arg0, 0x48, 0x48);
@@ -1243,26 +1163,17 @@ void func_80284418(s32 arg0) {
func_80282D90(arg0, &D_80285A10, &D_80285A4C, 0);
}
extern s32 D_80285A88;
extern s32 D_80285AB8;
void func_80284494(s32 arg0) {
func_802832C4(&func_80283ACC, arg0, 0x1E, 0x1E);
func_802832C4(&func_80283968, arg0, 0, 0);
func_80282D90(arg0, &D_80285A88, &D_80285AB8, 0);
}
extern s32 D_80285AE8;
extern s32 D_80285B00;
void func_802844FC(s32 arg0) {
func_802832C4(&func_80283AA4, arg0, 0x3B, 0x3B);
func_80282D90(arg0, &D_80285AE8, &D_80285B00, 0);
}
extern s32 D_80285B18;
extern s32 D_80285B54;
void func_8028454C(s32 arg0) {
func_802832C4(&func_80283CA8, arg0, 0, 0);
func_802832C4(&func_80283A34, arg0, 1, 1);
@@ -1271,9 +1182,6 @@ void func_8028454C(s32 arg0) {
func_80282D90(arg0, &D_80285B18, &D_80285B54, 0);
}
extern s32 D_80285B90;
extern s32 D_80285BA8;
void func_802845EC(s32 arg0) {
func_80282D90(arg0, &D_80285B90, &D_80285BA8, 0);
}
@@ -1293,9 +1201,6 @@ UNUSED void func_802846AC(void) {
}
extern s32 D_80285C38;
extern s32 D_80285C74;
void func_802846B4(s32 arg0) {
func_80282D90(arg0, &D_80285C38, &D_80285C74, 0);
}
@@ -1421,14 +1326,25 @@ the instruction, which has a name starting with "jtbl"/"jpt_".
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_80284AE8.s")
#endif
#ifdef MIPS_TO_C
//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307
/*
Failed to decompile function func_80284CC0:
void func_80284CC0(void) {
f32 temp_f0;
f32 temp_f14;
temp_f14 = D_802856B0 - D_802856C0;
if (temp_f14 < 0.0f) {
temp_f14 = 0.0f;
}
temp_f0 = D_802856B0 + D_802856C0;
// Note that this MUST be on one line. All hail significant whitespace in C!
do {if (temp_f0 > 240.0f) { temp_f0 = 239.0f; } } while (0);
gDPPipeSync(gDisplayListHead++);
gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2);
gDPSetCycleType(gDisplayListHead++, G_CYC_FILL);
gDPSetFillColor(gDisplayListHead++, (GPACK_RGBA5551(0, 0, 0, 1) << 16 | GPACK_RGBA5551(0, 0, 0, 1)));
gDPFillRectangle(gDisplayListHead++, 0, 0, 319, (s32)temp_f14);
gDPFillRectangle(gDisplayListHead++, 0, (s32)temp_f0, 319, 239);
gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE);
func_802822AC(&D_802856C0, D_802856B8, D_802856BC / D_802856B4);
}
Last instruction is missing a delay slot:
jr $ra
*/
#else
GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_80284CC0.s")
#endif
+127
View File
@@ -0,0 +1,127 @@
#ifndef CODE_80281FA0_h
#define CODE_80281FA0_h
#include "common_structs.h"
/* Function Prototypes */
void func_80281FA0(Vec3f, f32, f32, f32);
void func_80281FC0(Vec3s, s16, s16, s16);
void func_80281FDC(Vec3f);
void func_80281FF4(Vec3s);
void func_80282008(Vec3f, Vec3f);
void func_80282024(Vec3s, Vec3s);
void func_80282040();
void func_80282048();
s32 func_802821A0(f32*, f32, f32);
s32 func_80282200(s16*, s16, s16);
s32 func_802822AC(f32*, f32, f32);
s32 func_80282364(s16*, s16, s16);
void func_8028240C();
void func_80282434(s32);
s32 func_80282D90(s32, s32, s32, s32);
void func_80282E58(s32, s32, s32);
void func_80282F00(s16*, s16);
void func_80283240(s16);
s32 func_802832C4(void (*)(s32), s32, s16, s16);
s32 func_80283330(s32);
s32 func_80283428();
void func_80283968(s32);
void func_80283994(s32);
void func_802839B4(s32);
void func_802839CC(s32);
void func_802839E0(s32);
void func_80283A00(s32);
void func_80283A34(s32);
void func_80283A54(s32);
void func_80283A7C(s32);
void func_80283AA4(s32);
void func_80283ACC(s32);
void func_80283AF4(s32);
void func_80283B1C(s32);
void func_80283B44(s32);
void func_80283B6C(s32);
void func_80283BA4(s32);
void func_80283BF0(s32);
void func_80283C14(s32);
void func_80283C38(s32);
void func_80283C58(s32);
void func_80283C78(s32);
void func_80283CA8(s32);
void func_80283CD0(s32);
void func_80283D04(s32);
void func_80283D2C(s32);
void func_80283EA0(s32);
void func_80283ED0(Vec3f);
void func_80283EF8(Vec3f);
void func_80283F6C(s32);
void func_80283FCC(Vec3f);
void func_80283FF4(Vec3f);
void func_80284068(s32);
void func_802840C8(s32);
void func_80284154(s32);
void func_80284184();
void func_802841E8(Vec3f);
void func_8028422C(s32);
void func_802842A8(s32);
void func_802842D8(s32);
void func_80284418(s32 arg0);
void func_80284494(s32 arg0);
void func_802844FC(s32 arg0);
void func_8028454C(s32 arg0);
void func_802845EC(s32 arg0);
void func_8028461C(s32 arg0);
void func_80284648(s32 arg0);
void func_802846AC();
void func_802846B4(s32 arg0);
void func_80284CC0();
/* This is where I'd put my static data, if I had any */
extern u16 D_800DC5E4;
extern s32 D_80283FCC;
extern s32 D_80283FF4;
extern f32 D_802856B0;
extern f32 D_802856B4;
extern f32 D_802856B8;
extern f32 D_802856BC;
extern f32 D_802856C0;
extern s32 D_802856DC;
extern s32 D_80285718;
extern s32 D_80285754;
extern s32 D_80285784;
extern s32 D_802857B4;
extern s32 D_802857CC;
extern s32 D_802857F0;
extern s32 D_80285850;
extern s32 D_802858B0;
extern s32 D_802858C8;
extern s32 D_80285910;
extern s32 D_80285928;
extern s32 D_80285940;
extern s32 D_80285A10;
extern s32 D_80285A4C;
extern s32 D_80285A88;
extern s32 D_80285AB8;
extern s32 D_80285AE8;
extern s32 D_80285B00;
extern s32 D_80285B18;
extern s32 D_80285B54;
extern s32 D_80285B90;
extern s32 D_80285BA8;
extern s32 D_80285C38;
extern s32 D_80285C74;
extern s16 D_80285D14;
extern s16 D_802876D0;
extern s16 D_802876D2;
extern s32 D_802876D4;
extern s32 D_802876D8;
extern s32 D_802876E0;
extern s32 D_80287818;
extern s32 D_80287998;
extern f32 D_80287B18;
extern s16 D_80287B1C;
extern s16 D_80287B1E;
extern s8 D_80287B20;
#endif