CEnvWeaponfire::FireShot
0x008cd250 · 1299 bytes · __thiscall
_ZN14CEnvWeaponfire8FireShotEv
Decompiled
undefined (1 param)
/* CEnvWeaponfire::FireShot() */
void __thiscall CEnvWeaponfire::FireShot(CEnvWeaponfire *this)
{
float fVar1;
uint uVar2;
CBaseEdict *this_00;
float fVar3;
float fVar4;
bool bVar5;
int iVar6;
int iVar7;
int iVar8;
undefined *puVar9;
Vector *pVVar10;
longdouble lVar11;
longdouble lVar12;
longdouble lVar13;
float fVar14;
float local_9c;
float local_70;
float local_6c;
float local_68;
float local_64;
float local_60;
float local_5c;
float local_58;
float local_54;
float local_50;
float local_4c;
float local_48;
undefined4 local_44;
float local_40;
float local_3c;
undefined4 local_38;
Vector local_34 [12];
float local_28;
float local_24;
float local_20;
iVar6 = CTerrorWeaponInfo::GetWeaponInfo(*(undefined4 *)(this + 0x478));
local_9c = *(float *)(iVar6 + 0xc2c);
fVar1 = *(float *)(iVar6 + 0xc30);
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
local_70 = *(float *)(this + 0x2e0);
local_6c = *(float *)(this + 0x2e4);
local_68 = *(float *)(this + 0x2e8);
iVar7 = RandomInt(0,4);
pVVar10 = (Vector *)0x0;
uVar2 = *(uint *)(this + 0x45c);
if (iVar7 == 0) {
if (((uVar2 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar9 + 8) == uVar2 >> 0xc)) {
pVVar10 = *(Vector **)(puVar9 + 4);
}
(**(code **)(*(int *)pVVar10 + 0x248))(&local_64,pVVar10,&local_70);
}
else {
if (((uVar2 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar9 + 8) == uVar2 >> 0xc)) {
pVVar10 = *(Vector **)(puVar9 + 4);
}
(**(code **)(*(int *)pVVar10 + 0x244))(&local_64,pVVar10,&local_70,1);
}
local_64 = local_64 - local_70;
local_60 = local_60 - local_6c;
local_5c = local_5c - local_68;
local_54 = 1.0 / SQRT(local_64 * local_64 + local_60 * local_60 + local_5c * local_5c);
local_50 = local_5c * local_54;
local_58 = local_64 * local_54;
local_54 = local_60 * local_54;
VectorAngles((Vector *)&local_58,(QAngle *)&local_4c);
iVar7 = *(int *)(iVar6 + 0x9d8);
if ((fVar1 == 0.0) || (local_9c == 0.0)) {
local_9c = 1.0;
}
else {
local_9c = local_9c / fVar1;
}
if (iVar7 == 1) {
fVar14 = (float)*(int *)(this + 0x484) * *(float *)(iVar6 + 0xc10);
lVar12 = (longdouble)RandomFloat(-fVar14,fVar14);
local_48 = (float)lVar12 + local_48;
lVar12 = (longdouble)RandomFloat(-fVar14,fVar14);
local_4c = (float)lVar12 + local_4c;
}
else if (iVar7 < 1) {
return;
}
bVar5 = true;
iVar6 = 0;
while( true ) {
local_3c = local_48;
local_38 = local_44;
local_40 = local_4c;
if ((bVar5) || (iVar7 < 2)) {
AngleVectors((QAngle *)&local_40,local_34);
pVVar10 = local_34;
TraceShot((Vector *)&local_28);
fVar4 = local_20;
fVar3 = local_24;
fVar14 = local_28;
if ((bVar5) &&
(((local_28 != *(float *)(this + 0x488) || (local_24 != *(float *)(this + 0x48c))) ||
(local_20 != *(float *)(this + 0x490))))) {
if (this[0x6c] == (CEnvWeaponfire)0x0) {
this_00 = *(CBaseEdict **)(this + 0x30);
if (this_00 != (CBaseEdict *)0x0) {
*(uint *)this_00 = *(uint *)this_00 | 0x101;
iVar8 = CBaseEdict::GetChangeAccessor(this_00);
*(undefined2 *)(iVar8 + 2) = 0;
}
}
else {
this[0x70] = (CEnvWeaponfire)((byte)this[0x70] | 1);
}
*(float *)(this + 0x488) = fVar14;
*(float *)(this + 0x48c) = fVar3;
*(float *)(this + 0x490) = fVar4;
}
}
else {
lVar11 = (longdouble)RandomFloat(-fVar1,fVar1,pVVar10);
lVar12 = (longdouble)RandomFloat(0,0x43340000);
lVar13 = (longdouble)(((float)lVar12 + (float)lVar12) * 0.017453292);
lVar12 = (longdouble)fcos(lVar13);
lVar13 = (longdouble)fsin(lVar13);
local_40 = local_9c * (float)lVar11 * (float)lVar13 + local_40;
local_3c = (float)lVar12 * (float)lVar11 + local_3c;
AngleVectors((QAngle *)&local_40,local_34);
pVVar10 = local_34;
TraceShot((Vector *)&local_28);
}
if (iVar7 <= iVar6 + 1) break;
iVar6 = iVar6 + 1;
bVar5 = false;
}
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.