CModelLoader::Map_LoadModelGuts
0x0019d560 · 1696 bytes · __thiscall
_ZN12CModelLoader17Map_LoadModelGutsEP7model_t
Decompiled
undefined (2 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CModelLoader::Map_LoadModelGuts(model_t*) */
void __thiscall CModelLoader::Map_LoadModelGuts(CModelLoader *this,model_t *param_1)
{
model_t *pmVar1;
CModelLoader *pCVar2;
CModelLoader CVar3;
medge_t *pmVar4;
int iVar5;
char *pcVar6;
uint uVar7;
int in_GS_OFFSET;
CMapLoadHelper *local_284;
uint local_278;
undefined4 local_274;
undefined4 local_270;
undefined4 local_26c;
undefined4 local_268;
undefined4 local_264;
uint local_260 [3];
int local_254;
texinfo_s *local_250;
CMapLoadHelper local_140 [12];
int local_134;
int local_20;
g_nMapLoadCount = g_nMapLoadCount + 1;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
COM_TimestampedLog(" Map_CheckForHDR");
pmVar1 = param_1 + 4;
CVar3 = (CModelLoader)Map_CheckForHDR(param_1,(char *)pmVar1);
this[0x199] = CVar3;
CMapLoadHelper::CMapLoadHelper((CMapLoadHelper *)local_260,6);
if (local_260[0] != (local_260[0] / 0x48) * 0x48) {
/* try { // try from 0019dbe3 to 0019dc07 has its CatchHandler @ 0019dc60 */
Host_Error("Map_LoadModelGuts: bad LUMP_TEXINFO size in %s",pmVar1);
}
uVar7 = local_260[0] / 0x48;
if (uVar7 == 0) {
Sys_Error("Map_LoadModelGuts: Map with no texinfo, %s",pmVar1);
}
else if (0x3000 < uVar7) {
/* try { // try from 0019d61a to 0019d757 has its CatchHandler @ 0019dc60 */
Sys_Error("Map_LoadModelGuts: Map has too many surfaces, %s",pmVar1);
}
COM_TimestampedLog(" CM_LoadMap");
CM_LoadMap((char *)pmVar1,false,local_250,uVar7,&local_278);
COM_TimestampedLog(" Mod_LoadVertices");
Mod_LoadVertices();
COM_TimestampedLog(" Mod_LoadEdges");
pmVar4 = (medge_t *)Mod_LoadEdges();
COM_TimestampedLog(" Mod_LoadSurfedges");
Mod_LoadSurfedges(pmVar4);
COM_TimestampedLog(" Mod_LoadPlanes");
iVar5 = s_pMap;
*(undefined4 *)(s_pMap + 8) = DAT_00394380;
*(undefined4 *)(iVar5 + 4) = DAT_0039437c;
COM_TimestampedLog(" Mod_LoadOcclusion");
Mod_LoadOcclusion();
COM_TimestampedLog(" Mod_LoadTexdata");
iVar5 = s_pMap;
*(undefined4 *)(s_pMap + 0x60) = DAT_00394544;
*(undefined4 *)(iVar5 + 100) = DAT_0039454c;
COM_TimestampedLog(" Mod_LoadTexinfo");
Mod_LoadTexinfo((CMapLoadHelper *)local_260);
COM_TimestampedLog(" Mod_LoadLighting");
iVar5 = (**(code **)(*g_pMaterialSystemHardwareConfig + 0x8c))(g_pMaterialSystemHardwareConfig);
if (iVar5 == 0) {
LAB_0019db28:
/* try { // try from 0019db3f to 0019db43 has its CatchHandler @ 0019dc60 */
CMapLoadHelper::CMapLoadHelper(local_140,8);
/* try { // try from 0019db4d to 0019db51 has its CatchHandler @ 0019dcaa */
Mod_LoadLighting(local_140);
if (local_134 != 0) {
(**(code **)(*g_pFileSystem + 0x150))(g_pFileSystem,local_134);
}
}
else {
iVar5 = _DAT_003a8340;
if (_DAT_003a832c == 0) {
iVar5 = _DAT_003a8a60;
}
if (iVar5 < 1) goto LAB_0019db28;
CMapLoadHelper::CMapLoadHelper(local_140,0x35);
/* try { // try from 0019d761 to 0019d765 has its CatchHandler @ 0019dc87 */
Mod_LoadLighting(local_140);
if (local_134 != 0) {
(**(code **)(*g_pFileSystem + 0x150))(g_pFileSystem,local_134);
}
}
local_284 = local_140;
/* try { // try from 0019d78c to 0019d9ba has its CatchHandler @ 0019dc60 */
COM_TimestampedLog(" Mod_LoadPrimitives");
Mod_LoadPrimitives();
COM_TimestampedLog(" Mod_LoadPrimVerts");
Mod_LoadPrimVerts();
COM_TimestampedLog(" Mod_LoadPrimIndices");
Mod_LoadPrimIndices();
COM_TimestampedLog(" Mod_LoadFaces");
Mod_LoadFaces();
COM_TimestampedLog(" Mod_LoadVertNormals");
Mod_LoadVertNormals();
COM_TimestampedLog(" Mod_LoadVertNormalIndices");
Mod_LoadVertNormalIndices();
COM_TimestampedLog(" Mod_LoadLeafs");
Mod_LoadLeafs();
COM_TimestampedLog(" Mod_LoadMarksurfaces");
Mod_LoadMarksurfaces();
COM_TimestampedLog(" Mod_LoadNodes");
Mod_LoadNodes();
COM_TimestampedLog(" Mod_LoadLeafWaterData");
Mod_LoadLeafWaterData();
COM_TimestampedLog(" Mod_LoadLeafMinDistToWater");
Mod_LoadLeafMinDistToWater();
COM_TimestampedLog(" LUMP_CLIPPORTALVERTS");
pCVar2 = this + 0x158;
pcVar6 = (char *)va("%s [%s]",pCVar2,"clipportalverts");
Mod_LoadLump(param_1,0x29,pcVar6,0xc,(void **)(this + 0x138),(int *)(this + 0x134));
COM_TimestampedLog(" LUMP_AREAPORTALS");
pcVar6 = (char *)va("%s [%s]",pCVar2,"areaportals");
Mod_LoadLump(param_1,0x15,pcVar6,0xc,(void **)(this + 0x130),(int *)(this + 300));
COM_TimestampedLog(" LUMP_AREAS");
pcVar6 = (char *)va("%s [%s]",pCVar2,"areas");
Mod_LoadLump(param_1,0x14,pcVar6,8,(void **)(this + 0x128),(int *)(this + 0x124));
COM_TimestampedLog(" Mod_LoadWorldlights");
iVar5 = (**(code **)(*g_pMaterialSystemHardwareConfig + 0x8c))(g_pMaterialSystemHardwareConfig);
if (iVar5 != 0) {
iVar5 = _DAT_003a835c;
if (_DAT_003a8348 == 0) {
iVar5 = _DAT_003a8a70;
}
if (0 < iVar5) {
CMapLoadHelper::CMapLoadHelper(local_284,0x36);
/* try { // try from 0019d9cc to 0019d9d0 has its CatchHandler @ 0019dcd0 */
Mod_LoadWorldlights(local_284,true);
if (local_134 != 0) {
(**(code **)(*g_pFileSystem + 0x150))(g_pFileSystem,local_134);
}
goto LAB_0019d9f0;
}
}
/* try { // try from 0019db91 to 0019db95 has its CatchHandler @ 0019dc60 */
CMapLoadHelper::CMapLoadHelper(local_284,0xf);
/* try { // try from 0019dba7 to 0019dbab has its CatchHandler @ 0019dc64 */
Mod_LoadWorldlights(local_284,false);
if (local_134 != 0) {
(**(code **)(*g_pFileSystem + 0x150))(g_pFileSystem,local_134);
}
LAB_0019d9f0:
/* try { // try from 0019d9f7 to 0019da1d has its CatchHandler @ 0019dc60 */
COM_TimestampedLog(" Mod_LoadCubemapSamples");
Mod_LoadCubemapSamples();
COM_TimestampedLog(" Mod_LoadGameLumpDict");
Mod_LoadGameLumpDict();
COM_TimestampedLog(" Mod_LoadSubmodels");
local_274 = 0;
local_270 = 0;
local_26c = 0;
local_268 = 0;
local_264 = 0;
/* try { // try from 0019da59 to 0019dac4 has its CatchHandler @ 0019dc12 */
Mod_LoadSubmodels((CUtlVector *)&local_274);
COM_TimestampedLog(" SetupSubModels");
SetupSubModels(this,param_1,(CUtlVector *)&local_274);
COM_TimestampedLog(" RecomputeSurfaceFlags");
(**(code **)(*(int *)this + 0x48))(this,param_1);
COM_TimestampedLog(" Map_VisClear");
Map_VisClear();
COM_TimestampedLog(" Map_SetRenderInfoAllocated");
(**(code **)(*(int *)this + 0x38))(this,0);
local_268 = 0;
CUtlMemory<mmodel_t,int>::Purge((CUtlMemory<mmodel_t,int> *)&local_274);
local_264 = local_274;
CUtlMemory<mmodel_t,int>::Purge((CUtlMemory<mmodel_t,int> *)&local_274);
if (local_254 != 0) {
(**(code **)(*g_pFileSystem + 0x150))(g_pFileSystem,local_254);
}
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.