Add additional fields to save metadata (feature 7618)

macos_ci_fix
Andrei Kortunov 7 months ago
parent 08ff69f199
commit fc74cc49dd

@ -103,6 +103,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

@ -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)

@ -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);

@ -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

@ -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);
}
}

@ -34,6 +34,10 @@ namespace ESM
std::string mDescription;
std::vector<char> mScreenshot; // raw jpg-encoded data
int mCurrentDay = 0;
float mCurrentHealth = 0;
float mMaximumHealth = 0;
void load(ESMReader& esm);
void save(ESMWriter& esm) const;
};

Loading…
Cancel
Save