Fix bug with leaving a stage via the pause menu while not having cleared a stage causing the unlock to still occur. Release Build 8656.

This commit is contained in:
sigonasr2 2024-04-01 19:19:23 -05:00
parent 28003c88a0
commit 99d449400b
7 changed files with 20 additions and 2 deletions

View File

@ -3973,3 +3973,14 @@ const bool AiL::QuitRequested()const{
void AiL::SetQuitAllowed(bool quittingAllowed){
savingFile=!quittingAllowed;
}
const bool AiL::PreviousStageCompleted()const{
return prevStageCompleted;
}
void AiL::SetCompletedStageFlag(){
prevStageCompleted=true;
}
void AiL::ResetCompletedStageFlag(){
prevStageCompleted=false;
}

View File

@ -184,6 +184,7 @@ private:
bool displayHud=true;
float vignetteDisplayTime=0.f;
bool savingFile=false;
bool prevStageCompleted=false;
void ValidateGameStatus();
void _PrepareLevel(MapName map,MusicChange changeMusic);
@ -325,6 +326,9 @@ public:
void GlobalGameUpdates();
const bool QuitRequested()const;
void SetQuitAllowed(bool quittingAllowed); //Locks the game from quitting during sensitive operations such as file saving/loading.
const bool PreviousStageCompleted()const;
void SetCompletedStageFlag();
void ResetCompletedStageFlag();
struct TileGroupData{
vi2d tilePos;

View File

@ -74,7 +74,7 @@ void Menu::InitializePauseWindow(){
Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Summary");
Component<MenuComponent>(LEVEL_COMPLETE,"Level Details Outline")->SetLabel("");
if(game->GetCurrentMapName()=="HUB")Unlock::UnlockCurrentMap(); //Special unlock for the hub area when leaving.
if(game->GetCurrentMapName()=="HUB"&&game->PreviousStageCompleted())Unlock::UnlockCurrentMap(); //Special unlock for the hub area when leaving.
if(Unlock::IsUnlocked("STORY_1_1")){
Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->Enable();

View File

@ -1065,6 +1065,7 @@ void Player::CheckEndZoneCollision(){
endZoneStandTime+=game->GetElapsedTime();
if(endZoneStandTime>="Player.End Zone Wait Time"_F){
Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Completed");
game->SetCompletedStageFlag();
Component<MenuComponent>(LEVEL_COMPLETE,"Level Details Outline")->SetLabel("Complete Bonus\n +10% XP");
if(Unlock::IsUnlocked("STORY_1_1")){
Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->Enable();

View File

@ -61,6 +61,8 @@ void State_OverworldMap::OnStateChange(GameState*prevState){
Component<MenuComponent>(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut(false);
SaveFile::SaveGame();
game->ResetCompletedStageFlag();
if(Unlock::IsUnlocked("STORY_1_3")){
game->SetChapter(2);
}

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 1
#define VERSION_PATCH 0
#define VERSION_BUILD 8655
#define VERSION_BUILD 8656
#define stringify(a) stringify_(a)
#define stringify_(a) #a