diff --git a/.vscode/settings.json b/.vscode/settings.json index bd9dc9ac..3546560a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -31,6 +31,7 @@ "controller.h": "c", "os_version.h": "c", "stdbool.h": "c", - "variables.h": "c" + "variables.h": "c", + "random": "c" }, } \ No newline at end of file diff --git a/include/functions.h b/include/functions.h index 7ae1cf1a..638d1c33 100644 --- a/include/functions.h +++ b/include/functions.h @@ -140,11 +140,14 @@ void func_800A5D6C(void); void func_800B8DD0(Gfx**, s16); void func_800BA490(void); void func_800BA4F0(void); +s32 func_800BA7BC(s32, s32); void func_800BA808(u16*, s32); void func_800BB5D0(void); void func_800BC4B0(void); void func_800B6F50(f32, f32, f32, f32, f32, f32); void func_800B9358(void); +s32 func_800C2890(u16*); +s32 func_800C2F30(s32, s32); void func_801988E0(void); diff --git a/include/variables.h b/include/variables.h index 5fa65d18..febbf951 100644 --- a/include/variables.h +++ b/include/variables.h @@ -41,7 +41,26 @@ extern OSMesgQueue* D_800C7C64; extern char D_800C7C80[]; +extern Gfx D_800D31F8[]; +extern Gfx D_800D3240[]; +extern Gfx D_800D3288[]; +extern Gfx D_800D32D0[]; +extern Gfx D_800D33A8[]; +extern Gfx D_800D33F0[]; +extern Gfx D_800D34C8[]; +extern Gfx D_800D3510[]; +extern Gfx D_800D3558[]; +extern Gfx D_800D35A0[]; +extern Gfx D_800D3678[]; +extern Gfx D_800D3BD0[]; +extern Gfx D_800D36C0[]; +extern Gfx D_800D3708[]; +extern Gfx D_800D4050[]; +extern Gfx D_800D4320[]; + extern u16 D_800DD8AA; +extern s32 D_800D4A70; + extern u8 gAudioThreadStack[0x1000]; // 800DDAA0 extern OSThread gGraphicsThread; // 800DEAA0 extern u8 gGraphicsThreadStack[0x1000]; // 800DEC50 @@ -109,6 +128,13 @@ extern u16 D_80137E8A; extern s32 D_80178580; extern s32 *D_80178710; +extern s32 D_80178728; +extern s32 D_8017872C; +extern f32 D_80178730; +extern f32 D_80178734; +extern f32 D_80178738; +extern f32 D_8017873C; +extern f32 D_80178740; extern s32 D_80387800; extern u16 D_8038F080[]; extern u16 D_8038F300[]; @@ -208,6 +234,7 @@ extern s32 D_80177854; extern s32 D_80177898; extern s32 D_801778A0; extern s32 D_801778A8; +extern s32 D_801778B0[]; extern s32 D_801778B8; extern s32 D_801778E8; extern f32 D_80177940; @@ -218,16 +245,23 @@ extern f32 D_80177988; extern f32 D_801779A0; extern f32 D_801779B8; extern f32 D_801779C0; +extern s32 D_801779F8; extern s32 D_80177AE0; extern s32 D_80177AF8; extern u8 D_80177C98; extern f32 D_80177D08; extern f32 D_80177D20; +extern f32 D_80177D50; extern f32 D_80177D68; extern s32 D_80177DA0[]; extern s32 D_80177DB0; +extern s32 D_80178234; extern s32 D_8017829C; extern s32 D_801782A4; +extern s32 D_801782D8; +extern s32 D_801782E8; +extern s32 D_801782F8; +extern u16* D_80178308; extern s32 D_80178320; extern s32 D_80178328; extern s32 D_80178330; diff --git a/src/main/sf_2EFE0.c b/src/main/sf_2EFE0.c index 4823e6a4..eea40e23 100644 --- a/src/main/sf_2EFE0.c +++ b/src/main/sf_2EFE0.c @@ -1,8 +1,15 @@ -#include "common.h" +#include "global.h" #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_2EFE0/func_8002E3E0.s") -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_2EFE0/func_8002E4F8.s") +s32 func_8002E4F8(u16* arg0, s32 arg1) { + if ((D_8017829C == 0) && (D_80178280->unk_1C8 != 0)) { + func_800BA808(arg0, arg1); + return 1; + } else { + return 0; + } +} #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_2EFE0/func_8002E548.s") diff --git a/src/main/sf_B99D0.c b/src/main/sf_B99D0.c index 03da6046..67c17b92 100644 --- a/src/main/sf_B99D0.c +++ b/src/main/sf_B99D0.c @@ -10,43 +10,75 @@ void func_800B8F18(void) { gSPDisplayList(gMasterDisp++, D_800D31B0); } -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B8F48.s") +void func_800B8F48(void) { + gSPDisplayList(gMasterDisp++, D_800D31F8); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B8F78.s") +void func_800B8F78(void) { + gSPDisplayList(gMasterDisp++, D_800D34C8); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B8FA8.s") +void func_800B8FA8(void) { + gSPDisplayList(gMasterDisp++, D_800D3510); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B8FD8.s") +void func_800B8FD8(void) { + gSPDisplayList(gMasterDisp++, D_800D3240); +} #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B9008.s") -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B9120.s") +void func_800B9120(void) { + gSPDisplayList(gMasterDisp++, D_800D32D0); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B9150.s") +void func_800B9150(void) { + gSPDisplayList(gMasterDisp++, D_800D33A8); +} #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B9180.s") -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B9298.s") +void func_800B9298(void) { + gSPDisplayList(gMasterDisp++, D_800D33F0); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B92C8.s") +void func_800B92C8(void) { + gSPDisplayList(gMasterDisp++, D_800D3558); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B92F8.s") +void func_800B92F8(void) { + gSPDisplayList(gMasterDisp++, D_800D35A0); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B9328.s") +void func_800B9328(void) { + gSPDisplayList(gMasterDisp++, D_800D3678); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B9358.s") +void func_800B9358(void) { + gSPDisplayList(gMasterDisp++, D_800D3BD0); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B9388.s") +void func_800B9388(s32 r, s32 g, s32 b, s32 a, s32 nr, s32 fr) { + gSPDisplayList(gMasterDisp++, D_800D4050); + gDPSetFogColor(gMasterDisp++, r, g, b, a); + gSPFogFactor(gMasterDisp++, (0x1F400 / (fr - nr)), (((0x1F4 - nr) * 256) / (fr - nr))); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B94A0.s") +void func_800B94A0(void) { + gSPDisplayList(gMasterDisp++, D_800D4320); +} #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B94D0.s") -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B95E8.s") +void func_800B95E8(void) { + gSPDisplayList(gMasterDisp++, D_800D36C0); +} #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B9618.s") -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B9730.s") +void func_800B9730(void) { + gSPDisplayList(gMasterDisp++, D_800D3708); +} #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_B99D0/func_800B9760.s") diff --git a/src/main/sf_BB360.c b/src/main/sf_BB360.c index 2104ff77..014fa7fc 100644 --- a/src/main/sf_BB360.c +++ b/src/main/sf_BB360.c @@ -1,10 +1,129 @@ -#include "common.h" +#include "global.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_BB360/func_800BA760.s") +void func_800BA760(void) { + func_800B9358(); + if (D_80177D50 == 1.3f) { + D_801782F8 = func_800C2F30(D_80178308, D_801782D8); + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_BB360/func_800BA7BC.s") +s32 func_800BA7BC(s32 arg0, s32 arg1) { + s32 var_v0 = D_800D4A70; -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_BB360/func_800BA808.s") + if (arg1 == var_v0) { + return 0; + } + + if (arg1 < var_v0) { + return 1; + } + + if (var_v0 < arg1) { + D_800D4A70 = arg1; + return 2; + } +} + +void func_800BA808(u16* arg0, s32 arg1) { + s32 var_v1; + s32 temp_v0; + s32 var_a1; + + switch (*arg0) { + default: + case 0x08: + var_a1 = 0; + break; + case 0x09: + var_a1 = 1; + break; + case 0x0a: + var_a1 = 2; + break; + case 0x0b: + var_a1 = 3; + break; + } + + if (D_80177834 == 7) { + if ((arg1 == 10) || (arg1 == 20) || (arg1 == 30)) { + if (arg1 == 10) { + var_v1 = 1; + } + + if (arg1 == 20) { + var_v1 = 2; + } + + if (arg1 == 30) { + var_v1 = 3; + } + + if ((D_801778B0[var_v1] <= 0) && (D_801778B0[var_v1] != -2)) { + return; + } + } + } + + if (D_8017829C != 0) { + temp_v0 = func_800BA7BC(arg0, var_a1); + if (temp_v0 == 1) { + return; + } + } + + D_800D4A70 = var_a1; + D_80177D68 = arg1; + + if ((D_801779F8 != 0) && ((arg1 == 0) || (arg1 == 5))) { + D_80177D68 = 400; + } + + if (D_80178234 == 19) { + switch (arg1) { + case 200: + D_80177D68 = 240; + break; + case 210: + D_80177D68 = 250; + break; + case 220: + D_80177D68 = 260; + break; + case 230: + D_80177D68 = 270; + break; + } + } + + D_80178308 = arg0; + D_8017829C = 100; + + switch (D_80177834) { + case 2: + case 8: + D_8017872C = 176; + D_80178728 = 85; + D_80178730 = 80.0f; + D_80178734 = 174.0f; + D_80178738 = 4.63f; + D_8017873C = 32.0f; + D_80178740 = 174.0f; + break; + case 7: + D_8017872C = 180; + D_80178728 = 79; + D_80178730 = 74.0f; + D_80178734 = 178.0f; + D_80178738 = 4.53f; + D_8017873C = 26.0f; + D_80178740 = 178.0f; + break; + } + + D_801782E8 = func_800C2890(arg0); + func_8001ACDC(D_801782E8); +} #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_BB360/func_800BAAE8.s") diff --git a/src/main/sf_C3430.c b/src/main/sf_C3430.c index c8c629bf..2c144ec5 100644 --- a/src/main/sf_C3430.c +++ b/src/main/sf_C3430.c @@ -1,4 +1,4 @@ -#include "common.h" +#include "global.h" #pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_C3430/func_800C2830.s")