Make Leave Area button work in the camp. Fix background music volume not being halved when entering/exiting the pause menu. Release Build 7909.

pull/35/head
sigonasr2 9 months ago
parent 05e59f8ca4
commit 0fd57311be
  1. 15
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 3
      Adventures in Lestoria/AdventuresInLestoria.h
  3. 7
      Adventures in Lestoria/Audio.cpp
  4. 2
      Adventures in Lestoria/Menu.cpp
  5. 9
      Adventures in Lestoria/PauseMenu.cpp
  6. 1
      Adventures in Lestoria/State_GameHub.cpp
  7. 1
      Adventures in Lestoria/State_LevelComplete.cpp
  8. 1
      Adventures in Lestoria/TODO.txt
  9. 2
      Adventures in Lestoria/Version.h
  10. BIN
      x64/Release/Adventures in Lestoria.exe

@ -411,8 +411,6 @@ void AiL::HandleUserInput(float fElapsedTime){
bool setIdleAnimation=true; bool setIdleAnimation=true;
bool heldDownMovementKey=false; //Is true when a movement key has been held down. bool heldDownMovementKey=false; //Is true when a movement key has been held down.
if(KEY_MENU.Released()){ 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); Menu::OpenMenu(MenuType::PAUSE);
} }
if(player->GetVelocity()==vf2d{0,0}&&player->CanMove()){ if(player->GetVelocity()==vf2d{0,0}&&player->CanMove()){
@ -3376,14 +3374,11 @@ bool AiL::MenuClicksDeactivated()const{
} }
bool AiL::GamePaused(){ bool AiL::GamePaused(){
return fadeOutDuration>0||disableFadeIn||paused||LoadingScreen::loading; return
} fadeOutDuration>0
||disableFadeIn
void AiL::PauseGame(){ ||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.*/
paused=true; ||LoadingScreen::loading;
}
void AiL::ResumeGame(){
paused=false;
} }
void AiL::EndGame(){ void AiL::EndGame(){

@ -170,7 +170,6 @@ private:
std::map<std::string,std::vector<::ZoneData>>ZONE_LIST; std::map<std::string,std::vector<::ZoneData>>ZONE_LIST;
float lastMouseMovement=0.f; //Amount of time since the last time the cursor was moved or interacted with. float lastMouseMovement=0.f; //Amount of time since the last time the cursor was moved or interacted with.
vi2d lastMousePos={}; vi2d lastMousePos={};
bool paused=false;
bool gameInitialized=false; bool gameInitialized=false;
ResourcePack gamepack; ResourcePack gamepack;
uint8_t mosaicEffectTransition=1U; uint8_t mosaicEffectTransition=1U;
@ -300,8 +299,6 @@ public:
void AddZone(const std::string_view zoneName,const ZoneData&zone); void AddZone(const std::string_view zoneName,const ZoneData&zone);
//Returns the last time the mouse was moved or interacted with. //Returns the last time the mouse was moved or interacted with.
const float LastMouseMovement()const; const float LastMouseMovement()const;
void PauseGame();
void ResumeGame();
const bool GameInitialized()const; const bool GameInitialized()const;
rcode LoadResource(Renderable&renderable,std::string_view imgPath,bool filter=false,bool clamp=true); rcode LoadResource(Renderable&renderable,std::string_view imgPath,bool filter=false,bool clamp=true);
void UpdateMonsters(); void UpdateMonsters();

@ -386,11 +386,8 @@ void Audio::UpdateBGMVolume(){
} }
float Audio::GetCalculatedBGMVolume(const float channelVol){ float Audio::GetCalculatedBGMVolume(const float channelVol){
float pauseMult=1.f; float pauseMult=1.f;
for(Menu*menus:Menu::stack){ if(Menu::IsMenuOpen()&&Menu::stack.front()==Menu::menus[MenuType::PAUSE]){
if(menus==Menu::menus[MenuType::PAUSE]){ pauseMult=0.5f;
pauseMult=0.5f;
break;
}
} }
return channelVol*GetBGMVolume()*GetMuteMult()*pauseMult; return channelVol*GetBGMVolume()*GetMuteMult()*pauseMult;
} }

@ -318,6 +318,7 @@ void Menu::OpenMenu(MenuType menu,bool cover){
if(std::holds_alternative<ButtonName>(returnData)&&std::get<ButtonName>(returnData).length()>0||std::holds_alternative<std::weak_ptr<MenuComponent>>(returnData))menus[menu]->SetSelection(returnData,true); if(std::holds_alternative<ButtonName>(returnData)&&std::get<ButtonName>(returnData).length()>0||std::holds_alternative<std::weak_ptr<MenuComponent>>(returnData))menus[menu]->SetSelection(returnData,true);
} }
stack.push_back(menus[menu]); 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){ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
@ -644,6 +645,7 @@ void Menu::CloseMenu(){
}else{ }else{
ERR("WARNING! Trying to close out no menu?? Why are we doing this?") 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::pair<MenuType,std::string>Menu::GetMemoryLeakReportInfo(){ std::pair<MenuType,std::string>Menu::GetMemoryLeakReportInfo(){

@ -53,8 +53,6 @@ void Menu::InitializePauseWindow(){
pauseWindow->ADD("Resume Button",MenuComponent)(geom2d::rect<float>{{6.f,0.f},{84.f,24.f}},"Resume",[](MenuFuncData data){ pauseWindow->ADD("Resume Button",MenuComponent)(geom2d::rect<float>{{6.f,0.f},{84.f,24.f}},"Resume",[](MenuFuncData data){
Menu::CloseMenu(); 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; return true;
},ButtonAttr::FIT_TO_LABEL)END; },ButtonAttr::FIT_TO_LABEL)END;
pauseWindow->ADD("Character Button",MenuComponent)(geom2d::rect<float>{{6.f,28.f},{84.f,24.f}},"Character",[](MenuFuncData data){ pauseWindow->ADD("Character Button",MenuComponent)(geom2d::rect<float>{{6.f,28.f},{84.f,24.f}},"Character",[](MenuFuncData data){
@ -79,8 +77,11 @@ void Menu::InitializePauseWindow(){
}else{ }else{
Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->Disable(); Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->Disable();
} }
game->ResumeGame(); if(GameState::STATE==GameState::states[States::GAME_HUB]){
GameState::ChangeState(States::LEVEL_COMPLETE,0.4f); GameState::ChangeState(States::OVERWORLD_MAP,0.4f);
}else{
GameState::ChangeState(States::LEVEL_COMPLETE,0.4f);
}
return true; return true;
},ButtonAttr::FIT_TO_LABEL)END; },ButtonAttr::FIT_TO_LABEL)END;

@ -50,7 +50,6 @@ INCLUDE_MONSTER_LIST
INCLUDE_game INCLUDE_game
void State_GameHub::OnStateChange(GameState*prevState){ void State_GameHub::OnStateChange(GameState*prevState){
Component<MenuComponent>(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut(true);
if(Menu::IsMenuOpen()){ if(Menu::IsMenuOpen()){
Menu::CloseAllMenus(); Menu::CloseAllMenus();
} }

@ -48,7 +48,6 @@ INCLUDE_MONSTER_LIST
INCLUDE_game INCLUDE_game
void State_LevelComplete::OnStateChange(GameState*prevState){ void State_LevelComplete::OnStateChange(GameState*prevState){
game->ResumeGame();
if(xpGainSound==std::numeric_limits<size_t>::max()){ if(xpGainSound==std::numeric_limits<size_t>::max()){
xpGainSound=Audio::LoadAndPlay("xpgain.ogg"_SFX,true); xpGainSound=Audio::LoadAndPlay("xpgain.ogg"_SFX,true);
Audio::Engine().SetVolume(xpGainSound,0.f); Audio::Engine().SetVolume(xpGainSound,0.f);

@ -19,7 +19,6 @@ Funny text colors with text color override on blacksmith menu
Toggle for displaying error messages Toggle for displaying error messages
Make 'Leave Area' in pause menu work for camp
Level Up shows Health + and Atk + Indicators Level Up shows Health + and Atk + Indicators
Ranger Backdash range buff? Ranger Backdash range buff?

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 4 #define VERSION_MINOR 4
#define VERSION_PATCH 4 #define VERSION_PATCH 4
#define VERSION_BUILD 7906 #define VERSION_BUILD 7909
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

Loading…
Cancel
Save