CGameServer::PrecacheModel
0x0020a080 · 497 bytes · __thiscall
_ZN11CGameServer13PrecacheModelEPKciP7model_t
Decompiled
undefined (4 params)
/* CGameServer::PrecacheModel(char const*, int, model_t*) */
int __thiscall
CGameServer::PrecacheModel(CGameServer *this,char *param_1,int param_2,model_t *param_3)
{
CPrecacheItem *this_00;
int iVar1;
byte *pbVar2;
int iVar3;
int *piVar4;
model_t *pmVar5;
CMapReslistGenerator *this_01;
byte bVar6;
byte local_1d [13];
piVar4 = *(int **)(this + 0x2d364);
if ((piVar4 == (int *)0x0) ||
(iVar1 = (**(code **)(*piVar4 + 0x24))(piVar4,1,param_1,0xffffffff,0), iVar1 == 0xffff)) {
return -1;
}
pbVar2 = (byte *)(**(code **)(**(int **)(this + 0x2d364) + 0x30))
(*(int **)(this + 0x2d364),iVar1,0);
if (pbVar2 == (byte *)0x0) {
local_1d[0] = (byte)param_2 & 3;
}
else {
local_1d[0] = *pbVar2 & 0xfc | (*pbVar2 | (byte)param_2) & 3;
}
this_00 = (CPrecacheItem *)(this + iVar1 * 8 + 0x264);
(**(code **)(**(int **)(this + 0x2d364) + 0x2c))(*(int **)(this + 0x2d364),iVar1,1,local_1d);
if (param_3 != (model_t *)0x0) {
CPrecacheItem::SetModel(this_00,param_3);
}
bVar6 = 0;
iVar3 = CPrecacheItem::GetModel(this_00);
if (iVar3 == 0) {
bVar6 = (byte)((uint)param_2 >> 1) & 1;
}
piVar4 = (int *)CommandLine_Tier0();
iVar3 = (**(code **)(*piVar4 + 0x28))(piVar4,"-nopreload");
if (iVar3 == 0) {
piVar4 = (int *)CommandLine_Tier0();
iVar3 = (**(code **)(*piVar4 + 0x28))(piVar4,"-nopreloadmodels");
if (iVar3 == 0) {
if (*(int *)(sv_forcepreload._28_4_ + 0x30) == 0) {
piVar4 = (int *)CommandLine_Tier0();
iVar3 = (**(code **)(*piVar4 + 0x28))(piVar4,"-preload");
if (iVar3 == 0) {
if (iVar1 == 0) {
return 0;
}
if (bVar6 != 0) goto LAB_0020a215;
goto LAB_0020a1a3;
}
}
if (iVar1 == 0) {
return 0;
}
LAB_0020a215:
pmVar5 = (model_t *)(**(code **)(*(int *)modelloader + 0x1c))(modelloader,param_1,2);
CPrecacheItem::SetModel(this_00,pmVar5);
this_01 = (CMapReslistGenerator *)MapReslistGenerator();
CMapReslistGenerator::OnModelPrecached(this_01,param_1);
return iVar1;
}
}
if (iVar1 == 0) {
return 0;
}
LAB_0020a1a3:
(**(code **)(*(int *)modelloader + 0x20))(modelloader,param_1,2);
CPrecacheItem::SetModel(this_00,(model_t *)0x0);
return iVar1;
}
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.