From 0bc12ffeb8fbbd6f8b305bfaf352c9f2153940d5 Mon Sep 17 00:00:00 2001 From: Kelebek1 Date: Wed, 16 Oct 2024 15:05:48 +0100 Subject: [PATCH] fragment17 --- include/global.h | 59 +- include/sections.h | 1 + include/variables.h | 9 +- linker_scripts/us/symbol_addrs.txt | 7 + linker_scripts/us/undefined_syms.ld | 7 + src/11BA0.c | 2 +- src/11BA0.h | 2 +- src/19840.c | 4 +- src/19840.h | 2 +- src/1C720.c | 22 +- src/1C720.h | 16 +- src/20470.c | 2 +- src/22630.c | 2 +- src/26820.h | 3 + src/29BA0.h | 3 +- src/2E110.c | 14 +- src/2E110.h | 11 +- src/30640.h | 4 +- src/fragments/15/fragment15.h | 4 +- src/fragments/15/fragment15_14CA70.c | 6 +- src/fragments/16/fragment16.h | 1 - src/fragments/16/fragment16_158A00.c | 4 +- src/fragments/16/fragment16_15A2B0.c | 16 +- src/fragments/17/fragment17.h | 349 ++++++ src/fragments/17/fragment17_15F9B0.c | 26 +- src/fragments/17/fragment17_15FA60.c | 558 ++++++++- src/fragments/17/fragment17_160CB0.c | 63 +- src/fragments/17/fragment17_161000.c | 146 ++- src/fragments/17/fragment17_161590.c | 114 +- src/fragments/17/fragment17_161E60.c | 1668 +++++++++++++++++++++++++- src/fragments/17/fragment17_164B00.c | 94 +- src/fragments/17/fragment17_165640.c | 1099 ++++++++++++++++- src/fragments/17/fragment17_168110.c | 164 ++- src/fragments/17/fragment17_1687E0.c | 370 +++++- src/fragments/17/fragment17_169510.c | 67 +- src/fragments/17/fragment17_169A40.c | 173 ++- src/fragments/17/fragment17_16A0E0.c | 451 ++++++- src/fragments/2/fragment2.c | 2 +- src/fragments/3/fragment3.h | 9 +- src/fragments/36/fragment36.c | 2 +- src/fragments/37/fragment37.c | 2 +- src/geo_layout.c | 26 +- src/geo_layout.h | 28 +- src/memory.h | 2 + tools/animation_script.py | 169 +++ tools/data2c.py | 125 +- tools/find_sym.py | 130 +- utils/m2ctx.py | 84 -- yamls/us/rom.yaml | 29 +- 49 files changed, 5654 insertions(+), 497 deletions(-) create mode 100644 src/fragments/17/fragment17.h create mode 100755 tools/animation_script.py delete mode 100755 utils/m2ctx.py diff --git a/include/global.h b/include/global.h index 54e63c96..bf9f647b 100644 --- a/include/global.h +++ b/include/global.h @@ -167,6 +167,7 @@ typedef struct unk_D_86002F34_000_014 { /* 0x04 */ u8* unk_04; } unk_D_86002F34_000_014; // size >= 0x8 +struct GraphNode; typedef s32 (*func_D_86002F34_000_010)(s32, struct GraphNode*); typedef struct GraphNode { @@ -237,7 +238,7 @@ typedef struct unk_D_86002F34_00C_0CC { } unk_D_86002F34_00C_0CC; // size >= 0x20 typedef struct unk_D_86002F34_00C { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ unk_D_86002F34_00C_018 unk_18; /* 0x24 */ unk_D_86002F34_00C_024 unk_24; /* 0x40 */ unk_D_86002F34_00C_040 unk_40; @@ -247,7 +248,7 @@ typedef struct unk_D_86002F34_00C { } unk_D_86002F34_00C; // size = 0xF0 typedef struct unk_D_86002F34_alt1 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ s16 unk_18; /* 0x1A */ u16 unk_1A; /* 0x1C */ s8 unk_1C; @@ -257,32 +258,32 @@ typedef struct unk_D_86002F34_alt1 { } unk_D_86002F34_alt1; // size >= 0x28 typedef struct unk_D_86002F34_alt2 { - /* 0x00 */ struct GraphNode unk_00; - /* 0x18 */ struct GraphNode* unk_18; + /* 0x00 */ GraphNode unk_00; + /* 0x18 */ GraphNode* unk_18; } unk_D_86002F34_alt2; // size >= 0x1C typedef struct unk_D_86002F34_alt3 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ s16 unk_18; /* 0x1A */ s16 unk_1A; /* 0x1C */ s32 unk_1C; } unk_D_86002F34_alt3; // size >= 0x20 typedef struct unk_D_86002F34_alt4 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ Color_RGBA8_u32 unk_18; /* 0x1C */ u16 unk_1C; /* 0x1E */ u16 unk_1E; } unk_D_86002F34_alt4; // size >= 0x20 typedef struct unk_D_86002F34_alt5 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ Vec3f unk_18; /* 0x24 */ Vec3s unk_24; } unk_D_86002F34_alt5; // size = 0x2C typedef struct unk_D_86002F34_alt6 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ Vec3s unk_18; /* 0x1E */ Vec3s unk_1E; /* 0x24 */ Vec3f unk_24; @@ -292,27 +293,27 @@ typedef struct unk_D_86002F34_alt6 { } unk_D_86002F34_alt6; // size = 0x34 typedef struct unk_D_86002F34_alt7 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ Gfx* unk_18; /* 0x1C */ s16 unk_1C; } unk_D_86002F34_alt7; // size = 0x20 typedef struct unk_D_86002F34_alt8 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ Gfx* unk_18; /* 0x1C */ MtxF unk_1C; } unk_D_86002F34_alt8; // size = 0x5C typedef struct unk_D_86002F34_alt9 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ Gfx* unk_18; /* 0x1C */ Vec3f unk_1C; /* 0x28 */ f32 unk_28; } unk_D_86002F34_alt9; // size = 0x2C typedef struct unk_D_86002F34_alt10 { - /* 0x00 */ struct GraphNode unk_00; - /* 0x18 */ s32 unk_18; + /* 0x00 */ GraphNode unk_00; + /* 0x18 */ Gfx* unk_18; /* 0x1C */ s16 unk_1C; /* 0x1E */ s16 unk_1E; /* 0x20 */ s16 unk_20; @@ -329,13 +330,13 @@ typedef struct unk_D_86002F34_alt11_018 { } unk_D_86002F34_alt11_018; // size >= 0xC typedef struct unk_D_86002F34_alt11 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ unk_D_86002F34_alt11_018* unk_18; /* 0x1C */ unk_D_86002F34_alt11_018* unk_1C; } unk_D_86002F34_alt11; // size >= 0x20 typedef struct unk_D_86002F34_alt12 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ s16 unk_18; /* 0x1A */ s16 unk_1A; /* 0x1C */ s16 unk_1C; @@ -343,29 +344,29 @@ typedef struct unk_D_86002F34_alt12 { } unk_D_86002F34_alt12; // size = 0x20 typedef struct unk_D_86002F34_alt13 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ s16 unk_18; } unk_D_86002F34_alt13; // size = 0x1C typedef struct unk_D_86002F34_alt14 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; } unk_D_86002F34_alt14; // size = 0x18 typedef struct unk_D_86002F34_alt15 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; } unk_D_86002F34_alt15; // size = 0x18 typedef struct unk_D_86002F34_alt16 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ u32 unk_18; } unk_D_86002F34_alt16; // size = 0x1C typedef struct unk_D_86002F34_alt17 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; } unk_D_86002F34_alt17; // size = 0x18 typedef struct unk_D_86002F34_alt18 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ u8 r; /* 0x19 */ u8 g; /* 0x1A */ u8 b; @@ -375,36 +376,36 @@ typedef struct unk_D_86002F34_alt18 { } unk_D_86002F34_alt18; // size = 0x20 typedef struct unk_D_86002F34_alt19 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ u8 r; /* 0x19 */ u8 g; /* 0x1A */ u8 b; } unk_D_86002F34_alt19; // size = 0x1C typedef struct unk_D_86002F34_alt20 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ s16 unk_18; /* 0x1A */ s16 unk_1A; } unk_D_86002F34_alt20; // size = 0x1C typedef struct unk_D_86002F34_alt21 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ s16 unk_18; /* 0x1A */ s16 unk_1A; } unk_D_86002F34_alt21; // size = 0x1C typedef struct unk_D_86002F34_alt22 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ Vec3f unk_18; } unk_D_86002F34_alt22; // size = 0x24 typedef struct unk_D_86002F34_alt23 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ s16 unk_18; } unk_D_86002F34_alt23; // size = 0x1C typedef struct unk_D_86002F34_alt24 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ s16 unk_18; /* 0x1A */ s16 unk_1A; /* 0x1C */ s16 unk_1C; @@ -422,7 +423,7 @@ typedef struct unk_D_86002F34_018 { /* 0x01 */ u8 unk_01; /* 0x02 */ u8 unk_02; /* 0x03 */ u8 unk_03; - /* 0x04 */ char pad04[0x2]; + /* 0x04 */ s16 unk_04; /* 0x06 */ s16 unk_06; /* 0x08 */ s32* unk_08; } unk_D_86002F34_018; // size = 0xC @@ -434,7 +435,7 @@ typedef struct unk_D_86002F34_01C { } unk_D_86002F34_01C; // size = 0xC typedef struct unk_D_86002F34 { - /* 0x00 */ struct GraphNode unk_00; + /* 0x00 */ GraphNode unk_00; /* 0x18 */ unk_D_86002F34_018* unk_18; /* 0x1C */ unk_D_86002F34_01C* unk_1C; /* 0x20 */ Vtx* unk_20; diff --git a/include/sections.h b/include/sections.h index 68208f61..186a94da 100644 --- a/include/sections.h +++ b/include/sections.h @@ -524,6 +524,7 @@ extern u8 _70D3A0_ROM_START[]; extern u8 _70D3A0_ROM_END[]; extern u8 D_70110[]; extern u8 D_70290[]; +extern u8 D_70B10[]; extern u8 D_124570[]; diff --git a/include/variables.h b/include/variables.h index e2067780..18c4e33e 100644 --- a/include/variables.h +++ b/include/variables.h @@ -202,7 +202,14 @@ extern u8* D_800FF9C0; extern s32 D_80075BCC[]; typedef struct unk_70D3A0 { - /* 0x00 */ char unk00[0x10]; + /* 0x00 */ f32 unk_00; + /* 0x04 */ f32 unk_04; + /* 0x08 */ f32 unk_08; + /* 0x0C */ f32 unk_0C; } unk_70D3A0; // size = 0x10 +typedef struct unk_D_70B10 { + /* 0x00 */ char unk00[0x20]; +} unk_D_70B10; // size = 0x20 + #endif diff --git a/linker_scripts/us/symbol_addrs.txt b/linker_scripts/us/symbol_addrs.txt index 61d8c3cc..3a892060 100644 --- a/linker_scripts/us/symbol_addrs.txt +++ b/linker_scripts/us/symbol_addrs.txt @@ -353,3 +353,10 @@ D_8690B5D0 = 0x8690B5D0; // size:0x24 D_86A06228 = 0x86A06228; // size:0xC D_86A06238 = 0x86A06238; // size:0xC D_86A06248 = 0x86A06248; // size:0xC +D_30074E0 = 0x30074E0; +D_30092E0 = 0x30092E0; +D_300B6E0 = 0x300B6E0; +D_300B980 = 0x300B980; +D_300BAD0 = 0x300BAD0; +D_300BED0 = 0x300BED0; +D_300C2D0 = 0x300C2D0; diff --git a/linker_scripts/us/undefined_syms.ld b/linker_scripts/us/undefined_syms.ld index e69de29b..93824b9a 100644 --- a/linker_scripts/us/undefined_syms.ld +++ b/linker_scripts/us/undefined_syms.ld @@ -0,0 +1,7 @@ +D_30074E0 = 0x30074E0; +D_30092E0 = 0x30092E0; +D_300B6E0 = 0x300B6E0; +D_300B980 = 0x300B980; +D_300BAD0 = 0x300BAD0; +D_300BED0 = 0x300BED0; +D_300C2D0 = 0x300C2D0; diff --git a/src/11BA0.c b/src/11BA0.c index 90eae21e..41ac13d3 100644 --- a/src/11BA0.c +++ b/src/11BA0.c @@ -417,7 +417,7 @@ unk_func_80011B94* func_80011B94(MainPoolState* arg0, unk_func_80011B94* arg1, s return arg1; } -unk_D_86002F34_alt10* func_80011BF4(MainPoolState* arg0, unk_D_86002F34_alt10* arg1, s16 arg2, s16 arg3, s32 arg4, +unk_D_86002F34_alt10* func_80011BF4(MainPoolState* arg0, unk_D_86002F34_alt10* arg1, s16 arg2, s16 arg3, Gfx* arg4, s16 arg5, s16 arg6, u8 r, u8 g, u8 b, u8 a) { if (arg0 != NULL) { arg1 = func_80002DCC(arg0, sizeof(unk_D_86002F34_alt10), 4); diff --git a/src/11BA0.h b/src/11BA0.h index 8fea9ab4..adc8bda7 100644 --- a/src/11BA0.h +++ b/src/11BA0.h @@ -50,7 +50,7 @@ unk_D_86002F34_alt8* func_80011A3C(MainPoolState* arg0, unk_D_86002F34_alt8* arg unk_D_86002F34_alt8* func_80011ABC(MainPoolState* arg0, unk_D_86002F34_alt8* arg1, s32 arg2, Gfx* arg3, Vec3f* arg4, Vec3s* arg5); unk_D_86002F34_alt9* func_80011B10(MainPoolState* arg0, unk_D_86002F34_alt9* arg1, s32 arg2, Gfx* arg3, Vec3f* arg4, f32 arg5); unk_func_80011B94* func_80011B94(MainPoolState* arg0, unk_func_80011B94* arg1, s32 arg2, Gfx* arg3); -unk_D_86002F34_alt10* func_80011BF4(MainPoolState* arg0, unk_D_86002F34_alt10* arg1, s16 arg2, s16 arg3, s32 arg4, s16 arg5, s16 arg6, u8 r, u8 g, u8 b, u8 a); +unk_D_86002F34_alt10* func_80011BF4(MainPoolState* arg0, unk_D_86002F34_alt10* arg1, s16 arg2, s16 arg3, Gfx* arg4, s16 arg5, s16 arg6, u8 r, u8 g, u8 b, u8 a); unk_D_86002F34_alt23* func_80011C98(MainPoolState* arg0, unk_D_86002F34_alt23* arg1, s16 arg2); unk_D_86002F34_alt24* func_80011CF0(MainPoolState* arg0, unk_D_86002F34_alt24* arg1, s32 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s32 arg9, u8 r, u8 g, u8 b, u8 a); diff --git a/src/19840.c b/src/19840.c index fddb3e8e..d863b1ac 100644 --- a/src/19840.c +++ b/src/19840.c @@ -501,10 +501,10 @@ unk_D_86002F30* func_80019D18(s32 arg0) { return sp24; } -s32 func_80019D90(unk_func_8001BEE8* arg0) { +unk_D_86002F30* func_80019D90(unk_func_80026268_arg0* arg0) { Fragment* sp2C; arg1_func_80010CA8 sp28; - s32 sp24 = 0; + unk_D_86002F30* sp24 = NULL; MemoryBlock* sp20; sp2C = func_8000484C(D_800ABE10.unk_A04.unk_00, arg0->unk_00 - 1); diff --git a/src/19840.h b/src/19840.h index 0599c8f5..05d058a8 100644 --- a/src/19840.h +++ b/src/19840.h @@ -81,7 +81,7 @@ s32 func_80019C58(unk_D_86002F58_004_000_010* arg0); s32 func_80019CA8(unk_D_86002F58_004_000_010* arg0); s32 func_80019CE0(unk_D_86002F58_004_000_010* arg0); unk_D_86002F30* func_80019D18(s32 arg0); -s32 func_80019D90(unk_func_8001BEE8* arg0); +unk_D_86002F30* func_80019D90(unk_func_80026268_arg0* arg0); s32 func_80019E18(s32 arg0, s32 arg1); arg1_func_80019420* func_80019EA0(s32 arg0); Fragment* func_80019F0C(MainPoolState* arg0, u32 arg1, s32 arg2, s32 arg3, PERSSZP* arg4, s32 arg5); diff --git a/src/1C720.c b/src/1C720.c index 04ac43ff..2e20fc9a 100644 --- a/src/1C720.c +++ b/src/1C720.c @@ -119,13 +119,12 @@ unk_D_86002F58_004_000_00C_028* func_8001BE90(unk_D_86002F58_004_000* arg0, s32 return var_v1; } -#ifdef NON_MATCHING -unk_D_86002F58_004_000_010_02C* func_8001BEE8(unk_D_86002F58_004_000_010_02C* arg0, unk_func_8001BEE8* arg1) { +unk_D_86002F58_004_000_010_02C* func_8001BEE8(unk_D_86002F58_004_000_010_02C* arg0, unk_func_80026268_arg0* arg1) { + UNUSED s32 pad; char sp38[0xB]; unk_D_86002F58_004_000_010_02C sp34; unk_D_8006FF00* sp30; - UNUSED unk_func_8001BEE8* sp20; - UNUSED s32 i; + UNUSED s32 pad2; u8 var_a0; s8* var_v1; @@ -135,16 +134,20 @@ unk_D_86002F58_004_000_010_02C* func_8001BEE8(unk_D_86002F58_004_000_010_02C* ar func_80021CA4(sp38, arg1->unk_00); if (HAL_Strcmp(arg1->unk_30, sp38) != 0) { - var_a0 = (arg1->unk_0E >> 8) + arg1->unk_0E; + var_a0 = ((arg1->unk_0E >> 8) & 0xFF) + (arg1->unk_0E & 0xFF); + + if (1) {} var_v1 = arg1->unk_30; while (*var_v1) { - var_a0 += *var_v1++; + var_a0 += *var_v1++ & 0xFF; + var_a0 += 0; } var_v1 = arg1->unk_3B; while (*var_v1) { - var_a0 += *var_v1++; + var_a0 += *var_v1++ & 0xFF; + var_a0 += 0; } sp34.unk_00 = ((((sp30->unk_12 - sp30->unk_10) << 6) * var_a0) / 255) + (sp30->unk_10 << 6); @@ -153,12 +156,9 @@ unk_D_86002F58_004_000_010_02C* func_8001BEE8(unk_D_86002F58_004_000_010_02C* ar *arg0 = sp34; return arg0; } -#else -#pragma GLOBAL_ASM("asm/us/nonmatchings/1C720/func_8001BEE8.s") -#endif void func_8001C014(s32* arg0, unk_func_8001C014* arg1, u16 arg2) { - unk_func_8001BEE8 stack; + unk_func_80026268_arg0 stack; stack.unk_00 = arg2; stack.unk_0E = arg1->unk_02; diff --git a/src/1C720.h b/src/1C720.h index af0509cf..5c7995f5 100644 --- a/src/1C720.h +++ b/src/1C720.h @@ -2,6 +2,7 @@ #define _1C720_H_ #include "global.h" +#include "src/29BA0.h" typedef struct unk_func_8001C014 { /* 0x00 */ char unk_00[0x2]; @@ -10,21 +11,10 @@ typedef struct unk_func_8001C014 { /* 0x14 */ s8 unk_14[0x10]; } unk_func_8001C014; // size >= 0x24 -typedef struct unk_func_8001BEE8 { - /* 0x00 */ u8 unk_00; - /* 0x01 */ char unk01[0xD]; - /* 0x0E */ u16 unk_0E; - /* 0x10 */ char unk10[0x20]; - /* 0x30 */ char unk_30[0xB]; - /* 0x3B */ char unk_3B[0xB]; - /* 0x48 */ char unk46[0xC]; - /* 0x52 */ u8 unk_52; -} unk_func_8001BEE8; // size >= 0x54 - typedef struct unk_func_8001C07C_arg0 { /* 0x00 */ u8 unk_00; /* 0x02 */ s16 unk_02; - /* 0x04 */ unk_func_8001BEE8* unk_04; + /* 0x04 */ unk_func_80026268_arg0* unk_04; /* 0x08 */ char unk_08[0x8]; /* 0x10 */ unk_D_86002F58_004_000_010* unk_10; /* 0x14 */ s32 unk_14; @@ -52,7 +42,7 @@ void func_8001BE34(unk_D_86002F58_004_000* arg0, u8 arg1, u8 arg2, u8 arg3, u8 a void func_8001BE78(unk_D_86002F58_004_000* arg0, u8 arg1); void func_8001BE84(unk_D_86002F58_004_000* arg0, u8 arg1); unk_D_86002F58_004_000_00C_028* func_8001BE90(unk_D_86002F58_004_000* arg0, s32 arg1); -unk_D_86002F58_004_000_010_02C* func_8001BEE8(unk_D_86002F58_004_000_010_02C* arg0, unk_func_8001BEE8* arg1); +unk_D_86002F58_004_000_010_02C* func_8001BEE8(unk_D_86002F58_004_000_010_02C* arg0, unk_func_80026268_arg0* arg1); void func_8001C014(s32* arg0, unk_func_8001C014* arg1, u16 arg2); void func_8001C07C(unk_func_8001C07C_arg0* arg0); void func_8001C198(unk_func_8001C248* arg0); diff --git a/src/20470.c b/src/20470.c index de957a43..98a2e53a 100644 --- a/src/20470.c +++ b/src/20470.c @@ -508,7 +508,7 @@ void func_80021270(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { } void func_80021920(void) { - s32 temp_s2 = func_8002D5AC(0x24); + char** temp_s2 = func_8002D5AC(0x24); s32 i; for (i = 0; i < 151; i++) { diff --git a/src/22630.c b/src/22630.c index a69cc281..954c7486 100644 --- a/src/22630.c +++ b/src/22630.c @@ -426,7 +426,7 @@ u8 func_80022A60(s32 arg0) { #pragma GLOBAL_ASM("asm/us/nonmatchings/22630/func_80022F24.s") void func_80023068(void) { - s32 sp1C = func_8002D5AC(0x11); + char** sp1C = func_8002D5AC(0x11); HAL_Strcpy(D_800AC890[0], func_8002D7C0(NULL, 0, sp1C, 0)); HAL_Strcpy(D_800AC890[1], func_8002D7C0(NULL, 0, sp1C, 1)); diff --git a/src/26820.h b/src/26820.h index 5a6cbd7a..a3787c66 100644 --- a/src/26820.h +++ b/src/26820.h @@ -36,6 +36,9 @@ void func_80027F40(unk_func_8002A728*); void func_80027FA0(unk_func_80027FA0*, s16); void func_80028070(u16*); void func_800280D4(u8); +void func_80028128(s32); +s32 func_8002816C(void); +void func_8002817C(u8, u8); void func_800281D4(unk_func_800281D4*, unk_func_80026268_arg0*, u8); s32 func_80028320(unk_func_800281D4*, unk_func_80026268_arg0*); s32 func_800284B4(s16); diff --git a/src/29BA0.h b/src/29BA0.h index 036e4954..b28f4179 100644 --- a/src/29BA0.h +++ b/src/29BA0.h @@ -83,7 +83,8 @@ typedef struct unk_D_800AE540_1194 { /* 0x04 */ unk_D_800AE540_0004* unk_08[2]; /* 0x04 */ char unk10[0x4]; /* 0x04 */ s32 unk_14; - /* 0x04 */ char unk18[0x5]; + /* 0x04 */ char unk18[0x4]; + /* 0x1C */ u8 unk_1C; /* 0x1D */ u8 unk_1D; /* 0x1E */ u8 unk_1E; /* 0x20 */ s32 unk_20; diff --git a/src/2E110.c b/src/2E110.c index fd269dee..e3d8f318 100644 --- a/src/2E110.c +++ b/src/2E110.c @@ -5,24 +5,24 @@ #define D_800AF740_NUM_FILES 42 static BinArchive* D_800AF740; -static s32* D_800AF744; +static char** D_800AF744; void func_8002D510(void) { s32 i; D_800AF740 = func_800044F4(textdata_ROM_START, NULL, 1, 0); - D_800AF744 = main_pool_alloc(D_800AF740_NUM_FILES * sizeof(s32), 0); + D_800AF744 = main_pool_alloc(D_800AF740_NUM_FILES * sizeof(char*), 0); for (i = 0; i < D_800AF740_NUM_FILES; i++) { - D_800AF744[i] = 0; + D_800AF744[i] = NULL; } } -char* func_8002D5AC(s32 file_number) { - return (char*)func_8000484C(D_800AF740, file_number); +char** func_8002D5AC(s32 file_number) { + return (char**)func_8000484C(D_800AF740, file_number); } -void func_8002D5D4(u32 arg0, s32 arg1) { +void func_8002D5D4(u32 arg0, char* arg1) { if ((arg0 >= 0x14) && (arg0 < 0x2A)) { D_800AF744[arg0] = arg1; } @@ -70,7 +70,7 @@ void func_8002D628(char* arg0, u32 arg1, s8* arg2) { } if ((temp_v0 >= 0x14) && (temp_v0 < 0x2A)) { - if (D_800AF744[temp_v0] != 0) { + if (D_800AF744[temp_v0] != NULL) { var_s4 = D_800AF744[temp_v0]; var_s2 = 1; } diff --git a/src/2E110.h b/src/2E110.h index 6bf11478..c9a98d79 100644 --- a/src/2E110.h +++ b/src/2E110.h @@ -4,10 +4,11 @@ #include "global.h" void func_8002D510(void); -char* func_8002D5AC(s32); -void func_8002D600(u32, s32); -char* func_8002D7C0(char* arg0, s32 arg1, char** arg2, u32 arg3); -s32 func_8002D80C(s8*); - +char** func_8002D5AC(s32 file_number); +void func_8002D5D4(u32 arg0, char* arg1); +void func_8002D600(u32 arg0, s32 arg1); +void func_8002D628(char* arg0, u32 arg1, s8* arg2); +char* func_8002D7C0(char* arg0, s32 arg1, char** arg2, u32 file_number); +s32 func_8002D80C(s8* arg0); #endif // _2E110_H_ diff --git a/src/30640.h b/src/30640.h index baa13b1f..ef61456a 100644 --- a/src/30640.h +++ b/src/30640.h @@ -18,8 +18,8 @@ typedef struct unk_D_83402EE0_070 { } unk_D_83402EE0_070; // size = 0x1A void func_8002FA40(void); -void func_8003107C(unk_D_83402EE0_070*, unk_func_8001BEE8*); -void func_80031140(unk_func_8001BEE8*, unk_D_83407AC8*); +void func_8003107C(unk_D_83402EE0_070*, unk_func_80026268_arg0*); +void func_80031140(unk_func_80026268_arg0*, unk_D_83407AC8*); f32 func_80031A6C(f32); void func_80031EF4(MtxF*, MtxF*); void func_80032034(MtxF* arg0, Vec3f* arg1); diff --git a/src/fragments/15/fragment15.h b/src/fragments/15/fragment15.h index 65af689a..fa243c98 100644 --- a/src/fragments/15/fragment15.h +++ b/src/fragments/15/fragment15.h @@ -91,7 +91,7 @@ extern const char D_8690A5C8[]; extern const char D_8690A5D8[]; extern const char D_8690A5E8[]; -extern char* D_8690A678; +extern char** D_8690A678; extern f32 D_8690A708; extern unk_D_8690A710* D_8690A710; extern unk_D_8690B2F8 D_8690B2F8; @@ -114,7 +114,7 @@ s32 func_86900088(s32 arg0, struct GraphNode* arg1); s32 func_869000F4(s32 arg0, struct GraphNode* arg1); void func_86900110(u8 arg0, u8 arg1, u8 arg2); void func_86900188(void); -unk_D_86002F58_004_000_010_024* func_86900244(unk_func_8001BEE8* arg0); +unk_D_86002F58_004_000_010_024* func_86900244(unk_func_80026268_arg0* arg0); void func_869002AC(void); void func_86900410(void); void func_86900484(s32 arg0); diff --git a/src/fragments/15/fragment15_14CA70.c b/src/fragments/15/fragment15_14CA70.c index f98941b7..0b3a3564 100644 --- a/src/fragments/15/fragment15_14CA70.c +++ b/src/fragments/15/fragment15_14CA70.c @@ -294,7 +294,7 @@ static unk_D_8690A610 D_8690A610; static unk_D_86002F58_004_000_000 D_8690A630; static unk_D_86002F58_004_000_000 D_8690A648; static unk_D_86002F58_004_000_000 D_8690A660; -char* D_8690A678; +char** D_8690A678; static s32 D_8690A67C; static s32 D_8690A680; static s32 pad_D_8690A684; @@ -304,7 +304,7 @@ static s32 pad_D_8690A690; static s32 pad_D_8690A694; static BinArchive* D_8690A698; static unk_D_8690A69C* D_8690A69C; -static unk_func_8001BEE8 D_8690A6A0; +static unk_func_80026268_arg0 D_8690A6A0; static s32 D_8690A6F4; static s32 D_8690A6F8; static s32 D_8690A6FC; @@ -406,7 +406,7 @@ void func_86900188(void) { func_80003B30(&D_8690B2F8, sp20, sp1C, 0); } -unk_D_86002F58_004_000_010_024* func_86900244(unk_func_8001BEE8* arg0) { +unk_D_86002F58_004_000_010_024* func_86900244(unk_func_80026268_arg0* arg0) { unk_D_86002F58_004_000_010_02C sp1C; unk_D_86002F58_004_000_010* sp18; diff --git a/src/fragments/16/fragment16.h b/src/fragments/16/fragment16.h index 1528b1e8..314dbf54 100644 --- a/src/fragments/16/fragment16.h +++ b/src/fragments/16/fragment16.h @@ -2,7 +2,6 @@ #define _FRAGMENT16_H_ #include "global.h" -#include "prevent_bss_reordering.h" typedef struct unk_D_86A025A0 { /* 0x00 */ s8 unk_00; diff --git a/src/fragments/16/fragment16_158A00.c b/src/fragments/16/fragment16_158A00.c index 68017e32..536fb682 100644 --- a/src/fragments/16/fragment16_158A00.c +++ b/src/fragments/16/fragment16_158A00.c @@ -44,7 +44,7 @@ u8 D_86A06210; u8 D_86A06211; u8 D_86A06212; unk_D_86A03014* D_86A06214; -char* D_86A06218; +char** D_86A06218; u32 D_86A0621C; u16 D_86A06220; u16 D_86A06222; @@ -1537,7 +1537,7 @@ s32 func_86A01020(Color_RGBA8_u32* arg0, u16 arg1, u16 arg2, u8 arg3) { #ifdef NON_MATCHING // Needs the in-fucntion static but that breaks bss ordering void func_86A013C8(u8 arg0, u8 arg1, unk_D_86A03014* arg2) { - static char* D_86A06218; + static char** D_86A06218; u16 i; u16 sp2C; diff --git a/src/fragments/16/fragment16_15A2B0.c b/src/fragments/16/fragment16_15A2B0.c index 57b83b08..a15a53f9 100644 --- a/src/fragments/16/fragment16_15A2B0.c +++ b/src/fragments/16/fragment16_15A2B0.c @@ -3202,7 +3202,7 @@ static unk_D_86A04328 D_86A04328[18][6] = { #ifdef NON_MATCHING void func_86A018D0(unk_D_86002F34_00C* arg0, u16 arg1, s8 arg2, u8 arg3) { - UNUSED s32 pad; + f32 scale = 1.0f; unk_D_86A04328* ptr = &D_86A04328[arg2 - 1][arg3 - 3]; Vec3f sp3C; Vec3f sp30; @@ -3223,15 +3223,15 @@ void func_86A018D0(unk_D_86002F34_00C* arg0, u16 arg1, s8 arg2, u8 arg3) { D_86A06254->unk_24.near = ptr->unk_30; D_86A06254->unk_24.far = ptr->unk_34; - D_86A06228.x = ((ptr->unk_14.x - ptr->unk_00.x) * 1) / arg1; - D_86A06228.y = ((ptr->unk_14.y - ptr->unk_00.y) * 1) / arg1; - D_86A06228.z = ((ptr->unk_14.z - ptr->unk_00.z) * 1) / arg1; + D_86A06228.x = ((ptr->unk_14.x - ptr->unk_00.x) * scale) / arg1; + D_86A06228.y = ((ptr->unk_14.y - ptr->unk_00.y) * scale) / arg1; + D_86A06228.z = ((ptr->unk_14.z - ptr->unk_00.z) * scale) / arg1; - D_86A06238.x = ((sp30.x - sp3C.x) * 1) / arg1; - D_86A06238.y = ((sp30.y - sp3C.y) * 1) / arg1; - D_86A06238.z = ((sp30.z - sp3C.z) * 1) / arg1; + D_86A06238.x = ((sp30.x - sp3C.x) * scale) / arg1; + D_86A06238.y = ((sp30.y - sp3C.y) * scale) / arg1; + D_86A06238.z = ((sp30.z - sp3C.z) * scale) / arg1; - D_86A06244 = ((ptr->unk_2C - ptr->unk_28) * 1) / arg1; + D_86A06244 = ((ptr->unk_2C - ptr->unk_28) * scale) / arg1; } #else #pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/16/fragment16_15A2B0/func_86A018D0.s") diff --git a/src/fragments/17/fragment17.h b/src/fragments/17/fragment17.h new file mode 100644 index 00000000..f778e6b9 --- /dev/null +++ b/src/fragments/17/fragment17.h @@ -0,0 +1,349 @@ +#ifndef _FRAGMENT17_H_ +#define _FRAGMENT17_H_ + +#include "global.h" + +typedef struct unk_D_86B0E5D4_04 { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ s16 unk_0C; + /* 0x0E */ s16 unk_0E; + /* 0x10 */ char unk10[0x2]; + /* 0x12 */ s16 unk_12; + /* 0x14 */ s16 unk_14; + /* 0x18 */ f32 unk_18; + /* 0x1C */ f32 unk_1C; + /* 0x20 */ s16 unk_20; + /* 0x22 */ s16 unk_22; + /* 0x24 */ char unk24[0x2]; + /* 0x26 */ s16 unk_26; + /* 0x28 */ s16 unk_28; + /* 0x2C */ f32 unk_2C; + /* 0x30 */ f32 unk_30; + /* 0x34 */ f32 unk_34; + /* 0x38 */ f32 unk_38; + /* 0x3C */ f32 unk_3C; + /* 0x40 */ char unk40[0x4]; + /* 0x44 */ s32 unk_44; + /* 0x48 */ s32 unk_48; + /* 0x4C */ s32 unk_4C; + /* 0x50 */ s32 unk_50; + /* 0x54 */ char unk54[0x14]; + /* 0x68 */ f32 unk_68; + /* 0x6C */ f32 unk_6C; + /* 0x70 */ f32 unk_70; + /* 0x74 */ f32 unk_74; +} unk_D_86B0E5D4_04; // size >= 0x78 + +typedef struct unk_D_86B0E5D4 { + /* 0x00 */ unk_D_86002F34_00C* unk_00; + /* 0x04 */ unk_D_86B0E5D4_04 unk_04; +} unk_D_86B0E5D4; // size = 0x7C + +typedef struct unk_D_86B0C160 { + /* 0x00 */ s16 unk_00; + /* 0x02 */ s16 unk_02; + /* 0x04 */ s16 unk_04; + /* 0x06 */ s16 unk_06; + /* 0x08 */ s16 unk_08; + /* 0x0C */ f32 unk_0C; + /* 0x10 */ f32 unk_10; + /* 0x14 */ s16 unk_14; + /* 0x16 */ s16 unk_16; + /* 0x18 */ s16 unk_18; + /* 0x1A */ s16 unk_1A; + /* 0x1C */ s16 unk_1C; + /* 0x20 */ f32 unk_20; + /* 0x24 */ f32 unk_24; + /* 0x28 */ f32 unk_28; + /* 0x2C */ f32 unk_2C; + /* 0x30 */ f32 unk_30; +} unk_D_86B0C160; // size = 0x34 + +typedef struct unk_D_86B0E5F0 { + /* 0x000 */ unk_D_86002F30* unk_000; + /* 0x004 */ unk_D_86002F58_004_000 unk_004; + /* 0x16C */ s32 unk_16C; +} unk_D_86B0E5F0; // size = 0x170 + +typedef struct unk_D_86B0C4C8 { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ u8 unk_0C; + /* 0x0E */ s16 unk_0E; + /* 0x10 */ u16 unk_10; + /* 0x12 */ char unk12[0x2]; +} unk_D_86B0C4C8; // size = 0x14 + +typedef struct unk_D_86B0DAE0_000 { + /* 0x00 */ u16 unk_00; + /* 0x02 */ u16 unk_02; + /* 0x04 */ u16 unk_04; + /* 0x06 */ u16 unk_06; + /* 0x08 */ u16 unk_08; + /* 0x0A */ u16 unk_0A; + /* 0x0C */ u16 unk_0C; + /* 0x0E */ u16 unk_0E; + /* 0x10 */ u16 unk_10; + /* 0x12 */ u16 unk_12; + /* 0x14 */ u16 unk_14; + /* 0x16 */ u16 unk_16; +} unk_D_86B0DAE0_000; // size = 0x18 + +typedef struct unk_D_86B0DAE0 { + /* 0x00 */ unk_D_86B0DAE0_000 unk_00; + /* 0x18 */ unk_D_86B0DAE0_000 unk_18; +} unk_D_86B0DAE0; // size = 0x30 + +typedef struct unk_D_86B0FA78 { + /* 0x000 */ unk_D_86002F30* unk_000; + /* 0x004 */ unk_D_86002F58_004_000 unk_004; + /* 0x16C */ s32 unk_16C; + /* 0x170 */ s32 unk_170; + /* 0x174 */ s32 unk_174; + /* 0x178 */ s32 unk_178; + /* 0x17C */ s32 unk_17C; + /* 0x180 */ s16 unk_180; +} unk_D_86B0FA78; // size = 0x184 + +typedef struct unk_D_86B0FA50 { + /* 0x00 */ char unk00[0x80]; + /* 0x80 */ s32 unk_80; + /* 0x84 */ s32 unk_84; + /* 0x88 */ s32 unk_88; + /* 0x8C */ s32 unk_8C; + /* 0x90 */ s32 unk_90; + /* 0x94 */ char unk94[0x4]; + /* 0x98 */ f32 unk_98; + /* 0x9C */ s16 unk_9C; + /* 0x9E */ s16 unk_9E; + /* 0xA0 */ s16 unk_A0; + /* 0xA4 */ f32 unk_A4; + /* 0xA8 */ f32 unk_A8; + /* 0xAC */ f32 unk_AC; + /* 0xB0 */ unk_D_86B0DAE0_000 unk_B0; +} unk_D_86B0FA50; // size = 0xC8 + +typedef struct unk_D_86B0FA7C { + /* 0x00 */ unk_D_86002F34_00C* unk_00; + /* 0x04 */ Vec3f unk_04; + /* 0x10 */ s16 unk_10; + /* 0x12 */ s16 unk_12; + /* 0x14 */ char unk14[0x2]; + /* 0x16 */ s16 unk_16; + /* 0x18 */ s16 unk_18; + /* 0x1C */ f32 unk_1C; + /* 0x20 */ f32 unk_20; + /* 0x24 */ s16 unk_24; + /* 0x26 */ s16 unk_26; + /* 0x28 */ char unk28[0x2]; + /* 0x2A */ s16 unk_2A; + /* 0x2C */ s16 unk_2C; + /* 0x30 */ f32 unk_30; + /* 0x34 */ f32 unk_34; + /* 0x38 */ f32 unk_38; + /* 0x3C */ f32 unk_3C; + /* 0x40 */ f32 unk_40; + /* 0x44 */ f32 unk_44; + /* 0x48 */ char unk48[0x34]; +} unk_D_86B0FA7C; // size = 0x7C + +typedef struct unk_D_86B0C264 { + /* 0x00 */ Vec3f unk_00; + /* 0x0C */ s16 unk_0C; + /* 0x0E */ s16 unk_0E; + /* 0x10 */ u16 unk_10; + /* 0x10 */ u16 unk_12; + /* 0x14 */ u16 unk_14; + /* 0x14 */ u16 unk_16; + /* 0x18 */ s16 unk_18; + /* 0x1A */ s16 unk_1A; +} unk_D_86B0C264; // size = 0x1C + +extern unk_D_86B0C160 D_86B0E040[]; +extern s32 D_86B0E5DC; +extern char** D_86B0E5E0; +extern unk_D_86B0FA78* D_86B0FA78; +extern unk_D_86B0FA7C* D_86B0FA7C; +extern unk_70D3A0 D_86B10660; + +s32 func_86B00020(UNUSED s32 arg0, UNUSED s32 arg1); + +s32 func_86B000D0(s32 arg0, GraphNode* arg1); +s32 func_86B00158(s32 arg0, GraphNode* arg1); +s32 func_86B00188(s32 arg0, GraphNode* arg1); +s32 func_86B001B8(s32 arg0, GraphNode* arg1); +void func_86B001D8(void); +void func_86B001FC(unk_D_86B0E5F0* arg0); +void func_86B00258(void); +void func_86B0027C(unk_D_86B0E5F0* arg0, unk_D_86B0C4C8* arg1); +void func_86B0032C(unk_D_86B0E5F0* arg0, unk_D_86B0C4C8* arg1); +void func_86B00348(s32 arg0); +void func_86B003CC(s32 arg0); +void func_86B00470(s32 arg0); +void func_86B0054C(s32 arg0); +void func_86B00680(void); +void func_86B00688(void); +void func_86B00794(void); +void func_86B007EC(void); +s32 func_86B00848(s32 arg0); +void func_86B008C4(void); +void func_86B00904(void); +void func_86B00944(s32 arg0); +void func_86B00AE4(void); +void func_86B00B14(void); +s32 func_86B00C34(void); +void func_86B01004(void); +void func_86B0100C(void); +void func_86B0107C(void); +void func_86B010FC(void); +void func_86B0111C(void); +s32 func_86B01190(void); + +u16 func_86B01320(s32); +Vec3f* func_86B01404(Vec3f*, Vec3f*); +void func_86B0145C(f32*, f32, f32); + +u16 func_86B01670(unk_D_86002F34_00C* arg0, unk_D_86002F58_004_000* arg1, s16 arg2, s16 arg3, f32 arg4, f32 arg5); +void func_86B01898(unk_D_86B0E5D4_04* arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4); +void func_86B018D4(unk_D_86B0E5D4_04* arg0, f32 arg1, f32 arg2); +void func_86B018E8(unk_D_86B0E5D4_04* arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4); +void func_86B01924(unk_D_86B0E5D4_04* arg0, f32 arg1, f32 arg2); +void func_86B01938(unk_D_86B0E5D4_04* arg0, f32 arg1, f32 arg2); +void func_86B0194C(unk_D_86B0C160* arg0, unk_D_86B0E5D4* arg1); +void func_86B01A40(unk_D_86B0E5D4_04* arg0, unk_D_86B0E5D4* arg1); +s32 func_86B01AAC(unk_D_86B0E5D4_04* arg0, unk_D_86B0E5D4* arg1); + +void func_86B01C00(u8*); +void func_86B01D8C(u8*, s32, s32, s32, s32, u8, u8); +void func_86B02348(void); + +s32 func_86B024D0(s32 arg0, GraphNode* arg1); +s32 func_86B02538(s32 arg0, GraphNode* arg1); +void func_86B025A4(void); +void func_86B026C0(void); +void func_86B028F8(void); +void func_86B02908(void); +void func_86B02928(void); +void func_86B0299C(void); +void func_86B02A78(void); +s32 func_86B02B50(void); +void func_86B02C9C(s16 arg0, s16 arg1); +void func_86B02ED0(s16 arg0, s16 arg1); +void func_86B02F34(void); +void func_86B02F8C(void); +void func_86B03048(void); +void func_86B034AC(void); +void func_86B03B9C(void); +s32 func_86B03DF4(void); +Gfx* func_86B040C0(void); +s32 func_86B04200(void); +s32 func_86B042B4(void); +s32 func_86B0434C(void); +void func_86B044A0(void); +void func_86B044B0(void); +void func_86B04500(void); +void func_86B04740(void); +void func_86B04794(void); +void func_86B04880(void); +void func_86B048D8(void); +void func_86B04914(void); +s32 func_86B04944(void); +void func_86B04C9C(void); +void func_86B04CF4(UNUSED s32 arg0); +void func_86B04D48(void); +void func_86B04D98(void); +void func_86B04DF0(void); +void func_86B04EBC(void); +s32 func_86B04FB0(void); + +void func_86B05170(u8* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, u8 width, u8 height, u8 uls, u8 ult, u8 lrs, u8 lrt, u8 argB, u8 argC, unk_D_86B0DAE0* argD, s32 argE); +void func_86B05944(s32, s32, s32, s32, s32); + +s32 func_86B05CB0(s32 arg0, GraphNode* arg1); +s32 func_86B05D18(s32 arg0, GraphNode* arg1); +s32 func_86B05D84(s32 arg0, GraphNode* arg1); +void func_86B05DA0(u8 arg0, u8 arg1, u8 arg2); +void func_86B05E18(void); +void func_86B05EE8(void); +void func_86B06008(void); +void func_86B06050(void); +void func_86B06100(void); +void func_86B061E8(void); +s32 func_86B0630C(unk_D_86002F58_004_000* arg0, s16 arg1, s16 arg2); +s32 func_86B06394(unk_D_86002F58_004_000* arg0, s16 arg1, s16 arg2); +s32 func_86B06440(void); +void func_86B065C4(void); +void func_86B06960(void); +void func_86B069D8(void); +void func_86B06AB4(unk_D_86B0FA50* arg0, u8* arg1, f32 arg2, s16 arg3, s16 arg4, s16 arg5); +void func_86B06B38(void); +void func_86B06E34(void); +void func_86B06E80(void); +void func_86B06EC8(void); +void func_86B06F18(void); +void func_86B06F60(void); +void func_86B06F74(void); +void func_86B06FCC(void); +s32 func_86B06FFC(void); +s32 func_86B07450(unk_D_86B0FA50* arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5); +void func_86B075EC(void); +void func_86B07DF4(void); +void func_86B07EA0(void); +void func_86B07F14(void); +void func_86B07FA4(void); +void func_86B08034(void); +void func_86B0819C(void); +s32 func_86B08644(void); + +s16 func_86B08780(void); +s32 func_86B087A0(u8 arg0, u8* arg1, s32 arg2); +void func_86B087E8(unk_D_86B0FA78* arg0, Vec3f* arg1); +void func_86B088E4(void); +f32 func_86B089B0(f32 arg0, f32 arg1); +void func_86B089E0(s16 arg0, s16 arg1, s16 arg2, s16 arg3); +void func_86B08A3C(f32 arg0, f32 arg1); +void func_86B08A58(s16 arg0, s16 arg1, s16 arg2, s16 arg3); +void func_86B08AB4(f32 arg0, f32 arg1); +void func_86B08AD0(f32 arg0, f32 arg1); +void func_86B08AEC(unk_D_86B0C160* arg0, unk_D_86002F34_00C* arg1); +s32 func_86B08C44(unk_D_86002F34_00C* arg0); + +void func_86B08E50(s32 arg0, s32 arg1); +s32 func_86B08EA8(void); +void func_86B08EB4(void); +Gfx* func_86B08F48(Gfx* gfx, u32 arg1); +void func_86B095C4(void); +void func_86B0961C(s16 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7); +void func_86B097B0(s32 arg0, s32 arg1, s32 arg2, s32 arg3, u8* arg4, UNUSED s32 arg5); +void func_86B09928(u8* arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4, unk_D_86B0DAE0_000* arg5); +void func_86B09AD8(u8* arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4); + +void func_86B0A0B0(void); +void func_86B0A0B8(void); +void func_86B0A15C(void); +void func_86B0A18C(u8* arg0); +void func_86B0A30C(void); +s32 func_86B0A37C(void); +void func_86B0A414(void); +void func_86B0A47C(void); +s32 func_86B0A554(void); + +void func_86B0A750(void); +void func_86B0A7F8(void); +void func_86B0A81C(void); +void func_86B0A824(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8 arg4, u8 arg5, u8 arg6, u8 arg7); +void func_86B0B024(void); +void func_86B0B034(void); +s32 func_86B0B040(void); +void func_86B0B0B4(void); +void func_86B0B12C(void); +void func_86B0B184(void); +void func_86B0B498(void); +void func_86B0B4C8(void); +void func_86B0B4D0(u8* arg0); +void func_86B0B650(void); +s32 func_86B0B6C0(void); +void func_86B0B810(void); +void func_86B0B8DC(void); +s32 func_86B0BA18(void); + +#endif // _FRAGMENT17_H_ diff --git a/src/fragments/17/fragment17_15F9B0.c b/src/fragments/17/fragment17_15F9B0.c index 3e0519e6..68093448 100644 --- a/src/fragments/17/fragment17_15F9B0.c +++ b/src/fragments/17/fragment17_15F9B0.c @@ -1,3 +1,25 @@ -#include "global.h" +#include "fragment17.h" +#include "29BA0.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15F9B0/func_86B00020.s") +s32 func_86B00020(UNUSED s32 arg0, UNUSED s32 arg1) { + switch (D_800AE540.unk_0000) { + case 18: + return func_86B01190(); + + case 17: + return func_86B08644(); + + case 21: + return func_86B04FB0(); + + case 26: + return func_86B04FB0(); + + case 22: + case 23: + return func_86B0BA18(); + + case 24: + return func_86B0A554(); + } +} diff --git a/src/fragments/17/fragment17_15FA60.c b/src/fragments/17/fragment17_15FA60.c index 49f7e96b..5640d6f5 100644 --- a/src/fragments/17/fragment17_15FA60.c +++ b/src/fragments/17/fragment17_15FA60.c @@ -1,57 +1,557 @@ -#include "global.h" +#include "fragment17.h" +#include "src/12D80.h" +#include "src/17300.h" +#include "src/geo_layout.h" +#include "src/19840.h" +#include "src/1C720.h" +#include "src/1CF30.h" +#include "src/20330.h" +#include "src/26820.h" +#include "src/2E110.h" +#include "src/3FB0.h" +#include "src/4BDC0.h" +#include "src/6BC0.h" +#include "src/F420.h" +#include "src/controller.h" +#include "src/fragments/34/fragment34.h" +#include "src/memory.h" +#include "src/stage_loader.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B000D0.s") +typedef struct unk_D_86B0E5D8 { + /* 0x00 */ s16 unk_00; + /* 0x02 */ s16 unk_02; + /* 0x04 */ u8 unk_04; + /* 0x05 */ u8 unk_05; + /* 0x06 */ u8 unk_06; + /* 0x07 */ u8 unk_07; + /* 0x08 */ s16 unk_08; + /* 0x0A */ s16 unk_0A; +} unk_D_86B0E5D8; // size = 0xC -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B00158.s") +extern u32 D_86B0BD60[]; +extern unk_D_86B0C4C8* D_86B0C4C8[]; +extern unk_D_86B0C160 D_86B0C160[]; +extern unk_D_86B0C264 D_86B0C264[]; +extern u32 D_86B0CF9C[]; +extern u32 D_86B0DA9C[]; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B00188.s") +s32 func_86B000D0(s32, GraphNode*); +s32 func_86B00158(s32, GraphNode*); +s32 func_86B00188(s32, GraphNode*); +s32 func_86B001B8(s32, GraphNode*); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B001B8.s") +static s16 D_86B0BBF0 = -0x3C6E; +static s16 D_86B0BBF4 = 0x38E; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B001D8.s") +static u32 D_86B0BBF8[] = { + 0x0C00FFFF, 0x05000000, 0x0B00001E, 0x00000000, 0x014000F0, 0x0000000F, 0x00000000, 0x00000000, + 0x05000000, 0x0D000000, 0x05000000, 0x1A050000, 0x08000000, func_86B001B8, 0x00000000, 0x05000000, + 0x0F000002, 0x05000000, 0x06000000, 0x0F000002, 0x05000000, 0x06000000, 0x0F000002, 0x05000000, + 0x1F00FFFF, 0xC3920000, 0x00000000, 0xFC400000, 0x00640064, 0x00640000, 0x08000000, func_86B00158, + 0x00000000, 0x05000000, 0x00000000, D_86B0CF9C, 0x06000000, 0x06000000, 0x0F000002, 0x05000000, + 0x1F00FFFF, 0x00000000, 0x00000000, 0x0514F79A, 0x00640064, 0x00640000, 0x08000000, func_86B00188, + 0x00000000, 0x05000000, 0x00000000, D_86B0DA9C, 0x06000000, 0x06000000, 0x0F000002, 0x05000000, + 0x06000000, 0x06000000, 0x14000000, 0xF8E40000, 0xFFC89BFF, 0x08000000, func_86B000D0, 0x00000000, + 0x16FFFFFF, 0x0F000003, 0x05000000, 0x0A000000, &D_800AC840, 0x06000000, 0x06000000, 0x06000000, + 0x06000000, 0x01000000, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B001FC.s") +static GraphNode* D_86B0E5D0; +static unk_D_86B0E5D4* D_86B0E5D4; +static unk_D_86B0E5D8* D_86B0E5D8; +s32 D_86B0E5DC; +char** D_86B0E5E0; +static BinArchive* D_86B0E5E4; +static u8* D_86B0E5E8; +static unk_D_86B0E5F0 D_86B0E5F0[4]; +static s32 D_86B0EBB0; +static s32 D_86B0EBB4; +static u16 D_86B0EBB8; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B00258.s") +s32 func_86B000D0(s32 arg0, GraphNode* arg1) { + if (arg0 == 2) { + unk_D_86002F34_alt18* ptr = (unk_D_86002F34_alt18*)arg1; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B0027C.s") + D_86B0E5D8->unk_00 += D_86B0E5D8->unk_08; + D_86B0E5D8->unk_02 += D_86B0E5D8->unk_0A; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B0032C.s") + ptr->unk_1C = D_86B0E5D8->unk_00; + ptr->unk_1E = D_86B0E5D8->unk_02; + ptr->r = D_86B0E5D8->unk_05; + ptr->g = D_86B0E5D8->unk_06; + ptr->b = D_86B0E5D8->unk_07; + ptr->a = D_86B0E5D8->unk_04; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B00348.s") + return 0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B003CC.s") +s32 func_86B00158(s32 arg0, GraphNode* arg1) { + if (arg0 == 2) { + unk_D_86002F58_004_000* ptr = (unk_D_86002F58_004_000*)arg1; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B00470.s") + ptr->unk_030.x = 1.5f; + ptr->unk_030.y = 1.5f; + ptr->unk_030.z = 1.5f; + ptr->unk_01E.x = D_86B0BBF0; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B0054C.s") + return 0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B00688.s") +s32 func_86B00188(s32 arg0, GraphNode* arg1) { + if (arg0 == 2) { + unk_D_86002F58_004_000* ptr = (unk_D_86002F58_004_000*)arg1; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B00794.s") + ptr->unk_030.x = 1.0f; + ptr->unk_030.y = 1.0f; + ptr->unk_030.z = 1.0f; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B007EC.s") + ptr->unk_01E.x = D_86B0BBF4; + } + return 0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B00848.s") +s32 func_86B001B8(s32 arg0, GraphNode* arg1) { + if (arg0 == 2) { + unk_D_86002F34_alt21* ptr = (unk_D_86002F34_alt21*)arg1; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B008C4.s") + ptr->unk_1A = D_86B0E5D4->unk_04.unk_44; + } + return 0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B00904.s") +void func_86B001D8(void) { + s32 i; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B00944.s") + for (i = 0; i < 4; i++) { + D_86B0E5F0[i].unk_16C = 0; + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B00AE4.s") +void func_86B001FC(unk_D_86B0E5F0* arg0) { + while (arg0->unk_16C != 1) { + func_8001BCF0(&arg0->unk_004); + arg0++; + } + main_pool_pop_state('MONS'); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B00B14.s") +void func_86B00258(void) { + main_pool_push_state('MONS'); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B00C34.s") +void func_86B0027C(unk_D_86B0E5F0* arg0, unk_D_86B0C4C8* arg1) { + func_8001BB58(&arg0->unk_004); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B0100C.s") + arg0->unk_000 = func_80019D18(arg1->unk_0C); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B0107C.s") + func_8001BC34(&arg0->unk_004, 0, arg1->unk_0C, arg0->unk_000->unk_08->unk_00[0]); + func_8001BD04(&arg0->unk_004, arg1->unk_10); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B010FC.s") + if (arg1->unk_0C == 6) { + arg0->unk_004.unk_0A6 = 0; + } else { + arg0->unk_004.unk_0A6 = 0xFF; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B0111C.s") + func_80017464(&arg0->unk_004, 0); + arg0->unk_004.unk_000.unk_02 &= ~0x40; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_15FA60/func_86B01190.s") +void func_86B0032C(unk_D_86B0E5F0* arg0, unk_D_86B0C4C8* arg1) { + arg0->unk_004.unk_024.x = arg1->unk_00.x; + arg0->unk_004.unk_024.y = arg1->unk_00.y; + arg0->unk_004.unk_024.z = arg1->unk_00.z; +} + +void func_86B00348(s32 arg0) { + D_86B0E5D8->unk_00 = D_86B0C264[arg0].unk_0C; + D_86B0E5D8->unk_02 = D_86B0C264[arg0].unk_0E; + D_86B0E5D8->unk_08 = D_86B0C264[arg0].unk_18; + D_86B0E5D8->unk_0A = D_86B0C264[arg0].unk_1A; + D_86B0E5D8->unk_05 = D_86B0C264[arg0].unk_10; + D_86B0E5D8->unk_06 = D_86B0C264[arg0].unk_12; + D_86B0E5D8->unk_07 = D_86B0C264[arg0].unk_14; + D_86B0E5D8->unk_04 = D_86B0C264[arg0].unk_16; +} + +void func_86B003CC(s32 arg0) { + unk_D_86B0C4C8* var_s0 = D_86B0C4C8[arg0]; + unk_D_86B0E5F0* var_s1 = D_86B0E5F0; + + func_86B001D8(); + func_86B00258(); + + while (var_s0->unk_0C != 0x98) { + func_86B0027C(var_s1, var_s0); + func_86B0032C(var_s1, var_s0); + var_s1->unk_16C = 1; + + var_s1++; + var_s0++; + } + + func_86B00348(arg0); +} + +void func_86B00470(s32 arg0) { + unk_D_86B0C4C8* sp2C = D_86B0C4C8[arg0]; + unk_D_86B0E5F0* var_s1 = D_86B0E5F0; + + func_86B001FC(D_86B0E5F0); + func_86B001D8(); + func_86B00258(); + + while (sp2C->unk_0C != 0x98) { + func_86B0027C(var_s1, sp2C); + func_86B0032C(var_s1, sp2C); + var_s1->unk_16C = 1; + + var_s1++; + sp2C++; + } + + func_86B00348(arg0); + + if (arg0 == 4) { + func_8001BD9C(&D_86B0E5F0[0].unk_004, 0); + } +} + +void func_86B0054C(s32 arg0) { + if (arg0 == 4) { + D_86B0E5D4->unk_00->unk_60.at.x = -0.04f; + D_86B0E5D4->unk_00->unk_60.at.y = 24.2f; + D_86B0E5D4->unk_00->unk_60.at.z = -4.08f; + D_86B0E5D4->unk_00->unk_60.eye.x = 0.04f; + D_86B0E5D4->unk_00->unk_60.eye.y = 24.2f; + D_86B0E5D4->unk_00->unk_60.eye.z = 177.41f; + D_86B0E5D4->unk_00->unk_24.fovy = 25.0f; + } else { + D_86B0E5D4->unk_04.unk_00.x = D_86B0C264[arg0].unk_00.x; + D_86B0E5D4->unk_04.unk_00.y = D_86B0C264[arg0].unk_00.y; + D_86B0E5D4->unk_04.unk_00.z = D_86B0C264[arg0].unk_00.z; + + func_86B0194C(&D_86B0C160[arg0], D_86B0E5D4); + func_86B01A40(&D_86B0E5D4->unk_04, D_86B0E5D4); + } +} + +void func_86B00680(void) { +} + +void func_86B00688(void) { + s32 i = 0; + + if ((D_86B0E5D4->unk_04.unk_4C != 5) && (D_86B0E5D4->unk_04.unk_4C != 6) && (D_86B0E5D4->unk_04.unk_4C != 7) && + (D_86B0E5D4->unk_04.unk_4C != 8)) { + if (D_86B0E5D4->unk_04.unk_44 != 4) { + while (D_86B0C4C8[D_86B0E5D4->unk_04.unk_44][i].unk_0C != 0x98) { + if (func_800174E4(&D_86B0E5F0[i].unk_004) != 0) { + func_80017464(&D_86B0E5F0[i].unk_004, 0); + } + i++; + } + } + } +} + +void func_86B00794(void) { + if (D_86B0E5D4->unk_04.unk_48 == 1) { + func_8001F504(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, D_86B0EBB0); + } +} + +void func_86B007EC(void) { + if (D_86B0E5D4->unk_04.unk_44 == 2) { + func_86B01D8C(&D_86B0BD60, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 4, 0x80); + } +} + +s32 func_86B00848(s32 arg0) { + unk_D_86B0E5F0* var_v0 = D_86B0E5F0; + unk_D_86B0C4C8* var_v1 = D_86B0C4C8[arg0]; + s32 var_a1 = 1; + + while (var_v1->unk_0C != 0x98) { + var_v0->unk_004.unk_024.z += 20.0f; + if (var_v0->unk_004.unk_024.z <= 650.0f) { + var_a1 = 0; + } + var_v0++; + var_v1++; + } + return var_a1; +} + +void func_86B008C4(void) { + func_80007990(1); + func_80006CB4(0xC); + D_86B0E5D4->unk_04.unk_4C = 0; + D_86B0E5D4->unk_04.unk_50 = 0; +} + +void func_86B00904(void) { + D_86B0E5D4->unk_04.unk_4C = 9; + D_86B0E5D4->unk_04.unk_50 = 0; + D_86B0E5F0->unk_004.unk_000.unk_01 &= ~1; + D_86B0E5DC = 1; +} + +void func_86B00944(s32 arg0) { + unk_D_86B0C4C8* ptr1 = D_86B0C4C8[arg0]; + unk_D_86B0E5F0* ptr2 = &D_86B0E5F0[0]; + s16 sp88[] = { + // D_86B0BD20 + 0x1554, + 0x1554, + 0x1554, + 0x1554, + }; + s16 sp80[] = { + // D_86B0BD28 + 0x18E2, + 0x11C6, + 0x1554, + 0x1554, + }; + f32 sp70[] = { 1000.0f, 1000.0f, 2000.0f, 2000.0f }; // D_86B0BD30 + f32 sp60[] = { 1.0f, 1.0f, 100.0f, 50.0f }; // D_86B0BD40 + + while (ptr1->unk_0C != 0x98) { + if (func_86B01670(D_86B0E5D4->unk_00, &ptr2->unk_004, sp88[arg0], sp80[arg0], sp70[arg0], sp60[arg0]) != 0) { + ptr2->unk_004.unk_000.unk_01 |= 1; + } else { + ptr2->unk_004.unk_000.unk_01 &= ~1; + } + ptr2++; + ptr1++; + } +} + +void func_86B00AE4(void) { + Cont_StartReadInputs(); + Cont_ReadInputs(); + func_8001F730(); +} + +void func_86B00B14(void) { + D_86B0E5D4 = main_pool_alloc(sizeof(unk_D_86B0E5D4), 0); + bzero(D_86B0E5D4, sizeof(unk_D_86B0E5D4)); + + D_86B0E5D8 = main_pool_alloc(sizeof(unk_D_86B0E5D8), 0); + bzero(D_86B0E5D8, sizeof(unk_D_86B0E5D8)); + + D_86B0E5D4->unk_00 = D_86B0E5D0->unk_0C; + + D_86B0E5D4->unk_00->unk_24.near = 50.0f; + D_86B0E5D4->unk_00->unk_24.far = 8400.0f; + D_86B0E5D4->unk_00->unk_24.fovy = 30.0f; + D_86B0E5D4->unk_00->unk_60.at.x = 50.0f; + D_86B0E5D4->unk_00->unk_60.at.y = 50.0f; + D_86B0E5D4->unk_00->unk_60.at.z = 50.0f; + D_86B0E5D4->unk_00->unk_60.eye.x = 0.0f; + D_86B0E5D4->unk_00->unk_60.eye.y = 0.0f; + D_86B0E5D4->unk_00->unk_60.eye.z = 0.0f; + D_86B0E5D4->unk_04.unk_4C = 8; + D_86B0E5D4->unk_04.unk_50 = 0; + D_86B0E5D4->unk_04.unk_48 = 0; +} + +s32 func_86B00C34(void) { + if (((gPlayer1Controller->buttonPressed & 0x1000) || (gPlayer1Controller->buttonPressed & 0x8000) || + (gPlayer1Controller->buttonPressed & 0x4000)) && + (D_86B0E5D4->unk_04.unk_48 == 0)) { + if ((D_86B0E5D4->unk_04.unk_4C != 8) && (D_86B0E5D4->unk_04.unk_4C != 5)) { + D_86B0E5D4->unk_04.unk_48 = 1; + func_8004B9C4(0xA); + D_86B0EBB0 = 0; + D_86B0EBB4 = 2; + } + } + + if (D_86B0E5D4->unk_04.unk_48 == 1) { + D_86B0EBB0 = func_8001046C(D_86B0EBB0, 0xFF, 0x1E, 0x1E); + if (D_86B0EBB0 == 0xFF) { + return 1; + } + } + + switch (D_86B0E5D4->unk_04.unk_4C) { + case 5: + if (D_86B0E5D4->unk_04.unk_48 == 1) { + return 1; + } + + if (D_86B0E5D4->unk_04.unk_44 == 4) { + D_86B0E5D4->unk_04.unk_50 = 0; + D_86B0EBB4 = 1; + return 1; + } + + D_86B0E5D4->unk_04.unk_44++; + func_86B0054C(D_86B0E5D4->unk_04.unk_44); + func_86B00470(D_86B0E5D4->unk_04.unk_44); + D_86B0E5D4->unk_04.unk_4C = 6; + D_86B0E5D4->unk_04.unk_50 = 0; + break; + + case 6: + if (D_86B0E5D4->unk_04.unk_50++ >= 4) { + func_80007990(1); + func_80006C6C(0x20); + D_86B0E5D4->unk_04.unk_4C = 7; + if ((D_86B0E5D4->unk_04.unk_44 == 0) || (D_86B0E5D4->unk_04.unk_44 == 1)) { + func_86B01AAC(&D_86B0E5D4->unk_04, D_86B0E5D4); + } + } + break; + + case 7: + if (D_86B0E5D4->unk_04.unk_44 == 4) { + if (func_800174E4(&D_86B0E5F0[0].unk_004) != 0) { + func_86B00904(); + } + } else { + if (D_86B0E5D4->unk_04.unk_44 >= 2) { + if (func_86B00848(D_86B0E5D4->unk_04.unk_44) != 0) { + func_86B008C4(); + } + } else if (D_86B0E5D4->unk_04.unk_6C < D_86B0E5D4->unk_04.unk_30) { + func_86B008C4(); + } + + if ((D_86B0E5D4->unk_04.unk_44 == 0) || (D_86B0E5D4->unk_04.unk_44 == 1)) { + func_86B01AAC(&D_86B0E5D4->unk_04, D_86B0E5D4); + } + + func_86B00944(D_86B0E5D4->unk_04.unk_44); + } + break; + + case 8: + if (D_86B0E5D4->unk_04.unk_50++ >= 0xB) { + D_86B0E5D4->unk_04.unk_44 = 0; + func_86B0054C(D_86B0E5D4->unk_04.unk_44); + D_86B0E5D4->unk_04.unk_4C = 6; + D_86B0E5D4->unk_04.unk_50 = 0; + func_86B003CC(D_86B0E5D4->unk_04.unk_44); + func_8004B1CC(0x29); + } + break; + + case 9: + if (D_86B0E5D4->unk_04.unk_50++ >= 3) { + D_86B0E5D4->unk_04.unk_4C = 5; + D_86B0E5D4->unk_04.unk_50 = 0; + } + break; + + default: + if (D_86B0E5D4->unk_04.unk_44 != 4) { + if (D_86B0E5D4->unk_04.unk_44 >= 2) { + func_86B00848(D_86B0E5D4->unk_04.unk_44); + } else { + func_86B01AAC(&D_86B0E5D4->unk_04, D_86B0E5D4); + } + } + + if (D_86B0E5D4->unk_04.unk_50++ >= 0xE) { + D_86B0E5D4->unk_04.unk_4C = 5; + D_86B0E5D4->unk_04.unk_50 = 0; + } + break; + } + + return 0; +} + +void func_86B01004(void) { +} + +void func_86B0100C(void) { + func_800079C4(); + func_8000699C(&gDisplayListHead, 1); + func_80015348(); + func_86B007EC(); + func_86B01C00(D_86B0E5E8); + func_80015094(D_86B0E5D0); + func_86B00794(); + func_86B02348(); + func_80007778(); +} + +void func_86B0107C(void) { + s32 var_s1 = 1; + s32 var_s0 = 0; + + while (var_s1 != 0) { + func_86B00AE4(); + func_8140C5D0(); + + if (func_86B00C34() != 0) { + var_s1 = 0; + } + + var_s0++; + if (var_s0 == 0x50) { + var_s0 = 0; + } + + func_86B00688(); + func_86B0100C(); + } +} + +void func_86B010FC(void) { + func_86B0100C(); +} + +void func_86B0111C(void) { + MemoryBlock* sp1C; + + sp1C = func_80002D10(main_pool_get_available(), 0); + D_86B0E5D0 = process_geo_layout(sp1C, &D_86B0BBF8); + + func_80002D60(sp1C); + func_8001BB20(); + func_8001987C(); + func_86B00B14(); + + D_86B0EBB0 = 0; + D_86B0E5DC = 0; +} + +s32 func_86B01190(void) { + main_pool_push_state('MINI'); + + func_8001E94C(6, 0); + + ASSET_LOAD(D_1000000, common_menu1_ui, 0); + FRAGMENT_LOAD(fragment31); + func_80004454((((u32)D_8D000000 & 0x0FF00000) >> 0x14) - 0x10, _5C7A70_ROM_START, _5C7A70_ROM_END); + + func_80028AFC(2); + func_80027FA0(&D_86B0EBB8, 0); + D_86B0E5E4 = ASSET_LOAD2(backgrounds, 1, 1); + + if (D_86B0EBB8 == 0x1F8) { + D_86B0E5E8 = func_8000484C(D_86B0E5E4, 0x11); + } else { + D_86B0E5E8 = func_8000484C(D_86B0E5E4, 0); + } + + func_8002D510(); + D_86B0E5E0 = func_8002D5AC(0x14); + func_86B0111C(); + func_80007754(); + func_86B0107C(); + func_86B010FC(); + func_8000771C(); + func_8001E9CC(); + + main_pool_pop_state('MINI'); + + return D_86B0EBB4; +} diff --git a/src/fragments/17/fragment17_160CB0.c b/src/fragments/17/fragment17_160CB0.c index e1e7d8e5..b949da44 100644 --- a/src/fragments/17/fragment17_160CB0.c +++ b/src/fragments/17/fragment17_160CB0.c @@ -1,15 +1,62 @@ -#include "global.h" +#include "fragment17.h" +#include "src/math_util.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_160CB0/func_86B01320.s") +u16 func_86B01320(s32 arg0) { + return ((f32)(u32)MathUtil_Random16() / 65535.0) * arg0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_160CB0/func_86B01404.s") +Vec3f* func_86B01404(Vec3f* arg0, Vec3f* arg1) { + arg0->x = arg1->x; + arg0->y = arg1->y; + arg0->z = arg1->z; + return arg0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_160CB0/func_86B01424.s") +Vec3s* func_86B01424(Vec3s* arg0, Vec3s* arg1) { + arg0->x = arg1->x; + arg0->y = arg1->y; + arg0->z = arg1->z; + return arg0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_160CB0/func_86B01444.s") +void func_86B01444(Vec3f* arg0) { + arg0->x = arg0->y = arg0->z = 0.0f; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_160CB0/func_86B0145C.s") +void func_86B0145C(f32* arg0, f32 arg1, f32 arg2) { + *arg0 = *arg0 + ((arg1 - *arg0) * arg2); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_160CB0/func_86B014C4.s") + if ((*arg0 < 0.001) && (*arg0 > -0.001)) { + *arg0 = 0.0f; + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_160CB0/func_86B01528.s") +f32 func_86B014C4(Vec3f arg0, Vec3f arg1) { + return sqrtf(SQ(arg1.x - arg0.x) + SQ(arg1.y - arg0.y) + SQ(arg1.z - arg0.z)); +} + +void func_86B01528(MtxF* arg0, MtxF* arg1) { + f32 sp24 = sqrtf(SQ(arg1->mf[0][0]) + SQ(arg1->mf[0][1]) + SQ(arg1->mf[0][2])); + f32 sp20 = sqrtf(SQ(arg1->mf[1][0]) + SQ(arg1->mf[1][1]) + SQ(arg1->mf[1][2])); + f32 sp1C = sqrtf(SQ(arg1->mf[2][0]) + SQ(arg1->mf[2][1]) + SQ(arg1->mf[2][2])); + + arg0->mf[0][0] = arg1->mf[0][0] * sp24; + arg0->mf[0][1] = arg1->mf[1][0] * sp24; + arg0->mf[0][2] = arg1->mf[2][0] * sp24; + arg0->mf[0][3] = 0.0f; + + arg0->mf[1][0] = arg1->mf[0][1] * sp20; + arg0->mf[1][1] = arg1->mf[1][1] * sp20; + arg0->mf[1][2] = arg1->mf[2][1] * sp20; + arg0->mf[1][3] = 0.0f; + + arg0->mf[2][0] = arg1->mf[0][2] * sp1C; + arg0->mf[2][1] = arg1->mf[1][2] * sp1C; + arg0->mf[2][2] = arg1->mf[2][2] * sp1C; + arg0->mf[2][3] = 0.0f; + + arg0->mf[3][0] = 0.0f; + arg0->mf[3][1] = 0.0f; + arg0->mf[3][2] = 0.0f; + arg0->mf[3][3] = 1.0f; +} diff --git a/src/fragments/17/fragment17_161000.c b/src/fragments/17/fragment17_161000.c index 60c18c27..7990a20f 100644 --- a/src/fragments/17/fragment17_161000.c +++ b/src/fragments/17/fragment17_161000.c @@ -1,19 +1,145 @@ -#include "global.h" +#include "fragment17.h" +#include "src/F420.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161000/func_86B01670.s") +u16 func_86B01670(unk_D_86002F34_00C* arg0, unk_D_86002F58_004_000* arg1, s16 arg2, s16 arg3, f32 arg4, f32 arg5) { + UNUSED s32 pad[6]; + f32 sp6C; + f32 sp68; + f32 sp64; + f32 sp60; + f32 sp5C; + unk_D_86002F58_004_000* arg11; + f32 sp54; + f32 sp50; + UNUSED s32 pad3; + f32 sp48; + s16 sp46; + s16 sp44; + f32 sp40; + UNUSED s32 pad2; + f32 sp38; + s32 sp34 = 0; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161000/func_86B01898.s") + func_800102A4(&arg0->unk_60.at, &arg0->unk_60.eye, &sp48, &sp46, &sp44); + sp40 = (COSS(sp44 + 0x8000) * arg5) + arg0->unk_60.eye.z; + sp38 = (SINS(sp44 + 0x8000) * arg5) + arg0->unk_60.eye.x; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161000/func_86B018D4.s") + sp54 = (COSS((sp44 - arg3) + 0x8000) * arg4) + sp40; + sp60 = (SINS((sp44 - arg3) + 0x8000) * arg4) + sp38; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161000/func_86B018E8.s") + sp50 = (COSS((sp44 + arg2) + 0x8000) * arg4) + sp40; + sp5C = (SINS((sp44 + arg2) + 0x8000) * arg4) + sp38; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161000/func_86B01924.s") + sp6C = + ((sp54 - arg1->unk_024.z) * (sp5C - arg1->unk_024.x)) - ((sp50 - arg1->unk_024.z) * (sp60 - arg1->unk_024.x)); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161000/func_86B01938.s") + arg11 = arg1; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161000/func_86B0194C.s") + sp68 = ((sp50 - arg11->unk_024.z) * (sp38 - arg11->unk_024.x)) - + ((sp40 - arg11->unk_024.z) * (sp5C - arg11->unk_024.x)); + sp64 = ((sp40 - arg11->unk_024.z) * (sp60 - arg11->unk_024.x)) - + ((sp54 - arg11->unk_024.z) * (sp38 - arg11->unk_024.x)); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161000/func_86B01A40.s") + if (((sp6C >= 0.0f) && (sp68 >= 0.0f) && (sp64 >= 0.0f)) || ((sp6C <= 0.0f) && (sp68 <= 0.0f) && (sp64 <= 0.0f))) { + sp34 = 1; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161000/func_86B01AAC.s") + return sp34; +} + +void func_86B01898(unk_D_86B0E5D4_04* arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4) { + arg0->unk_0C = arg1; + arg0->unk_0E = arg2; + arg0->unk_20 = arg3; + arg0->unk_22 = arg4; +} + +void func_86B018D4(unk_D_86B0E5D4_04* arg0, f32 arg1, f32 arg2) { + arg0->unk_18 = arg1; + arg0->unk_2C = arg2; +} + +void func_86B018E8(unk_D_86B0E5D4_04* arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4) { + arg0->unk_12 = arg1; + arg0->unk_14 = arg2; + arg0->unk_26 = arg3; + arg0->unk_28 = arg4; +} + +void func_86B01924(unk_D_86B0E5D4_04* arg0, f32 arg1, f32 arg2) { + arg0->unk_1C = arg1; + arg0->unk_30 = arg2; +} + +void func_86B01938(unk_D_86B0E5D4_04* arg0, f32 arg1, f32 arg2) { + arg0->unk_34 = arg1; + arg0->unk_38 = arg2; +} + +void func_86B0194C(unk_D_86B0C160* arg0, unk_D_86B0E5D4* arg1) { + unk_D_86B0E5D4_04* ptr = &arg1->unk_04; + unk_D_86002F34_00C* ptr2 = arg1->unk_00; + f32 sp34; + f32 sp30; + f32 sp2C; + f32 sp28; + + ptr->unk_74 = 0.0f; + ptr->unk_68 = 0; + + if (arg0->unk_30 != 255.0f) { + ptr2->unk_24.fovy = ptr->unk_3C = arg0->unk_30; + } else { + ptr->unk_3C = arg0->unk_30; + } + + sp34 = arg0->unk_0C; + sp30 = arg0->unk_20; + sp2C = arg0->unk_10; + sp28 = arg0->unk_24; + + func_86B01898(ptr, arg0->unk_00, arg0->unk_02, arg0->unk_14, arg0->unk_16); + func_86B018D4(ptr, sp34, sp30); + func_86B018E8(ptr, arg0->unk_06, arg0->unk_08, arg0->unk_1A, arg0->unk_1C); + func_86B01924(ptr, sp2C, sp28); + func_86B01938(ptr, arg0->unk_28, arg0->unk_2C); +} + +void func_86B01A40(unk_D_86B0E5D4_04* arg0, unk_D_86B0E5D4* arg1) { + unk_D_86002F34_00C* sp2C = arg1->unk_00; + + func_80010354(&arg0->unk_00, &sp2C->unk_60.at, arg0->unk_18, arg0->unk_0C, arg0->unk_0E); + func_80010354(&sp2C->unk_60.at, &sp2C->unk_60.eye, arg0->unk_1C, arg0->unk_12, arg0->unk_14); +} + +s32 func_86B01AAC(unk_D_86B0E5D4_04* arg0, unk_D_86B0E5D4* arg1) { + unk_D_86002F34_00C* temp_s2 = arg1->unk_00; + Vec3f sp58; + Vec3f sp4C; + UNUSED s32 pad[3]; + f32 sp3C; + s16 sp3A; + s16 sp38; + + if (arg0->unk_3C != 255.0f) { + temp_s2->unk_24.fovy = arg0->unk_3C; + } else { + func_86B0145C(&temp_s2->unk_24.fovy, 30.0f, 0.06f); + } + + func_80010354(&arg0->unk_00, &sp58, arg0->unk_18, arg0->unk_0C, arg0->unk_0E); + func_80010354(&arg0->unk_00, &sp4C, arg0->unk_2C, arg0->unk_20, arg0->unk_22); + func_800102A4(&sp58, &sp4C, &sp3C, &sp3A, &sp38); + + arg1->unk_04.unk_68 = func_800104AC(arg1->unk_04.unk_68, sp3C, arg0->unk_34, arg0->unk_34); + + func_80010354(&sp58, &temp_s2->unk_60.at, arg1->unk_04.unk_68, sp3A, sp38); + func_80010354(&temp_s2->unk_60.at, &temp_s2->unk_60.eye, arg0->unk_1C, arg0->unk_12, arg0->unk_14); + + arg1->unk_04.unk_6C = sp3C - arg1->unk_04.unk_68; + if (arg1->unk_04.unk_6C <= 5.0f) { + return 1; + } + + return 0; +} diff --git a/src/fragments/17/fragment17_161590.c b/src/fragments/17/fragment17_161590.c index 7fc5f359..8f456d17 100644 --- a/src/fragments/17/fragment17_161590.c +++ b/src/fragments/17/fragment17_161590.c @@ -1,7 +1,113 @@ -#include "global.h" +#include "fragment17.h" +#include "src/1CF30.h" +#include "src/2E110.h" +#include "src/6A40.h" +#include "src/6BC0.h" +#include "src/controller.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161590/func_86B01C00.s") +void func_86B01C00(u8* arg0) { + s32 i; + s32 j; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161590/func_86B01D8C.s") + if (D_86B0E5DC == 0) { + return; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161590/func_86B02348.s") + gDPPipeSync(gDisplayListHead++); + + gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE); + gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); + gDPSetTexturePersp(gDisplayListHead++, G_TP_NONE); + gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGB, G_CC_DECALRGB); + + gDPPipeSync(gDisplayListHead++); + + if (0) {} + + for (i = 0; i < 15; i++) { + for (j = 0; j < 20; j++, arg0 += 0x200) { + func_8001C6AC(j * 16, i * 16, 0x10, 0x10, arg0, 0x10, 0); + } + } + + gSPDisplayList(gDisplayListHead++, D_8006F630); +} + +void func_86B01D8C(u8* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, u8 arg5, u8 arg6) { + unk_D_80068BB0* temp_s1 = func_8000648C(); + Vtx* temp_s2 = func_80005F5C(sizeof(Vtx) * 4); + Mtx* spCC = func_80005F5C(sizeof(Mtx) * 1); + Vp* spC8 = func_80005F5C(sizeof(Vp)); + + func_8001E6E8(spC8, temp_s1->width, temp_s1->height); + + gSPViewport(gDisplayListHead++, (u32)spC8 & 0x1FFFFFFF); + + guOrtho(spCC, 0.5f, temp_s1->width - 0.5f, temp_s1->height - 0.5f, 0.5f, -2.0f, 2.0f, 1.0f); + func_8001E680(&temp_s2[0], arg1, arg2, -1, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF); + func_8001E680(&temp_s2[1], arg1 + arg3, arg2, -1, arg5 << 5, 0, 0xFF, 0xFF, 0xFF, 0xFF); + func_8001E680(&temp_s2[2], arg1, arg2 + arg4, -1, 0, arg6 << 5, 0xFF, 0xFF, 0xFF, 0xFF); + func_8001E680(&temp_s2[3], arg1 + arg3, arg2 + arg4, -1, arg5 << 5, arg6 << 5, 0xFF, 0xFF, 0xFF, 0xFF); + + gDPPipeSync(gDisplayListHead++); + + gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE); + gSPClearGeometryMode(gDisplayListHead++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | + G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH | G_CLIPPING | + 0x0040F9FA); + gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGB, G_CC_DECALRGB); + gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP); + gDPSetTextureLOD(gDisplayListHead++, G_TL_TILE); + gDPSetTextureFilter(gDisplayListHead++, G_TF_BILERP); + gDPSetTextureLUT(gDisplayListHead++, G_TT_NONE); + gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); + gDPSetTextureFilter(gDisplayListHead++, G_TF_BILERP); + gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); + gSPPerspNormalize(gDisplayListHead++, 0xFFFF); + gSPMatrix(gDisplayListHead++, (u32)spCC & 0x1FFFFFFF, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gDisplayListHead++, (u32)&D_8006F010 & 0x1FFFFFFF, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gDPLoadTextureTile(gDisplayListHead++, arg0, G_IM_FMT_RGBA, G_IM_SIZ_16b, arg5, arg6, 0, 0, arg5 - 1, arg6 - 1, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); + + gSPVertex(gDisplayListHead++, (u32)temp_s2 & 0x1FFFFFFF, 4, 0); + gSP2Triangles(gDisplayListHead++, 0, 2, 3, 0, 0, 3, 1, 0); + + gSPDisplayList(gDisplayListHead++, D_8006F630); + + gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF); +} + +void func_86B02348(void) { + static s32 D_86B0BD50 = 0; + + s32 sp24; + s16 temp_s0; + + if (!(Cont_GetControllerBits() & 1)) { + sp24 = func_8001F5B0(4, 0, func_8002D7C0(NULL, 0, D_86B0E5E0, 0)); + temp_s0 = 0x50 - D_86B0BD50; + if (D_86B0E5DC != 1) { + gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 16, 0, 304, 240); + + func_8001F3F4(); + func_8001EBE0(4, 0); + func_8001F1E8(temp_s0, 0xB3, func_8002D7C0(NULL, 0, D_86B0E5E0, 0)); + + temp_s0 += sp24 + 0x1E; + if (temp_s0 < 0x140) { + func_8001F1E8(temp_s0, 0xB3, func_8002D7C0(NULL, 0, D_86B0E5E0, 0)); + } + + func_8001F444(); + + gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, 0, 320, 240); + + D_86B0BD50++; + if (D_86B0BD50 >= (sp24 + 0x50)) { + D_86B0BD50 = 0x32; + } + } + } +} diff --git a/src/fragments/17/fragment17_161E60.c b/src/fragments/17/fragment17_161E60.c index 7510b2cb..8c4213d9 100644 --- a/src/fragments/17/fragment17_161E60.c +++ b/src/fragments/17/fragment17_161E60.c @@ -1,77 +1,1667 @@ -#include "global.h" +#include "fragment17.h" +#include "src/12D80.h" +#include "src/17300.h" +#include "src/18140.h" +#include "src/geo_layout.h" +#include "src/19840.h" +#include "src/1C720.h" +#include "src/1CF30.h" +#include "src/20330.h" +#include "src/20470.h" +#include "src/26820.h" +#include "src/2E110.h" +#include "src/3FB0.h" +#include "src/49790.h" +#include "src/4BDC0.h" +#include "src/4F410.h" +#include "src/6A40.h" +#include "src/6BC0.h" +#include "src/F420.h" +#include "src/controller.h" +#include "src/math_util.h" +#include "src/memory.h" +#include "src/stage_loader.h" +#include "src/fragments/3/fragment3.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B024D0.s") +extern u8 D_30074E0[]; +extern u8 D_30092E0[]; +extern u8 D_300B6E0[]; +extern u8 D_300B980[]; +extern u8 D_300BAD0[]; +extern u8 D_300BED0[]; +extern u8 D_300C2D0[]; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B02538.s") +s32 func_86B024D0(s32, GraphNode*); +s32 func_86B02538(s32, GraphNode*); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B025A4.s") +typedef struct unk_D_86B0DBCC { + /* 0x00 */ f32 unk_00; + /* 0x04 */ f32 unk_04; + /* 0x08 */ f32 unk_08; + /* 0x0C */ f32 unk_0C; +} unk_D_86B0DBCC; // size = 0x10 -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B026C0.s") +typedef struct unk_D_86B0DB98 { + /* 0x00 */ u8* unk_00; + /* 0x04 */ s16 unk_04; +} unk_D_86B0DB98; // size = 0x8 -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B028F8.s") +typedef struct unk_D_86B0EBD8 { + /* 0x00 */ s32 unk_00; + /* 0x04 */ s32 unk_04; + /* 0x08 */ s32 unk_08; + /* 0x0C */ s32 unk_0C; + /* 0x10 */ char unk10[0x8]; + /* 0x18 */ s32 unk_18; + /* 0x30 */ unk_D_86B0DAE0 unk_1C; +} unk_D_86B0EBD8; // size = 0x4C -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B02908.s") +typedef struct unk_D_86B0EBDC { + /* 0x000 */ unk_D_86002F30* unk_000; + /* 0x004 */ unk_D_86002F30* unk_004; + /* 0x008 */ unk_D_86002F58_004_000 unk_008; + /* 0x170 */ unk_D_86002F58_004_000 unk_170; + /* 0x2D8 */ s32 unk_2D8; + /* 0x2DC */ s32 unk_2DC; + /* 0x2E0 */ char unk2E0[0x4]; + /* 0x2E4 */ s32 unk_2E4; + /* 0x2E8 */ s32 unk_2E8; + /* 0x2EC */ s32 unk_2EC; + /* 0x2F0 */ s32 unk_2F0; + /* 0x2F4 */ f32 unk_2F4; + /* 0x2F8 */ char unk2F8[0x4]; + /* 0x2FC */ f32 unk_2FC; + /* 0x300 */ f32 unk_300; + /* 0x304 */ s32 unk_304; + /* 0x308 */ s32 unk_308; +} unk_D_86B0EBDC; // size = 0x30C -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B02928.s") +typedef struct unk_D_86B0EBE0 { + /* 0x00 */ s32 unk_00; + /* 0x04 */ s32 unk_04; + /* 0x08 */ s32 unk_08; + /* 0x0C */ s32 unk_0C; + /* 0x10 */ s32 unk_10; + /* 0x14 */ s16 unk_14; + /* 0x16 */ s16 unk_16; + /* 0x18 */ s16 unk_18; + /* 0x1A */ s16 unk_1A; + /* 0x1C */ s16 unk_1C; +} unk_D_86B0EBE0; // size = 0x20 -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B0299C.s") +u32 D_86B0BD60[] = { + 0xCFFFCFFF, 0xCFFFCFFF, 0xCFFFCFFF, 0xCFFFCFFF, 0xCFFFCFFF, 0xCFFFCFFF, 0xCFFFCFFF, 0xCFFFCFFF, 0xC7FFC7FF, + 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, + 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, + 0xC7BFC7FF, 0xC7FFC7FF, 0xC7FFC7FF, 0xBFFFBFFF, 0xBFFFBFFF, 0xBFBFC7BF, 0xBFBFBFBF, 0xBFBFBFBF, 0xBFBFBFBF, + 0xBFBFBFBF, 0xBFBFBFBF, 0xBFBFBFBF, 0xBFBFBFBF, 0xBFBFBFBF, 0xBFBFBFBF, 0xBFBFBFBF, 0xBF7FBFBF, 0xBFBFBFBF, + 0xBFBFBFBF, 0xBF7FBF7F, 0xBF7FBF7F, 0xB77FB77F, 0xB77FB77F, 0xB77FB77F, 0xB77FB77F, 0xB77FB77F, 0xB77FB77F, + 0xB77FB77F, 0xB77FB77F, 0xB77FB77F, 0xB77FB77F, 0xB77FB77F, 0xB77FB77F, 0xB73FAF3F, 0xB73FAF3F, 0xB73FAF3F, + 0xAF3FB73F, 0xAF3FAF3F, 0xAF3FAF3F, 0xAF3FAF3F, 0xAF3FAF3F, 0xAF3FAF3F, 0xAEFFAF3F, 0xAF3FAF3F, 0xAF3FAF3F, + 0xAF3FAF3F, 0xAF3FAF3F, 0xAEFFAEFF, 0xAEFFAEFF, 0xAEFFAEFF, 0xAF3FAEFF, 0xA6FFA6FF, 0xA6FFA6FF, 0xA6FFA6FF, + 0xA6FFA6FF, 0xA6FFA6BF, 0xA6FFA6FF, 0xA6FFA6BF, 0xA6FFA6FF, 0xA6BFA6BF, 0xA6BFA6BF, 0xA6BF9EBF, 0xA6BF9EBF, + 0xA6BFA6BF, 0xA6BFA6BF, 0x9EBF9EBF, 0x9EBF9EBF, 0x9EBF9EBF, 0x9EBF9EBF, 0x9EBF9EBF, 0x9EBF9EBF, 0x9EBF9EBF, + 0x9E7F9E7F, 0x9E7F9E7F, 0x9E7F9E7F, 0x9E7F9E7F, 0x9E7F9E7F, 0x9E7F9E7F, 0x9E7F9E7F, 0x9E7F9E7F, 0x9E7F9E7F, + 0x967F963F, 0x967F9E3F, 0x967F967F, 0x967F967F, 0x963F963F, 0x963F963F, 0x963F963F, 0x963F963F, 0x963F963F, + 0x963F963F, 0x963F963F, 0x963F963F, 0x963F8E3F, 0x963F8E3F, 0x8E3F8E3F, 0x8E3F8E3F, 0x8E3F963F, 0x8E3F963F, + 0x8DFF8DFF, 0x8DFF8DFF, 0x8DFF8DFF, 0x8DFF8DFF, 0x8DFF8DFF, 0x8DFF8DFF, 0x8DFF8DFF, 0x8DFF8DFF, 0x8DFF8DFF, + 0x8DFF8DFF, 0x8DFF8DBF, 0x8DFF8DBF, 0x8DFF8DFF, 0x8DFF8DFF, 0x85BF85BF, 0x8DBF85BF, 0x85BF85BF, 0x85BF85BF, + 0x85BF85BF, 0x85BF85BF, 0x85BF85BF, 0x85BF85BF, 0x85BF85BF, 0x85BF85BF, 0x85BF7DBF, 0x85BF7DBF, 0x85BF85BF, + 0x85BF85BF, 0x7D7F7DBF, 0x7D7F7DBF, 0x7D7F7D7F, 0x7D7F7D7F, 0x7D7F7D7F, 0x7D7F7D7F, 0x7D7F7D7F, 0x7D7F7D7F, + 0x7D7F7D7F, 0x7D3F7D7F, 0x7D7F7D7F, 0x7D3F7D7F, 0x7D3F7D3F, 0x7D3F7D3F, 0x753F7D3F, 0x7D3F7D3F, 0x753F753F, + 0x753F753F, 0x753F753F, 0x753F753F, 0x753F753F, 0x753F753F, 0x753F753F, 0x753F753F, 0x753F753F, 0x74FF74FF, + 0x74FF753F, 0x74FF74FF, 0x74FF74FF, 0x74FF74FF, 0x6CFF6CFF, 0x6CFF6CFF, 0x6CFF6CFF, 0x6CFF6CFF, 0x6CFF6CFF, + 0x6CFF6CFF, 0x6CFF6CFF, 0x6CFF6CFF, 0x6CBF6CBF, 0x6CBF6CBF, 0x6CBF6CBF, 0x6CBF6CBF, 0x6CBF6CBF, 0x6CBF6CBF, + 0x6CBF6CBF, 0x64BF64BF, 0x64BF6CBF, 0x64BF64BF, 0x64BF64BF, 0x64BF64BF, 0x64BF64BF, 0x64BF64BF, 0x647F647F, + 0x647F647F, 0x647F647F, 0x647F647F, 0x647F647F, 0x647F647F, 0x647F647F, 0x647F647F, 0x647F647F, 0x647F647F, + 0x5C7F5C7F, 0x5C3F5C7F, 0x5C7F5C7F, 0x5C3F5C7F, 0x5C3F5C3F, 0x5C3F5C7F, 0x5C3F5C3F, 0x5C3F5C7F, 0x5C3F5C3F, + 0x5C3F5C3F, 0x5C3F5C3F, 0x5C3F5C3F, 0x5C3F5C3F, 0x5C3F5C3F, 0x5C3F5C3F, 0x5C3F5C3F, 0x5C3F5C3F, 0x5C3F5C3F, + 0x5C3F5C3F, 0x5C3F5C3F, 0x543F543F, 0x53FF543F, 0x543F543F, 0x543F543F, 0x53FF53FF, 0x53FF53FF, 0x53FF53FF, + 0x53FF53FF, 0x53FF53FF, 0x53FF53FF, 0x53FF53FF, 0x53FF53FF, 0x53FF53FF, 0x53FF53FF, 0x53FF53FF, 0x53FF53FF, + 0x53FF53FF, 0x53FF53FF, 0x53FF53FF, 0x53FF53FF, +}; +unk_D_86B0C160 D_86B0C160[] = { + { + 0, + 16384, + 0, + -5824, + 3640, + 240.00001525878906f, + 175.0f, + 0, + -16384, + 0, + 0, + 0, + 0.0f, + 85.0f, + 4.400000095367432f, + 0.0f, + 255.0f, + }, + { + 0, + -16384, + 0, + -6370, + -3640, + 175.0f, + 155.0f, + 0, + 16384, + 0, + 0, + 0, + 0.0f, + 60.000003814697266f, + 3.299999952316284f, + 0.0f, + 255.0f, + }, + { + 0, + 0, + 0, + 3276, + 0, + 875.0f, + 325.0f, + 0, + 0, + 0, + 3276, + 0, + 875.0f, + 325.0f, + 20.0f, + 0.0f, + 255.0f, + }, + { + 0, + 0, + 0, + -3276, + 0, + 875.0f, + 325.0f, + 0, + 0, + 0, + -3276, + 0, + 875.0f, + 325.0f, + 20.0f, + 0.0f, + 255.0f, + }, + { + 0, + 0, + 0, + 0, + 0, + 0.0f, + 325.0f, + 0, + 0, + 0, + 0, + 0, + 0.0f, + 325.0f, + 0.0f, + 0.0f, + 255.0f, + }, +}; +unk_D_86B0C264 D_86B0C264[] = { + { + { 0.0f, 60.0f, 0.0f }, + -12743, + 3640, + 0x00FF, + 0x00FF, + 0x00FF, + 0x0032, + 0, + 0, + }, + { + { 0.0f, 60.0f, 0.0f }, + -12743, + -3640, + 0x00FF, + 0x00FF, + 0x00FF, + 0x0032, + 0, + 0, + }, + { + { 0.0f, 60.0f, 0.0f }, + 10922, + 5461, + 0x00FF, + 0x00FF, + 0x00FF, + 0x001E, + 0, + 0, + }, + { + { 0.0f, 60.0f, 0.0f }, + 0, + 0, + 0x009B, + 0x009B, + 0x00FF, + 0x0032, + 1820, + 1820, + }, + { + { 0.0f, 60.0f, 0.0f }, + 7281, + 7281, + 0x00FF, + 0x00FF, + 0x00FF, + 0x0032, + 0, + 0, + }, +}; +static unk_D_86B0C4C8 D_86B0C2F0[] = { + { { 240.0f, 0.0f, 0.0f }, 9, 2, 0, 0 }, { { 160.0f, 0.0f, 0.0f }, 112, 2, 0, 0 }, + { { 80.0f, 0.0f, 0.0f }, 115, 2, 0, 0 }, { { 10.0f, 0.0f, 10.0f }, 67, 2, 0, 0 }, + { { -140.0f, 0.0f, 0.0f }, 152, 2, 0, 0 }, +}; +static unk_D_86B0C4C8 D_86B0C354[] = { + { { -10.0f, 0.0f, 10.0f }, 34, 2, 0, 0 }, { { -60.0f, 0.0f, 20.0f }, 28, 2, 0, 0 }, + { { -120.0f, 10.0f, -30.0f }, 123, 2, 0, 0 }, { { -180.0f, 0.0f, 0.0f }, 141, 2, 0, 0 }, + { { -140.0f, 0.0f, 0.0f }, 152, 2, 0, 0 }, +}; +static unk_D_86B0C4C8 D_86B0C3B8[] = { + { { 0.0f, -100.0f, -750.0f }, 18, 2, 0, 0 }, { { -35.0f, 40.0f, -350.0f }, 22, 2, 0, 0 }, + { { 78.0f, -50.0f, -150.0f }, 142, 2, 0, 0 }, { { -18.0f, -30.0f, 450.0f }, 6, 2, 10, 0 }, + { { -140.0f, 0.0f, 0.0f }, 152, 2, 0, 0 }, +}; +static unk_D_86B0C4C8 D_86B0C41C[] = { + { { 0.0f, 30.0f, -900.0f }, 119, 2, 0, 0 }, { { 15.0f, 10.0f, -250.0f }, 87, 2, 0, 0 }, + { { -38.0f, 20.0f, -550.0f }, 118, 2, 0, 0 }, { { 18.0f, 30.0f, 150.0f }, 73, 2, 0, 0 }, + { { -140.0f, 0.0f, 0.0f }, 152, 2, 0, 0 }, +}; +static unk_D_86B0C4C8 D_86B0C480[] = { + { + { 0.0f, 0.0f, 0.0f }, + 0xD7, + 0, + 0x0000, + 0x0000, + }, + { + { -140.0f, 0.0f, 0.0f }, + 0x98, + 2, + 0x0000, + 0x0000, + }, + { + { 0.0f, 0.0f, 0.0f }, + 0x00, + 0, + 0x0000, + 0x0000, + }, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B02A78.s") +static s32 pad_D_86B0C4BC[3] = { 0, 0, 0 }; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B02B50.s") +unk_D_86B0C4C8* D_86B0C4C8[] = { + D_86B0C2F0, D_86B0C354, D_86B0C3B8, D_86B0C41C, D_86B0C480, NULL, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B02C9C.s") +static u32 D_86B0C4E0[] = { + 0xE4FFE4FF, 0xE4FFE4FF, 0xE4FFE4FF, 0xE4FFE4FF, 0xE4FFE4FF, 0xE4FFE4FF, 0xE4FFE4FF, 0xE4FFE4FF, 0xE4FFE4FF, + 0xE6FFEEFF, 0xF8FEFFFB, 0xFFD3FB4D, 0xF309E701, 0xD405C12D, 0xBAA1C5E9, 0xD7F9E2FF, 0xE4FFE4FF, 0xE4FFE4FF, + 0xE5FFE5FF, 0xE5FFE4FF, 0xE4FFE4FF, 0xE4FFE4FF, 0xE4FFE4FF, 0xE4FFE4FF, 0xE5FFE6FF, 0xEAFFF2FF, 0xFCFFFFFC, + 0xFFDBFC62, 0xF214E409, 0xD114BE45, 0xB8A9C5ED, 0xD8FBE2FF, 0xE4FFE6FF, 0xEAFFEEFF, 0xF1FFF2FF, 0xEFFFEBFF, + 0xE7FFE5FF, 0xE5FFE5FF, 0xE4FFE4FF, 0xE5FFE7FF, 0xEAFFEFFF, 0xF3FFF9FF, 0xFFFFFFFC, 0xFFDAFF7A, 0xF336E227, + 0xCD3CBB71, 0xB9B8C7EF, 0xDAFFE3FF, 0xE6FFEDFF, 0xF8FFFFFF, 0xFFFFFFFF, 0xFDFFF6FF, 0xF2FFEFFF, 0xEFFFEDFF, + 0xE8FFE4FF, 0xE6FFEDFF, 0xF4FFFAFF, 0xFCFFFFFF, 0xFFFEFFFF, 0xFFCFFF89, 0xF155DE4B, 0xC963BA93, 0xBBCACAF4, + 0xDBFFE4FF, 0xEBFFFBFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFEFFF8FF, 0xF7FFF8FF, 0xF9FFF4FF, 0xEAFFE5FF, 0xE9FFF6FF, + 0xFDFFFEFF, 0xFFFFFFFF, 0xFFFEFFE9, 0xFFB9FB90, 0xEC72D96D, 0xC685BBAF, 0xBFDCCDFB, 0xDDFFE4FF, 0xF6FFFFFF, + 0xFFFFFFEF, 0xFFCAFEC4, 0xF3D5F0EE, 0xF2FFF5FF, 0xF5FFEFFF, 0xE6FFE3FF, 0xEDFFF9FF, 0xFEFFFEFF, 0xFEFFFFFF, + 0xFFFFFFD1, 0xFFA4F58D, 0xE781D787, 0xC7A1BFC9, 0xC6EFD3FD, 0xDFFFE4FF, 0xFFFFFFFF, 0xFFF9FFB7, 0xFF9BF09E, + 0xE8B3E6CB, 0xE9DEEAEE, 0xE9FAE5FF, 0xE1FFE3FF, 0xECFFF6FF, 0xFCFFFDFF, 0xFDFFFCFF, 0xFFFAFFC6, 0xFB9AF086, + 0xE685DA91, 0xCEB1C9D9, 0xCFF7DAFF, 0xE4FFE9FF, 0xFFFFFFFC, 0xFFCAFF93, 0xF57FE889, 0xE39BE0B4, 0xDFCDDEDE, + 0xDEEFDEFF, 0xDEFFE2FF, 0xE8FFEFFF, 0xF3FFF5FF, 0xF4FFF6FF, 0xFBFFFCC8, 0xF79AEE80, 0xE77BE086, 0xD9A7D6D2, + 0xDBF7E6FD, 0xEFFFF4FF, 0xFFFDFFDA, 0xFFA0FF79, 0xED71E478, 0xDF89D9A1, 0xD6C2D5DE, 0xD8F2DBFF, 0xDEFFE2FF, + 0xE4FFE7FF, 0xE7FFE8FF, 0xEAFFF0FF, 0xF6FEF8D6, 0xF4A3EE81, 0xE973E674, 0xE38AE1B3, 0xE6E2F0FA, 0xFBFDFFFF, + 0xFFD6FFB0, 0xFF84F16B, 0xE367DA6F, 0xD37FCC9C, 0xC8C2CAE7, 0xD2FFD9FF, 0xDEFFDFFF, 0xDFFFDEFF, 0xDDFFDFFF, + 0xE3FFEAFF, 0xF1FFF4ED, 0xF0B6EB8F, 0xE875E86A, 0xE66DE488, 0xE8AFF1D1, 0xFDE3FFEB, 0xFDA6FF8F, 0xF577E06B, + 0xD073C481, 0xBC98BAB6, 0xBBDEC2FF, 0xCDFFD9FF, 0xDEFFDDFF, 0xDAFFD8FF, 0xD7FFD8FF, 0xDEFFE5FF, 0xEBFFEEFE, + 0xEBD5E6A9, 0xE389E273, 0xDF6ADD75, 0xDF87E995, 0xF599FC9B, 0xF56DF46F, 0xE473CD7E, 0xBA94B8B5, 0xBBD7C1F7, + 0xC7FFD0FF, 0xD9FFE2FF, 0xE3FFDEFF, 0xD8FFD4FF, 0xD3FFD7FF, 0xE1FFE8FF, 0xEBFFEBFF, 0xE7FFE2D3, 0xDDAFD992, + 0xD784D67C, 0xD972E266, 0xEC58F14F, 0xEF40E957, 0xD673BF95, 0xB7BDBBE9, 0xC6FADBFF, 0xECFFF2FF, 0xF2FFF4FF, + 0xEFFFE4FF, 0xDBFFD5FF, 0xD5FFE1FF, 0xF1FFF6FF, 0xF2FFF0FF, 0xEDFFE4FE, 0xDAE4D5C7, 0xD7AEDA8E, 0xDE6DE44F, + 0xEA36EC2E, 0xEC2BE34A, 0xD075BBA9, 0xB8D9C3F6, 0xE2FFF8FF, 0xFEFFFEFF, 0xFEFFFFFF, 0xF9FFEAFF, 0xDDFFD8FF, + 0xDAFFEAFF, 0xFBFFFEFF, 0xFAFFF8FF, 0xF8FFEEFF, 0xDFFFDBFB, 0xDFD6E4A7, 0xE872EB47, 0xEC2AEB20, 0xE925E044, + 0xD174C3AD, 0xC5E2D8FA, 0xF3FEFEFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFBF7EAFC, 0xDDFFD8FF, 0xDCFFEAFF, 0xFAFFFEFF, + 0xFCFFFCFF, 0xFDFFF5FF, 0xEAFFE4FF, 0xE7F7ECC4, 0xF084F04A, 0xEE26EB18, 0xE722E13B, 0xD867D1A4, 0xD4DEE5F8, + 0xF6FEFEFF, 0xFFFFFFFF, 0xFFFAFFDC, 0xF8CDE7DC, 0xDCFED7FF, 0xD9FFE5FF, 0xF6FFFDFF, 0xFCFFFDFF, 0xFDFFFAFF, + 0xF4FFECFF, 0xECFFEFE7, 0xF3A2F45C, 0xF02EEB1B, 0xE421E12C, 0xDB4CD880, 0xDCC2E9F1, 0xF6FDFFFB, 0xFFF3FFE2, + 0xFFBAFF99, 0xF191E2AD, 0xD7E4D3FE, 0xD4FFDFFF, 0xEEFFF6FF, 0xFCFFFFFF, 0xFFFFFEFF, 0xFCFFF5FF, 0xF2FFF4FC, + 0xF7D2F885, 0xF24AEA2C, 0xE21FDF1B, 0xDA30D85C, 0xDD9CE8D0, 0xF7E1FFDD, 0xFFBBFF8E, 0xFF63F644, 0xE842DA6F, + 0xD1BCCEFA, 0xD1FFDAFF, 0xE9FFF5FF, 0xFCFFFFFF, 0xFFFFFFFF, 0xFEFFFBFF, 0xFAFFF8FF, 0xFCEEFCAB, 0xF471E748, + 0xDE1CDD10, 0xDA1DDA43, 0xDF7EE8AC, 0xF3B7FBA5, 0xFF79FC44, 0xF61FEC10, 0xE00ED336, 0xCBA0CAF4, 0xD1FEDEFF, + 0xEEFFF8FF, 0xFDFFFEFF, 0xFFFFFFFF, 0xFDFFFEFF, 0xFDFFF9FF, 0xFBFEFCBE, 0xF487E656, 0xDB20D916, 0xD625D647, + 0xDA76E295, 0xEB9BF184, 0xF358F127, 0xEC0BE404, 0xD908CD32, 0xC59FC8F4, 0xD5FEE7FF, 0xF8FFFFFF, 0xFFFFFFFF, + 0xFFFFFDFC, 0xFCFCFBFF, 0xFAFFF6FF, 0xF9FFFBD4, 0xF692E85C, 0xDA29D62A, 0xD041CE69, 0xD18BD89B, 0xE099E581, + 0xE85AE62D, 0xE310DD0D, 0xD220C75D, 0xC1BDC8F8, 0xDBFFF1FF, 0xFFFFFFFF, 0xFFFBFFE5, 0xFFD9FFD4, 0xFEE9FBF9, + 0xF8FFF7FE, 0xFBFEFFDF, 0xFD92EC56, 0xDD31D342, 0xC867C496, 0xC8B2CFB9, 0xD6B1DA9B, 0xDD78DD50, 0xDB33D437, + 0xCA5EC09F, 0xBFEACBFD, 0xE2FFF8FF, 0xFFFFFFE0, 0xFFBCFF95, 0xFF6BFF57, 0xFF71FDAE, 0xFBDEFDF6, 0xFFF3FFBA, + 0xFF6AF43F, 0xDD38CE5C, 0xC08FBCC7, 0xC1E7C9E7, 0xCFDBD3C6, 0xD6A9D68B, 0xD378CC83, 0xC2A7BCDB, 0xC0FED1FF, + 0xE7FFFCFF, 0xFFECFFBB, 0xFF8DFD50, 0xF817F708, 0xF619F750, 0xFA85FF9B, 0xFF9BFF69, 0xFF2FF826, 0xD842C677, + 0xBAB1BBEC, 0xC4FECDFE, 0xD1FBD4F5, 0xD6E2D3CC, 0xCDC1C5C9, 0xBEE2BDFF, 0xC5FFD6FF, 0xE9FFF8FF, 0xFCE3FAB2, + 0xF57EEF34, 0xEB05EA00, 0xEC04ED25, 0xF039F63C, 0xFD42FF25, 0xFD10F21A, 0xCC57BB93, 0xB7CDBDF9, 0xCBFFD5FF, + 0xDAFFDEFF, 0xDEFFD8FC, 0xCEF6C5FD, 0xC0FFC2FF, 0xCCFFDAFF, 0xE7FFEEFF, 0xEFF4EDC3, 0xEA8BE642, 0xE30AE201, + 0xE307E314, 0xE30EE60B, 0xEA15EC0C, 0xE908E421, 0xBD7AB7B7, 0xB7E8C2FE, 0xD3FFDEFF, 0xE5FFEAFF, 0xE9FFE0FF, + 0xD4FFCAFF, 0xC7FFCBFF, 0xD2FFDBFF, 0xE2FFE5FF, 0xE4FFE4EF, 0xE3B9E176, 0xDF35DE1A, 0xDD17DB0D, 0xD906D906, + 0xD913D715, 0xD415D23C, 0xB7B1B7DF, 0xBAF9CBFF, 0xDBFFE5FF, 0xEDFFF3FF, 0xF2FFE8FF, 0xD9FFD0FF, 0xCEFFD2FF, + 0xD7FFDCFF, 0xDFFFE0FF, 0xE0FFE1FF, 0xE2F1E2B8, 0xE07FDD54, 0xDC2ADA0F, 0xD70ED318, 0xD031CA44, 0xC347C170, + 0xBEE6BDFA, 0xC7FED6FF, 0xE1FFEAFF, 0xF2FFF7FF, 0xF5FFE8FF, 0xD8FFD1FF, 0xD2FFD7FF, 0xDCFFE0FF, 0xE0FFE0FF, + 0xE2FFE4FF, 0xE7FFE9F1, 0xE7BAE382, 0xE047DD29, 0xD72AD143, 0xCA6BC185, 0xB99ABAB7, 0xCEFCCFFF, 0xD6FFDDFF, + 0xE4FFE9FF, 0xEFFFF2FF, 0xEEFFDFFF, 0xD1FFCCFF, 0xD2FFDAFF, 0xE1FFE3FF, 0xE3FFE3FF, 0xE5FFE9FF, 0xEEFFF1FF, + 0xF1D8ED96, 0xE851E22F, 0xD830CD57, 0xC48DBCB3, 0xB7CFBDE8, 0xDCFFDDFF, 0xE0FFE2FF, 0xE4FFE4FF, 0xE5FFE3FF, + 0xDEFFD3FF, 0xC9FFC9FF, 0xD3FFDDFF, 0xE3FFE4FF, 0xE4FFE4FF, 0xE6FFEBFF, 0xF2FFF8FC, 0xF9DFF589, 0xEE36E416, + 0xD61BC953, 0xC099BBC7, 0xBCE5C6F8, 0xE3FFE4FF, 0xE4FFE4FF, 0xE4FFE2FF, 0xDEFFDAFF, 0xD5FFCDFF, 0xC8FFCCFF, + 0xD8FFE1FF, 0xE4FFE4FF, 0xE4FFE4FF, 0xE6FFECFF, 0xF4FFFBFC, 0xFDDBF970, 0xF120E50B, 0xD713C84B, 0xBF9DBED3, + 0xC4EFCFFC, 0xE4FFE4FF, 0xE4FFE4FF, 0xE4FFE3FF, 0xE2FFE1FF, 0xDFFFD9FF, 0xD4FFD7FF, 0xDEFFE4FF, 0xE4FFE4FF, + 0xE4FFE4FF, 0xE5FFECFF, 0xF6FEFDFB, 0xFFDCFC6C, 0xF11DE50A, 0xD611C849, 0xC2A3C5DD, 0xCDF7D9FE, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B02ED0.s") +static unk_D_86002F34_018 D_86B0CCE0 = { + 0x03, 0x02, 0x00, 0x20, 0x0020, 0x0400, D_86B0C4E0, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B02F34.s") +static Gfx D_86B0CCF0[] = { + gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_MIRROR | G_TX_WRAP, 5, G_TX_NOLOD, + G_TX_MIRROR | G_TX_WRAP, 5, G_TX_NOLOD), + gsDPLoadSync(), + gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 1023, 256), + gsDPPipeSync(), + gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 8, 0x0000, G_TX_RENDERTILE, 0, G_TX_MIRROR | G_TX_WRAP, 5, G_TX_NOLOD, + G_TX_MIRROR | G_TX_WRAP, 5, G_TX_NOLOD), + gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, 0x007C, 0x007C), + gsSPEndDisplayList(), +}; +static Vtx D_86B0CD28[] = { + VTX(-3000, -9000, 0, 1024, -2048, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(-3000, -3000, 0, 1024, -1024, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(-9000, -3000, 0, 0, -1024, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(-9000, -9000, 0, 0, -2048, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(-3000, 3000, 0, 1024, 0, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(-9000, 3000, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(-3000, 9000, 0, 1024, 1024, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(-9000, 9000, 0, 0, 1024, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(3000, 3000, 0, 2048, 0, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(9000, 3000, 0, 3072, 0, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(9000, 9000, 0, 3072, 1024, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(3000, 9000, 0, 2048, 1024, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(3000, -3000, 0, 2048, -1024, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(9000, -3000, 0, 3072, -1024, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(3000, -9000, 0, 2048, -2048, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(9000, -9000, 0, 3072, -2048, 0xFF, 0xFF, 0xFF, 0xFF), +}; +static Gfx D_86B0CE28[] = { + gsSPClearGeometryMode(G_LIGHTING), + gsDPSetCombineLERP(TEXEL1, TEXEL0, ENV_ALPHA, TEXEL0, TEXEL1, TEXEL0, ENVIRONMENT, TEXEL0, COMBINED, 0, SHADE, 0, + COMBINED, 0, PRIMITIVE, 0), + gsDPSetEnvColor(255, 255, 255, 125), + gsDPSetFogColor(191, 248, 255, 255), + gsSPFogPosition(995, 1000), + gsSPVertex(D_86B0CD28, 16, 0), + gsSPSetGeometryMode(G_CULL_BACK | G_FOG), + gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0), + gsSP2Triangles(1, 4, 5, 0, 1, 5, 2, 0), + gsSP2Triangles(4, 6, 7, 0, 4, 7, 5, 0), + gsSP2Triangles(8, 9, 10, 0, 8, 10, 11, 0), + gsSP2Triangles(8, 12, 13, 0, 8, 13, 9, 0), + gsSP2Triangles(12, 14, 15, 0, 12, 15, 13, 0), + gsSP2Triangles(6, 4, 8, 0, 6, 8, 11, 0), + gsSP2Triangles(4, 1, 12, 0, 4, 12, 8, 0), + gsSP2Triangles(1, 0, 14, 0, 1, 14, 12, 0), + gsSPSetGeometryMode(G_FOG | G_LIGHTING), + gsSPEndDisplayList(), +}; +static u8 D_86B0CEB8[] = { + 0x00, 0x03, 0x00, 0x02, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0F, 0x00, 0x0F, +}; +static u8 D_86B0CECC[] = { + 0x00, 0x03, 0x00, 0x02, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, +}; +static u8 D_86B0CEE0[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0x00, 0x01, 0x00, 0x00, +}; +static u8 D_86B0CEEC[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0x00, 0x01, 0x00, 0x00, +}; +static u8* D_86B0CEF8[] = { + D_86B0C4E0, D_86B0CEB8, D_86B0CEE0, NULL, NULL, NULL, NULL, NULL, +}; +static u8* D_86B0CF18[] = { + D_86B0C4E0, D_86B0CECC, D_86B0CEEC, NULL, NULL, NULL, NULL, NULL, +}; +static unk_D_86002F34_000_014 D_86B0CF38 = { + D_86B0CEF8, + D_86B0CF18, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B02F8C.s") +static u32 D_86B0CF40[] = { + 0x09000000, 0x05000000, 0x09000000, 0x05000000, 0x09000000, 0x05000000, 0x13000005, 0x03E303E8, + 0x2309FFFF, 0x86B0CCF0, 0x0000FFFF, 0xFFFFFFFF, 0x22050000, 0x00000000, 0x08000000, 0x810001D0, + 0x86B0CF38, 0x22050000, 0x86B0CE28, 0x06000000, 0x06000000, 0x06000000, 0x04000000, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B03048.s") +u32 D_86B0CF9C[] = { + 0x17000001, 0x00000010, &D_86B0CCE0, 0x00000000, D_86B0CD28, 0x05000000, 0x1C000000, 0x00008000, 0x00008000, + 0x00008000, 0x05000000, 0x03000000, D_86B0CF40, 0x06000000, 0x06000000, 0x01000000, 0x00000000, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B034AC.s") +static u32 D_86B0CFE0[] = { + 0x322B3AB3, 0x63B77C77, 0x5B73322F, 0x21ED21ED, 0x21EB21AB, 0x21A919A9, 0x19A921A9, 0x19A51963, 0x29E93A71, + 0x42F16BF1, 0x84735B2B, 0x3A2729E5, 0x2161215F, 0x21A52A2D, 0x29E7191B, 0x191B29E1, 0x32335B79, 0x747963B7, + 0x2A2F116D, 0x19AD21AD, 0x21AB1167, 0x112508E3, 0x09231123, 0x08DF08DD, 0x196729ED, 0x3A29636B, 0x63AD4269, + 0x29A51963, 0x19631121, 0x11211963, 0x1965111F, 0x10DB2165, 0x5BB96BF9, 0x53773273, 0x19B119AF, 0x19AD19A9, + 0x19671967, 0x08E108DF, 0x08DD08DB, 0x089B08DF, 0x19A929EB, 0x5B718475, 0x743563B5, 0x4AF13A6D, 0x29EB21A9, + 0x21A921A7, 0x29E721A5, 0x19633A6F, 0x743963B9, 0x53773275, 0x117121F1, 0x116908E3, 0x111F111D, 0x00990899, + 0x191D10DB, 0x08DB1965, 0x29EB5B71, 0x953B8CBB, 0x6BF95BB7, 0x4B353A6F, 0x21EB1967, 0x196929ED, 0x4AF15331, + 0x42B163F9, 0x74395379, 0x53795379, 0x327319AF, 0x112708DF, 0x08DD08DB, 0x00570055, 0x089910DB, 0x11232A2B, + 0x533384B9, 0x84BB5BB9, 0x4AF73AB3, 0x29ED19A7, 0x19671125, 0x11231125, 0x29ED5B75, 0x6C397C7B, 0x5B773235, + 0x3A754AF7, 0x53773AB5, 0x19AD1125, 0x08DF10DD, 0x08DB0099, 0x08DD1121, 0x21E93AAF, 0x63B57439, 0x53393AB7, + 0x327329ED, 0x19691167, 0x11251123, 0x11231125, 0x11693271, 0x63B77439, 0x3AB521F3, 0x21F321F3, 0x327542F5, + 0x3AB321AD, 0x19671965, 0x19651165, 0x196519A7, 0x29EB3AAF, 0x74377439, 0x42B742F7, 0x42F73273, 0x19AF1169, + 0x11271167, 0x11671127, 0x19AB21AD, 0x3A715B75, 0x29EF19B1, 0x19B319B1, 0x19B12A33, 0x32733273, 0x21EF19AD, + 0x196B19AB, 0x19AB19AB, 0x3AB18CB7, 0xB5FB63B7, 0x3AB75379, 0x533942B7, 0x21F3116D, 0x112919AD, 0x21AD1969, + 0x21AB1969, 0x19A93A6F, 0x21A9116D, 0x19AF116F, 0x19AF21F1, 0x2A333273, 0x3AB33AB1, 0x3A7142B1, 0x4AF163B3, + 0x94F9C67D, 0xBE3B5373, 0x19B13275, 0x4AF742B7, 0x327719B1, 0x21F12A33, 0x2A3119A9, 0x196508DF, 0x08E121A5, + 0x2163116B, 0x116D196D, 0x19AD19AF, 0x19AF21F1, 0x32714AF3, 0x63B58CB7, 0xA579BE3B, 0xCE7DCEBD, 0x9D773A6F, + 0x116D116F, 0x21F53277, 0x3AB72A35, 0x327742F7, 0x32731969, 0x111F08DB, 0x08D9195D, 0x19610925, 0x11271967, + 0x196919AB, 0x196D19AD, 0x19AD29ED, 0x326F4AF1, 0x6BF58CB7, 0x9D79ADB9, 0x5B7119A9, 0x196B19AF, 0x19B12A37, + 0x42F94AF9, 0x53395337, 0x2A311167, 0x08DB10D5, 0x0895191B, 0x191908DB, 0x111D1121, 0x19251967, 0x19651965, + 0x11651167, 0x196719A9, 0x21EB2A2D, 0x3A6F5331, 0x2A291167, 0x196B21AF, 0x197121F5, 0x42F963FB, 0x6C3B5337, + 0x21F11167, 0x08DB10D7, 0x08951919, 0x191710D9, 0x111D10DF, 0x11211123, 0x1121111F, 0x10DD08DD, 0x08DF1123, + 0x11251167, 0x196919AB, 0x21A91967, 0x1169116D, 0x116F19B5, 0x3AB76BFB, 0x7C7B5B79, 0x327519AB, 0x1123111F, + 0x111F215B, 0x19170893, 0x08DB1121, 0x11251125, 0x11231121, 0x112108DB, 0x08950897, 0x08DD0923, 0x112519A9, + 0x21AB21AB, 0x0927112B, 0x19AF19B3, 0x2A7763BB, 0x84BB5377, 0x327521EF, 0x21ED1167, 0x1965219F, 0x19590891, + 0x08D7111F, 0x11231121, 0x111F1121, 0x112308D9, 0x088F088D, 0x10D108D7, 0x08DB1165, 0x21AB21AB, 0x11270927, + 0x116D116F, 0x2A355BB9, 0x743B42F5, 0x2A3321F1, 0x21AD1923, 0x191F215F, 0x19590893, 0x08D910DD, 0x111D10DB, + 0x111D10DB, 0x08D90891, 0x088D088B, 0x088B088D, 0x089108D9, 0x19A721A9, 0x11651125, 0x0927092B, 0x21F55379, + 0x5B773233, 0x21F119AF, 0x1969111F, 0x10D9195B, 0x191908D7, 0x10D910DB, 0x111B1121, 0x19651967, 0x1965111B, + 0x10D510D1, 0x08D3088F, 0x088F0893, 0x111B1961, 0x19631165, 0x196919AD, 0x2A354B39, 0x42F521F1, 0x21F119AD, + 0x1969111F, 0x10D91919, 0x191910D9, 0x10DB1121, 0x196B21F3, 0x21F319B3, 0x21F52235, 0x29EF21EB, 0x1967111F, + 0x10D910D7, 0x10D9111F, 0x11631125, 0x116921F1, 0x42F75377, 0x327119AF, 0x21F119AD, 0x19AD21A7, 0x08DB1919, + 0x191D10DB, 0x196721EF, 0x21F52A77, 0x32773277, 0x32772A77, 0x3AB74AF5, 0x323121AB, 0x1163111D, 0x111D1123, + 0x1127116B, 0x21F14B37, 0x6BF94AF5, 0x21EF19AF, 0x2A3342B3, 0x3A7142F3, 0x322B2161, 0x322D19AD, 0x21F32A37, + 0x3AF95B79, 0x5B7942F9, 0x327721F5, 0x3A7563B7, 0x6BF74AF5, 0x21EB1123, 0x11211967, 0x21EF3AB3, 0x63B984BB, + 0x63B72A31, 0x19AD19B1, 0x2A3342B5, 0x533563F9, 0x7C795B73, 0x5BB72A75, 0x3AB7537B, 0x6C3B6BFB, 0x53393279, + 0x21F721F5, 0x21F342B5, 0x6C397439, 0x53752A2B, 0x116321A9, 0x4B357CBB, 0x953B6C39, 0x3AB319AD, 0x116B19AD, + 0x19AF21F1, 0x2A333AB5, 0x63B98479, 0x6BF75335, 0x4B375379, 0x5BB95B79, 0x42F92A37, 0x21F521F5, 0x19F32A33, + 0x4AF763F9, 0x63F94AF3, 0x19653AAF, 0x8CFB9D7D, 0x74393AB5, 0x21AD1169, 0x08E308E1, 0x09251127, 0x19AD19B1, + 0x3AB363B5, 0x3A6B42AF, 0x42F33AB5, 0x3AB74B39, 0x42F93277, 0x21F719B3, 0x19B32233, 0x3AB75377, 0x6BF76BF7, + 0x53317437, 0x84BB5377, 0x327321ED, 0x092508DF, 0x00990057, 0x009908DF, 0x116719AD, 0x42AF4AEF, 0x21A31965, + 0x19AB29EF, 0x2A332A35, 0x32773277, 0x2A7721F5, 0x21F53AB7, 0x42F742B5, 0x5B7584B9, 0x8CF984BB, 0x5B772231, + 0x19AB1123, 0x089908D7, 0x10D50851, 0x109310D7, 0x111F21E9, 0x3A6B3227, 0x219F1121, 0x112319A9, 0x19AB19AD, + 0x19AF21F1, 0x32753AB7, 0x3AB74AF9, 0x3AB521F3, 0x322F73F3, 0x94F96BF9, 0x327519AD, 0x1167111F, 0x08D70891, + 0x10CF088D, 0x088D10D3, 0x195D3225, 0x322529E1, 0x2159111D, 0x111D1121, 0x11231167, 0x196921AD, 0x29F13275, + 0x3AB73275, 0x21F119B1, 0x116B4AED, 0x9D396BF9, 0x327519AF, 0x196710DD, 0x08950851, 0x004B0007, 0x084910D3, + 0x3A2142A7, 0x219F215B, 0x19150893, 0x089510DB, 0x19611967, 0x196B19B1, 0x2A333AB5, 0x3AB321EF, 0x19AD19AD, + 0x09253229, 0xADBB84BB, 0x42F721F1, 0x11690921, 0x08990895, 0x004F088F, 0x088F31D9, 0x5B273A63, 0x191B2159, + 0x19170051, 0x0895111D, 0x11211967, 0x19AF21F1, 0x3AB34B35, 0x2A2F196B, 0x19690925, 0x092329E9, 0xA579ADBD, + 0x63F93275, 0x19AF19AB, 0x1965111F, 0x111D191B, 0x29DD6367, 0x6BAD29DF, 0x10D72117, 0x191910D9, 0x10DD1121, + 0x08E31969, 0x21AD3271, 0x53333A6F, 0x19691127, 0x11231123, 0x11652A2B, 0x6BF5A57B, 0x7CBB42F5, 0x21F119AD, + 0x11691125, 0x21A552E9, 0x7C6F8CB3, 0x53291959, 0x10D52159, 0x195B111F, 0x11251167, 0x19AB29EF, 0x32714AF1, + 0x42AF21AB, 0x112708E3, 0x08E11123, 0x112321AB, 0x3A716BF5, 0x8CFB63B7, 0x21EF116D, 0x19AB3229, 0x532D8473, + 0x9D377C73, 0x3A27191D, 0x10D71919, 0x191B1123, 0x19AD19AF, 0x2A314AF3, 0x533342B1, 0x21AB1169, 0x11271125, + 0x11251167, 0x11251969, 0x21ED3A71, 0x63B77C79, 0x327121AB, 0x3A6B532D, 0x636F6371, 0x63B35B73, 0x322D191F, + 0x10D71919, 0x29E129ED, 0x32334AF5, 0x6BF763B3, 0x42AF29ED, 0x21AD21AB, 0x196721A7, 0x19A921A9, 0x21E929EB, + 0x29EB3A71, 0x4B357439, 0x6BF7532F, 0x532B4AA9, 0x3A273229, 0x326F3AB3, 0x2A2B195D, 0x1919299D, +}; +static unk_D_86002F34_018 D_86B0D7E0 = { + 0x00, 0x02, 0x00, 0x20, 0x0020, 0x0400, D_86B0CFE0, +}; +static Gfx D_86B0D7F0[] = { + gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 0, 0x0000, G_TX_LOADTILE, 0, G_TX_MIRROR | G_TX_WRAP, 5, G_TX_NOLOD, + G_TX_MIRROR | G_TX_WRAP, 5, G_TX_NOLOD), + gsDPLoadSync(), + gsDPLoadBlock(G_TX_LOADTILE, 0, 0, 1023, 256), + gsDPPipeSync(), + gsDPSetTile(G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 0x0000, G_TX_RENDERTILE, 0, G_TX_MIRROR | G_TX_WRAP, 5, G_TX_NOLOD, + G_TX_MIRROR | G_TX_WRAP, 5, G_TX_NOLOD), + gsDPSetTileSize(G_TX_RENDERTILE, 0, 0, 0x007C, 0x007C), + gsSPEndDisplayList(), +}; +static Vtx D_86B0D828[] = { + VTX(-18000, 0, 9000, 0, 4710, 0xFF, 0xFF, 0xFF, 0xFF), VTX(-18000, 0, 3000, 0, 3482, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(-6000, 0, 3000, 2458, 3482, 0xFF, 0xFF, 0xFF, 0xFF), VTX(-6000, 0, 9000, 2458, 4710, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(-18000, 0, -3000, 0, 2253, 0xFF, 0xFF, 0xFF, 0xFF), VTX(-6000, 0, -3000, 2458, 2253, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(-18000, 0, -9000, 0, 1024, 0xFF, 0xFF, 0xFF, 0xFF), VTX(-6000, 0, -9000, 2458, 1024, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(6000, 0, -9000, 4915, 1024, 0xFF, 0xFF, 0xFF, 0xFF), VTX(18000, 0, -9000, 7373, 1024, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(18000, 0, -3000, 7373, 2253, 0xFF, 0xFF, 0xFF, 0xFF), VTX(6000, 0, -3000, 4915, 2253, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(18000, 0, 3000, 7373, 3482, 0xFF, 0xFF, 0xFF, 0xFF), VTX(6000, 0, 3000, 4915, 3482, 0xFF, 0xFF, 0xFF, 0xFF), + VTX(18000, 0, 9000, 7373, 4710, 0xFF, 0xFF, 0xFF, 0xFF), VTX(6000, 0, 9000, 4915, 4710, 0xFF, 0xFF, 0xFF, 0xFF), +}; +static Gfx D_86B0D928[] = { + gsSPClearGeometryMode(G_LIGHTING), + gsDPSetCombineLERP(TEXEL1, TEXEL0, ENV_ALPHA, TEXEL0, TEXEL1, TEXEL0, ENVIRONMENT, TEXEL0, COMBINED, 0, SHADE, 0, + COMBINED, 0, PRIMITIVE, 0), + gsDPSetEnvColor(255, 255, 255, 115), + gsDPSetFogColor(0, 0, 0, 255), + gsSPFogPosition(987, 1000), + gsSPVertex(D_86B0D828, 16, 0), + gsSPSetGeometryMode(G_CULL_BACK), + gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0), + gsSP2Triangles(1, 4, 5, 0, 1, 5, 2, 0), + gsSP2Triangles(4, 6, 7, 0, 4, 7, 5, 0), + gsSP2Triangles(8, 9, 10, 0, 8, 10, 11, 0), + gsSP2Triangles(10, 12, 13, 0, 10, 13, 11, 0), + gsSP2Triangles(12, 14, 15, 0, 12, 15, 13, 0), + gsSP2Triangles(8, 11, 5, 0, 8, 5, 7, 0), + gsSP2Triangles(11, 13, 2, 0, 11, 2, 5, 0), + gsSP2Triangles(13, 15, 3, 0, 13, 3, 2, 0), + gsSPSetGeometryMode(G_LIGHTING), + gsSPEndDisplayList(), +}; +static u8 D_86B0D9B8[] = { + 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, +}; +static u8 D_86B0D9CC[] = { + 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x05, 0x00, 0x05, 0x00, 0x0F, 0x00, 0x0F, +}; +static u8 D_86B0D9E0[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x00, +}; +static u8 D_86B0D9EC[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, +}; +static u8* D_86B0D9F8[] = { + D_86B0CFE0, D_86B0D9B8, D_86B0D9E0, NULL, NULL, NULL, NULL, NULL, +}; +static u8* D_86B0DA18[] = { + D_86B0CFE0, D_86B0D9CC, D_86B0D9EC, NULL, NULL, NULL, NULL, NULL, +}; +static unk_D_86002F34_000_014 D_86B0DA38 = { + D_86B0D9F8, + D_86B0DA18, +}; +static u32 D_86B0DA40[] = { + 0x09000000, 0x05000000, 0x09000000, 0x05000000, 0x09000000, 0x05000000, 0x13000005, 0x03E303E8, + 0x2306FFFF, D_86B0D7F0, 0x0000FFFF, 0xFFFFFFFF, 0x22010000, 0x00000000, 0x08000000, 0x810001D0, + &D_86B0DA38, 0x22010000, D_86B0D928, 0x06000000, 0x06000000, 0x06000000, 0x04000000, +}; +u32 D_86B0DA9C[] = { + 0x17000001, 0x00000010, &D_86B0D7E0, 0x00000000, D_86B0D828, 0x05000000, 0x1C000000, 0x00008000, 0x00008000, + 0x00008000, 0x05000000, 0x03000000, D_86B0DA40, 0x06000000, 0x06000000, 0x01000000, 0x00000000, +}; +static unk_D_86B0DAE0 D_86B0DAE0[] = { + { { + 0x00FF, + 0x00FF, + 0x0000, + 0x0000, + 0x0000, + 0x00B4, + 0x00FF, + 0x00FF, + 0x00FF, + 0x00FF, + 0x0000, + 0x00FF, + }, + { + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + } }, + { { + 0x00FF, + 0x00FF, + 0x00FF, + 0x0000, + 0x00FF, + 0x00FF, + 0x00FF, + 0x00FF, + 0x00FF, + 0x00FF, + 0x00FF, + 0x00FF, + }, + { + 0x0000, + 0x0000, + 0x0033, + 0x0000, + 0x0033, + 0x000F, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0033, + 0x0000, + } }, + { { + 0x00FF, + 0x00FF, + 0x0000, + 0x0000, + 0x0000, + 0x00B4, + 0x00FF, + 0x00FF, + 0x00FF, + 0x00FF, + 0x0000, + 0x00FF, + }, + { + 0x0000, + 0x0000, + 0x0011, + 0x0000, + 0x0011, + 0x0005, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0011, + 0x0000, + } }, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B03B9C.s") +static u32 D_86B0DB70 = 0x95; +static u32 D_86B0DB74 = 0x97; +static u32 D_86B0DB78 = 0x98; +static u32 D_86B0DB7C = 0x95; +static u32 D_86B0DB80 = 0x99; +static u32 D_86B0DB84 = 0x9A; +static u32 D_86B0DB88 = 0x9B; +static u32 D_86B0DB8C = 0x9C; +static u32 D_86B0DB90 = 0x98; +static u32 D_86B0DB94 = 0x9D; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B03DF4.s") +static unk_D_86B0DB98 D_86B0DB98[] = { + { D_300BAD0, 14 }, { D_300BED0, 2 }, { D_300C2D0, 6 }, { D_300BED0, 2 }, { NULL, 0 }, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B040C0.s") +static u8 D_86B0DBC0[] = { + 0x01, 0x04, 0x07, 0x6A, 0x6B, 0x85, 0x8A, 0x8C, 0x36, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04200.s") +static unk_D_86B0DBCC D_86B0DBCC[] = { + { 1270.0f, 0.0f, 27.0f, 0.0f }, + { 1783.0f, 0.0f, 27.0f, 0.0f }, + { 2120.0f, 0.0f, 25.799999237060547f, 0.0f }, + { 723.0f, 0.0f, 26.200000762939453f, 0.0f }, + { 900.0f, 0.0f, 26.5f, 0.0f }, + { 2600.0f, 0.0f, 26.299999237060547f, 0.0f }, + { 2290.0f, 0.0f, 25.899999618530273f, -10.0f }, + { 1900.0f, 0.0f, 26.399999618530273f, 0.0f }, + { 1200.0f, 0.0f, 27.0f, 0.0f }, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B042B4.s") +static u32 D_86B0DC5C[] = { + 0x0C00FFFF, 0x05000000, 0x0B00001E, 0x00000000, 0x014000F0, 0x0000000F, 0x00000000, 0x00000000, 0x05000000, + 0x0D000000, 0x05000000, 0x14000000, 0x002D0019, 0xFFFFFF28, 0x08000000, func_86B024D0, 0x00000000, 0x14000000, + 0x002D0019, 0x80808028, 0x08000000, func_86B02538, 0x00000000, 0x16646464, 0x0F000003, 0x05000000, 0x0A000000, + &D_800AC840, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x01000000, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B0434C.s") +static GraphNode* D_86B0EBC0; +static unk_D_86002F34_00C* D_86B0EBC4; +static s16 D_86B0EBC8; +static s16 D_86B0EBCA; +static f32 D_86B0EBCC; +static char** D_86B0EBD0; +static char** D_86B0EBD4; +static unk_D_86B0EBD8* D_86B0EBD8; +static unk_D_86B0EBDC* D_86B0EBDC; +static unk_D_86B0EBE0* D_86B0EBE0; +static u8 D_86B0EBE8[0xA60]; +static u8 D_86B0F648[0x180]; +static s8 D_86B0F7C8[0x100]; +static s8 D_86B0F8C8[0x100]; +static s32 D_86B0F9C8; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B044A0.s") +s32 func_86B024D0(s32 arg0, GraphNode* arg1) { + unk_D_86002F34_alt18* ptr = (unk_D_86002F34_alt18*)arg1; + f32 sp28; + s16 sp26; + s16 sp24; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B044B0.s") + if (arg0 == 2) { + func_800102A4(&D_8006F088->unk_60.at, &D_8006F088->unk_60.eye, &sp28, &sp26, &sp24); + ptr->unk_1C = sp26 + 0x2000; + ptr->unk_1E = sp24 - 0x2000; + } + return 0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04500.s") +s32 func_86B02538(s32 arg0, GraphNode* arg1) { + unk_D_86002F34_alt18* ptr = (unk_D_86002F34_alt18*)arg1; + f32 sp28; + s16 sp26; + s16 sp24; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04740.s") + if (arg0 == 2) { + func_800102A4(&D_8006F088->unk_60.at, &D_8006F088->unk_60.eye, &sp28, &sp26, &sp24); + ptr->unk_1C = -0x2000 - sp26; + ptr->unk_1E = sp24 + 0x6000; + } + return 0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04794.s") +void func_86B025A4(void) { + s32 temp_s0 = osGetCount() & 0xFF; + s32 var_v0; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04880.s") + D_86B0EBDC->unk_2F0 = 0; + func_80028AFC(2); + var_v0 = func_8002816C() & 0xFF; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B048D8.s") + D_86B0EBDC->unk_2E8 = var_v0; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04914.s") + if (var_v0 == 0) { + D_86B0EBDC->unk_2D8 = 0; + } else { + D_86B0EBDC->unk_2D8 = 1; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04944.s") + while (temp_s0-- > 0) { + MathUtil_Random_ZeroOne(); + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04C9C.s") + if (D_800AE540.unk_0000 == 0x1A) { + D_86B0F9C8 = 8; + D_86B0EBDC->unk_2EC = D_86B0DBC0[D_86B0F9C8]; + } else { + D_86B0F9C8 = MathUtil_Random_ZeroOne() * 8.0f; + if (D_86B0F9C8 >= 8) { + D_86B0F9C8 = 1; + } + D_86B0EBDC->unk_2EC = D_86B0DBC0[D_86B0F9C8]; + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04CF4.s") +void func_86B026C0(void) { + u8* temp_a1; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04D48.s") + main_pool_push_state('MONS'); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04D98.s") + func_8001BB58(&D_86B0EBDC->unk_008); + func_8001987C(); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04DF0.s") + D_86B0EBDC->unk_000 = func_80019D18(0xD3); + D_86B0EBDC->unk_008.unk_0A6 = 0xFF; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04EBC.s") + func_8001BC34(&D_86B0EBDC->unk_008, 0, 0xD3, D_86B0EBDC->unk_000->unk_08->unk_00[0]); + func_8001BD04(&D_86B0EBDC->unk_008, 0); + func_8001BB58(&D_86B0EBDC->unk_170); + func_8001987C(); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_161E60/func_86B04FB0.s") + D_86B0EBDC->unk_004 = func_80019D18(D_86B0EBDC->unk_2EC); + D_86B0EBDC->unk_170.unk_0A6 = 0; + func_8001BC34(&D_86B0EBDC->unk_170, 0, D_86B0EBDC->unk_2EC, D_86B0EBDC->unk_004->unk_08->unk_00[0]); + func_8001BD04(&D_86B0EBDC->unk_170, 0); + D_86B0EBDC->unk_170.unk_000.unk_02 &= ~0x40; + + D_86B0EBDC->unk_170.unk_030.x = D_86B0EBDC->unk_2F4 = D_86B0DBCC[D_86B0F9C8].unk_00 / 1000.0f; + D_86B0EBDC->unk_170.unk_030.y = D_86B0EBDC->unk_2F4 = D_86B0DBCC[D_86B0F9C8].unk_00 / 1000.0f; + D_86B0EBDC->unk_170.unk_030.z = D_86B0EBDC->unk_2F4 = D_86B0DBCC[D_86B0F9C8].unk_00 / 1000.0f; + + D_86B0EBDC->unk_2FC = D_86B0DBCC[D_86B0F9C8].unk_08; + D_86B0EBDC->unk_300 = D_86B0DBCC[D_86B0F9C8].unk_0C; + D_86B0EBDC->unk_170.unk_024.y = -100.0f; + D_86B0EBDC->unk_008.unk_000.unk_02 &= ~0x20; + D_86B0EBDC->unk_170.unk_000.unk_01 &= ~1; + + temp_a1 = _70D3A0_ROM_START + (D_80075BCC[D_86B0EBDC->unk_2EC] & 0xFFFFFF); + func_80003B30(D_86B0EBE8, temp_a1, temp_a1 + 0xBC0, 0); + D_86B0EBDC->unk_308 = 0; + func_87903600(); +} + +void func_86B028F8(void) { + D_86B0EBDC->unk_2DC = 0; +} + +void func_86B02908(void) { + D_86B0EBE0->unk_00 = 0xB; + D_86B0EBE0->unk_18 = 0; +} + +void func_86B02928(void) { + Vec3f sp1C; + + if (func_80015390(&D_86B0EBDC->unk_008, 1, &sp1C) != NULL) { + D_86B0EBDC->unk_170.unk_024.x = sp1C.x; + D_86B0EBDC->unk_170.unk_024.y = D_86B0EBDC->unk_2FC + sp1C.y; + D_86B0EBDC->unk_170.unk_024.z = D_86B0EBDC->unk_300 + sp1C.z; + } +} + +void func_86B0299C(void) { + D_86B0EBD8->unk_1C.unk_00.unk_00 = D_86B0DAE0[0].unk_00.unk_00; + D_86B0EBD8->unk_1C.unk_00.unk_02 = D_86B0DAE0[0].unk_00.unk_02; + D_86B0EBD8->unk_1C.unk_00.unk_04 = D_86B0DAE0[0].unk_00.unk_04; + D_86B0EBD8->unk_1C.unk_00.unk_06 = D_86B0DAE0[0].unk_00.unk_06; + D_86B0EBD8->unk_1C.unk_00.unk_08 = D_86B0DAE0[0].unk_00.unk_08; + D_86B0EBD8->unk_1C.unk_00.unk_0A = D_86B0DAE0[0].unk_00.unk_0A; + D_86B0EBD8->unk_1C.unk_00.unk_0C = D_86B0DAE0[0].unk_00.unk_0C; + D_86B0EBD8->unk_1C.unk_00.unk_0E = D_86B0DAE0[0].unk_00.unk_0E; + D_86B0EBD8->unk_1C.unk_00.unk_10 = D_86B0DAE0[0].unk_00.unk_10; + D_86B0EBD8->unk_1C.unk_00.unk_12 = D_86B0DAE0[0].unk_00.unk_12; + D_86B0EBD8->unk_1C.unk_00.unk_14 = D_86B0DAE0[0].unk_00.unk_14; + D_86B0EBD8->unk_1C.unk_00.unk_16 = D_86B0DAE0[0].unk_00.unk_16; + + D_86B0EBD8->unk_00 = 0x50; + D_86B0EBD8->unk_04 = -0x32; + D_86B0EBD8->unk_08 = 0x40; + D_86B0EBD8->unk_0C = 0xF2; + D_86B0EBD8->unk_18 = 0; +} + +void func_86B02A78(void) { + D_86B0EBC4 = D_86B0EBC0->unk_0C; + D_86B0EBC8 = 0; + D_86B0EBCA = 0; + D_86B0EBCC = 120.0f; + + func_8000E88C(&D_86B0EBC4->unk_60.at, 0.0f, 132.5f, -225.0f); + func_80010354(&D_86B0EBC4->unk_60.at, &D_86B0EBC4->unk_60.eye, D_86B0EBCC, D_86B0EBC8, D_86B0EBCA); + + D_86B0EBC4->unk_24.near = 10.0f; + D_86B0EBC4->unk_24.far = 6400.0f; + D_86B0EBC4->unk_24.fovy = 41.5f; +} + +s32 func_86B02B50(void) { + if (D_86B0F7C8[D_86B0EBE0->unk_04] == 0) { + return 1; + } + + if ((D_86B0F7C8[D_86B0EBE0->unk_04] == 0xA) || (D_86B0F7C8[D_86B0EBE0->unk_04] == 0x20)) { + D_86B0F8C8[D_86B0EBE0->unk_04] = D_86B0F7C8[D_86B0EBE0->unk_04]; + D_86B0EBE0->unk_04++; + } + + if ((D_86B0F7C8[D_86B0EBE0->unk_04] >= 0x21) && (D_86B0F7C8[D_86B0EBE0->unk_04] < 0x40)) { + D_86B0F8C8[D_86B0EBE0->unk_04] = D_86B0F7C8[D_86B0EBE0->unk_04]; + D_86B0EBE0->unk_04++; + } else { + if ((D_86B0F7C8[D_86B0EBE0->unk_04] == 0xA) || (D_86B0F7C8[D_86B0EBE0->unk_04] == 0x20)) { + D_86B0F8C8[D_86B0EBE0->unk_04] = D_86B0F7C8[D_86B0EBE0->unk_04]; + D_86B0EBE0->unk_04++; + } + D_86B0F8C8[D_86B0EBE0->unk_04] = D_86B0F7C8[D_86B0EBE0->unk_04]; + D_86B0F8C8[D_86B0EBE0->unk_04 + 1] = D_86B0F7C8[D_86B0EBE0->unk_04 + 1]; + D_86B0EBE0->unk_04++; + } + + D_86B0EBE0->unk_18 = 0; + if (D_86B0F7C8[D_86B0EBE0->unk_04] == 0) { + D_86B0EBE0->unk_18 = 1; + D_86B0EBE0->unk_1C = 0; + D_86B0EBE0->unk_1A = D_86B0DB98[D_86B0EBE0->unk_1C].unk_04; + } + + return 0; +} + +void func_86B02C9C(s16 arg0, s16 arg1) { + func_8001F3F4(); + func_8001EBE0(2, 0); + func_8001F3B4(0x10); + func_8002D5D4(0x1F, func_8002D7C0(NULL, 0, D_86B0EBD4, D_86B0EBDC->unk_2EC - 1)); + func_8002D7C0(D_86B0F7C8, 0xFF, D_86B0EBD0, 0xA5); + func_8001F1E8((arg0 - (func_8001F5B0(2, 0, D_86B0F7C8) / 2)) + 0x5A, arg1 + 5, D_86B0F7C8); + func_8001F1E8(arg0 + 0x28, arg1 + 0x19, func_8002D7C0(NULL, 0, D_86B0EBD0, 0xA2)); + func_8001F1E8(arg0 + 0x69, arg1 + 0x19, func_8002D7C0(NULL, 0, D_86B0EBD0, 0xA3)); + func_8001F444(); + + gSPDisplayList(gDisplayListHead++, D_8006F5A0); + + if (D_86B0EBDC->unk_2F0 == 1) { + func_8001D560(arg0 + 0x14, arg1 + 0x19, 0x18, 0xE, D_300B6E0, D_300B980, 0x18, 0x100000); + } else { + func_8001D560(arg0 + 0x55, arg1 + 0x19, 0x18, 0xE, D_300B6E0, D_300B980, 0x18, 0x100000); + } + + gSPDisplayList(gDisplayListHead++, D_8006F630); +} + +void func_86B02ED0(s16 arg0, s16 arg1) { + func_8001F3F4(); + func_8001EBE0(2, 0); + func_8001F3B4(0x10); + func_8001F1E8(arg0 + 0x10, arg1 + 5, "%s", D_86B0F8C8); + func_8001F444(); +} + +void func_86B02F34(void) { + s32 i; + + D_86B0EBE0->unk_10 = 0; + D_86B0EBE0->unk_04 = 0; + + // clang-format off + for (i = 0; i < 255; i++) { D_86B0F8C8[i] = 0; } + // clang-format on +} + +void func_86B02F8C(void) { + func_86B0A824(D_86B0EBE0->unk_16, D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2), D_86B0EBE0->unk_08, + D_86B0EBE0->unk_0C, 0x14, 0x14, 0xB4, 0x80); + func_86B05944(D_86B0EBE0->unk_16 - 2, (D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2)) - 2, D_86B0EBE0->unk_08 + 4, + D_86B0EBE0->unk_0C + 4, 0); +} + +void func_86B03048(void) { + s32 i; + s32 temp_v0; + + switch (D_86B0EBE0->unk_00) { + case 0: + if (D_800AE540.unk_0000 == 0x1A) { + sprintf(D_86B0F7C8, func_8002D7C0(NULL, 0, D_86B0EBD0, 0x96)); + } else { + func_8002D5D4(0x1F, func_8002D7C0(NULL, 0, D_86B0EBD4, D_86B0EBDC->unk_2EC - 1)); + func_8002D7C0(D_86B0F7C8, 0xFF, D_86B0EBD0, D_86B0DB70); + } + + D_86B0EBE0->unk_04 = 0; + D_86B0EBE0->unk_08 = 0xB4; + D_86B0EBE0->unk_0C = 0xA; + D_86B0EBE0->unk_16 = 0x46; + D_86B0EBE0->unk_14 = 0xC8; + + // clang-format off + for (i = 0; i < 255; i++) { D_86B0F8C8[i] = 0; } + // clang-format on + + func_86B02F8C(); + D_86B0EBE0->unk_00++; + break; + + case 1: + temp_v0 = func_8001046C(D_86B0EBE0->unk_0C, 0x37, 0xA, 0xA); + D_86B0EBE0->unk_0C = temp_v0; + if (temp_v0 == 0x37) { + D_86B0EBE0->unk_00++; + } + func_86B02F8C(); + D_86B0EBE0->unk_10 = 0; + break; + + case 2: + func_86B02F8C(); + func_86B02ED0(D_86B0EBE0->unk_16, D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2)); + if (func_86B02B50() != 0) { + if (D_86B0EBE0->unk_18 == 0) { + D_86B0EBE0->unk_10 = 0; + D_86B0EBE0->unk_04 = 0; + + // clang-format off + for (i = 0; i < 255; i++) { D_86B0F8C8[i] = 0; } + // clang-format on + + func_8002D5D4(0x1F, func_8002D7C0(NULL, 0, D_86B0EBD4, D_86B0EBDC->unk_2EC - 1)); + func_8002D7C0(D_86B0F7C8, 0xFF, D_86B0EBD0, D_86B0DB74); + D_86B0EBE0->unk_00++; + } + } + break; + + case 3: + func_86B02F8C(); + func_86B02ED0(D_86B0EBE0->unk_16, D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2)); + if ((func_86B02B50() != 0) && (D_86B0EBE0->unk_18 == 0)) { + D_86B0EBDC->unk_2F0 = 1; + D_86B0EBE0->unk_10 = 0; + D_86B0EBE0->unk_04 = 0; + + // clang-format off + for (i = 0; i < 255; i++) { D_86B0F8C8[i] = 0; } + // clang-format on + + sprintf(D_86B0F7C8, func_8002D7C0(NULL, 0, D_86B0EBD0, D_86B0DB78)); + func_8004E810(D_86B0EBDC->unk_2EC, 2); + func_8001BD04(&D_86B0EBDC->unk_170, *D_86B0F648); + D_86B0EBE0->unk_00++; + } + break; + + case 4: + func_86B02F8C(); + func_86B02ED0(D_86B0EBE0->unk_16, D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2)); + if ((func_86B02B50() != 0) && (D_86B0EBE0->unk_18 == 0)) { + D_86B0EBE0->unk_00 = 0xC; + } + break; + + case 12: + func_86B02F8C(); + func_86B02ED0(D_86B0EBE0->unk_16, D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2)); + break; + } +} + +void func_86B034AC(void) { + s32 i; + s32 temp_v0; + + switch (D_86B0EBE0->unk_00) { + case 0: + if (D_800AE540.unk_0000 == 0x1A) { + sprintf(D_86B0F7C8, func_8002D7C0(NULL, 0, D_86B0EBD0, 0x96)); + } else { + func_8002D5D4(0x1F, func_8002D7C0(NULL, 0, D_86B0EBD4, D_86B0EBDC->unk_2EC - 1)); + func_8002D7C0(D_86B0F7C8, 0xFF, D_86B0EBD0, D_86B0DB7C); + } + D_86B0EBE0->unk_04 = 0; + D_86B0EBE0->unk_08 = 0xB4; + D_86B0EBE0->unk_0C = 0xA; + D_86B0EBE0->unk_16 = 0x46; + D_86B0EBE0->unk_14 = 0xC8; + + // clang-format off + for (i = 0; i < 255; i++) { D_86B0F8C8[i] = 0; } + // clang-format on + + func_86B02F8C(); + D_86B0EBE0->unk_00++; + break; + + case 1: + temp_v0 = func_8001046C(D_86B0EBE0->unk_0C, 0x37, 0xA, 0xA); + D_86B0EBE0->unk_0C = temp_v0; + if (temp_v0 == 0x37) { + D_86B0EBE0->unk_00++; + } + func_86B02F8C(); + D_86B0EBE0->unk_10 = 0; + break; + + case 2: + func_86B02F8C(); + func_86B02ED0(D_86B0EBE0->unk_16, D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2)); + if (func_86B02B50() != 0) { + if (D_86B0EBE0->unk_18 == 0) { + D_86B0EBE0->unk_10 = 0; + D_86B0EBE0->unk_04 = 0; + + // clang-format off + for (i = 0; i < 255; i++) { D_86B0F8C8[i] = 0; } + // clang-format on + + sprintf(D_86B0F7C8, func_8002D7C0(NULL, 0, D_86B0EBD0, D_86B0DB80)); + D_86B0EBE0->unk_00++; + } + } + break; + + case 3: + func_86B02F8C(); + func_86B02ED0(D_86B0EBE0->unk_16, D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2)); + if (func_86B02B50() != 0) { + if (D_86B0EBE0->unk_18 == 0) { + D_86B0EBE0->unk_10 = 0; + D_86B0EBE0->unk_04 = 0; + + // clang-format off + for (i = 0; i < 255; i++) { D_86B0F8C8[i] = 0; } + // clang-format on + + sprintf(D_86B0F7C8, func_8002D7C0(NULL, 0, D_86B0EBD0, D_86B0DB84)); + D_86B0EBE0->unk_00++; + } + } + break; + + case 4: + func_86B02F8C(); + func_86B02ED0(D_86B0EBE0->unk_16, D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2)); + if (func_86B02B50() != 0) { + if (D_86B0EBE0->unk_18 == 0) { + D_86B0EBE0->unk_10 = 0; + D_86B0EBE0->unk_04 = 0; + + // clang-format off + for (i = 0; i < 255; i++) { D_86B0F8C8[i] = 0; } + // clang-format on + + func_8002D5D4(0x20, func_8002D7C0(NULL, 0, D_86B0EBD4, D_86B0EBDC->unk_2E8 - 1)); + func_8002D5D4(0x1F, func_8002D7C0(NULL, 0, D_86B0EBD4, D_86B0EBDC->unk_2EC - 1)); + func_8002D7C0(D_86B0F7C8, 0xFF, D_86B0EBD0, D_86B0DB88); + D_86B0EBE0->unk_00++; + } + } + break; + + case 5: + func_86B02F8C(); + func_86B02ED0(D_86B0EBE0->unk_16, D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2)); + if (func_86B02B50() != 0) { + if (D_86B0EBE0->unk_18 == 0) { + D_86B0EBE0->unk_10 = 0; + D_86B0EBE0->unk_04 = 0; + + // clang-format off + for (i = 0; i < 255; i++) { D_86B0F8C8[i] = 0; } + // clang-format on + + D_86B0EBE0->unk_00 = 0xD; + } + } + break; + + case 6: + func_86B02F8C(); + func_86B02ED0(D_86B0EBE0->unk_16, D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2)); + if (func_86B02B50() != 0) { + if (D_86B0EBE0->unk_18 == 0) { + D_86B0EBE0->unk_10 = 0; + D_86B0EBE0->unk_04 = 0; + + // clang-format off + for (i = 0; i < 255; i++) { D_86B0F8C8[i] = 0; } + // clang-format on + + sprintf(D_86B0F7C8, func_8002D7C0(NULL, 0, D_86B0EBD0, D_86B0DB90)); + D_86B0EBE0->unk_00++; + } + } + break; + + case 7: + func_86B02F8C(); + func_86B02ED0(D_86B0EBE0->unk_16, D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2)); + if ((func_86B02B50() != 0) && (D_86B0EBE0->unk_18 == 0)) { + D_86B0EBE0->unk_00 = 0xC; + } + break; + + case 13: + D_86B0EBE0->unk_18 = 0; + func_86B02F8C(); + func_86B02C9C(D_86B0EBE0->unk_16, D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2)); + break; + + case 12: + func_86B02F8C(); + func_86B02ED0(D_86B0EBE0->unk_16, D_86B0EBE0->unk_14 - (D_86B0EBE0->unk_0C / 2)); + break; + } +} + +void func_86B03B9C(void) { + func_86B05170(D_30074E0, D_86B0EBD8->unk_00, D_86B0EBD8->unk_04, 0x50, 0x30, 0xA0, 0x30, 0, 0, 0x50, 0x30, 0x4F, 0, + &D_86B0EBD8->unk_1C, 0); + func_86B05170(D_30074E0, D_86B0EBD8->unk_00 + 0x50, D_86B0EBD8->unk_04, 0x50, 0x30, 0xA0, 0x30, 0x50, 0, 0xA0, 0x30, + 0x9F, 0x50, &D_86B0EBD8->unk_1C, 0); + func_86B05170(D_30092E0, D_86B0EBD8->unk_08, D_86B0EBD8->unk_0C, 0x40, 0x30, 0xC0, 0x30, 0, 0, 0x40, 0x30, 0x3F, 0, + &D_86B0EBD8->unk_1C, 1); + func_86B05170(D_30092E0, D_86B0EBD8->unk_08 + 0x40, D_86B0EBD8->unk_0C, 0x40, 0x30, 0xC0, 0x30, 0x40, 0, 0x80, 0x30, + 0x7F, 0x40, &D_86B0EBD8->unk_1C, 1); + func_86B05170(D_30092E0, D_86B0EBD8->unk_08 + 0x80, D_86B0EBD8->unk_0C, 0x40, 0x30, 0xC0, 0x30, 0x80, 0, 0xC0, 0x30, + 0xBF, 0x80, &D_86B0EBD8->unk_1C, 1); +} + +s32 func_86B03DF4(void) { + D_86B0EBD8->unk_1C.unk_00.unk_00 = func_8001046C( + D_86B0EBD8->unk_1C.unk_00.unk_00, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_00, + D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_00, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_00); + D_86B0EBD8->unk_1C.unk_00.unk_02 = func_8001046C( + D_86B0EBD8->unk_1C.unk_00.unk_02, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_02, + D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_02, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_02); + D_86B0EBD8->unk_1C.unk_00.unk_04 = func_8001046C( + D_86B0EBD8->unk_1C.unk_00.unk_04, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_04, + D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_04, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_04); + D_86B0EBD8->unk_1C.unk_00.unk_06 = func_8001046C( + D_86B0EBD8->unk_1C.unk_00.unk_06, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_06, + D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_06, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_06); + D_86B0EBD8->unk_1C.unk_00.unk_08 = func_8001046C( + D_86B0EBD8->unk_1C.unk_00.unk_08, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_08, + D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_08, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_08); + D_86B0EBD8->unk_1C.unk_00.unk_0A = func_8001046C( + D_86B0EBD8->unk_1C.unk_00.unk_0A, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_0A, + D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_0A, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_0A); + D_86B0EBD8->unk_1C.unk_00.unk_0C = func_8001046C( + D_86B0EBD8->unk_1C.unk_00.unk_0C, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_0C, + D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_0C, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_0C); + D_86B0EBD8->unk_1C.unk_00.unk_0E = func_8001046C( + D_86B0EBD8->unk_1C.unk_00.unk_0E, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_0E, + D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_0E, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_0E); + D_86B0EBD8->unk_1C.unk_00.unk_10 = func_8001046C( + D_86B0EBD8->unk_1C.unk_00.unk_10, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_10, + D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_10, D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_18.unk_10); + + if ((D_86B0EBD8->unk_1C.unk_00.unk_00 == D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_00) && + (D_86B0EBD8->unk_1C.unk_00.unk_02 == D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_02) && + (D_86B0EBD8->unk_1C.unk_00.unk_04 == D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_04) && + (D_86B0EBD8->unk_1C.unk_00.unk_06 == D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_06) && + (D_86B0EBD8->unk_1C.unk_00.unk_08 == D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_08) && + (D_86B0EBD8->unk_1C.unk_00.unk_0A == D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_0A) && + (D_86B0EBD8->unk_1C.unk_00.unk_0C == D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_0C) && + (D_86B0EBD8->unk_1C.unk_00.unk_0E == D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_0E) && + (D_86B0EBD8->unk_1C.unk_00.unk_10 == D_86B0DAE0[D_86B0EBD8->unk_18 + 1].unk_00.unk_10)) { + D_86B0EBD8->unk_18++; + if (D_86B0EBD8->unk_18 == 2) { + return 1; + } + } + + return 0; +} + +Gfx* func_86B040C0(void) { + if (D_86B0EBE0->unk_18 == 1) { + if (!D_86B0EBE0->unk_1A--) { + D_86B0EBE0->unk_1C++; + if (D_86B0DB98[D_86B0EBE0->unk_1C].unk_00 == 0) { + D_86B0EBE0->unk_1C = 0; + } + D_86B0EBE0->unk_1A = D_86B0DB98[D_86B0EBE0->unk_1C].unk_04; + } + + gSPDisplayList(gDisplayListHead++, D_8006F518); + + func_8001C8C4(D_86B0EBE0->unk_16 + 0x9E, D_86B0EBE0->unk_14 + 9, 0x10, 0x10, + D_86B0DB98[D_86B0EBE0->unk_1C].unk_00, 0x10, 0); + + gSPDisplayList(gDisplayListHead++, D_8006F630); + } +} + +s32 func_86B04200(void) { + if (D_86B0EBD8->unk_04 == 0) { + func_8004B1CC(0x3A); + } + + D_86B0EBD8->unk_04 = func_8001046C(D_86B0EBD8->unk_04, 0x3E, 0x19, 0x19); + D_86B0EBD8->unk_0C = func_8001046C(D_86B0EBD8->unk_0C, 0x82, 0x19, 0x19); + + if ((D_86B0EBD8->unk_04 == 0x3E) && (D_86B0EBD8->unk_0C == 0x82)) { + return 1; + } + return 0; +} + +s32 func_86B042B4(void) { + D_86B0EBD8->unk_04 = func_8001046C(D_86B0EBD8->unk_04, -0x32, 0x19, 0x19); + D_86B0EBD8->unk_0C = func_8001046C(D_86B0EBD8->unk_0C, 0x122, 0x19, 0x19); + + if ((D_86B0EBD8->unk_04 == -0x32) && (D_86B0EBD8->unk_0C == 0x122)) { + return 1; + } + return 0; +} + +s32 func_86B0434C(void) { + Vec3f tmp; + + tmp.x = 50.0f; + tmp.y = 30.0f; + tmp.z = 100.0f; + + D_86B0EBC4->unk_60.at.y = func_800104AC(D_86B0EBC4->unk_60.at.y, 45.0f, tmp.x / 65.0f, tmp.x / 65.0f); + D_86B0EBC4->unk_60.eye.y = func_800104AC(D_86B0EBC4->unk_60.eye.y, 50.0f, tmp.y / 65.0f, tmp.y / 65.0f); + D_86B0EBC4->unk_60.eye.z = func_800104AC(D_86B0EBC4->unk_60.eye.z, 190.0f, tmp.z / 60.0f, tmp.z / 60.0f); + + if (D_86B0EBC4->unk_60.eye.z >= 85.0f) { + D_86B0EBDC->unk_008.unk_000.unk_02 |= 0x20; + D_86B0EBDC->unk_170.unk_000.unk_01 |= 1; + func_86B02928(); + } + + if (D_86B0EBC4->unk_60.eye.z >= 190.0f) { + return 1; + } + return 0; +} + +void func_86B044A0(void) { + D_86B0EBE0->unk_00 = 0; +} + +void func_86B044B0(void) { + s32 i; + + D_86B0EBE0->unk_00 = 0xB; + + // clang-format off + for (i = 0; i < 255; i++) { D_86B0F8C8[i] = 0; } + // clang-format on +} + +void func_86B04500(void) { + if (D_86B0EBE0->unk_00 == 0xD) { + if (gPlayer1Controller->buttonPressed & 0x200) { + D_86B0EBDC->unk_2F0 = 1; + } + + if (gPlayer1Controller->buttonPressed & 0x100) { + D_86B0EBDC->unk_2F0 = 0; + } + + if ((gPlayer1Controller->buttonPressed & 0x200) || (gPlayer1Controller->buttonPressed & 0x100)) { + func_80048B90(1); + } + + if ((gPlayer1Controller->buttonPressed & 0x8000) && (D_86B0EBDC->unk_2F0 == 1)) { + func_80048B90(2); + D_86B0EBE0->unk_00 = 6; + func_86B02F34(); + func_8002D5D4(0x20, func_8002D7C0(NULL, 0, D_86B0EBD4, D_86B0EBDC->unk_2E8 - 1)); + func_8002D5D4(0x1F, func_8002D7C0(NULL, 0, D_86B0EBD4, D_86B0EBDC->unk_2EC - 1)); + func_8002D7C0(D_86B0F7C8, 0xFF, D_86B0EBD0, D_86B0DB8C); + func_8001BD04(&D_86B0EBDC->unk_170, *D_86B0F648); + func_8004E810(D_86B0EBDC->unk_2EC, 2); + } + + if ((gPlayer1Controller->buttonPressed & 0x8000) && (D_86B0EBDC->unk_2F0 == 0)) { + func_80048B90(3); + D_86B0EBE0->unk_00 = 7; + func_86B02F34(); + func_8002D5D4(0x1F, func_8002D7C0(NULL, 0, D_86B0EBD4, D_86B0EBDC->unk_2EC - 1)); + func_8002D7C0(D_86B0F7C8, 0xFF, D_86B0EBD0, D_86B0DB94); + func_80017454(&D_86B0EBDC->unk_008, -1); + } + } +} + +void func_86B04740(void) { + if ((D_86B0EBE0->unk_18 == 1) && (gPlayer1Controller->buttonPressed & 0x8000)) { + D_86B0EBE0->unk_18 = 0; + func_80048B90(1); + } +} + +void func_86B04794(void) { + D_86B0EBDC->unk_304++; + if (((D_86B0EBDC->unk_304 % 60) == 0) && (D_86B0EBDC->unk_308 == 0) && (D_86B0EBE8[2641] != 0xFF)) { + func_80017788(&D_86B0EBDC->unk_170); + func_8001BD9C(&D_86B0EBDC->unk_170, D_86B0EBE8[2641]); + D_86B0EBDC->unk_308 = 1; + } else if ((D_86B0EBDC->unk_308 == 1) && (func_8001783C(&D_86B0EBDC->unk_170) == 1)) { + D_86B0EBDC->unk_308 = 0; + func_80017804(&D_86B0EBDC->unk_170, 0); + func_8001BD9C(&D_86B0EBDC->unk_170, -1); + } +} + +void func_86B04880(void) { + if (func_800174E4(&D_86B0EBDC->unk_170) == 1) { + func_80017464(&D_86B0EBDC->unk_170, 0); + func_8001BD04(&D_86B0EBDC->unk_170, 0); + } +} + +void func_86B048D8(void) { + if (((s32)D_86B0EBDC->unk_008.unk_040.unk_0C >> 0x10) == -1) { + if ((D_86B0EBDC->unk_008.unk_040.unk_08 >> 0x10) > 0) { + D_86B0EBDC->unk_008.unk_040.unk_08 += 0xFFFF0000; + } + } +} + +void func_86B04914(void) { + Cont_StartReadInputs(); + Cont_ReadInputs(); + func_8001F730(); +} + +s32 func_86B04944(void) { + if (D_86B0EBDC->unk_2DC >= 7) { + func_86B04740(); + func_86B04794(); + func_86B04880(); + } + + switch (D_86B0EBDC->unk_2DC) { + case 0: + if (func_86B04200() != 0) { + D_86B0EBDC->unk_2DC++; + } + break; + + case 1: + if (func_86B03DF4() != 0) { + D_86B0EBDC->unk_2E4 = 0; + D_86B0EBDC->unk_2DC++; + } + break; + + case 2: + if (D_86B0EBDC->unk_2E4++ == 0x14) { + D_86B0EBDC->unk_2E4 = 0; + D_86B0EBDC->unk_2DC++; + } + break; + + case 3: + if (func_86B042B4() != 0) { + D_86B0EBDC->unk_2DC++; + } + break; + + case 4: + if (D_86B0EBDC->unk_2E4++ >= 0x1E) { + func_8000E88C(&D_86B0EBC4->unk_60.at, 0.0f, 90.0f, 0.0f); + func_8000E88C(&D_86B0EBC4->unk_60.eye, 0.0f, 80.0f, 90.0f); + + if (D_86B0EBDC->unk_2E4 == 0x1F) { + func_879037D0(0.2f, 0.0f, 125.0f, -235.0f, 0x7D2, 0, 0); + } + + if (D_86B0EBDC->unk_2E4 == 0x3C) { + func_87903838(0.2f, 100.0f, 125.0f, -235.0f, 0x7D2, -0xE38, 0); + } + + if (D_86B0EBDC->unk_2E4 == 0x5A) { + func_879038AC(0.2f, -100.0f, 125.0f, -235.0f, 0x7D2, 0xE38, 0); + } + } + + if (D_86B0EBDC->unk_2E4 == 0x78) { + D_86B0EBDC->unk_2E4 = 0; + D_86B0EBDC->unk_2DC++; + } + break; + + case 5: + if (func_86B0434C() != 0) { + D_86B0EBDC->unk_2DC++; + } + break; + + case 6: + func_86B02928(); + if (func_800174E4(&D_86B0EBDC->unk_008) != 0) { + D_86B0EBDC->unk_2E4 = 0; + D_86B0EBDC->unk_2DC++; + } + break; + + case 7: + func_86B044A0(); + func_8004B1CC(0x13); + D_86B0EBDC->unk_2DC++; + break; + + case 8: + func_86B048D8(); + func_86B02928(); + func_86B04500(); + if (D_86B0EBE0->unk_00 == 0xC) { + D_86B0EBDC->unk_2DC++; + } + break; + + case 9: + func_86B048D8(); + func_86B02928(); + if (D_86B0EBDC->unk_2E4++ == 2) { + return 1; + } + break; + } + + return 0; +} + +void func_86B04C9C(void) { + if (D_86B0EBDC->unk_2D8 == 1) { + func_86B034AC(); + } else { + func_86B03048(); + } + func_86B03B9C(); + func_86B040C0(); +} + +void func_86B04CF4(UNUSED s32 arg0) { + func_800079C4(); + func_8000699C(&gDisplayListHead, 1); + func_80015348(); + func_80015094(D_86B0EBC0); + func_86B04C9C(); + func_80007778(); +} + +void func_86B04D48(void) { + s32 i; + + func_80006C6C(0x10); + + for (i = 0; i < 16; i++) { + func_86B04914(); + func_86B04CF4(0); + } +} + +void func_86B04D98(void) { + s32 var_s0 = 1; + + while (var_s0 != 0) { + func_86B04914(); + func_8790370C(); + + if (func_86B04944() != 0) { + var_s0 = 0; + } + + func_86B04CF4(1); + } +} + +void func_86B04DF0(void) { + s32 i; + + func_80006CB4(0xA); + for (i = 0; i < 10; i++) { + func_86B04914(); + func_86B048D8(); + func_86B02928(); + func_86B04CF4(2); + } + + if (D_86B0EBDC->unk_2F0 == 1) { + if (D_800AE540.unk_0000 == 0x1A) { + func_8002817C(D_86B0EBDC->unk_2EC, 1); + func_80028128(1); + } else { + func_8002817C(D_86B0EBDC->unk_2EC, D_800AE540.unk_11F2); + } + func_80026684(0x14, 0); + func_800284B4(2); + } +} + +void func_86B04EBC(void) { + MemoryBlock* sp1C; + + sp1C = func_80002D10(main_pool_get_available(), 0); + D_86B0EBC0 = process_geo_layout(sp1C, &D_86B0DC5C); + func_80002D60(sp1C); + func_8001BB20(); + + D_86B0EBE0 = main_pool_alloc(0x20, 0); + bzero(D_86B0EBE0, 0x20); + + D_86B0EBDC = main_pool_alloc(0x30C, 0); + bzero(D_86B0EBDC, 0x30C); + + D_86B0EBD8 = main_pool_alloc(0x4C, 0); + bzero(D_86B0EBD8, 0x4C); + + func_86B025A4(); + func_86B026C0(); + func_86B02A78(); + func_86B028F8(); + func_86B02908(); + func_86B0299C(); +} + +s32 func_86B04FB0(void) { + unk_func_80007444* sp24; + + main_pool_push_state('DEMO'); + + func_80005E40(0x10000, 0); + sp24 = func_80007444(0, 1, 3, 1, 2, 1); + func_8001E94C(2, 0); + + ASSET_LOAD(D_1000000, common_menu1_ui, 0); + ASSET_LOAD(D_2000000, common_menu2_ui, 0); + ASSET_LOAD(D_3000000, cup_clear_ui, 0); + + FRAGMENT_LOAD(fragment31); + func_80004454((((u32)D_8D000000 & 0x0FF00000) >> 0x14) - 0x10, _5C7A70_ROM_START, _5C7A70_ROM_END); + + func_8002D510(); + + D_86B0EBD0 = func_8002D5AC(0x1E); + D_86B0EBD4 = func_8002D5AC(0x24); + + func_86B04EBC(); + func_80007678(sp24); + func_86B04D48(); + func_86B04D98(); + func_86B04DF0(); + func_800076C0(); + func_8001E9CC(); + func_80005EAC(); + main_pool_pop_state('DEMO'); + + return 0; +} diff --git a/src/fragments/17/fragment17_164B00.c b/src/fragments/17/fragment17_164B00.c index e87972ef..87392e9a 100644 --- a/src/fragments/17/fragment17_164B00.c +++ b/src/fragments/17/fragment17_164B00.c @@ -1,5 +1,93 @@ -#include "global.h" +#include "fragment17.h" +#include "src/1CF30.h" +#include "src/6A40.h" +#include "src/6BC0.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_164B00/func_86B05170.s") +void func_86B05170(u8* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, u8 width, u8 height, u8 uls, u8 ult, u8 lrs, + u8 lrt, u8 argB, u8 argC, unk_D_86B0DAE0* argD, s32 argE) { + unk_D_80068BB0* temp_s1 = func_8000648C(); + Vtx* temp_s6 = func_80005F5C(sizeof(Vtx) * 4); + Mtx* spD4 = func_80005F5C(sizeof(Mtx) * 1); + Vp* temp_v0 = func_80005F5C(sizeof(Vp) * 1); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_164B00/func_86B05944.s") + func_8001E6E8(temp_v0, temp_s1->width, temp_s1->height); + + gSPViewport(gDisplayListHead++, (u32)temp_v0 & 0x1FFFFFFF); + + guOrtho(spD4, 0.5f, temp_s1->width - 0.5f, temp_s1->height - 0.5f, 0.5f, -2.0f, 2.0f, 1.0f); + if (argE != 0) { + func_8001E680(&temp_s6[0], arg1, arg2, -1, argC << 5, 0, argD->unk_00.unk_12, argD->unk_00.unk_14, + argD->unk_00.unk_16, 0xFF); + func_8001E680(&temp_s6[1], arg1 + arg3, arg2, -1, argB << 5, 0, argD->unk_00.unk_12, argD->unk_00.unk_14, + argD->unk_00.unk_16, 0xFF); + func_8001E680(&temp_s6[2], arg1, arg2 + arg4, -1, argC << 5, height << 5, argD->unk_00.unk_0C, + argD->unk_00.unk_0E, argD->unk_00.unk_10, 0xFF); + func_8001E680(&temp_s6[3], arg1 + arg3, arg2 + arg4, -1, argB << 5, height << 5, argD->unk_00.unk_0C, + argD->unk_00.unk_0E, argD->unk_00.unk_10, 0xFF); + } else { + func_8001E680(&temp_s6[0], arg1, arg2, -1, argC << 5, 0, argD->unk_00.unk_0C, argD->unk_00.unk_0E, + argD->unk_00.unk_10, 0xFF); + func_8001E680(&temp_s6[1], arg1 + arg3, arg2, -1, argB << 5, 0, argD->unk_00.unk_0C, argD->unk_00.unk_0E, + argD->unk_00.unk_10, 0xFF); + func_8001E680(&temp_s6[2], arg1, arg2 + arg4, -1, argC << 5, height << 5, argD->unk_00.unk_12, + argD->unk_00.unk_14, argD->unk_00.unk_16, 0xFF); + func_8001E680(&temp_s6[3], arg1 + arg3, arg2 + arg4, -1, argB << 5, height << 5, argD->unk_00.unk_12, + argD->unk_00.unk_14, argD->unk_00.unk_16, 0xFF); + } + + gDPPipeSync(gDisplayListHead++); + + gDPSetCycleType(gDisplayListHead++, G_CYC_2CYCLE); + gDPSetTexturePersp(gDisplayListHead++, G_TP_PERSP); + gSPClearGeometryMode(gDisplayListHead++, G_ZBUFFER | G_LIGHTING); + gDPSetCombineLERP(gDisplayListHead++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, TEXEL0, COMBINED, 0, + SHADE, 0, 0, 0, 0, COMBINED); + gDPSetRenderMode(gDisplayListHead++, G_RM_PASS, G_RM_XLU_SURF2); + gDPSetEnvColor(gDisplayListHead++, argD->unk_00.unk_06, argD->unk_00.unk_08, argD->unk_00.unk_0A, 255); + gDPSetPrimColor(gDisplayListHead++, 0, 0, argD->unk_00.unk_00, argD->unk_00.unk_02, argD->unk_00.unk_04, 255); + gDPSetTextureFilter(gDisplayListHead++, G_TF_BILERP); + gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); + + gDPLoadTextureTile(gDisplayListHead++, arg0, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, uls, ult, lrs - 1, lrt - 1, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); + + gSPPerspNormalize(gDisplayListHead++, 0xFFFF); + gSPMatrix(gDisplayListHead++, (u32)spD4 & 0x1FFFFFFF, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gDisplayListHead++, (u32)&D_8006F010 & 0x1FFFFFFF, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPVertex(gDisplayListHead++, (u32)temp_s6 & 0x1FFFFFFF, 4, 0); + gSP2Triangles(gDisplayListHead++, 0, 2, 3, 0, 0, 3, 1, 0); + gSPDisplayList(gDisplayListHead++, D_8006F630); + gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF); +} + +void func_86B05944(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + unk_D_80068BB0* temp_s1 = func_8000648C(); + Vtx* temp_s2 = func_80005F5C(sizeof(Vtx) * 4); + Mtx* sp84 = func_80005F5C(sizeof(Mtx) * 1); + Vp* sp80 = func_80005F5C(sizeof(Vp) * 1); + + func_8001E6E8(sp80, temp_s1->width, temp_s1->height); + + gSPViewport(gDisplayListHead++, (u32)sp80 & 0x1FFFFFFF); + + guOrtho(sp84, 0.5f, temp_s1->width - 0.5f, temp_s1->height - 0.5f, 0.5f, -2.0f, 2.0f, 1.0f); + + func_8001E680(&temp_s2[0], arg0, arg1, -1, 0, 0, 0, 0, 0, arg4); + func_8001E680(&temp_s2[1], arg0 + arg2, arg1, -1, 0, 0, 0, 0, 0, arg4); + func_8001E680(&temp_s2[2], arg0, arg1 + arg3, -1, 0, 0, 0, 0, 0, arg4); + func_8001E680(&temp_s2[3], arg0 + arg2, arg1 + arg3, -1, 0, 0, 0, 0, 0, arg4); + + gDPPipeSync(gDisplayListHead++); + + gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE); + gSPClearGeometryMode(gDisplayListHead++, G_ZBUFFER | G_LIGHTING); + gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE); + gDPSetRenderMode(gDisplayListHead++, G_RM_XLU_SURF, G_RM_XLU_SURF2); + gSPPerspNormalize(gDisplayListHead++, 0xFFFF); + + gSPMatrix(gDisplayListHead++, (u32)sp84 & 0x1FFFFFFF, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gDisplayListHead++, (u32)&D_8006F010 & 0x1FFFFFFF, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gSPVertex(gDisplayListHead++, (u32)temp_s2 & 0x1FFFFFFF, 4, 0); + gSP2Triangles(gDisplayListHead++, 0, 2, 3, 0, 0, 3, 1, 0); +} diff --git a/src/fragments/17/fragment17_165640.c b/src/fragments/17/fragment17_165640.c index 2afe8669..4f503df6 100644 --- a/src/fragments/17/fragment17_165640.c +++ b/src/fragments/17/fragment17_165640.c @@ -1,71 +1,1098 @@ -#include "global.h" +#include "fragment17.h" +#include "src/11BA0.h" +#include "src/12D80.h" +#include "src/18140.h" +#include "src/geo_layout.h" +#include "src/19840.h" +#include "src/1C720.h" +#include "src/1CF30.h" +#include "src/20330.h" +#include "src/29BA0.h" +#include "src/3FB0.h" +#include "src/4BDC0.h" +#include "src/4CBC0.h" +#include "src/6A40.h" +#include "src/6BC0.h" +#include "src/F420.h" +#include "src/controller.h" +#include "src/fragments/3/fragment3.h" +#include "src/fragments/34/fragment34.h" +#include "src/memory.h" +#include "src/stage_loader.h" +#include "src/util.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B05CB0.s") +extern u8 D_3000180[]; +extern u8 D_3000780[]; +extern u8 D_3001220[]; +extern u8 D_3001B80[]; +extern u8 D_30024E0[]; +extern u8 D_30032A0[]; +extern u8 D_3004060[]; +extern u8 D_3004E20[]; +extern u8 D_3005780[]; +extern u8 D_30060E0[]; +extern u8 D_3006B80[]; +extern u8 D_300C6D0[]; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B05D18.s") +s32 func_86B05CB0(s32, GraphNode*); +s32 func_86B05D18(s32, GraphNode*); +s32 func_86B05D84(s32, GraphNode*); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B05D84.s") +typedef struct unk_D_86B0DD58 { + /* 0x00 */ u8 unk_00; + /* 0x04 */ f32 unk_04; + /* 0x08 */ f32 unk_08; +} unk_D_86B0DD58; // size = 0xC -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B05DA0.s") +static unk_D_86B0DAE0_000 D_86B0DCE0[4] = { + { + 0x00FF, + 0x00E1, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + 0x0000, + }, + { + 0x00FF, + 0x00FF, + 0x00FF, + 0x00FF, + 0x00FF, + 0x0064, + 0x00FF, + 0x0007, + 0x0040, + 0x0040, + 0x0040, + 0x0019, + }, + { + 0x00FF, + 0x00FF, + 0x009B, + 0x009B, + 0x009B, + 0x0000, + 0x00FF, + 0x00FF, + 0x0032, + 0x0032, + 0x0032, + 0x0032, + }, + { + 0x00FF, + 0x00FF, + 0x00FF, + 0x00FF, + 0x00FF, + 0x0064, + 0x00FF, + 0x00FF, + 0x0080, + 0x0080, + 0x0080, + 0x0032, + }, +}; +static u8 D_86B0DD40[] = { + 0, 0xFF, 0, 0xE1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0, 3, 0, 0x11, 0, 0x11, 0, 0x11, 0, 7, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B05E18.s") +static unk_D_86B0DD58 D_86B0DD58[20] = { + { 0xA7, 47.5f, 30.0f }, { 0xA8, 47.5f, 30.0f }, { 0xA9, 47.5f, 30.0f }, { 0xAA, 47.5f, 30.0f }, + { 0xA5, 66.5f, 85.0f }, { 0xA5, 66.5f, 85.0f }, { 0xA7, 0.0f, 0.0f }, { 0xA7, 0.0f, 0.0f }, + { 0xA7, 0.0f, 0.0f }, { 0xA7, 0.0f, 0.0f }, { 0xA7, 0.0f, 0.0f }, { 0xA7, 0.0f, 0.0f }, + { 0xA7, 0.0f, 0.0f }, { 0xA7, 0.0f, 0.0f }, { 0xA7, 0.0f, 0.0f }, { 0xA7, 0.0f, 0.0f }, + { 0xA7, 0.0f, 0.0f }, { 0xA7, 0.0f, 0.0f }, { 0xA7, 0.0f, 0.0f }, { 0xA7, 0.0f, 0.0f }, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B05EE8.s") +static u8 D_86B0DE48[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x11, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06008.s") +static unk_D_8690A610 D_86B0F9D0; +static unk_D_86002F58_004_000_000 D_86B0F9F0; +static unk_D_86002F58_004_000_000 D_86B0FA08; +static unk_D_86002F58_004_000_000 D_86B0FA20; +static u32 D_86B0FA38; +static Color_RGBA8_u32 D_86B0FA3C; +static u8 D_86B0FA40; +static s16 D_86B0FA42; +static s16 D_86B0FA44; +static s16 D_86B0FA46; +static f32 D_86B0FA48; +static void* D_86B0FA4C; +static unk_D_86B0FA50* D_86B0FA50; +static unk_D_86B0FA50* D_86B0FA54; +static unk_D_86B0FA50* D_86B0FA58; +static unk_D_86B0FA50* D_86B0FA5C; +static unk_D_86B0FA50* D_86B0FA60; +static s16 D_86B0FA64; +static s16 D_86B0FA66; +static s16 D_86B0FA68; +static f32 D_86B0FA6C; +static s32 D_86B0FA70; +static s32 D_86B0FA74; +unk_D_86B0FA78* D_86B0FA78; +unk_D_86B0FA7C* D_86B0FA7C; +static u8 D_86B0FA80[0xBE0]; +unk_70D3A0 D_86B10660; +static unk_D_70B10 D_86B10670; +static unk_D_800AE540_0004* D_86B10690; +static unk_D_800AE540_1194* D_86B10694; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06050.s") +static u32 D_86B0DE5C[] = { + 0x0C00FFFF, 0x05000000, 0x0B00001E, 0x00000000, 0x014000F0, 0x0000000F, 0x00000000, 0x00000000, + 0x05000000, 0x0D000000, 0x05000000, 0x07000000, &D_86B0F9D0, 0x14000000, 0x002D0019, 0xFFFFFF28, + 0x08000000, func_86B05CB0, 0x00000000, 0x14000000, 0x002D0019, 0x80808028, 0x08000000, func_86B05D18, + 0x00000000, 0x16646464, 0x0F000002, 0x05000000, 0x1F00FFFF, 0x00000000, 0x00000000, 0x00000000, + 0x00640064, 0x00640000, 0x08000000, func_86B05D84, 0x00000000, 0x05000000, 0x07000000, &D_86B0F9F0, + 0x06000000, 0x06000000, 0x0F000003, 0x05000000, 0x1F00FFFF, 0x00000000, 0x00000000, 0x00000000, + 0x00640064, 0x00640000, 0x08000000, func_86B05D84, 0x00000000, 0x05000000, 0x07000000, &D_86B0FA08, + 0x06000000, 0x06000000, 0x0F000002, 0x05000000, 0x1F00FFFF, 0x00000000, 0x00000000, 0x00000000, + 0x00640064, 0x00640000, 0x08000000, func_86B05D84, 0x00000000, 0x05000000, 0x07000000, &D_86B0FA20, + 0x06000000, 0x06000000, 0x0F000003, 0x05000000, 0x0A000000, &D_800AC840, 0x06000000, 0x0F000002, + 0x05000000, 0x0A000000, &D_800AC858, 0x06000000, 0x09000000, 0x06000000, 0x06000000, 0x06000000, + 0x01000000, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06100.s") +s32 func_86B05CB0(s32 arg0, GraphNode* arg1) { + unk_D_86002F34_alt18* ptr = (unk_D_86002F34_alt18*)arg1; + f32 sp28; + s16 sp26; + s16 sp24; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B061E8.s") + if (arg0 == 2) { + func_800102A4(&D_8006F088->unk_60.at, &D_8006F088->unk_60.eye, &sp28, &sp26, &sp24); + ptr->unk_1C = sp26 + 0x2000; + ptr->unk_1E = sp24 - 0x2000; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B0630C.s") + return 0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06394.s") +s32 func_86B05D18(s32 arg0, GraphNode* arg1) { + unk_D_86002F34_alt18* ptr = (unk_D_86002F34_alt18*)arg1; + f32 sp28; + s16 sp26; + s16 sp24; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06440.s") + if (arg0 == 2) { + func_800102A4(&D_8006F088->unk_60.at, &D_8006F088->unk_60.eye, &sp28, &sp26, &sp24); + ptr->unk_1C = -0x2000 - sp26; + ptr->unk_1E = sp24 + 0x6000; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B065C4.s") + return 0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06960.s") +s32 func_86B05D84(s32 arg0, GraphNode* arg1) { + unk_D_86002F58_004_000* ptr = (unk_D_86002F58_004_000*)arg1; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B069D8.s") + if (arg0 == 2) { + ptr->unk_03C.rgba = D_86B0FA3C.rgba; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06AB4.s") + return 0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06B38.s") +void func_86B05DA0(u8 arg0, u8 arg1, u8 arg2) { + u8 v = arg0 & arg1 & arg2; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06E34.s") + D_86B0FA3C.r = arg0; + D_86B0FA3C.g = arg1; + D_86B0FA3C.b = arg2; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06E80.s") + if (v == 0xFF) { + if (D_86B0F9D0.unk_00.unk_14 == 1) { + D_86B0F9D0.unk_00.unk_01 |= 1; + } + } else { + D_86B0F9D0.unk_00.unk_01 &= ~1; + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06EC8.s") +void func_86B05E18(void) { + UNUSED s32 pad[2]; + u8* sp24; + u8* temp_a1; + u8* sp1C; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06F18.s") + temp_a1 = (u32)_70D3A0_ROM_START + (D_80075BCC[D_86B0FA78->unk_174] & 0xFFFFFF); + sp24 = (u32)_70D3A0_ROM_START + + ((((D_86B0FA78->unk_174 ^ 0) * sizeof(unk_D_70B10)) - sizeof(unk_D_70B10) + (u32)D_70B10) & 0xFFFFFF); + sp1C = (u32)_70D3A0_ROM_START + + (((D_86B0FA78->unk_174 * sizeof(unk_70D3A0)) - sizeof(unk_70D3A0) + (u32)D_70110) & 0xFFFFFF); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06F60.s") + func_80003B30(D_86B0FA80, temp_a1, temp_a1 + 0xBC0, 0); + func_80003B30(&D_86B10660, sp1C, sp1C + sizeof(unk_70D3A0), 0); + func_80003B30(&D_86B10670, sp24, sp24 + sizeof(unk_D_70B10), 0); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06F74.s") +void func_86B05EE8(void) { + D_86B0FA78->unk_174 = D_86B10690->unk_01C[D_86B0FA78->unk_17C].unk_00; + func_8001BB58(&D_86B0FA78->unk_004); + func_8001987C(); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06FCC.s") + D_86B0FA78->unk_000 = func_80019D90(&D_86B10690->unk_01C[D_86B0FA78->unk_17C]); + func_8001BC34(&D_86B0FA78->unk_004, 0, D_86B0FA78->unk_174, D_86B0FA78->unk_000->unk_08->unk_00[0]); + func_8001BD04(&D_86B0FA78->unk_004, 0); + D_86B0FA78->unk_004.unk_0A6 = 0; + func_86B05E18(); + D_86B0FA78->unk_004.unk_024.y += D_86B10660.unk_08; + D_86B0FA78->unk_170 = 0; + func_80017804(&D_86B0FA78->unk_004, 0); + func_8001BD9C(&D_86B0FA78->unk_004, -1); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B06FFC.s") +void func_86B06008(void) { + func_8001BCF0(&D_86B0FA78->unk_004); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B07450.s") + main_pool_pop_state('MONS'); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B075EC.s") + main_pool_push_state('MONS'); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B07DF4.s") + func_86B05EE8(); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B07EA0.s") +void func_86B06050(void) { + D_86B0FA7C->unk_00->unk_24.fovy = 30.0f; + D_86B0FA7C->unk_00->unk_24.near = 30.0f; + D_86B0FA7C->unk_00->unk_24.far = 6400.0f; + func_86B087E8(D_86B0FA78, &D_86B0FA7C->unk_04); + func_86B08AEC(&D_86B0E040[D_86B0FA78->unk_17C], D_86B0FA7C->unk_00); + func_86B088E4(); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B07F14.s") +void func_86B06100(void) { + func_8001BCF0(&D_86B0FA78->unk_004); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B07FA4.s") + main_pool_pop_state('MONS'); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B08034.s") + main_pool_push_state('MONS'); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B0819C.s") + D_86B0FA78->unk_174 = D_86B0DD58[D_86B0FA44].unk_00; + func_8001BB58(&D_86B0FA78->unk_004); + func_8001987C(); + D_86B0FA78->unk_000 = func_80019D18(D_86B0FA78->unk_174); + func_8001BC34(&D_86B0FA78->unk_004, 0, D_86B0FA78->unk_174, D_86B0FA78->unk_000->unk_08->unk_00[0]); + func_8001BD04(&D_86B0FA78->unk_004, 0); + func_8000E88C(&D_86B0FA78->unk_004.unk_024, 0.0f, 300.0f, 0.0f); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_165640/func_86B08644.s") +void func_86B061E8(void) { + D_86B0FA46 = 0; + D_86B0FA48 = 0.0f; + D_86B0FA7C->unk_00->unk_24.fovy = 40.0f; + D_86B0FA7C->unk_00->unk_24.near = 30.0f; + D_86B0FA7C->unk_00->unk_24.far = 6400.0f; + + func_8000E88C(&D_86B0FA7C->unk_00->unk_60.at, D_86B0FA78->unk_004.unk_024.x, + D_86B0DD58[D_86B0FA44].unk_04 + D_86B0FA78->unk_004.unk_024.y, D_86B0FA78->unk_004.unk_024.z); + + if ((D_86B0FA44 == 4) || (D_86B0FA44 == 5)) { + func_8000E88C(&D_86B0FA7C->unk_00->unk_60.eye, 0, 100.0f, 328.0f); + } else { + func_8000E88C(&D_86B0FA7C->unk_00->unk_60.eye, 0, 100.0f, 250.0f); + } +} + +s32 func_86B0630C(unk_D_86002F58_004_000* arg0, s16 arg1, s16 arg2) { + if (arg1 > 0) { + arg0->unk_01E.y -= arg1; + if ((arg0->unk_01E.y < arg2) && ((arg2 - arg1) < arg0->unk_01E.y)) { + return 1; + } + } else { + arg0->unk_01E.y -= arg1; + if ((arg2 < arg0->unk_01E.y) && (arg0->unk_01E.y < (arg2 - arg1))) { + return 1; + } + } + return 0; +} + +s32 func_86B06394(unk_D_86002F58_004_000* arg0, s16 arg1, s16 arg2) { + if ((((arg0->unk_01E.y - arg2) / 182) < 0x3D) && (((arg0->unk_01E.y - arg2) / 182) >= 0)) { + arg1 = (arg0->unk_01E.y - arg2) / 9; + } + arg0->unk_01E.y -= arg1; + + if (arg1 > 0) { + if ((arg2 >= arg0->unk_01E.y) && (arg0->unk_01E.y >= (arg2 - arg1))) { + arg0->unk_01E.y = arg2; + return 1; + } + } else if ((arg0->unk_01E.y >= arg2) && ((arg2 - arg1) >= arg0->unk_01E.y)) { + arg0->unk_01E.y = arg2; + return 1; + } + return 0; +} + +s32 func_86B06440(void) { + if (D_86B0FA46 < 3) { + if ((D_86B0FA46 <= 0) && (func_86B0630C(&D_86B0FA78->unk_004, 0x71C, 0) != 0)) { + D_86B0FA46++; + } + + if ((D_86B0FA46 > 0) && (func_86B06394(&D_86B0FA78->unk_004, 0x71C, 0) != 0)) { + D_86B0FA46++; + } + } + + func_86B0145C(&D_86B0FA48, 0.1f, 0.02f); + func_86B0145C(&D_86B0FA78->unk_004.unk_024.y, 0.0f, D_86B0FA48); + + if (D_86B0FA78->unk_004.unk_024.y <= 0.25f) { + D_86B0FA78->unk_004.unk_024.y = 0.0f; + } + + func_8000E88C(&D_86B0FA7C->unk_00->unk_60.at, D_86B0FA78->unk_004.unk_024.x, + D_86B0DD58[D_86B0FA44].unk_04 + D_86B0FA78->unk_004.unk_024.y, D_86B0FA78->unk_004.unk_024.z); + + if (D_86B0FA78->unk_004.unk_024.y <= 0.5f) { + return 1; + } + return 0; +} + +void func_86B065C4(void) { + Vec3f sp44; + + if (D_86B0FA40 == 0) { + D_86B0FA40 = 1; + func_8004DF94(0x0110000F, 0, 0); + } + + if (D_86B0FA78->unk_178 & 1) { + func_8000E88C(&sp44, D_86B0FA78->unk_004.unk_024.x, + D_86B0DD58[D_86B0FA44].unk_08 + (func_86B01320(0x28) - 0x14), D_86B0FA78->unk_004.unk_024.z); + func_81407D48(1.0f, sp44, D_86B0FA78->unk_004.unk_01E, func_879027F0, &D_87903E40, 1); + + if ((D_86B0FA78->unk_178 >= 0xA) && (D_86B0FA78->unk_178 & 1)) { + func_8000E88C(&sp44, D_86B0FA78->unk_004.unk_024.x, + D_86B0DD58[D_86B0FA44].unk_08 + (func_86B01320(0x28) - 0x14), D_86B0FA78->unk_004.unk_024.z); + func_81407D48(1.0f, sp44, D_86B0FA78->unk_004.unk_01E, func_879027F0, &D_87903E40, 1); + } + + if ((D_86B0FA78->unk_178 >= 0x14) && (D_86B0FA78->unk_178 & 1)) { + func_8000E88C(&sp44, D_86B0FA78->unk_004.unk_024.x, + D_86B0DD58[D_86B0FA44].unk_08 + (func_86B01320(0x28) - 0x14), D_86B0FA78->unk_004.unk_024.z); + func_81407D48(1.0f, sp44, D_86B0FA78->unk_004.unk_01E, func_879027F0, &D_87903E40, 1); + } + + if ((D_86B0FA78->unk_178 >= 0x1E) && (D_86B0FA78->unk_178 & 1)) { + func_8000E88C(&sp44, D_86B0FA78->unk_004.unk_024.x, + D_86B0DD58[D_86B0FA44].unk_08 + (func_86B01320(0x28) - 0x14), D_86B0FA78->unk_004.unk_024.z); + func_81407D48(1.0f, sp44, D_86B0FA78->unk_004.unk_01E, func_879027F0, &D_87903E40, 1); + } + } +} + +void func_86B06960(void) { + D_86B0FA78->unk_180 = func_800104AC(D_86B0FA78->unk_180, 100.0f, 2.0f, 2.0f); + func_86B05DA0(D_86B0FA78->unk_180, D_86B0FA78->unk_180, D_86B0FA78->unk_180); +} + +void func_86B069D8(void) { + if (((D_86B0FA78->unk_178 % 50) == 0) && (D_86B0FA78->unk_170 == 0) && (D_86B0FA80[0xA51] != 0xFF)) { + func_80017788(&D_86B0FA78->unk_004); + func_8001BD9C(&D_86B0FA78->unk_004, D_86B0FA80[0xA51]); + D_86B0FA78->unk_170 = 1; + } else if ((D_86B0FA78->unk_170 == 1) && (func_8001783C(&D_86B0FA78->unk_004) == 1)) { + D_86B0FA78->unk_170 = 0; + func_80017804(&D_86B0FA78->unk_004, 0); + func_8001BD9C(&D_86B0FA78->unk_004, -1); + } +} + +void func_86B06AB4(unk_D_86B0FA50* arg0, u8* arg1, f32 arg2, s16 arg3, s16 arg4, s16 arg5) { + arg0->unk_80 = arg1; + arg0->unk_98 = arg2; + arg0->unk_9C = arg3; + arg0->unk_9E = arg4; + arg0->unk_A0 = arg5; + + arg0->unk_88 = 0; + arg0->unk_8C = 0; + arg0->unk_84 = 0; + arg0->unk_A4 = 0; + arg0->unk_AC = 0.0f; + + arg0->unk_B0.unk_00 = D_86B0DCE0->unk_00; + arg0->unk_B0.unk_02 = D_86B0DCE0->unk_02; + arg0->unk_B0.unk_04 = D_86B0DCE0->unk_04; + arg0->unk_B0.unk_06 = D_86B0DCE0->unk_06; + arg0->unk_B0.unk_08 = D_86B0DCE0->unk_08; + arg0->unk_B0.unk_0A = D_86B0DCE0->unk_0A; +} + +void func_86B06B38(void) { + if (D_800AE540.unk_11F2 == 1) { + func_86B06AB4(D_86B0FA60, &D_300C6D0, -250.0f, 0xC8, 0x18, 0x18); + } + + func_86B06AB4(D_86B0FA54, &D_3000180, -250.0f, 0xC8, 0x40, 0x18); + + if (D_800AE540.unk_0002 == 0) { + func_86B06AB4(D_86B0FA5C, &D_30060E0, -170.0f, 0x3C, 0x88, 0x14); + } else if (D_800AE540.unk_0002 == 1) { + func_86B06AB4(D_86B0FA5C, &D_3006B80, -170.0f, 0x3C, 0x78, 0x14); + } else if (D_800AE540.unk_0002 == 2) { + func_86B06AB4(D_86B0FA5C, &D_3004E20, -170.0f, 0x3C, 0x78, 0x14); + } else if (D_800AE540.unk_0002 == 3) { + func_86B06AB4(D_86B0FA5C, &D_3005780, -170.0f, 0x3C, 0x78, 0x14); + } + + switch (D_800AE540.unk_0001) { + case 1: + func_86B06AB4(D_86B0FA58, &D_30024E0, -100.0f, 0x1E, 0xB0, 0x14); + break; + + case 2: + func_86B06AB4(D_86B0FA58, &D_30032A0, -100.0f, 0x1E, 0xB0, 0x14); + break; + + case 3: + func_86B06AB4(D_86B0FA58, &D_3004060, -100.0f, 0x1E, 0xB0, 0x14); + break; + + case 4: + func_86B06AB4(D_86B0FA58, &D_3000780, -100.0f, 0x1E, 0x88, 0x14); + break; + + case 5: + func_86B06AB4(D_86B0FA58, &D_3001220, -100.0f, 0x1E, 0x78, 0x14); + break; + + case 6: + func_86B06AB4(D_86B0FA58, &D_3001B80, -100.0f, 0x1E, 0x78, 0x14); + break; + + default: + func_86B06AB4(D_86B0FA58, &D_30024E0, -100.0f, 0x1E, 0xB0, 0x14); + break; + } +} + +void func_86B06E34(void) { + D_86B0FA78->unk_16C = 0; + D_86B0FA78->unk_17C = 0; + D_86B0FA78->unk_174 = 0; + + main_pool_push_state('MONS'); + + func_86B05EE8(); +} + +void func_86B06E80(void) { + D_86B0FA7C->unk_00 = D_87906050->unk_00.unk_0C; + D_87906054 = D_86B0FA7C->unk_00; + func_86B06050(); +} + +void func_86B06EC8(void) { + D_86B0FA78->unk_16C = 6; + D_86B0FA78->unk_17C = 6; + D_86B0FA78->unk_174 = 0; + + main_pool_push_state('MONS'); + + func_86B06100(); +} + +void func_86B06F18(void) { + D_86B0FA7C->unk_00 = D_87906050->unk_00.unk_0C; + D_87906054 = D_86B0FA7C->unk_00; + func_86B061E8(); +} + +void func_86B06F60(void) { + D_86B0FA50->unk_90 = 3; +} + +void func_86B06F74(void) { + if (D_800AE540.unk_1194[0].unk_1C == 1) { + D_86B10690 = D_800AE540.unk_1194[0].unk_08[0]; + D_86B10694 = &D_800AE540.unk_1194[0]; + } else { + D_86B10690 = D_800AE540.unk_1194[1].unk_08[0]; + D_86B10694 = &D_800AE540.unk_1194[1]; + } +} + +void func_86B06FCC(void) { + Cont_StartReadInputs(); + Cont_ReadInputs(); + func_8001F730(); +} + +s32 func_86B06FFC(void) { + switch (D_86B0FA78->unk_16C) { + case 0: + func_86B06050(); + func_86B08C44(D_86B0FA7C->unk_00); + D_86B0FA78->unk_170 = 0; + D_86B0FA78->unk_16C += 1; + break; + + case 1: + func_86B069D8(); + if (D_86B0FA78->unk_178++ == 0x19) { + D_86B0FA50->unk_90 = 0; + } + + if (func_86B08C44(D_86B0FA7C->unk_00) != 0) { + if ((D_800AE540.unk_0001 == 7) && (D_86B0FA78->unk_17C == 5)) { + return 1; + } + func_86B08E50(3, 0x1E); + D_86B0FA78->unk_16C += 1; + } + break; + + case 2: + func_86B08EB4(); + if (func_86B08EA8() == 1) { + D_86B0FA78->unk_17C++; + if (D_86B0FA78->unk_17C == 6) { + D_86B0FA78->unk_170 = 0; + func_86B06100(); + func_86B061E8(); + D_86B0FA50->unk_90 = 3; + D_86B0FA78->unk_178 = 0; + func_86B08E50(2, 0x1E); + D_86B0FA78->unk_16C = 6; + } else { + D_86B0FA78->unk_170 = 0; + func_86B06008(); + func_86B06050(); + D_86B0FA50->unk_90 = 3; + D_86B0FA78->unk_178 = 0; + func_86B08E50(2, 0x1E); + D_86B0FA78->unk_16C++; + } + } + break; + + case 3: + func_86B08EB4(); + if (D_86B0FA78->unk_178++ > 0) { + func_86B08C44(D_86B0FA7C->unk_00); + } + + if (func_86B08EA8() == 0) { + D_86B0FA78->unk_178 = 0; + D_86B0FA78->unk_16C = 1; + } + break; + + case 6: + D_86B0FA78->unk_180 = 0xFF; + func_86B08EB4(); + func_86B06440(); + if (func_86B08EA8() == 0) { + D_86B0FA78->unk_16C++; + } + break; + + case 7: + if (func_86B06440() != 0) { + D_86B0FA78->unk_178 = 0; + D_86B0FA50->unk_90 = 0; + func_8004DF94(0x01100002, 0, 0); + D_86B0FA40 = 0; + D_86B0FA78->unk_16C++; + } + break; + + case 8: + if (D_86B0FA58->unk_84 != 0) { + func_86B065C4(); + } + if (D_86B0FA78->unk_178++ >= 0x41) { + D_86B0FA64 = 0; + func_800102A4(&D_87906054->unk_60.at, &D_87906054->unk_60.eye, &D_86B0FA6C, &D_86B0FA66, &D_86B0FA68); + D_86B0FA78->unk_16C++; + } + break; + + case 9: + func_86B06960(); + + if (D_86B0FA58->unk_84 != 0) { + func_86B065C4(); + } + + if (gPlayer1Controller->buttonDown & 0xC000) { + return 1; + } + + if (D_86B0FA78->unk_178++ >= 0x3E9) { + D_86B0FA78->unk_178 = 0x64; + } + + D_86B0FA64 = func_8001046C(D_86B0FA64, 0x3C, 1, 1); + D_86B0FA68 += D_86B0FA64; + func_80010354(&D_87906054->unk_60.at, &D_87906054->unk_60.eye, D_86B0FA6C, D_86B0FA66, D_86B0FA68); + break; + } + + if ((D_86B0FA74 == 2) && (D_86B0FA70 == 0x12C)) { + func_8004B1CC(0x5B); + } + return 0; +} + +s32 func_86B07450(unk_D_86B0FA50* arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) { + f32 temp_fa1; + f32 sp20; + f32 temp_fv0; + f32 temp_fv0_2; + f32 temp_fv0_4; + f32* new_var; + + sp20 = arg0->unk_A4; + + temp_fv0 = func_800104AC(sp20, 0.0f, 0.0f, 0.0f); + arg0->unk_A4 = temp_fv0; + if (temp_fv0 >= 0.0f) { + temp_fv0 = 0; + if ((arg0 && arg0) && arg0) {} + } + temp_fv0_2 = COSS(0) * temp_fv0; + temp_fa1 = -arg3; + + new_var = &arg0->unk_AC; + + temp_fv0_4 = (-temp_fa1) - (arg2 * ((sp20 * arg0->unk_AC) + temp_fv0_2)); + arg0->unk_AC = (temp_fv0_4 * arg5) + ((*new_var) + temp_fv0_2); + + if (arg0->unk_AC >= 28.0) { + arg0->unk_AC = 28.0f; + } + + arg0->unk_98 += arg0->unk_AC; + if (temp_fa1 >= 0) { + if ((arg0->unk_98 < arg4) && (arg0->unk_98 >= 0.0f)) { + arg0->unk_98 = arg4; + arg0->unk_AC *= -arg1; + } + } else if ((arg4 < arg0->unk_98) && (arg0->unk_98 >= 0.0f)) { + arg0->unk_98 = arg4; + arg0->unk_AC *= -arg1; + if (arg0->unk_A8 == arg0->unk_AC) { + return 1; + } + arg0->unk_A8 = arg0->unk_AC; + } + + return 0; +} + +void func_86B075EC(void) { + if (D_86B0FA78->unk_17C == 6) { + switch (D_86B0FA50->unk_90) { + case 3: + break; + + case 0: + func_86B06B38(); + D_86B0FA50->unk_90++; + break; + + case 1: + func_86B07450(D_86B0FA54, 0.25f, 0.0f, 3.0f, 0xA3 - (D_86B0FA54->unk_9E / 2), 1.7f); + func_86B09928(D_86B0FA54->unk_80, D_86B0FA54->unk_98, D_86B0FA54->unk_9C, D_86B0FA54->unk_9E, + D_86B0FA54->unk_A0, &D_86B0FA54->unk_B0); + D_86B0FA58->unk_84 = + func_86B07450(D_86B0FA58, 0.25f, 0.0f, 3.0f, 0xA3 - (D_86B0FA58->unk_9E / 2), 1.7f); + func_86B09928(D_86B0FA58->unk_80, D_86B0FA58->unk_98, D_86B0FA58->unk_9C, D_86B0FA58->unk_9E, + D_86B0FA58->unk_A0, &D_86B0FA54->unk_B0); + + if (D_800AE540.unk_11F2 == 1) { + func_86B09AD8(D_86B0FA60->unk_80, (s16)D_86B0FA58->unk_98 + D_86B0FA58->unk_9E, + D_86B0FA58->unk_9C - 2, D_86B0FA60->unk_9E, D_86B0FA60->unk_A0); + } + + if ((D_86B0FA44 != 4) && (D_86B0FA44 != 5)) { + func_86B07450(D_86B0FA5C, 0.25f, 0.0f, 3.0f, 0xA3 - (D_86B0FA5C->unk_9E / 2), 1.7f); + func_86B09928(D_86B0FA5C->unk_80, D_86B0FA5C->unk_98, D_86B0FA5C->unk_9C, D_86B0FA5C->unk_9E, + D_86B0FA5C->unk_A0, &D_86B0FA54->unk_B0); + } + + if (D_86B0FA58->unk_84 != 0) { + D_86B0FA54->unk_B0.unk_00 = func_8001046C( + D_86B0FA54->unk_B0.unk_00, D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_00, + D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_0C, D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_0C); + D_86B0FA54->unk_B0.unk_02 = func_8001046C( + D_86B0FA54->unk_B0.unk_02, D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_02, + D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_0E, D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_0E); + D_86B0FA54->unk_B0.unk_04 = func_8001046C( + D_86B0FA54->unk_B0.unk_04, D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_04, + D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_10, D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_10); + D_86B0FA54->unk_B0.unk_06 = func_8001046C( + D_86B0FA54->unk_B0.unk_06, D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_06, + D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_12, D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_12); + D_86B0FA54->unk_B0.unk_08 = func_8001046C( + D_86B0FA54->unk_B0.unk_08, D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_08, + D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_14, D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_14); + D_86B0FA54->unk_B0.unk_0A = func_8001046C( + D_86B0FA54->unk_B0.unk_0A, D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_0A, + D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_16, D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_16); + if ((D_86B0FA54->unk_B0.unk_00 == D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_00) && + (D_86B0FA54->unk_B0.unk_02 == D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_02) && + (D_86B0FA54->unk_B0.unk_04 == D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_04) && + (D_86B0FA54->unk_B0.unk_06 == D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_06) && + (D_86B0FA54->unk_B0.unk_08 == D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_08) && + (D_86B0FA54->unk_B0.unk_0A == D_86B0DCE0[D_86B0FA54->unk_88 + 1].unk_0A)) { + + D_86B0FA54->unk_88++; + if (D_86B0FA54->unk_88 == 4) { + D_86B0FA50->unk_90++; + } + } + } + break; + + case 2: + func_86B09928(D_86B0FA54->unk_80, D_86B0FA54->unk_98, D_86B0FA54->unk_9C, D_86B0FA54->unk_9E, + D_86B0FA54->unk_A0, D_86B0DD40); + func_86B09928(D_86B0FA58->unk_80, D_86B0FA58->unk_98, D_86B0FA58->unk_9C, D_86B0FA58->unk_9E, + D_86B0FA58->unk_A0, D_86B0DD40); + + if (D_800AE540.unk_11F2 == 1) { + func_86B09AD8(D_86B0FA60->unk_80, (s16)D_86B0FA58->unk_98 + D_86B0FA58->unk_9E, + D_86B0FA58->unk_9C - 2, D_86B0FA60->unk_9E, D_86B0FA60->unk_A0); + } + + if ((D_86B0FA44 != 4) && (D_86B0FA44 != 5)) { + func_86B09928(D_86B0FA5C->unk_80, D_86B0FA5C->unk_98, D_86B0FA5C->unk_9C, D_86B0FA5C->unk_9E, + D_86B0FA5C->unk_A0, D_86B0DD40); + } + break; + } + } else { + switch (D_86B0FA50->unk_90) { + case 3: + break; + + case 0: + D_86B0FA50->unk_98 = -80.0f; + D_86B0FA50->unk_9C = 0xB4; + D_86B0FA50->unk_A4 = 0.0f; + D_86B0FA50->unk_AC = 0.0f; + sprintf(D_86B0FA50->unk00, "%s", D_86B10690->unk_01C[D_86B0FA78->unk_17C].unk_30); + D_86B0FA50->unk_90++; + break; + + case 1: + func_8001F3F4(); + func_8001F470(); + func_8001EBE0(0x10, 0); + func_8001F36C(0, 0x82, 0xFF, 0xFF); + func_8001F324(0xC8, 0xFF, 0xFF, 0xFF); + func_86B07450(D_86B0FA50, 0.35f, 0.0f, 4.0f, 160.0f, 1.4f); + func_8001F1E8((s32)D_86B0FA50->unk_98 - (func_8001F5B0(0x10, 0, D_86B0FA50->unk00) / 2), + D_86B0FA50->unk_9C, D_86B0FA50->unk00); + func_8001F4C4(); + func_8001F444(); + break; + } + } + + func_86B095C4(); +} + +void func_86B07DF4(void) { + func_800079C4(); + + if ((D_86B0FA38 == -1) || (D_86B0FA38 == 0)) { + func_8000699C(&gDisplayListHead, 1); + } else if (D_86B0FA38 < 0x10000) { + func_8000699C(&gDisplayListHead, D_86B0FA38); + } else { + func_8000699C(&gDisplayListHead, 0xA6BF); + } + + func_80015348(); + func_80015094(&D_87906050->unk_00); + func_86B075EC(); + func_87901C98(); + func_80007778(); +} + +void func_86B07EA0(void) { + func_800079C4(); + func_8000699C(&gDisplayListHead, 1); + func_80015348(); + func_80015094(&D_87906050->unk_00); + func_8001F504(0, 0, 0x140, 0xF0, 0, 0, 0, 0xFF); + func_80007778(); +} + +void func_86B07F14(void) { + s32 i; + + for (i = 0; i < 18; i++) { + func_86B06FCC(); + + if (i < 3) { + func_80007990(1); + func_80006C6C(0x10); + func_86B07EA0(); + } + } + + if (D_86B0FA74 == 2) { + func_8004B1CC(0x44); + } else { + func_8004B1CC(8); + } +} + +void func_86B07FA4(void) { + s32 var_s0 = 1; + void (*temp_s2)(void) = (void*)Util_ConvertAddrToVirtAddr(func_8140C734); + + D_86B0FA70 = 0; + while (var_s0 != 0) { + D_86B0FA70++; + + func_86B06FCC(); + func_87901C20(); + + if (func_86B06FFC() != 0) { + var_s0 = 0; + } + + temp_s2(); + func_86B07DF4(); + } +} + +void func_86B08034(void) { + s32 i; + s32 var_s1; + void (*temp_s2)(void) = Util_ConvertAddrToVirtAddr(func_8140C734); + + if (D_800AE540.unk_0001 == 7) { + for (i = 0; i < 100; i++) { + func_86B06FCC(); + func_87901C20(); + + temp_s2(); + + func_86B07DF4(); + } + } + + if (D_800AE540.unk_0001 == 7) { + var_s1 = 0x64; + } else { + var_s1 = 0xA; + } + + func_80006CB4(var_s1); + func_8004B9C4(var_s1 - 2); + + for (i = 0; i < var_s1; i++) { + if (D_800AE540.unk_0001 == 7) { + func_86B06FCC(); + func_87901C20(); + temp_s2(); + func_86B07DF4(); + } else { + func_86B06FCC(); + func_87901C20(); + func_86B06FFC(); + temp_s2(); + func_86B07DF4(); + } + } + + if (D_800AE540.unk_0001 == 7) { + for (i = 0; i < 30; i++) { + func_86B06FCC(); + func_87901C20(); + + temp_s2(); + + func_86B07DF4(); + } + } +} + +void func_86B0819C(void) { + MemoryBlock* sp34; + UNUSED s32 pad; + FragmentEntry sp2C; + void* temp_v0_3; + unk_D_8690A610_018* temp_v0_6; + + D_86B0FA42 = D_86B0DE48[D_800AE540.unk_0001]; + if (D_800AE540.unk_0001 == 7) { + D_86B0FA42 += D_800AE540.unk_0002; + } + + switch (D_800AE540.unk_0001) { + case 1: + D_86B0FA44 = 4; + break; + + case 2: + D_86B0FA44 = 4; + break; + + case 3: + D_86B0FA44 = D_800AE540.unk_0002; + break; + + case 4: + D_86B0FA44 = 5; + break; + + case 5: + D_86B0FA44 = 5; + break; + + case 6: + D_86B0FA44 = D_800AE540.unk_0002; + break; + + default: + D_86B0FA44 = 0; + break; + } + + sp2C = func_8000484C(func_800044F4(stadium_models_ROM_START, _5C7A70_ROM_START, 1, 1), D_86B0FA42); + + D_86B0FA4C = sp2C(2, 0); + func_800113F8(0, &D_86B0F9D0, 0x3C0, 0x3E8, 0xFF, 0xFF, 0xFF, 0xFF); + func_8001103C(NULL, &D_86B0F9F0); + func_8001103C(NULL, &D_86B0FA08); + func_8001103C(NULL, &D_86B0FA20); + sp34 = func_80002D10(main_pool_get_available(), 0); + D_87906050 = process_geo_layout(sp34, D_86B0DE5C); + + temp_v0_3 = sp2C(0, 0); + if (temp_v0_3 != NULL) { + func_80012094(&D_86B0F9F0, process_geo_layout(sp34, temp_v0_3)); + } + + temp_v0_3 = sp2C(1, 0); + if (temp_v0_3 != NULL) { + func_80012094(&D_86B0FA08, process_geo_layout(sp34, temp_v0_3)); + } + + temp_v0_3 = sp2C(3, 0); + if (temp_v0_3 != NULL) { + func_80012094(&D_86B0FA20, process_geo_layout(sp34, temp_v0_3)); + } + + D_86B0FA38 = sp2C(2, 0); + func_80002D60(sp34); + + temp_v0_6 = sp2C(4, 0); + if (temp_v0_6 == NULL) { + D_86B0F9D0.unk_00.unk_14 = 0; + D_86B0F9D0.unk_00.unk_01 &= ~1; + } else { + D_86B0F9D0.unk_18.unk_00 = temp_v0_6->unk_00; + D_86B0F9D0.unk_18.unk_02 = temp_v0_6->unk_02; + D_86B0F9D0.unk_18.unk_04.rgba = temp_v0_6->unk_04.rgba; + D_86B0F9D0.unk_00.unk_14 = 1; + } + + func_8001BB20(); + func_86B05DA0(0xFF, 0xFF, 0xFF); + func_87901620(); + + D_86B0FA78 = main_pool_alloc(sizeof(unk_D_86B0FA78), 0); + bzero(D_86B0FA78, sizeof(unk_D_86B0FA78)); + + D_86B0FA7C = main_pool_alloc(sizeof(unk_D_86B0FA7C), 0); + bzero(D_86B0FA7C, sizeof(unk_D_86B0FA7C)); + + D_86B0FA50 = main_pool_alloc(sizeof(unk_D_86B0FA50), 0); + bzero(D_86B0FA50, sizeof(unk_D_86B0FA50)); + + D_86B0FA54 = main_pool_alloc(sizeof(unk_D_86B0FA50), 0); + bzero(D_86B0FA54, sizeof(unk_D_86B0FA50)); + + D_86B0FA58 = main_pool_alloc(sizeof(unk_D_86B0FA50), 0); + bzero(D_86B0FA58, sizeof(unk_D_86B0FA50)); + + D_86B0FA5C = main_pool_alloc(sizeof(unk_D_86B0FA50), 0); + bzero(D_86B0FA5C, sizeof(unk_D_86B0FA50)); + + D_86B0FA60 = main_pool_alloc(sizeof(unk_D_86B0FA50), 0); + bzero(D_86B0FA60, sizeof(unk_D_86B0FA50)); + + func_86B06F74(); + + switch (D_800AE540.unk_0001) { + case 1: + case 2: + case 4: + case 5: + case 7: + func_86B06E34(); + func_86B06E80(); + func_86B06F60(); + D_86B0FA74 = 0; + break; + + default: + if (D_800AE540.unk_0002 == 3) { + D_86B0FA74 = 1; + func_86B06E34(); + func_86B06E80(); + func_86B06F60(); + } else { + D_86B0FA74 = 2; + func_86B06EC8(); + func_86B06F18(); + func_86B06F60(); + } + break; + } +} + +s32 func_86B08644(void) { + unk_func_80007444* sp24; + + main_pool_push_state('DEMO'); + + func_80005E40(0x10000, 0); + sp24 = func_80007444(0, 1, 3, 1, 2, 1); + func_8001E94C(0x10, 0); + + ASSET_LOAD(D_1000000, common_menu1_ui, 0); + ASSET_LOAD(D_3000000, cup_clear_ui, 0); + + FRAGMENT_LOAD(fragment31); + + func_86B0819C(); + func_80007678(sp24); + func_86B07F14(); + func_86B07FA4(); + func_86B08034(); + func_800076C0(); + func_8001E9CC(); + func_80005EAC(); + + main_pool_pop_state('DEMO'); + + return 0; +} diff --git a/src/fragments/17/fragment17_168110.c b/src/fragments/17/fragment17_168110.c index acedfef5..cabd040b 100644 --- a/src/fragments/17/fragment17_168110.c +++ b/src/fragments/17/fragment17_168110.c @@ -1,25 +1,163 @@ -#include "global.h" +#include "fragment17.h" +#include "src/F420.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_168110/func_86B08780.s") +typedef struct unk_D_86B0DFC0 { + u8 unk_00[1]; +} unk_D_86B0DFC0; // size = ?? -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_168110/func_86B087A0.s") +static unk_D_86B0DFC0 D_86B0DFC0 = { 0x8E }; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_168110/func_86B087E8.s") +s16 func_86B08780(void) { + return D_86B0FA78->unk_004.unk_01E.y + 0x8000; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_168110/func_86B088E4.s") +s32 func_86B087A0(u8 arg0, u8* arg1, s32 arg2) { + while (arg2--) { + if (arg0 == *arg1) { + return 1; + } + arg1++; + } + return 0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_168110/func_86B089B0.s") +void func_86B087E8(unk_D_86B0FA78* arg0, Vec3f* arg1) { + f32 sp24 = 0.0f; + unk_D_86B0DFC0 sp20 = D_86B0DFC0; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_168110/func_86B089E0.s") + if (func_86B087A0(D_86B0FA78->unk_174, sp20.unk_00, 1) != 0) { + sp24 = D_86B10660.unk_04 / 1.5f; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_168110/func_86B08A3C.s") + if (D_86B10660.unk_08 != 0) { + arg1->x = arg0->unk_004.unk_024.x; + arg1->y = arg0->unk_004.unk_024.y + sp24; + arg1->z = arg0->unk_004.unk_024.z; + } else { + arg1->x = arg0->unk_004.unk_024.x; + arg1->y = arg0->unk_004.unk_024.y + D_86B10660.unk_04; + arg1->z = arg0->unk_004.unk_024.z; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_168110/func_86B08A58.s") + if (arg1->y < 0) { + arg1->y = D_86B10660.unk_04; + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_168110/func_86B08AB4.s") +void func_86B088E4(void) { + func_80010354(&D_86B0FA7C->unk_04, &D_86B0FA7C->unk_00->unk_60.at, D_86B0FA7C->unk_1C, D_86B0FA7C->unk_10, + func_86B08780() + D_86B0FA7C->unk_12); + func_80010354(&D_86B0FA7C->unk_04, &D_86B0FA7C->unk_00->unk_60.eye, D_86B0FA7C->unk_20, D_86B0FA7C->unk_16, + func_86B08780() + D_86B0FA7C->unk_18); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_168110/func_86B08AD0.s") + D_86B0FA7C->unk_00->unk_60.at.y += D_86B10660.unk_0C; + if (D_86B0FA7C->unk_00->unk_60.eye.y <= 10.0f) { + D_86B0FA7C->unk_00->unk_60.eye.y = 10.0f; + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_168110/func_86B08AEC.s") +f32 func_86B089B0(f32 arg0, f32 arg1) { + f32 temp_fv1 = D_86B10660.unk_00 * arg0; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_168110/func_86B08C44.s") + if (arg1 < temp_fv1) { + return arg1; + } + return temp_fv1; +} + +void func_86B089E0(s16 arg0, s16 arg1, s16 arg2, s16 arg3) { + D_86B0FA7C->unk_10 = arg0; + D_86B0FA7C->unk_12 = arg1; + D_86B0FA7C->unk_24 = arg2; + D_86B0FA7C->unk_26 = arg3; +} + +void func_86B08A3C(f32 arg0, f32 arg1) { + D_86B0FA7C->unk_1C = arg0; + D_86B0FA7C->unk_30 = arg1; +} + +void func_86B08A58(s16 arg0, s16 arg1, s16 arg2, s16 arg3) { + D_86B0FA7C->unk_16 = arg0; + D_86B0FA7C->unk_18 = arg1; + D_86B0FA7C->unk_2A = arg2; + D_86B0FA7C->unk_2C = arg3; +} + +void func_86B08AB4(f32 arg0, f32 arg1) { + D_86B0FA7C->unk_20 = arg0; + D_86B0FA7C->unk_34 = arg1; +} + +void func_86B08AD0(f32 arg0, f32 arg1) { + D_86B0FA7C->unk_38 = arg0; + D_86B0FA7C->unk_3C = arg1; +} + +void func_86B08AEC(unk_D_86B0C160* arg0, unk_D_86002F34_00C* arg1) { + f32 sp34; + f32 sp30; + f32 sp2C; + f32 sp28; + + D_86B0FA7C->unk_44 = 0.0f; + if (arg0->unk_30 != 200.0f) { + arg1->unk_24.fovy = D_86B0FA7C->unk_40 = arg0->unk_30; + } else { + D_86B0FA7C->unk_40 = arg0->unk_30; + } + + sp34 = func_86B089B0(arg0->unk_0C, 500.0f); + sp30 = func_86B089B0(arg0->unk_20, 500.0f); + sp2C = func_86B089B0(arg0->unk_10, 500.0f); + sp28 = func_86B089B0(arg0->unk_24, 500.0f); + + func_86B089E0(arg0->unk_00, func_86B08780() + arg0->unk_02, arg0->unk_14, func_86B08780() + arg0->unk_16); + func_86B08A3C(sp34, sp30); + + func_86B08A58(arg0->unk_06, func_86B08780() + arg0->unk_08, arg0->unk_1A, func_86B08780() + arg0->unk_1C); + func_86B08AB4(sp2C, sp28); + func_86B08AD0(arg0->unk_28, arg0->unk_2C); +} + +s32 func_86B08C44(unk_D_86002F34_00C* arg0) { + Vec3f sp5C; + Vec3f sp50; + Vec3f sp44; + Vec3f sp38; + f32 sp34; + f32 sp30; + s16 sp2E; + s16 sp2C; + + if (D_86B0FA7C->unk_40 != 200.0f) { + arg0->unk_24.fovy = D_86B0FA7C->unk_40; + } else { + func_86B0145C(&arg0->unk_24.fovy, 30.0f, 0.06f); + } + + func_86B0145C(&D_86B0FA7C->unk_44, D_86B0FA7C->unk_38, D_86B0FA7C->unk_3C); + func_80010354(&D_86B0FA7C->unk_04, &sp50, D_86B0FA7C->unk_34, D_86B0FA7C->unk_2A, + func_86B08780() + D_86B0FA7C->unk_2C); + + if (sp50.y <= 10.0f) { + sp50.y = 10.0f; + } + + func_86B01404(&sp44, &arg0->unk_60.eye); + func_800102A4(&sp44, &sp50, &sp34, &sp2E, &sp2C); + func_80010354(&sp44, &arg0->unk_60.eye, D_86B0FA7C->unk_44 * sp34, sp2E, sp2C); + func_80010354(&D_86B0FA7C->unk_04, &sp38, D_86B0FA7C->unk_30, D_86B0FA7C->unk_24, + func_86B08780() + D_86B0FA7C->unk_26); + + sp38.y += D_86B10660.unk_0C; + + func_86B01404(&sp5C, &arg0->unk_60.at); + func_800102A4(&sp5C, &sp38, &sp30, &sp2E, &sp2C); + func_80010354(&sp5C, &arg0->unk_60.at, D_86B0FA7C->unk_44 * sp30, sp2E, sp2C); + + if ((sp34 <= 1.0f) && (sp30 <= 1.0f)) { + return 1; + } + return 0; +} diff --git a/src/fragments/17/fragment17_1687E0.c b/src/fragments/17/fragment17_1687E0.c index baf5302b..d588d76b 100644 --- a/src/fragments/17/fragment17_1687E0.c +++ b/src/fragments/17/fragment17_1687E0.c @@ -1,19 +1,369 @@ -#include "global.h" +#include "fragment17.h" +#include "src/1CF30.h" +#include "src/6BC0.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_1687E0/func_86B08E50.s") +static Gfx D_86B0DFD0[] = { + gsDPPipeSync(), + gsDPSetCycleType(G_CYC_1CYCLE), + gsSPClearGeometryMode(G_ZBUFFER | G_CULL_BACK | G_LIGHTING), + gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_NOOP2), + gsDPSetCombineMode(G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM), + gsDPSetPrimColor(0, 0, 5, 5, 5, 255), + gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON), + gsDPSetTexturePersp(G_TP_NONE), + gsSPEndDisplayList(), +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_1687E0/func_86B08EA8.s") +static Gfx D_86B0E018[] = { + gsDPSetCycleType(G_CYC_2CYCLE), + gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF), + gsDPSetTexturePersp(G_TP_PERSP), + gsSPSetGeometryMode(G_ZBUFFER | G_CULL_BACK | G_LIGHTING), + gsSPEndDisplayList(), +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_1687E0/func_86B08EB4.s") +unk_D_86B0C160 D_86B0E040[] = { + { + 0, + 0, + 0, + 0, + 12743, + 0.0f, + 10.0f, + 0, + 0, + 0, + 0, + 0, + 0.0f, + 4.0f, + 0.15000000596046448f, + 0.009999999776482582f, + 30.0f, + }, + { + 0, + 0, + 0, + 0, + 0, + 0.0f, + 10.0f, + 0, + 0, + 0, + 0, + 0, + 0.0f, + 3.0f, + 0.15000000596046448f, + 0.009999999776482582f, + 200.0f, + }, + { + 0, + 0, + 0, + 7281, + 16384, + 0.0f, + 10.0f, + 0, + 0, + 0, + 0, + 0, + 0.0f, + 3.5f, + 0.15000000596046448f, + 0.009999999776482582f, + 200.0f, + }, + { + 0, + 0, + 0, + 25486, + 9102, + 0.0f, + 10.0f, + 0, + 0, + 0, + 0, + -380, + 0.5f, + 4.0f, + 0.15000000596046448f, + 0.009999999776482582f, + 200.0f, + }, + { + 0, + 12743, + 0, + -3640, + 9102, + 3.0f, + 10.0f, + 0, + 0, + 0, + 1820, + 0, + 0.0f, + 3.5f, + 0.15000000596046448f, + 0.009999999776482582f, + 200.0f, + }, + { + 0, + 0, + 0, + 14563, + 0, + 0.0f, + 10.0f, + 0, + 0, + 0, + 0, + 0, + 0.0f, + 4.0f, + 0.15000000596046448f, + 0.009999999776482582f, + 200.0f, + }, + { + -7282, + 0, + 0, + 25486, + 14563, + 2.0f, + 10.0f, + 0, + 0, + 0, + 0, + -198, + 0.5f, + 4.0f, + 0.15000000596046448f, + 0.009999999776482582f, + 200.0f, + }, + { + 0, + 0, + 0, + -3640, + 23665, + 0.0f, + 10.0f, + 0, + 0, + 0, + 1820, + 0, + 0.0f, + 3.5f, + 0.15000000596046448f, + 0.009999999776482582f, + 200.0f, + }, + { + 0, + 0, + 0, + 14563, + 0, + 0.0f, + 10.0f, + 0, + 0, + 0, + 0, + 0, + 0.0f, + 4.0f, + 0.15000000596046448f, + 0.009999999776482582f, + 200.0f, + }, + { + 0, + 0, + 0, + -3640, + 0, + 0.0f, + 7.0f, + 0, + 0, + 0, + 1820, + 0, + 0.0f, + 3.5f, + 0.15000000596046448f, + 0.009999999776482582f, + 200.0f, + }, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_1687E0/func_86B08F48.s") +static s16 D_86B106A0; +static s16 D_86B106A2; +static s16 D_86B106A4; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_1687E0/func_86B095C4.s") +void func_86B08E50(s32 arg0, s32 arg1) { + D_86B106A0 = arg0; + D_86B106A4 = arg1; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_1687E0/func_86B0961C.s") + if ((D_86B106A0 == 0) || ((D_86B106A0 != 1) && (D_86B106A0 != 2) && (D_86B106A0 == 3))) { + D_86B106A2 = 0x140; + } else { + D_86B106A2 = 0; + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_1687E0/func_86B097B0.s") +s32 func_86B08EA8(void) { + return D_86B106A0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_1687E0/func_86B09928.s") +void func_86B08EB4(void) { + s16 tmp = D_86B106A2; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_1687E0/func_86B09AD8.s") + switch (D_86B106A0) { + case 2: + if (tmp < 0x140) { + tmp += D_86B106A4; + } else { + D_86B106A0 = 0; + } + break; + + case 3: + if (tmp > 0) { + tmp -= D_86B106A4; + } else { + D_86B106A0 = 1; + } + + if (tmp < 0) { + tmp = 0; + } + break; + } + + D_86B106A2 = tmp; +} + +Gfx* func_86B08F48(Gfx* gfx, u32 arg1) { + s32 idx1 = arg1 % 2; + s32 idx2 = (arg1 + 1) % 2; + s32 i; + s16 xl; + s16 yl; + + gSPDisplayList(gfx++, D_86B0DFD0); + + gDPLoadTextureBlock_4b(gfx++, D_3000000, G_IM_FMT_I, 12, 48, 0, G_TX_NOMIRROR | G_TX_CLAMP, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + gDPPipeSync(gfx++); + + for (i = idx1; i < 5; i += 2) { + xl = (D_86B106A2 * 2) - 0x140; + yl = (i * 0x30); + + gSPScisTextureRectangle(gfx++, xl << 2, yl << 2, (xl + 0x280) << 2, (yl + 24) << 2, 0, 0, 0, 1 << 6, 1 << 10); + gSPScisTextureRectangle(gfx++, xl << 2, (yl + 24) << 2, (xl + 0x280) << 2, (yl + 48) << 2, 0, 0, 0, 1 << 6, + 1 << 10); + } + + for (i = idx2; i < 5; i += 2) { + xl = -D_86B106A2 * 2; + yl = (i * 0x30); + + gSPScisTextureRectangle(gfx++, xl << 2, yl << 2, (xl + 0x280) << 2, (yl + 24) << 2, 0, 0x500, 0, -(1 << 6), + 1 << 10); + gSPScisTextureRectangle(gfx++, xl << 2, (yl + 24) << 2, (xl + 0x280) << 2, (yl + 48) << 2, 0, 0x500, 0, + -(1 << 6), 1 << 10); + } + + gSPDisplayList(gfx++, D_86B0E018); + + return gfx; +} + +void func_86B095C4(void) { + Gfx* var_a0 = gDisplayListHead; + + if (D_86B106A0 != 0) { + if (D_86B106A0 == 2) { + var_a0 = func_86B08F48(var_a0, 0); + } else { + var_a0 = func_86B08F48(var_a0, 1); + } + } + gDisplayListHead = var_a0; +} + +void func_86B0961C(s16 arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5, s16 arg6, s16 arg7) { + unk_D_800A7440 sp30; + + func_80005FC0(&sp30, arg0, arg1, (arg0 + arg2) - 1, (arg1 + arg3) - 1); + + if (func_80006030(&sp30) != 0) { + if (arg6 != 0) { + arg4 += ((sp30.x1 - arg0) * arg6) >> 5; + } + + if (arg7 != 0) { + arg5 += ((sp30.y2 - arg1) * arg7) >> 5; + } + + sp30.y1 += 1; + sp30.x2 += 1; + + gSPTextureRectangle(gDisplayListHead++, sp30.x1 << 2, sp30.y2 << 2, sp30.y1 << 2, sp30.x2 << 2, G_TX_RENDERTILE, + arg4, arg5, arg6, arg7); + } +} + +void func_86B097B0(s32 arg0, s32 arg1, s32 arg2, s32 arg3, u8* arg4, UNUSED s32 arg5) { + gDPLoadTextureTile(gDisplayListHead++, arg4, G_IM_FMT_IA, G_IM_SIZ_8b, arg2, arg3, 0, 0, arg2 - 1, arg3 - 1, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); + + func_86B0961C(arg0, arg1, arg2, arg3, 0, 0, 0x400, 0x400); +} + +void func_86B09928(u8* arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4, unk_D_86B0DAE0_000* arg5) { + gDPPipeSync(gDisplayListHead++); + + gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE); + gDPSetTexturePersp(gDisplayListHead++, G_TP_NONE); + gDPSetCombineLERP(gDisplayListHead++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetRenderMode(gDisplayListHead++, G_RM_XLU_SURF, G_RM_XLU_SURF2); + gDPSetEnvColor(gDisplayListHead++, (u8)arg5->unk_06, (u8)arg5->unk_08, (u8)arg5->unk_0A, 255); + gDPSetPrimColor(gDisplayListHead++, 0, 0, (u8)arg5->unk_00, (u8)arg5->unk_02, (u8)arg5->unk_04, 255); + gSPClearGeometryMode(gDisplayListHead++, G_ZBUFFER | G_LIGHTING); + + func_86B097B0(arg1, arg2, arg3, arg4, arg0, arg3); + + gSPDisplayList(gDisplayListHead++, D_8006F630); +} + +void func_86B09AD8(u8* arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4) { + gSPDisplayList(gDisplayListHead++, D_8006F518); + + func_8001C6AC(arg1, arg2, arg3, arg4, arg0, arg3, 0); + + gSPDisplayList(gDisplayListHead++, D_8006F630); +} diff --git a/src/fragments/17/fragment17_169510.c b/src/fragments/17/fragment17_169510.c index 74d2eabe..30549bd4 100644 --- a/src/fragments/17/fragment17_169510.c +++ b/src/fragments/17/fragment17_169510.c @@ -1,7 +1,68 @@ -#include "global.h" +#include "fragment17.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_169510/func_86B09B80.s") +void func_86B09B80(Mtx* arg0, MtxF* arg1) { + arg0->m[0][0] = + ((s32)(arg1->mf[0][0] * 65536.0f) & 0xFFFF0000) | (((s32)(arg1->mf[0][1] * 65536.0f) >> 0x10) & 0xFFFF); + arg0->m[0][1] = + ((s32)(arg1->mf[0][2] * 65536.0f) & 0xFFFF0000) | (((s32)(arg1->mf[0][3] * 65536.0f) >> 0x10) & 0xFFFF); + arg0->m[0][2] = + ((s32)(arg1->mf[1][0] * 65536.0f) & 0xFFFF0000) | (((s32)(arg1->mf[1][1] * 65536.0f) >> 0x10) & 0xFFFF); + arg0->m[0][3] = + ((s32)(arg1->mf[1][2] * 65536.0f) & 0xFFFF0000) | (((s32)(arg1->mf[1][3] * 65536.0f) >> 0x10) & 0xFFFF); + arg0->m[1][0] = + ((s32)(arg1->mf[2][0] * 65536.0f) & 0xFFFF0000) | (((s32)(arg1->mf[2][1] * 65536.0f) >> 0x10) & 0xFFFF); + arg0->m[1][1] = + ((s32)(arg1->mf[2][2] * 65536.0f) & 0xFFFF0000) | (((s32)(arg1->mf[2][3] * 65536.0f) >> 0x10) & 0xFFFF); + arg0->m[1][2] = + ((s32)(arg1->mf[3][0] * 65536.0f) & 0xFFFF0000) | (((s32)(arg1->mf[3][1] * 65536.0f) >> 0x10) & 0xFFFF); + arg0->m[1][3] = + ((s32)(arg1->mf[3][2] * 65536.0f) & 0xFFFF0000) | (((s32)(arg1->mf[3][3] * 65536.0f) >> 0x10) & 0xFFFF); + arg0->m[2][0] = ((s32)(arg1->mf[0][0] * 65536.0f) << 0x10) | ((s32)(arg1->mf[0][1] * 65536.0f) & 0xFFFF); + arg0->m[2][1] = ((s32)(arg1->mf[0][2] * 65536.0f) << 0x10) | ((s32)(arg1->mf[0][3] * 65536.0f) & 0xFFFF); + arg0->m[2][2] = ((s32)(arg1->mf[1][0] * 65536.0f) << 0x10) | ((s32)(arg1->mf[1][1] * 65536.0f) & 0xFFFF); + arg0->m[2][3] = ((s32)(arg1->mf[1][2] * 65536.0f) << 0x10) | ((s32)(arg1->mf[1][3] * 65536.0f) & 0xFFFF); + arg0->m[3][0] = ((s32)(arg1->mf[2][0] * 65536.0f) << 0x10) | ((s32)(arg1->mf[2][1] * 65536.0f) & 0xFFFF); + arg0->m[3][1] = ((s32)(arg1->mf[2][2] * 65536.0f) << 0x10) | ((s32)(arg1->mf[2][3] * 65536.0f) & 0xFFFF); + arg0->m[3][2] = ((s32)(arg1->mf[3][0] * 65536.0f) << 0x10) | ((s32)(arg1->mf[3][1] * 65536.0f) & 0xFFFF); + arg0->m[3][3] = ((s32)(arg1->mf[3][2] * 65536.0f) << 0x10) | ((s32)(arg1->mf[3][3] * 65536.0f) & 0xFFFF); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_169510/func_86B09EF0.s") +void func_86B09EF0(MtxF* arg0, f32 arg1) { + arg0->mf[0][0] *= arg1; + arg0->mf[1][0] *= arg1; + arg0->mf[2][0] *= arg1; + arg0->mf[0][1] *= arg1; + arg0->mf[1][1] *= arg1; + arg0->mf[2][1] *= arg1; + + arg0->mf[0][2] *= arg1; + arg0->mf[1][2] *= arg1; + arg0->mf[2][2] *= arg1; +} + +#ifdef NON_MATCHING +void func_86B09F64(MtxF* arg0, f32 arg1, f32 arg2, f32 arg3, u16 arg4, u16 arg5) { + arg0->mf[0][0] = (COSS(arg4) * COSS(arg5)) + (SINS(arg4) * SINS(arg4) * SINS(arg5)); + arg0->mf[1][0] = (-COSS(arg4) * SINS(arg5)) + (SINS(arg4) * SINS(arg4) * COSS(arg5)); + arg0->mf[2][0] = COSS(arg4) * SINS(arg4); + arg0->mf[3][0] = arg1; + + arg0->mf[0][1] = COSS(arg4) * SINS(arg5); + arg0->mf[2][1] = -SINS(arg4); + arg0->mf[1][1] = COSS(arg4) * COSS(arg5); + arg0->mf[3][1] = arg2; + + arg0->mf[0][2] = (SINS(arg4) * COSS(arg4) * SINS(arg5)) + (-SINS(arg4) * COSS(arg5)); + arg0->mf[1][2] = (SINS(arg4) * COSS(arg4) * COSS(arg5)) + (SINS(arg4) * SINS(arg5)); + arg0->mf[2][2] = COSS(arg4) * COSS(arg4); + arg0->mf[3][2] = arg3; + + arg0->mf[0][3] = 0.0f; + arg0->mf[1][3] = 0.0f; + arg0->mf[2][3] = 0.0f; + arg0->mf[3][3] = 1.0f; +} +#else #pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_169510/func_86B09F64.s") +#endif diff --git a/src/fragments/17/fragment17_169A40.c b/src/fragments/17/fragment17_169A40.c index 601bf4ec..10f63e80 100644 --- a/src/fragments/17/fragment17_169A40.c +++ b/src/fragments/17/fragment17_169A40.c @@ -1,20 +1,175 @@ -#include "global.h" +#include "fragment17.h" +#include "src/12D80.h" +#include "src/17300.h" +#include "src/geo_layout.h" +#include "src/19840.h" +#include "src/1C720.h" +#include "src/1CF30.h" +#include "src/20330.h" +#include "src/26820.h" +#include "src/3FB0.h" +#include "src/6A40.h" +#include "src/6BC0.h" +#include "src/DDC0.h" +#include "src/F420.h" +#include "src/controller.h" +#include "src/memory.h" +#include "src/stage_loader.h" + +static u32 D_86B0E250[] = { + 0x0C00FFFF, 0x05000000, 0x0B00001E, 0x00000000, 0x014000F0, 0x00000032, 0x00000000, 0x00000118, + 0x05000000, 0x0D000000, 0x05000000, 0x14000000, 0x002B0012, 0xFFFFFF32, 0x16FFFFFF, 0x0F000003, + 0x05000000, 0x0A000000, &D_800AC840, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x01000000, +}; + +static unk_D_86002F30* D_86B106B0; +static GraphNode* D_86B106B4; +static unk_D_86002F58_004_000 D_86B106B8; +static unk_D_86002F34_00C* D_86B10820; +static BinArchive* D_86B10824; +static u8* D_86B10828; +static u8 D_86B1082C; +static unk_func_80027FA0 D_86B10830; void func_86B0A0B0(void) { } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_169A40/func_86B0A0B8.s") +void func_86B0A0B8(void) { + D_86B10820 = D_86B106B4->unk_0C; + func_8000E88C(&D_86B10820->unk_60.at, 0.0f, 0.0f, 0.0f); + func_8000E88C(&D_86B10820->unk_60.eye, 0.0f, 0.0f, 200.0f); + D_86B10820->unk_24.near = 16.0f; + D_86B10820->unk_24.far = 32768.0f; + D_86B10820->unk_24.fovy = 45.0f; +} + +void func_86B0A15C(void) { + Cont_StartReadInputs(); + Cont_ReadInputs(); + func_8001F730(); +} + +void func_86B0A18C(u8* arg0) { + s32 i; + s32 j; + + if (1) {} + + gDPPipeSync(gDisplayListHead++); + + gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE); + gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); + gDPSetTexturePersp(gDisplayListHead++, G_TP_NONE); + gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGB, G_CC_DECALRGB); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_169A40/func_86B0A15C.s") + gDPPipeSync(gDisplayListHead++); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_169A40/func_86B0A18C.s") + for (i = 0; i < 15; i++) { + for (j = 0; j < 20; j++, arg0 += 0x200) { + func_8001C6AC(j * 0x10, i * 0x10, 0x10, 0x10, arg0, 0x10, 0); + } + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_169A40/func_86B0A30C.s") + gSPDisplayList(gDisplayListHead++, D_8006F630); +} + +void func_86B0A30C(void) { + func_800079C4(); + func_86B0A18C(D_86B10828); + func_800067E4(&gDisplayListHead, 0, 0, 0x140, 0xF0); + func_80015348(); + func_80015094(D_86B106B4); + func_86B0A0B0(); + func_80007778(); +} + +s32 func_86B0A37C(void) { + s32 var_v0; + + if ((D_86B106B8.unk_040.unk_08 >> 0x10) >= 0x5F) { + func_8001BE34(&D_86B106B8, 0, 0, 0, D_86B1082C += 0x14); + } + + if ((D_86B106B8.unk_040.unk_08 >> 0x10) == 0x64) { + func_80007990(1); + func_80006CB4(3); + } + + var_v0 = func_800174E4(&D_86B106B8) != 0; + if (var_v0) { + return 1; + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_169A40/func_86B0A37C.s") +void func_86B0A414(void) { + s32 var_s0 = 1; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_169A40/func_86B0A414.s") + func_80006C6C(0xC); + func_8000D1F0(0x30); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_169A40/func_86B0A47C.s") + while (var_s0 != 0) { + func_86B0A15C(); + if (func_86B0A37C() != 0) { + var_s0 = 0; + } + func_86B0A30C(); + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_169A40/func_86B0A554.s") + func_800077B4(2); +} + +void func_86B0A47C(void) { + MemoryBlock* sp1C = func_80002D10(main_pool_get_available(), 0); + + D_86B106B4 = process_geo_layout(sp1C, &D_86B0E250); + + func_80002D60(sp1C); + func_8001BB20(); + func_86B0A0B8(); + func_8001BB58(&D_86B106B8); + func_8001987C(); + + D_86B106B0 = func_80019D18(0xD6); + func_8001BC34(&D_86B106B8, 0, 0xD6, D_86B106B0->unk_08->unk_00[0]); + func_8001BD04(&D_86B106B8, 1); + func_8000E88C(&D_86B106B8.unk_024, 0.0f, 0.0f, 0.0f); + D_86B1082C = 0; +} + +s32 func_86B0A554(void) { + unk_func_80007444* sp24; + + main_pool_push_state('MTWO'); + + func_80005E40(0x10000, 0); + sp24 = func_80007444(0, 1, 3, 1, 2, 1); + func_8001E94C(6, 0); + + ASSET_LOAD(D_1000000, common_menu1_ui, 0); + FRAGMENT_LOAD(fragment31); + + func_80028AFC(2); + func_80027FA0(&D_86B10830, D_800AE540.unk_11F2); + + if (D_800AE540.unk_11F2 == 1) { + D_86B10824 = ASSET_LOAD2(backgrounds, 1, 1); + D_86B10828 = func_8000484C(D_86B10824, 2); + } else if (D_86B10830.unk_00 & 0x100) { + D_86B10824 = ASSET_LOAD2(backgrounds, 1, 1); + D_86B10828 = func_8000484C(D_86B10824, 1); + } else { + D_86B10824 = ASSET_LOAD2(backgrounds, 1, 1); + D_86B10828 = func_8000484C(D_86B10824, 2); + } + + func_86B0A47C(); + func_80007678(sp24); + func_86B0A414(); + func_800076C0(); + func_8001E9CC(); + func_80005EAC(); + + main_pool_pop_state('MTWO'); + + return 0; +} diff --git a/src/fragments/17/fragment17_16A0E0.c b/src/fragments/17/fragment17_16A0E0.c index a53ebf10..fa51682b 100644 --- a/src/fragments/17/fragment17_16A0E0.c +++ b/src/fragments/17/fragment17_16A0E0.c @@ -1,36 +1,453 @@ -#include "global.h" +#include "fragment17.h" +#include "src/12D80.h" +#include "src/17300.h" +#include "src/geo_layout.h" +#include "src/19840.h" +#include "src/1C720.h" +#include "src/1CF30.h" +#include "src/20330.h" +#include "src/2E110.h" +#include "src/3FB0.h" +#include "src/4BDC0.h" +#include "src/6A40.h" +#include "src/6BC0.h" +#include "src/F420.h" +#include "src/controller.h" +#include "src/memory.h" +#include "src/stage_loader.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0A750.s") +typedef struct unk_D_86B10BD0 { + /* 0x00 */ s32 unk_00; + /* 0x04 */ s32 unk_04; + /* 0x08 */ s32 unk_08; +} unk_D_86B10BD0; // size >= 0xC -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0A7F8.s") +typedef struct unk_D_86B10BE0 { + /* 0x00 */ s32 unk_00; + /* 0x04 */ s32 unk_04; + /* 0x08 */ s32 unk_08; + /* 0x0C */ s32 unk_0C; + /* 0x10 */ s32 unk_10; +} unk_D_86B10BE0; // size >= 0x14 + +static u32 D_86B0E2B0[] = { + 0xA4AAA4E1, 0xA4C7A4C8, 0xA4A6A1AA, 0x20A5C9A1, 0xBCA5C9A1, 0xBCA4CE0A, 0xA5B2A1BC, 0xA5E0A5DC, 0xA1BCA5A4, + 0xA4F2A5B2, 0xA5C3A5C8, 0xA4C0A1AA, 0x00000000, 0x4742A5D3, 0xA5EBA4CE, 0xA5B2A1BC, 0xA5E0A5DC, 0xA1BCA5A4, + 0xA4AC0A20, 0x20A5B9A5, 0xD4A1BCA5, 0xC9A5A2A5, 0xC3A5D7A1, 0xAA000000, 0xA4B9A4B4, 0xA4A4A4BE, 0xA1AA20A5, + 0xC9A1BCA5, 0xC9A5EAA5, 0xAAA4CE0A, 0xA5B2A1BC, 0xA5E0A5DC, 0xA1BCA5A4, 0xA4F2A5B2, 0xA5C3A5C8, 0xA4C0A1AA, + 0x00000000, 0x4742A5D3, 0xA5EBA4CE, 0xA5B2A1BC, 0xA5E0A5DC, 0xA1BCA5A4, 0xA4AC0AA4, 0xB5A4E9A4, 0xCBA5B9A5, + 0xD4A1BCA5, 0xC9A5A2A5, 0xC3A5D7A4, 0xC0A1AA00, +}; + +static u32 D_86B0E374[] = { + 0x0C00FFFF, 0x05000000, 0x0B00001E, 0x00000000, 0x014000F0, 0x00000000, 0x00000000, 0x00000118, + 0x05000000, 0x0D000000, 0x05000000, 0x14000000, 0x002B0012, 0xFFFFFF32, 0x16FFFFFF, 0x0F000003, + 0x05000000, 0x0A000000, &D_800AC840, 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x01000000, +}; + +static char** D_86B10840; +static unk_D_86002F30* D_86B10844; +static GraphNode* D_86B10848; +static unk_D_86002F58_004_000 D_86B10850; +static unk_D_86002F34_00C* D_86B109B8; +static BinArchive* D_86B109BC; +static u8* D_86B109C0; +static s8 D_86B109C8[0x100]; +static s8 D_86B10AC8[0x100]; +static s16 D_86B10BC8; +static s16 D_86B10BCA; +static s16 D_86B10BCC; +static unk_D_86B10BD0 D_86B10BD0; +static unk_D_86B10BE0 D_86B10BE0; + +void func_86B0A750(void) { + D_86B109B8 = D_86B10848->unk_0C; + + D_86B10BC8 = 0; + D_86B10BCA = 0; + D_86B10BCC = 0x78; + + func_80010354(&D_86B109B8->unk_60.at, &D_86B109B8->unk_60.eye, D_86B10BCC, D_86B10BC8, D_86B10BCA); + + D_86B109B8->unk_24.near = 50.0f; + D_86B109B8->unk_24.far = 6400.0f; +} + +void func_86B0A7F8(void) { + D_86B10BD0.unk_00 = 0; + D_86B10BD0.unk_04 = 0; + D_86B10BD0.unk_08 = 0; + D_86B10BE0.unk_10 = 0xA; +} void func_86B0A81C(void) { } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0A824.s") +void func_86B0A824(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8 arg4, u8 arg5, u8 arg6, u8 arg7) { + s16 sp48; + s16 sp44; + s16 var_s2; + s16 var_s3; + + if (arg2 >= 0x10) { + var_s3 = 8; + } else { + var_s3 = arg2 / 2; + } + + if (arg3 >= 0x10) { + var_s2 = 8; + } else { + var_s2 = arg3 / 2; + } + + sp48 = arg2 - (var_s3 * 2); + sp44 = arg3 - (var_s2 * 2); + + gSPDisplayList(gDisplayListHead++, D_8006F518); + gDPSetEnvColor(gDisplayListHead++, arg4, arg5, arg6, arg7); + + gDPLoadTextureBlock_4b(gDisplayListHead++, D_2028A60, G_IM_FMT_I, 16, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD); + + func_8001C330(arg0, arg1, var_s3, var_s2, 0, 0, 0x2000 / var_s3, 0x2000 / var_s2, 0); + + gDPLoadTextureBlock_4b(gDisplayListHead++, D_2028AA0, G_IM_FMT_I, 16, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD); + + func_8001C330((arg0 + arg2) - var_s3, arg1, var_s3, var_s2, 0, 0, 0x2000 / var_s3, 0x2000 / var_s2, 0); + + gDPLoadTextureBlock_4b(gDisplayListHead++, D_20289E0, G_IM_FMT_I, 16, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD); + + func_8001C330(arg0, (arg1 + arg3) - var_s2, var_s3, var_s2, 0, 0, 0x2000 / var_s3, 0x2000 / var_s2, 0); + + gDPLoadTextureBlock_4b(gDisplayListHead++, D_2028A20, G_IM_FMT_I, 16, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, + G_TX_NOMIRROR | G_TX_WRAP, 5, 5, G_TX_NOLOD, G_TX_NOLOD); + + func_8001C330((arg0 + arg2) - var_s3, (arg1 + arg3) - var_s2, var_s3, var_s2, 0, 0, 0x2000 / var_s3, + 0x2000 / var_s2, 0); + + gSPDisplayList(gDisplayListHead++, D_8006F498); + + if ((sp48 > 0) && (sp44 > 0)) { + func_8001C604(arg0 + var_s3, arg1, sp48, var_s2, arg4, arg5, arg6, arg7); + func_8001C604(arg0, arg1 + var_s3, arg2, sp44, arg4, arg5, arg6, arg7); + func_8001C604(arg0 + var_s3, (arg1 + var_s3) + sp44, sp48, var_s2, arg4, arg5, arg6, arg7); + } else if (sp48 > 0) { + func_8001C604(arg0 + var_s3, arg1, sp48, arg3, arg4, arg5, arg6, arg7); + } else if (sp44 > 0) { + func_8001C604(arg0, arg1 + var_s2, arg2, sp44, arg4, arg5, arg6, arg7); + } + + gSPDisplayList(gDisplayListHead++, D_8006F630); +} + +void func_86B0B024(void) { + D_86B10BE0.unk_00 = 0xFF; +} + +void func_86B0B034(void) { + D_86B10BE0.unk_00 = 0; +} + +s32 func_86B0B040(void) { + if (D_86B109C8[D_86B10BE0.unk_04] == 0) { + return 1; + } + + D_86B10AC8[D_86B10BE0.unk_04++] = D_86B109C8[D_86B10BE0.unk_04]; + + if (D_86B109C8[D_86B10BE0.unk_04] == 0) { + return 1; + } + + D_86B10AC8[D_86B10BE0.unk_04++] = D_86B109C8[D_86B10BE0.unk_04]; + return 0; +} + +void func_86B0B0B4(void) { + func_86B0A824(0x3C, 0xBE - (D_86B10BE0.unk_10 / 2), D_86B10BE0.unk_0C, D_86B10BE0.unk_10, 0x50, 0x50, 0xF0, 0x80); +} + +void func_86B0B12C(void) { + func_8001F3F4(); + func_8001EBE0(2, 0); + func_8001F3B4(0x10); + func_8001F1E8(0x56, 0xAF, "%s", D_86B10AC8); + func_8001F444(); +} + +void func_86B0B184(void) { + s32 i; + + switch (D_86B10BE0.unk_00) { + case 0x0: + if (D_800AE540.unk_0000 == 0x16) { + sprintf(D_86B109C8, func_8002D7C0(NULL, 0, D_86B10840, 0x91)); + } else { + sprintf(D_86B109C8, func_8002D7C0(NULL, 0, D_86B10840, 0x93)); + } + + D_86B10BE0.unk_04 = 0; + D_86B10BE0.unk_08 = 0; + D_86B10BE0.unk_0C = 0xC8; + D_86B10BE0.unk_10 = 0xA; + + // clang-format off + for (i = 0; i < 255; i++) { D_86B10AC8[i] = 0; } + // clang-format on + + func_86B0B0B4(); + D_86B10BE0.unk_00++; + break; + + case 0x1: + D_86B10BE0.unk_10 = func_8001046C(D_86B10BE0.unk_10, 0x28, 8, 8); + if (D_86B10BE0.unk_10 == 0x28) { + D_86B10BE0.unk_00++; + } + func_86B0B0B4(); + break; + + case 0x2: + func_86B0B0B4(); + if (func_86B0B040() != 0) { + D_86B10BE0.unk_00++; + } + func_86B0B12C(); + break; + + case 0x3: + func_86B0B0B4(); + func_86B0B12C(); + + if (D_86B10BE0.unk_08++ == 0x3C) { + if (D_800AE540.unk_0000 == 0x16) { + sprintf(D_86B109C8, func_8002D7C0(NULL, 0, D_86B10840, 0x92)); + } else { + sprintf(D_86B109C8, func_8002D7C0(NULL, 0, D_86B10840, 0x94)); + } + + D_86B10BE0.unk_04 = 0; + D_86B10BE0.unk_08 = 0; + + // clang-format off + for (i = 0; i < 255; i++) { D_86B10AC8[i] = 0; } + // clang-format on + + D_86B10BE0.unk_00++; + } + break; + + case 0x4: + func_86B0B0B4(); + if (func_86B0B040() != 0) { + D_86B10BE0.unk_00++; + } + func_86B0B12C(); + break; + + case 0x5: + func_86B0B0B4(); + func_86B0B12C(); + + if (D_86B10BE0.unk_08++ == 0x41) { + D_86B10BE0.unk_00 = 0xFF; + } + break; + + case 0xFF: + D_86B10BE0.unk_10 = func_8001046C(D_86B10BE0.unk_10, 0, 8, 8); + if (D_86B10BE0.unk_10 >= 0xB) { + func_86B0B0B4(); + } + break; + } +} + +void func_86B0B498(void) { + Cont_StartReadInputs(); + Cont_ReadInputs(); + func_8001F730(); +} + +void func_86B0B4C8(void) { +} + +void func_86B0B4D0(u8* arg0) { + s32 i; + s32 j; + + if (1) {} + + gDPPipeSync(gDisplayListHead++); + + gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE); + gDPSetRenderMode(gDisplayListHead++, G_RM_OPA_SURF, G_RM_OPA_SURF2); + gDPSetTexturePersp(gDisplayListHead++, G_TP_NONE); + gDPSetCombineMode(gDisplayListHead++, G_CC_DECALRGB, G_CC_DECALRGB); + + gDPPipeSync(gDisplayListHead++); + + for (i = 0; i < 15; i++) { + for (j = 0; j < 20; j++, arg0 += 0x200) { + func_8001C6AC(j * 0x10, i * 0x10, 0x10, 0x10, arg0, 0x10, 0); + } + } + + gSPDisplayList(gDisplayListHead++, D_8006F630); +} + +void func_86B0B650(void) { + func_800079C4(); + func_86B0B4D0(D_86B109C0); + func_800067E4(&gDisplayListHead, 0, 0, 0x140, 0xF0); + func_80015348(); + func_80015094(D_86B10848); + func_86B0B184(); + func_80007778(); +} + +s32 func_86B0B6C0(void) { + s32 sp24 = 0; + + switch (D_86B10BD0.unk_00) { + case 0: + D_86B10850.unk_000.unk_02 |= 0x20; + D_86B10850.unk_000.unk_01 |= 1; + D_86B10BD0.unk_00++; + break; + + case 1: + if ((D_86B10850.unk_040.unk_08 >> 0x10) == 0xA) { + func_8004B1CC(0x38); + } + + if ((D_86B10850.unk_040.unk_08 >> 0x10) == 0x72) { + D_86B10BD0.unk_08 = 0; + D_86B10850.unk_000.unk_02 &= 0xFFDF; + func_86B0B034(); + func_8004B1CC(0x13); + D_86B10BD0.unk_00++; + } + break; + + case 2: + if (D_86B10BE0.unk_00 == 0xFF) { + D_86B10BD0.unk_08 = 0; + D_86B10850.unk_000.unk_02 |= 0x20; + func_86B0B024(); + D_86B10BD0.unk_00++; + } + break; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0B024.s") + case 3: + if (func_800174E4(&D_86B10850) != 0) { + D_86B10BD0.unk_00++; + } + break; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0B034.s") + case 4: + sp24 = 1; + break; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0B040.s") + return sp24; +} + +void func_86B0B810(void) { + s32 i; + s32 var_s2 = 1; + + func_80007990(1); + func_80006C6C(0xA); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0B0B4.s") + for (i = 0; i < 10; i++) { + func_86B0B498(); + func_86B0B650(); + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0B12C.s") + while (var_s2 != 0) { + func_86B0B498(); + if (func_86B0B6C0() != 0) { + var_s2 = 0; + } + func_86B0B650(); + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0B184.s") + func_80007990(0xFFFF); + func_80006CB4(8); + + for (i = 0; i < 8; i++) { + func_86B0B498(); + func_86B0B650(); + } + + func_800077B4(2); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0B498.s") +void func_86B0B8DC(void) { + MemoryBlock* temp_v0 = func_80002D10(main_pool_get_available(), 0); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0B4D0.s") + D_86B10848 = process_geo_layout(temp_v0, &D_86B0E374); + func_80002D60(temp_v0); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0B650.s") + func_8001BB20(); + func_86B0A750(); + func_86B0A7F8(); + func_86B0B024(); + func_8001BB58(&D_86B10850); + func_8001987C(); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0B6C0.s") + if (D_800AE540.unk_0000 == 0x16) { + D_86B10844 = func_80019D18(0xD5); + func_8001BC34(&D_86B10850, 0, 0xD5, D_86B10844->unk_08->unk_00[0]); + } else { + D_86B10844 = func_80019D18(0xD4); + func_8001BC34(&D_86B10850, 0, 0xD4, D_86B10844->unk_08->unk_00[0]); + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0B810.s") + func_8001BD04(&D_86B10850, 0); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0B8DC.s") + D_86B10850.unk_000.unk_02 &= ~0x20; + D_86B10850.unk_000.unk_01 &= ~1; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/17/fragment17_16A0E0/func_86B0BA18.s") + func_8000E88C(&D_86B10850.unk_024, 0.0f, 11.0f, -105.0f); +} + +s32 func_86B0BA18(void) { + unk_func_80007444* sp24; + + main_pool_push_state('GBOY'); + + func_80005E40(0x10000, 0); + sp24 = func_80007444(0, 1, 3, 1, 2, 1); + func_8001E94C(2, 0); + + ASSET_LOAD(D_1000000, common_menu1_ui, 0); + ASSET_LOAD(D_2000000, common_menu2_ui, 0); + FRAGMENT_LOAD(fragment31); + + func_8002D510(); + D_86B10840 = func_8002D5AC(0x1E); + + if (D_800AE540.unk_0000 == 0x16) { + D_86B109BC = ASSET_LOAD2(backgrounds, 1, 1); + D_86B109C0 = func_8000484C(D_86B109BC, 0x12); + } else { + D_86B109BC = ASSET_LOAD2(backgrounds, 1, 1); + D_86B109C0 = func_8000484C(D_86B109BC, 0x13); + } + + func_86B0B8DC(); + func_80007678(sp24); + func_86B0B810(); + func_800076C0(); + func_8001E9CC(); + func_80005EAC(); + + main_pool_pop_state('GBOY'); + + return 0; +} diff --git a/src/fragments/2/fragment2.c b/src/fragments/2/fragment2.c index 4805d4c9..b740607a 100644 --- a/src/fragments/2/fragment2.c +++ b/src/fragments/2/fragment2.c @@ -20,7 +20,7 @@ extern u32 D_87806730[]; char** D_87806330 = NULL; static s32 D_8780FA20; -static s32 D_8780FA24; +static char** D_8780FA24; u16 D_8780FA28; s16 D_8780FA2A; s16 D_8780FA2C; diff --git a/src/fragments/3/fragment3.h b/src/fragments/3/fragment3.h index 429808cb..06c33fe8 100644 --- a/src/fragments/3/fragment3.h +++ b/src/fragments/3/fragment3.h @@ -264,6 +264,13 @@ void func_87903358(s16 arg0, s16 arg1); void func_879033FC(unk_func_8790002C* arg0); void func_8790354C(void); - +void func_87903600(void); +void func_879036B4(unk_func_8790002C* arg0); +void func_8790370C(void); +void func_879037D0(f32 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s16 arg5, s16 arg6); +void func_87903838(f32 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s16 arg5, s16 arg6); +void func_879038AC(f32 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s16 arg5, s16 arg6); +Gfx* func_87903920(Gfx* arg0, arg1_func_87903D64_014* arg1); +void func_87903D64(s32 arg0, arg1_func_87903D64* arg1); #endif // _FRAGMENT3_H_ diff --git a/src/fragments/36/fragment36.c b/src/fragments/36/fragment36.c index fe51bf86..249cccb4 100644 --- a/src/fragments/36/fragment36.c +++ b/src/fragments/36/fragment36.c @@ -16,7 +16,7 @@ #include "src/memory.h" #include "src/stage_loader.h" -static s32 D_82100EA0; +static char** D_82100EA0; static s32 pad_D_82100EA4; static unk_func_80027FA0 D_82100EA8; static BinArchive* D_82100EB0; diff --git a/src/fragments/37/fragment37.c b/src/fragments/37/fragment37.c index abfc668b..47890b91 100644 --- a/src/fragments/37/fragment37.c +++ b/src/fragments/37/fragment37.c @@ -78,7 +78,7 @@ static unk_D_82202FE4 D_82202FE4[9] = { static u8* D_82203064[] = { 0x03005000, 0x03005A20, 0x03006440, 0x03005A20 }; -static s32 D_822030F0; +static char** D_822030F0; static BinArchive* D_822030F4; static Vp D_822030F8; static Mtx D_82203108; diff --git a/src/geo_layout.c b/src/geo_layout.c index c3343878..780a287c 100644 --- a/src/geo_layout.c +++ b/src/geo_layout.c @@ -8,7 +8,7 @@ extern GeoLayoutCommandProc GeoLayoutJumpTable[]; extern MemoryBlock* gGraphNodePool; extern unk_D_86002F34* gCurRootGraphNode; extern u32 gGeoLayoutStack[]; -extern struct GraphNode *gCurGraphNodeList[32]; +extern struct GraphNode* gCurGraphNodeList[32]; extern s16 gCurGraphNodeIndex; extern s16 gGeoLayoutStackIndex; extern s16 gGeoLayoutReturnIndex; @@ -20,7 +20,7 @@ extern u8* gGeoLayoutCommand; */ void geo_layout_cmd_branch_and_link(void) { u8* cmd = (void*)gGeoLayoutCommand; - + cmd += 0; gGeoLayoutStack[gGeoLayoutStackIndex++] = (uintptr_t)(cmd + CMD_PROCESS_OFFSET(8)); @@ -34,7 +34,7 @@ void geo_layout_cmd_end(void) { gGeoLayoutStackIndex = gGeoLayoutReturnIndex; gGeoLayoutReturnIndex = gGeoLayoutStack[--gGeoLayoutStackIndex] & 0xFFFF; gCurGraphNodeIndex = gGeoLayoutStack[gGeoLayoutStackIndex] >> 16; - gGeoLayoutCommand = (u8 *) gGeoLayoutStack[--gGeoLayoutStackIndex]; + gGeoLayoutCommand = (u8*)gGeoLayoutStack[--gGeoLayoutStackIndex]; } /* @@ -43,7 +43,7 @@ void geo_layout_cmd_end(void) { */ void geo_layout_cmd_jump(void) { u8* cmd = (void*)gGeoLayoutCommand; - + cmd += 0; gGeoLayoutCommand = Util_ConvertAddrToVirtAddr(cur_geo_cmd_ptr(0x04)); @@ -55,7 +55,7 @@ void geo_layout_cmd_jump(void) { */ void geo_layout_cmd_branch(void) { u8* cmd = (void*)gGeoLayoutCommand; - + cmd += 0; // unlike in sm64, this argument doesnt seem to be optional. @@ -65,7 +65,7 @@ void geo_layout_cmd_branch(void) { // 0x04: Return from branch void geo_layout_cmd_return(void) { - gGeoLayoutCommand = (u8 *) gGeoLayoutStack[--gGeoLayoutStackIndex]; + gGeoLayoutCommand = (u8*)gGeoLayoutStack[--gGeoLayoutStackIndex]; } // 0x05: Open node @@ -81,7 +81,7 @@ void geo_layout_cmd_close_node(void) { gGeoLayoutCommand += 0x04 << CMD_SIZE_SHIFT; } -void func_80017AC4(struct GraphNode *arg0) { +void func_80017AC4(struct GraphNode* arg0) { if (arg0 != NULL) { gCurGraphNodeList[gCurGraphNodeIndex] = arg0; if (gCurGraphNodeIndex == 0) { @@ -128,7 +128,8 @@ void func_80017BFC(void) { void func_80017C48(void) { unk_D_800ABE00_cmdB* cmd = (unk_D_800ABE00_cmdB*)gGeoLayoutCommand; - unk_D_86002F34_00C* temp_v0 = func_800110E0(gGraphNodePool, NULL, cmd->unk_04, cmd->unk_06, cmd->unk_08, cmd->unk_0A); + unk_D_86002F34_00C* temp_v0 = + func_800110E0(gGraphNodePool, NULL, cmd->unk_04, cmd->unk_06, cmd->unk_08, cmd->unk_0A); if (temp_v0 != NULL) { temp_v0->unk_24.fovy = cmd->unk_02; @@ -223,8 +224,8 @@ void func_800180D4(void) { void func_8001812C(void) { unk_D_800ABE00_cmd17* cmd = (unk_D_800ABE00_cmd17*)gGeoLayoutCommand; - func_80017AC4( - func_8001156C(gGraphNodePool, NULL, cmd->unk_02, cmd->unk_08, cmd->unk_04, cmd->unk_0C, cmd->unk_06, cmd->unk_10)); + func_80017AC4(func_8001156C(gGraphNodePool, NULL, cmd->unk_02, cmd->unk_08, cmd->unk_04, cmd->unk_0C, cmd->unk_06, + cmd->unk_10)); gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd17); } @@ -295,7 +296,8 @@ void func_80018490(void) { var_a3 |= 2; } - func_80017AC4(func_80011814(gGraphNodePool, NULL, cmd->unk_01, var_a3, cmd->unk_03, &cmd->unk_04, &cmd->unk_0A, &sp3C)); + func_80017AC4( + func_80011814(gGraphNodePool, NULL, cmd->unk_01, var_a3, cmd->unk_03, &cmd->unk_04, &cmd->unk_0A, &sp3C)); gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd1D); } @@ -398,7 +400,7 @@ void func_80018AD0(void) { gGeoLayoutCommand += sizeof(unk_D_800ABE00_cmd26); } -struct GraphNode *process_geo_layout(MemoryBlock* pool, void *segptr) { +struct GraphNode* process_geo_layout(MemoryBlock* pool, void* segptr) { // set by register_scene_graph_node when gCurGraphNodeIndex is 0 // and gCurRootGraphNode is NULL gCurRootGraphNode = NULL; diff --git a/src/geo_layout.h b/src/geo_layout.h index e0aec3e1..cf29b7cb 100644 --- a/src/geo_layout.h +++ b/src/geo_layout.h @@ -27,31 +27,32 @@ #define cur_geo_cmd_ptr(offset) \ (*(void **) &gGeoLayoutCommand[CMD_PROCESS_OFFSET(offset)]) - typedef void (*GeoLayoutCommandProc)(void); typedef struct unk_D_800ABE00_cmd0 { /* 0x00 */ u8 cmd; /* 0x02 */ u16 unk_02; - /* 0x04 */ s32 unk_04; + /* 0x04 */ u8* unk_04; } unk_D_800ABE00_cmd0; // size = 0x8 typedef struct unk_D_800ABE00_cmd1 { /* 0x00 */ u8 cmd; + /* 0x01 */ char pad[3]; } unk_D_800ABE00_cmd1; // size = 0x4 typedef struct unk_D_800ABE00_cmd2 { /* 0x00 */ u8 cmd; - /* 0x04 */ u32 unk_04; + /* 0x04 */ u8* unk_04; } unk_D_800ABE00_cmd2; // size = 0x8 typedef struct unk_D_800ABE00_cmd3 { /* 0x00 */ u8 cmd; - /* 0x04 */ u32 unk_04; + /* 0x04 */ u8* unk_04; } unk_D_800ABE00_cmd3; // size = 0x8 typedef struct unk_D_800ABE00_cmd4 { /* 0x00 */ u8 cmd; + /* 0x01 */ char pad[3]; } unk_D_800ABE00_cmd4; // size = 0x4 typedef struct unk_D_800ABE00_cmd5 { @@ -130,6 +131,11 @@ typedef struct unk_D_800ABE00_cmd11 { /* 0x01 */ char pad[3]; } unk_D_800ABE00_cmd11; // size = 0x4 +typedef struct unk_D_800ABE00_cmd12 { + /* 0x00 */ u8 cmd; + /* 0x01 */ char pad[3]; +} unk_D_800ABE00_cmd12; // size = 0x4 + typedef struct unk_D_800ABE00_cmd13 { /* 0x00 */ u8 cmd; /* 0x01 */ u8 r; @@ -141,7 +147,7 @@ typedef struct unk_D_800ABE00_cmd13 { typedef struct unk_D_800ABE00_cmd14 { /* 0x00 */ u8 cmd; - /* 0x01 */ char unk01[0x3]; + /* 0x01 */ char pad[0x3]; /* 0x04 */ s16 unk_04; /* 0x06 */ s16 unk_06; /* 0x08 */ u8 r; @@ -152,7 +158,7 @@ typedef struct unk_D_800ABE00_cmd14 { typedef struct unk_D_800ABE00_cmd15 { /* 0x00 */ u8 cmd; - /* 0x01 */ char unk01[0xB]; + /* 0x01 */ char pad[0xB]; } unk_D_800ABE00_cmd15; // size = 0xC typedef struct unk_D_800ABE00_cmd16 { @@ -182,7 +188,7 @@ typedef struct unk_D_800ABE00_cmd18 { typedef struct unk_D_800ABE00_cmd19 { /* 0x00 */ u8 cmd; - /* 0x01 */ char unk01[0x3]; + /* 0x01 */ char pad[0x3]; /* 0x04 */ s16 unk_04; /* 0x06 */ s16 unk_06; } unk_D_800ABE00_cmd19; // size = 0x8 @@ -195,7 +201,7 @@ typedef struct unk_D_800ABE00_cmd1A { typedef struct unk_D_800ABE00_cmd1B { /* 0x00 */ u8 cmd; - /* 0x01 */ char unk01[0x3]; + /* 0x01 */ char pad[0x3]; /* 0x04 */ s16 unk_04; /* 0x06 */ s16 unk_06; /* 0x08 */ s16 unk_08; @@ -204,7 +210,7 @@ typedef struct unk_D_800ABE00_cmd1B { typedef struct unk_D_800ABE00_cmd1C { /* 0x00 */ u8 cmd; - /* 0x01 */ char unk01[0x3]; + /* 0x01 */ char pad[0x3]; /* 0x04 */ u32 unk_04; /* 0x08 */ u32 unk_08; /* 0x0C */ u32 unk_0C; @@ -245,7 +251,7 @@ typedef struct unk_D_800ABE00_cmd1F { typedef struct unk_D_800ABE00_cmd20 { /* 0x00 */ u8 cmd; /* 0x01 */ u8 unk_01; - /* 0x02 */ char unk02[0x2]; + /* 0x02 */ s16 unk_02; /* 0x04 */ s16 unk_04; /* 0x06 */ s16 unk_06; /* 0x08 */ s16 unk_08; @@ -271,7 +277,7 @@ typedef struct unk_D_800ABE00_cmd23 { /* 0x00 */ u8 cmd; /* 0x01 */ u8 unk_01; /* 0x02 */ s16 unk_02; - /* 0x04 */ s32 unk_04; + /* 0x04 */ Gfx* unk_04; /* 0x07 */ s16 unk_08; /* 0x0A */ s16 unk_0A; /* 0x0C */ u8 r; diff --git a/src/memory.h b/src/memory.h index 9888efca..404891d6 100644 --- a/src/memory.h +++ b/src/memory.h @@ -7,6 +7,8 @@ #define MEMORY_POOL_LEFT 0 #define MEMORY_POOL_RIGHT 1 +struct MainPoolBlock; + typedef void (*AllocateFunc)(struct MainPoolBlock*, u32); typedef struct MainPoolBlock { diff --git a/tools/animation_script.py b/tools/animation_script.py new file mode 100755 index 00000000..ffcd6eaf --- /dev/null +++ b/tools/animation_script.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python3 + +import sys +from pathlib import Path +from struct import * +import data2c +import find_sym + +COMMANDS = {} + +NUM_COMMANDS = 38 + +for i in range(NUM_COMMANDS): + struct_name = f"unk_D_800ABE00_cmd{i:X}" + struct = data2c.STRUCTS[struct_name] + + COMMANDS[i] = {"name":struct_name, "size":struct["size"], "args":struct["data"]} + +with open(Path(sys.argv[0]).absolute().parent / "../linker_scripts/us/symbol_addrs_code.txt", "r") as f: + fd = f.read().splitlines() + +FUNCS = {} +for line in fd: + name, addr = line.split(";",1)[0].split(" = ") + name = name.strip() + addr = int(addr.strip(), 16) + FUNCS[addr] = name + +def dump(offset): + OUT_FUNCS = {8:set()} + OUT_DATA = {} + DONE_DECOMP = set() + TO_DECOMP = [] + + def get_type(f, offset, cmd, args, out): + for arg in args: + if "pad" in arg["name"]: + continue + + #print() + #print(arg) + f.seek(offset + arg["offset"], 0) + + if arg["type"] in data2c.STRUCTS: + out = get_type(f, offset + arg["offset"], cmd, data2c.STRUCTS[arg["type"]]["data"], out) + else: + is_signed = arg["type"] in data2c.SIGNED + is_float = arg["type"] in data2c.FLOAT + make_hex = "*" in arg["type"] or arg["type"] == "ptr" + + type = "ptr" if "*" in arg["type"] else arg["type"] + match data2c.BASE_TYPES[type]: + case 1: + v = unpack(">b" if is_signed else ">B", f.read(1))[0] + out += f"{v}, " + + case 2: + v = unpack_from(">h" if is_signed else ">H", f.read(2))[0] + out += f"{v}, " + + case 4: + v = unpack_from(">f" if is_float else ">i" if is_signed else ">I", f.read(4))[0] + + if (cmd == 0x00 or cmd == 0x03) and arg["name"] == "unk_04": + TO_DECOMP.append(find_sym.find(f"0x{v:X}", "v")["rom"]) + out += f"D_{v:08X}" + ", " + + elif "*" in arg["type"]: + if v != 0: + OUT_DATA[v] = arg["type"].replace("*","") + out += f"D_{v:08X}" + ", " + else: + out += f"NULL" + ", " + + elif make_hex: + if v == 0: + out += f"NULL" + ", " + elif v in FUNCS: + out += f"{FUNCS[v]}" + ", " + OUT_FUNCS[cmd].add(FUNCS[v]) + else: + out += f"0x{v:08X}" + ", " + else: + out += f"{v}" + ("f" if is_float else "") + ", " + + case 8: + v = unpack_from(">d" if is_float else ">q" if is_signed else ">Q", f.read(8))[0] + out += f"{v}" + ", " + + case _: + print(f"Unhandled size type for arg") + print(f"{arg}") + exit() + return out + + offset = int(offset, 16) + + TO_DECOMP.append(offset) + TO_OUTPUT = [] + + with open(Path(sys.argv[0]).absolute().parent / "../baseroms/us/baserom.z64", "rb") as f: + while len(TO_DECOMP) > 0: + offset = TO_DECOMP.pop() + if offset in DONE_DECOMP: + continue + DONE_DECOMP.add(offset) + + out_info = find_sym.find(offset) + + #print(f"Processing script at 0x{offset:X}") + + f.seek(offset, 0) + + out = f"" + while True: + cmd = unpack_from(">B", f.read(1), 0)[0] + #print(f"depth {DEPTH} offset 0x{offset:X} cmd 0x{cmd:02X} size 0x{COMMANDS[cmd]['size']:X}") + #print(f"command 0x{cmd:X} --", COMMANDS[cmd]) + + out += f" ANIMATION_SCRIPT_CMD_{cmd:02X}" + out += "(" + out = get_type(f, offset, cmd, COMMANDS[cmd]["args"][1:], out) + if out[-2:] == ", ": + out = out[:-2] + out += "),\n" + + if cmd == 0x01: + break; + + offset += COMMANDS[cmd]["size"] + f.seek(offset, 0) + + out = out[:-1] + + #print() + out_struct = f"static u32 D_{out_info['ram']:X}[] = " + "{\n" + TO_OUTPUT.append([out_struct, out + "\n};\n"]) + + for cmd in OUT_FUNCS: + funcs = sorted(list(OUT_FUNCS[cmd])) + for func in funcs: + match cmd: + case 0x08: + print(f"s32 {func}(s32, unk_D_86002F34_000*);") + + case _: + print(f"Unhandled output function type cmd {cmd}") + exit() + + if len(OUT_FUNCS) > 0: + print() + + for v, type in sorted(list(OUT_DATA.items()), key=lambda x:x[0]): + match type: + case "Gfx": + print(f"Gfx D_{v:08X}[];") + + case "Vtx": + print(f"Vtx D_{v:08X}[];") + + case _: + print(f"{type}* D_{v:08X};") + + print() + [print(x[0] + x[1]) for x in sorted(TO_OUTPUT, key=lambda x: x[0])] + +if __name__ == "__main__": + dump(sys.argv[1]) + diff --git a/tools/data2c.py b/tools/data2c.py index e0b9d107..df6cf120 100755 --- a/tools/data2c.py +++ b/tools/data2c.py @@ -46,6 +46,11 @@ "short", "int", + + "f32", + "f64", + "float", + "double", } FLOAT = { @@ -126,6 +131,7 @@ def calc_size(name, data): i += 1 + max_size = round_up(max_size, max_rounding) STRUCTS[name]["size"] = max_size STRUCTS[name]["round"] = max_rounding @@ -527,46 +533,64 @@ def dump_data(offset, struct, counts): def output_struct(data, name, out, offset, indent): def round_up(offset, rounding): return offset + (-offset % rounding) + def output_type(type, size, offset, out): + is_signed = type in SIGNED + is_float = type in FLOAT + make_hex = "*" in type or type not in SIGNED + + match size: + case 1: + v = unpack_from(">b" if is_signed else ">B", data, offset)[0] + if make_hex: + out += f"0x{v:02X}" + ", " + else: + out += f"{v}, " - out += indent + "{ " - - for member in STRUCTS[name]["data"]: - if member["type"] in STRUCTS: - out = output_struct(data, member["type"], out, offset + member["offset"], indent) - else: - #print(member) + case 2: + v = unpack_from(">h" if is_signed else ">H", data, offset)[0] + if make_hex: + out += f"0x{v:04X}" + ", " + else: + out += f"{v}, " - is_signed = member["type"] in SIGNED - is_float = member["type"] in FLOAT - read_offset = offset + member["offset"] - make_hex = "*" in member["type"] + case 4: + v = unpack_from(">f" if is_float else ">i" if is_signed else ">I", data, offset)[0] + if make_hex: + if v == 0: + out += f"NULL" + ", " + else: + out += f"0x{v:08X}" + ", " + else: + out += f"{v}" + ("f" if is_float else "") + ", " - match member["size"]: - case 1: - v = unpack_from(">b" if is_signed else ">B", data, read_offset)[0] + case 8: + v = unpack_from(">d" if is_float else ">q" if is_signed else ">Q", data, offset)[0] + if make_hex: + out += f"0x{v:16X}" + ", " + else: out += f"{v}, " - case 2: - v = unpack_from(">h" if is_signed else ">H", data, read_offset)[0] - out += f"{v}, " + return out - case 4: - v = unpack_from(">f" if is_float else ">i" if is_signed else ">I", data, read_offset)[0] - if make_hex: - if v == 0: - out += f"NULL" + ", " - else: - out += f"0x{v:08X}" + ", " - else: - out += f"{v}" + ("f" if is_float else "") + ", " - case 8: - v = unpack_from(">d" if is_float else ">q" if is_signed else ">Q", data, read_offset)[0] - out += f"{v}" + ", " + if name in STRUCTS: + out += indent + "{ " + + #print(STRUCTS[name]) + for member in STRUCTS[name]["data"]: + if member["type"] in STRUCTS: + out = output_struct(data, member["type"], out, offset + member["offset"], indent) + else: + #print(member) + out = output_type(member["type"], member["size"], offset + member["offset"], out) + + if len(STRUCTS[name]["data"]) <= 4: + out = out[:-2] + out += indent + "}, " + + else: + out = output_type(name, BASE_TYPES[name], offset, out) - if len(STRUCTS[name]["data"]) <= 4: - out = out[:-2] - out += indent + "}, " return out def output_array(data, name, counts, depth, out, offset): @@ -585,18 +609,18 @@ def output_array(data, name, counts, depth, out, offset): out += indent + "\n}," else: out = output_struct(data, name, out, offset, (depth + 1) * " ") - offset += STRUCTS[name]["size"] + offset += STRUCTS[name]["size"] if name in STRUCTS else BASE_TYPES[name] else: out = output_struct(data, name, out, offset, "") return out, offset - total_size = STRUCTS[struct]["size"] + total_size = STRUCTS[struct]["size"] if struct in STRUCTS else BASE_TYPES[struct] total_count = 1 for count in counts: total_count *= count - total_size = STRUCTS[struct]["size"] * total_count + total_size *= total_count #print(f"size 0x{STRUCTS[struct]['size']:X} x {total_count} = 0x{total_size:X}") @@ -607,31 +631,32 @@ def output_array(data, name, counts, depth, out, offset): out = "{" if len(counts) > 0 else "" out, _ = output_array(data, struct, counts, 0, out, 0) - out = out + "};" if len(counts) > 0 else (out[:-2] + ";") + out = out + "};" if (len(counts) > 0 and struct in STRUCTS) else (out[:-2] + "};") print(out) - ####################################################################### parse_structs() calc_struct_sizes() - #print(f"{len(STRUCTS)} structs parsed in") -offset = int(sys.argv[1], 16) -struct = sys.argv[2] +def dump(offset, type_name): + offset = int(offset, 16) + + counts = [] + while "[" in type_name: + count = type_name.split("[",1)[1].split("]",1)[0] + type_name = type_name.split("[",1)[0] + type_name.split("]",1)[1] + count = int(count, 0) + counts.append(count) -counts = [] -while "[" in struct: - count = struct.split("[",1)[1].split("]",1)[0] - struct = struct.split("[",1)[0] + struct.split("]",1)[1] - count = int(count, 0) - counts.append(count) + if type_name not in STRUCTS and type_name not in BASE_TYPES: + print(f"Could not find type definition \"{type_name}\", maybe it failed to parse...") + exit() -if struct not in STRUCTS: - print(f"Could not find struct definition \"{struct}\", maybe it failed to parse...") - exit() + dump_data(offset, type_name, counts) -dump_data(offset, struct, counts) +if __name__ == "__main__": + dump(sys.argv[1], sys.argv[2]) diff --git a/tools/find_sym.py b/tools/find_sym.py index 1b8213d4..1a74e913 100755 --- a/tools/find_sym.py +++ b/tools/find_sym.py @@ -5,61 +5,85 @@ import yaml import sys -addr = sys.argv[1] -if "D_" in sys.argv[1]: - addr = "0x" + sys.argv[1][2:] -addr = int(addr, 0) -is_vram = addr >= 0x10000000 -if len(sys.argv) > 2 and sys.argv[2] == "v": - is_vram = True -elif len(sys.argv) > 2 and sys.argv[2] == "p": - is_vram = False - -with open("yamls/us/rom.yaml", "r") as f: - splat = yaml.load(f.read(), Loader=yaml.SafeLoader) - -min_seg = None -min_subseg = 99999 -min_diff = 0xFFFFFFFF - -for segment in splat: - if type(segment) == dict and "subsegments" in segment: - for i,subseg in enumerate(segment["subsegments"]): - if type(subseg) == list: - if is_vram: - rom_to_vram = (subseg[0] - segment["start"]) + segment["vram"] - diff = addr - rom_to_vram +def find(addr, opt=""): + if type(addr) == str: + if "D_" in addr: + addr = "0x" + addr[2:] + addr = int(addr, 0) + + is_vram = addr >= 0x10000000 + if opt == "v": + is_vram = True + elif opt == "p": + is_vram = False + + with open("yamls/us/rom.yaml", "r") as f: + splat = yaml.load(f.read(), Loader=yaml.SafeLoader) + + min_seg = None + min_subseg = 99999 + min_diff = 0xFFFFFFFF + + for segment in splat: + if type(segment) == dict and "subsegments" in segment: + for i,subseg in enumerate(segment["subsegments"]): + if type(subseg) == list: + if is_vram: + rom_to_vram = (subseg[0] - segment["start"]) + segment["vram"] + diff = addr - rom_to_vram + else: + diff = addr - subseg[0] + elif "bss" in subseg["type"]: + if is_vram: + diff = addr - subseg["vram"] + #print(f"vram diff to {subseg['name']} 0x{diff}") else: - diff = addr - subseg[0] - elif "bss" in subseg["type"]: - if is_vram: - diff = addr - segment["vram"] - else: - #print(f"Unknown subsegment {subseg}") - pass - - if diff >= 0 and diff < min_diff: - min_seg = segment - min_subseg = i - min_diff = diff - -if min_seg: - seg_type = min_seg['subsegments'][min_subseg][1] - - if len(min_seg['subsegments'][min_subseg]) < 3: - name = min_seg['subsegments'][min_subseg][1] - has_rom = not ("bss" in seg_type) + #print(f"Unknown subsegment {subseg}") + pass + + if diff >= 0 and diff < min_diff: + #print(f"Setting min seg to {segment['name']}") + min_seg = segment + min_subseg = i + min_diff = diff + + if min_seg: + is_dict = type(min_seg['subsegments'][min_subseg]) == dict + addr_idx = "vram" if is_dict else 0 + type_idx = "type" if is_dict else 1 + name_idx = "name" if is_dict else 2 + + seg_type = min_seg['subsegments'][min_subseg][type_idx] + + if len(min_seg['subsegments'][min_subseg]) < 3: + name = min_seg['subsegments'][min_subseg][type_idx] + has_rom = not ("bss" in seg_type) + else: + name = min_seg['subsegments'][min_subseg][name_idx] + has_rom = not ("reloc" in min_seg['subsegments'][min_subseg][name_idx] or "bss" in seg_type) + + rom = 0x0 + if has_rom: + rom = min_seg['subsegments'][min_subseg][addr_idx] + min_diff + + rom_diff = (min_seg['subsegments'][min_subseg][addr_idx] + min_diff) - min_seg['start'] + ram = min_seg['vram'] + rom_diff + + return {"found":True, "rom":rom, "ram":ram, "min_diff":min_diff, "name": name} else: - name = min_seg['subsegments'][min_subseg][2] - has_rom = not ("reloc" in min_seg['subsegments'][min_subseg][2] or "bss" in seg_type) + return {"found":False} + +if __name__ == "__main__": + opt = sys.argv[2] if len(sys.argv) > 2 else "" + ret = find(sys.argv[1], opt) - rom_str = "(No rom address)" - if has_rom: - rom_str = f"ROM: 0x{min_seg['subsegments'][min_subseg][0] + min_diff:X}" + if ret["found"]: + rom_str = "(No rom address)" + if ret["rom"] != 0x0: + rom_str = f"ROM: 0x{ret['rom']:X}" - rom_diff = (min_seg['subsegments'][min_subseg][0] + min_diff) - min_seg['start'] - ram_str = f"RAM: 0x{min_seg['vram'] + rom_diff:X}" + ram_str = f"RAM: 0x{ret['ram']:X}" - print(f"({rom_str} {ram_str}) is 0x{min_diff:X} bytes inside {name} ") -else: - print(f"Could not find 0x{addr:08X}") + print(f"({rom_str} {ram_str}) is 0x{ret['min_diff']:X} bytes inside {ret['name']} ") + else: + print(f"Could not find {sys.argv[1]}") diff --git a/utils/m2ctx.py b/utils/m2ctx.py deleted file mode 100755 index e7d93b3b..00000000 --- a/utils/m2ctx.py +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env python3 -import argparse -import os -import shutil -import sys -import subprocess -from pathlib import Path - -# Project-specific -# assuming that this is in tools -SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) -ROOT_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "..")) -CPP_FLAGS = [ - "-undef", - "-D__sgi", - "-D_LANGUAGE_C", - "-DF3DEX_GBI_2", - "-DNDEBUG", - "-D_MIPS_SZLONG=32", - "-DSCRIPT(...)={}" - "-D__attribute__(...)=", - "-D__asm__(...)=", - "-DGLOBAL_ASM(...)=", - "-ffreestanding", - "-nostdinc", - "-Iinclude", - "-Iinclude/PR", - "-Iinclude/audio", - "-Isrc" -] - -def import_c_file(in_file) -> str: - in_file = os.path.relpath(in_file, ROOT_DIR) - # Prefer clang as C preprocessor if installed on the system - if shutil.which('clang') is not None: - cpp = ['clang', '-E', '-P', '-x', 'c', '-Wno-trigraphs'] - else: - cpp = ['gcc', '-E', '-P'] - - cpp_getdefines = [*cpp, "-dM", *CPP_FLAGS, in_file] - cpp_procfile = [*cpp, *CPP_FLAGS, in_file] - - out_text = "" - try: - out_text += subprocess.check_output(cpp_getdefines, cwd=ROOT_DIR, encoding="utf-8") - out_text += subprocess.check_output(cpp_procfile, cwd=ROOT_DIR, encoding="utf-8") - except subprocess.CalledProcessError: - print( - "Failed to preprocess input file, when running command:\n", - cpp_getdefines, - file=sys.stderr, - ) - sys.exit(1) - - if not out_text: - print("Output is empty - aborting") - sys.exit(1) - return out_text - -def main(): - parser = argparse.ArgumentParser( - description="Create a context file which can be used for m2c" - ) - parser.add_argument( - "c_file", - help="File from which to create context", - ) - parser.add_argument( - "ctx_file", - nargs='?', - help="save context to file if present, otherwise print to stdout" - ) - args = parser.parse_args() - - output = import_c_file(args.c_file) - - if args.ctx_file is not None: - with open(os.path.join(ROOT_DIR, args.ctx_file), "w", encoding="UTF-8") as f: - f.write(output) - else: - print(output) - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/yamls/us/rom.yaml b/yamls/us/rom.yaml index f8071021..5965ea77 100644 --- a/yamls/us/rom.yaml +++ b/yamls/us/rom.yaml @@ -992,14 +992,27 @@ - [0x169510, c, fragments/17/fragment17_169510] - [0x169A40, c, fragments/17/fragment17_169A40] - [0x16A0E0, c, fragments/17/fragment17_16A0E0] - - [0x16B580, data, fragments/17/fragment17_data] - - [0x16DD70, rodata, fragments/17/fragment17_rodata_16DD70] - - [0x16DDA0, rodata, fragments/17/fragment17_rodata_16DDA0] - - [0x16DDF0, rodata, fragments/17/fragment17_rodata_16DDF0] - - [0x16DEA0, rodata, fragments/17/fragment17_rodata_16DEA0] - - [0x16DF30, rodata, fragments/17/fragment17_rodata_16DF30] - - - {vram: 0x86B0E5D0, type: bss, name: fragments/17/fragment17_bss} + - [0x16B580, .data, fragments/17/fragment17_15FA60] + - [0x16B6E0, .data, fragments/17/fragment17_161590] + - [0x16B6F0, .data, fragments/17/fragment17_161E60] + - [0x16D670, .data, fragments/17/fragment17_165640] + - [0x16D950, .data, fragments/17/fragment17_168110] + - [0x16D960, .data, fragments/17/fragment17_1687E0] + - [0x16DBE0, .data, fragments/17/fragment17_169A40] + - [0x16DC40, .data, fragments/17/fragment17_16A0E0] + + - [0x16DD70, .rodata, fragments/17/fragment17_15F9B0] + - [0x16DDA0, .rodata, fragments/17/fragment17_15FA60] + - [0x16DDF0, .rodata, fragments/17/fragment17_161E60] + - [0x16DEA0, .rodata, fragments/17/fragment17_165640] + - [0x16DF30, .rodata, fragments/17/fragment17_16A0E0] + + - {vram: 0x86B0E5D0, type: .bss, name: fragments/17/fragment17_15FA60} + - {vram: 0x86B0EBC0, type: .bss, name: fragments/17/fragment17_161E60} + - {vram: 0x86B0F9D0, type: .bss, name: fragments/17/fragment17_165640} + - {vram: 0x86B106A0, type: .bss, name: fragments/17/fragment17_1687E0} + - {vram: 0x86B106B0, type: .bss, name: fragments/17/fragment17_169A40} + - {vram: 0x86B10840, type: .bss, name: fragments/17/fragment17_16A0E0} - name: fragment17_relocs type: code