CTerrorPlayer::ChooseSurvivorCharacter
0x009c9270 · 417 bytes · __thiscall
_ZNK13CTerrorPlayer23ChooseSurvivorCharacterE21SurvivorCharacterType
Decompiled
undefined (2 params)
/* CTerrorPlayer::ChooseSurvivorCharacter(SurvivorCharacterType) const */
uint __thiscall CTerrorPlayer::ChooseSurvivorCharacter(CTerrorPlayer *this,uint param_2)
{
char cVar1;
int iVar2;
int iVar3;
int iVar4;
int local_3c;
CTerrorPlayer *local_38;
uint *local_34;
undefined4 local_30;
undefined4 local_2c;
int local_28;
uint *local_24;
int local_20;
iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
if (7 < param_2) {
param_2 = *(uint *)(this + 0x2eac);
}
local_38 = this;
local_34 = (uint *)0x0;
local_30 = 0;
local_2c = 0;
local_28 = 0;
iVar3 = 0;
local_24 = (uint *)0x0;
local_20 = iVar2;
do {
local_3c = iVar3 + (uint)(iVar2 != 2) * 4;
/* try { // try from 009c92eb to 009c934e has its CatchHandler @ 009c9432 */
CUtlVector<SurvivorCharacterType,CUtlMemory<SurvivorCharacterType,int>>::InsertBefore
((CUtlVector<SurvivorCharacterType,CUtlMemory<SurvivorCharacterType,int>> *)&local_34,
local_28,(SurvivorCharacterType *)&local_3c);
iVar3 = iVar3 + 1;
} while (iVar3 != 4);
iVar3 = local_28 + -1;
if (-1 < iVar3) {
iVar4 = iVar3 * 4;
do {
while ((local_20 != 2 ||
(cVar1 = IsCharacterUsedByTransitioningPlayer(*(undefined4 *)((int)local_34 + iVar4)),
cVar1 == '\0'))) {
iVar3 = iVar3 + -1;
iVar4 = iVar4 + -4;
if (iVar3 == -1) goto LAB_009c935e;
}
CUtlVector<SurvivorCharacterType,CUtlMemory<SurvivorCharacterType,int>>::ShiftElementsLeft
((CUtlVector<SurvivorCharacterType,CUtlMemory<SurvivorCharacterType,int>> *)
&local_34,iVar3,1);
local_28 = local_28 + -1;
iVar3 = iVar3 + -1;
iVar4 = iVar4 + -4;
} while (iVar3 != -1);
}
LAB_009c935e:
/* try { // try from 009c9364 to 009c941b has its CatchHandler @ 009c9420 */
ForEachPlayer<UnusedSurvivorCharacter>((UnusedSurvivorCharacter *)&local_38);
if (param_2 == 8) {
if (0 < local_28) goto LAB_009c939c;
}
else if (0 < local_28) {
if (param_2 == *local_34) goto LAB_009c93b5;
iVar2 = 0;
do {
iVar2 = iVar2 + 1;
if (iVar2 == local_28) goto LAB_009c939c;
} while (param_2 != local_34[iVar2]);
if (iVar2 != -1) goto LAB_009c93b5;
LAB_009c939c:
iVar2 = RandomInt(0,local_28 + -1);
param_2 = local_34[iVar2];
goto LAB_009c93b5;
}
if (iVar2 == 2) {
param_2 = RandomInt(0,3);
}
else {
param_2 = RandomInt(4,7);
}
LAB_009c93b5:
local_28 = 0;
CUtlMemory<SurvivorCharacterType,int>::Purge((CUtlMemory<SurvivorCharacterType,int> *)&local_34);
local_24 = local_34;
CUtlMemory<SurvivorCharacterType,int>::Purge((CUtlMemory<SurvivorCharacterType,int> *)&local_34);
return param_2;
}
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.