CUpgradeSpawner::Spawn
0x008d9cc0 · 1465 bytes · __thiscall
_ZN15CUpgradeSpawner5SpawnEv
Decompiled
undefined (1 param)
/* CUpgradeSpawner::Spawn() */
void __thiscall CUpgradeSpawner::Spawn(CUpgradeSpawner *this)
{
char *pcVar1;
uint uVar2;
CBaseEdict *pCVar3;
char cVar4;
int iVar5;
CBaseEntity *this_00;
uint uVar6;
float fVar7;
float fVar8;
undefined1 local_e8 [8];
float local_e0;
CTraceFilterSimple local_dc [16];
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;
char *local_70 [3];
Vector local_64 [43];
char local_39;
if (this[0x454] != (CUpgradeSpawner)0x0) {
local_70[0] = "upgrade_laser_sight";
CUtlVector<char_const*,CUtlMemory<char_const*,int>>::InsertBefore
((CUtlVector<char_const*,CUtlMemory<char_const*,int>> *)(this + 0x440),
*(int *)(this + 0x44c),local_70);
}
if (this[0x455] != (CUpgradeSpawner)0x0) {
local_70[0] = "weapon_upgradepack_incendiary_spawn";
CUtlVector<char_const*,CUtlMemory<char_const*,int>>::InsertBefore
((CUtlVector<char_const*,CUtlMemory<char_const*,int>> *)(this + 0x440),
*(int *)(this + 0x44c),local_70);
}
if (this[0x456] != (CUpgradeSpawner)0x0) {
cVar4 = CTerrorGameRules::IsVersusMode();
if (cVar4 == '\0') {
cVar4 = CTerrorGameRules::IsScavengeMode();
if (cVar4 == '\0') {
local_70[0] = "weapon_upgradepack_explosive_spawn";
CUtlVector<char_const*,CUtlMemory<char_const*,int>>::InsertBefore
((CUtlVector<char_const*,CUtlMemory<char_const*,int>> *)(this + 0x440),
*(int *)(this + 0x44c),local_70);
}
}
}
if (0 < *(int *)(this + 0x44c)) {
CPointEntity::Spawn((CPointEntity *)this);
if (((byte)this[0x14d] & 8) == 0) {
local_c4 = *(float *)(this + 0x2e8);
local_bc = 0.0;
local_b4 = local_c4 - 120.0;
local_b8 = 0.0;
fVar8 = 0.0;
local_cc = *(float *)(this + 0x2e0);
local_c8 = *(float *)(this + 0x2e4);
}
else {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
local_c4 = *(float *)(this + 0x2e8);
local_cc = *(float *)(this + 0x2e0);
local_c8 = *(float *)(this + 0x2e4);
local_b4 = local_c4 - 120.0;
if (((byte)this[0x14d] & 8) == 0) {
local_bc = 0.0;
local_b8 = local_bc;
fVar8 = local_bc;
}
else {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
local_bc = local_cc - *(float *)(this + 0x2e0);
local_c4 = *(float *)(this + 0x2e8);
local_b8 = local_c8 - *(float *)(this + 0x2e4);
fVar8 = local_b8 * local_b8 + local_bc * local_bc;
local_cc = *(float *)(this + 0x2e0);
local_c8 = *(float *)(this + 0x2e4);
}
}
local_b4 = local_b4 - local_c4;
local_87 = local_b4 * local_b4 + fVar8 != 0.0;
local_94 = 0;
local_98 = 0;
local_9c = 0;
local_8c = 0;
local_88 = 1;
local_a4 = 0;
local_a8 = 0;
local_ac = 0;
CTraceFilterSimple::CTraceFilterSimple
(local_dc,(IHandleEntity *)this,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x46004003,local_dc,(Vector *)local_70)
;
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine((Vector *)local_70,local_64,0xff,0,0,true,-1.0);
}
if (local_39 == '\0') {
CBaseEntity::SetAbsOrigin((CBaseEntity *)this,local_64);
}
iVar5 = RandomInt(0,*(int *)(this + 0x44c) + -1);
pcVar1 = *(char **)(*(int *)(this + 0x440) + iVar5 * 4);
if (pcVar1 != (char *)0x0) {
this_00 = (CBaseEntity *)CreateEntityByName(pcVar1,-1,true);
if (this_00 == (CBaseEntity *)0x0) {
Msg("Failed to spawn item by class %s\n",pcVar1);
}
else {
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
CBaseEntity::SetAbsOrigin(this_00,(Vector *)(this + 0x2e0));
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
CBaseEntity::SetAbsAngles(this_00,(QAngle *)(this + 0x37c));
uVar6 = *(uint *)(this + 0x148);
if (((uVar6 & 2) != 0) &&
(uVar2 = *(uint *)(this_00 + 0x148), *(uint *)(this_00 + 0x148) != (uVar2 | 2))) {
if (this_00[0x6c] == (CBaseEntity)0x0) {
pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
}
*(uint *)(this_00 + 0x148) = uVar2 | 2;
uVar6 = *(uint *)(this + 0x148);
}
if (((uVar6 & 1) != 0) &&
(uVar6 = *(uint *)(this_00 + 0x148) | 1, *(uint *)(this_00 + 0x148) != uVar6)) {
if (this_00[0x6c] == (CBaseEntity)0x0) {
pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this_00[0x70] = (CBaseEntity)((byte)this_00[0x70] | 1);
}
*(uint *)(this_00 + 0x148) = uVar6;
}
(**(code **)(*(int *)this_00 + 0x6c))(this_00);
DispatchSpawn(this_00,true);
(**(code **)(*(int *)(this_00 + 0x194) + 0xc))(this_00 + 0x194,local_e8,local_dc);
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
fVar8 = *(float *)(this_00 + 0x2e8);
fVar7 = fVar8 - local_e0;
if (0.0 < fVar7) {
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
fVar8 = *(float *)(this_00 + 0x2e8);
}
local_cc = *(float *)(this_00 + 0x2e0);
local_c4 = fVar8 + fVar7;
local_c8 = *(float *)(this_00 + 0x2e4);
CBaseEntity::SetAbsOrigin(this_00,(Vector *)&local_cc);
}
}
}
}
UTIL_Remove((CBaseEntity *)this);
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.