diff --git a/include/global.h b/include/global.h index 6da0e74b..7c089728 100644 --- a/include/global.h +++ b/include/global.h @@ -145,6 +145,19 @@ typedef struct unk_D_86002F58_004_000 { /* 0x0F8 */ char pad0F8[0x70]; } unk_D_86002F58_004_000; // size = 0x168 +typedef struct unk_D_86002F34_000_014_004 { + /* 0x00 */ u8 unk_00[5]; +} unk_D_86002F34_000_014_004; // size = 0x5 + +typedef struct unk_D_86002F34_000_014_010 { + /* 0x00 */ u8 unk_00[4]; +} unk_D_86002F34_000_014_010; // size = 0x4 + +typedef struct unk_D_86002F34_000_014 { + /* 0x00 */ u8* unk_00; + /* 0x04 */ u8* unk_04; +} unk_D_86002F34_000_014; // size >= 0x8 + typedef struct unk_D_86002F34_000 { /* 0x00 */ u8 unk_00; /* 0x01 */ u8 unk_01; @@ -155,7 +168,7 @@ typedef struct unk_D_86002F34_000 { /* 0x08 */ struct unk_D_86002F34_000* unk_08; /* 0x0C */ struct unk_D_86002F34_000* unk_0C; /* 0x10 */ s32 (*unk_10)(s32, struct unk_D_86002F34_000*); - /* 0x14 */ char unk14[0x4]; + /* 0x14 */ unk_D_86002F34_000_014* unk_14; } unk_D_86002F34_000; // size >= 0x18 typedef struct unk_D_86002F34_00C_018 { diff --git a/include/macros.h b/include/macros.h index 3beddba4..374b8593 100644 --- a/include/macros.h +++ b/include/macros.h @@ -48,8 +48,8 @@ #define ROUND_MAX(x) (((x) > 0.0f ? 0.5f : -0.5f) + (x)) -#define ABS(x) ((x) >= 0 ? (x) : -(x)) -#define ABS_ALT(x) ((x) < 0 ? -(x) : (x)) +#define ABS(x) ((x) < 0 ? -(x) : (x)) +#define ABS_ALT(x) ((x) >= 0 ? (x) : -(x)) #define FRAGMENT_ID(fragment) ((((u32)fragment##_TEXT_START & 0x0FF00000) >> 0x14) - 0x10) #define ASSET_ID(asset) (((u32)asset & 0x0F000000) >> 0x18) diff --git a/include/variables.h b/include/variables.h index bcff1609..76b4a4a8 100644 --- a/include/variables.h +++ b/include/variables.h @@ -81,19 +81,6 @@ extern u32 D_B0000D10; extern u8 D_800818E0[0x20]; -typedef struct unk_D_80068BA0 { - /* 0x00 */ char pad00[0x2]; - /* 0x02 */ s16 unk_02; - /* 0x04 */ s16 unk_04; - /* 0x06 */ u16 unk_06; - /* 0x08 */ u16 unk_08; - /* 0x0A */ char pad0A[0x2]; -} unk_D_80068BA0; // size >= 0xC - -extern unk_D_80068BA0* D_80068BA0; -extern unk_D_80068BA0* D_80068BA4; -extern unk_D_80068BA0* D_80068BA8; -extern unk_D_80068BA0* D_80068BAC; extern Gfx D_8006F518[]; extern Gfx D_8006F630[]; extern u8 D_82000000; diff --git a/linker_scripts/us/symbol_addrs.txt b/linker_scripts/us/symbol_addrs.txt index b51b589a..7492ccdd 100644 --- a/linker_scripts/us/symbol_addrs.txt +++ b/linker_scripts/us/symbol_addrs.txt @@ -77,7 +77,6 @@ D_87906048 = 0x87906048; D_87906060 = 0x87906060; D_87906064 = 0x87906064; D_87906068 = 0x87906068; -D_8790606C = 0x8790606C; D_87906070 = 0x87906070; D_87906094 = 0x87906094; D_87906098 = 0x87906098; @@ -296,3 +295,15 @@ D_8006F050 = 0x8006F050; // size:0xC D_8006F05C = 0x8006F05C; // size:0x6 D_8006F064 = 0x8006F064; // size:0xC D_800ABE10 = 0x800ABE10; // size:0xA18 +gPlayer1Controller = 0x80068BA0; +gPlayer2Controller = 0x80068BA4; +gPlayer3Controller = 0x80068BA8; +gPlayer4Controller = 0x80068BAC; +D_8790606C = 0x8790606C; // size:0x6 +D_87906088 = 0x87906088; // size:0xC +D_8790609C = 0x8790609C; // size:0x6 +D_879060AC = 0x879060AC; // size:0x6 +pad_D_879060B4 = 0x879060B4; // size:0x8 +D_879060E0 = 0x879060E0; // size:0xC +D_87906100 = 0x87906100; // size:0xC +D_87906110 = 0x87906110; // size:0xC diff --git a/src/11BA0.h b/src/11BA0.h index 1b83244d..624c9faa 100644 --- a/src/11BA0.h +++ b/src/11BA0.h @@ -9,17 +9,10 @@ typedef struct unk_func_80011B94 { /* 0x18 */ Gfx* unk_18; } unk_func_80011B94; // size = 0x1C -typedef struct unk_D_86404778_190 { - /* 0x00 */ unk_D_86002F58_004_000_000 unk_00; - /* 0x18 */ Gfx* unk_18; - /* 0x1C */ Vec3f unk_1C; - /* 0x28 */ f32 unk_28; -} unk_D_86404778_190; // size = 0x2C - unk_D_86002F58_004_000_000* func_8001103C(MainPoolState*, void*); unk_D_86002F58_004_000* func_80011938(MainPoolState* arg0, unk_D_86002F58_004_000* arg1, s16 arg2, Vec3f* arg3, Vec3s* arg4, Vec3f* arg5); unk_func_80011B94* func_80011B94(MainPoolState*, unk_func_80011B94*, s32, Gfx*); -unk_D_86404778_190* func_80011B10(MainPoolState*, s32, s32, s32, Vec3f*, f32); +unk_D_86002F34_alt9* func_80011B10(MainPoolState*, s32, s32, s32, Vec3f*, f32); void func_80012094(unk_D_86002F58_004_000_000*, unk_D_86002F58_004_000_000*); diff --git a/src/12D80.c b/src/12D80.c index ba1493e0..71acc326 100644 --- a/src/12D80.c +++ b/src/12D80.c @@ -29,7 +29,7 @@ unk_D_86002F34_00C* D_8006F094 = NULL; unk_D_86002F34_alt1* D_8006F098 = NULL; unk_D_86002F58_004_000* D_8006F09C = NULL; unk_D_86002F34_alt11* D_8006F0A0 = NULL; -func_D_8006F0A4 D_8006F0A4[] = { +static func_D_8006F0A4 D_8006F0A4[] = { func_80013330, func_800133D8, func_80013464, func_80013764, func_8001378C, func_8001395C, func_800139E8, func_80013AF8, func_80013B8C, func_80013C14, func_80013C1C, func_80013D34, func_80013F7C, func_80013F84, func_80014124, func_80014D70, func_80014214, func_800142BC, func_80014334, func_80014384, func_800143C0, @@ -37,9 +37,9 @@ func_D_8006F0A4 D_8006F0A4[] = { func_80014D50, NULL, NULL, }; -s32 D_8006F120 = 0; +static s32 D_8006F120 = 0; -u32 D_8006F124[4][9] = { +static u32 D_8006F124[4][9] = { { 0x3024000, 0x3024000, @@ -86,7 +86,7 @@ u32 D_8006F124[4][9] = { }, }; -u8 D_8006F1B4[15][16] = { +static u8 D_8006F1B4[15][16] = { { 0x1F, 0x1F, 0x1F, 3, 7, 7, 7, 3, 0, 0x1F, 4, 0x1F, 0, 7, 6, 7 }, { 1, 0x1F, 3, 0x1F, 7, 7, 7, 1, 0, 0x1F, 4, 0x1F, 0, 7, 6, 7 }, { 1, 3, 8, 3, 7, 7, 3, 7, 0, 0x1F, 4, 0x1F, 0, 7, 6, 7 }, @@ -104,20 +104,20 @@ u8 D_8006F1B4[15][16] = { { 1, 0x1F, 4, 0x1F, 1, 7, 4, 7, 0x1F, 0x1F, 0x1F, 0, 0, 7, 6, 7 }, }; -s16 D_8006F2A4[] = { 16, 8, 4, 2, 0, 0 }; - -s32 D_800AA6C0; -MtxF* D_800AA6C8[8]; -u8 pad_D_800AA6E8[0x1E0]; -unk_D_800AA8C8 D_800AA8C8; -unk_D_800AB970 D_800AB970; -s32 D_800ABB00; -s32 D_800ABB04; -s32 D_800ABB08; -unk_D_800ABB10 D_800ABB10; -unk_D_800ABB28 D_800ABB28[10]; -unk_D_800ABB28* D_800ABCB8; -s32 D_800ABCBC; +static s16 D_8006F2A4[] = { 16, 8, 4, 2, 0, 0 }; + +static s32 D_800AA6C0; +static MtxF* D_800AA6C8[8]; +static u8 pad_D_800AA6E8[0x1E0]; +static unk_D_800AA8C8 D_800AA8C8; +static unk_D_800AB970 D_800AB970; +static s32 D_800ABB00; +static s32 D_800ABB04; +static s32 D_800ABB08; +static unk_D_800ABB10 D_800ABB10; +static unk_D_800ABB28 D_800ABB28[10]; +static unk_D_800ABB28* D_800ABCB8; +static s32 D_800ABCBC; void func_80012180(void) { D_800AA8C8.unk_10A0 = 0; diff --git a/src/12D80.h b/src/12D80.h index 6addc2df..18a87f41 100644 --- a/src/12D80.h +++ b/src/12D80.h @@ -44,6 +44,16 @@ typedef struct unk_D_800ABB10 { /* 0x14 */ Gfx* unk_14; } unk_D_800ABB10; // size = 0x18? +extern s32 D_8006F080; +extern u16 D_8006F084; +extern unk_D_86002F34_00C* D_8006F088; +extern unk_D_86002F34_alt1* D_8006F08C; +extern unk_D_86002F34_alt1* D_8006F090; +extern unk_D_86002F34_00C* D_8006F094; +extern unk_D_86002F34_alt1* D_8006F098; +extern unk_D_86002F58_004_000* D_8006F09C; +extern unk_D_86002F34_alt11* D_8006F0A0; + void func_80012180(void); void func_800121C8(void); void func_80012230(MtxF* arg0); diff --git a/src/17300.c b/src/17300.c index 62807f85..75ad7c96 100644 --- a/src/17300.c +++ b/src/17300.c @@ -330,7 +330,7 @@ void func_800173CC(unk_D_86002F58_004_000* arg0) { arg0->unk_040.unk_04 = NULL; } -s32 func_800173DC(unk_D_86002F58_004_000* arg0, s16 arg1, s32 arg2, s32 arg3) { +s32 func_800173DC(unk_D_86002F58_004_000* arg0, s16 arg1, void* arg2, s32 arg3) { unk_D_86002F58_004_000_040_004* temp_v0 = Util_ConvertAddrToVirtAddr(arg2); unk_D_86002F58_004_000_040* ptr = &arg0->unk_040; @@ -375,8 +375,8 @@ s32 func_80017484(unk_D_86002F58_004_000* arg0, s16 arg1) { return var_a2; } -void func_800174E4(unk_D_86002F58_004_000* arg0) { - func_80017484(arg0, arg0->unk_040.unk_04->unk_0A - 1); +s32 func_800174E4(unk_D_86002F58_004_000* arg0) { + return func_80017484(arg0, arg0->unk_040.unk_04->unk_0A - 1); } s32 func_80017514(unk_D_86002F58_004_000* arg0) { diff --git a/src/17300.h b/src/17300.h index 8bfd9bc0..d4091f3f 100644 --- a/src/17300.h +++ b/src/17300.h @@ -36,11 +36,11 @@ void func_80017090(unk_D_86002F58_004_000_040* arg0, u16 arg1, s32 arg2); void func_80017188(void); void func_800171A8(Vec3f* arg0, Vec3s* arg1, Vec3f* arg2, s32 arg3); void func_800173CC(unk_D_86002F58_004_000* arg0); -s32 func_800173DC(unk_D_86002F58_004_000* arg0, s16 arg1, s32 arg2, s32 arg3); +s32 func_800173DC(unk_D_86002F58_004_000* arg0, s16 arg1, void* arg2, s32 arg3); s32 func_80017454(unk_D_86002F58_004_000* arg0, s32 arg1); void func_80017464(unk_D_86002F58_004_000* arg0, s16 arg1); s32 func_80017484(unk_D_86002F58_004_000* arg0, s16 arg1); -void func_800174E4(unk_D_86002F58_004_000* arg0); +s32 func_800174E4(unk_D_86002F58_004_000* arg0); s32 func_80017514(unk_D_86002F58_004_000* arg0); diff --git a/src/20330.c b/src/20330.c index bddb4601..50d90c7f 100644 --- a/src/20330.c +++ b/src/20330.c @@ -3,33 +3,33 @@ static s32 pad_D_800AC880[0x2]; static s32 D_800AC888; -static unk_D_80068BA0* D_800AC88C; +static Controller* D_800AC88C; void func_8001F730(void) { } -void func_8001F738(unk_D_80068BA0* arg0) { +void func_8001F738(Controller* arg0) { D_800AC888 = 0xA; D_800AC88C = arg0; } s32 func_8001F750(void) { - if (D_800AC88C->unk_08 & 0x800) { + if (D_800AC88C->buttonPressed & 0x800) { D_800AC888 = 0xA; return 0x800; } - if (D_800AC88C->unk_08 & 0x400) { + if (D_800AC88C->buttonPressed & 0x400) { D_800AC888 = 0xA; return 0x400; } - if (D_800AC88C->unk_08 & 0x200) { + if (D_800AC88C->buttonPressed & 0x200) { D_800AC888 = 0xA; return 0x200; } - if (D_800AC88C->unk_08 & 0x100) { + if (D_800AC88C->buttonPressed & 0x100) { D_800AC888 = 0xA; return 0x100; } @@ -39,22 +39,22 @@ s32 func_8001F750(void) { D_800AC888 = 0; // clang-format off - if (D_800AC88C->unk_06 & 0x800) { + if (D_800AC88C->buttonDown & 0x800) { D_800AC888 = 2; return 0x800; } // clang-format on - if (D_800AC88C->unk_06 & 0x400) { + if (D_800AC88C->buttonDown & 0x400) { D_800AC888 = 2; return 0x400; } - if (D_800AC88C->unk_06 & 0x200) { + if (D_800AC88C->buttonDown & 0x200) { D_800AC888 = 2; return 0x200; } - if (D_800AC88C->unk_06 & 0x100) { + if (D_800AC88C->buttonDown & 0x100) { D_800AC888 = 2; return 0x100; } diff --git a/src/20330.h b/src/20330.h index b05274ce..2f497464 100644 --- a/src/20330.h +++ b/src/20330.h @@ -2,9 +2,10 @@ #define _20330_H_ #include "global.h" +#include "src/controller.h" void func_8001F730(void); -void func_8001F738(unk_D_80068BA0*); +void func_8001F738(Controller*); s32 func_8001F750(void); diff --git a/src/29BA0.h b/src/29BA0.h index eea1bdbd..036e4954 100644 --- a/src/29BA0.h +++ b/src/29BA0.h @@ -3,6 +3,7 @@ #include "global.h" #include "3FB0.h" +#include "src/controller.h" typedef struct unk_D_800AE520 { /* 0x00 */ s16 unk_00; @@ -64,7 +65,7 @@ typedef struct unk_D_800AE540_0004 { /* 0x000 */ u8 unk_000; /* 0x001 */ u8 unk_001; /* 0x002 */ u8 unk_002; - /* 0x004 */ struct Controller* controller; + /* 0x004 */ Controller* controller; /* 0x008 */ char unk_008[0x4]; /* 0x00C */ char unk00C[0xC]; /* 0x018 */ s32 unk_018; diff --git a/src/2FEA0.c b/src/2FEA0.c index d8234e6c..539767ec 100644 --- a/src/2FEA0.c +++ b/src/2FEA0.c @@ -87,7 +87,7 @@ void func_8002F2A0(void) { FRAGMENT_LOAD(fragment3); var_s0 = FRAGMENT_LOAD_AND_CALL(fragment19, 0, 0); break; - case 15: // + case 15: // FRAGMENT_LOAD(fragment3); var_s0 = FRAGMENT_LOAD_AND_CALL(fragment20, 0, 0); break; diff --git a/src/controller.c b/src/controller.c index 805bc6bf..e231f4fe 100644 --- a/src/controller.c +++ b/src/controller.c @@ -3,7 +3,12 @@ #include "gb_tower.h" #include "math_util.h" -struct Controller gControllers[4]; +Controller* gPlayer1Controller = &gControllers[0]; +Controller* gPlayer2Controller = &gControllers[1]; +Controller* gPlayer3Controller = &gControllers[2]; +Controller* gPlayer4Controller = &gControllers[3]; + +Controller gControllers[4]; OSMesgQueue gSIEventMesgQueue; u8 gControllerBits; u8 gEepromProbe; @@ -22,7 +27,7 @@ void Cont_InitControllers(void) { // clear each gControllers member. for (i = 0; i < MAXCONTROLLERS; i++) { - bzero((void*)&gControllers[i], sizeof(struct Controller)); + bzero((void*)&gControllers[i], sizeof(Controller)); } // Initialize each connected controller. @@ -41,7 +46,7 @@ void Cont_InitControllers(void) { * Take the updated controller struct and calculate * the new x, y, and distance floats. */ -void Cont_AdjustAnalogStick(struct Controller* controller) { +void Cont_AdjustAnalogStick(Controller* controller) { // reset the controller's x and y floats. controller->stickX = 0.0f; controller->stickY = 0.0f; @@ -75,7 +80,7 @@ void Cont_AdjustAnalogStick(struct Controller* controller) { } if (controller->stickMag > 0.0f) { - controller->unkE = MathUtil_Atan2s(-controller->stickY, controller->stickX); + controller->angle = MathUtil_Atan2s(-controller->stickY, controller->stickX); } } @@ -93,7 +98,7 @@ void Cont_StartReadInputs(void) { */ void Cont_ReadInputs(void) { s32 i; - struct Controller* controller = &gControllers[0]; + Controller* controller = &gControllers[0]; osRecvMesg(&gSIEventMesgQueue, NULL, OS_MESG_BLOCK); osContGetReadData(&gControllerPads[0]); diff --git a/src/controller.h b/src/controller.h index b3db6ce6..cb81ccec 100644 --- a/src/controller.h +++ b/src/controller.h @@ -1,23 +1,23 @@ #ifndef _CONTROLLER_H_ #define _CONTROLLER_H_ -struct Controller { +typedef struct Controller { /* 0x00 */ s16 contId; /* 0x02 */ s16 rawStickX; /* 0x04 */ s16 rawStickY; /* 0x06 */ u16 buttonDown; /* 0x08 */ u16 buttonPressed; /* 0x0A */ u16 unkA; - char fillerC[2]; - /* 0x0E */ u16 unkE; - /* 0x10 */ float stickMag; - /* 0x14 */ float stickX; - /* 0x18 */ float stickY; + /* 0x0C */ char fillerC[2]; + /* 0x0E */ s16 angle; + /* 0x10 */ f32 stickMag; + /* 0x14 */ f32 stickX; + /* 0x18 */ f32 stickY; /* 0x1C */ OSContStatus *statusData; /* 0x20 */ OSContPad *controllerData; -}; +} Controller; -extern struct Controller gControllers[4]; +extern Controller gControllers[4]; extern OSMesgQueue gSIEventMesgQueue; extern u8 gControllerBits; extern u8 gEepromProbe; @@ -27,8 +27,13 @@ extern OSMesg gSIEventMesgBuf[1]; extern OSMesg gEepromMesgBuf[1]; extern OSMesgQueue gEepromMesgQueue; +extern Controller* gPlayer1Controller; +extern Controller* gPlayer2Controller; +extern Controller* gPlayer3Controller; +extern Controller* gPlayer4Controller; + void Cont_InitControllers(void); -void Cont_AdjustAnalogStick(struct Controller *controller); +void Cont_AdjustAnalogStick(Controller *controller); void Cont_StartReadInputs(void); void Cont_ReadInputs(void); u8 Cont_GetControllerBits(void); diff --git a/src/crash_screen.c b/src/crash_screen.c index 246f1ebf..e4df0d4d 100644 --- a/src/crash_screen.c +++ b/src/crash_screen.c @@ -74,8 +74,8 @@ void crash_screen_wait_for_button_combo(void) { do { Cont_StartReadInputs(); Cont_ReadInputs(); - if (D_80068BA0->unk_08 != 0) { - if (D_80068BA0->unk_08 == gCrashScreenUnlockInputs[i++]) { + if (gPlayer1Controller->buttonPressed != 0) { + if (gPlayer1Controller->buttonPressed == gCrashScreenUnlockInputs[i++]) { // have we reached the end of the array? exit the sleep loop. if (i == 10) { breakloop = TRUE; diff --git a/src/fragments/10/fragment10.c b/src/fragments/10/fragment10.c index 4a9a78b8..5409e3ed 100644 --- a/src/fragments/10/fragment10.c +++ b/src/fragments/10/fragment10.c @@ -690,9 +690,9 @@ void func_86401B3C(void) { while (var_s2 != 0) { if (var_s1 >= 0x11) { - if (D_80068BA0->unk_08 & 0x1000) { + if (gPlayer1Controller->buttonPressed & 0x1000) { var_s2 = 0; - } else if ((D_8780FA2A == 0) && (D_80068BA0->unk_08 & 0x4000)) { + } else if ((D_8780FA2A == 0) && (gPlayer1Controller->buttonPressed & 0x4000)) { func_80048B90(3); func_87802EB8(2); D_87B000D0 = 1; diff --git a/src/fragments/10/fragment10.h b/src/fragments/10/fragment10.h index b6a0cdb1..ead24e17 100644 --- a/src/fragments/10/fragment10.h +++ b/src/fragments/10/fragment10.h @@ -22,7 +22,7 @@ typedef struct unk_D_86404778 { /* 0x020 */ s32 unk_020; /* 0x024 */ u8 unk_024; /* 0x028 */ unk_D_86002F58_004_000 unk_028; - /* 0x190 */ unk_D_86404778_190* unk_190; + /* 0x190 */ unk_D_86002F34_alt9* unk_190; /* 0x194 */ u16 unk_194[14][8]; /* 0x274 */ u8 unk_274; } unk_D_86404778; // size = 0x278 diff --git a/src/fragments/11/fragment11.c b/src/fragments/11/fragment11.c index 0c5b0041..d8a49f98 100644 --- a/src/fragments/11/fragment11.c +++ b/src/fragments/11/fragment11.c @@ -608,9 +608,9 @@ void func_86501668(void) { while (var_s2 != 0) { if (var_s1 >= 0x11) { - if (D_80068BA0->unk_08 & 0x1000) { + if (gPlayer1Controller->buttonPressed & 0x1000) { var_s2 = 0; - } else if ((D_8780FA2A == 0) && (D_80068BA0->unk_08 & 0x4000)) { + } else if ((D_8780FA2A == 0) && (gPlayer1Controller->buttonPressed & 0x4000)) { func_80048B90(3); func_87802EB8(2); D_87B000D0 = 1; diff --git a/src/fragments/11/fragment11.h b/src/fragments/11/fragment11.h index 82ea9e1c..e50617be 100644 --- a/src/fragments/11/fragment11.h +++ b/src/fragments/11/fragment11.h @@ -14,7 +14,7 @@ typedef struct unk_D_8650A528 { /* 0x010 */ s16 unk_010; /* 0x010 */ s16 unk_012; /* 0x014 */ unk_D_86002F58_004_000 unk_014; - /* 0x17C */ unk_D_86404778_190* unk_17C; + /* 0x17C */ unk_D_86002F34_alt9* unk_17C; } unk_D_8650A528; // size = 0x180 typedef struct unk_D_8650AB30_000 { diff --git a/src/fragments/2/fragment2_1.c b/src/fragments/2/fragment2_1.c index 8fe7d67e..45c62f0a 100644 --- a/src/fragments/2/fragment2_1.c +++ b/src/fragments/2/fragment2_1.c @@ -64,7 +64,7 @@ void func_87802360(s16 arg0, s16 arg1, f32* arg2, f32* arg3) { } } - var_fv0 *= ABS_ALT(SINS((temp_ft1 & 0xFFFF))); + var_fv0 *= ABS(SINS((temp_ft1 & 0xFFFF))); *arg3 = 1.0f - var_fv0; *arg2 = 1.0f - var_fv0; diff --git a/src/fragments/2/fragment2_2.c b/src/fragments/2/fragment2_2.c index 1c8114ef..767ef8ce 100644 --- a/src/fragments/2/fragment2_2.c +++ b/src/fragments/2/fragment2_2.c @@ -1237,7 +1237,7 @@ u16 D_8780FC96; u16 D_8780FC98; static u8 D_8780FC9A; static u8 D_8780FC9B; -static unk_D_80068BA0* D_8780FC9C; +static Controller* D_8780FC9C; static u8 D_8780FCA0; static u8 D_8780FCA1; static u8 D_8780FCA2; @@ -1279,7 +1279,7 @@ void func_878029C0(void) { D_8780FC44 = 0; D_8780FC4C = 0; D_8780FC5C = 0; - D_8780FC9C = D_80068BA0; + D_8780FC9C = gPlayer1Controller; D_8780FC60 = D_8780FC64 = D_8780FC68 = D_8780FC6C = D_8780FC70 = D_8780FC74 = 0; D_8780FC92 = 0; D_8780FC94 = 0; @@ -1903,9 +1903,9 @@ s32 func_87804FD4(void) { sp67 = 0; sp66 = 0; - if (D_8780FC9C->unk_04 >= 0x32) { + if (D_8780FC9C->rawStickY >= 0x32) { sp67 = 1; - } else if (D_8780FC9C->unk_04 < -0x31) { + } else if (D_8780FC9C->rawStickY < -0x31) { sp66 = 1; } @@ -1936,19 +1936,19 @@ s32 func_87804FD4(void) { } } else if (D_8780FC92 == 0) { if (D_8780FC94 != 0) { - if ((D_8780FC9C->unk_08 & 0x800) || ((sp67 == 1) && (D_8780FC9A == 0))) { + if ((D_8780FC9C->buttonPressed & 0x800) || ((sp67 == 1) && (D_8780FC9A == 0))) { func_8004AF44(2); D_8780FC5C--; if (D_8780FC5C < 0) { D_8780FC5C = D_8780FC5D - 1; } - } else if ((D_8780FC9C->unk_08 & 0x400) || ((sp66 == 1) && (D_8780FC9B == 0))) { + } else if ((D_8780FC9C->buttonPressed & 0x400) || ((sp66 == 1) && (D_8780FC9B == 0))) { func_8004AF44(2); D_8780FC5C++; if (D_8780FC5C >= D_8780FC5D) { D_8780FC5C = 0; } - } else if (D_8780FC9C->unk_08 & 0x8000) { + } else if (D_8780FC9C->buttonPressed & 0x8000) { if (D_8780FC5C == 0) { func_8004AF44(0); D_8780FC94 = 0; @@ -1957,12 +1957,12 @@ s32 func_87804FD4(void) { D_8780FC92 = 1; D_8780FE01 = 1; } - } else if (D_8780FC9C->unk_08 & 0x1000) { + } else if (D_8780FC9C->buttonPressed & 0x1000) { func_8004AF44(0); D_8780FC94 = 0; D_8780FC5C = 0; } - } else if ((func_87802974() == -2) && (D_8780FC9C->unk_08 & 0x1000)) { + } else if ((func_87802974() == -2) && (D_8780FC9C->buttonPressed & 0x1000)) { func_8004AF44(1); D_8780FC94 = 1; D_8780FC5D = 2; @@ -1975,7 +1975,7 @@ s32 func_87804FD4(void) { D_8780FE44 -= D_8780FCA0; } - if ((D_8780FE44 <= 0) && (D_8780FC9C->unk_08 & 0x8000)) { + if ((D_8780FE44 <= 0) && (D_8780FC9C->buttonPressed & 0x8000)) { D_8780FC98 = 1; if (D_8780FA2A == 0) { func_80048B90(4); @@ -2025,7 +2025,7 @@ s32 func_87804FD4(void) { if (i == 4) { if (D_8780FC6C == 0) { - if (D_8780FC9C->unk_08 & 0x8000) { + if (D_8780FC9C->buttonPressed & 0x8000) { func_80048B90(4); if (func_87802FA0() != 0) { func_8004B1CC(0x13); @@ -2039,7 +2039,7 @@ s32 func_87804FD4(void) { } else { D_8780FE44 -= D_8780FCA0; if (D_8780FE44 <= 0) { - if (D_8780FC9C->unk_08 & 0x8000) { + if (D_8780FC9C->buttonPressed & 0x8000) { func_80048B90(4); D_8780FC40 = 3; D_8780FC70 = 1; @@ -2059,19 +2059,19 @@ s32 func_87804FD4(void) { break; case 3: - if ((D_8780FC9C->unk_08 & 0x800) || ((sp67 == 1) && (D_8780FC9A == 0))) { + if ((D_8780FC9C->buttonPressed & 0x800) || ((sp67 == 1) && (D_8780FC9A == 0))) { func_80048B90(1); D_8780FC5C--; if (D_8780FC5C < 0) { D_8780FC5C = D_8780FC5D - 1; } - } else if ((D_8780FC9C->unk_08 & 0x400) || ((sp66 == 1) && (D_8780FC9B == 0))) { + } else if ((D_8780FC9C->buttonPressed & 0x400) || ((sp66 == 1) && (D_8780FC9B == 0))) { func_80048B90(1); D_8780FC5C++; if (D_8780FC5C >= D_8780FC5D) { D_8780FC5C = 0; } - } else if (D_8780FC9C->unk_08 & 0x8000) { + } else if (D_8780FC9C->buttonPressed & 0x8000) { func_80048B90(2); if (D_8780FA2A == 0) { D_8780FC40 = 6; diff --git a/src/fragments/3/fragment3.h b/src/fragments/3/fragment3.h new file mode 100644 index 00000000..a045ba6f --- /dev/null +++ b/src/fragments/3/fragment3.h @@ -0,0 +1,269 @@ +#ifndef _FRAGMENT3_H_ +#define _FRAGMENT3_H_ + +#include "global.h" +#include "src/fragments/34/fragment34.h" +#include "src/3FB0.h" + +typedef struct unk_func_8790002C { + /* 0x000 */ unk_D_86002F58_004_000 unk_000; + /* 0x168 */ unk_D_86002F30* unk_168; + /* 0x16C */ f32 unk_16C; + /* 0x170 */ f32 unk_170; + /* 0x174 */ f32 unk_174; + /* 0x178 */ char unk178[0x18]; + /* 0x190 */ f32 unk_190; + /* 0x194 */ f32 unk_194; + /* 0x198 */ f32 unk_198; + /* 0x19C */ f32 unk_19C; + /* 0x1A0 */ f32 unk_1A0; + /* 0x1A4 */ f32 unk_1A4; + /* 0x1A8 */ f32 unk_1A8; + /* 0x1AC */ f32 unk_1AC; + /* 0x1B0 */ f32 unk_1B0; + /* 0x1B4 */ f32 unk_1B4; + /* 0x1B8 */ f32 unk_1B8; + /* 0x1BC */ f32 unk_1BC; + /* 0x1C0 */ f32 unk_1C0; + /* 0x1C4 */ f32 unk_1C4; + /* 0x1C8 */ f32 unk_1C8; + /* 0x1CC */ f32 unk_1CC; + /* 0x1D0 */ f32 unk_1D0; + /* 0x1D4 */ f32 unk_1D4; + /* 0x1D8 */ char unk1D8[0xC]; + /* 0x1E4 */ f32 unk_1E4; + /* 0x1E8 */ char unk1E8[0x4]; + /* 0x1EC */ f32 unk_1EC; + /* 0x1F0 */ f32 unk_1F0; + /* 0x1F4 */ f32 unk_1F4; + /* 0x1F8 */ f32 unk_1F8; + /* 0x1FC */ f32 unk_1FC; + /* 0x200 */ f32 unk_200; + /* 0x204 */ f32 unk_204; + /* 0x208 */ f32 unk_208; + /* 0x20C */ f32 unk_20C; + /* 0x210 */ f32 unk_210; + /* 0x214 */ s16 unk_214; + /* 0x216 */ s16 unk_216; + /* 0x218 */ s16 unk_218; + /* 0x21A */ s16 unk_21A; + /* 0x21C */ s16 unk_21C; + /* 0x21E */ s16 unk_21E; + /* 0x220 */ s16 unk_220; + /* 0x222 */ s16 unk_222; + /* 0x224 */ s16 unk_224; + /* 0x226 */ s16 unk_226; + /* 0x228 */ s16 unk_228; + /* 0x22A */ s16 unk_22A; + /* 0x22C */ s16 unk_22C; + /* 0x22E */ s16 unk_22E; + /* 0x230 */ s16 unk_230; + /* 0x232 */ s16 unk_232; + /* 0x234 */ s16 unk_234; + /* 0x236 */ s16 unk_236; + /* 0x238 */ s16 unk_238; + /* 0x23A */ char unk23A[0x2]; + /* 0x23A */ s16 unk_23C; + /* 0x23E */ s16 unk_23E; + /* 0x240 */ s16 unk_240; + /* 0x242 */ s16 unk_242; + /* 0x244 */ char unk244[0x4]; + /* 0x248 */ s16 unk_248; + /* 0x24A */ s16 unk_24A; + /* 0x24C */ s16 unk_24C; + /* 0x24E */ char unk24E[0x6]; + /* 0x254 */ s32 unk_254; + /* 0x258 */ char unk258[0x2]; + /* 0x25A */ s16 unk_25A; + /* 0x25C */ char unk25C[0x4]; + /* 0x260 */ s16 unk_260; + /* 0x262 */ s16 unk_262; + /* 0x264 */ s16 unk_264; + /* 0x264 */ s16 unk_266; + /* 0x268 */ char unk268[0x2]; + /* 0x26A */ s16 unk_26A; + /* 0x26C */ s16 unk_26C; + /* 0x26E */ s16 unk_26E; + /* 0x270 */ char unk270[0x2]; + /* 0x272 */ s16 unk_272; + /* 0x274 */ f32 unk_274; + /* 0x278 */ char unk278[0x4]; + /* 0x27C */ f32 unk_27C; + /* 0x280 */ f32 unk_280; + /* 0x284 */ f32 unk_284; + /* 0x288 */ f32 unk_288; + /* 0x28C */ f32 unk_28C; + /* 0x290 */ s16 unk_290; + /* 0x292 */ s16 unk_292; + /* 0x294 */ s16 unk_294; + /* 0x296 */ s16 unk_296; + /* 0x298 */ s16 unk_298; + /* 0x29A */ s16 unk_29A; + /* 0x29C */ s16 unk_29C; + /* 0x29E */ s16 unk_29E; + /* 0x2A0 */ s16 unk_2A0; + /* 0x2A2 */ s16 unk_2A2; + /* 0x2A4 */ s16 unk_2A4; + /* 0x2A6 */ char unk2A6[0x2]; + /* 0x2A8 */ s16 unk_2A8; + /* 0x2AA */ s16 unk_2AA; + /* 0x2AC */ s16 unk_2AC; + /* 0x2B0 */ char unk2B0[0x4]; +} unk_func_8790002C; // size = 0x2B4 + +// Possibly unk_D_86002F34_alt7, unk_D_86002F34_alt8, +// unk_D_86002F34_alt9 or unk_D_86002F34_alt2 +typedef struct arg1_func_87902F80 { + /* 0x00 */ unk_D_86002F34_000 unk_00; + /* 0x18 */ Gfx* unk_18; +} arg1_func_87902F80; // size >= 0x1C + +typedef struct unk_D_87903E00 { + /* 0x00 */ u32 unk_00; + /* 0x04 */ void* unk_04; + /* 0x08 */ void* unk_08; + /* 0x0C */ u32* unk_0C; +} unk_D_87903E00; // size = 0x10 + +typedef struct unk_D_87903E10 { + /* 0x00 */ s32 unk_00; + /* 0x04 */ unk_D_87903E00* unk_04; +} unk_D_87903E10; // size = 0x8 + +extern s16 D_87903DA4; +extern s16 D_87903DA8; +extern s16 D_87903DAC; +extern s16 D_87903DC0; +extern s16 D_87903DC4; +extern s16 D_87903DC8; +extern s16 D_87903DCC; +extern s16 D_87903DD0; +extern s16 D_87903DD4; + +extern unk_D_87903E10 D_87903E10; +extern unk_D_87903E10 D_87903E28; +extern unk_D_87903E10 D_87903E40; +extern unk_D_87903E10 D_87903E58; + +extern s16 D_87906040; +extern s16 D_87906044; +extern s16 D_87906046; +extern s16 D_87906048; +extern s16 D_8790604A; + +extern unk_D_86002F34_00C* D_87906054; +extern s16 D_87906060; +extern s16 D_87906062; +extern s16 D_87906064; +extern s16 D_87906066; +extern s16 D_87906068; +extern s16 D_8790606A; +extern Vec3s D_8790606C; +extern s16 D_87906072; +extern s16 D_87906076; +extern s16 D_87906078; +extern f32 D_8790607C; +extern f32 D_87906080; +extern Vec3f D_87906088; + +extern s16 D_87906094; +extern s16 D_87906096; +extern s16 D_87906098; +extern s16 D_8790609A; +extern Vec3s D_8790609C; + +extern s16 D_879060A2; +extern s16 D_879060A4; +extern s16 D_879060A6; +extern s16 D_879060A8; +extern Vec3s D_879060AC; + +extern s16 D_87903DB0; +extern s16 D_87903DB8; + +extern s8 D_879060C4; +extern s8 D_879060C5; +extern s8 D_879060C6; +extern s8 D_879060C7; +extern s16 D_879060C8; +extern s16 D_879060CA; + +extern Vec3f D_879060E0; +extern Vec3f D_87906100; +extern Vec3f D_87906110; + +ret_func_80004454 func_87900020(void); +void func_8790002C(unk_func_8790002C* arg0, unk_func_8790002C* arg1); +void func_87900070(unk_func_8790002C* arg0, unk_func_8790002C* arg1); +s32 func_879000C4(unk_func_8790002C* arg0, unk_func_8790002C* arg1); +s32 func_879001A4(unk_func_8790002C* arg0, unk_func_8790002C* arg1); +void func_879002B8(unk_func_8790002C* arg0, s16 arg1, s16 arg2, s16 arg3); +void func_879002FC(unk_func_8790002C* arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4); +void func_87900344(unk_func_8790002C* arg0, s16 arg1, s16 arg2, s16 arg3); +s32 func_87900384(unk_func_8790002C* arg0); +void func_879003A0(unk_func_8790002C* arg0); +void func_879004F8(unk_D_86002F58_004_000* arg0); +void func_87900528(void); +void func_87900558(void); +void func_87900564(unk_func_8790002C* arg0); +void func_87900594(unk_func_8790002C* arg0); +void func_879005AC(unk_func_8790002C* arg0); +void func_879005C4(unk_func_8790002C* arg0); +void func_8790060C(unk_func_8790002C* arg0); +void func_87900770(unk_func_8790002C* arg0); +void func_87900808(unk_func_8790002C* arg0); +void func_87900854(void); +void func_87900920(void); +void func_879009B4(void); + +void func_87900A50(void); +void func_87900B64(void); +s32 func_87900C5C(void); +void func_87900F44(void); +void func_879010A4(void); +void func_87901200(void); + +void func_87901620(void); +s32 func_8790168C(void); +void func_87901720(unk_D_8140E728* arg0); +void func_87901804(s32 arg0, f32 arg1, Vec3f arg2, func_unk_D_8140E720_008 arg3, unk_D_8140E728_01C* arg4, s16 arg5, u8 arg6, u8 arg7); +void func_879018B0(s32 arg0, s32 arg1, s8 arg2, f32 arg3, Vec3f arg4, func_unk_D_8140E720_008 arg7, unk_D_8140E728_01C* arg8, s16 arg9, u8 argA, u8 argB); +void func_87901958(unk_D_8140E720* arg0, unk_D_8140E728* arg1, s16 arg2); +void func_87901A28(unk_D_8140E728* arg0); +void func_87901ADC(unk_D_8140E728* arg0); +void func_87901B08(void); +void func_87901BB0(unk_D_8140E720* arg0); +void func_87901BD4(unk_D_8140E720* arg0); +void func_87901C20(void); +void func_87901C98(void); +void func_87901DA0(unk_D_8140E720* arg0); +void func_87901F04(unk_D_8140E720* arg0); +void func_87901FA0(unk_D_8140E720* arg0); +void func_87902068(unk_D_8140E720* arg0); +void func_8790215C(unk_D_8140E720* arg0); +void func_87902224(unk_D_8140E720* arg0); +void func_87902318(unk_D_8140E720* arg0); +void func_879023EC(unk_D_8140E720* arg0); +void func_879024DC(unk_D_8140E720* arg0); +void func_87902608(unk_D_8140E720* arg0); +void func_879026D8(unk_D_8140E720* arg0); +void func_879027F0(unk_D_8140E720* arg0); +void func_879028E0(unk_D_8140E720* arg0); +void func_879029F0(unk_D_8140E720* arg0); +void func_87902AE0(unk_D_8140E720* arg0); +void func_87902C9C(unk_D_8140E720* arg0); +void func_87902D3C(Gfx* arg0, unk_D_86002F34_000_014* arg1, UNUSED u16 arg2); +void func_87902F80(s32 arg0, arg1_func_87902F80* arg1); +void func_87902FC8(Gfx* arg0, unk_D_86002F34_000_014* arg1, UNUSED u16 arg2); +void func_8790320C(s32 arg0, arg1_func_87902F80* arg1); + +void func_87903260(void); +void func_87903294(void); +void func_879032BC(s16 arg0); +void func_87903358(s16 arg0, s16 arg1); +void func_879033FC(unk_func_8790002C* arg0); +void func_8790354C(void); + + + +#endif // _FRAGMENT3_H_ diff --git a/src/fragments/3/fragment3_1189B0.c b/src/fragments/3/fragment3_1189B0.c index 2de6e0ef..2a481722 100644 --- a/src/fragments/3/fragment3_1189B0.c +++ b/src/fragments/3/fragment3_1189B0.c @@ -1,47 +1,355 @@ -#include "global.h" +#include "fragment3.h" +#include "include/libc/math.h" +#include "src/17300.h" +#include "src/18140.h" +#include "src/1C720.h" +#include "src/20330.h" +#include "src/3FB0.h" +#include "src/controller.h" +#include "src/fragments/2/fragment2.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_87900020.s") +s16 D_87903DA0 = 0; +s16 D_87903DA4 = 0; +s16 D_87903DA8 = 0; +s16 D_87903DAC = 0; +s16 D_87903DB0 = 0; +s32 pad_D_87903DB4 = 0; +s16 D_87903DB8 = 0; +s32 pad_D_87903DBC = 0; +s16 D_87903DC0 = 0; +s16 D_87903DC4 = 0; +s16 D_87903DC8 = 0; +s16 D_87903DCC = 0; +s16 D_87903DD0 = 0; +s16 D_87903DD4 = 0; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_8790002C.s") +ret_func_80004454 func_87900020(void) { + return func_87900020; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_87900070.s") +void func_8790002C(unk_func_8790002C* arg0, unk_func_8790002C* arg1) { + sqrtf(SQ(arg1->unk_19C - arg0->unk_19C) + SQ(arg1->unk_1A4 - arg0->unk_1A4)); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_879000C4.s") +void func_87900070(unk_func_8790002C* arg0, unk_func_8790002C* arg1) { + sqrtf(SQ(arg1->unk_19C - arg0->unk_19C) + SQ(arg1->unk_1A0 - arg0->unk_1A0) + SQ(arg1->unk_1A4 - arg0->unk_1A4)); +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_879001A4.s") +s32 func_879000C4(unk_func_8790002C* arg0, unk_func_8790002C* arg1) { + f32 var_fv0 = arg1->unk_19C - arg0->unk_19C; + f32 var_fv1 = arg1->unk_1A0 - arg0->unk_1A0; + f32 var_fa0 = arg1->unk_1A4 - arg0->unk_1A4; + f32 var_fa1 = (arg0->unk_288 * arg0->unk_170) + (arg1->unk_288 * arg1->unk_170); + s32 ret = 0; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_879002B8.s") + if (var_fv0 < 0.0f) { + var_fv0 = -var_fv0; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_879002FC.s") + if (var_fv1 < 0.0f) { + var_fv1 = -var_fv1; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_87900344.s") + if (var_fa0 < 0.0f) { + var_fa0 = -var_fa0; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_87900384.s") + if (var_fa1 < 0.0f) { + var_fa1 = -var_fa1; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_879003A0.s") + if (CB(var_fa0) < ((CB(var_fa1) - CB(var_fv0)) - CB(var_fv1))) { + ret = 1; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_879004F8.s") + return ret; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_87900528.s") +s32 func_879001A4(unk_func_8790002C* arg0, unk_func_8790002C* arg1) { + f32 var_fa0; + f32 var_fa1; + f32 var_fs0; + f32 var_fv0; + f32 var_fv1; + f32 tmp; + s32 var_v1; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_87900558.s") + var_fv0 = arg1->unk_19C - arg0->unk_19C; + var_fv1 = arg1->unk_1A0 - arg0->unk_1A0; + var_fa0 = arg1->unk_1A4 - arg0->unk_1A4; + var_v1 = 0; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_87900564.s") + var_fa1 = (arg0->unk_288 * arg0->unk_170) + (arg1->unk_288 * arg1->unk_170); + var_fs0 = ((arg0->unk_28C * arg0->unk_170) + (arg1->unk_28C * arg1->unk_170)) * 0.5f; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_87900594.s") + var_fv0 = ABS(var_fv0); + var_fv1 = ABS(var_fv1); + var_fa0 = ABS(var_fa0); + var_fa1 = ABS(var_fa1); + var_fs0 = ABS(var_fs0); + tmp = var_fs0 - var_fv1; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_879005AC.s") + if ((SQ(var_fa0) < (SQ(var_fa1) - SQ(var_fv0))) && (tmp > 0)) { + var_v1 = 1; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_879005C4.s") + return var_v1; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_8790060C.s") +void func_879002B8(unk_func_8790002C* arg0, s16 arg1, s16 arg2, s16 arg3) { + arg0->unk_248 = 1; + arg0->unk_24A = arg1; + arg0->unk_24C = arg2; + arg0->unk_26A = arg3; + arg0->unk_26C = 0; + arg0->unk_26E = 0; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_87900770.s") +void func_879002FC(unk_func_8790002C* arg0, s16 arg1, s16 arg2, s16 arg3, s16 arg4) { + arg0->unk_248 = 1; + arg0->unk_24A = arg1; + arg0->unk_24C = arg2; + arg0->unk_26A = arg3; + arg0->unk_26C = 0; + arg0->unk_26E = arg4; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_87900808.s") +void func_87900344(unk_func_8790002C* arg0, s16 arg1, s16 arg2, s16 arg3) { + arg0->unk_248 = 1; + arg0->unk_24A = arg1; + arg0->unk_24C = arg2; + arg0->unk_26A = arg3; + arg0->unk_26C = 1; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_87900854.s") +s32 func_87900384(unk_func_8790002C* arg0) { + s32 var_v1 = 0; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_87900920.s") + if (arg0->unk_248 == 0) { + var_v1 = 1; + } + return var_v1; +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1189B0/func_879009B4.s") +void func_879003A0(unk_func_8790002C* arg0) { + switch (arg0->unk_248) { + case 1: + func_8001BD04(&arg0->unk_000, arg0->unk_24A); + if (arg0->unk_26C != 0) { + func_800173DC(&arg0->unk_000, 0, arg0->unk_000.unk_040.unk_04, -0x10000); + func_80017464(&arg0->unk_000, arg0->unk_000.unk_040.unk_04->unk_0A - 1); + } else { + func_800173DC(&arg0->unk_000, 0, arg0->unk_000.unk_040.unk_04, 0x10000); + func_80017464(&arg0->unk_000, arg0->unk_26E); + func_80017788(&arg0->unk_000); + if (arg0->unk_24C != -1) { + func_8001BD9C(&arg0->unk_000, arg0->unk_24C); + func_80017804(&arg0->unk_000, arg0->unk_26E); + } + } + arg0->unk_248++; + break; + + case 2: + if (arg0->unk_26C == 0) { + if (func_800174E4(&arg0->unk_000) != 0) { + arg0->unk_248++; + } + } else { + if (arg0->unk_000.unk_040.unk_08 == 0) { + arg0->unk_248++; + } + } + break; + + case 3: + if (arg0->unk_26A != 0) { + func_8001BD04(&arg0->unk_000, 0); + } + arg0->unk_248 = 0; + break; + } +} + +void func_879004F8(unk_D_86002F58_004_000* arg0) { + func_80017464(arg0, arg0->unk_040.unk_04->unk_0A - 1); +} + +void func_87900528(void) { + Cont_StartReadInputs(); + Cont_ReadInputs(); + func_8001F730(); +} + +void func_87900558(void) { + D_87906044 = 0; +} + +void func_87900564(unk_func_8790002C* arg0) { + arg0->unk_1C0 = 0.0f; + arg0->unk_1A8 = 0.0f; + arg0->unk_190 = 0.0f; + arg0->unk_1C4 = 0.0f; + arg0->unk_1AC = 0.0f; + arg0->unk_194 = 0.0f; + arg0->unk_1C8 = 0.0f; + arg0->unk_1B0 = 0.0f; + arg0->unk_198 = 0.0f; +} + +void func_87900594(unk_func_8790002C* arg0) { + arg0->unk_1A8 = 0.0f; + arg0->unk_1AC = 0.0f; + arg0->unk_1B0 = 0.0f; +} + +void func_879005AC(unk_func_8790002C* arg0) { + arg0->unk_1C0 = 0.0f; + arg0->unk_1C4 = 0.0f; + arg0->unk_1C8 = 0.0f; +} + +void func_879005C4(unk_func_8790002C* arg0) { + arg0->unk_1FC = arg0->unk_1FC - arg0->unk_210; + arg0->unk_1C0 = arg0->unk_1C0 + arg0->unk_1F8; + arg0->unk_1C4 = arg0->unk_1C4 + (arg0->unk_1FC - arg0->unk_210); + arg0->unk_1C8 = arg0->unk_1C8 + arg0->unk_200; +} + +void func_8790060C(unk_func_8790002C* arg0) { + arg0->unk_214 = arg0->unk_216 = arg0->unk_218 = 0; + arg0->unk_21A = arg0->unk_21C = arg0->unk_21E = 0; + arg0->unk_220 = arg0->unk_222 = arg0->unk_224 = 0; + arg0->unk_226 = arg0->unk_228 = arg0->unk_22A = 0; + arg0->unk_22C = arg0->unk_22E = arg0->unk_230 = 0; + arg0->unk_232 = arg0->unk_234 = arg0->unk_236 = 0; + arg0->unk_23E = arg0->unk_240 = arg0->unk_242 = arg0->unk_248 = 0; + + arg0->unk_254 = 0; + arg0->unk_272 = 0; + arg0->unk_238 = 0; + arg0->unk_25A = 0; + arg0->unk_2A8 = 0; + arg0->unk_2A4 = 0; + arg0->unk_2A2 = 0; + arg0->unk_29A = 0; + arg0->unk_2AA = 0; + arg0->unk_29C = 0; + arg0->unk_2A0 = 0; + arg0->unk_29E = 0; + arg0->unk_296 = 0; + arg0->unk_298 = 0; + + arg0->unk_16C = arg0->unk_170 = arg0->unk_174 = 1.0f; + + arg0->unk_198 = 0.0f; + arg0->unk_194 = 0.0f; + arg0->unk_190 = 0.0f; + arg0->unk_1B0 = 0.0f; + arg0->unk_1AC = 0.0f; + arg0->unk_1A8 = 0.0f; + arg0->unk_1BC = 0.0f; + arg0->unk_1B8 = 0.0f; + arg0->unk_1B4 = 0.0f; + arg0->unk_1C8 = 0.0f; + arg0->unk_1C4 = 0.0f; + arg0->unk_1C0 = 0.0f; + arg0->unk_1D4 = 0.0f; + arg0->unk_1D0 = 0.0f; + arg0->unk_1CC = 0.0f; + arg0->unk_1E4 = 0.0f; + arg0->unk_210 = 0.0f; + arg0->unk_20C = 0.0f; + arg0->unk_208 = 0.0f; + arg0->unk_204 = 0.0f; + arg0->unk_200 = 0.0f; + arg0->unk_1FC = 0.0f; + arg0->unk_1F8 = 0.0f; + arg0->unk_1F4 = 0.0f; + arg0->unk_1F0 = 0.0f; + arg0->unk_1EC = 0.0f; + arg0->unk_284 = 0.0f; + arg0->unk_280 = 0.0f; + arg0->unk_27C = 0.0f; + arg0->unk_274 = 0.0f; + + arg0->unk_260 = arg0->unk_262 = arg0->unk_264 = arg0->unk_266 = 0; + arg0->unk_290 = arg0->unk_292 = arg0->unk_294 = 0; +} + +void func_87900770(unk_func_8790002C* arg0) { + arg0->unk_190 = arg0->unk_19C = arg0->unk_1A8 + arg0->unk_1C0; + arg0->unk_194 = arg0->unk_1A0 = arg0->unk_1AC + arg0->unk_1C4; + arg0->unk_198 = arg0->unk_1A4 = arg0->unk_1B0 + arg0->unk_1C8; + + arg0->unk_1A0 = arg0->unk_1A0 + arg0->unk_1E4; + + arg0->unk_214 = arg0->unk_21A + arg0->unk_226 + arg0->unk_232; + arg0->unk_216 = arg0->unk_21C + arg0->unk_228 + arg0->unk_234; + arg0->unk_218 = arg0->unk_21E + arg0->unk_22A + arg0->unk_236; +} + +void func_87900808(unk_func_8790002C* arg0) { + arg0->unk_000.unk_030.x = arg0->unk_16C; + arg0->unk_000.unk_030.y = arg0->unk_170; + arg0->unk_000.unk_030.z = arg0->unk_174; + + arg0->unk_000.unk_024.x = arg0->unk_190; + arg0->unk_000.unk_024.y = arg0->unk_194; + arg0->unk_000.unk_024.z = arg0->unk_198; + + arg0->unk_000.unk_01E.x = arg0->unk_214; + arg0->unk_000.unk_01E.y = arg0->unk_216; + arg0->unk_000.unk_01E.z = arg0->unk_218; +} + +void func_87900854(void) { + s16* ptr = D_8780FA30; + + D_87903DA4 = 0; + D_87903DA8 = 0; + D_87903DAC = 0; + D_87906040 = 0; + D_87906048 = 0; + D_8790604A = 0; + D_87903DC0 = 0; + D_87903DC4 = 0; + D_87903DC8 = 0; + D_87903DCC = 0; + D_87903DD0 = 0; + D_87906072 = 0; + + func_878029C0(); + func_87802528(); + + D_879060C4 = ptr[0]; + D_879060C5 = ptr[1]; + D_879060C6 = ptr[2]; + D_879060C7 = ptr[3]; + + D_879060C8 = 0xFF; +} + +void func_87900920(void) { + D_8790607C = D_87906064; + D_87906080 = D_87906066; + + D_87906088.x = D_8790606C.x; + D_87906088.y = D_8790606C.y; + D_87906088.z = D_8790606C.z; + + D_87906076 = D_87906060; + D_87906078 = D_87906062; +} + +void func_879009B4(void) { + D_87906064 = D_8790607C; + D_87906066 = D_87906080; + + D_8790606C.x = D_87906088.x; + D_8790606C.y = D_87906088.y; + D_8790606C.z = D_87906088.z; + + D_87906060 = D_87906076; + D_87906062 = D_87906078; +} diff --git a/src/fragments/3/fragment3_1193E0.c b/src/fragments/3/fragment3_1193E0.c index 511725bf..9c16f966 100644 --- a/src/fragments/3/fragment3_1193E0.c +++ b/src/fragments/3/fragment3_1193E0.c @@ -1,13 +1,296 @@ -#include "global.h" +#include "fragment3.h" +#include "src/1CF30.h" +#include "src/20470.h" +#include "src/F420.h" +#include "src/controller.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1193E0/func_87900A50.s") +s16 D_87906040; +s16 pad_D_87906042; +s16 D_87906044; +s16 D_87906046; +s16 D_87906048; +s16 D_8790604A; +s32 pad_D_8790604C; +s32 D_87906050; +unk_D_86002F34_00C* D_87906054; +s32 pad_D_87906058[2]; +s16 D_87906060; +s16 D_87906062; +s16 D_87906064; +s16 D_87906066; +s16 D_87906068; +s16 D_8790606A; +Vec3s D_8790606C; +s16 D_87906072; +s16 pad_D_87906074; +s16 D_87906076; +s16 D_87906078; +f32 D_8790607C; +f32 D_87906080; +s32 pad_D_87906084; +Vec3f D_87906088; +s16 D_87906094; +s16 D_87906096; +s16 D_87906098; +s16 D_8790609A; +Vec3s D_8790609C; +s16 D_879060A2; +s16 D_879060A4; +s16 D_879060A6; +s16 D_879060A8; +Vec3s D_879060AC; +s32 pad_D_879060B4; +s32 pad_D_879060B8; +s16 D_879060BC; +s16 D_879060BE; +s16 D_879060C0; +s16 D_879060C2; +s8 D_879060C4; +s8 D_879060C5; +s8 D_879060C6; +s8 D_879060C7; +s16 D_879060C8; +s16 D_879060CA; +s32 pad_D_879060D0[4]; +Vec3f D_879060E0; +Vec3f pad_D_879060F0; +Vec3f D_87906100; +Vec3f D_87906110; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1193E0/func_87900B64.s") +void func_87900A50(void) { + D_87906060 = D_879060A2 + D_87906094; + D_87906062 = D_879060A4 + D_87906096; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1193E0/func_87900C5C.s") + D_8790606C.x = D_879060AC.x + D_8790609C.x; + D_8790606C.y = D_879060AC.y + D_8790609C.y; + D_8790606C.z = D_879060AC.z + D_8790609C.z; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1193E0/func_87900F44.s") + D_87906064 = D_879060A6 + D_87906098; + D_87906066 = D_879060A8 + D_8790609A; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1193E0/func_879010A4.s") + if (D_87906064 < 0x32) { + D_87906064 = 0x32; + D_87906098 = D_87906064 - D_879060A6; + } -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_1193E0/func_87901200.s") + if (D_87906066 < 0xA) { + D_87906066 = 0xA; + D_8790609A = D_87906066 - D_879060A8; + } +} + +void func_87900B64(void) { + D_87906054->unk_24.fovy = D_87906066; + D_87906054->unk_24.near = D_87906068; + D_87906054->unk_24.far = D_8790606A; + + D_87906054->unk_60.at.x = D_8790606C.x; + D_87906054->unk_60.at.y = D_8790606C.y; + D_87906054->unk_60.at.z = D_8790606C.z; + + func_80010354(&D_87906054->unk_60.at, &D_87906054->unk_60.eye, D_87906064, D_87906060, D_87906062); +} + +s32 func_87900C5C(void) { + s16 sp6; + + if (D_87903DB0 == 0) { + return; + } + + if (gPlayer1Controller->buttonPressed & 0x20) { + D_87903DB8++; + if (D_87903DB8 == 1) { + D_87903DB8 = 0; + } + } + + if (gPlayer1Controller->buttonPressed & 0x10) { + D_87903DB8--; + if (D_87903DB8 < 0) { + D_87903DB8 = 0; + } + } + + if (gPlayer1Controller->buttonPressed & 0x1000) { + D_8790609C.x = 0; + D_8790609C.y = 0; + D_8790609C.z = 0; + + D_87906094 = 0; + D_87906096 = 0; + D_87906098 = 0; + D_8790609A = 0; + } + + if (D_87903DB8 == 0) { + if (gPlayer1Controller->buttonDown & 0xCF00) { + if (gPlayer1Controller->buttonDown & 0x800) { + sp6 = D_87906062 + 0x8000; + } + + if (gPlayer1Controller->buttonDown & 0x400) { + sp6 = D_87906062; + } + + if (gPlayer1Controller->buttonDown & 0x200) { + sp6 = D_87906062 + 0xC000; + } + + if (gPlayer1Controller->buttonDown & 0x100) { + sp6 = D_87906062 + 0x4000; + } + + if (gPlayer1Controller->buttonDown & 0x8000) { + sp6 = D_87906062 + 0x8000; + } + + if (gPlayer1Controller->buttonDown & 0x4000) { + sp6 = D_87906062; + } + + D_8790609C.x += SINS(sp6) * 16.0f; + D_8790609C.z += COSS(sp6) * 16.0f; + } + + D_87906096 += gPlayer1Controller->stickX * 4.0f; + D_87906094 += gPlayer1Controller->stickY * 4.0f; + + if (gPlayer1Controller->buttonDown & 8) { + D_8790609C.y += 4; + } + + if (gPlayer1Controller->buttonDown & 4) { + D_8790609C.y -= 4; + } + + if (gPlayer1Controller->buttonDown & 1) { + D_87906098 += 0xA; + } + + if (gPlayer1Controller->buttonDown & 2) { + D_87906098 -= 0xA; + } + } +} + +void func_87900F44(void) { + u8 sp24[3] = { 0, 0, 30 }; // D_87903DE0 + u8 sp20[3] = { 0, 0, 250 }; // D_87903DE4 + + func_80020460(0x14, 0x14, 0x122, 0x3C, 0x141); + func_8001F3F4(); + func_8001EBE0(2, -2); + func_8001F324(0xFF, 0xFF, 0xFF, 0xFF); + + if (D_87903DB8 == 0) { + func_8001F1E8(0x19, 0x1C, "TRANSRATE"); + } + + func_8001F1E8(0x19, 0x28, "CAMERA X:%d", D_8790606C.x); + func_8001F1E8(0x19, 0x34, "CAMERA Y:%d", D_8790606C.y); + func_8001F1E8(0x19, 0x40, "CAMERA Z:%d", D_8790606C.z); + func_8001F1E8(0xA7, 0x28, "CAMERA D:%d", D_87906064); + func_8001F1E8(0xA7, 0x34, "CAMERA F:%d", D_87906066); + func_8001F1E8(0xA7, 0x40, "X:%04hX Y:%04hX", D_87906060, D_87906062); + func_8001F444(); +} + +void func_879010A4(void) { + u8 sp2C[3] = { 0, 0, 30 }; // D_87903DE8 + u8 sp28[3] = { 0, 0, 250 }; // D_87903DEC + + func_80020460(0x78, 0x80, 0xB4, 0x64, 0x141); + func_8001F3F4(); + func_8001EBE0(2, -2); + func_8001F324(0xFF, 0xFF, 0xFF, 0xFF); + func_8001F1E8(0x82, 0x8C, "FORCE :%2.2f", gPlayer1Controller->stickMag); + func_8001F1E8(0x82, 0x98, "LEVEL X :%2.2f", gPlayer1Controller->stickX); + func_8001F1E8(0x82, 0xA4, "LEVEL Y :%2.2f", gPlayer1Controller->stickY); + func_8001F1E8(0x82, 0xB0, "STICK X :%d", gPlayer1Controller->rawStickX); + func_8001F1E8(0x82, 0xBC, "STICK Y :%d", gPlayer1Controller->rawStickY); + func_8001F1E8(0x82, 0xC8, "ANGLE :%04hx", gPlayer1Controller->angle); + func_8001F444(); +} + +void func_87901200(void) { + UNUSED s32 pad; + u8 sp30[3] = { 0, 0, 30 }; // D_87903DF0 + u8 sp2C[3] = { 0, 0, 250 }; // D_87903DF4 + + if (gPlayer1Controller->buttonPressed & 8) { + D_879060CA--; + if (D_879060CA < 0) { + D_879060CA = 4; + } + } + + if (gPlayer1Controller->buttonPressed & 4) { + D_879060CA++; + if (D_879060CA >= 5) { + D_879060CA = 0; + } + } + + switch (D_879060CA) { + case 0: + if (gPlayer1Controller->buttonPressed & 2) { + D_87906100.x -= 0.1f; + } + if (gPlayer1Controller->buttonPressed & 1) { + D_87906100.x += 0.1f; + } + break; + + case 1: + if (gPlayer1Controller->buttonPressed & 2) { + D_87906100.y -= 0.1; + } + if (gPlayer1Controller->buttonPressed & 1) { + D_87906100.y += 0.1; + } + break; + + case 2: + if (gPlayer1Controller->buttonPressed & 2) { + D_879060E0.x -= 1.0; + } + if (gPlayer1Controller->buttonPressed & 1) { + D_879060E0.x += 1.0; + } + break; + + case 3: + if (gPlayer1Controller->buttonPressed & 2) { + D_879060E0.y -= 1.0; + } + if (gPlayer1Controller->buttonPressed & 1) { + D_879060E0.y += 1.0; + } + break; + + case 4: + if (gPlayer1Controller->buttonPressed & 2) { + D_87906110.y -= 0.02; + } + if (gPlayer1Controller->buttonPressed & 1) { + D_87906110.y += 0.02; + } + break; + } + + func_80020460(0x78, 0x80, 0xB4, 0x64, 0x141); + func_8001F3F4(); + func_8001EBE0(2, -2); + func_8001F324(0xFF, 0xFF, 0xFF, 0xFF); + func_8001F1E8(0x7C, 0x8C + (D_879060CA * 0xC), "@"); + + func_8001F1E8(0x82, 0x8C, "VX:%2.2f", D_87906100.x); + func_8001F1E8(0x82, 0x98, "VY:%2.2f", D_87906100.y); + func_8001F1E8(0x82, 0xA4, "BX:%2.2f", D_879060E0.x); + func_8001F1E8(0x82, 0xB0, "BY:%2.2f", D_879060E0.y); + func_8001F1E8(0x82, 0xBC, "GV:%2.2f", D_87906110.y); + func_8001F1E8(0x82, 0xC8, "PW:%2.2f", D_87906110.x); + + func_8001F444(); +} diff --git a/src/fragments/3/fragment3_119FB0.c b/src/fragments/3/fragment3_119FB0.c index b8b05f97..62eed7f5 100644 --- a/src/fragments/3/fragment3_119FB0.c +++ b/src/fragments/3/fragment3_119FB0.c @@ -1,69 +1,629 @@ -#include "global.h" - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901620.s") - +#include "fragment3.h" +#include "src/6A40.h" +#include "src/math_util.h" +#include "src/memory.h" +#include "src/12D80.h" + +void func_87901620(void) { + D_8140E720 = main_pool_alloc(0xF870, 0); + bzero(D_8140E720, 0xF870); + D_8140E72C = 0; + + D_8140E728 = main_pool_alloc(0x1800, 0); + bzero(D_8140E728, 0x1800); + D_8140E734 = 0; +} + +#ifdef NON_MATCHING +s32 func_8790168C(void) { + s32 i; + s32 var_v0 = D_8140E734; + unk_D_8140E728* var_v1 = &D_8140E728[var_v0]; + + for (i = 0; i < 0x80; i++) { + if (var_v1->unk_2B == 0) { + break; + } + + var_v0++; + if (var_v0 >= 0x80) { + var_v0 = 0; + var_v1 = D_8140E728; + } else { + var_v1++; + } + } + + if (i >= 0x80) { + return -1; + } + + var_v1->unk_2B = 1; + + D_8140E734 = var_v0 + 1; + if (D_8140E734 >= 0x80) { + D_8140E734 = 0; + } + + return (s32)var_v1; +} +#else #pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_8790168C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901720.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901738.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901804.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_879018B0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901958.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901A28.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901ADC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901B08.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901BB0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901BD4.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901C20.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901C98.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901DA0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901F04.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87901FA0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87902068.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_8790215C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87902224.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87902318.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_879023EC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_879024DC.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87902608.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_879026D8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_879027F0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_879028E0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_879029F0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87902AE0.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87902C9C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87902D3C.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87902F80.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_87902FC8.s") - -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_119FB0/func_8790320C.s") +#endif + +void func_87901720(unk_D_8140E728* arg0) { + arg0->unk_28 = 0; + arg0->unk_2B = 0; + arg0->unk_2A = 0; + arg0->unk_26 = arg0->unk_28; +} + +s32 func_87901738(s32 arg0, s32 arg1, s8 arg2, f32 arg3, Vec3f arg4, Vec3s arg7, func_unk_D_8140E720_008 arg9, + unk_D_8140E728_01C* argA, s32 argB, u8 argC, s16 argD, u8 argE, u8 argF, u8 arg10) { + unk_D_8140E728* temp_v0 = (unk_D_8140E728*)func_8790168C(); + + if ((s32)temp_v0 != -1) { + temp_v0->unk_28 = arg0; + temp_v0->unk_26 = arg1; + temp_v0->unk_2A = arg2; + temp_v0->unk_2C = argC; + + temp_v0->unk_00 = arg3; + + temp_v0->unk_04.x = arg4.x; + temp_v0->unk_04.y = arg4.y; + temp_v0->unk_04.z = arg4.z; + + temp_v0->unk_10.x = arg7.x; + temp_v0->unk_10.y = arg7.y; + temp_v0->unk_10.z = arg7.z; + + temp_v0->unk_18 = arg9; + temp_v0->unk_1C = argA; + temp_v0->unk_20 = argB; + temp_v0->unk_24 = argD; + temp_v0->unk_2D = argE; + temp_v0->unk_2E = argF; + temp_v0->unk_2F = arg10; + } + + return (s32)temp_v0; +} + +void func_87901804(s32 arg0, f32 arg1, Vec3f arg2, func_unk_D_8140E720_008 arg3, unk_D_8140E728_01C* arg4, s16 arg5, + u8 arg6, u8 arg7) { + Vec3s sp50; + + sp50.x = sp50.y = sp50.z = 0; + + func_87901738(arg0, 0, 1, arg1, arg2, sp50, arg3, arg4, 0, 0, arg5, arg6, arg7, 0); +} + +void func_879018B0(s32 arg0, s32 arg1, s8 arg2, f32 arg3, Vec3f arg4, func_unk_D_8140E720_008 arg7, + unk_D_8140E728_01C* arg8, s16 arg9, u8 argA, u8 argB) { + Vec3s sp50; + + sp50.x = sp50.y = sp50.z = 0; + + func_87901738(arg0, arg1, arg2, arg3, arg4, sp50, arg7, arg8, 0, 0, arg9, argA, argB, 0); +} + +void func_87901958(unk_D_8140E720* arg0, unk_D_8140E728* arg1, s16 arg2) { + if ((s32)arg0 != -1) { + while (arg0 != NULL) { + arg0->unk_28 = arg1->unk_00; + + func_81400930(&arg0->unk_68, &arg1->unk_04); + func_8140094C(&arg0->unk_94, &arg1->unk_10); + + arg0->unk_AC = arg2++; + + arg0->unk_08 = arg1->unk_18; + arg0->unk_0C = arg1->unk_1C; + + arg0->unk_CD = arg1->unk_2F; + arg0->unk_CE = arg1->unk_2D; + arg0->unk_AA = arg1->unk_24; + arg0->unk_CF = arg1->unk_2E; + + arg0 = arg0->next; + }; + } +} + +void func_87901A28(unk_D_8140E728* arg0) { + s16 i; + s16 sp2C; + unk_D_8140E728_01C* temp_v0 = arg0->unk_1C; + s16 temp_v1 = arg0->unk_24; + unk_D_8140E728_01C_004* unk_04 = temp_v0->unk_04; + + if ((temp_v0->unk_00 == 1) && (unk_04->unk_00 == 1)) { + func_87901958(func_81407B5C(temp_v1 & 0xFF), arg0, 0); + } else { + for (i = 0; i < sp2C; i++) { + func_87901958(func_81407B3C(), arg0, i); + } + } +} + +void func_87901ADC(unk_D_8140E728* arg0) { + if (arg0->unk_2C == 0) { + func_87901A28(arg0); + } +} + +void func_87901B08(void) { + s32 i; + unk_D_8140E728* var_s0 = D_8140E728; + + for (i = 0; i < 0x80; i++, var_s0++) { + if (var_s0->unk_2B != 0) { + var_s0->unk_28--; + if (var_s0->unk_28 < 0) { + func_87901ADC(var_s0); + if (var_s0->unk_2A > 0) { + var_s0->unk_2A--; + if (var_s0->unk_2A == 0) { + func_87901720(var_s0); + } + } else { + var_s0->unk_28 = var_s0->unk_26; + } + } + } + } +} + +void func_87901BB0(unk_D_8140E720* arg0) { + D_8140E628.x = arg0->unk_28; + D_8140E628.y = arg0->unk_28; + D_8140E628.z = arg0->unk_28; +} + +void func_87901BD4(unk_D_8140E720* arg0) { + if (func_81408180(arg0) != 0) { + arg0->unk_18 = 0; + func_81408158(arg0); + func_81407B04(arg0); + } else { + func_81408AF0(arg0); + } +} + +void func_87901C20(void) { + s32 i; + unk_D_8140E720* var_s0 = D_8140E720; + + func_87901B08(); + + for (i = 0; i < 0x12C; i++, var_s0++) { + if (var_s0->unk_D0 != 0) { + func_87901BB0(var_s0); + + var_s0->unk_08(var_s0); + + func_87901BD4(var_s0); + } + } +} + +void func_87901C98(void) { + gSPPerspNormalize(gDisplayListHead++, D_87906054->unk_24.perspNorm); + gSPMatrix(gDisplayListHead++, D_87906054->unk_24.mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gDisplayListHead++, D_87906054->unk_60.p_mtxf, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); + + D_8140E620 = func_80005F5C(0x5BE0); + D_8140E624 = 0; + + gSPDisplayList(gDisplayListHead++, D_8140DB30); + + func_8140C204(D_87906054, &gDisplayListHead); + + gSPDisplayList(gDisplayListHead++, D_8140DAE0); +} + +void func_87901DA0(unk_D_8140E720* arg0) { + Vec3s sp28; + s16 sp26 = func_8140C038(arg0); + + func_8140BAC8(arg0, 0xC8, 0xAA, 0x64); + func_8140BB74(arg0, 0x3A, 0x18, 0x18); + func_8140B938(arg0, (func_81400A78(0xA) * 0.03f) + 0.15f); + + sp28.x = func_81400B00(0x400) - 0x3000; + sp28.y = (func_81400B00(0x400) + (sp26 << 0xD)) - 0x3000; + sp28.z = 0; + + func_8140A4F0(arg0, sp28); + func_8140AD8C(arg0, (func_81400A78(0xA) * 0.3f) + 6.0f); + func_8140B2B4(arg0); + func_8140BC20(arg0, 0xFF); + func_814081BC(arg0); +} + +void func_87901F04(unk_D_8140E720* arg0) { + switch (arg0->unk_B2) { + case 1: + func_87901DA0(arg0); + break; + + case 2: + if (arg0->unk_30 < 0.0f) { + func_81408150(arg0); + } + break; + } + + if (func_8140819C(arg0) != 0) { + func_8140B0A4(arg0, -8.0f, 1.0f); + func_81409BDC(arg0); + } +} + +void func_87901FA0(unk_D_8140E720* arg0) { + func_8140B938(arg0, 0.25f); + func_8140A594(arg0, func_81400A78(0x10000)); + func_8140AD8C(arg0, (2.0f * MathUtil_Random_ZeroOne()) + 4.0f); + func_8140AF24(arg0, (MathUtil_Random_ZeroOne() * 3.0f) + 1.0f); + func_8140D5A0(arg0, 0xA); + func_8140BC20(arg0, 0x64); + func_8140BCA8(arg0, 7); + func_814081BC(arg0); +} + +void func_87902068(unk_D_8140E720* arg0) { + switch (arg0->unk_B2) { + case 1: + func_87901FA0(arg0); + break; + + case 2: + func_814084D8(arg0, 0, 7, 1, 2, 0); + func_8140B98C(arg0, 0.8f, 0.1f); + func_8140ADBC(arg0, 1.0f, 1); + if (func_8140BDAC(arg0) != 0) { + func_8140B180(arg0, 0.5f, 0.4f); + func_81409C6C(arg0); + } + break; + + case 3: + func_81408150(arg0); + break; + } + + if (func_8140819C(arg0) != 0) { + func_81409CBC(arg0); + } +} + +void func_8790215C(unk_D_8140E720* arg0) { + func_8140B938(arg0, 0.25f); + func_8140A594(arg0, func_81400A78(0x10000)); + func_8140AD8C(arg0, (2.0f * MathUtil_Random_ZeroOne()) + 2.0f); + func_8140AF24(arg0, (MathUtil_Random_ZeroOne() * 3.0f) + 1.0f); + func_8140D5A0(arg0, 0xA); + func_8140BC20(arg0, 0x64); + func_8140BCA8(arg0, 7); + func_814081BC(arg0); +} + +void func_87902224(unk_D_8140E720* arg0) { + switch (arg0->unk_B2) { + case 1: + func_8790215C(arg0); + break; + + case 2: + func_814084D8(arg0, 0, 7, 1, 2, 0); + func_8140B98C(arg0, 0.8f, 0.1f); + func_8140ADBC(arg0, 1.0f, 1); + if (func_8140BDAC(arg0) != 0) { + func_8140B180(arg0, 0.5f, 0.4f); + func_81409C6C(arg0); + } + break; + + case 3: + func_81408150(arg0); + break; + } + + if (func_8140819C(arg0) != 0) { + func_81409CBC(arg0); + } +} + +void func_87902318(unk_D_8140E720* arg0) { + func_8140B938(arg0, 0.5f); + func_8140959C(arg0, 3, 0, 3); + func_8140A594(arg0, func_81400A78(0x10000)); + func_8140AD8C(arg0, (MathUtil_Random_ZeroOne() * 3.0f) + 3.0f); + func_8140AF24(arg0, (2.0f * MathUtil_Random_ZeroOne()) + 4.0f); + func_8140D5A0(arg0, 0xA); + func_8140BC20(arg0, 0x64); + func_8140BCA8(arg0, 7); + func_814081BC(arg0); +} + +void func_879023EC(unk_D_8140E720* arg0) { + switch (arg0->unk_B2) { + case 1: + func_87902318(arg0); + break; + + case 2: + func_814084D8(arg0, 0, 7, 1, 2, 0); + func_8140B98C(arg0, 1.0f, 0.05f); + func_8140ADBC(arg0, 1.0f, 1); + if (func_8140BDAC(arg0) != 0) { + func_8140B180(arg0, 1.0f, 0.2f); + func_81409C6C(arg0); + } + break; + + case 3: + func_81408150(arg0); + break; + } + + if (func_8140819C(arg0) != 0) { + func_81409CBC(arg0); + } +} + +void func_879024DC(unk_D_8140E720* arg0) { + Vec3s sp28; + + func_8140BAC8(arg0, 0xC8, 0xAA, 0x64); + func_8140BB74(arg0, 0x3A, 0x18, 0x18); + func_8140B938(arg0, (MathUtil_Random_ZeroOne() * 0.1f) + 0.1f); + + sp28.x = func_81400B00(0x800) - 0x3800; + sp28.y = func_81400B00(0x1000) + 0x8000; + sp28.z = 0; + + func_8140A4F0(arg0, sp28); + func_8140AD8C(arg0, (func_81400A78(0xA) * 0.3f) + 6.0f); + func_8140B2B4(arg0); + func_8140BC20(arg0, 0xFF); + func_814081BC(arg0); +} + +void func_87902608(unk_D_8140E720* arg0) { + switch (arg0->unk_B2) { + case 1: + func_879024DC(arg0); + break; + + case 2: + if (arg0->unk_54 < 0.0f) { + func_81408150(arg0); + } + break; + } + + if (func_8140819C(arg0) != 0) { + if (arg0->unk_30 > 0.0f) { + func_81408328(arg0); + } else { + func_81408348(arg0); + } + func_8140B0A4(arg0, -8.0f, 1.0f); + func_81409BDC(arg0); + } +} + +void func_879026D8(unk_D_8140E720* arg0) { + Vec3s sp28; + s16 sp26 = func_8140C038(arg0); + + func_8140C040(arg0); + + sp28.x = func_81400A78(0x10000); + sp28.y = func_81400A78(0x10000); + sp28.z = 0; + + func_8140A24C(arg0, sp28); + func_8140AD8C(arg0, 0.0f); + func_8140ADA4(arg0, 0); + func_8140D5A0(arg0, 0x17); + func_8140B938(arg0, 0.0f); + func_8140B95C(arg0, 0.6f); + func_8140B974(arg0, 0.1f); + func_81409404(arg0, 0x14, 0xA); + func_8140935C(arg0, 0xF, 0xF); + func_81409514(arg0, 0x14, 0xA); + func_8140BCA8(arg0, sp26); + func_81408348(arg0); + func_814081BC(arg0); +} + +void func_879027F0(unk_D_8140E720* arg0) { + switch (arg0->unk_B2) { + case 1: + func_879026D8(arg0); + break; + + case 2: + if (func_8140BDD0(arg0) != 0) { + func_81408328(arg0); + } + break; + + case 3: + if (func_8140BA48(arg0) != 0) { + func_8140B95C(arg0, 0.0f); + } + break; + + case 4: + func_8140BA48(arg0); + break; + + case 5: + func_81408150(arg0); + break; + } + + if (func_81408368(arg0) != 0) { + func_81409FD8(arg0); + if (arg0->unk_30 < 0.0f) { + func_81408150(arg0); + } + } +} + +void func_879028E0(unk_D_8140E720* arg0) { + Vec3s sp28; + s16 sp26 = func_8140C038(arg0); + + sp28.x = func_81400A78(0x10000); + sp28.y = func_81400A78(0x10000); + sp28.z = 0; + + func_8140A24C(arg0, sp28); + func_8140AD8C(arg0, 0.0f); + func_8140ADA4(arg0, 0.0f); + func_8140D5A0(arg0, 0x17); + func_8140B938(arg0, 0.0f); + func_8140B95C(arg0, 0.2f); + func_8140B974(arg0, 0.035f); + func_81409404(arg0, 7, 3); + func_8140935C(arg0, 0x14, 0xA); + func_81409514(arg0, 7, 3); + func_8140BCA8(arg0, sp26); + func_81408348(arg0); + func_814081BC(arg0); +} + +void func_879029F0(unk_D_8140E720* arg0) { + switch (arg0->unk_B2) { + case 1: + func_879028E0(arg0); + break; + + case 2: + if (func_8140BDD0(arg0) != 0) { + func_81408328(arg0); + } + break; + + case 3: + if (func_8140BA48(arg0) != 0) { + func_8140B95C(arg0, 0.0f); + } + break; + + case 4: + func_8140BA48(arg0); + break; + + case 5: + func_81408150(arg0); + break; + } + + if (func_81408368(arg0) != 0) { + func_81409FD8(arg0); + if (arg0->unk_30 < 0.0f) { + func_81408150(arg0); + } + } +} + +void func_87902AE0(unk_D_8140E720* arg0) { + Vec3s sp30; + + func_8140BAC8(arg0, 0xFF, 0xFF, 0xFF); + func_8140BB74(arg0, 0x64, 0xC8, 0xFF); + func_8140B938(arg0, (MathUtil_Random_ZeroOne() * 0.2f) + 0.3f); + + sp30.x = func_81400B00(0x1800) - 0x3000; + sp30.y = func_81400B00(0x10000); + sp30.z = 0; + + func_8140A4F0(arg0, sp30); + + func_81408E18(arg0, func_81400B00(0xA) * 0.1f, func_81400A78(0xA) * 0.25f, func_81400B00(0xA) * 0.1f); + func_8140AD8C(arg0, (func_81400A78(5) * 0.35f) + 4.0f); + func_8140B2B4(arg0); + func_8140BC20(arg0, 0xFF); + func_814081BC(arg0); +} + +void func_87902C9C(unk_D_8140E720* arg0) { + switch (arg0->unk_B2) { + case 1: + func_87902AE0(arg0); + break; + + case 2: + if (arg0->unk_54 < -2.5f) { + func_81408150(arg0); + } + break; + } + + if (func_8140819C(arg0) != 0) { + func_8140B0A4(arg0, -8.0f, 0.8f); + func_81409BDC(arg0); + } +} + +void func_87902D3C(Gfx* arg0, unk_D_86002F34_000_014* arg1, UNUSED u16 arg2) { + gDPPipeSync(arg0++); + + gDPSetPrimColor(arg0++, 0, 0xB4, 255, 255, 255, 128); + gDPSetEnvColor(arg0++, 255, 255, 255, 255); + gDPSetCombineLERP(arg0++, TEXEL0, TEXEL1, PRIM_LOD_FRAC, TEXEL1, TEXEL0, TEXEL1, PRIMITIVE, TEXEL1, 0, 0, 0, + COMBINED, COMBINED, 0, SHADE, 0); + + gDPLoadTextureTile(arg0++, arg1->unk_00, G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 0, 0, 0, 31, 31, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, 12, G_TX_NOLOD); + + func_81406204(arg0++, 0xA, 0xE, 0x20, 0x20); + + gDPLoadMultiTile(arg0++, arg1->unk_04, 0x0100, 1, G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 0, 0, 0, 31, 31, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, 1, G_TX_NOLOD); + + func_81406288(arg0++, 5, 7, 0x20, 0x20); + + gSPEndDisplayList(arg0++); +} + +void func_87902F80(s32 arg0, arg1_func_87902F80* arg1) { + if (arg0 == 2) { + arg1->unk_18 = func_80005F5C(sizeof(Gfx) * 30); + func_87902D3C(arg1->unk_18, arg1->unk_00.unk_14, D_8006F084); + } +} + +void func_87902FC8(Gfx* arg0, unk_D_86002F34_000_014* arg1, UNUSED u16 arg2) { + gDPPipeSync(arg0++); + + gDPSetPrimColor(arg0++, 0, 0xC8, 255, 255, 255, 180); + gDPSetEnvColor(arg0++, 255, 255, 255, 255); + gDPSetCombineLERP(arg0++, TEXEL0, TEXEL1, PRIM_LOD_FRAC, TEXEL1, TEXEL0, TEXEL1, PRIMITIVE, TEXEL1, 0, 0, 0, + COMBINED, COMBINED, 0, SHADE, 0); + + gDPLoadTextureTile(arg0++, arg1->unk_00, G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 0, 0, 0, 31, 31, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, 15, 1); + + func_81406204(arg0++, 2, 6, 0x20, 0x20); + + gDPLoadMultiTile(arg0++, arg1->unk_04, 0x0100, 1, G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 0, 0, 0, 31, 31, 0, + G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 5, 5, 1, G_TX_NOLOD); + + func_81406288(arg0++, -2, 0xC, 0x20, 0x20); + + gSPEndDisplayList(arg0++); +} + +void func_8790320C(s32 arg0, arg1_func_87902F80* arg1) { + if (arg0 == 2) { + arg1->unk_18 = func_80005F5C(sizeof(Gfx) * 30); + func_87902FC8(arg1->unk_18, arg1->unk_00.unk_14, D_8006F084); + } +} diff --git a/src/fragments/3/fragment3_11BBF0.c b/src/fragments/3/fragment3_11BBF0.c index aff53af3..90841faf 100644 --- a/src/fragments/3/fragment3_11BBF0.c +++ b/src/fragments/3/fragment3_11BBF0.c @@ -1,13 +1,404 @@ -#include "global.h" +#include "fragment3.h" +#include "src/fragments/2/fragment2.h" +#include "src/1CF30.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BBF0/func_87903260.s") +void func_8140C84C(); +void func_8140CDDC(); +void func_8140C7C0(); +void func_8140C8B8(); -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BBF0/func_87903294.s") +extern u32 D_87903E80[]; +extern u32 D_87904E80[]; +extern u32 D_87905280[]; +extern u32 D_87905680[]; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BBF0/func_879032BC.s") +unk_D_87903E00 D_87903E00 = { + 0x00000001, + func_8140C84C, + func_8140CDDC, + D_87903E80, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BBF0/func_87903358.s") +unk_D_87903E10 D_87903E10 = { + 0x00000001, + &D_87903E00, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BBF0/func_879033FC.s") +unk_D_87903E00 D_87903E18 = { + 0x01000001, + func_8140C7C0, + func_8140CDDC, + D_87904E80, +}; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BBF0/func_8790354C.s") +unk_D_87903E10 D_87903E28 = { + 0x00000001, + &D_87903E18, +}; + +unk_D_87903E00 D_87903E30 = { + 0x01000002, + func_8140C7C0, + func_8140CDDC, + D_87905280, +}; + +unk_D_87903E10 D_87903E40 = { + 0x00000001, + &D_87903E30, +}; + +unk_D_87903E00 D_87903E48 = { + 0x00000001, + func_8140C8B8, + func_8140CDDC, + D_87905680, +}; + +unk_D_87903E10 D_87903E58 = { + 0x00000001, + &D_87903E48, +}; + +s16 D_87903E60[4][4] = { + { 0x006E, 0x006E, 0x006E, 0x006E }, + { 0x0060, 0x007C, 0x006E, 0x006E }, + { 0x0054, 0x006E, 0x0088, 0x006E }, + { 0x0046, 0x0060, 0x007C, 0x0096 }, +}; + +u32 D_87903E80[] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x01000000, 0x00000000, 0x00000000, 0x00001111, 0x22221000, 0x00000000, + 0x00000000, 0x11244434, 0x43442000, 0x00000000, 0x00000000, 0x13344445, 0x65632000, 0x00000000, 0x00000001, + 0x24554666, 0x77851000, 0x00000000, 0x00000001, 0x24443556, 0x78852000, 0x00000000, 0x00000001, 0x13554455, + 0x88752000, 0x00000000, 0x00000000, 0x23544455, 0x78751100, 0x00000000, 0x00000002, 0x25643566, 0x88643100, + 0x00000000, 0x00000003, 0x46743343, 0x68853320, 0x00000000, 0x00000003, 0x57633543, 0x58A96431, 0x00000000, + 0x00000001, 0x23334754, 0x56774333, 0x10000000, 0x00000002, 0x34346664, 0x55563321, 0x10000000, 0x00000002, + 0x33445443, 0x67442422, 0x00000000, 0x00000000, 0x12333444, 0x66423332, 0x10000000, 0x00000000, 0x01023444, + 0x55422122, 0x00000000, 0x00000000, 0x00001123, 0x45410000, 0x00000000, 0x00000000, 0x00000001, 0x11100000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000122, 0x11100000, 0x00000000, 0x00000000, 0x00123345, 0x54221000, 0x00000000, 0x00000011, 0x12666567, + 0x76574100, 0x00000000, 0x00000012, 0x34566789, 0x98895200, 0x00000000, 0x00000013, 0x76458A9A, 0xABBA5200, + 0x00000000, 0x00000026, 0x9866899A, 0xBCCA7410, 0x00000000, 0x00000015, 0x88678AAA, 0xBCC97420, 0x00000000, + 0x00000012, 0x6977888A, 0xBAA95310, 0x00000000, 0x00000013, 0x68856579, 0x9A894210, 0x00000000, 0x00000113, + 0x8986667A, 0xAA895320, 0x00000000, 0x00000145, 0x8A975679, 0xA9BA8532, 0x10000000, 0x00000158, 0xABA87746, + 0x8BCBA753, 0x20000000, 0x00000025, 0xA98ABA86, 0x8CCCA752, 0x31000000, 0x00000013, 0x67789B97, 0x7ABA9843, + 0x42100000, 0x00000014, 0x67887AB9, 0x78997455, 0x41000000, 0x00000024, 0x56788897, 0x79A75455, 0x51000000, + 0x00000012, 0x45256566, 0x8AA73454, 0x41000000, 0x00000001, 0x11134665, 0x69852221, 0x10000000, 0x00000000, + 0x00002555, 0x57752000, 0x00000000, 0x00000000, 0x00001232, 0x33442000, 0x00000000, 0x00000000, 0x00000000, + 0x00110000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000022, 0x10000000, 0x00000000, 0x00000000, 0x00122366, 0x43100000, + 0x00000000, 0x00000000, 0x01443458, 0x87321000, 0x00000000, 0x00000000, 0x04866899, 0x99685300, 0x00000000, + 0x00000232, 0x23789BBB, 0xBAAB7400, 0x00000000, 0x00001246, 0x6345BCBA, 0xCDDB9410, 0x00000000, 0x0000135A, + 0xA778BBBC, 0xCDDDB652, 0x00000000, 0x0000049C, 0xB999BACD, 0xDDDCA942, 0x00000000, 0x0000138C, 0xB988ABDD, + 0xDDDA8842, 0x00000000, 0x00000158, 0xBB988ACC, 0xCAB97521, 0x00000000, 0x00000146, 0xAA9879BA, 0xCBAA7552, + 0x00000000, 0x00000149, 0xBA8899BB, 0xCBAB7561, 0x00000000, 0x0000135A, 0xB9899ABB, 0xBCDDC974, 0x11000000, + 0x0000158B, 0xCBB9AAA9, 0x8BDEDA64, 0x21200000, 0x0000158C, 0xBBBBCCA8, 0xACEEDB87, 0x63200000, 0x00000149, + 0x98ACCCBB, 0xBDEDCBA9, 0x62210000, 0x00000037, 0x8789BDCB, 0xACCCA987, 0x65310000, 0x00000136, 0xAAA9ACDB, + 0x99AB9777, 0x57200000, 0x00000146, 0x89A99BCC, 0xBBCB8564, 0x45200000, 0x00000134, 0x6555789A, 0xBCCB7334, + 0x22100000, 0x00000012, 0x10157678, 0x9BAA6311, 0x00000000, 0x00000000, 0x00035555, 0x66775200, 0x00000000, + 0x00000000, 0x00013333, 0x33233100, 0x00000000, 0x00000000, 0x00000111, 0x10000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000132, 0x20000000, 0x00000000, 0x00000000, 0x00111478, 0x64100000, 0x00000000, 0x00000000, + 0x0232357A, 0xA7320000, 0x00000000, 0x00000000, 0x157688AB, 0xB9863200, 0x00000000, 0x00000000, 0x15899ACC, + 0xBABA7520, 0x00000000, 0x00012342, 0x13579CCB, 0xBCDCA830, 0x00000000, 0x00012487, 0x3569BCDC, 0xDEDCDB64, + 0x20000000, 0x000147B8, 0x699ABCDE, 0xEEECCBA5, 0x10000000, 0x000169CB, 0xAA9AADEE, 0xEEEDA9A6, 0x10000000, + 0x000149BC, 0xCA99BDDE, 0xEDDA7984, 0x21000000, 0x0000269C, 0xDB97ACDD, 0xDBB85644, 0x31000000, 0x0000147A, + 0xAB98ACCD, 0xECCA8767, 0x20000000, 0x00001479, 0xABAA9BBC, 0xDDCA9964, 0x00000000, 0x000114AB, 0xB9A9ACCC, + 0xDCDDDC83, 0x01100000, 0x000135AB, 0xBBCBBBCB, 0xBCEEED95, 0x13210000, 0x000158AC, 0xCCCCDDCC, 0xCDEFEDB7, + 0x47410000, 0x0000259A, 0x9AACDCCB, 0xCDEEECA7, 0x78411000, 0x00000157, 0x79BCDDDC, 0xCCCDCA97, 0x77321000, + 0x00000149, 0x89A9BEED, 0xCBABB898, 0x54630000, 0x00000149, 0xAAB8ADDB, 0xCCBBB867, 0x43510000, 0x00000257, + 0x8A989BBC, 0xDDCCB534, 0x32200000, 0x00000134, 0x44458AAB, 0xBBCCB521, 0x10000000, 0x00000000, 0x0003887A, + 0xABC98420, 0x00000000, 0x00000000, 0x00047756, 0x56634310, 0x00000000, 0x00000000, 0x00024432, 0x22211100, + 0x00000000, 0x00000000, 0x00001211, 0x21000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000122, + 0x10000000, 0x00000000, 0x00000000, 0x00000377, 0x52000000, 0x00000000, 0x00000000, 0x1112358A, 0x85200000, + 0x00000000, 0x00000000, 0x2468889B, 0xA8631210, 0x00000000, 0x00000000, 0x257789AB, 0xA9A84531, 0x00000000, + 0x00001000, 0x12567889, 0xABCB9851, 0x00000000, 0x00012420, 0x13469BCB, 0xCDDCCB73, 0x20000000, 0x00124742, + 0x5678ADEE, 0xEEECCCA8, 0x30000000, 0x00147964, 0x68A9ADEE, 0xEEFDA9A9, 0x30000000, 0x00158999, 0xA999ADEE, + 0xEEEB98A7, 0x21000000, 0x000379BB, 0x978AACDC, 0xCD964565, 0x42000000, 0x000158BC, 0xA978ACCC, 0xCB765327, + 0x51000000, 0x00003899, 0xBAA98ABD, 0xDB987534, 0x10000000, 0x00003777, 0xCAA989AC, 0xCBA99853, 0x00000000, + 0x00016889, 0xA998ABCC, 0xCCDCBA64, 0x20010000, 0x00004789, 0x9ABABBAC, 0xCCEECCA7, 0x31031000, 0x0012689B, + 0xCCCCCCBD, 0xCDEEDDB7, 0x32341000, 0x0002568B, 0xCBABCCCC, 0xCEEEDC95, 0x43342000, 0x00001247, 0xAA8BDDDD, + 0xCCCDB877, 0x44641000, 0x00000146, 0x8BAADEEE, 0xDA88A956, 0x54442000, 0x00000157, 0x7A87ADED, 0xDC888845, + 0x42220000, 0x00000257, 0x8B979CDC, 0xCDCB9843, 0x31000000, 0x00000144, 0x57658ABA, 0xACDBA931, 0x10000000, + 0x00000012, 0x212589AA, 0x999A8831, 0x00000000, 0x00000000, 0x00136887, 0x89986520, 0x00000000, 0x00000000, + 0x00025754, 0x55542210, 0x00000000, 0x00000000, 0x00013431, 0x12100000, 0x00000000, 0x00000000, 0x00000110, + 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000233, 0x10000000, 0x00000000, 0x00000000, 0x11222466, 0x31100000, 0x00000000, 0x00000000, + 0x24555677, 0x54330000, 0x00000000, 0x00000000, 0x23346788, 0x66773220, 0x00000000, 0x00000000, 0x01245456, + 0x67995651, 0x00000000, 0x00000000, 0x01234577, 0x9AABA962, 0x00000000, 0x00001101, 0x12236ABB, 0xCCCCBA84, + 0x20000000, 0x00013102, 0x35569BDC, 0xCDDD9776, 0x30000000, 0x00234324, 0x6876ACCB, 0xDECB9667, 0x30000000, + 0x00245568, 0x66879BBB, 0xCDA75565, 0x21000000, 0x00134697, 0x447769A9, 0x98643324, 0x31000000, 0x00014798, + 0x65578999, 0x87643213, 0x10000000, 0x00014679, 0x99987799, 0x98766412, 0x00000000, 0x00035559, 0x99965698, + 0x78877542, 0x11000000, 0x00367668, 0x886679A9, 0x89A88665, 0x31000000, 0x00256566, 0x7878AAAA, 0xAAA8A987, + 0x31001000, 0x00155378, 0x9BBAAAAA, 0xAABBBA96, 0x21212000, 0x002468AB, 0xBBBBAABB, 0xBCCBB954, 0x31102000, + 0x0001147B, 0xB889ACDC, 0xBDB98654, 0x21123100, 0x00000138, 0xA979CEED, 0xCA875553, 0x22242000, 0x00000026, + 0x9877ACCD, 0xCA755641, 0x21110000, 0x00000124, 0x88458ABB, 0xBB756532, 0x10000000, 0x00000123, 0x78357899, + 0xAA9A9433, 0x10000000, 0x00000012, 0x33247888, 0x999B8553, 0x00000000, 0x00000001, 0x00037877, 0x77575243, + 0x00000000, 0x00000000, 0x00134443, 0x24542132, 0x00000000, 0x00000000, 0x00012221, 0x12311110, 0x00000000, + 0x00000000, 0x00001220, 0x12100000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00100111, 0x00000000, 0x00000000, 0x00000000, 0x12212232, 0x10110000, + 0x00000000, 0x00000000, 0x11112333, 0x11342000, 0x00000000, 0x00000000, 0x00022222, 0x24652330, 0x00000000, + 0x00000000, 0x00021123, 0x35775541, 0x00000000, 0x00000000, 0x00012235, 0x77896562, 0x00000000, 0x00000000, + 0x11113368, 0x78AA5352, 0x10000000, 0x00000001, 0x33234689, 0x89A96222, 0x10000000, 0x00011013, 0x34346789, + 0x98865322, 0x10000000, 0x00112233, 0x23544678, 0x76432111, 0x00000000, 0x00012342, 0x23335566, 0x43211101, + 0x00000000, 0x00012333, 0x33455333, 0x22221100, 0x00000000, 0x00002345, 0x66665223, 0x24432210, 0x00000000, + 0x00011244, 0x68643233, 0x23443311, 0x10000000, 0x01221234, 0x66333454, 0x34333221, 0x21000000, 0x01344222, + 0x54356666, 0x56443344, 0x31000000, 0x00232233, 0x57866666, 0x55644443, 0x20000000, 0x01222466, 0x88987767, + 0x78854331, 0x10000000, 0x00014689, 0x778678AA, 0xAA743221, 0x10000000, 0x00001256, 0x567679BA, 0x88742111, + 0x10011000, 0x00000035, 0x66457889, 0xA7531121, 0x00000000, 0x00000014, 0x55335657, 0x75422221, 0x00000000, + 0x00000003, 0x42135665, 0x56424311, 0x10000000, 0x00000001, 0x22023444, 0x58677412, 0x10000000, 0x00000000, + 0x00014544, 0x57455212, 0x10000000, 0x00000000, 0x00025533, 0x33212002, 0x10000000, 0x00000000, 0x00023122, + 0x00110011, 0x00000000, 0x00000000, 0x00010000, 0x00100000, 0x00000000, 0x00000000, 0x00000100, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00121000, 0x00000000, 0x00000000, 0x00000000, 0x01221110, 0x00000000, 0x00000000, 0x00000000, + 0x01332220, 0x00000000, 0x00000000, 0x00000001, 0x12443221, 0x00000000, 0x00000000, 0x00000001, 0x23442121, + 0x00000000, 0x00000000, 0x00000013, 0x22442000, 0x00000000, 0x00000000, 0x10001124, 0x31342100, 0x00000000, + 0x00000000, 0x10011124, 0x21221000, 0x00000000, 0x00000000, 0x11111112, 0x32100000, 0x00000000, 0x00000000, + 0x11111111, 0x11100000, 0x00000000, 0x00000000, 0x01221000, 0x01110000, 0x00000000, 0x00000001, 0x23331000, + 0x00111000, 0x00000000, 0x00000011, 0x24320000, 0x00000000, 0x00000000, 0x00000001, 0x23320111, 0x00000000, + 0x00000000, 0x00011011, 0x23232211, 0x11100000, 0x00000000, 0x00121100, 0x13433221, 0x11110000, 0x00000000, + 0x00110223, 0x34323323, 0x43311000, 0x00000000, 0x00011235, 0x64323335, 0x65310000, 0x00000000, 0x00001243, + 0x33323355, 0x44320000, 0x00000000, 0x00000121, 0x23312244, 0x43210000, 0x00000000, 0x00000011, 0x22111211, + 0x23210000, 0x00000000, 0x00000001, 0x11002221, 0x12101100, 0x00000000, 0x00000000, 0x00012221, 0x13211100, + 0x00000000, 0x00000000, 0x00000011, 0x13333100, 0x00000000, 0x00000000, 0x00001100, 0x12111000, 0x00000000, + 0x00000000, 0x00002100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +}; + +u32 D_87904E80[] = { + 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, + 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, + 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xE0E0D0C0, 0xE0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, + 0xF0F0F0F0, 0xE0D0C1B3, 0xB6B9AD9B, 0x92D0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xD0C0B1A4, + 0xA79B9E9F, 0xAFAFAF8F, 0x7E95C0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0D0A4, 0x999C8E8F, 0x8F8F9F9F, + 0x9F9F8F7F, 0x7F8F89A1, 0xE0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0C0977F, 0x8F8F9F8F, 0x8F8F8F8F, 0x8F8F7F6F, + 0x6F7F7F7D, 0x94C0F0F0, 0xF0F0F0F0, 0xF0F0F0E0, 0xB0898F9F, 0x9F8F8F7F, 0x7F7F7F7F, 0x7F7F7F7F, 0x7F7F6F6F, + 0x6F78B1F0, 0xF0F0F0F0, 0xF0F0E0A1, 0x6B7F9F9F, 0x9F8F7F6F, 0x6F7F7F7F, 0x7F7F6F7F, 0x7F7F6F6F, 0x7F7F96D0, + 0xF0F0F0F0, 0xF0E0935D, 0x6F7F8F8F, 0x8F7F6F6F, 0x6F7F7F7F, 0x7F7F7F7F, 0x7F8F7F7F, 0x7F8F86C0, 0xF0F0F0F0, + 0xD0956E6F, 0x6F8F8F8F, 0x7F6F6F6F, 0x6F6F6F6F, 0x7F7F6F7F, 0x7F7F7F7F, 0x7F6F67C0, 0xF0F0F0C0, 0x786F7F6F, + 0x6F8F8F7F, 0x6F6F6F6F, 0x6F5F6F6F, 0x7F6F6F6F, 0x6F6F5F6F, 0x6F4F57C0, 0xF0F0D077, 0x5F6F6F6F, 0x5F7F7F6F, + 0x6F6F6F6F, 0x5F5F5F6F, 0x6F6F6F6F, 0x6F5F5F5F, 0x5F3F57C0, 0xF0F0936F, 0x5F4F4F3F, 0x3F5F6F6F, 0x6F6F6F6F, + 0x5F5F5F6F, 0x6F6F6F6F, 0x6F6F6F5F, 0x4F4F68C0, 0xF0B06B5F, 0x4F4F4F4F, 0x4F4F5F6F, 0x6F6F7F6F, 0x6F5F5F5F, + 0x6F6F6F6F, 0x6F6F6F6F, 0x5F5F68C0, 0xF0904E4F, 0x4F4F4F4F, 0x4F4F4F5F, 0x6F6F7F7F, 0x6F6F6F6F, 0x6F6F6F6F, + 0x6F5F6F6F, 0x6F6F78C0, 0xF0723F3F, 0x4F4F4F3F, 0x4F4F4F4F, 0x4F4F5F7F, 0x7F7F7F7F, 0x7F7F6F6F, 0x5F6F6F6F, + 0x6F6F79C0, 0xE0542F3F, 0x3F3F3F3F, 0x3F4F4F4F, 0x3F3F4F7F, 0x7F7F7F7F, 0x6F6F5F5F, 0x5F5F6F6F, 0x5F5F79C0, + 0xD0552F3F, 0x3F3F3F3F, 0x3F3F3F3F, 0x3F3F5F7F, 0x7F7F6F5F, 0x5F5F5F5F, 0x5F5F6F6F, 0x5F5F6AB0, 0xB0473F3F, + 0x3F3F3F2F, 0x2F2F2F3F, 0x3F3F4F6F, 0x6F5F5F5F, 0x4F4F5F6F, 0x6F6F6F7F, 0x6F5F69B0, 0xA0393F3F, 0x3F3F3F2F, + 0x2F2F3F3F, 0x3F3F4F5F, 0x5F5F4F4F, 0x4F4F5F6F, 0x6F5F7F8F, 0x7F6A91F0, 0xD0723A3F, 0x3F3F3F3F, 0x3F3F4F4F, + 0x4F3F4F4F, 0x5F5F4F4F, 0x4F5F6F5F, 0x4F4F6F7F, 0x88B0F0F0, 0xF0E0A056, 0x3E3F3F4F, 0x4F4F4F5F, 0x4F4F4F4F, + 0x5F5F5F5F, 0x5F4F4F4F, 0x3F3F5F86, 0xC0F0F0F0, 0xF0F0F0D0, 0x81493F5F, 0x4F3F4F4F, 0x5F4F4F4F, 0x5F5F5F5F, + 0x4F3F3F3F, 0x3F3E74D0, 0xF0F0F0F0, 0xF0F0F0F0, 0xE0A0483F, 0x3F2F3F3F, 0x4F4F5F4F, 0x4F4F4F3F, 0x3F2F2F3F, + 0x4C82D0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0902B, 0x2F2F2F2F, 0x3F3F4F3F, 0x2F2F3F3F, 0x3F2F2F5A, 0x91E0F0F0, + 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0E061, 0x2D2F2F2F, 0x2F3F3F3F, 0x2F2F3F4F, 0x4F3F58A0, 0xF0F0F0F0, 0xF0F0F0F0, + 0xF0F0F0F0, 0xF0F0F0D0, 0x532F2F1F, 0x2F3F3F3F, 0x2F1F2F3F, 0x4E66B0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, + 0xF0F0F0F0, 0xC0461F1F, 0x2F2F3F3E, 0x3B384673, 0x91C0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, + 0xF0A0383B, 0x58567381, 0x90B0D0E0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0B0A0, + 0xC0D0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, + 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, 0xF0F0F0F0, +}; + +u32 D_87905280[] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000102, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000113, + 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000223, 0x02000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000234, 0x02000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00001345, 0x13000000, 0x00000000, 0x00000000, + 0x00000000, 0x00010100, 0x00000000, 0x00000000, 0x00002367, 0x23000000, 0x00000000, 0x00000000, 0x01010000, + 0x00000102, 0x01010000, 0x00000000, 0x00002488, 0x24000000, 0x00000000, 0x00010102, 0x01000000, 0x00000001, + 0x02131202, 0x00000000, 0x000035AB, 0x35000000, 0x00000002, 0x12130201, 0x00000000, 0x00000000, 0x01022434, + 0x23020000, 0x011246EE, 0x46120100, 0x00022334, 0x24020100, 0x00000000, 0x00000000, 0x00000224, 0x56563502, + 0x234588FF, 0x88452302, 0x35565634, 0x02000000, 0x00000000, 0x00000000, 0x00000002, 0x2467AA89, 0x67BBFFFF, + 0xFFBB6789, 0xAB672402, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x001367EE, 0xFFFFFFFF, 0xFFFFFFEE, + 0x67130000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00012367, 0xFFFFFFFF, 0xFFFFFF67, 0x23010000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00012377, 0xFFFFFFFF, 0xFFFFFF77, 0x23010000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00012367, 0xFFFFFFFF, 0xFFFFFF67, 0x23010000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x001367EE, 0xFFFFFFFF, 0xFFFFFFEE, 0x67130000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x2467AA89, 0x67BBFFFF, 0xFFBB6789, 0xAB672402, 0x00000000, 0x00000000, 0x00000000, 0x00000224, + 0x56563502, 0x234588FF, 0x88452302, 0x35566734, 0x02000000, 0x00000000, 0x00000000, 0x01022434, 0x23020000, + 0x011246EE, 0x46120100, 0x00022334, 0x24020100, 0x00000000, 0x00000001, 0x02131202, 0x00000000, 0x000035AB, + 0x35000000, 0x00000002, 0x12130201, 0x00000000, 0x00000102, 0x01010000, 0x00000000, 0x00002489, 0x24000000, + 0x00000000, 0x00010102, 0x01000000, 0x00010100, 0x00000000, 0x00000000, 0x00002367, 0x23000000, 0x00000000, + 0x00000000, 0x01010000, 0x00000000, 0x00000000, 0x00000000, 0x00001345, 0x13000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000234, 0x02000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000223, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000113, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000102, 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, +}; + +u32 D_87905680[] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00013000, 0x00000000, 0x00000000, 0x00000000, 0x0012A000, 0x00000000, 0x00000000, 0x00000000, 0x00284000, + 0x00000000, 0x00000000, 0x00000000, 0x00110000, 0x00000000, 0x00000000, 0x00000000, 0x00001100, 0x00000000, + 0x00000000, 0x00000000, 0x00012621, 0x00000000, 0x00000000, 0x00000000, 0x01237C12, 0x235C5000, 0x00000000, + 0x00000000, 0x126BD212, 0x4DF81000, 0x00000000, 0x00000000, 0x25E32112, 0x35100000, 0x00011110, 0x00000002, + 0x3B511111, 0x11000000, 0x00126B86, 0x20000002, 0x31101111, 0x00000000, 0x00123678, 0x10000001, 0x200024BC, + 0xA0000000, 0x23012331, 0x00001127, 0x00001364, 0x20000000, 0xFA000000, 0x000023B8, 0x00000000, 0x00000000, + 0x10000000, 0x000034C1, 0x00000000, 0x00000000, 0x00000000, 0x10003300, 0x00000000, 0x00000000, 0x00000001, + 0x53000000, 0x00000000, 0x00000000, 0x0000013A, 0xA0000000, 0x00000000, 0x00000000, 0x00000277, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00012100, 0x00000000, 0x00000000, 0x00000000, 0x00012100, + 0x00000000, 0x00000000, 0x00000000, 0x00012100, 0x00000000, 0x00000000, 0x00000000, 0x00014700, 0x00000000, + 0x00000000, 0x00000000, 0x00128100, 0x00000000, 0x00000000, 0x00000000, 0x00120000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000237, 0x30000000, 0x00000000, 0x00000000, + 0x0012239A, 0x00000000, 0x00000000, 0x00000000, 0x0024D7C1, 0x00000000, 0x00000000, 0x00000000, 0x013AA210, + 0x00000000, 0x00000000, 0x00000000, 0x023C1000, 0x00000000, 0x11111000, 0x00000000, 0x01110000, 0x00000000, + 0x23431000, 0x00000000, 0x01100000, 0x00000000, 0x39FEC400, 0x00000011, 0x10000000, 0x00000000, 0x12332000, + 0x00000121, 0x11100002, 0x8DB80000, 0x01111000, 0x0000236F, 0x51100001, 0x24210000, 0x00000000, 0x000038F5, + 0xC1100000, 0x00000000, 0x00000000, 0x000049C5, 0xF1000000, 0x00000000, 0x00000000, 0x00115F44, 0x72000000, + 0x00000000, 0x00000000, 0x00136811, 0x10000000, 0x00000000, 0x00001210, 0x00011100, 0x00000000, 0x00000000, + 0x000024C2, 0x00000000, 0x00000000, 0x00000000, 0x00026C10, 0x00000000, 0x00000000, 0x00000000, 0x00012100, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x27400000, 0x00000000, 0x00000000, 0x00000004, 0xBA000000, 0x00000000, 0x00000000, 0x000037B7, 0xC0000000, + 0x00000000, 0x00000000, 0x00026F33, 0x10000000, 0x00000000, 0x00000000, 0x00239400, 0x00000000, 0x00000000, + 0x00000000, 0x00111100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x62000000, 0x00000001, 0x22000000, 0x00000000, 0xEC000000, 0x00000012, 0xB2000000, + 0x00000000, 0x10000000, 0x00000012, 0x61000000, 0x002ADD92, 0x00000000, 0x00001111, 0x21000000, 0x00122111, + 0x00000000, 0x00012531, 0x10000000, 0x00000000, 0x00000000, 0x0024AA12, 0x21000000, 0x00000000, 0x00000000, + 0x0026B313, 0xC3000000, 0x00000000, 0x00000000, 0x0026D514, 0x88000000, 0x00000000, 0x00000000, 0x002BD003, + 0x59000000, 0x00000000, 0x00010000, 0x00262002, 0x20000000, 0x00000000, 0x00127200, 0x00000000, 0x00000000, + 0x00000000, 0x013B7000, 0x00000000, 0x00000000, 0x00000000, 0x02430000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00220000, 0x00000000, 0x00000000, 0x00000000, 0x00220000, 0x00000000, 0x00000000, 0x00000000, 0x00220000, + 0x00000000, 0x00000000, 0x00000000, 0x012A1000, 0x00000000, 0x00000000, 0x00000124, 0x74AA0000, 0x00000000, + 0x00000000, 0x0000024E, 0x38B10000, 0x00000000, 0x00000000, 0x000013E8, 0x12000000, 0x00000000, 0x00000000, + 0x00002281, 0x00000000, 0x00000000, 0x00000000, 0x00002100, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x10000000, 0x00000000, + 0x00000000, 0x00000002, 0x35200000, 0x00000000, 0x00000000, 0x00000014, 0xDC000000, 0x00000000, 0x00000000, + 0x00000124, 0xF3000000, 0x00000000, 0x00000000, 0x00000123, 0x41000000, 0x000022AB, 0x00000000, 0x00000136, + 0x11000000, 0x00001111, 0x00000000, 0x0000125D, 0x11000000, 0x00000000, 0x00000000, 0x001223B7, 0x11000000, + 0x00000000, 0x00000000, 0x123A9332, 0x11000000, 0x00000000, 0x00000000, 0x15F92111, 0x11000000, 0x00000000, + 0x00000000, 0x14862113, 0x31000000, 0x00000000, 0x00000000, 0x046F2114, 0x5D100000, 0x00000000, 0x00000000, + 0x15E71003, 0x5A400000, 0x00000000, 0x00000000, 0x03400002, 0x35400000, 0x00000000, 0x00000000, 0x00000001, + 0x11000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, +}; + +void func_87903260(void) { + if (D_87903DC4 > 0) { + D_87903DCC = D_87903DC4; + D_87903DC4 = -2; + D_87903DC0 = 1; + } +} + +void func_87903294(void) { + D_87903DC4 = -1; + D_87903DC0 = 0; + D_87903DCC = 0; + D_87903DD0 = 0; +} + +void func_879032BC(s16 arg0) { + switch (D_87903DC0) { + case 1: + D_87903DD0 = 0x18; + D_87903DC8 = arg0; + D_87903DC0++; + break; + + case 2: + D_87903DC8--; + if (D_87903DC8 == 0) { + func_87903294(); + } + break; + } +} + +void func_87903358(s16 arg0, s16 arg1) { + switch (D_87903DC0) { + case 1: + D_87903DD0 = arg0; + D_87903DC8 = arg1; + D_87903DC0++; + break; + + case 2: + D_87903DC8--; + if (D_87903DC8 == 0) { + func_87903294(); + } + break; + } +} + +void func_879033FC(unk_func_8790002C* arg0) { + s32 i; + s16 temp_a2; + s32 var_s2; + + if (1) {} + + gSPDisplayList(gDisplayListHead++, D_8006F518); + gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255); + + var_s2 = 0; + for (i = 0; i < 4; i++) { + if (arg0[i].unk_2A8 != 0) { + temp_a2 = D_87903E60[D_87903DD4][var_s2]; + if (arg0[i].unk_2AC != 0) { + func_87801644(-1 - i, 0x78, temp_a2, 1.0f); + } else { + func_87801644(i, 0x78, temp_a2, 1.0f); + } + var_s2++; + } + } + + gSPDisplayList(gDisplayListHead++, D_8006F630); +} + +void func_8790354C(void) { + switch (D_87906046) { + case 0: + func_8001F1E8(0xC8, 0x20, "(EASY)"); + break; + + case 1: + func_8001F1E8(0xC8, 0x20, "(NORMAL)"); + break; + + case 2: + func_8001F1E8(0xC8, 0x20, "(HARD)"); + break; + + case 3: + func_8001F1E8(0xC8, 0x20, "(SUPER)"); + break; + } +} diff --git a/src/fragments/3/fragment3_11BF90.c b/src/fragments/3/fragment3_11BF90.c index 71caf900..5862c028 100644 --- a/src/fragments/3/fragment3_11BF90.c +++ b/src/fragments/3/fragment3_11BF90.c @@ -1,19 +1,254 @@ -#include "global.h" +#include "fragment3.h" +#include "src/19840.h" +#include "src/1C720.h" +#include "src/memory.h" -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BF90/func_87903600.s") +static unk_func_8790002C* D_87906120; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BF90/func_879036B4.s") +void func_87903600(void) { + s32 i; + unk_func_8790002C* ptr; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BF90/func_8790370C.s") + D_87906120 = main_pool_alloc(sizeof(unk_func_8790002C) * 3, 0); + ptr = D_87906120; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BF90/func_87903778.s") + for (i = 0; i < 3; i++, ptr++) { + func_8001BB58(&ptr->unk_000); + ptr->unk_168 = func_80019D18(0xAB); + func_8001BC34(&ptr->unk_000, 0, ptr->unk_23C, ptr->unk_168->unk_08->unk_00[0]); + func_8001BD04(&ptr->unk_000, 0); + ptr->unk_000.unk_000.unk_01 &= ~1; + func_8790060C(ptr); + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BF90/func_879037D0.s") +void func_879036B4(unk_func_8790002C* arg0) { + if (arg0->unk_23E == 1) { + arg0->unk_000.unk_000.unk_01 |= 1; + func_879002B8(arg0, 0, -1, 0); + arg0->unk_23E++; + } +} -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BF90/func_87903838.s") +void func_8790370C(void) { + s32 i; + unk_func_8790002C* ptr = D_87906120; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BF90/func_879038AC.s") + func_8140C5D0(); + for (i = 0; i < 3; i++, ptr++) { + func_879036B4(ptr); + func_879003A0(ptr); + func_87900770(ptr); + func_87900808(ptr); + } +} + +void func_87903778(unk_func_8790002C* arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, s16 arg5, s16 arg6, s16 arg7, + s16 arg8) { + arg0->unk_16C = arg1; + arg0->unk_170 = arg1; + arg0->unk_174 = arg1; + arg0->unk_1A8 = arg2; + arg0->unk_1AC = arg3; + arg0->unk_1B0 = arg4; + arg0->unk_21A = arg5; + arg0->unk_21C = arg6; + arg0->unk_21E = arg7; + arg0->unk_266 = arg8; + arg0->unk_23E = 1; +} + +void func_879037D0(f32 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s16 arg5, s16 arg6) { + unk_func_8790002C* sp34 = D_87906120; + + func_87903778(sp34, arg0, arg1, arg2, arg3, arg4, arg5, arg6, 0); + sp34->unk_000.unk_000.unk_14 = 0; +} + +void func_87903838(f32 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s16 arg5, s16 arg6) { + unk_func_8790002C* sp34 = &D_87906120[1]; + + func_87903778(sp34, arg0, arg1, arg2, arg3, arg4, arg5, arg6, 1); + sp34->unk_000.unk_000.unk_14 = 1; +} + +void func_879038AC(f32 arg0, f32 arg1, f32 arg2, f32 arg3, s16 arg4, s16 arg5, s16 arg6) { + unk_func_8790002C* sp34 = &D_87906120[2]; + + func_87903778(sp34, arg0, arg1, arg2, arg3, arg4, arg5, arg6, 2); + sp34->unk_000.unk_000.unk_14 = 2; +} + +typedef struct arg1_func_87903D64_014 { + /* 0x00 */ s32 unk_00; + /* 0x04 */ unk_D_86002F34_000_014_004* unk_04; + /* 0x08 */ unk_D_86002F34_000_014_004* unk_08; + /* 0x0C */ unk_D_86002F34_000_014_004* unk_0C; + /* 0x10 */ unk_D_86002F34_000_014_010* unk_10; + /* 0x14 */ unk_D_86002F34_000_014_010* unk_14; + /* 0x18 */ unk_D_86002F34_000_014_010* unk_18; +} arg1_func_87903D64_014; + +// Possibly unk_D_86002F34_alt7, unk_D_86002F34_alt8, +// unk_D_86002F34_alt9 or unk_D_86002F34_alt2 +typedef struct arg1_func_87903D64 { + /* 0x00 */ char unk00[0x14]; + /* 0x00 */ arg1_func_87903D64_014* unk_14; + /* 0x18 */ Gfx* unk_18; +} arg1_func_87903D64; // size >= 0x1C + +#ifdef NON_MATCHING +Gfx* func_87903920(Gfx* arg0, arg1_func_87903D64_014* arg1) { + s32 sp38; + s32 sp34; + s32 sp30; + + unk_D_86002F34_000_014_004* sp2C; + unk_D_86002F34_000_014_004* sp28; + unk_D_86002F34_000_014_010* sp24; + unk_D_86002F34_000_014_010* sp20; + + s32 temp_a2; + s32 temp_t1; + s32 temp_t1_2; + s32 temp_t2; + s32 temp_t2_2; + s32 temp_t2_3; + s32 temp_t4; + s32 var_a0; + s32 var_v1; + u32 temp_a3; + u32 var_v0; + u8* temp_t1_3; + u8* temp_v1; + unk_D_86002F34_000_014_004* var_a1; + unk_D_86002F34_000_014_004* var_a2; + unk_D_86002F34_000_014_010* var_a3; + unk_D_86002F34_000_014_010* var_t0; + u32 tmp1; + u32 tmp2; + u32 tmp3; + u32 tmp4; + u32 tmp5; + u32 tmp6; + u32 tmp7; + u32 tmp8; + u32 tmp9; + + temp_a2 = D_8006F09C->unk_000.unk_14; + temp_a3 = (D_8006F09C->unk_040.unk_08 >> 0x10) + 1; + + switch (arg1->unk_00) { + default: + var_a0 = sp34; + var_v1 = sp38; + var_v0 = sp30; + break; + + case 1: + if (temp_a3 < 0xF) { + var_v1 = 0; + var_v0 = (temp_a3 << 8) / 15; + var_a0 = 1; + } else if (temp_a3 < 0x1D) { + var_v1 = 1; + var_v0 = ((temp_a3 << 8) - 0xF00) / 14; + var_a0 = 2; + } else { + var_v1 = 2; + var_a0 = 2; + var_v0 = 0; + } + break; + + case 2: + if (temp_a3 < 5) { + var_v1 = 0; + var_v0 = (temp_a3 << 8) / 5; + var_a0 = 1; + } else if (temp_a3 < 0xF) { + var_v1 = 1; + var_v0 = ((temp_a3 << 8) - 0x500) / 10; + var_a0 = 2; + } else if (temp_a3 < 0x1D) { + var_v1 = 2; + var_v0 = ((temp_a3 << 8) - 0xF00) / 14; + var_a0 = 3; + } else { + var_v1 = 3; + var_a0 = 3; + var_v0 = 0; + } + break; + } + + switch (temp_a2) { + default: + var_t0 = sp20; + var_a3 = sp24; + var_a2 = sp28; + var_a1 = sp2C; + break; + + case 0: + var_a3 = &arg1->unk_10[var_v1]; + var_t0 = &arg1->unk_10[var_a0]; + var_a1 = &arg1->unk_04[var_v1]; + var_a2 = &arg1->unk_04[var_a0]; + break; + + case 1: + var_a3 = &arg1->unk_14[var_v1]; + var_t0 = &arg1->unk_14[var_a0]; + var_a1 = &arg1->unk_08[var_v1]; + var_a2 = &arg1->unk_08[var_a0]; + break; + + case 2: + var_a3 = &arg1->unk_18[var_v1]; + var_t0 = &arg1->unk_18[var_a0]; + var_a1 = &arg1->unk_0C[var_v1]; + var_a2 = &arg1->unk_0C[var_a0]; + break; + } + + gDPPipeSync(arg0++); + + tmp5 = ((var_a1->unk_00[4] * (0x100 - var_v0)) + (var_a2->unk_00[4] * var_v0)) >> 8; + + tmp1 = ((var_a1->unk_00[0] * (0x100 - var_v0)) + (var_a2->unk_00[0] * var_v0)); + tmp1 >>= 8; + tmp2 = ((var_a1->unk_00[1] * (0x100 - var_v0)) + (var_a2->unk_00[1] * var_v0)); + tmp2 >>= 8; + tmp3 = ((var_a1->unk_00[2] * (0x100 - var_v0)) + (var_a2->unk_00[2] * var_v0)); + tmp3 >>= 8; + tmp4 = ((var_a1->unk_00[3] * (0x100 - var_v0)) + (var_a2->unk_00[3] * var_v0)); + tmp4 >>= 8; + + tmp6 = ((var_a3->unk_00[0] * (0x100 - var_v0)) + (var_t0->unk_00[0] * var_v0)); + tmp6 >>= 8; + tmp7 = ((var_a3->unk_00[1] * (0x100 - var_v0)) + (var_t0->unk_00[1] * var_v0)); + tmp7 >>= 8; + tmp8 = ((var_a3->unk_00[2] * (0x100 - var_v0)) + (var_t0->unk_00[2] * var_v0)); + tmp8 >>= 8; + tmp9 = ((var_a3->unk_00[3] * (0x100 - var_v0)) + (var_t0->unk_00[3] * var_v0)); + tmp9 >>= 8; + + gDPSetPrimColor(arg0++, 0, tmp5, tmp1, tmp2, tmp3, tmp4); + + gDPSetEnvColor(arg0++, tmp1, tmp2, tmp3, tmp4); + + return arg0; +} +#else #pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BF90/func_87903920.s") +#endif + +void func_87903D64(s32 arg0, arg1_func_87903D64* arg1) { + if (arg0 == 5) { + arg1_func_87903D64_014* tmp = arg1->unk_14; -#pragma GLOBAL_ASM("asm/us/nonmatchings/fragments/3/fragment3_11BF90/func_87903D64.s") + gDisplayListHead = func_87903920(gDisplayListHead, tmp); + } +} diff --git a/src/fragments/34/fragment34.h b/src/fragments/34/fragment34.h new file mode 100644 index 00000000..1af21298 --- /dev/null +++ b/src/fragments/34/fragment34.h @@ -0,0 +1,131 @@ +#ifndef _FRAGMENT34_H_ +#define _FRAGMENT34_H_ + +#include "global.h" + +typedef void (*func_unk_D_8140E720_008)(struct unk_D_8140E720*); + +typedef struct unk_D_8140E728_01C_004 { + /* 0x00 */ u8 unk_00; +} unk_D_8140E728_01C_004; + +typedef struct unk_D_8140E728_01C { + /* 0x00 */ s32 unk_00; + /* 0x04 */ unk_D_8140E728_01C_004* unk_04; +} unk_D_8140E728_01C; // size >= 0x8 + +typedef struct unk_D_8140E728 { + /* 0x00 */ f32 unk_00; + /* 0x04 */ Vec3f unk_04; + /* 0x10 */ Vec3s unk_10; + /* 0x18 */ func_unk_D_8140E720_008 unk_18; + /* 0x1C */ unk_D_8140E728_01C* unk_1C; + /* 0x20 */ s32 unk_20; + /* 0x24 */ u16 unk_24; + /* 0x26 */ s16 unk_26; + /* 0x28 */ s16 unk_28; + /* 0x2A */ s8 unk_2A; + /* 0x2B */ s8 unk_2B; + /* 0x2C */ u8 unk_2C; + /* 0x2D */ u8 unk_2D; + /* 0x2E */ u8 unk_2E; + /* 0x2F */ u8 unk_2F; +} unk_D_8140E728; // size = 0x30 + +typedef struct unk_D_8140E720 { + /* 0x00 */ struct unk_D_8140E720* next; + /* 0x04 */ char unk04[0x4]; + /* 0x08 */ func_unk_D_8140E720_008 unk_08; + /* 0x0C */ unk_D_8140E728_01C* unk_0C; + /* 0x10 */ char unk10[0x8]; + /* 0x18 */ s32 unk_18; + /* 0x1C */ char unk1C[0xC]; + /* 0x28 */ f32 unk_28; + /* 0x2C */ char unk2C[0x4]; + /* 0x30 */ f32 unk_30; + /* 0x34 */ char unk34[0x20]; + /* 0x54 */ f32 unk_54; + /* 0x58 */ char unk58[0x10]; + /* 0x68 */ Vec3f unk_68; + /* 0x74 */ char unk74[0x20]; + /* 0x94 */ Vec3s unk_94; + /* 0x9A */ char unk9A[0x10]; + /* 0xAA */ s16 unk_AA; + /* 0xAC */ s16 unk_AC; + /* 0xAE */ char unkAE[0x4]; + /* 0xB2 */ s16 unk_B2; + /* 0xB4 */ char unkB4[0x19]; + /* 0xCD */ u8 unk_CD; + /* 0xCE */ u8 unk_CE; + /* 0xCF */ u8 unk_CF; + /* 0xD0 */ s8 unk_D0; +} unk_D_8140E720; // size = 0xD4 + +extern Gfx D_8140DAE0[]; +extern Gfx D_8140DB30[]; + +extern void* D_8140E620; +extern s32 D_8140E624; +extern Vec3f D_8140E628; + +extern unk_D_8140E720* D_8140E720; +extern unk_D_8140E728* D_8140E728; +extern s32 D_8140E72C; +extern s32 D_8140E734; + +void func_81400930(Vec3f*, Vec3f*); +void func_8140094C(Vec3s*, Vec3s*); +u32 func_81400A78(s32); +s32 func_81400B00(s32); +void func_81406204(Gfx*, s32, s32, s32, s32); +void func_81406288(Gfx*, s32, s32, s32, s32); +void func_81407B04(unk_D_8140E720*); +unk_D_8140E720* func_81407B3C(void); +unk_D_8140E720* func_81407B5C(s32); +void func_81408150(unk_D_8140E720*); +void func_81408158(unk_D_8140E720*); +s32 func_81408180(unk_D_8140E720*); +s32 func_8140819C(unk_D_8140E720*); +void func_814081BC(unk_D_8140E720*); +void func_81408328(unk_D_8140E720*); +void func_81408348(unk_D_8140E720*); +s32 func_81408368(unk_D_8140E720*); +void func_814084D8(unk_D_8140E720*, s32, s32, s32, s32, s32); +void func_81408AF0(unk_D_8140E720*); +void func_81408E18(unk_D_8140E720*, f32, f32, f32); +void func_8140935C(unk_D_8140E720*, s32, s32); +void func_81409404(unk_D_8140E720*, s32, s32); +void func_81409514(unk_D_8140E720*, s32, s32); +void func_8140959C(unk_D_8140E720*, s32, s32, s32); +void func_81409BDC(unk_D_8140E720*); +void func_81409C6C(unk_D_8140E720*); +void func_81409CBC(unk_D_8140E720*); +void func_81409FD8(unk_D_8140E720*); +void func_8140A24C(unk_D_8140E720*, Vec3s); +void func_8140A4F0(unk_D_8140E720*, Vec3s); +void func_8140A594(unk_D_8140E720*, s16); +void func_8140AD8C(unk_D_8140E720*, f32); +void func_8140ADA4(unk_D_8140E720*, f32); +void func_8140ADBC(unk_D_8140E720*, f32, f32); +void func_8140AF24(unk_D_8140E720*, f32); +void func_8140B0A4(unk_D_8140E720*, f32, f32); +void func_8140B180(unk_D_8140E720*, f32, f32); +void func_8140B2B4(unk_D_8140E720*); +void func_8140B938(unk_D_8140E720*, f32); +void func_8140B95C(unk_D_8140E720*, f32); +void func_8140B974(unk_D_8140E720*, f32); +void func_8140B98C(unk_D_8140E720*, f32, f32); +s32 func_8140BA48(unk_D_8140E720*); +void func_8140BAC8(unk_D_8140E720*, s32, s32, s32); +void func_8140BB74(unk_D_8140E720*, s32, s32, s32); +s32 func_8140BDAC(unk_D_8140E720*); +s32 func_8140BDD0(unk_D_8140E720*); +void func_8140BC20(unk_D_8140E720*, s32); +void func_8140BCA8(unk_D_8140E720*, s32); +s16 func_8140C038(unk_D_8140E720*); +void func_8140C040(unk_D_8140E720*); +void func_8140C204(unk_D_86002F34_00C*, Gfx**); +void func_8140C5D0(void); +void func_8140D5A0(unk_D_8140E720*, s32); + +#endif // _FRAGMENT34_H_ diff --git a/src/fragments/36/fragment36.c b/src/fragments/36/fragment36.c index c29fff1b..f8f51eab 100644 --- a/src/fragments/36/fragment36.c +++ b/src/fragments/36/fragment36.c @@ -286,7 +286,7 @@ s32 func_821009B4(void) { s32 var_s0 = 0; s32 var_s2 = 30; - func_8001F738(D_80068BA0); + func_8001F738(gPlayer1Controller); while (var_s0 == 0) { if (D_82100EC8 == 0) { @@ -298,7 +298,7 @@ s32 func_821009B4(void) { func_800290B4(); - if ((D_80068BA0->unk_08 & 0x9000) && (D_82100EC8 != 0)) { + if ((gPlayer1Controller->buttonPressed & 0x9000) && (D_82100EC8 != 0)) { func_80048B90(0xF); var_s0 = func_82100054(); } else if (func_82100958() != 0) { @@ -343,7 +343,8 @@ void func_82100B1C(s32 arg0) { void func_82100B98(void) { ASSET_LOAD(D_1000000, common_menu1_ui, 0); - ASSET_LOAD(D_2000000, title_ui, 0); // bin contains a JP logo and press start, but this bin is loaded for the "Press Start" gfx + ASSET_LOAD(D_2000000, title_ui, + 0); // bin contains a JP logo and press start, but this bin is loaded for the "Press Start" gfx D_82100EB8 = main_pool_alloc(0x4510, 0); D_82100EBC = main_pool_alloc(0x100000, 0); diff --git a/src/fragments/37/fragment37.c b/src/fragments/37/fragment37.c index 92d4ee74..6fc4ba19 100644 --- a/src/fragments/37/fragment37.c +++ b/src/fragments/37/fragment37.c @@ -530,24 +530,24 @@ s32 func_822023A4(void) { D_82203150.unk_06 = 0; D_82203150.unk_04 = 0x12C; - if (D_80068BA0->unk_08 & 0x8000) { + if (gPlayer1Controller->buttonPressed & 0x8000) { if (D_822031D8 == 3) { func_8004E810(0x96, 8); } func_80048B90(0x33); func_80048B90(0x16); var_t1 = 3; - } else if (D_80068BA0->unk_08 & 0x4000) { + } else if (gPlayer1Controller->buttonPressed & 0x4000) { func_8000D23C(0x28); func_80048B90(3); var_t1 = 4; - } else if (D_80068BA0->unk_08 & 0x800) { + } else if (gPlayer1Controller->buttonPressed & 0x800) { var_s0 = D_82202FE4[D_822031D8].unk_06; - } else if (D_80068BA0->unk_08 & 0x400) { + } else if (gPlayer1Controller->buttonPressed & 0x400) { var_s0 = D_82202FE4[D_822031D8].unk_07; - } else if (D_80068BA0->unk_08 & 0x200) { + } else if (gPlayer1Controller->buttonPressed & 0x200) { var_s0 = D_82202FE4[D_822031D8].unk_08; - } else if (D_80068BA0->unk_08 & 0x100) { + } else if (gPlayer1Controller->buttonPressed & 0x100) { var_s0 = D_82202FE4[D_822031D8].unk_09; } diff --git a/src/fragments/6/fragment6.c b/src/fragments/6/fragment6.c index 790c3c2d..dc81e718 100644 --- a/src/fragments/6/fragment6.c +++ b/src/fragments/6/fragment6.c @@ -177,15 +177,15 @@ void func_86000020(void) { s32 i; s32 j; - D_86002F58[0].unk_17A = D_80068BA0->unk_08; - D_86002F58[1].unk_17A = D_80068BA4->unk_08; - D_86002F58[2].unk_17A = D_80068BA8->unk_08; - D_86002F58[3].unk_17A = D_80068BAC->unk_08; + D_86002F58[0].unk_17A = gPlayer1Controller->buttonPressed; + D_86002F58[1].unk_17A = gPlayer2Controller->buttonPressed; + D_86002F58[2].unk_17A = gPlayer3Controller->buttonPressed; + D_86002F58[3].unk_17A = gPlayer4Controller->buttonPressed; - D_86002F58[0].unk_174 = D_80068BA0->unk_06; - D_86002F58[1].unk_174 = D_80068BA4->unk_06; - D_86002F58[2].unk_174 = D_80068BA8->unk_06; - D_86002F58[3].unk_174 = D_80068BAC->unk_06; + D_86002F58[0].unk_174 = gPlayer1Controller->buttonDown; + D_86002F58[1].unk_174 = gPlayer2Controller->buttonDown; + D_86002F58[2].unk_174 = gPlayer3Controller->buttonDown; + D_86002F58[3].unk_174 = gPlayer4Controller->buttonDown; for (i = 0; i < 4; i++) { D_86003B5C = &D_86002F58[i]; @@ -596,11 +596,11 @@ s32 func_86000FD4(void) { var_s0_2 = true; while (var_s0_2 == true) { if (func_86000410() == 0) { - if (D_80068BA0->unk_08 & 0x1000) { + if (gPlayer1Controller->buttonPressed & 0x1000) { var_s0_2 = false; } - if ((D_8780FA2A == 0) && (D_80068BA0->unk_08 & 0x4000)) { + if ((D_8780FA2A == 0) && (gPlayer1Controller->buttonPressed & 0x4000)) { func_80048B90(3); func_87802EB8(2); return -1; diff --git a/src/fragments/7/fragment7.c b/src/fragments/7/fragment7.c index b8709b8f..008d3790 100644 --- a/src/fragments/7/fragment7.c +++ b/src/fragments/7/fragment7.c @@ -497,15 +497,15 @@ void func_86100798(s16 arg0, s16 arg1, f32 arg2) { } void func_86100A80(void) { - D_861054C0[0].unk_172 = D_80068BA0->unk_08; - D_861054C0[1].unk_172 = D_80068BA4->unk_08; - D_861054C0[2].unk_172 = D_80068BA8->unk_08; - D_861054C0[3].unk_172 = D_80068BAC->unk_08; - - D_861054C0[0].unk_170 = D_80068BA0->unk_06; - D_861054C0[1].unk_170 = D_80068BA4->unk_06; - D_861054C0[2].unk_170 = D_80068BA8->unk_06; - D_861054C0[3].unk_170 = D_80068BAC->unk_06; + D_861054C0[0].unk_172 = gPlayer1Controller->buttonPressed; + D_861054C0[1].unk_172 = gPlayer2Controller->buttonPressed; + D_861054C0[2].unk_172 = gPlayer3Controller->buttonPressed; + D_861054C0[3].unk_172 = gPlayer4Controller->buttonPressed; + + D_861054C0[0].unk_170 = gPlayer1Controller->buttonDown; + D_861054C0[1].unk_170 = gPlayer2Controller->buttonDown; + D_861054C0[2].unk_170 = gPlayer3Controller->buttonDown; + D_861054C0[3].unk_170 = gPlayer4Controller->buttonDown; } void func_86100AEC(void) { @@ -822,7 +822,7 @@ s32 func_8610197C(void) { while (var_s0 == 1) { func_878001E8(0x3E8); - temp_v1 = D_80068BA0->unk_08; + temp_v1 = gPlayer1Controller->buttonPressed; if (temp_v1 & 0x1000) { var_s0 = 0; } diff --git a/src/fragments/8/fragment8.c b/src/fragments/8/fragment8.c index 42dd475a..653e9664 100644 --- a/src/fragments/8/fragment8.c +++ b/src/fragments/8/fragment8.c @@ -217,10 +217,10 @@ void func_862002F4(void) { f32 temp_fv0; f32 temp_fv1; - sp60[0] = D_80068BA0->unk_08; - sp60[1] = D_80068BA4->unk_08; - sp60[2] = D_80068BA8->unk_08; - sp60[3] = D_80068BAC->unk_08; + sp60[0] = gPlayer1Controller->buttonPressed; + sp60[1] = gPlayer2Controller->buttonPressed; + sp60[2] = gPlayer3Controller->buttonPressed; + sp60[3] = gPlayer4Controller->buttonPressed; if (D_86203E48 == 2) { for (i = 0; i < 4; i++) { @@ -537,11 +537,11 @@ s32 func_862011E8(void) { func_862004D8(); func_86200620(); if (D_8620471A == 1) { - if (D_80068BA0->unk_08 & 0x1000) { + if (gPlayer1Controller->buttonPressed & 0x1000) { var_s1_3 = 0; } - if ((D_8780FA2A == 0) && (D_80068BA0->unk_08 & 0x4000)) { + if ((D_8780FA2A == 0) && (gPlayer1Controller->buttonPressed & 0x4000)) { func_80048B90(3); func_87802EB8(2); return -1; @@ -581,7 +581,8 @@ void func_862013C0(void) { func_862004D8(); if ((D_86204718 == 1) && (func_80007604() == 0) && - ((D_80068BA0->unk_08 | D_80068BA4->unk_08 | D_80068BA8->unk_08 | (D_80068BAC->unk_08 != 0)) != 0)) { + ((gPlayer1Controller->buttonPressed | gPlayer2Controller->buttonPressed | + gPlayer3Controller->buttonPressed | (gPlayer4Controller->buttonPressed != 0)) != 0)) { func_80006CB4(0x1E); func_8004B094(0x1E); D_86204700 = 0; @@ -1026,7 +1027,7 @@ void func_862023F8(void) { } if (D_86204718 == 1) { - if ((D_80068BA0->unk_08 != 0) && (sp8C == 0)) { + if ((gPlayer1Controller->buttonPressed != 0) && (sp8C == 0)) { D_86204704 = 0x1C2; sp8C = 1; } diff --git a/src/fragments/9/fragment9.c b/src/fragments/9/fragment9.c index 5c875064..9ae7efa1 100644 --- a/src/fragments/9/fragment9.c +++ b/src/fragments/9/fragment9.c @@ -82,21 +82,21 @@ void func_86300020(void) { D_86301730[i].unk_17B = D_86301730[i].unk_179; } - D_86301730[0].unk_17C = D_80068BA0->unk_08; - D_86301730[0].unk_178 = D_80068BA0->unk_02; - D_86301730[0].unk_179 = D_80068BA0->unk_04; + D_86301730[0].unk_17C = gPlayer1Controller->buttonPressed; + D_86301730[0].unk_178 = gPlayer1Controller->rawStickX; + D_86301730[0].unk_179 = gPlayer1Controller->rawStickY; - D_86301730[1].unk_17C = D_80068BA4->unk_08; - D_86301730[1].unk_178 = D_80068BA4->unk_02; - D_86301730[1].unk_179 = D_80068BA4->unk_04; + D_86301730[1].unk_17C = gPlayer2Controller->buttonPressed; + D_86301730[1].unk_178 = gPlayer2Controller->rawStickX; + D_86301730[1].unk_179 = gPlayer2Controller->rawStickY; - D_86301730[2].unk_17C = D_80068BA8->unk_08; - D_86301730[2].unk_178 = D_80068BA8->unk_02; - D_86301730[2].unk_179 = D_80068BA8->unk_04; + D_86301730[2].unk_17C = gPlayer3Controller->buttonPressed; + D_86301730[2].unk_178 = gPlayer3Controller->rawStickX; + D_86301730[2].unk_179 = gPlayer3Controller->rawStickY; - D_86301730[3].unk_17C = D_80068BAC->unk_08; - D_86301730[3].unk_178 = D_80068BAC->unk_02; - D_86301730[3].unk_179 = D_80068BAC->unk_04; + D_86301730[3].unk_17C = gPlayer4Controller->buttonPressed; + D_86301730[3].unk_178 = gPlayer4Controller->rawStickX; + D_86301730[3].unk_179 = gPlayer4Controller->rawStickY; } void func_8630011C(void) { @@ -461,7 +461,7 @@ void func_86300F68(void) { func_8630011C(); func_86300230(); - if (D_80068BA0->unk_08 & 0x1000) { + if (gPlayer1Controller->buttonPressed & 0x1000) { var_s6 = 0; } diff --git a/src/stage_loader.c b/src/stage_loader.c index 0088951d..459c49b3 100644 --- a/src/stage_loader.c +++ b/src/stage_loader.c @@ -101,7 +101,7 @@ static unk_D_80068CA0* D_80068CA4 = NULL; static s32 D_80068CA8 = 0; -static s32 D_80068BAC_Pad[1] = { 0 }; +static s32 D_80068CAC_Pad[1] = { 0 }; static u32 D_80068CB0[] = { 0x00000000, 0xF1000F1F, 0x10000000, 0x00F10000, 0x00000FF1, 0x0000F100, 0x000F100F, 0x10000000, 0x00000000, diff --git a/yamls/us/rom.yaml b/yamls/us/rom.yaml index 30103de1..8151ec1f 100644 --- a/yamls/us/rom.yaml +++ b/yamls/us/rom.yaml @@ -332,7 +332,7 @@ # .data - [0x69770, data, rom_data_69770] # dp_intro - [0x69790, .data, util] - - [0x697A0, data, rom_data_697A0] + - [0x697A0, .data, controller] - [0x697B0, .data, 6BC0] - [0x697C0, .data, stage_loader] - [0x6A1B0, .data, crash_screen] @@ -635,12 +635,16 @@ - [0x119FB0, c, fragments/3/fragment3_119FB0] - [0x11BBF0, c, fragments/3/fragment3_11BBF0] - [0x11BF90, c, fragments/3/fragment3_11BF90] - - [0x11C730, data, fragments/3/fragment3_data] - - [0x11E810, rodata, fragments/3/fragment3_rodata_11E810] - - [0x11E950, rodata, fragments/3/fragment3_rodata_11E950] - - [0x11E9A0, rodata, fragments/3/fragment3_rodata_11E9A0] - - - {vram: 0x87906040, type: bss, name: fragments/3/fragment3_bss} + - [0x11C730, .data, fragments/3/fragment3_1189B0] + - [0x11C770, .data, fragments/3/fragment3_1193E0] + - [0x11C790, .data, fragments/3/fragment3_11BBF0] + - [0x11E810, .rodata, fragments/3/fragment3_1193E0] + - [0x11E950, .rodata, fragments/3/fragment3_119FB0] + - [0x11E9A0, .rodata, fragments/3/fragment3_11BBF0] + + - {vram: 0x87906040, type: .bss, name: fragments/3/fragment3_1189B0} + - {vram: 0x879060E0, type: .bss, name: fragments/3/fragment3_1193E0} + - {vram: 0x87906120, type: .bss, name: fragments/3/fragment3_11BF90} - name: fragment3_relocs type: code