Charger::Spawn
0x00a7be20 · 464 bytes · __thiscall
_ZN7Charger5SpawnEv
Decompiled
undefined (1 param)
/* Charger::Spawn() */
void __thiscall Charger::Spawn(Charger *this)
{
int iVar1;
undefined4 uVar2;
int *piVar3;
int iVar4;
CBaseEntity *pCVar5;
undefined4 *puVar6;
int iVar7;
void *pvVar8;
int iVar9;
g_ZombieClass = 6;
piVar3 = (int *)(**(code **)(*(int *)this + 0x9b4))(this);
(**(code **)(*piVar3 + 0x10c))(piVar3,2);
iVar4 = RandomInt(1,100);
if (iVar4 < 0x32) {
this[0x4324] = (Charger)0x1;
}
pCVar5 = (CBaseEntity *)
CGlobalEntityList::FindEntityByClassname
((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,"func_block_charge");
do {
if (pCVar5 == (CBaseEntity *)0x0) {
BossZombiePlayerBot::Spawn((BossZombiePlayerBot *)this);
return;
}
puVar6 = (undefined4 *)(**(code **)(*(int *)pCVar5 + 0xc))(pCVar5);
iVar1 = *(int *)(this + 0x4334);
uVar2 = *puVar6;
iVar4 = iVar1 + 1;
iVar9 = *(int *)(this + 0x432c);
if (iVar9 < iVar4) {
iVar7 = *(int *)(this + 0x4330);
if (iVar7 < 0) goto LAB_00a7bea0;
if (iVar7 == 0) {
if (iVar9 == 0) {
if (iVar4 < 9) {
iVar7 = 8;
goto LAB_00a7bf6f;
}
iVar9 = 8;
}
do {
iVar7 = iVar9 * 2;
if (iVar4 <= iVar7) break;
iVar7 = iVar9 * 4;
iVar9 = iVar7;
} while (iVar7 < iVar4);
}
else {
for (iVar7 = (iVar1 / iVar7 + 1) * iVar7; iVar7 < iVar4; iVar7 = (iVar7 + iVar4) / 2) {
}
}
LAB_00a7bf6f:
*(int *)(this + 0x432c) = iVar7;
if (*(void **)(this + 0x4328) == (void *)0x0) {
pvVar8 = malloc(iVar7 << 2);
*(void **)(this + 0x4328) = pvVar8;
}
else {
pvVar8 = realloc(*(void **)(this + 0x4328),iVar7 << 2);
*(void **)(this + 0x4328) = pvVar8;
iVar4 = *(int *)(this + 0x4334) + 1;
}
}
else {
LAB_00a7bea0:
pvVar8 = *(void **)(this + 0x4328);
}
*(int *)(this + 0x4334) = iVar4;
iVar9 = iVar1 * 4;
iVar4 = (iVar4 - iVar1) + -1;
*(void **)(this + 0x4338) = pvVar8;
if (0 < iVar4) {
_V_memmove((void *)((int)pvVar8 + iVar9 + 4),(void *)((int)pvVar8 + iVar9),iVar4 * 4);
pvVar8 = *(void **)(this + 0x4328);
}
if ((undefined4 *)(iVar9 + (int)pvVar8) != (undefined4 *)0x0) {
*(undefined4 *)(iVar9 + (int)pvVar8) = uVar2;
}
pCVar5 = (CBaseEntity *)
CGlobalEntityList::FindEntityByClassname
((CGlobalEntityList *)gEntList,pCVar5,"func_block_charge");
} while( true );
}
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.