L L4D2node

CFuncLadder::Spawn

0x0044ee70 · 2587 bytes · __thiscall

_ZN11CFuncLadder5SpawnEv

Decompiled

undefined (1 param)

/* CFuncLadder::Spawn() */

void __thiscall CFuncLadder::Spawn(CFuncLadder *this)

{
  Vector *pVVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  float fVar6;
  float fVar7;
  CFuncLadder CVar8;
  CBaseEdict *pCVar9;
  bool bVar10;
  int iVar11;
  int iVar12;
  char *pcVar13;
  undefined1 *puVar14;
  undefined1 *puVar15;
  float fVar16;
  float fVar17;
  float fVar18;
  float fVar19;
  float fVar20;
  float fVar21;
  float local_13c [4];
  float local_12c [4];
  undefined4 local_11c;
  undefined4 local_118;
  undefined4 local_114;
  float local_10c;
  float local_108;
  float local_104;
  float local_fc;
  float local_f8;
  float local_f4;
  undefined4 local_ec;
  undefined1 local_e8;
  undefined1 local_e7;
  Vector local_d0 [12];
  Vector local_c4 [43];
  char local_99;
  int local_84;
  float local_7c;
  float local_78;
  float local_74;
  Vector local_70 [4];
  undefined4 local_6c;
  undefined4 local_68;
  undefined4 local_64;
  float local_5c;
  float local_58;
  float local_54;
  float local_4c;
  undefined4 local_48;
  float local_44;
  undefined4 local_3c;
  undefined1 local_38;
  undefined1 local_37;
  int local_30;
  
  CBaseEntity::Spawn((CBaseEntity *)this);
  CCollisionProperty::SetSolid((CCollisionProperty *)(this + 0x194),0);
  CBaseEntity::SetMoveType((CBaseEntity *)this,0,0);
  CBaseEntity::SetCollisionGroup((CBaseEntity *)this,0);
  *(undefined4 *)(this + 0x260) = 0;
  CBaseEntity::DispatchUpdateTransmitState((CBaseEntity *)this);
  iVar11 = (**(code **)(*soundemitterbase + 0x88))(soundemitterbase,&DAT_00d539c2);
  if (iVar11 != *(int *)(this + 0xf4)) {
    if (this[0x6c] == (CFuncLadder)0x0) {
      pCVar9 = *(CBaseEdict **)(this + 0x30);
      if (pCVar9 != (CBaseEdict *)0x0) {
        *(uint *)pCVar9 = *(uint *)pCVar9 | 0x101;
        iVar12 = CBaseEdict::GetChangeAccessor(pCVar9);
        *(undefined2 *)(iVar12 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CFuncLadder)((byte)this[0x70] | 1);
    }
    *(int *)(this + 0xf4) = iVar11;
  }
  CBaseEntity::AddEffects((CBaseEntity *)this,0x20);
  *(uint *)(this + 0x14c) = *(uint *)(this + 0x14c) | 0x80;
  CBaseEntity::DispatchUpdateTransmitState((CBaseEntity *)this);
  iVar11 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
  fVar2 = *(float *)(iVar11 + 0xc);
  fVar3 = *(float *)(iVar11 + 0x14);
  fVar4 = *(float *)(iVar11 + 0x10);
  iVar11 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
  fVar5 = *(float *)(iVar11 + 0x18);
  fVar6 = *(float *)(iVar11 + 0x1c);
  fVar7 = *(float *)(iVar11 + 0x20);
  pVVar1 = (Vector *)(this + 0x46c);
  SetEndPoints(this,(Vector *)(this + 0x460),pVVar1);
  local_6c = 0;
  local_68 = 0;
  local_64 = 0;
  local_3c = 0;
  local_37 = 0;
  fVar17 = (fVar5 - fVar2) * 0.5;
  fVar19 = (fVar7 - fVar3) * 0.5;
  fVar16 = (fVar6 - fVar4) * 0.5;
  bVar10 = fVar19 * fVar19 + fVar17 * fVar17 + fVar16 * fVar16 < 1e-06;
  fVar21 = (fVar5 + fVar2) * 0.5;
  fVar20 = (fVar4 + fVar6) * 0.5;
  local_7c = *(float *)(this + 0x46c) + fVar21;
  fVar18 = (fVar7 + fVar3) * 0.5;
  local_78 = *(float *)(this + 0x470) + fVar20;
  local_74 = *(float *)(this + 0x474) + fVar18;
  local_5c = -fVar21;
  local_58 = -fVar20;
  local_54 = -fVar18;
  local_4c = fVar17;
  local_48 = fVar16;
  local_44 = fVar19;
  local_38 = bVar10;
  CTraceFilterSimple::CTraceFilterSimple
            ((CTraceFilterSimple *)local_12c,(IHandleEntity *)0x0,8,
             (_func_bool_IHandleEntity_ptr_int *)0x0);
  (**(code **)(*enginetrace + 0x14))
            (enginetrace,&local_7c,0x1400b,(CTraceFilterSimple *)local_12c,local_d0);
  if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
    DebugDrawLine(local_d0,local_c4,0xff,0xff,0,true,-1.0);
  }
  local_12c[0] = *(float *)(this + 0x460) + fVar21;
  local_e7 = 0;
  local_12c[1] = *(float *)(this + 0x464) + fVar20;
  local_12c[2] = *(float *)(this + 0x468) + fVar18;
  local_11c = 0;
  local_118 = 0;
  local_114 = 0;
  local_ec = 0;
  local_10c = -fVar21;
  local_108 = -fVar20;
  local_104 = -fVar18;
  local_fc = fVar17;
  local_f8 = fVar16;
  local_f4 = fVar19;
  local_e8 = bVar10;
  CTraceFilterSimple::CTraceFilterSimple
            ((CTraceFilterSimple *)local_13c,(IHandleEntity *)0x0,8,
             (_func_bool_IHandleEntity_ptr_int *)0x0);
  (**(code **)(*enginetrace + 0x14))
            (enginetrace,(CTraceFilterSimple *)local_12c,0x1400b,(CTraceFilterSimple *)local_13c,
             &local_7c);
  if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
    DebugDrawLine((Vector *)&local_7c,local_70,0xff,0xff,0,true,-1.0);
  }
  if (local_99 == '\0') {
    if (local_48._3_1_ == '\0') goto LAB_0044f460;
LAB_0044f5da:
    if (local_30 == 0) {
      pcVar13 = "NULL";
    }
    else {
      puVar14 = *(undefined1 **)(local_30 + 0x154);
      if (puVar14 == (undefined1 *)0x0) {
        puVar14 = &DAT_00d539c2;
      }
      puVar15 = &DAT_00d539c2;
      if (*(undefined1 **)(local_30 + 0x7c) != (undefined1 *)0x0) {
        puVar15 = *(undefined1 **)(local_30 + 0x7c);
      }
      pcVar13 = (char *)UTIL_VarArgs("%s/%s",puVar15,puVar14);
    }
    DevMsg(1,"Warning, funcladder with blocked top point (%.2f %.2f %.2f) stuck in (%s)\n",
           (double)*(float *)(this + 0x460),(double)*(float *)(this + 0x464),
           (double)*(float *)(this + 0x468),pcVar13);
  }
  else {
    if (local_84 == 0) {
      pcVar13 = "NULL";
    }
    else {
      puVar14 = *(undefined1 **)(local_84 + 0x154);
      if (puVar14 == (undefined1 *)0x0) {
        puVar14 = &DAT_00d539c2;
      }
      puVar15 = &DAT_00d539c2;
      if (*(undefined1 **)(local_84 + 0x7c) != (undefined1 *)0x0) {
        puVar15 = *(undefined1 **)(local_84 + 0x7c);
      }
      pcVar13 = (char *)UTIL_VarArgs("%s/%s",puVar15,puVar14);
    }
    DevMsg(1,"Warning, funcladder with blocked bottom point (%.2f %.2f %.2f) stuck in (%s)\n",
           (double)*(float *)(this + 0x46c),(double)*(float *)(this + 0x470),
           (double)*(float *)(this + 0x474),pcVar13);
    if (local_48._3_1_ != '\0') goto LAB_0044f5da;
  }
  if (1 < *(int *)(developer._28_4_ + 0x30)) {
    *(uint *)(this + 0x110) = *(uint *)(this + 0x110) | 1;
  }
