CDevShotSystem::FrameUpdatePostEntityThink
0x007dab30 · 730 bytes · __thiscall
_ZN14CDevShotSystem26FrameUpdatePostEntityThinkEv
Decompiled
undefined (1 param)
/* CDevShotSystem::FrameUpdatePostEntityThink() */
void __thiscall CDevShotSystem::FrameUpdatePostEntityThink(CDevShotSystem *this)
{
code *pcVar1;
char cVar2;
KeyValues *pKVar3;
IBaseFileSystem *pIVar4;
undefined1 *puVar5;
int iVar6;
undefined4 uVar7;
CBaseEntity *pCVar8;
int in_GS_OFFSET;
uint uVar9;
char local_220 [512];
int local_20;
iVar6 = gpGlobals;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
if (((5.0 < *(float *)(gpGlobals + 0xc) || *(float *)(gpGlobals + 0xc) == 5.0) &&
(this[0xc] == (CDevShotSystem)0x0)) && (this[0xd] == (CDevShotSystem)0x0)) {
this[0xd] = (CDevShotSystem)0x1;
uVar9 = 0x200;
puVar5 = &DAT_00d539c2;
if (*(undefined1 **)(iVar6 + 0x3c) != (undefined1 *)0x0) {
puVar5 = *(undefined1 **)(iVar6 + 0x3c);
}
V_snprintf(local_220,0x200,"maps/%s.txt",puVar5);
pKVar3 = KeyValues::operator_new((KeyValues *)0x2c,uVar9);
/* try { // try from 007dabd1 to 007dabd5 has its CatchHandler @ 007dae15 */
KeyValues::KeyValues(pKVar3,"MapCameras",(IKeyValuesSystem *)0x0,false);
pIVar4 = (IBaseFileSystem *)0x0;
if (filesystem != 0) {
pIVar4 = (IBaseFileSystem *)(filesystem + 4);
}
cVar2 = KeyValues::LoadFromFile(pKVar3,pIVar4,local_220,"MOD");
if (cVar2 != '\0') {
Warning("Devshots: Loading point_devshot_camera positions from %s. \n",local_220);
for (pKVar3 = (KeyValues *)KeyValues::GetFirstSubKey(pKVar3); pKVar3 != (KeyValues *)0x0;
pKVar3 = (KeyValues *)KeyValues::GetNextKey(pKVar3)) {
uVar7 = KeyValues::GetName(pKVar3);
pCVar8 = (CBaseEntity *)CreateEntityByName("point_devshot_camera",-1,true);
(**(code **)(*(int *)pCVar8 + 0x84))(pCVar8,"cameraname",uVar7);
pcVar1 = *(code **)(*(int *)pCVar8 + 0x84);
uVar7 = KeyValues::GetString(pKVar3,"origin","0 0 0");
(*pcVar1)(pCVar8,"origin",uVar7);
pcVar1 = *(code **)(*(int *)pCVar8 + 0x84);
uVar7 = KeyValues::GetString(pKVar3,"angles","0 0 0");
(*pcVar1)(pCVar8,"angles",uVar7);
pcVar1 = *(code **)(*(int *)pCVar8 + 0x84);
uVar7 = KeyValues::GetString(pKVar3,"FOV","75");
(*pcVar1)(pCVar8,&DAT_00cb87ee,uVar7);
DispatchSpawn(pCVar8,true);
(**(code **)(*(int *)pCVar8 + 0x94))(pCVar8);
}
}
if (g_iDevShotCameraCount == 0) {
puVar5 = &DAT_00d539c2;
if (*(undefined1 **)(gpGlobals + 0x3c) != (undefined1 *)0x0) {
puVar5 = *(undefined1 **)(gpGlobals + 0x3c);
}
Warning("Devshots: No point_devshot_camera in %s. Moving to next map.\n",puVar5);
if (*(int *)(gpGlobals + 0x14) < 2) {
iVar6 = UTIL_GetLocalPlayer();
}
else {
cVar2 = (**(code **)(*engine + 8))(engine);
if (cVar2 != '\0') goto LAB_007dac80;
iVar6 = UTIL_GetListenServerHost();
}
if (iVar6 != 0) {
(**(code **)(*engine + 0x9c))(engine,*(undefined4 *)(iVar6 + 0x30),"devshots_nextmap");
this[0xc] = (CDevShotSystem)0x1;
}
}
}
LAB_007dac80:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
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.