diff --git a/src/game/chr/chrai.c b/src/game/chr/chrai.c index f8d4198cf..294c63613 100644 --- a/src/game/chr/chrai.c +++ b/src/game/chr/chrai.c @@ -404,7 +404,7 @@ glabel chraiExecute // g_Vars.chrdata = NULL; // g_Vars.objdata = NULL; // g_Vars.aicdata = NULL; -// g_Vars.aiddata = NULL; +// g_Vars.hovdata = NULL; // g_Vars.ailist = NULL; // g_Vars.aioffset = 0; // @@ -418,7 +418,7 @@ glabel chraiExecute // } else if (obj->type == 0x28) { // g_Vars.aicdata = entity; // } else if (obj->type == OBJTYPE_HOVERVEHICLE || obj->type == OBJTYPE_ARMEDVEHICLE) { -// g_Vars.aiddata = entity; +// g_Vars.hovdata = entity; // } // } // @@ -431,9 +431,9 @@ glabel chraiExecute // } else if (g_Vars.aicdata) { // g_Vars.ailist = g_Vars.aicdata->ailist; // g_Vars.aioffset = g_Vars.aicdata->aioffset; -// } else if (g_Vars.aiddata) { -// g_Vars.ailist = g_Vars.aiddata->ailist; -// g_Vars.aioffset = g_Vars.aiddata->aioffset; +// } else if (g_Vars.hovdata) { +// g_Vars.ailist = g_Vars.hovdata->ailist; +// g_Vars.aioffset = g_Vars.hovdata->aioffset; // } // // if (g_Vars.ailist) { diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index 6a4fa8cda..4ecae5e12 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -55,9 +55,9 @@ bool aiYield(void) } else if (g_Vars.aicdata) { g_Vars.aicdata->ailist = g_Vars.ailist; g_Vars.aicdata->aioffset = g_Vars.aioffset; - } else if (g_Vars.aiddata) { - g_Vars.aiddata->ailist = g_Vars.ailist; - g_Vars.aiddata->aioffset = g_Vars.aioffset; + } else if (g_Vars.hovdata) { + g_Vars.hovdata->ailist = g_Vars.ailist; + g_Vars.hovdata->aioffset = g_Vars.aioffset; } return true; @@ -170,8 +170,8 @@ bool aiSetReturnList(void) g_Vars.objdata->aireturnlist = ailistid; } else if (g_Vars.aicdata) { g_Vars.aicdata->aireturnlist = ailistid; - } else if (g_Vars.aiddata) { - g_Vars.aiddata->aireturnlist = ailistid; + } else if (g_Vars.hovdata) { + g_Vars.hovdata->aireturnlist = ailistid; } g_Vars.aioffset += 5; @@ -360,8 +360,8 @@ glabel aiReturn // ailist = ailistFindById(g_Vars.objdata->aireturnlist); // } else if (g_Vars.aicdata) { // ailist = ailistFindById(g_Vars.aicdata->aireturnlist); -// } else if (g_Vars.aiddata) { -// ailist = ailistFindById(g_Vars.aiddata->aireturnlist); +// } else if (g_Vars.hovdata) { +// ailist = ailistFindById(g_Vars.hovdata->aireturnlist); // } // // g_Vars.ailist = ailist; @@ -388,8 +388,8 @@ bool aiStop(void) { if (g_Vars.chrdata) { func0f03ad8c(g_Vars.chrdata); - } else if (g_Vars.aiddata) { - func0f07b078(g_Vars.aiddata); + } else if (g_Vars.hovdata) { + func0f07b078(g_Vars.hovdata); } g_Vars.aioffset += 2; @@ -924,7 +924,7 @@ bool aiAimAndFire2(void) u32 thingtype = cmd[3] | (cmd[2] << 8); if ((g_Vars.chrdata && func0f03a76c(g_Vars.chrdata, thingtype, thingid)) || - (g_Vars.aiddata && func0f07b038(g_Vars.aiddata))) { + (g_Vars.hovdata && func0f07b038(g_Vars.hovdata))) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[6]); } else { g_Vars.aioffset += 7; @@ -1370,7 +1370,7 @@ bool aiIfRandomLessThan(void) u8 *cmd = g_Vars.ailist + g_Vars.aioffset; if ((g_Vars.chrdata && g_Vars.chrdata->random < cmd[2]) || - (g_Vars.aiddata && (random() & 0xff) < cmd[2])) { + (g_Vars.hovdata && (random() & 0xff) < cmd[2])) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[3]); } else { g_Vars.aioffset += 4; @@ -1387,7 +1387,7 @@ bool aiIfRandomGreaterThan(void) u8 *cmd = g_Vars.ailist + g_Vars.aioffset; if ((g_Vars.chrdata && g_Vars.chrdata->random > cmd[2]) || - (g_Vars.aiddata && (random() & 0xff) > cmd[2])) { + (g_Vars.hovdata && (random() & 0xff) > cmd[2])) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[3]); } else { g_Vars.aioffset += 4; @@ -1603,7 +1603,7 @@ bool aiIfSawDeath(void) bool aiIfSeesPlayer(void) { if ((g_Vars.chrdata && func0f039368(g_Vars.chrdata)) || - (g_Vars.aiddata && func0f07ae18(g_Vars.aiddata, 0x40) && func0f07af34(g_Vars.aiddata))) { + (g_Vars.hovdata && func0f07ae18(g_Vars.hovdata, 0x40) && func0f07af34(g_Vars.hovdata))) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); } else { @@ -6102,7 +6102,7 @@ bool aiSetPadPreset(void) if (g_Vars.chrdata) { chrSetPadPreset(g_Vars.chrdata, pad_id); } else if (g_Vars.aicdata) { - g_Vars.aicdata->padpreset1 = pad_id; + g_Vars.aicdata->base.pad = pad_id; } g_Vars.aioffset += 4; @@ -6183,8 +6183,8 @@ bool aiRestartTimer(void) { if (g_Vars.chrdata) { chrRestartTimer(g_Vars.chrdata); - } else if (g_Vars.aiddata) { - func0f07b0f4(g_Vars.aiddata); + } else if (g_Vars.hovdata) { + func0f07b0f4(g_Vars.hovdata); } g_Vars.aioffset += 2; @@ -12824,8 +12824,8 @@ bool ai013f(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - if (g_Vars.aiddata) { - if (g_Vars.aiddata->unk90 != 0) { + if (g_Vars.hovdata) { + if (g_Vars.hovdata->unk90 != 0) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); } else { g_Vars.aioffset += 3; @@ -12844,8 +12844,8 @@ bool ai0140(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - if (g_Vars.aiddata) { - if ((cmd[3] < g_Vars.aiddata->unk8c && cmd[2] == 1) || (g_Vars.aiddata->unk8c < cmd[3] && cmd[2] == 0)) { + if (g_Vars.hovdata) { + if ((cmd[3] < g_Vars.hovdata->unk8c && cmd[2] == 1) || (g_Vars.hovdata->unk8c < cmd[3] && cmd[2] == 0)) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[4]); } else { g_Vars.aioffset += 5; @@ -13152,8 +13152,8 @@ glabel ai0142 */ bool ai0143(void) { - if (g_Vars.aiddata) { - func0f07b0bc(g_Vars.aiddata, true); + if (g_Vars.hovdata) { + func0f07b0bc(g_Vars.hovdata, true); } g_Vars.aioffset += 2; @@ -13166,8 +13166,8 @@ bool ai0143(void) */ bool ai0144(void) { - if (g_Vars.aiddata) { - func0f07b0bc(g_Vars.aiddata, false); + if (g_Vars.hovdata) { + func0f07b0bc(g_Vars.hovdata, false); } g_Vars.aioffset += 2; @@ -13581,7 +13581,7 @@ glabel aiIfAction bool aiHovercopterFireRocket(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - func0f07b290(g_Vars.aiddata, cmd[2]); + func0f07b290(g_Vars.hovdata, cmd[2]); g_Vars.aioffset += 3; return false; @@ -13634,8 +13634,6 @@ glabel aiIfNaturalAnim // return false; //} -struct otheraidata *func0f07adf4(struct otheraidata *otheraidata); - /** * @cmd 016a */ @@ -13645,11 +13643,11 @@ bool aiIfY(void) struct chrdata *chr = NULL; float cutoff_y = ((cmd[4] | (cmd[3] << 8)) << 16) >> 16; - if (cmd[2] == CHR_TARGET && g_Vars.aiddata) { - struct otheraidata *aiddata = func0f07adf4(g_Vars.aiddata); + if (cmd[2] == CHR_TARGET && g_Vars.hovdata) { + struct heliobj *heli = func0f07adf4(&g_Vars.hovdata->base); - if (aiddata) { - struct targetsomething *target = objGetTargetSomething(aiddata); + if (heli) { + struct targetsomething *target = objGetTargetSomething(heli); if (target && (target->unk00 == 3 || target->unk00 == 6)) { chr = target->chr; diff --git a/src/include/game/game_0601b0.h b/src/include/game/game_0601b0.h index 6640491c6..2f71a565f 100644 --- a/src/include/game/game_0601b0.h +++ b/src/include/game/game_0601b0.h @@ -301,7 +301,8 @@ u32 func0f065880(void); u32 func0f065d1c(void); u32 func0f065f80(void); u32 func0f066290(void); -struct targetsomething *objGetTargetSomething(struct defaultobj *obj); +struct targetsomething *objGetTargetSomething(struct heliobj *obj); +struct heliobj *func0f07adf4(struct defaultobj *obj); u32 func0f095bf4(void); u32 func0f095d64(void); u32 func0f096700(void); diff --git a/src/include/gvars/gvars.h b/src/include/gvars/gvars.h index 43dfa53d1..0c7993b24 100644 --- a/src/include/gvars/gvars.h +++ b/src/include/gvars/gvars.h @@ -265,8 +265,8 @@ struct g_vars { /*000420*/ u32 unk000420; /*000424*/ struct chrdata *chrdata; /*000428*/ struct standardobj *objdata; - /*00042c*/ struct otheraidata *aicdata; - /*000430*/ struct otheraidata *aiddata; + /*00042c*/ struct standardobj *aicdata; + /*000430*/ struct heliobj *hovdata; /*000434*/ u8 *ailist; /*000438*/ u32 aioffset; /*00043c*/ u32 unk00043c; diff --git a/src/include/types.h b/src/include/types.h index 2f4642fab..aacd1bd72 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -409,7 +409,7 @@ struct autogunobj { // objtype 0d /*0xa8*/ u8 autogun_type; }; -struct liftobj { +struct liftobj { // objtype 30 struct defaultobj base; /*0x5c*/ u32 unk5c; /*0x60*/ u32 unk60; @@ -420,41 +420,8 @@ struct liftobj { /*0x74*/ float unk74; }; -struct tag { - // These three words are possibly the same values as defined in the setup - // file, but this just a guess. - u32 unk00; - u16 unk04; - s16 unk06; - u32 unk08; - struct defaultobj *obj; -}; - -struct otheraidata { - /*0x00*/ u32 unk00; - /*0x04*/ u16 unk04; - /*0x06*/ u16 padpreset1; - /*0x08*/ u32 unk08; - /*0x0c*/ u32 unk0c; - /*0x10*/ u32 unk10; - /*0x14*/ u32 unk14; - /*0x18*/ u32 unk18; - /*0x1c*/ u32 unk1c; - /*0x20*/ u32 unk20; - /*0x24*/ u32 unk24; - /*0x28*/ u32 unk28; - /*0x2c*/ u32 unk2c; - /*0x30*/ u32 unk30; - /*0x34*/ u32 unk34; - /*0x38*/ u32 unk38; - /*0x3c*/ u32 unk3c; - /*0x40*/ u32 unk40; - /*0x44*/ u32 unk44; - /*0x48*/ u32 unk48; - /*0x4c*/ u32 unk4c; - /*0x50*/ u32 unk50; - /*0x54*/ u32 unk54; - /*0x58*/ u32 unk58; +struct heliobj { + struct defaultobj base; /*0x5c*/ u8 *ailist; /*0x60*/ u16 aioffset; /*0x62*/ u16 aireturnlist; @@ -472,6 +439,16 @@ struct otheraidata { /*0x90*/ s16 unk90; }; +struct tag { + // These three words are possibly the same values as defined in the setup + // file, but this just a guess. + u32 unk00; + u16 unk04; + s16 unk06; + u32 unk08; + struct defaultobj *obj; +}; + struct targetsomething { /*0x00*/ u8 unk00; /*0x04*/ struct chrdata *chr;