Death/godmode fixes: Revive player *after* character update, since there might be fall damage.

actorid
scrawl 11 years ago
parent 9c0ed69550
commit 28185e2017

@ -89,6 +89,8 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
if (mUseSound)
MWBase::Environment::get().getSoundManager()->update(frametime);
bool paused = MWBase::Environment::get().getWindowManager()->isGuiMode();
if (MWBase::Environment::get().getStateManager()->getState()==
MWBase::StateManager::State_Running)
{
@ -105,7 +107,7 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
if (changed) // keep change flag for another frame, if cell changed happened in local script
MWBase::Environment::get().getWorld()->markCellAsUnchanged();
if (!MWBase::Environment::get().getWindowManager()->isGuiMode())
if (!paused)
MWBase::Environment::get().getWorld()->advanceTime(
frametime*MWBase::Environment::get().getWorld()->getTimeScaleFactor()/3600);
@ -116,18 +118,18 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
// update actors
MWBase::Environment::get().getMechanicsManager()->update(frametime,
MWBase::Environment::get().getWindowManager()->isGuiMode());
paused);
if (MWBase::Environment::get().getStateManager()->getState()==
MWBase::StateManager::State_Running)
{
MWWorld::Ptr player = mEnvironment.getWorld()->getPlayer().getPlayer();
if(MWWorld::Class::get(player).getCreatureStats(player).isDead())
MWWorld::Ptr player = mEnvironment.getWorld()->getPlayerPtr();
if(!paused && player.getClass().getCreatureStats(player).isDead())
MWBase::Environment::get().getStateManager()->endGame();
}
// update world
MWBase::Environment::get().getWorld()->update(frametime, MWBase::Environment::get().getWindowManager()->isGuiMode());
MWBase::Environment::get().getWorld()->update(frametime, paused);
// update GUI
Ogre::RenderWindow* window = mOgre->getWindow();

@ -771,6 +771,24 @@ namespace MWMechanics
void Actors::update (float duration, bool paused)
{
if(!paused)
{
// Note: we need to do this before any of the animations are updated.
// Reaching the text keys may trigger Hit / Spellcast (and as such, particles),
// so updating VFX immediately after that would just remove the particle effects instantly.
// There needs to be a magic effect update in between.
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter)
iter->second->updateContinuousVfx();
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter)
{
if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects().get(
ESM::MagicEffect::Paralyze).mMagnitude > 0)
iter->second->skipAnim();
iter->second->update(duration);
}
}
if (!paused)
{
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();iter++)
@ -804,7 +822,6 @@ namespace MWMechanics
stat.setModified(1, 0);
stats.setHealth(stat);
}
stats.resurrect();
continue;
}
@ -818,6 +835,9 @@ namespace MWMechanics
spells.purge(iter->first.getRefData().getHandle());
}
// FIXME: see http://bugs.openmw.org/issues/869
MWBase::Environment::get().getWorld()->enableActorCollision(iter->first, false);
if (iter->second->kill())
{
++mDeathCount[cls.getId(iter->first)];
@ -839,24 +859,6 @@ namespace MWMechanics
}
}
}
if(!paused)
{
// Note: we need to do this before any of the animations are updated.
// Reaching the text keys may trigger Hit / Spellcast (and as such, particles),
// so updating VFX immediately after that would just remove the particle effects instantly.
// There needs to be a magic effect update in between.
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter)
iter->second->updateContinuousVfx();
for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter)
{
if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects().get(
ESM::MagicEffect::Paralyze).mMagnitude > 0)
iter->second->skipAnim();
iter->second->update(duration);
}
}
}
void Actors::restoreDynamicStats(bool sleep)
{

@ -1153,7 +1153,6 @@ void CharacterController::update(float duration)
}
else if(cls.getCreatureStats(mPtr).isDead())
{
MWBase::Environment::get().getWorld()->enableActorCollision(mPtr, false);
world->queueMovement(mPtr, Ogre::Vector3(0.0f));
}

Loading…
Cancel
Save