TerrorNavArea::MaintainWanderingPopulation
0x0097a8d0 · 1437 bytes · __thiscall
_ZN13TerrorNavArea27MaintainWanderingPopulationEv
Decompiled
undefined (1 param)
/* TerrorNavArea::MaintainWanderingPopulation() */
void __thiscall TerrorNavArea::MaintainWanderingPopulation(TerrorNavArea *this)
{
TerrorNavArea *pTVar1;
char cVar2;
int iVar3;
int iVar4;
int iVar5;
int *piVar6;
undefined4 uVar7;
uint uVar8;
int iVar9;
int in_GS_OFFSET;
CUtlMemory<TerrorNavArea*,int> *this_00;
Vector *pVVar10;
TerrorNavArea *local_60;
undefined4 local_5c;
float local_58;
TerrorNavArea *local_54;
undefined4 local_50;
float local_4c;
TerrorNavArea *local_48;
undefined4 local_44;
float local_40;
TerrorNavArea *local_3c;
undefined4 local_38;
float local_34;
int local_30;
TerrorNavArea *local_2c;
char local_28 [8];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (*(int *)(director_output_population_visits._28_4_ + 0x30) != 0) {
iVar3 = *(int *)(gpGlobals + 4);
if (iVar3 == MaintainWanderingPopulation()::frameCounted) {
MaintainWanderingPopulation()::frameCount = MaintainWanderingPopulation()::frameCount + 1;
}
else {
if (MaintainWanderingPopulation()::frameCount != 0) {
Msg("MWP %d: %d\n",MaintainWanderingPopulation()::frameCounted,
MaintainWanderingPopulation()::frameCount);
iVar3 = *(int *)(gpGlobals + 4);
}
MaintainWanderingPopulation()::frameCount = 1;
MaintainWanderingPopulation()::frameCounted = iVar3;
}
}
this_00 = (CUtlMemory<TerrorNavArea*,int> *)TheDirector;
cVar2 = CDirector::AreWanderersAllowed(TheDirector);
if (cVar2 == '\0') {
*(undefined4 *)(this + 0x128) = 0;
}
else if (((0 < *(int *)(this + 0x128)) &&
(this_00 = (CUtlMemory<TerrorNavArea*,int> *)TheDirector,
cVar2 = CDirector::IsBackgroundMap(), cVar2 == '\0')) &&
(cVar2 = CTerrorGameRules::IsSurvivalMode(), cVar2 == '\0')) {
this_00 = (CUtlMemory<TerrorNavArea*,int> *)TheDirector;
cVar2 = CDirector::IsFinale(TheDirector);
if (((cVar2 == '\0') &&
(this_00 = (CUtlMemory<TerrorNavArea*,int> *)this,
cVar2 = IsCleared(this,(CTerrorPlayer *)0x0), cVar2 == '\0')) &&
(this[0x7d] == (TerrorNavArea)0x0)) {
this_00 = (CUtlMemory<TerrorNavArea*,int> *)TheDirector;
iVar3 = CDirector::GetCommonInfectedLimit(TheDirector);
if (*(int *)(this + 0x128) != 0) {
pVVar10 = (Vector *)&local_60;
while( true ) {
this_00 = *(CUtlMemory<TerrorNavArea*,int> **)(TheDirector + 0x628);
iVar4 = CDirectorTacticalServices::GetCommonInfectedCount
((CDirectorTacticalServices *)this_00,0);
if (iVar3 <= iVar4) break;
FindRandomSpot();
local_54 = local_60;
local_50 = local_5c;
local_4c = local_58 + 1.0;
/* try { // try from 0097ab59 to 0097ab5d has its CatchHandler @ 0097ae8f */
cVar2 = CDirectorTacticalServices::IsVisibleToTeam
(*(CDirectorTacticalServices **)(TheDirector + 0x628),
(Vector *)&local_54,2,2,0.0,this,(CBaseEntity *)0x0);
if (cVar2 == '\0') {
local_48 = local_60;
local_44 = local_5c;
local_40 = local_58 + 35.5;
/* try { // try from 0097ac11 to 0097ac15 has its CatchHandler @ 0097ae9e */
cVar2 = CDirectorTacticalServices::IsVisibleToTeam
(*(CDirectorTacticalServices **)(TheDirector + 0x628),
(Vector *)&local_48,2,2,0.0,this,(CBaseEntity *)0x0);
if (cVar2 != '\0') goto LAB_0097ab62;
local_3c = local_60;
local_38 = local_5c;
local_34 = local_58 + 56.8;
/* try { // try from 0097ac7d to 0097ac81 has its CatchHandler @ 0097ae9c */
cVar2 = CDirectorTacticalServices::IsVisibleToTeam
(*(CDirectorTacticalServices **)(TheDirector + 0x628),
(Vector *)&local_3c,2,2,0.0,this,(CBaseEntity *)0x0);
if (cVar2 != '\0') goto LAB_0097ab62;
}
else {
LAB_0097ab62:
cVar2 = CDirector::IsLocationFoggedToSurvivors(TheDirector,pVVar10);
if (cVar2 == '\0') {
MarkAreaCleared(this,(CTerrorPlayer *)0x0);
this_00 = (CUtlMemory<TerrorNavArea*,int> *)this;
if (*(int *)(ZombieDebug._28_4_ + 0x30) != 0) {
NDebugOverlay::Cross3D(pVVar10,5.0,0,0xff,0xff,true,15.0);
this_00 = (CUtlMemory<TerrorNavArea*,int> *)pVVar10;
}
break;
}
}
this_00 = (CUtlMemory<TerrorNavArea*,int> *)TheZombieManager;
iVar4 = ZombieManager::SpawnCommonZombie(TheZombieManager,this,pVVar10,0);
if (iVar4 == 0) {
this_00 = (CUtlMemory<TerrorNavArea*,int> *)&local_3c;
local_3c = (TerrorNavArea *)0x0;
iVar3 = 0;
local_38 = 0;
local_34 = 0.0;
local_30 = 0;
local_2c = (TerrorNavArea *)0x0;
do {
piVar6 = *(int **)(this + iVar3 * 4 + 0x58);
iVar4 = *piVar6;
if (0 < iVar4) {
iVar9 = 0;
do {
if (iVar4 < 1) {
LAB_0097acf2:
local_48 = (TerrorNavArea *)0x0;
}
else {
iVar5 = 0;
if (iVar9 != 0) {
do {
iVar5 = iVar5 + 1;
if (iVar5 == iVar4) goto LAB_0097acf2;
} while (iVar5 != iVar9);
}
local_48 = (TerrorNavArea *)piVar6[iVar5 * 2 + 1];
}
/* try { // try from 0097acfa to 0097adc8 has its CatchHandler @ 0097ae7a */
cVar2 = IsValidForWanderingPopulation(local_48);
if (cVar2 != '\0') {
CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>>::InsertBefore
((CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>> *)this_00,
local_30,&local_48);
}
piVar6 = *(int **)(this + iVar3 * 4 + 0x58);
iVar9 = iVar9 + 1;
iVar4 = *piVar6;
} while (iVar9 < iVar4);
}
iVar3 = iVar3 + 1;
} while (iVar3 != 4);
if (0 < local_30) {
iVar3 = RandomInt(0,local_30 + -1);
iVar3 = *(int *)(local_3c + iVar3 * 4);
*(int *)(iVar3 + 0x128) = *(int *)(iVar3 + 0x128) + 1;
uVar7 = 0;
if (-1 < *(int *)(iVar3 + 0x128)) {
uVar7 = *(undefined4 *)(iVar3 + 0x128);
}
*(undefined4 *)(iVar3 + 0x128) = uVar7;
uVar7 = ZombieDebug._28_4_;
*(int *)(this + 0x128) = *(int *)(this + 0x128) + -1;
if (*(int *)(uVar7 + 0x30) != 0) {
/* try { // try from 0097ae70 to 0097ae74 has its CatchHandler @ 0097ae7a */
NDebugOverlay::HorzArrow
((Vector *)(this + 0x2c),(Vector *)(iVar3 + 0x2c),5.0,0xff,0,0,0xff,true,
15.0);
}
}
local_30 = 0;
CUtlMemory<TerrorNavArea*,int>::Purge(this_00);
local_2c = local_3c;
CUtlMemory<TerrorNavArea*,int>::Purge(this_00);
break;
}
pTVar1 = this + 0x128;
*(int *)pTVar1 = *(int *)pTVar1 + -1;
if (*(int *)pTVar1 == 0) break;
}
}
}
else if (*(int *)(ZombieDebug._28_4_ + 0x30) != 0) {
this_00 = (CUtlMemory<TerrorNavArea*,int> *)(this + 0x2c);
NDebugOverlay::Cross3D((Vector *)this_00,5.0,0xff,0,0,true,15.0);
cVar2 = CDirector::IsFinale(TheDirector);
if (cVar2 != '\0') {
local_28[0] = 'F';
}
uVar8 = (uint)(cVar2 != '\0');
cVar2 = IsCleared(this,(CTerrorPlayer *)0x0);
if (cVar2 != '\0') {
local_28[uVar8] = 'N';
uVar8 = uVar8 + 1;
}
if (this[0x7d] != (TerrorNavArea)0x0) {
local_28[uVar8] = 'V';
uVar8 = uVar8 + 1;
}
local_28[uVar8] = '\0';
NDebugOverlay::Text((Vector *)this_00,local_28,false,15.0);
}
}
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail(this_00);
}
return;
}
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.