L L4D2node

CBreakableSurface::VPhysicsCollision

0x006b5fe0 · 1254 bytes · __thiscall

_ZN17CBreakableSurface17VPhysicsCollisionEiP21gamevcollisionevent_t

Decompiled

undefined (3 params)

/* CBreakableSurface::VPhysicsCollision(int, gamevcollisionevent_t*) */

void __thiscall
CBreakableSurface::VPhysicsCollision
          (CBreakableSurface *this,int param_1,gamevcollisionevent_t *param_2)

{
  float fVar1;
  char *pcVar2;
  longdouble lVar3;
  int local_fc;
  float local_f8;
  float local_f4;
  float local_f0;
  float local_ec;
  float local_e8;
  float local_e4;
  uint local_e0;
  uint local_dc;
  uint local_d8;
  undefined4 local_d0;
  float local_cc;
  float local_c8;
  float local_c4;
  float local_c0;
  float local_bc;
  undefined2 local_90;
  CBreakable *local_84;
  undefined4 local_80;
  float local_7c;
  float local_78;
  float local_74;
  undefined4 local_70;
  float local_6c;
  float local_68;
  float local_64;
  undefined4 local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_4c;
  int local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined2 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined1 local_24;
  undefined1 local_23;
  
  if (this[0x524] == (CBreakableSurface)0x0) {
    pcVar2 = (char *)0x0;
    local_fc = 0;
    if (*(int *)(this + 0x528) == 0) {
      pcVar2 = "glass";
    }
    lVar3 = (longdouble)
            CalculateDefaultPhysicsDamage
                      (param_1,param_2,0x3f800000,0,&local_fc,pcVar2,
                       *(uint *)(this + 0x148) >> 1 & 1);
    fVar1 = (float)lVar3;
    if (10.0 < fVar1) {
      (**(code **)(**(int **)(param_2 + param_1 * 4) + 0x74))
                (*(int **)(param_2 + param_1 * 4),0x40000000);
      (**(code **)**(undefined4 **)(param_2 + 0x1c))(*(undefined4 **)(param_2 + 0x1c),&local_e0);
      if (param_1 == 0) {
        local_e0 = local_e0 ^ 0x80000000;
        local_dc = local_dc ^ 0x80000000;
        local_d8 = local_d8 ^ 0x80000000;
      }
      (**(code **)(**(int **)(param_2 + 0x1c) + 4))(*(int **)(param_2 + 0x1c),(Vector *)&local_d0);
      CTakeDamageInfo::CTakeDamageInfo
                ((CTakeDamageInfo *)&local_7c,
                 *(CBaseEntity **)(param_2 + ((param_1 == 0) + 0x18) * 4 + 8),
                 *(CBaseEntity **)(param_2 + ((param_1 == 0) + 0x18) * 4 + 8),(Vector *)&local_e0,
                 (Vector *)&local_d0,fVar1,local_fc,0,(Vector *)0x0);
      PhysCallbackDamage((CBaseEntity *)this,(CTakeDamageInfo *)&local_7c,param_2,param_1);
    }
    else if ((0.0 < fVar1) && (((byte)this[0x148] & 1) != 0)) {
      (**(code **)**(undefined4 **)(param_2 + 0x1c))(*(undefined4 **)(param_2 + 0x1c),&local_f8);
      if (param_1 == 0) {
        local_f8 = -local_f8;
        local_f4 = -local_f4;
        local_f0 = -local_f0;
      }
      (**(code **)(**(int **)(param_2 + 0x1c) + 4))(*(int **)(param_2 + 0x1c),&local_ec);
      local_7c = local_ec - local_f8;
      local_78 = local_e8 - local_f4;
      local_44 = 0;
      local_74 = local_e4 - local_f0;
      local_68 = (local_e8 + local_f4) - local_78;
      local_48 = 0;
      local_6c = (local_ec + local_f8) - local_7c;
      local_4c = 0;
      local_64 = (local_e4 + local_f0) - local_74;
      local_3c = 0;
      local_54 = 0;
      local_58 = 0;
      local_5c = 0;
      local_38._0_2_ =
           CONCAT11(local_68 * local_68 + local_6c * local_6c + local_64 * local_64 != 0.0,1);
      CTraceFilterSimple::CTraceFilterSimple
                ((CTraceFilterSimple *)&local_e0,(IHandleEntity *)0x0,0,
                 (_func_bool_IHandleEntity_ptr_int *)0x0);
      (**(code **)(*enginetrace + 0x14))
                (enginetrace,&local_7c,0x400b,(CTraceFilterSimple *)&local_e0,&local_d0);
      if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
        DebugDrawLine((Vector *)&local_d0,(Vector *)&local_c4,0xff,0,0,true,-1.0);
      }
      if ((local_84 != (CBreakable *)0x0) && (local_84 == (CBreakable *)this)) {
        local_64 = 0.0;
        local_60 = 0;
        local_5c = 0;
        local_7c = local_c4;
        local_34 = local_90;
        local_78 = local_c0;
        local_58 = 0;
        local_74 = local_bc;
        local_28 = local_80;
        local_70 = local_d0;
        local_54 = 0;
        local_6c = local_cc;
        local_50 = 0;
        local_4c = 0;
        local_44 = 0x3f800000;
        local_38 = 0;
        local_40 = 0;
        local_3c = 0;
        local_30 = 0;
        local_24 = 0;
        local_23 = 0;
        local_68 = local_c8;
        local_2c = 0x80;
        if (*(int *)(this + 0x30) == 0) {
          local_48 = 0;
        }
        else {
          local_48 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
        }
        DispatchEffect("Impact",(CEffectData *)&local_7c);
        this = (CBreakableSurface *)local_84;
      }
    }
  }
  CBreakable::VPhysicsCollision((CBreakable *)this,param_1,param_2);
  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)