L L4D2node

CCollisionEvent::RestoreDamageInflictorState

0x0077b570 · 288 bytes · __thiscall

_ZN15CCollisionEvent27RestoreDamageInflictorStateEP14IPhysicsObject

Decompiled

undefined (2 params)

/* CCollisionEvent::RestoreDamageInflictorState(IPhysicsObject*) */

void __thiscall
CCollisionEvent::RestoreDamageInflictorState(CCollisionEvent *this,IPhysicsObject *param_1)

{
  int iVar1;
  uint uVar2;
  int iVar3;
  int iVar4;
  longdouble lVar5;
  float fVar6;
  
  if ((param_1 != (IPhysicsObject *)0x0) && (iVar3 = *(int *)(this + 0x118) + -1, -1 < iVar3)) {
    iVar4 = *(int *)(this + 0x10c) + iVar3 * 0x24;
    if (param_1 != *(IPhysicsObject **)(iVar4 + 0x18)) {
      iVar1 = *(int *)(this + 0x10c) + -0x24 + iVar3 * 0x24;
      do {
        iVar4 = iVar1;
        iVar3 = iVar3 + -1;
        if (iVar3 == -1) {
          return;
        }
        iVar1 = iVar4 + -0x24;
      } while (param_1 != *(IPhysicsObject **)(iVar4 + 0x18));
    }
    if (*(short *)(iVar4 + 0x22) == 0) {
      lVar5 = (longdouble)(**(code **)(**(int **)(iVar4 + 0x18) + 0x78))(*(int **)(iVar4 + 0x18));
      if ((500.0 <= (float)lVar5) ||
         (uVar2 = (**(code **)(**(int **)(iVar4 + 0x18) + 0x50))(*(int **)(iVar4 + 0x18)),
         (uVar2 & 1) != 0)) {
        fVar6 = 1.0;
      }
      else {
        uVar2 = -(uint)(0.0 < *(float *)(iVar4 + 0x1c));
        fVar6 = (float)lVar5 / (float)(~uVar2 & 0x3f800000 | (uint)*(float *)(iVar4 + 0x1c) & uVar2)
        ;
        if (fVar6 <= 0.1) {
          fVar6 = 0.1;
        }
        if (10.0 <= fVar6) {
          fVar6 = 10.0;
        }
        if (fVar6 < 1.0) {
          fVar6 = (fVar6 + -0.1) * 0.5555556;
        }
        else {
          fVar6 = (fVar6 + -1.0) * 0.055555556 + 0.5;
        }
      }
      RestoreDamageInflictorState(this,iVar3,fVar6);
      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)