diff --git a/src/g_game.cpp b/src/g_game.cpp index 5a4a51eec..3339a072d 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -2275,6 +2275,9 @@ static void PutSaveWads (FSerializer &arc) } } +EXTERN_CVAR(Bool, hud_showmonsters) +EXTERN_CVAR(Bool, hud_showitems) +EXTERN_CVAR(Bool, hud_showsecrets) static void PutSaveComment (FSerializer &arc) { int levelTime; @@ -2291,8 +2294,30 @@ static void PutSaveComment (FSerializer &arc) levelTime = primaryLevel->time / TICRATE; comment.AppendFormat("%s: %02d:%02d:%02d\n", time, levelTime/3600, (levelTime%3600)/60, levelTime%60); - // Append kills/items/secrets - comment.AppendFormat("K: %d/%d - I: %d/%d - S: %d/%d\n", primaryLevel->killed_monsters, primaryLevel->total_monsters, primaryLevel->found_items, primaryLevel->total_items, primaryLevel->found_secrets, primaryLevel->total_secrets); + // Append kills/items/secrets (only if visible on HUD to avoid spoiling levels) + bool hasStatOnLine = false; + if (hud_showmonsters) { + comment.AppendFormat("K: %d/%d", primaryLevel->killed_monsters, primaryLevel->total_monsters); + hasStatOnLine = true; + } + if (hud_showitems) { + if (hasStatOnLine) { + comment.AppendFormat(" - "); + } + comment.AppendFormat("I: %d/%d", primaryLevel->found_items, primaryLevel->total_items); + hasStatOnLine = true; + } + if (hud_showsecrets) { + if (hasStatOnLine) { + comment.AppendFormat(" - "); + } + comment.AppendFormat("S: %d/%d", primaryLevel->found_secrets, primaryLevel->total_secrets); + hasStatOnLine = true; + } + + if (hasStatOnLine) { + comment.AppendFormat("\n"); + } // Append player health and armor const char* const health = "Health";// GStrings("SAVECOMMENT_HEALTH");