From 314dd63eb1f518acb75f7ff7be7edaca8597186d Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 20 Jun 2020 17:18:15 +1000 Subject: [PATCH] Discover chrIsUsingLift and if_using_lift AI command --- src/game/chr/chraction.c | 2 +- src/game/chr/chrai.c | 2 +- src/game/chr/chraicommands.c | 4 ++-- src/include/commands.h | 6 +++++- src/include/game/chr/chraction.h | 2 +- src/include/game/chr/chraicommands.h | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 16cad7d9a..9c0b3d664 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -23829,7 +23829,7 @@ glabel func0f046648 /* f046a2c: 00000000 */ sll $zero,$zero,0x0 ); -s32 func0f046a30(struct chrdata *chr) +s32 chrIsUsingLift(struct chrdata *chr) { return (chr->actiontype == ACT_GOPOS || chr->actiontype == ACT_PATROL) && chr->liftaction > 0; } diff --git a/src/game/chr/chrai.c b/src/game/chr/chrai.c index a09cb0b38..a43b52d5a 100644 --- a/src/game/chr/chrai.c +++ b/src/game/chr/chrai.c @@ -439,7 +439,7 @@ bool (*g_CommandPointers[])(void) = { /*0x01a2*/ aiSayCiStaffQuip, /*0x01a3*/ aiDoPresetAnimation, /*0x01a4*/ aiShowHudmsgMiddle, - /*0x01a5*/ ai01a5, + /*0x01a5*/ aiIfUsingLift, /*0x01a6*/ aiIfTargetYDifferenceLessThan, /*0x01a7*/ aiIfChrPropsoundcountZero, /*0x01a8*/ NULL, diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 17b12057e..00a100a91 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -10357,11 +10357,11 @@ bool aiDoPresetAnimation(void) /** * @cmd 01a5 */ -bool ai01a5(void) +bool aiIfUsingLift(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - if (func0f046a30(g_Vars.chrdata)) { + if (chrIsUsingLift(g_Vars.chrdata)) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); } else { g_Vars.aioffset += 3; diff --git a/src/include/commands.h b/src/include/commands.h index dbdb786e3..a9a6847e0 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -3555,7 +3555,11 @@ color, \ mkshort(text), -#define cmd01a5(label) \ +/** + * Checks if the current chr is using a lift (most likely from the moment they + * call it until the moment the door opens at the end of the journey). + */ +#define if_using_lift(label) \ mkshort(0x01a5), \ label, diff --git a/src/include/game/chr/chraction.h b/src/include/game/chr/chraction.h index 851b4c7e1..6e4e94734 100644 --- a/src/include/game/chr/chraction.h +++ b/src/include/game/chr/chraction.h @@ -266,7 +266,7 @@ void unregisterDangerousProp(struct prop *prop); void registerDangerousProp(struct prop *prop); bool chrDetectDangerousObject(struct chrdata *chr, u8 flags); void chrTickBondDie(struct chrdata *chr); -s32 func0f046a30(struct chrdata *chr); +s32 chrIsUsingLift(struct chrdata *chr); bool chrTrySkJump(struct chrdata *chr, u8 arg1, u8 arg2, s32 arg3, u8 arg4); bool chrSawTargetRecently(struct chrdata *chr); bool chrHeardTargetRecently(struct chrdata *chr); diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index 1e8b6eca0..ee9b437d1 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -388,7 +388,7 @@ /*0x01a2*/ bool aiSayCiStaffQuip(void); /*0x01a3*/ bool aiDoPresetAnimation(void); /*0x01a4*/ bool aiShowHudmsgMiddle(void); -/*0x01a5*/ bool ai01a5(void); +/*0x01a5*/ bool aiIfUsingLift(void); /*0x01a6*/ bool aiIfTargetYDifferenceLessThan(void); /*0x01a7*/ bool aiIfChrPropsoundcountZero(void); /*0x01aa*/ bool ai01aa(void);