Scrollbar click behavior changes for ScrollableWindowComponents. Items that are createable now display the proper contents in the Blacksmithing window.

pull/35/head
sigonasr2 10 months ago
parent b8dea862f6
commit d904ef7e91
  1. 2
      Adventures in Lestoria/BlacksmithCraftingWindow.cpp
  2. 4
      Adventures in Lestoria/Item.cpp
  3. 3
      Adventures in Lestoria/Menu.cpp
  4. 2
      Adventures in Lestoria/Menu.h
  5. 10
      Adventures in Lestoria/RequiredMaterialsList.h
  6. 6
      Adventures in Lestoria/RowItemDisplay.h
  7. 2
      Adventures in Lestoria/ScrollableWindowComponent.h
  8. 2
      Adventures in Lestoria/Version.h
  9. BIN
      x64/Release/Adventures in Lestoria.exe

@ -99,7 +99,7 @@ void Menu::InitializeBlacksmithCraftingWindow(){
std::string label=""; std::string label="";
if(Inventory::GetItemCount(item.lock()->ActualName())==0){ //If we don't own the item we have to create it first. if(Inventory::GetItemCount(item.lock()->ActualName())==0){ //If we don't own the item we have to create it first.
if(item.lock()->EnhancementIsPossible()&&item.lock()->GetEnhancementInfo().size()>item.lock()->EnhancementLevel()+1){ if(item.lock()->EnhancementIsPossible()&&item.lock()->GetEnhancementInfo().size()>item.lock()->EnhancementLevel()+1){
label=std::format("#00FF00Craft {}",item.lock()->DisplayName()); label="";
} }
Component<MenuLabel>(CRAFT_ITEM,"Enhancement Level Header")->SetLabel(label); Component<MenuLabel>(CRAFT_ITEM,"Enhancement Level Header")->SetLabel(label);
Component<MenuLabel>(CRAFT_ITEM,"Item Name Header")->SetLabel(std::format("Crafting {}",item.lock()->DisplayName())); Component<MenuLabel>(CRAFT_ITEM,"Item Name Header")->SetLabel(std::format("Crafting {}",item.lock()->DisplayName()));

@ -1068,7 +1068,9 @@ const bool Item::CanEnhanceItem(uint8_t qty)const{
if(ISBLANK(std::make_shared<Item>(*this)))return false; if(ISBLANK(std::make_shared<Item>(*this)))return false;
if(!GetEnhancementInfo().CanBeEnhanced())return false; if(!GetEnhancementInfo().CanBeEnhanced())return false;
if(GetEnhancementInfo().AvailableChapter()<game->GetCurrentChapter())return false; if(GetEnhancementInfo().AvailableChapter()<game->GetCurrentChapter())return false;
const EnhancementLevelInfo&enhanceInfo=GetEnhancementInfo()[EnhancementLevel()+1]; size_t enhanceIndex=EnhancementLevel()+1;
if(Inventory::GetItemCount(ActualName())==0)enhanceIndex=0;
const EnhancementLevelInfo&enhanceInfo=GetEnhancementInfo()[enhanceIndex];
if(GetEnhancementInfo().size()>2){ //If the item has exactly 2 enhancement levels, then it's an item that can only simply be crafted. Therefore, don't do the max enhancement level check. if(GetEnhancementInfo().size()>2){ //If the item has exactly 2 enhancement levels, then it's an item that can only simply be crafted. Therefore, don't do the max enhancement level check.
if(EnhancementLevel()>="Item.Item Max Enhancement Level"_I)return false; if(EnhancementLevel()>="Item.Item Max Enhancement Level"_I)return false;
} }

@ -62,6 +62,7 @@ const vf2d Menu::CENTERED = {-456,-456};
MenuType Menu::lastMenuTypeCreated; MenuType Menu::lastMenuTypeCreated;
std::string Menu::lastRegisteredComponent; std::string Menu::lastRegisteredComponent;
bool Menu::alreadyClicked=false; bool Menu::alreadyClicked=false;
bool Menu::scrolling=false;
INCLUDE_game INCLUDE_game
INCLUDE_GFX INCLUDE_GFX
@ -128,7 +129,7 @@ void Menu::CheckClickAndPerformMenuSelect(AiL*game){
} }
void Menu::HoverMenuSelect(AiL*game){ void Menu::HoverMenuSelect(AiL*game){
if(!game->IsFocused()||selection.expired()||selection.lock()->disabled||selection.lock()->grayedOut||Menu::alreadyClicked)return; if(!game->IsFocused()||selection.expired()||selection.lock()->disabled||selection.lock()->grayedOut||Menu::alreadyClicked||Menu::scrolling)return;
if(selection.lock()->draggable){ if(selection.lock()->draggable){
if(buttonHoldTime<"ThemeGlobal.MenuHoldTime"_F){ if(buttonHoldTime<"ThemeGlobal.MenuHoldTime"_F){

@ -89,6 +89,7 @@ struct Navigation{
}; };
class Menu:public IAttributable{ class Menu:public IAttributable{
friend class ScrollableWindowComponent;
static void InitializeConsumableInventoryWindow(); static void InitializeConsumableInventoryWindow();
static void InitializeClassInfoWindow(); static void InitializeClassInfoWindow();
static void InitializeClassSelectionWindow(); static void InitializeClassSelectionWindow();
@ -121,6 +122,7 @@ class Menu:public IAttributable{
int componentCount=0; int componentCount=0;
float componentSelectionIndex=0.f; float componentSelectionIndex=0.f;
static bool alreadyClicked; static bool alreadyClicked;
static bool scrolling;
std::unique_ptr<MenuComponent>draggingComponent; std::unique_ptr<MenuComponent>draggingComponent;
ViewPort window; ViewPort window;

@ -69,10 +69,14 @@ protected:
labelTextSize=vf2d(game->GetTextSizeProp(label)*adjustedScale); labelTextSize=vf2d(game->GetTextSizeProp(label)*adjustedScale);
} }
if(itemRef.lock()->EnhancementIsPossible()&&itemRef.lock()->GetEnhancementInfo().size()>itemRef.lock()->EnhancementLevel()+1){ if(itemRef.lock()->EnhancementIsPossible()){
size_t enhancementIndex=itemRef.lock()->EnhancementLevel()+1;
if(Inventory::GetItemCount(itemRef.lock()->ActualName())==0){ //If we don't have the item, use the initial crafting list instead.
enhancementIndex=0;
}
float drawWidth=rect.size.x/3; float drawWidth=rect.size.x/3;
int index=0; int index=0;
for(const auto&[name,amt]:itemRef.lock()->GetEnhancementInfo()[itemRef.lock()->EnhancementLevel()+1].craftingRequirement.GetItems()){ for(const auto&[name,amt]:itemRef.lock()->GetEnhancementInfo()[enhancementIndex].craftingRequirement.GetItems()){
Pixel textCol=WHITE; Pixel textCol=WHITE;
if(Inventory::GetItemCount(name)<amt*qty)textCol=RED; if(Inventory::GetItemCount(name)<amt*qty)textCol=RED;
vf2d drawPos=rect.pos+vf2d{drawWidth*(index%3),12.f*(index/3)}; vf2d drawPos=rect.pos+vf2d{drawWidth*(index%3),12.f*(index/3)};
@ -83,7 +87,7 @@ protected:
index++; index++;
} }
Pixel textCol=WHITE; Pixel textCol=WHITE;
uint32_t goldAmt=itemRef.lock()->GetEnhancementInfo()[itemRef.lock()->EnhancementLevel()+1].craftingRequirement.GetCost(); uint32_t goldAmt=itemRef.lock()->GetEnhancementInfo()[enhancementIndex].craftingRequirement.GetCost();
if(goldAmt>0){ if(goldAmt>0){
if(game->GetPlayer()->GetMoney()<goldAmt*qty)textCol=RED; if(game->GetPlayer()->GetMoney()<goldAmt*qty)textCol=RED;
vf2d drawPos=rect.pos+vf2d{drawWidth*(index%3),12.f*(index/3)}; vf2d drawPos=rect.pos+vf2d{drawWidth*(index%3),12.f*(index/3)};

@ -119,9 +119,15 @@ public:
borderCol=WHITE; borderCol=WHITE;
switch(priceLabel){ switch(priceLabel){
case PriceLabel::CRAFTABLE:{ case PriceLabel::CRAFTABLE:{
if(!canEnhance&&fadeOutIfMissingRequirements){
vf2d craftableTextSize=vf2d(game->GetTextSizeProp("Item.Missing Upgradeable Item Text"_S))*vf2d{1.f,0.85f};
window.DrawShadowStringPropDecal(rect.pos+vf2d{rect.size.x-craftableTextSize.x-1,3},"Item.Missing Upgradeable Item Text"_S,"Item.Missing Upgradeable Item Text Color"_Pixel,BLACK,{1.f,0.85f});
borderCol=GREEN;
}else{
vf2d craftableTextSize=vf2d(game->GetTextSizeProp("Item.Craftable Item Text"_S))*vf2d{1.f,0.85f}; vf2d craftableTextSize=vf2d(game->GetTextSizeProp("Item.Craftable Item Text"_S))*vf2d{1.f,0.85f};
window.DrawShadowStringPropDecal(rect.pos+vf2d{rect.size.x-craftableTextSize.x-1,3},"Item.Craftable Item Text"_S,"Item.Craftable Item Text Color"_Pixel,BLACK,{1.f,0.85f}); window.DrawShadowStringPropDecal(rect.pos+vf2d{rect.size.x-craftableTextSize.x-1,3},"Item.Craftable Item Text"_S,"Item.Craftable Item Text Color"_Pixel,BLACK,{1.f,0.85f});
borderCol=GREEN; borderCol=GREEN;
}
}break; }break;
case PriceLabel::UPGRADEABLE:{ case PriceLabel::UPGRADEABLE:{
if(!canEnhance&&fadeOutIfMissingRequirements){ if(!canEnhance&&fadeOutIfMissingRequirements){

@ -146,8 +146,10 @@ protected:
} }
if(game->GetMouse(0).bReleased){ if(game->GetMouse(0).bReleased){
scrollBarSelected=false; scrollBarSelected=false;
Menu::scrolling=false;
} }
if(scrollBarSelected){ if(scrollBarSelected){
Menu::scrolling=true;
float spaceBetweenTopAndBottomArrows=rect.size.y-24; float spaceBetweenTopAndBottomArrows=rect.size.y-24;
float viewHeight=rect.size.y; float viewHeight=rect.size.y;

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

Loading…
Cancel
Save