diff --git a/include/functions.h b/include/functions.h index 932d3afe..1ef5c8c4 100644 --- a/include/functions.h +++ b/include/functions.h @@ -132,6 +132,7 @@ void func_80040CDC(void); u8 func_80058F14(u8 arg0, u8 arg1); void func_80059498(void); +void func_8005980C(f32 arg0); void func_80057D00(void); void func_80060FBC(u8*, f32*); @@ -149,6 +150,7 @@ void func_80084688(s32, s32); void func_800857DC(f32, f32, f32, f32); void func_80085890(f32, f32, f32, f32); void func_80086664(f32, f32); +void func_800869A0(f32 arg0, f32 arg1, s32 k, f32 arg3, s32 arg4, s32 arg5); void func_80087530(f32, f32, s32); void func_8008865C(void); void func_8008B5B0(f32 x, f32 y); diff --git a/include/structs.h b/include/structs.h index 38d10286..c5571641 100644 --- a/include/structs.h +++ b/include/structs.h @@ -119,7 +119,10 @@ typedef struct { typedef struct UnkStruct_D_80178280 { /* 0x000 */ char pad_0[0xC]; /* 0x00C */ f32 unk_00C; - /* 0x010 */ char pad_010[0x64]; + /* 0x010 */ char pad_010[0x48]; + /* 0x058 */ f32 unk_058; + /* 0x05C */ f32 unk_05C; + /* 0x060 */ char pad_060[0x14]; /* 0x074 */ f32 unk_074; /* 0x078 */ f32 unk_078; /* 0x07C */ f32 unk_07C; @@ -129,7 +132,9 @@ typedef struct UnkStruct_D_80178280 { /* 0x138 */ f32 unk_138; /* 0x13C */ char pad_13C[0x8C]; /* 0x1C8 */ s32 unk_1C8; - /* 0x1CC */ char pad_1CC[0x44]; + /* 0x1CC */ char pad_1CC[0x4]; + /* 0x1D0 */ s32 unk_1D0; + /* 0x1D4 */ char pad_1D4[0x3C]; /* 0x210 */ s32 unk_210; /* 0x214 */ char pad_214[0x10]; /* 0x224 */ s32 unk_224; @@ -145,9 +150,14 @@ typedef struct UnkStruct_D_80178280 { /* 0x2C0 */ char pad_2C0[0x220]; } UnkStruct_D_80178280; // size = 0x4E0 -typedef struct { +/** + * func_800612B8 does a mem_cpy of size 0x24 + * sugesting this to be an individual + * struct of that size +*/ +typedef struct UnkStruct_90A00_1C { char unk0[0x24]; -} UnkStruct_90A00_1C; +} UnkStruct_90A00_1C; // size 0x24 typedef struct { /* 0x000 */ ElementType1 unk_000; @@ -194,4 +204,26 @@ typedef struct { /* 0x18C */ Vec3f unk_18C[30]; } UnkStruct_func_80090A00; +typedef struct { + /* 0x00 */ ElementType1 unk_00; + /* 0x1C */ UnkStruct_90A00_1C unk_1C; + /* 0x40 */ char pad_40[0x4]; + /* 0x44 */ s16 unk_44; + /* 0x46 */ s16 unk_46; + /* 0x48 */ s16 unk_48; + /* 0x4A */ s16 unk_4A; + /* 0x4C */ char pad_4C[0x2]; + /* 0x4E */ s16 unk_4E; + /* 0x50 */ char pad_50[0x4]; + /* 0x54 */ f32 unk_54; + /* 0x58 */ f32 unk_58; + /* 0x5C */ f32 unk_5C; + /* 0x60 */ char pad_60[0xC]; + /* 0x6C */ f32 unk_6C; + /* 0x70 */ f32 unk_70; + /* 0x74 */ char pad_74[0xC]; + /* 0x80 */ f32 unk_80[1]; // unknown size + /* 0x84 */ char pad_84[0x8]; +} UnkStruct_func_80094BBC; // size 0x8C + #endif diff --git a/include/variables.h b/include/variables.h index a122c72e..26a29430 100644 --- a/include/variables.h +++ b/include/variables.h @@ -230,6 +230,7 @@ extern u8 D_80161A90[]; extern s16 D_80161AA0[]; extern UnkStruct_func_80090A00 D_80163FE0[60]; extern UnkStruct_D_8016F110 D_8016F110[]; +extern UnkStruct_func_80094BBC D_80173754[100]; // size intued by func_800933D8 loop extern UnkStruct_D_80175A10 D_80175A10[]; extern s32 D_801774F8; extern s32 D_80177820; @@ -430,6 +431,7 @@ extern u16 D_1012988[]; extern u8 D_10129C0[]; extern u16 D_1013090[]; extern Gfx D_1015510[]; +extern Gfx D_1023750[]; extern Gfx D_1024230[]; extern Gfx D_1024830[]; extern u8 D_1024A58[]; @@ -484,6 +486,16 @@ extern u8 D_5000380[]; extern u8 D_5000400[]; extern u8 D_5000480[]; extern s32 D_50077B0; +extern u8 D_5009F60[]; +extern u8 D_500A050[]; +extern u8 D_500A140[]; +extern u8 D_500A230[]; +extern u8 D_500A320[]; +extern u8 D_500A410[]; +extern u8 D_500A500[]; +extern u8 D_500A5F0[]; +extern u8 D_500A6E0[]; +extern u8 D_500A7D0[]; extern Gfx D_6004570[]; extern Gfx D_D0098B0[]; diff --git a/src/main/sf_hud.c b/src/main/sf_hud.c index 8e234359..42e68f65 100644 --- a/src/main/sf_hud.c +++ b/src/main/sf_hud.c @@ -164,7 +164,39 @@ s32 func_800863C8(void) { #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_hud/func_80086664.s") +#ifdef IMPORT_DATA_PENDING +void func_800869A0(f32 arg0, f32 arg1, s32 k, f32 arg3, s32 arg4, s32 arg5) { + s32 var_s2; + s32 i; + s32 j; + + u8* D_800D1CD4[] = { + D_5009F60, D_500A050, D_500A140, D_500A230, D_500A320, D_500A410, D_500A500, D_500A5F0, D_500A6E0, D_500A7D0, + }; + + if (arg4 != 0) { + var_s2 = false; + } else { + var_s2 = true; + } + + i = arg5 + 1; + k %= i; + + for (i /= 10; i != 1; i /= 10) { + j = k / i; + if ((j != 0) || (var_s2 == true)) { + func_8009D994(&gMasterDisp, D_800D1CD4[j], 16, 15, arg0, arg1, arg3, arg3); + arg0 += 13.0f * arg3; + k %= i; + var_s2 = true; + } + } + func_8009D994(&gMasterDisp, D_800D1CD4[k], 16, 15, arg0, arg1, arg3, arg3); +} +#else #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_hud/func_800869A0.s") +#endif void func_80086C08(f32 arg0, f32 arg1, f32 arg2, f32 arg3) { func_800B8DD0(&gMasterDisp, 0x4E); @@ -518,7 +550,36 @@ void func_80089E98(s32 arg0) { #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_hud/func_8008A4DC.s") -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_hud/func_8008AC54.s") +s32 func_8008AC54(s32 arg0) { + UnkStruct_func_80090A00* var_a1; + s32 i; + s32 ret = 0; + + for (i = 0, var_a1 = D_80163FE0; i < 60; i++, var_a1++) { + switch (arg0) { + case 0: + if ((var_a1->unk_000.unk_00 == 2) && (var_a1->unk_000.unk_02 == 0xBE)) { + ret++; + } + break; + + case 1: + if ((var_a1->unk_000.unk_00 == 2) && (var_a1->unk_000.unk_02 == 0xBF)) { + ret++; + } + break; + + case 2: + if (((var_a1->unk_000.unk_02 == 0xBE) || (var_a1->unk_000.unk_02 == 0xBF)) && + (var_a1->unk_000.unk_00 == 2)) { + ret++; + } + break; + } + } + + return ret; +} void func_8008AD94(void) { if (D_80177834 == 7) { @@ -1992,15 +2053,147 @@ void func_800922F4(UnkStruct_func_80090A00* arg0) { #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_hud/func_80093164.s") -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_hud/func_80093310.s") +void func_80093310(void) { + UnkStruct_func_80090A00* this = D_80163FE0; -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_hud/func_800933D8.s") + func_800613C4(&D_80163FE0); + this->unk_000.unk_00 = 1; + this->unk_000.pos.x = 0.0f; + this->unk_000.pos.y += 1700.0f; + this->unk_000.pos.z -= 5000.0f; + D_80163FE0->unk_0B6 = 1; + if (1) {} + this->unk_000.unk_02 = 195; + func_800612B8(&this->unk_01C, this->unk_000.unk_02); + func_80019218(0x11030010, this->unk_100, 0, &D_800C5D34, &D_800C5D34, &D_800C5D3C); +} + +void func_800933D8(f32 x, f32 y, f32 z, f32 arg3) { + s32 i; + UnkStruct_func_80094BBC* var_s0 = D_80173754; + UnkStruct_D_80178280* sp24 = D_80178280; + + for (i = 0; i < 100; i++) { + if (var_s0->unk_00.unk_00 == 0) { + func_80061474(var_s0); + var_s0->unk_00.unk_00 = 1; + var_s0->unk_00.unk_02 = 0x16B; + var_s0->unk_00.pos.x = x; + var_s0->unk_00.pos.y = y; + var_s0->unk_00.pos.z = z; + + if ((sp24->unk_1C8 == 2) && (D_80178234 == 13) && (sp24->unk_1D0 < 2)) { + var_s0->unk_6C = 0.4f; + var_s0->unk_44 = 0; + var_s0->unk_46 = 24; + var_s0->unk_48 = Rand_ZeroOne() * 4.0f; + if (Rand_ZeroOne() < 0.5f) { + var_s0->unk_48 = -var_s0->unk_48; + } + } else { + var_s0->unk_54 = (Rand_ZeroOne() - 0.5f) * 5.0f; + var_s0->unk_58 = (Rand_ZeroOne() - 0.5f) * 3.0f; + var_s0->unk_48 = 0; + + if (Rand_ZeroOne() < 0.5f) { + var_s0->unk_48 = -var_s0->unk_48; + } + + if (sp24->unk_1D0 >= 5) { + var_s0->unk_4A = 0x60; + var_s0->unk_46 = 4; + } else { + var_s0->unk_4A = 0x80; + var_s0->unk_46 = 2; + } + } + + var_s0->unk_70 = arg3 * 0.2f; + var_s0->unk_00.unk_10.z = Rand_ZeroOne() * 360.0f; + func_800612B8(&var_s0->unk_1C, var_s0->unk_00.unk_02); + break; + } + var_s0--; + } +} #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_hud/func_800935E8.s") -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_hud/func_80094954.s") +void func_80094954(UnkStruct_func_80094BBC* arg0) { + UnkStruct_D_80178280* temp = D_80178280; -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_hud/func_80094BBC.s") + if ((temp->unk_1C8 == 2) && (D_80178234 == 13) && (temp->unk_1D0 < 2)) { + switch (arg0->unk_4E) { + case 0: + arg0->unk_44 += arg0->unk_46; + arg0->unk_4A = arg0->unk_44; + arg0->unk_70 += 0.01f; + + if (arg0->unk_4A >= 200) { + arg0->unk_4E = 1; + arg0->unk_4A = 200; + } + break; + + case 1: + arg0->unk_4A -= arg0->unk_46; + arg0->unk_70 -= 0.1f; + break; + } + + if ((arg0->unk_4E == 1) && (arg0->unk_4A <= 0)) { + func_80060FBC(arg0, arg0->unk_80); + } + + arg0->unk_58 += arg0->unk_6C; + arg0->unk_6C -= 0.05f; + + if (arg0->unk_6C < -1.0f) { + arg0->unk_6C = -1.0f; + } + arg0->unk_00.unk_10.z += arg0->unk_48; + return; + } + + if (temp->unk_1C8 == 7) { + arg0->unk_00.unk_10.x = temp->unk_05C * 180.0f / M_PI; + arg0->unk_00.unk_10.y = -temp->unk_058 * 180.0f / M_PI; + } + + if (temp->unk_1C8 == 6) { + arg0->unk_46 = 2; + if (temp->unk_1D0 >= 4) { + arg0->unk_58 -= 0.13f; + } + } + + arg0->unk_70 += 0.8f; + arg0->unk_4A -= arg0->unk_46; + + if ((arg0->unk_4A < 0) || ((temp->unk_1C8 == 2) && (D_80178234 == 13) && (temp->unk_1D0 == 5))) { + func_80060FBC(arg0, arg0->unk_80); + } + arg0->unk_00.unk_10.z += arg0->unk_48; +} + +void func_80094BBC(UnkStruct_func_80094BBC* arg0) { + UnkStruct_D_80178280* temp = D_80178280; + + if ((temp->unk_1C8 == 2) && (D_80178234 == 13) && (temp->unk_1D0 < 2)) { + func_800B8DD0(&gMasterDisp, 0x44); + gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 21, 34, arg0->unk_4A); + gDPSetEnvColor(gMasterDisp++, 255, 255, 251, 0); + func_8005980C(arg0->unk_70); + gSPDisplayList(gMasterDisp++, D_1023750); + } else { + func_8005980C(arg0->unk_70); + gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, arg0->unk_4A); + gSPDisplayList(gMasterDisp++, D_1023750); + } +} + +void stub_80094D10(void){}; +void stub_80094D18(void){}; #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_hud/func_80094D20.s")