L L4D2node

Infected::Precache

0x00a14f90 · 1311 bytes · __thiscall

_ZN8Infected8PrecacheEv

Decompiled

undefined (1 param)

/* Infected::Precache() */

void __thiscall Infected::Precache(Infected *this)

{
  void *pvVar1;
  char cVar2;
  KeyValues *pKVar3;
  KeyValues *this_00;
  undefined4 uVar4;
  int iVar5;
  int iVar6;
  char *pcVar7;
  int in_GS_OFFSET;
  int **local_154;
  char *local_150 [3];
  char *local_144;
  int *local_140;
  undefined4 local_13c;
  undefined4 local_138;
  int local_134;
  undefined4 local_130;
  CFmtStrN<256> local_12c [5];
  char local_127 [263];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  CBaseCombatCharacter::Precache((CBaseCombatCharacter *)this);
  if (*(int *)(this + 0xfc) != 0) goto LAB_00a153a3;
  iVar6 = 0;
  if (0 < DAT_01024564) {
    do {
      if ((void *)CommonInfectedModels[iVar6] != (void *)0x0) {
        operator_delete__((void *)CommonInfectedModels[iVar6]);
      }
      iVar6 = iVar6 + 1;
    } while (iVar6 < DAT_01024564);
  }
  iVar6 = 0;
  DAT_01024564 = 0;
  if (0 < DAT_01024550) {
    do {
      pvVar1 = *(void **)(LowViolenceInfectedModels + iVar6 * 4);
      if (pvVar1 != (void *)0x0) {
        operator_delete__(pvVar1);
      }
      iVar6 = iVar6 + 1;
    } while (iVar6 < DAT_01024550);
  }
  DAT_01024550 = 0;
  PrecacheInfectedModels
            ((CBaseAnimating *)this,(CUtlVector *)&CommonInfectedModels,
             (CUtlVector *)&LowViolenceInfectedModels);
  if (DAT_01024550 == 0) {
    local_140 = (int *)CloneString("models/infected/common_male_tshirt_cargos.mdl");
    CUtlVector<char_const*,CUtlMemory<char_const*,int>>::InsertBefore
              ((CUtlVector<char_const*,CUtlMemory<char_const*,int>> *)&LowViolenceInfectedModels,
               DAT_01024550,(char **)&local_140);
    if (DAT_01024564 == 0) {
LAB_00a15499:
      local_154 = &local_140;
      local_140 = (int *)CloneString("models/infected/common_male_tshirt_cargos.mdl");
      CUtlVector<char_const*,CUtlMemory<char_const*,int>>::InsertBefore
                ((CUtlVector<char_const*,CUtlMemory<char_const*,int>> *)&CommonInfectedModels,
                 DAT_01024564,(char **)local_154);
    }
    CBaseEntity::PrecacheModel("models/infected/common_male_tshirt_cargos.mdl");
  }
  else if (DAT_01024564 == 0) goto LAB_00a15499;
  cVar2 = CDirector::IsBackgroundMap();
  if (cVar2 == '\0') {
    pcVar7 = "";
    if (*(char **)(gpGlobals + 0x3c) != (char *)0x0) {
      pcVar7 = *(char **)(gpGlobals + 0x3c);
    }
    iVar6 = V_stristr(pcVar7,"background");
    if (iVar6 != 0) goto LAB_00a150db;
  }
  else {
LAB_00a150db:
    pKVar3 = (KeyValues *)CDirector::GetPopulationData(TheDirector);
    local_140 = (int *)0x0;
    local_13c = 0;
    local_138 = 0;
    local_134 = 0;
    local_130 = 0;
                    /* try { // try from 00a15129 to 00a151f4 has its CatchHandler @ 00a15467 */
    pKVar3 = (KeyValues *)KeyValues::GetFirstTrueSubKey(pKVar3);
    for (; pKVar3 != (KeyValues *)0x0; pKVar3 = (KeyValues *)KeyValues::GetNextTrueSubKey(pKVar3)) {
      for (this_00 = (KeyValues *)KeyValues::GetFirstValue(pKVar3); this_00 != (KeyValues *)0x0;
          this_00 = (KeyValues *)KeyValues::GetNextValue(this_00)) {
        uVar4 = KeyValues::GetName(this_00);
        CFmtStrN<256>::CFmtStrN(local_12c,"models/infected/%s.mdl",uVar4);
        if (DAT_01024564 < 1) {
LAB_00a153c0:
          if (local_134 < 1) {
LAB_00a1540d:
            AllocPooledString((char *)local_150);
            local_144 = "";
            if (local_150[0] != (char *)0x0) {
              local_144 = local_150[0];
            }
            CUtlVector<char_const*,CUtlMemory<char_const*,int>>::InsertBefore
                      ((CUtlVector<char_const*,CUtlMemory<char_const*,int>> *)&local_140,local_134,
                       &local_144);
            CBaseEntity::PrecacheModel(local_127);
          }
          else {
            iVar6 = 0;
            pcVar7 = (char *)*local_140;
                    /* try { // try from 00a153e3 to 00a15461 has its CatchHandler @ 00a15467 */
            while ((pcVar7 != local_127 && (iVar5 = _V_stricmp(pcVar7,local_127), iVar5 != 0))) {
              iVar6 = iVar6 + 1;
              if (local_134 <= iVar6) goto LAB_00a1540d;
              pcVar7 = (char *)local_140[iVar6];
            }
          }
        }
        else {
          iVar6 = 0;
          pcVar7 = (char *)*CommonInfectedModels;
          while ((pcVar7 != local_127 && (iVar5 = _V_stricmp(pcVar7,local_127), iVar5 != 0))) {
            iVar6 = iVar6 + 1;
            if (DAT_01024564 <= iVar6) goto LAB_00a153c0;
            pcVar7 = (char *)CommonInfectedModels[iVar6];
          }
        }
      }
    }
    CUtlVector<char_const*,CUtlMemory<char_const*,int>>::~CUtlVector
              ((CUtlVector<char_const*,CUtlMemory<char_const*,int>> *)&local_140);
  }
  pcVar7 = s_models_infected_cim_fallen_survi_00f1c700;
  CBaseEntity::PrecacheModel("models/infected/gibs/gibs.mdl");
  do {
    if (*pcVar7 != '\0') {
      CBaseEntity::PrecacheModel(pcVar7);
    }
    pcVar7 = pcVar7 + 0x184;
  } while (pcVar7 != DataMapInit<CTransitioningPlayer>(CTransitioningPlayer*)::dataDesc + 0x70);
  CBaseEntity::PrecacheScriptSound("Zombie.Sleeping");
  CBaseEntity::PrecacheScriptSound("Zombie.Wander");
  CBaseEntity::PrecacheScriptSound("Zombie.BecomeEnraged");
  CBaseEntity::PrecacheScriptSound("Zombie.Rage");
  CBaseEntity::PrecacheScriptSound("Zombie.RageAtVictim");
  CBaseEntity::PrecacheScriptSound("Zombie.BecomeAlert");
  CBaseEntity::PrecacheScriptSound("Zombie.Alert");
  CBaseEntity::PrecacheScriptSound("Zombie.Shoved");
  CBaseEntity::PrecacheScriptSound("Zombie.AttackMiss");
  CBaseEntity::PrecacheScriptSound("Zombie.ClawScrape");
  CBaseEntity::PrecacheScriptSound("Zombie.Die");
  CBaseEntity::PrecacheScriptSound("Zombie.IgniteScream");
  CBaseEntity::PrecacheScriptSound("Zombie.Shot");
  CBaseEntity::PrecacheScriptSound("Zombie.Punch");
  CBaseEntity::PrecacheScriptSound("Zombie.BulletImpact");
  CBaseEntity::PrecacheScriptSound("Zombie.HeadlessCough");
  CBaseEntity::PrecacheScriptSound("MegaMobIncoming");
  CBaseEntity::PrecacheScriptSound("Blood.Spurt");
  CBaseEntity::PrecacheScriptSound("Melee.HitHead");
  CBaseEntity::PrecacheScriptSound("Melee.HitBody");
  CBaseEntity::PrecacheScriptSound("Melee.HitLimb");
  CBaseEntity::PrecacheScriptSound("CEDA.suit.deflate");
  PrecacheParticleSystem("blood_atomized");
  PrecacheParticleSystem("blood_spray_clown");
  CBaseEntity::PrecacheScriptSound("Clown.Default.RunLeft");
  CBaseEntity::PrecacheScriptSound("Clown.Default.RunRight");
  CBaseEntity::PrecacheModel("error.mdl");
  ACT_EXP_IDLE = ActivityList_RegisterPrivateActivity("ACT_EXP_IDLE");
  ACT_EXP_ANGRY = ActivityList_RegisterPrivateActivity("ACT_EXP_ANGRY");
LAB_00a153a3:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)