Discover if_lift_at_stop AI command and attempt to decompile aiIfLiftAtStop

This commit is contained in:
Ryan Dwyer 2020-02-09 12:26:24 +10:00
parent 046877a518
commit b76d35c1b3
5 changed files with 43 additions and 9 deletions

View File

@ -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
*/

View File

@ -6613,7 +6613,7 @@ bool (*g_CommandPointers[])(void) = {
/*0x0187*/ ai0187,
/*0x0188*/ aiIfLiftStationary,
/*0x0189*/ ai0189,
/*0x018a*/ ai018a,
/*0x018a*/ aiIfLiftAtStop,
/*0x018b*/ aiConfigureRain,
/*0x018c*/ aiChrToggleProp,
/*0x018d*/ aiActivateLift,

View File

@ -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,
/**

View File

@ -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);

View File

@ -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 {