L L4D2node

SpawnBackgroundZombies

0x00976320 · 397 bytes · __cdecl

_Z22SpawnBackgroundZombiesib

Decompiled

undefined (2 params)

/* SpawnBackgroundZombies(int, bool) */

void SpawnBackgroundZombies(int param_1,bool param_2)

{
  int iVar1;
  int *piVar2;
  int iVar3;
  longdouble lVar4;
  float fVar5;
  float local_34;
  undefined1 local_28 [24];
  
  if (DAT_00fe6000 < 1) {
    local_34 = 0.0;
  }
  else {
    local_34 = 0.0;
    piVar2 = TheNavAreas;
    do {
      while (iVar3 = *piVar2, param_2 == ((*(uint *)(iVar3 + 300) & 0x802) != 0)) {
        piVar2 = piVar2 + 1;
        local_34 = (*(float *)(iVar3 + 0x14) - *(float *)(iVar3 + 8)) *
                   (*(float *)(iVar3 + 0x10) - *(float *)(iVar3 + 4)) + local_34;
        if (piVar2 == TheNavAreas + DAT_00fe6000) goto LAB_00976393;
      }
      piVar2 = piVar2 + 1;
    } while (piVar2 != TheNavAreas + DAT_00fe6000);
  }
LAB_00976393:
  if (param_1 != 0) {
    while (iVar3 = CDirectorTacticalServices::GetCommonInfectedCount
                             (*(CDirectorTacticalServices **)(TheDirector + 0x628),0),
          iVar3 < *(int *)(ZombieBackgroundLimit._28_4_ + 0x30)) {
      lVar4 = (longdouble)RandomFloat(0,local_34);
      fVar5 = (float)lVar4;
      if (DAT_00fe6000 < 1) {
        return;
      }
      iVar3 = 0;
      do {
        iVar1 = TheNavAreas[iVar3];
        if ((param_2 == ((*(uint *)(iVar1 + 300) & 0x802) != 0)) &&
           (fVar5 = fVar5 - (*(float *)(iVar1 + 0x14) - *(float *)(iVar1 + 8)) *
                            (*(float *)(iVar1 + 0x10) - *(float *)(iVar1 + 4)), fVar5 <= 0.0))
        goto LAB_00976458;
        iVar3 = iVar3 + 1;
      } while (iVar3 != DAT_00fe6000);
      if (0.0 < fVar5) {
        return;
      }
LAB_00976458:
      TerrorNavArea::FindRandomSpot();
      iVar3 = ZombieManager::SpawnCommonZombie(TheZombieManager,iVar1,local_28,0);
      param_1 = param_1 + -1 + (uint)(iVar3 == 0);
      if (param_1 == 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)