L L4D2node

CCoreDispSurface::CalcLuxelCoords

0x000bd990 · 783 bytes · __thiscall

_ZN16CCoreDispSurface15CalcLuxelCoordsEibRK6VectorS2_

Decompiled

undefined (5 params)

/* CCoreDispSurface::CalcLuxelCoords(int, bool, Vector const&, Vector const&) */

bool __thiscall
CCoreDispSurface::CalcLuxelCoords
          (CCoreDispSurface *this,int param_1,bool param_2,Vector *param_3,Vector *param_4)

{
  int iVar1;
  bool bVar2;
  char cVar3;
  CCoreDispSurface *pCVar4;
  CCoreDispSurface *pCVar5;
  CCoreDispSurface *pCVar6;
  CCoreDispSurface *pCVar7;
  int iVar8;
  CCoreDispSurface *pCVar9;
  float fVar10;
  float fVar11;
  float fVar12;
  float fVar13;
  float fVar14;
  float fVar15;
  float fVar16;
  float fVar17;
  float fVar18;
  float fVar19;
  float fVar20;
  int local_28;
  int local_24;
  int local_20;
  
  if (0.0 < (float)param_1) {
    if (param_2) {
      iVar1 = *(int *)(this + 0x198);
      local_20 = iVar1 % 4;
      local_24 = (iVar1 + 3) % 4;
      iVar8 = (iVar1 + 1) % 4;
      local_28 = (iVar1 + 2) % 4;
    }
    else {
      local_28 = 2;
      iVar8 = 1;
      local_24 = 3;
      local_20 = 0;
    }
    cVar3 = LongestInU(this,param_3,param_4);
    fVar10 = *(float *)(this + local_24 * 0xc + 8) - *(float *)(this + local_20 * 0xc + 8);
    fVar12 = *(float *)(this + local_24 * 0xc + 0x10) - *(float *)(this + local_20 * 0xc + 0x10);
    fVar13 = *(float *)(this + local_24 * 0xc + 0xc) - *(float *)(this + local_20 * 0xc + 0xc);
    fVar15 = *(float *)(this + local_28 * 0xc + 8) - *(float *)(this + iVar8 * 0xc + 8);
    fVar11 = *(float *)(this + local_28 * 0xc + 0x10) - *(float *)(this + iVar8 * 0xc + 0x10);
    fVar14 = *(float *)(this + local_28 * 0xc + 0xc) - *(float *)(this + iVar8 * 0xc + 0xc);
    fVar20 = *(float *)(this + iVar8 * 0xc + 8) - *(float *)(this + local_20 * 0xc + 8);
    fVar18 = *(float *)(this + iVar8 * 0xc + 0xc) - *(float *)(this + local_20 * 0xc + 0xc);
    fVar17 = *(float *)(this + iVar8 * 0xc + 0x10) - *(float *)(this + local_20 * 0xc + 0x10);
    fVar19 = *(float *)(this + local_28 * 0xc + 0x10) - *(float *)(this + local_24 * 0xc + 0x10);
    fVar16 = *(float *)(this + local_28 * 0xc + 0xc) - *(float *)(this + local_24 * 0xc + 0xc);
    fVar12 = SQRT(fVar12 * fVar12 + fVar13 * fVar13 + fVar10 * fVar10);
    fVar13 = *(float *)(this + local_28 * 0xc + 8) - *(float *)(this + local_24 * 0xc + 8);
    fVar10 = SQRT(fVar11 * fVar11 + fVar15 * fVar15 + fVar14 * fVar14);
    if (fVar10 <= fVar12) {
      fVar10 = fVar12;
    }
    fVar14 = SQRT(fVar18 * fVar18 + fVar20 * fVar20 + fVar17 * fVar17);
    fVar11 = SQRT(fVar16 * fVar16 + fVar13 * fVar13 + fVar19 * fVar19);
    fVar12 = 1.0 / (float)param_1;
    if (fVar11 <= fVar14) {
      fVar11 = fVar14;
    }
    fVar10 = (float)((int)(fVar10 * fVar12) + 1);
    if (125.0 <= fVar10) {
      fVar10 = 125.0;
    }
    fVar11 = (float)((int)(fVar11 * fVar12) + 1);
    if (125.0 <= fVar11) {
      fVar11 = 125.0;
    }
    if (cVar3 == '\0') {
      bVar2 = fVar11 < fVar10;
    }
    else {
      bVar2 = fVar10 < fVar11;
    }
    *(int *)(this + 0x118) = (int)fVar10;
    *(int *)(this + 0x11c) = (int)fVar11;
    pCVar4 = this + local_20 * 8;
    pCVar6 = this + local_28 * 8;
    pCVar7 = this + local_24 * 8;
    pCVar9 = this + iVar8 * 8;
    do {
      *(undefined4 *)(pCVar4 + 0x88) = 0x3f000000;
      pCVar5 = pCVar4 + 0x20;
      *(undefined4 *)(pCVar4 + 0x8c) = 0x3f000000;
      *(undefined4 *)(pCVar9 + 0x88) = 0x3f000000;
      *(float *)(pCVar9 + 0x8c) = fVar11 + 0.5;
      *(float *)(pCVar6 + 0x88) = fVar10 + 0.5;
      *(float *)(pCVar6 + 0x8c) = fVar11 + 0.5;
      *(float *)(pCVar7 + 0x88) = fVar10 + 0.5;
      *(undefined4 *)(pCVar7 + 0x8c) = 0x3f000000;
      pCVar4 = pCVar5;
      pCVar6 = pCVar6 + 0x20;
      pCVar7 = pCVar7 + 0x20;
      pCVar9 = pCVar9 + 0x20;
    } while (pCVar5 != this + local_20 * 8 + 0x80);
    return bVar2;
  }
  return false;
}

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)