Document the distortion world warp overlay.

This commit is contained in:
Evan 2024-06-19 18:04:52 -04:00
parent 310478f899
commit f38e97b37b
No known key found for this signature in database
GPG Key ID: 1DB54D7C0B0938F2
48 changed files with 446 additions and 431 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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'
)

View File

@ -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);
}
}

View File

@ -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)

View File

@ -399,7 +399,7 @@ BOOL ov21_021D10B8 (UnkStruct_ov21_021D0F60 * param0)
sub_020241B4();
ov21_021D2124(&param0->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;

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -1154,7 +1154,7 @@ static void ov69_0225CF50 (UnkStruct_ov69_0225CE64 * param0)
ov69_0225D854(&param0->unk_288, &param0->unk_1DC);
ov69_0225D384(&param0->unk_20);
sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
}
static void ov69_0225CF90 (void * param0)

View File

@ -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(&param0->unk_3C);
}

View File

@ -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)

View File

@ -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;
}
}

View File

@ -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)

View File

@ -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);
}
}

View File

@ -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) {

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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) {

View File

@ -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);
}
}

View File

@ -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)

View File

@ -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);

View File

@ -225,7 +225,7 @@ static void ov100_021D17B4 (UnkStruct_ov100_021D1808 * param0)
ov100_021D49B4(&param0->unk_1A4.unk_00[2]);
ov100_021D49B4(&param0->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)

View File

@ -763,5 +763,5 @@ static void ov100_021D2E0C (UnkStruct_ov100_021D1C98 * param0)
ov100_021D49B4(&param0->unk_1A0.unk_16FC[2]);
ov100_021D49B4(&param0->unk_1A0.unk_16FC[3]);
sub_020241BC(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
G3_RequestSwapBuffers(GX_SORTMODE_AUTO, GX_BUFFERMODE_W);
}

View File

@ -240,7 +240,7 @@ static void ov100_021D3558 (UnkStruct_ov100_021D3084 * param0)
ov100_021D49B4(&param0->unk_0C.unk_16FC[2]);
ov100_021D49B4(&param0->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)

View File

@ -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)

View File

@ -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);
}

View File

@ -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)

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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)

385
src/overlay121/DWWarp.c Normal file
View File

@ -0,0 +1,385 @@
#include <nitro.h>
#include <string.h>
#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++;
}

View File

@ -1,370 +0,0 @@
#include <nitro.h>
#include <string.h>
#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(&param0->unk_D8, 30, 4);
v0 = NARC_ctor(NARC_INDEX_DEMO__TITLE__TITLEDEMO, 30);
{
sub_020170D8(&param0->unk_B4, v0, 16, 30);
NNS_G3dMdlUseMdlAlpha(param0->unk_B4.unk_08);
NNS_G3dMdlUseMdlPolygonID(param0->unk_B4.unk_08);
sub_02017164(&param0->unk_8C, &param0->unk_B4, v0, 18, 30, &param0->unk_D8);
sub_02017240(&param0->unk_8C, 0);
sub_02017164(&param0->unk_A0, &param0->unk_B4, v0, 17, 30, &param0->unk_D8);
sub_02017240(&param0->unk_A0, 0);
sub_02017258(&param0->unk_14, &param0->unk_B4);
sub_02017350(&param0->unk_14, 0, 0, 0);
sub_0201736C(&param0->unk_14, (FX32_ONE), (FX32_ONE), (FX32_ONE));
sub_02017348(&param0->unk_14, 1);
sub_0201727C(&param0->unk_14, &param0->unk_8C);
sub_0201727C(&param0->unk_14, &param0->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(&param0->unk_B4);
sub_020171A0(&param0->unk_8C, &param0->unk_D8);
sub_020171A0(&param0->unk_A0, &param0->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(&param0->unk_8C, FX32_ONE);
sub_020171CC(&param0->unk_A0, FX32_ONE);
NNS_G3dGePushMtx();
{
sub_02017294(&param0->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++;
}

View File

@ -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;

View File

@ -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)
};

View File

@ -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);

View File

@ -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)