Implemented the Artificer Accessory Disassembling menu. Added support for children of RowInventoryScrollingWindowComponents to be selected. Added a MenuDecal menu component. Release Build 11414.

pull/65/head
sigonasr2 3 months ago
parent ac934eead5
commit da65f1525b
  1. 4
      Adventures in Lestoria/Adventures in Lestoria.vcxproj
  2. 3
      Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
  3. 4
      Adventures in Lestoria/AdventuresInLestoria.cpp
  4. 77
      Adventures in Lestoria/ArtificerDisassembleWindow.cpp
  5. 2
      Adventures in Lestoria/Crawler_Artificer.txt
  6. 4
      Adventures in Lestoria/Item.cpp
  7. 8
      Adventures in Lestoria/Item.h
  8. 54
      Adventures in Lestoria/MenuDecal.h
  9. 4
      Adventures in Lestoria/MenuLabel.h
  10. 16
      Adventures in Lestoria/RowInventoryScrollableWindowComponent.h
  11. 9
      Adventures in Lestoria/RowItemDisplay.h
  12. 8
      Adventures in Lestoria/SaveFile.cpp
  13. 2
      Adventures in Lestoria/Version.h
  14. 5
      Adventures in Lestoria/assets/config/audio/events.txt
  15. 1
      Adventures in Lestoria/assets/config/gfx/gfx.txt
  16. BIN
      Adventures in Lestoria/assets/downarrow.png
  17. BIN
      Adventures in Lestoria/assets/gamepack.pak
  18. BIN
      Adventures in Lestoria/assets/sounds/disassemble.ogg
  19. BIN
      x64/Release/Adventures in Lestoria.exe

@ -521,6 +521,10 @@
<SubType> <SubType>
</SubType> </SubType>
</ClInclude> </ClInclude>
<ClInclude Include="MenuDecal.h">
<SubType>
</SubType>
</ClInclude>
<ClInclude Include="MenuDefinitions.h" /> <ClInclude Include="MenuDefinitions.h" />
<ClInclude Include="MenuItemLabel.h"> <ClInclude Include="MenuItemLabel.h">
<SubType> <SubType>

@ -693,6 +693,9 @@
<ClInclude Include="Oscillator.h"> <ClInclude Include="Oscillator.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="MenuDecal.h">
<Filter>Header Files\Interface</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Player.cpp"> <ClCompile Include="Player.cpp">

@ -427,8 +427,8 @@ bool AiL::OnConsoleCommand(const std::string& sCommand){
}else }else
if(args[0]=="/give"){ if(args[0]=="/give"){
if(args.size()<2)ConsoleOut()<<"Usage: /give <Item Name> [Amount]"<<std::endl; if(args.size()<2)ConsoleOut()<<"Usage: /give <Item Name> [Amount]"<<std::endl;
uint8_t itemAmt{1}; uint32_t itemAmt{1};
if(args.size()>=3)itemAmt=std::stoi(args[2]); if(args.size()>=3)itemAmt=std::stoul(args[2]);
Inventory::AddItem(args[1],itemAmt); Inventory::AddItem(args[1],itemAmt);
ConsoleOut()<<"Added x"<<int(itemAmt)<<" "<<args[1]<<" to player's inventory."<<std::endl; ConsoleOut()<<"Added x"<<int(itemAmt)<<" "<<args[1]<<" to player's inventory."<<std::endl;
}else }else

