From 51e037ca80191ae142b7a79206f15e8823a45864 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 12 Mar 2020 17:41:25 +1000 Subject: [PATCH] Rename chr->unk2d4 to chr->aibot --- src/game/chr/chraction.c | 62 ++++---- src/game/game_01e250.c | 2 +- src/game/game_17f930.c | 14 +- src/game/game_190260.c | 264 ++++++++++++++++----------------- src/game/game_197600.c | 2 +- src/game/game_19aa80.c | 10 +- src/include/game/game_1999b0.h | 4 +- src/include/types.h | 8 +- 8 files changed, 183 insertions(+), 183 deletions(-) diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index b7f56a56f..e6b45b2ea 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -828,7 +828,7 @@ void func0f02e9a0(struct chrdata *chr, f32 arg1) chr->sleep = fsleep; - if (func0001db94(chr->animdata) && !chr->unk2d4) { + if (func0001db94(chr->animdata) && !chr->aibot) { chr->hidden |= CHRHFLAG_00200000; } else { func0f02e6dc(chr, arg1); @@ -857,7 +857,7 @@ void chrStand(struct chrdata *chr) chr->sleep = 0; chr->act_stand.face_target = false; - if (chr->unk2d4 == NULL) { + if (chr->aibot == NULL) { if (animGetId(chr->animdata) == ANIM_KNEEL_SHOOT_RIGHT_HAND) { result = func0f02e15c(chr, 0.5, 0.8); func0001dccc(chr->animdata, ANIM_KNEEL_SHOOT_RIGHT_HAND, @@ -3360,7 +3360,7 @@ void func0f03119c(struct chrdata *chr) } chr->actiontype = ACT_DEAD; - chr->act_dead.unk038 = chr->unk2d4 ? 0 : -1; + chr->act_dead.unk038 = chr->aibot ? 0 : -1; chr->act_dead.unk02c = 0; chr->act_dead.unk030 = 0; chr->act_dead.unk034 = 0; @@ -9145,13 +9145,13 @@ void func0f036358(struct chrdata *chr, s32 arg1) chr->aioffset = 0; func0f0b09f4(arg1, mpPlayerGetIndex(chr)); - func0f199964(chr, chr->unk2d4->unk020); + func0f199964(chr, chr->aibot->unk020); - chr->unk2d4->unk09c_00 = 0; - chr->unk2d4->unk09c_01 = 0; - chr->unk2d4->unk04c_04 = 0; - chr->unk2d4->unk04c_03 = 0; - chr->unk2d4->unk04c_05 = 0; + chr->aibot->unk09c_00 = 0; + chr->aibot->unk09c_01 = 0; + chr->aibot->unk04c_04 = 0; + chr->aibot->unk04c_03 = 0; + chr->aibot->unk04c_05 = 0; } } @@ -11863,7 +11863,7 @@ glabel chrGoToPos // func0f036ee4(chr, &chr->act_gopos.unk068, &auStack52[0], &prevpos); // } // -// if (chr->act_gopos.unk068 != MAX_CHRWAYPOINTS && func0001db94(chr->animdata) != 0 && !chr->unk2d4) { +// if (chr->act_gopos.unk068 != MAX_CHRWAYPOINTS && func0001db94(chr->animdata) != 0 && !chr->aibot) { // chr->hidden |= CHRHFLAG_00200000; // return true; // } else { @@ -16254,7 +16254,7 @@ void func0f03cd04(struct chrdata *chr) void chrTickDead(struct chrdata *chr) { - struct chr2d4 *chr2d4 = chr->unk2d4; + struct aibot *aibot = chr->aibot; if (chr->act_dead.unk038 >= 0) { chr->act_dead.unk038 += g_Vars.lvupdate240_60; @@ -16262,7 +16262,7 @@ void chrTickDead(struct chrdata *chr) if (chr->act_dead.unk038 >= 90) { chr->fadealpha = 0; - if (chr2d4) { + if (aibot) { mpInitSimulant(chr, true); } else { chr->hidden |= CHRHFLAG_00000020; @@ -16283,7 +16283,7 @@ void chrTickDead(struct chrdata *chr) } if (chr->act_dead.unk030 && chr->act_dead.unk034 >= 120) { - if (chr2d4 == 0) { + if (aibot == 0) { chr->hidden |= CHRHFLAG_00000020; } @@ -16293,7 +16293,7 @@ void chrTickDead(struct chrdata *chr) } } - if (chr2d4 == NULL) { + if (aibot == NULL) { chr->ailist = NULL; } } @@ -16799,7 +16799,7 @@ void chrTickDruggedDrop(struct chrdata *chr) if (animGetFrame(animdata) >= func0001d1a0(animdata)) { chr->actiontype = ACT_DRUGGEDKO; - chr->act_druggedko.unk038 = chr->unk2d4 ? 0 : -1; + chr->act_druggedko.unk038 = chr->aibot ? 0 : -1; chr->act_druggedko.unk02c = 0; chr->act_druggedko.unk030 = 0; chr->act_druggedko.unk034 = 0; @@ -17176,8 +17176,8 @@ glabel var7f1a8f24 void func0f03e538(struct chrdata *chr, f32 arg1) { - if (chr->unk2d4) { - chr->unk2d4->unk0b0 = arg1; + if (chr->aibot) { + chr->aibot->unk0b0 = arg1; } else { func0001ae90(chr->animdata, arg1); } @@ -17185,8 +17185,8 @@ void func0f03e538(struct chrdata *chr, f32 arg1) f32 func0f03e578(struct chrdata *chr) { - if (chr->unk2d4) { - return chr->unk2d4->unk0a4; + if (chr->aibot) { + return chr->aibot->unk0a4; } return func0001ae44(chr->animdata); @@ -17194,8 +17194,8 @@ f32 func0f03e578(struct chrdata *chr) void func0f03e5b0(struct chrdata *chr, f32 arg1) { - if (chr->unk2d4) { - chr->unk2d4->unk0a4 = arg1; + if (chr->aibot) { + chr->aibot->unk0a4 = arg1; } else { func0001ae90(chr->animdata, arg1); } @@ -18600,7 +18600,7 @@ void chrStopFiring(struct chrdata *chr) { u8 race = CHRRACE(chr); - if (race != RACE_DRCAROLL && race != RACE_EYESPY && chr->unk2d4 == NULL) { + if (race != RACE_DRCAROLL && race != RACE_EYESPY && chr->aibot == NULL) { chrSetFiring(chr, 0, false); chrSetFiring(chr, 1, false); chrResetAimEndProperties(chr); @@ -23428,9 +23428,9 @@ bool chrDetectDangerousObject(struct chrdata *chr, u8 flags) chr->runfrompos.y = g_DangerousProps[i]->pos.y; chr->runfrompos.z = g_DangerousProps[i]->pos.z; - if (chr->unk2d4) { - chr->unk2d4->unk064 |= 0x0004; - chr->unk2d4->unk00c = i; + if (chr->aibot) { + chr->aibot->unk064 |= 0x0004; + chr->aibot->unk00c = i; } return true; @@ -23438,9 +23438,9 @@ bool chrDetectDangerousObject(struct chrdata *chr, u8 flags) } } - if (chr->unk2d4) { - chr->unk2d4->unk064 &= ~0x0004; - chr->unk2d4->unk00c = -1; + if (chr->aibot) { + chr->aibot->unk064 &= ~0x0004; + chr->aibot->unk00c = -1; } return false; @@ -27436,8 +27436,8 @@ void chrTick(struct chrdata *chr) chr->soundtimer += g_Vars.lvupdate240_60; chr->talktimer += g_Vars.lvupdate240_60; - if (chr->unk2d4) { - chr->unk2d4->unk030 += g_Vars.lvupdate240_60; + if (chr->aibot) { + chr->aibot->unk030 += g_Vars.lvupdate240_60; } if (chr->hidden & CHRHFLAG_TIMER_RUNNING) { @@ -27449,7 +27449,7 @@ void chrTick(struct chrdata *chr) if (chr->sleep < 0 || (chr->chrflags & CHRCFLAG_00040000) || chr->alertness >= 65 - || (chr->unk2d4 && (chr->actiontype == ACT_DIE || chr->actiontype == ACT_DEAD))) { + || (chr->aibot && (chr->actiontype == ACT_DIE || chr->actiontype == ACT_DEAD))) { u8 pass = race == RACE_HUMAN || race == RACE_SKEDAR; chr->sleep = 0; diff --git a/src/game/game_01e250.c b/src/game/game_01e250.c index af3e2291a..d1bdadd3b 100644 --- a/src/game/game_01e250.c +++ b/src/game/game_01e250.c @@ -2724,7 +2724,7 @@ void chrInit(struct prop *prop, u8 *ailist) chr->runfrompos.y = 0; chr->runfrompos.z = 0; chr->oldrooms[0] = -1; - chr->unk2d4 = NULL; + chr->aibot = NULL; chr->blurdrugamount = 0; chr->drugheadsway = 0; chr->drugheadcount = 0; diff --git a/src/game/game_17f930.c b/src/game/game_17f930.c index 0158e6504..072b649cc 100644 --- a/src/game/game_17f930.c +++ b/src/game/game_17f930.c @@ -825,7 +825,7 @@ void scenarioHtbCallback10(void) // Check if a simulant is holding it if (g_ScenarioData.htb.token == NULL) { for (i = PLAYERCOUNT(); i < g_MpNumPlayers; i++) { - if (g_MpPlayerChrs[i]->prop && g_MpPlayerChrs[i]->unk2d4->unk09c_00) { + if (g_MpPlayerChrs[i]->prop && g_MpPlayerChrs[i]->aibot->unk09c_00) { g_ScenarioData.htb.token = g_MpPlayerChrs[i]->prop; break; } @@ -851,16 +851,16 @@ void scenarioHtbCallback10(void) void scenarioHtbCallback14(struct chrdata *chr) { if (chr) { - if (chr->unk2d4->unk09c_00) { - chr->unk2d4->unk0a0 += g_Vars.lvupdate240; + if (chr->aibot->unk09c_00) { + chr->aibot->unk0a0 += g_Vars.lvupdate240; - if (chr->unk2d4->unk0a0 >= SECSTOFRAMES240(30)) { + if (chr->aibot->unk0a0 >= SECSTOFRAMES240(30)) { func00010904(var80095200, 0x5b8, 0, -1, -1, -1, -1, -1); var800ac500[mpPlayerGetIndex(chr)]->unk3e++; - chr->unk2d4->unk0a0 = 0; + chr->aibot->unk0a0 = 0; } } else { - chr->unk2d4->unk0a0 = 0; + chr->aibot->unk0a0 = 0; } } else { if (currentPlayerHasBriefcase()) { @@ -3305,7 +3305,7 @@ void scenarioHtmCallback10(void) // Check if a simulant is holding it if (g_ScenarioData.htm.uplink == NULL) { for (i = PLAYERCOUNT(); i < g_MpNumPlayers; i++) { - if (g_MpPlayerChrs[i]->unk2d4->unk04c_05) { + if (g_MpPlayerChrs[i]->aibot->unk04c_05) { g_ScenarioData.htm.uplink = g_MpPlayerChrs[i]->prop; break; } diff --git a/src/game/game_190260.c b/src/game/game_190260.c index 06c35a5da..fa374662f 100644 --- a/src/game/game_190260.c +++ b/src/game/game_190260.c @@ -39,7 +39,7 @@ bool func0f190260(struct chrdata *chr) { - return chr->blurdrugamount >= var80087d14[chr->unk2d4->simulant->unk48].blurdrugamount; + return chr->blurdrugamount >= var80087d14[chr->aibot->simulant->unk48].blurdrugamount; } GLOBAL_ASM( @@ -277,8 +277,8 @@ glabel mpChrReset // s32 i; // u32 rand; // -// if (chr->unk2d4) { -// struct chr2d4 *chr2d4 = chr->unk2d4; +// if (chr->aibot) { +// struct aibot *aibot = chr->aibot; // // chr->fadealpha = -1; // chr->chrflags &= ~CHRCFLAG_JUST_INJURED; @@ -311,104 +311,104 @@ glabel mpChrReset // chr->chrheight = 185; // // for (i = 0; i < 33; i++) { -// chr2d4->unk01c->unk00[i] = 0; +// aibot->unk01c->unk00[i] = 0; // } // // func0f197c00(chr); // -// chr2d4->unk04c_02 = 0; -// chr2d4->unk04c_01 = 1; -// chr2d4->unk09c_00 = 0; -// chr2d4->unk04c_06 = 0; -// chr2d4->unk04c_04 = 0; -// chr2d4->unk04c_03 = 0; -// chr2d4->unk09c_01 = 0; -// chr2d4->unk04c_05 = 0; -// chr2d4->unk020 = 1; -// chr2d4->unk024 = 0; -// chr2d4->unk028 = 0; -// chr2d4->prop = NULL; -// chr2d4->unk02c = 0; -// chr2d4->unk02e = 0; -// chr2d4->unk05c = 0; -// chr2d4->unk060 = 0; -// chr2d4->unk074 = -1; -// chr2d4->unk030 = 301; -// chr2d4->unk034 = 0; -// chr2d4->unk04d = 0; -// chr2d4->unk04e = 0; -// chr2d4->unk044 = 0; -// chr2d4->unk0a0 = 0; -// chr2d4->unk09c_02 = 0; -// chr2d4->unk064 = 0; -// chr2d4->unk04c_00 = 0; -// chr2d4->unk048 = -1; -// chr2d4->unk04a = -1; -// chr2d4->unk0bc = -1; -// chr2d4->unk0c8 = 0; -// chr2d4->unk0c4 = 0; -// chr2d4->unk0cc = 0; -// chr2d4->unk0d0 = 0; -// chr2d4->unk0d8 = 0; -// chr2d4->unk0dc = 0; -// chr2d4->unk03e = -1; -// chr2d4->unk03c = 0; -// chr2d4->unk0e2 = 0; -// chr2d4->unk0e0 = 0; -// chr2d4->unk118 = 0; -// chr2d4->unk11c = 0; -// chr2d4->unk120 = -1; -// chr2d4->unk124 = -1; -// chr2d4->unk128 = 0; -// chr2d4->unk12c = 0; -// chr2d4->unk040 = 0; -// chr2d4->unk06c = 0; -// chr2d4->unk070 = 0; -// chr2d4->unk0e8 = 0; -// chr2d4->unk0e4 = 0; -// chr2d4->unk108 = 0; -// chr2d4->unk10c = 0; -// chr2d4->unk110 = 0; +// aibot->unk04c_02 = 0; +// aibot->unk04c_01 = 1; +// aibot->unk09c_00 = 0; +// aibot->unk04c_06 = 0; +// aibot->unk04c_04 = 0; +// aibot->unk04c_03 = 0; +// aibot->unk09c_01 = 0; +// aibot->unk04c_05 = 0; +// aibot->unk020 = 1; +// aibot->unk024 = 0; +// aibot->unk028 = 0; +// aibot->prop = NULL; +// aibot->unk02c = 0; +// aibot->unk02e = 0; +// aibot->unk05c = 0; +// aibot->unk060 = 0; +// aibot->unk074 = -1; +// aibot->unk030 = 301; +// aibot->unk034 = 0; +// aibot->unk04d = 0; +// aibot->unk04e = 0; +// aibot->unk044 = 0; +// aibot->unk0a0 = 0; +// aibot->unk09c_02 = 0; +// aibot->unk064 = 0; +// aibot->unk04c_00 = 0; +// aibot->unk048 = -1; +// aibot->unk04a = -1; +// aibot->unk0bc = -1; +// aibot->unk0c8 = 0; +// aibot->unk0c4 = 0; +// aibot->unk0cc = 0; +// aibot->unk0d0 = 0; +// aibot->unk0d8 = 0; +// aibot->unk0dc = 0; +// aibot->unk03e = -1; +// aibot->unk03c = 0; +// aibot->unk0e2 = 0; +// aibot->unk0e0 = 0; +// aibot->unk118 = 0; +// aibot->unk11c = 0; +// aibot->unk120 = -1; +// aibot->unk124 = -1; +// aibot->unk128 = 0; +// aibot->unk12c = 0; +// aibot->unk040 = 0; +// aibot->unk06c = 0; +// aibot->unk070 = 0; +// aibot->unk0e8 = 0; +// aibot->unk0e4 = 0; +// aibot->unk108 = 0; +// aibot->unk10c = 0; +// aibot->unk110 = 0; // // for (i = 0; i != 12; i++) { -// chr2d4->unk130[i] = -1; -// chr2d4->unk13c[i] = 4294967296; -// chr2d4->unk16c[i] = 0; -// chr2d4->unk178[i] = -1; -// chr2d4->unk1a8[i] = -1; +// aibot->unk130[i] = -1; +// aibot->unk13c[i] = 4294967296; +// aibot->unk16c[i] = 0; +// aibot->unk178[i] = -1; +// aibot->unk1a8[i] = -1; // } // -// chr2d4->unk1e8 = 0; -// chr2d4->unk208 = 0; -// chr2d4->unk210 = random(); -// chr2d4->unk20c = 0; -// chr2d4->unk2c8 = 0; -// chr2d4->unk09c_03 = 0; -// chr2d4->unk2cc = 0; -// chr2d4->unk2c4 = 0; +// aibot->unk1e8 = 0; +// aibot->unk208 = 0; +// aibot->unk210 = random(); +// aibot->unk20c = 0; +// aibot->unk2c8 = 0; +// aibot->unk09c_03 = 0; +// aibot->unk2cc = 0; +// aibot->unk2c4 = 0; // -// chr2d4->unk2d0 = random(); -// chr2d4->unk2d4 = random(); -// chr2d4->unk078 = 0; -// chr2d4->unk09c_07 = 0; -// chr2d4->unk050 = 0; -// chr2d4->unk09d = 0; +// aibot->unk2d0 = random(); +// aibot->aibot = random(); +// aibot->unk078 = 0; +// aibot->unk09c_07 = 0; +// aibot->unk050 = 0; +// aibot->unk09d = 0; // } // -// if (chr2d4->simulant->type == SIMTYPE_TURTLE || chr2d4->simulant->type == SIMTYPE_SHIELD) { +// if (aibot->simulant->type == SIMTYPE_TURTLE || aibot->simulant->type == SIMTYPE_SHIELD) { // chr->cshield = 8; // } // -// if (chr2d4->simulant->unk48 == 5) { -// chr2d4->unk064 &= ~1; +// if (aibot->simulant->unk48 == 5) { +// aibot->unk064 &= ~1; // // if (func0f198278()) { // chr->cshield = 8; // } // } // -// chr2d4->unk059 = 1; -// chr2d4->unk058 = 120; +// aibot->unk059 = 1; +// aibot->unk058 = 120; // } //} @@ -417,7 +417,7 @@ void mpInitSimulant(struct chrdata *chr, u8 full) f32 thing; struct prop *prop; struct defaultobj *obj; - struct chr2d4 *chr2d4 = chr->unk2d4; + struct aibot *aibot = chr->aibot; struct coord pos; s16 rooms[8]; @@ -435,18 +435,18 @@ void mpInitSimulant(struct chrdata *chr, u8 full) } } - if (chr2d4) { + if (aibot) { mpChrReset(chr, full); chrInitSplats(chr); thing = scenarioCallback2c(chr->chrwidth, &pos, rooms, chr->prop); chr->hidden |= CHRHFLAG_00100000; chrMoveToPos(chr, &pos, rooms, thing, true); - chr->unk2d4->unk0a4 = func0001ae44(chr->animdata); - chr->unk2d4->unk0a8 = 0; - chr->unk2d4->unk0ac = 0; - chr->unk2d4->unk0b0 = func0001ae44(chr->animdata); - chr->unk2d4->unk0b4 = 0; - chr->unk2d4->unk0b8 = 0; + chr->aibot->unk0a4 = func0001ae44(chr->animdata); + chr->aibot->unk0a8 = 0; + chr->aibot->unk0ac = 0; + chr->aibot->unk0b0 = func0001ae44(chr->animdata); + chr->aibot->unk0b4 = 0; + chr->aibot->unk0b8 = 0; func0f02e9a0(chr, 0); } } @@ -469,7 +469,7 @@ u32 propobjHandlePickupByAibot(struct prop *prop, struct chrdata *chr) { struct defaultobj *obj = prop->obj; - if (!chr || !chr->unk2d4) { + if (!chr || !chr->aibot) { return 0; } @@ -487,7 +487,7 @@ u32 propobjHandlePickupByAibot(struct prop *prop, struct chrdata *chr) dprint(); if (qty) { - aibotGiveAmmo(chr->unk2d4, crate->ammotype, qty); + aibotGiveAmmo(chr->aibot, crate->ammotype, qty); } func0f0939f8(NULL, prop, 0xea, -1, @@ -536,7 +536,7 @@ u32 propobjHandlePickupByAibot(struct prop *prop, struct chrdata *chr) } if (qty) { - aibotGiveAmmo(chr->unk2d4, i + 1, qty); + aibotGiveAmmo(chr->aibot, i + 1, qty); } } @@ -562,7 +562,7 @@ u32 propobjHandlePickupByAibot(struct prop *prop, struct chrdata *chr) qty = weaponGetPickupAmmoQty(weapon); if (qty) { - func0f199e3c(chr->unk2d4, weapon->weapon_id, weapon->dragonthrown, qty); + func0f199e3c(chr->aibot, weapon->weapon_id, weapon->dragonthrown, qty); } if (itemtype) { @@ -1330,8 +1330,8 @@ glabel var7f1b8eb4 u32 func0f1915b4(struct chrdata *chr) { - if (chr->unk2d4) { - return chr->unk2d4->unk020; + if (chr->aibot) { + return chr->aibot->unk020; } return g_Vars.players[propGetPlayerNum(chr->prop)]->unk0638; @@ -2404,51 +2404,51 @@ char *mpGetBotCommandName(s32 command) void mpAibotApplyAttack(struct chrdata *chr, struct prop *prop) { - chr->unk2d4->command = AIBOTCMD_ATTACK; - chr->unk2d4->attackpropnum = prop - g_Vars.props; - chr->unk2d4->unk0d8 = 1; + chr->aibot->command = AIBOTCMD_ATTACK; + chr->aibot->attackpropnum = prop - g_Vars.props; + chr->aibot->unk0d8 = 1; } void mpAibotApplyFollow(struct chrdata *chr, struct prop *prop) { - chr->unk2d4->command = AIBOTCMD_FOLLOW; - chr->unk2d4->followprotectpropnum = prop - g_Vars.props; - chr->unk2d4->unk0d8 = 1; + chr->aibot->command = AIBOTCMD_FOLLOW; + chr->aibot->followprotectpropnum = prop - g_Vars.props; + chr->aibot->unk0d8 = 1; } void mpAibotApplyProtect(struct chrdata *chr, struct prop *prop) { - chr->unk2d4->command = AIBOTCMD_PROTECT; - chr->unk2d4->followprotectpropnum = prop - g_Vars.props; - chr->unk2d4->unk0d8 = 1; + chr->aibot->command = AIBOTCMD_PROTECT; + chr->aibot->followprotectpropnum = prop - g_Vars.props; + chr->aibot->unk0d8 = 1; } void mpAibotApplyDefend(struct chrdata *chr, struct coord *pos, s16 *room, f32 arg3) { - chr->unk2d4->command = AIBOTCMD_DEFEND; - chr->unk2d4->defendholdpos.x = pos->x; - chr->unk2d4->defendholdpos.y = pos->y; - chr->unk2d4->defendholdpos.z = pos->z; - roomsCopy(room, &chr->unk2d4->rooms[0]); - chr->unk2d4->unk098 = arg3; - chr->unk2d4->unk0d8 = 1; + chr->aibot->command = AIBOTCMD_DEFEND; + chr->aibot->defendholdpos.x = pos->x; + chr->aibot->defendholdpos.y = pos->y; + chr->aibot->defendholdpos.z = pos->z; + roomsCopy(room, &chr->aibot->rooms[0]); + chr->aibot->unk098 = arg3; + chr->aibot->unk0d8 = 1; } void mpAibotApplyHold(struct chrdata *chr, struct coord *pos, s16 *room, f32 arg3) { - chr->unk2d4->command = AIBOTCMD_HOLD; - chr->unk2d4->defendholdpos.x = pos->x; - chr->unk2d4->defendholdpos.y = pos->y; - chr->unk2d4->defendholdpos.z = pos->z; - roomsCopy(room, &chr->unk2d4->rooms[0]); - chr->unk2d4->unk098 = arg3; - chr->unk2d4->unk0d8 = 1; + chr->aibot->command = AIBOTCMD_HOLD; + chr->aibot->defendholdpos.x = pos->x; + chr->aibot->defendholdpos.y = pos->y; + chr->aibot->defendholdpos.z = pos->z; + roomsCopy(room, &chr->aibot->rooms[0]); + chr->aibot->unk098 = arg3; + chr->aibot->unk0d8 = 1; } void mpAibotApplyScenarioCommand(struct chrdata *chr, u32 command) { - chr->unk2d4->command = command; - chr->unk2d4->unk0d8 = 1; + chr->aibot->command = command; + chr->aibot->unk0d8 = 1; } GLOBAL_ASM( @@ -3524,13 +3524,13 @@ bool mpIsChrFollowedByChr(struct chrdata *leader, struct chrdata *follower) bool result = true; while (true) { - struct chr2d4 *chr2d4 = follower->unk2d4; + struct aibot *aibot = follower->aibot; - if (!chr2d4 || follower->myaction[0] != MA_AIBOTFOLLOW || chr2d4->followingplayernum < 0) { + if (!aibot || follower->myaction[0] != MA_AIBOTFOLLOW || aibot->followingplayernum < 0) { break; } - follower = g_MpPlayerChrs[chr2d4->followingplayernum]; + follower = g_MpPlayerChrs[aibot->followingplayernum]; if (follower == leader) { result = false; @@ -3546,7 +3546,7 @@ s32 func0f193530(struct chrdata *chr, f32 arg1) s32 result = -1; if (g_MpSetup.options & MPOPTION_TEAMSENABLED) { - if (chr->myaction[0] != MA_AIBOTFOLLOW && (random() % 100) < chr->unk2d4->unk000) { + if (chr->myaction[0] != MA_AIBOTFOLLOW && (random() % 100) < chr->aibot->unk000) { f32 bestvalue = 0; s32 bestindex = -1; s32 i; @@ -3556,7 +3556,7 @@ s32 func0f193530(struct chrdata *chr, f32 arg1) !chrIsDead(g_MpPlayerChrs[i]) && chr->team == g_MpPlayerChrs[i]->team && mpIsChrFollowedByChr(chr, g_MpPlayerChrs[i])) { - f32 value = chr->unk2d4->unk13c[i]; + f32 value = chr->aibot->unk13c[i]; if (bestindex < 0 || value < bestvalue) { bestindex = i; @@ -4740,7 +4740,7 @@ s32 mpCountAibotsWithCommand(struct chrdata *self, u32 command, bool includeself for (i = PLAYERCOUNT(); i < g_MpNumPlayers; i++) { if (self->team == g_MpPlayerChrs[i]->team) { if (includeself || self != g_MpPlayerChrs[i]) { - if (command == g_MpPlayerChrs[i]->unk2d4->command) { + if (command == g_MpPlayerChrs[i]->aibot->command) { count++; } } @@ -4760,8 +4760,8 @@ s32 scenarioCtcIsChrsTokenHeld(struct chrdata *chr) bool func0f19489c(struct chrdata *chr) { - if (chr->unk2d4->unk09c_01) { - if (chr->unk2d4->unk04f_00 == 0 || mpGetNumPlayerTeammates(chr) >= 2 || !scenarioCtcIsChrsTokenHeld(chr)) { + if (chr->aibot->unk09c_01) { + if (chr->aibot->unk04f_00 == 0 || mpGetNumPlayerTeammates(chr) >= 2 || !scenarioCtcIsChrsTokenHeld(chr)) { return true; } } @@ -4776,7 +4776,7 @@ s32 mpGetNumTeammatesDefendingHill(struct chrdata *bot) for (i = 0; i < g_MpNumPlayers; i++) { if (bot->team == g_MpPlayerChrs[i]->team && g_MpPlayerChrs[i]->prop->rooms[0] == g_ScenarioData.cbt.unk0e[0]) { - if (g_MpPlayerChrs[i]->unk2d4->command == AIBOTCMD_DEFHILL || g_MpPlayerChrs[i]->unk2d4->command == AIBOTCMD_HOLDHILL) { + if (g_MpPlayerChrs[i]->aibot->command == AIBOTCMD_DEFHILL || g_MpPlayerChrs[i]->aibot->command == AIBOTCMD_HOLDHILL) { count++; } } @@ -7902,11 +7902,11 @@ glabel var7f1b8fc8 void func0f197544(struct chrdata *chr) { bool pass = false; - struct chr2d4 *chr2d4 = chr->unk2d4; + struct aibot *aibot = chr->aibot; if (chr->myaction[0] == MA_AIBOTGETITEM) { if (chr->act_gopos.waypoints[chr->act_gopos.nextwaypointindex] == 0) { - struct prop *prop = chr2d4->prop; + struct prop *prop = aibot->prop; if (prop && !prop->parent && prop->timetoregen == 0) { if (prop->type == PROPTYPE_WEAPON || prop->type == PROPTYPE_OBJ) { @@ -7915,7 +7915,7 @@ void func0f197544(struct chrdata *chr) } } - chr2d4->unk0d8 = 1; + aibot->unk0d8 = 1; pass = true; } diff --git a/src/game/game_197600.c b/src/game/game_197600.c index 6285fc426..68f3d9ae3 100644 --- a/src/game/game_197600.c +++ b/src/game/game_197600.c @@ -598,7 +598,7 @@ u32 aibotGetInvItemType(struct chrdata *chr, u32 weaponnum) { struct invitem *item; - if (!chr || !chr->unk2d4) { + if (!chr || !chr->aibot) { return 0; } diff --git a/src/game/game_19aa80.c b/src/game/game_19aa80.c index 509b67486..a22db5f83 100644 --- a/src/game/game_19aa80.c +++ b/src/game/game_19aa80.c @@ -44,22 +44,22 @@ bool aiMpInitSimulants(void) bool ai0176(void) { u8 *cmd = g_Vars.ailist + g_Vars.aioffset; - struct chr2d4 *chr2d4; + struct aibot *aibot; /** * @bug: Missing return means a crash will occur if either of these are * null. */ - if (!g_Vars.chrdata || !g_Vars.chrdata->unk2d4) { + if (!g_Vars.chrdata || !g_Vars.chrdata->aibot) { g_Vars.aioffset += 3; //return false; } - chr2d4 = g_Vars.chrdata->unk2d4; + aibot = g_Vars.chrdata->aibot; - if (chr2d4->unk059 == 1) { + if (aibot->unk059 == 1) { g_Vars.aioffset = chraiGoToLabel(g_Vars.ailist, g_Vars.aioffset, cmd[2]); - chr2d4->unk059 = 0; + aibot->unk059 = 0; } else { g_Vars.aioffset += 3; } diff --git a/src/include/game/game_1999b0.h b/src/include/game/game_1999b0.h index c16f28678..e3d1816bd 100644 --- a/src/include/game/game_1999b0.h +++ b/src/include/game/game_1999b0.h @@ -9,8 +9,8 @@ u32 func0f199a40(void); u32 func0f199be4(void); u32 func0f199cb8(void); u32 func0f199d70(void); -void func0f199e3c(struct chr2d4 *chr2d4, u32 weaponnum, bool proxy, u32 qty); -void aibotGiveAmmo(struct chr2d4 *chr2d4, u32 ammotype, u32 qty); +void func0f199e3c(struct aibot *aibot, u32 weaponnum, bool proxy, u32 qty); +void aibotGiveAmmo(struct aibot *aibot, u32 ammotype, u32 qty); u32 func0f199f84(void); bool func0f19a29c(u32 value, bool fallback); u32 func0f19a2dc(u32 value); diff --git a/src/include/types.h b/src/include/types.h index ae539ac28..d0fca5d01 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -137,11 +137,11 @@ struct animdata { /*0x20*/ struct anim *anim; }; -struct chr2d4_01c { +struct aibot_01c { u32 unk00[33]; }; -struct chr2d4 { +struct aibot { /*0x000*/ u8 unk000; /*0x004*/ struct mpsim *simulant; /*0x008*/ u16 unk008; @@ -150,7 +150,7 @@ struct chr2d4 { /*0x010*/ struct prop *prop; /*0x014*/ u32 unk014; /*0x018*/ u32 unk018; - /*0x01c*/ struct chr2d4_01c *unk01c; + /*0x01c*/ struct aibot_01c *unk01c; /*0x020*/ u32 unk020; /*0x024*/ u32 unk024; /*0x028*/ u32 unk028; @@ -673,7 +673,7 @@ struct chrdata { /*0x2b4*/ u32 unk2b4; /*0x2b8*/ s16 oldrooms[8]; /*0x2c8*/ struct coord runfrompos; - /*0x2d4*/ struct chr2d4 *unk2d4; + /*0x2d4*/ struct aibot *aibot; /*0x2d8*/ s16 blurdrugamount; /*0x2da*/ u16 cloakpause; /*0x2dc*/ f32 drugheadsway;