* Fixed the Mode Attack cv_nextmap issue Salt found.

* Improved the defaulting system to work cross-gametype.
* Cleaned up the code. Less hacks!
This commit is contained in:
toasterbabe 2017-02-05 21:20:32 +00:00
parent 3aa7573c86
commit d670189c89
5 changed files with 15 additions and 15 deletions

View File

@ -1532,7 +1532,8 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese
// The supplied data are assumed to be good.
I_Assert(delay >= 0 && delay <= 2);
CV_SetValue(&cv_nextmap, mapnum);
if (mapnum != -1)
CV_SetValue(&cv_nextmap, mapnum);
CONS_Debug(DBG_GAMELOGIC, "Map change: mapnum=%d gametype=%d ultmode=%d resetplayers=%d delay=%d skipprecutscene=%d\n",
mapnum, newgametype, pultmode, resetplayers, delay, skipprecutscene);

View File

@ -697,8 +697,7 @@ void G_SetNightsRecords(void)
free(gpath);
// If the mare count changed, this will update the score display
CV_AddValue(&cv_nextmap, 1);
CV_AddValue(&cv_nextmap, -1);
Nextmap_OnChange();
}
// for consistency among messages: this modifies the game and removes savemoddata.

View File

@ -377,7 +377,6 @@ static void M_HandleFogColor(INT32 choice);
static void M_HandleVideoMode(INT32 choice);
// Consvar onchange functions
static void Nextmap_OnChange(void);
static void Newgametype_OnChange(void);
static void Dummymares_OnChange(void);
@ -1850,8 +1849,8 @@ menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOp
// Prototypes
static INT32 M_GetFirstLevelInList(INT32 gt);
// Nextmap. Used for Time Attack.
static void Nextmap_OnChange(void)
// Nextmap. Used for Level select.
void Nextmap_OnChange(void)
{
char *leveltitle;
char tabase[256];
@ -6303,8 +6302,7 @@ static void M_EraseGuest(INT32 choice)
M_SetupNextMenu(&SP_NightsAttackDef);
else
M_SetupNextMenu(&SP_TimeAttackDef);
CV_AddValue(&cv_nextmap, -1);
CV_AddValue(&cv_nextmap, 1);
Nextmap_OnChange();
M_StartMessage(M_GetText("Guest replay data erased.\n"),NULL,MM_NOTHING);
}
@ -6330,8 +6328,7 @@ static void M_OverwriteGuest(const char *which, boolean nights)
M_SetupNextMenu(&SP_NightsAttackDef);
else
M_SetupNextMenu(&SP_TimeAttackDef);
CV_AddValue(&cv_nextmap, -1);
CV_AddValue(&cv_nextmap, 1);
Nextmap_OnChange();
M_StartMessage(M_GetText("Guest replay data saved.\n"),NULL,MM_NOTHING);
}
@ -6422,9 +6419,7 @@ static void M_ModeAttackEndGame(INT32 choice)
G_SetGamestate(GS_TIMEATTACK);
modeattacking = ATTACKING_NONE;
S_ChangeMusicInternal("_inter", true);
// Update replay availability.
CV_AddValue(&cv_nextmap, 1);
CV_AddValue(&cv_nextmap, -1);
Nextmap_OnChange();
}
// ========
@ -6897,6 +6892,9 @@ static void M_MapChange(INT32 choice)
CV_SetValue(&cv_newgametype, choice);
if (Playing() && !(M_CanShowLevelOnPlatter(cv_nextmap.value-1, choice)) && (M_CanShowLevelOnPlatter(gamemap-1, choice)))
CV_SetValue(&cv_nextmap, gamemap);
if (!M_PrepareLevelPlatter(choice))
{
M_StartMessage(M_GetText("No selectable levels found.\n"),NULL,MM_NOTHING);

View File

@ -238,6 +238,9 @@ void M_ForceSaveSlotSelected(INT32 sslot);
void M_CheatActivationResponder(INT32 ch);
// Level select updating
void Nextmap_OnChange(void);
// Screenshot menu updating
void Moviemode_mode_Onchange(void);
void Screenshot_option_Onchange(void);

View File

@ -900,8 +900,7 @@ static void Y_UpdateRecordReplays(void)
CONS_Printf(M_GetText("\x82" "Earned %hu emblem%s for Record Attack records.\n"), (UINT16)earnedEmblems, earnedEmblems > 1 ? "s" : "");
// Update timeattack menu's replay availability.
CV_AddValue(&cv_nextmap, 1);
CV_AddValue(&cv_nextmap, -1);
Nextmap_OnChange();
}
//