Fully implemented controller/keyboard controls for Inventory Consumable Window. Fix bug with loadout items that were set during file loads were not selected in consumable window. Release Build 6907.

pull/35/head
sigonasr2 10 months ago
parent 13a821c011
commit fd1f762e20
  1. 4
      Adventures in Lestoria/Adventures in Lestoria.vcxproj
  2. 3
      Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
  3. 28
      Adventures in Lestoria/AdventuresInLestoria.cpp
  4. 121
      Adventures in Lestoria/InventoryConsumableWindow.cpp
  5. 2
      Adventures in Lestoria/Item.cpp
  6. 2
      Adventures in Lestoria/Key.cpp
  7. 6
      Adventures in Lestoria/Menu.cpp
  8. 2
      Adventures in Lestoria/Menu.h
  9. 5
      Adventures in Lestoria/MenuComponent.cpp
  10. 43
      Adventures in Lestoria/PauseMenu.cpp
  11. 39
      Adventures in Lestoria/TODO.txt
  12. 2
      Adventures in Lestoria/Version.h
  13. BIN
      x64/Release/Adventures in Lestoria.exe

@ -649,6 +649,10 @@
<SubType> <SubType>
</SubType> </SubType>
</ClCompile> </ClCompile>
<ClCompile Include="PauseMenu.cpp">
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="RunAway.cpp" /> <ClCompile Include="RunAway.cpp" />
<ClCompile Include="RunTowards.cpp" /> <ClCompile Include="RunTowards.cpp" />
<ClCompile Include="Pathfinding.cpp" /> <ClCompile Include="Pathfinding.cpp" />

@ -791,6 +791,9 @@
<ClCompile Include="InputNewKeybindWindow.cpp"> <ClCompile Include="InputNewKeybindWindow.cpp">
<Filter>Source Files\Interface</Filter> <Filter>Source Files\Interface</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="PauseMenu.cpp">
<Filter>Source Files\Interface</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="cpp.hint" /> <None Include="cpp.hint" />

