L L4D2node

CBitWrite::WriteBitCoord

0x00b74aa0 · 668 bytes · __thiscall

_ZN9CBitWrite13WriteBitCoordEf

Decompiled

undefined (2 params)

/* CBitWrite::WriteBitCoord(float) */

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

{
  int iVar1;
  uint *puVar2;
  byte bVar3;
  uint uVar4;
  uint uVar5;
  int iVar6;
  uint uVar7;
  uint uVar8;
  
  uVar8 = (uint)ABS(param_1);
  uVar4 = (int)(param_1 * 32.0) >> 0x1f;
  uVar4 = ((int)(param_1 * 32.0) ^ uVar4) - uVar4;
  uVar7 = uVar4 & 0x1f;
  iVar1 = *(int *)(this + 0x14);
  uVar5 = (uVar8 & 1) << (0x20U - (char)iVar1 & 0x1f) | *(uint *)(this + 0x10);
  *(int *)(this + 0x14) = iVar1 + -1;
  *(uint *)(this + 0x10) = uVar5;
  if (iVar1 + -1 == 0) {
    puVar2 = *(uint **)(this + 0x18);
    if (puVar2 == *(uint **)(this + 0x1c)) {
      this[4] = (CBitWrite)0x1;
    }
    else {
      *(uint **)(this + 0x18) = puVar2 + 1;
      *puVar2 = uVar5;
    }
    *(undefined4 *)(this + 0x14) = 0x1f;
    *(uint *)(this + 0x10) = uVar4 & 1;
  }
  else {
    *(int *)(this + 0x14) = iVar1 + -2;
    uVar5 = (uVar4 & 1) << (0x21U - (char)iVar1 & 0x1f) | uVar5;
    *(uint *)(this + 0x10) = uVar5;
    if (iVar1 + -2 == 0) {
      puVar2 = *(uint **)(this + 0x18);
      if (puVar2 == *(uint **)(this + 0x1c)) {
        this[4] = (CBitWrite)0x1;
      }
      else {
        *(uint **)(this + 0x18) = puVar2 + 1;
        *puVar2 = uVar5;
      }
      *(undefined4 *)(this + 0x10) = 0;
      *(undefined4 *)(this + 0x14) = 0x20;
    }
  }
  if (uVar7 != 0 || uVar8 != 0) {
    iVar1 = *(int *)(this + 0x14);
    iVar6 = iVar1 + -1;
    *(int *)(this + 0x14) = iVar6;
    uVar4 = (uint)(param_1 <= -0.03125) << (0x20U - (char)iVar1 & 0x1f) | *(uint *)(this + 0x10);
    *(uint *)(this + 0x10) = uVar4;
    if (iVar6 == 0) {
      puVar2 = *(uint **)(this + 0x18);
      if (puVar2 == *(uint **)(this + 0x1c)) {
        this[4] = (CBitWrite)0x1;
      }
      else {
        *(uint **)(this + 0x18) = puVar2 + 1;
        *puVar2 = uVar4;
      }
      *(undefined4 *)(this + 0x10) = 0;
      *(undefined4 *)(this + 0x14) = 0x20;
    }
    if (uVar8 != 0) {
      iVar1 = *(int *)(this + 0x14);
      uVar8 = uVar8 - 1;
      bVar3 = (byte)iVar1;
      if (iVar1 < 0xe) {
        puVar2 = *(uint **)(this + 0x18);
        uVar4 = (*(uint *)(CBitBuffer::s_nMaskTable + iVar1 * 4) & uVar8) << (0x20 - bVar3 & 0x1f) |
                *(uint *)(this + 0x10);
        *(uint *)(this + 0x10) = uVar4;
        if (puVar2 == *(uint **)(this + 0x1c)) {
          this[4] = (CBitWrite)0x1;
        }
        else {
          *(uint **)(this + 0x18) = puVar2 + 1;
          *puVar2 = uVar4;
        }
        *(int *)(this + 0x14) = iVar1 + 0x12;
        *(uint *)(this + 0x10) = uVar8 >> (bVar3 & 0x1f);
      }
      else {
        *(int *)(this + 0x14) = iVar1 + -0xe;
        uVar4 = uVar8 << (0x20 - bVar3 & 0x1f) | *(uint *)(this + 0x10);
        *(uint *)(this + 0x10) = uVar4;
        if (iVar1 + -0xe == 0) {
          puVar2 = *(uint **)(this + 0x18);
          if (puVar2 == *(uint **)(this + 0x1c)) {
            this[4] = (CBitWrite)0x1;
          }
          else {
            *(uint **)(this + 0x18) = puVar2 + 1;
            *puVar2 = uVar4;
          }
          *(undefined4 *)(this + 0x10) = 0;
          *(undefined4 *)(this + 0x14) = 0x20;
        }
      }
    }
    if (uVar7 != 0) {
      iVar1 = *(int *)(this + 0x14);
      bVar3 = (byte)iVar1;
      if (iVar1 < 5) {
        puVar2 = *(uint **)(this + 0x18);
        uVar4 = (uVar7 & *(uint *)(CBitBuffer::s_nMaskTable + iVar1 * 4)) << (0x20 - bVar3 & 0x1f) |
                *(uint *)(this + 0x10);
        *(uint *)(this + 0x10) = uVar4;
        if (puVar2 == *(uint **)(this + 0x1c)) {
          this[4] = (CBitWrite)0x1;
        }
        else {
          *(uint **)(this + 0x18) = puVar2 + 1;
          *puVar2 = uVar4;
        }
        *(int *)(this + 0x14) = iVar1 + 0x1b;
        *(uint *)(this + 0x10) = uVar7 >> (bVar3 & 0x1f);
        return;
      }
      *(int *)(this + 0x14) = iVar1 + -5;
      uVar4 = *(uint *)(this + 0x10) | uVar7 << (0x20 - bVar3 & 0x1f);
      *(uint *)(this + 0x10) = uVar4;
      if (iVar1 + -5 == 0) {
        puVar2 = *(uint **)(this + 0x18);
        if (puVar2 == *(uint **)(this + 0x1c)) {
          this[4] = (CBitWrite)0x1;
        }
        else {
          *(uint **)(this + 0x18) = puVar2 + 1;
          *puVar2 = uVar4;
        }
        *(undefined4 *)(this + 0x10) = 0;
        *(undefined4 *)(this + 0x14) = 0x20;
      }
    }
  }
  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)