CPointSpotlight::SpotlightUpdate
0x007de6e0 · 1415 bytes · __thiscall
_ZN15CPointSpotlight15SpotlightUpdateEv
Decompiled
undefined (1 param)
/* CPointSpotlight::SpotlightUpdate() */
void __thiscall CPointSpotlight::SpotlightUpdate(CPointSpotlight *this)
{
uint uVar1;
int iVar2;
undefined *puVar3;
undefined *puVar4;
CBaseEntity *pCVar5;
longdouble lVar6;
float fVar7;
float local_34;
float local_30;
float local_2c;
float local_28;
float local_24;
float local_20;
uVar1 = *(uint *)(this + 0x46c);
if ((((uVar1 == 0xffffffff) ||
(puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar3 + 8) != uVar1 >> 0xc)) || (*(int *)(puVar3 + 4) == 0)) {
if (this[0x440] == (CPointSpotlight)0x0) {
return;
}
SpotlightCreate(this);
}
else if (this[0x440] == (CPointSpotlight)0x0) {
SpotlightDestroy(this);
return;
}
uVar1 = *(uint *)(this + 0x470);
if (((uVar1 == 0xffffffff) ||
(puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 == (undefined *)0xfffffffc)) ||
((*(uint *)(puVar3 + 8) != uVar1 >> 0xc || (*(int *)(puVar3 + 4) == 0)))) {
DevWarning("**Attempting to update point_spotlight but target ent is NULL\n");
SpotlightDestroy(this);
SpotlightCreate(this);
uVar1 = *(uint *)(this + 0x470);
if (((uVar1 == 0xffffffff) ||
(puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 == (undefined *)0xfffffffc)) ||
((*(uint *)(puVar3 + 8) != uVar1 >> 0xc || (*(int *)(puVar3 + 4) == 0)))) {
return;
}
}
pCVar5 = (CBaseEntity *)0x0;
SpotlightCurrentPos();
uVar1 = *(uint *)(this + 0x470);
*(float *)(this + 0x450) = local_28;
*(float *)(this + 0x454) = local_24;
puVar3 = g_pEntityList;
*(float *)(this + 0x458) = local_20;
if (((uVar1 != 0xffffffff) &&
(puVar3 = puVar3 + (uVar1 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar3 + 8) == uVar1 >> 0xc)) {
pCVar5 = *(CBaseEntity **)(puVar3 + 4);
}
if (((byte)pCVar5[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar5);
local_28 = *(float *)(this + 0x450);
local_24 = *(float *)(this + 0x454);
local_20 = *(float *)(this + 0x458);
}
local_30 = local_24 - *(float *)(pCVar5 + 0x2e4);
local_2c = local_20 - *(float *)(pCVar5 + 0x2e8);
local_34 = local_28 - *(float *)(pCVar5 + 0x2e0);
fVar7 = SQRT(local_30 * local_30 + local_2c * local_2c + local_34 * local_34);
if (1.0 <= fVar7) {
local_28 = local_34;
local_24 = local_30;
local_20 = local_2c;
VectorNormalize((Vector *)&local_28);
fVar7 = fVar7 * 10.0;
local_28 = local_28 * fVar7;
local_24 = local_24 * fVar7;
local_20 = fVar7 * local_20;
if (200.0 < SQRT(local_24 * local_24 + local_28 * local_28 + local_20 * local_20)) {
VectorNormalize((Vector *)&local_28);
local_28 = local_28 * 200.0;
local_24 = local_24 * 200.0;
local_20 = local_20 * 200.0;
VectorNormalize((Vector *)&local_34);
pCVar5 = (CBaseEntity *)0x0;
uVar1 = *(uint *)(this + 0x470);
if (((uVar1 != 0xffffffff) &&
(puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar3 + 8) == uVar1 >> 0xc)) {
pCVar5 = *(CBaseEntity **)(puVar3 + 4);
}
CBaseEntity::SetAbsOrigin(pCVar5,(Vector *)(this + 0x450));
}
uVar1 = *(uint *)(this + 0x470);
pCVar5 = (CBaseEntity *)0x0;
if (((uVar1 != 0xffffffff) &&
(puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar3 + 8) == uVar1 >> 0xc)) {
pCVar5 = *(CBaseEntity **)(puVar3 + 4);
}
CBaseEntity::SetAbsVelocity(pCVar5,(Vector *)&local_28);
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
puVar3 = g_pEntityList;
uVar1 = *(uint *)(this + 0x470);
iVar2 = 0;
if (((uVar1 != 0xffffffff) &&
(puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar4 + 8) == uVar1 >> 0xc)) {
iVar2 = *(int *)(puVar4 + 4);
}
*(undefined4 *)(iVar2 + 0x454) = *(undefined4 *)(this + 0x2e0);
*(undefined4 *)(iVar2 + 0x458) = *(undefined4 *)(this + 0x2e4);
*(undefined4 *)(iVar2 + 0x45c) = *(undefined4 *)(this + 0x2e8);
uVar1 = *(uint *)(this + 0x470);
if (((uVar1 == 0xffffffff) ||
(puVar4 = puVar3 + (uVar1 & 0xfff) * 0x10, puVar4 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar4 + 8) != uVar1 >> 0xc)) {
pCVar5 = (CBaseEntity *)0x0;
}
else {
pCVar5 = *(CBaseEntity **)(puVar4 + 4);
}
if (((byte)pCVar5[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar5);
puVar3 = g_pEntityList;
}
*(float *)(pCVar5 + 0x448) = *(float *)(pCVar5 + 0x2e0) - *(float *)(pCVar5 + 0x454);
*(float *)(pCVar5 + 0x44c) = *(float *)(pCVar5 + 0x2e4) - *(float *)(pCVar5 + 0x458);
*(float *)(pCVar5 + 0x450) = *(float *)(pCVar5 + 0x2e8) - *(float *)(pCVar5 + 0x45c);
uVar1 = *(uint *)(this + 0x470);
if (((uVar1 == 0xffffffff) ||
(puVar3 = puVar3 + (uVar1 & 0xfff) * 0x10, puVar3 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar3 + 8) != uVar1 >> 0xc)) {
iVar2 = 0;
}
else {
iVar2 = *(int *)(puVar3 + 4);
}
lVar6 = (longdouble)VectorNormalize((Vector *)(iVar2 + 0x448));
*(float *)(this + 0x478) = (float)lVar6 * 0.4 + *(float *)(this + 0x478) * 0.6;
ComputeRenderInfo(this);
return;
}
uVar1 = *(uint *)(this + 0x470);
pCVar5 = (CBaseEntity *)0x0;
if (((uVar1 != 0xffffffff) &&
(puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar3 + 8) == uVar1 >> 0xc)) {
pCVar5 = *(CBaseEntity **)(puVar3 + 4);
}
CBaseEntity::SetAbsVelocity(pCVar5,(Vector *)&vec3_origin);
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.