CSprite::Spawn
0x004c3c10 · 919 bytes · __thiscall
_ZN7CSprite5SpawnEv
Decompiled
undefined (1 param)
/* CSprite::Spawn() */
void __thiscall CSprite::Spawn(CSprite *this)
{
code *pcVar1;
CBaseEdict *pCVar2;
undefined1 *puVar3;
undefined4 uVar4;
int iVar5;
float fVar6;
double dVar7;
double dVar8;
undefined1 *local_30 [2];
undefined4 local_28;
undefined4 local_24;
undefined4 local_20;
if ((*(int *)(force_disablex360._28_4_ + 0x30) != 0) && (this[0x128] != (CSprite)0x0)) {
UTIL_Remove((CBaseEntity *)this);
return;
}
CCollisionProperty::SetSolid((CCollisionProperty *)(this + 0x194));
CBaseEntity::SetMoveType((CBaseEntity *)this,0,0);
if (*(float *)(this + 0x44c) != 0.0) {
if (this[0x6c] == (CSprite)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CSprite)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x44c) = 0;
}
(**(code **)(*(int *)this + 0x6c))(this);
pcVar1 = *(code **)(*(int *)this + 0x70);
(**(code **)(*(int *)this + 0x20))(local_30);
puVar3 = &DAT_00d539c2;
if (local_30[0] != (undefined1 *)0x0) {
puVar3 = local_30[0];
}
(*pcVar1)(this,puVar3);
CCollisionProperty::SetSurroundingBoundsType((CCollisionProperty *)(this + 0x194),4,0,0);
pcVar1 = *(code **)(*modelinfo + 0x28);
uVar4 = CBaseEntity::GetModel((CBaseEntity *)this);
iVar5 = (*pcVar1)(modelinfo,uVar4);
*(float *)(this + 0x474) = (float)iVar5 - 1.0;
CBaseEntity::AddEffects((CBaseEntity *)this,0x50);
fVar6 = *(float *)(this + 0x468);
if (fVar6 <= 64.0) goto LAB_004c3da9;
if (((byte)this[0x14d] & 8) == 0) {
dVar8 = (double)*(float *)(this + 0x2e8);
LAB_004c3d4c:
dVar7 = (double)*(float *)(this + 0x2e4);
}
else {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
dVar8 = (double)*(float *)(this + 0x2e8);
if (((byte)this[0x14d] & 8) == 0) goto LAB_004c3d4c;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
dVar7 = (double)*(float *)(this + 0x2e4);
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
}
DevWarning("env_sprite at setpos %0.0f %0.0f %0.0f has invalid glow size %f - clamping to %f\n",
(double)*(float *)(this + 0x2e0),dVar7,dVar8,(double)fVar6,0x4050000000000000);
if (*(float *)(this + 0x468) != 64.0) {
if (this[0x6c] == (CSprite)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CSprite)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + 0x468) = 0x42800000;
}
LAB_004c3da9:
if ((*(int *)(this + 0x154) == 0) || (((byte)this[0x148] & 1) != 0)) {
TurnOn(this);
}
else {
TurnOff(this);
}
if ((*(float *)(this + 0x3ac) != 0.0) && (*(float *)(this + 0x3b0) == 0.0)) {
local_28 = *(undefined4 *)(this + 0x3a8);
local_20 = *(undefined4 *)(this + 0x3ac);
local_24 = 0;
CBaseEntity::SetLocalAngles((CBaseEntity *)this,(QAngle *)&local_28);
}
fVar6 = *(float *)(this + 0x45c);
if ((64.0 < fVar6) || (fVar6 < 0.0)) {
if (64.0 < fVar6) {
fVar6 = 64.0;
}
else if (fVar6 < 0.0) {
fVar6 = 0.0;
}
else {
fVar6 = (float)(int)fVar6;
}
}
SetBrightness(this,(uint)(byte)this[0x127],0.0);
SetScale(this,fVar6,0.0);
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.