get rid of the global maplumpnum

This commit is contained in:
Fabian Greffrath 2022-02-18 08:25:26 +01:00
parent 494e556f5f
commit c66996d29b
4 changed files with 7 additions and 11 deletions

View File

@ -1895,9 +1895,11 @@ static void G_DoLoadGame(void)
{
const int time = leveltime / TICRATE;
const int ttime = (totalleveltimes + leveltime) / TICRATE;
char *maplump = MAPNAME(gameepisode, gamemap);
int maplumpnum = W_CheckNumForName(maplump);
fprintf(stderr, "G_DoLoadGame: Slot %d, %.8s (%s), Skill %d, Time %02d:%02d:%02d/%02d:%02d:%02d\n",
savegameslot, lumpinfo[maplumpnum].name, W_WadNameForLump(maplumpnum), gameskill,
savegameslot, maplump, W_WadNameForLump(maplumpnum), gameskill,
time/3600, (time%3600)/60, time%60,
ttime/3600, (ttime%3600)/60, ttime%60);
}

View File

@ -52,7 +52,6 @@
#include "d_deh.h"
#include "m_misc.h"
#include "m_misc2.h" // [FG] M_StringDuplicate()
#include "p_setup.h" // [FG] maplumpnum
#include "w_wad.h" // [FG] W_IsIWADLump() / W_WadNameForLump()
#include "p_saveg.h" // saveg_compat
#include "m_input.h"
@ -1056,6 +1055,8 @@ void M_DoSave(int slot)
// [FG] generate a default save slot name when the user saves to an empty slot
static void SetDefaultSaveName (int slot)
{
char *maplump = MAPNAME(gameepisode, gamemap);
int maplumpnum = W_CheckNumForName(maplump);
char *wadname = M_StringDuplicate(W_WadNameForLump(maplumpnum));
char *ext = strrchr(wadname, '.');
@ -1065,7 +1066,7 @@ static void SetDefaultSaveName (int slot)
}
M_snprintf(savegamestrings[slot], SAVESTRINGSIZE,
"%s (%s)", lumpinfo[maplumpnum].name, wadname);
"%s (%s)", maplump, wadname);
(free)(wadname);
M_ForceUppercase(savegamestrings[slot]);

View File

@ -1416,8 +1416,6 @@ static boolean P_LoadReject(int lumpnum, int totallines)
//
// killough 5/3/98: reformatted, cleaned up
// [FG] current map lump number
int maplumpnum = -1;
// fast-forward demo to the next map
boolean demoskip = false;
@ -1546,9 +1544,6 @@ void P_SetupLevel(int episode, int map, int playermask, skill_t skill)
if (precache)
R_PrecacheLevel();
// [FG] current map lump number
maplumpnum = lumpnum;
// [FG] log level setup
{
const int ttime = (totalleveltimes + leveltime) / TICRATE;
@ -1559,7 +1554,7 @@ void P_SetupLevel(int episode, int map, int playermask, skill_t skill)
NULL);
fprintf(stderr, "P_SetupLevel: %.8s (%s), %s%s%s\n Skill %d%s, Total %d:%02d:%02d\n Demo Version %d\n",
lumpinfo[maplumpnum].name, W_WadNameForLump(maplumpnum),
lumpname, W_WadNameForLump(lumpnum),
mapformat == MFMT_ZDBSPX ? "ZDBSP nodes" :
mapformat == MFMT_ZDBSPZ ? "compressed ZDBSP nodes" :
mapformat == MFMT_DEEPBSP ? "DeepBSP nodes" :

View File

@ -45,8 +45,6 @@ extern int bmapheight; // in mapblocks
extern fixed_t bmaporgx;
extern fixed_t bmaporgy; // origin of block map
extern mobj_t **blocklinks; // for thing chains
// [FG] current map lump number
extern int maplumpnum;
extern boolean skipblstart; // MaxW: Skip initial blocklist short