L L4D2node

CTerrorPlayer::OnEnterGhostState

0x009c8100 · 1266 bytes · __thiscall

_ZN13CTerrorPlayer17OnEnterGhostStateEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::OnEnterGhostState() */

void __thiscall CTerrorPlayer::OnEnterGhostState(CTerrorPlayer *this)

{
  float fVar1;
  CBaseEdict *pCVar2;
  char cVar3;
  int iVar4;
  int iVar5;
  KeyValues *this_00;
  undefined *puVar6;
  uint uVar7;
  longdouble lVar8;
  CTerrorPlayer *pCVar9;
  
  (**(code **)(*(int *)(this + 0x3ab4) + 0x10))(this + 0x3ab4);
  (**(code **)(*(int *)this + 0x63c))(this);
  CBaseEntity::SetMoveType((CBaseEntity *)this,2,0);
  CCollisionProperty::SetSolidFlags
            ((CCollisionProperty *)(this + 0x194),*(ushort *)(this + 0x1b4) & 0xfffffffb);
  if (*(int *)(this + 0x1a7c) != 0) {
    (**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a7c);
    *(undefined4 *)(this + 0x1a7c) = 0;
  }
  CCSPlayer::PhysObjectWake((CCSPlayer *)this);
  if (this[0x2ca5] != (CTerrorPlayer)0x1) {
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar4 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar4 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
    }
    this[0x2ca5] = (CTerrorPlayer)0x1;
  }
  g_ZombieClass = *(undefined4 *)(this + 0x2ba4);
  this[0x2ccd] = (CTerrorPlayer)0x0;
  this[0x2cce] = (CTerrorPlayer)0x1;
  (**(code **)(*(int *)this + 100))(this);
  *(undefined4 *)(this + 0x1cb0) = 0;
  CBaseEntity::SetNextThink((CBaseEntity *)this,-1.0,(char *)0x0);
  if (this[0x1ac8] != (CTerrorPlayer)0x1) {
    (**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1ac8);
    this[0x1ac8] = (CTerrorPlayer)0x1;
  }
  CBasePlayer::EnableControl((CBasePlayer *)this,true);
  CBasePlayer::SetViewEntity((CBasePlayer *)this,(CBaseEntity *)0x0);
  uVar7 = *(uint *)(this + 0x1a7c) & 0xfffffffb;
  if (*(uint *)(this + 0x1a7c) != uVar7) {
    (**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a7c);
    *(uint *)(this + 0x1a7c) = uVar7;
  }
  WarpGhostToInitialPosition(this,true);
  (**(code **)(*(int *)this + 0x8a8))(this);
  lVar8 = (longdouble)CountdownTimer::Now();
  if ((float)lVar8 != *(float *)(this + 0x2cbc)) {
    (**(code **)(*(int *)(this + 0x2cb4) + 4))(this + 0x2cb4,this + 0x2cbc);
    *(float *)(this + 0x2cbc) = (float)lVar8;
  }
  if (*(float *)(this + 0x2cb8) != 0.0) {
    (**(code **)(*(int *)(this + 0x2cb4) + 4))(this + 0x2cb4,this + 0x2cb8);
    *(undefined4 *)(this + 0x2cb8) = 0;
  }
  if (*(int *)(this + 0x2ca8) != 0) {
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar4 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar4 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x2ca8) = 0;
  }
  iVar4 = 1;
  CDirector::GetTimeUntilNextGhostWave
            (TheDirector,*(float *)(gpGlobals + 0xc) - *(float *)(this + 0x340c));
  if ((*(float *)(this + 0x2bc0) <= 0.0) && (*(float *)(this + 0x2be0) <= 0.0)) {
    iVar4 = (int)*(float *)(ZombieGhostDuration._28_4_ + 0x2c);
  }
  if (iVar4 != *(int *)(this + 0x2cac)) {
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
    }
    *(int *)(this + 0x2cac) = iVar4;
  }
  if (*(int *)(this + 0x2cb0) != iVar4) {
    if (this[0x6c] == (CTerrorPlayer)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
    }
    *(int *)(this + 0x2cb0) = iVar4;
  }
  pCVar9 = (CTerrorPlayer *)0x41700000;
  lVar8 = (longdouble)RandomFloat(0);
  fVar1 = (float)lVar8;
  lVar8 = (longdouble)CountdownTimer::Now();
  if ((float)lVar8 + fVar1 != *(float *)(this + 0x2cc8)) {
    pCVar9 = this + 0x2cc8;
    (**(code **)(*(int *)(this + 0x2cc0) + 4))(this + 0x2cc0);
    *(float *)(this + 0x2cc8) = (float)lVar8 + fVar1;
  }
  if (fVar1 != *(float *)(this + 0x2cc4)) {
    pCVar9 = this + 0x2cc4;
    (**(code **)(*(int *)(this + 0x2cc0) + 4))(this + 0x2cc0);
    *(float *)(this + 0x2cc4) = fVar1;
  }
  if ((*(int *)(gpGlobals + 0x48) != 3) &&
     ((((uVar7 = *(uint *)(this + 0x2088), uVar7 == 0xffffffff ||
        (puVar6 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc)) ||
       (*(uint *)(puVar6 + 8) != uVar7 >> 0xc)) ||
      ((this == *(CTerrorPlayer **)(puVar6 + 4) || (*(int *)(puVar6 + 4) == 0)))))) {
    this_00 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pCVar9);
                    /* try { // try from 009c845b to 009c845f has its CatchHandler @ 009c8629 */
    KeyValues::KeyValues(this_00,"data",(IKeyValuesSystem *)0x0,false);
    iVar4 = (**(code **)(*(int *)this + 0x544))(this);
    KeyValues::SetInt(this_00,"zombieClass",iVar4);
    (**(code **)(*(int *)this + 0x580))(this,"spawnmode_bar",1,this_00);
    KeyValues::deleteThis();
  }
  cVar3 = CDirectorChallengeMode::TankRun(*(CDirectorChallengeMode **)(TheDirector + 0x648));
  if ((cVar3 != '\0') && (cVar3 = (**(code **)(*(int *)this + 0x778))(this), cVar3 == '\0')) {
    MaterializeFromGhost(this);
    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)