CDirectorScriptedEventManager::StartPanicEvent
0x008b7780 · 948 bytes · __thiscall
_ZN29CDirectorScriptedEventManager15StartPanicEventEiP11CBasePlayer
Decompiled
undefined (3 params)
/* CDirectorScriptedEventManager::StartPanicEvent(int, CBasePlayer*) */
void __thiscall
CDirectorScriptedEventManager::StartPanicEvent
(CDirectorScriptedEventManager *this,int param_1,CBasePlayer *param_2)
{
CDirector *pCVar1;
float fVar2;
float fVar3;
code *pcVar4;
CDirector *pCVar5;
char cVar6;
int iVar7;
int *piVar8;
undefined4 uVar9;
longdouble lVar10;
pCVar1 = TheDirector;
if ((0.0 < *(float *)(TheDirector + 0x43c)) &&
(lVar10 = (longdouble)CountdownTimer::Now(), (float)lVar10 < *(float *)(pCVar1 + 0x43c))) {
UTIL_LogPrintf("%3.2f: Director::StartPanicEvent( %d ): ERROR: It is too soon to restart a PanicEvent.\n"
,(double)*(float *)(gpGlobals + 0xc),param_1);
return;
}
iVar7 = param_1;
UTIL_LogPrintf("%3.2f: Director::StartPanicEvent( %d ): Panic event started.\n",
(double)*(float *)(gpGlobals + 0xc),param_1);
pCVar5 = TheDirector;
pCVar1 = TheDirector + 0x434;
lVar10 = (longdouble)CountdownTimer::Now();
if ((float)lVar10 + 3.0 != *(float *)(pCVar5 + 0x43c)) {
(**(code **)(*(int *)(pCVar5 + 0x434) + 4))(pCVar1,pCVar5 + 0x43c);
*(float *)(pCVar5 + 0x43c) = (float)lVar10 + 3.0;
}
if (*(float *)(pCVar5 + 0x438) != 3.0) {
(**(code **)(*(int *)(pCVar5 + 0x434) + 4))(pCVar1,pCVar5 + 0x438);
*(undefined4 *)(pCVar5 + 0x438) = 0x40400000;
}
*(undefined4 *)(TheZombieManager + 0x210) = 0;
UTIL_LogPrintf("%3.2f: ZombieManager::ClearPendingMobCount: All mobs cleared.\n",
(double)*(float *)(gpGlobals + 0xc),iVar7);
*(undefined4 *)(this + 0x128) = 0;
lVar10 = (longdouble)RandomFloat(0x3f800000,0x40000000);
fVar3 = (float)lVar10;
lVar10 = (longdouble)CountdownTimer::Now();
if ((float)lVar10 + fVar3 == *(float *)(this + 0x134)) {
fVar2 = *(float *)(this + 0x130);
}
else {
(**(code **)(*(int *)(this + 300) + 4))(this + 300,this + 0x134);
fVar2 = *(float *)(this + 0x130);
*(float *)(this + 0x134) = (float)lVar10 + fVar3;
}
if (fVar3 != fVar2) {
(**(code **)(*(int *)(this + 300) + 4))(this + 300,this + 0x130);
*(float *)(this + 0x130) = fVar3;
}
*(undefined4 *)(this + 0x138) = 0;
UTIL_LogPrintf("%3.2f: Director: Panic Stage = STAGE_INITIAL_DELAY\n",
(double)*(float *)(gpGlobals + 0xc));
iVar7 = 1;
if (param_1 != 0) {
iVar7 = param_1;
}
*(int *)(this + 0x13c) = iVar7;
cVar6 = IsACrecendoEvent(this);
if (cVar6 != '\0') {
this[0x110] = (CDirectorScriptedEventManager)0x1;
this[0x111] = (CDirectorScriptedEventManager)0x1;
if (param_1 == 0) {
iVar7 = CDirector::GetMapArcValue(TheDirector);
if (iVar7 < 2) {
*(undefined4 *)(this + 0x13c) = 1;
UTIL_LogPrintf("%3.2f: Director::StartPanicEvent: Staring 1 wave panic event\n",
(double)*(float *)(gpGlobals + 0xc));
}
else {
*(undefined4 *)(this + 0x13c) = 2;
UTIL_LogPrintf("%3.2f: Director::StartPanicEvent: Staring 2 wave panic event\n",
(double)*(float *)(gpGlobals + 0xc));
}
}
}
iVar7 = TheZombieManager;
_V_memset((void *)(TheZombieManager + 0x50),0,0x18);
pCVar1 = TheDirector;
*(undefined4 *)(iVar7 + 0x68) = 0;
iVar7 = CDirector::GetCommonInfectedLimit(pCVar1);
if ((iVar7 != 0) &&
(piVar8 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"create_panic_event",0,0), piVar8 != (int *)0x0))
{
pcVar4 = *(code **)(*piVar8 + 0x30);
uVar9 = 0;
if (param_2 != (CBasePlayer *)0x0) {
uVar9 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_2 + 0x30));
}
(*pcVar4)(piVar8,"userid",uVar9);
/* WARNING: Could not recover jumptable at 0x008b7a0c. Too many branches */
/* WARNING: Treating indirect jump as call */
(**(code **)(*gameeventmanager + 0x20))();
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.