diff --git a/libs/video/targets/in_sdl.c b/libs/video/targets/in_sdl.c
index 96ba9a8a3..01dc88a64 100644
--- a/libs/video/targets/in_sdl.c
+++ b/libs/video/targets/in_sdl.c
@@ -31,20 +31,17 @@
 
 #include <SDL.h>
 
-#include "client.h"
-#include "cl_input.h"
-#include "cl_main.h"
 #include "QF/compat.h"
 #include "QF/console.h"
 #include "QF/cvar.h"
-#include "draw.h"
 #include "QF/input.h"
 #include "QF/joystick.h"
 #include "QF/keys.h"
+#include "QF/mathlib.h"
 #include "QF/sys.h"
 #include "QF/qargs.h"
 #include "QF/qendian.h"
-#include "view.h" // FIXME: probable evil
+#include "QF/vid.h"
 
 #ifdef WIN32
 // FIXME: this is evil...
@@ -60,19 +57,14 @@ int         modestate;					// FIXME: just to avoid cross-comp.
 
 										// errors - remove later
 
-static qboolean mouse_avail;
-static float mouse_x, mouse_y;
-static float old_mouse_x, old_mouse_y;
 static int  mouse_oldbuttonstate = 0;
 
-extern viddef_t vid;					// global video state
-
 /*
 	IN_SendKeyEvents
 */
 
 void
-IN_SendKeyEvents (void)
+IN_LL_SendKeyEvents (void)
 {
 	SDL_Event   event;
 	int         sym, state, but;
@@ -294,8 +286,8 @@ IN_SendKeyEvents (void)
 					if ((event.motion.x != (vid.width / 2))
 						|| (event.motion.y != (vid.height / 2))) {
 						// *2 for vid_sdl.c, *10 for vid_sgl.c.
-						mouse_x = event.motion.xrel * 5;
-						mouse_y = event.motion.yrel * 5;
+						in_mouse_x = event.motion.xrel * 5;
+						in_mouse_y = event.motion.yrel * 5;
 						if (
 							(event.motion.x <
 							 ((vid.width / 2) - (vid.width / 4)))
@@ -309,13 +301,13 @@ IN_SendKeyEvents (void)
 					}
 				} else {
 					// following are *2 in vid_sdl.c, vid_sgl.c is *10
-					mouse_x = event.motion.xrel * 5;
-					mouse_y = event.motion.yrel * 5;
+					in_mouse_x = event.motion.xrel * 5;
+					in_mouse_y = event.motion.yrel * 5;
 				}
 				break;
 
 			case SDL_QUIT:
-				CL_Disconnect ();
+				//CL_Disconnect ();
 				Sys_Quit ();
 				break;
 			default:
@@ -326,7 +318,7 @@ IN_SendKeyEvents (void)
 
 
 void
-IN_Commands (void)
+IN_LL_Commands (void)
 {
 	JOY_Command ();
 
@@ -343,42 +335,38 @@ IN_Commands (void)
 }
 
 void
-IN_Init (void)
+IN_LL_Init (void)
 {
 	JOY_Init ();
 
 	if (COM_CheckParm ("-nomouse") && !_windowed_mouse->value)
 		return;
 
-	mouse_x = mouse_y = 0.0;
-	mouse_avail = 1;
+	in_mouse_x = in_mouse_y = 0.0;
+	in_mouse_avail = 1;
 //  SDL_ShowCursor (0); 
 //  SDL_WM_GrabInput (SDL_GRAB_ON);
 //  FIXME: disable DGA if in_dgamouse says to.
 }
 
 void
-IN_Init_Cvars (void)
+IN_LL_Init_Cvars (void)
 {
-	JOY_Init_Cvars ();
-
-	_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL, "If set to 1, quake will grab the mouse in X");
-	m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, NULL, "Toggle mouse input filtering");
 }
 
 void
-IN_Shutdown (void)
+IN_LL_Shutdown (void)
 {
-	mouse_avail = 0;
+	in_mouse_avail = 0;
 }
 
 void
-IN_Frame (void)
+IN_LL_Frame (void)
 {
 	int         i;
 	int         mouse_buttonstate;
 
-	if (!mouse_avail)
+	if (!in_mouse_avail)
 		return;
 
 	i = SDL_GetMouseState (NULL, NULL);
@@ -395,38 +383,3 @@ IN_Frame (void)
 	}
 	mouse_oldbuttonstate = mouse_buttonstate;
 }
