L L4D2node

bf_write::WriteBitCoord

0x00098ea0 · 634 bytes · __thiscall

_ZN8bf_write13WriteBitCoordEf

Decompiled

undefined (2 params)

/* bf_write::WriteBitCoord(float) */

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

{
  byte *pbVar1;
  uint uVar2;
  uint uVar3;
  uint uVar4;
  int iVar5;
  int iVar6;
  uint *puVar7;
  int iVar8;
  byte local_14;
  
  iVar8 = (int)ABS(param_1);
  uVar2 = (int)(param_1 * 32.0) >> 0x1f;
  iVar5 = *(int *)(this + 0xc);
  uVar2 = ((int)(param_1 * 32.0) ^ uVar2) - uVar2 & 0x1f;
  if (iVar5 < *(int *)(this + 8)) {
    if (this[0x10] == (bf_write)0x0) {
      if (iVar8 == 0) {
        pbVar1 = (byte *)(*(int *)this + (iVar5 >> 3));
        *pbVar1 = *pbVar1 & ~(byte)(1 << ((byte)iVar5 & 7));
      }
      else {
        local_14 = (byte)(1 << ((byte)iVar5 & 7));
        pbVar1 = (byte *)(*(int *)this + (iVar5 >> 3));
        *pbVar1 = *pbVar1 | local_14;
      }
      iVar5 = *(int *)(this + 0xc) + 1;
      *(int *)(this + 0xc) = iVar5;
      if (*(int *)(this + 8) <= iVar5) goto LAB_00098f60;
    }
    if (this[0x10] == (bf_write)0x0) {
      if (uVar2 == 0) {
        pbVar1 = (byte *)(*(int *)this + (iVar5 >> 3));
        *pbVar1 = *pbVar1 & ~(byte)(1 << ((byte)iVar5 & 7));
      }
      else {
        local_14 = (byte)(1 << ((byte)iVar5 & 7));
        pbVar1 = (byte *)(*(int *)this + (iVar5 >> 3));
        *pbVar1 = *pbVar1 | local_14;
      }
      *(int *)(this + 0xc) = *(int *)(this + 0xc) + 1;
    }
    if (uVar2 == 0 && iVar8 == 0) {
      return;
    }
  }
  else {
LAB_00098f60:
    this[0x10] = (bf_write)0x1;
    if (uVar2 == 0 && iVar8 == 0) {
      return;
    }
  }
  iVar5 = *(int *)(this + 0xc);
  if (iVar5 < *(int *)(this + 8)) {
    if (this[0x10] == (bf_write)0x0) {
      if (param_1 <= -0.03125) {
        local_14 = (byte)(1 << ((byte)iVar5 & 7));
        pbVar1 = (byte *)(*(int *)this + (iVar5 >> 3));
        *pbVar1 = *pbVar1 | local_14;
      }
      else {
        pbVar1 = (byte *)(*(int *)this + (iVar5 >> 3));
        *pbVar1 = *pbVar1 & ~(byte)(1 << ((byte)iVar5 & 7));
      }
      *(int *)(this + 0xc) = *(int *)(this + 0xc) + 1;
    }
  }
  else {
    this[0x10] = (bf_write)0x1;
  }
  if (iVar8 != 0) {
    uVar3 = *(uint *)(this + 0xc);
    if (*(int *)(this + 8) < (int)(uVar3 + 0xe)) {
      *(int *)(this + 0xc) = *(int *)(this + 8);
      this[0x10] = (bf_write)0x1;
    }
    else {
      uVar4 = uVar3 & 0x1f;
      iVar5 = ((int)uVar3 >> 5) * 4;
      puVar7 = (uint *)(*(int *)this + iVar5);
      iVar6 = 0x20 - uVar4;
      *puVar7 = iVar8 - 1U << (sbyte)uVar4 | *puVar7 & *(uint *)(&DAT_000d6af8 + uVar4 * 0x84);
      if (iVar6 < 0xe) {
        puVar7 = (uint *)(*(int *)this + 4 + iVar5);
        *puVar7 = (&g_BitWriteMasks)[0xe - iVar6] & *puVar7 | iVar8 - 1U >> ((byte)iVar6 & 0x1f);
      }
      *(int *)(this + 0xc) = *(int *)(this + 0xc) + 0xe;
    }
  }
  if (uVar2 != 0) {
    uVar3 = *(uint *)(this + 0xc);
    if (*(int *)(this + 8) < (int)(uVar3 + 5)) {
      *(int *)(this + 0xc) = *(int *)(this + 8);
      this[0x10] = (bf_write)0x1;
    }
    else {
      iVar5 = ((int)uVar3 >> 5) * 4;
      uVar3 = uVar3 & 0x1f;
      puVar7 = (uint *)(*(int *)this + iVar5);
      iVar8 = 0x20 - uVar3;
      *puVar7 = uVar2 << (sbyte)uVar3 | *puVar7 & *(uint *)(&DAT_000d6ad4 + uVar3 * 0x84);
      if (iVar8 < 5) {
        puVar7 = (uint *)(*(int *)this + 4 + iVar5);
        *puVar7 = uVar2 >> ((byte)iVar8 & 0x1f) | (&g_BitWriteMasks)[5 - iVar8] & *puVar7;
      }
      *(int *)(this + 0xc) = *(int *)(this + 0xc) + 5;
    }
  }
  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)