Let's see if initializing localfile properly closes #131

This commit is contained in:
GenericHeroGuy 2025-09-29 16:34:58 +02:00
parent fbc33d1517
commit a56213921e
4 changed files with 7 additions and 8 deletions

View file

@ -167,7 +167,7 @@ UINT8 *PutFileNeeded(UINT16 firstfile)
for (; i < numwadfiles; i++) //mainwads+1, otherwise we start on the first mainwad
{
// If it has only music/sound lumps, don't put it in the list
if (!wadfiles[i]->important)
if (!wadfiles[i]->important || wadfiles[i]->localfile)
continue;
if (firstfile)
@ -563,7 +563,7 @@ INT32 CL_CheckFiles(void)
// CONS_Printf("checking %d of %d / %d of %d?\n", i, fileneedednum, j, numwadfiles);
// CONS_Printf("i: %s / j: %s \n", fileneeded[i].filename, wadfiles[j]->filename);
if (j < numwadfiles && !wadfiles[j]->important && !wadfiles[j]->localfile)
if (j < numwadfiles && (!wadfiles[j]->important || wadfiles[j]->localfile))
{
// Unimportant on our side.
++j;

View file

@ -9513,7 +9513,7 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, wadcompat_t compat, boolean
// UINT16 mapPos, mapNum = 0;
// Init file.
if ((numlumps = W_InitFile(wadfilename, false, false, compat)) == INT16_MAX)
if ((numlumps = W_InitFile(wadfilename, false, false, local, compat)) == INT16_MAX)
{
refreshdirmenu |= REFRESHDIR_NOTLOADED;
return UINT16_MAX;
@ -9526,8 +9526,6 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, wadcompat_t compat, boolean
partadd_important = true;
}
wadfiles[wadnum]->localfile = local;
if (partadd_stage != 0)
{
partadd_earliestfile = wadnum;

View file

@ -869,7 +869,7 @@ static UINT16 W_InitFileError (const char *filename, boolean exitworthy)
//
// Can now load dehacked files (.soc)
//
UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup, wadcompat_t compat)
UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup, boolean local, wadcompat_t compat)
{
FILE *handle;
lumpinfo_t *lumpinfo = NULL;
@ -981,6 +981,7 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup, wadco
fseek(handle, 0, SEEK_END);
wadfile->filesize = (unsigned)ftell(handle);
wadfile->type = type;
wadfile->localfile = local;
// already generated, just copy it over
wadfile->hash = filehash;
@ -1076,7 +1077,7 @@ INT32 W_InitMultipleFiles(char **filenames, boolean addons)
G_SetGameModified(true, false);
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
rc = W_InitFile(*filenames, !addons, true, WC_AUTO);
rc = W_InitFile(*filenames, !addons, true, false, WC_AUTO);
if (rc == INT16_MAX)
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames);
overallrc &= (rc != INT16_MAX) ? 1 : 0;

View file

@ -154,7 +154,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, boolean mainfile, boolean startup, wadcompat_t compat);
UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup, boolean local, wadcompat_t compat);
boolean W_MakeFileHash(const char *filename, boolean openwad, UINT64 *ret);