diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index 01751b4e..ec814542 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -401,6 +401,7 @@ + diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters index 1785aa8a..dccff7b4 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters @@ -483,6 +483,9 @@ Header Files\Interface + + Header Files\Interface + diff --git a/Adventures in Lestoria/ItemLoadoutWindow.cpp b/Adventures in Lestoria/ItemLoadoutWindow.cpp index 5dd8f6f7..c5edbaf0 100644 --- a/Adventures in Lestoria/ItemLoadoutWindow.cpp +++ b/Adventures in Lestoria/ItemLoadoutWindow.cpp @@ -39,7 +39,7 @@ All rights reserved. #include "DEFINES.h" #include "Menu.h" #include "MenuLabel.h" -#include "MenuItemItemButton.h" +#include "MenuItemLoadoutButton.h" #include "State_OverworldMap.h" INCLUDE_game @@ -57,41 +57,50 @@ void Menu::InitializeItemLoadoutWindow(){ float buttonBorderPadding=64; - itemLoadoutWindow->ADD("Loadout Item 1",MenuItemItemButton)(geom2d::rect{{64,84},{48,48}},game->GetLoadoutItem(0),[](MenuFuncData data){ + itemLoadoutWindow->ADD("Loadout Item 1",MenuItemLoadoutButton)(geom2d::rect{{64,90},{48,48}},0,[](MenuFuncData data){ Menu::menus.at(INVENTORY_CONSUMABLES)->I(A::LOADOUT_SLOT)=0; Menu::OpenMenu(INVENTORY_CONSUMABLES); return true; },[](MenuFuncData data){ + std::weak_ptrloadoutButton=DYNAMIC_POINTER_CAST(data.component); + Component(ITEM_LOADOUT,"Item Name Label")->SetLabel(loadoutButton.lock()->GetItem().lock()->DisplayName()); + Component(ITEM_LOADOUT,"Item Description")->SetLabel(loadoutButton.lock()->GetItem().lock()->Description()); return true; },[](MenuFuncData data){ Component(ITEM_LOADOUT,"Item Name Label")->SetLabel(""); Component(ITEM_LOADOUT,"Item Description")->SetLabel(""); return true; - },"Item Name Label","Item Description")END + })END ->SetIconScale({2.f,2.f}); - itemLoadoutWindow->ADD("Loadout Item 2",MenuItemItemButton)(geom2d::rect{{itemLoadoutWindowWidth/2-24,84},{48,48}},game->GetLoadoutItem(1),[](MenuFuncData data){ + itemLoadoutWindow->ADD("Loadout Item 2",MenuItemLoadoutButton)(geom2d::rect{{itemLoadoutWindowWidth/2-24,90},{48,48}},1,[](MenuFuncData data){ Menu::menus.at(INVENTORY_CONSUMABLES)->I(A::LOADOUT_SLOT)=1; Menu::OpenMenu(INVENTORY_CONSUMABLES); return true; },[](MenuFuncData data){ + std::weak_ptrloadoutButton=DYNAMIC_POINTER_CAST(data.component); + Component(ITEM_LOADOUT,"Item Name Label")->SetLabel(loadoutButton.lock()->GetItem().lock()->DisplayName()); + Component(ITEM_LOADOUT,"Item Description")->SetLabel(loadoutButton.lock()->GetItem().lock()->Description()); return true; },[](MenuFuncData data){ Component(ITEM_LOADOUT,"Item Name Label")->SetLabel(""); Component(ITEM_LOADOUT,"Item Description")->SetLabel(""); return true; - },"Item Name Label","Item Description")END + })END ->SetIconScale({2.f,2.f}); - itemLoadoutWindow->ADD("Loadout Item 3",MenuItemItemButton)(geom2d::rect{{itemLoadoutWindowWidth-48-64,84},{48,48}},game->GetLoadoutItem(2),[](MenuFuncData data){ + itemLoadoutWindow->ADD("Loadout Item 3",MenuItemLoadoutButton)(geom2d::rect{{itemLoadoutWindowWidth-48-64,90},{48,48}},2,[](MenuFuncData data){ Menu::menus.at(INVENTORY_CONSUMABLES)->I(A::LOADOUT_SLOT)=2; Menu::OpenMenu(INVENTORY_CONSUMABLES); return true; },[](MenuFuncData data){ + std::weak_ptrloadoutButton=DYNAMIC_POINTER_CAST(data.component); + Component(ITEM_LOADOUT,"Item Name Label")->SetLabel(loadoutButton.lock()->GetItem().lock()->DisplayName()); + Component(ITEM_LOADOUT,"Item Description")->SetLabel(loadoutButton.lock()->GetItem().lock()->Description()); return true; },[](MenuFuncData data){ Component(ITEM_LOADOUT,"Item Name Label")->SetLabel(""); Component(ITEM_LOADOUT,"Item Description")->SetLabel(""); return true; - },"Item Name Label","Item Description")END + })END ->SetIconScale({2.f,2.f}); itemLoadoutWindow->ADD("Item Name Label",MenuLabel)(geom2d::rect{{0,146},{itemLoadoutWindowWidth,12}},"",1,ComponentAttr::SHADOW)END; diff --git a/Adventures in Lestoria/MenuItemLoadoutButton.h b/Adventures in Lestoria/MenuItemLoadoutButton.h new file mode 100644 index 00000000..cfa3c30a --- /dev/null +++ b/Adventures in Lestoria/MenuItemLoadoutButton.h @@ -0,0 +1,65 @@ +#pragma region License +/* +License (OLC-3) +~~~~~~~~~~~~~~~ + +Copyright 2024 Joshua Sigona + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions or derivations of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +2. Redistributions or derivative works in binary form must reproduce the above +copyright notice. This list of conditions and the following disclaimer must be +reproduced in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may +be used to endorse or promote products derived from this software without specific +prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +Portions of this software are copyright © 2024 The FreeType +Project (www.freetype.org). Please see LICENSE_FT.txt for more information. +All rights reserved. +*/ +#pragma endregion +#include "MenuItemItemButton.h" +#include "Key.h" + +INCLUDE_game + +class MenuItemLoadoutButton:public MenuItemItemButton{ +public: + inline MenuItemLoadoutButton(geom2d::rectrect,uint8_t itemLoadoutSlot,MenuFunc onClick,MenuFunc onHover,MenuFunc onMouseOut,std::string itemNameLabelName="",std::string itemDescriptionLabelName="",IconButtonAttr attributes=IconButtonAttr::SELECTABLE) + :MenuItemItemButton(rect,game->GetLoadoutItem(itemLoadoutSlot),onClick,onHover,onMouseOut,itemNameLabelName,itemDescriptionLabelName,attributes),itemLoadoutSlot(itemLoadoutSlot){} + virtual inline void DrawDecal(ViewPort&window,bool focused)override final{ + MenuItemItemButton::DrawDecal(window,focused); + + switch(itemLoadoutSlot){ + case 0:{ + game->GetPlayer()->KEY_ITEM1.DrawPrimaryInput(&window,rect.middle()+vf2d{2.f,-25.f},"",255,Input::UsingGamepad()?CONTROLLER:KEY); + }break; + case 1:{ + game->GetPlayer()->KEY_ITEM2.DrawPrimaryInput(&window,rect.middle()+vf2d{2.f,-25.f},"",255,Input::UsingGamepad()?CONTROLLER:KEY); + }break; + case 2:{ + game->GetPlayer()->KEY_ITEM3.DrawPrimaryInput(&window,rect.middle()+vf2d{2.f,-25.f},"",255,Input::UsingGamepad()?CONTROLLER:KEY); + }break; + default:ERR(std::format("WARNING! Invalid Item Loadout slot given: {}",itemLoadoutSlot)); + } + } +private: + uint8_t itemLoadoutSlot; +}; \ No newline at end of file diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 71b1b4b9..18a9f8d4 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -17,6 +17,4 @@ Add in vsync system option Hint text does not appear except during actual gameplay. Terrain Collision Boxes -Add hotkeys to loadout slots when selecting them from the menu - -Fix Story setpieces (outer tiles) \ No newline at end of file +Add hotkeys to loadout slots when selecting them from the menu \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 83cbdee0..1978d390 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 5 #define VERSION_PATCH 1 -#define VERSION_BUILD 8193 +#define VERSION_BUILD 8207 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 43634986..6e446fe4 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