separate args to highlight text and item help button

This commit is contained in:
2025-02-04 12:29:52 -06:00
parent ddad32458e
commit 673de75c73
5 changed files with 21 additions and 19 deletions

View File

@@ -599,15 +599,15 @@ void do_explosion_anim(short /*sound_num*/,short special_draw, short snd) {
store_booms[i].boom_type = -1;
}
void click_shop_rect(rectangle area_rect) {
void click_shop_rect(rectangle area_rect, bool item_help) {
if(recording){
record_action("click_shop_rect", boost::lexical_cast<std::string>(area_rect));
}
draw_shop_graphics(1,area_rect);
draw_shop_graphics(!item_help,item_help,area_rect);
mainPtr.display();
play_sound(37, time_in_ticks(5));
draw_shop_graphics(0,area_rect);
draw_shop_graphics(false,false,area_rect);
}
@@ -627,7 +627,7 @@ graf_pos calc_item_rect(int num,rectangle& to_rect) {
}
// mode 1 - drawing dark for button press
void draw_shop_graphics(bool pressed,rectangle clip_area_rect) {
void draw_shop_graphics(bool item_pressed, bool item_help_pressed, rectangle clip_area_rect) {
rectangle area_rect,item_info_from = {11,42,24,56};
rectangle face_rect = {6,6,38,38};
@@ -653,7 +653,7 @@ void draw_shop_graphics(bool pressed,rectangle clip_area_rect) {
area_rect = rectangle(talk_gworld);
talk_gworld.setActive(false);
// Only re-render on top of the item that is clicked:
if(pressed) {
if(item_pressed || item_help_pressed) {
clip_area_rect.offset(-area_rect.left, -area_rect.top);
clip_rect(talk_gworld, clip_area_rect);
} else {
@@ -664,8 +664,10 @@ void draw_shop_graphics(bool pressed,rectangle clip_area_rect) {
frame_rect(talk_gworld, shop_frame, Colours::BLACK);
}
// Place store icon
if(!pressed) {
// Place store icon:
// We can skip this when rendering for a button press, but it won't matter anyway
// because button press rendering is clipped anyway.
if(!item_pressed || item_help_pressed) {
rectangle from_rect = {0,0,32,32};
std::shared_ptr<const sf::Texture> from_gw;
int i = std::max<int>(0, active_shop.getFace());
@@ -719,7 +721,7 @@ void draw_shop_graphics(bool pressed,rectangle clip_area_rect) {
}
win_draw_string(talk_gworld,shopper_name,title.str(),eTextMode::LEFT_TOP,style);
if(pressed)
if(item_pressed)
style.colour = Colours::TITLE_BLUE;
else
style.colour = Colours::BLACK;
@@ -781,7 +783,7 @@ void draw_shop_graphics(bool pressed,rectangle clip_area_rect) {
rect_draw_some_item(invenbtn_gworld, {0, 29, 7, 36}, talk_gworld, cost_rect, sf::BlendAlpha);
style.pointSize = 10;
win_draw_string(talk_gworld,shopping_rects[i][SHOPRECT_ITEM_EXTRA],cur_info_str,eTextMode::WRAP,style);
rect_draw_some_item(invenbtn_gworld,item_info_from,talk_gworld,shopping_rects[i][SHOPRECT_ITEM_HELP],pressed ? sf::BlendNone : sf::BlendAlpha);
rect_draw_some_item(invenbtn_gworld,item_info_from,talk_gworld,shopping_rects[i][SHOPRECT_ITEM_HELP],item_help_pressed ? sf::BlendNone : sf::BlendAlpha);
}
// Finally, cost info and help strs