@ -71,6 +71,7 @@ All rights reserved.
#include "TitleScreen.h" #include "TitleScreen.h"
#include "SoundEffect.h" #include "SoundEffect.h"
#include "olcPGEX_Gamepad.h" #include "olcPGEX_Gamepad.h"
#include "InventoryScrollableWindowComponent.h"
#ifndef __EMSCRIPTEN__ #ifndef __EMSCRIPTEN__
#include "discord.h" #include "discord.h"
#endif #endif
@ -2461,7 +2462,7 @@ void AiL::InitializeDefaultKeybinds(){
KEY_ATTACK.AddKeybind({KEY,SHIFT}); KEY_ATTACK.AddKeybind({KEY,SHIFT});
KEY_ATTACK.AddKeybind({MOUSE,Mouse::LEFT}); KEY_ATTACK.AddKeybind({MOUSE,Mouse::LEFT});
KEY_ATTACK.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::L2)}); KEY_ATTACK.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::L2)});
KEY_LEFT.AddKeybind({KEY,A}); KEY_LEFT.AddKeybind({KEY,Key::A});
KEY_LEFT.AddKeybind({KEY,LEFT}); KEY_LEFT.AddKeybind({KEY,LEFT});
KEY_LEFT.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::DPAD_L)}); KEY_LEFT.AddKeybind({CONTROLLER,static_cast<int>(GPButtons::DPAD_L)});
KEY_RIGHT.AddKeybind({KEY,D}); KEY_RIGHT.AddKeybind({KEY,D});
@ -2806,6 +2807,19 @@ const std::weak_ptr<Item>AiL::GetLoadoutItem(int slot){
void AiL::SetLoadoutItem(int slot,std::string itemName){ void AiL::SetLoadoutItem(int slot,std::string itemName){
if(slot<0||slot>loadout.size()-1)ERR("Invalid inventory slot "+std::to_string(slot)+", please choose a slot in range (0-"+std::to_string(loadout.size()-1)+")."); if(slot<0||slot>loadout.size()-1)ERR("Invalid inventory slot "+std::to_string(slot)+", please choose a slot in range (0-"+std::to_string(loadout.size()-1)+").");
if(Inventory::GetItemCount(itemName)>0){ if(Inventory::GetItemCount(itemName)>0){
if(loadout[slot]&&!ISBLANK(loadout[slot])&&loadout[slot]->Amt()>0){
//If the slot isn't blank, we should clear the item from being selected in the consumables list.
auto&itemsList=Component<InventoryScrollableWindowComponent>(INVENTORY_CONSUMABLES,"inventory")->GetComponents();
auto item=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&component){
if(DYNAMIC_POINTER_CAST<MenuItemButton>(component)->GetItem().lock()->ActualName()==loadout[slot]->ActualName()){
return true;
}
return false;
});
if(item!=itemsList.end()){
DYNAMIC_POINTER_CAST<MenuItemButton>(*item)->selected=-1;
}else ERR(std::format("WARNING! Could not find item {} in inventory while deselecting a loadout item from the consumables menu! THIS SHOULD NOT BE HAPPENING!",loadout[slot]->ActualName()));
}
loadout[slot]=Inventory::CopyItem(itemName)[0]; loadout[slot]=Inventory::CopyItem(itemName)[0];
GetLoadoutItem(slot).lock()->amt=std::min((uint32_t)"Player.Item Loadout Limit"_I,GetLoadoutItem(slot).lock()->Amt()); //We are only allowed to have up to 10 maximum of an item on a journey. GetLoadoutItem(slot).lock()->amt=std::min((uint32_t)"Player.Item Loadout Limit"_I,GetLoadoutItem(slot).lock()->Amt()); //We are only allowed to have up to 10 maximum of an item on a journey.
InputGroup*inputGroup=nullptr; InputGroup*inputGroup=nullptr;
@ -2848,6 +2862,18 @@ void AiL::SetLoadoutItem(int slot,std::string itemName){
}break; }break;
} }
//Set the loadout slot selection for this loadout item.
auto&itemsList=Component<InventoryScrollableWindowComponent>(INVENTORY_CONSUMABLES,"inventory")->GetComponents();
auto item=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&component){
if(DYNAMIC_POINTER_CAST<MenuItemButton>(component)->GetItem().lock()->ActualName()==loadout[slot]->ActualName()){
return true;
}
return false;
});
if(item!=itemsList.end()){
DYNAMIC_POINTER_CAST<MenuItemButton>(*item)->selected=slot;
}else ERR(std::format("WARNING! Could not find item {} in inventory while selecting a loadout item from the consumables menu! THIS SHOULD NOT BE HAPPENING!",loadout[slot]->ActualName()));
}else{ }else{
ERR("Trying to set item "+itemName+" in Loadout slot "+std::to_string(slot)+" when said item does not exist in our inventory!"); ERR("Trying to set item "+itemName+" in Loadout slot "+std::to_string(slot)+" when said item does not exist in our inventory!");
} }

