L L4D2node

CDirector::DrawDebug

0x0087b130 · 5680 bytes · __thiscall

_ZN9CDirector9DrawDebugEv

Decompiled

undefined (1 param)

/* WARNING: Removing unreachable block (ram,0x0087b668) */
/* WARNING: Removing unreachable block (ram,0x0087b65a) */
/* WARNING: Removing unreachable block (ram,0x0087b64c) */
/* WARNING: Removing unreachable block (ram,0x0087b67c) */
/* CDirector::DrawDebug() */

void __thiscall CDirector::DrawDebug(CDirector *this)

{
  CBaseEntity *pCVar1;
  CDirectorScriptedEventManager *this_00;
  int *piVar2;
  char cVar3;
  bool bVar4;
  int iVar5;
  undefined4 uVar6;
  int iVar7;
  char *pcVar8;
  int iVar9;
  uint uVar10;
  int iVar11;
  undefined *puVar12;
  int iVar13;
  CDirector *pCVar14;
  int in_GS_OFFSET;
  longdouble lVar15;
  float fVar16;
  double dVar17;
  char *pcVar18;
  undefined8 uVar19;
  DebugIntensity *local_198;
  int local_194;
  AreNoSurvivorsInCombat *local_188;
  CFmtStrN<256> *local_184;
  char *local_180;
  undefined4 local_17c;
  undefined4 local_178;
  int local_174;
  undefined4 local_170;
  float local_16c [2];
  int local_164 [7];
  undefined4 auStack_148 [6];
  undefined1 local_130;
  undefined **local_12c;
  undefined1 local_128;
  char local_127 [259];
  undefined4 local_24;
  int local_20;
  
  local_128 = 1;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_12c = &PTR_InitQuietTruncation_00c08ee8;
  local_127[0] = '\0';
  local_24 = 0;
  iVar5 = CDirectorScriptedEventManager::DrawDebugNonVirtual
                    (*(CDirectorScriptedEventManager **)(this + 0x638),6);
  uVar6 = CDirectorSurvivalMode::DrawDebugNonVirtual
                    (*(CDirectorSurvivalMode **)(this + 0x640),iVar5);
  iVar5 = (**(code **)(*(int *)this + 0x78))(this,uVar6);
  if (*(int *)(*(int *)(this + 0x638) + 0x128) == 4) {
    iVar9 = iVar5 + 2;
    pcVar8 = "NORMAL MODE";
    AddDebugTextLine(0.01,0.0,iVar5 + 1,"NORMAL MODE",0xff,0xff,0xff,0xff,0.01023);
    iVar7 = *(int *)(this + 0x194);
    if (iVar7 == 1) {
      fVar16 = *(float *)(this + 0x1a0);
      lVar15 = (longdouble)CountdownTimer::Now();
      pcVar18 = "  tempo: SUSTAIN_PEAK (%d seconds remaining)";
      iVar7 = (int)(fVar16 - (float)lVar15);
      if ((float)iVar7 < fVar16 - (float)lVar15) {
        iVar7 = iVar7 + 1;
      }
      uVar19 = CONCAT44(pcVar8,iVar7);
LAB_0087c205:
      CFmtStrN<256>::sprintf((CFmtStrN<256> *)&local_12c,pcVar18,uVar19);
LAB_0087c219:
      AddDebugTextLine(0.01,0.0,iVar9,local_127,0xff,0xff,0,0xff,0.01023);
      iVar9 = iVar5 + 3;
    }
    else if (iVar7 < 2) {
      if (iVar7 == 0) {
        lVar15 = (longdouble)CountdownTimer::Now();
        fVar16 = *(float *)(this + 0x1a0);
        if ((float)lVar15 < fVar16) {
          lVar15 = (longdouble)CountdownTimer::Now();
          fVar16 = fVar16 - (float)lVar15;
          iVar7 = (int)fVar16;
          if ((float)iVar7 < fVar16) {
            iVar7 = iVar7 + 1;
          }
          CFmtStrN<256>::sprintf
                    ((CFmtStrN<256> *)&local_12c,"  tempo: BUILD_UP (%d seconds remaining)",iVar7);
        }
        else {
          CFmtStrN<256>::sprintf((CFmtStrN<256> *)&local_12c,"  tempo: BUILD_UP");
        }
        goto LAB_0087c219;
      }
    }
    else if (iVar7 == 2) {
      local_16c[0] = 0.0;
      ForEachTerrorPlayer<FindMaxIntensity>((FindMaxIntensity *)local_16c);
      CFmtStrN<256>::sprintf
                ((CFmtStrN<256> *)&local_12c,"  tempo: PEAK_FADE (%3.2f max intensity)",
                 (double)local_16c[0]);
      AddDebugTextLine(0.01,0.0,iVar9,local_127,0xff,0xff,0,0xff,0.01023);
      iVar9 = iVar5 + 3;
    }
    else if (iVar7 == 3) {
      fVar16 = *(float *)(this + 0x1a0);
      lVar15 = (longdouble)CountdownTimer::Now();
      pcVar18 = "  tempo: RELAX (%d seconds remaining)";
      iVar7 = (int)(fVar16 - (float)lVar15);
      if ((float)iVar7 < fVar16 - (float)lVar15) {
        iVar7 = iVar7 + 1;
      }
      uVar19 = CONCAT44(pcVar8,iVar7);
      goto LAB_0087c205;
    }
    local_180 = local_127;
    local_184 = (CFmtStrN<256> *)&local_12c;
    CFmtStrN<256>::sprintf
              (local_184,"  Total Population: %d",*(undefined4 *)(TheZombieManager + 0x278));
    AddDebugTextLine(0.01,0.0,iVar9,local_180,0xff,0xff,0,0xff,0.01023);
  }
  local_180 = local_127;
  local_184 = (CFmtStrN<256> *)&local_12c;
  local_188 = (AreNoSurvivorsInCombat *)local_16c;
  NDebugOverlay::ScreenTextLine(0.01,0.0,0x18,"MAP INFO",0xff,0xff,0xff,0xff,0.01023);
  CFmtStrN<256>::sprintf(local_184,"  Previous Elapsed time: %.0f",(double)*(float *)(this + 0x3b0))
  ;
  NDebugOverlay::ScreenTextLine(0.01,0.0,0x19,local_180,0xff,0xff,0,0xff,0.01023);
  if (*(float *)(this + 0x3ac) <= 0.0) {
    dVar17 = 99999.8984375;
  }
  else {
    lVar15 = (longdouble)IntervalTimer::Now();
    dVar17 = (double)((float)lVar15 - *(float *)(this + 0x3ac));
  }
  CFmtStrN<256>::sprintf(local_184,"  Current Elapsed time: %.0f",dVar17);
  NDebugOverlay::ScreenTextLine(0.01,0.0,0x1a,local_180,0xff,0xff,0,0xff,0.01023);
  CFmtStrN<256>::sprintf(local_184,"  Original map was %s",this + 0x3b4);
  NDebugOverlay::ScreenTextLine(0.01,0.0,0x1b,local_180,0xff,0xff,0,0xff,0.01023);
  CFmtStrN<256>::sprintf(local_184,"  Map number: %d",*(undefined4 *)(this + 0x420));
  NDebugOverlay::ScreenTextLine(0.01,0.0,0x1c,local_180,0xff,0xff,0,0xff,0.01023);
  AddDebugTextLine(0.01,0.0,0x1e,"COMMON INFECTED STATS",0xff,0xff,0xff,0xff,0.01023);
  if (*(int *)(*(int *)(this + 0x638) + 0x128) == 4) {
    if (*(float *)(this + 0x29c) <= 0.0) {
      lVar15 = (longdouble)GetScriptValue(this,"MobSpawnSize",*(float *)(this + 900));
      CFmtStrN<256>::sprintf(local_184,"  Next mob size: %d",(int)lVar15);
    }
    else {
      CountdownTimer::Now();
      lVar15 = (longdouble)GetScriptValue(this,"MobSpawnSize",*(float *)(this + 900));
      CFmtStrN<256>::sprintf(local_184,"  Next mob size: %d (in %d seconds)",(int)lVar15);
    }
    AddDebugTextLine(0.01,0.0,0x1f,local_180,0xff,0xff,0,0xff,0.01023);
  }
  else {
    AddDebugTextLine(0.01,0.0,0x1f,"  Next mob size: N/A (in panic mode)",0xff,0xff,0,0xff,0.01023);
  }
  GetCommonInfectedLimit(this);
  uVar6 = CDirectorTacticalServices::GetCommonInfectedCount
                    (*(CDirectorTacticalServices **)(this + 0x628),0);
  CFmtStrN<256>::sprintf(local_184,"  Population: %d (out of %d max)",uVar6);
  AddDebugTextLine(0.01,0.0,0x20,local_180,0xff,0xff,0,0xff,0.01023);
  CFmtStrN<256>::sprintf(local_184,"  Pending count: %d",*(undefined4 *)(TheZombieManager + 0x210));
  AddDebugTextLine(0.01,0.0,0x21,local_180,0xff,0xff,0,0xff,0.01023);
  iVar9 = TheZombieManager;
  iVar5 = *(int *)(TheZombieManager + 0x1f0);
  if (iVar5 == 0) {
    AddDebugTextLine(0.01,0.0,0x22,"No mob spawn areas",0xff,0xff,0,0xff,0.01023);
  }
  else {
    local_16c[0] = 0.0;
    local_16c[1] = 0.0;
    local_164[0] = 0;
    local_164[1] = 0;
    if (iVar5 < 1) {
      pcVar8 = "";
    }
    else {
      iVar7 = 0;
      do {
        if (iVar7 < iVar5) {
          uVar6 = *(undefined4 *)(*(int *)(iVar9 + 0x1e4) + iVar7 * 8);
        }
        else {
          uVar6 = 0;
        }
        *(undefined4 *)(local_188 + iVar7 * 4) = uVar6;
        iVar7 = iVar7 + 1;
      } while ((iVar7 != iVar5) && (iVar7 != 4));
      pcVar8 = "";
      if (4 < iVar5) {
        pcVar8 = "more...";
      }
    }
    CFmtStrN<256>::sprintf(local_184,"  Spawn areas: #%d, #%d, #%d, #%d %s",0,0,0,0,pcVar8);
    AddDebugTextLine(0.01,0.0,0x22,local_180,0xff,0xff,0,0xff,0.01023);
  }
  iVar9 = (**(code **)(**(int **)(this + 0x634) + 0x24))(*(int **)(this + 0x634),0x24);
  AddDebugTextLine(0.01,0.0,iVar9,"SURVIVOR STATS",0xff,0xff,0xff,0xff,0.01023);
  cVar3 = CDirectorScriptedEventManager::AreAllSurvivorsInBattlefield
                    (*(CDirectorScriptedEventManager **)(this + 0x638));
  iVar5 = iVar9 + 1;
  if (cVar3 != '\0') {
    iVar5 = iVar9 + 2;
    AddDebugTextLine(0.01,0.0,iVar9 + 1,"  In a Battlefield Area",0xff,0xff,0,0xff,0.01023);
  }
  pcVar8 = "No";
  if ((this[0x160] != (CDirector)0x0) && (pcVar8 = "All", this[0x161] == (CDirector)0x0)) {
    pcVar8 = "Some";
  }
  CFmtStrN<256>::sprintf(local_184,"  %s survivors have left the starting safe area",pcVar8);
  AddDebugTextLine(0.01,0.0,iVar5,local_180,0xff,0xff,0,0xff,0.01023);
  bVar4 = ForEachSurvivor<AreNoSurvivorsInCombat>(local_188);
  puVar12 = &DAT_00d539c2;
  if (bVar4) {
    puVar12 = &DAT_00cdbb60;
  }
  CFmtStrN<256>::sprintf(local_184,"  %sIN COMBAT",puVar12);
  AddDebugTextLine(0.01,0.0,iVar5 + 1,local_180,0xff,0xff,0,0xff,0.01023);
  CFmtStrN<256>::sprintf(local_184,"  Flow span: %d",(int)*(float *)(this + 0x244));
  AddDebugTextLine(0.01,0.0,iVar5 + 2,local_180,0xff,0xff,0,0xff,0.01023);
  CFmtStrN<256>::sprintf(local_184,"  Furthest flow: %d",(int)*(float *)(this + 0x24c));
  AddDebugTextLine(0.01,0.0,iVar5 + 3,local_180,0xff,0xff,0,0xff,0.01023);
  CFmtStrN<256>::sprintf(local_184,"  Flow/s: %d",(int)*(float *)(this + 0x248));
  pcVar8 = local_180;
  AddDebugTextLine(0.01,0.0,iVar5 + 4,local_180,0xff,0xff,0,0xff,0.01023);
  local_130 = 0;
  uVar10 = 0;
  local_16c[0] = 0.0;
  local_16c[1] = 0.0;
  local_164[0] = 0;
  do {
    *(undefined4 *)((int)local_164 + uVar10 + 4) = 0;
    uVar10 = uVar10 + 4;
  } while (uVar10 < 0x18);
  uVar10 = 0;
  do {
    *(undefined4 *)((int)auStack_148 + uVar10) = 0;
    uVar10 = uVar10 + 4;
  } while (uVar10 < 0x18);
  ForEachTerrorPlayer<ZombieCounter>((ZombieCounter *)local_188);
  if ((g_pGameRules == (CTerrorGameRules *)0x0) ||
     (cVar3 = CTerrorGameRules::IsChallengeModeActive(g_pGameRules), cVar3 == '\0')) {
    if (this[0x160] == (CDirector)0x0) {
      uVar6 = (**(code **)(*(int *)this + 0x30))(this);
      pcVar18 = "SPECIALS (%d max) - Not spawning - all players still in safe area.";
      uVar19 = CONCAT44(pcVar8,uVar6);
    }
    else {
      this_00 = *(CDirectorScriptedEventManager **)(this + 0x638);
      if ((*(int *)(this + 0x1c0) < 1) ||
         ((*(int *)this_00 == 1 && (*(int *)(this_00 + 4) == 0x11)))) {
        cVar3 = CDirectorScriptedEventManager::AreAllSurvivorsInBattlefield(this_00);
        if ((cVar3 == '\0') ||
           (((piVar2 = *(int **)(this + 0x638), piVar2[0x4a] != 4 || (piVar2[1] == 9)) ||
            (*piVar2 == 1)))) {
          local_17c = CONCAT22(local_17c._2_2_,0x101);
          bVar4 = ForEachTerrorPlayer<SurvivorsInFinaleScan>((SurvivorsInFinaleScan *)&local_17c);
          if ((bVar4) && (**(int **)(this + 0x638) == 5)) {
            uVar6 = (**(code **)(*(int *)this + 0x30))(this);
            pcVar18 = "SPECIALS (%d max) - Not spawning - setting up for finale.";
            uVar19 = CONCAT44(pcVar8,uVar6);
          }
          else {
            uVar6 = (**(code **)(*(int *)this + 0x30))(this);
            pcVar18 = "SPECIALS (%d max)";
            uVar19 = CONCAT44(pcVar8,uVar6);
          }
          CFmtStrN<256>::sprintf(local_184,pcVar18,uVar19);
          AddDebugTextLine(0.01,0.0,0x2c,local_180,0xff,0xff,0xff,0xff,0.01023);
          goto LAB_0087bac0;
        }
        uVar6 = (**(code **)(*(int *)this + 0x30))(this);
        pcVar18 = "SPECIALS (%d max) - Not spawning - in battlefield with panic event cleared.";
        uVar19 = CONCAT44(pcVar8,uVar6);
      }
      else {
        uVar6 = (**(code **)(*(int *)this + 0x30))(this);
        pcVar18 = "SPECIALS (%d max) - Not spawning - tank in play.";
        uVar19 = CONCAT44(pcVar8,uVar6);
      }
    }
  }
  else {
    uVar6 = (**(code **)(*(int *)this + 0x30))(this);
    pcVar18 = "SPECIALS (%d max) - being run by Challenge Mode";
    uVar19 = CONCAT44(pcVar8,uVar6);
  }
  CFmtStrN<256>::sprintf(local_184,pcVar18,uVar19);
  AddDebugTextLine(0.01,0.0,0x2c,local_180,0xff,0xff,0xff,0xff,0.01023);
LAB_0087bac0:
  local_198 = (DebugIntensity *)&local_17c;
  pCVar14 = this + 0x2f4;
  iVar5 = 0;
  local_194 = 0;
  do {
    fVar16 = *(float *)(pCVar14 + 8);
    iVar9 = iVar5 + 0x2d;
    lVar15 = (longdouble)CountdownTimer::Now();
    iVar7 = (int)(fVar16 - (float)lVar15);
    if ((float)iVar7 < fVar16 - (float)lVar15) {
      iVar7 = iVar7 + 1;
    }
    iVar11 = 0;
    if (-1 < iVar7) {
      fVar16 = *(float *)(pCVar14 + 8);
      lVar15 = (longdouble)CountdownTimer::Now();
      iVar11 = (int)(fVar16 - (float)lVar15);
      if ((float)iVar11 < fVar16 - (float)lVar15) {
        iVar11 = iVar11 + 1;
      }
    }
    iVar5 = iVar5 + 1;
    pCVar14 = pCVar14 + 0xc;
    uVar6 = ZombieClassName(iVar5);
    CFmtStrN<256>::sprintf(local_184,"  [%02ds] %d %sS",iVar11,local_164[iVar5],uVar6);
    AddDebugTextLine(0.01,0.0,iVar9,local_180,0xff,0xff,0,0xff,0.01023);
    local_194 = local_194 + local_164[iVar5];
  } while (iVar5 != 6);
  iVar9 = 0xff;
  iVar5 = (**(code **)(*(int *)this + 0x30))(this);
  if (iVar5 < local_194) {
    iVar9 = 0;
  }
  iVar7 = 0;
  CFmtStrN<256>::sprintf(local_184,"  Total Specials %d",local_194);
  iVar5 = 0;
  AddDebugTextLine(0.01,0.0,0x33,local_180,0xff,iVar9,iVar9,0xff,0.01023);
  while( true ) {
    iVar9 = iVar5 + 0x34;
    iVar11 = (**(code **)(*(int *)this + 0x30))(this);
    iVar13 = 3;
    if (3 < iVar11) {
      iVar13 = (**(code **)(*(int *)this + 0x30))(this);
    }
    if ((iVar13 <= iVar5) || (*(int *)(this + 0x370) <= iVar5)) break;
    fVar16 = *(float *)(*(int *)(this + 0x33c) + iVar7 + 8);
    lVar15 = (longdouble)CountdownTimer::Now();
    fVar16 = fVar16 - (float)lVar15;
    iVar11 = (int)fVar16;
    if ((float)iVar11 < fVar16) {
      iVar11 = iVar11 + 1;
    }
    if (iVar11 < 0) {
LAB_0087bcfc:
      CFmtStrN<256>::sprintf(local_184,"  Slot #%d: Slot available.",iVar5);
    }
    else {
      fVar16 = *(float *)(*(int *)(this + 0x33c) + iVar7 + 8);
      lVar15 = (longdouble)CountdownTimer::Now();
      fVar16 = fVar16 - (float)lVar15;
      iVar11 = (int)fVar16;
      if ((float)iVar11 < fVar16) {
        iVar11 = iVar11 + 1;
      }
      if (iVar11 == 0) goto LAB_0087bcfc;
      if (iVar11 < 600) {
        CFmtStrN<256>::sprintf(local_184,"  Slot #%d: %d seconds remaining for respawn.",iVar5);
      }
      else {
        CFmtStrN<256>::sprintf(local_184,"  Slot #%d: Currently active.",iVar5);
      }
    }
    iVar5 = iVar5 + 1;
    iVar7 = iVar7 + 0xc;
    AddDebugTextLine(0.01,0.0,iVar9,local_180,0xff,0xff,0,0xff,0.01023);
  }
  iVar5 = (**(code **)(*(int *)this + 0x30))(this);
  if (iVar5 < 4) {
    local_174 = 0x38;
    iVar5 = 0x37;
  }
  else {
    local_174 = (**(code **)(*(int *)this + 0x30))(this);
    iVar5 = local_174 + 0x34;
    local_174 = local_174 + 0x35;
  }
  iVar9 = 0;
  local_17c = 0x3c23d70a;
  local_178 = 0;
  AddDebugTextLine(0.01,0.0,iVar5,"SURVIVOR INTENSITY",0xff,0xff,0xff,0xff,0.25);
  local_170 = 0;
  ForEachTerrorPlayer<DebugIntensity>(local_198);
  if (0 < *(int *)(this + 0x480)) {
    do {
      while ((((uVar10 = *(uint *)(*(int *)(this + 0x474) + iVar9 * 4), uVar10 != 0xffffffff &&
               (puVar12 = g_pEntityList + (uVar10 & 0xfff) * 0x10,
               puVar12 != (undefined *)0xfffffffc)) && (*(uint *)(puVar12 + 8) == uVar10 >> 0xc)) &&
             (pCVar1 = *(CBaseEntity **)(puVar12 + 4), pCVar1 != (CBaseEntity *)0x0))) {
        NDebugOverlay::EntityBounds(pCVar1,0xff,0,0,10,0.01023);
        if (*(int *)(pCVar1 + 0x30) == 0) {
          iVar5 = 0;
        }
        else {
          iVar5 = *(int *)(pCVar1 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
        }
        iVar9 = iVar9 + 1;
        NDebugOverlay::EntityText(iVar5,0,"FORBIDDEN TARGET",0.01023,0xff,0xff,0xff,0xff);
        if (*(int *)(this + 0x480) <= iVar9) goto LAB_0087bf24;
      }
      iVar9 = iVar9 + 1;
    } while (iVar9 < *(int *)(this + 0x480));
  }
LAB_0087bf24:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)