mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
getting closer to building the vid libs.
in_common.c is the main input interface. in_x11 has been modified suitably
This commit is contained in:
parent
a4db2f0e5b
commit
7e67fd56f3
16 changed files with 462 additions and 207 deletions
|
@ -36,7 +36,7 @@ struct {
|
||||||
vec3_t position;
|
vec3_t position;
|
||||||
} viewdelta;
|
} viewdelta;
|
||||||
|
|
||||||
#define freelook (in_mlook.state&1 || cl_freelook->int_val)
|
#define freelook (in_mlook.state&1 || in_freelook->int_val)
|
||||||
|
|
||||||
void IN_Init (void);
|
void IN_Init (void);
|
||||||
void IN_Init_Cvars (void);
|
void IN_Init_Cvars (void);
|
||||||
|
@ -59,4 +59,14 @@ void IN_HandlePause (qboolean paused);
|
||||||
|
|
||||||
extern cvar_t *_windowed_mouse;
|
extern cvar_t *_windowed_mouse;
|
||||||
|
|
||||||
|
extern qboolean in_mouse_avail;
|
||||||
|
extern float in_mouse_x, in_mouse_y;
|
||||||
|
|
||||||
|
|
||||||
|
void IN_LL_Init_Cvars ();
|
||||||
|
void IN_LL_Init ();
|
||||||
|
void IN_LL_Shutdown ();
|
||||||
|
void IN_LL_Commands ();
|
||||||
|
void IN_LL_SendKeyEvents ();
|
||||||
|
|
||||||
#endif // _INPUT_H
|
#endif // _INPUT_H
|
||||||
|
|
|
@ -160,6 +160,13 @@ typedef enum {
|
||||||
K_MWHEELDOWN
|
K_MWHEELDOWN
|
||||||
} keynum_t;
|
} keynum_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int down[2]; // key nums holding it down
|
||||||
|
int state; // low bit is down state
|
||||||
|
} kbutton_t;
|
||||||
|
|
||||||
|
|
||||||
// key_none should, preferably, be last
|
// key_none should, preferably, be last
|
||||||
typedef enum {key_game, key_console, key_message, key_menu, key_none} keydest_t;
|
typedef enum {key_game, key_console, key_message, key_menu, key_none} keydest_t;
|
||||||
|
|
||||||
|
@ -179,4 +186,7 @@ void Key_WriteBindings (QFile *f);
|
||||||
void Key_SetBinding (int keynum, char *binding);
|
void Key_SetBinding (int keynum, char *binding);
|
||||||
void Key_ClearStates (void);
|
void Key_ClearStates (void);
|
||||||
|
|
||||||
|
float Key_KeyState (kbutton_t *key);
|
||||||
|
char *Key_KeynumToString (int keynum);
|
||||||
|
|
||||||
#endif // _KEYS_H
|
#endif // _KEYS_H
|
||||||
|
|
|
@ -99,6 +99,7 @@ void VID_Update (vrect_t *rects);
|
||||||
// called only on Win32, when pause happens, so the mouse can be released
|
// called only on Win32, when pause happens, so the mouse can be released
|
||||||
void VID_HandlePause (qboolean pause);
|
void VID_HandlePause (qboolean pause);
|
||||||
|
|
||||||
|
void VID_InitBuffers (void);
|
||||||
void VID_LockBuffer (void);
|
void VID_LockBuffer (void);
|
||||||
void VID_UnlockBuffer (void);
|
void VID_UnlockBuffer (void);
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,10 @@
|
||||||
|
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
|
|
||||||
#include "client.h"
|
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
#include "QF/model.h"
|
#include "QF/model.h"
|
||||||
#include "render.h"
|
|
||||||
#include "QF/qfgl_ext.h"
|
#include "QF/qfgl_ext.h"
|
||||||
#include "wad.h"
|
#include "QF/wad.h"
|
||||||
|
|
||||||
void GL_BeginRendering (int *x, int *y, int *width, int *height);
|
void GL_BeginRendering (int *x, int *y, int *width, int *height);
|
||||||
void GL_EndRendering (void);
|
void GL_EndRendering (void);
|
||||||
|
@ -106,7 +104,7 @@ typedef struct surfcache_s {
|
||||||
byte data[4]; // width*height elements
|
byte data[4]; // width*height elements
|
||||||
} surfcache_t;
|
} surfcache_t;
|
||||||
|
|
||||||
|
#if 0
|
||||||
//====================================================
|
//====================================================
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,7 +133,7 @@ extern refdef_t r_refdef;
|
||||||
extern mleaf_t *r_viewleaf, *r_oldviewleaf;
|
extern mleaf_t *r_viewleaf, *r_oldviewleaf;
|
||||||
extern texture_t *r_notexture_mip;
|
extern texture_t *r_notexture_mip;
|
||||||
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
||||||
|
#endif
|
||||||
extern qboolean envmap;
|
extern qboolean envmap;
|
||||||
extern int currenttexture;
|
extern int currenttexture;
|
||||||
extern int cnttextures[2];
|
extern int cnttextures[2];
|
||||||
|
|
2
libs/video/targets/.gitignore
vendored
2
libs/video/targets/.gitignore
vendored
|
@ -5,3 +5,5 @@
|
||||||
.vimrc
|
.vimrc
|
||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
|
fbset_modes_y.[ch]
|
||||||
|
fbset_modes_l.c
|
||||||
|
|
|
@ -20,7 +20,7 @@ libQFjs_la_CFLAGS= $(JOY_CFLAGS)
|
||||||
YFLAGS = -d
|
YFLAGS = -d
|
||||||
libQFfbdev_la_LDFLAGS= -version-info 1:0:0
|
libQFfbdev_la_LDFLAGS= -version-info 1:0:0
|
||||||
libQFfbdev_la_SOURCES= fbset.c fbset_modes_y.y fbset_modes_l.l \
|
libQFfbdev_la_SOURCES= fbset.c fbset_modes_y.y fbset_modes_l.l \
|
||||||
in_fbdev.c vid.c vid_fbdev.c
|
in_common.c in_fbdev.c vid.c vid_fbdev.c
|
||||||
YACCLEX_CLEANFILES= fbset_modes_y.c fbset_modes_y.h \
|
YACCLEX_CLEANFILES= fbset_modes_y.c fbset_modes_y.h \
|
||||||
fbset_modes_y.tab.h fbset_modes_l.c
|
fbset_modes_y.tab.h fbset_modes_l.c
|
||||||
EXTRA_libQFfbdev_la_SOURCES=fbset_modes_y.h
|
EXTRA_libQFfbdev_la_SOURCES=fbset_modes_y.h
|
||||||
|
@ -31,31 +31,31 @@ fbset_modes_l.lo: $(srcdir)/fbset_modes_l.c
|
||||||
$(COMPILE) -Wno-error -c $<
|
$(COMPILE) -Wno-error -c $<
|
||||||
|
|
||||||
libQFmgl_la_LDFLAGS= -version-info 1:0:0
|
libQFmgl_la_LDFLAGS= -version-info 1:0:0
|
||||||
libQFmgl_la_SOURCES= in_win.c vid.c vid_common_sw.c vid_mgl.c
|
libQFmgl_la_SOURCES= in_common.c in_win.c vid.c vid_common_sw.c vid_mgl.c
|
||||||
|
|
||||||
libQFsdl_la_LDFLAGS= -version-info 1:0:0
|
libQFsdl_la_LDFLAGS= -version-info 1:0:0
|
||||||
libQFsdl_la_SOURCES= in_sdl.c vid.c vid_common_sw.c vid_sdl.c
|
libQFsdl_la_SOURCES= in_common.c in_sdl.c vid.c vid_common_sw.c vid_sdl.c
|
||||||
|
|
||||||
libQFsvga_la_LDFLAGS= -version-info 1:0:0
|
libQFsvga_la_LDFLAGS= -version-info 1:0:0
|
||||||
libQFsvga_la_SOURCES= d_copy.S in_svgalib.c vid.c vid_common_sw.c \
|
libQFsvga_la_SOURCES= d_copy.S in_common.c in_svgalib.c vid.c vid_common_sw.c \
|
||||||
vid_svgalib.c
|
vid_svgalib.c
|
||||||
|
|
||||||
libQFx11_la_LDFLAGS= -version-info 1:0:0
|
libQFx11_la_LDFLAGS= -version-info 1:0:0
|
||||||
libQFx11_la_SOURCES= in_x11.c vid.c context_x11.c dga_check.c \
|
libQFx11_la_SOURCES= in_common.c in_x11.c vid.c context_x11.c dga_check.c \
|
||||||
vid_common_sw.c vid_x11.c
|
vid_common_sw.c vid_x11.c
|
||||||
|
|
||||||
libQFglx_la_LDFLAGS= -version-info 1:0:0
|
libQFglx_la_LDFLAGS= -version-info 1:0:0
|
||||||
libQFglx_la_SOURCES= in_x11.c vid.c context_x11.c dga_check.c \
|
libQFglx_la_SOURCES= in_common.c in_x11.c vid.c context_x11.c dga_check.c \
|
||||||
vid_common_gl.c vid_glx.c
|
vid_common_gl.c vid_glx.c
|
||||||
|
|
||||||
libQFsgl_la_LDFLAGS= -version-info 1:0:0
|
libQFsgl_la_LDFLAGS= -version-info 1:0:0
|
||||||
libQFsgl_la_SOURCES= in_sdl.c vid.c vid_common_gl.c vid_sgl.c
|
libQFsgl_la_SOURCES= in_common.c in_sdl.c vid.c vid_common_gl.c vid_sgl.c
|
||||||
|
|
||||||
libQFtdfx_la_LDFLAGS= -version-info 1:0:0
|
libQFtdfx_la_LDFLAGS= -version-info 1:0:0
|
||||||
libQFtdfx_la_SOURCES= in_svgalib.c vid.c vid_common_gl.c vid_3dfxsvga.c
|
libQFtdfx_la_SOURCES= in_common.c in_svgalib.c vid.c vid_common_gl.c vid_3dfxsvga.c
|
||||||
|
|
||||||
libQFwgl_la_LDFLAGS= -version-info 1:0:0
|
libQFwgl_la_LDFLAGS= -version-info 1:0:0
|
||||||
libQFwgl_la_SOURCES= in_win.c vid.c vid_wgl.c
|
libQFwgl_la_SOURCES= in_common.c in_win.c vid.c vid_wgl.c
|
||||||
|
|
||||||
LIBLIST = $(lib_LTLIBRARIES) @LIBRARY_SEARCH_PATH@
|
LIBLIST = $(lib_LTLIBRARIES) @LIBRARY_SEARCH_PATH@
|
||||||
|
|
||||||
|
|
176
libs/video/targets/d_copy.S
Normal file
176
libs/video/targets/d_copy.S
Normal file
|
@ -0,0 +1,176 @@
|
||||||
|
/*
|
||||||
|
d_copy.S
|
||||||
|
|
||||||
|
x86 assembly-language screen copying code.
|
||||||
|
|
||||||
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to:
|
||||||
|
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
59 Temple Place - Suite 330
|
||||||
|
Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
#include "QF/asm_i386.h"
|
||||||
|
#include "quakeasm.h"
|
||||||
|
#include "asm_draw.h"
|
||||||
|
|
||||||
|
#ifdef USE_INTEL_ASM
|
||||||
|
.data
|
||||||
|
|
||||||
|
LCopyWidth: .long 0
|
||||||
|
LBlockSrcStep: .long 0
|
||||||
|
LBlockDestStep: .long 0
|
||||||
|
LSrcDelta: .long 0
|
||||||
|
LDestDelta: .long 0
|
||||||
|
|
||||||
|
#define bufptr 4+16
|
||||||
|
|
||||||
|
// copies 16 rows per plane at a pop; idea is that 16*512 = 8k, and since
|
||||||
|
// no Mode X mode is wider than 360, all the data should fit in the cache for
|
||||||
|
// the passes for the next 3 planes
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
.globl C(VGA_UpdatePlanarScreen)
|
||||||
|
C(VGA_UpdatePlanarScreen):
|
||||||
|
pushl %ebp // preserve caller's stack frame
|
||||||
|
pushl %edi
|
||||||
|
pushl %esi // preserve register variables
|
||||||
|
pushl %ebx
|
||||||
|
|
||||||
|
movl C(VGA_bufferrowbytes),%eax
|
||||||
|
shll $1,%eax
|
||||||
|
movl %eax,LBlockSrcStep
|
||||||
|
movl C(VGA_rowbytes),%eax
|
||||||
|
shll $1,%eax
|
||||||
|
movl %eax,LBlockDestStep
|
||||||
|
|
||||||
|
movl $0x3C4,%edx
|
||||||
|
movb $2,%al
|
||||||
|
outb %al,%dx // point the SC to the Map Mask
|
||||||
|
incl %edx
|
||||||
|
|
||||||
|
movl bufptr(%esp),%esi
|
||||||
|
movl C(VGA_pagebase),%edi
|
||||||
|
movl C(VGA_height),%ebp
|
||||||
|
shrl $1,%ebp
|
||||||
|
|
||||||
|
movl C(VGA_width),%ecx
|
||||||
|
movl C(VGA_bufferrowbytes),%eax
|
||||||
|
subl %ecx,%eax
|
||||||
|
movl %eax,LSrcDelta
|
||||||
|
movl C(VGA_rowbytes),%eax
|
||||||
|
shll $2,%eax
|
||||||
|
subl %ecx,%eax
|
||||||
|
movl %eax,LDestDelta
|
||||||
|
shrl $4,%ecx
|
||||||
|
movl %ecx,LCopyWidth
|
||||||
|
|
||||||
|
LRowLoop:
|
||||||
|
movb $1,%al
|
||||||
|
|
||||||
|
LPlaneLoop:
|
||||||
|
outb %al,%dx
|
||||||
|
movb $2,%ah
|
||||||
|
|
||||||
|
pushl %esi
|
||||||
|
pushl %edi
|
||||||
|
LRowSetLoop:
|
||||||
|
movl LCopyWidth,%ecx
|
||||||
|
LColumnLoop:
|
||||||
|
movb 12(%esi),%bh
|
||||||
|
movb 8(%esi),%bl
|
||||||
|
shll $16,%ebx
|
||||||
|
movb 4(%esi),%bh
|
||||||
|
movb (%esi),%bl
|
||||||
|
movl %ebx,(%edi)
|
||||||
|
addl $16,%esi
|
||||||
|
addl $4,%edi
|
||||||
|
decl %ecx
|
||||||
|
jnz LColumnLoop
|
||||||
|
|
||||||
|
addl LDestDelta,%edi
|
||||||
|
addl LSrcDelta,%esi
|
||||||
|
decb %ah
|
||||||
|
jnz LRowSetLoop
|
||||||
|
|
||||||
|
popl %edi
|
||||||
|
popl %esi
|
||||||
|
incl %esi
|
||||||
|
|
||||||
|
shlb $1,%al
|
||||||
|
cmpb $16,%al
|
||||||
|
jnz LPlaneLoop
|
||||||
|
|
||||||
|
subl $4,%esi
|
||||||
|
addl LBlockSrcStep,%esi
|
||||||
|
addl LBlockDestStep,%edi
|
||||||
|
decl %ebp
|
||||||
|
jnz LRowLoop
|
||||||
|
|
||||||
|
popl %ebx // restore register variables
|
||||||
|
popl %esi
|
||||||
|
popl %edi
|
||||||
|
popl %ebp // restore the caller's stack frame
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
#define srcptr 4+16
|
||||||
|
#define destptr 8+16
|
||||||
|
#define width 12+16
|
||||||
|
#define height 16+16
|
||||||
|
#define srcrowbytes 20+16
|
||||||
|
#define destrowbytes 24+16
|
||||||
|
|
||||||
|
.globl C(VGA_UpdateLinearScreen)
|
||||||
|
C(VGA_UpdateLinearScreen):
|
||||||
|
pushl %ebp // preserve caller's stack frame
|
||||||
|
pushl %edi
|
||||||
|
pushl %esi // preserve register variables
|
||||||
|
pushl %ebx
|
||||||
|
|
||||||
|
cld
|
||||||
|
movl srcptr(%esp),%esi
|
||||||
|
movl destptr(%esp),%edi
|
||||||
|
movl width(%esp),%ebx
|
||||||
|
movl srcrowbytes(%esp),%eax
|
||||||
|
subl %ebx,%eax
|
||||||
|
movl destrowbytes(%esp),%edx
|
||||||
|
subl %ebx,%edx
|
||||||
|
shrl $2,%ebx
|
||||||
|
movl height(%esp),%ebp
|
||||||
|
LLRowLoop:
|
||||||
|
movl %ebx,%ecx
|
||||||
|
rep/movsl (%esi),(%edi)
|
||||||
|
addl %eax,%esi
|
||||||
|
addl %edx,%edi
|
||||||
|
decl %ebp
|
||||||
|
jnz LLRowLoop
|
||||||
|
|
||||||
|
popl %ebx // restore register variables
|
||||||
|
popl %esi
|
||||||
|
popl %edi
|
||||||
|
popl %ebp // restore the caller's stack frame
|
||||||
|
|
||||||
|
ret
|
||||||
|
#endif /* USE_INTEL_ASM */
|
155
libs/video/targets/in_common.c
Normal file
155
libs/video/targets/in_common.c
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
/*
|
||||||
|
in_common.c
|
||||||
|
|
||||||
|
general input driver
|
||||||
|
|
||||||
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
|
Copyright (C) 2000 Marcus Sundberg [mackan@stacken.kth.se]
|
||||||
|
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||||
|
Please see the file "AUTHORS" for a list of contributors
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to:
|
||||||
|
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
59 Temple Place - Suite 330
|
||||||
|
Boston, MA 02111-1307, USA
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRINGS_H
|
||||||
|
# include <strings.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
# include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define _BSD
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "QF/console.h"
|
||||||
|
#include "QF/cvar.h"
|
||||||
|
#include "QF/input.h"
|
||||||
|
#include "QF/joystick.h"
|
||||||
|
#include "QF/keys.h"
|
||||||
|
#include "QF/mathlib.h"
|
||||||
|
|
||||||
|
cvar_t *_windowed_mouse;
|
||||||
|
cvar_t *m_filter;
|
||||||
|
cvar_t *sensitivity;
|
||||||
|
cvar_t *lookstrafe;
|
||||||
|
cvar_t *in_freelook;
|
||||||
|
|
||||||
|
kbutton_t in_mlook, in_klook;
|
||||||
|
kbutton_t in_strafe;
|
||||||
|
kbutton_t in_speed;
|
||||||
|
|
||||||
|
qboolean in_mouse_avail;
|
||||||
|
float in_mouse_x, in_mouse_y;
|
||||||
|
static float in_old_mouse_x, in_old_mouse_y;
|
||||||
|
|
||||||
|
void
|
||||||
|
IN_Commands (void)
|
||||||
|
{
|
||||||
|
JOY_Command ();
|
||||||
|
|
||||||
|
IN_LL_Commands ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
IN_SendKeyEvents (void)
|
||||||
|
{
|
||||||
|
/* Get events from X server. */
|
||||||
|
IN_LL_SendKeyEvents ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
IN_Move (void)
|
||||||
|
{
|
||||||
|
JOY_Move ();
|
||||||
|
|
||||||
|
if (!in_mouse_avail)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_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 *= sensitivity->value;
|
||||||
|
in_mouse_y *= sensitivity->value;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
in_mouse_x = in_mouse_y = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Called at shutdown
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
IN_Shutdown (void)
|
||||||
|
{
|
||||||
|
JOY_Shutdown ();
|
||||||
|
|
||||||
|
Con_Printf ("IN_Shutdown\n");
|
||||||
|
IN_LL_Shutdown ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
IN_Init (void)
|
||||||
|
{
|
||||||
|
IN_LL_Init ();
|
||||||
|
|
||||||
|
JOY_Init ();
|
||||||
|
|
||||||
|
in_mouse_x = in_mouse_y = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
IN_Init_Cvars (void)
|
||||||
|
{
|
||||||
|
JOY_Init_Cvars ();
|
||||||
|
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL,
|
||||||
|
"With this set to 1, quake will grab the mouse from X");
|
||||||
|
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, NULL,
|
||||||
|
"Toggle mouse input filtering.");
|
||||||
|
lookstrafe = Cvar_Get ("lookstrafe", "0", CVAR_ARCHIVE, NULL,
|
||||||
|
"when mlook/klook on player will strafe");
|
||||||
|
sensitivity = Cvar_Get ("sensitivity", "3", CVAR_ARCHIVE, NULL,
|
||||||
|
"mouse sensitivity multiplier");
|
||||||
|
IN_LL_Init_Cvars ();
|
||||||
|
}
|
|
@ -42,8 +42,6 @@
|
||||||
#include <vgakeyboard.h>
|
#include <vgakeyboard.h>
|
||||||
#include <vgamouse.h>
|
#include <vgamouse.h>
|
||||||
|
|
||||||
#include "cl_input.h"
|
|
||||||
#include "client.h"
|
|
||||||
#include "QF/cmd.h"
|
#include "QF/cmd.h"
|
||||||
#include "QF/compat.h"
|
#include "QF/compat.h"
|
||||||
#include "QF/console.h"
|
#include "QF/console.h"
|
||||||
|
@ -51,9 +49,9 @@
|
||||||
#include "QF/input.h"
|
#include "QF/input.h"
|
||||||
#include "QF/joystick.h"
|
#include "QF/joystick.h"
|
||||||
#include "QF/keys.h"
|
#include "QF/keys.h"
|
||||||
|
#include "QF/mathlib.h"
|
||||||
#include "QF/qargs.h"
|
#include "QF/qargs.h"
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
#include "view.h"
|
|
||||||
|
|
||||||
static int UseKeyboard = 1;
|
static int UseKeyboard = 1;
|
||||||
static int UseMouse = 1;
|
static int UseMouse = 1;
|
||||||
|
@ -72,6 +70,8 @@ static void IN_InitMouse (void);
|
||||||
|
|
||||||
cvar_t *_windowed_mouse;
|
cvar_t *_windowed_mouse;
|
||||||
cvar_t *m_filter;
|
cvar_t *m_filter;
|
||||||
|
cvar_t *sensitivity;
|
||||||
|
cvar_t *lookstrafe;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
keyhandler (int scancode, int state)
|
keyhandler (int scancode, int state)
|
||||||
|
@ -103,13 +103,6 @@ mousehandler (int buttonstate, int dx, int dy, int dz, int drx, int dry, int drz
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
Force_CenterView_f (void)
|
|
||||||
{
|
|
||||||
cl.viewangles[PITCH] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
IN_Init (void)
|
IN_Init (void)
|
||||||
{
|
{
|
||||||
|
@ -135,6 +128,10 @@ IN_Init_Cvars (void)
|
||||||
JOY_Init_Cvars ();
|
JOY_Init_Cvars ();
|
||||||
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, NULL,
|
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, NULL,
|
||||||
"Toggle mouse input filtering.");
|
"Toggle mouse input filtering.");
|
||||||
|
lookstrafe = Cvar_Get ("lookstrafe", "0", CVAR_ARCHIVE, NULL,
|
||||||
|
"when mlook/klook on player will strafe");
|
||||||
|
sensitivity = Cvar_Get ("sensitivity", "3", CVAR_ARCHIVE, NULL,
|
||||||
|
"mouse sensitivity multiplier");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -265,8 +262,6 @@ IN_InitMouse (void)
|
||||||
char *mousedev;
|
char *mousedev;
|
||||||
int mouserate = MOUSE_DEFAULTSAMPLERATE;
|
int mouserate = MOUSE_DEFAULTSAMPLERATE;
|
||||||
|
|
||||||
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "Force viewpoint of player to center");
|
|
||||||
|
|
||||||
mouse_buttons = 3;
|
mouse_buttons = 3;
|
||||||
|
|
||||||
mtype = vga_getmousetype ();
|
mtype = vga_getmousetype ();
|
||||||
|
|
|
@ -55,23 +55,20 @@
|
||||||
# include <X11/extensions/xf86dga.h>
|
# include <X11/extensions/xf86dga.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cl_input.h"
|
|
||||||
#include "client.h"
|
|
||||||
#include "QF/compat.h"
|
#include "QF/compat.h"
|
||||||
#include "QF/console.h"
|
#include "QF/console.h"
|
||||||
#include "context_x11.h"
|
|
||||||
#include "QF/cmd.h"
|
#include "QF/cmd.h"
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
#include "dga_check.h"
|
|
||||||
#include "QF/input.h"
|
#include "QF/input.h"
|
||||||
#include "QF/joystick.h"
|
#include "QF/joystick.h"
|
||||||
#include "QF/keys.h"
|
#include "QF/keys.h"
|
||||||
|
#include "QF/mathlib.h"
|
||||||
#include "QF/qargs.h"
|
#include "QF/qargs.h"
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
#include "view.h"
|
#include "QF/vid.h"
|
||||||
|
|
||||||
cvar_t *_windowed_mouse;
|
#include "context_x11.h"
|
||||||
cvar_t *m_filter;
|
#include "dga_check.h"
|
||||||
|
|
||||||
cvar_t *in_dga;
|
cvar_t *in_dga;
|
||||||
cvar_t *in_dga_mouseaccel;
|
cvar_t *in_dga_mouseaccel;
|
||||||
|
@ -81,9 +78,6 @@ static qboolean dga_active;
|
||||||
|
|
||||||
static keydest_t old_key_dest = key_none;
|
static keydest_t old_key_dest = key_none;
|
||||||
|
|
||||||
static qboolean mouse_avail;
|
|
||||||
static float mouse_x, mouse_y;
|
|
||||||
static float old_mouse_x, old_mouse_y;
|
|
||||||
static int p_mouse_x, p_mouse_y;
|
static int p_mouse_x, p_mouse_y;
|
||||||
|
|
||||||
#define KEY_MASK (KeyPressMask | KeyReleaseMask)
|
#define KEY_MASK (KeyPressMask | KeyReleaseMask)
|
||||||
|
@ -364,21 +358,21 @@ static void
|
||||||
event_motion (XEvent * event)
|
event_motion (XEvent * event)
|
||||||
{
|
{
|
||||||
if (dga_active) {
|
if (dga_active) {
|
||||||
mouse_x += event->xmotion.x_root * in_dga_mouseaccel->value;
|
in_mouse_x += event->xmotion.x_root * in_dga_mouseaccel->value;
|
||||||
mouse_y += event->xmotion.y_root * in_dga_mouseaccel->value;
|
in_mouse_y += event->xmotion.y_root * in_dga_mouseaccel->value;
|
||||||
} else {
|
} else {
|
||||||
if (vid_fullscreen->int_val || _windowed_mouse->int_val) {
|
if (vid_fullscreen->int_val || _windowed_mouse->int_val) {
|
||||||
if (!event->xmotion.send_event) {
|
if (!event->xmotion.send_event) {
|
||||||
mouse_x += (event->xmotion.x - p_mouse_x);
|
in_mouse_x += (event->xmotion.x - p_mouse_x);
|
||||||
mouse_y += (event->xmotion.y - p_mouse_y);
|
in_mouse_y += (event->xmotion.y - p_mouse_y);
|
||||||
if (abs (vid.width / 2 - event->xmotion.x) > vid.width / 4
|
if (abs (vid.width / 2 - event->xmotion.x) > vid.width / 4
|
||||||
|| abs (vid.height / 2 - event->xmotion.y) > vid.height / 4) {
|
|| abs (vid.height / 2 - event->xmotion.y) > vid.height / 4) {
|
||||||
center_pointer ();
|
center_pointer ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mouse_x += (event->xmotion.x - p_mouse_x);
|
in_mouse_x += (event->xmotion.x - p_mouse_x);
|
||||||
mouse_y += (event->xmotion.y - p_mouse_y);
|
in_mouse_y += (event->xmotion.y - p_mouse_y);
|
||||||
}
|
}
|
||||||
p_mouse_x = event->xmotion.x;
|
p_mouse_x = event->xmotion.x;
|
||||||
p_mouse_y = event->xmotion.y;
|
p_mouse_y = event->xmotion.y;
|
||||||
|
@ -387,13 +381,11 @@ event_motion (XEvent * event)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
IN_Commands (void)
|
IN_LL_Commands (void)
|
||||||
{
|
{
|
||||||
static int old_windowed_mouse;
|
static int old_windowed_mouse;
|
||||||
static int old_in_dga;
|
static int old_in_dga;
|
||||||
|
|
||||||
JOY_Command ();
|
|
||||||
|
|
||||||
if ((old_windowed_mouse != _windowed_mouse->int_val)
|
if ((old_windowed_mouse != _windowed_mouse->int_val)
|
||||||
|| (old_in_dga != in_dga->int_val)) {
|
|| (old_in_dga != in_dga->int_val)) {
|
||||||
old_windowed_mouse = _windowed_mouse->int_val;
|
old_windowed_mouse = _windowed_mouse->int_val;
|
||||||
|
@ -423,57 +415,20 @@ IN_Commands (void)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
IN_SendKeyEvents (void)
|
IN_LL_SendKeyEvents (void)
|
||||||
{
|
{
|
||||||
/* Get events from X server. */
|
/* Get events from X server. */
|
||||||
X11_ProcessEvents ();
|
X11_ProcessEvents ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
IN_Move (void)
|
|
||||||
{
|
|
||||||
JOY_Move ();
|
|
||||||
|
|
||||||
if (!mouse_avail)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_filter->int_val) {
|
|
||||||
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;
|
|
||||||
|
|
||||||
mouse_x *= sensitivity->value;
|
|
||||||
mouse_y *= sensitivity->value;
|
|
||||||
|
|
||||||
if ((in_strafe.state & 1) || (lookstrafe->int_val && freelook))
|
|
||||||
viewdelta.position[0] += mouse_x;
|
|
||||||
else
|
|
||||||
viewdelta.angles[YAW] -= mouse_x;
|
|
||||||
|
|
||||||
if (freelook && !(in_strafe.state & 1)) {
|
|
||||||
viewdelta.angles[PITCH] += mouse_y;
|
|
||||||
} else {
|
|
||||||
if ((in_strafe.state & 1) && noclip_anglehack)
|
|
||||||
viewdelta.position[1] -= mouse_y;
|
|
||||||
else
|
|
||||||
viewdelta.position[2] -= mouse_y;
|
|
||||||
}
|
|
||||||
mouse_x = mouse_y = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Called at shutdown
|
Called at shutdown
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
IN_Shutdown (void)
|
IN_LL_Shutdown (void)
|
||||||
{
|
{
|
||||||
JOY_Shutdown ();
|
Con_Printf ("IN_LL_Shutdown\n");
|
||||||
|
in_mouse_avail = 0;
|
||||||
Con_Printf ("IN_Shutdown\n");
|
|
||||||
mouse_avail = 0;
|
|
||||||
if (x_disp) {
|
if (x_disp) {
|
||||||
XAutoRepeatOn (x_disp);
|
XAutoRepeatOn (x_disp);
|
||||||
|
|
||||||
|
@ -486,13 +441,7 @@ IN_Shutdown (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Force_CenterView_f (void)
|
IN_LL_Init (void)
|
||||||
{
|
|
||||||
cl.viewangles[PITCH] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
IN_Init (void)
|
|
||||||
{
|
{
|
||||||
// open the display
|
// open the display
|
||||||
if (!x_disp)
|
if (!x_disp)
|
||||||
|
@ -515,8 +464,6 @@ IN_Init (void)
|
||||||
XChangeWindowAttributes (x_disp, x_win, attribmask, &attribs_2);
|
XChangeWindowAttributes (x_disp, x_win, attribmask, &attribs_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
JOY_Init ();
|
|
||||||
|
|
||||||
XAutoRepeatOff (x_disp);
|
XAutoRepeatOff (x_disp);
|
||||||
|
|
||||||
if (COM_CheckParm ("-nomouse"))
|
if (COM_CheckParm ("-nomouse"))
|
||||||
|
@ -528,26 +475,18 @@ IN_Init (void)
|
||||||
_windowed_mouse->flags |= CVAR_ROM;
|
_windowed_mouse->flags |= CVAR_ROM;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_x = mouse_y = 0.0;
|
in_mouse_avail = 1;
|
||||||
mouse_avail = 1;
|
|
||||||
|
|
||||||
X11_AddEvent (KeyPress, &event_key);
|
X11_AddEvent (KeyPress, &event_key);
|
||||||
X11_AddEvent (KeyRelease, &event_key);
|
X11_AddEvent (KeyRelease, &event_key);
|
||||||
X11_AddEvent (ButtonPress, &event_button);
|
X11_AddEvent (ButtonPress, &event_button);
|
||||||
X11_AddEvent (ButtonRelease, &event_button);
|
X11_AddEvent (ButtonRelease, &event_button);
|
||||||
X11_AddEvent (MotionNotify, &event_motion);
|
X11_AddEvent (MotionNotify, &event_motion);
|
||||||
|
|
||||||
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "Force view of player to center");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
IN_Init_Cvars (void)
|
IN_LL_Init_Cvars (void)
|
||||||
{
|
{
|
||||||
JOY_Init_Cvars ();
|
|
||||||
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL,
|
|
||||||
"With this set to 1, quake will grab the mouse from X");
|
|
||||||
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, NULL,
|
|
||||||
"Toggle mouse input filtering.");
|
|
||||||
in_dga = Cvar_Get ("in_dga", "1", CVAR_ARCHIVE, NULL,
|
in_dga = Cvar_Get ("in_dga", "1", CVAR_ARCHIVE, NULL,
|
||||||
"DGA Input support");
|
"DGA Input support");
|
||||||
in_dga_mouseaccel = Cvar_Get ("in_dga_mouseaccel", "1", CVAR_ARCHIVE, NULL,
|
in_dga_mouseaccel = Cvar_Get ("in_dga_mouseaccel", "1", CVAR_ARCHIVE, NULL,
|
||||||
|
|
|
@ -36,4 +36,57 @@
|
||||||
#include "QF/compat.h"
|
#include "QF/compat.h"
|
||||||
#include "QF/qargs.h"
|
#include "QF/qargs.h"
|
||||||
#include "QF/vid.h"
|
#include "QF/vid.h"
|
||||||
#include "view.h"
|
|
||||||
|
|
||||||
|
void
|
||||||
|
VID_InitBuffers (void)
|
||||||
|
{
|
||||||
|
int buffersize, zbuffersize, cachesize;
|
||||||
|
void *vid_surfcache;
|
||||||
|
|
||||||
|
// Calculate the sizes we want first
|
||||||
|
buffersize = vid.rowbytes * vid.height;
|
||||||
|
zbuffersize = vid.width * vid.height * sizeof (*d_pzbuffer);
|
||||||
|
cachesize = D_SurfaceCacheForRes (vid.width, vid.height);
|
||||||
|
|
||||||
|
// Free the old screen buffer
|
||||||
|
if (vid.buffer) {
|
||||||
|
free (vid.buffer);
|
||||||
|
vid.conbuffer = vid.buffer = NULL;
|
||||||
|
}
|
||||||
|
// Free the old z-buffer
|
||||||
|
if (d_pzbuffer) {
|
||||||
|
free (d_pzbuffer);
|
||||||
|
d_pzbuffer = NULL;
|
||||||
|
}
|
||||||
|
// Free the old surface cache
|
||||||
|
vid_surfcache = D_SurfaceCacheAddress ();
|
||||||
|
if (vid_surfcache) {
|
||||||
|
D_FlushCaches ();
|
||||||
|
free (vid_surfcache);
|
||||||
|
vid_surfcache = NULL;
|
||||||
|
}
|
||||||
|
// Allocate the new screen buffer
|
||||||
|
vid.conbuffer = vid.buffer = calloc (buffersize, 1);
|
||||||
|
if (!vid.conbuffer) {
|
||||||
|
Sys_Error ("Not enough memory for video mode\n");
|
||||||
|
}
|
||||||
|
// Allocate the new z-buffer
|
||||||
|
d_pzbuffer = calloc (zbuffersize, 1);
|
||||||
|
if (!d_pzbuffer) {
|
||||||
|
free (vid.buffer);
|
||||||
|
vid.conbuffer = vid.buffer = NULL;
|
||||||
|
Sys_Error ("Not enough memory for video mode\n");
|
||||||
|
}
|
||||||
|
// Allocate the new surface cache; free the z-buffer if we fail
|
||||||
|
vid_surfcache = calloc (cachesize, 1);
|
||||||
|
if (!vid_surfcache) {
|
||||||
|
free (vid.buffer);
|
||||||
|
free (d_pzbuffer);
|
||||||
|
vid.conbuffer = vid.buffer = NULL;
|
||||||
|
d_pzbuffer = NULL;
|
||||||
|
Sys_Error ("Not enough memory for video mode\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
D_InitCaches (vid_surfcache, cachesize);
|
||||||
|
}
|
||||||
|
|
|
@ -298,59 +298,6 @@ get_mode (char *name, int width, int height, int depth)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
VID_InitBuffers (void)
|
|
||||||
{
|
|
||||||
int buffersize, zbuffersize, cachesize;
|
|
||||||
void *vid_surfcache;
|
|
||||||
|
|
||||||
// Calculate the sizes we want first
|
|
||||||
buffersize = vid.rowbytes * vid.height;
|
|
||||||
zbuffersize = vid.width * vid.height * sizeof (*d_pzbuffer);
|
|
||||||
cachesize = D_SurfaceCacheForRes (vid.width, vid.height);
|
|
||||||
|
|
||||||
// Free the old screen buffer
|
|
||||||
if (vid.buffer) {
|
|
||||||
free (vid.buffer);
|
|
||||||
vid.conbuffer = vid.buffer = NULL;
|
|
||||||
}
|
|
||||||
// Free the old z-buffer
|
|
||||||
if (d_pzbuffer) {
|
|
||||||
free (d_pzbuffer);
|
|
||||||
d_pzbuffer = NULL;
|
|
||||||
}
|
|
||||||
// Free the old surface cache
|
|
||||||
vid_surfcache = D_SurfaceCacheAddress ();
|
|
||||||
if (vid_surfcache) {
|
|
||||||
D_FlushCaches ();
|
|
||||||
free (vid_surfcache);
|
|
||||||
vid_surfcache = NULL;
|
|
||||||
}
|
|
||||||
// Allocate the new screen buffer
|
|
||||||
vid.conbuffer = vid.buffer = calloc (buffersize, 1);
|
|
||||||
if (!vid.conbuffer) {
|
|
||||||
Sys_Error ("Not enough memory for video mode\n");
|
|
||||||
}
|
|
||||||
// Allocate the new z-buffer
|
|
||||||
d_pzbuffer = calloc (zbuffersize, 1);
|
|
||||||
if (!d_pzbuffer) {
|
|
||||||
free (vid.buffer);
|
|
||||||
vid.conbuffer = vid.buffer = NULL;
|
|
||||||
Sys_Error ("Not enough memory for video mode\n");
|
|
||||||
}
|
|
||||||
// Allocate the new surface cache; free the z-buffer if we fail
|
|
||||||
vid_surfcache = calloc (cachesize, 1);
|
|
||||||
if (!vid_surfcache) {
|
|
||||||
free (vid.buffer);
|
|
||||||
free (d_pzbuffer);
|
|
||||||
vid.conbuffer = vid.buffer = NULL;
|
|
||||||
d_pzbuffer = NULL;
|
|
||||||
Sys_Error ("Not enough memory for video mode\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
D_InitCaches (vid_surfcache, cachesize);
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned char *fb_map_addr = 0;
|
static unsigned char *fb_map_addr = 0;
|
||||||
static unsigned long fb_map_length = 0;
|
static unsigned long fb_map_length = 0;
|
||||||
|
|
||||||
|
@ -461,9 +408,6 @@ VID_SetMode (char *name, unsigned char *palette)
|
||||||
vid.conheight = vid.height;
|
vid.conheight = vid.height;
|
||||||
vid.numpages = 1;
|
vid.numpages = 1;
|
||||||
|
|
||||||
vid.maxwarpwidth = WARP_WIDTH;
|
|
||||||
vid.maxwarpheight = WARP_HEIGHT;
|
|
||||||
|
|
||||||
if (fb_map_addr) {
|
if (fb_map_addr) {
|
||||||
if (munmap(fb_map_addr, fb_map_length) == -1) {
|
if (munmap(fb_map_addr, fb_map_length) == -1) {
|
||||||
Sys_Printf("could not unmap framebuffer at %p: %s\n",
|
Sys_Printf("could not unmap framebuffer at %p: %s\n",
|
||||||
|
|
|
@ -344,15 +344,6 @@ extern entity_t *cl_visedicts[MAX_VISEDICTS];
|
||||||
//
|
//
|
||||||
// cl_input
|
// cl_input
|
||||||
//
|
//
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int down[2]; // key nums holding it down
|
|
||||||
int state; // low bit is down state
|
|
||||||
} kbutton_t;
|
|
||||||
|
|
||||||
extern kbutton_t in_mlook, in_klook;
|
|
||||||
extern kbutton_t in_strafe;
|
|
||||||
extern kbutton_t in_speed;
|
|
||||||
|
|
||||||
void CL_InitInput (void);
|
void CL_InitInput (void);
|
||||||
void CL_SendCmd (void);
|
void CL_SendCmd (void);
|
||||||
|
@ -368,10 +359,6 @@ int CL_ReadFromServer (void);
|
||||||
void CL_WriteToServer (usercmd_t *cmd);
|
void CL_WriteToServer (usercmd_t *cmd);
|
||||||
void CL_BaseMove (usercmd_t *cmd);
|
void CL_BaseMove (usercmd_t *cmd);
|
||||||
|
|
||||||
|
|
||||||
float CL_KeyState (kbutton_t *key);
|
|
||||||
char *Key_KeynumToString (int keynum);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_demo.c
|
// cl_demo.c
|
||||||
//
|
//
|
||||||
|
|
|
@ -457,8 +457,8 @@ R_SetupFrame (void)
|
||||||
|
|
||||||
if ((r_dowarp != r_dowarpold) || r_viewchanged) {
|
if ((r_dowarp != r_dowarpold) || r_viewchanged) {
|
||||||
if (r_dowarp) {
|
if (r_dowarp) {
|
||||||
if ((vid.width <= vid.maxwarpwidth)
|
if ((vid.width <= WARP_WIDTH)
|
||||||
&& (vid.height <= vid.maxwarpheight)) {
|
&& (vid.height <= WARP_HEIGHT)) {
|
||||||
vrect.x = 0;
|
vrect.x = 0;
|
||||||
vrect.y = 0;
|
vrect.y = 0;
|
||||||
vrect.width = vid.width;
|
vrect.width = vid.width;
|
||||||
|
@ -469,14 +469,14 @@ R_SetupFrame (void)
|
||||||
w = vid.width;
|
w = vid.width;
|
||||||
h = vid.height;
|
h = vid.height;
|
||||||
|
|
||||||
if (w > vid.maxwarpwidth) {
|
if (w > WARP_WIDTH) {
|
||||||
h *= (float) vid.maxwarpwidth / w;
|
h *= (float) WARP_WIDTH / w;
|
||||||
w = vid.maxwarpwidth;
|
w = WARP_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h > vid.maxwarpheight) {
|
if (h > WARP_HEIGHT) {
|
||||||
h = vid.maxwarpheight;
|
h = WARP_HEIGHT;
|
||||||
w *= (float) vid.maxwarpheight / h;
|
w *= (float) WARP_HEIGHT / h;
|
||||||
}
|
}
|
||||||
|
|
||||||
vrect.x = 0;
|
vrect.x = 0;
|
||||||
|
|
|
@ -31,16 +31,6 @@
|
||||||
|
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
int down[2]; // key nums holding it down
|
|
||||||
int state; // low bit is down state
|
|
||||||
} kbutton_t;
|
|
||||||
|
|
||||||
extern kbutton_t in_mlook, in_klook;
|
|
||||||
extern kbutton_t in_strafe;
|
|
||||||
extern kbutton_t in_speed;
|
|
||||||
|
|
||||||
void CL_Input_Init (void);
|
void CL_Input_Init (void);
|
||||||
void CL_Input_Init_Cvars (void);
|
void CL_Input_Init_Cvars (void);
|
||||||
void CL_ClearStates (void);
|
void CL_ClearStates (void);
|
||||||
|
@ -55,9 +45,4 @@ int CL_ReadFromServer (void);
|
||||||
void CL_WriteToServer (usercmd_t *cmd);
|
void CL_WriteToServer (usercmd_t *cmd);
|
||||||
void CL_BaseMove (usercmd_t *cmd);
|
void CL_BaseMove (usercmd_t *cmd);
|
||||||
|
|
||||||
|
|
||||||
float CL_KeyState (kbutton_t *key);
|
|
||||||
char *Key_KeynumToString (int keynum);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -512,8 +512,8 @@ R_SetupFrame (void)
|
||||||
|
|
||||||
if ((r_dowarp != r_dowarpold) || r_viewchanged) {
|
if ((r_dowarp != r_dowarpold) || r_viewchanged) {
|
||||||
if (r_dowarp) {
|
if (r_dowarp) {
|
||||||
if ((vid.width <= vid.maxwarpwidth) &&
|
if ((vid.width <= WARP_WIDTH) &&
|
||||||
(vid.height <= vid.maxwarpheight)) {
|
(vid.height <= WARP_HEIGHT)) {
|
||||||
vrect.x = 0;
|
vrect.x = 0;
|
||||||
vrect.y = 0;
|
vrect.y = 0;
|
||||||
vrect.width = vid.width;
|
vrect.width = vid.width;
|
||||||
|
@ -524,14 +524,14 @@ R_SetupFrame (void)
|
||||||
w = vid.width;
|
w = vid.width;
|
||||||
h = vid.height;
|
h = vid.height;
|
||||||
|
|
||||||
if (w > vid.maxwarpwidth) {
|
if (w > WARP_WIDTH) {
|
||||||
h *= (float) vid.maxwarpwidth / w;
|
h *= (float) WARP_WIDTH / w;
|
||||||
w = vid.maxwarpwidth;
|
w = WARP_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h > vid.maxwarpheight) {
|
if (h > WARP_HEIGHT) {
|
||||||
h = vid.maxwarpheight;
|
h = WARP_HEIGHT;
|
||||||
w *= (float) vid.maxwarpheight / h;
|
w *= (float) WARP_HEIGHT / h;
|
||||||
}
|
}
|
||||||
|
|
||||||
vrect.x = 0;
|
vrect.x = 0;
|
||||||
|
|
Loading…
Reference in a new issue