mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-05-30 08:40:39 +00:00
Makefile.am: misc. fixes to changelog building.
input.h: Use int_val for freelook cl_input.c: Use freelook macro instead of in_mlook.state in_svgalib.c: freelook support and whitespace in_win.c: whitespace and minor optimization in mouse support in_x11.c: freelook support vid_ggi.c: joystick support and minor opt in mouse support vid_sdl.c: joystick support, freelook support, minor mouse opt, spaces->tabs
This commit is contained in:
parent
40269b2bb5
commit
8903d650d2
8 changed files with 389 additions and 360 deletions
|
@ -10,9 +10,7 @@ EXTRA_DIST = README.WIN newtree.dsw ChangeLog \
|
|||
tools/gas2masm/gas2masm.mak tools/gas2masm/gas2masm.mdp \
|
||||
tools/zpak
|
||||
|
||||
bin_SCRIPTS = ChangeLog
|
||||
|
||||
ChangeLog:
|
||||
changelog::
|
||||
-touch ChangeLog
|
||||
-tools/cvs2cl/cvs2cl.pl
|
||||
-rm -f ChangeLog.bak
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "protocol.h"
|
||||
#include "cvar.h"
|
||||
|
||||
#define freelook (in_mlook.state&1 || cl_freelook->value)
|
||||
#define freelook (in_mlook.state&1 || cl_freelook->int_val)
|
||||
|
||||
void IN_Init (void);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include "in_win.h"
|
||||
#include "input.h"
|
||||
#include "sys.h"
|
||||
#include "sys.h"
|
||||
#include "cvar.h"
|
||||
|
@ -145,7 +145,7 @@ void IN_KLookUp (void) {KeyUp(&in_klook);}
|
|||
void IN_MLookDown (void) {KeyDown(&in_mlook);}
|
||||
void IN_MLookUp (void) {
|
||||
KeyUp(&in_mlook);
|
||||
if ( !(in_mlook.state&1 || cl_freelook->value) && lookspring->value)
|
||||
if ( !freelook && lookspring->value)
|
||||
V_StartPitchDrift();
|
||||
}
|
||||
void IN_UpDown(void) {KeyDown(&in_up);}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "cvar.h"
|
||||
#include "cmd.h"
|
||||
#include "qargs.h"
|
||||
#include "input.h"
|
||||
#include "joystick.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -102,7 +103,8 @@ void Force_CenterView_f(void)
|
|||
}
|
||||
|
||||
|
||||
int IN_Init(void)
|
||||
void
|
||||
IN_Init (void)
|
||||
{
|
||||
if (COM_CheckParm("-nokbd")) UseKeyboard = 0;
|
||||
if (COM_CheckParm("-nomouse")) UseMouse = 0;
|
||||
|
@ -115,10 +117,11 @@ int IN_Init(void)
|
|||
JOY_Init();
|
||||
|
||||
in_svgalib_inited = 1;
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
||||
static void IN_init_kb()
|
||||
static void
|
||||
IN_init_kb (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -232,13 +235,14 @@ static void IN_init_kb()
|
|||
scantokey[111] = K_DEL;
|
||||
scantokey[119] = K_PAUSE;
|
||||
|
||||
if (keyboard_init()) {
|
||||
Sys_Error("keyboard_init() failed");
|
||||
if (keyboard_init ()) {
|
||||
Sys_Error ("keyboard_init() failed");
|
||||
}
|
||||
keyboard_seteventhandler(keyhandler);
|
||||
}
|
||||
|
||||
static void IN_init_mouse()
|
||||
static void
|
||||
IN_init_mouse()
|
||||
{
|
||||
int mtype;
|
||||
char *mousedev;
|
||||
|
@ -339,7 +343,7 @@ void IN_Move(usercmd_t *cmd)
|
|||
while (mouse_update())
|
||||
;
|
||||
|
||||
if (m_filter->value) {
|
||||
if (m_filter->int_val) {
|
||||
mouse_x = (mx + old_mouse_x) * 0.5;
|
||||
mouse_y = (my + old_mouse_y) * 0.5;
|
||||
} else {
|
||||
|
@ -355,23 +359,18 @@ void IN_Move(usercmd_t *cmd)
|
|||
mouse_y *= sensitivity->value;
|
||||
|
||||
/* Add mouse X/Y movement to cmd */
|
||||
if ( (in_strafe.state & 1) ||
|
||||
(lookstrafe->value && (in_mlook.state & 1) )) {
|
||||
if ((in_strafe.state & 1) || (lookstrafe->int_val && freelook)) {
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
} else {
|
||||
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
}
|
||||
|
||||
if ((in_mlook.state & 1)) V_StopPitchDrift();
|
||||
if (freelook)
|
||||
V_StopPitchDrift();
|
||||
|
||||
if ((in_mlook.state & 1) && !(in_strafe.state & 1)) {
|
||||
if (freelook && !(in_strafe.state & 1)) {
|
||||
cl.viewangles[PITCH] += m_pitch->value * mouse_y;
|
||||
if (cl.viewangles[PITCH] > 80) {
|
||||
cl.viewangles[PITCH] = 80;
|
||||
}
|
||||
if (cl.viewangles[PITCH] < -70) {
|
||||
cl.viewangles[PITCH] = -70;
|
||||
}
|
||||
cl.viewangles[PITCH] = bound (-70, cl.viewangles[PITCH], 80);
|
||||
} else {
|
||||
if ((in_strafe.state & 1) && noclip_anglehack) {
|
||||
cmd->upmove -= m_forward->value * mouse_y;
|
||||
|
|
|
@ -717,7 +717,7 @@ void IN_MouseMove (usercmd_t *cmd)
|
|||
mouse_y *= sensitivity->value;
|
||||
|
||||
// add mouse X/Y movement to cmd
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && freelook ))
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && freelook))
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
else
|
||||
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
|
@ -725,16 +725,10 @@ void IN_MouseMove (usercmd_t *cmd)
|
|||
if (freelook)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
if ( freelook && !(in_strafe.state & 1))
|
||||
{
|
||||
if ( freelook && !(in_strafe.state & 1)) {
|
||||
cl.viewangles[PITCH] += m_pitch->value * mouse_y;
|
||||
if (cl.viewangles[PITCH] > 80)
|
||||
cl.viewangles[PITCH] = 80;
|
||||
if (cl.viewangles[PITCH] < -70)
|
||||
cl.viewangles[PITCH] = -70;
|
||||
}
|
||||
else
|
||||
{
|
||||
cl.viewangles[PITCH] = bound (-70, cl.viewangles[PITCH], 80);
|
||||
} else {
|
||||
if ((in_strafe.state & 1) && noclip_anglehack)
|
||||
cmd->upmove -= m_forward->value * mouse_y;
|
||||
else
|
||||
|
|
|
@ -35,11 +35,18 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
|
||||
|
@ -59,12 +66,9 @@
|
|||
#include "console.h"
|
||||
#include "client.h"
|
||||
#include "context_x11.h"
|
||||
#include "qargs.h"
|
||||
#include "input.h"
|
||||
#include "joystick.h"
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#include "qargs.h"
|
||||
|
||||
cvar_t *_windowed_mouse;
|
||||
cvar_t *m_filter;
|
||||
|
@ -302,18 +306,19 @@ void
|
|||
IN_Commands (void)
|
||||
{
|
||||
JOY_Command ();
|
||||
if (old__windowed_mouse != _windowed_mouse->value) {
|
||||
old__windowed_mouse = _windowed_mouse->value;
|
||||
|
||||
if (!_windowed_mouse->value) {
|
||||
if (old__windowed_mouse != _windowed_mouse->int_val) {
|
||||
old__windowed_mouse = _windowed_mouse->int_val;
|
||||
|
||||
if (!_windowed_mouse->int_val) {
|
||||
/* ungrab the pointer */
|
||||
XUngrabPointer(x_disp,CurrentTime);
|
||||
XUngrabPointer (x_disp, CurrentTime);
|
||||
} else {
|
||||
/* grab the pointer */
|
||||
XGrabPointer(x_disp, x_win, True, MOUSE_MASK, GrabModeAsync,
|
||||
XGrabPointer (x_disp, x_win, True, MOUSE_MASK, GrabModeAsync,
|
||||
GrabModeAsync, x_win, None, CurrentTime);
|
||||
//XGrabPointer(x_disp,x_win,True,0,GrabModeAsync,
|
||||
// GrabModeAsync,x_win,None,CurrentTime);
|
||||
// XGrabPointer (x_disp,x_win,True,0,GrabModeAsync,
|
||||
// GrabModeAsync,x_win,None,CurrentTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -335,7 +340,7 @@ IN_Move (usercmd_t *cmd)
|
|||
if (!mouse_avail)
|
||||
return;
|
||||
|
||||
if (m_filter->value) {
|
||||
if (m_filter->int_val) {
|
||||
mouse_x = (mouse_x + old_mouse_x) * 0.5;
|
||||
mouse_y = (mouse_y + old_mouse_y) * 0.5;
|
||||
}
|
||||
|
@ -346,14 +351,15 @@ IN_Move (usercmd_t *cmd)
|
|||
mouse_x *= sensitivity->value;
|
||||
mouse_y *= sensitivity->value;
|
||||
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))
|
||||
if ((in_strafe.state & 1) || (lookstrafe->int_val && freelook))
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
else
|
||||
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
if (in_mlook.state & 1)
|
||||
|
||||
if (freelook)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) {
|
||||
if (freelook && !(in_strafe.state & 1)) {
|
||||
cl.viewangles[PITCH] += m_pitch->value * mouse_y;
|
||||
cl.viewangles[PITCH] = bound (-70, cl.viewangles[PITCH], 80);
|
||||
} else {
|
||||
|
@ -390,13 +396,14 @@ void
|
|||
IN_Shutdown (void)
|
||||
{
|
||||
JOY_Shutdown ();
|
||||
Con_Printf("IN_Shutdown\n");
|
||||
|
||||
Con_Printf ("IN_Shutdown\n");
|
||||
mouse_avail = 0;
|
||||
if (x_disp) {
|
||||
XAutoRepeatOn(x_disp);
|
||||
XAutoRepeatOn (x_disp);
|
||||
|
||||
#ifdef HAVE_DGA
|
||||
XF86DGADirectVideo(x_disp, DefaultScreen(x_disp), 0);
|
||||
XF86DGADirectVideo (x_disp, DefaultScreen (x_disp), 0);
|
||||
#endif
|
||||
}
|
||||
x11_close_display();
|
||||
|
@ -404,7 +411,7 @@ IN_Shutdown (void)
|
|||
|
||||
extern int scr_width, scr_height;
|
||||
|
||||
int
|
||||
void
|
||||
IN_Init (void)
|
||||
{
|
||||
// open the display
|
||||
|
@ -433,7 +440,8 @@ IN_Init (void)
|
|||
|
||||
XAutoRepeatOff(x_disp);
|
||||
|
||||
if (COM_CheckParm("-nomouse")) return 1;
|
||||
if (COM_CheckParm("-nomouse"))
|
||||
return;
|
||||
#ifdef HAVE_DGA
|
||||
in_dgamouse = Cvar_Get ("in_dgamouse", "0", CVAR_ROM,
|
||||
"1 if you have DGA mouse support");
|
||||
|
@ -473,5 +481,5 @@ IN_Init (void)
|
|||
x11_add_event(ButtonRelease, &event_button);
|
||||
x11_add_event(MotionNotify, &event_motion);
|
||||
|
||||
return 1;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -67,6 +67,8 @@
|
|||
#include "d_local.h"
|
||||
#include "input.h"
|
||||
|
||||
#include "joystick.h"
|
||||
|
||||
extern viddef_t vid; // global video state
|
||||
unsigned short d_8to16table[256];
|
||||
|
||||
|
@ -910,6 +912,8 @@ void IN_SendKeyEvents(void)
|
|||
void
|
||||
IN_Init(void)
|
||||
{
|
||||
JOY_Init ();
|
||||
|
||||
_windowed_mouse = Cvar_Get("_windowed_mouse", "0", CVAR_ARCHIVE, "None");
|
||||
old_windowed_mouse = -1; /* Force update */
|
||||
m_filter = Cvar_Get("m_filter", "0", CVAR_ARCHIVE, "None");
|
||||
|
@ -923,6 +927,9 @@ IN_Init(void)
|
|||
void
|
||||
IN_Shutdown(void)
|
||||
{
|
||||
JOY_Shutdown ();
|
||||
|
||||
Con_Printf("IN_Shutdown\n");
|
||||
mouse_avail = 0;
|
||||
}
|
||||
|
||||
|
@ -930,6 +937,8 @@ IN_Shutdown(void)
|
|||
void
|
||||
IN_Commands (void)
|
||||
{
|
||||
JOY_Command ();
|
||||
|
||||
/* Only supported by LibGII 0.7 or later. */
|
||||
#ifdef GII_CMDCODE_PREFER_RELPTR
|
||||
if (old_windowed_mouse != _windowed_mouse->value) {
|
||||
|
@ -952,9 +961,12 @@ IN_Commands (void)
|
|||
void
|
||||
IN_Move(usercmd_t *cmd)
|
||||
{
|
||||
if (!mouse_avail) return;
|
||||
JOY_Move (cmd);
|
||||
|
||||
if (m_filter->value) {
|
||||
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;
|
||||
}
|
||||
|
@ -965,19 +977,16 @@ IN_Move(usercmd_t *cmd)
|
|||
mouse_x *= sensitivity->value;
|
||||
mouse_y *= sensitivity->value;
|
||||
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && freelook ))
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->int_val && freelook))
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
else
|
||||
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
if (freelook)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
if ( freelook && !(in_strafe.state & 1)) {
|
||||
if (freelook && !(in_strafe.state & 1)) {
|
||||
cl.viewangles[PITCH] += m_pitch->value * mouse_y;
|
||||
if (cl.viewangles[PITCH] > 80)
|
||||
cl.viewangles[PITCH] = 80;
|
||||
if (cl.viewangles[PITCH] < -70)
|
||||
cl.viewangles[PITCH] = -70;
|
||||
cl.viewangles[PITCH] = bound (-70, cl.viewangles[PITCH], 80);
|
||||
} else {
|
||||
if ((in_strafe.state & 1) && noclip_anglehack)
|
||||
cmd->upmove -= m_forward->value * mouse_y;
|
||||
|
|
101
source/vid_sdl.c
101
source/vid_sdl.c
|
@ -57,7 +57,7 @@
|
|||
#include "compat.h"
|
||||
#include "d_local.h"
|
||||
#include "input.h"
|
||||
|
||||
#include "joystick.h"
|
||||
|
||||
cvar_t *_windowed_mouse;
|
||||
|
||||
|
@ -92,13 +92,13 @@ static qboolean mouse_avail;
|
|||
static float mouse_x, mouse_y;
|
||||
static int mouse_oldbuttonstate = 0;
|
||||
|
||||
void VID_SetPalette (unsigned char *palette)
|
||||
void
|
||||
VID_SetPalette (unsigned char *palette)
|
||||
{
|
||||
int i;
|
||||
SDL_Color colors[256];
|
||||
|
||||
for ( i=0; i<256; ++i )
|
||||
{
|
||||
for ( i=0; i<256; ++i ) {
|
||||
colors[i].r = *palette++;
|
||||
colors[i].g = *palette++;
|
||||
colors[i].b = *palette++;
|
||||
|
@ -106,12 +106,14 @@ void VID_SetPalette (unsigned char *palette)
|
|||
SDL_SetColors(screen, colors, 0, 256);
|
||||
}
|
||||
|
||||
void VID_ShiftPalette (unsigned char *palette)
|
||||
void
|
||||
VID_ShiftPalette (unsigned char *palette)
|
||||
{
|
||||
VID_SetPalette(palette);
|
||||
}
|
||||
|
||||
void VID_Init (unsigned char *palette)
|
||||
void
|
||||
VID_Init (unsigned char *palette)
|
||||
{
|
||||
int pnum, chunk;
|
||||
byte *cache;
|
||||
|
@ -122,7 +124,7 @@ void VID_Init (unsigned char *palette)
|
|||
|
||||
|
||||
// Load the SDL library
|
||||
if (SDL_Init(SDL_INIT_VIDEO)<0) //|SDL_INIT_AUDIO|SDL_INIT_CDROM) < 0)
|
||||
if (SDL_Init (SDL_INIT_VIDEO) < 0) //|SDL_INIT_AUDIO|SDL_INIT_CDROM) < 0)
|
||||
Sys_Error("VID: Couldn't load SDL: %s", SDL_GetError());
|
||||
|
||||
// Set up display mode (width and height)
|
||||
|
@ -130,8 +132,7 @@ void VID_Init (unsigned char *palette)
|
|||
vid.height = BASEHEIGHT;
|
||||
vid.maxwarpwidth = WARP_WIDTH;
|
||||
vid.maxwarpheight = WARP_HEIGHT;
|
||||
if ((pnum=COM_CheckParm("-winsize")))
|
||||
{
|
||||
if ((pnum=COM_CheckParm("-winsize"))) {
|
||||
if (pnum >= com_argc-2)
|
||||
Sys_Error("VID: -winsize <width> <height>\n");
|
||||
vid.width = atoi(com_argv[pnum+1]);
|
||||
|
@ -173,8 +174,7 @@ void VID_Init (unsigned char *palette)
|
|||
Sys_Error ("Not enough memory for video mode\n");
|
||||
|
||||
// initialize the cache memory
|
||||
cache = (byte *) d_pzbuffer
|
||||
+ vid.width * vid.height * sizeof (*d_pzbuffer);
|
||||
cache = (byte *) d_pzbuffer + vid.width * vid.height * sizeof (*d_pzbuffer);
|
||||
D_InitCaches (cache, cachesize);
|
||||
|
||||
// initialize the mouse
|
||||
|
@ -189,12 +189,14 @@ void VID_Init (unsigned char *palette)
|
|||
|
||||
}
|
||||
|
||||
void VID_Shutdown (void)
|
||||
void
|
||||
VID_Shutdown (void)
|
||||
{
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
void VID_Update (vrect_t *rects)
|
||||
void
|
||||
VID_Update (vrect_t *rects)
|
||||
{
|
||||
SDL_Rect *sdlrects;
|
||||
int n, i;
|
||||
|
@ -210,16 +212,17 @@ void VID_Update (vrect_t *rects)
|
|||
// Second, copy them to SDL rectangles and update
|
||||
if(!(sdlrects=(SDL_Rect *)calloc(1,n*sizeof(SDL_Rect))))
|
||||
Sys_Error("Out of memory!");
|
||||
|
||||
i = 0;
|
||||
for (rect = rects; rect; rect = rect->pnext)
|
||||
{
|
||||
|
||||
for (rect = rects; rect; rect = rect->pnext) {
|
||||
sdlrects[i].x = rect->x;
|
||||
sdlrects[i].y = rect->y;
|
||||
sdlrects[i].w = rect->width;
|
||||
sdlrects[i].h = rect->height;
|
||||
++i;
|
||||
}
|
||||
SDL_UpdateRects(screen, n, sdlrects);
|
||||
SDL_UpdateRects (screen, n, sdlrects);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -227,17 +230,20 @@ void VID_Update (vrect_t *rects)
|
|||
D_BeginDirectRect
|
||||
================
|
||||
*/
|
||||
void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height)
|
||||
void
|
||||
D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height)
|
||||
{
|
||||
Uint8 *offset;
|
||||
|
||||
if (!screen)
|
||||
return;
|
||||
|
||||
if ( x < 0 )
|
||||
x = screen->w+x-1;
|
||||
|
||||
if (!screen) return;
|
||||
if ( x < 0 ) x = screen->w+x-1;
|
||||
offset = (Uint8 *)screen->pixels + y*screen->pitch + x;
|
||||
while ( height-- )
|
||||
{
|
||||
memcpy(offset, pbitmap, width);
|
||||
while (height--) {
|
||||
memcpy (offset, pbitmap, width);
|
||||
offset += screen->pitch;
|
||||
pbitmap += width;
|
||||
}
|
||||
|
@ -249,10 +255,15 @@ void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height)
|
|||
D_EndDirectRect
|
||||
================
|
||||
*/
|
||||
void D_EndDirectRect (int x, int y, int width, int height)
|
||||
void
|
||||
D_EndDirectRect (int x, int y, int width, int height)
|
||||
{
|
||||
if (!screen) return;
|
||||
if (x < 0) x = screen->w+x-1;
|
||||
if (!screen)
|
||||
return;
|
||||
|
||||
if (x < 0)
|
||||
x = screen->w+x-1;
|
||||
|
||||
SDL_UpdateRect(screen, x, y, width, height);
|
||||
}
|
||||
|
||||
|
@ -429,18 +440,23 @@ void IN_SendKeyEvents (void)
|
|||
void
|
||||
IN_Commands (void)
|
||||
{
|
||||
if (old_windowed_mouse != _windowed_mouse->value)
|
||||
{
|
||||
JOY_Command ();
|
||||
|
||||
if (old_windowed_mouse != _windowed_mouse->int_val) {
|
||||
old_windowed_mouse = _windowed_mouse->value;
|
||||
if (!_windowed_mouse->value)
|
||||
SDL_WM_GrabInput (SDL_GRAB_OFF);
|
||||
else
|
||||
|
||||
if (_windowed_mouse->int_val)
|
||||
SDL_WM_GrabInput (SDL_GRAB_ON);
|
||||
else
|
||||
SDL_WM_GrabInput (SDL_GRAB_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
void IN_Init (void)
|
||||
void
|
||||
IN_Init (void)
|
||||
{
|
||||
JOY_Init ();
|
||||
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse","0",CVAR_ARCHIVE,"None");
|
||||
|
||||
if ( COM_CheckParm("-nomouse") && !_windowed_mouse->value)
|
||||
|
@ -450,8 +466,12 @@ void IN_Init (void)
|
|||
mouse_avail = 1;
|
||||
}
|
||||
|
||||
void IN_Shutdown (void)
|
||||
void
|
||||
IN_Shutdown (void)
|
||||
{
|
||||
JOY_Shutdown ();
|
||||
|
||||
Con_Printf ("IN_Shutdown\n");
|
||||
mouse_avail = 0;
|
||||
}
|
||||
|
||||
|
@ -475,27 +495,28 @@ void IN_Frame(void)
|
|||
mouse_oldbuttonstate = mouse_buttonstate;
|
||||
}
|
||||
|
||||
void IN_Move (usercmd_t *cmd)
|
||||
void
|
||||
IN_Move (usercmd_t *cmd)
|
||||
{
|
||||
JOY_Move (cmd);
|
||||
|
||||
if (!mouse_avail)
|
||||
return;
|
||||
|
||||
mouse_x *= sensitivity->value;
|
||||
mouse_y *= sensitivity->value;
|
||||
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1) ))
|
||||
if ( (in_strafe.state & 1) || (lookstrafe->value && freelook))
|
||||
cmd->sidemove += m_side->value * mouse_x;
|
||||
else
|
||||
cl.viewangles[YAW] -= m_yaw->value * mouse_x;
|
||||
if (in_mlook.state & 1)
|
||||
|
||||
if (freelook)
|
||||
V_StopPitchDrift ();
|
||||
|
||||
if ( (in_mlook.state & 1) && !(in_strafe.state & 1)) {
|
||||
if (freelook && !(in_strafe.state & 1)) {
|
||||
cl.viewangles[PITCH] += m_pitch->value * mouse_y;
|
||||
if (cl.viewangles[PITCH] > 80)
|
||||
cl.viewangles[PITCH] = 80;
|
||||
if (cl.viewangles[PITCH] < -70)
|
||||
cl.viewangles[PITCH] = -70;
|
||||
cl.viewangles[PITCH] = bound (-70, cl.viewangles[PITCH], 80);
|
||||
} else {
|
||||
if ((in_strafe.state & 1) && noclip_anglehack)
|
||||
cmd->upmove -= m_forward->value * mouse_y;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue