Added controller compatibility for buy item menu. Removed restriction on mouse navigation not handling inputs defined in input engage groups of menus. Release Build 7242.

This commit is contained in:
2024-02-16 17:58:10 -06:00
parent 6db0aa3641
commit 5d315ada93
10 changed files with 123 additions and 34 deletions
+27 -29
View File
@@ -316,36 +316,34 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
buttonHoldTime=0;
}
if(!Menu::UsingMouseNavigation()){
for(auto&[input,data]:inputGroups){
bool activated=false;
switch(input.GetEngageType()){
case Released:{
activated=input.GetGroup().Released();
}break;
case Pressed:{
activated=input.GetGroup().Pressed();
}break;
case PressedDAS:{
activated=input.GetGroup().PressedDAS();
}break;
case Held:{
activated=input.GetGroup().Held();
}break;
case Analog:{
activated=input.GetGroup().Analog()!=0.f;
}break;
[[unlikely]]default:ERR(std::format("WARNING! Unhandled input engage type {}! THIS SHOULD NOT BE HAPPENING!",int(input.GetEngageType())));
}
for(auto&[input,data]:inputGroups){
bool activated=false;
switch(input.GetEngageType()){
case Released:{
activated=input.GetGroup().Released();
}break;
case Pressed:{
activated=input.GetGroup().Pressed();
}break;
case PressedDAS:{
activated=input.GetGroup().PressedDAS();
}break;
case Held:{
activated=input.GetGroup().Held();
}break;
case Analog:{
activated=input.GetGroup().Analog()!=0.f;
}break;
[[unlikely]]default:ERR(std::format("WARNING! Unhandled input engage type {}! THIS SHOULD NOT BE HAPPENING!",int(input.GetEngageType())));
}
if(activated){
auto&action=data.second;
if(std::holds_alternative<ButtonName>(action))Component<MenuComponent>(type,std::get<ButtonName>(action))->Click();
else
if(std::holds_alternative<std::function<void(MenuType)>>(action))std::get<std::function<void(MenuType)>>(action)(type);
else{
ERR("WARNING! Navigation data has an unrecognized type or is empty! This should not be happening!")
}
if(activated){
auto&action=data.second;
if(std::holds_alternative<ButtonName>(action))Component<MenuComponent>(type,std::get<ButtonName>(action))->Click();
else
if(std::holds_alternative<std::function<void(MenuType)>>(action))std::get<std::function<void(MenuType)>>(action)(type);
else{
ERR("WARNING! Navigation data has an unrecognized type or is empty! This should not be happening!")
}
}
}