Close consumables selection window automatically once a loadout item has been selected. Release Build 8038.

mac-build
sigonasr2 9 months ago
parent 2364176c79
commit cfdc2c9a8c
  1. 2
      Adventures in Lestoria/AdventuresInLestoria.h
  2. 2
      Adventures in Lestoria/Audio.h
  3. 4
      Adventures in Lestoria/CharacterMenuWindow.cpp
  4. 4
      Adventures in Lestoria/CraftingRequirement.cpp
  5. 6
      Adventures in Lestoria/CraftingRequirement.h
  6. 2
      Adventures in Lestoria/IT.h
  7. 1
      Adventures in Lestoria/InventoryConsumableWindow.cpp
  8. 29
      Adventures in Lestoria/Item.cpp
  9. 6
      Adventures in Lestoria/Item.h
  10. 4
      Adventures in Lestoria/SaveFile.cpp
  11. 4
      Adventures in Lestoria/Version.h
  12. 10
      Adventures in Lestoria/olcPGEX_TTF.h
  13. 4
      Adventures in Lestoria/olcUTIL_DataFile.h
  14. BIN
      x64/Release/Adventures in Lestoria.exe

@ -116,7 +116,7 @@ public:
static InputGroup KEY_MOUSE_RIGHT;
static float SIZE_CHANGE_SPEED;
double levelTime;
double levelTime=0.;
Camera2D camera;
std::map<MapName,Map>MAP_DATA;
private:

@ -92,7 +92,7 @@ private:
struct BGMPlayParams{
std::string sound;
bool loop;
bool loop=false;
};
class EventData{
public:

@ -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{

@ -37,10 +37,10 @@ All rights reserved.
#pragma endregion
#include "CraftingRequirement.h"
CraftingRequirement::CraftingRequirement(const std::vector<std::pair<IT,int>>&craftingItems,const uint32_t cost,const uint8_t availableChapter)
CraftingRequirement::CraftingRequirement(const std::vector<ItemPair>&craftingItems,const uint32_t cost,const uint8_t availableChapter)
:craftingItems(craftingItems),cost(cost),availableChapter(availableChapter){}
const std::vector<std::pair<IT,int>>&CraftingRequirement::GetItems()const{
const std::vector<ItemPair>&CraftingRequirement::GetItems()const{
return craftingItems;
}
const uint32_t CraftingRequirement::GetCost()const{

@ -39,12 +39,12 @@ All rights reserved.
#include "Item.h"
class CraftingRequirement{
std::vector<std::pair<IT,int>>craftingItems;
std::vector<ItemPair>craftingItems;
uint32_t cost;
uint8_t availableChapter;
public:
CraftingRequirement(const std::vector<std::pair<IT,int>>&craftingItems,const uint32_t cost,const uint8_t availableChapter);
const std::vector<std::pair<IT,int>>&GetItems()const;
CraftingRequirement(const std::vector<ItemPair>&craftingItems,const uint32_t cost,const uint8_t availableChapter);
const std::vector<ItemPair>&GetItems()const;
const uint32_t GetCost()const;
const uint8_t GetAvailableChapter()const;
};

@ -66,3 +66,5 @@ struct std::formatter<IT> {
return std::format_to(ctx.out(),"{}",item.itemName);
}
};
using ItemPair=std::pair<IT,uint32_t>;

@ -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");

@ -189,7 +189,7 @@ void ItemInfo::InitializeItems(){
enhancementStats.SetAttribute(enhancementLevel,attr,dat.GetReal(attrIndex));
attrIndex++;
}
std::vector<std::pair<IT,int>>itemsRequired;
std::vector<ItemPair>itemsRequired;
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<std::pair<IT,int>>itemsRequired;
std::vector<ItemPair>itemsRequired;
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::optional<const::ItemSet*const>setOpt=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)<amt?"#FF0000":"#FFFFFF",
@ -818,14 +821,14 @@ const std::optional<const ItemSet *const>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 "<<setPieces);
return setBonuses[setPieces];
if(setPieces-1<=-1||setPieces-1>=setBonuses.size())ERR("Piece count is invalid! Expecting a value (1-8) but got "<<setPieces);
return setBonuses[setPieces-1];
};
void ItemSet::AddSetBonus(std::string setName,int pieceCount,Stats&bonuses){
if(pieceCount<=0||pieceCount>=9)ERR("Piece count is invalid! Expecting a value (1-8) but got "<<pieceCount);
if(pieceCount-1<=-1||pieceCount-1>=sets[setName].setBonuses.size())ERR("Piece count is invalid! Expecting a value (1-8) but got "<<pieceCount);
sets[setName].name=setName;
for(int i=pieceCount;i<sets[setName].setBonuses.size();i++){
for(int i=pieceCount-1;i<sets[setName].setBonuses.size();i++){
sets[setName].setBonuses[i]+=bonuses;
}
sets[setName].setBonusBreakpoints.push_back({pieceCount,bonuses});
@ -1078,7 +1081,7 @@ void Stats::InitializeDamageReductionTable(){
}
}
void EnhancementInfo::SetCraftingRequirements(const int enhanceLevel,const std::vector<std::pair<IT,int>>&requiredItems,const uint32_t goldCost,const uint8_t availableChapter){
void EnhancementInfo::SetCraftingRequirements(const int enhanceLevel,const std::vector<ItemPair>&requiredItems,const uint32_t goldCost,const uint8_t availableChapter){
while(craftingRequirements.size()<=enhanceLevel){
craftingRequirements.push_back(CraftingRequirement({},0,availableChapter));
}

@ -126,7 +126,7 @@ private:
std::vector<CraftingRequirement>craftingRequirements;
public:
void SetAttribute(int enhanceLevel,ItemAttribute attribute,float value);
void SetCraftingRequirements(const int enhanceLevel,const std::vector<std::pair<IT,int>>&requiredItems,const uint32_t goldCost,const uint8_t availableChapter);
void SetCraftingRequirements(const int enhanceLevel,const std::vector<ItemPair>&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::map<std::string,ItemSet>sets;
std::array<Stats,8>setBonuses;
std::array<Stats,8>setBonuses; //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<std::pair<int,Stats>>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="";

@ -116,13 +116,15 @@ 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.has_value()){ERR(std::format("WARNING! Could not find connection point {}! THIS SHOULD NOT BE HAPPENING! Potential invalid unlock name.",unlockName));
}else{
if(opt_cp.value()->Visited()){
saveFile["Unlocks"][unlockName].SetString("True",1U);
}else{
saveFile["Unlocks"][unlockName].SetString("False",1U);
}
}
}
for(auto&[taskName,task]:Tutorial::taskList){
saveFile["Tutorial"][std::to_string(int(taskName))].SetBool(Tutorial::TaskIsComplete(taskName));

@ -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

@ -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<int>::max();
int intMin = std::numeric_limits<int>::min();
constexpr int intMax = std::numeric_limits<int>::max();
constexpr int intMin = std::numeric_limits<int>::min();
int minX = intMax;
int minY = intMax;
@ -298,6 +298,7 @@ namespace olc {
pen.y += kern.y;
}
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);
@ -318,6 +319,7 @@ namespace olc {
sprite);
}
}
}
pge->SetPixelMode(prevMode);

@ -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);
}

Loading…
Cancel
Save