Browse Source

Convert plUoid's object name to a plString

Michael Hansen 13 years ago
parent
commit
e34414889f
  1. 13
      Sources/Plasma/Apps/plClient/plClient.cpp
  2. 2
      Sources/Plasma/Apps/plPageInfo/plPageInfo.cpp
  3. 27
      Sources/Plasma/CoreLib/hsStream.cpp
  4. 9
      Sources/Plasma/CoreLib/hsStream.h
  5. 24
      Sources/Plasma/CoreLib/plString.cpp
  6. 39
      Sources/Plasma/CoreLib/plString.h
  7. 8
      Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.cpp
  8. 4
      Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.h
  9. 4
      Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.cpp
  10. 4
      Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp
  11. 4
      Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.cpp
  12. 18
      Sources/Plasma/FeatureLib/pfAudio/plListener.cpp
  13. 4
      Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp
  14. 4
      Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp
  15. 2
      Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h
  16. 4
      Sources/Plasma/FeatureLib/pfCharacter/pfMarkerInfo.cpp
  17. 16
      Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp
  18. 204
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp
  19. 8
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp
  20. 5
      Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp
  21. 4
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp
  22. 10
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.cpp
  23. 2
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.h
  24. 3
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.cpp
  25. 3
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.cpp
  26. 85
      Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp
  27. 18
      Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.h
  28. 59
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  29. 18
      Sources/Plasma/FeatureLib/pfPython/cyMisc.h
  30. 4
      Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp
  31. 4
      Sources/Plasma/FeatureLib/pfPython/cyMiscGlue3.cpp
  32. 34
      Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp
  33. 65
      Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp
  34. 16
      Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h
  35. 6
      Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp
  36. 7
      Sources/Plasma/FeatureLib/pfPython/pyImage.cpp
  37. 21
      Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp
  38. 18
      Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h
  39. 14
      Sources/Plasma/FeatureLib/pfPython/pyJournalBookGlue.cpp
  40. 3
      Sources/Plasma/FeatureLib/pfPython/pyKey.h
  41. 10
      Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp
  42. 4
      Sources/Plasma/FeatureLib/pfPython/pySceneObject.h
  43. 4
      Sources/Plasma/FeatureLib/pfPython/pySceneObjectGlue.cpp
  44. 3
      Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp
  45. 3
      Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp
  46. 4
      Sources/Plasma/NucleusLib/inc/hsResMgr.h
  47. 4
      Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp
  48. 6
      Sources/Plasma/NucleusLib/pnKeyedObject/hsKeyedObject.cpp
  49. 4
      Sources/Plasma/NucleusLib/pnKeyedObject/hsKeyedObject.h
  50. 81
      Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp
  51. 3
      Sources/Plasma/NucleusLib/pnKeyedObject/plKey.h
  52. 6
      Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp
  53. 2
      Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.h
  54. 4
      Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp
  55. 24
      Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp
  56. 10
      Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h
  57. 18
      Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp
  58. 5
      Sources/Plasma/NucleusLib/pnMessage/plMessage.h
  59. 8
      Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoaderPaging.cpp
  60. 6
      Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp
  61. 4
      Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp
  62. 8
      Sources/Plasma/PubUtilLib/plAudio/plSound.cpp
  63. 3
      Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp
  64. 16
      Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp
  65. 2
      Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp
  66. 5
      Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp
  67. 4
      Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp
  68. 4
      Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.cpp
  69. 23
      Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp
  70. 7
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp
  71. 40
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp
  72. 8
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.h
  73. 10
      Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.cpp
  74. 3
      Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp
  75. 4
      Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp
  76. 16
      Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp
  77. 9
      Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp
  78. 22
      Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp
  79. 85
      Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp
  80. 4
      Sources/Plasma/PubUtilLib/plGImage/plFontCache.cpp
  81. 6
      Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp
  82. 4
      Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.cpp
  83. 4
      Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp
  84. 2
      Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.cpp
  85. 2
      Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.cpp
  86. 2
      Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp
  87. 2
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp
  88. 2
      Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.cpp
  89. 8
      Sources/Plasma/PubUtilLib/plNetClient/plNetVoiceList.cpp
  90. 4
      Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.cpp
  91. 14
      Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp
  92. 8
      Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h
  93. 2
      Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.cpp
  94. 2
      Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.h
  95. 4
      Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.cpp
  96. 4
      Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp
  97. 12
      Sources/Plasma/PubUtilLib/plPhysX/plPXPhysical.cpp
  98. 12
      Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp
  99. 6
      Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp
  100. 2
      Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRefs.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

13
Sources/Plasma/Apps/plClient/plClient.cpp

@ -632,7 +632,7 @@ hsBool plClient::MsgReceive(plMessage* msg)
{ {
case plClientRefMsg::kLoadRoom : case plClientRefMsg::kLoadRoom :
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
plStatusLog::AddLineS( "pageouts.log", ".. ClientRefMsg received for room %s", pRefMsg->GetRef() != nil ? pRefMsg->GetRef()->GetKey()->GetUoid().GetObjectName() : "nilref" ); plStatusLog::AddLineS( "pageouts.log", ".. ClientRefMsg received for room %s", pRefMsg->GetRef() != nil ? pRefMsg->GetRef()->GetKey()->GetUoid().GetObjectName().c_str() : "nilref" );
#endif #endif
// was it that the room was loaded? // was it that the room was loaded?
@ -782,11 +782,10 @@ hsBool plClient::MsgReceive(plMessage* msg)
plEventCallbackMsg* callback = plEventCallbackMsg::ConvertNoRef(msg); plEventCallbackMsg* callback = plEventCallbackMsg::ConvertNoRef(msg);
if( callback ) if( callback )
{ {
char str[256]; plString str = plString::Format("Callback event from %s\n", callback->GetSender()
sprintf(str, "Callback event from %s\n", callback->GetSender() ? callback->GetSender()->GetName().c_str()
? callback->GetSender()->GetName() : "Unknown");
: "Unknown"); hsStatusMessage(str.c_str());
hsStatusMessage(str);
static int gotten = 0; static int gotten = 0;
if( ++gotten > 5 ) if( ++gotten > 5 )
{ {
@ -1282,7 +1281,7 @@ void plClient::IRoomUnloaded(plSceneNode* node)
void plClient::IReadKeyedObjCallback(plKey key) void plClient::IReadKeyedObjCallback(plKey key)
{ {
fInstance->IIncProgress(1, key->GetName()); fInstance->IIncProgress(1, _TEMP_CONVERT_TO_CONST_CHAR(key->GetName()));
} }
//============================================================================ //============================================================================

2
Sources/Plasma/Apps/plPageInfo/plPageInfo.cpp

@ -230,7 +230,7 @@ public:
{ {
plKeyImp* imp = (plKey)key; plKeyImp* imp = (plKey)key;
fStream.WriteString(imp->GetName()); fStream.WriteString_TEMP(imp->GetName());
fStream.WriteString(","); fStream.WriteString(",");
fStream.WriteString(plFactory::GetNameOfClass(imp->GetUoid().GetClassType())); fStream.WriteString(plFactory::GetNameOfClass(imp->GetUoid().GetClassType()));

27
Sources/Plasma/CoreLib/hsStream.cpp

@ -322,6 +322,33 @@ wchar_t *hsStream::ReadSafeWString()
return retVal; return retVal;
} }
UInt32 hsStream::WriteSafeString_TEMP(const plString &string)
{
return WriteSafeString(string.c_str());
}
UInt32 hsStream::WriteSafeWString_TEMP(const plString &string)
{
plStringBuffer<wchar_t> wbuffer = string.ToWchar();
return WriteSafeWString(wbuffer.GetData());
}
plString hsStream::ReadSafeString_TEMP()
{
char *buffer = ReadSafeString();
plString result = plString::FromIso8859_1(buffer);
delete [] buffer;
return result;
}
plString hsStream::ReadSafeWString_TEMP()
{
wchar_t *wbuffer = ReadSafeWString();
plString result = plString::FromWchar(wbuffer);
delete [] wbuffer;
return result;
}
hsBool hsStream::Read4Bytes(void *pv) // Virtual, faster version in sub classes hsBool hsStream::Read4Bytes(void *pv) // Virtual, faster version in sub classes
{ {
int knt = this->Read(sizeof(UInt32), pv); int knt = this->Read(sizeof(UInt32), pv);

9
Sources/Plasma/CoreLib/hsStream.h

@ -59,7 +59,8 @@ struct FileEntry;
#ifndef STREAM_LOGGER #ifndef STREAM_LOGGER
#define hsReadOnlyLoggingStream hsReadOnlyStream #define hsReadOnlyLoggingStream hsReadOnlyStream
#define LogRead(byteCount, buffer, desc) Read(byteCount, buffer) #define LogRead(byteCount, buffer, desc) Read(byteCount, buffer)
#define LogReadSafeString() ReadSafeString(); #define LogReadSafeString() ReadSafeString()
#define LogReadSafeString_TEMP() ReadSafeString_TEMP()
#define LogReadSafeStringLong() ReadSafeStringLong(); #define LogReadSafeStringLong() ReadSafeStringLong();
#define LogSkip(deltaByteCount, desc) Skip(deltaByteCount) #define LogSkip(deltaByteCount, desc) Skip(deltaByteCount)
#define LogReadLE(value, desc) ReadLE(value) #define LogReadLE(value, desc) ReadLE(value)
@ -130,6 +131,7 @@ public:
virtual hsBool IsCompressed() { return false; } virtual hsBool IsCompressed() { return false; }
UInt32 WriteString(const char cstring[]); UInt32 WriteString(const char cstring[]);
UInt32 WriteString_TEMP(const plString & string) { return WriteString(string.c_str()); }
UInt32 WriteFmt(const char * fmt, ...); UInt32 WriteFmt(const char * fmt, ...);
UInt32 WriteFmtV(const char * fmt, va_list av); UInt32 WriteFmtV(const char * fmt, va_list av);
@ -143,6 +145,11 @@ public:
char * ReadSafeString(); char * ReadSafeString();
wchar_t * ReadSafeWString(); wchar_t * ReadSafeWString();
UInt32 WriteSafeString_TEMP(const plString &string); // uses 2 bytes for length
UInt32 WriteSafeWString_TEMP(const plString &string);
plString ReadSafeString_TEMP();
plString ReadSafeWString_TEMP();
hsBool GetToken(char *s, UInt32 maxLen=UInt32(-1), const char beginComment=kComment, const char endComment=kEolnCode); hsBool GetToken(char *s, UInt32 maxLen=UInt32(-1), const char beginComment=kComment, const char endComment=kEolnCode);
hsBool ReadLn(char* s, UInt32 maxLen=UInt32(-1), const char beginComment=kComment, const char endComment=kEolnCode); hsBool ReadLn(char* s, UInt32 maxLen=UInt32(-1), const char beginComment=kComment, const char endComment=kEolnCode);

24
Sources/Plasma/CoreLib/plString.cpp

@ -490,7 +490,7 @@ plString plString::Format(const char *fmt, ...)
return str; return str;
} }
int plString::Find(char ch, CaseSense sense) const int plString::Find(char ch, CaseSensitivity sense) const
{ {
if (sense == kCaseSensitive) { if (sense == kCaseSensitive) {
const char *cp = strchr(s_str(), ch); const char *cp = strchr(s_str(), ch);
@ -506,7 +506,7 @@ int plString::Find(char ch, CaseSense sense) const
} }
} }
int plString::FindReverse(char ch, CaseSense sense) const int plString::FindLast(char ch, CaseSensitivity sense) const
{ {
if (IsEmpty()) if (IsEmpty())
return -1; return -1;
@ -526,6 +526,26 @@ int plString::FindReverse(char ch, CaseSense sense) const
} }
} }
int plString::Find(const char *str, CaseSensitivity sense) const
{
if (!str || !str[0])
return -1;
if (sense == kCaseSensitive) {
const char *cp = strstr(s_str(), str);
return cp ? (cp - c_str()) : -1;
} else {
// The easy way
size_t len = strlen(str);
const char *cp = c_str();
while (*cp) {
if (strnicmp(cp, str, len) == 0)
return cp - c_str();
++cp;
}
}
}
static bool in_set(char key, const char *charset) static bool in_set(char key, const char *charset)
{ {
for (const char *cs = charset; *cs; ++cs) { for (const char *cs = charset; *cs; ++cs) {

39
Sources/Plasma/CoreLib/plString.h

@ -126,10 +126,6 @@ class plString
}; };
#pragma warning(pop) #pragma warning(pop)
enum CaseSense {
kCaseSensitive, kCaseInsensitive
};
public: public:
static const plString Null; static const plString Null;
@ -212,23 +208,50 @@ public:
return str; return str;
} }
int Compare(const plString &str, CaseSense sense = kCaseSensitive) const enum CaseSensitivity {
kCaseSensitive, kCaseInsensitive
};
int Compare(const plString &str, CaseSensitivity sense = kCaseSensitive) const
{ {
if (c_str() == str.c_str())
return 0;
return (sense == kCaseSensitive) ? strcmp(s_str(), str.s_str()) return (sense == kCaseSensitive) ? strcmp(s_str(), str.s_str())
: stricmp(s_str(), str.s_str()); : stricmp(s_str(), str.s_str());
} }
int Compare(const char *str, CaseSense sense = kCaseSensitive) const int Compare(const char *str, CaseSensitivity sense = kCaseSensitive) const
{ {
return (sense == kCaseSensitive) ? strcmp(s_str(), str) return (sense == kCaseSensitive) ? strcmp(s_str(), str)
: stricmp(s_str(), str); : stricmp(s_str(), str);
} }
int CompareN(const plString &str, size_t count, CaseSensitivity sense = kCaseSensitive) const
{
if (c_str() == str.c_str())
return 0;
return (sense == kCaseSensitive) ? strncmp(s_str(), str.s_str(), count)
: strnicmp(s_str(), str.s_str(), count);
}
int CompareN(const char *str, size_t count, CaseSensitivity sense = kCaseSensitive) const
{
return (sense == kCaseSensitive) ? strncmp(s_str(), str, count)
: strnicmp(s_str(), str, count);
}
bool operator<(const plString &other) const { return Compare(other) < 0; }
bool operator==(const plString &other) const { return Compare(other) == 0; } bool operator==(const plString &other) const { return Compare(other) == 0; }
bool operator!=(const plString &other) const { return Compare(other) != 0; } bool operator!=(const plString &other) const { return Compare(other) != 0; }
int Find(char ch, CaseSense sense = kCaseSensitive) const; int Find(char ch, CaseSensitivity sense = kCaseSensitive) const;
int FindReverse(char ch, CaseSense sense = kCaseSensitive) const; int FindLast(char ch, CaseSensitivity sense = kCaseSensitive) const;
int Find(const char *str, CaseSensitivity sense = kCaseSensitive) const;
int Find(const plString &str, CaseSensitivity sense = kCaseSensitive) const
{ return Find(str.c_str(), sense); }
plString TrimLeft(const char *charset = " \t\n\r") const; plString TrimLeft(const char *charset = " \t\n\r") const;
plString TrimRight(const char *charset = " \t\n\r") const; plString TrimRight(const char *charset = " \t\n\r") const;

8
Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.cpp

@ -53,7 +53,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plResMgr/plKeyFinder.h" #include "plResMgr/plKeyFinder.h"
#include "plPipeline/plDebugText.h" #include "plPipeline/plDebugText.h"
void plAnimDebugList::AddObjects(char *subString) void plAnimDebugList::AddObjects(const plString &subString)
{ {
std::vector<plKey> keys; std::vector<plKey> keys;
std::vector<plKey>::iterator i; std::vector<plKey>::iterator i;
@ -79,18 +79,18 @@ void plAnimDebugList::AddObjects(char *subString)
} }
} }
void plAnimDebugList::RemoveObjects(char *subString) void plAnimDebugList::RemoveObjects(const plString &subString)
{ {
int i; int i;
for (i = fMaterialKeys.GetCount() - 1; i >= 0; i--) for (i = fMaterialKeys.GetCount() - 1; i >= 0; i--)
{ {
if (strstr(fMaterialKeys[i]->GetName(), subString)) if (fMaterialKeys[i]->GetName().Find(subString) >= 0)
fMaterialKeys.Remove(i); fMaterialKeys.Remove(i);
} }
for (i = fSOKeys.GetCount() - 1; i >= 0; i--) for (i = fSOKeys.GetCount() - 1; i >= 0; i--)
{ {
if (strstr(fSOKeys[i]->GetName(), subString)) if (fSOKeys[i]->GetName().Find(subString) >= 0)
fSOKeys.Remove(i); fSOKeys.Remove(i);
} }
} }

4
Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.h

@ -55,8 +55,8 @@ public:
plAnimDebugList() : fEnabled(false) {} plAnimDebugList() : fEnabled(false) {}
~plAnimDebugList() {} ~plAnimDebugList() {}
void AddObjects(char *subString); void AddObjects(const plString &subString);
void RemoveObjects(char *subString); void RemoveObjects(const plString &subString);
void ShowReport(); void ShowReport();
}; };

4
Sources/Plasma/FeatureLib/pfAnimation/plFollowMod.cpp

@ -69,11 +69,11 @@ hsBool plFollowMod::MsgReceive(plMessage* msg)
plRenderMsg* rend = plRenderMsg::ConvertNoRef(msg); plRenderMsg* rend = plRenderMsg::ConvertNoRef(msg);
if( rend ) if( rend )
{ {
plProfile_BeginLap(FollowMod, this->GetKey()->GetUoid().GetObjectName()); plProfile_BeginLap(FollowMod, this->GetKey()->GetUoid().GetObjectName().c_str());
fLeaderL2W = rend->Pipeline()->GetCameraToWorld(); fLeaderL2W = rend->Pipeline()->GetCameraToWorld();
fLeaderW2L = rend->Pipeline()->GetWorldToCamera(); fLeaderW2L = rend->Pipeline()->GetWorldToCamera();
fLeaderSet = true; fLeaderSet = true;
plProfile_EndLap(FollowMod, this->GetKey()->GetUoid().GetObjectName()); plProfile_EndLap(FollowMod, this->GetKey()->GetUoid().GetObjectName().c_str());
return true; return true;
} }
plListenerMsg* list = plListenerMsg::ConvertNoRef(msg); plListenerMsg* list = plListenerMsg::ConvertNoRef(msg);

4
Sources/Plasma/FeatureLib/pfAnimation/plLineFollowMod.cpp

@ -257,11 +257,11 @@ hsBool plLineFollowMod::MsgReceive(plMessage* msg)
plRenderMsg* rend = plRenderMsg::ConvertNoRef(msg); plRenderMsg* rend = plRenderMsg::ConvertNoRef(msg);
if( rend ) if( rend )
{ {
plProfile_BeginLap(LineFollow, this->GetKey()->GetUoid().GetObjectName()); plProfile_BeginLap(LineFollow, this->GetKey()->GetUoid().GetObjectName().c_str());
hsPoint3 oldPos = fSearchPos; hsPoint3 oldPos = fSearchPos;
fSearchPos = rend->Pipeline()->GetViewPositionWorld(); fSearchPos = rend->Pipeline()->GetViewPositionWorld();
ICheckForPop(oldPos, fSearchPos); ICheckForPop(oldPos, fSearchPos);
plProfile_EndLap(LineFollow, this->GetKey()->GetUoid().GetObjectName()); plProfile_EndLap(LineFollow, this->GetKey()->GetUoid().GetObjectName().c_str());
return true; return true;
} }
plListenerMsg* list = plListenerMsg::ConvertNoRef(msg); plListenerMsg* list = plListenerMsg::ConvertNoRef(msg);

4
Sources/Plasma/FeatureLib/pfAnimation/plViewFaceModifier.cpp