@ -42,32 +42,93 @@ All rights reserved.
#include "InventoryCreator.h" #include "InventoryCreator.h"
#include "MenuItemItemButton.h" #include "MenuItemItemButton.h"
#include "RowItemDisplay.h" #include "RowItemDisplay.h"
#include "MenuDecal.h"
#include "SoundEffect.h"
INCLUDE_game INCLUDE_game
void Menu::InitializeArtificerDisassembleWindow(){ void Menu::InitializeArtificerDisassembleWindow(){
Menu*artificerDisassembleWindow=CreateMenu(ARTIFICER_DISASSEMBLE,CENTERED,game->GetScreenSize()-vi2d{52,52}); Menu*artificerDisassembleWindow=CreateMenu(ARTIFICER_DISASSEMBLE,CENTERED,game->GetScreenSize()-vi2d{52,52});
const auto ResetDisassemblyDisplay=[artificerDisassembleWindow](){
MenuType menuType{artificerDisassembleWindow->GetType()};
Component<MenuDecal>(menuType,"Down Arrow")->Disable();
Component<MenuIconButton>(menuType,"Disassembly Result")->Disable();
Component<MenuLabel>(menuType,"Disassembly Result Title")->Disable();
Component<MenuLabel>(menuType,"Fragment Total Count")->Disable();
Component<MenuComponent>(menuType,"Disassemble Button")->Disable();
};
const auto EnableDisassemblyDisplay=[artificerDisassembleWindow](){
MenuType menuType{artificerDisassembleWindow->GetType()};
Component<MenuDecal>(menuType,"Down Arrow")->Enable();
Component<MenuIconButton>(menuType,"Disassembly Result")->Enable();
Component<MenuLabel>(menuType,"Disassembly Result Title")->Enable();
Component<MenuLabel>(menuType,"Fragment Total Count")->Enable();
Component<MenuComponent>(menuType,"Disassemble Button")->Enable();
};
auto disassemblyTitleLabel{artificerDisassembleWindow->ADD("Disassembly Title Label",MenuLabel)(geom2d::rect<float>{{},{artificerDisassembleWindow->size.x,24.f}},"Accessory Disassembly",2.f,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END}; auto disassemblyTitleLabel{artificerDisassembleWindow->ADD("Disassembly Title Label",MenuLabel)(geom2d::rect<float>{{},{artificerDisassembleWindow->size.x,24.f}},"Accessory Disassembly",2.f,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END};
auto inventoryLabel=artificerDisassembleWindow->ADD("Accessory List Label",MenuLabel)(geom2d::rect<float>{{0.f,28.f},{180.f,12.f}},"Choose Accessory:",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END; auto inventoryLabel=artificerDisassembleWindow->ADD("Accessory List Label",MenuLabel)(geom2d::rect<float>{{0.f,28.f},{180.f,12.f}},"Choose Accessory:",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
auto itemIcon{artificerDisassembleWindow->ADD("Item Icon",MenuItemItemButton)(geom2d::rect<float>({artificerDisassembleWindow->size.x/2+4.f,44.f},{48,48}),Item::BLANK,DO_NOTHING,"","Item Description",IconButtonAttr::NOT_SELECTABLE)END};
itemIcon->SetIconScale({2.f,2.f});
itemIcon->SetCompactDescriptions(true);
auto accessoryDescription{artificerDisassembleWindow->ADD("Item Description",MenuLabel)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+56.f,44.f},{artificerDisassembleWindow->size.x/2-56.f,72.f}},"",0.5f,ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE|ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END};
auto downArrow{artificerDisassembleWindow->ADD("Down Arrow",MenuDecal)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+4.f,92.f},{48,48}},GFX.at("downarrow.png"),DO_NOTHING,DO_NOTHING)END};
auto disassemblyResult{artificerDisassembleWindow->ADD("Disassembly Result",MenuIconButton)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+4.f,141.f},{48,48}},nullptr,DO_NOTHING,IconButtonAttr::NOT_SELECTABLE)END};
auto disassemblyResultTitle{artificerDisassembleWindow->ADD("Disassembly Result Title",MenuLabel)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+56.f,141.f},{artificerDisassembleWindow->size.x/2-56.f,24.f}},"",2.f,ComponentAttr::BACKGROUND|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::FIT_TO_LABEL)END};
auto disassemblyTotalCount{artificerDisassembleWindow->ADD("Fragment Total Count",MenuLabel)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+56.f,127.f},{artificerDisassembleWindow->size.x/2-56.f,12.f}},"",0.85f,ComponentAttr::RIGHT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::FIT_TO_LABEL)END};
auto disassembleButton{artificerDisassembleWindow->ADD("Disassemble Button",MenuComponent)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+72.f,171.f},{artificerDisassembleWindow->size.x/2-72.f,16.f}},"Disassemble",[ResetDisassemblyDisplay](MenuFuncData data){
auto it{Component<MenuItemItemButton>(data.menu.type,"Item Icon")->GetItem()};
if(Inventory::Disassemble(it)==Inventory::DisassembleResult::SUCCESS){
SoundEffect::PlaySFX("Disassemble Item",SoundEffect::CENTERED);
Component<MenuItemItemButton>(data.menu.type,"Item Icon")->SetItem(Item::BLANK);
Component<MenuIconButton>(data.menu.type,"Disassembly Result")->SetIcon(nullptr);
Component<MenuLabel>(data.menu.type,"Disassembly Result Title")->SetLabel("");
Component<MenuLabel>(data.menu.type,"Fragment Total Count")->SetLabel("");
ResetDisassemblyDisplay();
}else{
SoundEffect::PlaySFX("Locked Item",SoundEffect::CENTERED);
game->AddNotification(AiL::Notification{"Cannot disassemble locked accessory!",5.f,RED});
}
return true;
})END};
auto inventoryDisplay=artificerDisassembleWindow->ADD("Accessory List",RowInventoryScrollableWindowComponent)(geom2d::rect<float>{{0.f,44.f},{artificerDisassembleWindow->size.x/2-4.f,artificerDisassembleWindow->size.y-60}},"","",[](MenuFuncData data){ auto inventoryDisplay=artificerDisassembleWindow->ADD("Accessory List",RowInventoryScrollableWindowComponent)(geom2d::rect<float>{{0.f,44.f},{artificerDisassembleWindow->size.x/2-4.f,artificerDisassembleWindow->size.y-60}},"","",[](MenuFuncData data){
RowItemDisplay&item{*DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component)};
DYNAMIC_POINTER_CAST<RowInventoryScrollableWindowComponent>(data.parentComponent.lock())->SelectChild(DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component));
return true; return true;
},[](MenuFuncData data){ },[EnableDisassemblyDisplay](MenuFuncData data){
EnableDisassemblyDisplay();
RowItemDisplay&item{*DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component)}; RowItemDisplay&item{*DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component)};
Component<MenuItemItemButton>(data.menu.type,"Item Icon")->SetItem(item.GetItem().lock()); Component<MenuItemItemButton>(data.menu.type,"Item Icon")->SetItem(item.GetItem().lock());
Component<MenuIconButton>(data.menu.type,"Disassembly Result")->SetIcon(GFX.at(item.GetItem().lock()->FragmentName()).Decal());
Component<MenuLabel>(data.menu.type,"Disassembly Result Title")->SetLabel(item.GetItem().lock()->FragmentName());
Component<MenuLabel>(data.menu.type,"Fragment Total Count")->SetLabel(std::format("Currently Owned: {}",Inventory::GetItemCount(item.GetItem().lock()->FragmentName())));
return true; return true;
},DO_NOTHING, },[ResetDisassemblyDisplay,EnableDisassemblyDisplay](MenuFuncData data){
ResetDisassemblyDisplay();
auto childComponent{DYNAMIC_POINTER_CAST<RowInventoryScrollableWindowComponent>(data.parentComponent.lock())->GetSelectedChild()};
if(childComponent){
RowItemDisplay&item{childComponent.value().get()};
Component<MenuItemItemButton>(data.menu.type,"Item Icon")->SetItem(item.GetItem().lock());
Component<MenuIconButton>(data.menu.type,"Disassembly Result")->SetIcon(GFX.at(item.GetItem().lock()->FragmentName()).Decal());
Component<MenuLabel>(data.menu.type,"Disassembly Result Title")->SetLabel(item.GetItem().lock()->FragmentName());
Component<MenuLabel>(data.menu.type,"Fragment Total Count")->SetLabel(std::format("Currently Owned: {}",Inventory::GetItemCount(item.GetItem().lock()->FragmentName())));
EnableDisassemblyDisplay();
}
return true;
},
InventoryCreator::RowPlayer_InventoryUpdate, InventoryCreator::RowPlayer_InventoryUpdate,
InventoryWindowOptions{.padding=1,.size={artificerDisassembleWindow->size.x/2-5.f-12.f,28}})END; InventoryWindowOptions{.padding=1,.size={artificerDisassembleWindow->size.x/2-5.f-12.f,28}})END;
auto itemIcon{artificerDisassembleWindow->ADD("Item Icon",MenuItemItemButton)(geom2d::rect<float>({artificerDisassembleWindow->size.x/2+4.f,44.f},{48,48}),Item::BLANK,DO_NOTHING,"","Item Description",IconButtonAttr::NOT_SELECTABLE)END};
itemIcon->SetIconScale({2.f,2.f});
itemIcon->SetCompactDescriptions(true);
auto accessoryDescription{artificerDisassembleWindow->ADD("Item Description",MenuLabel)(geom2d::rect<float>({artificerDisassembleWindow->size.x/2+56.f,44.f},{artificerDisassembleWindow->size.x/2-56.f,72.f}),"",0.5f,ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE|ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END};
auto backButton=artificerDisassembleWindow->ADD("Back",MenuComponent)(geom2d::rect<float>{{0.f,artificerDisassembleWindow->size.y-12.f},{96.f,16.f}},"Back",[](MenuFuncData data){ auto backButton=artificerDisassembleWindow->ADD("Back",MenuComponent)(geom2d::rect<float>{{0.f,artificerDisassembleWindow->size.y-12.f},{96.f,16.f}},"Back",[](MenuFuncData data){
Menu::CloseMenu(); Menu::CloseMenu();
return true; return true;

@ -36,7 +36,7 @@ Artificer has 4 Dialog Options
Enhancing Gear Refining Gear
- increases the stats of an item. - increases the stats of an item.
- Increases a random stat by a random amount that did not reach its cap. (cant go higher then 20% of its current amount in on Enhance attempt and cant go higher then the max stat value of the item) - Increases a random stat by a random amount that did not reach its cap. (cant go higher then 20% of its current amount in on Enhance attempt and cant go higher then the max stat value of the item)
- Costs 1 piece of the Ring you want to enhance + 20g - Costs 1 piece of the Ring you want to enhance + 20g

@ -1414,12 +1414,14 @@ const EquipSlot ItemInfo::StringToEquipSlot(std::string_view slotName){
return nameToEquipSlot[std::string(slotName)]; return nameToEquipSlot[std::string(slotName)];
} }
void Inventory::Disassemble(std::weak_ptr<Item>itemRef){ [[nodiscard]]const Inventory::DisassembleResult Inventory::Disassemble(std::weak_ptr<Item>itemRef){
if(ISBLANK(itemRef))ERR(std::format("WARNING! Trying to feed a blank item into the Disassemble function! THIS SHOULD NOT BE HAPPENING!")); if(ISBLANK(itemRef))ERR(std::format("WARNING! Trying to feed a blank item into the Disassemble function! THIS SHOULD NOT BE HAPPENING!"));
const std::shared_ptr<Item>&currentItem{itemRef.lock()}; const std::shared_ptr<Item>&currentItem{itemRef.lock()};
if(!currentItem->IsAccessory())ERR(std::format("WARNING! Trying to disassemble Item {} which is not an accessory! THIS SHOULD NOT BE HAPPENING!",currentItem->ActualName())); if(!currentItem->IsAccessory())ERR(std::format("WARNING! Trying to disassemble Item {} which is not an accessory! THIS SHOULD NOT BE HAPPENING!",currentItem->ActualName()));
if(currentItem->IsLocked())return DisassembleResult::FAILED;
Inventory::RemoveItem(itemRef); Inventory::RemoveItem(itemRef);
Inventory::AddItem(currentItem->FragmentName(),"Fragment Disassemble Gain Amount"_I); Inventory::AddItem(currentItem->FragmentName(),"Fragment Disassemble Gain Amount"_I);
return DisassembleResult::SUCCESS;
} }
const std::string&Item::FragmentName()const{ const std::string&Item::FragmentName()const{

@ -274,6 +274,12 @@ class Inventory{
friend class InventoryCreator; friend class InventoryCreator;
friend class ItemTests::ItemTest; friend class ItemTests::ItemTest;
public: public:
enum class DisassembleResult{
SUCCESS,
FAILED, //Failure is due to an item being locked.
};
static std::weak_ptr<Item>AddItem(IT it,uint32_t amt=1,bool monsterDrop=false); static std::weak_ptr<Item>AddItem(IT it,uint32_t amt=1,bool monsterDrop=false);
//Returns the actual amount available in your main inventory. //Returns the actual amount available in your main inventory.
[[nodiscard]] static uint32_t GetItemCount(IT it); [[nodiscard]] static uint32_t GetItemCount(IT it);
@ -302,7 +308,7 @@ public:
static void ResetLoadoutItemsUsed(); static void ResetLoadoutItemsUsed();
static void GivePlayerLoadoutItemsUsed(); static void GivePlayerLoadoutItemsUsed();
static const bool EquipsFullyMaxedOut(int maxWeaponLevel=10,int maxArmorLevel=10); static const bool EquipsFullyMaxedOut(int maxWeaponLevel=10,int maxArmorLevel=10);
static void Disassemble(std::weak_ptr<Item>itemRef); static const Inventory::DisassembleResult Disassemble(std::weak_ptr<Item>itemRef);
static bool SwapItems(ITCategory itemCategory,uint32_t slot1,uint32_t slot2); static bool SwapItems(ITCategory itemCategory,uint32_t slot1,uint32_t slot2);
//Makes sure this is a valid category. Will error out if it doesn't exist! Use for ERROR HANDLING! //Makes sure this is a valid category. Will error out if it doesn't exist! Use for ERROR HANDLING!

@ -0,0 +1,54 @@
#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
#pragma once
#include "MenuComponent.h"
class MenuDecal:public MenuComponent{
public:
inline MenuDecal(geom2d::rect<float>rect,Renderable&image,MenuFunc onClick,MenuFunc onHover)
:image(image),MenuComponent(rect,"",onClick,ButtonAttr::NONE){
SetHoverFunc(onHover);
}
inline void DrawDecal(ViewPort&window,bool focused)override{
window.DrawDecal(rect.pos,image.Decal(),rect.size/image.Sprite()->Size());
}
private:
const Renderable&image;
};

@ -105,7 +105,7 @@ protected:
proportional? proportional?
vf2d(game->GetTextSizeProp(finalLabel)*adjustedScale): vf2d(game->GetTextSizeProp(finalLabel)*adjustedScale):
vf2d(game->GetTextSize(finalLabel)*adjustedScale); vf2d(game->GetTextSize(finalLabel)*adjustedScale);
float sizeRatio=(labelTextSize.x)/(rect.size.x-8); float sizeRatio=(labelTextSize.x)/(rect.size.x-6);
if(sizeRatio>1){ if(sizeRatio>1){
adjustedScale.x/=sizeRatio; adjustedScale.x/=sizeRatio;
adjustedShadowScale.x/=sizeRatio; adjustedShadowScale.x/=sizeRatio;
@ -116,7 +116,7 @@ protected:
vf2d drawPos=vf2d{-1,0}+rect.middle()-vf2d{labelTextSize}/2; //Assume centered. vf2d drawPos=vf2d{-1,0}+rect.middle()-vf2d{labelTextSize}/2; //Assume centered.
if(!centered){ if(!centered){
if(rightAlign){ if(rightAlign){
drawPos=vf2d{rect.pos.x+rect.size.x-labelTextSize.x-8,rect.middle().y-labelTextSize.y/2}; //We should at least vertically align here. drawPos=vf2d{rect.pos.x+rect.size.x-labelTextSize.x,rect.middle().y-labelTextSize.y/2}; //We should at least vertically align here.
}else{ //Left Align }else{ //Left Align
drawPos=vf2d{rect.pos.x+2,rect.middle().y-labelTextSize.y/2}; //We should at least vertically align here. drawPos=vf2d{rect.pos.x+2,rect.middle().y-labelTextSize.y/2}; //We should at least vertically align here.
} }

@ -43,6 +43,7 @@ All rights reserved.
class RowInventoryScrollableWindowComponent:public InventoryScrollableWindowComponent{ class RowInventoryScrollableWindowComponent:public InventoryScrollableWindowComponent{
friend class InventoryCreator; friend class InventoryCreator;
friend class Menu; friend class Menu;
std::weak_ptr<RowItemDisplay>selectedComponent;
protected: protected:
PriceLabel::PriceLabel priceLabel=PriceLabel::NONE; PriceLabel::PriceLabel priceLabel=PriceLabel::NONE;
public: public:
@ -67,4 +68,19 @@ public:
itemButton.lock()->SetPriceLabelType(labelType); itemButton.lock()->SetPriceLabelType(labelType);
} }
} }
virtual inline void SelectChild(std::weak_ptr<RowItemDisplay>childComponent){
selectedComponent=childComponent;
for(std::weak_ptr<MenuComponent>child:components){
RowItemDisplay&rowItem{*DYNAMIC_POINTER_CAST<RowItemDisplay>(child)};
rowItem.itemIsSelected=false;
}
selectedComponent.lock()->itemIsSelected=true;
}
virtual inline std::optional<std::reference_wrapper<RowItemDisplay>>GetSelectedChild()const{
if(!selectedComponent.expired()){
return *selectedComponent.lock();
}
return {};
}
}; };

@ -54,6 +54,7 @@ namespace PriceLabel{
} }
class RowItemDisplay:public MenuComponent{ class RowItemDisplay:public MenuComponent{
friend class RowInventoryScrollableWindowComponent;
std::string itemNameLabelName; std::string itemNameLabelName;
std::string itemDescriptionLabelName; std::string itemDescriptionLabelName;
CompactText compact=NON_COMPACT; CompactText compact=NON_COMPACT;
@ -61,6 +62,7 @@ class RowItemDisplay:public MenuComponent{
PriceLabel::PriceLabel priceLabel=PriceLabel::NONE; PriceLabel::PriceLabel priceLabel=PriceLabel::NONE;
bool fadeOutIfMissingRequirements=false; bool fadeOutIfMissingRequirements=false;
bool hideLabelWhileLocked=false; bool hideLabelWhileLocked=false;
bool itemIsSelected=false;
protected: protected:
std::weak_ptr<Item>itemRef; std::weak_ptr<Item>itemRef;
public: public:
@ -96,6 +98,13 @@ public:
window.DrawDecal(rect.pos+vf2d{2,2},const_cast<Decal*>(itemRef.lock()->Decal()),{scaleFactor,scaleFactor},tint); window.DrawDecal(rect.pos+vf2d{2,2},const_cast<Decal*>(itemRef.lock()->Decal()),{scaleFactor,scaleFactor},tint);
window.DrawRectDecal(rect.pos+vf2d{2,2},iconSize,borderCol); window.DrawRectDecal(rect.pos+vf2d{2,2},iconSize,borderCol);
if(itemIsSelected){
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{0.f,1.f},{rect.size.x+1,1},YELLOW);
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{1.f,0.f},{1,rect.size.y+1},YELLOW);
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{-1.f,0.f}+vf2d{rect.size.x-1+1,0},{1,rect.size.y+1},YELLOW);
window.FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{0.f,-1.f}+vf2d{0,rect.size.y-1+1},{rect.size.x+1,1},YELLOW);
}
#pragma region Item Name Display #pragma region Item Name Display
std::string itemName=itemRef.lock()->DisplayName(); std::string itemName=itemRef.lock()->DisplayName();
vf2d scaledSize={std::min(1.f,(rect.size.x-6-iconSize.x)/game->GetTextSizeProp(itemName).x),1}; vf2d scaledSize={std::min(1.f,(rect.size.x-6-iconSize.x)/game->GetTextSizeProp(itemName).x),1};

@ -219,8 +219,8 @@ const void SaveFile::SaveGame(){
fileHashWrittenSuccessfully=utils::datafile::Write(saveFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)); //Once the hash has been computed and added, save the file a second time. fileHashWrittenSuccessfully=utils::datafile::Write(saveFile,"save_file_path"_S+std::format("save.{:04}",saveFileID)); //Once the hash has been computed and added, save the file a second time.
} }
std::error_code result; std::error_code result;
std::filesystem::remove("save_file_path"_S+std::format("save.{:04}",saveFileID)+".tmp",result); const bool succeeded{std::filesystem::remove("save_file_path"_S+std::format("save.{:04}",saveFileID)+".tmp",result)};
if(!result)LOG(std::format("WARNING! Could not delete temporary save file. Error: {}",result.message())); if(!succeeded)LOG(std::format("WARNING! Could not delete temporary save file. Error: {}",result.message()));
#pragma endregion #pragma endregion
//WARNING! DO NOT WRITE ANY CODE BELOW HERE!!!!! THE HASH HAS ALREADY BEEN WRITTEN. //WARNING! DO NOT WRITE ANY CODE BELOW HERE!!!!! THE HASH HAS ALREADY BEEN WRITTEN.
//FILES BECOME CORRUPTED IF THE SAVE FILE IS MODIFIED FROM HERE ONWARDS. //FILES BECOME CORRUPTED IF THE SAVE FILE IS MODIFIED FROM HERE ONWARDS.
@ -366,8 +366,8 @@ void SaveFile::LoadFile(){
} }
std::error_code result; std::error_code result;
std::filesystem::remove("save_file_path"_S+std::format("save.{:04}",saveFileID)+".tmp",result); const bool succeeded{std::filesystem::remove("save_file_path"_S+std::format("save.{:04}",saveFileID)+".tmp",result)};
if(!result)LOG(std::format("WARNING! Could not delete temporary save file. Error: {}",result.message())); if(!succeeded)LOG(std::format("WARNING! Could not delete temporary save file. Error: {}",result.message()));
} }
} }
game->ResetGame(); game->ResetGame();

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 2 #define VERSION_MINOR 2
#define VERSION_PATCH 5 #define VERSION_PATCH 5
#define VERSION_BUILD 11382 #define VERSION_BUILD 11414
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -132,6 +132,11 @@ Events
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = dig.ogg, 100% File[0] = dig.ogg, 100%
} }
Disassemble Item
{
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = disassemble.ogg, 70%
}
Equip Armor Equip Armor
{ {
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)

@ -130,6 +130,7 @@ Images
GFX_Flames = FlamesTexture.png GFX_Flames = FlamesTexture.png
GFX_Comet = comet.png GFX_Comet = comet.png
GFX_CometFlare = comet_flare.png GFX_CometFlare = comet_flare.png
GFX_DownArrow = downarrow.png
GFX_Thief_Sheet = nico-thief.png GFX_Thief_Sheet = nico-thief.png
GFX_Trapper_Sheet = nico-trapper.png GFX_Trapper_Sheet = nico-trapper.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

Loading…
Cancel
Save