Browse Source

Really fix those bizarre panic links

Looks like Cyan never actually stopped simulating, so we simulate through
adding objects to the scene and positioning them. This is a bad thing(TM),
so now we suspend/resume the simulation on plAgeLoadedMsg.
Adam Johnson 13 years ago
parent
commit
33dbdce2f1
  1. 10
      Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp

10
Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp

@ -56,6 +56,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnSceneObject/plCoordinateInterface.h" #include "pnSceneObject/plCoordinateInterface.h"
#include "pnNetCommon/plSDLTypes.h" #include "pnNetCommon/plSDLTypes.h"
#include "plMessage/plCollideMsg.h" #include "plMessage/plCollideMsg.h"
#include "plMessage/plAgeLoadedMsg.h"
#include "plModifier/plDetectorLog.h" #include "plModifier/plDetectorLog.h"
@ -358,6 +359,7 @@ void plSimulationMgr::Init()
{ {
gTheInstance->RegisterAs(kSimulationMgr_KEY); gTheInstance->RegisterAs(kSimulationMgr_KEY);
gTheInstance->GetKey()->RefObject(); gTheInstance->GetKey()->RefObject();
plgDispatch::Dispatch()->RegisterForExactType(plAgeLoadedMsg::Index(), gTheInstance->GetKey());
} }
else else
{ {
@ -377,6 +379,7 @@ void plSimulationMgr::Shutdown()
// UnRef to match our Ref in Init(). Unless something strange is // UnRef to match our Ref in Init(). Unless something strange is
// going on, this should destroy the instance and set gTheInstance to nil. // going on, this should destroy the instance and set gTheInstance to nil.
// gTheInstance->GetKey()->UnRefObject(); // gTheInstance->GetKey()->UnRefObject();
plgDispatch::Dispatch()->UnRegisterForExactType(plAgeLoadedMsg::Index(), gTheInstance->GetKey());
gTheInstance->UnRegister(); // this will destroy the instance gTheInstance->UnRegister(); // this will destroy the instance
gTheInstance = nil; gTheInstance = nil;
} }
@ -756,6 +759,13 @@ void plSimulationMgr::ISendUpdates()
hsBool plSimulationMgr::MsgReceive(plMessage *msg) hsBool plSimulationMgr::MsgReceive(plMessage *msg)
{ {
// Suspend/resume the simulation based on whether or not we're in an age...
if (plAgeLoadedMsg* aMsg = plAgeLoadedMsg::ConvertNoRef(msg))
{
fSuspended = !aMsg->fLoaded;
return true;
}
return hsKeyedObject::MsgReceive(msg); return hsKeyedObject::MsgReceive(msg);
} }

Loading…
Cancel
Save