Fix Menu crash for tab switching on blacksmith (inactive scrolled menu items were unfocused and unselectable). Added sound effect for toggling button icon sets. Fix Key DrawInput functions to respect new extended icon types. Bosses now respect boundaries of boss arenas. Release Build 7474.

pull/35/head
sigonasr2 9 months ago
parent 63f7062841
commit ee215b132c
  1. 12
      Adventures in Lestoria/BlacksmithCraftingWindow.cpp
  2. 28
      Adventures in Lestoria/CharacterMenuWindow.cpp
  3. 11
      Adventures in Lestoria/Key.cpp
  4. 1
      Adventures in Lestoria/Menu.cpp
  5. 22
      Adventures in Lestoria/Monster.cpp
  6. 4
      Adventures in Lestoria/OverworldMapLevelWindow.cpp
  7. 3
      Adventures in Lestoria/SettingsWindow.cpp
  8. 2
      Adventures in Lestoria/Version.h
  9. 5
      Adventures in Lestoria/assets/config/audio/events.txt
  10. BIN
      x64/Release/Adventures in Lestoria.exe

@ -78,9 +78,9 @@ 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]);
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")));
}
@ -96,9 +96,9 @@ 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]);
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")));
}

@ -327,7 +327,8 @@ void Menu::InitializeCharacterMenuWindow(){
{{game->KEY_MOUSE_RIGHT,Pressed},{[](MenuFuncData data){
if(!data.menu.GetSelection().expired()&&
data.menu.GetSelection().lock()->GetName().starts_with("Equip Slot ")){
if(!ISBLANK(Inventory::GetEquip(EquipSlot(data.menu.GetSelection().lock()->I(Attribute::EQUIP_TYPE))))){
EquipSlot slot=EquipSlot(data.menu.GetSelection().lock()->I(Attribute::EQUIP_TYPE));
if(!ISBLANK(Inventory::GetEquip(slot))){
return "Unequip";
}
}
@ -335,16 +336,22 @@ void Menu::InitializeCharacterMenuWindow(){
},[](MenuType type){
if(!Menu::menus[type]->GetSelection().expired()&&
Menu::menus[type]->GetSelection().lock()->GetName().starts_with("Equip Slot ")){
if(!ISBLANK(Inventory::GetEquip(EquipSlot(Menu::menus[type]->GetSelection().lock()->I(Attribute::EQUIP_TYPE))))){
Inventory::UnequipItem(EquipSlot(Menu::menus[type]->GetSelection().lock()->I(Attribute::EQUIP_TYPE)));
SoundEffect::PlaySFX("Unequip Armor",SoundEffect::CENTERED);
EquipSlot slot=EquipSlot(Menu::menus[type]->GetSelection().lock()->I(Attribute::EQUIP_TYPE));
if(!ISBLANK(Inventory::GetEquip(slot))){
Inventory::UnequipItem(slot);
if(slot&EquipSlot::RING1||slot&EquipSlot::RING2){
SoundEffect::PlaySFX("Unequip Accessory",SoundEffect::CENTERED);
}else{
SoundEffect::PlaySFX("Unequip Armor",SoundEffect::CENTERED);
}
}
}
}}},
{{game->KEY_FACELEFT,Pressed},{[](MenuFuncData data){
if(!data.menu.GetSelection().expired()&&
data.menu.GetSelection().lock()->GetName().starts_with("Equip Slot ")){
if(!ISBLANK(Inventory::GetEquip(EquipSlot(data.menu.GetSelection().lock()->I(Attribute::EQUIP_TYPE))))){
EquipSlot slot=EquipSlot(data.menu.GetSelection().lock()->I(Attribute::EQUIP_TYPE));
if(!ISBLANK(Inventory::GetEquip(slot))){
return "Unequip";
}
}
@ -352,9 +359,14 @@ void Menu::InitializeCharacterMenuWindow(){
},[](MenuType type){
if(!Menu::menus[type]->GetSelection().expired()&&
Menu::menus[type]->GetSelection().lock()->GetName().starts_with("Equip Slot ")){
if(!ISBLANK(Inventory::GetEquip(EquipSlot(Menu::menus[type]->GetSelection().lock()->I(Attribute::EQUIP_TYPE))))){
Inventory::UnequipItem(EquipSlot(Menu::menus[type]->GetSelection().lock()->I(Attribute::EQUIP_TYPE)));
SoundEffect::PlaySFX("Unequip Armor",SoundEffect::CENTERED);
EquipSlot slot=EquipSlot(Menu::menus[type]->GetSelection().lock()->I(Attribute::EQUIP_TYPE));
if(!ISBLANK(Inventory::GetEquip(slot))){
Inventory::UnequipItem(slot);
if(slot&EquipSlot::RING1||slot&EquipSlot::RING2){
SoundEffect::PlaySFX("Unequip Accessory",SoundEffect::CENTERED);
}else{
SoundEffect::PlaySFX("Unequip Armor",SoundEffect::CENTERED);
}
}
}
}}},

@ -316,6 +316,11 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
if(type!=CONTROLLER&&type!=MOUSE){
for(const Input&input:keyOrder){
if(input.GetType()==MOUSE){
if(input.HasExtendedIcons()){
buttonImgSize.x+=input.GetIcon(GameSettings::GetIconType()).Sprite()->width+"Interface.InputHelperSpacing"_F;
buttonImgSize.y=std::max(buttonImgSize.y,float(input.GetIcon(GameSettings::GetIconType()).Sprite()->height));
buttonImgs.push_back(input.GetIcon(GameSettings::GetIconType()).Decal());
}else
if(input.HasIcon()){
buttonImgSize.x+=input.GetIcon().Sprite()->width+"Interface.InputHelperSpacing"_F;
buttonImgSize.y=std::max(buttonImgSize.y,float(input.GetIcon().Sprite()->height));
@ -330,8 +335,12 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
}
if(primaryKey.has_value()){
if(primaryKey.value().HasExtendedIcons()){
buttonImgSize.x+=primaryKey.value().GetIcon(GameSettings::GetIconType()).Sprite()->width+"Interface.InputHelperSpacing"_F;
buttonImgSize.y=std::max(buttonImgSize.y,float(primaryKey.value().GetIcon(GameSettings::GetIconType()).Sprite()->height));
buttonImgs.push_back(primaryKey.value().GetIcon(GameSettings::GetIconType()).Decal());
}else
if(primaryKey.value().HasIcon()){
buttonImgSize.x+=primaryKey.value().GetIcon().Sprite()->width+"Interface.InputHelperSpacing"_F;
buttonImgSize.y=std::max(buttonImgSize.y,float(primaryKey.value().GetIcon().Sprite()->height));
buttonImgs.push_back(primaryKey.value().GetIcon().Decal());

@ -715,6 +715,7 @@ const std::weak_ptr<MenuComponent>Menu::GetKeySelection()const{
}
void Menu::SetSelection(std::weak_ptr<MenuComponent>button,const bool scroll,const bool reset){
if(button.expired())return;
selection=button;
if(navigationGroups.count(button.lock()->GetName())||
!button.lock()->parentComponent.expired()&&navigationGroups.count(button.lock()->parentComponent.lock()->GetName())){

@ -151,8 +151,17 @@ bool Monster::_SetX(float x,const bool monsterInvoked){
return true;
} else {
geom2d::rect<float>collision={collisionRect.pos,collisionRect.size};
bool insideArenaBounds=true;
#pragma region Calculate Arena Bounds check for Bosses
if(isBoss){
const geom2d::rect<int>arenaBounds=game->GetZones().at("BossArena")[0].zone;
if(!geom2d::contains(arenaBounds,newPos)){
insideArenaBounds=false;
}
}
#pragma endregion
#pragma region lambdas
auto NoEnemyCollisionWithTile=[&](){return isBoss||!geom2d::overlaps(newPos,collision);};
auto NoEnemyCollisionWithTile=[&](){return (isBoss&&insideArenaBounds)||!geom2d::overlaps(newPos,collision);};
#pragma endregion
collision.pos+=tilePos;
if(NoEnemyCollisionWithTile()){
@ -181,8 +190,17 @@ bool Monster::_SetY(float y,const bool monsterInvoked){
return true;
} else {
geom2d::rect<float>collision={collisionRect.pos,collisionRect.size};
bool insideArenaBounds=true;
#pragma region Calculate Arena Bounds check for Bosses
if(isBoss){
const geom2d::rect<int>arenaBounds=game->GetZones().at("BossArena")[0].zone;
if(!geom2d::contains(arenaBounds,newPos)){
insideArenaBounds=false;
}
}
#pragma endregion
#pragma region lambdas
auto NoEnemyCollisionWithTile=[&](){return isBoss||!geom2d::overlaps(newPos,collision);};
auto NoEnemyCollisionWithTile=[&](){return (isBoss&&insideArenaBounds)||!geom2d::overlaps(newPos,collision);};
#pragma endregion
collision.pos+=tilePos;
if(NoEnemyCollisionWithTile()){

@ -74,7 +74,9 @@ void Menu::InitializeOverworldMapLevelWindow(){
Menu::OpenMenu(OVERWORLD_MENU);
}}},
{{game->KEY_CONFIRM},{"Start Stage",[](MenuType type){
Component<MenuComponent>(type,"Enter Button")->Click();
if(!Menu::UsingMouseNavigation()){
Component<MenuComponent>(type,"Enter Button")->Click();
}
}}},
{{game->KEY_CHANGE_LOADOUT},{"Change Loadout",[](MenuType type){
Component<MenuComponent>(type,"Change Loadout Button")->Click();

@ -157,6 +157,9 @@ void Menu::InitializeSettingsWindow(){
ERR(std::format("WARNING! Unhandled icon type {}!",int(GameSettings::GetIconType())));
}
}
if(Menu::IsCurrentlyActive(data.menu.GetType())){
SoundEffect::PlaySFX("Button Click",SoundEffect::CENTERED);
}
return true;
})END;

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

@ -196,6 +196,11 @@ Events
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = equip2.ogg, 60%
}
Unequip Accessory
{
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = equip_ring.ogg, 60%, 70%, 70%
}
Ursule Dead
{
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)

Loading…
Cancel
Save