From: terencehill Date: Sun, 28 Aug 2016 22:29:56 +0000 (+0200) Subject: Add update_mousepos() X-Git-Tag: xonotic-v0.8.2~647 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=692fbab7868855c0a3bed273854bc719f5851029;p=xonotic%2Fxonotic-data.pk3dir.git Add update_mousepos() --- diff --git a/qcsrc/client/hud/hud_config.qc b/qcsrc/client/hud/hud_config.qc index 4f116d724..f2b23e392 100644 --- a/qcsrc/client/hud/hud_config.qc +++ b/qcsrc/client/hud/hud_config.qc @@ -1111,12 +1111,7 @@ void HUD_Panel_Mouse() return; if (!autocvar_hud_cursormode) - { - mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed; - - mousepos.x = bound(0, mousepos.x, vid_conwidth); - mousepos.y = bound(0, mousepos.y, vid_conheight); - } + update_mousepos(); if(mouseClicked) { diff --git a/qcsrc/client/hud/panel/quickmenu.qc b/qcsrc/client/hud/panel/quickmenu.qc index 8616492d2..e242ae895 100644 --- a/qcsrc/client/hud/panel/quickmenu.qc +++ b/qcsrc/client/hud/panel/quickmenu.qc @@ -496,13 +496,8 @@ void QuickMenu_Mouse() return; } - if(!autocvar_hud_cursormode) - { - mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed; - - mousepos.x = bound(0, mousepos.x, vid_conwidth); - mousepos.y = bound(0, mousepos.y, vid_conheight); - } + if (!autocvar_hud_cursormode) + update_mousepos(); panel = HUD_PANEL(QUICKMENU); HUD_Panel_LoadCvars(); diff --git a/qcsrc/client/hud/panel/radar.qc b/qcsrc/client/hud/panel/radar.qc index 2c71c8e63..269d87071 100644 --- a/qcsrc/client/hud/panel/radar.qc +++ b/qcsrc/client/hud/panel/radar.qc @@ -137,13 +137,8 @@ void HUD_Radar_Mouse() return; } - if(!autocvar_hud_cursormode) - { - mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed; - - mousepos_x = bound(0, mousepos_x, vid_conwidth); - mousepos_y = bound(0, mousepos_y, vid_conheight); - } + if (!autocvar_hud_cursormode) + update_mousepos(); panel = HUD_PANEL(RADAR); HUD_Panel_LoadCvars(); diff --git a/qcsrc/client/miscfunctions.qc b/qcsrc/client/miscfunctions.qc index 33fd015cc..0e88cd5a5 100644 --- a/qcsrc/client/miscfunctions.qc +++ b/qcsrc/client/miscfunctions.qc @@ -350,6 +350,13 @@ void drawcolorcodedstring_aspect_expanding(vector pos, string text, vector sz, f drawcolorcodedstring_expanding(pos, text, '1 1 0' * sz.y, theAlpha, drawflag, fadelerp); } +void update_mousepos() +{ + mousepos += getmousepos() * autocvar_menu_mouse_speed; + mousepos.x = bound(0, mousepos.x, vid_conwidth); + mousepos.y = bound(0, mousepos.y, vid_conheight); +} + // this draws the triangles of a model DIRECTLY. Don't expect high performance, really... float PolyDrawModelSurface(entity e, float i_s) { diff --git a/qcsrc/client/miscfunctions.qh b/qcsrc/client/miscfunctions.qh index 1f8790481..9d792f60c 100644 --- a/qcsrc/client/miscfunctions.qh +++ b/qcsrc/client/miscfunctions.qh @@ -187,6 +187,8 @@ void drawcolorcodedstring_expanding(vector position, string text, vector theScal void drawcolorcodedstring_aspect_expanding(vector pos, string text, vector sz, float theAlpha, float drawflag, float fadelerp); +void update_mousepos(); + // this draws the triangles of a model DIRECTLY. Don't expect high performance, really... float PolyDrawModelSurface(entity e, float i_s); void PolyDrawModel(entity e); diff --git a/qcsrc/common/minigames/cl_minigames_hud.qc b/qcsrc/common/minigames/cl_minigames_hud.qc index 12d2f06d1..a359831df 100644 --- a/qcsrc/common/minigames/cl_minigames_hud.qc +++ b/qcsrc/common/minigames/cl_minigames_hud.qc @@ -682,13 +682,8 @@ void HUD_Minigame_Mouse() if( !HUD_MinigameMenu_IsOpened() || autocvar__hud_configure || mv_active ) return; - if(!autocvar_hud_cursormode) - { - mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed; - - mousepos_x = bound(0, mousepos_x, vid_conwidth); - mousepos_y = bound(0, mousepos_y, vid_conheight); - } + if (!autocvar_hud_cursormode) + update_mousepos(); if ( HUD_MinigameMenu_IsOpened() && HUD_mouse_over(HUD_PANEL(MINIGAME_MENU)) ) HUD_MinigameMenu_MouseInput();