L L4D2node

CRagdollMagnet::GetForceVector

0x0064fe00 · 509 bytes · __cdecl

_ZN14CRagdollMagnet14GetForceVectorEP11CBaseEntity

Decompiled

undefined (1 param)

/* CRagdollMagnet::GetForceVector(CBaseEntity*) */

CBaseEntity * CRagdollMagnet::GetForceVector(CBaseEntity *param_1)

{
  int *piVar1;
  Vector *pVVar2;
  float *pfVar3;
  undefined1 *puVar4;
  longdouble lVar5;
  float fVar6;
  CBaseEntity *in_stack_00000008;
  int *in_stack_0000000c;
  float local_48;
  float local_44;
  float local_40;
  float local_3c;
  float local_38;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  
  if (((byte)in_stack_00000008[0x148] & 2) == 0) {
    pfVar3 = (float *)(**(code **)(*in_stack_0000000c + 0x288))();
    if (((byte)in_stack_00000008[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(in_stack_00000008);
    }
    local_2c = *(float *)(in_stack_00000008 + 0x2e4) - pfVar3[1];
    local_28 = *(float *)(in_stack_00000008 + 0x2e8) - pfVar3[2];
    local_30 = *(float *)(in_stack_00000008 + 0x2e0) - *pfVar3;
    VectorNormalize((Vector *)&local_30);
    fVar6 = *(float *)(in_stack_00000008 + 0x448);
    *(float *)(param_1 + 4) = local_2c * fVar6;
    *(float *)(param_1 + 8) = local_28 * fVar6;
    *(float *)param_1 = local_30 * fVar6;
  }
  else {
    CPlane::CPlane((CPlane *)&local_30);
    if (((byte)in_stack_00000008[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(in_stack_00000008);
    }
    pVVar2 = (Vector *)(**(code **)(*in_stack_0000000c + 0x288))();
    CalcClosestPointOnLineSegment
              (pVVar2,(Vector *)(in_stack_00000008 + 0x2e0),(Vector *)(in_stack_00000008 + 0x44c),
               (Vector *)&local_3c,(float *)0x0);
    pfVar3 = (float *)(**(code **)(*in_stack_0000000c + 0x288))();
    local_44 = local_38 - pfVar3[1];
    local_48 = local_3c - *pfVar3;
    local_40 = local_34 - pfVar3[2];
    VectorNormalize((Vector *)&local_48);
    fVar6 = *(float *)(in_stack_00000008 + 0x448);
    *(float *)(param_1 + 4) = local_44 * fVar6;
    *(float *)(param_1 + 8) = local_40 * fVar6;
    *(float *)param_1 = local_48 * fVar6;
  }
  if ((*(int *)(ai_debug_ragdoll_magnets._28_4_ + 0x30) != 0) &&
     (piVar1 = (int *)in_stack_0000000c[0x8e], piVar1 != (int *)0x0)) {
    puVar4 = &DAT_00d539c2;
    if ((undefined1 *)in_stack_0000000c[0x1f] != (undefined1 *)0x0) {
      puVar4 = (undefined1 *)in_stack_0000000c[0x1f];
    }
    lVar5 = (longdouble)(**(code **)(*piVar1 + 0x78))(piVar1);
    Msg("Ragdoll magnet adding %f inches/sec to %s\n",(double)(fVar6 / (float)lVar5),puVar4);
  }
  return param_1;
}

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)