diff --git a/src/files/setup/setupame.c b/src/files/setup/setupame.c index 3bdcb8bae..5dbaf4063 100644 --- a/src/files/setup/setupame.c +++ b/src/files/setup/setupame.c @@ -1245,7 +1245,7 @@ u8 func040f_cass[] = { stop_chr yield unset_stage_flag(STAGEFLAG_SECETARY_SAW_JO_OR_COOP) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x5b) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x5b) beginloop(0x5b) if_chr_stopped(/*goto*/ 0x5c) @@ -1276,7 +1276,7 @@ u8 func040f_cass[] = { // Face target again label(0x06) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x64) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x64) beginloop(0x64) if_jo_ccw_direction_lt(10, /*goto*/ 0x65) @@ -1349,7 +1349,7 @@ u8 func040f_cass[] = { label(0x06) restart_timer - try_face_entity(0x0008, 0x0042, /*goto*/ 0xb8) + try_face_entity(ENTITYTYPE_PAD, 0x0042, /*goto*/ 0xb8) beginloop(0xb8) if_timer_gt(60, /*goto*/ 0x63) @@ -1383,13 +1383,13 @@ u8 func040f_cass[] = { label(0x6b) stop_chr yield - try_face_entity(0x0200, 0x0000, /*goto*/ 0x6c) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x6c) beginloop(0x6c) call_rng if_rand_lt(250, /*goto*/ 0x06) stop_chr - try_face_entity(0x0200, 0x0000, /*goto*/ 0x2c) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x2c) label(0x2c) call_rng if_distance_to_target_gt(500, /*goto*/ 0x06) @@ -1465,7 +1465,7 @@ u8 func0411_secretary[] = { endloop(0x7a) label(0x7b) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x7c) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x7c) beginloop(0x7c) if_timer_lt(80, /*goto*/ 0x2c) @@ -1509,7 +1509,7 @@ u8 func0411_secretary[] = { goto_next(0x81) // Unreachable - try_face_entity(0x0200, 0x0000, /*goto*/ 0x7f) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x7f) beginloop(0x7f) if_jo_ccw_direction_lt(10, /*goto*/ 0x81) @@ -1700,7 +1700,7 @@ u8 func0414_programmer[] = { restart_timer set_alertness(255) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x9a) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x9a) beginloop(0x9a) if_jo_ccw_direction_lt(10, /*goto*/ 0x06) @@ -1799,7 +1799,7 @@ u8 func0414_programmer[] = { speak(CHR_TARGET, L_AME(71), 0x7323, CHANNEL_3, COLOR_09_BLUE) // "Move it!" label(0x06) set_stage_flag(STAGEFLAG_TALKED_TO_PROGRAMMER) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x9b) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x9b) beginloop(0x9b) if_stage_flag_eq(STAGEFLAG_TALKED_TO_PROGRAMMER, TRUE, /*goto*/ 0x06) diff --git a/src/files/setup/setupark.c b/src/files/setup/setupark.c index fc8a7fcbe..d4046fc86 100644 --- a/src/files/setup/setupark.c +++ b/src/files/setup/setupark.c @@ -831,7 +831,7 @@ u8 func040f_top_guard[] = { endloop(0x21) label(0x00) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x1f) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x1f) beginloop(0x1f) if_distance_to_target_lt(200, /*goto*/ 0x20) @@ -929,7 +929,7 @@ u8 func0406_general_combat[] = { label(0x14) if_self_flag_bankx_eq(CHRFLAG0_00002000, TRUE, BANK_0, /*goto*/ 0x00) label(0x20) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0x10) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x10) label(0x00) kneel @@ -1000,7 +1000,7 @@ u8 func0406_general_combat[] = { say_quip(CHR_BOND, QUIP_SEEPLAYER, 0xff, 0x02, 0xff, BANK_0, 0x00, 0x00) label(0x20) if_self_flag_bankx_eq(CHRFLAG0_00002000, TRUE, BANK_0, /*goto*/ 0x17) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x12) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x12) goto_next(0x13) beginloop(0x12) @@ -1059,10 +1059,10 @@ u8 func0406_general_combat[] = { goto_first(0x15) label(0x17) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x16) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x16) label(0x16) say_quip(CHR_BOND, QUIP_ATTACK1, 0x19, 0x02, 0x01, BANK_0, 0x00, 0x00) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x00) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x00) goto_next(0x20) label(0x00) goto_first(0x12) @@ -1209,7 +1209,7 @@ u8 func0408_hovercopter[] = { // Low shooting label(0x43) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x44) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x44) goto_first(0x22) label(0x44) @@ -1236,7 +1236,7 @@ u8 func0408_hovercopter[] = { // Mid shooting label(0x48) dprint 'S','H','O','O','T',' ','M','I','D','\n',0, - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x49) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x49) goto_first(0x24) label(0x49) @@ -1262,7 +1262,7 @@ u8 func0408_hovercopter[] = { // High shooting (roof) label(0x4d) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x00) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x00) label(0x00) set_stage_flag(STAGEFLAG_HOVERCOPTER_ON_ROOF) if_stage_flag_eq(STAGEFLAG_SAID_FINAL_WARNING, TRUE, /*goto*/ 0x20) @@ -1277,7 +1277,7 @@ u8 func0408_hovercopter[] = { endloop(0x29) label(0x00) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x00) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x00) goto_first(0x26) label(0x00) @@ -2094,7 +2094,7 @@ u8 func040d_cass[] = { dprint 'M','O','V','E',' ','F','A','I','L','\n',0, label(0x00) dprint 'M','O','V','E',' ','G','O','O','D','\n',0, - try_face_entity(0x0200, 0x0000, /*goto*/ 0x20) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x20) label(0x20) set_ailist(CHR_SELF, GAILIST_IDLE) endlist diff --git a/src/files/setup/setupate.c b/src/files/setup/setupate.c index 39eb4caa7..f1d3dee5e 100644 --- a/src/files/setup/setupate.c +++ b/src/files/setup/setupate.c @@ -421,9 +421,9 @@ u8 func0402_guard_combat[] = { // 2 seconds have passed without seeing guard, or guard has been shot label(0x06) if_chr_dead(CHR_TARGET, /*goto*/ 0x2e) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x2d) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x2d) label(0x2d) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x0c) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0c) beginloop(0x0c) if_chr_stopped(/*goto*/ 0x06) @@ -464,10 +464,10 @@ u8 func0403_jon_combat[] = { reloop(0x08) label(0x06) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0x2d) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x2d) label(0x2d) try_attack_roll(/*goto*/ 0x0c) - try_attack_kneel(0x0200, 0x0000, /*goto*/ 0x0c) + try_attack_kneel(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0c) beginloop(0x0c) if_chr_stopped(/*goto*/ 0x06) @@ -503,9 +503,9 @@ u8 func0404_trent_combat[] = { // Attack label(0x06) if_chr_dead(CHR_TARGET, /*goto*/ 0x2e) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x2d) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x2d) label(0x2d) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x0c) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0c) beginloop(0x0c) if_chr_stopped(/*goto*/ 0x06) diff --git a/src/files/setup/setupazt.c b/src/files/setup/setupazt.c index e6c86389c..bb74dca12 100644 --- a/src/files/setup/setupazt.c +++ b/src/files/setup/setupazt.c @@ -1339,7 +1339,7 @@ u8 func0418_robot[] = { set_target_chr(CHR_P1P2) restart_timer dprint 'P','A','R','T',' ','3','a','\n',0, - try_attack_stand1(0x0200, 0x0000, /*goto*/ 0x0e) + try_attack_stand(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0e) goto_first(0x04) beginloop(0x0e) @@ -1748,10 +1748,10 @@ u8 func041f_trent_shooting[] = { label(0x08) label(0xa8) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0xa7) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0xa7) label(0xa7) say_quip(CHR_BOND, QUIP_ATTACK1, 0x19, 0x02, 0x01, BANK_0, 0x00, 0x00) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x0a) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0a) goto_next(0x31) // Shoot worked diff --git a/src/files/setup/setupcave.c b/src/files/setup/setupcave.c index 53424621b..93901f826 100644 --- a/src/files/setup/setupcave.c +++ b/src/files/setup/setupcave.c @@ -1229,7 +1229,7 @@ u8 func0407_stewardess[] = { // Saw player label(0x04) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x05) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x05) beginloop(0x05) if_jo_ccw_direction_lt(10, /*goto*/ 0x02) @@ -1526,7 +1526,7 @@ u8 func0408_secretary[] = { // Joanna within 14 units (?) of distance label(0x02) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x05) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x05) beginloop(0x05) if_jo_ccw_direction_lt(10, /*goto*/ 0x02) @@ -2118,7 +2118,7 @@ u8 func0409_office1[] = { // Picked up briefcase label(0x02) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x0b) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0b) beginloop(0x0b) if_sound_finished(CHANNEL_4, /*goto*/ 0x31) @@ -2145,7 +2145,7 @@ u8 func0409_office1[] = { label(0x07) object_do_animation(0x025a, 0xff, 0x02, 0xffff) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x05) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x05) beginloop(0x05) if_jo_ccw_direction_lt(10, /*goto*/ 0x02) @@ -2226,7 +2226,7 @@ u8 func040a_office2[] = { label(0x02) object_do_animation(0x025a, 0xff, 0x02, 0xffff) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x05) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x05) // Wait for other guy to finish talking beginloop(0x05) @@ -2505,7 +2505,7 @@ u8 func040f_nsa[] = { label(0x04) restart_timer restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_jo_ccw_direction_lt(10, /*goto*/ 0x02) @@ -2625,7 +2625,7 @@ u8 func0411_takeover_lackey[] = { goto_next(0x02) label(0x31) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x02) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x02) label(0x02) if_self_flag_bankx_eq(CHRFLAG0_00002000, FALSE, BANK_0, /*goto*/ 0x31) if_target_in_sight(/*goto*/ 0x02) @@ -2640,9 +2640,9 @@ u8 func0411_takeover_lackey[] = { if_chr_death_animation_finished(0x0c, /*goto*/ 0x02) if_chr_knockedout(0x0c, /*goto*/ 0x02) set_target_chr(0x0c) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0x31) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x31) label(0x31) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x04) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x04) beginloop(0x04) if_chr_stopped(/*goto*/ 0x02) @@ -2743,7 +2743,7 @@ u8 func0414_officeworker[] = { label(0x02) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x78) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x78) beginloop(0x78) if_jo_ccw_direction_lt(10, /*goto*/ 0x02) @@ -3414,7 +3414,7 @@ u8 func0419_ba8c[] = { label(0x0f) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x08) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x08) label(0x08) yield if_jo_ccw_direction_lt(10, /*goto*/ 0x02) diff --git a/src/files/setup/setupdam.c b/src/files/setup/setupdam.c index c3ce44cd5..b144135e4 100644 --- a/src/files/setup/setupdam.c +++ b/src/files/setup/setupdam.c @@ -1577,7 +1577,7 @@ u8 func040d_labtech3[] = { u8 func0411_labtech_alerted[] = { restart_timer label(0x0b) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x0c) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0c) beginloop(0x0c) if_jo_ccw_direction_lt(10, /*goto*/ 0x04) @@ -2221,9 +2221,9 @@ u8 func0404_angry_pilot[] = { goto_first(0x00) label(0x07) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x04) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x04) label(0x04) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x6e) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x6e) beginloop(0x6e) if_chr_stopped(/*goto*/ 0x07) diff --git a/src/files/setup/setupdepo.c b/src/files/setup/setupdepo.c index 729f75a77..4fa6342aa 100644 --- a/src/files/setup/setupdepo.c +++ b/src/files/setup/setupdepo.c @@ -2316,9 +2316,9 @@ u8 func0412_cloak_guard[] = { set_chr_cloaked(CHR_SELF, FALSE, TRUE) label(0x0a) label(0x2c) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x2c) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x2c) label(0x2c) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x0b) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0b) beginloop(0x0b) if_chr_stopped(/*goto*/ 0x0c) diff --git a/src/files/setup/setupdish.c b/src/files/setup/setupdish.c index 7f0dd0fd9..ec65b4990 100644 --- a/src/files/setup/setupdish.c +++ b/src/files/setup/setupdish.c @@ -591,7 +591,7 @@ u8 func041e_colleague[] = { restart_timer label(0x08) if_self_flag_bankx_eq(CHRFLAG1_DOINGIDLEANIMATION, TRUE, BANK_1, /*goto*/ 0x06) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_jo_ccw_direction_lt(10, /*goto*/ 0x06) @@ -620,7 +620,7 @@ u8 func041e_colleague[] = { label(0x06) restart_timer stop_chr - try_face_entity(0x0200, 0x0000, /*goto*/ 0x59) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x59) beginloop(0x59) if_target_in_sight(/*goto*/ 0x06) @@ -2464,7 +2464,7 @@ u8 func0429_grimshaw_disguise[] = { restart_timer label(0x08) if_self_flag_bankx_eq(CHRFLAG1_DOINGIDLEANIMATION, TRUE, BANK_1, /*goto*/ 0x06) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_stage_flag_eq(STAGEFLAG_DEVICE_ABORTING, TRUE, /*goto*/ 0x0d) @@ -2656,7 +2656,7 @@ u8 func042a_carrington_cloak[] = { restart_timer label(0x08) if_self_flag_bankx_eq(CHRFLAG1_DOINGIDLEANIMATION, TRUE, BANK_1, /*goto*/ 0x06) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_jo_ccw_direction_lt(10, /*goto*/ 0x06) @@ -3174,7 +3174,7 @@ u8 func042c_carrington_tour[] = { label(0x06) restart_timer set_target_chr(CHR_BOND) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x79) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x79) beginloop(0x79) if_timer_gt(120, /*goto*/ 0x2f) @@ -4549,7 +4549,7 @@ u8 func0404_holo4_guard2[] = { set_ailist(CHR_SELF, GAILIST_IDLE) label(0x06) if_distance_to_target_lt(500, /*goto*/ 0x2f) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x08) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x08) beginloop(0x08) if_distance_to_target_lt(500, /*goto*/ 0x2f) @@ -4809,7 +4809,7 @@ u8 func0407_holo5_guard1[] = { label(0x06) if_distance_to_target_lt(300, /*goto*/ 0x2f) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x08) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x08) beginloop(0x08) if_distance_to_target_lt(300, /*goto*/ 0x2f) @@ -4866,7 +4866,7 @@ u8 func0409_holo5_guard2[] = { label(0x06) label(0x09) set_self_chrflag(CHRCFLAG_INVINCIBLE_TO_GUNFIRE) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x0a) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0a) beginloop(0x0a) if_chr_sees_player(/*goto*/ 0x06) @@ -5248,7 +5248,7 @@ u8 func0416_holo_guard_unarmed_alert2[] = { if_jo_ccw_direction_lt(10, /*goto*/ 0x06) if_jo_ccw_direction_gt(246, /*goto*/ 0x06) stop_chr - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_chr_dead(CHR_TARGET, /*goto*/ 0x57) @@ -5604,14 +5604,14 @@ u8 func0419_holo_guard_armed_alert[] = { set_ailist(CHR_SELF, AILIST_HOLO_GUARD_UNARMED_ALERT) label(0x2f) label(0x8f) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x04) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x04) beginloop(0x04) if_in_disarm_range(/*goto*/ 0x2f) endloop(0x04) label(0x2f) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x08) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x08) beginloop(0x08) if_chr_injured_target(CHR_SELF, /*goto*/ 0x2f) diff --git a/src/files/setup/setupear.c b/src/files/setup/setupear.c index 6076b9c1d..7e933f3b0 100644 --- a/src/files/setup/setupear.c +++ b/src/files/setup/setupear.c @@ -1020,7 +1020,7 @@ u8 func0404_scientist[] = { label(0x06) restart_timer label(0x08) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_sound_finished(CHANNEL_6, /*goto*/ 0x2f) @@ -1204,7 +1204,7 @@ u8 func0406_nasty_scientist[] = { label(0x13) label(0x08) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_sound_finished(CHANNEL_6, /*goto*/ 0x2f) @@ -2862,9 +2862,9 @@ u8 func0402_k7_guard[] = { endloop(0x04) label(0x06) - try_attack_stand1(0x0028, 0x0159, /*goto*/ 0x2f) + try_attack_stand(ENTITYTYPE_PAD | ENTITYTYPE_AIMONLY, 0x0159, /*goto*/ 0x2f) label(0x2f) - try_attack_stand2(0x0008, 0x0159, /*goto*/ 0x2f) + try_modify_attack(ENTITYTYPE_PAD, 0x0159, /*goto*/ 0x2f) label(0x2f) say_quip(CHR_BOND, QUIP_ATTACK1, 0x32, 0x02, 0xff, BANK_0, 0x00, 0x00) diff --git a/src/files/setup/setupeld.c b/src/files/setup/setupeld.c index c0a8aa2ae..6d216c7ee 100644 --- a/src/files/setup/setupeld.c +++ b/src/files/setup/setupeld.c @@ -1500,7 +1500,7 @@ u8 func0402_taker[] = { label(0x06) set_target_chr(CHR_BOND) label(0x03) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x05) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x05) beginloop(0x05) if_distance_to_target_gt(1000, /*goto*/ 0x2e) @@ -1519,7 +1519,7 @@ u8 func0402_taker[] = { // Jo got too close label(0x06) set_self_flag_bankx(CHRFLAG0_00002000, BANK_0) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x09) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) label(0x09) yield if_chr_stopped(/*goto*/ 0x06) @@ -1546,7 +1546,7 @@ u8 func0402_taker[] = { restart_timer set_target_chr(CHR_NEGOTIATOR) label(0x03) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x04) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x04) beginloop(0x04) chr_toggle_p1p2(CHR_SELF) @@ -1584,7 +1584,7 @@ u8 func0402_taker[] = { // Shoot label(0x6f) label(0x06) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x08) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x08) beginloop(0x08) if_chr_death_animation_finished(CHR_NEGOTIATOR, /*goto*/ 0x06) @@ -1805,7 +1805,7 @@ u8 func0404_sniper[] = { if_rand_lt(64, /*goto*/ 0x59) if_rand_lt(128, /*goto*/ 0x5a) if_rand_lt(196, /*goto*/ 0x5b) - try_face_entity(ENTITYTYPE_DIRECTION, 0x0000, /*goto*/ 0x06) + try_face_entity(ENTITYTYPE_DIRECTION, 0, /*goto*/ 0x06) reloop(0x04) label(0x59) @@ -1889,13 +1889,13 @@ u8 func0404_sniper[] = { label(0x2d) restart_timer label(0x06) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x08) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x08) reloop(0x04) label(0x08) yield label(0x06) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x09) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) reloop(0x04) beginloop(0x09) diff --git a/src/files/setup/setupimp.c b/src/files/setup/setupimp.c index fe629fc88..94f9175b3 100644 --- a/src/files/setup/setupimp.c +++ b/src/files/setup/setupimp.c @@ -1899,10 +1899,10 @@ u8 func041f_holoclone[] = { set_target_chr(holoclone) \ label(0x04) \ yield \ - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0xb9) \ + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0xb9) \ label(0xb9) \ say_quip(CHR_BOND, QUIP_ATTACK1, 0x19, 0x02, 0x01, BANK_0, 0x00, 0x00) \ - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x0a) \ + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0a) \ \ beginloop(0x0a) \ if_chr_stopped(/*goto*/ 0x08) \ @@ -1988,7 +1988,7 @@ u8 func0425_hostage_thank_and_run[] = { label(0x08) restart_timer label(0x0a) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x0b) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0b) beginloop(0x0b) if_timer_gt(60, /*goto*/ 0x08) @@ -2080,7 +2080,7 @@ u8 func0427_drop_devastator[] = { label(0x08) restart_timer label(0x0a) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x0b) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0b) beginloop(0x0b) if_timer_gt(60, /*goto*/ 0x08) @@ -2366,10 +2366,10 @@ u8 func0432_taker_attack[] = { // Healthy label(0x04) yield - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0xb9) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0xb9) label(0xb9) say_quip(CHR_BOND, QUIP_ATTACK1, 0x19, 0x02, 0x01, BANK_0, 0x00, 0x00) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x0a) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0a) beginloop(0x0a) if_chr_stopped(/*goto*/ 0x08) diff --git a/src/files/setup/setuplee.c b/src/files/setup/setuplee.c index 9ac49702c..0f67c815f 100644 --- a/src/files/setup/setuplee.c +++ b/src/files/setup/setuplee.c @@ -1489,7 +1489,7 @@ u8 func0408_knifeable_skedar[] = { label(0x2c) restart_timer set_target_chr(CHR_CASS) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x04) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x04) beginloop(0x04) chr_toggle_p1p2(CHR_SELF) @@ -2339,7 +2339,7 @@ u8 func041a_bridgeclone[] = { if_jo_ccw_direction_lt(10, /*goto*/ 0x06) if_jo_ccw_direction_gt(246, /*goto*/ 0x06) stop_chr - try_face_entity(0x0200, 0x0001, /*goto*/ 0x0b) + try_face_entity(ENTITYTYPE_TARGET, 1, /*goto*/ 0x0b) beginloop(0x0b) if_chr_dead(CHR_SELF, /*goto*/ 0xb8) @@ -2990,7 +2990,7 @@ u8 func0421_bridge_skedar[] = { label(0xc6) if_self_flag_bankx_eq(CHRFLAG0_00002000, TRUE, BANK_0, /*goto*/ 0x06) set_target_chr(CHR_BOND) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0xc7) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0xc7) label(0x06) kneel @@ -3085,10 +3085,10 @@ u8 func0421_bridge_skedar[] = { label(0xca) if_self_flag_bankx_eq(CHRFLAG0_00002000, FALSE, BANK_0, /*goto*/ 0x60) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0xb1) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0xb1) label(0xb1) say_quip(CHR_BOND, QUIP_ATTACK1, 0x19, 0x02, 0x01, BANK_0, 0x00, 0x00) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x06) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x06) goto_next(0x2c) label(0x60) diff --git a/src/files/setup/setuplip.c b/src/files/setup/setuplip.c index 347cd0b32..2a0f5bda2 100644 --- a/src/files/setup/setuplip.c +++ b/src/files/setup/setuplip.c @@ -1354,7 +1354,7 @@ u8 func0410_labtech_showers_sa_pa[] = { if_self_flag_bankx_eq(CHRFLAG0_00002000, TRUE, BANK_0, /*goto*/ 0x56) restart_timer label(0x08) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_jo_ccw_direction_lt(10, /*goto*/ 0x06) @@ -1365,7 +1365,7 @@ u8 func0410_labtech_showers_sa_pa[] = { dprint 'T','A','L','K',' ','1','\n',0, speak(CHR_TARGET, L_LIP(37), 0x1b2d, CHANNEL_4, COLOR_08_RED) // "Who are you?" restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x64) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x64) // Wait until seeing Jo with a gun, or Jo has clothes beginloop(0x64) @@ -1725,7 +1725,7 @@ u8 func0418_doorman[] = { label(0x03) restart_timer label(0x08) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_jo_ccw_direction_lt(10, /*goto*/ 0x06) @@ -1958,7 +1958,7 @@ u8 func041a_labtech_harrysmate[] = { label(0x2d) restart_timer label(0x08) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_jo_ccw_direction_lt(10, /*goto*/ 0x06) @@ -2328,7 +2328,7 @@ u8 func0413_mechanic[] = { restart_timer label(0x08) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_jo_ccw_direction_lt(10, /*goto*/ 0x06) @@ -2632,7 +2632,7 @@ u8 func041f_labtech_lights[] = { if_self_flag_bankx_eq(CHRFLAG0_00002000, TRUE, BANK_0, /*goto*/ 0x53) restart_timer label(0x08) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_jo_ccw_direction_lt(10, /*goto*/ 0x06) @@ -2727,7 +2727,7 @@ u8 func041f_labtech_lights[] = { label(0x06) set_self_chrflag(CHRCFLAG_00000080) restart_timer - try_face_entity(0x0008, 0x0428, /*goto*/ 0x6e) + try_face_entity(ENTITYTYPE_PAD, 0x0428, /*goto*/ 0x6e) beginloop(0x6e) if_timer_gt(120, /*goto*/ 0x6f) @@ -2859,7 +2859,7 @@ u8 func0420_labtech_doors[] = { label(0x03) restart_timer label(0x08) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_saw_injury(0x00, /*goto*/ 0x89) @@ -2925,9 +2925,9 @@ u8 func0420_labtech_doors[] = { label(0x06) restart_timer if_self_flag_bankx_eq(CHRFLAG0_00000004, TRUE, BANK_0, /*goto*/ 0x2d) - try_face_entity(0x0008, 0x03c6, /*goto*/ 0x70) + try_face_entity(ENTITYTYPE_PAD, 0x03c6, /*goto*/ 0x70) label(0x2d) - try_face_entity(0x0008, 0x03c7, /*goto*/ 0x70) + try_face_entity(ENTITYTYPE_PAD, 0x03c7, /*goto*/ 0x70) beginloop(0x70) if_timer_gt(30, /*goto*/ 0x2d) @@ -2956,7 +2956,7 @@ u8 func0420_labtech_doors[] = { label(0x06) restart_timer - try_face_entity(0x0008, 0x0107, /*goto*/ 0x73) + try_face_entity(ENTITYTYPE_PAD, 0x0107, /*goto*/ 0x73) beginloop(0x73) if_timer_gt(30, /*goto*/ 0x06) @@ -3094,7 +3094,7 @@ u8 func0422_labtech_records[] = { label(0x2d) restart_timer label(0x08) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) label(0x09) yield if_jo_ccw_direction_lt(10, /*goto*/ 0x06) diff --git a/src/files/setup/setuplue.c b/src/files/setup/setuplue.c index ead8ddbe2..18fdbd169 100644 --- a/src/files/setup/setuplue.c +++ b/src/files/setup/setuplue.c @@ -1540,14 +1540,14 @@ u8 func0417_traitor[] = { label(0x2e) call_rng if_rand_gt(128, /*goto*/ 0x2e) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0x0a) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x0a) label(0x2e) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x0a) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x0a) dprint 'S','H','O','O','T','F','A','I','L','E','D','\n',0, yield label(0x0a) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x0b) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0b) goto_next(0x0c) beginloop(0x0b) @@ -1659,7 +1659,7 @@ u8 func0416_mechanic[] = { label(0x2e) set_alertness(100) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x0a) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0a) beginloop(0x0a) if_jo_ccw_direction_lt(10, /*goto*/ 0x06) @@ -1733,7 +1733,7 @@ u8 func040a_top_interceptor[] = { goto_first(0x09) label(0x59) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x5b) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x5b) reloop(0x0a) label(0x5b) diff --git a/src/files/setup/setuppam.c b/src/files/setup/setuppam.c index 71552f139..5d254f1f3 100644 --- a/src/files/setup/setuppam.c +++ b/src/files/setup/setuppam.c @@ -1211,7 +1211,7 @@ u8 func0406_elvis_follow_and_do_sa_megaweapon[] = { label(0x2e) restart_timer - try_face_entity(0x0008, 0x0115, /*goto*/ 0x97) + try_face_entity(ENTITYTYPE_PAD, 0x0115, /*goto*/ 0x97) beginloop(0x97) if_timer_gt(60, /*goto*/ 0x06) @@ -3223,9 +3223,9 @@ u8 func041d_sniper[] = { set_chr_cloaked(CHR_SELF, FALSE, TRUE) label(0x0a) label(0x2e) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x2e) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x2e) label(0x2e) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x0b) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0b) beginloop(0x0b) if_chr_stopped(/*goto*/ 0x0c) @@ -3467,7 +3467,7 @@ u8 func040f_miniskedar[] = { restart_timer dprint 'F','A','C','E',' ','T','A','R','G','E','T','\n',0, stop_chr - try_face_entity(0x0200, 0x0000, /*goto*/ 0x0b) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0b) beginloop(0x0b) if_timer_gt(30, /*goto*/ 0x06) diff --git a/src/files/setup/setuppete.c b/src/files/setup/setuppete.c index c0bf14994..b03d579f2 100644 --- a/src/files/setup/setuppete.c +++ b/src/files/setup/setuppete.c @@ -1437,7 +1437,7 @@ u8 func0412_cia[] = { label(0x1e) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_jo_ccw_direction_lt(10, /*goto*/ 0x04) @@ -1586,7 +1586,7 @@ u8 func0413_bugspotter[] = { // Player in sight - face them label(0x04) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x04) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x04) beginloop(0x09) if_jo_ccw_direction_lt(10, /*goto*/ 0x04) @@ -1868,7 +1868,7 @@ u8 func041d_fbi[] = { label(0x04) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x0d) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0d) beginloop(0x0d) if_jo_ccw_direction_lt(10, /*goto*/ 0x04) @@ -2040,7 +2040,7 @@ u8 func041a_robot[] = { label(0x03) set_target_chr(CHR_P1P2) restart_timer - try_attack_stand1(0x0200, 0x0000, /*goto*/ 0x09) + try_attack_stand(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) reloop(0x02) beginloop(0x09) diff --git a/src/files/setup/setuprit.c b/src/files/setup/setuprit.c index 872837a54..6b041d7b4 100644 --- a/src/files/setup/setuprit.c +++ b/src/files/setup/setuprit.c @@ -1210,7 +1210,7 @@ u8 func0405_president_in_room[] = { set_target_chr(CHR_PRESET) restart_timer label(0x08) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) // Wait for Carrington's "on this level" message to finish @@ -1246,7 +1246,7 @@ u8 func0405_president_in_room[] = { speak(CHR_TARGET, L_RIT(37), 0x72bc, CHANNEL_7, COLOR_09_BLUE) // "Mr. President, you're in danger. Trent is trying t..." restart_timer stop_chr - try_face_entity(0x0200, 0x0000, /*goto*/ 0x78) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x78) // In this loop the president will continue to turn to face the player // because it lacks an if_jo_ccw_direction_lt check. @@ -1327,7 +1327,7 @@ u8 func0405_president_in_room[] = { set_stage_flag(STAGEFLAG_PRESIDENT_CALLED_SECURITY) yield increase_squadron_alertness(100) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x0a) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0a) beginloop(0x0a) endloop(0x0a) @@ -1339,7 +1339,7 @@ u8 func0405_president_in_room[] = { stop_chr speak(CHR_TARGET, L_RIT(41), 0x72bd, CHANNEL_6, COLOR_09_BLUE) // "This is a recording of a meeting between Trent and..." restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x0b) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0b) // This loop uses an if_sound_finished check rather than a timer check, // which allows the speech to be skipped. @@ -1413,7 +1413,7 @@ u8 func0405_president_in_room[] = { set_stage_flag(STAGEFLAG_PRESIDENT_STARTED_RUNNING) speak(CHR_TARGET, L_RIT(39), 0x72be, CHANNEL_6, COLOR_09_BLUE) // "We have to get you to the escape pod. Follow me." restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x0e) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0e) beginloop(0x0e) if_timer_gt(120, /*goto*/ 0x06) @@ -1774,9 +1774,9 @@ u8 func0413_taker[] = { if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0x11) if_chr_dead(CHR_TARGET, /*goto*/ 0x11) if_chr_knockedout(CHR_TARGET, /*goto*/ 0x11) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x06) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x06) label(0x06) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x08) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x08) label(0x08) say_quip(CHR_BOND, QUIP_ATTACK1, 0x19, 0x02, 0x00, BANK_0, 0x00, 0x00) say_quip(CHR_BOND, QUIP_ATTACK2, 0x19, 0x02, 0x01, BANK_0, 0x00, 0x00) @@ -2756,7 +2756,7 @@ u8 func041e_blonde[] = { set_self_chrflag(CHRCFLAG_00000040) label(0x68) if_self_flag_bankx_eq(CHRFLAG0_00002000, TRUE, BANK_0, /*goto*/ 0x06) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0x75) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x75) label(0x06) kneel @@ -2782,7 +2782,7 @@ u8 func041e_blonde[] = { goto_next(0x6c) // Unreachable - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x6d) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x6d) goto_next(0x6e) // Reachable from below @@ -2843,7 +2843,7 @@ u8 func041e_blonde[] = { label(0x6c) say_quip(CHR_BOND, QUIP_ATTACK1, 0x19, 0x02, 0x01, BANK_0, 0x00, 0x00) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x06) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x06) label(0x06) goto_first(0x6d) @@ -2851,10 +2851,10 @@ u8 func041e_blonde[] = { goto_first(0x6e) label(0x76) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x74) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x74) label(0x74) say_quip(CHR_BOND, QUIP_ATTACK1, 0x19, 0x02, 0x01, BANK_0, 0x00, 0x00) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x06) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x06) goto_next(0x2d) label(0x06) goto_first(0x6d) @@ -2916,10 +2916,10 @@ u8 func0420_trent_attacking[] = { // President in sight label(0x06) label(0x76) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x74) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x74) label(0x74) say_quip(CHR_BOND, QUIP_ATTACK1, 0x19, 0x02, 0x01, BANK_0, 0x00, 0x00) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x08) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x08) goto_next(0x2d) beginloop(0x08) @@ -3042,7 +3042,7 @@ u8 func0429_be_unalert[] = { set_alertness(0) label(0x03) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x04) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x04) beginloop(0x04) if_chr_stopped(/*goto*/ 0x06) @@ -3239,7 +3239,7 @@ u8 func0407_steward[] = { label(0x89) set_alertness(100) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_jo_ccw_direction_lt(10, /*goto*/ 0x06) @@ -3295,7 +3295,7 @@ u8 func0407_stewardess[] = { // Alerted label(0x2d) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_jo_ccw_direction_lt(10, /*goto*/ 0x06) diff --git a/src/files/setup/setupsho.c b/src/files/setup/setupsho.c index 63b94f997..60ce6f054 100644 --- a/src/files/setup/setupsho.c +++ b/src/files/setup/setupsho.c @@ -614,7 +614,7 @@ u8 func0402_unarmed_skedar[] = { if_jo_ccw_direction_gt(246, /*goto*/ 0x06) stop_chr set_action(MA_FACING, TRUE) - try_face_entity(0x0200, 0x0001, /*goto*/ 0x0c) + try_face_entity(ENTITYTYPE_TARGET, 1, /*goto*/ 0x0c) beginloop(0x0c) if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ 0x10) @@ -802,7 +802,7 @@ u8 func0404_miniskedar[] = { restart_timer dprint 'F','A','C','E',' ','T','A','R','G','E','T','\n',0, stop_chr - try_face_entity(0x0200, 0x0000, /*goto*/ 0x0c) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0c) beginloop(0x0c) if_timer_gt(30, /*goto*/ 0x06) @@ -1693,7 +1693,7 @@ u8 func0409_reaper_slayer_skedar[] = { label(0x5e) if_self_flag_bankx_eq(CHRFLAG0_00002000, TRUE, BANK_0, /*goto*/ 0x06) set_target_chr(CHR_BOND) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0x5f) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x5f) label(0x06) kneel @@ -1800,10 +1800,10 @@ u8 func0409_reaper_slayer_skedar[] = { label(0x71) if_self_flag_bankx_eq(CHRFLAG0_00002000, FALSE, BANK_0, /*goto*/ 0x72) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x70) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x70) label(0x70) say_quip(CHR_BOND, QUIP_ATTACK1, 0x19, 0x02, 0x01, BANK_0, 0x00, 0x00) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x06) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x06) goto_next(0x2d) label(0x72) @@ -1981,7 +1981,7 @@ u8 func040d_king_combat[] = { label(LABEL_MAINLOOP) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x04) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x04) beginloop(0x04) if_chr_death_animation_finished(CHR_P1P2, /*goto*/ LABEL_PLAYER_DEAD) @@ -2042,10 +2042,10 @@ u8 func040d_king_combat[] = { label(0x06) say_quip(CHR_BOND, QUIP_ATTACK2, 0xff, 0x03, 0xff, BANK_0, 0x00, 0x00) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x70) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x70) label(0x70) say_quip(CHR_BOND, QUIP_ATTACK1, 0x19, 0x02, 0x01, BANK_0, 0x00, 0x00) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x7b) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x7b) goto_next(0x2d) label(0x06) @@ -2161,7 +2161,7 @@ u8 func040d_king_combat[] = { if_jo_ccw_direction_lt(10, /*goto*/ 0x06) if_jo_ccw_direction_gt(246, /*goto*/ 0x06) stop_chr - try_face_entity(0x0200, 0x0000, /*goto*/ 0x09) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x09) beginloop(0x09) if_chr_death_animation_finished(CHR_P1P2, /*goto*/ 0x0b) diff --git a/src/files/setup/setuptra.c b/src/files/setup/setuptra.c index fc0742f92..1e4723b1f 100644 --- a/src/files/setup/setuptra.c +++ b/src/files/setup/setuptra.c @@ -837,7 +837,7 @@ u8 func0402_jonathan_waiting_for_meetup[] = { label(0x06) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x0a) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x0a) beginloop(0x0a) if_sound_finished(CHANNEL_4, /*goto*/ 0x32) @@ -1101,7 +1101,7 @@ u8 func0413_jonathan_hangar[] = { set_stage_flag(STAGEFLAG_JON_WAITING_AT_UFO) stop_chr set_target_chr(CHR_P1P2) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x14) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x14) // Wait until both Joanna and Elvis within 400 units beginloop(0x14) @@ -1336,7 +1336,7 @@ u8 func0413_jonathan_hangar[] = { label(0x59) speak(CHR_BOND, L_TRA(47), 0x72ac, CHANNEL_5, COLOR_09_BLUE) // "Jonathan, go with Elvis. I'll see to the consoles." restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x46) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x46) beginloop(0x46) if_jo_ccw_direction_lt(10, /*goto*/ 0x06) diff --git a/src/files/setup/setupwax.c b/src/files/setup/setupwax.c index c1c23314b..678bda440 100644 --- a/src/files/setup/setupwax.c +++ b/src/files/setup/setupwax.c @@ -1316,7 +1316,7 @@ u8 func0411_cass_in_office[] = { label(0x55) stop_chr yield - try_face_entity(0x0200, 0x0000, /*goto*/ 0x56) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x56) beginloop(0x56) if_jo_ccw_direction_lt(10, /*goto*/ 0x57) @@ -1350,9 +1350,9 @@ u8 func0411_cass_in_office[] = { reloop(0x5a) label(0x83) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x2c) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x2c) label(0x2c) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x82) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x82) // Wait until shooting animation finished beginloop(0x82) @@ -1586,9 +1586,9 @@ u8 func0415_chief[] = { // Attack while in sight label(0x2c) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x2c) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x2c) label(0x2c) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x82) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x82) beginloop(0x82) if_chr_stopped(/*goto*/ 0x06) diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 901887e3d..3705d93e3 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -1949,7 +1949,7 @@ void chrRunToPos(struct chrdata *chr, struct coord *pos) } GLOBAL_ASM( -glabel func0f030120 +glabel chrAttackStand /* f030120: 27bdffa8 */ addiu $sp,$sp,-88 /* f030124: afbf0024 */ sw $ra,0x24($sp) /* f030128: afa5005c */ sw $a1,0x5c($sp) @@ -13304,7 +13304,7 @@ glabel var7f1a8ec4 /* f03a574: 00000000 */ sll $zero,$zero,0x0 ); -bool func0f03a578(struct chrdata *chr, s32 entitytype, s32 entityid) +bool chrTryAttackStand(struct chrdata *chr, s32 entitytype, s32 entityid) { s32 race = CHRRACE(chr); @@ -13314,14 +13314,14 @@ bool func0f03a578(struct chrdata *chr, s32 entitytype, s32 entityid) if (chrIsReadyForOrders(chr)) { if (race == RACE_ROBOT) { - func0f042808(chr); + robotAttack(chr); return true; } if (race == RACE_HUMAN || race == RACE_SKEDAR) { if (chrGetEquippedWeaponPropWithCheck(chr, 0) || (chrGetEquippedWeaponPropWithCheck(chr, 1))) { - func0f030120(chr, entitytype, entityid); + chrAttackStand(chr, entitytype, entityid); return true; } } @@ -13358,7 +13358,7 @@ bool chrTryAttackLie(struct chrdata *chr, s32 entitytype, s32 entityid) return false; } -bool func0f03a76c(struct chrdata *chr, u32 entitytype, s32 entityid) +bool chrTryModifyAttack(struct chrdata *chr, u32 entitytype, s32 entityid) { s32 race = CHRRACE(chr); @@ -21364,7 +21364,7 @@ glabel func0f04279c ); GLOBAL_ASM( -glabel func0f042808 +glabel robotAttack .late_rodata glabel var7f1a9194 .word 0x3f59999a @@ -22081,7 +22081,7 @@ glabel var7f1a91e0 /* f043214: ae0f004c */ sw $t7,0x4c($s0) /* f043218: 02002025 */ or $a0,$s0,$zero /* f04321c: 01e02825 */ or $a1,$t7,$zero -/* f043220: 0fc0c048 */ jal func0f030120 +/* f043220: 0fc0c048 */ jal chrAttackStand /* f043224: 8e060050 */ lw $a2,0x50($s0) /* f043228: 10000069 */ beqz $zero,.L0f0433d0 /* f04322c: 8fbf0024 */ lw $ra,0x24($sp) diff --git a/src/game/chr/chrai.c b/src/game/chr/chrai.c index d5c47bc56..fc3583132 100644 --- a/src/game/chr/chrai.c +++ b/src/game/chr/chrai.c @@ -39,9 +39,9 @@ bool (*g_CommandPointers[])(void) = { /*0x0012*/ aiTryAttackWalk, /*0x0013*/ aiTryAttackRun, /*0x0014*/ aiTryAttackRoll, - /*0x0015*/ aiTryAttackStand1, + /*0x0015*/ aiTryAttackStand, /*0x0016*/ aiTryAttackKneel, - /*0x0017*/ aiTryAttackStand2, + /*0x0017*/ aiTryModifyAttack, /*0x0018*/ aiFaceEntity, /*0x0019*/ ai0019, /*0x001a*/ ai001a, diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 717c55b53..dc417ba5d 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -683,13 +683,13 @@ bool aiTryAttackRoll(void) /** * @cmd 0015 */ -bool aiTryAttackStand1(void) +bool aiTryAttackStand(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; u32 thingid = cmd[5] | (cmd[4] << 8); u32 thingtype = cmd[3] | (cmd[2] << 8); - if (func0f03a578(g_Vars.chrdata, thingtype, thingid)) { + if (chrTryAttackStand(g_Vars.chrdata, thingtype, thingid)) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[6]); } else { g_Vars.aioffset += 7; @@ -771,13 +771,13 @@ bool aiIfAttacking(void) /** * @cmd 0017 */ -bool aiTryAttackStand2(void) +bool aiTryModifyAttack(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; u32 thingid = cmd[5] | (cmd[4] << 8); u32 thingtype = cmd[3] | (cmd[2] << 8); - if ((g_Vars.chrdata && func0f03a76c(g_Vars.chrdata, thingtype, thingid)) || + if ((g_Vars.chrdata && chrTryModifyAttack(g_Vars.chrdata, thingtype, thingid)) || (g_Vars.hovercar && chopperAttack(g_Vars.hovercar))) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[6]); } else { diff --git a/src/game/data/ailists.c b/src/game/data/ailists.c index 9fd747e97..188511611 100644 --- a/src/game/data/ailists.c +++ b/src/game/data/ailists.c @@ -1168,7 +1168,7 @@ u8 func0007_alerted[] = { dprint 'A','T',' ','T','R','A','P',' ','P','A','D','\n',0, label(0x9b) if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0x03) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x03) beginloop(0x03) if_in_disarm_range(/*goto*/ 0x9a) @@ -1188,7 +1188,7 @@ u8 func0007_alerted[] = { // Aiming only label(0x9a) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x04) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x04) beginloop(0x04) if_chr_stopped(/*goto*/ 0x16) @@ -1260,7 +1260,7 @@ u8 func0007_alerted[] = { dprint 'U','N','D','E','R',' ','P','O','P','P','E','R','\n',0, label(0xa8) if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0xa9) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0xa9) beginloop(0xa9) chr_toggle_p1p2(CHR_SELF) @@ -1278,7 +1278,7 @@ u8 func0007_alerted[] = { goto_next(0x13) label(0x16) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0xaa) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0xaa) label(0x13) kneel restart_timer @@ -1297,7 +1297,7 @@ u8 func0007_alerted[] = { label(0x13) if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x13) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x13) goto_first(0xa8) label(0x13) @@ -1305,7 +1305,7 @@ u8 func0007_alerted[] = { goto_first(0xa8) label(0x13) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x13) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x13) goto_first(0xa8) label(0x13) @@ -1331,7 +1331,7 @@ u8 func0007_alerted[] = { if_jo_ccw_direction_gt(246, /*goto*/ 0x13) restart_timer stop_chr - try_face_entity(0x0200, 0x0000, /*goto*/ 0xec) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0xec) beginloop(0xec) if_jo_ccw_direction_lt(10, /*goto*/ 0x13) @@ -1369,7 +1369,7 @@ u8 func0007_alerted[] = { label(0x13) restart_timer if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) - try_attack_lie(0x0022, 0x0000, /*goto*/ 0xdf) + try_attack_lie(ENTITYTYPE_FORWARD | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0xdf) beginloop(0xdf) if_distance_to_target_lt(1000, /*goto*/ 0x16) @@ -1385,7 +1385,7 @@ u8 func0007_alerted[] = { label(0x13) restart_timer set_accuracy(100) - try_attack_lie(0x0200, 0x0000, /*goto*/ 0xe0) + try_attack_lie(ENTITYTYPE_TARGET, 0, /*goto*/ 0xe0) dprint 'S','N','I','P','E','R',' ','N','O',' ','S','H','O','O','T','\n',0, beginloop(0xe0) @@ -1525,7 +1525,7 @@ u8 func0007_alerted[] = { unset_self_flag_bankx(CHRFLAG1_00040000, BANK_1) unset_self_flag_bankx(CHRFLAG1_00020000, BANK_1) if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0x59) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x59) beginloop(0x59) if_dangerous_object_nearby(3, /*goto*/ LABEL_FLEE_GRENADE) @@ -1660,11 +1660,11 @@ u8 func0007_alerted[] = { label(0x13) call_rng if_rand_gt(128, /*goto*/ 0x8c) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0x16) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x16) label(0x8c) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x16) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x16) label(0x16) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x60) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x60) beginloop(0x60) if_dangerous_object_nearby(3, /*goto*/ LABEL_FLEE_GRENADE) @@ -1874,7 +1874,7 @@ u8 func0007_alerted[] = { unset_self_flag_bankx(CHRFLAG1_00040000, BANK_1) unset_self_flag_bankx(CHRFLAG1_00020000, BANK_1) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x4b) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x4b) beginloop(0x4b) if_within_units_of_sight(30, /*goto*/ 0x42) @@ -1903,7 +1903,7 @@ u8 func0007_alerted[] = { unset_self_flag_bankx(CHRFLAG1_00040000, BANK_1) unset_self_flag_bankx(CHRFLAG1_00020000, BANK_1) if_chr_has_hiddenflag(CHR_TARGET, CHRHFLAG_CLOAKED, /*goto*/ LABEL_CLOAKED) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0x40) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x40) beginloop(0x40) if_dangerous_object_nearby(3, /*goto*/ LABEL_FLEE_GRENADE) @@ -2010,11 +2010,11 @@ u8 func0007_alerted[] = { label(0x13) call_rng if_rand_gt(128, /*goto*/ 0x8c) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x16) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x16) label(0x8c) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0x16) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x16) label(0x16) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x43) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x43) beginloop(0x43) if_dangerous_object_nearby(3, /*goto*/ LABEL_FLEE_GRENADE) @@ -2346,16 +2346,16 @@ u8 func0007_alerted[] = { label(0x13) call_rng if_rand_gt(128, /*goto*/ 0x8c) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0x28) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x28) label(0x8c) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x28) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x28) dprint 'S','H','O','O','T','F','A','I','L','E','D','\n',0, yield if_dangerous_object_nearby(3, /*goto*/ LABEL_FLEE_GRENADE) goto_first(0x8b) label(0x28) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0x44) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0x44) goto_next(0x67) label(0x44) @@ -3208,11 +3208,11 @@ u8 func000c_combat_with_target_chr[] = { label(0x13) call_rng if_rand_gt(128, /*goto*/ 0x8c) - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0x16) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x16) label(0x8c) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x16) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x16) label(0x16) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0xc3) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0xc3) label(0xc3) say_quip(CHR_BOND, QUIP_ATTACK3, 0x19, 0x02, 0xff, BANK_0, 0x00, 0x00) @@ -3309,7 +3309,7 @@ u8 func000c_combat_with_target_chr[] = { dprint 'G','O','T',' ','T','O',' ','C','O','V','E','R','\n',0, label(0xc8) restart_timer - try_attack_kneel(0x0220, 0x0000, /*goto*/ 0xc9) + try_attack_kneel(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0xc9) beginloop(0xc9) if_chr_dead(CHR_TARGET, /*goto*/ 0xc5) @@ -3346,7 +3346,7 @@ u8 func000c_combat_with_target_chr[] = { label(0x16) say_quip(CHR_BOND, QUIP_ATTACK2, 0xff, 0x03, 0xff, BANK_0, 0x00, 0x00) label(0x17) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0xcb) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0xcb) goto_next(0x16) label(0xcb) @@ -3457,7 +3457,7 @@ u8 func000c_combat_with_target_chr[] = { label(0xd7) say_quip(CHR_BOND, QUIP_KILLEDPLAYER1, 0x28, 0x00, 0x01, BANK_0, 0x00, 0x00) - try_face_entity(0x0200, 0x0000, /*goto*/ 0x16) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x16) label(0x16) if_chr_is_skedar(CHR_SELF, /*goto*/ 0xd9) chr_do_animation(ANIM_YAWN, 0, 193, 0x18, 0x10, CHR_SELF, 2) @@ -3880,7 +3880,7 @@ u8 func000f_hand_combat[] = { if_jo_ccw_direction_lt(10, /*goto*/ LABEL_PUNCH) if_jo_ccw_direction_gt(246, /*goto*/ LABEL_PUNCH) stop_chr - try_face_entity(0x0200, 0x0001, /*goto*/ 0x04) + try_face_entity(ENTITYTYPE_TARGET, 1, /*goto*/ 0x04) beginloop(0x04) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0xfa) @@ -3969,7 +3969,7 @@ u8 func0010_civilian_say_comment[] = { label(0x16) restart_timer dprint 'F','A','C','E',' ','T','A','R','G','E','T','\n',0, - try_face_entity(0x0200, 0x0000, /*goto*/ 0x04) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x04) // Wait until facing target, or a second has passed, or something else // happens such as hearing gunfire or seeing someone die. @@ -4166,7 +4166,7 @@ u8 func001b_observe_camspy[] = { label(0x13) set_target_chr(CHR_PRESET) restart_timer - try_face_entity(0x0200, 0x0000, /*goto*/ 0x03) + try_face_entity(ENTITYTYPE_TARGET, 0, /*goto*/ 0x03) // Wait 5 seconds. During this time: // - If the camspy moves away, exit the loop and follow it @@ -4221,9 +4221,9 @@ u8 func001b_observe_camspy[] = { // Shoot camspy label(0x09) set_self_chrflag(CHRCFLAG_00000040) - try_attack_stand1(0x0220, 0x0000, /*goto*/ 0x16) + try_attack_stand(ENTITYTYPE_TARGET | ENTITYTYPE_AIMONLY, 0, /*goto*/ 0x16) label(0x16) - try_attack_stand2(0x0200, 0x0000, /*goto*/ 0xc3) + try_modify_attack(ENTITYTYPE_TARGET, 0, /*goto*/ 0xc3) // Wait until shooting animation done beginloop(0xc3) diff --git a/src/include/commands.h b/src/include/commands.h index 7b9af342e..c03e8d76a 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -211,32 +211,50 @@ mkshort(0x0014), \ label, -#define try_attack_stand1(u1, u2, label) \ +/** + * Makes the chr attempt to do a standing attack. + * + * entity_type is expected to be an ENTITYTYPE constant. It can be bitwise ORed + * with ENTITYTYPE_AIMONLY to make the chr only aim at the entity. + */ +#define try_attack_stand(entity_type, entity_id, label) \ mkshort(0x0015), \ - mkshort(u1), \ - mkshort(u2), \ + mkshort(entity_type), \ + mkshort(entity_id), \ label, -#define try_attack_kneel(u1, u2, label) \ +/** + * Makes the chr attempt to do a kneeling attack. + * + * entity_type is expected to be an ENTITYTYPE constant. It can be bitwise ORed + * with ENTITYTYPE_AIMONLY to make the chr only aim at the entity. + */ +#define try_attack_kneel(entity_type, entity_id, label) \ mkshort(0x0016), \ - mkshort(u1), \ - mkshort(u2), \ + mkshort(entity_type), \ + mkshort(entity_id), \ label, -#define try_attack_stand2(u1, u2, label) \ +/** + * Modifies the target entity and the aim-only/shoot flag. + * + * This command can only be used after try_attack_stand, try_attack_kneel, + * try_attack_lie or try_face_entity. A common pattern is to use one of those + * commands with the ENTITYTYPE_AIMONLY flag to point the gun at the entity, and + * if the label was followed then call try_modify_attack to remove the + * ENTITYTYPE_AIMONLY flag, causing the chr to shoot. + */ +#define try_modify_attack(entity_type, entity_id, label) \ mkshort(0x0017), \ - mkshort(u1), \ - mkshort(u2), \ + mkshort(entity_type), \ + mkshort(entity_id), \ label, /** * 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. + * until stop_chr is used or a 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 + * entity_type is expected to be an ENTITYTYPE constant. */ #define try_face_entity(entity_type, entity_id, label) \ mkshort(0x0018), \ @@ -3635,11 +3653,16 @@ #define shuffle_pelagic_switches \ mkshort(0x01b9), -// Likely some kind of shoot command, with u1 = entitytype and u2 = entityid -#define try_attack_lie(u1, u2, label) \ +/** + * Makes the chr attempt to do a lying down attack. + * + * entity_type is expected to be an ENTITYTYPE constant. It can be bitwise ORed + * with ENTITYTYPE_AIMONLY to make the chr only aim at the entity. + */ +#define try_attack_lie(entity_type, entity_id, label) \ mkshort(0x01ba), \ - mkshort(u1), \ - mkshort(u2), \ + mkshort(entity_type), \ + mkshort(entity_id), \ label, #define noop01bb \ diff --git a/src/include/constants.h b/src/include/constants.h index 6d58c0e1a..c9b28f471 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -542,9 +542,12 @@ #define DRCAROLLIMAGE_RANDOM25 7 #define DRCAROLLIMAGE_RANDOM 8 +#define ENTITYTYPE_BOND 0x0001 +#define ENTITYTYPE_FORWARD 0x0002 #define ENTITYTYPE_CHR 0x0004 #define ENTITYTYPE_PAD 0x0008 #define ENTITYTYPE_DIRECTION 0x0010 +#define ENTITYTYPE_AIMONLY 0x0020 #define ENTITYTYPE_TARGET 0x0200 #define EYESPYMODE_CAMSPY 0 diff --git a/src/include/game/chr/chraction.h b/src/include/game/chr/chraction.h index e35edac5e..af1b31dca 100644 --- a/src/include/game/chr/chraction.h +++ b/src/include/game/chr/chraction.h @@ -27,7 +27,7 @@ void chrSurrenderStartAnim(struct chrdata *chr); void func0f02f8a4(struct chrdata *chr); void func0f02fc2c(struct chrdata *chr); void func0f02fe18(struct chrdata *chr); -void func0f030120(struct chrdata *chr, s32 entitytype, s32 entityid); +void chrAttackStand(struct chrdata *chr, s32 entitytype, s32 entityid); void chrAttackLie(struct chrdata *chr, s32 entitytype, s32 entityid); void chrAttackKneel(struct chrdata *chr, s32 entitytype, s32 entityid); u32 func0f030584(void); @@ -142,7 +142,7 @@ u32 func0f041d38(void); u32 func0f041e48(void); void chrTickAttackAmount(struct chrdata *chr); void func0f04279c(struct chrdata *chr, bool arg1, bool arg2); -void func0f042808(struct chrdata *chr); +void robotAttack(struct chrdata *chr); void chrTickRobotAttack(struct chrdata *chr); void chrTickAttack(struct chrdata *chr); void chrTickAttackRoll(struct chrdata *chr); @@ -230,10 +230,10 @@ bool func0f039368(struct chrdata *chr); void chrRecordLastSeeTargetTime(struct chrdata *chr); void chrRecordLastHearTargetTime(struct chrdata *chr); bool chrIsDead(struct chrdata *chr); -bool func0f03a578(struct chrdata *chr, s32 entitytype, s32 entityid); +bool chrTryAttackStand(struct chrdata *chr, s32 entitytype, s32 entityid); bool chrTryAttackKneel(struct chrdata *chr, s32 entitytype, s32 entityid); bool chrTryAttackLie(struct chrdata *chr, s32 entitytype, s32 entityid); -bool func0f03a76c(struct chrdata *chr, u32 entitytype, s32 entityid); +bool chrTryModifyAttack(struct chrdata *chr, u32 entitytype, s32 entityid); bool chrFaceEntity(struct chrdata *chr, u32 entitytype, u32 entityid); bool chrSetPath(struct chrdata *chr, u32 path_id); u32 chrStartPath(struct chrdata *chr); diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index 3165821dc..a4b138d4b 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -24,9 +24,9 @@ /*0x0012*/ bool aiTryAttackWalk(void); /*0x0013*/ bool aiTryAttackRun(void); /*0x0014*/ bool aiTryAttackRoll(void); -/*0x0015*/ bool aiTryAttackStand1(void); +/*0x0015*/ bool aiTryAttackStand(void); /*0x0016*/ bool aiTryAttackKneel(void); -/*0x0017*/ bool aiTryAttackStand2(void); +/*0x0017*/ bool aiTryModifyAttack(void); /*0x0018*/ bool aiFaceEntity(void); /*0x0019*/ bool ai0019(void); /*0x001a*/ bool ai001a(void); diff --git a/src/include/util.h b/src/include/util.h index e714b16f9..3fc15afb9 100644 --- a/src/include/util.h +++ b/src/include/util.h @@ -1,7 +1,7 @@ #ifndef _IN_UTIL_H #define _IN_UTIL_H -#define mkshort(val) (val >> 8) & 0xff, val & 0xff -#define mkword(val) (val >> 24) & 0xff, (val >> 16) & 0xff, (val >> 8) & 0xff, val & 0xff +#define mkshort(val) ((val) >> 8) & 0xff, (val) & 0xff +#define mkword(val) ((val) >> 24) & 0xff, ((val) >> 16) & 0xff, ((val) >> 8) & 0xff, (val) & 0xff #endif