d_stage_parse ok

This commit is contained in:
robojumper
2025-03-09 16:39:21 +01:00
parent 32b7ce138d
commit 7225fbe4ff
16 changed files with 852 additions and 153 deletions
+4 -1
View File
@@ -155,7 +155,10 @@ d/d_scene.cpp:
.bss start:0x805A06F0 end:0x805A0720
d/d_stage_parse.cpp:
.text start:0x80062E40 end:0x80064250
.text start:0x80062ED0 end:0x8006424C
.rodata start:0x804E0B38 end:0x804E0C98
.data start:0x8050DE48 end:0x8050DE58
.sdata2 start:0x80577920 end:0x80577928
d/d_sys.cpp:
.text start:0x80064250 end:0x80064920
+61 -61
View File
@@ -379,7 +379,7 @@ getNightT1__11FileManagerFv = .text:0x8000CA00; // type:function size:0x44
setNightT3__11FileManagerFb = .text:0x8000CA50; // type:function size:0x30
getNightT3__11FileManagerFv = .text:0x8000CA80; // type:function size:0x44
isNew_FileA__11FileManagerFv = .text:0x8000CAD0; // type:function size:0x24
setSceneFlagIndex__11FileManagerFUs = .text:0x8000CB00; // type:function size:0x30
setSceneFlagIndex__11FileManagerFs = .text:0x8000CB00; // type:function size:0x30
getSceneFlagIndex__11FileManagerFv = .text:0x8000CB30; // type:function size:0x44
getFileAreaIndex__11FileManagerFv = .text:0x8000CB80; // type:function size:0x44
fn_8000CBD0__11FileManagerFUc = .text:0x8000CBD0; // type:function size:0x30
@@ -1118,8 +1118,8 @@ postExecute__12dAcObjBase_cFQ27fBase_c12MAIN_STATE_e = .text:0x8002E2A0; // type
preDraw__12dAcObjBase_cFv = .text:0x8002E330; // type:function size:0x27C
getObjectListEntry__12dAcObjBase_cFv = .text:0x8002E5B0; // type:function size:0x8
restorePosRotFromCopy__12dAcObjBase_cFv = .text:0x8002E5C0; // type:function size:0x70
create__12dAcObjBase_cFQ28fProfile14PROFILE_NAME_eUlUlP7mVec3_cP7mAng3_cP7mVec3_cUl = .text:0x8002E630; // type:function size:0x98
create__12dAcObjBase_cFPcUlUlP7mVec3_cP7mAng3_cP7mVec3_cUlUsSc = .text:0x8002E6D0; // type:function size:0xA0
create__12dAcObjBase_cFQ28fProfile14PROFILE_NAME_eUlUlPC7mVec3_cPC7mAng3_cPC7mVec3_cUl = .text:0x8002E630; // type:function size:0x98
create__12dAcObjBase_cFPCcUlUlPC7mVec3_cPC7mAng3_cPC7mVec3_cUlUsSc = .text:0x8002E6D0; // type:function size:0xA0
ActorObjectBase__findObject = .text:0x8002E770; // type:function size:0x7C
getNextObject__12dAcObjBase_cFP9fLiMgBa_cP12dAcObjBase_c = .text:0x8002E7F0; // type:function size:0x58
isPlayer__12dAcObjBase_cFv = .text:0x8002E850; // type:function size:0x14
@@ -1144,7 +1144,7 @@ fn_8002EFA0 = .text:0x8002EFA0; // type:function size:0x50
fn_8002EFF0 = .text:0x8002EFF0; // type:function size:0x194
fn_8002F190 = .text:0x8002F190; // type:function size:0x24
createActorUnkGroup3__12dAcObjBase_cFQ28fProfile14PROFILE_NAME_eUlUlP7mVec3_cP7mAng3_cP7mVec3_cUl = .text:0x8002F1C0; // type:function size:0x98
fn_8002F260 = .text:0x8002F260; // type:function size:0xA0
createActorUnkGroup3__12dAcObjBase_cFPCcUlUlPC7mVec3_cPC7mAng3_cPC7mVec3_cUlUsSc = .text:0x8002F260; // type:function size:0xA0
__ct__11dAcEnBase_cFv = .text:0x8002F300; // type:function size:0x74
ActorEnemyBase__dtor = .text:0x8002F380; // type:function size:0x74
ActorEnemyBase__shouldUpdateMaybe = .text:0x8002F400; // type:function size:0xB4
@@ -2784,44 +2784,44 @@ fn_80062E40 = .text:0x80062E40; // type:function size:0x4
fn_80062E50 = .text:0x80062E50; // type:function size:0x60
fn_80062EB0 = .text:0x80062EB0; // type:function size:0x4
fn_80062EC0 = .text:0x80062EC0; // type:function size:0x4
parseBzsPcam = .text:0x80062ED0; // type:function size:0x1C
parseBzsLyse = .text:0x80062EF0; // type:function size:0x20
parseBzsStif = .text:0x80062F10; // type:function size:0x54
parseBzsRmpl = .text:0x80062F70; // type:function size:0x1C
fn_80062F90 = .text:0x80062F90; // type:function size:0x54
parseBzsLylt = .text:0x80062FF0; // type:function size:0xD8
handleBzsPcam__FiPC14BzsSectionHead = .text:0x80062ED0; // type:function size:0x1C
handleBzsLyse__FiPC14BzsSectionHead = .text:0x80062EF0; // type:function size:0x20
handleBzsStif__FiPC14BzsSectionHead = .text:0x80062F10; // type:function size:0x54
handleBzsRmpl__FiPC14BzsSectionHead = .text:0x80062F70; // type:function size:0x1C
handleBzsFile__FiPC14BzsSectionHead = .text:0x80062F90; // type:function size:0x54
handleBzsLylt__FiPC14BzsSectionHead = .text:0x80062FF0; // type:function size:0xD8
sprintf__15SizedString<16>FPCce = .text:0x800630D0; // type:function size:0xD0
parseBzsScen = .text:0x800631A0; // type:function size:0x54
parseBzsCam = .text:0x80063200; // type:function size:0x54
parseBzsEvnt = .text:0x80063260; // type:function size:0x54
parseBzsPath = .text:0x800632C0; // type:function size:0x54
parseBzsPnt = .text:0x80063320; // type:function size:0x54
parseBzsBpnt = .text:0x80063380; // type:function size:0x54
parseBzsSpth = .text:0x800633E0; // type:function size:0x54
fn_80063440 = .text:0x80063440; // type:function size:0x54
fn_800634A0 = .text:0x800634A0; // type:function size:0x54
parseBzsArea = .text:0x80063500; // type:function size:0x54
parseBzsPlyAndAlsoSpawnLink = .text:0x80063560; // type:function size:0x330
parseBzsObjn = .text:0x80063890; // type:function size:0x78
parseBzsArcn = .text:0x80063910; // type:function size:0x78
parseBzsObjn2 = .text:0x80063990; // type:function size:0x84
parseBzsArcn2 = .text:0x80063A20; // type:function size:0x78
getEnemyDefeatFlagFromId = .text:0x80063AA0; // type:function size:0x3C
getViewClipIndexFromId = .text:0x80063AE0; // type:function size:0x1C
parseBzsObj = .text:0x80063B00; // type:function size:0xB8
parseBzsSobj = .text:0x80063BC0; // type:function size:0xB8
parseBzsStas = .text:0x80063C80; // type:function size:0xB8
fn_80063D40 = .text:0x80063D40; // type:function size:0x78
parseBzsLay = .text:0x80063DC0; // type:function size:0x80
fn_80063E40 = .text:0x80063E40; // type:function size:0x80
fn_80063EC0 = .text:0x80063EC0; // type:function size:0x80
findAndRunStageTagParseFunc = .text:0x80063F40; // type:function size:0x48
parseRoomStageBzs = .text:0x80063F90; // type:function size:0x70
parseBzsStageRoom = .text:0x80064000; // type:function size:0x70
parseStageBzs = .text:0x80064070; // type:function size:0x7C
parseRoomBzs = .text:0x800640F0; // type:function size:0x70
fn_80064160 = .text:0x80064160; // type:function size:0x70
fn_800641D0 = .text:0x800641D0; // type:function size:0x7C
handleBzsScen__FiPC14BzsSectionHead = .text:0x800631A0; // type:function size:0x54
handleBzsCam__FiPC14BzsSectionHead = .text:0x80063200; // type:function size:0x54
handleBzsEvnt__FiPC14BzsSectionHead = .text:0x80063260; // type:function size:0x54
handleBzsPath__FiPC14BzsSectionHead = .text:0x800632C0; // type:function size:0x54
handleBzsPnt__FiPC14BzsSectionHead = .text:0x80063320; // type:function size:0x54
handleBzsBpnt__FiPC14BzsSectionHead = .text:0x80063380; // type:function size:0x54
handleBzsSpth__FiPC14BzsSectionHead = .text:0x800633E0; // type:function size:0x54
handleBzsSpnt__FiPC14BzsSectionHead = .text:0x80063440; // type:function size:0x54
handleBzsSbpt__FiPC14BzsSectionHead = .text:0x800634A0; // type:function size:0x54
handleBzsArea__FiPC14BzsSectionHead = .text:0x80063500; // type:function size:0x54
handleBzsPly__FiPC14BzsSectionHead = .text:0x80063560; // type:function size:0x330
handleBzsObjn__FiPC14BzsSectionHead = .text:0x80063890; // type:function size:0x78
handleBzsArcn__FiPC14BzsSectionHead = .text:0x80063910; // type:function size:0x78
handleBzsLayerObjn__FiPC14BzsSectionHead = .text:0x80063990; // type:function size:0x84
handleBzsLayerArcn__FiPC14BzsSectionHead = .text:0x80063A20; // type:function size:0x78
getEnemyDefeatFlagFromId__FlUs = .text:0x80063AA0; // type:function size:0x3C
getViewClipIndexFromId__FUs = .text:0x80063AE0; // type:function size:0x1C
handleBzsObj__FiPC14BzsSectionHead = .text:0x80063B00; // type:function size:0xB8
handleBzsSobj__FiPC14BzsSectionHead = .text:0x80063BC0; // type:function size:0xB8
handleBzsStas__FiPC14BzsSectionHead = .text:0x80063C80; // type:function size:0xB8
parseLayerBzs__FiUlPC3LAYPC17BzsTagToParseFuncl = .text:0x80063D40; // type:function size:0x78
handleBzsLay__FiPC14BzsSectionHead = .text:0x80063DC0; // type:function size:0x80
handleBzsLay2__FiPC14BzsSectionHead = .text:0x80063E40; // type:function size:0x80
handleBzsLay3__FiPC14BzsSectionHead = .text:0x80063EC0; // type:function size:0x80
findAndRunStageTagParseFunc__FiPC14BzsSectionHeadPC17BzsTagToParseFuncl = .text:0x80063F40; // type:function size:0x48
parseRoomStageBzs__FiPCv = .text:0x80063F90; // type:function size:0x70
parseBzsStageRoom__FiPCv = .text:0x80064000; // type:function size:0x70
parseStageBzs__FiPCv = .text:0x80064070; // type:function size:0x7C
parseRoomBzs__FiPCv = .text:0x800640F0; // type:function size:0x70
parseRoomReactivateBzs__FiPCv = .text:0x80064160; // type:function size:0x70
parseRoomActivateBzs__FiPCv = .text:0x800641D0; // type:function size:0x7C
dSys_c__initAudioMgr = .text:0x80064250; // type:function size:0xB0
dSys_c__beginRender = .text:0x80064300; // type:function size:0x38
dSys_c__endRender = .text:0x80064340; // type:function size:0x18
@@ -10552,10 +10552,10 @@ changeState__80sStateMgr_c<11dStageMgr_c,20sStateMethodUsr_FI_c,12sFStateFct_c,1
fn_80199000 = .text:0x80199000; // type:function size:0x110
fn_80199110 = .text:0x80199110; // type:function size:0x8
fn_80199120 = .text:0x80199120; // type:function size:0x10
StageManager__addObjnId = .text:0x80199130; // type:function size:0x8
StageManager__addStageArcn = .text:0x80199140; // type:function size:0x8
StageManager__addActorId = .text:0x80199150; // type:function size:0x8
StageManager__addLayerArcn = .text:0x80199160; // type:function size:0x8
addObjId__11dStageMgr_cFUs = .text:0x80199130; // type:function size:0x8
addStageArcn__11dStageMgr_cFPCc = .text:0x80199140; // type:function size:0x8
addActorId__11dStageMgr_cFUs = .text:0x80199150; // type:function size:0x8
addLayerArcn__11dStageMgr_cFPCc = .text:0x80199160; // type:function size:0x8
initUnkWithWater__11dStageMgr_cFUlP12UnkWithWater = .text:0x80199170; // type:function size:0x18
destroyUnkWithWater__11dStageMgr_cFUlP12UnkWithWater = .text:0x80199190; // type:function size:0x18
fn_801991B0 = .text:0x801991B0; // type:function size:0xA0
@@ -10565,9 +10565,9 @@ fn_80199400 = .text:0x80199400; // type:function size:0xE8
fn_801994F0 = .text:0x801994F0; // type:function size:0x4
triggerEntranceRestart = .text:0x80199500; // type:function size:0x40
getPCAMfromId = .text:0x80199540; // type:function size:0x34
StageManager__overrideLayer0WithLyse = .text:0x80199580; // type:function size:0xF8
StageManager__setSTIF = .text:0x80199680; // type:function size:0x1AC
StageManager__getFlagindex = .text:0x80199830; // type:function size:0x2C
overrideLayer0WithLyse__11dStageMgr_cFv = .text:0x80199580; // type:function size:0xF8
setStif__11dStageMgr_cFPC4STIF = .text:0x80199680; // type:function size:0x1AC
getFlagIndex__11dStageMgr_cCFv = .text:0x80199830; // type:function size:0x2C
getAreaType__11dStageMgr_cCFv = .text:0x80199860; // type:function size:0x1C
StageManager__isAreaTypeNormal = .text:0x80199880; // type:function size:0x28
isAreaTypeDungeon__11dStageMgr_cCFv = .text:0x801998B0; // type:function size:0x2C
@@ -10965,7 +10965,7 @@ createRooms__8dStage_cFv = .text:0x801B3730; // type:function size:0x200
waitForRooms__8dStage_cFv = .text:0x801B3930; // type:function size:0x30
setRoom__8dStage_cFiP7dRoom_c = .text:0x801B3960; // type:function size:0x10
getRoom__8dStage_cFl = .text:0x801B3970; // type:function size:0x10
RoomManager__handleRoomChangeMaybe = .text:0x801B3980; // type:function size:0x114
handleRoomChange__8dStage_cFi = .text:0x801B3980; // type:function size:0x114
RoomManager__updateRoomFlags = .text:0x801B3AA0; // type:function size:0x134
RoomManager__checkOtherRoomLoaded = .text:0x801B3BE0; // type:function size:0x78
fn_801B3C60 = .text:0x801B3C60; // type:function size:0x9C
@@ -10990,7 +10990,7 @@ getMA0AnmTexSrt__8dStage_cFPQ34nw4r3g3d12ResAnmTexSrtPCc = .text:0x801B4380; //
getMA0IndirectSrt__8dStage_cFPQ34nw4r3g3d12ResAnmTexSrtRCQ34nw4r3g3d6ResMdl = .text:0x801B4420; // type:function size:0x9C
changeLoadedEntities__8dStage_cFUlb = .text:0x801B44C0; // type:function size:0x50
RoomManager__checkRoomFlag = .text:0x801B4510; // type:function size:0x3C
RoomManager__checkEnemyDefeatFlag = .text:0x801B4550; // type:function size:0x6C
checkEnemyDefeatFlag__8dStage_cFUs = .text:0x801B4550; // type:function size:0x6C
fn_801B45C0 = .text:0x801B45C0; // type:function size:0xAC
__ct__12dRoomTable_cFv = .text:0x801B4670; // type:function size:0x110
__ct__10MapRelatedFv = .text:0x801B4780; // type:function size:0x180
@@ -11038,7 +11038,7 @@ doDelete__7dRoom_cFv = .text:0x801B65F0; // type:function size:0x74
execute__7dRoom_cFv = .text:0x801B6670; // type:function size:0x140
executeState__75sStateMgr_c<7dRoom_c,20sStateMethodUsr_FI_c,12sFStateFct_c,13sStateIDChk_c>Fv = .text:0x801B67B0; // type:function size:0x10
draw__7dRoom_cFv = .text:0x801B67C0; // type:function size:0x84
dRoom__getEntranceById = .text:0x801B6850; // type:function size:0x34
getEntranceById__7dRoom_cCFUc = .text:0x801B6850; // type:function size:0x34
fn_801B6890 = .text:0x801B6890; // type:function size:0x10
RoomManager__getEVNTForIndex = .text:0x801B68A0; // type:function size:0x10
deactivateUpdatesCb__FP9dAcBase_c = .text:0x801B68B0; // type:function size:0x20
@@ -28179,14 +28179,14 @@ lbl_804E0AE4 = .rodata:0x804E0AE4; // type:object size:0x14
lbl_804E0AF8 = .rodata:0x804E0AF8; // type:object size:0x14
lbl_804E0B0C = .rodata:0x804E0B0C; // type:object size:0x14 data:float
lbl_804E0B20 = .rodata:0x804E0B20; // type:object size:0x18 data:float
lbl_804E0B38 = .rodata:0x804E0B38; // type:object size:0x10
lbl_804E0B48 = .rodata:0x804E0B48; // type:object size:0x18
lbl_804E0B60 = .rodata:0x804E0B60; // type:object size:0x30
lbl_804E0B90 = .rodata:0x804E0B90; // type:object size:0x70
lbl_804E0C00 = .rodata:0x804E0C00; // type:object size:0x10
lbl_804E0C10 = .rodata:0x804E0C10; // type:object size:0x10
lbl_804E0C20 = .rodata:0x804E0C20; // type:object size:0x60
lbl_804E0C80 = .rodata:0x804E0C80; // type:object size:0x18
layerHandlers = .rodata:0x804E0B38; // type:object size:0x10
layerHandlers2 = .rodata:0x804E0B48; // type:object size:0x18
layerHandlers3 = .rodata:0x804E0B60; // type:object size:0x30
defaultHandlers = .rodata:0x804E0B90; // type:object size:0x70
roomStageHandlers = .rodata:0x804E0C00; // type:object size:0x10
stageRoomHandlers = .rodata:0x804E0C10; // type:object size:0x10
roomHandlers = .rodata:0x804E0C20; // type:object size:0x60
roomReactivateHandlers = .rodata:0x804E0C80; // type:object size:0x18
lbl_804E0C98 = .rodata:0x804E0C98; // type:object size:0x3C
lbl_804E0CD4 = .rodata:0x804E0CD4; // type:object size:0x3C
lbl_804E0D10 = .rodata:0x804E0D10; // type:object size:0x3C
@@ -30778,7 +30778,7 @@ lbl_8050DDB8 = .data:0x8050DDB8; // type:object size:0x20
@4669 = .data:0x8050DDD8; // type:object size:0xE scope:local data:string
@4670 = .data:0x8050DDE8; // type:object size:0xB scope:local data:string
__vt__8dScene_c = .data:0x8050DDF8; // type:object size:0x4C
lbl_8050DE48 = .data:0x8050DE48; // type:object size:0x10
lbl_8050DE48 = .data:0x8050DE48; // type:object size:0xE data:string
lbl_8050DE58 = .data:0x8050DE58; // type:object size:0x5C
lbl_8050DEB4 = .data:0x8050DEB4; // type:object size:0x10
lbl_8050DEC4 = .data:0x8050DEC4; // type:object size:0x10
@@ -41981,7 +41981,7 @@ lbl_8057790E = .sdata2:0x8057790E; // type:object size:0x2 data:2byte
lbl_80577910 = .sdata2:0x80577910; // type:object size:0x4 data:float
lbl_80577914 = .sdata2:0x80577914; // type:object size:0x4 data:float
lbl_80577918 = .sdata2:0x80577918; // type:object size:0x8 data:float
lbl_80577920 = .sdata2:0x80577920; // type:object size:0x8
roomActivateHandlers = .sdata2:0x80577920; // type:object size:0x8
lbl_80577928 = .sdata2:0x80577928; // type:object size:0x4 data:float
lbl_8057792C = .sdata2:0x8057792C; // type:object size:0x4 data:float
lbl_80577930 = .sdata2:0x80577930; // type:object size:0x8 data:double
+1 -1
View File
@@ -340,7 +340,7 @@ config.libs = [
Object(Matching, "d/d_heap.cpp"),
Object(Matching, "d/d_rawarchive.cpp"),
Object(Matching, "d/d_scene.cpp"),
Object(NonMatching, "d/d_stage_parse.cpp"),
Object(Matching, "d/d_stage_parse.cpp"),
Object(NonMatching, "d/d_sys.cpp"),
Object(NonMatching, "toBeSorted/sound_info.cpp"),
Object(Matching, "toBeSorted/arc_callback_handler.cpp"),
+4 -4
View File
@@ -160,11 +160,11 @@ public:
public:
/* 8002e630 */ static dAcObjBase_c *create(
fProfile::PROFILE_NAME_e actorId, u32 roomId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale,
fProfile::PROFILE_NAME_e actorId, u32 roomId, u32 params1, const mVec3_c *pos, const mAng3_c *rot, const mVec3_c *scale,
u32 params2
);
/* 8002e6d0 */ static dAcObjBase_c *create(
char *name, u32 roomId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2, u16 id,
const char *name, u32 roomId, u32 params1, const mVec3_c *pos, const mAng3_c *rot, const mVec3_c *scale, u32 params2, u16 id,
s8 viewclipId
);
/* 8002e770 */ static dAcObjBase_c *
@@ -208,8 +208,8 @@ public:
u32 params2
);
/* 8002f260 */ static dAcBase_c *createActorUnkGroup3(
char *name, u32 roomId, u32 params1, mVec3_c *pos, mAng3_c *rot, mVec3_c *scale, u32 params2, u16 id,
u8 viewclipId
const char *name, u32 roomId, u32 params1, const mVec3_c *pos, const mAng3_c *rot, const mVec3_c *scale,
u32 params2, u16 id, s8 viewclipId
);
};
+38 -5
View File
@@ -5,6 +5,12 @@
#include "m/m_angle.h"
#include "m/m_vec.h"
// https://github.com/lepelog/skywardsword-tools/blob/master/bzs.py
// Size 0x2
struct ARCN {
/* 0x00 */ u16 offset;
};
// Size 0x20
struct AREA {
@@ -53,11 +59,21 @@ struct EVNT {
/* 0x18 */ char name[32];
};
// Size 0x???
struct bzsFILE {
// ???
};
struct LAY {
/* 0x00 */ u16 mCount;
/* 0x04 */ u32 mOffset;
};
// Size 0x04
struct LYLT {
/* 0x0 */ u8 layer;
/* 0x1 */ u8 demoHigh;
/* 0x2 */ u8 demoLow;
/* 0x1 */ s8 demoHigh;
/* 0x2 */ s8 demoLow;
/* 0x3 */ u8 dummy;
};
@@ -78,6 +94,11 @@ struct OBJ {
/* 0x1C */ char name[8];
};
// Size 0x2
struct OBJN {
/* 0x00 */ u16 offset;
};
// Size 0xC
struct PATH {
/* 0x00 */ u8 field_0x00;
@@ -101,9 +122,12 @@ struct PCAM {
// Size 0x18
struct PLY {
/* 0x00 */ u16 storyFlag;
/* 0x02 */ u8 playCutscene;
/* 0x03 */ u8 _0x03[1];
// The Ghidra struct seems to overambitiously encode
// the params themselves, this is just an u32 link actor params
// /* 0x00 */ u16 storyFlag;
// /* 0x02 */ u8 playCutscene;
// /* 0x03 */ u8 _0x03[1];
/* 0x00 */ u32 linkParams;
/* 0x04 */ mVec3_c position;
/* 0x10 */ mAng3_c angle;
/* 0x16 */ u16 entranceId;
@@ -146,6 +170,15 @@ struct SOBJ {
/* 0x28 */ char name[8];
};
// Size 0x???
struct SBPT {
// ???
};
// Parsed the same way in ss-tools
typedef PNT SPNT;
typedef PATH SPTH;
// Size 0x14
struct STIF {
/* 0x00 */ f32 field_0x00;
+103 -42
View File
@@ -115,24 +115,24 @@ class dRoom_c : public dBase_c {
public:
dRoom_c()
: mStateMgr(*this, sStateID::null),
field_0x15C(nullptr),
scen(nullptr),
ply(nullptr),
cam(nullptr),
evnt(nullptr),
path(nullptr),
pnt(nullptr),
bpnt(nullptr),
AREA(nullptr),
unkCount(0),
scenCount(0),
plyCount(0),
camCount(0),
evntCount(0),
pathCount(0),
pntCount(0),
bpntCount(0),
areaCount(0),
mpFile(nullptr),
mpScen(nullptr),
mpPly(nullptr),
mpCam(nullptr),
mpEvnt(nullptr),
mpPath(nullptr),
mpPnt(nullptr),
mpBpnt(nullptr),
mpArea(nullptr),
mFileCount(0),
mScenCount(0),
mPlyCount(0),
mCamCount(0),
mEvntCount(0),
mPathCount(0),
mPntCount(0),
mBpntCount(0),
mAreaCount(0),
mFlags(0) {}
virtual ~dRoom_c() {}
@@ -150,6 +150,7 @@ public:
void drawOnMapIfVisible(mMtx_c *mtx, int param);
void getBounds(mVec3_c *min, mVec3_c *max) const;
const PLY *getEntranceById(u8 id) const;
void someLastBossThing(bool arg);
f32 getFrame() const;
@@ -157,6 +158,66 @@ public:
typedef void (*foreachObjCallback)(dAcBase_c *obj);
s32 foreachObject(foreachObjCallback cb);
void setFile(const bzsFILE *file, u16 count) {
mFileCount = count;
mpFile = file;
}
void setScen(const SCEN *scen, u16 count) {
mScenCount = count;
mpScen = scen;
}
void setCam(const CAM *file, u16 count) {
mCamCount = count;
mpCam = file;
}
void setEvnt(const EVNT *evnt, u16 count) {
mEvntCount = count;
mpEvnt = evnt;
}
void setPath(const PATH *path, u16 count) {
mPathCount = count;
mpPath = path;
}
void setPnt(const PNT *pnt, u16 count) {
mPntCount = count;
mpPnt = pnt;
}
void setBpnt(const BPNT *bpnt, u16 count) {
mBpntCount = count;
mpBpnt = bpnt;
}
void setSpth(const SPTH *spth, u16 count) {
mSpthCount = count;
mpSpth = spth;
}
void setSpnt(const SPNT *spnt, u16 count) {
mSpntCount = count;
mpSpnt = spnt;
}
void setSbpt(const SBPT *sbpt, u16 count) {
mSbptCount = count;
mpSbpt = sbpt;
}
void setArea(const AREA *path, u16 count) {
mAreaCount = count;
mpArea = path;
}
void setPly(const PLY *ply, u16 count) {
mPlyCount = count;
mpPly = ply;
}
private:
bool setupBg();
void executeBg();
@@ -175,30 +236,30 @@ private:
/* 0x220 */ dBgWKCol mBg[2];
/* 0x4E0 */ STATE_MGR_DECLARE(dRoom_c);
/* 0x51C */ void *field_0x15C;
/* 0x520 */ SCEN *scen;
/* 0x524 */ PLY *ply;
/* 0x528 */ CAM *cam;
/* 0x52C */ EVNT *evnt;
/* 0x530 */ PATH *path;
/* 0x534 */ PNT *pnt;
/* 0x538 */ BPNT *bpnt;
/* 0x53C */ PATH *spth;
/* 0x540 */ void *field_0x540;
/* 0x544 */ void *field_0x544;
/* 0x548 */ AREA *AREA;
/* 0x54C */ u16 unkCount;
/* 0x54E */ u16 scenCount;
/* 0x550 */ u16 plyCount;
/* 0x552 */ u16 camCount;
/* 0x554 */ u16 evntCount;
/* 0x556 */ u16 pathCount;
/* 0x558 */ u16 pntCount;
/* 0x55A */ u16 bpntCount;
/* 0x55C */ u16 spthCount;
/* 0x55E */ u16 unk2Count;
/* 0x560 */ u16 unk3Count;
/* 0x562 */ u16 areaCount;
/* 0x51C */ const bzsFILE *mpFile;
/* 0x520 */ const SCEN *mpScen;
/* 0x524 */ const PLY *mpPly;
/* 0x528 */ const CAM *mpCam;
/* 0x52C */ const EVNT *mpEvnt;
/* 0x530 */ const PATH *mpPath;
/* 0x534 */ const PNT *mpPnt;
/* 0x538 */ const BPNT *mpBpnt;
/* 0x53C */ const SPTH *mpSpth;
/* 0x540 */ const SPNT *mpSpnt;
/* 0x544 */ const SBPT *mpSbpt;
/* 0x548 */ const AREA *mpArea;
/* 0x54C */ u16 mFileCount;
/* 0x54E */ u16 mScenCount;
/* 0x550 */ u16 mPlyCount;
/* 0x552 */ u16 mCamCount;
/* 0x554 */ u16 mEvntCount;
/* 0x556 */ u16 mPathCount;
/* 0x558 */ u16 mPntCount;
/* 0x55A */ u16 mBpntCount;
/* 0x55C */ u16 mSpthCount;
/* 0x55E */ u16 mSpntCount;
/* 0x560 */ u16 mSbptCount;
/* 0x562 */ u16 mAreaCount;
// peak vtable placement
class UnkRoomClass {
+27 -3
View File
@@ -59,7 +59,7 @@ struct SpawnInfo {
/* 0x20 */ u16 transitionFadeFrames;
/* 0x22 */ u8 room;
/* 0x23 */ u8 layer;
/* 0x24 */ s8 entrance;
/* 0x24 */ u8 entrance;
/* 0x25 */ u8 night;
/* 0x26 */ u8 trial;
/* 0x27 */ u8 transitionType;
@@ -104,13 +104,13 @@ struct SpawnInfoExt : public SpawnInfo {
struct LinkReloadInfo {
LinkReloadInfo() : mType0CsFlag(0) {}
void set(u8 roomid, const mVec3_c &pos, mAng rot, u32 flags);
void set(u8 roomid, const mVec3_c &pos, mAng rot, u32 linkParams);
/* 0x00 */ mVec3_c mPosition;
/* 0x0C */ mAng mRotY;
/* 0x0E */ u8 mRoomId;
/* 0x0F */ u8 mType0CsFlag;
/* 0x10 */ u32 mUnkFlags;
/* 0x10 */ u32 mLinkParams;
};
class dScGame_c : public dScene_c {
@@ -166,6 +166,30 @@ public:
mSavePromptFlag = val;
}
u8 getType0CsFlag() const {
return mReloadInfo.mType0CsFlag;
}
void setType0CsFlag(u8 flag) {
mReloadInfo.mType0CsFlag = flag;
}
u8 getType0PosFlag() const {
return mType0PosFlag;
}
void setType0PosFlag(u8 flag) {
mType0PosFlag = flag;
}
static u8 getReloaderType() {
return sReloaderType;
}
static void setReloaderType(u8 type) {
sReloaderType = type;
}
protected:
static u32 sUpdateFrameCount;
static u8 sCurrentLayer;
+3
View File
@@ -122,6 +122,9 @@ public:
void drawMap(mMtx_c *mtx, int);
dRoom_c *getRoom(s32 idx);
void setRoom(int roomid, dRoom_c *room);
void handleRoomChange(int roomid);
bool checkEnemyDefeatFlag(u16 flag);
bool fadeIn(s32 fadeType, u16 frames);
bool fadeOut(s32 fadeType, u16 frames);
+54 -5
View File
@@ -65,10 +65,58 @@ public:
void initUnkWithWater(u32 val, UnkWithWater *waterThing);
void destroyUnkWithWater(u32 val, UnkWithWater *waterThing);
const RMPL *getRmpl() const {
return mpRmpl;
}
u16 getRmplCount() const {
return mRmplCount;
}
void setRmpl(const RMPL *pcam, u16 count) {
mRmplCount = count;
mpRmpl = pcam;
}
const PCAM *getPcam() const {
return mpPcam;
}
u16 getPcamCount() const {
return mPcamCount;
}
void setPcam(const PCAM *pcam, u16 count) {
mPcamCount = count;
mpPcam = pcam;
}
void setLyse(const LYSE *lyse, u16 count) {
mLyseCount = count;
mpLyse = lyse;
}
void overrideLayer0WithLyse();
void setStif(const STIF *stif);
s16 getFlagIndex() const;
void setDemoName(const SizedString<16>& name) {
mDemoName = name;
}
const char *getDemoName() const {
return mDemoName;
}
void addLayerArcn(const char *path);
void addStageArcn(const char *path);
void addObjId(u16 id);
void addActorId(u16 actorId);
private:
static void lastExecuteCallback();
void triggerFade(s32 fadeType, u8 fadeFrames);
static dStageMgr_c *sInstance;
@@ -83,6 +131,7 @@ private:
/* 0x0580 */ LayoutArcControl mLayoutArcCtrl2;
/* 0x058C */ dBgS mBg;
// ...
u8 _0x00001[0x7D0];
/* 0x3E40 */ dCcS mCc;
// ...
/* 0x7930 */ dFader_c mFader;
@@ -91,10 +140,10 @@ private:
/* 0x7956 */ u16 mLyseCount;
/* 0x7958 */ u16 mRmplCount;
/* 0x795C */ PCAM *pcam;
/* 0x7960 */ PCAM *lyse;
/* 0x7964 */ STIF *stif;
/* 0x7968 */ RMPL *rmpl;
/* 0x795C */ const PCAM *mpPcam;
/* 0x7960 */ const LYSE *mpLyse;
/* 0x7964 */ const STIF *mpStif;
/* 0x7968 */ const RMPL *mpRmpl;
/* 0x799C */ mDvd_callback_c *mpDvdCallback;
/* 0x79A0 */ mDvd_callback_c *mpDvdCallback2;
@@ -105,7 +154,7 @@ private:
/* 0x8694 */ dTimeAreaMgr_c mTimeAreaMgr;
// ...
u8 ___[2450];
u8 ___[446];
/* 0x88A0 */ u32 field_0x88A0;
/* 0x88A4 */ SizedString<16> mDemoName;
+6 -7
View File
@@ -1,12 +1,11 @@
#ifndef D_STAGE_PARSE_H
#define D_STAGE_PARSE_H
#include "common.h"
typedef s32 parseCallbackArg;
void parseStageBzs(parseCallbackArg arg, void *bzs);
void parseRoomStageBzs(parseCallbackArg arg, void *bzs);
void parseBzsStageRoom(parseCallbackArg arg, void *bzs);
void parseRoomStageBzs(int roomid, const void *bzs);
void parseBzsStageRoom(int roomid, const void *bzs);
void parseStageBzs(int roomid, const void *bzs);
void parseRoomBzs(int roomid, const void *bzs);
void parseRoomReactivateBzs(int roomid, const void *bzs);
void parseRoomActivateBzs(int roomid, const void *bzs);
#endif
+2 -2
View File
@@ -210,12 +210,12 @@ public:
/* 8000CAD0 */ bool isNew_FileA();
/* 8000CB00 */ void setSceneFlagIndex(u16 idx);
/* 8000CB00 */ void setSceneFlagIndex(s16 idx);
/* 8000CB30 */ u32 getSceneFlagIndex();
/* 8000CB80 */ s32 getFileAreaIndex();
/* 8000CBD0 */ void fn_8000CBD0(u8);
/* 8000CC00 */ void fn_8000CC00();
/* 8000CC00 */ u8 fn_8000CC00();
/* 8000CC50 */ void setFileTimes();
/* 8000CCB0 */ void setPlayTime(s64 time);
+2 -2
View File
@@ -248,11 +248,11 @@ void SpawnInfoExt::setSpawnData(
mType0RotY = rot;
}
void LinkReloadInfo::set(u8 roomid, const mVec3_c &pos, mAng rot, u32 flags) {
void LinkReloadInfo::set(u8 roomid, const mVec3_c &pos, mAng rot, u32 linkParams) {
mRoomId = roomid;
mPosition = pos;
mRotY = rot;
mUnkFlags = flags;
mLinkParams = linkParams;
mType0CsFlag = 1;
}
+9 -2
View File
@@ -3,9 +3,11 @@
#include "common.h"
#include "d/col/bg/d_bg_s.h"
#include "d/d_base.h"
#include "d/d_bzs_types.h"
#include "d/d_room.h"
#include "d/d_sc_game.h"
#include "d/d_sc_title.h"
#include "d/d_stage_mgr.h"
#include "d/flag/dungeonflag_manager.h"
#include "d/flag/sceneflag_manager.h"
#include "d/flag/storyflag_manager.h"
@@ -53,14 +55,19 @@ extern "C" void ScrapperPickupMgr__dtor();
extern "C" void fn_80028A80();
extern "C" void fn_80028EC0();
extern "C" void fn_80066D30(s32);
extern "C" void setPCAMpos2(const PCAM *);
int dStage_c::create() {
if (mPhase.step() != sFPhaseBase::PHASE_ALL_DONE) {
return NOT_READY;
}
// dStageMgr_c *stageMgr = dStageMgr_c::GetInstance();
// for (int i = 0; i < dSta)
dStageMgr_c *stageMgr = dStageMgr_c::GetInstance();
const PCAM *pcam = stageMgr->getPcam();
for (int i = 0; i < stageMgr->getPcamCount(); i++) {
setPCAMpos2(pcam);
pcam++;
}
if (mapRelated.field_0x1EB == 0) {
mVec3_c min, max;
+13 -16
View File
@@ -17,7 +17,6 @@
#include "toBeSorted/arc_managers/layout_arc_manager.h"
#include "toBeSorted/arc_managers/oarc_manager.h"
#include "toBeSorted/music_mgrs.h"
#include <cstddef>
SPECIAL_BASE_PROFILE(STAGE_MANAGER, dStageMgr_c, fProfile::STAGE_MANAGER, 0X5, 1536);
@@ -52,7 +51,7 @@ void dStageMgr_c::executeState_ReadStageRes() {
}
void dStageMgr_c::finalizeState_ReadStageRes() {
void *stageBzs = CurrentStageArcManager::sInstance->getData("dat/stage.bzs");
const void *stageBzs = CurrentStageArcManager::sInstance->getData("dat/stage.bzs");
if (stageBzs != nullptr) {
parseStageBzs(-1, stageBzs);
parseRoomStageBzs(-1, stageBzs);
@@ -70,15 +69,15 @@ void dStageMgr_c::executeState_ReadRoomRes() {
}
void dStageMgr_c::finalizeState_ReadRoomRes() {
if (rmpl != nullptr) {
RMPL *itRmpl = rmpl;
if (mpRmpl != nullptr) {
const RMPL *itRmpl = mpRmpl;
for (int i = 0; i < mRmplCount; itRmpl++, i++) {
void *bzs = CurrentStageArcManager::sInstance->loadFromRoomArc(itRmpl->roomId, "dat/room.bzs");
const void *bzs = CurrentStageArcManager::sInstance->loadFromRoomArc(itRmpl->roomId, "dat/room.bzs");
parseRoomStageBzs(itRmpl->roomId, bzs);
}
} else {
u32 roomId = dScGame_c::currentSpawnInfo.room;
void *bzs =
const void *bzs =
CurrentStageArcManager::sInstance->loadFromRoomArc(dScGame_c::currentSpawnInfo.room, "dat/room.bzs");
parseRoomStageBzs(roomId, bzs);
}
@@ -116,20 +115,20 @@ static const char *sSeekerStoneLayoutArcs[] = {
void dStageMgr_c::initializeState_ReadLayerObjectRes() {
mDemoName = demoName;
void *bzs = CurrentStageArcManager::sInstance->getData("dat/stage.bzs");
const void *bzs = CurrentStageArcManager::sInstance->getData("dat/stage.bzs");
if (bzs != nullptr) {
parseBzsStageRoom(-1, bzs);
}
if (rmpl != nullptr) {
RMPL *itRmpl = rmpl;
if (mpRmpl != nullptr) {
const RMPL *itRmpl = mpRmpl;
for (int i = 0; i < mRmplCount; itRmpl++, i++) {
void *bzs = CurrentStageArcManager::sInstance->loadFromRoomArc(itRmpl->roomId, "dat/room.bzs");
const void *bzs = CurrentStageArcManager::sInstance->loadFromRoomArc(itRmpl->roomId, "dat/room.bzs");
parseBzsStageRoom(itRmpl->roomId, bzs);
}
} else {
u32 roomId = dScGame_c::currentSpawnInfo.room;
void *bzs =
const void *bzs =
CurrentStageArcManager::sInstance->loadFromRoomArc(dScGame_c::currentSpawnInfo.room, "dat/room.bzs");
parseBzsStageRoom(roomId, bzs);
}
@@ -234,7 +233,7 @@ void dStageMgr_c::finalizeState_ReadObjectSound() {
}
extern "C" void *LYT_SAVE_MGR;
extern "C" void fn_80285600(void*, int, int);
extern "C" void fn_80285600(void *, int, int);
void dStageMgr_c::initializeState_SceneChangeSave() {
dScGame_c::sInstance->setSavePromptFlag(false);
if (LYT_SAVE_MGR != nullptr) {
@@ -247,7 +246,7 @@ void dStageMgr_c::initializeState_SceneChangeSave() {
void dStageMgr_c::executeState_SceneChangeSave() {
if (LYT_SAVE_MGR != nullptr) {
// "isNotSaving???"
if (((u8*)LYT_SAVE_MGR)[0x119C] == true) {
if (((u8 *)LYT_SAVE_MGR)[0x119C] == true) {
mStateMgr.changeState(StateID_RestartSceneWait);
}
} else {
@@ -287,9 +286,7 @@ void dStageMgr_c::initializeState_RestartScene() {
}
void dStageMgr_c::executeState_RestartScene() {
if (mFader.isStatus(mFaderBase_c::FADED_OUT)) {
}
if (mFader.isStatus(mFaderBase_c::FADED_OUT)) {}
}
void dStageMgr_c::finalizeState_RestartScene() {
+523
View File
@@ -0,0 +1,523 @@
#include "d/d_stage_parse.h"
#include "common.h"
#include "d/a/obj/d_a_obj_base.h"
#include "d/d_base.h"
#include "d/d_bzs_types.h"
#include "d/d_room.h"
#include "d/d_sc_game.h"
#include "d/d_stage.h"
#include "d/d_stage_mgr.h"
#include "d/flag/flag_managers.h"
#include "d/flag/storyflag_manager.h"
#include "f/f_base.h"
#include "f/f_profile_name.h"
#include "m/m_angle.h"
#include "m/m_vec.h"
#include "sized_string.h"
#include "toBeSorted/file_manager.h"
struct BzsHeader {
/* 0x00 */ u32 mName;
/* 0x04 */ u16 mSectionCount;
/* 0x08 */ u32 mOffset;
};
struct BzsSectionHead {
/* 0x00 */ u32 mTag;
/* 0x04 */ u16 mCount;
/* 0x08 */ u32 mOffset;
};
typedef void (*BzsParseFunc)(int roomid, const BzsSectionHead *section);
struct BzsTagToParseFunc {
/* 0x00 */ u32 mTag;
/* 0x04 */ BzsParseFunc mParseFunc;
};
#define OFS_TO_PTR(ty, section) \
(reinterpret_cast<const ty *>(reinterpret_cast<const char *>(section) + section->mOffset))
static void findAndRunStageTagParseFunc(
int roomid, const BzsSectionHead *head, const BzsTagToParseFunc *handlerTable, s32 tableSize
);
static void handleBzsPcam(int roomid, const BzsSectionHead *section) {
dStageMgr_c::GetInstance()->setPcam(OFS_TO_PTR(PCAM, section), section->mCount);
}
static void handleBzsLyse(int roomid, const BzsSectionHead *section) {
dStageMgr_c::GetInstance()->setLyse(OFS_TO_PTR(LYSE, section), section->mCount);
dStageMgr_c::GetInstance()->overrideLayer0WithLyse();
}
static void handleBzsStif(int roomid, const BzsSectionHead *section) {
// section->mCount == 1
dStageMgr_c::GetInstance()->setStif(OFS_TO_PTR(STIF, section));
s16 flagIndex = dStageMgr_c::GetInstance()->getFlagIndex();
FileManager::sInstance->setSceneFlagIndex(flagIndex);
updateFlagForFlagIndex(flagIndex);
}
static void handleBzsRmpl(int roomid, const BzsSectionHead *section) {
dStageMgr_c::GetInstance()->setRmpl(OFS_TO_PTR(RMPL, section), section->mCount);
}
static void handleBzsFile(int roomid, const BzsSectionHead *section) {
const bzsFILE *file = OFS_TO_PTR(bzsFILE, section);
dRoom_c *room = dStage_c::GetInstance()->getRoom(roomid);
room->setFile(file, section->mCount);
}
static void handleBzsLylt(int roomid, const BzsSectionHead *section) {
const LYLT *lylt = OFS_TO_PTR(LYLT, section);
for (s32 i = 0; i < section->mCount; i++) {
if (lylt->layer == dScGame_c::currentSpawnInfo.layer && lylt->demoHigh >= 0) {
SizedString<16> demoName;
demoName.sprintf("Demo%02d_%02d", lylt->demoHigh, lylt->demoLow);
dStageMgr_c::GetInstance()->setDemoName(demoName);
dStageMgr_c::GetInstance()->addLayerArcn(dStageMgr_c::GetInstance()->getDemoName());
}
lylt++;
}
}
static void handleBzsScen(int roomid, const BzsSectionHead *section) {
const SCEN *scen = OFS_TO_PTR(SCEN, section);
dRoom_c *room = dStage_c::GetInstance()->getRoom(roomid);
room->setScen(scen, section->mCount);
}
static void handleBzsCam(int roomid, const BzsSectionHead *section) {
const CAM *cam = OFS_TO_PTR(CAM, section);
dRoom_c *room = dStage_c::GetInstance()->getRoom(roomid);
room->setCam(cam, section->mCount);
}
static void handleBzsEvnt(int roomid, const BzsSectionHead *section) {
const EVNT *evnt = OFS_TO_PTR(EVNT, section);
dRoom_c *room = dStage_c::GetInstance()->getRoom(roomid);
room->setEvnt(evnt, section->mCount);
}
static void handleBzsPath(int roomid, const BzsSectionHead *section) {
const PATH *path = OFS_TO_PTR(PATH, section);
dRoom_c *room = dStage_c::GetInstance()->getRoom(roomid);
room->setPath(path, section->mCount);
}
static void handleBzsPnt(int roomid, const BzsSectionHead *section) {
const PNT *pnt = OFS_TO_PTR(PNT, section);
dRoom_c *room = dStage_c::GetInstance()->getRoom(roomid);
room->setPnt(pnt, section->mCount);
}
static void handleBzsBpnt(int roomid, const BzsSectionHead *section) {
const BPNT *bpnt = OFS_TO_PTR(BPNT, section);
dRoom_c *room = dStage_c::GetInstance()->getRoom(roomid);
room->setBpnt(bpnt, section->mCount);
}
static void handleBzsSpth(int roomid, const BzsSectionHead *section) {
const SPTH *spth = OFS_TO_PTR(SPTH, section);
dRoom_c *room = dStage_c::GetInstance()->getRoom(roomid);
room->setSpth(spth, section->mCount);
}
static void handleBzsSpnt(int roomid, const BzsSectionHead *section) {
const SPNT *spnt = OFS_TO_PTR(SPNT, section);
dRoom_c *room = dStage_c::GetInstance()->getRoom(roomid);
room->setSpnt(spnt, section->mCount);
}
static void handleBzsSbpt(int roomid, const BzsSectionHead *section) {
const SBPT *sbpt = OFS_TO_PTR(SBPT, section);
dRoom_c *room = dStage_c::GetInstance()->getRoom(roomid);
room->setSbpt(sbpt, section->mCount);
}
static void handleBzsArea(int roomid, const BzsSectionHead *section) {
const AREA *area = OFS_TO_PTR(AREA, section);
dRoom_c *room = dStage_c::GetInstance()->getRoom(roomid);
room->setArea(area, section->mCount);
}
extern "C" bool fn_8005C5D0(u32);
extern "C" void spawnLightObject();
extern "C" void spawnWeatherTag();
static void handleBzsPly(int roomid, const BzsSectionHead *section) {
const PLY *ply = OFS_TO_PTR(PLY, section);
dRoom_c *room = dStage_c::GetInstance()->getRoom(roomid);
room->setPly(ply, section->mCount);
if (roomid == dScGame_c::currentSpawnInfo.room) {
dScGame_c *sc = dScGame_c::GetInstance();
const mVec3_c *linkPos;
const mAng3_c *linkAngle;
mAng3_c ang(0, 0, 0);
mVec3_c pos;
u32 linkActorParams = 0x7FFFFFF;
bool param = 0;
bool preventSetRespawnInfo = false;
u8 reloaderType = dScGame_c::getReloaderType();
if (reloaderType != 0) {
FileManager *fileMgr = FileManager::sInstance;
if (reloaderType == 2) {
pos = *FileManager::sInstance->getPosT2();
ang.y = fileMgr->getAngleT2();
linkPos = &pos;
linkAngle = &ang;
linkActorParams = 0x7FFFF1B;
} else if (reloaderType == 3) {
pos = *FileManager::sInstance->getPosT3();
ang.y = fileMgr->getAngleT3();
linkPos = &pos;
linkAngle = &ang;
if (!StoryflagManager::sInstance->getCounterOrFlag(752) &&
!StoryflagManager::sInstance->getCounterOrFlag(119)) {
const PLY *entrance = room->getEntranceById(dScGame_c::currentSpawnInfo.entrance);
if (fn_8005C5D0(entrance->linkParams) == true) {
linkActorParams = entrance->linkParams;
}
}
} else {
if (FileManager::sInstance->getEntranceLoadFlagT1() == 0 && dScGame_c::getReloaderType() != 4) {
pos = *fileMgr->getPosT1();
ang.y = fileMgr->getAngleT1();
if (fileMgr->fn_8000CC00() == 2) {
const PLY *entrance = room->getEntranceById(dScGame_c::currentSpawnInfo.entrance);
linkActorParams = entrance->linkParams;
}
linkPos = &pos;
linkAngle = &ang;
} else {
const PLY *entrance = room->getEntranceById(dScGame_c::currentSpawnInfo.entrance);
linkActorParams = entrance->linkParams;
linkPos = &entrance->position;
linkAngle = &entrance->angle;
}
}
dScGame_c::setReloaderType(0);
if (sc->getType0CsFlag() != 0) {
sc->setType0CsFlag(0);
}
} else {
if (dScGame_c::GetInstance()->getType0CsFlag() != 0) {
preventSetRespawnInfo = true;
const LinkReloadInfo &info = dScGame_c::GetInstance()->getLinkReloadInfo();
ang.y = info.mRotY;
linkPos = &info.mPosition;
linkAngle = &ang;
linkActorParams = info.mLinkParams;
sc->setType0CsFlag(0);
} else if (dScGame_c::GetInstance()->getType0PosFlag() != 0) {
const SpawnInfoExt &info = dScGame_c::GetInstance()->getSpawnInfo();
pos = info.mType0Pos;
linkPos = &pos;
ang.y = info.mType0RotY;
linkAngle = &ang;
sc->setType0PosFlag(0);
} else {
const PLY *entrance = room->getEntranceById(dScGame_c::currentSpawnInfo.entrance);
linkActorParams = entrance->linkParams;
linkPos = &entrance->position;
linkAngle = &entrance->angle;
param = true;
}
}
// TODO constify args
dAcObjBase_c::create(
fProfile::PLAYER, -1, linkActorParams, (mVec3_c *)linkPos, (mAng3_c *)linkAngle, nullptr, -1
);
if (!preventSetRespawnInfo) {
dScGame_c::GetInstance()->setRespawnInfo(*linkPos, *linkAngle, param);
}
dStage_c::GetInstance()->handleRoomChange(roomid);
dBase_c::createBase(fProfile::CAMERA, dStage_c::GetInstance(), 0, fBase_c::OTHER);
spawnLightObject();
spawnWeatherTag();
}
}
extern "C" u16 getActorIdForObjName2(const char *objname);
// The above function suffered from tons of regswaps that ended up being fixed very quickly
// (swapping *pos and *ang). The below four functions have a single regswap that I don't
// understand and that I spent more time trying to fix than in the above function.
static void handleBzsObjn(int roomid, const BzsSectionHead *section) {
const OBJN *objn = OFS_TO_PTR(OBJN, section);
const char *buf = reinterpret_cast<const char *>(objn);
for (s32 i = 0; i < section->mCount; i++) {
dStageMgr_c::GetInstance()->addObjId(getActorIdForObjName2(buf + objn->offset));
objn++;
}
}
static void handleBzsArcn(int roomid, const BzsSectionHead *section) {
const ARCN *arcn = OFS_TO_PTR(ARCN, section);
const char *buf = reinterpret_cast<const char *>(arcn);
for (s32 i = 0; i < section->mCount; i++) {
dStageMgr_c::GetInstance()->addStageArcn(buf + arcn->offset);
arcn++;
}
}
static void handleBzsLayerObjn(int roomid, const BzsSectionHead *section) {
const OBJN *objn = OFS_TO_PTR(OBJN, section);
const char *buf = reinterpret_cast<const char *>(objn);
for (s32 i = 0; i < section->mCount; i++) {
u16 id = getActorIdForObjName2(buf + objn->offset);
dStageMgr_c::GetInstance()->addActorId(id);
objn++;
}
}
static void handleBzsLayerArcn(int roomid, const BzsSectionHead *section) {
const ARCN *arcn = OFS_TO_PTR(ARCN, section);
const char *buf = reinterpret_cast<const char *>(arcn);
for (s32 i = 0; i < section->mCount; i++) {
dStageMgr_c::GetInstance()->addLayerArcn(buf + arcn->offset);
arcn++;
}
}
static u16 getEnemyDefeatFlagFromId(s32 roomid, u16 id) {
u16 val = id & 0x3FF;
if (val >= 0x400) {
// Interesting condition
return -1;
}
if (roomid == -1) {
return val + (0x3F << 10);
}
return val + (roomid << 10);
}
static s8 getViewClipIndexFromId(u16 id) {
s8 val = (id >> 10) & 0x3F;
if (val == 0x3F) {
return -1;
}
return val;
}
static void handleBzsObj(int roomid, const BzsSectionHead *section) {
dStage_c *stage = dStage_c::GetInstance();
const OBJ *obj = OFS_TO_PTR(OBJ, section);
for (s32 i = 0; i < section->mCount; i++) {
u16 flag = getEnemyDefeatFlagFromId(roomid, obj->id);
s8 viewClipIdx = getViewClipIndexFromId(obj->id);
if (stage->checkEnemyDefeatFlag(flag)) {
dAcObjBase_c::create(
obj->name, roomid, obj->params1, &obj->position, &obj->angle, nullptr, obj->params2, flag, viewClipIdx
);
}
obj++;
}
}
static void handleBzsSobj(int roomid, const BzsSectionHead *section) {
dStage_c *stage = dStage_c::GetInstance();
const SOBJ *obj = OFS_TO_PTR(SOBJ, section);
for (s32 i = 0; i < section->mCount; i++) {
u16 flag = getEnemyDefeatFlagFromId(roomid, obj->id);
s8 viewClipIdx = getViewClipIndexFromId(obj->id);
if (stage->checkEnemyDefeatFlag(flag)) {
dAcObjBase_c::create(
obj->name, roomid, obj->params1, &obj->position, &obj->angle, (mVec3_c *)&obj->scale, obj->params2,
flag, viewClipIdx
);
}
obj++;
}
}
static void handleBzsStas(int roomid, const BzsSectionHead *section) {
dStage_c *stage = dStage_c::GetInstance();
const SOBJ *obj = OFS_TO_PTR(SOBJ, section);
for (s32 i = 0; i < section->mCount; i++) {
u16 flag = getEnemyDefeatFlagFromId(roomid, obj->id);
s8 viewClipIdx = getViewClipIndexFromId(obj->id);
if (stage->checkEnemyDefeatFlag(flag)) {
dAcObjBase_c::createActorUnkGroup3(
obj->name, roomid, obj->params1, &obj->position, &obj->angle, &obj->scale, obj->params2, flag,
viewClipIdx
);
}
obj++;
}
}
void parseLayerBzs(int roomid, u32 layer, const LAY *head, const BzsTagToParseFunc *handlerTable, s32 tableSize) {
const LAY *lay = head + layer;
const BzsSectionHead *newHead = OFS_TO_PTR(BzsSectionHead, lay);
for (s32 i = 0; i < lay->mCount; i++) {
findAndRunStageTagParseFunc(roomid, newHead++, handlerTable, tableSize);
}
}
static const BzsTagToParseFunc layerHandlers[] = {
{'OBJN', handleBzsLayerObjn},
{'ARCN', handleBzsLayerArcn},
};
void handleBzsLay(int roomid, const BzsSectionHead *section) {
const LAY *lay = OFS_TO_PTR(LAY, section);
parseLayerBzs(roomid, 0, lay, layerHandlers, ARRAY_LENGTH(layerHandlers));
if (dScGame_c::currentSpawnInfo.layer != 0) {
parseLayerBzs(roomid, dScGame_c::currentSpawnInfo.layer, lay, layerHandlers, ARRAY_LENGTH(layerHandlers));
}
}
static const BzsTagToParseFunc layerHandlers2[] = {
{'OBJ ', handleBzsObj},
{'SOBJ', handleBzsSobj},
{'STAG', handleBzsStas},
};
void handleBzsLay2(int roomid, const BzsSectionHead *section) {
const LAY *lay = OFS_TO_PTR(LAY, section);
parseLayerBzs(roomid, 0, lay, layerHandlers2, ARRAY_LENGTH(layerHandlers2));
if (dScGame_c::currentSpawnInfo.layer != 0) {
parseLayerBzs(roomid, dScGame_c::currentSpawnInfo.layer, lay, layerHandlers2, ARRAY_LENGTH(layerHandlers2));
}
}
static const BzsTagToParseFunc layerHandlers3[] = {
{'OBJS', handleBzsObj},
{'SOBS', handleBzsSobj},
{'STAS', handleBzsStas},
{'SNDT', handleBzsStas},
{'TBOX', handleBzsObj},
{'DOOR', handleBzsObj},
};
void handleBzsLay3(int roomid, const BzsSectionHead *section) {
const LAY *lay = OFS_TO_PTR(LAY, section);
parseLayerBzs(roomid, 0, lay, layerHandlers3, ARRAY_LENGTH(layerHandlers3));
if (dScGame_c::currentSpawnInfo.layer != 0) {
parseLayerBzs(roomid, dScGame_c::currentSpawnInfo.layer, lay, layerHandlers3, ARRAY_LENGTH(layerHandlers3));
}
}
static const BzsTagToParseFunc defaultHandlers[] = {
{'PCAM', handleBzsPcam},
{'LYSE', handleBzsLyse},
{'STIF', handleBzsStif},
{'RMPL', handleBzsRmpl},
{'SCEN', handleBzsScen},
{'CAM ', handleBzsCam},
{'EVNT', handleBzsEvnt},
{'PATH', handleBzsPath},
{'PNT ', handleBzsPnt},
{'BPNT', handleBzsBpnt},
{'SPTH', handleBzsSpth},
{'SPNT', handleBzsSpnt},
{'SBPT', handleBzsSbpt},
{'AREA', handleBzsArea},
};
static void findAndRunStageTagParseFunc(
int roomid, const BzsSectionHead *head, const BzsTagToParseFunc *handlerTable, s32 tableSize
) {
if (handlerTable == nullptr) {
tableSize = ARRAY_LENGTH(defaultHandlers);
handlerTable = defaultHandlers;
}
while (tableSize > 0) {
if (head->mTag == handlerTable->mTag) {
handlerTable->mParseFunc(roomid, head);
return;
}
handlerTable++;
tableSize--;
}
}
static const BzsTagToParseFunc roomStageHandlers[] = {
{'OBJN', handleBzsObjn},
{'ARCN', handleBzsArcn},
};
void parseRoomStageBzs(int roomid, const void *bzs) {
const BzsHeader *header = static_cast<const BzsHeader *>(bzs);
const BzsSectionHead *head = OFS_TO_PTR(BzsSectionHead, header);
for (s32 i = 0; i < header->mSectionCount; i++) {
findAndRunStageTagParseFunc(roomid, head++, roomStageHandlers, ARRAY_LENGTH(roomStageHandlers));
}
}
static const BzsTagToParseFunc stageRoomHandlers[] = {
{'LYLT', handleBzsLylt},
{'LAY ', handleBzsLay},
};
void parseBzsStageRoom(int roomid, const void *bzs) {
const BzsHeader *header = static_cast<const BzsHeader *>(bzs);
const BzsSectionHead *head = OFS_TO_PTR(BzsSectionHead, header);
for (s32 i = 0; i < header->mSectionCount; i++) {
findAndRunStageTagParseFunc(roomid, head++, stageRoomHandlers, ARRAY_LENGTH(stageRoomHandlers));
}
}
void parseStageBzs(int roomid, const void *bzs) {
const BzsHeader *header = static_cast<const BzsHeader *>(bzs);
const BzsSectionHead *head = OFS_TO_PTR(BzsSectionHead, header);
for (s32 i = 0; i < header->mSectionCount; i++) {
// Run "default handlers"
findAndRunStageTagParseFunc(roomid, head++, nullptr, 0);
}
}
static const BzsTagToParseFunc roomHandlers[] = {
{'FILE', handleBzsFile},
{'SCEN', handleBzsScen},
{'CAM ', handleBzsCam},
{'EVNT', handleBzsEvnt},
{'PATH', handleBzsPath},
{'PNT ', handleBzsPnt},
{'BPNT', handleBzsBpnt},
{'SPTH', handleBzsSpth},
{'SPNT', handleBzsSpnt},
{'SBPT', handleBzsSbpt},
{'AREA', handleBzsArea},
{'PLY ', handleBzsPly},
};
void parseRoomBzs(int roomid, const void *bzs) {
const BzsHeader *header = static_cast<const BzsHeader *>(bzs);
const BzsSectionHead *head = OFS_TO_PTR(BzsSectionHead, header);
for (s32 i = 0; i < header->mSectionCount; i++) {
findAndRunStageTagParseFunc(roomid, head++, roomHandlers, ARRAY_LENGTH(roomHandlers));
}
}
static const BzsTagToParseFunc roomReactivateHandlers[] = {
{'SOBJ', handleBzsSobj},
{'STAG', handleBzsStas},
{'LAY ', handleBzsLay2},
};
void parseRoomReactivateBzs(int roomid, const void *bzs) {
const BzsHeader *header = static_cast<const BzsHeader *>(bzs);
const BzsSectionHead *head = OFS_TO_PTR(BzsSectionHead, header);
for (s32 i = 0; i < header->mSectionCount; i++) {
findAndRunStageTagParseFunc(roomid, head++, roomReactivateHandlers, ARRAY_LENGTH(roomReactivateHandlers));
}
}
static const BzsTagToParseFunc roomActivateHandlers[] = {
{'LAY ', handleBzsLay3},
};
void parseRoomActivateBzs(int roomid, const void *bzs) {
const BzsHeader *header = static_cast<const BzsHeader *>(bzs);
const BzsSectionHead *head = OFS_TO_PTR(BzsSectionHead, header);
for (s32 i = 0; i < header->mSectionCount; i++) {
findAndRunStageTagParseFunc(roomid, head++, roomActivateHandlers, ARRAY_LENGTH(roomActivateHandlers));
}
}
+2 -2
View File
@@ -235,12 +235,12 @@ u16 *FileManager::getStoryFlagsMut() {
/* 8000CAD0 */ bool FileManager::isNew_FileA() {}
/* 8000CB00 */ void FileManager::setSceneFlagIndex(u16 idx) {}
/* 8000CB00 */ void FileManager::setSceneFlagIndex(s16 idx) {}
/* 8000CB30 */ u32 FileManager::getSceneFlagIndex() {}
/* 8000CB80 */ s32 FileManager::getFileAreaIndex() {}
/* 8000CBD0 */ void FileManager::fn_8000CBD0(u8) {}
/* 8000CC00 */ void FileManager::fn_8000CC00() {}
/* 8000CC00 */ u8 FileManager::fn_8000CC00() {}
/* 8000CC50 */ void FileManager::setFileTimes() {}
/* 8000CCB0 */ void FileManager::setPlayTime(s64 time) {}