diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 69c9cfe85..faf4be790 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -12164,7 +12164,7 @@ bool aiIfLiftStationary(void) if (obj && obj->prop && obj->type == OBJTYPE_LIFT) { struct liftobj *lift = (struct liftobj *)obj; - if ((obj->flags & OBJFLAG_DEACTIVATED) || !lift->unk74) { + if ((obj->flags & OBJFLAG_DEACTIVATED) || lift->dist == 0) { pass = true; } } @@ -12199,7 +12199,7 @@ bool ai0189(void) * @cmd 018a */ GLOBAL_ASM( -glabel ai018a +glabel aiIfLiftAtStop /* f05d30c: 3c03800a */ lui $v1,%hi(g_Vars) /* f05d310: 24639fc0 */ addiu $v1,$v1,%lo(g_Vars) /* f05d314: 8c6e0434 */ lw $t6,0x434($v1) @@ -12256,6 +12256,30 @@ glabel ai018a /* f05d3d4: 00000000 */ sll $zero,$zero,0x0 ); +// Mismatch because the load order of lift->levelcur and cmd[3] are swapped +//bool aiIfLiftAtStop(void) +//{ +// u8 *cmd = g_Vars.ailist + g_Vars.aioffset; +// struct defaultobj *obj = objFindByTagId(cmd[2]); +// bool pass = false; +// +// if (obj && obj->prop && obj->type == OBJTYPE_LIFT) { +// struct liftobj *lift = (struct liftobj *)obj; +// +// if (lift->levelcur == cmd[3] && lift->dist == 0) { +// pass = true; +// } +// } +// +// if (pass) { +// g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[4]); +// } else { +// g_Vars.aioffset += 5; +// } +// +// return false; +//} + /** * @cmd 018b */ diff --git a/src/game/data/data_0083d0.c b/src/game/data/data_0083d0.c index 5820dd9ea..72ced1bf3 100644 --- a/src/game/data/data_0083d0.c +++ b/src/game/data/data_0083d0.c @@ -6613,7 +6613,7 @@ bool (*g_CommandPointers[])(void) = { /*0x0187*/ ai0187, /*0x0188*/ aiIfLiftStationary, /*0x0189*/ ai0189, - /*0x018a*/ ai018a, + /*0x018a*/ aiIfLiftAtStop, /*0x018b*/ aiConfigureRain, /*0x018c*/ aiChrToggleProp, /*0x018d*/ aiActivateLift, diff --git a/src/include/commands.h b/src/include/commands.h index 405623780..4a2e963b9 100644 --- a/src/include/commands.h +++ b/src/include/commands.h @@ -3155,10 +3155,13 @@ lift, \ u1, -#define cmd018a(object, u1, label) \ +/** + * Checks if the lift is stopped at the given stop number. + */ +#define if_lift_at_stop(lift, stopnum, label) \ mkshort(0x018a), \ - object, \ - u1, \ + lift, \ + stopnum, \ label, /** diff --git a/src/include/game/chr/chraicommands.h b/src/include/game/chr/chraicommands.h index b43b47642..566bc1a2d 100644 --- a/src/include/game/chr/chraicommands.h +++ b/src/include/game/chr/chraicommands.h @@ -371,7 +371,7 @@ /*0x0187*/ bool ai0187(void); /*0x0188*/ bool aiIfLiftStationary(void); /*0x0189*/ bool ai0189(void); -/*0x018a*/ bool ai018a(void); +/*0x018a*/ bool aiIfLiftAtStop(void); /*0x018b*/ bool aiConfigureRain(void); /*0x018c*/ bool aiChrToggleProp(void); /*0x018d*/ bool aiActivateLift(void); diff --git a/src/include/types.h b/src/include/types.h index 462487b35..cf04a0cfa 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -839,13 +839,20 @@ struct heliobj { struct liftobj { // objtype 30 struct defaultobj base; - /*0x5c*/ u32 unk5c; + /*0x5c*/ u32 pad; /*0x60*/ u32 unk60; /*0x64*/ u32 unk64; /*0x68*/ u32 unk68; /*0x6c*/ u32 unk6c; /*0x70*/ u32 unk70; - /*0x74*/ f32 unk74; + /*0x74*/ f32 dist; + /*0x78*/ u32 speed; + /*0x7c*/ u32 accel; + /*0x80*/ u32 maxspeed; + /*0x84*/ u8 soundtype; + /*0x85*/ s8 levelcur; + /*0x85*/ s8 levelaim; + /*0x88*/ struct coord prevpos; }; struct hovercarobj {