diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 460cd863..4950fdc1 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -117,6 +117,7 @@ InputGroup AiL::KEY_FACEUP; InputGroup AiL::KEY_FACERIGHT; InputGroup AiL::KEY_FACELEFT; InputGroup AiL::KEY_FACEDOWN; +InputGroup AiL::KEY_ENTER; InputGroup AiL::KEY_SCROLLDOWN; InputGroup AiL::KEY_SCROLLUP; @@ -2503,6 +2504,8 @@ void AiL::InitializeDefaultKeybinds(){ KEY_MENU.AddKeybind({KEY,ESCAPE}); KEY_MENU.AddKeybind({CONTROLLER,static_cast(GPButtons::START)}); + KEY_ENTER.AddKeybind({KEY,ENTER}); + KEY_FASTSCROLLUP.AddKeybind({KEY,Q}); KEY_FASTSCROLLUP.AddKeybind({KEY,PGUP}); KEY_FASTSCROLLUP.AddKeybind({KEY,NP8}); diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 5cfaf0a6..18c7ce47 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -105,6 +105,7 @@ public: static InputGroup KEY_SCROLL; static InputGroup KEY_SHOULDER; static InputGroup KEY_CHANGE_LOADOUT; + static InputGroup KEY_ENTER; static float SIZE_CHANGE_SPEED; double levelTime; diff --git a/Adventures in Lestoria/InputHelper.cpp b/Adventures in Lestoria/InputHelper.cpp index c31195b4..ef495764 100644 --- a/Adventures in Lestoria/InputHelper.cpp +++ b/Adventures in Lestoria/InputHelper.cpp @@ -50,6 +50,12 @@ void InputHelper::Initialize(MenuInputGroups&inputGroups){ this->inputGroups.clear(); for(auto&data:inputGroups){ if(data.first.GetLabelVisible()){ //If the label is not visible, we don't care to include it in our list. + if(std::holds_alternative(data.second.first)){ + const ButtonName&name=std::get(data.second.first); + groupedInputs[name].push_back(data.first.GetGroup()); + + if(groupedInputs[name].size()>1)continue; //Skip adding to the list of input groups because this input already has been added. + } this->inputGroups[data.first.GetGroup()]=data.second.first; } } @@ -69,11 +75,18 @@ void InputHelper::Draw(){ case KEY:{ float buttonImgWidth=0.f; float buttonDescriptionWidth=0.f; - std::vector>buttonImgs; //Store decals for buttons that actually have images, and strings for buttons that have labels. + std::vector>>buttonImgs; //Store decals for buttons that actually have images, and strings for buttons that have labels. One button can have multiple icons. Store them all together. std::vectorbuttonDescriptions; #pragma region Populate all buttons to display for(auto&[group,display]:inputGroups){ - auto&primaryKey=group.GetPrimaryKey(mode); + + size_t groupedInputCount=1; + std::vectorinputGroupsToCheck; + if(std::holds_alternative(display)&&groupedInputs.count(std::get(display))){ + inputGroupsToCheck=groupedInputs.at(std::get(display)); + }else{ + inputGroupsToCheck.push_back(group); + } std::string displayName; @@ -87,20 +100,27 @@ void InputHelper::Draw(){ displayName=std::get>(display)(MenuFuncData{*Menu::stack.back(),game,Menu::stack.back()->GetSelection(),parentComponent}); } else ERR("WARNING! display contains a variant alternative that does not exist. THIS SHOULD NOT BE HAPPENING!"); - - if(displayName.length()>0&&primaryKey.has_value()){ - if(primaryKey.value().HasIcon()){ - buttonImgWidth+=primaryKey.value().GetIcon().Sprite()->width+"Interface.InputHelperSpacing"_I; - buttonImgs.push_back(primaryKey.value().GetIcon().Decal()); - }else{ - buttonImgWidth+=game->GetTextSizeProp(primaryKey.value().GetDisplayName()).x+"Interface.InputHelperSpacing"_I; - buttonImgs.push_back(primaryKey.value().GetDisplayName()); + + buttonImgs.push_back({}); + std::vector>&iconList=buttonImgs.back(); + + for(InputGroup&group:inputGroupsToCheck){ + auto&primaryKey=group.GetPrimaryKey(mode); + + if(displayName.length()>0&&primaryKey.has_value()){ + if(primaryKey.value().HasIcon()){ + buttonImgWidth+=primaryKey.value().GetIcon().Sprite()->width+"Interface.InputHelperSpacing"_I; + iconList.push_back(primaryKey.value().GetIcon().Decal()); + }else{ + buttonImgWidth+=game->GetTextSizeProp(primaryKey.value().GetDisplayName()).x+"Interface.InputHelperSpacing"_I; + iconList.push_back(primaryKey.value().GetDisplayName()); + } } - - vf2d descriptionSize=game->GetTextSizeProp(displayName); - buttonDescriptionWidth+=descriptionSize.x+"Interface.InputHelperSpacing"_I; - buttonDescriptions.push_back(displayName); } + + vf2d descriptionSize=game->GetTextSizeProp(displayName); + buttonDescriptionWidth+=descriptionSize.x+"Interface.InputHelperSpacing"_I; + buttonDescriptions.push_back(displayName); } #pragma endregion @@ -119,27 +139,28 @@ void InputHelper::Draw(){ #pragma region Draw all button inputs and descriptions float xOffset="Interface.InputHelperSpacing"_I; - for(size_t index=0;auto&button:buttonImgs){ - if(std::holds_alternative(button)){ - Decal*img=std::get(button); - game->DrawDecal(vf2d{xOffset,float(WINDOW_SIZE.y-img->sprite->height)-4},img); - xOffset+=img->sprite->width+"Interface.InputHelperSpacing"_I; - }else - if(std::holds_alternative(button)){ - std::string label=std::get(button); - vf2d textSize=game->GetTextSizeProp(label); - game->FillRectDecal(vf2d{xOffset-2,float(WINDOW_SIZE.y-textSize.y-6)},vf2d{textSize.x+4,textSize.y},"Interface.InputButtonBackCol"_Pixel); - game->FillRectDecal(vf2d{xOffset-1,float(WINDOW_SIZE.y-textSize.y-6)-1.f},vf2d{textSize.x+2,textSize.y},"Interface.InputButtonBackCol"_Pixel); - game->FillRectDecal(vf2d{xOffset-1,float(WINDOW_SIZE.y-textSize.y-6)},vf2d{textSize.x+2,textSize.y+1.f},"Interface.InputButtonBackCol"_Pixel); - game->DrawStringPropDecal(vf2d{xOffset,float(WINDOW_SIZE.y-textSize.y-6)},label,"Interface.InputButtonTextCol"_Pixel); - xOffset+=textSize.x+"Interface.InputHelperSpacing"_I; - }else [[unlikely]]ERR("WARNING! Hit a state where no data is inside of the button! THIS SHOULD NOT BE HAPPENING!"); - + for(size_t index=0;auto&buttonList:buttonImgs){ + for(std::variantbutton:buttonList){ + if(std::holds_alternative(button)){ + Decal*img=std::get(button); + game->DrawDecal(vf2d{xOffset,float(WINDOW_SIZE.y-img->sprite->height)-4},img); + xOffset+=img->sprite->width+"Interface.InputHelperSpacing"_I; + }else + if(std::holds_alternative(button)){ + std::string label=std::get(button); + vf2d textSize=game->GetTextSizeProp(label); + game->FillRectDecal(vf2d{xOffset-2,float(WINDOW_SIZE.y-textSize.y-6)},vf2d{textSize.x+4,textSize.y},"Interface.InputButtonBackCol"_Pixel); + game->FillRectDecal(vf2d{xOffset-1,float(WINDOW_SIZE.y-textSize.y-6)-1.f},vf2d{textSize.x+2,textSize.y},"Interface.InputButtonBackCol"_Pixel); + game->FillRectDecal(vf2d{xOffset-1,float(WINDOW_SIZE.y-textSize.y-6)},vf2d{textSize.x+2,textSize.y+1.f},"Interface.InputButtonBackCol"_Pixel); + game->DrawStringPropDecal(vf2d{xOffset,float(WINDOW_SIZE.y-textSize.y-6)},label,"Interface.InputButtonTextCol"_Pixel); + xOffset+=textSize.x+"Interface.InputHelperSpacing"_I; + }else [[unlikely]]ERR("WARNING! Hit a state where no data is inside of the button! THIS SHOULD NOT BE HAPPENING!"); + } std::string_view description=buttonDescriptions[index]; vf2d descriptionTextSize=game->GetTextSizeProp(description)*vf2d{buttonDescriptionScaleX,1.f}; game->DrawShadowStringPropDecal(vf2d{xOffset,float(WINDOW_SIZE.y-descriptionTextSize.y-6)},description,WHITE,BLACK,vf2d{buttonDescriptionScaleX,1.f}); xOffset+=descriptionTextSize.x+"Interface.InputHelperSpacing"_I*buttonDescriptionScaleX; - + index++; } #pragma endregion diff --git a/Adventures in Lestoria/InputHelper.h b/Adventures in Lestoria/InputHelper.h index d355fdd6..8e08801b 100644 --- a/Adventures in Lestoria/InputHelper.h +++ b/Adventures in Lestoria/InputHelper.h @@ -45,6 +45,7 @@ All rights reserved. class InputHelper{ std::mapinputGroups; + std::map>groupedInputs; const InputType InputMode()const; diff --git a/Adventures in Lestoria/SaveFileWindow.cpp b/Adventures in Lestoria/SaveFileWindow.cpp index d4712ed3..69f1cc70 100644 --- a/Adventures in Lestoria/SaveFileWindow.cpp +++ b/Adventures in Lestoria/SaveFileWindow.cpp @@ -63,6 +63,9 @@ void Menu::InitializeSaveFileWindow(){ {game->KEY_START,{"Confirm Character Name",[](MenuType type){ Component(type,"Continue Button")->Click(); }}}, + {game->KEY_ENTER,{"Confirm Character Name",[](MenuType type){ + Component(type,"Continue Button")->Click(); + }}}, {game->KEY_SELECT,{"Cancel",[](MenuType type){ Component(type,"Back Button")->Click(); }}}, diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 3fab0475..cb8c83c6 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -9,6 +9,8 @@ January 1st - Add screen shake and rumble as a toggle. +- Toggle between Playstation / Xbox controller gamepad displays +- Rebind FACELEFT/FACERIGHT menu keys (as they are used constantly throughout menus and would need to be rebinded if the player wants). (Or make confirm/back not rebindable) January 31st ============ diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 86a3d281..bda03121 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 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 7300 +#define VERSION_BUILD 7313 #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 881a095d..53801b39 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