Fix item name rect stealing clicks from ID button
This commit is contained in:
@@ -163,21 +163,8 @@ static void init_shopping_rects() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_screen_locs() {
|
void init_inven_rects() {
|
||||||
init_shopping_rects();
|
// icon, name, use, give, drop, info, sell/id each one 13 down
|
||||||
|
|
||||||
rectangle startup_base = {281,1,329,302};
|
|
||||||
|
|
||||||
for(auto btn : startup_button.keys()) {
|
|
||||||
startup_button[btn] = startup_base;
|
|
||||||
startup_button[btn].offset(301 * (btn / 3), 48 * (btn % 3));
|
|
||||||
}
|
|
||||||
startup_top.top = 7;
|
|
||||||
startup_top.bottom = startup_button[STARTBTN_TUTORIAL].top;
|
|
||||||
startup_top.left = startup_base.left;
|
|
||||||
startup_top.right = startup_button[STARTBTN_NEW].right;
|
|
||||||
|
|
||||||
// icon, name, use, give, drip, info, sell/id each one 13 down
|
|
||||||
item_buttons[0][ITEMBTN_ICON].top = 15;
|
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].bottom = item_buttons[0][ITEMBTN_ICON].top + 18;
|
||||||
item_buttons[0][ITEMBTN_ICON].left = 20;
|
item_buttons[0][ITEMBTN_ICON].left = 20;
|
||||||
@@ -205,25 +192,34 @@ void init_screen_locs() {
|
|||||||
item_buttons[0][ITEMBTN_SPEC] = item_buttons[0][ITEMBTN_NAME];
|
item_buttons[0][ITEMBTN_SPEC] = item_buttons[0][ITEMBTN_NAME];
|
||||||
item_buttons[0][ITEMBTN_SPEC].left = 173;
|
item_buttons[0][ITEMBTN_SPEC].left = 173;
|
||||||
item_buttons[0][ITEMBTN_SPEC].right = 232;
|
item_buttons[0][ITEMBTN_SPEC].right = 232;
|
||||||
|
// If extra buttons are visible on the item window, truncate the hitbox of the name, or else it will steal button clicks
|
||||||
|
if(stat_screen_mode >= MODE_IDENTIFY){
|
||||||
|
item_buttons[0][ITEMBTN_NAME].right = item_buttons[0][ITEMBTN_SPEC].left;
|
||||||
|
}
|
||||||
|
|
||||||
item_buttons[0][ITEMBTN_NAME].top += 3;
|
item_buttons[0][ITEMBTN_NAME].top += 3;
|
||||||
for(short i = 1; i < 8; i++)
|
for(short i = 1; i < 8; i++)
|
||||||
for(auto j : item_buttons[i].keys()) {
|
for(auto j : item_buttons[i].keys()) {
|
||||||
item_buttons[i][j] = item_buttons[0][j];
|
item_buttons[i][j] = item_buttons[0][j];
|
||||||
item_buttons[i][j].offset(0,13 * i);
|
item_buttons[i][j].offset(0,13 * i);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* for(short i = 0; i < 8; i++) {
|
|
||||||
item_screen_button_rects[i] = bottom_base;
|
void init_screen_locs() {
|
||||||
OffsetRect(&item_screen_button_rects[i],10 + i * 29,126);
|
init_shopping_rects(true);
|
||||||
|
|
||||||
|
rectangle startup_base = {281,1,329,302};
|
||||||
|
|
||||||
|
for(auto btn : startup_button.keys()) {
|
||||||
|
startup_button[btn] = startup_base;
|
||||||
|
startup_button[btn].offset(301 * (btn / 3), 48 * (btn % 3));
|
||||||
}
|
}
|
||||||
item_screen_button_rects[6].left = 176;
|
startup_top.top = 7;
|
||||||
item_screen_button_rects[6].right = 211;
|
startup_top.bottom = startup_button[STARTBTN_TUTORIAL].top;
|
||||||
item_screen_button_rects[7].left = 213;
|
startup_top.left = startup_base.left;
|
||||||
item_screen_button_rects[7].right = 248;
|
startup_top.right = startup_button[STARTBTN_NEW].right;
|
||||||
item_screen_button_rects[8].top = 127;
|
|
||||||
item_screen_button_rects[8].bottom = 140;
|
init_inven_rects();
|
||||||
item_screen_button_rects[8].left = 251;
|
|
||||||
item_screen_button_rects[8].right = 267; */
|
|
||||||
|
|
||||||
// name, hp, sp, info, trade
|
// name, hp, sp, info, trade
|
||||||
pc_buttons[0][PCBTN_NAME].top = 18;
|
pc_buttons[0][PCBTN_NAME].top = 18;
|
||||||
|
@@ -14,6 +14,7 @@ struct key_action_t {
|
|||||||
void (*action)();
|
void (*action)();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void init_inven_rects();
|
||||||
void init_screen_locs();
|
void init_screen_locs();
|
||||||
location mouse_window_coords();
|
location mouse_window_coords();
|
||||||
// If the mouse is in the terrain window, set the given location to the hovered tile.
|
// If the mouse is in the terrain window, set the given location to the hovered tile.
|
||||||
|
@@ -105,6 +105,8 @@ cShop active_shop;
|
|||||||
short active_shop_num;
|
short active_shop_num;
|
||||||
short store_cur_pc = -1;
|
short store_cur_pc = -1;
|
||||||
|
|
||||||
|
extern void init_inven_rects();
|
||||||
|
|
||||||
// For healing shops, other PCs might be able to buy something if
|
// For healing shops, other PCs might be able to buy something if
|
||||||
// the active PC can't
|
// the active PC can't
|
||||||
static bool start_shop_mode_other_pc(bool allow_empty = false, bool already_started = false) {
|
static bool start_shop_mode_other_pc(bool allow_empty = false, bool already_started = false) {
|
||||||
@@ -256,6 +258,7 @@ void end_shop_mode() {
|
|||||||
univ.party.store_limited_stock[active_shop_num][i] = left;
|
univ.party.store_limited_stock[active_shop_num][i] = left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
init_inven_rects();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool handle_shop_event(location p, cFramerateLimiter& fps_limiter) {
|
bool handle_shop_event(location p, cFramerateLimiter& fps_limiter) {
|
||||||
@@ -731,6 +734,7 @@ void end_talk_mode() {
|
|||||||
put_pc_screen();
|
put_pc_screen();
|
||||||
// TODO: I suspect REFRESH_NONE will suffice here
|
// TODO: I suspect REFRESH_NONE will suffice here
|
||||||
redraw_screen(REFRESH_TERRAIN | REFRESH_BAR);
|
redraw_screen(REFRESH_TERRAIN | REFRESH_BAR);
|
||||||
|
init_inven_rects();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fill_job_bank(cDialog& me, job_bank_t& bank, std::string) {
|
static void fill_job_bank(cDialog& me, job_bank_t& bank, std::string) {
|
||||||
@@ -1214,6 +1218,8 @@ bool handle_talk_event(location p, cFramerateLimiter& fps_limiter) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
handle_talk_node(which_talk_entry);
|
handle_talk_node(which_talk_entry);
|
||||||
|
// Update hitboxes of the inventory in case sell/identify/recharge mode started
|
||||||
|
init_inven_rects();
|
||||||
return clicked_word || p.in(rectangle(talk_gworld()));
|
return clicked_word || p.in(rectangle(talk_gworld()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user