ZSpawnCore
0x00a5adb0 · 2143 bytes · __regparm1
_ZL10ZSpawnCorei6Vector6QAngleibbb.isra.150
Decompiled
undefined (7 params)
/* ZSpawnCore(int, Vector, QAngle, int, bool, bool, bool) [clone .isra.150] */
bool __regparm1 ZSpawnCore(int param_1,CCSPlayer *param_2,float param_3,float param_4)
{
float fVar1;
undefined4 uVar2;
CBaseEdict *this;
bool bVar3;
ZombieManager *pZVar4;
float fVar5;
float fVar6;
undefined4 uVar7;
CCSPlayer *this_00;
int iVar8;
int iVar9;
TerrorNavArea *pTVar10;
Infected *this_01;
CBaseEntity *pCVar11;
bool bVar12;
int in_stack_0000001c;
undefined4 in_stack_00000020;
undefined4 in_stack_00000024;
Vector *pVVar13;
char local_f8;
char local_f0;
undefined4 local_e0;
undefined4 local_dc;
undefined4 local_d8;
Vector local_d0 [12];
Vector local_c4 [32];
float local_a4;
char local_99;
CCSPlayer *local_7c;
float local_78;
float local_74;
undefined4 local_6c;
undefined4 local_68;
undefined4 local_64;
float local_5c;
float local_58;
float local_54;
float local_4c;
float local_48;
float local_44;
undefined4 local_3c;
undefined1 local_38;
undefined1 local_37;
uVar7 = in_stack_00000024;
uVar2 = in_stack_00000020;
fVar1 = *(float *)(ZombieSpawnHeight._28_4_ + 0x2c);
if (param_1 == 10) {
iVar8 = CDirector::GetCommonInfectedLimit(TheDirector);
ZombieManager::SpawnMob(TheZombieManager,iVar8);
return true;
}
iVar8 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
iVar9 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
local_6c = 0;
local_68 = 0;
local_64 = 0;
local_3c = 0;
local_37 = 0;
local_4c = (*(float *)(iVar8 + 0x18) - *(float *)(iVar9 + 0xc)) * 0.5;
local_48 = (*(float *)(iVar8 + 0x1c) - *(float *)(iVar9 + 0x10)) * 0.5;
local_44 = (*(float *)(iVar8 + 0x20) - *(float *)(iVar9 + 0x14)) * 0.5;
local_38 = local_48 * local_48 + local_4c * local_4c + local_44 * local_44 < 1e-06;
local_5c = (*(float *)(iVar8 + 0x18) + *(float *)(iVar9 + 0xc)) * 0.5;
local_7c = (CCSPlayer *)((float)param_2 + local_5c);
local_58 = (*(float *)(iVar8 + 0x1c) + *(float *)(iVar9 + 0x10)) * 0.5;
local_78 = param_3 + local_58;
local_54 = (*(float *)(iVar8 + 0x20) + *(float *)(iVar9 + 0x14)) * 0.5;
local_5c = -local_5c;
local_58 = -local_58;
local_74 = param_4 + local_54;
local_54 = -local_54;
CTraceFilterSimple::CTraceFilterSimple
((CTraceFilterSimple *)&local_e0,(IHandleEntity *)0x0,0,
(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))
(enginetrace,&local_7c,0x202420b,(CTraceFilterSimple *)&local_e0,local_d0);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_d0,local_c4,0xff,0xff,0,true,-1.0);
}
pVVar13 = (Vector *)¶m_2;
pTVar10 = (TerrorNavArea *)
CNavMesh::GetNearestNavArea(TheNavMesh,pVVar13,false,10000.0,false,true,false);
local_f0 = (char)uVar2;
if (((local_99 != '\0') || (local_a4 < 1.0)) && (pTVar10 != (TerrorNavArea *)0x0)) {
pVVar13 = (Vector *)pTVar10;
TerrorNavArea::FindRandomSpot();
param_4 = fVar1 + local_74;
param_2 = local_7c;
param_3 = local_78;
}
if ((param_1 == 0xb) || (param_1 == 7)) {
if (local_f0 != '\0') {
Warning("ragdoll flag is not implemented\n",pVVar13);
}
s_ManualSpawn = 1;
if (param_1 != 7) {
iVar8 = ZombieManager::SpawnWitchBride
(TheZombieManager,(Vector *)¶m_2,(QAngle *)&stack0x00000010);
s_ManualSpawn = 0;
return iVar8 != 0;
}
iVar8 = ZombieManager::SpawnWitch
(TheZombieManager,(Vector *)¶m_2,(QAngle *)&stack0x00000010);
s_ManualSpawn = 0;
return iVar8 != 0;
}
bVar12 = param_1 == 8;
bVar3 = param_1 - 1U < 6;
if (!bVar3 && !bVar12) {
s_ManualSpawn = 1;
pCVar11 = (CBaseEntity *)ZombieManager::SpawnCommonZombie(TheZombieManager,pTVar10,¶m_2,0);
if (pCVar11 == (CBaseEntity *)0x0) {
iVar8 = CNavMesh::GetNearestNavArea
(TheNavMesh,(Vector *)¶m_2,false,10000.0,false,true,false);
if (iVar8 == 0) {
s_ManualSpawn = 0;
return false;
}
TerrorNavArea::FindRandomSpot();
param_4 = fVar1 + local_74;
param_2 = local_7c;
param_3 = local_78;
iVar8 = ZombieManager::SpawnCommonZombie(TheZombieManager,iVar8,¶m_2,0);
s_ManualSpawn = 0;
return iVar8 != 0;
}
s_ManualSpawn = 0;
if ((-1 < in_stack_0000001c) &&
(this_01 = (Infected *)(**(code **)(*(int *)pCVar11 + 0x14c))(pCVar11), fVar6 = DAT_01053d50,
fVar5 = DAT_01053d4c, fVar1 = vec3_origin, this_01 != (Infected *)0x0)) {
if ((vec3_origin != *(float *)(this_01 + 0x1cdc)) ||
((DAT_01053d4c != *(float *)(this_01 + 0x1ce0) ||
(DAT_01053d50 != *(float *)(this_01 + 0x1ce4))))) {
if (this_01[0x6c] == (Infected)0x0) {
this = *(CBaseEdict **)(this_01 + 0x30);
if (this != (CBaseEdict *)0x0) {
*(uint *)this = *(uint *)this | 0x101;
iVar8 = CBaseEdict::GetChangeAccessor(this);
*(undefined2 *)(iVar8 + 2) = 0;
}
}
else {
this_01[0x70] = (Infected)((byte)this_01[0x70] | 1);
}
*(float *)(this_01 + 0x1cdc) = fVar1;
*(float *)(this_01 + 0x1ce0) = fVar5;
*(float *)(this_01 + 0x1ce4) = fVar6;
}
Infected::RequestWound(this_01,in_stack_0000001c);
}
if (local_f0 != '\0') {
CTakeDamageInfo::CTakeDamageInfo((CTakeDamageInfo *)&local_7c,pCVar11,pCVar11,10000.0,1,0);
local_e0 = 0;
local_dc = 0;
local_d8 = 0x3f800000;
(**(code **)(*(int *)pCVar11 + 0x4dc))(pCVar11,&local_7c,(CTraceFilterSimple *)&local_e0);
return true;
}
return true;
}
if (local_f0 != '\0') {
Warning("ragdoll flag is not implemented",pVVar13);
}
local_7c = (CCSPlayer *)0x0;
local_78 = 0.0;
local_74 = (float)param_1;
ForEachTerrorPlayer<SpawnablePZScan>((SpawnablePZScan *)&local_7c);
local_f8 = (char)uVar7;
if ((local_7c != (CCSPlayer *)0x0) &&
(CCSPlayer::State_Transition(local_7c,6), this_00 = local_7c, local_7c != (CCSPlayer *)0x0)) {
if ((*(int *)(ZombieDebugTankSpawn._28_4_ + 0x30) == 0) && (param_1 == 8)) goto LAB_00a5b497;
if (*(int *)(tank_raffle_debug._28_4_ + 0x30) == 0) {
CCSPlayer::State_Transition(local_7c,0);
CBaseEntity::SetAbsOrigin((CBaseEntity *)this_00,(Vector *)¶m_2);
CBaseEntity::SetAbsAngles((CBaseEntity *)this_00,(QAngle *)&stack0x00000010);
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this_00);
}
pZVar4 = TheZombieManager;
g_ZombieClass = param_1;
*(undefined4 *)(TheZombieManager + 0x27c) = *(undefined4 *)(this_00 + 0x2e0);
*(undefined4 *)(pZVar4 + 0x280) = *(undefined4 *)(this_00 + 0x2e4);
uVar2 = *(undefined4 *)(this_00 + 0x2e8);
pZVar4[0x288] = (ZombieManager)0x1;
*(undefined4 *)(pZVar4 + 0x284) = uVar2;
this_00[0x3fe1] = (CCSPlayer)0x1;
*(undefined4 *)(this_00 + 0x3fe4) = 0xffffffff;
*(undefined4 *)(this_00 + 0x3fe8) = 0xbf800000;
(**(code **)(*(int *)this_00 + 100))(this_00);
iVar8 = *(int *)(z_spawn_health._28_4_ + 0x30);
if ((0 < iVar8) && (iVar8 != *(int *)(this_00 + 0x100))) {
(**(code **)(*(int *)this_00 + 0x214))(this_00,this_00 + 0x100);
*(int *)(this_00 + 0x100) = iVar8;
}
(**(code **)(*(int *)this_00 + 0x1dc))(this_00,¶m_2,&stack0x00000010,&vec3_origin);
TheZombieManager[0x288] = (ZombieManager)0x0;
return bVar3 || bVar12;
}
}
s_ManualSpawn = 1;
if (!bVar12) {
if ((pTVar10 != (TerrorNavArea *)0x0) && (local_f8 != '\0')) {
iVar8 = ZombieManager::SpawnSpecial(TheZombieManager,param_1,pTVar10,&stack0x00000010);
s_ManualSpawn = 0;
return iVar8 != 0;
}
iVar8 = ZombieManager::SpawnSpecial(TheZombieManager,param_1,¶m_2,&stack0x00000010);
s_ManualSpawn = 0;
return iVar8 != 0;
}
LAB_00a5b497:
s_ManualSpawn = 1;
if ((pTVar10 == (TerrorNavArea *)0x0) || (local_f8 == '\0')) {
pCVar11 = (CBaseEntity *)
ZombieManager::SpawnTank
(TheZombieManager,(Vector *)¶m_2,(QAngle *)&stack0x00000010);
}
else {
pCVar11 = (CBaseEntity *)
ZombieManager::SpawnTank(TheZombieManager,pTVar10,(QAngle *)&stack0x00000010,false);
}
CDirector::TryOfferingTankBot(TheDirector,pCVar11,true);
s_ManualSpawn = 0;
return pCVar11 != (CBaseEntity *)0x0;
}
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.