From 1fbd8ec44ebf3fd74ed13ff4bd8b59b18cbc4153 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 29 May 2020 19:47:07 +1000 Subject: [PATCH] Rename command 0039 to if_can_hear_alarm --- src/files/setup/setupcave.c | 2 +- src/game/chr/chraction.c | 2 +- src/game/chr/chrai.c | 2 +- src/game/chr/chraicommands.c | 4 ++-- src/include/commands.h | 8 +++++--- src/include/game/chr/chraction.h | 2 +- src/include/game/chr/chraicommands.h | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/files/setup/setupcave.c b/src/files/setup/setupcave.c index 948a167f3..07b56b0df 100644 --- a/src/files/setup/setupcave.c +++ b/src/files/setup/setupcave.c @@ -1520,7 +1520,7 @@ u8 func0408_secretary[] = { set_view_distance(14) if_alertness(99, OPERATOR_GREATER_THAN, /*goto*/ LABEL_BECOME_ALERT1) if_target_in_sight(/*goto*/ 0x02) - if_alarm_active2(/*goto*/ 0x67) + if_can_hear_alarm(/*goto*/ 0x67) endloop(LABEL_MAIN_LOOP) // Joanna within 14 units (?) of distance diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 5f007911d..5c5dfb54f 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -28200,7 +28200,7 @@ void incrementByte(u8 *dst, u8 amount) *dst += amount; } -bool func0f04a2b4(struct chrdata *chr) +bool chrCanHearAlarm(struct chrdata *chr) { return alarmIsActive(); } diff --git a/src/game/chr/chrai.c b/src/game/chr/chrai.c index 4202f596d..65eab935f 100644 --- a/src/game/chr/chrai.c +++ b/src/game/chr/chrai.c @@ -75,7 +75,7 @@ bool (*g_CommandPointers[])(void) = { /*0x0036*/ aiRandom, /*0x0037*/ aiIfRandomLessThan, /*0x0038*/ aiIfRandomGreaterThan, - /*0x0039*/ aiIfChrAlarmActivate, + /*0x0039*/ aiIfCanHearAlarm, /*0x003a*/ aiIfAlarmActive, /*0x003b*/ aiIfAlarmInactive, /*0x003c*/ ai003c, diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 84c76f883..f4a6f068d 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -1234,9 +1234,9 @@ bool aiStartPath(void) /** * @cmd 0039 */ -bool aiIfChrAlarmActivate(void) +bool aiIfCanHearAlarm(void) { - if (func0f04a2b4(g_Vars.chrdata)) { + if (chrCanHearAlarm(g_Vars.chrdata)) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); } else { diff --git a/src/include/commands.h b/src/include/commands.h index 7c0f99289..f2aa39e8b 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -521,10 +521,12 @@ label, /** - * Checks if the alarm is currently sounding. Not sure how this differs from - * if_alarm_active. + * Checks if the alarm is currently sounding. + * + * This is functionally the same as if_alarm_active, but during development may + * have contained extra per-chr checks such as chr flags and distance. */ -#define if_alarm_active2(label) \ +#define if_can_hear_alarm(label) \ mkshort(0x0039), \ label, diff --git a/src/include/game/chr/chraction.h b/src/include/game/chr/chraction.h index 1abc8d4be..dc3a27d6a 100644 --- a/src/include/game/chr/chraction.h +++ b/src/include/game/chr/chraction.h @@ -304,7 +304,7 @@ s32 chrGetNumArghs(struct chrdata *chr); s32 chrGetNumCloseArghs(struct chrdata *chr); void decrementByte(u8 *dst, u8 amount); void incrementByte(u8 *dst, u8 amount); -bool func0f04a2b4(struct chrdata *chr); +bool chrCanHearAlarm(struct chrdata *chr); bool func0f04a76c(struct chrdata *chr, f32 distance); bool func0f04a79c(u8 chrnum, struct chrdata *chr, f32 distance); bool chrCompareTeams(struct chrdata *chr1, struct chrdata *chr2, u8 checktype); diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index 61211ea31..d563b34b9 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -60,7 +60,7 @@ /*0x0036*/ bool aiRandom(void); /*0x0037*/ bool aiIfRandomLessThan(void); /*0x0038*/ bool aiIfRandomGreaterThan(void); -/*0x0039*/ bool aiIfChrAlarmActivate(void); +/*0x0039*/ bool aiIfCanHearAlarm(void); /*0x003a*/ bool aiIfAlarmActive(void); /*0x003b*/ bool aiIfAlarmInactive(void); /*0x003c*/ bool ai003c(void);