diff --git a/src/files/setup/setupark.c b/src/files/setup/setupark.c index d31a07ffe..315fadb23 100644 --- a/src/files/setup/setupark.c +++ b/src/files/setup/setupark.c @@ -961,7 +961,7 @@ u8 func0406_general_combat[] = { goto_next(0x5e) label(0x20) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x5e) + if_target_is_player(/*goto*/ 0x5e) goto_next(0x15) label(0x5e) @@ -979,7 +979,7 @@ u8 func0406_general_combat[] = { goto_next(0x5e) label(0x20) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x5e) + if_target_is_player(/*goto*/ 0x5e) goto_next(0x15) label(0x5e) @@ -1079,7 +1079,7 @@ u8 func0406_general_combat[] = { label(0x2a) label(0x20) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x20) + if_target_is_player(/*goto*/ 0x20) set_shotlist(GFUNC_COMBAT_WITH_TARGET) set_returnlist(CHR_SELF, GFUNC_COMBAT_WITH_TARGET) set_ailist(CHR_SELF, GFUNC_COMBAT_WITH_TARGET) diff --git a/src/files/setup/setupcave.c b/src/files/setup/setupcave.c index d2d58ffab..88da43592 100644 --- a/src/files/setup/setupcave.c +++ b/src/files/setup/setupcave.c @@ -1348,7 +1348,7 @@ u8 func0406_become_unalerted[] = { set_ailist(CHR_SELF, GFUNC_UNALERTED) label(0x02) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x02) + if_target_is_player(/*goto*/ 0x02) if_chr_dying(CHR_TARGET, /*goto*/ 0x02) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0x02) if_chr_unloaded(CHR_TARGET, /*goto*/ 0x02) diff --git a/src/files/setup/setupdam.c b/src/files/setup/setupdam.c index c98f48565..5e11fa819 100644 --- a/src/files/setup/setupdam.c +++ b/src/files/setup/setupdam.c @@ -2193,7 +2193,7 @@ u8 func0404_angry_pilot[] = { // Got target (other pilot or Jo) label(0x00) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x07) + if_target_is_player(/*goto*/ 0x07) goto_next(0x04) label(0x07) set_shotlist(GFUNC_ALERTED) diff --git a/src/files/setup/setupdish.c b/src/files/setup/setupdish.c index c26676a36..f1a69a397 100644 --- a/src/files/setup/setupdish.c +++ b/src/files/setup/setupdish.c @@ -5157,7 +5157,7 @@ u8 func0416_holo_guard_unarmed_alert2[] = { if_chr_unloaded(CHR_TARGET, /*goto*/ 0x57) if_timer_gt(20, /*goto*/ 0x10) if_chr_stopped(/*goto*/ 0x10) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x0e) + if_target_is_player(/*goto*/ 0x0e) label(0x0e) if_chr_distance_gt(400, /*goto*/ 0x10) if_chr_distance_lt(100, /*goto*/ 0x06) diff --git a/src/files/setup/setuppam.c b/src/files/setup/setuppam.c index 8c4d82796..3416c99b9 100644 --- a/src/files/setup/setuppam.c +++ b/src/files/setup/setuppam.c @@ -3172,7 +3172,7 @@ u8 func041d_sniper[] = { label(0x2e) set_target_chr(CHR_P1P2) label(0x2f) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x2f) + if_target_is_player(/*goto*/ 0x2f) goto_next(0x2e) label(0x2f) @@ -3198,7 +3198,7 @@ u8 func041d_sniper[] = { goto_next(0x06) // Unreachable - if_chr_lost_track_of_target_maybe(/*goto*/ 0x2e) + if_target_is_player(/*goto*/ 0x2e) goto_next(0x06) label(0x2e) @@ -3225,7 +3225,7 @@ u8 func041d_sniper[] = { endloop(0x0b) label(0x0c) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x2e) + if_target_is_player(/*goto*/ 0x2e) goto_next(0x06) label(0x2e) @@ -4353,7 +4353,7 @@ u8 func042e_elvis_run_to_exit[] = { label(0x06) restart_timer label(0x08) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x06) + if_target_is_player(/*goto*/ 0x06) goto_next(0x2e) label(0x06) goto_first(0x1f) diff --git a/src/files/setup/setuprit.c b/src/files/setup/setuprit.c index f076104f5..8e88b47a8 100644 --- a/src/files/setup/setuprit.c +++ b/src/files/setup/setuprit.c @@ -846,7 +846,7 @@ u8 func0403_stripes[] = { // Got target label(0x06) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x06) + if_target_is_player(/*goto*/ 0x06) if_chr_dying(CHR_TARGET, /*goto*/ 0x2d) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0x2d) if_chr_unloaded(CHR_TARGET, /*goto*/ 0x2d) @@ -1642,7 +1642,7 @@ u8 func0409_unused[] = { reloop(0x04) label(0x06) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x06) + if_target_is_player(/*goto*/ 0x06) if_chr_dying(CHR_TARGET, /*goto*/ 0x2d) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0x2d) if_chr_unloaded(CHR_TARGET, /*goto*/ 0x2d) @@ -1685,7 +1685,7 @@ u8 func100c_cockpit_stripes[] = { reloop(0x04) label(0x06) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x06) + if_target_is_player(/*goto*/ 0x06) if_chr_dying(CHR_TARGET, /*goto*/ 0x2d) if_chr_death_animation_finished(CHR_TARGET, /*goto*/ 0x2d) if_chr_unloaded(CHR_TARGET, /*goto*/ 0x2d) @@ -1779,7 +1779,7 @@ u8 func0413_taker[] = { endloop(0x09) label(0x2d) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x11) + if_target_is_player(/*goto*/ 0x11) if_target_chrs_target_is_different(/*goto*/ 0x2d) goto_next(0x11) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 9fe7bce25..126900f6a 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -12272,7 +12272,7 @@ bool aiPunchOrKick(void) /** * @cmd 0183 */ -bool ai0183(void) +bool aiIfTargetIsPlayer(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; struct prop *target = chrGetTargetProp(g_Vars.chrdata); diff --git a/src/include/commands.h b/src/include/commands.h index f764af3c9..21b80d18a 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -1919,8 +1919,7 @@ 0x00, \ label, -// In practice, scripts will assign function unalerted guard if this passes -#define if_chr_lost_track_of_target_maybe(label) \ +#define if_target_is_player(label) \ mkshort(0x0183), \ label, diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index 748c2a3b8..0bb5cbabb 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -364,7 +364,7 @@ /*0x0180*/ bool aiAudioRestartSfx(void); /*0x0181*/ bool aiIfPlayerLookingAtObject(void); /*0x0182*/ bool aiPunchOrKick(void); -/*0x0183*/ bool ai0183(void); +/*0x0183*/ bool aiIfTargetIsPlayer(void); /*0x0184*/ bool ai0184(void); /*0x0185*/ bool ai0185(void); /*0x0186*/ bool aiIfSoundTimer(void); diff --git a/src/setup/ailists.c b/src/setup/ailists.c index 545897bda..c66b7c981 100644 --- a/src/setup/ailists.c +++ b/src/setup/ailists.c @@ -173,7 +173,7 @@ u8 func0006_unalerted[] = { label(0x13) dprint 'A','I','V','S','A','I','P','A','S','S','\n',0, - if_chr_lost_track_of_target_maybe(/*goto*/ LABEL_AIVSAIFAIL) + if_target_is_player(/*goto*/ LABEL_AIVSAIFAIL) goto_next(0x12) // Check see and hear @@ -1221,7 +1221,7 @@ u8 func0007_alerted[] = { endloop(0xa2) label(0xee) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x13) + if_target_is_player(/*goto*/ 0x13) set_returnlist(CHR_SELF, GFUNC_COMBAT_WITH_TARGET) set_ailist(CHR_SELF, GFUNC_COMBAT_WITH_TARGET) @@ -2199,7 +2199,7 @@ u8 func0007_alerted[] = { goto_next(0x13) label(0x16) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x13) + if_target_is_player(/*goto*/ 0x13) set_returnlist(CHR_SELF, GFUNC_UNALERTED) set_ailist(CHR_SELF, GFUNC_COMBAT_WITH_TARGET) @@ -2842,7 +2842,7 @@ u8 func000c_combat_with_target_chr[] = { dprint 'S','E','E',' ','E','N','E','M','Y','\n',0, if_num_human_players_lt(2, /*goto*/ 0x16) label(0x13) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x13) + if_target_is_player(/*goto*/ 0x13) goto_next(0x16) label(0x13) @@ -2882,7 +2882,7 @@ u8 func000c_combat_with_target_chr[] = { // Solo mode, or co-op/counter-op on any other stage label(0x13) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x13) + if_target_is_player(/*goto*/ 0x13) goto_next(0x16) label(0x13) @@ -2975,7 +2975,7 @@ u8 func000c_combat_with_target_chr[] = { label(0xb3) if_chr_is_skedar(CHR_SELF, /*goto*/ 0x16) label(0x13) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x13) + if_target_is_player(/*goto*/ 0x13) goto_next(0x16) label(0x13) @@ -3256,7 +3256,7 @@ u8 func000c_combat_with_target_chr[] = { label(0x16) dprint 'B','O','N','N','D',' ','3','\n',0, if_self_flag_bankx_eq(CHRFLAG1_00000800, FALSE, BANK_1, /*goto*/ 0x13) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x13) + if_target_is_player(/*goto*/ 0x13) damage_chr(CHR_TARGET, 18) unset_self_flag_bankx(CHRFLAG1_00000800, BANK_1) label(0x13) @@ -3437,7 +3437,7 @@ u8 func000c_combat_with_target_chr[] = { label(0xcf) if_self_flag_bankx_eq(CHRFLAG0_10000000, FALSE, BANK_0, /*goto*/ 0x13) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x16) + if_target_is_player(/*goto*/ 0x16) goto_next(0x13) label(0x16) @@ -3810,7 +3810,7 @@ u8 func000f_hand_combat[] = { goto_first(0x0c) label(0x13) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x0a) + 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) label(0x13) @@ -3832,7 +3832,7 @@ u8 func000f_hand_combat[] = { if_chr_unloaded(CHR_TARGET, /*goto*/ 0xfa) label(0x13) if_timer_gt(90, /*goto*/ 0x0b) - if_chr_lost_track_of_target_maybe(/*goto*/ 0x09) + 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) label(0x13) @@ -4249,7 +4249,7 @@ u8 func001b_observe_camspy[] = { label(0x16) dprint 'E','6','\n',0, - if_chr_lost_track_of_target_maybe(/*goto*/ 0x13) + if_target_is_player(/*goto*/ 0x13) dprint 'E','7','\n',0, goto_first(0x09) diff --git a/src/setup/setup_000000.c b/src/setup/setup_000000.c index 0b020fac4..5c51e74e9 100644 --- a/src/setup/setup_000000.c +++ b/src/setup/setup_000000.c @@ -14519,7 +14519,7 @@ bool (*g_CommandPointers[])(void) = { /*0x0180*/ aiAudioRestartSfx, /*0x0181*/ aiIfPlayerLookingAtObject, /*0x0182*/ aiPunchOrKick, - /*0x0183*/ ai0183, + /*0x0183*/ aiIfTargetIsPlayer, /*0x0184*/ ai0184, /*0x0185*/ ai0185, /*0x0186*/ aiIfSoundTimer,