From 9ebe958bab7194eb8e3b7acab4ac34d8657c4cc3 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 17 Jan 2020 17:27:12 +1000 Subject: [PATCH] Make distance commands consistent --- src/files/setup/setupame.c | 18 ++-- src/files/setup/setupark.c | 10 +-- src/files/setup/setupate.c | 8 +- src/files/setup/setupazt.c | 14 +-- src/files/setup/setupcave.c | 22 ++--- src/files/setup/setupdam.c | 6 +- src/files/setup/setupdepo.c | 2 +- src/files/setup/setupdish.c | 36 ++++---- src/files/setup/setupear.c | 2 +- src/files/setup/setupeld.c | 8 +- src/files/setup/setupimp.c | 4 +- src/files/setup/setuplee.c | 18 ++-- src/files/setup/setuplip.c | 16 ++-- src/files/setup/setuppam.c | 44 +++++----- src/files/setup/setuppete.c | 6 +- src/files/setup/setuprit.c | 10 +-- src/files/setup/setupsho.c | 14 +-- src/files/setup/setuptra.c | 20 ++--- src/include/commands.h | 18 ++-- src/setup/ailists.c | 164 ++++++++++++++++++------------------ 20 files changed, 221 insertions(+), 219 deletions(-) diff --git a/src/files/setup/setupame.c b/src/files/setup/setupame.c index 13c1a169b..a6f8cd40c 100644 --- a/src/files/setup/setupame.c +++ b/src/files/setup/setupame.c @@ -1387,7 +1387,7 @@ u8 func040f_cass[] = { try_face_entity(0x0200, 0x0000, /*goto*/ 0x2c) label(0x2c) call_rng - if_chr_distance_gt(500, /*goto*/ 0x06) + if_distance_to_target_gt(500, /*goto*/ 0x06) if_chr_in_view(/*goto*/ 0x6d) label(0x06) endloop(0x6c) @@ -1492,7 +1492,7 @@ u8 func0411_secretary[] = { chr_do_animation(ANIM_COWER_01F5, -1, -1, 0x50, 0x14, CHR_SELF, 2) beginloop(0x79) - if_chr_distance_gt(500, /*goto*/ 0x06) + if_distance_to_target_gt(500, /*goto*/ 0x06) if_chr_in_view(/*goto*/ 0x7e) label(0x06) endloop(0x79) @@ -1743,7 +1743,7 @@ u8 func0414_programmer[] = { if_chr_sees_player(/*goto*/ 0x2c) goto_next(0x06) label(0x2c) - if_chr_distance_lt(300, /*goto*/ LABEL_JO_SPEAK) + if_distance_to_target_lt(300, /*goto*/ LABEL_JO_SPEAK) label(0x06) if_chr_stopped(/*goto*/ 0x06) endloop(0x97) @@ -1756,7 +1756,7 @@ u8 func0414_programmer[] = { beginloop(0x0d) if_timer_gt(300, /*goto*/ 0xb5) - if_chr_distance_gt(300, /*goto*/ 0x2c) + if_distance_to_target_gt(300, /*goto*/ 0x2c) if_chr_sees_player(/*goto*/ 0x06) goto_next(0x2c) label(0x06) @@ -1775,7 +1775,7 @@ u8 func0414_programmer[] = { if_timer_lt(120, /*goto*/ 0x06) if_chr_sees_player(/*goto*/ LABEL_JO_SPEAK) goto_next(0x06) - if_chr_distance_lt(300, /*goto*/ LABEL_JO_SPEAK) + if_distance_to_target_lt(300, /*goto*/ LABEL_JO_SPEAK) label(0x06) if_chr_stopped(/*goto*/ 0xa7) endloop(0xa6) @@ -1829,7 +1829,7 @@ u8 func0414_programmer[] = { beginloop(0x9e) if_chr_stopped(/*goto*/ LABEL_LOG_ON) if_stage_flag_eq(STAGEFLAG_PROGRAMMER_INJURED, TRUE, /*goto*/ 0x06) - if_chr_distance_lt(500, /*goto*/ 0x06) + if_distance_to_target_lt(500, /*goto*/ 0x06) if_player_looking_at_something_maybe(0x28, 0x01, 0x00, /*goto*/ 0x06) if_chr_in_room(CHR_PROGRAMMER, 0x00, 0x007d, /*goto*/ 0x06) if_chr_in_room(CHR_PROGRAMMER, 0x00, 0x007e, /*goto*/ 0x06) @@ -3753,7 +3753,7 @@ u8 func042f_surrendering_guard[] = { try_run_to_chr(CHR_PRESET, /*goto*/ 0x56) beginloop(0x56) - if_chr_distance_gt(300, /*goto*/ 0x06) + if_distance_to_target_gt(300, /*goto*/ 0x06) if_chr_in_view(/*goto*/ 0x28) label(0x06) if_chr_death_animation_finished(CHR_PRESET, /*goto*/ 0x55) @@ -3771,7 +3771,7 @@ u8 func042f_surrendering_guard[] = { // No chr in same group, or follow through from above // Wait until player in range and then surrender. beginloop(0x55) - if_chr_distance_gt(300, /*goto*/ 0x06) + if_distance_to_target_gt(300, /*goto*/ 0x06) if_chr_in_view(/*goto*/ 0x28) label(0x06) chr_toggle_p1p2(CHR_SELF) @@ -3784,7 +3784,7 @@ u8 func042f_surrendering_guard[] = { retreat(0x02, 0x02) beginloop(0x0a) - if_chr_distance_gt(300, /*goto*/ 0x06) + if_distance_to_target_gt(300, /*goto*/ 0x06) if_chr_in_view(/*goto*/ 0x28) label(0x06) if_timer_gt(600, /*goto*/ 0x2c) diff --git a/src/files/setup/setupark.c b/src/files/setup/setupark.c index a1ea09e7c..82f7d691f 100644 --- a/src/files/setup/setupark.c +++ b/src/files/setup/setupark.c @@ -595,7 +595,7 @@ u8 func0401_drcaroll_following[] = { label(0x00) if_timer_gt(1250, /*goto*/ 0x20) - if_chr_distance_gt(200, /*goto*/ 0x04) + if_distance_to_target_gt(200, /*goto*/ 0x04) endloop(0x03) label(0x20) @@ -617,7 +617,7 @@ u8 func0401_drcaroll_following[] = { if_chr_y(CHR_DRCAROLL, -2100, OPERATOR_LESS_THAN, /*goto*/ 0x20) try_run_to_target(/*goto*/ 0x05) label(0x20) - if_chr_distance_lt(200, /*goto*/ 0x20) + if_distance_to_target_lt(200, /*goto*/ 0x20) try_run_to_target(/*goto*/ 0x05) label(0x20) try_jog_to_target(/*goto*/ 0x05) @@ -629,7 +629,7 @@ u8 func0401_drcaroll_following[] = { label(0x00) label(0x20) label(0x00) - if_chr_distance_lt(200, /*goto*/ 0x06) + if_distance_to_target_lt(200, /*goto*/ 0x06) if_chr_stopped(/*goto*/ 0x06) if_timer_gt(360, /*goto*/ 0x20) endloop(0x05) @@ -834,7 +834,7 @@ u8 func040f_top_guard[] = { try_aim_and_shoot_thing1(0x0220, 0x0000, /*goto*/ 0x1f) beginloop(0x1f) - if_chr_distance_lt(200, /*goto*/ 0x20) + if_distance_to_target_lt(200, /*goto*/ 0x20) if_stage_flag_eq(STAGEFLAG_CASS_SHIELD_DAMAGED, TRUE, /*goto*/ 0x00) if_stage_flag_eq(STAGEFLAG_TOP_GUARDS_ATTACKING, TRUE, /*goto*/ 0x00) set_target_chr(CHR_PRESET) @@ -989,7 +989,7 @@ u8 func0406_general_combat[] = { label(0x15) set_chr_hiddenflag(CHR_BOND, CHRHFLAG_PSYCHOSISED) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x2a) - if_chr_distance_lt(250, /*goto*/ 0x29) + if_distance_to_target_lt(250, /*goto*/ 0x29) if_self_flag_bankx_eq(CHRFLAG0_00000004, TRUE, BANK_0, /*goto*/ 0x20) set_self_flag_bankx(CHRFLAG0_00000004, BANK_0) if_stage_flag_eq(STAGEFLAG_FOYER_LIGHTS_RESTORED, TRUE, /*goto*/ 0x00) diff --git a/src/files/setup/setupate.c b/src/files/setup/setupate.c index 55478e543..4bacff99c 100644 --- a/src/files/setup/setupate.c +++ b/src/files/setup/setupate.c @@ -408,13 +408,13 @@ u8 func0402_guard_combat[] = { try_jump_sideways(/*goto*/ 0x08) beginloop(0x08) - if_chr_distance_lt(250, /*goto*/ 0x0e) + if_distance_to_target_lt(250, /*goto*/ 0x0e) if_chr_stopped(/*goto*/ 0x03) endloop(0x08) // Guard has been shot, or finished jump beginloop(0x03) - if_chr_distance_lt(250, /*goto*/ 0x0e) + if_distance_to_target_lt(250, /*goto*/ 0x0e) if_chr_sees_player(/*goto*/ 0x06) reloop(0x03) @@ -459,7 +459,7 @@ u8 func0403_jon_combat[] = { try_run_to_target(/*goto*/ 0x08) beginloop(0x08) - if_chr_distance_lt(250, /*goto*/ 0x0e) + if_distance_to_target_lt(250, /*goto*/ 0x0e) if_in_disarm_range(/*goto*/ 0x06) reloop(0x08) @@ -496,7 +496,7 @@ u8 func0404_trent_combat[] = { // Wait until player in sight or in close range beginloop(0x03) - if_chr_distance_lt(250, /*goto*/ 0x0e) + if_distance_to_target_lt(250, /*goto*/ 0x0e) if_chr_sees_player(/*goto*/ 0x06) reloop(0x03) diff --git a/src/files/setup/setupazt.c b/src/files/setup/setupazt.c index 6d85f28fd..2188dfd05 100644 --- a/src/files/setup/setupazt.c +++ b/src/files/setup/setupazt.c @@ -1209,7 +1209,7 @@ u8 func0404_elvis[] = { beginloop(0x12) dprint 'G','O',' ','T','O','W','A','R','D','S','\n',0, - if_chr_distance_lt(300, /*goto*/ 0x13) + if_distance_to_target_lt(300, /*goto*/ 0x13) if_timer_gt(180, /*goto*/ 0x08) endloop(0x12) @@ -1301,8 +1301,8 @@ u8 func0418_robot[] = { label(0x0d) set_squadron_alertness(100) restart_timer - if_chr_distance_lt(300, /*goto*/ 0x31) - if_chr_distance_gt(1000, /*goto*/ 0x15) + if_distance_to_target_lt(300, /*goto*/ 0x31) + if_distance_to_target_gt(1000, /*goto*/ 0x15) if_target_in_sight(/*goto*/ 0x13) // Distance > 1000 or not in sight @@ -1321,7 +1321,7 @@ u8 func0418_robot[] = { beginloop(0x0a) dprint 'P','A','R','T',' ','2','\n',0, if_timer_gt(180, /*goto*/ 0x08) - if_chr_distance_gt(1000, /*goto*/ 0x15) + if_distance_to_target_gt(1000, /*goto*/ 0x15) dprint 'P','A','R','T',' ','2','\n',0, if_target_in_sight(/*goto*/ 0x13) chr_toggle_p1p2(CHR_SELF) @@ -1557,7 +1557,7 @@ u8 func041d_president_running[] = { label(0x08) if_timer_gt(1250, /*goto*/ 0x31) - if_chr_distance_gt(200, /*goto*/ 0xa0) + if_distance_to_target_gt(200, /*goto*/ 0xa0) endloop(0x9f) // 20.8 seconds passed @@ -1577,7 +1577,7 @@ u8 func041d_president_running[] = { label(0xa0) restart_timer label(0x31) - if_chr_distance_gt(300, /*goto*/ 0x31) + if_distance_to_target_gt(300, /*goto*/ 0x31) try_jog_to_target(/*goto*/ 0xa1) label(0x31) try_run_to_target(/*goto*/ 0xa1) @@ -1589,7 +1589,7 @@ u8 func041d_president_running[] = { if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5) if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5) if_chr_in_room(CHR_SELF, 0x00, 0x0014, /*goto*/ 0xa5) - if_chr_distance_lt(100, /*goto*/ 0xa2) + if_distance_to_target_lt(100, /*goto*/ 0xa2) if_chr_stopped(/*goto*/ 0xa2) if_timer_gt(360, /*goto*/ 0x31) endloop(0xa1) diff --git a/src/files/setup/setupcave.c b/src/files/setup/setupcave.c index 92c88221b..a205c0a11 100644 --- a/src/files/setup/setupcave.c +++ b/src/files/setup/setupcave.c @@ -1155,7 +1155,7 @@ u8 func0407_stewardess[] = { beginloop(0x4d) if_stage_flag_eq(STAGEFLAG_TRIGGER_MSG_NOWSYOURCHANCE, TRUE, /*goto*/ 0x75) - if_chr_distance_gt(200, /*goto*/ 0x75) + if_distance_to_target_gt(200, /*goto*/ 0x75) set_stage_flag(STAGEFLAG_TRIGGER_MSG_NOWSYOURCHANCE) label(0x75) if_self_flag_bankx_eq(CHRFLAG0_SAID_INJURY_QUIP, TRUE, BANK_0, /*goto*/ 0x02) @@ -1182,13 +1182,13 @@ u8 func0407_stewardess[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_stage_flag_eq(STAGEFLAG_TRIGGER_MSG_NOWSYOURCHANCE, TRUE, /*goto*/ 0x75) - if_chr_distance_gt(200, /*goto*/ 0x75) + if_distance_to_target_gt(200, /*goto*/ 0x75) set_stage_flag(STAGEFLAG_TRIGGER_MSG_NOWSYOURCHANCE) label(0x75) if_self_flag_bankx_eq(CHRFLAG0_CAN_EXAMINE_BODY, FALSE, BANK_0, /*goto*/ 0x31) if_saw_death(0x00, /*goto*/ 0x0f) label(0x31) - if_chr_distance_gt(500, /*goto*/ 0x31) + if_distance_to_target_gt(500, /*goto*/ 0x31) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x04) label(0x31) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x02) @@ -1211,7 +1211,7 @@ u8 func0407_stewardess[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_stage_flag_eq(STAGEFLAG_TRIGGER_MSG_NOWSYOURCHANCE, TRUE, /*goto*/ 0x75) - if_chr_distance_gt(200, /*goto*/ 0x75) + if_distance_to_target_gt(200, /*goto*/ 0x75) set_stage_flag(STAGEFLAG_TRIGGER_MSG_NOWSYOURCHANCE) label(0x75) if_self_flag_bankx_eq(CHRFLAG0_CAN_EXAMINE_BODY, FALSE, BANK_0, /*goto*/ 0x31) @@ -1284,7 +1284,7 @@ u8 func0407_stewardess[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_stage_flag_eq(STAGEFLAG_TRIGGER_MSG_NOWSYOURCHANCE, TRUE, /*goto*/ 0x75) - if_chr_distance_gt(200, /*goto*/ 0x75) + if_distance_to_target_gt(200, /*goto*/ 0x75) set_stage_flag(STAGEFLAG_TRIGGER_MSG_NOWSYOURCHANCE) label(0x75) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x4e) @@ -1292,7 +1292,7 @@ u8 func0407_stewardess[] = { if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x31) if_target_in_sight(/*goto*/ 0x02) label(0x31) - if_self_distance_to_chr_lt(200, 0xfb, /*goto*/ 0x4a) + if_distance_to_chr_lt(200, 0xfb, /*goto*/ 0x4a) if_chr_stopped(/*goto*/ 0x4a) endloop(0x49) @@ -1306,7 +1306,7 @@ u8 func0407_stewardess[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_stage_flag_eq(STAGEFLAG_TRIGGER_MSG_NOWSYOURCHANCE, TRUE, /*goto*/ 0x75) - if_chr_distance_gt(200, /*goto*/ 0x75) + if_distance_to_target_gt(200, /*goto*/ 0x75) set_stage_flag(STAGEFLAG_TRIGGER_MSG_NOWSYOURCHANCE) label(0x75) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x4e) @@ -1322,7 +1322,7 @@ u8 func0407_stewardess[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_stage_flag_eq(STAGEFLAG_TRIGGER_MSG_NOWSYOURCHANCE, TRUE, /*goto*/ 0x75) - if_chr_distance_gt(200, /*goto*/ 0x75) + if_distance_to_target_gt(200, /*goto*/ 0x75) set_stage_flag(STAGEFLAG_TRIGGER_MSG_NOWSYOURCHANCE) label(0x75) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x4e) @@ -2436,7 +2436,7 @@ u8 func040f_nsa[] = { dprint 'G','O',' ','F','O','R',' ','P','A','D','\n',0, chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_chr_distance_lt(250, /*goto*/ 0x64) + if_distance_to_target_lt(250, /*goto*/ 0x64) if_self_flag_bankx_eq(CHRFLAG0_00000080, TRUE, BANK_0, /*goto*/ 0x33) if_chr_in_room(CHR_TARGET, 0x00, 0x006b, /*goto*/ 0x31) if_chr_in_room(CHR_TARGET, 0x00, 0x006c, /*goto*/ 0x31) @@ -2560,7 +2560,7 @@ u8 func040f_nsa[] = { goto_next(0x07) label(0x31) - if_chr_distance_lt(250, /*goto*/ 0x02) + if_distance_to_target_lt(250, /*goto*/ 0x02) endloop(0x05) label(0x32) @@ -3399,7 +3399,7 @@ u8 func0419_ba8c[] = { goto_next(0x02) label(0x31) if_self_flag_bankx_eq(CHRFLAG0_00002000, TRUE, BANK_0, /*goto*/ 0x31) - if_chr_distance_gt(450, /*goto*/ 0x31) + if_distance_to_target_gt(450, /*goto*/ 0x31) set_self_flag_bankx(CHRFLAG0_00002000, BANK_0) set_returnlist(CHR_SELF, 0x0419) set_ailist(CHR_SELF, GAILIST_CIVILIAN_SAY_COMMENT) diff --git a/src/files/setup/setupdam.c b/src/files/setup/setupdam.c index 521faddb5..c0255f05c 100644 --- a/src/files/setup/setupdam.c +++ b/src/files/setup/setupdam.c @@ -1618,7 +1618,7 @@ u8 func0411_labtech_alerted[] = { label(0x07) set_target_chr(CHR_P1P2) - if_chr_distance_lt(300, /*goto*/ 0x04) + if_distance_to_target_lt(300, /*goto*/ 0x04) label(0x00) chr_do_animation(ANIM_COWER_0229, -1, -1, 0x10, 0x0a, CHR_SELF, 2) @@ -1631,7 +1631,7 @@ u8 func0411_labtech_alerted[] = { goto_next(0x00) label(0x07) - if_chr_distance_lt(300, /*goto*/ 0x04) + if_distance_to_target_lt(300, /*goto*/ 0x04) label(0x00) if_chr_stopped(/*goto*/ 0x07) endloop(0x11) @@ -1903,7 +1903,7 @@ u8 func0401_pilot[] = { // Wait for Jo nearby chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_chr_distance_lt(200, /*goto*/ 0x07) + if_distance_to_target_lt(200, /*goto*/ 0x07) reloop(0x0b) // and for Jo's room entry speech to finish diff --git a/src/files/setup/setupdepo.c b/src/files/setup/setupdepo.c index 649569eaf..94354501b 100644 --- a/src/files/setup/setupdepo.c +++ b/src/files/setup/setupdepo.c @@ -2331,7 +2331,7 @@ u8 func0413_cloak1_guard[] = { beginloop(0x04) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_chr_distance_lt(400, /*goto*/ 0x06) + if_distance_to_target_lt(400, /*goto*/ 0x06) if_jo_front_direction_lt(30, /*goto*/ 0x06) if_chr_in_view(/*goto*/ 0x06) if_difficulty_lt(DIFF_SA, /*goto*/ 0x2c) diff --git a/src/files/setup/setupdish.c b/src/files/setup/setupdish.c index 2866a1099..6ee0c3b91 100644 --- a/src/files/setup/setupdish.c +++ b/src/files/setup/setupdish.c @@ -2986,7 +2986,7 @@ u8 func042c_carrington_tour[] = { endloop(0x5c) label(0x2f) - if_chr_distance_lt(500, /*goto*/ 0x2f) + if_distance_to_target_lt(500, /*goto*/ 0x2f) goto_first(0x5c) label(0x2f) @@ -3014,7 +3014,7 @@ u8 func042c_carrington_tour[] = { endloop(0x63) label(0x2f) - if_chr_distance_lt(500, /*goto*/ 0x2f) + if_distance_to_target_lt(500, /*goto*/ 0x2f) goto_first(0x63) label(0x2f) @@ -3071,7 +3071,7 @@ u8 func042c_carrington_tour[] = { endloop(0x6a) label(0x2f) - if_chr_distance_lt(500, /*goto*/ 0x2f) + if_distance_to_target_lt(500, /*goto*/ 0x2f) goto_first(0x6a) label(0x2f) @@ -3107,7 +3107,7 @@ u8 func042c_carrington_tour[] = { endloop(0x6e) label(0x2f) - if_chr_distance_lt(500, /*goto*/ 0x2f) + if_distance_to_target_lt(500, /*goto*/ 0x2f) goto_first(0x6e) label(0x2f) @@ -3159,7 +3159,7 @@ u8 func042c_carrington_tour[] = { endloop(0x74) label(0x2f) - if_chr_distance_lt(500, /*goto*/ 0x2f) + if_distance_to_target_lt(500, /*goto*/ 0x2f) goto_first(0x74) label(0x2f) @@ -4472,11 +4472,11 @@ u8 func0404_holo4_guard2[] = { set_shotlist(GAILIST_IDLE) set_ailist(CHR_SELF, GAILIST_IDLE) label(0x06) - if_chr_distance_lt(500, /*goto*/ 0x2f) + if_distance_to_target_lt(500, /*goto*/ 0x2f) try_face_entity(0x0200, 0x0000, /*goto*/ 0x08) beginloop(0x08) - if_chr_distance_lt(500, /*goto*/ 0x2f) + if_distance_to_target_lt(500, /*goto*/ 0x2f) endloop(0x08) label(0x2f) @@ -4732,11 +4732,11 @@ u8 func0407_holo5_guard1[] = { endloop(0x0b) label(0x06) - if_chr_distance_lt(300, /*goto*/ 0x2f) + if_distance_to_target_lt(300, /*goto*/ 0x2f) try_face_entity(0x0200, 0x0000, /*goto*/ 0x08) beginloop(0x08) - if_chr_distance_lt(300, /*goto*/ 0x2f) + if_distance_to_target_lt(300, /*goto*/ 0x2f) endloop(0x08) label(0x2f) @@ -5081,7 +5081,7 @@ u8 func0415_holo_guard_unarmed_unalert[] = { endloop(0x08) beginloop(0x04) - if_chr_distance_lt(500, /*goto*/ 0x06) + if_distance_to_target_lt(500, /*goto*/ 0x06) call_rng if_rand_lt(1, /*goto*/ 0x06) label(0x2f) @@ -5102,7 +5102,7 @@ u8 func0416_holo_guard_unarmed_alert[] = { beginloop(0x08) if_chr_stopped(/*goto*/ 0x06) - if_chr_distance_lt(300, /*goto*/ 0x2f) + if_distance_to_target_lt(300, /*goto*/ 0x2f) if_timer_gt(15, /*goto*/ 0x06) endloop(0x08) @@ -5141,14 +5141,14 @@ u8 func0416_holo_guard_unarmed_alert2[] = { beginloop(0x04) if_chr_dying(CHR_TARGET, /*goto*/ 0x57) if_chr_unloaded(CHR_TARGET, /*goto*/ 0x57) - if_chr_distance_gt(100, /*goto*/ 0x2f) + if_distance_to_target_gt(100, /*goto*/ 0x2f) if_in_disarm_range(/*goto*/ 0x2f) if_timer_gt(120, /*goto*/ 0x10) endloop(0x04) label(0x2f) - if_chr_distance_gt(400, /*goto*/ 0x10) - if_chr_distance_lt(100, /*goto*/ 0x06) + if_distance_to_target_gt(400, /*goto*/ 0x10) + if_distance_to_target_lt(100, /*goto*/ 0x06) restart_timer try_run_to_target(/*goto*/ 0x08) @@ -5159,8 +5159,8 @@ u8 func0416_holo_guard_unarmed_alert2[] = { if_chr_stopped(/*goto*/ 0x10) if_target_is_player(/*goto*/ 0x0e) label(0x0e) - if_chr_distance_gt(400, /*goto*/ 0x10) - if_chr_distance_lt(100, /*goto*/ 0x06) + if_distance_to_target_gt(400, /*goto*/ 0x10) + if_distance_to_target_lt(100, /*goto*/ 0x06) endloop(0x08) label(0x2f) @@ -5177,7 +5177,7 @@ u8 func0416_holo_guard_unarmed_alert2[] = { beginloop(0x09) if_chr_dying(CHR_TARGET, /*goto*/ 0x57) if_chr_unloaded(CHR_TARGET, /*goto*/ 0x57) - if_chr_distance_gt(400, /*goto*/ 0x10) + if_distance_to_target_gt(400, /*goto*/ 0x10) if_jo_ccw_direction_lt(10, /*goto*/ 0x06) if_jo_ccw_direction_gt(246, /*goto*/ 0x06) if_timer_gt(120, /*goto*/ 0x06) @@ -5503,7 +5503,7 @@ u8 func0418_holo_guard_armed_unalert[] = { restart_timer beginloop(0x04) - if_chr_distance_lt(500, /*goto*/ 0x06) + if_distance_to_target_lt(500, /*goto*/ 0x06) if_timer_gt(300, /*goto*/ 0x2f) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x06) endloop(0x04) diff --git a/src/files/setup/setupear.c b/src/files/setup/setupear.c index 6cfa62ee4..d722e1a87 100644 --- a/src/files/setup/setupear.c +++ b/src/files/setup/setupear.c @@ -941,7 +941,7 @@ u8 func0404_scientist[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_target_in_sight(/*goto*/ 0x2f) - if_chr_distance_lt(500, /*goto*/ 0x2f) + if_distance_to_target_lt(500, /*goto*/ 0x2f) endloop(0x04) label(0x2f) diff --git a/src/files/setup/setupeld.c b/src/files/setup/setupeld.c index 87dfca6b6..6c0469b7f 100644 --- a/src/files/setup/setupeld.c +++ b/src/files/setup/setupeld.c @@ -1503,8 +1503,8 @@ u8 func0402_taker[] = { try_aim_and_shoot_thing1(0x0220, 0x0000, /*goto*/ 0x05) beginloop(0x05) - if_chr_distance_gt(1000, /*goto*/ 0x2e) - if_chr_distance_lt(300, /*goto*/ 0x06) + if_distance_to_target_gt(1000, /*goto*/ 0x2e) + if_distance_to_target_lt(300, /*goto*/ 0x06) if_self_flag_bankx_eq(CHRFLAG0_00002000, TRUE, BANK_0, /*goto*/ 0x06) if_chr_weapon_equipped(CHR_BOND, WEAPON_LAPTOPGUN, /*goto*/ 0x0b) label(0x2d) @@ -1602,11 +1602,11 @@ u8 func0402_taker[] = { beginloop(0x0d) if_self_flag_bankx_eq(CHRFLAG0_NOHEAR, FALSE, BANK_0, /*goto*/ 0x06) - if_chr_distance_lt(200, /*goto*/ 0x2d) + if_distance_to_target_lt(200, /*goto*/ 0x2d) reloop(0x0d) label(0x06) - if_chr_distance_lt(200, /*goto*/ 0x2d) + if_distance_to_target_lt(200, /*goto*/ 0x2d) if_chr_stopped(/*goto*/ 0x2d) endloop(0x0d) diff --git a/src/files/setup/setupimp.c b/src/files/setup/setupimp.c index 5641ff462..31e52467d 100644 --- a/src/files/setup/setupimp.c +++ b/src/files/setup/setupimp.c @@ -2021,7 +2021,7 @@ u8 func0425_hostage_thank_and_run[] = { if_chr_sees_player(/*goto*/ 0x2e) set_target_chr(CHR_COOP) if_chr_sees_player(/*goto*/ 0x2e) - if_chr_distance_gt(500, /*goto*/ 0x08) + if_distance_to_target_gt(500, /*goto*/ 0x08) label(0x2e) endloop(0x10) @@ -2105,7 +2105,7 @@ u8 func0427_drop_devastator[] = { beginloop(0x10) if_chr_sees_player(/*goto*/ 0x2e) - if_chr_distance_gt(500, /*goto*/ 0x08) + if_distance_to_target_gt(500, /*goto*/ 0x08) label(0x2e) endloop(0x10) diff --git a/src/files/setup/setuplee.c b/src/files/setup/setuplee.c index f1427cb8d..626bc102b 100644 --- a/src/files/setup/setuplee.c +++ b/src/files/setup/setuplee.c @@ -731,7 +731,7 @@ u8 func040e_elvis_give_ar34[] = { beginloop(0x09) set_target_chr(CHR_PRESET) if_timer_gt(60, /*goto*/ 0x2c) - if_chr_distance_lt(200, /*goto*/ 0x06) + if_distance_to_target_lt(200, /*goto*/ 0x06) reloop(0x09) label(0x06) @@ -819,12 +819,12 @@ u8 func0409_elvis_follow[] = { dprint 'I','N','J','U','R','E','D','F','I','N','\n',0, if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08) set_target_chr(CHR_PRESET) - if_chr_distance_lt(200, /*goto*/ 0x06) + if_distance_to_target_lt(200, /*goto*/ 0x06) label(0x03) set_target_chr(CHR_PRESET) restart_timer - if_chr_distance_gt(500, /*goto*/ 0x06) + if_distance_to_target_gt(500, /*goto*/ 0x06) try_jog_to_target(/*goto*/ 0x04) // Distance < 200 or distance > 500 @@ -841,7 +841,7 @@ u8 func0409_elvis_follow[] = { dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08) set_target_chr(CHR_PRESET) - if_chr_distance_lt(200, /*goto*/ 0x06) + if_distance_to_target_lt(200, /*goto*/ 0x06) if_timer_gt(60, /*goto*/ 0x2c) endloop(0x04) @@ -863,7 +863,7 @@ u8 func0409_elvis_follow[] = { dprint 'A','T',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08) set_target_chr(CHR_PRESET) - if_chr_distance_gt(300, /*goto*/ 0x06) + if_distance_to_target_gt(300, /*goto*/ 0x06) endloop(0x09) // Player moved away - do distance checks and start following @@ -1005,7 +1005,7 @@ u8 func040a_elvis_go_to_hangar_lift[] = { beginloop(0x04) if_timer_gt(60, /*goto*/ 0x2c) - if_chr_distance_lt(200, /*goto*/ 0x06) + if_distance_to_target_lt(200, /*goto*/ 0x06) endloop(0x04) label(0x2c) @@ -2290,7 +2290,7 @@ u8 func041a_bridgeclone[] = { // Has target - walk towards for 2 seconds label(0x06) - if_chr_distance_lt(150, /*goto*/ 0x2e) + if_distance_to_target_lt(150, /*goto*/ 0x2e) label(0xc5) restart_timer try_walk_to_target(/*goto*/ 0x08) @@ -2314,9 +2314,9 @@ u8 func041a_bridgeclone[] = { if_chr_dying(CHR_TARGET, /*goto*/ 0x10) if_chr_unloaded(CHR_TARGET, /*goto*/ 0x10) if_target_moving_away(/*goto*/ 0x2c) - if_chr_distance_lt(150, /*goto*/ 0x2e) + if_distance_to_target_lt(150, /*goto*/ 0x2e) label(0x2c) - if_chr_distance_lt(50, /*goto*/ 0x2e) + if_distance_to_target_lt(50, /*goto*/ 0x2e) if_timer_gt(14, /*goto*/ 0x06) endloop(0x0a) diff --git a/src/files/setup/setuplip.c b/src/files/setup/setuplip.c index 0faaf0c41..1f66042d9 100644 --- a/src/files/setup/setuplip.c +++ b/src/files/setup/setuplip.c @@ -1345,7 +1345,7 @@ u8 func0410_labtech_showers_sa_pa[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_target_in_sight(/*goto*/ 0x2d) - if_chr_distance_lt(500, /*goto*/ 0x03) + if_distance_to_target_lt(500, /*goto*/ 0x03) endloop(0x04) // Detected Jo @@ -1455,7 +1455,7 @@ u8 func0410_labtech_showers_sa_pa[] = { restart_timer beginloop(0x6f) - if_chr_distance_lt(400, /*goto*/ 0x2d) + if_distance_to_target_lt(400, /*goto*/ 0x2d) if_timer_gt(600, /*goto*/ 0x06) if_chr_stopped(/*goto*/ 0x06) endloop(0x6f) @@ -1719,7 +1719,7 @@ u8 func0418_doorman[] = { chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_target_in_sight(/*goto*/ 0x03) - if_chr_distance_lt(500, /*goto*/ 0x03) + if_distance_to_target_lt(500, /*goto*/ 0x03) endloop(0x04) label(0x03) @@ -1952,7 +1952,7 @@ u8 func041a_labtech_harrysmate[] = { beginloop(0x08) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x2d) if_target_in_sight(/*goto*/ 0x2d) - if_chr_distance_lt(500, /*goto*/ 0x2d) + if_distance_to_target_lt(500, /*goto*/ 0x2d) endloop(0x08) label(0x2d) @@ -2686,7 +2686,7 @@ u8 func041f_labtech_lights[] = { beginloop(0x0b) if_timer_gt(60, /*goto*/ 0x06) - if_chr_distance_lt(400, /*goto*/ 0x2d) + if_distance_to_target_lt(400, /*goto*/ 0x2d) endloop(0x0b) label(0x06) @@ -3067,7 +3067,7 @@ u8 func0422_labtech_records[] = { set_target_chr(CHR_P1P2) if_target_in_sight(/*goto*/ 0x03) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x03) - if_chr_distance_lt(500, /*goto*/ 0x03) + if_distance_to_target_lt(500, /*goto*/ 0x03) goto_first(0x04) label(0x03) @@ -3452,7 +3452,7 @@ u8 func0426_check_looking_at_alien[] = { beginloop(0x04) set_target_chr(CHR_BOND) if_self_has_chrflag(CHRCFLAG_HIDDEN, /*goto*/ 0x61) - if_chr_distance_lt(300, /*goto*/ 0x64) + if_distance_to_target_lt(300, /*goto*/ 0x64) goto_next(0x66) // Jo is in range @@ -3462,7 +3462,7 @@ u8 func0426_check_looking_at_alien[] = { // Jo is too far away or not looking at alien label(0x66) set_target_chr(CHR_COOP) - if_chr_distance_lt(300, /*goto*/ 0x68) + if_distance_to_target_lt(300, /*goto*/ 0x68) goto_next(0x69) // Velvet is in range diff --git a/src/files/setup/setuppam.c b/src/files/setup/setuppam.c index e0db75c7e..cb5b5fa15 100644 --- a/src/files/setup/setuppam.c +++ b/src/files/setup/setuppam.c @@ -793,14 +793,14 @@ u8 func0402_elvis_follow_and_reactive_teleportals[] = { // No enemy nearby label(0x06) set_target_chr(CHR_PRESET) - if_chr_distance_lt(200, /*goto*/ 0x06) + if_distance_to_target_lt(200, /*goto*/ 0x06) // Jo distance >= 200 label(0x03) dprint 'G','O','T','O','W','\n',0, set_target_chr(CHR_PRESET) restart_timer - if_chr_distance_gt(300, /*goto*/ 0x06) + if_distance_to_target_gt(300, /*goto*/ 0x06) try_jog_to_target(/*goto*/ 0x04) // Jo distance < 200 or distance > 300 @@ -818,7 +818,7 @@ u8 func0402_elvis_follow_and_reactive_teleportals[] = { if_chr_in_room(CHR_ELVIS, 0x00, 0x003c, /*goto*/ 0x5f) label(0x2e) set_target_chr(CHR_PRESET) - if_chr_distance_lt(200, /*goto*/ 0x06) + if_distance_to_target_lt(200, /*goto*/ 0x06) if_timer_gt(60, /*goto*/ 0x2e) endloop(0x04) @@ -840,7 +840,7 @@ u8 func0402_elvis_follow_and_reactive_teleportals[] = { if_chr_in_room(CHR_ELVIS, 0x00, 0x003c, /*goto*/ 0x5f) label(0x2e) set_target_chr(CHR_PRESET) - if_chr_distance_gt(300, /*goto*/ 0x06) + if_distance_to_target_gt(300, /*goto*/ 0x06) endloop(0x09) label(0x06) @@ -969,11 +969,11 @@ u8 func0404_elvis_follow_and_do_agent_megaweapon[] = { label(0x2e) if_enemy_distance_lt_and_los(2000, /*goto*/ 0x08) set_target_chr(CHR_PRESET) - if_chr_distance_lt(200, /*goto*/ 0x06) + if_distance_to_target_lt(200, /*goto*/ 0x06) label(0x03) set_target_chr(CHR_PRESET) restart_timer - if_chr_distance_gt(300, /*goto*/ 0x06) + if_distance_to_target_gt(300, /*goto*/ 0x06) try_jog_to_target(/*goto*/ 0x04) label(0x06) try_run_to_target(/*goto*/ 0x04) @@ -985,7 +985,7 @@ u8 func0404_elvis_follow_and_do_agent_megaweapon[] = { dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2000, /*goto*/ 0x08) set_target_chr(CHR_PRESET) - if_chr_distance_lt(200, /*goto*/ 0x06) + if_distance_to_target_lt(200, /*goto*/ 0x06) if_timer_gt(60, /*goto*/ 0x2e) endloop(0x04) @@ -1003,7 +1003,7 @@ u8 func0404_elvis_follow_and_do_agent_megaweapon[] = { dprint 'A','T',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2000, /*goto*/ 0x08) set_target_chr(CHR_PRESET) - if_chr_distance_gt(300, /*goto*/ 0x06) + if_distance_to_target_gt(300, /*goto*/ 0x06) endloop(0x09) label(0x06) @@ -1106,11 +1106,11 @@ u8 func0405_elvis_follow_nocombat[] = { label(0x06) if_enemy_distance_lt_and_los(300, /*goto*/ 0x08) set_target_chr(CHR_PRESET) - if_chr_distance_lt(200, /*goto*/ 0x06) + if_distance_to_target_lt(200, /*goto*/ 0x06) label(0x03) set_target_chr(CHR_PRESET) restart_timer - if_chr_distance_gt(300, /*goto*/ 0x06) + if_distance_to_target_gt(300, /*goto*/ 0x06) try_jog_to_target(/*goto*/ 0x04) label(0x06) try_run_to_target(/*goto*/ 0x04) @@ -1120,7 +1120,7 @@ u8 func0405_elvis_follow_nocombat[] = { dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(300, /*goto*/ 0x08) set_target_chr(CHR_PRESET) - if_chr_distance_lt(200, /*goto*/ 0x06) + if_distance_to_target_lt(200, /*goto*/ 0x06) if_timer_gt(60, /*goto*/ 0x2e) endloop(0x04) @@ -1136,7 +1136,7 @@ u8 func0405_elvis_follow_nocombat[] = { dprint 'A','T',' ','P','A','D','\n',0, if_enemy_distance_lt_and_los(2000, /*goto*/ 0x08) set_target_chr(CHR_PRESET) - if_chr_distance_gt(300, /*goto*/ 0x06) + if_distance_to_target_gt(300, /*goto*/ 0x06) endloop(0x09) label(0x06) @@ -1186,7 +1186,7 @@ u8 func0406_elvis_follow_and_do_sa_megaweapon[] = { label(0x5f) if_stage_flag_eq(STAGEFLAG_ELVIS_STARTED_SA_MEGAWEAPON, TRUE, /*goto*/ 0x1b) restart_timer - if_chr_distance_lt(400, /*goto*/ 0x2e) + if_distance_to_target_lt(400, /*goto*/ 0x2e) jog_to_pad(0x00b4) goto_next(0x0f) @@ -1287,7 +1287,7 @@ u8 func0407_elvis_go_to_sa_teleport[] = { set_target_chr(CHR_PRESET) label(0x5f) restart_timer - if_chr_distance_lt(1400, /*goto*/ 0x2e) + if_distance_to_target_lt(1400, /*goto*/ 0x2e) jog_to_pad(0x00c0) goto_next(0x0f) @@ -1361,12 +1361,12 @@ u8 func0403_elvis_give_farsight[] = { // Healthy label(0x06) set_target_chr(CHR_PRESET) - if_chr_distance_lt(200, /*goto*/ 0x06) + if_distance_to_target_lt(200, /*goto*/ 0x06) label(0x03) set_target_chr(CHR_PRESET) restart_timer - if_chr_distance_gt(300, /*goto*/ 0x06) + if_distance_to_target_gt(300, /*goto*/ 0x06) try_jog_to_target(/*goto*/ 0x04) label(0x06) try_run_to_target(/*goto*/ 0x04) @@ -1374,7 +1374,7 @@ u8 func0403_elvis_give_farsight[] = { beginloop(0x04) dprint 'G','O',' ','T','O',' ','P','A','D','\n',0, set_target_chr(CHR_PRESET) - if_chr_distance_lt(200, /*goto*/ 0x06) + if_distance_to_target_lt(200, /*goto*/ 0x06) if_timer_gt(60, /*goto*/ 0x2e) endloop(0x04) @@ -3125,7 +3125,7 @@ u8 func041b_sniper_wait_for_detection[] = { reloop(0x04) label(0x2e) - if_chr_distance_lt(400, /*goto*/ 0x06) + if_distance_to_target_lt(400, /*goto*/ 0x06) if_jo_front_direction_lt(30, /*goto*/ 0x06) if_chr_in_view(/*goto*/ 0x06) if_saw_death(0x00, /*goto*/ 0x06) @@ -3433,7 +3433,7 @@ u8 func040f_miniskedar[] = { goto_next(0x1e) label(0x2e) - if_chr_distance_lt(400, /*goto*/ 0x30) + if_distance_to_target_lt(400, /*goto*/ 0x30) label(0x1e) restart_timer @@ -3448,7 +3448,7 @@ u8 func040f_miniskedar[] = { goto_next(0x06) label(0x2e) - if_chr_distance_lt(400, /*goto*/ 0x30) + if_distance_to_target_lt(400, /*goto*/ 0x30) label(0x06) if_timer_gt(60, /*goto*/ 0x06) endloop(0x0a) @@ -3473,7 +3473,7 @@ u8 func040f_miniskedar[] = { label(0x06) say_quip(CHR_BOND, 0x04, 0xff, 0x00, 0xff, BANK_0, 0x00, 0x00) - if_chr_distance_lt(200, /*goto*/ 0x2f) + if_distance_to_target_lt(200, /*goto*/ 0x2f) miniskedar_try_pounce(0x04, 0x000e, /*goto*/ 0x34) reloop(0x03) @@ -4330,7 +4330,7 @@ u8 func042e_elvis_run_to_exit[] = { set_target_chr(CHR_PRESET) label(0x5f) restart_timer - if_chr_distance_lt(1400, /*goto*/ 0x2e) + if_distance_to_target_lt(1400, /*goto*/ 0x2e) jog_to_pad(0x0004) goto_next(0x0f) diff --git a/src/files/setup/setuppete.c b/src/files/setup/setuppete.c index ab5ea6b53..860b7100c 100644 --- a/src/files/setup/setuppete.c +++ b/src/files/setup/setuppete.c @@ -1423,7 +1423,7 @@ u8 func0412_cia[] = { label(0x03) if_self_flag_bankx_eq(CHRFLAG0_00002000, TRUE, BANK_0, /*goto*/ 0x03) - if_chr_distance_gt(450, /*goto*/ 0x03) + if_distance_to_target_gt(450, /*goto*/ 0x03) set_self_flag_bankx(CHRFLAG0_00002000, BANK_0) set_returnlist(CHR_SELF, AILIST_CIA) set_ailist(CHR_SELF, GAILIST_CIVILIAN_SAY_COMMENT) @@ -1509,7 +1509,7 @@ u8 func0412_cia[] = { try_run_to_chr(CHR_PRESET, /*goto*/ 0x06) beginloop(0x06) - if_self_distance_to_chr_lt(2520, CHR_HIDDENGUY, /*goto*/ 0x03) + if_distance_to_chr_lt(2520, CHR_HIDDENGUY, /*goto*/ 0x03) reloop(0x06) label(0x03) @@ -1851,7 +1851,7 @@ u8 func041d_fbi[] = { try_jog_to_target(/*goto*/ 0x06) beginloop(0x06) - if_chr_distance_lt(500, /*goto*/ 0x18) + if_distance_to_target_lt(500, /*goto*/ 0x18) if_target_in_sight(/*goto*/ 0x18) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) diff --git a/src/files/setup/setuprit.c b/src/files/setup/setuprit.c index ce1565def..7e6cc99c6 100644 --- a/src/files/setup/setuprit.c +++ b/src/files/setup/setuprit.c @@ -1496,7 +1496,7 @@ u8 func0404_president_running[] = { label(0x06) if_timer_gt(1250, /*goto*/ 0x2d) - if_chr_distance_gt(200, /*goto*/ 0x58) + if_distance_to_target_gt(200, /*goto*/ 0x58) endloop(0x57) // Been in sight for almost 21 seconds - say quip @@ -1537,7 +1537,7 @@ u8 func0404_president_running[] = { if_chr_in_room(CHR_TARGET, 0x00, 0x0030, /*goto*/ 0x11) if_chr_in_room(CHR_TARGET, 0x00, 0x0031, /*goto*/ 0x11) if_chr_in_room(CHR_TARGET, 0x00, 0x0032, /*goto*/ 0x11) - if_chr_distance_lt(100, /*goto*/ 0x5b) + if_distance_to_target_lt(100, /*goto*/ 0x5b) if_chr_stopped(/*goto*/ 0x5b) if_timer_gt(360, /*goto*/ 0x2d) endloop(0x59) @@ -2374,7 +2374,7 @@ u8 func040a_defend_pad[] = { u8 func040b_defend_president[] = { set_shotlist(AILIST_DEFEND_PRESIDENT) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x08) - if_self_distance_to_chr_lt(200, CHR_PRESIDENT, /*goto*/ 0x06) + if_distance_to_chr_lt(200, CHR_PRESIDENT, /*goto*/ 0x06) label(0x03) try_jog_to_chr(CHR_PRESIDENT, /*goto*/ 0x04) @@ -2387,7 +2387,7 @@ u8 func040b_defend_president[] = { // Near president label(0x60) - if_self_distance_to_chr_lt(200, CHR_PRESIDENT, /*goto*/ 0x06) + if_distance_to_chr_lt(200, CHR_PRESIDENT, /*goto*/ 0x06) goto_first(0x04) label(0x06) @@ -2400,7 +2400,7 @@ u8 func040b_defend_president[] = { goto_first(0x04) label(0x60) - if_chr_distance_to_target_chr_gt(300, CHR_PRESIDENT, /*goto*/ 0x06) + if_distance_to_chr_gt(300, CHR_PRESIDENT, /*goto*/ 0x06) endloop(0x09) label(0x06) diff --git a/src/files/setup/setupsho.c b/src/files/setup/setupsho.c index 362cd5765..7a4eb875d 100644 --- a/src/files/setup/setupsho.c +++ b/src/files/setup/setupsho.c @@ -560,7 +560,7 @@ u8 func0402_unarmed_skedar[] = { label(0x2e) set_chr_cloaked(CHR_SELF, FALSE, TRUE) say_quip(CHR_BOND, 0x01, 0xff, 0x03, 0xff, BANK_0, 0x00, 0x00) - if_chr_distance_lt(150, /*goto*/ 0x2f) + if_distance_to_target_lt(150, /*goto*/ 0x2f) label(0x54) if_num_times_shot_lt(1, /*goto*/ 0x2d) goto_next(0x06) @@ -598,9 +598,9 @@ u8 func0402_unarmed_skedar[] = { if_chr_dying(CHR_TARGET, /*goto*/ 0x10) if_chr_unloaded(CHR_TARGET, /*goto*/ 0x10) if_target_moving_away(/*goto*/ 0x2d) - if_chr_distance_lt(150, /*goto*/ 0x2f) + if_distance_to_target_lt(150, /*goto*/ 0x2f) label(0x2d) - if_chr_distance_lt(50, /*goto*/ 0x2f) + if_distance_to_target_lt(50, /*goto*/ 0x2f) if_timer_gt(30, /*goto*/ 0x06) endloop(0x0b) @@ -769,7 +769,7 @@ u8 func0404_miniskedar[] = { // Injured or detected enemy label(0x2d) set_self_flag_bankx(CHRFLAG0_00000004, BANK_0) - if_chr_distance_lt(400, /*goto*/ 0x2f) + if_distance_to_target_lt(400, /*goto*/ 0x2f) label(0x54) restart_timer @@ -790,7 +790,7 @@ u8 func0404_miniskedar[] = { goto_next(0x06) label(0x2d) - if_chr_distance_lt(400, /*goto*/ 0x2f) + if_distance_to_target_lt(400, /*goto*/ 0x2f) label(0x06) if_timer_gt(60, /*goto*/ 0x06) endloop(0x0b) @@ -814,7 +814,7 @@ u8 func0404_miniskedar[] = { goto_first(0x0c) label(0x06) - if_chr_distance_lt(200, /*goto*/ 0x2e) + if_distance_to_target_lt(200, /*goto*/ 0x2e) miniskedar_try_pounce(0x04, 0x000e, /*goto*/ 0x30) goto_first(0x03) @@ -2126,7 +2126,7 @@ u8 func040d_king_combat[] = { beginloop(0x08) if_chr_death_animation_finished(CHR_P1P2, /*goto*/ 0x0b) if_timer_gt(20, /*goto*/ 0x89) - if_chr_distance_lt(150, /*goto*/ 0x06) + if_distance_to_target_lt(150, /*goto*/ 0x06) endloop(0x08) // Unreachable diff --git a/src/files/setup/setuptra.c b/src/files/setup/setuptra.c index 7410c055b..c370574a9 100644 --- a/src/files/setup/setuptra.c +++ b/src/files/setup/setuptra.c @@ -845,7 +845,7 @@ u8 func0402_jonathan_waiting_for_meetup[] = { label(0x32) if_timer_lt(150, /*goto*/ 0x32) - if_chr_distance_lt(300, /*goto*/ 0x06) + if_distance_to_target_lt(300, /*goto*/ 0x06) label(0x32) endloop(0x0a) @@ -902,7 +902,7 @@ u8 func0404_jonathan_following_and_mine[] = { dprint 'J','O','N','A',' ','F','O','L','L','O','W','\n',0, label(LABEL_FOLLOW) - if_chr_distance_gt(200, /*goto*/ 0x5c) + if_distance_to_target_gt(200, /*goto*/ 0x5c) // distance <= 200 (waiting) stop_chr @@ -914,13 +914,13 @@ u8 func0404_jonathan_following_and_mine[] = { goto_next(0x5c) label(0x06) - if_chr_distance_gt(200, /*goto*/ 0x5c) + if_distance_to_target_gt(200, /*goto*/ 0x5c) endloop(0x5b) // distance > 200 label(0x5c) restart_timer - if_chr_distance_lt(300, /*goto*/ 0x32) + if_distance_to_target_lt(300, /*goto*/ 0x32) // distance >= 300 try_run_to_target(/*goto*/ 0x5d) @@ -942,7 +942,7 @@ u8 func0404_jonathan_following_and_mine[] = { // each loop iteration. label(0x32) set_target_chr(CHR_P1P2) - if_chr_distance_lt(200, /*goto*/ 0x5e) + if_distance_to_target_lt(200, /*goto*/ 0x5e) if_timer_gt(120, /*goto*/ 0x5e) if_chr_stopped(/*goto*/ 0x5e) goto_first(0x5d) @@ -1106,9 +1106,9 @@ u8 func0413_jonathan_hangar[] = { // Wait until both Joanna and Elvis within 400 units beginloop(0x14) set_target_chr(CHR_ELVIS) - if_chr_distance_gt(400, /*goto*/ 0x32) + if_distance_to_target_gt(400, /*goto*/ 0x32) set_target_chr(CHR_P1P2) - if_chr_distance_gt(400, /*goto*/ 0x32) + if_distance_to_target_gt(400, /*goto*/ 0x32) if_target_in_sight(/*goto*/ 0x06) label(0x32) endloop(0x14) @@ -1271,7 +1271,7 @@ u8 func0413_jonathan_hangar[] = { if_stage_flag_eq(STAGEFLAG_HANGAR_X_MUSIC_STARTED, TRUE, /*goto*/ 0x32) if_chr_y(CHR_SELF, -600, OPERATOR_GREATER_THAN, /*goto*/ 0x33) set_target_chr(CHR_P1P2) - if_chr_distance_lt(300, /*goto*/ 0x59) + if_distance_to_target_lt(300, /*goto*/ 0x59) label(0x32) if_chr_stopped(/*goto*/ 0x06) reloop(0x1c) @@ -1997,7 +1997,7 @@ u8 func040b_elvis_follow[] = { goto_next(0x5c) label(0x06) - if_chr_distance_gt(200, /*goto*/ 0x5c) + if_distance_to_target_gt(200, /*goto*/ 0x5c) endloop(0x5b) label(0x5c) @@ -2011,7 +2011,7 @@ u8 func040b_elvis_follow[] = { if_chr_distance_to_pad_lt(CHR_SELF, 300, 0x015f, /*goto*/ 0x08) label(0x32) set_target_chr(CHR_JONATHAN) - if_chr_distance_lt(200, /*goto*/ 0x5e) + if_distance_to_target_lt(200, /*goto*/ 0x5e) if_timer_gt(120, /*goto*/ 0x5e) if_chr_stopped(/*goto*/ 0x5e) goto_first(0x5d) diff --git a/src/include/commands.h b/src/include/commands.h index ea6d6fcda..3add7fb55 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -684,17 +684,19 @@ label, /** - * Checks if the distance to Joanna is less than the given value. + * Checks if the distance from the current chr to their target is less than the + * given value. */ -#define if_chr_distance_lt(distance, label) \ +#define if_distance_to_target_lt(distance, label) \ mkshort(0x0052), \ mkshort(distance / 10), \ label, /** - * Checks if the distance to Joanna is greater than than the given value. + * Checks if the distance from the current chr to their target is greater than + * the given value. */ -#define if_chr_distance_gt(distance, label) \ +#define if_distance_to_target_gt(distance, label) \ mkshort(0x0053), \ mkshort(distance / 10), \ label, @@ -711,8 +713,8 @@ label, /** - * Checks if the distance from the given chr to the given pad is greater than the - * given value. + * 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), \ @@ -725,7 +727,7 @@ * 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) \ +#define if_distance_to_chr_lt(distance, chr, label) \ mkshort(0x0056), \ mkshort(distance / 10), \ chr, \ @@ -735,7 +737,7 @@ * 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) \ +#define if_distance_to_chr_gt(distance, chr, label) \ mkshort(0x0057), \ mkshort(distance / 10), \ chr, \ diff --git a/src/setup/ailists.c b/src/setup/ailists.c index cdac5e129..e31459fcb 100644 --- a/src/setup/ailists.c +++ b/src/setup/ailists.c @@ -333,11 +333,11 @@ u8 func0006_unalerted[] = { if_chr_weapon_equipped(CHR_TARGET, WEAPON_HORIZONSCANNER, /*goto*/ 0xe6) if_chr_weapon_equipped(CHR_TARGET, WEAPON_SUITCASE, /*goto*/ 0xe6) dprint 'T','A','L','K',' ','D','I','S','T',' ','G','U','N','\n',0, - if_chr_distance_gt(900, /*goto*/ 0x15) + if_distance_to_target_gt(900, /*goto*/ 0x15) goto_next(0xe8) label(0xe6) - if_chr_distance_gt(450, /*goto*/ 0x15) + if_distance_to_target_gt(450, /*goto*/ 0x15) label(0xe8) if_chr_sees_player(/*goto*/ 0xe9) goto_next(LABEL_DISGUISE_UNCOVERED) @@ -545,7 +545,7 @@ u8 func0006_unalerted[] = { if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x13) if_target_in_sight(/*goto*/ 0x16) label(0x13) - if_self_distance_to_chr_lt(150, CHR_SEEDIE, /*goto*/ 0x7f) + if_distance_to_chr_lt(150, CHR_SEEDIE, /*goto*/ 0x7f) if_chr_stopped(/*goto*/ 0x7f) endloop(0x7e) @@ -1198,7 +1198,7 @@ u8 func0007_alerted[] = { label(0x16) if_self_flag_bankx_eq(CHRFLAG0_CAN_TRAP, TRUE, BANK_0, /*goto*/ 0x16) - if_chr_distance_lt(800, /*goto*/ 0x9c) + if_distance_to_target_lt(800, /*goto*/ 0x9c) label(0x16) goto_first(0x9b) @@ -1287,7 +1287,7 @@ u8 func0007_alerted[] = { beginloop(0xab) set_target_chr(CHR_P1P2) - if_chr_distance_gt(300, /*goto*/ 0x13) + if_distance_to_target_gt(300, /*goto*/ 0x13) unset_self_flag_bankx(CHRFLAG0_10000000, BANK_0) goto_first(0x1b) @@ -1325,8 +1325,8 @@ u8 func0007_alerted[] = { label(LABEL_SNIPE) unset_self_flag_bankx(CHRFLAG0_80000000, BANK_0) yield - if_chr_distance_lt(1000, /*goto*/ 0x16) - if_chr_distance_gt(2500, /*goto*/ 0x14) + if_distance_to_target_lt(1000, /*goto*/ 0x16) + if_distance_to_target_gt(2500, /*goto*/ 0x14) // Distance between 1000 and 2500 if_jo_ccw_direction_lt(10, /*goto*/ 0x13) @@ -1362,7 +1362,7 @@ u8 func0007_alerted[] = { try_run_to_target(/*goto*/ 0xe1) beginloop(0xe1) - if_chr_distance_lt(2500, /*goto*/ 0x15) + if_distance_to_target_lt(2500, /*goto*/ 0x15) endloop(0xe1) label(0x15) @@ -1374,7 +1374,7 @@ u8 func0007_alerted[] = { cmd01ba(0x0022, 0x0000, /*goto*/ 0xdf) beginloop(0xdf) - if_chr_distance_lt(1000, /*goto*/ 0x16) + if_distance_to_target_lt(1000, /*goto*/ 0x16) if_timer_gt(300, /*goto*/ 0x13) endloop(0xdf) @@ -1437,11 +1437,11 @@ u8 func0007_alerted[] = { label(0x16) if_within_units_of_sight(30, /*goto*/ 0x16) if_player_using_cmp150_or_ar34(/*goto*/ 0x69) - if_chr_distance_gt(2000, /*goto*/ 0x61) + if_distance_to_target_gt(2000, /*goto*/ 0x61) goto_next(0x16) label(0x69) - if_chr_distance_gt(4000, /*goto*/ 0x61) + if_distance_to_target_gt(4000, /*goto*/ 0x61) label(0x16) dprint 'O','K','F','O','R','C','O','V','E','R','\n',0, if_in_disarm_range(/*goto*/ 0x5b) @@ -1500,10 +1500,10 @@ u8 func0007_alerted[] = { if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) if_self_flag_bankx_eq(CHRFLAG1_00001000, TRUE, BANK_1, /*goto*/ 0x13) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x16) - if_chr_distance_lt(120, /*goto*/ 0x16) + if_distance_to_target_lt(120, /*goto*/ 0x16) call_rng if_rand_lt(128, /*goto*/ 0x13) - if_chr_distance_gt(250, /*goto*/ 0x13) + if_distance_to_target_gt(250, /*goto*/ 0x13) label(0x16) if_in_disarm_range(/*goto*/ 0x16) goto_next(0x13) @@ -1550,11 +1550,11 @@ u8 func0007_alerted[] = { label(0x66) if_player_using_cmp150_or_ar34(/*goto*/ 0x69) - if_chr_distance_gt(2000, /*goto*/ 0x16) + if_distance_to_target_gt(2000, /*goto*/ 0x16) goto_next(0x6a) label(0x69) - if_chr_distance_gt(4000, /*goto*/ 0x16) + if_distance_to_target_gt(4000, /*goto*/ 0x16) label(0x6a) if_player_looking_at_something_maybe(0x11, 0x01, 0x00, /*goto*/ 0x63) label(0x16) @@ -1573,11 +1573,11 @@ u8 func0007_alerted[] = { cmd013d_if_grenade_thrown_nearby_maybe(MA_GRENADEWAIT, /*goto*/ LABEL_FLEE_GRENADE) if_in_disarm_range(/*goto*/ 0x5f) if_player_using_cmp150_or_ar34(/*goto*/ 0x69) - if_chr_distance_gt(2000, /*goto*/ 0x65) + if_distance_to_target_gt(2000, /*goto*/ 0x65) goto_next(0x16) label(0x69) - if_chr_distance_gt(4000, /*goto*/ 0x65) + if_distance_to_target_gt(4000, /*goto*/ 0x65) label(0x16) if_timer_gt(120, /*goto*/ 0x63) label(0x65) @@ -1617,10 +1617,10 @@ u8 func0007_alerted[] = { if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) if_self_flag_bankx_eq(CHRFLAG1_00001000, TRUE, BANK_1, /*goto*/ 0x13) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x16) - if_chr_distance_lt(120, /*goto*/ 0x16) + if_distance_to_target_lt(120, /*goto*/ 0x16) call_rng if_rand_lt(128, /*goto*/ 0x13) - if_chr_distance_gt(250, /*goto*/ 0x13) + if_distance_to_target_gt(250, /*goto*/ 0x13) label(0x16) if_in_disarm_range(/*goto*/ 0x16) goto_next(0x13) @@ -1775,10 +1775,10 @@ u8 func0007_alerted[] = { if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) if_self_flag_bankx_eq(CHRFLAG1_00001000, TRUE, BANK_1, /*goto*/ 0x13) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x16) - if_chr_distance_lt(120, /*goto*/ 0x16) + if_distance_to_target_lt(120, /*goto*/ 0x16) call_rng if_rand_lt(128, /*goto*/ 0x13) - if_chr_distance_gt(250, /*goto*/ 0x13) + if_distance_to_target_gt(250, /*goto*/ 0x13) label(0x16) if_in_disarm_range(/*goto*/ 0x16) goto_next(0x13) @@ -1806,7 +1806,7 @@ u8 func0007_alerted[] = { if_chr_in_view(/*goto*/ 0x18) label(0x2f) dprint 'C',' ','1','\n',0, - if_chr_distance_gt(1300, /*goto*/ LABEL_TRACK) + if_distance_to_target_gt(1300, /*goto*/ LABEL_TRACK) if_in_disarm_range(/*goto*/ 0x26) dprint 'C',' ','2','\n',0, if_self_flag_bankx_eq(CHRFLAG0_CAN_RETREAT, FALSE, BANK_0, /*goto*/ 0x16) @@ -1843,7 +1843,7 @@ u8 func0007_alerted[] = { goto_next(0x4c) label(0x16) - if_chr_distance_lt(500, /*goto*/ 0x4c) + if_distance_to_target_lt(500, /*goto*/ 0x4c) dprint 'G','R','E','N','A','D','E','\n',0, restart_timer if_chr_in_squadron_doing_action(MA_GRENADE, /*goto*/ 0x4c) @@ -1935,7 +1935,7 @@ u8 func0007_alerted[] = { if_player_looking_at_something_maybe(0x15, 0x01, 0x00, /*goto*/ 0x16) goto_next(LABEL_TRACK) label(0x16) - if_chr_distance_gt(2000, /*goto*/ 0x41) + if_distance_to_target_gt(2000, /*goto*/ 0x41) endloop(0x40) label(0x42) @@ -1967,10 +1967,10 @@ u8 func0007_alerted[] = { if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) if_self_flag_bankx_eq(CHRFLAG1_00001000, TRUE, BANK_1, /*goto*/ 0x13) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x16) - if_chr_distance_lt(120, /*goto*/ 0x16) + if_distance_to_target_lt(120, /*goto*/ 0x16) call_rng if_rand_lt(128, /*goto*/ 0x13) - if_chr_distance_gt(250, /*goto*/ 0x13) + if_distance_to_target_gt(250, /*goto*/ 0x13) label(0x16) if_in_disarm_range(/*goto*/ 0x16) goto_next(0x13) @@ -2088,10 +2088,10 @@ u8 func0007_alerted[] = { if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) if_self_flag_bankx_eq(CHRFLAG1_00001000, TRUE, BANK_1, /*goto*/ 0x13) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x16) - if_chr_distance_lt(120, /*goto*/ 0x16) + if_distance_to_target_lt(120, /*goto*/ 0x16) call_rng if_rand_lt(128, /*goto*/ 0x13) - if_chr_distance_gt(250, /*goto*/ 0x13) + if_distance_to_target_gt(250, /*goto*/ 0x13) label(0x16) if_in_disarm_range(/*goto*/ 0x16) goto_next(0x13) @@ -2165,10 +2165,10 @@ u8 func0007_alerted[] = { if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) if_self_flag_bankx_eq(CHRFLAG1_00001000, TRUE, BANK_1, /*goto*/ 0x13) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x16) - if_chr_distance_lt(120, /*goto*/ 0x16) + if_distance_to_target_lt(120, /*goto*/ 0x16) call_rng if_rand_lt(128, /*goto*/ 0x13) - if_chr_distance_gt(250, /*goto*/ 0x13) + if_distance_to_target_gt(250, /*goto*/ 0x13) label(0x16) if_in_disarm_range(/*goto*/ 0x16) goto_next(0x13) @@ -2180,7 +2180,7 @@ u8 func0007_alerted[] = { label(0x13) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_chr_distance_gt(1300, /*goto*/ 0x13) + if_distance_to_target_gt(1300, /*goto*/ 0x13) if_self_flag_bankx_eq(CHRFLAG1_01000000, TRUE, BANK_1, /*goto*/ 0x16) if_self_flag_bankx_eq(CHRFLAG1_02000000, FALSE, BANK_1, /*goto*/ 0x16) if_player_looking_at_something_maybe(0x15, 0x01, 0x00, /*goto*/ 0x3b) @@ -2204,7 +2204,7 @@ u8 func0007_alerted[] = { set_ailist(CHR_SELF, GAILIST_COMBAT_WITH_TARGET) label(0x13) - if_chr_distance_gt(1300, /*goto*/ 0x3c) + if_distance_to_target_gt(1300, /*goto*/ 0x3c) if_self_flag_bankx_eq(CHRFLAG0_CAN_RETREAT, FALSE, BANK_0, /*goto*/ 0x16) if_self_flag_bankx_eq(CHRFLAG0_CANT_ALERT_GROUP, TRUE, BANK_0, /*goto*/ LABEL_RETREAT) if_num_times_shot_lt(1, /*goto*/ 0x16) @@ -2221,7 +2221,7 @@ u8 func0007_alerted[] = { label(0x39) if_self_flag_bankx_eq(CHRFLAG1_01000000, TRUE, BANK_1, /*goto*/ 0x3c) if_player_looking_at_something_maybe(0x15, 0x01, 0x00, /*goto*/ 0x3b) - if_chr_distance_lt(1300, /*goto*/ 0x3b) + if_distance_to_target_lt(1300, /*goto*/ 0x3b) goto_next(0x17) label(0x3a) @@ -2272,10 +2272,10 @@ u8 func0007_alerted[] = { if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) if_self_flag_bankx_eq(CHRFLAG1_00001000, TRUE, BANK_1, /*goto*/ 0x13) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x16) - if_chr_distance_lt(120, /*goto*/ 0x16) + if_distance_to_target_lt(120, /*goto*/ 0x16) call_rng if_rand_lt(128, /*goto*/ 0x13) - if_chr_distance_gt(250, /*goto*/ 0x13) + if_distance_to_target_gt(250, /*goto*/ 0x13) label(0x16) if_in_disarm_range(/*goto*/ 0x16) goto_next(0x13) @@ -2297,10 +2297,10 @@ u8 func0007_alerted[] = { if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) if_self_flag_bankx_eq(CHRFLAG1_00001000, TRUE, BANK_1, /*goto*/ 0x13) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x16) - if_chr_distance_lt(120, /*goto*/ 0x16) + if_distance_to_target_lt(120, /*goto*/ 0x16) call_rng if_rand_lt(128, /*goto*/ 0x13) - if_chr_distance_gt(250, /*goto*/ 0x13) + if_distance_to_target_gt(250, /*goto*/ 0x13) label(0x16) if_in_disarm_range(/*goto*/ 0x16) goto_next(0x13) @@ -2480,10 +2480,10 @@ u8 func0007_alerted[] = { beginloop(0x6c) cmd013d_if_grenade_thrown_nearby_maybe(MA_GRENADEWAIT, /*goto*/ LABEL_FLEE_GRENADE) - if_chr_distance_gt(300, /*goto*/ 0x16) + if_distance_to_target_gt(300, /*goto*/ 0x16) if_chr_in_view(/*goto*/ 0x70) label(0x16) - if_chr_distance_gt(3000, /*goto*/ 0x6d) + if_distance_to_target_gt(3000, /*goto*/ 0x6d) endloop(0x6c) label(0x6d) @@ -2493,7 +2493,7 @@ u8 func0007_alerted[] = { cmd013d_if_grenade_thrown_nearby_maybe(MA_GRENADEWAIT, /*goto*/ LABEL_FLEE_GRENADE) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_chr_distance_lt(3000, /*goto*/ 0x6f) + if_distance_to_target_lt(3000, /*goto*/ 0x6f) endloop(0x6e) label(0x6f) @@ -3031,7 +3031,7 @@ u8 func000c_combat_with_target_chr[] = { if_self_flag_bankx_eq(CHRFLAG1_00001000, TRUE, BANK_1, /*goto*/ 0x16) call_rng if_rand_lt(128, /*goto*/ 0x13) - if_chr_distance_gt(250, /*goto*/ 0x16) + if_distance_to_target_gt(250, /*goto*/ 0x16) if_in_disarm_range(/*goto*/ 0x13) goto_next(0x16) @@ -3059,10 +3059,10 @@ u8 func000c_combat_with_target_chr[] = { dprint 'F','O','U','N','D',' ','2','\n',0, if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x16) if_self_flag_bankx_eq(CHRFLAG1_00001000, TRUE, BANK_1, /*goto*/ 0x13) - if_chr_distance_lt(120, /*goto*/ 0x16) + if_distance_to_target_lt(120, /*goto*/ 0x16) call_rng if_rand_lt(128, /*goto*/ 0x13) - if_chr_distance_gt(250, /*goto*/ 0x13) + if_distance_to_target_gt(250, /*goto*/ 0x13) label(0x16) if_in_disarm_range(/*goto*/ 0x16) dprint 'N','O','U','N','A','R','M','\n',0, @@ -3133,7 +3133,7 @@ u8 func000c_combat_with_target_chr[] = { goto_next(0xc2) label(0x16) - if_chr_distance_lt(800, /*goto*/ 0xc2) + if_distance_to_target_lt(800, /*goto*/ 0xc2) // @bug: Guards will consider throwing grenades if you're moving quickly // rather than slowly. The below statement skips the grenade logic if slow. @@ -3146,10 +3146,10 @@ u8 func000c_combat_with_target_chr[] = { label(0x16) if_self_flag_bankx_eq(CHRFLAG1_00001000, TRUE, BANK_1, /*goto*/ 0x13) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x16) - if_chr_distance_lt(120, /*goto*/ 0x16) + if_distance_to_target_lt(120, /*goto*/ 0x16) call_rng if_rand_lt(128, /*goto*/ 0x13) - if_chr_distance_gt(250, /*goto*/ 0x13) + if_distance_to_target_gt(250, /*goto*/ 0x13) label(0x16) if_in_disarm_range(/*goto*/ 0x16) goto_next(0x13) @@ -3164,10 +3164,10 @@ u8 func000c_combat_with_target_chr[] = { label(0xc2) if_self_flag_bankx_eq(CHRFLAG1_00001000, TRUE, BANK_1, /*goto*/ 0x13) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x16) - if_chr_distance_lt(120, /*goto*/ 0x16) + if_distance_to_target_lt(120, /*goto*/ 0x16) call_rng if_rand_lt(128, /*goto*/ 0x13) - if_chr_distance_gt(250, /*goto*/ 0x13) + if_distance_to_target_gt(250, /*goto*/ 0x13) label(0x16) if_in_disarm_range(/*goto*/ 0x16) goto_next(0x13) @@ -3801,11 +3801,11 @@ u8 func000f_hand_combat[] = { dprint 'L','O','O','K',' ','F','O','R',' ','T','A','R','G','E','T','\n',0, if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x13) if_chr_is_skedar(CHR_SELF, /*goto*/ 0x0f) - if_chr_distance_gt(120, /*goto*/ 0x13) + if_distance_to_target_gt(120, /*goto*/ 0x13) goto_next(0x10) label(0x0f) - if_chr_distance_gt(150, /*goto*/ 0x13) + if_distance_to_target_gt(150, /*goto*/ 0x13) label(0x10) if_in_disarm_range(/*goto*/ 0x13) @@ -3815,14 +3815,14 @@ u8 func000f_hand_combat[] = { label(0x13) if_target_is_player(/*goto*/ 0x0a) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x13) - if_chr_distance_gt(400, /*goto*/ 0x0b) + if_distance_to_target_gt(400, /*goto*/ 0x0b) label(0x13) if_chr_is_skedar(CHR_SELF, /*goto*/ 0x0f) - if_chr_distance_lt(120, /*goto*/ LABEL_FACE_TARGET) + if_distance_to_target_lt(120, /*goto*/ LABEL_FACE_TARGET) goto_next(0x10) label(0x0f) - if_chr_distance_lt(150, /*goto*/ LABEL_FACE_TARGET) + if_distance_to_target_lt(150, /*goto*/ LABEL_FACE_TARGET) label(0x10) label(0xe3) restart_timer @@ -3837,39 +3837,39 @@ u8 func000f_hand_combat[] = { if_timer_gt(90, /*goto*/ 0x0b) if_target_is_player(/*goto*/ 0x09) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x13) - if_chr_distance_gt(400, /*goto*/ 0x0b) + if_distance_to_target_gt(400, /*goto*/ 0x0b) label(0x13) if_chr_is_skedar(CHR_SELF, /*goto*/ 0x0f) - if_chr_distance_lt(120, /*goto*/ LABEL_FACE_TARGET) + if_distance_to_target_lt(120, /*goto*/ LABEL_FACE_TARGET) goto_next(0x10) label(0x0f) - if_chr_distance_lt(150, /*goto*/ LABEL_FACE_TARGET) + if_distance_to_target_lt(150, /*goto*/ LABEL_FACE_TARGET) label(0x10) endloop(0x03) label(0x09) if_chr_is_skedar(CHR_SELF, /*goto*/ 0x0f) - if_chr_distance_lt(120, /*goto*/ LABEL_FACE_TARGET) + if_distance_to_target_lt(120, /*goto*/ LABEL_FACE_TARGET) goto_next(0x10) label(0x0f) - if_chr_distance_lt(150, /*goto*/ LABEL_FACE_TARGET) + if_distance_to_target_lt(150, /*goto*/ LABEL_FACE_TARGET) label(0x10) if_self_flag_bankx_eq(CHRFLAG1_00000001, TRUE, BANK_1, /*goto*/ 0x13) - if_chr_distance_gt(400, /*goto*/ 0x0b) + if_distance_to_target_gt(400, /*goto*/ 0x0b) label(0x13) goto_first(0x03) label(0x0a) if_chr_is_skedar(CHR_SELF, /*goto*/ 0x0f) - if_chr_distance_lt(120, /*goto*/ LABEL_FACE_TARGET) + if_distance_to_target_lt(120, /*goto*/ LABEL_FACE_TARGET) goto_next(0x10) label(0x0f) - if_chr_distance_lt(150, /*goto*/ LABEL_FACE_TARGET) + if_distance_to_target_lt(150, /*goto*/ LABEL_FACE_TARGET) label(0x10) - if_chr_distance_gt(400, /*goto*/ 0x0b) + if_distance_to_target_gt(400, /*goto*/ 0x0b) goto_first(0xe3) label(0x13) @@ -3889,7 +3889,7 @@ u8 func000f_hand_combat[] = { if_chr_dying(CHR_TARGET, /*goto*/ 0xfa) if_chr_unloaded(CHR_TARGET, /*goto*/ 0xfa) label(0x13) - if_chr_distance_gt(400, /*goto*/ 0x0b) + if_distance_to_target_gt(400, /*goto*/ 0x0b) if_jo_ccw_direction_lt(15, /*goto*/ LABEL_PUNCH) if_jo_ccw_direction_gt(240, /*goto*/ LABEL_PUNCH) if_timer_gt(60, /*goto*/ LABEL_PUNCH) @@ -4149,13 +4149,13 @@ u8 func001b_observe_camspy[] = { label(0x00) set_target_chr(CHR_PRESET) - if_chr_distance_lt(300, /*goto*/ 0x13) + if_distance_to_target_lt(300, /*goto*/ 0x13) try_jog_to_target(/*goto*/ 0x0c) restart_timer beginloop(0x0c) if_timer_gt(60, /*goto*/ 0x0b) - if_chr_distance_lt(300, /*goto*/ 0x13) + if_distance_to_target_lt(300, /*goto*/ 0x13) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x16) @@ -4175,7 +4175,7 @@ u8 func001b_observe_camspy[] = { // - If the player comes into sight, return from the function beginloop(0x03) if_timer_gt(300, /*goto*/ 0x04) - if_chr_distance_gt(400, /*goto*/ 0x13) + if_distance_to_target_gt(400, /*goto*/ 0x13) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x16) @@ -4287,7 +4287,7 @@ u8 func001d_search_for_player[] = { set_self_flag_bankx(CHRFLAG1_01000000, BANK_1) if_self_flag_bankx_eq(CHRFLAG1_10000000, TRUE, BANK_1, /*goto*/ 0x16) set_chr_roomtosearch - if_chr_distance_gt(1000, /*goto*/ 0x13) + if_distance_to_target_gt(1000, /*goto*/ 0x13) try_jog_to_target(/*goto*/ 0x03) label(0x13) try_run_to_target(/*goto*/ 0x03) @@ -4318,7 +4318,7 @@ u8 func001d_search_for_player[] = { if_enemy_distance_lt_and_los(100, /*goto*/ 0xc3) label(0x13) if_self_flag_bankx_eq(CHRFLAG1_00000400, FALSE, BANK_1, /*goto*/ 0x13) - if_chr_distance_lt(500, /*goto*/ 0x13) + if_distance_to_target_lt(500, /*goto*/ 0x13) goto_next(0x05) label(0x13) @@ -4333,7 +4333,7 @@ u8 func001d_search_for_player[] = { label(0x05) restart_timer label(0x06) - if_chr_distance_lt(1000, /*goto*/ 0x13) + if_distance_to_target_lt(1000, /*goto*/ 0x13) goto_first(0x00) label(0x13) @@ -4385,7 +4385,7 @@ u8 func001d_search_for_player[] = { if_enemy_distance_lt_and_los(2540, /*goto*/ 0xc3) label(0x13) if_self_flag_bankx_eq(CHRFLAG1_00000400, FALSE, BANK_1, /*goto*/ 0x13) - if_chr_distance_lt(500, /*goto*/ 0x13) + if_distance_to_target_lt(500, /*goto*/ 0x13) label(0x13) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) @@ -4401,7 +4401,7 @@ u8 func001d_search_for_player[] = { if_near_miss(/*goto*/ 0x12) dprint '1','\n',0, if_self_flag_bankx_eq(CHRFLAG1_00000400, FALSE, BANK_1, /*goto*/ 0x13) - if_chr_distance_gt(500, /*goto*/ 0x15) + if_distance_to_target_gt(500, /*goto*/ 0x15) label(0x13) dprint 'C','H','E','K',' ','V','I','S','\n',0, if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x15) @@ -4752,14 +4752,14 @@ u8 func0014_coop_buddy[] = { if_enemy_distance_lt_and_los(2540, /*goto*/ 0x03) label(0xdc) set_target_chr(CHR_BOND) - if_chr_distance_lt(200, /*goto*/ 0x16) + if_distance_to_target_lt(200, /*goto*/ 0x16) // Start outer loop label(0x00) dprint 'B','U','D','D','Y',' ','G','O',' ','T','O','W','A','R','D','S','\n',0, set_target_chr(CHR_BOND) restart_timer - if_chr_distance_gt(300, /*goto*/ 0x16) + if_distance_to_target_gt(300, /*goto*/ 0x16) try_jog_to_target(/*goto*/ 0x0c) label(0x16) try_run_to_target(/*goto*/ 0x0c) @@ -4787,7 +4787,7 @@ u8 func0014_coop_buddy[] = { if_enemy_distance_lt_and_los(2540, /*goto*/ 0x03) label(0xdc) set_target_chr(CHR_BOND) - if_chr_distance_lt(200, /*goto*/ 0x16) + if_distance_to_target_lt(200, /*goto*/ 0x16) if_timer_gt(60, /*goto*/ 0x13) endloop(0x0c) @@ -4833,7 +4833,7 @@ u8 func0014_coop_buddy[] = { label(0xdc) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x03) set_target_chr(CHR_BOND) - if_chr_distance_gt(300, /*goto*/ 0x16) + if_distance_to_target_gt(300, /*goto*/ 0x16) endloop(0x04) label(0x16) @@ -5083,7 +5083,7 @@ u8 func0024_follow_bond[] = { beginloop(0x04) set_action(MA_TRACKING, FALSE) - if_chr_distance_lt(200, /*goto*/ 0x16) + if_distance_to_target_lt(200, /*goto*/ 0x16) if_timer_gt(120, /*goto*/ 0x13) if_chr_stopped(/*goto*/ 0x13) endloop(0x04) @@ -5099,7 +5099,7 @@ u8 func0024_follow_bond[] = { // Wait here until 300 units away, then follow again beginloop(0x05) set_action(MA_WAITING, FALSE) - if_chr_distance_gt(300, /*goto*/ 0x16) + if_distance_to_target_gt(300, /*goto*/ 0x16) endloop(0x05) label(0x16) @@ -5205,16 +5205,16 @@ u8 func0027_psychosised[] = { try_find_chr_in_team(/*goto*/ 0x03) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x03) set_target_chr(CHR_PRESET) - if_chr_distance_lt(200, /*goto*/ 0x16) + if_distance_to_target_lt(200, /*goto*/ 0x16) // Following Joanna label(0x00) set_target_chr(CHR_PRESET) restart_timer - if_chr_distance_gt(300, /*goto*/ 0x16) + if_distance_to_target_gt(300, /*goto*/ 0x16) try_jog_to_target(/*goto*/ 0x0c) label(0x16) - if_chr_distance_lt(200, /*goto*/ 0x16) + if_distance_to_target_lt(200, /*goto*/ 0x16) try_run_to_target(/*goto*/ 0x0c) beginloop(0x0c) @@ -5226,7 +5226,7 @@ u8 func0027_psychosised[] = { label(0x07) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x03) set_target_chr(CHR_PRESET) - if_chr_distance_lt(200, /*goto*/ 0x16) + if_distance_to_target_lt(200, /*goto*/ 0x16) if_timer_gt(60, /*goto*/ 0x13) endloop(0x0c) @@ -5247,7 +5247,7 @@ u8 func0027_psychosised[] = { try_find_chr_in_team(/*goto*/ 0x03) if_enemy_distance_lt_and_los(2540, /*goto*/ 0x03) set_target_chr(CHR_PRESET) - if_chr_distance_gt(300, /*goto*/ 0x16) + if_distance_to_target_gt(300, /*goto*/ 0x16) endloop(0x04) label(0x16)