X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=cl_input.c;h=d449bdf6d062a27eed7a281ed9bf5d339f8ab77c;hb=2a10cbe9394e5ead9b8307591917d139774ceb43;hp=8fe0d4cbeffc5dd513a1ae86c855836b135339f1;hpb=dd9b6a7eef6a97ea184a54ededf6cc610164138d;p=xonotic%2Fdarkplaces.git diff --git a/cl_input.c b/cl_input.c index 8fe0d4cb..d449bdf6 100644 --- a/cl_input.c +++ b/cl_input.c @@ -457,6 +457,8 @@ cvar_t cl_netimmediatebuttons = {CVAR_SAVE, "cl_netimmediatebuttons", "1", "send cvar_t cl_nodelta = {0, "cl_nodelta", "0", "disables delta compression of non-player entities in QW network protocol"}; +cvar_t cl_csqc_generatemousemoveevents = {0, "cl_csqc_generatemousemoveevents", "1", "enables calls to CSQC_InputEvent with type 2, for compliance with EXT_CSQC spec"}; + extern cvar_t v_flipped; /* @@ -516,6 +518,7 @@ CL_Input Send the intended movement message to the server ================ */ +extern qboolean CL_VM_InputEvent (int eventtype, int x, int y); void CL_Input (void) { float mx, my; @@ -562,6 +565,27 @@ void CL_Input (void) // allow mice or other external controllers to add to the move IN_Move (); + // send mouse move to csqc + if (cl.csqc_loaded && cl_csqc_generatemousemoveevents.integer) + { + if (cl.csqc_wantsmousemove) + { + // event type 3 is a DP_CSQC thing + 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); + oldwindowmouse[0] = in_windowmouse_x; + oldwindowmouse[1] = in_windowmouse_y; + } + } + 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); + } + } + // apply m_accelerate if it is on if(m_accelerate.value > 1) { @@ -2234,5 +2258,7 @@ void CL_InitInput (void) Cvar_RegisterVariable(&cl_netimmediatebuttons); Cvar_RegisterVariable(&cl_nodelta); + + Cvar_RegisterVariable(&cl_csqc_generatemousemoveevents); }