From d953468bc155c43c8ace379feaa992b2a7f99fe9 Mon Sep 17 00:00:00 2001 From: Blixibon Date: Fri, 12 Mar 2021 11:08:39 -0600 Subject: [PATCH] Fixed env_credits always resetting sv_unlockedchapters to 15 when it shouldn't --- sp/src/game/server/EnvMessage.cpp | 8 ++++++++ sp/src/game/shared/mapbase/mapbase_shared.cpp | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/sp/src/game/server/EnvMessage.cpp b/sp/src/game/server/EnvMessage.cpp index 3f47c2ea..6de81783 100644 --- a/sp/src/game/server/EnvMessage.cpp +++ b/sp/src/game/server/EnvMessage.cpp @@ -212,6 +212,10 @@ static ConCommand creditsdone("creditsdone", CreditsDone_f ); extern ConVar sv_unlockedchapters; +#ifdef MAPBASE +extern int Mapbase_GetChapterCount(); +#endif + void CCredits::OnRestore() { BaseClass::OnRestore(); @@ -226,6 +230,10 @@ void CCredits::OnRestore() void CCredits::RollOutroCredits() { +#ifdef MAPBASE + // Don't set this if we're using Mapbase chapters or if sv_unlockedchapters is already greater than 15 + if (Mapbase_GetChapterCount() <= 0 && sv_unlockedchapters.GetInt() < 15) +#endif sv_unlockedchapters.SetValue( "15" ); CBasePlayer *pPlayer = UTIL_GetLocalPlayer(); diff --git a/sp/src/game/shared/mapbase/mapbase_shared.cpp b/sp/src/game/shared/mapbase/mapbase_shared.cpp index 6a89b30f..36818e6f 100644 --- a/sp/src/game/shared/mapbase/mapbase_shared.cpp +++ b/sp/src/game/shared/mapbase/mapbase_shared.cpp @@ -553,6 +553,11 @@ CUtlVector *Mapbase_GetChapterList() return &g_MapbaseChapterList; } +int Mapbase_GetChapterCount() +{ + return g_MapbaseChapterList.Count(); +} + ThreeState_t Flashlight_GetLegacyVersionKey() { KeyValues *gameinfo = new KeyValues( "GameInfo" );