LAB_0044f460:
  if (((byte)this[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
  }
  fVar16 = *(float *)(this + 0x460) - *(float *)(this + 0x2e0);
  fVar17 = *(float *)(this + 0x464) - *(float *)(this + 0x2e4);
  fVar18 = *(float *)(this + 0x468) - *(float *)(this + 0x2e8);
  if (((*(float *)(this + 0x460) == fVar16) && (*(float *)(this + 0x464) == fVar17)) &&
     (*(float *)(this + 0x468) == fVar18)) {
    CVar8 = this[0x14d];
  }
  else {
    if (this[0x6c] == (CFuncLadder)0x0) {
      pCVar9 = *(CBaseEdict **)(this + 0x30);
      if (pCVar9 != (CBaseEdict *)0x0) {
        *(uint *)pCVar9 = *(uint *)pCVar9 | 0x101;
        iVar11 = CBaseEdict::GetChangeAccessor(pCVar9);
        *(undefined2 *)(iVar11 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CFuncLadder)((byte)this[0x70] | 1);
    }
    CVar8 = this[0x14d];
    *(float *)(this + 0x460) = fVar16;
    *(float *)(this + 0x464) = fVar17;
    *(float *)(this + 0x468) = fVar18;
  }
  if (((byte)CVar8 & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
  }
  fVar16 = *(float *)(this + 0x46c) - *(float *)(this + 0x2e0);
  fVar17 = *(float *)(this + 0x470) - *(float *)(this + 0x2e4);
  fVar18 = *(float *)(this + 0x474) - *(float *)(this + 0x2e8);
  if (((*(float *)(this + 0x46c) != fVar16) || (*(float *)(this + 0x470) != fVar17)) ||
     (*(float *)(this + 0x474) != fVar18)) {
    if (this[0x6c] == (CFuncLadder)0x0) {
      pCVar9 = *(CBaseEdict **)(this + 0x30);
      if (pCVar9 != (CBaseEdict *)0x0) {
        *(uint *)pCVar9 = *(uint *)pCVar9 | 0x101;
        iVar11 = CBaseEdict::GetChangeAccessor(pCVar9);
        *(undefined2 *)(iVar11 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CFuncLadder)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x46c) = fVar16;
    *(float *)(this + 0x470) = fVar17;
    *(float *)(this + 0x474) = fVar18;
  }
  iVar11 = 0;
  fVar18 = -16384.0;
  local_13c[0] = 16384.0;
  fVar16 = *(float *)pVVar1;
  local_13c[1] = 16384.0;
  local_13c[2] = 16384.0;
  local_12c[0] = -16384.0;
  local_12c[1] = -16384.0;
  local_12c[2] = -16384.0;
  fVar17 = 16384.0;
  if (16384.0 <= fVar16) goto LAB_0044f582;
  do {
    *(float *)((CTraceFilterSimple *)local_13c + iVar11 * 4) = fVar16;
    fVar17 = fVar16;
LAB_0044f582:
    do {
      if (fVar18 < fVar16) {
        *(float *)((CTraceFilterSimple *)local_12c + iVar11 * 4) = fVar16;
        fVar18 = fVar16;
      }
      fVar16 = *(float *)((Vector *)(this + 0x460) + iVar11 * 4);
      if (fVar16 < fVar17) {
        *(float *)((CTraceFilterSimple *)local_13c + iVar11 * 4) = fVar16;
      }
      if (fVar18 < fVar16) {
        *(float *)((CTraceFilterSimple *)local_12c + iVar11 * 4) = fVar16;
      }
      iVar11 = iVar11 + 1;
      if (iVar11 == 3) {
        local_13c[0] = fVar2 + local_13c[0];
        local_13c[1] = fVar4 + local_13c[1];
        local_13c[2] = fVar3 + local_13c[2];
        local_12c[0] = fVar5 + local_12c[0];
        local_12c[1] = fVar6 + local_12c[1];
        local_12c[2] = fVar7 + local_12c[2];
        UTIL_SetSize((CBaseEntity *)this,(Vector *)local_13c,(Vector *)local_12c);
        CVar8 = this[0x148];
        if ((CFuncLadder)((byte)CVar8 & 1) != this[0x479]) {
          if (this[0x6c] == (CFuncLadder)0x0) {
            pCVar9 = *(CBaseEdict **)(this + 0x30);
            if (pCVar9 != (CBaseEdict *)0x0) {
              *(uint *)pCVar9 = *(uint *)pCVar9 | 0x101;
              iVar11 = CBaseEdict::GetChangeAccessor(pCVar9);
              *(undefined2 *)(iVar11 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CFuncLadder)((byte)this[0x70] | 1);
          }
          this[0x479] = (CFuncLadder)((byte)CVar8 & 1);
        }
        return;
      }
      fVar17 = *(float *)((CTraceFilterSimple *)local_13c + iVar11 * 4);
      fVar16 = *(float *)(pVVar1 + iVar11 * 4);
      fVar18 = *(float *)((CTraceFilterSimple *)local_12c + iVar11 * 4);
    } while (fVar17 <= fVar16);
  } while( true );
}

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)