Controller compatibility implemented for Blacksmith window. Release Build 7258.

pull/35/head
sigonasr2 1 year ago
parent d8d50f74a7
commit 138e194246
  1. 3
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 1
      Adventures in Lestoria/AdventuresInLestoria.h
  3. 230
      Adventures in Lestoria/BlacksmithCraftingWindow.cpp
  4. 4
      Adventures in Lestoria/MenuType.h
  5. 20
      Adventures in Lestoria/MerchantWindow.cpp
  6. 2
      Adventures in Lestoria/Version.h
  7. BIN
      x64/Release/Adventures in Lestoria.exe

@ -132,7 +132,6 @@ InputGroup AiL::KEY_SCROLLVERT_L;
InputGroup AiL::KEY_SCROLL;
InputGroup AiL::KEY_SHOULDER;
InputGroup AiL::KEY_CHANGE_LOADOUT;
InputGroup AiL::KEY_MOUSE_HOLDDOWN;
#ifndef __EMSCRIPTEN__
::discord::Core*Discord{};
@ -2556,8 +2555,6 @@ void AiL::InitializeDefaultKeybinds(){
KEY_UNEQUIP.AddKeybind({KEY,R});
KEY_UNEQUIP.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::FACE_U)});
KEY_MOUSE_HOLDDOWN.AddKeybind({MOUSE,Mouse::LEFT});
#define TieMenuNameToMenuInputGroup(KEY_NAME) \
InputGroup::menuNamesToInputGroups[DATA["Inputs"][#KEY_NAME].GetString()]=&KEY_NAME; \
InputGroup::menuInputGroups.push_back(DATA["Inputs"][#KEY_NAME].GetString());

@ -105,7 +105,6 @@ public:
static InputGroup KEY_SCROLL;
static InputGroup KEY_SHOULDER;
static InputGroup KEY_CHANGE_LOADOUT;
static InputGroup KEY_MOUSE_HOLDDOWN;
static float SIZE_CHANGE_SPEED;
double levelTime;

@ -77,6 +77,12 @@ void Menu::InitializeBlacksmithCraftingWindow(){
Component<RowInventoryScrollableWindowComponent>(BLACKSMITH,"Weapon Inventory Display")->Enable();
Component<RowInventoryScrollableWindowComponent>(BLACKSMITH,"Armor Inventory Display")->Disable();
data.component.lock()->selected=true;
std::vector<std::weak_ptr<MenuComponent>>*itemList=&Component<RowInventoryScrollableWindowComponent>(data.menu.GetType(),"Weapon Inventory Display")->GetComponents();
if(itemList->size()>0){
data.menu.SetSelection((*itemList)[0]);
}else{
data.menu.SetSelection(std::weak_ptr<MenuComponent>(Component<MenuComponent>(data.menu.GetType(),"Leave Button")));
}
return true;
})END;
weaponTab->selected=true;
@ -86,6 +92,12 @@ void Menu::InitializeBlacksmithCraftingWindow(){
Component<RowInventoryScrollableWindowComponent>(BLACKSMITH,"Weapon Inventory Display")->Disable();
Component<RowInventoryScrollableWindowComponent>(BLACKSMITH,"Armor Inventory Display")->Enable();
data.component.lock()->selected=true;
std::vector<std::weak_ptr<MenuComponent>>*itemList=&Component<RowInventoryScrollableWindowComponent>(data.menu.GetType(),"Armor Inventory Display")->GetComponents();
if(itemList->size()>0){
data.menu.SetSelection((*itemList)[0]);
}else{
data.menu.SetSelection(std::weak_ptr<MenuComponent>(Component<MenuComponent>(data.menu.GetType(),"Leave Button")));
}
return true;
})END;
armorTab->selectionType=SelectionType::HIGHLIGHT;
@ -202,4 +214,222 @@ void Menu::InitializeBlacksmithCraftingWindow(){
Menu::CloseMenu();
return true;
},vf2d{2,2})END;
blacksmithWindow->SetupKeyboardNavigation(
[](MenuType type,Data&returnData){ //On Open
if(Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->IsEnabled()){
auto&weaponsList=Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->GetComponents();
if(weaponsList.size()>0){
returnData=weaponsList[0];
}else{
returnData="Leave Button";
}
}else{
auto&armorList=Component<RowInventoryScrollableWindowComponent>(type,"Armor Inventory Display")->GetComponents();
if(armorList.size()>0){
returnData=armorList[0];
}else{
returnData="Leave Button";
}
}
},
{ //Button Key
{game->KEY_BACK,{"Leave",[](MenuType type){
Menu::CloseMenu();
}}},
{game->KEY_CONFIRM,{"Select",[](MenuType type){}}},
{{game->KEY_SHOULDER,Pressed},{"Scroll Up/Down",[](MenuType type){}}},
{{game->KEY_FASTSCROLLDOWN,PressedDAS},{"",[&](MenuType type){
if(!Menu::menus[type]->GetSelection().expired()&&
!Menu::menus[type]->GetSelection().lock()->parentComponent.expired()){
Menu::menus[type]->GetSelection().lock()->parentComponent.lock()->IncreaseSelectionIndex(3.f);
}
}}},
{{game->KEY_FASTSCROLLUP,PressedDAS},{"",[&](MenuType type){
if(!Menu::menus[type]->GetSelection().expired()&&
!Menu::menus[type]->GetSelection().lock()->parentComponent.expired()){
Menu::menus[type]->GetSelection().lock()->parentComponent.lock()->IncreaseSelectionIndex(-3.f);
}
}}},
{{game->KEY_FACELEFT,Pressed},{[](MenuFuncData data){
if(Component<RowInventoryScrollableWindowComponent>(data.menu.GetType(),"Weapon Inventory Display")->IsEnabled()){
return "Armor List";
}else{
return "Weapon List";
}
},[](MenuType type){
if(Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->IsEnabled()){
Component<MenuComponent>(type,"Armor Tab")->Click();
}else{
Component<MenuComponent>(type,"Weapon Tab")->Click();
}
}}},
{{game->KEY_SCROLL,Pressed},{"Navigate",[](MenuType type){}}},
}
,{ //Button Navigation Rules
{"Weapon Tab",{
.up="Leave Button",
.down=[](MenuType type,Data&returnData){
std::vector<std::weak_ptr<MenuComponent>>*itemList=&Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->GetComponents(); //By default we'll reference the weapon display as we assume being from the weapon tab, we are probably lookinga t weapons. However, there is an edge case where hovering over the weapon tab but pressing down using a non-mouse navigational method while viewing the armor tab will cause the cursor to simply vanish. So, we have to interrogate both the weapon and armor inventories to make sure we grab the right one.
if(!Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->IsEnabled()){
itemList=&Component<RowInventoryScrollableWindowComponent>(type,"Armor Inventory Display")->GetComponents(); //By default we'll reference the weapon display as we assume being from the weapon tab, we are probably lookinga t weapons. However, there is an edge case where hovering over the weapon tab but pressing down using a non-mouse navigational method while viewing the armor tab will cause the cursor to simply vanish. So, we have to interrogate both the weapon and armor inventories to make sure we grab the right one.
}
if(itemList->size()>0){
returnData=(*itemList)[0];
}else{
returnData="Leave Button";
}
},
.left=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Armor Tab")->Click();
returnData=Menu::menus[type]->GetSelection();
},
.right=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Armor Tab")->Click();
returnData=Menu::menus[type]->GetSelection();
},
}},
{"Armor Tab",{
.up="Leave Button",
.down=[](MenuType type,Data&returnData){
std::vector<std::weak_ptr<MenuComponent>>*itemList=&Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->GetComponents(); //By default we'll reference the weapon display as we assume being from the weapon tab, we are probably lookinga t weapons. However, there is an edge case where hovering over the weapon tab but pressing down using a non-mouse navigational method while viewing the armor tab will cause the cursor to simply vanish. So, we have to interrogate both the weapon and armor inventories to make sure we grab the right one.
if(!Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->IsEnabled()){
itemList=&Component<RowInventoryScrollableWindowComponent>(type,"Armor Inventory Display")->GetComponents(); //By default we'll reference the weapon display as we assume being from the weapon tab, we are probably lookinga t weapons. However, there is an edge case where hovering over the weapon tab but pressing down using a non-mouse navigational method while viewing the armor tab will cause the cursor to simply vanish. So, we have to interrogate both the weapon and armor inventories to make sure we grab the right one.
}
if(itemList->size()>0){
returnData=(*itemList)[0];
}else{
returnData="Leave Button";
}
},
.left=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Weapon Tab")->Click();
returnData=Menu::menus[type]->GetSelection();
},
.right=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Weapon Tab")->Click();
returnData=Menu::menus[type]->GetSelection();
},
}},
{"Leave Button",{
.up=[](MenuType type,Data&returnData){
std::vector<std::weak_ptr<MenuComponent>>*itemList=&Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->GetComponents(); //By default we'll reference the weapon display as we assume being from the weapon tab, we are probably lookinga t weapons. However, there is an edge case where hovering over the weapon tab but pressing down using a non-mouse navigational method while viewing the armor tab will cause the cursor to simply vanish. So, we have to interrogate both the weapon and armor inventories to make sure we grab the right one.
if(!Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->IsEnabled()){
itemList=&Component<RowInventoryScrollableWindowComponent>(type,"Armor Inventory Display")->GetComponents(); //By default we'll reference the weapon display as we assume being from the weapon tab, we are probably lookinga t weapons. However, there is an edge case where hovering over the weapon tab but pressing down using a non-mouse navigational method while viewing the armor tab will cause the cursor to simply vanish. So, we have to interrogate both the weapon and armor inventories to make sure we grab the right one.
}
if(itemList->size()>0){
returnData=(*itemList)[itemList->size()-1];
}else{
returnData="Leave Button";
}
},
.down=[](MenuType type,Data&returnData){
std::vector<std::weak_ptr<MenuComponent>>*itemList=&Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->GetComponents(); //By default we'll reference the weapon display as we assume being from the weapon tab, we are probably lookinga t weapons. However, there is an edge case where hovering over the weapon tab but pressing down using a non-mouse navigational method while viewing the armor tab will cause the cursor to simply vanish. So, we have to interrogate both the weapon and armor inventories to make sure we grab the right one.
if(!Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->IsEnabled()){
itemList=&Component<RowInventoryScrollableWindowComponent>(type,"Armor Inventory Display")->GetComponents(); //By default we'll reference the weapon display as we assume being from the weapon tab, we are probably lookinga t weapons. However, there is an edge case where hovering over the weapon tab but pressing down using a non-mouse navigational method while viewing the armor tab will cause the cursor to simply vanish. So, we have to interrogate both the weapon and armor inventories to make sure we grab the right one.
}
if(itemList->size()>0){
returnData=(*itemList)[0];
}else{
returnData="Leave Button";
}
},
.left=[](MenuType type,Data&returnData){
if(Component<MenuComponent>(type,"Weapon Tab")->selected){
Component<MenuComponent>(type,"Armor Tab")->Click();
}else{
Component<MenuComponent>(type,"Weapon Tab")->Click();
}
returnData=Menu::menus[type]->GetSelection();
},
.right=[](MenuType type,Data&returnData){
if(Component<MenuComponent>(type,"Weapon Tab")->selected){
Component<MenuComponent>(type,"Armor Tab")->Click();
}else{
Component<MenuComponent>(type,"Weapon Tab")->Click();
}
returnData=Menu::menus[type]->GetSelection();
},
}},
{"Weapon Inventory Display",{
.up=[](MenuType type,Data&returnData){
int currentlySelected=int(Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->GetComponentIndex(Menu::menus[type]->GetSelection()));
if(currentlySelected!=Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->GetComponents().size()){
currentlySelected--;
if(currentlySelected<0){
returnData="Leave Button";
}else{
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->GetComponents()[currentlySelected];
}
}else ERR("Could not find the selected component inside the Weapon Inventory Display. THIS SHOULD NOT BE HAPPENING!")
},
.down=[](MenuType type,Data&returnData){
int currentlySelected=int(Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->GetComponentIndex(Menu::menus[type]->GetSelection()));
if(currentlySelected!=Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->GetComponents().size()){
currentlySelected++;
if(currentlySelected>=Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->GetComponents().size()){
returnData="Leave Button";
}else{
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Weapon Inventory Display")->GetComponents()[currentlySelected];
}
}else ERR("Could not find the selected component inside the Weapon Inventory Display. THIS SHOULD NOT BE HAPPENING!")
},
.left=[](MenuType type,Data&returnData){
if(Component<MenuComponent>(type,"Weapon Tab")->selected){
Component<MenuComponent>(type,"Armor Tab")->Click();
}else{
Component<MenuComponent>(type,"Weapon Tab")->Click();
}
returnData=Menu::menus[type]->GetSelection();
},
.right=[](MenuType type,Data&returnData){
if(Component<MenuComponent>(type,"Weapon Tab")->selected){
Component<MenuComponent>(type,"Armor Tab")->Click();
}else{
Component<MenuComponent>(type,"Weapon Tab")->Click();
}
returnData=Menu::menus[type]->GetSelection();
},
}},
{"Armor Inventory Display",{
.up=[](MenuType type,Data&returnData){
int currentlySelected=int(Component<RowInventoryScrollableWindowComponent>(type,"Armor Inventory Display")->GetComponentIndex(Menu::menus[type]->GetSelection()));
if(currentlySelected!=Component<RowInventoryScrollableWindowComponent>(type,"Armor Inventory Display")->GetComponents().size()){
currentlySelected--;
if(currentlySelected<0){
returnData="Leave Button";
}else{
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Armor Inventory Display")->GetComponents()[currentlySelected];
}
}else ERR("Could not find the selected component inside the Armor Inventory Display. THIS SHOULD NOT BE HAPPENING!")
},
.down=[](MenuType type,Data&returnData){
int currentlySelected=int(Component<RowInventoryScrollableWindowComponent>(type,"Armor Inventory Display")->GetComponentIndex(Menu::menus[type]->GetSelection()));
if(currentlySelected!=Component<RowInventoryScrollableWindowComponent>(type,"Armor Inventory Display")->GetComponents().size()){
currentlySelected++;
if(currentlySelected>=Component<RowInventoryScrollableWindowComponent>(type,"Armor Inventory Display")->GetComponents().size()){
returnData="Leave Button";
}else{
returnData=Component<RowInventoryScrollableWindowComponent>(type,"Armor Inventory Display")->GetComponents()[currentlySelected];
}
}else ERR("Could not find the selected component inside the Armor Inventory Display. THIS SHOULD NOT BE HAPPENING!")
},
.left=[](MenuType type,Data&returnData){
if(Component<MenuComponent>(type,"Weapon Tab")->selected){
Component<MenuComponent>(type,"Armor Tab")->Click();
}else{
Component<MenuComponent>(type,"Weapon Tab")->Click();
}
returnData=Menu::menus[type]->GetSelection();
},
.right=[](MenuType type,Data&returnData){
if(Component<MenuComponent>(type,"Weapon Tab")->selected){
Component<MenuComponent>(type,"Armor Tab")->Click();
}else{
Component<MenuComponent>(type,"Weapon Tab")->Click();
}
returnData=Menu::menus[type]->GetSelection();
},
}},
});
}