@ -278,7 +278,7 @@ hsBool plViewFaceModifier::MsgReceive(plMessage* msg)
if( rend ) if( rend )
{ {
plProfile_BeginLap(ViewFace, this->GetKey()->GetUoid().GetObjectName()); plProfile_BeginLap(ViewFace, this->GetKey()->GetUoid().GetObjectName().c_str());
if( HasFlag(kFaceCam) ) if( HasFlag(kFaceCam) )
{ {
@ -314,7 +314,7 @@ hsBool plViewFaceModifier::MsgReceive(plMessage* msg)
IFacePoint(rend->Pipeline(), fFacePoint); IFacePoint(rend->Pipeline(), fFacePoint);
plProfile_EndLap(ViewFace, this->GetKey()->GetUoid().GetObjectName()); plProfile_EndLap(ViewFace, this->GetKey()->GetUoid().GetObjectName().c_str());
return true; return true;
} }
plArmatureUpdateMsg* armMsg = plArmatureUpdateMsg::ConvertNoRef(msg); plArmatureUpdateMsg* armMsg = plArmatureUpdateMsg::ConvertNoRef(msg);

18
Sources/Plasma/FeatureLib/pfAudio/plListener.cpp

@ -182,21 +182,21 @@ hsBool plListener::IEval(double secs, hsScalar del, UInt32 dirty)
if( fPrintDbgInfo ) if( fPrintDbgInfo )
{ {
char str[ 256 ]; plString str;
sprintf( str, "Direction: (%3.2f,%3.2f,%3.2f) from %s", dir.fX, dir.fY, dir.fZ, ( facingType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName() : "VCam" ); str = plString::Format( "Direction: (%3.2f,%3.2f,%3.2f) from %s", dir.fX, dir.fY, dir.fZ, ( facingType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName().c_str() : "VCam" );
plDebugText::Instance().DrawString( x, y, str, (UInt32)0xffffffff ); plDebugText::Instance().DrawString( x, y, str.c_str(), (UInt32)0xffffffff );
y += 12; y += 12;
sprintf( str, "Up: (%3.2f,%3.2f,%3.2f) from %s", up.fX, up.fY, up.fZ, ( facingType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName() : "VCam" ); str = plString::Format( "Up: (%3.2f,%3.2f,%3.2f) from %s", up.fX, up.fY, up.fZ, ( facingType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName().c_str() : "VCam" );
plDebugText::Instance().DrawString( x, y, str, (UInt32)0xffffffff ); plDebugText::Instance().DrawString( x, y, str.c_str(), (UInt32)0xffffffff );
y += 12; y += 12;
sprintf( str, "Position: (%3.2f,%3.2f,%3.2f) from %s", position.fX, position.fY, position.fZ, ( posType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName() : "VCam" ); str = plString::Format( "Position: (%3.2f,%3.2f,%3.2f) from %s", position.fX, position.fY, position.fZ, ( posType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName().c_str() : "VCam" );
plDebugText::Instance().DrawString( x, y, str, (UInt32)0xffffffff ); plDebugText::Instance().DrawString( x, y, str.c_str(), (UInt32)0xffffffff );
y += 12; y += 12;
sprintf( str, "Velocity: (%3.2f,%3.2f,%3.2f) from %s", velocity.fX, velocity.fY, velocity.fZ, ( velType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName() : "VCam" ); str = plString::Format( "Velocity: (%3.2f,%3.2f,%3.2f) from %s", velocity.fX, velocity.fY, velocity.fZ, ( velType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName().c_str() : "VCam" );
plDebugText::Instance().DrawString( x, y, str, (UInt32)0xffffffff ); plDebugText::Instance().DrawString( x, y, str.c_str(), (UInt32)0xffffffff );
y += 12; y += 12;
} }
plgDispatch::MsgSend( msg ); plgDispatch::MsgSend( msg );

4
Sources/Plasma/FeatureLib/pfCamera/plCameraBrain.cpp

@ -1318,8 +1318,8 @@ hsBool plCameraBrain1_FirstPerson::MsgReceive(plMessage* msg)
plSceneObject* child = (plSceneObject*)ci->GetChild(i)->GetOwner(); plSceneObject* child = (plSceneObject*)ci->GetChild(i)->GetOwner();
if (child) if (child)
{ {
const char* name = child->GetKeyName(); const plString& name = child->GetKeyName();
if (stricmp(name, "FPCameraOrigin") == 0) if (name.Compare("FPCameraOrigin", plString::kCaseInsensitive) == 0)
{ {
fPosNode = child; fPosNode = child;
SetOffset(hsVector3(0,0,0)); SetOffset(hsVector3(0,0,0));

4
Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.cpp

@ -533,11 +533,11 @@ void plVirtualCam1::SetRender(hsBool render)
} }
// hack, hack, hack // hack, hack, hack
hsBool plVirtualCam1::RestoreFromName(const char* name) hsBool plVirtualCam1::RestoreFromName(const plString& name)
{ {
for(int i = 0; i < fCamerasLoaded.Count(); i++) for(int i = 0; i < fCamerasLoaded.Count(); i++)
{ {
if (strcmp(name, fCamerasLoaded[i]->GetKeyName()) == 0) if (name.Compare(fCamerasLoaded[i]->GetKeyName()) == 0)
{ {
RebuildStack(fCamerasLoaded[i]->GetKey()); RebuildStack(fCamerasLoaded[i]->GetKey());
return true; return true;

2
Sources/Plasma/FeatureLib/pfCamera/plVirtualCamNeu.h

@ -170,7 +170,7 @@ public:
void ClearStack(); void ClearStack();
void AddCameraLoaded(plSceneObject* pCam) { fCamerasLoaded.Append(pCam); } void AddCameraLoaded(plSceneObject* pCam) { fCamerasLoaded.Append(pCam); }
hsBool RestoreFromName(const char* name); hsBool RestoreFromName(const plString& name);
void StartUnPan(); void StartUnPan();
// these are for console access // these are for console access
static hsBool fUseAccelOverride, freeze, alwaysCutForColin, WalkPan3rdPerson,StayInFirstPersonForever; static hsBool fUseAccelOverride, freeze, alwaysCutForColin, WalkPan3rdPerson,StayInFirstPersonForever;

4
Sources/Plasma/FeatureLib/pfCharacter/pfMarkerInfo.cpp

@ -77,7 +77,7 @@ void pfMarkerInfo::Init()
plLocation markerLoc = plKeyFinder::Instance().FindLocation("GlobalMarkers", "Markers"); plLocation markerLoc = plKeyFinder::Instance().FindLocation("GlobalMarkers", "Markers");
if (markerLoc.IsValid()) if (markerLoc.IsValid())
fMarkerUoid = plUoid(markerLoc, plSceneObject::Index(), "MarkerRoot"); fMarkerUoid = plUoid(markerLoc, plSceneObject::Index(), _TEMP_CONVERT_FROM_LITERAL("MarkerRoot"));
else else
fMarkerUoid.Invalidate(); fMarkerUoid.Invalidate();
} }
@ -101,7 +101,7 @@ void pfMarkerInfo::Spawn(MarkerType type)
plLocation markerLoc = plKeyFinder::Instance().FindLocation("GlobalMarkers", "Markers"); plLocation markerLoc = plKeyFinder::Instance().FindLocation("GlobalMarkers", "Markers");
if (markerLoc.IsValid()) if (markerLoc.IsValid())
fMarkerUoid = plUoid(markerLoc, plSceneObject::Index(), "MarkerRoot"); fMarkerUoid = plUoid(markerLoc, plSceneObject::Index(), _TEMP_CONVERT_FROM_LITERAL("MarkerRoot"));
else else
{ {
hsAssert(false, "Unable to spawn markers because the marker age was not loaded or found"); hsAssert(false, "Unable to spawn markers because the marker age was not loaded or found");

16
Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp

@ -112,9 +112,9 @@ PF_CONSOLE_FILE_DUMMY(Avatar)
// //
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
plKey FindSceneObjectByName(const char* name, const char* ageName, char* statusStr, bool subString=false); plKey FindSceneObjectByName(const plString& name, const char* ageName, char* statusStr, bool subString=false);
plKey FindObjectByName(const char* name, int type, const char* ageName, char* statusStr, bool subString=false); plKey FindObjectByName(const plString& name, int type, const char* ageName, char* statusStr, bool subString=false);
plKey FindObjectByNameAndType(const char* name, const char* typeName, const char* ageName, plKey FindObjectByNameAndType(const plString& name, const char* typeName, const char* ageName,
char* statusStr, bool subString=false); char* statusStr, bool subString=false);
void PrintStringF(void pfun(const char *),const char * fmt, ...); void PrintStringF(void pfun(const char *),const char * fmt, ...);
@ -353,7 +353,7 @@ PF_CONSOLE_CMD( Avatar_Turn, SetMouseTurnSensitivity, "float sensitivity", "Set
PF_CONSOLE_CMD( Avatar_Multistage, Trigger, "string multiComp", "Triggers the named Multistage Animation component") PF_CONSOLE_CMD( Avatar_Multistage, Trigger, "string multiComp", "Triggers the named Multistage Animation component")
{ {
char str[256]; char str[256];
plKey key = FindObjectByNameAndType((const char*)params[0], "plMultistageBehMod", nil, str, true); plKey key = FindObjectByNameAndType(plString::FromUtf8(params[0]), "plMultistageBehMod", nil, str, true);
PrintString(str); PrintString(str);
if (key) if (key)
@ -464,8 +464,8 @@ PF_CONSOLE_CMD( Avatar,
"Mark whether avatars in regionA want updates on those on regionB" ) "Mark whether avatars in regionA want updates on those on regionB" )
{ {
plRelevanceMgr *mgr = plRelevanceMgr::Instance(); plRelevanceMgr *mgr = plRelevanceMgr::Instance();
char *regA = params[0]; plString regA = plString::FromUtf8(params[0]);
char *regB = params[1]; plString regB = plString::FromUtf8(params[1]);
mgr->MarkRegion(mgr->GetIndex(regA), mgr->GetIndex(regB), params[2]); mgr->MarkRegion(mgr->GetIndex(regA), mgr->GetIndex(regB), params[2]);
} }
@ -484,7 +484,7 @@ PF_CONSOLE_CMD( Avatar,
PF_CONSOLE_CMD( Avatar, SeekPoint, "string seekpoint", "Move to the given seekpoint.") PF_CONSOLE_CMD( Avatar, SeekPoint, "string seekpoint", "Move to the given seekpoint.")
{ {
char *spName = params[0]; plString spName = plString::FromUtf8(params[0]);
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar(); plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
@ -586,7 +586,7 @@ PF_CONSOLE_CMD( Avatar, ClickToTurn, "bool b", "Set click-to-turn functionality.
PF_CONSOLE_CMD( Avatar, FakeLinkToObj, "string objName", "Pseudo-Link the avatar to the specified object's location") PF_CONSOLE_CMD( Avatar, FakeLinkToObj, "string objName", "Pseudo-Link the avatar to the specified object's location")
{ {
char *spName = params[0]; plString spName = plString::FromUtf8(params[0]);
char buff[256]; char buff[256];
plKey seekKey = FindSceneObjectByName(spName, nil, buff); plKey seekKey = FindSceneObjectByName(spName, nil, buff);
if (!seekKey) if (!seekKey)

204
Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp

@ -267,9 +267,9 @@ PF_CONSOLE_FILE_DUMMY(Main)
// utility functions // utility functions
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
plKey FindSceneObjectByName(const char* name, const char* ageName, char* statusStr, bool subString=false); plKey FindSceneObjectByName(const plString& name, const char* ageName, char* statusStr, bool subString=false);
plKey FindObjectByName(const char* name, int type, const char* ageName, char* statusStr, bool subString=false); plKey FindObjectByName(const plString& name, int type, const char* ageName, char* statusStr, bool subString=false);
plKey FindObjectByNameAndType(const char* name, const char* typeName, const char* ageName, plKey FindObjectByNameAndType(const plString& name, const char* typeName, const char* ageName,
char* statusStr, bool subString=false); char* statusStr, bool subString=false);
void PrintStringF(void pfun(const char *),const char * fmt, ...); void PrintStringF(void pfun(const char *),const char * fmt, ...);
@ -277,9 +277,9 @@ void PrintStringF(void pfun(const char *),const char * fmt, ...);
// Find an object from name, type (int), and optionally age. // Find an object from name, type (int), and optionally age.
// Name can be an alias specified by saying $foo // Name can be an alias specified by saying $foo
// //
plKey FindObjectByName(const char* name, int type, const char* ageName, char* statusStr, bool subString) plKey FindObjectByName(const plString& name, int type, const char* ageName, char* statusStr, bool subString)
{ {
if (!name) if (name.IsNull())
{ {
if (statusStr) if (statusStr)
sprintf(statusStr, "Object name is nil"); sprintf(statusStr, "Object name is nil");
@ -338,10 +338,10 @@ plKey FindObjectByName(const char* name, int type, const char* ageName, char* st
// Name can be an alias specified by saying $foo. // Name can be an alias specified by saying $foo.
// Will load the object if necessary. // Will load the object if necessary.
// //
plKey FindSceneObjectByName(const char* name, const char* ageName, char* statusStr, bool subString) plKey FindSceneObjectByName(const plString& name, const char* ageName, char* statusStr, bool subString)
{ {
plKey key=FindObjectByName(name, plSceneObject::Index(), ageName, statusStr, subString); plKey key=FindObjectByName(name, plSceneObject::Index(), ageName, statusStr, subString);
if (!plSceneObject::ConvertNoRef(key ? key->ObjectIsLoaded() : nil)) if (!plSceneObject::ConvertNoRef(key ? key->ObjectIsLoaded() : nil))
{ {
if (statusStr) if (statusStr)
@ -356,7 +356,7 @@ plKey FindSceneObjectByName(const char* name, const char* ageName, char* statusS
// Find an object from name, type (string) and optionally age. // Find an object from name, type (string) and optionally age.
// Name can be an alias specified by saying $foo // Name can be an alias specified by saying $foo
// //
plKey FindObjectByNameAndType(const char* name, const char* typeName, const char* ageName, plKey FindObjectByNameAndType(const plString& name, const char* typeName, const char* ageName,
char* statusStr, bool subString) char* statusStr, bool subString)
{ {
if (!typeName) if (!typeName)
@ -1628,7 +1628,7 @@ PF_CONSOLE_CMD( Graphics_Renderer, GrabCubeMap,
"Take cubemap from sceneObject's position and name it prefix_XX.jpg") "Take cubemap from sceneObject's position and name it prefix_XX.jpg")
{ {
char str[512]; char str[512];
const char* objName = params[0]; plString objName = plString::FromUtf8(params[0]);
plKey key = FindSceneObjectByName(objName, nil, str); plKey key = FindSceneObjectByName(objName, nil, str);
PrintString( str ); PrintString( str );
if( !key ) if( !key )
@ -1892,7 +1892,7 @@ PF_CONSOLE_CMD( Graphics_Show, SingleSound,
const char *ageName = plAgeLoader::GetInstance()->GetCurrAgeDesc().GetAgeName(); const char *ageName = plAgeLoader::GetInstance()->GetCurrAgeDesc().GetAgeName();
plKey key = FindSceneObjectByName( params[ 0 ], ageName, str, true ); plKey key = FindSceneObjectByName( plString::FromUtf8( params[ 0 ] ), ageName, str, true );
plSceneObject *obj = ( key != nil ) ? plSceneObject::ConvertNoRef( key->GetObjectPtr() ) : nil; plSceneObject *obj = ( key != nil ) ? plSceneObject::ConvertNoRef( key->GetObjectPtr() ) : nil;
if( !obj ) if( !obj )
{ {
@ -2224,7 +2224,7 @@ PF_CONSOLE_CMD( App,
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
plSceneObject* obj = plSceneObject::ConvertNoRef(key->GetObjectPtr()); plSceneObject* obj = plSceneObject::ConvertNoRef(key->GetObjectPtr());
if( !obj ) if( !obj )
{ {
@ -2301,7 +2301,7 @@ PF_CONSOLE_CMD( App,
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
plSceneObject* obj = plSceneObject::ConvertNoRef(key->GetObjectPtr()); plSceneObject* obj = plSceneObject::ConvertNoRef(key->GetObjectPtr());
if( !obj ) if( !obj )
{ {
@ -2355,18 +2355,18 @@ PF_CONSOLE_CMD( App,
"Enable/Disable/Toggle display of named CamView object" ) "Enable/Disable/Toggle display of named CamView object" )
{ {
char str[256]; char str[256];
char* name = params[0]; plString name = plString::FromUtf8(params[0]);
plKey key = FindSceneObjectByName(name, nil, str); plKey key = FindSceneObjectByName(name, nil, str);
if( !key ) if( !key )
{ {
sprintf(str, "%s - Not Found!", name); sprintf(str, "%s - Not Found!", name.c_str());
PrintString(str); PrintString(str);
return; return;
} }
plSceneObject* obj = plSceneObject::ConvertNoRef(key->GetObjectPtr()); plSceneObject* obj = plSceneObject::ConvertNoRef(key->GetObjectPtr());
if( !obj ) if( !obj )
{ {
sprintf(str, "%s - Not Found!", name); sprintf(str, "%s - Not Found!", name.c_str());
PrintString(str); PrintString(str);
return; return;
} }
@ -2379,11 +2379,11 @@ PF_CONSOLE_CMD( App,
} }
if( i >= obj->GetNumModifiers() ) if( i >= obj->GetNumModifiers() )
{ {
sprintf(str, "%s - No CamView Modifier found!", name); sprintf(str, "%s - No CamView Modifier found!", name.c_str());
PrintString(str); PrintString(str);
return; return;
} }
strcpy(str, name); strcpy(str, name.c_str());
plAnimCmdMsg* cmd = TRACKED_NEW plAnimCmdMsg(nil, obj->GetModifier(i)->GetKey(), nil); plAnimCmdMsg* cmd = TRACKED_NEW plAnimCmdMsg(nil, obj->GetModifier(i)->GetKey(), nil);
@ -2818,7 +2818,7 @@ PF_CONSOLE_CMD( Registry, ListRefs, "string keyType, string keyName", "For the g
"the objects who currently have active refs on it." ) "the objects who currently have active refs on it." )
{ {
char result[ 256 ]; char result[ 256 ];
plKey obj = FindObjectByNameAndType( params[ 1 ], params[ 0 ], nil, result); plKey obj = FindObjectByNameAndType( plString::FromUtf8( params[ 1 ] ), params[ 0 ], nil, result);
if( obj == nil ) if( obj == nil )
{ {
PrintString( result ); PrintString( result );
@ -2994,8 +2994,7 @@ PF_CONSOLE_CMD( Camera, // groupName
PF_CONSOLE_CMD( Camera, SwitchTo, "string cameraName", "Switch to the named camera") PF_CONSOLE_CMD( Camera, SwitchTo, "string cameraName", "Switch to the named camera")
{ {
char str[256]; char str[256];
char foo[256]; plString foo = plString::Format("%s_", plString::FromUtf8(params[0]));
sprintf(foo, "%s_", (const char*)params[0]);
plKey key = FindObjectByNameAndType(foo, "plCameraModifier1", nil, str, true); plKey key = FindObjectByNameAndType(foo, "plCameraModifier1", nil, str, true);
PrintString(str); PrintString(str);
@ -3119,7 +3118,7 @@ PF_CONSOLE_CMD( Camera, // groupName
PF_CONSOLE_GROUP( Logic ) PF_CONSOLE_GROUP( Logic )
static plLogicModBase *FindLogicMod(const char *name) static plLogicModBase *FindLogicMod(const plString &name)
{ {
char str[256]; char str[256];
plKey key = FindObjectByNameAndType(name, "plLogicModifier", nil, str, true); plKey key = FindObjectByNameAndType(name, "plLogicModifier", nil, str, true);
@ -3133,7 +3132,7 @@ static plLogicModBase *FindLogicMod(const char *name)
PF_CONSOLE_CMD( Logic, TriggerDetectorNum, "int detectorNum", "Triggers the detector with this number (from ListDetectors)") PF_CONSOLE_CMD( Logic, TriggerDetectorNum, "int detectorNum", "Triggers the detector with this number (from ListDetectors)")
{ {
std::vector<std::string> activatorNames; std::vector<plString> activatorNames;
plKeyFinder::Instance().GetActivatorNames(activatorNames); plKeyFinder::Instance().GetActivatorNames(activatorNames);
int activatorNum = params[0]; int activatorNum = params[0];
@ -3143,21 +3142,21 @@ PF_CONSOLE_CMD( Logic, TriggerDetectorNum, "int detectorNum", "Triggers the dete
return; return;
} }
plLogicModBase *mod = FindLogicMod(activatorNames[activatorNum-1].c_str()); plLogicModBase *mod = FindLogicMod(activatorNames[activatorNum-1]);
if (mod) if (mod)
mod->ConsoleTrigger(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); mod->ConsoleTrigger(plNetClientMgr::GetInstance()->GetLocalPlayerKey());
} }
PF_CONSOLE_CMD( Logic, TriggerDetector, "string detectorComp", "Triggers the named detector component") PF_CONSOLE_CMD( Logic, TriggerDetector, "string detectorComp", "Triggers the named detector component")
{ {
plLogicModBase *mod = FindLogicMod((const char*)params[0]); plLogicModBase *mod = FindLogicMod(plString::FromUtf8(params[0]));
if (mod) if (mod)
mod->ConsoleTrigger(plNetClientMgr::GetInstance()->GetLocalPlayerKey()); mod->ConsoleTrigger(plNetClientMgr::GetInstance()->GetLocalPlayerKey());
} }
PF_CONSOLE_CMD(Logic, EnableDetector, "string detectorComp, bool enable", "Enables/disables the named detector component") PF_CONSOLE_CMD(Logic, EnableDetector, "string detectorComp, bool enable", "Enables/disables the named detector component")
{ {
plLogicModBase *mod = FindLogicMod((const char*)params[0]); plLogicModBase *mod = FindLogicMod(plString::FromUtf8(params[0]));
if (mod) if (mod)
{ {
plEnableMsg* enableMsg = TRACKED_NEW plEnableMsg; plEnableMsg* enableMsg = TRACKED_NEW plEnableMsg;
@ -3202,7 +3201,7 @@ PF_CONSOLE_CMD( Logic, TriggerResponderNum, "int responderNum, ...", "Triggers t
return; return;
} }
std::vector<std::string> responderNames; std::vector<plString> responderNames;
plKeyFinder::Instance().GetResponderNames(responderNames); plKeyFinder::Instance().GetResponderNames(responderNames);
int responderNum = params[0]; int responderNum = params[0];
@ -3219,7 +3218,7 @@ PF_CONSOLE_CMD( Logic, TriggerResponderNum, "int responderNum, ...", "Triggers t
} }
char str[256]; char str[256];
plKey key = FindObjectByNameAndType(responderNames[responderNum-1].c_str(), "plResponderModifier", nil, str, true); plKey key = FindObjectByNameAndType(responderNames[responderNum-1], "plResponderModifier", nil, str, true);
PrintString(str); PrintString(str);
if (key) if (key)
@ -3235,7 +3234,7 @@ PF_CONSOLE_CMD( Logic, TriggerResponder, "string responderComp, ...", "Triggers
} }
char str[256]; char str[256];
plKey key = FindObjectByNameAndType(params[0], "plResponderModifier", nil, str, true); plKey key = FindObjectByNameAndType(plString::FromUtf8(params[0]), "plResponderModifier", nil, str, true);
PrintString(str); PrintString(str);
int responderState = -1; int responderState = -1;
@ -3257,7 +3256,7 @@ PF_CONSOLE_CMD( Logic, FastForwardResponder, "string responderComp, ...", "Fastf
} }
char str[256]; char str[256];
plKey key = FindObjectByNameAndType(params[0], "plResponderModifier", nil, str, true); plKey key = FindObjectByNameAndType(plString::FromUtf8(params[0]), "plResponderModifier", nil, str, true);
PrintString(str); PrintString(str);
int responderState = -1; int responderState = -1;
@ -3272,7 +3271,7 @@ PF_CONSOLE_CMD( Logic, FastForwardResponder, "string responderComp, ...", "Fastf
PF_CONSOLE_CMD(Logic, ListDetectors, "", "Prints the names of the loaded detectors to the console") PF_CONSOLE_CMD(Logic, ListDetectors, "", "Prints the names of the loaded detectors to the console")
{ {
std::vector<std::string> activatorNames; std::vector<plString> activatorNames;
plKeyFinder::Instance().GetActivatorNames(activatorNames); plKeyFinder::Instance().GetActivatorNames(activatorNames);
for (int i = 0; i < activatorNames.size(); i++) for (int i = 0; i < activatorNames.size(); i++)
@ -3285,7 +3284,7 @@ PF_CONSOLE_CMD(Logic, ListDetectors, "", "Prints the names of the loaded detecto
PF_CONSOLE_CMD(Logic, ListResponders, "", "Prints the names of the loaded responders to the console") PF_CONSOLE_CMD(Logic, ListResponders, "", "Prints the names of the loaded responders to the console")
{ {
std::vector<std::string> responderNames; std::vector<plString> responderNames;
plKeyFinder::Instance().GetResponderNames(responderNames); plKeyFinder::Instance().GetResponderNames(responderNames);
for (int i = 0; i < responderNames.size(); i++) for (int i = 0; i < responderNames.size(); i++)
@ -3568,7 +3567,7 @@ PF_CONSOLE_CMD( Audio, SetVolume,
"string obj, float vol", "Sets the volume on a given object. 1 is max volume, 0 is silence" ) "string obj, float vol", "Sets the volume on a given object. 1 is max volume, 0 is silence" )
{ {
char str[ 256 ]; char str[ 256 ];
plKey key = FindSceneObjectByName(params[ 0 ], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[ 0 ]), nil, str);
if( key == nil ) if( key == nil )
return; return;
@ -3597,7 +3596,7 @@ PF_CONSOLE_CMD( Audio, IsolateSound,
plKey key; plKey key;
plAudioSysMsg *asMsg; plAudioSysMsg *asMsg;
key = FindSceneObjectByName( params[ 0 ], nil, str ); key = FindSceneObjectByName( plString::FromUtf8( params[ 0 ] ), nil, str );
if( key == nil ) if( key == nil )
{ {
sprintf( str, "Cannot find sound %s", (char *)params[ 0 ] ); sprintf( str, "Cannot find sound %s", (char *)params[ 0 ] );
@ -4020,7 +4019,7 @@ PF_CONSOLE_CMD( Nav, UnloadPlayer, // Group name, Function name
"unloads a named player" ) // Help string "unloads a named player" ) // Help string
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
PrintString("UnloadPlayer (console version) is currently broken. Hassle Matt."); PrintString("UnloadPlayer (console version) is currently broken. Hassle Matt.");
// plNetClientMgr::UnloadPlayer(key); // plNetClientMgr::UnloadPlayer(key);
} }
@ -4038,12 +4037,12 @@ PF_CONSOLE_CMD( Nav, MovePlayer, // Group name, Function name
"moves a player from one paging unit to another" ) // Help string "moves a player from one paging unit to another" ) // Help string
{ {
char str[256]; char str[256];
plKey playerKey = FindSceneObjectByName(params[0], nil, str); plKey playerKey = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
PrintString(str); PrintString(str);
if( !playerKey ) if( !playerKey )
return; return;
plKey nodeKey = FindObjectByName(params[1], plSceneNode::Index(), nil, str); plKey nodeKey = FindObjectByName(plString::FromUtf8(params[1]), plSceneNode::Index(), nil, str);
PrintString(str); PrintString(str);
if( !nodeKey ) if( !nodeKey )
return; return;
@ -4348,9 +4347,8 @@ PF_CONSOLE_CMD( Access,
"Set the weight for a morphMod" ) "Set the weight for a morphMod" )
{ {
char str[256]; char str[256];
char name[256];
char* preFix = params[0]; char* preFix = params[0];
sprintf(name, "%s_plMorphSequence_0", preFix); plString name = plString::Format("%s_plMorphSequence_0", preFix);
plKey key = FindObjectByName(name, plMorphSequence::Index(), nil, str); plKey key = FindObjectByName(name, plMorphSequence::Index(), nil, str);
PrintString(str); PrintString(str);
if (!key) if (!key)
@ -4374,9 +4372,8 @@ PF_CONSOLE_CMD( Access,
"Activate a morphMod" ) "Activate a morphMod" )
{ {
char str[256]; char str[256];
char name[256];
char* preFix = params[0]; char* preFix = params[0];
sprintf(name, "%s_plMorphSequence_2", preFix); plString name = plString::Format("%s_plMorphSequence_2", preFix);
plKey key = FindObjectByName(name, plMorphSequence::Index(), nil, str); plKey key = FindObjectByName(name, plMorphSequence::Index(), nil, str);
PrintString(str); PrintString(str);
if (!key) if (!key)
@ -4396,9 +4393,8 @@ PF_CONSOLE_CMD( Access,
"Activate a morphMod" ) "Activate a morphMod" )
{ {
char str[256]; char str[256];
char name[256];
char* preFix = params[0]; char* preFix = params[0];
sprintf(name, "%s_plMorphSequence_2", preFix); plString name = plString::Format("%s_plMorphSequence_2", preFix);
plKey key = FindObjectByName(name, plMorphSequence::Index(), nil, str); plKey key = FindObjectByName(name, plMorphSequence::Index(), nil, str);
PrintString(str); PrintString(str);
if (!key) if (!key)
@ -4623,7 +4619,7 @@ PF_CONSOLE_CMD( Access,
"Test fading on visibility" ) "Test fading on visibility" )
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
PrintString(str); PrintString(str);
if( !key ) if( !key )
return; return;
@ -4655,7 +4651,7 @@ PF_CONSOLE_CMD( Access,
"Set the los test marker" ) "Set the los test marker" )
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
PrintString(str); PrintString(str);
if( !key ) if( !key )
return; return;
@ -4669,7 +4665,7 @@ PF_CONSOLE_CMD( Access,
"Set the Los hack marker" ) "Set the Los hack marker" )
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
PrintString(str); PrintString(str);
plSceneObject* so = nil; plSceneObject* so = nil;
@ -4744,7 +4740,7 @@ PF_CONSOLE_CMD( Access,
"Fire shot along gun's z-axis, creating decal of radius <radius>, with optional max-range (def 1000)" ) "Fire shot along gun's z-axis, creating decal of radius <radius>, with optional max-range (def 1000)" )
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
PrintString(str); PrintString(str);
if( !key ) if( !key )
return; return;
@ -4825,7 +4821,7 @@ PF_CONSOLE_CMD( Access,
"Add particle system <psys> to bulletMgr <bull>") "Add particle system <psys> to bulletMgr <bull>")
{ {
char str[256]; char str[256];
plKey bullKey = FindObjectByName(params[0], plDynaBulletMgr::Index(), nil, str, false); plKey bullKey = FindObjectByName(plString::FromUtf8(params[0]), plDynaBulletMgr::Index(), nil, str, false);
PrintString(str); PrintString(str);
if( !(bullKey && bullKey->GetObjectPtr()) ) if( !(bullKey && bullKey->GetObjectPtr()) )
{ {
@ -4833,7 +4829,7 @@ PF_CONSOLE_CMD( Access,
return; return;
} }
plKey sysKey = FindSceneObjectByName(params[1], nil, str); plKey sysKey = FindSceneObjectByName(plString::FromUtf8(params[1]), nil, str);
if( !(sysKey && sysKey->GetObjectPtr()) ) if( !(sysKey && sysKey->GetObjectPtr()) )
{ {
PrintString("Psys not found"); PrintString("Psys not found");
@ -5030,7 +5026,7 @@ static void IDisplayWaveVal(PrintFunk PrintString, plWaveSet7* wave, plWaveCmd::
PrintString(buff); PrintString(buff);
} }
static plWaveSet7* IGetWaveSet(PrintFunk PrintString, const char* name) static plWaveSet7* IGetWaveSet(PrintFunk PrintString, const plString& name)
{ {
char str[256]; char str[256];
plKey waveKey = FindObjectByName(name, plWaveSet7::Index(), nil, str, false); plKey waveKey = FindObjectByName(name, plWaveSet7::Index(), nil, str, false);
@ -5046,7 +5042,7 @@ static plWaveSet7* IGetWaveSet(PrintFunk PrintString, const char* name)
return waveSet; return waveSet;
} }
static plWaveSet7* ICheckWaveParams(PrintFunk PrintString, const char* name, int numParams, int n, plWaveCmd::Cmd cmd) static plWaveSet7* ICheckWaveParams(PrintFunk PrintString, const plString& name, int numParams, int n, plWaveCmd::Cmd cmd)
{ {
if( !numParams ) if( !numParams )
{ {
@ -5083,7 +5079,7 @@ static hsScalar LimitVal(hsScalar val, hsScalar lo, hsScalar hi, PrintFunk Print
static bool ISendWaveCmd1f(PrintFunk PrintString, pfConsoleCmdParam* params, int numParams, plWaveCmd::Cmd cmd) static bool ISendWaveCmd1f(PrintFunk PrintString, pfConsoleCmdParam* params, int numParams, plWaveCmd::Cmd cmd)
{ {
plWaveSet7* wave = ICheckWaveParams(PrintString, params[0], numParams, 2, cmd); plWaveSet7* wave = ICheckWaveParams(PrintString, plString::FromUtf8(params[0]), numParams, 2, cmd);
if( !wave ) if( !wave )
return false; return false;
@ -5162,7 +5158,7 @@ static bool ISendWaveCmd1f(PrintFunk PrintString, pfConsoleCmdParam* params, int
static bool ISendWaveCmd2f(PrintFunk PrintString, pfConsoleCmdParam* params, int numParams, plWaveCmd::Cmd cmd) static bool ISendWaveCmd2f(PrintFunk PrintString, pfConsoleCmdParam* params, int numParams, plWaveCmd::Cmd cmd)
{ {
plWaveSet7* wave = ICheckWaveParams(PrintString, params[0], numParams, 3, cmd); plWaveSet7* wave = ICheckWaveParams(PrintString, plString::FromUtf8(params[0]), numParams, 3, cmd);
if( !wave ) if( !wave )
return false; return false;
@ -5205,7 +5201,7 @@ static bool ISendWaveCmd2f(PrintFunk PrintString, pfConsoleCmdParam* params, int
static bool ISendWaveCmd3f(PrintFunk PrintString, pfConsoleCmdParam* params, int numParams, plWaveCmd::Cmd cmd) static bool ISendWaveCmd3f(PrintFunk PrintString, pfConsoleCmdParam* params, int numParams, plWaveCmd::Cmd cmd)
{ {
plWaveSet7* wave = ICheckWaveParams(PrintString, params[0], numParams, 4, cmd); plWaveSet7* wave = ICheckWaveParams(PrintString, plString::FromUtf8(params[0]), numParams, 4, cmd);
if( !wave ) if( !wave )
return false; return false;
@ -5243,7 +5239,7 @@ static bool ISendWaveCmd3f(PrintFunk PrintString, pfConsoleCmdParam* params, int
static bool ISendWaveCmd4c(PrintFunk PrintString, pfConsoleCmdParam* params, int numParams, plWaveCmd::Cmd cmd) static bool ISendWaveCmd4c(PrintFunk PrintString, pfConsoleCmdParam* params, int numParams, plWaveCmd::Cmd cmd)
{ {
plWaveSet7* wave = ICheckWaveParams(PrintString, params[0], numParams, 4, cmd); plWaveSet7* wave = ICheckWaveParams(PrintString, plString::FromUtf8(params[0]), numParams, 4, cmd);
if( !wave ) if( !wave )
return false; return false;
@ -5279,7 +5275,7 @@ PF_CONSOLE_CMD( Wave, Log, // Group name, Function name
"string waveSet", // Params none "string waveSet", // Params none
"Toggle logging for waves" ) // Help string "Toggle logging for waves" ) // Help string
{ {
const char* name = params[0]; plString name = plString::FromUtf8(params[0]);
plWaveSet7* waveSet = IGetWaveSet(PrintString, name); plWaveSet7* waveSet = IGetWaveSet(PrintString, name);
if( waveSet ) if( waveSet )
{ {
@ -5290,7 +5286,7 @@ PF_CONSOLE_CMD( Wave, Log, // Group name, Function name
waveSet->StopLog(); waveSet->StopLog();
char buff[256]; char buff[256];
sprintf(buff, "Logging for %s now %s", name, logging ? "on" : "off"); sprintf(buff, "Logging for %s now %s", name.c_str(), logging ? "on" : "off");
PrintString(buff); PrintString(buff);
} }
} }
@ -5299,7 +5295,7 @@ PF_CONSOLE_CMD( Wave, Graph, // Group name, Function name
"string waveSet", // Params none "string waveSet", // Params none
"Toggle graphing lens for waves" ) // Help string "Toggle graphing lens for waves" ) // Help string
{ {
const char* name = params[0]; plString name = plString::FromUtf8(params[0]);
plWaveSet7* waveSet = IGetWaveSet(PrintString, name); plWaveSet7* waveSet = IGetWaveSet(PrintString, name);
if( waveSet ) if( waveSet )
{ {
@ -5310,7 +5306,7 @@ PF_CONSOLE_CMD( Wave, Graph, // Group name, Function name
waveSet->StopGraph(); waveSet->StopGraph();
char buff[256]; char buff[256];
sprintf(buff, "Graphing for %s now %s", name, graphing ? "on" : "off"); sprintf(buff, "Graphing for %s now %s", name.c_str(), graphing ? "on" : "off");
PrintString(buff); PrintString(buff);
} }
} }
@ -5514,7 +5510,7 @@ PF_CONSOLE_CMD( SceneObject_SetEnable, Drawable, // Group name, Function name
"Enable or disable drawing of a sceneobject" ) // Help string "Enable or disable drawing of a sceneobject" ) // Help string
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
PrintString(str); PrintString(str);
if (!key) if (!key)
return; return;
@ -5533,7 +5529,7 @@ PF_CONSOLE_CMD( SceneObject_SetEnable, Physical, // Group name, Function name
"Enable or disable the physical of a sceneobject" ) // Help string "Enable or disable the physical of a sceneobject" ) // Help string
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
PrintString(str); PrintString(str);
if (!key) if (!key)
return; return;
@ -5575,7 +5571,7 @@ PF_CONSOLE_CMD( SceneObject_SetEnable, Audible, // Group name, Function name
"Enable or disable the audible of a sceneobject" ) // Help string "Enable or disable the audible of a sceneobject" ) // Help string
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
PrintString(str); PrintString(str);
if (!key) if (!key)
return; return;
@ -5594,7 +5590,7 @@ PF_CONSOLE_CMD( SceneObject_SetEnable, All, // Group name, Function name
"Enable or disable all fxns of a sceneobject" ) // Help string "Enable or disable all fxns of a sceneobject" ) // Help string
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
PrintString(str); PrintString(str);
if (!key) if (!key)
return; return;
@ -5614,8 +5610,8 @@ PF_CONSOLE_CMD( SceneObject, Attach, // Group name, Function name
{ {
char str[256]; char str[256];
const char* childName = params[0]; plString childName = plString::FromUtf8(params[0]);
const char* parentName = params[1]; plString parentName = plString::FromUtf8(params[1]);
plKey childKey = FindSceneObjectByName(childName, nil, str); plKey childKey = FindSceneObjectByName(childName, nil, str);
if( !childKey ) if( !childKey )
@ -5641,7 +5637,7 @@ PF_CONSOLE_CMD( SceneObject, Attach, // Group name, Function name
plAttachMsg* attMsg = TRACKED_NEW plAttachMsg(parentKey, child, plRefMsg::kOnRequest, nil); plAttachMsg* attMsg = TRACKED_NEW plAttachMsg(parentKey, child, plRefMsg::kOnRequest, nil);
plgDispatch::MsgSend(attMsg); plgDispatch::MsgSend(attMsg);
sprintf(str, "%s now child of %s", childName, parentName); sprintf(str, "%s now child of %s", childName.c_str(), parentName.c_str());
PrintString(str); PrintString(str);
} }
@ -5652,7 +5648,7 @@ PF_CONSOLE_CMD( SceneObject, Detach, // Group name, Function name
{ {
char str[256]; char str[256];
const char* childName = params[0]; plString childName = plString::FromUtf8(params[0]);
plKey childKey = FindSceneObjectByName(childName, nil, str); plKey childKey = FindSceneObjectByName(childName, nil, str);
if( !childKey ) if( !childKey )
@ -5677,13 +5673,13 @@ PF_CONSOLE_CMD( SceneObject, Detach, // Group name, Function name
plAttachMsg* attMsg = TRACKED_NEW plAttachMsg(parentKey, child, plRefMsg::kOnRemove, nil); plAttachMsg* attMsg = TRACKED_NEW plAttachMsg(parentKey, child, plRefMsg::kOnRemove, nil);
plgDispatch::MsgSend(attMsg); plgDispatch::MsgSend(attMsg);
sprintf(str, "%s detached from %s", childName, parentKey->GetName()); sprintf(str, "%s detached from %s", childName.c_str(), parentKey->GetName().c_str());
PrintString(str); PrintString(str);
return; return;
} }
else else
{ {
sprintf(str, "%s not attached to anything", childName); sprintf(str, "%s not attached to anything", childName.c_str());
PrintString(str); PrintString(str);
return; return;
} }
@ -6238,7 +6234,7 @@ PF_CONSOLE_CMD( Age, SetSDLBool, "string varName, bool value, int index", "Set t
PF_CONSOLE_GROUP( ParticleSystem ) // Defines a main command group PF_CONSOLE_GROUP( ParticleSystem ) // Defines a main command group
void UpdateParticleParam(char *objName, Int32 paramID, hsScalar value, void (*PrintString)(const char *)) void UpdateParticleParam(const plString &objName, Int32 paramID, hsScalar value, void (*PrintString)(const char *))
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(objName, nil, str); plKey key = FindSceneObjectByName(objName, nil, str);
@ -6267,7 +6263,7 @@ PF_CONSOLE_CMD( ParticleSystem, // Group name
"string objName, float value", // Params "string objName, float value", // Params
"Set the particles-per-second generated" ) // Help string "Set the particles-per-second generated" ) // Help string
{ {
UpdateParticleParam(params[0], plParticleUpdateMsg::kParamParticlesPerSecond, params[1], PrintString); UpdateParticleParam(plString::FromUtf8(params[0]), plParticleUpdateMsg::kParamParticlesPerSecond, params[1], PrintString);
} }
PF_CONSOLE_CMD( ParticleSystem, // Group name PF_CONSOLE_CMD( ParticleSystem, // Group name
@ -6275,7 +6271,7 @@ PF_CONSOLE_CMD( ParticleSystem, // Group name
"string objName, float value", // Params "string objName, float value", // Params
"Set the initial range of pitch of generated particles" ) // Help string "Set the initial range of pitch of generated particles" ) // Help string
{ {
UpdateParticleParam(params[0], plParticleUpdateMsg::kParamInitPitchRange, params[1], PrintString); UpdateParticleParam(plString::FromUtf8(params[0]), plParticleUpdateMsg::kParamInitPitchRange, params[1], PrintString);
} }
PF_CONSOLE_CMD( ParticleSystem, // Group name PF_CONSOLE_CMD( ParticleSystem, // Group name
@ -6283,7 +6279,7 @@ PF_CONSOLE_CMD( ParticleSystem, // Group name
"string objName, float value", // Params "string objName, float value", // Params
"Set the initial range of yaw of generated particles" ) // Help string "Set the initial range of yaw of generated particles" ) // Help string
{ {
UpdateParticleParam(params[0], plParticleUpdateMsg::kParamInitYawRange, params[1], PrintString); UpdateParticleParam(plString::FromUtf8(params[0]), plParticleUpdateMsg::kParamInitYawRange, params[1], PrintString);
} }
PF_CONSOLE_CMD( ParticleSystem, // Group name PF_CONSOLE_CMD( ParticleSystem, // Group name
@ -6291,7 +6287,7 @@ PF_CONSOLE_CMD( ParticleSystem, // Group name
"string objName, float value", // Params "string objName, float value", // Params
"Set the minimum initial velocity of generated particles" ) // Help string "Set the minimum initial velocity of generated particles" ) // Help string
{ {
UpdateParticleParam(params[0], plParticleUpdateMsg::kParamVelMin, params[1], PrintString); UpdateParticleParam(plString::FromUtf8(params[0]), plParticleUpdateMsg::kParamVelMin, params[1], PrintString);
} }
PF_CONSOLE_CMD( ParticleSystem, // Group name PF_CONSOLE_CMD( ParticleSystem, // Group name
@ -6299,7 +6295,7 @@ PF_CONSOLE_CMD( ParticleSystem, // Group name
"string objName, float value", // Params "string objName, float value", // Params
"Set the maximum initial velocity of generated particles" ) // Help string "Set the maximum initial velocity of generated particles" ) // Help string
{ {
UpdateParticleParam(params[0], plParticleUpdateMsg::kParamVelMax, params[1], PrintString); UpdateParticleParam(plString::FromUtf8(params[0]), plParticleUpdateMsg::kParamVelMax, params[1], PrintString);
} }
PF_CONSOLE_CMD( ParticleSystem, // Group name PF_CONSOLE_CMD( ParticleSystem, // Group name
@ -6307,7 +6303,7 @@ PF_CONSOLE_CMD( ParticleSystem, // Group name
"string objName, float value", // Params "string objName, float value", // Params
"Set the width of generated particles" ) // Help string "Set the width of generated particles" ) // Help string
{ {
UpdateParticleParam(params[0], plParticleUpdateMsg::kParamXSize, params[1], PrintString); UpdateParticleParam(plString::FromUtf8(params[0]), plParticleUpdateMsg::kParamXSize, params[1], PrintString);
} }
PF_CONSOLE_CMD( ParticleSystem, // Group name PF_CONSOLE_CMD( ParticleSystem, // Group name
@ -6315,7 +6311,7 @@ PF_CONSOLE_CMD( ParticleSystem, // Group name
"string objName, float value", // Params "string objName, float value", // Params
"Set the height of generated particles" ) // Help string "Set the height of generated particles" ) // Help string
{ {
UpdateParticleParam(params[0], plParticleUpdateMsg::kParamYSize, params[1], PrintString); UpdateParticleParam(plString::FromUtf8(params[0]), plParticleUpdateMsg::kParamYSize, params[1], PrintString);
} }
PF_CONSOLE_CMD( ParticleSystem, // Group name PF_CONSOLE_CMD( ParticleSystem, // Group name
@ -6323,7 +6319,7 @@ PF_CONSOLE_CMD( ParticleSystem, // Group name
"string objName, float value", // Params "string objName, float value", // Params
"Set the minimum width/height scaling of generated particles" ) // Help string "Set the minimum width/height scaling of generated particles" ) // Help string
{ {
UpdateParticleParam(params[0], plParticleUpdateMsg::kParamScaleMin, params[1], PrintString); UpdateParticleParam(plString::FromUtf8(params[0]), plParticleUpdateMsg::kParamScaleMin, params[1], PrintString);
} }
PF_CONSOLE_CMD( ParticleSystem, // Group name PF_CONSOLE_CMD( ParticleSystem, // Group name
@ -6331,7 +6327,7 @@ PF_CONSOLE_CMD( ParticleSystem, // Group name
"string objName, float value", // Params "string objName, float value", // Params
"Set the maximum width/height scaling of generated particles" ) // Help string "Set the maximum width/height scaling of generated particles" ) // Help string
{ {
UpdateParticleParam(params[0], plParticleUpdateMsg::kParamScaleMax, params[1], PrintString); UpdateParticleParam(plString::FromUtf8(params[0]), plParticleUpdateMsg::kParamScaleMax, params[1], PrintString);
} }
PF_CONSOLE_CMD( ParticleSystem, // Group name PF_CONSOLE_CMD( ParticleSystem, // Group name
@ -6339,7 +6335,7 @@ PF_CONSOLE_CMD( ParticleSystem, // Group name
"string objName, float value", // Params "string objName, float value", // Params
"Set the remaining life of the particle generator" ) // Help string "Set the remaining life of the particle generator" ) // Help string
{ {
UpdateParticleParam(params[0], plParticleUpdateMsg::kParamGenLife, params[1], PrintString); UpdateParticleParam(plString::FromUtf8(params[0]), plParticleUpdateMsg::kParamGenLife, params[1], PrintString);
} }
PF_CONSOLE_CMD( ParticleSystem, // Group name PF_CONSOLE_CMD( ParticleSystem, // Group name
@ -6347,7 +6343,7 @@ PF_CONSOLE_CMD( ParticleSystem, // Group name
"string objName, float value", // Params "string objName, float value", // Params
"Set the minimum lifespan of generated particles (negative values make them immortal)" ) // Help string "Set the minimum lifespan of generated particles (negative values make them immortal)" ) // Help string
{ {
UpdateParticleParam(params[0], plParticleUpdateMsg::kParamPartLifeMin, params[1], PrintString); UpdateParticleParam(plString::FromUtf8(params[0]), plParticleUpdateMsg::kParamPartLifeMin, params[1], PrintString);
} }
PF_CONSOLE_CMD( ParticleSystem, // Group name PF_CONSOLE_CMD( ParticleSystem, // Group name
@ -6355,7 +6351,7 @@ PF_CONSOLE_CMD( ParticleSystem, // Group name
"string objName, float value", // Params "string objName, float value", // Params
"Set the max lifespan of generated particles" ) // Help string "Set the max lifespan of generated particles" ) // Help string
{ {
UpdateParticleParam(params[0], plParticleUpdateMsg::kParamPartLifeMax, params[1], PrintString); UpdateParticleParam(plString::FromUtf8(params[0]), plParticleUpdateMsg::kParamPartLifeMax, params[1], PrintString);
} }
PF_CONSOLE_CMD( ParticleSystem, PF_CONSOLE_CMD( ParticleSystem,
@ -6364,7 +6360,7 @@ PF_CONSOLE_CMD( ParticleSystem,
"Creates a system (if necessary) on the avatar, and transfers particles" ) "Creates a system (if necessary) on the avatar, and transfers particles" )
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
if (key == nil) if (key == nil)
return; return;
@ -6383,7 +6379,7 @@ PF_CONSOLE_CMD( ParticleSystem,
"Flag some particles for death." ) "Flag some particles for death." )
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
if (key == nil) if (key == nil)
return; return;
@ -6402,7 +6398,7 @@ PF_CONSOLE_CMD( ParticleSystem,
PF_CONSOLE_SUBGROUP( ParticleSystem, Flock ) PF_CONSOLE_SUBGROUP( ParticleSystem, Flock )
static plParticleFlockEffect *FindFlock(char *objName) static plParticleFlockEffect *FindFlock(const plString &objName)
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(objName, nil, str); plKey key = FindSceneObjectByName(objName, nil, str);
@ -6430,7 +6426,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock,
"string objName, float x, float y, float z", "string objName, float x, float y, float z",
"Set the flock's goal to be an offset from its sceneObject") "Set the flock's goal to be an offset from its sceneObject")
{ {
plParticleEffect *flock = FindFlock(params[0]); plParticleEffect *flock = FindFlock(plString::FromUtf8(params[0]));
if (flock) if (flock)
{ {
(TRACKED_NEW plParticleFlockMsg(nil, flock->GetKey(), 0, plParticleFlockMsg::kFlockCmdSetOffset, params[1], params[2], params[3]))->Send(); (TRACKED_NEW plParticleFlockMsg(nil, flock->GetKey(), 0, plParticleFlockMsg::kFlockCmdSetOffset, params[1], params[2], params[3]))->Send();
@ -6442,7 +6438,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock,
"string objName, float x, float y, float z", "string objName, float x, float y, float z",
"Set the goal for particles that leave the flock") "Set the goal for particles that leave the flock")
{ {
plParticleEffect *flock = FindFlock(params[0]); plParticleEffect *flock = FindFlock(plString::FromUtf8(params[0]));
if (flock) if (flock)
{ {
(TRACKED_NEW plParticleFlockMsg(nil, flock->GetKey(), 0, plParticleFlockMsg::kFlockCmdSetDissentPoint, params[1], params[2], params[3]))->Send(); (TRACKED_NEW plParticleFlockMsg(nil, flock->GetKey(), 0, plParticleFlockMsg::kFlockCmdSetDissentPoint, params[1], params[2], params[3]))->Send();
@ -6454,7 +6450,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock,
"string objName, float value", "string objName, float value",
"") "")
{ {
plParticleFlockEffect *flock = FindFlock(params[0]); plParticleFlockEffect *flock = FindFlock(plString::FromUtf8(params[0]));
if (flock) if (flock)
flock->SetInfluenceAvgRadius(params[1]); flock->SetInfluenceAvgRadius(params[1]);
else else
@ -6466,7 +6462,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock,
"string objName, float value", "string objName, float value",
"") "")
{ {
plParticleFlockEffect *flock = FindFlock(params[0]); plParticleFlockEffect *flock = FindFlock(plString::FromUtf8(params[0]));
if (flock) if (flock)
flock->SetInfluenceRepelRadius(params[1]); flock->SetInfluenceRepelRadius(params[1]);
else else
@ -6478,7 +6474,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock,
"string objName, float value", "string objName, float value",
"") "")
{ {
plParticleFlockEffect *flock = FindFlock(params[0]); plParticleFlockEffect *flock = FindFlock(plString::FromUtf8(params[0]));
if (flock) if (flock)
flock->SetGoalRadius(params[1]); flock->SetGoalRadius(params[1]);
else else
@ -6490,7 +6486,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock,
"string objName, float value", "string objName, float value",
"") "")
{ {
plParticleFlockEffect *flock = FindFlock(params[0]); plParticleFlockEffect *flock = FindFlock(plString::FromUtf8(params[0]));
if (flock) if (flock)
flock->SetFullChaseRadius(params[1]); flock->SetFullChaseRadius(params[1]);
else else
@ -6502,7 +6498,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock,
"string objName, float value", "string objName, float value",
"") "")
{ {
plParticleFlockEffect *flock = FindFlock(params[0]); plParticleFlockEffect *flock = FindFlock(plString::FromUtf8(params[0]));
if (flock) if (flock)
flock->SetConformStr(params[1]); flock->SetConformStr(params[1]);
else else
@ -6514,7 +6510,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock,
"string objName, float value", "string objName, float value",
"") "")
{ {
plParticleFlockEffect *flock = FindFlock(params[0]); plParticleFlockEffect *flock = FindFlock(plString::FromUtf8(params[0]));
if (flock) if (flock)
flock->SetRepelStr(params[1]); flock->SetRepelStr(params[1]);
else else
@ -6526,7 +6522,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock,
"string objName, float value", "string objName, float value",
"") "")
{ {
plParticleFlockEffect *flock = FindFlock(params[0]); plParticleFlockEffect *flock = FindFlock(plString::FromUtf8(params[0]));
if (flock) if (flock)
flock->SetGoalOrbitStr(params[1]); flock->SetGoalOrbitStr(params[1]);
else else
@ -6538,7 +6534,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock,
"string objName, float value", "string objName, float value",
"") "")
{ {
plParticleFlockEffect *flock = FindFlock(params[0]); plParticleFlockEffect *flock = FindFlock(plString::FromUtf8(params[0]));
if (flock) if (flock)
flock->SetGoalChaseStr(params[1]); flock->SetGoalChaseStr(params[1]);
else else
@ -6550,7 +6546,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock,
"string objName, float value", "string objName, float value",
"") "")
{ {
plParticleFlockEffect *flock = FindFlock(params[0]); plParticleFlockEffect *flock = FindFlock(plString::FromUtf8(params[0]));
if (flock) if (flock)
flock->SetMaxOrbitSpeed(params[1]); flock->SetMaxOrbitSpeed(params[1]);
else else
@ -6562,7 +6558,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock,
"string objName, float value", "string objName, float value",
"") "")
{ {
plParticleFlockEffect *flock = FindFlock(params[0]); plParticleFlockEffect *flock = FindFlock(plString::FromUtf8(params[0]));
if (flock) if (flock)
flock->SetMaxChaseSpeed(params[1]); flock->SetMaxChaseSpeed(params[1]);
else else
@ -6580,7 +6576,7 @@ PF_CONSOLE_CMD( ParticleSystem_Flock,
PF_CONSOLE_GROUP( Animation ) // Defines a main command group PF_CONSOLE_GROUP( Animation ) // Defines a main command group
void SendAnimCmdMsg(char *objName, plMessage *msg) void SendAnimCmdMsg(const plString &objName, plMessage *msg)
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(objName, nil, str); plKey key = FindSceneObjectByName(objName, nil, str);
@ -6603,7 +6599,7 @@ PF_CONSOLE_CMD( Animation, // Group name
msg->SetCmd(plAnimCmdMsg::kContinue); msg->SetCmd(plAnimCmdMsg::kContinue);
msg->SetAnimName(nil); msg->SetAnimName(nil);
msg->SetBCastFlag(plMessage::kPropagateToModifiers); msg->SetBCastFlag(plMessage::kPropagateToModifiers);
SendAnimCmdMsg(params[0], msg); SendAnimCmdMsg(plString::FromUtf8(params[0]), msg);
} }
PF_CONSOLE_CMD( Animation, // Group name PF_CONSOLE_CMD( Animation, // Group name
@ -6615,7 +6611,7 @@ PF_CONSOLE_CMD( Animation, // Group name
msg->SetCmd(plAnimCmdMsg::kStop); msg->SetCmd(plAnimCmdMsg::kStop);
msg->SetAnimName(nil); msg->SetAnimName(nil);
msg->SetBCastFlag(plMessage::kPropagateToModifiers); msg->SetBCastFlag(plMessage::kPropagateToModifiers);
SendAnimCmdMsg(params[0], msg); SendAnimCmdMsg(plString::FromUtf8(params[0]), msg);
} }
PF_CONSOLE_CMD( Animation, // Group name PF_CONSOLE_CMD( Animation, // Group name
@ -6629,7 +6625,7 @@ PF_CONSOLE_CMD( Animation, // Group name
msg->fBlendRate = params[3]; msg->fBlendRate = params[3];
msg->SetAnimName(params[1]); msg->SetAnimName(params[1]);
msg->SetBCastFlag(plMessage::kPropagateToModifiers); msg->SetBCastFlag(plMessage::kPropagateToModifiers);
SendAnimCmdMsg(params[0], msg); SendAnimCmdMsg(plString::FromUtf8(params[0]), msg);
} }
PF_CONSOLE_CMD( Animation, // Group name PF_CONSOLE_CMD( Animation, // Group name
@ -6643,7 +6639,7 @@ PF_CONSOLE_CMD( Animation, // Group name
msg->fAmpRate = params[3]; msg->fAmpRate = params[3];
msg->SetAnimName(params[1]); msg->SetAnimName(params[1]);
msg->SetBCastFlag(plMessage::kPropagateToModifiers); msg->SetBCastFlag(plMessage::kPropagateToModifiers);
SendAnimCmdMsg(params[0], msg); SendAnimCmdMsg(plString::FromUtf8(params[0]), msg);
} }
PF_CONSOLE_CMD( Animation, // Group name PF_CONSOLE_CMD( Animation, // Group name
@ -6657,7 +6653,7 @@ PF_CONSOLE_CMD( Animation, // Group name
msg->fSpeedChangeRate = params[3]; msg->fSpeedChangeRate = params[3];
msg->SetAnimName(params[1]); msg->SetAnimName(params[1]);
msg->SetBCastFlag(plMessage::kPropagateToModifiers); msg->SetBCastFlag(plMessage::kPropagateToModifiers);
SendAnimCmdMsg(params[0], msg); SendAnimCmdMsg(plString::FromUtf8(params[0]), msg);
} }
PF_CONSOLE_CMD( Animation, PF_CONSOLE_CMD( Animation,
@ -6667,7 +6663,7 @@ PF_CONSOLE_CMD( Animation,
{ {
plAnimDebugList *adl = plClient::GetInstance()->fAnimDebugList; plAnimDebugList *adl = plClient::GetInstance()->fAnimDebugList;
if (adl) if (adl)
adl->AddObjects(params[0]); adl->AddObjects(plString::FromUtf8(params[0]));
} }
PF_CONSOLE_CMD( Animation, PF_CONSOLE_CMD( Animation,
@ -6677,7 +6673,7 @@ PF_CONSOLE_CMD( Animation,
{ {
plAnimDebugList *adl = plClient::GetInstance()->fAnimDebugList; plAnimDebugList *adl = plClient::GetInstance()->fAnimDebugList;
if (adl) if (adl)
adl->RemoveObjects(params[0]); adl->RemoveObjects(plString::FromUtf8(params[0]));
} }
PF_CONSOLE_CMD( Animation, PF_CONSOLE_CMD( Animation,

8
Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp

@ -196,9 +196,9 @@ PF_CONSOLE_FILE_DUMMY(Net)
// utility functions // utility functions
// //
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
plKey FindSceneObjectByName(const char* name, const char* ageName, char* statusStr, bool subString=false); plKey FindSceneObjectByName(const plString& name, const char* ageName, char* statusStr, bool subString=false);
plKey FindObjectByName(const char* name, int type, const char* ageName, char* statusStr, bool subString=false); plKey FindObjectByName(const plString& name, int type, const char* ageName, char* statusStr, bool subString=false);
plKey FindObjectByNameAndType(const char* name, const char* typeName, const char* ageName, plKey FindObjectByNameAndType(const plString& name, const char* typeName, const char* ageName,
char* statusStr, bool subString=false); char* statusStr, bool subString=false);
void PrintStringF(void pfun(const char *),const char * fmt, ...); void PrintStringF(void pfun(const char *),const char * fmt, ...);
@ -508,7 +508,7 @@ PF_CONSOLE_CMD( Net, // groupName
"Instructs the server to only send me updates about this object periodically" ) // helpString "Instructs the server to only send me updates about this object periodically" ) // helpString
{ {
char str[256]; char str[256];
plKey key = FindSceneObjectByName(params[0], nil, str); plKey key = FindSceneObjectByName(plString::FromUtf8(params[0]), nil, str);
PrintString(str); PrintString(str);
if (!key) if (!key)
return; return;

5
Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp

@ -45,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnMessage/plMessage.h" #include "pnMessage/plMessage.h"
#include "pnKeyedObject/plKey.h" #include "pnKeyedObject/plKey.h"
#include "hsWindows.h" #include "hsWindows.h"
#include "plString.h"
static bool DumpSpecificMsgInfo(plMessage* msg, std::string& info); static bool DumpSpecificMsgInfo(plMessage* msg, std::string& info);
@ -137,9 +138,9 @@ void plDispatchLog::DumpMsg(plMessage* msg, int numReceivers, int sendTimeMs, In
fLog->AddLineF("%sDispatched (%d) %d ms: time=%d CName=%s, sndr=%s, rcvr(%d)=%s, flags=0x%lx, tstamp=%f\n", fLog->AddLineF("%sDispatched (%d) %d ms: time=%d CName=%s, sndr=%s, rcvr(%d)=%s, flags=0x%lx, tstamp=%f\n",
indentStr, numReceivers, sendTimeMs, indentStr, numReceivers, sendTimeMs,
int(sendTime), msg->ClassName(), msg->fSender?msg->fSender->GetName():"nil", int(sendTime), msg->ClassName(), msg->fSender?msg->fSender->GetName().c_str():"nil",
msg->GetNumReceivers(), msg->GetNumReceivers() && msg->GetReceiver(0) msg->GetNumReceivers(), msg->GetNumReceivers() && msg->GetReceiver(0)
? msg->GetReceiver(0)->GetName():"nil", ? msg->GetReceiver(0)->GetName().c_str():"nil",
msg->fBCastFlags, msg->fTimeStamp); msg->fBCastFlags, msg->fTimeStamp);
lastTime=curTime; lastTime=curTime;

4
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIControlMod.cpp

@ -587,11 +587,11 @@ hsBool pfGUIControlMod::MsgReceive( plMessage *msg )
if( rend ) if( rend )
{ {
plProfile_BeginLap(GUITime, this->GetKey()->GetUoid().GetObjectName()); plProfile_BeginLap(GUITime, this->GetKey()->GetUoid().GetObjectName().c_str());
// Only need it once // Only need it once
if( ISetUpDynTextMap( rend->Pipeline() ) ) if( ISetUpDynTextMap( rend->Pipeline() ) )
plgDispatch::Dispatch()->UnRegisterForExactType( plRenderMsg::Index(), GetKey() ); plgDispatch::Dispatch()->UnRegisterForExactType( plRenderMsg::Index(), GetKey() );
plProfile_EndLap(GUITime, this->GetKey()->GetUoid().GetObjectName()); plProfile_EndLap(GUITime, this->GetKey()->GetUoid().GetObjectName().c_str());
return true; return true;
} }

10
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.cpp

@ -122,22 +122,20 @@ pfGUICtrlGenerator &pfGUICtrlGenerator::Instance( void )
//// IGetNextKeyName ///////////////////////////////////////////////////////// //// IGetNextKeyName /////////////////////////////////////////////////////////
void pfGUICtrlGenerator::IGetNextKeyName( char *name, const char *prefix ) plString pfGUICtrlGenerator::IGetNextKeyName( const char *prefix )
{ {
static UInt32 keyCount = 0; static UInt32 keyCount = 0;
return plString::Format( "%s%d", prefix, keyCount++ );
sprintf( name, "%s%d", prefix, keyCount++ );
} }
//// IAddKey ///////////////////////////////////////////////////////////////// //// IAddKey /////////////////////////////////////////////////////////////////
plKey pfGUICtrlGenerator::IAddKey( hsKeyedObject *ko, const char *prefix ) plKey pfGUICtrlGenerator::IAddKey( hsKeyedObject *ko, const char *prefix )
{ {
char keyName[ 128 ]; plString keyName;
IGetNextKeyName( keyName, prefix ); keyName = IGetNextKeyName( prefix );
return hsgResMgr::ResMgr()->NewKey( keyName, ko, plLocation::kGlobalFixedLoc ); return hsgResMgr::ResMgr()->NewKey( keyName, ko, plLocation::kGlobalFixedLoc );
} }

2
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICtrlGenerator.h

@ -85,7 +85,7 @@ class pfGUICtrlGenerator
plKey IAddKey( hsKeyedObject *ko, const char *prefix ); plKey IAddKey( hsKeyedObject *ko, const char *prefix );
void IGetNextKeyName( char *name, const char *prefix ); plString IGetNextKeyName( const char *prefix );
hsGMaterial *ICreateSolidMaterial( hsColorRGBA &color ); hsGMaterial *ICreateSolidMaterial( hsColorRGBA &color );

3
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListElement.cpp

@ -221,8 +221,7 @@ pfGUIListPicture::pfGUIListPicture( plKey mipKey, hsBool respectAlpha ) : pfGUIL
{ {
// Gotta make and grab an uncompressed one // Gotta make and grab an uncompressed one
plMipmap *uncompBuffer = hsCodecManager::Instance().CreateUncompressedMipmap( mip, hsCodecManager::k32BitDepth ); plMipmap *uncompBuffer = hsCodecManager::Instance().CreateUncompressedMipmap( mip, hsCodecManager::k32BitDepth );
char str[ 512 ]; plString str = plString::Format( "%s_uncomp", mip->GetKeyName() );
sprintf( str, "%s_uncomp", mip->GetKeyName() );
fMipmapKey = hsgResMgr::ResMgr()->NewKey( str, uncompBuffer, fMipmapKey->GetUoid().GetLocation() ); fMipmapKey = hsgResMgr::ResMgr()->NewKey( str, uncompBuffer, fMipmapKey->GetUoid().GetLocation() );
fMipmapKey->RefObject(); fMipmapKey->RefObject();
} }

3
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIPopUpMenu.cpp

@ -97,8 +97,7 @@ class pfPopUpKeyGenerator
plKey CreateKey( hsKeyedObject *ko ) plKey CreateKey( hsKeyedObject *ko )
{ {
char name[ 256 ]; plString name = plString::Format( "%s-%d", fPrefix, fKeyCount++ );
sprintf( name, "%s-%d", fPrefix, fKeyCount++ );
return hsgResMgr::ResMgr()->NewKey( name, ko, fLoc ); return hsgResMgr::ResMgr()->NewKey( name, ko, fLoc );
} }

85
Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp

@ -446,7 +446,7 @@ public:
//// Book data class ///////////////////////////////////////////////////////// //// Book data class /////////////////////////////////////////////////////////
pfBookData::pfBookData(const char *guiName /* = nil */) pfBookData::pfBookData(const plString &guiName /* = nil */)
{ {
fCurrBook = nil; fCurrBook = nil;
fDialog = nil; fDialog = nil;
@ -470,10 +470,10 @@ pfBookData::pfBookData(const char *guiName /* = nil */)
fEditable = false; fEditable = false;
fAdjustCursorTo = -1; fAdjustCursorTo = -1;
if (guiName) if (!guiName.IsEmpty())
fGUIName = guiName; fGUIName = guiName;
else else
fGUIName = "BkBook"; fGUIName = _TEMP_CONVERT_FROM_LITERAL("BkBook");
} }
pfBookData::~pfBookData() pfBookData::~pfBookData()
@ -1137,18 +1137,18 @@ void pfBookData::EnableEditGUI(hsBool enable/* =true */)
//// Our Singleton Stuff ///////////////////////////////////////////////////// //// Our Singleton Stuff /////////////////////////////////////////////////////
//pfJournalBook *pfJournalBook::fInstance = nil; //pfJournalBook *pfJournalBook::fInstance = nil;
std::map<std::string,pfBookData*> pfJournalBook::fBookGUIs; std::map<plString,pfBookData*> pfJournalBook::fBookGUIs;
void pfJournalBook::SingletonInit( void ) void pfJournalBook::SingletonInit( void )
{ {
fBookGUIs["BkBook"] = TRACKED_NEW pfBookData(); // load the default book data object fBookGUIs[_TEMP_CONVERT_FROM_LITERAL("BkBook")] = TRACKED_NEW pfBookData(); // load the default book data object
hsgResMgr::ResMgr()->NewKey("BkBook",fBookGUIs["BkBook"],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(_TEMP_CONVERT_FROM_LITERAL("BkBook"),fBookGUIs[_TEMP_CONVERT_FROM_LITERAL("BkBook")],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation());
fBookGUIs["BkBook"]->LoadGUI(); fBookGUIs[_TEMP_CONVERT_FROM_LITERAL("BkBook")]->LoadGUI();
} }
void pfJournalBook::SingletonShutdown( void ) void pfJournalBook::SingletonShutdown( void )
{ {
std::map<std::string,pfBookData*>::iterator i = fBookGUIs.begin(); std::map<plString,pfBookData*>::iterator i = fBookGUIs.begin();
while (i != fBookGUIs.end()) while (i != fBookGUIs.end())
{ {
pfBookData *bookData = i->second; pfBookData *bookData = i->second;
@ -1159,7 +1159,7 @@ void pfJournalBook::SingletonShutdown( void )
fBookGUIs.clear(); fBookGUIs.clear();
} }
void pfJournalBook::LoadGUI( const char *guiName ) void pfJournalBook::LoadGUI( const plString &guiName )
{ {
if (fBookGUIs.find(guiName) == fBookGUIs.end()) // is it already loaded? if (fBookGUIs.find(guiName) == fBookGUIs.end()) // is it already loaded?
{ // nope, load it { // nope, load it
@ -1169,11 +1169,11 @@ void pfJournalBook::LoadGUI( const char *guiName )
} }
} }
void pfJournalBook::UnloadGUI( const char *guiName ) void pfJournalBook::UnloadGUI( const plString &guiName )
{ {
if (strcmp(guiName,"BkBook")==0) if (guiName.Compare("BkBook")==0)
return; // do not allow people to unload the default book gui return; // do not allow people to unload the default book gui
std::map<std::string,pfBookData*>::iterator loc = fBookGUIs.find(guiName); std::map<plString,pfBookData*>::iterator loc = fBookGUIs.find(guiName);
if (loc != fBookGUIs.end()) // make sure it's loaded if (loc != fBookGUIs.end()) // make sure it's loaded
{ {
fBookGUIs[guiName]->GetKey()->UnRefObject(); fBookGUIs[guiName]->GetKey()->UnRefObject();
@ -1184,17 +1184,17 @@ void pfJournalBook::UnloadGUI( const char *guiName )
void pfJournalBook::UnloadAllGUIs() void pfJournalBook::UnloadAllGUIs()
{ {
std::map<std::string,pfBookData*>::iterator i = fBookGUIs.begin(); std::map<plString,pfBookData*>::iterator i = fBookGUIs.begin();
std::vector<std::string> names; std::vector<plString> names;
while (i != fBookGUIs.end()) while (i != fBookGUIs.end())
{ {
std::string name = i->first; plString name = i->first;
names.push_back(name); // store a list of keys names.push_back(name); // store a list of keys
i++; i++;
} }
int idx; int idx;
for (idx = 0; idx < names.size(); idx++) for (idx = 0; idx < names.size(); idx++)
UnloadGUI(names[idx].c_str()); // UnloadGUI won't unload BkBook UnloadGUI(names[idx]); // UnloadGUI won't unload BkBook
} }
//// Constructor ///////////////////////////////////////////////////////////// //// Constructor /////////////////////////////////////////////////////////////
@ -1203,16 +1203,16 @@ void pfJournalBook::UnloadAllGUIs()
// key is the keyed object to send event messages to (see <img> tag). // key is the keyed object to send event messages to (see <img> tag).
pfJournalBook::pfJournalBook( const char *esHTMLSource, plKey coverImageKey, plKey callbackKey /*= nil*/, pfJournalBook::pfJournalBook( const char *esHTMLSource, plKey coverImageKey, plKey callbackKey /*= nil*/,
const plLocation &hintLoc /* = plLocation::kGlobalFixedLoc */, const char *guiName /* = nil */ ) const plLocation &hintLoc /* = plLocation::kGlobalFixedLoc */, const plString &guiName /* = nil */ )
{ {
if (guiName && (strcmp(guiName,"") != 0)) if (!guiName.IsEmpty())
fCurBookGUI = guiName; fCurBookGUI = guiName;
else else
fCurBookGUI = "BkBook"; fCurBookGUI = _TEMP_CONVERT_FROM_LITERAL("BkBook");
if (fBookGUIs.find(fCurBookGUI) == fBookGUIs.end()) if (fBookGUIs.find(fCurBookGUI) == fBookGUIs.end())
{ {
fBookGUIs[fCurBookGUI] = TRACKED_NEW pfBookData(fCurBookGUI.c_str()); fBookGUIs[fCurBookGUI] = TRACKED_NEW pfBookData(fCurBookGUI);
hsgResMgr::ResMgr()->NewKey(fCurBookGUI.c_str(),fBookGUIs[fCurBookGUI],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(fCurBookGUI,fBookGUIs[fCurBookGUI],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation());
fBookGUIs[fCurBookGUI]->LoadGUI(); fBookGUIs[fCurBookGUI]->LoadGUI();
} }
@ -1239,16 +1239,16 @@ pfJournalBook::pfJournalBook( const char *esHTMLSource, plKey coverImageKey, plK
} }
pfJournalBook::pfJournalBook( const wchar_t *esHTMLSource, plKey coverImageKey, plKey callbackKey /*= nil*/, pfJournalBook::pfJournalBook( const wchar_t *esHTMLSource, plKey coverImageKey, plKey callbackKey /*= nil*/,
const plLocation &hintLoc /* = plLocation::kGlobalFixedLoc */, const char *guiName /* = nil */ ) const plLocation &hintLoc /* = plLocation::kGlobalFixedLoc */, const plString &guiName /* = nil */ )
{ {
if (guiName && (strcmp(guiName,"") != 0)) if (!guiName.IsEmpty())
fCurBookGUI = guiName; fCurBookGUI = guiName;
else else
fCurBookGUI = "BkBook"; fCurBookGUI = _TEMP_CONVERT_FROM_LITERAL("BkBook");
if (fBookGUIs.find(fCurBookGUI) == fBookGUIs.end()) if (fBookGUIs.find(fCurBookGUI) == fBookGUIs.end())
{ {
fBookGUIs[fCurBookGUI] = TRACKED_NEW pfBookData(fCurBookGUI.c_str()); fBookGUIs[fCurBookGUI] = TRACKED_NEW pfBookData(fCurBookGUI);
hsgResMgr::ResMgr()->NewKey(fCurBookGUI.c_str(),fBookGUIs[fCurBookGUI],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(fCurBookGUI,fBookGUIs[fCurBookGUI],pfGameGUIMgr::GetInstance()->GetKey()->GetUoid().GetLocation());
fBookGUIs[fCurBookGUI]->LoadGUI(); fBookGUIs[fCurBookGUI]->LoadGUI();
} }
@ -1288,12 +1288,12 @@ hsBool pfJournalBook::MsgReceive( plMessage *pMsg )
return hsKeyedObject::MsgReceive( pMsg ); return hsKeyedObject::MsgReceive( pMsg );
} }
void pfJournalBook::SetGUI( const char *guiName ) void pfJournalBook::SetGUI( const plString &guiName )
{ {
if (guiName && (strcmp(guiName,"") != 0)) if (!guiName.IsEmpty())
fCurBookGUI = guiName; fCurBookGUI = guiName;
if (fBookGUIs.find(fCurBookGUI) == fBookGUIs.end()) if (fBookGUIs.find(fCurBookGUI) == fBookGUIs.end())
fCurBookGUI = "BkBook"; // requested GUI isn't loaded, so use default GUI fCurBookGUI = _TEMP_CONVERT_FROM_LITERAL("BkBook"); // requested GUI isn't loaded, so use default GUI
SetEditable(fWantEditing); // make sure that if we want editing, to set it SetEditable(fWantEditing); // make sure that if we want editing, to set it
ICompileSource(fUncompiledSource.c_str(), fDefLoc); // recompile the source to be safe ICompileSource(fUncompiledSource.c_str(), fDefLoc); // recompile the source to be safe
} }
@ -2501,20 +2501,19 @@ void pfJournalBook::IFreeSource( void )
plKey pfJournalBook::IGetMipmapKey( const wchar_t *name, const plLocation &loc ) plKey pfJournalBook::IGetMipmapKey( const wchar_t *name, const plLocation &loc )
{ {
char *cName = hsWStringToString(name); plString cName = plString::FromWchar(name);
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
if( strchr( cName, '/' ) != nil || strchr( cName, '\\' ) != nil ) if( cName.Find( '/' ) >= 0 || cName.Find( '\\' ) >= 0 )
{ {
// For internal use only--allow local path names of PNG and JPEG images, to // For internal use only--allow local path names of PNG and JPEG images, to
// facilitate fast prototyping // facilitate fast prototyping
plMipmap *mip; plMipmap *mip;
if( strstr( cName, ".png" ) != nil ) if( cName.Find( ".png" ) >= 0 )
mip = plPNG::Instance().ReadFromFile( cName ); mip = plPNG::Instance().ReadFromFile( _TEMP_CONVERT_TO_CONST_CHAR( cName ) );
else else
mip = plJPEG::Instance().ReadFromFile( cName ); mip = plJPEG::Instance().ReadFromFile( _TEMP_CONVERT_TO_CONST_CHAR( cName ) );
hsgResMgr::ResMgr()->NewKey( cName, mip, loc ); hsgResMgr::ResMgr()->NewKey( cName, mip, loc );
delete [] cName;
return mip->GetKey(); return mip->GetKey();
} }
#endif #endif
@ -2524,7 +2523,6 @@ plKey pfJournalBook::IGetMipmapKey( const wchar_t *name, const plLocation &loc
plKey key = hsgResMgr::ResMgr()->FindKey( myUoid ); plKey key = hsgResMgr::ResMgr()->FindKey( myUoid );
if( key != nil ) if( key != nil )
{ {
delete [] cName;
return key; return key;
} }
@ -2535,7 +2533,6 @@ plKey pfJournalBook::IGetMipmapKey( const wchar_t *name, const plLocation &loc
key = hsgResMgr::ResMgr()->FindKey( myUoid ); key = hsgResMgr::ResMgr()->FindKey( myUoid );
if( key != nil ) if( key != nil )
{ {
delete [] cName;
return key; return key;
} }
@ -2548,13 +2545,11 @@ plKey pfJournalBook::IGetMipmapKey( const wchar_t *name, const plLocation &loc
key = plKeyFinder::Instance().StupidSearch( thisAge, nil, plMipmap::Index(), cName, true ); key = plKeyFinder::Instance().StupidSearch( thisAge, nil, plMipmap::Index(), cName, true );
if( key != nil ) if( key != nil )
{ {
delete [] cName;
return key; return key;
} }
} }
} }
delete [] cName;
return nil; return nil;
} }
@ -3043,13 +3038,13 @@ plLayerBink *pfJournalBook::IMakeMovieLayer(pfEsHTMLChunk *chunk, UInt16 x, UInt
// We'll need a unique name. This is a hack, but an effective hack. // We'll need a unique name. This is a hack, but an effective hack.
static int uniqueSuffix = 0; static int uniqueSuffix = 0;
char buff[256]; plString buff;
sprintf(buff, "%s_%d_ml", GetKey()->GetName(), uniqueSuffix); buff = plString::Format("%s_%d_ml", GetKey()->GetName().c_str(), uniqueSuffix);
layer = TRACKED_NEW plLayer; layer = TRACKED_NEW plLayer;
hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation());
sprintf(buff, "%s_%d_m", GetKey()->GetName(), uniqueSuffix++); buff = plString::Format("%s_%d_m", GetKey()->GetName().c_str(), uniqueSuffix++);
movieLayer = TRACKED_NEW plLayerBink; movieLayer = TRACKED_NEW plLayerBink;
hsgResMgr::ResMgr()->NewKey(buff, movieLayer, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, movieLayer, GetKey()->GetUoid().GetLocation());
movieLayer->GetKey()->RefObject(); // we want to own a ref so we can nuke it at will movieLayer->GetKey()->RefObject(); // we want to own a ref so we can nuke it at will
@ -3192,8 +3187,7 @@ plLayerInterface *pfJournalBook::IMakeBaseLayer(plMipmap *image)
// We'll need a unique name. This is a hack, but an effective hack. // We'll need a unique name. This is a hack, but an effective hack.
static int uniqueSuffix = 0; static int uniqueSuffix = 0;
char buff[256]; plString buff = plString::Format("%s_%d", GetKey()->GetName().c_str(), uniqueSuffix++);
sprintf(buff, "%s_%d", GetKey()->GetName(), uniqueSuffix++);
plLayer* layer = TRACKED_NEW plLayer; plLayer* layer = TRACKED_NEW plLayer;
hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation());
@ -3247,8 +3241,7 @@ plLayerInterface *pfJournalBook::IMakeDecalLayer(pfEsHTMLChunk *decalChunk, plMi
// We'll need a unique name. This is a hack, but an effective hack. // We'll need a unique name. This is a hack, but an effective hack.
static int uniqueSuffix = 0; static int uniqueSuffix = 0;
char buff[256]; plString buff = plString::Format("%s_%d_d", GetKey()->GetName().c_str(), uniqueSuffix++);
sprintf(buff, "%s_%d_d", GetKey()->GetName(), uniqueSuffix++);
plLayer* layer = TRACKED_NEW plLayer; plLayer* layer = TRACKED_NEW plLayer;
hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation());

18
Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.h

@ -211,7 +211,7 @@ public:
kTurnBackPage kTurnBackPage
}; };
pfBookData(const char *guiName = nil); pfBookData(const plString &guiName = plString::Null);
virtual ~pfBookData(); virtual ~pfBookData();
void LoadGUI(); // need this seperate because the plKey isn't setup until the constructor is done void LoadGUI(); // need this seperate because the plKey isn't setup until the constructor is done
@ -284,7 +284,7 @@ protected:
kRefDefaultCover kRefDefaultCover
}; };
std::string fGUIName; plString fGUIName;
// The pointer to our dialog // The pointer to our dialog
pfGUIDialogMod *fDialog; pfGUIDialogMod *fDialog;
@ -362,8 +362,8 @@ class pfJournalBook : public hsKeyedObject
// The constructor takes in the esHTML source for the journal, along with // The constructor takes in the esHTML source for the journal, along with
// the name of the mipmap to use as the cover of the book. The callback // the name of the mipmap to use as the cover of the book. The callback
// key is the keyed object to send event messages to (see <img> tag). // key is the keyed object to send event messages to (see <img> tag).
pfJournalBook( const char *esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, const plLocation &hintLoc = plLocation::kGlobalFixedLoc, const char *guiName = nil ); pfJournalBook( const char *esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, const plLocation &hintLoc = plLocation::kGlobalFixedLoc, const plString &guiName = plString::Null );
pfJournalBook( const wchar_t *esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, const plLocation &hintLoc = plLocation::kGlobalFixedLoc, const char *guiName = nil ); pfJournalBook( const wchar_t *esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, const plLocation &hintLoc = plLocation::kGlobalFixedLoc, const plString &guiName = plString::Null );
virtual ~pfJournalBook(); virtual ~pfJournalBook();
@ -380,15 +380,15 @@ class pfJournalBook : public hsKeyedObject
static void SingletonShutdown( void ); static void SingletonShutdown( void );
// loads a gui // loads a gui
static void LoadGUI( const char *guiName ); static void LoadGUI( const plString &guiName );
// unloads a gui if we don't need it any more and want to free up memory // unloads a gui if we don't need it any more and want to free up memory
static void UnloadGUI( const char *guiName ); static void UnloadGUI( const plString &guiName );
// unloads all GUIs except for the default // unloads all GUIs except for the default
static void UnloadAllGUIs(); static void UnloadAllGUIs();
void SetGUI( const char *guiName ); void SetGUI( const plString &guiName );
// Shows the book, optionally starting open or closed // Shows the book, optionally starting open or closed
void Show( hsBool startOpened = false ); void Show( hsBool startOpened = false );
@ -505,8 +505,8 @@ class pfJournalBook : public hsKeyedObject
// Current list of linkable image chunks we have visible on the screen, for quick hit testing // Current list of linkable image chunks we have visible on the screen, for quick hit testing
hsTArray<pfEsHTMLChunk *> fVisibleLinks; hsTArray<pfEsHTMLChunk *> fVisibleLinks;
static std::map<std::string,pfBookData*> fBookGUIs; static std::map<plString,pfBookData*> fBookGUIs;
std::string fCurBookGUI; plString fCurBookGUI;
enum Refs enum Refs
{ {

59
Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp

@ -194,12 +194,12 @@ void cyMisc::ConsoleNet(const char* command, hsBool netForce)
// PURPOSE : Execute a console command from a python script, // PURPOSE : Execute a console command from a python script,
// optionally propagate over the net // optionally propagate over the net
// //
PyObject* cyMisc::FindSceneObject(const char* name, const char* ageName) PyObject* cyMisc::FindSceneObject(const plString& name, const char* ageName)
{ {
// assume that we won't find the sceneobject (key is equal to nil) // assume that we won't find the sceneobject (key is equal to nil)
plKey key=nil; plKey key=nil;
if ( name || name[0] != 0) if ( !name.IsEmpty() )
{ {
const char* theAge = ageName; const char* theAge = ageName;
if ( ageName[0] == 0 ) if ( ageName[0] == 0 )
@ -209,18 +209,17 @@ PyObject* cyMisc::FindSceneObject(const char* name, const char* ageName)
if ( key == nil ) if ( key == nil )
{ {
char errmsg[256]; plString errmsg = plString::Format("Sceneobject %s not found",name.c_str());
sprintf(errmsg,"Sceneobject %s not found",name); PyErr_SetString(PyExc_NameError, errmsg.c_str());
PyErr_SetString(PyExc_NameError, errmsg);
return nil; // return nil cause we errored return nil; // return nil cause we errored
} }
return pySceneObject::New(key); return pySceneObject::New(key);
} }
PyObject* cyMisc::FindActivator(const char* name) PyObject* cyMisc::FindActivator(const plString& name)
{ {
plKey key = nil; plKey key = nil;
if (name && strlen(name) > 0) if (!name.IsEmpty())
{ {
std::vector<plKey> keylist; std::vector<plKey> keylist;
plKeyFinder::Instance().ReallyStupidActivatorSearch(name, keylist); plKeyFinder::Instance().ReallyStupidActivatorSearch(name, keylist);
@ -453,9 +452,9 @@ hsBool cyMisc::WasLocallyNotified(pyKey &selfkey)
// PURPOSE : Return the net client (account) name of the player whose avatar // PURPOSE : Return the net client (account) name of the player whose avatar
// key is provided. // key is provided.
// //
const char* cyMisc::GetClientName(pyKey &avKey) plString cyMisc::GetClientName(pyKey &avKey)
{ {
return plNetClientMgr::GetInstance()->GetPlayerName(avKey.getKey()).s_str(); return plNetClientMgr::GetInstance()->GetPlayerName(avKey.getKey());
} }
PyObject* cyMisc::GetAvatarKeyFromClientID(int clientID) PyObject* cyMisc::GetAvatarKeyFromClientID(int clientID)
@ -546,9 +545,9 @@ hsBool cyMisc::ValidateKey(pyKey& key)
// //
// PURPOSE : Return the local net client (account) name // PURPOSE : Return the local net client (account) name
// //
const char* cyMisc::GetLocalClientName() plString cyMisc::GetLocalClientName()
{ {
return plNetClientMgr::GetInstance()->GetPlayerName().c_str(); return plNetClientMgr::GetInstance()->GetPlayerName();
} }
@ -1910,7 +1909,7 @@ int cyMisc::GetNumParticles(pyKey& host)
} }
void cyMisc::SetLightColorValue(pyKey& light, std::string lightName, hsScalar r, hsScalar g, hsScalar b, hsScalar a) void cyMisc::SetLightColorValue(pyKey& light, const plString& lightName, hsScalar r, hsScalar g, hsScalar b, hsScalar a)
{ {
// lightName is the name of the light object attached to the light that we want to talk to // lightName is the name of the light object attached to the light that we want to talk to
// for the bug lights, this would be "RTOmni-BugLightTest" // for the bug lights, this would be "RTOmni-BugLightTest"
@ -1958,7 +1957,7 @@ void cyMisc::SetLightColorValue(pyKey& light, std::string lightName, hsScalar r,
} }
#include "pnMessage/plEnableMsg.h" #include "pnMessage/plEnableMsg.h"
void cyMisc::SetLightAnimationOn(pyKey& light, std::string lightName, hsBool start) void cyMisc::SetLightAnimationOn(pyKey& light, const plString& lightName, hsBool start)
{ {
// lightName is the name of the light object attached to the light that we want to talk to // lightName is the name of the light object attached to the light that we want to talk to
// for the bug lights, this would be "RTOmni-BugLightTest" // for the bug lights, this would be "RTOmni-BugLightTest"
@ -2449,28 +2448,26 @@ const char* cyMisc::GetCameraNumber(int number)
plCameraModifier1* pCam = plVirtualCam1::Instance()->GetCameraNumber(number-1); plCameraModifier1* pCam = plVirtualCam1::Instance()->GetCameraNumber(number-1);
if (pCam->GetTarget()) if (pCam->GetTarget())
{ {
const char* ret = pCam->GetTarget()->GetKeyName(); const char* ret = pCam->GetTarget()->GetKeyName().c_str();
(ret==nil) ? "empty" : ret; (ret==nil) ? "empty" : ret;
char str[256]; plString str = plString::Format("saving camera named %s to chronicle\n",ret);
sprintf(str, "saving camera named %s to chronicle\n",ret); plVirtualCam1::Instance()->AddMsgToLog(str.c_str());
plVirtualCam1::Instance()->AddMsgToLog(str);
return ret; return ret;
} }
plVirtualCam1::Instance()->AddMsgToLog("sending empty to camera chronicle\n"); plVirtualCam1::Instance()->AddMsgToLog("sending empty to camera chronicle\n");
return "empty"; return "empty";
} }
void cyMisc::RebuildCameraStack(const char* name, const char* ageName) void cyMisc::RebuildCameraStack(const plString& name, const char* ageName)
{ {
plKey key=nil; plKey key=nil;
char str[256]; plString str = plString::Format("attempting to restore camera named %s from chronicle\n",name.c_str());
sprintf(str, "attempting to restore camera named %s from chronicle\n",name); plVirtualCam1::Instance()->AddMsgToLog(str.c_str());
plVirtualCam1::Instance()->AddMsgToLog(str);
if (name.Compare("empty") == 0)
if (strcmp(name, "empty") == 0)
return; return;
if ( name || name[0] != 0) if ( !name.IsEmpty() )
{ {
key=plKeyFinder::Instance().StupidSearch(nil,nil,plSceneObject::Index(), name, false); key=plKeyFinder::Instance().StupidSearch(nil,nil,plSceneObject::Index(), name, false);
} }
@ -2481,9 +2478,8 @@ void cyMisc::RebuildCameraStack(const char* name, const char* ageName)
{ {
// give up and force built in 3rd person // give up and force built in 3rd person
plVirtualCam1::Instance()->PushThirdPerson(); plVirtualCam1::Instance()->PushThirdPerson();
char errmsg[256]; plString errmsg = plString::Format("Sceneobject %s not found",name.c_str());
sprintf(errmsg,"Sceneobject %s not found",name); PyErr_SetString(PyExc_NameError, errmsg.c_str());
PyErr_SetString(PyExc_NameError, errmsg);
} }
} }
else else
@ -2506,9 +2502,8 @@ void cyMisc::RebuildCameraStack(const char* name, const char* ageName)
} }
} }
plVirtualCam1::Instance()->PushThirdPerson(); plVirtualCam1::Instance()->PushThirdPerson();
char errmsg[256]; plString errmsg = plString::Format("Sceneobject %s has no camera modifier",name.c_str());
sprintf(errmsg,"Sceneobject %s has no camera modifier",name); PyErr_SetString(PyExc_NameError, errmsg.c_str());
PyErr_SetString(PyExc_NameError, errmsg);
} }
} }
@ -2670,10 +2665,10 @@ void cyMisc::FakeLinkToObject(pyKey& avatar, pyKey& object)
plgDispatch::MsgSend(msg); plgDispatch::MsgSend(msg);
} }
void cyMisc::FakeLinkToObjectNamed(const char* name) void cyMisc::FakeLinkToObjectNamed(const plString& name)
{ {
plKey key = nil; plKey key = nil;
if ( name || name[0] != 0) if ( !name.IsEmpty() )
{ {
key = plKeyFinder::Instance().StupidSearch(nil,nil,plSceneObject::Index(), name, false); key = plKeyFinder::Instance().StupidSearch(nil,nil,plSceneObject::Index(), name, false);
} }

18
Sources/Plasma/FeatureLib/pfPython/cyMisc.h

@ -142,8 +142,8 @@ public:
// PURPOSE : Execute a console command from a python script, // PURPOSE : Execute a console command from a python script,
// optionally propagate over the net // optionally propagate over the net
// //
static PyObject* FindSceneObject(const char* name, const char* ageName); // returns pySceneObject static PyObject* FindSceneObject(const plString& name, const char* ageName); // returns pySceneObject
static PyObject* FindActivator(const char* name); // returns pyKey static PyObject* FindActivator(const plString& name); // returns pyKey
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@ -252,7 +252,7 @@ public:
// PURPOSE : Return the net client (account) name of the player whose avatar // PURPOSE : Return the net client (account) name of the player whose avatar
// key is provided. // key is provided.
// //
static const char* GetClientName(pyKey &avKey); static plString GetClientName(pyKey &avKey);
static PyObject* GetAvatarKeyFromClientID(int clientID); // returns pyKey static PyObject* GetAvatarKeyFromClientID(int clientID); // returns pyKey
static int GetLocalClientID(); static int GetLocalClientID();
@ -268,7 +268,7 @@ public:
// //
// PURPOSE : Return the local net client (account) name // PURPOSE : Return the local net client (account) name
// //
static const char* GetLocalClientName(); static plString GetLocalClientName();
// //
@ -697,8 +697,8 @@ public:
static void SetParticleOffset(float x, float y, float z, pyKey& particles); static void SetParticleOffset(float x, float y, float z, pyKey& particles);
static void KillParticles(float time, float pct, pyKey& particles); static void KillParticles(float time, float pct, pyKey& particles);
static int GetNumParticles(pyKey& host); static int GetNumParticles(pyKey& host);
static void SetLightColorValue(pyKey& light, std::string lightName, hsScalar r, hsScalar g, hsScalar b, hsScalar a); static void SetLightColorValue(pyKey& light, const plString& lightName, hsScalar r, hsScalar g, hsScalar b, hsScalar a);
static void SetLightAnimationOn(pyKey& light, std::string lightName, hsBool start); static void SetLightAnimationOn(pyKey& light, const plString& lightName, hsBool start);
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// Function : RegisterForControlEventMessages // Function : RegisterForControlEventMessages
@ -799,7 +799,7 @@ public:
static int GetNumCameras(); static int GetNumCameras();
static const char* GetCameraNumber(int number); static const char* GetCameraNumber(int number);
static void RebuildCameraStack(const char* name, const char* ageName); static void RebuildCameraStack(const plString& name, const char* ageName);
static void PyClearCameraStack(); static void PyClearCameraStack();
static void RecenterCamera(); static void RecenterCamera();
static bool IsFirstPerson(); static bool IsFirstPerson();
@ -877,8 +877,8 @@ public:
// PURPOSE : takes an avatar key and an object key and fake-links the avatar // PURPOSE : takes an avatar key and an object key and fake-links the avatar
// to that object's position. appears to be a link to other players // to that object's position. appears to be a link to other players
// //
static void FakeLinkToObject(pyKey& avatar, pyKey& object); static void FakeLinkToObject(pyKey& avatar, pyKey& object);
static void FakeLinkToObjectNamed(const char* name); static void FakeLinkToObjectNamed(const plString& name);
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //

4
Sources/Plasma/FeatureLib/pfPython/cyMiscGlue.cpp

@ -112,10 +112,10 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtGetClientName, args, "Params: avatarKey=None\n
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
pyKey* key = pyKey::ConvertFrom(keyObj); pyKey* key = pyKey::ConvertFrom(keyObj);
return PyString_FromString(cyMisc::GetClientName(*key)); return PyString_FromString(cyMisc::GetClientName(*key).s_str());
} }
else else
return PyString_FromString(cyMisc::GetLocalClientName()); return PyString_FromString(cyMisc::GetLocalClientName().c_str());
} }
PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetLocalAvatar, "This will return a ptSceneobject of the local avatar\n" PYTHON_GLOBAL_METHOD_DEFINITION_NOARGS(PtGetLocalAvatar, "This will return a ptSceneobject of the local avatar\n"

4
Sources/Plasma/FeatureLib/pfPython/cyMiscGlue3.cpp

@ -183,7 +183,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtFindSceneobject, args, "Params: name,ageName\n
PyErr_SetString(PyExc_TypeError, "PtFindSceneobject expects two strings"); PyErr_SetString(PyExc_TypeError, "PtFindSceneobject expects two strings");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
return cyMisc::FindSceneObject(name, ageName); return cyMisc::FindSceneObject(plString::FromUtf8(name), ageName);
} }
PYTHON_GLOBAL_METHOD_DEFINITION(PtFindActivator, args, "Params: name\nThis will try to find an activator based on its name\n" PYTHON_GLOBAL_METHOD_DEFINITION(PtFindActivator, args, "Params: name\nThis will try to find an activator based on its name\n"
@ -197,7 +197,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtFindActivator, args, "Params: name\nThis will
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
return cyMisc::FindActivator(name); return cyMisc::FindActivator(plString::FromUtf8(name));
} }
PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(PtClearCameraStack, cyMisc::ClearCameraStack, "Clears the camera stack") PYTHON_BASIC_GLOBAL_METHOD_DEFINITION(PtClearCameraStack, cyMisc::ClearCameraStack, "Clears the camera stack")

34
Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp

@ -141,23 +141,17 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtSetLightValue, args, "Params: key,name,r,g,b,a
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
pyKey* key = pyKey::ConvertFrom(keyObj); pyKey* key = pyKey::ConvertFrom(keyObj);
std::string name = ""; plString name;
if (PyUnicode_Check(nameObj)) if (PyUnicode_Check(nameObj))
{ {
int strLen = PyUnicode_GetSize(nameObj); PyObject* utf8 = PyUnicode_AsUTF8String(nameObj);
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; name = plString::FromUtf8(PyString_AsString(utf8));
PyUnicode_AsWideChar((PyUnicodeObject*)nameObj, text, strLen); Py_DECREF(utf8);
text[strLen] = L'\0';
char* cText = hsWStringToString(text);
name = cText;
delete [] cText;
delete [] text;
} }
else if (PyString_Check(nameObj)) else if (PyString_Check(nameObj))
{ {
// we'll allow this, just in case something goes weird // we'll allow this, just in case something goes weird
char* text = PyString_AsString(nameObj); name = plString::FromUtf8(PyString_AsString(nameObj));
name = text;
} }
else else
{ {
@ -184,23 +178,17 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtSetLightAnimStart, args, "Params: key,name,sta
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
pyKey* key = pyKey::ConvertFrom(keyObj); pyKey* key = pyKey::ConvertFrom(keyObj);
std::string name = ""; plString name;
if (PyUnicode_Check(nameObj)) if (PyUnicode_Check(nameObj))
{ {
int strLen = PyUnicode_GetSize(nameObj); PyObject* utf8 = PyUnicode_AsUTF8String(nameObj);
wchar_t* text = TRACKED_NEW wchar_t[strLen + 1]; name = plString::FromUtf8(PyString_AsString(utf8));
PyUnicode_AsWideChar((PyUnicodeObject*)nameObj, text, strLen); Py_DECREF(utf8);
text[strLen] = L'\0';
char* cText = hsWStringToString(text);
name = cText;
delete [] cText;
delete [] text;
} }
else if (PyString_Check(nameObj)) else if (PyString_Check(nameObj))
{ {
// we'll allow this, just in case something goes weird // we'll allow this, just in case something goes weird
char* text = PyString_AsString(nameObj); name = plString::FromUtf8(PyString_AsString(nameObj));
name = text;
} }
else else
{ {
@ -363,7 +351,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtRebuildCameraStack, args, "Params: name,ageNam
PyErr_SetString(PyExc_TypeError, "PtRebuildCameraStack expects two strings"); PyErr_SetString(PyExc_TypeError, "PtRebuildCameraStack expects two strings");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
cyMisc::RebuildCameraStack(name, ageName); cyMisc::RebuildCameraStack(plString::FromUtf8(name), ageName);
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
} }

65
Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp

@ -331,7 +331,6 @@ hsBool plPythonFileMod::fAtConvertTime = false;
plPythonFileMod::plPythonFileMod() plPythonFileMod::plPythonFileMod()
{ {
fPythonFile = nil; fPythonFile = nil;
fModuleName = nil;
fModule = nil; fModule = nil;
fLocalNotify= true; fLocalNotify= true;
fIsFirstTimeEval = true; fIsFirstTimeEval = true;
@ -404,15 +403,15 @@ plPythonFileMod::~plPythonFileMod()
} }
// then get rid of this module // then get rid of this module
// NOTE: fModule shouldn't be made in the plugin, only at runtime // NOTE: fModule shouldn't be made in the plugin, only at runtime
if ( fModuleName && fModule ) if ( !fModuleName.IsNull() && fModule )
{ {
//_PyModule_Clear(fModule); //_PyModule_Clear(fModule);
PyObject *m; PyObject *m;
PyObject *modules = PyImport_GetModuleDict(); PyObject *modules = PyImport_GetModuleDict();
if( modules && (m = PyDict_GetItemString(modules, fModuleName)) && PyModule_Check(m)) if( modules && (m = PyDict_GetItemString(modules, fModuleName.c_str())) && PyModule_Check(m))
{ {
hsStatusMessageF("Module %s removed from python dictionary",fModuleName); hsStatusMessageF("Module %s removed from python dictionary",fModuleName);
PyDict_DelItemString(modules, fModuleName); PyDict_DelItemString(modules, fModuleName.c_str());
} }
else else
{ {
@ -422,8 +421,7 @@ plPythonFileMod::~plPythonFileMod()
// we need to set our pointer to nil to make sure we don't try to use it // we need to set our pointer to nil to make sure we don't try to use it
fModule = nil; fModule = nil;
} }
delete [] fModuleName; fModuleName = plString::Null;
fModuleName = nil;
} }
#include "plPythonPack.h" #include "plPythonPack.h"
@ -510,11 +508,8 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj)
{ {
plKey pkey = sobj->GetKey(); plKey pkey = sobj->GetKey();
// nope, must be the first object. Then use it as the basis for the module // nope, must be the first object. Then use it as the basis for the module
char modulename[256]; fModuleName = IMakeModuleName(sobj);
IMakeModuleName(modulename,sobj); fModule = PythonInterface::CreateModule(fModuleName.c_str());
delete [] fModuleName;
fModuleName = StrDup(modulename);
fModule = PythonInterface::CreateModule(modulename);
// if we can't create the instance then there is nothing to do here // if we can't create the instance then there is nothing to do here
if (!ILoadPythonCode()) if (!ILoadPythonCode())
@ -634,17 +629,16 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj)
NamedComponent comp; NamedComponent comp;
comp.isActivator = (isNamedAttr == 1); comp.isActivator = (isNamedAttr == 1);
comp.id = parameter.fID; comp.id = parameter.fID;
comp.name = TRACKED_NEW char[strlen(parameter.datarecord.fString) + 1]; comp.name = plString::FromUtf8(parameter.datarecord.fString);
strcpy(comp.name, parameter.datarecord.fString);
fNamedCompQueue.Append(comp); fNamedCompQueue.Append(comp);
} }
else else
{ {
if (isNamedAttr == 1) if (isNamedAttr == 1)
IFindActivatorAndAdd(parameter.datarecord.fString, parameter.fID); IFindActivatorAndAdd(plString::FromUtf8(parameter.datarecord.fString), parameter.fID);
else else
IFindResponderAndAdd(parameter.datarecord.fString, parameter.fID); IFindResponderAndAdd(plString::FromUtf8(parameter.datarecord.fString), parameter.fID);
} }
} }
} }
@ -951,7 +945,7 @@ void plPythonFileMod::HandleDiscardedKey( plKeyEventMsg *msg )
// //
// NOTE: This modifier wasn't intended to have multiple targets // NOTE: This modifier wasn't intended to have multiple targets
// //
void plPythonFileMod::IMakeModuleName(char* modulename,plSceneObject* sobj) plString plPythonFileMod::IMakeModuleName(plSceneObject* sobj)
{ {
// Forgive my general crapulance... // Forgive my general crapulance...
// This strips underscores out of module names // This strips underscores out of module names
@ -960,13 +954,14 @@ void plPythonFileMod::IMakeModuleName(char* modulename,plSceneObject* sobj)
plKey pKey = GetKey(); plKey pKey = GetKey();
plKey sKey = sobj->GetKey(); plKey sKey = sobj->GetKey();
const char* pKeyName = pKey->GetName(); const char* pKeyName = pKey->GetName().c_str();
const char* pSobjName = sKey->GetName(); const char* pSobjName = sKey->GetName().c_str();
UInt16 len = hsStrlen(pKeyName); UInt16 len = pKey->GetName().GetSize();
UInt16 slen = hsStrlen(pSobjName); UInt16 slen = sKey->GetName().GetSize();
hsAssert(len+slen < 256, "Warning: String length exceeds 256 characters."); hsAssert(len+slen < 256, "Warning: String length exceeds 256 characters.");
char modulename[256];
int i, k = 0; int i, k = 0;
for(i = 0; i < slen; i++) for(i = 0; i < slen; i++)
@ -983,6 +978,7 @@ void plPythonFileMod::IMakeModuleName(char* modulename,plSceneObject* sobj)
} }
modulename[k] = '\0'; modulename[k] = '\0';
plString name = plString::FromUtf8(modulename);
// check to see if we are attaching to a clone? // check to see if we are attaching to a clone?
plKeyImp* pKeyImp = (plKeyImp*)(sKey); plKeyImp* pKeyImp = (plKeyImp*)(sKey);
@ -992,7 +988,7 @@ void plPythonFileMod::IMakeModuleName(char* modulename,plSceneObject* sobj)
// add the cloneID to the end of the module name // add the cloneID to the end of the module name
// and set the fIAmAClone flag // and set the fIAmAClone flag
UInt32 cloneID = pKeyImp->GetUoid().GetCloneID(); UInt32 cloneID = pKeyImp->GetUoid().GetCloneID();
sprintf(modulename,"%s%d",modulename,cloneID); name += plString::Format("%d", cloneID);
fAmIAttachedToClone = true; fAmIAttachedToClone = true;
} }
@ -1001,8 +997,10 @@ void plPythonFileMod::IMakeModuleName(char* modulename,plSceneObject* sobj)
{ {
// if not unique then add the sequence number to the end of the modulename // if not unique then add the sequence number to the end of the modulename
UInt32 seqID = pKeyImp->GetUoid().GetLocation().GetSequenceNumber(); UInt32 seqID = pKeyImp->GetUoid().GetLocation().GetSequenceNumber();
sprintf(modulename,"%s%d",modulename,seqID); name += plString::Format("%d", seqID);
} }
return name;
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -1047,9 +1045,9 @@ void plPythonFileMod::ISetKeyValue(const plKey& key, Int32 id)
// PURPOSE : find a responder by name in all age and page locations // PURPOSE : find a responder by name in all age and page locations
// : and add to the Parameter list // : and add to the Parameter list
// //
void plPythonFileMod::IFindResponderAndAdd(const char *responderName, Int32 id) void plPythonFileMod::IFindResponderAndAdd(const plString &responderName, Int32 id)
{ {
if ( responderName != nil ) if ( !responderName.IsNull() )
{ {
std::vector<plKey> keylist; std::vector<plKey> keylist;
const plLocation &loc = GetKey()->GetUoid().GetLocation(); const plLocation &loc = GetKey()->GetUoid().GetLocation();
@ -1075,9 +1073,9 @@ void plPythonFileMod::IFindResponderAndAdd(const char *responderName, Int32 id)
// PURPOSE : find a responder by name in all age and page locations // PURPOSE : find a responder by name in all age and page locations
// : and add to the Parameter list // : and add to the Parameter list
// //
void plPythonFileMod::IFindActivatorAndAdd(const char *activatorName, Int32 id) void plPythonFileMod::IFindActivatorAndAdd(const plString &activatorName, Int32 id)
{ {
if ( activatorName != nil ) if ( !activatorName.IsNull() )
{ {
std::vector<plKey> keylist; std::vector<plKey> keylist;
const plLocation &loc = GetKey()->GetUoid().GetLocation(); const plLocation &loc = GetKey()->GetUoid().GetLocation();
@ -1236,8 +1234,6 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
IFindActivatorAndAdd(comp.name, comp.id); IFindActivatorAndAdd(comp.name, comp.id);
else else
IFindResponderAndAdd(comp.name, comp.id); IFindResponderAndAdd(comp.name, comp.id);
delete [] comp.name;
} }
fNamedCompQueue.Reset(); fNamedCompQueue.Reset();
@ -1756,9 +1752,9 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
{ {
// yes... // yes...
// call it // call it
char* roomname = ""; const char* roomname = "";
if ( pRLNMsg->GetRoom() != nil ) if ( pRLNMsg->GetRoom() != nil )
roomname = (char*)pRLNMsg->GetRoom()->GetName(); roomname = pRLNMsg->GetRoom()->GetName().c_str();
plProfile_BeginTiming(PythonUpdate); plProfile_BeginTiming(PythonUpdate);
PyObject* retVal = PyObject_CallMethod( PyObject* retVal = PyObject_CallMethod(
@ -2837,11 +2833,10 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
// //
void plPythonFileMod::ReportError() void plPythonFileMod::ReportError()
{ {
char objectName[128]; plString objectName = this->GetKeyName();
StrCopy(objectName, this->GetKeyName(), arrsize(objectName)); objectName += _TEMP_CONVERT_FROM_LITERAL(" - ");
StrPack(objectName, " - ", arrsize(objectName));
PythonInterface::WriteToStdErr(objectName); PythonInterface::WriteToStdErr(objectName.c_str());
PyErr_Print(); // make sure the error is printed PyErr_Print(); // make sure the error is printed
PyErr_Clear(); // clear the error PyErr_Clear(); // clear the error
@ -2984,4 +2979,4 @@ void plPythonFileMod::Write(hsStream* stream, hsResMgr* mgr)
//// kGlobalNameKonstant ///////////////////////////////////////////////// //// kGlobalNameKonstant /////////////////////////////////////////////////
// My continued attempt to spread the CORRECT way to spell konstant. -mcn // My continued attempt to spread the CORRECT way to spell konstant. -mcn
char plPythonFileMod::kGlobalNameKonstant[] = "VeryVerySpecialPythonFileMod"; plString plPythonFileMod::kGlobalNameKonstant = _TEMP_CONVERT_FROM_LITERAL("VeryVerySpecialPythonFileMod");

16
Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h

@ -74,10 +74,10 @@ protected:
hsBool IEval(double secs, hsScalar del, UInt32 dirty); hsBool IEval(double secs, hsScalar del, UInt32 dirty);
void IMakeModuleName(char* modulename,plSceneObject* sobj); plString IMakeModuleName(plSceneObject* sobj);
char* fPythonFile; char* fPythonFile;
char* fModuleName; plString fModuleName;
// the list of receivers that want to be notified // the list of receivers that want to be notified
hsTArray<plKey> fReceivers; hsTArray<plKey> fReceivers;
@ -104,15 +104,15 @@ protected:
struct NamedComponent struct NamedComponent
{ {
char* name; plString name;
Int32 id; Int32 id;
bool isActivator; bool isActivator;
}; };
hsTArray<NamedComponent> fNamedCompQueue; hsTArray<NamedComponent> fNamedCompQueue;
virtual void IFindResponderAndAdd(const char *responderName, Int32 id); virtual void IFindResponderAndAdd(const plString &responderName, Int32 id);
virtual void IFindActivatorAndAdd(const char *activatorName, Int32 id); virtual void IFindActivatorAndAdd(const plString &activatorName, Int32 id);
void ISetKeyValue(const plKey& key, Int32 id); void ISetKeyValue(const plKey& key, Int32 id);
bool ILoadPythonCode(); bool ILoadPythonCode();
@ -210,7 +210,7 @@ public:
static const char* fFunctionNames[]; static const char* fFunctionNames[];
// The konstant hard-coded name to be used for all global pythonFileMods // The konstant hard-coded name to be used for all global pythonFileMods
static char kGlobalNameKonstant[]; static plString kGlobalNameKonstant;
// API for processing discarded keys as the deafult key catcher // API for processing discarded keys as the deafult key catcher
void HandleDiscardedKey( plKeyEventMsg *msg ); void HandleDiscardedKey( plKeyEventMsg *msg );

6
Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp

@ -605,7 +605,7 @@ const plPythonSDLModifier* plPythonSDLModifier::FindAgeSDL()
return sdlMod; return sdlMod;
plNetClientApp::StaticErrorMsg("pfmod %s has a nil python SDL modifier for age sdl %s", plNetClientApp::StaticErrorMsg("pfmod %s has a nil python SDL modifier for age sdl %s",
pfmod->GetKeyName() ? pfmod->GetKeyName() : "?", ageName); pfmod->GetKeyName().s_str("?"), ageName);
} }
else else
{ {
@ -614,11 +614,11 @@ const plPythonSDLModifier* plPythonSDLModifier::FindAgeSDL()
else else
if (!key->ObjectIsLoaded()) if (!key->ObjectIsLoaded())
plNetClientApp::StaticErrorMsg("key %s not loaded for age sdl %s", plNetClientApp::StaticErrorMsg("key %s not loaded for age sdl %s",
key->GetName() ? key->GetName() : "?", ageName); key->GetName().s_str("?"), ageName);
else else
if (!plPythonFileMod::ConvertNoRef(key->ObjectIsLoaded())) if (!plPythonFileMod::ConvertNoRef(key->ObjectIsLoaded()))
plNetClientApp::StaticErrorMsg("key %s is not a python file mod for age sdl %s", plNetClientApp::StaticErrorMsg("key %s is not a python file mod for age sdl %s",
key->GetName() ? key->GetName() : "?", ageName); key->GetName().s_str("?"), ageName);
} }
} }
else else

7
Sources/Plasma/FeatureLib/pfPython/pyImage.cpp

@ -200,7 +200,7 @@ PyObject* pyImage::LoadJPEGFromDisk(const wchar* filename, UInt16 width, UInt16
} }
// let's create a nice name for this thing based on the filename // let's create a nice name for this thing based on the filename
std::string name = "PtImageFromDisk_"; plString name = _TEMP_CONVERT_FROM_LITERAL("PtImageFromDisk_");
const wchar* i = filename; const wchar* i = filename;
int charsChecked = 0; int charsChecked = 0;
@ -219,10 +219,9 @@ PyObject* pyImage::LoadJPEGFromDisk(const wchar* filename, UInt16 width, UInt16
i++; i++;
} }
char* cName = hsWStringToString(i); name += plString::FromWchar(i);
name = name + cName;
hsgResMgr::ResMgr()->NewKey(name.c_str(), theMipmap, plLocation::kGlobalFixedLoc); hsgResMgr::ResMgr()->NewKey(name, theMipmap, plLocation::kGlobalFixedLoc);
return pyImage::New( theMipmap ); return pyImage::New( theMipmap );
} }

21
Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp

@ -58,8 +58,7 @@ UInt32 pyJournalBook::fNextKeyID = 0;
void pyJournalBook::IMakeNewKey( void ) void pyJournalBook::IMakeNewKey( void )
{ {
char name[ 128 ]; plString name = plString::Format( "pyJournalBook-%d", fNextKeyID++ );
sprintf( name, "pyJournalBook-%d", fNextKeyID++ );
hsgResMgr::ResMgr()->NewKey( name, fBook, plLocation::kGlobalFixedLoc ); hsgResMgr::ResMgr()->NewKey( name, fBook, plLocation::kGlobalFixedLoc );
fBook->GetKey()->RefObject(); fBook->GetKey()->RefObject();
@ -96,14 +95,14 @@ pyJournalBook::pyJournalBook( std::wstring esHTMLSource, pyImage &coverImage, py
IMakeNewKey(); IMakeNewKey();
} }
pyJournalBook::pyJournalBook( const char *esHTMLSource, pyImage &coverImage, pyKey callbackKey, const char *guiName ) pyJournalBook::pyJournalBook( const char *esHTMLSource, pyImage &coverImage, pyKey callbackKey, const plString &guiName )
{ {
fBook = TRACKED_NEW pfJournalBook( esHTMLSource, coverImage.GetKey(), callbackKey.getKey(), fBook = TRACKED_NEW pfJournalBook( esHTMLSource, coverImage.GetKey(), callbackKey.getKey(),
callbackKey.getKey() != nil ? callbackKey.getKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc, guiName ); callbackKey.getKey() != nil ? callbackKey.getKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc, guiName );
IMakeNewKey(); IMakeNewKey();
} }
pyJournalBook::pyJournalBook( std::wstring esHTMLSource, pyImage &coverImage, pyKey callbackKey, const char *guiName ) pyJournalBook::pyJournalBook( std::wstring esHTMLSource, pyImage &coverImage, pyKey callbackKey, const plString &guiName )
{ {
fBook = TRACKED_NEW pfJournalBook( esHTMLSource.c_str(), coverImage.GetKey(), callbackKey.getKey(), fBook = TRACKED_NEW pfJournalBook( esHTMLSource.c_str(), coverImage.GetKey(), callbackKey.getKey(),
callbackKey.getKey() != nil ? callbackKey.getKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc, guiName ); callbackKey.getKey() != nil ? callbackKey.getKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc, guiName );
@ -135,7 +134,7 @@ pyJournalBook::~pyJournalBook()
} }
} }
void pyJournalBook::MakeBook(std::string esHTMLSource, plKey coverImageKey /* = nil */, plKey callbackKey /* = nil */, std::string guiName /* = "" */) void pyJournalBook::MakeBook(std::string esHTMLSource, plKey coverImageKey /* = nil */, plKey callbackKey /* = nil */, plString guiName /* = "" */)
{ {
if (fBook) if (fBook)
fBook->GetKey()->UnRefObject(); fBook->GetKey()->UnRefObject();
@ -144,11 +143,11 @@ void pyJournalBook::MakeBook(std::string esHTMLSource, plKey coverImageKey /* =
if (callbackKey != nil) if (callbackKey != nil)
loc = callbackKey->GetUoid().GetLocation(); loc = callbackKey->GetUoid().GetLocation();
fBook = TRACKED_NEW pfJournalBook(esHTMLSource.c_str(), coverImageKey, callbackKey, loc, guiName.c_str()); fBook = TRACKED_NEW pfJournalBook(esHTMLSource.c_str(), coverImageKey, callbackKey, loc, guiName);
IMakeNewKey(); IMakeNewKey();
} }
void pyJournalBook::MakeBook(std::wstring esHTMLSource, plKey coverImageKey /* = nil */, plKey callbackKey /* = nil */, std::string guiName /* = "" */) void pyJournalBook::MakeBook(std::wstring esHTMLSource, plKey coverImageKey /* = nil */, plKey callbackKey /* = nil */, plString guiName /* = "" */)
{ {
if (fBook) if (fBook)
fBook->GetKey()->UnRefObject(); fBook->GetKey()->UnRefObject();
@ -157,7 +156,7 @@ void pyJournalBook::MakeBook(std::wstring esHTMLSource, plKey coverImageKey /* =
if (callbackKey != nil) if (callbackKey != nil)
loc = callbackKey->GetUoid().GetLocation(); loc = callbackKey->GetUoid().GetLocation();
fBook = TRACKED_NEW pfJournalBook(esHTMLSource.c_str(), coverImageKey, callbackKey, loc, guiName.c_str()); fBook = TRACKED_NEW pfJournalBook(esHTMLSource.c_str(), coverImageKey, callbackKey, loc, guiName);
IMakeNewKey(); IMakeNewKey();
} }
@ -235,18 +234,18 @@ void pyJournalBook::AllowPageTurning( bool allow )
fBook->AllowPageTurning(allow); fBook->AllowPageTurning(allow);
} }
void pyJournalBook::SetGUI( const char *guiName ) void pyJournalBook::SetGUI( const plString &guiName )
{ {
if (fBook != nil) if (fBook != nil)
fBook->SetGUI(guiName); fBook->SetGUI(guiName);
} }
void pyJournalBook::LoadGUI( const char *guiName ) void pyJournalBook::LoadGUI( const plString &guiName )
{ {
pfJournalBook::LoadGUI(guiName); pfJournalBook::LoadGUI(guiName);
} }
void pyJournalBook::UnloadGUI( const char *guiName ) void pyJournalBook::UnloadGUI( const plString &guiName )
{ {
pfJournalBook::UnloadGUI(guiName); pfJournalBook::UnloadGUI(guiName);
} }

18
Sources/Plasma/FeatureLib/pfPython/pyJournalBook.h

@ -78,8 +78,8 @@ protected:
pyJournalBook( std::wstring esHTMLSource, pyKey callbackKey ); pyJournalBook( std::wstring esHTMLSource, pyKey callbackKey );
pyJournalBook( const char *esHTMLSource, pyImage &coverImage, pyKey callbackKey ); pyJournalBook( const char *esHTMLSource, pyImage &coverImage, pyKey callbackKey );
pyJournalBook( std::wstring esHTMLSource, pyImage &coverImage, pyKey callbackKey ); pyJournalBook( std::wstring esHTMLSource, pyImage &coverImage, pyKey callbackKey );
pyJournalBook( const char *esHTMLSource, pyImage &coverImage, pyKey callbackKey, const char *guiName ); pyJournalBook( const char *esHTMLSource, pyImage &coverImage, pyKey callbackKey, const plString &guiName );
pyJournalBook( std::wstring esHTMLSource, pyImage &coverImage, pyKey callbackKey, const char *guiName ); pyJournalBook( std::wstring esHTMLSource, pyImage &coverImage, pyKey callbackKey, const plString &guiName );
public: public:
virtual ~pyJournalBook(); virtual ~pyJournalBook();
@ -88,8 +88,8 @@ public:
// required functions for PyObject interoperability // required functions for PyObject interoperability
PYTHON_CLASS_NEW_FRIEND(ptBook); PYTHON_CLASS_NEW_FRIEND(ptBook);
static PyObject *New(std::string htmlSource, plKey coverImageKey = nil, plKey callbackKey = nil, std::string guiName = ""); static PyObject *New(std::string htmlSource, plKey coverImageKey = nil, plKey callbackKey = nil, plString guiName = _TEMP_CONVERT_FROM_LITERAL(""));
static PyObject *New(std::wstring htmlSource, plKey coverImageKey = nil, plKey callbackKey = nil, std::string guiName = ""); static PyObject *New(std::wstring htmlSource, plKey coverImageKey = nil, plKey callbackKey = nil, plString guiName = _TEMP_CONVERT_FROM_LITERAL(""));
PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyJournalBook object PYTHON_CLASS_CHECK_DEFINITION; // returns true if the PyObject is a pyJournalBook object
PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyJournalBook); // converts a PyObject to a pyJournalBook (throws error if not correct type) PYTHON_CLASS_CONVERT_FROM_DEFINITION(pyJournalBook); // converts a PyObject to a pyJournalBook (throws error if not correct type)
@ -98,8 +98,8 @@ public:
static void AddPlasmaConstantsClasses(PyObject *m); static void AddPlasmaConstantsClasses(PyObject *m);
// Deletes the existing book and re-creates it, for use by the python glue // Deletes the existing book and re-creates it, for use by the python glue
void MakeBook(std::string esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, std::string guiName = ""); void MakeBook(std::string esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, plString guiName = _TEMP_CONVERT_FROM_LITERAL(""));
void MakeBook(std::wstring esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, std::string guiName = ""); void MakeBook(std::wstring esHTMLSource, plKey coverImageKey = nil, plKey callbackKey = nil, plString guiName = _TEMP_CONVERT_FROM_LITERAL(""));
// Interface functions per book // Interface functions per book
virtual void Show( hsBool startOpened ); virtual void Show( hsBool startOpened );
@ -117,10 +117,10 @@ public:
virtual void SetSize( hsScalar width, hsScalar height ); virtual void SetSize( hsScalar width, hsScalar height );
virtual void SetGUI( const char *guiName ); virtual void SetGUI( const plString &guiName );
static void LoadGUI( const char *guiName ); static void LoadGUI( const plString &guiName );
static void UnloadGUI( const char *guiName ); static void UnloadGUI( const plString &guiName );
static void UnloadAllGUIs(); static void UnloadAllGUIs();
virtual PyObject *GetMovie( UInt8 index ); // returns cyAnimation virtual PyObject *GetMovie( UInt8 index ); // returns cyAnimation

14
Sources/Plasma/FeatureLib/pfPython/pyJournalBookGlue.cpp

@ -101,9 +101,9 @@ PYTHON_INIT_DEFINITION(ptBook, args, keywords)
callbackKey = pyKey::ConvertFrom(callbackObj)->getKey(); callbackKey = pyKey::ConvertFrom(callbackObj)->getKey();
} }
std::string guiNameStr = ""; plString guiNameStr;
if (guiName) if (guiName)
guiNameStr = guiName; guiNameStr = plString::FromUtf8(guiName);
// convert the sourcecode object // convert the sourcecode object
if (PyUnicode_Check(sourceObj)) if (PyUnicode_Check(sourceObj))
@ -225,7 +225,7 @@ PYTHON_METHOD_DEFINITION(ptBook, setGUI, args)
PyErr_SetString(PyExc_TypeError, "setGUI expects a string"); PyErr_SetString(PyExc_TypeError, "setGUI expects a string");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
self->fThis->SetGUI(guiName); self->fThis->SetGUI(plString::FromUtf8(guiName));
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
} }
@ -293,14 +293,14 @@ PYTHON_END_METHODS_TABLE;
PLASMA_DEFAULT_TYPE(ptBook, "Params: esHTMLSource,coverImage=None,callbackKey=None,guiName=''\nCreates a new book"); PLASMA_DEFAULT_TYPE(ptBook, "Params: esHTMLSource,coverImage=None,callbackKey=None,guiName=''\nCreates a new book");
// required functions for PyObject interoperability // required functions for PyObject interoperability
PyObject *pyJournalBook::New(std::string htmlSource, plKey coverImageKey /* = nil */, plKey callbackKey /* = nil */, std::string guiName /* = "" */) PyObject *pyJournalBook::New(std::string htmlSource, plKey coverImageKey /* = nil */, plKey callbackKey /* = nil */, plString guiName /* = "" */)
{ {
ptBook *newObj = (ptBook*)ptBook_type.tp_new(&ptBook_type, NULL, NULL); ptBook *newObj = (ptBook*)ptBook_type.tp_new(&ptBook_type, NULL, NULL);
newObj->fThis->MakeBook(htmlSource, coverImageKey, callbackKey, guiName); newObj->fThis->MakeBook(htmlSource, coverImageKey, callbackKey, guiName);
return (PyObject*)newObj; return (PyObject*)newObj;
} }
PyObject *pyJournalBook::New(std::wstring htmlSource, plKey coverImageKey /* = nil */, plKey callbackKey /* = nil */, std::string guiName /* = "" */) PyObject *pyJournalBook::New(std::wstring htmlSource, plKey coverImageKey /* = nil */, plKey callbackKey /* = nil */, plString guiName /* = "" */)
{ {
ptBook *newObj = (ptBook*)ptBook_type.tp_new(&ptBook_type, NULL, NULL); ptBook *newObj = (ptBook*)ptBook_type.tp_new(&ptBook_type, NULL, NULL);
newObj->fThis->MakeBook(htmlSource, coverImageKey, callbackKey, guiName); newObj->fThis->MakeBook(htmlSource, coverImageKey, callbackKey, guiName);
@ -329,7 +329,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtLoadBookGUI, args, "Params: guiName\nLoads the
PyErr_SetString(PyExc_TypeError, "PtLoadBookGUI expects a string"); PyErr_SetString(PyExc_TypeError, "PtLoadBookGUI expects a string");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
pyJournalBook::LoadGUI(guiName); pyJournalBook::LoadGUI(plString::FromUtf8(guiName));
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
} }
@ -341,7 +341,7 @@ PYTHON_GLOBAL_METHOD_DEFINITION(PtUnloadBookGUI, args, "Params: guiName\nUnloads
PyErr_SetString(PyExc_TypeError, "PtUnloadBookGUI expects a string"); PyErr_SetString(PyExc_TypeError, "PtUnloadBookGUI expects a string");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
pyJournalBook::UnloadGUI(guiName); pyJournalBook::UnloadGUI(plString::FromUtf8(guiName));
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
} }

3
Sources/Plasma/FeatureLib/pfPython/pyKey.h

@ -52,6 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <Python.h> #include <Python.h>
#include "pyGlueHelpers.h" #include "pyGlueHelpers.h"
#include "plString.h"
class plPythonFileMod; class plPythonFileMod;
class pySceneObject; class pySceneObject;
@ -98,7 +99,7 @@ public:
// getter and setters // getter and setters
virtual plKey getKey() { return fKey; } virtual plKey getKey() { return fKey; }
virtual void setKey(plKey key) { fKey=key; } virtual void setKey(plKey key) { fKey=key; }
virtual const char* getName() const { return fKey ? fKey->GetName() : "nil"; } virtual const char* getName() const { return fKey ? fKey->GetName().c_str() : "nil"; }
#ifndef BUILDING_PYPLASMA #ifndef BUILDING_PYPLASMA
PyObject* GetPySceneObject(); PyObject* GetPySceneObject();

10
Sources/Plasma/FeatureLib/pfPython/pySceneObject.cpp

@ -210,21 +210,21 @@ void pySceneObject::SetNetForce(hsBool state)
} }
const char* pySceneObject::GetName() plString pySceneObject::GetName()
{ {
if ( fSceneObjects.Count() > 0 ) if ( fSceneObjects.Count() > 0 )
return fSceneObjects[0]->GetName(); return fSceneObjects[0]->GetName();
return ""; return _TEMP_CONVERT_FROM_LITERAL("");
} }
PyObject* pySceneObject::findObj(const char* name) PyObject* pySceneObject::findObj(const plString& name)
{ {
PyObject* pSobj = nil; PyObject* pSobj = nil;
// search through the plKeys that we have looking for this name // search through the plKeys that we have looking for this name
int i; int i;
for ( i=0; i<fSceneObjects.Count(); i++ ) for ( i=0; i<fSceneObjects.Count(); i++ )
{ {
if ( hsStrEQ(name,fSceneObjects[i]->GetName()) ) if ( name == fSceneObjects[i]->GetName() )
{ {
pSobj = pySceneObject::New(fSceneObjects[i],fPyMod); pSobj = pySceneObject::New(fSceneObjects[i],fPyMod);
break; break;
@ -235,7 +235,7 @@ PyObject* pySceneObject::findObj(const char* name)
if ( pSobj == nil ) if ( pSobj == nil )
{ {
// throw a Python error, so the coder knows it didn't work // throw a Python error, so the coder knows it didn't work
PyErr_SetString(PyExc_KeyError, name); PyErr_SetString(PyExc_KeyError, name.c_str());
} }
return pSobj; return pSobj;

4
Sources/Plasma/FeatureLib/pfPython/pySceneObject.h

@ -114,9 +114,9 @@ public:
virtual void SetNetForce(hsBool state); virtual void SetNetForce(hsBool state);
virtual PyObject* findObj(const char* name); // pySceneObject virtual PyObject* findObj(const plString& name); // pySceneObject
virtual const char* GetName(); virtual plString GetName();
virtual std::vector<PyObject*> GetResponders(); // pyKey list virtual std::vector<PyObject*> GetResponders(); // pyKey list
virtual std::vector<PyObject*> GetPythonMods(); // pyKey list virtual std::vector<PyObject*> GetPythonMods(); // pyKey list
// //

4
Sources/Plasma/FeatureLib/pfPython/pySceneObjectGlue.cpp

@ -151,12 +151,12 @@ PYTHON_METHOD_DEFINITION(ptSceneobject, findObject, args)
PyErr_SetString(PyExc_TypeError, "findObject expects a string"); PyErr_SetString(PyExc_TypeError, "findObject expects a string");
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
return self->fThis->findObj(name); return self->fThis->findObj(plString::FromUtf8(name));
} }
PYTHON_METHOD_DEFINITION_NOARGS(ptSceneobject, getName) PYTHON_METHOD_DEFINITION_NOARGS(ptSceneobject, getName)
{ {
return PyString_FromString(self->fThis->GetName()); return PyString_FromString(self->fThis->GetName().c_str());
} }
PYTHON_METHOD_DEFINITION_NOARGS(ptSceneobject, getResponders) PYTHON_METHOD_DEFINITION_NOARGS(ptSceneobject, getResponders)

3
Sources/Plasma/FeatureLib/pfPython/pyVaultImageNode.cpp

@ -64,8 +64,7 @@ static unsigned s_keyseq;
//============================================================================ //============================================================================
static plKey CreateAndRefImageKey (unsigned nodeId, plMipmap * mipmap) { static plKey CreateAndRefImageKey (unsigned nodeId, plMipmap * mipmap) {
char keyName[MAX_PATH]; plString keyName = plString::Format("VaultImg_%u_%u", nodeId, s_keyseq++);
StrPrintf(keyName, arrsize(keyName), "VaultImg_%u_%u", nodeId, s_keyseq++);
plKey key = hsgResMgr::ResMgr()->NewKey(keyName, mipmap, plLocation::kGlobalFixedLoc); plKey key = hsgResMgr::ResMgr()->NewKey(keyName, mipmap, plLocation::kGlobalFixedLoc);

3
Sources/Plasma/FeatureLib/pfSurface/plLayerMovie.cpp

@ -115,8 +115,7 @@ hsBool plLayerMovie::ISetupBitmap()
memset(b->GetImage(), 0x10, b->GetHeight() * b->GetRowBytes() ); memset(b->GetImage(), 0x10, b->GetHeight() * b->GetRowBytes() );
b->SetFlags( b->GetFlags() | plMipmap::kDontThrowAwayImage ); b->SetFlags( b->GetFlags() | plMipmap::kDontThrowAwayImage );
char name[ 256 ]; plString name = plString::Format( "%s_BMap", fMovieName );
sprintf( name, "%s_BMap", fMovieName );
hsgResMgr::ResMgr()->NewKey( name, b, plLocation::kGlobalFixedLoc ); hsgResMgr::ResMgr()->NewKey( name, b, plLocation::kGlobalFixedLoc );
*fTexture = (plBitmap *)b; *fTexture = (plBitmap *)b;

4
Sources/Plasma/NucleusLib/inc/hsResMgr.h

@ -105,7 +105,7 @@ public:
//--------------------------- //---------------------------
// Registry Modification Functions // Registry Modification Functions
//--------------------------- //---------------------------
virtual plKey NewKey(const char* name, hsKeyedObject* object, const plLocation& loc, const plLoadMask& m = plLoadMask::kAlways)=0; virtual plKey NewKey(const plString& name, hsKeyedObject* object, const plLocation& loc, const plLoadMask& m = plLoadMask::kAlways)=0;
virtual plKey NewKey(plUoid& newUoid, hsKeyedObject* object)=0; virtual plKey NewKey(plUoid& newUoid, hsKeyedObject* object)=0;
virtual plDispatchBase* Dispatch()=0; virtual plDispatchBase* Dispatch()=0;
@ -118,7 +118,7 @@ protected:
friend class plKeyImp; friend class plKeyImp;
friend class plArmatureMod; // Temp hack until a findkey/clone issue is fixed. -Bob friend class plArmatureMod; // Temp hack until a findkey/clone issue is fixed. -Bob
virtual plKey ReRegister(const char *nm, const plUoid& oid)=0; virtual plKey ReRegister(const plString& nm, const plUoid& oid)=0;
virtual hsBool ReadObject(plKeyImp* key)=0; // plKeys call this when needed virtual hsBool ReadObject(plKeyImp* key)=0; // plKeys call this when needed
// Sets a key as used or unused in the registry. When all keys in a page of a // Sets a key as used or unused in the registry. When all keys in a page of a

4
Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp

@ -341,7 +341,7 @@ void plDispatch::IMsgDispatch()
UInt32 rcvTicks = hsTimer::GetPrecTickCount(); UInt32 rcvTicks = hsTimer::GetPrecTickCount();
// Object could be deleted by this message, so we need to log this stuff now // Object could be deleted by this message, so we need to log this stuff now
const char* keyname = "(unknown)"; plString keyname = _TEMP_CONVERT_FROM_LITERAL("(unknown)");
const char* className = "(unknown)"; const char* className = "(unknown)";
UInt32 clonePlayerID = 0; UInt32 clonePlayerID = 0;
if (plDispatchLogBase::IsLoggingLong()) if (plDispatchLogBase::IsLoggingLong())
@ -373,7 +373,7 @@ void plDispatch::IMsgDispatch()
float rcvTime = (float)(hsTimer::PrecTicksToSecs(rcvTicks) * 1000.f); float rcvTime = (float)(hsTimer::PrecTicksToSecs(rcvTicks) * 1000.f);
// If the receiver takes more than 5 ms to process its message, log it // If the receiver takes more than 5 ms to process its message, log it
if (rcvTime > 5.f) if (rcvTime > 5.f)
plDispatchLogBase::GetInstance()->LogLongReceive(keyname, className, clonePlayerID, msg, rcvTime); plDispatchLogBase::GetInstance()->LogLongReceive(keyname.c_str(), className, clonePlayerID, msg, rcvTime);
} }
#endif // PLASMA_EXTERNAL_RELEASE #endif // PLASMA_EXTERNAL_RELEASE

6
Sources/Plasma/NucleusLib/pnKeyedObject/hsKeyedObject.cpp

@ -65,12 +65,12 @@ hsBool hsKeyedObject::SendRef(plRefMsg* refMsg, plRefFlags::Type flags)
return hsgResMgr::SendRef(key, refMsg, flags); return hsgResMgr::SendRef(key, refMsg, flags);
} }
const char* hsKeyedObject::GetKeyName() const plString hsKeyedObject::GetKeyName() const
{ {
if (fpKey) if (fpKey)
return fpKey->GetName(); return fpKey->GetName();
else else
return "(unknown)"; return _TEMP_CONVERT_FROM_LITERAL("(unknown)");
} }
hsKeyedObject::~hsKeyedObject() hsKeyedObject::~hsKeyedObject()
@ -123,7 +123,7 @@ void hsKeyedObject::UnRegisterAs(plFixedKeyId fixedKey)
UnRegisterAsManual(uoid); UnRegisterAsManual(uoid);
} }
plKey hsKeyedObject::RegisterAsManual(plUoid& meUoid, const char* p) plKey hsKeyedObject::RegisterAsManual(plUoid& meUoid, const plString& p)
{ {
hsAssert(meUoid.GetClassType() == ClassIndex(),"Registering as wrong type!"); hsAssert(meUoid.GetClassType() == ClassIndex(),"Registering as wrong type!");
// Really should be a NewKey() call just for fixed keys, so change this once player rooms behave // Really should be a NewKey() call just for fixed keys, so change this once player rooms behave

4
Sources/Plasma/NucleusLib/pnKeyedObject/hsKeyedObject.h

@ -62,7 +62,7 @@ public:
GETINTERFACE_ANY(hsKeyedObject, plReceiver); GETINTERFACE_ANY(hsKeyedObject, plReceiver);
const plKey& GetKey() const { return fpKey; } const plKey& GetKey() const { return fpKey; }
const char* GetKeyName() const; plString GetKeyName() const;
virtual void Validate(); virtual void Validate();
virtual hsBool IsFinal() { return true; }; // experimental; currently "is ready to process Loads" virtual hsBool IsFinal() { return true; }; // experimental; currently "is ready to process Loads"
@ -85,7 +85,7 @@ public:
void UnRegisterAs(plFixedKeyId fixedKey); void UnRegisterAs(plFixedKeyId fixedKey);
// used when manually loading the player room // used when manually loading the player room
plKey RegisterAsManual(plUoid& uoid, const char* p); plKey RegisterAsManual(plUoid& uoid, const plString& p);
void UnRegisterAsManual(plUoid& uoid); void UnRegisterAsManual(plUoid& uoid);
// If you want clone keys to share a type of object, override this function for it. // If you want clone keys to share a type of object, override this function for it.

81
Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp

@ -64,11 +64,11 @@ struct plKeySeed
// NOTE: The following fields are broken out to make adding to the fixed key list easier. // NOTE: The following fields are broken out to make adding to the fixed key list easier.
// However, what they really are, are just the fields of plUoid (including plLocation) // However, what they really are, are just the fields of plUoid (including plLocation)
UInt16 fType; UInt16 fType;
const char *fObj; plString fObj;
hsBool Match( plKeySeed *p ) hsBool Match( plKeySeed *p )
{ {
if( ( fType == p->fType ) && stricmp( p->fObj, fObj ) == 0 ) if( ( fType == p->fType ) && p->fObj.Compare( fObj, plString::kCaseInsensitive ) == 0 )
{ {
return true; return true;
} }
@ -82,48 +82,50 @@ struct plKeySeed
// 2) Be sure your ClassIndex CLASS_INDEX(plSceneObject) matches the type of object you want to have the fixedKey // 2) Be sure your ClassIndex CLASS_INDEX(plSceneObject) matches the type of object you want to have the fixedKey
// 3) Make sure the Obj is unique for this location/Type Combo... (validated at runtime) // 3) Make sure the Obj is unique for this location/Type Combo... (validated at runtime)
#define _TCFL _TEMP_CONVERT_FROM_LITERAL
plKeySeed SeedList[] = { plKeySeed SeedList[] = {
// Key Enum Type Obj // Key Enum Type Obj
{ kFirst_Fixed_KEY, CLASS_INDEX_SCOPED( plSceneObject ), "kFirst_Fixed_KEY" }, { kFirst_Fixed_KEY, CLASS_INDEX_SCOPED( plSceneObject ), _TCFL("kFirst_Fixed_KEY") },
{ kLOSObject_KEY, CLASS_INDEX_SCOPED( plLOSDispatch ), "kLOSObject_KEY", }, { kLOSObject_KEY, CLASS_INDEX_SCOPED( plLOSDispatch ), _TCFL("kLOSObject_KEY"), },
{ kTimerCallbackManager_KEY, CLASS_INDEX_SCOPED( plTimerCallbackManager ), "kTimerCallbackManager_KEY", }, { kTimerCallbackManager_KEY, CLASS_INDEX_SCOPED( plTimerCallbackManager ), _TCFL("kTimerCallbackManager_KEY"), },
{ kConsoleObject_KEY, CLASS_INDEX_SCOPED( pfConsole ), "kConsoleObject_KEY", }, { kConsoleObject_KEY, CLASS_INDEX_SCOPED( pfConsole ), _TCFL("kConsoleObject_KEY"), },
{ kAudioSystem_KEY, CLASS_INDEX_SCOPED( plAudioSystem ), "kAudioSystem_KEY", }, { kAudioSystem_KEY, CLASS_INDEX_SCOPED( plAudioSystem ), _TCFL("kAudioSystem_KEY"), },
{ kInput_KEY, CLASS_INDEX_SCOPED( plInputManager ), "kInput_KEY", }, { kInput_KEY, CLASS_INDEX_SCOPED( plInputManager ), _TCFL("kInput_KEY"), },
{ kClient_KEY, CLASS_INDEX_SCOPED( plClient ), "kClient_KEY", }, { kClient_KEY, CLASS_INDEX_SCOPED( plClient ), _TCFL("kClient_KEY"), },
{ kNetClientMgr_KEY, CLASS_INDEX_SCOPED( plNetClientMgr ), "kNetClientMgr_KEY", }, { kNetClientMgr_KEY, CLASS_INDEX_SCOPED( plNetClientMgr ), _TCFL("kNetClientMgr_KEY"), },
{ kListenerMod_KEY, CLASS_INDEX_SCOPED( plListener ), "kListenerMod_KEY", }, { kListenerMod_KEY, CLASS_INDEX_SCOPED( plListener ), _TCFL("kListenerMod_KEY"), },
{ kTransitionMgr_KEY, CLASS_INDEX_SCOPED( plTransitionMgr ), "kTransitionMgr_KEY", }, { kTransitionMgr_KEY, CLASS_INDEX_SCOPED( plTransitionMgr ), _TCFL("kTransitionMgr_KEY"), },
{ kLinkEffectsMgr_KEY, CLASS_INDEX_SCOPED( plLinkEffectsMgr ), "kLinkEffectsMgr_KEY", }, { kLinkEffectsMgr_KEY, CLASS_INDEX_SCOPED( plLinkEffectsMgr ), _TCFL("kLinkEffectsMgr_KEY"), },
{ kGameGUIMgr_KEY, CLASS_INDEX_SCOPED( pfGameGUIMgr ), "kGameGUIMgr_KEY", }, { kGameGUIMgr_KEY, CLASS_INDEX_SCOPED( pfGameGUIMgr ), _TCFL("kGameGUIMgr_KEY"), },
{ kGameGUIDynamicDlg_KEY, CLASS_INDEX_SCOPED( plSceneNode ), "kGameGUIDynamicDlg_KEY", }, { kGameGUIDynamicDlg_KEY, CLASS_INDEX_SCOPED( plSceneNode ), _TCFL("kGameGUIDynamicDlg_KEY"), },
{ kVirtualCamera1_KEY, CLASS_INDEX_SCOPED( plVirtualCam1 ), "kVirtualCamera_KEY", }, { kVirtualCamera1_KEY, CLASS_INDEX_SCOPED( plVirtualCam1 ), _TCFL("kVirtualCamera_KEY"), },
{ kDefaultCameraMod1_KEY, CLASS_INDEX_SCOPED( plCameraModifier1 ), "kDefaultCameraMod1_KEY", }, { kDefaultCameraMod1_KEY, CLASS_INDEX_SCOPED( plCameraModifier1 ), _TCFL("kDefaultCameraMod1_KEY"), },
{ kKIGUIGlue_KEY, CLASS_INDEX_SCOPED( pfKI ), "kKIGUIGlue_KEY", }, { kKIGUIGlue_KEY, CLASS_INDEX_SCOPED( pfKI ), _TCFL("kKIGUIGlue_KEY"), },
{ kClothingMgr_KEY, CLASS_INDEX_SCOPED( plClothingMgr ), "kClothingMgr_KEY", }, { kClothingMgr_KEY, CLASS_INDEX_SCOPED( plClothingMgr ), _TCFL("kClothingMgr_KEY"), },
{ kInputInterfaceMgr_KEY, CLASS_INDEX_SCOPED( plInputInterfaceMgr ), "kInputInterfaceMgr_KEY", }, { kInputInterfaceMgr_KEY, CLASS_INDEX_SCOPED( plInputInterfaceMgr ), _TCFL("kInputInterfaceMgr_KEY"), },
{ kAVIWriter_KEY, CLASS_INDEX_SCOPED( plAVIWriter ), "kAVIWriter_KEY", }, { kAVIWriter_KEY, CLASS_INDEX_SCOPED( plAVIWriter ), _TCFL("kAVIWriter_KEY"), },
{ kResManagerHelper_KEY, CLASS_INDEX_SCOPED( plResManagerHelper ), "kResManagerHelper_KEY", }, { kResManagerHelper_KEY, CLASS_INDEX_SCOPED( plResManagerHelper ), _TCFL("kResManagerHelper_KEY"), },
{ kAvatarMgr_KEY, CLASS_INDEX_SCOPED( plAvatarMgr ), "kAvatarMgr_KEY", }, { kAvatarMgr_KEY, CLASS_INDEX_SCOPED( plAvatarMgr ), _TCFL("kAvatarMgr_KEY"), },
{ kSimulationMgr_KEY, CLASS_INDEX_SCOPED( plSimulationMgr ), "kSimulationMgr_KEY", }, { kSimulationMgr_KEY, CLASS_INDEX_SCOPED( plSimulationMgr ), _TCFL("kSimulationMgr_KEY"), },
{ kTransitionCamera_KEY, CLASS_INDEX_SCOPED( plCameraModifier1 ), "kTransitionCamera_KEY", }, { kTransitionCamera_KEY, CLASS_INDEX_SCOPED( plCameraModifier1 ), _TCFL("kTransitionCamera_KEY"), },
{ kCCRMgr_KEY, CLASS_INDEX_SCOPED( plCCRMgr ), "kCCRMgr_KEY", }, { kCCRMgr_KEY, CLASS_INDEX_SCOPED( plCCRMgr ), _TCFL("kCCRMgr_KEY"), },
{ kNetClientCloneRoom_KEY, CLASS_INDEX_SCOPED( plSceneNode ), "kNetClientCloneRoom_KEY", }, { kNetClientCloneRoom_KEY, CLASS_INDEX_SCOPED( plSceneNode ), _TCFL("kNetClientCloneRoom_KEY"), },
{ kMarkerMgr_KEY, CLASS_INDEX_SCOPED( pfMarkerMgr ), "kMarkerMgr_KEY", }, { kMarkerMgr_KEY, CLASS_INDEX_SCOPED( pfMarkerMgr ), _TCFL("kMarkerMgr_KEY"), },
{ kAutoProfile_KEY, CLASS_INDEX_SCOPED( plAutoProfile ), "kAutoProfile_KEY", }, { kAutoProfile_KEY, CLASS_INDEX_SCOPED( plAutoProfile ), _TCFL("kAutoProfile_KEY"), },
{ kGlobalVisMgr_KEY, CLASS_INDEX_SCOPED( plVisMgr ), "kGlobalVisMgr_KEY", }, { kGlobalVisMgr_KEY, CLASS_INDEX_SCOPED( plVisMgr ), _TCFL("kGlobalVisMgr_KEY"), },
{ kFontCache_KEY, CLASS_INDEX_SCOPED( plFontCache ), "kFontCache_KEY", }, { kFontCache_KEY, CLASS_INDEX_SCOPED( plFontCache ), _TCFL("kFontCache_KEY"), },
{ kRelevanceMgr_KEY, CLASS_INDEX_SCOPED( plRelevanceMgr ), "kRelevanceMgr_KEY", }, { kRelevanceMgr_KEY, CLASS_INDEX_SCOPED( plRelevanceMgr ), _TCFL("kRelevanceMgr_KEY"), },
{ kJournalBookMgr_KEY, CLASS_INDEX_SCOPED( pfJournalBook ), "kJournalBookMgr_KEY" }, { kJournalBookMgr_KEY, CLASS_INDEX_SCOPED( pfJournalBook ), _TCFL("kJournalBookMgr_KEY") },
{ kAgeLoader_KEY, CLASS_INDEX_SCOPED( plAgeLoader), "kAgeLoader_KEY" }, { kAgeLoader_KEY, CLASS_INDEX_SCOPED( plAgeLoader), _TCFL("kAgeLoader_KEY") },
{ kBuiltIn3rdPersonCamera_KEY, CLASS_INDEX_SCOPED( plCameraModifier1 ), "kBuiltIn3rdPersonCamera_KEY", }, { kBuiltIn3rdPersonCamera_KEY, CLASS_INDEX_SCOPED( plCameraModifier1 ), _TCFL("kBuiltIn3rdPersonCamera_KEY"), },
{ kSecurePreloader_KEY, CLASS_INDEX_SCOPED( pfSecurePreloader ), "kSecurePreloader_KEY", }, { kSecurePreloader_KEY, CLASS_INDEX_SCOPED( pfSecurePreloader ), _TCFL("kSecurePreloader_KEY"), },
{ kLast_Fixed_KEY, CLASS_INDEX_SCOPED( plSceneObject ), "kLast_Fixed_KEY", } { kLast_Fixed_KEY, CLASS_INDEX_SCOPED( plSceneObject ), _TCFL("kLast_Fixed_KEY"), }
}; };
#undef _TCFL
//// plFixedKeyValidator ///////////////////////////////////////////////////// //// plFixedKeyValidator /////////////////////////////////////////////////////
@ -166,14 +168,13 @@ plUoid::plUoid(plFixedKeyId fixedkey)
{ {
hsAssert(fixedkey < kLast_Fixed_KEY, "Request for Fixed key is out of Range"); hsAssert(fixedkey < kLast_Fixed_KEY, "Request for Fixed key is out of Range");
fObjectName = nil;
Invalidate(); Invalidate();
plKeySeed* p= &SeedList[fixedkey]; plKeySeed* p= &SeedList[fixedkey];
fLocation = plLocation::kGlobalFixedLoc; fLocation = plLocation::kGlobalFixedLoc;
fClassType = p->fType; fClassType = p->fType;
fObjectName = hsStrcpy(p->fObj); fObjectName = p->fObj;
fObjectID = 0; fObjectID = 0;
fCloneID = 0; fCloneID = 0;
fClonePlayerID = 0; fClonePlayerID = 0;

3
Sources/Plasma/NucleusLib/pnKeyedObject/plKey.h

@ -55,6 +55,7 @@ class hsBitVector;
class plKeyData; class plKeyData;
class plKeyImp; class plKeyImp;
class plString;
class plKey class plKey
{ {
@ -96,7 +97,7 @@ class plKeyData
{ {
public: public:
virtual const plUoid& GetUoid() const=0; virtual const plUoid& GetUoid() const=0;
virtual const char* GetName() const=0; virtual const plString& GetName() const=0;
virtual hsKeyedObject* GetObjectPtr()=0; virtual hsKeyedObject* GetObjectPtr()=0;
virtual hsKeyedObject* ObjectIsLoaded() const=0; virtual hsKeyedObject* ObjectIsLoaded() const=0;

6
Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp

@ -55,8 +55,8 @@ plProfile_CreateMemCounter("Keys", "Memory", KeyMem);
static UInt32 CalcKeySize(plKeyImp* key) static UInt32 CalcKeySize(plKeyImp* key)
{ {
UInt32 nameLen = 0; UInt32 nameLen = 0;
if (key->GetUoid().GetObjectName()) if (!key->GetUoid().GetObjectName().IsNull())
nameLen = strlen(key->GetUoid().GetObjectName()) + 1; nameLen = key->GetUoid().GetObjectName().GetSize() + 1;
return sizeof(plKeyImp) + nameLen; return sizeof(plKeyImp) + nameLen;
} }
@ -143,7 +143,7 @@ void plKeyImp::SetUoid(const plUoid& uoid)
#endif #endif
} }
const char* plKeyImp::GetName() const const plString& plKeyImp::GetName() const
{ {
return fUoid.GetObjectName(); return fUoid.GetObjectName();
} }

2
Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.h

@ -59,7 +59,7 @@ public:
virtual ~plKeyImp(); virtual ~plKeyImp();
virtual const plUoid& GetUoid() const { return fUoid; } virtual const plUoid& GetUoid() const { return fUoid; }
virtual const char* GetName() const; virtual const plString& GetName() const;
virtual hsKeyedObject* GetObjectPtr(); virtual hsKeyedObject* GetObjectPtr();
virtual hsKeyedObject* ObjectIsLoaded() const; virtual hsKeyedObject* ObjectIsLoaded() const;

4
Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp

@ -167,7 +167,7 @@ hsBool plMsgForwarder::IForwardCallbackMsg(plMessage *msg)
if (--fc->fNumCallbacks == 0) if (--fc->fNumCallbacks == 0)
{ {
hsStatusMessageF("plEventCallbackMsg received, erasing, sender=%s, remoteMsg=%d\n", hsStatusMessageF("plEventCallbackMsg received, erasing, sender=%s, remoteMsg=%d\n",
msg->GetSender() ? msg->GetSender()->GetName() : "nil", msg->HasBCastFlag(plMessage::kNetNonLocal)); msg->GetSender() ? msg->GetSender()->GetName().c_str() : "nil", msg->HasBCastFlag(plMessage::kNetNonLocal));
fCallbacks.erase(eventMsg); fCallbacks.erase(eventMsg);
@ -190,7 +190,7 @@ hsBool plMsgForwarder::IForwardCallbackMsg(plMessage *msg)
else else
{ {
hsStatusMessageF("! Unknown plEventCallbackMsg received, sender=%s, remoteMsg=%d\n", hsStatusMessageF("! Unknown plEventCallbackMsg received, sender=%s, remoteMsg=%d\n",
msg->GetSender() ? msg->GetSender()->GetName() : "nil", msg->HasBCastFlag(plMessage::kNetNonLocal)); msg->GetSender() ? msg->GetSender()->GetName().c_str() : "nil", msg->HasBCastFlag(plMessage::kNetNonLocal));
hsAssert(0, "Unknown plEventCallbackMsg received"); hsAssert(0, "Unknown plEventCallbackMsg received");
} }
return true; return true;

24
Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp

@ -135,21 +135,19 @@ plLocation plLocation::MakeNormal(UInt32 number)
//// plUoid ////////////////////////////////////////////////////////////////// //// plUoid //////////////////////////////////////////////////////////////////
plUoid::plUoid(const plLocation& location, UInt16 classType, const char* objectName, const plLoadMask& m) plUoid::plUoid(const plLocation& location, UInt16 classType, const plString& objectName, const plLoadMask& m)
{ {
fObjectName = nil;
Invalidate(); Invalidate();
fLocation = location; fLocation = location;
fClassType = classType; fClassType = classType;
fObjectName = hsStrcpy(objectName); fObjectName = objectName;
fLoadMask = m; fLoadMask = m;
fClonePlayerID = 0; fClonePlayerID = 0;
} }
plUoid::plUoid(const plUoid& src) plUoid::plUoid(const plUoid& src)
{ {
fObjectName = nil;
Invalidate(); Invalidate();
*this = src; *this = src;
} }
@ -177,7 +175,7 @@ void plUoid::Read(hsStream* s)
s->LogReadLE(&fClassType, "ClassType"); s->LogReadLE(&fClassType, "ClassType");
s->LogReadLE(&fObjectID, "ObjectID"); s->LogReadLE(&fObjectID, "ObjectID");
s->LogSubStreamPushDesc("ObjectName"); s->LogSubStreamPushDesc("ObjectName");
fObjectName = s->LogReadSafeString(); fObjectName = s->LogReadSafeString_TEMP();
// conditional cloneIDs read // conditional cloneIDs read
if (contents & kHasCloneIDs) if (contents & kHasCloneIDs)
@ -210,7 +208,7 @@ void plUoid::Write(hsStream* s) const
s->WriteLE( fClassType ); s->WriteLE( fClassType );
s->WriteLE( fObjectID ); s->WriteLE( fObjectID );
s->WriteSafeString( fObjectName ); s->WriteSafeString_TEMP( fObjectName );
// conditional cloneIDs write // conditional cloneIDs write
if (contents & kHasCloneIDs) if (contents & kHasCloneIDs)
@ -228,9 +226,7 @@ void plUoid::Invalidate()
fCloneID = 0; fCloneID = 0;
fClonePlayerID = 0; fClonePlayerID = 0;
fClassType = 0; fClassType = 0;
if (fObjectName) fObjectName = plString::Null;
delete [] fObjectName;
fObjectName = nil;
fLocation.Invalidate(); fLocation.Invalidate();
fLoadMask = plLoadMask::kAlways; fLoadMask = plLoadMask::kAlways;
@ -238,7 +234,7 @@ void plUoid::Invalidate()
hsBool plUoid::IsValid() const hsBool plUoid::IsValid() const
{ {
if (!fLocation.IsValid() || fObjectName == nil) if (!fLocation.IsValid() || fObjectName.IsNull())
return false; return false;
return true; return true;
@ -249,7 +245,7 @@ hsBool plUoid::operator==(const plUoid& u) const
return fLocation == u.fLocation return fLocation == u.fLocation
&& fLoadMask == u.fLoadMask && fLoadMask == u.fLoadMask
&& fClassType == u.fClassType && fClassType == u.fClassType
&& hsStrEQ(fObjectName, u.fObjectName) && fObjectName == u.fObjectName
&& fObjectID == u.fObjectID && fObjectID == u.fObjectID
&& fCloneID == u.fCloneID && fCloneID == u.fCloneID
&& fClonePlayerID == u.fClonePlayerID; && fClonePlayerID == u.fClonePlayerID;
@ -261,9 +257,7 @@ plUoid& plUoid::operator=(const plUoid& rhs)
fCloneID = rhs.fCloneID; fCloneID = rhs.fCloneID;
fClonePlayerID = rhs.fClonePlayerID; fClonePlayerID = rhs.fClonePlayerID;
fClassType = rhs.fClassType; fClassType = rhs.fClassType;
if (fObjectName) fObjectName = rhs.fObjectName;
delete [] fObjectName;
fObjectName = hsStrcpy(rhs.fObjectName);
fLocation = rhs.fLocation; fLocation = rhs.fLocation;
fLoadMask = rhs.fLoadMask; fLoadMask = rhs.fLoadMask;
@ -276,7 +270,7 @@ plString plUoid::StringIze() const // Format to displayable string
return plString::Format("(0x%x:0x%x:%s:C:[%u,%u])", return plString::Format("(0x%x:0x%x:%s:C:[%u,%u])",
fLocation.GetSequenceNumber(), fLocation.GetSequenceNumber(),
int(fLocation.GetFlags()), int(fLocation.GetFlags()),
fObjectName, fObjectName.c_str(),
GetClonePlayerID(), GetClonePlayerID(),
GetCloneID()); GetCloneID());
} }

10
Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h

@ -57,9 +57,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsTypes.h" #include "hsTypes.h"
#include "plFixedKey.h" #include "plFixedKey.h"
#include "plLoadMask.h" #include "plLoadMask.h"
#include "plString.h"
class hsStream; class hsStream;
class plString;
//// plLocation ////////////////////////////////////////////////////////////// //// plLocation //////////////////////////////////////////////////////////////
@ -144,15 +144,15 @@ public:
class plUoid class plUoid
{ {
public: public:
plUoid() { fObjectName = nil; Invalidate(); } plUoid() { Invalidate(); }
plUoid(const plLocation& location, UInt16 classType, const char* objectName, const plLoadMask& m=plLoadMask::kAlways); plUoid(const plLocation& location, UInt16 classType, const plString& objectName, const plLoadMask& m=plLoadMask::kAlways);
plUoid(plFixedKeyId fixedKey); plUoid(plFixedKeyId fixedKey);
plUoid(const plUoid& src); plUoid(const plUoid& src);
~plUoid(); ~plUoid();
const plLocation& GetLocation() const { return fLocation; } const plLocation& GetLocation() const { return fLocation; }
UInt16 GetClassType() const { return fClassType; } UInt16 GetClassType() const { return fClassType; }
const char* GetObjectName() const { return fObjectName; } const plString& GetObjectName() const { return fObjectName; }
const plLoadMask& GetLoadMask() const { return fLoadMask; } const plLoadMask& GetLoadMask() const { return fLoadMask; }
void Read(hsStream* s); void Read(hsStream* s);
@ -188,7 +188,7 @@ protected:
UInt32 fClonePlayerID; // The ID of the player who made this clone UInt32 fClonePlayerID; // The ID of the player who made this clone
UInt16 fCloneID; // The ID of this clone (unique per client) UInt16 fCloneID; // The ID of this clone (unique per client)
UInt16 fClassType; UInt16 fClassType;
char* fObjectName; plString fObjectName;
plLocation fLocation; plLocation fLocation;
plLoadMask fLoadMask; plLoadMask fLoadMask;
}; };

18
Sources/Plasma/NucleusLib/pnMessage/plMessage.cpp

@ -313,7 +313,7 @@ int plMsgStdStringHelper::PeekBig(std::string & stringref, hsStream* stream, co
return stream->GetPosition(); return stream->GetPosition();
} }
int plMsgStdStringHelper::Peek(plString & stringref, hsStream* stream, const UInt32 peekOptions) int plMsgStdStringHelper::Peek(plString & stringref, hsStream* stream, const UInt32 peekOptions)
{ {
std::string temp; std::string temp;
int pos = Peek(temp, stream, peekOptions); int pos = Peek(temp, stream, peekOptions);
@ -321,7 +321,7 @@ int plMsgStdStringHelper::Peek(plString & stringref, hsStream* stream, const UI
return pos; return pos;
} }
int plMsgStdStringHelper::PeekBig(plString & stringref, hsStream* stream, const UInt32 peekOptions) int plMsgStdStringHelper::PeekBig(plString & stringref, hsStream* stream, const UInt32 peekOptions)
{ {
std::string temp; std::string temp;
int pos = PeekBig(temp, stream, peekOptions); int pos = PeekBig(temp, stream, peekOptions);
@ -399,6 +399,20 @@ int plMsgCStringHelper::Peek(char *& str, hsStream* stream, const UInt32 peekOpt
return stream->GetPosition(); return stream->GetPosition();
} }
int plMsgCStringHelper::Poke(const plString & str, hsStream* stream, const UInt32 peekOptions)
{
return Poke(str.c_str(), stream, peekOptions);
}
int plMsgCStringHelper::Peek(plString & str, hsStream* stream, const UInt32 peekOptions)
{
char * temp = nil;
int pos = Peek(temp, stream, peekOptions);
str = plString::FromIso8859_1(temp);
delete [] temp;
return pos;
}
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////

5
Sources/Plasma/NucleusLib/pnMessage/plMessage.h

@ -190,13 +190,16 @@ struct plMsgXtlStringHelper
}; };
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// reads/writes your char * field // reads/writes your char * field (deprecated)
struct plMsgCStringHelper struct plMsgCStringHelper
{ {
static int Poke(const char * str, hsStream* stream, const UInt32 peekOptions=0); static int Poke(const char * str, hsStream* stream, const UInt32 peekOptions=0);
// deletes str and reallocates. you must delete [] str; // deletes str and reallocates. you must delete [] str;
static int Peek(char *& str, hsStream* stream, const UInt32 peekOptions=0); static int Peek(char *& str, hsStream* stream, const UInt32 peekOptions=0);
static int Poke(const plString & str, hsStream* stream, const UInt32 peekOptions=0);
static int Peek(plString & str, hsStream* stream, const UInt32 peekOptions=0);
}; };
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////

8
Sources/Plasma/PubUtilLib/plAgeLoader/plAgeLoaderPaging.cpp

@ -69,10 +69,10 @@ bool ReportRoomToServer(const plKey &key)
plLocation keyLoc=key->GetUoid().GetLocation(); plLocation keyLoc=key->GetUoid().GetLocation();
bool skip=(keyLoc.IsReserved() || keyLoc.IsVirtual() || bool skip=(keyLoc.IsReserved() || keyLoc.IsVirtual() ||
// HACK ALERT - replace with new uoid type flags // HACK ALERT - replace with new uoid type flags
(key->GetName() && (!key->GetName().IsNull() &&
(!strnicmp(key->GetName(), "global", 6) || (!key->GetName().CompareN("global", 6, plString::kCaseInsensitive) ||
strstr(key->GetName(), "_Male") || key->GetName().Find("_Male") >= 0 ||
strstr(key->GetName(), "_Female") key->GetName().Find("_Female") >= 0
) )
) )
); );

6
Sources/Plasma/PubUtilLib/plAudible/plWinAudible.cpp

@ -473,9 +473,7 @@ void plWinAudible::Read(hsStream* s, hsResMgr* mgr)
void plWinAudible::IAssignSoundKey( plSound *sound, const char *name, UInt32 i ) void plWinAudible::IAssignSoundKey( plSound *sound, const char *name, UInt32 i )
{ {
char keyName[ 256 ]; plString keyName = plString::Format( "%s_%d", name, i );
sprintf( keyName, "%s_%d", name, i );
hsgResMgr::ResMgr()->NewKey( keyName, sound, GetKey() ? GetKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc ); hsgResMgr::ResMgr()->NewKey( keyName, sound, GetKey() ? GetKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc );
} }
@ -607,7 +605,7 @@ int plWinAudible::GetSoundIndex(const char *keyname) const
for( int i = 0; i < fSoundObjs.Count(); i++) for( int i = 0; i < fSoundObjs.Count(); i++)
{ {
if(!fSoundObjs[i]) continue; if(!fSoundObjs[i]) continue;
if(!strcmp(fSoundObjs[i]->GetKeyName(), keyname )) if(!fSoundObjs[i]->GetKeyName().Compare( keyname ))
{ {
return i; return i;
} }

4
Sources/Plasma/PubUtilLib/plAudio/plAudioSystem.cpp

@ -934,7 +934,7 @@ hsBool plAudioSystem::MsgReceive(plMessage* msg)
{ {
//if( fListener ) //if( fListener )
{ {
plProfile_BeginLap(AudioUpdate, this->GetKey()->GetUoid().GetObjectName()); plProfile_BeginLap(AudioUpdate, this->GetKey()->GetUoid().GetObjectName().c_str());
if(hsTimer::GetMilliSeconds() - fLastUpdateTimeMs > UPDATE_TIME_MS) if(hsTimer::GetMilliSeconds() - fLastUpdateTimeMs > UPDATE_TIME_MS)
{ {
IUpdateSoftSounds( fCurrListenerPos ); IUpdateSoftSounds( fCurrListenerPos );
@ -947,7 +947,7 @@ hsBool plAudioSystem::MsgReceive(plMessage* msg)
} }
//fCommittedListenerPos = fCurrListenerPos; //fCommittedListenerPos = fCurrListenerPos;
} }
plProfile_EndLap(AudioUpdate, this->GetKey()->GetUoid().GetObjectName()); plProfile_EndLap(AudioUpdate, this->GetKey()->GetUoid().GetObjectName().c_str());
} }
return true; return true;

8
Sources/Plasma/PubUtilLib/plAudio/plSound.cpp

@ -141,10 +141,10 @@ void plSound::IPrintDbgMessage( const char *msg, hsBool isError )
if( isError ) if( isError )
// ourLog->AddLineF( plStatusLog::kRed, "ERROR: %s (%s)", msg, GetKey() ? GetKeyName() : "unkeyed" ); // ourLog->AddLineF( plStatusLog::kRed, "ERROR: %s (%s)", msg, GetKey() ? GetKeyName() : "unkeyed" );
ourLog->AddLineS( "audio.log", plStatusLog::kRed, "ERROR: %s (%s)", msg, GetKey() ? GetKeyName() : "unkeyed" ); ourLog->AddLineS( "audio.log", plStatusLog::kRed, "ERROR: %s (%s)", msg, GetKey() ? GetKeyName().c_str() : "unkeyed" );
else else
// ourLog->AddLineF( "%s (%s)", msg, GetKey() ? GetKeyName() : "unkeyed" ); // ourLog->AddLineF( "%s (%s)", msg, GetKey() ? GetKeyName() : "unkeyed" );
ourLog->AddLineS( "audio.log", "%s (%s)", msg, GetKey() ? GetKeyName() : "unkeyed" ); ourLog->AddLineS( "audio.log", "%s (%s)", msg, GetKey() ? GetKeyName().c_str() : "unkeyed" );
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -163,7 +163,7 @@ void plSound::IUpdateDebugPlate( void )
fDebugPlate->SetPosition( -0.5, 0 ); fDebugPlate->SetPosition( -0.5, 0 );
fDebugPlate->SetDataRange( 0, 100, 100 ); fDebugPlate->SetDataRange( 0, 100, 100 );
fDebugPlate->SetColors( 0x80202000 ); fDebugPlate->SetColors( 0x80202000 );
fDebugPlate->SetTitle( (char *)GetKeyName() ); // Bleah fDebugPlate->SetTitle( _TEMP_CONVERT_TO_CONST_CHAR( GetKeyName() ) ); // Bleah
fDebugPlate->SetLabelText( "Desired", "Curr", "Soft", "Dist" ); fDebugPlate->SetLabelText( "Desired", "Curr", "Soft", "Dist" );
} }
@ -190,7 +190,7 @@ void plSound::SetCurrDebugPlate( const plKey soundKey )
{ {
fDebugPlate->ClearData(); fDebugPlate->ClearData();
fDebugPlate->SetVisible( true ); fDebugPlate->SetVisible( true );
fDebugPlate->SetTitle( (char *)fCurrDebugPlateSound->GetKeyName() ); // Bleah fDebugPlate->SetTitle( _TEMP_CONVERT_TO_CONST_CHAR( fCurrDebugPlateSound->GetKeyName() ) ); // Bleah
} }
} }
} }

3
Sources/Plasma/PubUtilLib/plAudio/plVoiceChat.cpp

@ -410,8 +410,7 @@ plVoiceSound::plVoiceSound()
fEAXSettings.SetRoomParams(-1200, -100, 0, 0); fEAXSettings.SetRoomParams(-1200, -100, 0, 0);
fLastUpdate = 0; fLastUpdate = 0;
char keyName[32]; plString keyName = plString::Format("VoiceSound_%d", fCount);
snprintf(keyName, arrsize(keyName), "VoiceSound_%d", fCount);
fCount++; fCount++;
hsgResMgr::ResMgr()->NewKey(keyName, this, plLocation::kGlobalFixedLoc); hsgResMgr::ResMgr()->NewKey(keyName, this, plLocation::kGlobalFixedLoc);
} }

16
Sources/Plasma/PubUtilLib/plAudio/plWin32GroupedSound.cpp

@ -160,9 +160,8 @@ hsBool plWin32GroupedSound::LoadSound( hsBool is3D )
// We need it to be resident to read in // We need it to be resident to read in
if( retVal == plSoundBuffer::kError) if( retVal == plSoundBuffer::kError)
{ {
char str[ 256 ]; plString str = plString::Format("Unable to open .wav file %s", fDataBufferKey ? fDataBufferKey->GetName().c_str() : "nil");
sprintf( str, "Unable to open .wav file %s", fDataBufferKey ? fDataBufferKey->GetName() : "nil"); IPrintDbgMessage( str.c_str(), true );
IPrintDbgMessage( str, true );
fFailed = true; fFailed = true;
return false; return false;
} }
@ -229,9 +228,8 @@ hsBool plWin32GroupedSound::LoadSound( hsBool is3D )
IFillCurrentSound( 0 ); IFillCurrentSound( 0 );
// Logging // Logging
char str[ 256 ]; plString str = plString::Format(" Grouped %s %s allocated (%d msec).", buffer->GetFileName() != nil ? "file" : "buffer",
sprintf( str, " Grouped %s %s allocated (%d msec).", buffer->GetFileName() != nil ? "file" : "buffer", buffer->GetFileName() != nil ? buffer->GetFileName() : buffer->GetKey()->GetUoid().GetObjectName().c_str(),
buffer->GetFileName() != nil ? buffer->GetFileName() : buffer->GetKey()->GetUoid().GetObjectName(),
//fDSoundBuffer->IsHardwareAccelerated() ? "hardware" : "software", //fDSoundBuffer->IsHardwareAccelerated() ? "hardware" : "software",
//fDSoundBuffer->IsStaticVoice() ? "static" : "dynamic", //fDSoundBuffer->IsStaticVoice() ? "static" : "dynamic",
#ifdef PL_PROFILE_ENABLED #ifdef PL_PROFILE_ENABLED
@ -239,11 +237,11 @@ hsBool plWin32GroupedSound::LoadSound( hsBool is3D )
#else #else
0 ); 0 );
#endif #endif
IPrintDbgMessage( str ); IPrintDbgMessage( str.c_str() );
if( GetKey() != nil && GetKeyName() != nil && strstr( GetKeyName(), "Footstep" ) != nil ) if( GetKey() != nil && GetKeyName().Find( "Footstep" ) >= 0 )
; ;
else else
plStatusLog::AddLineS( "audioTimes.log", "%s (%s)", str, GetKey() ? GetKeyName() : "unkeyed" ); plStatusLog::AddLineS( "audioTimes.log", "%s (%s)", str, GetKey() ? GetKeyName().c_str() : "unkeyed" );
fTotalBytes = bufferSize; fTotalBytes = bufferSize;

2
Sources/Plasma/PubUtilLib/plAudio/plWin32Sound.cpp

@ -168,7 +168,7 @@ void plWin32Sound::IActuallyStop()
{ {
if( fDSoundBuffer != nil && fDSoundBuffer->IsPlaying() ) if( fDSoundBuffer != nil && fDSoundBuffer->IsPlaying() )
{ {
plStatusLog::AddLineS( "audio.log", 0xffff0000, "WARNING: BUFFER FLAGGED AS STOPPED BUT NOT STOPPED - %s", GetKey() ? GetKeyName() : nil ); plStatusLog::AddLineS( "audio.log", 0xffff0000, "WARNING: BUFFER FLAGGED AS STOPPED BUT NOT STOPPED - %s", GetKey() ? GetKeyName().c_str() : nil );
fDSoundBuffer->Stop(); fDSoundBuffer->Stop();
} }
} }

5
Sources/Plasma/PubUtilLib/plAudio/plWin32StaticSound.cpp

@ -115,9 +115,8 @@ hsBool plWin32StaticSound::LoadSound( hsBool is3D )
if( retVal == plSoundBuffer::kError ) if( retVal == plSoundBuffer::kError )
{ {
char str[ 256 ]; plString str = plString::Format( "Unable to open .wav file %s", fDataBufferKey ? fDataBufferKey->GetName().c_str() : "nil");
sprintf( str, "Unable to open .wav file %s", fDataBufferKey ? fDataBufferKey->GetName() : "nil"); IPrintDbgMessage( str.c_str(), true );
IPrintDbgMessage( str, true );
fFailed = true; fFailed = true;
return false; return false;
} }

4
Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp

@ -241,7 +241,7 @@ hsBool plAGMasterMod::IEval(double secs, hsScalar del, UInt32 dirty)
// APPLYANIMATIONS // APPLYANIMATIONS
void plAGMasterMod::ApplyAnimations(double time, hsScalar elapsed) void plAGMasterMod::ApplyAnimations(double time, hsScalar elapsed)
{ {
plProfile_BeginLap(ApplyAnimation, this->GetKey()->GetUoid().GetObjectName()); plProfile_BeginLap(ApplyAnimation, this->GetKey()->GetUoid().GetObjectName().c_str());
// update any fades // update any fades
for (int i = 0; i < fAnimInstances.size(); i++) for (int i = 0; i < fAnimInstances.size(); i++)
@ -251,7 +251,7 @@ void plAGMasterMod::ApplyAnimations(double time, hsScalar elapsed)
AdvanceAnimsToTime(time); AdvanceAnimsToTime(time);
plProfile_EndLap(ApplyAnimation,this->GetKey()->GetUoid().GetObjectName()); plProfile_EndLap(ApplyAnimation,this->GetKey()->GetUoid().GetObjectName().c_str());
} }
void plAGMasterMod::AdvanceAnimsToTime(double time) void plAGMasterMod::AdvanceAnimsToTime(double time)

4
Sources/Plasma/PubUtilLib/plAvatar/plAGMasterSDLModifier.cpp

@ -57,10 +57,10 @@ char plAGMasterSDLModifier::AGMasterVarNames::kStrBlends[]="blends";
UInt32 plAGMasterSDLModifier::IApplyModFlags(UInt32 sendFlags) UInt32 plAGMasterSDLModifier::IApplyModFlags(UInt32 sendFlags)
{ {
// ugly hack so bug light animation state isn't stored on the server // ugly hack so bug light animation state isn't stored on the server
if (stricmp(GetTarget()->GetKeyName(), "RTOmni-BugLightTest") == 0) if (GetTarget()->GetKeyName().Compare("RTOmni-BugLightTest", plString::kCaseInsensitive) == 0)
return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState); return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState);
// ditto for the KI light // ditto for the KI light
if (stricmp(GetTarget()->GetKeyName(), "RTOmniKILight") == 0) if (GetTarget()->GetKeyName().Compare("RTOmniKILight", plString::kCaseInsensitive) == 0)
return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState); return (sendFlags | plSynchedObject::kDontPersistOnServer | plSynchedObject::kIsAvatarState);
return sendFlags; return sendFlags;

23
Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp

@ -809,11 +809,8 @@ int plArmatureMod::IFindSpawnOverride( void )
plAvatarMgr *mgr = plAvatarMgr::GetInstance(); plAvatarMgr *mgr = plAvatarMgr::GetInstance();
for( i = 0; i < mgr->NumSpawnPoints(); i++ ) for( i = 0; i < mgr->NumSpawnPoints(); i++ )
{ {
char str2[ 256 ]; const plString &name = mgr->GetSpawnPoint( i )->GetTarget(0)->GetKeyName();
strcpy(str2, mgr->GetSpawnPoint( i )->GetTarget(0)->GetKeyName()); if (name.Find(fSpawnPointOverride, plString::kCaseInsensitive) >= 0)
strlwr(str2);
if (strstr(str2, fSpawnPointOverride) != nil)
return i; // Found it! return i; // Found it!
} }
return -1; return -1;
@ -1792,33 +1789,33 @@ void plArmatureMod::Read(hsStream * stream, hsResMgr *mgr)
if (gLoc.IsValid()) if (gLoc.IsValid())
{ {
const plUoid &myUoid = GetKey()->GetUoid(); const plUoid &myUoid = GetKey()->GetUoid();
plUoid SOUoid(gLoc, plSceneObject::Index(), "FootstepSoundObject"); plUoid SOUoid(gLoc, plSceneObject::Index(), _TEMP_CONVERT_FROM_LITERAL("FootstepSoundObject"));
fFootSoundSOKey = mgr->FindKey(SOUoid); fFootSoundSOKey = mgr->FindKey(SOUoid);
if (fFootSoundSOKey) if (fFootSoundSOKey)
{ {
// So it exists... but FindKey won't properly create our clone. So we do. // So it exists... but FindKey won't properly create our clone. So we do.
SOUoid.SetClone(myUoid.GetClonePlayerID(), myUoid.GetCloneID()); SOUoid.SetClone(myUoid.GetClonePlayerID(), myUoid.GetCloneID());
fFootSoundSOKey = mgr->ReRegister(nil, SOUoid); fFootSoundSOKey = mgr->ReRegister(plString::Null, SOUoid);
} }
// Add the effect to our effects manager // Add the effect to our effects manager
plUoid effectUoid(gLoc, plArmatureEffectFootSound::Index(), "FootstepSounds" ); plUoid effectUoid(gLoc, plArmatureEffectFootSound::Index(), _TEMP_CONVERT_FROM_LITERAL("FootstepSounds") );
plKey effectKey = mgr->FindKey(effectUoid); plKey effectKey = mgr->FindKey(effectUoid);
if (effectKey) if (effectKey)
{ {
effectUoid.SetClone(myUoid.GetClonePlayerID(), myUoid.GetCloneID()); effectUoid.SetClone(myUoid.GetClonePlayerID(), myUoid.GetCloneID());
effectKey = mgr->ReRegister(nil, effectUoid); effectKey = mgr->ReRegister(plString::Null, effectUoid);
} }
if (effectKey != nil) if (effectKey != nil)
mgr->AddViaNotify(effectKey, TRACKED_NEW plGenRefMsg(effectMgrKey, plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef); mgr->AddViaNotify(effectKey, TRACKED_NEW plGenRefMsg(effectMgrKey, plRefMsg::kOnCreate, -1, -1), plRefFlags::kActiveRef);
// Get the linking sound // Get the linking sound
plUoid LinkUoid(gLoc, plSceneObject::Index(), "LinkSoundSource"); plUoid LinkUoid(gLoc, plSceneObject::Index(), _TEMP_CONVERT_FROM_LITERAL("LinkSoundSource"));
fLinkSoundSOKey = mgr->FindKey(LinkUoid); fLinkSoundSOKey = mgr->FindKey(LinkUoid);
if (fLinkSoundSOKey) if (fLinkSoundSOKey)
{ {
LinkUoid.SetClone(myUoid.GetClonePlayerID(), myUoid.GetCloneID()); LinkUoid.SetClone(myUoid.GetClonePlayerID(), myUoid.GetCloneID());
fLinkSoundSOKey = mgr->ReRegister(nil, LinkUoid); fLinkSoundSOKey = mgr->ReRegister(plString::Null, LinkUoid);
} }
} }
} }
@ -2060,7 +2057,7 @@ hsBool plArmatureMod::ValidateMesh()
hsgResMgr::ResMgr()->SendRef(meshObj->GetKey(), refMsg, plRefFlags::kPassiveRef); hsgResMgr::ResMgr()->SendRef(meshObj->GetKey(), refMsg, plRefFlags::kPassiveRef);
} }
} }
if (!strcmp(GetTarget(0)->GetKeyName(), "Yeesha")) if (!GetTarget(0)->GetKeyName().Compare("Yeesha"))
ISetTransparentDrawOrder(true); ISetTransparentDrawOrder(true);
else else
ISetTransparentDrawOrder(false); ISetTransparentDrawOrder(false);
@ -2704,7 +2701,7 @@ void plArmatureMod::DumpToDebugDisplay(int &x, int &y, int lineHeight, char *str
plKey world = nil; plKey world = nil;
if (fController) if (fController)
world = fController->GetSubworld(); world = fController->GetSubworld();
sprintf(strBuf, "In world: %s Frozen: %s", world ? world->GetName() : "nil", frozen); sprintf(strBuf, "In world: %s Frozen: %s", world ? world->GetName().c_str() : "nil", frozen);
debugTxt.DrawString(x,y, strBuf); debugTxt.DrawString(x,y, strBuf);
y+= lineHeight; y+= lineHeight;

7
Sources/Plasma/PubUtilLib/plAvatar/plAvatarClothing.cpp

@ -276,13 +276,12 @@ void plClothingItem::Write(hsStream *s, hsResMgr *mgr)
plKey accessoryKey = nil; plKey accessoryKey = nil;
if (fAccessoryName) if (fAccessoryName)
{ {
char strBuf[512]; plString strBuf = plString::Format("CItm_%s", fAccessoryName);
sprintf(strBuf, "CItm_%s", fAccessoryName);
accessoryKey = plKeyFinder::Instance().StupidSearch("GlobalClothing", nil, plClothingItem::Index(), strBuf); accessoryKey = plKeyFinder::Instance().StupidSearch("GlobalClothing", nil, plClothingItem::Index(), strBuf);
if (accessoryKey == nil) if (accessoryKey == nil)
{ {
sprintf(strBuf, "Couldn't find accessory \"%s\". It won't show at runtime.", fAccessoryName); strBuf = plString::Format("Couldn't find accessory \"%s\". It won't show at runtime.", fAccessoryName);
hsMessageBox(strBuf, GetKeyName(), hsMessageBoxNormal); hsMessageBox(strBuf.c_str(), GetKeyName().c_str(), hsMessageBoxNormal);
} }
} }
mgr->WriteKey(s, accessoryKey); mgr->WriteKey(s, accessoryKey);

40
Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp

@ -134,10 +134,6 @@ void plAvatarMgr::IReset()
{ {
fSeekPoints.clear(); fSeekPoints.clear();
// Oneshots have copies of strings in their maps. I'm assuming the others should be the same, but until
// I hear otherwise...
for( plOneShotMap::iterator it = fOneShots.begin(); it != fOneShots.end(); it++ )
delete [] (char *)it->first;
fOneShots.clear(); fOneShots.clear();
fAvatars.clear(); fAvatars.clear();
fSpawnPoints.clear(); fSpawnPoints.clear();
@ -203,9 +199,9 @@ plKey plAvatarMgr::LoadAvatar(const char *name, const char *accountName, bool is
const plLocation& loc = (globalLoc.IsValid() ? globalLoc : custLoc.IsValid() ? custLoc : maleLoc); const plLocation& loc = (globalLoc.IsValid() ? globalLoc : custLoc.IsValid() ? custLoc : maleLoc);
#endif #endif
const char* theName = name; plString theName = _TEMP_CONVERT_FROM_LITERAL(name);
if ( loc == maleLoc ) if ( loc == maleLoc )
theName = "Male"; theName = _TEMP_CONVERT_FROM_LITERAL("Male");
if (loc.IsValid()) if (loc.IsValid())
{ {
@ -561,15 +557,14 @@ void plAvatarMgr::AddSeekPoint(plSeekPointMod *seekPoint)
{ {
if(seekPoint) if(seekPoint)
{ {
const char *name = seekPoint->GetTarget(0)->GetKey()->GetName(); plString name = seekPoint->GetTarget(0)->GetKey()->GetName();
char *ourName = hsStrcpy(name);
plSeekPointMod *alreadyThere = FindSeekPoint(name); plSeekPointMod *alreadyThere = FindSeekPoint(name);
/// hsAssert( ! alreadyThere, "Tried to add a seek point with duplicate name. Ignoring second seek point."); /// hsAssert( ! alreadyThere, "Tried to add a seek point with duplicate name. Ignoring second seek point.");
if ( ! alreadyThere) if ( ! alreadyThere)
{ {
fSeekPoints[ourName] = seekPoint; fSeekPoints[name] = seekPoint;
} }
} }
} }
@ -579,21 +574,19 @@ void plAvatarMgr::RemoveSeekPoint(plSeekPointMod *seekPoint)
{ {
if(seekPoint) if(seekPoint)
{ {
const char *name = seekPoint->GetTarget(0)->GetKey()->GetName(); plString name = seekPoint->GetTarget(0)->GetKey()->GetName();
plSeekPointMap::iterator found = fSeekPoints.find(name); plSeekPointMap::iterator found = fSeekPoints.find(name);
if(found != fSeekPoints.end()) if(found != fSeekPoints.end())
{ {
const char *oldName = (*found).first;
fSeekPoints.erase(found); fSeekPoints.erase(found);
delete[] const_cast<char *>(oldName); // retarded language, this is...
} }
} }
} }
// FINDSEEKPOINT // FINDSEEKPOINT
plSeekPointMod * plAvatarMgr::FindSeekPoint(const char *name) plSeekPointMod * plAvatarMgr::FindSeekPoint(const plString &name)
{ {
plSeekPointMap::iterator found = fSeekPoints.find(name); plSeekPointMap::iterator found = fSeekPoints.find(name);
@ -610,8 +603,7 @@ void plAvatarMgr::AddOneShot(plOneShotMod *oneshot)
{ {
if(oneshot) if(oneshot)
{ {
// allocate a copy of the target name to use as a key plString name = oneshot->GetTarget(0)->GetKey()->GetName();
char * name = hsStrcpy(oneshot->GetTarget(0)->GetKey()->GetName());
plOneShotMod *alreadyThere = FindOneShot(name); plOneShotMod *alreadyThere = FindOneShot(name);
@ -619,8 +611,6 @@ void plAvatarMgr::AddOneShot(plOneShotMod *oneshot)
{ {
fOneShots[name] = oneshot; fOneShots[name] = oneshot;
} }
else
delete [] name;
} }
} }
@ -631,14 +621,12 @@ void plAvatarMgr::RemoveOneShot(plOneShotMod *oneshot)
while (i != fOneShots.end()) while (i != fOneShots.end())
{ {
char * name = (*i).first; plString name = (*i).first;
plOneShotMod *thisOneshot = (*i).second; plOneShotMod *thisOneshot = (*i).second;
if(oneshot == thisOneshot) if(oneshot == thisOneshot)
{ {
i = fOneShots.erase(i); i = fOneShots.erase(i);
// destroy our copy of the target name
delete[] name;
} else { } else {
i++; i++;
} }
@ -646,7 +634,7 @@ void plAvatarMgr::RemoveOneShot(plOneShotMod *oneshot)
} }
// FINDONESHOT // FINDONESHOT
plOneShotMod *plAvatarMgr::FindOneShot(char *name) plOneShotMod *plAvatarMgr::FindOneShot(const plString &name)
{ {
plOneShotMap::iterator found = fOneShots.find(name); plOneShotMap::iterator found = fOneShots.find(name);
@ -756,7 +744,7 @@ plArmatureMod *plAvatarMgr::FindAvatarByModelName(char *name)
for (it = fAvatars.begin(); it != fAvatars.end(); ++it) for (it = fAvatars.begin(); it != fAvatars.end(); ++it)
{ {
plArmatureMod* armature = plArmatureMod::ConvertNoRef((*it)->ObjectIsLoaded()); plArmatureMod* armature = plArmatureMod::ConvertNoRef((*it)->ObjectIsLoaded());
if (armature && (!strcmp(armature->GetTarget(0)->GetKeyName(), name))) if (armature && (!armature->GetTarget(0)->GetKeyName().Compare(name)))
return armature; return armature;
} }
@ -769,7 +757,7 @@ void plAvatarMgr::FindAllAvatarsByModelName(const char* name, plArmatureModPtrVe
for (it = fAvatars.begin(); it != fAvatars.end(); ++it) for (it = fAvatars.begin(); it != fAvatars.end(); ++it)
{ {
plArmatureMod* armature = plArmatureMod::ConvertNoRef((*it)->ObjectIsLoaded()); plArmatureMod* armature = plArmatureMod::ConvertNoRef((*it)->ObjectIsLoaded());
if (armature && (!strcmp(armature->GetTarget(0)->GetKeyName(), name))) if (armature && (!armature->GetTarget(0)->GetKeyName().Compare(name)))
outVec.push_back(armature); outVec.push_back(armature);
} }
} }
@ -807,8 +795,8 @@ int plAvatarMgr::FindSpawnPoint( const char *name ) const
for( i = 0; i < fSpawnPoints.size(); i++ ) for( i = 0; i < fSpawnPoints.size(); i++ )
{ {
if( fSpawnPoints[ i ] != nil && if( fSpawnPoints[ i ] != nil &&
(strstr( fSpawnPoints[ i ]->GetKey()->GetUoid().GetObjectName(), name ) != nil || ( fSpawnPoints[ i ]->GetKey()->GetUoid().GetObjectName().Find( name ) >= 0 ||
strstr( fSpawnPoints[i]->GetTarget(0)->GetKeyName(), name) != nil)) fSpawnPoints[ i ]->GetTarget(0)->GetKeyName().Find( name ) >= 0 ))
return i; return i;
} }

8
Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.h

@ -101,7 +101,7 @@ public:
do away with this bookeeping entirely. */ do away with this bookeeping entirely. */
void AddSeekPoint(plSeekPointMod *seekpoint); void AddSeekPoint(plSeekPointMod *seekpoint);
void RemoveSeekPoint(plSeekPointMod *seekpoint); void RemoveSeekPoint(plSeekPointMod *seekpoint);
plSeekPointMod *FindSeekPoint(const char *name); plSeekPointMod *FindSeekPoint(const plString &name);
// \} // \}
// \{ // \{
@ -109,7 +109,7 @@ public:
scripting only. */ scripting only. */
void AddOneShot(plOneShotMod *oneshot); void AddOneShot(plOneShotMod *oneshot);
void RemoveOneShot(plOneShotMod *oneshot); void RemoveOneShot(plOneShotMod *oneshot);
plOneShotMod *FindOneShot(char *name); plOneShotMod *FindOneShot(const plString &name);
// \} // \}
plKey LoadPlayer(const char* name, const char *account); plKey LoadPlayer(const char* name, const char *account);
@ -200,10 +200,10 @@ protected:
static plAvatarMgr* fInstance; // the single instance of the avatar manager static plAvatarMgr* fInstance; // the single instance of the avatar manager
typedef std::map<const char *, plSeekPointMod *, stringISorter> plSeekPointMap; typedef std::map<plString, plSeekPointMod *, plString::less_i> plSeekPointMap;
plSeekPointMap fSeekPoints; plSeekPointMap fSeekPoints;
typedef std::map<char *, plOneShotMod *, stringISorter> plOneShotMap; typedef std::map<plString, plOneShotMod *, plString::less_i> plOneShotMap;
plOneShotMap fOneShots; plOneShotMap fOneShots;
typedef std::map<plKey, plMessage *> DeferredInits; typedef std::map<plKey, plMessage *> DeferredInits;

10
Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.cpp

@ -111,22 +111,14 @@ plCoopCoordinator::plCoopCoordinator(plKey host, plKey guest,
fGuestAccepted(false), fGuestAccepted(false),
fGuestLinked(false) fGuestLinked(false)
{ {
const char * hostName = host->GetName();
const char * guestName = guest->GetName();
static int serial = 0; static int serial = 0;
int len = strlen(hostName) + strlen(guestName) + 3 /* serial num */ + 1;
char *newName = TRACKED_NEW char[len];
serial = serial % 999; serial = serial % 999;
sprintf(newName, "%s%s%3i\x000", hostName, guestName, serial++); plString newName = plString::Format("%s%s%3i\x000", host->GetName().c_str(), guest->GetName().c_str(), serial++);
plKey newKey = hsgResMgr::ResMgr()->NewKey(newName, this, host->GetUoid().GetLocation()); plKey newKey = hsgResMgr::ResMgr()->NewKey(newName, this, host->GetUoid().GetLocation());
delete[] newName;
fSynchBone = hsStrcpy(synchBone); fSynchBone = hsStrcpy(synchBone);
plKey avMgrKey = plAvatarMgr::GetInstance()->GetKey(); plKey avMgrKey = plAvatarMgr::GetInstance()->GetKey();

3
Sources/Plasma/PubUtilLib/plDrawable/plDrawableGenerator.cpp

@ -259,8 +259,7 @@ plDrawableSpans *plDrawableGenerator::GenerateDrawable( UInt32 vertCount, hsPoin
} }
static int nameIdx = 0; static int nameIdx = 0;
char buff[256]; plString buff = plString::Format( "GenDrawable_%d", nameIdx++ );
sprintf(buff, "%s_%d", "GenDrawable", nameIdx++);
hsgResMgr::ResMgr()->NewKey( buff, newDraw, plLocation::kGlobalFixedLoc ); hsgResMgr::ResMgr()->NewKey( buff, newDraw, plLocation::kGlobalFixedLoc );
} }

4
Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpans.cpp

@ -1320,7 +1320,7 @@ hsBool plDrawableSpans::MsgReceive( plMessage* msg )
} }
else if( plRenderMsg::ConvertNoRef( msg ) ) else if( plRenderMsg::ConvertNoRef( msg ) )
{ {
plProfile_BeginLap(PalletteHack, this->GetKey()->GetUoid().GetObjectName()); plProfile_BeginLap(PalletteHack, this->GetKey()->GetUoid().GetObjectName().c_str());
IUpdateMatrixPaletteBoundsHack(); IUpdateMatrixPaletteBoundsHack();
@ -1331,7 +1331,7 @@ hsBool plDrawableSpans::MsgReceive( plMessage* msg )
// The pipeline will then clear out those bits as it blends them, and then we simply // The pipeline will then clear out those bits as it blends them, and then we simply
// re-set them here, since plRenderMsg is sent once before all the rendering is done :) // re-set them here, since plRenderMsg is sent once before all the rendering is done :)
fFakeBlendingSpanVector = fBlendingSpanVector; fFakeBlendingSpanVector = fBlendingSpanVector;
plProfile_EndLap(PalletteHack, this->GetKey()->GetUoid().GetObjectName()); plProfile_EndLap(PalletteHack, this->GetKey()->GetUoid().GetObjectName().c_str());
return true; return true;
} }

16
Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp

@ -387,7 +387,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
statusLog->AddLineF("From obj <%s> mat <%s> size %d bytes grp=%d (%d offset)", statusLog->AddLineF("From obj <%s> mat <%s> size %d bytes grp=%d (%d offset)",
geo->fMaxOwner ? geo->fMaxOwner : "<unknown>", geo->fMaxOwner ? geo->fMaxOwner : "<unknown>",
geo->fMaterial ? geo->fMaterial->GetKey()->GetName() : "<unknown>", geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(UInt16) * geo->fNumIndices, geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(UInt16) * geo->fNumIndices,
span->fGroupIdx, span->fGroupIdx,
ptr ptr
@ -405,7 +405,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
{ {
statusLog->AddLineF("Instanced obj <%s> mat <%s> grp=%d (%d/%d/%d/%d/%d/%d/%d/%d)", statusLog->AddLineF("Instanced obj <%s> mat <%s> grp=%d (%d/%d/%d/%d/%d/%d/%d/%d)",
geo->fMaxOwner ? geo->fMaxOwner : "<unknown>", geo->fMaxOwner ? geo->fMaxOwner : "<unknown>",
geo->fMaterial ? geo->fMaterial->GetKey()->GetName() : "<unknown>", geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
span->fGroupIdx, span->fGroupIdx,
span->fVBufferIdx, span->fVBufferIdx,
span->fCellIdx, span->fCellIdx,
@ -424,7 +424,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
{ {
statusLog->AddLineF("From obj <%s> mat <%s> size %d bytes grp=%d (%d/%d/%d/%d/%d)", statusLog->AddLineF("From obj <%s> mat <%s> size %d bytes grp=%d (%d/%d/%d/%d/%d)",
geo->fMaxOwner ? geo->fMaxOwner : "<unknown>", geo->fMaxOwner ? geo->fMaxOwner : "<unknown>",
geo->fMaterial ? geo->fMaterial->GetKey()->GetName() : "<unknown>", geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(UInt16) * geo->fNumIndices, geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(UInt16) * geo->fNumIndices,
span->fGroupIdx, span->fGroupIdx,
span->fVBufferIdx, span->fVBufferIdx,
@ -438,7 +438,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
{ {
statusLog->AddLineF("Instanced obj <%s> mat <%s> grp=%d (%d/%d/%d/%d/%d)", statusLog->AddLineF("Instanced obj <%s> mat <%s> grp=%d (%d/%d/%d/%d/%d)",
geo->fMaxOwner ? geo->fMaxOwner : "<unknown>", geo->fMaxOwner ? geo->fMaxOwner : "<unknown>",
geo->fMaterial ? geo->fMaterial->GetKey()->GetName() : "<unknown>", geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
span->fGroupIdx, span->fGroupIdx,
span->fVBufferIdx, span->fVBufferIdx,
span->fCellIdx, span->fCellIdx,
@ -755,18 +755,18 @@ short plDrawableSpans::ICompareSpans( plGeometrySpan *span1, plGeometrySpan *s
else if( t1 == nil && t2 == nil ) else if( t1 == nil && t2 == nil )
break; // Textures equal up to here--keep going with rest of tests break; // Textures equal up to here--keep going with rest of tests
if( t1->GetKeyName() != nil && t2->GetKeyName() != nil ) if( !t1->GetKeyName().IsNull() && !t2->GetKeyName().IsNull() )
{ {
j = stricmp( t1->GetKeyName(), t2->GetKeyName() ); j = t1->GetKeyName().Compare( t2->GetKeyName(), plString::kCaseInsensitive );
if( j != 0 ) if( j != 0 )
return (short)j; return (short)j;
} }
} }
// Finally, by material itself. // Finally, by material itself.
if( span1->fMaterial->GetKeyName() != nil && span2->fMaterial->GetKeyName() != nil ) if( !span1->fMaterial->GetKeyName().IsNull() && !span2->fMaterial->GetKeyName().IsNull() )
{ {
j = stricmp( span1->fMaterial->GetKeyName(), span2->fMaterial->GetKeyName() ); j = span1->fMaterial->GetKeyName().Compare( span2->fMaterial->GetKeyName(), plString::kCaseInsensitive );
if( j != 0 ) if( j != 0 )
return (short)j; return (short)j;
} }

9
Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp

@ -1578,21 +1578,20 @@ hsGMaterial* plDynaDecalMgr::IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap
oldMip->SetCurrLevel(0); oldMip->SetCurrLevel(0);
hsGMaterial* newMat = TRACKED_NEW hsGMaterial; hsGMaterial* newMat = TRACKED_NEW hsGMaterial;
char buff[256]; plString buff = plString::Format("%s_EnvMat", GetKey()->GetName().c_str());
sprintf(buff, "%s_%s", GetKey()->GetName(), "EnvMat");
hsgResMgr::ResMgr()->NewKey(buff, newMat, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, newMat, GetKey()->GetUoid().GetLocation());
static plTweak<hsScalar> kSmooth(1.f); static plTweak<hsScalar> kSmooth(1.f);
plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, plBumpMapGen::kBubbleTest, kSmooth); plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, plBumpMapGen::kBubbleTest, kSmooth);
// plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, plBumpMapGen::kNormalize, kSmooth); // plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, plBumpMapGen::kNormalize, kSmooth);
// plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, 0, 0); // plMipmap* bumpMap = plBumpMapGen::QikNormalMap(nil, oldMip, 0xffffffff, 0, 0);
sprintf(buff, "%s_%s", GetKey()->GetName(), "BumpMap"); buff = plString::Format("%s_BumpMap", GetKey()->GetName().c_str());
hsgResMgr::ResMgr()->NewKey(buff, bumpMap, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, bumpMap, GetKey()->GetUoid().GetLocation());
bumpMap->SetFlags(bumpMap->GetFlags() | plMipmap::kBumpEnvMap | plMipmap::kForceNonCompressed); bumpMap->SetFlags(bumpMap->GetFlags() | plMipmap::kBumpEnvMap | plMipmap::kForceNonCompressed);
plLayer* bumpLay = TRACKED_NEW plLayer; plLayer* bumpLay = TRACKED_NEW plLayer;
sprintf(buff, "%s_%s_%d", GetKey()->GetName(), "BumpMap", 0); buff = plString::Format("%s_BumpMap_0", GetKey()->GetName().c_str());
hsgResMgr::ResMgr()->NewKey(buff, bumpLay, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, bumpLay, GetKey()->GetUoid().GetLocation());
bumpLay->SetState(oldLay->GetState()); bumpLay->SetState(oldLay->GetState());
@ -1614,7 +1613,7 @@ hsGMaterial* plDynaDecalMgr::IConvertToEnvMap(hsGMaterial* mat, plBitmap* envMap
newMat->AddLayerViaNotify(bumpLay); newMat->AddLayerViaNotify(bumpLay);
plLayer* envLay = TRACKED_NEW plLayer; plLayer* envLay = TRACKED_NEW plLayer;
sprintf(buff, "%s_%s_%d", GetKey()->GetName(), "EnvMap", 0); buff = plString::Format("%s_EnvMap_0", GetKey()->GetName().c_str());
hsgResMgr::ResMgr()->NewKey(buff, envLay, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, envLay, GetKey()->GetUoid().GetLocation());
envLay->SetBlendFlags(hsGMatState::kBlendMult); envLay->SetBlendFlags(hsGMatState::kBlendMult);

22
Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp

@ -80,16 +80,16 @@ void plProxyGen::Init(const hsKeyedObject* owner)
{ {
if( !GetKey() ) if( !GetKey() )
{ {
char buff[256]; plString buff;
plLocation loc; plLocation loc;
if( owner->GetKey() ) if( owner->GetKey() )
{ {
sprintf(buff, "%s_%s_%d_%d", owner->GetKey()->GetName(), "ProxyGen", owner->GetKey()->GetUoid().GetClonePlayerID(), fProxyKeyCounter++); buff = plString::Format("%s_ProxyGen_%d_%d", owner->GetKey()->GetName().c_str(), owner->GetKey()->GetUoid().GetClonePlayerID(), fProxyKeyCounter++);
loc = owner->GetKey()->GetUoid().GetLocation(); loc = owner->GetKey()->GetUoid().GetLocation();
} }
else else
{ {
sprintf( buff, "ProxyGen%d", fProxyKeyCounter++ ); buff = plString::Format( "ProxyGen%d", fProxyKeyCounter++ );
loc = plLocation::kGlobalFixedLoc; loc = plLocation::kGlobalFixedLoc;
} }
@ -157,11 +157,11 @@ hsGMaterial* plProxyGen::IMakeProxyMaterial() const
hsGMaterial* retVal = TRACKED_NEW hsGMaterial(); hsGMaterial* retVal = TRACKED_NEW hsGMaterial();
char buff[256]; plString buff;
if( GetKey()->GetName() ) if( !GetKey()->GetName().IsNull() )
sprintf(buff, "%s_%s", GetKey()->GetName(), "Material"); buff = plString::Format("%s_Material", GetKey()->GetName().c_str());
else else
strcpy(buff, "ProxyMaterial"); buff = _TEMP_CONVERT_FROM_LITERAL("ProxyMaterial");
hsgResMgr::ResMgr()->NewKey( buff, retVal, GetKey() ? GetKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc ); hsgResMgr::ResMgr()->NewKey( buff, retVal, GetKey() ? GetKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc );
plLayer *lay = retVal->MakeBaseLayer(); plLayer *lay = retVal->MakeBaseLayer();
@ -232,11 +232,11 @@ void plProxyGen::IGenerateProxy()
if( fProxyDrawables[idx] && !fProxyDrawables[idx]->GetKey() ) if( fProxyDrawables[idx] && !fProxyDrawables[idx]->GetKey() )
{ {
char buff[256]; plString buff;
if( GetKey()->GetName() ) if( !GetKey()->GetName().IsNull() )
sprintf(buff, "%s_%s", GetKey()->GetName(), "ProxyDrawable"); buff = plString::Format("%s_ProxyDrawable", GetKey()->GetName().c_str());
else else
strcpy(buff, "ProxyDrawable"); buff = _TEMP_CONVERT_FROM_LITERAL("ProxyDrawable");
hsgResMgr::ResMgr()->NewKey( buff, fProxyDrawables[ idx ], GetKey() ? GetKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc ); hsgResMgr::ResMgr()->NewKey( buff, fProxyDrawables[ idx ], GetKey() ? GetKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc );
} }

85
Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp

@ -1617,8 +1617,7 @@ plMipmap* plWaveSet7::ICreateBiasNoiseMap()
plMipmap::kUncompressed, plMipmap::kUncompressed,
plMipmap::UncompressedInfo::kRGB8888); plMipmap::UncompressedInfo::kRGB8888);
char buff[256]; plString buff = plString::Format("%s_BiasBitPS", GetKey()->GetName().c_str());
sprintf(buff, "%s_%s", GetKey()->GetName(), "BiasBitPS");
hsgResMgr::ResMgr()->NewKey(buff, mipMap, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, mipMap, GetKey()->GetUoid().GetLocation());
int i; int i;
@ -1663,8 +1662,7 @@ plMipmap* plWaveSet7::ICreateBumpMipmapPS()
plMipmap::kUncompressed, plMipmap::kUncompressed,
plMipmap::UncompressedInfo::kRGB8888); plMipmap::UncompressedInfo::kRGB8888);
char buff[256]; plString buff = plString::Format("%s_BumpBitPS", GetKey()->GetName().c_str());
sprintf(buff, "%s_%s", GetKey()->GetName(), "BumpBitPS");
hsgResMgr::ResMgr()->NewKey(buff, mipMap, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, mipMap, GetKey()->GetUoid().GetLocation());
hsgResMgr::ResMgr()->SendRef(mipMap->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefCosineLUT), plRefFlags::kActiveRef); hsgResMgr::ResMgr()->SendRef(mipMap->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, kRefCosineLUT), plRefFlags::kActiveRef);
@ -1716,8 +1714,7 @@ void plWaveSet7::IAddBumpBiasLayer(hsGMaterial* mat)
for( i = 0; i < 2; i++ ) for( i = 0; i < 2; i++ )
{ {
plLayer* layer = TRACKED_NEW plLayer; plLayer* layer = TRACKED_NEW plLayer;
char buff[256]; plString buff = plString::Format("%s_Bias_%d", GetKey()->GetName().c_str(), i);
sprintf(buff, "%s_%s_%d", GetKey()->GetName(), "Bias", i);
hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation());
layer->SetBlendFlags(hsGMatState::kBlendAdd); layer->SetBlendFlags(hsGMatState::kBlendAdd);
@ -1752,8 +1749,7 @@ void plWaveSet7::IAddBumpBiasLayer(hsGMaterial* mat)
plLayer* plWaveSet7::ICreateBumpLayerPS(plMipmap* mipMap, hsGMaterial* bumpMat, int which) plLayer* plWaveSet7::ICreateBumpLayerPS(plMipmap* mipMap, hsGMaterial* bumpMat, int which)
{ {
plLayer* layer = TRACKED_NEW plLayer; plLayer* layer = TRACKED_NEW plLayer;
char buff[256]; plString buff = plString::Format("%s_BumpLayerPS_%d", GetKey()->GetName().c_str(), which);
sprintf(buff, "%s_%s_%d", GetKey()->GetName(), "BumpLayerPS", which);
hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation());
layer->SetBlendFlags(which ? hsGMatState::kBlendAdd : 0); layer->SetBlendFlags(which ? hsGMatState::kBlendAdd : 0);
@ -1810,8 +1806,7 @@ hsGMaterial* plWaveSet7::ICreateBumpLayersPS()
// Create a blank material // Create a blank material
hsGMaterial* bumpMat = TRACKED_NEW hsGMaterial; hsGMaterial* bumpMat = TRACKED_NEW hsGMaterial;
char buff[256]; plString buff = plString::Format("%s_BumpMatPS", GetKey()->GetName());
sprintf(buff, "%s_%s", GetKey()->GetName(), "BumpMatPS");
hsgResMgr::ResMgr()->NewKey(buff, bumpMat, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, bumpMat, GetKey()->GetUoid().GetLocation());
plMipmap* mipMap = ICreateBumpMipmapPS(); plMipmap* mipMap = ICreateBumpMipmapPS();
@ -1852,8 +1847,7 @@ void plWaveSet7::IAddBumpBiasShaders(plLayer* layer)
{ {
plShader* vShader = TRACKED_NEW plShader; plShader* vShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_BiasVS", GetKey()->GetName().c_str());
sprintf(buff, "%s_BiasVS", GetKey()->GetName());
hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation());
vShader->SetIsPixelShader(false); vShader->SetIsPixelShader(false);
@ -1916,8 +1910,7 @@ void plWaveSet7::IAddBumpBiasShaders(plLayer* layer)
{ {
plShader* pShader = TRACKED_NEW plShader; plShader* pShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_BiasPS", GetKey()->GetName().c_str());
sprintf(buff, "%s_BiasPS", GetKey()->GetName());
hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation());
pShader->SetIsPixelShader(true); pShader->SetIsPixelShader(true);
@ -1950,8 +1943,7 @@ void plWaveSet7::IAddBumpVertexShader(hsGMaterial* mat, int iShader, int iFirst,
int iShader = iBase / kBumpPerPass; int iShader = iBase / kBumpPerPass;
plShader* vShader = TRACKED_NEW plShader; plShader* vShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_BumpVS_%d", GetKey()->GetName().c_str(), iShader);
sprintf(buff, "%s_BumpVS_%d", GetKey()->GetName(), iShader);
hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation());
vShader->SetIsPixelShader(false); vShader->SetIsPixelShader(false);
@ -1996,8 +1988,7 @@ void plWaveSet7::IAddBumpPixelShader(hsGMaterial* mat, int iShader, int iFirst,
int iShader = iBase / kBumpPerPass; int iShader = iBase / kBumpPerPass;
plShader* pShader = TRACKED_NEW plShader; plShader* pShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_BumpPS_%d", GetKey()->GetName().c_str(), iShader);
sprintf(buff, "%s_BumpPS_%d", GetKey()->GetName(), iShader);
hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation());
pShader->SetIsPixelShader(true); pShader->SetIsPixelShader(true);
@ -2039,8 +2030,7 @@ void plWaveSet7::IAddBumpPixelShader(hsGMaterial* mat, int iShader, int iFirst,
plDrawableSpans* plWaveSet7::ICreateBumpDrawable() plDrawableSpans* plWaveSet7::ICreateBumpDrawable()
{ {
fBumpDraw = TRACKED_NEW plDrawableSpans; fBumpDraw = TRACKED_NEW plDrawableSpans;
char buff[256]; plString buff = plString::Format("%s_BumpDraw", GetKey()->GetName().c_str());
sprintf(buff, "%s_BumpDraw", GetKey()->GetName());
hsgResMgr::ResMgr()->NewKey(buff, fBumpDraw, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, fBumpDraw, GetKey()->GetUoid().GetLocation());
ICreateClearDrawable(fBumpDraw, fBumpMat); ICreateClearDrawable(fBumpDraw, fBumpMat);
@ -2155,8 +2145,7 @@ plRenderTarget* plWaveSet7::ICreateTransferRenderTarget(const char* name, int si
plRenderTarget* rt = TRACKED_NEW plRenderTarget(flags, size, size, bitDepth, zDepth, stencilDepth); plRenderTarget* rt = TRACKED_NEW plRenderTarget(flags, size, size, bitDepth, zDepth, stencilDepth);
char buff[256]; plString buff = plString::Format("%s_%s", GetKey()->GetName().c_str(), name);
sprintf(buff, "%s_%s", GetKey()->GetName(), name);
hsgResMgr::ResMgr()->NewKey(buff, rt, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, rt, GetKey()->GetUoid().GetLocation());
return rt; return rt;
@ -2168,8 +2157,7 @@ plLayer* plWaveSet7::ICreateTotalLayer(plBitmap* bm, hsGMaterial* mat, int which
if( !layer ) if( !layer )
{ {
layer = TRACKED_NEW plLayer; layer = TRACKED_NEW plLayer;
char buff[256]; plString buff = plString::Format("%s_%sLayerPS_%d", GetKey()->GetName().c_str(), suff, which);
sprintf(buff, "%s_%sLayerPS_%d", GetKey()->GetName(), suff, which);
hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation());
layer->SetAmbientColor(hsColorRGBA().Set(0.f, 0.f, 0.f, 1.f)); layer->SetAmbientColor(hsColorRGBA().Set(0.f, 0.f, 0.f, 1.f));
@ -2203,8 +2191,7 @@ plLayer* plWaveSet7::ICreateTotalLayer(plBitmap* bm, hsGMaterial* mat, int which
plLayer* plWaveSet7::ICreateTotalEnvLayer(plBitmap* envMap, hsGMaterial* mat, int which, const char* pref) plLayer* plWaveSet7::ICreateTotalEnvLayer(plBitmap* envMap, hsGMaterial* mat, int which, const char* pref)
{ {
plLayer* layer = TRACKED_NEW plLayer; plLayer* layer = TRACKED_NEW plLayer;
char buff[256]; plString buff = plString::Format("%s_%s_EnvLayerPS_%d", GetKey()->GetName().c_str(), pref, which);
sprintf(buff, "%s_%s_%s_%d", GetKey()->GetName(), pref, "EnvLayerPS", which);
hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, layer, GetKey()->GetUoid().GetLocation());
layer->SetBlendFlags(which ? hsGMatState::kBlendAddSigned : 0); layer->SetBlendFlags(which ? hsGMatState::kBlendAddSigned : 0);
@ -2304,8 +2291,7 @@ void plWaveSet7::IAddShoreVertexShader(hsGMaterial* mat)
plShader* vShader = TRACKED_NEW plShader; plShader* vShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_ShoreVS", GetKey()->GetName().c_str());
sprintf(buff, "%s_ShoreVS", GetKey()->GetName());
hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation());
vShader->SetIsPixelShader(false); vShader->SetIsPixelShader(false);
@ -2358,8 +2344,7 @@ void plWaveSet7::IAddShorePixelShader(hsGMaterial* mat)
{ {
plShader* pShader = TRACKED_NEW plShader; plShader* pShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_ShorePS", GetKey()->GetName().c_str());
sprintf(buff, "%s_ShorePS", GetKey()->GetName());
hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation());
pShader->SetIsPixelShader(true); pShader->SetIsPixelShader(true);
@ -2382,8 +2367,7 @@ void plWaveSet7::IAddFixedVertexShader(hsGMaterial* mat, const int numUVWs)
plShader* vShader = TRACKED_NEW plShader; plShader* vShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_FixedVS", GetKey()->GetName().c_str());
sprintf(buff, "%s_FixedVS", GetKey()->GetName());
hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation());
vShader->SetIsPixelShader(false); vShader->SetIsPixelShader(false);
@ -2452,8 +2436,7 @@ void plWaveSet7::IAddFixedPixelShader(hsGMaterial* mat)
if( !fFixedPShader ) if( !fFixedPShader )
{ {
plShader* pShader = TRACKED_NEW plShader; plShader* pShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_FixedPS", GetKey()->GetName().c_str());
sprintf(buff, "%s_FixedPS", GetKey()->GetName());
hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation());
pShader->SetIsPixelShader(true); pShader->SetIsPixelShader(true);
@ -2481,8 +2464,7 @@ void plWaveSet7::IAddRipVertexShader(hsGMaterial* mat, const plRipVSConsts& ripC
if( !fRipVShader ) if( !fRipVShader )
{ {
plShader* vShader = TRACKED_NEW plShader; plShader* vShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_RipVS", GetKey()->GetName().c_str());
sprintf(buff, "%s_RipVS", GetKey()->GetName());
hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation());
vShader->SetIsPixelShader(false); vShader->SetIsPixelShader(false);
@ -2567,8 +2549,7 @@ void plWaveSet7::IAddRipPixelShader(hsGMaterial* mat, const plRipVSConsts& ripCo
if( !fRipPShader ) if( !fRipPShader )
{ {
plShader* pShader = TRACKED_NEW plShader; plShader* pShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_RipPS", GetKey()->GetName().c_str());
sprintf(buff, "%s_RipPS", GetKey()->GetName());
hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation());
pShader->SetIsPixelShader(true); pShader->SetIsPixelShader(true);
@ -2627,8 +2608,7 @@ plShader* plWaveSet7::ICreateDecalVShader(DecalVType t)
plShader* vShader = TRACKED_NEW plShader; plShader* vShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_%s", GetKey()->GetName().c_str(), fname[t]);
sprintf(buff, "%s_%s", GetKey()->GetName(), fname[t]);
hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation());
vShader->SetIsPixelShader(false); vShader->SetIsPixelShader(false);
@ -2756,8 +2736,7 @@ plShader* plWaveSet7::ICreateDecalPShader(DecalPType t)
plShader* pShader = TRACKED_NEW plShader; plShader* pShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_%s", GetKey()->GetName().c_str(), fname[t]);
sprintf(buff, "%s_%s", GetKey()->GetName(), fname[t]);
hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation());
pShader->SetIsPixelShader(true); pShader->SetIsPixelShader(true);
@ -3698,8 +3677,7 @@ plDrawableSpans* plWaveSet7::ICreateGraphDrawable(plDrawableSpans* drawable, hsG
plDrawableSpans* plWaveSet7::ICreateEmptyGraphDrawable(const char* name, UInt32 ref, int which) plDrawableSpans* plWaveSet7::ICreateEmptyGraphDrawable(const char* name, UInt32 ref, int which)
{ {
plDrawableSpans* drawable = TRACKED_NEW plDrawableSpans; plDrawableSpans* drawable = TRACKED_NEW plDrawableSpans;
char buff[256]; plString buff = plString::Format("%s_%s_%d", GetKey()->GetName().c_str(), name, which);
sprintf(buff, "%s_%s_%d", GetKey()->GetName(), name, which);
hsgResMgr::ResMgr()->NewKey(buff, drawable, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, drawable, GetKey()->GetUoid().GetLocation());
hsgResMgr::ResMgr()->SendRef(drawable->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, which, (Int8)ref), plRefFlags::kActiveRef); hsgResMgr::ResMgr()->SendRef(drawable->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, which, (Int8)ref), plRefFlags::kActiveRef);
@ -3711,8 +3689,7 @@ hsGMaterial* plWaveSet7::ICreateEmptyMaterial(const char* name, UInt32 ref, int
{ {
hsGMaterial* mat = TRACKED_NEW hsGMaterial; hsGMaterial* mat = TRACKED_NEW hsGMaterial;
char buff[256]; plString buff = plString::Format("%s_%s_%d", GetKey()->GetName().c_str(), name, which);
sprintf(buff, "%s_%s_%d", GetKey()->GetName(), name, which);
hsgResMgr::ResMgr()->NewKey(buff, mat, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, mat, GetKey()->GetUoid().GetLocation());
hsgResMgr::ResMgr()->SendRef(mat->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, which, (Int8)ref), plRefFlags::kActiveRef); hsgResMgr::ResMgr()->SendRef(mat->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, which, (Int8)ref), plRefFlags::kActiveRef);
@ -3723,8 +3700,7 @@ hsGMaterial* plWaveSet7::ICreateEmptyMaterial(const char* name, UInt32 ref, int
plLayer* plWaveSet7::ICreateBlankLayer(const char* name, int suff) plLayer* plWaveSet7::ICreateBlankLayer(const char* name, int suff)
{ {
plLayer* lay = TRACKED_NEW plLayer; plLayer* lay = TRACKED_NEW plLayer;
char buff[256]; plString buff = plString::Format("%s_%s_%d", GetKey()->GetName().c_str(), name, suff);
sprintf(buff, "%s_%s_%d", GetKey()->GetName(), name, suff);
hsgResMgr::ResMgr()->NewKey(buff, lay, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, lay, GetKey()->GetUoid().GetLocation());
return lay; return lay;
@ -3739,8 +3715,7 @@ plMipmap* plWaveSet7::ICreateBlankTex(const char* name, int width, int height, U
plMipmap::kUncompressed, plMipmap::kUncompressed,
plMipmap::UncompressedInfo::kRGB8888); plMipmap::UncompressedInfo::kRGB8888);
char buff[256]; plString buff = plString::Format("%s_%s", GetKey()->GetName().c_str(), name);
sprintf(buff, "%s_%s", GetKey()->GetName(), name);
hsgResMgr::ResMgr()->NewKey(buff, mipMap, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, mipMap, GetKey()->GetUoid().GetLocation());
hsgResMgr::ResMgr()->SendRef(mipMap->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, (Int8)ref), plRefFlags::kActiveRef); hsgResMgr::ResMgr()->SendRef(mipMap->GetKey(), TRACKED_NEW plGenRefMsg(GetKey(), plRefMsg::kOnRequest, 0, (Int8)ref), plRefFlags::kActiveRef);
@ -4146,8 +4121,7 @@ void plWaveSet7::IAddGraphVShader(hsGMaterial* mat, int iPass)
if( !fGraphVShader[iPass] ) if( !fGraphVShader[iPass] )
{ {
plShader* vShader = TRACKED_NEW plShader; plShader* vShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_GraphVS_%d", GetKey()->GetName().c_str(), iPass);
sprintf(buff, "%s_GraphVS_%d", GetKey()->GetName(), iPass);
hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, vShader, GetKey()->GetUoid().GetLocation());
vShader->SetIsPixelShader(false); vShader->SetIsPixelShader(false);
@ -4181,8 +4155,7 @@ void plWaveSet7::IAddGraphPShader(hsGMaterial* mat, int iPass)
if( !fGraphPShader[iPass] ) if( !fGraphPShader[iPass] )
{ {
plShader* pShader = TRACKED_NEW plShader; plShader* pShader = TRACKED_NEW plShader;
char buff[256]; plString buff = plString::Format("%s_GraphPS_%d", GetKey()->GetName().c_str(), iPass);
sprintf(buff, "%s_GraphPS_%d", GetKey()->GetName(), iPass);
hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, pShader, GetKey()->GetUoid().GetLocation());
pShader->SetIsPixelShader(true); pShader->SetIsPixelShader(true);
@ -4252,11 +4225,11 @@ void plWaveSet7::ISetupGraphShore(hsGMaterial* mat)
void plWaveSet7::IMakeShoreLayer(hsGMaterial* mat, int which) void plWaveSet7::IMakeShoreLayer(hsGMaterial* mat, int which)
{ {
char name[512]; plString name;
if( which >= mat->GetNumLayers() ) if( which >= mat->GetNumLayers() )
{ {
plLayer* lay = TRACKED_NEW plLayer; plLayer* lay = TRACKED_NEW plLayer;
sprintf(name, "%s_lay_%d", mat->GetKey()->GetName(), which); name = plString::Format("%s_lay_%d", mat->GetKey()->GetName().c_str(), which);
hsgResMgr::ResMgr()->NewKey(name, lay, GetKey()->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(name, lay, GetKey()->GetUoid().GetLocation());
lay->SetAmbientColor(hsColorRGBA().Set(0.f, 0.f, 0.f, 1.f)); lay->SetAmbientColor(hsColorRGBA().Set(0.f, 0.f, 0.f, 1.f));

4
Sources/Plasma/PubUtilLib/plGImage/plFontCache.cpp

@ -179,10 +179,10 @@ void plFontCache::ILoadCustomFonts( void )
delete font; delete font;
else else
{ {
char keyName[ 512 ]; plString keyName;
if( font->GetKey() == nil ) if( font->GetKey() == nil )
{ {
sprintf( keyName, "%s-%d", font->GetFace(), font->GetSize() ); keyName = plString::Format( "%s-%d", font->GetFace(), font->GetSize() );
hsgResMgr::ResMgr()->NewKey( keyName, font, plLocation::kGlobalFixedLoc ); hsgResMgr::ResMgr()->NewKey( keyName, font, plLocation::kGlobalFixedLoc );
} }

6
Sources/Plasma/PubUtilLib/plGLight/plLightInfo.cpp

@ -373,7 +373,7 @@ hsBool plLightInfo::MsgReceive(plMessage* msg)
plRenderMsg* rendMsg = plRenderMsg::ConvertNoRef(msg); plRenderMsg* rendMsg = plRenderMsg::ConvertNoRef(msg);
if( rendMsg ) if( rendMsg )
{ {
plProfile_BeginLap(LightInfo, this->GetKey()->GetUoid().GetObjectName()); plProfile_BeginLap(LightInfo, this->GetKey()->GetUoid().GetObjectName().c_str());
if( !fDeviceRef && !GetProperty(kLPShadowOnly) ) if( !fDeviceRef && !GetProperty(kLPShadowOnly) )
{ {
@ -382,7 +382,7 @@ hsBool plLightInfo::MsgReceive(plMessage* msg)
ICheckMaxStrength(); ICheckMaxStrength();
plProfile_EndLap(LightInfo, this->GetKey()->GetUoid().GetObjectName()); plProfile_EndLap(LightInfo, this->GetKey()->GetUoid().GetObjectName().c_str());
return true; return true;
} }
plGenRefMsg* refMsg = plGenRefMsg::ConvertNoRef(msg); plGenRefMsg* refMsg = plGenRefMsg::ConvertNoRef(msg);
@ -395,7 +395,7 @@ hsBool plLightInfo::MsgReceive(plMessage* msg)
case kProjection: case kProjection:
fProjection = plLayerInterface::ConvertNoRef(refMsg->GetRef()); fProjection = plLayerInterface::ConvertNoRef(refMsg->GetRef());
{ {
if( GetKey() && GetKey()->GetName() && !strncmp(GetKey()->GetName(), "RTPatternLight", strlen("RTPatternLight")) ) if( GetKey() && !GetKey()->GetName().CompareN("RTPatternLight", strlen("RTPatternLight")) )
SetProperty(kLPForceProj, true); SetProperty(kLPForceProj, true);
} }
break; break;

4
Sources/Plasma/PubUtilLib/plGLight/plShadowCaster.cpp

@ -214,9 +214,9 @@ hsBool plShadowCaster::MsgReceive(plMessage* msg)
plRenderMsg* rendMsg = plRenderMsg::ConvertNoRef(msg); plRenderMsg* rendMsg = plRenderMsg::ConvertNoRef(msg);
if( rendMsg ) if( rendMsg )
{ {
plProfile_BeginLap(ShadowCaster, this->GetKey()->GetUoid().GetObjectName()); plProfile_BeginLap(ShadowCaster, this->GetKey()->GetUoid().GetObjectName().c_str());
IOnRenderMsg(rendMsg); IOnRenderMsg(rendMsg);
plProfile_EndLap(ShadowCaster, this->GetKey()->GetUoid().GetObjectName()); plProfile_EndLap(ShadowCaster, this->GetKey()->GetUoid().GetObjectName().c_str());
return true; return true;
} }

4
Sources/Plasma/PubUtilLib/plGLight/plShadowMaster.cpp

@ -180,9 +180,9 @@ hsBool plShadowMaster::MsgReceive(plMessage* msg)
plRenderMsg* rendMsg = plRenderMsg::ConvertNoRef(msg); plRenderMsg* rendMsg = plRenderMsg::ConvertNoRef(msg);
if( rendMsg ) if( rendMsg )
{ {
plProfile_BeginLap(ShadowMaster, this->GetKey()->GetUoid().GetObjectName()); plProfile_BeginLap(ShadowMaster, this->GetKey()->GetUoid().GetObjectName().c_str());
IBeginRender(); IBeginRender();
plProfile_EndLap(ShadowMaster, this->GetKey()->GetUoid().GetObjectName()); plProfile_EndLap(ShadowMaster, this->GetKey()->GetUoid().GetObjectName().c_str());
return true; return true;
} }

2
Sources/Plasma/PubUtilLib/plModifier/plCloneSpawnModifier.cpp

@ -106,7 +106,7 @@ plKey plCloneSpawnModifier::SpawnClone(const char* cloneName, const char* cloneA
const plLocation& loc = plKeyFinder::Instance().FindLocation(cloneAge, "BuiltIn"); const plLocation& loc = plKeyFinder::Instance().FindLocation(cloneAge, "BuiltIn");
// Find the clone template key // Find the clone template key
plUoid objUoid(loc, plSceneObject::Index(), cloneName); plUoid objUoid(loc, plSceneObject::Index(), _TEMP_CONVERT_FROM_LITERAL(cloneName));
plKey key = resMgr->FindKey(objUoid); plKey key = resMgr->FindKey(objUoid);
if (key) if (key)

2
Sources/Plasma/PubUtilLib/plModifier/plResponderModifier.cpp

@ -775,7 +775,7 @@ void plResponderModifier::ILog(UInt32 color, const char* format, ...)
if (!format || *format == '\0') if (!format || *format == '\0')
return; return;
const char* keyName = GetKeyName(); const char* keyName = _TEMP_CONVERT_TO_CONST_CHAR(GetKeyName());
// Make sure this key isn't in our list of keys to deny // Make sure this key isn't in our list of keys to deny
for (int i = 0; i < gNoLogStrings.size(); i++) for (int i = 0; i < gNoLogStrings.size(); i++)

2
Sources/Plasma/PubUtilLib/plNetClient/plNetCliAgeJoiner.cpp

@ -181,7 +181,7 @@ void plNCAgeJoiner::IDispatchMsgReceiveCallback () {
void plNCAgeJoiner::IResMgrProgressBarCallback (plKey key) { void plNCAgeJoiner::IResMgrProgressBarCallback (plKey key) {
#ifndef PLASMA_EXTERNAL_RELEASE #ifndef PLASMA_EXTERNAL_RELEASE
if (s_instance) if (s_instance)
s_instance->progressBar->SetStatusText(key->GetName()); s_instance->progressBar->SetStatusText(_TEMP_CONVERT_TO_CONST_CHAR(key->GetName()));
#endif #endif
} }

2
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp

@ -1480,7 +1480,7 @@ void plNetClientMgr::AddPendingLoad(PendingLoad *pl)
pl->fKey = hsgResMgr::ResMgr()->FindKey(pl->fUoid); pl->fKey = hsgResMgr::ResMgr()->FindKey(pl->fUoid);
// check for age SDL state // check for age SDL state
if (pl->fUoid.GetObjectName() && !strcmp(pl->fUoid.GetObjectName(), plSDL::kAgeSDLObjectName)) if (!pl->fUoid.GetObjectName().IsNull() && !pl->fUoid.GetObjectName().Compare(plSDL::kAgeSDLObjectName))
{ {
DebugMsg("Recv SDL state for age hook object, uoid=%s", pl->fUoid.StringIze().c_str()); DebugMsg("Recv SDL state for age hook object, uoid=%s", pl->fUoid.StringIze().c_str());
if (!pl->fKey) if (!pl->fKey)

2
Sources/Plasma/PubUtilLib/plNetClient/plNetObjectDebugger.cpp

@ -130,7 +130,7 @@ bool plNetObjectDebugger::DebugObject::ObjectMatches(const hsKeyedObject* obj)
if ((fFlags & kPageMatch)==0) if ((fFlags & kPageMatch)==0)
{ {
// match based on object name only // match based on object name only
return StringMatches(obj->GetKeyName()); return StringMatches(_TEMP_CONVERT_TO_CONST_CHAR(obj->GetKeyName()));
} }
return (obj->GetKey()->GetUoid().GetLocation()==fLoc); return (obj->GetKey()->GetUoid().GetLocation()==fLoc);

8
Sources/Plasma/PubUtilLib/plNetClient/plNetVoiceList.cpp

@ -88,7 +88,7 @@ void plNetTalkList::AddMember(plNetTransportMember* e)
{ {
if (FindMember(e)==-1) if (FindMember(e)==-1)
{ {
plStatusLog::AddLineS("voice.log", "Adding %s to talk list", e->AsStdString().c_str()); plStatusLog::AddLineS("voice.log", "Adding %s to talk list", e->AsString().c_str());
fMembers.push_back(e); fMembers.push_back(e);
} }
fFlags |= kDirty; fFlags |= kDirty;
@ -99,7 +99,7 @@ void plNetTalkList::RemoveMember(plNetTransportMember* e)
int idx=FindMember(e); int idx=FindMember(e);
if (idx!=-1) if (idx!=-1)
{ {
plStatusLog::AddLineS("voice.log", "Removing %s from talklist", e->AsStdString().c_str()); plStatusLog::AddLineS("voice.log", "Removing %s from talklist", e->AsString().c_str());
fMembers.erase(fMembers.begin()+idx); fMembers.erase(fMembers.begin()+idx);
} }
fFlags |= kDirty; fFlags |= kDirty;
@ -122,7 +122,7 @@ void plNetListenList::AddMember(plNetTransportMember* e)
{ {
if (FindMember(e)==-1) if (FindMember(e)==-1)
{ {
plStatusLog::AddLineS("voice.log", "Adding %s to listen list ", e->AsStdString().c_str()); plStatusLog::AddLineS("voice.log", "Adding %s to listen list ", e->AsString().c_str());
fMembers.push_back(e); fMembers.push_back(e);
#if 0 #if 0
@ -146,7 +146,7 @@ void plNetListenList::RemoveMember(plNetTransportMember* e)
if (idx!=-1) if (idx!=-1)
{ {
fMembers.erase(fMembers.begin()+idx); fMembers.erase(fMembers.begin()+idx);
plStatusLog::AddLineS("voice.log", "Removing %s from listen list", e->AsStdString().c_str()); plStatusLog::AddLineS("voice.log", "Removing %s from listen list", e->AsString().c_str());
#if 0 #if 0
// call the new member's win audible and set talk icon parameters // call the new member's win audible and set talk icon parameters

4
Sources/Plasma/PubUtilLib/plNetCommon/plNetMsgScreener.cpp

@ -76,8 +76,8 @@ void plNetMsgScreener::IRejectLogMsg(Int16 classIndex, const char* desc, const p
// //
void plNetMsgScreener::IRejectLogMsg(const plMessage* msg, const char* desc, const plNetGameMember* gm) const void plNetMsgScreener::IRejectLogMsg(const plMessage* msg, const char* desc, const plNetGameMember* gm) const
{ {
const char* senderName = msg->GetSender() ? msg->GetSender()->GetUoid().GetObjectName() : "?"; const char* senderName = msg->GetSender() ? msg->GetSender()->GetUoid().GetObjectName().c_str() : "?";
const char* rcvrName = msg->GetNumReceivers() && msg->GetReceiver(0) ? msg->GetReceiver(0)->GetUoid().GetObjectName() : "?"; const char* rcvrName = msg->GetNumReceivers() && msg->GetReceiver(0) ? msg->GetReceiver(0)->GetUoid().GetObjectName().c_str() : "?";
DebugMsg("Message %s was rejected, reason:%s, age:%s, client:%s, msgSndr:%s, msgRcvr:%s", DebugMsg("Message %s was rejected, reason:%s, age:%s, client:%s, msgSndr:%s, msgRcvr:%s",
msg->ClassName(), desc, IGetAgeName(), IGetSenderName(gm), msg->ClassName(), desc, IGetAgeName(), IGetSenderName(gm),

14
Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp

@ -828,13 +828,6 @@ void plNetMsgSDLStateBCast::WriteVersion(hsStream* s, hsResMgr* mgr)
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
// plNetMsgRoomsList // plNetMsgRoomsList
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
plNetMsgRoomsList::~plNetMsgRoomsList()
{
int i;
for(i=0;i<GetNumRooms();i++)
delete [] fRoomNames[i];
}
int plNetMsgRoomsList::IPokeBuffer(hsStream* stream, UInt32 peekOptions) int plNetMsgRoomsList::IPokeBuffer(hsStream* stream, UInt32 peekOptions)
{ {
int bytes=plNetMessage::IPokeBuffer(stream, peekOptions); int bytes=plNetMessage::IPokeBuffer(stream, peekOptions);
@ -871,7 +864,6 @@ int plNetMsgRoomsList::IPeekBuffer(hsStream* stream, UInt32 peekOptions)
loc.Read(stream); loc.Read(stream);
fRooms[i]=loc; fRooms[i]=loc;
// read room name for debugging // read room name for debugging
delete [] fRoomNames[i];
stream->LogSubStreamPushDesc("RoomList"); stream->LogSubStreamPushDesc("RoomList");
plMsgCStringHelper::Peek(fRoomNames[i],stream,peekOptions); plMsgCStringHelper::Peek(fRoomNames[i],stream,peekOptions);
} }
@ -884,13 +876,13 @@ int plNetMsgRoomsList::IPeekBuffer(hsStream* stream, UInt32 peekOptions)
void plNetMsgRoomsList::AddRoom(plKey rmKey) void plNetMsgRoomsList::AddRoom(plKey rmKey)
{ {
fRooms.push_back(rmKey->GetUoid().GetLocation()); fRooms.push_back(rmKey->GetUoid().GetLocation());
fRoomNames.push_back(hsStrcpy(rmKey->GetName())); fRoomNames.push_back(rmKey->GetName());
} }
void plNetMsgRoomsList::AddRoomLocation(plLocation loc, const char* rmName) void plNetMsgRoomsList::AddRoomLocation(plLocation loc, const plString& rmName)
{ {
fRooms.push_back(loc); fRooms.push_back(loc);
fRoomNames.push_back(rmName ? hsStrcpy(rmName) : nil); fRoomNames.push_back(rmName);
} }
int plNetMsgRoomsList::FindRoomLocation(plLocation loc) int plNetMsgRoomsList::FindRoomLocation(plLocation loc)

8
Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h

@ -451,24 +451,24 @@ class plNetMsgRoomsList : public plNetMessage
{ {
protected: protected:
std::vector<plLocation> fRooms; std::vector<plLocation> fRooms;
std::vector<char*> fRoomNames; // for debug usage only std::vector<plString> fRoomNames; // for debug usage only
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0); int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0); int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
public: public:
plNetMsgRoomsList() {} plNetMsgRoomsList() {}
~plNetMsgRoomsList(); ~plNetMsgRoomsList() {};
CLASSNAME_REGISTER( plNetMsgRoomsList ); CLASSNAME_REGISTER( plNetMsgRoomsList );
GETINTERFACE_ANY( plNetMsgRoomsList, plNetMessage ); GETINTERFACE_ANY( plNetMsgRoomsList, plNetMessage );
void AddRoom(plKey rmKey); void AddRoom(plKey rmKey);
void AddRoomLocation(plLocation loc, const char* rmName); void AddRoomLocation(plLocation loc, const plString& rmName);
int FindRoomLocation(plLocation loc); int FindRoomLocation(plLocation loc);
int GetNumRooms() const { return fRooms.size(); } int GetNumRooms() const { return fRooms.size(); }
plLocation GetRoomLoc(int i) const { return fRooms[i]; } plLocation GetRoomLoc(int i) const { return fRooms[i]; }
const char* GetRoomName(int i) const { return fRoomNames[i]; } // debug plString GetRoomName(int i) const { return fRoomNames[i]; } // debug
}; };
// //

2
Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.cpp

@ -364,7 +364,7 @@ int plNetMsgObjectHelper::Peek(hsStream* stream, const UInt32 peekOptions)
hsBool plNetMsgObjectHelper::SetFromKey(const plKey &key) hsBool plNetMsgObjectHelper::SetFromKey(const plKey &key)
{ {
if (!key || !key->GetName()) if (!key || key->GetName().IsNull())
return false; return false;
fUoid = key->GetUoid(); fUoid = key->GetUoid();

2
Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.h

@ -213,7 +213,7 @@ public:
void SetUoid(const plUoid &u) { fUoid=u; } void SetUoid(const plUoid &u) { fUoid=u; }
// getters // getters
const char* GetObjectName() const { return fUoid.GetObjectName(); } const plString& GetObjectName() const { return fUoid.GetObjectName(); }
UInt32 GetPageID() const { return fUoid.GetLocation().GetSequenceNumber(); } UInt32 GetPageID() const { return fUoid.GetLocation().GetSequenceNumber(); }
const plUoid& GetUoid() const { return fUoid; } const plUoid& GetUoid() const { return fUoid; }

4
Sources/Plasma/PubUtilLib/plParticleSystem/plParticleEmitter.cpp

@ -324,7 +324,7 @@ void plParticleEmitter::IUpdateParticles(hsScalar delta)
if ((fGenerator != nil) && (fTimeToLive >= 0)) if ((fGenerator != nil) && (fTimeToLive >= 0))
{ {
plProfile_BeginLap(ParticleGenerate, fSystem->GetKeyName()); plProfile_BeginLap(ParticleGenerate, fSystem->GetKeyName().c_str());
if (!fGenerator->AddAutoParticles(this, delta)) if (!fGenerator->AddAutoParticles(this, delta))
{ {
delete fGenerator; delete fGenerator;
@ -332,7 +332,7 @@ void plParticleEmitter::IUpdateParticles(hsScalar delta)
} }
if( (fTimeToLive > 0) && ((fTimeToLive -= delta) <= 0) ) if( (fTimeToLive > 0) && ((fTimeToLive -= delta) <= 0) )
fTimeToLive = -1.f; fTimeToLive = -1.f;
plProfile_EndLap(ParticleGenerate, fSystem->GetKeyName()); plProfile_EndLap(ParticleGenerate, fSystem->GetKeyName().c_str());
} }
fTargetInfo.fContext = fSystem->fContext; fTargetInfo.fContext = fSystem->fContext;

4
Sources/Plasma/PubUtilLib/plParticleSystem/plParticleSystem.cpp

@ -486,9 +486,9 @@ hsBool plParticleSystem::MsgReceive(plMessage* msg)
if ((rend = plRenderMsg::ConvertNoRef(msg))) if ((rend = plRenderMsg::ConvertNoRef(msg)))
{ {
plProfile_BeginLap(ParticleSys, this->GetKey()->GetUoid().GetObjectName()); plProfile_BeginLap(ParticleSys, this->GetKey()->GetUoid().GetObjectName().c_str());
IHandleRenderMsg(rend->Pipeline()); IHandleRenderMsg(rend->Pipeline());
plProfile_EndLap(ParticleSys, this->GetKey()->GetUoid().GetObjectName()); plProfile_EndLap(ParticleSys, this->GetKey()->GetUoid().GetObjectName().c_str());
return true; return true;
} }
else if ((refMsg = plGenRefMsg::ConvertNoRef(msg))) else if ((refMsg = plGenRefMsg::ConvertNoRef(msg)))

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

@ -493,7 +493,7 @@ hsBool plPXPhysical::Init(PhysRecipe& recipe)
} }
actorDesc.userData = this; actorDesc.userData = this;
actorDesc.name = GetKeyName(); actorDesc.name = GetKeyName().c_str();
// Put the dynamics into actor group 1. The actor groups are only used for // Put the dynamics into actor group 1. The actor groups are only used for
// deciding who we get contact reports for. // deciding who we get contact reports for.
@ -617,7 +617,7 @@ hsBool plPXPhysical::HandleRefMsg(plGenRefMsg* refMsg)
plKey ourKey = GetKey(); plKey ourKey = GetKey();
PhysRefType refType = PhysRefType(refMsg->fType); PhysRefType refType = PhysRefType(refMsg->fType);
const char* refKeyName = refKey ? refKey->GetName() : "MISSING"; plString refKeyName = refKey ? refKey->GetName() : _TEMP_CONVERT_FROM_LITERAL("MISSING");
if (refType == kPhysRefWorld) if (refType == kPhysRefWorld)
{ {
@ -695,11 +695,11 @@ plPhysical& plPXPhysical::SetProperty(int prop, hsBool status)
case plSimulationInterface::kNoSynchronize: propName = "kNoSynchronize"; break; case plSimulationInterface::kNoSynchronize: propName = "kNoSynchronize"; break;
} }
const char* name = "(unknown)"; plString name = _TEMP_CONVERT_FROM_LITERAL("(unknown)");
if (GetKey()) if (GetKey())
name = GetKeyName(); name = GetKeyName();
if (plSimulationMgr::fExtraProfile) if (plSimulationMgr::fExtraProfile)
plSimulationMgr::Log("Warning: Redundant physical property set (property %s, value %s) on %s", propName, status ? "true" : "false", name); plSimulationMgr::Log("Warning: Redundant physical property set (property %s, value %s) on %s", propName, status ? "true" : "false", name.c_str());
} }
switch (prop) switch (prop)
@ -786,7 +786,7 @@ void plPXPhysical::SendNewLocation(hsBool synchTransform, hsBool isSynchUpdate)
if (!CompareMatrices(curl2w, fCachedLocal2World, .0001f)) if (!CompareMatrices(curl2w, fCachedLocal2World, .0001f))
{ {
plProfile_Inc(LocationsSent); plProfile_Inc(LocationsSent);
plProfile_BeginLap(PhysicsUpdates, GetKeyName()); plProfile_BeginLap(PhysicsUpdates, GetKeyName().c_str());
// quick peek at the translation...last time it was corrupted because we applied a non-unit quaternion // quick peek at the translation...last time it was corrupted because we applied a non-unit quaternion
// hsAssert(real_finite(fCachedLocal2World.fMap[0][3]) && // hsAssert(real_finite(fCachedLocal2World.fMap[0][3]) &&
@ -808,7 +808,7 @@ void plPXPhysical::SendNewLocation(hsBool synchTransform, hsBool isSynchUpdate)
pCorrMsg->Send(); pCorrMsg->Send();
if (fProxyGen) if (fProxyGen)
fProxyGen->SetTransform(fCachedLocal2World, w2l); fProxyGen->SetTransform(fCachedLocal2World, w2l);
plProfile_EndLap(PhysicsUpdates, GetKeyName()); plProfile_EndLap(PhysicsUpdates, GetKeyName().c_str());
} }
} }
} }

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

@ -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(),
hitter ? hitter->GetName() : "(nil)" , entering ? "'enter'" : "'exit'"); hitter ? hitter->GetName().c_str() : "(nil)" , entering ? "'enter'" : "'exit'");
plCollideMsg* msg = TRACKED_NEW plCollideMsg; plCollideMsg* msg = TRACKED_NEW plCollideMsg;
msg->fOtherKey = hitter; msg->fOtherKey = hitter;
msg->fEntering = entering; msg->fEntering = entering;
@ -537,8 +537,8 @@ void plSimulationMgr::ReleaseScene(plKey world)
void plSimulationMgr::ISendCollisionMsg(plKey receiver, plKey hitter, hsBool entering) void plSimulationMgr::ISendCollisionMsg(plKey receiver, plKey hitter, hsBool entering)
{ {
DetectorLogYellow("Collision: %s is inside %s. Sending an %s msg", hitter ? hitter->GetName() : "(nil)", DetectorLogYellow("Collision: %s is inside %s. Sending an %s msg", hitter ? hitter->GetName().c_str() : "(nil)",
receiver->GetName(), entering ? "'enter'" : "'exit'"); receiver->GetName().c_str(), entering ? "'enter'" : "'exit'");
plCollideMsg* msg = TRACKED_NEW plCollideMsg; plCollideMsg* msg = TRACKED_NEW plCollideMsg;
msg->fOtherKey = hitter; msg->fOtherKey = hitter;
msg->fEntering = entering; msg->fEntering = entering;
@ -740,10 +740,10 @@ void plSimulationMgr::ISendUpdates()
const plKey physKey = physical->GetKey(); const plKey physKey = physical->GetKey();
if (physKey) if (physKey)
{ {
const char *physName = physical->GetKeyName(); const plString &physName = physical->GetKeyName();
if (physName) if (!physName.IsNull())
{ {
plSimulationMgr::Log("Removing physical <%s> because of missing scene node.\n", physName); plSimulationMgr::Log("Removing physical <%s> because of missing scene node.\n", physName.c_str());
} }
} }
// Remove(physical); // Remove(physical);

6
Sources/Plasma/PubUtilLib/plPipeline/plCaptureRender.cpp

@ -138,8 +138,7 @@ hsBool plCaptureRender::Capture(const plKey& ack, UInt16 width, UInt16 height)
plRenderTarget* rt = TRACKED_NEW plRenderTarget(flags, width, height, bitDepth, zDepth, stencilDepth); plRenderTarget* rt = TRACKED_NEW plRenderTarget(flags, width, height, bitDepth, zDepth, stencilDepth);
static int idx=0; static int idx=0;
char buff[32]; plString buff = plString::Format("tRT%d", idx++);
sprintf(buff, "tRT%d", idx++);
hsgResMgr::ResMgr()->NewKey(buff, rt, ack->GetUoid().GetLocation()); hsgResMgr::ResMgr()->NewKey(buff, rt, ack->GetUoid().GetLocation());
@ -181,8 +180,7 @@ hsBool plCaptureRender::IProcess(plPipeline* pipe, const plKey& ack, plRenderTar
static int currentCapIndex = 0; static int currentCapIndex = 0;
// Mipmap isn't created with a key so let's give it one now // Mipmap isn't created with a key so let's give it one now
char buff[512]; plString buff = plString::Format("CaptureRender_%d", currentCapIndex++);
sprintf(buff, "CaptureRender_%d", currentCapIndex++);
hsgResMgr::ResMgr()->NewKey(buff, mipMap, plLocation::kGlobalFixedLoc); hsgResMgr::ResMgr()->NewKey(buff, mipMap, plLocation::kGlobalFixedLoc);
mipMap->Ref(); mipMap->Ref();

2
Sources/Plasma/PubUtilLib/plPipeline/plDXDeviceRefs.cpp

@ -235,7 +235,7 @@ void plDXTextureRef::Release( void )
{ {
plProfile_DelMem(MemTexture, fDataSize + sizeof(plDXTextureRef)); plProfile_DelMem(MemTexture, fDataSize + sizeof(plDXTextureRef));
plProfile_Extern(ManagedMem); plProfile_Extern(ManagedMem);
PROFILE_POOL_MEM(D3DPOOL_MANAGED, fDataSize, false, (fOwner ? fOwner->GetKey() ? fOwner->GetKey()->GetUoid().GetObjectName() : "(UnknownTexture)" : "(UnknownTexture)")); PROFILE_POOL_MEM(D3DPOOL_MANAGED, fDataSize, false, (fOwner ? fOwner->GetKey() ? fOwner->GetKey()->GetUoid().GetObjectName().c_str() : "(UnknownTexture)" : "(UnknownTexture)"));
plDXPipeline::FreeManagedTexture(fDataSize); plDXPipeline::FreeManagedTexture(fDataSize);
fDataSize = 0; fDataSize = 0;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save