mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 07:22:28 +00:00
Add wads from the -file parameter after netvars are registered
This is so netvars registered by any lua scripts will load in the correct order.
This commit is contained in:
parent
a9a0137d22
commit
1cfb1f673b
3 changed files with 23 additions and 21 deletions
35
src/d_main.c
35
src/d_main.c
|
@ -99,6 +99,7 @@ UINT8 window_notinfocus = false;
|
||||||
// DEMO LOOP
|
// DEMO LOOP
|
||||||
//
|
//
|
||||||
static char *startupwadfiles[MAX_WADFILES];
|
static char *startupwadfiles[MAX_WADFILES];
|
||||||
|
static char *startuppwads[MAX_WADFILES];
|
||||||
|
|
||||||
boolean devparm = false; // started game with -devparm
|
boolean devparm = false; // started game with -devparm
|
||||||
|
|
||||||
|
@ -977,12 +978,12 @@ void D_StartTitle(void)
|
||||||
//
|
//
|
||||||
// D_AddFile
|
// D_AddFile
|
||||||
//
|
//
|
||||||
static void D_AddFile(const char *file)
|
static void D_AddFile(char **list, const char *file)
|
||||||
{
|
{
|
||||||
size_t pnumwadfiles;
|
size_t pnumwadfiles;
|
||||||
char *newfile;
|
char *newfile;
|
||||||
|
|
||||||
for (pnumwadfiles = 0; startupwadfiles[pnumwadfiles]; pnumwadfiles++)
|
for (pnumwadfiles = 0; list[pnumwadfiles]; pnumwadfiles++)
|
||||||
;
|
;
|
||||||
|
|
||||||
newfile = malloc(strlen(file) + 1);
|
newfile = malloc(strlen(file) + 1);
|
||||||
|
@ -992,16 +993,16 @@ static void D_AddFile(const char *file)
|
||||||
}
|
}
|
||||||
strcpy(newfile, file);
|
strcpy(newfile, file);
|
||||||
|
|
||||||
startupwadfiles[pnumwadfiles] = newfile;
|
list[pnumwadfiles] = newfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void D_CleanFile(void)
|
static inline void D_CleanFile(char **list)
|
||||||
{
|
{
|
||||||
size_t pnumwadfiles;
|
size_t pnumwadfiles;
|
||||||
for (pnumwadfiles = 0; startupwadfiles[pnumwadfiles]; pnumwadfiles++)
|
for (pnumwadfiles = 0; list[pnumwadfiles]; pnumwadfiles++)
|
||||||
{
|
{
|
||||||
free(startupwadfiles[pnumwadfiles]);
|
free(list[pnumwadfiles]);
|
||||||
startupwadfiles[pnumwadfiles] = NULL;
|
list[pnumwadfiles] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1086,7 +1087,7 @@ static void IdentifyVersion(void)
|
||||||
|
|
||||||
// Load the IWAD
|
// Load the IWAD
|
||||||
if (srb2wad != NULL && FIL_ReadFileOK(srb2wad))
|
if (srb2wad != NULL && FIL_ReadFileOK(srb2wad))
|
||||||
D_AddFile(srb2wad);
|
D_AddFile(startupwadfiles, srb2wad);
|
||||||
else
|
else
|
||||||
I_Error("srb2.pk3 not found! Expected in %s, ss file: %s\n", srb2waddir, srb2wad);
|
I_Error("srb2.pk3 not found! Expected in %s, ss file: %s\n", srb2waddir, srb2wad);
|
||||||
|
|
||||||
|
@ -1097,14 +1098,14 @@ static void IdentifyVersion(void)
|
||||||
// checking in D_SRB2Main
|
// checking in D_SRB2Main
|
||||||
|
|
||||||
// Add the maps
|
// Add the maps
|
||||||
D_AddFile(va(pandf,srb2waddir,"zones.pk3"));
|
D_AddFile(startupwadfiles, va(pandf,srb2waddir,"zones.pk3"));
|
||||||
|
|
||||||
// Add the players
|
// Add the players
|
||||||
D_AddFile(va(pandf,srb2waddir, "player.dta"));
|
D_AddFile(startupwadfiles, va(pandf,srb2waddir, "player.dta"));
|
||||||
|
|
||||||
#ifdef USE_PATCH_DTA
|
#ifdef USE_PATCH_DTA
|
||||||
// Add our crappy patches to fix our bugs
|
// Add our crappy patches to fix our bugs
|
||||||
D_AddFile(va(pandf,srb2waddir,"patch.pk3"));
|
D_AddFile(startupwadfiles, va(pandf,srb2waddir,"patch.pk3"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
|
#if !defined (HAVE_SDL) || defined (HAVE_MIXER)
|
||||||
|
@ -1114,7 +1115,7 @@ static void IdentifyVersion(void)
|
||||||
const char *musicpath = va(pandf,srb2waddir,str);\
|
const char *musicpath = va(pandf,srb2waddir,str);\
|
||||||
int ms = W_VerifyNMUSlumps(musicpath); \
|
int ms = W_VerifyNMUSlumps(musicpath); \
|
||||||
if (ms == 1) \
|
if (ms == 1) \
|
||||||
D_AddFile(musicpath); \
|
D_AddFile(startupwadfiles, musicpath); \
|
||||||
else if (ms == 0) \
|
else if (ms == 0) \
|
||||||
I_Error("File "str" has been modified with non-music/sound lumps"); \
|
I_Error("File "str" has been modified with non-music/sound lumps"); \
|
||||||
}
|
}
|
||||||
|
@ -1304,7 +1305,7 @@ void D_SRB2Main(void)
|
||||||
{
|
{
|
||||||
if (!W_VerifyNMUSlumps(s))
|
if (!W_VerifyNMUSlumps(s))
|
||||||
G_SetGameModified(true);
|
G_SetGameModified(true);
|
||||||
D_AddFile(s);
|
D_AddFile(startuppwads, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1345,8 +1346,8 @@ void D_SRB2Main(void)
|
||||||
|
|
||||||
// load wad, including the main wad file
|
// load wad, including the main wad file
|
||||||
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
|
CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n");
|
||||||
W_InitMultipleFiles(startupwadfiles, mainwads);
|
W_InitMultipleFiles(startupwadfiles);
|
||||||
D_CleanFile();
|
D_CleanFile(startupwadfiles);
|
||||||
|
|
||||||
#ifndef DEVELOP // md5s last updated 22/02/20 (ddmmyy)
|
#ifndef DEVELOP // md5s last updated 22/02/20 (ddmmyy)
|
||||||
|
|
||||||
|
@ -1395,6 +1396,10 @@ void D_SRB2Main(void)
|
||||||
|
|
||||||
I_RegisterSysCommands();
|
I_RegisterSysCommands();
|
||||||
|
|
||||||
|
CONS_Printf("W_InitMultipleFiles(): Adding extra PWADs.\n");
|
||||||
|
W_InitMultipleFiles(startuppwads);
|
||||||
|
D_CleanFile(startuppwads);
|
||||||
|
|
||||||
//--------------------------------------------------------- CONFIG.CFG
|
//--------------------------------------------------------- CONFIG.CFG
|
||||||
M_FirstLoadConfig(); // WARNING : this do a "COM_BufExecute()"
|
M_FirstLoadConfig(); // WARNING : this do a "COM_BufExecute()"
|
||||||
|
|
||||||
|
|
|
@ -887,16 +887,13 @@ 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.
|
||||||
*/
|
*/
|
||||||
void W_InitMultipleFiles(char **filenames, UINT16 mainfiles)
|
void W_InitMultipleFiles(char **filenames)
|
||||||
{
|
{
|
||||||
// open all the files, load headers, and count lumps
|
|
||||||
numwadfiles = 0;
|
|
||||||
|
|
||||||
// will be realloced as lumps are added
|
// will be realloced as lumps are added
|
||||||
for (; *filenames; filenames++)
|
for (; *filenames; filenames++)
|
||||||
{
|
{
|
||||||
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
|
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
|
||||||
W_InitFile(*filenames, numwadfiles < mainfiles, true);
|
W_InitFile(*filenames, numwadfiles < mainwads, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors);
|
||||||
UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup);
|
UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup);
|
||||||
|
|
||||||
// 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);
|
void W_InitMultipleFiles(char **filenames);
|
||||||
|
|
||||||
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);
|
||||||
|
|
Loading…
Reference in a new issue