diff --git a/Sources/Plasma/PubUtilLib/plModifier/plDetectorLog.cpp b/Sources/Plasma/PubUtilLib/plModifier/plDetectorLog.cpp index 23246e5b..306837c5 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plDetectorLog.cpp +++ b/Sources/Plasma/PubUtilLib/plModifier/plDetectorLog.cpp @@ -48,6 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com void DetectorLog(const char* format, ...) {} void DetectorLogSpecial(const char* format, ...) {} void DetectorLogRed(const char* format, ...) {} +void DetectorLogYellow(const char* format, ...) {} #else @@ -90,5 +91,12 @@ void DetectorLogRed(const char* format, ...) va_end(args); } +void DetectorLogYellow(const char* format, ...) +{ + va_list args; + va_start(args, format); + gLog->AddLineV(plStatusLog::kYellow, format, args); + va_end(args); +} #endif // PLASMA_EXTERNAL_RELEASE diff --git a/Sources/Plasma/PubUtilLib/plModifier/plDetectorLog.h b/Sources/Plasma/PubUtilLib/plModifier/plDetectorLog.h index 3e3c7590..50c3cafa 100644 --- a/Sources/Plasma/PubUtilLib/plModifier/plDetectorLog.h +++ b/Sources/Plasma/PubUtilLib/plModifier/plDetectorLog.h @@ -45,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com void DetectorLog(const char* format, ...); void DetectorLogSpecial(const char* format, ...); void DetectorLogRed(const char* format, ...); +void DetectorLogYellow(const char* format, ...); void DetectorDoLogfile(); #endif // plDetectorLog_h_inc \ No newline at end of file diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp index 58c53d19..f4a79da7 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp @@ -40,6 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "plPXPhysicalControllerCore.h" +#include "plgDispatch.h" #include "plSimulationMgr.h" #include "plPXPhysical.h" #include "plPXConvert.h" @@ -372,13 +373,6 @@ void plPXPhysicalControllerCore::ISetGlobalLoc(const hsMatrix44& l2w) plPXPhysicalControllerCore::~plPXPhysicalControllerCore() { IDeleteController(); - //need to make sure my queued messages are released - for(int j=0;jAddReceiver(physical->GetObjectKey()); if(!deferUntilNextSim) { -#ifndef PLASMA_EXTERNAL_RELEASE - DetectorLog("Sending an %s msg to %s" , entering? "entering":"exit", physical->GetObjectKey()->GetName()); -#endif - msg->Send(); + DetectorLog("Sending an %s msg to %s" , entering? "entering":"exit", physical->GetObjectKey()->GetName()); + msg->Send(); } else { -#ifndef PLASMA_EXTERNAL_RELEASE - DetectorLog("Queuing an %s msg to %s, which will be sent after the next simstep" , entering? "entering":"exit", physical->GetObjectKey()->GetName()); -#endif - //these will be fired in update prestep on the next lap - fQueuedCollideMsgs.Append(msg); + DetectorLog("Queuing an %s msg to %s, which will be sent after the client update" , entering? "entering":"exit", physical->GetObjectKey()->GetName()); + plgDispatch::Dispatch()->MsgQueue(msg); } } } } } -#ifndef PLASMA_EXTERNAL_RELEASE DetectorLog("Done informing from plPXPhysicalControllerCore::IInformDetectors"); -#endif } } void plPXPhysicalControllerCore::Move(hsVector3 displacement, unsigned int collideWith, unsigned int &collisionResults) @@ -932,16 +919,6 @@ void plPXPhysicalControllerCore::UpdatePrestep(hsScalar delSecs) if(ac) { if(ac->fNeedsResize)ac->IHandleResize(); - int storedCollideMsgs=ac->fQueuedCollideMsgs.GetCount(); - if(storedCollideMsgs) - { - plSimulationMgr* simMgr=plSimulationMgr::GetInstance(); - for(int j=0; jAddCollisionMsg(ac->fQueuedCollideMsgs[j]); - } - ac->fQueuedCollideMsgs.SetCount(0); - } ac->Apply(delSecs); } #ifndef PLASMA_EXTERNAL_RELEASE diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h index 4795cba4..8a99e59c 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h +++ b/Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.h @@ -151,7 +151,6 @@ protected: void IDrawDebugDisplay(); #endif void IHandleResize(); - hsTArray fQueuedCollideMsgs; hsScalar fPreferedRadius; hsScalar fPreferedHeight; // The global position and rotation of the avatar last time we set it (so we diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp b/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp index 895e09dc..52d5320e 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp +++ b/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp @@ -43,6 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include +#include "plgDispatch.h" #include "hsTimer.h" #include "plProfile.h" #include "plPXPhysical.h" @@ -206,13 +207,13 @@ class SensorReport : public NxUserTriggerReport void SendCollisionMsg(plKey receiver, plKey hitter, hsBool entering) { + DetectorLogYellow("Collision: %s was triggered by %s. Sending an %s msg", receiver->GetName(), + hitter ? hitter->GetName() : "(nil)" , entering ? "'enter'" : "'exit'"); plCollideMsg* msg = TRACKED_NEW plCollideMsg; msg->fOtherKey = hitter; msg->fEntering = entering; msg->AddReceiver(receiver); -// msg->Send();\ - //placing message in a list to be fired off after sim step - plSimulationMgr::GetInstance()->AddCollisionMsg(msg); + plgDispatch::Dispatch()->MsgQueue(msg); // Sends the msg on the next client update } } gSensorReport; @@ -536,6 +537,8 @@ void plSimulationMgr::ReleaseScene(plKey world) void plSimulationMgr::ISendCollisionMsg(plKey receiver, plKey hitter, hsBool entering) { + DetectorLogYellow("Collision: %s is inside %s. Sending an %s msg", hitter ? hitter->GetName() : "(nil)", + receiver->GetName(), entering ? "'enter'" : "'exit'"); plCollideMsg* msg = TRACKED_NEW plCollideMsg; msg->fOtherKey = hitter; msg->fEntering = entering; @@ -543,34 +546,6 @@ void plSimulationMgr::ISendCollisionMsg(plKey receiver, plKey hitter, hsBool ent msg->Send(); } -void plSimulationMgr::AddCollisionMsg(plCollideMsg* msg) -{ - fCollisionMessages.Append(msg); -} -void plSimulationMgr::IDispatchCollisionMessages() -{ - if(fCollisionMessages.GetCount()) - { -#ifndef PLASMA_EXTERNAL_RELEASE - DetectorLog("--------------------------------------------------"); - DetectorLog("Dispatching collision messages from last sim step"); -#endif - for(int i=0; iGetReceiver(0)->GetName(), - fCollisionMessages[i]->GetSender()?fCollisionMessages[i]->GetSender()->GetName():"An Avatar", - fCollisionMessages[i]->fEntering? "enter" : "exit"); -#endif - fCollisionMessages[i]->Send(); - } -#ifndef PLASMA_EXTERNAL_RELEASE - DetectorLog("--------------------------------------------------"); -#endif - fCollisionMessages.SetCount(0); - } -} - void plSimulationMgr::UpdateDetectorsInScene(plKey world, plKey avatar, hsPoint3& pos, bool entering) { // search thru the actors in a scene looking for convex hull detectors and see if the avatar is inside it @@ -679,9 +654,6 @@ void plSimulationMgr::Advance(float delSecs) } } plPXPhysicalControllerCore::UpdatePostSimStep(delSecs); - - //sending off and clearing the Collision Messages generated by scene->simulate - IDispatchCollisionMessages(); plProfile_EndTiming(Step); #ifndef PLASMA_EXTERNAL_RELEASE diff --git a/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.h b/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.h index 67843266..18448172 100644 --- a/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.h +++ b/Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.h @@ -139,12 +139,6 @@ protected: plPhysicsSoundMgr* fSoundMgr; - //a list of collision messages generated by the simulation steps. Added to by AddCollisionMsg(plCollideMsg* msg) - //cleared by IDispatchCollisionMessages when done - hsTArray fCollisionMessages; - - void IDispatchCollisionMessages(); - // A mapping from a key to a PhysX scene. The key is either the // SimulationMgr key, for the main world, or a SceneObject key if it's a // subworld.