diff --git a/Adventures in Lestoria/CharacterMenuWindow.cpp b/Adventures in Lestoria/CharacterMenuWindow.cpp index 0807bbce..52ab3d05 100644 --- a/Adventures in Lestoria/CharacterMenuWindow.cpp +++ b/Adventures in Lestoria/CharacterMenuWindow.cpp @@ -267,6 +267,7 @@ void Menu::InitializeCharacterMenuWindow(){ return true; },[](MenuFuncData data){//On Mouse Hover EquipSlot slot=DYNAMIC_POINTER_CAST(data.component.lock())->GetSlot(); + data.menu.I(A::ITEM_SLOT)=int(slot); const std::weak_ptrequip=Inventory::GetEquip(slot); if(!ISBLANK(equip)){ Component(data.component.lock()->parentMenu,"Character Rotating Display")->Disable(); @@ -324,37 +325,98 @@ void Menu::InitializeCharacterMenuWindow(){ {game->KEY_CONFIRM,{"Select",[](MenuType type){}}}, } ,{ //Button Navigation Rules - {"Equip List",{}}, + {"Equip List",{ + .up=[](MenuType type,Data&returnData){ + if(!Menu::menus[type]->GetSelection().expired()){ + auto selection=Menu::menus[type]->GetSelection().lock(); + size_t index=Component(type,"Equip List")->GetComponentIndex(selection); + index=std::clamp(index-1,size_t(0),Component(type,"Equip List")->GetComponents().size()-1); + returnData=Component(type,"Equip List")->GetComponents()[index]; + } + }, + .down=[](MenuType type,Data&returnData){ + if(!Menu::menus[type]->GetSelection().expired()){ + auto selection=Menu::menus[type]->GetSelection().lock(); + size_t index=Component(type,"Equip List")->GetComponentIndex(selection); + index=std::clamp(index+1,size_t(0),Component(type,"Equip List")->GetComponents().size()-1); + returnData=Component(type,"Equip List")->GetComponents()[index]; + } + }, + .left=[](MenuType type,Data&returnData){ + auto equipList=Component(type,"Equip List")->GetComponents(); + returnData=std::format("Equip Slot {}",slotNames[std::bit_width(unsigned(Menu::menus[type]->I(A::EQUIP_TYPE)))-1]); + }, + .right=[](MenuType type,Data&returnData){ + auto equipList=Component(type,"Equip List")->GetComponents(); + returnData=std::format("Equip Slot {}",slotNames[std::bit_width(unsigned(Menu::menus[type]->I(A::EQUIP_TYPE)))-1]); + } + }}, + {"Equip Selection Select Button",{ + .up=[](MenuType type,Data&returnData){ + auto equipList=Component(type,"Equip List")->GetComponents(); + returnData="Equip Selection Select Button"; + if(equipList.size()>0){ + returnData=equipList.back(); + } + }, + .down=[](MenuType type,Data&returnData){ + auto equipList=Component(type,"Equip List")->GetComponents(); + returnData="Equip Selection Select Button"; + if(equipList.size()>0){ + returnData=equipList.front(); + } + }, + .left=[](MenuType type,Data&returnData){ + auto equipList=Component(type,"Equip List")->GetComponents(); + returnData=std::format("Equip Slot {}",slotNames[std::bit_width(unsigned(Menu::menus[type]->I(A::EQUIP_TYPE)))-1]); + }, + .right=[](MenuType type,Data&returnData){ + auto equipList=Component(type,"Equip List")->GetComponents(); + returnData=std::format("Equip Slot {}",slotNames[std::bit_width(unsigned(Menu::menus[type]->I(A::EQUIP_TYPE)))-1]); + } + }}, {std::format("Equip Slot {}", slotNames[0]),{ .up="Back button", .down=std::format("Equip Slot {}", slotNames[2]), - .left=std::format("Equip Slot {}", slotNames[1]), + .left=[](MenuType type,Data&returnData){ + Menu::menus[type]->SetSelection(Component(type,"Equip List")->GetComponents()[std::bit_width(unsigned(Menu::menus[type]->I(A::ITEM_SLOT)))-1]); + }, .right=std::format("Equip Slot {}", slotNames[1]),}}, {std::format("Equip Slot {}", slotNames[1]),{ .up="Back button", .down=std::format("Equip Slot {}", slotNames[3]), .left=std::format("Equip Slot {}", slotNames[0]), - .right=std::format("Equip Slot {}", slotNames[0]),}}, + .right=[](MenuType type,Data&returnData){ + Menu::menus[type]->SetSelection(Component(type,"Equip List")->GetComponents()[std::bit_width(unsigned(Menu::menus[type]->I(A::ITEM_SLOT)))-1]); + },}}, {std::format("Equip Slot {}", slotNames[2]),{ .up=std::format("Equip Slot {}", slotNames[0]), .down=std::format("Equip Slot {}", slotNames[4]), - .left=std::format("Equip Slot {}", slotNames[3]), + .left=[](MenuType type,Data&returnData){ + Menu::menus[type]->SetSelection(Component(type,"Equip List")->GetComponents()[std::bit_width(unsigned(Menu::menus[type]->I(A::ITEM_SLOT)))-1]); + }, .right=std::format("Equip Slot {}", slotNames[3]),}}, {std::format("Equip Slot {}", slotNames[3]),{ .up=std::format("Equip Slot {}", slotNames[1]), .down=std::format("Equip Slot {}", slotNames[5]), .left=std::format("Equip Slot {}", slotNames[2]), - .right=std::format("Equip Slot {}", slotNames[2]),}}, + .right=[](MenuType type,Data&returnData){ + Menu::menus[type]->SetSelection(Component(type,"Equip List")->GetComponents()[std::bit_width(unsigned(Menu::menus[type]->I(A::ITEM_SLOT)))-1]); + },}}, {std::format("Equip Slot {}", slotNames[4]),{ .up=std::format("Equip Slot {}", slotNames[2]), .down=std::format("Equip Slot {}", slotNames[6]), - .left=std::format("Equip Slot {}", slotNames[5]), + .left=[](MenuType type,Data&returnData){ + Menu::menus[type]->SetSelection(Component(type,"Equip List")->GetComponents()[std::bit_width(unsigned(Menu::menus[type]->I(A::ITEM_SLOT)))-1]); + }, .right=std::format("Equip Slot {}", slotNames[5]),}}, {std::format("Equip Slot {}", slotNames[5]),{ .up=std::format("Equip Slot {}", slotNames[3]), .down=std::format("Equip Slot {}", slotNames[7]), .left=std::format("Equip Slot {}", slotNames[4]), - .right=std::format("Equip Slot {}", slotNames[4]),}}, + .right=[](MenuType type,Data&returnData){ + std::format("Equip Slot {}", slotNames[4]); + },}}, {std::format("Equip Slot {}", slotNames[6]),{ .up=std::format("Equip Slot {}", slotNames[4]), .down="Back button", @@ -363,12 +425,16 @@ void Menu::InitializeCharacterMenuWindow(){ {std::format("Equip Slot {}", slotNames[7]),{ .up=std::format("Equip Slot {}", slotNames[5]), .down="Back button", - .left=std::format("Equip Slot {}", slotNames[6]), + .left=[](MenuType type,Data&returnData){ + Menu::menus[type]->SetSelection(Component(type,"Equip List")->GetComponents()[std::bit_width(unsigned(Menu::menus[type]->I(A::ITEM_SLOT)))-1]); + }, .right=std::format("Equip Slot {}", slotNames[6]),}}, {"Back button",{ .up=std::format("Equip Slot {}", slotNames[7]), .down=std::format("Equip Slot {}", slotNames[0]), .left=std::format("Equip Slot {}", slotNames[7]), - .right=std::format("Equip Slot {}", slotNames[6]),}}, + .right=[](MenuType type,Data&returnData){ + Menu::menus[type]->SetSelection(Component(type,"Equip List")->GetComponents()[std::bit_width(unsigned(Menu::menus[type]->I(A::ITEM_SLOT)))-1]); + },}}, }); } \ No newline at end of file diff --git a/Adventures in Lestoria/Menu.cpp b/Adventures in Lestoria/Menu.cpp index 72810c7d..3eee334a 100644 --- a/Adventures in Lestoria/Menu.cpp +++ b/Adventures in Lestoria/Menu.cpp @@ -45,6 +45,7 @@ All rights reserved. #include "RowInventoryScrollableWindowComponent.h" #include "MenuItemItemButton.h" #include +#include "SoundEffect.h" INCLUDE_ITEM_CATEGORIES INCLUDE_DATA @@ -64,6 +65,7 @@ MenuType Menu::lastMenuTypeCreated; std::string Menu::lastRegisteredComponent; bool Menu::alreadyClicked=false; bool Menu::scrolling=false; +std::weak_ptrMenu::lastHover; INCLUDE_game INCLUDE_GFX @@ -152,6 +154,7 @@ void Menu::MenuSelect(AiL*game){ if(buttonStillValid){ if(selection.lock()->menuDest!=MenuType::ENUM_END){ if(stack.size()menuDest); //Navigate to the next menu. }else{ ERR("WARNING! Exceeded menu stack size limit!") @@ -188,6 +191,8 @@ void Menu::Update(AiL*game){ if(component->selectable){ if(!component->disable&&!component->disableOutsideWindow&&!component->grayedOut){ if(component->GetHoverState(game)){ + if(!Menu::lastHover.expired()&&&*component!=&*Menu::lastHover.lock())SoundEffect::PlaySFX("Menu Navigate",SoundEffect::CENTERED); + Menu::lastHover=component; component->hovered=true; itemHovered=true; SetSelection(std::weak_ptr(component)); @@ -356,6 +361,7 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){ if(navigationGroups.count(selectionButtonName)){ Navigation nav=navigationGroups[selectionButtonName]; if(game->KEY_UP.PressedDAS()||game->KEY_SCROLLUP.AnalogDAS(0.5f)<-0.5f){ + SoundEffect::PlaySFX("Menu Navigate",SoundEffect::CENTERED); SetMouseNavigation(false); if(std::holds_alternative(nav.up)&&std::get(nav.up).length()>0)SetSelection(std::string_view(std::get(nav.up))); else @@ -366,6 +372,7 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){ } } if(game->KEY_DOWN.PressedDAS()||game->KEY_SCROLLDOWN.AnalogDAS(0.5f)>0.5f){ + SoundEffect::PlaySFX("Menu Navigate",SoundEffect::CENTERED); SetMouseNavigation(false); if(std::holds_alternative(nav.down)&&std::get(nav.down).length()>0)SetSelection(std::string_view(std::get(nav.down))); else @@ -376,6 +383,7 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){ } } if(game->KEY_LEFT.PressedDAS()||game->KEY_SCROLLLEFT.AnalogDAS(0.5f)<-0.5f){ + SoundEffect::PlaySFX("Menu Navigate",SoundEffect::CENTERED); SetMouseNavigation(false); if(std::holds_alternative(nav.left)&&std::get(nav.left).length()>0)SetSelection(std::string_view(std::get(nav.left))); else @@ -386,6 +394,7 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){ } } if(game->KEY_RIGHT.PressedDAS()||game->KEY_SCROLLRIGHT.AnalogDAS(0.5f)>0.5f){ + SoundEffect::PlaySFX("Menu Navigate",SoundEffect::CENTERED); SetMouseNavigation(false); if(std::holds_alternative(nav.right)&&std::get(nav.right).length()>0)SetSelection(std::string_view(std::get(nav.right))); else diff --git a/Adventures in Lestoria/Menu.h b/Adventures in Lestoria/Menu.h index 7196cf48..d7ab4d61 100644 --- a/Adventures in Lestoria/Menu.h +++ b/Adventures in Lestoria/Menu.h @@ -228,6 +228,7 @@ private: InputHelper helpDisplay; static bool MOUSE_NAVIGATION; + static std::weak_ptrlastHover; bool cover; //A black cover for when a menu pops up to fade out the stuff behind it. }; diff --git a/Adventures in Lestoria/MenuType.h b/Adventures in Lestoria/MenuType.h index c307c6b0..04f2b29e 100644 --- a/Adventures in Lestoria/MenuType.h +++ b/Adventures in Lestoria/MenuType.h @@ -41,7 +41,7 @@ enum MenuType{ /////////////////////////////////////////////////////////// /*DO NOT REMOVE!!*/ENUM_START,/////////////////////////////// /////////////////////////////////////////////////////////// - // 32% Controller Compatibility. (100 total items, 4 items per menu * 25 menus) + // 34% 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 @@ -50,7 +50,7 @@ enum MenuType{ ITEM_LOADOUT, //100% Controller Compatibility LEVEL_COMPLETE, //100% Controller Compatibility OVERWORLD_MENU, //100% Controller Compatibility - CHARACTER_MENU, //0% Controller Compatibility + CHARACTER_MENU, //50% Controller Compatibility INVENTORY, //0% Controller Compatibility MERCHANT, //0% Controller Compatibility BUY_ITEM, //0% Controller Compatibility diff --git a/Adventures in Lestoria/MonsterAttribute.h b/Adventures in Lestoria/MonsterAttribute.h index d0ec619f..484bb649 100644 --- a/Adventures in Lestoria/MonsterAttribute.h +++ b/Adventures in Lestoria/MonsterAttribute.h @@ -97,4 +97,5 @@ enum class Attribute{ LAST_SFX_VOLUME, IS_KEYBOARD, KEYBIND, + ITEM_SLOT, }; \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 2360dccb..23872079 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 7162 +#define VERSION_BUILD 7167 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/audio/events.txt b/Adventures in Lestoria/assets/config/audio/events.txt index 5c59c4ad..96cf9cba 100644 --- a/Adventures in Lestoria/assets/config/audio/events.txt +++ b/Adventures in Lestoria/assets/config/audio/events.txt @@ -93,6 +93,18 @@ Events # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) File[0] = levelup.ogg, 100% } + Menu Navigate + { + # Muted for now. + # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) + File[0] = menu_navigate.ogg, 0%, 60%, 100% + } + Menu Select + { + # Muted for now. + # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) + File[0] = menu_navigate.ogg, 0% + } Monster Hurt { # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) diff --git a/Adventures in Lestoria/assets/sounds/menu_navigate.ogg b/Adventures in Lestoria/assets/sounds/menu_navigate.ogg new file mode 100644 index 00000000..03248a18 Binary files /dev/null and b/Adventures in Lestoria/assets/sounds/menu_navigate.ogg differ diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 775ca342..f105201c 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