L L4D2node

CTerrorPlayer::PrecacheSurvivorModels

0x009c8e20 · 1035 bytes · __thiscall

_ZN13CTerrorPlayer22PrecacheSurvivorModelsEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CTerrorPlayer::PrecacheSurvivorModels() */

void __thiscall CTerrorPlayer::PrecacheSurvivorModels(CTerrorPlayer *this)

{
  uint *puVar1;
  char cVar2;
  int iVar3;
  KeyValues *pKVar4;
  CDirector *this_00;
  char *pcVar5;
  int iVar6;
  int iVar7;
  int in_GS_OFFSET;
  CDirector *pCVar8;
  undefined4 local_144;
  undefined4 local_140;
  undefined4 local_138;
  undefined4 local_134;
  CDirector *local_130;
  CFmtStrN<256> local_12c [5];
  char local_127 [263];
  int local_20;
  
  local_144 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_140 = 0;
  if (_towlower == (CDirector *)0x0) {
    local_130 = (CDirector *)0x0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_144,0,0,0,0,"/data/src/game/server/terror/terrorplayer.cpp",0x6cd,
               &PrecacheSurvivorModels()::tm_fmt,"(%s)%s","SURVIVOR","PrecacheSurvivorModels");
    local_130 = _towlower;
  }
  iVar6 = _DAT_0105db00;
  local_138 = local_144;
  local_134 = local_140;
                    /* try { // try from 009c90de to 009c913e has its CatchHandler @ 009c9260 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar3 = ThreadGetCurrentId(), iVar6 == iVar3)) {
    if (*(char **)_DAT_0105d15c != "PrecacheSurvivorModels") {
      _DAT_0105d15c =
           (CDirector *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd13a46,(char *)0x0,0xce37cb);
    }
    puVar1 = (uint *)(_DAT_0105d1e8 + 4 + *(int *)(_DAT_0105d15c + 0x70) * 8);
    *puVar1 = *puVar1 | 4;
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 009c8ef9 to 009c9051 has its CatchHandler @ 009c923c */
  iVar3 = CTerrorGameRules::GetSurvivorSet();
  iVar6 = (uint)(iVar3 == 1) * 4 + 4;
  iVar3 = (uint)(iVar3 == 1) << 2;
  if (*(int *)(precache_all_survivors._28_4_ + 0x30) != 0) {
    iVar3 = 0;
    iVar6 = 8;
  }
  iVar7 = iVar3 * 4;
  do {
    PrecachePlayerModelAndMaterials
              ((CBaseAnimating *)this,*(char **)(SurvivorModels + iVar7),"null",(CUtlVector *)0x0);
    iVar3 = iVar3 + 1;
    iVar7 = iVar7 + 4;
  } while (iVar3 < iVar6);
  ConVar::Revert((ConVar *)ZombiePopulation);
  CNavMesh::GetPlacesFromNavFile(TheNavMesh,(bool *)0x0);
  pCVar8 = TheDirector;
  pKVar4 = (KeyValues *)CDirector::GetPopulationData(TheDirector);
  if (pKVar4 != (KeyValues *)0x0) {
    pcVar5 = "FCVAR_NEVER_AS_STRING";
    if ((ZombiePopulation[0x15] & 0x10) == 0) {
      pcVar5 = "";
      if (*(char **)(ZombiePopulation._28_4_ + 0x24) != (char *)0x0) {
        pcVar5 = *(char **)(ZombiePopulation._28_4_ + 0x24);
      }
    }
    this_00 = (CDirector *)KeyValues::FindKey(pKVar4,pcVar5,false);
    pCVar8 = (CDirector *)pKVar4;
    if (this_00 != (CDirector *)0x0) {
      for (pKVar4 = (KeyValues *)KeyValues::GetFirstSubKey((KeyValues *)this_00);
          iVar6 = _DAT_0105db00, pKVar4 != (KeyValues *)0x0;
          pKVar4 = (KeyValues *)KeyValues::GetNextKey(pKVar4)) {
        pcVar5 = (char *)KeyValues::GetName(pKVar4);
        iVar6 = V_strnicmp(pcVar5,"survivor",8);
        if (iVar6 == 0) {
          CFmtStrN<256>::CFmtStrN(local_12c,"models/survivors/%s.mdl",pcVar5);
          PrecachePlayerModelAndMaterials((CBaseAnimating *)this,local_127,"null",(CUtlVector *)0x0)
          ;
        }
        this_00 = (CDirector *)pKVar4;
      }
      if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
         (iVar3 = ThreadGetCurrentId(), iVar6 == iVar3)) {
        this_00 = _DAT_0105d15c;
        cVar2 = CVProfNode::ExitScope();
        if (cVar2 != '\0') {
          _DAT_0105d15c = *(CDirector **)(_DAT_0105d15c + 100);
        }
        DAT_0105d158 = _DAT_0105d15c == (CDirector *)0x105d160;
      }
      if (local_130 != (CDirector *)0x0) {
        this_00 = local_130;
        (**(code **)(local_130 + 0x54))(local_130,local_138,local_134,0,0,0);
      }
      goto LAB_009c90ba;
    }
  }
  this_00 = pCVar8;
  iVar6 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar3 = ThreadGetCurrentId(), iVar6 == iVar3)) {
    this_00 = _DAT_0105d15c;
    cVar2 = CVProfNode::ExitScope();
    if (cVar2 != '\0') {
      _DAT_0105d15c = *(CDirector **)(_DAT_0105d15c + 100);
    }
    DAT_0105d158 = _DAT_0105d15c == (CDirector *)0x105d160;
  }
  if (local_130 != (CDirector *)0x0) {
    this_00 = local_130;
    (**(code **)(local_130 + 0x54))(local_130,local_138,local_134,0,0,0);
  }
LAB_009c90ba:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail(this_00);
}

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)