L L4D2node

CDirector::IsClassAllowed

0x0087a850 · 553 bytes · __thiscall

_ZNK9CDirector14IsClassAllowedE15ZombieClassType

Decompiled

undefined (2 params)

/* CDirector::IsClassAllowed(ZombieClassType) const */

uint __thiscall CDirector::IsClassAllowed(CDirector *this,int param_2)

{
  char cVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  uint uVar5;
  int iVar6;
  longdouble lVar7;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54;
  int aiStack_50 [6];
  undefined4 auStack_38 [6];
  undefined1 local_20;
  
  if (param_2 == 0) {
    return 1;
  }
  if (((1 < param_2 - 7U) || (cVar1 = AreBossesProhibited(this), cVar1 == '\0')) &&
     ((cVar1 = CTerrorGameRules::IsSurvivalMode(), cVar1 == '\0' || (param_2 != 7)))) {
    uVar4 = param_2 - 1;
    if (5 < uVar4) {
      if ((**(int **)(this + 0x638) == 5) && (**(char **)(this + 0x640) == '\0')) {
        if (param_2 == 7) {
          uVar4 = IsInCommentaryMode();
          return uVar4 ^ 1;
        }
        if (param_2 == 8) {
          if (*(float *)(this + 0x174) <= 0.0) {
            return 0;
          }
          lVar7 = (longdouble)CountdownTimer::Now();
          if ((float)lVar7 < *(float *)(this + 0x174)) {
            return 0;
          }
          iVar3 = GetTankLimit(this);
          if (iVar3 == -1) {
            iVar3 = 1;
          }
          cVar1 = IsInCommentaryMode();
          if (cVar1 != '\0') {
            return 0;
          }
          if (iVar3 <= *(int *)(this + 0x1c0)) {
            return 0;
          }
        }
      }
      return 1;
    }
    iVar3 = (**(code **)(*(int *)this + 0x70))(this,param_2);
    iVar3 = GetScriptValue(this,*(char **)(IsClassAllowed(ZombieClassType)::
                                           specialLimitScriptEntries + uVar4 * 4),iVar3);
    if ((iVar3 != 0) &&
       (((**(char **)(this + 0x648) == '\0' ||
         (iVar2 = GetScriptValue(this,*(char **)(IsClassAllowed(ZombieClassType)::
                                                 specialTotalScriptEntries + uVar4 * 4),0),
         iVar2 == 0)) || (*(int *)(TheZombieManager + 0x4c + param_2 * 4) < iVar2)))) {
      local_5c = 0;
      uVar5 = 0;
      local_58 = 0;
      local_54 = 0;
      local_20 = 0;
      do {
        *(undefined4 *)((int)aiStack_50 + uVar5) = 0;
        uVar5 = uVar5 + 4;
      } while (uVar5 < 0x18);
      uVar5 = 0;
      do {
        *(undefined4 *)((int)auStack_38 + uVar5) = 0;
        uVar5 = uVar5 + 4;
      } while (uVar5 < 0x18);
      ForEachTerrorPlayer<ZombieCounter>((ZombieCounter *)&local_5c);
      if (CSWTCH_3505[param_2 + 0xf] != '\0') {
        iVar2 = 0;
        iVar6 = 0;
        do {
          if ((&IsClassAllowed(ZombieClassType)::isDominator)[iVar2] != '\0') {
            iVar6 = iVar6 + (uint)(0 < aiStack_50[iVar2]);
          }
          iVar2 = iVar2 + 1;
        } while (iVar2 != 6);
        iVar2 = (**(code **)(*(int *)this + 0x74))(this);
        if (iVar2 < iVar6) {
          return 0;
        }
      }
      return CONCAT31((int3)(uVar4 >> 8),aiStack_50[uVar4] < iVar3);
    }
  }
  return 0;
}

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)