diff --git a/assets/CMakeLists.txt b/assets/CMakeLists.txt index 1eab62cc9..89be796ad 100644 --- a/assets/CMakeLists.txt +++ b/assets/CMakeLists.txt @@ -13,12 +13,12 @@ set(SRB2_ASSET_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/installer" CACHE STRING "Path to directory that contains all asset files for the installer.") set(SRB2_ASSET_HASHED -"srb2.srb;\ -patch.kart;\ -gfx.kart;\ -textures.kart;\ -chars.kart;\ -maps.kart" +"main.kart;\ +gfx.pk3;\ +textures.pk3;\ +chars.pk3;\ +maps.wad;\ +patch.pk3" CACHE STRING "Asset filenames to apply MD5 checks. No spaces between entries!" ) diff --git a/src/Makefile b/src/Makefile index 214c2bf7a..f4a77aedd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -83,16 +83,14 @@ # SRB2 data files D_DIR?=../bin/Resources -D_FILES=$(D_DIR)/srb2.srb \ - $(D_DIR)/patch.dta \ - #$(D_DIR)/music.dta \ - $(D_DIR)/gfx.kart \ - $(D_DIR)/textures.kart \ - $(D_DIR)/chars.kart \ - $(D_DIR)/maps.kart \ - $(D_DIR)/sounds.kart \ - $(D_DIR)/patch.kart \ - $(D_DIR)/music.kart \ +D_FILES=$(D_DIR)/main.kart \ + $(D_DIR)/gfx.pk3 \ + $(D_DIR)/textures.pk3 \ + $(D_DIR)/chars.pk3 \ + $(D_DIR)/maps.wad \ + $(D_DIR)/patch.pk3 \ + $(D_DIR)/sounds.wad \ + $(D_DIR)/music.wad \ PKG_CONFIG?=pkg-config diff --git a/src/config.h.in b/src/config.h.in index 338647435..92708a46c 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -11,19 +11,13 @@ #ifdef CMAKECONFIG -// Base SRB2 hashes -#define ASSET_HASH_SRB2_SRB "${SRB2_ASSET_srb2.srb_HASH}" -#ifdef USE_PATCH_DTA -#define ASSET_HASH_PATCH_DTA "${SRB2_ASSET_patch.dta_HASH}" -#endif - -// SRB2Kart-specific hashes -#define ASSET_HASH_GFX_KART "${SRB2_ASSET_gfx.kart_HASH}" -#define ASSET_HASH_TEXTURES_KART "${SRB2_ASSET_textures.kart_HASH}" -#define ASSET_HASH_CHARS_KART "${SRB2_ASSET_chars.kart_HASH}" -#define ASSET_HASH_MAPS_KART "${SRB2_ASSET_maps.kart_HASH}" -#ifdef USE_PATCH_KART -#define ASSET_HASH_PATCH_KART "${SRB2_ASSET_patch.kart_HASH}" +#define ASSET_HASH_MAIN_KART "${SRB2_ASSET_main.kart_HASH}" +#define ASSET_HASH_GFX_PK3 "${SRB2_ASSET_gfx.pk3_HASH}" +#define ASSET_HASH_TEXTURES_PK3 "${SRB2_ASSET_textures.pk3_HASH}" +#define ASSET_HASH_CHARS_PK3 "${SRB2_ASSET_chars.pk3_HASH}" +#define ASSET_HASH_MAPS_WAD "${SRB2_ASSET_maps.wad_HASH}" +#ifdef USE_PATCH_FILE +#define ASSET_HASH_PATCH_PK3 "${SRB2_ASSET_patch.pk3_HASH}" #endif #define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}" @@ -34,25 +28,17 @@ #else /* Manually defined asset hashes for non-CMake builds - * Last updated 2015 / 05 / 03 - SRB2 v2.1.15 - srb2.srb - * Last updated 2018 / 12 / 23 - SRB2 v2.1.22 - patch.dta * Last updated 2019 / 01 / 18 - Kart v1.0.2 - Main assets * Last updated 2019 / 05 / 06 - Kart v1.1.0 - patch.kart */ -// Base SRB2 hashes -#define ASSET_HASH_SRB2_SRB "c1b9577687f8a795104aef4600720ea7" -#ifdef USE_PATCH_DTA -#define ASSET_HASH_PATCH_DTA "b04fd9624bfd94dc96dcf4f400f7deb4" -#endif - -// SRB2Kart-specific hashes -#define ASSET_HASH_GFX_KART "99c39f223d84ebc78e67ab68f3bead95" -#define ASSET_HASH_TEXTURES_KART "ec8e9b7535cf585afe72ef277b08f490" -#define ASSET_HASH_CHARS_KART "e2c428347dde52858a3dacd29fc5b964" -#define ASSET_HASH_MAPS_KART "1335cd064656aedca359cfbb5233ac4a" -#ifdef USE_PATCH_KART -#define ASSET_HASH_PATCH_KART "6461b30bb20754a16a1b582120f55842" +#define ASSET_HASH_MAIN_KART "00000000000000000000000000000000" +#define ASSET_HASH_GFX_PK3 "99c39f223d84ebc78e67ab68f3bead95" +#define ASSET_HASH_TEXTURES_PK3 "ec8e9b7535cf585afe72ef277b08f490" +#define ASSET_HASH_CHARS_PK3 "e2c428347dde52858a3dacd29fc5b964" +#define ASSET_HASH_MAPS_WAD "1335cd064656aedca359cfbb5233ac4a" +#ifdef USE_PATCH_FILE +#define ASSET_HASH_PATCH_PK3 "6461b30bb20754a16a1b582120f55842" #endif #endif diff --git a/src/d_main.c b/src/d_main.c index 467976c17..1404a5e61 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -836,11 +836,11 @@ static inline void D_CleanFile(char **filearray) static void IdentifyVersion(void) { - char *srb2wad1, *srb2wad2; + char *mainresource; const char *srb2waddir = NULL; #if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL) - // change to the directory where 'srb2.srb' is found + // change to the directory where 'main.kart' is found srb2waddir = I_LocateWad(); #endif @@ -871,46 +871,34 @@ static void IdentifyVersion(void) srb2waddir = I_GetWadDir(); #endif // Commercial. - srb2wad1 = malloc(strlen(srb2waddir)+1+8+1); - srb2wad2 = malloc(strlen(srb2waddir)+1+8+1); - if (srb2wad1 == NULL && srb2wad2 == NULL) + mainresource = malloc(strlen(srb2waddir)+1+9+1); + if (mainresource == NULL) I_Error("No more free memory to look in %s", srb2waddir); - if (srb2wad1 != NULL) - sprintf(srb2wad1, pandf, srb2waddir, "srb2.srb"); - if (srb2wad2 != NULL) - sprintf(srb2wad2, pandf, srb2waddir, "srb2.wad"); + if (mainresource != NULL) + sprintf(mainresource, pandf, srb2waddir, "main.kart"); // will be overwritten in case of -cdrom or unix/win home snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, srb2waddir); configfile[sizeof configfile - 1] = '\0'; // Load the IWAD - if (srb2wad2 != NULL && FIL_ReadFileOK(srb2wad2)) - D_AddFile(srb2wad2, startupwadfiles); - else if (srb2wad1 != NULL && FIL_ReadFileOK(srb2wad1)) - D_AddFile(srb2wad1, startupwadfiles); + if (mainresource != NULL && FIL_ReadFileOK(mainresource)) + D_AddFile(mainresource, startupwadfiles); else - I_Error("SRB2.SRB/SRB2.WAD not found! Expected in %s, ss files: %s or %s\n", srb2waddir, srb2wad1, srb2wad2); + I_Error("MAIN.KART not found! Expected in %s, ss file: %s \n", srb2waddir, mainresource); - if (srb2wad1) - free(srb2wad1); - if (srb2wad2) - free(srb2wad2); + if (mainresource) + free(mainresource); // if you change the ordering of this or add/remove a file, be sure to update the md5 // checking in D_SRB2Main -#ifdef USE_PATCH_DTA - // Add our crappy patches to fix our bugs - D_AddFile(va(pandf,srb2waddir,"patch.dta")); -#endif - - D_AddFile(va(pandf,srb2waddir,"gfx.kart"), startupwadfiles); - D_AddFile(va(pandf,srb2waddir,"textures.kart"), startupwadfiles); - D_AddFile(va(pandf,srb2waddir,"chars.kart"), startupwadfiles); - D_AddFile(va(pandf,srb2waddir,"maps.kart"), startupwadfiles); -#ifdef USE_PATCH_KART - D_AddFile(va(pandf,srb2waddir,"patch.kart"), startupwadfiles); + D_AddFile(va(pandf,srb2waddir,"gfx.pk3"), startupwadfiles); + D_AddFile(va(pandf,srb2waddir,"textures.pk3"), startupwadfiles); + D_AddFile(va(pandf,srb2waddir,"chars.pk3"), startupwadfiles); + D_AddFile(va(pandf,srb2waddir,"maps.wad"), startupwadfiles); // TODO: make this a pk3 too! +#ifdef USE_PATCH_FILE + D_AddFile(va(pandf,srb2waddir,"patch.pk3"), startupwadfiles); #endif #if !defined (HAVE_SDL) || defined (HAVE_MIXER) @@ -923,8 +911,8 @@ static void IdentifyVersion(void) else if (ms == 0) \ I_Error("File "str" has been modified with non-music/sound lumps"); \ } - MUSICTEST("sounds.kart") - MUSICTEST("music.kart") + MUSICTEST("sounds.wad") + MUSICTEST("music.wad") #undef MUSICTEST #endif } @@ -1208,27 +1196,21 @@ void D_SRB2Main(void) #ifndef DEVELOP // Check MD5s of autoloaded files // Note: Do not add any files that ignore MD5! - W_VerifyFileMD5(mainwads, ASSET_HASH_SRB2_SRB); // srb2.srb/srb2.wad -#ifdef USE_PATCH_DTA - mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_PATCH_DTA); // patch.dta -#endif - mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_GFX_KART); // gfx.kart - mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_TEXTURES_KART); // textures.kart - mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_CHARS_KART); // chars.kart - mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_MAPS_KART); // maps.kart -- 4 - If you touch this, make sure to touch up the majormods stuff below. -#ifdef USE_PATCH_KART - mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_PATCH_KART); // patch.kart + W_VerifyFileMD5(mainwads, ASSET_HASH_MAIN_KART); // main.kart + mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_GFX_PK3); // gfx.pk3 + mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_TEXTURES_PK3); // textures.pk3 + mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_CHARS_PK3); // chars.pk3 + mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_MAPS_WAD); // maps.wad -- 4 - If you touch this, make sure to touch up the majormods stuff below. +#ifdef USE_PATCH_FILE + mainwads++; W_VerifyFileMD5(mainwads, ASSET_HASH_PATCH_PK3); // patch.pk3 #endif #else -#ifdef USE_PATCH_DTA - mainwads++; // patch.dta -#endif - mainwads++; // gfx.kart - mainwads++; // textures.kart - mainwads++; // chars.kart - mainwads++; // maps.kart -#ifdef USE_PATCH_KART - mainwads++; // patch.kart + mainwads++; // gfx.pk3 + mainwads++; // textures.pk3 + mainwads++; // chars.pk3 + mainwads++; // maps.wad +#ifdef USE_PATCH_FILE + mainwads++; // patch.pk3 #endif #endif //ifndef DEVELOP diff --git a/src/d_netfil.c b/src/d_netfil.c index 4dcd3da4a..0b9dc9126 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -358,7 +358,6 @@ INT32 CL_CheckFiles(void) // return 1; // the first is the iwad (the main wad file) - // we don't care if it's called srb2.srb or srb2.wad. // Never download the IWAD, just assume it's there and identical // ...No! Why were we sending the base wads to begin with?? //fileneeded[0].status = FS_OPEN; @@ -774,17 +773,14 @@ void Got_Filetxpak(void) char *filename = file->filename; static INT32 filetime = 0; - if (!(strcmp(filename, "srb2.srb") - && strcmp(filename, "srb2.wad") - && strcmp(filename, "patch.dta") - //&& strcmp(filename, "music.dta") - && strcmp(filename, "gfx.kart") - && strcmp(filename, "textures.kart") - && strcmp(filename, "chars.kart") - && strcmp(filename, "maps.kart") - && strcmp(filename, "sounds.kart") - && strcmp(filename, "music.kart") - && strcmp(filename, "patch.kart") + if (!(strcmp(filename, "main.kart") + && strcmp(filename, "gfx.pk3") + && strcmp(filename, "textures.pk3") + && strcmp(filename, "chars.pk3") + && strcmp(filename, "maps.wad") + && strcmp(filename, "patch.pk3") + && strcmp(filename, "sounds.wad") + && strcmp(filename, "music.wad") )) I_Error("Tried to download \"%s\"", filename); diff --git a/src/dehacked.c b/src/dehacked.c index 7b1b321d7..5cd152982 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3749,8 +3749,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, UINT16 wad) } else if (fastcmp(word, "SRB2")) { - if (mainwads) // srb2.srb triggers this warning otherwise - deh_warning("Patch is only compatible with base SRB2."); + deh_warning("Patch is only compatible with base SRB2."); } // Clear all data in certain locations (mostly for unlocks) // Unless you REALLY want to piss people off, diff --git a/src/doomdef.h b/src/doomdef.h index 4ab40853a..8b1ad4138 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -163,10 +163,7 @@ extern FILE *logstream; // Does this version require an added patch file? // Comment or uncomment this as necessary. -//#define USE_PATCH_DTA - -// Kart has it's own, as well. -#define USE_PATCH_KART +//#define USE_PATCH_FILE // Use .kart extension addons #define USE_KART diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 31beecf09..c6f2f782b 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -443,26 +443,26 @@ static int libd_drawFill(lua_State *L) static int libd_fadeScreen(lua_State *L) { - UINT16 color = luaL_checkinteger(L, 1); - UINT8 strength = luaL_checkinteger(L, 2); - const UINT8 maxstrength = ((color & 0xFF00) ? 32 : 10); + UINT16 color = luaL_checkinteger(L, 1); + UINT8 strength = luaL_checkinteger(L, 2); + const UINT8 maxstrength = ((color & 0xFF00) ? 32 : 10); - HUDONLY + HUDONLY - if (!strength) - return 0; + if (!strength) + return 0; - if (strength > maxstrength) - return luaL_error(L, "%s fade strength %d out of range (0 - %d)", ((color & 0xFF00) ? "COLORMAP" : "TRANSMAP"), strength, maxstrength); + if (strength > maxstrength) + return luaL_error(L, "%s fade strength %d out of range (0 - %d)", ((color & 0xFF00) ? "COLORMAP" : "TRANSMAP"), strength, maxstrength); - if (strength == maxstrength) // Allow as a shortcut for drawfill... - { - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, ((color & 0xFF00) ? 31 : color)); - return 0; - } + if (strength == maxstrength) // Allow as a shortcut for drawfill... + { + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, ((color & 0xFF00) ? 31 : color)); + return 0; + } - V_DrawFadeScreen(color, strength); - return 0; + V_DrawFadeScreen(color, strength); + return 0; } static int libd_drawString(lua_State *L) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index c0fca64da..d24bd5ade 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -131,7 +131,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include #endif -// Locations for searching the srb2.srb +// Locations for searching for main.kart #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) #define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2Kart" #define DEFAULTWADLOCATION2 "/usr/local/games/SRB2Kart" @@ -149,8 +149,7 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); /** \brief WAD file to look for */ -#define WADKEYWORD1 "srb2.srb" -#define WADKEYWORD2 "srb2.wad" +#define WADKEYWORD "main.kart" /** \brief holds wad path */ static char returnWadPath[256]; @@ -3454,15 +3453,7 @@ static boolean isWadPathOk(const char *path) if (!wad3path) return false; - sprintf(wad3path, pandf, path, WADKEYWORD1); - - if (FIL_ReadFileOK(wad3path)) - { - free(wad3path); - return true; - } - - sprintf(wad3path, pandf, path, WADKEYWORD2); + sprintf(wad3path, pandf, path, WADKEYWORD); if (FIL_ReadFileOK(wad3path)) { @@ -3487,7 +3478,7 @@ static void pathonly(char *s) } } -/** \brief search for srb2.srb in the given path +/** \brief search for main.kart in the given path \param searchDir starting path @@ -3500,7 +3491,7 @@ static const char *searchWad(const char *searchDir) static char tempsw[256] = ""; filestatus_t fstemp; - strcpy(tempsw, WADKEYWORD1); + strcpy(tempsw, WADKEYWORD); fstemp = filesearch(tempsw,searchDir,NULL,true,20); if (fstemp == FS_FOUND) { @@ -3508,19 +3499,12 @@ static const char *searchWad(const char *searchDir) return tempsw; } - strcpy(tempsw, WADKEYWORD2); - fstemp = filesearch(tempsw, searchDir, NULL, true, 20); - if (fstemp == FS_FOUND) - { - pathonly(tempsw); - return tempsw; - } return NULL; } -/** \brief go through all possible paths and look for srb2.srb +/** \brief go through all possible paths and look for main.kart - \return path to srb2.srb if any + \return path to main.kart if any */ static const char *locateWad(void) { @@ -3649,7 +3633,7 @@ const char *I_LocateWad(void) if (waddir) { - // change to the directory where we found srb2.srb + // change to the directory where we found main.kart #if defined (_WIN32) SetCurrentDirectoryA(waddir); #else diff --git a/src/sdl12/i_system.c b/src/sdl12/i_system.c index d055a4ca5..62256f3a5 100644 --- a/src/sdl12/i_system.c +++ b/src/sdl12/i_system.c @@ -145,7 +145,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s? #define O_BINARY 0 #endif -// Locations for searching the srb2.srb +// Locations for searching the main.kart #ifdef _arch_dreamcast #define DEFAULTWADLOCATION1 "/cd" #define DEFAULTWADLOCATION2 "/pc" @@ -217,8 +217,7 @@ void __set_fpscr(long); // in libgcc / kernel's startup.s? /** \brief WAD file to look for */ -#define WADKEYWORD1 "srb2.srb" -#define WADKEYWORD2 "srb2.wad" +#define WADKEYWORD "main.kart" /** \brief holds wad path */ static char returnWadPath[256]; @@ -3398,15 +3397,7 @@ static boolean isWadPathOk(const char *path) if (!wad3path) return false; - sprintf(wad3path, pandf, path, WADKEYWORD1); - - if (FIL_ReadFileOK(wad3path)) - { - free(wad3path); - return true; - } - - sprintf(wad3path, pandf, path, WADKEYWORD2); + sprintf(wad3path, pandf, path, WADKEYWORD); if (FIL_ReadFileOK(wad3path)) { @@ -3431,7 +3422,7 @@ static void pathonly(char *s) } } -/** \brief search for srb2.srb in the given path +/** \brief search for main.kart in the given path \param searchDir starting path @@ -3444,7 +3435,7 @@ static const char *searchWad(const char *searchDir) static char tempsw[256] = ""; filestatus_t fstemp; - strcpy(tempsw, WADKEYWORD1); + strcpy(tempsw, WADKEYWORD); fstemp = filesearch(tempsw,searchDir,NULL,true,20); if (fstemp == FS_FOUND) { @@ -3452,19 +3443,12 @@ static const char *searchWad(const char *searchDir) return tempsw; } - strcpy(tempsw, WADKEYWORD2); - fstemp = filesearch(tempsw, searchDir, NULL, true, 20); - if (fstemp == FS_FOUND) - { - pathonly(tempsw); - return tempsw; - } return NULL; } -/** \brief go through all possible paths and look for srb2.srb +/** \brief go through all possible paths and look for main.kart - \return path to srb2.srb if any + \return path to main.kart if any */ static const char *locateWad(void) { @@ -3581,7 +3565,7 @@ const char *I_LocateWad(void) if (waddir) { - // change to the directory where we found srb2.srb + // change to the directory where we found main.kart #if (defined (_WIN32) && !defined (_WIN32_WCE)) && !defined (_XBOX) SetCurrentDirectoryA(waddir); #elif !defined (_WIN32_WCE) && !defined (_PS3)