From 8fac472e9219b18bfa8cc89a97093c5f9198a0a6 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 26 Nov 2019 23:10:08 +1000 Subject: [PATCH] Discover aiIfPlayerUsingCmpOrAr34 --- src/game/chr/chraicommands.c | 6 +++--- src/include/commands.h | 5 +---- src/include/game/chr/chraicommands.h | 2 +- src/setup/ailists.c | 6 +++--- src/setup/setup_000000.c | 2 +- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 74cc580b6..22d9245de 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -10307,14 +10307,14 @@ bool ai0125(void) /** * @cmd 0126 */ -bool ai0126(void) +bool aiIfPlayerUsingCmpOrAr34(void) { u32 arg = 0; u8 *cmd = g_Vars.ailist + g_Vars.aioffset; switch (getCurrentPlayerWeaponId(arg)) { - case 10: - case 17: + case WEAPON_CMP150: + case WEAPON_AR34: g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); break; default: diff --git a/src/include/commands.h b/src/include/commands.h index 64cbdee6d..29343a074 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -1185,10 +1185,7 @@ mkshort(0x0125), \ label, -// Looks at the first element in some struct array, -// and checks if field 0x640 is nonzero. -// globals.s only -#define cmd0126_if_something(label) \ +#define if_player_using_cmp150_or_ar34(label) \ mkshort(0x0126), \ label, diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index 3c8b5b98b..196a0e796 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -294,7 +294,7 @@ /*0x0123*/ bool ai0123(void); /*0x0124*/ bool ai0124(void); /*0x0125*/ bool ai0125(void); -/*0x0126*/ bool ai0126(void); +/*0x0126*/ bool aiIfPlayerUsingCmpOrAr34(void); /*0x0127*/ bool ai0127(void); /*0x0128*/ bool ai0128(void); /*0x0129*/ bool ai0129(void); diff --git a/src/setup/ailists.c b/src/setup/ailists.c index c81552feb..a81af3b05 100644 --- a/src/setup/ailists.c +++ b/src/setup/ailists.c @@ -1436,7 +1436,7 @@ u8 func0007_alerted[] = { if_within_units_of_sight(30, /*goto*/ 0x5f) label(0x16) if_within_units_of_sight(30, /*goto*/ 0x16) - cmd0126_if_something(/*goto*/ 0x69) + if_player_using_cmp150_or_ar34(/*goto*/ 0x69) if_chr_distance_gt(2000, /*goto*/ 0x61) goto_next(0x16) @@ -1549,7 +1549,7 @@ u8 func0007_alerted[] = { goto_next(0x16) label(0x66) - cmd0126_if_something(/*goto*/ 0x69) + if_player_using_cmp150_or_ar34(/*goto*/ 0x69) if_chr_distance_gt(2000, /*goto*/ 0x16) goto_next(0x6a) @@ -1572,7 +1572,7 @@ u8 func0007_alerted[] = { beginloop(0x62) cmd013d_if_grenade_thrown_nearby_maybe(ACTION_GRENADE_STOP, /*goto*/ LABEL_FLEE_GRENADE) if_in_disarm_range(/*goto*/ 0x5f) - cmd0126_if_something(/*goto*/ 0x69) + if_player_using_cmp150_or_ar34(/*goto*/ 0x69) if_chr_distance_gt(2000, /*goto*/ 0x65) goto_next(0x16) diff --git a/src/setup/setup_000000.c b/src/setup/setup_000000.c index fab047cdc..f564c5960 100644 --- a/src/setup/setup_000000.c +++ b/src/setup/setup_000000.c @@ -14426,7 +14426,7 @@ bool (*g_CommandPointers[])(void) = { /*0x0123*/ ai0123, /*0x0124*/ ai0124, /*0x0125*/ ai0125, - /*0x0126*/ ai0126, + /*0x0126*/ aiIfPlayerUsingCmpOrAr34, /*0x0127*/ ai0127, /*0x0128*/ ai0128, /*0x0129*/ ai0129,