Index: twilight/src/fs/dir.h
diff -u twilight/src/fs/dir.h:1.1 twilight/src/fs/dir.h:1.2
--- twilight/src/fs/dir.h:1.1	Sat Jun 14 19:53:06 2003
+++ twilight/src/fs/dir.h	Thu Jun 19 01:35:27 2003
@@ -28,7 +28,7 @@
 
 #include "fs.h"
 
-fs_group_t *FSD_New_Group(const char *path, fs_group_t *parent, const char *id);
+fs_group_t *FSD_New_Group(const char *path, fs_group_t *parent, const char *id, Uint32 flags);
 
 #endif // __FS_DIR_H
 
Index: twilight/src/fs/dir_posix.c
diff -u twilight/src/fs/dir_posix.c:1.1 twilight/src/fs/dir_posix.c:1.2
--- twilight/src/fs/dir_posix.c:1.1	Sat Jun 14 19:53:06 2003
+++ twilight/src/fs/dir_posix.c	Thu Jun 19 01:35:27 2003
@@ -23,7 +23,7 @@
 */
 
 static const char rcsid[] =
-	"$Id: dir_posix.c,v 1.1 2003/06/14 23:53:06 warp Exp $";
+	"$Id: dir_posix.c,v 1.2 2003/06/19 05:35:27 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -58,7 +58,7 @@
 }
 
 static SDL_RWops *
-FSD_Open_File (fs_file_t *file, qboolean write)
+FSD_Open_File (fs_file_t *file, Uint32 flags)
 {
 	fsd_group_t	*dir;
 	char		*name;
@@ -70,9 +70,13 @@
 	else
 		name = zasprintf (tempzone, "%s/%s", dir->path, file->name_base);
 
-	if (write)
-		rw = SDL_RWFromFile (name, "w");
-	else
+	if (flags & FSF_WRITE) {
+		if (file->group->flags & FS_READ_ONLY) {
+			Com_Printf ("Refusing to open '%s' in write mode.\n", name);
+			rw = NULL;
+		} else
+			rw = SDL_RWFromFile (name, "w");
+	} else
 		rw = SDL_RWFromFile (name, "r");
 
 	Zone_Free (name);
@@ -149,7 +153,8 @@
 }
 
 fs_group_t *
-FSD_New_Group (const char *path, fs_group_t *parent, const char *id)
+FSD_New_Group (const char *path, fs_group_t *parent, const char *id,
+		Uint32 flags)
 {
 	fs_group_t	*group;
 	fsd_group_t	*dir;
@@ -159,8 +164,13 @@
 	group->fs_data = dir;
 	group->free = FSD_Free;
 	group->free_file = FSD_Free_File;
-	group->open_new = FSD_Open_New;
-	group->close_new = FSD_Close_New;
+	group->flags |= flags;
+	if (parent)
+		group->flags |= parent->flags;
+	if (!(group->flags & FS_READ_ONLY)) {
+		group->open_new = FSD_Open_New;
+		group->close_new = FSD_Close_New;
+	}
 
 	dir->path = Zstrdup (fs_zone, path);
 
Index: twilight/src/fs/fs.c
diff -u twilight/src/fs/fs.c:1.2 twilight/src/fs/fs.c:1.3
--- twilight/src/fs/fs.c:1.2	Tue Jun 17 10:49:31 2003
+++ twilight/src/fs/fs.c	Thu Jun 19 01:35:27 2003
@@ -23,7 +23,7 @@
 */
 
 static const char rcsid[] =
-	"$Id: fs.c,v 1.2 2003/06/17 14:49:31 warp Exp $";
+	"$Id: fs.c,v 1.3 2003/06/19 05:35:27 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -179,7 +179,7 @@
 }
 
 void
-FS_AddPath (const char *path, const char *id)
+FS_AddPath (const char *path, const char *id, const Uint32 flags)
 {
 	if (!id) {
 		if ((id = strrchr(path, '/')))
@@ -188,7 +188,7 @@
 			id = path;
 	}
 		
-	FS_AddGroup (FSD_New_Group (path, NULL, id));
+	FS_AddGroup (FSD_New_Group (path, NULL, id, flags));
 }
 
 fs_group_t *
