Close consumables selection window automatically once a loadout item has been selected. Release Build 8038.
This commit is contained in:
parent
72c5a7394b
commit
13854574c9
@ -116,7 +116,7 @@ public:
|
|||||||
static InputGroup KEY_MOUSE_RIGHT;
|
static InputGroup KEY_MOUSE_RIGHT;
|
||||||
|
|
||||||
static float SIZE_CHANGE_SPEED;
|
static float SIZE_CHANGE_SPEED;
|
||||||
double levelTime;
|
double levelTime=0.;
|
||||||
Camera2D camera;
|
Camera2D camera;
|
||||||
std::map<MapName,Map>MAP_DATA;
|
std::map<MapName,Map>MAP_DATA;
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -92,7 +92,7 @@ private:
|
|||||||
|
|
||||||
struct BGMPlayParams{
|
struct BGMPlayParams{
|
||||||
std::string sound;
|
std::string sound;
|
||||||
bool loop;
|
bool loop=false;
|
||||||
};
|
};
|
||||||
class EventData{
|
class EventData{
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -217,9 +217,9 @@ void Menu::InitializeCharacterMenuWindow(){
|
|||||||
game->GetPlayer()->RestoreMana(manaBeforeEquip-game->GetPlayer()->GetMana(),true);
|
game->GetPlayer()->RestoreMana(manaBeforeEquip-game->GetPlayer()->GetMana(),true);
|
||||||
}
|
}
|
||||||
if(!ISBLANK(otherItem)){
|
if(!ISBLANK(otherItem)){
|
||||||
if(slot==EquipSlot::RING1)Inventory::EquipItem(otherItem,EquipSlot::RING2);
|
if(slot&EquipSlot::RING1)Inventory::EquipItem(otherItem,EquipSlot::RING2);
|
||||||
else
|
else
|
||||||
if(slot==EquipSlot::RING2)Inventory::EquipItem(otherItem,EquipSlot::RING1);
|
if(slot&EquipSlot::RING2)Inventory::EquipItem(otherItem,EquipSlot::RING1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@ -37,10 +37,10 @@ All rights reserved.
|
|||||||
#pragma endregion
|
#pragma endregion
|
||||||
#include "CraftingRequirement.h"
|
#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){}
|
: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;
|
return craftingItems;
|
||||||
}
|
}
|
||||||
const uint32_t CraftingRequirement::GetCost()const{
|
const uint32_t CraftingRequirement::GetCost()const{
|
||||||
|
|||||||
@ -39,12 +39,12 @@ All rights reserved.
|
|||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
|
|
||||||
class CraftingRequirement{
|
class CraftingRequirement{
|
||||||
std::vector<std::pair<IT,int>>craftingItems;
|
std::vector<ItemPair>craftingItems;
|
||||||
uint32_t cost;
|
uint32_t cost;
|
||||||
uint8_t availableChapter;
|
uint8_t availableChapter;
|
||||||
public:
|
public:
|
||||||
CraftingRequirement(const std::vector<std::pair<IT,int>>&craftingItems,const uint32_t cost,const uint8_t availableChapter);
|
CraftingRequirement(const std::vector<ItemPair>&craftingItems,const uint32_t cost,const uint8_t availableChapter);
|
||||||
const std::vector<std::pair<IT,int>>&GetItems()const;
|
const std::vector<ItemPair>&GetItems()const;
|
||||||
const uint32_t GetCost()const;
|
const uint32_t GetCost()const;
|
||||||
const uint8_t GetAvailableChapter()const;
|
const uint8_t GetAvailableChapter()const;
|
||||||
};
|
};
|
||||||
@ -66,3 +66,5 @@ struct std::formatter<IT> {
|
|||||||
return std::format_to(ctx.out(),"{}",item.itemName);
|
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);
|
button.lock()->selected=data.menu.I(A::LOADOUT_SLOT);
|
||||||
data.game->SetLoadoutItem(button.lock()->selected,button.lock()->GetItem().lock()->ActualName());
|
data.game->SetLoadoutItem(button.lock()->selected,button.lock()->GetItem().lock()->ActualName());
|
||||||
|
Menu::CloseMenu();
|
||||||
return true;
|
return true;
|
||||||
},InventoryCreator::Player_InventoryUpdate)END;
|
},InventoryCreator::Player_InventoryUpdate)END;
|
||||||
Menu::AddInventoryListener(consumableWindow,"Consumables");
|
Menu::AddInventoryListener(consumableWindow,"Consumables");
|
||||||
|
|||||||
@ -189,7 +189,7 @@ void ItemInfo::InitializeItems(){
|
|||||||
enhancementStats.SetAttribute(enhancementLevel,attr,dat.GetReal(attrIndex));
|
enhancementStats.SetAttribute(enhancementLevel,attr,dat.GetReal(attrIndex));
|
||||||
attrIndex++;
|
attrIndex++;
|
||||||
}
|
}
|
||||||
std::vector<std::pair<IT,int>>itemsRequired;
|
std::vector<ItemPair>itemsRequired;
|
||||||
uint32_t goldCost=0;
|
uint32_t goldCost=0;
|
||||||
if(enhancementLevel!=0){ //The first level does not require any crafting, skip this level.
|
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()))){
|
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]")){
|
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;
|
uint32_t goldCost=0;
|
||||||
uint8_t availableChapter=1;
|
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.
|
//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{
|
const uint32_t ItemProps::PropCount(const std::string&prop)const{
|
||||||
if(customProps->HasProperty(prop)) return (*customProps)[prop].GetValueCount();
|
if(customProps->HasProperty(prop)) return (*customProps)[prop].GetValueCount();
|
||||||
else return (*scriptProps)[prop].GetValueCount();
|
else return uint32_t((*scriptProps)[prop].GetValueCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemInfo::InitializeScripts(){
|
void ItemInfo::InitializeScripts(){
|
||||||
@ -367,7 +367,7 @@ void ItemInfo::InitializeScripts(){
|
|||||||
int restoreAmt=props.GetIntProp(propName);
|
int restoreAmt=props.GetIntProp(propName);
|
||||||
action(game,restoreAmt);
|
action(game,restoreAmt);
|
||||||
if(restoreAmt>0&&props.PropCount(propName)==3){
|
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){
|
ParseItemScriptData("HP Restore",[&](AiL*game,int restoreAmt){
|
||||||
@ -404,7 +404,7 @@ void ItemInfo::InitializeScripts(){
|
|||||||
int restoreAmt=props.GetIntProp(propName);
|
int restoreAmt=props.GetIntProp(propName);
|
||||||
action(game,restoreAmt);
|
action(game,restoreAmt);
|
||||||
if(restoreAmt>0&&props.PropCount(propName)==3){
|
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){
|
ParseItemScriptData("HP Restore",[&](AiL*game,int restoreAmt){
|
||||||
@ -658,8 +658,11 @@ const std::string Item::Description(CompactText compact)const{
|
|||||||
}
|
}
|
||||||
description+='\n';
|
description+='\n';
|
||||||
description+=GetStats().GetStatsString(Stats::NO_MAX_HIGHLIGHT,compact);
|
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){
|
if(compact==COMPACT){
|
||||||
description+="\n"+set->GetSetName()+" Set - ";
|
description+="\n"+set->GetSetName()+" Set - ";
|
||||||
}else{
|
}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);
|
size_t enhanceIndex=std::min(EnhancementLevel()+1,"Item.Item Max Enhancement Level"_I);
|
||||||
if(IsEquippable()&&Inventory::GetItemCount(ActualName())==0)enhanceIndex=0;
|
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()){
|
for(const auto&[name,amt]:info.craftingRequirement.GetItems()){
|
||||||
description+=std::format("{}{} x{} ({})\n",
|
description+=std::format("{}{} x{} ({})\n",
|
||||||
Inventory::GetItemCount(name)<amt?"#FF0000":"#FFFFFF",
|
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{
|
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);
|
if(setPieces-1<=-1||setPieces-1>=setBonuses.size())ERR("Piece count is invalid! Expecting a value (1-8) but got "<<setPieces);
|
||||||
return setBonuses[setPieces];
|
return setBonuses[setPieces-1];
|
||||||
};
|
};
|
||||||
|
|
||||||
void ItemSet::AddSetBonus(std::string setName,int pieceCount,Stats&bonuses){
|
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;
|
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].setBonuses[i]+=bonuses;
|
||||||
}
|
}
|
||||||
sets[setName].setBonusBreakpoints.push_back({pieceCount,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){
|
while(craftingRequirements.size()<=enhanceLevel){
|
||||||
craftingRequirements.push_back(CraftingRequirement({},0,availableChapter));
|
craftingRequirements.push_back(CraftingRequirement({},0,availableChapter));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -126,7 +126,7 @@ private:
|
|||||||
std::vector<CraftingRequirement>craftingRequirements;
|
std::vector<CraftingRequirement>craftingRequirements;
|
||||||
public:
|
public:
|
||||||
void SetAttribute(int enhanceLevel,ItemAttribute attribute,float value);
|
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 bool CanBeEnhanced()const;
|
||||||
const EnhancementLevelInfo operator[](int level)const;
|
const EnhancementLevelInfo operator[](int level)const;
|
||||||
const size_t size()const;
|
const size_t size()const;
|
||||||
@ -146,7 +146,7 @@ public:
|
|||||||
class ItemSet{
|
class ItemSet{
|
||||||
friend class ItemInfo;
|
friend class ItemInfo;
|
||||||
static std::map<std::string,ItemSet>sets;
|
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::string name;
|
||||||
std::vector<std::pair<int,Stats>>setBonusBreakpoints;
|
std::vector<std::pair<int,Stats>>setBonusBreakpoints;
|
||||||
public:
|
public:
|
||||||
@ -308,7 +308,7 @@ class ItemInfo{
|
|||||||
std::string category;
|
std::string category;
|
||||||
float castTime=0;
|
float castTime=0;
|
||||||
float cooldownTime=0;
|
float cooldownTime=0;
|
||||||
EquipSlot slot;
|
EquipSlot slot=EquipSlot::NONE;
|
||||||
EnhancementInfo enhancement;
|
EnhancementInfo enhancement;
|
||||||
::Decal*img;
|
::Decal*img;
|
||||||
EventName useSound="";
|
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.
|
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);
|
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()){
|
if(opt_cp.value()->Visited()){
|
||||||
saveFile["Unlocks"][unlockName].SetString("True",1U);
|
saveFile["Unlocks"][unlockName].SetString("True",1U);
|
||||||
}else{
|
}else{
|
||||||
saveFile["Unlocks"][unlockName].SetString("False",1U);
|
saveFile["Unlocks"][unlockName].SetString("False",1U);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(auto&[taskName,task]:Tutorial::taskList){
|
for(auto&[taskName,task]:Tutorial::taskList){
|
||||||
saveFile["Tutorial"][std::to_string(int(taskName))].SetBool(Tutorial::TaskIsComplete(taskName));
|
saveFile["Tutorial"][std::to_string(int(taskName))].SetBool(Tutorial::TaskIsComplete(taskName));
|
||||||
|
|||||||
@ -38,8 +38,8 @@ All rights reserved.
|
|||||||
#pragma once
|
#pragma once
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 5
|
#define VERSION_MINOR 5
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 1
|
||||||
#define VERSION_BUILD 8023
|
#define VERSION_BUILD 8038
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
|||||||
@ -78,7 +78,7 @@ namespace olc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Font(const Font &other) = delete;
|
Font(const Font &other) = delete;
|
||||||
Font(Font &&other) {
|
Font(Font &&other)noexcept{
|
||||||
fontFace = other.fontFace;
|
fontFace = other.fontFace;
|
||||||
fontSize = other.fontSize;
|
fontSize = other.fontSize;
|
||||||
fallbacks = std::move(other.fallbacks);
|
fallbacks = std::move(other.fallbacks);
|
||||||
@ -87,7 +87,7 @@ namespace olc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Font &operator=(const Font &other) = delete;
|
Font &operator=(const Font &other) = delete;
|
||||||
Font &operator=(Font &&other) {
|
Font &operator=(Font &&other)noexcept{
|
||||||
fontFace = other.fontFace;
|
fontFace = other.fontFace;
|
||||||
fontSize = other.fontSize;
|
fontSize = other.fontSize;
|
||||||
fallbacks = std::move(other.fallbacks);
|
fallbacks = std::move(other.fallbacks);
|
||||||
@ -109,8 +109,8 @@ namespace olc {
|
|||||||
pen.y = 0;
|
pen.y = 0;
|
||||||
|
|
||||||
olc::FontRect rect;
|
olc::FontRect rect;
|
||||||
int intMax = std::numeric_limits<int>::max();
|
constexpr int intMax = std::numeric_limits<int>::max();
|
||||||
int intMin = std::numeric_limits<int>::min();
|
constexpr int intMin = std::numeric_limits<int>::min();
|
||||||
|
|
||||||
int minX = intMax;
|
int minX = intMax;
|
||||||
int minY = intMax;
|
int minY = intMax;
|
||||||
@ -298,6 +298,7 @@ namespace olc {
|
|||||||
pen.y += kern.y;
|
pen.y += kern.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(toUse!=nullptr){
|
||||||
FT_Set_Transform(toUse->fontFace, nullptr, &pen);
|
FT_Set_Transform(toUse->fontFace, nullptr, &pen);
|
||||||
FT_Error error = FT_Load_Char(toUse->fontFace, chr,
|
FT_Error error = FT_Load_Char(toUse->fontFace, chr,
|
||||||
FT_LOAD_RENDER | FT_LOAD_COLOR);
|
FT_LOAD_RENDER | FT_LOAD_COLOR);
|
||||||
@ -318,6 +319,7 @@ namespace olc {
|
|||||||
sprite);
|
sprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pge->SetPixelMode(prevMode);
|
pge->SetPixelMode(prevMode);
|
||||||
|
|
||||||
|
|||||||
@ -112,13 +112,13 @@ namespace olc::utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Retrieves the Real Value of a Property (for a given index) or 0.0
|
// 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());
|
return std::atof(GetString(nItem).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the Real Value of a Property (for a given index)
|
// 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);
|
SetString(std::to_string(d), nItem);
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user