CWeaponSpawn::Spawn
0x008da8d0 · 1333 bytes · __thiscall
_ZN12CWeaponSpawn5SpawnEv
Decompiled
undefined (1 param)
/* CWeaponSpawn::Spawn() */
void __thiscall CWeaponSpawn::Spawn(CWeaponSpawn *this)
{
code *pcVar1;
CBaseEdict *pCVar2;
code **ppcVar3;
uint uVar4;
char cVar5;
float *pfVar6;
int iVar7;
int iVar8;
uint uVar9;
int *piVar10;
int *piVar11;
int local_58 [2];
code *local_50;
int local_30 [2];
float local_28;
float local_24;
float local_20;
piVar10 = (int *)&stack0xffffffb4;
if (((byte)this[0x148] & 8) == 0) {
local_50 = (code *)0x8da90b;
cVar5 = (**(code **)(*(int *)this + 0x3c0))();
if (cVar5 == '\0') {
local_50 = (code *)0x8da914;
cVar5 = IsPressDemoMode();
if (cVar5 != '\0') goto LAB_008da918;
}
local_50 = (code *)0x8da94b;
(**(code **)(*(int *)this + 0x3cc))();
local_50 = (code *)0x8da962;
cVar5 = CDirectorChallengeMode::AllowWeaponSpawn();
if (cVar5 == '\0') {
LAB_008da918:
local_50 = (code *)0x8da923;
iVar8 = (**(code **)(*(int *)this + 0x3cc))();
if (iVar8 == 0x36) {
local_50 = (code *)0x8dabdf;
(**(code **)(*(int *)this + 0x20))();
iVar8 = local_30[0];
if (Spawn()::classname == '\0') {
local_50 = (code *)&Spawn()::classname;
iVar7 = __cxa_guard_acquire();
if (iVar7 != 0) {
local_50 = (code *)&Spawn()::classname;
DAT_01005130 = 0;
Spawn()::classname = 0;
DAT_0100512c = "prop_dynamic";
__cxa_guard_release();
local_50 = CGameString::~CGameString;
__cxa_atexit();
}
}
piVar11 = (int *)0x0;
ppcVar3 = &local_50;
while( true ) {
piVar10 = (int *)ppcVar3;
if (((Spawn()::classname == 0) ||
(iVar7 = Spawn()::classname, DAT_01005130 != CGameString::gm_iSerialNumber)) &&
(iVar7 = 0, DAT_0100512c != (char *)0x0)) {
piVar10[1] = (int)DAT_0100512c;
*piVar10 = (int)local_30;
piVar10[-1] = 0x8dac2e;
AllocPooledString((char *)*piVar10);
Spawn()::classname = local_30[0];
DAT_01005130 = CGameString::gm_iSerialNumber;
iVar7 = local_30[0];
}
piVar10[1] = (int)piVar11;
piVar10[2] = iVar7;
*piVar10 = (int)gEntList;
piVar10[-1] = 0x8dac60;
piVar11 = (int *)CGlobalEntityList::FindEntityByClassnameFast();
if (piVar11 == (int *)0x0) break;
iVar7 = *piVar11;
piVar10[1] = (int)piVar11;
*piVar10 = (int)local_30;
pcVar1 = *(code **)(iVar7 + 0x20);
piVar10[-1] = 0x8dac76;
(*pcVar1)();
ppcVar3 = (code **)(piVar10 + -1);
if (iVar8 == local_30[0]) {
piVar10[-1] = (int)piVar11;
piVar10[-2] = 0x8dac8d;
UTIL_Remove((CBaseEntity *)piVar10[-1]);
ppcVar3 = (code **)(piVar10 + -1);
}
}
}
*piVar10 = (int)this;
piVar10[-1] = 0x8da934;
UTIL_Remove((CBaseEntity *)*piVar10);
return;
}
local_50 = (code *)0x8da96e;
cVar5 = ModifyWeaponSpawns(this);
}
else {
local_50 = (code *)0x8da8ed;
cVar5 = ModifyWeaponSpawns(this);
}
if (cVar5 != '\0') {
return;
}
local_50 = (code *)0x8da990;
CBaseEntity::SetGlobalFadeScale((CBaseEntity *)this,0.0);
local_50 = (code *)0x8da995;
cVar5 = CBaseEntity::IsPrecacheAllowed();
if (cVar5 != '\0') {
local_50 = (code *)0x8dad08;
(**(code **)(*(int *)this + 0x6c))();
}
pcVar1 = *(code **)(*(int *)this + 0x70);
local_50 = (code *)0x8da9ab;
(**(code **)(*(int *)this + 0x3c8))();
local_50 = (code *)0x8da9b4;
(*pcVar1)();
iVar8 = *(int *)this;
pcVar1 = *(code **)(iVar8 + 0x254);
if (((byte)this[0x14d] & 8) != 0) {
local_50 = (code *)0x8dacf8;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
iVar8 = *(int *)this;
}
local_50 = (code *)0x8da9d2;
pfVar6 = (float *)(**(code **)(iVar8 + 0x288))();
local_28 = *pfVar6 - *(float *)(this + 0x2e0);
local_24 = pfVar6[1] - *(float *)(this + 0x2e4);
local_20 = pfVar6[2] - *(float *)(this + 0x2e8);
local_50 = (code *)0x8daa13;
(*pcVar1)();
iVar8 = *(int *)(this + 0x1450);
if ((-1 < iVar8) && (iVar8 != *(int *)(this + 0x458))) {
if (this[0x6c] == (CWeaponSpawn)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
local_50 = (code *)0x8daa44;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this[0x70] = (CWeaponSpawn)((byte)this[0x70] | 1);
}
*(int *)(this + 0x458) = iVar8;
}
local_50 = (code *)0x8daa5b;
iVar8 = (**(code **)(*(int *)this + 0x3cc))();
if (iVar8 != *(int *)(this + 0x1458)) {
if (this[0x6c] == (CWeaponSpawn)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
local_50 = (code *)0x8daa86;
iVar7 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar7 + 2) = 0;
}
}
else {
this[0x70] = (CWeaponSpawn)((byte)this[0x70] | 1);
}
*(int *)(this + 0x1458) = iVar8;
}
local_50 = (code *)0x8daa9c;
iVar8 = GetWeaponInfo();
if ((iVar8 != 0) && ((*(int *)(iVar8 + 0x894) - 8U < 2 || (*(int *)(iVar8 + 0x894) == 0xf)))) {
*(undefined4 *)(this + 0x144c) = 1;
}
uVar9 = *(uint *)(this + 0x148);
if ((uVar9 & 1) == 0) {
if (uVar9 != (uVar9 | 1)) {
if (this[0x6c] == (CWeaponSpawn)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
local_50 = (code *)0x8dacbe;
iVar8 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar8 + 2) = 0;
}
}
else {
this[0x70] = (CWeaponSpawn)((byte)this[0x70] | 1);
}
*(uint *)(this + 0x148) = uVar9 | 1;
}
local_50 = (code *)0x8dacd2;
CItem::Spawn((CItem *)this);
uVar9 = *(uint *)(this + 0x148);
uVar4 = uVar9 & 0xfffffffe;
if (uVar9 != (uVar9 & 0xfffffffe)) goto LAB_008dab18;
}
else {
if (uVar9 != (uVar9 & 0xfffffffe)) {
if (this[0x6c] == (CWeaponSpawn)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
local_50 = (code *)0x8daaf3;
iVar8 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar8 + 2) = 0;
}
}
else {
this[0x70] = (CWeaponSpawn)((byte)this[0x70] | 1);
}
*(uint *)(this + 0x148) = uVar9 & 0xfffffffe;
}
local_50 = (code *)0x8dab05;
CItem::Spawn((CItem *)this);
uVar9 = *(uint *)(this + 0x148);
uVar4 = uVar9 | 1;
if (uVar9 != (uVar9 | 1)) {
LAB_008dab18:
uVar9 = uVar4;
if (this[0x6c] == (CWeaponSpawn)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
local_50 = (code *)0x8dab37;
iVar8 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar8 + 2) = 0;
}
}
else {
this[0x70] = (CWeaponSpawn)((byte)this[0x70] | 1);
}
*(uint *)(this + 0x148) = uVar9;
}
}
if ((uVar9 & 1) == 0) {
local_50 = (code *)0x8dad50;
CBaseEntity::SetMoveType();
}
if (*(int *)(this + 0x144c) < 1) {
local_50 = (code *)0x8dae1e;
iVar8 = CTerrorWeaponInfo::GetWeaponInfo();
if ((iVar8 == 0) || ((*(uint *)(iVar8 + 0x158) & 0xfffffffd) != 0)) {
local_50 = (code *)0x8dae36;
UTIL_Remove((CBaseEntity *)this);
}
else {
local_50 = (code *)0x8dae60;
CBaseEntity::AddEffects((CBaseEntity *)this,0x20);
}
iVar8 = *(int *)(this + 0x144c);
if (iVar8 < 1) goto LAB_008dab81;
}
local_50 = (code *)0x8dab7b;
VisibilityMonitor_AddEntity
((CBaseEntity *)this,400.0,WeaponSpawnVisibilityMonitorCallback,
CTerrorPlayer::DualWieldingFilter);
iVar8 = *(int *)(this + 0x144c);
LAB_008dab81:
*(int *)(this + 0x1454) = iVar8;
if (this[0x105] != (CWeaponSpawn)0x0) {
local_50 = (code *)0x8dad25;
(**(code **)(*(int *)this + 0x224))();
this[0x105] = (CWeaponSpawn)0x0;
}
*(undefined4 *)(this + 0x1460) = 0;
local_50 = (code *)0x8dabae;
CBaseEntity::AddEffects((CBaseEntity *)this,0x10);
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.