mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
make homedir patch to support on-the-fly game directory switching
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@999 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
1c4c5ba254
commit
553a640f35
1 changed files with 41 additions and 11 deletions
|
@ -1,12 +1,10 @@
|
|||
initial experimental support for user directories, based on uhexen2
|
||||
and tyrquake:
|
||||
** against quakespasm svn revision 994.
|
||||
** on-the-fly game directory switching not supported yet.
|
||||
** minimally tested, needs more work.
|
||||
initial support for user directories, based on uhexen2 and tyrquake.
|
||||
|
||||
** minimally tested. **
|
||||
|
||||
Index: Quake/sys_sdl_unix.c
|
||||
===================================================================
|
||||
--- Quake/sys_sdl_unix.c (revision 994)
|
||||
--- Quake/sys_sdl_unix.c (revision 998)
|
||||
+++ Quake/sys_sdl_unix.c (working copy)
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
|
@ -74,9 +72,9 @@ Index: Quake/sys_sdl_unix.c
|
|||
void Sys_mkdir (const char *path)
|
||||
Index: Quake/common.c
|
||||
===================================================================
|
||||
--- Quake/common.c (revision 994)
|
||||
--- Quake/common.c (revision 998)
|
||||
+++ Quake/common.c (working copy)
|
||||
@@ -1919,6 +1919,7 @@ static void COM_AddGameDirectory (const
|
||||
@@ -1918,6 +1918,7 @@ static void COM_AddGameDirectory (const
|
||||
searchpath_t *search;
|
||||
pack_t *pak, *qspak;
|
||||
char pakfile[MAX_OSPATH];
|
||||
|
@ -84,7 +82,7 @@ Index: Quake/common.c
|
|||
|
||||
q_strlcpy (com_gamedir, va("%s/%s", base, dir), sizeof(com_gamedir));
|
||||
|
||||
@@ -1927,6 +1928,7 @@ static void COM_AddGameDirectory (const
|
||||
@@ -1926,6 +1927,7 @@ static void COM_AddGameDirectory (const
|
||||
path_id = com_searchpaths->path_id << 1;
|
||||
else path_id = 1U;
|
||||
|
||||
|
@ -92,7 +90,7 @@ Index: Quake/common.c
|
|||
// add the directory to the search path
|
||||
search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t));
|
||||
search->path_id = path_id;
|
||||
@@ -1943,6 +1945,7 @@ static void COM_AddGameDirectory (const
|
||||
@@ -1942,6 +1944,7 @@ static void COM_AddGameDirectory (const
|
||||
qspak = NULL;
|
||||
else {
|
||||
qboolean old = com_modified;
|
||||
|
@ -100,7 +98,7 @@ Index: Quake/common.c
|
|||
q_snprintf (pakfile, sizeof(pakfile), "%s/quakespasm.pak", base);
|
||||
qspak = COM_LoadPackFile (pakfile);
|
||||
com_modified = old;
|
||||
@@ -1963,6 +1966,14 @@ static void COM_AddGameDirectory (const
|
||||
@@ -1962,6 +1965,14 @@ static void COM_AddGameDirectory (const
|
||||
}
|
||||
if (!pak) break;
|
||||
}
|
||||
|
@ -115,3 +113,35 @@ Index: Quake/common.c
|
|||
}
|
||||
|
||||
/*
|
||||
Index: Quake/host_cmd.c
|
||||
===================================================================
|
||||
--- Quake/host_cmd.c (revision 998)
|
||||
+++ Quake/host_cmd.c (working copy)
|
||||
@@ -149,10 +149,12 @@ void Host_Game_f (void)
|
||||
|
||||
if (q_strcasecmp(p, GAMENAME)) //game is not id1
|
||||
{
|
||||
+ qboolean been_here = false;
|
||||
// assign a path_id to this game directory
|
||||
if (com_searchpaths)
|
||||
path_id = com_searchpaths->path_id << 1;
|
||||
else path_id = 1U;
|
||||
+ _add_path:
|
||||
search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t));
|
||||
search->path_id = path_id;
|
||||
q_strlcpy (search->filename, com_gamedir, sizeof(search->filename));
|
||||
@@ -172,6 +174,14 @@ void Host_Game_f (void)
|
||||
search->next = com_searchpaths;
|
||||
com_searchpaths = search;
|
||||
}
|
||||
+
|
||||
+ if (!been_here && host_parms->userdir != host_parms->basedir)
|
||||
+ {
|
||||
+ been_here = true;
|
||||
+ q_strlcpy(com_gamedir, va("%s/%s", host_parms->userdir, p), sizeof(com_gamedir));
|
||||
+ Sys_mkdir(com_gamedir);
|
||||
+ goto _add_path;
|
||||
+ }
|
||||
}
|
||||
|
||||
//clear out and reload appropriate data
|
||||
|
|
Loading…
Reference in a new issue