Index: twilight/src/fs/fs.h
diff -u twilight/src/fs/fs.h:1.2 twilight/src/fs/fs.h:1.3
--- twilight/src/fs/fs.h:1.2	Tue Jun 17 10:49:31 2003
+++ twilight/src/fs/fs.h	Thu Jun 19 01:35:27 2003
@@ -30,15 +30,22 @@
 #include "qtypes.h"
 #include "hash.h"
 #include "zone.h"
+#include "mathlib.h"
 
 struct fs_file_s;
 struct fs_new_s;
-typedef SDL_RWops *(fs_open_t) (struct fs_file_s *, qboolean write);
+typedef SDL_RWops *(fs_open_t) (struct fs_file_s *, Uint32 flags);
 
+#define FSF_WRITE										BIT(0)
+
+#define FS_READ_ONLY									BIT(0)
+#define FS_NO_UPLOAD									BIT(1)
+
 typedef struct fs_group_s {
 	char				*id;
 	hash_t				*files;
 	Uint				path_num;
+	Uint32				flags;
 
 	qboolean			(*open_new) (struct fs_group_s *, struct fs_new_s *);
 	void				(*close_new) (struct fs_group_s *, struct fs_new_s *);
@@ -74,7 +81,7 @@
 fs_file_t *FS_FindFiles_Complex (const char **names, char ***exts);
 fs_file_t *FS_FindFile_Complex (const char *name, char **exts);
 fs_file_t *FS_FindFile (const char *name);
-void FS_AddPath (const char *path, const char *id);
+void FS_AddPath (const char *path, const char *id, const Uint32 flags);
 
 fs_group_t * FS_Alloc_Group (fs_group_t *parent, const char *id);
 void FS_Free_Group (fs_group_t *group);
Index: twilight/src/fs/pak.c
diff -u twilight/src/fs/pak.c:1.2 twilight/src/fs/pak.c:1.3
--- twilight/src/fs/pak.c:1.2	Tue Jun 17 10:49:31 2003
+++ twilight/src/fs/pak.c	Thu Jun 19 01:35:27 2003
@@ -23,7 +23,7 @@
 */
 
 static const char rcsid[] =
-	"$Id: pak.c,v 1.2 2003/06/17 14:49:31 warp Exp $";
+	"$Id: pak.c,v 1.3 2003/06/19 05:35:27 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -77,19 +77,19 @@
 }
 
 static SDL_RWops *
-FSP_Open_File (fs_file_t *file, qboolean write)
+FSP_Open_File (fs_file_t *file, Uint32 flags)
 {
 	fsp_file_t	*p_file;
 	fsp_group_t	*pak;
 	SDL_RWops	*rw;
 
-	if (write)
+	if (flags & FSF_WRITE)
 		return NULL;
 
 	p_file = file->fs_data;
 	pak = file->group->fs_data;
 
-	rw = LimitFromRW(pak->pak->open(pak->pak, false), p_file->ofs, p_file->ofs + file->len);
+	rw = LimitFromRW(pak->pak->open(pak->pak, 0), p_file->ofs, p_file->ofs + file->len);
 	return rw;
 }
 
@@ -102,7 +102,7 @@
 	SDL_RWops		*rw;
 	int				i, nfiles;
 
-	rw = file->open(file, false);
+	rw = file->open(file, 0);
 
 	pak->pak = file;
 
@@ -144,6 +144,9 @@
 	group->fs_data = pak;
 	group->free = FSP_Free;
 	group->free_file = FSP_Free_File;
+	if (parent)
+		group->flags |= parent->flags;
+	group->flags |= FS_NO_UPLOAD;
 
 	if (FSP_Add_Pak (group, pak, in))
 		return group;
Index: twilight/src/fs/wad.c
diff -u twilight/src/fs/wad.c:1.2 twilight/src/fs/wad.c:1.3
--- twilight/src/fs/wad.c:1.2	Tue Jun 17 10:50:39 2003
+++ twilight/src/fs/wad.c	Thu Jun 19 01:35:27 2003
@@ -23,7 +23,7 @@
 */
 
 static const char rcsid[] =
-	"$Id: wad.c,v 1.2 2003/06/17 14:50:39 warp Exp $";
+	"$Id: wad.c,v 1.3 2003/06/19 05:35:27 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -99,19 +99,19 @@
 }
 
 static SDL_RWops *
