Make collision events available on every frame (thanks, scrawl), make hurtStandingActor and hurtCollidingActor no-op in guimode

deque
MiroslavR 10 years ago
parent 2162a9e1b9
commit a5e972aeb5

@ -829,15 +829,15 @@ namespace MWWorld
const PtrVelocityList& PhysicsSystem::applyQueuedMovement(float dt) const PtrVelocityList& PhysicsSystem::applyQueuedMovement(float dt)
{ {
// Collision events are only tracked for a single frame, so reset first
mCollisions.clear();
mStandingCollisions.clear();
mMovementResults.clear(); mMovementResults.clear();
mTimeAccum += dt; mTimeAccum += dt;
if(mTimeAccum >= 1.0f/60.0f) if(mTimeAccum >= 1.0f/60.0f)
{ {
// Collision events should be available on every frame
mCollisions.clear();
mStandingCollisions.clear();
const MWBase::World *world = MWBase::Environment::get().getWorld(); const MWBase::World *world = MWBase::Environment::get().getWorld();
PtrVelocityList::iterator iter = mMovementQueue.begin(); PtrVelocityList::iterator iter = mMovementQueue.begin();
for(;iter != mMovementQueue.end();++iter) for(;iter != mMovementQueue.end();++iter)

@ -2078,6 +2078,9 @@ namespace MWWorld
void World::hurtStandingActors(const Ptr &object, float healthPerSecond) void World::hurtStandingActors(const Ptr &object, float healthPerSecond)
{ {
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
return;
std::vector<std::string> actors; std::vector<std::string> actors;
mPhysics->getActorsStandingOn(object, actors); mPhysics->getActorsStandingOn(object, actors);
for (std::vector<std::string>::iterator it = actors.begin(); it != actors.end(); ++it) for (std::vector<std::string>::iterator it = actors.begin(); it != actors.end(); ++it)
@ -2106,6 +2109,9 @@ namespace MWWorld
void World::hurtCollidingActors(const Ptr &object, float healthPerSecond) void World::hurtCollidingActors(const Ptr &object, float healthPerSecond)
{ {
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
return;
std::vector<std::string> actors; std::vector<std::string> actors;
mPhysics->getActorsCollidingWith(object, actors); mPhysics->getActorsCollidingWith(object, actors);
for (std::vector<std::string>::iterator it = actors.begin(); it != actors.end(); ++it) for (std::vector<std::string>::iterator it = actors.begin(); it != actors.end(); ++it)

Loading…
Cancel
Save