Float_Encode
0x001496e0 · 720 bytes · __cdecl
_Z12Float_EncodePKhP8DVariantPK8SendPropP8bf_writei
Decompiled
undefined (5 params)
/* Float_Encode(unsigned char const*, DVariant*, SendProp const*, bf_write*, int) */
void Float_Encode(uchar *param_1,DVariant *param_2,SendProp *param_3,bf_write *param_4,int param_5)
{
float fVar1;
int iVar2;
undefined4 uVar3;
int iVar4;
undefined4 uVar5;
uint uVar6;
int iVar7;
int iVar8;
uint *puVar9;
int in_GS_OFFSET;
uint local_30;
iVar2 = *(int *)(in_GS_OFFSET + 0x14);
uVar6 = *(uint *)(param_3 + 0x3c);
fVar1 = *(float *)param_2;
if ((uVar6 & 2) != 0) {
bf_write::WriteBitCoord(param_4,fVar1);
goto LAB_00149820;
}
if ((uVar6 & 0x1000) != 0) {
bf_write::WriteBitCoordMP(param_4,fVar1,0);
goto LAB_00149820;
}
if ((uVar6 & 0x2000) != 0) {
bf_write::WriteBitCoordMP(param_4,fVar1,1);
goto LAB_00149820;
}
if ((uVar6 & 0x4000) != 0) {
bf_write::WriteBitCoordMP(param_4,fVar1,2);
goto LAB_00149820;
}
if ((uVar6 & 4) != 0) {
bf_write::WriteBitFloat(param_4,fVar1);
goto LAB_00149820;
}
if ((uVar6 & 0x20) != 0) {
bf_write::WriteBitNormal(param_4,fVar1);
goto LAB_00149820;
}
if ((((uVar6 & 0x8000) != 0) || ((uVar6 & 0x10000) != 0)) || ((uVar6 & 0x20000) != 0)) {
bf_write::WriteBitCellCoord(param_4,fVar1,*(undefined4 *)(param_3 + 0xc));
goto LAB_00149820;
}
if (fVar1 < *(float *)(param_3 + 0x10)) {
if ((uVar6 & 0x10) == 0) {
uVar3 = *(undefined4 *)(param_3 + 0x30);
uVar5 = GetObjectClassName(param_5);
DataTable_Warning("(class %s): Out-of-range value (%f) in SendPropFloat \'%s\', clamping.\n",
uVar5,(double)fVar1,uVar3);
}
iVar4 = *(int *)(param_3 + 0xc);
local_30 = 0;
uVar6 = *(uint *)(param_4 + 0xc);
iVar7 = *(int *)(param_4 + 8);
if (iVar7 < (int)(iVar4 + uVar6)) goto LAB_001498a4;
}
else {
if (fVar1 < *(float *)(param_3 + 0x14) || fVar1 == *(float *)(param_3 + 0x14)) {
local_30 = (uint)ROUND((fVar1 - *(float *)(param_3 + 0x10)) * *(float *)(param_3 + 0x34));
iVar4 = *(int *)(param_3 + 0xc);
}
else {
iVar4 = *(int *)(param_3 + 0xc);
local_30 = (1 << ((byte)iVar4 & 0x1f)) - 1;
if ((uVar6 & 8) == 0) {
uVar3 = *(undefined4 *)(param_3 + 0x30);
uVar5 = GetObjectClassName(param_5);
DataTable_Warning("%s: Out-of-range value (%f) in SendPropFloat \'%s\', clamping.\n",uVar5,
(double)fVar1,uVar3);
iVar4 = *(int *)(param_3 + 0xc);
}
}
uVar6 = *(uint *)(param_4 + 0xc);
iVar7 = *(int *)(param_4 + 8);
if (iVar7 < (int)(iVar4 + uVar6)) {
LAB_001498a4:
*(int *)(param_4 + 0xc) = iVar7;
param_4[0x10] = (bf_write)0x1;
goto LAB_00149820;
}
}
iVar7 = ((int)uVar6 >> 5) * 4;
uVar6 = uVar6 & 0x1f;
puVar9 = (uint *)(*(int *)param_4 + iVar7);
*puVar9 = (&g_BitWriteMasks)[uVar6 * 0x21 + iVar4] & *puVar9 | local_30 << (sbyte)uVar6;
iVar8 = 0x20 - uVar6;
if (iVar8 < iVar4) {
puVar9 = (uint *)(*(int *)param_4 + 4 + iVar7);
*puVar9 = (&g_BitWriteMasks)[iVar4 - iVar8] & *puVar9 | local_30 >> ((byte)iVar8 & 0x1f);
}
*(int *)(param_4 + 0xc) = *(int *)(param_4 + 0xc) + iVar4;
LAB_00149820:
if (iVar2 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.