mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- use the currentLevel record for the status screens. What was there could be broken by scripts thanks to the non-existent access control to critical variables.
- give the final map in RR a proper mapinfo record. Without this the map is not really stable with the current savegame system.
This commit is contained in:
parent
0e19d4262e
commit
ebb43f9129
5 changed files with 35 additions and 74 deletions
|
@ -184,7 +184,7 @@ static void G_ShowScores(void)
|
|||
if (g_mostConcurrentPlayers > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET))
|
||||
{
|
||||
gametext_center(SCORESHEETOFFSET+58+2, GStrings("Multiplayer Totals"));
|
||||
gametext_center(SCORESHEETOFFSET+58+10, mapList[G_LastMapInfoIndex()].DisplayName());
|
||||
gametext_center(SCORESHEETOFFSET+58+10, currentLevel->DisplayName());
|
||||
|
||||
t = 0;
|
||||
minitext(70, SCORESHEETOFFSET+80, GStrings("Name"), 8, 2+8+16+ROTATESPRITE_MAX);
|
||||
|
@ -1885,7 +1885,7 @@ static void G_DisplayMPResultsScreen(void)
|
|||
if (PLUTOPAK) // JBF 20030804
|
||||
rotatesprite_fs((260)<<16, 36<<16, 65536L, 0, PLUTOPAKSPRITE+2, 0, 0, 2+8);
|
||||
gametext_center(58+2, GStrings("Multiplayer Totals"));
|
||||
gametext_center(58+10, mapList[G_LastMapInfoIndex()].DisplayName());
|
||||
gametext_center(58+10, currentLevel->DisplayName());
|
||||
|
||||
gametext_center_shade(165, GStrings("Presskey"), quotepulseshade);
|
||||
|
||||
|
@ -1953,11 +1953,11 @@ static int32_t G_PrintTime_ClockPad(void)
|
|||
clockpad = max(clockpad, ij);
|
||||
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
||||
{
|
||||
for (ii=mapList[G_LastMapInfoIndex()].parTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
|
||||
for (ii=currentLevel->parTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
|
||||
clockpad = max(clockpad, ij);
|
||||
if (!NAM_WW2GI && mapList[G_LastMapInfoIndex()].designerTime)
|
||||
if (!NAM_WW2GI && currentLevel->designerTime)
|
||||
{
|
||||
for (ii= mapList[G_LastMapInfoIndex()].designerTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
|
||||
for (ii= currentLevel->designerTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
|
||||
clockpad = max(clockpad, ij);
|
||||
}
|
||||
}
|
||||
|
@ -1986,13 +1986,13 @@ const char* G_PrintParTime(void)
|
|||
{
|
||||
if (ud.last_level < 1)
|
||||
return "<invalid>";
|
||||
return G_PrintTime2(mapList[G_LastMapInfoIndex()].parTime);
|
||||
return G_PrintTime2(currentLevel->parTime);
|
||||
}
|
||||
const char* G_PrintDesignerTime(void)
|
||||
{
|
||||
if (ud.last_level < 1)
|
||||
return "<invalid>";
|
||||
return G_PrintTime2(mapList[G_LastMapInfoIndex()].designerTime);
|
||||
return G_PrintTime2(currentLevel->designerTime);
|
||||
}
|
||||
const char* G_PrintBestTime(void)
|
||||
{
|
||||
|
@ -2017,9 +2017,9 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
}
|
||||
else
|
||||
{
|
||||
lastmapname = mapList[G_LastMapInfoIndex()].name;
|
||||
lastmapname = currentLevel->name;
|
||||
if (!lastmapname || !*lastmapname) // this isn't right but it's better than no name at all
|
||||
lastmapname = mapList[G_LastMapInfoIndex()].fileName;
|
||||
lastmapname = currentLevel->fileName;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2185,12 +2185,12 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
yy+=10;
|
||||
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
||||
{
|
||||
if (mapList[G_LastMapInfoIndex()].parTime)
|
||||
if (currentLevel->parTime)
|
||||
{
|
||||
gametext(10, yy+9, GStrings("TXT_ParTime"));
|
||||
yy+=10;
|
||||
}
|
||||
if (!NAM_WW2GI && !DUKEBETA && mapList[G_LastMapInfoIndex()].designerTime)
|
||||
if (!NAM_WW2GI && !DUKEBETA && currentLevel->designerTime)
|
||||
{
|
||||
// EDuke 2.0 / NAM source suggests "Green Beret's Time:"
|
||||
gametext(10, yy+9, GStrings("TXT_3DRTIME"));
|
||||
|
@ -2229,13 +2229,13 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
|
||||
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
||||
{
|
||||
if (mapList[G_LastMapInfoIndex()].parTime)
|
||||
if (currentLevel->parTime)
|
||||
{
|
||||
G_PrintParTime();
|
||||
gametext_number((320>>2)+71, yy+9, tempbuf);
|
||||
yy+=10;
|
||||
}
|
||||
if (!NAM_WW2GI && !DUKEBETA && mapList[G_LastMapInfoIndex()].designerTime)
|
||||
if (!NAM_WW2GI && !DUKEBETA && currentLevel->designerTime)
|
||||
{
|
||||
G_PrintDesignerTime();
|
||||
gametext_number((320>>2)+71, yy+9, tempbuf);
|
||||
|
|
|
@ -26,12 +26,6 @@ extern void G_DisplayExtraScreens(void);
|
|||
extern void G_DisplayLogo(void);
|
||||
extern void G_DoOrderScreen(void);
|
||||
|
||||
static inline int G_LastMapInfoIndex(void)
|
||||
{
|
||||
Bassert(ud.last_level >= 1); // NOTE: last_level is 1-based
|
||||
return ud.volume_number*MAXLEVELS + ud.last_level-1;
|
||||
}
|
||||
|
||||
#ifdef DEBUGGINGAIDS
|
||||
typedef struct {
|
||||
uint32_t lastgtic;
|
||||
|
|
|
@ -2337,26 +2337,14 @@ int G_EnterLevel(int gameMode)
|
|||
}
|
||||
}
|
||||
|
||||
mii = (ud.volume_number*MAXLEVELS)+ud.level_number;
|
||||
// Redirect the final RR level to a valid map record so that currentLevel can point to something.
|
||||
mii = (RR && g_lastLevel)? 127 : (ud.volume_number*MAXLEVELS)+ud.level_number;
|
||||
auto &mi = mapList[mii];
|
||||
|
||||
if (mi.fileName.IsEmpty())
|
||||
if (mi.fileName.IsEmpty() && !Menu_HaveUserMap())
|
||||
{
|
||||
if (RR && g_lastLevel)
|
||||
{
|
||||
// FIXME: Initialize this properly in the data structures!
|
||||
mi.fileName = "endgame.map";
|
||||
mi.name = "$TXT_CLOSEENCOUNTERS";
|
||||
}
|
||||
else if (Menu_HaveUserMap())
|
||||
{
|
||||
mi.name = "$TXT_USERMAP";
|
||||
}
|
||||
else
|
||||
{
|
||||
OSD_Printf(OSDTEXT_RED "Map E%dL%d not defined!\n", ud.volume_number+1, ud.level_number+1);
|
||||
return 1;
|
||||
}
|
||||
OSD_Printf(OSDTEXT_RED "Map E%dL%d not defined!\n", ud.volume_number+1, ud.level_number+1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
i = ud.screen_size;
|
||||
|
|
|
@ -176,7 +176,7 @@ static void G_ShowScores(void)
|
|||
if (g_mostConcurrentPlayers > 1 && (g_gametypeFlags[ud.coop]&GAMETYPE_SCORESHEET))
|
||||
{
|
||||
gametext_center(SCORESHEETOFFSET+58+2, GStrings("Multiplayer Totals"));
|
||||
gametext_center(SCORESHEETOFFSET+58+10, mapList[G_LastMapInfoIndex()].DisplayName());
|
||||
gametext_center(SCORESHEETOFFSET+58+10, currentLevel->DisplayName());
|
||||
|
||||
t = 0;
|
||||
minitext(70, SCORESHEETOFFSET+80, GStrings("Name"), 8, 2+8+16+ROTATESPRITE_MAX);
|
||||
|
@ -1908,7 +1908,7 @@ static void G_DisplayMPResultsScreen(void)
|
|||
if (!RR && PLUTOPAK) // JBF 20030804
|
||||
rotatesprite_fs((260)<<16, 36<<16, 65536L, 0, PLUTOPAKSPRITE+2, 0, 0, 2+8);
|
||||
gametext_center(58+(RR ? 0 : 2), GStrings("Multiplayer Totals"));
|
||||
gametext_center(58+10, mapList[G_LastMapInfoIndex()].DisplayName());
|
||||
gametext_center(58+10, currentLevel->DisplayName());
|
||||
|
||||
gametext_center_shade(RR ? 175 : 165, GStrings("Presskey"), quotepulseshade);
|
||||
|
||||
|
@ -1976,11 +1976,11 @@ static int32_t G_PrintTime_ClockPad(void)
|
|||
clockpad = max(clockpad, ij);
|
||||
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
||||
{
|
||||
for (ii=mapList[G_LastMapInfoIndex()].parTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
|
||||
for (ii=currentLevel->parTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
|
||||
clockpad = max(clockpad, ij);
|
||||
if (mapList[G_LastMapInfoIndex()].designerTime)
|
||||
if (currentLevel->designerTime)
|
||||
{
|
||||
for (ii=mapList[G_LastMapInfoIndex()].designerTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
|
||||
for (ii=currentLevel->designerTime/(REALGAMETICSPERSEC*60), ij=1; ii>9; ii/=10, ij++) { }
|
||||
clockpad = max(clockpad, ij);
|
||||
}
|
||||
}
|
||||
|
@ -2009,13 +2009,13 @@ const char* G_PrintParTime(void)
|
|||
{
|
||||
if (ud.last_level < 1)
|
||||
return "<invalid>";
|
||||
return G_PrintTime2(mapList[G_LastMapInfoIndex()].parTime);
|
||||
return G_PrintTime2(currentLevel->parTime);
|
||||
}
|
||||
const char* G_PrintDesignerTime(void)
|
||||
{
|
||||
if (ud.last_level < 1)
|
||||
return "<invalid>";
|
||||
return G_PrintTime2(mapList[G_LastMapInfoIndex()].designerTime);
|
||||
return G_PrintTime2(currentLevel->designerTime);
|
||||
}
|
||||
const char* G_PrintBestTime(void)
|
||||
{
|
||||
|
@ -2040,18 +2040,9 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
}
|
||||
else
|
||||
{
|
||||
lastmapname = mapList[G_LastMapInfoIndex()].DisplayName();
|
||||
lastmapname = currentLevel->DisplayName();
|
||||
}
|
||||
|
||||
if (RR)
|
||||
{
|
||||
if ((g_lastLevel && ud.volume_number == 2) || g_vixenLevel)
|
||||
lastmapname = GStrings("TXT_CLOSEENCOUNTERS");
|
||||
else if (g_turdLevel)
|
||||
lastmapname = GStrings("SMELTIN' PLANT");
|
||||
}
|
||||
|
||||
|
||||
fadepal(0, 0, 0, 0, 252, RR ? 4 : 28);
|
||||
videoSetViewableArea(0, 0, xdim-1, ydim-1);
|
||||
videoClearScreen(0L);
|
||||
|
@ -2251,7 +2242,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
yy+= yystep;
|
||||
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
||||
{
|
||||
if (mapList[G_LastMapInfoIndex()].parTime)
|
||||
if (currentLevel->parTime)
|
||||
{
|
||||
if (!RR)
|
||||
gametext(10, yy+9, GStrings("TXT_ParTime"));
|
||||
|
@ -2259,7 +2250,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
menutext(30, yy, GStrings("TXT_ParTime"));
|
||||
yy+=yystep;
|
||||
}
|
||||
if (mapList[G_LastMapInfoIndex()].designerTime)
|
||||
if (currentLevel->designerTime)
|
||||
{
|
||||
// EDuke 2.0 / NAM source suggests "Green Beret's Time:"
|
||||
if (DUKE)
|
||||
|
@ -2315,7 +2306,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
|
||||
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
||||
{
|
||||
if (mapList[G_LastMapInfoIndex()].parTime)
|
||||
if (currentLevel->parTime)
|
||||
{
|
||||
G_PrintParTime();
|
||||
if (!RR)
|
||||
|
@ -2324,7 +2315,7 @@ void G_BonusScreen(int32_t bonusonly)
|
|||
menutext(191, yy, tempbuf);
|
||||
yy+=yystep;
|
||||
}
|
||||
if (mapList[G_LastMapInfoIndex()].designerTime)
|
||||
if (currentLevel->designerTime)
|
||||
{
|
||||
G_PrintDesignerTime();
|
||||
if (DUKE)
|
||||
|
@ -2618,15 +2609,9 @@ void G_BonusScreenRRRA(int32_t bonusonly)
|
|||
}
|
||||
else
|
||||
{
|
||||
lastmapname = mapList[G_LastMapInfoIndex()].DisplayName();
|
||||
lastmapname = currentLevel->DisplayName();
|
||||
}
|
||||
|
||||
if ((g_lastLevel && ud.volume_number == 2) || g_vixenLevel)
|
||||
lastmapname = GStrings("TXT_CLOSEENCOUNTERS");
|
||||
else if (g_turdLevel)
|
||||
lastmapname = GStrings("SMELTIN' PLANT");
|
||||
|
||||
|
||||
fadepal(0, 0, 0, 0, 252, 4);
|
||||
videoSetViewableArea(0, 0, xdim-1, ydim-1);
|
||||
videoClearScreen(0L);
|
||||
|
@ -2819,12 +2804,12 @@ void G_BonusScreenRRRA(int32_t bonusonly)
|
|||
yy+= yystep;
|
||||
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
||||
{
|
||||
if (mapList[G_LastMapInfoIndex()].parTime)
|
||||
if (currentLevel->parTime)
|
||||
{
|
||||
menutext(30, yy, GStrings("TXT_PARTIME"));
|
||||
yy+=yystep;
|
||||
}
|
||||
if (mapList[G_LastMapInfoIndex()].designerTime)
|
||||
if (currentLevel->designerTime)
|
||||
{
|
||||
menutext(30, yy, GStrings("TXT_XTRTIME"));
|
||||
yy+=yystep;
|
||||
|
@ -2862,13 +2847,13 @@ void G_BonusScreenRRRA(int32_t bonusonly)
|
|||
|
||||
if (!(ud.volume_number == 0 && ud.last_level-1 == 7 && boardfilename[0]))
|
||||
{
|
||||
if (mapList[G_LastMapInfoIndex()].parTime)
|
||||
if (currentLevel->parTime)
|
||||
{
|
||||
G_PrintParTime();
|
||||
menutext(191, yy, tempbuf);
|
||||
yy+=yystep;
|
||||
}
|
||||
if (mapList[G_LastMapInfoIndex()].designerTime)
|
||||
if (currentLevel->designerTime)
|
||||
{
|
||||
G_PrintDesignerTime();
|
||||
menutext(191, yy, tempbuf);
|
||||
|
|
|
@ -26,12 +26,6 @@ extern void G_DisplayExtraScreens(void);
|
|||
extern void G_DisplayLogo(void);
|
||||
extern void G_DoOrderScreen(void);
|
||||
|
||||
static inline int G_LastMapInfoIndex(void)
|
||||
{
|
||||
Bassert(ud.last_level >= 1); // NOTE: last_level is 1-based
|
||||
return ud.volume_number*MAXLEVELS + ud.last_level-1;
|
||||
}
|
||||
|
||||
#ifdef DEBUGGINGAIDS
|
||||
typedef struct {
|
||||
uint32_t lastgtic;
|
||||
|
|
Loading…
Reference in a new issue