L L4D2node

CDirector::Reset

0x00879c10 · 1928 bytes · __thiscall

_ZN9CDirector5ResetEv

Decompiled

undefined (1 param)

/* CDirector::Reset() */

void __thiscall CDirector::Reset(CDirector *this)

{
  float fVar1;
  CBaseEdict *pCVar2;
  undefined4 uVar3;
  char cVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  CDirector *pCVar8;
  int *piVar9;
  uint uVar10;
  longdouble lVar11;
  int local_30 [4];
  undefined4 local_20 [4];
  
  CDirectorChallengeMode::ResetNonVirtual(*(CDirectorChallengeMode **)(this + 0x648));
  (**(code **)**(undefined4 **)(this + 0x62c))(*(undefined4 **)(this + 0x62c));
  CDirectorSessionManager::Reset(*(CDirectorSessionManager **)(this + 0x634));
  CDirectorScavengeMode::ResetNonVirtual(*(CDirectorScavengeMode **)(this + 0x644));
  CDirectorScriptedEventManager::ResetNonVirtual(*(CDirectorScriptedEventManager **)(this + 0x638));
  CDirectorVersusMode::ResetNonVirtual(*(CDirectorVersusMode **)(this + 0x63c));
  CDirectorSurvivalMode::ResetNonVirtual(*(CDirectorSurvivalMode **)(this + 0x640));
  this[0x160] = (CDirector)0x0;
  this[0x161] = (CDirector)0x0;
  this[0x280] = (CDirector)0x0;
  this[0x281] = (CDirector)0x0;
  this[0x282] = (CDirector)0x0;
  this[0x290] = (CDirector)0x0;
  this[0x291] = (CDirector)0x0;
  this[0x4e4] = (CDirector)0x0;
  this[0x4e7] = (CDirector)0x0;
  *(undefined4 *)(this + 0x3a4) = 0xffffffff;
  *(undefined4 *)(this + 0x194) = 0;
  if (*(float *)(this + 0x1a0) != -1.0) {
    (**(code **)(*(int *)(this + 0x198) + 4))(this + 0x198,this + 0x1a0);
    *(undefined4 *)(this + 0x1a0) = 0xbf800000;
  }
  *(undefined4 *)(this + 0x164) = 0;
  if (*(float *)(this + 600) != -1.0) {
    (**(code **)(*(int *)(this + 0x250) + 4))(this + 0x250,this + 600);
    *(undefined4 *)(this + 600) = 0xbf800000;
  }
  if (*(float *)(this + 0x264) != -1.0) {
    (**(code **)(*(int *)(this + 0x25c) + 4))(this + 0x25c,this + 0x264);
    *(undefined4 *)(this + 0x264) = 0xbf800000;
  }
  if (*(float *)(this + 0x270) != -1.0) {
    (**(code **)(*(int *)(this + 0x268) + 4))(this + 0x268,this + 0x270);
    *(undefined4 *)(this + 0x270) = 0xbf800000;
  }
  if (*(float *)(this + 0x27c) != -1.0) {
    (**(code **)(*(int *)(this + 0x274) + 4))(this + 0x274,this + 0x27c);
    *(undefined4 *)(this + 0x27c) = 0xbf800000;
  }
  (**(code **)(*(int *)this + 0x60))(this,9);
  this[0x1dc] = (CDirector)0x1;
  *(undefined4 *)(this + 0x39c) = 0;
  *(undefined4 *)(this + 0x288) = 0;
  *(undefined4 *)(this + 0x1c0) = 0;
  *(undefined4 *)(this + 0x1bc) = 0;
  *(undefined4 *)(this + 0x1c8) = 0;
  *(undefined4 *)(this + 0x1cc) = 0;
  this[0x4f5] = (CDirector)0x1;
  if (*(float *)(this + 0x174) != -1.0) {
    (**(code **)(*(int *)(this + 0x16c) + 4))(this + 0x16c,this + 0x174);
    *(undefined4 *)(this + 0x174) = 0xbf800000;
  }
  if (*(float *)(this + 0x29c) != -1.0) {
    (**(code **)(*(int *)(this + 0x294) + 4))(this + 0x294,this + 0x29c);
    *(undefined4 *)(this + 0x29c) = 0xbf800000;
  }
  if (*(float *)(this + 0x2a8) != -1.0) {
    (**(code **)(*(int *)(this + 0x2a0) + 4))(this + 0x2a0,this + 0x2a8);
    *(undefined4 *)(this + 0x2a8) = 0xbf800000;
  }
  if (*(float *)(this + 0x1d8) != -1.0) {
    (**(code **)(*(int *)(this + 0x1d0) + 4))(this + 0x1d0,this + 0x1d8);
    *(undefined4 *)(this + 0x1d8) = 0xbf800000;
  }
  UTIL_LogPrintf("Preventing spawning\n");
  lVar11 = (longdouble)
           GetScriptValue(this,"MobMaxSize",
                          *(float *)(DirectorPrivate_DirectorMobMaxSize._28_4_ + 0x2c));
  uVar3 = RescueInterval._28_4_;
  *(undefined4 *)(this + 0x388) = 0;
  *(undefined4 *)(this + 0x40c) = 0;
  *(undefined4 *)(this + 0x398) = 0;
  *(float *)(this + 900) = (float)lVar11;
  fVar1 = *(float *)(uVar3 + 0x2c);
  lVar11 = (longdouble)CountdownTimer::Now();
  if ((float)lVar11 + fVar1 != *(float *)(this + 0x3dc)) {
    (**(code **)(*(int *)(this + 0x3d4) + 4))(this + 0x3d4,this + 0x3dc);
    *(float *)(this + 0x3dc) = (float)lVar11 + fVar1;
  }
  if (fVar1 != *(float *)(this + 0x3d8)) {
    (**(code **)(*(int *)(this + 0x3d4) + 4))(this + 0x3d4,this + 0x3d8);
    *(float *)(this + 0x3d8) = fVar1;
  }
  ReloadPopulationData(this);
  iVar5 = 0;
  *(undefined4 *)(this + 0x1e0) = 0xffffffff;
  *(undefined4 *)(this + 0x1e4) = 0;
  do {
    *(undefined4 *)(this + iVar5 * 4 + 0x1e8) = 0;
    *(undefined4 *)(this + iVar5 * 4 + 0x210) = 0;
    iVar5 = iVar5 + 1;
  } while (iVar5 != 10);
  if (*(float *)(this + 0x240) != -1.0) {
    (**(code **)(*(int *)(this + 0x238) + 4))(this + 0x238,this + 0x240);
    *(undefined4 *)(this + 0x240) = 0xbf800000;
  }
  *(undefined4 *)(this + 0x244) = 0;
  *(undefined4 *)(this + 0x248) = 0;
  *(undefined4 *)(this + 0x24c) = 0;
  pCVar8 = this + 0x2ac;
  iVar5 = 0;
  do {
    while (iVar6 = iVar5, *(float *)(this + (int)(pCVar8 + (4 - (int)this))) != -1.0) {
      (**(code **)(*(int *)pCVar8 + 4))(pCVar8,pCVar8 + 4);
      *(undefined4 *)(this + (int)(pCVar8 + (4 - (int)this))) = 0xbf800000;
      pCVar8 = pCVar8 + 8;
      iVar5 = iVar6 + 1;
      if (iVar6 + 1 == 9) goto LAB_00879f75;
    }
    pCVar8 = pCVar8 + 8;
    iVar5 = iVar6 + 1;
  } while (iVar6 + 1 != 9);
LAB_00879f75:
  uVar10 = iVar6 + 1U & 0xffff0000;
  if (0 < *(int *)(this + 0x370)) {
    iVar5 = 0;
    do {
      while (piVar9 = (int *)(*(int *)(this + 0x33c) + iVar5), (float)piVar9[2] != -1.0) {
        uVar10 = uVar10 + 1;
        iVar5 = iVar5 + 0xc;
        (**(code **)(*piVar9 + 4))(piVar9,piVar9 + 2);
        piVar9[2] = -0x40800000;
        if (*(int *)(this + 0x370) <= (int)uVar10) goto LAB_00879fe2;
      }
      uVar10 = uVar10 + 1;
      iVar5 = iVar5 + 0xc;
    } while ((int)uVar10 < *(int *)(this + 0x370));
  }
LAB_00879fe2:
  DAT_01025eac = 0;
  if ((*(int *)(gpGlobals + 0x48) != 3) && (*(int *)(DirectorForceBackground._28_4_ + 0x30) == 0)) {
    NextBotDestroyer::NextBotDestroyer((NextBotDestroyer *)local_20,3);
    iVar5 = TheNextBots();
    uVar10 = (uint)*(ushort *)(iVar5 + 0x10);
    if (uVar10 != 0xffff) {
      iVar6 = *(int *)(iVar5 + 4);
      do {
        cVar4 = NextBotDestroyer::operator()
                          ((NextBotDestroyer *)local_20,*(INextBot **)(iVar6 + uVar10 * 8));
        if (cVar4 == '\0') break;
        iVar6 = *(int *)(iVar5 + 4);
        uVar10 = (uint)*(ushort *)(iVar6 + 6 + uVar10 * 8);
      } while (uVar10 != 0xffff);
    }
  }
  (**(code **)(*(int *)this + 0x48))(this);
  local_20[0] = 0;
  cVar4 = CTerrorGameRules::IsL4D1Campaign((int *)local_20);
  if ((cVar4 != '\0') && (iVar5 = GetWorldEntity(), iVar5 != 0)) {
    iVar6 = 0;
    if (-1 < *(int *)(this + 0x420)) {
      iVar6 = *(int *)(this + 0x420);
    }
    iVar7 = 1;
    if (iVar6 < 1) {
      iVar7 = iVar6;
    }
    if (*(int *)(iVar5 + 0x47c) != iVar7) {
      if (*(char *)(iVar5 + 0x6c) == '\0') {
        pCVar2 = *(CBaseEdict **)(iVar5 + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        *(byte *)(iVar5 + 0x70) = *(byte *)(iVar5 + 0x70) | 1;
      }
      *(int *)(iVar5 + 0x47c) = iVar7;
    }
    AllocPooledString((char *)local_30);
    if (*(int *)(iVar5 + 0x480) != local_30[0]) {
      if (*(char *)(iVar5 + 0x6c) == '\0') {
        pCVar2 = *(CBaseEdict **)(iVar5 + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        *(byte *)(iVar5 + 0x70) = *(byte *)(iVar5 + 0x70) | 1;
      }
      *(int *)(iVar5 + 0x480) = local_30[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)