diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d3d13a5d4..5bbc5b5b1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,6 +106,7 @@ Feature #7499: OpenMW-CS: Generate record filters by drag & dropping cell content to the filters field Feature #7546: Start the game on Fredas Feature #7568: Uninterruptable scripted music + Feature #7618: Show the player character's health in the save details Task #5896: Do not use deprecated MyGUI properties Task #7113: Move from std::atoi to std::from_char Task #7117: Replace boost::scoped_array with std::vector diff --git a/apps/openmw/mwgui/savegamedialog.cpp b/apps/openmw/mwgui/savegamedialog.cpp index 0d754f71e5..63e4fbc5cc 100644 --- a/apps/openmw/mwgui/savegamedialog.cpp +++ b/apps/openmw/mwgui/savegamedialog.cpp @@ -412,6 +412,10 @@ namespace MWGui text << Misc::fileTimeToString(mCurrentSlot->mTimeStamp, "%Y.%m.%d %T") << "\n"; + if (mCurrentSlot->mProfile.mMaximumHealth > 0) + text << std::fixed << std::setprecision(0) << "#{sHealth} " << mCurrentSlot->mProfile.mCurrentHealth << "/" + << mCurrentSlot->mProfile.mMaximumHealth << "\n"; + text << "#{sLevel} " << mCurrentSlot->mProfile.mPlayerLevel << "\n"; text << "#{sCell=" << mCurrentSlot->mProfile.mPlayerCellName << "}\n"; @@ -422,6 +426,9 @@ namespace MWGui if (hour == 0) hour = 12; + if (mCurrentSlot->mProfile.mCurrentDay > 0) + text << "#{Calendar:day} " << mCurrentSlot->mProfile.mCurrentDay << "\n"; + text << mCurrentSlot->mProfile.mInGameTime.mDay << " " << MWBase::Environment::get().getWorld()->getTimeManager()->getMonthName( mCurrentSlot->mProfile.mInGameTime.mMonth) diff --git a/apps/openmw/mwstate/statemanagerimp.cpp b/apps/openmw/mwstate/statemanagerimp.cpp index 6b09b37964..fb3590a3f0 100644 --- a/apps/openmw/mwstate/statemanagerimp.cpp +++ b/apps/openmw/mwstate/statemanagerimp.cpp @@ -227,10 +227,15 @@ void MWState::StateManager::saveGame(std::string_view description, const Slot* s else profile.mPlayerClassId = classId; + const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); + profile.mPlayerCellName = world.getCellName(); profile.mInGameTime = world.getTimeManager()->getEpochTimeStamp(); profile.mTimePlayed = mTimePlayed; profile.mDescription = description; + profile.mCurrentDay = world.getTimeManager()->getTimeStamp().getDay(); + profile.mCurrentHealth = stats.getHealth().getCurrent(); + profile.mMaximumHealth = stats.getHealth().getModified(); Log(Debug::Info) << "Making a screenshot for saved game '" << description << "'"; writeScreenshot(profile.mScreenshot); diff --git a/components/esm3/formatversion.hpp b/components/esm3/formatversion.hpp index 644298b00d..12a73fc12b 100644 --- a/components/esm3/formatversion.hpp +++ b/components/esm3/formatversion.hpp @@ -25,7 +25,7 @@ namespace ESM inline constexpr FormatVersion MaxNameIsRefIdOnlyFormatVersion = 25; inline constexpr FormatVersion MaxUseEsmCellIdFormatVersion = 26; inline constexpr FormatVersion MaxActiveSpellSlotIndexFormatVersion = 27; - inline constexpr FormatVersion CurrentSaveGameFormatVersion = 28; + inline constexpr FormatVersion CurrentSaveGameFormatVersion = 29; } #endif diff --git a/components/esm3/savedgame.cpp b/components/esm3/savedgame.cpp index 6652179ea9..e84cb27ad8 100644 --- a/components/esm3/savedgame.cpp +++ b/components/esm3/savedgame.cpp @@ -28,6 +28,10 @@ namespace ESM esm.getSubHeader(); mScreenshot.resize(esm.getSubSize()); esm.getExact(mScreenshot.data(), mScreenshot.size()); + + esm.getHNOT(mCurrentDay, "CDAY"); + esm.getHNOT(mCurrentHealth, "CHLT"); + esm.getHNOT(mMaximumHealth, "MHLT"); } void SavedGame::save(ESMWriter& esm) const @@ -51,6 +55,10 @@ namespace ESM esm.startSubRecord("SCRN"); esm.write(mScreenshot.data(), mScreenshot.size()); esm.endRecord("SCRN"); + + esm.writeHNT("CDAY", mCurrentDay); + esm.writeHNT("CHLT", mCurrentHealth); + esm.writeHNT("MHLT", mMaximumHealth); } } diff --git a/components/esm3/savedgame.hpp b/components/esm3/savedgame.hpp index 0777b2498b..2048244ac2 100644 --- a/components/esm3/savedgame.hpp +++ b/components/esm3/savedgame.hpp @@ -34,6 +34,10 @@ namespace ESM std::string mDescription; std::vector mScreenshot; // raw jpg-encoded data + int mCurrentDay = 0; + float mCurrentHealth = 0; + float mMaximumHealth = 0; + void load(ESMReader& esm); void save(ESMWriter& esm) const; };