]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Thanks to the use of the built in function setcursormode we can fix 2 bugs in hud...
authorterencehill <piuntn@gmail.com>
Wed, 9 Nov 2011 21:52:38 +0000 (22:52 +0100)
committerterencehill <piuntn@gmail.com>
Wed, 9 Nov 2011 21:52:38 +0000 (22:52 +0100)
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/client/csqc_builtins.qc
qcsrc/client/hud.qc
qcsrc/client/hud_config.qc

index 627ee9f2f80d727d08b0dc8ceba068a0bdafeafb..3de6fdd4f9fe3e111568ba3988d4f8b8ab01c444 100644 (file)
@@ -636,9 +636,10 @@ void GameCommand(string msg)
 // CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.
 // Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.
 // All keys are in ascii.
-// bInputType = 0 is key pressed, 1 is key released, 2 is mouse input.
+// bInputType = 0 is key pressed, 1 is key released, 2 and 3 are mouse input.
 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
+// In the case of mouse input after a setcursormode(1) call, nPrimary is xpos, nSecondary is ypos.
 float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
 {
        float bSkipKey;
index ac976db67bdd76f3c12c2fc75bdd00b4a00cf0d8..e0180a70670180a3439179a7516fbbcb5733b721 100644 (file)
@@ -468,7 +468,7 @@ void CSQC_UpdateView(float w, float h)
        }
        
        // do lockview after event chase camera so that it still applies whenever necessary.
-       if(autocvar_cl_lockview || (autocvar__hud_configure && spectatee_status <= 0) || intermission > 1)
+       if(autocvar_cl_lockview || intermission > 1)
        {
                R_SetView(VF_ORIGIN, freeze_org);
                R_SetView(VF_ANGLES, freeze_ang);
index 6ef34f35eab5fa8109e2eda628b889ace10a431d..dd7b18da39321fa124d60816499ee949ff652a4c 100644 (file)
@@ -125,6 +125,7 @@ void ()                                                                     DefaultPlayerPhysics = #347;
 
 string (float playernum, string key)                                   getplayerkey = #348;
 void (string cmdname)                                                  registercmd = #352;
+void(float usecursor)                                                  setcursormode = #343;
 vector ()                                                              getmousepos = #344;
 
 string (string s)                                                      uncolorstring = #170;
index 7acfacb8c428b99d8246db0b10b8f9a3c2db8335..f8e68fc2badf49f49d24d94ad51603510f556f13 100644 (file)
@@ -4989,7 +4989,12 @@ void HUD_Main (void)
                        HUD_Panel_UpdatePosSizeForId(highlightedPanel);
                        HUD_Panel_HlBorder(panel_bg_border + 1.5 * hlBorderSize, '0 0.5 1', 0.25 * (1 - autocvar__menu_alpha));
                }
+
+               if (!hud_configure_prev)
+                       setcursormode(1);
        }
+       else if (hud_configure_prev)
+               setcursormode(0);
 
        hud_configure_prev = autocvar__hud_configure;
 
index 18ff119a79ef636abbf231f6a7cb92ae0ea5e49b..0c47ffa2d73e9f56b0ef1aa3b042b9a9eb47c797 100644 (file)
@@ -621,13 +621,19 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
 {
        string s;
 
-       // we only care for keyboard events
-       if(bInputType != 0 && bInputType != 1)
+       if(bInputType == 2)
                return false;
 
        if(!autocvar__hud_configure)
                return false;
 
+       if(bInputType == 3)
+       {
+               mousepos_x = nPrimary;
+               mousepos_y = nSecondary;
+               return true;
+       }
+
        // allow console bind to work
        string con_keys;
        float keys;
@@ -1055,11 +1061,6 @@ void HUD_Panel_Mouse()
        if(menu_enabled == 1 || (menu_enabled == 2 && !hud_fade_alpha))
                return;
 
-       mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
-
-       mousepos_x = bound(0, mousepos_x, vid_conwidth);
-       mousepos_y = bound(0, mousepos_y, vid_conheight);
-
        if(mouseClicked)
        {
                if(prevMouseClicked == 0)