-FSW_Open_File (fs_file_t *file, qboolean write)
+FSW_Open_File (fs_file_t *file, Uint32 flags)
 {
 	fsw_file_t	*p_file;
 	fsw_group_t	*wad;
 	SDL_RWops	*rw;
 
-	if (write)
+	if (flags & FSF_WRITE)
 		return NULL;
 
 	p_file = file->fs_data;
 	wad = file->group->fs_data;
 
-	rw = LimitFromRW(wad->wad->open(wad->wad, false), p_file->ofs, p_file->ofs + file->len);
+	rw = LimitFromRW(wad->wad->open(wad->wad, 0), p_file->ofs, p_file->ofs + file->len);
 	return rw;
 }
 
@@ -124,7 +124,8 @@
 	SDL_RWops		*rw;
 	int				i;
 
-	rw = file->open(file, false);
+	if (!(rw = file->open(file, 0)))
+		return false;
 
 	wad->wad = file;
 
@@ -165,6 +166,8 @@
 	group->fs_data = wad;
 	group->free = FSW_Free;
 	group->free_file = FSW_Free_File;
+	if (parent)
+		group->flags |= parent->flags;
 
 	if (FSW_Add_Wad (group, wad, in))
 		return group;
Index: twilight/src/image/image.c
diff -u twilight/src/image/image.c:1.6 twilight/src/image/image.c:1.7
--- twilight/src/image/image.c:1.6	Tue Jun 17 10:49:31 2003
+++ twilight/src/image/image.c	Thu Jun 19 01:35:28 2003
@@ -23,7 +23,7 @@
 */
 
 static const char rcsid[] =
-	"$Id: image.c,v 1.6 2003/06/17 14:49:31 warp Exp $";
+	"$Id: image.c,v 1.7 2003/06/19 05:35:28 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -111,7 +111,7 @@
 	if (!file)
 		return NULL;
 
-	rw = file->open(file, false);
+	rw = file->open(file, 0);
 	if (!rw)
 		return NULL;
 
Index: twilight/src/nq/cl_demo.c
diff -u twilight/src/nq/cl_demo.c:1.29 twilight/src/nq/cl_demo.c:1.30
--- twilight/src/nq/cl_demo.c:1.29	Sat Jun 14 19:53:07 2003
+++ twilight/src/nq/cl_demo.c	Thu Jun 19 01:35:28 2003
@@ -23,7 +23,7 @@
 
 */
 static const char rcsid[] =
-    "$Id: cl_demo.c,v 1.29 2003/06/14 23:53:07 warp Exp $";
+    "$Id: cl_demo.c,v 1.30 2003/06/19 05:35:28 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -291,7 +291,7 @@
 		ccls.demonum = -1;	// stop demo loop
 		return;
 	}
-	ccls.demofile = file->open(file, false);
+	ccls.demofile = file->open(file, 0);
 	if (!ccls.demofile) {
 		Com_Printf ("ERROR: couldn't open %s.\n", name);
 		ccls.demonum = -1;	// stop demo loop
Index: twilight/src/nq/common.c
diff -u twilight/src/nq/common.c:1.90 twilight/src/nq/common.c:1.91
--- twilight/src/nq/common.c:1.90	Sat Jun 14 19:53:07 2003
+++ twilight/src/nq/common.c	Thu Jun 19 01:35:28 2003
@@ -23,7 +23,7 @@
 
 */
 static const char rcsid[] =
-	"$Id: common.c,v 1.90 2003/06/14 23:53:07 warp Exp $";
+	"$Id: common.c,v 1.91 2003/06/19 05:35:28 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -872,7 +872,7 @@
 			Sys_Printf ("LoadFile: can't find %s\n", path);
 		return NULL;
 	}
