fix shop and talk clicks falling through. Fix #544
This commit is contained in:
@@ -1386,14 +1386,18 @@ bool handle_action(const sf::Event& event, cFramerateLimiter& fps_limiter) {
|
|||||||
|
|
||||||
// Now split off the extra stuff, like talking and shopping.
|
// Now split off the extra stuff, like talking and shopping.
|
||||||
if(overall_mode == MODE_TALKING) {
|
if(overall_mode == MODE_TALKING) {
|
||||||
handle_talk_event(the_point, fps_limiter);
|
if(handle_talk_event(the_point, fps_limiter)){
|
||||||
if(overall_mode != MODE_TALKING)
|
advance_time(did_something, need_redraw, need_reprint);
|
||||||
return false;
|
are_done = All_Done;
|
||||||
|
return are_done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(overall_mode == MODE_SHOPPING) {
|
if(overall_mode == MODE_SHOPPING) {
|
||||||
handle_shop_event(the_point, fps_limiter);
|
if(handle_shop_event(the_point, fps_limiter)){
|
||||||
if(overall_mode != MODE_SHOPPING)
|
advance_time(did_something, need_redraw, need_reprint);
|
||||||
return false;
|
are_done = All_Done;
|
||||||
|
return are_done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise they're in a terrain view mode
|
// Otherwise they're in a terrain view mode
|
||||||
|
@@ -219,18 +219,17 @@ void end_shop_mode() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_shop_event(location p, cFramerateLimiter& fps_limiter) {
|
bool handle_shop_event(location p, cFramerateLimiter& fps_limiter) {
|
||||||
if(p.in(talk_help_rect)) {
|
if(p.in(talk_help_rect)) {
|
||||||
if(!help_btn->handleClick(p, fps_limiter))
|
if(help_btn->handleClick(p, fps_limiter))
|
||||||
return;
|
|
||||||
give_help_and_record(226,27);
|
give_help_and_record(226,27);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(p.in(shop_done_rect)) {
|
if(p.in(shop_done_rect)) {
|
||||||
if(done_btn->handleClick(p, fps_limiter))
|
if(done_btn->handleClick(p, fps_limiter))
|
||||||
end_shop_mode();
|
end_shop_mode();
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(short i = 0; i < 8; i++) {
|
for(short i = 0; i < 8; i++) {
|
||||||
@@ -252,11 +251,14 @@ void handle_shop_event(location p, cFramerateLimiter& fps_limiter) {
|
|||||||
if(p.in(active_rect)) {
|
if(p.in(active_rect)) {
|
||||||
click_shop_rect(active_rect);
|
click_shop_rect(active_rect);
|
||||||
handle_sale(what_picked);
|
handle_sale(what_picked);
|
||||||
|
return true;
|
||||||
} else if(p.in(item_help_rect)){
|
} else if(p.in(item_help_rect)){
|
||||||
click_shop_rect(item_help_rect);
|
click_shop_rect(item_help_rect);
|
||||||
handle_info_request(what_picked);
|
handle_info_request(what_picked);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_sale(int i) {
|
void handle_sale(int i) {
|
||||||
@@ -1110,18 +1112,18 @@ void handle_talk_node(int which_talk_entry) {
|
|||||||
place_talk_str(save_talk_str1,save_talk_str2,0,dummy_rect);
|
place_talk_str(save_talk_str1,save_talk_str2,0,dummy_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_talk_event(location p, cFramerateLimiter& fps_limiter) {
|
bool handle_talk_event(location p, cFramerateLimiter& fps_limiter) {
|
||||||
if(p.in(talk_help_rect)) {
|
if(p.in(talk_help_rect)) {
|
||||||
if(!help_btn->handleClick(p, fps_limiter))
|
if(help_btn->handleClick(p, fps_limiter))
|
||||||
return;
|
|
||||||
give_help_and_record(205,6);
|
give_help_and_record(205,6);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.x -= 5;
|
p.x -= 5;
|
||||||
p.y -= 5;
|
p.y -= 5;
|
||||||
|
|
||||||
int which_talk_entry = TALK_DUNNO;
|
int which_talk_entry = TALK_DUNNO;
|
||||||
|
bool clicked_word = false;
|
||||||
for(word_rect_t& word : talk_words) {
|
for(word_rect_t& word : talk_words) {
|
||||||
if(word.node == -1) continue;
|
if(word.node == -1) continue;
|
||||||
rectangle wordRect(word.rect);
|
rectangle wordRect(word.rect);
|
||||||
@@ -1130,9 +1132,11 @@ void handle_talk_event(location p, cFramerateLimiter& fps_limiter) {
|
|||||||
if(!p.in(wordRect)) continue;
|
if(!p.in(wordRect)) continue;
|
||||||
click_talk_rect(word);
|
click_talk_rect(word);
|
||||||
which_talk_entry = word.node;
|
which_talk_entry = word.node;
|
||||||
|
clicked_word = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
handle_talk_node(which_talk_entry);
|
handle_talk_node(which_talk_entry);
|
||||||
|
return clicked_word;
|
||||||
}
|
}
|
||||||
|
|
||||||
//town_num; // Will be 0 - 200 for town, 200 - 290 for outdoors
|
//town_num; // Will be 0 - 200 for town, 200 - 290 for outdoors
|
||||||
|
@@ -7,14 +7,14 @@
|
|||||||
|
|
||||||
bool start_shop_mode(short which,short cost_adj,std::string store_name, bool cancel_when_empty = false);
|
bool start_shop_mode(short which,short cost_adj,std::string store_name, bool cancel_when_empty = false);
|
||||||
void end_shop_mode();
|
void end_shop_mode();
|
||||||
void handle_shop_event(location p, cFramerateLimiter& fps_limiter);
|
bool handle_shop_event(location p, cFramerateLimiter& fps_limiter);
|
||||||
void handle_sale(int i);
|
void handle_sale(int i);
|
||||||
void handle_info_request(int what_picked);
|
void handle_info_request(int what_picked);
|
||||||
void set_up_shop_array();
|
void set_up_shop_array();
|
||||||
void start_talk_mode(short m_num,short personality,mon_num_t monst_type,short store_face_pic);
|
void start_talk_mode(short m_num,short personality,mon_num_t monst_type,short store_face_pic);
|
||||||
void end_talk_mode();
|
void end_talk_mode();
|
||||||
void handle_talk_node(int which_talk_entry);
|
void handle_talk_node(int which_talk_entry);
|
||||||
void handle_talk_event(location p, cFramerateLimiter& fps_limiter);
|
bool handle_talk_event(location p, cFramerateLimiter& fps_limiter);
|
||||||
void handle_talk_spec(short ttype,char* place_string1,char* place_string2);
|
void handle_talk_spec(short ttype,char* place_string1,char* place_string2);
|
||||||
void store_responses();
|
void store_responses();
|
||||||
void do_sign(short town_num, short which_sign, short sign_type);
|
void do_sign(short town_num, short which_sign, short sign_type);
|
||||||
|
Reference in New Issue
Block a user