1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 19:19:56 +00:00

Store camera first person state in savegame (Fixes #2255)

This commit is contained in:
scrawl 2015-01-06 19:29:33 +01:00
parent 992b87ea44
commit e19ab77d00
3 changed files with 18 additions and 2 deletions

View file

@ -355,6 +355,7 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
case ESM::REC_ENAB:
case ESM::REC_LEVC:
case ESM::REC_LEVI:
case ESM::REC_CAM_:
MWBase::Environment::get().getWorld()->readRecord (reader, n.val, contentFileMap);
break;
@ -406,6 +407,8 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
// Use detectWorldSpaceChange=false, otherwise some of the data we just loaded would be cleared again
MWBase::Environment::get().getWorld()->changeToCell (cellId, ptr.getRefData().getPosition(), false);
// Vanilla MW will restart startup scripts when a save game is loaded. This is unintuive,
// but some mods may be using it as a reload detector.
MWBase::Environment::get().getScriptManager()->getGlobalScripts().addStartup();
// Do not trigger erroneous cellChanged events

View file

@ -201,6 +201,7 @@ namespace MWWorld
setupPlayer();
renderPlayer();
mRendering->resetCamera();
MWBase::Environment::get().getWindowManager()->updatePlayer();
@ -304,7 +305,8 @@ namespace MWWorld
+1 // player record
+1 // weather record
+1 // actorId counter
+1; // levitation/teleport enabled state
+1 // levitation/teleport enabled state
+1; // camera
}
void World::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
@ -333,6 +335,11 @@ namespace MWWorld
writer.writeHNT("LEVT", mLevitationEnabled);
writer.endRecord(ESM::REC_ENAB);
progress.increaseProgress();
writer.startRecord(ESM::REC_CAM_);
writer.writeHNT("FIRS", isFirstPerson());
writer.endRecord(ESM::REC_CAM_);
progress.increaseProgress();
}
void World::readRecord (ESM::ESMReader& reader, int32_t type,
@ -347,6 +354,12 @@ namespace MWWorld
reader.getHNT(mTeleportEnabled, "TELE");
reader.getHNT(mLevitationEnabled, "LEVT");
return;
case ESM::REC_CAM_:
bool firstperson;
reader.getHNT(firstperson, "FIRS");
if (firstperson != isFirstPerson())
togglePOV();
break;
default:
if (!mStore.readRecord (reader, type) &&
!mGlobalVariables.readRecord (reader, type) &&
@ -2073,7 +2086,6 @@ namespace MWWorld
MWBase::Environment::get().getMechanicsManager()->add(mPlayer->getPlayer());
mPhysics->addActor(mPlayer->getPlayer());
mRendering->resetCamera();
}
int World::canRest ()

View file

@ -114,6 +114,7 @@ enum RecNameInts
REC_DCOU = FourCC<'D','C','O','U'>::value,
REC_MARK = FourCC<'M','A','R','K'>::value,
REC_ENAB = FourCC<'E','N','A','B'>::value,
REC_CAM_ = FourCC<'C','A','M','_'>::value,
// format 1
REC_FILT = 0x544C4946,