diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index f1c10734..4208388a 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -116,7 +116,7 @@ public: static InputGroup KEY_MOUSE_RIGHT; static float SIZE_CHANGE_SPEED; - double levelTime; + double levelTime=0.; Camera2D camera; std::mapMAP_DATA; private: diff --git a/Adventures in Lestoria/Audio.h b/Adventures in Lestoria/Audio.h index 00861401..578db573 100644 --- a/Adventures in Lestoria/Audio.h +++ b/Adventures in Lestoria/Audio.h @@ -92,7 +92,7 @@ private: struct BGMPlayParams{ std::string sound; - bool loop; + bool loop=false; }; class EventData{ public: diff --git a/Adventures in Lestoria/CharacterMenuWindow.cpp b/Adventures in Lestoria/CharacterMenuWindow.cpp index e6e1cb85..bba3877e 100644 --- a/Adventures in Lestoria/CharacterMenuWindow.cpp +++ b/Adventures in Lestoria/CharacterMenuWindow.cpp @@ -217,9 +217,9 @@ void Menu::InitializeCharacterMenuWindow(){ game->GetPlayer()->RestoreMana(manaBeforeEquip-game->GetPlayer()->GetMana(),true); } if(!ISBLANK(otherItem)){ - if(slot==EquipSlot::RING1)Inventory::EquipItem(otherItem,EquipSlot::RING2); + if(slot&EquipSlot::RING1)Inventory::EquipItem(otherItem,EquipSlot::RING2); else - if(slot==EquipSlot::RING2)Inventory::EquipItem(otherItem,EquipSlot::RING1); + if(slot&EquipSlot::RING2)Inventory::EquipItem(otherItem,EquipSlot::RING1); } } }else{ diff --git a/Adventures in Lestoria/CraftingRequirement.cpp b/Adventures in Lestoria/CraftingRequirement.cpp index e65f7d51..78dd6cfb 100644 --- a/Adventures in Lestoria/CraftingRequirement.cpp +++ b/Adventures in Lestoria/CraftingRequirement.cpp @@ -37,10 +37,10 @@ All rights reserved. #pragma endregion #include "CraftingRequirement.h" -CraftingRequirement::CraftingRequirement(const std::vector>&craftingItems,const uint32_t cost,const uint8_t availableChapter) +CraftingRequirement::CraftingRequirement(const std::vector&craftingItems,const uint32_t cost,const uint8_t availableChapter) :craftingItems(craftingItems),cost(cost),availableChapter(availableChapter){} -const std::vector>&CraftingRequirement::GetItems()const{ +const std::vector&CraftingRequirement::GetItems()const{ return craftingItems; } const uint32_t CraftingRequirement::GetCost()const{ diff --git a/Adventures in Lestoria/CraftingRequirement.h b/Adventures in Lestoria/CraftingRequirement.h index 9105cac9..7a071260 100644 --- a/Adventures in Lestoria/CraftingRequirement.h +++ b/Adventures in Lestoria/CraftingRequirement.h @@ -39,12 +39,12 @@ All rights reserved. #include "Item.h" class CraftingRequirement{ - std::vector>craftingItems; + std::vectorcraftingItems; uint32_t cost; uint8_t availableChapter; public: - CraftingRequirement(const std::vector>&craftingItems,const uint32_t cost,const uint8_t availableChapter); - const std::vector>&GetItems()const; + CraftingRequirement(const std::vector&craftingItems,const uint32_t cost,const uint8_t availableChapter); + const std::vector&GetItems()const; const uint32_t GetCost()const; const uint8_t GetAvailableChapter()const; }; \ No newline at end of file diff --git a/Adventures in Lestoria/IT.h b/Adventures in Lestoria/IT.h index 67cc663a..f1a50a89 100644 --- a/Adventures in Lestoria/IT.h +++ b/Adventures in Lestoria/IT.h @@ -65,4 +65,6 @@ struct std::formatter { auto format(const IT&item,std::format_context&ctx) const { return std::format_to(ctx.out(),"{}",item.itemName); } -}; \ No newline at end of file +}; + +using ItemPair=std::pair; \ No newline at end of file diff --git a/Adventures in Lestoria/InventoryConsumableWindow.cpp b/Adventures in Lestoria/InventoryConsumableWindow.cpp index 5efb0f45..4867b2d3 100644 --- a/Adventures in Lestoria/InventoryConsumableWindow.cpp +++ b/Adventures in Lestoria/InventoryConsumableWindow.cpp @@ -75,6 +75,7 @@ void Menu::InitializeConsumableInventoryWindow(){ } button.lock()->selected=data.menu.I(A::LOADOUT_SLOT); data.game->SetLoadoutItem(button.lock()->selected,button.lock()->GetItem().lock()->ActualName()); + Menu::CloseMenu(); return true; },InventoryCreator::Player_InventoryUpdate)END; Menu::AddInventoryListener(consumableWindow,"Consumables"); diff --git a/Adventures in Lestoria/Item.cpp b/Adventures in Lestoria/Item.cpp index 23797947..913db2c1 100644 --- a/Adventures in Lestoria/Item.cpp +++ b/Adventures in Lestoria/Item.cpp @@ -189,7 +189,7 @@ void ItemInfo::InitializeItems(){ enhancementStats.SetAttribute(enhancementLevel,attr,dat.GetReal(attrIndex)); attrIndex++; } - std::vector>itemsRequired; + std::vectoritemsRequired; uint32_t goldCost=0; if(enhancementLevel!=0){ //The first level does not require any crafting, skip this level. while(data[key]["Crafting"][std::format("Level[{}]",enhancementLevel)].HasProperty(std::format("Item[{}]",itemsRequired.size()))){ @@ -222,7 +222,7 @@ void ItemInfo::InitializeItems(){ } if(data[key].HasProperty("Crafting")&&!data[key]["Crafting"].HasProperty("Level[1]")){ - std::vector>itemsRequired; + std::vectoritemsRequired; uint32_t goldCost=0; uint8_t availableChapter=1; //If the item has a key called "Crafting" but did not specify a level number, then we assume this item just has one base level for normal crafting and thus we will add the requirements to craft this item under enhancement level 1. @@ -357,7 +357,7 @@ std::string ItemProps::GetStringProp(const std::string&prop,size_t index)const{ const uint32_t ItemProps::PropCount(const std::string&prop)const{ if(customProps->HasProperty(prop)) return (*customProps)[prop].GetValueCount(); - else return (*scriptProps)[prop].GetValueCount(); + else return uint32_t((*scriptProps)[prop].GetValueCount()); } void ItemInfo::InitializeScripts(){ @@ -367,7 +367,7 @@ void ItemInfo::InitializeScripts(){ int restoreAmt=props.GetIntProp(propName); action(game,restoreAmt); if(restoreAmt>0&&props.PropCount(propName)==3){ - game->GetPlayer()->AddBuff(RESTORATION,props.GetFloatProp(propName,2),restoreAmt,props.GetFloatProp(propName,1),action); + game->GetPlayer()->AddBuff(RESTORATION,props.GetFloatProp(propName,2),float(restoreAmt),props.GetFloatProp(propName,1),action); } }; ParseItemScriptData("HP Restore",[&](AiL*game,int restoreAmt){ @@ -404,7 +404,7 @@ void ItemInfo::InitializeScripts(){ int restoreAmt=props.GetIntProp(propName); action(game,restoreAmt); if(restoreAmt>0&&props.PropCount(propName)==3){ - game->GetPlayer()->AddBuff(RESTORATION_DURING_CAST,props.GetFloatProp(propName,2),restoreAmt,props.GetFloatProp(propName,1),action); + game->GetPlayer()->AddBuff(RESTORATION_DURING_CAST,props.GetFloatProp(propName,2),float(restoreAmt),props.GetFloatProp(propName,1),action); } }; ParseItemScriptData("HP Restore",[&](AiL*game,int restoreAmt){ @@ -658,8 +658,11 @@ const std::string Item::Description(CompactText compact)const{ } description+='\n'; description+=GetStats().GetStatsString(Stats::NO_MAX_HIGHLIGHT,compact); - if(ItemSet()){ - const::ItemSet*const set=ItemSet().value(); + + std::optionalsetOpt=ItemSet(); + + if(setOpt){ + const::ItemSet*const set=setOpt.value(); if(compact==COMPACT){ description+="\n"+set->GetSetName()+" Set - "; }else{ @@ -688,7 +691,7 @@ const std::string Item::Description(CompactText compact)const{ size_t enhanceIndex=std::min(EnhancementLevel()+1,"Item.Item Max Enhancement Level"_I); if(IsEquippable()&&Inventory::GetItemCount(ActualName())==0)enhanceIndex=0; - const EnhancementLevelInfo&info=GetEnhancementInfo()[enhanceIndex]; + const EnhancementLevelInfo&info=GetEnhancementInfo()[int(enhanceIndex)]; for(const auto&[name,amt]:info.craftingRequirement.GetItems()){ description+=std::format("{}{} x{} ({})\n", Inventory::GetItemCount(name)ItemInfo::ItemSet()const{ }; const Stats&ItemSet::operator[](int setPieces)const{ - if(setPieces<=0||setPieces>=9)ERR("Piece count is invalid! Expecting a value (1-8) but got "<=setBonuses.size())ERR("Piece count is invalid! Expecting a value (1-8) but got "<=9)ERR("Piece count is invalid! Expecting a value (1-8) but got "<=sets[setName].setBonuses.size())ERR("Piece count is invalid! Expecting a value (1-8) but got "<>&requiredItems,const uint32_t goldCost,const uint8_t availableChapter){ +void EnhancementInfo::SetCraftingRequirements(const int enhanceLevel,const std::vector&requiredItems,const uint32_t goldCost,const uint8_t availableChapter){ while(craftingRequirements.size()<=enhanceLevel){ craftingRequirements.push_back(CraftingRequirement({},0,availableChapter)); } diff --git a/Adventures in Lestoria/Item.h b/Adventures in Lestoria/Item.h index 5fe290eb..a6ee1974 100644 --- a/Adventures in Lestoria/Item.h +++ b/Adventures in Lestoria/Item.h @@ -126,7 +126,7 @@ private: std::vectorcraftingRequirements; public: void SetAttribute(int enhanceLevel,ItemAttribute attribute,float value); - void SetCraftingRequirements(const int enhanceLevel,const std::vector>&requiredItems,const uint32_t goldCost,const uint8_t availableChapter); + void SetCraftingRequirements(const int enhanceLevel,const std::vector&requiredItems,const uint32_t goldCost,const uint8_t availableChapter); const bool CanBeEnhanced()const; const EnhancementLevelInfo operator[](int level)const; const size_t size()const; @@ -146,7 +146,7 @@ public: class ItemSet{ friend class ItemInfo; static std::mapsets; - std::arraysetBonuses; + std::arraysetBonuses; //Stores the set bonuses with the amount of pieces being the index array - 1 internally. So if we wanted the set bonus for having 1 of this set equipped, we ask for [1] (and it's stored internally at index 0.) std::string name; std::vector>setBonusBreakpoints; public: @@ -308,7 +308,7 @@ class ItemInfo{ std::string category; float castTime=0; float cooldownTime=0; - EquipSlot slot; + EquipSlot slot=EquipSlot::NONE; EnhancementInfo enhancement; ::Decal*img; EventName useSound=""; diff --git a/Adventures in Lestoria/SaveFile.cpp b/Adventures in Lestoria/SaveFile.cpp index 0812d2a9..f222cc0c 100644 --- a/Adventures in Lestoria/SaveFile.cpp +++ b/Adventures in Lestoria/SaveFile.cpp @@ -116,11 +116,13 @@ const void SaveFile::SaveGame(){ if(unlockName=="WORLD_MAP")continue; //This is a special exception, because the world map is not an actual stage. auto opt_cp=State_OverworldMap::ConnectionPointFromString(unlockName); - if(!opt_cp.has_value())ERR(std::format("WARNING! Could not find connection point {}! THIS SHOULD NOT BE HAPPENING! Potential invalid unlock name.",unlockName)); - if(opt_cp.value()->Visited()){ - saveFile["Unlocks"][unlockName].SetString("True",1U); + if(!opt_cp.has_value()){ERR(std::format("WARNING! Could not find connection point {}! THIS SHOULD NOT BE HAPPENING! Potential invalid unlock name.",unlockName)); }else{ - saveFile["Unlocks"][unlockName].SetString("False",1U); + if(opt_cp.value()->Visited()){ + saveFile["Unlocks"][unlockName].SetString("True",1U); + }else{ + saveFile["Unlocks"][unlockName].SetString("False",1U); + } } } diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index b71d28a8..f07a893b 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -38,8 +38,8 @@ All rights reserved. #pragma once #define VERSION_MAJOR 0 #define VERSION_MINOR 5 -#define VERSION_PATCH 0 -#define VERSION_BUILD 8023 +#define VERSION_PATCH 1 +#define VERSION_BUILD 8038 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/olcPGEX_TTF.h b/Adventures in Lestoria/olcPGEX_TTF.h index bf7928bd..43b867be 100644 --- a/Adventures in Lestoria/olcPGEX_TTF.h +++ b/Adventures in Lestoria/olcPGEX_TTF.h @@ -78,7 +78,7 @@ namespace olc { } Font(const Font &other) = delete; - Font(Font &&other) { + Font(Font &&other)noexcept{ fontFace = other.fontFace; fontSize = other.fontSize; fallbacks = std::move(other.fallbacks); @@ -87,7 +87,7 @@ namespace olc { } Font &operator=(const Font &other) = delete; - Font &operator=(Font &&other) { + Font &operator=(Font &&other)noexcept{ fontFace = other.fontFace; fontSize = other.fontSize; fallbacks = std::move(other.fallbacks); @@ -109,8 +109,8 @@ namespace olc { pen.y = 0; olc::FontRect rect; - int intMax = std::numeric_limits::max(); - int intMin = std::numeric_limits::min(); + constexpr int intMax = std::numeric_limits::max(); + constexpr int intMin = std::numeric_limits::min(); int minX = intMax; int minY = intMax; @@ -298,24 +298,26 @@ namespace olc { pen.y += kern.y; } - FT_Set_Transform(toUse->fontFace, nullptr, &pen); - FT_Error error = FT_Load_Char(toUse->fontFace, chr, - FT_LOAD_RENDER | FT_LOAD_COLOR); - - FT_Bitmap bmp = toUse->fontFace->glyph->bitmap; - FT_GlyphSlot slot = toUse->fontFace->glyph; - - pen.x += toUse->fontFace->glyph->advance.x; - pen.y += toUse->fontFace->glyph->advance.y; - - if(chr=='\n'){ - int scaled_line_spacing = fontFace->size->metrics.height; - pen.y -=scaled_line_spacing; - pen.x=rect.offset.x; - } else { - DrawBitmapTo(slot->bitmap_left, - pge->ScreenHeight() - slot->bitmap_top, bmp, textCol, - sprite); + if(toUse!=nullptr){ + FT_Set_Transform(toUse->fontFace, nullptr, &pen); + FT_Error error = FT_Load_Char(toUse->fontFace, chr, + FT_LOAD_RENDER | FT_LOAD_COLOR); + + FT_Bitmap bmp = toUse->fontFace->glyph->bitmap; + FT_GlyphSlot slot = toUse->fontFace->glyph; + + pen.x += toUse->fontFace->glyph->advance.x; + pen.y += toUse->fontFace->glyph->advance.y; + + if(chr=='\n'){ + int scaled_line_spacing = fontFace->size->metrics.height; + pen.y -=scaled_line_spacing; + pen.x=rect.offset.x; + } else { + DrawBitmapTo(slot->bitmap_left, + pge->ScreenHeight() - slot->bitmap_top, bmp, textCol, + sprite); + } } } diff --git a/Adventures in Lestoria/olcUTIL_DataFile.h b/Adventures in Lestoria/olcUTIL_DataFile.h index a8a4ce6e..89f3a0cb 100644 --- a/Adventures in Lestoria/olcUTIL_DataFile.h +++ b/Adventures in Lestoria/olcUTIL_DataFile.h @@ -112,13 +112,13 @@ namespace olc::utils } // Retrieves the Real Value of a Property (for a given index) or 0.0 - inline const double GetReal(const size_t nItem = 0) const + inline const float GetReal(const size_t nItem = 0) const { return std::atof(GetString(nItem).c_str()); } // Sets the Real Value of a Property (for a given index) - inline void SetReal(const double d, const size_t nItem = 0) + inline void SetReal(const float d, const size_t nItem = 0) { SetString(std::to_string(d), nItem); } diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index cacc970f..24cc67bf 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