L L4D2node

CTerrorPlayer::TakeOverZombieBot

0x009ca530 · 746 bytes · __thiscall

_ZN13CTerrorPlayer17TakeOverZombieBotEPS_

Decompiled

undefined (2 params)

/* CTerrorPlayer::TakeOverZombieBot(CTerrorPlayer*) */

void __thiscall CTerrorPlayer::TakeOverZombieBot(CTerrorPlayer *this,CTerrorPlayer *param_1)

{
  code *pcVar1;
  int *piVar2;
  undefined4 uVar3;
  int iVar4;
  int iVar5;
  byte local_12d;
  ZombieReplacement local_128 [60];
  undefined4 local_ec;
  undefined4 local_e8;
  undefined4 local_e4;
  undefined4 local_e0;
  undefined4 local_dc;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  local_12d = 1;
  if (param_1[0x1a91] == (CTerrorPlayer)0x0) {
    local_12d = (byte)(*(uint *)(param_1 + 0x150) >> 1) & 1;
  }
  (**(code **)(*(int *)this + 0x98))(this,0,0xffffffff);
  local_ec = 0;
  local_e8 = 0;
  local_e4 = 0;
  local_e0 = 0;
  local_dc = 0;
  local_30 = 0;
  local_2c = 0;
  local_28 = 0;
  local_24 = 0;
  local_20 = 0;
                    /* try { // try from 009ca5e0 to 009ca80b has its CatchHandler @ 009ca81b */
  ZombieReplacement::Save(local_128,param_1);
  (**(code **)(*(int *)param_1 + 0x194))(param_1,1);
  ZombieReplacement::Restore(local_128,param_1,this);
  piVar2 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"bot_player_replace",0,0)
  ;
  if (piVar2 != (int *)0x0) {
    pcVar1 = *(code **)(*piVar2 + 0x30);
    uVar3 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
    (*pcVar1)(piVar2,"player",uVar3);
    pcVar1 = *(code **)(*piVar2 + 0x30);
    uVar3 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_1 + 0x30));
    (*pcVar1)(piVar2,"bot",uVar3);
    (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar2,0);
  }
  if (local_12d != 0) {
    *(uint *)(this + 0x1cb0) = *(uint *)(this + 0x1cb0) | 4;
    CBaseEntity::AddFlag((CBaseEntity *)this,2);
    if (this[0x1a90] != (CTerrorPlayer)0x1) {
      (**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a90);
      this[0x1a90] = (CTerrorPlayer)0x1;
    }
    if (this[0x1a91] != (CTerrorPlayer)0x1) {
      (**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a91);
      this[0x1a91] = (CTerrorPlayer)0x1;
    }
    if (*(int *)(this + 0x1a94) != 0) {
      (**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a94);
      *(undefined4 *)(this + 0x1a94) = 0;
    }
    pcVar1 = *(code **)(*(int *)this + 0x254);
    iVar4 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
    (*pcVar1)(this,iVar4 + 0x3c);
    iVar4 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
    iVar5 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
    CBaseEntity::SetCollisionBounds
              ((CBaseEntity *)this,(Vector *)(iVar5 + 0x24),(Vector *)(iVar4 + 0x30));
  }
  local_24 = 0;
  CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)&local_30);
  local_20 = local_30;
  CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)&local_30);
  local_e0 = 0;
  CUtlMemory<CTerrorWeapon*,int>::Purge((CUtlMemory<CTerrorWeapon*,int> *)&local_ec);
  local_dc = local_ec;
  CUtlMemory<CTerrorWeapon*,int>::Purge((CUtlMemory<CTerrorWeapon*,int> *)&local_ec);
  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)