L L4D2node

CDirectorChallengeMode::InitScriptsNonVirtual

0x0089ff60 · 617 bytes · __thiscall

_ZN22CDirectorChallengeMode21InitScriptsNonVirtualEv

Decompiled

undefined (1 param)

/* CDirectorChallengeMode::InitScriptsNonVirtual() */

void __thiscall CDirectorChallengeMode::InitScriptsNonVirtual(CDirectorChallengeMode *this)

{
  undefined4 *puVar1;
  CDirector *pCVar2;
  undefined4 uVar3;
  int iVar4;
  int iVar5;
  undefined1 *puVar6;
  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;
  
  CDirector::InitChallengeScope(TheDirector);
  AddEnumsToScope();
  CScriptHud::SetScriptLevel((CScriptHud *)(this + 0x15c),1);
  CScriptJournal::SetScriptLevel((CScriptJournal *)(this + 0x178),3);
  pCVar2 = TheDirector;
  *(undefined4 *)(this + 0x154) = 0;
  CDirector::RunScript(pCVar2,"scriptedmode",1,1);
  this[1] = (CDirectorChallengeMode)0x0;
  *(undefined4 *)(this + 0x138) = 1;
  uVar3 = CDirector::GetScriptScope(TheDirector,1);
  *(undefined4 *)(this + 0x140) = uVar3;
  iVar4 = CDirector::GetScriptScope(TheDirector,3);
  *(int *)(this + 0x144) = iVar4;
  if ((*(int *)(this + 0x140) != 0) && (iVar4 != 0)) {
    local_38 = 0;
    local_36 = 0;
    local_40[0] = (void *)0x0;
    puVar6 = &DAT_00d539c2;
    if (*(undefined1 **)(gpGlobals + 0x3c) != (undefined1 *)0x0) {
      puVar6 = *(undefined1 **)(gpGlobals + 0x3c);
    }
                    /* try { // try from 008a0063 to 008a0067 has its CatchHandler @ 008a01da */
    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 008a00cc to 008a0126 has its CatchHandler @ 008a01f5 */
    local_28 = puVar6;
    iVar4 = (**(code **)(*g_pScriptVM + 0x48))(g_pScriptVM,"ScriptMode_Init",*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) {
      this[1] = local_40[0]._0_1_;
                    /* try { // try from 008a015a to 008a017b has its CatchHandler @ 008a01da */
      CGlobalEntityList::CleanupDeleteList();
      (**(code **)(*engine + 0x17c))(engine);
    }
    CDirector::PostRunScript(TheDirector);
    if ((local_36 & 1) != 0) {
      free(local_40[0]);
      return;
    }
  }
  return;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)