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;
/*
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;
// 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)
{
Cvar_RegisterVariable(&cl_netimmediatebuttons);
Cvar_RegisterVariable(&cl_nodelta);
+
+ Cvar_RegisterVariable(&cl_csqc_generatemousemoveevents);
}
cl.csqc_paused = false;
}
-//#343 void(float usecursor) setcursormode (EXT_CSQC)
+//#343 void(float usecursor) setcursormode (DP_CSQC)
static void VM_CL_setcursormode (void)
{
VM_SAFEPARMCOUNT(1, VM_CL_setcursormode);
cl_ignoremousemoves = 2;
}
-//#344 vector() getmousepos (EXT_CSQC)
+//#344 vector() getmousepos (DP_CSQC)
static void VM_CL_getmousepos(void)
{
VM_SAFEPARMCOUNT(0,VM_CL_getmousepos);
VM_keynumtostring, // #340 string(float keynum) keynumtostring (EXT_CSQC)
VM_stringtokeynum, // #341 float(string keyname) stringtokeynum (EXT_CSQC)
VM_getkeybind, // #342 string(float keynum[, float bindmap]) getkeybind (EXT_CSQC)
-VM_CL_setcursormode, // #343 void(float usecursor) setcursormode (EXT_CSQC)
-VM_CL_getmousepos, // #344 vector() getmousepos (EXT_CSQC)
+VM_CL_setcursormode, // #343 void(float usecursor) setcursormode (DP_CSQC)
+VM_CL_getmousepos, // #344 vector() getmousepos (DP_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)
static void Cmd_Exec(const char *filename)
{
char *f;
+ qboolean isdefaultcfg = strlen(filename) >= 11 && !strcmp(filename + strlen(filename) - 11, "default.cfg");
if (!strcmp(filename, "config.cfg"))
{
// if executing default.cfg for the first time, lock the cvar defaults
// it may seem backwards to insert this text BEFORE the default.cfg
// but Cbuf_InsertText inserts before, so this actually ends up after it.
- if (strlen(filename) >= 11 && !strcmp(filename + strlen(filename) - 11, "default.cfg"))
+ if (isdefaultcfg)
Cbuf_InsertText("\ncvar_lockdefaults\n");
// insert newline after the text to make sure the last line is terminated (some text editors omit the trailing newline)
Cbuf_InsertText (f);
Mem_Free(f);
- // special defaults for specific games go here, these execute before default.cfg
- // Nehahra pushable crates malfunction in some levels if this is on
- // Nehahra NPC AI is confused by blowupfallenzombies
- if (gamemode == GAME_NEHAHRA)
- Cbuf_InsertText("\nsv_gameplayfix_upwardvelocityclearsongroundflag 0\nsv_gameplayfix_blowupfallenzombies 0\n\n");
- // hipnotic mission pack has issues in their 'friendly monster' ai, which seem to attempt to attack themselves for some reason when findradius() returns non-solid entities.
- // hipnotic mission pack has issues with bobbing water entities 'jittering' between different heights on alternate frames at the default 0.0138889 ticrate, 0.02 avoids this issue
- // hipnotic mission pack has issues in their proximity mine sticking code, which causes them to bounce off.
- if (gamemode == GAME_HIPNOTIC)
- Cbuf_InsertText("\nsv_gameplayfix_blowupfallenzombies 0\nsys_ticrate 0.02\nsv_gameplayfix_slidemoveprojectiles 0\n\n");
- // rogue mission pack has a guardian boss that does not wake up if findradius returns one of the entities around its spawn area
- if (gamemode == GAME_ROGUE)
- Cbuf_InsertText("\nsv_gameplayfix_findradiusdistancetobox 0\n\n");
- if (gamemode == GAME_NEXUIZ)
- Cbuf_InsertText("\nsv_gameplayfix_q2airaccelerate 1\nsv_gameplayfix_stepmultipletimes 1\n\n");
- if (gamemode == GAME_TENEBRAE)
- Cbuf_InsertText("\nr_shadow_gloss 2\nr_shadow_bumpscale_basetexture 4\n\n");
+ if (isdefaultcfg)
+ {
+ // special defaults for specific games go here, these execute before default.cfg
+ // Nehahra pushable crates malfunction in some levels if this is on
+ // Nehahra NPC AI is confused by blowupfallenzombies
+ if (gamemode == GAME_NEHAHRA)
+ Cbuf_InsertText("\nsv_gameplayfix_upwardvelocityclearsongroundflag 0\nsv_gameplayfix_blowupfallenzombies 0\n\n");
+ // hipnotic mission pack has issues in their 'friendly monster' ai, which seem to attempt to attack themselves for some reason when findradius() returns non-solid entities.
+ // hipnotic mission pack has issues with bobbing water entities 'jittering' between different heights on alternate frames at the default 0.0138889 ticrate, 0.02 avoids this issue
+ // hipnotic mission pack has issues in their proximity mine sticking code, which causes them to bounce off.
+ if (gamemode == GAME_HIPNOTIC)
+ Cbuf_InsertText("\nsv_gameplayfix_blowupfallenzombies 0\nsys_ticrate 0.02\nsv_gameplayfix_slidemoveprojectiles 0\n\n");
+ // rogue mission pack has a guardian boss that does not wake up if findradius returns one of the entities around its spawn area
+ if (gamemode == GAME_ROGUE)
+ Cbuf_InsertText("\nsv_gameplayfix_findradiusdistancetobox 0\n\n");
+ if (gamemode == GAME_NEXUIZ)
+ Cbuf_InsertText("\nsv_gameplayfix_q2airaccelerate 1\nsv_gameplayfix_stepmultipletimes 1\n\n");
+ if (gamemode == GAME_TENEBRAE)
+ Cbuf_InsertText("\nr_shadow_gloss 2\nr_shadow_bumpscale_basetexture 4\n\n");
+ // Steel Storm: Burning Retribution csqc misinterprets CSQC_InputEvent if type is a value other than 0 or 1
+ if (gamemode == GAME_STEELSTORM)
+ Cbuf_InsertText("\ncl_csqc_generatemousemoveevents 0\n\n");
+ }
}
/*
return true;
}
-qboolean CL_VM_InputEvent (qboolean down, int key, int ascii)
+// 0 = keydown, key, character (EXT_CSQC)
+// 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 r;
{
PRVM_clientglobalfloat(time) = cl.time;
PRVM_clientglobaledict(self) = cl.csqc_server2csqcentitynumber[cl.playerentity];
- PRVM_G_FLOAT(OFS_PARM0) = !down; // 0 is down, 1 is up
- PRVM_G_FLOAT(OFS_PARM1) = key;
- PRVM_G_FLOAT(OFS_PARM2) = ascii;
+ PRVM_G_FLOAT(OFS_PARM0) = eventtype;
+ PRVM_G_FLOAT(OFS_PARM1) = x; // key or x
+ PRVM_G_FLOAT(OFS_PARM2) = y; // ascii or y
PRVM_ExecuteProgram(PRVM_clientfunction(CSQC_InputEvent), "QC function CSQC_InputEvent is missing");
r = CSQC_RETURNVAL != 0;
}
}
}
-qboolean CL_VM_InputEvent (qboolean down, int key, int ascii);
+extern qboolean CL_VM_InputEvent (int eventtype, int x, int y);
/*
===================
case key_game:
// csqc has priority over toggle menu if it wants to (e.g. handling escape for UI stuff in-game.. :sick:)
- q = CL_VM_InputEvent(down, key, ascii);
+ q = CL_VM_InputEvent(down ? 0 : 1, key, ascii);
if (!q && down)
MR_ToggleMenu(1);
break;
MR_KeyEvent (key, ascii, down);
break;
case key_game:
- q = CL_VM_InputEvent(down, key, ascii);
+ q = CL_VM_InputEvent(down ? 0 : 1, key, ascii);
// ignore key repeats on binds and only send the bind if the event hasnt been already processed by csqc
if (!q && bind)
{