CGib::SpawnRandomGibs
0x006d61f0 · 278 bytes · __cdecl
_ZN4CGib15SpawnRandomGibsEP11CBaseEntityi9GibType_e
Decompiled
undefined (3 params)
/* CGib::SpawnRandomGibs(CBaseEntity*, int, GibType_e) */
void CGib::SpawnRandomGibs(CBaseEntity *param_1,int param_2,int param_3)
{
CBaseEdict *this;
int iVar1;
int iVar2;
int iVar3;
CGib *in_stack_ffffffc4;
CBaseEntity *in_stack_ffffffc8;
char *pcVar4;
undefined4 uVar5;
undefined4 uVar6;
iVar3 = 0;
if (0 < param_2) {
do {
in_stack_ffffffc4 = _CreateEntity<CGib>(in_stack_ffffffc4,(char *)in_stack_ffffffc8);
if (*(int *)(g_Language._28_4_ + 0x30) == 1) {
pcVar4 = "models/germangibs.mdl";
LAB_006d621d:
Spawn(in_stack_ffffffc4,pcVar4);
iVar1 = *random_valve;
uVar6 = 3;
uVar5 = 0;
LAB_006d623c:
iVar1 = (**(code **)(iVar1 + 8))(random_valve,uVar5,uVar6);
if (iVar1 != *(int *)(in_stack_ffffffc4 + 0x45c)) {
if (in_stack_ffffffc4[0x6c] == (CGib)0x0) {
this = *(CBaseEdict **)(in_stack_ffffffc4 + 0x30);
if (this != (CBaseEdict *)0x0) {
*(uint *)this = *(uint *)this | 0x101;
iVar2 = CBaseEdict::GetChangeAccessor(this);
*(undefined2 *)(iVar2 + 2) = 0;
}
}
else {
in_stack_ffffffc4[0x70] = (CGib)((byte)in_stack_ffffffc4[0x70] | 1);
}
*(int *)(in_stack_ffffffc4 + 0x45c) = iVar1;
}
}
else {
if (param_3 == 0) {
Spawn(in_stack_ffffffc4,"models/gibs/hgibs.mdl");
iVar1 = *random_valve;
uVar6 = 5;
uVar5 = 1;
goto LAB_006d623c;
}
if (param_3 == 1) {
pcVar4 = "models/gibs/agibs.mdl";
goto LAB_006d621d;
}
}
iVar3 = iVar3 + 1;
in_stack_ffffffc8 = param_1;
InitGib(in_stack_ffffffc4,param_1,300.0,400.0);
} while (iVar3 != param_2);
}
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.