diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 3493afbc..ae944ef7 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -2524,6 +2524,7 @@ void AiL::InitializeDefaultKeybinds(){ KEY_SCROLLVERT.AddKeybind({ANALOG,static_cast(GPAxes::RY)}); KEY_SCROLLHORZ.AddKeybind({ANALOG,static_cast(GPAxes::LX)}); KEY_SCROLLHORZ.AddKeybind({ANALOG,static_cast(GPAxes::RX)}); + KEY_SCROLL.AddKeybind({KEY,ARROWS}); KEY_SCROLL.AddKeybind({ANALOG,static_cast(GPAxes::ALL)}); KEY_SHOULDER.AddKeybind({KEY,SHOULDER}); diff --git a/Adventures in Lestoria/InventoryConsumableWindow.cpp b/Adventures in Lestoria/InventoryConsumableWindow.cpp index 00675c36..3bb20fa8 100644 --- a/Adventures in Lestoria/InventoryConsumableWindow.cpp +++ b/Adventures in Lestoria/InventoryConsumableWindow.cpp @@ -111,7 +111,18 @@ void Menu::InitializeConsumableInventoryWindow(){ {game->KEY_BACK,{"Back",[](MenuType type){ Menu::CloseMenu(); }}}, - {{game->KEY_SCROLLVERT,Analog},{"Scroll",[](MenuType type){}}}, + {{game->KEY_SCROLL,Analog},{"Scroll",[](MenuType type){}}}, + {{game->KEY_SHOULDER,Pressed},{"Scroll",[](MenuType type){}}}, + {{game->KEY_FASTSCROLLDOWN,PressedDAS,InputEngageGroup::NOT_VISIBLE},{"Scroll",[](MenuType type){ + auto itemsWindow=Component(type,"inventory"); + int invWidth=int((itemsWindow->rect.size.x-12)/(float(itemsWindow->options.size.x)+itemsWindow->options.padding)); + itemsWindow->IncreaseSelectionIndex(invWidth*3.f); + }}}, + {{game->KEY_FASTSCROLLUP,PressedDAS,InputEngageGroup::NOT_VISIBLE},{"Scroll",[](MenuType type){ + auto itemsWindow=Component(type,"inventory"); + int invWidth=int((itemsWindow->rect.size.x-12)/(float(itemsWindow->options.size.x)+itemsWindow->options.padding)); + itemsWindow->IncreaseSelectionIndex(invWidth*-3.f); + }}}, } ,{ //Button Navigation Rules {"OK Button",{ @@ -183,9 +194,14 @@ void Menu::InitializeConsumableInventoryWindow(){ std::weak_ptrselectedButton=DYNAMIC_POINTER_CAST(*component); int newRowIndex=selectedButton.lock()->inventoryIndex+invWidth; //Moving down moves the cursor down an entire row. if(newRowIndex>=itemsList.size()){ - //This means we have to wrap around. - returnData="OK Button"; - return; + int currentRow=newRowIndex/invWidth; + //The logic here is, if we clamp this row index to the last possible index and we're still on the same row, it means there is at least an item on this row. So we go to that instead. + newRowIndex=std::clamp(newRowIndex,0,int(itemsList.size()-1)); + int newRow=newRowIndex/invWidth; + if(currentRow!=newRow){ //This means we are on a different row, so the row we went down on didn't have any items. Simply drop down to the OK Button. + returnData="OK Button"; + return; + } } if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex)); //Select the component that matches this new number. diff --git a/Adventures in Lestoria/Key.cpp b/Adventures in Lestoria/Key.cpp index 02ce1a89..d434499d 100644 --- a/Adventures in Lestoria/Key.cpp +++ b/Adventures in Lestoria/Key.cpp @@ -482,6 +482,7 @@ std::map,GenericKey::KeyInfo> GenericKey::keyLiteral={ {{KEY, CAPS_LOCK},{"CAP LK"}}, {{KEY, olc::ENUM_END},{""}}, {{KEY, SHOULDER},{"Q-E","themes/button_qe.png"}}, + {{KEY, ARROWS},{"Arrow Keys","themes/button_arrows.png"}}, {{MOUSE, Mouse::LEFT},{"L.MOUSE"}}, {{MOUSE, Mouse::RIGHT},{"R.MOUSE"}}, {{MOUSE, Mouse::MIDDLE},{"M.MOUSE"}}, diff --git a/Adventures in Lestoria/State_MainMenu.cpp b/Adventures in Lestoria/State_MainMenu.cpp index f8a8bf8a..b6d2e7ee 100644 --- a/Adventures in Lestoria/State_MainMenu.cpp +++ b/Adventures in Lestoria/State_MainMenu.cpp @@ -56,5 +56,4 @@ void State_MainMenu::OnUserUpdate(AiL*game){ }; void State_MainMenu::Draw(AiL*game){ TitleScreen::Draw(); - game->DrawOGStringDecal({0,0},"DOWN: "+std::to_string(game->KEY_SCROLLVERT.Analog())); }; \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 65dca823..64756e3d 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 6936 +#define VERSION_BUILD 6939 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/gfx/gfx.txt b/Adventures in Lestoria/assets/config/gfx/gfx.txt index e8a7b797..71069820 100644 --- a/Adventures in Lestoria/assets/config/gfx/gfx.txt +++ b/Adventures in Lestoria/assets/config/gfx/gfx.txt @@ -63,6 +63,7 @@ Images GFX_Button_SHOULDER_QE = themes/button_qe.png GFX_Button_SHOULDER_L1R1 = themes/button_r1l1.png GFX_Button_AnalogStick = themes/button_analogstick.png + GFX_Button_Arrows = themes/button_arrows.png GFX_Overworld_Arrow = overworld_arrow.png GFX_Exclamation = exclamation.png GFX_Ursule2 = monsters/Ursule Mother of Bears2.png diff --git a/Adventures in Lestoria/assets/themes/button_arrows.png b/Adventures in Lestoria/assets/themes/button_arrows.png new file mode 100644 index 00000000..4c4a36fc Binary files /dev/null and b/Adventures in Lestoria/assets/themes/button_arrows.png differ diff --git a/Adventures in Lestoria/olcPixelGameEngine.h b/Adventures in Lestoria/olcPixelGameEngine.h index d9801224..58a83536 100644 --- a/Adventures in Lestoria/olcPixelGameEngine.h +++ b/Adventures in Lestoria/olcPixelGameEngine.h @@ -654,6 +654,7 @@ namespace olc //UNREACHABLE ITEMS BELOW: SHOULDER, + ARROWS, }; namespace Mouse