mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Do not load (0,0) on new game
This commit is contained in:
parent
6f03694d50
commit
6bd0bbb8df
4 changed files with 36 additions and 26 deletions
|
@ -104,6 +104,11 @@ namespace MWScript
|
|||
std::string name = runtime.getStringLiteral (runtime[0].mInteger);
|
||||
runtime.pop();
|
||||
|
||||
if (!MWBase::Environment::get().getWorld()->getPlayerPtr().isInCell())
|
||||
{
|
||||
runtime.push(0);
|
||||
return;
|
||||
}
|
||||
const ESM::Cell *cell = MWBase::Environment::get().getWorld()->getPlayerPtr().getCell()->getCell();
|
||||
|
||||
std::string current = cell->mName;
|
||||
|
|
|
@ -271,7 +271,7 @@ namespace MWScript
|
|||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
if (!ptr.isInCell())
|
||||
if (ptr.getContainerStore())
|
||||
return;
|
||||
|
||||
if (ptr.getRefData().getHandle() == "player")
|
||||
|
@ -308,6 +308,7 @@ namespace MWScript
|
|||
if(store)
|
||||
{
|
||||
MWBase::Environment::get().getWorld()->moveObject(ptr,store,x,y,z);
|
||||
ptr = MWWorld::Ptr(ptr.getBase(), store);
|
||||
float ax = Ogre::Radian(ptr.getRefData().getPosition().rot[0]).valueDegrees();
|
||||
float ay = Ogre::Radian(ptr.getRefData().getPosition().rot[1]).valueDegrees();
|
||||
if(ptr.getTypeName() == typeid(ESM::NPC).name())//some morrowind oddity
|
||||
|
|
|
@ -136,8 +136,6 @@ void MWState::StateManager::newGame (bool bypass)
|
|||
else
|
||||
MWBase::Environment::get().getWorld()->setGlobalInt ("chargenstate", -1);
|
||||
|
||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().addStartup();
|
||||
|
||||
mState = State_Running;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
#else
|
||||
#include <tr1/unordered_map>
|
||||
#endif
|
||||
|
||||
#include "../mwbase/scriptmanager.hpp"
|
||||
#include "../mwscript/globalscripts.hpp"
|
||||
#include <OgreSceneNode.h>
|
||||
|
||||
#include <libs/openengine/bullet/trace.h>
|
||||
|
@ -188,6 +189,18 @@ namespace MWWorld
|
|||
|
||||
MWBase::Environment::get().getWindowManager()->updatePlayer();
|
||||
|
||||
if (!bypass)
|
||||
{
|
||||
// FIXME: should be set to 1, but the sound manager won't pause newly started sounds
|
||||
mPlayIntro = 2;
|
||||
|
||||
// set new game mark
|
||||
mGlobalVariables["chargenstate"].setInteger (1);
|
||||
mGlobalVariables["pcrace"].setInteger (3);
|
||||
|
||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().addStartup();
|
||||
}
|
||||
|
||||
if (bypass && !mStartCell.empty())
|
||||
{
|
||||
ESM::Position pos;
|
||||
|
@ -204,27 +217,20 @@ namespace MWWorld
|
|||
}
|
||||
else
|
||||
{
|
||||
/// \todo if !bypass, do not add player location to global map for the duration of one
|
||||
/// frame
|
||||
ESM::Position pos;
|
||||
const int cellSize = 8192;
|
||||
pos.pos[0] = cellSize/2;
|
||||
pos.pos[1] = cellSize/2;
|
||||
pos.pos[2] = 0;
|
||||
pos.rot[0] = 0;
|
||||
pos.rot[1] = 0;
|
||||
pos.rot[2] = 0;
|
||||
mWorldScene->changeToExteriorCell(pos);
|
||||
}
|
||||
|
||||
if (!bypass)
|
||||
{
|
||||
// FIXME: should be set to 1, but the sound manager won't pause newly started sounds
|
||||
mPlayIntro = 2;
|
||||
|
||||
// set new game mark
|
||||
mGlobalVariables["chargenstate"].setInteger (1);
|
||||
mGlobalVariables["pcrace"].setInteger (3);
|
||||
for (int i=0; i<5; ++i)
|
||||
MWBase::Environment::get().getScriptManager()->getGlobalScripts().run();
|
||||
if (!getPlayerPtr().isInCell())
|
||||
{
|
||||
ESM::Position pos;
|
||||
const int cellSize = 8192;
|
||||
pos.pos[0] = cellSize/2;
|
||||
pos.pos[1] = cellSize/2;
|
||||
pos.pos[2] = 0;
|
||||
pos.rot[0] = 0;
|
||||
pos.rot[1] = 0;
|
||||
pos.rot[2] = 0;
|
||||
mWorldScene->changeToExteriorCell(pos);
|
||||
}
|
||||
}
|
||||
|
||||
// we don't want old weather to persist on a new game
|
||||
|
@ -938,7 +944,7 @@ namespace MWWorld
|
|||
|
||||
Ogre::Vector3 vec(x, y, z);
|
||||
|
||||
CellStore *currCell = ptr.getCell();
|
||||
CellStore *currCell = ptr.isInCell() ? ptr.getCell() : NULL;
|
||||
bool isPlayer = ptr == mPlayer->getPlayer();
|
||||
bool haveToMove = isPlayer || mWorldScene->isCellActive(*currCell);
|
||||
|
||||
|
|
Loading…
Reference in a new issue