diff --git a/config/RZDE01_00/symbols.txt b/config/RZDE01_00/symbols.txt index fde9a067c7..bda5588b99 100644 --- a/config/RZDE01_00/symbols.txt +++ b/config/RZDE01_00/symbols.txt @@ -26185,7 +26185,7 @@ lbl_80537A93 = .sdata:0x80537A93; // type:object size:0x8 data:string lbl_80537A9B = .sdata:0x80537A9B; // type:object size:0x7 data:string lbl_80537AA2 = .sdata:0x80537AA2; // type:object size:0x5 data:string lbl_80537AA7 = .sdata:0x80537AA7; // type:object size:0x8 data:string -lbl_80537AAF = .sdata:0x80537AAF; // type:object size:0x1 data:byte +g_blackColor = .sdata:0x80537AAF; // type:object size:0x1 data:byte lbl_80537AB0 = .sdata:0x80537AB0; // type:object size:0x1 data:byte lbl_80537AB1 = .sdata:0x80537AB1; // type:object size:0x1 data:byte lbl_80537AB2 = .sdata:0x80537AB2; // type:object size:0x1 data:byte diff --git a/config/RZDE01_02/symbols.txt b/config/RZDE01_02/symbols.txt index 7879acbfed..8d6aea7ca7 100644 --- a/config/RZDE01_02/symbols.txt +++ b/config/RZDE01_02/symbols.txt @@ -25761,7 +25761,7 @@ lbl_8051DB33 = .sdata:0x8051DB33; // type:object size:0x8 data:string lbl_8051DB3B = .sdata:0x8051DB3B; // type:object size:0x7 data:string lbl_8051DB42 = .sdata:0x8051DB42; // type:object size:0x5 data:string lbl_8051DB47 = .sdata:0x8051DB47; // type:object size:0x8 data:string -lbl_8051DB4F = .sdata:0x8051DB4F; // type:object size:0x1 data:byte +g_blackColor = .sdata:0x8051DB4F; // type:object size:0x1 data:byte lbl_8051DB50 = .sdata:0x8051DB50; // type:object size:0x1 data:byte lbl_8051DB51 = .sdata:0x8051DB51; // type:object size:0x1 data:byte lbl_8051DB52 = .sdata:0x8051DB52; // type:object size:0x1 data:byte diff --git a/config/RZDJ01/symbols.txt b/config/RZDJ01/symbols.txt index c0d0fdf6ba..25a002b8e0 100644 --- a/config/RZDJ01/symbols.txt +++ b/config/RZDJ01/symbols.txt @@ -25762,7 +25762,7 @@ lbl_8051B9AB = .sdata:0x8051B9AB; // type:object size:0x8 data:string lbl_8051B9B3 = .sdata:0x8051B9B3; // type:object size:0x7 data:string lbl_8051B9BA = .sdata:0x8051B9BA; // type:object size:0x5 data:string lbl_8051B9BF = .sdata:0x8051B9BF; // type:object size:0x8 data:string -lbl_8051B9C7 = .sdata:0x8051B9C7; // type:object size:0x1 data:byte +g_blackColor = .sdata:0x8051B9C7; // type:object size:0x1 data:byte lbl_8051B9C8 = .sdata:0x8051B9C8; // type:object size:0x1 data:byte lbl_8051B9C9 = .sdata:0x8051B9C9; // type:object size:0x1 data:byte lbl_8051B9CA = .sdata:0x8051B9CA; // type:object size:0x1 data:byte @@ -27811,6 +27811,7 @@ mParticleTracePCB__13dPa_control_c = .sbss:0x8051E988; // type:object size:0x4 s mWipe__12dDlst_list_c = .sbss:0x8051E990; // type:object size:0x1 data:byte mWipeRate__12dDlst_list_c = .sbss:0x8051E994; // type:object size:0x4 scope:global align:4 data:float mWipeSpeed__12dDlst_list_c = .sbss:0x8051E998; // type:object size:0x4 scope:global align:4 data:float +lbl_8051E99C = .sbss:0x8051E99C; // type:object size:0x4 init$0000 = .sbss:0x8051E9A0; // type:object size:0x1 scope:local data:byte S_parcent_bak$99593 = .sbss:0x8051E9A8; // type:object size:0x4 scope:local align:4 data:float S_rot_work1$100794 = .sbss:0x8051E9AC; // type:object size:0x2 scope:local align:4 data:2byte diff --git a/config/RZDP01/symbols.txt b/config/RZDP01/symbols.txt index f09f341b02..e0c400af98 100644 --- a/config/RZDP01/symbols.txt +++ b/config/RZDP01/symbols.txt @@ -25757,7 +25757,7 @@ lbl_8051E433 = .sdata:0x8051E433; // type:object size:0x8 data:string lbl_8051E43B = .sdata:0x8051E43B; // type:object size:0x7 data:string lbl_8051E442 = .sdata:0x8051E442; // type:object size:0x5 data:string lbl_8051E447 = .sdata:0x8051E447; // type:object size:0x8 data:string -lbl_8051E44F = .sdata:0x8051E44F; // type:object size:0x1 data:byte +g_blackColor = .sdata:0x8051E44F; // type:object size:0x1 data:byte lbl_8051E450 = .sdata:0x8051E450; // type:object size:0x1 data:byte lbl_8051E451 = .sdata:0x8051E451; // type:object size:0x1 data:byte lbl_8051E452 = .sdata:0x8051E452; // type:object size:0x1 data:byte diff --git a/config/Shield/rels/d_a_npc_taro/symbols.txt b/config/Shield/rels/d_a_npc_taro/symbols.txt index 39cc7aa76e..a098750d56 100644 --- a/config/Shield/rels/d_a_npc_taro/symbols.txt +++ b/config/Shield/rels/d_a_npc_taro/symbols.txt @@ -270,5 +270,5 @@ lbl_88_data_1BD8 = .data:0x00001BD8; // type:object size:0x24 @120156 = .data:0x00001DD4; // type:object size:0xC scope:local data:string @120184 = .data:0x00001DF4; // type:object size:0xD scope:local data:string l_HIO = .bss:0x00000000; // type:object size:0x4 scope:global -lbl_88_bss_4 = .bss:0x00000004; // type:object size:0x1 data:byte +@GUARD@setAttnPos__12daNpc_Taro_cFv@prtclScl = .bss:0x00000004; // type:object size:0x1 data:byte @LOCAL@setAttnPos__12daNpc_Taro_cFv@prtclScl = .bss:0x00000008; // type:object size:0xC scope:local align:4 data:float diff --git a/config/ShieldD/rels/d_a_tag_firewallD/symbols.txt b/config/ShieldD/rels/d_a_tag_firewallD/symbols.txt index d336822da0..6a14227b8a 100644 --- a/config/ShieldD/rels/d_a_tag_firewallD/symbols.txt +++ b/config/ShieldD/rels/d_a_tag_firewallD/symbols.txt @@ -30,4 +30,4 @@ game_over_eff_name__11Tag_FWall_n = .data:0x00000040; // type:object size:0x8 sc l_daTag_FWall_Method = .data:0x00000060; // type:object size:0x20 scope:global g_profile_Tag_FWall = .data:0x00000080; // type:object size:0x30 scope:global fire_leader = .bss:0x00000000; // type:object size:0x4 scope:global -lbl_708_bss_4 = .bss:0x00000004; // type:object size:0x1 data:byte +fire_num = .bss:0x00000004; // type:object size:0x1 data:byte diff --git a/config/ShieldD/rels/d_a_tag_waterfallD/symbols.txt b/config/ShieldD/rels/d_a_tag_waterfallD/symbols.txt index cb049717ff..5065ceba03 100644 --- a/config/ShieldD/rels/d_a_tag_waterfallD/symbols.txt +++ b/config/ShieldD/rels/d_a_tag_waterfallD/symbols.txt @@ -61,5 +61,5 @@ __RTTI__20daTagWaterFall_HIO_c = .data:0x000001A0; // type:object size:0x8 scope @118516 = .data:0x000001A8; // type:object size:0xE scope:local data:string @118517 = .data:0x000001B8; // type:object size:0xC scope:local @118518 = .data:0x000001DC; // type:object size:0x11 scope:local data:string -lbl_743_bss_0 = .bss:0x00000000; // type:object size:0x1 data:byte +masterWaterfallTagExists = .bss:0x00000000; // type:object size:0x1 data:byte l_HIO = .bss:0x00000004; // type:object size:0x24 scope:global data:byte diff --git a/configure.py b/configure.py index c8592a73a3..56bcdde7c8 100755 --- a/configure.py +++ b/configure.py @@ -2130,19 +2130,19 @@ config.libs = [ ActorRel(MatchingFor(ALL_GCN), "d_a_set_bgobj"), ActorRel(MatchingFor(ALL_GCN), "d_a_swhit0"), ActorRel(MatchingFor(ALL_GCN), "d_a_tag_allmato"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_camera"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_chkpoint"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_event"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_evt"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_evtarea"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_evtmsg"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_howl"), + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_camera"), # debug extra weak fns + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_chkpoint"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_event"), # TODO: this is part of Rframework in ShieldD + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_evt"), # debug extra weak fns + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_evtarea"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_evtmsg"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_howl"), # debug weak func order ActorRel(MatchingFor(ALL_GCN), "d_a_tag_kmsg"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_lantern"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_mist"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_msg"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_push"), - ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_telop"), + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_lantern"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_mist"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_msg"), # TODO: this is part of Rframework in ShieldD + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_push"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_telop"), # debug weak func order ActorRel(MatchingFor(ALL_GCN), "d_a_tbox"), ActorRel(MatchingFor(ALL_GCN), "d_a_tbox2"), ActorRel(MatchingFor(ALL_GCN), "d_a_vrbox"), @@ -2223,19 +2223,19 @@ config.libs = [ ActorRel(MatchingFor(ALL_GCN), "d_a_shop_item"), ActorRel(MatchingFor(ALL_GCN), "d_a_sq"), ActorRel(MatchingFor(ALL_GCN), "d_a_swc00"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_CstaSw"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_ajnot"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_attack_item"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_gstart"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_hinit"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_hjump"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_hstop"), - ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_lv2prchk"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_magne"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_mhint"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_mstop"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_spring"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_statue_evt"), + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_CstaSw"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_ajnot"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_attack_item"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_gstart"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_hinit"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_hjump"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_hstop"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_lv2prchk"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_magne"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_mhint"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_mstop"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_spring"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_statue_evt"), # debug weak func order ActorRel(MatchingFor(ALL_GCN), "d_a_ykgr"), ActorRel(MatchingFor(ALL_GCN), "d_a_L7demo_dr"), ActorRel(MatchingFor(ALL_GCN), "d_a_L7low_dr"), @@ -2805,7 +2805,7 @@ config.libs = [ ActorRel(MatchingFor(ALL_GCN), "d_a_obj_zra_freeze"), ActorRel(MatchingFor(ALL_GCN), "d_a_obj_zra_rock"), ActorRel(MatchingFor(ALL_GCN), "d_a_passer_mng"), - ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_arena"), + ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_arena"), # debug weak func order ActorRel(MatchingFor(ALL_GCN), "d_a_peru"), ActorRel(MatchingFor(ALL_GCN), "d_a_ppolamp"), ActorRel(MatchingFor(ALL_GCN), "d_a_skip_2D"), @@ -2813,49 +2813,49 @@ config.libs = [ ActorRel(MatchingFor(ALL_GCN), "d_a_swBall"), ActorRel(MatchingFor(ALL_GCN), "d_a_swLBall"), ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_swTime"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_Lv6Gate"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_Lv7Gate"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_Lv8Gate"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_TWgate"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_lv6CstaSw"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_assistance"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_bottle_item"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_chgrestart"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_csw"), - ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_escape"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_firewall"), - ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_gra"), - ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_guard"), - ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_instruction"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_kago_fall"), - ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_lightball"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_lv5soup"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_mmsg"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_mwait"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_myna2"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_myna_light"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_pachi"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_poFire"), + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_Lv6Gate"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_Lv7Gate"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_Lv8Gate"), # debug .data + weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_TWgate"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_lv6CstaSw"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_assistance"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_bottle_item"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_chgrestart"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_csw"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN, ALL_WII, "Shield"), "d_a_tag_escape"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_firewall"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN, ALL_WII, "Shield"), "d_a_tag_gra"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_guard"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN, ALL_WII, "Shield"), "d_a_tag_instruction"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_kago_fall"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_lightball"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_lv5soup"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_mmsg"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_mwait"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_myna2"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_myna_light"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_pachi"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_poFire"), # debug weak func order ActorRel(MatchingFor(ALL_GCN), "d_a_tag_qs"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_ret_room"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_river_back"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_rmbit_sw"), - ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_schedule"), - ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tag_setBall"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_setrestart"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_shop_camera"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_shop_item"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_smk_emt"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_spinner"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_sppath"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_ss_drink"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_stream"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_theB_hint"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_wara_howl"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_watchge"), - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_waterfall"), + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_ret_room"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_river_back"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_rmbit_sw"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN, ALL_WII, "Shield"), "d_a_tag_schedule"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN, ALL_WII, "Shield"), "d_a_tag_setBall"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_setrestart"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_shop_camera"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_shop_item"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_smk_emt"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_spinner"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_sppath"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_ss_drink"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_stream"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_theB_hint"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_wara_howl"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_watchge"), # debug weak func order + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_waterfall"), # debug weak func order ActorRel(MatchingFor(ALL_GCN), "d_a_tag_wljump"), # debug weak func order - ActorRel(MatchingFor(ALL_GCN), "d_a_tag_yami"), + ActorRel(MatchingFor(ALL_GCN), "d_a_tag_yami"), # debug weak func order ActorRel(MatchingFor(ALL_GCN), "d_a_talk"), ActorRel(MatchingFor(ALL_GCN, "Shield"), "d_a_tboxSw"), ActorRel(MatchingFor(ALL_GCN), "d_a_title"), diff --git a/include/d/actor/d_a_cstatue.h b/include/d/actor/d_a_cstatue.h index ca888e7dc4..e20e683398 100644 --- a/include/d/actor/d_a_cstatue.h +++ b/include/d/actor/d_a_cstatue.h @@ -5,22 +5,6 @@ #include "d/d_particle_copoly.h" #include "f_op/f_op_actor.h" -enum daCstatue_FLG0 { - daCstatue_FLG0_1 = 0x1, - daCstatue_FLG0_2 = 0x2, - daCstatue_FLG0_4 = 0x4, - daCstatue_FLG0_8 = 0x8, - daCstatue_FLG0_10 = 0x10, - daCstatue_FLG0_20 = 0x20, - daCstatue_FLG0_Demo = 0x40, - daCstatue_FLG0_80 = 0x80, - daCstatue_FLG0_100 = 0x100, - daCstatue_FLG0_200 = 0x200, - daCstatue_FLG0_400 = 0x400, - daCstatue_FLG0_800 = 0x800, - daCstatue_FLG0_1000 = 0x1000, -}; - enum daCstatue_MoveMode { daCstatue_MoveMode_0, daCstatue_MoveMode_1, @@ -58,6 +42,22 @@ enum daCstatueType { * */ class daCstatue_c : public fopAc_ac_c { + enum daCstatue_FLG0 { + daCstatue_FLG0_1 = 0x1, + daCstatue_FLG0_2 = 0x2, + daCstatue_FLG0_4 = 0x4, + daCstatue_FLG0_8 = 0x8, + daCstatue_FLG0_10 = 0x10, + daCstatue_FLG0_20 = 0x20, + daCstatue_FLG0_Demo = 0x40, + daCstatue_FLG0_80 = 0x80, + daCstatue_FLG0_100 = 0x100, + daCstatue_FLG0_200 = 0x200, + daCstatue_FLG0_400 = 0x400, + daCstatue_FLG0_800 = 0x800, + daCstatue_FLG0_1000 = 0x1000, + }; + public: void atHitCallback(fopAc_ac_c*); int createHeap(); diff --git a/include/d/actor/d_a_npc4.h b/include/d/actor/d_a_npc4.h index 7c311d0733..8b82886e62 100644 --- a/include/d/actor/d_a_npc4.h +++ b/include/d/actor/d_a_npc4.h @@ -388,7 +388,7 @@ public: } BOOL checkHide() { return mHide || (mTwilight && !dComIfGs_wolfeye_effect_check()); } void setIntDemander(fopAc_ac_c* i_actor) { field_0x824.entry(i_actor); } - void setIntFlowNodeNo(int i_flowNodeNo) { mFlowNodeNo = i_flowNodeNo; } + void setIntFlowNodeNo(s32 i_flowNodeNo) { mFlowNodeNo = i_flowNodeNo; } void setCutType(int i_cutType) { mCutType = i_cutType; } void onInterrupt(u8 param_0) { field_0x9ef = param_0; } void onHide() { mHide = true; } diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index 9131286505..fdbb0bc0f7 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -336,7 +336,7 @@ public: FLG0_FAST_SWORD_CUT = 0x80000, FLG0_UNK_40000 = 0x40000, FLG0_DK_CAUGHT2 = 0x20000, - FLG0_UNK_10000 = 0x10000, + FLG0_DEMO_STREAM_ACCEPT = 0x10000, FLG0_UNK_8000 = 0x8000, FLG0_UNK_4000 = 0x4000, FLG0_UNK_2000 = 0x2000, @@ -951,6 +951,8 @@ public: void onTraningCutLargeTurn() { onNoResetFlg3(FLG3_TRANING_CUT_LARGE_TURN); } void onTraningCutDown() { onNoResetFlg3(FLG3_TRANING_CUT_DOWN); } void onTraningShieldAttack() { onNoResetFlg3(FLG3_TRANING_SHIELD_ATTACK); } + void onDemoStreamAccept() { onNoResetFlg0(FLG0_DEMO_STREAM_ACCEPT); } + void offDemoStreamAccept() { offNoResetFlg0(FLG0_DEMO_STREAM_ACCEPT); } BOOL checkStickArrowReset() const { return checkResetFlg0(RFLG0_STICK_ARROW_RESET); } BOOL getCutAtFlg() const { return checkNoResetFlg0(FLG0_CUT_AT_FLG); } diff --git a/include/d/actor/d_a_tag_CstaSw.h b/include/d/actor/d_a_tag_CstaSw.h index 691342c14a..b40a9d178e 100644 --- a/include/d/actor/d_a_tag_CstaSw.h +++ b/include/d/actor/d_a_tag_CstaSw.h @@ -14,7 +14,7 @@ public: int Draw(); int Delete(); - u8 getSw() { return fopAcM_GetParamBit(this, 0, 8); } + u32 getSw() { return fopAcM_GetParamBit(this, 0, 8); } private: /* 0x568 */ u8 mSwitch; @@ -25,11 +25,11 @@ private: class daTagCstaSw_HIO_c : public mDoHIO_entry_c { public: daTagCstaSw_HIO_c(); - virtual ~daTagCstaSw_HIO_c(); + virtual ~daTagCstaSw_HIO_c() {} void genMessage(JORMContext*); - u8 unk_0x4; + u8 show_range; }; #endif /* D_A_TAG_CSTASW_H */ diff --git a/include/d/actor/d_a_tag_Lv6Gate.h b/include/d/actor/d_a_tag_Lv6Gate.h index 504f6c2fed..d8a248db91 100644 --- a/include/d/actor/d_a_tag_Lv6Gate.h +++ b/include/d/actor/d_a_tag_Lv6Gate.h @@ -6,7 +6,7 @@ class daTagLv6Gate_c : public fopAc_ac_c { public: - int createHeap(); + inline int createHeap(); int create(); inline int execute(); int draw(); diff --git a/include/d/actor/d_a_tag_Lv7Gate.h b/include/d/actor/d_a_tag_Lv7Gate.h index db7b15d22e..efbb88b0cf 100644 --- a/include/d/actor/d_a_tag_Lv7Gate.h +++ b/include/d/actor/d_a_tag_Lv7Gate.h @@ -6,23 +6,23 @@ class daTagLv7Gate_c : public fopAc_ac_c { public: int create(); - void create_init(); - int execute(); + inline void create_init(); + inline int execute(); void calcFly(); inline ~daTagLv7Gate_c(); inline int createHeap(); - inline void setPath(u8 i_path_ID); + inline int setPath(int i_path_ID); inline void initBaseMtx(); inline void setBaseMtx(); inline void flyAnime(); - inline bool checkPoint(f32 i_speed); + inline bool checkPoint(cXyz& i_point, f32 i_speed); inline bool setNextPoint(); inline int draw(); - u8 getPathID() { return fopAcM_GetParam(this) >> 0x10; } - u16 getFlowNodeNo() { return fopAcM_GetParam(this); } + u8 getPathID() { return (fopAcM_GetParam(this) >> 16) & 0xFF; } + s16 getFlowNodeNo() { return (u16)fopAcM_GetParam(this); } /* 0x568 */ J3DModel* mpModel; /* 0x56C */ mDoExt_bckAnm* mpBck; diff --git a/include/d/actor/d_a_tag_Lv8Gate.h b/include/d/actor/d_a_tag_Lv8Gate.h index 9cf455a739..31f3e41e49 100644 --- a/include/d/actor/d_a_tag_Lv8Gate.h +++ b/include/d/actor/d_a_tag_Lv8Gate.h @@ -10,8 +10,8 @@ class daTagLv8Gate_c : public fopAc_ac_c { public: inline ~daTagLv8Gate_c(); - int createHeap(); - int execute(); + inline int createHeap(); + inline int execute(); void initBaseMtx(); void create_init(); diff --git a/include/d/actor/d_a_tag_TWgate.h b/include/d/actor/d_a_tag_TWgate.h index 495be5bad2..e5952da286 100644 --- a/include/d/actor/d_a_tag_TWgate.h +++ b/include/d/actor/d_a_tag_TWgate.h @@ -8,6 +8,26 @@ class daTagTWGate_c; typedef void (daTagTWGate_c::*actionFunc)(); +struct daTagTWGate_Attr_c { + /* 0x00 */ u8 show_range; +}; + +class daTagTWGate_Hio_c : public mDoHIO_entry_c { +public: + daTagTWGate_Hio_c(); + + inline void ct(); + + inline void dt(); + + void default_set(); + + inline void genMessage(JORMContext*); + + /* 0x08 */ int field_0x8; + /* 0x0C */ daTagTWGate_Attr_c attr; +}; + class daTagTWGate_c : public fopAc_ac_c { public: enum EType { @@ -31,6 +51,7 @@ public: /* 0x0A */ ACT_DEMO_HYRAL_1, /* 0x0B */ ACT_DEMO_HYRAL_2, /* 0x0C */ ACT_DEMO_HYRAL_3, + /* 0x0D */ MODE_MAX_e, }; inline ~daTagTWGate_c(); @@ -62,65 +83,47 @@ public: void initDemoHyral3(); void executeDemoHyral3(); void initBaseMtx(); - int downloadModels(); + inline int downloadModels(); void initTalk(int, fopAc_ac_c**); bool talkProc(int*, int, fopAc_ac_c**); static int createHeapCallBack(fopAc_ac_c*); int CreateHeap(); - u8 getSwitch() { return fopAcM_GetParam(this) >> 8; } + u8 getSwitch() { return (fopAcM_GetParam(this) >> 8) & 0xFF; } u8 getType() { return fopAcM_GetParam(this); } inline int create(); - void create_init() { - field_0x5e0 = 0; - mActionID = 0; - mAction = &ActionTable[mActionID][0]; - (this->**mAction)(); + inline void create_init(); + + inline void callExecute(); + + inline int execute(); + + inline int draw(); + +#if DEBUG + daTagTWGate_Attr_c& attr() const { + return mHio.attr; } +#endif - void callExecute() { - (this->*mAction[1])(); - mDoAud_seStartLevel(Z2SE_OBJ_DARK_GATE, ¤t.pos, 0, 0); - } + inline void callInit(); - int execute() { - callExecute(); + inline void setAction(Mode_e i_action); - if (field_0x5e0 != 0) { - mpMorf->play(0, 0); - mpMorf->modelCalc(); - } - return 1; - } - - int draw() { - if (field_0x5e0 != 0) { - mpMorf->entryDL(); - } - return 1; - } - - void callInit() { - (this->*(*mAction))(); - } - - void setAction(Mode_e action) { - mActionID = action; - mAction = ActionTable[mActionID]; - callInit(); - } - - static u8 const mAttr[1]; - static actionFunc ActionTable[13][2]; + static daTagTWGate_Attr_c const mAttr; +#if DEBUG + static daTagTWGate_Hio_c mHio; +#endif + static const actionFunc ActionTable[][2]; private: /* 0x568 */ mDoExt_McaMorfSO* mpMorf; /* 0x56C */ request_of_phase_process_class mPhaseZevArc; /* 0x574 */ request_of_phase_process_class mPhaseMdRes; /* 0x57C */ request_of_phase_process_class mPhasePyRes; - /* 0x584 */ actionFunc* mAction; + /* 0x584 */ const actionFunc* mAction; /* 0x588 */ int mActionID; /* 0x58C */ dMsgFlow_c mMsgFlow; /* 0x5D8 */ u8 field_0x5d8[4]; diff --git a/include/d/actor/d_a_tag_assistance.h b/include/d/actor/d_a_tag_assistance.h index 73f71e297f..8262cf3ff0 100644 --- a/include/d/actor/d_a_tag_assistance.h +++ b/include/d/actor/d_a_tag_assistance.h @@ -5,21 +5,9 @@ class daTagAssist_c : public fopAc_ac_c { public: - void create_init() { - attention_info.flags = 0; - field_0x570 = -1; - } - - int create() { - fopAcM_ct(this, daTagAssist_c); - create_init(); - return cPhs_COMPLEATE_e; - } - - int execute() { - fopAcM_searchPlayerDistanceXZ(this); - return 1; - } + inline void create_init(); + inline int create(); + inline int execute(); u8 field_0x568[8]; s16 field_0x570; diff --git a/include/d/actor/d_a_tag_attack_item.h b/include/d/actor/d_a_tag_attack_item.h index 1f33cb9f83..b24c67003e 100644 --- a/include/d/actor/d_a_tag_attack_item.h +++ b/include/d/actor/d_a_tag_attack_item.h @@ -16,6 +16,7 @@ public: void action(); BOOL checkHit(); void createItem(); + int draw(); int _delete(); virtual ~daTagAtkItem_c() {} diff --git a/include/d/actor/d_a_tag_attention.h b/include/d/actor/d_a_tag_attention.h index 45d2292bec..37969d8903 100644 --- a/include/d/actor/d_a_tag_attention.h +++ b/include/d/actor/d_a_tag_attention.h @@ -4,6 +4,22 @@ #include "d/d_com_inf_game.h" #include "f_op/f_op_actor_mng.h" +class daAttp_HIO_c : public mDoHIO_entry_c { +public: + daAttp_HIO_c(); + + void genMessage(JORMContext*); + + /* 0x06 */ u8 enable_type_switching; + /* 0x07 */ u8 type_spec; + /* 0x08 */ u8 enable_distance_display; + /* 0x0C */ f32 dist_max; + /* 0x10 */ f32 dist_max_release; + /* 0x14 */ f32 dist_adjust; + /* 0x18 */ f32 upper_y; + /* 0x1C */ f32 lower_y; +}; + class daAttp_c : public fopAc_ac_c { public: int Create(); @@ -11,28 +27,33 @@ public: int execute(); int draw(); int _delete(); + +#if DEBUG + Mtx field_0x568; + u8 field_0x598; +#endif }; // Size: 0x568 namespace daAttp_prm { -static inline u32 getArg0(daAttp_c* pActor) { - return fopAcM_GetParam(pActor) & 3; +static inline u8 getArg0(daAttp_c* pActor) { + return fopAcM_GetParam(pActor) & 0x3; } -static inline u32 getArg1(daAttp_c* pActor) { - return (fopAcM_GetParam(pActor) >> 2) & 3; +static inline u8 getArg1(daAttp_c* pActor) { + return (fopAcM_GetParam(pActor) >> 2) & 0x3; } -static inline u32 getArg2(daAttp_c* pActor) { - return (fopAcM_GetParam(pActor) >> 4) & 7; +static inline u8 getArg2(daAttp_c* pActor) { + return (fopAcM_GetParam(pActor) >> 4) & 0x7; } -static inline u32 getArg3(daAttp_c* pActor) { - return (fopAcM_GetParam(pActor) >> 7) & 1; +static inline u8 getArg3(daAttp_c* pActor) { + return (fopAcM_GetParam(pActor) >> 7) & 0x1; } -static inline u32 getArg4(daAttp_c* pActor) { - return (fopAcM_GetParam(pActor) >> 8) & 1; +static inline u8 getArg4(daAttp_c* pActor) { + return (fopAcM_GetParam(pActor) >> 8) & 0x1; } -static inline u32 getSw1(daAttp_c* pActor) { +static inline u8 getSw1(daAttp_c* pActor) { return (fopAcM_GetParam(pActor) >> 0x10) & 0xff; } -static inline u32 getSw2(daAttp_c* pActor) { +static inline u8 getSw2(daAttp_c* pActor) { return (fopAcM_GetParam(pActor) >> 0x18); } } // namespace daAttp_prm diff --git a/include/d/actor/d_a_tag_bottle_item.h b/include/d/actor/d_a_tag_bottle_item.h index ecdba3d544..cd122c8cad 100644 --- a/include/d/actor/d_a_tag_bottle_item.h +++ b/include/d/actor/d_a_tag_bottle_item.h @@ -14,18 +14,18 @@ private: /* 0x0576 */ u8 mBottleItemType; public: - s32 create(); - s32 Delete(); - s32 Execute(); - s32 Draw(); + int create(); + int Delete(); + int Execute(); + int Draw(); void setTypeFromParam(); void restart(); void initialize(); int checkProcess(ProcessFunc); int setProcess(ProcessFunc); void setAttnPos(); - s32 chkEvent(); - s32 orderEvent(); + int chkEvent(); + int orderEvent(); void makeSoup(); int wait(void*); virtual ~daTag_BottleItem_c(); diff --git a/include/d/actor/d_a_tag_camera.h b/include/d/actor/d_a_tag_camera.h index e9b4516637..b2b558adb3 100644 --- a/include/d/actor/d_a_tag_camera.h +++ b/include/d/actor/d_a_tag_camera.h @@ -14,6 +14,7 @@ public: u16 getAreaType(); u16 getAreaNoChk(); int execute(); + int draw(); inline int create(); diff --git a/include/d/actor/d_a_tag_chgrestart.h b/include/d/actor/d_a_tag_chgrestart.h index 496b4a0477..18b1cd6a48 100644 --- a/include/d/actor/d_a_tag_chgrestart.h +++ b/include/d/actor/d_a_tag_chgrestart.h @@ -6,10 +6,11 @@ class daTagChgRestart_c : public fopAc_ac_c { public: daTagChgRestart_c() {} - s32 Create(); - s32 create(); - s32 execute(); - s32 _delete(); + int Create(); + int create(); + int execute(); + int draw(); + int _delete(); /* 0x0568 */ cXyz mVertices[4]; }; @@ -17,8 +18,12 @@ public: STATIC_ASSERT(sizeof(daTagChgRestart_c) == 0x598); namespace daTagChgRestart_prm { - inline u8 getSwNo(daTagChgRestart_c* p_chgRestart) { return fopAcM_GetParam(p_chgRestart) >> 8; } - inline u8 getPlayerNo(daTagChgRestart_c* p_chgRestart) { return fopAcM_GetParam(p_chgRestart); } + inline u8 getSwNo(daTagChgRestart_c* p_chgRestart) { + return (fopAcM_GetParam(p_chgRestart) >> 8) & 0xFF; + } + inline u8 getPlayerNo(daTagChgRestart_c* p_chgRestart) { + return fopAcM_GetParam(p_chgRestart); + } }; // namespace daTagChgRestart_prm #endif /* D_A_TAG_CHGRESTART_H */ diff --git a/include/d/actor/d_a_tag_chkpoint.h b/include/d/actor/d_a_tag_chkpoint.h index 842408d20c..4871ec3946 100644 --- a/include/d/actor/d_a_tag_chkpoint.h +++ b/include/d/actor/d_a_tag_chkpoint.h @@ -7,11 +7,12 @@ class daTag_Chk_c : public fopAc_ac_c { public: int execute(); + int draw(); u16 getAreaType() { return home.angle.z & 0x100; } - u16 getHeight() { return fopAcM_GetParam(this) & 0xff; } - u8 getSwBit() { return fopAcM_GetParam(this) >> 8; } - u8 getSwBit2() { return fopAcM_GetParam(this) >> 16; } + u8 getHeight() { return fopAcM_GetParam(this) & 0xff; } + u8 getSwBit() { return (fopAcM_GetParam(this) & 0xff00) >> 8; } + u8 getSwBit2() { return (fopAcM_GetParam(this) & 0xff0000) >> 16; } int create() { fopAcM_ct(this, daTag_Chk_c); @@ -34,8 +35,11 @@ public: attention_info.position = current.pos; - u16 height = getHeight(); - height != 0xff ? attention_info.position.y += height * 10.0f : attention_info.position.y += scale.y * 0.5f; + if (getHeight() != 0xff) { + attention_info.position.y += getHeight() * 10.0f; + } else { + attention_info.position.y += scale.y * 0.5f; + } eyePos = attention_info.position; return cPhs_COMPLEATE_e; diff --git a/include/d/actor/d_a_tag_csw.h b/include/d/actor/d_a_tag_csw.h index 97d08ffda2..a55f21cb88 100644 --- a/include/d/actor/d_a_tag_csw.h +++ b/include/d/actor/d_a_tag_csw.h @@ -23,7 +23,7 @@ struct daTagCsw_c : public fopAc_ac_c, public request_of_phase_process_class { int getSw2() { return fopAcM_GetParamBit(this, 9, 8); } int getType() { return fopAcM_GetParamBit(this, 0, 1); } int getParam(int param_1, int param_2, int param_3) { - return (1 << param_3) - 1U & param_1 >> (param_2 & 0x3fU); + return (1 << param_3) - 1U & param_1 >> param_2; } int getArg0() { return getParam(current.angle.x, 0, 8); } int getItemBit() { return fopAcM_GetParamBit(this, 17, 8); } diff --git a/include/d/actor/d_a_tag_escape.h b/include/d/actor/d_a_tag_escape.h index d9a0aa23a4..b733e95aa9 100644 --- a/include/d/actor/d_a_tag_escape.h +++ b/include/d/actor/d_a_tag_escape.h @@ -5,8 +5,7 @@ class daTagEscape_c : public fopAc_ac_c { public: - daTagEscape_c() {} - ~daTagEscape_c() {} + inline int create(); u8 getPathID() { return fopAcM_GetParam(this) & 0xff; } }; diff --git a/include/d/actor/d_a_tag_guard.h b/include/d/actor/d_a_tag_guard.h index 0d2c784303..adebfffb75 100644 --- a/include/d/actor/d_a_tag_guard.h +++ b/include/d/actor/d_a_tag_guard.h @@ -9,7 +9,7 @@ public: int getAppearPoint(Vec*); void createGuard(u32); - u8 getPathID() { return fopAcM_GetParam(this) >> 8; } + u8 getPathID() { return (fopAcM_GetParam(this) >> 8) & 0xFF; } inline int create(); inline void create_init(); diff --git a/include/d/actor/d_a_tag_howl.h b/include/d/actor/d_a_tag_howl.h index 9d1f9ed023..222987b8f6 100644 --- a/include/d/actor/d_a_tag_howl.h +++ b/include/d/actor/d_a_tag_howl.h @@ -14,7 +14,7 @@ public: int destroy(); int execute(); int draw(); - u8 isAreaCheck(); + bool isAreaCheck(); int getParam(); u8 getSwitchBit(); virtual ~daTag_Howl_c() {} diff --git a/include/d/actor/d_a_tag_lantern.h b/include/d/actor/d_a_tag_lantern.h index 9cb8c698e1..54e1e5cf22 100644 --- a/include/d/actor/d_a_tag_lantern.h +++ b/include/d/actor/d_a_tag_lantern.h @@ -5,7 +5,7 @@ #include "d/d_msg_flow.h" struct daTag_Lantern_HIOParam { - u8 field_0x0; + u8 enable_debug_info; }; class daTag_Lantern_Param_c { diff --git a/include/d/actor/d_a_tag_lightball.h b/include/d/actor/d_a_tag_lightball.h index a9e3453e39..c27ef8e061 100644 --- a/include/d/actor/d_a_tag_lightball.h +++ b/include/d/actor/d_a_tag_lightball.h @@ -13,8 +13,8 @@ public: int draw(); int _delete(); - u8 getSwBit() { return fopAcM_GetParamBit(this, 0, 8); } - u32 getType() { return fopAcM_GetParamBit(this, 8, 4); } + u8 getSwbit() { return fopAcM_GetParamBit(this, 0, 8); } + u8 getType() { return fopAcM_GetParamBit(this, 8, 4); } /* 0x568 */ DALKMIST_INFLUENCE mInfluence; /* 0x57C */ u8 field_0x57c; diff --git a/include/d/actor/d_a_tag_lv6CstaSw.h b/include/d/actor/d_a_tag_lv6CstaSw.h index 9f8bf99dd6..17b58e4b28 100644 --- a/include/d/actor/d_a_tag_lv6CstaSw.h +++ b/include/d/actor/d_a_tag_lv6CstaSw.h @@ -14,7 +14,7 @@ public: int Draw(); int Delete(); - u8 getSw() { return fopAcM_GetParamBit(this, 0, 8); } + u32 getSw() { return fopAcM_GetParamBit(this, 0, 8); } private: /* 0x568 */ u8 mSwitch; @@ -24,11 +24,11 @@ private: class daLv6CstaSw_HIO_c : public mDoHIO_entry_c { public: daLv6CstaSw_HIO_c(); - virtual ~daLv6CstaSw_HIO_c(); + virtual ~daLv6CstaSw_HIO_c() {} void genMessage(JORMContext*); - u8 unk_0x4; + u8 show_range; }; #endif /* D_A_TAG_LV6CSTASW_H */ diff --git a/include/d/actor/d_a_tag_mist.h b/include/d/actor/d_a_tag_mist.h index 798be173d9..9579ff62d5 100644 --- a/include/d/actor/d_a_tag_mist.h +++ b/include/d/actor/d_a_tag_mist.h @@ -11,6 +11,7 @@ public: int Create(); int create(); int execute(); + int draw(); int _delete(); static u8 getPlayerNo(); @@ -28,18 +29,18 @@ public: namespace daTagMist_prm { inline u8 getSwNoNum(daTagMist_c* i_this) { - return fopAcM_GetParam(i_this) >> 0x10; + return (fopAcM_GetParam(i_this) >> 16) & 0xFF; } inline u8 getMySwNo(daTagMist_c* i_this) { - return fopAcM_GetParam(i_this) >> 0x8; + return (fopAcM_GetParam(i_this) >> 8) & 0xFF; } inline u8 getTopSwNo(daTagMist_c* i_this) { return fopAcM_GetParam(i_this); } inline u8 getExitNo(daTagMist_c* i_this) { - return (fopAcM_GetParam(i_this) >> 0x18) & 0x3F; + return (fopAcM_GetParam(i_this) >> 24) & 0x3F; } -inline int getSwNo2(daTagMist_c* i_this) { +inline u8 getSwNo2(daTagMist_c* i_this) { return i_this->field_0x5a2 & 0xFF; } } // namespace daTagMist_prm diff --git a/include/d/actor/d_a_tag_mmsg.h b/include/d/actor/d_a_tag_mmsg.h index b916e2f212..9fdd0b3c66 100644 --- a/include/d/actor/d_a_tag_mmsg.h +++ b/include/d/actor/d_a_tag_mmsg.h @@ -12,13 +12,13 @@ public: int execute(); void onUseFlg() { mUseFlg = true; } - bool checkNoAttention() { return mAttention == 0xFF; } + bool checkNoAttention() const { return mAttention == 0xFF; } private: /* 0x568 */ u8 field_0x568; /* 0x569 */ u8 field_0x569; /* 0x56A */ u8 mAttention; - /* 0x56B */ bool field_0x56b; + /* 0x56B */ u8 field_0x56b; /* 0x56C */ bool mUseFlg; /* 0x56D */ u8 field_0x56d[3]; /* 0x570 */ u16 field_0x570; diff --git a/include/d/actor/d_a_tag_msg.h b/include/d/actor/d_a_tag_msg.h index 52f60bf13b..5ff6163559 100644 --- a/include/d/actor/d_a_tag_msg.h +++ b/include/d/actor/d_a_tag_msg.h @@ -16,6 +16,23 @@ public: static const daTag_Msg_HIO_Param_c m; }; +#if DEBUG +class daTag_Msg_HIO_c : public JORReflexible { +public: + daTag_Msg_HIO_c(); + ~daTag_Msg_HIO_c(); + + void genMessage(JORMContext*); + + s8 mChild; + daTag_Msg_HIO_Param_c m; +}; + +#define TAG_MSG_HIO_CLASS daTag_Msg_HIO_c +#else +#define TAG_MSG_HIO_CLASS daTag_Msg_Param_c +#endif + class daTag_Msg_c : public fopAc_ac_c { public: virtual ~daTag_Msg_c(); @@ -39,9 +56,9 @@ public: /* 0x5CC */ int mOrderEvtNum; /* 0x5D0 */ s16 mEventIdx; /* 0x5D2 */ u8 field_0x5D2[0x5D8 - 0x5D2]; - /* 0x5D8 */ daTag_Msg_Param_c* mParam; - /* 0x5DC */ u8 field_0x5dc; - /* 0x5DD */ u8 field_0x5dd; + /* 0x5D8 */ TAG_MSG_HIO_CLASS* mpHIO; + /* 0x5DC */ bool field_0x5dc; + /* 0x5DD */ bool field_0x5dd; /* 0x5DE */ u8 mOnSwitch; /* 0x5DF */ u8 mOffSwitch; /* 0x5E0 */ u16 mOnSaveLabel; diff --git a/include/d/actor/d_a_tag_myna2.h b/include/d/actor/d_a_tag_myna2.h index 5117e36c22..7eecb0c1d7 100644 --- a/include/d/actor/d_a_tag_myna2.h +++ b/include/d/actor/d_a_tag_myna2.h @@ -8,8 +8,8 @@ public: s32 create(); s32 execute(); - u8 getSwBit() { return fopAcM_GetParam(this) >> 8; } - u8 getMode() { return fopAcM_GetParam(this); } + u8 getSwBit() { return (fopAcM_GetParam(this) >> 8) & 0xFF; } + int getMode() { return fopAcM_GetParam(this) & 0xFF; } f32 getExtent() { return scale.x * 100.0f;} private: diff --git a/include/d/actor/d_a_tag_myna_light.h b/include/d/actor/d_a_tag_myna_light.h index 0a8b27c15d..664aea5e57 100644 --- a/include/d/actor/d_a_tag_myna_light.h +++ b/include/d/actor/d_a_tag_myna_light.h @@ -10,8 +10,8 @@ public: int Execute(); int Draw(); bool setTurnOnOffChange(); - u32 getTurnOnTime(); - u32 getTurnOffTime(); + u8 getTurnOnTime(); + u8 getTurnOffTime(); void initialize(); virtual ~daTag_MynaLight_c(); diff --git a/include/d/actor/d_a_tag_push.h b/include/d/actor/d_a_tag_push.h index ae3d664401..3a20b5ed77 100644 --- a/include/d/actor/d_a_tag_push.h +++ b/include/d/actor/d_a_tag_push.h @@ -16,12 +16,12 @@ public: int getId() { u16 id = (fopAcM_GetParam(this) & 0xFF000000) >> 24; - return (id == 0xFF) ? -1 : id; + return id == 0xFF ? -1 : id; } u8 getBitSW() { return fopAcM_GetParam(this) & 0xFF; } - u8 getBitSW2() { return (fopAcM_GetParam(this) >> 8) & 0xFF; } + u8 getBitSW2() { return (fopAcM_GetParam(this) & 0xFF00) >> 8; } u32 getFlowNodeNo() { if (home.angle.x != 0xFFFF) { diff --git a/include/d/actor/d_a_tag_qs.h b/include/d/actor/d_a_tag_qs.h index 832881d338..0ff7b20127 100644 --- a/include/d/actor/d_a_tag_qs.h +++ b/include/d/actor/d_a_tag_qs.h @@ -17,7 +17,7 @@ public: int execute(); int draw(); - u8 getType() { return fopAcM_GetParamBit(this, 0, 1); } + u32 getType() { return fopAcM_GetParamBit(this, 0, 1); } int getSwNo() { return fopAcM_GetParamBit(this, 1, 8); } /* 0x568 */ f32 field_0x568; diff --git a/include/d/actor/d_a_tag_ret_room.h b/include/d/actor/d_a_tag_ret_room.h index 063f644d8f..9e5f579e76 100644 --- a/include/d/actor/d_a_tag_ret_room.h +++ b/include/d/actor/d_a_tag_ret_room.h @@ -13,7 +13,7 @@ public: int draw(); int execute(); void init(); - u8 chkPlyrInTag(); + bool chkPlyrInTag(); /* 0x56C */ f32 field_0x56c; /* 0x570 */ f32 field_0x570; diff --git a/include/d/actor/d_a_tag_river_back.h b/include/d/actor/d_a_tag_river_back.h index 9cbd1e603e..3d53fe9d27 100644 --- a/include/d/actor/d_a_tag_river_back.h +++ b/include/d/actor/d_a_tag_river_back.h @@ -31,9 +31,11 @@ public: void setAction(u8 i_action) { mAction = i_action; } - u8 getSwBit() { return fopAcM_GetParamBit(this, 8, 8); } + u8 getSwbit() { return fopAcM_GetParamBit(this, 8, 8); } - u8 getSwBit2() { return fopAcM_GetParamBit(this, 0x10, 8); } + u8 getSwbit2() { return fopAcM_GetParamBit(this, 0x10, 8); } + + u8 getNextSceneNo() { return fopAcM_GetParamBit(this, 0, 8); } /* 0x568 */ request_of_phase_process_class mPhase; /* 0x570 */ u8 mTimer; diff --git a/include/d/actor/d_a_tag_rmbit_sw.h b/include/d/actor/d_a_tag_rmbit_sw.h index 8b214533b9..957267dd1d 100644 --- a/include/d/actor/d_a_tag_rmbit_sw.h +++ b/include/d/actor/d_a_tag_rmbit_sw.h @@ -12,13 +12,13 @@ public: int draw(); int execute(); void init(); - u8 chkPlyrInTag(); + bool chkPlyrInTag(); s8 getArg0_RoomSaveTableNo() { return fopAcM_GetParamBit(this, 0, 8); } s8 getArg1_RoomNo() { return fopAcM_GetParamBit(this, 8, 8); } u8 getArg2_CngBitVal() { return fopAcM_GetParamBit(this, 16, 1); } u8 getArg3_CngBitFlg() { return fopAcM_GetParamBit(this, 17, 1); } - u8 getSwBit() { return fopAcM_GetParamBit(this, 24, 8); } + int getSwBit() { return fopAcM_GetParamBit(this, 24, 8); } /* 0x56C */ f32 field_0x56c; /* 0x570 */ f32 field_0x570; diff --git a/include/d/actor/d_a_tag_setrestart.h b/include/d/actor/d_a_tag_setrestart.h index 73eb563ace..9cc144a55c 100644 --- a/include/d/actor/d_a_tag_setrestart.h +++ b/include/d/actor/d_a_tag_setrestart.h @@ -8,6 +8,7 @@ public: int Create(); int create(); int execute(); + int draw(); int _delete(); /* 0x568 */ s8 mPlayerRoomNo; diff --git a/include/d/actor/d_a_tag_spinner.h b/include/d/actor/d_a_tag_spinner.h index b0d97dfb56..cae6eeb9b6 100644 --- a/include/d/actor/d_a_tag_spinner.h +++ b/include/d/actor/d_a_tag_spinner.h @@ -14,6 +14,7 @@ public: int CreateHeap(); int create(); int execute(); + int draw(); int _delete(); f32 GetR() { return mRadius; } }; diff --git a/include/d/actor/d_a_tag_spring.h b/include/d/actor/d_a_tag_spring.h index 4d6a50a9b0..353d920ad9 100644 --- a/include/d/actor/d_a_tag_spring.h +++ b/include/d/actor/d_a_tag_spring.h @@ -10,10 +10,11 @@ public: int Create(); int create(); int execute(); - u8 checkArea(); + bool checkArea(); + int draw(); int _delete(); - u32 getSwbit() { return fopAcM_GetParamBit(this, 0, 8); } + u8 getSwbit() { return fopAcM_GetParamBit(this, 0, 8); } /* 0x568 */ u8 mTimer; }; // Size: 0x56C diff --git a/include/d/actor/d_a_tag_ss_drink.h b/include/d/actor/d_a_tag_ss_drink.h index 4055bd3fc0..c5766c9dfc 100644 --- a/include/d/actor/d_a_tag_ss_drink.h +++ b/include/d/actor/d_a_tag_ss_drink.h @@ -14,7 +14,7 @@ public: int Delete(); int Execute(); int Draw(); - int getTypeFromParam(); + u8 getTypeFromParam(); u8 getSwitchFromParam(); u16 getFlowNodeNum(); u16 getValue(); @@ -29,7 +29,6 @@ public: int talk(void*); ~daTag_SSDrink_c(); - s32 fopAcM_seenPlayerAngleY() { return fopAcM_seenActorAngleY(this, dComIfGp_getPlayer(0)); } bool checkShopOil() const { return field_0x5D2 == 4; } /* 0x578 */ dMsgFlow_c field_0x578; diff --git a/include/d/actor/d_a_tag_statue_evt.h b/include/d/actor/d_a_tag_statue_evt.h index 596d820e65..e116dea787 100644 --- a/include/d/actor/d_a_tag_statue_evt.h +++ b/include/d/actor/d_a_tag_statue_evt.h @@ -21,7 +21,7 @@ public: void endParticle(); BOOL checkStartDemo(); BOOL checkOnEffect(); - s32 getLetterCount(); + int getLetterCount(); int draw(); int _delete(); @@ -38,7 +38,7 @@ private: /* 0x596 */ u8 mMapToolId; /* 0x597 */ u8 mSkyCharacterEventBitIdIndex; /* 0x598 */ s16 mEventId; - /* 0x59C */ u32 mTreasureDemoItemId; + /* 0x59C */ u32 mItemId; /* 0x5A0 */ s32 mOwlStatueId; enum Action_e { @@ -63,19 +63,23 @@ private: TAG_LOCATION_RUINED_THEATRE }; - void setAction(Action_e action) { + void setAction(u8 action) { mCurrentAction = action; } - u32 getSwbit() { + u8 getSwbit() { return fopAcM_GetParamBit(this, 0, 8); } // Returns whether player has obtained a Sky Character from the tag - u32 getSwbit2() { + u8 getSwbit2() { return fopAcM_GetParamBit(this, 12, 8); } + + u8 getType() { + return fopAcM_GetParamBit(this, 8, 4); + } }; #endif /* D_A_TAG_STATUE_EVT_H */ diff --git a/include/d/actor/d_a_tag_stream.h b/include/d/actor/d_a_tag_stream.h index 6988320281..7c3b3eb4ac 100644 --- a/include/d/actor/d_a_tag_stream.h +++ b/include/d/actor/d_a_tag_stream.h @@ -5,7 +5,7 @@ class daTagStream_c : public fopAc_ac_c { public: - u8 getPriority() { + u8 getPriority() const { return mPriority; } diff --git a/include/d/actor/d_a_tag_theB_hint.h b/include/d/actor/d_a_tag_theB_hint.h index cd80a3e5e7..fb200e1ecd 100644 --- a/include/d/actor/d_a_tag_theB_hint.h +++ b/include/d/actor/d_a_tag_theB_hint.h @@ -1,61 +1,16 @@ #ifndef D_A_TAG_THEB_HINT_H #define D_A_TAG_THEB_HINT_H -// #include "d/actor/d_a_npc_theB.h" -#include "d/d_com_inf_game.h" #include "f_op/f_op_actor_mng.h" -// needs to be pulled from d_a_npc_theB.h eventually -struct daNpcTheB_c { - daNpcTheB_c(); - ~daNpcTheB_c(); - void create(); - void CreateHeap(); - void Delete(); - void Execute(); - void Draw(); - void ctrlJoint(J3DJoint*, J3DModel*); - void createHeapCallBack(fopAc_ac_c*); - void ctrlJointCallBack(J3DJoint*, int); - void getHandPos1(int); - void getHandPos2(int); - void setHintEvent(s32, u16, int); - void main(); - void setParam(); - void ctrlBtk(); - void setAttnPos(); - void setExpressionAnm(int, bool); - void setExpressionBtp(int); - bool setMotionAnm(int, f32); - bool drawDbgInfo(); - void reset(); - void playExpression(); - void playMotion(); - void doNormalAction(); - void doEvent(); - void lookat(); - void wait(void*); - void setMotion(int, f32, int); - void setExpression(int, f32); - void talk(void*); - void EvCut_PersonalCombatIntro(int); - void EvCut_PersonalCombatRevenge(int); - void EvCut_PersonalCombatAfter(); - void EvCut_AnnulationFieldRace(int); - void EvCut_TheBHint(int); - void EvCut_CoachGuardGameOver(int); - - static u8 mEvtSeqList[72]; -}; - class daTagTheBHint_c : public fopAc_ac_c { public: - u8 getSwitchNo() { + u32 getSwitchNo() { return shape_angle.x & 0xff; } - u16 getMessageNo() { + u32 getMessageNo() { return shape_angle.z & 0xffff; } @@ -65,37 +20,11 @@ public: s8 getRoomNo() { return fopAcM_GetParam(this) >> 24; - } - - int create() { - fopAcM_ct(this, daTagTheBHint_c); - field_0x568 = pow(scale.x * 100.0f,2.0f); - return cPhs_COMPLEATE_e; } - int execute() { - if (fopAcM_isSwitch(this,getSwitchNo())) { - fopAcM_delete(this); - return 1; - } else { - f32 distance = fopAcM_searchPlayerDistanceXZ2(this); + inline int create(); + inline int execute(); - if (distance < field_0x568) { - daNpcTheB_c* the_b = (daNpcTheB_c*)fpcM_SearchByName(PROC_NPC_THEB); - if (the_b) { - s8 roomNo = getRoomNo(); - - if (roomNo == 0xFF) { - roomNo = fopAcM_GetRoomNo(this); - } - - the_b->setHintEvent(getMessageNo(),getLinkID(),roomNo); - } - } - } - - return 1; - } /* 0x568 */ f32 field_0x568; }; diff --git a/include/d/actor/d_a_tag_waterfall.h b/include/d/actor/d_a_tag_waterfall.h index 26c1bc040c..fe833394c2 100644 --- a/include/d/actor/d_a_tag_waterfall.h +++ b/include/d/actor/d_a_tag_waterfall.h @@ -29,31 +29,31 @@ private: /* 0x574 */ f32 mFogNear; /* 0x578 */ f32 mFogFar; /* 0x57C */ f32 mColorBlend; - /* 0x580 */ bool mPrevCameraInWaterfall; + /* 0x580 */ u8 mPrevCameraInWaterfall; /* 0x581 */ u8 mFrameCountdown; /* 0x582 */ u8 mColpat; /* 0x583 */ u8 mIsMasterWaterfallTag; }; -struct daTagWaterFall_HIO_c { +struct daTagWaterFall_HIO_c : public JORReflexible { public: daTagWaterFall_HIO_c(); - virtual ~daTagWaterFall_HIO_c(); + virtual ~daTagWaterFall_HIO_c() {} + + void genMessage(JORMContext*); /* 0x00 */ /* vtable */ - /* 0x04 */ s8 field_0x04; - /* 0x05 */ bool mShouldModifyFog; - /* 0x06 */ u8 pad0[2]; - /* 0x08 */ f32 mBaseFogNear; - /* 0x0C */ f32 mBaseFogFar; - /* 0x10 */ f32 mColorBlendStepDivisor; - /* 0x14 */ u8 field_0x14; - /* 0x15 */ u8 field_0x15; - /* 0x16 */ u8 pad1[2]; - /* 0x18 */ f32 field_0x18; - /* 0x1C */ f32 field_0x1C; - /* 0x20 */ f32 field_0x20; + /* 0x04 */ s8 child; + /* 0x05 */ u8 enable_fog_adjust; + /* 0x08 */ f32 base_fog_far; + /* 0x0C */ f32 base_fog_near; + /* 0x10 */ f32 color_blend_step_divisor; + /* 0x14 */ u8 draw_ellipse; + /* 0x15 */ u8 enable_ellipse_adjust; + /* 0x18 */ f32 ellipse_radius_a; + /* 0x1C */ f32 ellipse_radius_b; + /* 0x20 */ f32 ellipse_rotate; }; #endif /* D_A_TAG_WATERFALL_H */ diff --git a/include/d/actor/d_a_tag_yami.h b/include/d/actor/d_a_tag_yami.h index 0af2271e6b..8410899186 100644 --- a/include/d/actor/d_a_tag_yami.h +++ b/include/d/actor/d_a_tag_yami.h @@ -16,8 +16,8 @@ public: void offMidnaTagSw2(); void setCoC(cXyz i_coC) { mCoC = i_coC; } - u8 get_MTagSw() { return fopAcM_GetParamBit(this, 8, 8); } - u8 get_MTagSw2() { return fopAcM_GetParamBit(this, 16, 8); } + int get_MTagSw() { return (fopAcM_GetParam(this) >> 8) & 0xFF; } + int get_MTagSw2() { return (fopAcM_GetParam(this) >> 16) & 0xFF; } s32 get_prm() { return fopAcM_GetParam(this) & 0xff; } int is_CoHit() { return mIsCoHit; } diff --git a/include/d/d_bg_w.h b/include/d/d_bg_w.h index 846a177bd9..527c0e3fe4 100644 --- a/include/d/d_bg_w.h +++ b/include/d/d_bg_w.h @@ -219,7 +219,7 @@ public: MtxP GetBaseMtxP() { return pm_base; } bool ChkNoCalcVtx() { return mFlags & NO_CALC_VTX_e; } bool ChkFlush() { return field_0x91 & 8; } - void SetLock() { mFlags |= LOCK_e; } + void SetLock() { mFlags |= (u8)LOCK_e; } void OffRoofRegist() { field_0x91 |= 0x4; } void OnRoofRegist() { field_0x91 &= ~0x04; } bool ChkRoofRegist() { return field_0x91 & 4;} diff --git a/src/d/actor/d_a_alink.cpp b/src/d/actor/d_a_alink.cpp index e83d187c8f..6ae53c7983 100644 --- a/src/d/actor/d_a_alink.cpp +++ b/src/d/actor/d_a_alink.cpp @@ -5275,7 +5275,7 @@ void daAlink_c::setIceSlipSpeed() { void daAlink_c::setPolygonSpeed() { offNoResetFlg3(daPy_FLG3(FLG3_UNK_1000 | FLG3_UNK_2000)); - if ((!checkEventRun() || checkNoResetFlg0(daPy_FLG0(FLG0_UNK_10000 | FLG0_UNK_4000))) && !checkMagneBootsOn()) { + if ((!checkEventRun() || checkNoResetFlg0(daPy_FLG0(FLG0_DEMO_STREAM_ACCEPT | FLG0_UNK_4000))) && !checkMagneBootsOn()) { cM3dGPla tripla; if (checkNoResetFlg3(FLG3_MIDNA_TALK_POLY_SPEED)) { offNoResetFlg3(FLG3_MIDNA_TALK_POLY_SPEED); @@ -13097,7 +13097,7 @@ void daAlink_c::posMove() { current.pos.x += mWindSpeed.x; current.pos.z += mWindSpeed.z; } - } else if (checkNoResetFlg0(daPy_FLG0(FLG0_UNK_10000 | FLG0_UNK_4000))) { + } else if (checkNoResetFlg0(daPy_FLG0(FLG0_DEMO_STREAM_ACCEPT | FLG0_UNK_4000))) { current.pos += field_0x3594; } } else if (checkOctaIealSpecialCollect()) { diff --git a/src/d/actor/d_a_alink_demo.inc b/src/d/actor/d_a_alink_demo.inc index 2da24db56a..ed927c8de2 100644 --- a/src/d/actor/d_a_alink_demo.inc +++ b/src/d/actor/d_a_alink_demo.inc @@ -888,7 +888,7 @@ void daAlink_c::resetSpecialEvent() { void daAlink_c::endDemoMode() { BOOL flyAtnWait = checkFlyAtnWait(); endHighModel(); - offNoResetFlg0(daPy_FLG0(FLG0_UNK_10000 | FLG0_UNK_400)); + offNoResetFlg0(daPy_FLG0(FLG0_DEMO_STREAM_ACCEPT | FLG0_UNK_400)); field_0x06f4 = NULL; if (field_0x06f8 != NULL) { diff --git a/src/d/actor/d_a_tag_CstaSw.cpp b/src/d/actor/d_a_tag_CstaSw.cpp index 9d24b13c50..6974c3d5d3 100644 --- a/src/d/actor/d_a_tag_CstaSw.cpp +++ b/src/d/actor/d_a_tag_CstaSw.cpp @@ -6,12 +6,23 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_tag_CstaSw.h" + +#include "d/d_debug_viewer.h" #include "d/d_procname.h" +daTagCstaSw_HIO_c l_HIO; + daTagCstaSw_HIO_c::daTagCstaSw_HIO_c() { - unk_0x4 = 0; + show_range = 0; } +#if DEBUG +void daTagCstaSw_HIO_c::genMessage(JORMContext* ctx) { + // "Show range" + ctx->genCheckBox("範囲表示", &show_range, 1); +} +#endif + void daTagCstaSw_c::setBaseMtx() { mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z); @@ -21,12 +32,20 @@ int daTagCstaSw_c::create() { fopAcM_ct(this, daTagCstaSw_c); mSwitch = getSw(); setBaseMtx(); + +#if DEBUG + // "Stone statue SW tag" + l_HIO.entryHIO("石像SWタグ"); +#endif + return cPhs_COMPLEATE_e; } -fopAc_ac_c* daTagCstaSw_c::searchSekizoAct(void* i_actor, void*) { - if (i_actor && fopAcM_IsActor(i_actor) && fopAcM_GetProfName(i_actor) == PROC_CSTAF) { - return (fopAc_ac_c*)i_actor; +fopAc_ac_c* daTagCstaSw_c::searchSekizoAct(void* i_actor, void* param_1) { + fopAc_ac_c* actor2 = (fopAc_ac_c*)param_1; + fopAc_ac_c* actor = (fopAc_ac_c*)i_actor; + if (actor && fopAcM_IsActor(actor) && fopAcM_GetProfName(actor) == PROC_CSTAF) { + return actor; } return NULL; } @@ -40,7 +59,8 @@ bool daTagCstaSw_c::areaCheck() { } cXyz vec_to_actor = current.pos - sekizo_p->current.pos; - if (vec_to_actor.absXZ() <= scale.x * 100.0f) { + f32 dist_to_actor = vec_to_actor.absXZ(); + if (dist_to_actor <= scale.x * 100.0f) { in_area = true; } @@ -48,7 +68,8 @@ bool daTagCstaSw_c::areaCheck() { } int daTagCstaSw_c::Execute() { - if (areaCheck() == 1) { + bool checkResult = areaCheck(); + if (checkResult == 1) { if (!fopAcM_isSwitch(this, mSwitch)) { fopAcM_onSwitch(this, mSwitch); } @@ -61,10 +82,23 @@ int daTagCstaSw_c::Execute() { } int daTagCstaSw_c::Draw() { +#if DEBUG + if (l_HIO.show_range) { + g_env_light.settingTevStruct(16, ¤t.pos, &tevStr); + + GXColor color = (GXColor){0, 0, 0xff, 0x80}; + dDbVw_drawCylinderXlu(current.pos, scale.x * 100.0f, scale.y * 100.0f, color, 1); + } +#endif + return 1; } int daTagCstaSw_c::Delete() { +#if DEBUG + l_HIO.removeHIO(); +#endif + return 1; } @@ -77,17 +111,16 @@ static int daTagCstaSw_Execute(daTagCstaSw_c* i_this) { } static int daTagCstaSw_Delete(daTagCstaSw_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->Delete(); } static int daTagCstaSw_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagCstaSw_c* cstaSw = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return cstaSw->create(); } -daTagCstaSw_HIO_c::~daTagCstaSw_HIO_c() {} - -static daTagCstaSw_HIO_c l_HIO; - static actor_method_class l_daTagCstaSw_Method = { (process_method_func)daTagCstaSw_Create, (process_method_func)daTagCstaSw_Delete, (process_method_func)daTagCstaSw_Execute, (process_method_func)NULL, diff --git a/src/d/actor/d_a_tag_Lv6Gate.cpp b/src/d/actor/d_a_tag_Lv6Gate.cpp index 041a1dab90..caad0162a2 100644 --- a/src/d/actor/d_a_tag_Lv6Gate.cpp +++ b/src/d/actor/d_a_tag_Lv6Gate.cpp @@ -10,29 +10,32 @@ #include "d/actor/d_a_player.h" #include "d/d_procname.h" -static int createSolidHeap(fopAc_ac_c* i_this) { - return static_cast(i_this)->createHeap(); -} - static f32 const l_minRelative[] = {-700.0f, -300.0f, -2000.0f}; static f32 const l_maxRelative[] = {700.0f, 0.0f, 1000.0f}; static char* l_arcName = "Lv6Gate"; -int daTagLv6Gate_c::createHeap() { +static int createSolidHeap(fopAc_ac_c* i_this) { + daTagLv6Gate_c* gate = static_cast(i_this); + return gate->createHeap(); +} + +inline int daTagLv6Gate_c::createHeap() { J3DAnmTextureSRTKey* btk; - J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 15); - mpModel[0] = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000284); + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 15); + JUT_ASSERT(92, modelData != NULL); + mpModel[0] = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000284); if (mpModel[0] == NULL) { return 0; } btk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 19); + JUT_ASSERT(100, btk != NULL); mpBtk[0] = new mDoExt_btkAnm(); if (mpBtk[0] == NULL || - !mpBtk[0]->init(model_data, btk, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1)) + !mpBtk[0]->init(modelData, btk, TRUE, J3DFrameCtrl::EMode_NONE, 1.0f, 0, -1)) { return 0; } @@ -42,15 +45,17 @@ int daTagLv6Gate_c::createHeap() { } btk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 20); + JUT_ASSERT(108, btk != NULL); mpBtk[1] = new mDoExt_btkAnm(); if (mpBtk[1] == NULL || - !mpBtk[1]->init(model_data, btk, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1)) + !mpBtk[1]->init(modelData, btk, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1)) { return 0; } - model_data = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 16); - mpModel[1] = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000084); + modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 16); + JUT_ASSERT(115, modelData != NULL); + mpModel[1] = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); if (mpModel[1] == NULL) { return 0; } @@ -68,7 +73,9 @@ int daTagLv6Gate_c::createHeap() { } static int daTagLv6Gate_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagLv6Gate_c* gate = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return gate->create(); } void daTagLv6Gate_c::initBaseMtx() { @@ -76,13 +83,13 @@ void daTagLv6Gate_c::initBaseMtx() { mDoMtx_stack_c::transS(0.0f, 0.0f, 0.0f); mDoMtx_stack_c::YrotM(0); - MTXCopy(mDoMtx_stack_c::get(), field_0x6f8[0]); + cMtx_copy(mDoMtx_stack_c::get(), field_0x6f8[0]); mpModel[0]->setBaseTRMtx(mDoMtx_stack_c::get()); mBgW[0].Move(); mDoMtx_stack_c::transS(0.0f, 2887.0f, -8330.0f); mDoMtx_stack_c::YrotM(0); - MTXCopy(mDoMtx_stack_c::get(), field_0x6f8[1]); + cMtx_copy(mDoMtx_stack_c::get(), field_0x6f8[1]); mpModel[1]->setBaseTRMtx(mDoMtx_stack_c::get()); mBgW[1].Move(); } @@ -159,27 +166,25 @@ inline int daTagLv6Gate_c::execute() { actor1 = NULL; fopAcM_SearchByID(parentActorID, &actor1); - if (actor1 == NULL) { - break; + if (actor1 != NULL) { + fopAcM_GetOldPosition_p(actor1)->set(pos); + fopAcM_GetPosition_p(actor1)->set(pos); + +#if PLATFORM_GCN + actor2 = NULL; + fopAcM_SearchByName(PROC_NPC_TKC, &actor2); + + if (actor2 == NULL) { + break; + } + + *fopAcM_GetOldPosition_p(actor2) = pos; + *fopAcM_GetPosition_p(actor2) = pos; +#endif } - - fopAcM_GetOldPosition_p(actor1)->set(pos); - fopAcM_GetPosition_p(actor1)->set(pos); - - #if VERSION != VERSION_SHIELD_DEBUG - - actor2 = NULL; - fopAcM_SearchByName(PROC_NPC_TKC, &actor2); - - if (actor2 == NULL) { - break; - } - - *fopAcM_GetOldPosition_p(actor2) = pos; - *fopAcM_GetPosition_p(actor2) = pos; - #endif - break; } + case '0005': + break; case '0006': fopAcM_onSwitch(this, getSwitchNo2()); mpBtk[0]->setFrame(mpBtk[0]->getEndFrame()); @@ -189,7 +194,9 @@ inline int daTagLv6Gate_c::execute() { fopAcM_delete(parentActorID); break; default: + int unused; // debug: force extra b instruction at end of case JUT_ASSERT(332, FALSE); + break; } } @@ -333,8 +340,8 @@ int daTagLv6Gate_c::draw() { } for (u16 i = 0; i < 2; i++) { - J3DModelData* model_data = mpModel[1]->getModelData(); - model_data->getMaterialNodePointer(i)->getTevKColor(3)->a = field_0x760[i]; + J3DMaterial* material = mpModel[1]->getModelData()->getMaterialNodePointer(i); + material->getTevKColor(3)->a = field_0x760[i]; } g_env_light.setLightTevColorType_MAJI(mpModel[1], &tevStr); @@ -360,6 +367,7 @@ daTagLv6Gate_c::~daTagLv6Gate_c() { } static int daTagLv6Gate_Delete(daTagLv6Gate_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagLv6Gate_c(); return 1; } diff --git a/src/d/actor/d_a_tag_Lv7Gate.cpp b/src/d/actor/d_a_tag_Lv7Gate.cpp index a31bceface..cf402f4848 100644 --- a/src/d/actor/d_a_tag_Lv7Gate.cpp +++ b/src/d/actor/d_a_tag_Lv7Gate.cpp @@ -18,14 +18,16 @@ int daTagLv7Gate_c::createHeap() { return 1; } - J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 11); - mpModel = mDoExt_J3DModel__create(model_data, 0, 0x11000084); + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 11); + JUT_ASSERT(92, modelData != NULL); + mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11000084); if (mpModel == NULL) { return 0; } J3DAnmTransform* bck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 7); + JUT_ASSERT(100, bck != NULL); mpBck = new mDoExt_bckAnm(); @@ -37,11 +39,14 @@ int daTagLv7Gate_c::createHeap() { } static int createSolidHeap(fopAc_ac_c* i_this) { - return static_cast(i_this)->createHeap(); + daTagLv7Gate_c* gate = static_cast(i_this); + return gate->createHeap(); } static int daTagLv7Gate_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagLv7Gate_c* gate = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return gate->create(); } int daTagLv7Gate_c::create() { @@ -66,48 +71,46 @@ int daTagLv7Gate_c::create() { return phase; } -void daTagLv7Gate_c::setPath(u8 i_path_ID) { +int daTagLv7Gate_c::setPath(int i_path_ID) { mRoomPath = dPath_GetRoomPath(i_path_ID, fopAcM_GetRoomNo(this)); - if (mRoomPath != NULL) { - dPnt* pnt = dPath_GetPnt(mRoomPath, 0); - cXyz pos1 = pnt->m_position; - - pnt = dPath_GetPnt(mRoomPath, 1); - cXyz pos2 = pnt->m_position; - - mPos1 = pos1; - - // Fake match? - s16 angle_y = cLib_targetAngleY(&pos1, &pos2); - // s16 angle_x = cLib_targetAngleX(&pos1, &pos2); - - // field_0x594.set(-angle_x, angle_y, 0); - field_0x594.x = -cLib_targetAngleX(&pos1, &pos2); - // field_0x594.x = -angle_x; - field_0x594.y = angle_y; - field_0x594.z = 0; - - mDistance = sqrtf(PSVECSquareDistance((Vec*)&mPos1, (Vec*)&pos2)); - field_0x5a0 = 1; - mPos2 = pos2; + if (mRoomPath == NULL) { + return 0; } + + cXyz pos1 = dPath_GetPnt(mRoomPath, 0)->m_position; + cXyz pos2 = dPath_GetPnt(mRoomPath, 1)->m_position; + + mPos1.set(pos1); + + field_0x594.set(-cLib_targetAngleX(&pos1, &pos2), cLib_targetAngleY(&pos1, &pos2), 0); + + mDistance = mPos1.abs(pos2); + field_0x5a0 = 1; + mPos2.set(pos2); + + return 1; } void daTagLv7Gate_c::initBaseMtx() { - fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); + if (mpModel != NULL) { + fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); + setBaseMtx(); + } } void daTagLv7Gate_c::setBaseMtx() { - if (mpModel) { - cXyz local_34(0.0f, 0.0f, speedF); - - mDoMtx_stack_c::transS(mPos1); - mDoMtx_stack_c::ZXYrotM((csXyz&)field_0x594); - mDoMtx_stack_c::multVec(&local_34, (Vec*)&mPos1); - MTXCopy(mDoMtx_stack_c::get(), mpModel->mBaseTransformMtx); - - attention_info.position = mPos1; + if (mpModel == NULL) { + return; } + + cXyz local_34(0.0f, 0.0f, speedF); + + mDoMtx_stack_c::transS(mPos1); + mDoMtx_stack_c::ZXYrotM(field_0x594); + mDoMtx_stack_c::multVec(&local_34, &mPos1); + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); + + attention_info.position = mPos1; } void daTagLv7Gate_c::create_init() { @@ -119,14 +122,11 @@ void daTagLv7Gate_c::create_init() { field_0x5b0 = false; field_0x5b1 = false; - setPath(getPathID() & 0xFF); + setPath(getPathID()); attention_info.position = mPos1; - if (mpModel) { - initBaseMtx(); - setBaseMtx(); - } + initBaseMtx(); // City in the Sky clear if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[268])) { @@ -149,13 +149,9 @@ void daTagLv7Gate_c::create_init() { fopAcM_create(PROC_NPC_TKS, 7, &pos, fopAcM_GetRoomNo(this), &local_54, NULL, -1); - pos.x = 2603.315f; - pos.y = -200.0f; - pos.z = 5485.9224f; + pos.set(2603.315f, -200.0f, 5485.9224f); - local_54.x = 0.0f; - local_54.y = -0x4000; - local_54.z = 0.0f; + local_54.set(0, -0x4000, 0); fopAcM_create(PROC_NPC_TKJ, 0, &pos, fopAcM_GetRoomNo(this), &local_54, NULL, -1); } @@ -163,6 +159,7 @@ void daTagLv7Gate_c::create_init() { eventInfo.setArchiveName(l_arcName); dComIfGp_getEventManager().setObjectArchive(eventInfo.getArchiveName()); mEvtId = dComIfGp_getEventManager().getEventIdx(this, mEvName, -1); + JUT_ASSERT(204, mEvtId != -1); fopAcM_orderOtherEventId(this, mEvtId, -1, -1, 2, 1); } @@ -187,7 +184,7 @@ void daTagLv7Gate_c::flyAnime() { if (bck_anm == bck_anm_3) { if (field_0x5ac < 150) { - field_0x5ac += 1; + field_0x5ac += (u16)1; if (field_0x5ac >= 150) { bck = bck_anm_4; attribute = J3DFrameCtrl::EMode_NONE; @@ -199,10 +196,7 @@ void daTagLv7Gate_c::flyAnime() { attribute = J3DFrameCtrl::EMode_NONE; } } else { - // } else if (mpBck->isStop()) { - // Fake match? - mDoExt_bckAnm* tmp = mpBck; - if (tmp->isStop()) { + if (mpBck->isStop()) { if (bck_anm == bck_anm_2) { bck = bck_anm_3; attribute = J3DFrameCtrl::EMode_LOOP; @@ -287,46 +281,39 @@ int daTagLv7Gate_c::execute() { return 1; } -bool daTagLv7Gate_c::checkPoint(f32 i_speed) { +bool daTagLv7Gate_c::checkPoint(cXyz& i_point, f32 i_speed) { dPnt* pnt = dPath_GetPnt(mRoomPath, field_0x5a0); mDistance -= i_speed; - if (sqrtf(PSVECSquareDistance((Vec*)&mPos1, (Vec*)&pnt->m_position)) < i_speed || + if (i_point.abs(pnt->m_position) < i_speed || mDistance < 0.0f) { return true; - } + } return false; } bool daTagLv7Gate_c::setNextPoint() { bool bVar1; - dPath_GetPnt(mRoomPath, field_0x5a0); + dPnt* unusedPnt = dPath_GetPnt(mRoomPath, field_0x5a0); + dPnt* pnt; field_0x5a0 += 1; if (field_0x5a0 >= mRoomPath->m_num) { field_0x5a0 = mRoomPath->m_num - 1; mDistance = 0; - bVar1 = true; + return true; } else { - dPnt* pnt = dPath_GetPnt(mRoomPath, field_0x5a0); - - cXyz pos1(mPos1.x, 0.0f, mPos1.z); - - cXyz pos2(pnt->m_position.x, 0.0f, pnt->m_position.z); - - mDistance = sqrtf(PSVECSquareDistance((Vec*)&pos1, (Vec*)&pos2)); - mPos2 = pnt->m_position; - bVar1 = false; + pnt = dPath_GetPnt(mRoomPath, field_0x5a0); + mDistance = mPos1.absXZ(pnt->m_position); + mPos2.set(pnt->m_position); + return false; } - if (bVar1) { - field_0x5b1 = false; - speedF = 0; - } - return bVar1; } void daTagLv7Gate_c::calcFly() { - f32 speed = speedF; - if (checkPoint(speed)) { - setNextPoint(); + if (checkPoint(mPos1, speedF)) { + if (setNextPoint()) { + field_0x5b1 = false; + speedF = 0.0f; + } } s16 angle_x = -cLib_targetAngleX(&mPos1, &mPos2); s16 angle_y = cLib_targetAngleY(&mPos1, &mPos2); @@ -361,6 +348,7 @@ daTagLv7Gate_c::~daTagLv7Gate_c() { } static int daTagLv7Gate_Delete(daTagLv7Gate_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagLv7Gate_c(); return 1; } diff --git a/src/d/actor/d_a_tag_Lv8Gate.cpp b/src/d/actor/d_a_tag_Lv8Gate.cpp index be0e766c7d..0b836e8ca8 100644 --- a/src/d/actor/d_a_tag_Lv8Gate.cpp +++ b/src/d/actor/d_a_tag_Lv8Gate.cpp @@ -11,7 +11,8 @@ static char* l_arcName = "Lv8Gate"; static int createSolidHeap(fopAc_ac_c* i_this) { - return static_cast(i_this)->createHeap(); + daTagLv8Gate_c* gate = static_cast(i_this); + return gate->createHeap(); } daTagLv8Gate_c::~daTagLv8Gate_c() { @@ -43,21 +44,20 @@ inline int daTagLv8Gate_c::create() { fopAcM_ct(this, daTagLv8Gate_c); cPhs__Step step; - /* dSv_event_flag_c::F_0354 - Cutscene - [cutscene] Mirror complete */ + /* dSv_event_flag_c::F_0354 - Cutscene - [cutscene] Mirror complete */ if (!dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[354])) { - step = cPhs_ERROR_e; + return cPhs_ERROR_e; } else { step = (cPhs__Step)dComIfG_resLoad(&mPhaseReq, l_arcName); if (step == cPhs_COMPLEATE_e) { if (!fopAcM_entrySolidHeap(this, createSolidHeap, 0x1600)) { - step = cPhs_ERROR_e; + return cPhs_ERROR_e; } else { create_init(); } } + return step; } - - return step; } inline int daTagLv8Gate_c::draw() { @@ -81,18 +81,24 @@ inline int daTagLv8Gate_c::draw() { dComIfGd_setList(); if (mpBck != NULL) { - mpModel->getModelData()->getJointNodePointer(0)->setMtxCalc(NULL); + mpBck->remove(mpModel->getModelData()); } } return TRUE; } +// this function and ::execute seem to be inline, but somehow both this function's .data and .rodata +// are supposed to be placed before ::execute's (.data order is reversed for inline functions but +// .rodata order is not) +// retail function order also suggests that this function comes first int daTagLv8Gate_c::createHeap() { if (strcmp(dComIfGp_getStartStageName(), "D_MN08") == 0) { - J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 8); - mpModel = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000084); + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 8); + JUT_ASSERT(275, modelData != NULL); + mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); J3DAnmTransform* bck = (J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 5); + JUT_ASSERT(283, bck != NULL); mpBck = new mDoExt_bckAnm(); if (mpBck == NULL || !mpBck->init(bck, TRUE, J3DFrameCtrl::EMode_LOOP, 1.0f, 0, -1, false)) @@ -105,15 +111,16 @@ int daTagLv8Gate_c::createHeap() { } static int daTagLv8Gate_Create(fopAc_ac_c* i_this) { - daTagLv8Gate_c* a_this = static_cast(i_this); - return a_this->create(); + daTagLv8Gate_c* gate = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return gate->create(); } static int daTagLv8Gate_Execute(daTagLv8Gate_c* i_this) { return i_this->execute(); } -inline int daTagLv8Gate_c::execute() { +int daTagLv8Gate_c::execute() { if (dComIfGp_event_runCheck() && !eventInfo.checkCommandTalk()) { dEvent_manager_c& eventManager = dComIfGp_getEventManager(); s32 cut_index = eventManager.getMyStaffId(l_arcName, NULL, 0); @@ -132,8 +139,8 @@ inline int daTagLv8Gate_c::execute() { if (mirror_table != NULL) { static_cast(mirror_table)->setEffect(); } - break; } + break; case '0002': dStage_changeScene(getSceneNo(), 0.0f, 0, fopAcM_GetRoomNo(this), 0, -1); break; @@ -215,6 +222,7 @@ static int daTagLv8Gate_IsDelete(daTagLv8Gate_c* i_this) { } static int daTagLv8Gate_Delete(daTagLv8Gate_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagLv8Gate_c(); return TRUE; } diff --git a/src/d/actor/d_a_tag_TWgate.cpp b/src/d/actor/d_a_tag_TWgate.cpp index 2d90b9bef3..85084747c9 100644 --- a/src/d/actor/d_a_tag_TWgate.cpp +++ b/src/d/actor/d_a_tag_TWgate.cpp @@ -4,12 +4,13 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep -#include "d/actor/d_a_tag_TWgate.h" +#include "JSystem/JUtility/JUTAssert.h" #include "d/actor/d_a_player.h" +#include "d/actor/d_a_tag_TWgate.h" #include "d/d_com_inf_game.h" +#include "d/d_debug_viewer.h" #include "d/d_msg_object.h" #include "f_op/f_op_actor_mng.h" -#include "JSystem/JUtility/JUTAssert.h" struct daTagTWGate_zevParam { /* 0x00 */ char* mArcName; @@ -23,13 +24,11 @@ struct daTagTWGate_zevParam { /* 0x1B */ s8 mLayer; }; -void daTagTWGate_c::initWait() { - mEventID = -1; -} +daTagTWGate_Attr_c const daTagTWGate_c::mAttr = {}; -u8 const daTagTWGate_c::mAttr[1] = { - 0x00, -}; +#if DEBUG +daTagTWGate_Hio_c daTagTWGate_c::mHio; +#endif static daTagTWGate_zevParam const l_zevParamTbl[4] = { { @@ -80,7 +79,7 @@ static daTagTWGate_zevParam const l_zevParamTbl[4] = { static const char* l_myName = "Gate"; -actionFunc daTagTWGate_c::ActionTable[13][2] = { +const actionFunc daTagTWGate_c::ActionTable[][2] = { {&daTagTWGate_c::initWait, &daTagTWGate_c::executeWait}, {&daTagTWGate_c::initDemoFilone1, &daTagTWGate_c::executeDemoFilone1}, {&daTagTWGate_c::initDemoFilone2, &daTagTWGate_c::executeDemoFilone2}, @@ -96,59 +95,117 @@ actionFunc daTagTWGate_c::ActionTable[13][2] = { {&daTagTWGate_c::initDemoHyral3, &daTagTWGate_c::executeDemoHyral3}, }; -void daTagTWGate_c::executeWait() { - f32 radius = pow(scale.x * 100.0f, 2.0f); - f32 distance = fopAcM_searchActorDistanceXZ2(this, (fopAc_ac_c*)dComIfGp_getPlayer(0)); +#if DEBUG +daTagTWGate_Hio_c::daTagTWGate_Hio_c() { + field_0x8 = 0; + default_set(); +} - if (distance < radius) { +void daTagTWGate_Hio_c::ct() { + if (field_0x8++ == 0) { + // "Twilight Gate tag" + entryHIO("トワイライトゲートタグ"); + } +} + +void daTagTWGate_Hio_c::dt() { + if (--field_0x8 == 0) { + removeHIO(); + } +} + +void daTagTWGate_Hio_c::default_set() { + attr = daTagTWGate_c::mAttr; +} + +void daTagTWGate_Hio_c::genMessage(JORMContext* ctx) { + // "Twilight Gate tag parameter settings" + ctx->genLabel("§ トワイライトゲートタグ パラメータ設定 §\n", 0); + // "Draw range" + ctx->genCheckBox("範囲描画", &attr.show_range, 1); +} +#endif + +inline daTagTWGate_c::~daTagTWGate_c() { + dComIfG_resDelete(&mPhaseZevArc, l_zevParamTbl[mType].mArcName); + + if (mPhaseMdRes.id != cPhs_INIT_e) { + dComIfG_resDelete(&mPhaseMdRes, "TWGate_Md"); + } + + if (mPhasePyRes.id != cPhs_INIT_e) { + dComIfG_resDelete(&mPhasePyRes, mIsWolf ? "TWGate_Wf" : "TWGate_Lk"); + } + +#if DEBUG + mHio.dt(); +#endif +} + +void daTagTWGate_c::initWait() { + mEventID = -1; +} + +void daTagTWGate_c::setAction(Mode_e i_action) { + JUT_ASSERT(233, i_action < MODE_MAX_e); + int oldActionID = mActionID; + mActionID = i_action; + mAction = ActionTable[mActionID]; + callInit(); +} + +void daTagTWGate_c::callInit() { + JUT_ASSERT(289, mAction != NULL); + (this->*(*mAction))(); +} + +void daTagTWGate_c::callExecute() { + JUT_ASSERT(302, mAction != NULL); + (this->*mAction[1])(); + Z2GetAudioMgr()->seStartLevel(Z2SE_OBJ_DARK_GATE, ¤t.pos, + 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); +} + +void daTagTWGate_c::executeWait() { + f32 radius = std::pow(scale.x * 100.0f, 2.0f); + + if (fopAcM_searchPlayerDistanceXZ2(this) < radius) { if (field_0x5de == 0) { field_0x5de = 1; switch (mType) { case TYPE_FILONE: if (fopAcM_isSwitch(this, getSwitch())) { - mActionID = ACT_DEMO_FILONE_2; - mAction = &ActionTable[mActionID][0]; - (this->**mAction)(); + setAction(ACT_DEMO_FILONE_2); } else { - mActionID = ACT_DEMO_FILONE_1; - mAction = &ActionTable[mActionID][0]; - (this->**mAction)(); + setAction(ACT_DEMO_FILONE_1); } break; case TYPE_ORDIN: if (fopAcM_isSwitch(this, getSwitch())) { - mActionID = ACT_DEMO_ORDIN_2; - mAction = &ActionTable[mActionID][0]; - (this->**mAction)(); + setAction(ACT_DEMO_ORDIN_2); } else { - mActionID = ACT_DEMO_ORDIN_1; - mAction = &ActionTable[mActionID][0]; - (this->**mAction)(); + setAction(ACT_DEMO_ORDIN_1); } break; case TYPE_RANAIL: if (fopAcM_isSwitch(this, getSwitch())) { - mActionID = ACT_DEMO_RANAIL_2; - mAction = &ActionTable[mActionID][0]; - (this->**mAction)(); + setAction(ACT_DEMO_RANAIL_2); } else { - mActionID = ACT_DEMO_RANAIL_1; - mAction = &ActionTable[mActionID][0]; - (this->**mAction)(); + setAction(ACT_DEMO_RANAIL_1); } break; case TYPE_HYRAL: if (fopAcM_isSwitch(this, getSwitch())) { - mActionID = ACT_DEMO_HYRAL_2; - mAction = &ActionTable[mActionID][0]; - (this->**mAction)(); + setAction(ACT_DEMO_HYRAL_2); } else { - mActionID = ACT_DEMO_HYRAL_1; - mAction = &ActionTable[mActionID][0]; - (this->**mAction)(); + setAction(ACT_DEMO_HYRAL_1); } break; + default: + // "Twilight Gate demo tag argument 0 error Type=%d + OS_REPORT("\nトワイライトゲートデモタグ 引数0エラー Type=%d\n\n", mType); + JUT_ASSERT(344, FALSE); } } } else { @@ -166,34 +223,36 @@ void daTagTWGate_c::executeDemoFilone1() { dEvent_manager_c& event_manager = dComIfGp_getEventManager(); int staffId = event_manager.getMyStaffId(l_myName, NULL, 0); + int* cutName; if (staffId != -1) { - int* cutName = (int*)event_manager.getMyNowCutName(staffId); + cutName = (int*)event_manager.getMyNowCutName(staffId); if (event_manager.getIsAddvance(staffId)) { switch (*cutName) { case 0x30303031: - dComIfGp_getEvent()->setSkipProc(this, dEv_noFinishSkipProc, 0); + dComIfGp_getEvent()->startCheckSkipEdge(this); break; + default: + JUT_ASSERT(395, FALSE); } } switch (*cutName) { case 0x30303031: - if (dComIfGp_getEvent()->chkFlag2(8)) { + if (dComIfGp_getEvent()->checkSkipEdge()) { dComIfGp_getEvent()->onSkipFade(); - mActionID = ACT_DEMO_FILONE_2; - mAction = ActionTable[mActionID]; - (this->**mAction)(); + setAction(ACT_DEMO_FILONE_2); } event_manager.cutEnd(staffId); + break; + default: + JUT_ASSERT(407, FALSE); } if (eventInfo.checkCommandDemoAccrpt() && mEventID != -1 && event_manager.endCheck(mEventID)) { - mActionID = ACT_DEMO_FILONE_2; - mAction = ActionTable[mActionID]; - (this->**mAction)(); + setAction(ACT_DEMO_FILONE_2); } } } @@ -213,12 +272,13 @@ void daTagTWGate_c::initDemoFilone2() { } void daTagTWGate_c::executeDemoFilone2() { - s32 staffId = dComIfGp_evmng_getMyStaffId(l_myName, NULL, 0); + dEvent_manager_c& eventManager = dComIfGp_getEventManager(); + s32 staffId = eventManager.getMyStaffId(l_myName, NULL, 0); if (staffId != -1) { - int* cutName = (int*)dComIfGp_getEventManager().getMyNowCutName(staffId); + int* cutName = (int*)eventManager.getMyNowCutName(staffId); - if (dComIfGp_evmng_getIsAddvance(staffId)) { + if (eventManager.getIsAddvance(staffId)) { switch (*cutName) { case '0002': initTalk(0xBC1, NULL); @@ -226,40 +286,43 @@ void daTagTWGate_c::executeDemoFilone2() { case '0001': case '0003': break; + default: + JUT_ASSERT(480, FALSE); } } switch (*cutName) { case '0001': case '0003': - dComIfGp_evmng_cutEnd(staffId); + eventManager.cutEnd(staffId); break; case '0002': if (talkProc(NULL, 1, NULL)) { - if (mMsgFlow.getChoiceNo() == 0) { - mActionID = ACT_DEMO_FILONE_3; - mAction = ActionTable[mActionID]; - (this->**mAction)(); + int choiceNo = mMsgFlow.getChoiceNo(); + // "Two-way branch %s" / "Yes" / "No" + OS_REPORT("二択分岐 %s\n", choiceNo == 0 ? "はい" : "いいえ"); + if (choiceNo == 0) { + setAction(ACT_DEMO_FILONE_3); } - dComIfGp_evmng_cutEnd(staffId); + eventManager.cutEnd(staffId); } break; + default: + JUT_ASSERT(497, FALSE); } if (eventInfo.checkCommandDemoAccrpt() && mEventID != -1 && - dComIfGp_evmng_endCheck(mEventID)) { - dComIfGp_getEvent()->reset(); + eventManager.endCheck(mEventID)) { + dComIfGp_event_reset(); field_0x5e0 = 0; - mActionID = ACT_WAIT; - mAction = ActionTable[mActionID]; - (this->**mAction)(); + setAction(ACT_WAIT); } } } void daTagTWGate_c::initDemoFilone3() { field_0x5de = 1; - mIsWolf = (dComIfGp_getLinkPlayer()->mNoResetFlg1 >> 25) & 1; // checking if wolf? + mIsWolf = daPy_py_c::checkNowWolf() ? TRUE : FALSE; eventInfo.setArchiveName(l_zevParamTbl[mType].mArcName); dComIfGp_getEventManager().setObjectArchive(eventInfo.getArchiveName()); mEventID = @@ -269,17 +332,18 @@ void daTagTWGate_c::initDemoFilone3() { } void daTagTWGate_c::executeDemoFilone3() { - s32 staffId = dComIfGp_evmng_getMyStaffId(l_myName, NULL, 0); + dEvent_manager_c& eventManager = dComIfGp_getEventManager(); + s32 staffId = eventManager.getMyStaffId(l_myName, NULL, 0); if (staffId != -1) { - int* cutName = (int*)dComIfGp_getEventManager().getMyNowCutName(staffId); + int* cutName = (int*)eventManager.getMyNowCutName(staffId); - if (dComIfGp_evmng_getIsAddvance(staffId)) { + if (eventManager.getIsAddvance(staffId)) { switch (*cutName) { case 0x30303031: break; case 0x30303032: - dComIfGp_getEvent()->setSkipProc(this, dEv_noFinishSkipProc, 0); + dComIfGp_getEvent()->startCheckSkipEdge(this); field_0x5e1 = 0; break; case 0x30303033: @@ -287,50 +351,46 @@ void daTagTWGate_c::executeDemoFilone3() { mpMorf->setPlaySpeed(1.0f); field_0x5e0 = 1; break; + default: + JUT_ASSERT(560, FALSE); } } switch (*cutName) { - case 0x30303031: { + case 0x30303031: int modelSts = downloadModels(); if (modelSts == 1) { - dComIfGp_evmng_cutEnd(staffId); + eventManager.cutEnd(staffId); } else if (modelSts == -1) { dComIfGp_setNextStage(l_zevParamTbl[mType].mStage, l_zevParamTbl[mType].mPoint, l_zevParamTbl[mType].mRoomNo, l_zevParamTbl[mType].mLayer); } break; - } - case 0x30303032: { - if (dComIfGp_getEvent()->chkFlag2(8)) { + case 0x30303032: + if (dComIfGp_getEvent()->checkSkipEdge()) { dComIfGp_getEvent()->onSkipFade(); dComIfGp_setNextStage(l_zevParamTbl[mType].mStage, l_zevParamTbl[mType].mPoint, l_zevParamTbl[mType].mRoomNo, l_zevParamTbl[mType].mLayer); } - u8 old_5e1 = field_0x5e1; - field_0x5e1++; - - if (old_5e1 == 43) { + if (field_0x5e1++ == 43) { daPy_py_c* player = daPy_getPlayerActorClass(); - csXyz sxyz(0, player->shape_angle.y + 0x8000, 0); + cXyz pos; + csXyz sxyz(0, fopAcM_GetShapeAngle_p(player)->y + 0x8000, 0); - mDoMtx_stack_c::transS(player->current.pos); + mDoMtx_stack_c::transS(fopAcM_GetPosition(player)); mDoMtx_stack_c::YrotM(sxyz.y); mDoMtx_stack_c::transM(0.0f, 240.0f, -710.0f); - cXyz pos; - pos.x = mDoMtx_stack_c::get()[0][3]; - pos.y = mDoMtx_stack_c::get()[1][3]; - pos.z = mDoMtx_stack_c::get()[2][3]; + mDoMtx_stack_c::multVecZero(&pos); dComIfGp_particle_set(0x86C5, &pos, &sxyz, NULL); - mDoAud_seStart(Z2SE_OBJ_DARK_GATE_RIPPLE, &pos, 0, 0); - dComIfGp_evmng_cutEnd(staffId); + Z2GetAudioMgr()->seStart(Z2SE_OBJ_DARK_GATE_RIPPLE, &pos, + 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + eventManager.cutEnd(staffId); } break; - } case 0x30303033: - if (dComIfGp_getEvent()->chkFlag2(8)) { + if (dComIfGp_getEvent()->checkSkipEdge()) { dComIfGp_getEvent()->onSkipFade(); dComIfGp_setNextStage(l_zevParamTbl[mType].mStage, l_zevParamTbl[mType].mPoint, @@ -339,18 +399,19 @@ void daTagTWGate_c::executeDemoFilone3() { } if (mpMorf->isStop()) { - dComIfGp_evmng_cutEnd(staffId); + eventManager.cutEnd(staffId); } break; + default: + JUT_ASSERT(621, FALSE); + break; } if (eventInfo.checkCommandDemoAccrpt() && mEventID != -1 && - dComIfGp_evmng_endCheck(mEventID)) { - dComIfGp_getEvent()->reset(); + eventManager.endCheck(mEventID)) { + dComIfGp_event_reset(); field_0x5e0 = 0; - mActionID = ACT_WAIT; - mAction = ActionTable[mActionID]; - (this->**mAction)(); + setAction(ACT_WAIT); } } } @@ -364,13 +425,16 @@ void daTagTWGate_c::initDemoOrdin1() { void daTagTWGate_c::executeDemoOrdin1() { dEvent_manager_c& evtMng = dComIfGp_getEventManager(); int staffId = evtMng.getMyStaffId(l_myName, NULL, 0); + int* cutName; if (staffId != -1) { - int* cutName = (int*)evtMng.getMyNowCutName(staffId); + cutName = (int*)evtMng.getMyNowCutName(staffId); if (evtMng.getIsAddvance(staffId)) { switch (*cutName) { case '0001': dComIfGp_getEvent()->startCheckSkipEdge(this); break; + default: + JUT_ASSERT(674, FALSE); } } switch (*cutName) { @@ -381,6 +445,9 @@ void daTagTWGate_c::executeDemoOrdin1() { } evtMng.cutEnd(staffId); break; + default: + JUT_ASSERT(686, FALSE); + break; } if (eventInfo.checkCommandDemoAccrpt() && mEventID != -1 && evtMng.endCheck(mEventID)) { setAction(ACT_DEMO_ORDIN_2); @@ -417,23 +484,30 @@ void daTagTWGate_c::executeDemoOrdin2() { break; case '0003': break; + default: + JUT_ASSERT(749, FALSE); + break; } } - int choiceNo; - switch(*cutName) { + switch (*cutName) { case '0001': case '0003': evtMng.cutEnd(staffId); break; case '0002': if (talkProc(NULL, 1, NULL)) { - choiceNo = mMsgFlow.getChoiceNo(); + int choiceNo = mMsgFlow.getChoiceNo(); + // "Two-way branch %s" / "Yes" / "No" + OS_REPORT("二択分岐 %s\n", choiceNo == 0 ? "はい" : "いいえ"); if (choiceNo == 0) { setAction(ACT_DEMO_ORDIN_3); } evtMng.cutEnd(staffId); } break; + default: + JUT_ASSERT(766, FALSE); + break; } if (eventInfo.checkCommandDemoAccrpt() && mEventID != -1 && @@ -447,7 +521,7 @@ void daTagTWGate_c::executeDemoOrdin2() { void daTagTWGate_c::initDemoOrdin3() { field_0x5de = 1; - mIsWolf = (dComIfGp_getLinkPlayer()->mNoResetFlg1 >> 25) & 1; // checking if wolf? + mIsWolf = daPy_py_c::checkNowWolf() ? TRUE : FALSE; eventInfo.setArchiveName(l_zevParamTbl[mType].mArcName); dComIfGp_getEventManager().setObjectArchive(eventInfo.getArchiveName()); mEventID = @@ -477,7 +551,7 @@ void daTagTWGate_c::executeDemoOrdin3() { field_0x5e0 = 1; break; default: - JUT_PANIC(829, "0"); + JUT_ASSERT(829, FALSE); break; } @@ -527,7 +601,7 @@ void daTagTWGate_c::executeDemoOrdin3() { } break; default: - JUT_PANIC(890, "0"); + JUT_ASSERT(890, FALSE); break; } @@ -547,13 +621,17 @@ void daTagTWGate_c::initDemoRanail1() { void daTagTWGate_c::executeDemoRanail1() { dEvent_manager_c& evtMng = dComIfGp_getEventManager(); int staffId = evtMng.getMyStaffId(l_myName, NULL, 0); + int* cutName; if (staffId != -1) { - int* cutName = (int*)evtMng.getMyNowCutName(staffId); + cutName = (int*)evtMng.getMyNowCutName(staffId); if (evtMng.getIsAddvance(staffId)) { switch (*cutName) { case '0001': dComIfGp_getEvent()->startCheckSkipEdge(this); break; + default: + JUT_ASSERT(943, FALSE); + break; } } switch (*cutName) { @@ -564,6 +642,9 @@ void daTagTWGate_c::executeDemoRanail1() { } evtMng.cutEnd(staffId); break; + default: + JUT_ASSERT(955, FALSE); + break; } if (eventInfo.checkCommandDemoAccrpt() && mEventID != -1 && evtMng.endCheck(mEventID)) { setAction(ACT_DEMO_RANAIL_2); @@ -600,23 +681,30 @@ void daTagTWGate_c::executeDemoRanail2() { break; case '0003': break; + default: + JUT_ASSERT(1018, FALSE); + break; } } - int choiceNo; - switch(*cutName) { + switch (*cutName) { case '0001': case '0003': evtMng.cutEnd(staffId); break; case '0002': if (talkProc(NULL, 1, NULL)) { - choiceNo = mMsgFlow.getChoiceNo(); + int choiceNo = mMsgFlow.getChoiceNo(); + // "Two-way branch" / "Yes" / "No" + OS_REPORT("二択分岐 %s\n", choiceNo == 0 ? "はい" : "いいえ"); if (choiceNo == 0) { setAction(ACT_DEMO_RANAIL_3); } evtMng.cutEnd(staffId); } break; + default: + JUT_ASSERT(1035, FALSE); + break; } if (eventInfo.checkCommandDemoAccrpt() && mEventID != -1 && @@ -630,7 +718,7 @@ void daTagTWGate_c::executeDemoRanail2() { void daTagTWGate_c::initDemoRanail3() { field_0x5de = 1; - mIsWolf = (dComIfGp_getLinkPlayer()->mNoResetFlg1 >> 25) & 1; // checking if wolf? + mIsWolf = daPy_py_c::checkNowWolf() ? TRUE : FALSE; eventInfo.setArchiveName(l_zevParamTbl[mType].mArcName); dComIfGp_getEventManager().setObjectArchive(eventInfo.getArchiveName()); mEventID = @@ -662,7 +750,7 @@ void daTagTWGate_c::executeDemoRanail3() { field_0x5e0 = 1; break; default: - JUT_PANIC(1099, "0"); + JUT_ASSERT(1099, FALSE); break; } } @@ -711,7 +799,7 @@ void daTagTWGate_c::executeDemoRanail3() { } break; default: - JUT_PANIC(1160, "0"); + JUT_ASSERT(1160, FALSE); break; } @@ -731,13 +819,16 @@ void daTagTWGate_c::initDemoHyral1() { void daTagTWGate_c::executeDemoHyral1() { dEvent_manager_c& evtMng = dComIfGp_getEventManager(); int staffId = evtMng.getMyStaffId(l_myName, NULL, 0); + int* cutName; if (staffId != -1) { - int* cutName = (int*)evtMng.getMyNowCutName(staffId); + cutName = (int*)evtMng.getMyNowCutName(staffId); if (evtMng.getIsAddvance(staffId)) { switch (*cutName) { case '0001': dComIfGp_getEvent()->startCheckSkipEdge(this); break; + default: + JUT_ASSERT(1213, FALSE); } } switch (*cutName) { @@ -748,6 +839,9 @@ void daTagTWGate_c::executeDemoHyral1() { } evtMng.cutEnd(staffId); break; + default: + JUT_ASSERT(1225, FALSE); + break; } if (eventInfo.checkCommandDemoAccrpt() && mEventID != -1 && evtMng.endCheck(mEventID)) { setAction(ACT_DEMO_HYRAL_2); @@ -783,23 +877,28 @@ void daTagTWGate_c::executeDemoHyral2() { case '0002': initTalk(0xbc1, NULL); break; + default: + JUT_ASSERT(1288, FALSE); } } - int choiceNo; - switch(*piVar3) { + switch (*piVar3) { case '0001': case '0003': eventMgr.cutEnd(staffId); break; case '0002': if (talkProc(NULL, 1, NULL)) { - choiceNo = mMsgFlow.getChoiceNo(); + int choiceNo = mMsgFlow.getChoiceNo(); + OS_REPORT("二択分岐 %s\n", choiceNo == 0 ? "はい" : "いいえ"); if (choiceNo == 0) { setAction(ACT_DEMO_HYRAL_3); } eventMgr.cutEnd(staffId); } break; + default: + JUT_ASSERT(1305, FALSE); + break; } if (eventInfo.checkCommandDemoAccrpt() && mEventID != -1 && eventMgr.endCheck(mEventID)) @@ -812,7 +911,7 @@ void daTagTWGate_c::executeDemoHyral2() { void daTagTWGate_c::initDemoHyral3() { field_0x5de = 1; - mIsWolf = (dComIfGp_getLinkPlayer()->mNoResetFlg1 >> 25) & 1; // checking if wolf? + mIsWolf = daPy_py_c::checkNowWolf() ? TRUE : FALSE; eventInfo.setArchiveName(l_zevParamTbl[mType].mArcName); dComIfGp_getEventManager().setObjectArchive(eventInfo.getArchiveName()); mEventID = @@ -841,6 +940,8 @@ void daTagTWGate_c::executeDemoHyral3() { mpMorf->setPlaySpeed(1.0f); field_0x5e0 = 1; break; + default: + JUT_ASSERT(1368, FALSE); } } switch(*piVar3) { @@ -883,6 +984,9 @@ void daTagTWGate_c::executeDemoHyral3() { eventMgr.cutEnd(staffId); } break; + default: + JUT_ASSERT(1417, FALSE); + break; } if (eventInfo.checkCommandDemoAccrpt() && mEventID != -1 && eventMgr.endCheck(mEventID)) @@ -894,17 +998,15 @@ void daTagTWGate_c::executeDemoHyral3() { } void daTagTWGate_c::initBaseMtx() { - cullMtx = mpMorf->getModel()->getBaseTRMtx(); - fopAc_ac_c* player = (fopAc_ac_c*)dComIfGp_getPlayer(0); + fopAcM_SetMtx(this, mpMorf->getModel()->getBaseTRMtx()); + fopAc_ac_c* player = daPy_getPlayerActorClass(); - shape_angle.y = player->shape_angle.y + 0x8000; - mDoMtx_stack_c::transS(player->current.pos); + shape_angle.y = fopAcM_GetShapeAngle_p(player)->y + 0x8000; + mDoMtx_stack_c::transS(fopAcM_GetPosition(player)); mDoMtx_stack_c::YrotM(shape_angle.y); mDoMtx_stack_c::transM(0.0f, 250.0f, -840.0f); - current.pos.x = mDoMtx_stack_c::get()[0][3]; - current.pos.y = mDoMtx_stack_c::get()[1][3]; - current.pos.z = mDoMtx_stack_c::get()[2][3]; + mDoMtx_stack_c::multVecZero(¤t.pos); mpMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); } @@ -917,14 +1019,18 @@ int daTagTWGate_c::downloadModels() { } if (phase_state == cPhs_COMPLEATE_e) { - if (fopAcM_entrySolidHeap(this, createHeapCallBack, 0x3140)) { - return 1; - } else { + if (!fopAcM_entrySolidHeap(this, createHeapCallBack, 0x3140)) { return -1; + } else { + return 1; } } - return phase_state == cPhs_ERROR_e ? -1 : 0; + if (phase_state == cPhs_ERROR_e) { + return -1; + } else { + return 0; + } } void daTagTWGate_c::initTalk(int param_0, fopAc_ac_c** param_1) { @@ -957,13 +1063,17 @@ bool daTagTWGate_c::talkProc(int* param_1, int param_2, fopAc_ac_c** param_3) { } int daTagTWGate_c::createHeapCallBack(fopAc_ac_c* i_actor) { - return ((daTagTWGate_c*)i_actor)->CreateHeap(); + daTagTWGate_c* gate = static_cast(i_actor); + return gate->CreateHeap(); } int daTagTWGate_c::CreateHeap() { - J3DModelData* modelData = static_cast(dComIfG_getObjectRes("TWGate_Md", 7)); + J3DModelData* mdlData_p = NULL; + int var_r27 = 0; + mdlData_p = static_cast(dComIfG_getObjectRes("TWGate_Md", 7)); + JUT_ASSERT(1685, NULL != mdlData_p); mpMorf = - new mDoExt_McaMorfSO(modelData, NULL, NULL, + new mDoExt_McaMorfSO(mdlData_p, NULL, NULL, static_cast(dComIfG_getObjectRes("TWGate_Md", 4)), 0, 0.0f, 0, -1, NULL, 0, 0x11000084); @@ -986,7 +1096,7 @@ int daTagTWGate_c::create() { int phase_state; if (dComIfGs_isDarkClearLV(l_zevParamTbl[mType].mLv)) { - phase_state = cPhs_ERROR_e; + return cPhs_ERROR_e; } else { phase_state = dComIfG_resLoad(&mPhaseZevArc, l_zevParamTbl[mType].mArcName); if (phase_state == cPhs_COMPLEATE_e) { @@ -997,36 +1107,59 @@ int daTagTWGate_c::create() { return phase_state; } -static int daTagTWGate_Create(fopAc_ac_c* i_actor) { - return ((daTagTWGate_c*)i_actor)->create(); -} - -inline daTagTWGate_c::~daTagTWGate_c() { - dComIfG_resDelete(&mPhaseZevArc, l_zevParamTbl[mType].mArcName); - - if (mPhaseMdRes.id != cPhs_INIT_e) { - dComIfG_resDelete(&mPhaseMdRes, "TWGate_Md"); +int daTagTWGate_c::draw() { + if (field_0x5e0 != 0) { + mpMorf->entryDL(); } - if (mPhasePyRes.id != cPhs_INIT_e) { - dComIfG_resDelete(&mPhasePyRes, mIsWolf ? "TWGate_Wf" : "TWGate_Lk"); +#if DEBUG + if (attr().show_range) { + dDbVw_drawCylinderOpa(current.pos, scale.x * 100.0f, scale.y * 100.0f, (GXColor){0xff, 0xff, 0xff, 0xff}, 1); } -} +#endif -static int daTagTWGate_Delete(daTagTWGate_c* i_gate) { - i_gate->~daTagTWGate_c(); return 1; } -static int daTagTWGate_Execute(daTagTWGate_c* i_gate) { - return i_gate->execute(); +void daTagTWGate_c::create_init() { +#if DEBUG + mHio.ct(); +#endif + field_0x5e0 = 0; + setAction(ACT_WAIT); } -static int daTagTWGate_Draw(daTagTWGate_c* i_gate) { - return i_gate->draw(); +static int daTagTWGate_Create(fopAc_ac_c* i_this) { + daTagTWGate_c* gate = static_cast(i_this); + fopAcM_RegisterCreateID(i_this, "Tag_TWGate"); + return gate->create(); } -static int daTagTWGate_IsDelete(daTagTWGate_c*) { +static int daTagTWGate_Delete(daTagTWGate_c* i_this) { + fopAcM_RegisterDeleteID(i_this, "Tag_TWGate"); + i_this->~daTagTWGate_c(); + return 1; +} + +int daTagTWGate_c::execute() { + callExecute(); + + if (field_0x5e0 != 0) { + mpMorf->play(0, 0); + mpMorf->modelCalc(); + } + return 1; +} + +static int daTagTWGate_Execute(daTagTWGate_c* i_this) { + return i_this->execute(); +} + +static int daTagTWGate_Draw(daTagTWGate_c* i_this) { + return i_this->draw(); +} + +static int daTagTWGate_IsDelete(daTagTWGate_c* i_this) { return 1; } diff --git a/src/d/actor/d_a_tag_ajnot.cpp b/src/d/actor/d_a_tag_ajnot.cpp index cc5cc9155a..988af1ff42 100644 --- a/src/d/actor/d_a_tag_ajnot.cpp +++ b/src/d/actor/d_a_tag_ajnot.cpp @@ -15,12 +15,15 @@ int daTagAJnot_c::create() { } static int daTagAJnot_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagAJnot_c* ajNot = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return ajNot->create(); } daTagAJnot_c::~daTagAJnot_c() {} static int daTagAJnot_Delete(daTagAJnot_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagAJnot_c(); return 1; } diff --git a/src/d/actor/d_a_tag_allmato.cpp b/src/d/actor/d_a_tag_allmato.cpp index 9bb94d22f9..bf833803ec 100644 --- a/src/d/actor/d_a_tag_allmato.cpp +++ b/src/d/actor/d_a_tag_allmato.cpp @@ -2,8 +2,8 @@ #include "d/actor/d_a_tag_allmato.h" #include "d/actor/d_a_npc4.h" -#include "d/actor/d_a_obj_itamato.h" #include "d/actor/d_a_obj_boumato.h" +#include "d/actor/d_a_obj_itamato.h" #include "d/actor/d_a_arrow.h" #include "f_op/f_op_camera_mng.h" @@ -268,10 +268,14 @@ static fopAc_ac_c* l_findActorPtrs[100]; static u32 l_findCount; void* daTag_AllMato_c::srchBouMato(void* i_actor, void* i_data) { - if (l_findCount < 100 && i_actor != NULL && i_actor != i_data) { - if (fopAcM_IsExecuting(fopAcM_GetID(i_actor)) && fopAcM_GetName(i_actor) == PROC_OBJ_BOUMATO) { - l_findActorPtrs[l_findCount] = (fopAc_ac_c*)i_actor; - l_findCount++; + void* data = i_data; + if (l_findCount < 100) { + fopAc_ac_c* actor = (fopAc_ac_c*)i_actor; + if (actor != NULL && actor != data) { + if (fopAcM_IsExecuting(fopAcM_GetID(actor)) && fopAcM_GetName(i_actor) == PROC_OBJ_BOUMATO) { + l_findActorPtrs[l_findCount] = actor; + l_findCount++; + } } } @@ -279,10 +283,14 @@ void* daTag_AllMato_c::srchBouMato(void* i_actor, void* i_data) { } void* daTag_AllMato_c::srchItaMato(void* i_actor, void* i_data) { - if (l_findCount < 100 && i_actor != NULL && i_actor != i_data) { - if (fopAcM_IsExecuting(fopAcM_GetID(i_actor)) && fopAcM_GetName(i_actor) == PROC_OBJ_ITAMATO) { - l_findActorPtrs[l_findCount] = (fopAc_ac_c*)i_actor; - l_findCount++; + void* data = i_data; + if (l_findCount < 100) { + fopAc_ac_c* actor = (fopAc_ac_c*)i_actor; + if (actor != NULL && actor != data) { + if (fopAcM_IsExecuting(fopAcM_GetID(actor)) && fopAcM_GetName(i_actor) == PROC_OBJ_ITAMATO) { + l_findActorPtrs[l_findCount] = actor; + l_findCount++; + } } } @@ -290,10 +298,14 @@ void* daTag_AllMato_c::srchItaMato(void* i_actor, void* i_data) { } void* daTag_AllMato_c::srchTaro(void* i_actor, void* i_data) { - if (l_findCount < 100 && i_actor != NULL && i_actor != i_data) { - if (fopAcM_IsExecuting(fopAcM_GetID(i_actor)) && fopAcM_GetName(i_actor) == PROC_NPC_TARO) { - l_findActorPtrs[l_findCount] = (fopAc_ac_c*)i_actor; - l_findCount++; + void* data = i_data; + if (l_findCount < 100) { + fopAc_ac_c* actor = (fopAc_ac_c*)i_actor; + if (actor != NULL && actor != data) { + if (fopAcM_IsExecuting(fopAcM_GetID(actor)) && fopAcM_GetName(i_actor) == PROC_NPC_TARO) { + l_findActorPtrs[l_findCount] = actor; + l_findCount++; + } } } @@ -301,10 +313,14 @@ void* daTag_AllMato_c::srchTaro(void* i_actor, void* i_data) { } void* daTag_AllMato_c::srchArrow(void* i_actor, void* i_data) { - if (l_findCount < 100 && i_actor != NULL && i_actor != i_data) { - if (fopAcM_IsExecuting(fopAcM_GetID(i_actor)) && fopAcM_GetName(i_actor) == PROC_ARROW) { - l_findActorPtrs[l_findCount] = (fopAc_ac_c*)i_actor; - l_findCount++; + void* data = i_data; + if (l_findCount < 100) { + fopAc_ac_c* actor = (fopAc_ac_c*)i_actor; + if (actor != NULL && actor != data) { + if (fopAcM_IsExecuting(fopAcM_GetID(actor)) && fopAcM_GetName(i_actor) == PROC_ARROW) { + l_findActorPtrs[l_findCount] = actor; + l_findCount++; + } } } @@ -436,11 +452,12 @@ fopAc_ac_c* daTag_AllMato_c::getTaroActorP() { fopAc_ac_c* boumato_actor_p = NULL; fopAc_ac_c* itamato_actor_p = NULL; + int sp14 = 0; for (int i = 0; i < 499; i++) { for (int j = 0; j < mBouMatoActorNum; j++) { boumato_actor_p = mBouMatoActorMngr[j].getActorP(); if (boumato_actor_p != NULL) { - int sp14 = ((daObj_BouMato_c*)boumato_actor_p)->checkCrs(arrow_p, field_0x590[i], field_0x590[i + 1], sp94.abs() + arrow_p->getArrowOutLength()); + sp14 = ((daObj_BouMato_c*)boumato_actor_p)->checkCrs(arrow_p, field_0x590[i], field_0x590[i + 1], sp94.abs() + arrow_p->getArrowOutLength()); if (sp14 != 0) { mBrkMatoActorMngr.entry(mBouMatoActorMngr[j].getActorP()); return sp14; @@ -451,7 +468,7 @@ fopAc_ac_c* daTag_AllMato_c::getTaroActorP() { for (int j = 0; j < mItaMatoActorNum; j++) { itamato_actor_p = mItaMatoActorMngr[j].getActorP(); if (itamato_actor_p != NULL) { - int sp14 = ((daObj_ItaMato_c*)itamato_actor_p)->checkCrs(arrow_p, field_0x590[i], field_0x590[i + 1], sp94.abs() + arrow_p->getArrowOutLength()); + sp14 = ((daObj_ItaMato_c*)itamato_actor_p)->checkCrs(arrow_p, field_0x590[i], field_0x590[i + 1], sp94.abs() + arrow_p->getArrowOutLength()); if (sp14 != 0) { mBrkMatoActorMngr.entry(mItaMatoActorMngr[j].getActorP()); return sp14; @@ -466,7 +483,7 @@ fopAc_ac_c* daTag_AllMato_c::getTaroActorP() { } int daTag_AllMato_c::checkCrsMato2() { - fopAc_ac_c* sp28; + fopAc_ac_c* sp28 = NULL; getArrowActorP(); for (int i = 0; i < (int)l_findCount; i++) { @@ -499,13 +516,13 @@ int daTag_AllMato_c::checkCrsMato2() { } fopAc_ac_c* sp18 = NULL; - fopAc_ac_c* sp14 = NULL; + int sp14 = NULL; for (int i = 0; i < 499; i++) { for (int j = 0; j < mBouMatoActorNum; j++) { sp18 = mBouMatoActorMngr[j].getActorP(); if (sp18 != NULL) { - int sp14 = ((daObj_BouMato_c*)sp18)->checkCrs(arrow_p, field_0x590[i], field_0x590[i + 1], sp80.abs() + arrow_p->getArrowOutLength()); + sp14 = ((daObj_BouMato_c*)sp18)->checkCrs(arrow_p, field_0x590[i], field_0x590[i + 1], sp80.abs() + arrow_p->getArrowOutLength()); if (sp14 != 0) { mBrkMatoActorMngr.entry(mBouMatoActorMngr[j].getActorP()); return sp14; @@ -520,10 +537,11 @@ int daTag_AllMato_c::checkCrsMato2() { } int daTag_AllMato_c::checkBrkMato() { + daObj_ItaMato_c* actor_p = NULL; int rt = 0; for (int i = 0; i < mItaMatoActorNum; i++) { - daObj_ItaMato_c* actor_p = (daObj_ItaMato_c*)mItaMatoActorMngr[i].getActorP(); + actor_p = (daObj_ItaMato_c*)mItaMatoActorMngr[i].getActorP(); rt = actor_p->checkBrk(); if (rt != 0) { mBrkMatoActorMngr.entry(mItaMatoActorMngr[i].getActorP()); diff --git a/src/d/actor/d_a_tag_arena.cpp b/src/d/actor/d_a_tag_arena.cpp index bdaa2dc16a..24ba2b1c86 100644 --- a/src/d/actor/d_a_tag_arena.cpp +++ b/src/d/actor/d_a_tag_arena.cpp @@ -9,10 +9,12 @@ static int daTagArena_Create(fopAc_ac_c* i_this) { daTagArena_c* arena_tag = (daTagArena_c*)i_this; + int id = fopAcM_GetID(i_this); return arena_tag->create(); } static int daTagArena_Delete(daTagArena_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagArena_c(); return 1; } diff --git a/src/d/actor/d_a_tag_assistance.cpp b/src/d/actor/d_a_tag_assistance.cpp index 8fce57e12e..62fdc624f9 100644 --- a/src/d/actor/d_a_tag_assistance.cpp +++ b/src/d/actor/d_a_tag_assistance.cpp @@ -7,8 +7,27 @@ #include "d/actor/d_a_tag_assistance.h" +void daTagAssist_c::create_init() { + attention_info.flags = 0; + field_0x570 = -1; +} + +int daTagAssist_c::create() { + fopAcM_ct(this, daTagAssist_c); + create_init(); + return cPhs_COMPLEATE_e; +} + +int daTagAssist_c::execute() { + if (fopAcM_searchPlayerDistanceXZ(this) < scale.x * 100.0f) { + // empty block + } + return 1; +} + static int daTagAssist_Create(fopAc_ac_c* i_this) { daTagAssist_c* tag_assist = (daTagAssist_c*)i_this; + int id = fopAcM_GetID(i_this); return tag_assist->create(); } @@ -21,6 +40,7 @@ static int daTagAssist_IsDelete(daTagAssist_c* i_this) { } static int daTagAssist_Delete(daTagAssist_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagAssist_c(); return 1; } diff --git a/src/d/actor/d_a_tag_attack_item.cpp b/src/d/actor/d_a_tag_attack_item.cpp index f3bfc4becb..6e2ce1c8e4 100644 --- a/src/d/actor/d_a_tag_attack_item.cpp +++ b/src/d/actor/d_a_tag_attack_item.cpp @@ -1,13 +1,24 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_tag_attack_item.h" + #include "SSystem/SComponent/c_math.h" #include "d/actor/d_a_player.h" +#include "d/d_debug_viewer.h" -void daTagAtkItem_c::setBaseMtx() { - mDoMtx_stack_c::transS(current.pos); - mDoMtx_stack_c::ZXYrotM(shape_angle); -} +class daTagAtkItem_HIO_c : public mDoHIO_entry_c { +public: + daTagAtkItem_HIO_c(); + + void genMessage(JORMContext*); + + f32 field_0x8; + u8 show_range; +}; + +#if DEBUG +daTagAtkItem_HIO_c l_HIO; +#endif static dCcD_SrcCyl l_cyl_src = { { @@ -17,14 +28,28 @@ static dCcD_SrcCyl l_cyl_src = { {0x0}, // mGObjCo }, // mObjInf { - { - {0.0f, 0.0f, 0.0f}, // mCenter - 50.0f, // mRadius - 100.0f // mHeight - } // mCyl + { + {0.0f, 0.0f, 0.0f}, // mCenter + 50.0f, // mRadius + 100.0f // mHeight + } // mCyl } }; +#if DEBUG +void daTagAtkItem_HIO_c::genMessage(JORMContext* ctx) { + // "Attack reaction item" + ctx->genLabel("攻撃反応アイテム", 0); + // "Show range" + ctx->genCheckBox("範囲表示", &show_range, 1); +} +#endif + +void daTagAtkItem_c::setBaseMtx() { + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::ZXYrotM(shape_angle); +} + int daTagAtkItem_c::Create() { mCcStts.Init(0, 0xFF, this); mCyl.Set(l_cyl_src); @@ -36,6 +61,11 @@ int daTagAtkItem_c::Create() { return 1; } +daTagAtkItem_HIO_c::daTagAtkItem_HIO_c() { + field_0x8 = 0.0f; + show_range = 0; +} + int daTagAtkItem_c::create() { fopAcM_ct(this, daTagAtkItem_c); @@ -44,6 +74,11 @@ int daTagAtkItem_c::create() { } OS_REPORT("攻撃反応アイテム:<%x>\n", fopAcM_GetParam(this)); + +#if DEBUG + l_HIO.entryHIO("攻撃反応アイテム"); +#endif + return cPhs_COMPLEATE_e; } @@ -108,12 +143,7 @@ BOOL daTagAtkItem_c::checkHit() { void daTagAtkItem_c::createItem() { csXyz angle(0, 0, 0); - int create_num; - if (getNum() == 0xFF) { - create_num = 1; - } else { - create_num = getNum(); - } + int create_num = getNum() == 0xFF ? 1 : getNum(); int item_bit = getItemBit(); for (int i = 0; i < create_num; i++) { @@ -128,19 +158,40 @@ void daTagAtkItem_c::createItem() { } } -int daTagAtkItem_c::_delete() { +int daTagAtkItem_c::draw() { +#if DEBUG + if (l_HIO.show_range) { + GXColor color = (GXColor){0, 0, 0xff, 0x80}; + dDbVw_drawCylinderXlu(current.pos, scale.x * 50.0f, scale.y * 100.0f, color, 1); + } +#endif + return 1; } +int daTagAtkItem_c::_delete() { +#if DEBUG + l_HIO.removeHIO(); +#endif + + return 1; +} + +static int daTagAtkItem_Draw(daTagAtkItem_c* i_this) { + return i_this->draw(); +} + static int daTagAtkItem_Execute(daTagAtkItem_c* i_this) { return i_this->execute(); } static int daTagAtkItem_Delete(daTagAtkItem_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->_delete(); } static int daTagAtkItem_Create(daTagAtkItem_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->create(); } @@ -149,7 +200,11 @@ static actor_method_class l_daTagAtkItem_Method = { (process_method_func)daTagAtkItem_Delete, (process_method_func)daTagAtkItem_Execute, (process_method_func)NULL, +#if DEBUG + (process_method_func)daTagAtkItem_Draw, +#else (process_method_func)NULL, +#endif }; actor_process_profile_definition g_profile_Tag_AttackItem = { diff --git a/src/d/actor/d_a_tag_attention.cpp b/src/d/actor/d_a_tag_attention.cpp index 29a1fa5279..270fc030a8 100644 --- a/src/d/actor/d_a_tag_attention.cpp +++ b/src/d/actor/d_a_tag_attention.cpp @@ -6,12 +6,98 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_tag_attention.h" -#include "d/actor/d_a_player.h" -static const u8 l_dist_tbl[] = { 0x23, 0x24 }; +#include "d/actor/d_a_player.h" +#include "d/d_debug_viewer.h" + +#if DEBUG +daAttp_HIO_c l_HIO; + +void daAttp_HIO_c::genMessage(JORMContext* ctx) { + static const char* l_type_name[37] = { + "注目なし - ダミー", // No focus - dummy + "注目だけ - 標準", // Focus only - standard + "会話 - 標準", // Conversation - standard + "戦闘 - 標準", // Combat - standard + "戦闘B - 標準", // Combat B - standard + "会話B - 標準", // Conversation B - standard + "持上げ - 標準", // Lifting - standard + "持上げ - タル", // Lifting - barrel + "持上げ - 壷大", // Lifting - large jar + "持上げ - 水壷", // Lifting - water jar + "持上げ - 椅子", // Lifting - chair + "持上げ - 小石", // Lifting - pebble + "持上げ - 岩", // Lifting - rock + "馬", // Horse + "ドア、宝箱", // Door, treasure chest + "持上げボコの棒", // Lifting stick + "敵氷", // Enemy ice + "引き連れられ石像", // Dragged stone statue + "引き連れられ石像", // Dragged stone statue + "ジャガ-", // Jaguar + "接近会話", // Close-range conversation + "長距離戦闘", // Long-range combat + "短距離戦闘", // Short-range combat + "予備戦闘", // Reserve combat + "予備戦闘", // Reserve combat + "予備戦闘", // Reserve combat + "床レバー用", // Floor lever + "狼鎖", // Wolf chain + "NPCナビィ - ハイラル城、呼びかけデモ用(会話)", // NPC Navii - Hyrule Castle, demo call (conversation) + "NPCナビィ - ハイラル城、呼びかけデモ用(注目)", // NPC Navii - Hyrule Castle, demo call (focus) + "狼掘る", // Wolf digging + "カヌー", // Canoe + "覗きタグ", // Peek tag + "馬戦闘", // Horse combat + "注目点 通常長さ", // Focus point - normal length + "注目点 長注目版", // Focus point - long focus + "調整用カスタム", // Adjustment custom + }; + static const u8 l_type[37] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, + }; + static const int num = 37; + + // "Focus point" + ctx->genLabel("注目点", 0, 0, NULL, -1, -1, 0x200, 0x18); + // "Type switching ON" + ctx->genCheckBox("タイプ切り替えON", &enable_type_switching, 1, 0, NULL, -1, -1, 0x200, 0x18); + + // "Type specification" + ctx->startComboBox("タイプ指定", &type_spec, 0, NULL, -1, -1, 0x100, 0x1a); + for (int i = 0; i < num; i++) { + ctx->genComboBoxItem(l_type_name[i], l_type[i]); + } + ctx->endComboBox(); + + // "Distance display ON" + ctx->genCheckBox("距離表示ON", &enable_distance_display, 1, 0, NULL, -1, -1, 0x200, 0x18); + + // "For adjustment" + ctx->genLabel("調整用", 0, 0, NULL, -1, -1, 0x200, 0x18); + ctx->genSlider("on", &dist_max, 0.0f, 10000.0f, 0, NULL, -1, -1, 0x200, 0x18); + ctx->genSlider("off", &dist_max_release, 0.0f, 10000.0f, 0, NULL, -1, -1, 0x200, 0x18); + ctx->genSlider("angle adjust", &dist_adjust, 0.0f, 10000.0f, 0, NULL, -1, -1, 0x200, 0x18); + ctx->genSlider("hi", &upper_y, -10000.0f, 10000.0f, 0, NULL, -1, -1, 0x200, 0x18); + ctx->genSlider("low", &lower_y, -10000.0f, 10000.0f, 0, NULL, -1, -1, 0x200, 0x18); +} +#endif int daAttp_c::Create() { - attention_info.distances[fopAc_attn_LOCK_e] = l_dist_tbl[daAttp_prm::getArg4(this)]; + static const u8 l_dist_tbl[] = { 35, 36 }; + + u8 arg4 = daAttp_prm::getArg4(this); + attention_info.distances[fopAc_attn_LOCK_e] = l_dist_tbl[arg4]; + +#if DEBUG + field_0x598 = l_dist_tbl[arg4]; + + mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); + cMtx_copy(mDoMtx_stack_c::get(), field_0x568); + fopAcM_SetMtx(this, field_0x568); +#endif execute(); return 1; @@ -20,10 +106,31 @@ int daAttp_c::Create() { int daAttp_c::create() { fopAcM_ct(this, daAttp_c); Create(); + +#if DEBUG + // "Key points" + l_HIO.entryHIO("注目点"); +#endif + return cPhs_COMPLEATE_e; } int daAttp_c::execute() { +#if DEBUG + if (l_HIO.enable_type_switching) { + attention_info.distances[fopAc_attn_LOCK_e] = l_HIO.type_spec; + } else { + attention_info.distances[fopAc_attn_LOCK_e] = field_0x598; + } + + dist_entry& distTable = dAttention_c::getDistTable(37); + distTable.mDistMax = l_HIO.dist_max; + distTable.mDistMaxRelease = l_HIO.dist_max_release; + distTable.mDistanceAdjust = l_HIO.dist_adjust; + distTable.mUpperY = l_HIO.upper_y; + distTable.mLowerY = l_HIO.lower_y; +#endif + bool bVar1 = true; fopAc_ac_c& link = *daPy_getPlayerActorClass(); @@ -58,6 +165,7 @@ int daAttp_c::execute() { } break; default: + JUT_ASSERT(432, FALSE); break; case 7: break; @@ -80,6 +188,8 @@ int daAttp_c::execute() { case 3: bVar1 = false; break; + default: + JUT_ASSERT(461, FALSE); } } else { switch (daAttp_prm::getArg0(this)) { @@ -97,6 +207,9 @@ int daAttp_c::execute() { break; case 3: bVar1 = false; + break; + default: + JUT_ASSERT(485, FALSE); } if (daAttp_prm::getSw2(this) != 0xff) { @@ -120,13 +233,36 @@ int daAttp_c::execute() { } int daAttp_c::draw() { +#if DEBUG + if (l_HIO.enable_distance_display) { + GXColor color1 = {0xff, 0, 0, 0x80}; + GXColor color2 = {0, 0, 0xff, 0x80}; + cXyz sp10(current.pos); + sp10.y += 5.0f; + dist_entry& distTable = + dAttention_c::getDistTable(attention_info.distances[fopAc_attn_LOCK_e]); + + dDbVw_drawCircleXlu(current.pos, distTable.mDistMax, color2, 1, 12); + dDbVw_drawCircleXlu(current.pos, distTable.mDistMaxRelease, color1, 1, 12); + } +#endif + return 1; } int daAttp_c::_delete() { +#if DEBUG + l_HIO.removeHIO(); +#endif + return 1; } +daAttp_HIO_c::daAttp_HIO_c() { + type_spec = 0; + dist_max = dist_max_release = dist_adjust = upper_y = lower_y = 0.0f; +} + static int daAttp_Draw(daAttp_c* i_this) { return i_this->draw(); } @@ -137,11 +273,14 @@ static int daAttp_Execute(daAttp_c* i_this) { } static int daAttp_Delete(daAttp_c* i_this) { + fpc_ProcID id = fopAcM_GetID(i_this); return i_this->_delete(); } static int daAttp_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daAttp_c* attp = static_cast(i_this); + fpc_ProcID id = fopAcM_GetID(i_this); + return attp->create(); } static actor_method_class l_daAttp_Method = { diff --git a/src/d/actor/d_a_tag_bottle_item.cpp b/src/d/actor/d_a_tag_bottle_item.cpp index 20dce2e102..77128dee7b 100644 --- a/src/d/actor/d_a_tag_bottle_item.cpp +++ b/src/d/actor/d_a_tag_bottle_item.cpp @@ -5,34 +5,32 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep +#include "d/actor/d_a_player.h" #include "d/actor/d_a_tag_bottle_item.h" #include "d/d_item.h" -#include "d/actor/d_a_player.h" #include "d/d_procname.h" +#include "d/d_s_play.h" -s32 daTag_BottleItem_c::create() { - s32 ret; - +int daTag_BottleItem_c::create() { fopAcM_ct(this, daTag_BottleItem_c); setTypeFromParam(); if (!isBottleItem(mBottleItemType)) { - ret = cPhs_ERROR_e; - } else { - initialize(); - ret = cPhs_COMPLEATE_e; + return cPhs_ERROR_e; } - return ret; + initialize(); + return cPhs_COMPLEATE_e; } -s32 daTag_BottleItem_c::Delete() { +int daTag_BottleItem_c::Delete() { return 1; } -s32 daTag_BottleItem_c::Execute() { - if (chkEvent()) { +int daTag_BottleItem_c::Execute() { + int eventResult = chkEvent(); + if (eventResult) { if (mProcessFunc) { (this->*mProcessFunc)(0); } @@ -43,7 +41,7 @@ s32 daTag_BottleItem_c::Execute() { return 1; } -s32 daTag_BottleItem_c::Draw() { +int daTag_BottleItem_c::Draw() { return 1; } @@ -72,26 +70,26 @@ int daTag_BottleItem_c::checkProcess(ProcessFunc i_processFunc) { } int daTag_BottleItem_c::setProcess(ProcessFunc i_processFunc) { - int uVar3 = 0; + int retval = 0; if (checkProcess(i_processFunc)) { - return 0; + return retval; } else { mEventType = 2; if (mProcessFunc) { - uVar3 = (this->*mProcessFunc)(0); + retval = (this->*mProcessFunc)(0); } mEventType = 0; mProcessFunc = i_processFunc; if (mProcessFunc) { - uVar3 = (this->*mProcessFunc)(0); + retval = (this->*mProcessFunc)(0); } mEventType = 1; } - return uVar3; + return retval; } void daTag_BottleItem_c::setAttnPos() { @@ -99,8 +97,8 @@ void daTag_BottleItem_c::setAttnPos() { eyePos = current.pos; } -s32 daTag_BottleItem_c::chkEvent() { - s32 uVar2 = 1; +int daTag_BottleItem_c::chkEvent() { + int uVar2 = 1; if (!dComIfGp_getEvent()->isOrderOK()) { uVar2 = 0; @@ -112,7 +110,7 @@ s32 daTag_BottleItem_c::chkEvent() { return uVar2; } -s32 daTag_BottleItem_c::orderEvent() { +int daTag_BottleItem_c::orderEvent() { makeSoup(); if (!daPy_py_c::checkNowWolf() && mBottleItemType != fpcNm_ITEM_EMPTY_BOTTLE) { @@ -150,8 +148,9 @@ int daTag_BottleItem_c::wait(void* param_0) { if (eventInfo.checkCommandCatch() == 0){ fopAc_ac_c* player = dComIfGp_getPlayer(0); cXyz pos = attention_info.position - player->attention_info.position; - - dComIfGp_att_CatchRequest(this,mBottleItemType,140.0f,pos.y+100.0f,pos.y-100.0f,0x2000,1); + + dComIfGp_att_CatchRequest(this, mBottleItemType, 140.0f + YREG_F(4), pos.y + 100.0f, + pos.y - 100.0f, 0x2000 + YREG_S(5), 1); eventInfo.onCondition(dEvtCnd_40_e); } case 2: @@ -162,23 +161,23 @@ int daTag_BottleItem_c::wait(void* param_0) { return 1; } -static s32 daTag_BottleItem_Create(void* i_this) { +static int daTag_BottleItem_Create(void* i_this) { return static_cast(i_this)->create(); } -static s32 daTag_BottleItem_Delete(void* i_this) { +static int daTag_BottleItem_Delete(void* i_this) { return static_cast(i_this)->Delete(); } -static s32 daTag_BottleItem_Execute(void* i_this) { +static int daTag_BottleItem_Execute(void* i_this) { return static_cast(i_this)->Execute(); } -static s32 daTag_BottleItem_Draw(void* i_this) { +static int daTag_BottleItem_Draw(void* i_this) { return static_cast(i_this)->Draw(); } -static s32 daTag_BottleItem_IsDelete(void* i_this) { +static int daTag_BottleItem_IsDelete(void* i_this) { return 1; } diff --git a/src/d/actor/d_a_tag_camera.cpp b/src/d/actor/d_a_tag_camera.cpp index f1b34e8084..5378ff1182 100644 --- a/src/d/actor/d_a_tag_camera.cpp +++ b/src/d/actor/d_a_tag_camera.cpp @@ -1,10 +1,12 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep -#include "d/actor/d_a_tag_camera.h" #include #include "d/actor/d_a_alink.h" -#include "d/d_com_inf_game.h" #include "d/actor/d_a_horse.h" +#include "d/actor/d_a_tag_camera.h" +#include "d/d_com_inf_game.h" +#include "d/d_debug_viewer.h" +#include "d/d_s_play.h" namespace { bool always_true() { @@ -107,19 +109,19 @@ u8 daTag_Cam_c::getSwType() { } u8 daTag_Cam_c::getPrio() { - return (fopAcM_GetParam(this) >> 4) & 0xF; + return (fopAcM_GetParam(this) & 0xF0) >> 4; } u8 daTag_Cam_c::getSwBit() { - return (fopAcM_GetParam(this) >> 8) & 0xFF; + return (fopAcM_GetParam(this) & 0xFF00) >> 8; } u8 daTag_Cam_c::getCondition() { - return (fopAcM_GetParam(this) >> 0x10) & 0xFF; + return (fopAcM_GetParam(this) & 0xFF0000) >> 16; } u8 daTag_Cam_c::getCameraId() { - return (fopAcM_GetParam(this) >> 0x18) & 0xFF; + return (fopAcM_GetParam(this) & 0xFF000000) >> 24; } u8 daTag_Cam_c::getRailID() { @@ -184,8 +186,10 @@ int daTag_Cam_c::create() { is_player_hugging_eal, }; + int var_r27 = 22; + u8 func_index = getCondition(); - if ((int)func_index > 22) { + if ((int)func_index > var_r27) { func_index = 3; } @@ -251,7 +255,11 @@ int daTag_Cam_c::execute() { bool set_camera = mCheckFunc(); if (condition == 0xFF) { +#if PLATFORM_SHIELD + priority |= (u16)0x8000; +#else priority |= 0x8000; +#endif } else if (condition == 0xFA) { if (dCam_getBody()->CheckFlag(0x8000000)) { set_camera = true; @@ -269,6 +277,28 @@ int daTag_Cam_c::execute() { } static int daTag_Cam_Draw(daTag_Cam_c* i_this) { +#if DEBUG + return i_this->draw(); +#else + return 1; +#endif +} + +int daTag_Cam_c::draw() { +#if DEBUG + if (g_envHIO.mOther.mDisplayTransparentCyl != 0) { + if (getAreaType() == 0) { + cXyz sp3C = (mBoundsHi - mBoundsLo) * 0.5f; + cXyz sp30 = mBoundsLo + sp3C; + csXyz sp10(0, 0, 0); + dDbVw_drawCubeXlu(sp30, sp3C, sp10, (GXColor){0xc0, 0xff, 0x78, 0xa0}); + } else { + cXyz cStack_3c = current.pos; + dDbVw_drawCylinderXlu(cStack_3c, scale.x, scale.y, (GXColor){0xc0, 0xff, 0x78, 0xa0}, + 1); + } + } +#endif return 1; } @@ -282,13 +312,16 @@ static int daTag_Cam_IsDelete(daTag_Cam_c* i_this) { } static int daTag_Cam_Delete(daTag_Cam_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTag_Cam_c(); return 1; } static int daTag_Cam_Create(fopAc_ac_c* i_this) { - daTag_Cam_c* a_this = (daTag_Cam_c*)i_this; - return a_this->create(); + daTag_Cam_c* cam = (daTag_Cam_c*)i_this; + int id = fopAcM_GetID(i_this); + int result = cam->create(); + return result; } static actor_method_class l_daTag_Cam_Method = { diff --git a/src/d/actor/d_a_tag_chgrestart.cpp b/src/d/actor/d_a_tag_chgrestart.cpp index c2eb2260b9..626f268847 100644 --- a/src/d/actor/d_a_tag_chgrestart.cpp +++ b/src/d/actor/d_a_tag_chgrestart.cpp @@ -6,9 +6,35 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_tag_chgrestart.h" + +#include "d/d_debug_viewer.h" #include "d/d_procname.h" -s32 daTagChgRestart_c::Create() { +class daTagChgRestart_HIO_c : public mDoHIO_entry_c { +public: + daTagChgRestart_HIO_c(); + + void genMessage(JORMContext* ctx); + + u8 show_range; +}; + +#if DEBUG +daTagChgRestart_HIO_c l_HIO; + +daTagChgRestart_HIO_c::daTagChgRestart_HIO_c() { + show_range = FALSE; +} + +void daTagChgRestart_HIO_c::genMessage(JORMContext* ctx) { + // "Room return position change tag" + ctx->genLabel("部屋戻し位置変更タグ", 0); + // "Display range" + ctx->genCheckBox("範囲表示", &show_range, 1); +} +#endif + +int daTagChgRestart_c::Create() { mVertices[0].x = -100.0f * scale.x; mVertices[0].z = -100.0f * scale.z; @@ -21,25 +47,27 @@ s32 daTagChgRestart_c::Create() { mVertices[3].x = -100.0f * scale.x; mVertices[3].z = 100.0f * scale.z; - mVertices[3].y = 0.0f; - mVertices[2].y = 0.0f; - mVertices[1].y = 0.0f; - mVertices[0].y = 0.0f; + mVertices[0].y = mVertices[1].y = mVertices[2].y = mVertices[3].y = 0.0f; return 1; } -s32 daTagChgRestart_c::create() { +int daTagChgRestart_c::create() { fopAcM_ct(this, daTagChgRestart_c); if (!Create()) { return cPhs_ERROR_e; } +#if DEBUG + // "Room return position change tag" + l_HIO.entryHIO("部屋戻し位置変更タグ"); +#endif + return cPhs_COMPLEATE_e; } -s32 daTagChgRestart_c::execute() { +int daTagChgRestart_c::execute() { if (fopAcM_isSwitch(this, daTagChgRestart_prm::getSwNo(this))) { return 1; } @@ -59,11 +87,13 @@ s32 daTagChgRestart_c::execute() { u8 playerNo = daTagChgRestart_prm::getPlayerNo(this); if (playerNo != 0xFF) { - dStage_roomDt_c* roomDt = dComIfGp_roomControl_getStatusRoomDt(fopAcM_GetRoomNo(this)); + int roomNo = fopAcM_GetRoomNo(this); + dStage_roomDt_c* roomDt = dComIfGp_roomControl_getStatusRoomDt(roomNo); stage_actor_class* player_data = roomDt->getPlayer(); stage_actor_data_class* entry_p = player_data->m_entries; - for (int i = 0; i < player_data->num; i++) { + int i = 0; + for (i = 0; i < player_data->num; i++) { if ((entry_p->base.angle.z & 0xFF) == playerNo) { break; } @@ -71,6 +101,11 @@ s32 daTagChgRestart_c::execute() { entry_p++; } + if (i == player_data->num) { + OS_REPORT_ERROR("部屋戻し位置変更の為のプレイヤー番号が不正です!<%d>\n", i); + JUT_ASSERT(317, FALSE); + } + restart_pos = entry_p->base.position; restart_angle = entry_p->base.angle.y; } @@ -82,26 +117,74 @@ s32 daTagChgRestart_c::execute() { return 1; } -s32 daTagChgRestart_c::_delete() { +int daTagChgRestart_c::draw() { +#if DEBUG + if (l_HIO.show_range) { + GXColor color = {0, 0, 0x80, 0x80}; + cXyz sp10[8]; + + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::YrotM(current.angle.y); + + sp10[0] = mVertices[0]; + sp10[1] = mVertices[1]; + sp10[2] = mVertices[3]; + sp10[3] = mVertices[2]; + sp10[4] = mVertices[0]; + sp10[5] = mVertices[1]; + sp10[6] = mVertices[3]; + sp10[7] = mVertices[2]; + + for (int i = 0; i < 8; i++) { + mDoMtx_stack_c::multVec(&sp10[i], &sp10[i]); + } + for (int i = 0; i < 4; i++) { + sp10[i].y += 1000.0f; + } + + dDbVw_drawCube8pXlu(sp10, color); + } +#endif + return 1; } -static s32 daTagChgRestart_Execute(daTagChgRestart_c* i_this) { +int daTagChgRestart_c::_delete() { +#if DEBUG + l_HIO.removeHIO(); +#endif + return 1; +} + +static int daTagChgRestart_Execute(daTagChgRestart_c* i_this) { return i_this->execute(); } -static s32 daTagChgRestart_Delete(daTagChgRestart_c* i_this) { +static int daTagChgRestart_Delete(daTagChgRestart_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->_delete(); } -static s32 daTagChgRestart_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); +static int daTagChgRestart_Create(fopAc_ac_c* i_this) { + daTagChgRestart_c* chgRestart = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return chgRestart->create(); +} + +static int daTagChgRestart_Draw(daTagChgRestart_c* i_this) { + return i_this->draw(); } static actor_method_class l_daTagChgRestart_Method = { (process_method_func)daTagChgRestart_Create, (process_method_func)daTagChgRestart_Delete, (process_method_func)daTagChgRestart_Execute, + NULL, +#if DEBUG + (process_method_func)daTagChgRestart_Draw, +#else + NULL, +#endif }; actor_process_profile_definition g_profile_Tag_ChgRestart = { diff --git a/src/d/actor/d_a_tag_chkpoint.cpp b/src/d/actor/d_a_tag_chkpoint.cpp index 04ca0a80ab..6b79abf81a 100644 --- a/src/d/actor/d_a_tag_chkpoint.cpp +++ b/src/d/actor/d_a_tag_chkpoint.cpp @@ -7,7 +7,10 @@ #include "d/actor/d_a_tag_chkpoint.h" #include + #include "d/actor/d_a_player.h" +#include "d/d_debug_viewer.h" +#include "d/d_s_play.h" int daTag_Chk_c::execute() { if (fopAcM_GetRoomNo(this) != dComIfGp_roomControl_getStayNo()) { @@ -32,10 +35,10 @@ int daTag_Chk_c::execute() { var_r27 = 2; } - u8 swbit2 = getSwBit2(); - if (swbit2 == 0xFF) { + swbit = getSwBit2(); + if (swbit == 0xFF) { var_r26 = 0; - } else if (dComIfGs_isSwitch(swbit2, fopAcM_GetRoomNo(this))) { + } else if (dComIfGs_isSwitch(swbit, fopAcM_GetRoomNo(this))) { var_r26 = 1; } else { var_r26 = 2; @@ -44,20 +47,22 @@ int daTag_Chk_c::execute() { bool set_attention = false; if (sp64[var_r27][var_r26] != 0) { - cXyz& player_pos = dComIfGp_getLinkPlayer()->current.pos; + daPy_py_c* player = dComIfGp_getLinkPlayer(); if (getAreaType() == 0) { - if (mVtxA.x <= player_pos.x && player_pos.x <= mVtxB.x && mVtxA.y <= player_pos.y && - player_pos.y <= mVtxB.y && mVtxA.z <= player_pos.z && player_pos.z <= mVtxB.z) + if (mVtxA.x <= player->current.pos.x && player->current.pos.x <= mVtxB.x && + mVtxA.y <= player->current.pos.y && player->current.pos.y <= mVtxB.y && + mVtxA.z <= player->current.pos.z && player->current.pos.z <= mVtxB.z) { set_attention = true; } } else { - f32 x_dist = current.pos.x - player_pos.x; - f32 z_dist = current.pos.z - player_pos.z; + f32 x_dist = current.pos.x - player->current.pos.x; + f32 z_dist = current.pos.z - player->current.pos.z; - if (std::sqrt(x_dist * x_dist + z_dist * z_dist) < scale.x && mVtxA.y <= player_pos.y && - player_pos.y <= mVtxB.y) + f32 var_f29 = std::sqrt(x_dist * x_dist + z_dist * z_dist); + if (var_f29 < scale.x && mVtxA.y <= player->current.pos.y && + player->current.pos.y <= mVtxB.y) { set_attention = true; } @@ -75,6 +80,30 @@ int daTag_Chk_c::execute() { } static int daTag_Chk_Draw(daTag_Chk_c* i_this) { +#if DEBUG + return i_this->draw(); +#else + return 1; +#endif +} + +int daTag_Chk_c::draw() { +#if DEBUG + if (g_envHIO.mOther.mDisplayTransparentCyl) { + if (getAreaType() == 0) { + cXyz sp40 = (mVtxB - mVtxA) * 0.5f; + cXyz sp34 = mVtxA + sp40; + csXyz sp14(0,0,0); + dDbVw_drawCubeXlu(sp34, sp40, sp14,(GXColor){0xc0, 0x78, 0xff, 0xa0}); + } else { + cXyz sp28 = current.pos; + dDbVw_drawCylinderXlu(sp28, scale.x, scale.y, (GXColor){0xc0, 0x78, 0xff, 0xa0}, 1); + } + } + if (g_envHIO.mOther.mDisplayTransparentCyl) { + dDbVw_drawSphereXlu(attention_info.position, 20.0f, (GXColor){0xc0, 0x78, 0xff, 0xc0}, 1); + } +#endif return 1; } @@ -88,12 +117,16 @@ static int daTag_Chk_IsDelete(daTag_Chk_c* i_this) { } static int daTag_Chk_Delete(daTag_Chk_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTag_Chk_c(); return 1; } static int daTag_Chk_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTag_Chk_c* chk = static_cast(i_this); + int id = fopAcM_GetID(i_this); + int result = chk->create(); + return result; } static actor_method_class l_daTag_Chk_Method = { diff --git a/src/d/actor/d_a_tag_csw.cpp b/src/d/actor/d_a_tag_csw.cpp index 5c461f3afc..24be671d06 100644 --- a/src/d/actor/d_a_tag_csw.cpp +++ b/src/d/actor/d_a_tag_csw.cpp @@ -10,10 +10,36 @@ #include "d/d_com_inf_game.h" #include "d/d_bg_w.h" +class daTagCsw_HIO_c : public mDoHIO_entry_c { +public: + daTagCsw_HIO_c(); + + void genMessage(JORMContext*); + + f32 field_0x8; +}; + static const char* l_arcName = "Lv6Warp"; -#pragma push -#pragma force_active on +static int const l_bmd_idx[2] = {5, 6}; + +static int const l_brk_idx[2] = {9, 10}; + +static int const l_dbz_idx[2] = {13, 14}; + +#if DEBUG +static daTagCsw_HIO_c l_HIO; + +daTagCsw_HIO_c::daTagCsw_HIO_c() { + field_0x8 = 5.0f; +} + +void daTagCsw_HIO_c::genMessage(JORMContext* ctx) { + ctx->genLabel("石像ワープ", 0); + ctx->genSlider("上昇速度", &field_0x8, 0.0f, 30.0f); +} +#endif + static dCcD_SrcCyl l_cyl_src = { { {0x0, {{0x0, 0x0, 0x0}, {0xffffffff, 0x0}, 0x19}}, // mObj @@ -22,17 +48,14 @@ static dCcD_SrcCyl l_cyl_src = { {0x0}, // mGObjCo }, // mObjInf { - { - {0.0f, 0.0f, 0.0f}, // mCenter - 300.0f, // mRadius - 600.0f // mHeight - } // mCyl + { + {0.0f, 0.0f, 0.0f}, // mCenter + 300.0f, // mRadius + 600.0f // mHeight + } // mCyl } // mCylAttr }; -#pragma pop -#pragma push -#pragma force_active on static dCcD_SrcCyl l_tg_src = { { {0x0, {{0x0, 0x0, 0x0}, {0x400000, 0x11}, 0x0}}, // mObj @@ -41,29 +64,16 @@ static dCcD_SrcCyl l_tg_src = { {0x0}, // mGObjCo }, // mObjInf { - { - {0.0f, 0.0f, 0.0f}, // mCenter - 300.0f, // mRadius - 600.0f // mHeight - } // mCyl + { + {0.0f, 0.0f, 0.0f}, // mCenter + 300.0f, // mRadius + 600.0f // mHeight + } // mCyl } // mCylAttr }; -#pragma pop daTagCsw_c::~daTagCsw_c() {} -static u8 const l_bmd_idx[8] = { - 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x06, -}; - -static u8 const l_brk_idx[8] = { - 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0A, -}; - -static u8 const l_dbz_idx[8] = { - 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x0E, -}; - void daTagCsw_c::setMtx() { mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); mDoMtx_stack_c::YrotM(current.angle.y); @@ -164,14 +174,13 @@ static int daTagCsw_c_createHeap(fopAc_ac_c* i_this) { int daTagCsw_c::chkInsideStatueStart() { bool rv = false; + bool var_r29; if (fopAcM_isSwitch(this, getSw())) { - bool bVar1 = true; - if (getSw() != 10) { - if (fopAcM_isSwitch(this, getSw() + 1)) { - bVar1 = false; - } + var_r29 = true; + if (getSw() != 10 && fopAcM_isSwitch(this, getSw() + 1)) { + var_r29 = false; } - if (bVar1) { + if (var_r29) { rv = true; } } @@ -180,6 +189,14 @@ int daTagCsw_c::chkInsideStatueStart() { int daTagCsw_c::create() { fopAcM_ct(this, daTagCsw_c); + + if (getSw() < 0 || getSw() > 10) { + // "Stone statue warp tag: Switch bit is out of range: + // Please use a save bit within the range (%d~%d)" + OS_REPORT_ERROR("石像ワープタグ:スイッチビットが範囲外:%dセーブビット(%d~%d)でお願いします。\n", + getSw(), 0, 10); + } + field_0x570 = getType(); int rv = dComIfG_resLoad(this, l_arcName); if (rv == cPhs_COMPLEATE_e) { @@ -191,7 +208,11 @@ int daTagCsw_c::create() { field_0x624 = 500.0f; } else if (chkInsideStatueStart()) { field_0x624 = 0.0f; +#if DEBUG + field_0x628 = l_HIO.field_0x8; +#else field_0x628 = 5.0f; +#endif if (getSw2() != 0xff) { fopAcM_onSwitch(this, getSw2()); } @@ -225,24 +246,27 @@ int daTagCsw_c::create() { return rv; } -static void* searchTagCswOut(void* param_1, void* param_2) { - if (param_1 != NULL && fopAcM_IsActor(param_1) && fopAcM_GetProfName(param_1) == PROC_TAG_CSW && - static_cast(param_1)->getType() == 1) - { - if (static_cast(param_1)->getSw() == - static_cast(param_2)->getSw()) - { - return param_1; +static void* searchTagCswOut(void* param_0, void* param_1) { + UNUSED(param_1); + if (param_0 != NULL && fopAcM_IsActor(param_0) && fopAcM_GetProfName(param_0) == PROC_TAG_CSW) { + daTagCsw_c* csw1 = static_cast(param_0); + daTagCsw_c* csw2 = static_cast(param_1); + if (csw1->getType() == 1) { + if (csw1->getSw() == csw2->getSw()) { + return param_0; + } } } return NULL; } -static void* searchCStatue(void* param_1, void* param_2) { - if (param_1 != NULL && fopAcM_IsActor(param_1) && fopAcM_GetProfName(param_1) == PROC_CSTATUE && - static_cast(param_1)->checkNormalType()) - { - return param_1; +static void* searchCStatue(void* param_0, void* param_1) { + UNUSED(param_1); + if (param_0 != NULL && fopAcM_IsActor(param_0) && fopAcM_GetProfName(param_0) == PROC_CSTATUE) { + daCstatue_c* cstatue = static_cast(param_0); + if (cstatue->checkNormalType()) { + return param_0; + } } return NULL; } @@ -283,11 +307,14 @@ void daTagCsw_c::offLight() { int daTagCsw_c::execute() { bool bVar3 = false; daCstatue_c* statue = (daCstatue_c*)fopAcM_Search(searchCStatue, this); - if (statue != NULL && statue->current.pos.absXZ(current.pos) < 75.0f && - statue->current.pos.y > current.pos.y - 30.0f && - statue->current.pos.y < current.pos.y + 200.0f) - { - bVar3 = true; + if (statue != NULL) { + f32 dist = statue->current.pos.absXZ(current.pos); + if (dist < 75.0f && + statue->current.pos.y > current.pos.y - 30.0f && + statue->current.pos.y < current.pos.y + 200.0f) + { + bVar3 = true; + } } if (field_0x570 == 0) { if (bVar3) { @@ -302,7 +329,11 @@ int daTagCsw_c::execute() { if (cM3d_IsZero(field_0x628) && getSw2() != 0xff) { fopAcM_onSwitch(this, getSw2()); } +#if DEBUG + field_0x628 = -l_HIO.field_0x8; +#else field_0x628 = -5.0f; +#endif if (!field_0x588->ChkUsed()) { dComIfG_Bgsp().Regist(field_0x588, this); field_0x5ec = 0; @@ -342,14 +373,14 @@ int daTagCsw_c::execute() { } } if (field_0x570 == 0 && getSw() == 6 && field_0x8e2 != 0) { - s16 angleDiff = (current.angle.y - statue->current.angle.y); - s16 sVar4 = angleDiff / field_0x8e2; - if (sVar4 > 0x800) { - statue->current.angle.y += 0x800; - } else if (sVar4 < -0x800) { - statue->current.angle.y -= 0x800; + s16 sp0A = current.angle.y - statue->current.angle.y; + sp0A /= field_0x8e2; + if (sp0A > 0x800) { + statue->current.angle.y += (s16)0x800; + } else if (sp0A < -0x800) { + statue->current.angle.y -= (s16)0x800; } else { - statue->current.angle.y += sVar4; + statue->current.angle.y += sp0A; } statue->shape_angle.y = statue->current.angle.y; onLight(); @@ -357,7 +388,11 @@ int daTagCsw_c::execute() { } if (!bVar3 && field_0x624 == 0.0f) { if (fopAcM_isSwitch(this, getSw())) { +#if DEBUG + field_0x628 = l_HIO.field_0x8; +#else field_0x628 = 5.0f; +#endif } } } else { @@ -365,7 +400,11 @@ int daTagCsw_c::execute() { if (getSw2() != 0xff) { fopAcM_onSwitch(this, getSw2()); } +#if DEBUG + field_0x628 = l_HIO.field_0x8; +#else field_0x628 = 5.0f; +#endif onLight(); } else if (field_0x624 == 500.0f) { @@ -498,7 +537,8 @@ static int daTagCsw_Delete(daTagCsw_c* i_this) { } static int daTagCsw_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagCsw_c* csw = static_cast(i_this); + return csw->create(); } static actor_method_class l_daTagCsw_Method = { diff --git a/src/d/actor/d_a_tag_escape.cpp b/src/d/actor/d_a_tag_escape.cpp index 268f3e3ed1..7b18f747d1 100644 --- a/src/d/actor/d_a_tag_escape.cpp +++ b/src/d/actor/d_a_tag_escape.cpp @@ -8,12 +8,19 @@ #include "d/actor/d_a_tag_escape.h" #include "d/d_procname.h" -static int daTagEscape_Create(fopAc_ac_c* i_this) { - fopAcM_ct(i_this, daTagEscape_c); +int daTagEscape_c::create() { + fopAcM_ct(this, daTagEscape_c); return cPhs_COMPLEATE_e; } +static int daTagEscape_Create(fopAc_ac_c* i_this) { + daTagEscape_c* escape = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return escape->create(); +} + static int daTagEscape_Delete(daTagEscape_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagEscape_c(); return 1; } diff --git a/src/d/actor/d_a_tag_event.cpp b/src/d/actor/d_a_tag_event.cpp index 019cfb6583..f772ebc349 100644 --- a/src/d/actor/d_a_tag_event.cpp +++ b/src/d/actor/d_a_tag_event.cpp @@ -1,23 +1,25 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep +#include "d/actor/d_a_horse.h" #include "d/actor/d_a_tag_event.h" #include "d/d_com_inf_game.h" -#include "d/actor/d_a_horse.h" +#include "d/d_debug_viewer.h" +#include "d/d_s_play.h" static fopAc_ac_c* daTag_getBk(u32 param_0) { return fopAcM_searchFromName("Bk", 0xF, param_0); } u8 daTag_Event_c::getEventNo() { - return fopAcM_GetParam(this) >> 0x18; + return (fopAcM_GetParam(this) & 0xff000000) >> 24; } u8 daTag_Event_c::getSwbit() { - return fopAcM_GetParam(this) >> 0x8; + return (fopAcM_GetParam(this) & 0xff00) >> 8; } u8 daTag_Event_c::getSwbit2() { - return fopAcM_GetParam(this) >> 0x10; + return (fopAcM_GetParam(this) & 0xff0000) >> 16; } u8 daTag_Event_c::getType() { @@ -103,10 +105,8 @@ int daTag_Event_c::create() { setActio(ACTION_WAIT); } - shape_angle.z = 0; - shape_angle.x = 0; - current.angle.z = 0; - current.angle.x = 0; + shape_angle.x = shape_angle.z = 0; + current.angle.x = current.angle.z = 0; scale.x *= 100.0f; scale.y *= 100.0f; @@ -131,8 +131,9 @@ int daTag_Event_c::actionNext() { mEventIdx = mMapEventIdx; mMapEventIdx = -1; + int roomNo = fopAcM_GetRoomNo(this); dStage_MapEvent_dt_c* event_data = - dEvt_control_c::searchMapEventData(mMapToolId, fopAcM_GetRoomNo(this)); + dEvt_control_c::searchMapEventData(mMapToolId, roomNo); if (event_data != NULL) { mMapToolId = event_data->field_0x5; mMapEventIdx = dComIfGp_getEventManager().getEventIdx(this, mMapToolId); @@ -231,6 +232,10 @@ int daTag_Event_c::actionHunt() { if (swbit != 0xFF && dComIfGs_isSwitch(swbit, fopAcM_GetRoomNo(this))) { setActio(ACTION_WAIT); } else if (arrivalTerms() && checkArea()) { +#if DEBUG + mEventIdx = dComIfGp_getEventManager().getEventIdx(this, getEventNo()); +#endif + setActio(ACTION_READY); fopAcM_orderOtherEventId(this, mEventIdx, getEventNo(), 0xFFFF, 0, 1); } @@ -299,6 +304,36 @@ int daTag_Event_c::execute() { } int daTag_Event_c::draw() { +#if DEBUG + static GXColor color = {0x00, 0x00, 0xFF, 0xFF}; + + if (g_envHIO.mOther.mDisplayTransparentCyl != 0) { + if (getAreaType() == 0x8000) { + cXyz sp30[8]; + cXyz sp20(current.pos.x - scale.x * 0.5f, + current.pos.y, + current.pos.z - scale.z * 0.5f); + cXyz sp14(current.pos.x + scale.x * 0.5f, + current.pos.y + scale.y, + current.pos.z + scale.z * 0.5f); + sp30[0].set(sp20.x, sp20.y, sp20.z); + sp30[1].set(sp20.x, sp20.y, sp14.z); + sp30[2].set(sp14.x, sp20.y, sp14.z); + sp30[3].set(sp14.x, sp20.y, sp20.z); + sp30[4].set(sp20.x, sp14.y, sp20.z); + sp30[5].set(sp20.x, sp14.y, sp14.z); + sp30[6].set(sp14.x, sp14.y, sp14.z); + sp30[7].set(sp14.x, sp14.y, sp20.z); + dDbVw_drawCube8pXlu(sp30, color); + } else { + cXyz sp08(current.pos); + sp08.y -= scale.y; + dDbVw_drawCylinderXlu( + sp08, scale.x, scale.y * 2.0f, + color, 1); + } + } +#endif return 1; } @@ -316,12 +351,16 @@ static int daTag_Event_IsDelete(daTag_Event_c* i_this) { } static int daTag_Event_Delete(daTag_Event_c* i_this) { + u32 actorId = fopAcM_GetID(i_this); i_this->~daTag_Event_c(); return 1; } static int daTag_Event_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTag_Event_c* event = static_cast(i_this); + u32 actorId = fopAcM_GetID(i_this); + int result = event->create(); + return result; } static actor_method_class l_daTag_Event_Method = { diff --git a/src/d/actor/d_a_tag_evt.cpp b/src/d/actor/d_a_tag_evt.cpp index a41258bebb..d38bb6b500 100644 --- a/src/d/actor/d_a_tag_evt.cpp +++ b/src/d/actor/d_a_tag_evt.cpp @@ -38,14 +38,20 @@ int daTag_Evt_c::destroy() { } int daTag_Evt_c::execute() { + cXyz sp14; + int var_r29 = 0; BOOL bVar = true; + u16 eventId; + int iVar1; + int actIdx; + eyePos.set(current.pos.x, current.pos.y + 100.0f, current.pos.z); attention_info.position = eyePos; fopAcM_SetRoomNo(this, dComIfGp_roomControl_getStayNo()); if (field_0x5E4 == 0 || field_0x5E4 == 1) { if (dComIfGp_event_runCheck()) { bVar = false; - int iVar1 = dComIfGp_evmng_getMyStaffId(field_0x568, 0, 0); + iVar1 = dComIfGp_evmng_getMyStaffId(field_0x568, 0, 0); if (!eventInfo.checkCommandTalk()) { if (eventInfo.checkCommandDemoAccrpt()) { if (dComIfGp_getEventManager().endCheck(field_0x572)) { @@ -55,20 +61,20 @@ int daTag_Evt_c::execute() { bVar = true; } else { if (iVar1 != -1) { - int actIdx = dComIfGp_getEventManager().getMyActIdx( + actIdx = dComIfGp_getEventManager().getMyActIdx( iVar1, mEvtCutList, 3, 0, 0); - int iVar2 = 0; + var_r29 = 0; switch (actIdx) { case 0: - iVar2 = doEvtCutWait(iVar1); + var_r29 = doEvtCutWait(iVar1); break; case 1: - iVar2 = doEvtCutTalk(iVar1); + var_r29 = doEvtCutTalk(iVar1); break; case 2: - iVar2 = doEvtCutNext(iVar1); + var_r29 = doEvtCutNext(iVar1); } - if (iVar2 != 0) { + if (var_r29 != 0) { dComIfGp_getEventManager().cutEnd(iVar1); } } @@ -77,7 +83,7 @@ int daTag_Evt_c::execute() { } else if (field_0x5DC != 0) { if (mMsgFlow.doFlow(this, NULL, 0) != 0) { dComIfGp_event_reset(); - u16 eventId = mMsgFlow.getEventId(NULL); + eventId = mMsgFlow.getEventId(NULL); if (eventId != 0) { daNpcMsg_setEvtNum(eventId); field_0x570 = 1; @@ -92,8 +98,8 @@ int daTag_Evt_c::execute() { } } if (!isDelete() && cLib_calcTimer(&field_0x5D0) == 0) { - cXyz var1 = daPy_getPlayerActorClass()->current.pos - current.pos; - if (var1.absXZ() < scale.x && -scale.y < var1.y && var1.y < scale.y) { + sp14 = daPy_getPlayerActorClass()->current.pos - current.pos; + if (sp14.absXZ() < scale.x && -scale.y < sp14.y && sp14.y < scale.y) { field_0x570 = 1; } } @@ -113,16 +119,16 @@ int daTag_Evt_c::draw() { int daTag_Evt_c::getParam() { field_0x5E0 = fopAcM_GetParam(this) & 0xFFF; - field_0x5E2 = (fopAcM_GetParam(this) >> 0xC) & 0xFFF; + field_0x5E2 = (fopAcM_GetParam(this) & 0xFFF000) >> 12; if ((fopAcM_GetParam(this) & 0xF000000) != 0xF000000) { - field_0x5D8 = (fopAcM_GetParam(this) & 0xF000000) >> 0x18; + field_0x5D8 = (fopAcM_GetParam(this) & 0xF000000) >> 24; } else { field_0x5D8 = -1; } - field_0x5E4 = fopAcM_GetParam(this) >> 0x1E; + field_0x5E4 = (fopAcM_GetParam(this) & 0xC0000000) >> 30; field_0x5DD = home.angle.x; - field_0x5DE = (u16)home.angle.x >> 8; + field_0x5DE = (home.angle.x & 0xFF00) >> 8; field_0x5D4 = home.angle.z & 0xFF; if ((home.angle.z & 0xFF00) != 0xFF00) { field_0x5D0 = ((home.angle.z & 0xFF00) >> 8) * 0x1E; @@ -175,16 +181,19 @@ int daTag_Evt_c::isDelete() { } int daTag_Evt_c::doEvtCutWait(int param_0) { + int* pTimer = NULL; if (dComIfGp_getEventManager().getIsAddvance(param_0)) { - int* pTimer = dComIfGp_evmng_getMyIntegerP(param_0, "timer"); - mTimer = (pTimer == NULL ? 0 : *pTimer); + pTimer = dComIfGp_evmng_getMyIntegerP(param_0, "timer"); + mTimer = pTimer == NULL ? 0 : *pTimer; } return cLib_calcTimer(&mTimer) == 0; } int daTag_Evt_c::doEvtCutTalk(int param_0) { + int* pTimer = NULL; if (dComIfGp_getEventManager().getIsAddvance(param_0)) { - mMsgFlow.init(this, *dComIfGp_evmng_getMyIntegerP(param_0, "flowNodeNo"), 0, NULL); + pTimer = dComIfGp_evmng_getMyIntegerP(param_0, "flowNodeNo"); + mMsgFlow.init(this, *pTimer, 0, NULL); return 0; } else { return mMsgFlow.doFlow(this, NULL, 0); @@ -192,6 +201,7 @@ int daTag_Evt_c::doEvtCutTalk(int param_0) { } int daTag_Evt_c::doEvtCutNext(int param_0) { + int* pTimer = NULL; if (dComIfGp_getEventManager().getIsAddvance(param_0)) { if ((field_0x5E4 == 0 || field_0x5E4 == 1) && field_0x5DE != 0xFF) { dComIfGs_onSwitch(field_0x5DE, fopAcM_GetRoomNo(this)); diff --git a/src/d/actor/d_a_tag_evtarea.cpp b/src/d/actor/d_a_tag_evtarea.cpp index 5833296ffe..47df3e71d3 100644 --- a/src/d/actor/d_a_tag_evtarea.cpp +++ b/src/d/actor/d_a_tag_evtarea.cpp @@ -9,6 +9,8 @@ #include "d/d_procname.h" cPhs__Step daTag_EvtArea_c::create() { + int var_r28 = 0; + fopAcM_ct(this, daTag_EvtArea_c); switch (getType()) { @@ -149,20 +151,19 @@ BOOL daTag_EvtArea_c::isDelete() { } BOOL daTag_EvtArea_c::chkPointInArea(cXyz i_point, cXyz i_addSize) { - cXyz area_vtx[4]; - cXyz size, center, player_to_home, point_to_current; - if (field_0x56c == 0) { if ((getOnEvtBit() != -1 && daNpcT_chkEvtBit(getOnEvtBit())) || (getBitSW() != 0xff && dComIfGs_isSwitch(getBitSW(), fopAcM_GetRoomNo(this))) || (getOnEvtBit() == -1 && getBitSW() == 0xFF)) { - size = scale + i_addSize; + cXyz size = scale + i_addSize; + cXyz center; if (getType() == 15 || getType() == 16) { - player_to_home = daPy_getPlayerActorClass()->current.pos; + cXyz area_vtx[4]; + cXyz player_to_home = daPy_getPlayerActorClass()->current.pos; player_to_home -= home.pos; - mDoMtx_YrotS(mDoMtx_stack_c::now, -current.angle.y); + mDoMtx_stack_c::YrotS(-current.angle.y); mDoMtx_stack_c::multVec(&player_to_home, &player_to_home); // bottom left @@ -184,7 +185,7 @@ BOOL daTag_EvtArea_c::chkPointInArea(cXyz i_point, cXyz i_addSize) { if (area_vtx[0].x < player_to_home.x && area_vtx[0].z < player_to_home.z && area_vtx[2].x > player_to_home.x && area_vtx[2].z > player_to_home.z) { - point_to_current = i_point - current.pos; + cXyz point_to_current = i_point - current.pos; if (0 <= (int)point_to_current.y && (int)point_to_current.y < (int)size.y) { return true; } diff --git a/src/d/actor/d_a_tag_evtmsg.cpp b/src/d/actor/d_a_tag_evtmsg.cpp index 73d516eacb..26d64f664b 100644 --- a/src/d/actor/d_a_tag_evtmsg.cpp +++ b/src/d/actor/d_a_tag_evtmsg.cpp @@ -10,6 +10,13 @@ #include "d/d_com_inf_game.h" #include "d/d_procname.h" +enum evt_cut_e { + EVT_CUT_NONE_e, + EVT_CUT_TALK_e, + EVT_CUT_WAIT_e, + NUM_EVT_CUTS_e, +}; + char* daTag_EvtMsg_c::mEvtCutNameList[] = {"", "TALK", "WAIT"}; EvtCutFunc daTag_EvtMsg_c::mEvtCutList[] = { @@ -21,6 +28,8 @@ EvtCutFunc daTag_EvtMsg_c::mEvtCutList[] = { static char* l_myName = "EvtMsg"; int daTag_EvtMsg_c::create() { + int var_r28 = 0; + fopAcM_ct(this, daTag_EvtMsg_c); scale.x *= 100.0f; @@ -67,6 +76,10 @@ int daTag_EvtMsg_c::Execute() { staff_id = evt_mng.getMyStaffId(l_myName, this, -1); if (staff_id != -1) { int evtCutNo = evt_mng.getMyActIdx(staff_id, mEvtCutNameList, 3, 0, 0); + + JUT_ASSERT(165, (0 <= evtCutNo) && (evtCutNo < NUM_EVT_CUTS_e)); + JUT_ASSERT(166, NULL != mEvtCutList[evtCutNo]); + if ((this->*mEvtCutList[evtCutNo])(staff_id) != 0) { evt_mng.cutEnd(staff_id); } @@ -82,18 +95,18 @@ int daTag_EvtMsg_c::Execute() { } } else if (isDelete()) { fopAcM_delete(this); - } else if (mFlowID != -1) { - if (chkPointInArea(daPy_getPlayerActorClass()->current.pos)) { + } else { + if (mFlowID != -1 && chkPointInArea(daPy_getPlayerActorClass()->current.pos)) { if (getProcType() == 0) { - s16 var_r0 = (s16)(fopAcM_searchPlayerAngleY(this) + 0x7FFF); - var_r0 = var_r0 - daPy_getPlayerActorClass()->current.angle.y; + s16 var_r28 = (s16)(fopAcM_searchPlayerAngleY(this) + 0x7FFF); + var_r28 = var_r28 - daPy_getPlayerActorClass()->current.angle.y; - if (var_r0 < 0) { - var_r0 = -var_r0; + if (var_r28 < 0) { + var_r28 = -var_r28; } - if (var_r0 <= 0x1000) { - mEventID = evt_mng.getEventIdx(this, "DEFAULT_EVT_TALK", 0xFF); + if (var_r28 <= 0x1000) { + mEventID = dComIfGp_getEventManager().getEventIdx(this, "DEFAULT_EVT_TALK", 0xFF); fopAcM_orderOtherEventId(this, mEventID, 0xFF, 0xFFFF, 0, 1); } } else { @@ -117,20 +130,12 @@ int daTag_EvtMsg_c::Draw() { u32 daTag_EvtMsg_c::getOnEvtBit() { u32 bit = fopAcM_GetParam(this) & 0xFFF; - if (bit != 0xFFF) { - return bit; - } - - return -1; + return bit == 0xFFF ? -1 : bit; } u32 daTag_EvtMsg_c::getOffEvtBit() { - u32 bit = (fopAcM_GetParam(this) >> 0xC) & 0xFFF; - if (bit != 0xFFF) { - return bit; - } - - return -1; + u32 bit = (fopAcM_GetParam(this) & 0xFFF000) >> 12; + return bit == 0xFFF ? -1 : bit; } u8 daTag_EvtMsg_c::getOnSwBit() { @@ -138,7 +143,7 @@ u8 daTag_EvtMsg_c::getOnSwBit() { } u8 daTag_EvtMsg_c::getOffSwBit() { - return (home.angle.x >> 8) & 0xFF; + return (home.angle.x & 0xFF00) >> 8; } u8 daTag_EvtMsg_c::getProcType() { @@ -175,7 +180,8 @@ BOOL daTag_EvtMsg_c::chkPointInArea(cXyz param_0) { } BOOL daTag_EvtMsg_c::ECut_talk(int i_staffID) { - if (dComIfGp_getEventManager().getIsAddvance(i_staffID)) { + dEvent_manager_c& eventMgr = dComIfGp_getEventManager(); + if (eventMgr.getIsAddvance(i_staffID)) { mMsgFlow.init(this, mFlowID, 0, NULL); } @@ -188,9 +194,10 @@ BOOL daTag_EvtMsg_c::ECut_talk(int i_staffID) { BOOL daTag_EvtMsg_c::ECut_wait(int i_staffID) { dEvent_manager_c& evt_mng = dComIfGp_getEventManager(); + int* data_p = NULL; int timer = 0; - int* data_p = dComIfGp_evmng_getMyIntegerP(i_staffID, "timer"); + data_p = dComIfGp_evmng_getMyIntegerP(i_staffID, "timer"); if (data_p != NULL) { timer = *data_p; } diff --git a/src/d/actor/d_a_tag_firewall.cpp b/src/d/actor/d_a_tag_firewall.cpp index c9917cc79f..29212c89c0 100644 --- a/src/d/actor/d_a_tag_firewall.cpp +++ b/src/d/actor/d_a_tag_firewall.cpp @@ -5,12 +5,13 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep -#include "d/actor/d_a_tag_firewall.h" #include #include "d/actor/d_a_player.h" -#include "d/d_com_inf_game.h" +#include "d/actor/d_a_tag_firewall.h" #include "d/d_bomb.h" #include "d/d_camera.h" +#include "d/d_com_inf_game.h" +#include "d/d_s_play.h" struct Tag_FWall_n { static dCcD_SrcSph cc_sph_src; @@ -42,6 +43,7 @@ static u8 fire_num; int daTag_FWall_c::execute() { cXyz cam_eye = dCam_getBody()->Eye(); cXyz pos; + u8 target_alpha = 0xff; if (mSetGameoverEff) { pos.set(0.0f, 0.0f, 0.0f); @@ -108,8 +110,9 @@ int daTag_FWall_c::execute() { mCcSphs[i].OnAtSetBit(); pos = mWallPos[i]; + pos.y += nREG_F(17); mCcSphs[i].SetC(pos); - mCcSphs[i].SetR(90.0f); + mCcSphs[i].SetR(90.0f + nREG_F(16)); dComIfG_Ccsp()->Set(&mCcSphs[i]); } @@ -120,8 +123,7 @@ int daTag_FWall_c::execute() { if (emitter != NULL) { pos = cam_eye - mWallPos[i]; - u8 target_alpha; - if (pos.absXZ() < 250.0f && std::abs(pos.y) < 250.0f) { + if (pos.absXZ() < 250.0f + nREG_F(18) && std::abs(pos.y) < 250.0f + nREG_F(19)) { target_alpha = 0; } else { target_alpha = 0xFF; @@ -163,23 +165,26 @@ static int daTag_FWall_IsDelete(daTag_FWall_c* i_this) { } static int daTag_FWall_Delete(daTag_FWall_c* i_this) { + int id = fopAcM_GetID(i_this); return 1; } int daTag_FWall_c::create() { fopAcM_ct(this, daTag_FWall_c); + OS_REPORT("Tag_FWall PARAM %x %d \n", fopAcM_GetParam(this), fire_num); + if (fire_num == 0) { field_0x568 = 0xFF; fire_leader = this; mCcStts.Init(0xFF, 0, this); } - fire_leader->mWallTimer[fire_num] = (fopAcM_GetParam(this) >> 8) & 0xFFFF; + fire_leader->mWallTimer[fire_num] = (fopAcM_GetParam(this) & 0xFFFF00) >> 8; fire_leader->mExplodeTime[fire_num] = current.angle.x & 0xFFFF; fire_leader->field_0x65c[fire_num] = fopAcM_GetParam(this); - u8 temp_r0 = fopAcM_GetParam(this) >> 0x18; + u8 temp_r0 = (fopAcM_GetParam(this) & 0xFF000000) >> 24; if (temp_r0 == 0xFF) { temp_r0 = 0; } @@ -194,12 +199,12 @@ int daTag_FWall_c::create() { fire_leader->mWallMode[fire_num] = 1; } - if (++fire_num > 1) { + fire_num++; + if (fire_num > 1) { return cPhs_ERROR_e; } - shape_angle.x = 0; - current.angle.x = 0; + current.angle.x = shape_angle.x = 0; return cPhs_COMPLEATE_e; } diff --git a/src/d/actor/d_a_tag_gra.cpp b/src/d/actor/d_a_tag_gra.cpp index 083aca0aa4..fe5b3dd91d 100644 --- a/src/d/actor/d_a_tag_gra.cpp +++ b/src/d/actor/d_a_tag_gra.cpp @@ -9,10 +9,12 @@ static int daTagGra_Create(fopAc_ac_c* i_this) { daTagGra_c* gra_tag = (daTagGra_c*)i_this; + int id = fopAcM_GetID(i_this); return gra_tag->create(); } static int daTagGra_Delete(daTagGra_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagGra_c(); return 1; } diff --git a/src/d/actor/d_a_tag_gstart.cpp b/src/d/actor/d_a_tag_gstart.cpp index 7a05742d52..dbf64577b6 100644 --- a/src/d/actor/d_a_tag_gstart.cpp +++ b/src/d/actor/d_a_tag_gstart.cpp @@ -14,30 +14,33 @@ int daTagGstart_c::create() { fopAcM_ct(this, daTagGstart_c); mSwNo = fopAcM_GetParam(this); - mSwNo2 = fopAcM_GetParam(this) >> 8; - field_0x56a = fopAcM_GetParam(this) >> 0x10; + mSwNo2 = (fopAcM_GetParam(this) >> 8) & 0xFF; + field_0x56a = (fopAcM_GetParam(this) >> 0x10) & 0xFF; mType = (fopAcM_GetParam(this) >> 0x18) & 0xF; return cPhs_COMPLEATE_e; } static int daTagGstart_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagGstart_c* gStart = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return gStart->create(); } daTagGstart_c::~daTagGstart_c() {} static int daTagGstart_Delete(daTagGstart_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagGstart_c(); return 1; } int daTagGstart_c::execute() { - if ((mSwNo == 0xFF || dComIfGs_isSwitch(mSwNo, fopAcM_GetHomeRoomNo(this))) && - (mSwNo2 == 0xFF || !dComIfGs_isSwitch(mSwNo2, fopAcM_GetHomeRoomNo(this)))) + if ((mSwNo == 0xFF || fopAcM_isSwitch(this, mSwNo)) && + (mSwNo2 == 0xFF || !fopAcM_isSwitch(this, mSwNo2))) { - if (mType != 0 || dComIfGp_getLinkPlayer()->checkWolf()) { - dComIfGp_getLinkPlayer()->onSceneChangeDead(field_0x56a, fopAcM_GetRoomNo(this)); + if (mType != 0 || daPy_py_c::checkNowWolf()) { + daPy_getLinkPlayerActorClass()->onSceneChangeDead(field_0x56a, fopAcM_GetRoomNo(this)); } } diff --git a/src/d/actor/d_a_tag_guard.cpp b/src/d/actor/d_a_tag_guard.cpp index f07448bc8d..661a907e70 100644 --- a/src/d/actor/d_a_tag_guard.cpp +++ b/src/d/actor/d_a_tag_guard.cpp @@ -13,7 +13,8 @@ int daTagGuard_c::getAppearPoint(Vec* i_appearPnt) { return 0; } - *i_appearPnt = dPath_GetPnt(mPath, mPath->m_num - 1)->m_position; + dPnt* pnt = dPath_GetPnt(mPath, mPath->m_num - 1); + *i_appearPnt = pnt->m_position; return 1; } @@ -21,8 +22,9 @@ void daTagGuard_c::createGuard(u32 i_parameters) { cXyz pos = current.pos; if (getPathID() != 0xFF) { - pos = dPath_GetPnt(mPath, 0)->m_position; - i_parameters |= (getPathID() << 0x10); + dPnt* pnt = dPath_GetPnt(mPath, 0); + pos.set(pnt->m_position); + i_parameters |= getPathID() << 0x10; } fopAcM_createChild(PROC_NPC_GUARD, fopAcM_GetID(this), i_parameters, &pos, @@ -38,20 +40,31 @@ int daTagGuard_c::create() { void daTagGuard_c::create_init() { mPath = dPath_GetRoomPath(getPathID(), fopAcM_GetHomeRoomNo(this)); + JUT_ASSERT(135, mPath != NULL); + dPnt* pnt1 = dPath_GetPnt(mPath, 0); dPnt* pnt2 = dPath_GetPnt(mPath, 1); +#if DEBUG + current.pos.set(pnt1->m_position); +#else + //TODO: fakematch, using ::set causes a misplaced mr on GCN versions current.pos.x = pnt1->m_position.x; current.pos.y = pnt1->m_position.y; current.pos.z = pnt1->m_position.z; +#endif + current.angle.y = cLib_targetAngleY(&pnt1->m_position, &pnt2->m_position); } static int daTagGuard_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagGuard_c* guard = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return guard->create(); } static int daTagGuard_Delete(daTagGuard_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagGuard_c(); return 1; } diff --git a/src/d/actor/d_a_tag_hinit.cpp b/src/d/actor/d_a_tag_hinit.cpp index db98089988..6f9207cf07 100644 --- a/src/d/actor/d_a_tag_hinit.cpp +++ b/src/d/actor/d_a_tag_hinit.cpp @@ -25,12 +25,15 @@ int daTagHinit_c::create() { } static int daTagHinit_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagHinit_c* hInit = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return hInit->create(); } daTagHinit_c::~daTagHinit_c() {} static int daTagHinit_Delete(daTagHinit_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagHinit_c(); return 1; } diff --git a/src/d/actor/d_a_tag_hjump.cpp b/src/d/actor/d_a_tag_hjump.cpp index 0e49eb14de..0692347e80 100644 --- a/src/d/actor/d_a_tag_hjump.cpp +++ b/src/d/actor/d_a_tag_hjump.cpp @@ -11,8 +11,27 @@ #include "d/d_com_inf_game.h" #include "d/actor/d_a_horse.h" +class daTagHjump_HIO_c : public mDoHIO_entry_c { +public: + daTagHjump_HIO_c(); + + void genMessage(JORMContext*); + + f32 depth; + f32 height; +}; + static char const l_arcName[] = "Hfence"; +#if DEBUG +daTagHjump_HIO_c l_HIO; + +void daTagHjump_HIO_c::genMessage(JORMContext* ctx) { + ctx->genSlider("高さ", &height, 0.0f, 500.0f); + ctx->genSlider("奥行き", &depth, 0.0f, 1000.0f); +} +#endif + int daTagHjump_c::CreateHeap() { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 4); mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); @@ -43,7 +62,7 @@ int daTagHjump_c::create() { if (phase == cPhs_COMPLEATE_e) { fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); - tevStr.room_no = fopAcM_GetRoomNo(this); + tevStr.room_no = (int)fopAcM_GetRoomNo(this); mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); mDoMtx_stack_c::YrotM(shape_angle.y); @@ -61,6 +80,11 @@ int daTagHjump_c::create() { fopAcM_SetMin(this, -scale.x, 0.0f, -50.0f); fopAcM_SetMax(this, scale.x, 200.0f, 50.0f); +#if DEBUG + // "Horse jumping fence" + l_HIO.entryHIO("馬ジャンプ柵"); +#endif + field_0x5ae = 0x2000; fopAcM_setCullSizeFar(this, 5.0f); field_0x5ad = 4; @@ -85,23 +109,41 @@ int daTagHjump_c::create() { return phase; } +daTagHjump_HIO_c::daTagHjump_HIO_c() { + height = 350.0f; + depth = 400.0f; +} + static int daTagHjump_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagHjump_c* hJump = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return hJump->create(); } daTagHjump_c::~daTagHjump_c() { if (mType != TYPE_TRIGGER_e) { dComIfG_resDelete(&mPhase, l_arcName); + +#if DEBUG + l_HIO.removeHIO(); +#endif } } static int daTagHjump_Delete(daTagHjump_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->MoveBGDelete(); i_this->~daTagHjump_c(); return 1; } int daTagHjump_c::execute() { +#if DEBUG + if (mType != 0) { + scale.y = l_HIO.height; + scale.z = l_HIO.depth; + } +#endif daHorse_c* horse_p = dComIfGp_getHorseActor(); if (horse_p != NULL && diff --git a/src/d/actor/d_a_tag_howl.cpp b/src/d/actor/d_a_tag_howl.cpp index 3480d4acc4..a93a9584f9 100644 --- a/src/d/actor/d_a_tag_howl.cpp +++ b/src/d/actor/d_a_tag_howl.cpp @@ -36,14 +36,16 @@ int daTag_Howl_c::draw() { return 1; } -u8 daTag_Howl_c::isAreaCheck() { +bool daTag_Howl_c::isAreaCheck() { + cXyz vec_to_player; + if (getSwitchBit() != 0xFF) { if (dComIfGs_isSaveSwitch(getSwitchBit())) { return false; } } - cXyz vec_to_player = daPy_getPlayerActorClass()->current.pos - current.pos; + vec_to_player = daPy_getPlayerActorClass()->current.pos - current.pos; if (daPy_py_c::checkNowWolf()) { if (vec_to_player.absXZ() < scale.x && -scale.y < vec_to_player.y && vec_to_player.y < scale.y) @@ -57,7 +59,7 @@ u8 daTag_Howl_c::isAreaCheck() { int daTag_Howl_c::getParam() { mCurveID = fopAcM_GetParam(this) & 0xF; - field_0x569 = fopAcM_GetParam(this) >> 0x1E; + field_0x569 = (fopAcM_GetParam(this) & 0xC0000000) >> 30; scale.x *= 100.0f; scale.y *= 100.0f; scale.z *= 100.0f; @@ -65,7 +67,8 @@ int daTag_Howl_c::getParam() { } u8 daTag_Howl_c::getSwitchBit() { - return (fopAcM_GetParam(this) >> 4) & 0xFF; + u8 param = (fopAcM_GetParam(this) & 0xFF0) >> 4; + return param; } static int daTag_Howl_Create(void* i_this) { diff --git a/src/d/actor/d_a_tag_hstop.cpp b/src/d/actor/d_a_tag_hstop.cpp index eb5179b751..54b5d4a3dd 100644 --- a/src/d/actor/d_a_tag_hstop.cpp +++ b/src/d/actor/d_a_tag_hstop.cpp @@ -5,11 +5,13 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep +#include "d/actor/d_a_horse.h" #include "d/actor/d_a_tag_hstop.h" #include "d/d_com_inf_game.h" +#include "d/d_debug_viewer.h" #include "d/d_meter2_info.h" +#include "d/d_s_play.h" #include "f_op/f_op_actor_mng.h" -#include "d/actor/d_a_horse.h" int daTagHstop_c::create() { fopAcM_ct(this, daTagHstop_c); @@ -42,16 +44,16 @@ int daTagHstop_c::create() { if (mPrm1 == 2) { if (daPy_py_c::checkRoomRestartStart()) { - if (!dComIfGs_isSwitch(0x8A, fopAcM_GetHomeRoomNo(this))) { - dComIfGs_onSwitch(0x8A, fopAcM_GetHomeRoomNo(this)); - } else if (!dComIfGs_isSwitch(0x8B, fopAcM_GetHomeRoomNo(this))) { - dComIfGs_onSwitch(0x8B, fopAcM_GetHomeRoomNo(this)); - } else if (!dComIfGs_isSwitch(0x8C, fopAcM_GetHomeRoomNo(this))) { - dComIfGs_onSwitch(0x8C, fopAcM_GetHomeRoomNo(this)); + if (!fopAcM_isSwitch(this, 0x8A)) { + fopAcM_onSwitch(this, 0x8A); + } else if (!fopAcM_isSwitch(this, 0x8B)) { + fopAcM_onSwitch(this, 0x8B); + } else if (!fopAcM_isSwitch(this, 0x8C)) { + fopAcM_onSwitch(this, 0x8C); } } - if (dComIfGs_isSwitch(0x8C, fopAcM_GetHomeRoomNo(this))) { + if (fopAcM_isSwitch(this, 0x8C)) { field_0x574 = 0; } else { field_0x574 = 1200; @@ -64,7 +66,9 @@ int daTagHstop_c::create() { } static int daTagHstop_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagHstop_c* hStop = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return hStop->create(); } daTagHstop_c::~daTagHstop_c() { @@ -82,14 +86,15 @@ daTagHstop_c::~daTagHstop_c() { } static int daTagHstop_Delete(daTagHstop_c* i_this) { + int id = fopAcM_GetID(i_this); static_cast(i_this)->~daTagHstop_c(); return 1; } void daTagHstop_c::setActive() { if (mPrm0 == 0xFF || mPrm1 == 2 || - (mPrm1 == 0 && dComIfGs_isSwitch(mPrm0, fopAcM_GetHomeRoomNo(this))) || - (mPrm1 == 1 && !dComIfGs_isSwitch(mPrm0, fopAcM_GetHomeRoomNo(this)))) + (mPrm1 == 0 && fopAcM_isSwitch(this, mPrm0)) || + (mPrm1 == 1 && !fopAcM_isSwitch(this, mPrm0))) { mActive = true; } else { @@ -105,19 +110,18 @@ int daTagHstop_c::execute() { m_msgFlow.init(this, (u16)shape_angle.z, 0, NULL); field_0x573 = 3; } else if (m_msgFlow.doFlow(this, NULL, 0)) { - dComIfGp_getEvent()->reset(); + dComIfGp_event_reset(); field_0x573 = 0; - s16 arrow_num = dComIfGp_getItemMaxArrowNumCount(); - dComIfGp_setItemArrowNumCount(arrow_num); - dComIfGs_onSwitch(0x8D, fopAcM_GetHomeRoomNo(this)); + dComIfGp_setItemArrowNumCount(dComIfGp_getItemMaxArrowNumCount()); + fopAcM_onSwitch(this, 0x8D); } } else { if (field_0x574 != 0) { - if (dComIfGs_isSwitch(0x8F, fopAcM_GetHomeRoomNo(this))) { + if (fopAcM_isSwitch(this, 0x8F)) { field_0x574 = 0; - } else if (dComIfGp_getLinkPlayer()->checkSingleBoarBattleSecondBowReady()) { - dComIfGs_onSwitch(0x8F, fopAcM_GetHomeRoomNo(this)); + } else if (daPy_getLinkPlayerActorClass()->checkSingleBoarBattleSecondBowReady()) { + fopAcM_onSwitch(this, 0x8F); field_0x574 = 0; } else { field_0x574--; @@ -127,35 +131,35 @@ int daTagHstop_c::execute() { setActive(); if (field_0x573) { - daHorse_c* horse_p = dComIfGp_getHorseActor(); + daHorse_c* horse_p = (daHorse_c*)dComIfGp_getHorseActor(); if (mPrm1 != 2 || dComIfGs_getArrowNum() != 0 || horse_p == NULL) { field_0x573 = 0; } else if (field_0x573 == 1) { - if (dComIfGp_getHorseActor()->checkTurnStand() && - !dComIfGp_getHorseActor()->checkTurnStandCamera()) + if (horse_p->checkTurnStand() && + !horse_p->checkTurnStandCamera()) { field_0x573 = 2; } - } else if (field_0x573 == 2 && !dComIfGp_getHorseActor()->checkTurnStand()) { + } else if (field_0x573 == 2 && !horse_p->checkTurnStand()) { fopAcM_orderSpeakEvent(this, 0, 0); eventInfo.onCondition(dEvtCnd_CANTALK_e); } } else if (mPrm1 == 2 && !dComIfGp_event_runCheck()) { - if (dComIfGs_getArrowNum() == 0 && !dComIfGs_isSwitch(0x8D, fopAcM_GetHomeRoomNo(this))) + if (dComIfGs_getArrowNum() == 0 && !fopAcM_isSwitch(this, 0x8D)) { - dComIfGs_onSwitch(0x8D, fopAcM_GetHomeRoomNo(this)); + fopAcM_onSwitch(this, 0x8D); dMeter2Info_setFloatingFlow(43, 90, true); - if (!dComIfGs_isSwitch(0x8F, fopAcM_GetHomeRoomNo(this))) { + if (!fopAcM_isSwitch(this, 0x8F)) { field_0x574 = 1200; - dComIfGs_offSwitch(0x8A, fopAcM_GetHomeRoomNo(this)); - dComIfGs_offSwitch(0x8B, fopAcM_GetHomeRoomNo(this)); - dComIfGs_offSwitch(0x8C, fopAcM_GetHomeRoomNo(this)); + fopAcM_offSwitch(this, 0x8A); + fopAcM_offSwitch(this, 0x8B); + fopAcM_offSwitch(this, 0x8C); } - } else if (field_0x574 == 0 && !dComIfGs_isSwitch(0x8F, fopAcM_GetHomeRoomNo(this))) { - dComIfGs_onSwitch(0x8F, fopAcM_GetHomeRoomNo(this)); - dComIfGs_onSwitch(0x8E, fopAcM_GetHomeRoomNo(this)); + } else if (field_0x574 == 0 && !fopAcM_isSwitch(this, 0x8F)) { + fopAcM_onSwitch(this, 0x8F); + fopAcM_onSwitch(this, 0x8E); } } } @@ -167,7 +171,31 @@ static int daTagHstop_Execute(daTagHstop_c* i_this) { return i_this->execute(); } -static int daTagHstop_Draw(daTagHstop_c*) { +static int daTagHstop_Draw(daTagHstop_c* i_this) { +#if DEBUG + if (UREG_S(9) != 0) { + cXyz sp08[8]; + sp08[0].set(-i_this->scale.x, i_this->scale.y, -i_this->scale.z); + sp08[1].set(i_this->scale.x, sp08[0].y, sp08[0].z); + sp08[2].set(sp08[0].x, sp08[0].y, i_this->scale.z); + sp08[3].set(sp08[1].x, sp08[0].y, sp08[2].z); + sp08[4].set(sp08[0].x, 0.0f, sp08[0].z); + sp08[5].set(sp08[1].x, 0.0f, sp08[1].z); + sp08[6].set(sp08[2].x, 0.0f, sp08[2].z); + sp08[7].set(sp08[3].x, 0.0f, sp08[3].z); + + mDoMtx_stack_c::transS(i_this->current.pos); + mDoMtx_stack_c::YrotM(i_this->shape_angle.y); + + for (int i = 0; i < 8; i++) { + mDoMtx_stack_c::multVec(&sp08[i], &sp08[i]); + } + + static GXColor color = {0xff, 0, 0xff, 0x80}; + dDbVw_drawCube8pXlu(sp08, color); + } +#endif + return 1; } diff --git a/src/d/actor/d_a_tag_instruction.cpp b/src/d/actor/d_a_tag_instruction.cpp index e6493d0358..cfee3518c0 100644 --- a/src/d/actor/d_a_tag_instruction.cpp +++ b/src/d/actor/d_a_tag_instruction.cpp @@ -9,11 +9,13 @@ #include "d/d_procname.h" static int daTagInst_Create(fopAc_ac_c* i_this) { + int id = fopAcM_GetID(i_this); fopAcM_ct(i_this, daTagInst_c); return cPhs_COMPLEATE_e; } static int daTagInst_Delete(daTagInst_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagInst_c(); return 1; } diff --git a/src/d/actor/d_a_tag_kago_fall.cpp b/src/d/actor/d_a_tag_kago_fall.cpp index 64af655b64..369ff1aba5 100644 --- a/src/d/actor/d_a_tag_kago_fall.cpp +++ b/src/d/actor/d_a_tag_kago_fall.cpp @@ -5,8 +5,9 @@ #include "d/actor/d_a_player.h" #include "d/d_camera.h" #include "d/d_com_inf_game.h" -#include "d/d_procname.h" #include "d/d_msg_object.h" +#include "d/d_procname.h" +#include "d/d_s_play.h" #include "f_op/f_op_actor_mng.h" #include "m_Do/m_Do_graphic.h" @@ -28,7 +29,7 @@ int daTagKagoFall_c::create() { mExitID = 2; mStartPoint = 0; - mDoMtx_trans(mDoMtx_stack_c::get(), current.pos.x, current.pos.y, current.pos.z); + mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); mDoMtx_stack_c::YrotM(shape_angle.y); mDoMtx_inverse(mDoMtx_stack_c::get(), mMtx); @@ -84,7 +85,7 @@ void daTagKagoFall_c::actionWaitRiver() { return; } } else { - mNoCarryTimer = 150; + mNoCarryTimer = 150 + nREG_S(5); } } @@ -99,7 +100,7 @@ void daTagKagoFall_c::actionWaitRiver() { mRestartPos = dCam_getBody()->Eye(); mActionState = 1; mTimer = 30; - player->onNoResetFlg0(daPy_py_c::FLG0_UNK_10000); + player->onDemoStreamAccept(); mRiverTimer = 60; } } @@ -111,7 +112,7 @@ void daTagKagoFall_c::actionWaitRiver() { } if (mRiverTimer == 0) { - Z2GetAudioMgr()->seStart(Z2SE_FORCE_BACK, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + mDoAud_seStart(Z2SE_FORCE_BACK, NULL, 0, 0); mDoGph_gInf_c::fadeOut(0.05f, static_cast(g_blackColor)); mRiverTimer = 20; mActionState = 2; @@ -122,7 +123,7 @@ void daTagKagoFall_c::actionWaitRiver() { case 2: if (mRiverTimer == 0) { - daPy_getPlayerActorClass()->offNoResetFlg0(daPy_py_c::FLG0_UNK_10000); + daPy_getPlayerActorClass()->offDemoStreamAccept(); mActionState = 3; mTimer = 40; } @@ -136,25 +137,21 @@ void daTagKagoFall_c::actionWaitRiver() { } break; - case 4: { - daPy_getPlayerActorClass()->offNoResetFlg0(daPy_py_c::FLG0_UNK_10000); + case 4: + daPy_getPlayerActorClass()->offDemoStreamAccept(); - int msg = mMsgFlow.doFlow(this, NULL, 0); - if (msg != 0) { + if (mMsgFlow.doFlow(this, NULL, 0) != 0) { if (dMsgObject_getSelectCursorPos() != 0) { dStage_changeScene(mExitID, 0.0f, 0, fopAcM_GetRoomNo(this), 0, -1); } else { - int room = dStage_roomControl_c::mStayNo; - dComIfGp_setNextStage("F_SP112", mStartPoint, room, dComIfG_play_c::getLayerNo(0), - 0.0f, 10, 1, 0, 0, 1, 0); + dComIfGp_setNextStage("F_SP112", mStartPoint, dComIfGp_roomControl_getStayNo(), + dComIfG_play_c::getLayerNo(0), 0.0f, 10, 1, 0, 0, 1, 0); } mActionState = 5; } break; - } case 5: - // Maybe contained some stripped out debug code? break; } } @@ -179,7 +176,7 @@ void daTagKagoFall_c::actionWaitFall() { mActionState = 1; } } else { - mNoCarryTimer = 150; + mNoCarryTimer = 150 + nREG_S(5); } } break; @@ -188,9 +185,8 @@ void daTagKagoFall_c::actionWaitFall() { if (dComIfGs_getLife() == 0) { player->onSceneChangeAreaJump(mExitID, -1, NULL); - if (player->checkNoResetFlg2(daPy_py_c::FLG2_SCENE_CHANGE_START) && !mPlayedSceneChangeSfx) - { - Z2GetAudioMgr()->seStart(Z2SE_FORCE_BACK, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + if (player->checkSceneChangeAreaStart() && !mPlayedSceneChangeSfx) { + mDoAud_seStart(Z2SE_FORCE_BACK, NULL, 0, 0); player->voiceStart(Z2SE_WL_V_FALL_TO_RESTART); mPlayedSceneChangeSfx = true; } @@ -202,7 +198,7 @@ void daTagKagoFall_c::actionWaitFall() { mDoGph_gInf_c::fadeOut(0.05f, static_cast(g_blackColor)); mTimer = 60; mActionState = 2; - Z2GetAudioMgr()->seStart(Z2SE_FORCE_BACK, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + mDoAud_seStart(Z2SE_FORCE_BACK, NULL, 0, 0); player->voiceStart(Z2SE_WL_V_FALL_TO_RESTART); } break; @@ -236,14 +232,12 @@ void daTagKagoFall_c::actionWaitFall() { case 3: { player->setPlayerPosAndAngle(&mRestartPos, 0, 0); - int msg = mMsgFlow.doFlow(this, NULL, 0); - if (msg != 0) { + if (mMsgFlow.doFlow(this, NULL, 0) != 0) { if (dMsgObject_getSelectCursorPos() != 0) { dStage_changeScene(mExitID, 0.0f, 0, fopAcM_GetRoomNo(this), 0, -1); } else { - int room = dStage_roomControl_c::mStayNo; - dComIfGp_setNextStage("F_SP112", mStartPoint, room, dComIfG_play_c::getLayerNo(0), - 0.0f, 10, 1, 0, 0, 1, 0); + dComIfGp_setNextStage("F_SP112", mStartPoint, dComIfGp_roomControl_getStayNo(), + dComIfG_play_c::getLayerNo(0), 0.0f, 10, 1, 0, 0, 1, 0); } mActionState = 10; } @@ -265,10 +259,12 @@ static int daTagKagoFall_Execute(daTagKagoFall_c* i_this) { } static int daTagKagoFall_Delete(daTagKagoFall_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->_delete(); } static int daTagKagoFall_Create(daTagKagoFall_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->create(); } diff --git a/src/d/actor/d_a_tag_lantern.cpp b/src/d/actor/d_a_tag_lantern.cpp index 30f269b70f..b27a4facc9 100644 --- a/src/d/actor/d_a_tag_lantern.cpp +++ b/src/d/actor/d_a_tag_lantern.cpp @@ -6,21 +6,46 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_tag_lantern.h" + +#include "JSystem/JHostIO/JORFile.h" +#include "d/d_debug_viewer.h" #include "d/d_procname.h" static TAG_LANTERN_HIO_CLASS l_HIO; +daTag_Lantern_HIOParam const daTag_Lantern_Param_c::m = {0}; + #if DEBUG daTag_Lantern_HIO_c::daTag_Lantern_HIO_c() { m = daTag_Lantern_Param_c::m; } void daTag_Lantern_HIO_c::listenPropertyEvent(const JORPropertyEvent* event) { - // NONMATCHING + JORReflexible::listenPropertyEvent(event); + JORFile file; + switch ((int)event->id) { + case 0x40000002: + if (file.open(JORFile::EFlags_WRITE | JORFile::EFlags_UNK_0x4, "すべてのファイル(*.*)\0*.*\0", NULL, NULL, NULL)) { + char sp138[0x7d0]; + memset(sp138, 0, sizeof(sp138)); + int msgLen = 0; + sprintf(sp138 + msgLen, "%d, \t// デバグ情報ON\n", m.enable_debug_info); + msgLen = strlen(sp138); + file.writeData(sp138, msgLen); + file.close(); + OS_REPORT("write append success!::%6d\n", msgLen); + } else { + OS_REPORT("write append failure!\n"); + } + break; + } } void daTag_Lantern_HIO_c::genMessage(JORMContext* ctx) { - // NONMATCHING + // "Debug information ON" + ctx->genCheckBox("デバグ情報ON ", &m.enable_debug_info, 1); + // "Export file" + ctx->genButton("ファイル書き出し", 0x40000002, 0); } #endif @@ -39,6 +64,7 @@ int daTag_Lantern_c::create() { } int daTag_Lantern_c::Delete() { + fopAcM_RegisterDeleteID(this, "TAG_LANTERN"); this->~daTag_Lantern_c(); return 1; } @@ -80,12 +106,25 @@ int daTag_Lantern_c::Execute() { } int daTag_Lantern_c::Draw() { +#if DEBUG + if (mpHIO->m.enable_debug_info) { + dDbVw_drawCylinderXlu(current.pos, scale.x, scale.y, + (GXColor){0x80, 0x80, 0x80, 0x80}, 1); + } +#endif + return 1; } void daTag_Lantern_c::initialize() { fopAcM_setCullSizeBox(this, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); +#if DEBUG + mpHIO = &l_HIO; + // "Lantern check tag" + mpHIO->entryHIO("カンテラチェックタグ"); +#endif + if (home.angle.z != 0xFFFF) { mFlowIndex = home.angle.z; } else { diff --git a/src/d/actor/d_a_tag_lightball.cpp b/src/d/actor/d_a_tag_lightball.cpp index f524503921..e26b245b02 100644 --- a/src/d/actor/d_a_tag_lightball.cpp +++ b/src/d/actor/d_a_tag_lightball.cpp @@ -17,7 +17,7 @@ void daTagLightBall_c::setBaseMtx() { int daTagLightBall_c::Create() { initBaseMtx(); - u8 swbit = getSwBit(); + u8 swbit = getSwbit(); if (fopAcM_GetRoomNo(this) == 7) { if (!fopAcM_isSwitch(this, 70)) { fopAcM_offSwitch(this, swbit); @@ -56,7 +56,7 @@ int daTagLightBall_c::create() { } int daTagLightBall_c::execute() { - u8 swbit = getSwBit(); + u8 swbit = getSwbit(); if (swbit != 0xFF) { if (getType() == 15) { if (field_0x57c && !fopAcM_isSwitch(this, swbit)) { @@ -102,11 +102,14 @@ static int daTagLightBall_Execute(daTagLightBall_c* i_this) { } static int daTagLightBall_Delete(daTagLightBall_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->_delete(); } static int daTagLightBall_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagLightBall_c* lightBall = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return lightBall->create(); } static actor_method_class l_daTagLightBall_Method = { diff --git a/src/d/actor/d_a_tag_lv2prchk.cpp b/src/d/actor/d_a_tag_lv2prchk.cpp index bb7e7d186b..8b074baa8a 100644 --- a/src/d/actor/d_a_tag_lv2prchk.cpp +++ b/src/d/actor/d_a_tag_lv2prchk.cpp @@ -12,6 +12,8 @@ int daTagLv2PrChk_c::Create() { mSwbit2 = getSwbit2(); if (mSwbit2 == 0xFF) { + // "Boomerang puzzle monitoring tag: switch 2 is not specified" + OS_REPORT("\x1b[43;30mブーメランネタ監視タグ:スイッチ2の指定がありません\n\x1b[m"); return 0; } @@ -21,6 +23,9 @@ int daTagLv2PrChk_c::Create() { mAction = ACTION_CHECK_e; } + // "Boomerang puzzle monitoring tag: switch 1 <%d> switch 2 <%d>" + OS_REPORT("ブーメランネタ監視タグ:スイッチ1<%d>スイッチ2<%d>\n", getSwbit(), getSwbit2()); + return 1; } @@ -120,6 +125,8 @@ void daTagLv2PrChk_c::actionCheck() { case MODE_PUZZLE_CLEAR: fopAcM_onSwitch(this, getSwbit()); mAction = ACTION_END_e; + // "Boomerang puzzle monitoring tag: SW<%d> was turned on" + OS_REPORT("ブーメランネタ監視タグ:SW<%d>オンしました\n", getSwbit()); break; case MODE_CHECK_RESET: if (!switch_1 && !switch_2 && !switch_3 && !switch_4) { @@ -151,6 +158,8 @@ void daTagLv2PrChk_c::actionEnd() {} void daTagLv2PrChk_c::seStartWrong() { Z2GetAudioMgr()->seStart(Z2SE_SYS_RESULT_WRONG, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + // "♪ Wrong answer!!!!" + OS_REPORT("♪ハズレ!!!!\n"); } int daTagLv2PrChk_c::_delete() { @@ -162,10 +171,12 @@ static int daTagLv2PrChk_Execute(daTagLv2PrChk_c* i_this) { } static int daTagLv2PrChk_Delete(daTagLv2PrChk_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->_delete(); } static int daTagLv2PrChk_Create(daTagLv2PrChk_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->create(); } diff --git a/src/d/actor/d_a_tag_lv5soup.cpp b/src/d/actor/d_a_tag_lv5soup.cpp index 2c000a0b92..dfd532d615 100644 --- a/src/d/actor/d_a_tag_lv5soup.cpp +++ b/src/d/actor/d_a_tag_lv5soup.cpp @@ -42,7 +42,8 @@ int daTag_Lv5Soup_c::Draw() { } bool daTag_Lv5Soup_c::isAreaCheck() { - cXyz dist = daPy_getPlayerActorClass()->current.pos - current.pos; + cXyz dist; + dist = daPy_getPlayerActorClass()->current.pos - current.pos; f32 boundX = scale.x * 100.0f; f32 boundY = scale.y * 100.0f; diff --git a/src/d/actor/d_a_tag_lv6CstaSw.cpp b/src/d/actor/d_a_tag_lv6CstaSw.cpp index 2e1ba6105d..14150299eb 100644 --- a/src/d/actor/d_a_tag_lv6CstaSw.cpp +++ b/src/d/actor/d_a_tag_lv6CstaSw.cpp @@ -6,12 +6,23 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_tag_lv6CstaSw.h" + +#include "d/d_debug_viewer.h" #include "d/d_procname.h" +static daLv6CstaSw_HIO_c l_HIO; + daLv6CstaSw_HIO_c::daLv6CstaSw_HIO_c() { - unk_0x4 = 0; + show_range = 0; } +#if DEBUG +void daLv6CstaSw_HIO_c::genMessage(JORMContext* ctx) { + // "Display range" + ctx->genCheckBox("範囲表示", &show_range, 1); +} +#endif + void daLv6CstaSw_c::setBaseMtx() { mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z); @@ -21,12 +32,19 @@ int daLv6CstaSw_c::create() { fopAcM_ct(this, daLv6CstaSw_c); mSwitch = getSw(); setBaseMtx(); + +#if DEBUG + l_HIO.entryHIO("石像SWタグ"); +#endif + return cPhs_COMPLEATE_e; } -fopAc_ac_c* daLv6CstaSw_c::searchSekizoAct(void* i_actor, void*) { - if (i_actor != NULL && fopAcM_IsActor(i_actor) && fopAcM_GetProfName(i_actor) == PROC_CSTATUE) { - return (fopAc_ac_c*)i_actor; +fopAc_ac_c* daLv6CstaSw_c::searchSekizoAct(void* i_actor, void* param_1) { + fopAc_ac_c* actor2 = (fopAc_ac_c*)param_1; + fopAc_ac_c* actor = (fopAc_ac_c*)i_actor; + if (actor != NULL && fopAcM_IsActor(actor) && fopAcM_GetProfName(actor) == PROC_CSTATUE) { + return actor; } return NULL; @@ -41,7 +59,8 @@ bool daLv6CstaSw_c::areaCheck() { } cXyz vec_to_actor = current.pos - sekizo_p->current.pos; - if (vec_to_actor.absXZ() <= scale.x * 100.0f) { + f32 dist_to_actor = vec_to_actor.absXZ(); + if (dist_to_actor <= scale.x * 100.0f) { in_area = true; } @@ -49,7 +68,8 @@ bool daLv6CstaSw_c::areaCheck() { } int daLv6CstaSw_c::Execute() { - if (areaCheck() == true) { + bool result = areaCheck(); + if (result == true) { if (!fopAcM_isSwitch(this, mSwitch)) { fopAcM_onSwitch(this, mSwitch); } @@ -63,10 +83,22 @@ int daLv6CstaSw_c::Execute() { } int daLv6CstaSw_c::Draw() { +#if DEBUG + if (l_HIO.show_range) { + g_env_light.settingTevStruct(16, ¤t.pos, &tevStr); + GXColor color = (GXColor){0, 0, 0xff, 0x80}; + dDbVw_drawCylinderXlu(current.pos, scale.x * 100.0f, scale.y * 100.0f, color, 1); + } +#endif + return 1; } int daLv6CstaSw_c::Delete() { +#if DEBUG + l_HIO.removeHIO(); +#endif + return 1; } @@ -79,17 +111,16 @@ static int daLv6CstaSw_Execute(daLv6CstaSw_c* i_this) { } static int daLv6CstaSw_Delete(daLv6CstaSw_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->Delete(); } static int daLv6CstaSw_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daLv6CstaSw_c* cStaSw = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return cStaSw->create(); } -daLv6CstaSw_HIO_c::~daLv6CstaSw_HIO_c() {} - -static daLv6CstaSw_HIO_c l_HIO; - static actor_method_class l_daLv6CstaSw_Method = { (process_method_func)daLv6CstaSw_Create, (process_method_func)daLv6CstaSw_Delete, (process_method_func)daLv6CstaSw_Execute, (process_method_func)NULL, diff --git a/src/d/actor/d_a_tag_magne.cpp b/src/d/actor/d_a_tag_magne.cpp index 8d292552e8..0ade82b3e4 100644 --- a/src/d/actor/d_a_tag_magne.cpp +++ b/src/d/actor/d_a_tag_magne.cpp @@ -10,6 +10,8 @@ int daTagMagne_c::Create() { if (mTagMagne != NULL) { + // "Multiple magnet cord(?) management tags are placed!" + OS_REPORT_ERROR("マグネコード管理タグが複数置かれています!\n"); return 0; } @@ -24,7 +26,7 @@ int daTagMagne_c::Create() { int daTagMagne_c::create() { fopAcM_ct(this, daTagMagne_c); - if (mTagMagne != NULL && mTagMagne->current.roomNo != current.roomNo) { + if (mTagMagne != NULL && fopAcM_GetRoomNo(mTagMagne) != fopAcM_GetRoomNo(this)) { return cPhs_INIT_e; } @@ -32,6 +34,8 @@ int daTagMagne_c::create() { return cPhs_ERROR_e; } + OS_REPORT("TAG MAGNE PARAM=%x\n", fopAcM_GetParam(this)); + return cPhs_COMPLEATE_e; } @@ -41,11 +45,14 @@ int daTagMagne_c::_delete() { } static void daTagMagne_Delete(daTagMagne_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->_delete(); } static void daTagMagne_Create(fopAc_ac_c* i_this) { - ((daTagMagne_c*)i_this)->create(); + daTagMagne_c* magne = static_cast(i_this); + int id = fopAcM_GetID(i_this); + magne->create(); } static actor_method_class l_daTagMagne_Method = { diff --git a/src/d/actor/d_a_tag_mhint.cpp b/src/d/actor/d_a_tag_mhint.cpp index 3352b1e9ab..ee66c938b7 100644 --- a/src/d/actor/d_a_tag_mhint.cpp +++ b/src/d/actor/d_a_tag_mhint.cpp @@ -64,12 +64,15 @@ int daTagMhint_c::create() { } static int daTagMhint_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagMhint_c* mhint = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return mhint->create(); } daTagMhint_c::~daTagMhint_c() {} static int daTagMhint_Delete(daTagMhint_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagMhint_c(); return 1; } @@ -132,13 +135,14 @@ int daTagMhint_c::execute() { } else if (eventInfo.checkCommandTalk()) { if (!midna_p->checkShadowModeTalkWait()) { if (field_0x56e == 0) { - mMsgFlow.init(this, shape_angle.z & 0xFFFF, 0, NULL); + mMsgFlow.init(this, (u16)shape_angle.z, 0, NULL); field_0x56e = 1; mDoAud_seStart(Z2SE_NAVI_TALK_START, NULL, 0, 0); field_0x571 = 0; } else if (mMsgFlow.doFlow(this, NULL, 0)) { int sp28; - if (mMsgFlow.getEventId(&sp28) == 7) { + u16 eventId = mMsgFlow.getEventId(&sp28); + if (eventId == 7) { dMeter2Info_setPauseStatus(1); } diff --git a/src/d/actor/d_a_tag_mist.cpp b/src/d/actor/d_a_tag_mist.cpp index c73f347840..5b55240b58 100644 --- a/src/d/actor/d_a_tag_mist.cpp +++ b/src/d/actor/d_a_tag_mist.cpp @@ -7,14 +7,37 @@ #include "d/actor/d_a_tag_mist.h" #include "d/d_com_inf_game.h" +#include "d/d_debug_viewer.h" #include "d/d_procname.h" -void daTagMist_c::offSw() { - u8 sw_no_num; - u8 top_sw_no; +class daTagMist_HIO_c : public mDoHIO_entry_c { +public: + daTagMist_HIO_c(); - top_sw_no = daTagMist_prm::getTopSwNo(this); - sw_no_num = daTagMist_prm::getSwNoNum(this); + void genMessage(JORMContext*); + + u8 show_range; +}; + +#if DEBUG +daTagMist_HIO_c l_HIO; + +daTagMist_HIO_c::daTagMist_HIO_c() { + show_range = 0; +} + +void daTagMist_HIO_c::genMessage(JORMContext* ctx) { + // "Fog range tag" + ctx->genLabel("霧の範囲タグ", 0); + // "Show range" + ctx->genCheckBox("範囲表示", &show_range, 1); +} +#endif + +void daTagMist_c::offSw() { + u8 top_sw_no = daTagMist_prm::getTopSwNo(this); + u8 my_sw_no = daTagMist_prm::getMySwNo(this); + u8 sw_no_num = daTagMist_prm::getSwNoNum(this); for (int i = 0; i < sw_no_num; i++) { fopAcM_offSwitch(this, top_sw_no + i); @@ -22,11 +45,8 @@ void daTagMist_c::offSw() { } void daTagMist_c::onMySw() { - u32 my_sw_no; - u32 top_sw_no; - - top_sw_no = daTagMist_prm::getTopSwNo(this); - my_sw_no = daTagMist_prm::getMySwNo(this); + u8 top_sw_no = daTagMist_prm::getTopSwNo(this); + u8 my_sw_no = daTagMist_prm::getMySwNo(this); if (my_sw_no != 0xFF) { fopAcM_onSwitch(this, top_sw_no + my_sw_no); @@ -34,11 +54,8 @@ void daTagMist_c::onMySw() { } BOOL daTagMist_c::isMySw() { - u32 my_sw_no; - u32 top_sw_no; - - top_sw_no = daTagMist_prm::getTopSwNo(this); - my_sw_no = daTagMist_prm::getMySwNo(this); + u8 top_sw_no = daTagMist_prm::getTopSwNo(this); + u8 my_sw_no = daTagMist_prm::getMySwNo(this); if (my_sw_no != 0xFF && fopAcM_isSwitch(this, top_sw_no + my_sw_no)) { return TRUE; @@ -60,10 +77,7 @@ int daTagMist_c::Create() { mVertices[3].x = scale.x * -50.0f; mVertices[3].z = scale.z * 50.0f; - mVertices[3].y = 0.0f; - mVertices[2].y = 0.0f; - mVertices[1].y = 0.0f; - mVertices[0].y = 0.0f; + mVertices[0].y = mVertices[1].y = mVertices[2].y = mVertices[3].y = 0.0f; if (isMySw()) { setPlayerNo(daTagMist_prm::getExitNo(this)); @@ -82,23 +96,26 @@ int daTagMist_c::create() { field_0x5a2 = home.angle.x; field_0x5a4 = home.angle.z; - home.angle.z = 0; - home.angle.x = 0; - current.angle.z = 0; - current.angle.x = 0; - shape_angle.z = 0; - shape_angle.x = 0; + home.angle.x = home.angle.z = 0; + current.angle.x = current.angle.z = 0; + shape_angle.x = shape_angle.z = 0; } if (!Create()) { return cPhs_ERROR_e; } +#if DEBUG + // "Fog range tag" + l_HIO.entryHIO("霧の範囲タグ"); +#endif + return cPhs_COMPLEATE_e; } int daTagMist_c::execute() { - if (fopAcM_isSwitch(this, daTagMist_prm::getSwNo2(this))) { + u8 sw_no_2 = daTagMist_prm::getSwNo2(this); + if (fopAcM_isSwitch(this, sw_no_2)) { return 1; } @@ -109,33 +126,76 @@ int daTagMist_c::execute() { mDoMtx_stack_c::YrotS(-current.angle.y); mDoMtx_stack_c::multVec(&player_dist, &player_dist); - u8 player_inside = (mVertices[0].x < player_dist.x && mVertices[0].z < player_dist.z) && - (mVertices[2].x > player_dist.x && mVertices[2].z > player_dist.z); + u8 player_inside = mVertices[0].x < player_dist.x && mVertices[0].z < player_dist.z && + mVertices[2].x > player_dist.x && mVertices[2].z > player_dist.z; if (player_inside && !mPlayerTouched) { offSw(); onMySw(); - mPlayerNo = daTagMist_prm::getExitNo(this); + setPlayerNo(daTagMist_prm::getExitNo(this)); } mPlayerTouched = player_inside; return 1; } -int daTagMist_c::_delete() { +int daTagMist_c::draw() { +#if DEBUG + if (l_HIO.show_range) { + GXColor color = {0, 0, 0x80, 0x80}; + cXyz sp10[8]; + + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::YrotM(current.angle.y); + + sp10[0] = mVertices[0]; + sp10[1] = mVertices[1]; + sp10[2] = mVertices[3]; + sp10[3] = mVertices[2]; + sp10[4] = mVertices[0]; + sp10[5] = mVertices[1]; + sp10[6] = mVertices[3]; + sp10[7] = mVertices[2]; + + for (int i = 0; i < 8; i++) { + mDoMtx_stack_c::multVec(&sp10[i], &sp10[i]); + } + + for (int i = 0; i < 4; i++) { + sp10[i].y += 1000.0f; + } + + dDbVw_drawCube8pXlu(sp10, color); + } +#endif + return 1; } +int daTagMist_c::_delete() { +#if DEBUG + l_HIO.removeHIO(); +#endif + return 1; +} + +static int daTagMist_Draw(daTagMist_c* i_this) { + return i_this->draw(); +} + static int daTagMist_Execute(daTagMist_c* i_this) { return i_this->execute(); } static int daTagMist_Delete(daTagMist_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->_delete(); } static int daTagMist_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagMist_c* mist = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return mist->create(); } static actor_method_class l_daTagMist_Method = { @@ -143,7 +203,11 @@ static actor_method_class l_daTagMist_Method = { (process_method_func)daTagMist_Delete, (process_method_func)daTagMist_Execute, (process_method_func)NULL, +#if DEBUG + (process_method_func)daTagMist_Draw, +#else (process_method_func)NULL, +#endif }; actor_process_profile_definition g_profile_Tag_Mist = { diff --git a/src/d/actor/d_a_tag_mmsg.cpp b/src/d/actor/d_a_tag_mmsg.cpp index ef52c329b4..11bf28eb00 100644 --- a/src/d/actor/d_a_tag_mmsg.cpp +++ b/src/d/actor/d_a_tag_mmsg.cpp @@ -8,13 +8,13 @@ int daTagMmsg_c::create() { fopAcM_ct(this, daTagMmsg_c); - field_0x570 = fpcM_GetParam(this) & 0x3FF; - field_0x572 = (fpcM_GetParam(this) >> 10) & 0x3FF; - field_0x56b = (fpcM_GetParam(this) >> 29) & 1; + field_0x570 = fopAcM_GetParam(this) & 0x3FF; + field_0x572 = (fopAcM_GetParam(this) >> 10) & 0x3FF; + field_0x56b = (fopAcM_GetParam(this) >> 29) & 0x1; field_0x568 = shape_angle.x; field_0x569 = (shape_angle.x >> 8) & 0xFF; - if ((fpcM_GetParam(this) >> 30) & 1) { + if ((fopAcM_GetParam(this) >> 30) & 0x1) { scale.x *= 10.0f; scale.y *= 10.0f; } @@ -24,10 +24,9 @@ int daTagMmsg_c::create() { mAttention = shape_angle.y; if (!checkNoAttention()) { - s32 roomNo = fopAcM_GetRoomNo(this); stage_arrow_data_class* arrowData = - &dComIfGp_getRoomArrow(roomNo) - ->m_entries[dComIfGp_getRoomCamera(roomNo)->m_entries[mAttention].m_arrow_idx]; + &dComIfGp_getRoomArrow(fopAcM_GetRoomNo(this)) + ->m_entries[dComIfGp_getRoomCamera(fopAcM_GetRoomNo(this))->m_entries[mAttention].m_arrow_idx]; eyePos.set(arrowData->posX, arrowData->posY, arrowData->posZ); attention_info.position = eyePos; } @@ -37,18 +36,22 @@ int daTagMmsg_c::create() { } static int daTagMmsg_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagMmsg_c* mmsg = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return mmsg->create(); } daTagMmsg_c::~daTagMmsg_c() {} static int daTagMmsg_Delete(daTagMmsg_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagMmsg_c(); return 1; } int daTagMmsg_c::execute() { - if (daPy_py_c::getMidnaActor() == NULL) { + daMidna_c* midna = daPy_py_c::getMidnaActor(); + if (midna == NULL) { return 1; } @@ -57,13 +60,13 @@ int daTagMmsg_c::execute() { return 1; } - if (field_0x569 != 0xFF && dComIfGs_isSwitch(field_0x569, fopAcM_GetHomeRoomNo(this))) { + if (field_0x569 != 0xFF && fopAcM_isSwitch(this, field_0x569)) { fopAcM_delete(this); return 1; } if (mUseFlg && !dComIfGp_event_runCheck() && field_0x56b && field_0x569 != 0xFF) { - dComIfGs_onSwitch(field_0x569, fopAcM_GetHomeRoomNo(this)); + fopAcM_onSwitch(this, field_0x569); fopAcM_delete(this); return 1; } @@ -73,7 +76,7 @@ int daTagMmsg_c::execute() { (fopAcM_searchPlayerDistanceXZ2(this) < field_0x574) && (field_0x570 == 0x3FF || dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[field_0x570])) && - (field_0x568 == 0xFF || dComIfGs_isSwitch(field_0x568, fopAcM_GetHomeRoomNo(this)))) + (field_0x568 == 0xFF || fopAcM_isSwitch(this, field_0x568))) { player->setMidnaMsgNum(this, shape_angle.z); } diff --git a/src/d/actor/d_a_tag_msg.cpp b/src/d/actor/d_a_tag_msg.cpp index 734635ec74..d9cbd2bf66 100644 --- a/src/d/actor/d_a_tag_msg.cpp +++ b/src/d/actor/d_a_tag_msg.cpp @@ -5,12 +5,14 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep -#include "d/actor/d_a_tag_msg.h" #include "d/actor/d_a_player.h" +#include "d/actor/d_a_tag_msg.h" #include "d/d_com_inf_game.h" +#include "d/d_debug_viewer.h" static int createHeapCallBack(fopAc_ac_c* i_this) { - return ((daTag_Msg_c*)i_this)->createHeap(); + daTag_Msg_c* msg = (daTag_Msg_c*)i_this; + return msg->createHeap(); } static char* l_resName = "TagMsg"; @@ -20,8 +22,20 @@ static char* l_evtNameTBL[2] = { "SPEAK", }; +#if DEBUG +daTag_Msg_HIO_c::daTag_Msg_HIO_c() { + m = daTag_Msg_Param_c::m; +} +#endif + daTag_Msg_c::~daTag_Msg_c() { dComIfG_resDelete(&mPhase, getResName()); + +#if DEBUG + if (mpHIO != NULL) { + mDoHIO_deleteChild(mpHIO->mChild); + } +#endif } int daTag_Msg_c::create() { @@ -38,14 +52,18 @@ int daTag_Msg_c::create() { if (!fopAcM_entrySolidHeap(this, createHeapCallBack, 0x10)) { return cPhs_ERROR_e; } + +#if DEBUG + mpHIO->mChild = mDoHIO_createChild("メッセ-ジタグ", mpHIO); +#endif } return phase_state; } int daTag_Msg_c::createHeap() { - mParam = new daTag_Msg_Param_c(); - if (mParam == NULL) { + mpHIO = new TAG_MSG_HIO_CLASS(); + if (mpHIO == NULL) { return 0; } @@ -53,6 +71,7 @@ int daTag_Msg_c::createHeap() { } int daTag_Msg_c::destroy() { + int id = fopAcM_GetID(this); this->~daTag_Msg_c(); return 1; } @@ -128,6 +147,14 @@ int daTag_Msg_c::execute() { } int daTag_Msg_c::draw() { +#if DEBUG + if (mpHIO->m.mDebugAdjustON) { + cXyz sp0C(current.pos); + sp0C.y -= scale.y; + dDbVw_drawCylinderXlu(sp0C, scale.x, 2.0f * scale.y, (GXColor){0x80, 0x80, 0x80, 0x80}, 1); + } +#endif + return 1; } @@ -159,15 +186,15 @@ BOOL daTag_Msg_c::otherCheck() { if (field_0x5dd) { return 1; - } + } else { + s16 var_r28 = fopAcM_searchActorAngleY(this, daPy_getPlayerActorClass()) + 0x7FFF; + s16 angle_to_player = var_r28 - daPy_getPlayerActorClass()->current.angle.y; + if (angle_to_player < 0) { + angle_to_player = -angle_to_player; + } - s16 var_r28 = fopAcM_searchActorAngleY(this, daPy_getPlayerActorClass()) + 0x7FFF; - s16 angle_to_player = var_r28 - daPy_getPlayerActorClass()->current.angle.y; - if (angle_to_player < 0) { - angle_to_player = -angle_to_player; + return angle_to_player <= 0x1000; } - - return angle_to_player <= 0x1000; } char* daTag_Msg_c::getResName() { @@ -176,14 +203,15 @@ char* daTag_Msg_c::getResName() { void daTag_Msg_c::getParam() { mOnSwitch = home.angle.x & 0xFF; - mOffSwitch = (home.angle.x >> 8) & 0xFF; + mOffSwitch = (home.angle.x & 0xFF00) >> 8; mOnSaveLabel = fopAcM_GetParam(this) & 0xFFF; - mOffSaveLabel = (fopAcM_GetParam(this) >> 0xC) & 0xFFF; + mOffSaveLabel = (fopAcM_GetParam(this) & 0xFFF000) >> 12; field_0x5dc = (fopAcM_GetParam(this) & 0x1000000) != 0; field_0x5dd = (fopAcM_GetParam(this) & 0x2000000) != 0; - if ((home.angle.z & 0xFFFF) != 0) { - mFlowID = home.angle.z & 0xFFFF; + u16 var_r30 = (u16)home.angle.z; + if (var_r30 != 0) { + mFlowID = var_r30; } else { mFlowID = -1; } @@ -227,6 +255,15 @@ static int daTag_Msg_IsDelete(void* i_this) { return 1; } +#if DEBUG +daTag_Msg_HIO_c::~daTag_Msg_HIO_c() { +} + +void daTag_Msg_HIO_c::genMessage(JORMContext* ctx) { + ctx->genCheckBox("デバグ描画ON ", &m.mDebugAdjustON, 1, 0, NULL, -1, -1, 0x200, 0x18); +} +#endif + void dummyString() { DEAD_STRING("Timer"); } diff --git a/src/d/actor/d_a_tag_mstop.cpp b/src/d/actor/d_a_tag_mstop.cpp index c58e6b0935..5094221a06 100644 --- a/src/d/actor/d_a_tag_mstop.cpp +++ b/src/d/actor/d_a_tag_mstop.cpp @@ -14,7 +14,7 @@ int daTagMstop_c::create() { fopAcM_ct(this, daTagMstop_c); - field_0x56b = fopAcM_GetParam(this) >> 16; + field_0x56b = (fopAcM_GetParam(this) >> 16) & 0xFF; field_0x56a = (fopAcM_GetParam(this) >> 24) & 0xF; if (field_0x56a == 1 || field_0x56a == 2) { @@ -40,23 +40,17 @@ int daTagMstop_c::create() { field_0x572 = 0xFFFF; } - f32 tmp = scale.x; - tmp *= 10000.0f * scale.x; - - field_0x5c0 = tmp; + field_0x5c0 = scale.x * (scale.x * 10000.0f); field_0x5c4 = current.pos.y + scale.y * 100.0f; + u16 param = fopAcM_GetParam(this); csXyz pos_angle; - - daNpcF_getPlayerInfoFromPlayerList(fopAcM_GetParam(this) & 0xFFFF, fopAcM_GetRoomNo(this), - field_0x5c8, pos_angle); - - u8 idx = field_0x56b; + daNpcF_getPlayerInfoFromPlayerList(param, fopAcM_GetRoomNo(this), field_0x5c8, pos_angle); if (!checkNoAttention()) { - s32 room = fopAcM_GetRoomNo(this); - stage_arrow_data_class* arrowData = &dComIfGp_getRoomArrow(room) - ->m_entries[dComIfGp_getRoomCamera(room)->m_entries[idx].m_arrow_idx]; + stage_arrow_data_class* arrowData = &dComIfGp_getRoomArrow(fopAcM_GetRoomNo(this))-> + m_entries[dComIfGp_getRoomCamera(fopAcM_GetRoomNo(this))-> + m_entries[field_0x56b].m_arrow_idx]; eyePos.set(arrowData->posX, arrowData->posY, arrowData->posZ); attention_info.position = eyePos; @@ -67,12 +61,15 @@ int daTagMstop_c::create() { } static int daTagMstop_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagMstop_c* mstop = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return mstop->create(); } daTagMstop_c::~daTagMstop_c() {} static int daTagMstop_Delete(daTagMstop_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagMstop_c(); return 1; } diff --git a/src/d/actor/d_a_tag_mwait.cpp b/src/d/actor/d_a_tag_mwait.cpp index fcb85b51ee..198c2e9fdb 100644 --- a/src/d/actor/d_a_tag_mwait.cpp +++ b/src/d/actor/d_a_tag_mwait.cpp @@ -12,7 +12,7 @@ int daTagMwait_c::create() { fopAcM_ct(this, daTagMwait_c); - mEnterSw = fopAcM_GetParam(this) >> 8; + mEnterSw = (fopAcM_GetParam(this) >> 8) & 0xFF; if (fopAcM_isSwitch(this, mEnterSw)) { return cPhs_ERROR_e; @@ -39,12 +39,12 @@ int daTagMwait_c::create() { scale *= 100.0f; - u32 wait_y_offset = (fopAcM_GetParam(this) >> 0x18) & 0xFF; - if (wait_y_offset == 0 || wait_y_offset == 0xFF) { - wait_y_offset = 0; + prm = (fopAcM_GetParam(this) >> 0x18) & 0xFF; // wait Y offset + if (prm == 0 || prm == 0xFF) { + prm = 0; } - mWaitPosition.set(current.pos.x, current.pos.y + (wait_y_offset * 10.0f), current.pos.z); + mWaitPosition.set(current.pos.x, current.pos.y + (prm * 10.0f), current.pos.z); attention_info.position.set(mWaitPosition.x, mWaitPosition.y + 220.0f, mWaitPosition.z); eyePos.set(mWaitPosition.x, mWaitPosition.y + 150.0f, mWaitPosition.z); @@ -54,12 +54,15 @@ int daTagMwait_c::create() { } static int daTagMwait_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagMwait_c* mWait = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return mWait->create(); } daTagMwait_c::~daTagMwait_c() {} static int daTagMwait_Delete(daTagMwait_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagMwait_c(); return 1; } diff --git a/src/d/actor/d_a_tag_myna2.cpp b/src/d/actor/d_a_tag_myna2.cpp index fd84d698e2..1c048d20af 100644 --- a/src/d/actor/d_a_tag_myna2.cpp +++ b/src/d/actor/d_a_tag_myna2.cpp @@ -5,6 +5,7 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep +#include "d/actor/d_a_player.h" #include "d/actor/d_a_tag_myna2.h" #include "d/d_procname.h" @@ -17,27 +18,25 @@ s32 daTagMyna2_c::create() { } s32 daTagMyna2_c::execute() { - if (!dComIfGp_event_runCheck()) { - if (!dComIfGs_isSwitch(mSwitchNo,fopAcM_GetRoomNo(this))) { - if ((dComIfGp_getPlayer(0)->current.pos - current.pos).absXZ() < getExtent()) { - s16 angle_y = (s16)fopAcM_searchPlayerAngleY(this); - csXyz actor_angle(0x1e,angle_y,0); - cXyz actor_pos = current.pos; - actor_pos.y += 1000.0f; + if (!dComIfGp_event_runCheck() && + !dComIfGs_isSwitch(mSwitchNo,fopAcM_GetRoomNo(this)) && + (daPy_getPlayerActorClass()->current.pos - current.pos).absXZ() < getExtent()) { + csXyz actor_angle(30, (s16)fopAcM_searchPlayerAngleY(this), 0); + cXyz actor_pos = current.pos; + actor_pos.y += 1000.0f; - if (fopAcM_gc_c::gndCheck(&actor_pos) != 0) { - actor_pos.y = fopAcM_gc_c::getGroundY(); - } else { - actor_pos = current.pos; - } + if (fopAcM_gc_c::gndCheck(&actor_pos) != 0) { + actor_pos.y = fopAcM_gc_c::getGroundY(); + } else { + actor_pos = current.pos; + } - if (mTimer == 0) { - s32 actor_create = fopAcM_create(PROC_MYNA2, (mSwitchNo << 8 | 0xffff0001), &actor_pos, fopAcM_GetRoomNo(this), &actor_angle, 0, 0xffffffff); - - if (actor_create != 0xFFFFFFFF) { - dComIfGs_onSwitch(mSwitchNo,fopAcM_GetRoomNo(this)); - } - } + u32 var_r29 = 0xffff0001; + if (mTimer == 0) { + if (fopAcM_create(PROC_MYNA2, var_r29 | mSwitchNo << 8, &actor_pos, + fopAcM_GetRoomNo(this), &actor_angle, 0, -1) + != fpcM_ERROR_PROCESS_ID_e) { + dComIfGs_onSwitch(mSwitchNo,fopAcM_GetRoomNo(this)); } } } @@ -52,7 +51,9 @@ s32 daTagMyna2_c::execute() { } static s32 daTagMyna2_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagMyna2_c* myna2 = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return myna2->create(); } static s32 daTagMyna2_Execute(daTagMyna2_c* i_this) { @@ -60,6 +61,7 @@ static s32 daTagMyna2_Execute(daTagMyna2_c* i_this) { } static s32 daTagMyna2_Delete(daTagMyna2_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagMyna2_c(); return 1; } diff --git a/src/d/actor/d_a_tag_myna_light.cpp b/src/d/actor/d_a_tag_myna_light.cpp index 11ab9df604..e4748364f9 100644 --- a/src/d/actor/d_a_tag_myna_light.cpp +++ b/src/d/actor/d_a_tag_myna_light.cpp @@ -25,18 +25,15 @@ int daTag_MynaLight_c::Delete() { } int daTag_MynaLight_c::Execute() { - u8 uVar1 = (int)(dComIfGs_getTime() * 0.06666667f) & 0xFF; - u8 turn_on_time = getTurnOnTime() & 0xFF; - u8 turn_off_time = getTurnOffTime() & 0xFF; - - if (turn_off_time > turn_on_time) { - if (uVar1 >= (getTurnOnTime() & 0xFF) && uVar1 < (getTurnOffTime() & 0xFF)) { + u8 var_r30 = (int)(dComIfGs_getTime() * 0.06666667f); + if (getTurnOffTime() > getTurnOnTime()) { + if (var_r30 >= getTurnOnTime() && var_r30 < getTurnOffTime()) { field_0x578 = true; } else { field_0x578 = false; } } else { - if (uVar1 >= (getTurnOffTime() & 0xFF) && uVar1 < (getTurnOnTime() & 0xFF)) { + if (var_r30 >= getTurnOffTime() && var_r30 < getTurnOnTime()) { field_0x578 = false; } else { field_0x578 = true; @@ -45,10 +42,10 @@ int daTag_MynaLight_c::Execute() { if (mTurnOnFlag) { if (dComIfGp_roomControl_getStayNo() != 0) { - mDoAud_seStartLevel(Z2SE_OBJ_MYNA_LIGHT_BURNING, (Vec*)¤t.pos, 0, - dComIfGp_getReverb(dComIfGp_roomControl_getStayNo())); + mDoAud_seStartLevel(Z2SE_OBJ_MYNA_LIGHT_BURNING, ¤t.pos, 0, + dComIfGp_getReverb(dComIfGp_roomControl_getStayNo())); } else { - mDoAud_seStartLevel(Z2SE_OBJ_MYNA_LIGHT_BURNING, (Vec*)¤t.pos, 0, 0); + mDoAud_seStartLevel(Z2SE_OBJ_MYNA_LIGHT_BURNING, ¤t.pos, 0, 0); } } return 1; @@ -110,12 +107,14 @@ bool daTag_MynaLight_c::setTurnOnOffChange() { return mTurnOnFlag; } -u32 daTag_MynaLight_c::getTurnOnTime() { - return fopAcM_GetParamBit(this, 0, 5); +u8 daTag_MynaLight_c::getTurnOnTime() { + u8 param = fopAcM_GetParam(this) & 0x1F; + return param; } -u32 daTag_MynaLight_c::getTurnOffTime() { - return fopAcM_GetParamBit(this, 5, 5); +u8 daTag_MynaLight_c::getTurnOffTime() { + u8 param = (fopAcM_GetParam(this) & 0x3E0) >> 5; + return param; } void daTag_MynaLight_c::initialize() { diff --git a/src/d/actor/d_a_tag_pachi.cpp b/src/d/actor/d_a_tag_pachi.cpp index eaa18e2fd4..949ffd6902 100644 --- a/src/d/actor/d_a_tag_pachi.cpp +++ b/src/d/actor/d_a_tag_pachi.cpp @@ -3,6 +3,7 @@ #include "d/actor/d_a_tag_pachi.h" #include "d/d_com_inf_game.h" #include "d/d_procname.h" +#include "d/d_s_play.h" daTagPati_c::~daTagPati_c() {} @@ -24,6 +25,7 @@ static dCcD_SrcCyl const l_sph_src = { int daTagPati_c::create() { fopAcM_ct(this, daTagPati_c); + OS_REPORT("-------------- TAG YAMI CREATE!!\n"); field_0x6E0 = get_prm(); mStts.Init(0xFF, 0xFF, this); mCyl.Set(l_sph_src); @@ -39,25 +41,41 @@ int daTagPati_c::Execute() { } void daTagPati_c::col_set() { - mCyl.SetR(1350.f); + f32 var_f31 = 1350.f; + if (field_0x6E0 == 0 || field_0x6E0 == 1) { + var_f31 += tREG_F(18); + } else if (field_0x6E0 == 2 || field_0x6E0 == 3) { + var_f31 += tREG_F(19); + } + mCyl.SetR(var_f31); mCyl.SetH(300000.0f); mCyl.SetC(home.pos); dComIfG_Ccsp()->Set(&mCyl); } u32 daTagPati_c::chk_CoHit() { - return mCyl.ChkCoHit() ? 1 : 0; + if (mCyl.ChkCoHit()) { + OS_REPORT("----mtype = %d\n", field_0x6E0); + return 1; + } else { + return 0; + } } static int daTagPati_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagPati_c* pati = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return pati->create(); } static int daTagPati_Execute(fopAc_ac_c* i_this) { - return static_cast(i_this)->Execute(); + daTagPati_c* pati = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return pati->Execute(); } static int daTagPati_Delete(daTagPati_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagPati_c(); return 1; } diff --git a/src/d/actor/d_a_tag_poFire.cpp b/src/d/actor/d_a_tag_poFire.cpp index 5cbdb87a5a..6c1d8cdc05 100644 --- a/src/d/actor/d_a_tag_poFire.cpp +++ b/src/d/actor/d_a_tag_poFire.cpp @@ -12,6 +12,12 @@ daTagPoFire_HIO_c::daTagPoFire_HIO_c() { unk_0x4 = 0x14; } +#if DEBUG +void daTagPoFire_HIO_c::genMessage(JORMContext* ctx) { + // empty function +} +#endif + void daTagPoFire_c::setBaseMtx() { mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z); @@ -48,11 +54,14 @@ static int daTagPoFire_Execute(daTagPoFire_c* i_this) { } static int daTagPoFire_Delete(daTagPoFire_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->Delete(); } static int daTagPoFire_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagPoFire_c* poFire = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return poFire->create(); } daTagPoFire_HIO_c::~daTagPoFire_HIO_c() {} diff --git a/src/d/actor/d_a_tag_push.cpp b/src/d/actor/d_a_tag_push.cpp index a6bed6cfa4..a45670ac84 100644 --- a/src/d/actor/d_a_tag_push.cpp +++ b/src/d/actor/d_a_tag_push.cpp @@ -5,52 +5,60 @@ #include "d/d_procname.h" void* daTag_Push_c::srchActor(void* param_0, void* param_1) { + daTag_Push_c* push = (daTag_Push_c*)param_0; BOOL bVar1 = false; - if (param_0 != NULL && fopAcM_IsActor(param_0)) { + if (push != NULL && fopAcM_IsActor(push)) { if (fopAcM_IsExecuting(fopAcM_GetID(param_0))) { - switch (((daTag_Push_c*)param_1)->getId()) { + int id = ((daTag_Push_c*)param_1)->getId(); + switch (id) { case 1: - bVar1 = fopAcM_GetName(param_0) == PROC_NPC_TARO; + bVar1 = fopAcM_GetName(push) == PROC_NPC_TARO; break; case 2: - bVar1 = fopAcM_GetName(param_0) == PROC_NPC_JAGAR; + bVar1 = fopAcM_GetName(push) == PROC_NPC_JAGAR; break; case 3: - bVar1 = fopAcM_GetName(param_0) == PROC_NPC_LEN; + bVar1 = fopAcM_GetName(push) == PROC_NPC_LEN; break; case 4: - bVar1 = fopAcM_GetName(param_0) == PROC_NPC_TARO; + bVar1 = fopAcM_GetName(push) == PROC_NPC_TARO; break; case 5: - bVar1 = fopAcM_GetName(param_0) == PROC_NPC_MARO; + bVar1 = fopAcM_GetName(push) == PROC_NPC_MARO; break; case 6: - bVar1 = fopAcM_GetName(param_0) == PROC_NPC_BESU; + bVar1 = fopAcM_GetName(push) == PROC_NPC_BESU; break; case 7: - bVar1 = fopAcM_GetName(param_0) == PROC_NPC_BOU; + bVar1 = fopAcM_GetName(push) == PROC_NPC_BOU; break; case 8: - bVar1 = fopAcM_GetName(param_0) == PROC_NPC_GRS; + bVar1 = fopAcM_GetName(push) == PROC_NPC_GRS; break; case 9: - bVar1 = fopAcM_GetName(param_0) == PROC_NPC_GRO; + bVar1 = fopAcM_GetName(push) == PROC_NPC_GRO; break; } } } if (!bVar1) { - param_0 = NULL; + push = NULL; } - return param_0; + return push; } int daTag_Push_c::create() { + int var_r29 = 0; fopAcM_ct(this, daTag_Push_c); scale.x *= 100.0f; scale.y *= 100.0f; scale.z = scale.x; + + OS_REPORT("\t(%s:%d) PlayerNo:%d, BitSW:%02x, BitSW2:%02x, flowNo:%d<%08x>\n", + fopAcM_getProcNameString(this), getId(), getPlayerListNo(), getBitSW(), getBitSW2(), + getFlowNodeNo(), fopAcM_GetParam(this)); + if (isDelete()) { return cPhs_ERROR_e; } else { diff --git a/src/d/actor/d_a_tag_qs.cpp b/src/d/actor/d_a_tag_qs.cpp index 780e338a6e..b1e8204bdf 100644 --- a/src/d/actor/d_a_tag_qs.cpp +++ b/src/d/actor/d_a_tag_qs.cpp @@ -4,14 +4,134 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep -#include "d/actor/d_a_tag_qs.h" +#include "SSystem/SComponent/c_math.h" #include "d/actor/d_a_obj_carry.h" #include "d/actor/d_a_player.h" -#include "d/d_cc_d.h" +#include "d/actor/d_a_tag_qs.h" #include "d/d_a_item_static.h" -#include "d/d_save.h" +#include "d/d_cc_d.h" #include "d/d_com_inf_game.h" -#include "SSystem/SComponent/c_math.h" +#include "d/d_debug_viewer.h" +#include "d/d_save.h" + +class daObjTagQs_HIO_c : public mDoHIO_entry_c { +public: + daObjTagQs_HIO_c(); + + void genMessage(JORMContext*); + + /* 0x08 */ f32 powerOutsideRadius; + /* 0x0C */ f32 safeArea; + /* 0x10 */ f32 powerInsideRadius; + /* 0x14 */ f32 powerCenter; + /* 0x18 */ f32 sinkholePowerOutsideRadius; + /* 0x1C */ f32 sinkholeSafeArea; + /* 0x20 */ f32 sinkholePowerInsideRadius; + /* 0x24 */ f32 sinkholePowerCenter; + /* 0x28 */ s16 startMorfFrame; + /* 0x2A */ s16 stopMorfFrame; + /* 0x2C */ f32 centralSinkSpeed; + /* 0x30 */ u16 flags; +}; + +#if DEBUG +daObjTagQs_HIO_c l_HIO; +#endif + +#define TAG_QS_DEF_POWER_OUTSIDE_RADIUS 4.0f +#define TAG_QS_DEF_SAFE_AREA 0.8f +#define TAG_QS_DEF_POWER_INSIDE_RADIUS 6.0f +#define TAG_QS_DEF_POWER_CENTER 12.0f +#define TAG_QS_DEF_SINKHOLE_POWER_OUTSIDE_RADIUS 5.0f +#define TAG_QS_DEF_SINKHOLE_SAFE_AREA 0.5f +#define TAG_QS_DEF_SINKHOLE_POWER_INSIDE_RADIUS 10.0f +#define TAG_QS_DEF_SINKHOLE_POWER_CENTER 20.0f +#define TAG_QS_DEF_START_MORF_FRAME 30 +#define TAG_QS_DEF_STOP_MORF_FRAME 30 +#define TAG_QS_DEF_CENTRAL_SINK_SPEED 0.5f +#define TAG_QS_DEF_FLAGS 0 + +#if DEBUG +#define TAG_QS_POWER_OUTSIDE_RADIUS l_HIO.powerOutsideRadius +#define TAG_QS_SAFE_AREA l_HIO.safeArea +#define TAG_QS_POWER_INSIDE_RADIUS l_HIO.powerInsideRadius +#define TAG_QS_POWER_CENTER l_HIO.powerCenter +#define TAG_QS_SINKHOLE_POWER_OUTSIDE_RADIUS l_HIO.sinkholePowerOutsideRadius +#define TAG_QS_SINKHOLE_SAFE_AREA l_HIO.sinkholeSafeArea +#define TAG_QS_SINKHOLE_POWER_INSIDE_RADIUS l_HIO.sinkholePowerInsideRadius +#define TAG_QS_SINKHOLE_POWER_CENTER l_HIO.sinkholePowerCenter +#define TAG_QS_START_MORF_FRAME l_HIO.startMorfFrame +#define TAG_QS_STOP_MORF_FRAME l_HIO.stopMorfFrame +#define TAG_QS_CENTRAL_SINK_SPEED l_HIO.centralSinkSpeed +#define TAG_QS_FLAGS l_HIO.flags +#else +#define TAG_QS_POWER_OUTSIDE_RADIUS TAG_QS_DEF_POWER_OUTSIDE_RADIUS +#define TAG_QS_SAFE_AREA TAG_QS_DEF_SAFE_AREA +#define TAG_QS_POWER_INSIDE_RADIUS TAG_QS_DEF_POWER_INSIDE_RADIUS +#define TAG_QS_POWER_CENTER TAG_QS_DEF_POWER_CENTER +#define TAG_QS_SINKHOLE_POWER_OUTSIDE_RADIUS TAG_QS_DEF_SINKHOLE_POWER_OUTSIDE_RADIUS +#define TAG_QS_SINKHOLE_SAFE_AREA TAG_QS_DEF_SINKHOLE_SAFE_AREA +#define TAG_QS_SINKHOLE_POWER_INSIDE_RADIUS TAG_QS_DEF_SINKHOLE_POWER_INSIDE_RADIUS +#define TAG_QS_SINKHOLE_POWER_CENTER TAG_QS_DEF_SINKHOLE_POWER_CENTER +#define TAG_QS_START_MORF_FRAME TAG_QS_DEF_START_MORF_FRAME +#define TAG_QS_STOP_MORF_FRAME TAG_QS_DEF_STOP_MORF_FRAME +#define TAG_QS_CENTRAL_SINK_SPEED TAG_QS_DEF_CENTRAL_SINK_SPEED +#define TAG_QS_FLAGS TAG_QS_DEF_FLAGS +#endif + +#if DEBUG +daObjTagQs_HIO_c::daObjTagQs_HIO_c() { + powerOutsideRadius = TAG_QS_DEF_POWER_OUTSIDE_RADIUS; + safeArea = TAG_QS_DEF_SAFE_AREA; + powerInsideRadius = TAG_QS_DEF_POWER_INSIDE_RADIUS; + powerCenter = TAG_QS_DEF_POWER_CENTER; + sinkholePowerOutsideRadius = TAG_QS_DEF_SINKHOLE_POWER_OUTSIDE_RADIUS; + sinkholeSafeArea = TAG_QS_DEF_SINKHOLE_SAFE_AREA; + sinkholePowerInsideRadius = TAG_QS_DEF_SINKHOLE_POWER_INSIDE_RADIUS; + sinkholePowerCenter = TAG_QS_DEF_SINKHOLE_POWER_CENTER; + startMorfFrame = TAG_QS_DEF_START_MORF_FRAME; + stopMorfFrame = TAG_QS_DEF_STOP_MORF_FRAME; + flags = TAG_QS_DEF_FLAGS; + centralSinkSpeed = TAG_QS_DEF_CENTRAL_SINK_SPEED; +} + +void daObjTagQs_HIO_c::genMessage(JORMContext* ctx) { + // "Quicksand" + ctx->genLabel("流砂", 0); + // "Power (outside safety radius)" + ctx->genSlider("パワー(安全半径外)", &powerOutsideRadius, 0.0f, 100.0f); + // "Safety radius adjust" + ctx->genSlider("安全半径変更", &safeArea, 0.0f, 1.0f); + // "Power (inside safety radius)" + ctx->genSlider("パワー(安全半径)", &powerInsideRadius, 0.0f, 100.0f); + // "Power (center)" + ctx->genSlider("パワー(中心)", &powerCenter, 0.0f, 100.0f); + + // "Quicksand (10x)" (sinkhole?) + ctx->genLabel("流砂(10倍)", 0); + // "Power (outside safety radius)" + ctx->genSlider("パワー(安全半径外)", &sinkholePowerOutsideRadius, 0.0f, 100.0f); + // "Safety radius adjust" + ctx->genSlider("安全半径変更", &sinkholeSafeArea, 0.0f, 1.0f); + // "Power (inside safety radius)" + ctx->genSlider("パワー(安全半径)", &sinkholePowerInsideRadius, 0.0f, 100.0f); + // "Power (center)" + ctx->genSlider("パワー(中心)", &sinkholePowerCenter, 0.0f, 100.0f); + + // "Others" + ctx->genLabel("その他", 0); + // "Start interpolation frame" + ctx->genSlider("スタート補間フレーム", &startMorfFrame, 0, 120); + // "Stop interpolation frame" + ctx->genSlider("ストップ補間フレーム", &stopMorfFrame, 0, 120); + // "Draw" + ctx->genCheckBox("描画", &flags, 0x1); + // "Stop" + ctx->genCheckBox("停止", &flags, 0x2); + // "Central sink speed" + ctx->genSlider("中心沈み速度", ¢ralSinkSpeed, 0.0f, 10.0f); +} +#endif static dCcD_SrcCyl l_cc_cyl_src = { { @@ -33,6 +153,12 @@ daTagQs_c::~daTagQs_c() {} int daTagQs_c::create() { fopAcM_ct(this, daTagQs_c); + +#if DEBUG + // "Quicksand" + l_HIO.entryHIO("流砂"); +#endif + f32 typeScale; if (getType() == 0) { typeScale = 1.0f; @@ -50,137 +176,170 @@ int daTagQs_c::create() { } f32 daTagQs_c::getPower() { - return getType() == 0 ? 4.0f : 5.0f; + if (getType() == 0) { + return TAG_QS_POWER_OUTSIDE_RADIUS; + } else { + return TAG_QS_SINKHOLE_POWER_OUTSIDE_RADIUS; + } } f32 daTagQs_c::getSafeArea() { - return getType() == 0 ? 0.8f : 0.5f; + if (getType() == 0) { + return TAG_QS_SAFE_AREA; + } else { + return TAG_QS_SINKHOLE_SAFE_AREA; + } } f32 daTagQs_c::getPower80() { - return getType() == 0 ? 6.0f : 10.0f; + if (getType() == 0) { + return TAG_QS_POWER_INSIDE_RADIUS; + } else { + return TAG_QS_SINKHOLE_POWER_INSIDE_RADIUS; + } } f32 daTagQs_c::getCenterPower() { - return getType() == 0 ? 12.0f : 20.0f; + if (getType() == 0) { + return TAG_QS_POWER_CENTER; + } else { + return TAG_QS_SINKHOLE_POWER_CENTER; + } } f32 daTagQs_c::calcPower(f32 param_1, f32 param_2) { f32 dVar12 = 1.0f; if (getSwNo() != 0xff) { if (fopAcM_isSwitch(this, getSwNo())) { - dVar12 = field_0x570 / 30.0f; + dVar12 = field_0x570 / (f32)TAG_QS_START_MORF_FRAME; } else { - dVar12 = (30 - field_0x574) / 30.0f; + dVar12 = (TAG_QS_STOP_MORF_FRAME - field_0x574) / (f32)TAG_QS_STOP_MORF_FRAME; } } - if (param_2 > (param_1 * 0.8f)) { + if (param_2 > param_1 * TAG_QS_SAFE_AREA) { return dVar12 * getPower(); } return dVar12 * - ((1.0f - (param_2 / (param_1 * getSafeArea()))) * (getCenterPower() - getPower80()) + + ((1.0f - param_2 / (param_1 * getSafeArea())) * (getCenterPower() - getPower80()) + getPower80()); } static int hikiyose(cXyz* param_1, cXyz* param_2, cXyz* param_3, f32 param_4) { - cXyz cStack_44 = *param_1 - *param_2; - cXyz cStack_50(cStack_44); - cStack_50.y = 0.0f; - f32 dVar6 = fabsf(cStack_50.getSquareMag()); - if (dVar6 < 4.0f) { + cXyz posDiff; + posDiff = *param_1 - *param_2; + cXyz posDiffLat(posDiff); + posDiffLat.y = 0.0f; + f32 dist; + if (fabsf(posDiffLat.getSquareMag()) < 4.0f) { param_2->x = param_1->x + cM_rndFX(1.0f); - param_2->y -= 0.5f; + param_2->y -= TAG_QS_CENTRAL_SINK_SPEED; param_2->z = param_1->z + cM_rndFX(1.0f); param_3->y = param_2->y; if (param_2->y < param_1->y - 100.0f) { return 2; } return 1; - } else if (cStack_44.abs() < param_4) { - param_2->x = param_1->x; - param_2->y = param_1->y; - param_2->z = param_1->z; } else { - cStack_44.normalize(); - cStack_44 *= param_4; - *param_2 += cStack_44; + dist = posDiff.abs(); + if (dist < param_4) { + param_2->x = param_1->x; + param_2->y = param_1->y; + param_2->z = param_1->z; + } else { + posDiff.normalize(); + posDiff *= param_4; + *param_2 += posDiff; + } } return 0; } static void* search(void* param_1, void* param_2) { + UNUSED(param_2); + if (param_1 == NULL || !fopAcM_IsActor(param_1)) { return NULL; } - fopAc_ac_c* actor1 = (fopAc_ac_c*) param_1; - daTagQs_c* actor2 = (daTagQs_c*) param_2; - f32 dVar9 = actor2->current.pos.absXZ(actor1->current.pos); - if (dVar9 > actor2->field_0x568) { + + daTagQs_c* qs = (daTagQs_c*)param_2; + fopAc_ac_c* target = (fopAc_ac_c*)param_1; + + f32 latDist = qs->current.pos.absXZ(target->current.pos); + if (latDist > qs->field_0x568) { return NULL; } - if (actor2->current.pos.y - 110.0f > actor1->current.pos.y || - actor2->current.pos.y + actor2->field_0x56c < actor1->current.pos.y) + + if (qs->current.pos.y - 110.0f > target->current.pos.y || + qs->current.pos.y + qs->field_0x56c < target->current.pos.y) { return NULL; } - if (actor1->current.pos.y > - actor2->current.pos.y + (actor2->field_0x56c * dVar9) / (actor2->field_0x568 * 0.9f) + 20.0f) + + if (target->current.pos.y > + qs->current.pos.y + qs->field_0x56c * latDist / (qs->field_0x568 * 0.9f) + 20.0f) { return NULL; } + if (fopAcM_GetProfName(param_1) == PROC_ITEM) { - daItem_c* item = (daItem_c*)param_1; - item->getItemNo(); - if (item->getItemNo() <= 3) { - int iVar3 = hikiyose(&actor2->current.pos, &actor1->current.pos, &actor1->old.pos, - actor2->calcPower(actor2->field_0x568, dVar9)); - if (iVar3 == 1) { + daItem_c* item = (daItem_c*)target; + // somehow this condition is supposed to produce a double `li r0, 0x1` instruction, + // this only produces one and is likely a fakematch anyway + if (((u8)item->getItemNo(), true) && item->getItemNo() <= 3) { + int sp14 = hikiyose(&qs->current.pos, &item->current.pos, &item->old.pos, + qs->calcPower(qs->field_0x568, latDist)); + if (sp14 == 1) { item->startCtrl(); - } else if (iVar3 == 2) { - fopAcM_delete(actor1); + } else if (sp14 == 2) { + fopAcM_delete(item); } } return NULL; } + if (fopAcM_GetProfName(param_1) == PROC_Obj_Carry) { - daObjCarry_c* carry = (daObjCarry_c*)param_1; + daObjCarry_c* carry = (daObjCarry_c*)target; if (carry->getType() == 7 || carry->getType() == 1 || carry->getType() == 5) { - int iVar3 = hikiyose(&actor2->current.pos, &carry->current.pos, &carry->old.pos, actor2->calcPower(actor2->field_0x568, dVar9)); - if (iVar3 == 1) { + int sp10 = hikiyose(&qs->current.pos, &carry->current.pos, &carry->old.pos, + qs->calcPower(qs->field_0x568, latDist)); + if (sp10 == 1) { carry->startCtrl(); - } else if (iVar3 == 2) { + } else if (sp10 == 2) { fopAcM_delete(carry); } } return NULL; } + if (param_1 == daPy_getPlayerActorClass()) { daPy_py_c* player = daPy_getPlayerActorClass(); - cXyz local_58 = actor2->current.pos - player->current.pos; - if (local_58.getSquareMag() >= actor2->getPower()) { - s16 sVar6 = cM_atan2s(local_58.x, local_58.z); + cXyz posDiff = qs->current.pos - player->current.pos; + if (posDiff.getSquareMag() >= qs->getPower()) { + s16 yaw = cM_atan2s(posDiff.x, posDiff.z); if (!player->checkPlayerFly()) { - player->setOutPower(actor2->calcPower(actor2->field_0x568, dVar9), sVar6, 0); + player->setOutPower(qs->calcPower(qs->field_0x568, latDist), yaw, 0); } } return NULL; } - + return NULL; } int daTagQs_c::execute() { - fopAcM_Search(search, this); + if ((TAG_QS_FLAGS & 0x2) == 0) { + fopAcM_Search(search, this); + } if (getSwNo() != 0xff) { - int bossLife; + int bossLife = 0; if (fopAcM_isSwitch(this, getSwNo())) { field_0x570++; - if (field_0x570 > 30) { - field_0x570 = 30; + if (field_0x570 > TAG_QS_START_MORF_FRAME) { + field_0x570 = TAG_QS_START_MORF_FRAME; } field_0x574 = 0; - bossLife = (field_0x570 * 100.0f) / 30.0f; + bossLife = (field_0x570 * 100.0f) / (f32)TAG_QS_START_MORF_FRAME; if (getType() == 0) { Z2GetAudioMgr()->seStartLevel(Z2SE_ENV_QUICKSAND_LOOP, ¤t.pos, 0, dComIfGp_getReverb(fopAcM_GetRoomNo(this)), 1.0f, @@ -188,11 +347,11 @@ int daTagQs_c::execute() { } } else { field_0x574++; - if (field_0x574 > 30) { - field_0x574 = 30; + if (field_0x574 > TAG_QS_STOP_MORF_FRAME) { + field_0x574 = TAG_QS_STOP_MORF_FRAME; } field_0x570 = 0; - bossLife = 100.0f - field_0x574 * 100.0f / 30.0f; + bossLife = 100.0f - field_0x574 * 100.0f / (f32)TAG_QS_STOP_MORF_FRAME; } dComIfGs_BossLife_public_Set(bossLife); } else { @@ -206,6 +365,15 @@ int daTagQs_c::execute() { } int daTagQs_c::draw() { + if (TAG_QS_FLAGS & 0x1) { + GXColor color; + color.r = 0xff; + color.g = 0; + color.b = 0xff; + color.a = 0x80; + dDbVw_drawCylinderXlu(current.pos, field_0x568, field_0x56c, color, 1); + } + return 1; } @@ -218,6 +386,10 @@ static int daTagQs_Execute(daTagQs_c* i_this) { } static int daTagQs_IsDelete(daTagQs_c* i_this) { + UNUSED(i_this); +#if DEBUG + l_HIO.removeHIO(); +#endif return 1; } @@ -227,7 +399,8 @@ static int daTagQs_Delete(daTagQs_c* i_this) { } static int daTagQs_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagQs_c* qs = static_cast(i_this); + return qs->create(); } static actor_method_class l_daTagQs_Method = { diff --git a/src/d/actor/d_a_tag_ret_room.cpp b/src/d/actor/d_a_tag_ret_room.cpp index f22cbd4f55..7e7a411236 100644 --- a/src/d/actor/d_a_tag_ret_room.cpp +++ b/src/d/actor/d_a_tag_ret_room.cpp @@ -6,7 +6,44 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_tag_ret_room.h" + #include "d/actor/d_a_player.h" +#include "d/d_debug_viewer.h" + +class daTagRetRm_HIO_c : public mDoHIO_entry_c { +public: + daTagRetRm_HIO_c(); + + void genMessage(JORMContext*); + + void setScale(const cXyz& i_scale) { scale = i_scale; }; + + cXyz scale; + u8 showTag; +}; + +#if DEBUG +daTagRetRm_HIO_c l_TAG_RET_ROOM_HIO; +#endif + +daTagRetRm_HIO_c::daTagRetRm_HIO_c() { + // empty function +} + +#if DEBUG +void daTagRetRm_HIO_c::genMessage(JORMContext* ctx) { + // "Return to room tag" + ctx->genLabel("____________部屋戻しタグ____________", 0); + // "Scale value X" + ctx->genSlider("スケール値X", &scale.x, 0.0f, 25.0f); + // "Scale value Y" + ctx->genSlider("スケール値Y", &scale.y, 0.0f, 25.0f); + // "Scale value Z" + ctx->genSlider("スケール値Z", &scale.z, 0.0f, 25.0f); + // "Display tag ON/OFF" + ctx->genCheckBox("Tag表示ON/OFF", &showTag, TRUE); +} +#endif daTagRetRm_c::daTagRetRm_c() {} @@ -15,14 +52,51 @@ daTagRetRm_c::~daTagRetRm_c() {} int daTagRetRm_c::create() { fopAcM_ct(this, daTagRetRm_c); init(); + +#if DEBUG + // "Room return tag Lv7D" + l_TAG_RET_ROOM_HIO.entryHIO("部屋戻しタグLv7D"); + l_TAG_RET_ROOM_HIO.setScale(scale); + l_TAG_RET_ROOM_HIO.showTag = FALSE; +#endif + return cPhs_COMPLEATE_e; } int daTagRetRm_c::Delete() { +#if DEBUG + l_TAG_RET_ROOM_HIO.removeHIO(); +#endif + return 1; } int daTagRetRm_c::draw() { +#if DEBUG + if (l_TAG_RET_ROOM_HIO.showTag == TRUE) { + GXColor color = {0xff, 0, 0, 0x80}; + cXyz sp10[8]; + + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::YrotM(current.angle.y); + + sp10[0].set(-field_0x56c, 0.0f, -field_0x574); + sp10[1].set(-field_0x56c, 0.0f, field_0x574); + sp10[2].set(field_0x56c, 0.0f, -field_0x574); + sp10[3].set(field_0x56c, 0.0f, field_0x574); + sp10[4].set(-field_0x56c, field_0x570, -field_0x574); + sp10[5].set(-field_0x56c, field_0x570, field_0x574); + sp10[6].set(field_0x56c, field_0x570, -field_0x574); + sp10[7].set(field_0x56c, field_0x570, field_0x574); + + for (int i = 0; i < ARRAY_SIZE(sp10); i++) { + mDoMtx_stack_c::multVec(&sp10[i], &sp10[i]); + } + + dDbVw_drawCube8pXlu(sp10, color); + } +#endif + return 1; } @@ -48,21 +122,21 @@ void daTagRetRm_c::init() { field_0x578 = 0; } -u8 daTagRetRm_c::chkPlyrInTag() { - cXyz pos; - if (dComIfGp_getPlayer(0) == NULL) { - return 0; +bool daTagRetRm_c::chkPlyrInTag() { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + if (player == NULL) { + return false; + } + + cXyz pos = player->current.pos - current.pos; + mDoMtx_stack_c::YrotS(-current.angle.y); + mDoMtx_stack_c::multVec(&pos, &pos); + if (0 < pos.y && field_0x570 > pos.y && field_0x56c > pos.x && field_0x574 > pos.z && + -field_0x56c < pos.x && -field_0x574 < pos.z) + { + return true; } else { - pos = daPy_getPlayerActorClass()->current.pos - current.pos; - mDoMtx_stack_c::YrotS(-current.angle.y); - mDoMtx_stack_c::multVec(&pos, &pos); - if ((0 < pos.y) && (field_0x570 > pos.y) && (field_0x56c > pos.x) && - (field_0x574 > pos.z) && (-field_0x56c < pos.x) && (-field_0x574 < pos.z)) - { - return 1; - } else { - return 0; - } + return false; } } diff --git a/src/d/actor/d_a_tag_river_back.cpp b/src/d/actor/d_a_tag_river_back.cpp index c902f125a7..e361cccbd9 100644 --- a/src/d/actor/d_a_tag_river_back.cpp +++ b/src/d/actor/d_a_tag_river_back.cpp @@ -12,10 +12,14 @@ static char* l_arcName = "RvBack"; static char* l_evName = "RIVER_BACK"; +static char* l_staffName = "rvback"; + int daTagRiverBack_c::Create() { mMapToolID = -1; eventInfo.setArchiveName(l_arcName); - mEventID = dComIfGp_getEventManager().getEventIdx(this, l_evName, -1); + mEventID = (s16)dComIfGp_getEventManager().getEventIdx(this, l_evName, -1); + // "River flow reversal tag: evid<%d>tool<%d>" + OS_REPORT("川流れ戻しタグ:evid<%d>tool<%d>\n", mEventID, mMapToolID); return 1; } @@ -23,8 +27,7 @@ int daTagRiverBack_c::create() { fopAcM_ct(this, daTagRiverBack_c); int phase = dComIfG_resLoad(&mPhase, l_arcName); if (phase == cPhs_COMPLEATE_e) { - int result = Create(); - if (!result) { + if (!Create()) { return cPhs_ERROR_e; } } @@ -32,13 +35,11 @@ int daTagRiverBack_c::create() { } int daTagRiverBack_c::execute() { - u8 swBit = getSwBit(); - if (swBit != 0xFF && fopAcM_isSwitch(this, swBit) != 0) { + if (getSwbit() != 0xFF && fopAcM_isSwitch(this, getSwbit()) != 0) { return 1; } - u8 swBit2 = getSwBit2(); - if (swBit2 != 0xFF && fopAcM_isSwitch(this, swBit2) == 0) { + if (getSwbit2() != 0xFF && fopAcM_isSwitch(this, getSwbit2()) == 0) { return 1; } @@ -47,8 +48,6 @@ int daTagRiverBack_c::execute() { return 1; } -static char* l_staffName = "rvback"; - void daTagRiverBack_c::event_proc_call() { typedef void (daTagRiverBack_c::*actionFunc)(); static actionFunc l_func[] = {&daTagRiverBack_c::actionWait, @@ -59,7 +58,8 @@ void daTagRiverBack_c::event_proc_call() { } void daTagRiverBack_c::actionWait() { - if (dComIfGp_checkPlayerStatus0(0, 0x100000) != 0) { + u32 result = dComIfGp_checkPlayerStatus0(0, 0x100000); + if (result != 0) { mCount = 0; setAction(ACTION_ORDER_EVENT_e); fopAcM_orderOtherEventId(this, mEventID, mMapToolID, 0xFFFF, 0, 1); @@ -72,7 +72,7 @@ void daTagRiverBack_c::actionOrderEvent() { if (eventInfo.checkCommandDemoAccrpt()) { setAction(ACTION_EVENT_e); mStaffID = dComIfGp_evmng_getMyStaffId(l_staffName, NULL, 0); - player->mNoResetFlg0 |= 0x10000; + player->onDemoStreamAccept(); demoProc(); } else { fopAcM_orderOtherEventId(this, mEventID, mMapToolID, 0xFFFF, 0, 1); @@ -82,7 +82,7 @@ void daTagRiverBack_c::actionOrderEvent() { void daTagRiverBack_c::actionEvent() { daPy_py_c* player = daPy_getPlayerActorClass(); - mCount += 1; + mCount += (s16)1; if (dComIfGp_evmng_endCheck(mEventID)) { setAction(ACTION_DEAD_e); dComIfGp_event_reset(); @@ -96,34 +96,35 @@ void daTagRiverBack_c::actionEvent() { void daTagRiverBack_c::actionDead() {} -static char* action_table[] = {"WAIT", "SCENE_CHG"}; - int daTagRiverBack_c::demoProc() { + static char* action_table[] = {"WAIT", "SCENE_CHG"}; + + daPy_py_c* player = daPy_getPlayerActorClass(); int act_id = dComIfGp_evmng_getMyActIdx(mStaffID, action_table, ARRAY_SIZEU(action_table), 0, 0); + int* timer_p; if (dComIfGp_evmng_getIsAddvance(mStaffID)) { switch (act_id) { - case WAIT_e: { - int* timer_p = dComIfGp_evmng_getMyIntegerP(mStaffID, "Timer"); + case WAIT_e: + timer_p = dComIfGp_evmng_getMyIntegerP(mStaffID, "Timer"); if (timer_p == NULL) { mTimer = 1; } else { mTimer = *timer_p; } break; - } case SCENE_CHG_e: mDoAud_seStart(Z2SE_FORCE_BACK, 0, 0, 0); } } switch (act_id) { case WAIT_e: - if ((cLib_calcTimer(&mTimer) & 0xFF) == 0) { + if (cLib_calcTimer(&mTimer) == 0) { dComIfGp_evmng_cutEnd(mStaffID); } break; case SCENE_CHG_e: - dStage_changeScene(fopAcM_GetParamBit(this, 0, 8) & 0xFF, 0.0f, 0, fopAcM_GetRoomNo(this), + dStage_changeScene(getNextSceneNo(), 0.0f, 0, fopAcM_GetRoomNo(this), 0, -1); break; default: @@ -143,10 +144,12 @@ static int daTagRiverBack_Execute(daTagRiverBack_c* i_this) { } static int daTagRiverBack_Delete(daTagRiverBack_c* i_this) { + fopAcM_RegisterDeleteID(i_this, "RiverBack"); return i_this->_delete(); } static int daTagRiverBack_Create(daTagRiverBack_c* i_this) { + fopAcM_RegisterCreateID(i_this, "RiverBack"); return i_this->create(); } diff --git a/src/d/actor/d_a_tag_rmbit_sw.cpp b/src/d/actor/d_a_tag_rmbit_sw.cpp index 5ea0480999..e3def0a333 100644 --- a/src/d/actor/d_a_tag_rmbit_sw.cpp +++ b/src/d/actor/d_a_tag_rmbit_sw.cpp @@ -6,30 +6,112 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_tag_rmbit_sw.h" + +#include "d/d_debug_viewer.h" #include "d/d_procname.h" +class daTagRmbitSw_HIO_c : public mDoHIO_entry_c { +public: + daTagRmbitSw_HIO_c(); + + void setScale(const cXyz& i_scale); + + void genMessage(JORMContext*); + + cXyz scale; + u8 show_tag; +}; + +#if DEBUG +daTagRmbitSw_HIO_c l_RMBIT_HIO; + +daTagRmbitSw_HIO_c::daTagRmbitSw_HIO_c() { + // empty function +} + +void daTagRmbitSw_HIO_c::setScale(const cXyz& i_scale) { + scale = i_scale; +} + +void daTagRmbitSw_HIO_c::genMessage(JORMContext* ctx) { + ctx->genLabel("____________部屋戻しタグ____________", 0); + ctx->genSlider("スケール値X", &scale.x, 0.0f, 25.0f); + ctx->genSlider("スケール値Y", &scale.y, 0.0f, 25.0f); + ctx->genSlider("スケール値Z", &scale.z, 0.0f, 25.0f); + ctx->genCheckBox("Tag表示ON/OFF", &show_tag, 0x1); +} +#endif + daTagRmbitSw_c::daTagRmbitSw_c() {} daTagRmbitSw_c::~daTagRmbitSw_c() {} int daTagRmbitSw_c::create() { fopAcM_ct(this, daTagRmbitSw_c); + init(); + +#if DEBUG + // "Destination room bit change switch" + l_RMBIT_HIO.entryHIO("到達部屋ビット変更スイッチ"); + l_RMBIT_HIO.setScale(scale); + l_RMBIT_HIO.show_tag = FALSE; +#endif + + if (getArg1_RoomNo() == -1) { + JUT_WARN(165, "%s", " VisitedRoomNo == -1 !!!!!\n"); + } + return cPhs_COMPLEATE_e; } int daTagRmbitSw_c::Delete() { +#if DEBUG + l_RMBIT_HIO.removeHIO(); +#endif + return 1; } int daTagRmbitSw_c::draw() { +#if DEBUG + if (l_RMBIT_HIO.show_tag == TRUE) { + GXColor color = {0xff, 0, 0, 0x80}; + cXyz sp10[8]; + + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::YrotM(current.angle.y); + + sp10[0].set(-field_0x56c, 0.0f, -field_0x574); + sp10[1].set(-field_0x56c, 0.0f, field_0x574); + sp10[2].set(field_0x56c, 0.0f, -field_0x574); + sp10[3].set(field_0x56c, 0.0f, field_0x574); + sp10[4].set(-field_0x56c, field_0x570, -field_0x574); + sp10[5].set(-field_0x56c, field_0x570, field_0x574); + sp10[6].set(field_0x56c, field_0x570, -field_0x574); + sp10[7].set(field_0x56c, field_0x570, field_0x574); + + for (int i = 0; i < ARRAY_SIZE(sp10); i++) { + mDoMtx_stack_c::multVec(&sp10[i], &sp10[i]); + } + + dDbVw_drawCube8pXlu(sp10, color); + } +#endif + return 1; } int daTagRmbitSw_c::execute() { +#if DEBUG + field_0x56c = l_RMBIT_HIO.scale.x * 50.0f; + field_0x570 = l_RMBIT_HIO.scale.y * 100.0f; + field_0x574 = l_RMBIT_HIO.scale.z * 50.0f; +#endif + if (chkPlyrInTag()) { if (getArg3_CngBitFlg() == 1) { - if ((s32)getSwBit() == 0xff || fopAcM_isSwitch(this, getSwBit())) { + if (getSwBit() == 0xff || fopAcM_isSwitch(this, getSwBit())) { if (getArg2_CngBitVal() == 1) { if (getArg0_RoomSaveTableNo() == -1) { dComIfGs_onVisitedRoom(getArg1_RoomNo()); @@ -79,22 +161,22 @@ void daTagRmbitSw_c::init() { field_0x574 = scale.z * 50.0f; } -u8 daTagRmbitSw_c::chkPlyrInTag() { +bool daTagRmbitSw_c::chkPlyrInTag() { fopAc_ac_c* fopPos = dComIfGp_getPlayer(0); if (!fopPos) { - return 0; - } else { - cXyz cPos = fopPos->current.pos - current.pos; - mDoMtx_stack_c::YrotS(-current.angle.y); - mDoMtx_stack_c::multVec(&cPos, &cPos); - if ((0.0f < cPos.y) && (field_0x570 > cPos.y) && (field_0x56c > cPos.x) && - (field_0x574 > cPos.z) && (-field_0x56c < cPos.x) && (-field_0x574 < cPos.z)) - { - return 1; - } + return false; } - return 0; + + cXyz cPos = fopPos->current.pos - current.pos; + mDoMtx_stack_c::YrotS(-current.angle.y); + mDoMtx_stack_c::multVec(&cPos, &cPos); + if (0.0f < cPos.y && field_0x570 > cPos.y && field_0x56c > cPos.x && + field_0x574 > cPos.z && -field_0x56c < cPos.x && -field_0x574 < cPos.z) + { + return true; + } + return false; } int daTagRmbitSw_create(daTagRmbitSw_c* i_this) { diff --git a/src/d/actor/d_a_tag_schedule.cpp b/src/d/actor/d_a_tag_schedule.cpp index 8b8df4d1f5..5e567a56f4 100644 --- a/src/d/actor/d_a_tag_schedule.cpp +++ b/src/d/actor/d_a_tag_schedule.cpp @@ -9,10 +9,12 @@ static int daTagSchedule_Create(fopAc_ac_c* i_this) { daTagSchedule_c* schedule_tag = (daTagSchedule_c*)i_this; + int id = fopAcM_GetID(i_this); return schedule_tag->create(); } static int daTagSchedule_Delete(daTagSchedule_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagSchedule_c(); return 1; } diff --git a/src/d/actor/d_a_tag_setBall.cpp b/src/d/actor/d_a_tag_setBall.cpp index 57d7038dec..75ef80c1be 100644 --- a/src/d/actor/d_a_tag_setBall.cpp +++ b/src/d/actor/d_a_tag_setBall.cpp @@ -43,10 +43,12 @@ static int daTagSetBall_Execute(daTagSetBall_c* i_this) { } static int daTagSetBall_Delete(daTagSetBall_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->_delete(); } static int daTagSetBall_Create(daTagSetBall_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->create(); } diff --git a/src/d/actor/d_a_tag_setrestart.cpp b/src/d/actor/d_a_tag_setrestart.cpp index d96fc0ac01..e76afad4ed 100644 --- a/src/d/actor/d_a_tag_setrestart.cpp +++ b/src/d/actor/d_a_tag_setrestart.cpp @@ -8,8 +8,33 @@ #include "d/actor/d_a_tag_setrestart.h" #include "d/d_com_inf_game.h" +#include "d/d_debug_viewer.h" #include "d/d_procname.h" +class daTagRestart_HIO_c : public mDoHIO_entry_c { +public: + daTagRestart_HIO_c(); + + void genMessage(JORMContext*); + + u8 show_range; +}; + +#if DEBUG +daTagRestart_HIO_c l_HIO; + +daTagRestart_HIO_c::daTagRestart_HIO_c() { + show_range = FALSE; +} + +void daTagRestart_HIO_c::genMessage(JORMContext* ctx) { + // "Room return switch tag" + ctx->genLabel("部屋戻し切替タグ", 0); + // "Range display" + ctx->genCheckBox("範囲表示", &show_range, 0x1); +} +#endif + int daTagRestart_c::Create() { field_0x56c[0].x = scale.x * -100.0f; field_0x56c[0].z = scale.z * -100.0f; @@ -23,10 +48,7 @@ int daTagRestart_c::Create() { field_0x56c[3].x = scale.x * -100.0f; field_0x56c[3].z = scale.z * 100.0f; - field_0x56c[3].y = 0.0f; - field_0x56c[2].y = 0.0f; - field_0x56c[1].y = 0.0f; - field_0x56c[0].y = 0.0f; + field_0x56c[0].y = field_0x56c[1].y = field_0x56c[2].y = field_0x56c[3].y = 0.0f; mPlayerRoomNo = -1; return 1; @@ -39,6 +61,11 @@ int daTagRestart_c::create() { return cPhs_ERROR_e; } +#if DEBUG + // "Room return switch tag" + l_HIO.entryHIO("部屋戻し切替タグ"); +#endif + return cPhs_COMPLEATE_e; } @@ -56,6 +83,7 @@ int daTagRestart_c::execute() { int roomNo = dComIfGp_roomControl_getStayNo(); if (roomNo != mPlayerRoomNo) { cXyz pos_offset; + cXyz restart_pos; s16 restart_angle; if (roomNo == daTagRestart_prm::getFRoomNo(this)) { restart_angle = home.angle.y; @@ -68,10 +96,14 @@ int daTagRestart_c::execute() { pos_offset.y += 100.0f; mDoMtx_stack_c::YrotS(home.angle.y); mDoMtx_stack_c::multVec(&pos_offset, &pos_offset); - cXyz restart_pos = current.pos + pos_offset; + restart_pos = current.pos + pos_offset; if (fopAcM_gc_c::gndCheck(&restart_pos)) { restart_pos.y = fopAcM_gc_c::getGroundY(); + } else { + // "There was no floor at the player's restart position!" + OS_REPORT_ERROR("プレイヤー部屋戻し位置に床がありませんでした!\n"); + JUT_ASSERT(304, FALSE); } dComIfGs_setRestartRoom(restart_pos, restart_angle, fopAcM_GetRoomNo(player)); @@ -82,20 +114,63 @@ int daTagRestart_c::execute() { return 1; } -int daTagRestart_c::_delete() { +int daTagRestart_c::draw() { +#if DEBUG + if (l_HIO.show_range) { + GXColor color = {0x80, 0, 0, 0x80}; + cXyz sp10[8]; + + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::YrotM(current.angle.y); + + sp10[0] = field_0x56c[0]; + sp10[1] = field_0x56c[1]; + sp10[2] = field_0x56c[3]; + sp10[3] = field_0x56c[2]; + sp10[4] = field_0x56c[0]; + sp10[5] = field_0x56c[1]; + sp10[6] = field_0x56c[3]; + sp10[7] = field_0x56c[2]; + + for (int i = 0; i < ARRAY_SIZE(sp10); i++) { + mDoMtx_stack_c::multVec(&sp10[i], &sp10[i]); + } + + for (int i = 0; i < 4; i++) { + sp10[i].y += 1000.0f; + } + + dDbVw_drawCube8pXlu(sp10, color); + } +#endif + return 1; } +int daTagRestart_c::_delete() { +#if DEBUG + l_HIO.removeHIO(); +#endif + return 1; +} + +static int daTagRestart_Draw(daTagRestart_c* i_this) { + return i_this->draw(); +} + static int daTagRestart_Execute(daTagRestart_c* i_this) { return i_this->execute(); } static int daTagRestart_Delete(daTagRestart_c* i_this) { + ("Delete -> TagRestart( =%d)\n", fopAcM_GetID(i_this)); return i_this->_delete(); } static int daTagRestart_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagRestart_c* restart = static_cast(i_this); + fopAcM_RegisterCreateID(i_this, "Hasu"); + return restart->create(); } static actor_method_class l_daTagRestart_Method = { @@ -103,7 +178,11 @@ static actor_method_class l_daTagRestart_Method = { (process_method_func)daTagRestart_Delete, (process_method_func)daTagRestart_Execute, (process_method_func)NULL, +#if DEBUG + (process_method_func)daTagRestart_Draw, +#else (process_method_func)NULL, +#endif }; actor_process_profile_definition g_profile_Tag_Restart = { diff --git a/src/d/actor/d_a_tag_shop_item.cpp b/src/d/actor/d_a_tag_shop_item.cpp index a9f0ea9171..0671f06374 100644 --- a/src/d/actor/d_a_tag_shop_item.cpp +++ b/src/d/actor/d_a_tag_shop_item.cpp @@ -47,17 +47,17 @@ int daTag_ShopItem_c::create() { if (getSwitchBit1() != 0xFF) { if (dComIfGs_isSaveSwitch(getSwitchBit1())) { - mCreateTimer = 150; // "Already Sold\n" OS_REPORT("もう売れたよ\n"); + mCreateTimer = 150; } } if (getSwitchBit2() != 0xFF) { if (!dComIfGs_isSaveSwitch(getSwitchBit2())) { - mCreateTimer = 150; // "Not sold yet\n" OS_REPORT("まだ売れない\n"); + mCreateTimer = 150; } } } @@ -79,7 +79,7 @@ int daTag_ShopItem_c::Execute() { if (mProcessID == fpcM_ERROR_PROCESS_ID_e) { if (mCreateTimer == 0) { mProcessID = - fopAcM_create(PROC_ShopItem, (getType() & 0xFF) | (getGroupID() << 0x1C), + fopAcM_create(PROC_ShopItem, getType() | (getGroupID() << 28), ¤t.pos, fopAcM_GetRoomNo(this), ¤t.angle, NULL, -1); } else { @@ -126,19 +126,25 @@ int daTag_ShopItem_c::Draw() { } u8 daTag_ShopItem_c::getType() { - return fopAcM_GetParam(this) & 0xFF; + u8 result = fopAcM_GetParam(this); + return result; } u8 daTag_ShopItem_c::getGroupID() { - return fopAcM_GetParam(this) >> 0x1C; + u8 result = (fopAcM_GetParam(this) & 0xF0000000) >> 28; + return result; } u8 daTag_ShopItem_c::getSwitchBit1() { - return home.angle.z & 0xFF; + u16 angleZ = home.angle.z; + u8 result = angleZ; + return result; } u8 daTag_ShopItem_c::getSwitchBit2() { - return home.angle.z >> 8 & 0xFF; + u16 angleZ = home.angle.z; + u8 result = (angleZ & 0xFF00) >> 8; + return result; } void daTag_ShopItem_c::initialize() { diff --git a/src/d/actor/d_a_tag_smk_emt.cpp b/src/d/actor/d_a_tag_smk_emt.cpp index 035a667e2d..8e91fcb7ca 100644 --- a/src/d/actor/d_a_tag_smk_emt.cpp +++ b/src/d/actor/d_a_tag_smk_emt.cpp @@ -33,19 +33,19 @@ int daTagSmkEmt_c::execute() { return 1; } -static u16 const PARTICLE_NAME[3] = { - 0x87E7, - 0x87E8, - 0x87E9 -}; - void daTagSmkEmt_c::createSmkEmt() { + static u16 const PARTICLE_NAME[3] = { + dPa_RM(ID_ZF_S_L5CHIMSMK00), + dPa_RM(ID_ZF_S_L5CHIMSMK01), + dPa_RM(ID_ZF_S_L5CHIMSMK02), + }; + cXyz pos(current.pos); csXyz angle(0,0,0); - cXyz pos2(1.0f,1.0f,1.0f); + cXyz pos2(1.0f, 1.0f, 1.0f); for (int i = 0; i < 3; i++) { - mParticles[i] = dComIfGp_particle_set(PARTICLE_NAME[i],&pos,&angle,&pos2); + mParticles[i] = dComIfGp_particle_set(PARTICLE_NAME[i], &pos, &angle, &pos2); } } diff --git a/src/d/actor/d_a_tag_spinner.cpp b/src/d/actor/d_a_tag_spinner.cpp index d3c928cb3e..8a95bd4955 100644 --- a/src/d/actor/d_a_tag_spinner.cpp +++ b/src/d/actor/d_a_tag_spinner.cpp @@ -6,8 +6,34 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_tag_spinner.h" + +#include "d/d_debug_viewer.h" #include "d/d_procname.h" +class daTagSpinner_HIO_c : public mDoHIO_entry_c { +public: + daTagSpinner_HIO_c(); + + void genMessage(JORMContext*); + + u8 enable_debug_display; +}; + +#if DEBUG +daTagSpinner_HIO_c l_HIO; + +daTagSpinner_HIO_c::daTagSpinner_HIO_c() { + enable_debug_display = FALSE; +} + +void daTagSpinner_HIO_c::genMessage(JORMContext* ctx) { + // "Spinner suction tag" + ctx->genLabel("スピンナー吸い込みタグ", 0); + // "Debug display" + ctx->genCheckBox("デバッグ表示", &enable_debug_display, 0x1); +} +#endif + static int CheckCreateHeap(fopAc_ac_c* param_0) { daTagSpinner_c* tag = (daTagSpinner_c*)param_0; return tag->CreateHeap(); @@ -17,12 +43,15 @@ static void* search_spinner_sub(void* tag_0, void* tag_1) { fopAc_ac_c* actor = (fopAc_ac_c*)tag_0; daTagSpinner_c* actor2 = (daTagSpinner_c*)tag_1; - if ((actor != NULL) && (fopAcM_IsActor(actor) != NULL) && (fopAcM_GetProfName(actor) == 0xF2)) { - if ((actor->current.pos.absXZ(actor2->current.pos)) < (actor2->GetR())) { + if (actor != NULL && + fopAcM_IsActor(actor) != NULL && + fopAcM_GetProfName(actor) == PROC_SPINNER) { + f32 latDist = actor->current.pos.absXZ(actor2->current.pos); + if (latDist < actor2->GetR()) { return actor; } } - return 0; + return NULL; } void daTagSpinner_c::initBaseMtx() { @@ -30,8 +59,8 @@ void daTagSpinner_c::initBaseMtx() { } void daTagSpinner_c::setBaseMtx() { - MTXTrans(mDoMtx_stack_c::now, current.pos.x, current.pos.y, current.pos.z); - mDoMtx_ZXYrotM(mDoMtx_stack_c::now, shape_angle.x, shape_angle.y, shape_angle.z); + mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); + mDoMtx_stack_c::ZXYrotM(shape_angle.x, shape_angle.y, shape_angle.z); } int daTagSpinner_c::Create() { @@ -46,21 +75,27 @@ int daTagSpinner_c::CreateHeap() { } int daTagSpinner_c::create() { - int iVar1; - int iVar2; fopAcM_ct(this, daTagSpinner_c); - if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0)) { - iVar2 = 5; - } else { - iVar1 = Create(); - if (iVar1 == NULL) { - iVar2 = 5; - } else { - iVar2 = 4; + int var_r29 = cPhs_COMPLEATE_e; + if (var_r29 == cPhs_COMPLEATE_e) { + if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0)) { + return cPhs_ERROR_e; } + + if (!Create()) { + return cPhs_ERROR_e; + } + + OS_REPORT("TAG_SPINNER PARAM:%x\n", fopAcM_GetParam(this)); + +#if DEBUG + // "Spinner suction tag" + l_HIO.entryHIO("スピンナー吸い込みタグ"); +#endif } - return iVar2; + + return var_r29; } int daTagSpinner_c::execute() { @@ -76,26 +111,55 @@ int daTagSpinner_c::execute() { return 1; } -int daTagSpinner_c::_delete() { +int daTagSpinner_c::draw() { +#if DEBUG + GXColor color = (GXColor){0, 0, 0x80, 0x80}; + + if (l_HIO.enable_debug_display) { + dDbVw_drawCylinderXlu(current.pos, mRadius, field_0x56c, color, 1); + } +#endif + return 1; } -static int daTagSpinner_Execute(daTagSpinner_c* tag) { - return tag->execute(); +int daTagSpinner_c::_delete() { +#if DEBUG + l_HIO.removeHIO(); +#endif + + return 1; +} + +static int daTagSpinner_Execute(daTagSpinner_c* i_this) { + return i_this->execute(); +} + +static int daTagSpinner_Draw(daTagSpinner_c* i_this) { + return i_this->draw(); } static int daTagSpinner_Delete(daTagSpinner_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->_delete(); } -static int daTagSpinner_Create(fopAc_ac_c* tag) { - return static_cast(tag)->create(); +static int daTagSpinner_Create(fopAc_ac_c* i_this) { + daTagSpinner_c* spinner = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return spinner->create(); } static actor_method_class l_daTagSpinner_Method = { (process_method_func)daTagSpinner_Create, (process_method_func)daTagSpinner_Delete, (process_method_func)daTagSpinner_Execute, + (process_method_func)NULL, +#if DEBUG + (process_method_func)daTagSpinner_Draw, +#else + (process_method_func)NULL, +#endif }; diff --git a/src/d/actor/d_a_tag_sppath.cpp b/src/d/actor/d_a_tag_sppath.cpp index c703b5ce68..162facf5cc 100644 --- a/src/d/actor/d_a_tag_sppath.cpp +++ b/src/d/actor/d_a_tag_sppath.cpp @@ -28,8 +28,8 @@ static dCcD_SrcCyl l_cylSrc = { int daTagSppath_c::create() { fopAcM_ct(this, daTagSppath_c); - mSwNo1 = fopAcM_GetParamBit(this, 8, 8); - mSwNo2 = fopAcM_GetParamBit(this, 16, 8); + mSwNo1 = (fopAcM_GetParam(this) >> 8) & 0xFF; + mSwNo2 = (fopAcM_GetParam(this) >> 16) & 0xFF; s32 pathIndex = fopAcM_GetParam(this) & 0xff; if (pathIndex == 0xff || @@ -53,53 +53,65 @@ int daTagSppath_c::create() { } static int daTagSppath_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagSppath_c* spPath = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return spPath->create(); } daTagSppath_c::~daTagSppath_c() {} static int daTagSppath_Delete(daTagSppath_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagSppath_c(); return 1; } int daTagSppath_c::getNearPathPos(cXyz* i_result, dPath* i_path) { - daPy_py_c* py = daPy_getPlayerActorClass(); - cXyz* pyCurPos = &py->current.pos; + cXyz* pyCurPos = &daPy_getPlayerActorClass()->current.pos; dPnt* curPnt = i_path->m_points; f32 bestDist = FLT_MAX; - int bestNo; + f32 distToSeg; BOOL isValid; cM3dGLin line; cXyz nearestPointOnSeg; cXyz pntDiff; - f32 distToSeg; + int bestNo; + f32 flatness; + f32 segLen; + dPnt* adjPnt; for (int i = 0; i < i_path->m_num; i++, curPnt++) { if (i != i_path->m_num - 1) { line.set(curPnt[0].m_position, curPnt[1].m_position); if (!dPath_ChkClose(i_path)) { + adjPnt = curPnt + 1; if (i == 0) { - pntDiff.set(curPnt[1].m_position.x - curPnt[0].m_position.x, - curPnt[1].m_position.y - curPnt[0].m_position.y, - curPnt[1].m_position.z - curPnt[0].m_position.z); - f32 segLen = pntDiff.abs(); + pntDiff.set(adjPnt->m_position.x - curPnt->m_position.x, + adjPnt->m_position.y - curPnt->m_position.y, + adjPnt->m_position.z - curPnt->m_position.z); + segLen = pntDiff.abs(); pntDiff.normalizeZP(); - f32 flatness = pntDiff.absXZ(); - if (flatness > 0.001f && segLen > 30.0f / flatness) { - line.GetStartP() = line.GetStart() + pntDiff * (30.0f / flatness); + flatness = pntDiff.absXZ(); + if (flatness > 0.001f) { + flatness = 30.0f / flatness; + if (segLen > flatness) { + line.GetStartP() = line.GetStart() + pntDiff * flatness; + } } } if (i == i_path->m_num - 2) { - pntDiff.set(curPnt[0].m_position.x - curPnt[1].m_position.x, - curPnt[0].m_position.y - curPnt[1].m_position.y, - curPnt[0].m_position.z - curPnt[1].m_position.z); - f32 segLen = pntDiff.abs(); + pntDiff.set(curPnt->m_position.x - adjPnt->m_position.x, + curPnt->m_position.y - adjPnt->m_position.y, + curPnt->m_position.z - adjPnt->m_position.z); + segLen = pntDiff.abs(); pntDiff.normalizeZP(); - f32 flatness = pntDiff.absXZ(); - if (flatness > 0.001f && segLen > 30.0f / flatness) { - line.GetEndP() = line.GetEnd() + pntDiff * (30.0f / flatness); + flatness = pntDiff.absXZ(); + if (flatness > 0.001f) { + flatness = 30.0f / flatness; + if (segLen > flatness) { + line.GetEndP() = line.GetEnd() + pntDiff * flatness; + } } } } @@ -117,7 +129,6 @@ int daTagSppath_c::getNearPathPos(cXyz* i_result, dPath* i_path) { if (isValid == 0) { nearestPointOnSeg = curPnt->m_position; if (!dPath_ChkClose(i_path) && ((i == 0 || (i == i_path->m_num - 1)))) { - dPnt* adjPnt; if (i == 0) { adjPnt = curPnt + 1; } else { @@ -127,11 +138,14 @@ int daTagSppath_c::getNearPathPos(cXyz* i_result, dPath* i_path) { pntDiff.set(adjPnt->m_position.x - curPnt->m_position.x, adjPnt->m_position.y - curPnt->m_position.y, adjPnt->m_position.z - curPnt->m_position.z); - f32 segLen = pntDiff.abs(); + segLen = pntDiff.abs(); pntDiff.normalizeZP(); - f32 flatness = pntDiff.absXZ(); - if (flatness > 0.001f && segLen > 30.0f / flatness) { - nearestPointOnSeg += pntDiff * (30.0f / flatness); + flatness = pntDiff.absXZ(); + if (flatness > 0.001f) { + flatness = 30.0f / flatness; + if (segLen > flatness) { + nearestPointOnSeg += pntDiff * flatness; + } } } } @@ -157,12 +171,14 @@ int daTagSppath_c::execute() { } dPath* path = mpInitPath; + cXyz nearestPointOnPath; f32 bestDist = FLT_MAX; + f32 dist; + int no; for (; path != NULL; path = dPath_GetNextRoomPath(path, fopAcM_GetRoomNo(this))) { - cXyz nearestPointOnPath; - int no = getNearPathPos(&nearestPointOnPath, path); - f32 dist = nearestPointOnPath.abs2(py->current.pos); + no = getNearPathPos(&nearestPointOnPath, path); + dist = nearestPointOnPath.abs2(py->current.pos); if (dist < bestDist) { bestDist = dist; current.pos = nearestPointOnPath; @@ -172,8 +188,7 @@ int daTagSppath_c::execute() { } if (mpBestPath->field_0x4 == 0) { - u32 swNo = mpBestPath->field_0x6; - if (swNo == 0xff || fopAcM_isSwitch(this, swNo) == 0) { + if (mpBestPath->field_0x6 == 0xff || fopAcM_isSwitch(this, mpBestPath->field_0x6) == 0) { field_0x6e8 = 1; } else { field_0x6e8 = 2; @@ -182,7 +197,8 @@ int daTagSppath_c::execute() { field_0x6e8 = 0; } - mCyl.SetC(cXyz(current.pos.x, current.pos.y - mHeight * 0.5f, current.pos.z)); + cXyz sp10(current.pos.x, current.pos.y - mHeight * 0.5f, current.pos.z); + mCyl.SetC(sp10); dComIfG_Ccsp()->Set(&mCyl); return 1; diff --git a/src/d/actor/d_a_tag_spring.cpp b/src/d/actor/d_a_tag_spring.cpp index afc26df117..4eabdf3db2 100644 --- a/src/d/actor/d_a_tag_spring.cpp +++ b/src/d/actor/d_a_tag_spring.cpp @@ -6,9 +6,41 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_tag_spring.h" + #include "d/actor/d_a_player.h" +#include "d/d_debug_viewer.h" #include "d/d_procname.h" +class daTagSpring_HIO_c : public mDoHIO_entry_c { +public: + daTagSpring_HIO_c(); + + void genMessage(JORMContext*); + + u8 draw_range; + u8 recovery_time; + u8 field_0x8; +}; + +daTagSpring_HIO_c::daTagSpring_HIO_c() { + draw_range = 0; + recovery_time = 30; + field_0x8 = 1; +} + +#if DEBUG +daTagSpring_HIO_c l_HIO; + +void daTagSpring_HIO_c::genMessage(JORMContext* ctx) { + // "Spirit spring" + ctx->genLabel("精霊の泉", 0); + // "Draw range" + ctx->genCheckBox("範囲描画", &draw_range, 1); + // "Recovery time" + ctx->genSlider("回復時間", &recovery_time, 0, 200); +} +#endif + void daTagSpring_c::initBaseMtx() { setBaseMtx(); } @@ -30,7 +62,11 @@ int daTagSpring_c::create() { return cPhs_ERROR_e; } - fopAcM_GetParam(this); + OS_REPORT("SPRING PARAM:%x\n", fopAcM_GetParam(this)); +#if DEBUG + l_HIO.entryHIO("精霊の泉"); +#endif + return cPhs_COMPLEATE_e; } @@ -49,40 +85,73 @@ int daTagSpring_c::execute() { if (checkArea() && fopAcM_wt_c::waterCheck(&player_p->current.pos) && (!dComIfGp_checkPlayerStatus0(0, 0x100000) && - fopAcM_wt_c::mWaterY > player_p->current.pos.y || + fopAcM_wt_c::getWaterY() > player_p->current.pos.y || dComIfGp_checkPlayerStatus0(0, 0x100000))) { if (mTimer != 0) { mTimer--; } else { +#if DEBUG + mTimer = l_HIO.recovery_time; +#else mTimer = 30; +#endif dComIfGp_setItemLifeCount(1.0f, 1); } } else { +#if DEBUG + mTimer = l_HIO.recovery_time; +#else mTimer = 30; +#endif } return 1; } -u8 daTagSpring_c::checkArea() { +bool daTagSpring_c::checkArea() { fopAc_ac_c* player_p = daPy_getPlayerActorClass(); - return player_p->current.pos.absXZ(current.pos) < (scale.x * 1000); + if (player_p->current.pos.absXZ(current.pos) < (scale.x * 1000.0f)) { + return 1; + } else { + return 0; + } +} + +int daTagSpring_c::draw() { +#if DEBUG + if (l_HIO.draw_range) { + GXColor color = (GXColor){0, 0, 0xff, 0x80}; + dDbVw_drawCylinderXlu(current.pos, scale.x * 1000.0f, 100.0f, color, 1); + } +#endif + + return 1; } int daTagSpring_c::_delete() { +#if DEBUG + l_HIO.removeHIO(); +#endif + return 1; } +static int daTagSpring_Draw(daTagSpring_c* i_this) { + return i_this->draw(); +} + static int daTagSpring_Execute(daTagSpring_c* i_this) { return i_this->execute(); } static int daTagSpring_Delete(daTagSpring_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->_delete(); } static int daTagSpring_Create(daTagSpring_c* i_this) { + int id = fopAcM_GetID(i_this); return i_this->create(); } diff --git a/src/d/actor/d_a_tag_ss_drink.cpp b/src/d/actor/d_a_tag_ss_drink.cpp index 3126e8c000..bca1da5abc 100644 --- a/src/d/actor/d_a_tag_ss_drink.cpp +++ b/src/d/actor/d_a_tag_ss_drink.cpp @@ -26,7 +26,8 @@ int daTag_SSDrink_c::Delete() { } int daTag_SSDrink_c::Execute() { - if (chkEvent()) { + int eventResult = chkEvent(); + if (eventResult) { if (mProcessFunc) { (this->*mProcessFunc)(0); } @@ -40,8 +41,9 @@ int daTag_SSDrink_c::Draw() { return 1; } -int daTag_SSDrink_c::getTypeFromParam() { - switch (fopAcM_GetParamBit(this, 0, 4)) { +u8 daTag_SSDrink_c::getTypeFromParam() { + u8 param = fopAcM_GetParam(this) & 0xF; + switch (param) { case 0: field_0x5D3 = 0x69; return 0; @@ -70,28 +72,18 @@ int daTag_SSDrink_c::getTypeFromParam() { } u8 daTag_SSDrink_c::getSwitchFromParam() { - return fopAcM_GetParamBit(this, 4, 8); + u8 result = (fopAcM_GetParam(this) & 0xFF0) >> 4; + return result; } u16 daTag_SSDrink_c::getFlowNodeNum() { - u16 num = home.angle.x; - bool bVar1 = false; - if (num == 0xFFFF || num == 0) { - bVar1 = true; - } - - u16 num2; - if (!bVar1) { - num2 = num; - } else { - num2 = 0xFFFF; - } - - return num2 & 0xFFFF; + u16 angleX = home.angle.x; + return angleX == 0xFFFF || angleX == 0 ? 0xFFFF : angleX; } u16 daTag_SSDrink_c::getValue() { - return fopAcM_GetParamBit(this, 12, 16); + u16 result = (fopAcM_GetParam(this) & 0xFFFF000) >> 12; + return result; } void daTag_SSDrink_c::restart() { @@ -117,7 +109,7 @@ int daTag_SSDrink_c::setProcess(ProcessFunc i_processFunc) { int retVal = 0; if (checkProcess(i_processFunc)) { - return 0; + return retVal; } else { mEventType = 2; if (mProcessFunc) { @@ -167,7 +159,7 @@ int daTag_SSDrink_c::chkEvent() { } int daTag_SSDrink_c::orderEvent() { - if (!dComIfGp_getLinkPlayer()->checkWolf() && fopAcM_isSwitch(this, getSwitchFromParam()) && + if (!daPy_py_c::checkNowWolf() && fopAcM_isSwitch(this, getSwitchFromParam()) && field_0x5D3 != 0x60 && getFlowNodeNum() != 0xFFFF) { attention_info.flags = (fopAc_AttnFlag_TALKREAD_e | fopAc_AttnFlag_SPEAK_e); @@ -176,7 +168,7 @@ int daTag_SSDrink_c::orderEvent() { } if (attention_info.flags == (fopAc_AttnFlag_TALKREAD_e | fopAc_AttnFlag_SPEAK_e)) { - if (fopAcM_searchPlayerDistanceXZ(this) <= 160.0f && fopAcM_seenPlayerAngleY() <= 0x2000) { + if (fopAcM_searchPlayerDistanceXZ(this) <= 160.0f && fopAcM_seenPlayerAngleY(this) <= 0x2000) { attention_info.distances[fopAc_attn_TALK_e] = 0x9D; attention_info.distances[fopAc_attn_SPEAK_e] = 0x9D; eventInfo.onCondition(1); @@ -192,7 +184,7 @@ int daTag_SSDrink_c::wait(void* param_0) { if (!eventInfo.checkCommandCatch()) { if (fopAcM_isSwitch(this, getSwitchFromParam())) { if (fopAcM_searchPlayerDistanceXZ(this) <= 160.0f && - fopAcM_seenPlayerAngleY() <= 0x2000) + fopAcM_seenPlayerAngleY(this) <= 0x2000) { fopAc_ac_c* player = dComIfGp_getPlayer(0); cXyz local_28 = attention_info.position - player->attention_info.position; diff --git a/src/d/actor/d_a_tag_statue_evt.cpp b/src/d/actor/d_a_tag_statue_evt.cpp index eac78855db..de6ac67c85 100644 --- a/src/d/actor/d_a_tag_statue_evt.cpp +++ b/src/d/actor/d_a_tag_statue_evt.cpp @@ -5,8 +5,25 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep +#include "d/actor/d_a_player.h" #include "d/actor/d_a_tag_statue_evt.h" #include "d/d_com_inf_game.h" +#include "d/d_debug_viewer.h" + +class daTagStatue_HIO_c : public mDoHIO_entry_c { +public: + daTagStatue_HIO_c(); + + void genMessage(JORMContext*); + + f32 check_range; + f32 event_trigger_range; + u8 show_range; +}; + +#if DEBUG +daTagStatue_HIO_c l_HIO; +#endif static int CheckCreateHeap(fopAc_ac_c* i_this) { daTagStatue_c* tag_statue = static_cast(i_this); @@ -14,8 +31,9 @@ static int CheckCreateHeap(fopAc_ac_c* i_this) { } // Returns ID of Owl Statue corresponding to tag -static void* s_s_sub(void* i_proc, void* unused) { - if (fopAc_IsActor(i_proc) && fopAcM_GetName(i_proc) == PROC_CSTAF) { +static void* s_s_sub(void* i_proc, void* param_1) { + UNUSED(param_1); + if (fopAcM_IsActor(i_proc) && fopAcM_GetName(i_proc) == PROC_CSTAF) { return i_proc; } @@ -36,15 +54,6 @@ static const u16 l_event_bit[6] = { dSv_event_flag_c::F_0812, /* N/A - N/A */ }; -void daTagStatue_c::setBaseMtx() { - const cXyz& current_pos = fopAcM_GetPosition(this); - mDoMtx_stack_c::transS(current_pos.x, 1.0f + current_pos.y, current_pos.z); - const csXyz& shape_angle = *fopAcM_GetShapeAngle_p(this); - mDoMtx_stack_c::ZXYrotM(shape_angle); - - mpModel->setBaseTRMtx(mDoMtx_stack_c::now); -} - static char* l_arcName = "Obj_cs_f"; static u16 l_eff_id[3] = { @@ -74,19 +83,42 @@ static cull_box l_cull_box = { {300.0f, 400.0f, 300.0f} // Max }; +#if DEBUG +daTagStatue_HIO_c::daTagStatue_HIO_c() { + check_range = 120.0f; + event_trigger_range = 100.0f; + show_range = 0; +} + +void daTagStatue_HIO_c::genMessage(JORMContext* ctx) { + // "Sky Character tag" + ctx->genLabel("天空文字タグ", 0, 0); + ctx->genCheckBox("範囲表示", &show_range, 1); + // "Stone statue check range" + ctx->genSlider("石像チェック範囲", &check_range, 0.0f, 1000.0f); + // "Event trigger range" + ctx->genSlider("イベント起動範囲", &event_trigger_range, 0.0f, 1000.0f); +} +#endif + +void daTagStatue_c::setBaseMtx() { + mDoMtx_stack_c::transS(current.pos.x, 1.0f + current.pos.y, current.pos.z); + mDoMtx_stack_c::ZXYrotM(shape_angle); + + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); +} + cPhs__Step daTagStatue_c::Create() { - if(fopAcM_isSwitch(this, getSwbit2())) { + if (fopAcM_isSwitch(this, getSwbit2())) { // Player already obtained Sky Character from this tag setAction(ACTION_DEAD_e); mpGlowingSkyCharacterBrk->setFrame(0.0f); mpGlowingSkyCharacterBrk->setPlaySpeed(0.0f); - } - else { - if(fopAcM_isSwitch(this, getSwbit())) { + } else { + if (fopAcM_isSwitch(this, getSwbit())) { setParticle(); mpGlowingSkyCharacterBrk->setFrame(mpGlowingSkyCharacterBrk->getEndFrame()); - } - else { + } else { mpGlowingSkyCharacterBrk->setFrame(0.0f); mpGlowingSkyCharacterBrk->setPlaySpeed(0.0f); } @@ -94,49 +126,56 @@ cPhs__Step daTagStatue_c::Create() { setAction(ACTION_WAIT_e); } - mpPlatformCircleBtk->setFrame(static_cast(mSkyCharacterEventBitIdIndex)); + mpPlatformCircleBtk->setFrame(mSkyCharacterEventBitIdIndex); initBaseMtx(); fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); - fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, l_cull_box.max.x, l_cull_box.max.y, l_cull_box.max.z); + fopAcM_setCullSizeBox(this, l_cull_box.min.x, l_cull_box.min.y, l_cull_box.min.z, + l_cull_box.max.x, l_cull_box.max.y, l_cull_box.max.z); - char* ev_arc_name = l_evArcName[mSkyCharacterEventBitIdIndex]; - - if(!ev_arc_name) { + if (!l_evArcName[mSkyCharacterEventBitIdIndex]) { eventInfo.setArchiveName(l_arcName); - } - else { - eventInfo.setArchiveName(ev_arc_name); + } else { + eventInfo.setArchiveName(l_evArcName[mSkyCharacterEventBitIdIndex]); } mMapToolId = 255; - mEventId = dComIfGp_getPEvtManager()->getEventIdx(this, l_eventName[mSkyCharacterEventBitIdIndex], 0xFF); + mEventId = (int)dComIfGp_getEventManager(). + getEventIdx(this, l_eventName[mSkyCharacterEventBitIdIndex], 0xFF); - mTreasureDemoItemId = -1; + mItemId = -1; mOwlStatueId = -1; return cPhs_LOADING_e; } int daTagStatue_c::CreateHeap() { - J3DModelData* model_data = static_cast(dComIfG_getObjectRes(l_arcName, 6)); - mpModel = mDoExt_J3DModel__create(model_data, 0x00080000, 0x11000284); + J3DModelData* modelData = static_cast(dComIfG_getObjectRes(l_arcName, 6)); + JUT_ASSERT(277, modelData != NULL) + mpModel = mDoExt_J3DModel__create(modelData, 0x00080000, 0x11000284); - if(!mpModel) return 0; + if (!mpModel) { + return 0; + } - J3DAnmTextureSRTKey* btk = reinterpret_cast(dComIfG_getObjectRes(l_arcName, 12)); + J3DAnmTextureSRTKey* pbtk = (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 12); + JUT_ASSERT(291, pbtk != NULL); mpPlatformCircleBtk = new mDoExt_btkAnm(); - if(!mpPlatformCircleBtk || !mpPlatformCircleBtk->init(model_data, btk, 1, 0, 1.0f, 0, -1)) + if (!mpPlatformCircleBtk || !mpPlatformCircleBtk->init(modelData, pbtk, 1, 0, 1.0f, 0, -1)) { return 0; + } - J3DAnmTevRegKey* brk = reinterpret_cast(dComIfG_getObjectRes(l_arcName, 9)); + J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 9); + JUT_ASSERT(303, pbrk != NULL); mpGlowingSkyCharacterBrk = new mDoExt_brkAnm(); - if(!mpGlowingSkyCharacterBrk || !mpGlowingSkyCharacterBrk->init(model_data, brk, 1, 0, 1.0f, 0, -1)) + if (!mpGlowingSkyCharacterBrk || + !mpGlowingSkyCharacterBrk->init(modelData, pbrk, 1, 0, 1.0f, 0, -1)) { return 0; + } return 1; } @@ -144,40 +183,50 @@ int daTagStatue_c::CreateHeap() { cPhs__Step daTagStatue_c::create() { fopAcM_ct(this, daTagStatue_c); - mSkyCharacterEventBitIdIndex = fopAcM_GetParamBit(this, 8, 4); + mSkyCharacterEventBitIdIndex = getType(); int phase; - if(l_evArcName[mSkyCharacterEventBitIdIndex]) { + if (l_evArcName[mSkyCharacterEventBitIdIndex]) { phase = dComIfG_resLoad(&mEvArcPhase, l_evArcName[mSkyCharacterEventBitIdIndex]); - if(phase != cPhs_COMPLEATE_e) + if (phase != cPhs_COMPLEATE_e) { return static_cast(phase); + } } phase = dComIfG_resLoad(&mArcPhase, l_arcName); - if(phase == cPhs_COMPLEATE_e) { - if(!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x1100)) + if (phase == cPhs_COMPLEATE_e) { + if (!fopAcM_entrySolidHeap(this, CheckCreateHeap, 0x1100)) { return cPhs_ERROR_e; + } - if(Create() == cPhs_INIT_e) + if (Create() == cPhs_INIT_e) { return cPhs_ERROR_e; + } + +#if DEBUG + // "Sky Character tag" + l_HIO.entryHIO("天空文字タグ"); +#endif } return static_cast(phase); } int daTagStatue_c::execute() { - if(static_cast(mOwlStatueId + (1 << 16)) == 0xFFFF) { - base_process_class* found_owl_statue = fpcEx_Search(s_s_sub, this); - if(found_owl_statue) { + if (static_cast(mOwlStatueId + (1 << 16)) == 0xFFFF) { + base_process_class* found_owl_statue = fpcM_Search(s_s_sub, this); + if (found_owl_statue) { mOwlStatueId = fopAcM_GetID(found_owl_statue); + // "Sky Character tag: a stone statue was discovered!" + OS_REPORT("天空文字タグ:石像発見しました!ID=%d\n", mOwlStatueId); } } event_proc_call(); setBaseMtx(); - if(mpGlowingSkyCharacterBrk) { + if (mpGlowingSkyCharacterBrk) { mpGlowingSkyCharacterBrk->play(); } @@ -191,20 +240,21 @@ void daTagStatue_c::event_proc_call() { (this->*l_func[mCurrentAction])(); - // Form ring of light around platform and glowing Sky Character if Owl Statue has been moved far enough away - if(checkOnEffect()) { + // Form ring of light around platform and glowing Sky Character if Owl Statue has been moved far + // enough away + if (checkOnEffect()) { setParticle(); mpGlowingSkyCharacterBrk->setPlaySpeed(1.0f); - } - else { + } else { endParticle(); mpGlowingSkyCharacterBrk->setPlaySpeed(-1.0f); } } void daTagStatue_c::actionWait() { - if(checkStartDemo()) { - // Statue is far enough away and player is close enough to the tag for the cutscene to be ordered + if (checkStartDemo()) { + // Statue is far enough away and player is close enough to the tag for the cutscene to be + // ordered setAction(ACTION_ORDER_EVENT_e); fopAcM_orderOtherEventId(this, mEventId, mMapToolId, 0xFFFF, 0, 1); eventInfo.onCondition(0x0002); @@ -212,13 +262,12 @@ void daTagStatue_c::actionWait() { } void daTagStatue_c::actionOrderEvent() { - if(eventInfo.checkCommandDemoAccrpt()) { + if (eventInfo.checkCommandDemoAccrpt()) { // Cutscene order accepted setAction(ACTION_EVENT_e); - mDoAud_subBgmStart(Z2BGM_KOMONJO_GET_INTRO); + Z2GetAudioMgr()->subBgmStart(Z2BGM_KOMONJO_GET_INTRO); demoProc(); - } - else { + } else { // Cutscene order has not been accepted yet, attempt again fopAcM_orderOtherEventId(this, mEventId, mMapToolId, 0xFFFF, 0, 1); eventInfo.onCondition(0x0002); @@ -226,13 +275,12 @@ void daTagStatue_c::actionOrderEvent() { } void daTagStatue_c::actionEvent() { - if(dComIfGp_evmng_endCheck(mEventId)) { + if (dComIfGp_evmng_endCheck(mEventId)) { setAction(ACTION_DEAD_e); dComIfGp_event_reset(); fopAcM_onSwitch(this, getSwbit2()); - dComIfGs_onEventBit(l_event_bit[mSkyCharacterEventBitIdIndex]); - } - else { + dComIfGs_onEventBit((u16)l_event_bit[mSkyCharacterEventBitIdIndex]); + } else { demoProc(); } } @@ -268,13 +316,19 @@ int daTagStatue_c::demoProc() { 16384 // Ruined Theatre }; - int act_id = dComIfGp_evmng_getMyActIdx(mStaffId, action_table, ARRAY_SIZEU(action_table), 0, 0); + daPy_py_c* player = daPy_getPlayerActorClass(); - if(dComIfGp_evmng_getIsAddvance(mStaffId)) { + int act_id = + dComIfGp_evmng_getMyActIdx(mStaffId, action_table, ARRAY_SIZEU(action_table), 0, 0); + + int item; + int* timer_p; + fopAc_ac_c* found_owl_statue; + if (dComIfGp_evmng_getIsAddvance(mStaffId)) { switch(act_id) { case DEMO_ACTION_WAIT: { // Delay fading to black - int* timer_p = dComIfGp_evmng_getMyIntegerP(mStaffId, "Timer"); + timer_p = dComIfGp_evmng_getMyIntegerP(mStaffId, "Timer"); if (!timer_p) { mTimer = 1; @@ -286,9 +340,11 @@ int daTagStatue_c::demoProc() { } case DEMO_ACTION_MOVE_OWL_STATUE: // Position and orient Owl Statue behind player - if(mSkyCharacterEventBitIdIndex != TAG_LOCATION_GERUDO_DESERT && mSkyCharacterEventBitIdIndex != TAG_LOCATION_LAKE_HYLIA && mSkyCharacterEventBitIdIndex != TAG_LOCATION_RUINED_THEATRE) { - fopAc_ac_c* found_owl_statue = reinterpret_cast(fpcEx_Search(s_s_sub, this)); - if(found_owl_statue) { + if (mSkyCharacterEventBitIdIndex != TAG_LOCATION_GERUDO_DESERT && + mSkyCharacterEventBitIdIndex != TAG_LOCATION_LAKE_HYLIA && + mSkyCharacterEventBitIdIndex != TAG_LOCATION_RUINED_THEATRE) { + found_owl_statue = reinterpret_cast(fpcM_Search(s_s_sub, this)); + if (found_owl_statue) { found_owl_statue->current.pos = l_statue_pos[mSkyCharacterEventBitIdIndex]; found_owl_statue->shape_angle.y = l_statue_ang[mSkyCharacterEventBitIdIndex]; fopAcM_OnStatus(found_owl_statue, 0x800); @@ -296,31 +352,31 @@ int daTagStatue_c::demoProc() { } break; case DEMO_ACTION_AWARD_ITEM: - // If the player already has 5 Sky Characters, reward them with the completed Ancient Sky Book, - // otherwise, reward another character - int item; - if(getLetterCount() == 5) { + // If the player already has 5 Sky Characters, reward them with the completed + // Ancient Sky Book, otherwise, reward another character + if (getLetterCount() == 5) { item = fpcNm_ITEM_ANCIENT_DOCUMENT2; /* Sky character - Sky character 6 */ dComIfGs_onEventBit(dSv_event_flag_c::F_0796); - } - else { + } else { item = fpcNm_ITEM_AIR_LETTER; } - mTreasureDemoItemId = fopAcM_createItemForTrBoxDemo(&fopAcM_GetPosition(this), item, -1, fopAcM_GetRoomNo(this), 0, 0); + mItemId = + fopAcM_createItemForTrBoxDemo(¤t.pos, item, -1, + fopAcM_GetRoomNo(this), 0, 0); - if(static_cast(mTreasureDemoItemId + (1 << 16)) != 0xFFFF) { - dComIfGp_event_setItemPartnerId(mTreasureDemoItemId); + JUT_ASSERT(580, mItemId != fpcM_ERROR_PROCESS_ID_e); + + if (mItemId + (1 << 16) != 0xFFFF) { + dComIfGp_event_setItemPartnerId(mItemId); } - - break; } } switch(act_id) { case DEMO_ACTION_WAIT: - if(!cLib_calcTimer(&mTimer)) { + if (!cLib_calcTimer(&mTimer)) { dComIfGp_evmng_cutEnd(mStaffId); } break; @@ -336,16 +392,18 @@ int daTagStatue_c::demoProc() { } void daTagStatue_c::setParticle() { - for(int i = 0; i < 3; i++) { - if(!mpLightRingEmitters[i]) { - mpLightRingEmitters[i] = dComIfGp_particle_set(l_eff_id[i], ¤t.pos, &home.angle, &scale); + for (int i = 0; i < 3; i++) { + if (!mpLightRingEmitters[i]) { + mpLightRingEmitters[i] = + dComIfGp_particle_set(l_eff_id[i], ¤t.pos, &home.angle, &scale, 0xff, NULL, + -1, NULL, NULL, NULL); } } } void daTagStatue_c::endParticle() { - for(int i = 0; i < 3; i++) { - if(mpLightRingEmitters[i]) { + for (int i = 0; i < 3; i++) { + if (mpLightRingEmitters[i]) { mpLightRingEmitters[i]->becomeInvalidEmitter(); mpLightRingEmitters[i]->quitImmortalEmitter(); mpLightRingEmitters[i] = NULL; @@ -353,48 +411,48 @@ void daTagStatue_c::endParticle() { } } -// Check if statue is far enough away from the Sky Character platform and if player is close enough to the tag for the cutscene -// of obtaining a Sky Character to be ordered +// Check if statue is far enough away from the Sky Character platform and if player is close enough +// to the tag for the cutscene of obtaining a Sky Character to be ordered BOOL daTagStatue_c::checkStartDemo() { - const fopAc_ac_c* const player = dComIfGp_getPlayer(0); + const fopAc_ac_c* const player = daPy_getPlayerActorClass(); - if(!checkOnEffect()) { + if (!checkOnEffect()) { // Owl Statue is not far enough away from tag return 0; } - const f32 tag_distance_to_player = sqrtf(PSVECSquareDistance(&player->current.pos, ¤t.pos)); +#if DEBUG +#define TAG_STATUE_EVENT_TRIGGER_RANGE l_HIO.event_trigger_range +#else +#define TAG_STATUE_EVENT_TRIGGER_RANGE 100.0f +#endif - return (tag_distance_to_player < 100.0f); + if (player->current.pos.abs(current.pos) < TAG_STATUE_EVENT_TRIGGER_RANGE) { + return 1; + } else { + return 0; + } } -// Return whether the owl statue has moved far enough away (in the horizontal plane) from the platform where the Sky Character is obtained -// in order for its glowing effects to occur and the cutscene to be ordered +// Return whether the owl statue has moved far enough away (in the horizontal plane) from the +// platform where the Sky Character is obtained in order for its glowing effects to occur and the +// cutscene to be ordered BOOL daTagStatue_c::checkOnEffect() { - BOOL is_switch = fopAcM_isSwitch(this, getSwbit2()); - if(!is_switch && static_cast(mOwlStatueId + (1 << 16)) != 0xFFFF) { + daPy_py_c* player = daPy_getPlayerActorClass(); + if (!fopAcM_isSwitch(this, getSwbit2()) && + static_cast(mOwlStatueId + (1 << 16)) != 0xFFFF) { fopAc_ac_c* found_owl_statue = fopAcM_SearchByID(mOwlStatueId); - if(found_owl_statue) { - Vec statue_tag_xy_pos; - Vec found_owl_statue_xy_pos; + if (found_owl_statue) { +#if DEBUG +#define TAG_STATUE_CHECK_RANGE l_HIO.check_range +#else +#define TAG_STATUE_CHECK_RANGE 120.0f +#endif - const f32 found_owl_statue_z = fopAcM_GetPosition(found_owl_statue).z; - const f32 found_owl_statue_x = fopAcM_GetPosition(found_owl_statue).x; - found_owl_statue_xy_pos.x = found_owl_statue_x; - found_owl_statue_xy_pos.y = 0.0f; - found_owl_statue_xy_pos.z = found_owl_statue_z; - - const f32 statue_tag_z = fopAcM_GetPosition(this).z; - const f32 statue_tag_x = fopAcM_GetPosition(this).x; - statue_tag_xy_pos.x = statue_tag_x; - statue_tag_xy_pos.y = 0.0f; - statue_tag_xy_pos.z = statue_tag_z; - - const f32 distance_between_statue_and_tag = sqrtf(PSVECSquareDistance(&found_owl_statue_xy_pos, &statue_tag_xy_pos)); - - if(distance_between_statue_and_tag > 120.0f) return TRUE; - } - else { + if (found_owl_statue->current.pos.absXZ(current.pos) > TAG_STATUE_CHECK_RANGE) { + return TRUE; + } + } else { // No Owl Statue found, platform cannot be covered return TRUE; } @@ -403,21 +461,20 @@ BOOL daTagStatue_c::checkOnEffect() { return FALSE; } -s32 daTagStatue_c::getLetterCount() { - s32 numLetters = 0; - for(int i = 0; i < 6; i++) { - if(dComIfGs_isEventBit(l_event_bit[i])) { +int daTagStatue_c::getLetterCount() { + int numLetters = 0; + for (int i = 0; i < 6; i++) { + if (dComIfGs_isEventBit((u16)l_event_bit[i])) { numLetters++; } } -return numLetters; + return numLetters; } int daTagStatue_c::draw() { - dScnKy_env_light_c* env_light = dKy_getEnvlight(); - env_light->settingTevStruct(0, ¤t.pos, &tevStr); - env_light->setLightTevColorType_MAJI(mpModel, &tevStr); + g_env_light.settingTevStruct(0, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr); dComIfGd_setListBG(); @@ -429,32 +486,46 @@ int daTagStatue_c::draw() { dComIfGd_setList(); +#if DEBUG + if (l_HIO.show_range) { + GXColor color1 = (GXColor){0xff, 0, 0, 0xff}; + GXColor color2 = (GXColor){0, 0, 0xff, 0xff}; + dDbVw_drawCircleXlu(current.pos, l_HIO.check_range, color1, 1, 12); + dDbVw_drawCircleXlu(current.pos, l_HIO.event_trigger_range, color2, 1, 12); + } +#endif + return 1; } int daTagStatue_c::_delete() { endParticle(); dComIfG_resDelete(&mArcPhase, l_arcName); - if(l_evArcName[mSkyCharacterEventBitIdIndex]) { + if (l_evArcName[mSkyCharacterEventBitIdIndex]) { dComIfG_resDelete(&mEvArcPhase, l_evArcName[mSkyCharacterEventBitIdIndex]); } +#if DEBUG + l_HIO.removeHIO(); +#endif return 1; } - static int daTagStatue_Draw(daTagStatue_c* i_this) { +static int daTagStatue_Draw(daTagStatue_c* i_this) { return i_this->draw(); - } +} static int daTagStatue_Execute(daTagStatue_c* i_this) { return i_this->execute(); } static int daTagStatue_Delete(daTagStatue_c* i_this) { + fopAcM_RegisterDeleteID(i_this, "Sample"); return i_this->_delete(); } static int daTagStatue_Create(daTagStatue_c* i_this) { + fopAcM_RegisterCreateID(i_this, "Sample"); return i_this->create(); } diff --git a/src/d/actor/d_a_tag_stream.cpp b/src/d/actor/d_a_tag_stream.cpp index d681a130bb..60dd5fcba2 100644 --- a/src/d/actor/d_a_tag_stream.cpp +++ b/src/d/actor/d_a_tag_stream.cpp @@ -5,18 +5,25 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep -#include "d/actor/d_a_tag_stream.h" #include "SSystem/SComponent/c_math.h" +#include "d/actor/d_a_tag_stream.h" + +#include "d/d_debug_viewer.h" #include "d/d_procname.h" +#include "d/d_s_play.h" int daTagStream_c::create() { fopAcM_ct(this, daTagStream_c); - mPriority = fopAcM_GetParam(this) >> 8; + mPriority = (fopAcM_GetParam(this) >> 8) & 0xFF; mPower = fopAcM_GetParam(this); - field_0x56b = fopAcM_GetParam(this) >> 16; + field_0x56b = (fopAcM_GetParam(this) >> 16) & 0xFF; - fopAcM_GetParam(this) >> 24 != 0 ? mParameters = 0 : mParameters = 1; + if ((fopAcM_GetParam(this) >> 24) != 0) { + mParameters = 0; + } else { + mParameters = 1; + } scale.x *= 100.0f; scale.y *= 100.0f; @@ -49,18 +56,17 @@ int daTagStream_c::create() { } else { m_top = this; } - - f32 float1 = cM_scos(shape_angle.y) * cM_scos(shape_angle.x); - f32 float2 = -cM_ssin(shape_angle.x); - f32 float3 = cM_ssin(shape_angle.y) * cM_scos(shape_angle.x); - speed.set(float3,float2,float1); + speed.set(cM_ssin(shape_angle.y) * cM_scos(shape_angle.x), -cM_ssin(shape_angle.x), + cM_scos(shape_angle.y) * cM_scos(shape_angle.x)); return cPhs_COMPLEATE_e; } static int daTagStream_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagStream_c* stream = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return stream->create(); } daTagStream_c::~daTagStream_c() { @@ -78,6 +84,7 @@ daTagStream_c::~daTagStream_c() { }; static int daTagStream_Delete(daTagStream_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagStream_c(); return 1; } @@ -96,8 +103,33 @@ static int daTagStream_Execute(daTagStream_c* i_this) { return i_this->execute(); } -static bool daTagStream_Draw(daTagStream_c* param_0) { - return true; +static int daTagStream_Draw(daTagStream_c* i_this) { +#if DEBUG + if (UREG_S(9) != 0 && i_this->checkStreamOn()) { + cXyz vertices[8]; + vertices[0].set(-i_this->scale.x, i_this->scale.y, -i_this->scale.z); + vertices[1].set(i_this->scale.x, vertices[0].y, vertices[0].z); + vertices[2].set(vertices[0].x, vertices[0].y, i_this->scale.z); + vertices[3].set(vertices[1].x, vertices[0].y, vertices[2].z); + vertices[4].set(vertices[0].x, 0.0f, vertices[0].z); + vertices[5].set(vertices[1].x, 0.0f, vertices[1].z); + vertices[6].set(vertices[2].x, 0.0f, vertices[2].z); + vertices[7].set(vertices[3].x, 0.0f, vertices[3].z); + + mDoMtx_stack_c::transS(i_this->current.pos); + mDoMtx_stack_c::YrotM(i_this->shape_angle.y); + + for (int i = 0; i < ARRAY_SIZE(vertices); i++) { + mDoMtx_stack_c::multVec(&vertices[i], &vertices[i]); + } + + static GXColor color = {0xff, 0, 0xff, 0x80}; + + dDbVw_drawCube8pXlu(vertices, color); + } +#endif + + return 1; } static actor_method_class l_daTagStream_Method = { diff --git a/src/d/actor/d_a_tag_telop.cpp b/src/d/actor/d_a_tag_telop.cpp index 76a27ed0e0..782a597843 100644 --- a/src/d/actor/d_a_tag_telop.cpp +++ b/src/d/actor/d_a_tag_telop.cpp @@ -52,12 +52,15 @@ static int daTag_Telop_IsDelete(daTag_Telop_c* i_this) { } static int daTag_Telop_Delete(daTag_Telop_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTag_Telop_c(); return 1; } static int daTag_Telop_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTag_Telop_c* telop = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return telop->create(); } static actor_method_class l_daTag_Telop_Method = { diff --git a/src/d/actor/d_a_tag_theB_hint.cpp b/src/d/actor/d_a_tag_theB_hint.cpp index 25acc4361e..3c1274ae5a 100644 --- a/src/d/actor/d_a_tag_theB_hint.cpp +++ b/src/d/actor/d_a_tag_theB_hint.cpp @@ -6,12 +6,40 @@ #include "d/dolzel_rel.h" // IWYU pragma: keep #include "d/actor/d_a_tag_theB_hint.h" +#include "d/actor/d_a_npc_theB.h" + +int daTagTheBHint_c::create() { + fopAcM_ct(this, daTagTheBHint_c); + field_0x568 = std::pow(scale.x * 100.0f,2.0f); + return cPhs_COMPLEATE_e; +} + +int daTagTheBHint_c::execute() { + if (fopAcM_isSwitch(this, getSwitchNo())) { + fopAcM_delete(this); + return 1; + } + + if (fopAcM_searchPlayerDistanceXZ2(this) < field_0x568) { + daNpcTheB_c* the_b = (daNpcTheB_c*)fpcM_SearchByName(PROC_NPC_THEB); + if (the_b) { + int roomNo = getRoomNo() == 0xff ? fopAcM_GetRoomNo(this) : getRoomNo(); + + the_b->setHintEvent(getMessageNo(), getLinkID(), roomNo); + } + } + + return 1; +} static int daTagTheBHint_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagTheBHint_c* theBHint = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return theBHint->create(); } static int daTagTheBHint_Delete(daTagTheBHint_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagTheBHint_c(); return 1; } diff --git a/src/d/actor/d_a_tag_wara_howl.cpp b/src/d/actor/d_a_tag_wara_howl.cpp index 0a4afbeb29..fc55700edf 100644 --- a/src/d/actor/d_a_tag_wara_howl.cpp +++ b/src/d/actor/d_a_tag_wara_howl.cpp @@ -45,12 +45,13 @@ void daTagWrHowl_c::init() { } bool daTagWrHowl_c::chkWlfInTag() { - if (dComIfGp_getPlayer(0) == NULL) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + if (player == NULL) { return false; } if (daPy_py_c::checkNowWolf()) { - cXyz player_pos = dComIfGp_getPlayer(0)->current.pos; + cXyz player_pos = player->current.pos; if (player_pos.abs2(current.pos) < field_0x570) { return true; } diff --git a/src/d/actor/d_a_tag_watchge.cpp b/src/d/actor/d_a_tag_watchge.cpp index 15b920f211..aeacc17e88 100644 --- a/src/d/actor/d_a_tag_watchge.cpp +++ b/src/d/actor/d_a_tag_watchge.cpp @@ -54,6 +54,7 @@ static int daTagWatchGe_IsDelete(daTagWatchGe_c* i_this) { } static int daTagWatchGe_Delete(daTagWatchGe_c* i_this) { + fopAcM_RegisterDeleteID(i_this, "Tag_WatchGe"); return 1; } diff --git a/src/d/actor/d_a_tag_waterfall.cpp b/src/d/actor/d_a_tag_waterfall.cpp index 31cc323f2a..f05003a982 100644 --- a/src/d/actor/d_a_tag_waterfall.cpp +++ b/src/d/actor/d_a_tag_waterfall.cpp @@ -7,25 +7,113 @@ #include "d/actor/d_a_tag_waterfall.h" #include "d/d_com_inf_game.h" +#include "d/d_debug_viewer.h" #include "d/d_procname.h" #include "f_op/f_op_camera_mng.h" -static u32 m_master_id = static_cast(0xFFFFFFFF); - daTagWaterFall_HIO_c::daTagWaterFall_HIO_c() { - field_0x04 = -1; - mBaseFogNear = 0.0f; - mBaseFogFar = 10000.0f; - mColorBlendStepDivisor = 3.0f; - mShouldModifyFog = false; - field_0x14 = 0; - field_0x15 = 0; - field_0x18 = 0.0f; - field_0x1C = 0.0f; - field_0x20 = 0.0f; + child = -1; + base_fog_far = 0.0f; + base_fog_near = 10000.0f; + color_blend_step_divisor = 3.0f; + enable_fog_adjust = false; + draw_ellipse = 0; + enable_ellipse_adjust = 0; + ellipse_radius_a = 0.0f; + ellipse_radius_b = 0.0f; + ellipse_rotate = 0.0f; } +#if DEBUG +void daTagWaterFall_HIO_c::genMessage(JORMContext* ctx) { + // "Zora river waterfall" + ctx->genLabel("ゾーラ川の滝", 0x80000001); + ctx->genLabel("-", 0x80000001); + + // "Fog adjustment parameters" + ctx->genLabel("フォグ調整パラメータ", 0x80000001); + ctx->genLabel("-", 0x80000001); + // "Fog adjustment ON?" + ctx->genCheckBox("フォグ調整ON?", &enable_fog_adjust, 0x1); + // "Near direct value" + ctx->genSlider("near直値", &base_fog_far, -100000.0f, 100000.0f); + // "Far direct value" + ctx->genSlider("far直値", &base_fog_near, -100000.0f, 100000.0f); + // "Switching time" + ctx->genSlider("切り替わり時間", &color_blend_step_divisor, 0.0f, 100.0f); + ctx->genLabel("-", 0x80000001); + ctx->genLabel("-", 0x80000001); + ctx->genLabel("-", 0x80000001); + + // "Ellipse adjustment parameters" + ctx->genLabel("楕円調整パラメータ", 0x80000001); + ctx->genLabel("-", 0x80000001); + // "Ellipse display" + ctx->genCheckBox("楕円表示", &draw_ellipse, 0x1); + ctx->genLabel("-", 0x80000001); + // "Ellipse adjustment ON?" + ctx->genCheckBox("楕円調整ON?", &enable_ellipse_adjust, 0x1); + // "Ellipse X radius" + ctx->genSlider("楕円X半径", &ellipse_radius_a, 0.0f, 10000.0f); + // "Ellipse Z radius" + ctx->genSlider("楕円Z半径", &ellipse_radius_b, 0.0f, 10000.0f); + // "Ellipse rotation" + ctx->genSlider("楕円回転", &ellipse_rotate, 0.0f, 65536.0f); +} +#endif + +static bool masterWaterfallTagExists; + +static u32 m_master_id = 0xFFFFFFFF; + +static daTagWaterFall_HIO_c l_HIO; + int daTagWaterFall_c::draw() { +#if DEBUG + f32 paramX; + f32 paramY; + f32 rotCos; + f32 rotSin; + s16 angle; + if (l_HIO.draw_ellipse || l_HIO.enable_ellipse_adjust) { + angle = 0; + cXyz startPos = current.pos; + if (!l_HIO.draw_ellipse) { + paramX = l_HIO.ellipse_radius_a * cM_ssin(angle); + paramY = l_HIO.ellipse_radius_b * cM_scos(angle); + rotCos = cM_scos(l_HIO.ellipse_rotate); + rotSin = cM_ssin(l_HIO.ellipse_rotate); + } else { + paramX = mCylinderRadiusA * cM_ssin(angle); + paramY = mCylinderRadiusB * cM_scos(angle); + rotCos = cM_scos(shape_angle.y); + rotSin = cM_ssin(shape_angle.y); + } + + startPos.x += paramX * rotCos + paramY * rotSin; + startPos.z += -paramX * rotSin + paramY * rotCos; + + cXyz endPos; + for (int i = 0; i < 0x10; i++) { + angle += (s16)0x1000; + endPos = current.pos; + if (l_HIO.draw_ellipse == 0) { + paramX = l_HIO.ellipse_radius_a * cM_ssin(angle); + paramY = l_HIO.ellipse_radius_b * cM_scos(angle); + } else { + paramX = mCylinderRadiusA * cM_ssin(angle); + paramY = mCylinderRadiusB * cM_scos(angle); + } + endPos.x += paramX * rotCos + paramY * rotSin; + endPos.z += -paramX * rotSin + paramY * rotCos; + + dDbVw_drawLineXlu(startPos, endPos, (GXColor){0, 0xff, 0, 0xff}, 1, 0xc); + + startPos = endPos; + } + } +#endif + return 1; } @@ -33,18 +121,14 @@ static int daTagWaterFall_Draw(daTagWaterFall_c* i_this) { return i_this->draw(); } -void* s_waterfall(void* pProc, void* unused) { - if (fopAc_IsActor(pProc)) { - if (fopAcM_GetName(pProc) == PROC_Tag_WaterFall) { - daTagWaterFall_c* pProcWaterfallTag = static_cast(pProc); +void* s_waterfall(void* pProc, void* param_1) { + UNUSED(param_1); - s32 id = fpcM_GetID(pProc); - if (!fpcM_IsCreating(id)) { - if (pProcWaterfallTag->checkHitWaterFallCamera()) { - return pProc; - } - } - } + if (fopAcM_IsActor(pProc) && + fopAcM_GetName(pProc) == PROC_Tag_WaterFall && + !fpcM_IsCreating(fopAcM_GetID(pProc)) && + static_cast(pProc)->checkHitWaterFallCamera()) { + return pProc; } return NULL; @@ -56,67 +140,69 @@ f32 daTagWaterFall_c::getEllipseY(f32 x) { f32 ellipseRadiusB = mCylinderRadiusB; f32 ellipseRadiusA = mCylinderRadiusA; - f32 ellipseRadiusBSquared = ellipseRadiusB * ellipseRadiusB; - f32 ellipseRadiusASquared = ellipseRadiusA * ellipseRadiusA; - f32 ellipseYSquared_OverBSquared = (1.0f - ((x * x) / (ellipseRadiusASquared))); - f32 ellipseYSquared = (ellipseRadiusBSquared)*ellipseYSquared_OverBSquared; +#if DEBUG + if (l_HIO.enable_ellipse_adjust) { + ellipseRadiusB = l_HIO.ellipse_radius_b; + ellipseRadiusA = l_HIO.ellipse_radius_a; + } +#endif - return JMAFastSqrt(ellipseYSquared); + f32 result = JMAFastSqrt((ellipseRadiusB * ellipseRadiusB) * + (1.0f - ((x * x) / (ellipseRadiusA * ellipseRadiusA)))); + return result; } bool daTagWaterFall_c::checkHitWaterFall(cXyz objPos) { - Vec dst; + cXyz dst; + s16 angleY = shape_angle.y; f32 ellipseRadiusA = mCylinderRadiusA; - mDoMtx_stack_c::YrotS(-fopAcM_GetShapeAngle_p(this)->y); +#if DEBUG + if (l_HIO.enable_ellipse_adjust) { + angleY = l_HIO.ellipse_rotate; + ellipseRadiusA = l_HIO.ellipse_radius_a; + } +#endif - const cXyz& waterfallTagPos = fopAcM_GetPosition(this); - mDoMtx_stack_c::transM(-waterfallTagPos.x, -waterfallTagPos.y, -waterfallTagPos.z); + mDoMtx_stack_c::YrotS(-angleY); + + mDoMtx_stack_c::transM(-current.pos.x, -current.pos.y, -current.pos.z); mDoMtx_stack_c::multVec(&objPos, &dst); - if (fabsf(dst.x) < ellipseRadiusA) { - const f32 absEllipseY = fabsf(getEllipseY(dst.x)); - if (fabsf(dst.z) < absEllipseY) { - if (waterfallTagPos.y < objPos.y) { - // Instruction reordering occurs when mCylinderHeight == 0.0f is used - if (!mCylinderHeight || (waterfallTagPos.y + mCylinderHeight) > objPos.y) { - return true; - } + f32 absEllipseY; + if (std::abs(dst.x) < ellipseRadiusA) { + absEllipseY = std::abs(getEllipseY(dst.x)); + if (std::abs(dst.z) < absEllipseY && current.pos.y < objPos.y) { + // Instruction reordering occurs when mCylinderHeight == 0.0f is used + if (!mCylinderHeight || (current.pos.y + mCylinderHeight) > objPos.y) { + return true; } } - } + } return false; } bool daTagWaterFall_c::checkHitWaterFallCamera() { - const camera_class* camera = dComIfGp_getCamera(0); - return checkHitWaterFall(camera->lookat.eye); + return checkHitWaterFall(dComIfGp_getCamera(0)->lookat.eye); } -static bool masterWaterfallTagExists; - -static daTagWaterFall_HIO_c l_HIO; - int daTagWaterFall_c::execute() { - u32 masterId = m_master_id; - u32 waterfallId = fpcM_GetID(this); - - if (masterId == waterfallId) { + if (m_master_id == fopAcM_GetID(this)) { if (mFrameCountdown) { const dScnKy_env_light_c* const envLight = dKy_getEnvlight(); mFogNear = envLight->mFogNear; mFogFar = envLight->mFogFar; mFrameCountdown--; - mColpat = envLight->mColpatWeather; + mColpat = g_env_light.mColpatWeather; mColorBlend = 1.0f; } else { - bool currCameraInWaterfall = false; - if (fpcEx_Search(s_waterfall, this)) { - currCameraInWaterfall = true; + u8 currCameraInWaterfall = FALSE; + if (fpcM_Search(s_waterfall, this)) { + currCameraInWaterfall = TRUE; } if (!currCameraInWaterfall) { @@ -132,7 +218,7 @@ int daTagWaterFall_c::execute() { mPrevCameraInWaterfall = currCameraInWaterfall; } - cLib_chaseF(&mColorBlend, 1.0f, 1.0f / l_HIO.mColorBlendStepDivisor); + cLib_chaseF(&mColorBlend, 1.0f, 1.0f / l_HIO.color_blend_step_divisor); if (!mPrevCameraInWaterfall) { dKy_custom_colset(7, mColpat, mColorBlend); @@ -141,23 +227,24 @@ int daTagWaterFall_c::execute() { } f32 instanceFogMultiplier; - f32 HIOFogMultiplier; + f32 hioFogMultiplier; - if (l_HIO.mShouldModifyFog) { + if (l_HIO.enable_fog_adjust) { if (mPrevCameraInWaterfall) { instanceFogMultiplier = 1.0f - mColorBlend; - HIOFogMultiplier = mColorBlend; + hioFogMultiplier = mColorBlend; } else { instanceFogMultiplier = mColorBlend; - HIOFogMultiplier = 1.0f - mColorBlend; + hioFogMultiplier = 1.0f - mColorBlend; } - f32 fogParam0 = - (mFogNear * instanceFogMultiplier) + (l_HIO.mBaseFogNear * HIOFogMultiplier); - f32 fogParam1 = - (mFogFar * instanceFogMultiplier) + (l_HIO.mBaseFogFar * HIOFogMultiplier); - - dKy_fog_startendz_set(fogParam0, fogParam1, 1.0f); + dKy_fog_startendz_set( + (mFogNear * instanceFogMultiplier) + + (l_HIO.base_fog_far * hioFogMultiplier), + (mFogFar * instanceFogMultiplier) + + (l_HIO.base_fog_near * hioFogMultiplier), + 1.0f + ); } } } @@ -177,7 +264,12 @@ static int daTagWaterFall_IsDelete(daTagWaterFall_c* i_this) { int daTagWaterFall_c::_delete() { if (mIsMasterWaterfallTag) { masterWaterfallTagExists = false; + +#if DEBUG + mDoHIO_deleteChild(l_HIO.child); +#endif } + return 1; } @@ -189,37 +281,41 @@ static int daTagWaterFall_Delete(daTagWaterFall_c* i_this) { cPhs__Step daTagWaterFall_c::create() { fopAcM_ct(this, daTagWaterFall_c); + OS_REPORT("Tag_WaterFall PARAM %x %x %x \n", fopAcM_GetParam(this), current.angle.x, current.angle.y); + if (masterWaterfallTagExists == false) { masterWaterfallTagExists = true; mIsMasterWaterfallTag = 1; - l_HIO.field_0x04 = -1; +#if DEBUG + // "Zora river waterfall" + l_HIO.child = mDoHIO_createChild("ゾーラ川の滝", &l_HIO); +#else + l_HIO.child = -1; +#endif } - mCylinderRadiusA = static_cast(fpcM_GetParam(this) & 0x0000FFFF); + mCylinderRadiusA = static_cast(fopAcM_GetParam(this) & 0x0000FFFF); if (mCylinderRadiusA < 0.0f) { mCylinderRadiusB = 0.0f; } - mCylinderHeight = static_cast((fpcM_GetParam(this) & 0xFFFF0000) >> 16); + mCylinderHeight = static_cast((fopAcM_GetParam(this) >> 16) & 0xFFFF); if (mCylinderHeight < 0.0f) { mCylinderHeight = 0.0f; } - mCylinderRadiusB = static_cast((fopAcM_GetAngle_p(this)->x & 0x0000FFFF)); + mCylinderRadiusB = static_cast(current.angle.x & 0xFFFF); if (mCylinderRadiusB <= 0.0f) { mCylinderRadiusB = mCylinderRadiusA; } - fopAcM_GetShapeAngle_p(this)->x = 0; - fopAcM_GetAngle_p(this)->x = 0; + current.angle.x = shape_angle.x = 0; if (m_master_id + (1 << 16) == 0xFFFF) { - u32 id = fopAcM_GetID(this); - - m_master_id = id; + m_master_id = fopAcM_GetID(this); mColorBlend = 0.0f; mFrameCountdown = 30; @@ -232,8 +328,6 @@ static int daTagWaterFall_Create(daTagWaterFall_c* i_this) { return i_this->create(); } -daTagWaterFall_HIO_c::~daTagWaterFall_HIO_c() {} - static actor_method_class l_daTagWaterFall_Method = { (process_method_func)daTagWaterFall_Create, (process_method_func)daTagWaterFall_Delete, (process_method_func)daTagWaterFall_Execute, (process_method_func)daTagWaterFall_IsDelete, diff --git a/src/d/actor/d_a_tag_yami.cpp b/src/d/actor/d_a_tag_yami.cpp index edc1319f3a..d9491c1e85 100644 --- a/src/d/actor/d_a_tag_yami.cpp +++ b/src/d/actor/d_a_tag_yami.cpp @@ -55,8 +55,8 @@ int daTagYami_c::create() { } else { on_CoHit(); } - break; } + break; default: return cPhs_ERROR_e; } @@ -72,7 +72,8 @@ int daTagYami_c::Execute() { void daTagYami_c::calcCoC(cXyz& i_dst) { cXyz base(0.0f, 0.0f, 430.0f); - mDoMtx_stack_c::ZXYrotS(csXyz(0, -0x7f96, 0)); + csXyz sp10(0, -0x7f96, 0); + mDoMtx_stack_c::ZXYrotS(sp10); mDoMtx_stack_c::multVec(&base, &base); i_dst = home.pos + base; } @@ -87,14 +88,12 @@ u32 daTagYami_c::chk_CoHit() { } f32 coR = getCoR(); - f32 plDist = getPlDist(); - return plDist < coR; + return getPlDist() < coR; } f32 daTagYami_c::getPlDist() { cXyz coC(mCoC); - daPy_py_c* py = daPy_getPlayerActorClass(); - cXyz pyPos = fopAcM_GetPosition((fopAc_ac_c*)py); + cXyz pyPos = *fopAcM_GetPosition_p(daPy_getPlayerActorClass()); cXyz diff = pyPos - coC; return diff.absXZ(); } @@ -109,14 +108,19 @@ void daTagYami_c::offMidnaTagSw2() { } int daTagYami_Create(fopAc_ac_c* i_this) { - return static_cast(i_this)->create(); + daTagYami_c* yami = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return yami->create(); } int daTagYami_Execute(fopAc_ac_c* i_this) { - return static_cast(i_this)->Execute(); + daTagYami_c* yami = static_cast(i_this); + int id = fopAcM_GetID(i_this); + return yami->Execute(); } int daTagYami_Delete(daTagYami_c* i_this) { + int id = fopAcM_GetID(i_this); i_this->~daTagYami_c(); return 1; }