L L4D2node

CDirector::OnMapLoaded

0x00873820 · 864 bytes · __thiscall

_ZN9CDirector11OnMapLoadedEv

Decompiled

undefined (1 param)

/* CDirector::OnMapLoaded() */

void __thiscall CDirector::OnMapLoaded(CDirector *this)

{
  float fVar1;
  int *piVar2;
  CDirector CVar3;
  char cVar4;
  NextBotManager *this_00;
  KeyValues *this_01;
  undefined4 uVar5;
  char *pcVar6;
  CDirector *pCVar7;
  int iVar8;
  longdouble lVar9;
  
  iVar8 = 0;
  (**(code **)(**(int **)(this + 0x634) + 4))(*(int **)(this + 0x634));
  (**(code **)(**(int **)(this + 0x62c) + 8))(*(int **)(this + 0x62c));
  (**(code **)(*TheNavMesh + 0x48))(TheNavMesh);
  this_00 = (NextBotManager *)TheNextBots();
  NextBotManager::OnMapLoaded(this_00);
  ZombieManager::ServerActivate(TheZombieManager);
  CVar3 = m_isTransitioning;
  m_isTransitioning = (CDirector)0x0;
  this[0x115] = (CDirector)0x0;
  this[0x28e] = CVar3;
  (**(code **)(*(int *)this + 0x60))(this,9);
  pCVar7 = this + 0x2ac;
  do {
    while (*(float *)(this + (int)(pCVar7 + (4 - (int)this))) != -1.0) {
      iVar8 = iVar8 + 1;
      (**(code **)(*(int *)pCVar7 + 4))(pCVar7,pCVar7 + 4);
      *(undefined4 *)(this + (int)(pCVar7 + (4 - (int)this))) = 0xbf800000;
      pCVar7 = pCVar7 + 8;
      if (iVar8 == 9) goto LAB_0087390d;
    }
    iVar8 = iVar8 + 1;
    pCVar7 = pCVar7 + 8;
  } while (iVar8 != 9);
LAB_0087390d:
  this_01 = (KeyValues *)CTerrorGameRules::GetMissionCurrentMap((KeyValues **)0x0);
  if (this_01 == (KeyValues *)0x0) {
    *(undefined4 *)(this + 0x420) = 0;
  }
  else {
    iVar8 = KeyValues::GetInt(this_01,"chapter",1);
    *(int *)(this + 0x420) = iVar8 + -1;
  }
  if (this[0x28e] == (CDirector)0x0) {
    pcVar6 = "";
    if (*(char **)(gpGlobals + 0x3c) != (char *)0x0) {
      pcVar6 = *(char **)(gpGlobals + 0x3c);
    }
    V_strncpy((char *)(this + 0x3b4),pcVar6,0x20);
    if (this[0x28e] != (CDirector)0x0) goto LAB_00873951;
LAB_00873b31:
    *(undefined4 *)(this + 0x424) = *(undefined4 *)(this + 0x420);
  }
  else {
LAB_00873951:
    if (m_isScenarioRestart != '\0') goto LAB_00873b31;
  }
  lVar9 = (longdouble)IntervalTimer::Now();
  if ((float)lVar9 != *(float *)(this + 0x3ac)) {
    (**(code **)(*(int *)(this + 0x3a8) + 4))(this + 0x3a8,this + 0x3ac);
    *(float *)(this + 0x3ac) = (float)lVar9;
  }
  this[0x28d] = (CDirector)0x0;
  if (this[0x28e] == (CDirector)0x0) {
    cVar4 = IsTransitioned();
    if (cVar4 == '\0') {
      *(undefined4 *)(this + 0x3b0) = 0;
      this[0x28c] = (CDirector)0x0;
      goto LAB_008739d2;
    }
  }
  this[0x28c] = (CDirector)0x1;
LAB_008739d2:
  piVar2 = g_pGameRules;
  this[0x4e5] = (CDirector)0x0;
  this[0x4e6] = (CDirector)0x0;
  (**(code **)(*piVar2 + 0x2cc))(piVar2);
  ClearTeamScores(this,(bool)((byte)this[0x28e] ^ 1));
  fVar1 = *(float *)(DirectorTransitionTimeout._28_4_ + 0x2c);
  lVar9 = (longdouble)CountdownTimer::Now();
  if ((float)lVar9 + fVar1 != *(float *)(this + 0x4f0)) {
    (**(code **)(*(int *)(this + 0x4e8) + 4))(this + 0x4e8,this + 0x4f0);
    *(float *)(this + 0x4f0) = (float)lVar9 + fVar1;
  }
  if (fVar1 != *(float *)(this + 0x4ec)) {
    (**(code **)(*(int *)(this + 0x4e8) + 4))(this + 0x4e8,this + 0x4ec);
    *(float *)(this + 0x4ec) = fVar1;
  }
  CDirectorVersusMode::OnMapLoadedNonVirtual(*(CDirectorVersusMode **)(this + 0x63c));
  CDirectorSurvivalMode::OnMapLoadedNonVirtual(*(CDirectorSurvivalMode **)(this + 0x640));
  CDirectorScavengeMode::OnMapLoadedNonVirtual(*(CDirectorScavengeMode **)(this + 0x644));
  uVar5 = RandomInt(1,6);
  *(undefined4 *)(this + 0x4f8) = uVar5;
  cVar4 = CTerrorGameRules::IsGenericCooperativeMode();
  if ((cVar4 != '\0') && (this[0x28e] == (CDirector)0x0)) {
    cVar4 = IsTransitioned();
    if (cVar4 == '\0') {
      uVar5 = RandomInt(0,100);
      *(undefined4 *)(this + 0x4fc) = uVar5;
    }
  }
  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)