L L4D2node

CDirectorScriptedEventManager::DrawDebugNonVirtual

0x008b6a30 · 3000 bytes · __thiscall

_ZN29CDirectorScriptedEventManager19DrawDebugNonVirtualEi

Decompiled

undefined (2 params)

/* CDirectorScriptedEventManager::DrawDebugNonVirtual(int) */

int __thiscall
CDirectorScriptedEventManager::DrawDebugNonVirtual(CDirectorScriptedEventManager *this,int param_1)

{
  undefined4 uVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  int iVar4;
  undefined4 uVar5;
  int iVar6;
  int in_GS_OFFSET;
  longdouble lVar7;
  longdouble lVar8;
  float fVar9;
  int local_134;
  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_127[0] = '\0';
  local_12c = &PTR_InitQuietTruncation_00c08ee8;
  local_24 = 0;
  if (**(char **)(TheDirector + 0x648) == '\0') {
    iVar4 = *(int *)this;
  }
  else {
    uVar3 = CDirector::GetScriptValue(TheDirector,"ScriptedStageValue",1);
    iVar4 = CDirector::GetScriptValue(TheDirector,"ScriptedStageType",9);
    if (iVar4 == 9) {
      uVar3 = *(undefined4 *)(DrawDebugNonVirtual(int)::stageName + *(int *)(this + 4) * 4);
      uVar5 = CDirector::GetGameMode();
      CFmtStrN<256>::sprintf((CFmtStrN<256> *)&local_12c,"Mutation: %s Stage %s",uVar5,uVar3);
    }
    else {
      uVar5 = *(undefined4 *)(DrawDebugNonVirtual(int)::finaleStageNames + iVar4 * 4);
      uVar1 = *(undefined4 *)(DrawDebugNonVirtual(int)::stageName + *(int *)(this + 4) * 4);
      uVar2 = CDirector::GetGameMode();
      CFmtStrN<256>::sprintf
                ((CFmtStrN<256> *)&local_12c,"Mutation: %s Stage %s val %d (script %s)",uVar2,uVar1,
                 uVar3,uVar5);
    }
    AddDebugTextLine(0.01,0.0,param_1,local_127,0x9b,0xff,0x9b,0xff,0.01023);
    iVar4 = *(int *)this;
    param_1 = param_1 + 1;
  }
  if (iVar4 == 1) {
    AddDebugTextLine(0.01,0.0,param_1 + 1,"GAUNTLET FINALE",0xff,0xff,0xff,0xff,0.01023);
    uVar3 = CDirector::GetCommonInfectedLimit(TheDirector);
    CFmtStrN<256>::sprintf((CFmtStrN<256> *)&local_12c,"  Common Limit = %d",uVar3);
    AddDebugTextLine(0.01,0.0,param_1 + 2,local_127,0xff,0xff,0,0xff,0.01023);
    lVar7 = (longdouble)CDirector::GetMobSpawnMaxInterval(TheDirector);
    lVar8 = (longdouble)CDirector::GetMobSpawnMinInterval(TheDirector);
    CFmtStrN<256>::sprintf
              ((CFmtStrN<256> *)&local_12c,"  Mob Spawn Time Range: %d to %d seconds",(int)lVar8,
               (int)lVar7);
    AddDebugTextLine(0.01,0.0,param_1 + 3,local_127,0xff,0xff,0,0xff,0.01023);
    lVar7 = (longdouble)ZombieManager::GetZombieSpawnRange();
    CFmtStrN<256>::sprintf((CFmtStrN<256> *)&local_12c,"  Max Mob Spawn Distance: %d",(int)lVar7);
    AddDebugTextLine(0.01,0.0,param_1 + 4,local_127,0xff,0xff,0,0xff,0.01023);
    CFmtStrN<256>::sprintf
              ((CFmtStrN<256> *)&local_12c,"  Movement threshold: %d",(int)*(float *)(this + 0x9c));
    AddDebugTextLine(0.01,0.0,param_1 + 5,local_127,0xff,0xff,0,0xff,0.01023);
    fVar9 = *(float *)(this + 0xac);
    lVar7 = (longdouble)CountdownTimer::Now();
    iVar4 = (int)(fVar9 - (float)lVar7);
    if ((float)iVar4 < fVar9 - (float)lVar7) {
      iVar4 = iVar4 + 1;
    }
    CFmtStrN<256>::sprintf((CFmtStrN<256> *)&local_12c,"  Movement time: %02d seconds.",iVar4);
    AddDebugTextLine(0.01,0.0,param_1 + 6,local_127,0xff,0xff,0,0xff,0.01023);
    iVar4 = (int)*(float *)(this + 0xa0);
    if ((float)iVar4 < *(float *)(this + 0xa0)) {
      iVar4 = iVar4 + 1;
    }
    CFmtStrN<256>::sprintf((CFmtStrN<256> *)&local_12c,"  Current Bonus: %02d seconds.",iVar4);
    AddDebugTextLine(0.01,0.0,param_1 + 7,local_127,0xff,0xff,0,0xff,0.01023);
    fVar9 = *(float *)(this + 0xb8);
    local_134 = param_1 + 8;
    if (0.0 < fVar9) {
      lVar7 = (longdouble)CountdownTimer::Now();
      fVar9 = fVar9 - (float)lVar7;
      iVar4 = (int)fVar9;
      if ((float)iVar4 < fVar9) {
        iVar4 = iVar4 + 1;
      }
      local_134 = param_1 + 9;
      CFmtStrN<256>::sprintf
                ((CFmtStrN<256> *)&local_12c,"  Bonus countdown: %2d seconds remaining.",iVar4);
      AddDebugTextLine(0.01,0.0,param_1 + 8,local_127,0xff,0xff,0,0xff,0.01023);
    }
    iVar4 = *(int *)this;
    param_1 = local_134 + 1;
  }
  if (iVar4 != 5) {
    if (iVar4 == 3) {
      CFmtStrN<256>::sprintf
                ((CFmtStrN<256> *)&local_12c,"PANIC EVENT - CUSTOM (%c)",(int)(char)this[0xf0]);
      iVar4 = *(int *)this;
    }
    if (iVar4 - 2U < 3) {
      CFmtStrN<256>::sprintf
                ((CFmtStrN<256> *)&local_12c,"FINALE - CUSTOM (%c)",(int)(char)this[0xf0]);
    }
    else if (iVar4 == 1) {
      CFmtStrN<256>::sprintf((CFmtStrN<256> *)&local_12c,"FINALE - GAUNTLET");
    }
    else {
      CFmtStrN<256>::sprintf((CFmtStrN<256> *)&local_12c,"FINALE - STANDARD");
    }
    iVar4 = param_1 + 1;
    AddDebugTextLine(0.01,0.0,param_1,local_127,0,0xff,0,0xff,0.01023);
    switch(*(int *)(this + 4)) {
    case 7:
      fVar9 = *(float *)(this + 0x134);
      lVar7 = (longdouble)CountdownTimer::Now();
      iVar6 = (int)(fVar9 - (float)lVar7);
      if ((float)iVar6 < fVar9 - (float)lVar7) {
        iVar6 = iVar6 + 1;
      }
      CFmtStrN<256>::sprintf
                ((CFmtStrN<256> *)&local_12c,"  stage #%d: %s (%d waves remaining, timer at %d)",
                 *(undefined4 *)(this + 0xe8),
                 *(undefined4 *)(DrawDebugNonVirtual(int)::stageName + *(int *)(this + 4) * 4),
                 *(int *)(this + 0x13c) - *(int *)(this + 0x138),iVar6);
      break;
    case 8:
      CFmtStrN<256>::sprintf
                ((CFmtStrN<256> *)&local_12c,"  stage #%d: %s (%d tanks active)",
                 *(undefined4 *)(this + 0xe8),"CUSTOM_TANK",*(undefined4 *)(TheDirector + 0x1c0));
      break;
    case 9:
      fVar9 = *(float *)(this + 0x10c);
      lVar7 = (longdouble)CountdownTimer::Now();
      iVar6 = (int)(fVar9 - (float)lVar7);
      if ((float)iVar6 < fVar9 - (float)lVar7) {
        iVar6 = iVar6 + 1;
      }
      CFmtStrN<256>::sprintf
                ((CFmtStrN<256> *)&local_12c,
                 "  stage #%d: %s (scripted, at least %d seconds remaining)",
                 *(undefined4 *)(this + 0xe8),
                 *(undefined4 *)(DrawDebugNonVirtual(int)::stageName + *(int *)(this + 4) * 4),iVar6
                );
      break;
    case 10:
      fVar9 = *(float *)(this + 0x98);
      lVar7 = (longdouble)CountdownTimer::Now();
      iVar6 = (int)(fVar9 - (float)lVar7);
      if ((float)iVar6 < fVar9 - (float)lVar7) {
        iVar6 = iVar6 + 1;
      }
      CFmtStrN<256>::sprintf
                ((CFmtStrN<256> *)&local_12c,"  stage #%d: %s (%d seconds remaining)",
                 *(undefined4 *)(this + 0xe8),
                 *(undefined4 *)(DrawDebugNonVirtual(int)::stageName + *(int *)(this + 4) * 4),iVar6
                );
      break;
    case 0xb:
      fVar9 = *(float *)(this + 0x124);
      lVar7 = (longdouble)CountdownTimer::Now();
      iVar6 = (int)(fVar9 - (float)lVar7);
      if ((float)iVar6 < fVar9 - (float)lVar7) {
        iVar6 = iVar6 + 1;
      }
      CFmtStrN<256>::sprintf
                ((CFmtStrN<256> *)&local_12c," stage #%d: %s (%d common/%d special, timer at %d)",
                 *(undefined4 *)(this + 0xe8),
                 *(undefined4 *)(DrawDebugNonVirtual(int)::stageName + *(int *)(this + 4) * 4),
                 *(undefined4 *)(this + 0x114),*(undefined4 *)(this + 0x118),iVar6);
      break;
    default:
      CFmtStrN<256>::sprintf
                ((CFmtStrN<256> *)&local_12c,"  stage: %s",
                 *(undefined4 *)(DrawDebugNonVirtual(int)::stageName + *(int *)(this + 4) * 4));
      break;
    case 0x11:
      if (*(int *)(TheDirector + 0x1c0) < 1) {
        fVar9 = *(float *)(this + 0xfc);
        lVar7 = (longdouble)CountdownTimer::Now();
        iVar6 = (int)(fVar9 - (float)lVar7);
        if ((float)iVar6 < fVar9 - (float)lVar7) {
          iVar6 = iVar6 + 1;
        }
        CFmtStrN<256>::sprintf
                  ((CFmtStrN<256> *)&local_12c,"  escape stage: %s - %ds until next tank.",
                   *(undefined4 *)(DrawDebugNonVirtual(int)::stageName + *(int *)(this + 4) * 4),
                   iVar6);
      }
      else {
        CFmtStrN<256>::sprintf((CFmtStrN<256> *)&local_12c,"  escape stage: %s","GAUNTLET_ESCAPE");
      }
    }
    param_1 = param_1 + 2;
    AddDebugTextLine(0.01,0.0,iVar4,local_127,0xff,0xff,0,0xff,0.01023);
  }
  if (*(int *)(this + 0x128) != 4) {
    AddDebugTextLine(0.01,0.0,param_1,"PANIC EVENT",0xff,0xff,0xff,0xff,0.01023);
    CFmtStrN<256>::sprintf
              ((CFmtStrN<256> *)&local_12c,"  stage: %s",
               *(undefined4 *)(DrawDebugNonVirtual(int)::stageName + *(int *)(this + 0x128) * 4));
    iVar4 = param_1 + 1;
    iVar6 = param_1 + 2;
    param_1 = param_1 + 3;
    AddDebugTextLine(0.01,0.0,iVar4,local_127,0xff,0xff,0,0xff,0.01023);
    CFmtStrN<256>::sprintf
              ((CFmtStrN<256> *)&local_12c,"  wave: %d (of %d total)",*(undefined4 *)(this + 0x138),
               *(undefined4 *)(this + 0x13c));
    AddDebugTextLine(0.01,0.0,iVar6,local_127,0xff,0xff,0,0xff,0.01023);
  }
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return param_1;
}

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)