L L4D2node

CInfectedZooPuppet::Spawn

0x008d2670 · 936 bytes · __thiscall

_ZN18CInfectedZooPuppet5SpawnEv

Decompiled

undefined (1 param)

/* CInfectedZooPuppet::Spawn() */

void __thiscall CInfectedZooPuppet::Spawn(CInfectedZooPuppet *this)

{
  CInfectedZooPuppet *pCVar1;
  CBaseEdict *pCVar2;
  CInfectedZooPuppet CVar3;
  undefined4 *puVar4;
  int *piVar5;
  int iVar6;
  int iVar7;
  undefined4 uVar8;
  char *__s;
  CInfectedZooPuppet CVar9;
  int *piVar10;
  int iVar11;
  CInfectedZooPuppet CVar12;
  CInfectedZooPuppet local_45;
  int local_3c;
  char *local_38 [3];
  CInfectedZooPuppet local_2c [4];
  CInfectedZooPuppet local_28 [4];
  CInfectedZooPuppet local_24 [4];
  CInfectedZooPuppet local_20 [16];
  
  Infected::Spawn((Infected *)this);
  piVar5 = mdlcache;
  (**(code **)(*mdlcache + 0x68))(mdlcache);
  piVar10 = *(int **)(this + 0x13e0);
  if (piVar10 == (int *)0x0) {
    iVar6 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar6 != 0) {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
    }
    piVar10 = *(int **)(this + 0x13e0);
    if (piVar10 == (int *)0x0) goto LAB_008d2a1a;
  }
  if (*piVar10 == 0) {
LAB_008d2a1a:
    (**(code **)(*piVar5 + 0x6c))(piVar5);
    return;
  }
                    /* try { // try from 008d26b4 to 008d2851 has its CatchHandler @ 008d2a49 */
  iVar6 = InfectedRandomColorArray(&local_3c);
  puVar4 = s_pVariations;
  local_38[0] = "Head";
  local_38[1] = "UpperBody";
  local_38[2] = "LowerBody";
  if (s_pVariations != (undefined4 *)0x0) {
    iVar11 = 0;
    uVar8 = *(undefined4 *)(*piVar10 + 0xe0);
    s_pVariations[2] = 0;
    puVar4[3] = 0;
    puVar4[4] = 0;
    *puVar4 = uVar8;
    puVar4[1] = local_3c;
    iVar7 = CBaseAnimating::FindBodygroupByName((CBaseAnimating *)this,"Head");
    while( true ) {
      puVar4 = s_pVariations;
      if (-1 < iVar7) {
        uVar8 = CBaseAnimating::CountBodyGroupVariants((CBaseAnimating *)this,iVar7);
        puVar4[iVar11 + 2] = uVar8;
      }
      iVar11 = iVar11 + 1;
      if (iVar11 == 3) break;
      iVar7 = CBaseAnimating::FindBodygroupByName((CBaseAnimating *)this,local_38[iVar11]);
    }
  }
  if (s_pCreatePuppet == (int *)0x0) goto LAB_008d2880;
  iVar7 = *s_pCreatePuppet;
  if (iVar7 != *(int *)(this + 0x458)) {
    if (this[0x6c] == (CInfectedZooPuppet)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar11 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar11 + 2) = 0;
      }
      *(int *)(this + 0x458) = iVar7;
    }
    else {
      this[0x70] = (CInfectedZooPuppet)((byte)this[0x70] | 1);
      *(int *)(this + 0x458) = iVar7;
    }
  }
  if (*(int *)(sv_zoo_tint_loop._28_4_ + 0x30) == 0) {
    __s = "FCVAR_NEVER_AS_STRING";
    if ((sv_zoo_tint_clr[0x15] & 0x10) == 0) {
      __s = "";
      if (*(char **)(sv_zoo_tint_clr._28_4_ + 0x24) != (char *)0x0) {
        __s = *(char **)(sv_zoo_tint_clr._28_4_ + 0x24);
      }
    }
    iVar6 = sscanf(__s,"%d %d %d %d",local_2c,local_28,local_24,local_20);
    if (iVar6 < 1) {
      local_2c[0] = (CInfectedZooPuppet)0xff;
LAB_008d2955:
      local_28[0] = (CInfectedZooPuppet)0xff;
LAB_008d295a:
      local_45 = (CInfectedZooPuppet)0xff;
      CVar3 = (CInfectedZooPuppet)0xff;
      CVar12 = local_28[0];
      CVar9 = local_2c[0];
      if (local_2c[0] == this[0x124]) {
LAB_008d296e:
        CVar12 = local_28[0];
        CVar9 = local_2c[0];
        if (((local_28[0] == this[0x125]) && (CVar3 == this[0x126])) && (local_45 == this[0x127]))
        goto LAB_008d28e2;
      }
    }
    else {
      if (iVar6 == 1) goto LAB_008d2955;
      if (iVar6 == 2) goto LAB_008d295a;
      if (iVar6 == 3) {
        local_45 = (CInfectedZooPuppet)0xff;
      }
      else {
        local_45 = local_20[0];
      }
      CVar12 = local_28[0];
      CVar9 = local_2c[0];
      CVar3 = local_24[0];
      if (local_2c[0] == this[0x124]) goto LAB_008d296e;
    }
    if (this[0x6c] == (CInfectedZooPuppet)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar6 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CInfectedZooPuppet)((byte)this[0x70] | 1);
    }
    this[0x124] = CVar9;
    this[0x125] = CVar12;
    this[0x126] = CVar3;
    this[0x127] = local_45;
  }
  else {
    pCVar1 = (CInfectedZooPuppet *)(iVar6 + s_pCreatePuppet[1] * 4);
    if ((((this[0x124] != *pCVar1) || (this[0x125] != pCVar1[1])) || (this[0x126] != pCVar1[2])) ||
       (this[0x127] != pCVar1[3])) {
      if (this[0x6c] == (CInfectedZooPuppet)0x0) {
        pCVar2 = *(CBaseEdict **)(this + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
                    /* try { // try from 008d28cf to 008d2a0b has its CatchHandler @ 008d2a49 */
          iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CInfectedZooPuppet)((byte)this[0x70] | 1);
      }
      *(undefined4 *)(this + 0x124) = *(undefined4 *)pCVar1;
    }
  }
LAB_008d28e2:
  iVar7 = 0;
  iVar6 = CBaseAnimating::FindBodygroupByName((CBaseAnimating *)this,"Head");
  while( true ) {
    if ((-1 < iVar6) &&
       (iVar11 = CBaseAnimating::FindBodyGroupVariant
                           ((CBaseAnimating *)this,iVar6,s_pCreatePuppet[iVar7 + 2] + 1),
       -1 < iVar11)) {
      CBaseAnimating::SetBodygroup((CBaseAnimating *)this,iVar6,iVar11);
    }
    iVar7 = iVar7 + 1;
    if (iVar7 == 3) break;
    iVar6 = CBaseAnimating::FindBodygroupByName((CBaseAnimating *)this,local_38[iVar7]);
  }
LAB_008d2880:
  (**(code **)(*piVar5 + 0x6c))(piVar5);
  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)