CDirector::AddSurvivorBot
0x00886f80 · 323 bytes · __thiscall
_ZNK9CDirector14AddSurvivorBotE21SurvivorCharacterType
Decompiled
undefined (2 params)
/* CDirector::AddSurvivorBot(SurvivorCharacterType) const */
void __thiscall CDirector::AddSurvivorBot(CDirector *this,int param_2)
{
char cVar1;
char *pcVar2;
SurvivorBot *pSVar3;
int iVar4;
int iVar5;
int local_24;
int local_20 [5];
cVar1 = NoSurvivorBots(this);
if (cVar1 != '\0') {
return;
}
if (param_2 == 8) {
local_20[0] = 0;
iVar4 = 0;
local_20[1] = 0;
local_20[2] = 0;
local_20[3] = 0;
local_20[4] = 0;
do {
/* try { // try from 00887033 to 008870d0 has its CatchHandler @ 008870d6 */
iVar5 = CTerrorPlayer::GetPlayerByCharacter(iVar4);
if (iVar5 == 0) {
local_24 = iVar4;
CUtlVector<SurvivorCharacterType,CUtlMemory<SurvivorCharacterType,int>>::InsertBefore
((CUtlVector<SurvivorCharacterType,CUtlMemory<SurvivorCharacterType,int>> *)
local_20,local_20[3],(SurvivorCharacterType *)&local_24);
}
iVar4 = iVar4 + 1;
} while (iVar4 != 4);
if (local_20[3] == 0) {
local_20[3] = 0;
CUtlMemory<SurvivorCharacterType,int>::Purge
((CUtlMemory<SurvivorCharacterType,int> *)local_20);
local_20[4] = local_20[0];
CUtlMemory<SurvivorCharacterType,int>::Purge
((CUtlMemory<SurvivorCharacterType,int> *)local_20);
return;
}
iVar4 = RandomInt(0,local_20[3] + -1);
param_2 = *(int *)(local_20[0] + iVar4 * 4);
local_20[3] = 0;
CUtlMemory<SurvivorCharacterType,int>::Purge((CUtlMemory<SurvivorCharacterType,int> *)local_20);
local_20[4] = local_20[0];
CUtlMemory<SurvivorCharacterType,int>::Purge((CUtlMemory<SurvivorCharacterType,int> *)local_20);
if (param_2 == 8) {
return;
}
}
if ((param_2 - 4U < 4) && (iVar4 = CTerrorPlayer::GetPlayerByCharacter(param_2), iVar4 != 0)) {
return;
}
pcVar2 = (char *)SurvivorCharacterDisplayName(param_2);
pSVar3 = NextBotCreatePlayerBot<SurvivorBot>(pcVar2);
if (pSVar3 != (SurvivorBot *)0x0) {
(**(code **)(*(int *)pSVar3 + 0x8cc))(pSVar3,(3 < param_2) * '\x02' + '\x02',param_2,0);
}
return;
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.