This commit is contained in:
alufolie91 committed 2023-12-06 17:25:20 +01:00
1 parent 088f1800ff
commit 37377a42e6
3 files changed
+52 -2

No files matched your search

+18
View File
@@ -47,6 +47,7 @@
#include "k_kart.h"
#include "s_sound.h" // sfx_syfail
#include "m_perfstats.h"
#include "d_main.h"
#ifdef CLIENT_LOADINGSCREEN
// cl loading screen
@@ -1901,6 +1902,23 @@ static void CL_LoadReceivedSavegame(void)
demo.title = false;
automapactive = false;
if (!postautoloaded)
{
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
if (W_InitMultipleFiles(autoloadwadfilespost, true))
{
if (modifiedgame)
{
autoloaded = true;
modifiedgame = false;
}
}
else // snarky remark
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
D_CleanFile(autoloadwadfilespost);
postautoloaded = true;
}
// load a base level
if (P_LoadNetGame())
{
+28 -2
View File
@@ -105,8 +105,10 @@ static char *startuppwads[MAX_WADFILES];
// autoloading
static char *autoloadwadfiles[MAX_WADFILES];
char *autoloadwadfilespost[MAX_WADFILES];
boolean autoloading;
boolean autoloaded;
boolean postautoloaded;
boolean devparm = false; // started game with -devparm
@@ -945,11 +947,26 @@ static void D_AutoloadFile(const char *file, char **filearray)
COM_BufAddText(va("exec %s\n", newfile));
}
static char *strremove(char *str, const char *sub) {
char *p, *q, *r;
if (*sub && (q = r = strstr(str, sub)) != NULL) {
size_t len = strlen(sub);
while ((r = strstr(p = r + len, sub)) != NULL) {
while (p < r)
*q++ = *p++;
}
while ((*q++ = *p++) != '\0')
continue;
}
return str;
}
// FIND THEM
static void D_FindAddonsToAutoload(void)
{
FILE *autoloadconfigfile;
const char *autoloadpath;
boolean postload;
INT32 i;
char wadsToAutoload[256] = "", renameAutoloadStrings[256] = "";
@@ -964,10 +981,16 @@ static void D_FindAddonsToAutoload(void)
while (fgets(wadsToAutoload, sizeof wadsToAutoload, autoloadconfigfile) != NULL)
{
postload = false;
// skip if commented or empty
if ((wadsToAutoload[1] == '\0' || wadsToAutoload[1] == '\n')
|| (wadsToAutoload[0] == '#'))
continue;
// this marks it so that it loads after loading server addons
else if (fastncmp(wadsToAutoload, "postload ", 9)) {
strremove(wadsToAutoload, "postload ");
postload = true;
}
// Remove Any Empty or Skipped Lines
for (i = 0; wadsToAutoload[i] != '\0'; i++)
@@ -977,7 +1000,10 @@ static void D_FindAddonsToAutoload(void)
}
// LOAD IT
D_AutoloadFile(wadsToAutoload, autoloadwadfiles);
if (!postload)
D_AutoloadFile(wadsToAutoload, autoloadwadfiles);
else
D_AutoloadFile(wadsToAutoload, autoloadwadfilespost);
// end it here
for (i = 0; wadsToAutoload[i] != '\0'; i++)
@@ -988,7 +1014,7 @@ static void D_FindAddonsToAutoload(void)
fclose(autoloadconfigfile);
}
static inline void D_CleanFile(char **filearray)
void D_CleanFile(char **filearray)
{
size_t pnumwadfiles;
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
+6
View File
@@ -38,6 +38,10 @@ extern boolean statdp; //kartZ speedo
extern boolean autoloading;
extern boolean autoloaded;
extern boolean postautoloaded;
extern boolean statdp; //kartZ speedo
extern char *autoloadwadfilespost[MAX_WADFILES];
// the infinite loop of D_SRB2Loop() called from win_main for windows version
void D_SRB2Loop(void) FUNCNORETURN;
@@ -54,6 +58,8 @@ void D_PostEvent(const event_t *ev);
void D_ProcessEvents(void);
void D_CleanFile(char **filearray);
const char *D_Home(void);
//