]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
split VM_getmousepos into client and menu versions because they need to
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 8 May 2008 17:22:08 +0000 (17:22 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 8 May 2008 17:22:08 +0000 (17:22 +0000)
check different variables to decide whether to return window coordinates
or delta mouse motions

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8290 d7cf8633-e32d-0410-b094-e92efae38249

cl_screen.c
clvm_cmds.c
mvm_cmds.c
prvm_cmds.c

index 044dc6dbf02b8bdb8d76e8a5929e41ab4f1f8c6a..9dbeb5620b4084d3835a11f72c556ea0d0d94dfa 100644 (file)
@@ -2277,7 +2277,7 @@ void CL_UpdateScreen(void)
        else if (key_dest == key_menu_grabbed)
                grabmouse = true;
        else if (key_dest == key_menu)
-               grabmouse = in_client_mouse;
+               grabmouse = !in_client_mouse;
        else if (key_dest == key_game)
                grabmouse = vid_mouse.integer && !cls.demoplayback && !cl.csqc_wantsmousemove;
        else
index cd35395fa6a480983b862e0788674b981ed1a6af..83aa12a652f679689e1a7d49a03d48c0e9e3eb23 100644 (file)
@@ -1107,6 +1107,17 @@ static void VM_CL_setcursormode (void)
        cl_ignoremousemoves = 2;
 }
 
+//#344 vector() getmousepos (EXT_CSQC)
+static void VM_CL_getmousepos(void)
+{
+       VM_SAFEPARMCOUNT(0,VM_CL_getmousepos);
+
+       if (cl.csqc_wantsmousemove)
+               VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_windowmouse_x * vid_conwidth.integer / vid.width, in_windowmouse_y * vid_conheight.integer / vid.height, 0);
+       else
+               VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_mouse_x * vid_conwidth.integer / vid.width, in_mouse_y * vid_conheight.integer / vid.height, 0);
+}
+
 //#345 float(float framenum) getinputstate (EXT_CSQC)
 static void VM_CL_getinputstate (void)
 {
@@ -3247,7 +3258,7 @@ VM_keynumtostring,                                // #340 string(float keynum) keynumtostring (EXT_CSQC)
 VM_stringtokeynum,                             // #341 float(string keyname) stringtokeynum (EXT_CSQC)
 VM_CL_getkeybind,                              // #342 string(float keynum) getkeybind (EXT_CSQC)
 VM_CL_setcursormode,                   // #343 void(float usecursor) setcursormode (EXT_CSQC)
-VM_getmousepos,                                        // #344 vector() getmousepos (EXT_CSQC)
+VM_CL_getmousepos,                             // #344 vector() getmousepos (EXT_CSQC)
 VM_CL_getinputstate,                   // #345 float(float framenum) getinputstate (EXT_CSQC)
 VM_CL_setsensitivityscale,             // #346 void(float sens) setsensitivityscale (EXT_CSQC)
 VM_CL_runplayerphysics,                        // #347 void() runstandardplayerphysics (EXT_CSQC)
index 391076f520dd38c9235d218ee540f09682114c7d..34a0a22c007c50bc6137fb2e387b366f90bdfd91 100644 (file)
@@ -785,6 +785,17 @@ static void VM_M_copyentity (void)
        memcpy(out->fields.vp, in->fields.vp, prog->progs->entityfields * 4);
 }
 
+//#66 vector() getmousepos (EXT_CSQC)
+static void VM_M_getmousepos(void)
+{
+       VM_SAFEPARMCOUNT(0,VM_M_getmousepos);
+
+       if (in_client_mouse)
+               VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_windowmouse_x * vid_conwidth.integer / vid.width, in_windowmouse_y * vid_conheight.integer / vid.height, 0);
+       else
+               VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_mouse_x * vid_conwidth.integer / vid.width, in_mouse_y * vid_conheight.integer / vid.height, 0);
+}
+
 prvm_builtin_t vm_m_builtins[] = {
 NULL,                                                                  //   #0 NULL function (not callable)
 VM_checkextension,                             //   #1
@@ -852,7 +863,7 @@ VM_clientstate,                                     //  #62
 VM_clcommand,                                          //  #63
 VM_changelevel,                                        //  #64
 VM_localsound,                                         //  #65
-VM_getmousepos,                                        //  #66
+VM_M_getmousepos,                                      //  #66
 VM_gettime,                                                    //  #67
 VM_loadfromdata,                                       //  #68
 VM_loadfromfile,                                       //  #69
index eb677b6168e2bf60d9ad560bec73adf7eefe1317..71bebfff2666895779301da3a2a4ef894db813c7 100644 (file)
@@ -2298,24 +2298,6 @@ void VM_getostype(void)
 #endif
 }
 
-/*
-=========
-VM_getmousepos
-
-vector getmousepos()
-=========
-*/
-void VM_getmousepos(void)
-{
-       VM_SAFEPARMCOUNT(0,VM_getmousepos);
-
-       // FIXME: somehow this should involve in_client_mouse if this is menu progs
-       if (!vid.mouseaim)
-               VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_windowmouse_x * vid_conwidth.integer / vid.width, in_windowmouse_y * vid_conheight.integer / vid.height, 0);
-       else
-               VectorSet(PRVM_G_VECTOR(OFS_RETURN), in_mouse_x * vid_conwidth.integer / vid.width, in_mouse_y * vid_conheight.integer / vid.height, 0);
-}
-
 /*
 =========
 VM_gettime