Merge remote-tracking branch 'mrcheko/savedgame' into savedgame

actorid
Marc Zinnschlag 11 years ago
commit 09fadd446b

@ -93,18 +93,18 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
if (mUseSound)
MWBase::Environment::get().getSoundManager()->update(frametime);
// global scripts
if (MWBase::Environment::get().getStateManager()->getState()==
MWBase::StateManager::State_Running)
{
// 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.
// 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();
@ -113,17 +113,26 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
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);
}
// update actors
MWBase::Environment::get().getMechanicsManager()->update(frametime,
MWBase::Environment::get().getWindowManager()->isGuiMode());
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())
MWBase::Environment::get().getStateManager()->endGame();
}
// update world
MWBase::Environment::get().getWorld()->update(frametime, MWBase::Environment::get().getWindowManager()->isGuiMode());
// update GUI
Ogre::RenderWindow* window = mOgre->getWindow();
unsigned int tri, batch;

@ -112,6 +112,8 @@ namespace MWBase
virtual MWWorld::CellStore *getInterior (const std::string& name) = 0;
virtual void useDeathCamera() = 0;
virtual void setWaterHeight(const float height) = 0;
virtual void toggleWater() = 0;

@ -181,7 +181,9 @@ namespace MWInput
switch (action)
{
case A_GameMenu:
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();
@ -301,7 +303,9 @@ namespace MWInput
return;
// Disable movement in Gui mode
if (MWBase::Environment::get().getWindowManager()->isGuiMode()) return;
if (MWBase::Environment::get().getWindowManager()->isGuiMode()
|| 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"
@ -571,19 +570,15 @@ namespace MWMechanics
stats.resurrect();
continue;
}
MWBase::Environment::get().getStateManager()->endGame();
}
if(iter->second->isDead())
continue;
iter->second->kill();
++mDeathCount[cls.getId(iter->first)];
if (iter->second->kill())
{
++mDeathCount[cls.getId(iter->first)];
if(cls.isEssential(iter->first))
MWBase::Environment::get().getWindowManager()->messageBox("#{sKilledEssential}");
if(cls.isEssential(iter->first))
MWBase::Environment::get().getWindowManager()->messageBox("#{sKilledEssential}");
}
}
}

@ -1052,10 +1052,19 @@ void CharacterController::forceStateUpdate()
}
}
void CharacterController::kill()
bool CharacterController::kill()
{
if(mDeathState != CharState_None)
return;
if( isDead() )
{
//player's death animation is over
if( mPtr.getRefData().getHandle()=="player" && !isAnimPlaying(mCurrentDeath)
&& MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_MainMenu )
{
MWWorld::Class::get(mPtr).getCreatureStats(mPtr).setHealth(0);
MWBase::Environment::get().getWindowManager()->pushGuiMode (MWGui::GM_MainMenu);
}
return false;
}
if(mPtr.getTypeName() == typeid(ESM::NPC).name())
{
@ -1100,6 +1109,8 @@ void CharacterController::kill()
mIdleState = CharState_None;
mCurrentIdle.clear();
return true;
}
void CharacterController::resurrect()

@ -188,7 +188,7 @@ public:
void skipAnim();
bool isAnimPlaying(const std::string &groupName);
void kill();
bool kill();
void resurrect();
bool isDead() const
{ return mDeathState != CharState_None; }

@ -221,6 +221,11 @@ OEngine::Render::Fader* RenderingManager::getFader()
return mRendering.getFader();
}
MWRender::Camera* RenderingManager::getCamera() const
{
return mCamera;
}
void RenderingManager::removeCell (MWWorld::CellStore *store)
{
mObjects.removeCell(store);

@ -98,6 +98,8 @@ public:
SkyManager* getSkyManager();
Compositors* getCompositors();
MWRender::Camera* getCamera() const;
void toggleLight();
bool toggleRenderMode(int mode);

@ -77,6 +77,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,6 +400,17 @@ namespace MWWorld
return mCells.getInterior (name);
}
void World::useDeathCamera()
{
if(mRendering->getCamera()->isVanityOrPreviewModeEnabled() )
{
mRendering->getCamera()->togglePreviewMode(false);
mRendering->getCamera()->toggleVanityMode(false);
}
if(mRendering->getCamera()->isFirstPerson())
togglePOV();
}
MWWorld::Player& World::getPlayer()
{
return *mPlayer;

@ -42,6 +42,7 @@ namespace MWRender
class SkyManager;
class CellRender;
class Animation;
class Camera;
}
struct ContentLoader;
@ -185,6 +186,9 @@ namespace MWWorld
virtual CellStore *getInterior (const std::string& name);
//switch to POV before showing player's death animation
virtual void useDeathCamera();
virtual void setWaterHeight(const float height);
virtual void toggleWater();

Loading…
Cancel
Save