CBalanceTeamGroup::MaybeAddPlayer
0x004c9390 · 344 bytes · __thiscall
_ZN17CBalanceTeamGroup14MaybeAddPlayerEP11CBasePlayer
Decompiled
undefined (2 params)
/* CBalanceTeamGroup::MaybeAddPlayer(CBasePlayer*) */
void __thiscall CBalanceTeamGroup::MaybeAddPlayer(CBalanceTeamGroup *this,CBasePlayer *param_1)
{
char cVar1;
int iVar2;
int iVar3;
void *pvVar4;
int iVar5;
int iVar6;
if (param_1 == (CBasePlayer *)0x0) {
return;
}
cVar1 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
if (cVar1 == '\0') {
return;
}
iVar2 = (**(code **)(*(int *)param_1 + 2000))(param_1);
*(int *)(param_1 + 0x2384) = iVar2;
if (*(int *)(this + 0x18) < iVar2) {
*(int *)(this + 0x18) = iVar2;
cVar1 = (**(code **)(*(int *)param_1 + 300))(param_1);
if (cVar1 != '\0') goto LAB_004c93e5;
LAB_004c9452:
iVar6 = *(int *)(this + 0x10);
iVar5 = *(int *)(this + 8);
*(int *)(this + 0x20) = *(int *)(this + 0x20) + 1;
iVar2 = iVar6 + 1;
if (iVar5 < iVar2) {
LAB_004c9463:
iVar3 = *(int *)(this + 0xc);
if (-1 < iVar3) {
if (iVar3 == 0) {
if (iVar5 == 0) {
if (iVar2 < 9) {
iVar3 = 8;
goto LAB_004c948f;
}
iVar5 = 8;
}
do {
iVar3 = iVar5 * 2;
if (iVar2 <= iVar3) break;
iVar3 = iVar5 * 4;
iVar5 = iVar3;
} while (iVar3 < iVar2);
}
else {
for (iVar3 = (iVar6 / iVar3 + 1) * iVar3; iVar3 < iVar2; iVar3 = (iVar3 + iVar2) / 2) {
}
}
LAB_004c948f:
*(int *)(this + 8) = iVar3;
if (*(void **)(this + 4) == (void *)0x0) {
pvVar4 = malloc(iVar3 << 2);
*(void **)(this + 4) = pvVar4;
}
else {
pvVar4 = realloc(*(void **)(this + 4),iVar3 << 2);
*(void **)(this + 4) = pvVar4;
iVar2 = *(int *)(this + 0x10) + 1;
}
goto LAB_004c93f9;
}
}
}
else {
cVar1 = (**(code **)(*(int *)param_1 + 300))(param_1);
if (cVar1 == '\0') goto LAB_004c9452;
LAB_004c93e5:
iVar6 = *(int *)(this + 0x10);
iVar5 = *(int *)(this + 8);
*(int *)(this + 0x1c) = *(int *)(this + 0x1c) + 1;
iVar2 = iVar6 + 1;
if (iVar5 < iVar2) goto LAB_004c9463;
}
pvVar4 = *(void **)(this + 4);
LAB_004c93f9:
*(int *)(this + 0x10) = iVar2;
iVar2 = (iVar2 - iVar6) + -1;
*(void **)(this + 0x14) = pvVar4;
iVar6 = iVar6 * 4;
if (0 < iVar2) {
_V_memmove((void *)((int)pvVar4 + iVar6 + 4),(void *)((int)pvVar4 + iVar6),iVar2 * 4);
pvVar4 = *(void **)(this + 4);
}
if ((undefined4 *)((int)pvVar4 + iVar6) == (undefined4 *)0x0) {
return;
}
*(undefined4 *)((int)pvVar4 + iVar6) = param_1;
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.