diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 634de3fa..9f358d21 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -1134,6 +1134,8 @@ Player*Crawler::GetPlayer(){ } void Crawler::RenderHud(){ + ItemOverlay::Draw(); + RenderCooldowns(); auto RenderCastbar=[&](const CastInfo&cast){ diff --git a/Crawler/Item.cpp b/Crawler/Item.cpp index 0e203029..f946fd78 100644 --- a/Crawler/Item.cpp +++ b/Crawler/Item.cpp @@ -47,6 +47,7 @@ safemap>ITEM_CATEGORIES; Item Item::BLANK; std::mapInventory::_inventory; std::map>Inventory::sortedInv; +std::vectorItemOverlay::items; ItemInfo::ItemInfo() :customProps({nullptr,nullptr}),img(nullptr){} @@ -327,4 +328,36 @@ void Inventory::Clear(ITCategory itemCategory){ bool Item::operator==(const Item&rhs)const{ return it==rhs.it; +} + +ItemOverlay::ItemOverlay(ItemInfo item) +:it(item),width("ItemDrop.Item Drop Scale"_F*24+4+game->GetTextSizeProp(item.Name()).x*0.5){ + xOffset=-width; +} + +void ItemOverlay::Update(){ + for(ItemOverlay&item:items){ + item.timer+=game->GetElapsedTime(); + item.xOffset=std::min(item.xOffset+game->GetElapsedTime()*"ItemOverlay.Item Overlay Speed"_F,0.f); + } + std::erase_if(items,[](ItemOverlay&item){return item.timer>"ItemOverlay.Item Overlay Time"_F;}); +} + +void ItemOverlay::Draw(){ + int counter=0; + float itemScale="ItemDrop.Item Drop Scale"_F; + for(ItemOverlay&item:items){ + vf2d pos={item.xOffset,96.f+counter*10}; + Pixel darkCol=Menu::GetCurrentTheme().GetButtonCol(); + Pixel lightCol=Menu::GetCurrentTheme().GetButtonCol()*1.2; + game->GradientFillRectDecal(pos,{item.width,8},darkCol,darkCol,darkCol,lightCol); + game->DrawRectDecal(pos,{item.width,8},Menu::GetCurrentTheme().GetHighlightCol()); + game->DrawDecal(pos,item.it.Decal(),{itemScale,itemScale}); + game->DrawShadowStringPropDecal(pos+vf2d{itemScale*24+2,2},item.it.Name(),WHITE,BLACK,{0.5,0.7}); + counter++; + } +} + +void ItemOverlay::AddToItemOverlay(const ItemInfo&it){ + items.push_back(ItemOverlay{it}); } \ No newline at end of file diff --git a/Crawler/Item.h b/Crawler/Item.h index 8ffb2e03..23dda441 100644 --- a/Crawler/Item.h +++ b/Crawler/Item.h @@ -130,4 +130,17 @@ public: /* For the useFunc, return true if the item can be used, false otherwise. */ +}; + +class ItemOverlay{ + ItemInfo it; + float timer=0; + float xOffset=0; + float width=0; //How wide the entire label is. + static std::vectoritems; + ItemOverlay(ItemInfo item); +public: + static void AddToItemOverlay(const ItemInfo&it); + static void Update(); + static void Draw(); }; \ No newline at end of file diff --git a/Crawler/ItemDrop.cpp b/Crawler/ItemDrop.cpp index 5e4bf27b..13ee4a39 100644 --- a/Crawler/ItemDrop.cpp +++ b/Crawler/ItemDrop.cpp @@ -130,10 +130,13 @@ void ItemDrop::UpdateDrops(float fElapsedTime){ std::erase_if(drops,[](ItemDrop&drop){ if(drop.collected){ Inventory::AddItem(drop.GetItem()->Name(),1,true); + ItemOverlay::AddToItemOverlay(*drop.GetItem()); return true; } return false; }); + + ItemOverlay::Update(); } float ItemDrop::GetZ(){ diff --git a/Crawler/Version.h b/Crawler/Version.h index df7ab210..b297cc8c 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -35,7 +35,7 @@ SUCH DAMAGE. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 3085 +#define VERSION_BUILD 3096 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/assets/config/gfx/gfx.txt b/Crawler/assets/config/gfx/gfx.txt index 706c56d3..df757f97 100644 --- a/Crawler/assets/config/gfx/gfx.txt +++ b/Crawler/assets/config/gfx/gfx.txt @@ -40,8 +40,8 @@ Images GFX_SkillOverlayIconOverlay = skill_overlay_icon_overlay.png GFX_FinishRing = finishring.png GFX_FinishRingGreen = finishring_green.png - GFX_SkillIcon = skill_overlay_icon.png - GFX_SkillIconEmpty = skill_overlay_icon_empty.png + GFX_SqareSkillIcon = square_skill_overlay_icon.png + GFX_SqareSkillIconEmpty = square_skill_overlay_icon_empty.png # Ability Icons GFX_Warrior_BattleCry_Icon = Ability Icons/battlecry.png diff --git a/Crawler/assets/config/items/items.txt b/Crawler/assets/config/items/items.txt index cf17d8f5..da26973a 100644 --- a/Crawler/assets/config/items/items.txt +++ b/Crawler/assets/config/items/items.txt @@ -26,4 +26,11 @@ ItemDrop # Item drop scale Item Drop Scale = 0.4 +} +ItemOverlay +{ + # Amount of time the item overlay display remains on-screen. + Item Overlay Time = 5.0 + # How fast the item overlay display moves into the screen (from the left edge). + Item Overlay Speed = 200 } \ No newline at end of file diff --git a/x64/Release/Crawler.exe b/x64/Release/Crawler.exe index ff8afc5b..aeb32184 100644 Binary files a/x64/Release/Crawler.exe and b/x64/Release/Crawler.exe differ