1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 16:15:31 +00:00

Merged pull request #1868

This commit is contained in:
Marc Zinnschlag 2018-08-17 09:37:49 +02:00
commit 088463ebe6
6 changed files with 38 additions and 6 deletions

View file

@ -22,6 +22,7 @@
Bug #3533: GetSpellEffects should detect effects with zero duration Bug #3533: GetSpellEffects should detect effects with zero duration
Bug #3591: Angled hit distance too low Bug #3591: Angled hit distance too low
Bug #3629: DB assassin attack never triggers creature spawning Bug #3629: DB assassin attack never triggers creature spawning
Bug #3788: GetPCInJail and GetPCTraveling do not work as in vanilla
Bug #3876: Landscape texture painting is misaligned Bug #3876: Landscape texture painting is misaligned
Bug #3897: Have Goodbye give all choices the effects of Goodbye Bug #3897: Have Goodbye give all choices the effects of Goodbye
Bug #3911: [macOS] Typing in the "Content List name" dialog box produces double characters Bug #3911: [macOS] Typing in the "Content List name" dialog box produces double characters

View file

@ -566,6 +566,9 @@ namespace MWBase
virtual bool isPlayerInJail() const = 0; virtual bool isPlayerInJail() const = 0;
virtual void setPlayerTraveling(bool traveling) = 0;
virtual bool isPlayerTraveling() const = 0;
virtual void rotateWorldObject (const MWWorld::Ptr& ptr, osg::Quat rotate) = 0; virtual void rotateWorldObject (const MWWorld::Ptr& ptr, osg::Quat rotate) = 0;
/// Return terrain height at \a worldPos position. /// Return terrain height at \a worldPos position.

View file

@ -154,6 +154,10 @@ namespace MWGui
if (playerGold<price) if (playerGold<price)
return; return;
// Set "traveling" flag, so GetPCTraveling can detect teleportation.
// We will reset this flag during next world update.
MWBase::Environment::get().getWorld()->setPlayerTraveling(true);
if (!mPtr.getCell()->isExterior()) if (!mPtr.getCell()->isExterior())
// Interior cell -> mages guild transport // Interior cell -> mages guild transport
MWBase::Environment::get().getWindowManager()->playSound("mysticism cast"); MWBase::Environment::get().getWindowManager()->playSound("mysticism cast");

View file

@ -1155,8 +1155,7 @@ namespace MWScript
virtual void execute (Interpreter::Runtime &runtime) virtual void execute (Interpreter::Runtime &runtime)
{ {
/// \todo implement traveling check runtime.push (MWBase::Environment::get().getWorld()->isPlayerTraveling());
runtime.push (0);
} }
}; };

View file

@ -155,7 +155,8 @@ namespace MWWorld
mGodMode(false), mScriptsEnabled(true), mContentFiles (contentFiles), mUserDataPath(userDataPath), mGodMode(false), mScriptsEnabled(true), mContentFiles (contentFiles), mUserDataPath(userDataPath),
mActivationDistanceOverride (activationDistanceOverride), mStartupScript(startupScript), mActivationDistanceOverride (activationDistanceOverride), mStartupScript(startupScript),
mStartCell (startCell), mDistanceToFacedObject(-1), mTeleportEnabled(true), mStartCell (startCell), mDistanceToFacedObject(-1), mTeleportEnabled(true),
mLevitationEnabled(true), mGoToJail(false), mDaysInPrison(0), mSpellPreloadTimer(0.f) mLevitationEnabled(true), mGoToJail(false), mDaysInPrison(0),
mPlayerTraveling(false), mPlayerInJail(false), mSpellPreloadTimer(0.f)
{ {
mPhysics.reset(new MWPhysics::PhysicsSystem(resourceSystem, rootNode)); mPhysics.reset(new MWPhysics::PhysicsSystem(resourceSystem, rootNode));
mRendering.reset(new MWRender::RenderingManager(viewer, rootNode, resourceSystem, workQueue, &mFallback, resourcePath)); mRendering.reset(new MWRender::RenderingManager(viewer, rootNode, resourceSystem, workQueue, &mFallback, resourcePath));
@ -313,6 +314,8 @@ namespace MWWorld
mGoToJail = false; mGoToJail = false;
mTeleportEnabled = true; mTeleportEnabled = true;
mLevitationEnabled = true; mLevitationEnabled = true;
mPlayerTraveling = false;
mPlayerInJail = false;
fillGlobalVariables(); fillGlobalVariables();
} }
@ -1644,6 +1647,15 @@ namespace MWWorld
if (mGoToJail && !paused) if (mGoToJail && !paused)
goToJail(); goToJail();
// Reset "traveling" flag - there was a frame to detect traveling.
mPlayerTraveling = false;
// The same thing for "in jail" flag: reset it if:
// 1. Player was in jail
// 2. Jailing window was closed
if (mPlayerInJail && !mGoToJail && !MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Jail))
mPlayerInJail = false;
updateWeather(duration, paused); updateWeather(duration, paused);
if (!paused) if (!paused)
@ -3283,6 +3295,7 @@ namespace MWWorld
{ {
// Reset bounty and forget the crime now, but don't change cell yet (the player should be able to read the dialog text first) // Reset bounty and forget the crime now, but don't change cell yet (the player should be able to read the dialog text first)
mGoToJail = true; mGoToJail = true;
mPlayerInJail = true;
MWWorld::Ptr player = getPlayerPtr(); MWWorld::Ptr player = getPlayerPtr();
@ -3308,10 +3321,17 @@ namespace MWWorld
bool World::isPlayerInJail() const bool World::isPlayerInJail() const
{ {
if (mGoToJail) return mPlayerInJail;
return true; }
return MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Jail); void World::setPlayerTraveling(bool traveling)
{
mPlayerTraveling = traveling;
}
bool World::isPlayerTraveling() const
{
return mPlayerTraveling;
} }
float World::getTerrainHeightAt(const osg::Vec3f& worldPos) const float World::getTerrainHeightAt(const osg::Vec3f& worldPos) const

View file

@ -168,6 +168,8 @@ namespace MWWorld
bool mLevitationEnabled; bool mLevitationEnabled;
bool mGoToJail; bool mGoToJail;
int mDaysInPrison; int mDaysInPrison;
bool mPlayerTraveling;
bool mPlayerInJail;
float mSpellPreloadTimer; float mSpellPreloadTimer;
@ -672,6 +674,9 @@ namespace MWWorld
bool isPlayerInJail() const override; bool isPlayerInJail() const override;
void setPlayerTraveling(bool traveling) override;
bool isPlayerTraveling() const override;
/// Return terrain height at \a worldPos position. /// Return terrain height at \a worldPos position.
float getTerrainHeightAt(const osg::Vec3f& worldPos) const override; float getTerrainHeightAt(const osg::Vec3f& worldPos) const override;