-
-void
-IN_Move (void)
-{
-	
-	JOY_Move ();
-
-	if (!mouse_avail)
-		return;
-
-	if (m_filter->value) {
-		mouse_x = (mouse_x + old_mouse_x) * 0.5;
-		mouse_y = (mouse_y + old_mouse_y) * 0.5;
-	}
-	old_mouse_x = mouse_x; 
-	old_mouse_y = mouse_y; 
-
-	mouse_x *= sensitivity->value;
-	mouse_y *= sensitivity->value;
-
-	if ((in_strafe.state & 1) || (lookstrafe->value && (in_mlook.state & 1)))
-		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)
-			viewdelta.position[1] -= mouse_y;
-		else
-			viewdelta.position[2] -= mouse_y;
-	}
-	mouse_x = mouse_y = 0.0;
-}
diff --git a/libs/video/targets/vid_common_gl.c b/libs/video/targets/vid_common_gl.c
index 0f2b81e09..f69168f35 100644
--- a/libs/video/targets/vid_common_gl.c
+++ b/libs/video/targets/vid_common_gl.c
@@ -63,6 +63,7 @@ unsigned char d_15to8table[65536];
 
 cvar_t     *vid_mode;
 cvar_t     *brighten;
+cvar_t     *gl_multitexture;
 extern byte gammatable[256];
 
 QF_glActiveTextureARB   qglActiveTexture = NULL;
@@ -98,6 +99,7 @@ GL_Common_Init_Cvars (void)
 	vid_use8bit = Cvar_Get ("vid_use8bit", "0", CVAR_ROM, NULL,	"Use 8-bit shared palettes.");
 	brightness = Cvar_Get ("brightness", "1", CVAR_ARCHIVE, NULL, "Brightness level");
 	contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, NULL, "Contrast level");
+	gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, NULL, "Use multitexture when available");
 }
 
 /*
diff --git a/libs/video/targets/vid_sdl.c b/libs/video/targets/vid_sdl.c
index dcdabd22e..8a1ee8a1c 100644
--- a/libs/video/targets/vid_sdl.c
+++ b/libs/video/targets/vid_sdl.c
@@ -42,7 +42,6 @@
 #include "QF/compat.h"
 #include "QF/console.h"
 #include "QF/cvar.h"
-#include "d_local.h"
 #include "QF/qendian.h"
 #include "QF/sys.h"
 #include "QF/va.h"
@@ -75,44 +74,6 @@ byte       *VGA_pagebase;
 
 static SDL_Surface *screen = NULL;
 
-void
-VID_InitBuffers (int width, int height)
-{
-	int         tbuffersize, tcachesize;
-	void       *vid_surfcache;
-
-	// Calculate the sizes we want first
-	tbuffersize = vid.width * vid.height * sizeof (*d_pzbuffer);
-	tcachesize = D_SurfaceCacheForRes (width, height);
-
-	// 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 z-buffer
-	d_pzbuffer = calloc (tbuffersize, 1);
-	if (!d_pzbuffer) {
-		Sys_Error ("Not enough memory for video mode\n");
-	}
-	// Allocate the new surface cache; free the z-buffer if we fail
-	vid_surfcache = calloc (tcachesize, 1);
-	if (!vid_surfcache) {
-		free (d_pzbuffer);
-		d_pzbuffer = NULL;
-		Sys_Error ("Not enough memory for video mode\n");
-	}
-
-	D_InitCaches (vid_surfcache, tcachesize);
-}
-
 void
 VID_SetPalette (unsigned char *palette)
 {
@@ -149,9 +110,6 @@ VID_Init (unsigned char *palette)
 	VID_GetWindowSize (BASEWIDTH, BASEHEIGHT);
 	Con_CheckResize (); // Now that we have a window size, fix console
 
-	vid.maxwarpwidth = WARP_WIDTH;
-	vid.maxwarpheight = WARP_HEIGHT;
-
 	// Set video width, height and flags
 	flags = (SDL_SWSURFACE | SDL_HWPALETTE);
 	if (vid_fullscreen->int_val)
@@ -177,7 +135,7 @@ VID_Init (unsigned char *palette)
 	vid.direct = 0;
 
 	// allocate z buffer and surface cache
-	VID_InitBuffers (vid.width, vid.height);
+	VID_InitBuffers ();
 
 	// initialize the mouse
 	SDL_ShowCursor (0);
diff --git a/libs/video/targets/vid_sgl.c b/libs/video/targets/vid_sgl.c
index 5f5ba1d43..08b25705e 100644
--- a/libs/video/targets/vid_sgl.c
+++ b/libs/video/targets/vid_sgl.c
@@ -49,6 +49,7 @@
 #include "sbar.h"
 #include "QF/sys.h"
 #include "QF/va.h"
+#include "QF/vid.h"
 
 #ifdef WIN32
 /* FIXME: this is evil hack to get full DirectSound support with SDL */
