Fixed clashing key names for text with the same information but differing widths. Corrected all GUI mispositioned text or incorrect wrapping on equip screens.

This commit is contained in:
2023-12-21 19:06:47 -06:00
parent c795e7f891
commit 4c290e81aa
10 changed files with 70 additions and 27 deletions
+45 -5
View File
@@ -1305,9 +1305,9 @@ void Crawler::RenderCooldowns(){
if(loadoutSlot!=-1){
uint32_t itemAmt=GetLoadoutItem(loadoutSlot).Amt();
if(itemAmt>0){
std::string amtString="x"+std::to_string(itemAmt);
vf2d qtySize=vf2d{GetTextSize(amtString)}*vf2d{0.5f,0.75f};
DrawShadowStringDecal(pos+vf2d{20,20}-qtySize/2,amtString,WHITE,BLACK,{0.5f,0.75f});
std::string amtString="x"+std::to_string(itemAmt);
vf2d qtySize=vf2d{GetTextSize(amtString)}*vf2d{0.5f,0.75f};
DrawShadowStringDecal(pos+vf2d{20,20}-qtySize/2,amtString,WHITE,BLACK,{0.5f,0.75f});
}else{
DrawDecal(pos,GFX["square_skill_overlay_icon_empty.png"].Decal(),{1,1},DARK_RED);
shortNameCol=RED;
@@ -1491,6 +1491,7 @@ void Crawler::InitializeLevel(std::string mapFile,MapName map){
void Crawler::LoadLevel(MapName map){
SPAWNER_LIST.clear();
foregroundTileGroups.clear();
MONSTER_LIST.clear();
currentLevel=map;
levelTime=0;
bossName="";
@@ -1500,6 +1501,8 @@ void Crawler::LoadLevel(MapName map){
totalBossEncounterMobs=0;
Inventory::Clear("Monster Loot");
Inventory::Clear("Stage Loot");
GetPlayer()->SetState(State::NORMAL);
GetPlayer()->GetCastInfo()={};
#pragma region Monster Spawn Data Setup
for(auto&[key,value]:MAP_DATA[map].SpawnerData){
@@ -2265,8 +2268,7 @@ void Crawler::SetLoadoutItem(int slot,std::string itemName){
bool Crawler::UseLoadoutItem(int slot){
if(slot<0||slot>loadout.size()-1)ERR("Invalid inventory slot "+std::to_string(slot)+", please choose a slot in range (0-"+std::to_string(loadout.size()-1)+").");
if(GetLoadoutItem(slot).Amt()>0){
Inventory::UseItem(loadout[slot].ActualName());
GetLoadoutItem(slot).OnUseAction();
Inventory::UseItem(GetLoadoutItem(slot).ActualName());
GetLoadoutItem(slot).amt--;
return true;
}
@@ -2276,6 +2278,44 @@ bool Crawler::UseLoadoutItem(int slot){
void Crawler::ClearLoadoutItem(int slot){
if(slot<0||slot>loadout.size()-1)ERR("Invalid inventory slot "+std::to_string(slot)+", please choose a slot in range (0-"+std::to_string(loadout.size()-1)+").");
loadout[slot].it=nullptr;
InputGroup*inputGroup=nullptr;
switch(slot){
case 0:{
inputGroup=&Player::KEY_ITEM1;
}break;
case 1:{
inputGroup=&Player::KEY_ITEM2;
}break;
case 2:{
inputGroup=&Player::KEY_ITEM3;
}break;
}
Ability itemAbility{"???","","",0,0,inputGroup,""};
switch(slot){
case 0:{
itemAbility.action=[&](Player*p,vf2d pos={}){
bool itemUsed=game->UseLoadoutItem(0);
return itemUsed;
};
game->GetPlayer()->SetItem1UseFunc(itemAbility);
Component<MenuItemItemButton>(MenuType::ITEM_LOADOUT,"Loadout Item 1")->UpdateIcon();
}break;
case 1:{
itemAbility.action=[&](Player*p,vf2d pos={}){
return game->UseLoadoutItem(1);
};
game->GetPlayer()->SetItem2UseFunc(itemAbility);
Component<MenuItemItemButton>(MenuType::ITEM_LOADOUT,"Loadout Item 2")->UpdateIcon();
}break;
case 2:{
itemAbility.action=[&](Player*p,vf2d pos={}){
return game->UseLoadoutItem(2);
};
game->GetPlayer()->SetItem3UseFunc(itemAbility);
Component<MenuItemItemButton>(MenuType::ITEM_LOADOUT,"Loadout Item 3")->UpdateIcon();
}break;
}
}
void Crawler::RenderFadeout(){