DispatchSpawn
0x00b2dca0 · 565 bytes · __cdecl
_Z13DispatchSpawnP11CBaseEntityb
Decompiled
undefined (2 params)
/* DispatchSpawn(CBaseEntity*, bool) */
undefined4 DispatchSpawn(CBaseEntity *param_1,bool param_2)
{
uint uVar1;
int *piVar2;
uint *puVar3;
int iVar4;
undefined *puVar5;
int iVar6;
char *pcVar7;
undefined1 *puVar8;
undefined1 *puVar9;
char *pcVar10;
undefined1 local_25;
piVar2 = mdlcache;
if (param_1 == (CBaseEntity *)0x0) {
return 0;
}
(**(code **)(*mdlcache + 0x68))(mdlcache);
/* try { // try from 00b2dccf to 00b2dd38 has its CatchHandler @ 00b2def5 */
puVar3 = (uint *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
uVar1 = *puVar3;
if (param_2) {
(**(code **)(*(int *)param_1 + 800))(param_1);
}
if (*(int *)(sv_sync_anims_spawn._28_4_ + 0x30) == 0) {
local_25 = 1;
}
else {
local_25 = (**(code **)(*mdlcache + 0x84))(mdlcache,4,0);
}
iVar4 = (**(code **)(*(int *)param_1 + 0xf0))(param_1);
if (iVar4 == 0) {
(**(code **)(*(int *)param_1 + 100))(param_1);
}
else {
*(ushort *)(iVar4 + 0x524) = *(ushort *)(iVar4 + 0x524) | 2;
(**(code **)(*(int *)param_1 + 100))(param_1);
*(ushort *)(iVar4 + 0x524) = *(ushort *)(iVar4 + 0x524) & 0xfffd;
}
if (*(int *)(sv_sync_anims_spawn._28_4_ + 0x30) != 0) {
/* try { // try from 00b2ddba to 00b2de8d has its CatchHandler @ 00b2def5 */
(**(code **)(*mdlcache + 0x84))(mdlcache,4,local_25);
}
if (uVar1 != 0xffffffff) {
puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10;
if ((((puVar5 != (undefined *)0xfffffffc) && (*(uint *)(puVar5 + 8) == uVar1 >> 0xc)) &&
(*(int *)(puVar5 + 4) != 0)) && ((*(uint *)(param_1 + 0x14c) & 1) == 0)) {
if (*(char **)(param_1 + 0x80) != (char *)0x0) {
iVar4 = GlobalEntity_GetIndex(*(char **)(param_1 + 0x80));
if (iVar4 < 0) {
puVar9 = *(undefined1 **)(gpGlobals + 0x3c);
if (puVar9 == (undefined1 *)0x0) {
puVar9 = &DAT_00d539c2;
}
puVar8 = &DAT_00d539c2;
if (*(undefined1 **)(param_1 + 0x80) != (undefined1 *)0x0) {
puVar8 = *(undefined1 **)(param_1 + 0x80);
}
/* try { // try from 00b2decc to 00b2deec has its CatchHandler @ 00b2def5 */
GlobalEntity_Add(puVar8,puVar9,1);
}
else {
iVar6 = GlobalEntity_GetState(iVar4);
if (iVar6 == 2) {
CBaseEntity::Remove(param_1);
goto LAB_00b2dd77;
}
pcVar7 = (char *)GlobalEntity_GetMap(iVar4);
pcVar10 = "";
if (*(char **)(gpGlobals + 0x3c) != (char *)0x0) {
pcVar10 = *(char **)(gpGlobals + 0x3c);
}
if (pcVar7 != pcVar10) {
iVar4 = _V_stricmp(pcVar10,pcVar7);
if (iVar4 != 0) {
CBaseEntity::MakeDormant(param_1);
}
}
}
}
CGlobalEntityList::NotifySpawn((CGlobalEntityList *)gEntList,param_1);
if (param_2) {
CBaseEntity::RunOnPostSpawnScripts(param_1);
}
(**(code **)(*piVar2 + 0x6c))(piVar2);
return 0;
}
}
LAB_00b2dd77:
(**(code **)(*piVar2 + 0x6c))(piVar2);
return 0xffffffff;
}
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.