L L4D2node

CBitWrite::WriteBitCellCoord

0x00b75340 · 633 bytes · __thiscall

_ZN9CBitWrite17WriteBitCellCoordEfi13EBitCoordType

Decompiled

undefined (4 params)

/* CBitWrite::WriteBitCellCoord(float, int, EBitCoordType) */

void __thiscall CBitWrite::WriteBitCellCoord(CBitWrite *this,float param_1,int param_2,int param_4)

{
  uint *puVar1;
  byte bVar2;
  byte bVar3;
  uint uVar4;
  int iVar5;
  uint uVar6;
  bool bVar7;
  uint local_14;
  
  uVar6 = (uint)ABS(param_1);
  bVar7 = param_4 != 1;
  if (bVar7) {
    uVar4 = (int)(param_1 * 32.0) >> 0x1f;
    local_14 = ((int)(param_1 * 32.0) ^ uVar4) - uVar4 & 0x1f;
    if (param_4 == 2) {
      iVar5 = *(int *)(this + 0x14);
      bVar3 = (byte)iVar5;
      if (iVar5 < param_2) {
        puVar1 = *(uint **)(this + 0x18);
        uVar4 = (*(uint *)(CBitBuffer::s_nMaskTable + iVar5 * 4) & uVar6) << (0x20 - bVar3 & 0x1f) |
                *(uint *)(this + 0x10);
        *(uint *)(this + 0x10) = uVar4;
        if (puVar1 == *(uint **)(this + 0x1c)) {
          this[4] = (CBitWrite)0x1;
        }
        else {
          *(uint **)(this + 0x18) = puVar1 + 1;
          *puVar1 = uVar4;
        }
        *(uint *)(this + 0x10) = uVar6 >> (bVar3 & 0x1f);
        *(int *)(this + 0x14) = 0x20 - (param_2 - iVar5);
        return;
      }
      iVar5 = iVar5 - param_2;
      *(int *)(this + 0x14) = iVar5;
      uVar6 = *(uint *)(this + 0x10) | uVar6 << (0x20 - bVar3 & 0x1f);
      *(uint *)(this + 0x10) = uVar6;
      goto joined_r0x00b75599;
    }
  }
  else {
    uVar4 = (int)(param_1 * 8.0) >> 0x1f;
    local_14 = ((int)(param_1 * 8.0) ^ uVar4) - uVar4 & 7;
  }
  iVar5 = *(int *)(this + 0x14);
  bVar3 = (byte)iVar5;
  if (iVar5 < param_2) {
    puVar1 = *(uint **)(this + 0x18);
    param_2 = param_2 - iVar5;
    uVar4 = (*(uint *)(CBitBuffer::s_nMaskTable + iVar5 * 4) & uVar6) << (0x20 - bVar3 & 0x1f) |
            *(uint *)(this + 0x10);
    *(uint *)(this + 0x10) = uVar4;
    if (puVar1 == *(uint **)(this + 0x1c)) {
      this[4] = (CBitWrite)0x1;
    }
    else {
      *(uint **)(this + 0x18) = puVar1 + 1;
      *puVar1 = uVar4;
    }
    uVar6 = uVar6 >> (bVar3 & 0x1f);
    *(uint *)(this + 0x10) = uVar6;
    iVar5 = 0x20 - param_2;
    *(int *)(this + 0x14) = iVar5;
LAB_00b753f0:
    bVar2 = (byte)param_2;
    uVar4 = (-(uint)bVar7 & 2) + 3;
    bVar3 = bVar2;
    if (iVar5 < (int)uVar4) {
LAB_00b75530:
      puVar1 = *(uint **)(this + 0x18);
      uVar6 = (local_14 & *(uint *)(CBitBuffer::s_nMaskTable + iVar5 * 4)) << (bVar3 & 0x1f) | uVar6
      ;
      *(uint *)(this + 0x10) = uVar6;
      if (puVar1 == *(uint **)(this + 0x1c)) {
        this[4] = (CBitWrite)0x1;
      }
      else {
        *(uint **)(this + 0x18) = puVar1 + 1;
        *puVar1 = uVar6;
      }
      *(uint *)(this + 0x14) = 0x20 - (uVar4 - iVar5);
      *(uint *)(this + 0x10) = local_14 >> ((byte)iVar5 & 0x1f);
      return;
    }
  }
  else {
    iVar5 = iVar5 - param_2;
    uVar6 = *(uint *)(this + 0x10) | uVar6 << (0x20 - bVar3 & 0x1f);
    *(uint *)(this + 0x10) = uVar6;
    *(int *)(this + 0x14) = iVar5;
    if (iVar5 != 0) {
      param_2 = 0x20 - iVar5;
      goto LAB_00b753f0;
    }
    puVar1 = *(uint **)(this + 0x18);
    if (puVar1 == *(uint **)(this + 0x1c)) {
      this[4] = (CBitWrite)0x1;
    }
    else {
      *(uint **)(this + 0x18) = puVar1 + 1;
      *puVar1 = uVar6;
    }
    uVar6 = 0;
    iVar5 = 0x20;
    *(undefined4 *)(this + 0x10) = 0;
    *(undefined4 *)(this + 0x14) = 0x20;
    uVar4 = (-(uint)bVar7 & 2) + 3;
    bVar3 = 0;
    bVar2 = 0;
    if (0x20 < uVar4) goto LAB_00b75530;
  }
  iVar5 = iVar5 - uVar4;
  *(int *)(this + 0x14) = iVar5;
  uVar6 = local_14 << (bVar2 & 0x1f) | uVar6;
  *(uint *)(this + 0x10) = uVar6;
joined_r0x00b75599:
  if (iVar5 == 0) {
    puVar1 = *(uint **)(this + 0x18);
    if (puVar1 == *(uint **)(this + 0x1c)) {
      this[4] = (CBitWrite)0x1;
    }
    else {
      *(uint **)(this + 0x18) = puVar1 + 1;
      *puVar1 = uVar6;
    }
    *(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)