SurvivorLegsBattleStations::Update
0x00952ad0 · 1891 bytes · __thiscall
_ZN26SurvivorLegsBattleStations6UpdateEP11SurvivorBotf
Decompiled
undefined (3 params)
/* SurvivorLegsBattleStations::Update(SurvivorBot*, float) */
SurvivorLegsBattleStations * __thiscall
SurvivorLegsBattleStations::Update
(SurvivorLegsBattleStations *this,SurvivorBot *param_1,float param_2)
{
INextBot *pIVar1;
float fVar2;
CNavArea *this_00;
uint uVar3;
CBaseEntity *pCVar4;
char cVar5;
bool bVar6;
undefined4 *puVar7;
CNavArea *pCVar8;
int iVar9;
undefined4 uVar10;
undefined *puVar11;
int *piVar12;
longdouble lVar13;
float fVar14;
float fVar15;
float fVar16;
undefined **local_2c;
INextBot *local_28;
undefined4 local_24;
undefined1 local_20;
undefined1 local_1f;
cVar5 = CDirector::IsFinale(TheDirector);
if (cVar5 != '\0') {
piVar12 = *(int **)(TheDirector + 0x638);
if (*piVar12 == 5) {
if (((char)piVar12[0x44] != '\0') && (*(char *)((int)piVar12 + 0x111) == '\0'))
goto LAB_00952b72;
}
else if (piVar12[1] == 6) {
LAB_00952b72:
cVar5 = SurvivorBot::IsAllowedToMoveToRescueVehicle((SurvivorBot *)param_2);
if (cVar5 != '\0') {
puVar7 = ::operator_new(0x4818);
puVar7[8] = 0;
puVar7[9] = 0;
puVar7[10] = 0;
puVar7[3] = 0;
puVar7[4] = 0;
puVar7[5] = 0;
puVar7[6] = 0;
puVar7[7] = 0;
puVar7[2] = 0;
*(undefined1 *)(puVar7 + 0xc) = 0;
*(undefined1 *)((int)puVar7 + 0x31) = 0;
puVar7[0xb] = 0;
*puVar7 = &PTR__SurvivorLegsMeetRescueVehicleArrival_00d0b1e8;
puVar7[1] = &PTR__SurvivorLegsMeetRescueVehicleArrival_00d0b350;
/* try { // try from 00952cf8 to 00952cfc has its CatchHandler @ 0095325a */
PathFollower::PathFollower((PathFollower *)(puVar7 + 0xd));
*(undefined4 *)this = 1;
*(undefined4 **)(this + 4) = puVar7;
*(char **)(this + 8) = "Moving to meet the incoming rescue vehicle";
return this;
}
}
}
cVar5 = CDirector::IsFinale(TheDirector);
if (((cVar5 != '\0') && (cVar5 = CDirector::IsFinaleVehicleReady(TheDirector), cVar5 != '\0')) &&
(cVar5 = SurvivorBot::IsAllowedToMoveToRescueVehicle((SurvivorBot *)param_2), cVar5 != '\0')) {
puVar7 = ::operator_new(0x4814);
puVar7[8] = 0;
puVar7[9] = 0;
puVar7[10] = 0;
puVar7[3] = 0;
puVar7[4] = 0;
puVar7[5] = 0;
puVar7[6] = 0;
puVar7[7] = 0;
puVar7[2] = 0;
*(undefined1 *)(puVar7 + 0xc) = 0;
*(undefined1 *)((int)puVar7 + 0x31) = 0;
puVar7[0xb] = 0;
*puVar7 = &PTR__SurvivorLegsEnterRescueVehicle_00d0b388;
puVar7[1] = &PTR__SurvivorLegsEnterRescueVehicle_00d0b4f0;
/* try { // try from 00952c60 to 00952c64 has its CatchHandler @ 00953274 */
PathFollower::PathFollower((PathFollower *)(puVar7 + 0xd));
*(undefined4 *)this = 1;
*(undefined4 **)(this + 4) = puVar7;
*(char **)(this + 8) = "The rescue vehicle is here!!!";
return this;
}
piVar12 = *(int **)(TheDirector + 0x638);
if (*piVar12 == 5) {
if (((char)piVar12[0x44] != '\0') && (*(char *)((int)piVar12 + 0x111) == '\0'))
goto LAB_00952ba2;
}
else if (piVar12[1] == 6) {
LAB_00952ba2:
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "The battle is over, move on";
return this;
}
if (0 < *(int *)(TheDirector + 0x1c0)) {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "A Tank is coming";
return this;
}
pCVar8 = (CNavArea *)(**(code **)(*(int *)param_2 + 0x52c))(param_2);
if (pCVar8 == (CNavArea *)0x0) {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "I\'m off the mesh";
return this;
}
iVar9 = SurvivorBot::GetPace((SurvivorBot *)param_2);
if (iVar9 == 0) goto LAB_00952dd2;
if (iVar9 == 1) {
(**(code **)(*(int *)param_2 + 0x988))(param_2,0xbf800000);
}
iVar9 = SurvivorBot::GetTeamSituation((SurvivorBot *)param_2);
this_00 = *(CNavArea **)(param_1 + 0x4814);
if (this_00 == (CNavArea *)0x0) {
iVar9 = FindBattleStation((SurvivorLegsBattleStations *)param_1,(SurvivorBot *)param_2,
(TerrorNavArea *)0x0);
*(int *)(param_1 + 0x4814) = iVar9;
if (iVar9 == 0) {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "No practical battlestation found";
return this;
}
goto LAB_00952dd2;
}
if (pCVar8 == this_00) {
lVar13 = (longdouble)CountdownTimer::Now();
if (*(float *)(param_1 + 0x4820) <= (float)lVar13) {
uVar3 = *(uint *)(iVar9 + 0x30);
if (((uVar3 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar11 + 8) == uVar3 >> 0xc &&
(pCVar4 = *(CBaseEntity **)(puVar11 + 4), pCVar4 != (CBaseEntity *)0x0)))) {
fVar2 = *(float *)(SurvivorBotBattlestationGiveUpRangeFromHuman._28_4_ + 0x2c);
iVar9 = *(int *)(param_1 + 0x4814);
if (((byte)pCVar4[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar4);
}
fVar14 = *(float *)(pCVar4 + 0x2e0) - *(float *)(iVar9 + 0x2c);
fVar16 = *(float *)(pCVar4 + 0x2e4) - *(float *)(iVar9 + 0x30);
fVar15 = *(float *)(pCVar4 + 0x2e8) - *(float *)(iVar9 + 0x34);
if (fVar2 * fVar2 < fVar14 * fVar14 + fVar16 * fVar16 + fVar15 * fVar15) {
*(undefined4 *)(param_1 + 0x4814) = 0;
}
}
uVar10 = FindBattleStation((SurvivorLegsBattleStations *)param_1,(SurvivorBot *)param_2,
*(TerrorNavArea **)(param_1 + 0x4814));
*(undefined4 *)(param_1 + 0x4814) = uVar10;
lVar13 = (longdouble)RandomFloat(0x3f000000,0x40000000);
CountdownTimer::Start((CountdownTimer *)(param_1 + 0x4818),(float)lVar13);
}
goto LAB_00952dd2;
}
cVar5 = CNavArea::IsBlocked(this_00,2,false);
if (((cVar5 == '\0') &&
(*(int *)(*(TerrorNavArea **)(param_1 + 0x4814) + 0x70) < *(int *)(gpGlobals + 0x18))) &&
(cVar5 = IsOccupied((SurvivorLegsBattleStations *)param_1,(SurvivorBot *)param_2,
*(TerrorNavArea **)(param_1 + 0x4814)), cVar5 == '\0')) {
uVar3 = *(uint *)(iVar9 + 0x30);
if (((uVar3 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
((*(uint *)(puVar11 + 8) == uVar3 >> 0xc &&
(pCVar4 = *(CBaseEntity **)(puVar11 + 4), pCVar4 != (CBaseEntity *)0x0)))) {
fVar2 = *(float *)(SurvivorBotMaxBattlestationRangeFromHuman._28_4_ + 0x2c);
iVar9 = *(int *)(param_1 + 0x4814);
if (((byte)pCVar4[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar4);
}
fVar16 = *(float *)(pCVar4 + 0x2e0) - *(float *)(iVar9 + 0x2c);
fVar14 = *(float *)(pCVar4 + 0x2e4) - *(float *)(iVar9 + 0x30);
fVar15 = *(float *)(pCVar4 + 0x2e8) - *(float *)(iVar9 + 0x34);
if (fVar2 * fVar2 < fVar14 * fVar14 + fVar16 * fVar16 + fVar15 * fVar15) goto LAB_00952dc5;
}
lVar13 = (longdouble)CountdownTimer::Now();
if (*(float *)(param_1 + 0x482c) <= (float)lVar13) {
piVar12 = (int *)(**(code **)(*(int *)param_2 + 0x9a0))(param_2);
cVar5 = (**(code **)(*piVar12 + 0xd4))(piVar12);
if (cVar5 == '\0') {
CountdownTimer::Start((CountdownTimer *)(param_1 + 0x4824),2.0);
local_2c = &PTR_operator___00d09770;
pIVar1 = (INextBot *)((int)param_2 + 0x4028);
local_28 = pIVar1;
local_24 = (**(code **)(*(int *)((int)param_2 + 0x4028) + 0xc0))(pIVar1);
piVar12 = (int *)(**(code **)(*(int *)((int)param_2 + 0x4028) + 200))(pIVar1);
iVar9 = (**(code **)(*piVar12 + 0xb8))(piVar12,pIVar1);
local_20 = iVar9 != 0;
local_1f = 0;
bVar6 = Path::Compute<SurvivorBotPathCost>
((Path *)(param_1 + 0x34),pIVar1,
(Vector *)(*(int *)(param_1 + 0x4814) + 0x2c),
(SurvivorBotPathCost *)&local_2c,0.0);
if (!bVar6) {
*(undefined4 *)this = 3;
*(undefined4 *)(this + 4) = 0;
*(char **)(this + 8) = "No path to battlestation";
return this;
}
}
}
PathFollower::Update((PathFollower *)(param_1 + 0x34),(INextBot *)((int)param_2 + 0x4028));
lVar13 = (longdouble)RandomFloat(0x40a00000,0x41200000);
fVar2 = (float)lVar13;
lVar13 = (longdouble)CountdownTimer::Now();
if ((float)lVar13 + fVar2 != *(float *)(param_1 + 0x4820)) {
(**(code **)(*(int *)(param_1 + 0x4818) + 4))(param_1 + 0x4818,param_1 + 0x4820);
*(float *)(param_1 + 0x4820) = (float)lVar13 + fVar2;
}
if (fVar2 != *(float *)(param_1 + 0x481c)) {
(**(code **)(*(int *)(param_1 + 0x4818) + 4))(param_1 + 0x4818,param_1 + 0x481c);
*(float *)(param_1 + 0x481c) = fVar2;
}
}
else {
LAB_00952dc5:
*(undefined4 *)(param_1 + 0x4814) = 0;
}
LAB_00952dd2:
*(undefined4 *)this = 0;
*(undefined4 *)(this + 4) = 0;
*(undefined4 *)(this + 8) = 0;
return this;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.