ZombieManager::SpawnMob
0x00a5a990 · 572 bytes · __thiscall
_ZN13ZombieManager8SpawnMobEi
Decompiled
undefined (2 params)
/* ZombieManager::SpawnMob(int) */
void __thiscall ZombieManager::SpawnMob(ZombieManager *this,int param_1)
{
CDirector *pCVar1;
int iVar2;
longdouble lVar3;
uint local_18;
int local_14;
undefined4 local_10;
UTIL_LogPrintf("%3.2f: (MOB) SpawnMob requested of size %d.\n",(double)*(float *)(gpGlobals + 0xc)
,param_1);
pCVar1 = TheDirector;
*(int *)(this + 0x210) = *(int *)(this + 0x210) + param_1;
iVar2 = CDirector::GetMaxPendingMobCount(pCVar1);
if (iVar2 < 1) {
iVar2 = *(int *)(this + 0x210);
}
else {
if (*(int *)(this + 0x210) < iVar2) {
iVar2 = *(int *)(this + 0x210);
}
*(int *)(this + 0x210) = iVar2;
}
UTIL_LogPrintf("%3.2f: (MOB) SpawnMob pending count is now %d.\n",
(double)*(float *)(gpGlobals + 0xc),iVar2);
if (*(int *)(ZombieMobMinNotifyCount._28_4_ + 0x30) <= *(int *)(this + 0x210)) {
local_18 = local_18 & 0xffffff00;
ForEachTerrorPlayer<MobAlert>((MobAlert *)&local_18);
}
iVar2 = CDirector::GetScriptValue(TheDirector,"PreferredMobDirection",-1);
*(int *)(this + 0x214) = iVar2;
if (iVar2 == 10) {
CDirector::GetScriptValue
((MobSpawnMusic *)&local_18,TheDirector,"PreferredMobPosition",
*(undefined4 *)(this + 0x218),*(undefined4 *)(this + 0x21c),
*(undefined4 *)(this + 0x220));
pCVar1 = TheDirector;
*(uint *)(this + 0x218) = local_18;
*(int *)(this + 0x21c) = local_14;
*(undefined4 *)(this + 0x220) = local_10;
lVar3 = (longdouble)
CDirector::GetScriptValue(pCVar1,"PreferredMobPositionRange",*(float *)(this + 0x224));
iVar2 = *(int *)(this + 0x214);
*(float *)(this + 0x224) = (float)lVar3;
}
if (iVar2 == -1) {
if ((**(int **)(TheDirector + 0x638) == 1) && ((*(int **)(TheDirector + 0x638))[1] != 0x11)) {
*(undefined4 *)(this + 0x214) = 7;
iVar2 = 7;
}
else {
lVar3 = (longdouble)RandomFloat(0,0x42c80000);
if ((float)lVar3 < *(float *)(ZombieSpawnMobsBehindChance._28_4_ + 0x2c)) {
*(undefined4 *)(this + 0x214) = 1;
iVar2 = 1;
}
else {
*(undefined4 *)(this + 0x214) = 0;
iVar2 = 0;
}
}
}
local_18 = *(uint *)(this + 0x210);
*(undefined4 *)(this + 0x1f0) = 0;
*(undefined4 *)(this + 0x1dc) = 0;
local_14 = iVar2;
ForEachTerrorPlayer<MobSpawnMusic>((MobSpawnMusic *)&local_18);
CL4DGameStats::Event_MobSpawned((CL4DGameStats *)CL4D_GameStats);
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.