]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Upgrade CL_VM_InputEvent to using floats rather than ints, this keeps
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 15 Dec 2013 01:22:30 +0000 (01:22 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 15 Dec 2013 01:22:30 +0000 (01:22 +0000)
the precision on fractional absolute mouse positions.

Changed CL_VM_InputEvent passing of relative mouse moves to no longer
scale by vid_conwidth, vid_conheight as this goes against the intention
in most cases (where mouse turning or similar is being achieved).

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

cl_input.c
csprogs.c
csprogs.h

index 308eb0821e422043e7dbc0927b0784399c29d02a..ecebd716a31f357e415bf39f2c07b0140f137528 100644 (file)
@@ -574,7 +574,7 @@ void CL_Input (void)
                        static int oldwindowmouse[2];
                        if (oldwindowmouse[0] != in_windowmouse_x || oldwindowmouse[1] != in_windowmouse_y)
                        {
-                               CL_VM_InputEvent(3, in_windowmouse_x * vid_conwidth.integer / vid.width, in_windowmouse_y * vid_conheight.integer / vid.height);
+                               CL_VM_InputEvent(3, in_windowmouse_x * vid_conwidth.value / vid.width, in_windowmouse_y * vid_conheight.value / vid.height);
                                oldwindowmouse[0] = in_windowmouse_x;
                                oldwindowmouse[1] = in_windowmouse_y;
                        }
@@ -582,7 +582,7 @@ void CL_Input (void)
                else
                {
                        if (in_mouse_x || in_mouse_y)
-                               CL_VM_InputEvent(2, in_mouse_x * vid_conwidth.integer / vid.width, in_mouse_y * vid_conheight.integer / vid.height);
+                               CL_VM_InputEvent(2, in_mouse_x, in_mouse_y);
                }
        }
 
index 909a82ccaf3c7a573b25dd81ca1f55d4b1d08c0b..fd2d8f6ebb4d0074cf9b3712e410af8a31ccae1c 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -433,7 +433,7 @@ qboolean CSQC_AddRenderEdict(prvm_edict_t *ed, int edictnum)
 // 1 = keyup, key, character (EXT_CSQC)
 // 2 = mousemove relative, x, y (EXT_CSQC)
 // 3 = mousemove absolute, x, y (DP_CSQC)
-qboolean CL_VM_InputEvent (int eventtype, int x, int y)
+qboolean CL_VM_InputEvent (int eventtype, float x, float y)
 {
        prvm_prog_t *prog = CLVM_prog;
        qboolean r;
index 02fa972aee3dafde0fc7f519fbae610c770e6528..567610141cc01eb43f764936a133222711f75436 100644 (file)
--- a/csprogs.h
+++ b/csprogs.h
@@ -89,7 +89,7 @@ void CL_VM_Init(void);
 void CL_VM_ShutDown(void);
 void CL_VM_UpdateIntermissionState(int intermission);
 void CL_VM_UpdateShowingScoresState(int showingscores);
-qboolean CL_VM_InputEvent(int eventtype, int x, int y);
+qboolean CL_VM_InputEvent(int eventtype, float x, float y);
 qboolean CL_VM_ConsoleCommand(const char *cmd);
 void CL_VM_UpdateDmgGlobals(int dmg_take, int dmg_save, vec3_t dmg_origin);
 void CL_VM_UpdateIntermissionState(int intermission);