typedef struct {
char model[MAXLENGTH_MODELPATH];
char bmp[MAXLENGTH_MODELPATH];
+ char tmdl[MAXLENGTH_MODELPATH];
} precache_paths;
typedef struct {
snprintf(precache_list[i].paths.model, MAXLENGTH_MODELPATH, "models/player/%s/%s.mdl", model, model);
snprintf(precache_list[i].paths.bmp, MAXLENGTH_MODELPATH, "models/player/%s/%s.bmp", model, model);
+ snprintf(precache_list[i].paths.tmdl, MAXLENGTH_MODELPATH, "models/player/%s/%st.mdl", model, model);
+
+ // Check if BMP exists
+ if (!fileExists(precache_list[i].paths.bmp))
+ precache_list[i].paths.bmp[0] = 0;
+
+ // Check if t.mdl exists, also try alternative path
+ if (!fileExists(precache_list[i].paths.tmdl)) {
+ snprintf(precache_list[i].paths.tmdl, MAXLENGTH_MODELPATH, "models/player/%s/%sT.mdl", model, model);
+ if (!fileExists(precache_list[i].paths.tmdl))
+ precache_list[i].paths.tmdl[0] = 0;
+ }
precache_count++;
- LOG_MESSAGE(PLID, "Precache entry %d: playername=\"%s\" modelname=\"%s\" paths.model=\"%s\" paths.bmp=\"%s\"", i, precache_list[i].playername, precache_list[i].modelname, precache_list[i].paths.model, precache_list[i].paths.bmp);
+ LOG_MESSAGE(PLID, "Precache entry %d: playername=\"%s\" modelname=\"%s\" paths.model=\"%s\" paths.bmp=\"%s\" paths.tmdl=\"%s\"", i, precache_list[i].playername, precache_list[i].modelname, precache_list[i].paths.model, precache_list[i].paths.bmp, precache_list[i].paths.tmdl);
return true;
}
else
}
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax) {
- bool hasBMP;
+ bool hasBMP, hasTMDL;
LOG_MESSAGE(PLID, "Precaching %d player models", precache_count);
for (int i = 0; i < precache_count; i++) {
- hasBMP = fileExists(precache_list[i].paths.bmp);
+ hasBMP = strlen(precache_list[i].paths.bmp) != 0;
+ hasTMDL = strlen(precache_list[i].paths.tmdl) != 0;
+
+ const char* indicator;
+ if (hasBMP && hasTMDL)
+ indicator = "(with bmp+tmdl)";
+ else if (hasBMP)
+ indicator = "(with bmp)";
+ else if (hasTMDL)
+ indicator = "(with tmdl)";
+ else
+ indicator = "(without bmp)";
+
LOG_MESSAGE(PLID, "Precaching model %s: %s (contributed by %s)",
- hasBMP ? "(with bmp)" : "(without bmp)",
+ indicator,
precache_list[i].modelname, precache_list[i].playername);
+
g_engfuncs.pfnPrecacheModel(precache_list[i].paths.model);
+
if (hasBMP)
g_engfuncs.pfnPrecacheGeneric(precache_list[i].paths.bmp);
+
+ if (hasTMDL)
+ g_engfuncs.pfnPrecacheGeneric(precache_list[i].paths.tmdl);
}
precache_count = 0;
RETURN_META(MRES_HANDLED);