From 52e98268042cbf9d4460898e4fa8ebaa023977e2 Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 15 Dec 2013 01:22:30 +0000 Subject: [PATCH] Upgrade CL_VM_InputEvent to using floats rather than ints, this keeps 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 | 4 ++-- csprogs.c | 2 +- csprogs.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cl_input.c b/cl_input.c index 308eb082..ecebd716 100644 --- a/cl_input.c +++ b/cl_input.c @@ -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); } } diff --git a/csprogs.c b/csprogs.c index 909a82cc..fd2d8f6e 100644 --- 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; diff --git a/csprogs.h b/csprogs.h index 02fa972a..56761014 100644 --- 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); -- 2.39.2