mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-13 06:13:18 +00:00
Address compat with old-style names
This commit is contained in:
parent
3f3ff0688b
commit
e641895268
2 changed files with 43 additions and 1 deletions
41
src/m_menu.c
41
src/m_menu.c
|
@ -2276,6 +2276,9 @@ void Nextmap_OnChange(void)
|
||||||
{
|
{
|
||||||
char *leveltitle;
|
char *leveltitle;
|
||||||
char tabase[256];
|
char tabase[256];
|
||||||
|
#ifdef OLDNREPLAYNAME
|
||||||
|
char tabaseold[256];
|
||||||
|
#endif
|
||||||
short i;
|
short i;
|
||||||
boolean active;
|
boolean active;
|
||||||
|
|
||||||
|
@ -2301,10 +2304,16 @@ 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), skins[cv_chooseskin.value-1].name);
|
sprintf(tabase,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1].name);
|
||||||
|
|
||||||
|
#ifdef OLDNREPLAYNAME
|
||||||
|
sprintf(tabaseold,"%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s",srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value));
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
SP_NightsReplayMenu[i].status = IT_DISABLED;
|
SP_NightsReplayMenu[i].status = IT_DISABLED;
|
||||||
SP_NightsGuestReplayMenu[i].status = IT_DISABLED;
|
SP_NightsGuestReplayMenu[i].status = IT_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FIL_FileExists(va("%s-score-best.lmp", tabase))) {
|
if (FIL_FileExists(va("%s-score-best.lmp", tabase))) {
|
||||||
SP_NightsReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
|
SP_NightsReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
|
||||||
SP_NightsGuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
|
SP_NightsGuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
|
||||||
|
@ -2325,11 +2334,32 @@ void Nextmap_OnChange(void)
|
||||||
SP_NightsGuestReplayMenu[3].status = IT_WHITESTRING|IT_CALL;
|
SP_NightsGuestReplayMenu[3].status = IT_WHITESTRING|IT_CALL;
|
||||||
active = true;
|
active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Old style name compatibility
|
||||||
|
#ifdef OLDNREPLAYNAME
|
||||||
|
if (FIL_FileExists(va("%s-score-best.lmp", tabaseold))) {
|
||||||
|
SP_NightsReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
|
||||||
|
SP_NightsGuestReplayMenu[0].status = IT_WHITESTRING|IT_CALL;
|
||||||
|
active = true;
|
||||||
|
}
|
||||||
|
if (FIL_FileExists(va("%s-time-best.lmp", tabaseold))) {
|
||||||
|
SP_NightsReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
|
||||||
|
SP_NightsGuestReplayMenu[1].status = IT_WHITESTRING|IT_CALL;
|
||||||
|
active = true;
|
||||||
|
}
|
||||||
|
if (FIL_FileExists(va("%s-last.lmp", tabaseold))) {
|
||||||
|
SP_NightsReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
|
||||||
|
SP_NightsGuestReplayMenu[2].status = IT_WHITESTRING|IT_CALL;
|
||||||
|
active = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (active) {
|
if (active) {
|
||||||
SP_NightsAttackMenu[naguest].status = IT_WHITESTRING|IT_SUBMENU;
|
SP_NightsAttackMenu[naguest].status = IT_WHITESTRING|IT_SUBMENU;
|
||||||
SP_NightsAttackMenu[nareplay].status = IT_WHITESTRING|IT_SUBMENU;
|
SP_NightsAttackMenu[nareplay].status = IT_WHITESTRING|IT_SUBMENU;
|
||||||
SP_NightsAttackMenu[naghost].status = IT_WHITESTRING|IT_SUBMENU;
|
SP_NightsAttackMenu[naghost].status = IT_WHITESTRING|IT_SUBMENU;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(itemOn == nareplay) // Reset lastOn so replay isn't still selected when not available.
|
else if(itemOn == nareplay) // Reset lastOn so replay isn't still selected when not available.
|
||||||
{
|
{
|
||||||
currentMenu->lastOn = itemOn;
|
currentMenu->lastOn = itemOn;
|
||||||
|
@ -10185,6 +10215,7 @@ static void M_ChooseTimeAttack(INT32 choice)
|
||||||
static void M_ReplayTimeAttack(INT32 choice)
|
static void M_ReplayTimeAttack(INT32 choice)
|
||||||
{
|
{
|
||||||
const char *which;
|
const char *which;
|
||||||
|
char *demoname;
|
||||||
M_ClearMenus(true);
|
M_ClearMenus(true);
|
||||||
modeattacking = ATTACKING_RECORD; // set modeattacking before G_DoPlayDemo so the map loader knows
|
modeattacking = ATTACKING_RECORD; // set modeattacking before G_DoPlayDemo so the map loader knows
|
||||||
|
|
||||||
|
@ -10229,7 +10260,15 @@ static void M_ReplayTimeAttack(INT32 choice)
|
||||||
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;
|
||||||
}
|
}
|
||||||
G_DoPlayDemo(va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1].name, which));
|
|
||||||
|
demoname = va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), skins[cv_chooseskin.value-1].name, which);
|
||||||
|
|
||||||
|
#ifdef OLDNREPLAYNAME // Check for old style named NiGHTS replay, since the new style replay doesn't exist.
|
||||||
|
if (!FIL_FileExists(demoname))
|
||||||
|
demoname = va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-%s.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value), which);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
G_DoPlayDemo(demoname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
#include "r_skins.h" // for SKINNAMESIZE
|
#include "r_skins.h" // for SKINNAMESIZE
|
||||||
#include "f_finale.h" // for ttmode_enum
|
#include "f_finale.h" // for ttmode_enum
|
||||||
|
|
||||||
|
// Compatibility with old-style named NiGHTS replay files.
|
||||||
|
#define OLDNREPLAYNAME
|
||||||
|
|
||||||
//
|
//
|
||||||
// MENUS
|
// MENUS
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue