From 39a12ab9cf0dcfdfd75a6899409e38f26affef4c Mon Sep 17 00:00:00 2001 From: k1ll Date: Thu, 27 Jun 2013 19:20:14 +0200 Subject: [PATCH 1/4] CXX Flags aren't definitions --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6948a3420..f2b1fcd4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -321,15 +321,15 @@ endif() # Compiler settings if (CMAKE_COMPILER_IS_GNUCC) - add_definitions (-Wall -Wextra -Wno-unused-parameter -Wno-reorder -std=c++98 -pedantic -Wno-long-long) + SET(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-reorder -std=c++98 -pedantic -Wno-long-long ${CMAKE_CXX_FLAGS}") # Silence warnings in OGRE headers. Remove once OGRE got fixed! - add_definitions (-Wno-ignored-qualifiers) + SET(CMAKE_CXX_FLAGS "-Wno-ignored-qualifiers ${CMAKE_CXX_FLAGS}") execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) if ("${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6) - add_definitions (-Wno-unused-but-set-parameter) + SET(CMAKE_CXX_FLAGS "-Wno-unused-but-set-parameter ${CMAKE_CXX_FLAGS}") endif("${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6) endif (CMAKE_COMPILER_IS_GNUCC) From b095c2485418d3588b811dcd7da37f23a5fefabd Mon Sep 17 00:00:00 2001 From: Vincent Heuken Date: Thu, 27 Jun 2013 14:11:20 -0700 Subject: [PATCH 2/4] resize actor collision boxes on death --- apps/openmw/mwbase/world.hpp | 2 ++ apps/openmw/mwmechanics/character.cpp | 4 ++++ apps/openmw/mwworld/worldimp.cpp | 14 ++++++++++++++ apps/openmw/mwworld/worldimp.hpp | 2 ++ 4 files changed, 22 insertions(+) diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 86a6a89d2..cf41f97df 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -345,6 +345,8 @@ namespace MWBase virtual void getItemsOwnedBy (const MWWorld::Ptr& npc, std::vector& out) = 0; ///< get all items in active cells owned by this Npc + virtual void enableActorCollision(const MWWorld::Ptr& actor, bool enable) = 0; + virtual void setupExternalRendering (MWRender::ExternalRendering& rendering) = 0; virtual int canRest() = 0; diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index abc6b82c4..d3dbb9325 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -462,6 +462,10 @@ void CharacterController::update(float duration, Movement &movement) mAnimation->disable("torch"); } } + else if (cls.getCreatureStats(mPtr).isDead()) + { + MWBase::Environment::get().getWorld()->enableActorCollision(mPtr, false); + } if(mAnimation && !mSkipAnim) { diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 16cba2ea8..662d46a4b 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1751,4 +1751,18 @@ namespace MWWorld out.push_back(searchPtrViaHandle(*it)); } } + + void World::enableActorCollision(const MWWorld::Ptr& actor, bool enable) + { + OEngine::Physic::PhysicActor *physicActor = mPhysEngine->getCharacter(actor.getRefData().getHandle()); + + if (!enable) + { + physicActor->setScale(0.15); + } + else + { + physicActor->setScale(1); + } + } } diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index 12438efd4..5cf3a24bf 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -394,6 +394,8 @@ namespace MWWorld virtual void getItemsOwnedBy (const MWWorld::Ptr& npc, std::vector& out); ///< get all items in active cells owned by this Npc + virtual void enableActorCollision(const MWWorld::Ptr& actor, bool enable); + virtual void setupExternalRendering (MWRender::ExternalRendering& rendering); virtual int canRest(); From f43b48015e487f80810e52c12f0d4f5b4f5df2bb Mon Sep 17 00:00:00 2001 From: Vincent Heuken Date: Thu, 27 Jun 2013 19:42:27 -0700 Subject: [PATCH 3/4] remove actor's collisionbox on death --- apps/openmw/mwworld/worldimp.cpp | 6 +++--- libs/openengine/bullet/physic.cpp | 10 ++++++++++ libs/openengine/bullet/physic.hpp | 3 +++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 662d46a4b..0a1e0ccdc 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1756,13 +1756,13 @@ namespace MWWorld { OEngine::Physic::PhysicActor *physicActor = mPhysEngine->getCharacter(actor.getRefData().getHandle()); - if (!enable) + if (enable) { - physicActor->setScale(0.15); + physicActor->enableCollisionBody(); } else { - physicActor->setScale(1); + physicActor->disableCollisionBody(); } } } diff --git a/libs/openengine/bullet/physic.cpp b/libs/openengine/bullet/physic.cpp index bbe633847..550e71b3c 100644 --- a/libs/openengine/bullet/physic.cpp +++ b/libs/openengine/bullet/physic.cpp @@ -146,6 +146,16 @@ namespace Physic return collisionMode && onGround; } + void PhysicActor::disableCollisionBody() + { + mEngine->dynamicsWorld->removeRigidBody(mBody); + } + + void PhysicActor::enableCollisionBody() + { + mEngine->dynamicsWorld->addRigidBody(mBody); + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/libs/openengine/bullet/physic.hpp b/libs/openengine/bullet/physic.hpp index 80c681fe5..baeb31678 100644 --- a/libs/openengine/bullet/physic.hpp +++ b/libs/openengine/bullet/physic.hpp @@ -129,6 +129,9 @@ namespace Physic bool getOnGround() const; + void disableCollisionBody(); + void enableCollisionBody(); + //HACK: in Visual Studio 2010 and presumably above, this structures alignment // must be 16, but the built in operator new & delete don't properly // perform this alignment. From cd538538b563e3ac99948032b56ba52fc4a1c586 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 28 Jun 2013 09:00:21 +0200 Subject: [PATCH 4/4] fixed weather code --- apps/openmw/mwworld/weather.cpp | 53 +++++++++++++++++---------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/apps/openmw/mwworld/weather.cpp b/apps/openmw/mwworld/weather.cpp index 10dbdae9b..467d7e7c8 100644 --- a/apps/openmw/mwworld/weather.cpp +++ b/apps/openmw/mwworld/weather.cpp @@ -572,35 +572,36 @@ Ogre::String WeatherManager::nextWeather(const ESM::Region* region) const int chance = (rand() % 100) + 1; // 1..100 int sum = 0; - for (int i = 0; i < 10; ++i) + int i = 0; + for (; i < 10; ++i) { sum += probability[i]; if (chance < sum) - { - switch (i) - { - case 1: - return "cloudy"; - case 2: - return "foggy"; - case 3: - return "overcast"; - case 4: - return "rain"; - case 5: - return "thunderstorm"; - case 6: - return "ashstorm"; - case 7: - return "blight"; - case 8: - return "snow"; - case 9: - return "blizzard"; - default: // case 0 - return "clear"; - } - } + break; + } + + switch (i) + { + case 1: + return "cloudy"; + case 2: + return "foggy"; + case 3: + return "overcast"; + case 4: + return "rain"; + case 5: + return "thunderstorm"; + case 6: + return "ashstorm"; + case 7: + return "blight"; + case 8: + return "snow"; + case 9: + return "blizzard"; + default: // case 0 + return "clear"; } }