From f4961d9da7dd1f344d8604a6260a3074ddb5f7ae Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sat, 11 Feb 2023 06:48:12 +0300 Subject: [PATCH] engine: client: return empty string in pfnGetLevelName if no map is loaded yet --- engine/client/cl_game.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 26b6c91d..09b82230 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -2582,7 +2582,10 @@ static const char *pfnGetLevelName( void ) { static char mapname[64]; - if( cls.state >= ca_connected ) + // a1ba: don't return maps/.bsp if no map is loaded yet + // in GoldSrc this is handled by cl.levelname field but we don't have it + // so emulate this behavior here + if( cls.state >= ca_connected && COM_CheckStringEmpty( clgame.mapname )) Q_snprintf( mapname, sizeof( mapname ), "maps/%s.bsp", clgame.mapname ); else mapname[0] = '\0'; // not in game