1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-01 19:45:35 +00:00
This commit is contained in:
Sebastian Wick 2013-07-04 01:21:37 +02:00
commit f29e30d21d
8 changed files with 65 additions and 29 deletions

View file

@ -321,15 +321,15 @@ endif()
# Compiler settings # Compiler settings
if (CMAKE_COMPILER_IS_GNUCC) 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! # 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 execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION) OUTPUT_VARIABLE GCC_VERSION)
if ("${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6) 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("${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
endif (CMAKE_COMPILER_IS_GNUCC) endif (CMAKE_COMPILER_IS_GNUCC)

View file

@ -345,6 +345,8 @@ namespace MWBase
virtual void getItemsOwnedBy (const MWWorld::Ptr& npc, std::vector<MWWorld::Ptr>& out) = 0; virtual void getItemsOwnedBy (const MWWorld::Ptr& npc, std::vector<MWWorld::Ptr>& out) = 0;
///< get all items in active cells owned by this Npc ///< 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 void setupExternalRendering (MWRender::ExternalRendering& rendering) = 0;
virtual int canRest() = 0; virtual int canRest() = 0;

View file

@ -462,6 +462,10 @@ void CharacterController::update(float duration, Movement &movement)
mAnimation->disable("torch"); mAnimation->disable("torch");
} }
} }
else if (cls.getCreatureStats(mPtr).isDead())
{
MWBase::Environment::get().getWorld()->enableActorCollision(mPtr, false);
}
if(mAnimation && !mSkipAnim) if(mAnimation && !mSkipAnim)
{ {

View file

@ -572,11 +572,14 @@ Ogre::String WeatherManager::nextWeather(const ESM::Region* region) const
int chance = (rand() % 100) + 1; // 1..100 int chance = (rand() % 100) + 1; // 1..100
int sum = 0; int sum = 0;
for (int i = 0; i < 10; ++i) int i = 0;
for (; i < 10; ++i)
{ {
sum += probability[i]; sum += probability[i];
if (chance < sum) if (chance < sum)
{ break;
}
switch (i) switch (i)
{ {
case 1: case 1:
@ -601,8 +604,6 @@ Ogre::String WeatherManager::nextWeather(const ESM::Region* region) const
return "clear"; return "clear";
} }
} }
}
}
void WeatherManager::setHour(const float hour) void WeatherManager::setHour(const float hour)
{ {

View file

@ -1751,4 +1751,18 @@ namespace MWWorld
out.push_back(searchPtrViaHandle(*it)); 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->enableCollisionBody();
}
else
{
physicActor->disableCollisionBody();
}
}
} }

View file

@ -394,6 +394,8 @@ namespace MWWorld
virtual void getItemsOwnedBy (const MWWorld::Ptr& npc, std::vector<MWWorld::Ptr>& out); virtual void getItemsOwnedBy (const MWWorld::Ptr& npc, std::vector<MWWorld::Ptr>& out);
///< get all items in active cells owned by this Npc ///< 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 void setupExternalRendering (MWRender::ExternalRendering& rendering);
virtual int canRest(); virtual int canRest();

View file

@ -146,6 +146,16 @@ namespace Physic
return collisionMode && onGround; return collisionMode && onGround;
} }
void PhysicActor::disableCollisionBody()
{
mEngine->dynamicsWorld->removeRigidBody(mBody);
}
void PhysicActor::enableCollisionBody()
{
mEngine->dynamicsWorld->addRigidBody(mBody);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -129,6 +129,9 @@ namespace Physic
bool getOnGround() const; bool getOnGround() const;
void disableCollisionBody();
void enableCollisionBody();
//HACK: in Visual Studio 2010 and presumably above, this structures alignment //HACK: in Visual Studio 2010 and presumably above, this structures alignment
// must be 16, but the built in operator new & delete don't properly // must be 16, but the built in operator new & delete don't properly
// perform this alignment. // perform this alignment.