L L4D2node

CInfectedZooMaker::PerformSpawnModel

0x008d1f00 · 924 bytes · __thiscall

_ZN17CInfectedZooMaker17PerformSpawnModelEPKciRi

Decompiled

undefined (4 params)

/* CInfectedZooMaker::PerformSpawnModel(char const*, int, int&) */

int __thiscall
CInfectedZooMaker::PerformSpawnModel(CInfectedZooMaker *this,char *param_1,int param_2,int *param_3)

{
  char *pcVar1;
  undefined1 *puVar2;
  CBaseEntity *this_00;
  int iVar3;
  int iVar4;
  int in_GS_OFFSET;
  undefined1 *local_170;
  float local_16c;
  float local_168;
  undefined4 local_164;
  undefined4 local_160;
  undefined4 local_15c;
  undefined4 local_158;
  int local_154;
  int local_150;
  int local_14c;
  int local_148;
  int local_144;
  int local_140;
  int local_13c;
  int local_138;
  int local_134;
  int local_130;
  CFmtStrN<256> local_12c [268];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pcVar1 = "FCVAR_NEVER_AS_STRING";
  if ((sv_zoo_model_filter[0x15] & 0x10) == 0) {
    pcVar1 = "";
    if (*(char **)(sv_zoo_model_filter._28_4_ + 0x24) != (char *)0x0) {
      pcVar1 = *(char **)(sv_zoo_model_filter._28_4_ + 0x24);
    }
  }
  if (*pcVar1 != '\0') {
    pcVar1 = strstr(param_1,pcVar1);
    if (pcVar1 == (char *)0x0) {
      iVar3 = 0;
      goto LAB_008d220d;
    }
  }
  CFmtStrN<256>::CFmtStrN(local_12c,"models/infected/%s.mdl",param_1);
  AllocPooledString((char *)&local_170);
  puVar2 = local_170;
  if (local_170 == (undefined1 *)0x0) {
    puVar2 = &DAT_00d539c2;
  }
  iVar3 = 0;
  Msg("[Zoo] Spawning `%s`...\n",puVar2);
  local_168 = 0.0;
  local_164 = 0;
  local_154 = 0;
  local_150 = 0;
  local_14c = 0;
  local_16c = (float)*param_3;
  local_148 = 0;
  local_144 = 0;
  local_140 = 0;
  local_160 = vec3_angle;
  local_13c = 0;
  local_138 = 0;
  local_134 = 0;
  local_15c = DAT_01053d40;
  local_130 = 0;
  local_158 = DAT_01053d44;
  s_pVariations = &local_154;
  s_pCreatePuppet = &local_140;
  EnableManualSpawnOverride();
  iVar4 = *s_pCreatePuppet;
  while( true ) {
    iVar3 = iVar3 + 1;
    this_00 = (CBaseEntity *)CreateEntityByName("info_infected_zoo_puppet",-1,true);
    if (this_00 == (CBaseEntity *)0x0) break;
    CBaseEntity::SetAbsAngles(this_00,(QAngle *)&local_160);
    CBaseEntity::SetAbsOrigin(this_00,(Vector *)&local_16c);
    (**(code **)(*(int *)this_00 + 0x70))(this_00,puVar2);
    DispatchSpawn(this_00,true);
    s_pVariations = (int *)0x0;
    local_13c = local_13c + 1;
    if (local_150 <= local_13c) {
      local_13c = 0;
    }
    local_138 = local_138 + 1;
    if (local_14c <= local_138) {
      local_138 = 0;
      local_134 = local_134 + 1;
      if (local_148 <= local_134) {
        local_134 = 0;
        local_130 = local_130 + 1;
        if (local_144 <= local_130) {
          local_130 = 0;
          local_140 = local_140 + 4;
          if (local_154 <= local_140) {
            local_140 = 0;
            break;
          }
        }
      }
    }
    local_168 = local_168 + *(float *)(sv_zoo_spacing._28_4_ + 0x2c);
    if (*(int *)(sv_zoo_wrap_skin._28_4_ + 0x30) == 0) {
      iVar4 = *s_pCreatePuppet;
    }
    else if (*s_pCreatePuppet != iVar4) {
      local_168 = 0.0;
      local_16c = local_16c + *(float *)(sv_zoo_spacing_wrap._28_4_ + 0x2c);
      iVar4 = *s_pCreatePuppet;
    }
  }
  DisableManualSpawnOverride();
  Msg("[Zoo] `%s` spawned %d variations.\n",puVar2,iVar3);
  s_pVariations = (int *)0x0;
  s_pCreatePuppet = (int *)0x0;
  *param_3 = (int)(*(float *)(sv_zoo_spacing_rows._28_4_ + 0x2c) + local_16c);
LAB_008d220d:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return iVar3;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)