From 6715402425e2247818086a51f9662c0605447177 Mon Sep 17 00:00:00 2001 From: Artem Golubikhin Date: Sat, 28 Jan 2017 00:02:43 +0300 Subject: [PATCH] Workaround for texture precaching on case-sensitive filesystem (#325) That fixes a problem when texture file for model ends with "t.mdl", not "T.mdl" --- rehlds/engine/sv_main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 1bad319..df8285b 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -5663,7 +5663,7 @@ void PrecacheModelTexture(const char *s, studiohdr_t *pStudioHeader) return; size_t modelNameLength = Q_strlen(s); - if (modelNameLength >= MAX_QPATH - 1) + if (modelNameLength > MAX_QPATH - 2) return; char textureModelName[MAX_QPATH]; @@ -5673,6 +5673,11 @@ void PrecacheModelTexture(const char *s, studiohdr_t *pStudioHeader) char *modelExtension = &textureModelName[modelNameLength - modelExtensionLength]; Q_strcpy(modelExtension, "T.mdl"); +#ifndef _WIN32 + if (!FS_FileExists(textureModelName)) + modelExtension[0] = 't'; +#endif + // Use generic, because model max count is 512... PF_precache_generic_I(textureModelName); }