mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 07:11:41 +00:00
[qw] Create axes for viewdelta
First step in removing IN_Move. Once nq is updated, IN_Move can be removed entirely.
This commit is contained in:
parent
9172e76107
commit
6da8a2622f
2 changed files with 60 additions and 13 deletions
|
@ -66,6 +66,38 @@ cvar_t *cl_nodelta;
|
|||
cvar_t *cl_maxnetfps;
|
||||
cvar_t *cl_spamimpulse;
|
||||
|
||||
in_axis_t viewdelta_position_forward = {
|
||||
.mode = ina_accumulate,
|
||||
.name = "move.forward",
|
||||
.description = "Move forward (positive) or backward (negative)",
|
||||
};
|
||||
in_axis_t viewdelta_position_left = {
|
||||
.mode = ina_accumulate,
|
||||
.name = "move.left",
|
||||
.description = "Move left (positive) or right (negative)",
|
||||
};
|
||||
in_axis_t viewdelta_position_up = {
|
||||
.mode = ina_accumulate,
|
||||
.name = "move.up",
|
||||
.description = "Move up (positive) or down (negative)",
|
||||
};
|
||||
|
||||
in_axis_t viewdelta_angles_pitch = {
|
||||
.mode = ina_accumulate,
|
||||
.name = "move.pitch",
|
||||
.description = "Pitch axis",
|
||||
};
|
||||
in_axis_t viewdelta_angles_yaw = {
|
||||
.mode = ina_accumulate,
|
||||
.name = "move.yaw",
|
||||
.description = "Yaw axis",
|
||||
};
|
||||
in_axis_t viewdelta_angles_roll = {
|
||||
.mode = ina_accumulate,
|
||||
.name = "move.roll",
|
||||
.description = "Roll axis",
|
||||
};
|
||||
|
||||
in_button_t in_left = {
|
||||
.name = "left",
|
||||
.description = "When active the player is turning left"
|
||||
|
@ -140,6 +172,16 @@ in_button_t in_mlook = {
|
|||
"+lookdown"
|
||||
};
|
||||
|
||||
static in_axis_t *cl_in_axes[] = {
|
||||
&viewdelta_position_forward,
|
||||
&viewdelta_position_left,
|
||||
&viewdelta_position_up,
|
||||
&viewdelta_angles_pitch,
|
||||
&viewdelta_angles_yaw,
|
||||
&viewdelta_angles_roll,
|
||||
0,
|
||||
};
|
||||
|
||||
static in_button_t *cl_in_buttons[] = {
|
||||
&in_left,
|
||||
&in_right,
|
||||
|
@ -288,11 +330,6 @@ CL_BaseMove (usercmd_t *cmd)
|
|||
if (freelook)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
viewdelta.angles[0] = viewdelta.angles[1] = viewdelta.angles[2] = 0;
|
||||
viewdelta.position[0] = viewdelta.position[1] = viewdelta.position[2] = 0;
|
||||
|
||||
IN_Move ();
|
||||
|
||||
// adjust for chase camera angles
|
||||
/*FIXME:chase figure out just what this does and get it working
|
||||
if (cl.chase
|
||||
|
@ -313,12 +350,19 @@ CL_BaseMove (usercmd_t *cmd)
|
|||
}
|
||||
*/
|
||||
|
||||
cmd->forwardmove += viewdelta.position[2] * m_forward->value;
|
||||
cmd->sidemove += viewdelta.position[0] * m_side->value;
|
||||
cmd->upmove += viewdelta.position[1];
|
||||
cl.viewstate.angles[PITCH] += viewdelta.angles[PITCH] * m_pitch->value;
|
||||
cl.viewstate.angles[YAW] += viewdelta.angles[YAW] * m_yaw->value;
|
||||
cl.viewstate.angles[ROLL] += viewdelta.angles[ROLL];
|
||||
cmd->forwardmove += viewdelta_position_forward.value * m_forward->value;
|
||||
cmd->sidemove += viewdelta_position_left.value * m_side->value;
|
||||
cmd->upmove += viewdelta_position_up.value;
|
||||
cl.viewstate.angles[PITCH] += viewdelta_angles_pitch.value * m_pitch->value;
|
||||
cl.viewstate.angles[YAW] += viewdelta_angles_yaw.value * m_yaw->value;
|
||||
cl.viewstate.angles[ROLL] += viewdelta_angles_roll.value;
|
||||
|
||||
viewdelta_angles_pitch.value = 0;
|
||||
viewdelta_angles_yaw.value = 0;
|
||||
viewdelta_angles_roll.value = 0;
|
||||
viewdelta_position_forward.value = 0;
|
||||
viewdelta_position_left.value = 0;
|
||||
viewdelta_position_up.value = 0;
|
||||
|
||||
if (freelook && !(in_strafe.state & inb_down)) {
|
||||
cl.viewstate.angles[PITCH]
|
||||
|
@ -522,11 +566,16 @@ CL_SendCmd (void)
|
|||
void
|
||||
CL_Input_Init (void)
|
||||
{
|
||||
for (int i = 0; cl_in_axes[i]; i++) {
|
||||
IN_RegisterAxis (cl_in_axes[i]);
|
||||
}
|
||||
for (int i = 0; cl_in_buttons[i]; i++) {
|
||||
IN_RegisterButton (cl_in_buttons[i]);
|
||||
}
|
||||
cl_game_context = IMT_CreateContext ("key_game");
|
||||
IMT_SetContextCbuf (cl_game_context, cl_cbuf);
|
||||
cl_demo_context = IMT_CreateContext ("key_demo");
|
||||
IMT_SetContextCbuf (cl_demo_context, cl_cbuf);
|
||||
Cmd_AddDataCommand ("impulse", IN_Impulse, 0,
|
||||
"Call a game function or QuakeC function.");
|
||||
}
|
||||
|
|
|
@ -1146,7 +1146,6 @@ CL_SetState (cactive_t state)
|
|||
if (old_state == ca_active) {
|
||||
// leaving active state
|
||||
IN_ClearStates ();
|
||||
//Key_SetKeyDest (key_console);
|
||||
|
||||
// Auto demo recorder stops here
|
||||
if (cl_autorecord->int_val && cls.demorecording)
|
||||
|
@ -1155,7 +1154,6 @@ CL_SetState (cactive_t state)
|
|||
// entering active state
|
||||
VID_SetCaption (cls.servername->str);
|
||||
IN_ClearStates ();
|
||||
//Key_SetKeyDest (key_game);
|
||||
|
||||
// Auto demo recorder starts here
|
||||
if (cl_autorecord->int_val && !cls.demoplayback
|
||||
|
|
Loading…
Reference in a new issue