L L4D2node

cast_ray

0x006419b0 · 1264 bytes · __cdecl

_ZL8cast_rayRK8CCommand

Decompiled

undefined (1 param)

/* cast_ray(CCommand const&) */

void cast_ray(CCommand *param_1)

{
  CBaseEntity *pCVar1;
  CBasePlayer *this;
  undefined1 *puVar2;
  undefined4 uVar3;
  undefined4 uVar4;
  CBaseEntity *pCVar5;
  double dVar6;
  double dVar7;
  double dVar8;
  double local_10c;
  double local_104;
  float local_f4;
  float local_f0;
  float local_ec;
  undefined4 local_e8;
  undefined4 local_e4;
  undefined4 local_e0;
  CTraceFilterSimple local_dc [16];
  float local_cc;
  float local_c8;
  float local_c4;
  float local_bc;
  float local_b8;
  float local_b4;
  undefined4 local_ac;
  undefined4 local_a8;
  undefined4 local_a4;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_8c;
  undefined1 local_88;
  undefined1 local_87;
  Vector local_70 [12];
  float local_64;
  float local_60;
  float local_5c;
  float local_58;
  float local_54;
  float local_50;
  float local_44;
  undefined4 local_40;
  char local_3a;
  char local_39;
  undefined4 local_34;
  short local_30;
  undefined4 local_2c;
  short local_28;
  CBaseEntity *local_24;
  undefined4 local_20;
  
  this = (CBasePlayer *)UTIL_GetCommandClient();
  CBasePlayer::EyeVectors(this,(Vector *)&local_f4,(Vector *)0x0,(Vector *)0x0);
  (**(code **)(*(int *)this + 0x234))((Vector *)&local_e8,this);
  local_8c = 0;
  local_88 = 1;
  local_bc = local_f4 * 16384.0;
  local_b8 = local_f0 * 16384.0;
  local_b4 = local_ec * 16384.0;
  local_94 = 0;
  local_98 = 0;
  local_9c = 0;
  local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
  local_a4 = 0;
  local_a8 = 0;
  local_ac = 0;
  local_cc = (float)local_e8;
  local_c8 = (float)local_e4;
  local_c4 = (float)local_e0;
  CTraceFilterSimple::CTraceFilterSimple
            (local_dc,(IHandleEntity *)this,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
  (**(code **)(*enginetrace + 0x14))(enginetrace,(Vector *)&local_cc,0x200400b,local_dc);
  if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
    DebugDrawLine(local_70,(Vector *)&local_64,0xff,0,0,true,-1.0);
  }
  pCVar1 = local_24;
  if ((local_44 < 1.0) || (local_3a != '\0')) {
    if (((byte)local_24[0x14d] & 8) != 0) goto LAB_00641d86;
LAB_00641b86:
    local_104 = (double)*(float *)(local_24 + 900);
LAB_00641b99:
    local_10c = (double)*(float *)(local_24 + 0x380);
LAB_00641bac:
    dVar7 = (double)*(float *)(local_24 + 0x37c);
LAB_00641bb7:
    dVar8 = (double)*(float *)(local_24 + 0x2e8);
  }
  else {
    if (local_39 == '\0') {
      return;
    }
    if (((byte)local_24[0x14d] & 8) == 0) goto LAB_00641b86;
LAB_00641d86:
    CBaseEntity::CalcAbsolutePosition(local_24);
    pCVar5 = local_24;
    local_104 = (double)*(float *)(pCVar1 + 900);
    if (((byte)local_24[0x14d] & 8) == 0) goto LAB_00641b99;
    CBaseEntity::CalcAbsolutePosition(local_24);
    pCVar1 = local_24;
    local_10c = (double)*(float *)(pCVar5 + 0x380);
    if (((byte)local_24[0x14d] & 8) == 0) goto LAB_00641bac;
    CBaseEntity::CalcAbsolutePosition(local_24);
    pCVar5 = local_24;
    dVar7 = (double)*(float *)(pCVar1 + 0x37c);
    if (((byte)local_24[0x14d] & 8) == 0) goto LAB_00641bb7;
    CBaseEntity::CalcAbsolutePosition(local_24);
    pCVar1 = local_24;
    dVar8 = (double)*(float *)(pCVar5 + 0x2e8);
    if (((byte)local_24[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(local_24);
      pCVar5 = local_24;
      dVar6 = (double)*(float *)(pCVar1 + 0x2e4);
      if (((byte)local_24[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(local_24);
      }
      goto LAB_00641bcf;
    }
  }
  dVar6 = (double)*(float *)(local_24 + 0x2e4);
  pCVar5 = local_24;
LAB_00641bcf:
  puVar2 = &DAT_00d539c2;
  if (*(undefined1 **)(local_24 + 0x7c) != (undefined1 *)0x0) {
    puVar2 = *(undefined1 **)(local_24 + 0x7c);
  }
  DevMsg(1,"Hit %s\nposition %.2f, %.2f, %.2f\nangles %.2f, %.2f, %.2f\n",puVar2,
         (double)*(float *)(pCVar5 + 0x2e0),dVar6,dVar8,dVar7,local_10c,local_104);
  uVar3 = (**(code **)(*physprops + 0x20))(physprops,(int)local_30);
  uVar4 = (**(code **)(*(int *)(local_24 + 0x194) + 0x2c))(local_24 + 0x194);
  DevMsg(1,
         "Hit: hitbox %d, hitgroup %d, physics bone %d, solid %d, surface %s, surfaceprop %s, contents %08x\n"
         ,local_20,local_2c,(int)local_28,uVar4,local_34,uVar3,local_40);
  NDebugOverlay::Line((Vector *)&local_e8,(Vector *)&local_64,0,0xff,0,false,10.0);
  local_c8 = local_54 * 12.0 + local_60;
  local_c4 = local_50 * 12.0 + local_5c;
  local_cc = local_58 * 12.0 + local_64;
  NDebugOverlay::Line((Vector *)&local_64,(Vector *)&local_cc,0xff,0xff,0,false,10.0);
  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)