L L4D2node

CCSGameMovement::CanUnduck

0x0042f390 · 1050 bytes · __thiscall

_ZN15CCSGameMovement9CanUnduckEv

Decompiled

undefined (1 param)

/* CCSGameMovement::CanUnduck() */

bool __thiscall CCSGameMovement::CanUnduck(CCSGameMovement *this)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  float fVar6;
  IHandleEntity *pIVar7;
  int iVar8;
  int iVar9;
  undefined4 uVar10;
  int iVar11;
  float fVar12;
  float fVar13;
  float fVar14;
  CTraceFilterSimple local_dc [16];
  float local_cc;
  float local_c8;
  float local_c4;
  float local_bc;
  float local_b8;
  float local_b4;
  float local_ac;
  float local_a8;
  float local_a4;
  float local_9c;
  float local_98;
  float local_94;
  undefined4 local_8c;
  undefined1 local_88;
  undefined1 local_87;
  Vector local_70 [12];
  Vector local_64 [32];
  float local_44;
  char local_39;
  
  iVar8 = *(int *)(this + 8);
  fVar14 = *(float *)(iVar8 + 0x9c);
  fVar12 = *(float *)(iVar8 + 0xa0);
  fVar13 = *(float *)(iVar8 + 0xa4);
  iVar8 = CBaseEntity::GetGroundEntity(*(CBaseEntity **)(this + 4));
  if (iVar8 == 0) {
    iVar8 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
    iVar9 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
    fVar1 = *(float *)(iVar9 + 0x18);
    fVar2 = *(float *)(iVar9 + 0x1c);
    fVar3 = *(float *)(iVar9 + 0x20);
    fVar4 = *(float *)(iVar8 + 0xc);
    fVar5 = *(float *)(iVar8 + 0x10);
    fVar6 = *(float *)(iVar8 + 0x14);
    iVar8 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
    iVar9 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
    fVar14 = ((fVar1 - fVar4) - (*(float *)(iVar9 + 0x30) - *(float *)(iVar8 + 0x24))) * -0.5 +
             fVar14;
    fVar12 = ((fVar2 - fVar5) - (*(float *)(iVar9 + 0x34) - *(float *)(iVar8 + 0x28))) * -0.5 +
             fVar12;
    fVar13 = ((fVar3 - fVar6) - (*(float *)(iVar9 + 0x38) - *(float *)(iVar8 + 0x2c))) * -0.5 +
             fVar13;
  }
  else {
    iVar8 = (**(code **)(*g_pGameRules + 0x7c))();
    iVar9 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
    fVar14 = (fVar14 + *(float *)(iVar9 + 0x24)) - *(float *)(iVar8 + 0xc);
    fVar12 = (fVar12 + *(float *)(iVar9 + 0x28)) - *(float *)(iVar8 + 0x10);
    fVar13 = (fVar13 + *(float *)(iVar9 + 0x2c)) - *(float *)(iVar8 + 0x14);
  }
  pIVar7 = *(IHandleEntity **)(this + 4);
  uVar10 = (**(code **)(*(int *)this + 0x40))(this,0,0);
  iVar9 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
  iVar11 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
  local_8c = 0;
  iVar8 = *(int *)(this + 8);
  local_bc = fVar14 - *(float *)(iVar8 + 0x9c);
  local_b8 = fVar12 - *(float *)(iVar8 + 0xa0);
  local_b4 = fVar13 - *(float *)(iVar8 + 0xa4);
  local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
  local_9c = (*(float *)(iVar9 + 0x18) - *(float *)(iVar11 + 0xc)) * 0.5;
  local_98 = (*(float *)(iVar9 + 0x1c) - *(float *)(iVar11 + 0x10)) * 0.5;
  local_94 = (*(float *)(iVar9 + 0x20) - *(float *)(iVar11 + 0x14)) * 0.5;
  local_88 = local_98 * local_98 + local_9c * local_9c + local_94 * local_94 < 1e-06;
  local_ac = (*(float *)(iVar9 + 0x18) + *(float *)(iVar11 + 0xc)) * 0.5;
  local_cc = *(float *)(iVar8 + 0x9c) + local_ac;
  local_a8 = (*(float *)(iVar9 + 0x1c) + *(float *)(iVar11 + 0x10)) * 0.5;
  local_c8 = *(float *)(iVar8 + 0xa0) + local_a8;
  local_a4 = (*(float *)(iVar9 + 0x20) + *(float *)(iVar11 + 0x14)) * 0.5;
  local_ac = -local_ac;
  local_a8 = -local_a8;
  local_c4 = *(float *)(iVar8 + 0xa4) + local_a4;
  local_a4 = -local_a4;
  CTraceFilterSimple::CTraceFilterSimple(local_dc,pIVar7,8,(_func_bool_IHandleEntity_ptr_int *)0x0);
  (**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,uVar10,local_dc,local_70);
  if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
    DebugDrawLine(local_70,local_64,0xff,0xff,0,true,-1.0);
  }
  return local_39 == '\0' && local_44 == 1.0;
}

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)