From 7eee54bcd79cfbbc9d4b2046aad318221df38f59 Mon Sep 17 00:00:00 2001 From: Jason Hooks Date: Sun, 25 Dec 2011 01:52:57 -0500 Subject: [PATCH] More physics and managing of Animation objects --- apps/openmw/mwclass/npc.cpp | 13 ++++++++++--- apps/openmw/mwrender/actors.cpp | 15 ++++++--------- apps/openmw/mwworld/physicssystem.cpp | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index cedca5bca..e09cd6051 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -45,9 +45,16 @@ namespace MWClass const std::string &model = ref->base->model; assert (ref->base != NULL); - if(!model.empty()){ - physics.insertActorPhysics(ptr, "meshes\\" + model); - } + std::string headID = ref->base->head; + std::string bodyRaceID = headID.substr(0, headID.find_last_of("head_") - 4); + bool beast = bodyRaceID == "b_n_khajiit_m_" || bodyRaceID == "b_n_khajiit_f_" || bodyRaceID == "b_n_argonian_m_" || bodyRaceID == "b_n_argonian_f_"; + + + std::string smodel = "meshes\\base_anim.nif"; + if(beast) + smodel = "meshes\\base_animkna.nif"; + physics.insertActorPhysics(ptr, smodel); + } diff --git a/apps/openmw/mwrender/actors.cpp b/apps/openmw/mwrender/actors.cpp index 7c5aaeec2..dc99d8809 100644 --- a/apps/openmw/mwrender/actors.cpp +++ b/apps/openmw/mwrender/actors.cpp @@ -98,18 +98,15 @@ void Actors::removeCell(MWWorld::Ptr::CellStore* store){ { Ogre::SceneNode* base = mCellSceneNodes[store]; base->removeAndDestroyAllChildren(); - - - - - - - - - mCellSceneNodes.erase(store); mRend.getScene()->destroySceneNode(base); base = 0; } + for(std::map::iterator iter = mAllActors.begin(); iter != mAllActors.end(); iter++) + { + if(iter->first.getCell() == store){ + mAllActors.erase(iter); + } + } } \ No newline at end of file diff --git a/apps/openmw/mwworld/physicssystem.cpp b/apps/openmw/mwworld/physicssystem.cpp index 8212dbeea..cfe5edab4 100644 --- a/apps/openmw/mwworld/physicssystem.cpp +++ b/apps/openmw/mwworld/physicssystem.cpp @@ -191,7 +191,7 @@ namespace MWWorld void PhysicsSystem::insertActorPhysics(const MWWorld::Ptr& ptr, const std::string model){ Ogre::SceneNode* node = ptr.getRefData().getBaseNode(); - std::cout << "Adding node with name" << node->getName(); + // std::cout << "Adding node with name" << node->getName(); addActor (node->getName(), model, node->getPosition()); }