ZombieManager::SpawnCommonZombie
0x00a59610 · 2315 bytes · __thiscall
_ZN13ZombieManager17SpawnCommonZombieEP13TerrorNavAreaRK6VectorNS_28CommonInfectedSpawnDirectiveE
Decompiled
undefined (4 params)
/* ZombieManager::SpawnCommonZombie(TerrorNavArea*, Vector const&,
ZombieManager::CommonInfectedSpawnDirective) */
CBaseEntity * __thiscall
ZombieManager::SpawnCommonZombie(ZombieManager *this,int param_1,float *param_2,int param_4)
{
float fVar1;
float fVar2;
float fVar3;
CBaseEntity *this_00;
int iVar4;
int iVar5;
undefined4 uVar6;
longdouble lVar7;
float local_e8;
float local_e4;
float local_e0;
undefined **local_dc [4];
float local_cc;
float local_c8;
float local_c4;
float local_bc;
float local_b8;
float local_b4;
undefined4 local_ac;
undefined4 local_a8;
undefined4 local_a4;
undefined4 local_9c;
undefined4 local_98;
undefined4 local_94;
undefined4 local_8c;
undefined1 local_88;
undefined1 local_87;
Vector local_70 [12];
float local_64;
float local_60;
float local_5c;
float local_44;
byte local_3c;
char local_39;
if (this[4] != (ZombieManager)0x0) {
CTraceFilterSimple::CTraceFilterSimple
((CTraceFilterSimple *)local_dc,(IHandleEntity *)0x0,8,
(_func_bool_IHandleEntity_ptr_int *)0x0);
local_87 = 0;
local_c4 = param_2[2] + 35.0;
local_88 = 0;
local_dc[0] = &PTR_ShouldHitEntity_00d2aa08;
local_cc = *param_2;
local_bc = 0.0;
local_c8 = param_2[1];
local_b8 = 0.0;
local_b4 = 0.0;
local_8c = 0;
local_9c = 0x41700000;
local_98 = 0x41700000;
local_94 = 0x420c0000;
local_ac = 0;
local_a8 = 0;
local_a4 = 0xc20c0000;
(**(code **)(*enginetrace + 0x14))
(enginetrace,&local_cc,0x202420b,(CTraceFilterSimple *)local_dc,local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_70,(Vector *)&local_64,0xff,0xff,0,true,-1.0);
}
if ((local_39 != '\0') || (local_44 < 1.0)) {
if ((SpawnCommonZombie(TerrorNavArea*,Vector_const&,ZombieManager::CommonInfectedSpawnDirective)
::vStepHeight == '\0') &&
(iVar4 = __cxa_guard_acquire(&SpawnCommonZombie(TerrorNavArea*,Vector_const&,ZombieManager::CommonInfectedSpawnDirective)
::vStepHeight), iVar4 != 0)) {
SpawnCommonZombie(TerrorNavArea*,Vector_const&,ZombieManager::CommonInfectedSpawnDirective)
::vStepHeight = 0.0;
DAT_01028514 = 0.0;
DAT_01028518 = 18.0;
__cxa_guard_release(&SpawnCommonZombie(TerrorNavArea*,Vector_const&,ZombieManager::CommonInfectedSpawnDirective)
::vStepHeight);
}
local_8c = 0;
local_88 = 0;
local_9c = 0x41700000;
local_98 = 0x41700000;
local_cc = SpawnCommonZombie(TerrorNavArea*,Vector_const&,ZombieManager::CommonInfectedSpawnDirective)
::vStepHeight + *param_2;
local_94 = 0x420c0000;
local_c8 = DAT_01028514 + param_2[1];
local_ac = 0;
local_a8 = 0;
local_bc = *param_2 - local_cc;
local_b8 = param_2[1] - local_c8;
local_a4 = 0xc20c0000;
local_c4 = DAT_01028518 + param_2[2];
local_b4 = param_2[2] - local_c4;
local_c4 = local_c4 + 35.0;
local_87 = local_bc * local_bc + local_b8 * local_b8 + local_b4 * local_b4 != 0.0;
(**(code **)(*enginetrace + 0x14))
(enginetrace,&local_cc,0x202420b,(CTraceFilterSimple *)local_dc,local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_70,(Vector *)&local_64,0xff,0xff,0,true,-1.0);
}
if ((local_39 != '\0') || (local_44 == 0.0)) {
if (*(int *)(ZombieDebug._28_4_ + 0x30) == 0) {
return (CBaseEntity *)0x0;
}
Msg("%3.2f: SpawnCommonZombie: Spot blocked (%.0f, %.0f, %.0f)\n",
(double)*(float *)(gpGlobals + 0xc),(double)local_e8,(double)local_e4,(double)local_e0);
NDebugOverlay::Cross3D((Vector *)&local_e8,5.0,0xff,0xff,0,true,120.0);
NDebugOverlay::Text((Vector *)&local_e8,"Blkd",false,15.0);
return (CBaseEntity *)0x0;
}
local_e8 = local_64;
local_e4 = local_60;
local_e0 = local_5c;
}
else {
local_e8 = *param_2;
local_e4 = param_2[1];
local_e0 = param_2[2];
}
fVar3 = local_e0;
fVar2 = local_e4;
fVar1 = local_e8;
if (*(int *)(ZombiePreventBurrowing._28_4_ + 0x30) != 0) {
local_87 = 1;
local_88 = 0;
local_c4 = local_e0 + 35.0;
local_bc = 0.0;
local_b8 = 0.0;
local_b4 = 500.0;
local_8c = 0;
local_9c = 0x41700000;
local_98 = 0x41700000;
local_94 = 0x420c0000;
local_cc = local_e8;
local_c8 = local_e4;
local_ac = 0x80000000;
local_a8 = 0x80000000;
local_a4 = 0xc20c0000;
(**(code **)(*enginetrace + 0x14))
(enginetrace,&local_cc,0x2420b,(CTraceFilterSimple *)local_dc,local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_70,(Vector *)&local_64,0xff,0xff,0,true,-1.0);
}
if (0.0 < local_44) {
local_88 = 0;
local_8c = 0;
local_cc = local_64;
local_b8 = fVar2 - local_60;
local_9c = 0x41700000;
local_bc = fVar1 - local_64;
local_98 = 0x41700000;
local_c8 = local_60;
local_b4 = fVar3 - local_5c;
local_94 = 0x420c0000;
local_ac = 0x80000000;
local_a8 = 0x80000000;
local_a4 = 0xc20c0000;
local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
local_c4 = local_5c + 35.0;
(**(code **)(*enginetrace + 0x14))
(enginetrace,&local_cc,0x2420b,(CTraceFilterSimple *)local_dc,local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_70,(Vector *)&local_64,0xff,0xff,0,true,-1.0);
}
if ((local_44 < 1.0) && ((local_3c & 1) != 0)) {
if (param_1 == 0) {
uVar6 = 0xffffffff;
}
else {
uVar6 = *(undefined4 *)(param_1 + 0x8c);
}
Warning("Zombie tried to spawn under displacement in nav area %d, setpos %.1f %.1f %.1f\n"
,uVar6,(double)local_e8,(double)local_e4,(double)local_e0);
return (CBaseEntity *)0x0;
}
}
}
this_00 = (CBaseEntity *)CreateEntityByName("infected",-1,true);
if (this_00 != (CBaseEntity *)0x0) {
*(int *)(this + 0x28c) = param_4;
CBaseEntity::SetAbsOrigin(this_00,(Vector *)&local_e8);
lVar7 = (longdouble)RandomFloat(0,0x43b40000);
local_c8 = (float)lVar7;
local_cc = 0.0;
local_c4 = 0.0;
CBaseEntity::SetAbsAngles(this_00,(QAngle *)&local_cc);
if (g_bSpawnAtConstAng != '\0') {
local_cc = 0.0;
local_c8 = g_flConstSpawnAng;
local_c4 = 0.0;
CBaseEntity::SetAbsAngles(this_00,(QAngle *)&local_cc);
}
DispatchSpawn(this_00,true);
(**(code **)(*(int *)this_00 + 0x578))(this_00);
if (param_4 == 1) {
Infected::AttackSurvivorTeam((Infected *)this_00);
}
else if (param_4 == 2) {
Infected::RunAmbientMob((Infected *)this_00);
}
else {
iVar4 = CDirector::GetNumReservedWanderers(TheDirector);
iVar5 = CDirector::GetDesiredNumReservedWanderers(TheDirector);
if (iVar5 < iVar4) {
Infected::SetReservedWandererStatus((Infected *)this_00,false);
}
else {
Infected::SetReservedWandererStatus((Infected *)this_00,true);
}
}
*(int *)(this + 0x278) = *(int *)(this + 0x278) + 1;
CL4DGameStats::Event_SpawnZombie((CL4DGameStats *)CL4D_GameStats,0,1);
*(undefined4 *)(this + 0x28c) = 0;
return this_00;
}
}
return (CBaseEntity *)0x0;
}
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.