mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-28 16:36:40 +00:00
Merge branch 'unsave' into 'master'
Drop support for saves made prior to 0.40 See merge request OpenMW/openmw!3645
This commit is contained in:
commit
7e3270abc9
9 changed files with 25 additions and 75 deletions
apps
components/esm3
|
@ -898,36 +898,27 @@ namespace MWWorld
|
|||
{
|
||||
if (ESM::REC_WTHR == type)
|
||||
{
|
||||
if (reader.getFormatVersion() <= ESM::MaxOldWeatherFormatVersion)
|
||||
ESM::WeatherState state;
|
||||
state.load(reader);
|
||||
|
||||
std::swap(mCurrentRegion, state.mCurrentRegion);
|
||||
mTimePassed = state.mTimePassed;
|
||||
mFastForward = state.mFastForward;
|
||||
mWeatherUpdateTime = state.mWeatherUpdateTime;
|
||||
mTransitionFactor = state.mTransitionFactor;
|
||||
mCurrentWeather = state.mCurrentWeather;
|
||||
mNextWeather = state.mNextWeather;
|
||||
mQueuedWeather = state.mQueuedWeather;
|
||||
|
||||
mRegions.clear();
|
||||
importRegions();
|
||||
|
||||
for (auto it = state.mRegions.begin(); it != state.mRegions.end(); ++it)
|
||||
{
|
||||
// Weather state isn't really all that important, so to preserve older save games, we'll just discard
|
||||
// the older weather records, rather than fail to handle the record.
|
||||
reader.skipRecord();
|
||||
}
|
||||
else
|
||||
{
|
||||
ESM::WeatherState state;
|
||||
state.load(reader);
|
||||
|
||||
std::swap(mCurrentRegion, state.mCurrentRegion);
|
||||
mTimePassed = state.mTimePassed;
|
||||
mFastForward = state.mFastForward;
|
||||
mWeatherUpdateTime = state.mWeatherUpdateTime;
|
||||
mTransitionFactor = state.mTransitionFactor;
|
||||
mCurrentWeather = state.mCurrentWeather;
|
||||
mNextWeather = state.mNextWeather;
|
||||
mQueuedWeather = state.mQueuedWeather;
|
||||
|
||||
mRegions.clear();
|
||||
importRegions();
|
||||
|
||||
for (auto it = state.mRegions.begin(); it != state.mRegions.end(); ++it)
|
||||
auto found = mRegions.find(it->first);
|
||||
if (found != mRegions.end())
|
||||
{
|
||||
auto found = mRegions.find(it->first);
|
||||
if (found != mRegions.end())
|
||||
{
|
||||
found->second = RegionWeather(it->second);
|
||||
}
|
||||
found->second = RegionWeather(it->second);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -270,8 +270,6 @@ namespace
|
|||
std::vector<ESM::FormatVersion> result({
|
||||
ESM::DefaultFormatVersion,
|
||||
ESM::CurrentContentFormatVersion,
|
||||
ESM::MaxOldWeatherFormatVersion,
|
||||
ESM::MaxOldDeathAnimationFormatVersion,
|
||||
ESM::MaxOldFogOfWarFormatVersion,
|
||||
ESM::MaxUnoptimizedCharacterDataFormatVersion,
|
||||
ESM::MaxOldTimeLeftFormatVersion,
|
||||
|
|
|
@ -21,18 +21,7 @@ namespace ESM
|
|||
anim.mGroup = esm.getHString();
|
||||
esm.getHNOT(anim.mTime, "TIME");
|
||||
esm.getHNOT(anim.mAbsolute, "ABST");
|
||||
|
||||
esm.getSubNameIs("COUN");
|
||||
// workaround bug in earlier version where size_t was used
|
||||
esm.getSubHeader();
|
||||
if (esm.getSubSize() == 8)
|
||||
esm.getT(anim.mLoopCount);
|
||||
else
|
||||
{
|
||||
uint32_t loopcount;
|
||||
esm.getT(loopcount);
|
||||
anim.mLoopCount = (uint64_t)loopcount;
|
||||
}
|
||||
esm.getHNT(anim.mLoopCount, "COUN");
|
||||
|
||||
mScriptedAnims.push_back(anim);
|
||||
}
|
||||
|
|
|
@ -42,15 +42,11 @@ namespace ESM
|
|||
{
|
||||
esm.getHNOT(mDead, "DEAD");
|
||||
esm.getHNOT(mDeathAnimationFinished, "DFNT");
|
||||
if (esm.getFormatVersion() <= MaxOldDeathAnimationFormatVersion && mDead)
|
||||
mDeathAnimationFinished = true;
|
||||
esm.getHNOT(mDied, "DIED");
|
||||
esm.getHNOT(mMurdered, "MURD");
|
||||
esm.getHNOT(mTalkedTo, "TALK");
|
||||
esm.getHNOT(mAlarmed, "ALRM");
|
||||
esm.getHNOT(mAttacked, "ATKD");
|
||||
if (esm.isNextSub("ATCK"))
|
||||
esm.skipHSub(); // attackingOrSpell, no longer used
|
||||
esm.getHNOT(mKnockdown, "KNCK");
|
||||
esm.getHNOT(mKnockdownOneFrame, "KNC1");
|
||||
esm.getHNOT(mKnockdownOverOneFrame, "KNCO");
|
||||
|
|
|
@ -9,8 +9,6 @@ namespace ESM
|
|||
|
||||
inline constexpr FormatVersion DefaultFormatVersion = 0;
|
||||
inline constexpr FormatVersion CurrentContentFormatVersion = 1;
|
||||
inline constexpr FormatVersion MaxOldWeatherFormatVersion = 1;
|
||||
inline constexpr FormatVersion MaxOldDeathAnimationFormatVersion = 2;
|
||||
inline constexpr FormatVersion MaxOldFogOfWarFormatVersion = 6;
|
||||
inline constexpr FormatVersion MaxUnoptimizedCharacterDataFormatVersion = 7;
|
||||
inline constexpr FormatVersion MaxOldTimeLeftFormatVersion = 8;
|
||||
|
@ -28,7 +26,7 @@ namespace ESM
|
|||
inline constexpr FormatVersion MaxActiveSpellSlotIndexFormatVersion = 27;
|
||||
inline constexpr FormatVersion CurrentSaveGameFormatVersion = 29;
|
||||
|
||||
inline constexpr FormatVersion MinSupportedSaveGameFormatVersion = 1;
|
||||
inline constexpr FormatVersion MinSupportedSaveGameFormatVersion = 4;
|
||||
inline constexpr FormatVersion OpenMW0_48SaveGameFormatVersion = 21;
|
||||
inline constexpr FormatVersion OpenMW0_49SaveGameFormatVersion = CurrentSaveGameFormatVersion;
|
||||
}
|
||||
|
|
|
@ -52,20 +52,17 @@ namespace ESM
|
|||
mItems.push_back(state);
|
||||
}
|
||||
|
||||
std::map<std::pair<ESM::RefId, std::string>, int32_t> levelledItemMap;
|
||||
// Next item is Levelled item
|
||||
while (esm.isNextSub("LEVM"))
|
||||
{
|
||||
// Get its name
|
||||
ESM::RefId id = esm.getRefId();
|
||||
int32_t count;
|
||||
std::string parentGroup;
|
||||
// Then get its count
|
||||
esm.getHNT(count, "COUN");
|
||||
// Old save formats don't have information about parent group; check for that
|
||||
if (esm.isNextSub("LGRP"))
|
||||
// Newest saves contain parent group
|
||||
parentGroup = esm.getHString();
|
||||
mLevelledItemMap[std::make_pair(id, parentGroup)] = count;
|
||||
std::string parentGroup = esm.getHNString("LGRP");
|
||||
levelledItemMap[std::make_pair(id, parentGroup)] = count;
|
||||
}
|
||||
|
||||
while (esm.isNextSub("MAGI"))
|
||||
|
@ -117,7 +114,7 @@ namespace ESM
|
|||
|
||||
// Old saves had restocking levelled items in a special map
|
||||
// This turns items from that map into negative quantities
|
||||
for (const auto& entry : mLevelledItemMap)
|
||||
for (const auto& entry : levelledItemMap)
|
||||
{
|
||||
const ESM::RefId& id = entry.first.first;
|
||||
const int count = entry.second;
|
||||
|
@ -141,13 +138,6 @@ namespace ESM
|
|||
}
|
||||
}
|
||||
|
||||
for (auto it = mLevelledItemMap.begin(); it != mLevelledItemMap.end(); ++it)
|
||||
{
|
||||
esm.writeHNRefId("LEVM", it->first.first);
|
||||
esm.writeHNT("COUN", it->second);
|
||||
esm.writeHNString("LGRP", it->first.second);
|
||||
}
|
||||
|
||||
for (const auto& [id, params] : mPermanentMagicEffectMagnitudes)
|
||||
{
|
||||
esm.writeHNRefId("MAGI", id);
|
||||
|
|
|
@ -22,8 +22,6 @@ namespace ESM
|
|||
// <Index in mItems, equipment slot>
|
||||
std::map<uint32_t, int32_t> mEquipmentSlots;
|
||||
|
||||
std::map<std::pair<ESM::RefId, std::string>, int32_t> mLevelledItemMap;
|
||||
|
||||
std::map<ESM::RefId, std::vector<std::pair<float, float>>> mPermanentMagicEffectMagnitudes;
|
||||
|
||||
std::optional<uint32_t> mSelectedEnchantItem; // For inventories only
|
||||
|
|
|
@ -42,9 +42,6 @@ namespace ESM
|
|||
else
|
||||
mPosition = mRef.mPos;
|
||||
|
||||
if (esm.isNextSub("LROT"))
|
||||
esm.skipHSub(); // local rotation, no longer used
|
||||
|
||||
mFlags = 0;
|
||||
esm.getHNOT(mFlags, "FLAG");
|
||||
|
||||
|
|
|
@ -37,18 +37,11 @@ namespace ESM
|
|||
BaseProjectileState::load(esm);
|
||||
|
||||
mSpellId = esm.getHNRefId("SPEL");
|
||||
if (esm.isNextSub("SRCN")) // for backwards compatibility
|
||||
esm.skipHSub();
|
||||
EffectList().load(esm); // for backwards compatibility
|
||||
esm.getHNT(mSpeed, "SPED");
|
||||
if (esm.peekNextSub("ITEM"))
|
||||
mItem = esm.getFormId(true, "ITEM");
|
||||
if (esm.isNextSub("SLOT")) // for backwards compatibility
|
||||
esm.skipHSub();
|
||||
if (esm.isNextSub("STCK")) // for backwards compatibility
|
||||
esm.skipHSub();
|
||||
if (esm.isNextSub("SOUN")) // for backwards compatibility
|
||||
esm.skipHSub();
|
||||
}
|
||||
|
||||
void ProjectileState::save(ESMWriter& esm) const
|
||||
|
|
Loading…
Reference in a new issue