Browse Source

Fix string usage that was broken from enabling the Max plugin build

Michael Hansen 13 years ago
parent
commit
be4b0732d5
  1. 9
      Sources/Plasma/CoreLib/hsStream.cpp
  2. 4
      Sources/Plasma/CoreLib/hsStream.h
  3. 21
      Sources/Plasma/CoreLib/plString.cpp
  4. 6
      Sources/Plasma/CoreLib/plString.h
  5. 18
      Sources/Plasma/FeatureLib/pfConsole/pfAvatarConsoleCommands.cpp
  6. 10
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp
  7. 34
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.cpp
  8. 9
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.h
  9. 19
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.cpp
  10. 7
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.h
  11. 19
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.cpp
  12. 11
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.h
  13. 19
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.cpp
  14. 9
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.h
  15. 4
      Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp
  16. 6
      Sources/Plasma/FeatureLib/pfPython/cyAvatar.cpp
  17. 4
      Sources/Plasma/FeatureLib/pfPython/cyAvatar.h
  18. 6
      Sources/Plasma/FeatureLib/pfPython/cyAvatarGlue.cpp
  19. 10
      Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp
  20. 37
      Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h
  21. 8
      Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp
  22. 2
      Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.h
  23. 2
      Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp
  24. 3
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.cpp
  25. 78
      Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp
  26. 48
      Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h
  27. 18
      Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp
  28. 8
      Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h
  29. 19
      Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.cpp
  30. 13
      Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.h
  31. 4
      Sources/Plasma/PubUtilLib/plAvatar/plAGChannel.cpp
  32. 7
      Sources/Plasma/PubUtilLib/plAvatar/plAGChannel.h
  33. 38
      Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.cpp
  34. 16
      Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h
  35. 19
      Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.cpp
  36. 12
      Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.h
  37. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp
  38. 92
      Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp
  39. 24
      Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h
  40. 4
      Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.cpp
  41. 4
      Sources/Plasma/PubUtilLib/plAvatar/plAvBrainClimb.cpp
  42. 8
      Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp
  43. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.h
  44. 17
      Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp
  45. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp
  46. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarMgr.cpp
  47. 67
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp
  48. 26
      Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.h
  49. 14
      Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.cpp
  50. 5
      Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.h
  51. 3
      Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.cpp
  52. 6
      Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp
  53. 8
      Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp
  54. 2
      Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.cpp
  55. 36
      Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.h
  56. 41
      Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.cpp
  57. 38
      Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h
  58. 12
      Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.cpp
  59. 4
      Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.h
  60. 9
      Sources/Plasma/PubUtilLib/plMessage/plOneShotCallbacks.cpp
  61. 6
      Sources/Plasma/PubUtilLib/plMessage/plOneShotCallbacks.h
  62. 8
      Sources/Plasma/PubUtilLib/plModifier/plAxisAnimModifier.cpp
  63. 7
      Sources/Plasma/PubUtilLib/plModifier/plAxisAnimModifier.h
  64. 4
      Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp
  65. 12
      Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h
  66. 24
      Sources/Tools/MaxComponent/plAGComponents.cpp
  67. 7
      Sources/Tools/MaxComponent/plAnimCompProc.cpp
  68. 43
      Sources/Tools/MaxComponent/plAnimComponent.cpp
  69. 4
      Sources/Tools/MaxComponent/plAnimComponent.h
  70. 36
      Sources/Tools/MaxComponent/plAnimEventComponent.cpp
  71. 3
      Sources/Tools/MaxComponent/plAnimObjInterface.h
  72. 42
      Sources/Tools/MaxComponent/plAudioComponents.cpp
  73. 4
      Sources/Tools/MaxComponent/plAutoUIParams.cpp
  74. 22
      Sources/Tools/MaxComponent/plAvatarComponent.cpp
  75. 6
      Sources/Tools/MaxComponent/plClickDragComponent.cpp
  76. 10
      Sources/Tools/MaxComponent/plComponentBase.cpp
  77. 2
      Sources/Tools/MaxComponent/plComponentBase.h
  78. 6
      Sources/Tools/MaxComponent/plComponentTools.cpp
  79. 12
      Sources/Tools/MaxComponent/plComponentTools.h
  80. 2
      Sources/Tools/MaxComponent/plFootstepComponent.cpp
  81. 8
      Sources/Tools/MaxComponent/plGUIComponents.cpp
  82. 3
      Sources/Tools/MaxComponent/plInventoryObjComponent.cpp
  83. 29
      Sources/Tools/MaxComponent/plMaxAnimUtils.cpp
  84. 9
      Sources/Tools/MaxComponent/plMaxAnimUtils.h
  85. 46
      Sources/Tools/MaxComponent/plNotetrackAnim.cpp
  86. 20
      Sources/Tools/MaxComponent/plNotetrackAnim.h
  87. 14
      Sources/Tools/MaxComponent/plNotetrackDlg.cpp
  88. 2
      Sources/Tools/MaxComponent/plObjectFlockerComponent.cpp
  89. 6
      Sources/Tools/MaxComponent/plParticleComponents.cpp
  90. 6
      Sources/Tools/MaxComponent/plPhysicalComponents.cpp
  91. 22
      Sources/Tools/MaxComponent/plPythonFileComponent.cpp
  92. 22
      Sources/Tools/MaxComponent/plResponderAnim.cpp
  93. 6
      Sources/Tools/MaxComponent/plResponderCmd.h
  94. 6
      Sources/Tools/MaxComponent/plResponderComponent.cpp
  95. 2
      Sources/Tools/MaxComponent/plResponderLink.cpp
  96. 46
      Sources/Tools/MaxComponent/plResponderMtl.cpp
  97. 6
      Sources/Tools/MaxComponent/plResponderMtl.h
  98. 6
      Sources/Tools/MaxComponent/plResponderWait.cpp
  99. 3
      Sources/Tools/MaxComponent/plResponderWait.h
  100. 8
      Sources/Tools/MaxComponent/plSoftVolumeComponent.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

9
Sources/Plasma/CoreLib/hsStream.cpp

@ -322,15 +322,14 @@ wchar_t *hsStream::ReadSafeWString()
return retVal; return retVal;
} }
uint32_t hsStream::WriteSafeString_TEMP(const plString &string) uint32_t hsStream::WriteSafeString(const plString &string)
{ {
return WriteSafeString(string.c_str()); return WriteSafeString(_TEMP_CONVERT_TO_CONST_CHAR(string));
} }
uint32_t hsStream::WriteSafeWString_TEMP(const plString &string) uint32_t hsStream::WriteSafeWString(const plString &string)
{ {
plStringBuffer<wchar_t> wbuffer = string.ToWchar(); return WriteSafeWString(_TEMP_CONVERT_TO_WCHAR_T(string));
return WriteSafeWString(wbuffer.GetData());
} }
plString hsStream::ReadSafeString_TEMP() plString hsStream::ReadSafeString_TEMP()

4
Sources/Plasma/CoreLib/hsStream.h

@ -145,8 +145,8 @@ public:
char * ReadSafeString(); char * ReadSafeString();
wchar_t * ReadSafeWString(); wchar_t * ReadSafeWString();
uint32_t WriteSafeString_TEMP(const plString &string); // uses 2 bytes for length uint32_t WriteSafeString(const plString &string); // uses 2 bytes for length
uint32_t WriteSafeWString_TEMP(const plString &string); uint32_t WriteSafeWString(const plString &string);
plString ReadSafeString_TEMP(); plString ReadSafeString_TEMP();
plString ReadSafeWString_TEMP(); plString ReadSafeWString_TEMP();

21
Sources/Plasma/CoreLib/plString.cpp

