From c970f28804fc799f4d9e233195450601ba81ed79 Mon Sep 17 00:00:00 2001 From: nillerusr Date: Mon, 20 Feb 2023 21:03:47 +0300 Subject: [PATCH] engine: fix Map_IsValid for mapcycle --- engine/modelloader.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/engine/modelloader.cpp b/engine/modelloader.cpp index 06e5ce82..be833736 100644 --- a/engine/modelloader.cpp +++ b/engine/modelloader.cpp @@ -5449,6 +5449,15 @@ bool CModelLoader::Map_IsValid( char const *pMapFile, bool bQuiet /* = false */ V_strcpy_safe( szMapFile, szMapName360 ); } + bool bHaveBspFormatInPath = strcasestr(szMapFile, ".bsp"); + bool bHaveMapsInPath = strcasestr(szMapFile, "maps/"); + + if( !bHaveMapsInPath ) + snprintf(szMapFile, sizeof(szMapFile), "maps/%s", pMapFile); + + if( !bHaveBspFormatInPath ) + strncat(szMapFile, ".bsp", sizeof(szMapFile)); + mapfile = g_pFileSystem->OpenEx( szMapFile, "rb", IsX360() ? FSOPEN_NEVERINPACK : 0, "GAME" ); if ( mapfile != FILESYSTEM_INVALID_HANDLE ) {