CMapEntitySpawner::AddEntity
0x006f1270 · 1253 bytes · __thiscall
_ZN17CMapEntitySpawner9AddEntityEP11CBaseEntityPKci
Decompiled
undefined (4 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CMapEntitySpawner::AddEntity(CBaseEntity*, char const*, int) */
void __thiscall
CMapEntitySpawner::AddEntity(CMapEntitySpawner *this,CBaseEntity *param_1,char *param_2,int param_3)
{
char cVar1;
int iVar2;
int iVar3;
undefined1 *puVar4;
CPointTemplate *local_24;
undefined4 local_20;
CPointTemplate *local_18;
undefined4 local_14;
int local_10;
cVar1 = (**(code **)(*(int *)param_1 + 0x174))(param_1);
if (cVar1 == '\0') {
iVar2 = __dynamic_cast(param_1,&CBaseEntity::typeinfo,&CWorld::typeinfo,0);
if (iVar2 == 0) {
iVar2 = __dynamic_cast(param_1,&CBaseEntity::typeinfo,&CLight::typeinfo,0);
if (iVar2 == 0) {
local_18 = (CPointTemplate *)
__dynamic_cast(param_1,&CBaseEntity::typeinfo,&CPointTemplate::typeinfo,0);
if (local_18 == (CPointTemplate *)0x0) {
*(CBaseEntity **)(*(int *)(this + 0x20) * 0x10 + *(int *)(this + 8)) = param_1;
*(undefined4 *)(*(int *)(this + 0x20) * 0x10 + *(int *)(this + 8) + 4) = 0;
*(undefined4 *)(*(int *)(this + 0x20) * 0x10 + *(int *)(this + 8) + 0xc) = 0;
*(undefined4 *)(*(int *)(this + 0x20) * 0x10 + *(int *)(this + 8) + 8) = 0;
*(char **)(*(int *)(this + 4) + *(int *)(this + 0x20) * 8) = param_2;
*(int *)(*(int *)(this + 4) + 4 + *(int *)(this + 0x20) * 8) = param_3;
*(int *)(this + 0x20) = *(int *)(this + 0x20) + 1;
}
else {
CUtlVector<CPointTemplate*,CUtlMemory<CPointTemplate*,int>>::InsertBefore
((CUtlVector<CPointTemplate*,CUtlMemory<CPointTemplate*,int>> *)(this + 0xc),
*(int *)(this + 0x18),&local_18);
}
}
else {
local_24 = (CPointTemplate *)0x0;
local_20 = 0;
if (___atan2f_finite == 0) {
local_10 = 0;
}
else {
(**(code **)(___atan2f_finite + 0x50))
(___atan2f_finite,&local_24,0,0,0,0,"/data/src/game/server/mapentities.cpp",
0x179,&AddEntity(CBaseEntity*,char_const*,int)::tm_fmt,"(%s)%s","Unaccounted",
"MapEntity_ParseAllEntities_SpawnTransients");
local_10 = ___atan2f_finite;
}
iVar2 = _DAT_0105db00;
local_18 = local_24;
local_14 = local_20;
if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
/* try { // try from 006f15c6 to 006f1614 has its CatchHandler @ 006f17a6 */
iVar3 = ThreadGetCurrentId();
if (iVar2 == iVar3) {
if ((char *)*_DAT_0105d15c != "MapEntity_ParseAllEntities_SpawnTransients") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode
((char *)_DAT_0105d15c,0xc9cf3c,(char *)0x1,0xbfafa1);
}
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
}
/* try { // try from 006f151b to 006f151f has its CatchHandler @ 006f17a8 */
iVar2 = DispatchSpawn(param_1,true);
if (iVar2 < 0) {
puVar4 = gEntList;
/* try { // try from 006f1787 to 006f178b has its CatchHandler @ 006f17a8 */
CGlobalEntityList::CleanupDeleteList();
param_1 = (CBaseEntity *)puVar4;
}
iVar2 = _DAT_0105db00;
if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
iVar3 = ThreadGetCurrentId(param_1);
if (iVar2 == iVar3) {
cVar1 = CVProfNode::ExitScope();
if (cVar1 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
}
if (local_10 != 0) {
(**(code **)(local_10 + 0x54))(local_10,local_18,local_14,0,0,0);
}
}
}
else {
local_24 = (CPointTemplate *)0x0;
local_20 = 0;
if (___atan2f_finite == 0) {
local_10 = 0;
}
else {
(**(code **)(___atan2f_finite + 0x50))
(___atan2f_finite,&local_24,0,0,0,0,"/data/src/game/server/mapentities.cpp",0x158,
&AddEntity(CBaseEntity*,char_const*,int)::tm_fmt,"(%s)%s","Unaccounted",
"MapEntity_ParseAllEntities_SpawnWorld");
local_10 = ___atan2f_finite;
}
iVar2 = _DAT_0105db00;
local_18 = local_24;
local_14 = local_20;
if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
/* try { // try from 006f135f to 006f1363 has its CatchHandler @ 006f1791 */
iVar3 = ThreadGetCurrentId();
if (iVar2 == iVar3) {
if ((char *)*_DAT_0105d15c != "MapEntity_ParseAllEntities_SpawnWorld") {
/* try { // try from 006f1700 to 006f1711 has its CatchHandler @ 006f1791 */
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc9cf14,(char *)0x1,0xbfafa1);
}
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
}
*(undefined4 *)(param_1 + 0x84) = 0;
/* try { // try from 006f1381 to 006f1385 has its CatchHandler @ 006f17b8 */
DispatchSpawn(param_1,true);
iVar2 = _DAT_0105db00;
if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
iVar3 = ThreadGetCurrentId();
if (iVar2 == iVar3) {
cVar1 = CVProfNode::ExitScope();
if (cVar1 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
}
if (local_10 != 0) {
(**(code **)(local_10 + 0x54))(local_10,local_18,local_14,0,0,0);
return;
}
}
}
else {
if (*this != (CMapEntitySpawner)0x0) {
Templates_RemoveByHammerID(*(int *)(param_1 + 0x88));
}
Templates_Add(param_1,param_2,param_3,*(int *)(param_1 + 0x88));
UTIL_Remove(param_1);
CGlobalEntityList::CleanupDeleteList();
}
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.