CDirectorScriptedEventManager::UpdatePanicEvents
0x008bbe00 · 1611 bytes · __thiscall
_ZN29CDirectorScriptedEventManager17UpdatePanicEventsEv
Decompiled
undefined (1 param)
/* CDirectorScriptedEventManager::UpdatePanicEvents() */
void __thiscall
CDirectorScriptedEventManager::UpdatePanicEvents(CDirectorScriptedEventManager *this)
{
CDirectorScriptedEventManager *pCVar1;
float fVar2;
bool bVar3;
ZombieManager *pZVar4;
char cVar5;
int iVar6;
int iVar7;
uint uVar8;
int iVar9;
longdouble lVar10;
longdouble lVar11;
undefined4 local_20 [4];
iVar6 = *(int *)(this + 0x128);
if (iVar6 == 1) {
local_20[0] = 0;
iVar6 = TheNextBots();
uVar8 = (uint)*(ushort *)(iVar6 + 0x10);
if (uVar8 != 0xffff) {
iVar9 = *(int *)(iVar6 + 4);
do {
cVar5 = AttackClosestSurvivor::operator()
((AttackClosestSurvivor *)local_20,*(INextBot **)(iVar9 + uVar8 * 8));
if (cVar5 == '\0') break;
iVar9 = *(int *)(iVar6 + 4);
uVar8 = (uint)*(ushort *)(iVar9 + 6 + uVar8 * 8);
} while (uVar8 != 0xffff);
}
iVar6 = CDirector::GetMegaMobSize(TheDirector);
if (1 < iVar6) {
ZombieManager::SpawnMegaMob(TheZombieManager);
}
*(int *)(this + 0x138) = *(int *)(this + 0x138) + 1;
*(undefined4 *)(this + 0x128) = 2;
lVar10 = (longdouble)CountdownTimer::Now();
if ((float)lVar10 + 10.0 != *(float *)(this + 0x134)) {
(**(code **)(*(int *)(this + 300) + 4))(this + 300,this + 0x134);
*(float *)(this + 0x134) = (float)lVar10 + 10.0;
}
if (*(float *)(this + 0x130) != 10.0) {
(**(code **)(*(int *)(this + 300) + 4))(this + 300,this + 0x130);
*(undefined4 *)(this + 0x130) = 0x41200000;
}
DevMsg("STAGE_MEGA_MOB -> STAGE_WAIT_FOR_COMBAT_TO_END\n");
return;
}
if (iVar6 < 2) {
if (iVar6 != 0) {
return;
}
lVar10 = (longdouble)CountdownTimer::Now();
if ((float)lVar10 < *(float *)(this + 0x134)) {
return;
}
*(undefined4 *)(this + 0x128) = 1;
DevMsg("STAGE_INITIAL_DELAY -> STAGE_MEGA_MOB\n");
*(undefined4 *)(this + 0x138) = 0;
PlayMegaMobWarningSounds();
return;
}
if (iVar6 != 2) {
if (iVar6 != 3) {
return;
}
lVar10 = (longdouble)CountdownTimer::Now();
if ((float)lVar10 < *(float *)(this + 0x134)) {
return;
}
if ((*(int *)(TheDirector + 0x194) != 0) &&
(cVar5 = CDirector::ShouldPausePanicWhenRelaxing(TheDirector), cVar5 != '\0')) {
return;
}
*(undefined4 *)(this + 0x128) = 1;
DevMsg("STAGE_PAUSE -> STAGE_MEGA_MOB\n");
return;
}
pCVar1 = this + 300;
if (0 < *(int *)(TheZombieManager + 0x210)) {
lVar10 = (longdouble)CountdownTimer::Now();
if ((float)lVar10 + 10.0 != *(float *)(this + 0x134)) {
(**(code **)(*(int *)(this + 300) + 4))(pCVar1,this + 0x134);
*(float *)(this + 0x134) = (float)lVar10 + 10.0;
}
if (*(float *)(this + 0x130) != 10.0) {
(**(code **)(*(int *)(this + 300) + 4))(pCVar1,this + 0x130);
*(undefined4 *)(this + 0x130) = 0x41200000;
}
pZVar4 = TheZombieManager;
iVar6 = CDirector::GetCommonInfectedLimit(TheDirector);
if (iVar6 < 1) {
*(undefined4 *)(pZVar4 + 0x210) = 0;
UTIL_LogPrintf("%3.2f: ZombieManager::ClearPendingMobCount: All mobs cleared.\n",
(double)*(float *)(gpGlobals + 0xc));
}
}
if (**(char **)(TheDirector + 0x648) == '\0') goto LAB_008bbff8;
iVar6 = 0;
bVar3 = false;
iVar9 = 0;
do {
iVar7 = CDirector::GetScriptValue
(TheDirector,(&UpdatePanicEvents()::specialTotalScriptEntries)[iVar9],0);
if (iVar7 != 0) {
bVar3 = true;
iVar7 = iVar7 - *(int *)(TheZombieManager + iVar9 * 4 + 0x50);
if (iVar7 < 0) {
iVar7 = 0;
}
iVar6 = iVar6 + iVar7;
}
iVar9 = iVar9 + 1;
} while (iVar9 != 6);
iVar9 = CDirector::GetScriptValue(TheDirector,"TotalSpecials",0);
if (iVar9 == 0) {
if (iVar6 == 0) {
if (!bVar3) goto LAB_008bbff8;
goto LAB_008bc28a;
}
}
else {
iVar9 = iVar9 - *(int *)(TheZombieManager + 0x68);
if (iVar9 < 0) {
iVar9 = 0;
}
if (iVar9 + iVar6 == 0) {
LAB_008bc28a:
iVar6 = CDirector::GetScriptValue(TheDirector,"PanicSpecialsOnly",0);
if (iVar6 != 0) {
if (*(float *)(this + 0x134) != -1.0) {
(**(code **)(*(int *)(this + 300) + 4))(pCVar1,this + 0x134);
*(undefined4 *)(this + 0x134) = 0xbf800000;
}
*(undefined4 *)(TheZombieManager + 0x210) = 0;
UTIL_LogPrintf("%3.2f: ZombieManager::ClearPendingMobCount: All mobs cleared.\n",
(double)*(float *)(gpGlobals + 0xc));
DevMsg("Hoping to kick out of mode, finished the specials\n");
}
goto LAB_008bbff8;
}
}
lVar10 = (longdouble)CountdownTimer::Now();
if ((float)lVar10 + 10.0 != *(float *)(this + 0x134)) {
(**(code **)(*(int *)(this + 300) + 4))(pCVar1,this + 0x134);
*(float *)(this + 0x134) = (float)lVar10 + 10.0;
}
if (*(float *)(this + 0x130) != 10.0) {
(**(code **)(*(int *)(this + 300) + 4))(pCVar1,this + 0x130);
*(undefined4 *)(this + 0x130) = 0x41200000;
}
LAB_008bbff8:
lVar10 = (longdouble)CountdownTimer::Now();
if (*(float *)(this + 0x134) <= (float)lVar10) {
cVar5 = ShouldPanicForever(this);
if ((*(int *)(this + 0x138) < *(int *)(this + 0x13c)) || (cVar5 != '\0')) {
*(undefined4 *)(this + 0x128) = 3;
lVar10 = (longdouble)CDirector::GetPanicWavePauseMax(TheDirector);
lVar11 = (longdouble)CDirector::GetPanicWavePauseMin(TheDirector);
lVar10 = (longdouble)RandomFloat((float)lVar11,(float)lVar10);
fVar2 = (float)lVar10;
lVar10 = (longdouble)CountdownTimer::Now();
if ((float)lVar10 + fVar2 != *(float *)(this + 0x134)) {
(**(code **)(*(int *)(this + 300) + 4))(pCVar1,this + 0x134);
*(float *)(this + 0x134) = (float)lVar10 + fVar2;
}
if (fVar2 != *(float *)(this + 0x130)) {
(**(code **)(*(int *)(this + 300) + 4))(pCVar1,this + 0x130);
*(float *)(this + 0x130) = fVar2;
}
DevMsg("STAGE_WAIT_FOR_COMBAT_TO_END -> STAGE_PAUSE\n");
if ((*(int *)this != 5) && (cVar5 == '\0')) {
CDirector::OnFinalePause(TheDirector);
}
}
else {
CDirector::OnMobRushStart(TheDirector);
*(undefined4 *)(this + 0x128) = 4;
CL4DGameStats::Event_PanicEventOver((CL4DGameStats *)CL4D_GameStats);
DevMsg("STAGE_WAIT_FOR_COMBAT_TO_END -> STAGE_DONE\n");
this[0x111] = (CDirectorScriptedEventManager)0x0;
OnPanicEventFinished(this);
}
}
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.