mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 09:02:08 +00:00
[input] Nuke IN_Move from orbit
gotta be sure :) On a serious note, it was always a problem in that it had client-specific code and concepts embedded in the libraries.
This commit is contained in:
parent
15dbe443b0
commit
b892ce637a
9 changed files with 10 additions and 77 deletions
|
@ -49,11 +49,6 @@ typedef struct in_buttoninfo_s {
|
||||||
|
|
||||||
#ifndef __QFCC__
|
#ifndef __QFCC__
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
vec3_t angles;
|
|
||||||
vec3_t position;
|
|
||||||
} viewdelta_t;
|
|
||||||
|
|
||||||
struct qf_fd_set;
|
struct qf_fd_set;
|
||||||
|
|
||||||
typedef struct in_driver_s {
|
typedef struct in_driver_s {
|
||||||
|
@ -93,15 +88,13 @@ typedef struct in_device_s {
|
||||||
void *event_data;
|
void *event_data;
|
||||||
} in_device_t;
|
} in_device_t;
|
||||||
|
|
||||||
extern viewdelta_t viewdelta;
|
|
||||||
|
|
||||||
#define freelook (in_mlook.state & 1 || in_freelook->int_val)
|
#define freelook (in_mlook.state & 1 || in_freelook->int_val)
|
||||||
|
|
||||||
struct cvar_s;
|
struct cvar_s;
|
||||||
|
|
||||||
int IN_RegisterDriver (in_driver_t *driver, void *data);
|
int IN_RegisterDriver (in_driver_t *driver, void *data);
|
||||||
void IN_DriverData (int handlle, void *data);
|
void IN_DriverData (int handlle, void *data);
|
||||||
void IN_Init (struct cbuf_s *cbuf);
|
void IN_Init (void);
|
||||||
void IN_Init_Cvars (void);
|
void IN_Init_Cvars (void);
|
||||||
struct plitem_s;
|
struct plitem_s;
|
||||||
void IN_SaveConfig (struct plitem_s *config);
|
void IN_SaveConfig (struct plitem_s *config);
|
||||||
|
@ -128,9 +121,6 @@ void IN_UpdateGrab (struct cvar_s *);
|
||||||
|
|
||||||
void IN_ClearStates (void);
|
void IN_ClearStates (void);
|
||||||
|
|
||||||
void IN_Move (void); // FIXME: was cmduser_t?
|
|
||||||
// add additional movement on top of the keyboard move cmd
|
|
||||||
|
|
||||||
extern struct cvar_s *in_grab;
|
extern struct cvar_s *in_grab;
|
||||||
extern struct cvar_s *in_amp;
|
extern struct cvar_s *in_amp;
|
||||||
extern struct cvar_s *in_pre_amp;
|
extern struct cvar_s *in_pre_amp;
|
||||||
|
@ -139,10 +129,6 @@ extern struct cvar_s *in_mouse_accel;
|
||||||
extern struct cvar_s *in_freelook;
|
extern struct cvar_s *in_freelook;
|
||||||
extern struct cvar_s *lookstrafe;
|
extern struct cvar_s *lookstrafe;
|
||||||
|
|
||||||
extern qboolean in_mouse_avail;
|
|
||||||
extern float in_mouse_x, in_mouse_y;
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif//__QF_input_h
|
#endif//__QF_input_h
|
||||||
|
|
|
@ -47,7 +47,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "QF/cbuf.h"
|
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
#include "QF/darray.h"
|
#include "QF/darray.h"
|
||||||
#define IMPLEMENT_INPUT_Funcs
|
#define IMPLEMENT_INPUT_Funcs
|
||||||
|
@ -71,8 +70,6 @@ typedef struct {
|
||||||
static struct DARRAY_TYPE (in_regdriver_t) in_drivers = { .grow = 8 };
|
static struct DARRAY_TYPE (in_regdriver_t) in_drivers = { .grow = 8 };
|
||||||
static struct DARRAY_TYPE (in_device_t) in_devices = { .grow = 8 };
|
static struct DARRAY_TYPE (in_device_t) in_devices = { .grow = 8 };
|
||||||
|
|
||||||
VISIBLE viewdelta_t viewdelta;
|
|
||||||
|
|
||||||
cvar_t *in_grab;
|
cvar_t *in_grab;
|
||||||
VISIBLE cvar_t *in_amp;
|
VISIBLE cvar_t *in_amp;
|
||||||
VISIBLE cvar_t *in_pre_amp;
|
VISIBLE cvar_t *in_pre_amp;
|
||||||
|
@ -84,10 +81,6 @@ cvar_t *lookstrafe;
|
||||||
|
|
||||||
int64_t in_timeout = 10000;//10ms default timeout
|
int64_t in_timeout = 10000;//10ms default timeout
|
||||||
|
|
||||||
qboolean in_mouse_avail;
|
|
||||||
float in_mouse_x, in_mouse_y;
|
|
||||||
static float in_old_mouse_x, in_old_mouse_y;
|
|
||||||
|
|
||||||
int
|
int
|
||||||
IN_RegisterDriver (in_driver_t *driver, void *data)
|
IN_RegisterDriver (in_driver_t *driver, void *data)
|
||||||
{
|
{
|
||||||
|
@ -415,42 +408,6 @@ IN_LoadConfig (plitem_t *config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
IN_Move (void)
|
|
||||||
{
|
|
||||||
//JOY_Move ();
|
|
||||||
|
|
||||||
if (!in_mouse_avail)
|
|
||||||
return;
|
|
||||||
|
|
||||||
in_mouse_x *= in_mouse_pre_amp->value * in_pre_amp->value;
|
|
||||||
in_mouse_y *= in_mouse_pre_amp->value * in_pre_amp->value;
|
|
||||||
|
|
||||||
if (in_mouse_filter->int_val) {
|
|
||||||
in_mouse_x = (in_mouse_x + in_old_mouse_x) * 0.5;
|
|
||||||
in_mouse_y = (in_mouse_y + in_old_mouse_y) * 0.5;
|
|
||||||
|
|
||||||
in_old_mouse_x = in_mouse_x;
|
|
||||||
in_old_mouse_y = in_mouse_y;
|
|
||||||
}
|
|
||||||
|
|
||||||
in_mouse_x *= in_mouse_amp->value * in_amp->value;
|
|
||||||
in_mouse_y *= in_mouse_amp->value * in_amp->value;
|
|
||||||
#if 0
|
|
||||||
if ((in_strafe.state & 1) || (lookstrafe->int_val && freelook))
|
|
||||||
viewdelta.position[0] += in_mouse_x;
|
|
||||||
else
|
|
||||||
viewdelta.angles[YAW] -= in_mouse_x;
|
|
||||||
|
|
||||||
if (freelook && !(in_strafe.state & 1)) {
|
|
||||||
viewdelta.angles[PITCH] += in_mouse_y;
|
|
||||||
} else {
|
|
||||||
viewdelta.position[2] -= in_mouse_y;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
in_mouse_x = in_mouse_y = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Called at shutdown */
|
/* Called at shutdown */
|
||||||
static void
|
static void
|
||||||
IN_shutdown (void *data)
|
IN_shutdown (void *data)
|
||||||
|
@ -467,7 +424,7 @@ IN_shutdown (void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
IN_Init (cbuf_t *cbuf)
|
IN_Init (void)
|
||||||
{
|
{
|
||||||
Sys_RegisterShutdown (IN_shutdown, 0);
|
Sys_RegisterShutdown (IN_shutdown, 0);
|
||||||
IMT_Init ();
|
IMT_Init ();
|
||||||
|
@ -477,17 +434,11 @@ IN_Init (cbuf_t *cbuf)
|
||||||
in_regdriver_t *rd = &in_drivers.a[i];
|
in_regdriver_t *rd = &in_drivers.a[i];
|
||||||
rd->driver.init (rd->data);
|
rd->driver.init (rd->data);
|
||||||
}
|
}
|
||||||
//Key_Init (cbuf);
|
|
||||||
//JOY_Init ();
|
|
||||||
|
|
||||||
in_mouse_x = in_mouse_y = 0.0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
IN_Init_Cvars (void)
|
IN_Init_Cvars (void)
|
||||||
{
|
{
|
||||||
//Key_Init_Cvars ();
|
|
||||||
//JOY_Init_Cvars ();
|
|
||||||
in_grab = Cvar_Get ("in_grab", "0", CVAR_ARCHIVE, IN_UpdateGrab,
|
in_grab = Cvar_Get ("in_grab", "0", CVAR_ARCHIVE, IN_UpdateGrab,
|
||||||
"With this set to 1, quake will grab the mouse, "
|
"With this set to 1, quake will grab the mouse, "
|
||||||
"preventing loss of input focus.");
|
"preventing loss of input focus.");
|
||||||
|
@ -516,7 +467,6 @@ IN_ClearStates (void)
|
||||||
rd->driver.clear_states (rd->data);
|
rd->driver.clear_states (rd->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Key_ClearStates ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_EVDEV
|
#ifdef HAVE_EVDEV
|
||||||
|
|
|
@ -1035,7 +1035,6 @@ static void
|
||||||
in_x11_shutdown (void *data)
|
in_x11_shutdown (void *data)
|
||||||
{
|
{
|
||||||
Sys_MaskPrintf (SYS_vid, "in_x11_shutdown\n");
|
Sys_MaskPrintf (SYS_vid, "in_x11_shutdown\n");
|
||||||
in_mouse_avail = 0;
|
|
||||||
if (x_disp) {
|
if (x_disp) {
|
||||||
// XAutoRepeatOn (x_disp);
|
// XAutoRepeatOn (x_disp);
|
||||||
dga_off ();
|
dga_off ();
|
||||||
|
@ -1129,8 +1128,6 @@ in_x11_init (void *data)
|
||||||
X11_AddEvent (MotionNotify, &event_motion);
|
X11_AddEvent (MotionNotify, &event_motion);
|
||||||
|
|
||||||
x11_add_device (&x11_mouse_device);
|
x11_add_device (&x11_mouse_device);
|
||||||
|
|
||||||
in_mouse_avail = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Cmd_AddCommand ("in_paste_buffer", in_paste_buffer_f,
|
Cmd_AddCommand ("in_paste_buffer", in_paste_buffer_f,
|
||||||
|
|
|
@ -211,8 +211,8 @@ Chase_Update (void)
|
||||||
// mouse and joystick controllers add to movement
|
// mouse and joystick controllers add to movement
|
||||||
VectorSet (0, cl.viewstate.angles[1] - camera_angles[1], 0, dir);
|
VectorSet (0, cl.viewstate.angles[1] - camera_angles[1], 0, dir);
|
||||||
AngleVectors (&dir[0], &forward[0], &right[0], &up[0]); //FIXME
|
AngleVectors (&dir[0], &forward[0], &right[0], &up[0]); //FIXME
|
||||||
forward *= viewdelta.position[2] * m_forward->value;
|
//forward *= viewdelta.position[2] * m_forward->value; FIXME
|
||||||
right *= viewdelta.position[0] * m_side->value;
|
//right *= viewdelta.position[0] * m_side->value; FIXME
|
||||||
dir = forward + right;
|
dir = forward + right;
|
||||||
cmd.forwardmove += dir[0];
|
cmd.forwardmove += dir[0];
|
||||||
cmd.sidemove -= dir[1];
|
cmd.sidemove -= dir[1];
|
||||||
|
|
|
@ -585,7 +585,7 @@ CL_Init (cbuf_t *cbuf)
|
||||||
|
|
||||||
W_LoadWadFile ("gfx.wad");
|
W_LoadWadFile ("gfx.wad");
|
||||||
VID_Init (basepal, colormap);
|
VID_Init (basepal, colormap);
|
||||||
IN_Init (cbuf);
|
IN_Init ();
|
||||||
R_Init ();
|
R_Init ();
|
||||||
r_data->lightstyle = cl.lightstyle;
|
r_data->lightstyle = cl.lightstyle;
|
||||||
|
|
||||||
|
|
|
@ -211,8 +211,8 @@ Chase_Update (void)
|
||||||
// mouse and joystick controllers add to movement
|
// mouse and joystick controllers add to movement
|
||||||
VectorSet (0, cl.viewstate.angles[1] - camera_angles[1], 0, dir);
|
VectorSet (0, cl.viewstate.angles[1] - camera_angles[1], 0, dir);
|
||||||
AngleVectors (&dir[0], &forward[0], &right[0], &up[0]); //FIXME
|
AngleVectors (&dir[0], &forward[0], &right[0], &up[0]); //FIXME
|
||||||
forward *= viewdelta.position[2] * m_forward->value;
|
//forward *= viewdelta.position[2] * m_forward->value; FIXME
|
||||||
right *= viewdelta.position[0] * m_side->value;
|
//right *= viewdelta.position[0] * m_side->value; FIXME
|
||||||
dir = forward + right;
|
dir = forward + right;
|
||||||
cmd.forwardmove += dir[0];
|
cmd.forwardmove += dir[0];
|
||||||
cmd.sidemove -= dir[1];
|
cmd.sidemove -= dir[1];
|
||||||
|
|
|
@ -1183,7 +1183,7 @@ CL_Init (void)
|
||||||
|
|
||||||
W_LoadWadFile ("gfx.wad");
|
W_LoadWadFile ("gfx.wad");
|
||||||
VID_Init (basepal, colormap);
|
VID_Init (basepal, colormap);
|
||||||
IN_Init (cl_cbuf);
|
IN_Init ();
|
||||||
Mod_Init ();
|
Mod_Init ();
|
||||||
R_Init ();
|
R_Init ();
|
||||||
r_data->lightstyle = cl.lightstyle;
|
r_data->lightstyle = cl.lightstyle;
|
||||||
|
|
|
@ -191,7 +191,7 @@ BI_Init (progs_t *pr)
|
||||||
|
|
||||||
W_LoadWadFile ("gfx.wad");
|
W_LoadWadFile ("gfx.wad");
|
||||||
VID_Init (basepal, colormap);
|
VID_Init (basepal, colormap);
|
||||||
IN_Init (qwaq_cbuf);
|
IN_Init ();
|
||||||
Mod_Init ();
|
Mod_Init ();
|
||||||
R_Init ();
|
R_Init ();
|
||||||
R_Progs_Init (pr);
|
R_Progs_Init (pr);
|
||||||
|
|
|
@ -89,7 +89,7 @@ qwaq_init_threads (qwaq_thread_set_t *thread_data)
|
||||||
Sys_SetStdPrintf (qwaq_print);
|
Sys_SetStdPrintf (qwaq_print);
|
||||||
|
|
||||||
IN_Init_Cvars ();
|
IN_Init_Cvars ();
|
||||||
IN_Init (qwaq_cbuf);
|
IN_Init ();
|
||||||
|
|
||||||
for (size_t i = 1, thread_ind = 0; i < thread_data->size; i++) {
|
for (size_t i = 1, thread_ind = 0; i < thread_data->size; i++) {
|
||||||
qwaq_thread_t *thread = thread_data->a[i];
|
qwaq_thread_t *thread = thread_data->a[i];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue