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

View File

@ -120,7 +120,7 @@ void G_BeginRecording(void);
void G_BeginMetal(void);
// 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);
typedef enum

View File

@ -1038,30 +1038,28 @@ static void HU_drawGametype(void)
//
UINT32 hu_demoscore;
UINT32 hu_demotime;
UINT16 hu_demorings;
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)
{
V_DrawString(4, 188-16, V_YELLOWMAP|V_MONOSPACE, "SCORE:");
V_DrawRightAlignedString(120, 188-16, V_MONOSPACE, va("%d", hu_demoscore));
if (modeattacking == ATTACKING_NIGHTS)
{
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)
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_TicsToSeconds(hu_demotime),
G_TicsToCentiseconds(hu_demotime)));
else
V_DrawRightAlignedString(120, 188- 8, 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));
}
V_DrawRightAlignedString(120, 188- timeoffset, V_MONOSPACE, "--:--.--");
}
}

View File

@ -111,14 +111,14 @@ const char *quitmsg[NUM_QUITMESSAGES];
// Stuff for customizing the player select screen Tails 09-22-2003
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"},
{"\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"},
{"\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"},
{"\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"},
{"???", "", ""},
{"???", "", ""},
{"???", "", ""},
{"???", "", ""},
{"\x82Sonic\x80", "", "sonic"},
{"\x82Tails\x80", "", "tails"},
{"\x82Knuckles\x80", "", "knuckles"},
{"\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[] =
{
{IT_WHITESTRING|IT_CALL, NULL, "Replay Best Score", M_ReplayTimeAttack, 0},
{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 Best Time", M_ReplayTimeAttack, 16},
{IT_WHITESTRING|IT_CALL, NULL, "Replay Last", M_ReplayTimeAttack,29},
{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
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_GuestReplayMenu[i].status = IT_DISABLED;
}
@ -1838,26 +1836,16 @@ static void Nextmap_OnChange(void)
SP_GuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
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_GuestReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
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_GuestReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
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) {
SP_TimeAttackMenu[taguest].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) {
default:
case 0: // best score
which = "score-best";
break;
case 1: // best time
case 0: // best time
which = "time-best";
break;
case 2: // best rings
which = "rings-best";
break;
case 3: // last
case 1: // last
which = "last";
break;
case 4: // guest
/*case 2: // best staff
which = "staff-best";
break;*/
case 2: // guest
// 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)));
return;
@ -5621,6 +5606,9 @@ static void M_ReplayTimeAttack(INT32 choice)
case 2: // last
which = "last";
break;
/*case 3: // best staff
which = "staff-best";
break;*/
case 3: // guest
which = "guest";
break;

View File

@ -846,7 +846,10 @@ void Y_Ticker(void)
if (r)
S_StartSound(NULL, sfx_menu1);
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
{
@ -883,19 +886,13 @@ static void Y_UpdateRecordReplays(void)
if (!mainrecords[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))
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!
bestdemo[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();
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);
}
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);
Z_Free(buf);
@ -980,9 +959,11 @@ void Y_StartIntermission(void)
else
intertype = (maptol & TOL_NIGHTS) ? int_nights : int_coop;
*/
/* // srb2kart: time attack tally is UGLY rn
if (modeattacking)
intertype = int_timeattack;
else
*/
intertype = int_race;
}
else
@ -1286,6 +1267,24 @@ void Y_StartIntermission(void)
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
Y_CalculateTournamentPoints();