]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add update_mousepos()
authorterencehill <piuntn@gmail.com>
Sun, 28 Aug 2016 22:29:56 +0000 (00:29 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 28 Aug 2016 22:29:56 +0000 (00:29 +0200)
qcsrc/client/hud/hud_config.qc
qcsrc/client/hud/panel/quickmenu.qc
qcsrc/client/hud/panel/radar.qc
qcsrc/client/miscfunctions.qc
qcsrc/client/miscfunctions.qh
qcsrc/common/minigames/cl_minigames_hud.qc

index 4f116d724fb35a8203132f7ff43cec23504ab142..f2b23e39256217b9f33019b51c2e94bdd1e8b59a 100644 (file)
@@ -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)
        {
index 8616492d20eb6676a82c599dba5f55427107a4bd..e242ae895881a89d05baf81eb6da4c3197fdf4e7 100644 (file)
@@ -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();
index 2c71c8e63dc7ab6d37085a4d055fad51722ed390..269d870718e42663a431a3445c984876ff74b4c5 100644 (file)
@@ -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();
index 33fd015cce8f8724a5403d6024b3ea7f79a1f379..0e88cd5a51043107b2d2246e79351151dccc538e 100644 (file)
@@ -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)
 {
index 1f8790481f1a8d88a0193d9971d8b65b2dcbad4b..9d792f60cd62ad3335e5531e8c48c483a16dc199 100644 (file)
@@ -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);
index 12d2f06d18caecf4bbf6f07d8f803e5ef5073544..a359831dfdd3cb74535c790c34f71b5ba9723721 100644 (file)
@@ -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();