From e679dfe0aa059cca68bc67da5a45c12c26dfd9ac Mon Sep 17 00:00:00 2001 From: haya_underscore Date: Wed, 5 Oct 2022 11:27:28 +0800 Subject: [PATCH] bogus fix for localskins not properly saving when returning back into the titlescreen --- src/p_setup.c | 9 ++++++++- src/w_wad.c | 15 +++++++++------ src/w_wad.h | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index f24a02ee5..f7a2bb05f 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3418,6 +3418,13 @@ boolean P_SetupLevel(boolean skipprecip) #endif } + /* testing purposes + CONS_Printf(M_GetText("Local skin number is %d\n"), players[consoleplayer].localskin); + for (i = 0; i < numlocalskins; i++) { + CONS_Printf(M_GetText("Local skin number is %s\n"), localskins[players[consoleplayer].localskin - 1].name); + } + */ + G_AddMapToBuffer(gamemap-1); return true; @@ -3472,7 +3479,7 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local) boolean mapsadded = false; lumpinfo_t *lumpinfo; - if ((numlumps = W_InitFile(wadfilename)) == INT16_MAX) + if ((numlumps = W_InitFile(wadfilename, 0, &wadnum, local)) == INT16_MAX) { refreshdirmenu |= REFRESHDIR_NOTLOADED; CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename); diff --git a/src/w_wad.c b/src/w_wad.c index 040233487..625484fbc 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -690,7 +690,7 @@ static void W_ReadFileShaders(wadfile_t *wadfile) // // Can now load dehacked files (.soc) // -UINT16 W_InitFile(const char *filename) +UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, boolean local) { FILE *handle; lumpinfo_t *lumpinfo = NULL; @@ -743,10 +743,13 @@ UINT16 W_InitFile(const char *filename) { if (!memcmp(wadfiles[i]->md5sum, md5sum, 16)) { - CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename); - if (handle) - fclose(handle); - return INT16_MAX; + if (!local) { + CONS_Alert(CONS_ERROR, M_GetText("%s is already loaded\n"), filename); + if (handle) + fclose(handle); + return INT16_MAX; + } + CONS_Alert(CONS_WARNING, M_GetText("%s is a local skin that is already loaded\n"), filename); } } #endif @@ -898,7 +901,7 @@ INT32 W_InitMultipleFiles(char **filenames, boolean addons) G_SetGameModified(true, false); //CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames); - rc = W_InitFile(*filenames); + rc = W_InitFile(*filenames, 0, 0, false); if (rc == INT16_MAX) CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames); overallrc &= (rc != INT16_MAX) ? 1 : 0; diff --git a/src/w_wad.h b/src/w_wad.h index 4a9be3c78..d2b72b74a 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -129,7 +129,7 @@ void W_Shutdown(void); // Opens a WAD file. Returns the FILE * handle for the file, or NULL if not found or could not be opened FILE *W_OpenWadFile(const char **filename, boolean useerrors); // Load and add a wadfile to the active wad files, returns numbers of lumps, INT16_MAX on error -UINT16 W_InitFile(const char *filename); +UINT16 W_InitFile(const char *filename, const char *lumpname, UINT16 *wadnump, boolean local); #ifdef DELFILE void W_UnloadWadFile(UINT16 num); #endif