Merge pull request #55 from IcySlurpee/decomp-1de40

Match most of `1DE40`
This commit is contained in:
Rainchus 2025-02-02 13:03:20 -06:00 committed by GitHub
commit 84bf96b85e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 183 additions and 51 deletions

View File

@ -249,19 +249,23 @@ typedef struct unkProcessStruct {
typedef struct unk_Struct00 {
/* 0x000 */ Vec3f pos;
/* 0x00C */ f32 unkC;
/* 0x010 */ f32 unk10;
/* 0x014 */ f32 unk14;
/* 0x018 */ f32 unk18;
/* 0x01C */ f32 unk1C;
/* 0x020 */ f32 unk20;
/* 0x024 */ char pad24[0x1C];
/* 0x00C */ Vec3f unkC;
/* 0x018 */ Vec3f unk18;
/* 0x024 */ Vec3f unk24;
/* 0x030 */ Vec3f unk30;
/* 0x03C */ char pad3C[4];
/* 0x040 */ f32 unk_40;
/* 0x044 */ f32 unk_44;
/* 0x048 */ f32 unk_48;
/* 0x04C */ char pad4C[0xA8];
/* 0x04C */ u16 unk4C;
/* 0x04E */ s16 unk4E;
/* 0x050 */ char pad50[0x88];
/* 0x0D8 */ Vec4f unkD8;
/* 0x0E8 */ s32 unkE8;
/* 0x0EC */ s32 unkEC;
/* 0x0F0 */ s32 unkF0;
/* 0x0F4 */ s32 unkF4;
/* 0x0F8 */ char padF8[0x40];
/* 0x0F8 */ Mtx unkF8;
/* 0x138 */ Mtx unk_138;
/* 0x178 */ char unk_178[0x380];
} unk_Struct00;
@ -296,7 +300,7 @@ typedef struct Object {
/* 0x4C */ s32 unk_4C;
/* 0x50 */ char unk_50[3];
/* 0x53 */ s8 unk_53;
/* 0x50 */ char unk_54[0x38];
/* 0x54 */ char unk_54[0x38];
/* 0x8C */ struct Object* unk_8C;
} Object; // //sizeof 0xAC? (this and mpSource_object are the same struct)
@ -477,11 +481,11 @@ typedef struct mpSource_f2b7cstruct {
} mpSource_f2b7cstruct;
typedef struct camera {
/* 0x00 */ Vec3f coords;
/* 0x0C */ f32 unk_0C;
/* 0x00 */ Vec3f coords; // eye?
/* 0x0C */ f32 unk_0C; // at?
/* 0x10 */ f32 unk_10;
/* 0x14 */ f32 unk_14;
/* 0x18 */ f32 unk_18;
/* 0x18 */ f32 unk_18; // up?
/* 0x1C */ f32 unk_1C;
/* 0x20 */ f32 unk_20;
} camera; //sizeof unknown
@ -978,4 +982,4 @@ typedef struct unk3AC60Struct2 {
/* 0x3A */ s16 unk_3A;
} unk3AC60Struct2; //sizeof unknown
#endif
#endif

View File

@ -165,7 +165,7 @@ void func_80009618(s32);
void func_8002456C(s16);
void func_800211BC(s16, u8);
void func_8003E5E0(Object*);
void func_8001D4D4(s32, Vec4f*);
void func_8001D4D4(s16, Vec4f*);
void func_8004D2A4(s16, s32, s16);
s32 DirectionPrompt(s32);
u32 PlayerIsCPU(s16 index);
@ -204,7 +204,7 @@ void func_8006DDC8(s16, s32, s16);
void func_80072080(s16);
void func_80025F10(s16, s32);
s16 func_8007194C(s32, s32, s32);
void func_8001D520(s32, Vec3f*, Vec3f*);
void func_8001D520(s16, Vec3f*, Vec3f*);
void func_80070D90(s16);
s16 func_8006D010(s16, s16, s16, s16, s32, s32);
void func_800F86EC(void);
@ -221,7 +221,6 @@ void func_80055A34(s32);
void func_8003C314(s8 a, void* ptr, s32 c, s32 d);
void func_8003E174(Object* ptr);
void func_800584F0(s32 unk);
void InitCameras(s32 count);
void SetPlayerOntoChain(s16 player, s16 chain_index, s16 space_index);
void func_80056AF4(void);
s32 func_8004B850(void);
@ -277,7 +276,7 @@ omObjData* func_8004E3E0(s32, Vec3f*, s32, void*); //arg2 should be Vec3f*
void func_80055960(s32, s32);
void omSetRot(omObjData*, f32, f32, f32);
void omSetSca(omObjData*, f32, f32, f32);
void InitCameras(s32);
void InitCameras(s16 count);
void func_8005AD18(void);
void func_80062450(void);
s32 func_8005CE48(s32);
@ -295,8 +294,8 @@ u16 func_800174F4(s32, s32);
void func_8001775C(omObjData*, u16, s32);
void func_800264F8(s16 arg0, s16 arg1, f32 arg2, char* arg3, char* arg4, s32 arg5);
f32 sinf(f32);
void func_8001D420(s32, Vec3f*, Vec3f*, Vec3f*);
void func_8001D57C(s32);
void func_8001D420(s16, Vec3f*, Vec3f*, Vec3f*);
void func_8001D57C(s16);
f32 func_800B1750(f32);
void SetBasicSpriteSize(u16, f32, f32);
void func_80018E50(s32, u16, s32);
@ -469,7 +468,7 @@ void* func_8005B7E8(s32 stringIndex);
void func_800230D0(s32);
void func_8001AAC4(Gfx*, u16, s32, OSMesgQueue*, s32);
s16 func_8001CD00(u8*);
void func_8001D40C(void);
void func_8001D40C();
void func_8001D7DC(s16, Gfx**);
void func_80023040(void);
void func_800230D0(s32);
@ -508,8 +507,10 @@ void func_8009EA40(Matrix4f, f32, f32, f32);
void func_800A0A20(Matrix4f, void*);
void func_800A2A50(Matrix4f);
//void guLookAtHilite (Mtx*, LookAt*, Hilite*, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, s32, s32);
void guLookAt(Mtx*, f32, f32, f32, f32, f32, f32, f32, f32, f32);
void guLookAtReflect(Mtx*, LookAt*, f32, f32, f32, f32, f32, f32, f32, f32, f32);
void guMtxIdentF(Matrix4f);
void guPerspective(Mtx*, u16*, f32, f32, f32, f32, f32);
void* func_80023668(s32);
void MtxMult(Matrix4f, Matrix4f, Matrix4f);
u32 MtxReset(Matrix4f, Matrix4f);
@ -526,10 +527,10 @@ s32 _CheckFlag(s32);
s32 PlayerHasCoins(s32 index, s32 count);
s16 RNGPercentChance(s8);
s32 func_8004FEBC(s16);
void HuGuLookAtF(f32 mf[4][4], f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp);
void HuGuLookAtF(Matrix4f matrix, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp);
void WriteEeprom(s32 arg0, void* arg1, s16 arg2);
void func_8001A498(void);
void func_8005B024(void);
void func_8005B280(void);
void func_8005B3B0(void);
#endif
#endif

View File

@ -154,4 +154,9 @@ extern u32 D_800C4230[];
extern u32 D_800C4240[];
extern s32 D_800ECB24;
extern s32 D_800F3FF0;
extern s16 D_800C4C30[7];
extern s16 D_800C4C30[7];
extern s16 D_800ECB00;
extern Vec3f D_800C3114;
extern Vec3f D_800C3150;
extern Vec4f D_800C318C;
extern Mtx* D_800F2BCC;

View File

@ -1,31 +1,108 @@
#include "common.h"
INCLUDE_ASM("asm/nonmatchings/1DE40", InitCameras);
void InitCameras(s16 count) {
s16 j;
s16 i;
void func_8001D40C(void) {
D_800ECB00 = count;
D_800F3FA8 = 0;
if (D_800C3110 != NULL) {
func_80023728(D_800C3110);
}
D_800C3110 = func_80023668(0x1DD0);
for (i = 0; i < 6; i++) {
D_800C3110[i].unk_40 = 45.0f;
D_800C3110[i].unk_44 = 80.0f;
D_800C3110[i].unk_48 = 8000.0f;
D_800C3110[i].unk4E = 0;
func_8001D520(i, &D_800C3114, &D_800C3150);
func_8001D4D4(i, &D_800C318C);
D_800C3110[i].unkE8 = 0;
D_800C3110[i].unkF0 = 0;
D_800C3110[i].unkF4 = 0;
for (j = 0; j < D_800F37DA; j++) {
func_800A2B40(&D_800C3110[i].unkF8 + j * 2);
func_800A2B40(&D_800C3110[i].unkF8 + j * 2 + 1);
}
}
D_800F32A0 = (camera *) D_800C3110;
D_800F2BCC = &D_800C3110->unkF8;
}
void func_8001D40C() {
D_800F3FA8 = D_800F37F0;
}
INCLUDE_ASM("asm/nonmatchings/1DE40", func_8001D420);
void func_8001D420(s16 index, Vec3f *arg1, Vec3f *arg2, Vec3f *arg3) {
unk_Struct00 *temp_v0;
INCLUDE_ASM("asm/nonmatchings/1DE40", func_8001D494);
temp_v0 = &D_800C3110[index];
temp_v0->pos = *arg1;
temp_v0->unkC = *arg2;
temp_v0->unk18 = *arg3;
}
INCLUDE_ASM("asm/nonmatchings/1DE40", func_8001D4D4);
void func_8001D494(s16 index, f32 arg1, f32 arg2, f32 arg3) {
unk_Struct00 *temp_v0;
INCLUDE_ASM("asm/nonmatchings/1DE40", func_8001D520);
temp_v0 = &D_800C3110[index];
temp_v0->unk_40 = arg1;
temp_v0->unk_44 = arg2;
temp_v0->unk_48 = arg3;
temp_v0->unk4C = 1;
}
INCLUDE_ASM("asm/nonmatchings/1DE40", func_8001D57C);
void func_8001D4D4(s16 index, Vec4f *arg1) {
unk_Struct00 *temp_v0;
temp_v0 = &D_800C3110[index];
temp_v0->unkD8.x = arg1->x;
temp_v0->unkD8.y = arg1->y;
temp_v0->unkD8.z = arg1->z;
temp_v0->unkD8.w = arg1->w;
}
void func_8001D520(s16 index, Vec3f *arg1, Vec3f *arg2) {
unk_Struct00 *temp_v0;
temp_v0 = &D_800C3110[index];
temp_v0->unk24 = *arg1;
temp_v0->unk30 = *arg2;
}
void func_8001D57C(s16 index) {
unk_Struct00 *temp_s0;
Mtx *temp_s1;
temp_s0 = &D_800C3110[index];
temp_s1 = &temp_s0->unkF8 + (D_800F3FA8 << 1);
guPerspective(temp_s1, &temp_s0->unk4C, temp_s0->unk_40, (4.0f / 3.0f), temp_s0->unk_44, temp_s0->unk_48, 1.0f);
guLookAt(temp_s1 + 0x1, temp_s0->pos.x, temp_s0->pos.y, temp_s0->pos.z, temp_s0->unkC.x, temp_s0->unkC.y, temp_s0->unkC.z, temp_s0->unk18.x, temp_s0->unk18.y, temp_s0->unk18.z);
}
INCLUDE_ASM("asm/nonmatchings/1DE40", func_8001D658);
INCLUDE_ASM("asm/nonmatchings/1DE40", func_8001D7DC);
void func_8001D7DC(s16 index, Gfx **arg1) {
unk_Struct00 *temp_a2;
INCLUDE_ASM("asm/nonmatchings/1DE40", func_8001D8A0);
temp_a2 = &D_800C3110[index];
gDPSetScissor((*arg1)++, G_SC_NON_INTERLACE, temp_a2->unkD8.x, temp_a2->unkD8.y, temp_a2->unkD8.z, temp_a2->unkD8.w)
}
INCLUDE_ASM("asm/nonmatchings/1DE40", func_8001D8D4);
void func_8001D8A0(s16 index, s32 arg1, s32 arg2) {
unk_Struct00 *temp_v0;
void func_8001D904(s16 arg0, s32 arg1) {
D_800C3110[arg0].unkF4 = arg1;
temp_v0 = &D_800C3110[index];
temp_v0->unkE8 = arg1;
temp_v0->unkEC = arg2;
}
void func_8001D8D4(s16 index, s32 arg1) {
D_800C3110[index].unkF0 = arg1;
}
void func_8001D904(s16 index, s32 arg1) {
D_800C3110[index].unkF4 = arg1;
}
void Convert3DTo2D(s16 index, Vec3f* arg1, Vec2f* arg2) {
@ -37,9 +114,9 @@ void Convert3DTo2D(s16 index, Vec3f* arg1, Vec2f* arg2) {
f32 temp_f2;
f32 temp_f30;
unk_Struct00 *temp_s0;
temp_s0 = &D_800C3110[index];
HuGuLookAtF(sp28, temp_s0->pos.x, temp_s0->pos.y, temp_s0->pos.z, temp_s0->unkC, temp_s0->unk10, temp_s0->unk14, temp_s0->unk18, temp_s0->unk1C, temp_s0->unk20);
HuGuLookAtF(sp28, temp_s0->pos.x, temp_s0->pos.y, temp_s0->pos.z, temp_s0->unkC.x, temp_s0->unkC.y, temp_s0->unkC.z, temp_s0->unk18.x, temp_s0->unk18.y, temp_s0->unk18.z);
temp_f30 = arg1->x;
temp_f28 = arg1->y;
temp_f2 = arg1->z;
@ -50,11 +127,56 @@ void Convert3DTo2D(s16 index, Vec3f* arg1, Vec2f* arg2) {
temp_f22 = ((temp_f30 * sp28[0][1]) + (temp_f28 * sp28[1][1])) + (temp_f2 * sp28[2][1]);
temp_f20 = ((temp_f30 * sp28[0][2]) + (temp_f28 * sp28[1][2])) + (temp_f2 * sp28[2][2]);
temp_f30 = func_800AEAC0(temp_s0->unk_40 / 2.0f) / func_800AEFD0(temp_s0->unk_40 / 2.0f) * temp_f20 * (4.0f / 3.0f);
temp_f28 = (func_800AEAC0(temp_s0->unk_40 / 2.0f) / func_800AEFD0(temp_s0->unk_40 / 2.0f)) * temp_f20;
temp_f28 = (func_800AEAC0(temp_s0->unk_40 / 2.0f) / func_800AEFD0(temp_s0->unk_40 / 2.0f)) * temp_f20;
arg2->x = (temp_f24 * (160.0f / (-temp_f30))) + 160.0f;
arg2->y = ((temp_f22 * (120.0f / temp_f28)) + 120.0f);
}
INCLUDE_ASM("asm/nonmatchings/1DE40", func_8001DB2C);
void func_8001DB2C(s16 index, Vec3f *arg1, Vec2f *arg2) {
Matrix4f sp28;
f32 temp_f0;
f32 temp_f20;
f32 temp_f22;
f32 temp_f24;
f32 temp_f28;
f32 temp_f30;
f32 temp_f2;
f32 temp_f2_2;
unk_Struct00 *temp_s0;
INCLUDE_ASM("asm/nonmatchings/1DE40", func_8001DD24);
temp_s0 = &D_800C3110[index];
HuGuLookAtF(sp28, temp_s0->pos.x, temp_s0->pos.y, temp_s0->pos.z, temp_s0->unkC.x, temp_s0->unkC.y, temp_s0->unkC.z, temp_s0->unk18.x, temp_s0->unk18.y, temp_s0->unk18.z);
temp_f30 = arg1->x;
temp_f28 = arg1->y;
temp_f2 = arg1->z;
temp_f30 -= temp_s0->pos.x;
temp_f28 -= temp_s0->pos.y;
temp_f2 -= temp_s0->pos.z;
temp_f24 = (temp_f30 * sp28[0][0]) + (temp_f28 * sp28[1][0]) + (temp_f2 * sp28[2][0]);
temp_f22 = (temp_f30 * sp28[0][1]) + (temp_f28 * sp28[1][1]) + (temp_f2 * sp28[2][1]);
temp_f20 = (temp_f30 * sp28[0][2]) + (temp_f28 * sp28[1][2]) + (temp_f2 * sp28[2][2]);
temp_f30 = func_800AEAC0(temp_s0->unk_40 / 2.0f) / func_800AEFD0(temp_s0->unk_40 / 2.0f) * temp_f20 * (temp_s0->unk24.x / temp_s0->unk24.y);
temp_f28 = func_800AEAC0(temp_s0->unk_40 / 2.0f) / func_800AEFD0(temp_s0->unk_40 / 2.0f) * temp_f20;
temp_f2_2 = temp_s0->unk30.x / 4.0f;
arg2->x = temp_f24 * (temp_f2_2 / -temp_f30) + temp_f2_2;
temp_f0 = temp_s0->unk30.y / 4.0f;
arg2->y = temp_f22 * (temp_f0 / temp_f28) + temp_f0;
}
void func_8001DD24(s16 index, f32 arg1, Vec3f *arg2, Vec2f *arg3) {
Matrix4f sp28;
f32 temp_f20;
f32 temp_f4;
f32 unk_var1;
f32 unk_var2;
unk_Struct00 *temp_s0;
temp_s0 = &D_800C3110[index];
HuGuLookAtF(sp28, temp_s0->pos.x, temp_s0->pos.y, temp_s0->pos.z, temp_s0->unkC.x, temp_s0->unkC.y, temp_s0->unkC.z, temp_s0->unk18.x, temp_s0->unk18.y, temp_s0->unk18.z);
temp_f20 = func_800AEAC0(temp_s0->unk_40 / 2.0f) / func_800AEFD0(temp_s0->unk_40 / 2.0f) * arg1;
temp_f4 = temp_f20 * (4.0f / 3.0f);
unk_var1 = arg2->x / 320.0f;
unk_var2 = (240.0f - arg2->y) / 240.0f;
arg3->x = 2.0f * temp_f4 * unk_var1 - temp_f4;
arg3->y = 2.0f * temp_f20 * unk_var2 - temp_f20;
}

View File

@ -86,7 +86,7 @@ void func_8004A7A4(void);
void func_8004AFFC(void);
void func_8004B7F8(s32);
void func_8004ACEC(void);
void func_8004A19C(s16, s16);
void func_8004A19C(s16, s16);
extern void func_8007F54C(void*, void*, s32, Unk800D673C*);
extern void func_8007FAC0(void);
@ -146,7 +146,7 @@ INCLUDE_ASM("asm/nonmatchings/48D90", func_80049F0C);
void LoadBackgroundIndex(s32 arg0) {
unkStruct17* temp_v0;
s32 temp_s0;
D_800F6598 = arg0;
D_800D6728 = (u8*)((u8*)D_800D6720 + D_800C4F70[arg0]);
temp_v0 = MallocTemp(sizeof(unkStruct17));
@ -313,7 +313,7 @@ void func_8004A684(void) {
var_s0->unk2 = -1;
var_s0->data = func_80023668(0x1800);
var_s0->archive = NULL;
var_s0++;
var_s0++;
}
bzero(&D_800D6A60, sizeof(Object));
}
@ -324,7 +324,7 @@ void func_8004A6F8(void) {
var_v1 = D_800D6740;
for(i = 0; i < 40; i++) {
if ((var_v1->archive == NULL) &&
if ((var_v1->archive == NULL) &&
((u16) var_v1->unk0 == 0)) {
var_v1->unk2 = -1;
}
@ -384,7 +384,7 @@ unk20* func_8004A890(u16 arg0) {
unk20* var_s1;
unk20* var_v1;
s32 i;
var_s1 = NULL;
for (var_v1 = D_800D6740, i = 0; i < 40; var_v1++, i++) {
if (var_v1->unk2 == -1) {
@ -394,13 +394,13 @@ unk20* func_8004A890(u16 arg0) {
return var_v1;
}
}
if (var_s1) {
u32 tblSize;
var_s1->unk0 = 1;
var_s1->unk2 = arg0;
var_s1->bytes = func_8004A868(arg0);
tblSize = func_8004A844(arg0);
var_s1->dirTblSize = tblSize;
var_s1->archive = MallocTemp(tblSize);
@ -427,9 +427,9 @@ void func_8004A950(void) {
((s32) var_s2 >= D_800C4F78->unkC)) {
D_800D6A60[j][i] = NULL;
} else {
D_800D6A60[j][i] = func_8004A890(func_8004A814(var_s1, var_s2));
D_800D6A60[j][i] = func_8004A890(func_8004A814(var_s1, var_s2));
}
}
}
}
}
@ -437,7 +437,7 @@ INCLUDE_ASM("asm/nonmatchings/48D90", func_8004AAA8);
INCLUDE_ASM("asm/nonmatchings/48D90", func_8004ACEC);
void func_8001D57C(s32);
void func_8001D57C(s16);
void omPrcSetStatBit(Process*, s32);
void func_8004B208(void);