From 2332cc6623e23018333b9736c439798808edc486 Mon Sep 17 00:00:00 2001 From: Mark Olsen Date: Sun, 16 Apr 2006 02:10:36 +0000 Subject: [PATCH] Mousecursor support (cheers, TimeServ) git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2217 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/in_morphos.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/engine/client/in_morphos.c b/engine/client/in_morphos.c index 19bbc29e5..29bf344ed 100644 --- a/engine/client/in_morphos.c +++ b/engine/client/in_morphos.c @@ -212,6 +212,9 @@ void IN_Commands(void) void IN_Move (usercmd_t *cmd, int pnum) { + extern int mousecursor_x, mousecursor_y; + extern int mousemove_x, mousemove_y; + if (pnum != 0) return; //we're lazy today. @@ -222,14 +225,39 @@ void IN_Move (usercmd_t *cmd, int pnum) old_mouse_x = mouse_x; old_mouse_y = mouse_y; - - mouse_x *= sensitivity.value; - mouse_y *= sensitivity.value; - + #ifdef IN_XFLIP if(in_xflip.value) mouse_x *= -1; #endif + if (Key_MouseShouldBeFree()) + { + mousemove_x += mouse_x; + mousemove_y += mouse_y; + mousecursor_x += mouse_x; + mousecursor_y += mouse_y; + + if (mousecursor_y<0) + mousecursor_y=0; + if (mousecursor_x<0) + mousecursor_x=0; + + if (mousecursor_x >= vid.width) + mousecursor_x = vid.width - 1; + + if (mousecursor_y >= vid.height) + mousecursor_y = vid.height - 1; + + mouse_x = mouse_y = 0; +#ifdef VM_UI + UI_MousePosition(mousecursor_x, mousecursor_y); +#endif + } + + + mouse_x *= sensitivity.value; + mouse_y *= sensitivity.value; + if ( (in_strafe.state[pnum] & 1) || (lookstrafe.value && (in_mlook.state[pnum] & 1) )) { if (cmd)