Implement item loadout controller compatibility. Added left analog stick map navigation to overworld map. Release Build 7005.

pull/35/head
sigonasr2 10 months ago
parent 116c3c1a51
commit 5169670b76
  1. 6
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 2
      Adventures in Lestoria/AdventuresInLestoria.h
  3. 9
      Adventures in Lestoria/InventoryConsumableWindow.cpp
  4. 54
      Adventures in Lestoria/ItemLoadoutWindow.cpp
  5. 6
      Adventures in Lestoria/MenuType.h
  6. 16
      Adventures in Lestoria/State_OverworldMap.cpp
  7. 1
      Adventures in Lestoria/State_OverworldMap.h
  8. 2
      Adventures in Lestoria/Version.h
  9. BIN
      x64/Release/Adventures in Lestoria.exe

@ -125,8 +125,10 @@ InputGroup AiL::KEY_FASTSCROLLUP;
InputGroup AiL::KEY_SCROLLLEFT; InputGroup AiL::KEY_SCROLLLEFT;
InputGroup AiL::KEY_SCROLLRIGHT; InputGroup AiL::KEY_SCROLLRIGHT;
InputGroup AiL::KEY_SCROLLHORZ; InputGroup AiL::KEY_SCROLLHORZ;
InputGroup AiL::KEY_SCROLLHORZ_L;
InputGroup AiL::KEY_SCROLLVERT; InputGroup AiL::KEY_SCROLLVERT;
InputGroup AiL::KEY_SCROLLVERT_R; InputGroup AiL::KEY_SCROLLVERT_R;
InputGroup AiL::KEY_SCROLLVERT_L;
InputGroup AiL::KEY_SCROLL; InputGroup AiL::KEY_SCROLL;
InputGroup AiL::KEY_SHOULDER; InputGroup AiL::KEY_SHOULDER;
InputGroup AiL::KEY_CHANGE_LOADOUT; InputGroup AiL::KEY_CHANGE_LOADOUT;
@ -2513,7 +2515,7 @@ void AiL::InitializeDefaultKeybinds(){
KEY_CHANGE_LOADOUT.AddKeybind({KEY,R}); KEY_CHANGE_LOADOUT.AddKeybind({KEY,R});
KEY_CHANGE_LOADOUT.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::FACE_U)}); KEY_CHANGE_LOADOUT.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::FACE_U)});
KEY_START.AddKeybind({KEY,RETURN}); KEY_START.AddKeybind({KEY,SPACE});
KEY_START.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::START)}); KEY_START.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::START)});
KEY_SELECT.AddKeybind({KEY,ESCAPE}); KEY_SELECT.AddKeybind({KEY,ESCAPE});
KEY_SELECT.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::SELECT)}); KEY_SELECT.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::SELECT)});
@ -2537,8 +2539,10 @@ void AiL::InitializeDefaultKeybinds(){
KEY_SCROLLDOWN.AddKeybind({ANALOG,static_cast<int>(GPAxes::RY)}); KEY_SCROLLDOWN.AddKeybind({ANALOG,static_cast<int>(GPAxes::RY)});
KEY_SCROLLVERT.AddKeybind({ANALOG,static_cast<int>(GPAxes::LY)}); KEY_SCROLLVERT.AddKeybind({ANALOG,static_cast<int>(GPAxes::LY)});
KEY_SCROLLVERT.AddKeybind({ANALOG,static_cast<int>(GPAxes::RY)}); KEY_SCROLLVERT.AddKeybind({ANALOG,static_cast<int>(GPAxes::RY)});
KEY_SCROLLVERT_L.AddKeybind({ANALOG,static_cast<int>(GPAxes::LY)});
KEY_SCROLLVERT_R.AddKeybind({ANALOG,static_cast<int>(GPAxes::RY)}); KEY_SCROLLVERT_R.AddKeybind({ANALOG,static_cast<int>(GPAxes::RY)});
KEY_SCROLLHORZ.AddKeybind({ANALOG,static_cast<int>(GPAxes::LX)}); KEY_SCROLLHORZ.AddKeybind({ANALOG,static_cast<int>(GPAxes::LX)});
KEY_SCROLLHORZ_L.AddKeybind({ANALOG,static_cast<int>(GPAxes::LX)});
KEY_SCROLLHORZ.AddKeybind({ANALOG,static_cast<int>(GPAxes::RX)}); KEY_SCROLLHORZ.AddKeybind({ANALOG,static_cast<int>(GPAxes::RX)});
KEY_SCROLL.AddKeybind({KEY,ARROWS}); KEY_SCROLL.AddKeybind({KEY,ARROWS});
KEY_SCROLL.AddKeybind({ANALOG,static_cast<int>(GPAxes::ALL)}); KEY_SCROLL.AddKeybind({ANALOG,static_cast<int>(GPAxes::ALL)});

@ -98,8 +98,10 @@ public:
static InputGroup KEY_SCROLLLEFT; static InputGroup KEY_SCROLLLEFT;
static InputGroup KEY_SCROLLRIGHT; static InputGroup KEY_SCROLLRIGHT;
static InputGroup KEY_SCROLLHORZ; static InputGroup KEY_SCROLLHORZ;
static InputGroup KEY_SCROLLHORZ_L;
static InputGroup KEY_SCROLLVERT; static InputGroup KEY_SCROLLVERT;
static InputGroup KEY_SCROLLVERT_R; static InputGroup KEY_SCROLLVERT_R;
static InputGroup KEY_SCROLLVERT_L;
static InputGroup KEY_SCROLL; static InputGroup KEY_SCROLL;
static InputGroup KEY_SHOULDER; static InputGroup KEY_SHOULDER;
static InputGroup KEY_CHANGE_LOADOUT; static InputGroup KEY_CHANGE_LOADOUT;

@ -107,11 +107,6 @@ void Menu::InitializeConsumableInventoryWindow(){
} }
}, },
{ //Button Key { //Button Key
{game->KEY_CONFIRM,{"Set Loadout Item",[](MenuType type){}}},
{game->KEY_BACK,{"Back",[](MenuType type){
Menu::CloseMenu();
}}},
{{game->KEY_SCROLL,Analog},{"Scroll",[](MenuType type){}}},
{{game->KEY_SHOULDER,Pressed},{"Scroll",[](MenuType type){}}}, {{game->KEY_SHOULDER,Pressed},{"Scroll",[](MenuType type){}}},
{{game->KEY_FASTSCROLLDOWN,PressedDAS,InputEngageGroup::NOT_VISIBLE},{"Scroll",[](MenuType type){ {{game->KEY_FASTSCROLLDOWN,PressedDAS,InputEngageGroup::NOT_VISIBLE},{"Scroll",[](MenuType type){
auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory"); auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory");
@ -123,6 +118,10 @@ void Menu::InitializeConsumableInventoryWindow(){
int invWidth=int((itemsWindow->rect.size.x-12)/(float(itemsWindow->options.size.x)+itemsWindow->options.padding)); int invWidth=int((itemsWindow->rect.size.x-12)/(float(itemsWindow->options.size.x)+itemsWindow->options.padding));
itemsWindow->IncreaseSelectionIndex(invWidth*-3.f); itemsWindow->IncreaseSelectionIndex(invWidth*-3.f);
}}}, }}},
{game->KEY_BACK,{"Back",[](MenuType type){
Menu::CloseMenu();
}}},
{game->KEY_CONFIRM,{"Set Loadout Item",[](MenuType type){}}},
} }
,{ //Button Navigation Rules ,{ //Button Navigation Rules
{"OK Button",{ {"OK Button",{

@ -54,25 +54,67 @@ void Menu::InitializeItemLoadoutWindow(){
float buttonBorderPadding=64; float buttonBorderPadding=64;
itemLoadoutWindow->ADD("Loadout Item 1",MenuItemItemButton)(geom2d::rect<float>{{64,96},{48,48}},game->GetLoadoutItem(0),INVENTORY_CONSUMABLES,[](MenuFuncData data){Menu::menus.at(INVENTORY_CONSUMABLES)->I(A::LOADOUT_SLOT)=0; return true;},[](MenuFuncData data){return true;},[](MenuFuncData data){ itemLoadoutWindow->ADD("Loadout Item 1",MenuItemItemButton)(geom2d::rect<float>{{64,84},{48,48}},game->GetLoadoutItem(0),INVENTORY_CONSUMABLES,[](MenuFuncData data){Menu::menus.at(INVENTORY_CONSUMABLES)->I(A::LOADOUT_SLOT)=0; return true;},[](MenuFuncData data){return true;},[](MenuFuncData data){
Component<MenuLabel>(ITEM_LOADOUT,"Item Name Label")->SetLabel(""); Component<MenuLabel>(ITEM_LOADOUT,"Item Name Label")->SetLabel("");
Component<MenuLabel>(ITEM_LOADOUT,"Item Description")->SetLabel(""); Component<MenuLabel>(ITEM_LOADOUT,"Item Description")->SetLabel("");
return true; return true;
},"Item Name Label","Item Description")END; },"Item Name Label","Item Description")END;
itemLoadoutWindow->ADD("Loadout Item 2",MenuItemItemButton)(geom2d::rect<float>{{itemLoadoutWindowWidth/2-24,96},{48,48}},game->GetLoadoutItem(1),INVENTORY_CONSUMABLES,[](MenuFuncData data){Menu::menus.at(INVENTORY_CONSUMABLES)->I(A::LOADOUT_SLOT)=1;return true;},[](MenuFuncData data){return true;},[](MenuFuncData data){ itemLoadoutWindow->ADD("Loadout Item 2",MenuItemItemButton)(geom2d::rect<float>{{itemLoadoutWindowWidth/2-24,84},{48,48}},game->GetLoadoutItem(1),INVENTORY_CONSUMABLES,[](MenuFuncData data){Menu::menus.at(INVENTORY_CONSUMABLES)->I(A::LOADOUT_SLOT)=1;return true;},[](MenuFuncData data){return true;},[](MenuFuncData data){
Component<MenuLabel>(ITEM_LOADOUT,"Item Name Label")->SetLabel(""); Component<MenuLabel>(ITEM_LOADOUT,"Item Name Label")->SetLabel("");
Component<MenuLabel>(ITEM_LOADOUT,"Item Description")->SetLabel(""); Component<MenuLabel>(ITEM_LOADOUT,"Item Description")->SetLabel("");
return true; return true;
},"Item Name Label","Item Description")END; },"Item Name Label","Item Description")END;
itemLoadoutWindow->ADD("Loadout Item 3",MenuItemItemButton)(geom2d::rect<float>{{itemLoadoutWindowWidth-48-64,96},{48,48}},game->GetLoadoutItem(2),INVENTORY_CONSUMABLES,[](MenuFuncData data){Menu::menus.at(INVENTORY_CONSUMABLES)->I(A::LOADOUT_SLOT)=2;return true;},[](MenuFuncData data){return true;},[](MenuFuncData data){ itemLoadoutWindow->ADD("Loadout Item 3",MenuItemItemButton)(geom2d::rect<float>{{itemLoadoutWindowWidth-48-64,84},{48,48}},game->GetLoadoutItem(2),INVENTORY_CONSUMABLES,[](MenuFuncData data){Menu::menus.at(INVENTORY_CONSUMABLES)->I(A::LOADOUT_SLOT)=2;return true;},[](MenuFuncData data){return true;},[](MenuFuncData data){
Component<MenuLabel>(ITEM_LOADOUT,"Item Name Label")->SetLabel(""); Component<MenuLabel>(ITEM_LOADOUT,"Item Name Label")->SetLabel("");
Component<MenuLabel>(ITEM_LOADOUT,"Item Description")->SetLabel(""); Component<MenuLabel>(ITEM_LOADOUT,"Item Description")->SetLabel("");
return true; return true;
},"Item Name Label","Item Description")END; },"Item Name Label","Item Description")END;
itemLoadoutWindow->ADD("Item Name Label",MenuLabel)(geom2d::rect<float>{{0,158},{itemLoadoutWindowWidth,12}},"",1,ComponentAttr::SHADOW)END; itemLoadoutWindow->ADD("Item Name Label",MenuLabel)(geom2d::rect<float>{{0,146},{itemLoadoutWindowWidth,12}},"",1,ComponentAttr::SHADOW)END;
itemLoadoutWindow->ADD("Item Description",MenuLabel)(geom2d::rect<float>{{0,170},{itemLoadoutWindowWidth,24}},"",1,ComponentAttr::SHADOW)END; itemLoadoutWindow->ADD("Item Description",MenuLabel)(geom2d::rect<float>{{0,158},{itemLoadoutWindowWidth,24}},"",1,ComponentAttr::SHADOW)END;
itemLoadoutWindow->ADD("Start Level Button",MenuComponent)(geom2d::rect<float>{{itemLoadoutWindowWidth/2-32,214},{64,16}},"Start",[](MenuFuncData data){State_OverworldMap::StartLevel();return true;})END; itemLoadoutWindow->ADD("Start Level Button",MenuComponent)(geom2d::rect<float>{{itemLoadoutWindowWidth/2+32,202},{64,16}},"Start",[](MenuFuncData data){State_OverworldMap::StartLevel();return true;})END;
itemLoadoutWindow->ADD("Back Button",MenuComponent)(geom2d::rect<float>{{itemLoadoutWindowWidth/2-96,202},{64,16}},"Back",[](MenuFuncData data){Menu::CloseMenu();return true;})END;
itemLoadoutWindow->SetupKeyboardNavigation(
[](MenuType type,Data&returnData){ //On Open
returnData="Loadout Item 1";
},
{ //Button Key
{game->KEY_START,{"Start Stage",[](MenuType type){
Component<MenuComponent>(type,"Start Level Button")->Click();
}}},
{game->KEY_BACK,{"Back",[](MenuType type){
Component<MenuComponent>(type,"Back Button")->Click();
}}},
{game->KEY_CONFIRM,{"Select",[](MenuType type){}}},
}
,{ //Button Navigation Rules
{"Loadout Item 1",{
.up="Back Button",
.down="Back Button",
.left="Loadout Item 3",
.right="Loadout Item 2",}},
{"Loadout Item 2",{
.up="Start Level Button",
.down="Start Level Button",
.left="Loadout Item 1",
.right="Loadout Item 3",}},
{"Loadout Item 3",{
.up="Start Level Button",
.down="Start Level Button",
.left="Loadout Item 2",
.right="Loadout Item 1",}},
{"Start Level Button",{
.up="Loadout Item 3",
.down="Loadout Item 3",
.left="Back Button",
.right="Back Button",}},
{"Back Button",{
.up="Loadout Item 1",
.down="Loadout Item 1",
.left="Start Level Button",
.right="Start Level Button",}},
});
} }

@ -41,13 +41,13 @@ enum MenuType{
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
/*DO NOT REMOVE!!*/ENUM_START,/////////////////////////////// /*DO NOT REMOVE!!*/ENUM_START,///////////////////////////////
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// 28% Controller Compatibility. (100 total items, 4 items per menu * 25 menus) // 32% Controller Compatibility. (100 total items, 4 items per menu * 25 menus)
INVENTORY_CONSUMABLES, //100% Controller Compatibility INVENTORY_CONSUMABLES, //100% Controller Compatibility
CLASS_INFO, //100% Controller Compatibility CLASS_INFO, //100% Controller Compatibility
CLASS_SELECTION, //100% Controller Compatibility CLASS_SELECTION, //100% Controller Compatibility
MAIN_MENU, //100% Controller Compatibility MAIN_MENU, //100% Controller Compatibility
OVERWORLD_LEVEL_SELECT, //100% Controller Compatibility - Scrolling for keyboard? OVERWORLD_LEVEL_SELECT, //100% Controller Compatibility - Scrolling for keyboard?
ITEM_LOADOUT, //0% Controller Compatibility ITEM_LOADOUT, //100% Controller Compatibility
LEVEL_COMPLETE, //0% Controller Compatibility LEVEL_COMPLETE, //0% Controller Compatibility
OVERWORLD_MENU, //0% Controller Compatibility OVERWORLD_MENU, //0% Controller Compatibility
CHARACTER_MENU, //0% Controller Compatibility CHARACTER_MENU, //0% Controller Compatibility
@ -60,7 +60,7 @@ enum MenuType{
CRAFT_CONSUMABLE, //0% Controller Compatibility CRAFT_CONSUMABLE, //0% Controller Compatibility
CONSUMABLE_CRAFT_ITEM, //0% Controller Compatibility CONSUMABLE_CRAFT_ITEM, //0% Controller Compatibility
SAVE_FILE_NAME, //100% Controller Compatibility SAVE_FILE_NAME, //100% Controller Compatibility
LOAD_GAME, //75% Controller Compatibility LOAD_GAME, //75% Controller Compatibility - Online Mode Tab switching
USER_ID, //0% Controller Compatibility USER_ID, //0% Controller Compatibility
SETTINGS, //0% Controller Compatibility SETTINGS, //0% Controller Compatibility
SHERMAN, //0% Controller Compatibility SHERMAN, //0% Controller Compatibility

@ -100,15 +100,16 @@ void State_OverworldMap::OnUserUpdate(AiL*game){
#pragma region Handle Connection Point Clicking and Movement #pragma region Handle Connection Point Clicking and Movement
for(ConnectionPoint&cp:connections){ for(ConnectionPoint&cp:connections){
if(game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect) if(game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect)
||game->KEY_LEFT.Pressed()||game->KEY_RIGHT.Pressed()||game->KEY_UP.Pressed()||game->KEY_DOWN.Pressed()){ ||game->KEY_LEFT.Pressed()||game->KEY_RIGHT.Pressed()||game->KEY_UP.Pressed()||game->KEY_DOWN.Pressed()
||(!analogMove&&(abs(game->KEY_SCROLLHORZ_L.Analog())>=0.2f||abs(game->KEY_SCROLLVERT_L.Analog())>=0.2f))){
bool mouseUsed=game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect); bool mouseUsed=game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect);
for(int directionInd=0;int neighborInd:currentConnectionPoint->neighbors){ for(int directionInd=0;int neighborInd:currentConnectionPoint->neighbors){
int targetDirection=-1; int targetDirection=-1;
if(game->KEY_LEFT.Pressed())targetDirection=ConnectionPoint::WEST; if(game->KEY_LEFT.Pressed()||game->KEY_SCROLLHORZ_L.Analog()<=-0.2f)targetDirection=ConnectionPoint::WEST;
if(game->KEY_RIGHT.Pressed())targetDirection=ConnectionPoint::EAST; if(game->KEY_RIGHT.Pressed()||game->KEY_SCROLLHORZ_L.Analog()>=0.2f)targetDirection=ConnectionPoint::EAST;
if(game->KEY_UP.Pressed())targetDirection=ConnectionPoint::NORTH; if(game->KEY_UP.Pressed()||game->KEY_SCROLLVERT_L.Analog()<=-0.2f)targetDirection=ConnectionPoint::NORTH;
if(game->KEY_DOWN.Pressed())targetDirection=ConnectionPoint::SOUTH; if(game->KEY_DOWN.Pressed()||game->KEY_SCROLLVERT_L.Analog()>=0.2f)targetDirection=ConnectionPoint::SOUTH;
if(neighborInd==-1){ if(neighborInd==-1){
directionInd++; directionInd++;
@ -132,6 +133,7 @@ void State_OverworldMap::OnUserUpdate(AiL*game){
}else{ }else{
game->GetPlayer()->UpdateWalkingAnimation(LEFT); game->GetPlayer()->UpdateWalkingAnimation(LEFT);
} }
if(abs(game->KEY_SCROLLHORZ_L.Analog())>=0.2f||abs(game->KEY_SCROLLVERT_L.Analog()>=0.2f))analogMove=true;
goto doneNavigating; goto doneNavigating;
} }
directionInd++; directionInd++;
@ -140,7 +142,9 @@ void State_OverworldMap::OnUserUpdate(AiL*game){
} }
#pragma endregion #pragma endregion
doneNavigating: doneNavigating:
int a; if(abs(game->KEY_SCROLLVERT_L.Analog())<0.2f&&abs(game->KEY_SCROLLHORZ_L.Analog())<0.2f){
analogMove=false;
}
}; };
void State_OverworldMap::Draw(AiL*game){ void State_OverworldMap::Draw(AiL*game){
currentTime+=game->GetElapsedTime(); currentTime+=game->GetElapsedTime();

@ -46,6 +46,7 @@ class State_OverworldMap:public GameState{
float currentTime=0; float currentTime=0;
vf2d playerTargetPos; vf2d playerTargetPos;
const float playerMoveSpd=48.0; const float playerMoveSpd=48.0;
bool analogMove=false;
public: public:
State_OverworldMap(); State_OverworldMap();
static std::vector<ConnectionPoint>connections; static std::vector<ConnectionPoint>connections;

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

Loading…
Cancel
Save