Use pointers for aioffsets
This commit is contained in:
parent
e36d700bad
commit
0c948fdce9
|
|
@ -274,7 +274,7 @@ void amSetAiBuddyStealth(void)
|
|||
&& chr->actiontype != ACT_DRUGGEDCOMINGUP) {
|
||||
chrStopFiring(chr);
|
||||
chr->ailist = ailistFindById(GAILIST_BUDDY_STEALTH);
|
||||
chr->aioffset = 0;
|
||||
chr->aioffset = chr->ailist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1126,7 +1126,7 @@ void chrInit(struct prop *prop, u8 *ailist)
|
|||
chr->sleep = 0;
|
||||
|
||||
chr->ailist = ailist;
|
||||
chr->aioffset = 0;
|
||||
chr->aioffset = ailist;
|
||||
chr->aireturnlist = -1;
|
||||
chr->aishotlist = -1;
|
||||
chr->aipunchdodgelist = -1;
|
||||
|
|
|
|||
|
|
@ -5093,7 +5093,7 @@ void chrDie(struct chrdata *chr, s32 aplayernum)
|
|||
chr->act_die.timeextra = 0;
|
||||
|
||||
chr->ailist = ailistFindById(GAILIST_AIBOT_DEAD);
|
||||
chr->aioffset = 0;
|
||||
chr->aioffset = chr->ailist;
|
||||
|
||||
mpstatsRecordDeath(aplayernum, mpPlayerGetIndex(chr));
|
||||
botinvDropAll(chr, chr->aibot->weaponnum);
|
||||
|
|
@ -13407,7 +13407,7 @@ void cutsceneStart(u32 ailistid)
|
|||
}
|
||||
|
||||
g_BgChrs[g_NumBgChrs - 1].ailist = ailistFindById(ailistid);
|
||||
g_BgChrs[g_NumBgChrs - 1].aioffset = 0;
|
||||
g_BgChrs[g_NumBgChrs - 1].aioffset = g_BgChrs[g_NumBgChrs - 1].ailist;
|
||||
g_BgChrs[g_NumBgChrs - 1].aireturnlist = -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -650,10 +650,10 @@ s32 chraiGetListIdByList(u8 *ailist, bool *is_global)
|
|||
return -1;
|
||||
}
|
||||
|
||||
u32 chraiGoToLabel(u8 *ailist, u32 aioffset, u8 label)
|
||||
u8 *chraiGoToLabel(u8 *ailist, u8 *aioffset, u8 label)
|
||||
{
|
||||
do {
|
||||
u8 *cmd = aioffset + ailist;
|
||||
u8 *cmd = aioffset;
|
||||
u32 type = (cmd[0] << 8) + cmd[1];
|
||||
|
||||
if (type == CMD_LABEL) {
|
||||
|
|
@ -675,7 +675,7 @@ void chraiExecute(void *entity, s32 proptype)
|
|||
g_Vars.heli = NULL;
|
||||
g_Vars.hovercar = NULL;
|
||||
g_Vars.ailist = NULL;
|
||||
g_Vars.aioffset = 0;
|
||||
g_Vars.aioffset = NULL;
|
||||
|
||||
if (proptype == PROPTYPE_CHR) {
|
||||
g_Vars.chrdata = entity;
|
||||
|
|
@ -722,7 +722,7 @@ void chraiExecute(void *entity, s32 proptype)
|
|||
// Set shot list
|
||||
g_Vars.chrdata->chrflags &= ~CHRCFLAG_TRIGGERSHOTLIST;
|
||||
g_Vars.ailist = ailistFindById(g_Vars.chrdata->aishotlist);
|
||||
g_Vars.aioffset = 0;
|
||||
g_Vars.aioffset = g_Vars.ailist;
|
||||
}
|
||||
} else if (g_Vars.chrdata && (g_Vars.chrdata->chrflags & CHRCFLAG_CONSIDER_DODGE)) {
|
||||
g_Vars.chrdata->chrflags &= ~CHRCFLAG_CONSIDER_DODGE;
|
||||
|
|
@ -742,7 +742,7 @@ void chraiExecute(void *entity, s32 proptype)
|
|||
&& g_Vars.chrdata->actiontype != ACT_ATTACKROLL) {
|
||||
// Set shooting at me list
|
||||
g_Vars.ailist = ailistFindById(g_Vars.chrdata->aishootingatmelist);
|
||||
g_Vars.aioffset = 0;
|
||||
g_Vars.aioffset = g_Vars.ailist;
|
||||
g_Vars.chrdata->dodgerating = 0;
|
||||
} else {
|
||||
// Increase dodge rating
|
||||
|
|
@ -768,7 +768,7 @@ void chraiExecute(void *entity, s32 proptype)
|
|||
chrSetFlags(g_Vars.chrdata, CHRFLAG1_SEARCHSAMEROOM, BANK_1);
|
||||
g_Vars.chrdata->alertness = 0;
|
||||
g_Vars.ailist = ailistFindById(g_Vars.chrdata->aidarkroomlist);
|
||||
g_Vars.aioffset = 0;
|
||||
g_Vars.aioffset = g_Vars.ailist;
|
||||
}
|
||||
} else {
|
||||
// empty
|
||||
|
|
@ -776,7 +776,7 @@ void chraiExecute(void *entity, s32 proptype)
|
|||
|
||||
// Iterate and execute the ailist
|
||||
while (g_Vars.ailist) {
|
||||
u8 *cmd = g_Vars.aioffset + g_Vars.ailist;
|
||||
u8 *cmd = g_Vars.aioffset;
|
||||
s32 type = (cmd[0] << 8) + cmd[1];
|
||||
|
||||
if (g_CommandPointers[type]()) {
|
||||
|
|
@ -786,9 +786,9 @@ void chraiExecute(void *entity, s32 proptype)
|
|||
}
|
||||
}
|
||||
|
||||
u32 chraiGetCommandLength(u8 *ailist, u32 aioffset)
|
||||
u32 chraiGetCommandLength(u8 *ailist, u8 *aioffset)
|
||||
{
|
||||
u8 *cmd = aioffset + ailist;
|
||||
u8 *cmd = aioffset;
|
||||
s32 type = (cmd[0] << 8) + cmd[1];
|
||||
|
||||
if (type >= 0 && type < ARRAYCOUNT(g_CommandLengths)) {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -83,7 +83,7 @@ void stageAllocateBgChrs(void)
|
|||
}
|
||||
|
||||
g_BgChrs[count].ailist = g_StageSetup.ailists[i].list;
|
||||
g_BgChrs[count].aioffset = 0;
|
||||
g_BgChrs[count].aioffset = g_BgChrs[count].ailist;
|
||||
g_BgChrs[count].aireturnlist = -1;
|
||||
g_BgChrs[count].actiontype = ACT_NULL;
|
||||
count++;
|
||||
|
|
@ -96,7 +96,7 @@ void stageAllocateBgChrs(void)
|
|||
g_BgChrs[count] = blankchr;
|
||||
g_BgChrs[count].chrnum = 4900;
|
||||
g_BgChrs[count].ailist = NULL;
|
||||
g_BgChrs[count].aioffset = 0;
|
||||
g_BgChrs[count].aioffset = NULL;
|
||||
g_BgChrs[count].aireturnlist = -1;
|
||||
g_BgChrs[count].actiontype = ACT_NULL;
|
||||
g_BgChrs[count].hidden2 |= CHRH2FLAG_TICKDURINGAUTOCUT;
|
||||
|
|
@ -165,7 +165,7 @@ void stageLoadAllAilistModels(void)
|
|||
break;
|
||||
}
|
||||
|
||||
cmd += chraiGetCommandLength(cmd, 0);
|
||||
cmd += chraiGetCommandLength(cmd, cmd);
|
||||
}
|
||||
|
||||
i++;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ bool aiMpInitSimulants(void)
|
|||
*/
|
||||
bool ai0176(void)
|
||||
{
|
||||
u8 *cmd = g_Vars.ailist + g_Vars.aioffset;
|
||||
u8 *cmd = g_Vars.aioffset;
|
||||
struct aibot *aibot;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1840,7 +1840,7 @@ void setupCreateProps(s32 stagenum)
|
|||
truck->turnrot60 = 0;
|
||||
truck->roty = 0;
|
||||
truck->ailist = ailistFindById((u32)truck->ailist);
|
||||
truck->aioffset = 0;
|
||||
truck->aioffset = truck->ailist;
|
||||
truck->aireturnlist = -1;
|
||||
truck->path = NULL;
|
||||
truck->nextstep = 0;
|
||||
|
|
@ -1862,7 +1862,7 @@ void setupCreateProps(s32 stagenum)
|
|||
car->rotx = 0;
|
||||
car->speedtime60 = -1;
|
||||
car->ailist = ailistFindById((s32)car->ailist);
|
||||
car->aioffset = 0;
|
||||
car->aioffset = car->ailist;
|
||||
car->aireturnlist = -1;
|
||||
car->path = NULL;
|
||||
car->nextstep = 0;
|
||||
|
|
@ -1891,7 +1891,7 @@ void setupCreateProps(s32 stagenum)
|
|||
chopper->barrelrot = 0;
|
||||
chopper->barrelrotspeed = 0;
|
||||
chopper->ailist = ailistFindById((u32)chopper->ailist);
|
||||
chopper->aioffset = 0;
|
||||
chopper->aioffset = chopper->ailist;
|
||||
chopper->aireturnlist = -1;
|
||||
chopper->path = NULL;
|
||||
chopper->nextstep = 0;
|
||||
|
|
@ -1938,7 +1938,7 @@ void setupCreateProps(s32 stagenum)
|
|||
heli->speedtime60 = -1;
|
||||
heli->rotoryspeedtime = -1;
|
||||
heli->ailist = ailistFindById((u32)heli->ailist);
|
||||
heli->aioffset = 0;
|
||||
heli->aioffset = heli->ailist;
|
||||
heli->aireturnlist = -1;
|
||||
heli->path = NULL;
|
||||
heli->nextstep = 0;
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
#include "types.h"
|
||||
|
||||
s32 chraiGetListIdByList(u8 *ailist, bool *is_global);
|
||||
u32 chraiGoToLabel(u8 *ailist, u32 aioffset, u8 label);
|
||||
u8 *chraiGoToLabel(u8 *ailist, u8 *aioffset, u8 label);
|
||||
void chraiExecute(void *entity, s32 proptype);
|
||||
u32 chraiGetCommandLength(u8 *ailist, u32 aioffset);
|
||||
u32 chraiGetCommandLength(u8 *ailist, u8 *aioffset);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ struct g_vars {
|
|||
/*0x42c*/ struct heliobj *heli;
|
||||
/*0x430*/ struct chopperobj *hovercar;
|
||||
/*0x434*/ u8 *ailist;
|
||||
/*0x438*/ u32 aioffset;
|
||||
/*0x438*/ u8 *aioffset;
|
||||
/*0x43c*/ s32 hardfreeabletally;
|
||||
/*0x440*/ s32 antiheadnum;
|
||||
/*0x444*/ s32 antibodynum;
|
||||
|
|
@ -1202,7 +1202,7 @@ struct chrdata {
|
|||
/*0x100*/ f32 damage;
|
||||
/*0x104*/ f32 maxdamage;
|
||||
/*0x108*/ u8 *ailist;
|
||||
/*0x10c*/ u16 aioffset;
|
||||
/*0x10c*/ u8 *aioffset;
|
||||
/*0x10e*/ s16 aireturnlist;
|
||||
/*0x110*/ s16 aishotlist;
|
||||
/*0x112*/ u8 morale;
|
||||
|
|
@ -1748,7 +1748,7 @@ struct padlockeddoorobj { // objtype 0x26
|
|||
struct truckobj { // objtype 0x27
|
||||
struct defaultobj base;
|
||||
/*0x5c*/ u8 *ailist;
|
||||
/*0x60*/ u16 aioffset;
|
||||
/*0x60*/ u8 *aioffset;
|
||||
/*0x62*/ s16 aireturnlist;
|
||||
/*0x64*/ f32 speed;
|
||||
/*0x68*/ f32 wheelxrot;
|
||||
|
|
@ -1764,7 +1764,7 @@ struct truckobj { // objtype 0x27
|
|||
struct heliobj { // objtype 0x28
|
||||
struct defaultobj base;
|
||||
/*0x5c*/ u8 *ailist;
|
||||
/*0x60*/ u16 aioffset;
|
||||
/*0x60*/ u8 *aioffset;
|
||||
/*0x62*/ s16 aireturnlist;
|
||||
/*0x64*/ f32 rotoryrot;
|
||||
/*0x68*/ f32 rotoryspeed;
|
||||
|
|
@ -1879,7 +1879,7 @@ struct fanobj { // objtype 0x36
|
|||
struct hovercarobj { // objtype 0x37
|
||||
struct defaultobj base;
|
||||
/*0x5c*/ u8 *ailist;
|
||||
/*0x60*/ u16 aioffset;
|
||||
/*0x60*/ u8 *aioffset;
|
||||
/*0x62*/ s16 aireturnlist;
|
||||
/*0x64*/ f32 speed;
|
||||
/*0x68*/ f32 speedaim;
|
||||
|
|
@ -1907,7 +1907,7 @@ struct padeffectobj { // objtype 0x38
|
|||
struct chopperobj { // objtype 0x39
|
||||
struct defaultobj base;
|
||||
/*0x5c*/ u8 *ailist;
|
||||
/*0x60*/ u16 aioffset;
|
||||
/*0x60*/ u8 *aioffset;
|
||||
/*0x62*/ s16 aireturnlist;
|
||||
union {
|
||||
struct {
|
||||
|
|
|
|||
Loading…
Reference in New Issue