L L4D2node

CDirector::NewPlayerPossessBot

0x00873000 · 775 bytes · __thiscall

_ZN9CDirector19NewPlayerPossessBotER23DirectorNewPlayerType_tP11SurvivorBot

Decompiled

undefined (3 params)

/* CDirector::NewPlayerPossessBot(DirectorNewPlayerType_t&, SurvivorBot*) */

void __thiscall
CDirector::NewPlayerPossessBot
          (CDirector *this,DirectorNewPlayerType_t *param_1,SurvivorBot *param_2)

{
  uint uVar1;
  char cVar2;
  int iVar3;
  KeyValues *this_00;
  undefined *puVar4;
  CCSPlayer *pCVar5;
  CTerrorPlayer *pCVar6;
  int *piVar7;
  SurvivorBot *pSVar8;
  int *local_20;
  
  piVar7 = (int *)0x0;
  uVar1 = *(uint *)param_1;
  if (((uVar1 != 0xffffffff) &&
      (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar4 + 8) == uVar1 >> 0xc)) {
    piVar7 = *(int **)(puVar4 + 4);
  }
  (**(code **)(*piVar7 + 0x194))(piVar7,1);
  uVar1 = *(uint *)param_1;
  pCVar5 = (CCSPlayer *)0x0;
  if (((uVar1 != 0xffffffff) &&
      (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar4 + 8) == uVar1 >> 0xc)) {
    pCVar5 = *(CCSPlayer **)(puVar4 + 4);
  }
  CCSPlayer::State_Transition(pCVar5,6);
  uVar1 = *(uint *)param_1;
  pCVar6 = (CTerrorPlayer *)0x0;
  if (((uVar1 != 0xffffffff) &&
      (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar4 + 8) == uVar1 >> 0xc)) {
    pCVar6 = *(CTerrorPlayer **)(puVar4 + 4);
  }
  SurvivorBot::SetHumanSpectator(param_2,pCVar6);
  uVar1 = *(uint *)param_1;
  piVar7 = (int *)0x0;
  if (((uVar1 != 0xffffffff) &&
      (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar4 + 8) == uVar1 >> 0xc)) {
    piVar7 = *(int **)(puVar4 + 4);
  }
  pSVar8 = param_2;
  (**(code **)(*piVar7 + 0x64c))(piVar7);
  uVar1 = *(uint *)param_1;
  piVar7 = (int *)0x0;
  if (((uVar1 != 0xffffffff) &&
      (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar4 + 8) == uVar1 >> 0xc)) {
    piVar7 = *(int **)(puVar4 + 4);
  }
  iVar3 = (**(code **)(*piVar7 + 0x648))(piVar7);
  if (iVar3 == 6) {
    uVar1 = *(uint *)param_1;
    piVar7 = (int *)0x0;
    if (((uVar1 != 0xffffffff) &&
        (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar4 + 8) == uVar1 >> 0xc)) {
      piVar7 = *(int **)(puVar4 + 4);
    }
    pSVar8 = (SurvivorBot *)0x5;
    (**(code **)(*piVar7 + 0x644))(piVar7);
  }
  this_00 = KeyValues::operator_new((KeyValues *)0x2c,(uint)pSVar8);
                    /* try { // try from 00873175 to 00873179 has its CatchHandler @ 00873358 */
  KeyValues::KeyValues(this_00,"data",(IKeyValuesSystem *)0x0,false);
  KeyValues::SetInt(this_00,"character",*(int *)(param_2 + 0x2ba0));
  local_20 = (int *)0x0;
  uVar1 = *(uint *)param_1;
  if (((uVar1 != 0xffffffff) &&
      (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar4 + 8) == uVar1 >> 0xc)) {
    local_20 = *(int **)(puVar4 + 4);
  }
  (**(code **)(*local_20 + 0x580))(local_20,"takeover_survivor_bar",1,this_00);
  KeyValues::deleteThis();
  cVar2 = CTerrorGameRules::HasPlayerControlledZombies();
  if (((cVar2 == '\0') && (cVar2 = (**(code **)(*(int *)param_2 + 300))(param_2), cVar2 != '\0')) &&
     ((param_2[0x39e4] != (SurvivorBot)0x0 ||
      (cVar2 = (**(code **)(*(int *)param_2 + 0x7e8))(param_2), cVar2 != '\0')))) {
    return;
  }
  uVar1 = *(uint *)param_1;
  pCVar6 = (CTerrorPlayer *)0x0;
  if (((uVar1 != 0xffffffff) &&
      (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar4 + 8) == uVar1 >> 0xc)) {
    pCVar6 = *(CTerrorPlayer **)(puVar4 + 4);
  }
  CTerrorPlayer::TakeOverBot(pCVar6,false);
  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)