Fix small item icons being shrunk even further in the inventory screen

This commit is contained in:
2020-01-26 16:07:12 -05:00
parent 1a05d9c53f
commit a2e73a0223
3 changed files with 18 additions and 17 deletions

View File

@@ -160,7 +160,11 @@ void init_screen_locs() {
startup_top.left = startup_base.left; startup_top.left = startup_base.left;
startup_top.right = startup_button[STARTBTN_JOIN].right; startup_top.right = startup_button[STARTBTN_JOIN].right;
// name, use, give, drip, info, sell/id each one 13 down // icon, name, use, give, drip, info, sell/id each one 13 down
item_buttons[0][ITEMBTN_ICON].top = 15;
item_buttons[0][ITEMBTN_ICON].bottom = item_buttons[0][ITEMBTN_ICON].top + 18;
item_buttons[0][ITEMBTN_ICON].left = 20;
item_buttons[0][ITEMBTN_ICON].right = item_buttons[0][ITEMBTN_ICON].left + 18;
item_buttons[0][ITEMBTN_NAME].top = 17; item_buttons[0][ITEMBTN_NAME].top = 17;
item_buttons[0][ITEMBTN_NAME].bottom = item_buttons[0][ITEMBTN_NAME].top + 12; item_buttons[0][ITEMBTN_NAME].bottom = item_buttons[0][ITEMBTN_NAME].top + 12;
item_buttons[0][ITEMBTN_NAME].left = 3; item_buttons[0][ITEMBTN_NAME].left = 3;

View File

@@ -102,12 +102,13 @@ enum eShopArea {
// Item buttons // Item buttons
enum eItemButton { enum eItemButton {
ITEMBTN_NAME = 0, ITEMBTN_ICON = 0,
ITEMBTN_USE = 1, ITEMBTN_NAME = 1,
ITEMBTN_GIVE = 2, ITEMBTN_USE = 2,
ITEMBTN_DROP = 3, ITEMBTN_GIVE = 3,
ITEMBTN_INFO = 4, ITEMBTN_DROP = 4,
ITEMBTN_SPEC = 5, // Sell, Identify, or Enchant ITEMBTN_INFO = 5,
ITEMBTN_SPEC = 6, // Sell, Identify, or Enchant
MAX_eItemButton // keep last MAX_eItemButton // keep last
}; };

View File

@@ -422,19 +422,12 @@ void place_buy_button(short position,short pc_num,short item_num) {
} }
} }
// name, use, give, drop, info, sell/id
// shortcuts - if which_button_to_put is 10, all 4 buttons now
// if which_button_to_put is 11, just right 2
void place_item_graphic(short which_slot,short graphic) { void place_item_graphic(short which_slot,short graphic) {
rectangle from_rect = {0,0,18,18},to_rect; rectangle from_rect = {0,0,18,18},to_rect;
item_area_button_active[which_slot][ITEMBTN_NAME] = true; item_area_button_active[which_slot][ITEMBTN_ICON] = true;
from_rect.offset((graphic % 10) * 18,(graphic / 10) * 18); from_rect.offset((graphic % 10) * 18,(graphic / 10) * 18);
to_rect = item_buttons[which_slot][ITEMBTN_NAME]; to_rect = item_buttons[which_slot][ITEMBTN_ICON];
to_rect.right = to_rect.left + (to_rect.bottom - to_rect.top);
to_rect.inset(-1,-1);
to_rect.offset(20,1);
from_rect.inset(2,2);
std::shared_ptr<const sf::Texture> src_gw; std::shared_ptr<const sf::Texture> src_gw;
if(graphic >= 10000) { if(graphic >= 10000) {
graf_pos_ref(src_gw, from_rect) = spec_scen_g.find_graphic(graphic - 10000, true); graf_pos_ref(src_gw, from_rect) = spec_scen_g.find_graphic(graphic - 10000, true);
@@ -446,6 +439,9 @@ void place_item_graphic(short which_slot,short graphic) {
else rect_draw_some_item(*ResMgr::graphics.get("tinyobj"), from_rect, item_stats_gworld, to_rect, sf::BlendAlpha); else rect_draw_some_item(*ResMgr::graphics.get("tinyobj"), from_rect, item_stats_gworld, to_rect, sf::BlendAlpha);
} }
// name, use, give, drop, info, sell/id
// shortcuts - if which_button_to_put is 10, all 4 buttons now
// if which_button_to_put is 11, just right 2
void place_item_button(short button_position,short which_slot,eItemButton button_type) { void place_item_button(short button_position,short which_slot,eItemButton button_type) {
rectangle from_rect = {0,0,18,18},to_rect; rectangle from_rect = {0,0,18,18},to_rect;
@@ -453,7 +449,7 @@ void place_item_button(short button_position,short which_slot,eItemButton button
switch(button_position) { switch(button_position) {
default: // this means put a regular item button default: // this means put a regular item button
item_area_button_active[which_slot][button_type] = true; item_area_button_active[which_slot][button_type] = true;
rect_draw_some_item(invenbtn_gworld, item_buttons_from[button_type - 1], item_stats_gworld, item_buttons[which_slot][button_type], sf::BlendAlpha); rect_draw_some_item(invenbtn_gworld, item_buttons_from[button_type - 2], item_stats_gworld, item_buttons[which_slot][button_type], sf::BlendAlpha);
break; break;
case ITEMBTN_ALL: // this means put all 4 case ITEMBTN_ALL: // this means put all 4
item_area_button_active[which_slot][ITEMBTN_USE] = true; item_area_button_active[which_slot][ITEMBTN_USE] = true;