L L4D2node

PhysCallbackDamage

0x00780080 · 309 bytes · __cdecl

_Z18PhysCallbackDamageP11CBaseEntityRK15CTakeDamageInfo

Decompiled

undefined (2 params)

/* PhysCallbackDamage(CBaseEntity*, CTakeDamageInfo const&) */

void PhysCallbackDamage(CBaseEntity *param_1,CTakeDamageInfo *param_2)

{
  char cVar1;
  uint uVar2;
  undefined1 *puVar3;
  undefined1 *puVar4;
  undefined *puVar5;
  undefined1 in_stack_ffffffd4;
  Vector *in_stack_ffffffd8;
  Vector *in_stack_ffffffdc;
  CCollisionEvent *local_20;
  
  cVar1 = PhysIsInCallback();
  if (cVar1 == '\0') {
    CBaseEntity::TakeDamage(param_1,param_2);
    return;
  }
  uVar2 = *(uint *)(param_2 + 0x30);
  local_20 = (CCollisionEvent *)0x0;
  if (uVar2 != 0xffffffff) {
    in_stack_ffffffdc = (Vector *)(g_pEntityList + (uVar2 & 0xfff) * 0x10);
    if (((in_stack_ffffffdc != (Vector *)0xfffffffc) &&
        (*(uint *)(in_stack_ffffffdc + 8) == uVar2 >> 0xc)) &&
       (*(int *)(in_stack_ffffffdc + 4) != 0)) {
      local_20 = *(CCollisionEvent **)(*(int *)(in_stack_ffffffdc + 4) + 0x238);
    }
  }
  if (((byte)param_1[0x14c] & 1) == 0) {
    CCollisionEvent::AddDamageEvent
              (local_20,(CBaseEntity *)0x0,(CTakeDamageInfo *)&vec3_origin,
               (IPhysicsObject *)&vec3_origin,(bool)in_stack_ffffffd4,in_stack_ffffffd8,
               in_stack_ffffffdc);
    uVar2 = *(uint *)(param_2 + 0x30);
  }
  if (((uVar2 != 0xffffffff) &&
      (puVar5 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
     ((*(uint *)(puVar5 + 8) == uVar2 >> 0xc && (*(int *)(puVar5 + 4) != 0)))) {
    puVar4 = *(undefined1 **)(*(int *)(puVar5 + 4) + 0x7c);
    if (puVar4 == (undefined1 *)0x0) {
      puVar4 = &DAT_00d539c2;
    }
    puVar3 = &DAT_00d539c2;
    if (*(undefined1 **)(param_1 + 0x7c) != (undefined1 *)0x0) {
      puVar3 = *(undefined1 **)(param_1 + 0x7c);
    }
    DevMsg(2,"Warning: Physics damage event with no recovery info!\nObjects: %s, %s\n",puVar3,puVar4
          );
    return;
  }
  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)