L L4D2node

CTerrorPlayer::OnFalling

0x009c2370 · 1050 bytes · __thiscall

_ZN13CTerrorPlayer9OnFallingEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::OnFalling() */

void __thiscall CTerrorPlayer::OnFalling(CTerrorPlayer *this)

{
  char cVar1;
  int iVar2;
  CBaseEntity *this_00;
  uint uVar3;
  undefined *puVar4;
  longdouble lVar5;
  int local_80;
  undefined4 local_7c;
  undefined4 local_78;
  float local_74;
  undefined4 local_70 [3];
  undefined4 local_64;
  undefined4 local_60;
  float local_5c;
  float local_44;
  
  iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  if ((iVar2 == 2) &&
     (*(float *)(this + 0x4008) < *(float *)(gpGlobals + 0xc) ||
      *(float *)(this + 0x4008) == *(float *)(gpGlobals + 0xc))) {
    lVar5 = (longdouble)CountdownTimer::Now();
    if (*(float *)(this + 0x30a0) <= (float)lVar5) {
      uVar3 = *(uint *)(this + 0x2088);
      if (((((uVar3 == 0xffffffff) ||
            (puVar4 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar4 == (undefined *)0xfffffffc)) ||
           (*(uint *)(puVar4 + 8) != uVar3 >> 0xc)) ||
          ((*(CTerrorPlayer **)(puVar4 + 4) == (CTerrorPlayer *)0x0 ||
           (this == *(CTerrorPlayer **)(puVar4 + 4))))) &&
         (lVar5 = (longdouble)EstimateFallingDamage(this),
         *(float *)(SurvivorIncapacitatedMaxFallDamage._28_4_ + 0x2c) <= (float)lVar5 &&
         (float)lVar5 != *(float *)(SurvivorIncapacitatedMaxFallDamage._28_4_ + 0x2c))) {
        if (((byte)this[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
        }
        if (((pointDeathfallCameraStr == 0) ||
            (iVar2 = pointDeathfallCameraStr, DAT_0102092c != CGameString::gm_iSerialNumber)) &&
           (iVar2 = 0, DAT_01020928 != 0)) {
          AllocPooledString((char *)&local_80);
          pointDeathfallCameraStr = local_80;
          DAT_0102092c = CGameString::gm_iSerialNumber;
          iVar2 = local_80;
        }
        this_00 = (CBaseEntity *)
                  CGlobalEntityList::FindEntityByClassnameNearestFast
                            ((CGlobalEntityList *)gEntList,iVar2,(Vector *)(this + 0x2e0),0x461c4000
                            );
        if (this_00 != (CBaseEntity *)0x0) {
          if (((byte)this[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
          }
          if (((byte)this_00[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(this_00);
          }
          cVar1 = CBaseCombatCharacter::ComputeLOS
                            ((CBaseCombatCharacter *)this,(Vector *)(this_00 + 0x2e0),
                             (Vector *)(this + 0x2e0));
          if (cVar1 != '\0') {
            local_70[0] = 0;
            local_64 = 0xffffffff;
            local_60 = 0;
            (**(code **)(*(int *)this_00 + 0xb4))(this_00,"Enable",this,0,local_70,0);
          }
        }
      }
      CBasePlayer::ClearUseEntity((CBasePlayer *)this);
      SetPushEntity(this,(CBaseEntity *)0x0);
      iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
      if (iVar2 == 3) {
        iVar2 = (**(code **)(*(int *)this + 0x544))(this);
        if (iVar2 != 3) {
          return;
        }
        (**(code **)(*(int *)this + 0x850))
                  (this,*(undefined4 *)(ZombieNoiseLevelVocalize._28_4_ + 0x2c));
        CBaseEntity::EmitSound((CBaseEntity *)this,"PlayerZombie.Fall",0.0,(float *)0x0);
      }
      else {
        if (((byte)this[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
        }
        local_74 = *(float *)(this + 0x2e8) - 1000.0;
        local_78 = *(undefined4 *)(this + 0x2e4);
        local_7c = *(undefined4 *)(this + 0x2e0);
        uVar3 = (**(code **)(*(int *)this + 0x7a0))(this,0);
        UTIL_TraceEntity((CBaseEntity *)this,(Vector *)(this + 0x2e0),(Vector *)&local_7c,uVar3,
                         (IHandleEntity *)this,0,(CGameTrace *)local_70);
        if ((0.0 < local_44) && (local_44 < 1.0)) {
          local_74 = local_5c + 1.0;
          uVar3 = (**(code **)*enginetrace)(enginetrace,(Vector *)&local_7c,0x4030,0);
          if ((uVar3 & 0x4030) != 0) {
            return;
          }
        }
        (**(code **)(*(int *)this + 0x850))
                  (this,*(undefined4 *)(ZombieNoiseLevelVocalize._28_4_ + 0x2c));
        EmitTrackedSound(this,"Player.Fall",5.0);
      }
      lVar5 = (longdouble)CountdownTimer::Now();
      if ((float)lVar5 + 1.5 != *(float *)(this + 0x30a0)) {
        (**(code **)(*(int *)(this + 0x3098) + 4))(this + 0x3098,this + 0x30a0);
        *(float *)(this + 0x30a0) = (float)lVar5 + 1.5;
      }
      if (*(float *)(this + 0x309c) != 1.5) {
        (**(code **)(*(int *)(this + 0x3098) + 4))(this + 0x3098,this + 0x309c);
        *(undefined4 *)(this + 0x309c) = 0x3fc00000;
      }
    }
  }
  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)