Cache all models inside the models/player directory

Some player models are missing from precache scripts. This caches all models inside the player directory to avoid a short hitch when a player spawns with a non-cached model
This commit is contained in:
smallmodel 2025-01-22 18:22:40 +01:00
parent 90e46f535c
commit 92a0a9c197
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512

View file

@ -1588,6 +1588,30 @@ void Level::Precache(void)
LoadAllScripts("global", ".scr"); LoadAllScripts("global", ".scr");
InitVoteOptions(); InitVoteOptions();
// Added in OPM
// Cache all player models in multi-player
// This avoids using precache scripts
if (g_gametype->integer != GT_SINGLE_PLAYER) {
char **fileList;
int numFiles;
int i;
fileList = gi.FS_ListFiles("models/player", ".tik", qfalse, &numFiles);
for (i = 0; i < numFiles; i++) {
const char *filename = fileList[i];
const size_t filelen = strlen(filename);
if (!Q_stricmpn(filename, "allied_", 7) || !Q_stricmpn(filename, "american_", 9)
|| !Q_stricmpn(filename, "german_", 7) || !Q_stricmpn(filename, "IT_", 3)
|| !Q_stricmpn(filename, "SC_", 3)) {
CacheResource(va("models/player/%s", filename));
}
}
gi.FS_FreeFileList(fileList);
}
} }
/* /*