mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
Add more information in saved game comments
Save games now store kills/items/secrets and player health/armor in the comment string, which is displayed in the save/load game menu. This change is not retroactive: old savegames will not display this information until they are overwritten.
This commit is contained in:
parent
bd4f4f739a
commit
56c2bd018d
1 changed files with 19 additions and 1 deletions
|
@ -2289,7 +2289,25 @@ static void PutSaveComment (FSerializer &arc)
|
|||
// Append elapsed time
|
||||
const char *const time = GStrings("SAVECOMMENT_TIME");
|
||||
levelTime = primaryLevel->time / TICRATE;
|
||||
comment.AppendFormat("%s: %02d:%02d:%02d", 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
|
||||
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 player health and armor
|
||||
const char *const health = GStrings("SAVECOMMENT_HEALTH");
|
||||
const char *const armor = GStrings("SAVECOMMENT_ARMOR");
|
||||
int armorAmount = 0;
|
||||
auto basicArmorItem = primaryLevel->Players[consoleplayer]->mo->FindInventory(NAME_BasicArmor);
|
||||
if (basicArmorItem) {
|
||||
armorAmount += basicArmorItem->IntVar(NAME_Amount);
|
||||
}
|
||||
auto hexenArmorItem = primaryLevel->Players[consoleplayer]->mo->FindInventory(NAME_HexenArmor);
|
||||
if (hexenArmorItem) {
|
||||
double *Slots = (double*)hexenArmorItem->ScriptVar(NAME_Slots, nullptr);
|
||||
armorAmount += Slots[0] + Slots[1] + Slots[2] + Slots[3] + Slots[4];
|
||||
}
|
||||
comment.AppendFormat("%s: %d - %s: %d", health, primaryLevel->Players[consoleplayer]->mo->health, armor, armorAmount);
|
||||
|
||||
// Write out the comment
|
||||
arc.AddString("Comment", comment);
|
||||
|
|
Loading…
Reference in a new issue