Force mark wad files added via 'addfilelocal' as not important #31

Merged
alufolie91 merged 1 commits from addfilelocal-not-important-wad into Saturn 2023-08-21 17:26:41 +02:00
7 changed files with 47 additions and 17 deletions

No files matched your search

+5 -3
View File
@@ -4453,7 +4453,7 @@ static void Command_Addfilelocal(void)
if (COM_Argc() != 2)
{
CONS_Printf(M_GetText("addfile <wadfile.wad>: load wad file\n"));
CONS_Printf(M_GetText("addfilelocal <wadfile.wad>: load wad file\n"));
return;
}
else
@@ -4464,8 +4464,10 @@ static void Command_Addfilelocal(void)
if (!isprint(fn[i]) || fn[i] == ';')
return;
// Add file on your client directly if it is trivial, or you aren't in a netgame.
P_AddWadFile(fn);
// Add any wad file, ignoring checks for if it contains complex things like
// lua. Great for complex but client-side customizations, like different
// level cards or anything like that.
P_AddWadFileLocal(fn);
}
+18 -5
View File
@@ -508,6 +508,9 @@ INT32 CL_CheckFiles(void)
if (modifiedgame)
{
CONS_Debug(DBG_NETPLAY, "game is modified; only doing basic checks\n");
boolean have_important = false;
for (i = 0, j = mainwads+1; i < fileneedednum || j < numwadfiles;)
{
if (j < numwadfiles && !wadfiles[j]->important)
@@ -517,10 +520,17 @@ INT32 CL_CheckFiles(void)
continue;
}
// If this test is true, we've reached the end of one file list
// and the other still has a file that's important
// If this test is true, we've reached the end of one file list.
if (i >= fileneedednum || j >= numwadfiles)
return 2;
{
// We are missing some of important files, or have too much
// important files.
if (have_important)
return 2;
// All checked files weren't important, don't care about them.
break;
}
// For the sake of speed, only bother with a md5 check
if (memcmp(wadfiles[j]->md5sum, fileneeded[i].md5sum, 16))
@@ -528,11 +538,14 @@ INT32 CL_CheckFiles(void)
// It's accounted for! let's keep going.
CONS_Debug(DBG_NETPLAY, "'%s' accounted for\n", fileneeded[i].filename);
have_important = true;
fileneeded[i].status = FS_OPEN;
++i;
++j;
}
return 1;
if (have_important)
return 1;
}
for (i = 0; i < fileneedednum; i++)
@@ -591,7 +604,7 @@ boolean CL_LoadServerFiles(void)
continue; // Already loaded
else if (fileneeded[i].status == FS_FOUND)
{
P_PartialAddWadFile(fileneeded[i].filename);
P_PartialAddWadFile(fileneeded[i].filename, false);
G_SetGameModified(true, false);
fileneeded[i].status = FS_OPEN;
return false;
+1 -1
View File
@@ -7073,7 +7073,7 @@ static void G_LoadDemoExtraFiles(UINT8 **pp)
}
else
{
P_PartialAddWadFile(filename);
P_PartialAddWadFile(filename, false);
}
}
}
+14 -3
View File
@@ -3453,7 +3453,18 @@ boolean P_AddWadFile(const char *wadfilename)
{
UINT16 wadnum;
if ((wadnum = P_PartialAddWadFile(wadfilename)) == UINT16_MAX)
if ((wadnum = P_PartialAddWadFile(wadfilename, false)) == UINT16_MAX)
return false;
P_MultiSetupWadFiles(true);
return true;
}
boolean P_AddWadFileLocal(const char *wadfilename)
{
UINT16 wadnum;
if ((wadnum = P_PartialAddWadFile(wadfilename, true)) == UINT16_MAX)
return false;
P_MultiSetupWadFiles(true);
@@ -3464,7 +3475,7 @@ boolean P_AddWadFile(const char *wadfilename)
// Add a WAD file and do the per-WAD setup stages.
// Call P_MultiSetupWadFiles as soon as possible after any number of these.
//
UINT16 P_PartialAddWadFile(const char *wadfilename)
UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
{
size_t i, j, sreplaces = 0, mreplaces = 0, digmreplaces = 0;
UINT16 numlumps, wadnum;
@@ -3472,7 +3483,7 @@ UINT16 P_PartialAddWadFile(const char *wadfilename)
boolean mapsadded = false;
lumpinfo_t *lumpinfo;
if ((numlumps = W_InitFile(wadfilename)) == INT16_MAX)
if ((numlumps = W_InitFile(wadfilename, local)) == INT16_MAX)
{
refreshdirmenu |= REFRESHDIR_NOTLOADED;
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename);
+2 -1
View File
@@ -61,6 +61,7 @@ void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum);
void P_LoadThingsOnly(void);
boolean P_SetupLevel(boolean skipprecip);
boolean P_AddWadFile(const char *wadfilename);
boolean P_AddWadFileLocal(const char *wadfilename);
#ifdef DELFILE
boolean P_DelWadFile(void);
#endif
@@ -68,7 +69,7 @@ boolean P_DelWadFile(void);
// WARNING: The following functions should be grouped as follows:
// any amount of PartialAdds followed by MultiSetups until returned true,
// as soon as possible.
UINT16 P_PartialAddWadFile(const char *wadfilename);
UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local);
// Run a single stage of multisetup, or all of them if fullsetup set.
// fullsetup true: run everything
// otherwise
+3 -3
View File
@@ -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, boolean local)
{
FILE *handle;
lumpinfo_t *lumpinfo = NULL;
@@ -729,7 +729,7 @@ UINT16 W_InitFile(const char *filename)
if ((handle = W_OpenWadFile(&filename, true)) == NULL)
return INT16_MAX;
important = !W_VerifyNMUSlumps(filename);
important = !local && !W_VerifyNMUSlumps(filename);
#ifndef NOMD5
//
@@ -898,7 +898,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, false);
if (rc == INT16_MAX)
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), *filenames);
overallrc &= (rc != INT16_MAX) ? 1 : 0;
+4 -1
View File
@@ -129,7 +129,10 @@ 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);
//
// if local is true, it wouldn't check if file adds complex things, therefore
// allowing to still join server without the "you have wrong addons loaded" error
UINT16 W_InitFile(const char *filename, boolean local);
#ifdef DELFILE
void W_UnloadWadFile(UINT16 num);
#endif