CDirectorChallengeMode::ActivateScriptedMode
0x0089e700 · 1001 bytes · __thiscall
_ZN22CDirectorChallengeMode20ActivateScriptedModeEv
Decompiled
undefined (1 param)
/* CDirectorChallengeMode::ActivateScriptedMode() */
void __thiscall CDirectorChallengeMode::ActivateScriptedMode(CDirectorChallengeMode *this)
{
undefined4 *puVar1;
int *piVar2;
char cVar3;
int iVar4;
int iVar5;
undefined4 uVar6;
void *pvVar7;
char *pcVar8;
undefined1 *puVar9;
void *local_40 [2];
undefined2 local_38;
ushort local_36;
void *local_34;
undefined4 local_30;
undefined2 local_2c;
ushort local_2a;
undefined1 *local_28;
undefined4 local_24;
undefined2 local_20;
ushort local_1e;
if (this[1] == (CDirectorChallengeMode)0x0) {
return;
}
local_38 = 0;
local_36 = 0;
local_40[0] = (void *)0x0;
puVar9 = &DAT_00d539c2;
if (*(undefined1 **)(gpGlobals + 0x3c) != (undefined1 *)0x0) {
puVar9 = *(undefined1 **)(gpGlobals + 0x3c);
}
/* try { // try from 0089e743 to 0089e747 has its CatchHandler @ 0089eb34 */
local_34 = (void *)CDirector::GetGameMode();
puVar1 = *(undefined4 **)(this + 0x140);
local_2a = 0;
local_1e = 0;
local_30 = 0;
local_2c = 0x1f;
local_24 = 0;
local_20 = 0x1f;
/* try { // try from 0089e7a9 to 0089e807 has its CatchHandler @ 0089eafa */
local_28 = puVar9;
iVar4 = (**(code **)(*g_pScriptVM + 0x48))(g_pScriptVM,"ScriptMode_OnActivate",*puVar1,0);
if (iVar4 == 0) {
iVar5 = -1;
}
else {
iVar5 = (**(code **)(*g_pScriptVM + 0x50))(g_pScriptVM,iVar4,&local_34,2,local_40,*puVar1,1);
(**(code **)(*g_pScriptVM + 0x4c))(g_pScriptVM,iVar4);
}
if ((local_1e & 1) != 0) {
free(local_28);
local_1e = local_1e & 0xfffe;
}
local_28 = (undefined1 *)0x0;
local_24 = 0;
local_20 = 0;
if ((local_2a & 1) != 0) {
free(local_34);
}
if (iVar5 != -1) {
/* try { // try from 0089e83d to 0089e942 has its CatchHandler @ 0089eb34 */
CDirector::PostRunScript(TheDirector);
}
*this = (CDirectorChallengeMode)0x1;
if (g_pGameRules != (CTerrorGameRules *)0x0) {
CTerrorGameRules::SetChallengeModeActive(g_pGameRules,true);
}
uVar6 = (**(code **)(*g_pScriptVM + 0x48))
(g_pScriptVM,"GetNextStage",**(undefined4 **)(this + 0x144),0);
*(undefined4 *)(this + 0x110) = uVar6;
uVar6 = (**(code **)(*g_pScriptVM + 0x48))
(g_pScriptVM,"UserConsoleCommand",**(undefined4 **)(this + 0x144),0);
*(undefined4 *)(this + 0x134) = uVar6;
uVar6 = (**(code **)(*g_pScriptVM + 0x48))
(g_pScriptVM,"InterceptChat",**(undefined4 **)(this + 0x144),0);
*(undefined4 *)(this + 0x130) = uVar6;
uVar6 = (**(code **)(*g_pScriptVM + 0x48))
(g_pScriptVM,"AllowTakeDamage",**(undefined4 **)(this + 0x144),0);
*(undefined4 *)(this + 0x11c) = uVar6;
uVar6 = (**(code **)(*g_pScriptVM + 0x48))
(g_pScriptVM,"AllowBash",**(undefined4 **)(this + 0x144),0);
*(undefined4 *)(this + 0x124) = uVar6;
piVar2 = g_pScriptVM;
if (*(int *)(this + 0x11c) == 0) goto LAB_0089e9ee;
local_34 = (void *)0x0;
local_2a = 0;
*(undefined4 *)(this + 0x120) = 0;
local_2c = 0;
iVar4 = 0;
if (**(int **)(this + 0x140) != -1) {
iVar4 = **(int **)(this + 0x140);
}
/* try { // try from 0089e9a8 to 0089e9d4 has its CatchHandler @ 0089eb22 */
cVar3 = (**(code **)(*piVar2 + 0x90))(piVar2,iVar4,"ScriptedDamageInfo",&local_34);
if (cVar3 == '\0') {
pvVar7 = *(void **)(this + 0x120);
if (*(void **)(this + 0x120) == (void *)0x0) goto LAB_0089ea91;
LAB_0089e9c0:
cVar3 = (**(code **)(*g_pScriptVM + 0x84))(g_pScriptVM,pvVar7);
if (cVar3 == '\0') goto LAB_0089ea91;
}
else {
*(void **)(this + 0x120) = local_34;
pvVar7 = local_34;
if (local_34 != (void *)0x0) goto LAB_0089e9c0;
LAB_0089ea91:
*(undefined4 *)(this + 0x11c) = 0;
}
if ((local_2a & 1) != 0) {
free(local_34);
}
LAB_0089e9ee:
/* try { // try from 0089e9f6 to 0089ea6f has its CatchHandler @ 0089eb34 */
pcVar8 = (char *)CDirector::GetGameMode();
iVar4 = V_strnicmp(pcVar8,"debug_",6);
this[0x114] = (CDirectorChallengeMode)(iVar4 == 0);
if (iVar4 == 0) {
DevMsg("ScriptedMode: IsADebugMode is True!\n");
uVar6 = (**(code **)(*g_pScriptVM + 0x48))
(g_pScriptVM,"DebugTick",**(undefined4 **)(this + 0x144),0);
*(undefined4 *)(this + 0x118) = uVar6;
}
CDirectorScriptedEventManager::IncrementCustomFinaleStage
(*(CDirectorScriptedEventManager **)(TheDirector + 0x638));
if ((local_36 & 1) == 0) {
return;
}
free(local_40[0]);
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.