L L4D2node

CPhysicsNPCSolver::Simulate

0x007940c0 · 872 bytes · __thiscall

_ZN17CPhysicsNPCSolver8SimulateEP24IPhysicsMotionControllerP14IPhysicsObjectfR6VectorS5_

Decompiled

undefined (6 params)

/* CPhysicsNPCSolver::Simulate(IPhysicsMotionController*, IPhysicsObject*, float, Vector&, Vector&)
    */

undefined4 __thiscall
CPhysicsNPCSolver::Simulate
          (CPhysicsNPCSolver *this,IPhysicsMotionController *param_1,IPhysicsObject *param_2,
          float param_3,Vector *param_4,Vector *param_5)

{
  char cVar1;
  uint uVar2;
  int iVar3;
  undefined *puVar4;
  int *piVar5;
  CBaseEntity *this_00;
  undefined4 local_70;
  float local_64;
  float local_60;
  float local_5c;
  float local_58;
  float local_54;
  float local_50;
  float local_4c;
  float local_48;
  float local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  cVar1 = IsIntersecting(this);
  if (cVar1 == '\0') {
    return 0;
  }
  uVar2 = (**(code **)(*(int *)param_2 + 0x50))(param_2);
  if (((uVar2 & 4) != 0) && (piVar5 = (int *)UTIL_GetLocalPlayer(), piVar5 != (int *)0x0)) {
    local_70 = 0;
    uVar2 = *(uint *)(this + 0x44c);
    if ((uVar2 != 0xffffffff) &&
       ((puVar4 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc &&
        (*(uint *)(puVar4 + 8) == uVar2 >> 0xc)))) {
      local_70 = *(undefined4 *)(puVar4 + 4);
    }
    (**(code **)(*piVar5 + 0x6f0))(piVar5,local_70);
  }
  ResetCancelTime(this);
  *(undefined4 *)param_5 = 0;
  *(undefined4 *)(param_5 + 4) = 0;
  *(undefined4 *)(param_5 + 8) = 0;
  *(undefined4 *)param_4 = 0;
  *(undefined4 *)(param_4 + 4) = 0;
  *(undefined4 *)(param_4 + 8) = 0;
  uVar2 = (**(code **)(*(int *)param_2 + 0x50))(param_2);
  if ((uVar2 & 0x10) != 0) {
    uVar2 = *(uint *)(this + 0x44c);
    piVar5 = (int *)0x0;
    if (((uVar2 != 0xffffffff) &&
        (puVar4 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar4 + 8) == uVar2 >> 0xc)) {
      piVar5 = *(int **)(puVar4 + 4);
    }
    iVar3 = (**(code **)(*piVar5 + 0x18c))(piVar5);
    if (iVar3 != 0) {
      return 0;
    }
  }
  (**(code **)(*(int *)param_2 + 0xc4))(param_2,&local_64,0);
  (**(code **)(*(int *)param_2 + 0xd4))(param_2,&local_58,0);
  uVar2 = *(uint *)(this + 0x448);
  this_00 = (CBaseEntity *)0x0;
  if (((uVar2 != 0xffffffff) &&
      (puVar4 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar4 + 8) == uVar2 >> 0xc)) {
    this_00 = *(CBaseEntity **)(puVar4 + 4);
  }
  if (((byte)this_00[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition(this_00);
  }
  local_4c = local_64 - *(float *)(this_00 + 0x2e0);
  local_48 = local_60 - *(float *)(this_00 + 0x2e4);
  uVar2 = -(uint)(0.0 < local_5c - *(float *)(this_00 + 0x2e8));
  local_44 = (float)(~uVar2 & 0xbdcccccd | uVar2 & 0x3dcccccd);
  VectorNormalize((Vector *)&local_4c);
  local_28 = local_4c * 150.0;
  local_40 = 0;
  local_24 = local_48 * 150.0;
  local_3c = 0;
  local_20 = local_44 * 150.0;
  local_38 = 0;
  PhysComputeSlideDirection
            (param_2,(Vector *)&local_28,(Vector *)&local_40,(Vector *)&local_34,(Vector *)0x0,0.0);
  local_4c = local_34;
  local_48 = local_30;
  local_44 = local_2c;
  VectorNormalize((Vector *)&local_4c);
  if (local_48 * local_54 + local_4c * local_58 + local_44 * local_50 < 75.0) {
    *(float *)param_4 = local_34;
    *(float *)(param_4 + 4) = local_30;
    *(float *)(param_4 + 8) = local_2c;
    cVar1 = (**(code **)(*(int *)param_2 + 0x110))(param_2,0,0);
    if (cVar1 != '\0') {
      *(float *)(param_4 + 8) = *(float *)(param_4 + 8) + *(float *)(sv_gravity._28_4_ + 0x2c);
    }
  }
  return 3;
}

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)