L L4D2node

CBitWrite::WriteBitCoordMP

0x00256080 · 1310 bytes · __thiscall

_ZN9CBitWrite15WriteBitCoordMPEf13EBitCoordType

Decompiled

undefined (3 params)

/* CBitWrite::WriteBitCoordMP(float, EBitCoordType) */

void __thiscall CBitWrite::WriteBitCoordMP(CBitWrite *this,float param_1,int param_3)

{
  uint *puVar1;
  bool bVar2;
  char cVar3;
  byte bVar4;
  byte bVar5;
  uint uVar6;
  int iVar7;
  uint uVar8;
  int iVar9;
  bool local_19;
  uint local_18;
  
  if (param_3 != 1) {
    local_19 = param_1 <= -0.03125;
    uVar8 = (int)(param_1 * 32.0) >> 0x1f;
    local_18 = ((int)(param_1 * 32.0) ^ uVar8) - uVar8 & 0x1f;
  }
  else {
    local_19 = param_1 <= -0.125;
    uVar8 = (int)(param_1 * 8.0) >> 0x1f;
    local_18 = ((int)(param_1 * 8.0) ^ uVar8) - uVar8 & 7;
  }
  uVar8 = (uint)ABS(param_1);
  iVar9 = *(int *)(this + 0x14);
  bVar2 = (int)uVar8 < 0x800;
  uVar6 = (uint)bVar2 << (0x20U - (char)iVar9 & 0x1f) | *(uint *)(this + 0x10);
  *(int *)(this + 0x14) = iVar9 + -1;
  *(uint *)(this + 0x10) = uVar6;
  if (iVar9 + -1 == 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;
    iVar9 = 0x1f;
    uVar6 = 0;
    *(undefined4 *)(this + 0x14) = 0x20;
    bVar4 = 0;
  }
  else {
    bVar4 = 0x21 - (char)iVar9;
    iVar9 = iVar9 + -2;
  }
  *(int *)(this + 0x14) = iVar9;
  uVar6 = (uVar8 & 1) << (bVar4 & 0x1f) | uVar6;
  *(uint *)(this + 0x10) = uVar6;
  if (param_3 == 2) {
    if (iVar9 == 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;
    }
    if (uVar8 == 0) {
      return;
    }
    cVar3 = (char)*(int *)(this + 0x14);
    uVar6 = (uint)local_19 << (0x20U - cVar3 & 0x1f) | *(uint *)(this + 0x10);
    iVar9 = *(int *)(this + 0x14) + -1;
    *(int *)(this + 0x14) = iVar9;
    *(uint *)(this + 0x10) = uVar6;
    if (iVar9 == 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;
      uVar6 = 0;
      iVar9 = 0x20;
      *(undefined4 *)(this + 0x14) = 0x20;
      bVar4 = 0;
    }
    else {
      bVar4 = 0x21 - cVar3;
    }
    uVar8 = uVar8 - 1;
    if (bVar2) {
      if (iVar9 < 0xb) {
        uVar6 = ((&CBitBuffer::s_nMaskTable)[iVar9] & uVar8) << (bVar4 & 0x1f) | uVar6;
        puVar1 = *(uint **)(this + 0x18);
        *(uint *)(this + 0x10) = uVar6;
        if (puVar1 == *(uint **)(this + 0x1c)) {
          this[4] = (CBitWrite)0x1;
        }
        else {
          *(uint **)(this + 0x18) = puVar1 + 1;
          *puVar1 = uVar6;
        }
        *(int *)(this + 0x14) = iVar9 + 0x15;
        *(uint *)(this + 0x10) = uVar8 >> ((byte)iVar9 & 0x1f);
        return;
      }
      iVar9 = iVar9 + -0xb;
      uVar6 = uVar8 << (bVar4 & 0x1f) | uVar6;
      *(int *)(this + 0x14) = iVar9;
      *(uint *)(this + 0x10) = uVar6;
    }
    else {
      if (iVar9 < 0xe) {
        uVar6 = ((&CBitBuffer::s_nMaskTable)[iVar9] & uVar8) << (bVar4 & 0x1f) | uVar6;
        puVar1 = *(uint **)(this + 0x18);
        *(uint *)(this + 0x10) = uVar6;
        if (puVar1 == *(uint **)(this + 0x1c)) {
          this[4] = (CBitWrite)0x1;
        }
        else {
          *(uint **)(this + 0x18) = puVar1 + 1;
          *puVar1 = uVar6;
        }
        *(int *)(this + 0x14) = iVar9 + 0x12;
        *(uint *)(this + 0x10) = uVar8 >> ((byte)iVar9 & 0x1f);
        return;
      }
      iVar9 = iVar9 + -0xe;
      uVar6 = uVar8 << (bVar4 & 0x1f) | uVar6;
      *(int *)(this + 0x14) = iVar9;
      *(uint *)(this + 0x10) = uVar6;
    }
    if (iVar9 != 0) {
      return;
    }
    puVar1 = *(uint **)(this + 0x18);
    if (puVar1 != *(uint **)(this + 0x1c)) {
      *(uint **)(this + 0x18) = puVar1 + 1;
      *puVar1 = uVar6;
      goto LAB_0025621d;
    }
  }
  else {
    if (iVar9 == 0) {
      puVar1 = *(uint **)(this + 0x18);
      if (puVar1 == *(uint **)(this + 0x1c)) {
        this[4] = (CBitWrite)0x1;
      }
      else {
        *(uint **)(this + 0x18) = puVar1 + 1;
        *puVar1 = uVar6;
      }
      uVar6 = (uint)local_19;
      *(undefined4 *)(this + 0x14) = 0x1f;
      bVar4 = 1;
      iVar7 = 0x1f;
      *(uint *)(this + 0x10) = uVar6;
    }
    else {
      iVar7 = iVar9 + -1;
      uVar6 = (uint)local_19 << (0x20U - (char)iVar9 & 0x1f) | uVar6;
      *(uint *)(this + 0x10) = uVar6;
      *(int *)(this + 0x14) = iVar7;
      if (iVar7 == 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;
        uVar6 = 0;
        iVar7 = 0x20;
        *(undefined4 *)(this + 0x14) = 0x20;
        bVar4 = 0;
      }
      else {
        bVar4 = 0x21 - (char)iVar9;
      }
    }
    if (uVar8 != 0) {
      uVar8 = uVar8 - 1;
      bVar5 = (byte)iVar7;
      if (bVar2) {
        if (iVar7 < 0xb) {
          puVar1 = *(uint **)(this + 0x18);
          uVar6 = (uVar8 & (&CBitBuffer::s_nMaskTable)[iVar7]) << (bVar4 & 0x1f) | uVar6;
          *(uint *)(this + 0x10) = uVar6;
          if (puVar1 == *(uint **)(this + 0x1c)) {
            this[4] = (CBitWrite)0x1;
          }
          else {
            *(uint **)(this + 0x18) = puVar1 + 1;
            *puVar1 = uVar6;
          }
          iVar7 = iVar7 + 0x15;
          uVar6 = uVar8 >> (bVar5 & 0x1f);
          *(int *)(this + 0x14) = iVar7;
          bVar4 = 0xb - bVar5;
          *(uint *)(this + 0x10) = uVar6;
        }
        else {
          iVar7 = iVar7 + -0xb;
          uVar6 = uVar8 << (bVar4 & 0x1f) | uVar6;
          *(int *)(this + 0x14) = iVar7;
          *(uint *)(this + 0x10) = uVar6;
          if (iVar7 == 0) {
LAB_002561b5:
            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;
            bVar4 = 0;
            uVar6 = 0;
            *(undefined4 *)(this + 0x14) = 0x20;
            iVar7 = 0x20;
          }
          else {
            bVar4 = 0x2b - bVar5;
          }
        }
      }
      else if (iVar7 < 0xe) {
        puVar1 = *(uint **)(this + 0x18);
        uVar6 = (uVar8 & (&CBitBuffer::s_nMaskTable)[iVar7]) << (bVar4 & 0x1f) | uVar6;
        *(uint *)(this + 0x10) = uVar6;
        if (puVar1 == *(uint **)(this + 0x1c)) {
          this[4] = (CBitWrite)0x1;
        }
        else {
          *(uint **)(this + 0x18) = puVar1 + 1;
          *puVar1 = uVar6;
        }
        iVar7 = iVar7 + 0x12;
        uVar6 = uVar8 >> (bVar5 & 0x1f);
        *(int *)(this + 0x14) = iVar7;
        bVar4 = 0xe - bVar5;
        *(uint *)(this + 0x10) = uVar6;
      }
      else {
        iVar7 = iVar7 + -0xe;
        uVar6 = uVar8 << (bVar4 & 0x1f) | uVar6;
        *(int *)(this + 0x14) = iVar7;
        *(uint *)(this + 0x10) = uVar6;
        if (iVar7 == 0) goto LAB_002561b5;
        bVar4 = 0x2e - bVar5;
      }
    }
    iVar9 = (-(uint)(param_3 != 1) & 2) + 3;
    if (iVar7 < iVar9) {
      puVar1 = *(uint **)(this + 0x18);
      uVar6 = (local_18 & (&CBitBuffer::s_nMaskTable)[iVar7]) << (bVar4 & 0x1f) | uVar6;
      *(uint *)(this + 0x10) = uVar6;
      if (puVar1 == *(uint **)(this + 0x1c)) {
        this[4] = (CBitWrite)0x1;
      }
      else {
        *(uint **)(this + 0x18) = puVar1 + 1;
        *puVar1 = uVar6;
      }
      *(int *)(this + 0x14) = 0x20 - (iVar9 - iVar7);
      *(uint *)(this + 0x10) = local_18 >> ((byte)iVar7 & 0x1f);
      return;
    }
    *(int *)(this + 0x14) = iVar7 - iVar9;
    uVar6 = local_18 << (bVar4 & 0x1f) | uVar6;
    *(uint *)(this + 0x10) = uVar6;
    if (iVar7 - iVar9 != 0) {
      return;
    }
    puVar1 = *(uint **)(this + 0x18);
    if (puVar1 != *(uint **)(this + 0x1c)) {
      *(uint **)(this + 0x18) = puVar1 + 1;
      *puVar1 = uVar6;
      goto LAB_0025621d;
    }
  }
  this[4] = (CBitWrite)0x1;
LAB_0025621d:
  *(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)