CFish::FlockTo
0x006a44e0 · 923 bytes · __thiscall
_ZN5CFish7FlockToEPS_f
Decompiled
undefined (3 params)
/* CFish::FlockTo(CFish*, float) */
void __thiscall CFish::FlockTo(CFish *this,CFish *param_1,float param_2)
{
float fVar1;
undefined *puVar2;
CBaseEntity *this_00;
longdouble lVar3;
uint uVar4;
float fVar5;
float fVar6;
float local_30;
float local_28;
float local_24;
float local_20;
lVar3 = (longdouble)CountdownTimer::Now();
if (*(float *)(this + 0x1488) <= (float)lVar3) {
if (param_1 == (CFish *)0x0) {
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
uVar4 = *(uint *)(this + 0x13f4);
this_00 = (CBaseEntity *)0x0;
if (((uVar4 != 0xffffffff) &&
(puVar2 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar2 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar2 + 8) == uVar4 >> 0xc)) {
this_00 = *(CBaseEntity **)(puVar2 + 4);
}
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
local_28 = *(float *)(this_00 + 0x2e0) - *(float *)(this + 0x2e0);
local_30 = 300.0;
local_24 = *(float *)(this_00 + 0x2e4) - *(float *)(this + 0x2e4);
local_20 = *(float *)(this_00 + 0x2e8) - *(float *)(this + 0x2e8);
}
else {
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
}
local_28 = *(float *)(param_1 + 0x2e0) - *(float *)(this + 0x2e0);
local_30 = 100.0;
local_24 = *(float *)(param_1 + 0x2e4) - *(float *)(this + 0x2e4);
local_20 = *(float *)(param_1 + 0x2e8) - *(float *)(this + 0x2e8);
}
lVar3 = (longdouble)VectorNormalize((Vector *)&local_28);
fVar1 = (float)lVar3;
if (fVar1 <= local_30) {
if ((fVar1 < 25.0) && (param_1 != (CFish *)0x0)) {
if (((byte)this[0x14d] & 0x10) != 0) {
CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
}
if (((byte)param_1[0x14d] & 0x10) != 0) {
CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)param_1);
}
if ((*(float *)(param_1 + 0x278) - *(float *)(this + 0x278)) * local_24 +
(*(float *)(param_1 + 0x274) - *(float *)(this + 0x274)) * local_28 +
(*(float *)(param_1 + 0x27c) - *(float *)(this + 0x27c)) * local_20 < 0.0) {
if (0.0 < local_24 * *(float *)(this + 0x1420) + local_28 * *(float *)(this + 0x141c) +
local_20 * *(float *)(this + 0x1424)) {
*(float *)(this + 0x140c) = (fVar1 * 0.04 + -1.0) * 5.0 + *(float *)(this + 0x140c);
return;
}
*(float *)(this + 0x140c) = (1.0 - fVar1 * 0.04) * 5.0 + *(float *)(this + 0x140c);
return;
}
}
fVar5 = ((local_24 * -*(float *)(this + 0x1414) - *(float *)(this + 0x1410) * local_28) + 1.0)
- local_20 * *(float *)(this + 0x1418);
uVar4 = -(uint)(1.0 < local_24 * *(float *)(this + 0x1410) +
-*(float *)(this + 0x1414) * local_28);
fVar6 = (float)(~uVar4 & 0xbf800000 | uVar4 & 0x3f800000);
if ((1.0 < fVar5) && (fVar6 = -1.0, this[0x1458] != (CFish)0x0)) {
fVar6 = 1.0;
}
*(float *)(this + 0x140c) =
param_2 * 0.7 * (1.0 - fVar1 / local_30) * fVar5 * fVar6 + *(float *)(this + 0x140c);
}
}
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.