diff -rupN WQ-X-src//Makefile WQ-Z-src//Makefile
--- WQ-X-src//Makefile	2015-10-21 03:50:03 -0400
+++ WQ-Z-src//Makefile	2015-10-22 03:19:31 -0400
@@ -1,11 +1,11 @@
 CC=gcc
 
-CFLAGS = -O2 -m32 -DWIN32 -DNDEBUG -D_WINDOWS
-CFLAGS += -D_WIN32 -DUSE_CODEC_OGG
+CFLAGS = -O2 -m32 -DNDEBUG -DSDL=1 -D__WIN32__=1 -D_WIN32=1
+CFLAGS += -DUSE_CODEC_OGG
 CFLAGS += -DUSE_CODEC_MP3 
 CFLAGS += -DUSE_CODEC_VORBIS -Is_win32\codecs\include -I/usr/include/directx
-CFLAGS += -DASM386 -D__i386__ -Wno-trigraphs
-LIBS = -lgdi32 -lwinmm -lwsock32 -ldinput -ldxguid -lmad -lvorbisfile -lvorbis -logg -Ls_win32\codecs\x86 -L/usr/lib/directx -mwindows
+CFLAGS += -DASM386 -D__i386__ -Wno-trigraphs -I/usr/include/SDL
+LIBS = -lgdi32 -lwinmm -lwsock32 -ldinput -ldxguid -lmad -lvorbisfile -lvorbis -logg -Ls_win32\codecs\x86 -L/usr/lib/directx -L/usr/lib -lsdl -mwindows
 
 CFLAGS+=-DNDEBUG
 LDFLAGS=-s -m32
@@ -54,14 +54,13 @@ OBJECTS= bgmusic.o \
 	world.o \
 	zone.o \
 	r_varsa.o \
-	cd_win.o \
-	in_win.o \
+	cd_sdl.o \
 	net_wins.o \
-	sys_win.o \
+	sys_sdl.o \
 	conproc.o \
 	net_win.o \
-	snd_win.o \
-	vid_win.o \
+	snd_sdl.o \
+	vid_sdl.o \
 	r_aclip.o \
 	r_alias.o \
 	r_bsp.o \
@@ -110,10 +109,10 @@ OBJECTS= bgmusic.o \
 	d_init.o \
 	winquake.res
 
-all:    Winquake-X
+all:    Winquake-Z
 
