Revamp statistics screen to put everything on the same page. http://imgur.com/a/kZrfm

* Also, inverted the direction of PGUP and PGDN.
This commit is contained in:
toasterbabe 2017-04-16 00:12:37 +01:00
parent b0ebb40913
commit 24192f54d1

View file

@ -277,7 +277,7 @@ static void M_ModeAttackEndGame(INT32 choice);
static void M_SetGuestReplay(INT32 choice);
static void M_HandleChoosePlayerMenu(INT32 choice);
static void M_ChoosePlayer(INT32 choice);
menu_t SP_GameStatsDef, SP_LevelStatsDef;
menu_t SP_LevelStatsDef;
static menu_t SP_TimeAttackDef, SP_ReplayDef, SP_GuestReplayDef, SP_GhostDef;
static menu_t SP_NightsAttackDef, SP_NightsReplayDef, SP_NightsGuestReplayDef, SP_NightsGhostDef;
@ -346,7 +346,6 @@ static void M_DrawLevelPlatterMenu(void);
static void M_DrawImageDef(void);
static void M_DrawLoad(void);
static void M_DrawLevelStats(void);
static void M_DrawGameStats(void);
static void M_DrawTimeAttackMenu(void);
static void M_DrawNightsAttackMenu(void);
static void M_DrawSetupChoosePlayerMenu(void);
@ -377,7 +376,6 @@ static void M_HandleLevelPlatter(INT32 choice);
static void M_HandleSoundTest(INT32 choice);
static void M_HandleImageDef(INT32 choice);
static void M_HandleLoadSave(INT32 choice);
static void M_HandleGameStats(INT32 choice);
static void M_HandleLevelStats(INT32 choice);
#ifndef NONET
static void M_HandleConnectIP(INT32 choice);
@ -880,11 +878,6 @@ enum
};
// Statistics
static menuitem_t SP_GameStatsMenu[] =
{
{IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleGameStats, 0}, // dummy menuitem for the control func
};
static menuitem_t SP_LevelStatsMenu[] =
{
{IT_KEYHANDLER | IT_NOTHING, NULL, "", M_HandleLevelStats, 0}, // dummy menuitem for the control func
@ -1482,17 +1475,6 @@ menu_t SP_LoadDef =
menu_t SP_LevelSelectDef = MAPPLATTERMENUSTYLE(NULL, SP_LevelSelectMenu);
menu_t SP_GameStatsDef =
{
"M_STATS",
1,
&SP_MainDef,
SP_GameStatsMenu,
M_DrawGameStats,
280, 185,
0,
NULL
};
menu_t SP_LevelStatsDef =
{
"M_STATS",
@ -5724,24 +5706,21 @@ static void M_Statistics(INT32 choice)
statsMapList[j++] = i;
}
statsMapList[j] = -1;
statsMax = j - 13 + numextraemblems;
statsMax = j - 11 + numextraemblems;
statsLocation = 0;
if (statsMax < 0)
statsMax = 0;
M_SetupNextMenu(&SP_GameStatsDef);
M_SetupNextMenu(&SP_LevelStatsDef);
}
static void M_DrawStatsMaps(int location)
{
INT32 y = 76, i = -1;
INT32 y = 80, i = -1;
INT16 mnum;
extraemblem_t *exemblem;
boolean dobottomarrow = (location < statsMax);
V_DrawString(20, y-12, 0, "LEVEL NAME");
V_DrawString(248, y-12, 0, "EMBLEMS");
boolean dotopname = true, dobottomarrow = (location < statsMax);
if (location)
V_DrawString(10, y, V_YELLOWMAP, "\x1A");
@ -5753,6 +5732,13 @@ static void M_DrawStatsMaps(int location)
--location;
continue;
}
else if (dotopname)
{
V_DrawString(20, y, V_GREENMAP, "LEVEL NAME");
V_DrawString(248, y, V_GREENMAP, "EMBLEMS");
y += 8;
dotopname = false;
}
mnum = statsMapList[i];
M_DrawMapEmblems(mnum+1, 292, y);
@ -5767,19 +5753,34 @@ static void M_DrawStatsMaps(int location)
if (y >= BASEVIDHEIGHT-8)
goto bottomarrow;
}
if (dotopname && !location)
{
V_DrawString(20, y, V_GREENMAP, "LEVEL NAME");
V_DrawString(248, y, V_GREENMAP, "EMBLEMS");
y += 8;
}
else if (location)
--location;
// Extra Emblems
for (i = -2; i < numextraemblems; ++i)
{
if (i == -1)
{
V_DrawString(20, y, V_GREENMAP, "EXTRA EMBLEMS");
if (location)
{
y += 8;
location++;
}
}
if (location)
{
--location;
continue;
}
if (i == -1)
V_DrawString(20, y, V_GREENMAP, "EXTRA EMBLEMS");
else if (i >= 0)
if (i >= 0)
{
exemblem = &extraemblems[i];
@ -5804,11 +5805,78 @@ bottomarrow:
static void M_DrawLevelStats(void)
{
M_DrawMenuTitle();
V_DrawCenteredString(BASEVIDWIDTH/2, 24, V_YELLOWMAP, "\x1C PAGE 2 OF 2 \x1D");
char beststr[40];
V_DrawString(72, 48, 0, va("x %d/%d", M_CountEmblems(), numemblems+numextraemblems));
V_DrawScaledPatch(40, 48-4, 0, W_CachePatchName("EMBLICON", PU_STATIC));
tic_t besttime = 0;
UINT32 bestscore = 0;
UINT32 bestrings = 0;
INT32 i;
INT32 mapsunfinished = 0;
boolean bestunfinished[3] = {false, false, false};
M_DrawMenuTitle();
V_DrawString(20, 24, V_YELLOWMAP, "Total Play Time:");
V_DrawCenteredString(BASEVIDWIDTH/2, 32, 0, va("%i hours, %i minutes, %i seconds",
G_TicsToHours(totalplaytime),
G_TicsToMinutes(totalplaytime, false),
G_TicsToSeconds(totalplaytime)));
for (i = 0; i < NUMMAPS; i++)
{
boolean mapunfinished = false;
if (!mapheaderinfo[i] || !(mapheaderinfo[i]->menuflags & LF2_RECORDATTACK))
continue;
if (!mainrecords[i])
{
mapsunfinished++;
bestunfinished[0] = bestunfinished[1] = bestunfinished[2] = true;
continue;
}
if (mainrecords[i]->score > 0)
bestscore += mainrecords[i]->score;
else
mapunfinished = bestunfinished[0] = true;
if (mainrecords[i]->time > 0)
besttime += mainrecords[i]->time;
else
mapunfinished = bestunfinished[1] = true;
if (mainrecords[i]->rings > 0)
bestrings += mainrecords[i]->rings;
else
mapunfinished = bestunfinished[2] = true;
if (mapunfinished)
mapsunfinished++;
}
V_DrawString(20, 48, 0, "Combined records:");
if (mapsunfinished)
V_DrawString(20, 56, V_REDMAP, va("(%d unfinished)", mapsunfinished));
else
V_DrawString(20, 56, V_GREENMAP, "(complete)");
V_DrawString(36, 64, 0, va("x %d/%d", M_CountEmblems(), numemblems+numextraemblems));
V_DrawSmallScaledPatch(20, 64, 0, W_CachePatchName("EMBLICON", PU_STATIC));
sprintf(beststr, "%u", bestscore);
V_DrawString(BASEVIDWIDTH/2, 48, V_YELLOWMAP, "SCORE:");
V_DrawRightAlignedString(BASEVIDWIDTH-16, 48, (bestunfinished[0] ? V_REDMAP : 0), beststr);
sprintf(beststr, "%i:%02i:%02i.%02i", G_TicsToHours(besttime), G_TicsToMinutes(besttime, false), G_TicsToSeconds(besttime), G_TicsToCentiseconds(besttime));
V_DrawString(BASEVIDWIDTH/2, 56, V_YELLOWMAP, "TIME:");
V_DrawRightAlignedString(BASEVIDWIDTH-16, 56, (bestunfinished[1] ? V_REDMAP : 0), beststr);
sprintf(beststr, "%u", bestrings);
V_DrawString(BASEVIDWIDTH/2, 64, V_YELLOWMAP, "RINGS:");
V_DrawRightAlignedString(BASEVIDWIDTH-16, 64, (bestunfinished[2] ? V_REDMAP : 0), beststr);
M_DrawStatsMaps(statsLocation);
}
@ -5832,124 +5900,19 @@ static void M_HandleLevelStats(INT32 choice)
--statsLocation;
break;
case KEY_PGUP:
S_StartSound(NULL, sfx_menu1);
statsLocation += (statsLocation+15 >= statsMax) ? statsMax-statsLocation : 15;
break;
case KEY_PGDN:
S_StartSound(NULL, sfx_menu1);
statsLocation -= (statsLocation < 15) ? statsLocation : 15;
statsLocation += (statsLocation+13 >= statsMax) ? statsMax-statsLocation : 13;
break;
case KEY_PGUP:
S_StartSound(NULL, sfx_menu1);
statsLocation -= (statsLocation < 13) ? statsLocation : 13;
break;
case KEY_ESCAPE:
exitmenu = true;
break;
case KEY_LEFTARROW:
case KEY_RIGHTARROW:
case KEY_ENTER:
S_StartSound(NULL, sfx_menu1);
M_SetupNextMenu(&SP_GameStatsDef);
break;
}
if (exitmenu)
{
if (currentMenu->prevMenu)
M_SetupNextMenu(currentMenu->prevMenu);
else
M_ClearMenus(true);
}
}
// Handle GAME statistics.
static void M_DrawGameStats(void)
{
char beststr[40];
tic_t besttime = 0;
UINT32 bestscore = 0;
UINT32 bestrings = 0;
INT32 i;
INT32 mapsunfinished[3] = {0, 0, 0};
M_DrawMenuTitle();
V_DrawCenteredString(BASEVIDWIDTH/2, 24, V_YELLOWMAP, "\x1C PAGE 1 OF 2 \x1D");
V_DrawString(32, 60, V_YELLOWMAP, "Total Play Time:");
V_DrawRightAlignedString(BASEVIDWIDTH-32, 70, 0, va("%i hours, %i minutes, %i seconds",
G_TicsToHours(totalplaytime),
G_TicsToMinutes(totalplaytime, false),
G_TicsToSeconds(totalplaytime)));
for (i = 0; i < NUMMAPS; i++)
{
if (!mapheaderinfo[i] || !(mapheaderinfo[i]->menuflags & LF2_RECORDATTACK))
continue;
if (!mainrecords[i])
{
mapsunfinished[0]++;
mapsunfinished[1]++;
mapsunfinished[2]++;
continue;
}
if (mainrecords[i]->score > 0)
bestscore += mainrecords[i]->score;
else
mapsunfinished[0]++;
if (mainrecords[i]->time > 0)
besttime += mainrecords[i]->time;
else
mapsunfinished[1]++;
if (mainrecords[i]->rings > 0)
bestrings += mainrecords[i]->rings;
else
mapsunfinished[2]++;
}
V_DrawCenteredString(BASEVIDWIDTH/2, 90, 0, "* COMBINED RECORDS *");
sprintf(beststr, "%u", bestscore);
V_DrawString(32, 100, V_YELLOWMAP, "SCORE:");
V_DrawRightAlignedString(BASEVIDWIDTH-32, 100, 0, beststr);
if (mapsunfinished[0])
V_DrawRightAlignedString(BASEVIDWIDTH-32, 108, V_REDMAP, va("(%d unfinished)", mapsunfinished[0]));
sprintf(beststr, "%i:%02i:%02i.%02i", G_TicsToHours(besttime), G_TicsToMinutes(besttime, false), G_TicsToSeconds(besttime), G_TicsToCentiseconds(besttime));
V_DrawString(32, 120, V_YELLOWMAP, "TIME:");
V_DrawRightAlignedString(BASEVIDWIDTH-32, 120, 0, beststr);
if (mapsunfinished[1])
V_DrawRightAlignedString(BASEVIDWIDTH-32, 128, V_REDMAP, va("(%d unfinished)", mapsunfinished[1]));
sprintf(beststr, "%u", bestrings);
V_DrawString(32, 140, V_YELLOWMAP, "RINGS:");
V_DrawRightAlignedString(BASEVIDWIDTH-32, 140, 0, beststr);
if (mapsunfinished[2])
V_DrawRightAlignedString(BASEVIDWIDTH-32, 148, V_REDMAP, va("(%d unfinished)", mapsunfinished[2]));
}
static void M_HandleGameStats(INT32 choice)
{
boolean exitmenu = false; // exit to previous menu
switch (choice)
{
case KEY_ESCAPE:
exitmenu = true;
break;
case KEY_LEFTARROW:
case KEY_RIGHTARROW:
case KEY_ENTER:
S_StartSound(NULL, sfx_menu1);
M_SetupNextMenu(&SP_LevelStatsDef);
break;
}
if (exitmenu)
{