1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-28 21:39:48 +00:00

Make idle emitters emit ripples every 1.5 seconds (bug #5883)

This commit is contained in:
Alexei Kotov 2022-11-07 23:09:12 +03:00
parent 3ca17e5183
commit a5adb73900
3 changed files with 9 additions and 1 deletions

View file

@ -8,6 +8,7 @@
Bug #5129: Stuttering animation on Centurion Archer
Bug #5714: Touch spells cast using ExplodeSpell don't always explode
Bug #5849: Paralysis breaks landing
Bug #5883: Immobile creatures don't cause water ripples
Bug #5977: Fatigueless NPCs' corpse underwater changes animation on game load
Bug #6427: Enemy health bar disappears before damaging effect ends
Bug #6645: Enemy block sounds align with animation instead of blocked hits

View file

@ -127,6 +127,7 @@ namespace MWRender
const MWBase::World* world = MWBase::Environment::get().getWorld();
for (Emitter& emitter : mEmitters)
{
emitter.mTimer -= dt;
MWWorld::ConstPtr& ptr = emitter.mPtr;
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
{
@ -139,9 +140,13 @@ namespace MWRender
bool shouldEmit = (world->isUnderwater(ptr.getCell(), currentPos) && !world->isSubmerged(ptr))
|| world->isWalkingOnWater(ptr);
if (shouldEmit && (currentPos - emitter.mLastEmitPosition).length() > 10)
if (!shouldEmit)
emitter.mTimer = 0.f;
else if (emitter.mTimer <= 0.f || (currentPos - emitter.mLastEmitPosition).length() > 10)
{
emitter.mLastEmitPosition = currentPos;
emitter.mTimer = 1.5f;
currentPos.z() = mParticleNode->getPosition().z();
@ -160,6 +165,7 @@ namespace MWRender
newEmitter.mScale = scale;
newEmitter.mForce = force;
newEmitter.mLastEmitPosition = osg::Vec3f(0, 0, 0);
newEmitter.mTimer = 0.f;
mEmitters.push_back(newEmitter);
}

View file

@ -35,6 +35,7 @@ namespace MWRender
osg::Vec3f mLastEmitPosition;
float mScale;
float mForce;
float mTimer;
};
class RippleSimulation