From 69b4fe8545264efeeedf5925e10b10f0f7faf236 Mon Sep 17 00:00:00 2001 From: elsid Date: Tue, 27 Aug 2019 20:49:07 +0200 Subject: [PATCH] Revert "Open door when it is on the way to a next path point" This reverts commit c32872fb16fe826c5409e31111bd50466595abf5. --- apps/openmw/mwbase/world.hpp | 2 -- apps/openmw/mwmechanics/aipackage.cpp | 18 ------------------ apps/openmw/mwmechanics/aipackage.hpp | 2 -- apps/openmw/mwworld/worldimp.cpp | 9 ++------- apps/openmw/mwworld/worldimp.hpp | 2 -- 5 files changed, 2 insertions(+), 31 deletions(-) diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 08642eb7f..256c8b1d5 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -306,8 +306,6 @@ namespace MWBase virtual bool castRay (float x1, float y1, float z1, float x2, float y2, float z2) = 0; - virtual MWWorld::Ptr castRay(const osg::Vec3f& from, const osg::Vec3f& to, int mask) const = 0; - virtual void setActorCollisionMode(const MWWorld::Ptr& ptr, bool internal, bool external) = 0; virtual bool isActorCollisionEnabled(const MWWorld::Ptr& ptr) = 0; diff --git a/apps/openmw/mwmechanics/aipackage.cpp b/apps/openmw/mwmechanics/aipackage.cpp index 4395f1e4b..598292fc3 100644 --- a/apps/openmw/mwmechanics/aipackage.cpp +++ b/apps/openmw/mwmechanics/aipackage.cpp @@ -13,8 +13,6 @@ #include "../mwworld/cellstore.hpp" #include "../mwworld/inventorystore.hpp" -#include "../mwphysics/collisiontype.hpp" - #include "pathgrid.hpp" #include "creaturestats.hpp" #include "movement.hpp" @@ -236,9 +234,6 @@ void MWMechanics::AiPackage::openDoors(const MWWorld::Ptr& actor) // note: AiWander currently does not open doors if (getTypeId() != TypeIdWander && !door.getCellRef().getTeleport() && door.getClass().getDoorState(door) == 0) { - if (!isDoorOnTheWay(actor, door)) - return; - if ((door.getCellRef().getTrap().empty() && door.getCellRef().getLockLevel() <= 0 )) { world->activate(door, actor); @@ -407,16 +402,3 @@ DetourNavigator::Flags MWMechanics::AiPackage::getNavigatorFlags(const MWWorld:: return result; } - -bool MWMechanics::AiPackage::isDoorOnTheWay(const MWWorld::Ptr& actor, const MWWorld::Ptr& door) const -{ - if (mPathFinder.getPathSize() == 0) - return false; - - const auto world = MWBase::Environment::get().getWorld(); - const auto halfExtents = world->getHalfExtents(actor); - const auto position = actor.getRefData().getPosition().asVec3() + osg::Vec3f(0, 0, halfExtents.z()); - const auto destination = mPathFinder.getPath().front() + osg::Vec3f(0, 0, halfExtents.z()); - - return world->castRay(position, destination, MWPhysics::CollisionType_Door) == door; -} diff --git a/apps/openmw/mwmechanics/aipackage.hpp b/apps/openmw/mwmechanics/aipackage.hpp index 0f7b5cf1d..6bb12342a 100644 --- a/apps/openmw/mwmechanics/aipackage.hpp +++ b/apps/openmw/mwmechanics/aipackage.hpp @@ -147,8 +147,6 @@ namespace MWMechanics private: bool isNearInactiveCell(osg::Vec3f position); - - bool isDoorOnTheWay(const MWWorld::Ptr& actor, const MWWorld::Ptr& door) const; }; } diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index d285d04ca..ce253b8ba 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1610,13 +1610,8 @@ namespace MWWorld osg::Vec3f a(x1,y1,z1); osg::Vec3f b(x2,y2,z2); - return !castRay(a, b, mask).isEmpty(); - } - - MWWorld::Ptr World::castRay(const osg::Vec3f& from, const osg::Vec3f& to, int mask) const - { - const auto result = mPhysics->castRay(from, to, MWWorld::Ptr(), std::vector(), mask); - return result.mHit ? result.mHitObject : MWWorld::Ptr(); + MWPhysics::PhysicsSystem::RayResult result = mPhysics->castRay(a, b, MWWorld::Ptr(), std::vector(), mask); + return result.mHit; } void World::processDoors(float duration) diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index 0acbc5926..dd915c8bd 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -420,8 +420,6 @@ namespace MWWorld bool castRay (float x1, float y1, float z1, float x2, float y2, float z2) override; - MWWorld::Ptr castRay (const osg::Vec3f& from, const osg::Vec3f& to, int mask) const override; - void setActorCollisionMode(const Ptr& ptr, bool internal, bool external) override; bool isActorCollisionEnabled(const Ptr& ptr) override;