@ -41,7 +41,7 @@ enum MenuType{
///////////////////////////////////////////////////////////
/*DO NOT REMOVE!!*/ENUM_START,///////////////////////////////
///////////////////////////////////////////////////////////
// 52% Controller Compatibility. (100 total items, 4 items per menu * 25 menus)
// 56% 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
@ -55,7 +55,7 @@ enum MenuType{
MERCHANT, //100% Controller Compatibility
BUY_ITEM, //100% Controller Compatibility
SELL_ITEM, //100% Controller Compatibility
BLACKSMITH, //0% Controller Compatibility
BLACKSMITH, //100% Controller Compatibility
CRAFT_ITEM, //0% Controller Compatibility
CRAFT_CONSUMABLE, //0% Controller Compatibility
CONSUMABLE_CRAFT_ITEM, //0% Controller Compatibility

@ -835,8 +835,14 @@ void Menu::InitializeMerchantWindow(){
}
}
},
.left="Sell Tab",
.right="Sell Tab",
.left=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Sell Tab")->Click();
returnData="Sell Tab";
},
.right=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Sell Tab")->Click();
returnData="Sell Tab";
},
}},
{"Sell Tab",{
.up="Leave Button",
@ -853,8 +859,14 @@ void Menu::InitializeMerchantWindow(){
}
}
},
.left="Buy Tab",
.right="Buy Tab",
.left=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Buy Tab")->Click();
returnData="Buy Tab";
},
.right=[](MenuType type,Data&returnData){
Component<MenuComponent>(type,"Buy Tab")->Click();
returnData="Buy Tab";
},
}},
});
}

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 3
#define VERSION_PATCH 0
#define VERSION_BUILD 7249
#define VERSION_BUILD 7258
#define stringify(a) stringify_(a)
#define stringify_(a) #a

Loading…
Cancel
Save