-	rw = file->open(file, false);
+	rw = file->open(file, 0);
 	if (!rw) {
 		if (complain)
 			Sys_Printf ("LoadFile: can't open %s\n", path);
@@ -932,12 +932,12 @@
 ================
 */
 static void
-COM_AddDirectory (const char *dir)
+COM_AddDirectory (const char *dir, Uint32 flags)
 {
 	strlcpy_s (com_gamedir, dir);
 	Sys_mkdir (com_gamedir);
 
-	FS_AddPath (dir, NULL);
+	FS_AddPath (dir, NULL, flags);
 }
 
 /*
@@ -951,15 +951,16 @@
 	char		buf[1024];
 
 	snprintf (buf, sizeof (buf), "%s/%s", fs_sharepath->svalue, dir);
-	COM_AddDirectory (buf);
 
-	if (strcmp (fs_userpath->svalue, fs_sharepath->svalue) != 0)
+	if (strcmp (fs_userpath->svalue, fs_sharepath->svalue))
 	{
 		// only do this if the share path is not the same as the base path
+		COM_AddDirectory (buf, FS_READ_ONLY);
 		snprintf (buf, sizeof (buf), "%s/%s", fs_userpath->svalue, dir);
 		Sys_mkdir (buf);
-		COM_AddDirectory (buf);
 	}
+
+	COM_AddDirectory (buf, 0);
 }
 
 
Index: twilight/src/nq/host.c
diff -u twilight/src/nq/host.c:1.89 twilight/src/nq/host.c:1.90
--- twilight/src/nq/host.c:1.89	Tue Jun 17 10:49:31 2003
+++ twilight/src/nq/host.c	Thu Jun 19 01:35:28 2003
@@ -23,7 +23,7 @@
 
 */
 static const char rcsid[] =
-    "$Id: host.c,v 1.89 2003/06/17 14:49:31 warp Exp $";
+    "$Id: host.c,v 1.90 2003/06/19 05:35:28 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -269,7 +269,7 @@
 		COM_DefaultExtension (fname, ".cfg", sizeof (fname));
 
 		if ((file = FS_FindFile (fname)))
-			rw = file->open(file, true);
+			rw = file->open(file, FSF_WRITE);
 
 		if (!rw)
 			rw = FS_Open_New (fname);
Index: twilight/src/nq/host_cmd.c
diff -u twilight/src/nq/host_cmd.c:1.53 twilight/src/nq/host_cmd.c:1.54
--- twilight/src/nq/host_cmd.c:1.53	Sat Jun 14 19:53:07 2003
+++ twilight/src/nq/host_cmd.c	Thu Jun 19 01:35:28 2003
@@ -23,7 +23,7 @@
 
 */
 static const char rcsid[] =
-    "$Id: host_cmd.c,v 1.53 2003/06/14 23:53:07 warp Exp $";
+    "$Id: host_cmd.c,v 1.54 2003/06/19 05:35:28 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -441,7 +441,7 @@
 	COM_DefaultExtension (name, ".sav", sizeof (name));
 
 	if ((file = FS_FindFile (name)))
-		rw = file->open(file, true);
+		rw = file->open(file, FSF_WRITE);
 
 	if (!rw)
 		rw = FS_Open_New (name);
Index: twilight/src/qw/cl_demo.c
diff -u twilight/src/qw/cl_demo.c:1.37 twilight/src/qw/cl_demo.c:1.38
--- twilight/src/qw/cl_demo.c:1.37	Sat Jun 14 19:53:07 2003
+++ twilight/src/qw/cl_demo.c	Thu Jun 19 01:35:28 2003
@@ -23,7 +23,7 @@
 
 */
 static const char rcsid[] =
-    "$Id: cl_demo.c,v 1.37 2003/06/14 23:53:07 warp Exp $";
+    "$Id: cl_demo.c,v 1.38 2003/06/19 05:35:28 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -683,7 +683,7 @@
 		return;
 	}
 
-	ccls.demofile = file->open(file, false);
+	ccls.demofile = file->open(file, 0);
 	if (!ccls.demofile) {
 		Com_Printf ("ERROR: couldn't open %s.\n", name);
 		ccls.demonum = -1;				// stop demo loop
Index: twilight/src/qw/cl_main.c
diff -u twilight/src/qw/cl_main.c:1.118 twilight/src/qw/cl_main.c:1.119
--- twilight/src/qw/cl_main.c:1.118	Tue Jun 17 10:49:32 2003
+++ twilight/src/qw/cl_main.c	Thu Jun 19 01:35:28 2003
@@ -23,7 +23,7 @@
 
 */
 static const char rcsid[] =
-    "$Id: cl_main.c,v 1.118 2003/06/17 14:49:32 warp Exp $";
+    "$Id: cl_main.c,v 1.119 2003/06/19 05:35:28 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -1196,7 +1196,7 @@
 		COM_DefaultExtension (fname, ".cfg", sizeof (fname));
 
 		if ((file = FS_FindFile (fname)))
-			rw = file->open(file, true);
+			rw = file->open(file, FSF_WRITE);
 
 		if (!rw)
 			rw = FS_Open_New (fname);
Index: twilight/src/qw/common.c
diff -u twilight/src/qw/common.c:1.92 twilight/src/qw/common.c:1.93
--- twilight/src/qw/common.c:1.92	Sat Jun 14 19:53:08 2003
+++ twilight/src/qw/common.c	Thu Jun 19 01:35:28 2003
@@ -23,7 +23,7 @@
 
 */
 static const char rcsid[] =
-	"$Id: common.c,v 1.92 2003/06/14 23:53:08 warp Exp $";
+	"$Id: common.c,v 1.93 2003/06/19 05:35:28 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -1036,7 +1036,7 @@
 			Sys_Printf ("LoadFile: can't find %s\n", path);
 		return NULL;
 	}
