diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3e791f7ab..c03584043 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1913,15 +1913,6 @@ static void CL_LoadReceivedSavegame(void) demo.title = false; automapactive = false; - if (!postautoloaded) - { - CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n"); - if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0) - 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()) { @@ -4308,6 +4299,8 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) if (server && multiplayer && motd[0] != '\0') COM_BufAddText(va("sayto %d %s\n", newplayernum, motd)); + D_AddAutoloadFiles(); + LUAh_PlayerJoin(newplayernum); if (newplayernum == consoleplayer) diff --git a/src/d_main.c b/src/d_main.c index d223f8a5c..f1d05a1c0 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -103,11 +103,12 @@ static char *startupwadfiles[MAX_WADFILES]; static char *startuppwads[MAX_WADFILES]; // autoloading -static char *autoloadwadfiles[MAX_WADFILES]; +char *autoloadwadfiles[MAX_WADFILES]; char *autoloadwadfilespost[MAX_WADFILES]; boolean autoloading; boolean autoloaded; -boolean postautoloaded; +boolean postautoloaded = false; +boolean wasautoloaded = false; boolean devparm = false; // started game with -devparm @@ -1105,6 +1106,32 @@ static void D_FindAddonsToAutoload(void) fclose(autoloadconfigfile); } +void D_AddAutoloadFiles(void) +{ + if (wasautoloaded && postautoloaded) + return; + + if (!wasautoloaded && !modeattacking) + { + CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n"); + if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0) + CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n"); + D_CleanFile(autoloadwadfiles); + + wasautoloaded = true; + } + + if ((!postautoloaded) && netgame) + { + CONS_Printf("D_AutoloadFile(): Loading postloaded addons...\n"); + if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0) + CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n"); + D_CleanFile(autoloadwadfilespost); + + postautoloaded = true; + } +} + void D_CleanFile(char **filearray) { size_t pnumwadfiles; @@ -1791,11 +1818,6 @@ void D_SRB2Main(void) CONS_Printf("ST_Init(): Init status bar.\n"); ST_Init(); - CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n"); - if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0) - CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n"); - D_CleanFile(autoloadwadfiles); - // Set up splitscreen players before joining! if (!dedicated && (M_CheckParm("-splitscreen") && M_IsNextParm())) { diff --git a/src/d_main.h b/src/d_main.h index 23fb31619..d4d3e6e95 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -43,12 +43,15 @@ extern boolean statdp; // stat display for extended player setup extern boolean nametaggfx; // Nametag stuffs extern boolean driftgaugegfx; +void D_AddAutoloadFiles(void); extern boolean autoloading; extern boolean autoloaded; extern boolean postautoloaded; +extern boolean wasautoloaded; extern char *autoloadwadfilespost[MAX_WADFILES]; +extern char *autoloadwadfiles[MAX_WADFILES]; // the infinite loop of D_SRB2Loop() called from win_main for windows version void D_SRB2Loop(void) FUNCNORETURN;