Don't count main WADs in packetsizetally

This commit is contained in:
James R 2019-04-22 21:11:27 -07:00
parent 6f6bb07687
commit f3513e7edb
7 changed files with 7 additions and 11 deletions

View file

@ -74,7 +74,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...);
#include "m_cond.h" // condition initialization #include "m_cond.h" // condition initialization
#include "fastcmp.h" #include "fastcmp.h"
#include "keys.h" #include "keys.h"
#include "filesrch.h" // refreshdirmenu, mainwadstally #include "filesrch.h" // refreshdirmenu
#ifdef CMAKECONFIG #ifdef CMAKECONFIG
#include "config.h" #include "config.h"
@ -1257,8 +1257,6 @@ void D_SRB2Main(void)
#endif //ifndef DEVELOP #endif //ifndef DEVELOP
mainwadstally = packetsizetally;
// //
// search for maps // search for maps
// //

View file

@ -342,7 +342,6 @@ UINT8 refreshdirmenu = 0;
char *refreshdirname = NULL; char *refreshdirname = NULL;
size_t packetsizetally = 0; size_t packetsizetally = 0;
size_t mainwadstally = 0;
#if defined (_XBOX) && defined (_MSC_VER) #if defined (_XBOX) && defined (_MSC_VER)
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum,

View file

@ -43,7 +43,6 @@ extern UINT8 refreshdirmenu;
extern char *refreshdirname; extern char *refreshdirname;
extern size_t packetsizetally; extern size_t packetsizetally;
extern size_t mainwadstally;
typedef enum typedef enum
{ {

View file

@ -4665,7 +4665,7 @@ static void M_DrawAddons(void)
else else
{ {
x = FixedDiv(((ssize_t)(numwadfiles) - (ssize_t)(mainwads+1))<<FRACBITS, ((ssize_t)MAX_WADFILES - (ssize_t)(mainwads+1))<<FRACBITS); x = FixedDiv(((ssize_t)(numwadfiles) - (ssize_t)(mainwads+1))<<FRACBITS, ((ssize_t)MAX_WADFILES - (ssize_t)(mainwads+1))<<FRACBITS);
y = FixedDiv((((ssize_t)packetsizetally-(ssize_t)mainwadstally)<<FRACBITS), ((((ssize_t)MAXFILENEEDED*sizeof(UINT8)-(ssize_t)mainwadstally)-(5+22))<<FRACBITS)); // 5+22 = (a.ext + checksum length) is minimum addition to packet size tally y = FixedDiv((((ssize_t)packetsizetally)<<FRACBITS), ((((ssize_t)MAXFILENEEDED*sizeof(UINT8))-(5+22))<<FRACBITS)); // 5+22 = (a.ext + checksum length) is minimum addition to packet size tally
if (x > y) if (x > y)
y = x; y = x;
if (y > FRACUNIT) // happens because of how we're shrinkin' it a little if (y > FRACUNIT) // happens because of how we're shrinkin' it a little

View file

@ -3353,7 +3353,7 @@ boolean P_AddWadFile(const char *wadfilename)
boolean mapsadded = false; boolean mapsadded = false;
boolean replacedcurrentmap = false; boolean replacedcurrentmap = false;
if ((numlumps = W_InitFile(wadfilename)) == INT16_MAX) if ((numlumps = W_InitFile(wadfilename, true)) == INT16_MAX)
{ {
refreshdirmenu |= REFRESHDIR_NOTLOADED; refreshdirmenu |= REFRESHDIR_NOTLOADED;
CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename); CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename);

View file

@ -644,7 +644,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
// //
// Can now load dehacked files (.soc) // Can now load dehacked files (.soc)
// //
UINT16 W_InitFile(const char *filename) UINT16 W_InitFile(const char *filename, boolean addon)
{ {
FILE *handle; FILE *handle;
lumpinfo_t *lumpinfo = NULL; lumpinfo_t *lumpinfo = NULL;
@ -687,7 +687,7 @@ UINT16 W_InitFile(const char *filename)
// Check if wad files will overflow fileneededbuffer. Only the filename part // Check if wad files will overflow fileneededbuffer. Only the filename part
// is send in the packet; cf. // is send in the packet; cf.
// see PutFileNeeded in d_netfil.c // see PutFileNeeded in d_netfil.c
if ((important = !W_VerifyNMUSlumps(filename))) if ((important = !W_VerifyNMUSlumps(filename)) && addon)
{ {
packetsize = packetsizetally + nameonlylength(filename) + 22; packetsize = packetsizetally + nameonlylength(filename) + 22;
@ -866,7 +866,7 @@ INT32 W_InitMultipleFiles(char **filenames, boolean addons)
G_SetGameModified(true, false); G_SetGameModified(true, false);
//CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames); //CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames);
rc &= (W_InitFile(*filenames) != INT16_MAX) ? 1 : 0; rc &= (W_InitFile(*filenames, addons) != INT16_MAX) ? 1 : 0;
} }
if (!numwadfiles) if (!numwadfiles)

View file

@ -126,7 +126,7 @@ 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 // 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); 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); UINT16 W_InitFile(const char *filename, boolean addon);
#ifdef DELFILE #ifdef DELFILE
void W_UnloadWadFile(UINT16 num); void W_UnloadWadFile(UINT16 num);
#endif #endif