mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 22:00:48 +00:00
Store kills/items/secrets in save comment only if visible on HUD
This prevents spoiling levels when the HUD information is disabled. This change is not retroactive: it has no effect on existing savegames. You need to save again for this change to have an effect.
This commit is contained in:
parent
5870ec2e7a
commit
ffcfec66b3
1 changed files with 27 additions and 2 deletions
|
@ -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)
|
static void PutSaveComment (FSerializer &arc)
|
||||||
{
|
{
|
||||||
int levelTime;
|
int levelTime;
|
||||||
|
@ -2291,8 +2294,30 @@ static void PutSaveComment (FSerializer &arc)
|
||||||
levelTime = primaryLevel->time / TICRATE;
|
levelTime = primaryLevel->time / TICRATE;
|
||||||
comment.AppendFormat("%s: %02d:%02d:%02d\n", time, levelTime/3600, (levelTime%3600)/60, levelTime%60);
|
comment.AppendFormat("%s: %02d:%02d:%02d\n", time, levelTime/3600, (levelTime%3600)/60, levelTime%60);
|
||||||
|
|
||||||
// Append kills/items/secrets
|
// Append kills/items/secrets (only if visible on HUD to avoid spoiling levels)
|
||||||
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);
|
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
|
// Append player health and armor
|
||||||
const char* const health = "Health";// GStrings("SAVECOMMENT_HEALTH");
|
const char* const health = "Health";// GStrings("SAVECOMMENT_HEALTH");
|
||||||
|
|
Loading…
Reference in a new issue