Merge remote-tracking branch 'glorf/bugfix-4'

actorid
Marc Zinnschlag 12 years ago
commit bab899513a

@ -368,7 +368,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
mEnvironment.setWorld( new MWWorld::World (*mOgre, mFileCollections, mMaster, mPlugins, mEnvironment.setWorld( new MWWorld::World (*mOgre, mFileCollections, mMaster, mPlugins,
mResDir, mCfgMgr.getCachePath(), mNewGame, mEncoder, mFallbackMap, mResDir, mCfgMgr.getCachePath(), mNewGame, mEncoder, mFallbackMap,
mActivationDistanceOverride)); mActivationDistanceOverride));
MWBase::Environment::get().getWorld()->setupPlayer(mNewGame); MWBase::Environment::get().getWorld()->setupPlayer();
//Load translation data //Load translation data
mTranslationDataStorage.setEncoder(mEncoder); mTranslationDataStorage.setEncoder(mEncoder);

@ -323,7 +323,7 @@ namespace MWBase
virtual void changeVanityModeScale(float factor) = 0; virtual void changeVanityModeScale(float factor) = 0;
virtual bool vanityRotateCamera(float * rot) = 0; virtual bool vanityRotateCamera(float * rot) = 0;
virtual void setupPlayer(bool newGame) = 0; virtual void setupPlayer() = 0;
virtual void renderPlayer() = 0; virtual void renderPlayer() = 0;
virtual void activateDoor(const MWWorld::Ptr& door) = 0; virtual void activateDoor(const MWWorld::Ptr& door) = 0;

@ -1110,6 +1110,13 @@ namespace MWGui
{ {
mLoadingScreen->loadingDone (); mLoadingScreen->loadingDone ();
} }
bool WindowManager::getRestEnabled()
{
//Enable rest dialogue if character creation finished
if(mRestAllowed==false && MWBase::Environment::get().getWorld()->getGlobalVariable ("chargenstate").mFloat==-1)
mRestAllowed=true;
return mRestAllowed;
}
bool WindowManager::getPlayerSleeping () bool WindowManager::getPlayerSleeping ()
{ {

@ -220,7 +220,7 @@ namespace MWGui
virtual void loadingDone(); virtual void loadingDone();
virtual void enableRest() { mRestAllowed = true; } virtual void enableRest() { mRestAllowed = true; }
virtual bool getRestEnabled() { return mRestAllowed; } virtual bool getRestEnabled();
virtual bool getPlayerSleeping(); virtual bool getPlayerSleeping();
virtual void wakeUpPlayer(); virtual void wakeUpPlayer();

@ -163,7 +163,8 @@ namespace MWWorld
ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride) ToUTF8::Utf8Encoder* encoder, const std::map<std::string,std::string>& fallbackMap, int mActivationDistanceOverride)
: mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0), : mPlayer (0), mLocalScripts (mStore), mGlobalVariables (0),
mSky (true), mCells (mStore, mEsm), mSky (true), mCells (mStore, mEsm),
mNumFacing(0), mActivationDistanceOverride (mActivationDistanceOverride),mFallback(fallbackMap) mNumFacing(0), mActivationDistanceOverride (mActivationDistanceOverride),
mFallback(fallbackMap), mNewGame(newGame)
{ {
mPhysics = new PhysicsSystem(renderer); mPhysics = new PhysicsSystem(renderer);
mPhysEngine = mPhysics->getEngine(); mPhysEngine = mPhysics->getEngine();
@ -214,7 +215,7 @@ namespace MWWorld
// global variables // global variables
mGlobalVariables = new Globals (mStore); mGlobalVariables = new Globals (mStore);
if (newGame) if (mNewGame)
{ {
// set new game mark // set new game mark
mGlobalVariables->setInt ("chargenstate", 1); mGlobalVariables->setInt ("chargenstate", 1);
@ -1474,12 +1475,12 @@ namespace MWWorld
return mRendering->vanityRotateCamera(rot); return mRendering->vanityRotateCamera(rot);
} }
void World::setupPlayer(bool newGame) void World::setupPlayer()
{ {
const ESM::NPC* player = mStore.get<ESM::NPC>().find ("player"); const ESM::NPC* player = mStore.get<ESM::NPC>().find ("player");
mPlayer = new MWWorld::Player (player, *this); mPlayer = new MWWorld::Player (player, *this);
mRendering->attachCameraTo(mPlayer->getPlayer()); mRendering->attachCameraTo(mPlayer->getPlayer());
if (newGame) if (mNewGame)
{ {
MWWorld::Class::get(mPlayer->getPlayer()).getContainerStore(mPlayer->getPlayer()).fill(player->mInventory, "", mStore); MWWorld::Class::get(mPlayer->getPlayer()).getContainerStore(mPlayer->getPlayer()).fill(player->mInventory, "", mStore);
MWWorld::Class::get(mPlayer->getPlayer()).getInventoryStore(mPlayer->getPlayer()).autoEquip (mPlayer->getPlayer()); MWWorld::Class::get(mPlayer->getPlayer()).getInventoryStore(mPlayer->getPlayer()).autoEquip (mPlayer->getPlayer());
@ -1490,6 +1491,8 @@ namespace MWWorld
{ {
mRendering->renderPlayer(mPlayer->getPlayer()); mRendering->renderPlayer(mPlayer->getPlayer());
mPhysics->addActor(mPlayer->getPlayer()); mPhysics->addActor(mPlayer->getPlayer());
if (mNewGame)
toggleCollisionMode();
} }
void World::setupExternalRendering (MWRender::ExternalRendering& rendering) void World::setupExternalRendering (MWRender::ExternalRendering& rendering)

@ -85,6 +85,8 @@ namespace MWWorld
float mFaced2Distance; float mFaced2Distance;
int mNumFacing; int mNumFacing;
bool mNewGame;
std::map<MWWorld::Ptr, int> mDoorStates; std::map<MWWorld::Ptr, int> mDoorStates;
///< only holds doors that are currently moving. 0 means closing, 1 opening ///< only holds doors that are currently moving. 0 means closing, 1 opening
@ -371,7 +373,7 @@ namespace MWWorld
virtual bool vanityRotateCamera(float * rot); virtual bool vanityRotateCamera(float * rot);
virtual void setupPlayer(bool newGame); virtual void setupPlayer();
virtual void renderPlayer(); virtual void renderPlayer();
virtual void activateDoor(const MWWorld::Ptr& door); virtual void activateDoor(const MWWorld::Ptr& door);

Loading…
Cancel
Save