|
|
|
@ -47,6 +47,7 @@ safemap<std::string,std::set<std::string>>ITEM_CATEGORIES; |
|
|
|
|
Item Item::BLANK; |
|
|
|
|
std::map<IT,Item>Inventory::_inventory; |
|
|
|
|
std::map<ITCategory,std::vector<Item>>Inventory::sortedInv; |
|
|
|
|
std::vector<ItemOverlay>ItemOverlay::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}); |
|
|
|
|
} |