diff --git a/CHANGELOG.md b/CHANGELOG.md index bd8bf9f48..51e18a439 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ Bug #4768: Fallback numerical value recovery chokes on invalid arguments Bug #4775: Slowfall effect resets player jumping flag Bug #4778: Interiors of Illusion puzzle in Sotha Sil Expanded mod is broken + Bug #4783: Blizzard behavior is incorrect Bug #4787: Sneaking makes 1st person walking/bobbing animation super-slow Bug #4797: Player sneaking and running stances are not accounted for when in air Bug #4800: Standing collisions are not updated immediately when an object is teleported without a cell change diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index b58b31906..3996f472c 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -225,7 +225,7 @@ protected: virtual void apply(osg::StateSet *stateset, osg::NodeVisitor *nv) { osg::TexMat* texMat = static_cast(stateset->getTextureAttribute(0, osg::StateAttribute::TEXMAT)); - texMat->setMatrix(osg::Matrix::translate(osg::Vec3f(0, mAnimationTimer, 0.f))); + texMat->setMatrix(osg::Matrix::translate(osg::Vec3f(0, -mAnimationTimer, 0.f))); stateset->setTextureAttribute(0, mTexture, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE); stateset->setTextureAttribute(1, mTexture, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE); @@ -1108,7 +1108,7 @@ SkyManager::SkyManager(osg::Group* parentNode, Resource::SceneManager* sceneMana , mMonth(0) , mCloudAnimationTimer(0.f) , mRainTimer(0.f) - , mStormDirection(0,-1,0) + , mStormDirection(0,1,0) , mClouds() , mNextClouds() , mCloudBlendFactor(0.0f) @@ -1597,10 +1597,14 @@ void SkyManager::update(float duration) osg::Quat quat; quat.makeRotate(osg::Vec3f(0,1,0), mStormDirection); - if (mParticleNode) - mParticleNode->setAttitude(quat); - mCloudNode->setAttitude(quat); + if (mParticleNode) + { + // Morrowind deliberately rotates the blizzard mesh, so so should we. + if (mCurrentParticleEffect == "meshes\\blizzard.nif") + quat.makeRotate(osg::Vec3f(-1,0,0), mStormDirection); + mParticleNode->setAttitude(quat); + } } else mCloudNode->setAttitude(osg::Quat()); @@ -1636,7 +1640,7 @@ void SkyManager::updateRainParameters() { if (mRainShooter) { - float angle = -std::atan2(1, 50.f/mWindSpeed); + float angle = -std::atan(mWindSpeed/50.f); mRainShooter->setVelocity(osg::Vec3f(0, mRainSpeed*std::sin(angle), -mRainSpeed/std::cos(angle))); mRainShooter->setAngle(angle); diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 79a305fee..2f054488b 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -661,17 +661,6 @@ void WeatherManager::playerTeleported(const std::string& playerRegion, bool isEx } } -osg::Vec3f WeatherManager::calculateStormDirection() -{ - osg::Vec3f playerPos (MWMechanics::getPlayer().getRefData().getPosition().asVec3()); - playerPos.z() = 0; - osg::Vec3f redMountainPos (25000, 70000, 0); - osg::Vec3f stormDirection = (playerPos - redMountainPos); - stormDirection.normalize(); - - return stormDirection; -} - float WeatherManager::calculateWindSpeed(int weatherId, float currentSpeed) { float targetSpeed = std::min(8.0f * mWeatherSettings[weatherId].mWindSpeed, 70.f); @@ -682,15 +671,7 @@ float WeatherManager::calculateWindSpeed(int weatherId, float currentSpeed) float updatedSpeed = (Misc::Rng::rollClosedProbability() - 0.5f) * multiplier * targetSpeed + currentSpeed; if (updatedSpeed > 0.5f * targetSpeed && updatedSpeed < 2.f * targetSpeed) - { currentSpeed = updatedSpeed; - } - - // Take in account direction to the Red Mountain, when needed - if (weatherId == 6 || weatherId == 7) - { - currentSpeed = (calculateStormDirection() * currentSpeed).length(); - } return currentSpeed; } @@ -750,7 +731,16 @@ void WeatherManager::update(float duration, bool paused, const TimeStamp& time, if (mIsStorm) { - mStormDirection = calculateStormDirection(); + osg::Vec3f stormDirection(0, 1, 0); + if (mResult.mParticleEffect == "meshes\\ashcloud.nif" || mResult.mParticleEffect == "meshes\\blightcloud.nif") + { + osg::Vec3f playerPos (MWMechanics::getPlayer().getRefData().getPosition().asVec3()); + playerPos.z() = 0; + osg::Vec3f redMountainPos (25000, 70000, 0); + stormDirection = (playerPos - redMountainPos); + stormDirection.normalize(); + } + mStormDirection = stormDirection; mRendering.getSkyManager()->setStormDirection(mStormDirection); } diff --git a/apps/openmw/mwworld/weather.hpp b/apps/openmw/mwworld/weather.hpp index c4f787739..696f7c688 100644 --- a/apps/openmw/mwworld/weather.hpp +++ b/apps/openmw/mwworld/weather.hpp @@ -370,7 +370,6 @@ namespace MWWorld bool updateWeatherRegion(const std::string& playerRegion); void updateWeatherTransitions(const float elapsedRealSeconds); void forceWeather(const int weatherID); - osg::Vec3f calculateStormDirection(); bool inTransition(); void addWeatherTransition(const int weatherID);