From 48c41753d0cd7fb59afab655cb31fa7ccb104b74 Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Fri, 12 Aug 2005 08:58:41 +0000 Subject: [PATCH] fix the strange mouse click issues on briefing, ship select and weapon select screens --- src/missionui/missionbrief.cpp | 21 ++++++++++--- src/missionui/missionscreencommon.cpp | 45 ++++++++++++++++----------- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/src/missionui/missionbrief.cpp b/src/missionui/missionbrief.cpp index 170ffe1..a64722e 100644 --- a/src/missionui/missionbrief.cpp +++ b/src/missionui/missionbrief.cpp @@ -15,6 +15,9 @@ * C module that contains code to display the mission briefing to the player * * $Log$ + * Revision 1.11 2005/08/12 08:58:41 taylor + * fix the strange mouse click issues on briefing, ship select and weapon select screens + * * Revision 1.10 2005/03/29 02:18:47 taylor * Various 64-bit platform fixes * Fix compiler errors with MAKE_FS1 and fix gr_set_bitmap() too @@ -1747,7 +1750,7 @@ void brief_update_closeup_icon(int mode) // void brief_check_for_anim() { - int mx, my, i, iw, ih; + int mx, my, i, iw, ih, x, y; brief_stage *bs; brief_icon *bi = NULL; @@ -1756,9 +1759,19 @@ void brief_check_for_anim() // if mouse click is over the VCR controls, don't launch an icon // FIXME - should prolly push these into defines instead of hardcoding this - if ( mx >= 0 && mx <= 115 && my >= 136 && my <= 148 ) { - return; - } +// if ( mx >= 0 && mx <= 115 && my >= 136 && my <= 148 ) { +// return; +// } + + // same as above but without the hardcoded values, which were wrong anyway. don't know + // how this will work longterm but will hopefully keep things working well - taylor + for (i = 0; i <= BRIEF_BUTTON_FIRST_STAGE; i++) { + Brief_buttons[gr_screen.res][i].button.get_dimensions(&x, &y, &iw, &ih); + + if (mx >= x && mx <= (x+iw) && my >= y && my <= (y+ih)) { + return; + } + } // if mouse coords are outside the briefing screen, then go away my -= bscreen.map_y1; diff --git a/src/missionui/missionscreencommon.cpp b/src/missionui/missionscreencommon.cpp index 6233c46..39cffa4 100644 --- a/src/missionui/missionscreencommon.cpp +++ b/src/missionui/missionscreencommon.cpp @@ -13,6 +13,9 @@ * $Author$ * * $Log$ + * Revision 1.10 2005/08/12 08:58:41 taylor + * fix the strange mouse click issues on briefing, ship select and weapon select screens + * * Revision 1.9 2004/09/20 01:31:44 theoddone33 * GCC 3.4 fixes. * @@ -811,24 +814,6 @@ int common_select_do(float frametime) { int k, new_k; - // If the mouse went up, set flags. We can't use mouse_up_count() more than once a frame, - // since the count gets zeroed after the call. - // - Drop_icon_mflag = 0; - Drop_on_wing_mflag = 0; - Brief_mouse_up_flag = 0; - - if ( mouse_up_count(MOUSE_LEFT_BUTTON) ) { - Drop_icon_mflag = 1; - Drop_on_wing_mflag = 1; - Brief_mouse_up_flag = 1; - } - - Mouse_down_last_frame = 0; - if ( mouse_down_count(MOUSE_LEFT_BUTTON) ) { - Mouse_down_last_frame = 1; - } - if ( help_overlay_active(BR_OVERLAY) || help_overlay_active(SS_OVERLAY) || help_overlay_active(WL_OVERLAY) ) { Common_buttons[0][gr_screen.res][COMMON_HELP_BUTTON].button.reset_status(); Common_buttons[1][gr_screen.res][COMMON_HELP_BUTTON].button.reset_status(); @@ -856,6 +841,30 @@ int common_select_do(float frametime) } } + // test for mouse buttons, must be done after Active_ui_window->process() + // has been called to work properly + // + Drop_icon_mflag = 0; + Drop_on_wing_mflag = 0; + Brief_mouse_up_flag = 0; + Mouse_down_last_frame = 0; + + // if the left mouse button was released... + if ( B1_RELEASED ) { + Drop_icon_mflag = 1; + Drop_on_wing_mflag = 1; + } + + // if the left mouse button was pressed... + if ( B1_PRESSED ) { + Mouse_down_last_frame = 1; + } + + // basically a "click", only check for the click here to avoid action-on-over on briefing map + if ( B1_JUST_PRESSED ) { + Brief_mouse_up_flag = 1; + } + // reset timers for flashing buttons if key pressed if ( (k>0) || (new_k>0) ) { common_flash_button_init(); -- 2.39.2