L L4D2node

CBaseEntity::PhysicsStep

0x00790110 · 1422 bytes · __thiscall

_ZN11CBaseEntity11PhysicsStepEv

Decompiled

undefined (1 param)

/* CBaseEntity::PhysicsStep() */

void __thiscall CBaseEntity::PhysicsStep(CBaseEntity *this)

{
  float fVar1;
  float fVar2;
  float fVar3;
  CBaseEdict *pCVar4;
  int iVar5;
  code *pcVar6;
  char cVar7;
  int iVar8;
  int iVar9;
  int *piVar10;
  uint uVar11;
  undefined *puVar12;
  longdouble lVar13;
  float fVar14;
  float local_7c;
  float local_78;
  float local_74;
  undefined4 local_70 [13];
  char local_39;
  
  if (this[0x6c] == (CBaseEntity)0x0) {
    pCVar4 = *(CBaseEdict **)(this + 0x30);
    if (pCVar4 != (CBaseEdict *)0x0) {
      *(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
      iVar8 = CBaseEdict::GetChangeAccessor(pCVar4);
      *(undefined2 *)(iVar8 + 2) = 0;
      if (this[0x6c] != (CBaseEntity)0x0) goto LAB_00790458;
      pCVar4 = *(CBaseEdict **)(this + 0x30);
      if (pCVar4 != (CBaseEdict *)0x0) {
        *(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar4);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
  }
  else {
LAB_00790458:
    this[0x70] = (CBaseEntity)((byte)this[0x70] | 1);
  }
  fVar14 = *(float *)(gpGlobals + 0xc);
  if (fVar14 != *(float *)(this + 0x94)) {
    if (this[0x6c] == (CBaseEntity)0x0) {
      pCVar4 = *(CBaseEdict **)(this + 0x30);
      if (pCVar4 != (CBaseEdict *)0x0) {
        *(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar4);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseEntity)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x94) = fVar14;
  }
  PhysicsRunThink(this,2);
  iVar8 = GetNextThinkTick(this,(char *)0x0);
  fVar14 = (float)iVar8 * *(float *)(gpGlobals + 0x1c);
  if ((0.5 < fVar14 - *(float *)(gpGlobals + 0xc)) || (fVar14 <= 0.0)) {
    PhysicsStepRunTimestep(this,*(float *)(gpGlobals + 0x10));
    PhysicsCheckWaterTransition(this);
    SetLastThink(this,-1,*(float *)(gpGlobals + 0xc));
    (**(code **)(*(int *)this + 0x2b4))(this,*(undefined4 *)(gpGlobals + 0x10));
    PhysicsRelinkChildren(this,*(float *)(gpGlobals + 0x10));
    return;
  }
  if (((byte)this[0x14d] & 8) != 0) {
    CalcAbsolutePosition(this);
  }
  fVar1 = *(float *)(this + 0x2e0);
  fVar2 = *(float *)(this + 0x2e4);
  fVar3 = *(float *)(this + 0x2e8);
  iVar5 = *(int *)(npc_vphysics._28_4_ + 0x30);
  cVar7 = HasDataObjectType(this,6);
  if (cVar7 == '\0') {
LAB_00790235:
    if (iVar5 == 0) goto LAB_0079023d;
  }
  else {
    iVar9 = GetDataObject(this,6);
    if (*(float *)(iVar9 + 4) < *(float *)(gpGlobals + 0xc) ||
        *(float *)(iVar9 + 4) == *(float *)(gpGlobals + 0xc)) {
      piVar10 = (int *)(**(code **)(**(int **)(this + 0x238) + 0x120))(*(int **)(this + 0x238));
      (**(code **)(*piVar10 + 0x3c))(piVar10,0,local_70);
      piVar10 = (int *)(**(code **)(**(int **)(this + 0x238) + 0x120))(*(int **)(this + 0x238));
      (**(code **)(*piVar10 + 0xc))(piVar10,*(undefined4 *)(iVar9 + 8),local_70[0]);
      DestroyDataObject(this,6);
      goto LAB_00790235;
    }
  }
  piVar10 = *(int **)(this + 0x238);
  if ((piVar10 != (int *)0x0) &&
     ((((uVar11 = *(uint *)(this + 0x180), uVar11 == 0xffffffff ||
        (puVar12 = g_pEntityList + (uVar11 & 0xfff) * 0x10, puVar12 == (undefined *)0xfffffffc)) ||
       (*(uint *)(puVar12 + 8) != uVar11 >> 0xc)) || (*(int *)(puVar12 + 4) == 0)))) {
    (**(code **)(*piVar10 + 0x11c))(piVar10,(Vector *)&local_7c,0);
    if (((byte)this[0x14d] & 8) != 0) {
      CalcAbsolutePosition(this);
    }
    if ((*(float *)(this + 0x2e0) - local_7c) * (*(float *)(this + 0x2e0) - local_7c) +
        (*(float *)(this + 0x2e4) - local_78) * (*(float *)(this + 0x2e4) - local_78) +
        (*(float *)(this + 0x2e8) - local_74) * (*(float *)(this + 0x2e8) - local_74) < 1.0) {
      uVar11 = (**(code **)(*(int *)this + 0x2c8))(this);
      if ((((byte)this[0x14d] & 8) != 0) &&
         (CalcAbsolutePosition(this), ((byte)this[0x14d] & 8) != 0)) {
        CalcAbsolutePosition(this);
      }
      Physics_TraceEntity(this,(Vector *)(this + 0x2e0),(Vector *)(this + 0x2e0),uVar11,
                          (CGameTrace *)local_70);
      if (local_39 == '\0') goto LAB_0079023d;
    }
    SetAbsOrigin(this,(Vector *)&local_7c);
    PhysicsTouchTriggers(this,(Vector *)0x0);
  }
LAB_0079023d:
  if (iVar8 <= *(int *)(gpGlobals + 0x18)) {
    if (fVar14 <= *(float *)(gpGlobals + 0xc)) {
      fVar14 = *(float *)(gpGlobals + 0xc);
    }
    lVar13 = (longdouble)GetLastThink(this,(char *)0x0);
    fVar14 = fVar14 - (float)lVar13;
    StepSimulationThink(this,fVar14);
    PhysicsCheckWaterTransition(this);
    if (*(int *)(this + 0x238) != 0) {
      if (((byte)this[0x14d] & 8) != 0) {
        CalcAbsolutePosition(this);
      }
      if (((fVar1 != *(float *)(this + 0x2e0)) || (fVar2 != *(float *)(this + 0x2e4))) ||
         (fVar3 != *(float *)(this + 0x2e8))) {
        piVar10 = *(int **)(this + 0x238);
        pcVar6 = *(code **)(*piVar10 + 0x118);
        uVar11 = *(uint *)(this + 0x150);
        if (((byte)this[0x14d] & 8) != 0) {
          CalcAbsolutePosition(this);
        }
        (*pcVar6)(piVar10,this + 0x2e0,&vec3_angle,uVar11 >> 10 & 1,fVar14);
      }
    }
    PhysicsRelinkChildren(this,fVar14);
  }
  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)