From f38e97b37bed65c1b2497513cd9ebd18e892724a Mon Sep 17 00:00:00 2001 From: Evan Date: Wed, 19 Jun 2024 18:04:52 -0400 Subject: [PATCH] Document the distortion world warp overlay. --- include/overlay121/DWWarp.h | 9 + include/overlay121/ov121_021D0D80.h | 9 - include/unk_0202419C.h | 2 +- platinum.us/main.lsf | 2 +- src/battle/ov16_0223B140.c | 2 +- src/choose_starter/choose_starter_app.c | 2 +- src/meson.build | 2 +- src/overlay005/encounter_effect_core.c | 2 +- src/overlay005/fieldmap.c | 2 +- src/overlay021/ov21_021D0D80.c | 2 +- src/overlay022/ov22_02255094.c | 2 +- src/overlay022/ov22_0225B660.c | 2 +- src/overlay062/ov62_0222F2C0.c | 2 +- src/overlay062/ov62_02237D24.c | 8 +- src/overlay069/ov69_0225C700.c | 2 +- src/overlay070/ov70_0225D9A4.c | 2 +- src/overlay076/ov76_0223B870.c | 2 +- src/overlay077/ov77_021D0D80.c | 4 +- src/overlay077/ov77_021D25B0.c | 2 +- src/overlay077/ov77_021D6C70.c | 2 +- src/overlay083/ov83_0223C958.c | 2 +- src/overlay092/ov92_021D0D80.c | 4 +- src/overlay093/ov93_021D0D80.c | 2 +- src/overlay093/ov93_021D111C.c | 2 +- src/overlay095/ov95_02247B6C.c | 2 +- src/overlay095/ov95_02248590.c | 2 +- src/overlay095/ov95_02249740.c | 2 +- src/overlay095/ov95_0224A390.c | 2 +- src/overlay095/ov95_0224ABC0.c | 2 +- src/overlay095/ov95_0224B3D8.c | 2 +- src/overlay099/ov99_021D0D80.c | 2 +- src/overlay100/ov100_021D13E4.c | 2 +- src/overlay100/ov100_021D1C44.c | 2 +- src/overlay100/ov100_021D2F0C.c | 2 +- src/overlay104/ov104_0223C2D4.c | 2 +- src/overlay109/ov109_021D0D80.c | 2 +- src/overlay113/ov113_0225C700.c | 2 +- src/overlay115/ov115_02260CEC.c | 2 +- src/overlay116/ov116_02261870.c | 2 +- src/overlay117/ov117_02260668.c | 2 +- src/overlay118/ov118_021D0D80.c | 2 +- src/overlay119/ov119_021D0D80.c | 2 +- src/overlay121/DWWarp.c | 385 ++++++++++++++++++++++++ src/overlay121/ov121_021D0D80.c | 370 ----------------------- src/unk_0202419C.c | 2 +- src/unk_0203D1B8.c | 8 +- src/unk_0207AE68.c | 2 +- src/unk_0207C63C.c | 2 +- 48 files changed, 446 insertions(+), 431 deletions(-) create mode 100644 include/overlay121/DWWarp.h delete mode 100644 include/overlay121/ov121_021D0D80.h create mode 100644 src/overlay121/DWWarp.c delete mode 100644 src/overlay121/ov121_021D0D80.c diff --git a/include/overlay121/DWWarp.h b/include/overlay121/DWWarp.h new file mode 100644 index 000000000..477f30c40 --- /dev/null +++ b/include/overlay121/DWWarp.h @@ -0,0 +1,9 @@ +#ifndef POKEPLATINUM_DWWARP_H +#define POKEPLATINUM_DWWARP_H + + +int DWWarp_Init(OverlayManager * ovy, int * seq); +int DWWarp_Main(OverlayManager * ovy, int * seq); +int DWWarp_Exit(OverlayManager * ovy, int * seq); + +#endif // POKEPLATINUM_DWWARP_H diff --git a/include/overlay121/ov121_021D0D80.h b/include/overlay121/ov121_021D0D80.h deleted file mode 100644 index b2918b537..000000000 --- a/include/overlay121/ov121_021D0D80.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef POKEPLATINUM_OV121_021D0D80_H -#define POKEPLATINUM_OV121_021D0D80_H - - -int ov121_021D0D80(OverlayManager * param0, int * param1); -int ov121_021D0E7C(OverlayManager * param0, int * param1); -int ov121_021D0F14(OverlayManager * param0, int * param1); - -#endif // POKEPLATINUM_OV121_021D0D80_H diff --git a/include/unk_0202419C.h b/include/unk_0202419C.h index b3c29414a..cd0df3787 100644 --- a/include/unk_0202419C.h +++ b/include/unk_0202419C.h @@ -6,7 +6,7 @@ void sub_0202419C(void); void sub_020241B4(void); -void sub_020241BC(GXSortMode param0, GXBufferMode param1); +void G3_RequestSwapBuffers(GXSortMode param0, GXBufferMode param1); void sub_020241CC(void); #endif // POKEPLATINUM_UNK_0202419C_H diff --git a/platinum.us/main.lsf b/platinum.us/main.lsf index 8f1d5afee..60e36c449 100644 --- a/platinum.us/main.lsf +++ b/platinum.us/main.lsf @@ -1720,6 +1720,6 @@ Overlay overlay120 Overlay overlay121 { After main - Object main.nef.p/src_overlay121_ov121_021D0D80.c.o + Object main.nef.p/src_overlay121_DWWarp.c.o } diff --git a/src/battle/ov16_0223B140.c b/src/battle/ov16_0223B140.c index f3441d4ed..d030882cd 100644 --- a/src/battle/ov16_0223B140.c +++ b/src/battle/ov16_0223B140.c @@ -1562,7 +1562,7 @@ static void ov16_0223CF48 (SysTask * param0, void * param1) sub_02007768(v0->unk_88); sub_0200C7EC(v0->unk_94); sub_0200C808(); - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); } } diff --git a/src/choose_starter/choose_starter_app.c b/src/choose_starter/choose_starter_app.c index f50c62469..ef7be57b3 100644 --- a/src/choose_starter/choose_starter_app.c +++ b/src/choose_starter/choose_starter_app.c @@ -1063,7 +1063,7 @@ static void DrawScene (ChooseStarterApp * param0) NNS_G3dGePopMtx(1); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); sub_020219F8(param0->unk_248); } diff --git a/src/meson.build b/src/meson.build index 429646392..f90c4a2f9 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1020,5 +1020,5 @@ pokeplatinum_c = files( 'overlay119/ov119_021D0D80.c', 'overlay119/ov119_021D191C.c', 'overlay120/ov120_021D0D80.c', - 'overlay121/ov121_021D0D80.c' + 'overlay121/DWWarp.c' ) diff --git a/src/overlay005/encounter_effect_core.c b/src/overlay005/encounter_effect_core.c index bb28b5dce..485056f6b 100644 --- a/src/overlay005/encounter_effect_core.c +++ b/src/overlay005/encounter_effect_core.c @@ -3608,7 +3608,7 @@ static BOOL EncounterEffect_EliteFourChampion(EncounterEffect *encEffect, enum H sub_020241B4(); ov5_021DF1CC(); ov5_021DF070(); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } } diff --git a/src/overlay005/fieldmap.c b/src/overlay005/fieldmap.c index 4da635743..c869c34fb 100644 --- a/src/overlay005/fieldmap.c +++ b/src/overlay005/fieldmap.c @@ -759,7 +759,7 @@ static void ov5_021D15F4 (FieldSystem * fieldSystem) } ov5_021D1B18(fieldSystem->unk_04->unk_04); - sub_020241BC(GX_SORTMODE_AUTO, gBufferMode); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, gBufferMode); } void ov5_021D16F4 (FieldSystem * fieldSystem, BOOL param1) diff --git a/src/overlay021/ov21_021D0D80.c b/src/overlay021/ov21_021D0D80.c index 50035618b..606a2332b 100644 --- a/src/overlay021/ov21_021D0D80.c +++ b/src/overlay021/ov21_021D0D80.c @@ -399,7 +399,7 @@ BOOL ov21_021D10B8 (UnkStruct_ov21_021D0F60 * param0) sub_020241B4(); ov21_021D2124(¶m0->unk_177C); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); param0->unk_1A68 = 0; param0->unk_1A6C = 0; diff --git a/src/overlay022/ov22_02255094.c b/src/overlay022/ov22_02255094.c index 321b4119b..91354aaec 100644 --- a/src/overlay022/ov22_02255094.c +++ b/src/overlay022/ov22_02255094.c @@ -140,7 +140,7 @@ void ov22_02255180 (UnkStruct_ov22_0225A0E4 * param0) sub_02007768(param0->unk_20); } - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); ov22_02255AC0(param0); } diff --git a/src/overlay022/ov22_0225B660.c b/src/overlay022/ov22_0225B660.c index 4221de298..3b8ea2a00 100644 --- a/src/overlay022/ov22_0225B660.c +++ b/src/overlay022/ov22_0225B660.c @@ -121,7 +121,7 @@ int ov22_0225B738 (OverlayManager * param0, int * param1) sub_020241B4(); NNS_G2dSetupSoftwareSpriteCamera(); ov22_0225AFF8(v0->unk_10); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } ov22_0225562C(&v0->unk_14); diff --git a/src/overlay062/ov62_0222F2C0.c b/src/overlay062/ov62_0222F2C0.c index 673df0ad0..de7373921 100644 --- a/src/overlay062/ov62_0222F2C0.c +++ b/src/overlay062/ov62_0222F2C0.c @@ -447,7 +447,7 @@ BOOL ov62_0222F910 (UnkStruct_0208C06C * param0, int * param1) sub_020241B4(); sub_02007768(param0->unk_14.unk_50); - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); ov62_022411D4(param0); diff --git a/src/overlay062/ov62_02237D24.c b/src/overlay062/ov62_02237D24.c index 2a7afbaea..1c75cf1c6 100644 --- a/src/overlay062/ov62_02237D24.c +++ b/src/overlay062/ov62_02237D24.c @@ -332,7 +332,7 @@ static BOOL ov62_02237F08 (UnkStruct_0208C06C * param0) if (v0->unk_228) { sub_020241B4(); ov22_0225AFF8(v0->unk_228); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } return 0; @@ -355,7 +355,7 @@ static BOOL ov62_02238048 (UnkStruct_0208C06C * param0) if (v0->unk_228) { sub_020241B4(); ov22_0225AFF8(v0->unk_228); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } return 0; @@ -949,7 +949,7 @@ static BOOL ov62_02238D04 (UnkStruct_0208C06C * param0) if (v0->unk_228) { sub_020241B4(); ov22_0225AFF8(v0->unk_228); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } return 0; @@ -990,7 +990,7 @@ static BOOL ov62_02238E54 (UnkStruct_0208C06C * param0) if (v0->unk_228) { sub_020241B4(); ov22_0225AFF8(v0->unk_228); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } return 0; diff --git a/src/overlay069/ov69_0225C700.c b/src/overlay069/ov69_0225C700.c index 7c4996a37..7c7fc2020 100644 --- a/src/overlay069/ov69_0225C700.c +++ b/src/overlay069/ov69_0225C700.c @@ -1154,7 +1154,7 @@ static void ov69_0225CF50 (UnkStruct_ov69_0225CE64 * param0) ov69_0225D854(¶m0->unk_288, ¶m0->unk_1DC); ov69_0225D384(¶m0->unk_20); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); } static void ov69_0225CF90 (void * param0) diff --git a/src/overlay070/ov70_0225D9A4.c b/src/overlay070/ov70_0225D9A4.c index edbf5dadf..e8412c1bf 100644 --- a/src/overlay070/ov70_0225D9A4.c +++ b/src/overlay070/ov70_0225D9A4.c @@ -1504,7 +1504,7 @@ static void ov70_0225E92C (UnkStruct_ov70_0225DEE8 * param0) ov70_0225CAD4(param0->unk_444); ov70_02269240(param0->unk_438); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); ov70_0225E6C0(¶m0->unk_3C); } diff --git a/src/overlay076/ov76_0223B870.c b/src/overlay076/ov76_0223B870.c index 4640ac6e6..8ffad5f4d 100644 --- a/src/overlay076/ov76_0223B870.c +++ b/src/overlay076/ov76_0223B870.c @@ -445,7 +445,7 @@ void ov76_0223BF50 (void) } sub_020146C0(); - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); } void ov76_0223BF74 (BGL * param0, Window * param1, int param2, UnkStruct_ov76_0223DE00 * param3, int param4) diff --git a/src/overlay077/ov77_021D0D80.c b/src/overlay077/ov77_021D0D80.c index 9b9118df0..f886dc149 100644 --- a/src/overlay077/ov77_021D0D80.c +++ b/src/overlay077/ov77_021D0D80.c @@ -553,7 +553,7 @@ static void ov77_021D1568 (UnkStruct_ov77_021D1568 * param0, UnkStruct_ov77_021D break; case 1: sub_020241B4(); - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_W); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_W); param1->unk_00 = 0; break; case 2: @@ -596,7 +596,7 @@ static void ov77_021D1568 (UnkStruct_ov77_021D1568 * param0, UnkStruct_ov77_021D break; } - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_W); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_W); break; } } diff --git a/src/overlay077/ov77_021D25B0.c b/src/overlay077/ov77_021D25B0.c index 6a9ff9554..fda3af623 100644 --- a/src/overlay077/ov77_021D25B0.c +++ b/src/overlay077/ov77_021D25B0.c @@ -1838,7 +1838,7 @@ static void ov77_021D4188 (UnkStruct_ov77_021D37C0 * param0) sub_020146C0(); } - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); } static BOOL ov77_021D4230 (UnkStruct_ov77_021D2E9C * param0, UnkStruct_ov77_021D37C0 * param1, const int param2) diff --git a/src/overlay077/ov77_021D6C70.c b/src/overlay077/ov77_021D6C70.c index d1b4b0cba..5207af160 100644 --- a/src/overlay077/ov77_021D6C70.c +++ b/src/overlay077/ov77_021D6C70.c @@ -185,7 +185,7 @@ void ov77_021D6E50 (UnkStruct_ov77_021D6CFC * param0) NNS_G2dSetupSoftwareSpriteCamera(); sub_02007768(param0->unk_00); ov77_021D725C(); - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); } } diff --git a/src/overlay083/ov83_0223C958.c b/src/overlay083/ov83_0223C958.c index 723f7a07a..d0a7e0da0 100644 --- a/src/overlay083/ov83_0223C958.c +++ b/src/overlay083/ov83_0223C958.c @@ -130,7 +130,7 @@ void ov83_0223CBA4 (UnkStruct_ov83_0223B784 * param0) } NNS_G3dGePopMtx(1); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); if (param0->unk_31C) { if (param0->unk_2C.unk_00) { diff --git a/src/overlay092/ov92_021D0D80.c b/src/overlay092/ov92_021D0D80.c index c4323ba1b..1f4624763 100644 --- a/src/overlay092/ov92_021D0D80.c +++ b/src/overlay092/ov92_021D0D80.c @@ -1474,7 +1474,7 @@ static void ov92_021D26D0 (UnkStruct_ov92_021D1B24 * param0) break; case 2: sub_020241B4(); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); param0->unk_BAE8 = 0; break; case 1: @@ -1504,7 +1504,7 @@ static void ov92_021D26D0 (UnkStruct_ov92_021D1B24 * param0) } } - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); break; } } diff --git a/src/overlay093/ov93_021D0D80.c b/src/overlay093/ov93_021D0D80.c index 15a2c0432..35177bbfa 100644 --- a/src/overlay093/ov93_021D0D80.c +++ b/src/overlay093/ov93_021D0D80.c @@ -174,7 +174,7 @@ int ov93_021D0E70 (OverlayManager * param0, int * param1) sub_020241B4(); Camera_ComputeViewMatrix(); sub_0201CA74(&v5->unk_04, &v4, &v2, &v3); - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_W); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_W); return 0; } diff --git a/src/overlay093/ov93_021D111C.c b/src/overlay093/ov93_021D111C.c index 1ea33cb3b..e82663d6a 100644 --- a/src/overlay093/ov93_021D111C.c +++ b/src/overlay093/ov93_021D111C.c @@ -174,7 +174,7 @@ int ov93_021D120C (OverlayManager * param0, int * param1) sub_020241B4(); Camera_ComputeViewMatrix(); sub_0201CA74(&v5->unk_04, &v4, &v2, &v3); - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_W); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_W); return 0; } diff --git a/src/overlay095/ov95_02247B6C.c b/src/overlay095/ov95_02247B6C.c index 6682be239..ca897ad49 100644 --- a/src/overlay095/ov95_02247B6C.c +++ b/src/overlay095/ov95_02247B6C.c @@ -199,7 +199,7 @@ static void ov95_02247C6C (UnkStruct_ov95_02247C6C * param0) NNS_G3dGePopMtx(1); ov95_02247770(param0->unk_70); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } static int ov95_02247CB4 (UnkStruct_ov95_02247C6C * param0, int * param1) diff --git a/src/overlay095/ov95_02248590.c b/src/overlay095/ov95_02248590.c index f49bdd763..c009fecb2 100644 --- a/src/overlay095/ov95_02248590.c +++ b/src/overlay095/ov95_02248590.c @@ -297,7 +297,7 @@ static void ov95_02248688 (UnkStruct_ov95_02248688 * param0) G3X_Reset(); ov95_02247770(param0->unk_D4); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } } diff --git a/src/overlay095/ov95_02249740.c b/src/overlay095/ov95_02249740.c index 0040c5e11..aff03c862 100644 --- a/src/overlay095/ov95_02249740.c +++ b/src/overlay095/ov95_02249740.c @@ -185,7 +185,7 @@ static void ov95_022497D8 (UnkStruct_ov95_022497D8 * param0) G3X_Reset(); ov95_02247770(param0->unk_28); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } } diff --git a/src/overlay095/ov95_0224A390.c b/src/overlay095/ov95_0224A390.c index e01b7d86b..2aecdfb73 100644 --- a/src/overlay095/ov95_0224A390.c +++ b/src/overlay095/ov95_0224A390.c @@ -579,7 +579,7 @@ static void ov95_0224AB50 (void * param0) if (v0->unk_28) { G3X_Reset(); ov95_02247770(v0->unk_28); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } if (v0->unk_0C) { diff --git a/src/overlay095/ov95_0224ABC0.c b/src/overlay095/ov95_0224ABC0.c index 900f6634b..274890f2c 100644 --- a/src/overlay095/ov95_0224ABC0.c +++ b/src/overlay095/ov95_0224ABC0.c @@ -204,7 +204,7 @@ static void ov95_0224AC64 (UnkStruct_ov95_0224AC64 * param0) ov95_02247990(param0->unk_24, &(param0->unk_28)); G3X_Reset(); ov95_02247770(param0->unk_20); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } } diff --git a/src/overlay095/ov95_0224B3D8.c b/src/overlay095/ov95_0224B3D8.c index ea2e22441..7381e573c 100644 --- a/src/overlay095/ov95_0224B3D8.c +++ b/src/overlay095/ov95_0224B3D8.c @@ -229,7 +229,7 @@ static void ov95_0224B4D4 (UnkStruct_ov95_0224B4D4 * param0) ov95_02247770(param0->unk_74); } - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } static int ov95_0224B520 (UnkStruct_ov95_0224B4D4 * param0, int * param1) diff --git a/src/overlay099/ov99_021D0D80.c b/src/overlay099/ov99_021D0D80.c index 12ea076df..618db758e 100644 --- a/src/overlay099/ov99_021D0D80.c +++ b/src/overlay099/ov99_021D0D80.c @@ -299,7 +299,7 @@ static void ov99_021D1244 (SysTask * param0, void * param1) if (v0->unk_1103 == 1) { ov99_021D1720(v0); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } sub_0200C7EC(v0->unk_1C); diff --git a/src/overlay100/ov100_021D13E4.c b/src/overlay100/ov100_021D13E4.c index f4816c35e..bc8c71bc2 100644 --- a/src/overlay100/ov100_021D13E4.c +++ b/src/overlay100/ov100_021D13E4.c @@ -225,7 +225,7 @@ static void ov100_021D17B4 (UnkStruct_ov100_021D1808 * param0) ov100_021D49B4(¶m0->unk_1A4.unk_00[2]); ov100_021D49B4(¶m0->unk_1A4.unk_498); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); } static void ov100_021D1808 (UnkStruct_ov100_021D1808 * param0) diff --git a/src/overlay100/ov100_021D1C44.c b/src/overlay100/ov100_021D1C44.c index 7f635feeb..dd1ee0840 100644 --- a/src/overlay100/ov100_021D1C44.c +++ b/src/overlay100/ov100_021D1C44.c @@ -763,5 +763,5 @@ static void ov100_021D2E0C (UnkStruct_ov100_021D1C98 * param0) ov100_021D49B4(¶m0->unk_1A0.unk_16FC[2]); ov100_021D49B4(¶m0->unk_1A0.unk_16FC[3]); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); } diff --git a/src/overlay100/ov100_021D2F0C.c b/src/overlay100/ov100_021D2F0C.c index 098986999..5ab477bd0 100644 --- a/src/overlay100/ov100_021D2F0C.c +++ b/src/overlay100/ov100_021D2F0C.c @@ -240,7 +240,7 @@ static void ov100_021D3558 (UnkStruct_ov100_021D3084 * param0) ov100_021D49B4(¶m0->unk_0C.unk_16FC[2]); ov100_021D49B4(¶m0->unk_0C.unk_16FC[3]); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); } void * ov100_021D3620 (UnkStruct_ov100_021D4DD8 * param0) diff --git a/src/overlay104/ov104_0223C2D4.c b/src/overlay104/ov104_0223C2D4.c index 29dc5aba5..abdc9a9e7 100644 --- a/src/overlay104/ov104_0223C2D4.c +++ b/src/overlay104/ov104_0223C2D4.c @@ -386,7 +386,7 @@ static void ov104_0223C738 (SysTask * param0, void * param1) sub_0200C808(); ov104_0223D6A8(); - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); } static void ov104_0223C798 (UnkStruct_ov104_0223C4CC * param0) diff --git a/src/overlay109/ov109_021D0D80.c b/src/overlay109/ov109_021D0D80.c index 7c7150e11..e303436d7 100644 --- a/src/overlay109/ov109_021D0D80.c +++ b/src/overlay109/ov109_021D0D80.c @@ -1601,7 +1601,7 @@ static void ov109_021D1C90 (UnkStruct_ov109_021D0F70 * param0) ov109_021D2AC8(param0); ov109_021D2CCC(param0); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); sub_0200C7EC(param0->unk_D98); } diff --git a/src/overlay113/ov113_0225C700.c b/src/overlay113/ov113_0225C700.c index c4fd2b093..e016df3e5 100644 --- a/src/overlay113/ov113_0225C700.c +++ b/src/overlay113/ov113_0225C700.c @@ -693,7 +693,7 @@ static void ov113_0225CEF0 (SysTask * param0, void * param1) sub_0200C7EC(v0->unk_20); sub_0200C808(); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); } static void ov113_0225CF18 (void * param0) diff --git a/src/overlay115/ov115_02260CEC.c b/src/overlay115/ov115_02260CEC.c index cb955309e..828966180 100644 --- a/src/overlay115/ov115_02260CEC.c +++ b/src/overlay115/ov115_02260CEC.c @@ -3001,7 +3001,7 @@ static void ov115_0226369C (const UnkStruct_ov115_02260D78 * param0, UnkStruct_o NNS_G3dGePopMtx(1); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); sub_020219F8(param1->unk_1C); } diff --git a/src/overlay116/ov116_02261870.c b/src/overlay116/ov116_02261870.c index d46407940..252c37953 100644 --- a/src/overlay116/ov116_02261870.c +++ b/src/overlay116/ov116_02261870.c @@ -175,7 +175,7 @@ void ov116_02261940 (UnkStruct_ov116_0226139C * param0) } } - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W); sub_0200C7EC(param0->unk_48.unk_0C); } diff --git a/src/overlay117/ov117_02260668.c b/src/overlay117/ov117_02260668.c index 16e31135a..5e8751d82 100644 --- a/src/overlay117/ov117_02260668.c +++ b/src/overlay117/ov117_02260668.c @@ -634,7 +634,7 @@ static void ov117_02260F7C (SysTask * param0, void * param1) sub_0200C7EC(v0->unk_28); sub_0200C808(); - sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_Z); sub_02038A1C(110, v0->unk_2C); } diff --git a/src/overlay118/ov118_021D0D80.c b/src/overlay118/ov118_021D0D80.c index b07ebfcac..5e588dc53 100644 --- a/src/overlay118/ov118_021D0D80.c +++ b/src/overlay118/ov118_021D0D80.c @@ -246,7 +246,7 @@ static int ov118_021D10E8 (void) } sub_020146C0(); - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); return v0; } diff --git a/src/overlay119/ov119_021D0D80.c b/src/overlay119/ov119_021D0D80.c index 543b6a36d..60e0716f3 100644 --- a/src/overlay119/ov119_021D0D80.c +++ b/src/overlay119/ov119_021D0D80.c @@ -272,7 +272,7 @@ void ov119_021D1004 (void) } sub_020146C0(); - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); } void ov119_021D1028 (void) diff --git a/src/overlay121/DWWarp.c b/src/overlay121/DWWarp.c new file mode 100644 index 000000000..4afc63bea --- /dev/null +++ b/src/overlay121/DWWarp.c @@ -0,0 +1,385 @@ +#include +#include + +#include "core_sys.h" + +#include "struct_decls/struct_02006C24_decl.h" +#include "struct_decls/sys_task.h" +#include "struct_decls/struct_020203AC_decl.h" + +#include "struct_defs/struct_020170F4.h" +#include "struct_defs/struct_02017248.h" +#include "struct_defs/struct_02017294.h" +#include "struct_defs/struct_0207C690.h" +#include "struct_defs/struct_02099F80.h" +#include "overlay115/camera_angle.h" + +#include "unk_02002328.h" +#include "unk_02005474.h" +#include "overlay_manager.h" +#include "narc.h" +#include "unk_0200D9E8.h" +#include "unk_0200F174.h" +#include "unk_020170BC.h" +#include "unk_02017728.h" +#include "heap.h" +#include "unk_0201E3D8.h" +#include "gx_layers.h" +#include "unk_02020020.h" +#include "unk_0202419C.h" +#include "unk_02024220.h" +#include "overlay121/DWWarp.h" + +typedef struct { + GenericPointerData * p3DCallback; + UnkStruct_020203AC * camera; + SysTask * task; + int frame_cnt; + int soundEffect_cnt; + UnkStruct_02017294 animation_obj; + UnkStruct_02017248 animation_animation; + UnkStruct_02017248 animation_animation2; + UnkStruct_020170F4 animation_model; + u32 move_frame; + int camera_angle; + int camera_angle_calc; + fx32 camera_distance; + int camera_perspective; + NNSFndAllocator allocator; +} DistortionWorld_Warp; + +static void DW_Update(SysTask * task, void * data); +static void DW_VBlankIntr(void * data); +static void DW_VramSetBank(void); +static void DW_InitCamera(DistortionWorld_Warp * warp); +static void DWWarp_CameraEnd(DistortionWorld_Warp * warp); +static void DWWarp_InitModel(DistortionWorld_Warp * warp); +static void DWWarp_DeleteModel(DistortionWorld_Warp * warp); +static void Model3D_Update(DistortionWorld_Warp * warp); +static GenericPointerData * DWWarp_Init3D(int heapId); +static void DWWarp_Setup3D(void); +static void DWWarp_Exit3D(GenericPointerData * param0); +static void DWWarp_CameraMove(DistortionWorld_Warp * warp); + +// Initializes the Distortion World warp effect overlay. +int DWWarp_Init (OverlayManager * ovy, int * seq) +{ + DistortionWorld_Warp * dww; + + SetMainCallback(NULL, NULL); + DisableHBlank(); + GXLayers_DisableEngineALayers(); + GXLayers_DisableEngineBLayers(); + + GX_SetVisiblePlane(0); + GXS_SetVisiblePlane(0); + GX_SetVisibleWnd(GX_WNDMASK_NONE); + GXS_SetVisibleWnd(GX_WNDMASK_NONE); + G2_BlendNone(); + G2S_BlendNone(); + + Heap_Create(3, 30, 0x50000); + + dww = OverlayManager_NewData(ovy, sizeof(DistortionWorld_Warp), 30); + MI_CpuClear8(dww, sizeof(DistortionWorld_Warp)); + dww->p3DCallback = DWWarp_Init3D(30); + + SetAutorepeat(4, 8); + DW_VramSetBank(); + sub_0201E3D8(); + sub_0201E450(4); + + DWWarp_InitModel(dww); + DW_InitCamera(dww); + sub_0200F174(0, 1, 1, 0x0, 16, 1, 30); + + gCoreSys.unk_65 = 0; + + GXLayers_SwapDisplay(); + GXLayers_TurnBothDispOn(); + sub_02002AC8(1); + sub_02002AE4(0); + sub_02002B20(0); + + dww->task = SysTask_Start(DW_Update, dww, 60000); + SetMainCallback(DW_VBlankIntr, dww); + + return TRUE; +} + +enum { + DWARP_SEQ_SCREENWIPE = 0, + DWARP_SEQ_LOOP, + DWARP_SEQ_CLEAR_SCREEN, + DWARP_SEQ_WAIT +}; + +int DWWarp_Main (OverlayManager * ovy, int * seq) +{ + DistortionWorld_Warp * warp = OverlayManager_Data(ovy); + + // Handle the different states of the warp effect. + switch (*seq) { + case DWARP_SEQ_SCREENWIPE: + if (ScreenWipe_Done() == TRUE) { + (*seq)++; + } + break; + case DWARP_SEQ_LOOP: + // Play the portal sound effect after 15 frames + if (warp->soundEffect_cnt == 15) { + Sound_PlayEffect(1491); + } + + warp->soundEffect_cnt++; + warp->frame_cnt++; + + // Continue to the next sequence after 85 frames + if (warp->frame_cnt > 85) { + (*seq)++; + } + break; + case DWARP_SEQ_CLEAR_SCREEN: + // Clear the screen to black + sub_0200F174(0, 0, 0, 0x0, 20, 1, 30); + (*seq)++; + break; + case DWARP_SEQ_WAIT: + // Wait for the screen wipe to finish + if (ScreenWipe_Done() == TRUE) { + return 1; + } + break; + } + + DWWarp_CameraMove(warp); + + return 0; +} + +// Exits the Distortion World warp effect overlay. +int DWWarp_Exit (OverlayManager * ovy, int * seq) +{ + DistortionWorld_Warp * warp = OverlayManager_Data(ovy); + + SysTask_Done(warp->task); + + DWWarp_DeleteModel(warp); + DWWarp_CameraEnd(warp); + DWWarp_Exit3D(warp->p3DCallback); + + SetMainCallback(NULL, NULL); + DisableHBlank(); + sub_0201E530(); + sub_02002AC8(0); + sub_02002AE4(0); + sub_02002B20(0); + OverlayManager_FreeData(ovy); + Heap_Destroy(30); + + return TRUE; +} + +static void DW_Update (SysTask * task, void * data) +{ + DistortionWorld_Warp * dw = data; + + Model3D_Update(dw); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_W); +} + +static void DW_VBlankIntr (void * data) +{ + DistortionWorld_Warp * dw = data; + OS_SetIrqCheckFlag(OS_IE_V_BLANK); +} + +static void DW_VramSetBank (void) +{ + GXLayers_DisableEngineALayers(); + GXLayers_DisableEngineBLayers(); + + { + UnkStruct_02099F80 vramBank = { + GX_VRAM_BG_128_C, + GX_VRAM_BGEXTPLTT_NONE, + GX_VRAM_SUB_BG_32_H, + GX_VRAM_SUB_BGEXTPLTT_NONE, + GX_VRAM_OBJ_64_E, + GX_VRAM_OBJEXTPLTT_NONE, + GX_VRAM_SUB_OBJ_16_I, + GX_VRAM_SUB_OBJEXTPLTT_NONE, + GX_VRAM_TEX_01_AB, + GX_VRAM_TEXPLTT_01_FG + }; + + GXLayers_SetBanks(&vramBank); + + MI_CpuClear32((void *)HW_BG_VRAM, HW_BG_VRAM_SIZE); + MI_CpuClear32((void *)HW_DB_BG_VRAM, HW_DB_BG_VRAM_SIZE); + MI_CpuClear32((void *)HW_OBJ_VRAM, HW_OBJ_VRAM_SIZE); + MI_CpuClear32((void *)HW_DB_OBJ_VRAM, HW_DB_OBJ_VRAM_SIZE); + } +} + +static void DW_InitCamera (DistortionWorld_Warp * warp) +{ + { + static const CameraAngle DWW_CameraAngle = { + (0x10000 - 0x1c7d), + ((0 * 0xffff) / 360), + ((0 * 0xffff) / 360), + }; + VecFx32 target = {0, 0, 0}; + + warp->camera = sub_020203AC(30); + + sub_020206D0(&target, (160 << FX32_SHIFT), &DWW_CameraAngle, (((22 * 0xffff) / 360)), 0, 0, warp->camera); + sub_020206BC(0, (FX32_ONE * 300), warp->camera); + + { + CameraAngle angle = {0, 0, 0, 0}; + + angle = sub_02020A94(warp->camera); + angle.x = (0x10000 - 0x3fef); + + Camera_SetAngle(&angle, warp->camera); + } + + sub_020203D4(warp->camera); + } +} + +static void DWWarp_CameraEnd (DistortionWorld_Warp * warp) +{ + sub_020203B8(warp->camera); +} + +static void DWWarp_InitModel (DistortionWorld_Warp * warp) +{ + NARC * narc; + + Heap_FndInitAllocatorForExpHeap(&warp->allocator, 30, 4); + + narc = NARC_ctor(NARC_INDEX_DEMO__TITLE__TITLEDEMO, 30); + + { + sub_020170D8(&warp->animation_model, narc, 16, 30); + + NNS_G3dMdlUseMdlAlpha(warp->animation_model.unk_08); + NNS_G3dMdlUseMdlPolygonID(warp->animation_model.unk_08); + + sub_02017164(&warp->animation_animation, &warp->animation_model, narc, 18, 30, &warp->allocator); + sub_02017240(&warp->animation_animation, 0); + + sub_02017164(&warp->animation_animation2, &warp->animation_model, narc, 17, 30, &warp->allocator); + sub_02017240(&warp->animation_animation2, 0); + sub_02017258(&warp->animation_obj, &warp->animation_model); + + sub_02017350(&warp->animation_obj, 0, 0, 0); + sub_0201736C(&warp->animation_obj, (FX32_ONE), (FX32_ONE), (FX32_ONE)); + sub_02017348(&warp->animation_obj, 1); + + sub_0201727C(&warp->animation_obj, &warp->animation_animation); + sub_0201727C(&warp->animation_obj, &warp->animation_animation2); + } + + NARC_dtor(narc); + + warp->camera_angle = ((0x10000 - 0x3fef) - (0x10000 - 0x1c7d)) / 30; + warp->camera_angle_calc = (0x10000 - 0x1c7d); + warp->camera_distance = (FX32_ONE); + warp->camera_perspective = (60 << 8); +} + +static void DWWarp_DeleteModel (DistortionWorld_Warp * warp) +{ + sub_02017110(&warp->animation_model); + sub_020171A0(&warp->animation_animation, &warp->allocator); + sub_020171A0(&warp->animation_animation2, &warp->allocator); +} + +static void Model3D_Update (DistortionWorld_Warp * warp) +{ + VecFx32 scaleVec, transVec; + MtxFx33 rot33; + + scaleVec.x = FX32_ONE; + scaleVec.y = FX32_ONE; + scaleVec.z = FX32_ONE; + + transVec.x = 0; + transVec.y = 0; + transVec.z = 0; + + MTX_Identity33(&rot33); + + sub_020241B4(); + sub_020203D4(warp->camera); + sub_02020854(0, warp->camera); + sub_020203EC(); + + NNS_G3dGlbLightVector(0, 0, -FX32_ONE, 0); + NNS_G3dGlbLightColor(0, GX_RGB(28, 28, 28)); + NNS_G3dGlbMaterialColorDiffAmb(GX_RGB(31, 31, 31), GX_RGB(31, 31, 31), FALSE); + NNS_G3dGlbMaterialColorSpecEmi(GX_RGB(31, 31, 31), GX_RGB(31, 31, 31), FALSE); + NNS_G3dGlbSetBaseTrans(&transVec); + NNS_G3dGlbSetBaseRot(&rot33); + NNS_G3dGlbSetBaseScale(&scaleVec); + + sub_020171CC(&warp->animation_animation, FX32_ONE); + sub_020171CC(&warp->animation_animation2, FX32_ONE); + + NNS_G3dGePushMtx(); + + { + sub_02017294(&warp->animation_obj); + } + + NNS_G3dGePopMtx(1); +} + +static GenericPointerData * DWWarp_Init3D (int param0) +{ + GenericPointerData * v0; + + v0 = sub_02024220(param0, 0, 2, 0, 2, DWWarp_Setup3D); + return v0; +} + +static void DWWarp_Setup3D (void) +{ + GXLayers_EngineAToggleLayers(GX_PLANEMASK_BG0, 1); + + G2_SetBG0Priority(1); + + G3X_SetShading(GX_SHADING_TOON); + G3X_AntiAlias(TRUE); + G3X_AlphaTest(FALSE, 0); + G3X_AlphaBlend(TRUE); + G3X_EdgeMarking(FALSE); + G3X_SetFog(FALSE, GX_FOGBLEND_COLOR_ALPHA, GX_FOGSLOPE_0x8000, 0); + G3X_SetClearColor(GX_RGB(0, 0, 0), 0, 0x7fff, 63, FALSE); + G3_ViewPort(0, 0, 255, 191); +} + +static void DWWarp_Exit3D (GenericPointerData * param0) +{ + sub_020242C4(param0); +} + +static void DWWarp_CameraMove (DistortionWorld_Warp * warp) +{ + VecFx32 v0 = {0, 0, 0}; + CameraAngle v1 = {0, 0, 0, 0}; + int v2; + + sub_0202094C(-(warp->camera_perspective >> 8), warp->camera); + warp->camera_perspective -= 0x80; + + if (warp->camera_perspective < (16 << 8)) { + warp->camera_perspective = (16 << 8); + } + + warp->move_frame++; +} diff --git a/src/overlay121/ov121_021D0D80.c b/src/overlay121/ov121_021D0D80.c deleted file mode 100644 index d2fb0c009..000000000 --- a/src/overlay121/ov121_021D0D80.c +++ /dev/null @@ -1,370 +0,0 @@ -#include -#include - -#include "core_sys.h" - -#include "struct_decls/struct_02006C24_decl.h" -#include "struct_decls/sys_task.h" - -#include "struct_defs/struct_020170F4.h" -#include "struct_defs/struct_02017248.h" -#include "struct_defs/struct_02017294.h" -#include "struct_defs/struct_0207C690.h" -#include "struct_defs/struct_02099F80.h" -#include "overlay115/camera_angle.h" - -#include "unk_02002328.h" -#include "unk_02005474.h" -#include "overlay_manager.h" -#include "narc.h" -#include "unk_0200D9E8.h" -#include "unk_0200F174.h" -#include "unk_020170BC.h" -#include "unk_02017728.h" -#include "heap.h" -#include "unk_0201E3D8.h" -#include "gx_layers.h" -#include "camera.h" -#include "unk_0202419C.h" -#include "unk_02024220.h" -#include "overlay121/ov121_021D0D80.h" - -typedef struct { - GenericPointerData * unk_00; - Camera * camera; - SysTask * unk_08; - int unk_0C; - int unk_10; - UnkStruct_02017294 unk_14; - UnkStruct_02017248 unk_8C; - UnkStruct_02017248 unk_A0; - UnkStruct_020170F4 unk_B4; - u32 unk_C4; - int unk_C8; - int unk_CC; - fx32 unk_D0; - int unk_D4; - NNSFndAllocator unk_D8; -} UnkStruct_ov121_021D0FF4; - -static void ov121_021D0F68(SysTask * param0, void * param1); -static void ov121_021D0F7C(void * param0); -static void ov121_021D0F94(void); -static void ov121_021D0FF4(UnkStruct_ov121_021D0FF4 * param0); -static void ov121_021D1068(UnkStruct_ov121_021D0FF4 * param0); -static void ov121_021D1074(UnkStruct_ov121_021D0FF4 * param0); -static void ov121_021D1184(UnkStruct_ov121_021D0FF4 * param0); -static void ov121_021D11A8(UnkStruct_ov121_021D0FF4 * param0); -static GenericPointerData * ov121_021D1270(int param0); -static void ov121_021D128C(void); -static void ov121_021D1310(GenericPointerData * param0); -static void ov121_021D1318(UnkStruct_ov121_021D0FF4 * param0); - -int ov121_021D0D80 (OverlayManager * param0, int * param1) -{ - UnkStruct_ov121_021D0FF4 * v0; - - SetMainCallback(NULL, NULL); - DisableHBlank(); - GXLayers_DisableEngineALayers(); - GXLayers_DisableEngineBLayers(); - - GX_SetVisiblePlane(0); - GXS_SetVisiblePlane(0); - GX_SetVisibleWnd(GX_WNDMASK_NONE); - GXS_SetVisibleWnd(GX_WNDMASK_NONE); - G2_BlendNone(); - G2S_BlendNone(); - - Heap_Create(3, 30, 0x50000); - - v0 = OverlayManager_NewData(param0, sizeof(UnkStruct_ov121_021D0FF4), 30); - MI_CpuClear8(v0, sizeof(UnkStruct_ov121_021D0FF4)); - v0->unk_00 = ov121_021D1270(30); - - SetAutorepeat(4, 8); - ov121_021D0F94(); - sub_0201E3D8(); - sub_0201E450(4); - - ov121_021D1074(v0); - ov121_021D0FF4(v0); - sub_0200F174(0, 1, 1, 0x0, 16, 1, 30); - - gCoreSys.unk_65 = 0; - - GXLayers_SwapDisplay(); - GXLayers_TurnBothDispOn(); - sub_02002AC8(1); - sub_02002AE4(0); - sub_02002B20(0); - - v0->unk_08 = SysTask_Start(ov121_021D0F68, v0, 60000); - SetMainCallback(ov121_021D0F7C, v0); - - return 1; -} - -int ov121_021D0E7C (OverlayManager * param0, int * param1) -{ - UnkStruct_ov121_021D0FF4 * v0 = OverlayManager_Data(param0); - - switch (*param1) { - case 0: - if (ScreenWipe_Done() == 1) { - (*param1)++; - } - break; - case 1: - if (v0->unk_10 == 15) { - Sound_PlayEffect(1491); - } - - v0->unk_10++; - v0->unk_0C++; - - if (v0->unk_0C > 85) { - (*param1)++; - } - break; - case 2: - sub_0200F174(0, 0, 0, 0x0, 20, 1, 30); - (*param1)++; - break; - case 3: - if (ScreenWipe_Done() == 1) { - return 1; - } - break; - } - - ov121_021D1318(v0); - - return 0; -} - -int ov121_021D0F14 (OverlayManager * param0, int * param1) -{ - UnkStruct_ov121_021D0FF4 * v0 = OverlayManager_Data(param0); - - SysTask_Done(v0->unk_08); - - ov121_021D1184(v0); - ov121_021D1068(v0); - ov121_021D1310(v0->unk_00); - - SetMainCallback(NULL, NULL); - DisableHBlank(); - sub_0201E530(); - sub_02002AC8(0); - sub_02002AE4(0); - sub_02002B20(0); - OverlayManager_FreeData(param0); - Heap_Destroy(30); - - return 1; -} - -static void ov121_021D0F68 (SysTask * param0, void * param1) -{ - UnkStruct_ov121_021D0FF4 * v0 = param1; - - ov121_021D11A8(v0); - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_W); -} - -static void ov121_021D0F7C (void * param0) -{ - UnkStruct_ov121_021D0FF4 * v0 = param0; - OS_SetIrqCheckFlag(OS_IE_V_BLANK); -} - -static void ov121_021D0F94 (void) -{ - GXLayers_DisableEngineALayers(); - GXLayers_DisableEngineBLayers(); - - { - UnkStruct_02099F80 v0 = { - GX_VRAM_BG_128_C, - GX_VRAM_BGEXTPLTT_NONE, - GX_VRAM_SUB_BG_32_H, - GX_VRAM_SUB_BGEXTPLTT_NONE, - GX_VRAM_OBJ_64_E, - GX_VRAM_OBJEXTPLTT_NONE, - GX_VRAM_SUB_OBJ_16_I, - GX_VRAM_SUB_OBJEXTPLTT_NONE, - GX_VRAM_TEX_01_AB, - GX_VRAM_TEXPLTT_01_FG - }; - - GXLayers_SetBanks(&v0); - - MI_CpuClear32((void *)HW_BG_VRAM, HW_BG_VRAM_SIZE); - MI_CpuClear32((void *)HW_DB_BG_VRAM, HW_DB_BG_VRAM_SIZE); - MI_CpuClear32((void *)HW_OBJ_VRAM, HW_OBJ_VRAM_SIZE); - MI_CpuClear32((void *)HW_DB_OBJ_VRAM, HW_DB_OBJ_VRAM_SIZE); - } -} - -static void ov121_021D0FF4 (UnkStruct_ov121_021D0FF4 * param0) -{ - { - static const CameraAngle v0 = { - (0x10000 - 0x1c7d), - ((0 * 0xffff) / 360), - ((0 * 0xffff) / 360), - }; - VecFx32 v1 = {0, 0, 0}; - - param0->camera = Camera_Alloc(30); - - Camera_InitWithTarget(&v1, (160 << FX32_SHIFT), &v0, (((22 * 0xffff) / 360)), 0, 0, param0->camera); - Camera_SetClipping(0, (FX32_ONE * 300), param0->camera); - - { - CameraAngle v2 = {0, 0, 0, 0}; - - v2 = Camera_GetAngle(param0->camera); - v2.x = (0x10000 - 0x3fef); - - Camera_SetAngleAroundTarget(&v2, param0->camera); - } - - Camera_SetAsActive(param0->camera); - } -} - -static void ov121_021D1068 (UnkStruct_ov121_021D0FF4 * param0) -{ - Camera_Delete(param0->camera); -} - -static void ov121_021D1074 (UnkStruct_ov121_021D0FF4 * param0) -{ - NARC * v0; - - Heap_FndInitAllocatorForExpHeap(¶m0->unk_D8, 30, 4); - - v0 = NARC_ctor(NARC_INDEX_DEMO__TITLE__TITLEDEMO, 30); - - { - sub_020170D8(¶m0->unk_B4, v0, 16, 30); - - NNS_G3dMdlUseMdlAlpha(param0->unk_B4.unk_08); - NNS_G3dMdlUseMdlPolygonID(param0->unk_B4.unk_08); - - sub_02017164(¶m0->unk_8C, ¶m0->unk_B4, v0, 18, 30, ¶m0->unk_D8); - sub_02017240(¶m0->unk_8C, 0); - - sub_02017164(¶m0->unk_A0, ¶m0->unk_B4, v0, 17, 30, ¶m0->unk_D8); - sub_02017240(¶m0->unk_A0, 0); - sub_02017258(¶m0->unk_14, ¶m0->unk_B4); - - sub_02017350(¶m0->unk_14, 0, 0, 0); - sub_0201736C(¶m0->unk_14, (FX32_ONE), (FX32_ONE), (FX32_ONE)); - sub_02017348(¶m0->unk_14, 1); - - sub_0201727C(¶m0->unk_14, ¶m0->unk_8C); - sub_0201727C(¶m0->unk_14, ¶m0->unk_A0); - } - - NARC_dtor(v0); - - param0->unk_C8 = ((0x10000 - 0x3fef) - (0x10000 - 0x1c7d)) / 30; - param0->unk_CC = (0x10000 - 0x1c7d); - param0->unk_D0 = (FX32_ONE); - param0->unk_D4 = (60 << 8); -} - -static void ov121_021D1184 (UnkStruct_ov121_021D0FF4 * param0) -{ - sub_02017110(¶m0->unk_B4); - sub_020171A0(¶m0->unk_8C, ¶m0->unk_D8); - sub_020171A0(¶m0->unk_A0, ¶m0->unk_D8); -} - -static void ov121_021D11A8 (UnkStruct_ov121_021D0FF4 * param0) -{ - VecFx32 v0, v1; - MtxFx33 v2; - - v0.x = FX32_ONE; - v0.y = FX32_ONE; - v0.z = FX32_ONE; - - v1.x = 0; - v1.y = 0; - v1.z = 0; - - MTX_Identity33(&v2); - - sub_020241B4(); - Camera_SetAsActive(param0->camera); - Camera_ComputeProjectionMatrix(0, param0->camera); - Camera_ComputeViewMatrix(); - - NNS_G3dGlbLightVector(0, 0, -FX32_ONE, 0); - NNS_G3dGlbLightColor(0, GX_RGB(28, 28, 28)); - NNS_G3dGlbMaterialColorDiffAmb(GX_RGB(31, 31, 31), GX_RGB(31, 31, 31), 0); - NNS_G3dGlbMaterialColorSpecEmi(GX_RGB(31, 31, 31), GX_RGB(31, 31, 31), 0); - NNS_G3dGlbSetBaseTrans(&v1); - NNS_G3dGlbSetBaseRot(&v2); - NNS_G3dGlbSetBaseScale(&v0); - - sub_020171CC(¶m0->unk_8C, FX32_ONE); - sub_020171CC(¶m0->unk_A0, FX32_ONE); - - NNS_G3dGePushMtx(); - - { - sub_02017294(¶m0->unk_14); - } - - NNS_G3dGePopMtx(1); -} - -static GenericPointerData * ov121_021D1270 (int param0) -{ - GenericPointerData * v0; - - v0 = sub_02024220(param0, 0, 2, 0, 2, ov121_021D128C); - return v0; -} - -static void ov121_021D128C (void) -{ - GXLayers_EngineAToggleLayers(GX_PLANEMASK_BG0, 1); - - G2_SetBG0Priority(1); - - G3X_SetShading(GX_SHADING_TOON); - G3X_AntiAlias(1); - G3X_AlphaTest(0, 0); - G3X_AlphaBlend(1); - G3X_EdgeMarking(0); - G3X_SetFog(0, GX_FOGBLEND_COLOR_ALPHA, GX_FOGSLOPE_0x8000, 0); - G3X_SetClearColor(GX_RGB(0, 0, 0), 0, 0x7fff, 63, 0); - G3_ViewPort(0, 0, 255, 191); -} - -static void ov121_021D1310 (GenericPointerData * param0) -{ - sub_020242C4(param0); -} - -static void ov121_021D1318 (UnkStruct_ov121_021D0FF4 * param0) -{ - VecFx32 v0 = {0, 0, 0}; - CameraAngle v1 = {0, 0, 0, 0}; - int v2; - - Camera_AdjustFOV(-(param0->unk_D4 >> 8), param0->camera); - param0->unk_D4 -= 0x80; - - if (param0->unk_D4 < (16 << 8)) { - param0->unk_D4 = (16 << 8); - } - - param0->unk_C4++; -} diff --git a/src/unk_0202419C.c b/src/unk_0202419C.c index 2b155b84d..15dcd40eb 100644 --- a/src/unk_0202419C.c +++ b/src/unk_0202419C.c @@ -22,7 +22,7 @@ void sub_020241B4 (void) G3X_Reset(); } -void sub_020241BC (GXSortMode param0, GXBufferMode param1) +void G3_RequestSwapBuffers (GXSortMode param0, GXBufferMode param1) { Unk_021C0788.unk_04 = param0; Unk_021C0788.unk_08 = param1; diff --git a/src/unk_0203D1B8.c b/src/unk_0203D1B8.c index fd9ddfccc..a238398f2 100644 --- a/src/unk_0203D1B8.c +++ b/src/unk_0203D1B8.c @@ -151,7 +151,7 @@ #include "overlay110/ov110_021D0D80.h" #include "overlay111/ov111_021D0D80.h" #include "overlay120/ov120_021D0D80.h" -#include "overlay121/ov121_021D0D80.h" +#include "overlay121/DWWarp.h" FS_EXTERN_OVERLAY(battle); FS_EXTERN_OVERLAY(overlay19); @@ -1835,9 +1835,9 @@ void sub_0203E704 (FieldSystem * fieldSystem) static const OverlayManagerTemplate Unk_020EA368 = { - ov121_021D0D80, - ov121_021D0E7C, - ov121_021D0F14, + DWWarp_Init, + DWWarp_Main, + DWWarp_Exit, FS_OVERLAY_ID(overlay121) }; diff --git a/src/unk_0207AE68.c b/src/unk_0207AE68.c index 333c486f4..b049ef141 100644 --- a/src/unk_0207AE68.c +++ b/src/unk_0207AE68.c @@ -179,7 +179,7 @@ static void sub_0207B0A0 (SysTask * param0, void * param1) sub_0207B180(v0); sub_02007768(v0->unk_18); sub_0207C770(); - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); if (v0->unk_67) { SysTask_Done(param0); diff --git a/src/unk_0207C63C.c b/src/unk_0207C63C.c index 5f2357f12..b694270e7 100644 --- a/src/unk_0207C63C.c +++ b/src/unk_0207C63C.c @@ -105,7 +105,7 @@ void sub_0207C770 (void) } sub_020146C0(); - sub_020241BC(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); + G3_RequestSwapBuffers(GX_SORTMODE_MANUAL, GX_BUFFERMODE_Z); } static u32 sub_0207C794 (u32 param0, BOOL param1)