Fix shops not working with custom graphics

This commit is contained in:
2016-09-28 22:16:03 -04:00
parent b526b08b7e
commit 65aed58d33
2 changed files with 10 additions and 5 deletions

View File

@@ -307,8 +307,6 @@ void draw_items(location where){
to_rect = coord_to_rect(where_draw.x,where_draw.y);
if(univ.town.items[i].graphic_num >= 10000){
graf_pos_ref(src_gw, from_rect) = spec_scen_g.find_graphic(univ.town.items[i].graphic_num - 10000, true);
}else if(univ.town.items[i].graphic_num >= 1000){
graf_pos_ref(src_gw, from_rect) = spec_scen_g.find_graphic(univ.town.items[i].graphic_num - 1000);
}else{
graf_pos_ref(src_gw, from_rect) = calc_item_rect(univ.town.items[i].graphic_num, to_rect);
}

View File

@@ -622,6 +622,7 @@ void click_shop_rect(rectangle area_rect) {
}
graf_pos calc_item_rect(int num,rectangle& to_rect) {
if(num >= 1000) return spec_scen_g.find_graphic(num - 1000);
rectangle from_rect = {0,0,18,18};
sf::Texture *from_gw;
if(num < 55) {
@@ -682,10 +683,16 @@ void draw_shop_graphics(bool pressed,rectangle clip_area_rect) {
// Place store icon
if(!pressed) {
int i = active_shop.getFace();
rectangle from_rect = {0,0,32,32};
from_rect.offset(32 * (i % 10),32 * (i / 10));
rect_draw_some_item(*ResMgr::get<ImageRsrc>("talkportraits"), from_rect, talk_gworld, face_rect);
sf::Texture* from_gw;
int i = std::max<int>(0, active_shop.getFace());
if(i >= 1000) {
graf_pos_ref(from_gw, from_rect) = spec_scen_g.find_graphic(i - 1000);
} else {
from_rect.offset(32 * (i % 10),32 * (i / 10));
from_gw = ResMgr::get<ImageRsrc>("talkportraits").get();
}
rect_draw_some_item(*from_gw, from_rect, talk_gworld, face_rect);
}