Browse Source

Fix some %s errors in plPhysX

Michael Hansen 13 years ago
parent
commit
4b70d592c9
  1. 4
      Sources/Plasma/PubUtilLib/plPhysX/plLOSDispatch.cpp
  2. 20
      Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp
  3. 6
      Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp
  4. 32
      Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp

4
Sources/Plasma/PubUtilLib/plPhysX/plLOSDispatch.cpp

@ -226,7 +226,7 @@ hsBool plLOSDispatch::MsgReceive(plMessage* msg)
scene->raycastAllShapes(worldRay, gMyReport, NX_ALL_SHAPES, 0xffffffff, dist, NX_RAYCAST_DISTANCE | NX_RAYCAST_IMPACT | NX_RAYCAST_NORMAL); scene->raycastAllShapes(worldRay, gMyReport, NX_ALL_SHAPES, 0xffffffff, dist, NX_RAYCAST_DISTANCE | NX_RAYCAST_IMPACT | NX_RAYCAST_NORMAL);
} }
else{ else{
SimLog("%s sent out a LOS request with a ray length of %d.", requestMsg->GetSender()->GetName(), dist); SimLog("%s sent out a LOS request with a ray length of %d.", requestMsg->GetSender()->GetName().c_str(), dist);
} }
if (gMyReport.GotHit()) if (gMyReport.GotHit())
{ {
@ -259,7 +259,7 @@ hsBool plLOSDispatch::MsgReceive(plMessage* msg)
else// we are right on top of the object I assume that means we hit it else// we are right on top of the object I assume that means we hit it
{// since PhysX would have complained we will log it anyways. Just so we have a better idea, where this {// since PhysX would have complained we will log it anyways. Just so we have a better idea, where this
//was happening previously //was happening previously
SimLog("%s sent out a LOS request. The second cast for culling was of length 0. ABORTING and assuming hit.", requestMsg->GetSender()->GetName()); SimLog("%s sent out a LOS request. The second cast for culling was of length 0. ABORTING and assuming hit.", requestMsg->GetSender()->GetName().c_str());
} }
} }

20
Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp

