mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-25 21:31:37 +00:00
Unified input subsystems. Should now all act the same.
_windowed_mouse 0 on windows is basically identical to mono-touch on android, at least the touchless emulator. :) This needs testing on other platforms. Committing so I can easily get my source onto loonix. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4126 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
586cedea8b
commit
cac1e0fb57
26 changed files with 16348 additions and 17015 deletions
|
@ -409,6 +409,7 @@ CLIENT_OBJS = \
|
|||
cl_ents.o \
|
||||
clq2_ents.o \
|
||||
cl_input.o \
|
||||
in_generic.o \
|
||||
cl_main.o \
|
||||
cl_parse.o \
|
||||
cl_pred.o \
|
||||
|
@ -671,7 +672,7 @@ ifeq ($(FTE_TARGET),nacl)
|
|||
BASELDFLAGS = -lm -lppapi_gles2 -lnosys -lppapi
|
||||
IMAGELDFLAGS =
|
||||
|
||||
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) sys_ppapi.o cd_null.o gl_vidppapi.o in_generic.o fs_ppapi.o snd_ppapi.o
|
||||
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) sys_ppapi.o cd_null.o gl_vidppapi.o fs_ppapi.o snd_ppapi.o
|
||||
|
||||
GLB_DIR=gl_nacl_x86_$(BITS)
|
||||
GL_EXE_NAME=../fteqw_x86_$(BITS).nexe
|
||||
|
@ -994,12 +995,12 @@ ifeq ($(FTE_TARGET),droid)
|
|||
|
||||
SV_DIR=sv_droid-$(DROID_ARCH)
|
||||
SV_LDFLAGS=-lz
|
||||
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(BOTLIB_OBJS) svmodel.o sys_droid.o in_droid.o
|
||||
SV_OBJS=$(COMMON_OBJS) $(SERVER_OBJS) $(PROGS_OBJS) $(BOTLIB_OBJS) svmodel.o sys_droid.o
|
||||
SV_EXE_NAME=libftedroid.so
|
||||
|
||||
SV_LDFLAGS=
|
||||
|
||||
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) gl_viddroid.o sys_droid.o in_droid.o cd_null.o snd_droid.o
|
||||
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(BOTLIB_OBJS) gl_viddroid.o sys_droid.o cd_null.o snd_droid.o
|
||||
GL_LDFLAGS=$(GLLDFLAGS)
|
||||
GLB_DIR=gl_droid-$(DROID_ARCH)
|
||||
GL_EXE_NAME=libftedroid.so
|
||||
|
|
|
@ -317,6 +317,19 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#define OS_STRING "cygwin"
|
||||
#define ID_INLINE inline
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#define ARCH_STRING "x86"
|
||||
|
||||
#define Q3_BIG_ENDIAN
|
||||
|
||||
#define DLL_EXT ".dll"
|
||||
|
||||
#endif
|
||||
|
||||
//================================================================== Q3VM ===
|
||||
|
||||
#ifdef Q3_VM
|
||||
|
|
|
@ -1568,9 +1568,6 @@ void Con_DrawConsole (int lines, qboolean noback)
|
|||
}
|
||||
|
||||
Font_EndString(font_conchar);
|
||||
|
||||
// draw the input prompt, user text, and cursor if desired
|
||||
SCR_DrawCursor(0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,330 +0,0 @@
|
|||
#include "quakedef.h"
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
extern qboolean mouse_active;
|
||||
|
||||
cvar_t m_filter = CVARF("m_filter", "0", CVAR_ARCHIVE);
|
||||
cvar_t m_strafeonleft = CVARFD("m_strafeonleft", "1", CVAR_ARCHIVE, "If 1, touching the right half of the touchscreen will strafe/move, while the left side will turn.");
|
||||
cvar_t m_fatpressthreshold = CVARFD("m_fatpressthreshold", "0.5", CVAR_ARCHIVE, "How fat your thumb has to be to register a fat press.");
|
||||
cvar_t m_slidethreshold = CVARFD("m_slidethreshold", "5", CVAR_ARCHIVE, "How far your finger needs to move to be considered a slide event.");
|
||||
|
||||
extern cvar_t _windowed_mouse;
|
||||
|
||||
int mousecursor_x, mousecursor_y; /*absolute position*/
|
||||
extern int mousemove_x, mousemove_y;
|
||||
static float mouse_x, mouse_y;
|
||||
static float mousestrafe_x, mousestrafe_y;
|
||||
static float old_mouse_x, old_mouse_y; /*for smoothing*/
|
||||
|
||||
|
||||
#define EVENTQUEUELENGTH 128
|
||||
struct eventlist_s
|
||||
{
|
||||
enum
|
||||
{
|
||||
IEV_KEYDOWN,
|
||||
IEV_KEYRELEASE,
|
||||
IEV_MOUSEABS
|
||||
} type;
|
||||
int devid;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
float x, y;
|
||||
float tsize; //the size of the touch
|
||||
} mouse;
|
||||
struct
|
||||
{
|
||||
int scancode, unicode;
|
||||
} keyboard;
|
||||
};
|
||||
} eventlist[EVENTQUEUELENGTH];
|
||||
volatile int events_avail; /*volatile to make sure the cc doesn't try leaving these cached in a register*/
|
||||
volatile int events_used;
|
||||
|
||||
static struct eventlist_s *in_newevent(void)
|
||||
{
|
||||
if (events_avail >= events_used + EVENTQUEUELENGTH)
|
||||
return NULL;
|
||||
return &eventlist[events_avail & (EVENTQUEUELENGTH-1)];
|
||||
}
|
||||
|
||||
static void in_finishevent(void)
|
||||
{
|
||||
events_avail++;
|
||||
}
|
||||
|
||||
#define MAXPOINTERS 8
|
||||
struct
|
||||
{
|
||||
vec2_t oldpos;
|
||||
vec2_t downpos;
|
||||
float movedist;
|
||||
vec2_t move;
|
||||
int down;
|
||||
} ptr[MAXPOINTERS];
|
||||
|
||||
|
||||
|
||||
void IN_Shutdown(void)
|
||||
{
|
||||
}
|
||||
|
||||
void IN_ReInit()
|
||||
{
|
||||
}
|
||||
|
||||
void IN_Init(void)
|
||||
{
|
||||
Cvar_Register (&m_filter, "input controls");
|
||||
Cvar_Register (&m_strafeonleft, "input controls");
|
||||
Cvar_Register (&m_fatpressthreshold, "input controls");
|
||||
Cvar_Register (&m_slidethreshold, "input controls");
|
||||
}
|
||||
|
||||
/*on android, each 'pointer' is a separate touch location*/
|
||||
void IN_Commands(void)
|
||||
{
|
||||
struct eventlist_s *ev;
|
||||
while (events_used != events_avail)
|
||||
{
|
||||
ev = &eventlist[events_used & (EVENTQUEUELENGTH-1)];
|
||||
switch(ev->type)
|
||||
{
|
||||
case IEV_KEYDOWN:
|
||||
case IEV_KEYRELEASE:
|
||||
if (ev->keyboard.scancode == K_MOUSE1 && ev->devid < MAXPOINTERS)
|
||||
{
|
||||
if (Key_MouseShouldBeFree())
|
||||
ptr[ev->devid].down = 0;
|
||||
else
|
||||
{
|
||||
if (ev->type == IEV_KEYDOWN)
|
||||
{
|
||||
ptr[ev->devid].down = 1;
|
||||
ptr[ev->devid].movedist = 0;
|
||||
ptr[ev->devid].downpos[0] = ptr[ev->devid].oldpos[0];
|
||||
ptr[ev->devid].downpos[1] = ptr[ev->devid].oldpos[1];
|
||||
ptr[ev->devid].move[0] = 0;
|
||||
ptr[ev->devid].move[1] = 0;
|
||||
|
||||
if (ev->mouse.tsize > m_fatpressthreshold.value)
|
||||
{
|
||||
int key = (m_strafeonleft.ival && ptr[ev->devid].downpos[0] > vid.pixelwidth/2)?K_MOUSE2:K_MOUSE1;
|
||||
Key_Event(ev->devid, key, 0, true);
|
||||
ptr[ev->devid].down = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptr[ev->devid].down > 1)
|
||||
{
|
||||
int key = (m_strafeonleft.ival && ptr[ev->devid].downpos[0] > vid.pixelwidth/2)?K_MOUSE2:K_MOUSE1;
|
||||
Key_Event(ev->devid, key, 0, false);
|
||||
ptr[ev->devid].down = 1;
|
||||
}
|
||||
if (ptr[ev->devid].down)
|
||||
{
|
||||
if (ptr[ev->devid].movedist < m_slidethreshold.value)
|
||||
{
|
||||
/*if its on the right, make it a mouse2*/
|
||||
int key = (m_strafeonleft.ival && ptr[ev->devid].downpos[0] > vid.pixelwidth/2)?K_MOUSE2:K_MOUSE1;
|
||||
Key_Event(ev->devid, key, 0, true);
|
||||
Key_Event(ev->devid, key, 0, false);
|
||||
}
|
||||
}
|
||||
ptr[ev->devid].down = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
Key_Event(ev->devid, ev->keyboard.scancode, ev->keyboard.unicode, ev->type == IEV_KEYDOWN);
|
||||
break;
|
||||
case IEV_MOUSEABS:
|
||||
/*mouse cursors only really work with one pointer*/
|
||||
if (ev->devid == 0)
|
||||
{
|
||||
float fl;
|
||||
fl = ev->mouse.x * vid.width / vid.pixelwidth;
|
||||
mousecursor_x = bound(0, fl, vid.width-1);
|
||||
fl = ev->mouse.y * vid.height / vid.pixelheight;
|
||||
mousecursor_y = bound(0, fl, vid.height-1);
|
||||
}
|
||||
|
||||
if (ev->devid < MAXPOINTERS)
|
||||
{
|
||||
ptr[ev->devid].move[0] += ev->mouse.x - ptr[ev->devid].oldpos[0];
|
||||
ptr[ev->devid].move[1] += ev->mouse.y - ptr[ev->devid].oldpos[1];
|
||||
|
||||
ptr[ev->devid].movedist += fabs(ev->mouse.x - ptr[ev->devid].oldpos[0]) + fabs(ev->mouse.y - ptr[ev->devid].oldpos[1]);
|
||||
|
||||
ptr[ev->devid].oldpos[0] = ev->mouse.x;
|
||||
ptr[ev->devid].oldpos[1] = ev->mouse.y;
|
||||
|
||||
|
||||
if (ptr[ev->devid].down > 1 && ev->mouse.tsize < m_fatpressthreshold.value)
|
||||
{
|
||||
int key = (m_strafeonleft.ival && ptr[ev->devid].downpos[0] > vid.pixelwidth/2)?K_MOUSE2:K_MOUSE1;
|
||||
Key_Event(ev->devid, key, 0, false);
|
||||
ptr[ev->devid].down = 1;
|
||||
}
|
||||
if (ptr[ev->devid].down == 1 && ev->mouse.tsize > m_fatpressthreshold.value)
|
||||
{
|
||||
int key = (m_strafeonleft.ival && ptr[ev->devid].downpos[0] > vid.pixelwidth/2)?K_MOUSE2:K_MOUSE1;
|
||||
Key_Event(ev->devid, key, 0, true);
|
||||
ptr[ev->devid].down = 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
events_used++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void IN_Update(qboolean ingame)
|
||||
{
|
||||
int i;
|
||||
//strafing speed is absolute
|
||||
mousestrafe_x = 0;
|
||||
mousestrafe_y = 0;
|
||||
|
||||
for (i = 0; i < MAXPOINTERS; i++)
|
||||
{
|
||||
/*ignore if no action, to avoid phantom csqc input events*/
|
||||
if (!ptr[i].down && !ptr[i].move[0] && !ptr[i].move[1])
|
||||
continue;
|
||||
|
||||
if (!CSQC_MousePosition(ptr[i].oldpos[0], ptr[i].oldpos[1], i))
|
||||
{
|
||||
if (!CSQC_MouseMove(ptr[i].move[0], ptr[i].move[1], i))
|
||||
{
|
||||
if (ptr[i].down && m_strafeonleft.ival && ptr[i].downpos[0] > vid.pixelwidth/2 && ingame)
|
||||
{
|
||||
mousestrafe_x += ptr[i].oldpos[0] - ptr[i].downpos[0];
|
||||
mousestrafe_y += ptr[i].oldpos[1] - ptr[i].downpos[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse_x += ptr[i].move[0];
|
||||
mouse_y += ptr[i].move[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
ptr[i].move[0] = 0;
|
||||
ptr[i].move[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void IN_Move (float *movements, int pnum)
|
||||
{
|
||||
qboolean ingame;
|
||||
extern int mousecursor_x, mousecursor_y;
|
||||
|
||||
if (pnum != 0)
|
||||
return; //we're lazy today.
|
||||
|
||||
ingame = movements != NULL && (key_dest == key_game);
|
||||
|
||||
IN_Update(ingame);
|
||||
|
||||
if (m_filter.value)
|
||||
{
|
||||
mouse_x = (mouse_x + old_mouse_x) * 0.5;
|
||||
mouse_y = (mouse_y + old_mouse_y) * 0.5;
|
||||
}
|
||||
old_mouse_x = mouse_x;
|
||||
old_mouse_y = mouse_y;
|
||||
|
||||
if(in_xflip.value) mouse_x *= -1;
|
||||
|
||||
mousemove_x += mouse_x;
|
||||
mousemove_y += mouse_y;
|
||||
|
||||
if (!ingame)
|
||||
{
|
||||
mouse_x = mouse_y = 0;
|
||||
#ifdef VM_UI
|
||||
UI_MousePosition(mousecursor_x, mousecursor_y);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*if the look-mouse is set to always strafe instead...*/
|
||||
if ( (in_strafe.state[pnum] & 1) || (lookstrafe.value && (in_mlook.state[pnum] & 1) ))
|
||||
{
|
||||
mousestrafe_x += mouse_x;
|
||||
mouse_x = 0;
|
||||
}
|
||||
if ( (in_strafe.state[pnum] & 1) || !(in_mlook.state[pnum] & 1))
|
||||
{
|
||||
mousestrafe_y += mouse_y;
|
||||
mouse_y = 0;
|
||||
}
|
||||
|
||||
/*handle strafes*/
|
||||
if (movements)
|
||||
{
|
||||
float scale;
|
||||
|
||||
scale = m_side.value * sensitivity.value;
|
||||
movements[1] += mousestrafe_x * scale;
|
||||
|
||||
scale = m_forward.value * sensitivity.value;
|
||||
if ((in_strafe.state[pnum] & 1) && noclip_anglehack)
|
||||
movements[2] -= mousestrafe_y * scale;
|
||||
else
|
||||
movements[0] -= mousestrafe_y * scale;
|
||||
}
|
||||
|
||||
if (in_mlook.state[pnum] & 1)
|
||||
V_StopPitchDrift (pnum);
|
||||
|
||||
/*handle looks*/
|
||||
cl.playerview[pnum].viewanglechange[YAW] -= m_yaw.value * mouse_x * sensitivity.value;
|
||||
cl.playerview[pnum].viewanglechange[PITCH] += m_pitch.value * mouse_y * sensitivity.value;
|
||||
|
||||
mouse_x = mouse_y = 0.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_fteqw_FTEDroidEngine_keypress(JNIEnv *env, jobject obj,
|
||||
jint down, jint keycode, jint unicode)
|
||||
{
|
||||
struct eventlist_s *ev = in_newevent();
|
||||
if (!ev)
|
||||
return;
|
||||
ev->type = down?IEV_KEYDOWN:IEV_KEYRELEASE;
|
||||
ev->devid = 0;
|
||||
ev->keyboard.scancode = keycode;
|
||||
ev->keyboard.unicode = unicode;
|
||||
in_finishevent();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_fteqw_FTEDroidEngine_motion(JNIEnv *env, jobject obj,
|
||||
jint act, jint ptrid, jfloat x, jfloat y, jfloat size)
|
||||
{
|
||||
struct eventlist_s *ev = in_newevent();
|
||||
if (!ev)
|
||||
return;
|
||||
ev->devid = ptrid;
|
||||
if (act)
|
||||
{
|
||||
ev->type = (act==1)?IEV_KEYDOWN:IEV_KEYRELEASE;
|
||||
ev->keyboard.scancode = K_MOUSE1;
|
||||
ev->keyboard.unicode = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ev->type = IEV_MOUSEABS;
|
||||
ev->mouse.x = x;
|
||||
ev->mouse.y = y;
|
||||
ev->mouse.tsize = size;
|
||||
}
|
||||
in_finishevent();
|
||||
}
|
|
@ -1,19 +1,25 @@
|
|||
//Generic input code.
|
||||
//mostly mouse support, but can also handle a few keyboard events.
|
||||
|
||||
#include "quakedef.h"
|
||||
extern qboolean mouse_active;
|
||||
|
||||
cvar_t m_simtouch = CVARF("m_simtouch", "0", CVAR_ARCHIVE);
|
||||
cvar_t m_filter = CVARF("m_filter", "0", CVAR_ARCHIVE);
|
||||
cvar_t m_strafeonright = CVARFD("m_strafeonright", "1", CVAR_ARCHIVE, "If 1, touching the right half of the touchscreen will strafe/move, while the left side will turn.");
|
||||
|
||||
extern cvar_t _windowed_mouse;
|
||||
|
||||
int mousecursor_x, mousecursor_y; /*absolute position*/
|
||||
extern int mousemove_x, mousemove_y;
|
||||
static float mouse_x, mouse_y;
|
||||
static float mousestrafe_x, mousestrafe_y;
|
||||
static float old_mouse_x, old_mouse_y; /*for smoothing*/
|
||||
|
||||
|
||||
extern qboolean mouse_active;
|
||||
|
||||
static cvar_t m_filter = CVARF("m_filter", "0", CVAR_ARCHIVE);
|
||||
static cvar_t m_accel = CVARF("m_accel", "0", CVAR_ARCHIVE);
|
||||
static cvar_t m_forcewheel = CVARD("m_forcewheel", "1", "0: ignore mousewheels in apis where it is abiguous.\n1: Use mousewheel when it is treated as a third axis. Motion above a threshold is ignored, to avoid issues with an unknown threshold.\n2: Like 1, but excess motion is retained. The threshold specifies exact z-axis distance per notice.");
|
||||
static cvar_t m_forcewheel_threshold = CVARD("m_forcewheel_threshold", "32", "Mousewheel graduations smaller than this will not trigger mousewheel deltas.");
|
||||
static cvar_t m_strafeonright = CVARFD("m_strafeonright", "1", CVAR_ARCHIVE, "If 1, touching the right half of the touchscreen will strafe/move, while the left side will turn.");
|
||||
static cvar_t m_fatpressthreshold = CVARFD("m_fatpressthreshold", "0.5", CVAR_ARCHIVE, "How fat your thumb has to be to register a fat press (touchscreens).");
|
||||
static cvar_t m_slidethreshold = CVARFD("m_slidethreshold", "5", CVAR_ARCHIVE, "How far your finger needs to move to be considered a slide event (touchscreens).");
|
||||
|
||||
extern cvar_t cl_forcesplitclient; //all devices claim to be a single player
|
||||
extern cvar_t _windowed_mouse;
|
||||
|
||||
int mousecursor_x, mousecursor_y; /*absolute position*/
|
||||
extern int mousemove_x, mousemove_y;
|
||||
|
||||
|
||||
#define EVENTQUEUELENGTH 128
|
||||
struct eventlist_s
|
||||
{
|
||||
|
@ -30,7 +36,8 @@ struct eventlist_s
|
|||
{
|
||||
struct
|
||||
{
|
||||
float x, y;
|
||||
float x, y, z;
|
||||
float tsize; //the size of the touch
|
||||
} mouse;
|
||||
struct
|
||||
{
|
||||
|
@ -47,12 +54,6 @@ static struct eventlist_s *in_newevent(void)
|
|||
return NULL;
|
||||
return &eventlist[events_avail & (EVENTQUEUELENGTH-1)];
|
||||
}
|
||||
static struct eventlist_s *in_lastevent(void)
|
||||
{
|
||||
if (events_avail == events_used)
|
||||
return NULL;
|
||||
return &eventlist[(events_avail-1) & (EVENTQUEUELENGTH-1)];
|
||||
}
|
||||
|
||||
static void in_finishevent(void)
|
||||
{
|
||||
|
@ -60,43 +61,68 @@ static void in_finishevent(void)
|
|||
}
|
||||
|
||||
#define MAXPOINTERS 8
|
||||
struct
|
||||
struct mouse_s
|
||||
{
|
||||
vec2_t oldpos;
|
||||
vec2_t downpos;
|
||||
float movedist;
|
||||
vec2_t move;
|
||||
enum
|
||||
{
|
||||
MT_UNPRESSED,
|
||||
MT_PRESSED,
|
||||
MT_DELTA
|
||||
} mtype;
|
||||
} ptr[MAXPOINTERS];
|
||||
|
||||
|
||||
|
||||
void IN_Shutdown(void)
|
||||
{
|
||||
}
|
||||
|
||||
void IN_ReInit()
|
||||
{
|
||||
}
|
||||
|
||||
void IN_Init(void)
|
||||
{
|
||||
Cvar_Register (&m_simtouch, "input controls");
|
||||
Cvar_Register (&m_filter, "input controls");
|
||||
Cvar_Register (&m_strafeonright, "input controls");
|
||||
|
||||
IN_ReInit();
|
||||
}
|
||||
|
||||
/*on android, each 'pointer' is a separate touch location*/
|
||||
void IN_Commands(void)
|
||||
{
|
||||
M_INVALID,
|
||||
M_MOUSE, //using deltas
|
||||
M_TOUCH //using absolutes
|
||||
} type;
|
||||
int qdeviceid;
|
||||
vec2_t oldpos;
|
||||
vec2_t downpos;
|
||||
float moveddist; //how far it has moved while held. this provides us with our emulated mouse1 when they release the press
|
||||
vec2_t delta; //how far its moved recently
|
||||
vec2_t old_delta; //how far its moved previously, for mouse smoothing
|
||||
float wheeldelta;
|
||||
int down;
|
||||
} ptr[MAXPOINTERS];
|
||||
|
||||
|
||||
|
||||
void IN_Shutdown(void)
|
||||
{
|
||||
INS_Shutdown();
|
||||
}
|
||||
|
||||
void IN_ReInit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
events_avail = 0;
|
||||
events_used = 0;
|
||||
|
||||
for (i = 0; i < MAXPOINTERS; i++)
|
||||
{
|
||||
ptr[i].type = M_INVALID;
|
||||
ptr[i].qdeviceid = i;
|
||||
}
|
||||
|
||||
INS_ReInit();
|
||||
}
|
||||
|
||||
void IN_Init(void)
|
||||
{
|
||||
Cvar_Register (&m_filter, "input controls");
|
||||
Cvar_Register (&m_accel, "input controls");
|
||||
Cvar_Register (&m_forcewheel, "Input Controls");
|
||||
Cvar_Register (&m_forcewheel_threshold, "Input Controls");
|
||||
Cvar_Register (&m_strafeonright, "input controls");
|
||||
Cvar_Register (&m_fatpressthreshold, "input controls");
|
||||
Cvar_Register (&m_slidethreshold, "input controls");
|
||||
|
||||
INS_Init();
|
||||
}
|
||||
|
||||
/*a 'pointer' is either a multitouch pointer, or a separate device
|
||||
note that mice use the keyboard button api, but separate devices*/
|
||||
void IN_Commands(void)
|
||||
{
|
||||
struct eventlist_s *ev;
|
||||
|
||||
INS_Commands();
|
||||
|
||||
while (events_used != events_avail)
|
||||
{
|
||||
ev = &eventlist[events_used & (EVENTQUEUELENGTH-1)];
|
||||
|
@ -104,213 +130,339 @@ void IN_Commands(void)
|
|||
{
|
||||
case IEV_KEYDOWN:
|
||||
case IEV_KEYRELEASE:
|
||||
if (ev->keyboard.scancode == K_MOUSE1 && ev->devid < MAXPOINTERS && ptr[ev->devid].mtype != MT_DELTA)
|
||||
//on touchscreens, mouse1 is used as up/down state. we have to emulate actual mouse clicks based upon distance moved, so we can get movement events.
|
||||
if (ev->keyboard.scancode == K_MOUSE1 && ev->devid < MAXPOINTERS && (ptr[ev->devid].type == M_TOUCH))
|
||||
{
|
||||
if (Key_MouseShouldBeFree())
|
||||
ptr[ev->devid].mtype = MT_UNPRESSED;
|
||||
ptr[ev->devid].down = 0;
|
||||
else
|
||||
{
|
||||
if (ev->type == IEV_KEYDOWN)
|
||||
{
|
||||
ptr[ev->devid].mtype = MT_PRESSED;
|
||||
ptr[ev->devid].movedist = 0;
|
||||
ptr[ev->devid].down = 1;
|
||||
ptr[ev->devid].moveddist = 0;
|
||||
ptr[ev->devid].downpos[0] = ptr[ev->devid].oldpos[0];
|
||||
ptr[ev->devid].downpos[1] = ptr[ev->devid].oldpos[1];
|
||||
ptr[ev->devid].move[0] = 0;
|
||||
ptr[ev->devid].move[1] = 0;
|
||||
ptr[ev->devid].delta[0] = 0;
|
||||
ptr[ev->devid].delta[1] = 0;
|
||||
|
||||
if (ev->mouse.tsize > m_fatpressthreshold.value)
|
||||
{
|
||||
int key = (m_strafeonright.ival && ptr[ev->devid].downpos[0] > vid.pixelwidth/2)?K_MOUSE2:K_MOUSE1;
|
||||
Key_Event(ev->devid, key, 0, true);
|
||||
ptr[ev->devid].down = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ptr[ev->devid].mtype == MT_PRESSED)
|
||||
if (ptr[ev->devid].down > 1)
|
||||
{
|
||||
if (ptr[ev->devid].movedist < 5)
|
||||
int key = (m_strafeonright.ival && ptr[ev->devid].downpos[0] > vid.pixelwidth/2)?K_MOUSE2:K_MOUSE1;
|
||||
Key_Event(ev->devid, key, 0, false);
|
||||
ptr[ev->devid].down = 1;
|
||||
}
|
||||
if (ptr[ev->devid].down)
|
||||
{
|
||||
if (ptr[ev->devid].moveddist < m_slidethreshold.value)
|
||||
{
|
||||
/*if its on the right, make it a mouse2*/
|
||||
int key = (m_strafeonright.ival && ptr[ev->devid].downpos[0] > vid.pixelwidth/2)?K_MOUSE3:K_MOUSE1;
|
||||
int key = (m_strafeonright.ival && ptr[ev->devid].downpos[0] > vid.pixelwidth/2)?K_MOUSE2:K_MOUSE1;
|
||||
Key_Event(ev->devid, key, 0, true);
|
||||
Key_Event(ev->devid, key, 0, false);
|
||||
}
|
||||
}
|
||||
ptr[ev->devid].mtype = MT_UNPRESSED;
|
||||
ptr[ev->devid].down = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
Key_Event(ev->devid, ev->keyboard.scancode, ev->keyboard.unicode, ev->type == IEV_KEYDOWN);
|
||||
break;
|
||||
case IEV_MOUSEDELTA:
|
||||
if (ev->devid < MAXPOINTERS)
|
||||
{
|
||||
if (ptr[ev->devid].type != M_MOUSE)
|
||||
{
|
||||
ptr[ev->devid].type = M_MOUSE;
|
||||
}
|
||||
ptr[ev->devid].delta[0] += ev->mouse.x;
|
||||
ptr[ev->devid].delta[1] += ev->mouse.y;
|
||||
|
||||
if (m_forcewheel.value >= 2)
|
||||
ptr[ev->devid].wheeldelta -= ev->mouse.z;
|
||||
else if (m_forcewheel.value)
|
||||
{
|
||||
int mfwt = (int)m_forcewheel_threshold.value;
|
||||
|
||||
if (ev->mouse.z > mfwt)
|
||||
ptr[ev->devid].wheeldelta -= mfwt;
|
||||
else if (ev->mouse.z < -mfwt)
|
||||
ptr[ev->devid].wheeldelta += mfwt;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IEV_MOUSEABS:
|
||||
/*mouse cursors only really work with one pointer*/
|
||||
if (ev->devid == 0)
|
||||
{
|
||||
mousecursor_x = bound(0, ev->mouse.x, vid.width - 1);
|
||||
mousecursor_y = bound(0, ev->mouse.y, vid.height - 1);
|
||||
float fl;
|
||||
fl = ev->mouse.x * vid.width / vid.pixelwidth;
|
||||
mousecursor_x = bound(0, fl, vid.width-1);
|
||||
fl = ev->mouse.y * vid.height / vid.pixelheight;
|
||||
mousecursor_y = bound(0, fl, vid.height-1);
|
||||
}
|
||||
|
||||
if (ev->devid < MAXPOINTERS)
|
||||
{
|
||||
if (ptr[ev->devid%MAXPOINTERS].mtype == MT_DELTA)
|
||||
ptr[ev->devid%MAXPOINTERS].mtype = MT_UNPRESSED;
|
||||
ptr[ev->devid].move[0] += ev->mouse.x - ptr[ev->devid].oldpos[0];
|
||||
ptr[ev->devid].move[1] += ev->mouse.y - ptr[ev->devid].oldpos[1];
|
||||
|
||||
ptr[ev->devid].movedist += fabs(ev->mouse.x - ptr[ev->devid].oldpos[0]) + fabs(ev->mouse.y - ptr[ev->devid].oldpos[1]);
|
||||
if (ptr[ev->devid].type != M_TOUCH)
|
||||
{
|
||||
//if its now become an absolute device, clear stuff so we don't get confused.
|
||||
ptr[ev->devid].type = M_TOUCH;
|
||||
ptr[ev->devid].down = 0;
|
||||
ptr[ev->devid].moveddist = 0;
|
||||
ptr[ev->devid].oldpos[0] = ev->mouse.x;
|
||||
ptr[ev->devid].oldpos[1] = ev->mouse.y;
|
||||
}
|
||||
|
||||
if (ptr[ev->devid].down)
|
||||
{
|
||||
ptr[ev->devid].delta[0] += ev->mouse.x - ptr[ev->devid].oldpos[0];
|
||||
ptr[ev->devid].delta[1] += ev->mouse.y - ptr[ev->devid].oldpos[1];
|
||||
|
||||
ptr[ev->devid].moveddist += fabs(ev->mouse.x - ptr[ev->devid].oldpos[0]) + fabs(ev->mouse.y - ptr[ev->devid].oldpos[1]);
|
||||
}
|
||||
|
||||
ptr[ev->devid].oldpos[0] = ev->mouse.x;
|
||||
ptr[ev->devid].oldpos[1] = ev->mouse.y;
|
||||
|
||||
|
||||
if (ptr[ev->devid].down > 1 && ev->mouse.tsize < m_fatpressthreshold.value)
|
||||
{
|
||||
int key = (m_strafeonright.ival && ptr[ev->devid].downpos[0] > vid.pixelwidth/2)?K_MOUSE2:K_MOUSE1;
|
||||
Key_Event(ev->devid, key, 0, false);
|
||||
ptr[ev->devid].down = 1;
|
||||
}
|
||||
if (ptr[ev->devid].down == 1 && ev->mouse.tsize > m_fatpressthreshold.value)
|
||||
{
|
||||
int key = (m_strafeonright.ival && ptr[ev->devid].downpos[0] > vid.pixelwidth/2)?K_MOUSE2:K_MOUSE1;
|
||||
Key_Event(ev->devid, key, 0, true);
|
||||
ptr[ev->devid].down = 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IEV_MOUSEDELTA:
|
||||
/*unlike abs, we can combine the mice properly*/
|
||||
mousecursor_x += ev->mouse.x;
|
||||
mousecursor_y += ev->mouse.y;
|
||||
mousecursor_x = bound(0, mousecursor_x, vid.width - 1);
|
||||
mousecursor_y = bound(0, mousecursor_y, vid.height - 1);
|
||||
|
||||
ptr[ev->devid%MAXPOINTERS].move[0] += ev->mouse.x;
|
||||
ptr[ev->devid%MAXPOINTERS].move[1] += ev->mouse.y;
|
||||
|
||||
ptr[ev->devid%MAXPOINTERS].movedist += fabs(ev->mouse.x) + fabs(ev->mouse.y);
|
||||
|
||||
if (m_simtouch.ival)
|
||||
{
|
||||
if (ptr[ev->devid%MAXPOINTERS].mtype == MT_DELTA)
|
||||
ptr[ev->devid%MAXPOINTERS].mtype = MT_UNPRESSED;
|
||||
ptr[ev->devid].oldpos[0] = mousecursor_x;
|
||||
ptr[ev->devid].oldpos[1] = mousecursor_y;
|
||||
}
|
||||
else
|
||||
ptr[ev->devid%MAXPOINTERS].mtype = MT_DELTA;
|
||||
|
||||
break;
|
||||
}
|
||||
events_used++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void IN_Update(qboolean ingame)
|
||||
}
|
||||
}
|
||||
|
||||
void IN_MoveMouse(struct mouse_s *mouse, float *movements, int pnum)
|
||||
{
|
||||
int i;
|
||||
//strafing speed is absolute
|
||||
mousestrafe_x = 0;
|
||||
mousestrafe_y = 0;
|
||||
extern int mousecursor_x, mousecursor_y;
|
||||
extern int mousemove_x, mousemove_y;
|
||||
|
||||
for (i = 0; i < MAXPOINTERS; i++)
|
||||
int mx, my;
|
||||
double mouse_x, mouse_y, mouse_deltadist;
|
||||
int mfwt;
|
||||
qboolean strafe_x, strafe_y;
|
||||
int wpnum;
|
||||
|
||||
//small performance boost
|
||||
if (mouse->type == M_INVALID)
|
||||
return;
|
||||
|
||||
/*each device will be processed when its player comes to be processed*/
|
||||
wpnum = cl.splitclients;
|
||||
if (wpnum < 1)
|
||||
wpnum = 1;
|
||||
if (cl_forcesplitclient.ival)
|
||||
wpnum = (cl_forcesplitclient.ival-1) % wpnum;
|
||||
else
|
||||
wpnum = mouse->qdeviceid % wpnum;
|
||||
if (wpnum != pnum)
|
||||
return;
|
||||
|
||||
if (m_forcewheel.value)
|
||||
{
|
||||
/*ignore if no action, to avoid phantom csqc input events*/
|
||||
if (ptr[i].mtype == MT_UNPRESSED && !ptr[i].move[0] && !ptr[i].move[1])
|
||||
continue;
|
||||
|
||||
if (ptr[i].mtype == MT_DELTA || !CSQC_MousePosition(ptr[i].oldpos[0], ptr[i].oldpos[1], i))
|
||||
mfwt = m_forcewheel_threshold.ival;
|
||||
if (mfwt)
|
||||
{
|
||||
if (!CSQC_MouseMove(ptr[i].move[0], ptr[i].move[1], i))
|
||||
while(mouse->wheeldelta <= -mfwt)
|
||||
{
|
||||
switch(ptr[i].mtype)
|
||||
{
|
||||
case MT_UNPRESSED:
|
||||
break;
|
||||
case MT_PRESSED:
|
||||
if (m_strafeonright.ival && ptr[i].downpos[0] > vid.pixelwidth/2 && ingame)
|
||||
{
|
||||
mousestrafe_x += ptr[i].oldpos[0] - ptr[i].downpos[0];
|
||||
mousestrafe_y += ptr[i].oldpos[1] - ptr[i].downpos[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse_x += ptr[i].move[0];
|
||||
mouse_y += ptr[i].move[1];
|
||||
}
|
||||
break;
|
||||
case MT_DELTA:
|
||||
mouse_x += ptr[i].move[0];
|
||||
mouse_y += ptr[i].move[1];
|
||||
break;
|
||||
}
|
||||
Key_Event (mouse->qdeviceid, K_MWHEELUP, 0, true);
|
||||
Key_Event (mouse->qdeviceid, K_MWHEELUP, 0, false);
|
||||
mouse->wheeldelta += mfwt;
|
||||
}
|
||||
|
||||
while(mouse->wheeldelta >= mfwt)
|
||||
{
|
||||
Key_Event (mouse->qdeviceid, K_MWHEELDOWN, 0, true);
|
||||
Key_Event (mouse->qdeviceid, K_MWHEELDOWN, 0, false);
|
||||
mouse->wheeldelta -= mfwt;
|
||||
}
|
||||
}
|
||||
ptr[i].move[0] = 0;
|
||||
ptr[i].move[1] = 0;
|
||||
|
||||
if (m_forcewheel.value < 2)
|
||||
mouse->wheeldelta = 0;
|
||||
}
|
||||
}
|
||||
|
||||
mx = mouse->delta[0];
|
||||
mouse->delta[0]=0;
|
||||
my = mouse->delta[1];
|
||||
mouse->delta[1]=0;
|
||||
|
||||
|
||||
void IN_Move (float *movements, int pnum)
|
||||
{
|
||||
qboolean ingame;
|
||||
extern int mousecursor_x, mousecursor_y;
|
||||
if(in_xflip.value) mx *= -1;
|
||||
|
||||
if (pnum != 0)
|
||||
return; //we're lazy today.
|
||||
mousemove_x += mx;
|
||||
mousemove_y += my;
|
||||
|
||||
ingame = movements != NULL && (key_dest == key_game);
|
||||
|
||||
IN_Update(ingame);
|
||||
|
||||
if (m_filter.value)
|
||||
if (Key_MouseShouldBeFree())
|
||||
{
|
||||
mouse_x = (mouse_x + old_mouse_x) * 0.5;
|
||||
mouse_y = (mouse_y + old_mouse_y) * 0.5;
|
||||
mousecursor_x += mx;
|
||||
mousecursor_y += my;
|
||||
|
||||
if (mousecursor_y<0)
|
||||
mousecursor_y=0;
|
||||
if (mousecursor_x<0)
|
||||
mousecursor_x=0;
|
||||
|
||||
if (mousecursor_x >= vid.width)
|
||||
mousecursor_x = vid.width - 1;
|
||||
|
||||
if (mousecursor_y >= vid.height)
|
||||
mousecursor_y = vid.height - 1;
|
||||
mx=my=0;
|
||||
|
||||
#ifdef PEXT_CSQC
|
||||
CSQC_MousePosition(mousecursor_x, mousecursor_y, mouse->qdeviceid);
|
||||
#endif
|
||||
}
|
||||
old_mouse_x = mouse_x;
|
||||
old_mouse_y = mouse_y;
|
||||
|
||||
if(in_xflip.value) mouse_x *= -1;
|
||||
|
||||
mousemove_x += mouse_x;
|
||||
mousemove_y += mouse_y;
|
||||
|
||||
if (!ingame)
|
||||
else
|
||||
{
|
||||
mouse_x = mouse_y = 0;
|
||||
#ifdef VM_UI
|
||||
UI_MousePosition(mousecursor_x, mousecursor_y);
|
||||
if (UI_MousePosition(mx, my))
|
||||
{
|
||||
mx = 0;
|
||||
my = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*if the look-mouse is set to always strafe instead...*/
|
||||
if ( (in_strafe.state[pnum] & 1) || (lookstrafe.value && (in_mlook.state[pnum] & 1) ))
|
||||
if (mouse->type == M_TOUCH)
|
||||
{
|
||||
mousestrafe_x += mouse_x;
|
||||
mouse_x = 0;
|
||||
if (m_strafeonright.ival && mouse->downpos[0] > vid.pixelwidth/2 && movements != NULL && (key_dest == key_game))
|
||||
{
|
||||
//if they're strafing, calculate the speed to move at based upon their displacement
|
||||
if (mouse->down)
|
||||
{
|
||||
mx = (mouse->oldpos[0] - mouse->downpos[0])*0.1;
|
||||
my = (mouse->oldpos[1] - mouse->downpos[1])*0.1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mx = 0;
|
||||
my = 0;
|
||||
}
|
||||
strafe_x = true;
|
||||
strafe_y = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
strafe_x = false;
|
||||
strafe_y = false;
|
||||
}
|
||||
}
|
||||
if ( (in_strafe.state[pnum] & 1) || !(in_mlook.state[pnum] & 1))
|
||||
else
|
||||
{
|
||||
mousestrafe_y += mouse_y;
|
||||
mouse_y = 0;
|
||||
strafe_x = (in_strafe.state[pnum] & 1) || (lookstrafe.value && (in_mlook.state[pnum] & 1) );
|
||||
strafe_y = !((in_mlook.state[pnum] & 1) && !(in_strafe.state[pnum] & 1));
|
||||
}
|
||||
|
||||
/*handle strafes*/
|
||||
if (movements)
|
||||
#ifdef PEXT_CSQC
|
||||
if (mx || my)
|
||||
if (CSQC_MouseMove(mx, my, mouse->qdeviceid))
|
||||
{
|
||||
float scale;
|
||||
mx = 0;
|
||||
my = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
scale = m_side.value * sensitivity.value;
|
||||
movements[1] += mousestrafe_x * scale;
|
||||
if (m_filter.value)
|
||||
{
|
||||
double fraction = bound(0, m_filter.value, 2) * 0.5;
|
||||
mouse_x = (mx*(1-fraction) + mouse->old_delta[0]*fraction);
|
||||
mouse_y = (my*(1-fraction) + mouse->old_delta[1]*fraction);
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse_x = mx;
|
||||
mouse_y = my;
|
||||
}
|
||||
|
||||
scale = m_forward.value * sensitivity.value;
|
||||
if ((in_strafe.state[pnum] & 1) && noclip_anglehack)
|
||||
movements[2] -= mousestrafe_y * scale;
|
||||
else
|
||||
movements[0] -= mousestrafe_y * scale;
|
||||
mouse->old_delta[0] = mx;
|
||||
mouse->old_delta[1] = my;
|
||||
|
||||
if (m_accel.value)
|
||||
{
|
||||
mouse_deltadist = sqrt(mx*mx + my*my);
|
||||
mouse_x *= (mouse_deltadist*m_accel.value + sensitivity.value*in_sensitivityscale);
|
||||
mouse_y *= (mouse_deltadist*m_accel.value + sensitivity.value*in_sensitivityscale);
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse_x *= sensitivity.value*in_sensitivityscale;
|
||||
mouse_y *= sensitivity.value*in_sensitivityscale;
|
||||
}
|
||||
|
||||
if (cl.playerview[pnum].stats[STAT_VIEWZOOM])
|
||||
{
|
||||
mouse_x *= cl.playerview[pnum].stats[STAT_VIEWZOOM]/255.0f;
|
||||
mouse_y *= cl.playerview[pnum].stats[STAT_VIEWZOOM]/255.0f;
|
||||
}
|
||||
|
||||
if (!movements)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// add mouse X/Y movement to cmd
|
||||
if (strafe_x)
|
||||
movements[1] += m_side.value * mouse_x;
|
||||
else
|
||||
{
|
||||
// if ((int)((cl.viewangles[pnum][PITCH]+89.99)/180) & 1)
|
||||
// mouse_x *= -1;
|
||||
cl.playerview[pnum].viewanglechange[YAW] -= m_yaw.value * mouse_x;
|
||||
}
|
||||
|
||||
if (in_mlook.state[pnum] & 1)
|
||||
V_StopPitchDrift (pnum);
|
||||
|
||||
/*handle looks*/
|
||||
cl.viewanglechange[pnum][YAW] -= m_yaw.value * mouse_x * sensitivity.value;
|
||||
cl.viewanglechange[pnum][PITCH] += m_pitch.value * mouse_y * sensitivity.value;
|
||||
if (!strafe_y)
|
||||
{
|
||||
cl.playerview[pnum].viewanglechange[PITCH] += m_pitch.value * mouse_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((in_strafe.state[pnum] & 1) && noclip_anglehack)
|
||||
movements[2] -= m_forward.value * mouse_y;
|
||||
else
|
||||
movements[0] -= m_forward.value * mouse_y;
|
||||
}
|
||||
}
|
||||
|
||||
void IN_Move (float *movements, int pnum)
|
||||
{
|
||||
int i;
|
||||
INS_Move(movements, pnum);
|
||||
for (i = 0; i < MAXPOINTERS; i++)
|
||||
IN_MoveMouse(&ptr[i], movements, pnum);
|
||||
}
|
||||
|
||||
mouse_x = mouse_y = 0.0;
|
||||
}
|
||||
|
||||
|
||||
/*regular key event*/
|
||||
void IN_QueueKey(int down, int keycode, int unicode)
|
||||
void IN_KeyEvent(int devid, int down, int keycode, int unicode)
|
||||
{
|
||||
struct eventlist_s *ev = in_newevent();
|
||||
if (!ev)
|
||||
if (!ev)
|
||||
return;
|
||||
ev->type = down?IEV_KEYDOWN:IEV_KEYRELEASE;
|
||||
ev->devid = 0;
|
||||
|
@ -318,49 +470,23 @@ void IN_QueueKey(int down, int keycode, int unicode)
|
|||
ev->keyboard.unicode = unicode;
|
||||
in_finishevent();
|
||||
}
|
||||
|
||||
/*
|
||||
in ppapi, we have 'keycode' and 'char' events completely separately
|
||||
this doesn't match the rest of the system very well
|
||||
so we update the previous key event instead, where possible (IME can still trigger multiple chars at a time)
|
||||
|
||||
this is risky and may drop the key in rare situations
|
||||
devid is the mouse device id. generally idependant from keyboards.
|
||||
for multitouch, devid might be the touch identifier, which will persist until released.
|
||||
x is horizontal, y is vertical.
|
||||
z is height... generally its used as a mousewheel instead, but there are some '3d' mice out there, so its provided in this api.
|
||||
*/
|
||||
void IN_AmmendUnicode(int unicode)
|
||||
{
|
||||
struct eventlist_s *ev = in_lastevent();
|
||||
if (ev && ev->type == IEV_KEYDOWN)
|
||||
{
|
||||
if (!ev->keyboard.unicode)
|
||||
{
|
||||
ev->keyboard.unicode = unicode;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/*last command was already used? that makes things painful. maybe noone will notice*/
|
||||
IN_QueueKey(true, 0, unicode);
|
||||
IN_QueueKey(false, 0, unicode);
|
||||
}
|
||||
|
||||
void IN_QueueMouse(int act, int ptrid, float x, float y, int button)
|
||||
void IN_MouseMove(int devid, int abs, float x, float y, float z, float size)
|
||||
{
|
||||
struct eventlist_s *ev = in_newevent();
|
||||
if (!ev)
|
||||
return;
|
||||
ev->devid = ptrid;
|
||||
switch(act)
|
||||
{
|
||||
case 0:
|
||||
case 3:
|
||||
ev->type = (act==0)?IEV_MOUSEABS:IEV_MOUSEDELTA;
|
||||
ev->mouse.x = x;
|
||||
ev->mouse.y = y;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
ev->type = (act==1)?IEV_KEYDOWN:IEV_KEYRELEASE;
|
||||
ev->keyboard.scancode = K_MOUSE1+button;
|
||||
ev->keyboard.unicode = 0;
|
||||
break;
|
||||
}
|
||||
ev->devid = devid;
|
||||
ev->type = abs?IEV_MOUSEABS:IEV_MOUSEDELTA;
|
||||
ev->mouse.x = x;
|
||||
ev->mouse.y = y;
|
||||
ev->mouse.z = z;
|
||||
ev->mouse.tsize = size;
|
||||
in_finishevent();
|
||||
}
|
||||
|
|
|
@ -50,16 +50,11 @@ static struct MsgPort *inputport = 0;
|
|||
static struct IOStdReq *inputreq = 0;
|
||||
static BYTE inputret = -1;
|
||||
|
||||
cvar_t m_filter = {"m_filter", "1", CVAR_ARCHIVE};
|
||||
|
||||
extern cvar_t _windowed_mouse;
|
||||
|
||||
float mouse_x, mouse_y;
|
||||
float old_mouse_x, old_mouse_y;
|
||||
|
||||
#define DEBUGRING(x)
|
||||
|
||||
void IN_Shutdown(void)
|
||||
void INS_Shutdown(void)
|
||||
{
|
||||
if (inputret == 0)
|
||||
{
|
||||
|
@ -87,10 +82,13 @@ void IN_Shutdown(void)
|
|||
}
|
||||
}
|
||||
|
||||
void IN_ReInit()
|
||||
void INS_ReInit()
|
||||
{
|
||||
/* Cvar_Register (&m_filter, "input controls");*/
|
||||
|
||||
if (inputport)
|
||||
return;
|
||||
|
||||
inputport = CreatePort(0, 0);
|
||||
if (inputport == 0)
|
||||
{
|
||||
|
@ -122,182 +120,99 @@ void IN_ReInit()
|
|||
DoIO((struct IORequest *)inputreq);
|
||||
}
|
||||
|
||||
void IN_Init(void)
|
||||
void INS_Init(void)
|
||||
{
|
||||
IN_ReInit();
|
||||
INS_ReInit();
|
||||
}
|
||||
|
||||
static void ExpireRingBuffer()
|
||||
//IN_KeyEvent is threadsafe (for one other thread, anyway)
|
||||
void INS_ProcessInputMessage(struct InputEvent *msg, qboolean consumemotion)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while(imsgs[imsglow].ie_Class == IECLASS_NULL && imsglow != imsghigh)
|
||||
if ((window->Flags & WFLG_WINDOWACTIVE))
|
||||
{
|
||||
imsglow++;
|
||||
i++;
|
||||
imsglow%= MAXIMSGS;
|
||||
}
|
||||
|
||||
DEBUGRING(dprintf("Expired %d messages\n", i));
|
||||
}
|
||||
|
||||
void IN_Commands(void)
|
||||
{
|
||||
int a;
|
||||
char key;
|
||||
int i;
|
||||
int down;
|
||||
struct InputEvent ie;
|
||||
|
||||
for(i = imsglow;i != imsghigh;i++, i%= MAXIMSGS)
|
||||
{
|
||||
DEBUGRING(dprintf("%d %d\n", i, imsghigh));
|
||||
if ((window->Flags & WFLG_WINDOWACTIVE))
|
||||
if (msg->ie_Class == IECLASS_NEWMOUSE)
|
||||
{
|
||||
if (imsgs[i].ie_Class == IECLASS_NEWMOUSE)
|
||||
key = 0;
|
||||
|
||||
if (msg->ie_Code == NM_WHEEL_UP)
|
||||
key = K_MWHEELUP;
|
||||
else if (msg->ie_Code == NM_WHEEL_DOWN)
|
||||
key = K_MWHEELDOWN;
|
||||
|
||||
if (msg->ie_Code == NM_BUTTON_FOURTH)
|
||||
{
|
||||
key = 0;
|
||||
|
||||
if (imsgs[i].ie_Code == NM_WHEEL_UP)
|
||||
key = K_MWHEELUP;
|
||||
else if (imsgs[i].ie_Code == NM_WHEEL_DOWN)
|
||||
key = K_MWHEELDOWN;
|
||||
|
||||
if (imsgs[i].ie_Code == NM_BUTTON_FOURTH)
|
||||
{
|
||||
Key_Event(0, K_MOUSE4, 0, true);
|
||||
}
|
||||
else if (imsgs[i].ie_Code == (NM_BUTTON_FOURTH|IECODE_UP_PREFIX))
|
||||
{
|
||||
Key_Event(0, K_MOUSE4, 0, false);
|
||||
}
|
||||
|
||||
if (key)
|
||||
{
|
||||
Key_Event(0, key, 0, 1);
|
||||
Key_Event(0, key, 0, 0);
|
||||
}
|
||||
|
||||
IN_KeyEvent(0, true, K_MOUSE4, 0);
|
||||
}
|
||||
else if (imsgs[i].ie_Class == IECLASS_RAWKEY)
|
||||
else if (msg->ie_Code == (NM_BUTTON_FOURTH|IECODE_UP_PREFIX))
|
||||
{
|
||||
down = !(imsgs[i].ie_Code&IECODE_UP_PREFIX);
|
||||
imsgs[i].ie_Code&=~IECODE_UP_PREFIX;
|
||||
|
||||
memcpy(&ie, &imsgs[i], sizeof(ie));
|
||||
|
||||
key = 0;
|
||||
if (imsgs[i].ie_Code <= 255)
|
||||
key = keyconv[imsgs[i].ie_Code];
|
||||
|
||||
if (key)
|
||||
Key_Event(0, key, key, down);
|
||||
else
|
||||
{
|
||||
if (developer.value)
|
||||
Con_Printf("Unknown key %d\n", imsgs[i].ie_Code);
|
||||
}
|
||||
IN_KeyEvent(0, false, K_MOUSE4, 0);
|
||||
}
|
||||
|
||||
else if (imsgs[i].ie_Class == IECLASS_RAWMOUSE)
|
||||
if (key)
|
||||
{
|
||||
if (imsgs[i].ie_Code == IECODE_LBUTTON)
|
||||
Key_Event(0, K_MOUSE1, 0, true);
|
||||
else if (imsgs[i].ie_Code == (IECODE_LBUTTON|IECODE_UP_PREFIX))
|
||||
Key_Event(0, K_MOUSE1, 0, false);
|
||||
else if (imsgs[i].ie_Code == IECODE_RBUTTON)
|
||||
Key_Event(0, K_MOUSE2, 0, true);
|
||||
else if (imsgs[i].ie_Code == (IECODE_RBUTTON|IECODE_UP_PREFIX))
|
||||
Key_Event(0, K_MOUSE2, 0, false);
|
||||
else if (imsgs[i].ie_Code == IECODE_MBUTTON)
|
||||
Key_Event(0, K_MOUSE3, 0, true);
|
||||
else if (imsgs[i].ie_Code == (IECODE_MBUTTON|IECODE_UP_PREFIX))
|
||||
Key_Event(0, K_MOUSE3, 0, false);
|
||||
|
||||
mouse_x+= imsgs[i].ie_position.ie_xy.ie_x;
|
||||
mouse_y+= imsgs[i].ie_position.ie_xy.ie_y;
|
||||
IN_KeyEvent(0, true, key, 0);
|
||||
IN_KeyEvent(0, false, key, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
imsgs[i].ie_Class = IECLASS_NULL;
|
||||
|
||||
}
|
||||
|
||||
ExpireRingBuffer();
|
||||
|
||||
}
|
||||
|
||||
void IN_Move (float *movements, int pnum)
|
||||
{
|
||||
extern int mousecursor_x, mousecursor_y;
|
||||
extern int mousemove_x, mousemove_y;
|
||||
|
||||
if (pnum != 0)
|
||||
return; //we're lazy today.
|
||||
|
||||
if (m_filter.value) {
|
||||
mouse_x = (mouse_x + old_mouse_x) * 0.5;
|
||||
mouse_y = (mouse_y + old_mouse_y) * 0.5;
|
||||
}
|
||||
|
||||
old_mouse_x = mouse_x;
|
||||
old_mouse_y = mouse_y;
|
||||
|
||||
if(in_xflip.value) mouse_x *= -1;
|
||||
|
||||
if (Key_MouseShouldBeFree())
|
||||
{
|
||||
mousemove_x += mouse_x;
|
||||
mousemove_y += mouse_y;
|
||||
mousecursor_x += mouse_x;
|
||||
mousecursor_y += mouse_y;
|
||||
|
||||
if (mousecursor_y<0)
|
||||
mousecursor_y=0;
|
||||
if (mousecursor_x<0)
|
||||
mousecursor_x=0;
|
||||
|
||||
if (mousecursor_x >= vid.width)
|
||||
mousecursor_x = vid.width - 1;
|
||||
|
||||
if (mousecursor_y >= vid.height)
|
||||
mousecursor_y = vid.height - 1;
|
||||
|
||||
mouse_x = mouse_y = 0;
|
||||
#ifdef VM_UI
|
||||
UI_MousePosition(mousecursor_x, mousecursor_y);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
mouse_x *= sensitivity.value;
|
||||
mouse_y *= sensitivity.value;
|
||||
|
||||
if ( (in_strafe.state[pnum] & 1) || (lookstrafe.value && (in_mlook.state[pnum] & 1) ))
|
||||
{
|
||||
if (movements)
|
||||
movements[1] += m_side.value * mouse_x;
|
||||
}
|
||||
else
|
||||
{
|
||||
cl.playerview[pnum].viewanglechange[YAW] -= m_yaw.value * mouse_x;
|
||||
}
|
||||
if (in_mlook.state[pnum] & 1)
|
||||
V_StopPitchDrift (pnum);
|
||||
|
||||
if ( (in_mlook.state[pnum] & 1) && !(in_strafe.state[pnum] & 1)) {
|
||||
cl.playerview[pnum].viewanglechange[PITCH] += m_pitch.value * mouse_y;
|
||||
} else {
|
||||
if (movements)
|
||||
else if (msg->ie_Class == IECLASS_RAWKEY)
|
||||
{
|
||||
if ((in_strafe.state[pnum] & 1) && noclip_anglehack)
|
||||
movements[2] -= m_forward.value * mouse_y;
|
||||
down = !(msg->ie_Code&IECODE_UP_PREFIX);
|
||||
msg->ie_Code&=~IECODE_UP_PREFIX;
|
||||
|
||||
memcpy(&ie, msg, sizeof(ie));
|
||||
|
||||
key = 0;
|
||||
if (msg->ie_Code <= 255)
|
||||
key = keyconv[msg->ie_Code];
|
||||
|
||||
if (key)
|
||||
IN_KeyEvent(0, down, key, key);
|
||||
else
|
||||
movements[0] -= m_forward.value * mouse_y;
|
||||
{
|
||||
// if (developer.value)
|
||||
// printf("Unknown key %d\n", msg->ie_Code);
|
||||
}
|
||||
}
|
||||
|
||||
else if (msg->ie_Class == IECLASS_RAWMOUSE)
|
||||
{
|
||||
if (msg->ie_Code == IECODE_LBUTTON)
|
||||
IN_KeyEvent(0, true, K_MOUSE1, 0);
|
||||
else if (msg->ie_Code == (IECODE_LBUTTON|IECODE_UP_PREFIX))
|
||||
IN_KeyEvent(0, false, K_MOUSE1, 0);
|
||||
else if (msg->ie_Code == IECODE_RBUTTON)
|
||||
IN_KeyEvent(0, true, K_MOUSE2, 0);
|
||||
else if (msg->ie_Code == (IECODE_RBUTTON|IECODE_UP_PREFIX))
|
||||
IN_KeyEvent(0, false, K_MOUSE2, 0);
|
||||
else if (msg->ie_Code == IECODE_MBUTTON)
|
||||
IN_KeyEvent(0, true, K_MOUSE3, 0);
|
||||
else if (msg->ie_Code == (IECODE_MBUTTON|IECODE_UP_PREFIX))
|
||||
IN_KeyEvent(0, false, K_MOUSE3, 0);
|
||||
|
||||
if (_windowed_mouse.ival)
|
||||
{
|
||||
if (consumemotion)
|
||||
{
|
||||
IN_MouseMove(0, 0, msg->ie_position.ie_xy.ie_x, msg->ie_position.ie_xy.ie_y, 0, 0);
|
||||
|
||||
#if 0
|
||||
coin->ie_Class = IECLASS_NULL;
|
||||
#else
|
||||
coin->ie_position.ie_xy.ie_x = 0;
|
||||
coin->ie_position.ie_xy.ie_y = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mouse_x = mouse_y = 0.0;
|
||||
}
|
||||
|
||||
void INS_Commands(void)
|
||||
{
|
||||
}
|
||||
void INS_Move (float *movements, int pnum)
|
||||
{
|
||||
}
|
||||
|
||||
char keyconv[] =
|
||||
|
@ -597,31 +512,7 @@ struct InputEvent *myinputhandler_real()
|
|||
{
|
||||
if (coin->ie_Class == IECLASS_RAWMOUSE || coin->ie_Class == IECLASS_RAWKEY || coin->ie_Class == IECLASS_NEWMOUSE)
|
||||
{
|
||||
/* kprintf("Mouse\n");*/
|
||||
|
||||
if ((imsghigh > imsglow && !(imsghigh == MAXIMSGS-1 && imsglow == 0)) || (imsghigh < imsglow && imsghigh != imsglow-1) || imsglow == imsghigh)
|
||||
{
|
||||
memcpy(&imsgs[imsghigh], coin, sizeof(imsgs[0]));
|
||||
imsghigh++;
|
||||
imsghigh%= MAXIMSGS;
|
||||
}
|
||||
else
|
||||
{
|
||||
DEBUGRING(kprintf("FTE: message dropped, imsglow = %d, imsghigh = %d\n", imsglow, imsghigh));
|
||||
}
|
||||
|
||||
if (/*mouse_active && */(window->Flags & WFLG_WINDOWACTIVE) && coin->ie_Class == IECLASS_RAWMOUSE && screeninfront && window->MouseX > 0 && window->MouseY > 0)
|
||||
{
|
||||
if (_windowed_mouse.value)
|
||||
{
|
||||
#if 0
|
||||
coin->ie_Class = IECLASS_NULL;
|
||||
#else
|
||||
coin->ie_position.ie_xy.ie_x = 0;
|
||||
coin->ie_position.ie_xy.ie_y = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
INS_ProcessInputMessage(coin, screeninfront && window->MouseX > 0 && window->MouseY > 0);
|
||||
}
|
||||
|
||||
coin = coin->ie_NextEvent;
|
||||
|
|
|
@ -222,8 +222,6 @@ static unsigned int tbl_sdltoquakemouse[] =
|
|||
K_MOUSE10
|
||||
};
|
||||
|
||||
int mouse_x, mouse_y;
|
||||
|
||||
void Sys_SendKeyEvents(void)
|
||||
{
|
||||
SDL_Event event;
|
||||
|
@ -253,12 +251,11 @@ void Sys_SendKeyEvents(void)
|
|||
|
||||
case SDL_KEYUP:
|
||||
case SDL_KEYDOWN:
|
||||
Key_Event(0, tbl_sdltoquake[event.key.keysym.sym], event.key.keysym.unicode, event.key.state);
|
||||
IN_KeyEvent(0, event.key.state, tbl_sdltoquake[event.key.keysym.sym], event.key.keysym.unicode);
|
||||
break;
|
||||
|
||||
case SDL_MOUSEMOTION:
|
||||
mouse_x += event.motion.xrel;
|
||||
mouse_y += event.motion.yrel;
|
||||
IN_MouseMove(0, 0, event.motion.xrel, event.motion.yrel, 0, 0);
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
|
@ -266,7 +263,7 @@ void Sys_SendKeyEvents(void)
|
|||
//Hmm. SDL allows for 255 buttons...
|
||||
if (event.button.button > sizeof(tbl_sdltoquakemouse)/sizeof(tbl_sdltoquakemouse[0]))
|
||||
event.button.button = sizeof(tbl_sdltoquakemouse)/sizeof(tbl_sdltoquakemouse[0]);
|
||||
Key_Event(0, tbl_sdltoquakemouse[event.button.button-1], 0, event.button.state);
|
||||
IN_KeyEvent(0, event.button.state, tbl_sdltoquakemouse[event.button.button-1], 0);
|
||||
break;
|
||||
|
||||
case SDL_QUIT:
|
||||
|
@ -281,65 +278,29 @@ void Sys_SendKeyEvents(void)
|
|||
|
||||
|
||||
|
||||
void IN_Shutdown (void)
|
||||
void INS_Shutdown (void)
|
||||
{
|
||||
IN_DeactivateMouse();
|
||||
}
|
||||
|
||||
void IN_ReInit (void)
|
||||
void INS_ReInit (void)
|
||||
{
|
||||
IN_ActivateMouse();
|
||||
|
||||
SDL_EnableUNICODE(SDL_ENABLE);
|
||||
}
|
||||
|
||||
void IN_Init (void)
|
||||
{
|
||||
IN_ReInit();
|
||||
}
|
||||
void IN_Move (float *movements, int pnum) //add mouse movement to cmd
|
||||
{
|
||||
#ifdef PEXT_CSQC
|
||||
if (CSQC_MouseMove(mouse_x, mouse_y, 0))
|
||||
{
|
||||
mouse_x = 0;
|
||||
mouse_y = 0;
|
||||
}
|
||||
#endif
|
||||
mouse_x *= sensitivity.value*in_sensitivityscale;
|
||||
mouse_y *= sensitivity.value*in_sensitivityscale;
|
||||
|
||||
|
||||
if (!cl.paused && mouseactive)
|
||||
{
|
||||
// add mouse X/Y movement to cmd
|
||||
if ( (in_strafe.state[pnum] & 1) || (lookstrafe.value && (in_mlook.state[pnum] & 1) ))
|
||||
movements[1] += m_side.value * mouse_x;
|
||||
else
|
||||
cl.playerview[pnum].viewanglechange[YAW] -= m_yaw.value * mouse_x;
|
||||
|
||||
if (in_mlook.state[pnum] & 1)
|
||||
V_StopPitchDrift (pnum);
|
||||
|
||||
if ( (in_mlook.state[pnum] & 1) && !(in_strafe.state[pnum] & 1))
|
||||
{
|
||||
cl.playerview[pnum].viewanglechange[PITCH] += m_pitch.value * mouse_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((in_strafe.state[pnum] & 1) && noclip_anglehack)
|
||||
movements[2] -= m_forward.value * mouse_y;
|
||||
else
|
||||
movements[0] -= m_forward.value * mouse_y;
|
||||
}
|
||||
}
|
||||
|
||||
mouse_x = 0;
|
||||
mouse_y = 0;
|
||||
}
|
||||
void IN_Accumulate(void) //input polling
|
||||
//stubs, all the work is done in Sys_SendKeyEvents
|
||||
void INS_Move(float *movements, int pnum)
|
||||
{
|
||||
}
|
||||
void IN_Commands (void) //used to Cbuf_AddText joystick button events in windows.
|
||||
void INS_Init (void)
|
||||
{
|
||||
}
|
||||
void INS_Accumulate(void) //input polling
|
||||
{
|
||||
}
|
||||
void INS_Commands (void) //used to Cbuf_AddText joystick button events in windows.
|
||||
{
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -34,8 +34,6 @@ void IN_Move (float *movements, int pnum);
|
|||
void IN_ModeChanged (void);
|
||||
// called whenever screen dimensions change
|
||||
|
||||
void IN_ClearStates (void);
|
||||
void IN_Accumulate (void);
|
||||
extern cvar_t in_xflip;
|
||||
|
||||
#ifdef _SDL
|
||||
|
@ -44,3 +42,16 @@ void IN_DeactivateMouse(void);
|
|||
#endif
|
||||
|
||||
int CL_TargettedSplit(qboolean nowrap);
|
||||
|
||||
//specific events for the system-specific input code to call. may be called outside the main thread (so long as you don't call these simultaneously - ie: use a mutex or only one input thread).
|
||||
void IN_KeyEvent(int devid, int down, int keycode, int unicode); //don't use IN_KeyEvent for mice if you ever use abs mice...
|
||||
void IN_MouseMove(int devid, int abs, float x, float y, float z, float size);
|
||||
|
||||
//system-specific functions
|
||||
void INS_Move (float *movements, int pnum);
|
||||
void INS_Accumulate (void);
|
||||
void INS_ClearStates (void);
|
||||
void INS_ReInit (void);
|
||||
void INS_Init (void);
|
||||
void INS_Shutdown (void);
|
||||
void INS_Commands (void); //final chance to call IN_MouseMove/IN_KeyEvent each frame
|
||||
|
|
|
@ -1613,6 +1613,9 @@ qboolean Key_MouseShouldBeFree(void)
|
|||
extern cvar_t cl_prydoncursor;
|
||||
// extern int mouseusedforgui;
|
||||
// if (mouseusedforgui) //I don't like this
|
||||
// return true;
|
||||
|
||||
// if (!ActiveApp)
|
||||
// return true;
|
||||
|
||||
if (key_dest == key_menu)
|
||||
|
|
|
@ -1566,8 +1566,6 @@ void M_Complex_Draw(void)
|
|||
}
|
||||
MenuDraw(cmenu);
|
||||
}
|
||||
|
||||
SCR_DrawCursor(0);
|
||||
}
|
||||
|
||||
menuoption_t *M_NextItem(menu_t *m, menuoption_t *old)
|
||||
|
|
|
@ -2048,7 +2048,7 @@ void S_ExtraUpdate (void)
|
|||
return;
|
||||
|
||||
#ifdef _WIN32
|
||||
IN_Accumulate ();
|
||||
INS_Accumulate ();
|
||||
#endif
|
||||
|
||||
if (snd_noextraupdate.ival)
|
||||
|
|
|
@ -59,6 +59,36 @@ JNIEXPORT jstring JNICALL Java_com_fteqw_FTEDroidEngine_getpreferedorientation(J
|
|||
return (*env)->NewStringUTF(env, sys_orientation.string);
|
||||
}
|
||||
|
||||
/*the java passes in all input directly via a 'UI' thread. we don't need to poll it at all*/
|
||||
void INS_Move(float *movements, int pnum)
|
||||
{
|
||||
}
|
||||
void INS_Commands(void)
|
||||
{
|
||||
}
|
||||
void INS_Init(void)
|
||||
{
|
||||
}
|
||||
void INS_ReInit(void)
|
||||
{
|
||||
}
|
||||
void INS_Shutdown(void)
|
||||
{
|
||||
}
|
||||
JNIEXPORT void JNICALL Java_com_fteqw_FTEDroidEngine_keypress(JNIEnv *env, jobject obj,
|
||||
jint down, jint keycode, jint unicode)
|
||||
{
|
||||
IN_KeyEvent(0, down, keycode, unicode);
|
||||
}
|
||||
JNIEXPORT void JNICALL Java_com_fteqw_FTEDroidEngine_motion(JNIEnv *env, jobject obj,
|
||||
jint act, jint ptrid, jfloat x, jfloat y, jfloat size)
|
||||
{
|
||||
if (act)
|
||||
IN_KeyEvent(ptrid, act==1, K_MOUSE1, 0);
|
||||
else
|
||||
IN_MouseMove(ptrid, true, x, y, 0, size);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_fteqw_FTEDroidEngine_frame(JNIEnv *env, jobject obj,
|
||||
jfloat ax, jfloat ay, jfloat az)
|
||||
{
|
||||
|
|
|
@ -476,7 +476,7 @@ void Sys_CloseTerminal (void)
|
|||
|
||||
#include <windows.h>
|
||||
#endif
|
||||
int main(int argc, char **argv)
|
||||
int QDECL main(int argc, char **argv)
|
||||
{
|
||||
float time, newtime, oldtime;
|
||||
quakeparms_t parms;
|
||||
|
|
|
@ -73,11 +73,11 @@ extern qboolean ActiveApp, Minimized;
|
|||
|
||||
extern qboolean WinNT;
|
||||
|
||||
void IN_UpdateGrabs(int fullscreen, int activeapp);
|
||||
void IN_RestoreOriginalMouseState (void);
|
||||
void IN_SetQuakeMouseState (void);
|
||||
void IN_MouseEvent (int mstate);
|
||||
void IN_RawInput_Read(HANDLE in_device_handle);
|
||||
void INS_UpdateGrabs(int fullscreen, int activeapp);
|
||||
void INS_RestoreOriginalMouseState (void);
|
||||
void INS_SetQuakeMouseState (void);
|
||||
void INS_MouseEvent (int mstate);
|
||||
void INS_RawInput_Read(HANDLE in_device_handle);
|
||||
|
||||
extern qboolean winsock_lib_initialized;
|
||||
|
||||
|
@ -88,9 +88,9 @@ extern qboolean mouseinitialized;
|
|||
|
||||
//extern HANDLE hinput, houtput;
|
||||
|
||||
void IN_UpdateClipCursor (void);
|
||||
void INS_UpdateClipCursor (void);
|
||||
void CenterWindow(HWND hWndCenter, int width, int height, BOOL lefttopjustify);
|
||||
void IN_TranslateKeyEvent(WPARAM wParam, LPARAM lParam, qboolean down, int pnum);
|
||||
void INS_TranslateKeyEvent(WPARAM wParam, LPARAM lParam, qboolean down, int pnum);
|
||||
|
||||
void S_BlockSound (void);
|
||||
void S_UnblockSound (void);
|
||||
|
|
|
@ -181,7 +181,7 @@ static void D3DVID_UpdateWindowStatus (HWND hWnd)
|
|||
window_center_x = (window_rect.left + window_rect.right) / 2;
|
||||
window_center_y = (window_rect.top + window_rect.bottom) / 2;
|
||||
|
||||
IN_UpdateClipCursor ();
|
||||
INS_UpdateClipCursor ();
|
||||
}
|
||||
|
||||
static qboolean D3D9AppActivate(BOOL fActive, BOOL minimize)
|
||||
|
@ -260,13 +260,13 @@ static LRESULT WINAPI D3D9_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
|||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
if (!vid_initializing)
|
||||
IN_TranslateKeyEvent (wParam, lParam, true, 0);
|
||||
INS_TranslateKeyEvent (wParam, lParam, true, 0);
|
||||
break;
|
||||
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
if (!vid_initializing)
|
||||
IN_TranslateKeyEvent (wParam, lParam, false, 0);
|
||||
INS_TranslateKeyEvent (wParam, lParam, false, 0);
|
||||
break;
|
||||
|
||||
case WM_SYSCHAR:
|
||||
|
|
|
@ -188,7 +188,7 @@ static void D3DVID_UpdateWindowStatus (HWND hWnd)
|
|||
window_center_x = (window_rect.left + window_rect.right) / 2;
|
||||
window_center_y = (window_rect.top + window_rect.bottom) / 2;
|
||||
|
||||
IN_UpdateClipCursor ();
|
||||
INS_UpdateClipCursor ();
|
||||
}
|
||||
|
||||
static qboolean D3D11AppActivate(BOOL fActive, BOOL minimize)
|
||||
|
@ -268,13 +268,13 @@ static LRESULT WINAPI D3D11_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
if (!vid_initializing)
|
||||
IN_TranslateKeyEvent (wParam, lParam, true, 0);
|
||||
INS_TranslateKeyEvent (wParam, lParam, true, 0);
|
||||
break;
|
||||
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
if (!vid_initializing)
|
||||
IN_TranslateKeyEvent (wParam, lParam, false, 0);
|
||||
INS_TranslateKeyEvent (wParam, lParam, false, 0);
|
||||
break;
|
||||
|
||||
case WM_SYSCHAR:
|
||||
|
|
|
@ -400,6 +400,10 @@
|
|||
RelativePath="..\botlib\l_utils.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\botlib\q_platform.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
|
|
|
@ -5,7 +5,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftequake", "ftequake.vcproj
|
|||
{0018E098-B12A-4E4D-9B22-6772DA287080} = {0018E098-B12A-4E4D-9B22-6772DA287080}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftequake", "ftequake_SDL.vcproj", "{F384725A-62D4-4063-9941-6D8D2D6C2A47}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdlfte", "ftequake_SDL.vcproj", "{F384725A-62D4-4063-9941-6D8D2D6C2A47}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "npfte", "npfte.vcproj", "{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
|
@ -56,8 +56,8 @@ Global
|
|||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.D3DDebug|Win32.ActiveCfg = D3DDebug|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.D3DDebug|Win32.Build.0 = D3DDebug|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.D3DDebug|Win32.ActiveCfg = D3DRelease|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.D3DDebug|Win32.Build.0 = D3DRelease|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.D3DDebug|x64.ActiveCfg = D3DDebug|x64
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.D3DDebug|x64.Build.0 = D3DDebug|x64
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.D3DRelease|Win32.ActiveCfg = D3DRelease|Win32
|
||||
|
@ -76,7 +76,6 @@ Global
|
|||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|x64.ActiveCfg = GLDebug|x64
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLDebug|x64.Build.0 = GLDebug|x64
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLRelease|Win32.ActiveCfg = GLRelease|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLRelease|Win32.Build.0 = GLRelease|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLRelease|x64.ActiveCfg = GLRelease|x64
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.GLRelease|x64.Build.0 = GLRelease|x64
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.MDebug|Win32.ActiveCfg = MDebug|Win32
|
||||
|
@ -103,9 +102,9 @@ Global
|
|||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release|Win32.Build.0 = MRelease|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release|x64.ActiveCfg = GLRelease|x64
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1364}.Release|x64.Build.0 = GLRelease|x64
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.D3DDebug|Win32.ActiveCfg = D3DDebug_SDL|x64
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.D3DDebug|Win32.ActiveCfg = D3DRelease_SDL|Win32
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.D3DDebug|x64.ActiveCfg = D3DDebug_SDL|x64
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.D3DRelease|Win32.ActiveCfg = D3DDebug_SDL|x64
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.D3DRelease|Win32.ActiveCfg = D3DDebug_SDL|Win32
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.D3DRelease|x64.ActiveCfg = D3DDebug_SDL|x64
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.Debug Dedicated Server|Win32.ActiveCfg = Debug Dedicated Server_SDL|x64
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.Debug Dedicated Server|x64.ActiveCfg = Debug Dedicated Server_SDL|x64
|
||||
|
@ -116,7 +115,8 @@ Global
|
|||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.GLDebug|Win32.ActiveCfg = GLDebug_SDL|Win32
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.GLDebug|Win32.Build.0 = GLDebug_SDL|Win32
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.GLDebug|x64.ActiveCfg = GLDebug_SDL|x64
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.GLRelease|Win32.ActiveCfg = GLRelease_SDL|x64
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.GLRelease|Win32.ActiveCfg = GLRelease_SDL|Win32
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.GLRelease|Win32.Build.0 = GLRelease_SDL|Win32
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.GLRelease|x64.ActiveCfg = GLRelease_SDL|x64
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.MDebug|Win32.ActiveCfg = MDebug_SDL|x64
|
||||
{F384725A-62D4-4063-9941-6D8D2D6C2A47}.MDebug|x64.ActiveCfg = MDebug_SDL|x64
|
||||
|
@ -165,7 +165,7 @@ Global
|
|||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|Win32.ActiveCfg = GLRelease|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|Win32.Build.0 = GLRelease|Win32
|
||||
{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|x64.ActiveCfg = GLDebug|Win32
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.D3DDebug|Win32.ActiveCfg = Debug
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.D3DDebug|Win32.ActiveCfg = Release
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.D3DDebug|x64.ActiveCfg = Debug
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.D3DRelease|Win32.ActiveCfg = Release
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.D3DRelease|x64.ActiveCfg = Release
|
||||
|
@ -190,8 +190,8 @@ Global
|
|||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.Release Dedicated Server|x64.ActiveCfg = Release
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.Release|Win32.ActiveCfg = Release
|
||||
{E0EE8B50-3A75-42A9-B80A-787675979B0C}.Release|x64.ActiveCfg = Release
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DDebug|Win32.Build.0 = Debug|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DDebug|Win32.ActiveCfg = Release|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DDebug|Win32.Build.0 = Release|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DDebug|x64.ActiveCfg = Debug|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DRelease|Win32.ActiveCfg = Release|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.D3DRelease|Win32.Build.0 = Release|Win32
|
||||
|
@ -224,8 +224,7 @@ Global
|
|||
{0018E098-B12A-4E4D-9B22-6772DA287080}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.Release|Win32.Build.0 = Release|Win32
|
||||
{0018E098-B12A-4E4D-9B22-6772DA287080}.Release|x64.ActiveCfg = Release|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.D3DDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.D3DDebug|Win32.Build.0 = Debug|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.D3DDebug|Win32.ActiveCfg = Release|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.D3DDebug|x64.ActiveCfg = Debug|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.D3DRelease|Win32.ActiveCfg = Release|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.D3DRelease|x64.ActiveCfg = Release|Win32
|
||||
|
@ -239,7 +238,6 @@ Global
|
|||
{2866F783-6B44-4655-A38D-D53874037454}.GLDebug|Win32.Build.0 = Debug|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.GLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.GLRelease|Win32.ActiveCfg = Release|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.GLRelease|Win32.Build.0 = Release|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.MDebug|Win32.Build.0 = Debug|Win32
|
||||
|
@ -259,8 +257,7 @@ Global
|
|||
{2866F783-6B44-4655-A38D-D53874037454}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.Release|Win32.Build.0 = Release|Win32
|
||||
{2866F783-6B44-4655-A38D-D53874037454}.Release|x64.ActiveCfg = Release|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.D3DDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.D3DDebug|Win32.Build.0 = Debug|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.D3DDebug|Win32.ActiveCfg = Release|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.D3DDebug|x64.ActiveCfg = Debug|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.D3DRelease|Win32.ActiveCfg = Release|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.D3DRelease|x64.ActiveCfg = Release|Win32
|
||||
|
@ -274,7 +271,6 @@ Global
|
|||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.GLDebug|Win32.Build.0 = Debug|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.GLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.GLRelease|Win32.ActiveCfg = Release|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.GLRelease|Win32.Build.0 = Release|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.MDebug|Win32.Build.0 = Debug|Win32
|
||||
|
@ -294,7 +290,7 @@ Global
|
|||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Release|Win32.Build.0 = Release|Win32
|
||||
{62669E6C-7E18-4E4D-BA54-DFBE29E7D24E}.Release|x64.ActiveCfg = Release|Win32
|
||||
{AA9D4AA8-2B98-42A8-9F63-B9E5A6221BB6}.D3DDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{AA9D4AA8-2B98-42A8-9F63-B9E5A6221BB6}.D3DDebug|Win32.ActiveCfg = Release|Win32
|
||||
{AA9D4AA8-2B98-42A8-9F63-B9E5A6221BB6}.D3DDebug|x64.ActiveCfg = Debug|Win32
|
||||
{AA9D4AA8-2B98-42A8-9F63-B9E5A6221BB6}.D3DRelease|Win32.ActiveCfg = Release|Win32
|
||||
{AA9D4AA8-2B98-42A8-9F63-B9E5A6221BB6}.D3DRelease|x64.ActiveCfg = Release|Win32
|
||||
|
@ -318,7 +314,7 @@ Global
|
|||
{AA9D4AA8-2B98-42A8-9F63-B9E5A6221BB6}.Release Dedicated Server|x64.ActiveCfg = Release|Win32
|
||||
{AA9D4AA8-2B98-42A8-9F63-B9E5A6221BB6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AA9D4AA8-2B98-42A8-9F63-B9E5A6221BB6}.Release|x64.ActiveCfg = Release|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.D3DDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.D3DDebug|Win32.ActiveCfg = Release|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.D3DDebug|x64.ActiveCfg = Debug|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.D3DRelease|Win32.ActiveCfg = Release|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.D3DRelease|x64.ActiveCfg = Release|Win32
|
||||
|
@ -342,8 +338,7 @@ Global
|
|||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.Release Dedicated Server|x64.ActiveCfg = Release|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4735677B-6D5A-4BE6-A945-CB32A7282F56}.Release|x64.ActiveCfg = Release|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.D3DDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.D3DDebug|Win32.Build.0 = Debug|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.D3DDebug|Win32.ActiveCfg = Release|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.D3DDebug|x64.ActiveCfg = Debug|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.D3DRelease|Win32.ActiveCfg = Release|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.D3DRelease|x64.ActiveCfg = Release|Win32
|
||||
|
@ -357,7 +352,6 @@ Global
|
|||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.GLDebug|Win32.Build.0 = Debug|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.GLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.GLRelease|Win32.ActiveCfg = Release|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.GLRelease|Win32.Build.0 = Release|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MDebug|Win32.Build.0 = Debug|Win32
|
||||
|
@ -376,8 +370,8 @@ Global
|
|||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.Release|Win32.Build.0 = Release|Win32
|
||||
{873CCE24-3549-49D4-A4B4-653F91B1532A}.Release|x64.ActiveCfg = Release|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DDebug|Win32.Build.0 = Debug|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DDebug|Win32.ActiveCfg = Release|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DDebug|Win32.Build.0 = Release|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DDebug|x64.ActiveCfg = Debug|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DRelease|Win32.ActiveCfg = Release|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.D3DRelease|Win32.Build.0 = Release|Win32
|
||||
|
@ -392,7 +386,6 @@ Global
|
|||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLDebug|Win32.Build.0 = Debug|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLRelease|Win32.ActiveCfg = Release|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLRelease|Win32.Build.0 = Release|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MDebug|Win32.Build.0 = Debug|Win32
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -204,6 +204,9 @@ void GLSCR_UpdateScreen (void)
|
|||
|
||||
SCR_DrawTwoDimensional(uimenu, nohud);
|
||||
|
||||
if (Key_MouseShouldBeFree())
|
||||
SCR_DrawCursor(0);
|
||||
|
||||
V_UpdatePalette (false);
|
||||
#if defined(_WIN32) && defined(GLQUAKE)
|
||||
Media_RecordFrame();
|
||||
|
|
|
@ -88,13 +88,6 @@ qboolean originalapplied; //states that the origionalramps arrays are valid, and
|
|||
|
||||
extern cvar_t _windowed_mouse;
|
||||
|
||||
|
||||
cvar_t m_filter = {"m_filter", "0"};
|
||||
cvar_t m_accel = {"m_accel", "0"};
|
||||
|
||||
static float mouse_x, mouse_y;
|
||||
static float old_mouse_x, old_mouse_y;
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
float gldepthmin, gldepthmax;
|
||||
|
@ -396,21 +389,20 @@ static void GetEvent(void)
|
|||
#ifdef USE_DGA
|
||||
if (dgamouse && old_windowed_mouse)
|
||||
{
|
||||
mouse_x += event.xmotion.x_root;
|
||||
mouse_y += event.xmotion.y_root;
|
||||
IN_MouseMove(0, false, event.xmotion.x_root, event.xmotion.y_root, 0, 0);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (old_windowed_mouse)
|
||||
{
|
||||
mouse_x = (float) ((int)event.xmotion.x - (int)(vid.width/2));
|
||||
mouse_y = (float) ((int)event.xmotion.y - (int)(vid.height/2));
|
||||
int cx = vid.pixelwidth/2, cy=vid.pixelheight/2;
|
||||
IN_MouseMove(0, false, event.xmotion.x - cx, event.xmotion.y - cy, 0, 0);
|
||||
|
||||
/* move the mouse to the window center again */
|
||||
XSelectInput(vid_dpy, vid_window, X_MASK & ~PointerMotionMask);
|
||||
XWarpPointer(vid_dpy, None, vid_window, 0, 0, 0, 0,
|
||||
(vid.width/2), (vid.height/2));
|
||||
cx, cy);
|
||||
XSelectInput(vid_dpy, vid_window, X_MASK);
|
||||
}
|
||||
}
|
||||
|
@ -448,7 +440,7 @@ static void GetEvent(void)
|
|||
b = x11violations?K_MOUSE10:-1;
|
||||
|
||||
if (b>=0)
|
||||
Key_Event(0, b, 0, true);
|
||||
IN_KeyEvent(0, true, b, 0);
|
||||
#ifdef WITH_VMODE
|
||||
if (vidmode_ext && vidmode_usemode>=0)
|
||||
if (!ActiveApp)
|
||||
|
@ -491,7 +483,7 @@ static void GetEvent(void)
|
|||
b = x11violations?K_MOUSE10:-1;
|
||||
|
||||
if (b>=0)
|
||||
Key_Event(0, b, 0, false);
|
||||
IN_KeyEvent(0, false, b, 0);
|
||||
break;
|
||||
|
||||
case FocusIn:
|
||||
|
@ -1046,140 +1038,22 @@ void Force_CenterView_f (void)
|
|||
cl.playerview[0].viewangles[PITCH] = 0;
|
||||
}
|
||||
|
||||
void IN_ReInit(void)
|
||||
|
||||
//these are done from the x11 event handler. we don't support evdev.
|
||||
void INS_Move(float *movements, int pnum)
|
||||
{
|
||||
}
|
||||
|
||||
void IN_Init(void)
|
||||
{
|
||||
IN_ReInit();
|
||||
}
|
||||
|
||||
void IN_Shutdown(void)
|
||||
void INS_Commands(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_Commands
|
||||
===========
|
||||
*/
|
||||
void IN_Commands (void)
|
||||
void INS_Init(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_Move
|
||||
===========
|
||||
*/
|
||||
void IN_MouseMove (float *movements, int pnum)
|
||||
void INS_ReInit(void)
|
||||
{
|
||||
extern int mousecursor_x, mousecursor_y;
|
||||
extern int mousemove_x, mousemove_y;
|
||||
float mx, my;
|
||||
|
||||
mx = mouse_x;
|
||||
my = mouse_y;
|
||||
|
||||
if (Key_MouseShouldBeFree())
|
||||
{
|
||||
mousemove_x += mouse_x;
|
||||
mousemove_y += mouse_y;
|
||||
mousecursor_x += mouse_x;
|
||||
mousecursor_y += mouse_y;
|
||||
|
||||
if (mousecursor_y<0)
|
||||
mousecursor_y=0;
|
||||
if (mousecursor_x<0)
|
||||
mousecursor_x=0;
|
||||
|
||||
if (mousecursor_x >= vid.width)
|
||||
mousecursor_x = vid.width - 1;
|
||||
|
||||
if (mousecursor_y >= vid.height)
|
||||
mousecursor_y = vid.height - 1;
|
||||
mouse_x=mouse_y=0;
|
||||
#ifdef VM_UI
|
||||
UI_MousePosition(mousecursor_x, mousecursor_y);
|
||||
#endif
|
||||
|
||||
#ifdef PEXT_CSQC
|
||||
if (CSQC_MousePosition(mousecursor_x, mousecursor_y, 0))
|
||||
{
|
||||
mx = 0;
|
||||
my = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef PEXT_CSQC
|
||||
if (mx || my)
|
||||
if (CSQC_MouseMove(mx, my, 0))
|
||||
{
|
||||
mx = 0;
|
||||
my = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m_filter.value)
|
||||
{
|
||||
float fraction = bound(0, m_filter.value, 2) * 0.5;
|
||||
mouse_x = (mouse_x*(1-fraction) + old_mouse_x*fraction);
|
||||
mouse_y = (mouse_y*(1-fraction) + old_mouse_y*fraction);
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse_x = mx;
|
||||
mouse_y = my;
|
||||
}
|
||||
old_mouse_x = mx;
|
||||
old_mouse_y = my;
|
||||
|
||||
if (m_accel.value)
|
||||
{
|
||||
float mouse_deltadist = sqrt(mx*mx + my*my);
|
||||
mouse_x *= (mouse_deltadist*m_accel.value + sensitivity.value*in_sensitivityscale);
|
||||
mouse_y *= (mouse_deltadist*m_accel.value + sensitivity.value*in_sensitivityscale);
|
||||
}
|
||||
else
|
||||
{
|
||||
mouse_x *= sensitivity.value*in_sensitivityscale;
|
||||
mouse_y *= sensitivity.value*in_sensitivityscale;
|
||||
}
|
||||
|
||||
if(in_xflip.value) mouse_x *= -1;
|
||||
|
||||
if (movements)
|
||||
{
|
||||
// add mouse X/Y movement to cmd
|
||||
if ( (in_strafe.state[pnum] & 1) || (lookstrafe.value && (in_mlook.state[pnum] & 1) ))
|
||||
movements[1] += m_side.value * mouse_x;
|
||||
else
|
||||
cl.playerview[pnum].viewanglechange[YAW] -= m_yaw.value * mouse_x;
|
||||
|
||||
if (in_mlook.state[pnum] & 1)
|
||||
V_StopPitchDrift (pnum);
|
||||
|
||||
if ( (in_mlook.state[pnum] & 1) && !(in_strafe.state[pnum] & 1))
|
||||
{
|
||||
cl.playerview[pnum].viewanglechange[PITCH] += m_pitch.value * mouse_y;
|
||||
CL_ClampPitch(pnum);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((in_strafe.state[pnum] & 1) && noclip_anglehack)
|
||||
movements[2] -= m_forward.value * mouse_y;
|
||||
else
|
||||
movements[0] -= m_forward.value * mouse_y;
|
||||
}
|
||||
}
|
||||
mouse_x = mouse_y = 0.0;
|
||||
}
|
||||
|
||||
void IN_Move (float *movements, int pnum)
|
||||
void INS_Shutdown(void)
|
||||
{
|
||||
IN_MouseMove(movements, pnum);
|
||||
}
|
||||
|
||||
void GL_DoSwap(void) {}
|
||||
|
|
|
@ -859,7 +859,7 @@ static qboolean CreateMainWindow(rendererstate_t *info)
|
|||
stat = VID_SetFullDIBMode(info);
|
||||
}
|
||||
|
||||
IN_UpdateGrabs(info->fullscreen, ActiveApp);
|
||||
INS_UpdateGrabs(info->fullscreen, ActiveApp);
|
||||
|
||||
return stat;
|
||||
}
|
||||
|
@ -1081,7 +1081,7 @@ void VID_UpdateWindowStatus (HWND hWnd)
|
|||
window_center_x = (window_rect.left + window_rect.right) / 2;
|
||||
window_center_y = (window_rect.top + window_rect.bottom) / 2;
|
||||
|
||||
IN_UpdateClipCursor ();
|
||||
INS_UpdateClipCursor ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1359,7 +1359,7 @@ void GL_DoSwap (void)
|
|||
|
||||
// handle the mouse state when windowed if that's changed
|
||||
|
||||
IN_UpdateGrabs(modestate != MS_WINDOWED, ActiveApp);
|
||||
INS_UpdateGrabs(modestate != MS_WINDOWED, ActiveApp);
|
||||
}
|
||||
|
||||
void GL_EndRendering (void)
|
||||
|
@ -1722,7 +1722,7 @@ void ClearAllStates (void)
|
|||
}
|
||||
|
||||
Key_ClearStates ();
|
||||
IN_ClearStates ();
|
||||
INS_ClearStates ();
|
||||
}
|
||||
|
||||
qboolean GLAppActivate(BOOL fActive, BOOL minimize)
|
||||
|
@ -1759,7 +1759,7 @@ qboolean GLAppActivate(BOOL fActive, BOOL minimize)
|
|||
sound_active = true;
|
||||
}
|
||||
|
||||
IN_UpdateGrabs(modestate != MS_WINDOWED, ActiveApp);
|
||||
INS_UpdateGrabs(modestate != MS_WINDOWED, ActiveApp);
|
||||
|
||||
if (fActive)
|
||||
{
|
||||
|
@ -1849,7 +1849,7 @@ LONG WINAPI GLMainWndProc (
|
|||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
if (!vid_initializing)
|
||||
IN_TranslateKeyEvent(wParam, lParam, true, 0);
|
||||
INS_TranslateKeyEvent(wParam, lParam, true, 0);
|
||||
break;
|
||||
|
||||
// case WM_UNICHAR:
|
||||
|
@ -1858,13 +1858,13 @@ LONG WINAPI GLMainWndProc (
|
|||
case WM_CHAR:
|
||||
case WM_SYSCHAR:
|
||||
// if (!vid_initializing)
|
||||
// IN_TranslateKeyEvent(wParam, lParam, true);
|
||||
// INS_TranslateKeyEvent(wParam, lParam, true);
|
||||
break;
|
||||
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
if (!vid_initializing)
|
||||
IN_TranslateKeyEvent(wParam, lParam, false, 0);
|
||||
INS_TranslateKeyEvent(wParam, lParam, false, 0);
|
||||
break;
|
||||
|
||||
// this is complicated because Win32 seems to pack multiple mouse events into
|
||||
|
@ -1916,7 +1916,7 @@ LONG WINAPI GLMainWndProc (
|
|||
temp |= 512;
|
||||
|
||||
if (!vid_initializing)
|
||||
IN_MouseEvent (temp);
|
||||
INS_MouseEvent (temp);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -1942,7 +1942,7 @@ LONG WINAPI GLMainWndProc (
|
|||
case WM_INPUT:
|
||||
// raw input handling
|
||||
if (!vid_initializing)
|
||||
IN_RawInput_Read((HANDLE)lParam);
|
||||
INS_RawInput_Read((HANDLE)lParam);
|
||||
break;
|
||||
|
||||
case WM_USER:
|
||||
|
|
|
@ -22,7 +22,10 @@ qboolean mouseactive;
|
|||
extern qboolean mouseusedforgui;
|
||||
|
||||
|
||||
|
||||
static void *GLVID_getsdlglfunction(char *functionname)
|
||||
{
|
||||
return SDL_GL_GetProcAddress(functionname);
|
||||
}
|
||||
|
||||
qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
|
||||
{
|
||||
|
@ -72,7 +75,7 @@ Con_Printf("Getting gamma\n");
|
|||
ActiveApp = true;
|
||||
|
||||
GLVID_SetPalette (palette);
|
||||
GL_Init(SDL_GL_GetProcAddress);
|
||||
GL_Init(GLVID_getsdlglfunction);
|
||||
|
||||
qglViewport (0, 0, vid.pixelwidth, vid.pixelheight);
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ void SWV_UpdateWindowStatus(void)
|
|||
window_center_x = (window_rect.left + window_rect.right) / 2;
|
||||
window_center_y = (window_rect.top + window_rect.bottom) / 2;
|
||||
|
||||
IN_UpdateClipCursor ();
|
||||
INS_UpdateClipCursor ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -487,13 +487,13 @@ LONG WINAPI MainWndProc (
|
|||
case WM_KEYDOWN:
|
||||
case WM_SYSKEYDOWN:
|
||||
// if (!vid_initializing)
|
||||
IN_TranslateKeyEvent(wParam, lParam, true, 0);
|
||||
INS_TranslateKeyEvent(wParam, lParam, true, 0);
|
||||
break;
|
||||
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
// if (!vid_initializing)
|
||||
IN_TranslateKeyEvent(wParam, lParam, false, 0);
|
||||
INS_TranslateKeyEvent(wParam, lParam, false, 0);
|
||||
break;
|
||||
|
||||
// this is complicated because Win32 seems to pack multiple mouse events into
|
||||
|
|
Loading…
Reference in a new issue