CCommentarySystem::LevelInitPostEntity
0x0064f0b0 · 865 bytes · __thiscall
_ZN17CCommentarySystem19LevelInitPostEntityEv
Decompiled
undefined (1 param)
/* CCommentarySystem::LevelInitPostEntity() */
void __thiscall CCommentarySystem::LevelInitPostEntity(CCommentarySystem *this)
{
uint uVar1;
int *piVar2;
undefined1 uVar3;
int iVar4;
undefined4 uVar5;
char *pcVar6;
CBaseEntity *pCVar7;
int iVar8;
undefined *puVar9;
int local_20 [4];
piVar2 = cvar;
if ((*(uint *)(gpGlobals + 0x48) & 0xfffffffd) != 1) {
this[0x1c] = (CCommentarySystem)0x0;
(**(code **)(*piVar2 + 0x40))(piVar2,CV_GlobalChange_Commentary);
*(undefined4 *)(this + 0x20) = 0;
*(undefined4 *)(this + 0x24) = 0;
*(undefined4 *)(this + 0x60) = 0xffffffff;
iVar4 = CGlobalEntityList::FindEntityByName
((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,"commentary_semaphore",
(CBaseEntity *)0x0,(CBaseEntity *)0x0,(CBaseEntity *)0x0,
(IEntityFindFilter *)0x0);
if (iVar4 == 0) {
if ((InitCommentary()::infoTargetStr == '\0') &&
(iVar4 = __cxa_guard_acquire(&InitCommentary()::infoTargetStr), iVar4 != 0)) {
InitCommentary()::infoTargetStr._8_4_ = 0;
InitCommentary()::infoTargetStr._0_4_ = 0;
InitCommentary()::infoTargetStr._4_4_ = s_info_target_00c0b8b8;
__cxa_guard_release(&InitCommentary()::infoTargetStr);
__cxa_atexit(CGameString::~CGameString,InitCommentary()::infoTargetStr,&__dso_handle);
}
if ((InitCommentary()::commentarySpawnedSemaphoreName == '\0') &&
(iVar4 = __cxa_guard_acquire(&InitCommentary()::commentarySpawnedSemaphoreName), iVar4 != 0
)) {
DAT_00fc429c = 0;
InitCommentary()::commentarySpawnedSemaphoreName = 0;
DAT_00fc4298 = "commentary_semaphore";
__cxa_guard_release(&InitCommentary()::commentarySpawnedSemaphoreName);
__cxa_atexit(CGameString::~CGameString,&InitCommentary()::commentarySpawnedSemaphoreName,
&__dso_handle);
}
pcVar6 = "";
if (InitCommentary()::infoTargetStr._4_4_ != 0) {
pcVar6 = (char *)InitCommentary()::infoTargetStr._4_4_;
}
iVar4 = CreateEntityByName(pcVar6,-1,true);
if (((InitCommentary()::commentarySpawnedSemaphoreName == 0) ||
(iVar8 = InitCommentary()::commentarySpawnedSemaphoreName,
DAT_00fc429c != CGameString::gm_iSerialNumber)) &&
(iVar8 = 0, DAT_00fc4298 != (char *)0x0)) {
AllocPooledString((char *)local_20);
InitCommentary()::commentarySpawnedSemaphoreName = local_20[0];
DAT_00fc429c = CGameString::gm_iSerialNumber;
iVar8 = local_20[0];
}
piVar2 = engine;
*(int *)(iVar4 + 0x154) = iVar8;
uVar3 = (**(code **)(*piVar2 + 0xd8))(piVar2,0);
if (*(int *)(this + 0x2c) != 0) {
KeyValues::deleteThis();
*(undefined4 *)(this + 0x2c) = 0;
}
LoadCommentaryFile(this);
if (*(char *)(*(int *)(TheDirector + 0x648) + 1) != '\0') {
pcVar6 = (char *)CDirector::GetGameMode();
LoadEntityFile(this,pcVar6);
}
iVar4 = 0;
if (*(int *)(this + 0x50) != 0) {
do {
pCVar7 = (CBaseEntity *)0x0;
uVar1 = *(uint *)(*(int *)(this + 0x44) + iVar4 * 4);
if (((uVar1 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar9 + 8) == uVar1 >> 0xc)) {
pCVar7 = *(CBaseEntity **)(puVar9 + 4);
}
iVar4 = iVar4 + 1;
DispatchSpawn(pCVar7,true);
} while (iVar4 != *(int *)(this + 0x50));
}
PrecachePointTemplates();
iVar4 = 0;
if (0 < *(int *)(this + 0x50)) {
do {
uVar1 = *(uint *)(*(int *)(this + 0x44) + iVar4 * 4);
if (((uVar1 != 0xffffffff) &&
(puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc))
&& ((*(uint *)(puVar9 + 8) == uVar1 >> 0xc &&
(piVar2 = *(int **)(puVar9 + 4), piVar2 != (int *)0x0)))) {
(**(code **)(*piVar2 + 0x94))(piVar2);
}
iVar4 = iVar4 + 1;
} while (iVar4 < *(int *)(this + 0x50));
}
(**(code **)(*engine + 0xd8))(engine,uVar3);
}
if (g_bInCommentaryMode != '\0') {
uVar5 = (**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"playing_commentary",0,0);
(**(code **)(*gameeventmanager + 0x24))(gameeventmanager,uVar5);
return;
}
}
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.