-	rw = file->open(file, false);
+	rw = file->open(file, 0);
 	if (!rw) {
 		if (complain)
 			Sys_Printf ("LoadFile: can't open %s\n", path);
@@ -1096,12 +1096,12 @@
 ================
 */
 static void
-COM_AddDirectory (const char *dir)
+COM_AddDirectory (const char *dir, Uint32 flags)
 {
 	strlcpy_s (com_gamedir, dir);
 	Sys_mkdir (com_gamedir);
 
-	FS_AddPath (dir, NULL);
+	FS_AddPath (dir, NULL, flags);
 }
 
 /*
@@ -1115,15 +1115,16 @@
 	char		buf[1024];
 
 	snprintf (buf, sizeof (buf), "%s/%s", fs_sharepath->svalue, dir);
-	COM_AddDirectory (buf);
 
-	if (strcmp (fs_userpath->svalue, fs_sharepath->svalue) != 0)
+	if (strcmp (fs_userpath->svalue, fs_sharepath->svalue))
 	{
 		// only do this if the share path is not the same as the base path
+		COM_AddDirectory (buf, FS_READ_ONLY);
 		snprintf (buf, sizeof (buf), "%s/%s", fs_userpath->svalue, dir);
 		Sys_mkdir (buf);
-		COM_AddDirectory (buf);
 	}
+
+	COM_AddDirectory (buf, 0);
 }
 
 
Index: twilight/src/qw/sv_main.c
diff -u twilight/src/qw/sv_main.c:1.11 twilight/src/qw/sv_main.c:1.12
--- twilight/src/qw/sv_main.c:1.11	Sat Jun 14 19:53:08 2003
+++ twilight/src/qw/sv_main.c	Thu Jun 19 01:35:28 2003
@@ -23,7 +23,7 @@
 
 */
 static const char rcsid[] =
-    "$Id: sv_main.c,v 1.11 2003/06/14 23:53:08 warp Exp $";
+    "$Id: sv_main.c,v 1.12 2003/06/19 05:35:28 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -940,7 +940,7 @@
 	Com_Printf ("Writing listip.cfg.\n");
 
 	if ((file = FS_FindFile ("listip.cfg")))
-		rw = file->open(file, true);
+		rw = file->open(file, FSF_WRITE);
 
 	if (!rw)
 		rw = FS_Open_New ("listip.cfg");
Index: twilight/src/qw/sv_user.c
diff -u twilight/src/qw/sv_user.c:1.12 twilight/src/qw/sv_user.c:1.13
--- twilight/src/qw/sv_user.c:1.12	Sat Jun 14 19:53:08 2003
+++ twilight/src/qw/sv_user.c	Thu Jun 19 01:35:28 2003
@@ -23,7 +23,7 @@
 
 */
 static const char rcsid[] =
-    "$Id: sv_user.c,v 1.12 2003/06/14 23:53:08 warp Exp $";
+    "$Id: sv_user.c,v 1.13 2003/06/19 05:35:28 warp Exp $";
 
 #include "twiconfig.h"
 
@@ -643,10 +643,12 @@
 	file = FS_FindFile (name);
 	if (!file)
 		goto error;
+	if (file->group->flags & FS_NO_UPLOAD)
+		goto error;
 
 	host_client->downloadsize = file->len;
 	host_client->downloadcount = 0;
-	host_client->download = file->open(file, false);
+	host_client->download = file->open(file, 0);
 
 	if (!file || !host_client->download) {
 error: