L L4D2node

CWorld::Precache

0x00b60dc0 · 937 bytes · __thiscall

_ZN6CWorld8PrecacheEv

Decompiled

undefined (1 param)

/* CWorld::Precache() */

void __thiscall CWorld::Precache(CWorld *this)

{
  CBaseEdict *this_00;
  CBaseEntity *this_01;
  int iVar1;
  uint uVar2;
  int iVar3;
  char *pcVar4;
  undefined1 local_3c [12];
  char *local_30;
  int *local_2c [2];
  int *local_24 [5];
  
  COM_TimestampedLog("CWorld::Precache - Start");
  g_fGameOver = 0;
  g_WorldEntity = this;
  g_pLastSpawn = 0;
  ConVar::SetValue(0xf7aec0);
  ConVarRef::ConVarRef((ConVarRef *)local_2c,"sv_stepsize");
  (**(code **)(*local_2c[0] + 8))(local_2c[0],0x12);
  ConVarRef::ConVarRef((ConVarRef *)local_24,"room_type");
  (**(code **)(*local_24[0] + 8))(local_24[0],0);
  if (g_pGameRules != (int *)0x0) {
    (**(code **)(*g_pGameRules + 0x34))(g_pGameRules);
  }
  InstallGameRules();
  (**(code **)(*g_pGameRules + 4))(g_pGameRules);
  CSoundEnt::InitSoundEnt();
  ActivityList_Free();
  ActivityList_RegisterSharedActivities();
  RegisterTerrorActivities();
  EventList_Free();
  EventList_RegisterSharedEvents();
  CBaseEntity::SetAllowPrecache(true);
  COM_TimestampedLog("IGameSystem::LevelInitPreEntityAllSystems");
  (**(code **)(*(int *)this + 0x20))(&local_30,this);
  pcVar4 = "";
  if (local_30 != (char *)0x0) {
    pcVar4 = local_30;
  }
  IGameSystem::LevelInitPreEntityAllSystems(pcVar4);
  COM_TimestampedLog("InitScripts()");
  (**(code **)(*g_pGameRules + 0x1e0))(g_pGameRules);
  COM_TimestampedLog("g_pGameRules->CreateStandardEntities()");
  (**(code **)(*g_pGameRules + 0x1e4))(g_pGameRules);
  COM_TimestampedLog("InitBodyQue()");
  InitBodyQue();
  COM_TimestampedLog("SENTENCEG_Init()");
  SENTENCEG_Init();
  COM_TimestampedLog("PrecacheStandardParticleSystems()");
  PrecacheStandardParticleSystems();
  COM_TimestampedLog("W_Precache()");
  W_Precache();
  COM_TimestampedLog("ClientPrecache()");
  ClientPrecache();
  COM_TimestampedLog("PrecacheTempEnts()");
  CBaseTempEntity::PrecacheTempEnts();
  COM_TimestampedLog("LightStyles");
  iVar1 = 0;
  do {
    iVar3 = iVar1 + 1;
    (**(code **)(*engine + 0xa0))(engine,iVar1,(&g_DefaultLightstyles)[iVar1]);
    iVar1 = iVar3;
  } while (iVar3 != 0xd);
  (**(code **)(*engine + 0xa0))(engine,0x3f,&DAT_00c908f8);
  Music::PrecacheMusic();
  COM_TimestampedLog("InitDefaultAIRelationships");
  (**(code **)(*g_pGameRules + 0x188))(g_pGameRules);
  COM_TimestampedLog("InitInteractionSystem");
  CBaseCombatCharacter::InitInteractionSystem();
  COM_TimestampedLog("g_pGameRules->Precache");
  (**(code **)(*g_pGameRules + 0xa4))(g_pGameRules);
  if (*(int *)(this + 0x440) != 0) {
    DevMsg(2,"Chapter title: %s\n",*(int *)(this + 0x440));
    this_01 = (CBaseEntity *)
              CBaseEntity::Create("env_message",(Vector *)&vec3_origin,(QAngle *)&vec3_angle,
                                  (CBaseEntity *)0x0);
    if (this_01 != (CBaseEntity *)0x0) {
      *(undefined4 *)(this_01 + 0x440) = *(undefined4 *)(this + 0x440);
      *(undefined4 *)(this + 0x440) = 0;
      uVar2 = *(uint *)(this_01 + 0x148) | 1;
      if (*(uint *)(this_01 + 0x148) != uVar2) {
        if (this_01[0x6c] == (CBaseEntity)0x0) {
          this_00 = *(CBaseEdict **)(this_01 + 0x30);
          if (this_00 != (CBaseEdict *)0x0) {
            *(uint *)this_00 = *(uint *)this_00 | 0x101;
            iVar1 = CBaseEdict::GetChangeAccessor(this_00);
            *(undefined2 *)(iVar1 + 2) = 0;
          }
          *(uint *)(this_01 + 0x148) = uVar2;
        }
        else {
          this_01[0x70] = (CBaseEntity)((byte)this_01[0x70] | 1);
          *(uint *)(this_01 + 0x148) = uVar2;
        }
      }
      CBaseEntity::ThinkSet
                ((_func_void *)local_3c,(float)this_01,(char *)CBaseEntity::SUB_CallUseToggle);
      CBaseEntity::SetNextThink(this_01,*(float *)(gpGlobals + 0xc) + 1.0,(char *)0x0);
    }
  }
  pcVar4 = "func_brush";
  AllocPooledString((char *)&local_30);
  g_iszFuncBrushClassname = local_30;
  if (*(char **)(this + 0x470) != (char *)0x0) {
    PrecacheMaterial(*(char **)(this + 0x470));
  }
  COM_TimestampedLog("CWorld::Precache - Finish",pcVar4);
  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)