- removed currentBoardFilename

This was only used for displaying the name for user maps, everything else was using other means of getting the data already, and even here currentLevel is better suited.
This commit is contained in:
Christoph Oelckers 2019-12-11 01:01:03 +01:00
parent 5c0cd5114d
commit 69fd6cf69d
11 changed files with 9 additions and 54 deletions

View file

@ -79,8 +79,6 @@ int32_t g_quitDeadline = 0;
int32_t g_cameraDistance = 0, g_cameraClock = 0; int32_t g_cameraDistance = 0, g_cameraClock = 0;
static int32_t g_quickExit; static int32_t g_quickExit;
char boardfilename[BMAX_PATH] = {0}, currentboardfilename[BMAX_PATH] = {0};
int32_t voting = -1; int32_t voting = -1;
int32_t vote_map = -1, vote_episode = -1; int32_t vote_map = -1, vote_episode = -1;

View file

@ -199,7 +199,7 @@ extern user_defs ud;
// this is checked against http://eduke32.com/VERSION // this is checked against http://eduke32.com/VERSION
extern const char *s_buildDate; extern const char *s_buildDate;
extern char boardfilename[BMAX_PATH], currentboardfilename[BMAX_PATH]; extern char boardfilename[BMAX_PATH];
#define USERMAPMUSICFAKEVOLUME MAXVOLUMES #define USERMAPMUSICFAKEVOLUME MAXVOLUMES
#define USERMAPMUSICFAKELEVEL (MAXLEVELS-1) #define USERMAPMUSICFAKELEVEL (MAXLEVELS-1)
#define USERMAPMUSICFAKESLOT ((USERMAPMUSICFAKEVOLUME * MAXLEVELS) + USERMAPMUSICFAKELEVEL) #define USERMAPMUSICFAKESLOT ((USERMAPMUSICFAKEVOLUME * MAXLEVELS) + USERMAPMUSICFAKELEVEL)

View file

@ -5613,7 +5613,6 @@ int portableBackupSave(const char * path, const char * name, int volume, int lev
sjson_node * root = sjson_mkobject(ctx); sjson_node * root = sjson_mkobject(ctx);
sjson_put_string(ctx, root, "name", name); sjson_put_string(ctx, root, "name", name);
// sjson_put_string(ctx, root, "map", currentboardfilename);
sjson_put_int(ctx, root, "volume", volume); sjson_put_int(ctx, root, "volume", volume);
sjson_put_int(ctx, root, "level", level); sjson_put_int(ctx, root, "level", level);
sjson_put_int(ctx, root, "skill", ud.player_skill); sjson_put_int(ctx, root, "skill", ud.player_skill);

View file

@ -1940,8 +1940,6 @@ int G_EnterLevel(int gameMode)
G_ResetTimers(0); // Here we go G_ResetTimers(0); // Here we go
Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH);
G_CheckIfStateless(); G_CheckIfStateless();
for (int TRAVERSE_CONNECT(i)) for (int TRAVERSE_CONNECT(i))

View file

