Implemented controller compatibility for the pause menu. Release Build 7447.
This commit is contained in:
parent
397d8abc0a
commit
e2cc0aa90c
@ -312,7 +312,8 @@ bool AiL::OnUserCreate(){
|
||||
#ifndef __EMSCRIPTEN__
|
||||
SetupDiscord();
|
||||
#endif
|
||||
|
||||
|
||||
gameInitialized=true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -388,8 +389,8 @@ void AiL::HandleUserInput(float fElapsedTime){
|
||||
|
||||
bool setIdleAnimation=true;
|
||||
bool heldDownMovementKey=false; //Is true when a movement key has been held down.
|
||||
if(GetKey(F1).bPressed){
|
||||
ConsoleShow(F1);
|
||||
if(KEY_MENU.Released()){
|
||||
Menu::OpenMenu(MenuType::PAUSE);
|
||||
}
|
||||
if(GetMouseWheel()>0){
|
||||
switch(player->GetClass()){
|
||||
@ -3069,7 +3070,14 @@ void AiL::RenderFadeout(){
|
||||
}
|
||||
|
||||
bool AiL::GamePaused(){
|
||||
return fadeOutDuration>0||disableFadeIn;
|
||||
return fadeOutDuration>0||disableFadeIn||paused;
|
||||
}
|
||||
|
||||
void AiL::PauseGame(){
|
||||
paused=true;
|
||||
}
|
||||
void AiL::ResumeGame(){
|
||||
paused=false;
|
||||
}
|
||||
|
||||
void AiL::EndGame(){
|
||||
@ -3291,4 +3299,8 @@ void AiL::GetAnyMousePress(int32_t mouseButton){
|
||||
|
||||
const float AiL::LastMouseMovement()const{
|
||||
return lastMouseMovement;
|
||||
}
|
||||
|
||||
const bool AiL::GameInitialized()const {
|
||||
return gameInitialized;
|
||||
}
|
@ -162,6 +162,8 @@ private:
|
||||
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.
|
||||
vi2d lastMousePos={};
|
||||
bool paused=false;
|
||||
bool gameInitialized=false;
|
||||
|
||||
void ValidateGameStatus();
|
||||
#ifndef __EMSCRIPTEN__
|
||||
@ -281,6 +283,9 @@ 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;
|
||||
|
||||
struct TileGroupData{
|
||||
vi2d tilePos;
|
||||
|
@ -102,6 +102,9 @@ public:
|
||||
}
|
||||
return DEFAULT;
|
||||
}
|
||||
inline auto count(std::string_view key)const{
|
||||
return attributes.count(ItemAttribute::Get(key));
|
||||
}
|
||||
inline auto begin()const{
|
||||
return attributes.begin();
|
||||
}
|
||||
|
@ -300,6 +300,7 @@ void Audio::SetBGMVolume(float vol){
|
||||
for(int channelListIndex=0;int trackID:track.GetChannelIDs()){
|
||||
float channelVol=track.GetVolume(Self().currentAudioEvent,channelListIndex);
|
||||
Engine().SetVolume(trackID,channelVol*GetBGMVolume()*GetMuteMult());
|
||||
channelListIndex++;
|
||||
}
|
||||
}
|
||||
void Audio::SetSFXVolume(float vol){
|
||||
|
@ -137,7 +137,8 @@ void Menu::InitializeInventoryWindow(){
|
||||
#pragma region Inventory Description
|
||||
float inventoryDescriptionWidth=inventoryWindow->pos.x+inventoryWindow->size.x-26-224;
|
||||
inventoryWindow->ADD("Item Description Outline",MenuLabel)(geom2d::rect<float>{{224,28},{inventoryDescriptionWidth,inventoryWindow->size.y-44}},"",1,LEFT_ALIGN|OUTLINE|BACKGROUND)END;
|
||||
inventoryWindow->ADD("Item Icon",MenuItemItemButton)(geom2d::rect<float>{{226+inventoryDescriptionWidth/2-24,30},{48,48}},Item::BLANK,DO_NOTHING,"","",IconButtonAttr::NOT_SELECTABLE)END;
|
||||
inventoryWindow->ADD("Item Icon",MenuItemItemButton)(geom2d::rect<float>{{226+inventoryDescriptionWidth/2-24,30},{48,48}},Item::BLANK,DO_NOTHING,"","",IconButtonAttr::NOT_SELECTABLE)END
|
||||
->SetIconScale({2.f,2.f});
|
||||
inventoryWindow->ADD("Item Name Label",MenuLabel)(geom2d::rect<float>{{226,84},{inventoryDescriptionWidth-6,12}},"",0.75f,LEFT_ALIGN|SHADOW)END;
|
||||
inventoryWindow->ADD("Item Description Label",MenuLabel)(geom2d::rect<float>{{226,94},{inventoryDescriptionWidth-6,inventoryWindow->size.y-44-66}},"",0.5f,LEFT_ALIGN|SHADOW)END;
|
||||
#pragma endregion
|
||||
|
@ -76,7 +76,7 @@ void Menu::InitializeLevelCompleteWindow(){
|
||||
|
||||
levelCompleteWindow->ADD("Level Details Outline",MenuComponent)(geom2d::rect<float>{{windowSize.size.x-72.f,32},{71,72}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END;
|
||||
levelCompleteWindow->ADD("Level EXP Gain Outline",MenuLabel)(geom2d::rect<float>{{windowSize.size.x-72.f,104},{71,36}},"+ Exp",1,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;
|
||||
levelCompleteWindow->ADD("Next Button",MenuComponent)(geom2d::rect<float>{{windowSize.size.x-72.f,144},{71,32}},"Next",nextButtonAction)END;
|
||||
levelCompleteWindow->ADD("Next Button",MenuComponent)(geom2d::rect<float>{{windowSize.size.x-72.f,144},{71,32}},"Proceed\nto Camp",nextButtonAction,ButtonAttr::FIT_TO_LABEL)END;
|
||||
|
||||
levelCompleteWindow->ADD("Monster Loot Popup Item Name",PopupMenuLabel)(geom2d::rect<float>{{0,108},{windowSize.size.x-80.f,12}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;
|
||||
levelCompleteWindow->ADD("Monster Loot Popup Item Description",PopupMenuLabel)(geom2d::rect<float>{{0,120},{windowSize.size.x-80.f,60}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;
|
||||
|
@ -49,18 +49,22 @@ using A=Attribute;
|
||||
void Menu::InitializeMainMenuWindow(){
|
||||
Menu*mainMenuWindow=CreateMenu(MAIN_MENU,vi2d{132,120},vi2d{96,96});
|
||||
|
||||
auto newGameButton=mainMenuWindow->ADD("New Game Button",MenuComponent)(geom2d::rect<float>{{12,4},{72,24}},"New Game",[&](MenuFuncData data){
|
||||
auto newGameButton=mainMenuWindow->ADD("New Game Button",MenuComponent)(geom2d::rect<float>{{12,4},{72,20}},"New Game",[&](MenuFuncData data){
|
||||
std::string randomName=DATA["Player"]["Default Female Name"].GetString(util::random()%DATA["Player"]["Default Female Name"].GetValueCount());
|
||||
|
||||
SaveFile::SetSaveFileName(randomName); //Randomize a default name.
|
||||
Menu::OpenMenu(CLASS_SELECTION);
|
||||
return true;
|
||||
})END;
|
||||
auto loadGameButton=mainMenuWindow->ADD("Load Game Button",MenuComponent)(geom2d::rect<float>{{12,36},{72,24}},"Load Game",[](MenuFuncData data){
|
||||
auto loadGameButton=mainMenuWindow->ADD("Load Game Button",MenuComponent)(geom2d::rect<float>{{12,28},{72,20}},"Load Game",[](MenuFuncData data){
|
||||
SaveFile::UpdateSaveGameData([](){Menu::OpenMenu(LOAD_GAME);}); //This function also opens the menu in emscripten.
|
||||
return true;
|
||||
})END;
|
||||
mainMenuWindow->ADD("Quit Game Button",MenuComponent)(geom2d::rect<float>{{12,68},{72,24}},"Quit Game",[](MenuFuncData data){
|
||||
mainMenuWindow->ADD("Settings Button",MenuComponent)(geom2d::rect<float>{{12,52},{72,20}},"Settings",[](MenuFuncData data){
|
||||
Menu::OpenMenu(SETTINGS);
|
||||
return true;
|
||||
})END;
|
||||
mainMenuWindow->ADD("Quit Game Button",MenuComponent)(geom2d::rect<float>{{12,76},{72,20}},"Quit Game",[](MenuFuncData data){
|
||||
game->EndGame();
|
||||
return true;
|
||||
})END;
|
||||
@ -82,9 +86,12 @@ void Menu::InitializeMainMenuWindow(){
|
||||
.down="Load Game Button",}},
|
||||
{"Load Game Button",{
|
||||
.up="New Game Button",
|
||||
.down="Settings Button",}},
|
||||
{"Settings Button",{
|
||||
.up="Load Game Button",
|
||||
.down="Quit Game Button",}},
|
||||
{"Quit Game Button",{
|
||||
.up="Load Game Button",
|
||||
.up="Settings Button",
|
||||
.down="New Game Button",}},
|
||||
});
|
||||
}
|
@ -41,7 +41,7 @@ enum MenuType{
|
||||
///////////////////////////////////////////////////////////
|
||||
/*DO NOT REMOVE!!*/ENUM_START,///////////////////////////////
|
||||
///////////////////////////////////////////////////////////
|
||||
// 96% Controller Compatibility. (100 total items, 4 items per menu * 25 menus)
|
||||
// 100% Controller Compatibility. (100 total items, 4 items per menu * 25 menus)
|
||||
INVENTORY_CONSUMABLES, //100% Controller Compatibility
|
||||
CLASS_INFO, //100% Controller Compatibility
|
||||
CLASS_SELECTION, //100% Controller Compatibility
|
||||
@ -66,7 +66,7 @@ enum MenuType{
|
||||
SHERMAN, //100% Controller Compatibility
|
||||
INPUT_KEY_DISPLAY, //100% Controller Compatibility
|
||||
NEW_INPUT, //100% Controller Compatibility
|
||||
PAUSE, //0% Controller Compatibility
|
||||
PAUSE, //100% Controller Compatibility
|
||||
///////////////////////////////////////////////////////////
|
||||
/*DO NOT REMOVE!!*/ENUM_END////////////////////////////////
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -37,7 +37,71 @@ All rights reserved.
|
||||
#pragma endregion
|
||||
|
||||
#include "Menu.h"
|
||||
#include "MenuComponent.h"
|
||||
#include "GameState.h"
|
||||
#include "MenuLabel.h"
|
||||
#include "AdventuresInLestoria.h"
|
||||
#include "CharacterRotatingDisplay.h"
|
||||
#include "ClassInfo.h"
|
||||
|
||||
INCLUDE_game
|
||||
INCLUDE_GFX
|
||||
|
||||
void Menu::InitializePauseWindow(){
|
||||
Menu*pauseWindow=CreateMenu(MenuType::PAUSE,CENTERED,vi2d{96,164});
|
||||
Menu*pauseWindow=CreateMenu(MenuType::PAUSE,CENTERED,vi2d{96,140});
|
||||
|
||||
pauseWindow->ADD("Resume Button",MenuComponent)(geom2d::rect<float>{{6.f,0.f},{84.f,24.f}},"Resume",[](MenuFuncData data){
|
||||
Menu::CloseMenu();
|
||||
return true;
|
||||
},ButtonAttr::FIT_TO_LABEL)END;
|
||||
pauseWindow->ADD("Character Button",MenuComponent)(geom2d::rect<float>{{6.f,28.f},{84.f,24.f}},"Character",[](MenuFuncData data){
|
||||
Component<CharacterRotatingDisplay>(CHARACTER_MENU,"Character Rotating Display")->SetIcon(GFX[classutils::GetClassInfo(game->GetPlayer()->GetClassName()).classFullImgName].Decal());
|
||||
Menu::OpenMenu(CHARACTER_MENU);
|
||||
return true;
|
||||
},ButtonAttr::FIT_TO_LABEL)END;
|
||||
pauseWindow->ADD("Inventory Button",MenuComponent)(geom2d::rect<float>{{6.f,56.f},{84.f,24.f}},"Inventory",[](MenuFuncData data){
|
||||
Menu::OpenMenu(INVENTORY);
|
||||
return true;
|
||||
},ButtonAttr::FIT_TO_LABEL)END;
|
||||
pauseWindow->ADD("Settings Button",MenuComponent)(geom2d::rect<float>{{6.f,84.f},{84.f,24.f}},"Settings",[](MenuFuncData data){
|
||||
Menu::OpenMenu(SETTINGS);
|
||||
return true;
|
||||
},ButtonAttr::FIT_TO_LABEL)END;
|
||||
pauseWindow->ADD("Return to Camp Button",MenuComponent)(geom2d::rect<float>{{6.f,112.f},{84.f,24.f}},"Return to Camp",[](MenuFuncData data){
|
||||
Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Summary");
|
||||
GameState::ChangeState(States::LEVEL_COMPLETE,0.4f);
|
||||
return true;
|
||||
},ButtonAttr::FIT_TO_LABEL)END;
|
||||
|
||||
pauseWindow->SetupKeyboardNavigation(
|
||||
[](MenuType type,Data&returnData){ //On Open
|
||||
returnData="Resume Button";
|
||||
},
|
||||
{ //Button Key
|
||||
{game->KEY_SCROLL,{"Navigate",[](MenuType type){}}},
|
||||
{game->KEY_BACK,{"Resume",[](MenuType type){
|
||||
Menu::CloseMenu();
|
||||
}}},
|
||||
{game->KEY_MENU,{"Resume",[](MenuType type){
|
||||
Menu::CloseMenu();
|
||||
}}},
|
||||
{game->KEY_CONFIRM,{"Select",[](MenuType type){}}},
|
||||
}
|
||||
,{ //Button Navigation Rules
|
||||
{"Resume Button",{
|
||||
.up="Return to Camp Button",
|
||||
.down="Character Button",}},
|
||||
{"Character Button",{
|
||||
.up="Resume Button",
|
||||
.down="Inventory Button",}},
|
||||
{"Inventory Button",{
|
||||
.up="Character Button",
|
||||
.down="Settings Button",}},
|
||||
{"Settings Button",{
|
||||
.up="Inventory Button",
|
||||
.down="Return to Camp Button",}},
|
||||
{"Return to Camp Button",{
|
||||
.up="Settings Button",
|
||||
.down="Resume Button",}},
|
||||
});
|
||||
}
|
@ -715,6 +715,7 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){
|
||||
|
||||
SoundEffect::PlaySFX("Player Hit",SoundEffect::CENTERED);
|
||||
}
|
||||
if(Menu::IsMenuOpen()&&mod_dmg>0)Menu::CloseAllMenus();
|
||||
hp=std::max(0,hp-int(mod_dmg));
|
||||
|
||||
hurtRumbleTime="Player.Hurt Rumble Time"_F;
|
||||
@ -978,6 +979,7 @@ void Player::CheckEndZoneCollision(){
|
||||
if(zone.isUpper==upperLevel&&geom2d::overlaps(GetPos(),zone.zone)){
|
||||
endZoneStandTime+=game->GetElapsedTime();
|
||||
if(endZoneStandTime>="Player.End Zone Wait Time"_F){
|
||||
Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Completed");
|
||||
GameState::ChangeState(States::LEVEL_COMPLETE);
|
||||
}
|
||||
return;
|
||||
@ -1035,6 +1037,7 @@ void EntityStats::RecalculateEquipStats(){
|
||||
equipStats.A(key)+=setStats.A_Read(key);
|
||||
}
|
||||
}
|
||||
game->GetPlayer()->UpdateHealthAndMana();
|
||||
for(std::weak_ptr<MenuComponent>component:Menu::equipStatListeners){
|
||||
component.lock()->OnEquipStatsUpdate();
|
||||
}
|
||||
@ -1338,4 +1341,12 @@ const vf2d Player::GetAimingLocation(){
|
||||
}
|
||||
const bool Player::UsingAutoAim()const{
|
||||
return (GameSettings::KeyboardAutoAimEnabled()&&game->LastMouseMovement()>=2.f)||Input::UsingGamepad();
|
||||
}
|
||||
|
||||
void Player::UpdateHealthAndMana(){
|
||||
//Perform a check to make sure stats are initialized before they can be used.
|
||||
if(game->GameInitialized()){
|
||||
hp=std::min(hp,int(GetStat("Health")));
|
||||
mana=std::min(mana,GetMaxMana());
|
||||
}
|
||||
}
|
@ -169,6 +169,8 @@ public:
|
||||
//Remove every buff.
|
||||
void RemoveAllBuffs();
|
||||
|
||||
void UpdateHealthAndMana();
|
||||
|
||||
void RecalculateEquipStats();
|
||||
|
||||
bool Hurt(int damage,bool onUpperLevel,float z);
|
||||
|
@ -44,11 +44,13 @@ All rights reserved.
|
||||
#include "State_OverworldMap.h"
|
||||
#include "GameEvent.h"
|
||||
#include "SaveFile.h"
|
||||
#include "MenuComponent.h"
|
||||
|
||||
INCLUDE_MONSTER_LIST
|
||||
INCLUDE_game
|
||||
|
||||
void State_GameHub::OnStateChange(GameState*prevState){
|
||||
Component<MenuComponent>(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut(true);
|
||||
if(Menu::IsMenuOpen()){
|
||||
Menu::CloseAllMenus();
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ INCLUDE_MONSTER_LIST
|
||||
INCLUDE_game
|
||||
|
||||
void State_LevelComplete::OnStateChange(GameState*prevState){
|
||||
game->ResumeGame();
|
||||
if(xpGainSound==std::numeric_limits<size_t>::max()){
|
||||
xpGainSound=Audio::LoadAndPlay("xpgain.ogg"_SFX,true);
|
||||
Audio::Engine().SetVolume(xpGainSound,0.f);
|
||||
|
@ -60,6 +60,7 @@ State_OverworldMap::State_OverworldMap(){
|
||||
SetStageMarker("Stage I-I"); //Eventually we will load the game from a file and this will not be necessary. We just set it to this for now.
|
||||
}
|
||||
void State_OverworldMap::OnStateChange(GameState*prevState){
|
||||
Component<MenuComponent>(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut(false);
|
||||
SaveFile::SaveGame();
|
||||
game->LoadLevel("WORLD_MAP");
|
||||
if(Menu::IsMenuOpen()){
|
||||
|
@ -1,18 +1,10 @@
|
||||
January 1st
|
||||
===========
|
||||
- Implement escape menu during gameplay.
|
||||
- If you leave a stage, the stage complete window still shows up, showing only the loot you obtained that session.
|
||||
|
||||
- Clamp bosses in boss arenas.
|
||||
|
||||
- Track items used during a stage, on death, restore the loadout item quantities used.
|
||||
|
||||
- Toggle between Playstation / Xbox controller gamepad displays
|
||||
- Rebind FACELEFT/FACERIGHT menu keys
|
||||
|
||||
Open window to the correct position/size at the beginning of the game if possible.
|
||||
|
||||
Input HElper disappearing? (Possibly on loads)
|
||||
Add Bonus XP when completing a stage
|
||||
|
||||
January 31st
|
||||
============
|
||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 7432
|
||||
#define VERSION_BUILD 7447
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user