diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 99389875..b4a8a27f 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -411,8 +411,6 @@ void AiL::HandleUserInput(float fElapsedTime){ bool setIdleAnimation=true; bool heldDownMovementKey=false; //Is true when a movement key has been held down. if(KEY_MENU.Released()){ - Audio::UpdateBGMVolume(); //When we open the pause menu, it forces the bgm volume to be halved. So we notify the engine that this is happening. - PauseGame(); Menu::OpenMenu(MenuType::PAUSE); } if(player->GetVelocity()==vf2d{0,0}&&player->CanMove()){ @@ -3376,14 +3374,11 @@ bool AiL::MenuClicksDeactivated()const{ } bool AiL::GamePaused(){ - return fadeOutDuration>0||disableFadeIn||paused||LoadingScreen::loading; -} - -void AiL::PauseGame(){ - paused=true; -} -void AiL::ResumeGame(){ - paused=false; + return + fadeOutDuration>0 + ||disableFadeIn + ||Menu::IsMenuOpen()&&Menu::stack.front()==Menu::menus[MenuType::PAUSE]/*The pause menu would be the only thing open and would be the menu in front.*/ + ||LoadingScreen::loading; } void AiL::EndGame(){ diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 16f93f11..f1c10734 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -170,7 +170,6 @@ private: std::map>ZONE_LIST; float lastMouseMovement=0.f; //Amount of time since the last time the cursor was moved or interacted with. vi2d lastMousePos={}; - bool paused=false; bool gameInitialized=false; ResourcePack gamepack; uint8_t mosaicEffectTransition=1U; @@ -300,8 +299,6 @@ public: void AddZone(const std::string_view zoneName,const ZoneData&zone); //Returns the last time the mouse was moved or interacted with. const float LastMouseMovement()const; - void PauseGame(); - void ResumeGame(); const bool GameInitialized()const; rcode LoadResource(Renderable&renderable,std::string_view imgPath,bool filter=false,bool clamp=true); void UpdateMonsters(); diff --git a/Adventures in Lestoria/Audio.cpp b/Adventures in Lestoria/Audio.cpp index 8f415cce..8870506f 100644 --- a/Adventures in Lestoria/Audio.cpp +++ b/Adventures in Lestoria/Audio.cpp @@ -386,11 +386,8 @@ void Audio::UpdateBGMVolume(){ } float Audio::GetCalculatedBGMVolume(const float channelVol){ float pauseMult=1.f; - for(Menu*menus:Menu::stack){ - if(menus==Menu::menus[MenuType::PAUSE]){ - pauseMult=0.5f; - break; - } + if(Menu::IsMenuOpen()&&Menu::stack.front()==Menu::menus[MenuType::PAUSE]){ + pauseMult=0.5f; } return channelVol*GetBGMVolume()*GetMuteMult()*pauseMult; } diff --git a/Adventures in Lestoria/Menu.cpp b/Adventures in Lestoria/Menu.cpp index 60810250..559e1f23 100644 --- a/Adventures in Lestoria/Menu.cpp +++ b/Adventures in Lestoria/Menu.cpp @@ -318,6 +318,7 @@ void Menu::OpenMenu(MenuType menu,bool cover){ if(std::holds_alternative(returnData)&&std::get(returnData).length()>0||std::holds_alternative>(returnData))menus[menu]->SetSelection(returnData,true); } stack.push_back(menus[menu]); + Audio::UpdateBGMVolume(); //If we open the pause menu, it forces the bgm volume to be halved. So we notify the engine that this is happening. } void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){ @@ -644,6 +645,7 @@ void Menu::CloseMenu(){ }else{ ERR("WARNING! Trying to close out no menu?? Why are we doing this?") } + Audio::UpdateBGMVolume(); //If we close the pause menu, the bgm volume was halved. So we notify the engine that this is happening so it can correct it. } std::pairMenu::GetMemoryLeakReportInfo(){ diff --git a/Adventures in Lestoria/PauseMenu.cpp b/Adventures in Lestoria/PauseMenu.cpp index b0bed909..4da95254 100644 --- a/Adventures in Lestoria/PauseMenu.cpp +++ b/Adventures in Lestoria/PauseMenu.cpp @@ -53,8 +53,6 @@ void Menu::InitializePauseWindow(){ pauseWindow->ADD("Resume Button",MenuComponent)(geom2d::rect{{6.f,0.f},{84.f,24.f}},"Resume",[](MenuFuncData data){ Menu::CloseMenu(); - game->ResumeGame(); - Audio::UpdateBGMVolume(); //When we open the pause menu, it forces the bgm volume to be halved. So we notify the engine that this is happening. return true; },ButtonAttr::FIT_TO_LABEL)END; pauseWindow->ADD("Character Button",MenuComponent)(geom2d::rect{{6.f,28.f},{84.f,24.f}},"Character",[](MenuFuncData data){ @@ -79,8 +77,11 @@ void Menu::InitializePauseWindow(){ }else{ Component(LEVEL_COMPLETE,"Next Button")->Disable(); } - game->ResumeGame(); - GameState::ChangeState(States::LEVEL_COMPLETE,0.4f); + if(GameState::STATE==GameState::states[States::GAME_HUB]){ + GameState::ChangeState(States::OVERWORLD_MAP,0.4f); + }else{ + GameState::ChangeState(States::LEVEL_COMPLETE,0.4f); + } return true; },ButtonAttr::FIT_TO_LABEL)END; diff --git a/Adventures in Lestoria/State_GameHub.cpp b/Adventures in Lestoria/State_GameHub.cpp index bfa6959d..b81cafbd 100644 --- a/Adventures in Lestoria/State_GameHub.cpp +++ b/Adventures in Lestoria/State_GameHub.cpp @@ -50,7 +50,6 @@ INCLUDE_MONSTER_LIST INCLUDE_game void State_GameHub::OnStateChange(GameState*prevState){ - Component(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut(true); if(Menu::IsMenuOpen()){ Menu::CloseAllMenus(); } diff --git a/Adventures in Lestoria/State_LevelComplete.cpp b/Adventures in Lestoria/State_LevelComplete.cpp index f7ab6ae4..b285558d 100644 --- a/Adventures in Lestoria/State_LevelComplete.cpp +++ b/Adventures in Lestoria/State_LevelComplete.cpp @@ -48,7 +48,6 @@ INCLUDE_MONSTER_LIST INCLUDE_game void State_LevelComplete::OnStateChange(GameState*prevState){ - game->ResumeGame(); if(xpGainSound==std::numeric_limits::max()){ xpGainSound=Audio::LoadAndPlay("xpgain.ogg"_SFX,true); Audio::Engine().SetVolume(xpGainSound,0.f); diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index a3aeaeb5..a3c2851f 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -19,7 +19,6 @@ Funny text colors with text color override on blacksmith menu Toggle for displaying error messages -Make 'Leave Area' in pause menu work for camp Level Up shows Health + and Atk + Indicators Ranger Backdash range buff? diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 17fd66c2..da55bad0 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 4 #define VERSION_PATCH 4 -#define VERSION_BUILD 7906 +#define VERSION_BUILD 7909 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index ea71a961..385bd520 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