]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/master' into terencehill/cursormode
authorSamual Lenks <samual@xonotic.org>
Tue, 4 Dec 2012 20:44:39 +0000 (15:44 -0500)
committerSamual Lenks <samual@xonotic.org>
Tue, 4 Dec 2012 20:44:39 +0000 (15:44 -0500)
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/client/csqc_builtins.qc
qcsrc/client/hud.qc
qcsrc/client/hud_config.qc
qcsrc/client/mapvoting.qc

index c7a66a8680271478e17323116cc577a02fec1272..835d2855ed78a866c8e0e15a806b63b6ff6b9766 100644 (file)
@@ -383,9 +383,10 @@ float button_zoom;
 // 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 46d116cbd74dd0d8e572973621a75e35164766e6..996302ca322baf32875a115fa5f6f7282643958d 100644 (file)
@@ -473,9 +473,9 @@ void CSQC_UpdateView(float w, float h)
                        eventchase_current_distance = 0; // start from 0 next time
                }
        }
-       
+
        // 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)
        {
                setproperty(VF_ORIGIN, freeze_org);
                setproperty(VF_ANGLES, freeze_ang);
index 15e62170bab859eca1b47c9bfa99797e959b006c..0fabb0d0c70b5eb86d9edca2d752efd2e466ee3e 100644 (file)
@@ -125,6 +125,7 @@ void (entity e)                                                                     runstandardplayerphysics = #347;
 
 string (float playernum, string key)                                   getplayerkeyvalue = #348;
 void (string cmdname)                                                  registercmd = #352;
+void(float usecursor)                                                  setcursormode = #343;
 vector ()                                                              getmousepos = #344;
 
 string (string s)                                                      uncolorstring = #170;
index 2e3607ff4ffd37baab05b269befe4af27de28418..16cf6d2e9cefa87677d524483728b3cdbc2a23a9 100644 (file)
@@ -5191,8 +5191,13 @@ void HUD_Main (void)
                        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);
                        hudShiftState = 0;
+               }
        }
+       else if (hud_configure_prev)
+               setcursormode(0);
 
        hud_configure_prev = autocvar__hud_configure;
 
index c1d67af6c38224daf3e5fd9965367ed5970b83a8..d1d5dfc8aec21da63dcada6245c0a9c36184f488 100644 (file)
@@ -635,8 +635,7 @@ 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)
@@ -646,6 +645,13 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
        if(autocvar__menu_alpha)
                return true;
 
+       if(bInputType == 3)
+       {
+               mousepos_x = nPrimary;
+               mousepos_y = nSecondary;
+               return true;
+       }
+
        // allow console bind to work
        string con_keys;
        float keys;
@@ -1070,11 +1076,6 @@ void HUD_Panel_Mouse()
        if(autocvar__menu_alpha == 1)
                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)
index 750bd2a75309d8774aea219b774ed1a9875c9f5d..0961096a4dc53a28abadabc9c2f2ee2bbad894a6 100644 (file)
@@ -174,11 +174,6 @@ void MapVote_Draw()
        if(!mv_active)
                return;
 
-       mv_mousepos = mv_mousepos + getmousepos();
-
-       mv_mousepos_x = bound(0, mv_mousepos_x, vid_conwidth);
-       mv_mousepos_y = bound(0, mv_mousepos_y, vid_conheight);
-
        center = (vid_conwidth - 1)/2;
        xmin = vid_conwidth*0.05; // 5% border must suffice
        xmax = vid_conwidth - xmin;
@@ -335,8 +330,7 @@ void MapVote_Init()
        precache_sound ("misc/invshot.wav");
 
        mv_active = 1;
-
-       mv_mousepos = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
+       setcursormode(1);
        mv_selection = -1;
 
        for(n_ssdirs = 0; ; ++n_ssdirs)
@@ -406,6 +400,13 @@ float MapVote_InputEvent(float bInputType, float nPrimary, float nSecondary)
        if (!mv_active)
                return false;
 
+       if(bInputType == 3)
+       {
+               mv_mousepos_x = nPrimary;
+               mv_mousepos_y = nSecondary;
+               return true;
+       }
+
        if (bInputType != 0)
                return false;