-Winquake-X: $(OBJECTS)
-	$(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o Winquake-X.exe
+Winquake-Z: $(OBJECTS)
+	$(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o Winquake-Z.exe
 
 DO_AS=$(CC) -x assembler-with-cpp
 
diff -rupN WQ-X-src//cd_sdl.c WQ-Z-src//cd_sdl.c
--- WQ-X-src//cd_sdl.c	1969-12-31 19:00:00 -0500
+++ WQ-Z-src//cd_sdl.c	2015-10-22 02:18:54 -0400
@@ -0,0 +1,225 @@
+/*
+  Some of this may not work. I'm not overly familiar with SDL, I just sort
+  of podged this together from the SDL headers, and the other cd-rom code.
+
+  Mark Baker <homer1@together.net>
+*/
+
+#include <SDL.h>
+
+#include "quakedef.h"
+
+static qboolean cdValid = false;
+static qboolean initialized = false;
+static qboolean enabled = true;
+static qboolean playLooping = false;
+static SDL_CD *cd_id;
+static float cdvolume = 1.0;
+
+static void CD_f();
+
+static void CDAudio_Eject()
+{
+	if(!cd_id || !enabled) return;
+
+	if(SDL_CDEject(cd_id))
+		Con_DPrintf("Unable to eject CD-ROM tray.\n");
+}
+
+int CDAudio_Play(byte track, qboolean looping)
+{
+	CDstatus cd_stat;
+	if(!cd_id || !enabled) return -1;
+	
+	if(!cdValid)
+	{
+		if(!CD_INDRIVE(cd_stat=SDL_CDStatus(cd_id)) ||(!cd_id->numtracks)) return;
+		cdValid = true;
+	}
+
+	if((track < 1) || (track >= cd_id->numtracks))
+	{
+		Con_DPrintf("CDAudio: Bad track number: %d\n",track);
+		return -1;
+	}
+	track--; /* Convert track from person to SDL value */
+	if(cd_stat == CD_PLAYING)
+	{
+		if(cd_id->cur_track == track) return;
+		CDAudio_Stop();
+	}
+
+	if(SDL_CDPlay(cd_id,cd_id->track[track].offset,
+			  cd_id->track[track].length))
+	{
+		Con_DPrintf("CDAudio_Play: Unable to play track: %d\n",track+1);
+		return -1;
+	}
+	playLooping = looping;
+
+	return 0;
+}
+
+
+void CDAudio_Stop()
+{
+	int cdstate;
+	if(!cd_id || !enabled) return;
+	cdstate = SDL_CDStatus(cd_id);
+	if((cdstate != CD_PLAYING) && (cdstate != CD_PAUSED)) return;
+
+	if(SDL_CDStop(cd_id))
+		Con_DPrintf("CDAudio_Stop: Failed to stop track.\n");
+}
+
+void CDAudio_Pause()
+{
+	if(!cd_id || !enabled) return;
+	if(SDL_CDStatus(cd_id) != CD_PLAYING) return;
+
+	if(SDL_CDPause(cd_id))
+		Con_DPrintf("CDAudio_Pause: Failed to pause track.\n");
+}
+
+
+void CDAudio_Resume()
+{
+	if(!cd_id || !enabled) return;
+	if(SDL_CDStatus(cd_id) != CD_PAUSED) return;
+
+	if(SDL_CDResume(cd_id))
+		Con_DPrintf("CDAudio_Resume: Failed tp resume track.\n");
+}
+
+void CDAudio_Update()
+{
+	if(!cd_id || !enabled) return;
+	if(bgmvolume.value != cdvolume)
+	{
+		if(cdvolume)
+		{
+			Cvar_SetValue("bgmvolume",0.0);
+			CDAudio_Pause();
+		}
+		else
+		{
+			Cvar_SetValue("bgmvolume",1.0);
+			CDAudio_Resume();
+		}
+		cdvolume = bgmvolume.value;
+		return;
+	}
+	if(playLooping && (SDL_CDStatus(cd_id) != CD_PLAYING)
+		 && (SDL_CDStatus(cd_id) != CD_PAUSED))
+		CDAudio_Play(cd_id->cur_track+1,true);
+}
+
+int CDAudio_Init()
+{
+	if((cls.state == ca_dedicated) || COM_CheckParm("-nocdaudio"))
+		return -1;
+		
+	cd_id = SDL_CDOpen(0);
+	if(!cd_id)
+	{
+		Con_Printf("CDAudio_Init: Unable to open default CD-ROM drive: %s\n",
+			SDL_GetError());
+		return -1;
+	}
+	
+	initialized = true;
+	enabled = true;
+	cdValid = true;
+	
+	if(!CD_INDRIVE(SDL_CDStatus(cd_id)))
+	{
+		Con_Printf("CDAudio_Init: No CD in drive.\n");
+		cdValid = false;
+	}
+	if(!cd_id->numtracks)
+	{
+		Con_Printf("CDAudio_Init: CD contains no audio tracks.\n");
+		cdValid = false;
+	}
+	Cmd_AddCommand("cd",CD_f);
+	Con_Printf("CD Audio Initialized.\n");
+	return 0;
+}
+
+
+void CDAudio_Shutdown()
+{
+	if(!cd_id) return;
+	CDAudio_Stop();
+	SDL_CDClose(cd_id);
+	cd_id = NULL;
+}
+
+static void CD_f()
+{
+	char *command;
+	int cdstate;
+	if(Cmd_Argc() < 2) return;
+
+	command = Cmd_Argv(1);
+	if(!Q_strcasecmp(command,"on"))
+	{
+		enabled = true;
+	}
+	if(!Q_strcasecmp(command,"off"))
+	{
+		if(!cd_id) return;
+		cdstate = SDL_CDStatus(cd_id);
+		if((cdstate == CD_PLAYING) || (cdstate == CD_PAUSED))
+			CDAudio_Stop();
+		enabled = false;
+		return;
+	}
+	if(!Q_strcasecmp(command,"play"))
+	{
+		CDAudio_Play(Q_atoi(Cmd_Argv(2)),false);
+		return;
+	}
+	if(!Q_strcasecmp(command,"loop"))
+	{
+		CDAudio_Play(Q_atoi(Cmd_Argv(2)),true);
+		return;
+	}
+	if(!Q_strcasecmp(command,"stop"))
+	{
+		CDAudio_Stop();
+		return;
+	}
+	if(!Q_strcasecmp(command,"pause"))
+	{
+		CDAudio_Pause();
+		return;
+	}
+	if(!Q_strcasecmp(command,"resume"))
+	{
+		CDAudio_Resume();
+		return;
+	}
+	if(!Q_strcasecmp(command,"eject"))
+	{
+		CDAudio_Eject();
+		return;
+	}
+	if(!Q_strcasecmp(command,"info"))
+	{
+		if(!cd_id) return;
+		cdstate = SDL_CDStatus(cd_id);
+		Con_Printf("%d tracks\n",cd_id->numtracks);
+		if(cdstate == CD_PLAYING)
+			Con_Printf("Currently %s track %d\n",
+				playLooping ? "looping" : "playing",
+				cd_id->cur_track+1);
+		else
+		if(cdstate == CD_PAUSED)
+			Con_Printf("Paused %s track %d\n",
+				playLooping ? "looping" : "playing",
+				cd_id->cur_track+1);
+		return;
+	}
+}
+
diff -rupN WQ-X-src//cl_parse.c WQ-Z-src//cl_parse.c
--- WQ-X-src//cl_parse.c	2015-10-21 03:50:03 -0400
+++ WQ-Z-src//cl_parse.c	2015-10-21 23:19:50 -0400
@@ -887,13 +887,13 @@ void CL_ParseServerMessage (void)
 				{
 					CDAudio_Pause ();
 					BGM_Pause ();
-					VID_HandlePause (true);
+					// VID_HandlePause (true);
 				}
 				else
 				{
 					CDAudio_Resume ();
 					BGM_Resume ();
-					VID_HandlePause (false);
+					// VID_HandlePause (false);
 				}
 			}
 			break;
diff -rupN WQ-X-src//common.c WQ-Z-src//common.c
--- WQ-X-src//common.c	2015-10-21 03:50:03 -0400
+++ WQ-Z-src//common.c	2015-10-22 02:43:49 -0400
@@ -434,6 +434,10 @@ float Q_atof (char *str)
 ============================================================================
 */
 
+#ifdef SDL
+#include "SDL_byteorder.h"
+#endif
+
 qboolean        bigendien;
 qboolean        host_bigendian;
 
@@ -1146,7 +1150,12 @@ void COM_Init (char *basedir)
 	byte    swaptest[2] = {1,0};
 
 // set the byte swapping variables in a portable manner 
+#ifdef SDL
+	// This is necessary because egcs 1.1.1 mis-compiles swaptest with -O2
+	if ( SDL_BYTEORDER == SDL_LIL_ENDIAN )
+#else
 	if ( *(short *)swaptest == 1)
+#endif
 	{
 		bigendien = false;
 		BigShort = ShortSwap;
@@ -1462,7 +1471,7 @@ int COM_FindFile (char *filename, int *h
 				else
 					sprintf (cachepath,"%s%s", com_cachedir, netpath+2);
 #else
-				sprintf (cachepath,"%s%s", com_cachedir, netpath);
+				sprintf (cachepath,"%s/%s", com_cachedir, netpath);
 #endif
 
 				cachetime = Sys_FileTime (cachepath);
@@ -2003,6 +2012,9 @@ char *FS_fgets(char *s, int size, fshand
     return ret;
 }
 
+#define	snprintf		_snprintf
+#define	vsnprintf		_vsnprintf
+
 void Q_snprintfz (char *dest, size_t size, char *fmt, ...)
 {
     va_list      argptr;
@@ -2012,3 +2024,127 @@ void Q_snprintfz (char *dest, size_t siz
 
     dest[size - 1] = 0;
 }
+
+int q_vsnprintf(char *str, size_t size, const char *format, va_list args)
+{
+	int		ret;
+
+	ret = vsnprintf (str, size, format, args);
+
+	if (ret < 0)
+		ret = (int)size;
+	if (size == 0)	/* no buffer */
+		return ret;
+	if ((size_t)ret >= size)
+		str[size - 1] = '\0';
+
+	return ret;
+}
+
+int q_snprintf (char *str, size_t size, const char *format, ...)
+{
+	int		ret;
+	va_list		argptr;
+
+	va_start (argptr, format);
+	ret = q_vsnprintf (str, size, format, argptr);
+	va_end (argptr);
+
+	return ret;
+}
+
+
+/*
+============================================================================
+
+					LIBRARY REPLACEMENT FUNCTIONS
+
+============================================================================
+*/
+
+int q_islower(int c)
+{
+	return (c >= 'a' && c <= 'z');
+}
+
+int q_isupper(int c)
+{
+	return (c >= 'A' && c <= 'Z');
+}
+
+int q_tolower(int c)
+{
+	return ((q_isupper(c)) ? (c | ('a' - 'A')) : c);
+}
+
+int q_toupper(int c)
+{
+	return ((q_islower(c)) ? (c & ~('a' - 'A')) : c);
+}
+
+int q_strcasecmp(const char * s1, const char * s2)
+{
+	const char * p1 = s1;
+	const char * p2 = s2;
+	char c1, c2;
+
+	if (p1 == p2)
+		return 0;
+
+	do
+	{
+		c1 = q_tolower (*p1++);
+		c2 = q_tolower (*p2++);
+		if (c1 == '\0')
+			break;
+	} while (c1 == c2);
+
+	return (int)(c1 - c2);
+}
+
+int q_strncasecmp(const char *s1, const char *s2, size_t n)
+{
+	const char * p1 = s1;
+	const char * p2 = s2;
+	char c1, c2;
+
+	if (p1 == p2 || n == 0)
+		return 0;
+
+	do
+	{
+		c1 = q_tolower (*p1++);
+		c2 = q_tolower (*p2++);
+		if (c1 == '\0' || c1 != c2)
+			break;
+	} while (--n > 0);
+
+	return (int)(c1 - c2);
+}
+
+
+
+/*
+============
+COM_FileGetExtension - doesn't return NULL
+============
+*/
+const char *COM_FileGetExtension (const char *in)
+{
+	const char	*src;
+	size_t		len;
+
+	len = strlen(in);
+	if (len < 2)	/* nothing meaningful */
+		return "";
+
+	src = in + len - 1;
+	while (src != in && src[-1] != '.')
+		src--;
+	if (src == in || strchr(src, '/') != NULL || strchr(src, '\\') != NULL)
+		return "";	/* no extension, or parent directory has a dot */
+
+	return src;
+}
+
+
diff -rupN WQ-X-src//console.c WQ-Z-src//console.c
--- WQ-X-src//console.c	2015-10-21 03:50:03 -0400
+++ WQ-Z-src//console.c	2015-10-21 22:31:58 -0400
@@ -253,6 +253,7 @@ Con_Linefeed
 */
 void Con_Linefeed (void)
 {
+	if ( ! con_initialized ) return;
 	con_x = 0;
 	con_current++;
 	Q_memset (&con_text[(con_current%con_totallines)*con_linewidth]
@@ -275,6 +276,7 @@ void Con_Print (char *txt)
 	static int	cr;
 	int		mask;
 	
+	if ( ! con_initialized ) return;
 	con_backscroll = 0;
 
 	if (txt[0] == 1)
diff -rupN WQ-X-src//d_vars.c WQ-Z-src//d_vars.c
--- WQ-X-src//d_vars.c	2015-10-21 03:50:03 -0400
+++ WQ-Z-src//d_vars.c	2015-10-21 22:31:59 -0400
@@ -19,10 +19,10 @@ Foundation, Inc., 59 Temple Place - Suit
 */
 // r_vars.c: global refresh variables
 
-#if	!id386
-
 #include	"quakedef.h"
 
+#if	!id386
+
 // all global and static refresh variables are collected in a contiguous block
 // to avoid cache conflicts.
 
diff -rupN WQ-X-src//menu.c WQ-Z-src//menu.c
--- WQ-X-src//menu.c	2015-10-21 03:50:04 -0400
+++ WQ-Z-src//menu.c	2015-10-21 23:46:41 -0400
@@ -1036,7 +1036,8 @@ again:
 //=============================================================================
 /* OPTIONS MENU */
 
-#ifdef _WIN32
+#if 0
+// #ifdef _WIN32
 #define	OPTIONS_ITEMS	14
 #else
 #define	OPTIONS_ITEMS	13
@@ -1052,7 +1053,8 @@ void M_Menu_Options_f (void)
 	m_state = m_options;
 	m_entersound = true;
 
-#ifdef _WIN32
+#if 0
+// #ifdef _WIN32
 	if ((options_cursor == 13) && (modestate != MS_WINDOWED))
 	{
 		options_cursor = 0;
@@ -1133,7 +1135,8 @@ void M_AdjustSliders (int dir)
 		Cvar_SetValue ("lookstrafe", !lookstrafe.value);
 		break;
 
-#ifdef _WIN32
+#if 0
+// #ifdef _WIN32
 	case 13:	// _windowed_mouse
 		Cvar_SetValue ("_windowed_mouse", !_windowed_mouse.value);
 		break;
@@ -1219,7 +1222,8 @@ void M_Options_Draw (void)
 	if (vid_menudrawfn)
 		M_Print (16, 128, "         Video Options");
 
-#ifdef _WIN32
+#if 0
+// #ifdef _WIN32
 	if (modestate == MS_WINDOWED)
 	{
 		M_Print (16, 136, "             Use Mouse");
@@ -1294,7 +1298,8 @@ void M_Options_Key (int k)
 			options_cursor = 0;
 	}
 
-#ifdef _WIN32
+#if 0
+// #ifdef _WIN32
 	if ((options_cursor == 13) && (modestate != MS_WINDOWED))
 	{
 		if (k == K_UPARROW)
diff -rupN WQ-X-src//snd_dma.c WQ-Z-src//snd_dma.c
--- WQ-X-src//snd_dma.c	2015-10-21 03:50:05 -0400
+++ WQ-Z-src//snd_dma.c	2015-10-21 22:56:50 -0400
@@ -229,7 +229,9 @@ void S_Init (void)
 		shm->buffer = Hunk_AllocName(1<<16, "shmbuf");
 	}
 
-	Con_Printf ("Sound sampling rate: %i\n", shm->speed);
+	if ( shm ) {
+		Con_Printf ("Sound sampling rate: %i\n", shm->speed);
+	}
 
 	// provides a tick sound until washed clean
 
@@ -650,11 +652,13 @@ void S_ClearBuffer (void)
 {
 	int		clear;
 		
+/*
 #ifdef _WIN32
 	if (!sound_started || !shm || (!shm->buffer && !pDSBuf))
-#else
+#else */
 	if (!sound_started || !shm || !shm->buffer)
-#endif
+// #endif
+
 		return;
 
 	if (shm->samplebits == 8)
@@ -662,7 +666,8 @@ void S_ClearBuffer (void)
 	else
 		clear = 0;
 
-#ifdef _WIN32
+#if 0
+// #ifdef _WIN32
 	if (pDSBuf)
 	{
 		DWORD	dwSize;
@@ -930,7 +935,8 @@ void GetSoundtime(void)
 void S_ExtraUpdate (void)
 {
 
-#ifdef _WIN32
+#if 0
+// #ifdef _WIN32
 	IN_Accumulate ();
 #endif
 
@@ -941,6 +947,8 @@ void S_ExtraUpdate (void)
 
 void S_Update_(void)
 {
+#ifndef SDL
+
 	unsigned        endtime;
 	int				samps;
 	
@@ -963,7 +971,8 @@ void S_Update_(void)
 	if (endtime - soundtime > samps)
 		endtime = soundtime + samps;
 
-#ifdef _WIN32
+#if 0
+// #ifdef _WIN32
 // if the buffer was lost or stopped, restore it and/or restart it
 	{
 		DWORD	dwStatus;
@@ -985,6 +994,7 @@ void S_Update_(void)
 	S_PaintChannels (endtime);
 
 	SNDDMA_Submit ();
+#endif /* ! SDL */
 }
 
 /*
diff -rupN WQ-X-src//snd_mix.c WQ-Z-src//snd_mix.c
--- WQ-X-src//snd_mix.c	2015-10-21 03:50:05 -0400
+++ WQ-Z-src//snd_mix.c	2015-10-21 22:57:47 -0400
@@ -79,7 +79,8 @@ void S_TransferStereo16 (int endtime)
 	snd_p = (int *) paintbuffer;
 	lpaintedtime = paintedtime;
 
-#ifdef _WIN32
+#if 0
+// #ifdef _WIN32
 	if (pDSBuf)
 	{
 		reps = 0;
@@ -130,7 +131,8 @@ void S_TransferStereo16 (int endtime)
 		lpaintedtime += (snd_linear_count>>1);
 	}
 
-#ifdef _WIN32
+#if 0
+// #ifdef _WIN32
 	if (pDSBuf)
 		pDSBuf->lpVtbl->Unlock(pDSBuf, pbuf, dwSize, NULL, 0);
 #endif
@@ -146,7 +148,8 @@ void S_TransferPaintBuffer(int endtime)
 	int		val;
 	int		snd_vol;
 	DWORD	*pbuf;
-#ifdef _WIN32
+#if 0
+// #ifdef _WIN32
 	int		reps;
 	DWORD	dwSize,dwSize2;
 	DWORD	*pbuf2;
@@ -166,7 +169,8 @@ void S_TransferPaintBuffer(int endtime)
 	step = 3 - shm->channels;
 	snd_vol = volume.value*256;
 
-#ifdef _WIN32
+#if 0
+// #ifdef _WIN32
 	if (pDSBuf)
 	{
 		reps = 0;
@@ -227,7 +231,8 @@ void S_TransferPaintBuffer(int endtime)
 		}
 	}
 
-#ifdef _WIN32
+#if 0
+// #ifdef _WIN32
 	if (pDSBuf) {
 		DWORD dwNewpos, dwWrite;
 		int il = paintedtime;
diff -rupN WQ-X-src//snd_sdl.c WQ-Z-src//snd_sdl.c
--- WQ-X-src//snd_sdl.c	1969-12-31 19:00:00 -0500
+++ WQ-Z-src//snd_sdl.c	2015-10-21 22:31:59 -0400
@@ -0,0 +1,112 @@
+
+#include <stdio.h>
+#include "SDL_audio.h"
+#include "SDL_byteorder.h"
+#include "quakedef.h"
+
+static dma_t the_shm;
+static int snd_inited;
+
+extern int desired_speed;
+extern int desired_bits;
+
+static void paint_audio(void *unused, Uint8 *stream, int len)
+{
+	if ( shm ) {
+		shm->buffer = stream;
+		shm->samplepos += len/(shm->samplebits/8)/2;
+		// Check for samplepos overflow?
+		S_PaintChannels (shm->samplepos);
+	}
+}
+
+qboolean SNDDMA_Init(void)
+{
+	SDL_AudioSpec desired, obtained;
+
+	snd_inited = 0;
+
+	/* Set up the desired format */
+	desired.freq = desired_speed;
+	switch (desired_bits) {
+		case 8:
+			desired.format = AUDIO_U8;
+			break;
+		case 16:
+			if ( SDL_BYTEORDER == SDL_BIG_ENDIAN )
+				desired.format = AUDIO_S16MSB;
+			else
+				desired.format = AUDIO_S16LSB;
+			break;
+		default:
+        		Con_Printf("Unknown number of audio bits: %d\n",
+								desired_bits);
+			return 0;
+	}
+	desired.channels = 2;
+	desired.samples = 512;
+	desired.callback = paint_audio;
+
+	/* Open the audio device */
+	if ( SDL_OpenAudio(&desired, &obtained) < 0 ) {
+        	Con_Printf("Couldn't open SDL audio: %s\n", SDL_GetError());
+		return 0;
+	}
+
+	/* Make sure we can support the audio format */
+	switch (obtained.format) {
+		case AUDIO_U8:
+			/* Supported */
+			break;
+		case AUDIO_S16LSB:
+		case AUDIO_S16MSB:
+			if ( ((obtained.format == AUDIO_S16LSB) &&
+			     (SDL_BYTEORDER == SDL_LIL_ENDIAN)) ||
+			     ((obtained.format == AUDIO_S16MSB) &&
+			     (SDL_BYTEORDER == SDL_BIG_ENDIAN)) ) {
+				/* Supported */
+				break;
+			}
+			/* Unsupported, fall through */;
+		default:
+			/* Not supported -- force SDL to do our bidding */
+			SDL_CloseAudio();
+			if ( SDL_OpenAudio(&desired, NULL) < 0 ) {
+        			Con_Printf("Couldn't open SDL audio: %s\n",
+							SDL_GetError());
+				return 0;
+			}
+			memcpy(&obtained, &desired, sizeof(desired));
+			break;
+	}
+	SDL_PauseAudio(0);
+
+	/* Fill the audio DMA information block */
+	shm = &the_shm;
+	shm->splitbuffer = 0;
+	shm->samplebits = (obtained.format & 0xFF);
+	shm->speed = obtained.freq;
+	shm->channels = obtained.channels;
+	shm->samples = obtained.samples*shm->channels;
+	shm->samplepos = 0;
+	shm->submission_chunk = 1;
+	shm->buffer = NULL;
+
+	snd_inited = 1;
+	return 1;
+}
+
+int SNDDMA_GetDMAPos(void)
+{
+	return shm->samplepos;
+}
+
+void SNDDMA_Shutdown(void)
+{
+	if (snd_inited)
+	{
+		SDL_CloseAudio();
+		snd_inited = 0;
+	}
+}
+
diff -rupN WQ-X-src//sys_sdl.c WQ-Z-src//sys_sdl.c
--- WQ-X-src//sys_sdl.c	1969-12-31 19:00:00 -0500
+++ WQ-Z-src//sys_sdl.c	2015-10-22 20:32:01 -0400
@@ -0,0 +1,454 @@
+#include <unistd.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#ifndef __WIN32__
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <sys/mman.h>
+#endif
+
+#include "quakedef.h"
+
+qboolean			isDedicated;
+
+int noconinput = 0;
+
+char *basedir = ".";
+char *cachedir = NULL;
+
+cvar_t  sys_linerefresh = {"sys_linerefresh","0"};// set for entity display
+cvar_t  sys_nostdout = {"sys_nostdout","1"};
+
+// =======================================================================
+// General routines
+// =======================================================================
+
+void Sys_DebugNumber(int y, int val)
+{
+}
+
+void Sys_Printf (char *fmt, ...)
+{
+	va_list		argptr;
+	char		text[1024];
+	
+	va_start (argptr,fmt);
+	vsprintf (text,fmt,argptr);
+	va_end (argptr);
+	fprintf(stderr, "%s", text);
+	
+	//Con_Print (text);
+}
+
+void Sys_Quit (void)
+{
+	Host_Shutdown();
+	exit(0);
+}
+
+void Sys_Init(void)
+{
+#if id386
+	Sys_SetFPCW();
+#endif
+}
+
+#if !id386
+
+/*
+================
+Sys_LowFPPrecision
+================
+*/
+void Sys_LowFPPrecision (void)
+{
+// causes weird problems on Nextstep
+}
+
+
+/*
+================
+Sys_HighFPPrecision
+================
+*/
+void Sys_HighFPPrecision (void)
+{
+// causes weird problems on Nextstep
+}
+
+#endif	// !id386
+
+
+void Sys_Error (char *error, ...)
+{ 
+    va_list     argptr;
+    char        string[1024];
+
+    va_start (argptr,error);
+    vsprintf (string,error,argptr);
+    va_end (argptr);
+	fprintf(stderr, "Error: %s\n", string);
+
+	Host_Shutdown ();
+	exit (1);
+
+} 
+
+void Sys_Warn (char *warning, ...)
+{ 
+    va_list     argptr;
+    char        string[1024];
+    
+    va_start (argptr,warning);
+    vsprintf (string,warning,argptr);
+    va_end (argptr);
+	fprintf(stderr, "Warning: %s", string);
+} 
+
+/*
+===============================================================================
+
+FILE IO
+
+===============================================================================
+*/
+
+#define	MAX_HANDLES		20
+FILE	*sys_handles[MAX_HANDLES];
+
+int		findhandle (void)
+{
+	int		i;
+	
+	for (i=1 ; i<MAX_HANDLES ; i++)
+		if (!sys_handles[i])
+			return i;
+	Sys_Error ("out of handles");
+	return -1;
+}
+
+/*
+================
+Qfilelength
+================
+*/
+static int Qfilelength (FILE *f)
+{
+	int		pos;
+	int		end;
+
+	pos = ftell (f);
+	fseek (f, 0, SEEK_END);
+	end = ftell (f);
+	fseek (f, pos, SEEK_SET);
+
+	return end;
+}
+
+int Sys_FileOpenRead (char *path, int *hndl)
+{
+	FILE	*f;
+	int		i;
+	
+	i = findhandle ();
+
+	f = fopen(path, "rb");
+	if (!f)
+	{
+		*hndl = -1;
+		return -1;
+	}
+	sys_handles[i] = f;
+	*hndl = i;
+	
+	return Qfilelength(f);
+}
+
+int Sys_FileOpenWrite (char *path)
+{
+	FILE	*f;
+	int		i;
+	
+	i = findhandle ();
+
+	f = fopen(path, "wb");
+	if (!f)
+		Sys_Error ("Error opening %s: %s", path,strerror(errno));
+	sys_handles[i] = f;
+	
+	return i;
+}
+
+void Sys_FileClose (int handle)
+{
+	if ( handle >= 0 ) {
+		fclose (sys_handles[handle]);
+		sys_handles[handle] = NULL;
+	}
+}
+
+void Sys_FileSeek (int handle, int position)
+{
+	if ( handle >= 0 ) {
+		fseek (sys_handles[handle], position, SEEK_SET);
+	}
+}
+
+int Sys_FileRead (int handle, void *dst, int count)
+{
+	char *data;
+	int size, done;
+
+	size = 0;
+	if ( handle >= 0 ) {
+		data = dst;
+		while ( count > 0 ) {
+			done = fread (data, 1, count, sys_handles[handle]);
+			if ( done == 0 ) {
+				break;
+			}
+			data += done;
+			count -= done;
+			size += done;
+		}
+	}
+	return size;
+		
+}
+
+int Sys_FileWrite (int handle, void *src, int count)
+{
+	char *data;
+	int size, done;
+
+	size = 0;
+	if ( handle >= 0 ) {
+		data = src;
+		while ( count > 0 ) {
+			done = fread (data, 1, count, sys_handles[handle]);
+			if ( done == 0 ) {
+				break;
+			}
+			data += done;
+			count -= done;
+			size += done;
+		}
+	}
+	return size;
+}
+
+int	Sys_FileTime (char *path)
+{
+	FILE	*f;
+	
+	f = fopen(path, "rb");
+	if (f)
+	{
+		fclose(f);
+		return 1;
+	}
+	
+	return -1;
+}
+
+void Sys_mkdir (char *path)
+{
+#ifdef __WIN32__
+    mkdir (path);
+#else
+    mkdir (path, 0777);
+#endif
+}
+
+void Sys_DebugLog(char *file, char *fmt, ...)
+{
+    va_list argptr; 
+    static char data[1024];
+    FILE *fp;
+    
+    va_start(argptr, fmt);
+    vsprintf(data, fmt, argptr);
+    va_end(argptr);
+    fp = fopen(file, "a");
+    fwrite(data, strlen(data), 1, fp);
+    fclose(fp);
+}
+
+double Sys_FloatTime (void)
+{
+#ifdef __WIN32__
+
+	static int starttime = 0;
+
+	if ( ! starttime )
+		starttime = clock();
+
+	return (clock()-starttime)*1.0/1024;
+
+#else
+
+    struct timeval tp;
+    struct timezone tzp; 
+    static int      secbase; 
+    
+    gettimeofday(&tp, &tzp);  
+
+    if (!secbase)
+    {
+        secbase = tp.tv_sec;
+        return tp.tv_usec/1000000.0;
+    }
+
+    return (tp.tv_sec - secbase) + tp.tv_usec/1000000.0;
+
+#endif
+}
+
+// =======================================================================
+// Sleeps for microseconds
+// =======================================================================
+
+static volatile int oktogo;
+
+void alarm_handler(int x)
+{
+	oktogo=1;
+}
+
+byte *Sys_ZoneBase (int *size)
+{
+/*
+	char *QUAKEOPT = getenv("QUAKEOPT");
+
+	*size = 0xc00000;
+	if (QUAKEOPT)
+	{
+		while (*QUAKEOPT)
+			if (tolower(*QUAKEOPT++) == 'm')
+			{
+				*size = atof(QUAKEOPT) * 1024*1024;
+				break;
+			}
+	}
+	return malloc (*size);
+*/
+}
+
+void Sys_LineRefresh(void)
+{
+}
+
+void Sys_Sleep(void)
+{
+	SDL_Delay(1);
+}
+
+void floating_point_exception_handler(int whatever)
+{
+//	Sys_Warn("floating point exception\n");
+	signal(SIGFPE, floating_point_exception_handler);
+}
+
+void moncontrol(int x)
+{
+}
+
+int main (int c, char **v)
+{
+
+	double		time, oldtime, newtime;
+	quakeparms_t parms;
+	extern int vcrFile;
+	extern int recording;
+	static int frame;
+
+	moncontrol(0);
+
+//	signal(SIGFPE, floating_point_exception_handler);
+//	signal(SIGFPE, SIG_IGN);
+
+	parms.memsize = 16*1024*1024;  // 8*1024*1024;
+	parms.membase = malloc (parms.memsize);
+	parms.basedir = basedir;
+	parms.cachedir = cachedir;
+
+	COM_InitArgv(c, v);
+	parms.argc = com_argc;
+	parms.argv = com_argv;
+
+	Sys_Init();
+
+    Host_Init(&parms);
+
+	Cvar_RegisterVariable (&sys_nostdout);
+
+    oldtime = Sys_FloatTime () - 0.1;
+    while (1)
+    {
+// find time spent rendering last frame
+        newtime = Sys_FloatTime ();
+        time = newtime - oldtime;
+
+        if (cls.state == ca_dedicated)
+        {   // play vcrfiles at max speed
+            if (time < sys_ticrate.value && (vcrFile == -1 || recording) )
+            {
+                SDL_Delay (1);
+                continue;       // not time to run a server only tic yet
+            }
+            time = sys_ticrate.value;
+        }
+
+        if (time > sys_ticrate.value*2)
+            oldtime = newtime;
+        else
+            oldtime += time;
+
+        if (++frame > 10)
+            moncontrol(1);      // profile only while we do each Quake frame
+        Host_Frame (time);
+        moncontrol(0);
+
+// graphic debugging aids
+        if (sys_linerefresh.value)
+            Sys_LineRefresh ();
+    }
+
+}
+
+
+/*
+================
+Sys_MakeCodeWriteable
+================
+*/
+void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
+{
+
+	int r;
+	unsigned long addr;
+	int psize = getpagesize();
+
+	fprintf(stderr, "writable code %lx-%lx\n", startaddr, startaddr+length);
+
+	addr = startaddr & ~(psize-1);
+
+	r = mprotect((char*)addr, length + startaddr - addr, 7);
+
+	if (r < 0)
+    		Sys_Error("Protection change failed\n");
+
+}
+
diff -rupN WQ-X-src//vid_sdl.c WQ-Z-src//vid_sdl.c
--- WQ-X-src//vid_sdl.c	1969-12-31 19:00:00 -0500
+++ WQ-Z-src//vid_sdl.c	2015-10-22 20:31:23 -0400
@@ -0,0 +1,392 @@
+// vid_sdl.h -- sdl video driver 
+
+#include "SDL.h"
+#include "quakedef.h"
+#include "d_local.h"
+#include <malloc.h>
+
+viddef_t    vid;                // global video state
+unsigned short  d_8to16table[256];
+
+// The original defaults
+//#define    BASEWIDTH    320
+//#define    BASEHEIGHT   200
+// Much better for high resolution displays
+// define    BASEWIDTH    (320*2)
+// #define    BASEHEIGHT   (200*2)
+#define    BASEWIDTH    (800)  // changed
+#define    BASEHEIGHT   (600)  // changed
+
+int    VGA_width, VGA_height, VGA_rowbytes, VGA_bufferrowbytes = 0;
+byte    *VGA_pagebase;
+
+static SDL_Surface *screen = NULL;
+
+static qboolean mouse_avail;
+static float   mouse_x, mouse_y;
+static int mouse_oldbuttonstate = 0;
+
+// No support for option menus
+void (*vid_menudrawfn)(void) = NULL;
+void (*vid_menukeyfn)(int key) = NULL;
+
+void    VID_SetPalette (unsigned char *palette)
+{
+    int i;
+    SDL_Color colors[256];
+
+    for ( i=0; i<256; ++i )
+    {
+        colors[i].r = *palette++;
+        colors[i].g = *palette++;
+        colors[i].b = *palette++;
+    }
+    SDL_SetColors(screen, colors, 0, 256);
+}
+
+void    VID_ShiftPalette (unsigned char *palette)
+{
+    VID_SetPalette(palette);
+}
+
+void    VID_Init (unsigned char *palette)
+{
+    int pnum, chunk;
+    byte *cache;
+    int cachesize;
+    Uint8 video_bpp;
+    Uint16 video_w, video_h;
+    Uint32 flags;
+
+    // Load the SDL library
+    if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_CDROM) < 0)
+        Sys_Error("VID: Couldn't load SDL: %s", SDL_GetError());
+
+    // Set up display mode (width and height)
+    vid.width = BASEWIDTH;
+    vid.height = BASEHEIGHT;
+    vid.maxwarpwidth = WARP_WIDTH;
+    vid.maxwarpheight = WARP_HEIGHT;
+    if ((pnum=COM_CheckParm("-winsize")))
+    {
+        if (pnum >= com_argc-2)
+            Sys_Error("VID: -winsize <width> <height>\n");
+        vid.width = Q_atoi(com_argv[pnum+1]);
+        vid.height = Q_atoi(com_argv[pnum+2]);
+        if (!vid.width || !vid.height)
+            Sys_Error("VID: Bad window width/height\n");
+    }
+
+    // Set video width, height and flags
+    flags = (SDL_SWSURFACE|SDL_HWPALETTE);
+    if ( COM_CheckParm ("-fullscreen") )
+        flags |= SDL_FULLSCREEN;
+
+    // Initialize display 
+    if (!(screen = SDL_SetVideoMode(vid.width, vid.height, 8, flags)))
+        Sys_Error("VID: Couldn't set video mode: %s\n", SDL_GetError());
+    VID_SetPalette(palette);
+    SDL_WM_SetCaption("Winquake-Z","Winquake-Z");
+    // now know everything we need to know about the buffer
+    VGA_width = vid.conwidth = vid.width;
+    VGA_height = vid.conheight = vid.height;
+    vid.aspect = ((float)vid.height / (float)vid.width) * (320.0 / 240.0);
+    vid.numpages = 1;
+    vid.colormap = host_colormap;
+    vid.fullbright = 256 - LittleLong (*((int *)vid.colormap + 2048));
+    VGA_pagebase = vid.buffer = screen->pixels;
+    VGA_rowbytes = vid.rowbytes = screen->pitch;
+    vid.conbuffer = vid.buffer;
+    vid.conrowbytes = vid.rowbytes;
+    vid.direct = 0;
+    
+    // allocate z buffer and surface cache
+    chunk = vid.width * vid.height * sizeof (*d_pzbuffer);
+    cachesize = D_SurfaceCacheForRes (vid.width, vid.height);
+    chunk += cachesize;
+    d_pzbuffer = Hunk_HighAllocName(chunk, "video");
+    if (d_pzbuffer == NULL)
+        Sys_Error ("Not enough memory for video mode\n");
+
+    // initialize the cache memory 
+        cache = (byte *) d_pzbuffer
+                + vid.width * vid.height * sizeof (*d_pzbuffer);
+    D_InitCaches (cache, cachesize);
+
+    // initialize the mouse
+    SDL_ShowCursor(0);
+}
+
+void    VID_Shutdown (void)
+{
+    SDL_Quit();
+}
+
+void    VID_Update (vrect_t *rects)
+{
+    SDL_Rect *sdlrects;
+    int n, i;
+    vrect_t *rect;
+
+    // Two-pass system, since Quake doesn't do it the SDL way...
+
+    // First, count the number of rectangles
+    n = 0;
+    for (rect = rects; rect; rect = rect->pnext)
+        ++n;
+
+    // Second, copy them to SDL rectangles and update
+    if (!(sdlrects = (SDL_Rect *)alloca(n*sizeof(*sdlrects))))
+        Sys_Error("Out of memory");
+    i = 0;
+    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);
+}
+
+/*
+================
+D_BeginDirectRect
+================
+*/
+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;
+    offset = (Uint8 *)screen->pixels + y*screen->pitch + x;
+    while ( height-- )
+    {
+        memcpy(offset, pbitmap, width);
+        offset += screen->pitch;
+        pbitmap += width;
+    }
+}
+
+
+/*
+================
+D_EndDirectRect
+================
+*/
+void D_EndDirectRect (int x, int y, int width, int height)
+{
+    if (!screen) return;
+    if (x < 0) x = screen->w+x-1;
+    SDL_UpdateRect(screen, x, y, width, height);
+}
+
+
+/*
+================
+Sys_SendKeyEvents
+================
+*/
+
+void Sys_SendKeyEvents(void)
+{
+    SDL_Event event;
+    int sym, state;
+     int modstate;
+
+    while (SDL_PollEvent(&event))
+    {
+        switch (event.type) {
+
+            case SDL_KEYDOWN:
+            case SDL_KEYUP:
+                sym = event.key.keysym.sym;
+                state = event.key.state;
+                modstate = SDL_GetModState();
+                switch(sym)
+                {
+                   case SDLK_DELETE: sym = K_DEL; break;
+                   case SDLK_BACKSPACE: sym = K_BACKSPACE; break;
+                   case SDLK_F1: sym = K_F1; break;
+                   case SDLK_F2: sym = K_F2; break;
+                   case SDLK_F3: sym = K_F3; break;
+                   case SDLK_F4: sym = K_F4; break;
+                   case SDLK_F5: sym = K_F5; break;
+                   case SDLK_F6: sym = K_F6; break;
+                   case SDLK_F7: sym = K_F7; break;
+                   case SDLK_F8: sym = K_F8; break;
+                   case SDLK_F9: sym = K_F9; break;
+                   case SDLK_F10: sym = K_F10; break;
+                   case SDLK_F11: sym = K_F11; break;
+                   case SDLK_F12: sym = K_F12; break;
+                   case SDLK_BREAK:
+                   case SDLK_PAUSE: sym = K_PAUSE; break;
+                   case SDLK_UP: sym = K_UPARROW; break;
+                   case SDLK_DOWN: sym = K_DOWNARROW; break;
+                   case SDLK_RIGHT: sym = K_RIGHTARROW; break;
+                   case SDLK_LEFT: sym = K_LEFTARROW; break;
+                   case SDLK_INSERT: sym = K_INS; break;
+                   case SDLK_HOME: sym = K_HOME; break;
+                   case SDLK_END: sym = K_END; break;
+                   case SDLK_PAGEUP: sym = K_PGUP; break;
+                   case SDLK_PAGEDOWN: sym = K_PGDN; break;
+                   case SDLK_RSHIFT:
+                   case SDLK_LSHIFT: sym = K_SHIFT; break;
+                   case SDLK_RCTRL:
+                   case SDLK_LCTRL: sym = K_CTRL; break;
+                   case SDLK_RALT:
+                   case SDLK_LALT: sym = K_ALT; break;
+                   case SDLK_KP0: 
+                       if(modstate & KMOD_NUM) sym = K_INS; 
+                       else sym = SDLK_0;
+                       break;
+                   case SDLK_KP1:
+                       if(modstate & KMOD_NUM) sym = K_END;
+                       else sym = SDLK_1;
+                       break;
+                   case SDLK_KP2:
+                       if(modstate & KMOD_NUM) sym = K_DOWNARROW;
+                       else sym = SDLK_2;
+                       break;
+                   case SDLK_KP3:
+                       if(modstate & KMOD_NUM) sym = K_PGDN;
+                       else sym = SDLK_3;
+                       break;
+                   case SDLK_KP4:
+                       if(modstate & KMOD_NUM) sym = K_LEFTARROW;
+                       else sym = SDLK_4;
+                       break;
+                   case SDLK_KP5: sym = SDLK_5; break;
+                   case SDLK_KP6:
+                       if(modstate & KMOD_NUM) sym = K_RIGHTARROW;
+                       else sym = SDLK_6;
+                       break;
+                   case SDLK_KP7:
+                       if(modstate & KMOD_NUM) sym = K_HOME;
+                       else sym = SDLK_7;
+                       break;
+                   case SDLK_KP8:
+                       if(modstate & KMOD_NUM) sym = K_UPARROW;
+                       else sym = SDLK_8;
+                       break;
+                   case SDLK_KP9:
+                       if(modstate & KMOD_NUM) sym = K_PGUP;
+                       else sym = SDLK_9;
+                       break;
+                   case SDLK_KP_PERIOD:
+                       if(modstate & KMOD_NUM) sym = K_DEL;
+                       else sym = SDLK_PERIOD;
+                       break;
+                   case SDLK_KP_DIVIDE: sym = SDLK_SLASH; break;
+                   case SDLK_KP_MULTIPLY: sym = SDLK_ASTERISK; break;
+                   case SDLK_KP_MINUS: sym = SDLK_MINUS; break;
+                   case SDLK_KP_PLUS: sym = SDLK_PLUS; break;
+                   case SDLK_KP_ENTER: sym = SDLK_RETURN; break;
+                   case SDLK_KP_EQUALS: sym = SDLK_EQUALS; break;
+                }
+                // If we're not directly handled and still above 255
+                // just force it to 0
+                if(sym > 255) sym = 0;
+                Key_Event(sym, state);
+                break;
+
+            case SDL_MOUSEMOTION:
+                if ( (event.motion.x != (vid.width/2)) ||
+                     (event.motion.y != (vid.height/2)) ) {
+                    mouse_x = event.motion.xrel*10;
+                    mouse_y = event.motion.yrel*10;
+                    if ( (event.motion.x < ((vid.width/2)-(vid.width/4))) ||
+                         (event.motion.x > ((vid.width/2)+(vid.width/4))) ||
+                         (event.motion.y < ((vid.height/2)-(vid.height/4))) ||
+                         (event.motion.y > ((vid.height/2)+(vid.height/4))) ) {
+                        SDL_WarpMouse(vid.width/2, vid.height/2);
+                    }
+                }
+                break;
+
+            case SDL_QUIT:
+                CL_Disconnect ();
+                Host_ShutdownServer(false);        
+                Sys_Quit ();
+                break;
+            default:
+                break;
+        }
+    }
+}
+
+void IN_Init (void)
+{
+    if ( COM_CheckParm ("-nomouse") )
+        return;
+    mouse_x = mouse_y = 0.0;
+    mouse_avail = 1;
+}
+
+void IN_Shutdown (void)
+{
+    mouse_avail = 0;
+}
+
+void IN_Commands (void)
+{
+    int i;
+    int mouse_buttonstate;
+   
+    if (!mouse_avail) return;
+   
+    i = SDL_GetMouseState(NULL, NULL);
+    /* Quake swaps the second and third buttons */
+    mouse_buttonstate = (i & ~0x06) | ((i & 0x02)<<1) | ((i & 0x04)>>1);
+    for (i=0 ; i<3 ; i++) {
+        if ( (mouse_buttonstate & (1<<i)) && !(mouse_oldbuttonstate & (1<<i)) )
+            Key_Event (K_MOUSE1 + i, true);
+
+        if ( !(mouse_buttonstate & (1<<i)) && (mouse_oldbuttonstate & (1<<i)) )
+            Key_Event (K_MOUSE1 + i, false);
+    }
+    mouse_oldbuttonstate = mouse_buttonstate;
+}
+
+void IN_Move (usercmd_t *cmd)
+{
+    if (!mouse_avail)
+        return;
+   
+    mouse_x *= sensitivity.value;
+    mouse_y *= sensitivity.value;
+   
+    if ( (in_strafe.state & 1) || (lookstrafe.value && m_look.value ))
+        cmd->sidemove += m_side.value * mouse_x;
+    else
+        cl.viewangles[YAW] -= m_yaw.value * mouse_x;
+    if (m_look.value)
+        V_StopPitchDrift ();
+   
+    if ( m_look.value && !(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 {
+        if ((in_strafe.state & 1) && noclip_anglehack)
+            cmd->upmove -= m_forward.value * mouse_y;
+        else
+            cmd->forwardmove -= m_forward.value * mouse_y;
+    }
+    mouse_x = mouse_y = 0.0;
+}
+
+/*
+================
+Sys_ConsoleInput
+================
+*/
+char *Sys_ConsoleInput (void)
+{
+    return 0;
+}
diff -rupN WQ-X-src//host.c WQ-Z-src//host.c
--- WQ-X-src//host.c	2015-10-21 03:50:03 -0400
+++ WQ-Z-src//host.c	2015-10-22 03:20:00 -0400
@@ -858,15 +858,12 @@ void Host_Init (quakeparms_t *parms)
 	Memory_Init (parms->membase, parms->memsize);
 	Cbuf_Init ();
 	Cmd_Init ();	
-	V_Init ();
-	Chase_Init ();
 	Host_InitVCR (parms);
 	COM_Init (parms->basedir);
 	Host_InitLocal ();
 	W_LoadWadFile ("gfx.wad");
 	Key_Init ();
 	Con_Init ();	
-	M_Init ();	
 	PR_Init ();
 	Mod_Init ();
 	NET_Init ();
@@ -886,33 +883,20 @@ void Host_Init (quakeparms_t *parms)
 		if (!host_colormap)
 			Sys_Error ("Couldn't load gfx/colormap.lmp");
 
-#ifndef _WIN32 // on non win32, mouse comes before video for security reasons
-		IN_Init ();
-#endif
-		VID_Init (host_basepal);
+		V_Init ();
+		Chase_Init ();
+		M_Init ();
 
+		VID_Init (host_basepal);
+		IN_Init ();
 		Draw_Init ();
 		SCR_Init ();
 		R_Init ();
-#ifndef	_WIN32
-	// on Win32, sound initialization has to come before video initialization, so we
-	// can put up a popup if the sound hardware is in use
 		S_Init ();
-#else
-
-#ifdef	GLQUAKE
-	// FIXME: doesn't use the new one-window approach yet
-		S_Init ();
-#endif
-
-#endif	// _WIN32
 		CDAudio_Init ();
 		BGM_Init();
 		Sbar_Init ();
 		CL_Init ();
-#ifdef _WIN32 // on non win32, mouse comes before video for security reasons
-		IN_Init ();
-#endif
 	}
 
 	Cbuf_InsertText ("exec quake.rc\n");