@ -88,10 +88,20 @@ void Menu::InitializeConsumableInventoryWindow(){
inventoryWindow->SetupKeyboardNavigation( inventoryWindow->SetupKeyboardNavigation(
[](MenuType type,Data&returnData){ //On Open [](MenuType type,Data&returnData){ //On Open
//Get the first component in the consumables list. //Try to find the component that matches the loadout item we have on us.
std::vector<std::weak_ptr<MenuComponent>>&components=Component<InventoryScrollableWindowComponent>(INVENTORY_CONSUMABLES,"inventory")->GetComponents(); std::vector<std::weak_ptr<MenuComponent>>&components=Component<InventoryScrollableWindowComponent>(INVENTORY_CONSUMABLES,"inventory")->GetComponents();
auto inventory=Component<InventoryScrollableWindowComponent>(INVENTORY_CONSUMABLES,"inventory");
auto foundComponent=std::find_if(components.begin(),components.end(),[&](auto&component){
if(!ISBLANK(DYNAMIC_POINTER_CAST<MenuItemButton>(component)->GetItem().lock())&&DYNAMIC_POINTER_CAST<MenuItemButton>(component)->GetItem().lock()->ActualName()==game->GetLoadoutItem(Menu::menus[type]->I(A::LOADOUT_SLOT)).lock()->ActualName()){
return true;
}
return false;
});
if(foundComponent!=components.end()){
returnData=*foundComponent;
}else
if(components.size()>0){ if(components.size()>0){
returnData=components[0].lock()->GetName(); returnData=components.front();
}else{ }else{
returnData="OK Button"; returnData="OK Button";
} }
@ -103,17 +113,37 @@ void Menu::InitializeConsumableInventoryWindow(){
}}}, }}},
} }
,{ //Button Navigation Rules ,{ //Button Navigation Rules
{"OK Button",{
.up=[](MenuType type,Data&returnData){
auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents();
if(itemsList.size()>0){
returnData=itemsList.back();
}
},
.down=[](MenuType type,Data&returnData){
auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents();
if(itemsList.size()>0){
returnData=itemsList.front();
}
},
.left=[](MenuType type,Data&returnData){
auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents();
if(itemsList.size()>0){
returnData=itemsList.back();
}
},
.right=[](MenuType type,Data&returnData){
auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents();
if(itemsList.size()>0){
returnData=itemsList.front();
}
},
}},
{"inventory",{ {"inventory",{
.up="Quit Game Button",
.down="Load Game Button",}},
{"Load Game Button",{
.up="New Game Button",
.down="Quit Game Button",}},
{"Quit Game Button",{
.up=[](MenuType type,Data&returnData){ .up=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection(); auto&selection=Menu::menus[type]->GetSelection();
auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents(); auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents();
auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory") auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory");
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();}); auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();});
if(itemsList.size()>0){ if(itemsList.size()>0){
if(component==itemsList.end()){ if(component==itemsList.end()){
@ -121,26 +151,27 @@ void Menu::InitializeConsumableInventoryWindow(){
returnData=itemsList.back(); returnData=itemsList.back();
}else{ }else{
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));
std::weak_ptr<MenuItemButton>selectedButton=DYNAMIC_POINTER_CAST<MenuItemButton>(component); std::weak_ptr<MenuItemButton>selectedButton=DYNAMIC_POINTER_CAST<MenuItemButton>(*component);
int newRowIndex=selectedButton.lock()->inventoryIndex-invWidth; //Moving up moves the cursor up an entire row. int newRowIndex=selectedButton.lock()->inventoryIndex-invWidth; //Moving up moves the cursor up an entire row.
if(newRowIndex<0){ if(newRowIndex<0){
//This means we have to wrap around. //This means we have to wrap around.
newRowIndex+=itemsList.size(); 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)); 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. //Select the component that matches this new number.
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<MenuItemButton>(comp).lock()->inventoryIndex==newRowIndex;}); auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<MenuItemButton>(comp)->inventoryIndex==newRowIndex;});
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex)); if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
returnData=component; returnData=*component;
} }
}else{ }else{
returnData="OK Button"; returnData="OK Button";
} }
}, },
.right=[](MenuType type,Data&returnData){ .down=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection(); auto&selection=Menu::menus[type]->GetSelection();
auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents(); auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents();
auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory") auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory");
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();}); auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();});
if(itemsList.size()>0){ if(itemsList.size()>0){
if(component==itemsList.end()){ if(component==itemsList.end()){
@ -148,72 +179,76 @@ void Menu::InitializeConsumableInventoryWindow(){
returnData=itemsList.front(); returnData=itemsList.front();
}else{ }else{
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));
std::weak_ptr<MenuItemButton>selectedButton=DYNAMIC_POINTER_CAST<MenuItemButton>(component); std::weak_ptr<MenuItemButton>selectedButton=DYNAMIC_POINTER_CAST<MenuItemButton>(*component);
int newRowIndex=std::clamp(selectedButton.lock()->inventoryIndex+1,(selectedButton.lock()->inventoryIndex/invWidth)*invWidth,std::min(itemsList.size(),(selectedButton.lock()->inventoryIndex/invWidth+1)*invWidth-1)); //Moving right, we need to wrap around if we get to the edge. int newRowIndex=selectedButton.lock()->inventoryIndex+invWidth; //Moving down moves the cursor down an entire row.
if(newRowIndex>=itemsList.size()){ if(newRowIndex>=itemsList.size()){
//This means we have to wrap around. //This means we have to wrap around.
newRowIndex-=itemsList.size(); 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)); 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. //Select the component that matches this new number.
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<MenuItemButton>(comp).lock()->inventoryIndex==newRowIndex;}); auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<MenuItemButton>(comp)->inventoryIndex==newRowIndex;});
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex)); if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
returnData=component; returnData=*component;
} }
}else{ }else{
returnData="OK Button"; returnData="OK Button";
} }
}, },
.down=[](MenuType type,Data&returnData){ .left=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection(); auto&selection=Menu::menus[type]->GetSelection();
auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents(); auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents();
auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory") auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory");
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();}); auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();});
if(itemsList.size()>0){ if(itemsList.size()>0){
if(component==itemsList.end()){ if(component==itemsList.end()){
//Set the selected button to the first element in the list. //Set the selected button to the last element in the list.
returnData=itemsList.front(); returnData=itemsList.back();
}else{ }else{
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));
std::weak_ptr<MenuItemButton>selectedButton=DYNAMIC_POINTER_CAST<MenuItemButton>(component); std::weak_ptr<MenuItemButton>selectedButton=DYNAMIC_POINTER_CAST<MenuItemButton>(*component);
int newRowIndex=selectedButton.lock()->inventoryIndex+invWidth; //Moving down moves the cursor down an entire row.
if(newRowIndex>=itemsList.size()){ int rowBaseIndex=(selectedButton.lock()->inventoryIndex/invWidth)*invWidth;
int newRowIndex=selectedButton.lock()->inventoryIndex-1;
if(newRowIndex<rowBaseIndex)newRowIndex+=invWidth;
newRowIndex=std::min(int(itemsList.size())-1,newRowIndex);
if(newRowIndex<0){
//This means we have to wrap around. //This means we have to wrap around.
newRowIndex-=itemsList.size(); newRowIndex+=itemsList.size();
} }
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex)); 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. //Select the component that matches this new number.
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<MenuItemButton>(comp).lock()->inventoryIndex==newRowIndex;}); auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<MenuItemButton>(comp)->inventoryIndex==newRowIndex;});
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex)); if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
returnData=component; returnData=*component;
} }
}else{ }else{
returnData="OK Button"; returnData="OK Button";
} }
}, },
.left=[](MenuType type,Data&returnData){ .right=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection(); auto&selection=Menu::menus[type]->GetSelection();
auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents(); auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents();
auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory") auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory");
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();}); auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();});
if(itemsList.size()>0){ if(itemsList.size()>0){
if(component==itemsList.end()){ if(component==itemsList.end()){
//Set the selected button to the last element in the list. //Set the selected button to the first element in the list.
returnData=itemsList.back(); returnData=itemsList.front();
}else{ }else{
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));
std::weak_ptr<MenuItemButton>selectedButton=DYNAMIC_POINTER_CAST<MenuItemButton>(component); std::weak_ptr<MenuItemButton>selectedButton=DYNAMIC_POINTER_CAST<MenuItemButton>(*component);
int newRowIndex=std::clamp(selectedButton.lock()->inventoryIndex-1,(selectedButton.lock()->inventoryIndex/invWidth)*invWidth,std::min(itemsList.size(),(selectedButton.lock()->inventoryIndex/invWidth+1)*invWidth-1)); //Moving left, we need to wrap around if we get to the edge. int rowBaseIndex=(selectedButton.lock()->inventoryIndex/invWidth)*invWidth;
if(newRowIndex<0){ int newRowIndex=selectedButton.lock()->inventoryIndex+1;
//This means we have to wrap around. if(newRowIndex>rowBaseIndex+invWidth-1)newRowIndex-=invWidth;
newRowIndex+=itemsList.size(); newRowIndex=std::clamp(newRowIndex,0,int(itemsList.size()-1));
}
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex)); 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. //Select the component that matches this new number.
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<MenuItemButton>(comp).lock()->inventoryIndex==newRowIndex;}); auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<MenuItemButton>(comp)->inventoryIndex==newRowIndex;});
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex)); if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
returnData=component; returnData=*component;
} }
}else{ }else{
returnData="OK Button"; returnData="OK Button";

@ -735,7 +735,7 @@ const ItemScript&ItemInfo::OnUseAction()const{
const bool Item::IsBlank()const{ const bool Item::IsBlank()const{
if(Item::IsBlankStaticCallCounter!=1)ERR("WARNING! You should not call the IsBlank() function directly! Use ISBLANK() macro instead!") if(Item::IsBlankStaticCallCounter!=1)ERR("WARNING! You should not call the IsBlank() function directly! Use ISBLANK() macro instead!")
Item::IsBlankStaticCallCounter--; Item::IsBlankStaticCallCounter--;
return amt==0||it==nullptr; return this==nullptr||amt==0||it==nullptr;
} }
void Inventory::Clear(ITCategory itemCategory){ void Inventory::Clear(ITCategory itemCategory){

@ -393,7 +393,7 @@ std::map<std::pair<InputType,int>,GenericKey::KeyInfo> GenericKey::keyLiteral={
{{KEY, ESCAPE},{"ESC"}}, {{KEY, ESCAPE},{"ESC"}},
{{KEY, RETURN},{"ENTER"}}, {{KEY, RETURN},{"ENTER"}},
{{KEY, ENTER},{"ENTER"}}, {{KEY, ENTER},{"ENTER"}},
{{KEY, PAUSE},{"PAUSE"}}, {{KEY, Key::PAUSE},{"PAUSE"}},
{{KEY, SCROLL},{"SCR LK"}}, {{KEY, SCROLL},{"SCR LK"}},
{{KEY, NP0},{"NP0"}}, {{KEY, NP0},{"NP0"}},
{{KEY, NP1},{"NP1"}}, {{KEY, NP1},{"NP1"}},

@ -76,7 +76,6 @@ Menu::Menu(vf2d pos,vf2d size)
} }
void Menu::InitializeMenus(){ void Menu::InitializeMenus(){
#define MAX_MENUS 32
stack.reserve(MAX_MENUS); stack.reserve(MAX_MENUS);
InitializeConsumableInventoryWindow(); InitializeConsumableInventoryWindow();
InitializeClassSelectionWindow(); InitializeClassSelectionWindow();
@ -102,6 +101,7 @@ void Menu::InitializeMenus(){
InitializeShermanWindow(); InitializeShermanWindow();
InitializeKeyboardInputWindow(); InitializeKeyboardInputWindow();
InitializeNewKeybindInputWindow(); InitializeNewKeybindInputWindow();
InitializePauseWindow();
for(MenuType type=MenuType(int(MenuType::ENUM_START)+1);type<MenuType::ENUM_END;type=MenuType(int(type+1))){ for(MenuType type=MenuType(int(MenuType::ENUM_START)+1);type<MenuType::ENUM_END;type=MenuType(int(type+1))){
if(menus.count(type)==0){ if(menus.count(type)==0){
@ -150,8 +150,8 @@ void Menu::MenuSelect(AiL*game){
bool buttonStillValid=selection.lock()->onClick(MenuFuncData{*this,game,selection,dynamic_pointer_cast<ScrollableWindowComponent>(selection.lock()->parentComponent.lock())}); bool buttonStillValid=selection.lock()->onClick(MenuFuncData{*this,game,selection,dynamic_pointer_cast<ScrollableWindowComponent>(selection.lock()->parentComponent.lock())});
if(buttonStillValid){ if(buttonStillValid){
if(selection.lock()->menuDest!=MenuType::ENUM_END){ if(selection.lock()->menuDest!=MenuType::ENUM_END){
if(stack.size()<32){ if(stack.size()<MAX_MENUS){
stack.push_back(menus[selection.lock()->menuDest]);//Navigate to the next menu. Menu::OpenMenu(selection.lock()->menuDest); //Navigate to the next menu.
}else{ }else{
ERR("WARNING! Exceeded menu stack size limit!") ERR("WARNING! Exceeded menu stack size limit!")
} }

@ -75,6 +75,7 @@ using ToggleFunc=std::function<bool(ToggleFuncData)>;
#define DEFAULT_DEPTH -999999 #define DEFAULT_DEPTH -999999
#define STARTING_DEPTH 999999 #define STARTING_DEPTH 999999
#define MAX_MENUS 32
using Data=std::variant<ButtonName,std::weak_ptr<MenuComponent>>; using Data=std::variant<ButtonName,std::weak_ptr<MenuComponent>>;
using MenuDataFunc=std::function<void(MenuType,Data&)>; using MenuDataFunc=std::function<void(MenuType,Data&)>;
@ -114,6 +115,7 @@ class Menu:public IAttributable{
static void InitializeShermanWindow(); static void InitializeShermanWindow();
static void InitializeKeyboardInputWindow(); static void InitializeKeyboardInputWindow();
static void InitializeNewKeybindInputWindow(); static void InitializeNewKeybindInputWindow();
static void InitializePauseWindow();
friend class AiL; friend class AiL;
friend class ItemInfo; friend class ItemInfo;

@ -40,6 +40,7 @@ All rights reserved.
#include "drawutil.h" #include "drawutil.h"
#include "util.h" #include "util.h"
#include "ScrollableWindowComponent.h" #include "ScrollableWindowComponent.h"
#include "Menu.h"
INCLUDE_game INCLUDE_game
@ -250,8 +251,8 @@ void MenuComponent::Click(){
bool buttonStillValid=onClick(MenuFuncData{*Menu::menus[parentMenu],game,Menu::menus[parentMenu]->components[name]}); bool buttonStillValid=onClick(MenuFuncData{*Menu::menus[parentMenu],game,Menu::menus[parentMenu]->components[name]});
if(buttonStillValid){ if(buttonStillValid){
if(menuDest!=MenuType::ENUM_END){ if(menuDest!=MenuType::ENUM_END){
if(Menu::stack.size()<32){ if(Menu::stack.size()<MAX_MENUS){
Menu::stack.push_back(Menu::menus[menuDest]);//Navigate to the next menu. Menu::OpenMenu(menuDest); //Navigate to the next menu.
}else{ }else{
ERR("WARNING! Exceeded menu stack size limit!") ERR("WARNING! Exceeded menu stack size limit!")
} }

@ -0,0 +1,43 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com>
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 "Menu.h"
void Menu::InitializePauseWindow(){
Menu*pauseWindow=CreateMenu(MenuType::PAUSE,CENTERED,vi2d{96,164});
}

@ -1,43 +1,15 @@
January 1st January 1st
=========== ===========
Settings Menu
- Any settings should be saved to the save file!
- Volume Controls
- Play Sound in Background (Sound while Focused)
- Keyboard aim assist (When playing w/keyboard, have the game auto fire for players that don't want to use mouse or cannot)
- Terrain Collision Boxes
- Key Configuration
-Upon pressing a key, check if the key is bound to another option, if so,
remove that bind from the list. Up to two keys may be binded per action.
-We have to save keybinds to the save file.
Menu Inputs
- Confirm
- Back
- Menu
- Change Loadout (Overworld Map)
- Unequip
- Left
- Right
- Up
- Down
Gameplay Inputs
- Ability 1,2,3,4
- Item 1,2,3
- Basic Attack
- XP Bar - XP Bar
- Mouse click keybind changes should be possible and mouse buttons should show up in the list along with keyboard mappings.
- If a mouse click is reassigned, it is removed from any other inputs with that mouse click.
- Implement escape menu during gameplay. - Implement escape menu during gameplay.
- If you leave a stage, the stage complete window still shows up, showing only the loot you obtained that session. - If you leave a stage, the stage complete window still shows up, showing only the loot you obtained that session.
- When setting loadout items while loading the game it should highlight the correct item in the consumables inventory as well.
- Clamp bosses in boss arenas. - Clamp bosses in boss arenas.
- Save randomized traveling merchant.
- Track items used during a stage, on death, restore the loadout item quantities used. - Track items used during a stage, on death, restore the loadout item quantities used.
- Add screen shake and rumble as a toggle. - Add screen shake and rumble as a toggle.
@ -46,7 +18,6 @@ Settings Menu
January 31st January 31st
============ ============
Story proofreading/correcting/storyboarding
- Loading Screen - Loading Screen
- Title Screen setpieces - Title Screen setpieces
@ -63,4 +34,6 @@ Story proofreading/correcting/storyboarding
- Auto aim causes retreat-type moves to aim away from the auto target, and prefer the direction the player's moving in. - Auto aim causes retreat-type moves to aim away from the auto target, and prefer the direction the player's moving in.
- Save window position and size - Save window position and size
- Fullscreen toggle

@ -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 6872 #define VERSION_BUILD 6907
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

Loading…
Cancel
Save