@ -28,6 +28,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <cstring> #include <cstring>
#include <cstdlib> #include <cstdlib>
#include <wchar.h>
const plString plString::Null; const plString plString::Null;
@ -51,6 +52,11 @@ static inline size_t u16slen(const uint16_t *ustr, size_t max)
void plString::IConvertFromUtf8(const char *utf8, size_t size, bool steal) void plString::IConvertFromUtf8(const char *utf8, size_t size, bool steal)
{ {
if (utf8 == nil) {
fUtf8Buffer = plStringBuffer<char>();
return;
}
if ((long)size < 0) if ((long)size < 0)
size = strnlen(utf8, -(long)size); size = strnlen(utf8, -(long)size);
@ -85,6 +91,11 @@ void plString::IConvertFromUtf8(const char *utf8, size_t size, bool steal)
void plString::IConvertFromUtf16(const uint16_t *utf16, size_t size) void plString::IConvertFromUtf16(const uint16_t *utf16, size_t size)
{ {
if (utf16 == nil) {
fUtf8Buffer = plStringBuffer<char>();
return;
}
if ((long)size < 0) if ((long)size < 0)
size = u16slen(utf16, -(long)size); size = u16slen(utf16, -(long)size);
@ -156,6 +167,11 @@ void plString::IConvertFromWchar(const wchar_t *wstr, size_t size)
// We assume that if sizeof(wchar_t) == 2, the data is UTF-16 already // We assume that if sizeof(wchar_t) == 2, the data is UTF-16 already
IConvertFromUtf16((const uint16_t *)wstr, size); IConvertFromUtf16((const uint16_t *)wstr, size);
#else #else
if (wstr == nil) {
fUtf8Buffer = plStringBuffer<char>();
return;
}
if ((long)size < 0) if ((long)size < 0)
size = wcsnlen(wstr, -(long)size); size = wcsnlen(wstr, -(long)size);
@ -213,6 +229,11 @@ void plString::IConvertFromWchar(const wchar_t *wstr, size_t size)
void plString::IConvertFromIso8859_1(const char *astr, size_t size) void plString::IConvertFromIso8859_1(const char *astr, size_t size)
{ {
if (astr == nil) {
fUtf8Buffer = plStringBuffer<char>();
return;
}
if ((long)size < 0) if ((long)size < 0)
size = strnlen(astr, -(long)size); size = strnlen(astr, -(long)size);

6
Sources/Plasma/CoreLib/plString.h

@ -39,8 +39,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*/ */
#define _TEMP_CONVERT_FROM_LITERAL(x) plString::FromUtf8((x)) #define _TEMP_CONVERT_FROM_LITERAL(x) plString::FromUtf8((x))
#define _TEMP_CONVERT_FROM_WCHAR_T(x) plString::FromWchar((x)) #define _TEMP_CONVERT_FROM_WCHAR_T(x) plString::FromWchar((x))
#define _TEMP_CONVERT_TO_CONST_CHAR(x) (x).c_str() #define _TEMP_CONVERT_TO_CONST_CHAR(x) ((x).c_str())
#define _TEMP_CONVERT_TO_CONST_CHAR_S(x) (x).s_str() #define _TEMP_CONVERT_TO_WCHAR_T(x) ((x).ToWchar().GetData())
typedef unsigned int UniChar; typedef unsigned int UniChar;
@ -70,7 +70,7 @@ private:
StringRef *fData; StringRef *fData;
public: public:
plStringBuffer() : fData(0) { } plStringBuffer() : fData(nil) { }
plStringBuffer(const plStringBuffer<_Ch> &copy) plStringBuffer(const plStringBuffer<_Ch> &copy)
{ {

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

@ -632,11 +632,11 @@ PF_CONSOLE_CMD( Avatar_Physics, TogglePhysical, "", "Disable/enable physics on t
PF_CONSOLE_CMD( Avatar_Anim, BlendAnim, "string Animation, float blendFactor", "Blend the given animation with the current animation.") PF_CONSOLE_CMD( Avatar_Anim, BlendAnim, "string Animation, float blendFactor", "Blend the given animation with the current animation.")
{ {
char *animationName = params[0]; plString animationName = plString::FromUtf8(params[0]);
float blendFactor = params[1]; float blendFactor = params[1];
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar(); plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
if (avatar && animationName) if (avatar && !animationName.IsNull())
{ {
plAGAnim * anim = plAGAnim::FindAnim(animationName); plAGAnim * anim = plAGAnim::FindAnim(animationName);
if(anim) if(anim)
@ -650,12 +650,12 @@ PF_CONSOLE_CMD( Avatar_Anim, BlendAnim, "string Animation, float blendFactor", "
PF_CONSOLE_CMD( Avatar_Anim, BlendAnimPri, "string Animation, float blendFactor, int priority", "Blend animation using priority.") PF_CONSOLE_CMD( Avatar_Anim, BlendAnimPri, "string Animation, float blendFactor, int priority", "Blend animation using priority.")
{ {
char *animationName = params[0]; plString animationName = plString::FromUtf8(params[0]);
float blendFactor = params[1]; float blendFactor = params[1];
int priority = params[2]; int priority = params[2];
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar(); plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
if (avatar && animationName) if (avatar && !animationName.IsNull())
{ {
plAGAnim * anim = plAGAnim::FindAnim(animationName); plAGAnim * anim = plAGAnim::FindAnim(animationName);
if(anim) if(anim)
@ -671,15 +671,15 @@ PF_CONSOLE_CMD( Avatar_Anim, PlaySimpleAnim, "string AvatarName, string Animatio
{ {
plArmatureMod *avatar = plAvatarMgr::GetInstance()->FindAvatarByModelName(params[0]); plArmatureMod *avatar = plAvatarMgr::GetInstance()->FindAvatarByModelName(params[0]);
if (avatar) if (avatar)
avatar->PlaySimpleAnim(params[1]); avatar->PlaySimpleAnim(plString::FromUtf8(params[1]));
} }
PF_CONSOLE_CMD( Avatar_Anim, DetachAnim, "string Animation", "Remove the given animation from the avatar.") PF_CONSOLE_CMD( Avatar_Anim, DetachAnim, "string Animation", "Remove the given animation from the avatar.")
{ {
char *animationName = params[0]; plString animationName = plString::FromUtf8(params[0]);
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar(); plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
if (avatar && animationName) if (avatar && !animationName.IsNull())
{ {
plAGAnimInstance * instance = avatar->FindAnimInstance(animationName); plAGAnimInstance * instance = avatar->FindAnimInstance(animationName);
if(instance) if(instance)
@ -691,11 +691,11 @@ PF_CONSOLE_CMD( Avatar_Anim, DetachAnim, "string Animation", "Remove the given a
PF_CONSOLE_CMD( Avatar_Anim, SetBlend, "string Animation, float blend", "Set the blend of the given animation.") PF_CONSOLE_CMD( Avatar_Anim, SetBlend, "string Animation, float blend", "Set the blend of the given animation.")
{ {
char *animationName = params[0]; plString animationName = plString::FromUtf8(params[0]);
float blend = params[1]; float blend = params[1];
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar(); plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
if (avatar && animationName) if (avatar && !animationName.IsNull())
{ {
plAGAnimInstance *anim = avatar->FindAnimInstance(animationName); plAGAnimInstance *anim = avatar->FindAnimInstance(animationName);
if(anim) if(anim)

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

@ -6548,7 +6548,7 @@ PF_CONSOLE_CMD( Animation, // Group name
{ {
plAnimCmdMsg *msg = new plAnimCmdMsg(); plAnimCmdMsg *msg = new plAnimCmdMsg();
msg->SetCmd(plAnimCmdMsg::kContinue); msg->SetCmd(plAnimCmdMsg::kContinue);
msg->SetAnimName(nil); msg->SetAnimName(plString::Null);
msg->SetBCastFlag(plMessage::kPropagateToModifiers); msg->SetBCastFlag(plMessage::kPropagateToModifiers);
SendAnimCmdMsg(plString::FromUtf8(params[0]), msg); SendAnimCmdMsg(plString::FromUtf8(params[0]), msg);
} }
@ -6560,7 +6560,7 @@ PF_CONSOLE_CMD( Animation, // Group name
{ {
plAnimCmdMsg *msg = new plAnimCmdMsg(); plAnimCmdMsg *msg = new plAnimCmdMsg();
msg->SetCmd(plAnimCmdMsg::kStop); msg->SetCmd(plAnimCmdMsg::kStop);
msg->SetAnimName(nil); msg->SetAnimName(plString::Null);
msg->SetBCastFlag(plMessage::kPropagateToModifiers); msg->SetBCastFlag(plMessage::kPropagateToModifiers);
SendAnimCmdMsg(plString::FromUtf8(params[0]), msg); SendAnimCmdMsg(plString::FromUtf8(params[0]), msg);
} }
@ -6574,7 +6574,7 @@ PF_CONSOLE_CMD( Animation, // Group name
msg->SetCmd(plAGCmdMsg::kSetBlend); msg->SetCmd(plAGCmdMsg::kSetBlend);
msg->fBlend = params[2]; msg->fBlend = params[2];
msg->fBlendRate = params[3]; msg->fBlendRate = params[3];
msg->SetAnimName(params[1]); msg->SetAnimName(plString::FromUtf8(params[1]));
msg->SetBCastFlag(plMessage::kPropagateToModifiers); msg->SetBCastFlag(plMessage::kPropagateToModifiers);
SendAnimCmdMsg(plString::FromUtf8(params[0]), msg); SendAnimCmdMsg(plString::FromUtf8(params[0]), msg);
} }
@ -6588,7 +6588,7 @@ PF_CONSOLE_CMD( Animation, // Group name
msg->SetCmd(plAGCmdMsg::kSetAmp); msg->SetCmd(plAGCmdMsg::kSetAmp);
msg->fAmp = params[2]; msg->fAmp = params[2];
msg->fAmpRate = params[3]; msg->fAmpRate = params[3];
msg->SetAnimName(params[1]); msg->SetAnimName(plString::FromUtf8(params[1]));
msg->SetBCastFlag(plMessage::kPropagateToModifiers); msg->SetBCastFlag(plMessage::kPropagateToModifiers);
SendAnimCmdMsg(plString::FromUtf8(params[0]), msg); SendAnimCmdMsg(plString::FromUtf8(params[0]), msg);
} }
@ -6602,7 +6602,7 @@ PF_CONSOLE_CMD( Animation, // Group name
msg->SetCmd(plAnimCmdMsg::kSetSpeed); msg->SetCmd(plAnimCmdMsg::kSetSpeed);
msg->fSpeed = params[2]; msg->fSpeed = params[2];
msg->fSpeedChangeRate = params[3]; msg->fSpeedChangeRate = params[3];
msg->SetAnimName(params[1]); msg->SetAnimName(plString::FromUtf8(params[1]));
msg->SetBCastFlag(plMessage::kPropagateToModifiers); msg->SetBCastFlag(plMessage::kPropagateToModifiers);
SendAnimCmdMsg(plString::FromUtf8(params[0]), msg); SendAnimCmdMsg(plString::FromUtf8(params[0]), msg);
} }

34
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.cpp

@ -150,8 +150,6 @@ void pfGUIButtonMod::StartDragging( void )
pfGUIButtonMod::pfGUIButtonMod() pfGUIButtonMod::pfGUIButtonMod()
{ {
fAnimName = nil;
fMouseOverAnimName = nil;
fDraggable = nil; fDraggable = nil;
fOrigHandler = nil; fOrigHandler = nil;
@ -161,12 +159,6 @@ pfGUIButtonMod::pfGUIButtonMod()
SetFlag( kWantsInterest ); SetFlag( kWantsInterest );
} }
pfGUIButtonMod::~pfGUIButtonMod()
{
delete [] fAnimName;
delete [] fMouseOverAnimName;
}
//// IEval /////////////////////////////////////////////////////////////////// //// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIButtonMod::IEval( double secs, float del, uint32_t dirty ) hsBool pfGUIButtonMod::IEval( double secs, float del, uint32_t dirty )
@ -204,13 +196,13 @@ void pfGUIButtonMod::Read( hsStream *s, hsResMgr *mgr )
uint32_t i, count = s->ReadLE32(); uint32_t i, count = s->ReadLE32();
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) ); fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString(); fAnimName = s->ReadSafeString_TEMP();
fMouseOverAnimKeys.Reset(); fMouseOverAnimKeys.Reset();
count = s->ReadLE32(); count = s->ReadLE32();
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
fMouseOverAnimKeys.Append( mgr->ReadKey( s ) ); fMouseOverAnimKeys.Append( mgr->ReadKey( s ) );
fMouseOverAnimName = s->ReadSafeString(); fMouseOverAnimName = s->ReadSafeString_TEMP();
fNotifyType = s->ReadLE32(); fNotifyType = s->ReadLE32();
mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDraggable ), plRefFlags::kActiveRef ); mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDraggable ), plRefFlags::kActiveRef );
@ -366,30 +358,16 @@ void pfGUIButtonMod::SetInteresting( hsBool i )
} }
void pfGUIButtonMod::SetAnimationKeys( hsTArray<plKey> &keys, const char *name ) void pfGUIButtonMod::SetAnimationKeys( hsTArray<plKey> &keys, const plString &name )
{ {
fAnimationKeys = keys; fAnimationKeys = keys;
delete [] fAnimName; fAnimName = name;
if( name != nil )
{
fAnimName = new char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
} }
void pfGUIButtonMod::SetMouseOverAnimKeys( hsTArray<plKey> &keys, const char *name ) void pfGUIButtonMod::SetMouseOverAnimKeys( hsTArray<plKey> &keys, const plString &name )
{ {
fMouseOverAnimKeys = keys; fMouseOverAnimKeys = keys;
delete [] fMouseOverAnimName; fMouseOverAnimName = name;
if( name != nil )
{
fMouseOverAnimName = new char[ strlen( name ) + 1 ];
strcpy( fMouseOverAnimName, name );
}
else
fMouseOverAnimName = nil;
} }

9
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIButtonMod.h

@ -60,10 +60,10 @@ class pfGUIButtonMod : public pfGUIControlMod
protected: protected:
hsTArray<plKey> fAnimationKeys; hsTArray<plKey> fAnimationKeys;
char *fAnimName; plString fAnimName;
hsTArray<plKey> fMouseOverAnimKeys; hsTArray<plKey> fMouseOverAnimKeys;
char *fMouseOverAnimName; plString fMouseOverAnimName;
hsBool fClicking; hsBool fClicking;
hsBool fTriggering; hsBool fTriggering;
@ -83,7 +83,6 @@ class pfGUIButtonMod : public pfGUIControlMod
public: public:
pfGUIButtonMod(); pfGUIButtonMod();
virtual ~pfGUIButtonMod();
CLASSNAME_REGISTER( pfGUIButtonMod ); CLASSNAME_REGISTER( pfGUIButtonMod );
GETINTERFACE_ANY( pfGUIButtonMod, pfGUIControlMod ); GETINTERFACE_ANY( pfGUIButtonMod, pfGUIControlMod );
@ -130,8 +129,8 @@ class pfGUIButtonMod : public pfGUIControlMod
void StopDragging( hsBool cancel ); void StopDragging( hsBool cancel );
// Export only // Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name ); void SetAnimationKeys( hsTArray<plKey> &keys, const plString &name );
void SetMouseOverAnimKeys( hsTArray<plKey> &keys, const char *name ); void SetMouseOverAnimKeys( hsTArray<plKey> &keys, const plString &name );
}; };
#endif // _pfGUIButtonMod_h #endif // _pfGUIButtonMod_h

19
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.cpp

@ -65,18 +65,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
pfGUICheckBoxCtrl::pfGUICheckBoxCtrl() pfGUICheckBoxCtrl::pfGUICheckBoxCtrl()
{ {
fAnimName = nil;
SetFlag( kWantsInterest ); SetFlag( kWantsInterest );
fChecked = false; fChecked = false;
fClicking = false; fClicking = false;
fPlaySound = true; fPlaySound = true;
} }
pfGUICheckBoxCtrl::~pfGUICheckBoxCtrl()
{
delete [] fAnimName;
}
//// IEval /////////////////////////////////////////////////////////////////// //// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUICheckBoxCtrl::IEval( double secs, float del, uint32_t dirty ) hsBool pfGUICheckBoxCtrl::IEval( double secs, float del, uint32_t dirty )
@ -102,7 +96,7 @@ void pfGUICheckBoxCtrl::Read( hsStream *s, hsResMgr *mgr )
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) ); fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString(); fAnimName = s->ReadSafeString_TEMP();
fChecked = s->ReadBool(); fChecked = s->ReadBool();
} }
@ -197,17 +191,10 @@ void pfGUICheckBoxCtrl::SetChecked( hsBool checked, hsBool immediate /*= fals
} }
} }
void pfGUICheckBoxCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *name ) void pfGUICheckBoxCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const plString &name )
{ {
fAnimationKeys = keys; fAnimationKeys = keys;
delete [] fAnimName; fAnimName = name;
if( name != nil )
{
fAnimName = new char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
} }
//// IGetDesiredCursor /////////////////////////////////////////////////////// //// IGetDesiredCursor ///////////////////////////////////////////////////////

7
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUICheckBoxCtrl.h

@ -59,7 +59,7 @@ class pfGUICheckBoxCtrl : public pfGUIControlMod
protected: protected:
hsTArray<plKey> fAnimationKeys; hsTArray<plKey> fAnimationKeys;
char *fAnimName; plString fAnimName;
hsBool fClicking; hsBool fClicking;
hsBool fChecked; hsBool fChecked;
@ -72,7 +72,6 @@ class pfGUICheckBoxCtrl : public pfGUIControlMod
public: public:
pfGUICheckBoxCtrl(); pfGUICheckBoxCtrl();
virtual ~pfGUICheckBoxCtrl();
CLASSNAME_REGISTER( pfGUICheckBoxCtrl ); CLASSNAME_REGISTER( pfGUICheckBoxCtrl );
GETINTERFACE_ANY( pfGUICheckBoxCtrl, pfGUIControlMod ); GETINTERFACE_ANY( pfGUICheckBoxCtrl, pfGUIControlMod );
@ -94,7 +93,7 @@ class pfGUICheckBoxCtrl : public pfGUIControlMod
void DontPlaySounds() { fPlaySound = false; } // should the checkbox play sounds? void DontPlaySounds() { fPlaySound = false; } // should the checkbox play sounds?
const hsTArray<plKey> &GetAnimationKeys( void ) const { return fAnimationKeys; } const hsTArray<plKey> &GetAnimationKeys( void ) const { return fAnimationKeys; }
const char *GetAnimationName( void ) const { return fAnimName; } plString GetAnimationName( void ) const { return fAnimName; }
enum SoundEvents enum SoundEvents
{ {
@ -105,7 +104,7 @@ class pfGUICheckBoxCtrl : public pfGUIControlMod
}; };
// Export only // Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name ); void SetAnimationKeys( hsTArray<plKey> &keys, const plString &name );
}; };
#endif // _pfGUICheckBoxCtrl_h #endif // _pfGUICheckBoxCtrl_h

19
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.cpp

@ -69,7 +69,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//// Constructor/Destructor ////////////////////////////////////////////////// //// Constructor/Destructor //////////////////////////////////////////////////
pfGUIKnobCtrl::pfGUIKnobCtrl() : pfGUIKnobCtrl::pfGUIKnobCtrl() :
fAnimName(nil),
fDragStart(0.f, 0.f, 0.f), fDragStart(0.f, 0.f, 0.f),
fDragging(false), fDragging(false),
fAnimStartPos(0.f, 0.f, 0.f), fAnimStartPos(0.f, 0.f, 0.f),
@ -83,11 +82,6 @@ pfGUIKnobCtrl::pfGUIKnobCtrl() :
SetFlag( kWantsInterest ); SetFlag( kWantsInterest );
} }
pfGUIKnobCtrl::~pfGUIKnobCtrl()
{
delete [] fAnimName;
}
//// IEval /////////////////////////////////////////////////////////////////// //// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIKnobCtrl::IEval( double secs, float del, uint32_t dirty ) hsBool pfGUIKnobCtrl::IEval( double secs, float del, uint32_t dirty )
@ -112,7 +106,7 @@ void pfGUIKnobCtrl::Read( hsStream *s, hsResMgr *mgr )
uint32_t i, count = s->ReadLE32(); uint32_t i, count = s->ReadLE32();
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) ); fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString(); fAnimName = s->ReadSafeString_TEMP();
fAnimTimesCalced = false; fAnimTimesCalced = false;
@ -262,17 +256,10 @@ void pfGUIKnobCtrl::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers )
//// SetAnimationKeys //////////////////////////////////////////////////////// //// SetAnimationKeys ////////////////////////////////////////////////////////
void pfGUIKnobCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *name ) void pfGUIKnobCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const plString &name )
{ {
fAnimationKeys = keys; fAnimationKeys = keys;
delete [] fAnimName; fAnimName = name;
if( name != nil )
{
fAnimName = new char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
} }
//// ICalcAnimTimes ////////////////////////////////////////////////////////// //// ICalcAnimTimes //////////////////////////////////////////////////////////

11
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.h

@ -58,17 +58,17 @@ class pfGUIKnobCtrl : public pfGUIValueCtrl
protected: protected:
hsTArray<plKey> fAnimationKeys; hsTArray<plKey> fAnimationKeys;
char *fAnimName; plString fAnimName;
hsPoint3 fDragStart; hsPoint3 fDragStart;
float fDragValue; float fDragValue;
hsBool fDragging; hsBool fDragging;
hsPoint3 fAnimStartPos, fAnimEndPos; // Calculated at export time for kMapToScreenRange hsPoint3 fAnimStartPos, fAnimEndPos; // Calculated at export time for kMapToScreenRange
float fDragRangeMin, fDragRangeMax; float fDragRangeMin, fDragRangeMax;
// Computed once, once an anim is loaded that we can compute this with // Computed once, once an anim is loaded that we can compute this with
float fAnimBegin, fAnimEnd; float fAnimBegin, fAnimEnd;
hsBool fAnimTimesCalced; hsBool fAnimTimesCalced;
virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval() virtual hsBool IEval( double secs, float del, uint32_t dirty ); // called only by owner object's Eval()
@ -80,7 +80,6 @@ class pfGUIKnobCtrl : public pfGUIValueCtrl
public: public:
pfGUIKnobCtrl(); pfGUIKnobCtrl();
virtual ~pfGUIKnobCtrl();
CLASSNAME_REGISTER( pfGUIKnobCtrl ); CLASSNAME_REGISTER( pfGUIKnobCtrl );
GETINTERFACE_ANY( pfGUIKnobCtrl, pfGUIValueCtrl ); GETINTERFACE_ANY( pfGUIKnobCtrl, pfGUIValueCtrl );
@ -109,7 +108,7 @@ class pfGUIKnobCtrl : public pfGUIValueCtrl
virtual void SetCurrValue( float v ); virtual void SetCurrValue( float v );
// Export only // Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name ); void SetAnimationKeys( hsTArray<plKey> &keys, const plString &name );
void SetScreenRange( const hsPoint3 &startPos, const hsPoint3 &endPos ) { fAnimStartPos = startPos; fAnimEndPos = endPos; } void SetScreenRange( const hsPoint3 &startPos, const hsPoint3 &endPos ) { fAnimStartPos = startPos; fAnimEndPos = endPos; }
}; };

19
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.cpp

@ -72,15 +72,9 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
pfGUIProgressCtrl::pfGUIProgressCtrl() : fStopSoundTimer(99) pfGUIProgressCtrl::pfGUIProgressCtrl() : fStopSoundTimer(99)
{ {
fAnimTimesCalced = false; fAnimTimesCalced = false;
fAnimName = nil;
fPlaySound = true; fPlaySound = true;
} }
pfGUIProgressCtrl::~pfGUIProgressCtrl()
{
delete [] fAnimName;
}
//// IEval /////////////////////////////////////////////////////////////////// //// IEval ///////////////////////////////////////////////////////////////////
hsBool pfGUIProgressCtrl::IEval( double secs, float del, uint32_t dirty ) hsBool pfGUIProgressCtrl::IEval( double secs, float del, uint32_t dirty )
@ -114,7 +108,7 @@ void pfGUIProgressCtrl::Read( hsStream *s, hsResMgr *mgr )
uint32_t i, count = s->ReadLE32(); uint32_t i, count = s->ReadLE32();
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) ); fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString(); fAnimName = s->ReadSafeString_TEMP();
fAnimTimesCalced = false; fAnimTimesCalced = false;
} }
@ -141,17 +135,10 @@ void pfGUIProgressCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool forc
//// SetAnimationKeys //////////////////////////////////////////////////////// //// SetAnimationKeys ////////////////////////////////////////////////////////
void pfGUIProgressCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *name ) void pfGUIProgressCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const plString &name )
{ {
fAnimationKeys = keys; fAnimationKeys = keys;
delete [] fAnimName; fAnimName = name;
if( name != nil )
{
fAnimName = new char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
} }
//// ICalcAnimTimes ////////////////////////////////////////////////////////// //// ICalcAnimTimes //////////////////////////////////////////////////////////

9
Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.h

@ -58,10 +58,10 @@ class pfGUIProgressCtrl : public pfGUIValueCtrl
protected: protected:
hsTArray<plKey> fAnimationKeys; hsTArray<plKey> fAnimationKeys;
char *fAnimName; plString fAnimName;
// Computed once, once an anim is loaded that we can compute this with // Computed once, once an anim is loaded that we can compute this with
float fAnimBegin, fAnimEnd; float fAnimBegin, fAnimEnd;
hsBool fAnimTimesCalced; hsBool fAnimTimesCalced;
hsBool fPlaySound; hsBool fPlaySound;
@ -69,12 +69,11 @@ class pfGUIProgressCtrl : public pfGUIValueCtrl
hsBool ICalcAnimTimes( void ); hsBool ICalcAnimTimes( void );
const uint32_t fStopSoundTimer; const uint32_t fStopSoundTimer;
public: public:
pfGUIProgressCtrl(); pfGUIProgressCtrl();
virtual ~pfGUIProgressCtrl();
CLASSNAME_REGISTER( pfGUIProgressCtrl ); CLASSNAME_REGISTER( pfGUIProgressCtrl );
GETINTERFACE_ANY( pfGUIProgressCtrl, pfGUIValueCtrl ); GETINTERFACE_ANY( pfGUIProgressCtrl, pfGUIValueCtrl );
@ -103,7 +102,7 @@ class pfGUIProgressCtrl : public pfGUIValueCtrl
void DontPlaySounds() { fPlaySound = false; } void DontPlaySounds() { fPlaySound = false; }
// Export only // Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name ); void SetAnimationKeys( hsTArray<plKey> &keys, const plString &name );
}; };
#endif // _pfGUIProgressCtrl_h #endif // _pfGUIProgressCtrl_h

4
Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp

@ -867,7 +867,7 @@ void pfBookData::ITriggerPageFlip(hsBool flipBackwards, hsBool immediate)
// in MAX, we just use a GUI check box to grab them for us, even though we never // in MAX, we just use a GUI check box to grab them for us, even though we never
// actually use the functionality of the checkbox itself // actually use the functionality of the checkbox itself
const hsTArray<plKey> &keys = fTurnPageButton->GetAnimationKeys(); const hsTArray<plKey> &keys = fTurnPageButton->GetAnimationKeys();
const char *animName = fTurnPageButton->GetAnimationName(); plString animName = fTurnPageButton->GetAnimationName();
plAnimCmdMsg *msg = new plAnimCmdMsg(); plAnimCmdMsg *msg = new plAnimCmdMsg();
if (immediate) if (immediate)
@ -1474,7 +1474,7 @@ void pfJournalBook::ITriggerCloseWithNotify( hsBool closeNotOpen, hsBool imme
fBookGUIs[fCurBookGUI]->CurrentlyOpen(!closeNotOpen); fBookGUIs[fCurBookGUI]->CurrentlyOpen(!closeNotOpen);
const hsTArray<plKey> &keys = fBookGUIs[fCurBookGUI]->CoverButton()->GetAnimationKeys(); const hsTArray<plKey> &keys = fBookGUIs[fCurBookGUI]->CoverButton()->GetAnimationKeys();
const char *animName = fBookGUIs[fCurBookGUI]->CoverButton()->GetAnimationName(); plString animName = fBookGUIs[fCurBookGUI]->CoverButton()->GetAnimationName();
plAnimCmdMsg *msg = new plAnimCmdMsg(); plAnimCmdMsg *msg = new plAnimCmdMsg();
if( !immediate ) if( !immediate )

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

@ -174,7 +174,7 @@ plKey cyAvatar::IFindArmatureModKey(plKey avKey)
// PURPOSE : oneShot Avatar (must already be there) // PURPOSE : oneShot Avatar (must already be there)
// //
void cyAvatar::OneShot(pyKey &seekKey, float duration, hsBool usePhysics, void cyAvatar::OneShot(pyKey &seekKey, float duration, hsBool usePhysics,
const char *animName, hsBool drivable, hsBool reversible) const plString &animName, hsBool drivable, hsBool reversible)
{ {
if ( fRecvr.Count() > 0 ) if ( fRecvr.Count() > 0 )
{ {
@ -185,7 +185,7 @@ void cyAvatar::OneShot(pyKey &seekKey, float duration, hsBool usePhysics,
seekKey.getKey(), // Mark D told me to do it ...paulg seekKey.getKey(), // Mark D told me to do it ...paulg
duration, duration,
usePhysics, usePhysics,
animName, // Constructor will do a copy. -mf- hsStrcpy(animName), animName,
drivable, drivable,
reversible); reversible);
@ -1586,7 +1586,7 @@ void cyAvatar::ExitSubWorld()
// //
// PURPOSE : Place the Avatar into the subworld of the sceneobject specified // PURPOSE : Place the Avatar into the subworld of the sceneobject specified
// //
void cyAvatar::PlaySimpleAnimation(const char* animName) void cyAvatar::PlaySimpleAnimation(const plString& animName)
{ {
// make sure that there is atleast one avatar scene object attached (should be) // make sure that there is atleast one avatar scene object attached (should be)
if ( fRecvr.Count() > 0) if ( fRecvr.Count() > 0)

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

@ -103,7 +103,7 @@ public:
// oneShot Avatar (must already be there) // oneShot Avatar (must already be there)
virtual void OneShot(pyKey &seekKey, float duration, hsBool usePhysics, virtual void OneShot(pyKey &seekKey, float duration, hsBool usePhysics,
const char *animName, hsBool drivable, hsBool reversible); const plString &animName, hsBool drivable, hsBool reversible);
// oneShot Avatar // oneShot Avatar
virtual void RunBehavior(pyKey &behKey, hsBool netForce, hsBool netProp); virtual void RunBehavior(pyKey &behKey, hsBool netForce, hsBool netProp);
@ -412,7 +412,7 @@ public:
// //
virtual void ExitSubWorld(); virtual void ExitSubWorld();
virtual void PlaySimpleAnimation(const char* animName); virtual void PlaySimpleAnimation(const plString& animName);
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //

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

@ -89,8 +89,7 @@ PYTHON_METHOD_DEFINITION(ptAvatar, oneShot, args)
} }
pyKey* key = pyKey::ConvertFrom(keyObj); pyKey* key = pyKey::ConvertFrom(keyObj);
std::string animNameStr = animName; // convert to string (for safety) self->fThis->OneShot(*key, duration, usePhysics != 0, plString::FromUtf8(animName), drivable != 0, reversable != 0);
self->fThis->OneShot(*key, duration, usePhysics != 0, animNameStr.c_str(), drivable != 0, reversable != 0);
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
} }
@ -592,8 +591,7 @@ PYTHON_METHOD_DEFINITION(ptAvatar, playSimpleAnimation, args)
PYTHON_RETURN_ERROR; PYTHON_RETURN_ERROR;
} }
std::string animNameStr = animName; // convert to a string (for safety) self->fThis->PlaySimpleAnimation(plString::FromUtf8(animName));
self->fThis->PlaySimpleAnimation(animNameStr.c_str());
PYTHON_RETURN_NONE; PYTHON_RETURN_NONE;
} }

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

@ -629,23 +629,23 @@ 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 = plString::FromUtf8(parameter.datarecord.fString); comp.name = parameter.fString;
fNamedCompQueue.Append(comp); fNamedCompQueue.Append(comp);
} }
else else
{ {
if (isNamedAttr == 1) if (isNamedAttr == 1)
IFindActivatorAndAdd(plString::FromUtf8(parameter.datarecord.fString), parameter.fID); IFindActivatorAndAdd(parameter.fString, parameter.fID);
else else
IFindResponderAndAdd(plString::FromUtf8(parameter.datarecord.fString), parameter.fID); IFindResponderAndAdd(parameter.fString, parameter.fID);
} }
} }
} }
// if it wasn't a named string then must be normal string type // if it wasn't a named string then must be normal string type
if ( isNamedAttr == 0 ) if ( isNamedAttr == 0 )
if ( parameter.datarecord.fString != nil ) if ( !parameter.fString.IsNull() )
value = PyString_FromString(parameter.datarecord.fString); value = PyString_FromString(parameter.fString.c_str());
break; break;
case plPythonParameter::kSceneObject: case plPythonParameter::kSceneObject:
case plPythonParameter::kSceneObjectList: case plPythonParameter::kSceneObjectList:

37
Sources/Plasma/FeatureLib/pfPython/plPythonParameter.h

@ -94,17 +94,16 @@ public:
// the data of the value // the data of the value
union union
{ {
int32_t fIntNumber; int32_t fIntNumber;
float fFloatNumber; float fFloatNumber;
hsBool fBool; hsBool fBool;
char* fString;
} datarecord; } datarecord;
plKey fObjectKey; // the plKey of the scene object (should be part of the union, but unions don't allow complex types) plKey fObjectKey; // the plKey of the scene object (should be part of the union, but unions don't allow complex types)
plString fString;
plPythonParameter() plPythonParameter()
@ -147,7 +146,7 @@ public:
SetTobool(other.datarecord.fBool); SetTobool(other.datarecord.fBool);
break; break;
case kString: case kString:
SetToString(other.datarecord.fString); SetToString(other.fString);
break; break;
case kSceneObject: case kSceneObject:
SetToSceneObject(other.fObjectKey); SetToSceneObject(other.fObjectKey);
@ -174,7 +173,7 @@ public:
SetToAnimation(other.fObjectKey); SetToAnimation(other.fObjectKey);
break; break;
case kAnimationName: case kAnimationName:
SetToAnimationName(other.datarecord.fString); SetToAnimationName(other.fString);
break; break;
case kBehavior: case kBehavior:
SetToBehavior(other.fObjectKey); SetToBehavior(other.fObjectKey);
@ -214,10 +213,6 @@ public:
void SetToNone() void SetToNone()
{ {
// remove the string if one was created
if ( fValueType == kString || fValueType == kAnimationName )
delete [] datarecord.fString;
fValueType = kNone; fValueType = kNone;
} }
@ -239,11 +234,11 @@ public:
fValueType = kbool; fValueType = kbool;
datarecord.fBool = state; datarecord.fBool = state;
} }
void SetToString(const char* string) void SetToString(const plString& string)
{ {
SetToNone(); SetToNone();
fValueType = kString; fValueType = kString;
datarecord.fString = hsStrcpy(string); fString = string;
} }
void SetToSceneObject(plKey key, hsBool list=false) void SetToSceneObject(plKey key, hsBool list=false)
{ {
@ -302,11 +297,11 @@ public:
fValueType = kAnimation; fValueType = kAnimation;
fObjectKey = key; fObjectKey = key;
} }
void SetToAnimationName(const char* string) void SetToAnimationName(const plString& string)
{ {
SetToNone(); SetToNone();
fValueType = kAnimationName; fValueType = kAnimationName;
datarecord.fString = hsStrcpy(string); fString = string;
} }
void SetToBehavior(plKey key) void SetToBehavior(plKey key)
{ {
@ -380,11 +375,13 @@ public:
count = stream->ReadLE32(); count = stream->ReadLE32();
if ( count != 0 ) if ( count != 0 )
{ {
datarecord.fString = new char[count+1]; char *buffer = new char[count];
stream->ReadLE(count,datarecord.fString); stream->ReadLE(count, buffer);
buffer[count-1] = 0;
fString = plString::Steal(buffer, count);
} }
else else
datarecord.fString = nil; fString = plString::Null;
break; break;
case kSceneObject: case kSceneObject:
@ -430,13 +427,13 @@ public:
case kString: case kString:
case kAnimationName: case kAnimationName:
if ( datarecord.fString != nil ) if ( !fString.IsNull() )
count = hsStrlen(datarecord.fString)+1; count = fString.GetSize()+1;
else else
count = 0; count = 0;
stream->WriteLE(count); stream->WriteLE(count);
if ( count != 0 ) if ( count != 0 )
stream->WriteLE(count,datarecord.fString); stream->WriteLE(count, fString.c_str());
break; break;
case kSceneObject: case kSceneObject:

8
Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.cpp

@ -109,24 +109,24 @@ std::string pyCritterBrain::BehaviorName(int behavior) const
return fBrain->BehaviorName(behavior); return fBrain->BehaviorName(behavior);
} }
std::string pyCritterBrain::AnimationName(int behavior) const plString pyCritterBrain::AnimationName(int behavior) const
{ {
if (!fBrain) if (!fBrain)
return false; return plString::Null;
return fBrain->AnimationName(behavior); return fBrain->AnimationName(behavior);
} }
int pyCritterBrain::CurBehavior() const int pyCritterBrain::CurBehavior() const
{ {
if (!fBrain) if (!fBrain)
return false; return 0;
return fBrain->CurBehavior(); return fBrain->CurBehavior();
} }
int pyCritterBrain::NextBehavior() const int pyCritterBrain::NextBehavior() const
{ {
if (!fBrain) if (!fBrain)
return false; return 0;
return fBrain->NextBehavior(); return fBrain->NextBehavior();
} }

2
Sources/Plasma/FeatureLib/pfPython/pyCritterBrain.h

@ -92,7 +92,7 @@ public:
bool RunningBehavior(const std::string& behaviorName) const; bool RunningBehavior(const std::string& behaviorName) const;
std::string BehaviorName(int behavior) const; std::string BehaviorName(int behavior) const;
std::string AnimationName(int behavior) const; plString AnimationName(int behavior) const;
int CurBehavior() const; int CurBehavior() const;
int NextBehavior() const; int NextBehavior() const;

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

@ -208,7 +208,7 @@ void plUoid::Write(hsStream* s) const
s->WriteLE( fClassType ); s->WriteLE( fClassType );
s->WriteLE( fObjectID ); s->WriteLE( fObjectID );
s->WriteSafeString_TEMP( fObjectName ); s->WriteSafeString( fObjectName );
// conditional cloneIDs write // conditional cloneIDs write
if (contents & kHasCloneIDs) if (contents & kHasCloneIDs)

3
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtSubst.cpp

@ -157,8 +157,7 @@ bool IParseForSubst (
} }
// Validate variable name length // Validate variable name length
chartype varBuffer[256]; if (varEnd - varStart >= 256) {
if (varEnd - varStart >= arrsize(varBuffer)) {
result = false; result = false;
src = current = varEnd + 1; src = current = varEnd + 1;
continue; continue;

78
Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.cpp

@ -76,31 +76,24 @@ plAGAnim::plAnimMap plAGAnim::fAllAnims;
plAGAnim::plAGAnim() plAGAnim::plAGAnim()
: plSynchedObject() : plSynchedObject()
{ {
fName = nil;
} }
// ctor ------------------------------------------------------ // ctor ------------------------------------------------------
// ----- // -----
plAGAnim::plAGAnim(const char *name, double start, double end) plAGAnim::plAGAnim(const plString &name, double start, double end)
: fStart((float)start), : fStart((float)start),
fEnd((float)end) fEnd((float)end),
fName(name)
{ {
if (name == nil)
name = "";
fName = new char[strlen(name) + 1];
strcpy(fName, name);
} }
// dtor ------------- // dtor -------------
// ----- // -----
plAGAnim::~plAGAnim() plAGAnim::~plAGAnim()
{ {
if (fName) if (!fName.IsNull())
{ {
RemoveAnim(fName); RemoveAnim(fName);
delete[] fName;
fName = nil;
} }
//int numChannels = fChannels.size(); //int numChannels = fChannels.size();
@ -137,7 +130,7 @@ plAGChannel * plAGAnim::GetChannel(int index) const
// GetChannel -------------------------------------------- // GetChannel --------------------------------------------
// ----------- // -----------
plAGChannel * plAGAnim::GetChannel(const char *name) const plAGChannel * plAGAnim::GetChannel(const plString &name) const
{ {
int appCount = fApps.size(); int appCount = fApps.size();
@ -145,9 +138,9 @@ plAGChannel * plAGAnim::GetChannel(const char *name) const
{ {
plAGApplicator *app = fApps[i]; plAGApplicator *app = fApps[i];
plAGChannel *channel = app->GetChannel(); plAGChannel *channel = app->GetChannel();
const char *channelName = app->GetChannelName(); plString channelName = app->GetChannelName();
if(stricmp(name, channelName) == 0) if(name.Compare(channelName, plString::kCaseInsensitive) == 0)
{ {
return channel; return channel;
} }
@ -205,7 +198,7 @@ void plAGAnim::ExtendToLength(float length)
// GetChannelName ------------------------------ // GetChannelName ------------------------------
// --------------- // ---------------
const char * plAGAnim::GetChannelName(int index) plString plAGAnim::GetChannelName(int index)
{ {
hsAssert(index < fApps.size(), "Out of range index for plAGAnim::GetChannelName()"); hsAssert(index < fApps.size(), "Out of range index for plAGAnim::GetChannelName()");
@ -213,7 +206,7 @@ const char * plAGAnim::GetChannelName(int index)
{ {
return fApps[index]->GetChannel()->GetName(); return fApps[index]->GetChannel()->GetName();
} else { } else {
return nil; return plString::Null;
} }
} }
@ -224,7 +217,7 @@ void plAGAnim::Read(hsStream *stream, hsResMgr *mgr)
plSynchedObject::Read(stream, mgr); plSynchedObject::Read(stream, mgr);
// read in the name of the animation itself // read in the name of the animation itself
fName = stream->ReadSafeString(); fName = stream->ReadSafeString_TEMP();
fStart = stream->ReadLEScalar(); fStart = stream->ReadLEScalar();
fEnd = stream->ReadLEScalar(); fEnd = stream->ReadLEScalar();
@ -279,11 +272,11 @@ void plAGAnim::ClearAnimationRegistry()
// AddAnim ---------------------------------------------- // AddAnim ----------------------------------------------
// -------- // --------
void plAGAnim::AddAnim(const char * name, plAGAnim *anim) void plAGAnim::AddAnim(const plString & name, plAGAnim *anim)
{ {
// Only register the animation if it's got a "real" name. Unnamed animations // Only register the animation if it's got a "real" name. Unnamed animations
// all get the same standard name. // all get the same standard name.
if(strcmp(name, ENTIRE_ANIMATION_NAME) != 0) if(name.Compare(ENTIRE_ANIMATION_NAME) != 0)
{ {
hsAssert(anim, "registering nil anim"); hsAssert(anim, "registering nil anim");
fAllAnims[name] = anim; fAllAnims[name] = anim;
@ -292,7 +285,7 @@ void plAGAnim::AddAnim(const char * name, plAGAnim *anim)
// FindAnim ----------------------------------- // FindAnim -----------------------------------
// --------- // ---------
plAGAnim * plAGAnim::FindAnim(const char *name) plAGAnim * plAGAnim::FindAnim(const plString &name)
{ {
plAnimMap::iterator i = fAllAnims.find(name); plAnimMap::iterator i = fAllAnims.find(name);
@ -306,7 +299,7 @@ plAGAnim * plAGAnim::FindAnim(const char *name)
// RemoveAnim ------------------------------- // RemoveAnim -------------------------------
// ----------- // -----------
hsBool plAGAnim::RemoveAnim(const char *name) hsBool plAGAnim::RemoveAnim(const plString &name)
{ {
plAnimMap::iterator i = fAllAnims.find(name); plAnimMap::iterator i = fAllAnims.find(name);
@ -328,8 +321,8 @@ void plAGAnim::DumpAnimationRegistry()
do { do {
plAGAnim *anim = (*i).second; plAGAnim *anim = (*i).second;
const char *name = anim->GetName(); plString name = anim->GetName();
hsStatusMessageF("GLOBAL ANIMS [%d]: <%s>", j++, name); hsStatusMessageF("GLOBAL ANIMS [%d]: <%s>", j++, name.c_str());
} while(++i != fAllAnims.end()); } while(++i != fAllAnims.end());
} }
@ -342,7 +335,7 @@ hsBool plAGAnim::SharesPinsWith(const plAGAnim *anim) const
{ {
for (j = 0; j < anim->fApps.size(); j++) for (j = 0; j < anim->fApps.size(); j++)
{ {
if (!strcmp(fApps[i]->GetChannelName(), anim->fApps[j]->GetChannelName()) && if (!fApps[i]->GetChannelName().Compare(anim->fApps[j]->GetChannelName()) &&
fApps[i]->CanBlend(anim->fApps[j])) fApps[i]->CanBlend(anim->fApps[j]))
{ {
return true; return true;
@ -367,7 +360,7 @@ plATCAnim::plATCAnim()
// ctor -------------------------------------------------------- // ctor --------------------------------------------------------
// ----- // -----
plATCAnim::plATCAnim(const char *name, double start, double end) plATCAnim::plATCAnim(const plString &name, double start, double end)
: plAGAnim(name, start, end), : plAGAnim(name, start, end),
fInitial(-1), fInitial(-1),
fAutoStart(true), fAutoStart(true),
@ -389,11 +382,7 @@ plATCAnim::plATCAnim(const char *name, double start, double end)
// ----- // -----
plATCAnim::~plATCAnim() plATCAnim::~plATCAnim()
{ {
for (MarkerMap::iterator it = fMarkers.begin(); it != fMarkers.end(); it++)
delete [] (char*)it->first;
fMarkers.clear(); fMarkers.clear();
for( LoopMap::iterator it2 = fLoops.begin(); it2 != fLoops.end(); it2++ )
delete [] (char *)it2->first;
fLoops.clear(); fLoops.clear();
fStopPoints.clear(); fStopPoints.clear();
} }
@ -423,7 +412,7 @@ void plATCAnim::Read(hsStream *stream, hsResMgr *mgr)
int numMarkers = stream->ReadLE32(); int numMarkers = stream->ReadLE32();
for (i = 0; i < numMarkers; i++) for (i = 0; i < numMarkers; i++)
{ {
char *name = stream->ReadSafeString(); plString name = stream->ReadSafeString_TEMP();
float time = stream->ReadLEFloat(); float time = stream->ReadLEFloat();
fMarkers[name] = time; fMarkers[name] = time;
} }
@ -431,7 +420,7 @@ void plATCAnim::Read(hsStream *stream, hsResMgr *mgr)
int numLoops = stream->ReadLE32(); int numLoops = stream->ReadLE32();
for (i = 0; i < numLoops; i++) for (i = 0; i < numLoops; i++)
{ {
char *name = stream->ReadSafeString(); plString name = stream->ReadSafeString_TEMP();
float begin = stream->ReadLEScalar(); float begin = stream->ReadLEScalar();
float end = stream->ReadLEScalar(); float end = stream->ReadLEScalar();
fLoops[name] = std::pair<float,float>(begin,end); fLoops[name] = std::pair<float,float>(begin,end);
@ -498,15 +487,14 @@ void plATCAnim::CheckLoop()
// AddLoop ------------------------------------------------------ // AddLoop ------------------------------------------------------
// -------- // --------
void plATCAnim::AddLoop(const char *name, float start, float end) void plATCAnim::AddLoop(const plString &name, float start, float end)
{ {
char *nameCpy = hsStrcpy(name); fLoops[name] = std::pair<float,float>(start, end);
fLoops[nameCpy] = std::pair<float,float>(start, end);
} }
// GetLoop -------------------------------------------------------------- // GetLoop --------------------------------------------------------------
// -------- // --------
bool plATCAnim::GetLoop(const char *name, float &start, float &end) const bool plATCAnim::GetLoop(const plString &name, float &start, float &end) const
{ {
LoopMap::const_iterator it = fLoops.find(name); LoopMap::const_iterator it = fLoops.find(name);
if (it != fLoops.end()) if (it != fLoops.end())
@ -549,15 +537,14 @@ uint32_t plATCAnim::GetNumLoops() const
// AddMarker ------------------------------------------ // AddMarker ------------------------------------------
// ---------- // ----------
void plATCAnim::AddMarker(const char *name, float time) void plATCAnim::AddMarker(const plString &name, float time)
{ {
char *nameCpy = hsStrcpy(name); fMarkers[name] = time;
fMarkers[nameCpy] = time;
} }
// GetMarker ------------------------------------- // GetMarker -------------------------------------
// ---------- // ----------
float plATCAnim::GetMarker(const char *name) const float plATCAnim::GetMarker(const plString &name) const
{ {
if (fMarkers.find(name) != fMarkers.end()) if (fMarkers.find(name) != fMarkers.end())
return (*fMarkers.find(name)).second; return (*fMarkers.find(name)).second;
@ -566,13 +553,14 @@ float plATCAnim::GetMarker(const char *name) const
// CopyMarkerNames ------------------------------------- // CopyMarkerNames -------------------------------------
// ---------------- // ----------------
void plATCAnim::CopyMarkerNames(std::vector<char*> &out) void plATCAnim::CopyMarkerNames(std::vector<plString> &out)
{ {
MarkerMap::iterator it = fMarkers.begin(); MarkerMap::iterator it = fMarkers.begin();
out.reserve(fMarkers.size());
for (; it != fMarkers.end(); it++) for (; it != fMarkers.end(); it++)
{ {
out.push_back(hsStrcpy((*it).first)); out.push_back((*it).first);
} }
} }
@ -613,7 +601,7 @@ plEmoteAnim::plEmoteAnim()
// ctor ------------------------------------------------------------------------------ // ctor ------------------------------------------------------------------------------
// ----- // -----
plEmoteAnim::plEmoteAnim(const char *animName, double begin, double end, float fadeIn, plEmoteAnim::plEmoteAnim(const plString &animName, double begin, double end, float fadeIn,
float fadeOut, BodyUsage bodyUsage) float fadeOut, BodyUsage bodyUsage)
: plATCAnim(animName, begin, end), : plATCAnim(animName, begin, end),
fFadeIn(fadeIn), fFadeIn(fadeIn),
@ -682,7 +670,7 @@ plAgeGlobalAnim::plAgeGlobalAnim()
// ctor -------------------------------------------------------------------- // ctor --------------------------------------------------------------------
// ----- // -----
plAgeGlobalAnim::plAgeGlobalAnim(const char *name, double start, double end) plAgeGlobalAnim::plAgeGlobalAnim(const plString &name, double start, double end)
: plAGAnim(name, start, end), : plAGAnim(name, start, end),
fGlobalVarName(nil) fGlobalVarName(nil)
{ {
@ -729,7 +717,7 @@ void plAgeGlobalAnim::Write(hsStream *stream, hsResMgr *mgr)
// GetStartToEndTransform ----------------------------------------------- // GetStartToEndTransform -----------------------------------------------
bool GetStartToEndTransform(const plAGAnim *anim, hsMatrix44 *startToEnd, bool GetStartToEndTransform(const plAGAnim *anim, hsMatrix44 *startToEnd,
hsMatrix44 *endToStart, const char *channelName) hsMatrix44 *endToStart, const plString &channelName)
{ {
double start = 0.0f; // assumed double start = 0.0f; // assumed
double end = anim->GetEnd(); double end = anim->GetEnd();
@ -740,7 +728,7 @@ bool GetStartToEndTransform(const plAGAnim *anim, hsMatrix44 *startToEnd,
// GetRelativeTransform --------------------------------------------------- // GetRelativeTransform ---------------------------------------------------
bool GetRelativeTransform(const plAGAnim *anim, double timeA, double timeB, bool GetRelativeTransform(const plAGAnim *anim, double timeA, double timeB,
hsMatrix44 *a2b, hsMatrix44 *b2a, const char *channelName) hsMatrix44 *a2b, hsMatrix44 *b2a, const plString &channelName)
{ {
bool result = false; bool result = false;
plAGChannel *maybeChannel = anim->GetChannel(channelName); plAGChannel *maybeChannel = anim->GetChannel(channelName);

48
Sources/Plasma/PubUtilLib/plAvatar/plAGAnim.h

@ -92,7 +92,7 @@ public:
plAGAnim(); plAGAnim();
/** Construct with name, start time, and end time (within the max note track) /** Construct with name, start time, and end time (within the max note track)
*/ */
plAGAnim(const char *name, double begin, double end); plAGAnim(const plString &name, double begin, double end);
/** Destruct, freeing the underlying animation data. */ /** Destruct, freeing the underlying animation data. */
virtual ~plAGAnim(); virtual ~plAGAnim();
@ -112,12 +112,12 @@ public:
/** Get the name of the channel having the given index. Useful for talking to an /** Get the name of the channel having the given index. Useful for talking to an
an animation before it is applied and finding out what channels it's going to an animation before it is applied and finding out what channels it's going to
affect. */ affect. */
virtual const char * GetChannelName(int index); virtual plString GetChannelName(int index);
/** Get channel by name. This corresponds to the name of the scene object this channel /** Get channel by name. This corresponds to the name of the scene object this channel
will be attached to when the animation is applied. will be attached to when the animation is applied.
This function is fairly slow and shouldn't be used often. */ This function is fairly slow and shouldn't be used often. */
plAGChannel * GetChannel(const char *name) const; plAGChannel * GetChannel(const plString &name) const;
/** Return the number of applicators held by this animation. An applicator is used /** Return the number of applicators held by this animation. An applicator is used
to attach a channel to a sceneobject. */ to attach a channel to a sceneobject. */
@ -141,7 +141,7 @@ public:
by the avatar or from script, but most of the functions which take an animation by the avatar or from script, but most of the functions which take an animation
name (such as AttachAnimation on the plAGMasterMod) will also take an pointer name (such as AttachAnimation on the plAGMasterMod) will also take an pointer
to a plAGAnim. */ to a plAGAnim. */
virtual const char * GetName() const { return fName; } virtual plString GetName() const { return fName; }
/** Return the length of the animation; end - start. */ /** Return the length of the animation; end - start. */
virtual float GetLength() const { return fEnd - fStart; } virtual float GetLength() const { return fEnd - fStart; }
@ -176,12 +176,12 @@ public:
/** Add the animation by name to a global static registry. /** Add the animation by name to a global static registry.
This functionality will possibly be added to the resource This functionality will possibly be added to the resource
manager. */ manager. */
static void AddAnim(const char * name, plAGAnim *anim); static void AddAnim(const plString & name, plAGAnim *anim);
/** See if there is an animation with the given name in the /** See if there is an animation with the given name in the
global animation registry. */ global animation registry. */
static plAGAnim *FindAnim(const char *name); static plAGAnim *FindAnim(const plString &name);
/** Remove the given animation from the registry. */ /** Remove the given animation from the registry. */
static hsBool RemoveAnim(const char *name); static hsBool RemoveAnim(const plString &name);
/** Clear the animation cache. Used when resetting the client /** Clear the animation cache. Used when resetting the client
to a vanilla state, as when clearing the scene while to a vanilla state, as when clearing the scene while
exporting. */ exporting. */
@ -199,17 +199,17 @@ protected:
ApplicatorVec fApps; /// our animation channels ApplicatorVec fApps; /// our animation channels
float fBlend; /// requested blend factor float fBlend; /// requested blend factor
float fStart; /// the start time of the beginning of the animation (usually 0) float fStart; /// the start time of the beginning of the animation (usually 0)
float fEnd; /// the end time of the animation float fEnd; /// the end time of the animation
char *fName; /// the name of our animation plString fName; /// the name of our animation
// ??? Can this be moved to the resource manager? If it can manage an efficient // ??? Can this be moved to the resource manager? If it can manage an efficient
// string-based namespace per class, we could get rid of this. // string-based namespace per class, we could get rid of this.
typedef std::map<const char *, plAGAnim *, stringISorter> plAnimMap; // typedef std::map<plString, plAGAnim *, plString::less_i> plAnimMap; //
static plAnimMap fAllAnims; /// map of animation names to animations static plAnimMap fAllAnims; /// map of animation names to animations
typedef std::map<const char *, plEmoteAnim *, stringISorter> plEmoteMap; typedef std::map<plString, plEmoteAnim *, plString::less_i> plEmoteMap;
static plEmoteMap fAllEmotes; static plEmoteMap fAllEmotes;
}; };
@ -230,7 +230,7 @@ public:
plATCAnim(); plATCAnim();
/** Construct with name, start time, and end time (within the max note track) /** Construct with name, start time, and end time (within the max note track)
Default is to start automatically, not loop, with no ease curves. */ Default is to start automatically, not loop, with no ease curves. */
plATCAnim(const char *name, double begin, double end); plATCAnim(const plString &name, double begin, double end);
/** Destruct, freeing the underlying animation data. */ /** Destruct, freeing the underlying animation data. */
virtual ~plATCAnim(); virtual ~plATCAnim();
@ -305,11 +305,11 @@ public:
/** Animations can have multiple defined loop segments; these /** Animations can have multiple defined loop segments; these
are selected using animation control messages. are selected using animation control messages.
Each loop segment is named using markers in the notetrack. */ Each loop segment is named using markers in the notetrack. */
void AddLoop(const char *name, float start, float end); void AddLoop(const plString &name, float start, float end);
/** Get the loop having the given name. /** Get the loop having the given name.
\param start will return the start time of the loop. \param start will return the start time of the loop.
\param end will hold the end time of the loop */ \param end will hold the end time of the loop */
bool GetLoop(const char *name, float &start, float &end) const; bool GetLoop(const plString &name, float &start, float &end) const;
/** Lets you get a loop by index instead of name. */ /** Lets you get a loop by index instead of name. */
bool GetLoop(uint32_t num, float &start, float &end) const; bool GetLoop(uint32_t num, float &start, float &end) const;
/** Returns the number of loops defined on this anim. */ /** Returns the number of loops defined on this anim. */
@ -318,10 +318,10 @@ public:
/** Add a marker to the animation. Markers can be used /** Add a marker to the animation. Markers can be used
for callbacks or for goto comands. A marker is a simple for callbacks or for goto comands. A marker is a simple
name/time tuple. */ name/time tuple. */
void AddMarker(const char *name, float time); void AddMarker(const plString &name, float time);
/** Returns the time value of the marker named by name. */ /** Returns the time value of the marker named by name. */
float GetMarker(const char *name) const; float GetMarker(const plString &name) const;
void CopyMarkerNames(std::vector<char*> &out); void CopyMarkerNames(std::vector<plString> &out);
/** Add a stop point to the animation. A stop point is a /** Add a stop point to the animation. A stop point is a
"detent" for playback - if the animation is stopping "detent" for playback - if the animation is stopping
near a stop point and fading out, the stop point will near a stop point and fading out, the stop point will
@ -363,10 +363,10 @@ protected:
float fEaseOutMax; /// maximum (initial) value of our ease-out float fEaseOutMax; /// maximum (initial) value of our ease-out
// a map from segment names to times // a map from segment names to times
typedef std::map<const char *, float, stringSorter> MarkerMap; typedef std::map<plString, float> MarkerMap;
MarkerMap fMarkers; MarkerMap fMarkers;
typedef std::map<const char *, std::pair<float,float>, stringSorter> LoopMap; typedef std::map<plString, std::pair<float,float> > LoopMap;
LoopMap fLoops; LoopMap fLoops;
typedef std::vector<float> ScalarMap; typedef std::vector<float> ScalarMap;
@ -384,7 +384,7 @@ class plEmoteAnim : public plATCAnim
public: public:
plEmoteAnim(); plEmoteAnim();
plEmoteAnim(const char *animName, double begin, double end, float fadeIn, float fadeOut, BodyUsage bodyUsage); plEmoteAnim(const plString &animName, double begin, double end, float fadeIn, float fadeOut, BodyUsage bodyUsage);
BodyUsage GetBodyUsage() const; BodyUsage GetBodyUsage() const;
float GetFadeIn() const; float GetFadeIn() const;
@ -417,7 +417,7 @@ public:
plAgeGlobalAnim(); plAgeGlobalAnim();
/** Construct with name, start time, and end time (within the max note track) /** Construct with name, start time, and end time (within the max note track)
*/ */
plAgeGlobalAnim(const char *name, double begin, double end); plAgeGlobalAnim(const plString &name, double begin, double end);
/** Destruct, freeing the underlying animation data. */ /** Destruct, freeing the underlying animation data. */
virtual ~plAgeGlobalAnim(); virtual ~plAgeGlobalAnim();
@ -438,8 +438,8 @@ protected:
}; };
// USEFUL HELPER FUNCTIONS // USEFUL HELPER FUNCTIONS
bool GetStartToEndTransform(const plAGAnim *anim, hsMatrix44 *startToEnd, hsMatrix44 *endToStart, const char *channelName); bool GetStartToEndTransform(const plAGAnim *anim, hsMatrix44 *startToEnd, hsMatrix44 *endToStart, const plString &channelName);
bool GetRelativeTransform(const plAGAnim *anim, double timeA, double timeB, hsMatrix44 *a2b, hsMatrix44 *b2a, const char *channelName); bool GetRelativeTransform(const plAGAnim *anim, double timeA, double timeB, hsMatrix44 *a2b, hsMatrix44 *b2a, const plString &channelName);

18
Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp

@ -123,7 +123,7 @@ plAGAnimInstance::plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master,
fCleanupChannels.push_back(timeChan); fCleanupChannels.push_back(timeChan);
#ifdef SHOW_AG_CHANGES #ifdef SHOW_AG_CHANGES
hsStatusMessageF("\nAbout to Attach anim <%s>", GetName()); hsStatusMessageF("\nAbout to Attach anim <%s>", GetName().c_str());
fMaster->DumpAniGraph("bone_pelvis", false, hsTimer::GetSysSeconds()); fMaster->DumpAniGraph("bone_pelvis", false, hsTimer::GetSysSeconds());
#endif #endif
@ -131,7 +131,7 @@ plAGAnimInstance::plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master,
{ {
plAGApplicator * app = fAnimation->GetApplicator(i); plAGApplicator * app = fAnimation->GetApplicator(i);
plAGChannel * inChannel = app->GetChannel(); plAGChannel * inChannel = app->GetChannel();
const char * channelName = app->GetChannelName(); plString channelName = app->GetChannelName();
plAGModifier * channelMod = master->GetChannelMod(channelName); plAGModifier * channelMod = master->GetChannelMod(channelName);
if(channelMod) { if(channelMod) {
@ -206,7 +206,7 @@ void plAGAnimInstance::SearchForGlobals()
} }
} }
void plAGAnimInstance::IRegisterDetach(const char *channelName, plAGChannel *channel) void plAGAnimInstance::IRegisterDetach(const plString &channelName, plAGChannel *channel)
{ {
plDetachMap::value_type newPair(channelName, channel); plDetachMap::value_type newPair(channelName, channel);
fManualDetachChannels.insert(newPair); fManualDetachChannels.insert(newPair);
@ -243,14 +243,14 @@ void plAGAnimInstance::Detach()
void plAGAnimInstance::DetachChannels() void plAGAnimInstance::DetachChannels()
{ {
#ifdef SHOW_AG_CHANGES #ifdef SHOW_AG_CHANGES
hsStatusMessageF("\nAbout to DETACH anim <%s>", GetName()); hsStatusMessageF("\nAbout to DETACH anim <%s>", GetName().c_str());
fMaster->DumpAniGraph("bone_pelvis", false, hsTimer::GetSysSeconds()); fMaster->DumpAniGraph("bone_pelvis", false, hsTimer::GetSysSeconds());
#endif #endif
plDetachMap::iterator i = fManualDetachChannels.begin(); plDetachMap::iterator i = fManualDetachChannels.begin();
while(i != fManualDetachChannels.end()) while(i != fManualDetachChannels.end())
{ {
const char *channelName = (*i).first; plString channelName = (*i).first;
plAGModifier *channelMod = fMaster->GetChannelMod(channelName, true); plAGModifier *channelMod = fMaster->GetChannelMod(channelName, true);
if(channelMod) if(channelMod)
@ -274,7 +274,7 @@ void plAGAnimInstance::DetachChannels()
fCleanupChannels.clear(); fCleanupChannels.clear();
#ifdef SHOW_AG_CHANGES #ifdef SHOW_AG_CHANGES
hsStatusMessageF("\nFinished DETACHING anim <%s>", GetName()); hsStatusMessageF("\nFinished DETACHING anim <%s>", GetName().c_str());
fMaster->DumpAniGraph("bone_pelvis", false, hsTimer::GetSysSeconds()); fMaster->DumpAniGraph("bone_pelvis", false, hsTimer::GetSysSeconds());
#endif #endif
} }
@ -323,12 +323,12 @@ float plAGAnimInstance::GetAmplitude()
// GetName ----------------------------- // GetName -----------------------------
// -------- // --------
const char * plAGAnimInstance::GetName() plString plAGAnimInstance::GetName()
{ {
if(fAnimation) if(fAnimation)
return fAnimation->GetName(); return fAnimation->GetName();
else else
return nil; return plString::Null;
} }
// SetLoop ---------------------------------- // SetLoop ----------------------------------
@ -409,7 +409,7 @@ void plAGAnimInstance::AttachCallbacks(plOneShotCallbacks *callbacks)
eventMsg->fRepeats = 0; eventMsg->fRepeats = 0;
eventMsg->fUser = cb.fUser; eventMsg->fUser = cb.fUser;
if (cb.fMarker) if (!cb.fMarker.IsNull())
{ {
float marker = anim->GetMarker(cb.fMarker); float marker = anim->GetMarker(cb.fMarker);
hsAssert(marker != -1, "Bad marker name"); hsAssert(marker != -1, "Bad marker name");

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

@ -192,7 +192,7 @@ public:
hsBool IsAtEnd(); hsBool IsAtEnd();
/** Get the name of the underlying animation. */ /** Get the name of the underlying animation. */
const char * GetName(); plString GetName();
/** Remove all channels from the master mode and remove us from /** Remove all channels from the master mode and remove us from
our master modifier. our master modifier.
@ -224,14 +224,14 @@ protected:
/** Set up bookkeeping for a fade. */ /** Set up bookkeeping for a fade. */
void ISetupFade(float goal, float rate, bool detach, uint8_t type); void ISetupFade(float goal, float rate, bool detach, uint8_t type);
void IRegisterDetach(const char *channelName, plAGChannel *channel); void IRegisterDetach(const plString &channelName, plAGChannel *channel);
const plAGAnim * fAnimation; const plAGAnim * fAnimation;
plAGMasterMod * fMaster; plAGMasterMod * fMaster;
std::map<char *, plAGChannelApplicator *, stringISorter> fChannels; std::map<plString, plAGChannelApplicator *, plString::less_i> fChannels;
typedef std::multimap<const char *, plAGChannel *> plDetachMap; typedef std::multimap<plString, plAGChannel *> plDetachMap;
plDetachMap fManualDetachChannels; plDetachMap fManualDetachChannels;
std::vector<plAGChannel*> fCleanupChannels; std::vector<plAGChannel*> fCleanupChannels;

19
Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.cpp

@ -48,24 +48,21 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// ----- // -----
plAGApplicator::plAGApplicator() plAGApplicator::plAGApplicator()
: fChannel(nil), : fChannel(nil),
fChannelName(nil),
fEnabled(true) fEnabled(true)
{ {
}; };
// ctor ------------------------------- // ctor -------------------------------
// ----- // -----
plAGApplicator::plAGApplicator(const char *channelName) plAGApplicator::plAGApplicator(const plString &channelName)
: fChannel(nil), : fChannel(nil),
fEnabled(true) fEnabled(true),
fChannelName(channelName)
{ {
fChannelName = hsStrcpy(channelName);
}; };
plAGApplicator::~plAGApplicator() plAGApplicator::~plAGApplicator()
{ {
if(fChannelName)
delete[] fChannelName;
} }
void plAGApplicator::Apply(const plAGModifier *mod, double time, hsBool force) void plAGApplicator::Apply(const plAGModifier *mod, double time, hsBool force)
@ -74,14 +71,14 @@ void plAGApplicator::Apply(const plAGModifier *mod, double time, hsBool force)
IApply(mod, time); IApply(mod, time);
} }
void plAGApplicator::SetChannelName(const char *name) void plAGApplicator::SetChannelName(const plString &name)
{ {
if(name) if(!name.IsNull())
fChannelName = hsStrcpy(name); fChannelName = name;
}; };
const char * plAGApplicator::GetChannelName() plString plAGApplicator::GetChannelName()
{ {
return fChannelName; return fChannelName;
}; };
@ -141,7 +138,7 @@ void plAGApplicator::Read(hsStream *stream, hsResMgr *mgr)
fEnabled = stream->ReadBool(); fEnabled = stream->ReadBool();
fChannel = nil; // Whatever is reading this applicator in should know what channel to assign it fChannel = nil; // Whatever is reading this applicator in should know what channel to assign it
fChannelName = stream->ReadSafeString(); fChannelName = stream->ReadSafeString_TEMP();
} }
// IGETxI // IGETxI

13
Sources/Plasma/PubUtilLib/plAvatar/plAGApplicator.h

@ -62,6 +62,7 @@ class plAGModifier;
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
#include "pnFactory/plCreatable.h" #include "pnFactory/plCreatable.h"
#include "plAvDefs.h" #include "plAvDefs.h"
#include "plString.h"
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
// //
@ -88,7 +89,7 @@ public:
// -- methods -- // -- methods --
/** Base constructor. */ /** Base constructor. */
plAGApplicator(); plAGApplicator();
plAGApplicator(const char *channelName); plAGApplicator(const plString &channelName);
virtual ~plAGApplicator(); virtual ~plAGApplicator();
/** Return our single input channel. Applicators only ever /** Return our single input channel. Applicators only ever
@ -100,8 +101,12 @@ public:
/** Set our input channel. Does not free the previous input channel. */ /** Set our input channel. Does not free the previous input channel. */
void SetChannel(plAGChannel *channel) { fChannel = channel; } void SetChannel(plAGChannel *channel) { fChannel = channel; }
void SetChannelName(const char *name); void SetChannelName(const plString &name);
const char * GetChannelName(); plString GetChannelName();
// TEMP plString REVISIT
// Because I'm TOO LAZY to keep converting all these calls to SetChannelName
void SetChannelName(const char *name) { SetChannelName(_TEMP_CONVERT_FROM_LITERAL(name)); }
/** Optionally suppress the action of this applicator. /** Optionally suppress the action of this applicator.
The applicator can still be forced to apply using the force The applicator can still be forced to apply using the force
@ -167,7 +172,7 @@ protected:
// -- members -- // -- members --
plAGChannel *fChannel; plAGChannel *fChannel;
hsBool fEnabled; hsBool fEnabled;
char *fChannelName; plString fChannelName;
}; };
#endif #endif

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

@ -62,8 +62,6 @@ plAGChannel::plAGChannel()
#ifdef TRACK_AG_ALLOCS #ifdef TRACK_AG_ALLOCS
fName = gGlobalAnimName; fName = gGlobalAnimName;
RegisterAGAlloc(this, gGlobalChannelName, gGlobalAnimName, this->ClassIndex()); RegisterAGAlloc(this, gGlobalChannelName, gGlobalAnimName, this->ClassIndex());
#else // TRACK_AG_ALLOCS
fName = nil;
#endif // TRACK_AG_ALLOCS #endif // TRACK_AG_ALLOCS
} }
@ -121,7 +119,7 @@ void plAGChannel::Read(hsStream *stream, hsResMgr *mgr)
{ {
plCreatable::Read(stream, mgr); plCreatable::Read(stream, mgr);
fName = stream->ReadSafeString(); fName = stream->ReadSafeString_TEMP();
} }
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////

7
Sources/Plasma/PubUtilLib/plAvatar/plAGChannel.h

@ -101,6 +101,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
#include "pnFactory/plCreatable.h" #include "pnFactory/plCreatable.h"
#include "plString.h"
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
// //
@ -177,8 +178,8 @@ public:
// \{ // \{
/** The name of the channel is used to dynamically attach to sub-parts of an /** The name of the channel is used to dynamically attach to sub-parts of an
object. */ object. */
virtual const char * GetName() { return fName; }; virtual plString GetName() { return fName; };
virtual void SetName(char * name) { fName = name; }; virtual void SetName(const plString & name) { fName = name; };
// \} // \}
// PLASMA PROTOCOL // PLASMA PROTOCOL
@ -191,7 +192,7 @@ public:
virtual void Read(hsStream *s, hsResMgr *mgr); virtual void Read(hsStream *s, hsResMgr *mgr);
protected: protected:
const char * fName; plString fName;
}; };

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

@ -301,7 +301,7 @@ void plAGMasterMod::DumpAniGraph(const char *justThisChannel, bool optimized, do
for(plChannelModMap::iterator j = fChannelMods.begin(); j != end; j++) for(plChannelModMap::iterator j = fChannelMods.begin(); j != end; j++)
{ {
plAGModifier *mod = (*j).second; plAGModifier *mod = (*j).second;
if(!justThisChannel || stricmp(justThisChannel, mod->GetChannelName()) == 0) if(!justThisChannel || mod->GetChannelName().Compare(justThisChannel, plString::kCaseInsensitive) == 0)
{ {
plAGApplicator *app = mod->GetApplicator(kAGPinTransform); plAGApplicator *app = mod->GetApplicator(kAGPinTransform);
@ -325,10 +325,10 @@ void plAGMasterMod::DumpAniGraph(const char *justThisChannel, bool optimized, do
// GETCHANNELMOD(name) // GETCHANNELMOD(name)
// Get the modifier that controls the channel with the given name // Get the modifier that controls the channel with the given name
plAGModifier * plAGMasterMod::GetChannelMod(const char * name, hsBool dontCache ) const plAGModifier * plAGMasterMod::GetChannelMod(const plString & name, hsBool dontCache ) const
{ {
plAGModifier * result = nil; plAGModifier * result = nil;
std::map<const char *, plAGModifier *, stringSorter>::const_iterator i = fChannelMods.find(name); std::map<plString, plAGModifier *>::const_iterator i = fChannelMods.find(name);
if (i != fChannelMods.end()) { if (i != fChannelMods.end()) {
result = (*i).second; result = (*i).second;
@ -356,7 +356,7 @@ plAGModifier * plAGMasterMod::ICacheChannelMod(plAGModifier *mod) const
// IFINDAGMOD (sceneObject) // IFINDAGMOD (sceneObject)
// See if there's an ag modifier on this sceneobject. // See if there's an ag modifier on this sceneobject.
// Doesn't check for multiples; just returns the first one. // Doesn't check for multiples; just returns the first one.
plAGModifier * plAGMasterMod::IFindChannelMod(const plSceneObject *SO, const char *name) const plAGModifier * plAGMasterMod::IFindChannelMod(const plSceneObject *SO, const plString &name) const
{ {
const plCoordinateInterface * CI = SO->GetCoordinateInterface(); const plCoordinateInterface * CI = SO->GetCoordinateInterface();
@ -365,8 +365,8 @@ plAGModifier * plAGMasterMod::IFindChannelMod(const plSceneObject *SO, const cha
if(mod) if(mod)
{ {
const char *modName = mod->GetChannelName(); plString modName = mod->GetChannelName();
if(stricmp(name, modName) == 0) if(modName.Compare(name, plString::kCaseInsensitive) == 0)
return mod; return mod;
} }
@ -421,7 +421,7 @@ plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(plAGAnim *anim,
} }
// ATTACHANIMATIONBLENDED(name, blend) // ATTACHANIMATIONBLENDED(name, blend)
plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(const char *name, float blendFactor /* = 0 */, uint16_t blendPriority, hsBool cache /* = false */) plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(const plString &name, float blendFactor /* = 0 */, uint16_t blendPriority, hsBool cache /* = false */)
{ {
plAGAnimInstance *instance = nil; plAGAnimInstance *instance = nil;
plAGAnim *anim = plAGAnim::FindAnim(name); plAGAnim *anim = plAGAnim::FindAnim(name);
@ -433,7 +433,7 @@ plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(const char *name, float
return instance; return instance;
} }
void plAGMasterMod::PlaySimpleAnim(const char *name) void plAGMasterMod::PlaySimpleAnim(const plString &name)
{ {
plATCAnim *anim = plATCAnim::ConvertNoRef(plAGAnim::FindAnim(name)); plATCAnim *anim = plATCAnim::ConvertNoRef(plAGAnim::FindAnim(name));
plAGAnimInstance *instance = nil; plAGAnimInstance *instance = nil;
@ -460,18 +460,18 @@ void plAGMasterMod::PlaySimpleAnim(const char *name)
// FINDANIMINSTANCE // FINDANIMINSTANCE
// Look for an animation instance of the given name on the modifier. // Look for an animation instance of the given name on the modifier.
// If we need this to be fast, should make it a map rather than a vector // If we need this to be fast, should make it a map rather than a vector
plAGAnimInstance * plAGMasterMod::FindAnimInstance(const char *name) plAGAnimInstance * plAGMasterMod::FindAnimInstance(const plString &name)
{ {
plAGAnimInstance *result = nil; plAGAnimInstance *result = nil;
if (name) if (!name.IsNull())
{ {
for (int i = 0; i < fAnimInstances.size(); i++) for (int i = 0; i < fAnimInstances.size(); i++)
{ {
plAGAnimInstance *act = fAnimInstances[i]; plAGAnimInstance *act = fAnimInstances[i];
const char *eachName = act->GetName(); plString eachName = act->GetName();
if( stricmp(eachName, name) == 0) if( eachName.Compare(name, plString::kCaseInsensitive) == 0)
{ {
result = act; result = act;
break; break;
@ -482,7 +482,7 @@ plAGAnimInstance * plAGMasterMod::FindAnimInstance(const char *name)
} }
// FINDORATTACHINSTANCE // FINDORATTACHINSTANCE
plAGAnimInstance * plAGMasterMod::FindOrAttachInstance(const char *name, float blendFactor) plAGAnimInstance * plAGMasterMod::FindOrAttachInstance(const plString &name, float blendFactor)
{ {
plAGAnimInstance *result = FindAnimInstance(name); plAGAnimInstance *result = FindAnimInstance(name);
if(result) if(result)
@ -587,7 +587,7 @@ void plAGMasterMod::DetachAnimation(plAGAnimInstance *anim)
} }
// DETACHANIMATION(name) // DETACHANIMATION(name)
void plAGMasterMod::DetachAnimation(const char *name) void plAGMasterMod::DetachAnimation(const plString &name)
{ {
plAGAnimInstance *anim = FindAnimInstance(name); plAGAnimInstance *anim = FindAnimInstance(name);
if(anim) { if(anim) {
@ -603,10 +603,10 @@ void plAGMasterMod::DumpCurrentAnims(const char *header)
for(int i = nAnims - 1; i >= 0; i--) for(int i = nAnims - 1; i >= 0; i--)
{ {
plAGAnimInstance *inst = fAnimInstances[i]; plAGAnimInstance *inst = fAnimInstances[i];
const char *name = inst->GetName(); plString name = inst->GetName();
float blend = inst->GetBlend(); float blend = inst->GetBlend();
hsStatusMessageF("%d: %s with blend of %f\n", i, name, blend); hsStatusMessageF("%d: %s with blend of %f\n", i, name.c_str(), blend);
} }
} }
@ -628,10 +628,10 @@ hsBool plAGMasterMod::MsgReceive(plMessage* msg)
if (cmdMsg = plAnimCmdMsg::ConvertNoRef(msg)) if (cmdMsg = plAnimCmdMsg::ConvertNoRef(msg))
{ {
const char *targetName = cmdMsg->GetAnimName(); plString targetName = cmdMsg->GetAnimName();
if (!targetName) if (targetName.IsNull())
targetName = ENTIRE_ANIMATION_NAME; targetName = _TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME);
plAGAnimInstance *inst = FindAnimInstance(targetName); plAGAnimInstance *inst = FindAnimInstance(targetName);
if (inst != nil) if (inst != nil)

16
Sources/Plasma/PubUtilLib/plAvatar/plAGMasterMod.h

@ -98,7 +98,7 @@ public:
virtual ~plAGMasterMod(); virtual ~plAGMasterMod();
/** Find an individual plAGModifier of the given name under our control. */ /** Find an individual plAGModifier of the given name under our control. */
plAGModifier * GetChannelMod(const char * name, hsBool dontCache = false) const; plAGModifier * GetChannelMod(const plString & name, hsBool dontCache = false) const;
/** \name Managing Animations */ /** \name Managing Animations */
// \{ // \{
@ -112,13 +112,13 @@ public:
/** Look up the given animation by name and attach it /** Look up the given animation by name and attach it
with the given blend factor. */ with the given blend factor. */
plAGAnimInstance *AttachAnimationBlended(const char *name, float blendFactor = 0, plAGAnimInstance *AttachAnimationBlended(const plString &name, float blendFactor = 0,
uint16_t blendPriority = kAGMedBlendPriority, uint16_t blendPriority = kAGMedBlendPriority,
hsBool cache = false); hsBool cache = false);
/** Play a simple anim (one that doesn't affect root) once and auto detach. /** Play a simple anim (one that doesn't affect root) once and auto detach.
Intended for Zandi's facial animations that run seperate from the behaviors. */ Intended for Zandi's facial animations that run seperate from the behaviors. */
void PlaySimpleAnim(const char *name); void PlaySimpleAnim(const plString &name);
/** Detach the given animation instance. Does nothing /** Detach the given animation instance. Does nothing
if the instance is not managed by this master mod. */ if the instance is not managed by this master mod. */
@ -128,7 +128,7 @@ public:
/** Detach the given animation by name. Searches for /** Detach the given animation by name. Searches for
any instances derived from animations with the any instances derived from animations with the
given name and removes them. */ given name and removes them. */
void DetachAnimation(const char *name); void DetachAnimation(const plString &name);
// \} // \}
/** Print the current animation stack to the console. /** Print the current animation stack to the console.
@ -139,7 +139,7 @@ public:
/** Find and return any animation instances with the /** Find and return any animation instances with the
given name on this master modifer. */ given name on this master modifer. */
plAGAnimInstance *FindAnimInstance(const char *name); plAGAnimInstance *FindAnimInstance(const plString &name);
/** Return the Ith animation instance, based on blend /** Return the Ith animation instance, based on blend
order. Of dubious utility, but, y'know. */ order. Of dubious utility, but, y'know. */
@ -152,7 +152,7 @@ public:
attached, it could be anywhere, including buried under attached, it could be anywhere, including buried under
a bunch of other animations. If it's important that it be a bunch of other animations. If it's important that it be
on top of the stack, you may need to detach it first. */ on top of the stack, you may need to detach it first. */
plAGAnimInstance *FindOrAttachInstance(const char *name, float blendFactor); plAGAnimInstance *FindOrAttachInstance(const plString &name, float blendFactor);
/** Return the number of animations available. */ /** Return the number of animations available. */
int GetNumAnimations(); int GetNumAnimations();
@ -218,7 +218,7 @@ public:
protected: protected:
// -- methods -- // -- methods --
plAGModifier * ICacheChannelMod(plAGModifier *mod) const; plAGModifier * ICacheChannelMod(plAGModifier *mod) const;
plAGModifier * IFindChannelMod(const plSceneObject *obj, const char *name) const; plAGModifier * IFindChannelMod(const plSceneObject *obj, const plString &name) const;
virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual hsBool IEval(double secs, float del, uint32_t dirty);
@ -231,7 +231,7 @@ protected:
plSceneObject* fTarget; plSceneObject* fTarget;
// a map from channel names to ag modifiers within our domain // a map from channel names to ag modifiers within our domain
typedef std::map<const char *, plAGModifier*, stringSorter> plChannelModMap; typedef std::map<plString, plAGModifier*> plChannelModMap;
plChannelModMap fChannelMods; plChannelModMap fChannelMods;
// instances which are currently attached to this master // instances which are currently attached to this master

19
Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.cpp

@ -64,28 +64,21 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
plAGModifier::plAGModifier() plAGModifier::plAGModifier()
: plSingleModifier() : plSingleModifier()
{ {
fChannelName = nil;
fAutoApply = true; fAutoApply = true;
fEnabled = true; fEnabled = true;
} }
// CTOR(name) // CTOR(name)
plAGModifier::plAGModifier(const char *name, hsBool autoApply) plAGModifier::plAGModifier(const plString &name, hsBool autoApply)
: plSingleModifier(), fAutoApply(autoApply) : plSingleModifier(), fAutoApply(autoApply)
{ {
fChannelName = hsStrcpy(name); fChannelName = name;
fEnabled = true; fEnabled = true;
} }
// DTOR // DTOR
plAGModifier::~plAGModifier() plAGModifier::~plAGModifier()
{ {
if(fChannelName)
{
delete[] fChannelName;
fChannelName = nil;
}
int i; int i;
for (i = 0; i < fApps.size(); i++) for (i = 0; i < fApps.size(); i++)
{ {
@ -94,7 +87,7 @@ plAGModifier::~plAGModifier()
} }
// GETCHANNELNAME // GETCHANNELNAME
const char * plAGModifier::GetChannelName() const plString plAGModifier::GetChannelName() const
{ {
return fChannelName; return fChannelName;
} }
@ -106,9 +99,9 @@ void plAGModifier::Enable(hsBool val)
} }
// SETCHANNELNAME // SETCHANNELNAME
void plAGModifier::SetChannelName(char * name) void plAGModifier::SetChannelName(const plString & name)
{ {
fChannelName = hsStrcpy(name); fChannelName = name;
} }
// IAPPLYCHANNELS (time) // IAPPLYCHANNELS (time)
@ -276,7 +269,7 @@ void plAGModifier::Read(hsStream *stream, hsResMgr *mgr)
plSingleModifier::Read(stream, mgr); plSingleModifier::Read(stream, mgr);
// read in the name of the modifier // read in the name of the modifier
fChannelName = stream->ReadSafeString(); fChannelName = stream->ReadSafeString_TEMP();
} }
// WRITE // WRITE

12
Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.h

@ -89,19 +89,19 @@ public:
incoming channels with this modifier. You may also supply an incoming channels with this modifier. You may also supply an
autoApply parameter, which indicates whether this modifier autoApply parameter, which indicates whether this modifier
should apply itself every frame, or only when explicitly asked to. */ should apply itself every frame, or only when explicitly asked to. */
plAGModifier(const char *name, hsBool autoApply = true); plAGModifier(const plString &name, hsBool autoApply = true);
/** It's a destructor. Destroys the name passed into the constructor, /** It's a destructor. Destroys the name passed into the constructor,
and a bunch of other stuff you don't need to know anything about. */ and a bunch of other stuff you don't need to know anything about. */
virtual ~plAGModifier(); virtual ~plAGModifier();
/** Get the name of the channel controlled by this modifier. */ /** Get the name of the channel controlled by this modifier. */
const char * GetChannelName() const; plString GetChannelName() const;
/** Change the channel name of the modifier. Will delete the previous /** Change the channel name of the modifier. Will delete the previous
name. Will NOT remove any channels that are already attached, so name. Will NOT remove any channels that are already attached, so
you could wind up with a modifier named "Fred" and a bunch of you could wind up with a modifier named "Fred" and a bunch of
channels attached to it that were intended for "Lamont." */ channels attached to it that were intended for "Lamont." */
void SetChannelName(char * name); void SetChannelName(const plString & name);
/** Attach a new applicator to our modifier. Will arbitrate with existing /** Attach a new applicator to our modifier. Will arbitrate with existing
modifiers if necessary, based on pin type. May destruct existing applicators. */ modifiers if necessary, based on pin type. May destruct existing applicators. */
@ -139,9 +139,9 @@ protected:
typedef std::vector<plAGApplicator*> plAppTable; typedef std::vector<plAGApplicator*> plAppTable;
plAppTable fApps; // the applicators (with respective channels) that we're applying to our scene object plAppTable fApps; // the applicators (with respective channels) that we're applying to our scene object
char *fChannelName; // name used for matching animation channels to this modifier plString fChannelName; // name used for matching animation channels to this modifier
hsBool fAutoApply; // evaluate animation automatically during IEval call hsBool fAutoApply; // evaluate animation automatically during IEval call
hsBool fEnabled; // if not enabled, we don't eval any of our anims hsBool fEnabled; // if not enabled, we don't eval any of our anims
// APPLYING THE ANIMATION // APPLYING THE ANIMATION
virtual hsBool IEval(double secs, float del, uint32_t dirty); virtual hsBool IEval(double secs, float del, uint32_t dirty);

2
Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp

@ -277,7 +277,7 @@ plAGAnimInstance * plAnimStage::Attach(plArmatureMod *armature, plArmatureBrain
if(fAnimInstance) if(fAnimInstance)
{ {
fAnimInstance->Stop(); // we'll be setting the time directly. fAnimInstance->Stop(); // we'll be setting the time directly.
fAnimatedHandle = (fAnimInstance->GetAnimation()->GetChannel("Handle") != nil); fAnimatedHandle = (fAnimInstance->GetAnimation()->GetChannel(_TEMP_CONVERT_FROM_LITERAL("Handle")) != nil);
fAttached = true; fAttached = true;
// this is too early to send the enter notify. we're attached, but we may not // this is too early to send the enter notify. we're attached, but we may not
// have faded in yet. // have faded in yet.

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

@ -660,11 +660,11 @@ void plArmatureMod::IInitDefaults()
fPhysHeight = 0.f; fPhysHeight = 0.f;
fPhysWidth = 0.f; fPhysWidth = 0.f;
fUpdateMsg = nil; fUpdateMsg = nil;
fRootName = nil; fRootName = plString::Null;
fDontPanicLink = false; fDontPanicLink = false;
fBodyAgeName = "GlobalAvatars"; fBodyAgeName = "GlobalAvatars";
fBodyFootstepSoundPage = "Audio"; fBodyFootstepSoundPage = "Audio";
fAnimationPrefix = "Male"; fAnimationPrefix = _TEMP_CONVERT_FROM_LITERAL("Male");
fUserStr = ""; fUserStr = "";
} }
@ -677,7 +677,6 @@ plArmatureMod::plArmatureMod() : plArmatureModBase()
plArmatureMod::~plArmatureMod() plArmatureMod::~plArmatureMod()
{ {
delete fBoneMap; delete fBoneMap;
delete [] fRootName;
if (fUpdateMsg) if (fUpdateMsg)
fUpdateMsg->UnRef(); fUpdateMsg->UnRef();
@ -746,7 +745,7 @@ void plArmatureMod::GetPositionAndRotationSim(hsPoint3* position, hsQuat* rotati
} }
} }
const plSceneObject *plArmatureMod::FindBone(const char * name) const const plSceneObject *plArmatureMod::FindBone(const plString & name) const
{ {
plSceneObject *result = nil; plSceneObject *result = nil;
@ -1034,14 +1033,12 @@ void plArmatureMod::PanicLink(hsBool playLinkOutAnim /* = true */)
{ {
plAvOneShotLinkTask *task = new plAvOneShotLinkTask; plAvOneShotLinkTask *task = new plAvOneShotLinkTask;
char *animName = MakeAnimationName("FallingLinkOut"); plString animName = MakeAnimationName("FallingLinkOut");
task->SetAnimName(animName); task->SetAnimName(animName);
task->SetMarkerName("touch"); task->SetMarkerName(_TEMP_CONVERT_FROM_LITERAL("touch"));
plAvTaskMsg *taskMsg = new plAvTaskMsg(GetKey(), GetKey(), task); plAvTaskMsg *taskMsg = new plAvTaskMsg(GetKey(), GetKey(), task);
taskMsg->Send(); taskMsg->Send();
delete [] animName;
} }
else else
{ {
@ -1059,10 +1056,9 @@ void plArmatureMod::PersonalLink()
else else
{ {
plAvOneShotLinkTask *task = new plAvOneShotLinkTask; plAvOneShotLinkTask *task = new plAvOneShotLinkTask;
char *animName = MakeAnimationName("PersonalLink"); plString animName = MakeAnimationName("PersonalLink");
task->SetAnimName(animName); task->SetAnimName(animName);
task->SetMarkerName("touch"); task->SetMarkerName(_TEMP_CONVERT_FROM_LITERAL("touch"));
delete [] animName;
plAvTaskMsg *taskMsg = new plAvTaskMsg(GetKey(), GetKey(), task); plAvTaskMsg *taskMsg = new plAvTaskMsg(GetKey(), GetKey(), task);
taskMsg->SetBCastFlag(plMessage::kNetPropagate); taskMsg->SetBCastFlag(plMessage::kNetPropagate);
@ -1758,7 +1754,7 @@ void plArmatureMod::Read(hsStream * stream, hsResMgr *mgr)
fMeshKeys.push_back(mgr->ReadKey(stream)); fMeshKeys.push_back(mgr->ReadKey(stream));
// read the root name string // read the root name string
fRootName = stream->ReadSafeString(); fRootName = stream->ReadSafeString_TEMP();
// read in the brains // read in the brains
int nBrains = stream->ReadLE32(); int nBrains = stream->ReadLE32();
@ -1825,11 +1821,9 @@ void plArmatureMod::Read(hsStream * stream, hsResMgr *mgr)
fPhysHeight = stream->ReadLEFloat(); fPhysHeight = stream->ReadLEFloat();
fPhysWidth = stream->ReadLEFloat(); fPhysWidth = stream->ReadLEFloat();
char* temp = stream->ReadSafeString(); fAnimationPrefix = stream->ReadSafeString_TEMP();
fAnimationPrefix = temp;
delete [] temp;
temp = stream->ReadSafeString(); char *temp = stream->ReadSafeString();
fBodyAgeName = temp; fBodyAgeName = temp;
delete [] temp; delete [] temp;
@ -1906,7 +1900,7 @@ void plArmatureMod::ICustomizeApplicator()
{ {
plArmatureModBase::ICustomizeApplicator(); plArmatureModBase::ICustomizeApplicator();
const plAGModifier *agMod = GetChannelMod("Bone_Root", true); const plAGModifier *agMod = GetChannelMod(_TEMP_CONVERT_FROM_LITERAL("Bone_Root"), true);
if (agMod) if (agMod)
{ {
// are there any applicators that manipulate the transform? // are there any applicators that manipulate the transform?
@ -2387,35 +2381,31 @@ bool plArmatureMod::FindMatchingGenericBrain(const char *names[], int count)
return false; return false;
} }
char *plArmatureMod::MakeAnimationName(const char *baseName) const plString plArmatureMod::MakeAnimationName(const char *baseName) const
{ {
std::string temp = fAnimationPrefix + baseName; return fAnimationPrefix + _TEMP_CONVERT_FROM_LITERAL(baseName);
char *result = hsStrcpy(temp.c_str()); // why they want a new string I'll never know... but hey, too late to change it now
return result;
} }
char *plArmatureMod::GetRootName() plString plArmatureMod::GetRootName()
{ {
return fRootName; return fRootName;
} }
void plArmatureMod::SetRootName(const char *name) void plArmatureMod::SetRootName(const plString &name)
{ {
delete [] fRootName; fRootName = name;
fRootName = hsStrcpy(name);
} }
plAGAnim *plArmatureMod::FindCustomAnim(const char *baseName) const plAGAnim *plArmatureMod::FindCustomAnim(const char *baseName) const
{ {
char *customName = MakeAnimationName(baseName); plString customName = MakeAnimationName(baseName);
plAGAnim *result = plAGAnim::FindAnim(customName); plAGAnim *result = plAGAnim::FindAnim(customName);
delete[] customName;
return result; return result;
} }
void plArmatureMod::ISetupMarkerCallbacks(plATCAnim *anim, plAnimTimeConvert *atc) void plArmatureMod::ISetupMarkerCallbacks(plATCAnim *anim, plAnimTimeConvert *atc)
{ {
std::vector<char*> markers; std::vector<plString> markers;
anim->CopyMarkerNames(markers); anim->CopyMarkerNames(markers);
int i; int i;
@ -2424,12 +2414,12 @@ void plArmatureMod::ISetupMarkerCallbacks(plATCAnim *anim, plAnimTimeConvert *at
float time = -1; float time = -1;
hsBool isLeft = false; hsBool isLeft = false;
if (strstr(markers[i], "SndLeftFootDown") == markers[i]) if (markers[i].Find("SndLeftFootDown") == 0)
{ {
isLeft = true; isLeft = true;
time = anim->GetMarker(markers[i]); time = anim->GetMarker(markers[i]);
} }
if (strstr(markers[i], "SndRightFootDown") == markers[i]) if (markers[i].Find("SndRightFootDown") == 0)
time = anim->GetMarker(markers[i]); time = anim->GetMarker(markers[i]);
if (time >= 0) if (time >= 0)
@ -2461,40 +2451,38 @@ void plArmatureMod::ISetupMarkerCallbacks(plATCAnim *anim, plAnimTimeConvert *at
hsRefCnt_SafeUnRef(foot); hsRefCnt_SafeUnRef(foot);
hsRefCnt_SafeUnRef(iMsg); hsRefCnt_SafeUnRef(iMsg);
} }
delete [] markers[i]; // done with this string, nuke it
} }
} }
const char *plArmatureMod::GetAnimRootName(const char *name) plString plArmatureMod::GetAnimRootName(const plString &name)
{ {
return name + fAnimationPrefix.length(); return name.Substr(fAnimationPrefix.GetSize());
} }
int8_t plArmatureMod::AnimNameToIndex(const char *name) int8_t plArmatureMod::AnimNameToIndex(const plString &name)
{ {
const char *rootName = GetAnimRootName(name); plString rootName = GetAnimRootName(name);
int8_t result = -1; int8_t result = -1;
if (!strcmp(rootName, "Walk") || !strcmp(rootName, "WalkBack") || if (!rootName.Compare("Walk") || !rootName.Compare("WalkBack") ||
!strcmp(rootName, "LadderDown") || !strcmp(rootName, "LadderDownOn") || !rootName.Compare("LadderDown") || !rootName.Compare("LadderDownOn") ||
!strcmp(rootName, "LadderDownOff") || !strcmp(rootName, "LadderUp") || !rootName.Compare("LadderDownOff") || !rootName.Compare("LadderUp") ||
!strcmp(rootName, "LadderUpOn") || !strcmp(rootName, "LadderUpOff") || !rootName.Compare("LadderUpOn") || !rootName.Compare("LadderUpOff") ||
!strcmp(rootName, "SwimSlow") || !strcmp(rootName, "SwimBackward") || !rootName.Compare("SwimSlow") || !rootName.Compare("SwimBackward") ||
!strcmp(rootName, "BallPushWalk")) !rootName.Compare("BallPushWalk"))
result = kWalk; result = kWalk;
else if (!strcmp(rootName, "Run") || !strcmp(rootName, "SwimFast")) else if (!rootName.Compare("Run") || !rootName.Compare("SwimFast"))
result = kRun; result = kRun;
else if (!strcmp(rootName, "TurnLeft") || !strcmp(rootName, "TurnRight") || else if (!rootName.Compare("TurnLeft") || !rootName.Compare("TurnRight") ||
!strcmp(rootName, "StepLeft") || !strcmp(rootName, "StepRight") || !rootName.Compare("StepLeft") || !rootName.Compare("StepRight") ||
!strcmp(rootName, "SideSwimLeft") || !strcmp(rootName, "SideSwimRight") || !rootName.Compare("SideSwimLeft") || !rootName.Compare("SideSwimRight") ||
!strcmp(rootName, "TreadWaterTurnLeft") || !strcmp(rootName, "TreadWaterTurnRight")) !rootName.Compare("TreadWaterTurnLeft") || !rootName.Compare("TreadWaterTurnRight"))
result = kTurn; result = kTurn;
else if (!strcmp(rootName, "GroundImpact") || !strcmp(rootName, "RunningImpact")) else if (!rootName.Compare("GroundImpact") || !rootName.Compare("RunningImpact"))
result = kImpact; result = kImpact;
else if (strstr(rootName, "Run")) // Critters else if (rootName.Find("Run") >= 0) // Critters
result = kRun; result = kRun;
else if (strstr(rootName, "Idle")) // Critters else if (rootName.Find("Idle") >= 0) // Critters
result = kWalk; result = kWalk;
return result; return result;
@ -2590,10 +2578,10 @@ plArmatureLODMod::plArmatureLODMod()
} }
// CTOR (physical, name) // CTOR (physical, name)
plArmatureLODMod::plArmatureLODMod(const char* root_name) plArmatureLODMod::plArmatureLODMod(const plString& root_name)
: plArmatureMod() : plArmatureMod()
{ {
fRootName = hsStrcpy(root_name); fRootName = root_name;
} }
plArmatureLODMod::~plArmatureLODMod() plArmatureLODMod::~plArmatureLODMod()

24
Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.h

@ -221,7 +221,7 @@ public:
hsBool IsLocalAvatar(); hsBool IsLocalAvatar();
hsBool IsLocalAI(); hsBool IsLocalAI();
virtual const plSceneObject *FindBone(const char * name) const; virtual const plSceneObject *FindBone(const plString & name) const;
virtual const plSceneObject *FindBone(uint32_t id) const; // use an id from an appropriate taxonomy, such as plAvBrainHuman::BoneID virtual const plSceneObject *FindBone(uint32_t id) const; // use an id from an appropriate taxonomy, such as plAvBrainHuman::BoneID
virtual void AddBoneMapping(uint32_t id, const plSceneObject *bone); virtual void AddBoneMapping(uint32_t id, const plSceneObject *bone);
plAGModifier *GetRootAGMod(); plAGModifier *GetRootAGMod();
@ -298,15 +298,15 @@ public:
kSwim, kSwim,
}; };
const char *GetAnimRootName(const char *name); plString GetAnimRootName(const plString &name);
int8_t AnimNameToIndex(const char *name); int8_t AnimNameToIndex(const plString &name);
void SetBodyType(int type) { fBodyType = type; } void SetBodyType(int type) { fBodyType = type; }
int GetBodyType(int type) { return fBodyType; } int GetBodyType(int type) { return fBodyType; }
int GetCurrentGenericType(); int GetCurrentGenericType();
bool FindMatchingGenericBrain(const char *names[], int count); bool FindMatchingGenericBrain(const char *names[], int count);
char *MakeAnimationName(const char * baseName) const; plString MakeAnimationName(const char * baseName) const;
char *GetRootName(); plString GetRootName();
void SetRootName(const char *name); void SetRootName(const plString &name);
int RefreshDebugDisplay(); int RefreshDebugDisplay();
void DumpToDebugDisplay(int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt); void DumpToDebugDisplay(int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt);
@ -369,7 +369,7 @@ public:
void SetBodyAgeName(const char* ageName) {if (ageName) fBodyAgeName = ageName; else fBodyAgeName = "";} void SetBodyAgeName(const char* ageName) {if (ageName) fBodyAgeName = ageName; else fBodyAgeName = "";}
void SetBodyFootstepSoundPage(const char* pageName) {if (pageName) fBodyFootstepSoundPage = pageName; else fBodyFootstepSoundPage = "";} void SetBodyFootstepSoundPage(const char* pageName) {if (pageName) fBodyFootstepSoundPage = pageName; else fBodyFootstepSoundPage = "";}
void SetAnimationPrefix(const char* prefix) {if (prefix) fAnimationPrefix = prefix; else fAnimationPrefix = "";} void SetAnimationPrefix(const plString& prefix) { fAnimationPrefix = prefix; }
const char* GetUserStr() {return fUserStr.c_str();} const char* GetUserStr() {return fUserStr.c_str();}
@ -388,16 +388,16 @@ protected:
void ISetTransparentDrawOrder(bool val); void ISetTransparentDrawOrder(bool val);
plLayerLinkAnimation *IFindLayerLinkAnim(); plLayerLinkAnimation *IFindLayerLinkAnim();
char *fRootName; // the name of the player root (from the max file) plString fRootName; // the name of the player root (from the max file)
hsBitVector fMoveFlags; // which keys/buttons are currently pressed hsBitVector fMoveFlags; // which keys/buttons are currently pressed
hsBitVector fMoveFlagsBackup; // a copy of fMoveFlags hsBitVector fMoveFlagsBackup; // a copy of fMoveFlags
typedef std::vector<plControlEventMsg*> CtrlMessageVec; typedef std::vector<plControlEventMsg*> CtrlMessageVec;
CtrlMessageVec fQueuedCtrlMessages; // input messages we haven't processed CtrlMessageVec fQueuedCtrlMessages; // input messages we haven't processed
float fMouseFrameTurnStrength; // Sum turnage from mouse delta messages since last eval. float fMouseFrameTurnStrength; // Sum turnage from mouse delta messages since last eval.
plKey fFootSoundSOKey; // The Scene Object we attach to targets for footstep sounds plKey fFootSoundSOKey; // The Scene Object we attach to targets for footstep sounds
plKey fLinkSoundSOKey; // Same thing for linking... wwwwawAWAWAwawa... plKey fLinkSoundSOKey; // Same thing for linking... wwwwawAWAWAwawa...
plKey fLinkInAnimKey; // Set when we link out, this is the anim to play (backwards) when we link in. plKey fLinkInAnimKey; // Set when we link out, this is the anim to play (backwards) when we link in.
static float fMouseTurnSensitivity; static float fMouseTurnSensitivity;
plArmatureUpdateMsg *fUpdateMsg; plArmatureUpdateMsg *fUpdateMsg;
// Trying to be a good lad here and align all our bools and bytes... // Trying to be a good lad here and align all our bools and bytes...
@ -443,7 +443,7 @@ protected:
// strings for animations, age names, footstep sounds, etc // strings for animations, age names, footstep sounds, etc
std::string fBodyAgeName; std::string fBodyAgeName;
std::string fBodyFootstepSoundPage; std::string fBodyFootstepSoundPage;
std::string fAnimationPrefix; plString fAnimationPrefix;
// user-defined string assigned to this avatar // user-defined string assigned to this avatar
std::string fUserStr; std::string fUserStr;
@ -457,7 +457,7 @@ class plArmatureLODMod : public plArmatureMod
public: public:
// tors // tors
plArmatureLODMod(); plArmatureLODMod();
plArmatureLODMod(const char * root_name); plArmatureLODMod(const plString & root_name);
virtual ~plArmatureLODMod(); virtual ~plArmatureLODMod();
CLASSNAME_REGISTER( plArmatureLODMod ); CLASSNAME_REGISTER( plArmatureLODMod );

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

@ -109,9 +109,9 @@ void plArmatureBehavior::DumpDebug(int &x, int &y, int lineHeight, char *strBuf,
if (fAnim) if (fAnim)
{ {
const char *animName = fAnim->GetName(); plString animName = fAnim->GetName();
float time = fAnim->GetTimeConvert()->CurrentAnimTime(); float time = fAnim->GetTimeConvert()->CurrentAnimTime();
sprintf(strBuf, "%20s %3s time: %5.2f %s", animName, onOff, time, blendBar); sprintf(strBuf, "%20s %3s time: %5.2f %s", animName.c_str(), onOff, time, blendBar);
} }
else else
sprintf(strBuf, " Behavior %2d %3s %s", fIndex, onOff, blendBar); sprintf(strBuf, " Behavior %2d %3s %s", fIndex, onOff, blendBar);

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

@ -714,7 +714,7 @@ void plAvBrainClimb::ICalcProbeLengths()
hsAssert(up, "Couldn't find ClimbUp animation."); hsAssert(up, "Couldn't find ClimbUp animation.");
if(up) if(up)
{ {
GetStartToEndTransform(up, &upMove, nil, "Handle"); GetStartToEndTransform(up, &upMove, nil, _TEMP_CONVERT_FROM_LITERAL("Handle"));
fVerticalProbeLength = upMove.GetTranslate().fZ; fVerticalProbeLength = upMove.GetTranslate().fZ;
} else } else
fVerticalProbeLength = 4.0f; // guess fVerticalProbeLength = 4.0f; // guess
@ -722,7 +722,7 @@ void plAvBrainClimb::ICalcProbeLengths()
hsAssert(left, "Couldn't find ClimbLeft animation."); hsAssert(left, "Couldn't find ClimbLeft animation.");
if(left) if(left)
{ {
GetStartToEndTransform(left, &leftMove, nil, "Handle"); GetStartToEndTransform(left, &leftMove, nil, _TEMP_CONVERT_FROM_LITERAL("Handle"));
fHorizontalProbeLength = leftMove.GetTranslate().fX; fHorizontalProbeLength = leftMove.GetTranslate().fX;
} else } else
fHorizontalProbeLength = 3.0f; // guess fHorizontalProbeLength = 3.0f; // guess

8
Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.cpp

@ -95,7 +95,7 @@ public:
void SetAnimTime(float time) {fAnim->SetCurrentTime(time, true);} void SetAnimTime(float time) {fAnim->SetCurrentTime(time, true);}
std::string Name() const {return fName;} std::string Name() const {return fName;}
std::string AnimName() const {return fAnimName;} plString AnimName() const {return fAnimName;}
bool RandomStartPoint() const {return fRandomStartPoint;} bool RandomStartPoint() const {return fRandomStartPoint;}
float FadeInLength() const {return fFadeInLength;} float FadeInLength() const {return fFadeInLength;}
float FadeOutLength() const {return fFadeOutLength;} float FadeOutLength() const {return fFadeOutLength;}
@ -117,7 +117,7 @@ protected:
plAvBrainCritter *fCritterBrain; plAvBrainCritter *fCritterBrain;
std::string fName; // user-created name for this behavior, also used as the index into the brain's behavior map std::string fName; // user-created name for this behavior, also used as the index into the brain's behavior map
std::string fAnimName; // physical animation's name, for reference plString fAnimName; // physical animation's name, for reference
bool fRandomStartPoint; // do we want this behavior to start at a random frame every time we start it? bool fRandomStartPoint; // do we want this behavior to start at a random frame every time we start it?
float fFadeInLength; // how long to fade in this behavior float fFadeInLength; // how long to fade in this behavior
float fFadeOutLength; // how long to fade out this behavior float fFadeOutLength; // how long to fade out this behavior
@ -290,10 +290,10 @@ std::string plAvBrainCritter::BehaviorName(int behavior) const
return ((CritterBehavior*)fBehaviors[behavior])->Name(); return ((CritterBehavior*)fBehaviors[behavior])->Name();
} }
std::string plAvBrainCritter::AnimationName(int behavior) const plString plAvBrainCritter::AnimationName(int behavior) const
{ {
if ((behavior >= fBehaviors.Count()) || (behavior < 0)) if ((behavior >= fBehaviors.Count()) || (behavior < 0))
return ""; return _TEMP_CONVERT_FROM_LITERAL("");
return ((CritterBehavior*)fBehaviors[behavior])->AnimName(); return ((CritterBehavior*)fBehaviors[behavior])->AnimName();
} }

2
Sources/Plasma/PubUtilLib/plAvatar/plAvBrainCritter.h

@ -92,7 +92,7 @@ public:
bool LocallyControlled() const {return fLocallyControlled;} bool LocallyControlled() const {return fLocallyControlled;}
std::string BehaviorName(int behavior) const; std::string BehaviorName(int behavior) const;
std::string AnimationName(int behavior) const; plString AnimationName(int behavior) const;
int CurBehavior() const {return fCurMode;} int CurBehavior() const {return fCurMode;}
int NextBehavior() const {return fNextMode;} int NextBehavior() const {return fNextMode;}

17
Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp

@ -309,7 +309,7 @@ void plAvBrainHuman::IInitBoneMap()
for(int i = 0; i < numTuples; i++) for(int i = 0; i < numTuples; i++)
{ {
HumanBoneID id = tupleMap[i].fID; HumanBoneID id = tupleMap[i].fID;
const char * name = tupleMap[i].fName; plString name = _TEMP_CONVERT_FROM_LITERAL(tupleMap[i].fName);
const plSceneObject * bone = this->fAvMod->FindBone(name); const plSceneObject * bone = this->fAvMod->FindBone(name);
if( bone ) if( bone )
@ -317,7 +317,7 @@ void plAvBrainHuman::IInitBoneMap()
fAvMod->AddBoneMapping(id, bone); fAvMod->AddBoneMapping(id, bone);
} }
else else
hsStatusMessageF("Couldn't find standard bone %s.", name); hsStatusMessageF("Couldn't find standard bone %s.", name.c_str());
} }
} }
@ -346,9 +346,8 @@ void plAvBrainHuman::Suspend()
// Kind of hacky... but this is a rather rare case. // Kind of hacky... but this is a rather rare case.
// If the user lets up on the PushToTalk key in another brain // If the user lets up on the PushToTalk key in another brain
// we'll miss the message to take off the animation. // we'll miss the message to take off the animation.
char *chatAnimName = fAvMod->MakeAnimationName("Talk"); plString chatAnimName = fAvMod->MakeAnimationName("Talk");
plAGAnimInstance *anim = fAvMod->FindAnimInstance(chatAnimName); plAGAnimInstance *anim = fAvMod->FindAnimInstance(chatAnimName);
delete [] chatAnimName;
if (anim) if (anim)
anim->FadeAndDetach(0, 1); anim->FadeAndDetach(0, 1);
@ -699,7 +698,7 @@ void plAvBrainHuman::TurnToPoint(hsPoint3 point)
void plAvBrainHuman::IChatOn() void plAvBrainHuman::IChatOn()
{ {
char *chatAnimName = fAvMod->MakeAnimationName("Talk"); plString chatAnimName = fAvMod->MakeAnimationName("Talk");
// check that we aren't adding this twice... // check that we aren't adding this twice...
if (!fAvMod->FindAnimInstance(chatAnimName)) if (!fAvMod->FindAnimInstance(chatAnimName))
@ -713,13 +712,11 @@ void plAvBrainHuman::IChatOn()
taskMsg->Send(); taskMsg->Send();
} }
} }
delete [] chatAnimName;
} }
void plAvBrainHuman::IChatOff() void plAvBrainHuman::IChatOff()
{ {
char *chatAnimName = fAvMod->MakeAnimationName("Talk"); plString chatAnimName = fAvMod->MakeAnimationName("Talk");
plKey avKey = fAvMod->GetKey(); plKey avKey = fAvMod->GetKey();
plAvAnimTask *animTask = new plAvAnimTask(chatAnimName, -1.0); plAvAnimTask *animTask = new plAvAnimTask(chatAnimName, -1.0);
if (animTask) if (animTask)
@ -728,7 +725,6 @@ void plAvBrainHuman::IChatOff()
taskMsg->SetBCastFlag(plMessage::kNetPropagate); taskMsg->SetBCastFlag(plMessage::kNetPropagate);
taskMsg->Send(); taskMsg->Send();
} }
delete[] chatAnimName;
} }
hsBool plAvBrainHuman::IInitAnimations() hsBool plAvBrainHuman::IInitAnimations()
@ -1422,12 +1418,11 @@ bool PushSimpleMultiStage(plArmatureMod *avatar, const char *enterAnim, const ch
bool AvatarEmote(plArmatureMod *avatar, const char *emoteName) bool AvatarEmote(plArmatureMod *avatar, const char *emoteName)
{ {
bool result = false; bool result = false;
char *fullName = avatar->MakeAnimationName(emoteName); plString fullName = avatar->MakeAnimationName(emoteName);
plAGAnim *anim = plAGAnim::FindAnim(fullName); plAGAnim *anim = plAGAnim::FindAnim(fullName);
plEmoteAnim *emote = plEmoteAnim::ConvertNoRef(anim); plEmoteAnim *emote = plEmoteAnim::ConvertNoRef(anim);
hsBool alreadyActive = avatar->FindAnimInstance(fullName) != nil; hsBool alreadyActive = avatar->FindAnimInstance(fullName) != nil;
plAvBrainHuman *huBrain = plAvBrainHuman::ConvertNoRef(avatar->FindBrainByClass(plAvBrainHuman::Index())); plAvBrainHuman *huBrain = plAvBrainHuman::ConvertNoRef(avatar->FindBrainByClass(plAvBrainHuman::Index()));
delete[] fullName;
// XXX // XXX
plAvBrainSwim *swimBrain = plAvBrainSwim::ConvertNoRef(avatar->GetCurrentBrain()); plAvBrainSwim *swimBrain = plAvBrainSwim::ConvertNoRef(avatar->GetCurrentBrain());

2
Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp

@ -534,7 +534,7 @@ hsBool plAvTaskSeek::IUpdateObjective(plArmatureMod *avatar)
plAGAnim *anim = avatar->FindCustomAnim(fAnimName); plAGAnim *anim = avatar->FindCustomAnim(fAnimName);
// don't need to do this every frame; the animation doesn't change. // don't need to do this every frame; the animation doesn't change.
// *** cache the adjustment; // *** cache the adjustment;
GetStartToEndTransform(anim, nil, &adjustment, "Handle"); // actually getting end-to-start GetStartToEndTransform(anim, nil, &adjustment, _TEMP_CONVERT_FROM_LITERAL("Handle")); // actually getting end-to-start
// ... but we do still need to multiply by the (potentially changed) target // ... but we do still need to multiply by the (potentially changed) target
targL2W = targL2W * adjustment; targL2W = targL2W * adjustment;
} }

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

@ -1022,7 +1022,7 @@ void plAvatarMgr::OfferLinkingBook(plKey hostKey, plKey guestKey, plMessage *lin
brainG->AddStage(guestAccept); brainG->AddStage(guestAccept);
brainG->AddStage(guestAcceptIdle); brainG->AddStage(guestAcceptIdle);
plCoopCoordinator *coord = new plCoopCoordinator(hostKey, guestKey, brainH, brainG, "Convergence", 1, 1, linkMsg, true); plCoopCoordinator *coord = new plCoopCoordinator(hostKey, guestKey, brainH, brainG, _TEMP_CONVERT_FROM_LITERAL("Convergence"), 1, 1, linkMsg, true);
plAvCoopMsg *coMg = new plAvCoopMsg(hostKey, coord); plAvCoopMsg *coMg = new plAvCoopMsg(hostKey, coord);

67
Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.cpp

@ -249,7 +249,7 @@ hsBool plAvSeekTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double
{ {
hsMatrix44 adjustment; hsMatrix44 adjustment;
plAGAnim *anim = avatar->FindCustomAnim(fAnimName); plAGAnim *anim = avatar->FindCustomAnim(fAnimName);
GetStartToEndTransform(anim, nil, &adjustment, "Handle"); // actually getting end-to-start GetStartToEndTransform(anim, nil, &adjustment, _TEMP_CONVERT_FROM_LITERAL("Handle")); // actually getting end-to-start
targetL2W = targetL2W * adjustment; targetL2W = targetL2W * adjustment;
} }
break; break;
@ -334,8 +334,7 @@ void plAvSeekTask::LeaveAge(plArmatureMod *avatar)
// CTOR default // CTOR default
plAvAnimTask::plAvAnimTask() plAvAnimTask::plAvAnimTask()
: fAnimName(nil), : fInitialBlend(0.0f),
fInitialBlend(0.0f),
fTargetBlend(0.0f), fTargetBlend(0.0f),
fFadeSpeed(0.0f), fFadeSpeed(0.0f),
fSetTime(0.0f), fSetTime(0.0f),
@ -347,7 +346,7 @@ plAvAnimTask::plAvAnimTask()
} }
// CTOR animName, initialBlend, targetBlend, fadeSpeed, start, loop, attach // CTOR animName, initialBlend, targetBlend, fadeSpeed, start, loop, attach
plAvAnimTask::plAvAnimTask(const char *animName, plAvAnimTask::plAvAnimTask(const plString &animName,
float initialBlend, float initialBlend,
float targetBlend, float targetBlend,
float fadeSpeed, float fadeSpeed,
@ -355,7 +354,8 @@ plAvAnimTask::plAvAnimTask(const char *animName,
hsBool start, hsBool start,
hsBool loop, hsBool loop,
hsBool attach) hsBool attach)
: fInitialBlend(initialBlend), : fAnimName(animName),
fInitialBlend(initialBlend),
fTargetBlend(targetBlend), fTargetBlend(targetBlend),
fFadeSpeed(fadeSpeed), fFadeSpeed(fadeSpeed),
fSetTime(setTime), fSetTime(setTime),
@ -364,13 +364,12 @@ plAvAnimTask::plAvAnimTask(const char *animName,
fAttach(attach), fAttach(attach),
fAnimInstance(nil) fAnimInstance(nil)
{ {
if(animName)
fAnimName = hsStrcpy(animName);
} }
// CTOR animName, fadeSpeed, attach // CTOR animName, fadeSpeed, attach
plAvAnimTask::plAvAnimTask(const char *animName, float fadeSpeed, hsBool attach) plAvAnimTask::plAvAnimTask(const plString &animName, float fadeSpeed, hsBool attach)
: fInitialBlend(0.0f), : fAnimName(animName),
fInitialBlend(0.0f),
fTargetBlend(0.0f), fTargetBlend(0.0f),
fFadeSpeed(fadeSpeed), fFadeSpeed(fadeSpeed),
fSetTime(0.0f), fSetTime(0.0f),
@ -379,23 +378,11 @@ plAvAnimTask::plAvAnimTask(const char *animName, float fadeSpeed, hsBool attach)
fAttach(attach), fAttach(attach),
fAnimInstance(nil) fAnimInstance(nil)
{ {
if(animName)
fAnimName = hsStrcpy(animName);
} }
// DTOR
plAvAnimTask::~plAvAnimTask()
{
if(fAnimName)
{
delete[] fAnimName;
fAnimName = nil;
}
}
// START // START
hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed) hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{ {
@ -420,7 +407,7 @@ hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double
} }
else else
{ {
hsStatusMessageF("Couldn't find animation <%s> for plAvAnimTask: will try again", fAnimName); hsStatusMessageF("Couldn't find animation <%s> for plAvAnimTask: will try again", fAnimName.c_str());
} }
} }
else else
@ -480,7 +467,7 @@ void plAvAnimTask::LeaveAge(plArmatureMod *avatar)
// READ // READ
void plAvAnimTask::Read(hsStream *stream, hsResMgr *mgr) void plAvAnimTask::Read(hsStream *stream, hsResMgr *mgr)
{ {
fAnimName = stream->ReadSafeString(); fAnimName = stream->ReadSafeString_TEMP();
fInitialBlend = stream->ReadLEScalar(); fInitialBlend = stream->ReadLEScalar();
fTargetBlend = stream->ReadLEScalar(); fTargetBlend = stream->ReadLEScalar();
fFadeSpeed = stream->ReadLEScalar(); fFadeSpeed = stream->ReadLEScalar();
@ -515,7 +502,6 @@ void plAvOneShotTask::InitDefaults()
fBackwards = false; fBackwards = false;
fDisableLooping = false; fDisableLooping = false;
fDisablePhysics = true; fDisablePhysics = true;
fAnimName = nil;
fMoveHandle = false; fMoveHandle = false;
fAnimInstance = nil; fAnimInstance = nil;
fDrivable = false; fDrivable = false;
@ -537,7 +523,7 @@ plAvOneShotTask::plAvOneShotTask()
// this construct is typically used when you want to create a one-shot task as part of a sequence // this construct is typically used when you want to create a one-shot task as part of a sequence
// of tasks // of tasks
// it's different than the message-based constructor in that fDetachAnimation and fMoveHandle default to false // it's different than the message-based constructor in that fDetachAnimation and fMoveHandle default to false
plAvOneShotTask::plAvOneShotTask(const char *animName, hsBool drivable, hsBool reversible, plOneShotCallbacks *callbacks) plAvOneShotTask::plAvOneShotTask(const plString &animName, hsBool drivable, hsBool reversible, plOneShotCallbacks *callbacks)
{ {
InitDefaults(); InitDefaults();
@ -547,7 +533,7 @@ plAvOneShotTask::plAvOneShotTask(const char *animName, hsBool drivable, hsBool r
// we're going to use this sometime in the future, better ref it so someone else doesn't release it // we're going to use this sometime in the future, better ref it so someone else doesn't release it
hsRefCnt_SafeRef(fCallbacks); hsRefCnt_SafeRef(fCallbacks);
fAnimName = hsStrcpy(animName); fAnimName = animName;
} }
// CTOR (plAvOneShotMsg, plArmatureMod) // CTOR (plAvOneShotMsg, plArmatureMod)
@ -565,14 +551,12 @@ plAvOneShotTask::plAvOneShotTask (plAvOneShotMsg *msg, plArmatureMod *avatar, pl
// we're going to use this sometime in the future, better ref it so someone else doesn't release it // we're going to use this sometime in the future, better ref it so someone else doesn't release it
hsRefCnt_SafeRef(fCallbacks); hsRefCnt_SafeRef(fCallbacks);
fAnimName = hsStrcpy(msg->fAnimName); fAnimName = msg->fAnimName;
} }
// DTOR // DTOR
plAvOneShotTask::~plAvOneShotTask() plAvOneShotTask::~plAvOneShotTask()
{ {
if(fAnimName)
delete[] fAnimName;
hsRefCnt_SafeUnRef(fCallbacks); hsRefCnt_SafeUnRef(fCallbacks);
} }
@ -640,7 +624,7 @@ hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, dou
plgDispatch::MsgSend( pMsg ); // whoosh... off it goes plgDispatch::MsgSend( pMsg ); // whoosh... off it goes
} }
fMoveHandle = (fAnimInstance->GetAnimation()->GetChannel("Handle") != nil); fMoveHandle = (fAnimInstance->GetAnimation()->GetChannel(_TEMP_CONVERT_FROM_LITERAL("Handle")) != nil);
if(fMoveHandle) if(fMoveHandle)
{ {
plMatrixDifferenceApp *differ = avatar->GetRootAnimator(); plMatrixDifferenceApp *differ = avatar->GetRootAnimator();
@ -654,9 +638,8 @@ hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, dou
} }
else else
{ {
char buf[256]; plString buf = plString::Format("Oneshot: Can't find animation <%s>; all bets are off.", fAnimName.c_str());
sprintf(buf, "Oneshot: Can't find animation <%s>; all bets are off.", fAnimName); hsAssert(false, buf.c_str());
hsAssert(false, buf);
result = true; result = true;
} }
return result; return result;
@ -750,10 +733,9 @@ void plAvOneShotTask::LeaveAge(plArmatureMod *avatar)
fIgnore = true; fIgnore = true;
} }
void plAvOneShotTask::SetAnimName(char *name) void plAvOneShotTask::SetAnimName(const plString &name)
{ {
delete [] fAnimName; fAnimName = name;
fAnimName = hsStrcpy(name);
} }
////////////////////// //////////////////////
@ -763,7 +745,6 @@ void plAvOneShotTask::SetAnimName(char *name)
////////////////////// //////////////////////
plAvOneShotLinkTask::plAvOneShotLinkTask() : plAvOneShotTask(), plAvOneShotLinkTask::plAvOneShotLinkTask() : plAvOneShotTask(),
fMarkerName(nil),
fMarkerTime(-1), fMarkerTime(-1),
fStartTime(0), fStartTime(0),
fLinkFired(false) fLinkFired(false)
@ -773,7 +754,6 @@ fLinkFired(false)
plAvOneShotLinkTask::~plAvOneShotLinkTask() plAvOneShotLinkTask::~plAvOneShotLinkTask()
{ {
delete [] fMarkerName;
} }
// task protocol // task protocol
@ -782,7 +762,7 @@ hsBool plAvOneShotLinkTask::Start(plArmatureMod *avatar, plArmatureBrain *brain,
hsBool result = plAvOneShotTask::Start(avatar, brain, time, elapsed); hsBool result = plAvOneShotTask::Start(avatar, brain, time, elapsed);
fStartTime = time; fStartTime = time;
if (fAnimInstance && fMarkerName) if (fAnimInstance && !fMarkerName.IsNull())
{ {
const plATCAnim *anim = plATCAnim::ConvertNoRef(fAnimInstance->GetAnimation()); const plATCAnim *anim = plATCAnim::ConvertNoRef(fAnimInstance->GetAnimation());
if (anim) if (anim)
@ -824,14 +804,13 @@ void plAvOneShotLinkTask::Write(hsStream *stream, hsResMgr *mgr)
void plAvOneShotLinkTask::Read(hsStream *stream, hsResMgr *mgr) void plAvOneShotLinkTask::Read(hsStream *stream, hsResMgr *mgr)
{ {
plAvOneShotTask::Read(stream, mgr); plAvOneShotTask::Read(stream, mgr);
fAnimName = stream->ReadSafeString(); fAnimName = stream->ReadSafeString_TEMP();
fMarkerName = stream->ReadSafeString(); fMarkerName = stream->ReadSafeString_TEMP();
} }
void plAvOneShotLinkTask::SetMarkerName(char *name) void plAvOneShotLinkTask::SetMarkerName(const plString &name)
{ {
delete [] fMarkerName; fMarkerName = name;
fMarkerName = hsStrcpy(name);
} }

26
Sources/Plasma/PubUtilLib/plAvatar/plAvatarTasks.h

@ -84,15 +84,13 @@ public:
\param loop Make the animation loop? \param loop Make the animation loop?
\param attach Are we attaching or detaching the animation? \param attach Are we attaching or detaching the animation?
*/ */
plAvAnimTask(const char *animName, float initialBlend, float targetBlend, float fadeSpeed, plAvAnimTask(const plString &animName, float initialBlend, float targetBlend, float fadeSpeed,
float setTime, hsBool start, hsBool loop, hsBool attach); float setTime, hsBool start, hsBool loop, hsBool attach);
/** Canonical constructor form form for detaching /** Canonical constructor form form for detaching
\param animName The name of the animation we're detaching \param animName The name of the animation we're detaching
\param fadeSpeed How fast to fade it out. */ \param fadeSpeed How fast to fade it out. */
plAvAnimTask(const char *animName, float fadeSpeed, hsBool attach = false); plAvAnimTask(const plString &animName, float fadeSpeed, hsBool attach = false);
virtual ~plAvAnimTask();
// task protocol // task protocol
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
@ -108,11 +106,11 @@ public:
protected: protected:
// public members // public members
char* fAnimName; // the animation we're operating on plString fAnimName; // the animation we're operating on
float fInitialBlend; // the blend to establish (attaching only) float fInitialBlend; // the blend to establish (attaching only)
float fTargetBlend; // the blend to achieve eventually (attaching only) float fTargetBlend; // the blend to achieve eventually (attaching only)
float fFadeSpeed; // how fast to achieve the blend float fFadeSpeed; // how fast to achieve the blend
float fSetTime; // set the animation to this time float fSetTime; // set the animation to this time
hsBool fStart; // start the animation playing? (attaching only) hsBool fStart; // start the animation playing? (attaching only)
hsBool fLoop; // turn on looping? (attaching only) hsBool fLoop; // turn on looping? (attaching only)
hsBool fAttach; // attach? (otherwise detach) hsBool fAttach; // attach? (otherwise detach)
@ -184,7 +182,7 @@ public:
\param reversable Unused. Allows the oneshot to be backed up by keyboard input \param reversable Unused. Allows the oneshot to be backed up by keyboard input
\param callbacks A vector of callback messages to be sent at specific times during the animation \param callbacks A vector of callback messages to be sent at specific times during the animation
*/ */
plAvOneShotTask(const char *animName, hsBool drivable, hsBool reversible, plOneShotCallbacks *callbacks); plAvOneShotTask(const plString &animName, hsBool drivable, hsBool reversible, plOneShotCallbacks *callbacks);
/** Construct from a oneshot message. /** Construct from a oneshot message.
\param msg The message to copy our parameters from \param msg The message to copy our parameters from
\param brain The brain to attach the task to. \param brain The brain to attach the task to.
@ -197,7 +195,7 @@ public:
virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed); virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
virtual void LeaveAge(plArmatureMod *avatar); virtual void LeaveAge(plArmatureMod *avatar);
void SetAnimName(char *name); void SetAnimName(const plString &name);
static hsBool fForce3rdPerson; static hsBool fForce3rdPerson;
@ -211,7 +209,7 @@ public:
// *** implement reader and writer if needed for network propagation // *** implement reader and writer if needed for network propagation
protected: protected:
char *fAnimName; // the name of the one-shot animation we want to use plString fAnimName; // the name of the one-shot animation we want to use
hsBool fMoveHandle; // move the handle after the oneshot's done playing? hsBool fMoveHandle; // move the handle after the oneshot's done playing?
plAGAnimInstance *fAnimInstance; // the animation instance (available only after it starts playing) plAGAnimInstance *fAnimInstance; // the animation instance (available only after it starts playing)
hsBool fDrivable; // the user can control the animation with the mouse hsBool fDrivable; // the user can control the animation with the mouse
@ -257,10 +255,10 @@ public:
virtual void Write(hsStream *stream, hsResMgr *mgr); virtual void Write(hsStream *stream, hsResMgr *mgr);
virtual void Read(hsStream *stream, hsResMgr *mgr); virtual void Read(hsStream *stream, hsResMgr *mgr);
void SetMarkerName(char *name); void SetMarkerName(const plString &name);
protected: protected:
char *fMarkerName; plString fMarkerName;
double fStartTime; double fStartTime;
float fMarkerTime; float fMarkerTime;
hsBool fLinkFired; hsBool fLinkFired;

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

@ -94,7 +94,7 @@ plCoopCoordinator::plCoopCoordinator()
// ------------------ // ------------------
plCoopCoordinator::plCoopCoordinator(plKey host, plKey guest, plCoopCoordinator::plCoopCoordinator(plKey host, plKey guest,
plAvBrainCoop *hostBrain, plAvBrainCoop *guestBrain, plAvBrainCoop *hostBrain, plAvBrainCoop *guestBrain,
const char *synchBone, const plString &synchBone,
uint32_t hostOfferStage, uint32_t guestAcceptStage, uint32_t hostOfferStage, uint32_t guestAcceptStage,
plMessage *guestAcceptMsg, plMessage *guestAcceptMsg,
bool autoStartGuest) bool autoStartGuest)
@ -108,6 +108,7 @@ plCoopCoordinator::plCoopCoordinator(plKey host, plKey guest,
fGuestAcceptStage(guestAcceptStage), fGuestAcceptStage(guestAcceptStage),
fGuestAcceptMsg(guestAcceptMsg), fGuestAcceptMsg(guestAcceptMsg),
fAutoStartGuest(autoStartGuest), fAutoStartGuest(autoStartGuest),
fSynchBone(synchBone),
fGuestAccepted(false), fGuestAccepted(false),
fGuestLinked(false) fGuestLinked(false)
{ {
@ -119,8 +120,6 @@ plCoopCoordinator::plCoopCoordinator(plKey host, plKey guest,
plKey newKey = hsgResMgr::ResMgr()->NewKey(newName, this, host->GetUoid().GetLocation()); plKey newKey = hsgResMgr::ResMgr()->NewKey(newName, this, host->GetUoid().GetLocation());
fSynchBone = hsStrcpy(synchBone);
plKey avMgrKey = plAvatarMgr::GetInstance()->GetKey(); plKey avMgrKey = plAvatarMgr::GetInstance()->GetKey();
guestBrain->SetRecipient(avMgrKey); guestBrain->SetRecipient(avMgrKey);
@ -136,13 +135,6 @@ plCoopCoordinator::plCoopCoordinator(plKey host, plKey guest,
} }
} }
// plCoopCoordinator ------------------
// ------------------
plCoopCoordinator::~plCoopCoordinator()
{
delete[] fSynchBone;
}
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
// //
// CONSTRUCTORS // CONSTRUCTORS
@ -405,7 +397,7 @@ void plCoopCoordinator::Read(hsStream *stream, hsResMgr *mgr)
else else
fGuestAcceptMsg = nil; fGuestAcceptMsg = nil;
fSynchBone = stream->ReadSafeString(); fSynchBone = stream->ReadSafeString_TEMP();
fAutoStartGuest = stream->Readbool(); fAutoStartGuest = stream->Readbool();
fInitiatorID = fHostBrain->GetInitiatorID(); fInitiatorID = fHostBrain->GetInitiatorID();

5
Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.h

@ -79,10 +79,9 @@ public:
plCoopCoordinator(); plCoopCoordinator();
plCoopCoordinator(plKey host, plKey guest, plCoopCoordinator(plKey host, plKey guest,
plAvBrainCoop *hostBrain, plAvBrainCoop *guestBrain, plAvBrainCoop *hostBrain, plAvBrainCoop *guestBrain,
const char *synchBone, uint32_t hostOfferStage, uint32_t guestAcceptStage, const plString &synchBone, uint32_t hostOfferStage, uint32_t guestAcceptStage,
plMessage *guestAcceptMsg, plMessage *guestAcceptMsg,
bool autoStartGuest); bool autoStartGuest);
~plCoopCoordinator();
virtual hsBool MsgReceive(plMessage *msg); virtual hsBool MsgReceive(plMessage *msg);
@ -124,7 +123,7 @@ protected:
plMessage *fGuestAcceptMsg; // send this when the guest accepts plMessage *fGuestAcceptMsg; // send this when the guest accepts
char *fSynchBone; plString fSynchBone;
bool fAutoStartGuest; bool fAutoStartGuest;
bool fGuestAccepted; bool fGuestAccepted;

3
Sources/Plasma/PubUtilLib/plAvatar/plOneShotMod.cpp

@ -130,13 +130,12 @@ hsBool plOneShotMod::MsgReceive(plMessage* msg)
if(avMod) if(avMod)
{ {
char *animName = avMod->MakeAnimationName(fAnimName); plString animName = avMod->MakeAnimationName(fAnimName);
plAvOneShotMsg *avOSmsg = new plAvOneShotMsg(myKey, oneShotMsg->fPlayerKey, objKey, plAvOneShotMsg *avOSmsg = new plAvOneShotMsg(myKey, oneShotMsg->fPlayerKey, objKey,
fSeekDuration, (hsBool)fSmartSeek, animName, fDrivable, fSeekDuration, (hsBool)fSmartSeek, animName, fDrivable,
fReversable); fReversable);
delete [] animName; // AvOneShotMsg constructor copies.
avOSmsg->fNoSeek = fNoSeek; avOSmsg->fNoSeek = fNoSeek;
avOSmsg->SetBCastFlag(plMessage::kPropagateToModifiers); avOSmsg->SetBCastFlag(plMessage::kPropagateToModifiers);
hsRefCnt_SafeRef(oneShotMsg->fCallbacks); hsRefCnt_SafeRef(oneShotMsg->fCallbacks);

6
Sources/Plasma/PubUtilLib/plAvatar/plSittingModifier.cpp

@ -279,7 +279,7 @@ bool IIsClosestAnim(const char *animName, hsMatrix44 &sitGoal, float &closestDis
// The first step is to get the transform from the end to the beginning of the // The first step is to get the transform from the end to the beginning of the
// animation. That's what this next line is doing. It's a bit unintuitive // animation. That's what this next line is doing. It's a bit unintuitive
// until you look at the parameter definitions. // until you look at the parameter definitions.
GetStartToEndTransform(anim, nil, &animEndToStart, "Handle"); GetStartToEndTransform(anim, nil, &animEndToStart, _TEMP_CONVERT_FROM_LITERAL("Handle"));
hsMatrix44 candidateGoal = sitGoal * animEndToStart; hsMatrix44 candidateGoal = sitGoal * animEndToStart;
hsPoint3 distP = candidateGoal.GetTranslate() - curPosition; hsPoint3 distP = candidateGoal.GetTranslate() - curPosition;
hsVector3 distV(distP.fX, distP.fY, distP.fZ); hsVector3 distV(distP.fX, distP.fY, distP.fZ);
@ -290,9 +290,7 @@ bool IIsClosestAnim(const char *animName, hsMatrix44 &sitGoal, float &closestDis
return true; return true;
} }
} else { } else {
char buffy[256]; hsAssert(false, plString::Format("Missing sit animation: %s", animName).c_str());
sprintf(buffy, "Missing sit animation: %s", animName);
hsAssert(false, buffy);
} }
return false; return false;
} }

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

@ -386,7 +386,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
uint32_t ptr = cell->fVtxStart + span->fCellOffset * stride; uint32_t ptr = cell->fVtxStart + span->fCellOffset * stride;
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.s_str("<unknown>"),
geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>", geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices, geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices,
span->fGroupIdx, span->fGroupIdx,
@ -404,7 +404,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
else else
{ {
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.s_str("<unknown>"),
geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>", geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
span->fGroupIdx, span->fGroupIdx,
span->fVBufferIdx, span->fVBufferIdx,
@ -423,7 +423,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
if( geo->fProps & plGeometrySpan::kFirstInstance ) if( geo->fProps & plGeometrySpan::kFirstInstance )
{ {
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.s_str("<unknown>"),
geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>", geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices, geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices,
span->fGroupIdx, span->fGroupIdx,
@ -437,7 +437,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
else else
{ {
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.s_str("<unknown>"),
geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>", geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
span->fGroupIdx, span->fGroupIdx,
span->fVBufferIdx, span->fVBufferIdx,

2
Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.cpp

@ -115,7 +115,7 @@ void plGeometrySpan::IClearMembers( void )
fDecalLevel = 0; fDecalLevel = 0;
fMaxOwner = nil; fMaxOwner = plString::Null;
} }
//// ClearBuffers //////////////////////////////////////////////////////////// //// ClearBuffers ////////////////////////////////////////////////////////////

36
Sources/Plasma/PubUtilLib/plDrawable/plGeometrySpan.h

@ -136,20 +136,20 @@ class plGeometrySpan
hsBounds3Ext fWorldBounds; hsBounds3Ext fWorldBounds;
plFogEnvironment *fFogEnviron; plFogEnvironment *fFogEnviron;
uint32_t fBaseMatrix; uint32_t fBaseMatrix;
uint8_t fNumMatrices; uint8_t fNumMatrices;
uint16_t fLocalUVWChans; uint16_t fLocalUVWChans;
uint16_t fMaxBoneIdx; uint16_t fMaxBoneIdx;
uint32_t fPenBoneIdx; uint32_t fPenBoneIdx;
float fMinDist; float fMinDist;
float fMaxDist; float fMaxDist;
float fWaterHeight; float fWaterHeight;
uint8_t fFormat; uint8_t fFormat;
uint32_t fProps; uint32_t fProps;
uint32_t fNumVerts, fNumIndices; uint32_t fNumVerts, fNumIndices;
/// Current vertex format: /// Current vertex format:
/// float position[ 3 ]; /// float position[ 3 ];
@ -158,22 +158,22 @@ class plGeometrySpan
/// float weights[]; // 0-3 blending weights /// float weights[]; // 0-3 blending weights
/// uint32_t weightIndices; // Only if there are >= 1 blending weights /// uint32_t weightIndices; // Only if there are >= 1 blending weights
uint8_t* fVertexData; uint8_t* fVertexData;
uint16_t* fIndexData; uint16_t* fIndexData;
uint32_t fDecalLevel; uint32_t fDecalLevel;
hsColorRGBA* fMultColor; hsColorRGBA* fMultColor;
hsColorRGBA* fAddColor; hsColorRGBA* fAddColor;
uint32_t* fDiffuseRGBA; uint32_t* fDiffuseRGBA;
uint32_t* fSpecularRGBA; uint32_t* fSpecularRGBA;
mutable hsTArray<plGeometrySpan *>* fInstanceRefs; mutable hsTArray<plGeometrySpan *>* fInstanceRefs;
mutable uint32_t fInstanceGroupID; // For writing out/reading in instance refs mutable uint32_t fInstanceGroupID; // For writing out/reading in instance refs
// The following is only used for logging during export. It is never set // The following is only used for logging during export. It is never set
// at runtime. Don't even think about using it for anything. // at runtime. Don't even think about using it for anything.
const char* fMaxOwner; plString fMaxOwner;
// The following is ONLY used during pack; it's so we can do a reverse lookup // The following is ONLY used during pack; it's so we can do a reverse lookup
// from the instanceRefs list to the correct span in the drawable // from the instanceRefs list to the correct span in the drawable

41
Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.cpp

@ -47,8 +47,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
plAnimCmdMsg::~plAnimCmdMsg() plAnimCmdMsg::~plAnimCmdMsg()
{ {
ClearCmd(); ClearCmd();
delete [] fAnimName;
delete [] fLoopName;
} }
@ -58,24 +56,22 @@ void plAnimCmdMsg::ClearCmd()
fCmd.Clear(); fCmd.Clear();
} }
void plAnimCmdMsg::SetAnimName(const char *name) void plAnimCmdMsg::SetAnimName(const plString &name)
{ {
delete [] fAnimName; fAnimName = name;
fAnimName = hsStrcpy(name);
} }
const char *plAnimCmdMsg::GetAnimName() plString plAnimCmdMsg::GetAnimName()
{ {
return fAnimName; return fAnimName;
} }
void plAnimCmdMsg::SetLoopName(const char *name) void plAnimCmdMsg::SetLoopName(const plString &name)
{ {
delete [] fLoopName; fLoopName = name;
fLoopName = hsStrcpy(name);
} }
const char *plAnimCmdMsg::GetLoopName() plString plAnimCmdMsg::GetLoopName()
{ {
return fLoopName; return fLoopName;
} }
@ -110,8 +106,8 @@ void plAnimCmdMsg::Read(hsStream* stream, hsResMgr* mgr)
stream->ReadLE(&fSpeedChangeRate); stream->ReadLE(&fSpeedChangeRate);
stream->ReadLE(&fTime); stream->ReadLE(&fTime);
fAnimName = stream->ReadSafeString(); fAnimName = stream->ReadSafeString_TEMP();
fLoopName = stream->ReadSafeString(); fLoopName = stream->ReadSafeString_TEMP();
} }
void plAnimCmdMsg::Write(hsStream* stream, hsResMgr* mgr) void plAnimCmdMsg::Write(hsStream* stream, hsResMgr* mgr)
@ -136,16 +132,14 @@ void plAnimCmdMsg::Write(hsStream* stream, hsResMgr* mgr)
plAGCmdMsg::~plAGCmdMsg() plAGCmdMsg::~plAGCmdMsg()
{ {
ClearCmd(); ClearCmd();
delete [] fAnimName;
} }
void plAGCmdMsg::SetAnimName(const char *name) void plAGCmdMsg::SetAnimName(const plString &name)
{ {
delete [] fAnimName; fAnimName = name;
fAnimName = hsStrcpy(name);
} }
const char *plAGCmdMsg::GetAnimName() plString plAGCmdMsg::GetAnimName()
{ {
return fAnimName; return fAnimName;
} }
@ -160,7 +154,7 @@ void plAGCmdMsg::Read(hsStream* stream, hsResMgr* mgr)
stream->ReadLE(&fAmp); stream->ReadLE(&fAmp);
stream->ReadLE(&fAmpRate); stream->ReadLE(&fAmpRate);
fAnimName = stream->ReadSafeString(); fAnimName = stream->ReadSafeString_TEMP();
} }
void plAGCmdMsg::Write(hsStream* stream, hsResMgr* mgr) void plAGCmdMsg::Write(hsStream* stream, hsResMgr* mgr)
@ -178,17 +172,12 @@ void plAGCmdMsg::Write(hsStream* stream, hsResMgr* mgr)
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
plAGDetachCallbackMsg::~plAGDetachCallbackMsg() void plAGDetachCallbackMsg::SetAnimName(const plString &name)
{ {
delete [] fAnimName; fAnimName = name;
} }
void plAGDetachCallbackMsg::SetAnimName(const char *name) plString plAGDetachCallbackMsg::GetAnimName()
{
fAnimName = hsStrcpy(name);
}
char *plAGDetachCallbackMsg::GetAnimName()
{ {
return fAnimName; return fAnimName;
} }

38
Sources/Plasma/PubUtilLib/plMessage/plAnimCmdMsg.h

@ -47,6 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsBitVector.h" #include "hsBitVector.h"
#include "hsTemplates.h" #include "hsTemplates.h"
#include "hsGeometry3.h" #include "hsGeometry3.h"
#include "plString.h"
#include "plInterp/plAnimEaseTypes.h" #include "plInterp/plAnimEaseTypes.h"
#include "plInterp/plAnimTimeConvert.h" #include "plInterp/plAnimTimeConvert.h"
@ -55,11 +56,11 @@ class plAGAnimInstance;
class plAnimCmdMsg : public plMessageWithCallbacks class plAnimCmdMsg : public plMessageWithCallbacks
{ {
protected: protected:
char *fAnimName; plString fAnimName;
char *fLoopName; plString fLoopName;
private: private:
void IInit() { fBegin=fEnd=fLoopBegin=fLoopEnd=fSpeed=fSpeedChangeRate=fTime=0; fAnimName=fLoopName=nil;} void IInit() { fBegin=fEnd=fLoopBegin=fLoopEnd=fSpeed=fSpeedChangeRate=fTime=0; fAnimName=fLoopName=plString::Null;}
public: public:
plAnimCmdMsg() plAnimCmdMsg()
: plMessageWithCallbacks(nil, nil, nil) { IInit(); } : plMessageWithCallbacks(nil, nil, nil) { IInit(); }
@ -110,12 +111,16 @@ public:
hsBool Cmd(int n) const { return fCmd.IsBitSet(n); } hsBool Cmd(int n) const { return fCmd.IsBitSet(n); }
void SetCmd(int n) { fCmd.SetBit(n); } void SetCmd(int n) { fCmd.SetBit(n); }
void ClearCmd(); void ClearCmd();
void SetAnimName(const char *name); void SetAnimName(const plString &name);
const char *GetAnimName(); plString GetAnimName();
hsBool CmdChangesAnimTime(); // Will this command cause an update to the current anim time? hsBool CmdChangesAnimTime(); // Will this command cause an update to the current anim time?
void SetLoopName(const char *name); // TEMP plString REVISIT
const char *GetLoopName(); // Because I'm TOO LAZY to keep converting all these calls to SetAnimName
void SetAnimName(const char *name) { SetAnimName(_TEMP_CONVERT_FROM_LITERAL(name)); }
void SetLoopName(const plString &name);
plString GetLoopName();
float fBegin; float fBegin;
float fEnd; float fEnd;
@ -136,11 +141,11 @@ public:
class plAGCmdMsg : public plMessage class plAGCmdMsg : public plMessage
{ {
protected: protected:
char *fAnimName; plString fAnimName;
private: private:
void IInit() { fBlend = fAmp = 0; void IInit() { fBlend = fAmp = 0;
fAnimName=nil;} fAnimName=plString::Null;}
public: public:
plAGCmdMsg() plAGCmdMsg()
: plMessage(nil, nil, nil) { IInit(); } : plMessage(nil, nil, nil) { IInit(); }
@ -165,8 +170,8 @@ public:
hsBool Cmd(int n) const { return fCmd.IsBitSet(n); } hsBool Cmd(int n) const { return fCmd.IsBitSet(n); }
void SetCmd(int n) { fCmd.SetBit(n); } void SetCmd(int n) { fCmd.SetBit(n); }
void ClearCmd() { fCmd.Clear(); } void ClearCmd() { fCmd.Clear(); }
void SetAnimName(const char *name); void SetAnimName(const plString &name);
const char *GetAnimName(); plString GetAnimName();
float fBlend; float fBlend;
float fBlendRate; float fBlendRate;
@ -199,13 +204,12 @@ public:
class plAGDetachCallbackMsg : public plEventCallbackMsg class plAGDetachCallbackMsg : public plEventCallbackMsg
{ {
protected: protected:
char *fAnimName; plString fAnimName;
public: public:
plAGDetachCallbackMsg() : plEventCallbackMsg(), fAnimName(nil) {} plAGDetachCallbackMsg() : plEventCallbackMsg() {}
plAGDetachCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) : plAGDetachCallbackMsg(plKey receiver, CallbackEvent e, int idx=0, float t=0, int16_t repeats=-1, uint16_t user=0) :
plEventCallbackMsg(receiver, e, idx, t, repeats, user), fAnimName(nil) {} plEventCallbackMsg(receiver, e, idx, t, repeats, user) {}
virtual ~plAGDetachCallbackMsg();
CLASSNAME_REGISTER( plAGDetachCallbackMsg ); CLASSNAME_REGISTER( plAGDetachCallbackMsg );
GETINTERFACE_ANY( plAGDetachCallbackMsg, plEventCallbackMsg ); GETINTERFACE_ANY( plAGDetachCallbackMsg, plEventCallbackMsg );
@ -214,8 +218,8 @@ public:
void Read(hsStream* stream, hsResMgr* mgr) {} void Read(hsStream* stream, hsResMgr* mgr) {}
void Write(hsStream* stream, hsResMgr* mgr) {} void Write(hsStream* stream, hsResMgr* mgr) {}
void SetAnimName(const char *name); void SetAnimName(const plString &name);
char *GetAnimName(); plString GetAnimName();
}; };

12
Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.cpp

@ -351,18 +351,17 @@ void plAvTaskSeekDoneMsg::Write(hsStream *stream, hsResMgr *mgr)
// CTOR() // CTOR()
plAvOneShotMsg::plAvOneShotMsg() plAvOneShotMsg::plAvOneShotMsg()
: plAvSeekMsg(), fAnimName(nil), fDrivable(false), fReversible(false), fCallbacks(nil) : plAvSeekMsg(), fDrivable(false), fReversible(false), fCallbacks(nil)
{ {
} }
// CTOR(sender, receiver, seekKey, time) // CTOR(sender, receiver, seekKey, time)
plAvOneShotMsg::plAvOneShotMsg(const plKey &sender, const plKey& receiver, plAvOneShotMsg::plAvOneShotMsg(const plKey &sender, const plKey& receiver,
const plKey& seekKey, float duration, hsBool smartSeek, const plKey& seekKey, float duration, hsBool smartSeek,
const char *animName, hsBool drivable, hsBool reversible) const plString &animName, hsBool drivable, hsBool reversible)
: plAvSeekMsg(sender, receiver, seekKey, duration, smartSeek), : plAvSeekMsg(sender, receiver, seekKey, duration, smartSeek), fAnimName(animName),
fDrivable(drivable), fReversible(reversible), fCallbacks(nil) fDrivable(drivable), fReversible(reversible), fCallbacks(nil)
{ {
fAnimName = hsStrcpy(animName);
} }
// DTOR // DTOR
@ -370,8 +369,6 @@ plAvOneShotMsg::~plAvOneShotMsg()
{ {
hsRefCnt_SafeUnRef(fCallbacks); hsRefCnt_SafeUnRef(fCallbacks);
fCallbacks = nil; fCallbacks = nil;
delete[] fAnimName;
} }
// READ // READ
@ -379,8 +376,7 @@ void plAvOneShotMsg::Read(hsStream *stream, hsResMgr *mgr)
{ {
plAvSeekMsg::Read(stream, mgr); plAvSeekMsg::Read(stream, mgr);
delete [] fAnimName; fAnimName = stream->ReadSafeString_TEMP();
fAnimName = stream->ReadSafeString();
fDrivable = stream->ReadBool(); fDrivable = stream->ReadBool();
fReversible = stream->ReadBool(); fReversible = stream->ReadBool();
} }

4
Sources/Plasma/PubUtilLib/plMessage/plAvatarMsg.h

@ -247,7 +247,7 @@ public:
virtual ~plAvOneShotMsg(); virtual ~plAvOneShotMsg();
plAvOneShotMsg(const plKey &sender, const plKey& receiver, plAvOneShotMsg(const plKey &sender, const plKey& receiver,
const plKey& seekKey, float duration, hsBool fSmartSeek, const plKey& seekKey, float duration, hsBool fSmartSeek,
const char *animName, hsBool drivable, hsBool reversible); const plString &animName, hsBool drivable, hsBool reversible);
// plasma protocol // plasma protocol
CLASSNAME_REGISTER( plAvOneShotMsg ); CLASSNAME_REGISTER( plAvOneShotMsg );
@ -257,7 +257,7 @@ public:
virtual void Write(hsStream *stream, hsResMgr *mgr); virtual void Write(hsStream *stream, hsResMgr *mgr);
// public members // public members
char * fAnimName; // the name of the animation we're going to use plString fAnimName; // the name of the animation we're going to use
hsBool fDrivable; // are we animated by time or by mouse movement? hsBool fDrivable; // are we animated by time or by mouse movement?
hsBool fReversible; // can we play backwards? hsBool fReversible; // can we play backwards?
plOneShotCallbacks *fCallbacks; // Callbacks given to us by a one-shot modifier plOneShotCallbacks *fCallbacks; // Callbacks given to us by a one-shot modifier

9
Sources/Plasma/PubUtilLib/plMessage/plOneShotCallbacks.cpp

@ -50,15 +50,12 @@ plOneShotCallbacks::plOneShotCallbacks()
plOneShotCallbacks::~plOneShotCallbacks() plOneShotCallbacks::~plOneShotCallbacks()
{ {
int size = fCallbacks.size();
for (int i = 0; i < size; i++)
delete [] fCallbacks[i].fMarker;
fCallbacks.clear(); fCallbacks.clear();
} }
void plOneShotCallbacks::AddCallback(const char *marker, plKey &receiver, int16_t user) void plOneShotCallbacks::AddCallback(const plString &marker, plKey &receiver, int16_t user)
{ {
fCallbacks.push_back(plOneShotCallback(hsStrcpy(marker), receiver, user)); fCallbacks.push_back(plOneShotCallback(marker, receiver, user));
} }
int plOneShotCallbacks::GetNumCallbacks() int plOneShotCallbacks::GetNumCallbacks()
@ -77,7 +74,7 @@ void plOneShotCallbacks::Read(hsStream* stream, hsResMgr* mgr)
fCallbacks.reserve(size); fCallbacks.reserve(size);
for (int i = 0; i < size; i++) for (int i = 0; i < size; i++)
{ {
char *marker = stream->ReadSafeString(); plString marker = stream->ReadSafeString_TEMP();
plKey receiver = mgr->ReadKey(stream); plKey receiver = mgr->ReadKey(stream);
int16_t user = stream->ReadLE16(); int16_t user = stream->ReadLE16();

6
Sources/Plasma/PubUtilLib/plMessage/plOneShotCallbacks.h

@ -59,10 +59,10 @@ public:
class plOneShotCallback class plOneShotCallback
{ {
public: public:
plOneShotCallback(char *marker, plKey &receiver, int16_t user) : plOneShotCallback(const plString &marker, plKey &receiver, int16_t user) :
fMarker(marker), fReceiver(receiver) , fUser(user) {} fMarker(marker), fReceiver(receiver) , fUser(user) {}
char *fMarker; plString fMarker;
plKey fReceiver; plKey fReceiver;
int16_t fUser; int16_t fUser;
}; };
@ -74,7 +74,7 @@ public:
plOneShotCallbacks(); plOneShotCallbacks();
~plOneShotCallbacks(); ~plOneShotCallbacks();
void AddCallback(const char *marker, plKey &receiver, int16_t user=0); void AddCallback(const plString &marker, plKey &receiver, int16_t user=0);
int GetNumCallbacks(); int GetNumCallbacks();
plOneShotCallback& GetCallback(int i); plOneShotCallback& GetCallback(int i);

8
Sources/Plasma/PubUtilLib/plModifier/plAxisAnimModifier.cpp

@ -203,7 +203,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg)
return true; return true;
plAnimCmdMsg* pMsg = new plAnimCmdMsg; plAnimCmdMsg* pMsg = new plAnimCmdMsg;
pMsg->AddReceiver(fXAnim); pMsg->AddReceiver(fXAnim);
pMsg->SetAnimName(fAnimLabel.c_str()); pMsg->SetAnimName(fAnimLabel);
// pMsg->SetAnimName() // pMsg->SetAnimName()
if (fXPos < pMMsg->GetXPos()) if (fXPos < pMMsg->GetXPos())
{ {
@ -223,7 +223,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg)
return true; return true;
plAnimCmdMsg* pMsg = new plAnimCmdMsg; plAnimCmdMsg* pMsg = new plAnimCmdMsg;
pMsg->AddReceiver(fYAnim); pMsg->AddReceiver(fYAnim);
pMsg->SetAnimName(fAnimLabel.c_str()); pMsg->SetAnimName(fAnimLabel);
if (fYPos > pMMsg->GetYPos()) if (fYPos > pMMsg->GetYPos())
{ {
if (fAllOrNothing) if (fAllOrNothing)
@ -301,7 +301,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg)
pMsg->SetCmd(plAnimCmdMsg::kAddCallbacks); pMsg->SetCmd(plAnimCmdMsg::kAddCallbacks);
pMsg->AddCallback(pCall1); pMsg->AddCallback(pCall1);
pMsg->AddCallback(pCall2); pMsg->AddCallback(pCall2);
pMsg->SetAnimName(fAnimLabel.c_str()); pMsg->SetAnimName(fAnimLabel);
pMsg->AddReceiver( fXAnim ); pMsg->AddReceiver( fXAnim );
hsRefCnt_SafeUnRef( pCall1 ); hsRefCnt_SafeUnRef( pCall1 );
@ -330,7 +330,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg)
pMsg->AddCallback(pCall1); pMsg->AddCallback(pCall1);
pMsg->AddCallback(pCall2); pMsg->AddCallback(pCall2);
pMsg->AddReceiver( fYAnim ); pMsg->AddReceiver( fYAnim );
pMsg->SetAnimName(fAnimLabel.c_str()); pMsg->SetAnimName(fAnimLabel);
hsRefCnt_SafeUnRef( pCall1 ); hsRefCnt_SafeUnRef( pCall1 );
hsRefCnt_SafeUnRef( pCall2 ); hsRefCnt_SafeUnRef( pCall2 );

7
Sources/Plasma/PubUtilLib/plModifier/plAxisAnimModifier.h

@ -45,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsStlUtils.h" #include "hsStlUtils.h"
#include "pnModifier/plSingleModifier.h" #include "pnModifier/plSingleModifier.h"
#include "plString.h"
class plKey; class plKey;
@ -74,7 +75,7 @@ protected:
int fIface; int fIface;
plNotifyMsg* fNotify; plNotifyMsg* fNotify;
std::string fAnimLabel; plString fAnimLabel;
plAxisInputInterface *fInputIface; plAxisInputInterface *fInputIface;
@ -100,8 +101,8 @@ public:
void SetNotificationKey(plKey k) { fNotificationKey = k; } void SetNotificationKey(plKey k) { fNotificationKey = k; }
plNotifyMsg* GetNotify() { return fNotify; } plNotifyMsg* GetNotify() { return fNotify; }
const char* GetAnimLabel() const {return fAnimLabel.c_str();} plString GetAnimLabel() const { return fAnimLabel; }
void SetAnimLabel(const char* a) {fAnimLabel = a; } void SetAnimLabel(const plString& a) { fAnimLabel = a; }
}; };

4
Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.cpp

@ -68,8 +68,7 @@ plLayerAnimationBase::plLayerAnimationBase()
fOpacityCtl(nil), fOpacityCtl(nil),
fTransformCtl(nil), fTransformCtl(nil),
fEvalTime(-1.0), fEvalTime(-1.0),
fCurrentTime(-1.f), fCurrentTime(-1.f)
fSegmentID(nil)
{ {
} }
@ -81,7 +80,6 @@ plLayerAnimationBase::~plLayerAnimationBase()
delete fSpecularColorCtl; delete fSpecularColorCtl;
delete fOpacityCtl; delete fOpacityCtl;
delete fTransformCtl; delete fTransformCtl;
delete [] fSegmentID;
} }
void plLayerAnimationBase::Read(hsStream* s, hsResMgr* mgr) void plLayerAnimationBase::Read(hsStream* s, hsResMgr* mgr)

12
Sources/Plasma/PubUtilLib/plSurface/plLayerAnimation.h

@ -60,10 +60,10 @@ class plSimpleStateVariable;
class plLayerAnimationBase : public plLayerInterface class plLayerAnimationBase : public plLayerInterface
{ {
protected: protected:
char* fSegmentID; plString fSegmentID;
double fEvalTime; double fEvalTime;
float fCurrentTime; float fCurrentTime;
float fLength; float fLength;
plController* fPreshadeColorCtl; plController* fPreshadeColorCtl;
plController* fRuntimeColorCtl; plController* fRuntimeColorCtl;
@ -92,8 +92,8 @@ public:
// Specialized // Specialized
float GetLength() const { return fLength; } float GetLength() const { return fLength; }
char *GetSegmentID() const { return fSegmentID; } plString GetSegmentID() const { return fSegmentID; }
void SetSegmentID(char *ID) { delete fSegmentID; fSegmentID = hsStrcpy(ID); } void SetSegmentID(const plString &ID) { fSegmentID = ID; }
// Export construction functions follow // Export construction functions follow
void SetPreshadeColorCtl(plController* colCtl); void SetPreshadeColorCtl(plController* colCtl);

24
Sources/Tools/MaxComponent/plAGComponents.cpp

@ -109,11 +109,11 @@ public:
virtual hsBool Convert(plMaxNode* node, plErrorMsg *pErrMsg); virtual hsBool Convert(plMaxNode* node, plErrorMsg *pErrMsg);
virtual plATCAnim * NewAnimation(const char *name, double begin, double end); virtual plATCAnim * NewAnimation(const plString &name, double begin, double end);
hsBool ConvertNode(plMaxNode *node, plErrorMsg *pErrMsg); hsBool ConvertNode(plMaxNode *node, plErrorMsg *pErrMsg);
hsBool ConvertNodeSegmentBranch(plMaxNode *node, plAGAnim *mod, plErrorMsg *pErrMsg); hsBool ConvertNodeSegmentBranch(plMaxNode *node, plAGAnim *mod, plErrorMsg *pErrMsg);
hsBool MakePersistent(plMaxNode *node, plAGAnim *anim, const char *animName, plErrorMsg *pErrMsg); hsBool MakePersistent(plMaxNode *node, plAGAnim *anim, const plString &animName, plErrorMsg *pErrMsg);
virtual void CollectNonDrawables(INodeTab& nonDrawables) { AddTargetsToList(nonDrawables); } virtual void CollectNonDrawables(INodeTab& nonDrawables) { AddTargetsToList(nonDrawables); }
@ -219,14 +219,15 @@ hsBool plAnimAvatarComponent::ConvertNode(plMaxNode *node, plErrorMsg *pErrMsg)
if (noteAnim.HasNotetracks()) if (noteAnim.HasNotetracks())
{ {
// for each segment we found: // for each segment we found:
while (const char *animName = noteAnim.GetNextAnimName()) plString animName;
while (!(animName = noteAnim.GetNextAnimName()).IsNull())
{ {
plAnimInfo info = noteAnim.GetAnimInfo(animName); plAnimInfo info = noteAnim.GetAnimInfo(animName);
plATCAnim *anim = NewAnimation(info.GetAnimName(), info.GetAnimStart(), info.GetAnimEnd()); plATCAnim *anim = NewAnimation(info.GetAnimName(), info.GetAnimStart(), info.GetAnimEnd());
const char *loopName = info.GetNextLoopName(); plString loopName = info.GetNextLoopName();
if (loopName) if (!loopName.IsNull())
{ {
anim->SetLoop(true); anim->SetLoop(true);
float loopStart = info.GetLoopStart(loopName); float loopStart = info.GetLoopStart(loopName);
@ -234,7 +235,8 @@ hsBool plAnimAvatarComponent::ConvertNode(plMaxNode *node, plErrorMsg *pErrMsg)
anim->SetLoopStart(loopStart == -1 ? anim->GetStart() : loopStart); anim->SetLoopStart(loopStart == -1 ? anim->GetStart() : loopStart);
anim->SetLoopEnd(loopEnd == -1 ? anim->GetEnd() : loopEnd); anim->SetLoopEnd(loopEnd == -1 ? anim->GetEnd() : loopEnd);
} }
while (const char *marker = info.GetNextMarkerName()) plString marker;
while (!(marker = info.GetNextMarkerName()).IsNull())
anim->AddMarker(marker, info.GetMarkerTime(marker)); anim->AddMarker(marker, info.GetMarkerTime(marker));
ConvertNodeSegmentBranch(node, anim, pErrMsg); ConvertNodeSegmentBranch(node, anim, pErrMsg);
@ -252,7 +254,7 @@ hsBool plAnimAvatarComponent::ConvertNode(plMaxNode *node, plErrorMsg *pErrMsg)
// NewAnimation ------------------------------------------------------------------------- // NewAnimation -------------------------------------------------------------------------
// ------------- // -------------
plATCAnim * plAnimAvatarComponent::NewAnimation(const char *name, double begin, double end) plATCAnim * plAnimAvatarComponent::NewAnimation(const plString &name, double begin, double end)
{ {
return new plATCAnim(name, begin, end); return new plATCAnim(name, begin, end);
} }
@ -268,7 +270,7 @@ hsBool plAnimAvatarComponent::ConvertNodeSegmentBranch(plMaxNode *node, plAGAnim
{ {
// Check for a suppression marker // Check for a suppression marker
plNotetrackAnim noteAnim(node, pErrMsg); plNotetrackAnim noteAnim(node, pErrMsg);
plAnimInfo info = noteAnim.GetAnimInfo(nil); plAnimInfo info = noteAnim.GetAnimInfo(plString::Null);
hsBool suppressed = info.IsSuppressed(mod->GetName()); hsBool suppressed = info.IsSuppressed(mod->GetName());
// Get the affine parts and the TM Controller // Get the affine parts and the TM Controller
@ -336,7 +338,7 @@ plKey FindSceneNode(plMaxNode *node)
// Perform wizardry necessary to make the object save itself. // Perform wizardry necessary to make the object save itself.
// //
// //
hsBool plAnimAvatarComponent::MakePersistent(plMaxNode *node, plAGAnim *anim, const char *animName, plErrorMsg *pErrMsg) hsBool plAnimAvatarComponent::MakePersistent(plMaxNode *node, plAGAnim *anim, const plString &animName, plErrorMsg *pErrMsg)
{ {
// new approach: add to the generic pool on the scene node // new approach: add to the generic pool on the scene node
plLocation nodeLoc = node->GetLocation(); plLocation nodeLoc = node->GetLocation();
@ -379,7 +381,7 @@ public:
plEmoteComponent(); plEmoteComponent();
virtual hsBool Convert(plMaxNode *node, plErrorMsg *pErrMsg); virtual hsBool Convert(plMaxNode *node, plErrorMsg *pErrMsg);
virtual plATCAnim * NewAnimation(const char *name, double begin, double end); virtual plATCAnim * NewAnimation(const plString &name, double begin, double end);
protected: protected:
float fFadeIn; float fFadeIn;
@ -455,7 +457,7 @@ hsBool plEmoteComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
// NewAnimation ---------------------------------------------------------------------- // NewAnimation ----------------------------------------------------------------------
// ------------- // -------------
plATCAnim * plEmoteComponent::NewAnimation(const char *name, double begin, double end) plATCAnim * plEmoteComponent::NewAnimation(const plString &name, double begin, double end)
{ {
return new plEmoteAnim(name, begin, end, fFadeIn, fFadeOut, fBodyUsage); return new plEmoteAnim(name, begin, end, fFadeIn, fFadeOut, fBodyUsage);
} }

7
Sources/Tools/MaxComponent/plAnimCompProc.cpp

@ -313,11 +313,12 @@ void plMtlAnimProc::ILoadAnimCombo(HWND hWnd, IParamBlock2* pb)
if (mtl) if (mtl)
{ {
plNotetrackAnim anim(mtl, nil); plNotetrackAnim anim(mtl, nil);
while (const char* animName = anim.GetNextAnimName()) plString animName;
while (!(animName = anim.GetNextAnimName()).IsNull())
{ {
int idx = ComboBox_AddString(hAnim, animName); int idx = ComboBox_AddString(hAnim, animName.c_str());
ComboBox_SetItemData(hAnim, idx, 1); ComboBox_SetItemData(hAnim, idx, 1);
if (!strcmp(animName, savedName)) if (!animName.Compare(savedName))
ComboBox_SetCurSel(hAnim, idx); ComboBox_SetCurSel(hAnim, idx);
} }

43
Sources/Tools/MaxComponent/plAnimComponent.cpp

@ -607,12 +607,12 @@ plAnimComponentBase::plAnimComponentBase() : fNeedReset(true)
} }
const char *plAnimComponentBase::GetAnimName() plString plAnimComponentBase::GetAnimName()
{ {
const char *name = fCompPB->GetStr(kAnimName); const char *name = fCompPB->GetStr(kAnimName);
if (!name || name[0] == '\0') if (!name || name[0] == '\0')
return nil; return plString::Null;
return name; return plString::FromUtf8(name);
} }
bool IsSubworld(plMaxNode* node) bool IsSubworld(plMaxNode* node)
@ -697,7 +697,7 @@ hsBool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg)
{ {
if (!node->HasAGMod()) // Need to add this before the MasterMod, if it doesn't have one already. if (!node->HasAGMod()) // Need to add this before the MasterMod, if it doesn't have one already.
{ {
node->AddModifier(new plAGModifier(node->GetName()), IGetUniqueName(node)); node->AddModifier(new plAGModifier(plString::FromUtf8(node->GetName())), IGetUniqueName(node));
} }
mod = new plAGMasterMod(); mod = new plAGMasterMod();
@ -717,9 +717,9 @@ hsBool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg)
// we've added all keys during convert. Some cleanup might // we've added all keys during convert. Some cleanup might
// be necessary in this case. // be necessary in this case.
const char *animName = fCompPB->GetStr(kAnimName); plString animName = plString::FromUtf8(fCompPB->GetStr(kAnimName));
if (animName == nil || !strcmp(animName, "")) if (animName.IsEmpty())
animName = ENTIRE_ANIMATION_NAME; animName = _TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME);
if (fCompPB->GetInt(ParamID(kAnimUseGlobal))) if (fCompPB->GetInt(ParamID(kAnimUseGlobal)))
{ {
@ -748,7 +748,7 @@ hsBool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg)
if (fCompPB->GetInt(kAnimLoop)) if (fCompPB->GetInt(kAnimLoop))
{ {
ATCAnim->SetLoop(true); ATCAnim->SetLoop(true);
const char *loopName = fCompPB->GetStr(kAnimLoopName); plString loopName = plString::FromUtf8(fCompPB->GetStr(kAnimLoopName));
float loopStart = info.GetLoopStart(loopName); float loopStart = info.GetLoopStart(loopName);
float loopEnd = info.GetLoopEnd(loopName); float loopEnd = info.GetLoopEnd(loopName);
@ -756,10 +756,12 @@ hsBool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg)
ATCAnim->SetLoopEnd(loopEnd == -1 ? ATCAnim->GetEnd() : loopEnd); ATCAnim->SetLoopEnd(loopEnd == -1 ? ATCAnim->GetEnd() : loopEnd);
} }
while (const char *loop = info.GetNextLoopName()) plString loop;
while (!(loop = info.GetNextLoopName()).IsNull())
ATCAnim->AddLoop(loop, info.GetLoopStart(loop), info.GetLoopEnd(loop)); ATCAnim->AddLoop(loop, info.GetLoopStart(loop), info.GetLoopEnd(loop));
while (const char *marker = info.GetNextMarkerName()) plString marker;
while (!(marker = info.GetNextMarkerName()).IsNull())
ATCAnim->AddMarker(marker, info.GetMarkerTime(marker)); ATCAnim->AddMarker(marker, info.GetMarkerTime(marker));
float stopPoint = -1; float stopPoint = -1;
@ -790,7 +792,7 @@ hsBool plAnimComponentBase::IAddTMToAnim(plMaxNode *node, plAGAnim *anim, plErro
hsAffineParts * parts = new hsAffineParts; hsAffineParts * parts = new hsAffineParts;
plController* tmc; plController* tmc;
if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) if (!anim->GetName().Compare(ENTIRE_ANIMATION_NAME))
tmc = hsControlConverter::Instance().ConvertTMAnim(obj, node, parts); tmc = hsControlConverter::Instance().ConvertTMAnim(obj, node, parts);
else else
tmc = hsControlConverter::Instance().ConvertTMAnim(obj, node, parts, anim->GetStart(), anim->GetEnd()); tmc = hsControlConverter::Instance().ConvertTMAnim(obj, node, parts, anim->GetStart(), anim->GetEnd());
@ -798,11 +800,11 @@ hsBool plAnimComponentBase::IAddTMToAnim(plMaxNode *node, plAGAnim *anim, plErro
if (tmc) if (tmc)
{ {
plMatrixChannelApplicator *app = new plMatrixChannelApplicator(); plMatrixChannelApplicator *app = new plMatrixChannelApplicator();
app->SetChannelName(node->GetName()); app->SetChannelName(plString::FromUtf8(node->GetName()));
plMatrixControllerChannel *channel = new plMatrixControllerChannel(tmc, parts); plMatrixControllerChannel *channel = new plMatrixControllerChannel(tmc, parts);
app->SetChannel(channel); app->SetChannel(channel);
anim->AddApplicator(app); anim->AddApplicator(app);
if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) if (!anim->GetName().Compare(ENTIRE_ANIMATION_NAME))
anim->ExtendToLength(tmc->GetLength()); anim->ExtendToLength(tmc->GetLength());
result = true; result = true;
} }
@ -861,7 +863,7 @@ hsBool plAnimComponentBase::IConvertNodeSegmentBranch(plMaxNode *node, plAGAnim
// It has an animation, we're going to need a plAGMod when loading the anim // It has an animation, we're going to need a plAGMod when loading the anim
if (!node->HasAGMod()) if (!node->HasAGMod())
{ {
node->AddModifier(new plAGModifier(node->GetName()), IGetUniqueName(node)); node->AddModifier(new plAGModifier(plString::FromUtf8(node->GetName())), IGetUniqueName(node));
} }
madeAnim = true; madeAnim = true;
} }
@ -883,8 +885,7 @@ hsBool plAnimComponentBase::IMakePersistent(plMaxNode *node, plAGAnim *anim, plE
plAGMasterMod *mod = plAGMasterMod::ConvertNoRef(fMods[node]); plAGMasterMod *mod = plAGMasterMod::ConvertNoRef(fMods[node]);
hsAssert(mod != nil, "No MasterMod to make animation persistent!"); hsAssert(mod != nil, "No MasterMod to make animation persistent!");
char buffer[256]; plString buffer = plString::Format("%s_%s_anim_%d", node->GetName(), anim->GetName().c_str(), mod->GetNumPrivateAnimations());
sprintf(buffer, "%s_%s_anim_%d", node->GetName(), anim->GetName(), mod->GetNumPrivateAnimations());
plLocation nodeLoc = node->GetLocation(); plLocation nodeLoc = node->GetLocation();
plKey animKey = hsgResMgr::ResMgr()->NewKey(buffer, anim, nodeLoc); plKey animKey = hsgResMgr::ResMgr()->NewKey(buffer, anim, nodeLoc);
@ -935,7 +936,7 @@ void plAnimComponentBase::SetupCtl( plAGAnim *anim, plController *ctl, plAGAppli
plScalarControllerChannel *channel = new plScalarControllerChannel(ctl); plScalarControllerChannel *channel = new plScalarControllerChannel(ctl);
app->SetChannel(channel); app->SetChannel(channel);
anim->AddApplicator(app); anim->AddApplicator(app);
if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) if (!anim->GetName().Compare(ENTIRE_ANIMATION_NAME))
anim->ExtendToLength(ctl->GetLength()); anim->ExtendToLength(ctl->GetLength());
} }
@ -989,12 +990,12 @@ void plAnimComponentBase::PickTargetNode( IParamBlock2 *destPB, ParamID destP
pick.DoPick(); pick.DoPick();
} }
const char *plAnimComponentBase::GetIfaceSegmentName( hsBool allowNil ) plString plAnimComponentBase::GetIfaceSegmentName( hsBool allowNil )
{ {
const char *name = GetAnimName(); plString name = GetAnimName();
if( allowNil || name != nil ) if( allowNil || !name.IsNull() )
return name; return name;
return ENTIRE_ANIMATION_NAME; return _TEMP_CONVERT_FROM_LITERAL( ENTIRE_ANIMATION_NAME );
} }
//// Hit Callback for Animations ///////////////////////////////////////////// //// Hit Callback for Animations /////////////////////////////////////////////

4
Sources/Tools/MaxComponent/plAnimComponent.h

@ -115,7 +115,7 @@ public:
hsBool DeInit(plMaxNode *node, plErrorMsg *pErrMsg); hsBool DeInit(plMaxNode *node, plErrorMsg *pErrMsg);
virtual plKey GetModKey(plMaxNode *node)=0; virtual plKey GetModKey(plMaxNode *node)=0;
const char *GetAnimName(); plString GetAnimName();
static hsBool IsAnimComponent(plComponentBase *comp); static hsBool IsAnimComponent(plComponentBase *comp);
std::map<plMaxNode*, plAGAnim*> fAnims; std::map<plMaxNode*, plAGAnim*> fAnims;
@ -132,7 +132,7 @@ public:
// plAnimObjInterface functions // plAnimObjInterface functions
virtual void PickTargetNode( IParamBlock2 *destPB, ParamID destParamID, ParamID typeID ); virtual void PickTargetNode( IParamBlock2 *destPB, ParamID destParamID, ParamID typeID );
virtual hsBool IsNodeRestricted( void ) { return true; } virtual hsBool IsNodeRestricted( void ) { return true; }
virtual const char *GetIfaceSegmentName( hsBool allowNil ); virtual plString GetIfaceSegmentName( hsBool allowNil );
protected: protected:
hsBool IAddTMToAnim(plMaxNode *node, plAGAnim *anim, plErrorMsg *pErrMsg); hsBool IAddTMToAnim(plMaxNode *node, plAGAnim *anim, plErrorMsg *pErrMsg);

36
Sources/Tools/MaxComponent/plAnimEventComponent.cpp

@ -183,7 +183,7 @@ hsBool plAnimEventComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
// Create and setup the callback message // Create and setup the callback message
// //
plKey animKey = animComp->GetModKey(animNode); plKey animKey = animComp->GetModKey(animNode);
const char* animName = animComp->GetAnimName(); plString animName = animComp->GetAnimName();
plAnimCmdMsg *animMsg = new plAnimCmdMsg; plAnimCmdMsg *animMsg = new plAnimCmdMsg;
animMsg->SetCmd(plAnimCmdMsg::kAddCallbacks); animMsg->SetCmd(plAnimCmdMsg::kAddCallbacks);
@ -209,7 +209,7 @@ hsBool plAnimEventComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
int numMarkers = fCompPB->Count(kAnimMarkers); int numMarkers = fCompPB->Count(kAnimMarkers);
for (int i = 0; i < numMarkers; i++) for (int i = 0; i < numMarkers; i++)
{ {
const char* marker = fCompPB->GetStr(kAnimMarkers, 0, i); plString marker = plString::FromUtf8(fCompPB->GetStr(kAnimMarkers, 0, i));
float time = info.GetMarkerTime(marker); float time = info.GetMarkerTime(marker);
plEventCallbackMsg *eventMsg = CreateCallbackMsg(animMsg, modKey); plEventCallbackMsg *eventMsg = CreateCallbackMsg(animMsg, modKey);
@ -255,12 +255,12 @@ static int ListBox_AddStringData(HWND hList, const char* text, int data)
return idx; return idx;
} }
static bool IsMarkerSelected(IParamBlock2* pb, int paramID, const char* marker, bool remove=false) static bool IsMarkerSelected(IParamBlock2* pb, int paramID, const plString& marker, bool remove=false)
{ {
int numMarkers = pb->Count(paramID); int numMarkers = pb->Count(paramID);
for (int i = 0; i < numMarkers; i++) for (int i = 0; i < numMarkers; i++)
{ {
if (hsStrEQ(marker, pb->GetStr(paramID, 0, i))) if (marker.Compare(pb->GetStr(paramID, 0, i)) == 0)
{ {
if (remove) if (remove)
pb->Delete(paramID, i, 1); pb->Delete(paramID, i, 1);
@ -279,7 +279,7 @@ static void RemoveDeadMarkers(IParamBlock2* pb, int paramID, plAnimInfo& info)
int numMarkers = pb->Count(paramID); int numMarkers = pb->Count(paramID);
for (int i = numMarkers-1; i >= 0; i--) for (int i = numMarkers-1; i >= 0; i--)
{ {
float time = info.GetMarkerTime(pb->GetStr(paramID, 0, i)); float time = info.GetMarkerTime(plString::FromUtf8(pb->GetStr(paramID, 0, i)));
if (time == -1) if (time == -1)
{ {
pb->Delete(paramID, i, 1); pb->Delete(paramID, i, 1);
@ -328,9 +328,10 @@ void plAnimEventProc::ILoadUser(HWND hWnd, IParamBlock2* pb)
RemoveDeadMarkers(pb, kAnimMarkers, info); RemoveDeadMarkers(pb, kAnimMarkers, info);
// Get all the markers in this animation // Get all the markers in this animation
while (const char* marker = info.GetNextMarkerName()) plString marker;
while (!(marker = info.GetNextMarkerName()).IsNull())
{ {
idx = ListBox_AddStringData(hList, marker, kAnimEventMarker); idx = ListBox_AddStringData(hList, marker.c_str(), kAnimEventMarker);
if (IsMarkerSelected(pb, kAnimMarkers, marker)) if (IsMarkerSelected(pb, kAnimMarkers, marker))
ListBox_SetSel(hList, TRUE, idx); ListBox_SetSel(hList, TRUE, idx);
@ -355,16 +356,17 @@ bool plAnimEventProc::IUserCommand(HWND hWnd, IParamBlock2* pb, int cmd, int res
{ {
char buf[256]; char buf[256];
ListBox_GetText(hList, idx, buf); ListBox_GetText(hList, idx, buf);
plString text = plString::FromUtf8(buf);
if (selected) if (selected)
{ {
if (!IsMarkerSelected(pb, kAnimMarkers, buf)) if (!IsMarkerSelected(pb, kAnimMarkers, text))
{ {
TCHAR* name = buf; TCHAR* name = buf;
pb->Append(kAnimMarkers, 1, &name); pb->Append(kAnimMarkers, 1, &name);
} }
} }
else else
IsMarkerSelected(pb, kAnimMarkers, buf, true); IsMarkerSelected(pb, kAnimMarkers, text, true);
} }
return true; return true;
@ -480,7 +482,7 @@ hsBool plMtlEventComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
Mtl* mtl = fCompPB->GetMtl(kMtlMtl); Mtl* mtl = fCompPB->GetMtl(kMtlMtl);
plMaxNodeBase* mtlNode = (plMaxNodeBase*)fCompPB->GetINode(kMtlNode); plMaxNodeBase* mtlNode = (plMaxNodeBase*)fCompPB->GetINode(kMtlNode);
const char* mtlAnim = fCompPB->GetStr(kMtlAnim); plString mtlAnim = plString::FromUtf8(fCompPB->GetStr(kMtlAnim));
// //
// Create and setup the callback message // Create and setup the callback message
@ -512,7 +514,7 @@ hsBool plMtlEventComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
int numMarkers = fCompPB->Count(kMtlMarkers); int numMarkers = fCompPB->Count(kMtlMarkers);
for (int i = 0; i < numMarkers; i++) for (int i = 0; i < numMarkers; i++)
{ {
const char* marker = fCompPB->GetStr(kMtlMarkers, 0, i); plString marker = plString::FromUtf8(fCompPB->GetStr(kMtlMarkers, 0, i));
float time = info.GetMarkerTime(marker); float time = info.GetMarkerTime(marker);
plEventCallbackMsg *eventMsg = CreateCallbackMsg(animMsg, modKey); plEventCallbackMsg *eventMsg = CreateCallbackMsg(animMsg, modKey);
@ -576,7 +578,7 @@ void plMtlEventProc::ILoadUser(HWND hWnd, IParamBlock2* pb)
if (mtl) if (mtl)
{ {
const char* mtlAnim = pb->GetStr(kMtlAnim); plString mtlAnim = plString::FromUtf8(pb->GetStr(kMtlAnim));
// Get the shared animations for all the nodes this component is applied to // Get the shared animations for all the nodes this component is applied to
plNotetrackAnim anim(mtl, nil); plNotetrackAnim anim(mtl, nil);
@ -585,9 +587,10 @@ void plMtlEventProc::ILoadUser(HWND hWnd, IParamBlock2* pb)
RemoveDeadMarkers(pb, kMtlMarkers, info); RemoveDeadMarkers(pb, kMtlMarkers, info);
// Get all the markers in this animation // Get all the markers in this animation
while (const char* marker = info.GetNextMarkerName()) plString marker;
while (!(marker = info.GetNextMarkerName()).IsNull())
{ {
idx = ListBox_AddStringData(hList, marker, kAnimEventMarker); idx = ListBox_AddStringData(hList, marker.c_str(), kAnimEventMarker);
if (IsMarkerSelected(pb, kMtlMarkers, marker)) if (IsMarkerSelected(pb, kMtlMarkers, marker))
ListBox_SetSel(hList, TRUE, idx); ListBox_SetSel(hList, TRUE, idx);
@ -612,16 +615,17 @@ bool plMtlEventProc::IUserCommand(HWND hWnd, IParamBlock2* pb, int cmd, int resI
{ {
char buf[256]; char buf[256];
ListBox_GetText(hList, idx, buf); ListBox_GetText(hList, idx, buf);
plString text = plString::FromUtf8(buf);
if (selected) if (selected)
{ {
if (!IsMarkerSelected(pb, kMtlMarkers, buf)) if (!IsMarkerSelected(pb, kMtlMarkers, text))
{ {
TCHAR* name = buf; TCHAR* name = buf;
pb->Append(kMtlMarkers, 1, &name); pb->Append(kMtlMarkers, 1, &name);
} }
} }
else else
IsMarkerSelected(pb, kMtlMarkers, buf, true); IsMarkerSelected(pb, kMtlMarkers, text, true);
} }
return true; return true;

3
Sources/Tools/MaxComponent/plAnimObjInterface.h

@ -51,6 +51,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define _plAnimObjInterface_h #define _plAnimObjInterface_h
#include "hsTemplates.h" #include "hsTemplates.h"
#include "plString.h"
class plAnimObjInterface class plAnimObjInterface
{ {
@ -79,7 +80,7 @@ class plAnimObjInterface
// Return the name of the segment/animation that this interface references. Pass "false" to get the // Return the name of the segment/animation that this interface references. Pass "false" to get the
// ENTIRE_ANIMATION_NAME string for entire animations, "true" for nil. // ENTIRE_ANIMATION_NAME string for entire animations, "true" for nil.
virtual const char *GetIfaceSegmentName( hsBool allowNil ) = 0; virtual plString GetIfaceSegmentName( hsBool allowNil ) = 0;
// This animation would require (depending on the node restriction) a separate material (i.e. material anim) // This animation would require (depending on the node restriction) a separate material (i.e. material anim)
virtual hsBool MightRequireSeparateMaterial( void ) { return false; } virtual hsBool MightRequireSeparateMaterial( void ) { return false; }

42
Sources/Tools/MaxComponent/plAudioComponents.cpp

@ -614,12 +614,15 @@ plSoundBuffer *plBaseSoundEmitterComponent::GetSourceBuffer( const char *fileN
plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer( const char *fileName, plMaxNode *srcNode, uint32_t srcBufferFlags ) plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer( const char *fileName, plMaxNode *srcNode, uint32_t srcBufferFlags )
{ {
plKey key; plKey key;
char keyName[ MAX_PATH ]; plString keyName;
char fullPath[ MAX_PATH ]; char fullPath[ MAX_PATH ];
strcpy( keyName, fileName ); // ***TEMP plString REVISIT***
::PathStripPath( keyName ); char tempPath[ MAX_PATH ];
strncpy(tempPath, fileName, MAX_PATH);
::PathStripPath( tempPath );
keyName = _TEMP_CONVERT_FROM_LITERAL( tempPath );
// TEMP HACK until we get packed sounds: // TEMP HACK until we get packed sounds:
// Given the source filename, we check to see if it's in our plasma game directory. If not, or if // Given the source filename, we check to see if it's in our plasma game directory. If not, or if
@ -635,7 +638,7 @@ plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer( const char *file
plFileUtils::CreateDir( fullPath ); plFileUtils::CreateDir( fullPath );
// Now finish the path... // Now finish the path...
strcat( fullPath, keyName ); strcat( fullPath, _TEMP_CONVERT_TO_CONST_CHAR( keyName ) );
// Check filestamp // Check filestamp
WIN32_FILE_ATTRIBUTE_DATA oldFileAttrib, newFileAttrib; WIN32_FILE_ATTRIBUTE_DATA oldFileAttrib, newFileAttrib;
@ -664,9 +667,9 @@ plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer( const char *file
// Additional info for the keyName--need some flag mangling, specifically for the left/right channel mangling // Additional info for the keyName--need some flag mangling, specifically for the left/right channel mangling
if( srcBufferFlags & plSoundBuffer::kOnlyLeftChannel ) if( srcBufferFlags & plSoundBuffer::kOnlyLeftChannel )
strcat( keyName, ":L" ); keyName += _TEMP_CONVERT_FROM_LITERAL( ":L" );
else if( srcBufferFlags & plSoundBuffer::kOnlyRightChannel ) else if( srcBufferFlags & plSoundBuffer::kOnlyRightChannel )
strcat( keyName, ":R" ); keyName += _TEMP_CONVERT_FROM_LITERAL( ":R" );
key = srcNode->FindPageKey( plSoundBuffer::Index(), keyName ); key = srcNode->FindPageKey( plSoundBuffer::Index(), keyName );
if( key != nil ) if( key != nil )
@ -890,8 +893,8 @@ void plBaseSoundEmitterComponent::ISetBaseParameters( plSound *destSound, plE
{ {
destSound->SetProperty( plSound::kPropLooping, true ); destSound->SetProperty( plSound::kPropLooping, true );
const char *loop = fCompPB->GetStr((ParamID)kSoundLoopName); plString loop = plString::FromUtf8( fCompPB->GetStr((ParamID)kSoundLoopName) );
if (loop && loop[0] != '\0') if (!loop.IsEmpty())
{ {
SegmentMap *segMap = GetCompWaveSegmentMap( GetSoundFileName( kBaseSound ) ); SegmentMap *segMap = GetCompWaveSegmentMap( GetSoundFileName( kBaseSound ) );
if (segMap && segMap->find(loop) != segMap->end()) if (segMap && segMap->find(loop) != segMap->end())
@ -915,7 +918,7 @@ hsBool plBaseSoundEmitterComponent::AddToAnim( plAGAnim *anim, plMaxNode *node
hsControlConverter& cc = hsControlConverter::Instance(); hsControlConverter& cc = hsControlConverter::Instance();
float start, end; float start, end;
if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) if (!anim->GetName().Compare(ENTIRE_ANIMATION_NAME))
{ {
start = end = -1; start = end = -1;
} }
@ -937,7 +940,7 @@ hsBool plBaseSoundEmitterComponent::AddToAnim( plAGAnim *anim, plMaxNode *node
std::map<plMaxNode*, int>::iterator i = fIndices.begin(); std::map<plMaxNode*, int>::iterator i = fIndices.begin();
plSoundVolumeApplicator *app = new plSoundVolumeApplicator( (*i).second ); plSoundVolumeApplicator *app = new plSoundVolumeApplicator( (*i).second );
app->SetChannelName(node->GetName()); app->SetChannelName(plString::FromUtf8(node->GetName()));
plAnimComponentBase::SetupCtl( anim, ctl, app, node ); plAnimComponentBase::SetupCtl( anim, ctl, app, node );
result = true; result = true;
} }
@ -1817,10 +1820,10 @@ public:
for (SegmentMap::iterator it = segMap->begin(); it != segMap->end(); it++) for (SegmentMap::iterator it = segMap->begin(); it != segMap->end(); it++)
{ {
SegmentSpec *spec = it->second; SegmentSpec *spec = it->second;
int idx = SendMessage(hLoop, CB_ADDSTRING, 0, (LPARAM)spec->fName); int idx = SendMessage(hLoop, CB_ADDSTRING, 0, (LPARAM)spec->fName.c_str());
SendMessage(hLoop, CB_SETITEMDATA, idx, 1); SendMessage(hLoop, CB_SETITEMDATA, idx, 1);
if (!strcmp(spec->fName, loop)) if (!spec->fName.Compare(loop))
SendMessage(hLoop, CB_SETCURSEL, idx, 0); SendMessage(hLoop, CB_SETCURSEL, idx, 0);
} }
@ -2185,8 +2188,7 @@ hsBool plSound3DEmitterComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
plWinAudible* pAudible = (plWinAudible*)ai->GetAudible(); plWinAudible* pAudible = (plWinAudible*)ai->GetAudible();
char keyName[ 256 ]; plString keyName = plString::FromUtf8(GetINode()->GetName());
sprintf( keyName, "%s", GetINode()->GetName());
plWin32Sound *sound = nil; plWin32Sound *sound = nil;
@ -2219,7 +2221,7 @@ hsBool plSound3DEmitterComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
// Converts an array of components into a single grouped sound // Converts an array of components into a single grouped sound
hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray<plBaseSoundEmitterComponent *> &groupArray, plErrorMsg *pErrMsg ) hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray<plBaseSoundEmitterComponent *> &groupArray, plErrorMsg *pErrMsg )
{ {
char keyName[ 256 ]; plString keyName;
if( !fValidNodes[ baseNode ] || !fCreateGrouped ) if( !fValidNodes[ baseNode ] || !fCreateGrouped )
@ -2340,7 +2342,7 @@ hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray
if( fIndices.find( baseNode ) != fIndices.end() ) if( fIndices.find( baseNode ) != fIndices.end() )
index = fIndices[ baseNode ]; index = fIndices[ baseNode ];
sprintf( keyName, "%s_MergedSound", GetINode()->GetName() ); keyName = plString::Format( "%s_MergedSound", GetINode()->GetName() );
plKey buffKey = baseNode->FindPageKey( plSoundBuffer::Index(), keyName ); plKey buffKey = baseNode->FindPageKey( plSoundBuffer::Index(), keyName );
if( buffKey != nil ) if( buffKey != nil )
@ -2361,7 +2363,7 @@ hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray
const plAudioInterface* ai = baseNode->GetSceneObject()->GetAudioInterface(); const plAudioInterface* ai = baseNode->GetSceneObject()->GetAudioInterface();
plWinAudible* pAudible = (plWinAudible*)ai->GetAudible(); plWinAudible* pAudible = (plWinAudible*)ai->GetAudible();
sprintf( keyName, "%s", GetINode()->GetName()); keyName = plString::FromUtf8(GetINode()->GetName());
plWin32GroupedSound *sound = new plWin32GroupedSound; plWin32GroupedSound *sound = new plWin32GroupedSound;
sound->SetPositionArray( startPoses.GetCount(), startPoses.AcquireArray(), volumes.AcquireArray() ); sound->SetPositionArray( startPoses.GetCount(), startPoses.AcquireArray(), volumes.AcquireArray() );
sound->SetProperty( plSound::kPropLoadOnlyOnCall, true ); sound->SetProperty( plSound::kPropLoadOnlyOnCall, true );
@ -2508,8 +2510,7 @@ hsBool plBackgroundMusicComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
if( srcBuffer == nil ) if( srcBuffer == nil )
return false; return false;
char keyName[ 256 ]; plString keyName = plString::Format( "%s_Win32BgndSnd", GetINode()->GetName() );
sprintf( keyName, "%s_Win32BgndSnd", GetINode()->GetName() );
plWin32Sound *sound = nil; plWin32Sound *sound = nil;
if( srcBuffer->GetDataLengthInSecs() > 4.f ) if( srcBuffer->GetDataLengthInSecs() > 4.f )
@ -2667,8 +2668,7 @@ hsBool plGUISoundComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
return false; return false;
} }
char keyName[ 256 ]; plString keyName = plString::Format( "%s_Win32GUISound", GetINode()->GetName() );
sprintf( keyName, "%s_Win32GUISound", GetINode()->GetName() );
plWin32StaticSound *sound = new plWin32StaticSound; plWin32StaticSound *sound = new plWin32StaticSound;
hsgResMgr::ResMgr()->NewKey(keyName, sound, node->GetLocation(), node->GetLoadMask()); hsgResMgr::ResMgr()->NewKey(keyName, sound, node->GetLocation(), node->GetLoadMask());

4
Sources/Tools/MaxComponent/plAutoUIParams.cpp

@ -1605,7 +1605,7 @@ plKey plPickMaterialAnimationButtonParam::GetKey(IParamBlock2 *pb, int idx)
} }
// this is in plResponderMtl.cpp // this is in plResponderMtl.cpp
extern int GetMatAnimModKey(Mtl* mtl, plMaxNodeBase* node, const char* segName, hsTArray<plKey>& keys);; extern int GetMatAnimModKey(Mtl* mtl, plMaxNodeBase* node, const plString& segName, hsTArray<plKey>& keys);;
void plPickMaterialAnimationButtonParam::CreateKeyArray(IParamBlock2* pb) void plPickMaterialAnimationButtonParam::CreateKeyArray(IParamBlock2* pb)
{ {
@ -1613,7 +1613,7 @@ void plPickMaterialAnimationButtonParam::CreateKeyArray(IParamBlock2* pb)
Mtl* mtl = (Mtl*)pb->GetReferenceTarget(fID); Mtl* mtl = (Mtl*)pb->GetReferenceTarget(fID);
int bob = GetMatAnimModKey(mtl, nil, nil, fKeys); int bob = GetMatAnimModKey(mtl, nil, plString::Null, fKeys);
} }
void plPickMaterialAnimationButtonParam::DestroyKeyArray() void plPickMaterialAnimationButtonParam::DestroyKeyArray()

22
Sources/Tools/MaxComponent/plAvatarComponent.cpp

@ -264,11 +264,11 @@ hsBool plArmatureComponent::Convert(plMaxNode* node, plErrorMsg *pErrMsg)
{ {
// MakeCharacterHierarchy will attach agmodifiers to all the bones in the hierarchy; // MakeCharacterHierarchy will attach agmodifiers to all the bones in the hierarchy;
// have to manually add any for non-bone objects... // have to manually add any for non-bone objects...
agMod = new plAGModifier("Handle"); // the player root is known as the handle agMod = new plAGModifier(_TEMP_CONVERT_FROM_LITERAL("Handle")); // the player root is known as the handle
node->AddModifier(agMod, IGetUniqueName(node)); node->AddModifier(agMod, IGetUniqueName(node));
} }
agMod->SetChannelName("Handle"); agMod->SetChannelName(_TEMP_CONVERT_FROM_LITERAL("Handle"));
// Get the position and radius of the head and torso physicals // Get the position and radius of the head and torso physicals
if (ClassID() == AVATAR_CLASS_ID || ClassID() == LOD_AVATAR_CLASS_ID) if (ClassID() == AVATAR_CLASS_ID || ClassID() == LOD_AVATAR_CLASS_ID)
@ -453,7 +453,7 @@ plAvatarComponent::plAvatarComponent()
void plAvatarComponent::IAttachModifiers(plMaxNode *node, plErrorMsg *pErrMsg) void plAvatarComponent::IAttachModifiers(plMaxNode *node, plErrorMsg *pErrMsg)
{ {
const char *name = node->GetKey()->GetName(); plString name = node->GetKey()->GetName();
plMaxNode *meshNode = (plMaxNode *)fCompPB->GetINode(plAvatarComponent::kMeshNode); plMaxNode *meshNode = (plMaxNode *)fCompPB->GetINode(plAvatarComponent::kMeshNode);
plKey meshKey = meshNode->GetSceneObject()->GetKey(); plKey meshKey = meshNode->GetSceneObject()->GetKey();
@ -476,7 +476,7 @@ void plAvatarComponent::IAttachModifiers(plMaxNode *node, plErrorMsg *pErrMsg)
avMod->SetBodyAgeName(node->GetAgeName()); avMod->SetBodyAgeName(node->GetAgeName());
avMod->SetBodyFootstepSoundPage(fCompPB->GetStr(ParamID(kBodyFootstepSoundPage))); avMod->SetBodyFootstepSoundPage(fCompPB->GetStr(ParamID(kBodyFootstepSoundPage)));
avMod->SetAnimationPrefix(fCompPB->GetStr(ParamID(kAnimationPrefix))); avMod->SetAnimationPrefix(plString::FromUtf8(fCompPB->GetStr(ParamID(kAnimationPrefix))));
//AddLinkSound(node, node->GetSceneObject()->GetKey(), pErrMsg ); //AddLinkSound(node, node->GetSceneObject()->GetKey(), pErrMsg );
@ -491,7 +491,7 @@ void plAvatarComponent::IAttachModifiers(plMaxNode *node, plErrorMsg *pErrMsg)
void AddClothingToMod(plMaxNode *node, plArmatureMod *mod, int group, hsGMaterial *mat, plErrorMsg *pErrMsg) void AddClothingToMod(plMaxNode *node, plArmatureMod *mod, int group, hsGMaterial *mat, plErrorMsg *pErrMsg)
{ {
plGenRefMsg *msg; plGenRefMsg *msg;
char keyName[256]; plString keyName;
TSTR sdata; TSTR sdata;
hsStringTokenizer toker; hsStringTokenizer toker;
@ -509,11 +509,11 @@ void AddClothingToMod(plMaxNode *node, plArmatureMod *mod, int group, hsGMateria
} }
else else
base->SetLayoutName("BasicHuman"); base->SetLayoutName("BasicHuman");
sprintf(keyName, "%s_ClothingBase", node->GetName()); keyName = plString::Format("%s_ClothingBase", node->GetName());
hsgResMgr::ResMgr()->NewKey(keyName, base, node->GetLocation()); hsgResMgr::ResMgr()->NewKey(keyName, base, node->GetLocation());
plClothingOutfit *outfit = new plClothingOutfit(); plClothingOutfit *outfit = new plClothingOutfit();
outfit->fGroup = group; outfit->fGroup = group;
sprintf(keyName, "%s_outfit", mod->GetKey()->GetName()); keyName = plString::Format("%s_outfit", mod->GetKey()->GetName().c_str());
hsgResMgr::ResMgr()->NewKey(keyName, outfit, node->GetLocation()); hsgResMgr::ResMgr()->NewKey(keyName, outfit, node->GetLocation());
msg = new plGenRefMsg(outfit->GetKey(), plRefMsg::kOnCreate, -1, -1); msg = new plGenRefMsg(outfit->GetKey(), plRefMsg::kOnCreate, -1, -1);
@ -682,10 +682,10 @@ hsBool plCompoundCtrlComponent::SetupProperties(plMaxNode *node, plErrorMsg *pEr
hsBool plCompoundCtrlComponent::Convert(plMaxNode* node, plErrorMsg *pErrMsg) hsBool plCompoundCtrlComponent::Convert(plMaxNode* node, plErrorMsg *pErrMsg)
{ {
const char *name = node->GetKey()->GetName(); plString name = node->GetKey()->GetName();
node->MakeCharacterHierarchy(pErrMsg); node->MakeCharacterHierarchy(pErrMsg);
node->SetupBonesAliasesRecur(name); node->SetupBonesAliasesRecur(_TEMP_CONVERT_TO_CONST_CHAR(name));
// create and register the player modifier // create and register the player modifier
@ -1052,7 +1052,7 @@ plLODAvatarComponent::plLODAvatarComponent() : fMaterial(nil)
void plLODAvatarComponent::IAttachModifiers( plMaxNode *node, plErrorMsg *pErrMsg) void plLODAvatarComponent::IAttachModifiers( plMaxNode *node, plErrorMsg *pErrMsg)
{ {
const char *avatarName = node->GetKey()->GetName(); plString avatarName = node->GetKey()->GetName();
plMaxNode *animRoot = (plMaxNode *)fCompPB->GetINode(plLODAvatarComponent::kRootNodeAddBtn); plMaxNode *animRoot = (plMaxNode *)fCompPB->GetINode(plLODAvatarComponent::kRootNodeAddBtn);
plKey animRootKey = animRoot->GetSceneObject()->GetKey(); plKey animRootKey = animRoot->GetSceneObject()->GetKey();
plArmatureLODMod* avMod = new plArmatureLODMod(avatarName); plArmatureLODMod* avMod = new plArmatureLODMod(avatarName);
@ -1066,7 +1066,7 @@ void plLODAvatarComponent::IAttachModifiers( plMaxNode *node, plErrorMsg *pEr
avMod->SetBodyAgeName(node->GetAgeName()); avMod->SetBodyAgeName(node->GetAgeName());
avMod->SetBodyFootstepSoundPage(fCompPB->GetStr(ParamID(kBodyFootstepSoundPage))); avMod->SetBodyFootstepSoundPage(fCompPB->GetStr(ParamID(kBodyFootstepSoundPage)));
avMod->SetAnimationPrefix(fCompPB->GetStr(ParamID(kAnimationPrefix))); avMod->SetAnimationPrefix(plString::FromUtf8(fCompPB->GetStr(ParamID(kAnimationPrefix))));
int iLODCount = fCompPB->Count(plLODAvatarComponent::kMeshNodeTab); int iLODCount = fCompPB->Count(plLODAvatarComponent::kMeshNodeTab);
for (int i = 0; i < iLODCount; i++) for (int i = 0; i < iLODCount; i++)

6
Sources/Tools/MaxComponent/plClickDragComponent.cpp

@ -448,12 +448,12 @@ hsBool plClickDragComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
pCall2->AddReceiver(axisKey); pCall2->AddReceiver(axisKey);
plAnimCmdMsg* pMsg = new plAnimCmdMsg; plAnimCmdMsg* pMsg = new plAnimCmdMsg;
const char *tempAnimName = pAnim->GetAnimName(); plString tempAnimName = pAnim->GetAnimName();
if (tempAnimName == nil) if (tempAnimName.IsNull())
{ {
//pMsg->SetAnimName(ENTIRE_ANIMATION_NAME); //pMsg->SetAnimName(ENTIRE_ANIMATION_NAME);
pMsg->SetAnimName(pAnim->GetModKey(node)->GetName()); pMsg->SetAnimName(pAnim->GetModKey(node)->GetName());
pAxis->SetAnimLabel(ENTIRE_ANIMATION_NAME); pAxis->SetAnimLabel(_TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME));
} }
else else
{ {

10
Sources/Tools/MaxComponent/plComponentBase.cpp

@ -279,10 +279,8 @@ bool plComponentBase::IsTarget(plMaxNodeBase *node)
return false; return false;
} }
const char* plComponentBase::IGetUniqueName(plMaxNodeBase* target) plString plComponentBase::IGetUniqueName(plMaxNodeBase* target)
{ {
static char nameBuf[256];
// Make sure we've actually got multiple *used* targets. (Some could be nil) // Make sure we've actually got multiple *used* targets. (Some could be nil)
int numUsedTargs = 0; int numUsedTargs = 0;
int thisTargIdx = -1; int thisTargIdx = -1;
@ -305,11 +303,9 @@ const char* plComponentBase::IGetUniqueName(plMaxNodeBase* target)
hsAssert(thisTargIdx != -1, "Bad target for IGetUniqueName"); hsAssert(thisTargIdx != -1, "Bad target for IGetUniqueName");
if (numUsedTargs > 1) if (numUsedTargs > 1)
_snprintf(nameBuf, sizeof(nameBuf), "%s_%d", GetINode()->GetName(), thisTargIdx); return plString::Format("%s_%d", GetINode()->GetName(), thisTargIdx);
else else
strncpy(nameBuf, GetINode()->GetName(), sizeof(nameBuf)); return plString::FromUtf8(GetINode()->GetName());
return nameBuf;
} }
plMaxNodeBase *plComponentBase::GetINode() plMaxNodeBase *plComponentBase::GetINode()

2
Sources/Tools/MaxComponent/plComponentBase.h

@ -70,7 +70,7 @@ protected:
// Get a unique name based on this components name and the index of this target // Get a unique name based on this components name and the index of this target
// Return value points to a static, so don't try to hold on to it // Return value points to a static, so don't try to hold on to it
const char* IGetUniqueName(plMaxNodeBase* target); plString IGetUniqueName(plMaxNodeBase* target);
public: public:
// Permanent Block ID's // Permanent Block ID's

6
Sources/Tools/MaxComponent/plComponentTools.cpp

@ -50,7 +50,7 @@ plKey plComponentTools::AddModifier(plMaxNodeBase *node, plModifier *mod)
return fAddModFunc(node, mod); return fAddModFunc(node, mod);
} }
plKey plComponentTools::GetNewKey(const char *name, plModifier *mod, plLocation loc) plKey plComponentTools::GetNewKey(const plString &name, plModifier *mod, plLocation loc)
{ {
return fNewKey(name, mod, loc); return fNewKey(name, mod, loc);
} }
@ -70,12 +70,12 @@ plKey plComponentTools::GetAnimCompLightModKey(plComponentBase *comp, plMaxNodeB
return fAnimLightKey(comp, node); return fAnimLightKey(comp, node);
} }
*/ */
const char *plComponentTools::GetAnimCompAnimName(plComponentBase *comp) plString plComponentTools::GetAnimCompAnimName(plComponentBase *comp)
{ {
return fAnimName(comp); return fAnimName(comp);
} }
int plComponentTools::GetMaterialAnimModKey(Mtl* mtl, plMaxNodeBase* node, const char *segName, hsTArray<plKey>& keys) int plComponentTools::GetMaterialAnimModKey(Mtl* mtl, plMaxNodeBase* node, const plString &segName, hsTArray<plKey>& keys)
{ {
return fMatMod(mtl, node, segName, keys); return fMatMod(mtl, node, segName, keys);
} }

12
Sources/Tools/MaxComponent/plComponentTools.h

@ -55,11 +55,11 @@ class plComponentBase;
class plMaxNodeBase; class plMaxNodeBase;
typedef plKey (*PAddModFunc) (plMaxNodeBase *, plModifier *); typedef plKey (*PAddModFunc) (plMaxNodeBase *, plModifier *);
typedef plKey (*PGetNewKeyFunc) (const char*, plModifier*, plLocation); typedef plKey (*PGetNewKeyFunc) (const plString&, plModifier*, plLocation);
typedef void (*PSetActivatorKeyFunc) (plMaxNodeBase*, plMaxNodeBase*, plMaxNodeBase*, plResponderModifier*); typedef void (*PSetActivatorKeyFunc) (plMaxNodeBase*, plMaxNodeBase*, plMaxNodeBase*, plResponderModifier*);
typedef plKey (*PGetAnimModKeyFunc) (plComponentBase*, plMaxNodeBase*); typedef plKey (*PGetAnimModKeyFunc) (plComponentBase*, plMaxNodeBase*);
typedef const char* (*PGetAnimNameFunc) (plComponentBase*); typedef plString (*PGetAnimNameFunc) (plComponentBase*);
typedef int (*PGetMaterialAnimModKeyFunc) (Mtl* mtl, plMaxNodeBase* node, const char *segName, hsTArray<plKey>& keys); typedef int (*PGetMaterialAnimModKeyFunc) (Mtl* mtl, plMaxNodeBase* node, const plString &segName, hsTArray<plKey>& keys);
typedef int (*PGetSoundNameAndIndex) (plComponentBase*, plMaxNodeBase* node, const char*& name); typedef int (*PGetSoundNameAndIndex) (plComponentBase*, plMaxNodeBase* node, const char*& name);
// //
@ -101,14 +101,14 @@ public:
{} {}
plKey AddModifier(plMaxNodeBase *node, plModifier *mod); plKey AddModifier(plMaxNodeBase *node, plModifier *mod);
plKey GetNewKey(const char *name, plModifier *mod, plLocation loc); plKey GetNewKey(const plString &name, plModifier *mod, plLocation loc);
void SetActivatorKey(plMaxNodeBase *activatorNode, plMaxNodeBase *responderNode, plMaxNodeBase *convertNode, plResponderModifier *responderLogic); void SetActivatorKey(plMaxNodeBase *activatorNode, plMaxNodeBase *responderNode, plMaxNodeBase *convertNode, plResponderModifier *responderLogic);
const char *GetAnimCompAnimName(plComponentBase *comp); plString GetAnimCompAnimName(plComponentBase *comp);
plKey GetAnimCompModKey(plComponentBase *comp, plMaxNodeBase *node); plKey GetAnimCompModKey(plComponentBase *comp, plMaxNodeBase *node);
// plKey GetAnimCompLightModKey(plComponentBase *comp, plMaxNodeBase *node); // plKey GetAnimCompLightModKey(plComponentBase *comp, plMaxNodeBase *node);
int GetMaterialAnimModKey(Mtl* mtl, plMaxNodeBase* node, const char *segName, hsTArray<plKey>& keys); int GetMaterialAnimModKey(Mtl* mtl, plMaxNodeBase* node, const plString &segName, hsTArray<plKey>& keys);
int GetSoundNameAndIndex(plComponentBase* comp, plMaxNodeBase* node, const char*& name); int GetSoundNameAndIndex(plComponentBase* comp, plMaxNodeBase* node, const char*& name);
}; };

2
Sources/Tools/MaxComponent/plFootstepComponent.cpp

@ -115,7 +115,7 @@ hsBool plFootstepSoundComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
plArmatureEffectFootSound *effect = new plArmatureEffectFootSound(); plArmatureEffectFootSound *effect = new plArmatureEffectFootSound();
// Note: MUST be a hard-coded keyname, since we search for same name in plArmatureMod.cpp // Note: MUST be a hard-coded keyname, since we search for same name in plArmatureMod.cpp
hsgResMgr::ResMgr()->NewKey( "FootstepSounds", effect, node->GetLocation()); hsgResMgr::ResMgr()->NewKey( _TEMP_CONVERT_FROM_LITERAL("FootstepSounds"), effect, node->GetLocation());
int i; int i;
for (i = 0; i < plArmatureEffectsMgr::kMaxSurface; i++) for (i = 0; i < plArmatureEffectsMgr::kMaxSurface; i++)

8
Sources/Tools/MaxComponent/plGUIComponents.cpp

@ -1319,7 +1319,7 @@ hsBool plGUIDialogComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
// Add it to the sceneNode as a generic interface, so it gets loaded with the sceneNode // Add it to the sceneNode as a generic interface, so it gets loaded with the sceneNode
plLocation nodeLoc = sceneNodeKey->GetUoid().GetLocation(); plLocation nodeLoc = sceneNodeKey->GetUoid().GetLocation();
plKey modKey = hsgResMgr::ResMgr()->NewKey( fCompPB->GetStr( kRefDialogName ), mod, nodeLoc ); plKey modKey = hsgResMgr::ResMgr()->NewKey( plString::FromUtf8( fCompPB->GetStr( kRefDialogName ) ), mod, nodeLoc );
hsgResMgr::ResMgr()->AddViaNotify( modKey, new plNodeRefMsg( sceneNodeKey, plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric ), plRefFlags::kActiveRef ); hsgResMgr::ResMgr()->AddViaNotify( modKey, new plNodeRefMsg( sceneNodeKey, plRefMsg::kOnCreate, -1, plNodeRefMsg::kGeneric ), plRefFlags::kActiveRef );
// Also add our dialog mod to the scene node in the same way // Also add our dialog mod to the scene node in the same way
@ -1360,7 +1360,7 @@ hsBool plGUIDialogComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg)
fCompPB->GetStr( kRefDialogName ), (uint32_t)-1 ); fCompPB->GetStr( kRefDialogName ), (uint32_t)-1 );
plLocation nodeLoc = sceneNodeKey->GetUoid().GetLocation(); plLocation nodeLoc = sceneNodeKey->GetUoid().GetLocation();
plKey dlgKey = hsgResMgr::ResMgr()->NewKey( fCompPB->GetStr( kRefDialogName ), fDialogMod, nodeLoc ); plKey dlgKey = hsgResMgr::ResMgr()->NewKey( plString::FromUtf8( fCompPB->GetStr( kRefDialogName ) ), fDialogMod, nodeLoc );
fDialogMod->SetSceneNodeKey( sceneNodeKey ); fDialogMod->SetSceneNodeKey( sceneNodeKey );
@ -2728,7 +2728,7 @@ hsBool plGUIKnobCtrlComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
plAGMasterMod *master = node->GetAGMasterMod(); plAGMasterMod *master = node->GetAGMasterMod();
hsTArray<plKey> keys; hsTArray<plKey> keys;
keys.Append( master->GetKey() ); keys.Append( master->GetKey() );
ctrl->SetAnimationKeys( keys, ENTIRE_ANIMATION_NAME ); ctrl->SetAnimationKeys( keys, _TEMP_CONVERT_FROM_LITERAL( ENTIRE_ANIMATION_NAME ) );
} }
if( fCompPB->GetInt( kRefOrientation ) == 1 ) if( fCompPB->GetInt( kRefOrientation ) == 1 )
@ -4450,7 +4450,7 @@ hsBool plGUIProgressCtrlComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
plAGMasterMod *master = node->GetAGMasterMod(); plAGMasterMod *master = node->GetAGMasterMod();
hsTArray<plKey> keys; hsTArray<plKey> keys;
keys.Append( master->GetKey() ); keys.Append( master->GetKey() );
ctrl->SetAnimationKeys( keys, ENTIRE_ANIMATION_NAME ); ctrl->SetAnimationKeys( keys, _TEMP_CONVERT_FROM_LITERAL( ENTIRE_ANIMATION_NAME ) );
} }
const char *errMsg = ISetSoundIndex( kRefAnimateSound, kRefAnimateSoundComp, pfGUIProgressCtrl::kAnimateSound, node ); const char *errMsg = ISetSoundIndex( kRefAnimateSound, kRefAnimateSoundComp, pfGUIProgressCtrl::kAnimateSound, node );

3
Sources/Tools/MaxComponent/plInventoryObjComponent.cpp

@ -187,8 +187,7 @@ hsBool plInventoryObjComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg)
// Create and register the ClickDrag's logic component // Create and register the ClickDrag's logic component
plLogicModifier *logic = new plLogicModifier; plLogicModifier *logic = new plLogicModifier;
char tmpName[256]; plString tmpName = plString::Format("%s_%s_LogicModifier", obj->GetKeyName().c_str(), GetINode()->GetName());
sprintf(tmpName, "%s_%s_LogicModifier", obj->GetKeyName(), GetINode()->GetName());
plKey logicKey = hsgResMgr::ResMgr()->NewKey(tmpName, logic, node->GetLocation()); plKey logicKey = hsgResMgr::ResMgr()->NewKey(tmpName, logic, node->GetLocation());
hsgResMgr::ResMgr()->AddViaNotify(logicKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef); hsgResMgr::ResMgr()->AddViaNotify(logicKey, new plObjRefMsg(obj->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kModifier), plRefFlags::kActiveRef);

29
Sources/Tools/MaxComponent/plMaxAnimUtils.cpp

@ -58,11 +58,11 @@ float TimeValueToGameTime(TimeValue t)
return float(t)/float(TPS); return float(t)/float(TPS);
} }
bool GetSegMapAnimTime(const char *animName, SegmentMap *segMap, SegmentSpec::SegType type, float& begin, float& end) bool GetSegMapAnimTime(const plString &animName, SegmentMap *segMap, SegmentSpec::SegType type, float& begin, float& end)
{ {
if (segMap) if (segMap)
{ {
if (animName && segMap->find(animName) != segMap->end()) if (!animName.IsNull() && segMap->find(animName) != segMap->end())
{ {
SegmentSpec *spec = (*segMap)[animName]; SegmentSpec *spec = (*segMap)[animName];
if (spec->fType == type) if (spec->fType == type)
@ -124,14 +124,13 @@ SegmentMap *GetSharedAnimSegmentMap(std::vector<Animatable*>& anims, plErrorMsg
return segMap; return segMap;
} }
SegmentSpec::SegmentSpec(float start, float end, char * name, SegType type) : SegmentSpec::SegmentSpec(float start, float end, const plString & name, SegType type) :
fStart(start), fEnd(end), fName(name), fType(type), fInitial(-1) fStart(start), fEnd(end), fName(name), fType(type), fInitial(-1)
{ {
} }
SegmentSpec::~SegmentSpec() SegmentSpec::~SegmentSpec()
{ {
delete [] fName;
} }
// constants used for parsing the note tracks // constants used for parsing the note tracks
@ -154,7 +153,6 @@ SegmentSpec::SegmentSpec()
fStart = -1; fStart = -1;
fEnd = -1; fEnd = -1;
fInitial = -1; fInitial = -1;
fName = nil;
fType = kAnim; fType = kAnim;
} }
@ -212,6 +210,9 @@ void GetSegment(const char *note, float time, SegmentMap *segMap, plErrorMsg *pE
int matchedFields = sscanf(note, " %[^@] @ %s ", segName, segSuffix); int matchedFields = sscanf(note, " %[^@] @ %s ", segName, segSuffix);
plString name = _TEMP_CONVERT_FROM_LITERAL(segName);
plString suffix = _TEMP_CONVERT_FROM_LITERAL(segSuffix);
if (matchedFields == 2) if (matchedFields == 2)
{ {
NoteType type = kNoteUnknown; NoteType type = kNoteUnknown;
@ -249,7 +250,7 @@ void GetSegment(const char *note, float time, SegmentMap *segMap, plErrorMsg *pE
} }
else else
{ {
SegmentMap::iterator existing = segMap->find(segName); SegmentMap::iterator existing = segMap->find(name);
SegmentSpec *existingSpec = (existing != segMap->end()) ? (*existing).second : nil; SegmentSpec *existingSpec = (existing != segMap->end()) ? (*existing).second : nil;
const char *kErrorTitle = "NoteTrack Anim Error"; const char *kErrorTitle = "NoteTrack Anim Error";
@ -304,37 +305,33 @@ void GetSegment(const char *note, float time, SegmentMap *segMap, plErrorMsg *pE
} }
else else
{ {
char *nameCopy = new char[strlen(segName)+1];
strcpy(nameCopy, segName);
switch (type) switch (type)
{ {
case kNoteStartAnim: case kNoteStartAnim:
(*segMap)[nameCopy] = new SegmentSpec(time, -1, nameCopy, SegmentSpec::kAnim); (*segMap)[name] = new SegmentSpec(time, -1, name, SegmentSpec::kAnim);
break; break;
case kNoteStartLoop: case kNoteStartLoop:
(*segMap)[nameCopy] = new SegmentSpec(time, -1, nameCopy, SegmentSpec::kLoop); (*segMap)[name] = new SegmentSpec(time, -1, name, SegmentSpec::kLoop);
break; break;
case kNoteEndLoop: case kNoteEndLoop:
(*segMap)[nameCopy] = new SegmentSpec(-1, time, nameCopy, SegmentSpec::kLoop); (*segMap)[name] = new SegmentSpec(-1, time, name, SegmentSpec::kLoop);
break; break;
case kNoteMarker: case kNoteMarker:
(*segMap)[nameCopy] = new SegmentSpec(time, -1, nameCopy, SegmentSpec::kMarker); (*segMap)[name] = new SegmentSpec(time, -1, name, SegmentSpec::kMarker);
break; break;
case kNoteStopPoint: case kNoteStopPoint:
(*segMap)[nameCopy] = new SegmentSpec(time, -1, nameCopy, SegmentSpec::kStopPoint); (*segMap)[name] = new SegmentSpec(time, -1, name, SegmentSpec::kStopPoint);
break; break;
case kNoteSuppress: case kNoteSuppress:
(*segMap)[nameCopy] = new SegmentSpec(-1, -1, nameCopy, SegmentSpec::kSuppress); (*segMap)[name] = new SegmentSpec(-1, -1, name, SegmentSpec::kSuppress);
break; break;
default: default:
delete [] nameCopy;
break; break;
} }
} }

9
Sources/Tools/MaxComponent/plMaxAnimUtils.h

@ -45,6 +45,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <map> #include <map>
#include <vector> #include <vector>
#include "hsStlSortUtils.h" #include "hsStlSortUtils.h"
#include "plString.h"
class plErrorMsg; class plErrorMsg;
class Animatable; class Animatable;
@ -59,11 +60,11 @@ public:
float fStart; // beginning of the segment in game time float fStart; // beginning of the segment in game time
float fEnd; // end of the segment in game time float fEnd; // end of the segment in game time
float fInitial; // initial position of the animation (-1 for the start) float fInitial; // initial position of the animation (-1 for the start)
char * fName; // name of the segment: controls lifespan of the name plString fName; // name of the segment: controls lifespan of the name
SegType fType; SegType fType;
SegmentSpec(); SegmentSpec();
SegmentSpec(float start, float end, char * name, SegType); SegmentSpec(float start, float end, const plString & name, SegType);
~SegmentSpec(); ~SegmentSpec();
bool Contains(SegmentSpec *spec); bool Contains(SegmentSpec *spec);
@ -71,7 +72,7 @@ public:
// a table mapping segment names to segment spec objects // a table mapping segment names to segment spec objects
typedef std::map<const char *, SegmentSpec*, stringISorter> SegmentMap; typedef std::map<plString, SegmentSpec*, plString::less_i> SegmentMap;
// You can pass in nil for pErrMsg for silent operation // You can pass in nil for pErrMsg for silent operation
SegmentMap *GetAnimSegmentMap(Animatable *anim, plErrorMsg *pErrMsg); SegmentMap *GetAnimSegmentMap(Animatable *anim, plErrorMsg *pErrMsg);
@ -80,7 +81,7 @@ void DeleteSegmentMap(SegmentMap *segMap);
SegmentMap *GetSharedAnimSegmentMap(std::vector<Animatable*>& anims, plErrorMsg *pErrorMsg); SegmentMap *GetSharedAnimSegmentMap(std::vector<Animatable*>& anims, plErrorMsg *pErrorMsg);
bool GetSegMapAnimTime(const char *animName, SegmentMap *segMap, SegmentSpec::SegType type, float& begin, float& end); bool GetSegMapAnimTime(const plString &animName, SegmentMap *segMap, SegmentSpec::SegType type, float& begin, float& end);
// For internal use // For internal use
void GetSegment(const char *note, float time, SegmentMap *segMap, plErrorMsg *pErrMsg); void GetSegment(const char *note, float time, SegmentMap *segMap, plErrorMsg *pErrMsg);

46
Sources/Tools/MaxComponent/plNotetrackAnim.cpp

@ -79,10 +79,10 @@ plNotetrackAnim::~plNotetrackAnim()
DeleteSegmentMap(fSegMap); DeleteSegmentMap(fSegMap);
} }
const char *plNotetrackAnim::GetNextAnimName() plString plNotetrackAnim::GetNextAnimName()
{ {
if (!fSegMap) if (!fSegMap)
return nil; return plString::Null;
while (fAnimIt != fSegMap->end()) while (fAnimIt != fSegMap->end())
{ {
@ -94,16 +94,16 @@ const char *plNotetrackAnim::GetNextAnimName()
} }
fAnimIt = fSegMap->begin(); fAnimIt = fSegMap->begin();
return nil; return plString::Null;
} }
plAnimInfo plNotetrackAnim::GetAnimInfo(const char *animName) plAnimInfo plNotetrackAnim::GetAnimInfo(const plString &animName)
{ {
if (!fSegMap) if (!fSegMap)
return plAnimInfo(); return plAnimInfo();
if (!animName || *animName == '\0' || fSegMap->find(animName) == fSegMap->end()) if (animName.IsEmpty() || fSegMap->find(animName) == fSegMap->end())
return plAnimInfo(fSegMap, nil); return plAnimInfo(fSegMap, plString::Null);
else else
return plAnimInfo(fSegMap, animName); return plAnimInfo(fSegMap, animName);
@ -112,10 +112,10 @@ plAnimInfo plNotetrackAnim::GetAnimInfo(const char *animName)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
plAnimInfo::plAnimInfo(SegmentMap *segMap, const char *animName) plAnimInfo::plAnimInfo(SegmentMap *segMap, const plString &animName)
{ {
fSegMap = segMap; fSegMap = segMap;
fAnimSpec = animName ? (*fSegMap)[animName] : nil; fAnimSpec = !animName.IsNull() ? (*fSegMap)[animName] : nil;
if (fSegMap) if (fSegMap)
{ {
@ -125,9 +125,9 @@ plAnimInfo::plAnimInfo(SegmentMap *segMap, const char *animName)
} }
} }
const char *plAnimInfo::GetAnimName() plString plAnimInfo::GetAnimName()
{ {
return fAnimSpec ? fAnimSpec->fName : nil; return fAnimSpec ? fAnimSpec->fName : plString::Null;
} }
float plAnimInfo::GetAnimStart() float plAnimInfo::GetAnimStart()
@ -145,10 +145,10 @@ float plAnimInfo::GetAnimInitial()
return fAnimSpec ? fAnimSpec->fInitial : -1; return fAnimSpec ? fAnimSpec->fInitial : -1;
} }
const char *plAnimInfo::GetNextLoopName() plString plAnimInfo::GetNextLoopName()
{ {
if (!fSegMap) if (!fSegMap)
return nil; return plString::Null;
while (fLoopIt != fSegMap->end()) while (fLoopIt != fSegMap->end())
{ {
@ -161,12 +161,12 @@ const char *plAnimInfo::GetNextLoopName()
} }
fLoopIt = fSegMap->begin(); fLoopIt = fSegMap->begin();
return nil; return plString::Null;
} }
float plAnimInfo::GetLoopStart(const char *loopName) float plAnimInfo::GetLoopStart(const plString &loopName)
{ {
if (!fSegMap || loopName == nil) if (!fSegMap || loopName.IsNull())
return -1; return -1;
if (fSegMap->find(loopName) != fSegMap->end()) if (fSegMap->find(loopName) != fSegMap->end())
@ -181,9 +181,9 @@ float plAnimInfo::GetLoopStart(const char *loopName)
return -1; return -1;
} }
float plAnimInfo::GetLoopEnd(const char *loopName) float plAnimInfo::GetLoopEnd(const plString &loopName)
{ {
if (!fSegMap || loopName == nil) if (!fSegMap || loopName.IsNull())
return -1; return -1;
if (fSegMap->find(loopName) != fSegMap->end()) if (fSegMap->find(loopName) != fSegMap->end())
@ -198,10 +198,10 @@ float plAnimInfo::GetLoopEnd(const char *loopName)
return -1; return -1;
} }
const char *plAnimInfo::GetNextMarkerName() plString plAnimInfo::GetNextMarkerName()
{ {
if (!fSegMap) if (!fSegMap)
return nil; return plString::Null;
while (fMarkerIt != fSegMap->end()) while (fMarkerIt != fSegMap->end())
{ {
@ -214,10 +214,10 @@ const char *plAnimInfo::GetNextMarkerName()
} }
fMarkerIt = fSegMap->begin(); fMarkerIt = fSegMap->begin();
return nil; return plString::Null;
} }
float plAnimInfo::GetMarkerTime(const char *markerName) float plAnimInfo::GetMarkerTime(const plString &markerName)
{ {
if (!fSegMap) if (!fSegMap)
return -1; return -1;
@ -250,9 +250,9 @@ float plAnimInfo::GetNextStopPoint()
return -1; return -1;
} }
bool plAnimInfo::IsSuppressed(const char *animName) bool plAnimInfo::IsSuppressed(const plString &animName)
{ {
if (!fSegMap || animName == nil) if (!fSegMap || animName.IsNull())
return false; return false;
if (fSegMap->find(animName) != fSegMap->end()) if (fSegMap->find(animName) != fSegMap->end())

20
Sources/Tools/MaxComponent/plNotetrackAnim.h

@ -56,22 +56,22 @@ protected:
public: public:
plAnimInfo() : fSegMap(NULL), fAnimSpec(NULL) {} plAnimInfo() : fSegMap(NULL), fAnimSpec(NULL) {}
plAnimInfo(SegmentMap *segMap, const char *animName); plAnimInfo(SegmentMap *segMap, const plString &animName);
const char *GetAnimName(); plString GetAnimName();
float GetAnimStart(); float GetAnimStart();
float GetAnimEnd(); float GetAnimEnd();
float GetAnimInitial(); float GetAnimInitial();
const char *GetNextLoopName(); plString GetNextLoopName();
float GetLoopStart(const char *loopName); float GetLoopStart(const plString &loopName);
float GetLoopEnd(const char *loopName); float GetLoopEnd(const plString &loopName);
const char *GetNextMarkerName(); plString GetNextMarkerName();
float GetMarkerTime(const char *markerName); float GetMarkerTime(const plString &markerName);
float GetNextStopPoint(); // Returns -1 on last stop point float GetNextStopPoint(); // Returns -1 on last stop point
bool IsSuppressed(const char *animName); bool IsSuppressed(const plString &animName);
}; };
class plNotetrackAnim class plNotetrackAnim
@ -88,8 +88,8 @@ public:
bool HasNotetracks() { return (fSegMap != NULL); } bool HasNotetracks() { return (fSegMap != NULL); }
const char *GetNextAnimName(); plString GetNextAnimName();
plAnimInfo GetAnimInfo(const char *animName); plAnimInfo GetAnimInfo(const plString &animName);
}; };
#endif //PL_NOTETRACK_ANIM #endif //PL_NOTETRACK_ANIM

14
Sources/Tools/MaxComponent/plNotetrackDlg.cpp

@ -129,11 +129,11 @@ void plNoteTrackDlg::ILoadAnims()
SegmentSpec *spec = it->second; SegmentSpec *spec = it->second;
if (spec->fType == SegmentSpec::kAnim) if (spec->fType == SegmentSpec::kAnim)
{ {
int idx = ComboBox_AddString(fhAnim, spec->fName); int idx = ComboBox_AddString(fhAnim, spec->fName.c_str());
ComboBox_SetItemData(fhAnim, idx, kName); ComboBox_SetItemData(fhAnim, idx, kName);
// If this is the saved animation name, select it // If this is the saved animation name, select it
if (!strcmp(spec->fName, savedAnim)) if (!spec->fName.Compare(savedAnim))
ComboBox_SetCurSel(fhAnim, idx); ComboBox_SetCurSel(fhAnim, idx);
} }
} }
@ -155,8 +155,8 @@ void plNoteTrackDlg::ILoadLoops()
{ {
// Get the animation segment (or leave it nil if we're using the entire animation) // Get the animation segment (or leave it nil if we're using the entire animation)
SegmentSpec *animSpec = nil; SegmentSpec *animSpec = nil;
const char *animName = fPB->GetStr(fAnimID); plString animName = plString::FromUtf8(fPB->GetStr(fAnimID));
if (animName && *animName != '\0' && fSegMap->find(animName) != fSegMap->end()) if (!animName.IsEmpty() && fSegMap->find(animName) != fSegMap->end())
animSpec = (*fSegMap)[animName]; animSpec = (*fSegMap)[animName];
// Get the saved loop name // Get the saved loop name
@ -174,10 +174,10 @@ void plNoteTrackDlg::ILoadLoops()
if (!animSpec || animSpec->Contains(spec)) if (!animSpec || animSpec->Contains(spec))
{ {
// Add the name // Add the name
int idx = ComboBox_AddString(fhLoop, spec->fName); int idx = ComboBox_AddString(fhLoop, spec->fName.c_str());
ComboBox_SetItemData(fhLoop, idx, kName); ComboBox_SetItemData(fhLoop, idx, kName);
if (!strcmp(loopName, spec->fName)) if (!spec->fName.Compare(loopName))
ComboBox_SetCurSel(fhLoop, idx); ComboBox_SetCurSel(fhLoop, idx);
} }
} }
@ -192,7 +192,7 @@ const char *plNoteTrackDlg::IGetSel(HWND hCombo)
{ {
char buf[256]; char buf[256];
ComboBox_GetText(hCombo, buf, sizeof(buf)); ComboBox_GetText(hCombo, buf, sizeof(buf));
return (*fSegMap)[buf]->fName; return (*fSegMap)[plString::FromUtf8(buf)]->fName.c_str();
} }
return ""; return "";

2
Sources/Tools/MaxComponent/plObjectFlockerComponent.cpp

@ -271,7 +271,7 @@ hsBool plObjectFlockerComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg
hsBool plObjectFlockerComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) hsBool plObjectFlockerComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
{ {
node->AddModifier(fFlocker, nil); node->AddModifier(fFlocker, plString::Null);
return true; return true;
} }

6
Sources/Tools/MaxComponent/plParticleComponents.cpp

@ -165,7 +165,7 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
int32_t i, j, k; int32_t i, j, k;
plLocation nodeLoc = node->GetKey()->GetUoid().GetLocation(); plLocation nodeLoc = node->GetKey()->GetUoid().GetLocation();
const char *objName = node->GetKey()->GetName(); plString objName = node->GetKey()->GetName();
plSceneObject *sObj = node->GetSceneObject(); plSceneObject *sObj = node->GetSceneObject();
plParticleSystem *sys = new plParticleSystem(); plParticleSystem *sys = new plParticleSystem();
@ -518,7 +518,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node)
hsControlConverter& cc = hsControlConverter::Instance(); hsControlConverter& cc = hsControlConverter::Instance();
float start, end; float start, end;
if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME)) if (!anim->GetName().Compare(ENTIRE_ANIMATION_NAME))
{ {
start = end = -1; start = end = -1;
} }
@ -1051,7 +1051,7 @@ void plParticleVolumeComponent::BuildVolume(plMaxNode *node)
return; // already converted it return; // already converted it
fBound = new plBoundInterface; fBound = new plBoundInterface;
hsgResMgr::ResMgr()->NewKey(node->GetName(), fBound, node->GetLocation(), node->GetLoadMask()); hsgResMgr::ResMgr()->NewKey(plString::FromUtf8(node->GetName()), fBound, node->GetLocation(), node->GetLoadMask());
fBound->Init(plMeshConverter::Instance().CreateConvexVolume(node)); fBound->Init(plMeshConverter::Instance().CreateConvexVolume(node));
hsgResMgr::ResMgr()->AddViaNotify(fBound->GetKey(), new plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef); hsgResMgr::ResMgr()->AddViaNotify(fBound->GetKey(), new plObjRefMsg(node->GetKey(), plRefMsg::kOnCreate, -1, plObjRefMsg::kInterface), plRefFlags::kActiveRef);
} }

6
Sources/Tools/MaxComponent/plPhysicalComponents.cpp

@ -1325,19 +1325,19 @@ hsBool plSwim2DComponent::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg)
case kCurrentSpiral: case kCurrentSpiral:
{ {
fSwimRegions[node] = new plSwimCircularCurrentRegion(); fSwimRegions[node] = new plSwimCircularCurrentRegion();
hsgResMgr::ResMgr()->NewKey(node->GetName(), fSwimRegions[node], node->GetLocation(), node->GetLoadMask()); hsgResMgr::ResMgr()->NewKey(plString::FromUtf8(node->GetName()), fSwimRegions[node], node->GetLocation(), node->GetLoadMask());
break; break;
} }
case kCurrentStraight: case kCurrentStraight:
{ {
fSwimRegions[node] = new plSwimStraightCurrentRegion(); fSwimRegions[node] = new plSwimStraightCurrentRegion();
hsgResMgr::ResMgr()->NewKey(node->GetName(), fSwimRegions[node], node->GetLocation(), node->GetLoadMask()); hsgResMgr::ResMgr()->NewKey(plString::FromUtf8(node->GetName()), fSwimRegions[node], node->GetLocation(), node->GetLoadMask());
break; break;
} }
default: default:
{ {
fSwimRegions[node] = new plSwimRegionInterface(); fSwimRegions[node] = new plSwimRegionInterface();
hsgResMgr::ResMgr()->NewKey(node->GetName(), fSwimRegions[node], node->GetLocation(), node->GetLoadMask()); hsgResMgr::ResMgr()->NewKey(plString::FromUtf8(node->GetName()), fSwimRegions[node], node->GetLocation(), node->GetLoadMask());
break; break;
} }
} }

22
Sources/Tools/MaxComponent/plPythonFileComponent.cpp

@ -102,7 +102,7 @@ class plCommonPythonLib : public plCommonObjLib
if( objectKey->GetUoid().GetClassType() == plPythonFileMod::Index() ) if( objectKey->GetUoid().GetClassType() == plPythonFileMod::Index() )
return true; return true;
if( objectKey->GetUoid().GetClassType() == plSceneObject::Index() && if( objectKey->GetUoid().GetClassType() == plSceneObject::Index() &&
strcmp( objectKey->GetUoid().GetObjectName(), plSDL::kAgeSDLObjectName ) == 0 ) objectKey->GetUoid().GetObjectName().Compare( plSDL::kAgeSDLObjectName ) == 0 )
return true; return true;
return false; return false;
} }
@ -457,7 +457,7 @@ hsBool plPythonFileComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
break; break;
case plAutoUIParam::kTypeString: case plAutoUIParam::kTypeString:
pyParam.SetToString(param->GetString(pb)); pyParam.SetToString(_TEMP_CONVERT_FROM_LITERAL(param->GetString(pb)));
mod->AddParameter(pyParam); mod->AddParameter(pyParam);
break; break;
@ -805,9 +805,9 @@ hsBool plPythonFileComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
{ {
plAnimComponentBase *animcomp = (plAnimComponentBase*)comp; plAnimComponentBase *animcomp = (plAnimComponentBase*)comp;
// save out the animation name first // save out the animation name first
const char *tempAnimName = animcomp->GetAnimName(); plString tempAnimName = animcomp->GetAnimName();
if (tempAnimName == nil) if (tempAnimName.IsNull())
pyParam.SetToAnimationName(ENTIRE_ANIMATION_NAME); pyParam.SetToAnimationName(_TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME));
else else
pyParam.SetToAnimationName(tempAnimName); pyParam.SetToAnimationName(tempAnimName);
mod->AddParameter(pyParam); mod->AddParameter(pyParam);
@ -929,7 +929,7 @@ hsBool plPythonFileComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
break; break;
case plAutoUIParam::kTypeDropDownList: case plAutoUIParam::kTypeDropDownList:
pyParam.SetToString(param->GetString(pb)); pyParam.SetToString(_TEMP_CONVERT_FROM_LITERAL(param->GetString(pb)));
mod->AddParameter(pyParam); mod->AddParameter(pyParam);
break; break;
@ -1074,13 +1074,13 @@ static BOOL CALLBACK WarnDialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM l
switch (err.error) switch (err.error)
{ {
case plPythonFileComponent::Validate::kPythonBadVer: case plPythonFileComponent::kPythonBadVer:
ListView_SetItemText(hList, idx, 2, "Old Version"); ListView_SetItemText(hList, idx, 2, "Old Version");
break; break;
case plPythonFileComponent::Validate::kPythonNoVer: case plPythonFileComponent::kPythonNoVer:
ListView_SetItemText(hList, idx, 2, "No Version"); ListView_SetItemText(hList, idx, 2, "No Version");
break; break;
case plPythonFileComponent::Validate::kPythonNoFile: case plPythonFileComponent::kPythonNoFile:
ListView_SetItemText(hList, idx, 2, "No File/Python Error"); ListView_SetItemText(hList, idx, 2, "No File/Python Error");
break; break;
} }
@ -1119,10 +1119,10 @@ static void WriteBadPythonText(ErrorSet& badNodes)
case plPythonFileComponent::kPythonBadVer: case plPythonFileComponent::kPythonBadVer:
errorText = "Old Version"; errorText = "Old Version";
break; break;
case plPythonFileComponent::Validate::kPythonNoVer: case plPythonFileComponent::kPythonNoVer:
errorText = "No Version"; errorText = "No Version";
break; break;
case plPythonFileComponent::Validate::kPythonNoFile: case plPythonFileComponent::kPythonNoFile:
errorText = "No File/Python Error"; errorText = "No File/Python Error";
break; break;
} }

22
Sources/Tools/MaxComponent/plResponderAnim.cpp

@ -333,7 +333,7 @@ plMessage *plResponderCmdAnim::ICreateAnimMsg(plMaxNode* node, plErrorMsg *pErrM
plAnimCmdMsg *msg = new plAnimCmdMsg; plAnimCmdMsg *msg = new plAnimCmdMsg;
msg->AddReceiver(animKey); msg->AddReceiver(animKey);
const char *tempAnimName = comp->GetAnimName(); plString tempAnimName = comp->GetAnimName();
msg->SetAnimName(tempAnimName); msg->SetAnimName(tempAnimName);
// Create and initialize a message for the command // Create and initialize a message for the command
@ -364,7 +364,7 @@ plMessage *plResponderCmdAnim::ICreateAnimMsg(plMaxNode* node, plErrorMsg *pErrM
// anims with a loop set in advance will actually work with this. -Colin // anims with a loop set in advance will actually work with this. -Colin
// msg->SetCmd(plAnimCmdMsg::kSetLoopBegin); // msg->SetCmd(plAnimCmdMsg::kSetLoopBegin);
// msg->SetCmd(plAnimCmdMsg::kSetLoopEnd); // msg->SetCmd(plAnimCmdMsg::kSetLoopEnd);
const char *loopName = pb->GetStr(kAnimLoop); plString loopName = plString::FromUtf8(pb->GetStr(kAnimLoop));
msg->SetLoopName(loopName); msg->SetLoopName(loopName);
} }
break; break;
@ -481,13 +481,14 @@ void plResponderCmdAnim::GetWaitPoints(IParamBlock2 *pb, WaitPoints& waitPoints)
return; return;
plAnimComponent *animComp = (plAnimComponent*)GetComponent(pb); plAnimComponent *animComp = (plAnimComponent*)GetComponent(pb);
const char *animName = animComp->GetAnimName(); plString animName = animComp->GetAnimName();
if (animComp) if (animComp)
{ {
plNotetrackAnim notetrackAnim(animComp, nil); plNotetrackAnim notetrackAnim(animComp, nil);
plAnimInfo info = notetrackAnim.GetAnimInfo(animName); plAnimInfo info = notetrackAnim.GetAnimInfo(animName);
while (const char *marker = info.GetNextMarkerName()) plString marker;
while (!(marker = info.GetNextMarkerName()).IsNull())
waitPoints.push_back(marker); waitPoints.push_back(marker);
} }
} }
@ -507,11 +508,11 @@ void plResponderCmdAnim::CreateWait(plMaxNode* node, plErrorMsg* pErrMsg, IParam
eventMsg->fRepeats = 0; eventMsg->fRepeats = 0;
eventMsg->fUser = waitInfo.callbackUser; eventMsg->fUser = waitInfo.callbackUser;
if (waitInfo.point) if (!waitInfo.point.IsNull())
{ {
// FIXME COLIN - Error checking here? // FIXME COLIN - Error checking here?
plAnimComponent *animComp = (plAnimComponent*)GetComponent(pb); plAnimComponent *animComp = (plAnimComponent*)GetComponent(pb);
const char *animName = animComp->GetAnimName(); plString animName = animComp->GetAnimName();
plNotetrackAnim notetrackAnim(animComp, nil); plNotetrackAnim notetrackAnim(animComp, nil);
plAnimInfo info = notetrackAnim.GetAnimInfo(animName); plAnimInfo info = notetrackAnim.GetAnimInfo(animName);
@ -752,18 +753,19 @@ void plResponderAnimProc::ILoadUser(HWND hWnd, IParamBlock2 *pb)
plComponentBase *comp = plResponderCmdAnim::Instance().GetComponent(pb); plComponentBase *comp = plResponderCmdAnim::Instance().GetComponent(pb);
if (comp && comp->ClassID() == ANIM_COMP_CID) if (comp && comp->ClassID() == ANIM_COMP_CID)
{ {
const char *animName = ((plAnimComponent*)comp)->GetAnimName(); plString animName = ((plAnimComponent*)comp)->GetAnimName();
// Get the shared animations for all the nodes this component is applied to // Get the shared animations for all the nodes this component is applied to
plNotetrackAnim anim(comp, nil); plNotetrackAnim anim(comp, nil);
plAnimInfo info = anim.GetAnimInfo(animName); plAnimInfo info = anim.GetAnimInfo(animName);
// Get all the loops in this animation // Get all the loops in this animation
while (const char *loopName = info.GetNextLoopName()) plString loopName;
while (!(loopName = info.GetNextLoopName()).IsNull())
{ {
int idx = ComboBox_AddString(hLoop, loopName); int idx = ComboBox_AddString(hLoop, loopName.c_str());
ComboBox_SetItemData(hLoop, idx, 1); ComboBox_SetItemData(hLoop, idx, 1);
if (!strcmp(loopName, savedName)) if (!loopName.Compare(savedName))
ComboBox_SetCurSel(hLoop, idx); ComboBox_SetCurSel(hLoop, idx);
} }

6
Sources/Tools/MaxComponent/plResponderCmd.h

@ -55,11 +55,11 @@ class plMaxNode;
class ResponderWaitInfo class ResponderWaitInfo
{ {
public: public:
const char* responderName; // For error messages plString responderName; // For error messages
plMessage *msg; // Message created by the responder command plMessage *msg; // Message created by the responder command
plKey receiver; // Key to send the callback message to plKey receiver; // Key to send the callback message to
const char *point; // Marker name to wait on (nil for end) plString point; // Marker name to wait on (nil for end)
int callbackUser; // Value to set the callback user value to int callbackUser; // Value to set the callback user value to
}; };
@ -81,7 +81,7 @@ public:
virtual void SetupProperties(plMaxNode* node, plErrorMsg* pErrMsg, IParamBlock2* pb) {} virtual void SetupProperties(plMaxNode* node, plErrorMsg* pErrMsg, IParamBlock2* pb) {}
virtual plMessage *CreateMsg(plMaxNode* node, plErrorMsg* pErrMsg, IParamBlock2* pb)=0; virtual plMessage *CreateMsg(plMaxNode* node, plErrorMsg* pErrMsg, IParamBlock2* pb)=0;
typedef std::vector<std::string> WaitPoints; typedef std::vector<plString> WaitPoints;
// Can other commands wait on you? // Can other commands wait on you?
virtual bool IsWaitable(IParamBlock2 *pb) { return false; } virtual bool IsWaitable(IParamBlock2 *pb) { return false; }
// The names of the points commands can wait on (or leave empty for only 'end') // The names of the points commands can wait on (or leave empty for only 'end')

6
Sources/Tools/MaxComponent/plResponderComponent.cpp

@ -491,11 +491,11 @@ void plResponderComponent::ISetupDefaultWait(plMaxNode* node, plErrorMsg* pErrMs
int convertedIdx = cmdIdxs[i]; int convertedIdx = cmdIdxs[i];
ResponderWaitInfo waitInfo; ResponderWaitInfo waitInfo;
waitInfo.responderName = GetINode()->GetName(); waitInfo.responderName = plString::FromUtf8(GetINode()->GetName());
waitInfo.receiver = responder->GetKey(); waitInfo.receiver = responder->GetKey();
waitInfo.callbackUser = numCallbacks++; waitInfo.callbackUser = numCallbacks++;
waitInfo.msg = cmds[convertedIdx].fMsg; waitInfo.msg = cmds[convertedIdx].fMsg;
waitInfo.point = nil; waitInfo.point = plString::Null;
IParamBlock2 *pb = (IParamBlock2*)statePB->GetReferenceTarget(kStateCmdParams, 0, i); IParamBlock2 *pb = (IParamBlock2*)statePB->GetReferenceTarget(kStateCmdParams, 0, i);
plResponderCmd *cmd = plResponderCmd::Find(pb); plResponderCmd *cmd = plResponderCmd::Find(pb);
@ -525,7 +525,7 @@ void plResponderComponent::IConvertCmdWaits(plMaxNode* node, plErrorMsg* pErrMsg
int convertedIdx = cmdIdxs[wait]; int convertedIdx = cmdIdxs[wait];
ResponderWaitInfo waitInfo; ResponderWaitInfo waitInfo;
waitInfo.responderName = GetINode()->GetName(); waitInfo.responderName = plString::FromUtf8(GetINode()->GetName());
waitInfo.receiver = responder->GetKey(); waitInfo.receiver = responder->GetKey();
waitInfo.callbackUser = numCallbacks++; waitInfo.callbackUser = numCallbacks++;
waitInfo.msg = cmds[convertedIdx].fMsg; waitInfo.msg = cmds[convertedIdx].fMsg;

2
Sources/Tools/MaxComponent/plResponderLink.cpp

@ -1262,7 +1262,7 @@ void plResponderCmdDelay::CreateWait(plMaxNode* node, plErrorMsg* pErrMsg, IPara
"However, you don't actually need two commands to wait on\n" "However, you don't actually need two commands to wait on\n"
"the same command since the first command will automatically\n" "the same command since the first command will automatically\n"
"delay any commands further down the list", "delay any commands further down the list",
waitInfo.responderName, node->GetName()).Show(); waitInfo.responderName.c_str(), node->GetName()).Show();
pErrMsg->Set(false); pErrMsg->Set(false);
} }
else else

46
Sources/Tools/MaxComponent/plResponderMtl.cpp

@ -250,12 +250,12 @@ Mtl *plResponderCmdMtl::GetMtl(IParamBlock2 *pb)
return (Mtl*)pb->GetReferenceTarget(kMtlRef); return (Mtl*)pb->GetReferenceTarget(kMtlRef);
} }
const char *plResponderCmdMtl::GetAnim(IParamBlock2 *pb) plString plResponderCmdMtl::GetAnim(IParamBlock2 *pb)
{ {
return pb->GetStr(kMtlAnim); return plString::FromUtf8(pb->GetStr(kMtlAnim));
} }
void ISearchLayerRecur(plLayerInterface *layer, const char *segName, hsTArray<plKey>& keys) void ISearchLayerRecur(plLayerInterface *layer, const plString &segName, hsTArray<plKey>& keys)
{ {
if (!layer) if (!layer)
return; return;
@ -263,10 +263,8 @@ void ISearchLayerRecur(plLayerInterface *layer, const char *segName, hsTArray<pl
plLayerAnimation *animLayer = plLayerAnimation::ConvertNoRef(layer); plLayerAnimation *animLayer = plLayerAnimation::ConvertNoRef(layer);
if (animLayer) if (animLayer)
{ {
char *ID = animLayer->GetSegmentID(); plString ID = animLayer->GetSegmentID();
if (ID == nil) if (!segName.Compare(ID))
ID = "";
if (!strcmp(ID, segName))
{ {
if( keys.kMissingIndex == keys.Find(animLayer->GetKey()) ) if( keys.kMissingIndex == keys.Find(animLayer->GetKey()) )
keys.Append(animLayer->GetKey()); keys.Append(animLayer->GetKey());
@ -276,17 +274,16 @@ void ISearchLayerRecur(plLayerInterface *layer, const char *segName, hsTArray<pl
ISearchLayerRecur(layer->GetAttached(), segName, keys); ISearchLayerRecur(layer->GetAttached(), segName, keys);
} }
int ISearchLayerRecur(hsGMaterial* mat, const char *segName, hsTArray<plKey>& keys) int ISearchLayerRecur(hsGMaterial* mat, const plString &segName, hsTArray<plKey>& keys)
{ {
if (segName == nil) plString name = segName.IsNull() ? _TEMP_CONVERT_FROM_LITERAL("") : segName;
segName = "";
int i; int i;
for( i = 0; i < mat->GetNumLayers(); i++ ) for( i = 0; i < mat->GetNumLayers(); i++ )
ISearchLayerRecur(mat->GetLayer(i), segName, keys); ISearchLayerRecur(mat->GetLayer(i), name, keys);
return keys.GetCount(); return keys.GetCount();
} }
int GetMatAnimModKey(Mtl* mtl, plMaxNodeBase* node, const char* segName, hsTArray<plKey>& keys) int GetMatAnimModKey(Mtl* mtl, plMaxNodeBase* node, const plString& segName, hsTArray<plKey>& keys)
{ {
int retVal = 0; int retVal = 0;
@ -336,7 +333,7 @@ plMessage *plResponderCmdMtl::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, IP
if (!maxMtl) if (!maxMtl)
throw "No material specified"; throw "No material specified";
const char *animName = pb->GetStr(kMtlAnim); plString animName = plString::FromUtf8(pb->GetStr(kMtlAnim));
float begin=-1.f; float begin=-1.f;
float end = -1.f; float end = -1.f;
@ -357,9 +354,8 @@ plMessage *plResponderCmdMtl::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, IP
GetMatAnimModKey(maxMtl, mtlNode, animName, keys); GetMatAnimModKey(maxMtl, mtlNode, animName, keys);
const char *loopName = nil; plString loopName = plString::FromUtf8(pb->GetStr(kMtlLoop));
loopName = pb->GetStr(kMtlLoop); if (segMap && !loopName.IsNull())
if (segMap && loopName)
GetSegMapAnimTime(loopName, segMap, SegmentSpec::kLoop, begin, end); GetSegMapAnimTime(loopName, segMap, SegmentSpec::kLoop, begin, end);
DeleteSegmentMap(segMap); DeleteSegmentMap(segMap);
@ -445,13 +441,14 @@ bool plResponderCmdMtl::IsWaitable(IParamBlock2 *pb)
void plResponderCmdMtl::GetWaitPoints(IParamBlock2 *pb, WaitPoints& waitPoints) void plResponderCmdMtl::GetWaitPoints(IParamBlock2 *pb, WaitPoints& waitPoints)
{ {
Mtl *mtl = GetMtl(pb); Mtl *mtl = GetMtl(pb);
const char *animName = GetAnim(pb); plString animName = GetAnim(pb);
if (mtl) if (mtl)
{ {
plNotetrackAnim notetrackAnim(mtl, nil); plNotetrackAnim notetrackAnim(mtl, nil);
plAnimInfo info = notetrackAnim.GetAnimInfo(animName); plAnimInfo info = notetrackAnim.GetAnimInfo(animName);
while (const char *marker = info.GetNextMarkerName()) plString marker;
while (!(marker = info.GetNextMarkerName()).IsNull())
waitPoints.push_back(marker); waitPoints.push_back(marker);
} }
} }
@ -468,11 +465,11 @@ void plResponderCmdMtl::CreateWait(plMaxNode* node, plErrorMsg* pErrMsg, IParamB
eventMsg->fEvent = kStop; eventMsg->fEvent = kStop;
eventMsg->fUser = waitInfo.callbackUser; eventMsg->fUser = waitInfo.callbackUser;
if (waitInfo.point) if (!waitInfo.point.IsNull())
{ {
// FIXME COLIN - Error checking here? // FIXME COLIN - Error checking here?
Mtl *mtl = GetMtl(pb); Mtl *mtl = GetMtl(pb);
const char *animName = GetAnim(pb); plString animName = GetAnim(pb);
plNotetrackAnim notetrackAnim(mtl, nil); plNotetrackAnim notetrackAnim(mtl, nil);
plAnimInfo info = notetrackAnim.GetAnimInfo(animName); plAnimInfo info = notetrackAnim.GetAnimInfo(animName);
@ -545,13 +542,14 @@ void plResponderMtlProc::ILoadUser(HWND hWnd, IParamBlock2 *pb)
ComboBox_Enable(hLoop, TRUE); ComboBox_Enable(hLoop, TRUE);
plNotetrackAnim anim(mtl, nil); plNotetrackAnim anim(mtl, nil);
const char *animName = pb->GetStr(kMtlAnim); plString animName = plString::FromUtf8(pb->GetStr(kMtlAnim));
plAnimInfo info = anim.GetAnimInfo(animName); plAnimInfo info = anim.GetAnimInfo(animName);
while (const char *loopName = info.GetNextLoopName()) plString loopName;
while (!(loopName = info.GetNextLoopName()).IsNull())
{ {
sel = ComboBox_AddString(hLoop, loopName); sel = ComboBox_AddString(hLoop, loopName.c_str());
if (!strcmp(loopName, savedName)) if (!loopName.Compare(savedName))
ComboBox_SetCurSel(hLoop, sel); ComboBox_SetCurSel(hLoop, sel);
} }
} }

6
Sources/Tools/MaxComponent/plResponderMtl.h

@ -52,7 +52,7 @@ class Mtl;
class plMaxNodeBase; class plMaxNodeBase;
template <class T> class hsTArray; template <class T> class hsTArray;
int GetMatAnimModKey(Mtl* mtl, plMaxNodeBase* node, const char *segName, hsTArray<plKey>& keys); int GetMatAnimModKey(Mtl* mtl, plMaxNodeBase* node, const plString &segName, hsTArray<plKey>& keys);
class plResponderCmdMtl : public plResponderCmd class plResponderCmdMtl : public plResponderCmd
{ {
@ -74,7 +74,7 @@ public:
virtual void CreateWait(plMaxNode* node, plErrorMsg* pErrMsg, IParamBlock2 *pb, ResponderWaitInfo& waitInfo); virtual void CreateWait(plMaxNode* node, plErrorMsg* pErrMsg, IParamBlock2 *pb, ResponderWaitInfo& waitInfo);
Mtl *GetMtl(IParamBlock2 *pb); Mtl *GetMtl(IParamBlock2 *pb);
const char *GetAnim(IParamBlock2 *pb); plString GetAnim(IParamBlock2 *pb);
}; };
int GetMatAnimModKey(Mtl* mtl, plMaxNodeBase* node, const char* segName, hsTArray<plKey>& keys); int GetMatAnimModKey(Mtl* mtl, plMaxNodeBase* node, const plString& segName, hsTArray<plKey>& keys);

6
Sources/Tools/MaxComponent/plResponderWait.cpp

@ -140,12 +140,12 @@ int ResponderWait::GetWaitingOn(IParamBlock2* waitPB)
return waitPB->GetInt(kWaitWho); return waitPB->GetInt(kWaitWho);
} }
const char* ResponderWait::GetWaitPoint(IParamBlock2* waitPB) plString ResponderWait::GetWaitPoint(IParamBlock2* waitPB)
{ {
const char* point = waitPB->GetStr(kWaitPoint); const char* point = waitPB->GetStr(kWaitPoint);
if (point && *point == '\0') if (point && *point == '\0')
return nil; return plString::Null;
return point; return plString::FromUtf8(point);
} }
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

3
Sources/Tools/MaxComponent/plResponderWait.h

@ -46,6 +46,7 @@ class IParamBlock2;
class plKey; class plKey;
class plMessage; class plMessage;
class plResponderModifier; class plResponderModifier;
class plString;
namespace ResponderWait namespace ResponderWait
{ {
@ -62,5 +63,5 @@ namespace ResponderWait
bool GetWaitOnMe(IParamBlock2* waitPB); bool GetWaitOnMe(IParamBlock2* waitPB);
int GetWaitingOn(IParamBlock2* waitPB); int GetWaitingOn(IParamBlock2* waitPB);
const char* GetWaitPoint(IParamBlock2* waitPB); plString GetWaitPoint(IParamBlock2* waitPB);
} }

8
Sources/Tools/MaxComponent/plSoftVolumeComponent.cpp

@ -255,7 +255,7 @@ plKey plSoftVolBaseComponent::ISetVolumeKey(plSoftVolume* vol)
break; break;
} }
hsAssert(i < NumTargets(), "We're not attached to anything?"); hsAssert(i < NumTargets(), "We're not attached to anything?");
plKey key = hsgResMgr::ResMgr()->NewKey(GetINode()->GetName(), vol, GetTarget(i)->GetLocation()); plKey key = hsgResMgr::ResMgr()->NewKey(plString::FromUtf8(GetINode()->GetName()), vol, GetTarget(i)->GetLocation());
return key; return key;
} }
@ -1299,7 +1299,7 @@ void plVisRegionComponent::ICheckVisRegion(const plLocation& loc)
return; return;
fVisReg = new plVisRegion; fVisReg = new plVisRegion;
plKey key = hsgResMgr::ResMgr()->NewKey(GetINode()->GetName(), fVisReg, loc); plKey key = hsgResMgr::ResMgr()->NewKey(plString::FromUtf8(GetINode()->GetName()), fVisReg, loc);
hsBool excludes = fCompPB->GetInt(kExcludes); hsBool excludes = fCompPB->GetInt(kExcludes);
@ -1465,7 +1465,7 @@ hsBool plRelevanceRegionComponent::Convert(plMaxNode *node, plErrorMsg *errMsg)
return true; return true;
fRegion = new plRelevanceRegion; fRegion = new plRelevanceRegion;
plKey key = hsgResMgr::ResMgr()->NewKey(GetINode()->GetName(), fRegion, node->GetLocation()); plKey key = hsgResMgr::ResMgr()->NewKey(plString::FromUtf8(GetINode()->GetName()), fRegion, node->GetLocation());
plGenRefMsg* refMsg = new plGenRefMsg(fRegion->GetKey(), plRefMsg::kOnCreate, 0, 0); plGenRefMsg* refMsg = new plGenRefMsg(fRegion->GetKey(), plRefMsg::kOnCreate, 0, 0);
hsgResMgr::ResMgr()->SendRef(softKey, refMsg, plRefFlags::kActiveRef); hsgResMgr::ResMgr()->SendRef(softKey, refMsg, plRefFlags::kActiveRef);
@ -1561,7 +1561,7 @@ plVisRegion* plEffVisSetComponent::GetVisRegion(plMaxNode* node)
if( !fVisReg ) if( !fVisReg )
{ {
fVisReg = new plVisRegion; fVisReg = new plVisRegion;
plKey key = hsgResMgr::ResMgr()->NewKey(GetINode()->GetName(), fVisReg, node->GetLocation()); plKey key = hsgResMgr::ResMgr()->NewKey(plString::FromUtf8(GetINode()->GetName()), fVisReg, node->GetLocation());
fVisReg->SetProperty(plVisRegion::kIsNot, false); fVisReg->SetProperty(plVisRegion::kIsNot, false);
fVisReg->SetProperty(plVisRegion::kReplaceNormal, fCompPB->GetInt(kHideNormal)); fVisReg->SetProperty(plVisRegion::kReplaceNormal, fCompPB->GetInt(kHideNormal));

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

Loading…
Cancel
Save