// if not in menu, apply mouse move to viewangles/movement
if (!cl.csqc_wantsmousemove && in_client_mouse)
{
+ float modulatedsensitivity = sensitivity.value * cl.sensitivityscale;
if (cl_prydoncursor.integer)
{
// mouse interacting with the scene, mostly stationary view
V_StopPitchDrift();
- cl.cmd.cursor_screen[0] += in_mouse_x * sensitivity.value / vid.width;
- cl.cmd.cursor_screen[1] += in_mouse_y * sensitivity.value / vid.height;
+ cl.cmd.cursor_screen[0] += in_mouse_x * modulatedsensitivity / vid.width;
+ cl.cmd.cursor_screen[1] += in_mouse_y * modulatedsensitivity / vid.height;
}
else if (in_strafe.state & 1)
{
// strafing mode, all looking is movement
V_StopPitchDrift();
- cl.cmd.sidemove += m_side.value * in_mouse_x * sensitivity.value;
+ cl.cmd.sidemove += m_side.value * in_mouse_x * modulatedsensitivity;
if (noclip_anglehack)
- cl.cmd.upmove -= m_forward.value * in_mouse_y * sensitivity.value;
+ cl.cmd.upmove -= m_forward.value * in_mouse_y * modulatedsensitivity;
else
- cl.cmd.forwardmove -= m_forward.value * in_mouse_y * sensitivity.value;
+ cl.cmd.forwardmove -= m_forward.value * in_mouse_y * modulatedsensitivity;
}
else if ((in_mlook.state & 1) || freelook.integer)
{
// mouselook, lookstrafe causes turning to become strafing
V_StopPitchDrift();
if (lookstrafe.integer)
- cl.cmd.sidemove += m_side.value * in_mouse_x * sensitivity.value;
+ cl.cmd.sidemove += m_side.value * in_mouse_x * modulatedsensitivity;
else
- cl.viewangles[YAW] -= m_yaw.value * in_mouse_x * sensitivity.value * cl.viewzoom;
- cl.viewangles[PITCH] += m_pitch.value * in_mouse_y * sensitivity.value * cl.viewzoom;
+ cl.viewangles[YAW] -= m_yaw.value * in_mouse_x * modulatedsensitivity * cl.viewzoom;
+ cl.viewangles[PITCH] += m_pitch.value * in_mouse_y * modulatedsensitivity * cl.viewzoom;
}
else
{
// non-mouselook, yaw turning and forward/back movement
- cl.viewangles[YAW] -= m_yaw.value * in_mouse_x * sensitivity.value * cl.viewzoom;
- cl.cmd.forwardmove -= m_forward.value * in_mouse_y * sensitivity.value;
+ cl.viewangles[YAW] -= m_yaw.value * in_mouse_x * modulatedsensitivity * cl.viewzoom;
+ cl.cmd.forwardmove -= m_forward.value * in_mouse_y * modulatedsensitivity;
}
}
// reset the view zoom interpolation
cl.mviewzoom[0] = cl.mviewzoom[1] = 1;
+ cl.sensitivityscale = 1.0f;
// enable rendering of the world and such
cl.csqc_vidvars.drawworld = true;
{
prvm_edict_t *ed;
ed = PRVM_ED_Alloc();
+ // FIXME: WTF.. this should be removed imo.. entnum points to the server.. [12/17/2007 Black]
ed->fields.client->entnum = PRVM_NUM_FOR_EDICT(ed); //[515]: not needed any more ?
VM_RETURN_EDICT(ed);
}
int move;
prvm_edict_t *ent;
- VM_SAFEPARMCOUNTRANGE(4, 8, VM_CL_traceline); // allow more parameters for future expansion
+ VM_SAFEPARMCOUNTRANGE(4, 4, VM_CL_traceline);
prog->xfunction->builtinsprofile += 30;
switch(c)
{
- case VF_MIN: r_view.x = (int)(f[0] * vid.width / vid_conwidth.value);
- r_view.y = (int)(f[1] * vid.height / vid_conheight.value);
- break;
- case VF_MIN_X: r_view.x = (int)(k * vid.width / vid_conwidth.value);
- break;
- case VF_MIN_Y: r_view.y = (int)(k * vid.height / vid_conheight.value);
- break;
- case VF_SIZE: r_view.width = (int)(f[0] * vid.width / vid_conwidth.value);
- r_view.height = (int)(f[1] * vid.height / vid_conheight.value);
- break;
- case VF_SIZE_Y: r_view.width = (int)(k * vid.width / vid_conwidth.value);
- break;
- case VF_SIZE_X: r_view.height = (int)(k * vid.height / vid_conheight.value);
- break;
- case VF_VIEWPORT: r_view.x = (int)(f[0] * vid.width / vid_conwidth.value);
- r_view.y = (int)(f[1] * vid.height / vid_conheight.value);
- f = PRVM_G_VECTOR(OFS_PARM2);
- r_view.width = (int)(f[0] * vid.width / vid_conwidth.value);
- r_view.height = (int)(f[1] * vid.height / vid_conheight.value);
- break;
- case VF_FOV: r_view.frustum_x = tan(f[0] * M_PI / 360.0);r_view.ortho_x = f[0];
- r_view.frustum_y = tan(f[1] * M_PI / 360.0);r_view.ortho_y = f[1];
- break;
- case VF_FOVX: r_view.frustum_x = tan(k * M_PI / 360.0);r_view.ortho_x = k;
- break;
- case VF_FOVY: r_view.frustum_y = tan(k * M_PI / 360.0);r_view.ortho_y = k;
- break;
- case VF_ORIGIN: VectorCopy(f, cl.csqc_origin);
- CSQC_R_RecalcView();
- break;
- case VF_ORIGIN_X: cl.csqc_origin[0] = k;
- CSQC_R_RecalcView();
- break;
- case VF_ORIGIN_Y: cl.csqc_origin[1] = k;
- CSQC_R_RecalcView();
- break;
- case VF_ORIGIN_Z: cl.csqc_origin[2] = k;
- CSQC_R_RecalcView();
- break;
- case VF_ANGLES: VectorCopy(f, cl.csqc_angles);
- CSQC_R_RecalcView();
- break;
- case VF_ANGLES_X: cl.csqc_angles[0] = k;
- CSQC_R_RecalcView();
- break;
- case VF_ANGLES_Y: cl.csqc_angles[1] = k;
- CSQC_R_RecalcView();
- break;
- case VF_ANGLES_Z: cl.csqc_angles[2] = k;
- CSQC_R_RecalcView();
- break;
- case VF_DRAWWORLD: cl.csqc_vidvars.drawworld = k;
- break;
- case VF_DRAWENGINESBAR: cl.csqc_vidvars.drawenginesbar = k;
- break;
- case VF_DRAWCROSSHAIR: cl.csqc_vidvars.drawcrosshair = k;
- break;
-
- case VF_CL_VIEWANGLES: VectorCopy(f, cl.viewangles);
- break;
- case VF_CL_VIEWANGLES_X:cl.viewangles[0] = k;
- break;
- case VF_CL_VIEWANGLES_Y:cl.viewangles[1] = k;
- break;
- case VF_CL_VIEWANGLES_Z:cl.viewangles[2] = k;
- break;
-
- case VF_PERSPECTIVE: r_view.useperspective = k != 0;
- break;
-
- default: PRVM_G_FLOAT(OFS_RETURN) = 0;
- VM_Warning("VM_CL_R_SetView : unknown parm %i\n", c);
- return;
+ case VF_MIN:
+ r_view.x = (int)(f[0] * vid.width / vid_conwidth.value);
+ r_view.y = (int)(f[1] * vid.height / vid_conheight.value);
+ break;
+ case VF_MIN_X:
+ r_view.x = (int)(k * vid.width / vid_conwidth.value);
+ break;
+ case VF_MIN_Y:
+ r_view.y = (int)(k * vid.height / vid_conheight.value);
+ break;
+ case VF_SIZE:
+ r_view.width = (int)(f[0] * vid.width / vid_conwidth.value);
+ r_view.height = (int)(f[1] * vid.height / vid_conheight.value);
+ break;
+ case VF_SIZE_Y:
+ r_view.width = (int)(k * vid.width / vid_conwidth.value);
+ break;
+ case VF_SIZE_X:
+ r_view.height = (int)(k * vid.height / vid_conheight.value);
+ break;
+ case VF_VIEWPORT:
+ r_view.x = (int)(f[0] * vid.width / vid_conwidth.value);
+ r_view.y = (int)(f[1] * vid.height / vid_conheight.value);
+ f = PRVM_G_VECTOR(OFS_PARM2);
+ r_view.width = (int)(f[0] * vid.width / vid_conwidth.value);
+ r_view.height = (int)(f[1] * vid.height / vid_conheight.value);
+ break;
+ case VF_FOV:
+ r_view.frustum_x = tan(f[0] * M_PI / 360.0);r_view.ortho_x = f[0];
+ r_view.frustum_y = tan(f[1] * M_PI / 360.0);r_view.ortho_y = f[1];
+ break;
+ case VF_FOVX:
+ r_view.frustum_x = tan(k * M_PI / 360.0);r_view.ortho_x = k;
+ break;
+ case VF_FOVY:
+ r_view.frustum_y = tan(k * M_PI / 360.0);r_view.ortho_y = k;
+ break;
+ case VF_ORIGIN:
+ VectorCopy(f, cl.csqc_origin);
+ CSQC_R_RecalcView();
+ break;
+ case VF_ORIGIN_X:
+ cl.csqc_origin[0] = k;
+ CSQC_R_RecalcView();
+ break;
+ case VF_ORIGIN_Y:
+ cl.csqc_origin[1] = k;
+ CSQC_R_RecalcView();
+ break;
+ case VF_ORIGIN_Z:
+ cl.csqc_origin[2] = k;
+ CSQC_R_RecalcView();
+ break;
+ case VF_ANGLES:
+ VectorCopy(f, cl.csqc_angles);
+ CSQC_R_RecalcView();
+ break;
+ case VF_ANGLES_X:
+ cl.csqc_angles[0] = k;
+ CSQC_R_RecalcView();
+ break;
+ case VF_ANGLES_Y:
+ cl.csqc_angles[1] = k;
+ CSQC_R_RecalcView();
+ break;
+ case VF_ANGLES_Z:
+ cl.csqc_angles[2] = k;
+ CSQC_R_RecalcView();
+ break;
+ case VF_DRAWWORLD:
+ cl.csqc_vidvars.drawworld = k;
+ break;
+ case VF_DRAWENGINESBAR:
+ cl.csqc_vidvars.drawenginesbar = k;
+ break;
+ case VF_DRAWCROSSHAIR:
+ cl.csqc_vidvars.drawcrosshair = k;
+ break;
+ case VF_CL_VIEWANGLES:
+ VectorCopy(f, cl.viewangles);
+ break;
+ case VF_CL_VIEWANGLES_X:
+ cl.viewangles[0] = k;
+ break;
+ case VF_CL_VIEWANGLES_Y:
+ cl.viewangles[1] = k;
+ break;
+ case VF_CL_VIEWANGLES_Z:
+ cl.viewangles[2] = k;
+ break;
+ case VF_PERSPECTIVE:
+ r_view.useperspective = k != 0;
+ break;
+ default:
+ PRVM_G_FLOAT(OFS_RETURN) = 0;
+ VM_Warning("VM_CL_R_SetView : unknown parm %i\n", c);
+ return;
}
PRVM_G_FLOAT(OFS_RETURN) = 1;
}
{
float *pos, *col;
matrix4x4_t matrix;
- VM_SAFEPARMCOUNTRANGE(3, 8, VM_CL_R_AddDynamicLight); // allow more than 3 because we may extend this in the future
+ VM_SAFEPARMCOUNTRANGE(3, 3, VM_CL_R_AddDynamicLight);
// if we've run out of dlights, just return
if (r_refdef.numlights >= MAX_DLIGHTS)
void VM_CL_Cmd_Init(void)
{
+ VM_Cmd_Init();
// TODO: replace vm_polygons stuff with a more general debugging polygon system, and make vm_polygons functions use that system
if(vm_polygons_initialized)
{
void VM_CL_Cmd_Reset(void)
{
+ VM_Cmd_Reset();
if(vm_polygons_initialized)
{
Mem_FreePool(&vm_polygons_pool);
prog->globals.client->clientcommandframe = cl.movecmd[0].sequence;
VectorCopy(cl.viewangles, prog->globals.client->input_angles);
VectorCopy(cl.viewangles, cl.csqc_angles);
+ // // FIXME: this actually belongs into getinputstate().. [12/17/2007 Black]
prog->globals.client->input_buttons = cl.movecmd[0].buttons;
VectorSet(prog->globals.client->input_movevalues, cl.movecmd[0].forwardmove, cl.movecmd[0].sidemove, cl.movecmd[0].upmove);
//VectorCopy(cl.movement_origin, cl.csqc_origin);
return true;
}
-qboolean CL_VM_InputEvent (qboolean pressed, int key)
+qboolean CL_VM_InputEvent (qboolean down, int key)
{
qboolean r;
if(!cl.csqc_loaded)
else
{
prog->globals.client->time = cl.time;
- PRVM_G_FLOAT(OFS_PARM0) = pressed;
+ PRVM_G_FLOAT(OFS_PARM0) = !down; // 0 is down, 1 is up
PRVM_G_FLOAT(OFS_PARM1) = key;
PRVM_ExecuteProgram(prog->funcoffsets.CSQC_InputEvent, "QC function CSQC_InputEvent is missing");
r = CSQC_RETURNVAL;
return bind;
}
-qboolean CL_VM_InputEvent (qboolean pressed, int key);
+qboolean CL_VM_InputEvent (qboolean down, int key);
/*
===================
if (developer.integer >= 1000)
Con_Printf("Key_Event(%i, '%c', %s) keydown %i bind \"%s\"\n", key, ascii, down ? "down" : "up", keydown[key], bind ? bind : "");
+#if 0
if(key_dest == key_game)
{
- q = CL_VM_InputEvent(!down, key);
+ q = CL_VM_InputEvent(down, key);
if(q)
{
if (down)
return;
}
}
+#endif
if (down)
{
{
// clear repeat count now that the key is released
keydown[key] = 0;
- // key up events only generate commands if the game key binding is a button
- // command (leading + sign). These will occur even in console mode, to
- // keep the character from continuing an action started before a console
- // switch. Button commands include the kenum as a parameter, so multiple
- // downs can be matched with ups
- if (bind && bind[0] == '+')
- Cbuf_AddText(va("-%s %i\n", bind + 1, key));
}
// key_consoleactive is a flag not a key_dest because the console is a
MR_KeyEvent (key, ascii, down);
break;
case key_game:
- if (down)
+ // 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);
+ if (!q && down)
MR_ToggleMenu_f ();
break;
default:
return;
}
+
+ // FIXME: actually the up-bind should only be called if the button was actually pressed while key_dest == key_game [12/17/2007 Black]
+ // especially CL_VM_InputEvent should be able to prevent it from being called (to intercept the binds)
+ // key up events only generate commands if the game key binding is a button
+ // command (leading + sign). These will occur even in console mode, to
+ // keep the character from continuing an action started before a console
+ // switch. Button commands include the kenum as a parameter, so multiple
+ // downs can be matched with ups
+ if (!down && bind && bind[0] == '+')
+ Cbuf_AddText(va("-%s %i\n", bind + 1, key));
+
// ignore binds while a video is played, let the video system handle the key event
if (cl_videoplaying)
{
MR_KeyEvent (key, ascii, down);
break;
case key_game:
- // ignore key repeats on binds
- if (bind && keydown[key] == 1 && down)
+ q = CL_VM_InputEvent(down, key);
+ // ignore key repeats on binds and only send the bind if the event hasnt been already processed by csqc
+ if (!q && bind && keydown[key] == 1 && down)
{
// button commands add keynum as a parm
if (bind[0] == '+')
if(!*sectionstarted)
MSG_WriteByte(msg, svc_csqcentities);
MSG_WriteShort(msg, number);
- ((int *)prog->globals.generic)[OFS_PARM0] = sv.writeentitiestoclient_cliententitynumber;
+ PRVM_G_INT(OFS_PARM0) = sv.writeentitiestoclient_cliententitynumber;
prog->globals.server->self = number;
PRVM_ExecuteProgram(val->function, "Null SendEntity\n");
- if(prog->globals.generic[OFS_RETURN])
+ if(PRVM_G_FLOAT(OFS_RETURN))
{
if (msg->cursize + 2 > msg->maxsize)
{