SurvivorLegsBattleStations::FindBattleStation
0x00952490 · 1501 bytes · __thiscall
_ZN26SurvivorLegsBattleStations17FindBattleStationEP11SurvivorBotP13TerrorNavArea
Decompiled
undefined (3 params)
/* SurvivorLegsBattleStations::FindBattleStation(SurvivorBot*, TerrorNavArea*) */
TerrorNavArea * __thiscall
SurvivorLegsBattleStations::FindBattleStation
(SurvivorLegsBattleStations *this,SurvivorBot *param_1,TerrorNavArea *param_2)
{
char cVar1;
int iVar2;
CNavArea *pCVar3;
Vector *pVVar4;
uint uVar5;
TerrorNavArea *pTVar6;
undefined *puVar7;
CTerrorPlayer *pCVar8;
int *piVar9;
CBaseEntity *pCVar10;
int iVar11;
longdouble lVar12;
float fVar13;
float local_40;
int local_30 [8];
iVar2 = SurvivorBot::GetTeamSituation(param_1);
pCVar3 = (CNavArea *)(**(code **)(*(int *)param_1 + 0x52c))(param_1);
if (pCVar3 != (CNavArea *)0x0) {
lVar12 = (longdouble)CountdownTimer::Now();
if (*(float *)(this + 0x4838) <= (float)lVar12) {
lVar12 = (longdouble)RandomFloat(0x3f000000,0x40000000);
fVar13 = (float)lVar12;
lVar12 = (longdouble)CountdownTimer::Now();
if ((float)lVar12 + fVar13 != *(float *)(this + 0x4838)) {
(**(code **)(*(int *)(this + 0x4830) + 4))(this + 0x4830,this + 0x4838);
*(float *)(this + 0x4838) = (float)lVar12 + fVar13;
}
if (fVar13 != *(float *)(this + 0x4834)) {
(**(code **)(*(int *)(this + 0x4830) + 4))(this + 0x4830,this + 0x4834);
*(float *)(this + 0x4834) = fVar13;
}
local_30[0] = 0;
local_30[1] = 0;
local_30[2] = 0;
local_30[3] = 0;
local_30[4] = 0;
/* try { // try from 0095259c to 0095261a has its CatchHandler @ 00952a9e */
pVVar4 = (Vector *)(**(code **)(*(int *)(param_1 + 0x4028) + 0xd4))(param_1 + 0x4028);
SearchSurroundingAreas<FindBattlestationScan>
(pCVar3,pVVar4,(FindBattlestationScan *)local_30,-1.0,0,-1);
if (local_30[3] != 0) {
uVar5 = *(uint *)(iVar2 + 0x30);
if ((((uVar5 == 0xffffffff) ||
(puVar7 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc))
|| (*(uint *)(puVar7 + 8) != uVar5 >> 0xc)) ||
(*(CTerrorPlayer **)(puVar7 + 4) == (CTerrorPlayer *)0x0)) {
iVar2 = RandomInt(0,local_30[3] + -1);
param_2 = *(TerrorNavArea **)(local_30[0] + iVar2 * 4);
}
else {
/* try { // try from 009526c6 to 00952a72 has its CatchHandler @ 00952a9e */
cVar1 = CTerrorPlayer::IsStill(*(CTerrorPlayer **)(puVar7 + 4),1);
if (cVar1 != '\0') {
pCVar8 = (CTerrorPlayer *)0x0;
uVar5 = *(uint *)(iVar2 + 0x30);
if (((uVar5 != 0xffffffff) &&
(puVar7 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)
) && (*(uint *)(puVar7 + 8) == uVar5 >> 0xc)) {
pCVar8 = *(CTerrorPlayer **)(puVar7 + 4);
}
lVar12 = (longdouble)CTerrorPlayer::GetStillTime(pCVar8,1);
if (*(float *)(SurvivorBotBattlestationHumanHoldTime._28_4_ + 0x2c) <= (float)lVar12) {
if (param_2 == (TerrorNavArea *)0x0) {
uVar5 = *(uint *)(iVar2 + 0x30);
pTVar6 = param_2;
}
else {
pCVar10 = (CBaseEntity *)0x0;
fVar13 = *(float *)(SurvivorBotMaxBattlestationRangeFromHuman._28_4_ + 0x2c);
uVar5 = *(uint *)(iVar2 + 0x30);
if (((uVar5 != 0xffffffff) &&
(puVar7 = g_pEntityList + (uVar5 & 0xfff) * 0x10,
puVar7 != (undefined *)0xfffffffc)) && (*(uint *)(puVar7 + 8) == uVar5 >> 0xc))
{
pCVar10 = *(CBaseEntity **)(puVar7 + 4);
}
if (((byte)pCVar10[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar10);
uVar5 = *(uint *)(iVar2 + 0x30);
}
pTVar6 = (TerrorNavArea *)0x0;
if ((*(float *)(pCVar10 + 0x2e0) - *(float *)(param_2 + 0x2c)) *
(*(float *)(pCVar10 + 0x2e0) - *(float *)(param_2 + 0x2c)) +
(*(float *)(pCVar10 + 0x2e4) - *(float *)(param_2 + 0x30)) *
(*(float *)(pCVar10 + 0x2e4) - *(float *)(param_2 + 0x30)) +
(*(float *)(pCVar10 + 0x2e8) - *(float *)(param_2 + 0x34)) *
(*(float *)(pCVar10 + 0x2e8) - *(float *)(param_2 + 0x34)) <= fVar13 * fVar13) {
pTVar6 = param_2;
}
}
param_2 = pTVar6;
piVar9 = (int *)0x0;
if (((uVar5 != 0xffffffff) &&
(puVar7 = g_pEntityList + (uVar5 & 0xfff) * 0x10,
puVar7 != (undefined *)0xfffffffc)) && (*(uint *)(puVar7 + 8) == uVar5 >> 0xc)) {
piVar9 = *(int **)(puVar7 + 4);
}
pTVar6 = (TerrorNavArea *)(**(code **)(*piVar9 + 0x52c))(piVar9);
if (pTVar6 != (TerrorNavArea *)0x0) {
cVar1 = TerrorNavArea::IsPotentiallyVisible(pTVar6,param_2,false);
if ((cVar1 == '\0') || (param_2 == (TerrorNavArea *)0x0)) {
param_2 = (TerrorNavArea *)0x0;
local_40 = *(float *)(SurvivorBotMaxBattlestationRangeFromHuman._28_4_ + 0x2c) *
*(float *)(SurvivorBotMaxBattlestationRangeFromHuman._28_4_ + 0x2c);
}
else {
pCVar10 = (CBaseEntity *)0x0;
uVar5 = *(uint *)(iVar2 + 0x30);
if (((uVar5 != 0xffffffff) &&
(puVar7 = g_pEntityList + (uVar5 & 0xfff) * 0x10,
puVar7 != (undefined *)0xfffffffc)) && (*(uint *)(puVar7 + 8) == uVar5 >> 0xc)
) {
pCVar10 = *(CBaseEntity **)(puVar7 + 4);
}
if (((byte)pCVar10[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar10);
}
local_40 = ((*(float *)(pCVar10 + 0x2e8) - *(float *)(param_2 + 0x34)) *
(*(float *)(pCVar10 + 0x2e8) - *(float *)(param_2 + 0x34)) +
(*(float *)(pCVar10 + 0x2e0) - *(float *)(param_2 + 0x2c)) *
(*(float *)(pCVar10 + 0x2e0) - *(float *)(param_2 + 0x2c)) +
(*(float *)(pCVar10 + 0x2e4) - *(float *)(param_2 + 0x30)) *
(*(float *)(pCVar10 + 0x2e4) - *(float *)(param_2 + 0x30))) * 0.5;
}
if (0 < local_30[3]) {
iVar11 = 0;
do {
pCVar3 = *(CNavArea **)(local_30[0] + iVar11 * 4);
cVar1 = CNavArea::IsBlocked(pCVar3,2,false);
if (((cVar1 == '\0') && (*(int *)(pCVar3 + 0x70) < *(int *)(gpGlobals + 0x18)))
&& (cVar1 = IsOccupied(this,param_1,(TerrorNavArea *)pCVar3), cVar1 == '\0'))
{
pCVar10 = (CBaseEntity *)0x0;
uVar5 = *(uint *)(iVar2 + 0x30);
if (((uVar5 != 0xffffffff) &&
(puVar7 = g_pEntityList + (uVar5 & 0xfff) * 0x10,
puVar7 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar7 + 8) == uVar5 >> 0xc)) {
pCVar10 = *(CBaseEntity **)(puVar7 + 4);
}
if (((byte)pCVar10[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar10);
}
fVar13 = (*(float *)(pCVar10 + 0x2e4) - *(float *)(pCVar3 + 0x30)) *
(*(float *)(pCVar10 + 0x2e4) - *(float *)(pCVar3 + 0x30)) +
(*(float *)(pCVar10 + 0x2e8) - *(float *)(pCVar3 + 0x34)) *
(*(float *)(pCVar10 + 0x2e8) - *(float *)(pCVar3 + 0x34)) +
(*(float *)(pCVar10 + 0x2e0) - *(float *)(pCVar3 + 0x2c)) *
(*(float *)(pCVar10 + 0x2e0) - *(float *)(pCVar3 + 0x2c));
if ((fVar13 < local_40) &&
(cVar1 = TerrorNavArea::IsPotentiallyVisible
(pTVar6,(TerrorNavArea *)pCVar3,false), cVar1 != '\0'))
{
param_2 = (TerrorNavArea *)pCVar3;
local_40 = fVar13;
}
}
iVar11 = iVar11 + 1;
} while (iVar11 < local_30[3]);
}
}
}
}
}
}
local_30[3] = 0;
CUtlMemory<TerrorNavArea*,int>::Purge((CUtlMemory<TerrorNavArea*,int> *)local_30);
local_30[4] = local_30[0];
CUtlMemory<TerrorNavArea*,int>::Purge((CUtlMemory<TerrorNavArea*,int> *)local_30);
return param_2;
}
}
return param_2;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.