From 7f78c093b70d252244be94576e0f0e565a98f5b8 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Fri, 30 Dec 2011 18:20:28 +0000 Subject: [PATCH] rediffed and adjusted the Misc/* extra patches so that they apply and compile correctly. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@589 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Misc/homedir_0.patch | 45 +++++++++++----------- Misc/quake_retexturing_project.patch | 57 ++++++++++++++-------------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Misc/homedir_0.patch b/Misc/homedir_0.patch index 11760f55..bbb65a28 100644 --- a/Misc/homedir_0.patch +++ b/Misc/homedir_0.patch @@ -1,12 +1,11 @@ -support for user directories, based on uhexen2 and tyrquake. -** against quakespasm svn revision 496. -** in alpha state, minimally tested. -** on-the-fly game directory changes not supported yet. -** needs more work. +support for user directories, based on uhexen2 and tyrquake: +** against quakespasm svn revision 588. +** on-the-fly game directory switching not supported yet. +** minimally tested, needs more work. Index: Quake/sys_sdl_unix.c =================================================================== ---- Quake/sys_sdl_unix.c (revision 496) +--- Quake/sys_sdl_unix.c (revision 588) +++ Quake/sys_sdl_unix.c (working copy) @@ -20,6 +20,8 @@ @@ -74,14 +73,14 @@ Index: Quake/sys_sdl_unix.c void Sys_mkdir (const char *path) Index: Quake/common.c =================================================================== ---- Quake/common.c (revision 496) +--- Quake/common.c (revision 588) +++ Quake/common.c (working copy) -@@ -1822,32 +1822,34 @@ +@@ -1846,32 +1846,34 @@ pack_t *COM_LoadPackFile (const char *pa COM_AddGameDirectory -- johnfitz -- modified based on topaz's tutorial ================= */ --void COM_AddGameDirectory (const char *dir) -+void COM_AddGameDirectory (const char *base, const char *dir) +-static void COM_AddGameDirectory (const char *dir) ++static void COM_AddGameDirectory (const char *base, const char *dir) { int i; unsigned int path_id; @@ -90,8 +89,8 @@ Index: Quake/common.c char pakfile[MAX_OSPATH]; + qboolean been_here = false; -- strcpy (com_gamedir, dir); -+ strcpy (com_gamedir, va("%s/%s", base, dir)); +- q_strlcpy (com_gamedir, dir, sizeof(com_gamedir)); ++ q_strlcpy (com_gamedir, va("%s/%s", base, dir), sizeof(com_gamedir)); // assign a path_id to this game directory if (com_searchpaths) @@ -102,20 +101,20 @@ Index: Quake/common.c // add the directory to the search path search = (searchpath_t *) Z_Malloc(sizeof(searchpath_t)); search->path_id = path_id; -- strcpy (search->filename, dir); -+ strcpy (search->filename, com_gamedir); +- q_strlcpy (search->filename, dir, sizeof(search->filename)); ++ q_strlcpy (search->filename, com_gamedir, sizeof(search->filename)); search->next = com_searchpaths; com_searchpaths = search; // add any pak files in the format pak0.pak pak1.pak, ... for (i = 0; ; i++) { -- sprintf (pakfile, "%s/pak%i.pak", dir, i); -+ sprintf (pakfile, "%s/pak%i.pak", com_gamedir, i); +- q_snprintf (pakfile, sizeof(pakfile), "%s/pak%i.pak", dir, i); ++ q_snprintf (pakfile, sizeof(pakfile), "%s/pak%i.pak", com_gamedir, i); pak = COM_LoadPackFile (pakfile); if (!pak) break; -@@ -1857,6 +1859,14 @@ +@@ -1881,6 +1883,14 @@ static void COM_AddGameDirectory (const search->next = com_searchpaths; com_searchpaths = search; } @@ -123,24 +122,24 @@ Index: Quake/common.c + if (!been_here && host_parms->userdir != host_parms->basedir) + { + been_here = true; -+ strcpy(com_gamedir, va("%s/%s", host_parms->userdir, dir)); ++ q_strlcpy(com_gamedir, va("%s/%s", host_parms->userdir, dir), sizeof(com_gamedir)); + Sys_mkdir(com_gamedir); + goto _add_path; + } } #if defined(USE_QS_CONBACK) -@@ -1907,8 +1917,7 @@ +@@ -1935,8 +1945,7 @@ void COM_InitFilesystem (void) //johnfit } // start up with GAMENAME by default (id1) - COM_AddGameDirectory (va("%s/"GAMENAME, com_basedir)); -- strcpy (com_gamedir, va("%s/"GAMENAME, com_basedir)); +- q_strlcpy (com_gamedir, va("%s/"GAMENAME, com_basedir), sizeof(com_gamedir)); + COM_AddGameDirectory (com_basedir, GAMENAME); #if defined(USE_QS_CONBACK) if (!fitzmode) -@@ -1922,17 +1931,17 @@ +@@ -1950,17 +1959,17 @@ void COM_InitFilesystem (void) //johnfit com_nummissionpacks = 0; if (COM_CheckParm ("-rogue")) { @@ -161,12 +160,12 @@ Index: Quake/common.c com_nummissionpacks++; } //johnfitz -@@ -1941,7 +1950,7 @@ +@@ -1969,7 +1978,7 @@ void COM_InitFilesystem (void) //johnfit if (i && i < com_argc-1) { com_modified = true; - COM_AddGameDirectory (va("%s/%s", com_basedir, com_argv[i + 1])); + COM_AddGameDirectory (com_basedir, com_argv[i + 1]); } - } + COM_CheckRegistered (); diff --git a/Misc/quake_retexturing_project.patch b/Misc/quake_retexturing_project.patch index 4281c619..abb2f968 100644 --- a/Misc/quake_retexturing_project.patch +++ b/Misc/quake_retexturing_project.patch @@ -1,8 +1,9 @@ + Index: Quake/gl_model.c =================================================================== ---- Quake/gl_model.c (revision 508) +--- Quake/gl_model.c (revision 588) +++ Quake/gl_model.c (working copy) -@@ -386,6 +386,8 @@ void Mod_LoadTextures (lump_t *l) +@@ -387,6 +387,8 @@ void Mod_LoadTextures (lump_t *l) extern byte *hunk_base; //johnfitz @@ -11,7 +12,7 @@ Index: Quake/gl_model.c //johnfitz -- don't return early if no textures; still need to create dummy texture if (!l->filelen) { -@@ -437,7 +439,17 @@ void Mod_LoadTextures (lump_t *l) +@@ -438,7 +440,17 @@ void Mod_LoadTextures (lump_t *l) if (!isDedicated) //no texture uploading for dedicated server { if (!Q_strncasecmp(tx->name,"sky",3)) //sky texture //also note -- was Q_strncmp, changed to match qbsp @@ -20,7 +21,7 @@ Index: Quake/gl_model.c + if (r_externaltexture_fix.value) { + if (strstr(tx->name,"sky4")) { + if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==13039) -+ strcpy(tx->name,"sky1"); ++ q_strlcpy(tx->name, "sky1", sizeof(tx->name)); + Con_Printf(" using %s\n", tx->name); + } + } //mk -- end @@ -29,74 +30,74 @@ Index: Quake/gl_model.c else if (tx->name[0] == '*') //warping texture { //external textures -- first look in "textures/mapname/" then look in "textures/" -@@ -479,6 +491,52 @@ void Mod_LoadTextures (lump_t *l) +@@ -480,6 +492,52 @@ void Mod_LoadTextures (lump_t *l) //external textures -- first look in "textures/mapname/" then look in "textures/" mark = Hunk_LowMark (); - COM_StripExtension (loadmodel->name + 5, mapname); + COM_StripExtension (loadmodel->name + 5, mapname, sizeof(mapname)); + //mk begin + if (r_externaltexture_fix.value) { + if (strstr(tx->name,"plat_top1")) { + if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==24428) -+ strcpy(tx->name,"plat_top1_cable"); ++ q_strlcpy(tx->name, "plat_top1_cable", sizeof(tx->name)); + else -+ strcpy(tx->name,"plat_top1_bolt"); ++ q_strlcpy(tx->name, "plat_top1_bolt", sizeof(tx->name)); + Con_Printf(" using %s\n", tx->name); + } + + if (strstr(tx->name,"metal5_2")) { + if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==49173) -+ strcpy(tx->name,"metal5_2_x"); ++ q_strlcpy(tx->name, "metal5_2_x", sizeof(tx->name)); + else -+ strcpy(tx->name,"metal5_2_arc"); ++ q_strlcpy(tx->name, "metal5_2_arc", sizeof(tx->name)); + Con_Printf(" using %s\n", tx->name); + } + + if (strstr(tx->name,"metal5_4")) { + if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==20977) -+ strcpy(tx->name,"metal5_4_double"); ++ q_strlcpy(tx->name, "metal5_4_double", sizeof(tx->name)); + else -+ strcpy(tx->name,"metal5_4_arc"); ++ q_strlcpy(tx->name, "metal5_4_arc", sizeof(tx->name)); + Con_Printf(" using %s\n", tx->name); + } + if (strstr(tx->name,"metal5_8")) { + if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==48444) -+ strcpy(tx->name,"metal5_8_rune"); ++ q_strlcpy(tx->name, "metal5_8_rune", sizeof(tx->name)); + else -+ strcpy(tx->name,"metal5_8_back"); ++ q_strlcpy(tx->name, "metal5_8_back", sizeof(tx->name)); + Con_Printf(" using %s\n", tx->name); + } + if (strstr(tx->name,"metal5_8")) { + if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==48444) -+ strcpy(tx->name,"metal5_8_rune"); ++ q_strlcpy(tx->name, "metal5_8_rune", sizeof(tx->name)); + else -+ strcpy(tx->name,"metal5_8_back"); ++ q_strlcpy(tx->name, "metal5_8_back", sizeof(tx->name)); + Con_Printf(" using %s\n", tx->name); + } + if (strstr(tx->name,"window03")) { + if (CRC_Block((byte *)(tx+1), tx->width * tx->height)==63697) // e4m2 variant -+ strcpy(tx->name,"window03_e4m2"); ++ q_strlcpy(tx->name, "window03_e4m2", sizeof(tx->name)); + Con_Printf(" using %s\n", tx->name); + } + } //mk end + - sprintf (filename, "textures/%s/%s", mapname, tx->name); + q_snprintf (filename, sizeof(filename), "textures/%s/%s", mapname, tx->name); data = Image_LoadImage (filename, &fwidth, &fheight); if (!data) Index: Quake/gl_rmain.c =================================================================== ---- Quake/gl_rmain.c (revision 508) +--- Quake/gl_rmain.c (revision 588) +++ Quake/gl_rmain.c (working copy) @@ -102,6 +102,7 @@ - cvar_t r_nolerp_list = {"r_nolerp_list", "progs/flame.mdl,progs/flame2.mdl,progs/braztall.mdl,progs/brazshrt.mdl,progs/longtrch.mdl,progs/flame_pyre.mdl,progs/v_saw.mdl,progs/v_xfist.mdl,progs/h2stuff/newfire.mdl"}; + cvar_t r_nolerp_list = {"r_nolerp_list", "progs/flame.mdl,progs/flame2.mdl,progs/braztall.mdl,progs/brazshrt.mdl,progs/longtrch.mdl,progs/flame_pyre.mdl,progs/v_saw.mdl,progs/v_xfist.mdl,progs/h2stuff/newfire.mdl", CVAR_NONE}; extern cvar_t r_vfog; //johnfitz -+cvar_t r_externaltexture_fix = {"r_externaltexture_fix","0", true}; //mk ++cvar_t r_externaltexture_fix = {"r_externaltexture_fix","0", CVAR_ARCHIVE}; //mk - cvar_t gl_zfix = {"gl_zfix", "1", true}; // QuakeSpasm z-fighting fix + cvar_t gl_zfix = {"gl_zfix", "1", CVAR_ARCHIVE}; // QuakeSpasm z-fighting fix Index: Quake/gl_rmisc.c =================================================================== ---- Quake/gl_rmisc.c (revision 508) +--- Quake/gl_rmisc.c (revision 588) +++ Quake/gl_rmisc.c (working copy) @@ -44,6 +44,7 @@ extern cvar_t r_lerpmove; @@ -106,12 +107,12 @@ Index: Quake/gl_rmisc.c extern cvar_t gl_zfix; // QuakeSpasm z-fighting fix -@@ -241,6 +242,7 @@ void R_Init (void) - Cvar_RegisterVariable (&r_lerpmove, NULL); - Cvar_RegisterVariable (&r_nolerp_list, R_NoLerpList_f); +@@ -243,6 +244,7 @@ void R_Init (void) + Cvar_RegisterVariable (&r_nolerp_list); + Cvar_SetCallback (&r_nolerp_list, R_NoLerpList_f); //johnfitz -+ Cvar_RegisterVariable (&r_externaltexture_fix, NULL); //mk ++ Cvar_RegisterVariable (&r_externaltexture_fix); //mk - Cvar_RegisterVariable (&gl_zfix, NULL); // QuakeSpasm z-fighting fix + Cvar_RegisterVariable (&gl_zfix); // QuakeSpasm z-fighting fix