Some cleanup

No longer save score/rings, use the Race tally as a placeholder
replacement for the butchered vanilla one
This commit is contained in:
TehRealSalt 2017-10-16 20:23:26 -04:00
parent b5e0a80c35
commit 4ed0511013
5 changed files with 66 additions and 95 deletions

View File

@ -645,7 +645,7 @@ void G_SetNightsRecords(void)
// Save demo! // Save demo!
bestdemo[255] = '\0'; bestdemo[255] = '\0';
lastdemo[255] = '\0'; lastdemo[255] = '\0';
G_SetDemoTime(totaltime, totalscore, 0); G_SetDemoTime(totaltime, totalscore);
G_CheckDemoStatus(); G_CheckDemoStatus();
I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755); I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755);
@ -2939,7 +2939,7 @@ static void G_DoCompleted(void)
// a map of the proper gametype -- skip levels that don't support // a map of the proper gametype -- skip levels that don't support
// the current gametype. (Helps avoid playing boss levels in Race, // the current gametype. (Helps avoid playing boss levels in Race,
// for instance). // for instance).
if (!token && !G_IsSpecialStage(gamemap) if (!token && !G_IsSpecialStage(gamemap) && !modeattacking
&& (nextmap >= 0 && nextmap < NUMMAPS)) && (nextmap >= 0 && nextmap < NUMMAPS))
{ {
register INT16 cm = nextmap; register INT16 cm = nextmap;
@ -4786,8 +4786,6 @@ void G_BeginRecording(void)
case ATTACKING_RECORD: // 1 case ATTACKING_RECORD: // 1
demotime_p = demo_p; demotime_p = demo_p;
WRITEUINT32(demo_p,UINT32_MAX); // time WRITEUINT32(demo_p,UINT32_MAX); // time
WRITEUINT32(demo_p,0); // score
WRITEUINT16(demo_p,0); // rings
break; break;
case ATTACKING_NIGHTS: // 2 case ATTACKING_NIGHTS: // 2
demotime_p = demo_p; demotime_p = demo_p;
@ -4894,15 +4892,13 @@ void G_BeginMetal(void)
oldmetal.angle = mo->angle; oldmetal.angle = mo->angle;
} }
void G_SetDemoTime(UINT32 ptime, UINT32 pscore, UINT16 prings) void G_SetDemoTime(UINT32 ptime, UINT32 pscore)
{ {
if (!demorecording || !demotime_p) if (!demorecording || !demotime_p)
return; return;
if (demoflags & DF_RECORDATTACK) if (demoflags & DF_RECORDATTACK)
{ {
WRITEUINT32(demotime_p, ptime); WRITEUINT32(demotime_p, ptime);
WRITEUINT32(demotime_p, pscore);
WRITEUINT16(demotime_p, prings);
demotime_p = NULL; demotime_p = NULL;
} }
else if (demoflags & DF_NIGHTSATTACK) else if (demoflags & DF_NIGHTSATTACK)
@ -4922,7 +4918,7 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
UINT8 *buffer,*p; UINT8 *buffer,*p;
UINT8 flags; UINT8 flags;
UINT32 oldtime, newtime, oldscore, newscore; UINT32 oldtime, newtime, oldscore, newscore;
UINT16 oldrings, newrings, oldversion; UINT16 oldversion;
size_t bufsize ATTRUNUSED; size_t bufsize ATTRUNUSED;
UINT8 c; UINT8 c;
UINT16 s ATTRUNUSED; UINT16 s ATTRUNUSED;
@ -4955,14 +4951,12 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
if (flags & DF_RECORDATTACK) if (flags & DF_RECORDATTACK)
{ {
newtime = READUINT32(p); newtime = READUINT32(p);
newscore = READUINT32(p); newscore = 0;
newrings = READUINT16(p);
} }
else if (flags & DF_NIGHTSATTACK) else if (flags & DF_NIGHTSATTACK)
{ {
newtime = READUINT32(p); newtime = READUINT32(p);
newscore = READUINT32(p); newscore = READUINT32(p);
newrings = 0;
} }
else // appease compiler else // appease compiler
return 0; return 0;
@ -5017,14 +5011,12 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
if (flags & DF_RECORDATTACK) if (flags & DF_RECORDATTACK)
{ {
oldtime = READUINT32(p); oldtime = READUINT32(p);
oldscore = READUINT32(p); oldscore = 0;
oldrings = READUINT16(p);
} }
else if (flags & DF_NIGHTSATTACK) else if (flags & DF_NIGHTSATTACK)
{ {
oldtime = READUINT32(p); oldtime = READUINT32(p);
oldscore = READUINT32(p); oldscore = READUINT32(p);
oldrings = 0;
} }
else // appease compiler else // appease compiler
return UINT8_MAX; return UINT8_MAX;
@ -5033,14 +5025,11 @@ UINT8 G_CmpDemoTime(char *oldname, char *newname)
c = 0; c = 0;
if (newtime < oldtime if (newtime < oldtime
|| (newtime == oldtime && (newscore > oldscore || newrings > oldrings))) || (newtime == oldtime && (newscore > oldscore)))
c |= 1; // Better time c |= 1; // Better time
if (newscore > oldscore if (newscore > oldscore
|| (newscore == oldscore && newtime < oldtime)) || (newscore == oldscore && newtime < oldtime))
c |= 1<<1; // Better score c |= 1<<1; // Better score
if (newrings > oldrings
|| (newrings == oldrings && newtime < oldtime))
c |= 1<<2; // Better rings
return c; return c;
} }
@ -5160,7 +5149,6 @@ void G_DoPlayDemo(char *defdemoname)
hu_demoscore = 0; hu_demoscore = 0;
hu_demotime = UINT32_MAX; hu_demotime = UINT32_MAX;
hu_demorings = 0;
switch (modeattacking) switch (modeattacking)
{ {
@ -5168,8 +5156,6 @@ void G_DoPlayDemo(char *defdemoname)
break; break;
case ATTACKING_RECORD: // 1 case ATTACKING_RECORD: // 1
hu_demotime = READUINT32(demo_p); hu_demotime = READUINT32(demo_p);
hu_demoscore = READUINT32(demo_p);
hu_demorings = READUINT16(demo_p);
break; break;
case ATTACKING_NIGHTS: // 2 case ATTACKING_NIGHTS: // 2
hu_demotime = READUINT32(demo_p); hu_demotime = READUINT32(demo_p);
@ -5390,7 +5376,7 @@ void G_AddGhost(char *defdemoname)
case ATTACKING_NONE: // 0 case ATTACKING_NONE: // 0
break; break;
case ATTACKING_RECORD: // 1 case ATTACKING_RECORD: // 1
p += 10; // demo time, score, and rings p += 4; // demo time
break; break;
case ATTACKING_NIGHTS: // 2 case ATTACKING_NIGHTS: // 2
p += 8; // demo time left, score p += 8; // demo time left, score

View File

@ -120,7 +120,7 @@ void G_BeginRecording(void);
void G_BeginMetal(void); void G_BeginMetal(void);
// Only called by shutdown code. // Only called by shutdown code.
void G_SetDemoTime(UINT32 ptime, UINT32 pscore, UINT16 prings); void G_SetDemoTime(UINT32 ptime, UINT32 pscore);
UINT8 G_CmpDemoTime(char *oldname, char *newname); UINT8 G_CmpDemoTime(char *oldname, char *newname);
typedef enum typedef enum

View File

@ -1038,30 +1038,28 @@ static void HU_drawGametype(void)
// //
UINT32 hu_demoscore; UINT32 hu_demoscore;
UINT32 hu_demotime; UINT32 hu_demotime;
UINT16 hu_demorings;
static void HU_DrawDemoInfo(void) static void HU_DrawDemoInfo(void)
{ {
V_DrawString(4, 188-24, V_YELLOWMAP, va(M_GetText("%s's replay"), player_names[0])); UINT8 timeoffset = 8;
V_DrawString(4, 188-16, V_YELLOWMAP, va(M_GetText("%s's replay"), player_names[0]));
if (modeattacking) if (modeattacking)
{ {
V_DrawString(4, 188-16, V_YELLOWMAP|V_MONOSPACE, "SCORE:"); if (modeattacking == ATTACKING_NIGHTS)
V_DrawRightAlignedString(120, 188-16, V_MONOSPACE, va("%d", hu_demoscore)); {
V_DrawString(4, 188-8, V_YELLOWMAP|V_MONOSPACE, "SCORE:");
V_DrawRightAlignedString(120, 188-8, V_MONOSPACE, va("%d", hu_demoscore));
timeoffset = 0;
}
V_DrawString(4, 188- 8, V_YELLOWMAP|V_MONOSPACE, "TIME:"); V_DrawString(4, 188- timeoffset, V_YELLOWMAP|V_MONOSPACE, "TIME:");
if (hu_demotime != UINT32_MAX) if (hu_demotime != UINT32_MAX)
V_DrawRightAlignedString(120, 188- 8, V_MONOSPACE, va("%i:%02i.%02i", V_DrawRightAlignedString(120, 188- timeoffset, V_MONOSPACE, va("%i:%02i.%02i",
G_TicsToMinutes(hu_demotime,true), G_TicsToMinutes(hu_demotime,true),
G_TicsToSeconds(hu_demotime), G_TicsToSeconds(hu_demotime),
G_TicsToCentiseconds(hu_demotime))); G_TicsToCentiseconds(hu_demotime)));
else else
V_DrawRightAlignedString(120, 188- 8, V_MONOSPACE, "--:--.--"); V_DrawRightAlignedString(120, 188- timeoffset, V_MONOSPACE, "--:--.--");
if (modeattacking == ATTACKING_RECORD)
{
V_DrawString(4, 188 , V_YELLOWMAP|V_MONOSPACE, "RINGS:");
V_DrawRightAlignedString(120, 188 , V_MONOSPACE, va("%d", hu_demorings));
}
} }
} }

View File

@ -111,14 +111,14 @@ const char *quitmsg[NUM_QUITMESSAGES];
// Stuff for customizing the player select screen Tails 09-22-2003 // Stuff for customizing the player select screen Tails 09-22-2003
description_t description[32] = description_t description[32] =
{ {
{"\x82Sonic\x80 is the fastest of the three, but also the hardest to control. Beginners beware, but experts will find Sonic very powerful.\n\n\x82""Ability:\x80 Speed Thok\nDouble jump to zoom forward with a huge burst of speed.\n\n\x82Tip:\x80 Simply letting go of forward does not slow down in SRB2. To slow down, hold the opposite direction.", "", "sonic"}, {"\x82Sonic\x80", "", "sonic"},
{"\x82Tails\x80 is the most mobile of the three, but has the slowest speed. Because of his mobility, he's well-\nsuited to beginners.\n\n\x82""Ability:\x80 Fly\nDouble jump to start flying for a limited time. Repetitively hit the jump button to ascend.\n\n\x82Tip:\x80 To quickly descend while flying, hit the spin button.", "", "tails"}, {"\x82Tails\x80", "", "tails"},
{"\x82Knuckles\x80 is well-\nrounded and can destroy breakable walls simply by touching them, but he can't jump as high as the other two.\n\n\x82""Ability:\x80 Glide & Climb\nDouble jump to glide in the air as long as jump is held. Glide into a wall to climb it.\n\n\x82Tip:\x80 Press spin while climbing to jump off the wall; press jump instead to jump off\nand face away from\nthe wall.", "", "knuckles"}, {"\x82Knuckles\x80", "", "knuckles"},
{"\x82Sonic & Tails\x80 team up to take on Dr. Eggman!\nControl Sonic while Tails desperately struggles to keep up.\n\nPlayer 2 can control Tails directly by setting the controls in the options menu.\nTails's directional controls are relative to Player 1's camera.\n\nTails can pick up Sonic while flying and carry him around.", "CHRS&T", "sonic&tails"}, {"\x82Metal Sonic\x80", "", "metalsonic"},
{"???", "", ""}, {"???", "", ""}, // {"\x82Blonic\x80", "", "blonic"},
{"???", "", ""}, {"???", "", ""}, // {"\x82Blails\x80", "", "blails"},
{"???", "", ""}, {"???", "", ""}, // {"\x82Bluckles\x80", "", "bluckles"},
{"???", "", ""}, {"???", "", ""}, // {"\x82Bletal Blonic\x80", "", "bletalblonic"},
{"???", "", ""}, {"???", "", ""},
{"???", "", ""}, {"???", "", ""},
{"???", "", ""}, {"???", "", ""},
@ -723,9 +723,7 @@ enum
static menuitem_t SP_ReplayMenu[] = static menuitem_t SP_ReplayMenu[] =
{ {
{IT_WHITESTRING|IT_CALL, NULL, "Replay Best Score", M_ReplayTimeAttack, 0}, {IT_WHITESTRING|IT_CALL, NULL, "Replay Best Time", M_ReplayTimeAttack, 16},
{IT_WHITESTRING|IT_CALL, NULL, "Replay Best Time", M_ReplayTimeAttack, 8},
{IT_WHITESTRING|IT_CALL, NULL, "Replay Best Rings", M_ReplayTimeAttack,16},
{IT_WHITESTRING|IT_CALL, NULL, "Replay Last", M_ReplayTimeAttack,29}, {IT_WHITESTRING|IT_CALL, NULL, "Replay Last", M_ReplayTimeAttack,29},
{IT_WHITESTRING|IT_CALL, NULL, "Replay Guest", M_ReplayTimeAttack,37}, {IT_WHITESTRING|IT_CALL, NULL, "Replay Guest", M_ReplayTimeAttack,37},
@ -1829,7 +1827,7 @@ static void Nextmap_OnChange(void)
// Check if file exists, if not, disable REPLAY option // Check if file exists, if not, disable REPLAY option
sprintf(tabase,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), cv_chooseskin.string); sprintf(tabase,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), cv_chooseskin.string);
for (i = 0; i < 5; i++) { for (i = 0; i < 3; i++) {
SP_ReplayMenu[i].status = IT_DISABLED; SP_ReplayMenu[i].status = IT_DISABLED;
SP_GuestReplayMenu[i].status = IT_DISABLED; SP_GuestReplayMenu[i].status = IT_DISABLED;
} }
@ -1838,26 +1836,16 @@ static void Nextmap_OnChange(void)
SP_GuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL; SP_GuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
active = true; active = true;
} }
if (FIL_FileExists(va("%s-score-best.lmp", tabase))) { if (FIL_FileExists(va("%s-last.lmp", tabase))) {
SP_ReplayMenu[1].status = IT_WHITESTRING|IT_CALL; SP_ReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
SP_GuestReplayMenu[1].status = IT_WHITESTRING|IT_CALL; SP_GuestReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
active = true; active = true;
} }
if (FIL_FileExists(va("%s-rings-best.lmp", tabase))) { if (FIL_FileExists(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)))) {
SP_ReplayMenu[2].status = IT_WHITESTRING|IT_CALL; SP_ReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
SP_GuestReplayMenu[2].status = IT_WHITESTRING|IT_CALL; SP_GuestReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
active = true; active = true;
} }
if (FIL_FileExists(va("%s-last.lmp", tabase))) {
SP_ReplayMenu[3].status = IT_WHITESTRING|IT_CALL;
SP_GuestReplayMenu[3].status = IT_WHITESTRING|IT_CALL;
active = true;
}
if (FIL_FileExists(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)))) {
SP_ReplayMenu[4].status = IT_WHITESTRING|IT_CALL;
SP_GuestReplayMenu[4].status = IT_WHITESTRING|IT_CALL;
active = true;
}
if (active) { if (active) {
SP_TimeAttackMenu[taguest].status = IT_WHITESTRING|IT_SUBMENU; SP_TimeAttackMenu[taguest].status = IT_WHITESTRING|IT_SUBMENU;
SP_TimeAttackMenu[tareplay].status = IT_WHITESTRING|IT_SUBMENU; SP_TimeAttackMenu[tareplay].status = IT_WHITESTRING|IT_SUBMENU;
@ -5588,19 +5576,16 @@ static void M_ReplayTimeAttack(INT32 choice)
{ {
switch(choice) { switch(choice) {
default: default:
case 0: // best score case 0: // best time
which = "score-best";
break;
case 1: // best time
which = "time-best"; which = "time-best";
break; break;
case 2: // best rings case 1: // last
which = "rings-best";
break;
case 3: // last
which = "last"; which = "last";
break; break;
case 4: // guest /*case 2: // best staff
which = "staff-best";
break;*/
case 2: // guest
// srb2/replay/main/map01-guest.lmp // srb2/replay/main/map01-guest.lmp
G_DoPlayDemo(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value))); G_DoPlayDemo(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)));
return; return;
@ -5621,6 +5606,9 @@ static void M_ReplayTimeAttack(INT32 choice)
case 2: // last case 2: // last
which = "last"; which = "last";
break; break;
/*case 3: // best staff
which = "staff-best";
break;*/
case 3: // guest case 3: // guest
which = "guest"; which = "guest";
break; break;

View File

@ -846,7 +846,10 @@ void Y_Ticker(void)
if (r) if (r)
S_StartSound(NULL, sfx_menu1); S_StartSound(NULL, sfx_menu1);
else else
endtic = intertic + 3*TICRATE; // 3 second pause after end of tally if (modeattacking)
endtic = intertic + 10*TICRATE; // 10 second pause after end of tally
else
endtic = intertic + 3*TICRATE; // 3 second pause after end of tally
} }
else if (intertype == int_match || intertype == int_ctf || intertype == int_teammatch) // match else if (intertype == int_match || intertype == int_ctf || intertype == int_teammatch) // match
{ {
@ -883,19 +886,13 @@ static void Y_UpdateRecordReplays(void)
if (!mainrecords[gamemap-1]) if (!mainrecords[gamemap-1])
G_AllocMainRecordData(gamemap-1); G_AllocMainRecordData(gamemap-1);
if (players[consoleplayer].score > mainrecords[gamemap-1]->score)
mainrecords[gamemap-1]->score = players[consoleplayer].score;
if ((mainrecords[gamemap-1]->time == 0) || (players[consoleplayer].realtime < mainrecords[gamemap-1]->time)) if ((mainrecords[gamemap-1]->time == 0) || (players[consoleplayer].realtime < mainrecords[gamemap-1]->time))
mainrecords[gamemap-1]->time = players[consoleplayer].realtime; mainrecords[gamemap-1]->time = players[consoleplayer].realtime;
if ((UINT16)(players[consoleplayer].health - 1) > mainrecords[gamemap-1]->rings)
mainrecords[gamemap-1]->rings = (UINT16)(players[consoleplayer].health - 1);
// Save demo! // Save demo!
bestdemo[255] = '\0'; bestdemo[255] = '\0';
lastdemo[255] = '\0'; lastdemo[255] = '\0';
G_SetDemoTime(players[consoleplayer].realtime, players[consoleplayer].score, (UINT16)(players[consoleplayer].health-1)); G_SetDemoTime(players[consoleplayer].realtime, 0);
G_CheckDemoStatus(); G_CheckDemoStatus();
I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755); I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755);
@ -921,24 +918,6 @@ static void Y_UpdateRecordReplays(void)
CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD TIME!"), M_GetText("Saved replay as"), bestdemo); CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW RECORD TIME!"), M_GetText("Saved replay as"), bestdemo);
} }
snprintf(bestdemo, 255, "%s-%s-score-best.lmp", gpath, cv_chooseskin.string);
if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<1)))
{ // Better score, save this demo.
if (FIL_FileExists(bestdemo))
remove(bestdemo);
FIL_WriteFile(bestdemo, buf, len);
CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW HIGH SCORE!"), M_GetText("Saved replay as"), bestdemo);
}
snprintf(bestdemo, 255, "%s-%s-rings-best.lmp", gpath, cv_chooseskin.string);
if (!FIL_FileExists(bestdemo) || (G_CmpDemoTime(bestdemo, lastdemo) & (1<<2)))
{ // Better rings, save this demo.
if (FIL_FileExists(bestdemo))
remove(bestdemo);
FIL_WriteFile(bestdemo, buf, len);
CONS_Printf("\x83%s\x80 %s '%s'\n", M_GetText("NEW MOST RINGS!"), M_GetText("Saved replay as"), bestdemo);
}
//CONS_Printf("%s '%s'\n", M_GetText("Saved replay as"), lastdemo); //CONS_Printf("%s '%s'\n", M_GetText("Saved replay as"), lastdemo);
Z_Free(buf); Z_Free(buf);
@ -980,9 +959,11 @@ void Y_StartIntermission(void)
else else
intertype = (maptol & TOL_NIGHTS) ? int_nights : int_coop; intertype = (maptol & TOL_NIGHTS) ? int_nights : int_coop;
*/ */
/* // srb2kart: time attack tally is UGLY rn
if (modeattacking) if (modeattacking)
intertype = int_timeattack; intertype = int_timeattack;
else else
*/
intertype = int_race; intertype = int_race;
} }
else else
@ -1286,6 +1267,24 @@ void Y_StartIntermission(void)
case int_race: // (time-only race) case int_race: // (time-only race)
{ {
if ((!modifiedgame || savemoddata) && !multiplayer && !demoplayback) // remove this once we have a proper time attack screen
{
// setup time data
data.coop.tics = players[consoleplayer].realtime;
// Update visitation flags
mapvisited[gamemap-1] |= MV_BEATEN;
if (ALL7EMERALDS(emeralds))
mapvisited[gamemap-1] |= MV_ALLEMERALDS;
if (ultimatemode)
mapvisited[gamemap-1] |= MV_ULTIMATE;
if (data.coop.gotperfbonus)
mapvisited[gamemap-1] |= MV_PERFECT;
if (modeattacking == ATTACKING_RECORD)
Y_UpdateRecordReplays();
}
// Calculate who won // Calculate who won
Y_CalculateTournamentPoints(); Y_CalculateTournamentPoints();