diff --git a/src/files/setup/setupame.c b/src/files/setup/setupame.c index 5dbaf4063..158dafb5f 100644 --- a/src/files/setup/setupame.c +++ b/src/files/setup/setupame.c @@ -1688,7 +1688,7 @@ u8 func0414_programmer[] = { if_near_miss(/*goto*/ 0x96) if_saw_injury(0x00, /*goto*/ 0x96) if_saw_death(0x00, /*goto*/ 0x96) - if_hears_gunfire(/*goto*/ 0x96) + if_hears_target(/*goto*/ 0x96) if_stage_flag_eq(STAGEFLAG_PROGRAMMER_RAN_TO_GUARD, TRUE, /*goto*/ 0x2c) if_sees_suspicious_item(/*goto*/ 0x96) label(0x2c) diff --git a/src/files/setup/setuppete.c b/src/files/setup/setuppete.c index fad5cc54d..811badc11 100644 --- a/src/files/setup/setuppete.c +++ b/src/files/setup/setuppete.c @@ -1831,7 +1831,7 @@ u8 func041d_fbi[] = { if_target_in_sight(/*goto*/ 0x18) if_near_miss(/*goto*/ 0x18) if_num_times_shot_gt(0, /*goto*/ 0x18) - if_hears_gunfire(/*goto*/ 0x16) + if_hears_target(/*goto*/ 0x16) if_saw_injury(0x00, /*goto*/ 0x16) if_saw_death(0x00, /*goto*/ 0x16) if_sees_suspicious_item(/*goto*/ 0x16) @@ -2106,7 +2106,7 @@ u8 func041e_sealer1[] = { if_target_in_sight(/*goto*/ LABEL_ALERTED) if_near_miss(/*goto*/ LABEL_ALERTED) if_num_times_shot_gt(0, /*goto*/ LABEL_ALERTED) - if_hears_gunfire(/*goto*/ LABEL_ALERTED) + if_hears_target(/*goto*/ LABEL_ALERTED) if_saw_injury(0x00, /*goto*/ LABEL_ALERTED) if_saw_death(0x00, /*goto*/ LABEL_ALERTED) if_sees_suspicious_item(/*goto*/ LABEL_ALERTED) diff --git a/src/files/setup/setuprit.c b/src/files/setup/setuprit.c index 6b041d7b4..8b03337dd 100644 --- a/src/files/setup/setuprit.c +++ b/src/files/setup/setuprit.c @@ -1236,7 +1236,7 @@ u8 func0405_president_in_room[] = { label(0x2d) if_saw_injury(0x00, /*goto*/ 0x86) - if_hears_gunfire(/*goto*/ 0x86) + if_hears_target(/*goto*/ 0x86) if_timer_lt(120, /*goto*/ 0x2d) if_chr_in_view(/*goto*/ 0x06) label(0x2d) @@ -1259,7 +1259,7 @@ u8 func0405_president_in_room[] = { label(0x2d) if_saw_injury(0x00, /*goto*/ 0x86) - if_hears_gunfire(/*goto*/ 0x86) + if_hears_target(/*goto*/ 0x86) if_timer_lt(240, /*goto*/ 0x2d) if_chr_in_view(/*goto*/ 0x06) label(0x2d) @@ -1279,7 +1279,7 @@ u8 func0405_president_in_room[] = { label(0x2d) if_saw_injury(0x00, /*goto*/ 0x86) - if_hears_gunfire(/*goto*/ 0x86) + if_hears_target(/*goto*/ 0x86) if_timer_lt(400, /*goto*/ 0x2d) goto_next(0x84) @@ -1352,7 +1352,7 @@ u8 func0405_president_in_room[] = { label(0x2d) if_saw_injury(0x00, /*goto*/ 0x86) - if_hears_gunfire(/*goto*/ 0x86) + if_hears_target(/*goto*/ 0x86) if_sound_finished(CHANNEL_6, /*goto*/ 0x06) goto_first(0x0b) @@ -1370,7 +1370,7 @@ u8 func0405_president_in_room[] = { label(0x2d) if_saw_injury(0x00, /*goto*/ 0x86) - if_hears_gunfire(/*goto*/ 0x86) + if_hears_target(/*goto*/ 0x86) if_timer_gt(400, /*goto*/ 0x06) endloop(0x7a) diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 5c5dfb54f..37762f05e 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -12401,7 +12401,7 @@ void chrRecordLastSeeTargetTime(struct chrdata *chr) void chrRecordLastHearTargetTime(struct chrdata *chr) { - chr->hidden |= CHRHFLAG_00000002; + chr->hidden |= CHRHFLAG_IS_HEARING_TARGET; chr->lastheartarget60 = g_Vars.lvframe60; } @@ -26449,7 +26449,7 @@ void chrTick(struct chrdata *chr) } } - chr->hidden &= ~CHRHFLAG_00000002; + chr->hidden &= ~CHRHFLAG_IS_HEARING_TARGET; chr->hidden2 &= ~CHRH2FLAG_0040; if (pass) { @@ -28022,9 +28022,9 @@ bool chrHasStageFlag(struct chrdata *chr, u32 flag) return (g_StageFlags & flag) != 0; } -bool chrHasHiddenFlag00000002(struct chrdata *chr) +bool chrIsHearingTarget(struct chrdata *chr) { - return (chr->hidden & CHRHFLAG_00000002) != 0; + return (chr->hidden & CHRHFLAG_IS_HEARING_TARGET) != 0; } void chrRestartTimer(struct chrdata *chr) diff --git a/src/game/chr/chrai.c b/src/game/chr/chrai.c index 455685432..24a916406 100644 --- a/src/game/chr/chrai.c +++ b/src/game/chr/chrai.c @@ -78,7 +78,7 @@ bool (*g_CommandPointers[])(void) = { /*0x0039*/ aiIfCanHearAlarm, /*0x003a*/ aiIfAlarmActive, /*0x003b*/ ai003b, - /*0x003c*/ ai003c, + /*0x003c*/ aiIfHearsTarget, /*0x003d*/ aiIfSawInjury, /*0x003e*/ aiIfSawDeath, /*0x003f*/ aiIfSeesPlayer, diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 81b1327e0..97e43c88c 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -1293,14 +1293,11 @@ bool ai003b(void) } /** - * Either a check if chr is alerted or a check if they can hear gunfire. - * Probably the latter. - * * @cmd 003c */ -bool ai003c(void) +bool aiIfHearsTarget(void) { - if (chrHasHiddenFlag00000002(g_Vars.chrdata)) { + if (chrIsHearingTarget(g_Vars.chrdata)) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); } else { @@ -6297,7 +6294,7 @@ bool aiSetTarget(void) g_Vars.chrdata->lastvisibletarget60 = 0; g_Vars.chrdata->lastseetarget60 = 0; g_Vars.chrdata->lastheartarget60 = 0; - g_Vars.chrdata->hidden &= ~CHRHFLAG_00000002; + g_Vars.chrdata->hidden &= ~CHRHFLAG_IS_HEARING_TARGET; g_Vars.chrdata->chrflags &= ~CHRCFLAG_NEAR_MISS; g_Vars.chrdata->target = prop_id; } diff --git a/src/game/data/ailists.c b/src/game/data/ailists.c index c48432f78..0ab1134be 100644 --- a/src/game/data/ailists.c +++ b/src/game/data/ailists.c @@ -564,7 +564,7 @@ u8 func0006_unalerted[] = { set_hear_distance(10000) chr_toggle_p1p2(CHR_SELF) set_target_chr(CHR_P1P2) - if_hears_gunfire(/*goto*/ 0x16) + if_hears_target(/*goto*/ 0x16) if_player_looking_at_something_maybe(0x00, 0x00, 0x01, /*goto*/ 0x13) if_target_in_sight(/*goto*/ 0x17) label(0x13) @@ -4392,7 +4392,7 @@ u8 func001d_search_for_player[] = { dprint '1','\n',0, if_chr_stopped(/*goto*/ 0x16) dprint '1','\n',0, - if_hears_gunfire(/*goto*/ 0x12) + if_hears_target(/*goto*/ 0x12) dprint '1','\n',0, if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ 0x12) dprint '1','\n',0, diff --git a/src/include/commands.h b/src/include/commands.h index b88dc5073..68798c3c6 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -542,9 +542,9 @@ label, /** - * Checks if the chr has heard gunfire. + * Checks if the chr has heard their target (eg. due to gunfire). */ -#define if_hears_gunfire(label) \ +#define if_hears_target(label) \ mkshort(0x003c), \ label, diff --git a/src/include/constants.h b/src/include/constants.h index cd3e742bf..270b0f6bd 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -354,7 +354,7 @@ // chr->hidden #define CHRHFLAG_00000001 0x00000001 // Set when chr drops weapon -#define CHRHFLAG_00000002 0x00000002 // Not used in scripts +#define CHRHFLAG_IS_HEARING_TARGET 0x00000002 // Not used in scripts #define CHRHFLAG_00000004 0x00000004 // Related to firing - hand 1 #define CHRHFLAG_00000008 0x00000008 // Related to firing - hand 0 #define CHRHFLAG_00000010 0x00000010 // Not used in scripts diff --git a/src/include/game/chr/chraction.h b/src/include/game/chr/chraction.h index dc3a27d6a..91ebc9145 100644 --- a/src/include/game/chr/chraction.h +++ b/src/include/game/chr/chraction.h @@ -297,7 +297,7 @@ bool chrHasFlagById(struct chrdata *ref, u32 chrnum, u32 flag, u32 bank); void chrSetStageFlag(struct chrdata *chr, u32 flag); void chrUnsetStageFlag(struct chrdata *chr, u32 flag); bool chrHasStageFlag(struct chrdata *chr, u32 flag); -bool chrHasHiddenFlag00000002(struct chrdata *chr); +bool chrIsHearingTarget(struct chrdata *chr); void chrRestartTimer(struct chrdata *chr); u32 chrResetNearMiss(struct chrdata *chr); s32 chrGetNumArghs(struct chrdata *chr); diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index e8088ff4a..c35f20e4c 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -63,7 +63,7 @@ /*0x0039*/ bool aiIfCanHearAlarm(void); /*0x003a*/ bool aiIfAlarmActive(void); /*0x003b*/ bool ai003b(void); -/*0x003c*/ bool ai003c(void); +/*0x003c*/ bool aiIfHearsTarget(void); /*0x003d*/ bool aiIfSawInjury(void); /*0x003e*/ bool aiIfSawDeath(void); /*0x003f*/ bool aiIfSeesPlayer(void);