diff --git a/src/doomstat.h b/src/doomstat.h index 34456b321..0ff47dce6 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -326,6 +326,7 @@ enum GameType // SRB2Kart extern tic_t totalplaytime; extern UINT32 matchesplayed; +extern UINT16 versusrecord[2]; extern UINT8 stagefailed; diff --git a/src/g_game.c b/src/g_game.c index e9309b807..cdb5d3717 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -169,6 +169,7 @@ INT32 sstimer; // Time allotted in the special stage tic_t totalplaytime; UINT32 matchesplayed; // SRB2Kart +UINT16 versusrecord[2]; // SRB2Kart: Online rankings boolean gamedataloaded = false; // Time attack data for levels @@ -3744,9 +3745,13 @@ void G_LoadGameData(void) // to new gamedata G_ClearRecords(); // main and nights records M_ClearSecrets(); // emblems, unlocks, maps visited, etc + totalplaytime = 0; // total play time (separate from all) matchesplayed = 0; // SRB2Kart: matches played & finished + for (i = 0; i < 2; i++) // SRB2Kart: online VR system + versusrecord[i] = 5000; + if (M_CheckParm("-nodata")) return; // Don't load. @@ -3777,6 +3782,9 @@ void G_LoadGameData(void) totalplaytime = READUINT32(save_p); matchesplayed = READUINT32(save_p); + for (i = 0; i < 2; i++) + versusrecord[i] = READUINT16(save_p); + modded = READUINT8(save_p); // Aha! Someone's been screwing with the save file! @@ -3925,6 +3933,9 @@ void G_SaveGameData(boolean force) WRITEUINT32(save_p, totalplaytime); WRITEUINT32(save_p, matchesplayed); + for (i = 0; i < 2; i++) + WRITEUINT16(save_p, versusrecord[i]); + btemp = (UINT8)(savemoddata || modifiedgame); WRITEUINT8(save_p, btemp); diff --git a/src/m_menu.c b/src/m_menu.c index 8e49b2155..2484cd9a3 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -6319,9 +6319,16 @@ static void M_DrawLevelStats(void) G_TicsToHours(totalplaytime), G_TicsToMinutes(totalplaytime, false), G_TicsToSeconds(totalplaytime))); + V_DrawString(20, 42, highlightflags, "Total Matches:"); V_DrawRightAlignedString(BASEVIDWIDTH-16, 42, 0, va("%i played", matchesplayed)); + V_DrawString(20, 50, highlightflags, "Race Versus Record:"); + V_DrawRightAlignedString(BASEVIDWIDTH-16, 50, 0, va("%i", versusrecord[0])); + + V_DrawString(20, 58, highlightflags, "Battle Versus Record:"); + V_DrawRightAlignedString(BASEVIDWIDTH-16, 58, 0, va("%i", versusrecord[1])); + for (i = 0; i < NUMMAPS; i++) { if (!mapheaderinfo[i] || !(mapheaderinfo[i]->menuflags & LF2_RECORDATTACK)) @@ -8452,6 +8459,8 @@ static UINT8 erasecontext = 0; static void M_EraseDataResponse(INT32 ch) { + UINT8 i; + if (ch != 'y' && ch != KEY_ENTER) return; @@ -8463,6 +8472,8 @@ static void M_EraseDataResponse(INT32 ch) // SRB2Kart: This actually needs to be done FIRST, so that you don't immediately regain playtime/matches secrets totalplaytime = 0; matchesplayed = 0; + for (i = 0; i < 2; i++) + versusrecord[i] = 5000; F_StartIntro(); } if (erasecontext != 1)