mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 20:29:57 +00:00
Add additional fields to save metadata (feature 7618)
This commit is contained in:
parent
08ff69f199
commit
fc74cc49dd
6 changed files with 26 additions and 1 deletions
|
@ -103,6 +103,7 @@
|
||||||
Feature #7499: OpenMW-CS: Generate record filters by drag & dropping cell content to the filters field
|
Feature #7499: OpenMW-CS: Generate record filters by drag & dropping cell content to the filters field
|
||||||
Feature #7546: Start the game on Fredas
|
Feature #7546: Start the game on Fredas
|
||||||
Feature #7568: Uninterruptable scripted music
|
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 #5896: Do not use deprecated MyGUI properties
|
||||||
Task #7113: Move from std::atoi to std::from_char
|
Task #7113: Move from std::atoi to std::from_char
|
||||||
Task #7117: Replace boost::scoped_array with std::vector
|
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";
|
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 << "#{sLevel} " << mCurrentSlot->mProfile.mPlayerLevel << "\n";
|
||||||
text << "#{sCell=" << mCurrentSlot->mProfile.mPlayerCellName << "}\n";
|
text << "#{sCell=" << mCurrentSlot->mProfile.mPlayerCellName << "}\n";
|
||||||
|
|
||||||
|
@ -422,6 +426,9 @@ namespace MWGui
|
||||||
if (hour == 0)
|
if (hour == 0)
|
||||||
hour = 12;
|
hour = 12;
|
||||||
|
|
||||||
|
if (mCurrentSlot->mProfile.mCurrentDay > 0)
|
||||||
|
text << "#{Calendar:day} " << mCurrentSlot->mProfile.mCurrentDay << "\n";
|
||||||
|
|
||||||
text << mCurrentSlot->mProfile.mInGameTime.mDay << " "
|
text << mCurrentSlot->mProfile.mInGameTime.mDay << " "
|
||||||
<< MWBase::Environment::get().getWorld()->getTimeManager()->getMonthName(
|
<< MWBase::Environment::get().getWorld()->getTimeManager()->getMonthName(
|
||||||
mCurrentSlot->mProfile.mInGameTime.mMonth)
|
mCurrentSlot->mProfile.mInGameTime.mMonth)
|
||||||
|
|
|
@ -227,10 +227,15 @@ void MWState::StateManager::saveGame(std::string_view description, const Slot* s
|
||||||
else
|
else
|
||||||
profile.mPlayerClassId = classId;
|
profile.mPlayerClassId = classId;
|
||||||
|
|
||||||
|
const MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||||
|
|
||||||
profile.mPlayerCellName = world.getCellName();
|
profile.mPlayerCellName = world.getCellName();
|
||||||
profile.mInGameTime = world.getTimeManager()->getEpochTimeStamp();
|
profile.mInGameTime = world.getTimeManager()->getEpochTimeStamp();
|
||||||
profile.mTimePlayed = mTimePlayed;
|
profile.mTimePlayed = mTimePlayed;
|
||||||
profile.mDescription = description;
|
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 << "'";
|
Log(Debug::Info) << "Making a screenshot for saved game '" << description << "'";
|
||||||
writeScreenshot(profile.mScreenshot);
|
writeScreenshot(profile.mScreenshot);
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace ESM
|
||||||
inline constexpr FormatVersion MaxNameIsRefIdOnlyFormatVersion = 25;
|
inline constexpr FormatVersion MaxNameIsRefIdOnlyFormatVersion = 25;
|
||||||
inline constexpr FormatVersion MaxUseEsmCellIdFormatVersion = 26;
|
inline constexpr FormatVersion MaxUseEsmCellIdFormatVersion = 26;
|
||||||
inline constexpr FormatVersion MaxActiveSpellSlotIndexFormatVersion = 27;
|
inline constexpr FormatVersion MaxActiveSpellSlotIndexFormatVersion = 27;
|
||||||
inline constexpr FormatVersion CurrentSaveGameFormatVersion = 28;
|
inline constexpr FormatVersion CurrentSaveGameFormatVersion = 29;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,6 +28,10 @@ namespace ESM
|
||||||
esm.getSubHeader();
|
esm.getSubHeader();
|
||||||
mScreenshot.resize(esm.getSubSize());
|
mScreenshot.resize(esm.getSubSize());
|
||||||
esm.getExact(mScreenshot.data(), mScreenshot.size());
|
esm.getExact(mScreenshot.data(), mScreenshot.size());
|
||||||
|
|
||||||
|
esm.getHNOT(mCurrentDay, "CDAY");
|
||||||
|
esm.getHNOT(mCurrentHealth, "CHLT");
|
||||||
|
esm.getHNOT(mMaximumHealth, "MHLT");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SavedGame::save(ESMWriter& esm) const
|
void SavedGame::save(ESMWriter& esm) const
|
||||||
|
@ -51,6 +55,10 @@ namespace ESM
|
||||||
esm.startSubRecord("SCRN");
|
esm.startSubRecord("SCRN");
|
||||||
esm.write(mScreenshot.data(), mScreenshot.size());
|
esm.write(mScreenshot.data(), mScreenshot.size());
|
||||||
esm.endRecord("SCRN");
|
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::string mDescription;
|
||||||
std::vector<char> mScreenshot; // raw jpg-encoded data
|
std::vector<char> mScreenshot; // raw jpg-encoded data
|
||||||
|
|
||||||
|
int mCurrentDay = 0;
|
||||||
|
float mCurrentHealth = 0;
|
||||||
|
float mMaximumHealth = 0;
|
||||||
|
|
||||||
void load(ESMReader& esm);
|
void load(ESMReader& esm);
|
||||||
void save(ESMWriter& esm) const;
|
void save(ESMWriter& esm) const;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue