diff --git a/src/files/setup/setupame.c b/src/files/setup/setupame.c index 7717aa966..13c1a169b 100644 --- a/src/files/setup/setupame.c +++ b/src/files/setup/setupame.c @@ -1679,7 +1679,7 @@ u8 func0414_programmer[] = { // have stopped without being near the PC. This bug is repeated several // times in this function but only documented here. beginloop(0x93) - if_target_chr_in_sight(/*goto*/ 0x96) + if_target_in_sight(/*goto*/ 0x96) if_near_miss(/*goto*/ 0x96) if_saw_injury(0x00, /*goto*/ 0x96) if_saw_death(0x00, /*goto*/ 0x96) @@ -3158,8 +3158,8 @@ u8 func0416_outro[] = { chr_do_animation(0x00f3, -1, -1, 0x06, 0x00, CHR_P1P2, 4) restart_timer unset_stage_flag(STAGEFLAG_LAB_ELEVATOR_CLOSED) - open_door2(OBJ_LABLIFTDOOR1) - open_door2(OBJ_LABLIFTDOOR2) + set_door_open(OBJ_LABLIFTDOOR1) + set_door_open(OBJ_LABLIFTDOOR2) restart_timer set_cutscene_weapon(CHR_P1P2, WEAPON_NONE, WEAPON_NONE) yield @@ -3728,7 +3728,7 @@ u8 func042f_surrendering_guard[] = { beginloop(0xc4) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x2c) + if_target_in_sight(/*goto*/ 0x2c) if_enemy_distance_lt_and_los(500, /*goto*/ 0x2c) if_near_miss(/*goto*/ 0x2c) if_saw_injury(0x00, /*goto*/ 0x2c) diff --git a/src/files/setup/setupark.c b/src/files/setup/setupark.c index 9fd90e767..59422dfb9 100644 --- a/src/files/setup/setupark.c +++ b/src/files/setup/setupark.c @@ -542,7 +542,7 @@ u8 func0401_drcaroll_following[] = { set_self_chrflag(CHRCFLAG_00040000) stop_chr set_target_chr(CHR_BOND) - try_jog_to_target_chr(/*goto*/ 0x00) + try_jog_to_target(/*goto*/ 0x00) label(0x00) yield set_target_chr(CHR_BOND) @@ -615,12 +615,12 @@ u8 func0401_drcaroll_following[] = { label(0x04) restart_timer if_chr_y(CHR_DRCAROLL, -2100, OPERATOR_LESS_THAN, /*goto*/ 0x20) - try_run_to_target_chr(/*goto*/ 0x05) + try_run_to_target(/*goto*/ 0x05) label(0x20) if_chr_distance_lt(200, /*goto*/ 0x20) - try_run_to_target_chr(/*goto*/ 0x05) + try_run_to_target(/*goto*/ 0x05) label(0x20) - try_jog_to_target_chr(/*goto*/ 0x05) + try_jog_to_target(/*goto*/ 0x05) beginloop(0x05) if_chr_in_room(CHR_TARGET, 0x00, 0x0094, /*goto*/ 0x00) @@ -646,7 +646,7 @@ u8 func0401_drcaroll_following[] = { goto_first(0x02) label(0x07) - try_run_to_target_chr(/*goto*/ 0x08) + try_run_to_target(/*goto*/ 0x08) beginloop(0x08) endloop(0x08) @@ -945,7 +945,7 @@ u8 func0406_general_combat[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_stage_flag_eq(STAGEFLAG_FOYER_LIGHTS_RESTORED, TRUE, /*goto*/ 0x00) - if_target_chr_in_sight(/*goto*/ 0x15) + if_target_in_sight(/*goto*/ 0x15) goto_next(0x20) label(0x00) @@ -969,7 +969,7 @@ u8 func0406_general_combat[] = { reloop(0x10) label(0x00) - if_target_chr_in_sight(/*goto*/ 0x15) + if_target_in_sight(/*goto*/ 0x15) if_stage_flag_eq(STAGEFLAG_FOYER_LIGHTS_RESTORED, TRUE, /*goto*/ 0x00) if_enemy_distance_lt_and_los(500, /*goto*/ 0x20) goto_next(0x5e) @@ -1030,7 +1030,7 @@ u8 func0406_general_combat[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) call_rng - if_target_chr_in_sight(/*goto*/ 0x19) + if_target_in_sight(/*goto*/ 0x19) if_timer_gt(60, /*goto*/ 0x1e) if_rand_lt(4, /*goto*/ 0x1e) endloop(0x1c) @@ -1071,7 +1071,7 @@ u8 func0406_general_combat[] = { goto_first(0x13) label(0x29) - try_jog_to_target_chr(/*goto*/ 0x20) + try_jog_to_target(/*goto*/ 0x20) label(0x20) dprint 'U','N',' ','E','N','T','R','Y','\n',0, set_returnlist(CHR_SELF, AILIST_GENERAL_COMBAT) @@ -1643,7 +1643,7 @@ u8 func0409_tech_conversation[] = { // Player activated door or door is fully open label(0x00) - set_follow_chr(CHR_TARGET) + set_chrpreset(CHR_TARGET) set_chr_team(CHR_TECH1, TEAM_ENEMY) set_chr_team(CHR_TECH2, TEAM_ENEMY) set_chr_team(CHR_RLSHOCK, TEAM_ENEMY) @@ -1674,7 +1674,7 @@ u8 func0409_tech_conversation[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x33) - if_target_chr_in_sight(/*goto*/ 0x33) + if_target_in_sight(/*goto*/ 0x33) pause_timer if_sound_finished(CHANNEL_7, /*goto*/ 0x20) reloop(0x21) @@ -1695,7 +1695,7 @@ u8 func0409_tech_conversation[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x33) - if_target_chr_in_sight(/*goto*/ 0x33) + if_target_in_sight(/*goto*/ 0x33) pause_timer if_sound_finished(CHANNEL_7, /*goto*/ 0x20) reloop(0x22) @@ -1716,7 +1716,7 @@ u8 func0409_tech_conversation[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x33) - if_target_chr_in_sight(/*goto*/ 0x33) + if_target_in_sight(/*goto*/ 0x33) pause_timer if_sound_finished(CHANNEL_7, /*goto*/ 0x20) reloop(0x23) @@ -1737,7 +1737,7 @@ u8 func0409_tech_conversation[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x33) - if_target_chr_in_sight(/*goto*/ 0x33) + if_target_in_sight(/*goto*/ 0x33) pause_timer if_sound_finished(CHANNEL_7, /*goto*/ 0x20) reloop(0x24) @@ -1759,7 +1759,7 @@ u8 func0409_tech_conversation[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x33) - if_target_chr_in_sight(/*goto*/ 0x33) + if_target_in_sight(/*goto*/ 0x33) pause_timer if_sound_finished(CHANNEL_7, /*goto*/ 0x20) reloop(0x25) @@ -1850,7 +1850,7 @@ u8 func040a_tech2[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_stage_flag_eq(STAGEFLAG_TECHS_FINISHED, TRUE, /*goto*/ 0x20) - if_target_chr_in_sight(/*goto*/ 0x33) + if_target_in_sight(/*goto*/ 0x33) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x33) endloop(0x1f) @@ -2637,7 +2637,7 @@ u8 func0413_defend_pad[] = { set_target_chr(CHR_P1P2) if_chr_sees_player(/*goto*/ 0x21) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x21) - if_distance_from_target_to_pad_lt(200, TARGET_PAD, /*goto*/ 0x22) + if_distance_from_target_to_pad_lt(200, PAD_PRESET, /*goto*/ 0x22) endloop(0x1f) label(0x21) diff --git a/src/files/setup/setupate.c b/src/files/setup/setupate.c index 05cc5ca16..55478e543 100644 --- a/src/files/setup/setupate.c +++ b/src/files/setup/setupate.c @@ -456,7 +456,7 @@ u8 func0403_jon_combat[] = { endloop(0x04) label(0x58) - try_run_to_target_chr(/*goto*/ 0x08) + try_run_to_target(/*goto*/ 0x08) beginloop(0x08) if_chr_distance_lt(250, /*goto*/ 0x0e) diff --git a/src/files/setup/setupazt.c b/src/files/setup/setupazt.c index 8802e9895..6d85f28fd 100644 --- a/src/files/setup/setupazt.c +++ b/src/files/setup/setupazt.c @@ -1150,7 +1150,7 @@ u8 func0404_elvis[] = { label(0x31) dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, set_target_chr(CHR_BOND) - set_follow_chr(CHR_BOND) + set_chrpreset(CHR_BOND) if_stage_flag_eq(STAGEFLAG_ELVIS_GAVE_PROXYMINE, TRUE, /*goto*/ 0x31) if_objective_complete(0, /*goto*/ 0x31) if_objective_complete(1, /*goto*/ 0x31) @@ -1159,7 +1159,7 @@ u8 func0404_elvis[] = { if_objective_complete(4, /*goto*/ 0x31) if_chr_sees_player(/*goto*/ 0xa5) set_target_chr(CHR_COOP) - set_follow_chr(CHR_COOP) + set_chrpreset(CHR_COOP) if_chr_sees_player(/*goto*/ 0xa5) label(0x31) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x0a) @@ -1205,7 +1205,7 @@ u8 func0404_elvis[] = { // Sees player label(0xa5) set_target_chr(CHR_PRESET) - try_run_to_target_chr(/*goto*/ 0x12) + try_run_to_target(/*goto*/ 0x12) beginloop(0x12) dprint 'G','O',' ','T','O','W','A','R','D','S','\n',0, @@ -1273,7 +1273,7 @@ u8 func0418_robot[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x0d) - if_target_chr_in_sight(/*goto*/ 0x0d) + if_target_in_sight(/*goto*/ 0x0d) call_rng if_rand_gt(5, /*goto*/ 0x31) if_sound_finished(CHANNEL_5, /*goto*/ 0x08) @@ -1303,11 +1303,11 @@ u8 func0418_robot[] = { restart_timer if_chr_distance_lt(300, /*goto*/ 0x31) if_chr_distance_gt(1000, /*goto*/ 0x15) - if_target_chr_in_sight(/*goto*/ 0x13) + if_target_in_sight(/*goto*/ 0x13) // Distance > 1000 or not in sight label(0x15) - try_jog_to_target_chr(/*goto*/ 0x08) + try_jog_to_target(/*goto*/ 0x08) // Distance < 300 label(0x31) @@ -1323,10 +1323,10 @@ u8 func0418_robot[] = { if_timer_gt(180, /*goto*/ 0x08) if_chr_distance_gt(1000, /*goto*/ 0x15) dprint 'P','A','R','T',' ','2','\n',0, - if_target_chr_in_sight(/*goto*/ 0x13) + if_target_in_sight(/*goto*/ 0x13) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x13) + if_target_in_sight(/*goto*/ 0x13) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) label(0x15) @@ -1420,7 +1420,7 @@ u8 func041a_pres_clone[] = { set_target_chr(CHR_P1P2) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x31) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x08) - if_target_chr_in_sight(/*goto*/ 0x31) + if_target_in_sight(/*goto*/ 0x31) label(0x08) endloop(0x06) @@ -1578,9 +1578,9 @@ u8 func041d_president_running[] = { restart_timer label(0x31) if_chr_distance_gt(300, /*goto*/ 0x31) - try_jog_to_target_chr(/*goto*/ 0xa1) + try_jog_to_target(/*goto*/ 0xa1) label(0x31) - try_run_to_target_chr(/*goto*/ 0xa1) + try_run_to_target(/*goto*/ 0xa1) beginloop(0xa1) dprint 'F','O','L','L','O','W','\n',0, @@ -1608,7 +1608,7 @@ u8 func041d_president_running[] = { // Unreachable label(0xa3) - try_run_to_target_chr(/*goto*/ 0xa4) + try_run_to_target(/*goto*/ 0xa4) // Unreachable beginloop(0xa4) @@ -1738,7 +1738,7 @@ u8 func041f_trent_shooting[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) try_unset_chr_flag_bank3_02000000(CHR_SELF, /*goto*/ 0x31) - if_target_chr_in_sight(/*goto*/ 0x08) + if_target_in_sight(/*goto*/ 0x08) endloop(0x06) label(0x31) diff --git a/src/files/setup/setupcave.c b/src/files/setup/setupcave.c index c3084dd18..3138f2f5b 100644 --- a/src/files/setup/setupcave.c +++ b/src/files/setup/setupcave.c @@ -1192,7 +1192,7 @@ u8 func0407_stewardess[] = { if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x04) label(0x31) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x02) - if_target_chr_in_sight(/*goto*/ 0x04) + if_target_in_sight(/*goto*/ 0x04) label(0x02) if_timer_gt(120, /*goto*/ 0x16) endloop(0x11) @@ -1219,7 +1219,7 @@ u8 func0407_stewardess[] = { label(0x31) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x04) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x02) - if_target_chr_in_sight(/*goto*/ 0x04) + if_target_in_sight(/*goto*/ 0x04) label(0x02) if_chr_stopped(/*goto*/ 0x0b) endloop(0x00) @@ -1290,7 +1290,7 @@ u8 func0407_stewardess[] = { if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x4e) dprint 'W','A','L','K','I','N','G','\n',0, if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x31) - if_target_chr_in_sight(/*goto*/ 0x02) + if_target_in_sight(/*goto*/ 0x02) label(0x31) if_self_distance_to_chr_lt(200, 0xfb, /*goto*/ 0x4a) if_chr_stopped(/*goto*/ 0x4a) @@ -1517,7 +1517,7 @@ u8 func0408_secretary[] = { if_saw_death(0x00, /*goto*/ LABEL_BECOME_ALERT1) set_view_distance(14) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ LABEL_BECOME_ALERT1) - if_target_chr_in_sight(/*goto*/ 0x02) + if_target_in_sight(/*goto*/ 0x02) if_alarm_active2(/*goto*/ 0x67) endloop(LABEL_MAIN_LOOP) @@ -2065,7 +2065,7 @@ u8 func0409_office1[] = { beginloop(0x00) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x02) + if_target_in_sight(/*goto*/ 0x02) if_saw_injury(0x00, /*goto*/ LABEL_RUN_TO_FOYER) if_stage_flag_eq(STAGEFLAG_OFFICE2_DEAD, TRUE, /*goto*/ LABEL_RUN_TO_FOYER) if_object_in_good_condition(0x45, /*goto*/ 0x33) @@ -2427,10 +2427,10 @@ u8 func040f_nsa[] = { set_ailist(CHR_SELF, GAILIST_IDLE) label(0x44) - if_chr_distance_to_pad_lt(CHR_SELF, 70, TARGET_PAD, /*goto*/ 0x02) + if_chr_distance_to_pad_lt(CHR_SELF, 70, PAD_PRESET, /*goto*/ 0x02) // Return to pad - walk_to_pad(TARGET_PAD) + walk_to_pad(PAD_PRESET) beginloop(0x06) dprint 'G','O',' ','F','O','R',' ','P','A','D','\n',0, @@ -2457,7 +2457,7 @@ u8 func040f_nsa[] = { label(0x31) if_chr_sees_player(/*goto*/ 0x04) - if_chr_distance_to_pad_lt(CHR_SELF, 70, TARGET_PAD, /*goto*/ 0x02) + if_chr_distance_to_pad_lt(CHR_SELF, 70, PAD_PRESET, /*goto*/ 0x02) endloop(0x06) // At pad @@ -2527,14 +2527,14 @@ u8 func040f_nsa[] = { // Unreachable restart_timer set_target_chr(CHR_P1P2) - try_walk_to_target_chr(/*goto*/ 0x05) + try_walk_to_target(/*goto*/ 0x05) // Also unreachable label(0x31) dprint 'R','U','N',' ','S','T','A','R','T','\n',0, restart_timer set_target_chr(CHR_BOND) - try_run_to_target_chr(/*goto*/ 0x05) + try_run_to_target(/*goto*/ 0x05) beginloop(0x05) set_returnlist(CHR_SELF, GAILIST_ALERTED) @@ -2619,14 +2619,14 @@ u8 func0411_takeover_lackey[] = { if_chr_dying(0x0c, /*goto*/ 0x7b) if_chr_death_animation_finished(0x0c, /*goto*/ 0x7b) if_chr_unloaded(0x0c, /*goto*/ 0x7b) - if_target_chr_in_sight(/*goto*/ 0x31) + if_target_in_sight(/*goto*/ 0x31) goto_next(0x02) label(0x31) try_face_entity(0x0200, 0x0000, /*goto*/ 0x02) label(0x02) if_self_flag_bankx_eq(CHRFLAG0_00002000, FALSE, BANK_0, /*goto*/ 0x31) - if_target_chr_in_sight(/*goto*/ 0x02) + if_target_in_sight(/*goto*/ 0x02) label(0x31) endloop(0x00) @@ -2693,7 +2693,7 @@ u8 func0414_officeworker[] = { goto_next(0x08) label(0x02) - if_target_chr_in_sight(/*goto*/ 0x02) + if_target_in_sight(/*goto*/ 0x02) label(0x33) endloop(0x00) @@ -2732,7 +2732,7 @@ u8 func0414_officeworker[] = { beginloop(0x04) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x02) + if_target_in_sight(/*goto*/ 0x02) if_chr_idle(/*goto*/ 0x31) goto_first(0x77) @@ -3348,7 +3348,7 @@ u8 func0419_ba8c[] = { label(0x31) unset_self_flag_bankx(CHRFLAG1_DONE_SEARCH_ANIM, BANK_1) - if_chr_distance_to_pad_lt(CHR_SELF, 100, TARGET_PAD, /*goto*/ 0x02) + if_chr_distance_to_pad_lt(CHR_SELF, 100, PAD_PRESET, /*goto*/ 0x02) goto_next(0x31) label(0x02) @@ -3373,7 +3373,7 @@ u8 func0419_ba8c[] = { set_target_chr(CHR_P1P2) if_saw_death(0x00, /*goto*/ 0x4f) if_saw_injury(0x00, /*goto*/ 0x0f) - if_target_chr_in_sight(/*goto*/ 0x02) + if_target_in_sight(/*goto*/ 0x02) if_chr_stopped(/*goto*/ 0x73) if_chr_idle(/*goto*/ 0x31) if_timer_gt(180, /*goto*/ 0x73) @@ -3386,7 +3386,7 @@ u8 func0419_ba8c[] = { label(0x6c) if_saw_death(0x00, /*goto*/ 0x4f) if_saw_injury(0x00, /*goto*/ 0x0f) - if_target_chr_in_sight(/*goto*/ 0x02) + if_target_in_sight(/*goto*/ 0x02) goto_first(0x00) label(0x02) diff --git a/src/files/setup/setupdam.c b/src/files/setup/setupdam.c index 77bef4b70..521faddb5 100644 --- a/src/files/setup/setupdam.c +++ b/src/files/setup/setupdam.c @@ -1887,7 +1887,7 @@ u8 func0401_pilot[] = { beginloop(0x00) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x07) + if_target_in_sight(/*goto*/ 0x07) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x04) endloop(0x00) @@ -2201,7 +2201,7 @@ u8 func0404_angry_pilot[] = { label(0x04) restart_timer - try_run_to_target_chr(/*goto*/ 0x6d) + try_run_to_target(/*goto*/ 0x6d) beginloop(0x6d) if_in_disarm_range(/*goto*/ 0x07) @@ -2515,7 +2515,7 @@ u8 func0415_elvis_at_start[] = { label(0x07) unset_self_flag_bankx(CHRFLAG1_DONE_SEARCH_ANIM, BANK_1) if_chr_in_room(CHR_SELF, 0x00, 0x0029, /*goto*/ 0x04) - set_target_pad(0x0040) + set_padpreset(0x0040) goto_next(0x07) label(0x04) @@ -2609,7 +2609,7 @@ u8 func0416_elvis_leading[] = { label(0x04) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x0b) - set_target_pad(0x0096) + set_padpreset(0x0096) label(0x12) label(0x04) run_to_pad(0x0096) diff --git a/src/files/setup/setupdish.c b/src/files/setup/setupdish.c index da713a6cb..2866a1099 100644 --- a/src/files/setup/setupdish.c +++ b/src/files/setup/setupdish.c @@ -572,7 +572,7 @@ u8 func041e_colleague[] = { beginloop(0x04) // Wait until player in sight and not doing idle animations already - if_target_chr_in_sight(/*goto*/ 0x2f) + if_target_in_sight(/*goto*/ 0x2f) if_chr_idle(/*goto*/ 0x06) if_self_flag_bankx_eq(CHRFLAG1_DOINGIDLEANIMATION, FALSE, BANK_1, /*goto*/ 0x7f) chr_do_animation(0x0227, 0, -1, 0x14, 0x00, CHR_SELF, 2) @@ -623,7 +623,7 @@ u8 func041e_colleague[] = { try_face_entity(0x0200, 0x0000, /*goto*/ 0x59) beginloop(0x59) - if_target_chr_in_sight(/*goto*/ 0x06) + if_target_in_sight(/*goto*/ 0x06) endloop(0x59) label(0x06) @@ -654,7 +654,7 @@ u8 func041e_colleague[] = { beginloop(0x0a) if_timer_lt(600, /*goto*/ 0x2f) - if_target_chr_in_sight(/*goto*/ 0x06) + if_target_in_sight(/*goto*/ 0x06) goto_next(0x2f) label(0x06) @@ -2450,7 +2450,7 @@ u8 func0429_grimshaw_disguise[] = { // Wait until Jo in sight beginloop(0x04) if_stage_flag_eq(STAGEFLAG_DEVICE_ABORTING, TRUE, /*goto*/ 0x0d) - if_target_chr_in_sight(/*goto*/ 0x2f) + if_target_in_sight(/*goto*/ 0x2f) if_chr_idle(/*goto*/ 0x06) label(0x7f) call_rng @@ -2639,7 +2639,7 @@ u8 func042a_carrington_cloak[] = { dprint 'I','n','i','t','i','a','l','i','s','e','a',0, beginloop(0x04) - if_target_chr_in_sight(/*goto*/ 0x2f) + if_target_in_sight(/*goto*/ 0x2f) if_chr_idle(/*goto*/ 0x06) label(0x7f) call_rng @@ -2940,7 +2940,7 @@ u8 func042c_carrington_tour[] = { label(0x2f) if_chr_sees_player(/*goto*/ 0x06) - try_jog_to_target_chr(/*goto*/ 0x08) + try_jog_to_target(/*goto*/ 0x08) beginloop(0x08) if_chr_sees_player(/*goto*/ 0x06) @@ -4782,7 +4782,7 @@ u8 func0409_holo5_guard2[] = { if_chr_death_animation_finished(CHR_SELF, /*goto*/ 0x2f) if_chr_dying(CHR_SELF, /*goto*/ 0x2f) if_chr_unloaded(CHR_SELF, /*goto*/ 0x2f) - if_target_chr_in_sight(/*goto*/ 0x09) + if_target_in_sight(/*goto*/ 0x09) unset_self_chrflag(CHRCFLAG_INVINCIBLE_TO_GUNFIRE) set_alertness(0) goto_first(0x08) @@ -5098,7 +5098,7 @@ u8 func0416_holo_guard_unarmed_alert[] = { if_chr_injured_target(CHR_SELF, /*goto*/ 0x09) label(0x8f) restart_timer - try_run_to_target_chr(/*goto*/ 0x08) + try_run_to_target(/*goto*/ 0x08) beginloop(0x08) if_chr_stopped(/*goto*/ 0x06) @@ -5150,7 +5150,7 @@ u8 func0416_holo_guard_unarmed_alert2[] = { if_chr_distance_gt(400, /*goto*/ 0x10) if_chr_distance_lt(100, /*goto*/ 0x06) restart_timer - try_run_to_target_chr(/*goto*/ 0x08) + try_run_to_target(/*goto*/ 0x08) beginloop(0x08) if_chr_dying(CHR_TARGET, /*goto*/ 0x57) diff --git a/src/files/setup/setupear.c b/src/files/setup/setupear.c index 44d17ab4c..2d5f960ec 100644 --- a/src/files/setup/setupear.c +++ b/src/files/setup/setupear.c @@ -940,7 +940,7 @@ u8 func0404_scientist[] = { beginloop(0x04) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x2f) + if_target_in_sight(/*goto*/ 0x2f) if_chr_distance_lt(500, /*goto*/ 0x2f) endloop(0x04) @@ -2314,8 +2314,8 @@ u8 func0416_intro[] = { endloop(0x08) label(0x77) - open_door2(0x24) - open_door2(0x40) + set_door_open(0x24) + set_door_open(0x40) unset_chr_chrflag(CHR_BOND, CHRCFLAG_UNPLAYABLE) unset_chr_chrflag(CHR_BOND, CHRCFLAG_00010000) set_chr_hiddenflag(CHR_BOND, CHRHFLAG_00020000) @@ -2825,7 +2825,7 @@ u8 func0402_k7_guard[] = { beginloop(0x0f) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - set_follow_chr(CHR_P1P2) + set_chrpreset(CHR_P1P2) if_chr_in_room(CHR_TARGET, 0x00, 0x0036, /*goto*/ 0x03) if_chr_in_room(CHR_TARGET, 0x00, 0x0037, /*goto*/ 0x03) if_chr_in_room(CHR_TARGET, 0x00, 0x003a, /*goto*/ 0x03) @@ -2842,7 +2842,7 @@ u8 func0402_k7_guard[] = { beginloop(0x04) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x0c) + if_target_in_sight(/*goto*/ 0x0c) if_near_miss(/*goto*/ 0x0c) if_num_times_shot_gt(0, /*goto*/ 0x0c) if_saw_injury(0x00, /*goto*/ 0x0c) @@ -2860,7 +2860,7 @@ u8 func0402_k7_guard[] = { beginloop(0x08) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x0c) + if_target_in_sight(/*goto*/ 0x0c) if_near_miss(/*goto*/ 0x0c) if_num_times_shot_gt(0, /*goto*/ 0x0c) if_saw_injury(0x00, /*goto*/ 0x0c) @@ -2896,7 +2896,7 @@ u8 func0402_k7_guard[] = { beginloop(0x09) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x0c) + if_target_in_sight(/*goto*/ 0x0c) if_near_miss(/*goto*/ 0x0c) if_num_times_shot_gt(0, /*goto*/ 0x0c) if_saw_injury(0x00, /*goto*/ 0x0c) @@ -2910,7 +2910,7 @@ u8 func0402_k7_guard[] = { beginloop(0x0a) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x0c) + if_target_in_sight(/*goto*/ 0x0c) if_near_miss(/*goto*/ 0x0c) if_num_times_shot_gt(0, /*goto*/ 0x0c) if_saw_injury(0x00, /*goto*/ 0x0c) @@ -2943,7 +2943,7 @@ u8 func0403_k7_scientist[] = { beginloop(0x08) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x0c) + if_target_in_sight(/*goto*/ 0x0c) if_near_miss(/*goto*/ 0x0c) if_num_times_shot_gt(0, /*goto*/ 0x0c) if_saw_injury(0x00, /*goto*/ 0x0c) @@ -2973,7 +2973,7 @@ u8 func0403_k7_scientist[] = { beginloop(0x0f) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x0c) + if_target_in_sight(/*goto*/ 0x0c) if_near_miss(/*goto*/ 0x0c) if_num_times_shot_gt(0, /*goto*/ 0x0c) if_saw_injury(0x00, /*goto*/ 0x0c) diff --git a/src/files/setup/setupeld.c b/src/files/setup/setupeld.c index deee9d2a1..87dfca6b6 100644 --- a/src/files/setup/setupeld.c +++ b/src/files/setup/setupeld.c @@ -1598,7 +1598,7 @@ u8 func0402_taker[] = { goto_first(0x03) label(0x10) - try_walk_to_target_chr(/*goto*/ 0x0d) + try_walk_to_target(/*goto*/ 0x0d) beginloop(0x0d) if_self_flag_bankx_eq(CHRFLAG0_NOHEAR, FALSE, BANK_0, /*goto*/ 0x06) @@ -1794,7 +1794,7 @@ u8 func0404_sniper[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) dprint 'S','T','A','R','T','\n',0, - if_target_chr_in_sight(/*goto*/ 0x58) + if_target_in_sight(/*goto*/ 0x58) // Choose a direction to face call_rng @@ -1825,7 +1825,7 @@ u8 func0404_sniper[] = { beginloop(0x0a) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x58) + if_target_in_sight(/*goto*/ 0x58) if_saw_death(0x00, /*goto*/ 0x58) if_saw_injury(0x00, /*goto*/ 0x58) dprint 'F','A','C','E','\n',0, @@ -1860,7 +1860,7 @@ u8 func0404_sniper[] = { yield chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x58) + if_target_in_sight(/*goto*/ 0x58) if_saw_death(0x00, /*goto*/ 0x58) if_saw_injury(0x00, /*goto*/ 0x58) dprint 'R','U','N','\n',0, diff --git a/src/files/setup/setupimp.c b/src/files/setup/setupimp.c index 4b5eee37b..5641ff462 100644 --- a/src/files/setup/setupimp.c +++ b/src/files/setup/setupimp.c @@ -690,16 +690,16 @@ u8 func0408_clone3[] = { u8 func0413_defend_pad[] = { set_shotlist(AILIST_DEFEND_PAD) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x0a) - if_chr_distance_to_pad_lt(CHR_SELF, 200, TARGET_PAD, /*goto*/ 0x08) + if_chr_distance_to_pad_lt(CHR_SELF, 200, PAD_PRESET, /*goto*/ 0x08) // Distance to pad >= 200 label(0x03) - jog_to_pad(TARGET_PAD) + jog_to_pad(PAD_PRESET) beginloop(0x04) dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2540, /*goto*/ 0x0a) - if_chr_distance_to_pad_lt(CHR_SELF, 200, TARGET_PAD, /*goto*/ 0x08) + if_chr_distance_to_pad_lt(CHR_SELF, 200, PAD_PRESET, /*goto*/ 0x08) endloop(0x04) // At pad @@ -709,7 +709,7 @@ u8 func0413_defend_pad[] = { beginloop(0x0b) dprint 'A','T',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2540, /*goto*/ 0x0a) - if_chr_distance_to_pad_gt(CHR_SELF, 300, TARGET_PAD, /*goto*/ 0x08) + if_chr_distance_to_pad_gt(CHR_SELF, 300, PAD_PRESET, /*goto*/ 0x08) endloop(0x0b) label(0x08) @@ -1609,7 +1609,7 @@ u8 func0414_firingrange_hostage[] = { goto_next(0x12) label(0x03) - jog_to_pad(TARGET_PAD) + jog_to_pad(PAD_PRESET) beginloop(0x04) dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, @@ -1974,11 +1974,11 @@ u8 func0425_hostage_thank_and_run[] = { label(0x03) set_target_chr(CHR_COOP) if_chr_sees_player(/*goto*/ 0x2e) - set_follow_chr(CHR_BOND) + set_chrpreset(CHR_BOND) goto_next(0x08) label(0x2e) - set_follow_chr(CHR_COOP) + set_chrpreset(CHR_COOP) label(0x08) restart_timer @@ -2066,11 +2066,11 @@ u8 func0427_drop_devastator[] = { label(0x03) set_target_chr(CHR_COOP) if_chr_sees_player(/*goto*/ 0x2e) - set_follow_chr(CHR_BOND) + set_chrpreset(CHR_BOND) goto_next(0x08) label(0x2e) - set_follow_chr(CHR_COOP) + set_chrpreset(CHR_COOP) label(0x08) restart_timer @@ -2252,7 +2252,7 @@ u8 func042e_taker_device_m[] = { beginloop(0x0a) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x08) + if_target_in_sight(/*goto*/ 0x08) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x08) endloop(0x0a) @@ -2304,7 +2304,7 @@ u8 func0430_taker_device_f[] = { beginloop(0x0a) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x08) + if_target_in_sight(/*goto*/ 0x08) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x08) endloop(0x0a) @@ -3028,7 +3028,7 @@ u8 func040c_init_clone4[] = { u8 func040b_clone4[] = { set_target_chr(CHR_BOND) - try_run_to_target_chr(/*goto*/ 0x2e) + try_run_to_target(/*goto*/ 0x2e) label(0x2e) set_ailist(CHR_SELF, GAILIST_ALERTED) endlist @@ -3147,7 +3147,7 @@ u8 func0412_init_clone6[] = { u8 func0411_clone6[] = { set_target_chr(CHR_BOND) - try_run_to_target_chr(/*goto*/ 0x2e) + try_run_to_target(/*goto*/ 0x2e) label(0x2e) set_ailist(CHR_SELF, GAILIST_ALERTED) endlist diff --git a/src/files/setup/setuplee.c b/src/files/setup/setuplee.c index cd20cf414..8c094032a 100644 --- a/src/files/setup/setuplee.c +++ b/src/files/setup/setuplee.c @@ -713,7 +713,7 @@ u8 func040e_elvis_give_ar34[] = { beginloop(0x04) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - set_follow_chr(CHR_P1P2) + set_chrpreset(CHR_P1P2) if_chr_sees_player(/*goto*/ 0x2c) endloop(0x04) @@ -726,7 +726,7 @@ u8 func040e_elvis_give_ar34[] = { // Run towards player label(0x0a) restart_timer - try_run_to_target_chr(/*goto*/ 0x09) + try_run_to_target(/*goto*/ 0x09) beginloop(0x09) set_target_chr(CHR_PRESET) @@ -825,11 +825,11 @@ u8 func0409_elvis_follow[] = { set_target_chr(CHR_PRESET) restart_timer if_chr_distance_gt(500, /*goto*/ 0x06) - try_jog_to_target_chr(/*goto*/ 0x04) + try_jog_to_target(/*goto*/ 0x04) // Distance < 200 or distance > 500 label(0x06) - try_run_to_target_chr(/*goto*/ 0x04) + try_run_to_target(/*goto*/ 0x04) beginloop(0x04) if_stage_flag_eq(STAGEFLAG_NAVIGATION_ROOM_DONE, TRUE, /*goto*/ 0x2c) @@ -875,7 +875,7 @@ u8 func0409_elvis_follow[] = { if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0x2c) if_chr_dying(CHR_TARGET, /*goto*/ 0x2c) if_chr_unloaded(CHR_TARGET, /*goto*/ 0x2c) - if_target_chrs_target_is_different(/*goto*/ 0x06) + if_chrpresets_target_is_different(/*goto*/ 0x06) label(0x2c) goto_first(0x03) @@ -1001,7 +1001,7 @@ u8 func040a_elvis_go_to_hangar_lift[] = { goto_next(0xc3) label(0x06) - try_run_to_target_chr(/*goto*/ 0x04) + try_run_to_target(/*goto*/ 0x04) beginloop(0x04) if_timer_gt(60, /*goto*/ 0x2c) @@ -1147,7 +1147,7 @@ u8 func0410_wake_suspendedanim_skedar[] = { set_recovery_speed(0) set_shield(0) set_target_chr(CHR_BOND) - try_walk_to_target_chr(/*goto*/ 0x2c) + try_walk_to_target(/*goto*/ 0x2c) label(0x2c) set_shotlist(GAILIST_RELATED_TO_SPAWNING) @@ -1486,7 +1486,7 @@ u8 func0408_knifeable_skedar[] = { chr_toggle_p1p2(CHR_SELF) if_stage_flag_eq(STAGEFLAG_CASS_AT_PAD, TRUE, /*goto*/ 0x06) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x0c) + if_target_in_sight(/*goto*/ 0x0c) set_target_chr(CHR_CASS) if_just_injured(CHR_SELF, /*goto*/ 0x0c) endloop(0x04) @@ -1508,7 +1508,7 @@ u8 func0408_knifeable_skedar[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_chr_stopped(/*goto*/ 0x06) - if_target_chr_in_sight(/*goto*/ 0x0c) + if_target_in_sight(/*goto*/ 0x0c) if_just_injured(CHR_SELF, /*goto*/ 0x0c) endloop(0x0a) @@ -1522,7 +1522,7 @@ u8 func0408_knifeable_skedar[] = { chr_toggle_p1p2(CHR_SELF) if_timer_gt(600, /*goto*/ 0x06) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x0c) + if_target_in_sight(/*goto*/ 0x0c) if_just_injured(CHR_SELF, /*goto*/ 0x0c) set_target_chr(CHR_CASS) endloop(0x0b) @@ -1539,7 +1539,7 @@ u8 func0408_knifeable_skedar[] = { dprint 'W','A','I','T','I','N','G',' ','T','W','O','\n',0, if_chr_stopped(/*goto*/ 0x0d) label(0x06) - if_target_chr_in_sight(/*goto*/ 0x0c) + if_target_in_sight(/*goto*/ 0x0c) label(0x2c) endloop(0x0a) @@ -1740,12 +1740,12 @@ u8 func0419_hangar_maian[] = { // to go to the label 0x06 just prior to "AT PAD", but that is not the next // label from here. Also, SPEED_RUN will always be used because SPEED_JOG // lacks a goto_next 0x04. - if_chr_distance_to_pad_lt(CHR_SELF, 200, TARGET_PAD, /*goto*/ 0x06) + if_chr_distance_to_pad_lt(CHR_SELF, 200, PAD_PRESET, /*goto*/ 0x06) // Distance to pad >= 200 label(0x03) restart_timer - if_chr_distance_to_pad_gt(CHR_SELF, 500, TARGET_PAD, /*goto*/ 0x06) + if_chr_distance_to_pad_gt(CHR_SELF, 500, PAD_PRESET, /*goto*/ 0x06) go_to_target_pad(SPEED_JOG) // Intended: Distance to pad > 500 @@ -1756,7 +1756,7 @@ u8 func0419_hangar_maian[] = { beginloop(0x04) dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08) - if_chr_distance_to_pad_lt(CHR_SELF, 200, TARGET_PAD, /*goto*/ 0x06) + if_chr_distance_to_pad_lt(CHR_SELF, 200, PAD_PRESET, /*goto*/ 0x06) if_timer_gt(60, /*goto*/ 0x2c) endloop(0x04) @@ -1771,7 +1771,7 @@ u8 func0419_hangar_maian[] = { beginloop(0x09) dprint 'A','T',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08) - if_chr_distance_to_pad_gt(CHR_SELF, 300, TARGET_PAD, /*goto*/ 0x06) + if_chr_distance_to_pad_gt(CHR_SELF, 300, PAD_PRESET, /*goto*/ 0x06) endloop(0x09) label(0x06) @@ -2293,7 +2293,7 @@ u8 func041a_bridgeclone[] = { if_chr_distance_lt(150, /*goto*/ 0x2e) label(0xc5) restart_timer - try_walk_to_target_chr(/*goto*/ 0x08) + try_walk_to_target(/*goto*/ 0x08) beginloop(0x08) if_chr_dying(CHR_SELF, /*goto*/ 0xb8) @@ -2305,7 +2305,7 @@ u8 func041a_bridgeclone[] = { label(0x09) restart_timer - try_run_to_target_chr(/*goto*/ 0x0a) + try_run_to_target(/*goto*/ 0x0a) // Start running beginloop(0x0a) @@ -2990,7 +2990,7 @@ u8 func0421_bridge_skedar[] = { label(0x2c) set_target_chr(CHR_P1P2) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x06) - if_target_chr_in_sight(/*goto*/ 0xc8) + if_target_in_sight(/*goto*/ 0xc8) label(0x06) if_saw_injury(0x00, /*goto*/ 0xc8) if_near_miss(/*goto*/ 0xc9) @@ -3000,7 +3000,7 @@ u8 func0421_bridge_skedar[] = { label(0x06) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x2c) - if_target_chr_in_sight(/*goto*/ 0xc8) + if_target_in_sight(/*goto*/ 0xc8) label(0x2c) set_target_chr(CHR_BOND) endloop(0xc7) @@ -3045,7 +3045,7 @@ u8 func0421_bridge_skedar[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x06) - if_target_chr_in_sight(/*goto*/ 0xce) + if_target_in_sight(/*goto*/ 0xce) label(0x06) if_timer_gt(60, /*goto*/ 0xcf) if_rand_lt(4, /*goto*/ 0xcf) @@ -3216,7 +3216,7 @@ u8 func0423_shy_skedar[] = { label(0x03) set_target_chr(CHR_CASS) restart_timer - try_run_to_target_chr(/*goto*/ 0x08) + try_run_to_target(/*goto*/ 0x08) beginloop(0x08) if_chr_stopped(/*goto*/ 0x06) @@ -3236,7 +3236,7 @@ u8 func0423_shy_skedar[] = { beginloop(0x09) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x2d) + if_target_in_sight(/*goto*/ 0x2d) if_chr_distance_to_pad_lt(CHR_SELF, 200, 0x00da, /*goto*/ 0x2d) if_chr_stopped(/*goto*/ 0x2d) endloop(0x09) diff --git a/src/files/setup/setuplip.c b/src/files/setup/setuplip.c index 3fe4f0fd5..0faaf0c41 100644 --- a/src/files/setup/setuplip.c +++ b/src/files/setup/setuplip.c @@ -1344,7 +1344,7 @@ u8 func0410_labtech_showers_sa_pa[] = { beginloop(0x04) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x2d) + if_target_in_sight(/*goto*/ 0x2d) if_chr_distance_lt(500, /*goto*/ 0x03) endloop(0x04) @@ -1451,7 +1451,7 @@ u8 func0410_labtech_showers_sa_pa[] = { if_rand_gt(25, /*goto*/ 0x06) speak(CHR_TARGET, 0x2a2d, 0x1b34, CHANNEL_4, COLOR_08_RED) // "Give me my clothes." label(0x06) - try_run_to_target_chr(/*goto*/ 0x6f) + try_run_to_target(/*goto*/ 0x6f) restart_timer beginloop(0x6f) @@ -1718,7 +1718,7 @@ u8 func0418_doorman[] = { beginloop(0x04) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x03) + if_target_in_sight(/*goto*/ 0x03) if_chr_distance_lt(500, /*goto*/ 0x03) endloop(0x04) @@ -1951,7 +1951,7 @@ u8 func041a_labtech_harrysmate[] = { beginloop(0x08) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x2d) - if_target_chr_in_sight(/*goto*/ 0x2d) + if_target_in_sight(/*goto*/ 0x2d) if_chr_distance_lt(500, /*goto*/ 0x2d) endloop(0x08) @@ -2047,7 +2047,7 @@ u8 func041b_labtech_keycardguy[] = { beginloop(0x08) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x2d) + if_target_in_sight(/*goto*/ 0x2d) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x2d) endloop(0x08) @@ -2436,7 +2436,7 @@ u8 func0415_warehouse_spawner[] = { u8 func0417_warehouse_clone[] = { set_target_chr(CHR_BOND) set_alertness(100) - try_run_to_target_chr(/*goto*/ 0x2d) + try_run_to_target(/*goto*/ 0x2d) label(0x2d) set_returnlist(CHR_SELF, GAILIST_UNALERTED) set_ailist(CHR_SELF, GAILIST_UNALERTED) @@ -2618,7 +2618,7 @@ u8 func041f_labtech_lights[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_self_flag_bankx_eq(CHRFLAG0_00002000, TRUE, BANK_0, /*goto*/ 0x53) - if_target_chr_in_sight(/*goto*/ 0x03) + if_target_in_sight(/*goto*/ 0x03) if_chr_idle(/*goto*/ 0x06) goto_first(0x5e) @@ -2682,7 +2682,7 @@ u8 func041f_labtech_lights[] = { label(0x0a) set_target_chr(CHR_BOND) restart_timer - try_run_to_target_chr(/*goto*/ 0x0b) + try_run_to_target(/*goto*/ 0x0b) beginloop(0x0b) if_timer_gt(60, /*goto*/ 0x06) @@ -2703,7 +2703,7 @@ u8 func041f_labtech_lights[] = { beginloop(0x0d) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x2d) + if_target_in_sight(/*goto*/ 0x2d) if_saw_injury(0x00, /*goto*/ 0x0f) label(0x2d) if_chr_weapon_equipped(CHR_TARGET, WEAPON_NONE, /*goto*/ 0x2d) @@ -2741,7 +2741,7 @@ u8 func041f_labtech_lights[] = { beginloop(0x0e) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x2d) + if_target_in_sight(/*goto*/ 0x2d) if_saw_injury(0x00, /*goto*/ 0x0f) label(0x2d) if_chr_weapon_equipped(CHR_TARGET, WEAPON_NONE, /*goto*/ 0x2d) @@ -3065,7 +3065,7 @@ u8 func0422_labtech_records[] = { label(0x2d) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x03) + if_target_in_sight(/*goto*/ 0x03) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x03) if_chr_distance_lt(500, /*goto*/ 0x03) goto_first(0x04) diff --git a/src/files/setup/setuplue.c b/src/files/setup/setuplue.c index 14a60ee12..2d3c7bcd6 100644 --- a/src/files/setup/setuplue.c +++ b/src/files/setup/setuplue.c @@ -1597,7 +1597,7 @@ u8 func0416_mechanic[] = { set_target_chr(CHR_P1P2) if_stage_flag_eq(STAGEFLAG_TRIGGER_INTERCEPTOR, TRUE, /*goto*/ 0x2f) if_just_injured(CHR_SELF, /*goto*/ 0x2e) - if_target_chr_in_sight(/*goto*/ 0x2e) + if_target_in_sight(/*goto*/ 0x2e) if_chr_stopped(/*goto*/ 0x06) endloop(0x09) @@ -1619,7 +1619,7 @@ u8 func0416_mechanic[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_heard_target_recently(/*goto*/ 0x2e) - if_target_chr_in_sight(/*goto*/ 0x2e) + if_target_in_sight(/*goto*/ 0x2e) if_chr_stopped(/*goto*/ 0x06) endloop(0x0d) @@ -2887,7 +2887,7 @@ u8 func0421_activate_autogun[] = { beginloop(0x04) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x2e) + if_target_in_sight(/*goto*/ 0x2e) if_heard_target_recently(/*goto*/ 0x2e) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x2e) endloop(0x04) diff --git a/src/files/setup/setupoat.c b/src/files/setup/setupoat.c index 3913c376b..52b8b38a9 100644 --- a/src/files/setup/setupoat.c +++ b/src/files/setup/setupoat.c @@ -169,16 +169,16 @@ u8 func0403_init_some_sound[] = { u8 func0407_defend_pad[] = { set_shotlist(0x0407) if_enemy_distance_lt_and_los(2540, /*goto*/ 0xa5) - if_chr_distance_to_pad_lt(CHR_SELF, 200, TARGET_PAD, /*goto*/ 0x01) + if_chr_distance_to_pad_lt(CHR_SELF, 200, PAD_PRESET, /*goto*/ 0x01) // Go to target pad, but stop when seen player or when near pad label(0xdb) - jog_to_pad(TARGET_PAD) + jog_to_pad(PAD_PRESET) label(0xdc) yield dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2540, /*goto*/ 0xa5) - if_chr_distance_to_pad_lt(CHR_SELF, 200, TARGET_PAD, /*goto*/ 0x01) + if_chr_distance_to_pad_lt(CHR_SELF, 200, PAD_PRESET, /*goto*/ 0x01) goto_first(0xdc) // Near pad. Wait until detected player. @@ -188,7 +188,7 @@ u8 func0407_defend_pad[] = { yield dprint 'A','T',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2540, /*goto*/ 0xa5) - if_chr_distance_to_pad_gt(CHR_SELF, 300, TARGET_PAD, /*goto*/ 0x01) + if_chr_distance_to_pad_gt(CHR_SELF, 300, PAD_PRESET, /*goto*/ 0x01) goto_first(0xa6) label(0x01) diff --git a/src/files/setup/setuppam.c b/src/files/setup/setuppam.c index 1e4f0b521..e0db75c7e 100644 --- a/src/files/setup/setuppam.c +++ b/src/files/setup/setuppam.c @@ -801,11 +801,11 @@ u8 func0402_elvis_follow_and_reactive_teleportals[] = { set_target_chr(CHR_PRESET) restart_timer if_chr_distance_gt(300, /*goto*/ 0x06) - try_jog_to_target_chr(/*goto*/ 0x04) + try_jog_to_target(/*goto*/ 0x04) // Jo distance < 200 or distance > 300 label(0x06) - try_run_to_target_chr(/*goto*/ 0x04) + try_run_to_target(/*goto*/ 0x04) beginloop(0x04) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x2e) @@ -974,9 +974,9 @@ u8 func0404_elvis_follow_and_do_agent_megaweapon[] = { set_target_chr(CHR_PRESET) restart_timer if_chr_distance_gt(300, /*goto*/ 0x06) - try_jog_to_target_chr(/*goto*/ 0x04) + try_jog_to_target(/*goto*/ 0x04) label(0x06) - try_run_to_target_chr(/*goto*/ 0x04) + try_run_to_target(/*goto*/ 0x04) beginloop(0x04) if_stage_flag_eq(STAGEFLAG_AGENT_MEGAWEAPON_DISABLED, TRUE, /*goto*/ 0x2e) @@ -1111,9 +1111,9 @@ u8 func0405_elvis_follow_nocombat[] = { set_target_chr(CHR_PRESET) restart_timer if_chr_distance_gt(300, /*goto*/ 0x06) - try_jog_to_target_chr(/*goto*/ 0x04) + try_jog_to_target(/*goto*/ 0x04) label(0x06) - try_run_to_target_chr(/*goto*/ 0x04) + try_run_to_target(/*goto*/ 0x04) beginloop(0x04) label(0x2e) @@ -1367,9 +1367,9 @@ u8 func0403_elvis_give_farsight[] = { set_target_chr(CHR_PRESET) restart_timer if_chr_distance_gt(300, /*goto*/ 0x06) - try_jog_to_target_chr(/*goto*/ 0x04) + try_jog_to_target(/*goto*/ 0x04) label(0x06) - try_run_to_target_chr(/*goto*/ 0x04) + try_run_to_target(/*goto*/ 0x04) beginloop(0x04) dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, @@ -3194,7 +3194,7 @@ u8 func041d_sniper[] = { label(0x06) dprint '2','\n',0, - set_follow_chr(CHR_TARGET) + set_chrpreset(CHR_TARGET) goto_next(0x06) // Unreachable @@ -3441,7 +3441,7 @@ u8 func040f_miniskedar[] = { restart_timer if_enemy_distance_lt_and_los(2540, /*goto*/ 0x06) label(0x06) - try_run_to_target_chr(/*goto*/ 0x0a) + try_run_to_target(/*goto*/ 0x0a) beginloop(0x0a) if_chr_sees_player(/*goto*/ 0x2e) diff --git a/src/files/setup/setuppete.c b/src/files/setup/setuppete.c index 9bc197aa1..5e578620d 100644 --- a/src/files/setup/setuppete.c +++ b/src/files/setup/setuppete.c @@ -976,7 +976,7 @@ u8 func040c_taxi[] = { }; #define tracerbug_logic(chr, chr2) \ - set_follow_chr(chr) \ + set_chrpreset(chr) \ if_difficulty_lt(DIFF_PA, /*goto*/ 0x54) \ goto_next(0x04) \ \ @@ -1374,7 +1374,7 @@ u8 func0412_cia[] = { label(0x03) unset_self_flag_bankx(CHRFLAG1_DONE_SEARCH_ANIM, BANK_1) cmd0049(0x003e, /*goto*/ 0x04) - set_target_pad(0x00ba) + set_padpreset(0x00ba) goto_next(0x03) label(0x04) @@ -1399,7 +1399,7 @@ u8 func0412_cia[] = { set_target_chr(CHR_P1P2) if_saw_death(0x00, /*goto*/ 0x1d) if_saw_injury(0x00, /*goto*/ 0x1e) - if_target_chr_in_sight(/*goto*/ 0x04) + if_target_in_sight(/*goto*/ 0x04) if_chr_stopped(/*goto*/ 0x35) endloop(0x36) @@ -1409,7 +1409,7 @@ u8 func0412_cia[] = { label(0x37) if_saw_death(0x00, /*goto*/ 0x1d) if_saw_injury(0x00, /*goto*/ 0x1e) - if_target_chr_in_sight(/*goto*/ 0x04) + if_target_in_sight(/*goto*/ 0x04) goto_first(0x10) label(0x04) @@ -1574,7 +1574,7 @@ u8 func0413_bugspotter[] = { beginloop(0x10) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x04) + if_target_in_sight(/*goto*/ 0x04) if_stage_flag_eq(STAGEFLAG_LIMO_READY_TO_LEAVE, TRUE, /*goto*/ LABEL_RUN_AWAY) if_stage_flag_eq(STAGEFLAG_TRACERBUG_PLACED, TRUE, /*goto*/ LABEL_RUN_AWAY) if_stage_flag_eq(STAGEFLAG_TAXI_READY_TO_CRASH, TRUE, /*goto*/ LABEL_RUN_AWAY) @@ -1615,10 +1615,10 @@ u8 func0413_bugspotter[] = { label(0x03) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x03) + if_target_in_sight(/*goto*/ 0x03) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x03) + if_target_in_sight(/*goto*/ 0x03) goto_next(0x0a) label(0x03) if_stage_flag_eq(STAGEFLAG_TRACERBUG_SAFE, TRUE, /*goto*/ 0x0a) @@ -1828,7 +1828,7 @@ u8 func041d_fbi[] = { goto_next(0x16) label(0x04) - if_target_chr_in_sight(/*goto*/ 0x18) + if_target_in_sight(/*goto*/ 0x18) if_near_miss(/*goto*/ 0x18) if_num_times_shot_gt(0, /*goto*/ 0x18) if_hears_gunfire(/*goto*/ 0x16) @@ -1848,14 +1848,14 @@ u8 func041d_fbi[] = { label(0x04) dprint 'T','R','A','C','K',' ','P','L','A','Y','E','R','\n',0, - try_jog_to_target_chr(/*goto*/ 0x06) + try_jog_to_target(/*goto*/ 0x06) beginloop(0x06) if_chr_distance_lt(500, /*goto*/ 0x18) - if_target_chr_in_sight(/*goto*/ 0x18) + if_target_in_sight(/*goto*/ 0x18) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x18) + if_target_in_sight(/*goto*/ 0x18) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) endloop(0x06) @@ -1977,7 +1977,7 @@ u8 func041a_robot[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_stage_flag_eq(STAGEFLAG_TRIGGER_CRASH, TRUE, /*goto*/ 0x01) - if_target_chr_in_sight(/*goto*/ 0x08) + if_target_in_sight(/*goto*/ 0x08) call_rng if_rand_gt(5, /*goto*/ 0x03) if_sound_finished(CHANNEL_5, /*goto*/ 0x04) @@ -2033,7 +2033,7 @@ u8 func041a_robot[] = { if_stage_flag_eq(STAGEFLAG_TRIGGER_CRASH, TRUE, /*goto*/ 0x01) if_timer_gt(120, /*goto*/ 0x04) if_self_flag_bankx_eq(CHRFLAG0_00002000, FALSE, BANK_0, /*goto*/ 0x2a) - if_target_chr_in_sight(/*goto*/ 0x03) + if_target_in_sight(/*goto*/ 0x03) label(0x2a) endloop(0x05) @@ -2103,7 +2103,7 @@ u8 func041e_sealer1[] = { goto_next(LABEL_ALERTED) label(0x04) - if_target_chr_in_sight(/*goto*/ LABEL_ALERTED) + if_target_in_sight(/*goto*/ LABEL_ALERTED) if_near_miss(/*goto*/ LABEL_ALERTED) if_num_times_shot_gt(0, /*goto*/ LABEL_ALERTED) if_hears_gunfire(/*goto*/ LABEL_ALERTED) @@ -2678,8 +2678,8 @@ u8 func040b_outro[] = { set_chr_chrflag(CHR_ANTI, CHRCFLAG_HIDDEN) set_chr_chrflag(0xf1, CHRCFLAG_HIDDEN) set_ailist(CHR_P1P2, GAILIST_IDLE) - open_door2(0x10) - open_door2(0x11) + set_door_open(0x10) + set_door_open(0x11) hide_object(OBJ_TAXI) hide_object(OBJ_LIMO) hide_chr(CHR_SEALER1) diff --git a/src/files/setup/setuprit.c b/src/files/setup/setuprit.c index 335fea96e..ce1565def 100644 --- a/src/files/setup/setuprit.c +++ b/src/files/setup/setuprit.c @@ -1411,7 +1411,7 @@ u8 func0405_president_in_room[] = { endloop(0x0e) label(0x06) - set_follow_chr(CHR_TARGET) + set_chrpreset(CHR_TARGET) set_chr_maxdamage(CHR_SELF, 500) set_shotlist(AILIST_PRESIDENT_RUNNING) set_ailist(CHR_SELF, AILIST_PRESIDENT_RUNNING) @@ -1519,7 +1519,7 @@ u8 func0404_president_running[] = { label(0x58) restart_timer label(0x2d) - try_jog_to_target_chr(/*goto*/ 0x59) + try_jog_to_target(/*goto*/ 0x59) beginloop(0x59) // @bug: This FALSE should be TRUE instead. This causes the president @@ -1556,7 +1556,7 @@ u8 func0404_president_running[] = { // Unreachable label(0x5c) - try_run_to_target_chr(/*goto*/ 0x5d) + try_run_to_target(/*goto*/ 0x5d) beginloop(0x5d) if_stage_flag_eq(STAGEFLAG_BOTH_BLONDES_DEAD, FALSE, /*goto*/ 0x2d) @@ -1780,7 +1780,7 @@ u8 func0413_taker[] = { label(0x2d) if_target_is_player(/*goto*/ 0x11) - if_target_chrs_target_is_different(/*goto*/ 0x2d) + if_chrpresets_target_is_different(/*goto*/ 0x2d) goto_next(0x11) label(0x2d) @@ -2336,15 +2336,15 @@ u8 func040a_defend_pad[] = { // Not injured label(0x06) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08) - if_chr_distance_to_pad_lt(CHR_SELF, 200, TARGET_PAD, /*goto*/ 0x06) + if_chr_distance_to_pad_lt(CHR_SELF, 200, PAD_PRESET, /*goto*/ 0x06) label(0x03) - jog_to_pad(TARGET_PAD) + jog_to_pad(PAD_PRESET) beginloop(0x04) dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08) - if_chr_distance_to_pad_lt(CHR_SELF, 200, TARGET_PAD, /*goto*/ 0x06) + if_chr_distance_to_pad_lt(CHR_SELF, 200, PAD_PRESET, /*goto*/ 0x06) endloop(0x04) label(0x06) @@ -2353,7 +2353,7 @@ u8 func040a_defend_pad[] = { beginloop(0x09) dprint 'A','T',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08) - if_chr_distance_to_pad_gt(CHR_SELF, 300, TARGET_PAD, /*goto*/ 0x06) + if_chr_distance_to_pad_gt(CHR_SELF, 300, PAD_PRESET, /*goto*/ 0x06) endloop(0x09) label(0x06) @@ -2688,7 +2688,7 @@ u8 func041c_init_clone3[] = { u8 func041d_clone3[] = { set_target_chr(CHR_BOND) - try_run_to_target_chr(/*goto*/ 0x04) + try_run_to_target(/*goto*/ 0x04) label(0x04) yield set_returnlist(CHR_SELF, AILIST_CLONE3) @@ -2755,13 +2755,13 @@ u8 func041e_blonde[] = { label(0x2d) chr_toggle_p1p2(CHR_P1P2) set_target_chr(CHR_BOND) - if_target_chr_in_sight(/*goto*/ 0x6a) + if_target_in_sight(/*goto*/ 0x6a) if_near_miss(/*goto*/ 0x6b) label(0x2d) reloop(0x75) label(0x06) - if_target_chr_in_sight(/*goto*/ 0x6a) + if_target_in_sight(/*goto*/ 0x6a) label(0x2d) endloop(0x75) @@ -2806,7 +2806,7 @@ u8 func041e_blonde[] = { label(0x6f) call_rng - if_target_chr_in_sight(/*goto*/ 0x70) + if_target_in_sight(/*goto*/ 0x70) if_timer_gt(60, /*goto*/ 0x71) if_rand_lt(4, /*goto*/ 0x71) goto_first(0x6f) @@ -2893,7 +2893,7 @@ u8 func0420_trent_attacking[] = { set_target_chr(CHR_P1P2) try_unset_chr_flag_bank3_02000000(CHR_SELF, /*goto*/ 0x2d) set_target_chr(CHR_PRESIDENT) - if_target_chr_in_sight(/*goto*/ 0x06) + if_target_in_sight(/*goto*/ 0x06) if_stage_flag_eq(STAGEFLAG_ONE_BLONDE_DEAD, TRUE, /*goto*/ 0x2d) endloop(0x04) @@ -3182,20 +3182,20 @@ u8 func0407_steward[] = { label(0x79) walk_to_pad(0x00c1) set_morale(1) - set_target_pad(0x00c2) + set_padpreset(0x00c2) goto_next(0x87) label(0x60) if_chr_distance_to_pad_lt(CHR_SELF, 50, 0x00c3, /*goto*/ 0x77) walk_to_pad(0x00c3) set_morale(2) - set_target_pad(0x00c4) + set_padpreset(0x00c4) goto_next(0x87) label(0x77) if_chr_distance_to_pad_lt(CHR_SELF, 50, 0x00c1, /*goto*/ 0x78) set_morale(3) - set_target_pad(0x00c6) + set_padpreset(0x00c6) walk_to_pad(0x00c5) goto_next(0x87) @@ -3205,13 +3205,13 @@ u8 func0407_steward[] = { beginloop(0x87) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x89) + if_target_in_sight(/*goto*/ 0x89) if_saw_injury(0x00, /*goto*/ 0x89) if_chr_stopped(/*goto*/ 0x06) endloop(0x87) label(0x06) - try_face_entity(ENTITYTYPE_PAD, TARGET_PAD, /*goto*/ 0x88) + try_face_entity(ENTITYTYPE_PAD, PAD_PRESET, /*goto*/ 0x88) beginloop(0x88) if_chr_stopped(/*goto*/ 0x06) @@ -3222,7 +3222,7 @@ u8 func0407_steward[] = { chr_do_animation(ANIM_OPERATE_0204, 0, -1, 0x10, 0x10, CHR_SELF, 2) label(0x2d) - if_target_chr_in_sight(/*goto*/ 0x89) + if_target_in_sight(/*goto*/ 0x89) if_saw_injury(0x00, /*goto*/ 0x89) endloop(0x03) diff --git a/src/files/setup/setupsho.c b/src/files/setup/setupsho.c index ab056bc80..d268bd0a5 100644 --- a/src/files/setup/setupsho.c +++ b/src/files/setup/setupsho.c @@ -527,7 +527,7 @@ u8 func0402_unarmed_skedar[] = { stop_chr if_self_flag_bankx_eq(CHRFLAG0_00000004, FALSE, BANK_0, /*goto*/ 0x03) set_action(MA_TRACKING, TRUE) - try_run_to_target_chr(/*goto*/ 0x03) + try_run_to_target(/*goto*/ 0x03) beginloop(0x03) if_chr_in_room(CHR_SELF, 0x00, 0x003b, /*goto*/ LABEL_HANDLE_PHOENIX_AREA) @@ -570,7 +570,7 @@ u8 func0402_unarmed_skedar[] = { restart_timer set_action(MA_WAITING, TRUE) say_quip(CHR_BOND, 0x03, 0xff, 0x03, 0xff, BANK_0, 0x00, 0x00) - try_walk_to_target_chr(/*goto*/ 0x08) + try_walk_to_target(/*goto*/ 0x08) beginloop(0x08) if_chr_in_room(CHR_SELF, 0x00, 0x003b, /*goto*/ LABEL_HANDLE_PHOENIX_AREA) @@ -588,7 +588,7 @@ u8 func0402_unarmed_skedar[] = { label(0x2d) restart_timer set_action(MA_TRACKING, TRUE) - try_run_to_target_chr(/*goto*/ 0x0b) + try_run_to_target(/*goto*/ 0x0b) beginloop(0x0b) if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ 0x10) @@ -780,7 +780,7 @@ u8 func0404_miniskedar[] = { label(0x2d) label(0x06) - try_run_to_target_chr(/*goto*/ 0x0b) + try_run_to_target(/*goto*/ 0x0b) beginloop(0x0b) if_self_flag_bankx_eq(CHRFLAG0_AIVSAI, FALSE, BANK_0, /*goto*/ 0x2e) @@ -887,7 +887,7 @@ u8 func0408_cloaked_skedar[] = { // King is alive chr_toggle_p1p2(CHR_SELF) - if_chr_distance_to_pad_lt(CHR_P1P2, 300, TARGET_PAD, /*goto*/ 0x2d) + if_chr_distance_to_pad_lt(CHR_P1P2, 300, PAD_PRESET, /*goto*/ 0x2d) // 1 in 256 chance of making skedar roar sound call_rng @@ -920,7 +920,7 @@ u8 func0404_miniskedar_spawner[] = { // Wait until player near trigger pad beginloop(0x04) chr_toggle_p1p2(CHR_SELF) - if_chr_distance_to_pad_lt(CHR_P1P2, 300, TARGET_PAD, /*goto*/ 0x4f) + if_chr_distance_to_pad_lt(CHR_P1P2, 300, PAD_PRESET, /*goto*/ 0x4f) endloop(0x04) label(0x4f) @@ -1695,7 +1695,7 @@ u8 func0409_reaper_slayer_skedar[] = { if_enemy_distance_lt_and_los(2540, /*goto*/ 0x60) label(0x2e) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x06) - if_target_chr_in_sight(/*goto*/ 0x60) + if_target_in_sight(/*goto*/ 0x60) label(0x06) if_just_injured(CHR_SELF, /*goto*/ 0x58) label(0x2d) @@ -1707,7 +1707,7 @@ u8 func0409_reaper_slayer_skedar[] = { label(0x06) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x2d) - if_target_chr_in_sight(/*goto*/ 0x60) + if_target_in_sight(/*goto*/ 0x60) label(0x2d) set_target_chr(CHR_BOND) goto_first(0x5f) @@ -1759,7 +1759,7 @@ u8 func0409_reaper_slayer_skedar[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x06) - if_target_chr_in_sight(/*goto*/ 0x6b) + if_target_in_sight(/*goto*/ 0x6b) label(0x06) if_timer_gt(60, /*goto*/ 0x6c) if_rand_lt(4, /*goto*/ 0x6c) @@ -1878,7 +1878,7 @@ u8 func040b_mauler_skedar[] = { label(0x2d) set_alertness(100) set_target_chr(CHR_BOND) - try_jog_to_target_chr(/*goto*/ 0x2d) + try_jog_to_target(/*goto*/ 0x2d) label(0x2d) set_shotlist(GAILIST_COMBAT_WITH_TARGET) set_returnlist(CHR_SELF, GAILIST_COMBAT_WITH_TARGET) @@ -2112,7 +2112,7 @@ u8 func040d_king_combat[] = { goto_next(0x88) label(0x2d) - chr_move_to_pad(CHR_SELF, TARGET_PAD, 0x00, /*goto*/ 0x2d) + chr_move_to_pad(CHR_SELF, PAD_PRESET, 0x00, /*goto*/ 0x2d) goto_next(0x88) label(0x2d) @@ -2121,7 +2121,7 @@ u8 func040d_king_combat[] = { label(0x8a) restart_timer - try_run_to_target_chr(/*goto*/ 0x08) + try_run_to_target(/*goto*/ 0x08) beginloop(0x08) if_chr_death_animation_finished(CHR_P1P2, /*goto*/ 0x0b) diff --git a/src/files/setup/setupstat.c b/src/files/setup/setupstat.c index cb802a9b0..7692b935d 100644 --- a/src/files/setup/setupstat.c +++ b/src/files/setup/setupstat.c @@ -344,11 +344,11 @@ u8 func0401_defend[] = { // Not dying - go to pad label(0x06) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08) - if_chr_distance_to_pad_lt(CHR_SELF, 200, TARGET_PAD, /*goto*/ 0x06) + if_chr_distance_to_pad_lt(CHR_SELF, 200, PAD_PRESET, /*goto*/ 0x06) label(0x03) restart_timer - if_chr_distance_to_pad_gt(CHR_SELF, 500, TARGET_PAD, /*goto*/ 0x06) + if_chr_distance_to_pad_gt(CHR_SELF, 500, PAD_PRESET, /*goto*/ 0x06) go_to_target_pad(SPEED_JOG) label(0x06) @@ -358,7 +358,7 @@ u8 func0401_defend[] = { beginloop(0x04) dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08) - if_chr_distance_to_pad_lt(CHR_SELF, 200, TARGET_PAD, /*goto*/ 0x06) + if_chr_distance_to_pad_lt(CHR_SELF, 200, PAD_PRESET, /*goto*/ 0x06) if_timer_gt(60, /*goto*/ 0x2d) endloop(0x04) @@ -373,7 +373,7 @@ u8 func0401_defend[] = { // Wait for enemy to come into sight, or to be pushed away from pad beginloop(0x09) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08) - if_chr_distance_to_pad_gt(CHR_SELF, 300, TARGET_PAD, /*goto*/ 0x06) + if_chr_distance_to_pad_gt(CHR_SELF, 300, PAD_PRESET, /*goto*/ 0x06) endloop(0x09) // Pushed away from pad - return to it @@ -539,7 +539,7 @@ u8 func0404_maian[] = { // Go to king label(0x2d) - try_run_to_target_chr(/*goto*/ 0x04) + try_run_to_target(/*goto*/ 0x04) beginloop(0x04) dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, @@ -884,7 +884,7 @@ u8 func0406_skedar[] = { // Go to Maian leader set_target_chr(CHR_MAIAN_LEADER) - try_run_to_target_chr(/*goto*/ 0x04) + try_run_to_target(/*goto*/ 0x04) beginloop(0x04) dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, diff --git a/src/files/setup/setuptra.c b/src/files/setup/setuptra.c index 86e47d458..7410c055b 100644 --- a/src/files/setup/setuptra.c +++ b/src/files/setup/setuptra.c @@ -923,11 +923,11 @@ u8 func0404_jonathan_following_and_mine[] = { if_chr_distance_lt(300, /*goto*/ 0x32) // distance >= 300 - try_run_to_target_chr(/*goto*/ 0x5d) + try_run_to_target(/*goto*/ 0x5d) // distance > 200 and distance < 300 label(0x32) - try_walk_to_target_chr(/*goto*/ 0x5d) + try_walk_to_target(/*goto*/ 0x5d) // Moving towards Jo label(0x5d) @@ -1109,7 +1109,7 @@ u8 func0413_jonathan_hangar[] = { if_chr_distance_gt(400, /*goto*/ 0x32) set_target_chr(CHR_P1P2) if_chr_distance_gt(400, /*goto*/ 0x32) - if_target_chr_in_sight(/*goto*/ 0x06) + if_target_in_sight(/*goto*/ 0x06) label(0x32) endloop(0x14) @@ -2002,7 +2002,7 @@ u8 func040b_elvis_follow[] = { label(0x5c) restart_timer - try_run_to_target_chr(/*goto*/ 0x5d) + try_run_to_target(/*goto*/ 0x5d) label(0x5d) restart_timer diff --git a/src/files/setup/setupwax.c b/src/files/setup/setupwax.c index 8dcc6119b..6a97e0218 100644 --- a/src/files/setup/setupwax.c +++ b/src/files/setup/setupwax.c @@ -1576,7 +1576,7 @@ u8 func0415_chief[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x06) - if_target_chr_in_sight(/*goto*/ 0x2c) + if_target_in_sight(/*goto*/ 0x2c) label(0x06) reloop(0x03) diff --git a/src/game/chr/chr.c b/src/game/chr/chr.c index d898acdaf..2d5b119eb 100644 --- a/src/game/chr/chr.c +++ b/src/game/chr/chr.c @@ -27709,7 +27709,7 @@ void func0f036358(struct chrdata *chr, s32 arg1) chr->act_die.unk034 = -1; chr->act_die.unk038 = 0; - chr->ailist = ailistFindById(GFUNC_AI_BOT_DEAD); + chr->ailist = ailistFindById(GAILIST_AI_BOT_DEAD); chr->aioffset = 0; func0f0b09f4(arg1, mpPlayerGetIndex(chr)); diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 19a67537e..2b3ef33e7 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -749,7 +749,7 @@ bool aiIfChrUnloaded(void) /** * @cmd 0035 */ -bool aiIfPlayerInSight(void) +bool aiIfTargetPropInSight(void) { if (func0f03978c(g_Vars.chrdata)) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; @@ -1304,7 +1304,7 @@ bool ai002a(void) /** * @cmd 002b */ -bool aiTryJogToTargetChr(void) +bool aiTryJogToTargetProp(void) { if (chrGoToTarget(g_Vars.chrdata, SPEED_JOG)) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; @@ -1319,7 +1319,7 @@ bool aiTryJogToTargetChr(void) /** * @cmd 002c */ -bool aiTryWalkToTargetChr(void) +bool aiTryWalkToTargetProp(void) { if (chrGoToTarget(g_Vars.chrdata, SPEED_WALK)) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; @@ -1334,7 +1334,7 @@ bool aiTryWalkToTargetChr(void) /** * @cmd 002d */ -bool aiTryRunToTargetChr(void) +bool aiTryRunToTargetProp(void) { if (chrGoToTarget(g_Vars.chrdata, SPEED_RUN)) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; diff --git a/src/include/commands.h b/src/include/commands.h index 90bed1379..824089164 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -1,49 +1,130 @@ #include "util.h" +/** + * Makes the script jump to the next label with the given ID, relative to the + * current command. Note that the beginloop macro expands to a label command, so + * this will match beginloops too. + */ #define goto_next(label) \ mkshort(0x0000), \ label, +/** + * Makes the script jump to the first label with the given ID, relative to the + * start of the current ailist. Note that the beginloop macro expands to a + * label command, so this will match beginloops too. + */ #define goto_first(label) \ mkshort(0x0001), \ label, +/** + * Defines a label. Does not actually do anything, but can be jumped to from + * other commands. + * + * Labels that are used to define the start of a loop should be unique within + * the current ailist, otherwise they may be unreachable by the goto_first + * command. + */ #define label(id) \ mkshort(0x0002), \ id, +/** + * Pauses the current script and yield execution back to the engine. At least + * one frame will pass before the script is continued. + * + * To prevent infinite loops this must be called at least once per loop. This is + * already done for you if you use the beginloop macro. + * + * Yielding should also be done when doing expensive operations like spawning + * chrs. If you don't then it may create a lag spike. + * + * Lastly, sometimes you need to yield and let the engine recalculate things + * before your script continues. For example, when moving a mine to a pad you + * may need to yield before detonating it. + */ #define yield \ mkshort(0x0003), +/** + * Marks the end of the ailist. + * + * Every ailist should end in this, and it must not be reachable by your ailist + * logic. Typically your ailist should loop back to an earlier point in the list + * or assign a different ailist before the end is reached. + */ #define endlist \ mkshort(0x0004), +/** + * Assigns a new ailist to the given chr. If the given chr is the current chr, + * execution is immediately passed to the start of the new list (ie. there is no + * yield). + */ #define set_ailist(chr, function) \ mkshort(0x0005), \ chr, \ mkshort(function), +/** + * Sets the chr's return ailist. The return ailist can be jumped to using the + * return command. + * + * A common pattern is to set the return ailist to the current ailist, then use + * set_ailist to assign a new one. The new ailist should use return to jump back + * to the original ailist. + */ #define set_returnlist(chr, function) \ mkshort(0x0006), \ chr, \ mkshort(function), +/** + * Sets the list that should be assigned when the chr is shot. + * + * You would typically set this to the same list as the current one so the chr + * continues doing what they were doing previously (eg. running to a target). + * The list will be restarted from the beginning. You may want to use + * if_just_injured near the top of the list so you detect then injury, make them + * say something and wait for their injury animation to finish before they + * continue their regular logic. + */ #define set_shotlist(function) \ mkshort(0x0007), \ mkshort(function), +/** + * Assigns the chr's return list to their current one. Execution of the new list + * is started from the top. + */ #define return \ mkshort(0x0008), +/** + * Makes the chr stop doing whatever they were doing (eg. running). + */ #define stop_chr \ mkshort(0x0009), +/** + * Makes the chr begin kneeling. + */ #define kneel \ mkshort(0x000a), -#define chr_do_animation(chr_do_animation, startframe, endframe, flags, transition, chr, animspeed) \ +/** + * Make a chr do an animation. See the ANIM constants in constants.h for known + * animation IDs. + * + * startframe may be 0 or higher for that frame number, -1 for the first frame + * (ie. same as 0) or -2 for the last frame. + * + * endframe may be 0 or higher for that frame number, or -1 for the last frame. + */ +#define chr_do_animation(animation, startframe, endframe, flags, transition, chr, animspeed) \ mkshort(0x000b), \ - mkshort(chr_do_animation), \ + mkshort(animation), \ mkshort(startframe), \ mkshort(endframe), \ flags, \ @@ -51,28 +132,59 @@ chr, \ animspeed, +/** + * Checks if the chr is considered to be idle. It is not known exactly what idle + * means, but it could be any of: + * - standing doing nothing + * - patrolling + * - sitting/operating equipment + * - idle animations such as yawning + */ #define if_chr_idle(label) \ mkshort(0x000c), \ label, +/** + * Makes the chr do a surprised animation. + */ #define be_surprised_000d \ mkshort(0x000d), +/** + * Makes the chr do a surprised animation. + */ #define be_surprised_000e \ mkshort(0x000e), +/** + * Attempt to jump sideways. If it worked then go to the given label. + * The command may fail if the chr is blocked. + */ #define try_jump_sideways(label) \ mkshort(0x000f), \ label, +/** + * Attempt to hop sideways. If it worked then go to the given label. + * The command may fail if the chr is blocked. + */ #define try_hop_sideways(label) \ mkshort(0x0010), \ label, +/** + * Attempt to run sideways. If it worked then go to the given label. + * The command may fail if the chr is blocked. + */ #define try_run_sideways(label) \ mkshort(0x0011), \ label, +/** + * Attempt to walk and shoot. If it worked then go to the given label. + * The command may fail if the chr is blocked, or maybe if the chr can't see + * their target. + */ #define try_walk_and_shoot(label) \ mkshort(0x0012), \ label, @@ -81,6 +193,11 @@ mkshort(0x0013), \ label, +/** + * Attempt to roll and shoot. If it worked then go to the given label. + * The command may fail if the chr is blocked, or maybe if the chr can't see + * their target. + */ #define try_roll_and_shoot(label) \ mkshort(0x0014), \ label, @@ -103,17 +220,24 @@ mkshort(u2), \ label, -// Suspected types: -// Type 0004 = no idea -// Type 0008 = pad -// Type 0010 = compass direction (0000, 4000, 8000, c000) -// Type 0200 = player +/** + * Makes the chr begin facing the given entity. They will continue to face it + * until stop_chr is used or significantly different action is given to them. + * + * Type 0x0004 is not known + * Type 0x0008 is pad + * Type 0x0010 is a compass direction (use 0x0000, 0x4000, 0x8000 and 0xc000) + * Type 0x0200 is the player + */ #define try_face_entity(entity_type, entity_id, label) \ mkshort(0x0018), \ mkshort(entity_type), \ mkshort(entity_id), \ label, +/** + * Damages the chr by the given amount. + */ #define damage_chr(chr, value) \ mkshort(0x0019), \ chr, \ @@ -129,7 +253,12 @@ chr2, \ weapon, -// Only ever called with values 512, 0 +/** + * Makes the chr consider throwing a grenade, using their grenade probability + * property. + * + * The values are not known. It's only called with values 512 and 0. + */ #define consider_throwing_grenade(value_1, value_2, label) \ mkshort(0x001b), \ mkshort(value_1), \ @@ -142,39 +271,73 @@ u2, \ label, +/** + * Makes the chr jog to the given pad. This may fail if pathfinding fails. + */ #define jog_to_pad(pad) \ mkshort(0x001d), \ mkshort(pad), +/** + * Makes the chr go to their pad preset. This may fail if pathfinding fails. + * + * Speed should be SPEED_WALK, SPEED_JOG or SPEED_RUN. + */ #define go_to_target_pad(speed) \ mkshort(0x001e), \ speed, +/** + * Makes the chr walk to the given pad. This may fail if pathfinding fails. + */ #define walk_to_pad(pad) \ mkshort(0x001f), \ mkshort(pad), +/** + * Makes the chr run to the given pad. This may fail if pathfinding fails. + */ #define run_to_pad(pad) \ mkshort(0x0020), \ mkshort(pad), +/** + * Assigns the given path ID to the chr for patrolling. The chr will not start + * patrolling until start_path is used. + */ #define assign_path(pathid) \ mkshort(0x0021), \ pathid, +/** + * Makes the chr start patrolling. + */ #define start_path \ mkshort(0x0022), +/** + * Checks if the chr is patrolling. + */ #define if_path_started(label) \ mkshort(0x0023), \ label, +/** + * Makes the chr surrender. + */ #define surrender \ mkshort(0x0024), +/** + * Makes the chr drop their gun and fade out. For an immersive gameplay + * experience, don't do this when the chr is on screen. + */ #define drop_gun_and_fade_out \ mkshort(0x0025), +/** + * Remove the chr completely. + */ #define remove_chr(chr) \ mkshort(0x0026), \ chr, @@ -184,9 +347,20 @@ mkshort(pad), \ label, +/** + * Activates the alarm. This alone does nothing except make the alarm sound + * start. To make guards spawn when the alarm is sounded, an AI list must wait + * for the alarm then spawn them. + * + * The alarm does not have a timer. You may want to use an AI list to wait for + * them alarm, then wait a certain amount of time before deactivating it. + */ #define activate_alarm \ mkshort(0x0028), +/** + * Deactivates the alarm. + */ #define deactivate_alarm \ mkshort(0x0029), @@ -194,15 +368,27 @@ mkshort(0x002a), \ label, -#define try_jog_to_target_chr(label) \ +/** + * Makes the chr attempt to jog to their target. The target can be a chr, object + * or the player. + */ +#define try_jog_to_target(label) \ mkshort(0x002b), \ label, -#define try_walk_to_target_chr(label) \ +/** + * Makes the chr attempt to jog to their target. The target can be a chr, object + * or the player. + */ +#define try_walk_to_target(label) \ mkshort(0x002c), \ label, -#define try_run_to_target_chr(label) \ +/** + * Makes the chr attempt to jog to their target. The target can be a chr, object + * or the player. + */ +#define try_run_to_target(label) \ mkshort(0x002d), \ label, @@ -210,64 +396,109 @@ mkshort(0x002e), \ label, +/** + * Makes the chr attempt to jog to the given chr. + */ #define try_jog_to_chr(chr, label) \ mkshort(0x002f), \ chr, \ label, +/** + * Makes the chr attempt to walk to the given chr. + */ #define try_walk_to_chr(chr, label) \ mkshort(0x0030), \ chr, \ label, +/** + * Makes the chr attempt to run to the given chr. + */ #define try_run_to_chr(chr, label) \ mkshort(0x0031), \ chr, \ label, +/** + * Checks if the chr is doing anything, such as running or animating. + */ #define if_chr_stopped(label) \ mkshort(0x0032), \ label, +/** + * Checks if the chr is doing their death animation. + */ #define if_chr_dying(chr, label) \ mkshort(0x0033), \ chr, \ label, +/** + * Checks if the chr has finished dying. + */ #define if_chr_death_animation_finished(chr, label) \ mkshort(0x0034), \ chr, \ label, -#define if_target_chr_in_sight(label) \ +/** + * Checks if the chr has line of sight to their target. The target can be a chr, + * object or the player. + */ +#define if_target_in_sight(label) \ mkshort(0x0035), \ label, +/** + * Calls the random number generator. The chr's rand property will be assigned a + * value between 0 and 255 (inclusive). + */ #define call_rng \ mkshort(0x0036), +/** + * Checks if the chr's rand property is less than the given value. + */ #define if_rand_lt(value, label) \ mkshort(0x0037), \ value, \ label, +/** + * Checks if the chr's rand property is greater than the given value. + */ #define if_rand_gt(value, label) \ mkshort(0x0038), \ value, \ label, +/** + * Checks if the alarm is currently sounding. Not sure how this differs from + * if_alarm_active. + */ #define if_alarm_active2(label) \ mkshort(0x0039), \ label, +/** + * Checks if the alarm is currently sounding. + */ #define if_alarm_active(label) \ mkshort(0x003a), \ label, +/** + * Checks if the alarm is currently quiet. + */ #define if_alarm_inactive(label) \ mkshort(0x003b), \ label, +/** + * Checks if the chr has heard gunfire. + */ #define if_hears_gunfire(label) \ mkshort(0x003c), \ label, @@ -308,6 +539,9 @@ checktype, \ label, +/** + * Checks if the chr can see the player. + */ #define if_chr_sees_player(label) \ mkshort(0x003f), \ label, @@ -317,34 +551,46 @@ mkword(flags), \ label, +// Not sure about this. #define if_within_units_of_sight(value, label) \ mkshort(0x0041), \ mkword(value), \ label, +/** + * Checks if the chr is in a loaded room. + */ #define if_in_loaded_room(label) \ mkshort(0x0042), \ label, /** - * Go to the label if the chr saw their target within the last 10 seconds. + * Checks if the chr saw their target within the last 10 seconds. */ #define if_saw_target_recently(label) \ mkshort(0x0043), \ label, /** - * Go to the label if the chr heard their target within the last 10 seconds. + * Checks if the chr heard their target within the last 10 seconds. */ #define if_heard_target_recently(label) \ mkshort(0x0044), \ label, +/** + * Checks if the chr has detected the given chr. Detecting can happen by seeing + * the chr or hearing gunfire. + */ #define if_detected_chr(chr, label) \ mkshort(0x0045), \ chr, \ label, +/** + * Checks if the chr has never been rendered. This is typically used to spawn + * clones until the source chr has appeared on screen. + */ #define if_never_been_onscreen(label) \ mkshort(0x0046), \ label, @@ -368,18 +614,26 @@ mkshort(0x004a), \ label, +/** + * Checks if the chr had shot nearly hit them. + */ #define if_near_miss(label) \ mkshort(0x004b), \ label, +/** + * Checks if the chr is dying. + */ #define if_dying(label) \ mkshort(0x004c), \ label, -// Checks if Jo is within a certain angle of the chr's direction. -// Value is a percentage of the circle, where 256 is a full circle. -// Only ever called with value = decimal 10, which is about 14 degrees. -// With value 10, returns true if Jo is roughly within 12-11 o'clock. +/** + * Checks if Jo is within a certain angle of the chr's direction. + * Value is a percentage of the circle, where 256 is a full circle. + * Only ever called with value = decimal 10, which is about 14 degrees. + * With value 10, returns true if Jo is roughly within 12-11 o'clock. + */ #define if_jo_ccw_direction_lt(value, label) \ mkshort(0x004d), \ value, \ @@ -395,39 +649,55 @@ bool2, \ label, -// Checks if Jo is outside of a certain angle of the chr's direction. -// Value is a percentage of the circle, where 256 is a full circle. -// Called with values = -10 and -11, which is about -14 degrees. -// With value -10, returns true if Jo is roughly within 12-1 o'clock. +/** + * Checks if Jo is outside of a certain angle of the chr's direction. + * Value is a percentage of the circle, where 256 is a full circle. + * Called with values = -10 and -11, which is about -14 degrees. + * With value -10, returns true if Jo is roughly within 12-1 o'clock. + */ #define if_jo_ccw_direction_gt(value, label) \ mkshort(0x004f), \ value, \ label, -// Similar to 004d and 004f, but checks if Jo is within the angle of player's -// 12 o'clock (ie. either side). +/** + * Similar to 004d and 004f, but checks if Jo is within the angle of player's + * 12 o'clock (ie. either side). + */ #define if_jo_front_direction_lt(value, label) \ mkshort(0x0050), \ value, \ label, -// Similar to 004d and 004f, but checks if Jo is not in front of the current chr -// by the given angle. +/** + * Similar to 004d and 004f, but checks if Jo is not in front of the current chr + * by the given angle. + */ #define if_jo_front_direction_gt(value, label) \ mkshort(0x0051), \ value, \ label, +/** + * Checks if the distance to Joanna is less than the given value. + */ #define if_chr_distance_lt(distance, label) \ mkshort(0x0052), \ mkshort(distance / 10), \ label, +/** + * Checks if the distance to Joanna is greater than than the given value. + */ #define if_chr_distance_gt(distance, label) \ mkshort(0x0053), \ mkshort(distance / 10), \ label, +/** + * Checks if the distance from the given chr to the given pad is less than the + * given value. + */ #define if_chr_distance_to_pad_lt(chr, distance, pad, label) \ mkshort(0x0054), \ chr, \ @@ -435,6 +705,10 @@ mkshort(pad), \ label, +/** + * Checks if the distance from the given chr to the given pad is greater than the + * given value. + */ #define if_chr_distance_to_pad_gt(chr, distance, pad, label) \ mkshort(0x0055), \ chr, \ @@ -442,12 +716,20 @@ mkshort(pad), \ label, +/** + * Checks if the distance from the current chr to the given chr is less than the + * given value. + */ #define if_self_distance_to_chr_lt(distance, chr, label) \ mkshort(0x0056), \ mkshort(distance / 10), \ chr, \ label, +/** + * Checks if the distance from the current chr to the given chr is greater than + * the given value. + */ #define if_chr_distance_to_target_chr_gt(distance, chr, label) \ mkshort(0x0057), \ mkshort(distance / 10), \ @@ -459,12 +741,20 @@ mkshort(distance / 10), \ label, +/** + * Checks if the distance from the current chr's target to the given pad is less + * than the given value. The target can be another chr or an object. + */ #define if_distance_from_target_to_pad_lt(distance, pad, label) \ mkshort(0x0059), \ mkshort(distance / 10), \ mkshort(pad), \ label, +/** + * Checks if the distance from the current chr's target to the given pad is + * greater than the given value. The target can be another chr or an object. + */ #define if_distance_from_target_to_pad_gt(distance, pad, label) \ mkshort(0x005a), \ mkshort(distance / 10), \ @@ -472,9 +762,11 @@ label, /** - * type 0 = if is in - * type 1 = if is in same room that self is searching - * type 2 = if 's camspy is within 150 units of + * Checks if the chr or their camspy is in the given room. + * + * Type 0 = if is in + * Type 1 = if is in same room that the current chr is searching + * Type 2 = if 's camspy is within 150 units of * * Type 2 is hard coded to only work in G5 Building. */ @@ -485,48 +777,77 @@ mkshort(room_or_pad), \ label, +/** + * Checks if the chr's target is in the given room. The target can be another + * chr or object. + */ #define if_target_in_room(room, label) \ mkshort(0x005c), \ mkshort(room), \ label +/** + * Checks if the given chr has the given object in their inventory. + */ #define if_chr_has_object(chr, object, label) \ mkshort(0x005d), \ chr, \ object, \ label, +/** + * Checks if the given weapon has been thrown. + */ #define if_weapon_thrown(weapon, label) \ mkshort(0x005e), \ weapon, \ label, +/** + * Checks if the given weapon has been thrown and has landed on the given + * object. + */ #define if_weapon_thrown_on_object(weapon, object, label) \ mkshort(0x005f), \ weapon, \ object, \ label, +/** + * Checks if the chr has the given weapon equipped. + */ #define if_chr_weapon_equipped(chr, weapon, label) \ mkshort(0x0060), \ chr, \ weapon, \ label, -// If behavior is zero, go to label if object exists. -// If behavior is nonzero, set flag on unclaimed gun. -// In practice this is always called with object = -1 and behavior = 1. +/** + * If behavior is zero, go to label if object exists. + * If behavior is nonzero, set flag on unclaimed gun. + * + * In practice this is always called with object = -1 and behavior = 1. + */ #define if_gun_unclaimed(object, behavior, label) \ mkshort(0x0061), \ object, \ behavior, \ label, +/** + * Checks if the object is in good working order (ie. not destroyed). + */ #define if_object_in_good_condition(object, label) \ mkshort(0x0062), \ object, \ label, +/** + * Checks if the object has been activated by the given chr. + * + * When this command is used the activated flag is cleared, so subsequent uses + * of this command will not pass unless the chr activates it again. + */ #define if_chr_activated_object(chr, object, label) \ mkshort(0x0063), \ chr, \ @@ -538,6 +859,11 @@ mkshort(0x0065), \ object, +/** + * Destroys the given object. + * + * In practice this is only used on mines. It might work on other objects. + */ #define destroy_object(object) \ mkshort(0x0066), \ object, @@ -546,210 +872,378 @@ mkshort(0x0067), \ object, +/** + * Makes the given chr drop their concealed items. + */ #define drop_concealed_items(chr) \ mkshort(0x0068), \ chr, +/** + * Makes the given chr drop their weapon. + */ #define chr_drop_weapon(chr) \ mkshort(0x0069), \ chr, +/** + * Makes the current chr give their object to the given chr. + */ #define give_object_to_chr(object, chr) \ mkshort(0x006a), \ object, \ chr, +/** + * Moves the object to the given pad. The move is instant. + */ #define move_object_to_pad(object, pad) \ mkshort(0x006b), \ object, \ mkshort(pad), +/** + * Opens the door. + */ #define open_door(door) \ mkshort(0x006c), \ door, +/** + * Closes the door. + */ #define close_door(door) \ mkshort(0x006d), \ door, +/** + * Checks the state of the current door. + * + * Doorstate is expected to be one of DOORSTATEBIT_OPEN, DOORSTATEBIT_CLOSED, + * DOORSTATEBIT_OPENING or DOORSTATEBIT_CLOSING. You can bitwise or them + * together to check multiple states at the same time. + */ #define if_door_state(door, doorstate, label) \ mkshort(0x006e), \ door, \ doorstate, \ label, +/** + * Checks if the given object is a door. + * + * Most likely a debug command, as you'd know what IDs your doors use. + */ #define if_object_is_door(object, label) \ mkshort(0x006f), \ object, \ label, +/** + * Locks the door by applying the given bitmask to it. + * + * In most cases you can just use bit 1. + * + * The engine allows doors to be locked for multiple reasons, in which case + * you'd lock the door with multiple bits, then unlock individual bits as the + * player completes each requirement. + */ #define lock_door(door, bits) \ mkshort(0x0070), \ door, \ bits, +/** + * Unsets bits from the door's bitmask. If all bits are unset (eg. if it uses + * the same bitmask that was used to lock the door) then the door is unlocked. + */ #define unlock_door(door, bits) \ mkshort(0x0071), \ door, \ bits, +/** + * Checks if the door is locked with the given bitmask. + */ #define if_door_locked(door, bits, label) \ mkshort(0x0072), \ door, \ bits, \ label, +/** + * Checks if the given objective index is complete. + * + * This is not the same as the objective number. Objective indexes start from 0, + * and some objective indexes do not apply to higher difficulties. + */ #define if_objective_complete(objective, label) \ mkshort(0x0073), \ objective, \ label, +/** + * Checks if the given objective index is failed. + * + * This is not the same as the objective number. Objective indexes start from 0, + * and some objective indexes do not apply to higher difficulties. + */ #define if_objective_failed(objective, label) \ mkshort(0x0074), \ objective, \ label, -// This is only ever called in a sequence of 4, with u1 values 8, 2, 4, 8 in -// that order. Believed to be a pad within specific distance of target chr, -// where the higher the number the further the distance. -// If u1 were 0x10 or 0x20, some other logic would be used. +/** + * This is only ever called in a sequence of 4, with u1 values 8, 2, 4, 8 in + * that order. Believed to be a pad within specific distance of target chr, + * where the higher the number the further the distance. + * If u1 were 0x10 or 0x20, some other logic would be used. + */ #define try_set_target_pad_to_something(u1, label) \ mkshort(0x0075), \ u1, \ label, -// Only ever called with values 1, 2, 4 and 8. The value is related to circles, -// perhaps specifying a certain side of the target chr. -// If u1 were 0x10 or 0x20, some other logic would be used (same as previous). +/** + * Only ever called with values 1, 2, 4 and 8. The value is related to circles, + * perhaps specifying a certain side of the target chr. + * If u1 were 0x10 or 0x20, some other logic would be used (same as previous). + */ #define try_set_target_pad_to_something2(u1, label) \ mkshort(0x0076), \ u1, \ label, +/** + * Checks if the difficulty is less than the given value. + * + * Diff is expected to be one of DIFF_A, DIFF_SA, DIFF_PA or DIFF_PD. + */ #define if_difficulty_lt(diff, label) \ mkshort(0x0077), \ diff, \ label, +/** + * Checks if the difficulty is greater than the given value. + * + * Diff is expected to be one of DIFF_A, DIFF_SA, DIFF_PA or DIFF_PD. + */ #define if_difficulty_gt(diff, label) \ mkshort(0x0078), \ diff, \ label, +/** + * Checks if the N64 uptime is less than the given value. + * + * The units used are not known. + */ #define if_uptime_lt(value, label) \ mkshort(0x0079), \ mkshort(value), \ label, +/** + * Checks if the N64 uptime is greater than the given value. + * + * The units used are not known. + */ #define if_uptime_gt(value, label) \ mkshort(0x007a), \ mkshort(value), \ label, +/** + * Checks if the stage ID is less than the given value. + * + * Consider using the helper macro if_stage_is_not instead. + */ #define if_stage_lt(stage, label) \ mkshort(0x007b), \ stage, \ label, +/** + * Checks if the stage ID is greater than the given value. + * + * Consider using the helper macro if_stage_is_not instead. + */ #define if_stage_gt(stage, label) \ mkshort(0x007c), \ stage, \ label, +/** + * Checks if the chr has been shot less than the given number of times. + */ #define if_num_times_shot_lt(value, label) \ mkshort(0x007d), \ value, \ label, +/** + * Checks if the chr has been shot more than the given number of times. + */ #define if_num_times_shot_gt(value, label) \ mkshort(0x007e), \ value, \ label, +/** + * Checks if the chr has had less than the given number of near misses. + */ #define if_num_close_arghs_lt(value, label) \ mkshort(0x007f), \ value, \ label, +/** + * Checks if the chr has had more than the given number of near misses. + */ #define if_num_close_arghs_gt(value, label) \ mkshort(0x0080), \ value, \ label, +/** + * Checks if the chr's health is less than the given value. + */ #define if_chr_health_lt(chr, health, label) \ mkshort(0x0081), \ chr, \ health, \ label, +/** + * Checks if the chr's health is greater than the given value. + */ #define if_chr_health_gt(chr, health, label) \ mkshort(0x0082), \ chr, \ health, \ label, -// Checks chr bank 3 0x00000100. If set, unsets it and follows label. +/** + * Checks if the chr was just injured. + * + * Typically you use set_shotlist to specify an AI list that the chr will assign + * when they are shot, and you set that list to the same one as their main task + * (such as running somewhere). When the chr is shot, the shot list is assigned + * which causes the list to be restarted from the top. You can then use the + * if_just_injured command near the top of the list, make them say something + * and wait for their injury animation to finish before continuing with their + * main logic. + * + * Using this command clears the injury state, so further calls will not pass + * unless the chr is injured again. + */ #define if_just_injured(chr, label) \ mkshort(0x0083), \ chr, \ label, +/** + * Sets the current chr's morale to the given value. + * + * Morale is a general purpose property. Its usage depends on the AI list. + * The value range is 0-255. + */ #define set_morale(value) \ mkshort(0x0084), \ value, +/** + * Adds the given value to the current chr's morale property. + */ #define add_morale(value) \ mkshort(0x0085), \ value, +/** + * Adds the given value to the given chr's morale property. + */ #define chr_add_morale(chr, value) \ mkshort(0x0086), \ chr, \ value, +/** + * Subtracts the given value from the current chr's morale property. + */ #define subtract_morale(value) \ mkshort(0x0087), \ value, +/** + * Checks if the chr's morale property is less than the given value. + */ #define if_morale_lt(value, label) \ mkshort(0x0088), \ value, \ label, +/** + * Checks if the chr's morale property is less than the chr's rand property. + */ #define if_morale_lt_random(label) \ mkshort(0x0089), \ label, +/** + * Sets the chr's alertness value. Alertness of 100 or more causes them to + * respond. + */ #define set_alertness(value) \ mkshort(0x008a), \ value, +/** + * Adds the given value to the current chr's alertness. + */ #define increase_self_alertness(value) \ mkshort(0x008b), \ value, +/** + * Adds the given value to the given chr's alertness. + */ #define increase_chr_alertness(value, chr) \ mkshort(0x008c), \ value, \ chr, +/** + * Subtracts the given value from current chr's alertness. + */ #define subtract_alertness(value, chr) \ mkshort(0x008d), \ value, \ chr, +/** + * Checks if the current chr's alertness is less or more than the given value. + * + * Operator is expected to be OPERATOR_LESS_THAN or OPERATOR_GREATER_THAN. + */ #define if_alertness(value, operator, label) \ mkshort(0x008e), \ value, \ operator, \ label, +/** + * Checks if the given chr's alertness is less than the given value. + */ #define if_chr_alertness_lt(value, chr, label) \ mkshort(0x008f), \ value, \ chr, \ label, +/** + * Checks if the current chr's alertness is less than their rand property. + */ #define if_alertness_lt_random(label) \ mkshort(0x0090), \ label, @@ -757,20 +1251,33 @@ #define noop0091 \ mkshort(0x0091), -// Set their hear distance to value divided by 1000. -// Only ever called with distance = 10,000, so it gets set to 10. +/** + * Set the current chr's hear distance. + * + * This value might be multiplied or divided by 1000. + */ #define set_hear_distance(value) \ mkshort(0x0092), \ mkshort(value), +/** + * Set the current chr's view distance. + */ #define set_view_distance(value) \ mkshort(0x0093), \ value, +/** + * Set the current chr's grenade probability. Used by the + * consider_throwing_grenade command. + */ #define set_grenade_probability_out_of_255(value) \ mkshort(0x0094), \ value, +/** + * Assigns a new ID to the chr. + */ #define set_chr_id(newid) \ mkshort(0x0095), \ newid, @@ -802,47 +1309,90 @@ mkshort(0x0097), \ mkshort(value), +/** + * Set the chr's reaction speed. Range is 0-100. + */ #define set_reaction_speed(value) \ mkshort(0x0098), \ value, +/** + * Set the chr's injury recovery speed. Range is 0-100. + */ #define set_recovery_speed(value) \ mkshort(0x0099), \ value, +/** + * Set the chr's accuracy. Range is 0-100. + */ #define set_accuracy(value) \ mkshort(0x009a), \ value, +/** + * Sets a flag on the current chr's flags or flags2 property. + * + * Use BANK_0 and a CHRFLAG0 constant for chr->flags (chr struct offset 0x114). + * Use BANK_1 and a CHRFLAG1 constant for chr->flags2 (chr struct offset 0x118). + */ #define set_self_flag_bankx(flag, bank) \ mkshort(0x009b), \ mkword(flag), \ bank, +/** + * Sets a flag on the current chr's flags or flags2 property. + * + * See set_self_flag_bankx for more info. + */ #define unset_self_flag_bankx(flag, bank) \ mkshort(0x009c), \ mkword(flag), \ bank, -#define if_self_flag_bankx_eq(props, bool, bank, label) \ +/** + * Checks if the given flag is set on the current chr's flags or flags2 + * property. + * + * Set bool to TRUE if checking if set, or FALSE if checking if unset. + * + * See set_self_flag_bankx for more info. + */ +#define if_self_flag_bankx_eq(flag, bool, bank, label) \ mkshort(0x009d), \ - mkword(props), \ + mkword(flag), \ bool, \ bank, \ label, +/** + * Sets a flag on the given chr's flags or flags2 property. + * + * See set_self_flag_bankx for more info. + */ #define set_chr_flag_bankx(chr, props, bank) \ mkshort(0x009e), \ chr, \ mkword(props), \ bank, +/** + * Unsets a flag on the given chr's flags or flags2 property. + * + * See set_self_flag_bankx for more info. + */ #define unset_chr_flag_bankx(chr, flag, bank) \ mkshort(0x009f), \ chr, \ mkword(flag), \ bank, +/** + * Checks if the given flag is set on the given chr's flags or flags2 property. + * + * See set_self_flag_bankx for more info. + */ #define if_chr_has_flag_bankx(chr, flag, bank, label) \ mkshort(0x00a0), \ chr, \ @@ -850,173 +1400,331 @@ bank, \ label, +/** + * Sets the given stage flag. + * + * Stage flags are defined in each stage's setup file and are named with a + * STAGEFLAG prefix. They are used to track events that have happened. Stage + * flags can also be mapped to objectives to make them complete or fail when the + * stage flag is set. + */ #define set_stage_flag(stageflag) \ mkshort(0x00a1), \ mkword(stageflag), +/** + * Unsets the given stage flag. + * + * If the stage flag is mapped to an objective, the objective may become + * incomplete. + */ #define unset_stage_flag(stageflag) \ mkshort(0x00a2), \ mkword(stageflag), +/** + * Checks if the given stage flag is set or not set. + * + * Set bool to TRUE if checking if set, or FALSE if checking if unset. + */ #define if_stage_flag_eq(stageflag, bool, label) \ mkshort(0x00a3), \ mkword(stageflag), \ bool, \ label, +/** + * Sets a flag on the current chr's chrflags property (chr struct offset 0x18). + * + * Expects a CHRCFLAG constant. + */ #define set_self_chrflag(chrflag3) \ mkshort(0x00a4), \ mkword(chrflag3), +/** + * Unsets a flag on the current chr's chrflags property. + * + * See set_self_chrflag for more info. + */ #define unset_self_chrflag(chrflag3) \ mkshort(0x00a5), \ mkword(chrflag3), +/** + * Checks if the current chr has the given chrflag. + * + * See set_self_chrflag for more info. + */ #define if_self_has_chrflag(chrflag3, label) \ mkshort(0x00a6), \ mkword(chrflag3), \ label, +/** + * Sets a flag on the given chr's chrflags property. + * + * See set_self_chrflag for more info. + */ #define set_chr_chrflag(chr, chrflag3) \ mkshort(0x00a7), \ chr, \ mkword(chrflag3), +/** + * Unsets a flag on the given chr's chrflags property. + * + * See set_self_chrflag for more info. + */ #define unset_chr_chrflag(chr, chrflag3) \ mkshort(0x00a8), \ chr, \ mkword(chrflag3), +/** + * Checks if the given chr has the given chrflag. + * + * See set_self_chrflag for more info. + */ #define if_chr_has_chrflag(chr, chrflag3, label) \ mkshort(0x00a9), \ chr, \ mkword(chrflag3), \ label, +/** + * Sets a flag on the object's flags property (object struct offset 0x08). + * + * Expects an OBJECTFLAG0 constant. + */ #define set_object_flag_bank0(object, objectflag0) \ mkshort(0x00aa), \ object, \ mkword(objectflag0), +/** + * Unsets a flag on the object's flags property. + * + * See set_object_flag_bank0 for more info. + */ #define unset_object_flag_bank0(object, objectflag0) \ mkshort(0x00ab), \ object, \ mkword(objectflag0), +/** + * Checks if the given object has the given flags property. + * + * See set_object_flag_bank0 for more info. + */ #define if_object_has_flag(object, flag, label) \ mkshort(0x00ac), \ object, \ mkword(flag), \ label, +/** + * Sets a flag on the object's flags2 property (object struct offset 0x0c). + * + * Expects an OBJECTFLAG1 constant. + */ #define set_object_flag_bank1(object, objectflag1) \ mkshort(0x00ad), \ object, \ mkword(objectflag1), +/** + * Unsets a flag on the object's flags2 property. + * + * See set_object_flag_bank1 for more info. + */ #define unset_object_flag_bank1(object, objectflag1) \ mkshort(0x00ae), \ object, \ mkword(objectflag1), +/** + * Checks if the given object has the given flags2 property. + * + * See set_object_flag_bank1 for more info. + */ #define if_object_flag_bank1(object, objectflag1, label) \ mkshort(0x00af), \ object, \ mkword(objectflag1), \ label, -#define set_follow_chr(chr) \ +/** + * Sets the current chr's chrpreset property. + * + * chrpreset is a general purpose property. It can be referenced via CHR_PRESET. + */ +#define set_chrpreset(chr) \ mkshort(0x00b0), \ chr, +/** + * Sets the current chr's target property to the given chr. + * + * The target is a general purpose property. It can be referenced via + * CHR_TARGET. + */ #define set_chr_target_chr(chr, target) \ mkshort(0x00b1), \ chr, \ target, -#define set_target_pad(pad) \ +/** + * Sets the current chr's padpreset property. + * + * padpreset can be referenced via PAD_PRESET. + */ +#define set_padpreset(pad) \ mkshort(0x00b2), \ mkshort(pad), +/** + * Sets the given chr's padpreset property. + * + * padpreset can be referenced via PAD_PRESET. + */ #define chr_set_target_pad(pad) \ mkshort(0x00b3), \ chr, \ mkshort(pad), +/** + * Copies the padpreset from the source chr to the destination chr. + */ #define chr_copy_target_pad(srcchr, dstchr) \ mkshort(0x00b4), \ srcchr, \ dstchr, +/** + * This command would have printed a message to the developer's console. + * + * It has no purpose in the retail game. + */ #define dprint \ mkshort(0x00b5), +/** + * Resets the current chr's timer to zero and starts it. + */ #define restart_timer \ mkshort(0x00b6), +/** + * Resets the current chr's timer to zero. The running state is unchanged. + */ #define reset_timer \ mkshort(0x00b7), +/** + * Pauses the current chr's timer. The timer value is unchanged. + */ #define pause_timer \ mkshort(0x00b8), +/** + * Resumes the current chr's timer. The timer continues from where it left off + * previously. + */ #define resume_timer \ mkshort(0x00b9), +/** + * Checks if the current chr's timer is stopped. + */ #define if_timer_stopped(label) \ mkshort(0x00ba), \ label, /** - * Compares the timer against the chr's random value. - * (You need to use call_rng before using this) + * Checks if the current chr's timer value is greater than the chr's rand value. + * + * You need to use call_rng before using this. */ #define if_timer_gt_random(label) \ mkshort(0x00bb), \ label, +/** + * Checks if the current chr's timer value is greater than the given value. + */ #define if_timer_gt(value, label) \ mkshort(0x00bd), \ 0x00, \ mkshort(value), \ label, +/** + * Checks if the current chr's timer value is less than the given value. + */ #define if_timer_lt(value, label) \ mkshort(0x00bc), \ 0x00, \ mkshort(value), \ label, +/** + * Shows the countdown timer. + */ #define show_countdown_timer \ mkshort(0x00be), +/** + * Hides the countdown timer. + */ #define hide_countdown_timer \ mkshort(0x00bf), +/** + * Sets the countdown timer value. + */ #define set_countdown_timer(seconds) \ mkshort(0x00c0), \ mkshort(seconds), +/** + * Stops the countdown timer. + */ #define stop_countdown_timer \ mkshort(0x00c1), +/** + * Starts the countdown timer. + */ #define start_countdown_timer \ mkshort(0x00c2), +/** + * Checks if the countdown timer is stopped. + */ #define if_countdown_timer_stopped(label) \ mkshort(0x00c3), \ label, +/** + * Checks if the countdown timer value is less than the given value. + */ #define if_countdown_timer_lt(value, label) \ mkshort(0x00c4), \ mkshort(value), \ label, +/** + * Checks if the countdown timer value is greater than the given value. + */ #define if_countdown_timer_gt(value, label) \ mkshort(0x00c5), \ mkshort(value), \ label, +/** + * Attempts to spawn a chr at the given pad. + */ #define try_spawn_chr_at_pad(body, head, pad, function, props, label) \ mkshort(0x00c6), \ body, \ @@ -1026,6 +1734,9 @@ mkword(props), \ label, +/** + * Attempts to spawn a chr at the given chr. + */ #define try_spawn_chr_at_chr(body, head, u1, function, props, label) \ mkshort(0x00c7), \ body, \ @@ -1035,6 +1746,11 @@ mkword(props), \ label, +/** + * Makes the chr equip the given weapon. + * + * Will cause crashes if the weapon's model file lacks positional information. + */ #define try_equip_weapon(model, weapon, flags, label) \ mkshort(0x00c8), \ mkshort(model), \ @@ -1042,6 +1758,14 @@ mkword(flags), \ label, +/** + * Makes the chr equip the given hat. + * + * Perfect Dark has no hats, but you can assign a weapon ID if you want the chr + * to wear a weapon like a hat. + * + * Will cause crashes if the weapon's model file lacks positional information. + */ #define try_equip_hat(u1, flags, label) \ mkshort(0x00c9), \ mkshort(u1), \ @@ -1055,17 +1779,35 @@ mkword(u1), \ label, +/** + * Show a HUD message to the player. + * + * The chr argument should be a player. + */ #define message(chr, text) \ mkshort(0x00cb), \ chr, \ mkshort(text), +/** + * Show a HUD message in the top middle of the screen. + * + * The chr argument should be a player. + * The color argument should be a COLOR constant. + */ #define display_text_top_middle(chr, text, color) \ mkshort(0x00cc), \ chr, \ mkshort(text), \ color, +/** + * Makes the given speech play and text appear at the top of the screen. + * + * The chr argument should be a player. + * The channel argument should be a CHANNEL constant. + * The color argument should be a COLOR constant. + */ #define speak(chr, text, sound, channel, color) \ mkshort(0x00cd), \ chr, \ @@ -1074,11 +1816,22 @@ channel, \ color, +/** + * Plays the given sound effect. + * + * The channel argument should be a CHANNEL constant. + */ #define play_sound(id, channel) \ mkshort(0x00ce), \ mkshort(id), \ channel, +/** + * Plays or stops a sound coming from the given object. + * + * The channel argument should be a CHANNEL constant. + * The bool argument should be TRUE to play or FALSE to stop. + */ #define control_sound_from_object(channel, object, bool) \ mkshort(0x00cf), \ channel, \ @@ -1086,6 +1839,9 @@ 0x00, \ bool, +/** + * Plays a sound coming from the given pad. + */ #define play_sound_from_pad(pad, sound) \ mkshort(0x00d0), \ 0x00, \ @@ -1104,6 +1860,11 @@ mkshort(audio_id), \ mkshort(u1), +/** + * Stops the given audio channel. + * + * The channel argument should be a CHANNEL constant. + */ #define mute_channel(channel) \ mkshort(0x00d3), \ channel, @@ -1114,15 +1875,29 @@ mkshort(u2), \ label, +/** + * Assigns a path to a hovercar and makes it start it. + */ #define begin_hovercar_path(path) \ mkshort(0x00d5), \ path, +/** + * Sets the hoverbot's speed. + * + * Speed is the maximum speed. 512 is an appropriate speed. + * + * The num_accel_frames is how many frames the vehicle takes to adjust to the + * new speed, assuming 60 frames per second. + */ #define set_vehicle_speed(speed, num_accel_frames) \ mkshort(0x00d6), \ mkshort(speed), \ mkshort(num_accel_frames), +/** + * Sets the speed of a component of the given vehicle, such as a rotor or wheel. + */ #define set_rotor_speed(speed, u1, u2) \ mkshort(0x00d7), \ mkshort(speed), \ @@ -1137,6 +1912,12 @@ mkshort(0x00d9), \ u1, +/** + * Sets the image for a monitor object. + * + * For single screen objects, slot should be 0. + * For multi screen objects, slot can be 0-3. + */ #define set_object_image(object, slot, image) \ mkshort(0x00da), \ object, \ @@ -1147,6 +1928,11 @@ mkshort(0x00db), \ u1, +/** + * End the current level immediately. + * + * If all objectives are complete then the endscreen will be completed. + */ #define end_level \ mkshort(0x00dc), @@ -1163,15 +1949,29 @@ mkshort(u1), \ mkshort(u2), +/** + * Remove control from the given chr. + * + * Used for the auto walk sequences in Extraction and Duel. + */ #define revoke_control(chr, value) \ mkshort(0x00e0), \ chr, \ value, +/** + * Grant control back to the given chr. + */ #define grant_control(chr) \ mkshort(0x00e1), \ chr, +/** + * Attempt to move the chr to the given pad. The chr is moved immediately. + * + * For an immersive gameplay experience, do not do this while the chr is on + * screen. + */ #define chr_move_to_pad(chr, pad, unknown, label) \ mkshort(0x00e2), \ chr, \ @@ -1192,7 +1992,11 @@ chr, \ label, -#define open_door2(door) \ +/** + * Set the door's state to be fully open. There is no transition; the state is + * applied instantly. + */ +#define set_door_open(door) \ mkshort(0x00e8), \ door, @@ -1201,14 +2005,19 @@ chr, \ u1, -// Reads 4 global values and counts how many are nonzero. -// If number of nonzeroes is less than given value, goto label. -// Only ever called with value = 2 +/** + * Checks if the number of players is less than the given value. + */ #define if_num_human_players_lt(value, label) \ mkshort(0x00ea), \ value, \ label, +/** + * Checks if the chr's quantity of ammotype is less than the given value. + * + * Ammotype is expected to be an AMMOTYPE constant. + */ #define if_ammo_quantity_lt(chr, ammotype, value, label) \ mkshort(0x00eb), \ chr, \ @@ -1216,11 +2025,17 @@ value, \ label, +/** + * Makes the player equip the given weapon. + */ #define chr_draw_weapon(chr, weapon) \ mkshort(0x00ec), \ chr, \ weapon, +/** + * Makes the player equip the given weapon (for cutscene use). + */ #define chr_draw_weapon_in_cutscene(chr, weapon) \ mkshort(0x00ed), \ chr, \ @@ -1231,6 +2046,9 @@ x, \ z, +/** + * Checks if the given object is in the given room. + */ #define if_object_in_room(object, room, label) \ mkshort(0x00ef), \ object, \ @@ -1241,6 +2059,9 @@ mkshort(0x00f0), \ label, +/** + * Checks if the current chr is attacking. + */ #define if_attacking(label) \ mkshort(0x00f1), \ label, @@ -1248,6 +2069,9 @@ #define cmd00f2 \ mkshort(0x00f2), +/** + * Makes the given player invincible. + */ #define set_invincible(chr) \ mkshort(0x00f3), \ chr, @@ -1268,29 +2092,54 @@ mkshort(0x00f6), \ label, +/** + * Checks if all objectives are complete. + */ #define if_all_objectives_complete(label) \ mkshort(0x00f7), \ label, +/** + * Checks if the player is invincible. + * + * Set set_invincible. + */ #define if_player_is_invincible(chr, label) \ mkshort(0x00f8), \ chr, \ label, +/** + * Starts the X music theme. The music will play for the given number of seconds + * before reverting to the standard level theme. + */ #define play_x_music(channel, seconds) \ mkshort(0x00f9), \ 0x01, \ channel, \ seconds, +/** + * Stops the music in the given channel. + */ #define stop_music_channel(channel) \ mkshort(0x00fa), \ channel, +/** + * Surround the given player in infinite explosions. + */ #define explosions_around_chr(chr) \ mkshort(0x00fb), \ chr, +/** + * Checks if the player's kill count is greater than the given value. + * + * Only chrs flagged with CHRCFLAG_KILLCOUNTABLE are counted. This is typically + * used to flag civilians, however is also used on enemies such as the hanger + * Skedar in Attack Ship. + */ #define if_kill_count_gt(value, label) \ mkshort(0x00fc), \ value, \ @@ -1301,9 +2150,15 @@ chr, \ label, +/** + * Kill Bond/Joanna immediately. + */ #define kill_bond \ mkshort(0x00fe), +/** + * Make the current chr do a surprised animation. + */ #define be_surprised_00ff \ mkshort(0x00ff), @@ -1330,6 +2185,10 @@ mkshort(0x0103), \ label, +/** + * Removes a prop (chr or object) from the stage. The prop is the one referenced + * by the current chr's proppreset property. + */ #define remove_object_at_proppreset \ mkshort(0x0104), @@ -1338,13 +2197,26 @@ mkshort(u1), \ label, +/** + * Set the current chr's target to the given chr. + * + * This command supports copying the target from another chr too, but this is + * not currently supported by the decomp project. + */ #define set_target_chr(chr) \ mkshort(0x0106), \ chr, \ 0x00, \ 0x00, -#define if_target_chrs_target_is_different(label) \ +/** + * Checks if the current chr's chrpreset's target is different to the current + * chr's target. + * + * Could be used to set an ally as your chrpreset, then use this command to + * prevent both chrs from attacking the same enemy. + */ +#define if_chrpresets_target_is_different(label) \ mkshort(0x0107), \ label, @@ -1372,13 +2244,19 @@ mkshort(u2), \ label, +/** + * Set the team that the chr is on. + * + * The values are not well understood yet. Enemies are typically assigned to + * team 0x02 and allies to team 0x10, but this varies. + */ #define set_chr_team(chr, team) \ mkshort(0x010b), \ chr, \ team, /** - * Compare current chr's chrpreset's team with our own. + * Compares the current chr's chrpreset's team with our own. * * checktype 1 = if friendly * checktype 2 = if enemies @@ -1391,26 +2269,41 @@ #define noop010d \ mkshort(0x010d), +/** + * Set the shield amount for the current chr. + */ #define set_shield(value) \ mkshort(0x010e), \ mkshort(value), +/** + * Checks if the chr's shield amount is less than the given value. + */ #define if_chr_shield_lt(chr, value, label) \ mkshort(0x010f), \ chr, \ mkshort(value), \ label, +/** + * Checks if the chr's shield amount is greater than the given value. + */ #define if_chr_shield_gt(chr, u1, label) \ mkshort(0x0110), \ chr, \ mkshort(u1), \ label, +/** + * Begins a camera animation (ie. for cutscenes). + */ #define camera_movement(animation) \ mkshort(0x0111), \ mkshort(animation), +/** + * Makes the given object do the given animation. + */ #define object_do_animation(u1, object, u2, u3) \ mkshort(0x0112), \ mkshort(u1), \ @@ -1418,72 +2311,128 @@ mkshort(u2), \ u3, +/** + * Checks if a cutscene is still running. + */ #define if_camera_animating(label) \ mkshort(0x0113), \ label, +/** + * Shows the given chr. + */ #define show_chr(chr) \ mkshort(0x0114), \ chr, +/** + * Hides the given chr. + */ #define hide_chr(chr) \ mkshort(0x0115), \ chr, +/** + * Shows the given object. + */ #define show_object(object) \ mkshort(0x0116), \ object, +/** + * Hides the given object. + */ #define hide_object(object) \ mkshort(0x0117), \ object, +/** + * Sets a flag on the object's flags3 property (object struct offset 0x10). + * + * Expects an OBJECTFLAG2 constant. + */ #define set_object_flag_bank2(object, objectflag2) \ mkshort(0x0118), \ object, \ mkword(objectflag2), +/** + * Unsets a flag on the object's flags3 property. + * + * See set_object_flag_bank2 for more info. + */ #define unset_object_flag_bank2(object, objectflag2) \ mkshort(0x0119), \ object, \ mkword(objectflag2), +/** + * Checks if the given object has the given flags3 property. + * + * See set_object_flag_bank2 for more info. + */ #define if_object_flag_bank2(object, objectflag2, label) \ mkshort(0x011a), \ object, \ mkword(objectflag2), \ label, +/** + * Sets a flag on the given chr's hidden property (chr struct offset 0x14). + * + * Expects a CHRHFLAG constant. + */ #define set_chr_hiddenflag(chr, chrflag2) \ mkshort(0x011b), \ chr, \ mkword(chrflag2), +/** + * Unsets a flag on the given chr's hidden property. + * + * See set_chr_hiddenflag for more info. + */ #define unset_chr_hiddenflag(chr, chrflag2) \ mkshort(0x011c), \ chr, \ mkword(chrflag2), +/** + * Checks if the given chr has the given hidden flag. + * + * See set_chr_hiddenflag for more info. + */ #define if_chr_has_hiddenflag(chr, chrflag2, label) \ mkshort(0x011d), \ chr, \ mkword(chrflag2), \ label, +/** + * Checks if the given chr is human. + * + * Not sure how this handles Maians, or the female Extraction guards. + */ #define if_chr_is_human(chr, label) \ mkshort(0x011e), \ chr, \ label, +/** + * Checks if the given chr is Skedar. + */ #define if_chr_is_skedar(chr, label) \ mkshort(0x011f), \ chr, \ label, -// Tries to find an chr in the team who meets certain criteria. For each chr, a -// score is calculated based on several factors, such as whether they've been -// shot. If any chr in the team has a score lower than the given value, the -// condition passes. +/** + * Tries to find a chr in the smae team who meets certain criteria. + * + * For each chr, a risk is calculated based on several factors, such as whether + * they've been shot. If any chr in the team has a risk lower than the given + * value then the condition passes. + */ #define if_retreat_risk_lt(value, label) \ mkshort(0x0120), \ value, \ @@ -1512,23 +2461,32 @@ action, // Related to command 012f -// globals.s only +// globals.c only #define cmd0125_if_or_try_something(label) \ mkshort(0x0125), \ label, +/** + * Checks if the player is using the CMP150 or AR34. + */ #define if_player_using_cmp150_or_ar34(label) \ mkshort(0x0126), \ label, -// Tries to find a chr in the team who meets some criteria and sets them as the -// current chr's target. This is different to the target chr. +/** + * Tries to find a chr in the team who meets some criteria and sets them as the + * current chr's target. + * + * Probably used to run to them for safety or to alert them. + */ #define try_find_chr_in_team(label) \ mkshort(0x0127), \ label, -// Check if there's an enemy within the range and sight, then sets the -// target chr field to that enemy +/** + * Checks if there's an enemy within the range and sight, then sets the + * chr's target chr field to that enemy. + */ #define if_enemy_distance_lt_and_los(distance, label) \ mkshort(0x0128), \ distance / 10, \ @@ -1559,16 +2517,17 @@ mkshort(0x012c), \ label, -// If chr field 0x292 > 0, call some function. +// If chr->cover > 0, call some function. // Involves some global array at 0x800a2360 -// globals.s only +// globals.c only #define cmd012f \ mkshort(0x012f), /** - * Make chr say something out of a random set of 3. Sets are defined in globals. - * The bank argument applies to humans only. Skedar and maians have their own - * hard coded banks. + * Makes chr say something out of a random set of 3. + * + * Sets are defined in the 39850 file. The bank argument applies to humans only. + * Skedar and maians have their own hard coded banks. */ #define say_quip(chr, index, u1, u2, u3, bank, u4, channel) \ mkshort(0x0130), \ @@ -1581,27 +2540,44 @@ u4, \ channel, +/** + * Sets the alertness value for all chrs in the current chr's squadron. + */ #define set_squadron_alertness(value) \ mkshort(0x0131), \ value, -// Sets chr's action to value. If bool is false, also sets orders to zero. -#define set_action(value, bool) \ +/** + * Set the current chr's action. If bool is false, also sets orders to zero. + * + * Action is expected to be an ACT constant. + */ +#define set_action(action, bool) \ mkshort(0x0132), \ - value, \ + action, \ bool, +/** + * This appears to be misnamed. At a glance it looks like this is looking for + * a chr in the squadron who is performing the given action. + */ #define set_orders(orders, label) \ mkshort(0x0133), \ orders, \ label, +/** + * Checks if the current chr's orders equal the given value. + */ #define if_orders_eq(action, label) \ mkshort(0x0134), \ 0xfd, \ action, \ label, +/** + * Checks if the current chr has orders at all. + */ #define if_has_orders(label) \ mkshort(0x0135), \ label, @@ -1619,6 +2595,12 @@ action, \ label, +/** + * Checks if the sound if finished in the given channel. + * + * For chr speeches this should be accompanied by a timer check as well, + * otherwise the speech can be skipped by pausing as it starts. + */ #define if_sound_finished(channel, label) \ mkshort(0x0138), \ channel, \ @@ -1627,7 +2609,7 @@ // value is either 25, 70 or 335. // u1 is either 1 or 2. // It seems related to the chr's prop properties -// Used by G5 cloaked guards, Deep Sea cloaked purple guards and globals.s +// Used by G5 cloaked guards, Deep Sea cloaked purple guards and globals.c // I think this is related to flanking, where the value arg is the angle // relative to the player's direction. 335 is the same as 25 degress to the // right (360 - 25). @@ -1649,6 +2631,9 @@ 0x00, \ label, +/** + * Set the current chr's squadron. + */ #define set_squadron(id) \ mkshort(0x013b), \ id, @@ -1659,12 +2644,15 @@ // Value is only ever 3. The function checks bits 0x01 and 0x02 to decide what // to do, so in all cases it does both paths. -// globals.s only +// globals.c only #define cmd013d_if_grenade_thrown_nearby_maybe(value, label) \ mkshort(0x013d), \ value, \ label, +/** + * Makes the chr run away from a live grenade. + */ #define run_from_grenade \ mkshort(0x013e), @@ -1672,12 +2660,21 @@ mkshort(0x013f), \ label, +/** + * Checks if a hoverbot has finished its path. + */ #define if_hoverbot_path_finished(u1, u2, label) \ mkshort(0x0140), \ u1, \ u2, \ label, +/** + * Shuffle a set of Investigation terminals. + * + * It works by editing the dst object tags to repoint them to the good and alarm + * terminals. + */ #define shuffle_investigation_terminals(dst1, dst2, src1, src2, src3, src4) \ mkshort(0x0141), \ dst1, \ @@ -1693,7 +2690,7 @@ * then uses a lookup table at g_InvestigationPadMap to decide which pad to set * as the current chr's pad preset. * - * It's only used for investigation scientists to run to a spot in front of the + * It's only used for Investigation scientists to run to a spot in front of the * terminal. Due to the fact that this lookup table is hard coded in a global * location, it's recommended to keep usage of this function to one stage only. */ @@ -1712,25 +2709,43 @@ mkshort(0x0144), \ label, -// Rebuild an array of teams containing chr IDs in that team +/** + * Rebuilds the list of teams containing chr IDs in each team. + * + * Should be used after reassigning chrs to teams. + */ #define rebuild_teams \ mkshort(0x0145), -// Rebuild an array of squadrons containing chr IDs in that squadron +/** + * Rebuilds the list of squadrons containing chr IDs in each squadron. + * + * Should be used after reassigning chrs to squadrons. + */ #define rebuild_squadrons \ mkshort(0x0146), +/** + * Checks if all chrs in the given squadron are dead. + */ #define if_all_chrs_in_squadron_are_dead(squadron, label) \ mkshort(0x0147), \ squadron, \ label, +/** + * Set the given chr to listening. + * + * The listening feature appears to be completely unused. + */ #define chr_set_listening(chr, value) \ mkshort(0x0148), \ chr, \ value, /** + * Checks if the given chr is listening. + * * checktype 0 = if chr's listening value is listenvalue * checktype 1 = if chr's convtalk value is zero */ @@ -1752,36 +2767,66 @@ u3, \ label, +/** + * Checks if the current chr is not listening (ie. not participating in a + * conversation). + */ #define if_not_listening(label) \ mkshort(0x014b), \ label, +/** + * Checks if the number of chrs in the given squadron is greater than the given + * value. + */ #define if_num_chrs_in_squadron_gt(value, squadron, label) \ mkshort(0x0152), \ value, \ squadron, \ label, +/** + * Toggles tinted glass opaqueness/transparency. + */ #define set_tinted_glass_enabled(bool) \ mkshort(0x0157), \ bool, +/** + * Plays the given music track. + */ #define play_music_track(id) \ mkshort(0x015b), \ id, +/** + * Restarts the default stage music from the beginning. + */ #define restart_music \ mkshort(0x015c), +/** + * Checks if the chr injured their target. Use this after attacking. + * + * The command will unset the flag so it may be used again. + */ #define if_chr_injured_target(chr, label) \ mkshort(0x0165), \ chr, \ label, +/** + * Checks if the current chr's action is the given action. + */ #define if_action_eq(action, label) \ mkshort(0x0166), \ label, +/** + * Makes the Extraction hovercopter fire a rocket from the given side. + * + * Side may be 0 or 1. + */ #define hovercopter_fire_rocket(side) \ mkshort(0x0167), \ side, @@ -1797,6 +2842,12 @@ action, \ label, +/** + * Checks if the chr's Y coordinate is greater than or less than the given + * value. + * + * Operator is expected to be OPERATOR_LESS_THAN or OPERATOR_GREATER_THAN. + */ #define if_chr_y(chr, value, operator, label) \ mkshort(0x016a), \ chr, \ @@ -1804,6 +2855,11 @@ operator, \ label, +/** + * Play a sound from the given object. + * + * Typically used to make terminals hum. + */ #define play_sound_from_object(channel, object, sound, u1) \ mkshort(0x016b), \ channel, \ @@ -1816,6 +2872,9 @@ #define noop016c \ mkshort(0x016c), +/** + * Add motion blur to the player. Motion blur will wear off automatically. + */ #define add_motion_blur(chr, value, bool) \ mkshort(0x016d), \ chr, \ @@ -1844,23 +2903,40 @@ bool, \ label, +/** + * Checks if the chr's distance to their dropped gun is less than the given + * value. + */ #define if_distance_to_gun_lt(distance, label) \ mkshort(0x0171), \ mkshort(distance / 10), \ label, -// Makes gun disappear from the ground and gives it to the chr -// (when a guard drops their gun and picks it up) +/** + * Makes the chr's gun disappear from the ground and gives it to the chr + * (when a guard drops their gun and picks it up). + */ #define chr_recover_gun(chr, label) \ mkshort(0x0172), \ chr, \ label, +/** + * Attempts to copy properties from the given chr to the current chr. + * + * Typically used after spawning a guard. + */ #define try_inherit_properties(chr_src, label) \ mkshort(0x0173), \ chr_src, \ label, +/** + * Checks if a controller button has been pressed during a cutscene. + * + * This should be checked inside every loop in cutscenes, otherwise that part of + * the cutscene becomes unskippable. + */ #define if_controller_button_pressed(label) \ mkshort(0x0174), \ label, @@ -1872,12 +2948,14 @@ mkshort(0x0175), \ u1, -// Points to a non-command function...? -// globals.s only +// globals.c only #define cmd0176_if_something(label) \ mkshort(0x0176), \ label, +/** + * Forces the player to walk to the given pad (eg. Extraction and Duel). + */ #define force_walk(chr, pad, unknown1, unknown2) \ mkshort(0x0177), \ chr, \ @@ -1885,6 +2963,9 @@ mkshort(unknown1), \ mkshort(unknown2), +/** + * Checks if the player's force walk has finished. + */ #define if_force_walk_finished(chr, label) \ mkshort(0x0178), \ chr, \ @@ -1911,36 +2992,61 @@ chr, \ label, +/** + * Assigns a sound to the given channel. Does not play the sound. + */ #define assign_sound(sound, channel) \ mkshort(0x017c), \ mkshort(sound), \ channel, +/** + * Sets the music track for this stage. + */ #define set_music_track(id) \ mkshort(0x017d), \ id, +/** + * Restarts the default stage music. + */ #define restart_default_music \ mkshort(0x017e), +/** + * Sets the sound effects track. This is typically background noise like wind, + * waves and the Area 51 announcements. + */ #define set_sfx_track(id) \ mkshort(0x017f), \ id, +/** + * Resets the sound effects track. + */ #define reset_ambience \ mkshort(0x0180), +/** + * Checks if the player is looking directly at the given object. + */ #define if_chr_looking_at_object(chr, object, label) \ mkshort(0x0181), \ chr, \ object, \ label, +/** + * Makes the current chr attack their target by punching or kicking. + */ #define try_punch_or_kick(label) \ mkshort(0x0182), \ 0x00, \ label, +/** + * Checks if the current chr's target is the player. + */ #define if_target_is_player(label) \ mkshort(0x0183), \ label, @@ -1964,7 +3070,6 @@ u1, \ u2, -// The rom address for this command is not a valid function entry...? #define cmd0185_mponly \ mkshort(0x0185), @@ -1978,6 +3083,9 @@ mkshort(0x0187), \ label, +/** + * Checks if the lift is currently stopped. + */ #define if_lift_stationary(lift, label) \ mkshort(0x0188), \ lift, \ @@ -1994,20 +3102,38 @@ u1, \ label, +/** + * Enables rain. + * + * The given value is not known. It may be intensity or direction. + */ #define enable_rain(value) \ mkshort(0x018b), \ value, +/** + * Remove the necklace from the given chr. + */ #define remove_cass_necklace(chr) \ mkshort(0x018c), \ chr, \ 0x07, +/** + * Activate the given lift. + * + * Lifts need to be activated before they start working. + */ #define activate_lift(liftid, object) \ mkshort(0x018d), \ liftid, \ object, +/** + * Makes a miniskedar attempt to pounce. + * + * Will not pass the check if the miniskedar doesn't have enough room. + */ #define miniskedar_try_pounce(u1, u2, label) \ mkshort(0x018e), \ u1, \ @@ -2015,6 +3141,10 @@ 0x00, \ label, +/** + * Checks if the distance between the given object and the given pad is less + * than the given value. + */ #define if_object_distance_to_pad_lt(object, distance, pad, label) \ mkshort(0x018f), \ object, \ @@ -2022,45 +3152,75 @@ mkshort(pad), \ label, +/** + * Sets a savefile flag. + * + * Expected to be a SAVEFILEFLAG constant. + */ #define set_savefile_flag(flag) \ mkshort(0x0190), \ flag, +/** + * Unsets a savefile flag. + */ #define unset_savefile_flag(flag) \ mkshort(0x0191), \ flag, +/** + * Checks if the given savefile flag is set. + */ #define if_savefile_flag_is_set(flag, label) \ mkshort(0x0192), \ flag, \ label, +/** + * Checks if the given savefile flag is unset. + */ #define if_savefile_flag_is_unset(flag, label) \ mkshort(0x0193), \ flag, \ label, +/** + * Checks if the given object's health is less than the given value. + */ #define if_object_health_lt(object, value, label) \ mkshort(0x019e), \ object, \ mkshort(value), \ label, +/** + * Sets the given object's health. + */ #define set_object_health(object, value) \ mkshort(0x019f), \ object, \ mkshort(value), +/** + * Assigns a special death animation to the given chr. + * + * This is used for the Villa snipers and the Chicago guard on the fire escape. + */ #define set_chr_special_death_animation(chr, anim) \ mkshort(0x01a0), \ chr, \ anim, -// Sets the chr's roomtosearch field -// to the same room that the chr's target is in. +/** + * Sets the current chr's roomtosearch field to the same room that the chr's + * target is in. + */ #define set_chr_roomtosearch \ mkshort(0x01a1), +/** + * Play a quip for the CI staff. + */ #define play_cistaff_quip(bank, channel) \ mkshort(0x01a2), \ bank, \ @@ -2086,6 +3246,10 @@ mkshort(0x01a5), \ label, +/** + * Checks if the Y distance between the current chr and their target is less + * than the given value. + */ #define if_target_y_difference_lt(distance, label) \ mkshort(0x01a6), \ distance / 10, \ @@ -2100,25 +3264,47 @@ mkshort(0x01aa), \ label, +/** + * Checks if the number of knocked out chrs is less than or greater than the + * given value. + * + * Operator is expected to be OPERATOR_LESS_THAN or OPERATOR_GREATER_THAN. + */ #define if_num_subdued(value, operator, label) \ mkshort(0x01ab), \ value, \ 1 - operator, \ label, +/** + * Makes the player let go of the currently held object (eg. hovercrate or bed). + */ #define release_grabbed_object(chr) \ mkshort(0x01ad), \ chr, +/** + * Removes all items from the player's inventory. + */ #define clear_inventory(chr) \ mkshort(0x01ae), \ chr, +/** + * Makes the player grab the given object (eg. hovercrate or bed). + */ #define grab_object(chr, object) \ mkshort(0x01af), \ chr, \ object, +/** + * Shuffles the pillars in Skedar Ruins. + * + * The P arguments are pillars. M arguments are mines. + * + * The dst tags are remapped so they point at random pillars. + */ #define shuffle_ruins_pillars(pdst1, pdst2, pdst3, psrc1, psrc2, psrc3, psrc4, psrc5, mdst1, mdst2, mdst3, msrc1, msrc2, msrc3, msrc4, msrc5) \ mkshort(0x01b1), \ pdst1, \ @@ -2151,7 +3337,8 @@ * identifier. This should be called inside a loop to give the illusion of * referencing both players. * - * This is safe to use in solo mode; it will not set it to coop if they don't exist. + * This is safe to use in solo mode; it will not set it to coop if they don't + * exist. */ #define chr_toggle_p1p2(chr) \ mkshort(0x01b3), \ @@ -2161,16 +3348,26 @@ mkshort(0x01b4), \ label, +/** + * Sets the given chr's p1p2 value explicitly to the given p1p2_chr. + */ #define chr_set_p1p2(chr, p1p2_chr) \ mkshort(0x01b5), \ chr, \ p1p2_chr, +/** + * Enables or disables the snow effect. + */ #define enable_snow(bool) \ mkshort(0x01b6), \ bool, -// bool_unknown determines whether to call some function on the chr afterwards +/** + * Cloak or uncloak the given chr. + * + * bool_unknown determines whether to call some function on the chr afterwards + */ #define set_chr_cloaked(chr, bool_enable, bool_unknown) \ mkshort(0x01b7), \ chr, \ @@ -2182,6 +3379,11 @@ object, \ type, +/** + * Shuffle the generator switches in Pelagic II. + * + * Note no arguments are passed here. The switch numbers are hard coded. + */ #define shuffle_pelagic_switches \ mkshort(0x01b9), @@ -2201,38 +3403,70 @@ u1, \ label, +/** + * Checks if the CI training PC has been holographed. + */ #define if_training_pc_holographed(label) \ mkshort(0x01bd), \ label, +/** + * Checks if the given chr is using the given weapon. + */ #define if_chr_has_weapon_equipped(chr, weapon, label) \ mkshort(0x01be), \ chr, \ weapon, \ label, +/** + * Begins or ends the Deep Sea teleport effect. + * + * Call this with pad set, then go into a loop waiting for + * if_teleport_full_white, then call this again with pad = 0. + */ #define teleport_to_pad(pad, chr) \ mkshort(0x01bf), \ mkshort(pad), \ chr, +/** + * Checks if the teleport effect is full white. + */ #define if_teleport_full_white(label, chr) \ mkshort(0x01c0), \ label, \ chr, +/** + * Sets the current chr's punchdodge ailist. Not sure if this used or not. + */ #define set_aipunchdodgelist(ailistid) \ mkshort(0x01c1), \ mkshort(ailistid), +/** + * Sets the current chr's shootingatme ailist. + * + * This is used to make the chr attempt a dodge when the player is aiming at + * them. It is invoked somewhat randomly. See set_chr_dodge_rating. + */ #define set_aishootingatmelist(ailistid) \ mkshort(0x01c2), \ mkshort(ailistid), -#define set_darkroom_function(function) \ +/** + * Sets the current chr's darkroom ailist. This is assigned when the lights are + * switched off. + */ +#define set_darkroomlist(function) \ mkshort(0x01c3), \ mkshort(function), +/** + * Sets the current chr's playerdead ailist. This is probably assigned when the + * player dies. + */ #define set_aiplayerdeadlist(ailistid) \ mkshort(0x01c4), \ mkshort(ailistid), @@ -2242,15 +3476,26 @@ #define cmd01c5 \ mkshort(0x01c5), -// Sets a field in the chr struct -// If whichprop is 0, set dodgerating -// If whichprop is 1, set maxdodgerating -// If whichprop is 2, set both +/** + * Sets the current chr's dodgerating and maxdodgerating properties. + * + * If whichprop is 0, set dodgerating + * If whichprop is 1, set maxdodgerating + * If whichprop is 2, set both + * + * When the player aims at the chr, there is a random chance that they will + * attempt to dodge. Each time they decide not to dodge, the rating is doubled + * until it hits the max. Once the chr has dodged once they will not dodge + * again. + */ #define set_chr_dodge_rating(value, whichprop) \ mkshort(0x01c6), \ value, \ whichprop, +/** + * This doesn't appear to be used. + */ #define set_unarmeddodgerating(value) \ mkshort(0x01c7), \ value, @@ -2270,12 +3515,33 @@ mkshort(0x01c9), \ label, +/** + * Set a weapon to be used in a cutscene. + * + * If both weapon and fallback are given, this might set them to the left and + * right weapons. + * + * If weapon is -1 (WEAPON_NONE) and fallback is given, fallback will be used. + * + * If both are -1 (WEAPON_NONE), the chr's current weapon will be used if it's + * a pistol, otherwise the Falcon 2 will be used. + */ #define set_cutscene_weapon(chr, weapon, weapon_fallback) \ mkshort(0x01ca), \ chr, \ weapon, \ weapon_fallback, +/** + * Fade the scene to the given color over the given number of frames. + * + * The color is a hex colour code in RGBA format. + * For num_frames, assume 60 frames per second. + * + * You can fade in the level by calling this twice in a row: + * First with 0x000000ff (solid black) and num_frames = 0. + * Second with 0x00000000 (transparent) and num_frames = 90. + */ #define fade_to_color(rgba, num_frames) \ mkshort(0x01cb), \ mkword(rgba), \ @@ -2290,11 +3556,18 @@ chr, \ bool, -// If enabled, Jo cannot use weapons or even the "unarmed" weapon +/** + * Disallows the use of weapons and unarmed. + * + * Used in the Carrington Institute. + */ #define passive_mode(bool) \ mkshort(0x01ce), \ bool, +/** + * Makes a chr start or stop shooting in a cutscene. + */ #define set_chr_shooting_in_cutscene(chr, bool) \ mkshort(0x01cf), \ chr, \ @@ -2311,12 +3584,17 @@ 0xb7, \ bool, +/** + * Emits sparks from the given chr. + * + * Used for Dr Caroll. + */ #define emit_sparks(chr) \ mkshort(0x01d2), \ chr, /** - * Set the images for Dr Caroll. + * Sets the images for Dr Caroll. * * The chr argument must be Dr Caroll. The left and right arguments can be: * @@ -2336,6 +3614,11 @@ 0x08, \ 0x00, +/** + * Shows or hides non-essential chrs. + * + * Used for cutscenes. + */ #define show_nonessential_chrs(bool) \ mkshort(0x01d5), \ bool, @@ -2376,7 +3659,7 @@ value, /** - * Redundant command. Use if_distance_to_target_lt. + * Redundant command. See if_distance_to_target_lt. */ #define if_distance_to_target2_lt(distance, label) \ mkshort(0x01d7), \ @@ -2384,7 +3667,7 @@ label, /** - * Redundant command. Use if_distance_to_target_gt. + * Redundant command. See if_distance_to_target_gt. */ #define if_distance_to_target2_gt(distance, label) \ mkshort(0x01d8), \ @@ -2403,15 +3686,21 @@ u2, // Only called in AF1 with param 0x35. -// Calls some functions and stores the value at 80840c8. +// Calls some functions and stores the value at 800840c8. #define cmd01da(u1) \ mkshort(0x01da), \ u1, +/** + * Kills the given chr. + */ #define kill(chr) \ mkshort(0x01db), \ chr, +/** + * Removes the given weapon from the current player's inventory. + */ #define remove_weapon_from_inventory(weapon) \ mkshort(0x01dc), \ weapon, @@ -2424,8 +3713,10 @@ u1, \ label, -// Get distance from chr to pad, but only if they are on the same floor -// (ie. Y difference is less than 150). +/** + * Gets the distance from chr to pad, but only if they are on the same floor + * (ie. Y difference is less than 150). + */ #define if_chr_same_floor_distance_to_pad_lt(chr, pad, distance, label) \ mkshort(0x01df), \ chr, \ @@ -2433,6 +3724,7 @@ mkshort(distance / 10), \ label, +// Not sure about this #define if_coop_mode(label) \ mkshort(0x01de), \ label, diff --git a/src/include/constants.h b/src/include/constants.h index 3026bff1a..5446b7001 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -746,6 +746,8 @@ #define OUTFIT_MAIAN 0x0d #define OUTFIT_NEGOTIATOR 0x0e // unused by scripts +#define PAD_PRESET 0x2328 + #define PADEFFECT_SPARKS 0x00 #define PADEFFECT_01 0x01 // used only in Escape on a pad containing nothing #define PADEFFECT_SPLASH 0x02 @@ -961,8 +963,6 @@ #define STAGEINDEX_TEST_MP19 0x3b #define STAGEINDEX_TEST_MP20 0x3c -#define TARGET_PAD 0x2328 - #define TELEPORTSTATE_STARTING 1 #define TELEPORTSTATE_3 3 #define TELEPORTSTATE_4 4 diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index 29ba6b67d..0423f2725 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -46,9 +46,9 @@ /*0x0028*/ bool aiActivateAlarm(void); /*0x0029*/ bool aiDeactivateAlarm(void); /*0x002a*/ bool ai002a(void); -/*0x002b*/ bool aiTryJogToTargetChr(void); -/*0x002c*/ bool aiTryWalkToTargetChr(void); -/*0x002d*/ bool aiTryRunToTargetChr(void); +/*0x002b*/ bool aiTryJogToTargetProp(void); +/*0x002c*/ bool aiTryWalkToTargetProp(void); +/*0x002d*/ bool aiTryRunToTargetProp(void); /*0x002e*/ bool ai002e(void); /*0x002f*/ bool aiTryJogToChr(void); /*0x0030*/ bool aiTryWalkToChr(void); @@ -56,7 +56,7 @@ /*0x0032*/ bool aiIfStopped(void); /*0x0033*/ bool aiIfChrDying(void); /*0x0034*/ bool aiIfChrDeathAnimationFinished(void); -/*0x0035*/ bool aiIfPlayerInSight(void); +/*0x0035*/ bool aiIfTargetPropInSight(void); /*0x0036*/ bool aiRandom(void); /*0x0037*/ bool aiIfRandomLessThan(void); /*0x0038*/ bool aiIfRandomGreaterThan(void); diff --git a/src/setup/ailists.c b/src/setup/ailists.c index a5e6ca07a..92c4c7027 100644 --- a/src/setup/ailists.c +++ b/src/setup/ailists.c @@ -162,7 +162,7 @@ u8 func0006_unalerted[] = { label(0x13) dprint 'A','1','\n',0, if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x16) - if_target_chr_in_sight(/*goto*/ LABEL_SEE_DETECT) + if_target_in_sight(/*goto*/ LABEL_SEE_DETECT) label(0x16) dprint 'B','4',' ','A','I','V','S','A','I','\n',0, if_self_flag_bankx_eq(CHRFLAG0_AIVSAI, FALSE, BANK_0, /*goto*/ LABEL_AIVSAIFAIL) @@ -543,7 +543,7 @@ u8 func0006_unalerted[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x13) - if_target_chr_in_sight(/*goto*/ 0x16) + if_target_in_sight(/*goto*/ 0x16) label(0x13) if_self_distance_to_chr_lt(150, CHR_SEEDIE, /*goto*/ 0x7f) if_chr_stopped(/*goto*/ 0x7f) @@ -566,7 +566,7 @@ u8 func0006_unalerted[] = { set_target_chr(CHR_P1P2) if_hears_gunfire(/*goto*/ 0x16) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x13) - if_target_chr_in_sight(/*goto*/ 0x17) + if_target_in_sight(/*goto*/ 0x17) label(0x13) if_self_flag_bankx_eq(CHRFLAG0_CAN_EXAMINE_BODY, FALSE, BANK_0, /*goto*/ 0x13) if_timer_lt(120, /*goto*/ 0x13) @@ -879,7 +879,7 @@ u8 func0007_alerted[] = { label(0x16) set_shotlist(GAILIST_ALERTED) set_aishootingatmelist(GAILIST_DODGE) - set_darkroom_function(GAILIST_SEARCH_FOR_PLAYER) + set_darkroomlist(GAILIST_SEARCH_FOR_PLAYER) dprint 'S','T','A','R','T',' ','L','O','O','P','\n',0, if_chr_dying(CHR_SELF, /*goto*/ 0x16) @@ -1213,7 +1213,7 @@ u8 func0007_alerted[] = { dprint 'W','A','I','T',' ','F','O','R',' ','A','M','B','\n',0, if_in_disarm_range(/*goto*/ 0xa3) dprint 'A','M','B','1','\n',0, - if_distance_from_target_to_pad_lt(200, TARGET_PAD, /*goto*/ 0x13) + if_distance_from_target_to_pad_lt(200, PAD_PRESET, /*goto*/ 0x13) dprint 'A','M','B','2','\n',0, chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) @@ -1359,7 +1359,7 @@ u8 func0007_alerted[] = { // Distance > 2500 label(0x14) - try_run_to_target_chr(/*goto*/ 0xe1) + try_run_to_target(/*goto*/ 0xe1) beginloop(0xe1) if_chr_distance_lt(2500, /*goto*/ 0x15) @@ -1521,7 +1521,7 @@ u8 func0007_alerted[] = { set_self_flag_bankx(CHRFLAG0_00000010, BANK_0) dprint 'U','N','D','E','R',' ','C','O','V','E','R','\n',0, label(0x58) - set_follow_chr(CHR_TARGET) + set_chrpreset(CHR_TARGET) restart_timer set_action(MA_COVERWAIT, TRUE) unset_self_flag_bankx(CHRFLAG1_00040000, BANK_1) @@ -1567,7 +1567,7 @@ u8 func0007_alerted[] = { label(0x16) cmd012f restart_timer - try_run_to_target_chr(/*goto*/ 0x62) + try_run_to_target(/*goto*/ 0x62) beginloop(0x62) cmd013d_if_grenade_thrown_nearby_maybe(MA_GRENADEWAIT, /*goto*/ LABEL_FLEE_GRENADE) @@ -1950,7 +1950,7 @@ u8 func0007_alerted[] = { dprint 'S','E','E','W','A','I','T','3','\n',0, if_in_disarm_range(/*goto*/ 0x8a) restart_timer - try_run_to_target_chr(/*goto*/ 0x89) + try_run_to_target(/*goto*/ 0x89) beginloop(0x89) cmd013d_if_grenade_thrown_nearby_maybe(MA_GRENADEWAIT, /*goto*/ LABEL_FLEE_GRENADE) @@ -2148,14 +2148,14 @@ u8 func0007_alerted[] = { goto_first(0x1b) label(LABEL_TRACK) - set_follow_chr(CHR_TARGET) + set_chrpreset(CHR_TARGET) dprint 'T','R','A','C','K','\n',0, set_action(MA_TRACKING, FALSE) unset_self_flag_bankx(CHRFLAG1_00040000, BANK_1) unset_self_flag_bankx(CHRFLAG1_00020000, BANK_1) restart_timer label(0xf7) - try_run_to_target_chr(/*goto*/ 0x35) + try_run_to_target(/*goto*/ 0x35) beginloop(0x35) if_chr_has_hiddenflag(CHR_SELF, CHRHFLAG_00002000, /*goto*/ 0x13) @@ -2265,7 +2265,7 @@ u8 func0007_alerted[] = { unset_self_flag_bankx(CHRFLAG1_00040000, BANK_1) unset_self_flag_bankx(CHRFLAG1_00020000, BANK_1) restart_timer - try_run_to_target_chr(/*goto*/ 0x85) + try_run_to_target(/*goto*/ 0x85) beginloop(0x85) cmd013d_if_grenade_thrown_nearby_maybe(MA_GRENADEWAIT, /*goto*/ LABEL_FLEE_GRENADE) @@ -2669,7 +2669,7 @@ u8 func000a_do_idle_animation[] = { label(0x07) dprint 'N','A','T',' ','5','\n',0, restart_timer - try_face_entity(ENTITYTYPE_PAD, TARGET_PAD, /*goto*/ 0xfa) + try_face_entity(ENTITYTYPE_PAD, PAD_PRESET, /*goto*/ 0xfa) beginloop(0xfa) if_timer_gt(60, /*goto*/ 0x06) @@ -2698,7 +2698,7 @@ u8 func000a_do_idle_animation[] = { beginloop(0x15) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x13) + if_target_in_sight(/*goto*/ 0x13) if_self_flag_bankx_eq(CHRFLAG0_AIVSAI, FALSE, BANK_0, /*goto*/ 0x16) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x13) goto_next(0x16) @@ -2966,7 +2966,7 @@ u8 func000c_combat_with_target_chr[] = { goto_next(0x16) label(0x13) - if_target_chrs_target_is_different(/*goto*/ 0xb3) + if_chrpresets_target_is_different(/*goto*/ 0xb3) label(0x16) dprint 'N','O',' ','T','A','R','G','E','T','\n',0, set_target_chr(-1) @@ -3022,7 +3022,7 @@ u8 func000c_combat_with_target_chr[] = { if_chr_dying(CHR_TARGET, /*goto*/ 0xba) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0xba) if_chr_unloaded(CHR_TARGET, /*goto*/ 0xba) - if_target_chrs_target_is_different(/*goto*/ 0x13) + if_chrpresets_target_is_different(/*goto*/ 0x13) goto_next(0x16) // Target's field 0x17e is different @@ -3040,7 +3040,7 @@ u8 func000c_combat_with_target_chr[] = { set_ailist(CHR_SELF, GAILIST_HAND_COMBAT) label(0x16) - try_run_to_target_chr(/*goto*/ 0xb4) + try_run_to_target(/*goto*/ 0xb4) dprint 'R','U','N',' ','F','A','I','L','\n',0, beginloop(0xb4) @@ -3052,7 +3052,7 @@ u8 func000c_combat_with_target_chr[] = { if_chr_dying(CHR_TARGET, /*goto*/ 0xba) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0xba) if_chr_unloaded(CHR_TARGET, /*goto*/ 0xba) - if_target_chrs_target_is_different(/*goto*/ 0x13) + if_chrpresets_target_is_different(/*goto*/ 0x13) goto_next(0xba) label(0x13) @@ -3088,7 +3088,7 @@ u8 func000c_combat_with_target_chr[] = { if_chr_dying(CHR_TARGET, /*goto*/ 0xba) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0xba) if_chr_unloaded(CHR_TARGET, /*goto*/ 0xba) - if_target_chrs_target_is_different(/*goto*/ 0x13) + if_chrpresets_target_is_different(/*goto*/ 0x13) goto_next(0xba) label(0x13) @@ -3097,13 +3097,13 @@ u8 func000c_combat_with_target_chr[] = { label(0xb5) restart_timer - try_run_to_target_chr(/*goto*/ 0xbc) + try_run_to_target(/*goto*/ 0xbc) beginloop(0xbc) if_chr_dying(CHR_TARGET, /*goto*/ 0xc0) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0xc0) if_chr_unloaded(CHR_TARGET, /*goto*/ 0xc0) - if_target_chrs_target_is_different(/*goto*/ 0x13) + if_chrpresets_target_is_different(/*goto*/ 0x13) goto_next(0xc0) label(0x13) @@ -3125,7 +3125,7 @@ u8 func000c_combat_with_target_chr[] = { if_chr_dying(CHR_TARGET, /*goto*/ 0xc1) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0xc1) if_chr_unloaded(CHR_TARGET, /*goto*/ 0xc1) - if_target_chrs_target_is_different(/*goto*/ 0x13) + if_chrpresets_target_is_different(/*goto*/ 0x13) goto_next(0xc1) label(0x13) @@ -3221,7 +3221,7 @@ u8 func000c_combat_with_target_chr[] = { if_chr_dying(CHR_TARGET, /*goto*/ 0xc1) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0xc1) if_chr_unloaded(CHR_TARGET, /*goto*/ 0xc1) - if_target_chrs_target_is_different(/*goto*/ 0x16) + if_chrpresets_target_is_different(/*goto*/ 0x16) goto_next(0xc1) label(0x16) @@ -3263,7 +3263,7 @@ u8 func000c_combat_with_target_chr[] = { if_chr_dying(CHR_TARGET, /*goto*/ 0xc5) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0xc5) if_chr_unloaded(CHR_TARGET, /*goto*/ 0xc5) - if_target_chrs_target_is_different(/*goto*/ 0x13) + if_chrpresets_target_is_different(/*goto*/ 0x13) goto_next(0xc5) label(0x13) @@ -3314,7 +3314,7 @@ u8 func000c_combat_with_target_chr[] = { if_chr_dying(CHR_TARGET, /*goto*/ 0xc5) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0xc5) if_chr_unloaded(CHR_TARGET, /*goto*/ 0xc5) - if_target_chrs_target_is_different(/*goto*/ 0x13) + if_chrpresets_target_is_different(/*goto*/ 0x13) goto_next(0xc5) label(0x13) @@ -3356,7 +3356,7 @@ u8 func000c_combat_with_target_chr[] = { if_chr_dying(CHR_TARGET, /*goto*/ 0xc5) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0xc5) if_chr_unloaded(CHR_TARGET, /*goto*/ 0xc5) - if_target_chrs_target_is_different(/*goto*/ 0x13) + if_chrpresets_target_is_different(/*goto*/ 0x13) goto_next(0xc5) label(0x13) @@ -3402,7 +3402,7 @@ u8 func000c_combat_with_target_chr[] = { // Unreachable - no label if_rand_gt(128, /*goto*/ 0xd1) - try_jog_to_target_chr(/*goto*/ 0xd0) + try_jog_to_target(/*goto*/ 0xd0) beginloop(0xd0) if_timer_gt(120, /*goto*/ 0xd2) @@ -3444,7 +3444,7 @@ u8 func000c_combat_with_target_chr[] = { return label(0x13) - try_walk_to_target_chr(/*goto*/ 0xd6) + try_walk_to_target(/*goto*/ 0xd6) beginloop(0xd6) if_enemy_distance_lt_and_los(1200, /*goto*/ 0x13) @@ -3791,7 +3791,7 @@ u8 func000f_hand_combat[] = { // This if-statement is effectively a no op dprint 'L','1','\n',0, - if_target_chrs_target_is_different(/*goto*/ 0x13) + if_chrpresets_target_is_different(/*goto*/ 0x13) dprint 'L','2','\n',0, label(0x13) @@ -3824,7 +3824,7 @@ u8 func000f_hand_combat[] = { label(0xe3) restart_timer dprint 'R','U','N',' ','T','O',' ','T','A','R','G','E','T','\n',0, - try_run_to_target_chr(/*goto*/ 0x03) + try_run_to_target(/*goto*/ 0x03) beginloop(0x03) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0xfa) @@ -4139,7 +4139,7 @@ u8 func001b_observe_camspy[] = { set_shotlist(GAILIST_ALERTED) unset_self_flag_bankx(CHRFLAG1_DOINGIDLEANIMATION, BANK_1) set_chr_special_death_animation(CHR_SELF, 0) - set_follow_chr(CHR_TARGET) + set_chrpreset(CHR_TARGET) if_just_injured(CHR_SELF, /*goto*/ 0x09) dprint 'E','Y','E',' ','S','P','Y','\n',0, @@ -4147,7 +4147,7 @@ u8 func001b_observe_camspy[] = { label(0x00) set_target_chr(CHR_PRESET) if_chr_distance_lt(300, /*goto*/ 0x13) - try_jog_to_target_chr(/*goto*/ 0x0c) + try_jog_to_target(/*goto*/ 0x0c) restart_timer beginloop(0x0c) @@ -4156,7 +4156,7 @@ u8 func001b_observe_camspy[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x16) - if_target_chr_in_sight(/*goto*/ 0x0b) + if_target_in_sight(/*goto*/ 0x0b) label(0x16) set_target_chr(CHR_PRESET) endloop(0x0c) @@ -4176,7 +4176,7 @@ u8 func001b_observe_camspy[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x16) - if_target_chr_in_sight(/*goto*/ 0x0b) + if_target_in_sight(/*goto*/ 0x0b) label(0x16) set_target_chr(CHR_PRESET) endloop(0x03) @@ -4198,7 +4198,7 @@ u8 func001b_observe_camspy[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x16) - if_target_chr_in_sight(/*goto*/ 0x0b) + if_target_in_sight(/*goto*/ 0x0b) label(0x16) set_target_chr(CHR_PRESET) endloop(0x05) @@ -4243,7 +4243,7 @@ u8 func001b_observe_camspy[] = { // Unreachable - no label dprint 'E','4','\n',0, - if_target_chrs_target_is_different(/*goto*/ 0x16) + if_chrpresets_target_is_different(/*goto*/ 0x16) dprint 'E','5','\n',0, goto_next(0x13) @@ -4285,15 +4285,15 @@ u8 func001d_search_for_player[] = { if_self_flag_bankx_eq(CHRFLAG1_10000000, TRUE, BANK_1, /*goto*/ 0x16) set_chr_roomtosearch if_chr_distance_gt(1000, /*goto*/ 0x13) - try_jog_to_target_chr(/*goto*/ 0x03) + try_jog_to_target(/*goto*/ 0x03) label(0x13) - try_run_to_target_chr(/*goto*/ 0x03) + try_run_to_target(/*goto*/ 0x03) beginloop(0x03) dprint 'S','E','A','R','C','H','I','N','I','T','\n',0, chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_target_chr_in_sight(/*goto*/ 0x12) + if_target_in_sight(/*goto*/ 0x12) if_self_flag_bankx_eq(CHRFLAG0_AIVSAI, FALSE, BANK_0, /*goto*/ 0x13) if_enemy_distance_lt_and_los(2540, /*goto*/ 0xc3) label(0x13) @@ -4322,7 +4322,7 @@ u8 func001d_search_for_player[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x15) - if_target_chr_in_sight(/*goto*/ 0x12) + if_target_in_sight(/*goto*/ 0x12) label(0x15) if_timer_gt(30, /*goto*/ 0x05) endloop(0x0a) @@ -4402,7 +4402,7 @@ u8 func001d_search_for_player[] = { label(0x13) dprint 'C','H','E','K',' ','V','I','S','\n',0, if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x15) - if_target_chr_in_sight(/*goto*/ 0x12) + if_target_in_sight(/*goto*/ 0x12) label(0x15) if_saw_death(0x00, /*goto*/ 0x28) endloop(0x04) @@ -4480,7 +4480,7 @@ u8 func001f_related_to_spawning[] = { if_saw_death(0x01, /*goto*/ 0x1e) if_saw_injury(0x01, /*goto*/ 0x1e) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x16) - if_target_chr_in_sight(/*goto*/ 0x1e) + if_target_in_sight(/*goto*/ 0x1e) label(0x16) if_self_flag_bankx_eq(CHRFLAG0_AIVSAI, FALSE, BANK_0, /*goto*/ 0x16) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x13) @@ -4571,7 +4571,7 @@ u8 func0012_init_coop_100[] = { set_self_chrflag(CHRCFLAG_01000000) set_chr_hiddenflag(CHR_SELF, CHRHFLAG_PSYCHOSISED) set_alertness(100) - set_follow_chr(CHR_BOND) + set_chrpreset(CHR_BOND) yield rebuild_teams rebuild_squadrons @@ -4757,9 +4757,9 @@ u8 func0014_coop_buddy[] = { set_target_chr(CHR_BOND) restart_timer if_chr_distance_gt(300, /*goto*/ 0x16) - try_jog_to_target_chr(/*goto*/ 0x0c) + try_jog_to_target(/*goto*/ 0x0c) label(0x16) - try_run_to_target_chr(/*goto*/ 0x0c) + try_run_to_target(/*goto*/ 0x0c) beginloop(0x0c) if_chr_has_hiddenflag(CHR_BOND, CHRHFLAG_TRIGGER_BUDDY_WARP, /*goto*/ 0x13) @@ -5076,7 +5076,7 @@ u8 func0024_follow_bond[] = { label(0x03) restart_timer - try_run_to_target_chr(/*goto*/ 0x04) + try_run_to_target(/*goto*/ 0x04) beginloop(0x04) set_action(MA_TRACKING, FALSE) @@ -5140,7 +5140,7 @@ u8 func0026_init_psychosis[] = { set_self_flag_bankx(CHRFLAG1_40000000, BANK_1) set_chr_hiddenflag(CHR_SELF, CHRHFLAG_PSYCHOSISED) set_alertness(100) - set_follow_chr(CHR_BOND) + set_chrpreset(CHR_BOND) yield rebuild_teams rebuild_squadrons @@ -5209,10 +5209,10 @@ u8 func0027_psychosised[] = { set_target_chr(CHR_PRESET) restart_timer if_chr_distance_gt(300, /*goto*/ 0x16) - try_jog_to_target_chr(/*goto*/ 0x0c) + try_jog_to_target(/*goto*/ 0x0c) label(0x16) if_chr_distance_lt(200, /*goto*/ 0x16) - try_run_to_target_chr(/*goto*/ 0x0c) + try_run_to_target(/*goto*/ 0x0c) beginloop(0x0c) if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_DISGUISED, /*goto*/ 0x06) @@ -5308,25 +5308,25 @@ u8 func0020_place_coop_buddy[] = { goto_next(0xf3) label(0xfa) - chr_move_to_pad(CHR_SELF, TARGET_PAD, 0x01, /*goto*/ 0x13) + chr_move_to_pad(CHR_SELF, PAD_PRESET, 0x01, /*goto*/ 0x13) label(0xf3) try_set_target_pad_to_something2(0x02, /*goto*/ 0xfa) goto_next(0xf3) label(0xfa) - chr_move_to_pad(CHR_SELF, TARGET_PAD, 0x01, /*goto*/ 0x13) + chr_move_to_pad(CHR_SELF, PAD_PRESET, 0x01, /*goto*/ 0x13) label(0xf3) try_set_target_pad_to_something2(0x04, /*goto*/ 0xfa) goto_next(0xf3) label(0xfa) - chr_move_to_pad(CHR_SELF, TARGET_PAD, 0x01, /*goto*/ 0x13) + chr_move_to_pad(CHR_SELF, PAD_PRESET, 0x01, /*goto*/ 0x13) label(0xf3) try_set_target_pad_to_something2(0x08, /*goto*/ 0xfa) goto_next(0xf3) label(0xfa) - chr_move_to_pad(CHR_SELF, TARGET_PAD, 0x01, /*goto*/ 0x13) + chr_move_to_pad(CHR_SELF, PAD_PRESET, 0x01, /*goto*/ 0x13) label(0xf3) goto_first(0x03) diff --git a/src/setup/setup_000000.c b/src/setup/setup_000000.c index e9af8cde7..f27426789 100644 --- a/src/setup/setup_000000.c +++ b/src/setup/setup_000000.c @@ -14178,9 +14178,9 @@ bool (*g_CommandPointers[])(void) = { /*0x0028*/ aiActivateAlarm, /*0x0029*/ aiDeactivateAlarm, /*0x002a*/ ai002a, - /*0x002b*/ aiTryJogToTargetChr, - /*0x002c*/ aiTryWalkToTargetChr, - /*0x002d*/ aiTryRunToTargetChr, + /*0x002b*/ aiTryJogToTargetProp, + /*0x002c*/ aiTryWalkToTargetProp, + /*0x002d*/ aiTryRunToTargetProp, /*0x002e*/ ai002e, /*0x002f*/ aiTryJogToChr, /*0x0030*/ aiTryWalkToChr, @@ -14188,7 +14188,7 @@ bool (*g_CommandPointers[])(void) = { /*0x0032*/ aiIfStopped, /*0x0033*/ aiIfChrDying, /*0x0034*/ aiIfChrDeathAnimationFinished, - /*0x0035*/ aiIfPlayerInSight, + /*0x0035*/ aiIfTargetPropInSight, /*0x0036*/ aiRandom, /*0x0037*/ aiIfRandomLessThan, /*0x0038*/ aiIfRandomGreaterThan,