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
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)
{
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)
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
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
#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