@ -302,9 +302,6 @@ int32_t G_LoadPlayer(FSaveGameNode *sv)
append_ext_UNSAFE(workbuffer, ".mhk"); append_ext_UNSAFE(workbuffer, ".mhk");
engineLoadMHK(workbuffer); engineLoadMHK(workbuffer);
} }
currentboardfilename[0] = '\0';
// G_NewGame_EnterLevel(); // G_NewGame_EnterLevel();
} }
@ -503,8 +500,6 @@ int32_t G_LoadPlayer(FSaveGameNode *sv)
engineLoadMHK(workbuffer); engineLoadMHK(workbuffer);
} }
Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH);
if (status == 2) if (status == 2)
G_NewGame_EnterLevel(); G_NewGame_EnterLevel();
else if ((status = sv_loadsnapshot(*fil, 0, &h))) // read the rest... else if ((status = sv_loadsnapshot(*fil, 0, &h))) // read the rest...
@ -1166,8 +1161,6 @@ static const dataspec_t svgm_udnetw[] =
{ DS_NOCHK, &ud.noexits, sizeof(ud.noexits), 1 }, { DS_NOCHK, &ud.noexits, sizeof(ud.noexits), 1 },
{ DS_NOCHK, &ud.playerai, sizeof(ud.playerai), 1 }, { DS_NOCHK, &ud.playerai, sizeof(ud.playerai), 1 },
{ 0, &ud.pause_on, sizeof(ud.pause_on), 1 }, { 0, &ud.pause_on, sizeof(ud.pause_on), 1 },
{ DS_NOCHK, &currentboardfilename[0], BMAX_PATH, 1 },
// { DS_LOADFN, (void *)&sv_postudload, 0, 1 },
{ 0, connectpoint2, sizeof(connectpoint2), 1 }, { 0, connectpoint2, sizeof(connectpoint2), 1 },
{ 0, &randomseed, sizeof(randomseed), 1 }, { 0, &randomseed, sizeof(randomseed), 1 },
{ 0, &g_globalRandom, sizeof(g_globalRandom), 1 }, { 0, &g_globalRandom, sizeof(g_globalRandom), 1 },
@ -1428,10 +1421,6 @@ int32_t sv_saveandmakesnapshot(FileWriter &fil, char const *name, int8_t spot, i
h.levnum = ud.level_number; h.levnum = ud.level_number;
h.skill = ud.player_skill; h.skill = ud.player_skill;
const uint32_t BSZ = sizeof(h.boardfn);
EDUKE32_STATIC_ASSERT(BSZ == sizeof(currentboardfilename));
Bstrncpy(h.boardfn, currentboardfilename, BSZ);
if (spot >= 0) if (spot >= 0)
{ {
// savegame // savegame
@ -1686,7 +1675,6 @@ int32_t sv_readdiff(FileReader &fil)
// SVGM data description // SVGM data description
static void sv_postudload() static void sv_postudload()
{ {
// Bmemcpy(&boardfilename[0], &currentboardfilename[0], BMAX_PATH); // DON'T do this in demos!
#if 1 #if 1
m_level_number = ud.level_number; m_level_number = ud.level_number;
ud.m_volume_number = ud.volume_number; ud.m_volume_number = ud.volume_number;

View file

@ -994,16 +994,7 @@ void G_DisplayRest(int32_t smoothratio)
else if (g_levelTextTime < 5) else if (g_levelTextTime < 5)
o |= 1; o |= 1;
auto dname = mapList[(ud.volume_number * MAXLEVELS) + ud.level_number].DisplayName(); menutext_(160<<16, (90+16+8)<<16, -g_levelTextTime+22/*quotepulseshade*/, currentLevel->DisplayName(), o, TEXT_XCENTER);
if (dname != NULL && *dname != 0)
{
char const * const fn = currentboardfilename[0] != 0 &&
ud.volume_number == 0 && ud.level_number == 7
? currentboardfilename
: dname;
menutext_(160<<16, (90+16+8)<<16, -g_levelTextTime+22/*quotepulseshade*/, fn, o, TEXT_XCENTER);
}
} }
if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && cl_crosshair && ud.camerasprite == -1) if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && cl_crosshair && ud.camerasprite == -1)

View file

@ -79,7 +79,7 @@ int32_t g_quitDeadline = 0;
int32_t g_cameraDistance = 0, g_cameraClock = 0; int32_t g_cameraDistance = 0, g_cameraClock = 0;
static int32_t g_quickExit; static int32_t g_quickExit;
char boardfilename[BMAX_PATH] = {0}, currentboardfilename[BMAX_PATH] = {0}; char boardfilename[BMAX_PATH] = {0};
int32_t voting = -1; int32_t voting = -1;
int32_t vote_map = -1, vote_episode = -1; int32_t vote_map = -1, vote_episode = -1;

View file

@ -198,7 +198,7 @@ extern user_defs ud;
// this is checked against http://eduke32.com/VERSION // this is checked against http://eduke32.com/VERSION
extern const char *s_buildDate; extern const char *s_buildDate;
extern char boardfilename[BMAX_PATH], currentboardfilename[BMAX_PATH]; extern char boardfilename[BMAX_PATH];
static inline int G_HaveUserMap(void) static inline int G_HaveUserMap(void)
{ {

View file

@ -2502,7 +2502,6 @@ int G_EnterLevel(int gameMode)
//AddLog(g_szBuf); //AddLog(g_szBuf);
// variables are set by pointer... // variables are set by pointer...
Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH);
if (G_HaveUserMap()) if (G_HaveUserMap())
{ {

View file

@ -258,8 +258,6 @@ int32_t G_LoadPlayer(const char *path)
engineLoadMHK(workbuffer); engineLoadMHK(workbuffer);
} }
Bmemcpy(currentboardfilename, boardfilename, BMAX_PATH);
if (status == 2) if (status == 2)
G_NewGame_EnterLevel(); G_NewGame_EnterLevel();
else if ((status = sv_loadsnapshot(*fil, 0, &h))) // read the rest... else if ((status = sv_loadsnapshot(*fil, 0, &h))) // read the rest...
@ -883,8 +881,6 @@ static const dataspec_t svgm_udnetw[] =
{ DS_NOCHK, &ud.noexits, sizeof(ud.noexits), 1 }, { DS_NOCHK, &ud.noexits, sizeof(ud.noexits), 1 },
{ DS_NOCHK, &ud.playerai, sizeof(ud.playerai), 1 }, { DS_NOCHK, &ud.playerai, sizeof(ud.playerai), 1 },
{ 0, &ud.pause_on, sizeof(ud.pause_on), 1 }, { 0, &ud.pause_on, sizeof(ud.pause_on), 1 },
{ DS_NOCHK, &currentboardfilename[0], BMAX_PATH, 1 },
// { DS_LOADFN, (void *)&sv_postudload, 0, 1 },
{ 0, connectpoint2, sizeof(connectpoint2), 1 }, { 0, connectpoint2, sizeof(connectpoint2), 1 },
{ 0, &randomseed, sizeof(randomseed), 1 }, { 0, &randomseed, sizeof(randomseed), 1 },
{ 0, &g_globalRandom, sizeof(g_globalRandom), 1 }, { 0, &g_globalRandom, sizeof(g_globalRandom), 1 },
@ -1130,10 +1126,6 @@ int32_t sv_saveandmakesnapshot(FileWriter &fil, char const *name, int8_t spot, i
h.levnum = ud.level_number; h.levnum = ud.level_number;
h.skill = ud.player_skill; h.skill = ud.player_skill;
const uint32_t BSZ = sizeof(h.boardfn);
EDUKE32_STATIC_ASSERT(BSZ == sizeof(currentboardfilename));
Bstrncpy(h.boardfn, currentboardfilename, BSZ);
if (spot >= 0) if (spot >= 0)
{ {
// savegame // savegame
@ -1382,7 +1374,6 @@ int32_t sv_readdiff(FileReader &fil)
// SVGM data description // SVGM data description
static void sv_postudload() static void sv_postudload()
{ {
// Bmemcpy(&boardfilename[0], &currentboardfilename[0], BMAX_PATH); // DON'T do this in demos!
#if 1 #if 1
m_level_number = ud.level_number; m_level_number = ud.level_number;
ud.m_volume_number = ud.volume_number; ud.m_volume_number = ud.volume_number;

View file

@ -989,14 +989,9 @@ void G_DisplayRest(int32_t smoothratio)
if (ud.overhead_on == 2) if (ud.overhead_on == 2)
{ {
const int32_t a = RR ? 0 : ((ud.screen_size > 0) ? 147 : 179); const int32_t a = RR ? 0 : ((ud.screen_size > 0) ? 147 : 179);
if (RR && g_lastLevel) if (!G_HaveUserMap())
minitext(5, a+6, "CLOSE ENCOUNTERS", 0, 2+8+16+256); minitext(5, a+6, GStrings.localize(gVolumeNames[ud.volume_number]), 0, 2+8+16+256);
else minitext(5, a+6+6, currentLevel->DisplayName(), 0, 2+8+16+256);
{
if (!G_HaveUserMap())
minitext(5, a+6, GStrings.localize(gVolumeNames[ud.volume_number]), 0, 2+8+16+256);
minitext(5, a+6+6, mapList[ud.volume_number*MAXLEVELS + ud.level_number].DisplayName(), 0, 2+8+16+256);
}
} }
} }
} }
@ -1025,11 +1020,7 @@ void G_DisplayRest(int32_t smoothratio)
else if (g_levelTextTime < 5) else if (g_levelTextTime < 5)
o |= 1; o |= 1;
char const * const fn = currentboardfilename[0] != 0 && menutext_(160<<16, (90+16+8)<<16, -g_levelTextTime+22/*quotepulseshade*/, currentLevel->DisplayName(), o, TEXT_XCENTER);
ud.volume_number == 0 && ud.level_number == 7
? currentboardfilename
: mapList[(ud.volume_number*MAXLEVELS) + ud.level_number].DisplayName();
menutext_(160<<16, (90+16+8)<<16, -g_levelTextTime+22/*quotepulseshade*/, fn, o, TEXT_XCENTER);
} }
if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && cl_crosshair && ud.camerasprite == -1) if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && cl_crosshair && ud.camerasprite == -1)