diff --git a/config/RSBE01_02/rels/st_tengan/splits.txt b/config/RSBE01_02/rels/st_tengan/splits.txt index cb535fa..3f7f60c 100644 --- a/config/RSBE01_02/rels/st_tengan/splits.txt +++ b/config/RSBE01_02/rels/st_tengan/splits.txt @@ -11,6 +11,31 @@ global_destructor_chain.c: .dtors start:0x00000000 end:0x00000008 .bss start:0x00000000 end:0x00000004 +mo_stage/st_tengan/st_tengan.cpp: + .text start:0x00000070 end:0x00006348 + .ctors start:0x00000000 end:0x00000004 + .rodata start:0x00000000 end:0x000000F8 + .data start:0x00000000 end:0x00000838 + .bss start:0x00000008 end:0x00000018 + +mo_stage/st_tengan/gr_tengan.cpp: + .text start:0x00006348 end:0x000065BC + .data start:0x00000838 end:0x00000AB8 + +mo_stage/st_tengan/gr_tengan_bg.cpp: + .text start:0x000065BC end:0x000067EC + .data start:0x00000AB8 end:0x00000DD0 + +mo_stage/st_tengan/gr_tengan_floor.cpp: + .text start:0x000067EC end:0x00007174 + .rodata start:0x000000F8 end:0x00000108 + .data start:0x00000DD0 end:0x00000FF0 + +mo_stage/st_tengan/gr_tengan_ashiba.cpp: + .text start:0x00007174 end:0x000077B4 + .rodata start:0x00000108 end:0x00000114 + .data start:0x00000FF0 end:0x00001208 + mo_stage/mo_stage.cpp: .text start:0x000077B4 end:0x00007850 .data start:0x00001208 end:0x00001215 diff --git a/config/RSBE01_02/rels/st_tengan/symbols.txt b/config/RSBE01_02/rels/st_tengan/symbols.txt index 40b89a4..ac2f558 100644 --- a/config/RSBE01_02/rels/st_tengan/symbols.txt +++ b/config/RSBE01_02/rels/st_tengan/symbols.txt @@ -1,27 +1,27 @@ __register_global_object = .text:0x00000000; // type:function size:0x1C scope:global __destroy_global_chain = .text:0x0000001C; // type:function size:0x54 scope:global -fn_60_70 = .text:0x00000070; // type:function size:0x34 -fn_60_A4 = .text:0x000000A4; // type:function size:0x1FC -fn_60_2A0 = .text:0x000002A0; // type:function size:0x198 -fn_60_438 = .text:0x00000438; // type:function size:0x8 -fn_60_440 = .text:0x00000440; // type:function size:0x1640 -fn_60_1A80 = .text:0x00001A80; // type:function size:0x8 -fn_60_1A88 = .text:0x00001A88; // type:function size:0x148 -fn_60_1BD0 = .text:0x00001BD0; // type:function size:0xD0 -fn_60_1CA0 = .text:0x00001CA0; // type:function size:0xDC -fn_60_1D7C = .text:0x00001D7C; // type:function size:0x8 -fn_60_1D84 = .text:0x00001D84; // type:function size:0x8 -fn_60_1D8C = .text:0x00001D8C; // type:function size:0x2A4 -fn_60_2030 = .text:0x00002030; // type:function size:0xFC -fn_60_212C = .text:0x0000212C; // type:function size:0x8 -fn_60_2134 = .text:0x00002134; // type:function size:0x1B0 -fn_60_22E4 = .text:0x000022E4; // type:function size:0x8 -fn_60_22EC = .text:0x000022EC; // type:function size:0x8 -fn_60_22F4 = .text:0x000022F4; // type:function size:0x8 -fn_60_22FC = .text:0x000022FC; // type:function size:0x10 +create__8stTenganFv = .text:0x00000070; // type:function size:0x34 +__ct__8stTenganFv = .text:0x000000A4; // type:function size:0x1FC +__dt__8stTenganFv = .text:0x000002A0; // type:function size:0x198 +loading__8stTenganFv = .text:0x00000438; // type:function size:0x8 +createObj__8stTenganFv = .text:0x00000440; // type:function size:0x1640 +setStageData__6GroundFPv = .text:0x00001A80; // type:function size:0x8 +createObjSkyLaser__8stTenganFi = .text:0x00001A88; // type:function size:0x148 +createObjEnkei__8stTenganFi = .text:0x00001BD0; // type:function size:0xD0 +createObjBg__8stTenganFi = .text:0x00001CA0; // type:function size:0xDC +setPosDialgaWork__10grTenganBgFP5Vec3f = .text:0x00001D7C; // type:function size:0x8 +setPosAshibaWork__10grTenganBgFP5Vec3f = .text:0x00001D84; // type:function size:0x8 +createObjDialga__8stTenganFi = .text:0x00001D8C; // type:function size:0x2A4 +createObjAshiba__8stTenganFi = .text:0x00002030; // type:function size:0xFC +setPosLimitWork__14grTenganAshibaFP5Vec3f = .text:0x0000212C; // type:function size:0x8 +createObjFloor__8stTenganFi = .text:0x00002134; // type:function size:0x1B0 +setFrameWork__13grTenganFloorFPf = .text:0x000022E4; // type:function size:0x8 +setStateWork__13grTenganFloorFPUc = .text:0x000022EC; // type:function size:0x8 +setType__13grTenganFloorFUc = .text:0x000022F4; // type:function size:0x8 +update__8stTenganFf = .text:0x000022FC; // type:function size:0x10 fn_60_230C = .text:0x0000230C; // type:function size:0x958 fn_60_2C64 = .text:0x00002C64; // type:function size:0x154 -fn_60_2DB8 = .text:0x00002DB8; // type:function size:0xFC +eventRebuildStageUpdate__8stTenganFv = .text:0x00002DB8; // type:function size:0xFC fn_60_2EB4 = .text:0x00002EB4; // type:function size:0x2A4 fn_60_3158 = .text:0x00003158; // type:function size:0x37C fn_60_34D4 = .text:0x000034D4; // type:function size:0x668 @@ -34,8 +34,8 @@ fn_60_4670 = .text:0x00004670; // type:function size:0x6D8 fn_60_4D48 = .text:0x00004D48; // type:function size:0x40C fn_60_5154 = .text:0x00005154; // type:function size:0x3C8 fn_60_551C = .text:0x0000551C; // type:function size:0x198 -fn_60_56B4 = .text:0x000056B4; // type:function size:0x9E4 -fn_60_6098 = .text:0x00006098; // type:function size:0x78 +updateEvent__8stTenganFf = .text:0x000056B4; // type:function size:0x9E4 +getZoneLightSetIndex__8stTenganFP5Vec3f = .text:0x00006098; // type:function size:0x78 fn_60_6110 = .text:0x00006110; // type:function size:0x4 fn_60_6114 = .text:0x00006114; // type:function size:0x8 fn_60_611C = .text:0x0000611C; // type:function size:0x8 @@ -48,8 +48,8 @@ fn_60_6148 = .text:0x00006148; // type:function size:0x8 fn_60_6150 = .text:0x00006150; // type:function size:0x8 fn_60_6158 = .text:0x00006158; // type:function size:0xC fn_60_6164 = .text:0x00006164; // type:function size:0xC -fn_60_6170 = .text:0x00006170; // type:function size:0x10 -fn_60_6180 = .text:0x00006180; // type:function size:0x14 +setBgmChange__5StageFfbUl = .text:0x00006170; // type:function size:0x10 +getBgmChangeID__5StageFPUlPf = .text:0x00006180; // type:function size:0x14 fn_60_6194 = .text:0x00006194; // type:function size:0x8 fn_60_619C = .text:0x0000619C; // type:function size:0x8 fn_60_61A4 = .text:0x000061A4; // type:function size:0x8 @@ -58,7 +58,7 @@ fn_60_61B4 = .text:0x000061B4; // type:function size:0x8 fn_60_61BC = .text:0x000061BC; // type:function size:0x4 fn_60_61C0 = .text:0x000061C0; // type:function size:0x1C fn_60_61DC = .text:0x000061DC; // type:function size:0x8 -fn_60_61E4 = .text:0x000061E4; // type:function size:0x8 +getAIRange__5StageFv = .text:0x000061E4; // type:function size:0x8 fn_60_61EC = .text:0x000061EC; // type:function size:0x8 fn_60_61F4 = .text:0x000061F4; // type:function size:0x8 fn_60_61FC = .text:0x000061FC; // type:function size:0xC @@ -68,47 +68,46 @@ fn_60_6214 = .text:0x00006214; // type:function size:0x8 fn_60_621C = .text:0x0000621C; // type:function size:0x8 fn_60_6224 = .text:0x00006224; // type:function size:0x8 fn_60_622C = .text:0x0000622C; // type:function size:0xC -fn_60_6238 = .text:0x00006238; // type:function size:0x64 -fn_60_629C = .text:0x0000629C; // type:function size:0x74 -fn_60_6310 = .text:0x00006310; // type:function size:0x34 -fn_60_6344 = .text:0x00006344; // type:function size:0x4 -fn_60_6348 = .text:0x00006348; // type:function size:0xD4 -fn_60_641C = .text:0x0000641C; // type:function size:0x8 -fn_60_6424 = .text:0x00006424; // type:function size:0x4C -fn_60_6470 = .text:0x00006470; // type:function size:0x58 -fn_60_64C8 = .text:0x000064C8; // type:function size:0x4 -fn_60_64CC = .text:0x000064CC; // type:function size:0x5C -fn_60_6528 = .text:0x00006528; // type:function size:0x8 -fn_60_6530 = .text:0x00006530; // type:function size:0x8 -fn_60_6538 = .text:0x00006538; // type:function size:0x8 -fn_60_6540 = .text:0x00006540; // type:function size:0x4 -fn_60_6544 = .text:0x00006544; // type:function size:0x4 -fn_60_6548 = .text:0x00006548; // type:function size:0x10 -fn_60_6558 = .text:0x00006558; // type:function size:0x10 -fn_60_6568 = .text:0x00006568; // type:function size:0xC -fn_60_6574 = .text:0x00006574; // type:function size:0x8 -fn_60_657C = .text:0x0000657C; // type:function size:0x4 -fn_60_6580 = .text:0x00006580; // type:function size:0x8 -fn_60_6588 = .text:0x00006588; // type:function size:0x1C -fn_60_65A4 = .text:0x000065A4; // type:function size:0x8 -fn_60_65AC = .text:0x000065AC; // type:function size:0x8 -fn_60_65B4 = .text:0x000065B4; // type:function size:0x8 -fn_60_65BC = .text:0x000065BC; // type:function size:0xD0 -fn_60_668C = .text:0x0000668C; // type:function size:0x58 -fn_60_66E4 = .text:0x000066E4; // type:function size:0x108 -fn_60_67EC = .text:0x000067EC; // type:function size:0x104 -fn_60_68F0 = .text:0x000068F0; // type:function size:0x58 -fn_60_6948 = .text:0x00006948; // type:function size:0x74 -fn_60_69BC = .text:0x000069BC; // type:function size:0x340 -fn_60_6CFC = .text:0x00006CFC; // type:function size:0x2C -fn_60_6D28 = .text:0x00006D28; // type:function size:0x4 -fn_60_6D2C = .text:0x00006D2C; // type:function size:0x448 -fn_60_7174 = .text:0x00007174; // type:function size:0xBC -fn_60_7230 = .text:0x00007230; // type:function size:0xBC -fn_60_72EC = .text:0x000072EC; // type:function size:0x58 -fn_60_7344 = .text:0x00007344; // type:function size:0x74 -fn_60_73B8 = .text:0x000073B8; // type:function size:0x354 -fn_60_770C = .text:0x0000770C; // type:function size:0xA8 +__sinit_\st_tengan_cpp = .text:0x00006238; // type:function size:0x64 +__dt__29stClassInfoImpl<21,8stTengan>Fv = .text:0x0000629C; // type:function size:0x74 +create__29stClassInfoImpl<21,8stTengan>Fv = .text:0x00006310; // type:function size:0x34 +preload__29stClassInfoImpl<21,8stTengan>Fv = .text:0x00006344; // type:function size:0x4 +create__8grTenganFiPCcPCc = .text:0x00006348; // type:function size:0xD4 +setMdlIndex__6GroundFi = .text:0x0000641C; // type:function size:0x8 +__ct__8grTenganFPCc = .text:0x00006424; // type:function size:0x4C +__dt__8grTenganFv = .text:0x00006470; // type:function size:0x58 +update__8grTenganFf = .text:0x000064C8; // type:function size:0x4 +setTgtNode__8grTenganFPCc = .text:0x000064CC; // type:function size:0x5C +getTgtNode__8grTenganFv = .text:0x00006528; // type:function size:0x8 +adventureEventGetItem__6GroundFiP13stTriggerData = .text:0x00006530; // type:function size:0x8 +getInitializeInfo__6GroundFi = .text:0x00006538; // type:function size:0x8 +setInitializeInfo__6GroundFi = .text:0x00006540; // type:function size:0x4 +setInitializeFlag__6GroundFv = .text:0x00006544; // type:function size:0x4 +disableCalcCollision__6GroundFv = .text:0x00006548; // type:function size:0x10 +enableCalcCollision__6GroundFv = .text:0x00006558; // type:function size:0x10 +isEnableCalcCollision__6GroundFv = .text:0x00006568; // type:function size:0xC +getMdlIndex__6GroundFv = .text:0x00006574; // type:function size:0x8 +initStageData__6GroundFv = .text:0x0000657C; // type:function size:0x4 +getStageData__6GroundFv = .text:0x00006580; // type:function size:0x8 +getModelCount__6GroundFv = .text:0x00006588; // type:function size:0x1C +getTransparencyFlag__9grGimmickFv = .text:0x000065A4; // type:function size:0x8 +getGimmickData__9grGimmickFv = .text:0x000065AC; // type:function size:0x8 +setGimmickData__9grGimmickFPv = .text:0x000065B4; // type:function size:0x8 +create__10grTenganBgFiPCcPCc = .text:0x000065BC; // type:function size:0xD0 +__dt__10grTenganBgFv = .text:0x0000668C; // type:function size:0x58 +update__10grTenganBgFf = .text:0x000066E4; // type:function size:0x108 +create__13grTenganFloorFiPCcPCc = .text:0x000067EC; // type:function size:0x104 +__dt__13grTenganFloorFv = .text:0x000068F0; // type:function size:0x58 +update__13grTenganFloorFf = .text:0x00006948; // type:function size:0x74 +updateActive__13grTenganFloorFf = .text:0x000069BC; // type:function size:0x340 +updatePreBuild__13grTenganFloorFf = .text:0x00006CFC; // type:function size:0x30 +setMotion__13grTenganFloorFUcbUlPf = .text:0x00006D2C; // type:function size:0x448 +create__14grTenganAshibaFiPCcPCc = .text:0x00007174; // type:function size:0xBC +__ct__14grTenganAshibaFPCc = .text:0x00007230; // type:function size:0xBC +__dt__14grTenganAshibaFv = .text:0x000072EC; // type:function size:0x58 +update__14grTenganAshibaFf = .text:0x00007344; // type:function size:0x74 +updateMove__14grTenganAshibaFf = .text:0x000073B8; // type:function size:0x354 +updateCallBack__14grTenganAshibaFf = .text:0x0000770C; // type:function size:0xA8 _prolog = .text:0x000077B4; // type:function size:0x48 scope:global _epilog = .text:0x000077FC; // type:function size:0x48 scope:global _unresolved = .text:0x00007844; // type:function size:0xC scope:global @@ -142,10 +141,10 @@ jumptable_60_data_4B8 = .data:0x000004B8; // type:object size:0x1C scope:local lbl_60_data_4D8 = .data:0x000004D8; // type:object size:0x238 lbl_60_data_710 = .data:0x00000710; // type:object size:0x9 data:string lbl_60_data_71C = .data:0x0000071C; // type:object size:0x24 -lbl_60_data_740 = .data:0x00000740; // type:object size:0x8 +__RTTI__8stTengan = .data:0x00000740; // type:object size:0x8 lbl_60_data_748 = .data:0x00000748; // type:object size:0x8 data:string lbl_60_data_750 = .data:0x00000750; // type:object size:0x20 -lbl_60_data_770 = .data:0x00000770; // type:object size:0x8 +__RTTI__7stMelee = .data:0x00000770; // type:object size:0x8 lbl_60_data_778 = .data:0x00000778; // type:object size:0x10 data:string lbl_60_data_788 = .data:0x00000788; // type:object size:0x18 lbl_60_data_7A0 = .data:0x000007A0; // type:object size:0x8 @@ -153,7 +152,7 @@ lbl_60_data_7A8 = .data:0x000007A8; // type:object size:0x6 data:string lbl_60_data_7B0 = .data:0x000007B0; // type:object size:0x10 lbl_60_data_7C0 = .data:0x000007C0; // type:object size:0x8 lbl_60_data_7C8 = .data:0x000007C8; // type:object size:0x7 data:string -lbl_60_data_7D0 = .data:0x000007D0; // type:object size:0x8 +__RTTI__6gfTask = .data:0x000007D0; // type:object size:0x8 lbl_60_data_7D8 = .data:0x000007D8; // type:object size:0x14 lbl_60_data_7EC = .data:0x000007EC; // type:object size:0x1E data:string lbl_60_data_80C = .data:0x0000080C; // type:object size:0xC @@ -161,19 +160,19 @@ lbl_60_data_818 = .data:0x00000818; // type:object size:0x8 lbl_60_data_820 = .data:0x00000820; // type:object size:0xC data:string lbl_60_data_830 = .data:0x00000830; // type:object size:0x8 lbl_60_data_838 = .data:0x00000838; // type:object size:0x8 -lbl_60_data_840 = .data:0x00000840; // type:object size:0x1C8 +__vt__8grTengan = .data:0x00000840; // type:object size:0x1C8 lbl_60_data_A08 = .data:0x00000A08; // type:object size:0x9 data:string lbl_60_data_A14 = .data:0x00000A14; // type:object size:0x24 -lbl_60_data_A38 = .data:0x00000A38; // type:object size:0x8 +__RTTI__8grTengan = .data:0x00000A38; // type:object size:0x8 lbl_60_data_A40 = .data:0x00000A40; // type:object size:0xB data:string lbl_60_data_A4C = .data:0x00000A4C; // type:object size:0x1C -lbl_60_data_A68 = .data:0x00000A68; // type:object size:0x8 +__RTTI__10grYakumono = .data:0x00000A68; // type:object size:0x8 lbl_60_data_A70 = .data:0x00000A70; // type:object size:0xA data:string lbl_60_data_A7C = .data:0x00000A7C; // type:object size:0x14 -lbl_60_data_A90 = .data:0x00000A90; // type:object size:0x8 +__RTTI__9grGimmick = .data:0x00000A90; // type:object size:0x8 lbl_60_data_A98 = .data:0x00000A98; // type:object size:0x7 data:string lbl_60_data_AA0 = .data:0x00000AA0; // type:object size:0x10 -lbl_60_data_AB0 = .data:0x00000AB0; // type:object size:0x8 +__RTTI__6Ground = .data:0x00000AB0; // type:object size:0x8 lbl_60_data_AB8 = .data:0x00000AB8; // type:object size:0x48 lbl_60_data_B00 = .data:0x00000B00; // type:object size:0x1D0 lbl_60_data_CD0 = .data:0x00000CD0; // type:object size:0xB data:string @@ -186,7 +185,7 @@ lbl_60_data_FE8 = .data:0x00000FE8; // type:object size:0x8 lbl_60_data_FF0 = .data:0x00000FF0; // type:object size:0x1D4 lbl_60_data_11C4 = .data:0x000011C4; // type:object size:0xF data:string lbl_60_data_11D4 = .data:0x000011D4; // type:object size:0x2C -lbl_60_data_1200 = .data:0x00001200; // type:object size:0x8 +__RTTI__14grTenganAshiba = .data:0x00001200; // type:object size:0x8 lbl_60_data_1208 = .data:0x00001208; // type:object size:0xD scope:local align:4 data:string HomeBtnIcon = .data:0x00001220; // type:object size:0x18C0 scope:global align:32 __global_destructor_chain = .bss:0x00000000; // type:object size:0x4 scope:global diff --git a/configure.py b/configure.py index d398217..7a4e8b5 100755 --- a/configure.py +++ b/configure.py @@ -1373,7 +1373,13 @@ def MatchingFor(*versions): "mw_version": config.linker_version, "cflags": cflags_rel, "host": False, - "objects": [], + "objects": [ + Object(NonMatching, "mo_stage/st_tengan/st_tengan.cpp"), + Object(Matching, "mo_stage/st_tengan/gr_tengan.cpp"), + Object(Matching, "mo_stage/st_tengan/gr_tengan_bg.cpp"), + Object(Matching, "mo_stage/st_tengan/gr_tengan_floor.cpp"), + Object(Matching, "mo_stage/st_tengan/gr_tengan_ashiba.cpp"), + ], }, { "lib": "st_village", diff --git a/include/st_tengan/gr_tengan.h b/include/st_tengan/gr_tengan.h new file mode 100644 index 0000000..221323d --- /dev/null +++ b/include/st_tengan/gr_tengan.h @@ -0,0 +1,26 @@ +#pragma once + +#include + +const float EFF_SOMETHING = 0.0f; +const float EFF_FRAME_MAX1 = 2540.0f; +const float EFF_FRAME_MAX2 = 6100.0f; +class grTengan : public grYakumono { +protected: + char m_tgtNode[0x80]; +// float unk_float; +// u8 type; +// u8 step; +// u16 padding; + +public: + grTengan(const char* taskName); + virtual void update(float deltaFrame); + virtual ~grTengan(); + + virtual void setTgtNode(const char *tgtNode); + virtual char* getTgtNode(); + + static grTengan* create(int mdlIndex, const char* tgtNodeName, const char* taskName); + +}; diff --git a/include/st_tengan/gr_tengan_ashiba.h b/include/st_tengan/gr_tengan_ashiba.h new file mode 100644 index 0000000..88fdab8 --- /dev/null +++ b/include/st_tengan/gr_tengan_ashiba.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include + +class grTenganAshiba : public grTengan { +protected: + u8 m_ashibaState; + float m_ashibaTimer; + Vec3f *m_posLimitWork; + Vec3f m_ashibaPos; + float m_ashibaPosY; + float m_speed; + bool m_isMovingUp; + u8 unk1F1; + +public: + grTenganAshiba(const char* taskName); + virtual ~grTenganAshiba(); + virtual void update(float deltaFrame); + virtual void updateMove(float deltaFrame); + virtual void updateCallBack(float deltaFrame); + + //virtual void setTgtNode(char *tgtNode); + //virtual char* getTgtNode(); + virtual void setPosLimitWork(Vec3f* pos); + + static grTenganAshiba* create(int mdlIndex, const char* tgtNodeName, const char* taskName); + +}; diff --git a/include/st_tengan/gr_tengan_bg.h b/include/st_tengan/gr_tengan_bg.h new file mode 100644 index 0000000..596b87c --- /dev/null +++ b/include/st_tengan/gr_tengan_bg.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include + +class grTenganBg : public grTengan { +protected: + Vec3f *posDialgaWork; + Vec3f *posAshibaWork; + +public: + grTenganBg(const char* taskName); + virtual ~grTenganBg(); + virtual void update(float deltaFrame); + + //virtual void setTgtNode(char *tgtNode); + //virtual char* getTgtNode(); + virtual void setPosDialgaWork(Vec3f* pos); + virtual void setPosAshibaWork(Vec3f* pos); + + static grTenganBg* create(int mdlIndex, const char* tgtNodeName, const char* taskName); + +}; diff --git a/include/st_tengan/gr_tengan_floor.h b/include/st_tengan/gr_tengan_floor.h new file mode 100644 index 0000000..6b1dde1 --- /dev/null +++ b/include/st_tengan/gr_tengan_floor.h @@ -0,0 +1,38 @@ +#pragma once + +#include +#include + +class grTenganFloor : public grYakumono { +protected: + +public: + Vec3f m_unused; + u8 m_state; + float m_stateTimer; + float* m_frameWork; + u8* m_stateWork; + u8 m_type; + u8 unk16d; + float unk170; + u8 m_animId; + float m_animTimer; + + grTenganFloor(const char* taskName); + virtual ~grTenganFloor(); + virtual void update(float deltaFrame); + virtual void updateActive(float deltaFrame); + virtual void updatePreBuild(float deltaFrame); + virtual void setMotion(u8 animId, bool shouldLoop, u32 unk3, float* frameCount); + virtual void setFrameWork(float* frameWork); + virtual void setStateWork(u8* stateWork); + virtual void setType(u8 type); + + //virtual void setTgtNode(char *tgtNode); + //virtual char* getTgtNode(); + //virtual void setPosDialgaWork(Vec3f* pos); + //virtual void setPosAshibaWork(Vec3f* pos); + + static grTenganFloor* create(int mdlIndex, const char* tgtNodeName, const char* taskName); + +}; diff --git a/include/st_tengan/st_tengan.h b/include/st_tengan/st_tengan.h new file mode 100644 index 0000000..8406ee6 --- /dev/null +++ b/include/st_tengan/st_tengan.h @@ -0,0 +1,134 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +template +class stClassInfoImpl : public stClassInfo { +public: + stClassInfoImpl() : stClassInfo() { + setClassInfo(Stages::Tengan, this); + }; + + virtual ~stClassInfoImpl() { + setClassInfo(Stages::Tengan, 0); + } + + virtual T* create() { + return T::create(); + } + + virtual void preload() { } +}; + +class stTengan : public stMelee { +// void* m_shrineStageData; + float unk1d8; + float unk1dc; + float unk1e0; + float unk1e4; + float unk1e8; + float unk1ec; + float unk1f0; + float unk1f4; + float unk1f8; + float unk1fc; + float unk200; + s32 m_substage; + snd3DGenerator snd_gen; + u32 unk210; + u32 unk214; + u32 unk218; + grTenganEvent event1; + grTenganEvent event2; + grTenganEvent eventLegendDisappear; + grTenganEvent eventLaser; + grTenganEvent eventQuake; + grTenganEvent eventCameraRoll; + grTenganEvent eventSlow; + grTenganEvent eventDropStage; + grTenganEvent eventRebuildStage; + grTenganEvent eventAura; + grTenganEvent eventUpDownReverse; + grTenganEvent eventLeftRightReverse; + grTenganEvent eventGravityHalf; + grTenganEvent event14; + grTenganEvent event15; + grTenganEvent eventBoomerang; + grTenganEvent eventRandomCall; + grTenganEvent eventSonicWaveCall; + Vec3f posDialga; + float unke40; + float unke44; + float unke48; + u32 unke4c; + u32 unke50; + u8 unke54; + u8 unke55; + float unke58; + float unke5c; + u8 unke60; + float m_rebuildTimer; + u8 m_stateFloorL; + u8 m_stateFloorC; + u8 m_stateFloorR; + u8 unke6b; + Vec3f posAshibaWork[4]; + u32 unke9c; + u32 unkea0; + float unkea4; + u8 unkea8; + u32 unkeac; + u32 unkeb0; + u32 unkeb4; + u8 unkeb8; + u8 unkeb9; + u8 unkeba; + float unkebc; + float unkec0; + float unkec4; + u8 unkec8; + float unkecc; + float unked0; + float unked4; + float unked8; + u32 unkedc; + u32 unkee0; + u32 unkee4; + float unkee8; + float unkeec; + u8 unkef0; + char m_slow; + // TODO: float array? + + public: + bool eventRebuildStageUpdate(); + + stTengan(); + virtual ~stTengan(); + virtual void createObj(); + virtual void createObjEnkei(int index); + virtual void createObjBg(int index); + virtual void createObjDialga(int index); + virtual void createObjAshiba(int index); + virtual void createObjFloor(int index); + virtual void createObjSkyLaser(int index); + virtual bool loading(); + virtual void update(float deltaFrame); + virtual void updateEvent(float deltaFrame); + virtual u32 getZoneLightSetIndex(Vec2f *position); +// virtual void update(float deltaFrame); +// virtual void initStageData(); +// virtual bool isReStartSamePoint() { return false; } + virtual GXColor getFinalTechniqColor() { return nw4r::ut::Color(0x1400047d); } + virtual bool isBamperVector() { return true; } +// virtual void notifyEventInfoGo(); + static stTengan* create(); + static stClassInfoImpl bss_loc_14; +}; diff --git a/include/st_tengan/st_tengan_data.h b/include/st_tengan/st_tengan_data.h new file mode 100644 index 0000000..31da234 --- /dev/null +++ b/include/st_tengan/st_tengan_data.h @@ -0,0 +1,72 @@ +struct stTenganParams { + float yuka_fly_accel; + float yuka_fly_speed_max; + float yuka_fly_rate_stop; + float yuka_fly_frame_stop_min; + float yuka_fly_frame_stop_max; + float yuka_fly_rate_turn; + float yuka_break_frame_rebuild_min; + float yuka_break_frame_rebuild_max; + float unk20; + float unk24; + float unk28; + float unk2C; + float unk30; + float unk34; + float unk38; + float unk3C; + float unk40; + float unk44; + float legend_frame_disappear_min; + float legend_frame_disappear_max; + float guest_rate_guest; + float guest_rate_emlit; + float guest_rate_uxi; + float guest_rate_agnom; + float guest_frame_emlit_out_min; + float guest_frame_emlit_out_max; + float guest_frame_uxiagnom_out_min; + float guest_frame_uxiagnom_out_max; + float event_angle_rot_screen_min; + float event_angle_rot_screen_max; + float event_angle_rot_return; + float event_frame_quake; + float event_frame_tobreak_min; + float event_frame_tobreak_max; + float unk88; + float unk8C; + float unk90; //laser related + float unk94; //laser related + float event_d_rate_rot_screen; + float event_d_rate_quake; + float event_d_rate_laser_y; + float event_d_rate_laser_x; + float event_d_rate_slow; + float event_d_rate_aura; + float event_d_rate_slow_1_2; + float event_d_rate_slow_1_3; + float event_d_rate_slow_1_4; + float event_d_frame_slow_min; + float event_d_frame_slow_max; + float event_d_frame_aura_min; + float event_d_frame_aura_max; + float event_p_rate_rot_screen; + float event_p_rate_quake; + float event_p_rate_laser_y; + float event_p_rate_laser_x; + float event_p_rate_gravity_half; + float event_p_rate_reverse_y; + float event_p_rate_reverse_x; + float event_p_frame_gravityhalf_min; + float event_p_frame_gravityhalf_max; + float event_p_frame_reversey_min; + float event_p_frame_reversey_max; + float event_p_frame_reversex_min; + float event_p_frame_reversex_max; + float event_c_rate_sonicwave; + float unk104; + float event_c_rate_boomerang; + float unk10C; + float unk110; + float unk114; +}; diff --git a/src/mo_stage/st_tengan/gr_tengan.cpp b/src/mo_stage/st_tengan/gr_tengan.cpp new file mode 100644 index 0000000..47205ea --- /dev/null +++ b/src/mo_stage/st_tengan/gr_tengan.cpp @@ -0,0 +1,42 @@ +#include +#include +#include + +grTengan* grTengan::create(int mdlIndex, const char* tgtNodeName, const char* taskName) +{ + grTengan* ground = new (Heaps::StageInstance) grTengan(taskName); + if (ground) { + ground->setMdlIndex(mdlIndex); + ground->setTgtNode(tgtNodeName); + } + ground->setupMelee(); + + return ground; +} + +grTengan::grTengan(const char* taskName) : grYakumono(taskName) { + memset(m_tgtNode,0,0x80); +} + +grTengan::~grTengan() { + +} + +void grTengan::update(float deltaFrame) +{ + grGimmick::update(deltaFrame); +} + +void grTengan::setTgtNode(const char* tgtNode) +{ + if (tgtNode) { + strcpy(m_tgtNode,""); + strncpy(m_tgtNode,tgtNode,0x7f); + } + //m_tgtNode = tgtNode; +} + +char* grTengan::getTgtNode() +{ + return m_tgtNode; +} diff --git a/src/mo_stage/st_tengan/gr_tengan_ashiba.cpp b/src/mo_stage/st_tengan/gr_tengan_ashiba.cpp new file mode 100644 index 0000000..29130f6 --- /dev/null +++ b/src/mo_stage/st_tengan/gr_tengan_ashiba.cpp @@ -0,0 +1,169 @@ +#include +#include +#include +#include +#include + +grTenganAshiba* grTenganAshiba::create(int mdlIndex, const char* tgtNodeName, const char* taskName) +{ + grTenganAshiba* ground = new (Heaps::StageInstance) grTenganAshiba(taskName); + if (ground) { + ground->setMdlIndex(mdlIndex); + ground->setTgtNode(tgtNodeName); + } + ground->setupMelee(); + + return ground; +} + +grTenganAshiba::grTenganAshiba(const char* taskName) : grTengan(taskName) { + grCalcWorldCallBack *callback = &m_calcWorldCallBack; + m_ashibaState = 0; + m_ashibaTimer = 0.0f; + m_posLimitWork = NULL; + m_ashibaPos.m_x = 0.0f; + m_ashibaPos.m_y = 0.0f; + m_ashibaPos.m_z = 0.0f; + m_ashibaPosY = 0.0f; + m_speed = 0.0f; + m_isMovingUp = 0; + unk1F1 = 0; + if (callback == NULL) { + return; + } + callback->m_numNodeCallbackData = 1; + callback->initialize(false, Heaps::StageInstance); + callback->m_nodeCallbackDatas[0].m_flags |= 1; + //m_calcWorldCallBack.m_nodeCallbackDatas[0].m_flag2 = true; + //this->setupMelee(); +// } +} + +grTenganAshiba::~grTenganAshiba() { + +} + +void grTenganAshiba::update(float deltaFrame) +{ + if (m_isUpdate) { + updateMove(deltaFrame); + updateCallBack(deltaFrame); + grTengan::update(deltaFrame); + } +} + +void grTenganAshiba::updateMove(float deltaFrame) { + if (m_posLimitWork != NULL) { + stTenganParams* tenganData = (stTenganParams*)getStageData(); + if (tenganData != NULL) { + if (m_posLimitWork[0].m_y != m_posLimitWork[1].m_y) { + float fVar1 = m_ashibaTimer - deltaFrame; + m_ashibaTimer = fVar1; + if (fVar1 < 0.0f) { + m_ashibaTimer = 0.0f; + } + switch(m_ashibaState) { + case 0: + m_ashibaPos.m_x = m_posLimitWork[1].m_x; + m_ashibaPos.m_y = m_posLimitWork[1].m_y; + m_ashibaPos.m_z = m_posLimitWork[1].m_z; + m_ashibaPos.m_y += (m_posLimitWork[0].m_y - m_posLimitWork[1].m_y)* randf(); + if (randf() < 0.5f) { + m_isMovingUp = 1; + } else { + m_isMovingUp = 0; + } + m_ashibaState = 1; + case 1: + if (m_ashibaTimer == 0.0f) { + m_speed = 0.0f; + unk1F1 = 0; + m_ashibaState = 2; + } + break; + case 2: + bool isForceTurn = 0; + bool isTurn = 0; + fVar1 = m_speed + tenganData->yuka_fly_accel; + m_speed = fVar1; + if (fVar1 > tenganData->yuka_fly_speed_max) { + m_speed = tenganData->yuka_fly_speed_max; + } + if (unk1F1 == 0 and m_speed == tenganData->yuka_fly_speed_max) { + if (randf() < tenganData->yuka_fly_rate_turn) { + isForceTurn = true;//(randf() < tenganData->yuka_fly_rate_turn); + } + unk1F1 = 1; + } + if (isForceTurn == true) { + isTurn = true; + } else if (m_isMovingUp == 1) { + fVar1 = m_speed * deltaFrame; + m_ashibaPos.m_y += fVar1; + if (m_ashibaPos.m_y >= m_posLimitWork[0].m_y) { + isTurn = true; + } + } else { + fVar1 = m_speed * deltaFrame; + m_ashibaPos.m_y -= fVar1; + if (m_ashibaPos.m_y <= m_posLimitWork[1].m_y) { + isTurn = true; + } + } + if (isTurn == true) { + m_ashibaState = 3; + m_ashibaPosY = m_ashibaPos.m_y; + } + break; + case 3: + fVar1 = m_speed - tenganData->yuka_fly_accel; + m_speed = fVar1; + if (fabs(fVar1) > tenganData->yuka_fly_speed_max) { + m_speed = tenganData->yuka_fly_speed_max * -1.0f; + } + if (m_isMovingUp == true) { + m_ashibaPos.m_y += m_speed * deltaFrame; + } else { + m_ashibaPos.m_y -= m_speed * deltaFrame; + } + if (((m_isMovingUp == true) and (m_ashibaPosY > m_ashibaPos.m_y)) + ||((m_isMovingUp == false) and (m_ashibaPosY < m_ashibaPos.m_y))) { + if (randf() < tenganData->yuka_fly_rate_stop) { + fVar1 = randf(); + float fVar2 = tenganData->yuka_fly_frame_stop_max; + float fVar3 = tenganData->yuka_fly_frame_stop_min; + m_ashibaState = 1; + float temp_f = (fVar2-fVar3); + m_ashibaTimer = fVar3+temp_f*fVar1; + } else { + m_ashibaState = 2; + } + m_isMovingUp = !(m_isMovingUp); + } + m_ashibaPosY = m_ashibaPos.m_y; + break; + } + } + } + } +} + +void grTenganAshiba::updateCallBack(float frameDelta) { + grCalcWorldCallBack* calcWorldCallBack = &this->m_calcWorldCallBack; + if (calcWorldCallBack != NULL) { + nw4r::g3d::ScnMdl* scnMdl = this->m_sceneModels[0]; + if (scnMdl != NULL) { + if (scnMdl->m_calcWorldCallBack == NULL) { + calcWorldCallBack->m_index = 0; + calcWorldCallBack->m_nodeCallbackDatas[0].m_nodeIndex = this->m_nodeIndex; + scnMdl->m_calcWorldCallBack = calcWorldCallBack; + scnMdl->EnableScnMdlCallbackTiming(1); + scnMdl->m_nodeIndex = calcWorldCallBack->m_nodeCallbackDatas[0].m_nodeIndex; + } + grNodeCallbackData* callbackData = calcWorldCallBack->m_nodeCallbackDatas; + callbackData->m_pos.m_x = m_ashibaPos.m_x; + callbackData->m_pos.m_y = m_ashibaPos.m_y; + callbackData->m_pos.m_z = m_ashibaPos.m_z; + } + } +} diff --git a/src/mo_stage/st_tengan/gr_tengan_bg.cpp b/src/mo_stage/st_tengan/gr_tengan_bg.cpp new file mode 100644 index 0000000..652ef8a --- /dev/null +++ b/src/mo_stage/st_tengan/gr_tengan_bg.cpp @@ -0,0 +1,39 @@ +#include +#include +#include + +grTenganBg* grTenganBg::create(int mdlIndex, const char* tgtNodeName, const char* taskName) +{ + grTenganBg* ground = new (Heaps::StageInstance) grTenganBg(taskName); + if (ground) { + ground->setMdlIndex(mdlIndex); + ground->setTgtNode(tgtNodeName); + } + ground->setupMelee(); + + return ground; +} + +grTenganBg::grTenganBg(const char* taskName) : grTengan(taskName) { + //memset(m_tgtNode,0,0x80); + posDialgaWork = NULL; + posAshibaWork = NULL; +} + +grTenganBg::~grTenganBg() { + +} + +void grTenganBg::update(float deltaFrame) +{ + if(posDialgaWork) { + getNodePosition(posDialgaWork,0,"dialgaPosition"); + } + if(posAshibaWork) { + getNodePosition(&posAshibaWork[0],0,"ashibaA_Up"); + getNodePosition(&posAshibaWork[1],0,"ashibaA_Down"); + getNodePosition(&posAshibaWork[2],0,"ashibaA_Up1"); + getNodePosition(&posAshibaWork[3],0,"ashibaA_Down1"); + } + grGimmick::update(deltaFrame); +} diff --git a/src/mo_stage/st_tengan/gr_tengan_floor.cpp b/src/mo_stage/st_tengan/gr_tengan_floor.cpp new file mode 100644 index 0000000..0e80e43 --- /dev/null +++ b/src/mo_stage/st_tengan/gr_tengan_floor.cpp @@ -0,0 +1,205 @@ +#include +#include +#include +#include + +grTenganFloor* grTenganFloor::create(int mdlIndex, const char* tgtNodeName, const char* taskName) +{ + grTenganFloor* ground = new (Heaps::StageInstance) grTenganFloor(taskName); + if (ground) { + ground->setMdlIndex(mdlIndex); + ground->setTgtNode(tgtNodeName); + } + ground->setupMelee(); + + return ground; +} + +inline grTenganFloor::grTenganFloor(const char* taskName) : grYakumono(taskName) { + //memset(m_tgtNode,0,0x80); + m_state = 0; + m_stateTimer = 0.0f; + m_frameWork = NULL; + m_stateWork = NULL; + m_type = 0; + unk16d = 0; + unk170 = 0.0f; + m_animId = 2; + m_animTimer = 0.0f; + m_unused.m_x = 0.0f; + m_unused.m_y = 0.0f; + m_unused.m_z = 0.0f; +} + +grTenganFloor::~grTenganFloor() { + +} + +void grTenganFloor::update(float deltaFrame) +{ + if (m_isUpdate) { + updateActive(deltaFrame); + updatePreBuild(deltaFrame); + grGimmick::update(deltaFrame); + } +} + +void grTenganFloor::updateActive(float deltaFrame) +{ + if (getStageData() != NULL) { + float fVar1 = m_stateTimer - deltaFrame; + m_stateTimer = fVar1; + if (fVar1 < 0.0f) { + m_stateTimer = 0.0f; + } + fVar1 = m_animTimer - deltaFrame; + m_animTimer = fVar1; + if (fVar1 < 0.0f) { + m_animTimer = 0.0f; + } + switch (m_state) { + case 0: + setMotion(0, false, 1, NULL); + m_state = 1; + break; + case 1: + bool isBreak = false; + switch (m_type) { + case 0: + case 1: + case 2: + if (m_stateWork[0] == 1) { + isBreak = true; + + //g_ecMgr->setParent(g_ecMgr->setEffect(ef_ptc_stg_tengan_yukabreak), m_sceneModels[0], 0, false); + + g_ecMgr->setParent(g_ecMgr->setEffect(ef_ptc_stg_tengan_yukabreak),m_sceneModels[0],1,0); + } + break; + case 3: + if (m_stateWork[0] == 1 || m_stateWork[1] == 1) { + isBreak = true; + } + break; + case 4: + if (m_stateWork[1] == 1 || m_stateWork[2] == 1) { + isBreak = true; + } + break; + } + if (isBreak == true) { + setMotion(1, false, 1, &m_animTimer); + setEnableCollisionStatus(false); + m_state = 2; + } + break; + case 2: + if (*m_frameWork < 1.0f) { + switch(m_type) { + case 0: + case 1: + case 2: + g_ecMgr->setParent(g_ecMgr->setEffect(ef_ptc_stg_tengan_yukahukkatu),m_sceneModels[0],1,0); + setMotion(0, false, 1, NULL); + g_sndSystem->playSE(snd_se_stage_Tengan_43,-1,0,0,-1); + break; + } + setNodeVisibilityAll(1,0); + m_state = 3; + } + if (m_animTimer == 0.0f) { + setVisibility(false); + } + break; + case 3: + if (*m_frameWork == 0.0f) { + *m_stateWork = 0; + setVisibility(true); + setEnableCollisionStatus(true); + m_state = 0; + } + break; + } + } +} + +void grTenganFloor::updatePreBuild(float deltaFrame) +{ + if (m_state != 3) { + return; + } + unk170 = 0.0f; + setVisibility(false); +} + +void grTenganFloor::setMotion(u8 animId, bool shouldLoop, u32 unk3, float* frameCount) +{ + if (this->m_animId == animId and unk3 == 0) + return; + + // get sceneMdl and model animations + nw4r::g3d::ScnMdl* sceneMdl = *this->m_sceneModels; + + if (sceneMdl == NULL) + return; + + gfModelAnimation* modelAnim = *this->m_modelAnims; + if (modelAnim == NULL) + return; + + // get scene model data + nw4r::g3d::ResMdl model = sceneMdl->m_resMdl; + + if (!model.IsValid()) + return; + + modelAnim->unbindNodeAnim(sceneMdl); + modelAnim->unbindVisibleAnim(sceneMdl); + modelAnim->unbindTexAnim(sceneMdl); + modelAnim->unbindTexSrtAnim(sceneMdl); + modelAnim->unbindMatColAnim(sceneMdl); + this->m_animId = animId; + + if (animId >= 2) + return; +// MEMAllocator* allocator; + bool result = (modelAnim->m_resFile.GetResAnmChrNumEntries() > animId); + if ((result)) + { + setChrAnim2(animId,model, modelAnim, Heaps::StageInstance); + } + + result = (modelAnim->m_resFile.GetResAnmVisNumEntries() > animId); + if ((result)) + { + setVisibilityAnim2(animId,model, modelAnim, Heaps::StageInstance); + } + + result = (modelAnim->m_resFile.GetResAnmTexPatNumEntries() > animId); + if ((result)) + { + setTexPatAnim2(animId,model, modelAnim, Heaps::StageInstance); + } + + result = (modelAnim->m_resFile.GetResAnmTexSrtNumEntries() > animId); + if ((result)) + { + setTexSortAnim2(animId,model, modelAnim, Heaps::StageInstance); + } + + result = (modelAnim->m_resFile.GetResAnmClrNumEntries() > animId); + if ((result)) + { + setColorAnim2(animId,model, modelAnim, Heaps::StageInstance); + } + + gfModelAnimation::bind(sceneMdl, modelAnim); + modelAnim->setFrame(0.0); + modelAnim->setUpdateRate(1.0); + modelAnim->setLoop(shouldLoop); + + if (frameCount != NULL) + { + *frameCount = modelAnim->getFrameCount(); + } +} diff --git a/src/mo_stage/st_tengan/st_tengan.cpp b/src/mo_stage/st_tengan/st_tengan.cpp new file mode 100644 index 0000000..9468f31 --- /dev/null +++ b/src/mo_stage/st_tengan/st_tengan.cpp @@ -0,0 +1,755 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +#include +#include +#include + +stClassInfoImpl stTengan::bss_loc_14; + +stTengan::stTengan() : stMelee("stTengan", Stages::Tengan) { + +// void* m_shrineStageData; + m_substage = 0; + m_slow = -1; + unk1d8 = 0.0; + unk1dc = 0.0; + unk1e0 = 0.0; + unk1e4 = 0.0; + unk1e8 = 0.0; + unk1ec = 0.0; + unk1f0 = 0.0; + unk1f4 = 0.0; + unk1f8 = 0.0; + unk1fc = 0.0; + unk200 = 0.0; +} + +stTengan* stTengan::create() { + return new (Heaps::StageInstance) stTengan; +} + +stTengan::~stTengan() { + releaseArchive(); + gfCopyEFBMgr::getInstance()->m_104=false; + gfCopyEFBMgr::getInstance()->m_108=0x80; + g_gfSceneRoot->m_transformFlag.m_mask &= 0xFFFFFF; + if (m_slow != -1) { + + } +} + +bool stTengan::loading() { + return true; +} + +void stTengan::createObj() +{ + testStageParamInit(m_fileData, 0xA); + testStageDataInit(m_fileData, 0x14, 1); + switch(g_GameGlobal->m_modeMelee->m_meleeInitData.m_subStageKind) { + case 2: + m_substage = 2; + break; + case 1: + m_substage = 1; + break; + case 0: + default: + m_substage = 0; + break; + } + + createObjEnkei(0); + createObjEnkei(1); + createObjBg(2); + grMadein* ground; + if (m_substage == 0) { + createObjDialga(3); + } else { + ground = grMadein::create(20, "dummy", "dummy",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + //ground->setType(0); + ground->initializeEntity(); + } + createObjAshiba(4); + createObjAshiba(5); + createObjFloor(6); + createObjFloor(7); + createObjFloor(8); + createObjFloor(9); + createObjFloor(10); + createObjSkyLaser(11); + createObjSkyLaser(12); + createObjSkyLaser(13); + createObjSkyLaser(14); + createObjDialga(15); + createObjDialga(16); + createObjDialga(17); + + if (m_substage == 1) { + createObjDialga(18); + } else { + ground = grMadein::create(20, "dummy", "dummy",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + //ground->setType(1); + ground->initializeEntity(); + } + + if (m_substage == 2) { + createObjDialga(19); + } else { + ground = grMadein::create(20, "dummy", "dummy",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + //ground->setType(1); + ground->initializeEntity(); + } + + ground = grMadein::create(20, "LaserAttackPointShort", "LaserAttackPoint",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + Vec3f offset;// = Vec3f(0.0,-100.0,0.0); + offset.m_x = 0.0; + offset.m_y = -100.0; + offset.m_z = 0.0; + ground->setAttack(15.0,&offset); + ground->setAttackPreset(grMadein::Attack_Overwrite); + //ground->m_attackInfo->m_preset = 4; + soCollisionAttackData* attack = ground->getOverwriteAttackData(); + attack->m_reactionEffect = 100; + attack->m_reactionFix = 70; + attack->m_reactionAdd = 0; + attack->m_power = 1; + attack->m_vector = 160; + attack->m_nodeIndex = 0; + attack->m_size = 15.0; + attack->m_offsetPos.m_x = offset.m_x; + attack->m_offsetPos.m_y = offset.m_y; + attack->m_offsetPos.m_z = offset.m_z; + attack->m_targetSituation = 0; + attack->m_targetPart = 0; + attack->m_region = soCollisionAttackData::Region_None; + attack->m_targetCategory = soCollision::CATEGORY_MASK_ALL; + attack->m_attribute = soCollisionAttackData::Attribute_None; + //attack->m_targetLr = true; +// attack->m_targetPart = 0; + attack->m_soundAttribute = soCollisionAttackData::Sound_Attribute_Elec; + attack->m_soundLevel = soCollisionAttackData::Sound_Level_Large; +// attack->m_setOffKind = soCollisionAttackData::SetOff_Thru; +// attack->m_noScale = false; + //attack->m_isShieldable = true; //need to match this somehow +// attack->m_isReflectable = false; +// attack->m_isAbsorbable = false; +// attack->m_subShield = 0; +// attack->m_isCapsule = false; + attack->m_serialHitFrame = 2; + attack->m_shapeType = soCollision::Shape_Capsule; + //ground->setType(1); + ground->initializeEntity(); + + ground = grMadein::create(20, "LaserAttackPointLong", "LaserAttackPoint",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + offset.m_x = 0.0; + offset.m_y = -180.0; + offset.m_z = 0.0; + ground->setAttack(15.0,&offset); + ground->setAttackPreset(grMadein::Attack_Overwrite); + attack = ground->getOverwriteAttackData(); + attack->m_reactionEffect = 100; + attack->m_reactionFix = 70; + attack->m_reactionAdd = 0; + attack->m_power = 1; + attack->m_vector = 160; + attack->m_size = 15.0; + //ground->setType(1); + ground->initializeEntity(); + + ground = grMadein::create(20, "LaserAttackPointSide", "LaserAttackPoint",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + offset.m_x = 0.0; + offset.m_y = 400.0; + offset.m_z = 0.0; + ground->setAttack(15.0,&offset); + ground->setAttackPreset(grMadein::Attack_Overwrite); + attack = ground->getOverwriteAttackData(); + attack->m_reactionEffect = 100; + attack->m_reactionFix = 70; + attack->m_reactionAdd = 0; + attack->m_power = 1; + attack->m_vector = 160; + attack->m_size = 15.0; + //ground->setType(1); + ground->initializeEntity(); + + ground = grMadein::create(20, "LaserAttackPointSide", "LaserAttackPoint",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + offset.m_x = 0.0; + offset.m_y = -100.0; + offset.m_z = 0.0; + ground->setAttack(15.0,&offset); + ground->setAttackPreset(grMadein::Attack_Overwrite); + attack = ground->getOverwriteAttackData(); + attack->m_reactionEffect = 150; + attack->m_reactionFix = 0; + attack->m_reactionAdd = 80; + attack->m_power = 5; + attack->m_vector = 361; + attack->m_size = 15.0; + //ground->setType(1); + ground->initializeEntity(); + + ground = grMadein::create(20, "LaserAttackPointSide", "LaserAttackPoint",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + offset.m_x = 0.0; + offset.m_y = -180.0; + offset.m_z = 0.0; + ground->setAttack(15.0,&offset); + ground->setAttackPreset(grMadein::Attack_Overwrite); + attack = ground->getOverwriteAttackData(); + attack->m_reactionEffect = 150; + attack->m_reactionFix = 0; + attack->m_reactionAdd = 80; + attack->m_power = 5; + attack->m_vector = 361; + attack->m_size = 15.0; + //ground->setType(1); + ground->initializeEntity(); + + ground = grMadein::create(20, "LaserAttackPointSide", "LaserAttackPoint",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + offset.m_x = 0.0; + offset.m_y = 400.0; + offset.m_z = 0.0; + ground->setAttack(15.0,&offset); + attack = ground->getOverwriteAttackData(); + attack->m_reactionEffect = 130; + attack->m_reactionFix = 0; + attack->m_reactionAdd = 120; + attack->m_power = 5; + attack->m_vector = 30; + attack->m_size = 15.0; + //ground->setType(1); + ground->initializeEntity(); + + ground = grMadein::create(20, "AuraAttackPoint", "AuraAttackPoint",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + offset.m_x = 0.0;// Vec3f(0.0,0.0,0.0); + offset.m_y = 0.0;// Vec3f(0.0,0.0,0.0); + offset.m_z = 0.0;// Vec3f(0.0,0.0,0.0); + ground->setAttack(30.0,&offset); + ground->setAttackPreset(grMadein::Attack_Overwrite); + attack = ground->getOverwriteAttackData(); + attack->m_reactionEffect = 50; + attack->m_reactionFix = 0; + attack->m_reactionAdd = 90; + attack->m_power = 25; + attack->m_vector = 70; + attack->m_size = 34.0; + attack->m_offsetPos.m_x = offset.m_x; + attack->m_offsetPos.m_y = offset.m_y; + attack->m_offsetPos.m_z = offset.m_z; +// attack->m_targetCategoryGimmick = true; // Ground +// attack-> m_targetCategory5 = true; +// attack-> m_targetCategory4 = true; +// attack->m_targetCategoryItem = true; // Barrel, Crate etc. +// attack->m_targetCategory2 = true; +// attack->m_targetCategoryEnemy = true; // SSE enemies +// attack->m_targetCategoryFighter = true; // Fighter + //attack->m_nodeIndex = 2; + attack->m_attribute = soCollisionAttackData::Attribute_Electric; + attack->m_soundLevel = soCollisionAttackData::Sound_Level_Large; + attack->m_soundAttribute = soCollisionAttackData::Sound_Attribute_Elec; + //attack->m_targetSituationODD = true; + //attack->m_targetSituationAir = true; + //attack->m_targetSituationGround = true; + attack->m_serialHitFrame = 2; + attack->m_shapeType = soCollision::Shape_Capsule; +// attack->m_setOffKind = soCollisionAttackData::SetOff_Thru; +// attack->m_noScale = false; +// attack->m_isShieldable = false; +// attack->m_isReflectable = false; +// attack->m_isAbsorbable = false; +// attack->m_subShield = 0; +// attack->m_isCapsule = false; + //ground->setType(1); + //ground->setType(1); + ground->initializeEntity(); + offset.m_x = 5.0; + offset.m_y = 20.0; + offset.m_z = 0.0; + ground->setPos(&offset); + + ground = grMadein::create(20, "Gake", "Collision",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + ground->initializeEntity(); + createCollision(m_fileData, 3, ground); + ground->setEnableCollisionStatus(false); + + ground = grMadein::create(21, "Laser", "A1Sign",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + ground->initializeEntity(); + + ground = grMadein::create(22, "Laser", "A2Sign",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + ground->initializeEntity(); + + ground = grMadein::create(23, "Laser", "BSign",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + ground->initializeEntity(); + + if (m_substage == 2) { + ground = grMadein::create(24, "Boomerang", "Boomerang",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + offset.m_x = 0.0; + offset.m_y = 0.0; + offset.m_z = 0.0; + ground->setAttack(15.0,&offset); + ground->setAttackPreset(grMadein::Attack_Overwrite); + attack = ground->getOverwriteAttackData(); + attack->m_reactionEffect = 100; + attack->m_reactionFix = 0; + attack->m_reactionAdd = 70; + attack->m_power = 20; + attack->m_vector = 361; + attack->m_size = 5.0; + //ground->setType(1); + ground->initializeEntity(); + + ground = grMadein::create(25, "RCall", "Rcall",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + ground->setAttack(15.0,&offset); + attack = ground->getOverwriteAttackData(); + attack->m_reactionEffect = 100; + attack->m_reactionFix = 70; + attack->m_reactionAdd = 0; + attack->m_power = 1; + attack->m_vector = 160; + attack->m_size = 15.0; + //ground->setType(1); + ground->initializeEntity(); + + ground = grMadein::create(26, "SonicWave", "SW",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + ground->initializeEntity(); + + ground = grMadein::create(27, "SonicWaveCutter", "SWCut",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + ground->initializeEntity(); + + ground = grMadein::create(27, "SonicWaveCutterPath", "SWCutPath",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + ground->initializeEntity(); + + ground = grMadein::create(20, "", "SWDmg",Heaps::StageInstance); + addGround(ground); + ground->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ground->setStageData(m_stageData); + offset.m_x = 0.0; + offset.m_y = -100.0; + offset.m_z = 0.0; + ground->setAttack(3.0,&offset); + ground->setAttackPreset(grMadein::Attack_Overwrite); + attack = ground->getOverwriteAttackData(); + //ground->setType(1); + ground->initializeEntity(); + } + + createCollision(m_fileData, 2, NULL); + initCameraParam(); + nw4r::g3d::ResFile posData(m_fileData->getData(Data_Type_Model, 0x64, 0xfffe)); + if (posData.ptr()) + { + nw4r::g3d::ResFile copyPosData = posData; + createStagePositions(©PosData); + } + else + { + // if no stgPos model in pac, use defaults + createStagePositions(); + } + createWind2ndOnly(); + nw4r::g3d::ResFileData* scnData; + if (m_substage == 1) { + scnData = static_cast(m_fileData->getData(Data_Type_Scene, 1, 0xfffe)); + registScnAnim(scnData, 0); + } else { + scnData = static_cast(m_fileData->getData(Data_Type_Scene, 0, 0xfffe)); + registScnAnim(scnData, 0); + } + stTenganParams* stagedata = (stTenganParams*)m_stageData; + if (stagedata) { + float tempf7 = randf()*2.0f; + if (stagedata->guest_rate_guest <= 1.0f - tempf7) { + + event15.set(0.0,0.0); + event14.set(0.0,0.0); + event14.start(); + } + event1.set(0.0,0.0); + eventBoomerang.set(0.0,0.0); + eventLegendDisappear.set(0.0,0.0); + eventDropStage.set(0.0,0.0); + eventRebuildStage.set(0.0,0.0); + eventQuake.set(stagedata->event_frame_quake,stagedata->event_frame_quake); + eventLaser.set(100.0,100.0); + eventCameraRoll.set(100.0,500.0); + //grTenganEvent event2; + //grTenganEvent event14; + //grTenganEvent event15; + switch(m_substage) { + case 0: + eventSlow.set(stagedata->event_d_frame_slow_min+60.0f,stagedata->event_d_frame_slow_max+60.0f); + eventAura.set(stagedata->event_d_frame_aura_min,stagedata->event_d_frame_aura_max); + break; + case 1: + eventUpDownReverse.set(stagedata->event_p_frame_reversey_min+60.0f,stagedata->event_p_frame_reversey_max+60.0f); + eventLeftRightReverse.set(stagedata->event_p_frame_reversex_min+60.0f,stagedata->event_p_frame_reversex_max+60.0f); + eventGravityHalf.set(stagedata->event_p_frame_gravityhalf_min+60.0f,stagedata->event_p_frame_gravityhalf_min+60.0f); + break; + case 2: + eventBoomerang.set(0.0,0.0); + eventRandomCall.set(300.0,600.0); + eventSonicWaveCall.set(300.0,600.0); + break; + } + event1.start(); + } + loadStageAttrParam(m_fileData, 0x1E); + initPosPokeTrainer(1, 0); + createObjPokeTrainer(m_fileData, 101, "PokeTrainer00", this->m_pokeTrainerPos, 0x0); + createObjPokeTrainer(m_fileData, 102, "PokeTrainer01", this->m_pokeTrainerPos+2, 0x0); +} + +void stTengan::createObjSkyLaser(int index) { + grMadein *laser; + switch(index) { + case 11: + laser = grMadein::create(11, "StgTenganLaserA1", "grTengan_LaserA1",Heaps::StageInstance); + break; + case 12: + laser = grMadein::create(12, "StgTenganLaserA2", "grTengan_LaserA2",Heaps::StageInstance); + break; + case 13: + laser = grMadein::create(13, "StgTenganLaserB", "grTengan_LaserB",Heaps::StageInstance); + break; + case 14: + laser = grMadein::create(14, "StgTenganLaserCharge", "grTengan_LaserCharge",Heaps::StageInstance); + break; + default: + laser = NULL; + } + if (laser) { + addGround(laser); + laser->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + laser->setStageData(m_stageData); + //ground->setType(1); + laser->initializeEntity(); + laser->m_sceneModels[0]->SetPriorityDrawOpa(255); + laser->m_sceneModels[0]->SetPriorityDrawXlu(255); + //nw4r::g3d::ScnObj::SetPriorityDrawOpa(0); + //nw4r::g3d::ScnObj::SetPriorityDrawXlu(0); + } +} + +void stTengan::createObjEnkei(int index) { + grTengan *enkei; + switch(index) { + case 0: + enkei = grTengan::create(4, "", "grTenganSky"); + break; + case 1: + enkei = grTengan::create(5, "", "grTenganStar"); + break; + default: + enkei = NULL; + } + if (enkei) { + addGround(enkei); + enkei->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + enkei->setStageData(m_stageData); + //ground->setType(1); + //enkei->initializeEntity(); + } +} + +void stTengan::createObjBg(int index) { + grTenganBg *bg; + switch(index) { + case 2: + bg = grTenganBg::create(0, "", "grTenganMainBg"); + break; + default: + bg = NULL; + } + if (bg) { + addGround(bg); + bg->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + bg->setStageData(m_stageData); + bg->setPosDialgaWork(&posDialga); + bg->setPosAshibaWork(posAshibaWork); + //enkei->initializeEntity(); + } +} + +void grTenganBg::setPosDialgaWork(Vec3f* pos) { + posDialgaWork = pos; +} + +void grTenganBg::setPosAshibaWork(Vec3f* pos) { + posAshibaWork = pos; +} + +void stTengan::createObjDialga(int index) { + grMadein *legend; + switch(index) { + case 3: + legend = grMadein::create(3, "dialga", "dialga",Heaps::StageInstance); + break; + case 18: + legend = grMadein::create(15, "palkia", "palkia",Heaps::StageInstance); + break; + case 19: + legend = grMadein::create(16, "crecelia", "crecelia",Heaps::StageInstance); + break; + case 15: + legend = grMadein::create(17, "agnome", "agnome",Heaps::StageInstance); + break; + case 16: + legend = grMadein::create(18, "emrit", "emrit",Heaps::StageInstance); + break; + case 17: + legend = grMadein::create(19, "yuxie", "yuxie",Heaps::StageInstance); + break; + default: + legend = NULL; + } + if (legend) { + addGround(legend); + legend->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + legend->setStageData(m_stageData); + //ground->setType(1); + //legend->setMotion(0); + legend->initializeEntity(); + } +} + +void stTengan::createObjAshiba(int index) { + grTenganAshiba *ashiba; + Vec3f* posLimitWork = NULL; + switch(index) { + case 4: + ashiba = grTenganAshiba::create(1, "StgTenganAshibaA", "grTenganAshibaA"); + posLimitWork = &posAshibaWork[0]; + break; + case 5: + ashiba = grTenganAshiba::create(2, "StgTenganAshibaB", "grTenganAshibaB"); + posLimitWork = &posAshibaWork[2]; + break; + default: + ashiba = NULL; + } + if (ashiba) { + addGround(ashiba); + ashiba->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + ashiba->setStageData(m_stageData); + ashiba->setPosLimitWork(posLimitWork); + //enkei->initializeEntity(); + } +} + +void grTenganAshiba::setPosLimitWork(Vec3f* pos) { + m_posLimitWork = pos; +} + +void stTengan::createObjFloor(int index) { + grTenganFloor *floor; + u8* stateWork; + u8 type; + switch(index) { + case 6: + floor = grTenganFloor::create(6, "StgTenganBrkYukaL", "grTenganFloorL"); + stateWork = &m_stateFloorL; + type = 0; + break; + case 7: + floor = grTenganFloor::create(8, "StgTenganBrkYukaC", "grTenganFloorC"); + stateWork = &m_stateFloorC; + type = 1; + break; + case 8: + floor = grTenganFloor::create(7, "StgTenganBrkYukaR", "grTenganFloorR"); + stateWork = &m_stateFloorR; + type = 2; + break; + case 9: + floor = grTenganFloor::create(9, "StgTenganBrkYukaCL", "grTenganFloorCL"); + stateWork = &m_stateFloorL; + type = 3; + break; + case 10: + floor = grTenganFloor::create(10, "StgTenganBrkYukaCR", "grTenganFloorCR"); + stateWork = &m_stateFloorL; + type = 4; + break; + default: + floor = NULL; + stateWork = NULL; + } + if (floor) { + addGround(floor); + floor->startup(m_fileData, 0, gfSceneRoot::Layer_Ground); + floor->setStageData(m_stageData); + floor->setFrameWork(&m_rebuildTimer); + floor->setStateWork(stateWork); + floor->setType(type); + //enkei->initializeEntity(); + } +} + +void grTenganFloor::setFrameWork(float* frameWork) +{ + this->m_frameWork = frameWork; +} + +void grTenganFloor::setStateWork(u8* stateWork) +{ + this->m_stateWork = stateWork; +} + +void grTenganFloor::setType(u8 type) +{ + this->m_type = type; +} + +void stTengan::update(float deltaFrame) { + updateEvent(deltaFrame); +} + +bool stTengan::eventRebuildStageUpdate() { + float fVar1 = eventRebuildStage.m_framesLeft; + m_rebuildTimer = fVar1; + if (fVar1 < 0.0f) { + m_rebuildTimer = 0.0f; + } + switch (eventRebuildStage.getPhase()) { + case 0: + if (m_stateFloorC == 1) { + if (static_cast(getGround(7))->m_state == 3) { + static_cast(getGround(27))->endEntity(); + static_cast(getGround(27))->setEnableCollisionStatus(false); + eventRebuildStage.setPhase(1); + } + } else { + eventRebuildStage.setPhase(1); + } + break; + case 1: + if (m_rebuildTimer == 0.0f and eventRebuildStage.isReadyEnd() == true) { + return 1; + } + break; + } + return 0; +} + +void stTengan::updateEvent(float deltaFrame) { + //updateEvent(deltaFrame); + if (m_stageData) { + event1.update(deltaFrame); + event2.update(deltaFrame); + eventLegendDisappear.update(deltaFrame); + event14.update(deltaFrame); + event15.update(deltaFrame); + eventLaser.update(deltaFrame); + eventQuake.update(deltaFrame); + eventCameraRoll.update(deltaFrame); + eventSlow.update(deltaFrame); + eventDropStage.update(deltaFrame); + eventRebuildStage.update(deltaFrame); + eventAura.update(deltaFrame); + eventUpDownReverse.update(deltaFrame); + eventLeftRightReverse.update(deltaFrame); + eventGravityHalf.update(deltaFrame); + eventBoomerang.update(deltaFrame); + eventRandomCall.update(deltaFrame); + eventSonicWaveCall.update(deltaFrame); + } +} + +u32 stTengan::getZoneLightSetIndex(Vec2f *position) { + if (position == NULL) { + return 20; + } + if (position->m_x < -78.0f) { + return 20; + } + if (position->m_x > 78.0f) { + return 20; + } + if (position->m_y < -60.0f) { + return 20; + } + if (position->m_y > -16.0f) { + return 20; + } + return 21; +}