mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 06:35:30 +00:00
reworked http://bugs.openmw.org/issues/428
This commit is contained in:
parent
fd9f8c34f6
commit
f50ff0b1c4
@ -94,35 +94,39 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
||||
MWBase::Environment::get().getSoundManager()->update(frametime);
|
||||
|
||||
// global scripts
|
||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().run();
|
||||
|
||||
bool changed = MWBase::Environment::get().getWorld()->hasCellChanged();
|
||||
|
||||
// local scripts
|
||||
executeLocalScripts(); // This does not handle the case where a global script causes a
|
||||
// cell change, followed by a cell change in a local script during
|
||||
// the same frame.
|
||||
|
||||
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())
|
||||
MWBase::Environment::get().getWorld()->advanceTime(
|
||||
frametime*MWBase::Environment::get().getWorld()->getTimeScaleFactor()/3600);
|
||||
|
||||
// update actors
|
||||
MWBase::Environment::get().getMechanicsManager()->update(frametime,
|
||||
MWBase::Environment::get().getWindowManager()->isGuiMode());
|
||||
|
||||
if (MWBase::Environment::get().getStateManager()->getState()==
|
||||
MWBase::StateManager::State_Running)
|
||||
{
|
||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().run();
|
||||
|
||||
bool changed = MWBase::Environment::get().getWorld()->hasCellChanged();
|
||||
|
||||
// local scripts
|
||||
executeLocalScripts(); // This does not handle the case where a global script causes a
|
||||
// cell change, followed by a cell change in a local script during
|
||||
// the same frame.
|
||||
|
||||
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())
|
||||
MWBase::Environment::get().getWorld()->advanceTime(
|
||||
frametime*MWBase::Environment::get().getWorld()->getTimeScaleFactor()/3600);
|
||||
|
||||
// update actors
|
||||
MWBase::Environment::get().getMechanicsManager()->update(frametime,
|
||||
MWBase::Environment::get().getWindowManager()->isGuiMode());
|
||||
|
||||
// update world
|
||||
MWBase::Environment::get().getWorld()->update(frametime, MWBase::Environment::get().getWindowManager()->isGuiMode());
|
||||
|
||||
// update game state
|
||||
MWBase::Environment::get().getStateManager()->update (frametime);
|
||||
MWWorld::Ptr player = mEnvironment.getWorld()->getPlayer().getPlayer();
|
||||
if(MWWorld::Class::get(player).getCreatureStats(player).isDead())
|
||||
MWBase::Environment::get().getStateManager()->endGame();
|
||||
}
|
||||
|
||||
// update world
|
||||
MWBase::Environment::get().getWorld()->update(frametime, MWBase::Environment::get().getWindowManager()->isGuiMode());
|
||||
|
||||
// update game state
|
||||
MWBase::Environment::get().getStateManager()->update (frametime);
|
||||
|
||||
// update GUI
|
||||
Ogre::RenderWindow* window = mOgre->getWindow();
|
||||
|
@ -43,7 +43,6 @@ namespace MWRender
|
||||
{
|
||||
class ExternalRendering;
|
||||
class Animation;
|
||||
class Camera;
|
||||
}
|
||||
|
||||
namespace MWMechanics
|
||||
@ -113,7 +112,7 @@ namespace MWBase
|
||||
|
||||
virtual MWWorld::CellStore *getInterior (const std::string& name) = 0;
|
||||
|
||||
virtual MWRender::Camera* getCamera() const = 0;
|
||||
virtual void useDeathCamera() = 0;
|
||||
|
||||
virtual void setWaterHeight(const float height) = 0;
|
||||
|
||||
|
@ -181,8 +181,9 @@ namespace MWInput
|
||||
switch (action)
|
||||
{
|
||||
case A_GameMenu:
|
||||
if(MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_Running)
|
||||
toggleMainMenu ();
|
||||
if(!(MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_Running
|
||||
&& MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_MainMenu))
|
||||
toggleMainMenu ();
|
||||
break;
|
||||
case A_Screenshot:
|
||||
screenshot();
|
||||
@ -303,8 +304,8 @@ namespace MWInput
|
||||
|
||||
// Disable movement in Gui mode
|
||||
if (MWBase::Environment::get().getWindowManager()->isGuiMode()
|
||||
|| MWWorld::Class::get(mPlayer->getPlayer()).getCreatureStats(mPlayer->getPlayer()).isDead() )
|
||||
return;
|
||||
|| MWBase::Environment::get().getStateManager()->getState() != MWBase::StateManager::State_Running)
|
||||
return;
|
||||
|
||||
|
||||
// Configure player movement according to keyboard input. Actual movement will
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/statemanager.hpp"
|
||||
|
||||
#include "npcstats.hpp"
|
||||
#include "creaturestats.hpp"
|
||||
|
@ -26,14 +26,12 @@
|
||||
#include "creaturestats.hpp"
|
||||
#include "security.hpp"
|
||||
|
||||
#include "../mwrender/camera.hpp"
|
||||
#include "../mwrender/animation.hpp"
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/statemanager.hpp"
|
||||
|
||||
#include "../mwworld/player.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
@ -1058,11 +1056,10 @@ bool CharacterController::kill()
|
||||
{
|
||||
if( isDead() )
|
||||
{
|
||||
//state=end game only when player's death animation is over
|
||||
//player's death animation is over
|
||||
if( mPtr.getRefData().getHandle()=="player" && !isAnimPlaying(mCurrentDeath)
|
||||
&& MWBase::Environment::get().getWindowManager()->getMode () != MWGui::GM_MainMenu )
|
||||
&& MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_MainMenu )
|
||||
{
|
||||
MWBase::Environment::get().getStateManager()->endGame();
|
||||
MWWorld::Class::get(mPtr).getCreatureStats(mPtr).setHealth(0);
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu);
|
||||
}
|
||||
@ -1105,18 +1102,6 @@ bool CharacterController::kill()
|
||||
|
||||
if(mAnimation)
|
||||
{
|
||||
//switch to 3rd person before player's death animation
|
||||
if (mPtr.getRefData().getHandle()=="player")
|
||||
{
|
||||
if(MWBase::Environment::get().getWorld()->getCamera()->isVanityOrPreviewModeEnabled() )
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->getCamera()->togglePreviewMode(false);
|
||||
MWBase::Environment::get().getWorld()->getCamera()->toggleVanityMode(false);
|
||||
}
|
||||
if(MWBase::Environment::get().getWorld()->getCamera()->isFirstPerson())
|
||||
MWBase::Environment::get().getWorld()->togglePOV();
|
||||
}
|
||||
|
||||
mAnimation->play(mCurrentDeath, Priority_Death, MWRender::Animation::Group_All,
|
||||
false, 1.0f, "start", "stop", 0.0f, 0);
|
||||
mAnimation->disable(mCurrentIdle);
|
||||
|
@ -70,6 +70,7 @@ void MWState::StateManager::newGame (bool bypass)
|
||||
void MWState::StateManager::endGame()
|
||||
{
|
||||
mState = State_Ended;
|
||||
MWBase::Environment::get().getWorld()->useDeathCamera();
|
||||
}
|
||||
|
||||
void MWState::StateManager::saveGame (const std::string& description, const Slot *slot)
|
||||
|
@ -400,9 +400,15 @@ namespace MWWorld
|
||||
return mCells.getInterior (name);
|
||||
}
|
||||
|
||||
MWRender::Camera* World::getCamera() const
|
||||
void World::useDeathCamera()
|
||||
{
|
||||
return mRendering->getCamera();
|
||||
if(mRendering->getCamera()->isVanityOrPreviewModeEnabled() )
|
||||
{
|
||||
mRendering->getCamera()->togglePreviewMode(false);
|
||||
mRendering->getCamera()->toggleVanityMode(false);
|
||||
}
|
||||
if(mRendering->getCamera()->isFirstPerson())
|
||||
togglePOV();
|
||||
}
|
||||
|
||||
MWWorld::Player& World::getPlayer()
|
||||
|
@ -42,6 +42,7 @@ namespace MWRender
|
||||
class SkyManager;
|
||||
class CellRender;
|
||||
class Animation;
|
||||
class Camera;
|
||||
}
|
||||
|
||||
struct ContentLoader;
|
||||
@ -185,7 +186,8 @@ namespace MWWorld
|
||||
|
||||
virtual CellStore *getInterior (const std::string& name);
|
||||
|
||||
virtual MWRender::Camera* getCamera() const;
|
||||
//switch to POV before showing player's death animation
|
||||
virtual void useDeathCamera();
|
||||
|
||||
virtual void setWaterHeight(const float height);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user