L L4D2node

CBitRead::ReadBitCellCoord

0x0009f940 · 1161 bytes · __thiscall

_ZN8CBitRead16ReadBitCellCoordEi13EBitCoordType

Decompiled

undefined (3 params)

/* CBitRead::ReadBitCellCoord(int, EBitCoordType) */

longdouble __thiscall CBitRead::ReadBitCellCoord(CBitRead *this,int param_1,int param_3)

{
  uint *puVar1;
  undefined4 *puVar2;
  uint uVar3;
  undefined4 uVar4;
  int iVar5;
  int iVar6;
  uint uVar7;
  double dVar8;
  double dVar9;
  double dVar10;
  uint local_18;
  
  if (param_3 == 2) {
    iVar6 = *(int *)(this + 0x14);
    if (param_1 <= iVar6) {
      uVar7 = (&CBitBuffer::s_nMaskTable)[param_1];
      *(int *)(this + 0x14) = iVar6 - param_1;
      uVar7 = uVar7 & *(uint *)(this + 0x10);
      if (iVar6 - param_1 != 0) {
        *(uint *)(this + 0x10) = *(uint *)(this + 0x10) >> ((byte)param_1 & 0x1f);
        return (longdouble)((float)(uVar7 >> 0x10) * 65536.0 + (float)(uVar7 & 0xffff));
      }
      puVar2 = *(undefined4 **)(this + 0x18);
      *(undefined4 *)(this + 0x14) = 0x20;
      if (puVar2 == *(undefined4 **)(this + 0x1c)) {
        *(undefined4 *)(this + 0x14) = 1;
        *(undefined4 *)(this + 0x10) = 0;
        *(undefined4 **)(this + 0x18) = puVar2 + 1;
        return (longdouble)((float)(uVar7 >> 0x10) * 65536.0 + (float)(uVar7 & 0xffff));
      }
      if (*(undefined4 **)(this + 0x1c) < puVar2) {
        this[4] = (CBitRead)0x1;
        *(undefined4 *)(this + 0x10) = 0;
      }
      else {
        *(undefined4 **)(this + 0x18) = puVar2 + 1;
        *(undefined4 *)(this + 0x10) = *puVar2;
      }
LAB_0009fccd:
      return (longdouble)((float)(uVar7 >> 0x10) * 65536.0 + (float)(uVar7 & 0xffff));
    }
    puVar1 = *(uint **)(this + 0x18);
    uVar7 = *(uint *)(this + 0x10);
    if (puVar1 == *(uint **)(this + 0x1c)) {
      *(undefined4 *)(this + 0x14) = 1;
      *(undefined4 *)(this + 0x10) = 0;
      *(uint **)(this + 0x18) = puVar1 + 1;
      this[4] = (CBitRead)0x1;
      return (longdouble)0;
    }
    if (*(uint **)(this + 0x1c) < puVar1) {
      this[4] = (CBitRead)0x1;
      *(undefined4 *)(this + 0x10) = 0;
    }
    else {
      *(uint **)(this + 0x18) = puVar1 + 1;
      uVar3 = *puVar1;
      *(uint *)(this + 0x10) = uVar3;
      if (this[4] == (CBitRead)0x0) {
        param_1 = param_1 - iVar6;
        uVar7 = ((&CBitBuffer::s_nMaskTable)[param_1] & uVar3) << ((byte)iVar6 & 0x1f) | uVar7;
        *(int *)(this + 0x14) = 0x20 - param_1;
        *(uint *)(this + 0x10) = uVar3 >> ((byte)param_1 & 0x1f);
        goto LAB_0009fccd;
      }
    }
    return (longdouble)0;
  }
  iVar6 = *(int *)(this + 0x14);
  if (iVar6 < param_1) {
    puVar1 = *(uint **)(this + 0x18);
    uVar7 = *(uint *)(this + 0x10);
    if (puVar1 == *(uint **)(this + 0x1c)) {
      *(undefined4 *)(this + 0x14) = 1;
      iVar6 = 1;
      *(undefined4 *)(this + 0x10) = 0;
      *(uint **)(this + 0x18) = puVar1 + 1;
      this[4] = (CBitRead)0x1;
    }
    else {
      if (puVar1 <= *(uint **)(this + 0x1c)) {
        *(uint **)(this + 0x18) = puVar1 + 1;
        local_18 = *puVar1;
        *(uint *)(this + 0x10) = local_18;
        if (this[4] == (CBitRead)0x0) {
          param_1 = param_1 - iVar6;
          uVar3 = (&CBitBuffer::s_nMaskTable)[param_1];
          *(int *)(this + 0x14) = 0x20 - param_1;
          uVar7 = (uVar3 & local_18) << ((byte)iVar6 & 0x1f) | uVar7;
          iVar6 = 0x20 - param_1;
          goto LAB_0009f9a9;
        }
        dVar9 = 0.0;
        goto LAB_0009f9b7;
      }
      this[4] = (CBitRead)0x1;
      *(undefined4 *)(this + 0x10) = 0;
    }
    local_18 = 0;
    dVar9 = 0.0;
  }
  else {
    local_18 = *(uint *)(this + 0x10);
    iVar6 = iVar6 - param_1;
    uVar7 = (&CBitBuffer::s_nMaskTable)[param_1];
    *(int *)(this + 0x14) = iVar6;
    uVar7 = uVar7 & local_18;
    if (iVar6 == 0) {
      puVar1 = *(uint **)(this + 0x18);
      *(undefined4 *)(this + 0x14) = 0x20;
      if (puVar1 == *(uint **)(this + 0x1c)) {
        *(undefined4 *)(this + 0x14) = 1;
        iVar6 = 1;
        dVar9 = (double)(int)uVar7;
        *(undefined4 *)(this + 0x10) = 0;
        *(uint **)(this + 0x18) = puVar1 + 1;
        local_18 = 0;
      }
      else if (*(uint **)(this + 0x1c) < puVar1) {
        dVar9 = (double)(int)uVar7;
        this[4] = (CBitRead)0x1;
        iVar6 = 0x20;
        *(undefined4 *)(this + 0x10) = 0;
        local_18 = 0;
      }
      else {
        iVar6 = 0x20;
        dVar9 = (double)(int)uVar7;
        *(uint **)(this + 0x18) = puVar1 + 1;
        local_18 = *puVar1;
        *(uint *)(this + 0x10) = local_18;
      }
    }
    else {
LAB_0009f9a9:
      dVar9 = (double)(int)uVar7;
      local_18 = local_18 >> ((byte)param_1 & 0x1f);
      *(uint *)(this + 0x10) = local_18;
    }
  }
LAB_0009f9b7:
  iVar5 = (-(uint)(param_3 != 1) & 2) + 3;
  if (iVar6 < iVar5) {
    puVar1 = *(uint **)(this + 0x18);
    if (puVar1 == *(uint **)(this + 0x1c)) {
      *(undefined4 *)(this + 0x14) = 1;
      *(undefined4 *)(this + 0x10) = 0;
      *(uint **)(this + 0x18) = puVar1 + 1;
      this[4] = (CBitRead)0x1;
    }
    else if (*(uint **)(this + 0x1c) < puVar1) {
      this[4] = (CBitRead)0x1;
      *(undefined4 *)(this + 0x10) = 0;
    }
    else {
      *(uint **)(this + 0x18) = puVar1 + 1;
      uVar7 = *puVar1;
      *(uint *)(this + 0x10) = uVar7;
      if (this[4] == (CBitRead)0x0) {
        iVar5 = iVar5 - iVar6;
        uVar3 = (&CBitBuffer::s_nMaskTable)[iVar5];
        uVar4 = *(undefined4 *)(this + 0x14);
        *(int *)(this + 0x14) = 0x20 - iVar5;
        *(uint *)(this + 0x10) = uVar7 >> ((byte)iVar5 & 0x1f);
        dVar8 = (double)(int)((uVar3 & uVar7) << ((byte)uVar4 & 0x1f) | local_18);
        goto joined_r0x0009fa6b;
      }
    }
    dVar8 = 0.0;
  }
  else {
    *(int *)(this + 0x14) = iVar6 - iVar5;
    uVar7 = local_18 & (&CBitBuffer::s_nMaskTable)[iVar5];
    if (iVar6 - iVar5 == 0) {
      puVar2 = *(undefined4 **)(this + 0x18);
      *(undefined4 *)(this + 0x14) = 0x20;
      if (puVar2 == *(undefined4 **)(this + 0x1c)) {
        *(undefined4 *)(this + 0x14) = 1;
        *(undefined4 *)(this + 0x10) = 0;
        *(undefined4 **)(this + 0x18) = puVar2 + 1;
        dVar8 = (double)(int)uVar7;
      }
      else if (*(undefined4 **)(this + 0x1c) < puVar2) {
        this[4] = (CBitRead)0x1;
        *(undefined4 *)(this + 0x10) = 0;
        dVar8 = (double)(int)uVar7;
      }
      else {
        *(undefined4 **)(this + 0x18) = puVar2 + 1;
        dVar8 = (double)(int)uVar7;
        *(undefined4 *)(this + 0x10) = *puVar2;
      }
    }
    else {
      dVar8 = (double)(int)uVar7;
      *(uint *)(this + 0x10) = local_18 >> (sbyte)iVar5;
    }
  }
joined_r0x0009fa6b:
  if (param_3 != 1) {
    dVar10 = 0.03125;
  }
  else {
    dVar10 = 0.125;
  }
  return (longdouble)(float)(dVar8 * dVar10 + dVar9);
}

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)