Added additional toggle and setting options in Settings menu. Made screen shake, gamepad rumble, keyboard aim assist, and terrain collision box display toggles functional. Added toggle sound effect. Release Build 7344.

This commit is contained in:
2024-02-18 22:16:09 -06:00
parent a39a841166
commit d5bd8655a9
22 changed files with 285 additions and 44 deletions
+36 -28
View File
@@ -163,6 +163,12 @@ void Menu::Update(AiL*game){
}
for(auto&[key,button]:components){
if(button->F(A::RUMBLE_TIMER)>0.f){
button->F(A::RUMBLE_TIMER)=std::max(button->F(A::RUMBLE_TIMER)-game->GetElapsedTime(),0.f);
if(button->F(A::RUMBLE_TIMER)==0.f){
Input::StopVibration();
}
}
if(!button->disable||!button->disableOutsideWindow){
button->hovered=false;
}
@@ -316,35 +322,37 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
}
}
for(auto&[input,data]:inputGroups){
if(Menu::alreadyClicked)break;
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(!Menu::UsingMouseNavigation()){
for(auto&[input,data]:inputGroups){
if(Menu::alreadyClicked)break;
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!")
}
}
}
}