From eb93ef68f11f7cd6b16b916e0892d034b4957745 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 13 Mar 2011 22:33:55 +0100 Subject: [PATCH] fixed collision mode interface and redirected collision mode script instruction from Player class to MWScene class --- apps/openmw/mwrender/mwscene.cpp | 2 +- apps/openmw/mwrender/mwscene.hpp | 4 ++-- apps/openmw/mwscript/controlextensions.cpp | 2 +- apps/openmw/mwworld/world.cpp | 5 +++++ apps/openmw/mwworld/world.hpp | 4 ++++ 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwrender/mwscene.cpp b/apps/openmw/mwrender/mwscene.cpp index 34461666e..09ee0e3e3 100644 --- a/apps/openmw/mwrender/mwscene.cpp +++ b/apps/openmw/mwrender/mwscene.cpp @@ -200,7 +200,7 @@ void MWScene::scaleObject (const std::string& handle, float scale) } -void MWScene::setCollsionMode (bool enabled) +void MWScene::toggleCollisionMode() { } diff --git a/apps/openmw/mwrender/mwscene.hpp b/apps/openmw/mwrender/mwscene.hpp index 3e1470e8d..fd3ef783f 100644 --- a/apps/openmw/mwrender/mwscene.hpp +++ b/apps/openmw/mwrender/mwscene.hpp @@ -87,9 +87,9 @@ namespace MWRender /// Change object's scale. void scaleObject (const std::string& handle, float scale); - /// Set collision mode for player. If disabled player object should ignore + /// Toggle collision mode for player. If disabled player object should ignore /// collisions and gravity. - void setCollsionMode (bool enabled); + void toggleCollisionMode(); }; } diff --git a/apps/openmw/mwscript/controlextensions.cpp b/apps/openmw/mwscript/controlextensions.cpp index 5020675d1..f5a5c08a4 100644 --- a/apps/openmw/mwscript/controlextensions.cpp +++ b/apps/openmw/mwscript/controlextensions.cpp @@ -46,7 +46,7 @@ namespace MWScript InterpreterContext& context = static_cast (runtime.getContext()); - context.getWorld().getPlayer().toggleCollisionMode(); + context.getWorld().toggleCollisionMode(); } }; diff --git a/apps/openmw/mwworld/world.cpp b/apps/openmw/mwworld/world.cpp index 9d975879e..66f866b07 100644 --- a/apps/openmw/mwworld/world.cpp +++ b/apps/openmw/mwworld/world.cpp @@ -855,4 +855,9 @@ namespace MWWorld { mScene.doPhysics (duration, *this, actors); } + + void World::toggleCollisionMode() + { + mScene.toggleCollisionMode(); + } } diff --git a/apps/openmw/mwworld/world.hpp b/apps/openmw/mwworld/world.hpp index becdd7072..5cd99d9cd 100644 --- a/apps/openmw/mwworld/world.hpp +++ b/apps/openmw/mwworld/world.hpp @@ -179,6 +179,10 @@ namespace MWWorld void doPhysics (const std::vector >& actors, float duration); ///< Run physics simulation and modify \a world accordingly. + + void toggleCollisionMode(); + ///< Toggle collision mode for player. If disabled player object should ignore + /// collisions and gravity. }; }