Merge src/w_wad.c/h

This commit is contained in:
SteelT 2020-08-06 18:52:39 -04:00
parent 30fd6f5db5
commit 6106589507
2 changed files with 10 additions and 47 deletions

View file

@ -207,10 +207,6 @@ static inline void W_LoadDehackedLumpsPK3(UINT16 wadnum, boolean mainfile)
for (; posStart < posEnd; posStart++) for (; posStart < posEnd; posStart++)
LUA_LoadLump(wadnum, posStart); LUA_LoadLump(wadnum, posStart);
} }
<<<<<<< HEAD
#endif
=======
>>>>>>> srb2/next
posStart = W_CheckNumForFolderStartPK3("SOC/", wadnum, 0); posStart = W_CheckNumForFolderStartPK3("SOC/", wadnum, 0);
if (posStart != INT16_MAX) if (posStart != INT16_MAX)
@ -714,11 +710,8 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup)
UINT16 numlumps = 0; UINT16 numlumps = 0;
#ifndef NOMD5 #ifndef NOMD5
size_t i; size_t i;
<<<<<<< HEAD
=======
#endif #endif
size_t packetsize; size_t packetsize;
>>>>>>> srb2/next
UINT8 md5sum[16]; UINT8 md5sum[16];
boolean important; boolean important;
@ -749,29 +742,8 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup)
// open wad file // open wad file
if ((handle = W_OpenWadFile(&filename, true)) == NULL) if ((handle = W_OpenWadFile(&filename, true)) == NULL)
return W_InitFileError(filename, startup); return W_InitFileError(filename, startup);
<<<<<<< HEAD
important = !W_VerifyNMUSlumps(filename); important = !W_VerifyNMUSlumps(filename);
=======
// Check if wad files will overflow fileneededbuffer. Only the filename part
// is send in the packet; cf.
// see PutFileNeeded in d_netfil.c
if ((important = !W_VerifyNMUSlumps(filename)))
{
packetsize = packetsizetally + nameonlylength(filename) + 22;
if (packetsize > MAXFILENEEDED*sizeof(UINT8))
{
CONS_Alert(CONS_ERROR, M_GetText("Maximum wad files reached\n"));
refreshdirmenu |= REFRESHDIR_MAX;
if (handle)
fclose(handle);
return W_InitFileError(filename, startup);
}
packetsizetally = packetsize;
}
>>>>>>> srb2/next
#ifndef NOMD5 #ifndef NOMD5
// //
@ -894,16 +866,12 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup)
* *
* \param filenames A null-terminated list of files to use. * \param filenames A null-terminated list of files to use.
*/ */
<<<<<<< HEAD
INT32 W_InitMultipleFiles(char **filenames, boolean addons) INT32 W_InitMultipleFiles(char **filenames, boolean addons)
{ {
INT32 rc = 1; INT32 rc = 1;
=======
void W_InitMultipleFiles(char **filenames, UINT16 mainfiles)
{
// open all the files, load headers, and count lumps // open all the files, load headers, and count lumps
numwadfiles = 0; numwadfiles = 0;
>>>>>>> srb2/next
// will be realloced as lumps are added // will be realloced as lumps are added
for (; *filenames; filenames++) for (; *filenames; filenames++)
@ -912,8 +880,13 @@ void W_InitMultipleFiles(char **filenames, UINT16 mainfiles)
G_SetGameModified(true, false); G_SetGameModified(true, false);
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames); //CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
W_InitFile(*filenames, numwadfiles < mainfiles, true); rc &= (W_InitFile(*filenames, numwadfiles < mainfiles, true) != INT16_MAX) ? 1 : 0;
} }
if (!numwadfiles)
I_Error("W_InitMultipleFiles: no files found");
return rc;
} }
/** Make sure a lump number is valid. /** Make sure a lump number is valid.
@ -1818,8 +1791,6 @@ void *W_CachePatchName(const char *name, INT32 tag)
return W_CachePatchNum(num, tag); return W_CachePatchNum(num, tag);
} }
<<<<<<< HEAD
=======
void *W_CachePatchLongName(const char *name, INT32 tag) void *W_CachePatchLongName(const char *name, INT32 tag)
{ {
lumpnum_t num; lumpnum_t num;
@ -1830,7 +1801,7 @@ void *W_CachePatchLongName(const char *name, INT32 tag)
return W_CachePatchNum(W_GetNumForLongName("MISSING"), tag); return W_CachePatchNum(W_GetNumForLongName("MISSING"), tag);
return W_CachePatchNum(num, tag); return W_CachePatchNum(num, tag);
} }
>>>>>>> srb2/next
#ifndef NOMD5 #ifndef NOMD5
/** /**
@ -2120,13 +2091,9 @@ int W_VerifyNMUSlumps(const char *filename)
{"STT", 3}, // Acceptable HUD changes (Score Time Rings) {"STT", 3}, // Acceptable HUD changes (Score Time Rings)
{"YB_", 3}, // Intermission graphics, goes with the above {"YB_", 3}, // Intermission graphics, goes with the above
{"M_", 2}, // As does menu stuff {"M_", 2}, // As does menu stuff
<<<<<<< HEAD
{"MKFNT", 5}, // Kart font changes {"MKFNT", 5}, // Kart font changes
{"K_", 2}, // Kart graphic changes {"K_", 2}, // Kart graphic changes
{"MUSICDEF", 8}, // Kart song definitions {"MUSICDEF", 8}, // Kart song definitions
=======
{"MUSICDEF", 8}, // Song definitions (thanks kart)
>>>>>>> srb2/next
#ifdef HWRENDER #ifdef HWRENDER
{"SHADERS", 7}, {"SHADERS", 7},

View file

@ -150,14 +150,10 @@ 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 // 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); UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup);
<<<<<<< HEAD
// W_InitMultipleFiles returns 1 if all is okay, 0 otherwise, // W_InitMultipleFiles returns 1 if all is okay, 0 otherwise,
// so that it stops with a message if a file was not found, but not if all is okay. // so that it stops with a message if a file was not found, but not if all is okay.
INT32 W_InitMultipleFiles(char **filenames, boolean addons);
=======
// W_InitMultipleFiles exits if a file was not found, but not if all is okay. // W_InitMultipleFiles exits if a file was not found, but not if all is okay.
void W_InitMultipleFiles(char **filenames, UINT16 mainfiles); INT32 W_InitMultipleFiles(char **filenames, UINT16 mainfiles);
>>>>>>> srb2/next
const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump); const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump);
const char *W_CheckNameForNum(lumpnum_t lumpnum); const char *W_CheckNameForNum(lumpnum_t lumpnum);