L L4D2node

CTerrorPlayer::SetClass

0x0099a780 · 1843 bytes · __thiscall

_ZN13CTerrorPlayer8SetClassE15ZombieClassType

Decompiled

undefined (2 params)

/* CTerrorPlayer::SetClass(ZombieClassType) */

void __thiscall CTerrorPlayer::SetClass(CTerrorPlayer *this,int param_2)

{
  CBaseEdict *pCVar1;
  undefined4 uVar2;
  int iVar3;
  longdouble lVar4;
  
  iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  if (iVar3 == 3) {
    SetClass(ZombieClassType)::s_zombieID = SetClass(ZombieClassType)::s_zombieID + 1;
    if (0x400 < SetClass(ZombieClassType)::s_zombieID) {
      SetClass(ZombieClassType)::s_zombieID = 1;
    }
    *(int *)(this + 0x2ba8) = SetClass(ZombieClassType)::s_zombieID;
    if (param_2 != *(int *)(this + 0x2ba4)) {
      if (this[0x6c] == (CTerrorPlayer)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar3 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
      }
      *(int *)(this + 0x2ba4) = param_2;
    }
    if (*(CHintMessageQueue **)(this + 0x238c) != (CHintMessageQueue *)0x0) {
      CHintMessageQueue::Reset(*(CHintMessageQueue **)(this + 0x238c));
    }
    if (this[0x121] != (CTerrorPlayer)0x0) {
      if (this[0x6c] == (CTerrorPlayer)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar3 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
      }
      this[0x121] = (CTerrorPlayer)0x0;
    }
    if (this[0x120] != (CTerrorPlayer)0x0) {
      if (this[0x6c] == (CTerrorPlayer)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar3 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
      }
      this[0x120] = (CTerrorPlayer)0x0;
    }
    if (this[0x124] != (CTerrorPlayer)0xff) {
      if (this[0x6c] == (CTerrorPlayer)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar3 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
      }
      this[0x124] = (CTerrorPlayer)0xff;
    }
    if (this[0x125] != (CTerrorPlayer)0xff) {
      if (this[0x6c] == (CTerrorPlayer)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar3 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
      }
      this[0x125] = (CTerrorPlayer)0xff;
    }
    if (this[0x126] != (CTerrorPlayer)0xff) {
      if (this[0x6c] == (CTerrorPlayer)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar3 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
      }
      this[0x126] = (CTerrorPlayer)0xff;
    }
    if (this[0x127] != (CTerrorPlayer)0xff) {
      if (this[0x6c] == (CTerrorPlayer)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar3 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
      }
      this[0x127] = (CTerrorPlayer)0xff;
    }
    (**(code **)(*(int *)this + 0x8a8))(this);
    switch(param_2) {
    case 1:
      iVar3 = (int)*(float *)(ZombieGasHealth._28_4_ + 0x2c);
      if (iVar3 != *(int *)(this + 0x100)) {
        (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
        uVar2 = ZombieGasHealth._28_4_;
        *(int *)(this + 0x100) = iVar3;
        iVar3 = (int)*(float *)(uVar2 + 0x2c);
      }
      if (*(int *)(this + 0xfc) != iVar3) {
        (**(code **)(*(int *)this + 0x20c))(this,this + 0xfc);
        *(int *)(this + 0xfc) = iVar3;
      }
      (**(code **)(*(int *)this + 0x6c0))(this,"weapon_smoker_claw",0,1,0);
      break;
    case 2:
      iVar3 = (int)*(float *)(ZombieExplodingHealth._28_4_ + 0x2c);
      if (iVar3 != *(int *)(this + 0x100)) {
        (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
        uVar2 = ZombieExplodingHealth._28_4_;
        *(int *)(this + 0x100) = iVar3;
        iVar3 = (int)*(float *)(uVar2 + 0x2c);
      }
      if (*(int *)(this + 0xfc) != iVar3) {
        (**(code **)(*(int *)this + 0x20c))(this,this + 0xfc);
        *(int *)(this + 0xfc) = iVar3;
      }
      (**(code **)(*(int *)this + 0x6c0))(this,"weapon_boomer_claw",0,1,0);
      break;
    case 3:
      iVar3 = (int)*(float *)(ZombieHunterHealth._28_4_ + 0x2c);
      if (iVar3 != *(int *)(this + 0x100)) {
        (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
        uVar2 = ZombieHunterHealth._28_4_;
        *(int *)(this + 0x100) = iVar3;
        iVar3 = (int)*(float *)(uVar2 + 0x2c);
      }
      if (*(int *)(this + 0xfc) != iVar3) {
        (**(code **)(*(int *)this + 0x20c))(this,this + 0xfc);
        *(int *)(this + 0xfc) = iVar3;
      }
      (**(code **)(*(int *)this + 0x6c0))(this,"weapon_hunter_claw",0,1,0);
      break;
    case 4:
      iVar3 = (int)*(float *)(z_spitter_health._28_4_ + 0x2c);
      if (iVar3 != *(int *)(this + 0x100)) {
        (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
        uVar2 = z_spitter_health._28_4_;
        *(int *)(this + 0x100) = iVar3;
        iVar3 = (int)*(float *)(uVar2 + 0x2c);
      }
      if (*(int *)(this + 0xfc) != iVar3) {
        (**(code **)(*(int *)this + 0x20c))(this,this + 0xfc);
        *(int *)(this + 0xfc) = iVar3;
      }
      (**(code **)(*(int *)this + 0x6c0))(this,"weapon_spitter_claw",0,1,0);
      break;
    case 5:
      iVar3 = (int)*(float *)(z_jockey_health._28_4_ + 0x2c);
      if (iVar3 != *(int *)(this + 0x100)) {
        (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
        uVar2 = z_jockey_health._28_4_;
        *(int *)(this + 0x100) = iVar3;
        iVar3 = (int)*(float *)(uVar2 + 0x2c);
      }
      if (iVar3 != *(int *)(this + 0xfc)) {
        (**(code **)(*(int *)this + 0x20c))(this,this + 0xfc);
        *(int *)(this + 0xfc) = iVar3;
      }
      (**(code **)(*(int *)this + 0x6c0))(this,"weapon_jockey_claw",0,1,0);
      break;
    case 6:
      iVar3 = (int)*(float *)(z_charger_health._28_4_ + 0x2c);
      if (iVar3 != *(int *)(this + 0x100)) {
        (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
        uVar2 = z_charger_health._28_4_;
        *(int *)(this + 0x100) = iVar3;
        iVar3 = (int)*(float *)(uVar2 + 0x2c);
      }
      if (*(int *)(this + 0xfc) != iVar3) {
        (**(code **)(*(int *)this + 0x20c))(this,this + 0xfc);
        *(int *)(this + 0xfc) = iVar3;
      }
      (**(code **)(*(int *)this + 0x6c0))(this,"weapon_charger_claw",0,1,0);
      break;
    case 8:
      lVar4 = (longdouble)CDirector::GetTankHealth(TheDirector);
      iVar3 = (int)lVar4;
      if (iVar3 != *(int *)(this + 0x100)) {
        (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
        *(int *)(this + 0x100) = iVar3;
      }
      if (*(int *)(this + 0xfc) != iVar3) {
        (**(code **)(*(int *)this + 0x20c))(this,this + 0xfc);
        *(int *)(this + 0xfc) = iVar3;
      }
      (**(code **)(*(int *)this + 0x6c0))(this,"weapon_tank_claw",0,1,0);
    }
    if (((this[0x3fe1] != (CTerrorPlayer)0x0) && (iVar3 = *(int *)(this + 0x3fe4), 0 < iVar3)) &&
       (iVar3 != *(int *)(this + 0x100))) {
      (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
      *(int *)(this + 0x100) = iVar3;
    }
    CDirector::OnZombieAdded(TheDirector,this);
    iVar3 = (**(code **)(*(int *)this + 0x544))(this);
    if (iVar3 == 8) {
      lVar4 = (longdouble)CountdownTimer::Now();
      if ((float)lVar4 + 2.0 != *(float *)(this + 0x30a0)) {
        (**(code **)(*(int *)(this + 0x3098) + 4))(this + 0x3098,this + 0x30a0);
        *(float *)(this + 0x30a0) = (float)lVar4 + 2.0;
      }
      if (*(float *)(this + 0x309c) != 2.0) {
        (**(code **)(*(int *)(this + 0x3098) + 4))(this + 0x3098,this + 0x309c);
        *(undefined4 *)(this + 0x309c) = 0x40000000;
      }
    }
  }
  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)