Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
viciious committed Oct 19, 2023
1 parent 98024f1 commit fd5263b
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 28 deletions.
6 changes: 3 additions & 3 deletions d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ void START_Title(void)

if (*l) {
W_Push();
W_ReadPWAD();
W_LoadPWAD();

int lump = W_CheckNumForName(l);
if (lump >= 0)
Expand Down Expand Up @@ -624,7 +624,7 @@ static void START_Credits (void)
return;

W_Push();
W_ReadPWAD();
W_LoadPWAD();

/* build a temp in-memory PWAD */
for (i = 0; i < 2; i++)
Expand Down Expand Up @@ -868,7 +868,7 @@ static void RunAttractDemos (void)

W_Push();

W_ReadPWAD();
W_LoadPWAD();

demo = NULL;
D_snprintf(demoname, sizeof(demoname), "DEMO%1d", i+1);
Expand Down
3 changes: 1 addition & 2 deletions doomdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,7 @@ void W_Init (void);

int W_Push (void);
int W_Pop (void);
void W_OpenPWAD (wadinfo_t *wad, void *ptr);
void W_ReadPWAD(void);
void W_LoadPWAD(void);
void W_SetPWAD (wadinfo_t *wad, void *lumpinfo);
lumpinfo_t *W_GetLumpInfo (void);
int W_GetLumpInfoSubset(lumpinfo_t *out, const lumpinfo_t *in, int numlumps, int *lumps);
Expand Down
2 changes: 1 addition & 1 deletion g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ void G_Init(void)
// copy mapnumbers to a temp buffer, then free, then allocate again
// to avoid zone memory fragmentation
W_Push();
W_ReadPWAD();
W_LoadPWAD();

maplist = G_LoadMaplist(&mapcount, &gameinfo);
if (mapcount > 99)
Expand Down
2 changes: 1 addition & 1 deletion in_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ void IN_Start (void)
Z_FreeTags (mainzone);

W_Push();
W_ReadPWAD();
W_LoadPWAD();

/* build a temp in-memory PWAD */
lumps[0] = W_CheckNumForName("INTERPIC");
Expand Down
2 changes: 1 addition & 1 deletion m_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void M_Start2 (boolean startup_)
if (startup)
{
W_Push();
W_ReadPWAD();
W_LoadPWAD();

i = W_CheckNumForName("M_DOOM");
m_doom = i != -1 ? W_CacheLumpNum(i, PU_STATIC) : NULL;
Expand Down
2 changes: 1 addition & 1 deletion marssound.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void S_Init(void)
S_StopSong();

W_Push();
W_ReadPWAD();
W_LoadPWAD();

/* build an in-memory PWAD with all music */
start = W_CheckNumForName("M_START");
Expand Down
3 changes: 1 addition & 2 deletions p_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,8 +655,7 @@ D_printf ("P_SetupLevel(%s,%i)\n",lumpname,skill);
P_InitThinkers ();

W_Push();

W_ReadPWAD();
W_LoadPWAD();

lumpnum = W_GetNumForName(lumpname);
if (lumpnum < 0)
Expand Down
24 changes: 7 additions & 17 deletions w_wad.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/* GLOBALS */
/*============= */

#define MAXWADS 3 /* IWAD + CD PWAD + virtual CD PWAD */
#define MAXWADS 2 /* IWAD + CD PWAD + virtual CD PWAD */

typedef struct
{
Expand Down Expand Up @@ -107,6 +107,8 @@ static void W_InitCDPWAD (void)
I_Error ("Wad file doesn't have PWAD id\n");
wad->numlumps = LITTLELONG(((wadinfo_t*)ptr)->numlumps);
wad->infotableofs = LITTLELONG(((wadinfo_t*)ptr)->infotableofs);

W_LoadPWAD();
}

/*
Expand Down Expand Up @@ -159,27 +161,26 @@ void W_SetPWAD (wadinfo_t *wadi, void *lumpinfo)
/*
====================
=
= W_ReadPWAD
= W_LoadPWAD
=
====================
*/
void W_ReadPWAD (void)
void W_LoadPWAD (void)
{
int i, l;
wadfile_t *wad = &wadfile[1];
lumpinfo_t *li;
static int cache_size = -1;
static int cache_num_lumps = 0;

I_OpenCDFileByOffset(wad->cdlength, wad->cdoffset);

if (cache_size != -1) {
I_OpenCDFileByOffset(wad->cdlength, wad->cdoffset);
wad->numlumps = cache_num_lumps;
wad->lumpinfo = I_GetCDFileCache(cache_size);
return;
}

I_OpenCDFileByOffset(wad->cdlength, wad->cdoffset);

I_SeekCDFile(wad->infotableofs, SEEK_SET);

l = wad->numlumps*sizeof(lumpinfo_t);
Expand Down Expand Up @@ -210,12 +211,6 @@ int W_Push (void)
{
if (wadnum >= MAXWADS-1)
return -1;

if (wadnum == 1) {
wadfile_t *wad = &wadfile[1];
I_OpenCDFileByOffset(wad->cdlength, wad->cdoffset);
}

wadnum++;
return 0;
}
Expand All @@ -231,11 +226,6 @@ int W_Pop (void)
{
if (wadnum == 0)
return -1;

if (wadnum == 1) {

}

--wadnum;
return 0;
}
Expand Down

0 comments on commit fd5263b

Please sign in to comment.