@ -84,7 +84,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define SpamMsg(x) #define SpamMsg(x)
#endif #endif
#define LogActivate(func) if (fActor->isSleeping()) SimLog("%s activated by %s", GetKeyName(), func); #define LogActivate(func) if (fActor->isSleeping()) SimLog("%s activated by %s", GetKeyName().c_str(), func);
PhysRecipe::PhysRecipe() PhysRecipe::PhysRecipe()
: mass(0.f) : mass(0.f)
@ -152,7 +152,7 @@ plPXPhysical::plPXPhysical()
plPXPhysical::~plPXPhysical() plPXPhysical::~plPXPhysical()
{ {
SpamMsg(plSimulationMgr::Log("Destroying physical %s", GetKeyName())); SpamMsg(plSimulationMgr::Log("Destroying physical %s", GetKeyName().c_str()));
if (fActor) if (fActor)
{ {
@ -345,9 +345,9 @@ hsBool plPXPhysical::Should_I_Trigger(hsBool enter, hsPoint3& pos)
#ifdef PHYSX_SAVE_TRIGGERS_WORKAROUND #ifdef PHYSX_SAVE_TRIGGERS_WORKAROUND
trigger = true; trigger = true;
fInsideConvexHull = enter; fInsideConvexHull = enter;
DetectorLogSpecial("**>Saved a missing enter collision: %s",GetObjectKey()->GetName()); DetectorLogSpecial("**>Saved a missing enter collision: %s",GetObjectKey()->GetName().c_str());
#else #else
DetectorLogSpecial("**>Could have saved a missing enter collision: %s",GetObjectKey()->GetName()); DetectorLogSpecial("**>Could have saved a missing enter collision: %s",GetObjectKey()->GetName().c_str());
#endif PHYSX_SAVE_TRIGGERS_WORKAROUND #endif PHYSX_SAVE_TRIGGERS_WORKAROUND
} }
} }
@ -436,7 +436,7 @@ hsBool plPXPhysical::Init(PhysRecipe& recipe)
case plSimDefs::kProxyBounds: case plSimDefs::kProxyBounds:
if (fGroup == plSimDefs::kGroupDetector) if (fGroup == plSimDefs::kGroupDetector)
{ {
SimLog("Someone using an Exact on a detector region: %s", GetKeyName()); SimLog("Someone using an Exact on a detector region: %s", GetKeyName().c_str());
} }
trimeshShapeDesc.meshData = recipe.triMesh; trimeshShapeDesc.meshData = recipe.triMesh;
trimeshShapeDesc.userData = recipe.meshStream; trimeshShapeDesc.userData = recipe.meshStream;
@ -489,7 +489,7 @@ hsBool plPXPhysical::Init(PhysRecipe& recipe)
else else
{ {
if ( GetProperty(plSimulationInterface::kPhysAnim) ) if ( GetProperty(plSimulationInterface::kPhysAnim) )
SimLog("An animated physical that has no mass: %s", GetKeyName()); SimLog("An animated physical that has no mass: %s", GetKeyName().c_str());
} }
actorDesc.userData = this; actorDesc.userData = this;
@ -536,7 +536,7 @@ hsBool plPXPhysical::Init(PhysRecipe& recipe)
if (!fActor->isSleeping()) if (!fActor->isSleeping())
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
SimLog("Deactivating %s in SetPositionAndRotationSim", GetKeyName()); SimLog("Deactivating %s in SetPositionAndRotationSim", GetKeyName().c_str());
fActor->putToSleep(); fActor->putToSleep();
} }
} }
@ -795,7 +795,7 @@ void plPXPhysical::SendNewLocation(hsBool synchTransform, hsBool isSynchUpdate)
if (fCachedLocal2World.GetTranslate().fZ < kMaxNegativeZPos) if (fCachedLocal2World.GetTranslate().fZ < kMaxNegativeZPos)
{ {
SimLog("Physical %s fell to %.1f (%.1f is the max). Suppressing.", GetKeyName(), fCachedLocal2World.GetTranslate().fZ, kMaxNegativeZPos); SimLog("Physical %s fell to %.1f (%.1f is the max). Suppressing.", GetKeyName().c_str(), fCachedLocal2World.GetTranslate().fZ, kMaxNegativeZPos);
// Since this has probably been falling for a while, and thus not getting any syncs, // Since this has probably been falling for a while, and thus not getting any syncs,
// make sure to save it's current pos so we'll know to reset it later // make sure to save it's current pos so we'll know to reset it later
DirtySynchState(kSDLPhysical, plSynchedObject::kBCastToClients); DirtySynchState(kSDLPhysical, plSynchedObject::kBCastToClients);
@ -936,7 +936,7 @@ void plPXPhysical::SetTransform(const hsMatrix44& l2w, const hsMatrix44& w2l, hs
else else
{ {
if ( !fActor->isDynamic() && plSimulationMgr::fExtraProfile) if ( !fActor->isDynamic() && plSimulationMgr::fExtraProfile)
SimLog("Setting transform on non-dynamic: %s.", GetKeyName()); SimLog("Setting transform on non-dynamic: %s.", GetKeyName().c_str());
} }
} }
@ -1228,7 +1228,7 @@ void plPXPhysical::SetSyncState(hsPoint3* pos, hsQuat* rot, hsVector3* linV, hsV
// we've got right now) // we've got right now)
if (pos && pos->fZ < kMaxNegativeZPos && initialSync) if (pos && pos->fZ < kMaxNegativeZPos && initialSync)
{ {
SimLog("Physical %s loaded out of range state. Forcing initial state to server.", GetKeyName()); SimLog("Physical %s loaded out of range state. Forcing initial state to server.", GetKeyName().c_str());
DirtySynchState(kSDLPhysical, plSynchedObject::kBCastToClients); DirtySynchState(kSDLPhysical, plSynchedObject::kBCastToClients);
return; return;
} }

6
Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp

@ -703,12 +703,12 @@ void plPXPhysicalControllerCore::IInformDetectors(bool entering,bool deferUntilN
msg->AddReceiver(physical->GetObjectKey()); msg->AddReceiver(physical->GetObjectKey());
if(!deferUntilNextSim) if(!deferUntilNextSim)
{ {
DetectorLog("Sending an %s msg to %s" , entering? "entering":"exit", physical->GetObjectKey()->GetName()); DetectorLog("Sending an %s msg to %s" , entering? "entering":"exit", physical->GetObjectKey()->GetName().c_str());
msg->Send(); msg->Send();
} }
else else
{ {
DetectorLog("Queuing an %s msg to %s, which will be sent after the client update" , entering? "entering":"exit", physical->GetObjectKey()->GetName()); DetectorLog("Queuing an %s msg to %s, which will be sent after the client update" , entering? "entering":"exit", physical->GetObjectKey()->GetName().c_str());
plgDispatch::Dispatch()->MsgQueue(msg); plgDispatch::Dispatch()->MsgQueue(msg);
} }
} }
@ -1217,7 +1217,7 @@ void plPXPhysicalControllerCore::IDrawDebugDisplay()
char *overlapStr = fDbgCollisionInfo[i].fOverlap ? "yes" : "no"; char *overlapStr = fDbgCollisionInfo[i].fOverlap ? "yes" : "no";
float angle = hsRadiansToDegrees(acos(normal * hsVector3(0, 0, 1))); float angle = hsRadiansToDegrees(acos(normal * hsVector3(0, 0, 1)));
sprintf(strBuf, " Obj: %s, Normal: (%.2f, %.2f, %.2f), Angle(%.1f), Overlap(%3s)", sprintf(strBuf, " Obj: %s, Normal: (%.2f, %.2f, %.2f), Angle(%.1f), Overlap(%3s)",
fDbgCollisionInfo[i].fSO->GetKeyName(), fDbgCollisionInfo[i].fSO->GetKeyName().c_str(),
normal.fX, normal.fY, normal.fZ, angle, overlapStr); normal.fX, normal.fY, normal.fZ, angle, overlapStr);
debugTxt.DrawString(x, y, strBuf); debugTxt.DrawString(x, y, strBuf);
y += lineHeight; y += lineHeight;

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

@ -80,7 +80,7 @@ class SensorReport : public NxUserTriggerReport
hsPoint3 otherPos = plPXConvert::Point(otherShape.getGlobalPosition()); hsPoint3 otherPos = plPXConvert::Point(otherShape.getGlobalPosition());
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
DetectorLogRed("-->%s %s (status=%x) other@(%f,%f,%f)",triggerPhys->GetObjectKey()->GetName(),status & NX_TRIGGER_ON_ENTER ? "enter" : "exit",status,otherPos.fX,otherPos.fY,otherPos.fZ); DetectorLogRed("-->%s %s (status=%x) other@(%f,%f,%f)",triggerPhys->GetObjectKey()->GetName().c_str(),status & NX_TRIGGER_ON_ENTER ? "enter" : "exit",status,otherPos.fX,otherPos.fY,otherPos.fZ);
plPXPhysical* otherPhys = (plPXPhysical*)otherShape.getActor().userData; plPXPhysical* otherPhys = (plPXPhysical*)otherShape.getActor().userData;
if (otherPhys) if (otherPhys)
@ -90,7 +90,7 @@ class SensorReport : public NxUserTriggerReport
if (!doReport) if (!doReport)
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
DetectorLogRed("<--Kill collision %s :failed group. US=%x OTHER=(%s)%x",triggerPhys->GetObjectKey()->GetName(),triggerPhys->GetGroup(),otherPhys->GetObjectKey()->GetName(),otherPhys->GetGroup()); DetectorLogRed("<--Kill collision %s :failed group. US=%x OTHER=(%s)%x",triggerPhys->GetObjectKey()->GetName().c_str(),triggerPhys->GetGroup(),otherPhys->GetObjectKey()->GetName().c_str(),otherPhys->GetGroup());
} }
} }
else else
@ -103,7 +103,7 @@ class SensorReport : public NxUserTriggerReport
{ {
#ifdef PHYSX_ONLY_TRIGGER_FROM_KINEMATIC #ifdef PHYSX_ONLY_TRIGGER_FROM_KINEMATIC
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
DetectorLogRed("<--Kill collision %s : ignoring controller events.",triggerPhys->GetObjectKey()->GetName()); DetectorLogRed("<--Kill collision %s : ignoring controller events.",triggerPhys->GetObjectKey()->GetName().c_str());
return; return;
#else // else if trigger on both controller and kinematic #else // else if trigger on both controller and kinematic
// only suppress controller collision 'enters' when disabled but let 'exits' continue // only suppress controller collision 'enters' when disabled but let 'exits' continue
@ -111,7 +111,7 @@ class SensorReport : public NxUserTriggerReport
if ( ( !controller->IsEnabled() /*&& (status & NX_TRIGGER_ON_ENTER)*/ ) || controller->IsKinematic() ) if ( ( !controller->IsEnabled() /*&& (status & NX_TRIGGER_ON_ENTER)*/ ) || controller->IsKinematic() )
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
DetectorLogRed("<--Kill collision %s : controller is not enabled.",triggerPhys->GetObjectKey()->GetName()); DetectorLogRed("<--Kill collision %s : controller is not enabled.",triggerPhys->GetObjectKey()->GetName().c_str());
return; return;
} }
#endif // PHYSX_ONLY_TRIGGER_FROM_KINEMATIC #endif // PHYSX_ONLY_TRIGGER_FROM_KINEMATIC
@ -124,7 +124,7 @@ class SensorReport : public NxUserTriggerReport
if ( !controller->IsKinematic() /*&& (status & NX_TRIGGER_ON_ENTER) */ ) if ( !controller->IsKinematic() /*&& (status & NX_TRIGGER_ON_ENTER) */ )
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
DetectorLogRed("<--Kill collision %s : kinematic is not enabled.",triggerPhys->GetObjectKey()->GetName()); DetectorLogRed("<--Kill collision %s : kinematic is not enabled.",triggerPhys->GetObjectKey()->GetName().c_str());
return; return;
} }
} }
@ -135,7 +135,7 @@ class SensorReport : public NxUserTriggerReport
{ {
if (!doReport) if (!doReport)
{ {
DetectorLogRed("<--Kill collision %s :failed group. US=%x OTHER=(NotAvatar)",triggerPhys->GetObjectKey()->GetName(),triggerPhys->GetGroup()); DetectorLogRed("<--Kill collision %s :failed group. US=%x OTHER=(NotAvatar)",triggerPhys->GetObjectKey()->GetName().c_str(),triggerPhys->GetGroup());
} }
else else
{ {
@ -155,29 +155,29 @@ class SensorReport : public NxUserTriggerReport
if (status & NX_TRIGGER_ON_ENTER && triggerPhys->Should_I_Trigger(status & NX_TRIGGER_ON_ENTER, otherPos) ) if (status & NX_TRIGGER_ON_ENTER && triggerPhys->Should_I_Trigger(status & NX_TRIGGER_ON_ENTER, otherPos) )
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
DetectorLogRed("-->Send Collision (CH) %s %s",triggerPhys->GetObjectKey()->GetName(),status & NX_TRIGGER_ON_ENTER ? "enter" : "exit"); DetectorLogRed("-->Send Collision (CH) %s %s",triggerPhys->GetObjectKey()->GetName().c_str(),status & NX_TRIGGER_ON_ENTER ? "enter" : "exit");
SendCollisionMsg(triggerPhys->GetObjectKey(), otherKey, true); SendCollisionMsg(triggerPhys->GetObjectKey(), otherKey, true);
} }
else if (status & NX_TRIGGER_ON_ENTER) else if (status & NX_TRIGGER_ON_ENTER)
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
DetectorLogRed("<--Kill collision %s :failed Should I trigger",triggerPhys->GetObjectKey()->GetName()); DetectorLogRed("<--Kill collision %s :failed Should I trigger",triggerPhys->GetObjectKey()->GetName().c_str());
} }
if (status & NX_TRIGGER_ON_LEAVE && triggerPhys->Should_I_Trigger(status & NX_TRIGGER_ON_ENTER, otherPos) ) if (status & NX_TRIGGER_ON_LEAVE && triggerPhys->Should_I_Trigger(status & NX_TRIGGER_ON_ENTER, otherPos) )
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
DetectorLogRed("-->Send Collision (CH) %s %s",triggerPhys->GetObjectKey()->GetName(),status & NX_TRIGGER_ON_ENTER ? "enter" : "exit"); DetectorLogRed("-->Send Collision (CH) %s %s",triggerPhys->GetObjectKey()->GetName().c_str(),status & NX_TRIGGER_ON_ENTER ? "enter" : "exit");
SendCollisionMsg(triggerPhys->GetObjectKey(), otherKey, false); SendCollisionMsg(triggerPhys->GetObjectKey(), otherKey, false);
} }
else if (status & NX_TRIGGER_ON_LEAVE) else if (status & NX_TRIGGER_ON_LEAVE)
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
DetectorLogRed("<--Kill collision %s :failed Should I trigger",triggerPhys->GetObjectKey()->GetName()); DetectorLogRed("<--Kill collision %s :failed Should I trigger",triggerPhys->GetObjectKey()->GetName().c_str());
} }
if (!(status & NX_TRIGGER_ON_ENTER) && !(status & NX_TRIGGER_ON_LEAVE) ) if (!(status & NX_TRIGGER_ON_ENTER) && !(status & NX_TRIGGER_ON_LEAVE) )
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
DetectorLogRed("<--Kill collision %s :failed event(CH)",triggerPhys->GetObjectKey()->GetName()); DetectorLogRed("<--Kill collision %s :failed event(CH)",triggerPhys->GetObjectKey()->GetName().c_str());
} }
} }
else else
@ -186,19 +186,19 @@ class SensorReport : public NxUserTriggerReport
if (status & NX_TRIGGER_ON_ENTER) if (status & NX_TRIGGER_ON_ENTER)
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
DetectorLogRed("-->Send Collision %s %s",triggerPhys->GetObjectKey()->GetName(),status & NX_TRIGGER_ON_ENTER ? "enter" : "exit"); DetectorLogRed("-->Send Collision %s %s",triggerPhys->GetObjectKey()->GetName().c_str(),status & NX_TRIGGER_ON_ENTER ? "enter" : "exit");
SendCollisionMsg(triggerPhys->GetObjectKey(), otherKey, true); SendCollisionMsg(triggerPhys->GetObjectKey(), otherKey, true);
} }
if (status & NX_TRIGGER_ON_LEAVE) if (status & NX_TRIGGER_ON_LEAVE)
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
DetectorLogRed("-->Send Collision %s %s",triggerPhys->GetObjectKey()->GetName(),status & NX_TRIGGER_ON_ENTER ? "enter" : "exit"); DetectorLogRed("-->Send Collision %s %s",triggerPhys->GetObjectKey()->GetName().c_str(),status & NX_TRIGGER_ON_ENTER ? "enter" : "exit");
SendCollisionMsg(triggerPhys->GetObjectKey(), otherKey, false); SendCollisionMsg(triggerPhys->GetObjectKey(), otherKey, false);
} }
if (!(status & NX_TRIGGER_ON_ENTER) && !(status & NX_TRIGGER_ON_LEAVE) ) if (!(status & NX_TRIGGER_ON_ENTER) && !(status & NX_TRIGGER_ON_LEAVE) )
{ {
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
DetectorLogRed("<--Kill collision %s :failed event",triggerPhys->GetObjectKey()->GetName()); DetectorLogRed("<--Kill collision %s :failed event",triggerPhys->GetObjectKey()->GetName().c_str());
} }
#ifdef USE_PHYSX_CONVEXHULL_WORKAROUND #ifdef USE_PHYSX_CONVEXHULL_WORKAROUND
} }
@ -208,7 +208,7 @@ class SensorReport : public NxUserTriggerReport
void SendCollisionMsg(plKey receiver, plKey hitter, hsBool entering) void SendCollisionMsg(plKey receiver, plKey hitter, hsBool entering)
{ {
DetectorLogYellow("Collision: %s was triggered by %s. Sending an %s msg", receiver->GetName(), DetectorLogYellow("Collision: %s was triggered by %s. Sending an %s msg", receiver->GetName().c_str(),
hitter ? hitter->GetName().c_str() : "(nil)" , entering ? "'enter'" : "'exit'"); hitter ? hitter->GetName().c_str() : "(nil)" , entering ? "'enter'" : "'exit'");
plCollideMsg* msg = new plCollideMsg; plCollideMsg* msg = new plCollideMsg;
msg->fOtherKey = hitter; msg->fOtherKey = hitter;
@ -962,7 +962,7 @@ void plSimulationMgr::IDrawActiveActorList()
for (SceneMap::iterator it = fScenes.begin(); it != fScenes.end(); it++) for (SceneMap::iterator it = fScenes.begin(); it != fScenes.end(); it++)
{ {
sprintf(strBuf, "Scene: %s",it->first->GetName()); sprintf(strBuf, "Scene: %s",it->first->GetName().c_str());
debugTxt.DrawString(x, y, strBuf); debugTxt.DrawString(x, y, strBuf);
y += lineHeight; y += lineHeight;
uint32_t numActors =it->second->getNbActors(); uint32_t numActors =it->second->getNbActors();

Loading…
Cancel
Save