some input cleanup, restarts should work a bit better

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2271 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-05-10 22:12:20 +00:00
parent 0d6d61e31c
commit 640524e990
8 changed files with 95 additions and 75 deletions

View file

@ -331,7 +331,7 @@ void IN_Impulse (void)
void IN_Restart (void) void IN_Restart (void)
{ {
IN_Shutdown(); IN_Shutdown();
IN_Init(); IN_ReInit();
} }
/* /*

View file

@ -68,15 +68,12 @@ void IN_Shutdown(void)
inputport = 0; inputport = 0;
} }
} }
void IN_Init() void IN_ReInit()
{ {
/* Cvar_Register (&m_filter, "input controls");*/ /* Cvar_Register (&m_filter, "input controls");*/
Cvar_Register (&in_xflip, "input controls");
inputport = CreatePort(0, 0); inputport = CreatePort(0, 0);
if (inputport == 0) if (inputport == 0)
{ {
@ -106,7 +103,12 @@ void IN_Init()
inputreq->io_Data = (void *)&InputHandler; inputreq->io_Data = (void *)&InputHandler;
inputreq->io_Command = IND_ADDHANDLER; inputreq->io_Command = IND_ADDHANDLER;
DoIO((struct IORequest *)inputreq); DoIO((struct IORequest *)inputreq);
}
void IN_Init(void)
{
Cvar_Register (&in_xflip, "input controls");
IN_ReInit();
} }
static void ExpireRingBuffer() static void ExpireRingBuffer()

View file

@ -284,11 +284,18 @@ void Sys_SendKeyEvents(void)
void IN_Shutdown (void) void IN_Shutdown (void)
{ {
} }
void IN_ReInit (void)
{
IN_ActivateMouse();
}
void IN_Init (void) void IN_Init (void)
{ {
#ifdef IN_XFLIP #ifdef IN_XFLIP
Cvar_Register (&in_xflip, "Input Controls"); Cvar_Register (&in_xflip, "Input Controls");
#endif #endif
IN_ReInit();
} }
void IN_Move (usercmd_t *cmd, int pnum) //add mouse movement to cmd void IN_Move (usercmd_t *cmd, int pnum) //add mouse movement to cmd
{ {

View file

@ -1199,10 +1199,14 @@ void IN_StartupMouse (void)
IN_Init IN_Init
=========== ===========
*/ */
void IN_Init (void) void IN_ReInit (void)
{ {
static qboolean firstinit = true; IN_StartupMouse ();
if (firstinit) IN_StartupJoystick ();
IN_ActivateMouse();
}
void IN_Init (void)
{ {
//keyboard variables //keyboard variables
Cvar_Register (&cl_keypad, "Input Controls"); Cvar_Register (&cl_keypad, "Input Controls");
@ -1271,14 +1275,8 @@ void IN_Init (void)
Cvar_Register (&in_rawinput_combine, "Input Controls"); Cvar_Register (&in_rawinput_combine, "Input Controls");
Cvar_Register (&in_rawinput_rdp, "Input Controls"); Cvar_Register (&in_rawinput_rdp, "Input Controls");
#endif #endif
}
else
{
IN_StartupMouse ();
IN_StartupJoystick ();
}
firstinit = false; IN_ReInit();
} }
/* /*

View file

@ -19,6 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// input.h -- external (non-keyboard) input devices // input.h -- external (non-keyboard) input devices
void IN_ReInit (void);
void IN_Init (void); void IN_Init (void);
void IN_Shutdown (void); void IN_Shutdown (void);

View file

@ -1615,7 +1615,7 @@ TRACE(("dbg: R_ApplyRenderer: renderer inited\n"));
TRACE(("dbg: R_ApplyRenderer: screen inited\n")); TRACE(("dbg: R_ApplyRenderer: screen inited\n"));
Sbar_Flush(); Sbar_Flush();
IN_Init(); IN_ReInit();
} }
else else
{ {

View file

@ -950,12 +950,17 @@ void Force_CenterView_f (void)
cl.viewangles[0][PITCH] = 0; cl.viewangles[0][PITCH] = 0;
} }
void IN_ReInit(void)
{
}
#ifndef SWQUAKE #ifndef SWQUAKE
void IN_Init(void) void IN_Init(void)
{ {
#ifdef IN_XFLIP #ifdef IN_XFLIP
Cvar_Register (&in_xflip, "Input variables"); Cvar_Register (&in_xflip, "Input variables");
#endif #endif
IN_ReInit();
} }
void IN_Shutdown(void) void IN_Shutdown(void)

View file

@ -1263,6 +1263,14 @@ void SWD_EndDirectRect (int x, int y, int width, int height)
// direct drawing of the "accessing disk" icon isn't supported under Linux // direct drawing of the "accessing disk" icon isn't supported under Linux
} }
void IN_ReInit(void)
{
if ( COM_CheckParm ("-nomouse") )
return;
mouse_x = mouse_y = 0.0;
mouseactive = mouse_avail = 1;
}
void IN_Init (void) void IN_Init (void)
{ {
Cvar_Register (&_windowed_mouse, "Input Controls"); Cvar_Register (&_windowed_mouse, "Input Controls");
@ -1271,10 +1279,8 @@ void IN_Init (void)
#ifdef IN_XFLIP #ifdef IN_XFLIP
Cvar_Register (&in_xflip, "Input Controls"); Cvar_Register (&in_xflip, "Input Controls");
#endif #endif
if ( COM_CheckParm ("-nomouse") )
return; IN_ReInit();
mouse_x = mouse_y = 0.0;
mouseactive = mouse_avail = 1;
} }
void IN_Shutdown (void) void IN_Shutdown (void)