L L4D2node

CBitWrite::WriteBitNormal

0x00256b90 · 293 bytes · __thiscall

_ZN9CBitWrite14WriteBitNormalEf

Decompiled

undefined (2 params)

/* CBitWrite::WriteBitNormal(float) */

void __thiscall CBitWrite::WriteBitNormal(CBitWrite *this,float param_1)

{
  int iVar1;
  int iVar2;
  uint *puVar3;
  char cVar4;
  uint uVar5;
  uint uVar6;
  
  iVar2 = *(int *)(this + 0x14);
  iVar1 = iVar2 + -1;
  *(int *)(this + 0x14) = iVar1;
  uVar5 = (int)(param_1 * 2047.0) >> 0x1f;
  uVar5 = ((int)(param_1 * 2047.0) ^ uVar5) - uVar5;
  uVar6 = 0x7ff;
  if (uVar5 < 0x800) {
    uVar6 = uVar5;
  }
  cVar4 = (char)iVar2;
  uVar5 = (uint)(param_1 <= -0.0004885198) << (0x20U - cVar4 & 0x1f) | *(uint *)(this + 0x10);
  *(uint *)(this + 0x10) = uVar5;
  if (iVar1 == 0) {
    puVar3 = *(uint **)(this + 0x18);
    if (puVar3 == *(uint **)(this + 0x1c)) {
      this[4] = (CBitWrite)0x1;
    }
    else {
      *(uint **)(this + 0x18) = puVar3 + 1;
      *puVar3 = uVar5;
    }
    *(uint *)(this + 0x10) = uVar6;
    *(undefined4 *)(this + 0x14) = 0x15;
    return;
  }
  if (iVar1 < 0xb) {
    uVar5 = ((&CBitBuffer::s_nMaskTable)[iVar1] & uVar6) << (0x21U - cVar4 & 0x1f) | uVar5;
    *(uint *)(this + 0x10) = uVar5;
    puVar3 = *(uint **)(this + 0x18);
    if (puVar3 == *(uint **)(this + 0x1c)) {
      this[4] = (CBitWrite)0x1;
    }
    else {
      *(uint **)(this + 0x18) = puVar3 + 1;
      *puVar3 = uVar5;
    }
    *(int *)(this + 0x14) = iVar2 + 0x14;
    *(uint *)(this + 0x10) = uVar6 >> ((byte)iVar1 & 0x1f);
  }
  else {
    *(int *)(this + 0x14) = iVar2 + -0xc;
    uVar5 = uVar6 << (0x21U - cVar4 & 0x1f) | uVar5;
    *(uint *)(this + 0x10) = uVar5;
    if (iVar2 + -0xc == 0) {
      puVar3 = *(uint **)(this + 0x18);
      if (puVar3 == *(uint **)(this + 0x1c)) {
        this[4] = (CBitWrite)0x1;
      }
      else {
        *(uint **)(this + 0x18) = puVar3 + 1;
        *puVar3 = uVar5;
      }
      *(undefined4 *)(this + 0x10) = 0;
      *(undefined4 *)(this + 0x14) = 0x20;
      return;
    }
  }
  return;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)