From 67b576ad9aec15953fa0d52f33cc88e8a783b46b Mon Sep 17 00:00:00 2001 From: Niklas Bauer Date: Fri, 26 Dec 2025 22:17:51 +0100 Subject: [PATCH] f_op debug work (#2991) * f_op debug 1 * f_op debug 2 * f_op debug 3 * f_op debug 4 * f_op debug 5 * f_op_debug fix build * f_op linking * remove goto in fopac_create * fix regressions * fix regressions * pr comments --- config/RZDE01_02/symbols.txt | 2 +- config/RZDJ01/symbols.txt | 2 +- config/RZDP01/symbols.txt | 2 +- config/Shield/symbols.txt | 2 +- config/ShieldD/splits.txt | 4 +- config/ShieldD/symbols.txt | 14 +- configure.py | 96 ++++---- include/d/actor/d_a_itembase.h | 1 + include/d/actor/d_a_obj_carry.h | 7 +- include/d/actor/d_a_tag_stream.h | 6 +- include/d/d_com_inf_game.h | 2 +- include/d/d_event.h | 8 +- include/d/d_item.h | 1 + include/d/d_particle.h | 3 + include/d/d_s_play.h | 6 +- include/d/d_stage.h | 5 +- include/f_op/f_op_actor.h | 1 + include/f_op/f_op_actor_mng.h | 14 +- include/f_op/f_op_actor_tag.h | 2 +- include/f_op/f_op_camera_mng.h | 3 +- include/f_op/f_op_kankyo.h | 2 + include/f_op/f_op_scene_mng.h | 24 +- include/f_op/f_op_scene_req.h | 2 +- include/f_pc/f_pc_manager.h | 11 +- include/m_Do/m_Do_ext.h | 2 + include/m_Do/m_Do_hostIO.h | 1 + src/Z2AudioLib/Z2StatusMgr.cpp | 2 +- src/d/actor/d_a_obj_stone.cpp | 3 +- src/d/d_camera.cpp | 6 +- src/d/d_debug_camera.cpp | 6 +- src/d/d_particle.cpp | 2 +- src/f_op/f_op_actor.cpp | 97 ++++---- src/f_op/f_op_actor_mng.cpp | 395 +++++++++++++++++++------------ src/f_op/f_op_actor_tag.cpp | 4 +- src/f_op/f_op_camera.cpp | 27 ++- src/f_op/f_op_camera_mng.cpp | 6 +- src/f_op/f_op_draw_iter.cpp | 8 +- src/f_op/f_op_kankyo.cpp | 47 ++-- src/f_op/f_op_kankyo_mng.cpp | 20 +- src/f_op/f_op_msg.cpp | 57 +++-- src/f_op/f_op_overlap.cpp | 32 ++- src/f_op/f_op_overlap_mng.cpp | 41 +++- src/f_op/f_op_overlap_req.cpp | 19 +- src/f_op/f_op_scene.cpp | 24 +- src/f_op/f_op_scene_mng.cpp | 14 +- src/f_op/f_op_scene_pause.cpp | 2 +- src/f_op/f_op_scene_req.cpp | 34 ++- src/f_op/f_op_view.cpp | 23 +- src/f_pc/f_pc_manager.cpp | 1 + src/m_Do/m_Do_hostIO.cpp | 4 + 50 files changed, 690 insertions(+), 407 deletions(-) diff --git a/config/RZDE01_02/symbols.txt b/config/RZDE01_02/symbols.txt index f834826770..3572680587 100644 --- a/config/RZDE01_02/symbols.txt +++ b/config/RZDE01_02/symbols.txt @@ -28000,7 +28000,7 @@ dylPreLoadTime1 = .sbss:0x80520E18; // type:object size:0x8 scope:global align:4 resPreLoadTime0 = .sbss:0x80520E20; // type:object size:0x8 scope:global align:4 data:4byte resPreLoadTime1 = .sbss:0x80520E28; // type:object size:0x8 scope:global align:4 data:4byte g_preLoadHIO = .sbss:0x80520E30; // type:object size:0x4 scope:global align:4 -lbl_80520E34 = .sbss:0x80520E34; // type:object size:0x1 data:byte +pauseTimer__9dScnPly_c = .sbss:0x80520E34; // type:object size:0x1 data:byte lbl_80520E35 = .sbss:0x80520E35; // type:object size:0x1 data:byte g_regHIO = .sbss:0x80520E38; // type:object size:0x4 scope:global align:4 m_nowID__9dkWmark_c = .sbss:0x80520E40; // type:object size:0x4 scope:global align:4 data:4byte diff --git a/config/RZDJ01/symbols.txt b/config/RZDJ01/symbols.txt index 83f6d7e6e7..7e63623202 100644 --- a/config/RZDJ01/symbols.txt +++ b/config/RZDJ01/symbols.txt @@ -28004,7 +28004,7 @@ dylPreLoadTime1 = .sbss:0x8051EC88; // type:object size:0x8 scope:global align:4 resPreLoadTime0 = .sbss:0x8051EC90; // type:object size:0x8 scope:global align:4 data:4byte resPreLoadTime1 = .sbss:0x8051EC98; // type:object size:0x8 scope:global align:4 data:4byte g_preLoadHIO = .sbss:0x8051ECA0; // type:object size:0x4 scope:global align:4 -lbl_8051ECA4 = .sbss:0x8051ECA4; // type:object size:0x1 data:byte +pauseTimer__9dScnPly_c = .sbss:0x8051ECA4; // type:object size:0x1 data:byte lbl_8051ECA5 = .sbss:0x8051ECA5; // type:object size:0x1 data:byte g_regHIO = .sbss:0x8051ECA8; // type:object size:0x4 scope:global align:4 m_nowID__9dkWmark_c = .sbss:0x8051ECB0; // type:object size:0x4 scope:global align:4 data:4byte diff --git a/config/RZDP01/symbols.txt b/config/RZDP01/symbols.txt index 570d80796b..752db8a4f2 100644 --- a/config/RZDP01/symbols.txt +++ b/config/RZDP01/symbols.txt @@ -27891,7 +27891,7 @@ dylPreLoadTime1 = .sbss:0x805215D8; // type:object size:0x8 scope:global align:4 resPreLoadTime0 = .sbss:0x805215E0; // type:object size:0x8 scope:global align:4 data:4byte resPreLoadTime1 = .sbss:0x805215E8; // type:object size:0x8 scope:global align:4 data:4byte g_preLoadHIO = .sbss:0x805215F0; // type:object size:0x4 scope:global align:4 -lbl_805215F4 = .sbss:0x805215F4; // type:object size:0x1 data:byte +pauseTimer__9dScnPly_c = .sbss:0x805215F4; // type:object size:0x1 data:byte lbl_805215F5 = .sbss:0x805215F5; // type:object size:0x1 data:byte g_regHIO = .sbss:0x805215F8; // type:object size:0x4 scope:global align:4 m_nowID__9dkWmark_c = .sbss:0x80521600; // type:object size:0x4 scope:global align:4 data:4byte diff --git a/config/Shield/symbols.txt b/config/Shield/symbols.txt index ee6a502e1d..814a870c54 100644 --- a/config/Shield/symbols.txt +++ b/config/Shield/symbols.txt @@ -25503,7 +25503,7 @@ dylPreLoadTime1 = .sbss:0x80508F18; // type:object size:0x8 scope:global data:4b resPreLoadTime0 = .sbss:0x80508F20; // type:object size:0x8 scope:global data:4byte hash:0xA1124705 resPreLoadTime1 = .sbss:0x80508F28; // type:object size:0x8 scope:global data:4byte hash:0xA1124704 g_preLoadHIO = .sbss:0x80508F30; // type:object size:0x4 scope:global data:4byte hash:0x2AE34DF2 -lbl_80508F34 = .sbss:0x80508F34; // type:object size:0x1 data:byte hash:0x2421530A dhash:0x54C04193 +pauseTimer__9dScnPly_c = .sbss:0x80508F34; // type:object size:0x1 data:byte hash:0x2421530A dhash:0x54C04193 lbl_80508F35 = .sbss:0x80508F35; // type:object size:0x1 data:byte hash:0x16684D2D dhash:0x100CD5B4 g_regHIO = .sbss:0x80508F38; // type:object size:0x4 scope:global data:4byte hash:0x944FCFA3 m_nowID__9dkWmark_c = .sbss:0x80508F40; // type:object size:0x4 scope:global data:4byte hash:0x8C7CDEA4 dhash:0x6AA81CDD diff --git a/config/ShieldD/splits.txt b/config/ShieldD/splits.txt index 4aa788274e..453eb67a2b 100644 --- a/config/ShieldD/splits.txt +++ b/config/ShieldD/splits.txt @@ -239,12 +239,12 @@ f_op/f_op_view.cpp: f_op/f_op_kankyo.cpp: .text start:0x800414A0 end:0x800417A0 .data start:0x8066AB58 end:0x8066ABA0 - .sbss start:0x8074C508 end:0x8074C514 + .sbss start:0x8074C508 end:0x8074C510 f_op/f_op_msg.cpp: .text start:0x800417A0 end:0x80041A50 .data start:0x8066ABA0 end:0x8066ABE8 - .sbss start:0x8074C514 end:0x8074C518 + .sbss start:0x8074C510 end:0x8074C518 f_op/f_op_kankyo_mng.cpp: .text start:0x80041A50 end:0x80041FD0 diff --git a/config/ShieldD/symbols.txt b/config/ShieldD/symbols.txt index 508a7bf04e..232039cea8 100644 --- a/config/ShieldD/symbols.txt +++ b/config/ShieldD/symbols.txt @@ -64102,7 +64102,7 @@ mDoMain_HIO = .sbss:0x8074C280; // type:object size:0x8 scope:global hash:0x5C34 @LOCAL@Debug_console__FUl@console_scroll@1 = .sbss:0x8074C288; // type:object size:0x4 scope:local align:4 data:float hash:0xBF7B851A dhash:0x7086F27F @LOCAL@main01__Fv@frame = .sbss:0x8074C28C; // type:object size:0x4 scope:local data:4byte hash:0xA8D047CF dhash:0x4B63C2BB instance__29JHIComPortManager<9JHICmnMem> = .sbss:0x8074C290; // type:object size:0x4 scope:global data:4byte hash:0x3E85C712 dhash:0x073E21A0 -lbl_8074C298 = .sbss:0x8074C298; // type:object size:0x1 data:byte hash:0xAA4B677C +print_initialized = .sbss:0x8074C298; // type:object size:0x1 data:byte hash:0xAA4B677C lbl_8074C299 = .sbss:0x8074C299; // type:object size:0x1 data:byte hash:0x732354FB lbl_8074C29A = .sbss:0x8074C29A; // type:object size:0x1 data:byte hash:0x192C6F69 lbl_8074C29B = .sbss:0x8074C29B; // type:object size:0x1 data:byte hash:0xD31C3E46 @@ -64255,9 +64255,9 @@ mCaptureScreenLineNum__11fapGm_HIO_c = .sbss:0x8074C490; // type:object size:0x2 lbl_8074C492 = .sbss:0x8074C492; // type:object size:0x1 data:byte hash:0x56EDE2EE dhash:0x36F65A0E lbl_8074C493 = .sbss:0x8074C493; // type:object size:0x1 data:byte hash:0xDA2ADA30 dhash:0x36F65A10 lbl_8074C494 = .sbss:0x8074C494; // type:object size:0x1 data:byte hash:0xA9B59EC0 dhash:0xA12DE4E0 -lbl_8074C498 = .sbss:0x8074C498; // type:object size:0x1 data:byte hash:0xE0AE7E09 dhash:0x4F24BEA1 -lbl_8074C499 = .sbss:0x8074C499; // type:object size:0x1 data:byte hash:0xC93122F6 dhash:0x62D5041E -lbl_8074C49A = .sbss:0x8074C49A; // type:object size:0x1 data:byte hash:0xB66ED925 dhash:0x722717CD +mPriorityMaximum__19print_error_check_c = .sbss:0x8074C498; // type:object size:0x1 data:byte hash:0xE0AE7E09 dhash:0x4F24BEA1 +mPrintDisable__19print_error_check_c = .sbss:0x8074C499; // type:object size:0x1 data:byte hash:0xC93122F6 dhash:0x62D5041E +mThresholdEnable__19print_error_check_c = .sbss:0x8074C49A; // type:object size:0x1 data:byte hash:0xB66ED925 dhash:0x722717CD @LOCAL@check__19print_error_check_cFv@l_name = .sbss:0x8074C4A0; // type:object size:0x8 scope:local hash:0x67D55231 dhash:0x02F8A364 @LOCAL@check__19print_error_check_cFv@l_name@0 = .sbss:0x8074C4A8; // type:object size:0x8 scope:local hash:0xB2729A01 dhash:0x02F8A364 g_fopAc_type = .sbss:0x8074C4B0; // type:object size:0x4 scope:global data:4byte hash:0x79729021 @@ -64280,7 +64280,7 @@ mWaterY__11fopAcM_wt_c = .sbss:0x8074C4F4; // type:object size:0x4 scope:global l_fopOvlpM_overlap = .sbss:0x8074C4F8; // type:object size:0x4 scope:global data:4byte hash:0x0EF2800B l_fopScnRq_IsUsingOfOverlap = .sbss:0x8074C500; // type:object size:0x4 scope:global data:4byte hash:0xB8D9D5AB fopKy_KANKYO_TYPE = .sbss:0x8074C508; // type:object size:0x4 scope:global data:4byte hash:0xBC1E6A2F -lbl_8074C510 = .sbss:0x8074C510; // type:object size:0x1 data:byte hash:0x69766C30 dhash:0xE973ADA6 +MemCheck__6fopMsg = .sbss:0x8074C510; // type:object size:0x1 scope:global data:byte hash:0x69766C30 dhash:0xE973ADA6 fopMsg_MSG_TYPE = .sbss:0x8074C514; // type:object size:0x4 scope:global hash:0xAC9753E4 @LOCAL@fopMsgM_createExpHeap__FUlP7JKRHeap@displayed = .sbss:0x8074C518; // type:object size:0x4 scope:local data:4byte hash:0xA29E9C43 dhash:0xFD9484E8 l_fopDwTg_id = .sbss:0x8074C520; // type:object size:0x4 scope:global data:4byte hash:0xBA0582FD @@ -64625,9 +64625,9 @@ dylPreLoadTime1 = .sbss:0x8074CAB8; // type:object size:0x8 scope:global data:4b resPreLoadTime0 = .sbss:0x8074CAC0; // type:object size:0x8 scope:global data:4byte hash:0xA1124705 resPreLoadTime1 = .sbss:0x8074CAC8; // type:object size:0x8 scope:global data:4byte hash:0xA1124704 g_preLoadHIO = .sbss:0x8074CAD0; // type:object size:0x8 scope:global hash:0x2AE34DF2 -lbl_8074CAD8 = .sbss:0x8074CAD8; // type:object size:0x1 data:byte hash:0x2421530A dhash:0x54C04193 +pauseTimer__9dScnPly_c = .sbss:0x8074CAD8; // type:object size:0x1 data:byte hash:0x2421530A dhash:0x54C04193 lbl_8074CAD9 = .sbss:0x8074CAD9; // type:object size:0x1 data:byte hash:0x16684D2D dhash:0x100CD5B4 -lbl_8074CADA = .sbss:0x8074CADA; // type:object size:0x1 data:byte hash:0xA127BB3C dhash:0x6A3A8CA5 +nextPauseTimer__9dScnPly_c = .sbss:0x8074CADA; // type:object size:0x1 data:byte hash:0xA127BB3C dhash:0x6A3A8CA5 lbl_8074CADB = .sbss:0x8074CADB; // type:object size:0x1 data:byte hash:0x2EF7A134 l_pause = .sbss:0x8074CADC; // type:object size:0x4 scope:global data:4byte hash:0x57FF2104 l_pauseFrame = .sbss:0x8074CAE0; // type:object size:0x4 scope:global align:4 data:float hash:0x378D15B9 diff --git a/configure.py b/configure.py index a749467ee5..22615e3796 100755 --- a/configure.py +++ b/configure.py @@ -514,6 +514,10 @@ Equivalent = config.non_matching # Object should be linked when configured with ALL_GCN = ["GZ2E01", "GZ2P01", "GZ2J01"] +ALL_WII = ["RZDE01_00", "RZDE01_02", "RZDP01", "RZDJ01"] # , "RZDK01"] +ALL_DEMO = ["DZDE01", "DZDP01"] +ALL_SHIELD = ["Shield", "ShieldD"] # , "ShieldP"] +ALL = ALL_GCN + ALL_WII + ALL_SHIELD # Object is only matching for specific versions @@ -598,59 +602,59 @@ config.libs = [ # f_op Object(MatchingFor(ALL_GCN), "f_op/f_op_actor.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_op/f_op_actor_iter.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_actor_tag.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_camera.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_op/f_op_actor_iter.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_op/f_op_actor_tag.cpp"), + Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_camera.cpp"), Object(NonMatching, "f_op/f_op_actor_map.cpp"), Object(MatchingFor(ALL_GCN), "f_op/f_op_actor_mng.cpp"), Object(MatchingFor(ALL_GCN), "f_op/f_op_camera_mng.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_overlap.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_overlap_mng.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_overlap_req.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_scene.cpp"), + Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_overlap.cpp"), + Object(MatchingFor(ALL_GCN, "Shield"), "f_op/f_op_overlap_mng.cpp"), + Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_overlap_req.cpp"), + Object(MatchingFor(ALL_GCN, "Shield"), "f_op/f_op_scene.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_scene_iter.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_scene_mng.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_scene_req.cpp"), - Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_scene_tag.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_view.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_kankyo.cpp"), - Object(MatchingFor(ALL_GCN), "f_op/f_op_msg.cpp"), + Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_scene_mng.cpp"), + Object(MatchingFor(ALL_GCN, "Shield"), "f_op/f_op_scene_req.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_op/f_op_scene_tag.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_op/f_op_view.cpp"), + Object(MatchingFor(ALL_GCN, "ShieldD"), "f_op/f_op_kankyo.cpp"), + Object(MatchingFor(ALL), "f_op/f_op_msg.cpp"), Object(MatchingFor(ALL_GCN), "f_op/f_op_kankyo_mng.cpp"), Object(MatchingFor(ALL_GCN), "f_op/f_op_msg_mng.cpp"), Object(MatchingFor(ALL_GCN), "f_op/f_op_draw_iter.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_op/f_op_draw_tag.cpp"), - Object(MatchingFor(ALL_GCN, "Shield"), "f_op/f_op_scene_pause.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_op/f_op_draw_tag.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_op/f_op_scene_pause.cpp"), # f_pc Object(MatchingFor(ALL_GCN), "f_pc/f_pc_base.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_pc/f_pc_create_iter.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_pc/f_pc_create_iter.cpp"), Object(MatchingFor(ALL_GCN), "f_pc/f_pc_create_req.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_pc/f_pc_create_tag.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_pc/f_pc_creator.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_pc/f_pc_delete_tag.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_pc/f_pc_create_tag.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_pc/f_pc_creator.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_pc/f_pc_delete_tag.cpp"), Object(MatchingFor(ALL_GCN), "f_pc/f_pc_deletor.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_pc/f_pc_draw_priority.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_pc/f_pc_draw_priority.cpp"), Object(MatchingFor(ALL_GCN), "f_pc/f_pc_executor.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "f_pc/f_pc_layer.cpp"), Object(MatchingFor(ALL_GCN, "Shield"), "f_pc/f_pc_leaf.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "f_pc/f_pc_layer_iter.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "f_pc/f_pc_layer_tag.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_pc/f_pc_line.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_pc/f_pc_line.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "f_pc/f_pc_load.cpp"), Object(MatchingFor(ALL_GCN), "f_pc/f_pc_manager.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "f_pc/f_pc_method.cpp"), Object(MatchingFor(ALL_GCN), "f_pc/f_pc_node.cpp"), Object(MatchingFor(ALL_GCN), "f_pc/f_pc_node_req.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "f_pc/f_pc_priority.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_pc/f_pc_profile.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_pc/f_pc_searcher.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_pc/f_pc_profile.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_pc/f_pc_searcher.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "f_pc/f_pc_line_tag.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "f_pc/f_pc_line_iter.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_pc/f_pc_method_iter.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_pc/f_pc_method_iter.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "f_pc/f_pc_method_tag.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_pc/f_pc_pause.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_pc/f_pc_pause.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "f_pc/f_pc_draw.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_pc/f_pc_fstcreate_req.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_pc/f_pc_fstcreate_req.cpp"), Object(MatchingFor(ALL_GCN), "f_pc/f_pc_stdcreate_req.cpp"), Object(MatchingFor("ShieldD"), "f_pc/f_pc_debug_sv.cpp"), ], @@ -672,7 +676,7 @@ config.libs = [ Object(MatchingFor(ALL_GCN, "Shield"), "d/d_bomb.cpp"), # debug weak func order Object(MatchingFor(ALL_GCN), "d/d_lib.cpp"), Object(MatchingFor(ALL_GCN), "d/d_save.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "d/d_save_init.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "d/d_save_init.cpp"), Object(MatchingFor(ALL_GCN), "d/d_jnt_col.cpp"), Object(MatchingFor(ALL_GCN), "d/d_a_obj.cpp"), Object(MatchingFor(ALL_GCN), "d/d_a_itembase_static.cpp"), @@ -704,8 +708,8 @@ config.libs = [ Object(MatchingFor(ALL_GCN, "Shield"), "d/d_vib_pattern.cpp"), Object(MatchingFor(ALL_GCN), "d/d_attention.cpp"), Object(NonMatching, "d/d_bg_parts.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "d/d_bg_pc.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "d/d_att_dist.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "d/d_bg_pc.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "d/d_att_dist.cpp"), Object(MatchingFor(ALL_GCN, "Shield"), "d/d_bg_plc.cpp"), Object(MatchingFor(ALL_GCN), "d/d_bg_s.cpp"), Object(MatchingFor(ALL_GCN), "d/d_bg_s_acch.cpp"), @@ -719,8 +723,8 @@ config.libs = [ Object(MatchingFor(ALL_GCN, "ShieldD"), "d/d_bg_s_sph_chk.cpp"), Object(MatchingFor(ALL_GCN), "d/d_bg_s_spl_grp_chk.cpp"), Object(MatchingFor(ALL_GCN), "d/d_bg_s_poly_pass_chk.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "d/d_bg_s_roof_chk.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "d/d_bg_s_wtr_chk.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "d/d_bg_s_roof_chk.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "d/d_bg_s_wtr_chk.cpp"), Object(MatchingFor(ALL_GCN), "d/d_bg_w.cpp"), Object(MatchingFor(ALL_GCN), "d/d_bg_w_base.cpp"), Object(NonMatching, "d/d_bg_w_deform.cpp"), @@ -870,23 +874,23 @@ config.libs = [ "progress_category": "third_party", "host": True, "objects": [ - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "SSystem/SComponent/c_malloc.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "SSystem/SComponent/c_API.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "SSystem/SComponent/c_API_controller_pad.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "SSystem/SComponent/c_API_graphic.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "SSystem/SComponent/c_malloc.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "SSystem/SComponent/c_API.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "SSystem/SComponent/c_API_controller_pad.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "SSystem/SComponent/c_API_graphic.cpp"), Object(MatchingFor(ALL_GCN), "SSystem/SComponent/c_cc_d.cpp"), Object(MatchingFor(ALL_GCN), "SSystem/SComponent/c_cc_s.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "SSystem/SComponent/c_counter.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "SSystem/SComponent/c_counter.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "SSystem/SComponent/c_list.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "SSystem/SComponent/c_list_iter.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "SSystem/SComponent/c_list_iter.cpp"), Object(MatchingFor(ALL_GCN), "SSystem/SComponent/c_node.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "SSystem/SComponent/c_node_iter.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "SSystem/SComponent/c_tree.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "SSystem/SComponent/c_tree.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "SSystem/SComponent/c_tree_iter.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "SSystem/SComponent/c_phase.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "SSystem/SComponent/c_request.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "SSystem/SComponent/c_tag.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "SSystem/SComponent/c_tag_iter.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "SSystem/SComponent/c_tag.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "SSystem/SComponent/c_tag_iter.cpp"), Object(MatchingFor(ALL_GCN), "SSystem/SComponent/c_xyz.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "SSystem/SComponent/c_sxyz.cpp"), Object(MatchingFor(ALL_GCN), "SSystem/SComponent/c_math.cpp"), # debug weak literal order @@ -960,14 +964,14 @@ config.libs = [ Object(MatchingFor(ALL_GCN), "JSystem/JStage/JSGFog.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "JSystem/JStage/JSGLight.cpp"), Object(MatchingFor(ALL_GCN, "ShieldD"), "JSystem/JStage/JSGObject.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "JSystem/JStage/JSGSystem.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "JSystem/JStage/JSGSystem.cpp"), ], ), JSystemLib( "JStudio", [ Object(MatchingFor(ALL_GCN), "JSystem/JStudio/JStudio/ctb.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "JSystem/JStudio/JStudio/ctb-data.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "JSystem/JStudio/JStudio/ctb-data.cpp"), Object(MatchingFor(ALL_GCN), "JSystem/JStudio/JStudio/functionvalue.cpp"), Object(MatchingFor(ALL_GCN), "JSystem/JStudio/JStudio/fvb.cpp"), Object(MatchingFor(ALL_GCN, "Shield"), "JSystem/JStudio/JStudio/fvb-data.cpp"), @@ -976,7 +980,7 @@ config.libs = [ Object(MatchingFor(ALL_GCN, "Shield"), "JSystem/JStudio/JStudio/jstudio-data.cpp"), Object(MatchingFor(ALL_GCN), "JSystem/JStudio/JStudio/jstudio-math.cpp"), Object(MatchingFor(ALL_GCN), "JSystem/JStudio/JStudio/jstudio-object.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "JSystem/JStudio/JStudio/object-id.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "JSystem/JStudio/JStudio/object-id.cpp"), Object(MatchingFor(ALL_GCN), "JSystem/JStudio/JStudio/stb.cpp"), Object(MatchingFor(ALL_GCN, "Shield"), "JSystem/JStudio/JStudio/stb-data-parse.cpp"), Object(MatchingFor(ALL_GCN), "JSystem/JStudio/JStudio/stb-data.cpp"), @@ -1290,7 +1294,7 @@ config.libs = [ [ Object(MatchingFor(ALL_GCN), "JSystem/JSupport/JSUList.cpp"), Object(MatchingFor(ALL_GCN), "JSystem/JSupport/JSUInputStream.cpp"), - Object(MatchingFor("Shield", "ShieldD"), "JSystem/JSupport/JSUOutputStream.cpp"), + Object(MatchingFor(ALL_SHIELD), "JSystem/JSupport/JSUOutputStream.cpp"), Object(MatchingFor(ALL_GCN), "JSystem/JSupport/JSUMemoryStream.cpp"), Object(MatchingFor(ALL_GCN), "JSystem/JSupport/JSUFileStream.cpp"), ], @@ -1334,7 +1338,7 @@ config.libs = [ Object(MatchingFor(ALL_GCN), "JSystem/JUtility/JUTProcBar.cpp"), Object(MatchingFor(ALL_GCN), "JSystem/JUtility/JUTConsole.cpp"), Object(MatchingFor(ALL_GCN), "JSystem/JUtility/JUTDirectFile.cpp"), - Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "JSystem/JUtility/JUTFontData_Ascfont_fix12.cpp"), + Object(MatchingFor(ALL_GCN, ALL_SHIELD), "JSystem/JUtility/JUTFontData_Ascfont_fix12.cpp"), Object(NonMatching, "JSystem/JUtility/JUTFontData_Ascfont_fix16.cpp"), ], ), @@ -2096,7 +2100,7 @@ config.libs = [ ), ], }, - Rel("f_pc_profile_lst", [Object(MatchingFor(ALL_GCN, "Shield", "ShieldD"), "f_pc/f_pc_profile_lst.cpp")]), + Rel("f_pc_profile_lst", [Object(MatchingFor(ALL_GCN, ALL_SHIELD), "f_pc/f_pc_profile_lst.cpp")]), ActorRel(MatchingFor(ALL_GCN), "d_a_andsw"), ActorRel(MatchingFor(ALL_GCN), "d_a_bg"), ActorRel(MatchingFor(ALL_GCN), "d_a_bg_obj"), diff --git a/include/d/actor/d_a_itembase.h b/include/d/actor/d_a_itembase.h index ac463a42fa..ccac214e45 100644 --- a/include/d/actor/d_a_itembase.h +++ b/include/d/actor/d_a_itembase.h @@ -5,6 +5,7 @@ #include "d/d_cc_d.h" #include "d/d_a_itembase_static.h" #include "f_op/f_op_actor_mng.h" +#include "m_Do/m_Do_ext.h" struct daItemBase_data { /* 0x00 */ f32 mGravity; diff --git a/include/d/actor/d_a_obj_carry.h b/include/d/actor/d_a_obj_carry.h index aa1db0f645..0581dda831 100644 --- a/include/d/actor/d_a_obj_carry.h +++ b/include/d/actor/d_a_obj_carry.h @@ -294,9 +294,10 @@ public: return mCannon; } - static void make_prm(u32* o_params, csXyz* o_paramsEx, u8 param_2, u8 i_itemNo, u8 i_itemBit, u8 i_itemType, u8 param_6) { - o_paramsEx->x = (i_itemBit << 8) | (i_itemNo & 0xFF); - o_paramsEx->z = (param_6 << 13) | (param_2 << 1) | i_itemType; + static u32* make_prm(u32* o_params, csXyz* o_paramsEx, u8 param_2, u8 i_itemNo, u8 i_itemBit, u8 i_itemType, u8 param_6) { + o_paramsEx->x = (i_itemBit << 8) | i_itemNo; + o_paramsEx->z = i_itemType | ((param_6 << 13) | (param_2 << 1)); + return o_params; } static void make_prm_bokkuri(u32* o_params, csXyz* o_paramsEx, u8 i_itemNo, u8 i_itemBit, u8 i_itemType, u8 param_5) { diff --git a/include/d/actor/d_a_tag_stream.h b/include/d/actor/d_a_tag_stream.h index 6405de3412..6988320281 100644 --- a/include/d/actor/d_a_tag_stream.h +++ b/include/d/actor/d_a_tag_stream.h @@ -17,15 +17,15 @@ public: return mNext; } - u8 checkStreamOn() { + u8 checkStreamOn() const { return mStreamOn; } - s32 checkCanoeOn() { + s32 checkCanoeOn() const { return mParameters; } - u8 getPower() { + u8 getPower() const { return mPower; } diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index c4e922971e..de93f6d793 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -3622,7 +3622,7 @@ inline int dComIfGp_event_order(u16 i_type, u16 i_prio, u16 i_flags, u16 i_hindF i_targetActor, i_eventID, i_mapToolId); } -inline void dComIfGp_event_setGtItm(int i_itemNo) { +inline void dComIfGp_event_setGtItm(u8 i_itemNo) { g_dComIfG_gameInfo.play.getEvent()->setGtItm(i_itemNo); } diff --git a/include/d/d_event.h b/include/d/d_event.h index adc09de53d..7b60d37bae 100644 --- a/include/d/d_event.h +++ b/include/d/d_event.h @@ -150,7 +150,13 @@ public: #endif } - BOOL isOrderOK() { return mEventStatus == 0 || mEventStatus == 2; } + BOOL isOrderOK() { +#if DEBUG + return (mEventStatus == 0 || mEventStatus == 2) && !mDebugStb; +#else + return mEventStatus == 0 || mEventStatus == 2; +#endif + } fopAc_ac_c* getPt1() { return convPId(mPt1); } fopAc_ac_c* getPt2() { return convPId(mPt2); } diff --git a/include/d/d_item.h b/include/d/d_item.h index e9dee1c010..14425c4d60 100644 --- a/include/d/d_item.h +++ b/include/d/d_item.h @@ -6,6 +6,7 @@ class dEnemyItem_c { public: static void setItemData(u8* data) { mData = data; } + static u8* getItemData() { return mData; } static u8* mData; }; diff --git a/include/d/d_particle.h b/include/d/d_particle.h index ed9bac9b2d..dd90e5735a 100644 --- a/include/d/d_particle.h +++ b/include/d/d_particle.h @@ -499,6 +499,9 @@ private: /* 0x01A */ u8 field_0x1a; /* 0x01B */ u8 field_0x1b; /* 0x01C */ dPa_simpleEcallBack field_0x1c[25]; + #if DEBUG + u8 unk_0x210[0x1CC]; + #endif /* 0x210 */ level_c field_0x210; #if DEBUG u8 mSceneCount; diff --git a/include/d/d_s_play.h b/include/d/d_s_play.h index 8c2c03c615..5736f0838c 100644 --- a/include/d/d_s_play.h +++ b/include/d/d_s_play.h @@ -68,7 +68,11 @@ public: bool resetGame(); void offReset(); - static bool isPause() { return pauseTimer == 0; } + #if VERSION == VERSION_SHIELD_DEBUG + static s8 isPause() { return pauseTimer | nextPauseTimer; } + #else + static s8 isPause() { return pauseTimer; } + #endif static void setPauseTimer(s8 time) { nextPauseTimer = time; } static s8 pauseTimer; diff --git a/include/d/d_stage.h b/include/d/d_stage.h index 2838afa6a7..d3a2f9c114 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -1133,7 +1133,10 @@ public: static void setProcID(u32 id) { mProcID = id; } static u32 getProcID() { return mProcID; } static void setStatusProcID(int i_roomNo, fpc_ProcID i_id) { mStatus[i_roomNo].mProcID = i_id; } - static int getStatusProcID(int i_roomNo) { return mStatus[i_roomNo].mProcID; } + static int getStatusProcID(int i_roomNo) { + JUT_ASSERT(2774, 0 <= i_roomNo && i_roomNo < 64); + return mStatus[i_roomNo].mProcID; + } static void setRegionNo(int i_roomNo, u8 i_regionNo) { mStatus[i_roomNo].mRegionNo = i_regionNo; } u8 checkStatusFlag(int i_roomNo, u8 flag) const { diff --git a/include/f_op/f_op_actor.h b/include/f_op/f_op_actor.h index aa54f8c180..99fcc87535 100644 --- a/include/f_op/f_op_actor.h +++ b/include/f_op/f_op_actor.h @@ -278,6 +278,7 @@ public: fopAc_ac_c(); ~fopAc_ac_c(); + static u32 getStopStatus() { return stopStatus; } static void setStopStatus(u32 status) { stopStatus = status; } static u32 stopStatus; diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index a6b3f1d677..bc02df41ac 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -76,6 +76,8 @@ struct fopAcM_search4ev_prm { }; struct fopAcM_search_prm { + fopAcM_search_prm() {}; + /* 0x00 */ u32 prm0; /* 0x04 */ u32 prm1; /* 0x08 */ s16 procname; @@ -480,15 +482,14 @@ inline f32 fopAcM_searchActorDistanceY(const fopAc_ac_c* actorA, const fopAc_ac_ return actorB->current.pos.y - actorA->current.pos.y; } -inline u16 fopAcM_GetSetId(const fopAc_ac_c* i_actor) { +inline int fopAcM_GetSetId(const fopAc_ac_c* i_actor) { return i_actor->setID; } inline void dComIfGs_onActor(int bitNo, int roomNo); inline void fopAcM_onActor(const fopAc_ac_c* i_actor) { - int setId = fopAcM_GetSetId(i_actor); - dComIfGs_onActor(setId, fopAcM_GetHomeRoomNo(i_actor)); + dComIfGs_onActor(fopAcM_GetSetId(i_actor), fopAcM_GetHomeRoomNo(i_actor)); } inline void fopAcM_onDraw(fopAc_ac_c* i_actor) { @@ -781,7 +782,7 @@ inline void fopAcM_seStartCurrentLevel(const fopAc_ac_c* actor, u32 sfxID, u32 p dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); } -inline void fopAcM_offActor(fopAc_ac_c* i_actor, u32 flag) { +inline void fopAcM_offActor(const fopAc_ac_c* i_actor, int flag) { dComIfGs_offActor(flag, fopAcM_GetHomeRoomNo(i_actor)); } @@ -853,7 +854,10 @@ public: static cXyz* getCrossP() { return mLineCheck.GetCrossP(); } static cXyz& getCross() { return mLineCheck.GetCross(); } static bool lineCheck(const cXyz*, const cXyz*, const fopAc_ac_c*); - static bool getTriPla(cM3dGPla* o_tri) { return dComIfG_Bgsp().GetTriPla(mLineCheck, o_tri); } + static bool dummyCheck(cM3dGPla* i_plane); + static bool getTriPla(cM3dGPla* i_plane) { + return dComIfG_Bgsp().GetTriPla(mLineCheck, i_plane); + }; static s32 getWallCode() { return dComIfG_Bgsp().GetWallCode(mLineCheck); } static bool checkWallHit() { cM3dGPla poly; diff --git a/include/f_op/f_op_actor_tag.h b/include/f_op/f_op_actor_tag.h index dbda5276a0..a354178a8b 100644 --- a/include/f_op/f_op_actor_tag.h +++ b/include/f_op/f_op_actor_tag.h @@ -3,7 +3,7 @@ #include "SSystem/SComponent/c_tag.h" -int fopAcTg_ActorQTo(create_tag_class* i_createTag); +void fopAcTg_ActorQTo(create_tag_class* i_createTag); int fopAcTg_Init(create_tag_class* i_createTag, void* i_data); int fopAcTg_ToActorQ(create_tag_class* i_createTag); diff --git a/include/f_op/f_op_camera_mng.h b/include/f_op/f_op_camera_mng.h index 4aa5f05d01..c722784386 100644 --- a/include/f_op/f_op_camera_mng.h +++ b/include/f_op/f_op_camera_mng.h @@ -1,9 +1,8 @@ #ifndef F_F_OP_CAMERA_MNG_H_ #define F_F_OP_CAMERA_MNG_H_ -#include "SSystem/SComponent/c_phase.h" -#include "d/d_camera.h" #include "f_op/f_op_view.h" +#include "d/d_camera.h" typedef struct leafdraw_method_class leafdraw_method_class; diff --git a/include/f_op/f_op_kankyo.h b/include/f_op/f_op_kankyo.h index 4d7dd8e6aa..9d2b3b87eb 100644 --- a/include/f_op/f_op_kankyo.h +++ b/include/f_op/f_op_kankyo.h @@ -19,6 +19,8 @@ struct kankyo_process_profile_definition { /* 0x24 */ leafdraw_method_class* sub_method; }; // Size: 0x28 +void fopKy_IsKankyo(void* i_this); + extern leafdraw_method_class g_fopKy_Method; #endif /* F_OP_F_OP_KANKYO_H */ diff --git a/include/f_op/f_op_scene_mng.h b/include/f_op/f_op_scene_mng.h index c4ada01812..996a3b6d6e 100644 --- a/include/f_op/f_op_scene_mng.h +++ b/include/f_op/f_op_scene_mng.h @@ -1,6 +1,7 @@ #ifndef F_F_OP_SCENE_MNG_H_ #define F_F_OP_SCENE_MNG_H_ +#include "f_op/f_op_scene_pause.h" #include "f_pc/f_pc_manager.h" #include "f_op/f_op_scene.h" @@ -15,9 +16,10 @@ void fopScnM_Management(); void fopScnM_Init(); inline fpc_ProcID fpcM_LayerID(const void* i_process) { - return fpcBs_Is_JustOfType(g_fpcNd_type, ((base_process_class*)i_process)->subtype) != FALSE ? - ((scene_class*)i_process)->base.layer.layer_id : - fpcM_ERROR_PROCESS_ID_e; + if (fpcBs_Is_JustOfType(g_fpcNd_type, ((base_process_class*)i_process)->subtype) != FALSE) { + return ((scene_class*)i_process)->base.layer.layer_id; + } + return fpcM_ERROR_PROCESS_ID_e; } inline fpc_ProcID fopScnM_GetID(void* i_scene) { @@ -32,4 +34,20 @@ inline u32 fopScnM_GetParam(void* i_scene) { return fpcM_GetParam(i_scene); } +inline void fopScnM_SetParam(void* i_scene, u32 i_param) { + fpcM_SetParam(i_scene, i_param); +} + +inline void* fopScnM_GetAppend(void* i_scene) { + return fpcM_GetAppend(i_scene); +} + +inline int fopScnM_PauseEnable(scene_class* i_scene) { + return fopScnPause_Enable(i_scene); +} + +inline int fopScnM_PauseDisable(scene_class* i_scene) { + return fopScnPause_Disable(i_scene); +} + #endif diff --git a/include/f_op/f_op_scene_req.h b/include/f_op/f_op_scene_req.h index 283e000eae..c9d68d3bdd 100644 --- a/include/f_op/f_op_scene_req.h +++ b/include/f_op/f_op_scene_req.h @@ -15,6 +15,6 @@ public: fpc_ProcID fopScnRq_Request(int i_reqType, scene_class* i_scene, s16 i_procName, void* i_data, s16 param_5, u16 param_6); s32 fopScnRq_ReRequest(fpc_ProcID i_requestId, s16 i_procName, void* i_data); -void fopScnRq_Handler(); +int fopScnRq_Handler(); #endif diff --git a/include/f_pc/f_pc_manager.h b/include/f_pc/f_pc_manager.h index 2150558827..f2399a39b6 100644 --- a/include/f_pc/f_pc_manager.h +++ b/include/f_pc/f_pc_manager.h @@ -1,6 +1,7 @@ #ifndef F_PC_MANAGER_H_ #define F_PC_MANAGER_H_ +#include "f_op/f_op_scene.h" #include "f_pc/f_pc_create_iter.h" #include "f_pc/f_pc_executor.h" #include "f_pc/f_pc_leaf.h" @@ -41,7 +42,7 @@ inline fpc_ProcID fpcM_Create(s16 i_procName, FastCreateReqFunc i_createFunc, vo i_append); } -inline s16 fpcM_DrawPriority(const void* i_process) { +inline s32 fpcM_DrawPriority(const void* i_process) { return (s16)fpcLf_GetPriority((const leafdraw_class*)i_process); } @@ -49,6 +50,10 @@ inline s32 fpcM_ChangeLayerID(void* i_process, int i_layerID) { return fpcPi_Change(&((base_process_class*)i_process)->priority, i_layerID, 0xFFFD, 0xFFFD); } +inline s32 fpcM_MakeOfType(int* i_type) { + return fpcBs_MakeOfType(i_type); +} + inline BOOL fpcM_IsJustType(int i_typeA, int i_typeB) { return fpcBs_Is_JustOfType(i_typeA, i_typeB); } @@ -85,6 +90,10 @@ inline base_process_class* fpcM_SearchByID(fpc_ProcID i_id) { return fpcEx_SearchByID(i_id); } +inline process_node_class* fpcM_Layer(void* i_process) { + return ((base_process_class*)i_process)->layer_tag.layer->process_node; +} + void fpcM_Draw(void* i_process); s32 fpcM_DrawIterater(fpcM_DrawIteraterFunc i_drawIterFunc); s32 fpcM_Execute(void* i_process); diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index 73556c5075..e2aa21e811 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -21,6 +21,7 @@ namespace mDoExt { }; #if DEBUG +void DummyCheckHeap_init(); void DummyCheckHeap_create(); void DummyCheckHeap_destroy(); #endif @@ -750,6 +751,7 @@ inline void mDoExt_bckAnmRemove(J3DModelData* i_modelData) { i_modelData->getJointNodePointer(0)->setMtxCalc(NULL); } +static JKRSolidHeap* mDoExt_createSolidHeap(u32 i_size, JKRHeap* i_parent, u32 i_alignment); JKRSolidHeap* mDoExt_createSolidHeapFromGame(u32 i_size, u32 i_alignment); void mDoExt_destroySolidHeap(JKRSolidHeap* i_heap); u32 mDoExt_adjustSolidHeap(JKRSolidHeap* i_heap); diff --git a/include/m_Do/m_Do_hostIO.h b/include/m_Do/m_Do_hostIO.h index 761db651c3..e432c736ad 100644 --- a/include/m_Do/m_Do_hostIO.h +++ b/include/m_Do/m_Do_hostIO.h @@ -71,6 +71,7 @@ public: extern mDoHIO_root_c mDoHIO_root; void mDoHIO_updateChild(s8 i_no); +void mDoHIO_update(); void mDoHIO_deleteChild(s8 i_no); inline s8 mDoHIO_createChild(const char* i_name, JORReflexible* i_node) { return mDoHIO_root.createChild(i_name, i_node); diff --git a/src/Z2AudioLib/Z2StatusMgr.cpp b/src/Z2AudioLib/Z2StatusMgr.cpp index 619055090f..c86b86eee3 100644 --- a/src/Z2AudioLib/Z2StatusMgr.cpp +++ b/src/Z2AudioLib/Z2StatusMgr.cpp @@ -114,7 +114,7 @@ void Z2StatusMgr::heartGaugeOn() { void Z2StatusMgr::processHeartGaugeSound() { if (!dComIfGp_event_runCheck() && mHeartGaugeOn != 0) { - if (dScnPly_c::isPause()) { + if (!dScnPly_c::isPause()) { mHeartGaugeOn--; } diff --git a/src/d/actor/d_a_obj_stone.cpp b/src/d/actor/d_a_obj_stone.cpp index bea118ce80..488436c5ee 100644 --- a/src/d/actor/d_a_obj_stone.cpp +++ b/src/d/actor/d_a_obj_stone.cpp @@ -991,8 +991,7 @@ int daObjStone_c::draw() { int daObjStone_c::_delete() { mSound.deleteObject(); - u16 setid = fopAcM_GetSetId(this); - fopAcM_offActor(this, setid); + fopAcM_offActor(this, fopAcM_GetSetId(this)); effect_delete(true); dComIfG_resDelete(&mPhase, l_arcName[mStoneType]); return 1; diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index 894c0507f7..9fca792bc5 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -4391,7 +4391,7 @@ bool dCamera_c::lockonCamera(s32 param_0) { v.Val(lockon->field_0x34.V() + ang5 * 0.05f); } else { r = lockon->field_0x34.R(); - r = r + ((fVar44a - r) * lockon->field_0x54 * fabsf(ang5.Cos())); + r = r + (fVar44a - r) * lockon->field_0x54 * fabsf(ang5.Cos()); u.Val(lockon->field_0x34.U() + (ang4 - lockon->field_0x34.U()) * lockon->field_0x58); v.Val(lockon->field_0x34.V() + ang5 * lockon->field_0x58); } @@ -4443,9 +4443,9 @@ bool dCamera_c::lockonCamera(s32 param_0) { bool bVar3 = false; f32 fVar31; - if (std::fabsf(fVar47) > 0.05f) { + if (fabsf(fVar47) > 0.05f) { cSAngle ang = globe2.U() + cSAngle(dCamMath::rationalBezierRatio(fVar47, 0.5f) * 7.5f); - fVar31 = std::fabsf(fVar47) - 0.05f; + fVar31 = fabsf(fVar47) - 0.05f; lockon->field_0x42 = ang; lockon->field_0x4c = 0.0f; bVar3 = true; diff --git a/src/d/d_debug_camera.cpp b/src/d/d_debug_camera.cpp index 2d54283bf1..d80eb3202b 100644 --- a/src/d/d_debug_camera.cpp +++ b/src/d/d_debug_camera.cpp @@ -557,6 +557,8 @@ int dDbgCamera_c::moveTool() { field_0x44.Val(*sp30 - *var_r28); switch (field_0xc00) { + f32 temp_f26; + f32 temp_f1_2; case 2: *var_r28 = *var_r28 + (field_0x44.Norm() * mCamSetup.Turbo(field_0xc10 * var_f30)); @@ -571,8 +573,8 @@ int dDbgCamera_c::moveTool() { *var_r28 = *var_r28 - (field_0x44.Norm() * mCamSetup.Translate(field_0xc10 * var_f30)); break; case 3: { - f32 temp_f26 = fabsf(substick_x); - f32 temp_f1_2 = fabsf(substick_y); + temp_f26 = fabsf(substick_x); + temp_f1_2 = fabsf(substick_y); if (field_0xc0c == 0 || temp_f26 < temp_f1_2) { cXyz sp1B0(0.0f, 1.0f, 0.0f); diff --git a/src/d/d_particle.cpp b/src/d/d_particle.cpp index c28ef4be0c..f4c164ef29 100644 --- a/src/d/d_particle.cpp +++ b/src/d/d_particle.cpp @@ -1218,7 +1218,7 @@ bool dPa_control_c::readScene(u8 param_0, mDoDvdThd_toMainRam_c** param_1) { if (m_sceneRes) { JUT_ASSERT(2641, !(--mSceneCount)); - JKRHeap::free(m_sceneRes, NULL); + JKRFree(m_sceneRes); m_sceneRes = NULL; } JUT_ASSERT(2647, !mSceneCount++); diff --git a/src/f_op/f_op_actor.cpp b/src/f_op/f_op_actor.cpp index 7ad3bae85e..2a0d52a768 100644 --- a/src/f_op/f_op_actor.cpp +++ b/src/f_op/f_op_actor.cpp @@ -6,8 +6,8 @@ #include "d/dolzel.h" // IWYU pragma: keep #include "d/actor/d_a_alink.h" +#include "d/actor/d_a_suspend.h" #include "d/d_com_inf_actor.h" -#include "d/d_com_static.h" #include "d/d_demo.h" #include "d/d_s_play.h" #include "f_ap/f_ap_game.h" @@ -242,7 +242,7 @@ static int fopAc_Draw(void* i_this) { if (!dComIfGp_isPauseFlag()) { int var_r28 = dComIfGp_event_moveApproval(actor); - if ((var_r28 == 2 || (!fopAcM_CheckStatus(actor, fopAc_ac_c::stopStatus) && + if ((var_r28 == 2 || (!fopAcM_CheckStatus(actor, fopAc_ac_c::getStopStatus()) && (!fopAcM_CheckStatus(actor, fopAcStts_CULL_e) || !fopAcM_cullingCheck(actor)))) && !fopAcM_CheckStatus(actor, 0x21000000)) { @@ -315,54 +315,52 @@ static int fopAc_Execute(void* i_this) { JUT_ASSERT(685, -1.0e32f < actor->current.pos.x && actor->current.pos.x < 1.0e32f && -1.0e32f < actor->current.pos.y && actor->current.pos.y < 1.0e32f && -1.0e32f < actor->current.pos.z && actor->current.pos.z < 1.0e32f); #endif - if (!dComIfGp_isPauseFlag() && dScnPly_c::isPause()) { - if (!dComIfA_PauseCheck()) { - daSus_c::check(actor); - actor->eventInfo.beforeProc(); - s32 move = dComIfGp_event_moveApproval(i_this); - fopAcM_OffStatus(actor, 0x40000000); + if (!dComIfGp_isPauseFlag() && !dScnPly_c::isPause() && !dComIfA_PauseCheck()) { + daSus_c::check(actor); + actor->eventInfo.beforeProc(); + s32 move = dComIfGp_event_moveApproval(actor); + fopAcM_OffStatus(actor, 0x40000000); - if (!fopAcM_CheckStatus(actor, 0x20000000) && - (move == 2 || - (move != 0 && !fopAcM_CheckStatus(actor, fopAc_ac_c::stopStatus) && - (!fopAcM_CheckStatus(actor, fopAcStts_NOEXEC_e) || !fopAcM_CheckCondition(actor, fopAcCnd_NODRAW_e))))) + if (!fopAcM_CheckStatus(actor, 0x20000000) && + (move == 2 || + (move != 0 && !fopAcM_CheckStatus(actor, fopAc_ac_c::getStopStatus()) && + (!fopAcM_CheckStatus(actor, fopAcStts_NOEXEC_e) || !fopAcM_CheckCondition(actor, fopAcCnd_NODRAW_e))))) + { + fopAcM_OffCondition(actor, fopAcCnd_NOEXEC_e); + actor->old = actor->current; + + #if DEBUG { - fopAcM_OffCondition(actor, fopAcCnd_NOEXEC_e); - actor->old = actor->current; + print_error_check_c error_check(actor, print_error_check_c::sEXECUTE); + #endif - #if DEBUG - { - print_error_check_c error_check(actor, print_error_check_c::sEXECUTE); - #endif + ret = fpcMtd_Execute((process_method_class*)actor->sub_method, actor); - ret = fpcMtd_Execute((process_method_class*)actor->sub_method, actor); - - #if DEBUG - } - #endif - } else { - actor->eventInfo.suspendProc(actor); - fopAcM_OnCondition(actor, fopAcCnd_NOEXEC_e); + #if DEBUG } - - if (fopAcM_CheckStatus(actor, 0x20) && - actor->home.pos.y - actor->current.pos.y > 5000.0f) - { - fopAcM_delete(actor); - } - - JUT_ASSERT(750, !isnan(actor->current.pos.x)); - JUT_ASSERT(751, !isnan(actor->current.pos.y)); - JUT_ASSERT(752, !isnan(actor->current.pos.z)); - - if (actor->current.pos.y < -1e31f) { - actor->current.pos.y = -1e31f; - } - - JUT_ASSERT(762, -1.0e32f < actor->current.pos.x && actor->current.pos.x < 1.0e32f && -1.0e32f < actor->current.pos.y && actor->current.pos.y < 1.0e32f && -1.0e32f < actor->current.pos.z && actor->current.pos.z < 1.0e32f); - - dKy_depth_dist_set(actor); + #endif + } else { + actor->eventInfo.suspendProc(actor); + fopAcM_OnCondition(actor, fopAcCnd_NOEXEC_e); } + + if (fopAcM_CheckStatus(actor, 0x20) && + actor->home.pos.y - actor->current.pos.y > 5000.0f) + { + fopAcM_delete(actor); + } + + JUT_ASSERT(750, !isnan(actor->current.pos.x)); + JUT_ASSERT(751, !isnan(actor->current.pos.y)); + JUT_ASSERT(752, !isnan(actor->current.pos.z)); + + if (actor->current.pos.y < -1e31f) { + actor->current.pos.y = -1e31f; + } + + JUT_ASSERT(762, -1.0e32f < actor->current.pos.x && actor->current.pos.x < 1.0e32f && -1.0e32f < actor->current.pos.y && actor->current.pos.y < 1.0e32f && -1.0e32f < actor->current.pos.z && actor->current.pos.z < 1.0e32f); + + dKy_depth_dist_set(actor); } #if DEBUG @@ -400,7 +398,7 @@ static int fopAc_IsDelete(void* i_this) { static int fopAc_Delete(void* i_this) { fopAc_ac_c* actor = (fopAc_ac_c*)i_this; - int ret; + int ret = FALSE; #if DEBUG { @@ -416,7 +414,7 @@ static int fopAc_Delete(void* i_this) { if (ret == TRUE) { fopAcTg_ActorQTo(&actor->actor_tag); fopDwTg_DrawQTo(&actor->draw_tag); - fopAcM_DeleteHeap(actor); + fopAcM_DeleteHeap((fopAc_ac_c*) i_this); dDemo_actor_c* demoAc = dDemo_c::getActor(actor->demoActorID); if (demoAc != NULL) { @@ -442,7 +440,7 @@ static int fopAc_Create(void* i_this) { if (fpcM_IsFirstCreating(i_this)) { actor_process_profile_definition* profile = (actor_process_profile_definition*)fpcM_GetProfile(i_this); - actor->actor_type = fpcBs_MakeOfType(&g_fopAc_type); + actor->actor_type = fpcM_MakeOfType(&g_fopAc_type); actor->sub_method = (profile_method_class*)profile->sub_method; fopAcTg_Init(&actor->actor_tag, actor); @@ -506,8 +504,9 @@ static int fopAc_Create(void* i_this) { } if (filelist != NULL) { + u8 sw; if (!dStage_FileList_dt_GetEnemyAppear1Flag(filelist)) { - u8 sw = dStage_FileList_dt_GetBitSw(filelist); + sw = dStage_FileList_dt_GetBitSw(filelist); if (sw != 0xFF && dComIfGs_isSwitch(sw, actor->home.roomNo) && profile->group == fopAc_ENEMY_e) { @@ -515,7 +514,7 @@ static int fopAc_Create(void* i_this) { return cPhs_ERROR_e; } } else { - u8 sw = dStage_FileList_dt_GetBitSw(filelist); + sw = dStage_FileList_dt_GetBitSw(filelist); if (sw != 0xFF && !dComIfGs_isSwitch(sw, actor->home.roomNo) && profile->group == fopAc_ENEMY_e) { diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index 3d10b12fdc..e3e33f7ba0 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -16,10 +16,12 @@ #include "d/actor/d_a_tag_stream.h" #include "d/d_item.h" #include "d/d_path.h" +#include "d/d_s_play.h" #include "f_op/f_op_actor_mng.h" #include "f_op/f_op_camera_mng.h" #include "f_op/f_op_scene_mng.h" #include "m_Do/m_Do_lib.h" +#include #define MAKE_ITEM_PARAMS(itemNo, itemBitNo, param_2, param_3) \ ((itemNo & 0xFF) << 0 | (itemBitNo & 0xFF) << 0x8 | param_2 << 0x10 | (param_3 & 0xF) << 0x18) @@ -107,7 +109,7 @@ fopAc_ac_c* fopAcM_FastCreate(s16 i_procName, FastCreateReqFunc i_createFunc, vo void fopAcM_setStageLayer(void* i_proc) { scene_class* stageProc = fopScnM_SearchByID(dStage_roomControl_c::getProcID()); - JUT_ASSERT(0, stageProc != NULL); + JUT_ASSERT(367, stageProc != NULL); fpcM_ChangeLayerID(i_proc, fopScnM_LayerID(stageProc)); } @@ -115,7 +117,7 @@ void fopAcM_setStageLayer(void* i_proc) { void fopAcM_setRoomLayer(void* i_proc, int i_roomNo) { if (i_roomNo >= 0) { scene_class* roomProc = fopScnM_SearchByID(dStage_roomControl_c::getStatusProcID(i_roomNo)); - JUT_ASSERT(0, roomProc != NULL); + JUT_ASSERT(390, roomProc != NULL); fpcM_ChangeLayerID(i_proc, fopScnM_LayerID(roomProc)); } @@ -283,13 +285,13 @@ fpc_ProcID fopAcM_createChildFromOffset(s16 i_procName, fpc_ProcID i_parentID, u s16 parent_angleY = parent_actor->current.angle.y; cXyz offset_pos; + csXyz offset_angle; if (i_pos == NULL) { offset_pos = cXyz::Zero; } else { offset_pos = *i_pos; } - csXyz offset_angle; if (i_angle == NULL) { offset_angle = csXyz::Zero; } else { @@ -354,10 +356,31 @@ u8 fopAcM::HeapAdjustVerbose; u8 fopAcM::HeapAdjustQuiet; u8 fopAcM::HeapDummyCreate; +static bool lbl_8074C4DC; +static bool lbl_8074C4DD; + +struct DummyCheckHeap { + static JKRHeap* getHeap(); + + /* 0x0 */ JKRHeap* dummyHeap; +}; + +static DummyCheckHeap* dch; + bool fopAcM_entrySolidHeap_(fopAc_ac_c* i_actor, heapCallbackFunc i_heapCallback, u32 i_size) { const char* procNameString = fopAcM_getProcNameString(i_actor); JKRSolidHeap* heap00 = NULL; +#if DEBUG + if (lbl_8074C4DC != 0 && lbl_8074C4DD != 0 && dch != NULL) { + JKRHeap* dummy_heap = dch->getHeap(); + if (dummy_heap != NULL) { + JKRSolidHeap* heap = mDoExt_createSolidHeap(-1, dummy_heap, 0x20); + JUT_ASSERT(1211, heap); + } + } +#endif + if (fopAcM::HeapAdjustVerbose) { OS_REPORT("\x1b[36mfopAcM_entrySolidHeap 開始 [%s] 見積もりサイズ=%08x\n\x1b[m", procNameString, i_size); @@ -521,29 +544,33 @@ void fopAcM_setCullSizeSphere(fopAc_ac_c* i_actor, f32 i_minX, f32 i_minY, f32 i void fopAcM_setCullSizeBox2(fopAc_ac_c* i_actor, J3DModelData* i_modelData) { J3DJoint* jointNode = i_modelData->getJointNodePointer(0); - - f32 minX = i_actor->scale.x * jointNode->getMin()->x; - f32 minY = i_actor->scale.y * jointNode->getMin()->y; - f32 minZ = i_actor->scale.z * jointNode->getMin()->z; - f32 maxX = i_actor->scale.x * jointNode->getMax()->x; - f32 maxY = i_actor->scale.y * jointNode->getMax()->y; - f32 maxZ = i_actor->scale.z * jointNode->getMax()->z; - - fopAcM_setCullSizeBox(i_actor, minX, minY, minZ, maxX, maxY, maxZ); + fopAcM_setCullSizeBox(i_actor, + i_actor->scale.x * jointNode->getMin()->x, + i_actor->scale.y * jointNode->getMin()->y, + i_actor->scale.z * jointNode->getMin()->z, + i_actor->scale.x * jointNode->getMax()->x, + i_actor->scale.y * jointNode->getMax()->y, + i_actor->scale.z * jointNode->getMax()->z); } bool fopAcM_addAngleY(fopAc_ac_c* i_actor, s16 i_target, s16 i_step) { - return cLib_chaseAngleS(&fopAcM_GetAngle_p(i_actor)->y, i_target, i_step); + csXyz* angle = fopAcM_GetAngle_p(i_actor); + return cLib_chaseAngleS(&angle->y, i_target, i_step); +} + +void dummy(fopAc_ac_c* i_actor) { + fopAcM_SetSpeedF(i_actor, 10.0f); } void fopAcM_calcSpeed(fopAc_ac_c* i_actor) { + f32 xSpeed, ySpeed, zSpeed; f32 speedF = fopAcM_GetSpeedF(i_actor); f32 gravity = fopAcM_GetGravity(i_actor); cXyz* speed = fopAcM_GetSpeed_p(i_actor); - f32 xSpeed = speedF * cM_ssin(i_actor->current.angle.y); - f32 ySpeed = speed->y + gravity; - f32 zSpeed = speedF * cM_scos(i_actor->current.angle.y); + xSpeed = speedF * cM_ssin(i_actor->current.angle.y); + ySpeed = speed->y + gravity; + zSpeed = speedF * cM_scos(i_actor->current.angle.y); if (ySpeed < fopAcM_GetMaxFallSpeed(i_actor)) { ySpeed = fopAcM_GetMaxFallSpeed(i_actor); @@ -580,13 +607,14 @@ s16 fopAcM_searchActorAngleX(const fopAc_ac_c* i_actorA, const fopAc_ac_c* i_act f32 x_dist = posB->x - posA->x; f32 z_dist = posB->z - posA->z; - return cM_atan2s(posB->y - posA->y, JMAFastSqrt(x_dist * x_dist + z_dist * z_dist)); + f32 dist = JMAFastSqrt(x_dist * x_dist + z_dist * z_dist); + return cM_atan2s(posB->y - posA->y, dist); } s32 fopAcM_seenActorAngleY(const fopAc_ac_c* i_actorA, const fopAc_ac_c* i_actorB) { - s16 target_angle = - cLib_targetAngleY(fopAcM_GetPosition_p(i_actorA), fopAcM_GetPosition_p(i_actorB)); - return abs((s16)(target_angle - i_actorA->shape_angle.y)); + s16 target_angle = cLib_targetAngleY(fopAcM_GetPosition_p(i_actorA), fopAcM_GetPosition_p(i_actorB)); + target_angle -= i_actorA->shape_angle.y; + return abs(target_angle); } f32 fopAcM_searchActorDistance(const fopAc_ac_c* i_actorA, const fopAc_ac_c* i_actorB) { @@ -778,49 +806,50 @@ s32 fopAcM_cullingCheck(fopAc_ac_c const* i_actor) { mDoLib_clipper::clip(mtx_p, &i_actor->cull.box.max, &i_actor->cull.box.min); mDoLib_clipper::resetFar(); return ret; - } else { - return mDoLib_clipper::clip(mtx_p, &i_actor->cull.box.max, &i_actor->cull.box.min); } - } else { - cull_box* box = &l_cullSizeBox[fopAcM_CULLSIZE_IDX(fopAcM_GetCullSize(i_actor))]; - if (fopAcM_getCullSizeFar(i_actor) > 0.0f) { - mDoLib_clipper::changeFar(cullsize_far * mDoLib_clipper::getFar()); - u32 ret = mDoLib_clipper::clip(mtx_p, &box->max, &box->min); - mDoLib_clipper::resetFar(); - return ret; - } else { - return mDoLib_clipper::clip(mtx_p, &box->max, &box->min); - } + return mDoLib_clipper::clip(mtx_p, &i_actor->cull.box.max, &i_actor->cull.box.min); } - } else { - if (fopAcM_GetCullSize(i_actor) == fopAc_CULLSPHERE_CUSTOM_e) { - if (fopAcM_getCullSizeFar(i_actor) > 0.0f) { - mDoLib_clipper::changeFar(cullsize_far * mDoLib_clipper::getFar()); - u32 ret = mDoLib_clipper::clip(mtx_p, fopAcM_getCullSizeSphereCenter(i_actor), - fopAcM_getCullSizeSphereR(i_actor)); - mDoLib_clipper::resetFar(); - return ret; - } else { - return mDoLib_clipper::clip(mtx_p, fopAcM_getCullSizeSphereCenter(i_actor), - fopAcM_getCullSizeSphereR(i_actor)); - } - } else { - cull_sphere* sphere = &l_cullSizeSphere[fopAcM_CULLSIZE_Q_IDX(fopAcM_GetCullSize(i_actor))]; - if (fopAcM_getCullSizeFar(i_actor) > 0.0f) { - mDoLib_clipper::changeFar(cullsize_far * mDoLib_clipper::getFar()); - u32 ret = mDoLib_clipper::clip(mtx_p, sphere->center, sphere->radius); - mDoLib_clipper::resetFar(); - return ret; - } else { - return mDoLib_clipper::clip(mtx_p, sphere->center, sphere->radius); - } + cull_box* box = &l_cullSizeBox[fopAcM_CULLSIZE_IDX(fopAcM_GetCullSize(i_actor))]; + + if (fopAcM_getCullSizeFar(i_actor) > 0.0f) { + mDoLib_clipper::changeFar(cullsize_far * mDoLib_clipper::getFar()); + u32 ret = mDoLib_clipper::clip(mtx_p, &box->max, &box->min); + mDoLib_clipper::resetFar(); + return ret; } + + return mDoLib_clipper::clip(mtx_p, &box->max, &box->min); } + + if (fopAcM_GetCullSize(i_actor) == fopAc_CULLSPHERE_CUSTOM_e) { + if (fopAcM_getCullSizeFar(i_actor) > 0.0f) { + mDoLib_clipper::changeFar(cullsize_far * mDoLib_clipper::getFar()); + u32 ret = mDoLib_clipper::clip(mtx_p, fopAcM_getCullSizeSphereCenter(i_actor), + fopAcM_getCullSizeSphereR(i_actor)); + mDoLib_clipper::resetFar(); + return ret; + } + + return mDoLib_clipper::clip(mtx_p, fopAcM_getCullSizeSphereCenter(i_actor), + fopAcM_getCullSizeSphereR(i_actor)); + } + + cull_sphere* sphere = &l_cullSizeSphere[fopAcM_CULLSIZE_Q_IDX(fopAcM_GetCullSize(i_actor))]; + + if (fopAcM_getCullSizeFar(i_actor) > 0.0f) { + mDoLib_clipper::changeFar(cullsize_far * mDoLib_clipper::getFar()); + u32 ret = mDoLib_clipper::clip(mtx_p, sphere->center, sphere->radius); + mDoLib_clipper::resetFar(); + return ret; + } + + return mDoLib_clipper::clip(mtx_p, sphere->center, sphere->radius); } -void* event_second_actor(u16) { +void* event_second_actor(u16 i_flag) { + (void)i_flag; return dComIfGp_getPlayer(0); } @@ -880,15 +909,19 @@ s32 fopAcM_orderDoorEvent(fopAc_ac_c* i_actorA, fopAc_ac_c* i_actorB, u16 i_prio i_priority = 0xFF; } - s16 eventID = i_actorB->eventInfo.getEventId(); - u8 toolID = i_actorB->eventInfo.getMapToolId(); + s16 evid = i_actorB->eventInfo.getEventId(); + u8 toolid = i_actorB->eventInfo.getMapToolId(); - if (fopAcM_GetProfName(i_actorB) == 0x55 && toolID != 0xFF) { - eventID = dComIfGp_getEventManager().getEventIdx(i_actorA, NULL, toolID); + if (fopAcM_GetProfName(i_actorB) == 0x55) { + if (toolid != 0xFF) { + evid = dComIfGp_getEventManager().getEventIdx(i_actorA, NULL, toolid); + } + } else if (fopAcM_GetProfName(i_actorB) == 0xAB) { } + OS_REPORT("toolid<%d>evid<%d>\n", toolid, evid); - return dComIfGp_event_order(dEvt_type_DOOR_e, i_priority, i_flag, -1, i_actorA, i_actorB, eventID, - toolID); + return dComIfGp_event_order(dEvt_type_DOOR_e, i_priority, i_flag, -1, i_actorA, i_actorB, evid, + toolid); } s32 fopAcM_orderCatchEvent(fopAc_ac_c* i_actorA, fopAc_ac_c* i_actorB, u16 i_priority, u16 i_flag) { @@ -976,6 +1009,7 @@ s32 fopAcM_orderOtherEventId(fopAc_ac_c* i_actor, s16 i_eventID, u8 i_mapToolID, } u16 newPriority = 50; + u16 eventPrio; s32 roomNo = dComIfGp_roomControl_getStayNo(); if (i_actor != NULL) { roomNo = fopAcM_GetRoomNo(i_actor); @@ -984,7 +1018,7 @@ s32 fopAcM_orderOtherEventId(fopAc_ac_c* i_actor, s16 i_eventID, u8 i_mapToolID, if (i_priority != 0) { newPriority = i_priority; } else if (i_actor != NULL) { - u16 eventPrio = dComIfGp_getEventManager().getEventPrio(i_actor, i_eventID); + eventPrio = dComIfGp_getEventManager().getEventPrio(i_actor, i_eventID); if (eventPrio != 0) { newPriority = eventPrio; @@ -1018,10 +1052,12 @@ s32 fopAcM_orderMapToolEvent(fopAc_ac_c* i_actor, u8 param_1, s16 i_eventID, u16 dStage_MapEvent_dt_c* dt = dEvt_control_c::searchMapEventData(param_1, roomNo); if (dt != NULL) { newPriority = dt->priority; - + if (i_eventID == 0xFF) { i_eventID = dComIfGp_getEventManager().getEventIdx(i_actor, param_1); } + } else { + OS_REPORT("\x1b[31m%s: %d: fopAcM_orderMapToolEvent() マップデータがみつかりません\n\x1b[m", __FILE__, 2984); // "Map data could not be found." } if (i_flag & 0x100) { @@ -1038,7 +1074,9 @@ s32 fopAcM_orderMapToolEvent(fopAc_ac_c* i_actor, u8 param_1, s16 i_eventID, u16 s32 fopAcM_orderMapToolAutoNextEvent(fopAc_ac_c* i_actor, u8 param_1, s16 i_eventID, u16 param_3, u16 i_flag, u16 param_5) { - return fopAcM_orderMapToolEvent(i_actor, param_1, i_eventID, param_3, i_flag | 0x100, param_5); + u16 flag = i_flag; + flag = flag | 0x100; + return fopAcM_orderMapToolEvent(i_actor, param_1, i_eventID, param_3, flag, param_5); } s32 fopAcM_orderPotentialEvent(fopAc_ac_c* i_actor, u16 i_flag, u16 param_2, u16 i_priority) { @@ -1087,11 +1125,13 @@ s32 fopAcM_orderTreasureEvent(fopAc_ac_c* i_actorA, fopAc_ac_c* i_actorB, u16 i_ -1); } -fopAc_ac_c* fopAcM_getTalkEventPartner(fopAc_ac_c const*) { +fopAc_ac_c* fopAcM_getTalkEventPartner(fopAc_ac_c const* i_this) { + (void)i_this; return (fopAc_ac_c*)dComIfGp_event_getTalkPartner(); } -fopAc_ac_c* fopAcM_getItemEventPartner(fopAc_ac_c const*) { +fopAc_ac_c* fopAcM_getItemEventPartner(fopAc_ac_c const* i_this) { + (void)i_this; return (fopAc_ac_c*)dComIfGp_event_getItemPartner(); } @@ -1106,9 +1146,11 @@ fopAc_ac_c* fopAcM_getEventPartner(fopAc_ac_c const* i_actor) { fpc_ProcID fopAcM_createItemForPresentDemo(cXyz const* i_pos, int i_itemNo, u8 param_2, int i_itemBitNo, int i_roomNo, csXyz const* i_angle, cXyz const* i_scale) { + JUT_ASSERT(3214, 0 <= i_itemNo && i_itemNo < 256); dComIfGp_event_setGtItm(i_itemNo); if (i_itemNo == fpcNm_ITEM_NONE) { + OS_REPORT("プレゼントデモ用なのに「ハズレ」です![%d]\n", i_itemNo); // Even though it is for a Present Demo, it is a 'Miss'! return fpcM_ERROR_PROCESS_ID_e; } @@ -1117,13 +1159,17 @@ fpc_ProcID fopAcM_createItemForPresentDemo(cXyz const* i_pos, int i_itemNo, u8 p fpc_ProcID fopAcM_createItemForTrBoxDemo(cXyz const* i_pos, int i_itemNo, int i_itemBitNo, int i_roomNo, csXyz const* i_angle, cXyz const* i_scale) { - dComIfGp_event_setGtItm(i_itemNo); + + JUT_ASSERT(3259, 0 <= i_itemNo && i_itemNo < 256); + dComIfGp_event_setGtItm(i_itemNo); if (i_itemNo == fpcNm_ITEM_NONE) { + OS_REPORT("ゲットデモ用なのに「ハズレ」です![%d]\n", i_itemNo); // Even though it is for a Get Demo, it is a 'Miss'! return fpcM_ERROR_PROCESS_ID_e; } - return fopAcM_createDemoItem(i_pos, i_itemNo, i_itemBitNo, i_angle, i_roomNo, i_scale, 0); + u8 param_7 = 0; + return fopAcM_createDemoItem(i_pos, i_itemNo, i_itemBitNo, i_angle, i_roomNo, i_scale, param_7); } struct ItemTableList { @@ -1134,23 +1180,26 @@ struct ItemTableList { }; u8 fopAcM_getItemNoFromTableNo(u8 i_tableNo) { - u8 tableNo = i_tableNo; + u8 hp_max; + u8 hp_percent; ItemTableList* tableList = (ItemTableList*)dComIfGp_getItemTable(); - + if (i_tableNo == 255) { return i_tableNo; } - + #if DEBUG - if (tableList->mTableNum - 1 < i_tableNo) { + u8 tableNum = tableList->mTableNum; + if (tableNum - 1 < i_tableNo) { // "Table Num<%d>, Specified Table<%d>, over table num!\n" OSReport_Error("テーブル数<%d>、指定テーブル番号<%d>で、テーブル数オーバーしています!\n", - tableList->mTableNum, i_tableNo); + tableNum, i_tableNo); i_tableNo = 0; } #endif - u8 hp_percent = (dComIfGs_getLife() * 100) / (((dComIfGs_getMaxLife() / 5) * 4) & 0xFC); + hp_max = dComIfGs_getMaxLife() / 5 * 4; + hp_percent = (dComIfGs_getLife() * 100) / hp_max; switch (i_tableNo) { case 150: @@ -1160,19 +1209,20 @@ u8 fopAcM_getItemNoFromTableNo(u8 i_tableNo) { case 190: if (hp_percent < 80) { if (hp_percent >= 60) { - tableNo = i_tableNo + 1; + i_tableNo = i_tableNo + 1; } else if (hp_percent >= 40) { - tableNo = i_tableNo + 2; + i_tableNo = i_tableNo + 2; } else if (hp_percent >= 20) { - tableNo = i_tableNo + 3; + i_tableNo = i_tableNo + 3; } else { - tableNo = i_tableNo + 4; + i_tableNo = i_tableNo + 4; } } break; } - return tableList->mTables[tableNo][(int)cM_rndF(15.9999f)]; + i_tableNo = tableList->mTables[i_tableNo][(int)cM_rndF(15.9999f)]; + return i_tableNo; } struct EnemyTableList { @@ -1190,11 +1240,14 @@ struct EnemyTable { fpc_ProcID fopAcM_createItemFromEnemyID(u8 i_enemyID, cXyz const* i_pos, int i_itemBitNo, int i_roomNo, csXyz const* i_angle, cXyz const* i_scale, f32* i_speedF, f32* i_speedY) { + int itemNo; int tableNo = 0xFF; - EnemyTableList* tblList = (EnemyTableList*)dEnemyItem_c::mData; - int tableNum = tblList->field_0x4; - EnemyTable* table = (EnemyTable*)&tblList->mData; - + u32* data = (u32*)dEnemyItem_c::getItemData(); + data++; + int tableNum = (int) *data; + data++; + EnemyTable* table = (EnemyTable*)data; + for (u32 i = 0; i < tableNum; i++) { if (i_enemyID == table->mEnemyID) { if (table->mStage[0] == '#') { @@ -1206,11 +1259,11 @@ fpc_ProcID fopAcM_createItemFromEnemyID(u8 i_enemyID, cXyz const* i_pos, int i_i } table++; } - + if (daPy_getPlayerActorClass()->checkHorseRide()) { - int itemNo = fopAcM_getItemNoFromTableNo(tableNo); + tableNo = fopAcM_getItemNoFromTableNo(tableNo); void* actor = - fopAcM_createItemForDirectGet(i_pos, itemNo, i_roomNo, NULL, NULL, 0.0f, 0.0f); + fopAcM_createItemForDirectGet(i_pos, tableNo, i_roomNo, NULL, NULL, 0.0f, 0.0f); return fopAcM_GetID(actor); } @@ -1369,7 +1422,7 @@ fpc_ProcID fopAcM_createItem(const cXyz* i_pos, int i_itemNo, int i_itemBitNo, i fopAc_ac_c* fopAcM_fastCreateItem2(const cXyz* i_pos, int i_itemNo, int i_itemBitNo, int i_roomNo, int param_5, const csXyz* i_angle, const cXyz* i_scale) { // clang-format off - JUT_ASSERT(0, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo < (dSv_info_c::DAN_ITEM + dSv_info_c::MEMORY_ITEM + dSv_info_c::ZONE_ITEM )) || i_itemBitNo == 255); + JUT_ASSERT(4202, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo < (dSv_info_c::DAN_ITEM + dSv_info_c::MEMORY_ITEM + dSv_info_c::ZONE_ITEM )) || i_itemBitNo == 255); // clang-format on csXyz item_angle(csXyz::Zero); @@ -1387,49 +1440,53 @@ fopAc_ac_c* fopAcM_fastCreateItem2(const cXyz* i_pos, int i_itemNo, int i_itemBi u8 item_no = check_itemno(i_itemNo); u32 params = MAKE_ITEM_PARAMS(item_no, i_itemBitNo, 0xFF, param_5); + fopAc_ac_c* ret; switch (i_itemNo) { case fpcNm_ITEM_RECOVERY_FAILY: - return fopAcM_fastCreate(PROC_Obj_Yousei, 0xFFFFFFFF, i_pos, i_roomNo, i_angle, i_scale, -1, + ret = fopAcM_fastCreate(PROC_Obj_Yousei, 0xFFFFFFFF, i_pos, i_roomNo, i_angle, i_scale, -1, NULL, NULL); + break; #if DEBUG case fpcNm_ITEM_SMALL_KEY: // "Small Key: Can't support map display, so program generation is prohibited!\n" OS_REPORT_ERROR("小さい鍵:マップ表示対応出来ないので、プログラム生成禁止!\n"); - JUT_ASSERT(0, FALSE); + JUT_ASSERT(4268, FALSE); break; case fpcNm_ITEM_KANTERA: // "Lantern: Program generation is prohibited!\n" OS_REPORT_ERROR("カンテラ:プログラム生成禁止!\n"); - JUT_ASSERT(0, FALSE); + JUT_ASSERT(4272, FALSE); break; case fpcNm_ITEM_LIGHT_DROP: // "Light Drop: Program generation is prohibited!\n" OS_REPORT_ERROR("光の雫:プログラム生成禁止!\n"); - JUT_ASSERT(0, FALSE); + JUT_ASSERT(4276, FALSE); break; #endif case fpcNm_ITEM_KAKERA_HEART: case fpcNm_ITEM_UTAWA_HEART: - return fopAcM_fastCreate(PROC_Obj_LifeContainer, params, i_pos, i_roomNo, i_angle, i_scale, + ret = fopAcM_fastCreate(PROC_Obj_LifeContainer, params, i_pos, i_roomNo, i_angle, i_scale, -1, NULL, NULL); + break; case fpcNm_ITEM_TRIPLE_HEART: for (int i = 0; i < 2; i++) { - fopAcM_fastCreate(PROC_ITEM, params, i_pos, i_roomNo, &item_angle, i_scale, -1, NULL, + ret = fopAcM_fastCreate(PROC_ITEM, params, i_pos, i_roomNo, &item_angle, i_scale, -1, NULL, NULL); item_angle.y = cM_rndFX(0x7FFF); } default: - return fopAcM_fastCreate(PROC_ITEM, params, i_pos, i_roomNo, &item_angle, i_scale, -1, NULL, + ret = fopAcM_fastCreate(PROC_ITEM, params, i_pos, i_roomNo, &item_angle, i_scale, -1, NULL, NULL); } + return ret; } fopAc_ac_c* fopAcM_fastCreateItem(const cXyz* i_pos, int i_itemNo, int i_roomNo, const csXyz* i_angle, const cXyz* i_scale, f32* i_speedF, f32* i_speedY, int i_itemBitNo, int param_9, createFunc i_createFunc) { - JUT_ASSERT(0, 0 <= i_itemNo && i_itemNo < 256); + JUT_ASSERT(4324, 0 <= i_itemNo && i_itemNo < 256); csXyz angle; if (i_itemNo == fpcNm_ITEM_NONE) { @@ -1446,31 +1503,35 @@ fopAc_ac_c* fopAcM_fastCreateItem(const cXyz* i_pos, int i_itemNo, int i_roomNo, *i_speedF = 2.0f * *i_speedF; } + fopAc_ac_c* ret; + switch (i_itemNo) { case fpcNm_ITEM_RECOVERY_FAILY: - return fopAcM_fastCreate(PROC_Obj_Yousei, 0xFFFFFFFF, i_pos, i_roomNo, i_angle, i_scale, -1, + ret = fopAcM_fastCreate(PROC_Obj_Yousei, 0xFFFFFFFF, i_pos, i_roomNo, i_angle, i_scale, -1, NULL, NULL); + break; #if DEBUG case fpcNm_ITEM_SMALL_KEY: // "Small Key: Can't support map display, so program generation is prohibited!\n" OS_REPORT_ERROR("小さい鍵:マップ表示対応出来ないので、プログラム生成禁止!\n"); - JUT_ASSERT(0, FALSE); + JUT_ASSERT(4383, FALSE); break; case fpcNm_ITEM_KANTERA: // "Lantern: Program generation is prohibited!\n" OS_REPORT_ERROR("カンテラ:プログラム生成禁止!\n"); - JUT_ASSERT(0, FALSE); + JUT_ASSERT(4387, FALSE); break; case fpcNm_ITEM_LIGHT_DROP: // "Light Drop: Program generation is prohibited!\n" OS_REPORT_ERROR("光の雫:プログラム生成禁止!\n"); - JUT_ASSERT(0, FALSE); + JUT_ASSERT(4391, FALSE); break; #endif case fpcNm_ITEM_KAKERA_HEART: case fpcNm_ITEM_UTAWA_HEART: - return fopAcM_fastCreate(PROC_Obj_LifeContainer, params, i_pos, i_roomNo, i_angle, i_scale, + ret = fopAcM_fastCreate(PROC_Obj_LifeContainer, params, i_pos, i_roomNo, i_angle, i_scale, -1, NULL, NULL); + break; case fpcNm_ITEM_TRIPLE_HEART: for (i = 0; i < 2; i++) { if (i_angle != NULL) { @@ -1502,25 +1563,26 @@ fopAc_ac_c* fopAcM_fastCreateItem(const cXyz* i_pos, int i_itemNo, int i_roomNo, } angle.z = 0xFF; - fopAc_ac_c* actor = (fopAc_ac_c*)fopAcM_fastCreate(PROC_ITEM, params, i_pos, i_roomNo, + ret = fopAcM_fastCreate(PROC_ITEM, params, i_pos, i_roomNo, &angle, i_scale, -1, i_createFunc, NULL); - if (actor != NULL) { + if (ret != NULL) { if (i_speedF != NULL) { - actor->speedF = *i_speedF; + ret->speedF = *i_speedF; } if (i_speedY != NULL) { - actor->speed.y = *i_speedY; + ret->speed.y = *i_speedY; } } - - return actor; } + + return ret; } fpc_ProcID fopAcM_createBokkuri(u16 i_setId, const cXyz* i_pos, int i_itemNo, int i_itemBit, int i_roomNo, const cXyz* param_6, int i_itemType, int param_8) { + u32 params = 0; csXyz params_ex(0, 0, 0); if (param_6 != NULL) { params_ex.y = param_6->atan2sX_Z(); @@ -1528,7 +1590,6 @@ fpc_ProcID fopAcM_createBokkuri(u16 i_setId, const cXyz* i_pos, int i_itemNo, in param_8 = 1; } - u32 params = 0; daObjCarry_c::make_prm_bokkuri(¶ms, ¶ms_ex, i_itemNo, i_itemBit, i_itemType, param_8); return fopAcM_create(PROC_Obj_Carry, i_setId, params, i_pos, i_roomNo, ¶ms_ex, NULL, -1, NULL); } @@ -1538,13 +1599,13 @@ fpc_ProcID fopAcM_createWarpHole(const cXyz* i_pos, const csXyz* i_angle, int i_ if (param_6 == 0xFF) { param_6 = param_4; } - u32 actorParams; - make_prm_warp_hole(&actorParams, param_5, param_6, param_4); - return fopAcM_create(PROC_Obj_BossWarp, actorParams, i_pos, i_roomNo, i_angle, NULL, -1); + u32 actorParams = 0x17000000 + 0xFF; + u32 actorParamsOut = actorParams | (param_5 << 0x1B) | (param_6 << 0x10) | (param_4 << 0x8); + return fopAcM_create(PROC_Obj_BossWarp, actorParamsOut, i_pos, i_roomNo, i_angle, NULL, -1); } void* enemySearchJugge(void* i_actor, void* i_data) { - if (i_actor != NULL && fopAc_IsActor(i_actor) && ((fopAc_ac_c*)i_actor)->group == fopAc_ENEMY_e) + if (i_actor != NULL && fopAcM_IsActor(i_actor) && fopAcM_GetGroup((fopAc_ac_c*)i_actor) == fopAc_ENEMY_e) { return i_actor; } else { @@ -1553,17 +1614,18 @@ void* enemySearchJugge(void* i_actor, void* i_data) { } fopAc_ac_c* fopAcM_myRoomSearchEnemy(s8 roomNo) { - JUT_ASSERT(0, roomNo >= 0); + JUT_ASSERT(4659, roomNo >= 0); - int procID = dStage_roomControl_c::getStatusProcID(roomNo); - scene_class* roomProc = fopScnM_SearchByID(procID); - JUT_ASSERT(0, roomProc != NULL); + scene_class* roomProc = fopScnM_SearchByID(dStage_roomControl_c::getStatusProcID(roomNo)); + JUT_ASSERT(4662, roomProc != NULL); - u32 actorID = ((daPy_py_c*)dComIfGp_getPlayer(0))->getGrabActorID(); - fopAc_ac_c* actor = fopAcM_SearchByID(actorID); + { + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); + fopAc_ac_c* actor = fopAcM_SearchByID(player->getGrabActorID()); - if (actor != NULL && fopAcM_GetGroup(actor) == 2) { - return actor; + if (actor != NULL && fopAcM_GetGroup(actor) == 2) { + return actor; + } } return (fopAc_ac_c*)fpcM_JudgeInLayer(fpcM_LayerID(roomProc), enemySearchJugge, NULL); @@ -1571,9 +1633,11 @@ fopAc_ac_c* fopAcM_myRoomSearchEnemy(s8 roomNo) { fpc_ProcID fopAcM_createDisappear(const fopAc_ac_c* i_actor, const cXyz* i_pos, u8 i_size, u8 i_type, u8 i_enemyID) { - return fopAcM_GetID(fopAcM_fastCreate( - PROC_DISAPPEAR, (i_enemyID << 0x10) | (i_size << 0x8) | i_type, i_pos, - fopAcM_GetRoomNo(i_actor), &i_actor->current.angle, NULL, 0xFF, NULL, NULL)); + u32 param = (i_enemyID << 0x10) | (i_size << 0x8) | i_type; + fopAc_ac_c* actor = fopAcM_fastCreate( + PROC_DISAPPEAR, param, i_pos, fopAcM_GetRoomNo(i_actor), &i_actor->current.angle, NULL, 0xFF, + NULL, NULL); + return fopAcM_GetID(actor); } void fopAcM_setCarryNow(fopAc_ac_c* i_actor, int param_1) { @@ -1589,14 +1653,11 @@ void fopAcM_cancelCarryNow(fopAc_ac_c* i_actor) { if (fopAcM_checkCarryNow(i_actor)) { i_actor->actor_status &= ~0x2000; - s8 roomNo = fopAcM_GetHomeRoomNo(i_actor); - if (roomNo != -1) { - int procID = dStage_roomControl_c::getStatusProcID(fopAcM_GetRoomNo(i_actor)); - scene_class* roomProc = fopScnM_SearchByID(procID); - - if (roomProc != NULL) { - fopAcM_setRoomLayer(i_actor, fopAcM_GetRoomNo(i_actor)); - } + if (fopAcM_GetHomeRoomNo(i_actor) != -1 && + fopScnM_SearchByID(dStage_roomControl_c::getStatusProcID(fopAcM_GetRoomNo(i_actor))) != + NULL) + { + fopAcM_setRoomLayer(i_actor, fopAcM_GetRoomNo(i_actor)); } i_actor->shape_angle.z = 0; @@ -1624,6 +1685,7 @@ BOOL fopAcM_otoCheck(fopAc_ac_c const* i_actor, f32 param_1) { BOOL fopAcM_otherBgCheck(fopAc_ac_c const* param_0, fopAc_ac_c const* param_1) { dBgS_LinChk linChk; + cXyz _; cXyz start; cXyz end; @@ -1650,14 +1712,14 @@ BOOL fopAcM_wayBgCheck(fopAc_ac_c const* param_0, f32 param_1, f32 param_2) { start = param_0->current.pos; start.y += param_2; - mDoMtx_YrotS((MtxP)calc_mtx, param_0->shape_angle.y); + cMtx_YrotS((MtxP)calc_mtx, param_0->shape_angle.y); offset.x = 0.0f; offset.y = 50.0f; offset.z = param_1; MtxPosition(&offset, &end); - VECAdd(&end, ¶m_0->current.pos, &end); + end += param_0->current.pos; linChk.Set(&start, &end, param_0); @@ -1669,7 +1731,8 @@ BOOL fopAcM_wayBgCheck(fopAc_ac_c const* param_0, f32 param_1, f32 param_2) { } BOOL fopAcM_plAngleCheck(fopAc_ac_c const* i_actor, s16 i_angle) { - s16 angle = i_actor->shape_angle.y - dComIfGp_getPlayer(0)->shape_angle.y; + fopAc_ac_c* player = dComIfGp_getPlayer(0); + s16 angle = i_actor->shape_angle.y - player->shape_angle.y; if (angle <= i_angle && angle >= (s16)-i_angle) { return FALSE; } @@ -1701,7 +1764,7 @@ void fopAcM_effSmokeSet1(u32* param_0, u32* param_1, cXyz const* param_2, csXyz f32 param_4, dKy_tevstr_c const* param_5, int param_6) { cXyz p2(param_2->x, param_2->y + 100.0f, param_2->z); if (fopAcM_gc_c::gndCheck(&p2)) { - p2.y = fopAcM_gc_c::getGroundY(); + p2.y = fopAcM_gc_c::getGroundY() + TREG_F(7); cXyz stack_18(param_4, param_4, param_4); *param_0 = dComIfGp_particle_setSimpleFoot(*param_0, param_1, *fopAcM_gc_c::getGroundCheck(), &p2, @@ -1725,6 +1788,11 @@ void fopAcM_effHamonSet(u32* param_0, cXyz const* param_1, f32 param_2, f32 emit } s32 fopAcM_riverStream(cXyz* param_0, s16* param_1, f32* param_2, f32 param_3) { + (void)¶m_0; + (void)¶m_1; + (void)¶m_2; + (void)¶m_3; + return 0; } @@ -1737,14 +1805,14 @@ s32 fopAcM_carryOffRevise(fopAc_ac_c* param_0) { start = player->current.pos; start.y = param_0->current.pos.y; - mDoMtx_YrotS((MtxP)calc_mtx, player->shape_angle.y); + cMtx_YrotS((MtxP)calc_mtx, player->shape_angle.y); offset.x = 0.0f; offset.y = param_0->current.pos.y - player->current.pos.y; - offset.z = 150.0f; + offset.z = 150.0f + AREG_F(17); MtxPosition(&offset, &end); - VECAdd(&end, &player->current.pos, &end); + end += player->current.pos; linChk.Set(&start, &end, param_0); @@ -1786,11 +1854,12 @@ void fopAcM_setEffectMtx(const fopAc_ac_c* i_actor, const J3DModelData* modelDat cXyz v1 = *pEyePos - camera->lookat.eye; cXyz v2; get_vectle_calc(&i_actor->tevStr.field_0x32c, pEyePos, &v2); - Vec half; + cXyz half; C_VECHalfAngle(&v1, &v2, &half); Mtx mtx; C_MTXLookAt(mtx, &cXyz::Zero, &cXyz::BaseY, &half); - mDoMtx_stack_c::scaleS(1.0, 1.0, 1.0); + f32 scale = 1.0f + IREG_F(0); + mDoMtx_stack_c::scaleS(scale, scale, 1.0); // static Mtx const mtx_adj = { {0.5f, 0.0f, 0.0f, 0.5f}, {0.0f, -0.5f, 0.0f, 0.5f}, @@ -1798,19 +1867,19 @@ void fopAcM_setEffectMtx(const fopAc_ac_c* i_actor, const J3DModelData* modelDat }; mDoMtx_stack_c::concat(mtx_adj); mDoMtx_stack_c::concat(mtx); - MtxP currentMtx = mDoMtx_stack_c::get(); - currentMtx[0][3] = 0.0; - currentMtx[1][3] = 0.0; - currentMtx[2][3] = 0.0; + mDoMtx_stack_c::get()[0][3] = 0.0; + mDoMtx_stack_c::get()[1][3] = 0.0; + mDoMtx_stack_c::get()[2][3] = 0.0; Mtx mtx2; - mDoMtx_copy(currentMtx, mtx2); + cMtx_copy(mDoMtx_stack_c::get(), mtx2); for (u16 i = 0; i < modelData->getMaterialNum(); i++) { J3DMaterial* material = modelData->getMaterialNodePointer(i); for (u32 j = 0; j < 8; j++) { J3DTexMtx* texMtx = material->getTexMtx(j); if (texMtx != NULL) { - switch (texMtx->getTexMtxInfo().mInfo) { + J3DTexMtxInfo* info = &texMtx->getTexMtxInfo(); + switch (info->mInfo) { case 6: texMtx->setEffectMtx(mtx2); break; @@ -1827,12 +1896,12 @@ const char* fopAcM_getProcNameString(const fopAc_ac_c* i_actor) { } static const fopAc_ac_c* fopAcM_findObjectCB(fopAc_ac_c const* i_actor, void* i_data) { - fopAcM_search_prm* prm = (fopAcM_search_prm*)i_data; - if (!fopAcM_IsExecuting(fopAcM_GetID(i_actor))) { return NULL; } + fopAcM_search_prm* prm = (fopAcM_search_prm*)i_data; + if (prm->procname == fopAcM_GetProfName(i_actor) && prm->argument == i_actor->argument) { if (prm->prm0 == 0 || prm->prm1 == (prm->prm0 & fopAcM_GetParam(i_actor))) { return i_actor; @@ -1878,12 +1947,12 @@ fopAc_ac_c* fopAcM_searchFromName4Event(char const* i_name, s16 i_eventID) { prm.event_id = i_eventID; strcpy(prm.name, i_name); - char* chr = strchr(prm.name, ':'); + char* chr = std::strchr(prm.name, ':'); if (chr != NULL) { chr[0] = 0; + chr++; prm.event_id = 0; - chr++; for (; *chr != 0; chr++) { if (*chr < '0' || *chr > '9') { prm.event_id = 0xFFFF; @@ -1923,7 +1992,8 @@ s32 fopAcM_getWaterY(cXyz const* param_0, f32* o_waterY) { void fpoAcM_relativePos(fopAc_ac_c const* i_actor, cXyz const* i_pos, cXyz* o_pos) { s16 angle = -i_actor->shape_angle.y; - cXyz pos = *i_pos - i_actor->current.pos; + cXyz pos; + pos = *i_pos - i_actor->current.pos; o_pos->x = (pos.z * cM_ssin(angle)) + (pos.x * cM_scos(angle)); o_pos->y = pos.y; @@ -1932,14 +2002,13 @@ void fpoAcM_relativePos(fopAc_ac_c const* i_actor, cXyz const* i_pos, cXyz* o_po s32 fopAcM_getWaterStream(cXyz const* pos, cBgS_PolyInfo const& polyinfo, cXyz* speed, int* power, BOOL param_4) { - daTagStream_c* stream = daTagStream_c::getTop(); - if (stream != NULL) { - for (stream = daTagStream_c::getTop(); stream != NULL; stream = stream->getNext()) { + if (daTagStream_c::getTop() != NULL) { + for (daTagStream_c* stream = daTagStream_c::getTop(); stream != NULL; stream = stream->getNext()) { if (stream->checkStreamOn() && (!param_4 || stream->checkCanoeOn()) && stream->checkArea(pos)) { *speed = stream->speed; - *power = stream->getPower() & 0xff; + *power = stream->getPower(); return 1; } } @@ -1977,7 +2046,11 @@ s16 fopAcM_getPolygonAngle(cBgS_PolyInfo const& poly, s16 param_1) { s16 fopAcM_getPolygonAngle(cM3dGPla const* p_plane, s16 param_1) { if (p_plane == NULL) { +#if DEBUG + JUT_ASSERT(5810, FALSE); +#else return 0; +#endif } f32 cos = cM_scos(p_plane->mNormal.atan2sX_Z() - param_1); @@ -1992,6 +2065,10 @@ bool fopAcM_lc_c::lineCheck(cXyz const* i_start, cXyz const* i_end, fopAc_ac_c c return dComIfG_Bgsp().LineCross(&mLineCheck); } +bool fopAcM_lc_c::dummyCheck(cM3dGPla* i_plane) { + return getTriPla(i_plane); +} + bool fopAcM_gc_c::gndCheck(cXyz const* i_pos) { mGndCheck.SetPos(i_pos); mGroundY = (f32)dComIfG_Bgsp().GroundCross(&mGndCheck); @@ -2021,4 +2098,12 @@ BOOL fopAcM_getNameString(const fopAc_ac_c* i_actor, char* o_name) { return TRUE; } -void fopAcM_initManager() {} +void fopAcM_initManager() { +#if DEBUG + DummyCheckHeap_init(); + if (lbl_8074C4DC != 0) { + DummyCheckHeap_create(); + } + l_hio.entry(); +#endif +} diff --git a/src/f_op/f_op_actor_tag.cpp b/src/f_op/f_op_actor_tag.cpp index b4a95012e5..2f0518b595 100644 --- a/src/f_op/f_op_actor_tag.cpp +++ b/src/f_op/f_op_actor_tag.cpp @@ -12,8 +12,8 @@ int fopAcTg_ToActorQ(create_tag_class* i_createTag) { return cTg_Addition(&g_fopAcTg_Queue, i_createTag); } -int fopAcTg_ActorQTo(create_tag_class* i_createTag) { - return cTg_SingleCutFromTree(i_createTag); +void fopAcTg_ActorQTo(create_tag_class* i_createTag) { + int _ = cTg_SingleCutFromTree(i_createTag); } int fopAcTg_Init(create_tag_class* i_createTag, void* i_data) { diff --git a/src/f_op/f_op_camera.cpp b/src/f_op/f_op_camera.cpp index 3d17f6d4fa..c2d94d0a76 100644 --- a/src/f_op/f_op_camera.cpp +++ b/src/f_op/f_op_camera.cpp @@ -5,26 +5,42 @@ #include "f_op/f_op_camera.h" #include "f_op/f_op_camera_mng.h" +#include "f_ap/f_ap_game.h" #include "d/d_com_inf_game.h" #include "d/d_s_play.h" #include "f_op/f_op_draw_tag.h" static s32 fopCam_Draw(camera_class* i_this) { s32 ret = 1; + #if DEBUG + fapGm_HIO_c::startCpuTimer(); + #endif + if (!dComIfGp_isPauseFlag()) { ret = fpcLf_DrawMethod(i_this->submethod, i_this); } + #if DEBUG + fapGm_HIO_c::stopCpuTimer("カメラ(描画処理)"); // Camera (rendering process) + #endif + return ret; } static int fopCam_Execute(camera_class* i_this) { int ret; + #if DEBUG + fapGm_HIO_c::startCpuTimer(); + #endif - if (!dComIfGp_isPauseFlag() && dScnPly_c::isPause()) { + if (!dComIfGp_isPauseFlag() && !dScnPly_c::isPause()) { ret = fpcMtd_Execute((process_method_class*)i_this->submethod, i_this); } + #if DEBUG + fapGm_HIO_c::stopCpuTimer("カメラ(計算処理)"); // Camera (computational processing) + #endif + return ret; } @@ -38,7 +54,8 @@ int fopCam_IsDelete(camera_class* i_this) { } int fopCam_Delete(camera_class* i_this) { - int ret = fpcMtd_Delete((process_method_class*)i_this->submethod, i_this); + int ret = 0; + ret = fpcMtd_Delete((process_method_class*)i_this->submethod, i_this); if (ret == 1) { fopDwTg_DrawQTo(&i_this->create_tag); } @@ -48,6 +65,7 @@ int fopCam_Delete(camera_class* i_this) { static int fopCam_Create(void* i_this) { camera_class* a_this = (camera_class*)i_this; + int ret; if (fpcM_IsFirstCreating(i_this)) { camera_process_profile_definition* profile = (camera_process_profile_definition*)fpcM_GetProfile(i_this); @@ -61,10 +79,9 @@ static int fopCam_Create(void* i_this) { } } - int ret = fpcMtd_Create(&a_this->submethod->base, a_this); + ret = fpcMtd_Create(&a_this->submethod->base, a_this); if (ret == cPhs_COMPLEATE_e) { - s32 priority = fpcM_DrawPriority(a_this); - fopDwTg_ToDrawQ(&a_this->create_tag, priority); + fopDwTg_ToDrawQ(&a_this->create_tag, fpcM_DrawPriority(a_this)); } return ret; diff --git a/src/f_op/f_op_camera_mng.cpp b/src/f_op/f_op_camera_mng.cpp index ea40325226..e8a035a40e 100644 --- a/src/f_op/f_op_camera_mng.cpp +++ b/src/f_op/f_op_camera_mng.cpp @@ -4,8 +4,6 @@ */ #include "f_op/f_op_camera_mng.h" -#include "f_pc/f_pc_layer.h" -#include "f_pc/f_pc_stdcreate_req.h" static fpc_ProcID l_fopCamM_id[4]; @@ -13,6 +11,10 @@ u32 fopCamM_GetParam(camera_class* i_this) { return fpcM_GetParam(i_this); } +void dummy(fpc_ProcID i_procName) { + fpcM_SearchByID(i_procName); +} + fpc_ProcID fopCamM_Create(int i_cameraIdx, s16 i_procName, void* i_append) { l_fopCamM_id[i_cameraIdx] = fpcM_Create(i_procName, NULL, i_append); return l_fopCamM_id[i_cameraIdx]; diff --git a/src/f_op/f_op_draw_iter.cpp b/src/f_op/f_op_draw_iter.cpp index 8f9150acfa..de1805762a 100644 --- a/src/f_op/f_op_draw_iter.cpp +++ b/src/f_op/f_op_draw_iter.cpp @@ -12,8 +12,8 @@ static int l_fopDwTg_id; create_tag_class* fopDwIt_GetTag() { while (l_fopDwTg_id + 1 < g_fopDwTg_Queue.mNumLists) { - l_fopDwTg_id++; - node_class* node = g_fopDwTg_Queue.mpLists[l_fopDwTg_id].mpHead; + node_list_class* list = &g_fopDwTg_Queue.mpLists[++l_fopDwTg_id]; + node_class* node = list->mpHead; if (node != NULL) { return (create_tag_class*)node; @@ -30,13 +30,13 @@ create_tag_class* fopDwIt_Begin() { if (tag != NULL) { return tag; } - return tag = fopDwIt_GetTag(); + return fopDwIt_GetTag(); } create_tag_class* fopDwIt_Next(create_tag_class* i_createTag) { create_tag_class* tag = (create_tag_class*)i_createTag->mpNode.mpNextNode; if (tag == NULL) { - tag = fopDwIt_GetTag(); + return fopDwIt_GetTag(); } return tag; } diff --git a/src/f_op/f_op_kankyo.cpp b/src/f_op/f_op_kankyo.cpp index 7a9b170786..c65007622a 100644 --- a/src/f_op/f_op_kankyo.cpp +++ b/src/f_op/f_op_kankyo.cpp @@ -6,38 +6,59 @@ #include "f_op/f_op_kankyo.h" #include "d/d_com_inf_game.h" #include "d/d_s_play.h" +#include "f_ap/f_ap_game.h" #include "f_op/f_op_draw_tag.h" #include "f_op/f_op_kankyo_mng.h" +static int fopKy_KANKYO_TYPE; + +void fopKy_IsKankyo(void* i_this) { + fpcM_IsJustType(fopKy_KANKYO_TYPE, ((kankyo_class*)i_this)->type); +} + static int fopKy_Draw(void* i_this) { int ret; - kankyo_class* a_this = (kankyo_class*)i_this; + +#if DEBUG + fapGm_HIO_c::startCpuTimer(); +#endif if (!dComIfGp_isPauseFlag()) { - ret = fpcLf_DrawMethod(a_this->sub_method, i_this); + ret = fpcLf_DrawMethod(((kankyo_class*)i_this)->sub_method, i_this); } +#if DEBUG + fapGm_HIO_c::stopCpuTimer("環境関係(描画処理)"); // Environmental aspects (rendering processing) +#endif + return ret; } static int fopKy_Execute(void* i_this) { - int ret; kankyo_class* a_this = (kankyo_class*)i_this; + int ret; + +#if DEBUG + fapGm_HIO_c::startCpuTimer(); +#endif - if (dScnPly_c::isPause() && (!dComIfGp_isPauseFlag() || fpcM_GetName(i_this) == PROC_ENVSE)) { - ret = fpcMtd_Execute(&a_this->sub_method->base, i_this); + if (!dScnPly_c::isPause() && (!dComIfGp_isPauseFlag() || fpcM_GetName(a_this) == PROC_ENVSE)) { + ret = fpcMtd_Execute(&((kankyo_class*)i_this)->sub_method->base, i_this); } +#if DEBUG + fapGm_HIO_c::stopCpuTimer("環境関係(計算処理)"); // Environmental aspects (computational processing) +#endif + return ret; } static int fopKy_IsDelete(void* i_this) { int ret; - kankyo_class* a_this = (kankyo_class*)i_this; - ret = fpcMtd_IsDelete(&a_this->sub_method->base, a_this); + ret = fpcMtd_IsDelete(&((kankyo_class*)i_this)->sub_method->base, i_this); if (ret == 1) { - fopDwTg_DrawQTo(&a_this->draw_tag); + fopDwTg_DrawQTo(&((kankyo_class*)i_this)->draw_tag); } return ret; @@ -52,15 +73,14 @@ static int fopKy_Delete(void* i_this) { return ret; } -static int fopKy_KANKYO_TYPE; - static int fopKy_Create(void* i_this) { kankyo_class* a_this = (kankyo_class*)i_this; + int ret; if (fpcM_IsFirstCreating(i_this)) { kankyo_process_profile_definition* profile = (kankyo_process_profile_definition*)fpcM_GetProfile(i_this); - a_this->type = fpcBs_MakeOfType(&fopKy_KANKYO_TYPE); + a_this->type = fpcM_MakeOfType(&fopKy_KANKYO_TYPE); a_this->sub_method = profile->sub_method; fopDwTg_Init(&a_this->draw_tag, a_this); @@ -73,10 +93,9 @@ static int fopKy_Create(void* i_this) { } } - int ret = fpcMtd_Create(&a_this->sub_method->base, a_this); + ret = fpcMtd_Create(&a_this->sub_method->base, a_this); if (ret == cPhs_COMPLEATE_e) { - s32 priority = fpcM_DrawPriority(a_this); - fopDwTg_ToDrawQ(&a_this->draw_tag, priority); + fopDwTg_ToDrawQ(&a_this->draw_tag, fpcM_DrawPriority(a_this)); } return ret; diff --git a/src/f_op/f_op_kankyo_mng.cpp b/src/f_op/f_op_kankyo_mng.cpp index d09a6be0df..0093173817 100644 --- a/src/f_op/f_op_kankyo_mng.cpp +++ b/src/f_op/f_op_kankyo_mng.cpp @@ -7,12 +7,22 @@ #include "SSystem/SComponent/c_malloc.h" #include "d/d_com_inf_game.h" +void dummy(fpcLyIt_JudgeFunc i_createFunc, void* i_this) { + fpcM_Search(i_createFunc, i_this); +} + +void fopKyM_IsKy(void* i_this) { + fopKy_IsKankyo((fopKyM_prm_class*)i_this); +} + fopKyM_prm_class* fopKyM_CreateAppend() { fopKyM_prm_class* append = (fopKyM_prm_class*)cMl::memalignB(-4, sizeof(fopKyM_prm_class)); if (append != NULL) { cLib_memSet(append, 0, sizeof(fopKyM_prm_class)); - append->scale.set(1.0f, 1.0f, 1.0f); + append->scale.x = 1.0f; + append->scale.y = 1.0f; + append->scale.z = 1.0f; } return append; } @@ -71,9 +81,7 @@ fpc_ProcID fopKyM_createWpillar(cXyz const* i_pos, f32 scale, int i_param) { } append->pos = *i_pos; - append->scale.x = scale; - append->scale.y = scale; - append->scale.z = scale; + append->scale.set(scale, scale, scale); append->parameters = i_param; return fopKyM_Create(PROC_WPILLAR, NULL, append); @@ -86,9 +94,7 @@ fpc_ProcID fopKyM_createMpillar(cXyz const* i_pos, f32 i_size) { }; cXyz scale; - scale.x = i_size; - scale.y = i_size; - scale.z = i_size; + scale.setall(i_size); for (int i = 0; i < 2; i++) { dComIfGp_particle_set(m_name[i], i_pos, NULL, &scale); diff --git a/src/f_op/f_op_msg.cpp b/src/f_op/f_op_msg.cpp index 4b9ad8afe6..f5cbf98b1c 100644 --- a/src/f_op/f_op_msg.cpp +++ b/src/f_op/f_op_msg.cpp @@ -5,32 +5,52 @@ #include "f_op/f_op_msg.h" #include "d/d_s_play.h" +#include "f_ap/f_ap_game.h" #include "f_op/f_op_draw_tag.h" #include "f_op/f_op_msg_mng.h" #include "f_pc/f_pc_manager.h" +#include "m_Do/m_Do_machine.h" static int fopMsg_Draw(void* i_this) { - msg_class* a_this = (msg_class*)i_this; - return fpcLf_DrawMethod(a_this->sub_method, i_this); +#if DEBUG + fapGm_HIO_c::startCpuTimer(); +#endif + s32 ret = fpcLf_DrawMethod(((msg_class*)i_this)->sub_method, i_this); +#if DEBUG + fapGm_HIO_c::stopCpuTimer("2D関係(描画処理)"); // 2D graphics (rendering) +#endif + return ret; } static int fopMsg_Execute(void* i_this) { msg_class* a_this = (msg_class*)i_this; - int ret = 1; - if (dScnPly_c::isPause()) { - ret = fpcMtd_Execute(&a_this->sub_method->base, i_this); +#if DEBUG + fapGm_HIO_c::startCpuTimer(); +#endif + if (!dScnPly_c::isPause()) { +#if DEBUG + if (fopMsg::MemCheck) { + mDoMch_HeapCheckAll(); + } +#endif + ret = fpcMtd_Execute(&((msg_class*)i_this)->sub_method->base, i_this); +#if DEBUG + if (fopMsg::MemCheck) { + mDoMch_HeapCheckAll(); + } +#endif } - +#if DEBUG + fapGm_HIO_c::stopCpuTimer("2D関係(計算処理)"); // 2D graphics (computational processing) +#endif return ret; } static int fopMsg_IsDelete(void* i_this) { - msg_class* a_this = (msg_class*)i_this; - - int ret = fpcMtd_IsDelete(&a_this->sub_method->base, i_this); + int ret = fpcMtd_IsDelete(&((msg_class*)i_this)->sub_method->base, i_this); if (ret == 1) { - fopDwTg_DrawQTo(&a_this->draw_tag); + fopDwTg_DrawQTo(&((msg_class*)i_this)->draw_tag); } return ret; @@ -39,7 +59,7 @@ static int fopMsg_IsDelete(void* i_this) { static int fopMsg_Delete(void* i_this) { msg_class* a_this = (msg_class*)i_this; - int ret = fpcMtd_Delete(&a_this->sub_method->base, i_this); + int ret = fpcMtd_Delete(&((msg_class*)i_this)->sub_method->base, i_this); fopDwTg_DrawQTo(&a_this->draw_tag); return ret; @@ -53,12 +73,14 @@ static int fopMsg_MSG_TYPE; int fopMsg_Create(void* i_this) { msg_class* a_this = (msg_class*)i_this; + int ret; - if (fpcM_IsFirstCreating(a_this)) { - msg_process_profile_definition* profile = (msg_process_profile_definition*)fpcM_GetProfile(i_this); - a_this->type = fpcBs_MakeOfType(&fopMsg_MSG_TYPE); + if (fpcM_IsFirstCreating(i_this)) { + msg_process_profile_definition* profile = + (msg_process_profile_definition*)fpcM_GetProfile(i_this); + a_this->type = fpcM_MakeOfType(&fopMsg_MSG_TYPE); a_this->sub_method = profile->sub_method; - + fopDwTg_Init(&a_this->draw_tag, a_this); fopMsg_prm_class* append = fopMsgM_GetAppend(a_this); @@ -71,10 +93,9 @@ int fopMsg_Create(void* i_this) { } } - int ret = fpcMtd_Create(&a_this->sub_method->base, a_this); + ret = fpcMtd_Create(&a_this->sub_method->base, a_this); if (ret == cPhs_COMPLEATE_e) { - s32 priority = fpcM_DrawPriority(a_this); - fopDwTg_ToDrawQ(&a_this->draw_tag, priority); + fopDwTg_ToDrawQ(&a_this->draw_tag, fpcM_DrawPriority(a_this)); } return ret; diff --git a/src/f_op/f_op_overlap.cpp b/src/f_op/f_op_overlap.cpp index 6625931ac9..557e9bda08 100644 --- a/src/f_op/f_op_overlap.cpp +++ b/src/f_op/f_op_overlap.cpp @@ -4,26 +4,34 @@ */ #include "f_op/f_op_overlap.h" +#include "JSystem/JKernel/JKRExpHeap.h" #include "f_pc/f_pc_manager.h" +#include "m_Do/m_Do_ext.h" static s32 fopOvlp_Draw(void* i_this) { - overlap_task_class* a_this = (overlap_task_class*)i_this; - return fpcLf_DrawMethod(a_this->submethod, i_this); + s32 ret = fpcLf_DrawMethod(((overlap_task_class*)i_this)->submethod, i_this); + return ret; } static s32 fopOvlp_Execute(void* i_this) { - overlap_task_class* a_this = (overlap_task_class*)i_this; - return fpcMtd_Execute(&a_this->submethod->base, i_this); + s32 ret = fpcMtd_Execute(&((overlap_task_class*)i_this)->submethod->base, i_this); + return ret; } static s32 fopOvlp_IsDelete(void* i_this) { - overlap_task_class* a_this = (overlap_task_class*)i_this; - return fpcMtd_IsDelete(&a_this->submethod->base, i_this); + s32 ret = fpcMtd_IsDelete(&((overlap_task_class*)i_this)->submethod->base, i_this); + return ret; } static s32 fopOvlp_Delete(void* i_this) { - overlap_task_class* a_this = (overlap_task_class*)i_this; - return fpcMtd_Delete(&a_this->submethod->base, i_this); + s32 ret = 0; + ret = fpcMtd_Delete(&((overlap_task_class*)i_this)->submethod->base, i_this); +#if DEBUG + if (ret == 1 && mDoExt_getSafeZeldaHeapSize() >= 0) { + mDoExt_addSafeZeldaHeapSize(mDoExt_getZeldaHeap()->getSize(i_this)); + } +#endif + return ret; } static s32 fopOvlp_Create(void* i_this) { @@ -36,9 +44,15 @@ static s32 fopOvlp_Create(void* i_this) { cReq_Create(&a_this->request, 1); a_this->submethod = profile->sub_method; a_this->scene_id = fpcM_ERROR_PROCESS_ID_e; +#if DEBUG + if (mDoExt_getSafeZeldaHeapSize() >= 0) { + mDoExt_addSafeZeldaHeapSize(-mDoExt_getZeldaHeap()->getSize(i_this)); + } +#endif } - return fpcMtd_Create(&a_this->submethod->base, a_this); + s32 ret = fpcMtd_Create(&a_this->submethod->base, a_this); + return ret; } leafdraw_method_class g_fopOvlp_Method = { diff --git a/src/f_op/f_op_overlap_mng.cpp b/src/f_op/f_op_overlap_mng.cpp index 5ed2a95de8..844b18a16a 100644 --- a/src/f_op/f_op_overlap_mng.cpp +++ b/src/f_op/f_op_overlap_mng.cpp @@ -4,29 +4,32 @@ */ #include "SSystem/SComponent/c_request.h" +#include "m_Do/m_Do_controller_pad.h" #include "f_op/f_op_overlap_mng.h" #include "f_op/f_op_overlap_req.h" +#include "f_op/f_op_scene_mng.h" #include "f_op/f_op_scene_pause.h" -#include "f_pc/f_pc_executor.h" // making it not an array put it in .bss static overlap_request_class* l_fopOvlpM_overlap[1] = {NULL}; int fopOvlpM_SceneIsStop() { if (l_fopOvlpM_overlap[0] != NULL) { - return fopScnPause_Enable( - (scene_class*)fpcEx_SearchByID(l_fopOvlpM_overlap[0]->overlap_task->scene_id)); + fpc_ProcID scene_id = l_fopOvlpM_overlap[0]->overlap_task->scene_id; + scene_class* cls = (scene_class*)fpcM_SearchByID(scene_id); + return fopScnM_PauseEnable(cls); } - + return 0; } int fopOvlpM_SceneIsStart() { if (l_fopOvlpM_overlap[0] != NULL) { - return fopScnPause_Disable( - (scene_class*)fpcEx_SearchByID(l_fopOvlpM_overlap[0]->overlap_task->scene_id)); + fpc_ProcID scene_id = l_fopOvlpM_overlap[0]->overlap_task->scene_id; + scene_class* cls = (scene_class*)fpcM_SearchByID(scene_id); + return fopScnM_PauseDisable(cls); } - + return 0; } @@ -45,23 +48,31 @@ void fopOvlpM_ToldAboutID(fpc_ProcID i_sceneId) { } int fopOvlpM_IsPeek() { - return l_fopOvlpM_overlap[0] != NULL ? l_fopOvlpM_overlap[0]->field_0x8 : FALSE; + if (l_fopOvlpM_overlap[0] != NULL) { + return l_fopOvlpM_overlap[0]->field_0x8; + } + return FALSE; } int fopOvlpM_IsDone() { - return l_fopOvlpM_overlap[0] != NULL ? cReq_Is_Done(&l_fopOvlpM_overlap[0]->base) : FALSE; + if (l_fopOvlpM_overlap[0] != NULL) { + return cReq_Is_Done(&l_fopOvlpM_overlap[0]->base); + } + return FALSE; } int fopOvlpM_IsDoingReq() { if (l_fopOvlpM_overlap[0] != NULL && l_fopOvlpM_overlap[0]->field_0x4 == 1) { return 1; } - - return 0; + return FALSE; } int fopOvlpM_ClearOfReq() { - return l_fopOvlpM_overlap[0] != NULL ? fopOvlpReq_OverlapClr(l_fopOvlpM_overlap[0]) : 0; + if (l_fopOvlpM_overlap[0] != NULL) { + return fopOvlpReq_OverlapClr(l_fopOvlpM_overlap[0]); + } + return FALSE; } static overlap_request_class l_fopOvlpM_Request; @@ -94,6 +105,12 @@ int fopOvlpM_Cancel() { if (fopOvlpReq_Cancel(l_fopOvlpM_overlap[0]) == true) { l_fopOvlpM_overlap[0] = NULL; +#if DEBUG + BOOL state = mDoCPd_c::isConnect(PAD_3); + if (state) { + JUT_WARN(336, "%s", "fopOvlpM_Cancel SUCCESSED"); + } +#endif return 1; } diff --git a/src/f_op/f_op_overlap_req.cpp b/src/f_op/f_op_overlap_req.cpp index 112809a706..28d0a743cc 100644 --- a/src/f_op/f_op_overlap_req.cpp +++ b/src/f_op/f_op_overlap_req.cpp @@ -80,7 +80,7 @@ static int fopOvlpReq_phase_IsCreated(overlap_request_class* i_overlapReq) { static int fopOvlpReq_phase_Create(overlap_request_class* i_overlapReq) { fpcLy_SetCurrentLayer(i_overlapReq->layer); i_overlapReq->request_id = - fpcSCtRq_Request(fpcLy_CurrentLayer(), i_overlapReq->procname, NULL, NULL, NULL); + fpcM_Create(i_overlapReq->procname, NULL, NULL); return cPhs_NEXT_e; } @@ -98,8 +98,7 @@ overlap_request_class* fopOvlpReq_Request(overlap_request_class* i_overlapReq, s }; if (i_overlapReq->field_0x4 == 1) { - i_overlapReq = NULL; - return i_overlapReq; + return NULL; } cReq_Command(&i_overlapReq->base, 1); @@ -116,9 +115,7 @@ overlap_request_class* fopOvlpReq_Request(overlap_request_class* i_overlapReq, s } int fopOvlpReq_Handler(overlap_request_class* i_overlapReq) { - int phase_state = cPhs_Do(&i_overlapReq->phase_req, i_overlapReq); - - switch (phase_state) { + switch (cPhs_Do(&i_overlapReq->phase_req, i_overlapReq)) { case cPhs_NEXT_e: return fopOvlpReq_Handler(i_overlapReq); case cPhs_INIT_e: @@ -136,11 +133,17 @@ int fopOvlpReq_Handler(overlap_request_class* i_overlapReq) { } int fopOvlpReq_Cancel(overlap_request_class* i_overlapReq) { - return fopOvlpReq_phase_Done(i_overlapReq) == cPhs_NEXT_e ? TRUE : FALSE; + if (fopOvlpReq_phase_Done(i_overlapReq) == cPhs_NEXT_e) { + return TRUE; + } + return FALSE; } int fopOvlpReq_Is_PeektimeLimit(overlap_request_class* i_overlapReq) { - return i_overlapReq->peektime == 0 ? TRUE : FALSE; + if (i_overlapReq->peektime == 0) { + return TRUE; + } + return FALSE; } void fopOvlpReq_SetPeektime(overlap_request_class* i_overlapReq, u16 i_peektime) { diff --git a/src/f_op/f_op_scene.cpp b/src/f_op/f_op_scene.cpp index 68624b5548..97a0124b09 100644 --- a/src/f_op/f_op_scene.cpp +++ b/src/f_op/f_op_scene.cpp @@ -5,13 +5,17 @@ #include "f_op/f_op_scene.h" #include "f_pc/f_pc_manager.h" +#include "f_op/f_op_scene_mng.h" +#include "m_Do/m_Do_hostIO.h" static int fopScn_Draw(scene_class* i_this) { - return fpcNd_DrawMethod((nodedraw_method_class*)i_this->submethod, i_this); + int ret = fpcNd_DrawMethod((nodedraw_method_class*)i_this->submethod, i_this); + return ret; } static int fopScn_Execute(scene_class* i_this) { - return fpcMtd_Execute((process_method_class*)i_this->submethod, i_this); + int ret = fpcMtd_Execute((process_method_class*)i_this->submethod, i_this); + return ret; } static int fopScn_IsDelete(void* i_this) { @@ -20,15 +24,21 @@ static int fopScn_IsDelete(void* i_this) { static int fopScn_Delete(void* i_this) { scene_class* scene = (scene_class*)i_this; - int ret = fpcMtd_Delete((process_method_class*)scene->submethod, scene); + int ret = 0; + ret = fpcMtd_Delete((process_method_class*)scene->submethod, scene); if (ret == 1) { fopScnTg_QueueTo(&scene->scene_tag); } +#if DEBUG + mDoHIO_update(); +#endif return ret; } static int fopScn_Create(void* i_this) { scene_class* scene = (scene_class*)i_this; + int ret; + if (fpcM_IsFirstCreating(i_this)) { scene_process_profile_definition* profile = (scene_process_profile_definition*)fpcM_GetProfile(i_this); scene->submethod = profile->submethod; @@ -36,13 +46,15 @@ static int fopScn_Create(void* i_this) { fopScnTg_Init(&scene->scene_tag, i_this); fopScnTg_ToQueue(&scene->scene_tag); - u32* append = (u32*)fpcM_GetAppend(i_this); + u32* append = (u32*)fopScnM_GetAppend(i_this); if (append != NULL) { - scene->base.base.parameters = *append; + fopScnM_SetParam(i_this, *append); } } - return fpcMtd_Create((process_method_class*)scene->submethod, i_this); + + ret = fpcMtd_Create((process_method_class*)scene->submethod, i_this); + return ret; } leafdraw_method_class g_fopScn_Method = { diff --git a/src/f_op/f_op_scene_mng.cpp b/src/f_op/f_op_scene_mng.cpp index b547549200..ba1f322139 100644 --- a/src/f_op/f_op_scene_mng.cpp +++ b/src/f_op/f_op_scene_mng.cpp @@ -4,6 +4,7 @@ */ #include "f_op/f_op_scene_mng.h" +#include "JSystem/JUtility/JUTAssert.h" #include "f_op/f_op_scene_iter.h" #include "f_op/f_op_scene_req.h" @@ -24,13 +25,11 @@ int fopScnM_ChangeReq(scene_class* i_scene, s16 i_procName, s16 param_3, u16 par } fpc_ProcID fopScnM_DeleteReq(scene_class* i_scene) { - fpc_ProcID request_id = fopScnRq_Request(1, i_scene, 0x7FFF, NULL, 0x7FFF, 0); - return request_id != fpcM_ERROR_PROCESS_ID_e; + return fopScnRq_Request(1, i_scene, 0x7FFF, NULL, 0x7FFF, 0) != fpcM_ERROR_PROCESS_ID_e; } int fopScnM_CreateReq(s16 i_procName, s16 param_2, u16 param_3, u32 i_data) { - fpc_ProcID request_id = fopScnRq_Request(0, 0, i_procName, (void*)i_data, param_2, param_3); - return request_id != fpcM_ERROR_PROCESS_ID_e; + return fopScnRq_Request(0, 0, i_procName, (void*)i_data, param_2, param_3) != fpcM_ERROR_PROCESS_ID_e; } u32 fopScnM_ReRequest(s16 i_procName, u32 i_data) { @@ -42,7 +41,14 @@ u32 fopScnM_ReRequest(s16 i_procName, u32 i_data) { } void fopScnM_Management() { +#if DEBUG + if (fopScnRq_Handler()) { + return; + }; + JUT_ASSERT(326, 0); +#else fopScnRq_Handler(); +#endif } void fopScnM_Init() {} diff --git a/src/f_op/f_op_scene_pause.cpp b/src/f_op/f_op_scene_pause.cpp index 3628f188e8..db98067143 100644 --- a/src/f_op/f_op_scene_pause.cpp +++ b/src/f_op/f_op_scene_pause.cpp @@ -19,7 +19,7 @@ int fopScnPause_Enable(scene_class* i_scene) { int fopScnPause_Disable(scene_class* i_scene) { if (i_scene != NULL) { - process_node_class* process_node = i_scene->base.base.layer_tag.layer->process_node; + process_node_class* process_node = fpcM_Layer(i_scene); if (process_node == NULL) { fpcM_PauseDisable(i_scene, 1); diff --git a/src/f_op/f_op_scene_req.cpp b/src/f_op/f_op_scene_req.cpp index 8bf1afd91f..d3136962ae 100644 --- a/src/f_op/f_op_scene_req.cpp +++ b/src/f_op/f_op_scene_req.cpp @@ -11,11 +11,13 @@ #include "f_pc/f_pc_manager.h" static cPhs__Step fopScnRq_phase_ClearOverlap(scene_request_class* i_sceneReq) { + cPhs__Step rv; if (fopOvlpM_ClearOfReq() == 1) { - return cPhs_NEXT_e; + rv = cPhs_NEXT_e; } else { - return cPhs_INIT_e; + rv = cPhs_INIT_e; } + return rv; } static cPhs__Step fopScnRq_phase_Execute(scene_request_class* i_sceneReq) { @@ -23,26 +25,31 @@ static cPhs__Step fopScnRq_phase_Execute(scene_request_class* i_sceneReq) { } static cPhs__Step fopScnRq_phase_IsDoingOverlap(scene_request_class* i_sceneReq) { + cPhs__Step rv; if (fopOvlpM_IsDoingReq() == 1) { - return cPhs_NEXT_e; + rv = cPhs_NEXT_e; } else { - return cPhs_INIT_e; + rv = cPhs_INIT_e; } + return rv; } static cPhs__Step fopScnRq_phase_IsDoneOverlap(scene_request_class* i_sceneReq) { + cPhs__Step rv; if (fopOvlpM_IsDone() == 1) { - return cPhs_NEXT_e; + rv = cPhs_NEXT_e; } else { - return cPhs_INIT_e; + rv = cPhs_INIT_e; } + return rv; } static BOOL l_fopScnRq_IsUsingOfOverlap; static cPhs__Step fopScnRq_phase_Done(scene_request_class* i_sceneReq) { if (i_sceneReq->create_request.parameters != 1) { - fopScnPause_Disable((scene_class*)fpcEx_SearchByID(i_sceneReq->create_request.creating_id)); + scene_class* scene = (scene_class*)fpcM_SearchByID(i_sceneReq->create_request.creating_id); + fopScnPause_Disable(scene); } l_fopScnRq_IsUsingOfOverlap = FALSE; @@ -55,6 +62,9 @@ static void fopScnRq_Execute(scene_request_class* i_sceneReq) { switch (phase_state) { case cPhs_NEXT_e: fopScnRq_Execute(i_sceneReq); + break; + default: + break; } } @@ -77,9 +87,11 @@ static int fopScnRq_Cancel(scene_request_class* i_sceneReq) { static scene_request_class* fopScnRq_FadeRequest(s16 i_procname, u16 i_peektime) { overlap_request_class* req = NULL; - if (!l_fopScnRq_IsUsingOfOverlap && (req = fopOvlpM_Request(i_procname, i_peektime), req != NULL)) - { - l_fopScnRq_IsUsingOfOverlap = TRUE; + if (!l_fopScnRq_IsUsingOfOverlap) { + req = fopOvlpM_Request(i_procname, i_peektime); + if (req != NULL) { + l_fopScnRq_IsUsingOfOverlap = TRUE; + } } return (scene_request_class*)req; @@ -145,6 +157,6 @@ s32 fopScnRq_ReRequest(fpc_ProcID i_requestId, s16 i_procName, void* i_data) { return fpcNdRq_ReRequest(i_requestId, i_procName, i_data); } -void fopScnRq_Handler() { +int fopScnRq_Handler() { fpcNdRq_Handler(); } diff --git a/src/f_op/f_op_view.cpp b/src/f_op/f_op_view.cpp index 0265048740..c48f7eb0f7 100644 --- a/src/f_op/f_op_view.cpp +++ b/src/f_op/f_op_view.cpp @@ -6,31 +6,36 @@ #include "f_op/f_op_view.h" #include "f_pc/f_pc_manager.h" -void fopVw_Draw(view_class* i_this) { - fpcLf_DrawMethod(i_this->sub_method, i_this); +s32 fopVw_Draw(view_class* i_this) { + int ret = fpcLf_DrawMethod(i_this->sub_method, i_this); + return ret; } -void fopVw_Execute(view_class* i_this) { - fpcMtd_Execute(&i_this->sub_method->base, i_this); +s32 fopVw_Execute(view_class* i_this) { + int ret = fpcMtd_Execute(&i_this->sub_method->base, i_this); + return ret; } s32 fopVw_IsDelete(void* i_this) { - view_class* a_this = (view_class*)i_this; - return fpcMtd_IsDelete(&a_this->sub_method->base, a_this); + int ret = fpcMtd_IsDelete(&((view_class*)i_this)->sub_method->base, i_this); + return ret; } s32 fopVw_Delete(view_class* i_this) { - return fpcMtd_Delete(&i_this->sub_method->base, i_this); + int ret = fpcMtd_Delete(&i_this->sub_method->base, i_this); + return ret; } s32 fopVw_Create(void* i_this) { view_class* a_this = (view_class*)i_this; + int ret; - view_process_profile_definition* profile = (view_process_profile_definition*)fpcM_GetProfile(a_this); + view_process_profile_definition* profile = (view_process_profile_definition*)fpcM_GetProfile(i_this); a_this->sub_method = profile->sub_method; a_this->field_0xc4 = profile->unk_0x28; - return fpcMtd_Create(&a_this->sub_method->base, a_this); + ret = fpcMtd_Create(&a_this->sub_method->base, a_this); + return ret; } leafdraw_method_class g_fopVw_Method = { diff --git a/src/f_pc/f_pc_manager.cpp b/src/f_pc/f_pc_manager.cpp index 4e49170d59..a6acd65848 100644 --- a/src/f_pc/f_pc_manager.cpp +++ b/src/f_pc/f_pc_manager.cpp @@ -7,6 +7,7 @@ #include "SSystem/SComponent/c_API_graphic.h" #include "d/d_error_msg.h" #include "d/d_lib.h" +#include "f_op/f_op_scene.h" #include "f_pc/f_pc_creator.h" #include "f_pc/f_pc_deletor.h" #include "f_pc/f_pc_draw.h" diff --git a/src/m_Do/m_Do_hostIO.cpp b/src/m_Do/m_Do_hostIO.cpp index 286a942110..7ee6a3653b 100644 --- a/src/m_Do/m_Do_hostIO.cpp +++ b/src/m_Do/m_Do_hostIO.cpp @@ -128,6 +128,10 @@ void mDoHIO_updateChild(s8 i_no) { mDoHIO_root.updateChild(i_no); } +void mDoHIO_update() { + mDoHIO_root.update(); +} + void mDoHIO_root_c::updateChild(s8 i_no) { mSub.updateChild(i_no); }