diff --git a/nq/source/gl_model_brush.c b/nq/source/gl_model_brush.c
index dbf8c1a10..746cc7068 100644
--- a/nq/source/gl_model_brush.c
+++ b/nq/source/gl_model_brush.c
@@ -55,14 +55,12 @@ Mod_ProcessTexture (miptex_t *mt, texture_t *tx)
 {
 	char        name[32];
 
-	texture_mode = GL_LINEAR_MIPMAP_NEAREST;	// _LINEAR;
 	snprintf (name, sizeof (name), "fb_%s", mt->name);
 	tx->gl_fb_texturenum =
 		Mod_Fullbright ((byte *) (tx + 1), tx->width, tx->height, name);
 	tx->gl_texturenum =
 		GL_LoadTexture (mt->name, tx->width, tx->height, (byte *) (tx + 1),
 						true, false, 1);
-	texture_mode = GL_LINEAR;
 }
 
 /*
diff --git a/nq/source/gl_rsurf.c b/nq/source/gl_rsurf.c
index 05b0e753e..2a8c613bd 100644
--- a/nq/source/gl_rsurf.c
+++ b/nq/source/gl_rsurf.c
@@ -812,7 +812,7 @@ R_DrawBrushModel (entity_t *e)
 	e->angles[0] = -e->angles[0];		// stupid quake bug
 
 	// LordHavoc: anyone without multitexture won't want texsort 0 anyway...
-	if (!gl_mtexable)
+	if (!gl_mtex_active)
 		Cvar_SetValue (gl_texsort, 1);
 
 	glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
@@ -990,7 +990,7 @@ R_DrawWorld (void)
 	currententity = &ent;
 
 	// LordHavoc: anyone without multitexture won't want texsort 0 anyway...
-	if (!gl_mtexable)
+	if (!gl_mtex_active)
 		Cvar_SetValue (gl_texsort, 1);
 
 	glColor3f (1.0, 1.0, 1.0);
@@ -1309,7 +1309,7 @@ GL_BuildLightmaps (void)
 		}
 	}
 
-	if (gl_mtexable && !gl_texsort->int_val)
+	if (gl_mtex_active && !gl_texsort->int_val)
 		qglSelectTexture (gl_mtex_enum + 1);
 
 	// 
@@ -1331,6 +1331,6 @@ GL_BuildLightmaps (void)
 					  GL_UNSIGNED_BYTE, lightmaps[i]);
 	}
 
-	if (gl_mtexable && !gl_texsort->int_val)
+	if (gl_mtex_active && !gl_texsort->int_val)
 		qglSelectTexture (gl_mtex_enum + 0);
 }
diff --git a/qw/source/gl_rmain.c b/qw/source/gl_rmain.c
index 1747924f7..27dffe530 100644
--- a/qw/source/gl_rmain.c
+++ b/qw/source/gl_rmain.c
@@ -124,7 +124,6 @@ cvar_t	*gl_fb_models;
 cvar_t	*gl_fb_bmodels;
 cvar_t	*gl_keeptjunctions;
 cvar_t	*gl_lerp_anim;
-cvar_t	*gl_multitexture;
 cvar_t	*gl_nocolors;
 cvar_t	*gl_playermip;
 cvar_t	*gl_dlight_smooth;
diff --git a/qw/source/gl_rmisc.c b/qw/source/gl_rmisc.c
index c54053f23..7f4d185fc 100644
--- a/qw/source/gl_rmisc.c
+++ b/qw/source/gl_rmisc.c
@@ -238,7 +238,6 @@ R_Init_Cvars (void)
 	gl_fires = Cvar_Get ("gl_fires", "0", CVAR_ARCHIVE, NULL, "Toggles lavaball and rocket fireballs");
 	gl_keeptjunctions = Cvar_Get ("gl_keeptjunctions", "1", CVAR_ARCHIVE, NULL, "Set to 0 to turn off colinear vertexes upon level load");
 	gl_lerp_anim = Cvar_Get ("gl_lerp_anim", "1", CVAR_ARCHIVE, NULL, "Toggles model animation interpolation");
-	gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, NULL, "Use multitexture when available");
 	gl_nocolors = Cvar_Get ("gl_nocolors", "0", CVAR_NONE, NULL, "Set to 1, turns off all player colors");
 	gl_playermip = Cvar_Get ("gl_playermip", "0", CVAR_NONE, NULL, "Detail of player skins. 0 best, 4 worst.");
 	gl_sky_clip = Cvar_Get ("gl_sky_clip", "0", CVAR_ARCHIVE, NULL, "controls whether sky is drawn first (0) or later (1)");