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. 5
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIKnobCtrl.h
  13. 19
      Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIProgressCtrl.cpp
  14. 5
      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. 33
      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. 44
      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. 8
      Sources/Plasma/PubUtilLib/plAvatar/plAGModifier.h
  37. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp
  38. 92
      Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp
  39. 20
      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. 18
      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. 2
      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. 6
      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;
}
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(wbuffer.GetData());
return WriteSafeWString(_TEMP_CONVERT_TO_WCHAR_T(string));
}
plString hsStream::ReadSafeString_TEMP()

4
Sources/Plasma/CoreLib/hsStream.h

@ -145,8 +145,8 @@ public:
char * ReadSafeString();
wchar_t * ReadSafeWString();
uint32_t WriteSafeString_TEMP(const plString &string); // uses 2 bytes for length
uint32_t WriteSafeWString_TEMP(const plString &string);
uint32_t WriteSafeString(const plString &string); // uses 2 bytes for length
uint32_t WriteSafeWString(const plString &string);
plString ReadSafeString_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 <cstdlib>
#include <wchar.h>
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)
{
if (utf8 == nil) {
fUtf8Buffer = plStringBuffer<char>();
return;
}
if ((long)size < 0)
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)
{
if (utf16 == nil) {
fUtf8Buffer = plStringBuffer<char>();
return;
}
if ((long)size < 0)
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
IConvertFromUtf16((const uint16_t *)wstr, size);
#else
if (wstr == nil) {
fUtf8Buffer = plStringBuffer<char>();
return;
}
if ((long)size < 0)
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)
{
if (astr == nil) {
fUtf8Buffer = plStringBuffer<char>();
return;
}
if ((long)size < 0)
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_WCHAR_T(x) plString::FromWchar((x))
#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_CONST_CHAR(x) ((x).c_str())
#define _TEMP_CONVERT_TO_WCHAR_T(x) ((x).ToWchar().GetData())
typedef unsigned int UniChar;
@ -70,7 +70,7 @@ private:
StringRef *fData;
public:
plStringBuffer() : fData(0) { }
plStringBuffer() : fData(nil) { }
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.")
{
char *animationName = params[0];
plString animationName = plString::FromUtf8(params[0]);
float blendFactor = params[1];
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
if (avatar && animationName)
if (avatar && !animationName.IsNull())
{
plAGAnim * anim = plAGAnim::FindAnim(animationName);
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.")
{
char *animationName = params[0];
plString animationName = plString::FromUtf8(params[0]);
float blendFactor = params[1];
int priority = params[2];
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
if (avatar && animationName)
if (avatar && !animationName.IsNull())
{
plAGAnim * anim = plAGAnim::FindAnim(animationName);
if(anim)
@ -671,15 +671,15 @@ PF_CONSOLE_CMD( Avatar_Anim, PlaySimpleAnim, "string AvatarName, string Animatio
{
plArmatureMod *avatar = plAvatarMgr::GetInstance()->FindAvatarByModelName(params[0]);
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.")
{
char *animationName = params[0];
plString animationName = plString::FromUtf8(params[0]);
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
if (avatar && animationName)
if (avatar && !animationName.IsNull())
{
plAGAnimInstance * instance = avatar->FindAnimInstance(animationName);
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.")
{
char *animationName = params[0];
plString animationName = plString::FromUtf8(params[0]);
float blend = params[1];
plArmatureMod *avatar = plAvatarMgr::GetInstance()->GetLocalAvatar();
if (avatar && animationName)
if (avatar && !animationName.IsNull())
{
plAGAnimInstance *anim = avatar->FindAnimInstance(animationName);
if(anim)

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

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

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

@ -150,8 +150,6 @@ void pfGUIButtonMod::StartDragging( void )
pfGUIButtonMod::pfGUIButtonMod()
{
fAnimName = nil;
fMouseOverAnimName = nil;
fDraggable = nil;
fOrigHandler = nil;
@ -161,12 +159,6 @@ pfGUIButtonMod::pfGUIButtonMod()
SetFlag( kWantsInterest );
}
pfGUIButtonMod::~pfGUIButtonMod()
{
delete [] fAnimName;
delete [] fMouseOverAnimName;
}
//// IEval ///////////////////////////////////////////////////////////////////
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();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
fAnimName = s->ReadSafeString_TEMP();
fMouseOverAnimKeys.Reset();
count = s->ReadLE32();
for( i = 0; i < count; i++ )
fMouseOverAnimKeys.Append( mgr->ReadKey( s ) );
fMouseOverAnimName = s->ReadSafeString();
fMouseOverAnimName = s->ReadSafeString_TEMP();
fNotifyType = s->ReadLE32();
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;
delete [] fAnimName;
if( name != nil )
{
fAnimName = new char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
fAnimName = name;
}
void pfGUIButtonMod::SetMouseOverAnimKeys( hsTArray<plKey> &keys, const char *name )
void pfGUIButtonMod::SetMouseOverAnimKeys( hsTArray<plKey> &keys, const plString &name )
{
fMouseOverAnimKeys = keys;
delete [] fMouseOverAnimName;
if( name != nil )
{
fMouseOverAnimName = new char[ strlen( name ) + 1 ];
strcpy( fMouseOverAnimName, name );
}
else
fMouseOverAnimName = nil;
fMouseOverAnimName = name;
}

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

@ -60,10 +60,10 @@ class pfGUIButtonMod : public pfGUIControlMod
protected:
hsTArray<plKey> fAnimationKeys;
char *fAnimName;
plString fAnimName;
hsTArray<plKey> fMouseOverAnimKeys;
char *fMouseOverAnimName;
plString fMouseOverAnimName;
hsBool fClicking;
hsBool fTriggering;
@ -83,7 +83,6 @@ class pfGUIButtonMod : public pfGUIControlMod
public:
pfGUIButtonMod();
virtual ~pfGUIButtonMod();
CLASSNAME_REGISTER( pfGUIButtonMod );
GETINTERFACE_ANY( pfGUIButtonMod, pfGUIControlMod );
@ -130,8 +129,8 @@ class pfGUIButtonMod : public pfGUIControlMod
void StopDragging( hsBool cancel );
// Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name );
void SetMouseOverAnimKeys( hsTArray<plKey> &keys, const char *name );
void SetAnimationKeys( hsTArray<plKey> &keys, const plString &name );
void SetMouseOverAnimKeys( hsTArray<plKey> &keys, const plString &name );
};
#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()
{
fAnimName = nil;
SetFlag( kWantsInterest );
fChecked = false;
fClicking = false;
fPlaySound = true;
}
pfGUICheckBoxCtrl::~pfGUICheckBoxCtrl()
{
delete [] fAnimName;
}
//// IEval ///////////////////////////////////////////////////////////////////
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++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
fAnimName = s->ReadSafeString_TEMP();
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;
delete [] fAnimName;
if( name != nil )
{
fAnimName = new char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
fAnimName = name;
}
//// IGetDesiredCursor ///////////////////////////////////////////////////////

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

@ -59,7 +59,7 @@ class pfGUICheckBoxCtrl : public pfGUIControlMod
protected:
hsTArray<plKey> fAnimationKeys;
char *fAnimName;
plString fAnimName;
hsBool fClicking;
hsBool fChecked;
@ -72,7 +72,6 @@ class pfGUICheckBoxCtrl : public pfGUIControlMod
public:
pfGUICheckBoxCtrl();
virtual ~pfGUICheckBoxCtrl();
CLASSNAME_REGISTER( pfGUICheckBoxCtrl );
GETINTERFACE_ANY( pfGUICheckBoxCtrl, pfGUIControlMod );
@ -94,7 +93,7 @@ class pfGUICheckBoxCtrl : public pfGUIControlMod
void DontPlaySounds() { fPlaySound = false; } // should the checkbox play sounds?
const hsTArray<plKey> &GetAnimationKeys( void ) const { return fAnimationKeys; }
const char *GetAnimationName( void ) const { return fAnimName; }
plString GetAnimationName( void ) const { return fAnimName; }
enum SoundEvents
{
@ -105,7 +104,7 @@ class pfGUICheckBoxCtrl : public pfGUIControlMod
};
// Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name );
void SetAnimationKeys( hsTArray<plKey> &keys, const plString &name );
};
#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 //////////////////////////////////////////////////
pfGUIKnobCtrl::pfGUIKnobCtrl() :
fAnimName(nil),
fDragStart(0.f, 0.f, 0.f),
fDragging(false),
fAnimStartPos(0.f, 0.f, 0.f),
@ -83,11 +82,6 @@ pfGUIKnobCtrl::pfGUIKnobCtrl() :
SetFlag( kWantsInterest );
}
pfGUIKnobCtrl::~pfGUIKnobCtrl()
{
delete [] fAnimName;
}
//// IEval ///////////////////////////////////////////////////////////////////
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();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
fAnimName = s->ReadSafeString_TEMP();
fAnimTimesCalced = false;
@ -262,17 +256,10 @@ void pfGUIKnobCtrl::HandleMouseDrag( hsPoint3 &mousePt, uint8_t modifiers )
//// SetAnimationKeys ////////////////////////////////////////////////////////
void pfGUIKnobCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *name )
void pfGUIKnobCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const plString &name )
{
fAnimationKeys = keys;
delete [] fAnimName;
if( name != nil )
{
fAnimName = new char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
fAnimName = name;
}
//// ICalcAnimTimes //////////////////////////////////////////////////////////

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

@ -58,7 +58,7 @@ class pfGUIKnobCtrl : public pfGUIValueCtrl
protected:
hsTArray<plKey> fAnimationKeys;
char *fAnimName;
plString fAnimName;
hsPoint3 fDragStart;
float fDragValue;
@ -80,7 +80,6 @@ class pfGUIKnobCtrl : public pfGUIValueCtrl
public:
pfGUIKnobCtrl();
virtual ~pfGUIKnobCtrl();
CLASSNAME_REGISTER( pfGUIKnobCtrl );
GETINTERFACE_ANY( pfGUIKnobCtrl, pfGUIValueCtrl );
@ -109,7 +108,7 @@ class pfGUIKnobCtrl : public pfGUIValueCtrl
virtual void SetCurrValue( float v );
// 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; }
};

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)
{
fAnimTimesCalced = false;
fAnimName = nil;
fPlaySound = true;
}
pfGUIProgressCtrl::~pfGUIProgressCtrl()
{
delete [] fAnimName;
}
//// IEval ///////////////////////////////////////////////////////////////////
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();
for( i = 0; i < count; i++ )
fAnimationKeys.Append( mgr->ReadKey( s ) );
fAnimName = s->ReadSafeString();
fAnimName = s->ReadSafeString_TEMP();
fAnimTimesCalced = false;
}
@ -141,17 +135,10 @@ void pfGUIProgressCtrl::UpdateBounds( hsMatrix44 *invXformMatrix, hsBool forc
//// SetAnimationKeys ////////////////////////////////////////////////////////
void pfGUIProgressCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const char *name )
void pfGUIProgressCtrl::SetAnimationKeys( hsTArray<plKey> &keys, const plString &name )
{
fAnimationKeys = keys;
delete [] fAnimName;
if( name != nil )
{
fAnimName = new char[ strlen( name ) + 1 ];
strcpy( fAnimName, name );
}
else
fAnimName = nil;
fAnimName = name;
}
//// ICalcAnimTimes //////////////////////////////////////////////////////////

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

@ -58,7 +58,7 @@ class pfGUIProgressCtrl : public pfGUIValueCtrl
protected:
hsTArray<plKey> fAnimationKeys;
char *fAnimName;
plString fAnimName;
// Computed once, once an anim is loaded that we can compute this with
float fAnimBegin, fAnimEnd;
@ -74,7 +74,6 @@ class pfGUIProgressCtrl : public pfGUIValueCtrl
public:
pfGUIProgressCtrl();
virtual ~pfGUIProgressCtrl();
CLASSNAME_REGISTER( pfGUIProgressCtrl );
GETINTERFACE_ANY( pfGUIProgressCtrl, pfGUIValueCtrl );
@ -103,7 +102,7 @@ class pfGUIProgressCtrl : public pfGUIValueCtrl
void DontPlaySounds() { fPlaySound = false; }
// Export only
void SetAnimationKeys( hsTArray<plKey> &keys, const char *name );
void SetAnimationKeys( hsTArray<plKey> &keys, const plString &name );
};
#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
// actually use the functionality of the checkbox itself
const hsTArray<plKey> &keys = fTurnPageButton->GetAnimationKeys();
const char *animName = fTurnPageButton->GetAnimationName();
plString animName = fTurnPageButton->GetAnimationName();
plAnimCmdMsg *msg = new plAnimCmdMsg();
if (immediate)
@ -1474,7 +1474,7 @@ void pfJournalBook::ITriggerCloseWithNotify( hsBool closeNotOpen, hsBool imme
fBookGUIs[fCurBookGUI]->CurrentlyOpen(!closeNotOpen);
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();
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)
//
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 )
{
@ -185,7 +185,7 @@ void cyAvatar::OneShot(pyKey &seekKey, float duration, hsBool usePhysics,
seekKey.getKey(), // Mark D told me to do it ...paulg
duration,
usePhysics,
animName, // Constructor will do a copy. -mf- hsStrcpy(animName),
animName,
drivable,
reversible);
@ -1586,7 +1586,7 @@ void cyAvatar::ExitSubWorld()
//
// 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)
if ( fRecvr.Count() > 0)

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

@ -103,7 +103,7 @@ public:
// oneShot Avatar (must already be there)
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
virtual void RunBehavior(pyKey &behKey, hsBool netForce, hsBool netProp);
@ -412,7 +412,7 @@ public:
//
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);
std::string animNameStr = animName; // convert to string (for safety)
self->fThis->OneShot(*key, duration, usePhysics != 0, animNameStr.c_str(), drivable != 0, reversable != 0);
self->fThis->OneShot(*key, duration, usePhysics != 0, plString::FromUtf8(animName), drivable != 0, reversable != 0);
PYTHON_RETURN_NONE;
}
@ -592,8 +591,7 @@ PYTHON_METHOD_DEFINITION(ptAvatar, playSimpleAnimation, args)
PYTHON_RETURN_ERROR;
}
std::string animNameStr = animName; // convert to a string (for safety)
self->fThis->PlaySimpleAnimation(animNameStr.c_str());
self->fThis->PlaySimpleAnimation(plString::FromUtf8(animName));
PYTHON_RETURN_NONE;
}

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

@ -629,23 +629,23 @@ void plPythonFileMod::AddTarget(plSceneObject* sobj)
NamedComponent comp;
comp.isActivator = (isNamedAttr == 1);
comp.id = parameter.fID;
comp.name = plString::FromUtf8(parameter.datarecord.fString);
comp.name = parameter.fString;
fNamedCompQueue.Append(comp);
}
else
{
if (isNamedAttr == 1)
IFindActivatorAndAdd(plString::FromUtf8(parameter.datarecord.fString), parameter.fID);
IFindActivatorAndAdd(parameter.fString, parameter.fID);
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 ( isNamedAttr == 0 )
if ( parameter.datarecord.fString != nil )
value = PyString_FromString(parameter.datarecord.fString);
if ( !parameter.fString.IsNull() )
value = PyString_FromString(parameter.fString.c_str());
break;
case plPythonParameter::kSceneObject:
case plPythonParameter::kSceneObjectList:

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

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

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

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

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

@ -92,7 +92,7 @@ public:
bool RunningBehavior(const std::string& behaviorName) const;
std::string BehaviorName(int behavior) const;
std::string AnimationName(int behavior) const;
plString AnimationName(int behavior) const;
int CurBehavior() 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( fObjectID );
s->WriteSafeString_TEMP( fObjectName );
s->WriteSafeString( fObjectName );
// conditional cloneIDs write
if (contents & kHasCloneIDs)

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

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

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

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

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

@ -92,7 +92,7 @@ public:
plAGAnim();
/** 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. */
virtual ~plAGAnim();
@ -112,12 +112,12 @@ public:
/** 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
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
will be attached to when the animation is applied.
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
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
name (such as AttachAnimation on the plAGMasterMod) will also take an pointer
to a plAGAnim. */
virtual const char * GetName() const { return fName; }
virtual plString GetName() const { return fName; }
/** Return the length of the animation; end - start. */
virtual float GetLength() const { return fEnd - fStart; }
@ -176,12 +176,12 @@ public:
/** Add the animation by name to a global static registry.
This functionality will possibly be added to the resource
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
global animation registry. */
static plAGAnim *FindAnim(const char *name);
static plAGAnim *FindAnim(const plString &name);
/** 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
to a vanilla state, as when clearing the scene while
exporting. */
@ -202,14 +202,14 @@ protected:
float fStart; /// the start time of the beginning of the animation (usually 0)
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
// 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
typedef std::map<const char *, plEmoteAnim *, stringISorter> plEmoteMap;
typedef std::map<plString, plEmoteAnim *, plString::less_i> plEmoteMap;
static plEmoteMap fAllEmotes;
};
@ -230,7 +230,7 @@ public:
plATCAnim();
/** Construct with name, start time, and end time (within the max note track)
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. */
virtual ~plATCAnim();
@ -305,11 +305,11 @@ public:
/** Animations can have multiple defined loop segments; these
are selected using animation control messages.
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.
\param start will return the start 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. */
bool GetLoop(uint32_t num, float &start, float &end) const;
/** Returns the number of loops defined on this anim. */
@ -318,10 +318,10 @@ public:
/** Add a marker to the animation. Markers can be used
for callbacks or for goto comands. A marker is a simple
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. */
float GetMarker(const char *name) const;
void CopyMarkerNames(std::vector<char*> &out);
float GetMarker(const plString &name) const;
void CopyMarkerNames(std::vector<plString> &out);
/** Add a stop point to the animation. A stop point is a
"detent" for playback - if the animation is stopping
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
// a map from segment names to times
typedef std::map<const char *, float, stringSorter> MarkerMap;
typedef std::map<plString, float> MarkerMap;
MarkerMap fMarkers;
typedef std::map<const char *, std::pair<float,float>, stringSorter> LoopMap;
typedef std::map<plString, std::pair<float,float> > LoopMap;
LoopMap fLoops;
typedef std::vector<float> ScalarMap;
@ -384,7 +384,7 @@ class plEmoteAnim : public plATCAnim
public:
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;
float GetFadeIn() const;
@ -417,7 +417,7 @@ public:
plAgeGlobalAnim();
/** 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. */
virtual ~plAgeGlobalAnim();
@ -438,8 +438,8 @@ protected:
};
// USEFUL HELPER FUNCTIONS
bool GetStartToEndTransform(const plAGAnim *anim, hsMatrix44 *startToEnd, hsMatrix44 *endToStart, const char *channelName);
bool GetRelativeTransform(const plAGAnim *anim, double timeA, double timeB, hsMatrix44 *a2b, hsMatrix44 *b2a, 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 plString &channelName);

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

@ -123,7 +123,7 @@ plAGAnimInstance::plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master,
fCleanupChannels.push_back(timeChan);
#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());
#endif
@ -131,7 +131,7 @@ plAGAnimInstance::plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master,
{
plAGApplicator * app = fAnimation->GetApplicator(i);
plAGChannel * inChannel = app->GetChannel();
const char * channelName = app->GetChannelName();
plString channelName = app->GetChannelName();
plAGModifier * channelMod = master->GetChannelMod(channelName);
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);
fManualDetachChannels.insert(newPair);
@ -243,14 +243,14 @@ void plAGAnimInstance::Detach()
void plAGAnimInstance::DetachChannels()
{
#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());
#endif
plDetachMap::iterator i = fManualDetachChannels.begin();
while(i != fManualDetachChannels.end())
{
const char *channelName = (*i).first;
plString channelName = (*i).first;
plAGModifier *channelMod = fMaster->GetChannelMod(channelName, true);
if(channelMod)
@ -274,7 +274,7 @@ void plAGAnimInstance::DetachChannels()
fCleanupChannels.clear();
#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());
#endif
}
@ -323,12 +323,12 @@ float plAGAnimInstance::GetAmplitude()
// GetName -----------------------------
// --------
const char * plAGAnimInstance::GetName()
plString plAGAnimInstance::GetName()
{
if(fAnimation)
return fAnimation->GetName();
else
return nil;
return plString::Null;
}
// SetLoop ----------------------------------
@ -409,7 +409,7 @@ void plAGAnimInstance::AttachCallbacks(plOneShotCallbacks *callbacks)
eventMsg->fRepeats = 0;
eventMsg->fUser = cb.fUser;
if (cb.fMarker)
if (!cb.fMarker.IsNull())
{
float marker = anim->GetMarker(cb.fMarker);
hsAssert(marker != -1, "Bad marker name");

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

@ -192,7 +192,7 @@ public:
hsBool IsAtEnd();
/** Get the name of the underlying animation. */
const char * GetName();
plString GetName();
/** Remove all channels from the master mode and remove us from
our master modifier.
@ -224,14 +224,14 @@ protected:
/** Set up bookkeeping for a fade. */
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;
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;
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()
: fChannel(nil),
fChannelName(nil),
fEnabled(true)
{
};
// ctor -------------------------------
// -----
plAGApplicator::plAGApplicator(const char *channelName)
plAGApplicator::plAGApplicator(const plString &channelName)
: fChannel(nil),
fEnabled(true)
fEnabled(true),
fChannelName(channelName)
{
fChannelName = hsStrcpy(channelName);
};
plAGApplicator::~plAGApplicator()
{
if(fChannelName)
delete[] fChannelName;
}
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);
}
void plAGApplicator::SetChannelName(const char *name)
void plAGApplicator::SetChannelName(const plString &name)
{
if(name)
fChannelName = hsStrcpy(name);
if(!name.IsNull())
fChannelName = name;
};
const char * plAGApplicator::GetChannelName()
plString plAGApplicator::GetChannelName()
{
return fChannelName;
};
@ -141,7 +138,7 @@ void plAGApplicator::Read(hsStream *stream, hsResMgr *mgr)
fEnabled = stream->ReadBool();
fChannel = nil; // Whatever is reading this applicator in should know what channel to assign it
fChannelName = stream->ReadSafeString();
fChannelName = stream->ReadSafeString_TEMP();
}
// IGETxI

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

@ -62,6 +62,7 @@ class plAGModifier;
/////////////////////////////////////////////////////////////////////////////////////////
#include "pnFactory/plCreatable.h"
#include "plAvDefs.h"
#include "plString.h"
/////////////////////////////////////////////////////////////////////////////////////////
//
@ -88,7 +89,7 @@ public:
// -- methods --
/** Base constructor. */
plAGApplicator();
plAGApplicator(const char *channelName);
plAGApplicator(const plString &channelName);
virtual ~plAGApplicator();
/** Return our single input channel. Applicators only ever
@ -100,8 +101,12 @@ public:
/** Set our input channel. Does not free the previous input channel. */
void SetChannel(plAGChannel *channel) { fChannel = channel; }
void SetChannelName(const char *name);
const char * GetChannelName();
void SetChannelName(const plString &name);
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.
The applicator can still be forced to apply using the force
@ -167,7 +172,7 @@ protected:
// -- members --
plAGChannel *fChannel;
hsBool fEnabled;
char *fChannelName;
plString fChannelName;
};
#endif

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

@ -62,8 +62,6 @@ plAGChannel::plAGChannel()
#ifdef TRACK_AG_ALLOCS
fName = gGlobalAnimName;
RegisterAGAlloc(this, gGlobalChannelName, gGlobalAnimName, this->ClassIndex());
#else // TRACK_AG_ALLOCS
fName = nil;
#endif // TRACK_AG_ALLOCS
}
@ -121,7 +119,7 @@ void plAGChannel::Read(hsStream *stream, hsResMgr *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 "plString.h"
/////////////////////////////////////////////////////////////////////////////////////////
//
@ -177,8 +178,8 @@ public:
// \{
/** The name of the channel is used to dynamically attach to sub-parts of an
object. */
virtual const char * GetName() { return fName; };
virtual void SetName(char * name) { fName = name; };
virtual plString GetName() { return fName; };
virtual void SetName(const plString & name) { fName = name; };
// \}
// PLASMA PROTOCOL
@ -191,7 +192,7 @@ public:
virtual void Read(hsStream *s, hsResMgr *mgr);
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++)
{
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);
@ -325,10 +325,10 @@ void plAGMasterMod::DumpAniGraph(const char *justThisChannel, bool optimized, do
// GETCHANNELMOD(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;
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()) {
result = (*i).second;
@ -356,7 +356,7 @@ plAGModifier * plAGMasterMod::ICacheChannelMod(plAGModifier *mod) const
// IFINDAGMOD (sceneObject)
// See if there's an ag modifier on this sceneobject.
// 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();
@ -365,8 +365,8 @@ plAGModifier * plAGMasterMod::IFindChannelMod(const plSceneObject *SO, const cha
if(mod)
{
const char *modName = mod->GetChannelName();
if(stricmp(name, modName) == 0)
plString modName = mod->GetChannelName();
if(modName.Compare(name, plString::kCaseInsensitive) == 0)
return mod;
}
@ -421,7 +421,7 @@ plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(plAGAnim *anim,
}
// 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;
plAGAnim *anim = plAGAnim::FindAnim(name);
@ -433,7 +433,7 @@ plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(const char *name, float
return instance;
}
void plAGMasterMod::PlaySimpleAnim(const char *name)
void plAGMasterMod::PlaySimpleAnim(const plString &name)
{
plATCAnim *anim = plATCAnim::ConvertNoRef(plAGAnim::FindAnim(name));
plAGAnimInstance *instance = nil;
@ -460,18 +460,18 @@ void plAGMasterMod::PlaySimpleAnim(const char *name)
// FINDANIMINSTANCE
// 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
plAGAnimInstance * plAGMasterMod::FindAnimInstance(const char *name)
plAGAnimInstance * plAGMasterMod::FindAnimInstance(const plString &name)
{
plAGAnimInstance *result = nil;
if (name)
if (!name.IsNull())
{
for (int i = 0; i < fAnimInstances.size(); 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;
break;
@ -482,7 +482,7 @@ plAGAnimInstance * plAGMasterMod::FindAnimInstance(const char *name)
}
// FINDORATTACHINSTANCE
plAGAnimInstance * plAGMasterMod::FindOrAttachInstance(const char *name, float blendFactor)
plAGAnimInstance * plAGMasterMod::FindOrAttachInstance(const plString &name, float blendFactor)
{
plAGAnimInstance *result = FindAnimInstance(name);
if(result)
@ -587,7 +587,7 @@ void plAGMasterMod::DetachAnimation(plAGAnimInstance *anim)
}
// DETACHANIMATION(name)
void plAGMasterMod::DetachAnimation(const char *name)
void plAGMasterMod::DetachAnimation(const plString &name)
{
plAGAnimInstance *anim = FindAnimInstance(name);
if(anim) {
@ -603,10 +603,10 @@ void plAGMasterMod::DumpCurrentAnims(const char *header)
for(int i = nAnims - 1; i >= 0; i--)
{
plAGAnimInstance *inst = fAnimInstances[i];
const char *name = inst->GetName();
plString name = inst->GetName();
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))
{
const char *targetName = cmdMsg->GetAnimName();
plString targetName = cmdMsg->GetAnimName();
if (!targetName)
targetName = ENTIRE_ANIMATION_NAME;
if (targetName.IsNull())
targetName = _TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME);
plAGAnimInstance *inst = FindAnimInstance(targetName);
if (inst != nil)

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

@ -98,7 +98,7 @@ public:
virtual ~plAGMasterMod();
/** 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 */
// \{
@ -112,13 +112,13 @@ public:
/** Look up the given animation by name and attach it
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,
hsBool cache = false);
/** 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. */
void PlaySimpleAnim(const char *name);
void PlaySimpleAnim(const plString &name);
/** Detach the given animation instance. Does nothing
if the instance is not managed by this master mod. */
@ -128,7 +128,7 @@ public:
/** Detach the given animation by name. Searches for
any instances derived from animations with the
given name and removes them. */
void DetachAnimation(const char *name);
void DetachAnimation(const plString &name);
// \}
/** Print the current animation stack to the console.
@ -139,7 +139,7 @@ public:
/** Find and return any animation instances with the
given name on this master modifer. */
plAGAnimInstance *FindAnimInstance(const char *name);
plAGAnimInstance *FindAnimInstance(const plString &name);
/** Return the Ith animation instance, based on blend
order. Of dubious utility, but, y'know. */
@ -152,7 +152,7 @@ public:
attached, it could be anywhere, including buried under
a bunch of other animations. If it's important that it be
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. */
int GetNumAnimations();
@ -218,7 +218,7 @@ public:
protected:
// -- methods --
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);
@ -231,7 +231,7 @@ protected:
plSceneObject* fTarget;
// 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;
// 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()
: plSingleModifier()
{
fChannelName = nil;
fAutoApply = true;
fEnabled = true;
}
// CTOR(name)
plAGModifier::plAGModifier(const char *name, hsBool autoApply)
plAGModifier::plAGModifier(const plString &name, hsBool autoApply)
: plSingleModifier(), fAutoApply(autoApply)
{
fChannelName = hsStrcpy(name);
fChannelName = name;
fEnabled = true;
}
// DTOR
plAGModifier::~plAGModifier()
{
if(fChannelName)
{
delete[] fChannelName;
fChannelName = nil;
}
int i;
for (i = 0; i < fApps.size(); i++)
{
@ -94,7 +87,7 @@ plAGModifier::~plAGModifier()
}
// GETCHANNELNAME
const char * plAGModifier::GetChannelName() const
plString plAGModifier::GetChannelName() const
{
return fChannelName;
}
@ -106,9 +99,9 @@ void plAGModifier::Enable(hsBool val)
}
// SETCHANNELNAME
void plAGModifier::SetChannelName(char * name)
void plAGModifier::SetChannelName(const plString & name)
{
fChannelName = hsStrcpy(name);
fChannelName = name;
}
// IAPPLYCHANNELS (time)
@ -276,7 +269,7 @@ void plAGModifier::Read(hsStream *stream, hsResMgr *mgr)
plSingleModifier::Read(stream, mgr);
// read in the name of the modifier
fChannelName = stream->ReadSafeString();
fChannelName = stream->ReadSafeString_TEMP();
}
// WRITE

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

@ -89,19 +89,19 @@ public:
incoming channels with this modifier. You may also supply an
autoApply parameter, which indicates whether this modifier
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,
and a bunch of other stuff you don't need to know anything about. */
virtual ~plAGModifier();
/** 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
name. Will NOT remove any channels that are already attached, so
you could wind up with a modifier named "Fred" and a bunch of
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
modifiers if necessary, based on pin type. May destruct existing applicators. */
@ -139,7 +139,7 @@ protected:
typedef std::vector<plAGApplicator*> plAppTable;
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 fEnabled; // if not enabled, we don't eval any of our anims

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

@ -277,7 +277,7 @@ plAGAnimInstance * plAnimStage::Attach(plArmatureMod *armature, plArmatureBrain
if(fAnimInstance)
{
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;
// this is too early to send the enter notify. we're attached, but we may not
// have faded in yet.

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

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

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

@ -221,7 +221,7 @@ public:
hsBool IsLocalAvatar();
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 void AddBoneMapping(uint32_t id, const plSceneObject *bone);
plAGModifier *GetRootAGMod();
@ -298,15 +298,15 @@ public:
kSwim,
};
const char *GetAnimRootName(const char *name);
int8_t AnimNameToIndex(const char *name);
plString GetAnimRootName(const plString &name);
int8_t AnimNameToIndex(const plString &name);
void SetBodyType(int type) { fBodyType = type; }
int GetBodyType(int type) { return fBodyType; }
int GetCurrentGenericType();
bool FindMatchingGenericBrain(const char *names[], int count);
char *MakeAnimationName(const char * baseName) const;
char *GetRootName();
void SetRootName(const char *name);
plString MakeAnimationName(const char * baseName) const;
plString GetRootName();
void SetRootName(const plString &name);
int RefreshDebugDisplay();
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 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();}
@ -388,7 +388,7 @@ protected:
void ISetTransparentDrawOrder(bool val);
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 fMoveFlagsBackup; // a copy of fMoveFlags
typedef std::vector<plControlEventMsg*> CtrlMessageVec;
@ -443,7 +443,7 @@ protected:
// strings for animations, age names, footstep sounds, etc
std::string fBodyAgeName;
std::string fBodyFootstepSoundPage;
std::string fAnimationPrefix;
plString fAnimationPrefix;
// user-defined string assigned to this avatar
std::string fUserStr;
@ -457,7 +457,7 @@ class plArmatureLODMod : public plArmatureMod
public:
// tors
plArmatureLODMod();
plArmatureLODMod(const char * root_name);
plArmatureLODMod(const plString & root_name);
virtual ~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)
{
const char *animName = fAnim->GetName();
plString animName = fAnim->GetName();
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
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.");
if(up)
{
GetStartToEndTransform(up, &upMove, nil, "Handle");
GetStartToEndTransform(up, &upMove, nil, _TEMP_CONVERT_FROM_LITERAL("Handle"));
fVerticalProbeLength = upMove.GetTranslate().fZ;
} else
fVerticalProbeLength = 4.0f; // guess
@ -722,7 +722,7 @@ void plAvBrainClimb::ICalcProbeLengths()
hsAssert(left, "Couldn't find ClimbLeft animation.");
if(left)
{
GetStartToEndTransform(left, &leftMove, nil, "Handle");
GetStartToEndTransform(left, &leftMove, nil, _TEMP_CONVERT_FROM_LITERAL("Handle"));
fHorizontalProbeLength = leftMove.GetTranslate().fX;
} else
fHorizontalProbeLength = 3.0f; // guess

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

@ -95,7 +95,7 @@ public:
void SetAnimTime(float time) {fAnim->SetCurrentTime(time, true);}
std::string Name() const {return fName;}
std::string AnimName() const {return fAnimName;}
plString AnimName() const {return fAnimName;}
bool RandomStartPoint() const {return fRandomStartPoint;}
float FadeInLength() const {return fFadeInLength;}
float FadeOutLength() const {return fFadeOutLength;}
@ -117,7 +117,7 @@ protected:
plAvBrainCritter *fCritterBrain;
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?
float fFadeInLength; // how long to fade in 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();
}
std::string plAvBrainCritter::AnimationName(int behavior) const
plString plAvBrainCritter::AnimationName(int behavior) const
{
if ((behavior >= fBehaviors.Count()) || (behavior < 0))
return "";
return _TEMP_CONVERT_FROM_LITERAL("");
return ((CritterBehavior*)fBehaviors[behavior])->AnimName();
}

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

@ -92,7 +92,7 @@ public:
bool LocallyControlled() const {return fLocallyControlled;}
std::string BehaviorName(int behavior) const;
std::string AnimationName(int behavior) const;
plString AnimationName(int behavior) const;
int CurBehavior() const {return fCurMode;}
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++)
{
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);
if( bone )
@ -317,7 +317,7 @@ void plAvBrainHuman::IInitBoneMap()
fAvMod->AddBoneMapping(id, bone);
}
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.
// If the user lets up on the PushToTalk key in another brain
// 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);
delete [] chatAnimName;
if (anim)
anim->FadeAndDetach(0, 1);
@ -699,7 +698,7 @@ void plAvBrainHuman::TurnToPoint(hsPoint3 point)
void plAvBrainHuman::IChatOn()
{
char *chatAnimName = fAvMod->MakeAnimationName("Talk");
plString chatAnimName = fAvMod->MakeAnimationName("Talk");
// check that we aren't adding this twice...
if (!fAvMod->FindAnimInstance(chatAnimName))
@ -713,13 +712,11 @@ void plAvBrainHuman::IChatOn()
taskMsg->Send();
}
}
delete [] chatAnimName;
}
void plAvBrainHuman::IChatOff()
{
char *chatAnimName = fAvMod->MakeAnimationName("Talk");
plString chatAnimName = fAvMod->MakeAnimationName("Talk");
plKey avKey = fAvMod->GetKey();
plAvAnimTask *animTask = new plAvAnimTask(chatAnimName, -1.0);
if (animTask)
@ -728,7 +725,6 @@ void plAvBrainHuman::IChatOff()
taskMsg->SetBCastFlag(plMessage::kNetPropagate);
taskMsg->Send();
}
delete[] chatAnimName;
}
hsBool plAvBrainHuman::IInitAnimations()
@ -1422,12 +1418,11 @@ bool PushSimpleMultiStage(plArmatureMod *avatar, const char *enterAnim, const ch
bool AvatarEmote(plArmatureMod *avatar, const char *emoteName)
{
bool result = false;
char *fullName = avatar->MakeAnimationName(emoteName);
plString fullName = avatar->MakeAnimationName(emoteName);
plAGAnim *anim = plAGAnim::FindAnim(fullName);
plEmoteAnim *emote = plEmoteAnim::ConvertNoRef(anim);
hsBool alreadyActive = avatar->FindAnimInstance(fullName) != nil;
plAvBrainHuman *huBrain = plAvBrainHuman::ConvertNoRef(avatar->FindBrainByClass(plAvBrainHuman::Index()));
delete[] fullName;
// XXX
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);
// don't need to do this every frame; the animation doesn't change.
// *** 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
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(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);

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

@ -249,7 +249,7 @@ hsBool plAvSeekTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double
{
hsMatrix44 adjustment;
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;
}
break;
@ -334,8 +334,7 @@ void plAvSeekTask::LeaveAge(plArmatureMod *avatar)
// CTOR default
plAvAnimTask::plAvAnimTask()
: fAnimName(nil),
fInitialBlend(0.0f),
: fInitialBlend(0.0f),
fTargetBlend(0.0f),
fFadeSpeed(0.0f),
fSetTime(0.0f),
@ -347,7 +346,7 @@ plAvAnimTask::plAvAnimTask()
}
// CTOR animName, initialBlend, targetBlend, fadeSpeed, start, loop, attach
plAvAnimTask::plAvAnimTask(const char *animName,
plAvAnimTask::plAvAnimTask(const plString &animName,
float initialBlend,
float targetBlend,
float fadeSpeed,
@ -355,7 +354,8 @@ plAvAnimTask::plAvAnimTask(const char *animName,
hsBool start,
hsBool loop,
hsBool attach)
: fInitialBlend(initialBlend),
: fAnimName(animName),
fInitialBlend(initialBlend),
fTargetBlend(targetBlend),
fFadeSpeed(fadeSpeed),
fSetTime(setTime),
@ -364,13 +364,12 @@ plAvAnimTask::plAvAnimTask(const char *animName,
fAttach(attach),
fAnimInstance(nil)
{
if(animName)
fAnimName = hsStrcpy(animName);
}
// CTOR animName, fadeSpeed, attach
plAvAnimTask::plAvAnimTask(const char *animName, float fadeSpeed, hsBool attach)
: fInitialBlend(0.0f),
plAvAnimTask::plAvAnimTask(const plString &animName, float fadeSpeed, hsBool attach)
: fAnimName(animName),
fInitialBlend(0.0f),
fTargetBlend(0.0f),
fFadeSpeed(fadeSpeed),
fSetTime(0.0f),
@ -379,23 +378,11 @@ plAvAnimTask::plAvAnimTask(const char *animName, float fadeSpeed, hsBool attach)
fAttach(attach),
fAnimInstance(nil)
{
if(animName)
fAnimName = hsStrcpy(animName);
}
// DTOR
plAvAnimTask::~plAvAnimTask()
{
if(fAnimName)
{
delete[] fAnimName;
fAnimName = nil;
}
}
// START
hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
@ -420,7 +407,7 @@ hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double
}
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
@ -480,7 +467,7 @@ void plAvAnimTask::LeaveAge(plArmatureMod *avatar)
// READ
void plAvAnimTask::Read(hsStream *stream, hsResMgr *mgr)
{
fAnimName = stream->ReadSafeString();
fAnimName = stream->ReadSafeString_TEMP();
fInitialBlend = stream->ReadLEScalar();
fTargetBlend = stream->ReadLEScalar();
fFadeSpeed = stream->ReadLEScalar();
@ -515,7 +502,6 @@ void plAvOneShotTask::InitDefaults()
fBackwards = false;
fDisableLooping = false;
fDisablePhysics = true;
fAnimName = nil;
fMoveHandle = false;
fAnimInstance = nil;
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
// of tasks
// 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();
@ -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
hsRefCnt_SafeRef(fCallbacks);
fAnimName = hsStrcpy(animName);
fAnimName = animName;
}
// 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
hsRefCnt_SafeRef(fCallbacks);
fAnimName = hsStrcpy(msg->fAnimName);
fAnimName = msg->fAnimName;
}
// DTOR
plAvOneShotTask::~plAvOneShotTask()
{
if(fAnimName)
delete[] fAnimName;
hsRefCnt_SafeUnRef(fCallbacks);
}
@ -640,7 +624,7 @@ hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, dou
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)
{
plMatrixDifferenceApp *differ = avatar->GetRootAnimator();
@ -654,9 +638,8 @@ hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, dou
}
else
{
char buf[256];
sprintf(buf, "Oneshot: Can't find animation <%s>; all bets are off.", fAnimName);
hsAssert(false, buf);
plString buf = plString::Format("Oneshot: Can't find animation <%s>; all bets are off.", fAnimName.c_str());
hsAssert(false, buf.c_str());
result = true;
}
return result;
@ -750,10 +733,9 @@ void plAvOneShotTask::LeaveAge(plArmatureMod *avatar)
fIgnore = true;
}
void plAvOneShotTask::SetAnimName(char *name)
void plAvOneShotTask::SetAnimName(const plString &name)
{
delete [] fAnimName;
fAnimName = hsStrcpy(name);
fAnimName = name;
}
//////////////////////
@ -763,7 +745,6 @@ void plAvOneShotTask::SetAnimName(char *name)
//////////////////////
plAvOneShotLinkTask::plAvOneShotLinkTask() : plAvOneShotTask(),
fMarkerName(nil),
fMarkerTime(-1),
fStartTime(0),
fLinkFired(false)
@ -773,7 +754,6 @@ fLinkFired(false)
plAvOneShotLinkTask::~plAvOneShotLinkTask()
{
delete [] fMarkerName;
}
// task protocol
@ -782,7 +762,7 @@ hsBool plAvOneShotLinkTask::Start(plArmatureMod *avatar, plArmatureBrain *brain,
hsBool result = plAvOneShotTask::Start(avatar, brain, time, elapsed);
fStartTime = time;
if (fAnimInstance && fMarkerName)
if (fAnimInstance && !fMarkerName.IsNull())
{
const plATCAnim *anim = plATCAnim::ConvertNoRef(fAnimInstance->GetAnimation());
if (anim)
@ -824,14 +804,13 @@ void plAvOneShotLinkTask::Write(hsStream *stream, hsResMgr *mgr)
void plAvOneShotLinkTask::Read(hsStream *stream, hsResMgr *mgr)
{
plAvOneShotTask::Read(stream, mgr);
fAnimName = stream->ReadSafeString();
fMarkerName = stream->ReadSafeString();
fAnimName = stream->ReadSafeString_TEMP();
fMarkerName = stream->ReadSafeString_TEMP();
}
void plAvOneShotLinkTask::SetMarkerName(char *name)
void plAvOneShotLinkTask::SetMarkerName(const plString &name)
{
delete [] fMarkerName;
fMarkerName = hsStrcpy(name);
fMarkerName = name;
}

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

@ -84,15 +84,13 @@ public:
\param loop Make the animation loop?
\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);
/** Canonical constructor form form for detaching
\param animName The name of the animation we're detaching
\param fadeSpeed How fast to fade it out. */
plAvAnimTask(const char *animName, float fadeSpeed, hsBool attach = false);
virtual ~plAvAnimTask();
plAvAnimTask(const plString &animName, float fadeSpeed, hsBool attach = false);
// task protocol
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
@ -108,7 +106,7 @@ public:
protected:
// 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 fTargetBlend; // the blend to achieve eventually (attaching only)
float fFadeSpeed; // how fast to achieve the blend
@ -184,7 +182,7 @@ public:
\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
*/
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.
\param msg The message to copy our parameters from
\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 void LeaveAge(plArmatureMod *avatar);
void SetAnimName(char *name);
void SetAnimName(const plString &name);
static hsBool fForce3rdPerson;
@ -211,7 +209,7 @@ public:
// *** implement reader and writer if needed for network propagation
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?
plAGAnimInstance *fAnimInstance; // the animation instance (available only after it starts playing)
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 Read(hsStream *stream, hsResMgr *mgr);
void SetMarkerName(char *name);
void SetMarkerName(const plString &name);
protected:
char *fMarkerName;
plString fMarkerName;
double fStartTime;
float fMarkerTime;
hsBool fLinkFired;

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

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

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

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

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

@ -130,13 +130,12 @@ hsBool plOneShotMod::MsgReceive(plMessage* msg)
if(avMod)
{
char *animName = avMod->MakeAnimationName(fAnimName);
plString animName = avMod->MakeAnimationName(fAnimName);
plAvOneShotMsg *avOSmsg = new plAvOneShotMsg(myKey, oneShotMsg->fPlayerKey, objKey,
fSeekDuration, (hsBool)fSmartSeek, animName, fDrivable,
fReversable);
delete [] animName; // AvOneShotMsg constructor copies.
avOSmsg->fNoSeek = fNoSeek;
avOSmsg->SetBCastFlag(plMessage::kPropagateToModifiers);
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
// animation. That's what this next line is doing. It's a bit unintuitive
// 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;
hsPoint3 distP = candidateGoal.GetTranslate() - curPosition;
hsVector3 distV(distP.fX, distP.fY, distP.fZ);
@ -290,9 +290,7 @@ bool IIsClosestAnim(const char *animName, hsMatrix44 &sitGoal, float &closestDis
return true;
}
} else {
char buffy[256];
sprintf(buffy, "Missing sit animation: %s", animName);
hsAssert(false, buffy);
hsAssert(false, plString::Format("Missing sit animation: %s", animName).c_str());
}
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;
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->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices,
span->fGroupIdx,
@ -404,7 +404,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
else
{
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>",
span->fGroupIdx,
span->fVBufferIdx,
@ -423,7 +423,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
if( geo->fProps & plGeometrySpan::kFirstInstance )
{
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->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices,
span->fGroupIdx,
@ -437,7 +437,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
else
{
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>",
span->fGroupIdx,
span->fVBufferIdx,

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

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

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

@ -173,7 +173,7 @@ class plGeometrySpan
// The following is only used for logging during export. It is never set
// 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
// 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()
{
ClearCmd();
delete [] fAnimName;
delete [] fLoopName;
}
@ -58,24 +56,22 @@ void plAnimCmdMsg::ClearCmd()
fCmd.Clear();
}
void plAnimCmdMsg::SetAnimName(const char *name)
void plAnimCmdMsg::SetAnimName(const plString &name)
{
delete [] fAnimName;
fAnimName = hsStrcpy(name);
fAnimName = name;
}
const char *plAnimCmdMsg::GetAnimName()
plString plAnimCmdMsg::GetAnimName()
{
return fAnimName;
}
void plAnimCmdMsg::SetLoopName(const char *name)
void plAnimCmdMsg::SetLoopName(const plString &name)
{
delete [] fLoopName;
fLoopName = hsStrcpy(name);
fLoopName = name;
}
const char *plAnimCmdMsg::GetLoopName()
plString plAnimCmdMsg::GetLoopName()
{
return fLoopName;
}
@ -110,8 +106,8 @@ void plAnimCmdMsg::Read(hsStream* stream, hsResMgr* mgr)
stream->ReadLE(&fSpeedChangeRate);
stream->ReadLE(&fTime);
fAnimName = stream->ReadSafeString();
fLoopName = stream->ReadSafeString();
fAnimName = stream->ReadSafeString_TEMP();
fLoopName = stream->ReadSafeString_TEMP();
}
void plAnimCmdMsg::Write(hsStream* stream, hsResMgr* mgr)
@ -136,16 +132,14 @@ void plAnimCmdMsg::Write(hsStream* stream, hsResMgr* mgr)
plAGCmdMsg::~plAGCmdMsg()
{
ClearCmd();
delete [] fAnimName;
}
void plAGCmdMsg::SetAnimName(const char *name)
void plAGCmdMsg::SetAnimName(const plString &name)
{
delete [] fAnimName;
fAnimName = hsStrcpy(name);
fAnimName = name;
}
const char *plAGCmdMsg::GetAnimName()
plString plAGCmdMsg::GetAnimName()
{
return fAnimName;
}
@ -160,7 +154,7 @@ void plAGCmdMsg::Read(hsStream* stream, hsResMgr* mgr)
stream->ReadLE(&fAmp);
stream->ReadLE(&fAmpRate);
fAnimName = stream->ReadSafeString();
fAnimName = stream->ReadSafeString_TEMP();
}
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)
{
fAnimName = hsStrcpy(name);
}
char *plAGDetachCallbackMsg::GetAnimName()
plString plAGDetachCallbackMsg::GetAnimName()
{
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 "hsTemplates.h"
#include "hsGeometry3.h"
#include "plString.h"
#include "plInterp/plAnimEaseTypes.h"
#include "plInterp/plAnimTimeConvert.h"
@ -55,11 +56,11 @@ class plAGAnimInstance;
class plAnimCmdMsg : public plMessageWithCallbacks
{
protected:
char *fAnimName;
char *fLoopName;
plString fAnimName;
plString fLoopName;
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:
plAnimCmdMsg()
: plMessageWithCallbacks(nil, nil, nil) { IInit(); }
@ -110,12 +111,16 @@ public:
hsBool Cmd(int n) const { return fCmd.IsBitSet(n); }
void SetCmd(int n) { fCmd.SetBit(n); }
void ClearCmd();
void SetAnimName(const char *name);
const char *GetAnimName();
void SetAnimName(const plString &name);
plString GetAnimName();
hsBool CmdChangesAnimTime(); // Will this command cause an update to the current anim time?
void SetLoopName(const char *name);
const char *GetLoopName();
// TEMP plString REVISIT
// 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 fEnd;
@ -136,11 +141,11 @@ public:
class plAGCmdMsg : public plMessage
{
protected:
char *fAnimName;
plString fAnimName;
private:
void IInit() { fBlend = fAmp = 0;
fAnimName=nil;}
fAnimName=plString::Null;}
public:
plAGCmdMsg()
: plMessage(nil, nil, nil) { IInit(); }
@ -165,8 +170,8 @@ public:
hsBool Cmd(int n) const { return fCmd.IsBitSet(n); }
void SetCmd(int n) { fCmd.SetBit(n); }
void ClearCmd() { fCmd.Clear(); }
void SetAnimName(const char *name);
const char *GetAnimName();
void SetAnimName(const plString &name);
plString GetAnimName();
float fBlend;
float fBlendRate;
@ -199,13 +204,12 @@ public:
class plAGDetachCallbackMsg : public plEventCallbackMsg
{
protected:
char *fAnimName;
plString fAnimName;
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) :
plEventCallbackMsg(receiver, e, idx, t, repeats, user), fAnimName(nil) {}
virtual ~plAGDetachCallbackMsg();
plEventCallbackMsg(receiver, e, idx, t, repeats, user) {}
CLASSNAME_REGISTER( plAGDetachCallbackMsg );
GETINTERFACE_ANY( plAGDetachCallbackMsg, plEventCallbackMsg );
@ -214,8 +218,8 @@ public:
void Read(hsStream* stream, hsResMgr* mgr) {}
void Write(hsStream* stream, hsResMgr* mgr) {}
void SetAnimName(const char *name);
char *GetAnimName();
void SetAnimName(const plString &name);
plString GetAnimName();
};

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

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

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

@ -247,7 +247,7 @@ public:
virtual ~plAvOneShotMsg();
plAvOneShotMsg(const plKey &sender, const plKey& receiver,
const plKey& seekKey, float duration, hsBool fSmartSeek,
const char *animName, hsBool drivable, hsBool reversible);
const plString &animName, hsBool drivable, hsBool reversible);
// plasma protocol
CLASSNAME_REGISTER( plAvOneShotMsg );
@ -257,7 +257,7 @@ public:
virtual void Write(hsStream *stream, hsResMgr *mgr);
// 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 fReversible; // can we play backwards?
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()
{
int size = fCallbacks.size();
for (int i = 0; i < size; i++)
delete [] fCallbacks[i].fMarker;
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()
@ -77,7 +74,7 @@ void plOneShotCallbacks::Read(hsStream* stream, hsResMgr* mgr)
fCallbacks.reserve(size);
for (int i = 0; i < size; i++)
{
char *marker = stream->ReadSafeString();
plString marker = stream->ReadSafeString_TEMP();
plKey receiver = mgr->ReadKey(stream);
int16_t user = stream->ReadLE16();

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

@ -59,10 +59,10 @@ public:
class plOneShotCallback
{
public:
plOneShotCallback(char *marker, plKey &receiver, int16_t user) :
plOneShotCallback(const plString &marker, plKey &receiver, int16_t user) :
fMarker(marker), fReceiver(receiver) , fUser(user) {}
char *fMarker;
plString fMarker;
plKey fReceiver;
int16_t fUser;
};
@ -74,7 +74,7 @@ public:
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();
plOneShotCallback& GetCallback(int i);

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

@ -203,7 +203,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg)
return true;
plAnimCmdMsg* pMsg = new plAnimCmdMsg;
pMsg->AddReceiver(fXAnim);
pMsg->SetAnimName(fAnimLabel.c_str());
pMsg->SetAnimName(fAnimLabel);
// pMsg->SetAnimName()
if (fXPos < pMMsg->GetXPos())
{
@ -223,7 +223,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg)
return true;
plAnimCmdMsg* pMsg = new plAnimCmdMsg;
pMsg->AddReceiver(fYAnim);
pMsg->SetAnimName(fAnimLabel.c_str());
pMsg->SetAnimName(fAnimLabel);
if (fYPos > pMMsg->GetYPos())
{
if (fAllOrNothing)
@ -301,7 +301,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg)
pMsg->SetCmd(plAnimCmdMsg::kAddCallbacks);
pMsg->AddCallback(pCall1);
pMsg->AddCallback(pCall2);
pMsg->SetAnimName(fAnimLabel.c_str());
pMsg->SetAnimName(fAnimLabel);
pMsg->AddReceiver( fXAnim );
hsRefCnt_SafeUnRef( pCall1 );
@ -330,7 +330,7 @@ hsBool plAxisAnimModifier::MsgReceive(plMessage* msg)
pMsg->AddCallback(pCall1);
pMsg->AddCallback(pCall2);
pMsg->AddReceiver( fYAnim );
pMsg->SetAnimName(fAnimLabel.c_str());
pMsg->SetAnimName(fAnimLabel);
hsRefCnt_SafeUnRef( pCall1 );
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 "pnModifier/plSingleModifier.h"
#include "plString.h"
class plKey;
@ -74,7 +75,7 @@ protected:
int fIface;
plNotifyMsg* fNotify;
std::string fAnimLabel;
plString fAnimLabel;
plAxisInputInterface *fInputIface;
@ -100,8 +101,8 @@ public:
void SetNotificationKey(plKey k) { fNotificationKey = k; }
plNotifyMsg* GetNotify() { return fNotify; }
const char* GetAnimLabel() const {return fAnimLabel.c_str();}
void SetAnimLabel(const char* a) {fAnimLabel = a; }
plString GetAnimLabel() const { return fAnimLabel; }
void SetAnimLabel(const plString& a) { fAnimLabel = a; }
};

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

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

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

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

24
Sources/Tools/MaxComponent/plAGComponents.cpp

@ -109,11 +109,11 @@ public:
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 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); }
@ -219,14 +219,15 @@ hsBool plAnimAvatarComponent::ConvertNode(plMaxNode *node, plErrorMsg *pErrMsg)
if (noteAnim.HasNotetracks())
{
// for each segment we found:
while (const char *animName = noteAnim.GetNextAnimName())
plString animName;
while (!(animName = noteAnim.GetNextAnimName()).IsNull())
{
plAnimInfo info = noteAnim.GetAnimInfo(animName);
plATCAnim *anim = NewAnimation(info.GetAnimName(), info.GetAnimStart(), info.GetAnimEnd());
const char *loopName = info.GetNextLoopName();
if (loopName)
plString loopName = info.GetNextLoopName();
if (!loopName.IsNull())
{
anim->SetLoop(true);
float loopStart = info.GetLoopStart(loopName);
@ -234,7 +235,8 @@ hsBool plAnimAvatarComponent::ConvertNode(plMaxNode *node, plErrorMsg *pErrMsg)
anim->SetLoopStart(loopStart == -1 ? anim->GetStart() : loopStart);
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));
ConvertNodeSegmentBranch(node, anim, pErrMsg);
@ -252,7 +254,7 @@ hsBool plAnimAvatarComponent::ConvertNode(plMaxNode *node, plErrorMsg *pErrMsg)
// 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);
}
@ -268,7 +270,7 @@ hsBool plAnimAvatarComponent::ConvertNodeSegmentBranch(plMaxNode *node, plAGAnim
{
// Check for a suppression marker
plNotetrackAnim noteAnim(node, pErrMsg);
plAnimInfo info = noteAnim.GetAnimInfo(nil);
plAnimInfo info = noteAnim.GetAnimInfo(plString::Null);
hsBool suppressed = info.IsSuppressed(mod->GetName());
// 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.
//
//
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
plLocation nodeLoc = node->GetLocation();
@ -379,7 +381,7 @@ public:
plEmoteComponent();
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:
float fFadeIn;
@ -455,7 +457,7 @@ hsBool plEmoteComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
// 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);
}

7
Sources/Tools/MaxComponent/plAnimCompProc.cpp

@ -313,11 +313,12 @@ void plMtlAnimProc::ILoadAnimCombo(HWND hWnd, IParamBlock2* pb)
if (mtl)
{
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);
if (!strcmp(animName, savedName))
if (!animName.Compare(savedName))
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);
if (!name || name[0] == '\0')
return nil;
return name;
return plString::Null;
return plString::FromUtf8(name);
}
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.
{
node->AddModifier(new plAGModifier(node->GetName()), IGetUniqueName(node));
node->AddModifier(new plAGModifier(plString::FromUtf8(node->GetName())), IGetUniqueName(node));
}
mod = new plAGMasterMod();
@ -717,9 +717,9 @@ hsBool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg)
// we've added all keys during convert. Some cleanup might
// be necessary in this case.
const char *animName = fCompPB->GetStr(kAnimName);
if (animName == nil || !strcmp(animName, ""))
animName = ENTIRE_ANIMATION_NAME;
plString animName = plString::FromUtf8(fCompPB->GetStr(kAnimName));
if (animName.IsEmpty())
animName = _TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME);
if (fCompPB->GetInt(ParamID(kAnimUseGlobal)))
{
@ -748,7 +748,7 @@ hsBool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg)
if (fCompPB->GetInt(kAnimLoop))
{
ATCAnim->SetLoop(true);
const char *loopName = fCompPB->GetStr(kAnimLoopName);
plString loopName = plString::FromUtf8(fCompPB->GetStr(kAnimLoopName));
float loopStart = info.GetLoopStart(loopName);
float loopEnd = info.GetLoopEnd(loopName);
@ -756,10 +756,12 @@ hsBool plAnimComponentBase::PreConvert(plMaxNode *node, plErrorMsg *pErrMsg)
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));
while (const char *marker = info.GetNextMarkerName())
plString marker;
while (!(marker = info.GetNextMarkerName()).IsNull())
ATCAnim->AddMarker(marker, info.GetMarkerTime(marker));
float stopPoint = -1;
@ -790,7 +792,7 @@ hsBool plAnimComponentBase::IAddTMToAnim(plMaxNode *node, plAGAnim *anim, plErro
hsAffineParts * parts = new hsAffineParts;
plController* tmc;
if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME))
if (!anim->GetName().Compare(ENTIRE_ANIMATION_NAME))
tmc = hsControlConverter::Instance().ConvertTMAnim(obj, node, parts);
else
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)
{
plMatrixChannelApplicator *app = new plMatrixChannelApplicator();
app->SetChannelName(node->GetName());
app->SetChannelName(plString::FromUtf8(node->GetName()));
plMatrixControllerChannel *channel = new plMatrixControllerChannel(tmc, parts);
app->SetChannel(channel);
anim->AddApplicator(app);
if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME))
if (!anim->GetName().Compare(ENTIRE_ANIMATION_NAME))
anim->ExtendToLength(tmc->GetLength());
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
if (!node->HasAGMod())
{
node->AddModifier(new plAGModifier(node->GetName()), IGetUniqueName(node));
node->AddModifier(new plAGModifier(plString::FromUtf8(node->GetName())), IGetUniqueName(node));
}
madeAnim = true;
}
@ -883,8 +885,7 @@ hsBool plAnimComponentBase::IMakePersistent(plMaxNode *node, plAGAnim *anim, plE
plAGMasterMod *mod = plAGMasterMod::ConvertNoRef(fMods[node]);
hsAssert(mod != nil, "No MasterMod to make animation persistent!");
char buffer[256];
sprintf(buffer, "%s_%s_anim_%d", node->GetName(), anim->GetName(), mod->GetNumPrivateAnimations());
plString buffer = plString::Format("%s_%s_anim_%d", node->GetName(), anim->GetName().c_str(), mod->GetNumPrivateAnimations());
plLocation nodeLoc = node->GetLocation();
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);
app->SetChannel(channel);
anim->AddApplicator(app);
if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME))
if (!anim->GetName().Compare(ENTIRE_ANIMATION_NAME))
anim->ExtendToLength(ctl->GetLength());
}
@ -989,12 +990,12 @@ void plAnimComponentBase::PickTargetNode( IParamBlock2 *destPB, ParamID destP
pick.DoPick();
}
const char *plAnimComponentBase::GetIfaceSegmentName( hsBool allowNil )
plString plAnimComponentBase::GetIfaceSegmentName( hsBool allowNil )
{
const char *name = GetAnimName();
if( allowNil || name != nil )
plString name = GetAnimName();
if( allowNil || !name.IsNull() )
return name;
return ENTIRE_ANIMATION_NAME;
return _TEMP_CONVERT_FROM_LITERAL( ENTIRE_ANIMATION_NAME );
}
//// Hit Callback for Animations /////////////////////////////////////////////

4
Sources/Tools/MaxComponent/plAnimComponent.h

@ -115,7 +115,7 @@ public:
hsBool DeInit(plMaxNode *node, plErrorMsg *pErrMsg);
virtual plKey GetModKey(plMaxNode *node)=0;
const char *GetAnimName();
plString GetAnimName();
static hsBool IsAnimComponent(plComponentBase *comp);
std::map<plMaxNode*, plAGAnim*> fAnims;
@ -132,7 +132,7 @@ public:
// plAnimObjInterface functions
virtual void PickTargetNode( IParamBlock2 *destPB, ParamID destParamID, ParamID typeID );
virtual hsBool IsNodeRestricted( void ) { return true; }
virtual const char *GetIfaceSegmentName( hsBool allowNil );
virtual plString GetIfaceSegmentName( hsBool allowNil );
protected:
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
//
plKey animKey = animComp->GetModKey(animNode);
const char* animName = animComp->GetAnimName();
plString animName = animComp->GetAnimName();
plAnimCmdMsg *animMsg = new plAnimCmdMsg;
animMsg->SetCmd(plAnimCmdMsg::kAddCallbacks);
@ -209,7 +209,7 @@ hsBool plAnimEventComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
int numMarkers = fCompPB->Count(kAnimMarkers);
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);
plEventCallbackMsg *eventMsg = CreateCallbackMsg(animMsg, modKey);
@ -255,12 +255,12 @@ static int ListBox_AddStringData(HWND hList, const char* text, int data)
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);
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)
pb->Delete(paramID, i, 1);
@ -279,7 +279,7 @@ static void RemoveDeadMarkers(IParamBlock2* pb, int paramID, plAnimInfo& info)
int numMarkers = pb->Count(paramID);
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)
{
pb->Delete(paramID, i, 1);
@ -328,9 +328,10 @@ void plAnimEventProc::ILoadUser(HWND hWnd, IParamBlock2* pb)
RemoveDeadMarkers(pb, kAnimMarkers, info);
// 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))
ListBox_SetSel(hList, TRUE, idx);
@ -355,16 +356,17 @@ bool plAnimEventProc::IUserCommand(HWND hWnd, IParamBlock2* pb, int cmd, int res
{
char buf[256];
ListBox_GetText(hList, idx, buf);
plString text = plString::FromUtf8(buf);
if (selected)
{
if (!IsMarkerSelected(pb, kAnimMarkers, buf))
if (!IsMarkerSelected(pb, kAnimMarkers, text))
{
TCHAR* name = buf;
pb->Append(kAnimMarkers, 1, &name);
}
}
else
IsMarkerSelected(pb, kAnimMarkers, buf, true);
IsMarkerSelected(pb, kAnimMarkers, text, true);
}
return true;
@ -480,7 +482,7 @@ hsBool plMtlEventComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
Mtl* mtl = fCompPB->GetMtl(kMtlMtl);
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
@ -512,7 +514,7 @@ hsBool plMtlEventComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
int numMarkers = fCompPB->Count(kMtlMarkers);
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);
plEventCallbackMsg *eventMsg = CreateCallbackMsg(animMsg, modKey);
@ -576,7 +578,7 @@ void plMtlEventProc::ILoadUser(HWND hWnd, IParamBlock2* pb)
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
plNotetrackAnim anim(mtl, nil);
@ -585,9 +587,10 @@ void plMtlEventProc::ILoadUser(HWND hWnd, IParamBlock2* pb)
RemoveDeadMarkers(pb, kMtlMarkers, info);
// 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))
ListBox_SetSel(hList, TRUE, idx);
@ -612,16 +615,17 @@ bool plMtlEventProc::IUserCommand(HWND hWnd, IParamBlock2* pb, int cmd, int resI
{
char buf[256];
ListBox_GetText(hList, idx, buf);
plString text = plString::FromUtf8(buf);
if (selected)
{
if (!IsMarkerSelected(pb, kMtlMarkers, buf))
if (!IsMarkerSelected(pb, kMtlMarkers, text))
{
TCHAR* name = buf;
pb->Append(kMtlMarkers, 1, &name);
}
}
else
IsMarkerSelected(pb, kMtlMarkers, buf, true);
IsMarkerSelected(pb, kMtlMarkers, text, 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
#include "hsTemplates.h"
#include "plString.h"
class plAnimObjInterface
{
@ -79,7 +80,7 @@ class plAnimObjInterface
// 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.
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)
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 )
{
plKey key;
char keyName[ MAX_PATH ];
plString keyName;
char fullPath[ MAX_PATH ];
strcpy( keyName, fileName );
::PathStripPath( keyName );
// ***TEMP plString REVISIT***
char tempPath[ MAX_PATH ];
strncpy(tempPath, fileName, MAX_PATH);
::PathStripPath( tempPath );
keyName = _TEMP_CONVERT_FROM_LITERAL( tempPath );
// 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
@ -635,7 +638,7 @@ plSoundBuffer *plBaseSoundEmitterComponent::IGetSourceBuffer( const char *file
plFileUtils::CreateDir( fullPath );
// Now finish the path...
strcat( fullPath, keyName );
strcat( fullPath, _TEMP_CONVERT_TO_CONST_CHAR( keyName ) );
// Check filestamp
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
if( srcBufferFlags & plSoundBuffer::kOnlyLeftChannel )
strcat( keyName, ":L" );
keyName += _TEMP_CONVERT_FROM_LITERAL( ":L" );
else if( srcBufferFlags & plSoundBuffer::kOnlyRightChannel )
strcat( keyName, ":R" );
keyName += _TEMP_CONVERT_FROM_LITERAL( ":R" );
key = srcNode->FindPageKey( plSoundBuffer::Index(), keyName );
if( key != nil )
@ -890,8 +893,8 @@ void plBaseSoundEmitterComponent::ISetBaseParameters( plSound *destSound, plE
{
destSound->SetProperty( plSound::kPropLooping, true );
const char *loop = fCompPB->GetStr((ParamID)kSoundLoopName);
if (loop && loop[0] != '\0')
plString loop = plString::FromUtf8( fCompPB->GetStr((ParamID)kSoundLoopName) );
if (!loop.IsEmpty())
{
SegmentMap *segMap = GetCompWaveSegmentMap( GetSoundFileName( kBaseSound ) );
if (segMap && segMap->find(loop) != segMap->end())
@ -915,7 +918,7 @@ hsBool plBaseSoundEmitterComponent::AddToAnim( plAGAnim *anim, plMaxNode *node
hsControlConverter& cc = hsControlConverter::Instance();
float start, end;
if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME))
if (!anim->GetName().Compare(ENTIRE_ANIMATION_NAME))
{
start = end = -1;
}
@ -937,7 +940,7 @@ hsBool plBaseSoundEmitterComponent::AddToAnim( plAGAnim *anim, plMaxNode *node
std::map<plMaxNode*, int>::iterator i = fIndices.begin();
plSoundVolumeApplicator *app = new plSoundVolumeApplicator( (*i).second );
app->SetChannelName(node->GetName());
app->SetChannelName(plString::FromUtf8(node->GetName()));
plAnimComponentBase::SetupCtl( anim, ctl, app, node );
result = true;
}
@ -1817,10 +1820,10 @@ public:
for (SegmentMap::iterator it = segMap->begin(); it != segMap->end(); it++)
{
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);
if (!strcmp(spec->fName, loop))
if (!spec->fName.Compare(loop))
SendMessage(hLoop, CB_SETCURSEL, idx, 0);
}
@ -2185,8 +2188,7 @@ hsBool plSound3DEmitterComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
plWinAudible* pAudible = (plWinAudible*)ai->GetAudible();
char keyName[ 256 ];
sprintf( keyName, "%s", GetINode()->GetName());
plString keyName = plString::FromUtf8(GetINode()->GetName());
plWin32Sound *sound = nil;
@ -2219,7 +2221,7 @@ hsBool plSound3DEmitterComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
// Converts an array of components into a single grouped sound
hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray<plBaseSoundEmitterComponent *> &groupArray, plErrorMsg *pErrMsg )
{
char keyName[ 256 ];
plString keyName;
if( !fValidNodes[ baseNode ] || !fCreateGrouped )
@ -2340,7 +2342,7 @@ hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray
if( fIndices.find( baseNode ) != fIndices.end() )
index = fIndices[ baseNode ];
sprintf( keyName, "%s_MergedSound", GetINode()->GetName() );
keyName = plString::Format( "%s_MergedSound", GetINode()->GetName() );
plKey buffKey = baseNode->FindPageKey( plSoundBuffer::Index(), keyName );
if( buffKey != nil )
@ -2361,7 +2363,7 @@ hsBool plSound3DEmitterComponent::ConvertGrouped( plMaxNode *baseNode, hsTArray
const plAudioInterface* ai = baseNode->GetSceneObject()->GetAudioInterface();
plWinAudible* pAudible = (plWinAudible*)ai->GetAudible();
sprintf( keyName, "%s", GetINode()->GetName());
keyName = plString::FromUtf8(GetINode()->GetName());
plWin32GroupedSound *sound = new plWin32GroupedSound;
sound->SetPositionArray( startPoses.GetCount(), startPoses.AcquireArray(), volumes.AcquireArray() );
sound->SetProperty( plSound::kPropLoadOnlyOnCall, true );
@ -2508,8 +2510,7 @@ hsBool plBackgroundMusicComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
if( srcBuffer == nil )
return false;
char keyName[ 256 ];
sprintf( keyName, "%s_Win32BgndSnd", GetINode()->GetName() );
plString keyName = plString::Format( "%s_Win32BgndSnd", GetINode()->GetName() );
plWin32Sound *sound = nil;
if( srcBuffer->GetDataLengthInSecs() > 4.f )
@ -2667,8 +2668,7 @@ hsBool plGUISoundComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
return false;
}
char keyName[ 256 ];
sprintf( keyName, "%s_Win32GUISound", GetINode()->GetName() );
plString keyName = plString::Format( "%s_Win32GUISound", GetINode()->GetName() );
plWin32StaticSound *sound = new plWin32StaticSound;
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
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)
{
@ -1613,7 +1613,7 @@ void plPickMaterialAnimationButtonParam::CreateKeyArray(IParamBlock2* pb)
Mtl* mtl = (Mtl*)pb->GetReferenceTarget(fID);
int bob = GetMatAnimModKey(mtl, nil, nil, fKeys);
int bob = GetMatAnimModKey(mtl, nil, plString::Null, fKeys);
}
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;
// 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));
}
agMod->SetChannelName("Handle");
agMod->SetChannelName(_TEMP_CONVERT_FROM_LITERAL("Handle"));
// Get the position and radius of the head and torso physicals
if (ClassID() == AVATAR_CLASS_ID || ClassID() == LOD_AVATAR_CLASS_ID)
@ -453,7 +453,7 @@ plAvatarComponent::plAvatarComponent()
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);
plKey meshKey = meshNode->GetSceneObject()->GetKey();
@ -476,7 +476,7 @@ void plAvatarComponent::IAttachModifiers(plMaxNode *node, plErrorMsg *pErrMsg)
avMod->SetBodyAgeName(node->GetAgeName());
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 );
@ -491,7 +491,7 @@ void plAvatarComponent::IAttachModifiers(plMaxNode *node, plErrorMsg *pErrMsg)
void AddClothingToMod(plMaxNode *node, plArmatureMod *mod, int group, hsGMaterial *mat, plErrorMsg *pErrMsg)
{
plGenRefMsg *msg;
char keyName[256];
plString keyName;
TSTR sdata;
hsStringTokenizer toker;
@ -509,11 +509,11 @@ void AddClothingToMod(plMaxNode *node, plArmatureMod *mod, int group, hsGMateria
}
else
base->SetLayoutName("BasicHuman");
sprintf(keyName, "%s_ClothingBase", node->GetName());
keyName = plString::Format("%s_ClothingBase", node->GetName());
hsgResMgr::ResMgr()->NewKey(keyName, base, node->GetLocation());
plClothingOutfit *outfit = new plClothingOutfit();
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());
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)
{
const char *name = node->GetKey()->GetName();
plString name = node->GetKey()->GetName();
node->MakeCharacterHierarchy(pErrMsg);
node->SetupBonesAliasesRecur(name);
node->SetupBonesAliasesRecur(_TEMP_CONVERT_TO_CONST_CHAR(name));
// create and register the player modifier
@ -1052,7 +1052,7 @@ plLODAvatarComponent::plLODAvatarComponent() : fMaterial(nil)
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);
plKey animRootKey = animRoot->GetSceneObject()->GetKey();
plArmatureLODMod* avMod = new plArmatureLODMod(avatarName);
@ -1066,7 +1066,7 @@ void plLODAvatarComponent::IAttachModifiers( plMaxNode *node, plErrorMsg *pEr
avMod->SetBodyAgeName(node->GetAgeName());
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);
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);
plAnimCmdMsg* pMsg = new plAnimCmdMsg;
const char *tempAnimName = pAnim->GetAnimName();
if (tempAnimName == nil)
plString tempAnimName = pAnim->GetAnimName();
if (tempAnimName.IsNull())
{
//pMsg->SetAnimName(ENTIRE_ANIMATION_NAME);
pMsg->SetAnimName(pAnim->GetModKey(node)->GetName());
pAxis->SetAnimLabel(ENTIRE_ANIMATION_NAME);
pAxis->SetAnimLabel(_TEMP_CONVERT_FROM_LITERAL(ENTIRE_ANIMATION_NAME));
}
else
{

10
Sources/Tools/MaxComponent/plComponentBase.cpp

@ -279,10 +279,8 @@ bool plComponentBase::IsTarget(plMaxNodeBase *node)
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)
int numUsedTargs = 0;
int thisTargIdx = -1;
@ -305,11 +303,9 @@ const char* plComponentBase::IGetUniqueName(plMaxNodeBase* target)
hsAssert(thisTargIdx != -1, "Bad target for IGetUniqueName");
if (numUsedTargs > 1)
_snprintf(nameBuf, sizeof(nameBuf), "%s_%d", GetINode()->GetName(), thisTargIdx);
return plString::Format("%s_%d", GetINode()->GetName(), thisTargIdx);
else
strncpy(nameBuf, GetINode()->GetName(), sizeof(nameBuf));
return nameBuf;
return plString::FromUtf8(GetINode()->GetName());
}
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
// 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:
// 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);
}
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);
}
@ -70,12 +70,12 @@ plKey plComponentTools::GetAnimCompLightModKey(plComponentBase *comp, plMaxNodeB
return fAnimLightKey(comp, node);
}
*/
const char *plComponentTools::GetAnimCompAnimName(plComponentBase *comp)
plString plComponentTools::GetAnimCompAnimName(plComponentBase *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);
}

12
Sources/Tools/MaxComponent/plComponentTools.h

@ -55,11 +55,11 @@ class plComponentBase;
class plMaxNodeBase;
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 plKey (*PGetAnimModKeyFunc) (plComponentBase*, plMaxNodeBase*);
typedef const char* (*PGetAnimNameFunc) (plComponentBase*);
typedef int (*PGetMaterialAnimModKeyFunc) (Mtl* mtl, plMaxNodeBase* node, const char *segName, hsTArray<plKey>& keys);
typedef plString (*PGetAnimNameFunc) (plComponentBase*);
typedef int (*PGetMaterialAnimModKeyFunc) (Mtl* mtl, plMaxNodeBase* node, const plString &segName, hsTArray<plKey>& keys);
typedef int (*PGetSoundNameAndIndex) (plComponentBase*, plMaxNodeBase* node, const char*& name);
//
@ -101,14 +101,14 @@ public:
{}
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);
const char *GetAnimCompAnimName(plComponentBase *comp);
plString GetAnimCompAnimName(plComponentBase *comp);
plKey GetAnimCompModKey(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);
};

2
Sources/Tools/MaxComponent/plFootstepComponent.cpp

@ -115,7 +115,7 @@ hsBool plFootstepSoundComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
plArmatureEffectFootSound *effect = new plArmatureEffectFootSound();
// 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;
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
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 );
// 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 );
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 );
@ -2728,7 +2728,7 @@ hsBool plGUIKnobCtrlComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
plAGMasterMod *master = node->GetAGMasterMod();
hsTArray<plKey> keys;
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 )
@ -4450,7 +4450,7 @@ hsBool plGUIProgressCtrlComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
plAGMasterMod *master = node->GetAGMasterMod();
hsTArray<plKey> keys;
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 );

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
plLogicModifier *logic = new plLogicModifier;
char tmpName[256];
sprintf(tmpName, "%s_%s_LogicModifier", obj->GetKeyName(), GetINode()->GetName());
plString tmpName = plString::Format("%s_%s_LogicModifier", obj->GetKeyName().c_str(), GetINode()->GetName());
plKey logicKey = hsgResMgr::ResMgr()->NewKey(tmpName, logic, node->GetLocation());
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);
}
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 (animName && segMap->find(animName) != segMap->end())
if (!animName.IsNull() && segMap->find(animName) != segMap->end())
{
SegmentSpec *spec = (*segMap)[animName];
if (spec->fType == type)
@ -124,14 +124,13 @@ SegmentMap *GetSharedAnimSegmentMap(std::vector<Animatable*>& anims, plErrorMsg
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)
{
}
SegmentSpec::~SegmentSpec()
{
delete [] fName;
}
// constants used for parsing the note tracks
@ -154,7 +153,6 @@ SegmentSpec::SegmentSpec()
fStart = -1;
fEnd = -1;
fInitial = -1;
fName = nil;
fType = kAnim;
}
@ -212,6 +210,9 @@ void GetSegment(const char *note, float time, SegmentMap *segMap, plErrorMsg *pE
int matchedFields = sscanf(note, " %[^@] @ %s ", segName, segSuffix);
plString name = _TEMP_CONVERT_FROM_LITERAL(segName);
plString suffix = _TEMP_CONVERT_FROM_LITERAL(segSuffix);
if (matchedFields == 2)
{
NoteType type = kNoteUnknown;
@ -249,7 +250,7 @@ void GetSegment(const char *note, float time, SegmentMap *segMap, plErrorMsg *pE
}
else
{
SegmentMap::iterator existing = segMap->find(segName);
SegmentMap::iterator existing = segMap->find(name);
SegmentSpec *existingSpec = (existing != segMap->end()) ? (*existing).second : nil;
const char *kErrorTitle = "NoteTrack Anim Error";
@ -304,37 +305,33 @@ void GetSegment(const char *note, float time, SegmentMap *segMap, plErrorMsg *pE
}
else
{
char *nameCopy = new char[strlen(segName)+1];
strcpy(nameCopy, segName);
switch (type)
{
case kNoteStartAnim:
(*segMap)[nameCopy] = new SegmentSpec(time, -1, nameCopy, SegmentSpec::kAnim);
(*segMap)[name] = new SegmentSpec(time, -1, name, SegmentSpec::kAnim);
break;
case kNoteStartLoop:
(*segMap)[nameCopy] = new SegmentSpec(time, -1, nameCopy, SegmentSpec::kLoop);
(*segMap)[name] = new SegmentSpec(time, -1, name, SegmentSpec::kLoop);
break;
case kNoteEndLoop:
(*segMap)[nameCopy] = new SegmentSpec(-1, time, nameCopy, SegmentSpec::kLoop);
(*segMap)[name] = new SegmentSpec(-1, time, name, SegmentSpec::kLoop);
break;
case kNoteMarker:
(*segMap)[nameCopy] = new SegmentSpec(time, -1, nameCopy, SegmentSpec::kMarker);
(*segMap)[name] = new SegmentSpec(time, -1, name, SegmentSpec::kMarker);
break;
case kNoteStopPoint:
(*segMap)[nameCopy] = new SegmentSpec(time, -1, nameCopy, SegmentSpec::kStopPoint);
(*segMap)[name] = new SegmentSpec(time, -1, name, SegmentSpec::kStopPoint);
break;
case kNoteSuppress:
(*segMap)[nameCopy] = new SegmentSpec(-1, -1, nameCopy, SegmentSpec::kSuppress);
(*segMap)[name] = new SegmentSpec(-1, -1, name, SegmentSpec::kSuppress);
break;
default:
delete [] nameCopy;
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 <vector>
#include "hsStlSortUtils.h"
#include "plString.h"
class plErrorMsg;
class Animatable;
@ -59,11 +60,11 @@ public:
float fStart; // beginning 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)
char * fName; // name of the segment: controls lifespan of the name
plString fName; // name of the segment: controls lifespan of the name
SegType fType;
SegmentSpec();
SegmentSpec(float start, float end, char * name, SegType);
SegmentSpec(float start, float end, const plString & name, SegType);
~SegmentSpec();
bool Contains(SegmentSpec *spec);
@ -71,7 +72,7 @@ public:
// 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
SegmentMap *GetAnimSegmentMap(Animatable *anim, plErrorMsg *pErrMsg);
@ -80,7 +81,7 @@ void DeleteSegmentMap(SegmentMap *segMap);
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
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);
}
const char *plNotetrackAnim::GetNextAnimName()
plString plNotetrackAnim::GetNextAnimName()
{
if (!fSegMap)
return nil;
return plString::Null;
while (fAnimIt != fSegMap->end())
{
@ -94,16 +94,16 @@ const char *plNotetrackAnim::GetNextAnimName()
}
fAnimIt = fSegMap->begin();
return nil;
return plString::Null;
}
plAnimInfo plNotetrackAnim::GetAnimInfo(const char *animName)
plAnimInfo plNotetrackAnim::GetAnimInfo(const plString &animName)
{
if (!fSegMap)
return plAnimInfo();
if (!animName || *animName == '\0' || fSegMap->find(animName) == fSegMap->end())
return plAnimInfo(fSegMap, nil);
if (animName.IsEmpty() || fSegMap->find(animName) == fSegMap->end())
return plAnimInfo(fSegMap, plString::Null);
else
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;
fAnimSpec = animName ? (*fSegMap)[animName] : nil;
fAnimSpec = !animName.IsNull() ? (*fSegMap)[animName] : nil;
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()
@ -145,10 +145,10 @@ float plAnimInfo::GetAnimInitial()
return fAnimSpec ? fAnimSpec->fInitial : -1;
}
const char *plAnimInfo::GetNextLoopName()
plString plAnimInfo::GetNextLoopName()
{
if (!fSegMap)
return nil;
return plString::Null;
while (fLoopIt != fSegMap->end())
{
@ -161,12 +161,12 @@ const char *plAnimInfo::GetNextLoopName()
}
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;
if (fSegMap->find(loopName) != fSegMap->end())
@ -181,9 +181,9 @@ float plAnimInfo::GetLoopStart(const char *loopName)
return -1;
}
float plAnimInfo::GetLoopEnd(const char *loopName)
float plAnimInfo::GetLoopEnd(const plString &loopName)
{
if (!fSegMap || loopName == nil)
if (!fSegMap || loopName.IsNull())
return -1;
if (fSegMap->find(loopName) != fSegMap->end())
@ -198,10 +198,10 @@ float plAnimInfo::GetLoopEnd(const char *loopName)
return -1;
}
const char *plAnimInfo::GetNextMarkerName()
plString plAnimInfo::GetNextMarkerName()
{
if (!fSegMap)
return nil;
return plString::Null;
while (fMarkerIt != fSegMap->end())
{
@ -214,10 +214,10 @@ const char *plAnimInfo::GetNextMarkerName()
}
fMarkerIt = fSegMap->begin();
return nil;
return plString::Null;
}
float plAnimInfo::GetMarkerTime(const char *markerName)
float plAnimInfo::GetMarkerTime(const plString &markerName)
{
if (!fSegMap)
return -1;
@ -250,9 +250,9 @@ float plAnimInfo::GetNextStopPoint()
return -1;
}
bool plAnimInfo::IsSuppressed(const char *animName)
bool plAnimInfo::IsSuppressed(const plString &animName)
{
if (!fSegMap || animName == nil)
if (!fSegMap || animName.IsNull())
return false;
if (fSegMap->find(animName) != fSegMap->end())

20
Sources/Tools/MaxComponent/plNotetrackAnim.h

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

14
Sources/Tools/MaxComponent/plNotetrackDlg.cpp

@ -129,11 +129,11 @@ void plNoteTrackDlg::ILoadAnims()
SegmentSpec *spec = it->second;
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);
// If this is the saved animation name, select it
if (!strcmp(spec->fName, savedAnim))
if (!spec->fName.Compare(savedAnim))
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)
SegmentSpec *animSpec = nil;
const char *animName = fPB->GetStr(fAnimID);
if (animName && *animName != '\0' && fSegMap->find(animName) != fSegMap->end())
plString animName = plString::FromUtf8(fPB->GetStr(fAnimID));
if (!animName.IsEmpty() && fSegMap->find(animName) != fSegMap->end())
animSpec = (*fSegMap)[animName];
// Get the saved loop name
@ -174,10 +174,10 @@ void plNoteTrackDlg::ILoadLoops()
if (!animSpec || animSpec->Contains(spec))
{
// Add the name
int idx = ComboBox_AddString(fhLoop, spec->fName);
int idx = ComboBox_AddString(fhLoop, spec->fName.c_str());
ComboBox_SetItemData(fhLoop, idx, kName);
if (!strcmp(loopName, spec->fName))
if (!spec->fName.Compare(loopName))
ComboBox_SetCurSel(fhLoop, idx);
}
}
@ -192,7 +192,7 @@ const char *plNoteTrackDlg::IGetSel(HWND hCombo)
{
char buf[256];
ComboBox_GetText(hCombo, buf, sizeof(buf));
return (*fSegMap)[buf]->fName;
return (*fSegMap)[plString::FromUtf8(buf)]->fName.c_str();
}
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)
{
node->AddModifier(fFlocker, nil);
node->AddModifier(fFlocker, plString::Null);
return true;
}

6
Sources/Tools/MaxComponent/plParticleComponents.cpp

@ -165,7 +165,7 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg)
int32_t i, j, k;
plLocation nodeLoc = node->GetKey()->GetUoid().GetLocation();
const char *objName = node->GetKey()->GetName();
plString objName = node->GetKey()->GetName();
plSceneObject *sObj = node->GetSceneObject();
plParticleSystem *sys = new plParticleSystem();
@ -518,7 +518,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node)
hsControlConverter& cc = hsControlConverter::Instance();
float start, end;
if (!strcmp(anim->GetName(), ENTIRE_ANIMATION_NAME))
if (!anim->GetName().Compare(ENTIRE_ANIMATION_NAME))
{
start = end = -1;
}
@ -1051,7 +1051,7 @@ void plParticleVolumeComponent::BuildVolume(plMaxNode *node)
return; // already converted it
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));
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:
{
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;
}
case kCurrentStraight:
{
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;
}
default:
{
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;
}
}

22
Sources/Tools/MaxComponent/plPythonFileComponent.cpp

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

22
Sources/Tools/MaxComponent/plResponderAnim.cpp

@ -333,7 +333,7 @@ plMessage *plResponderCmdAnim::ICreateAnimMsg(plMaxNode* node, plErrorMsg *pErrM
plAnimCmdMsg *msg = new plAnimCmdMsg;
msg->AddReceiver(animKey);
const char *tempAnimName = comp->GetAnimName();
plString tempAnimName = comp->GetAnimName();
msg->SetAnimName(tempAnimName);
// 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
// msg->SetCmd(plAnimCmdMsg::kSetLoopBegin);
// msg->SetCmd(plAnimCmdMsg::kSetLoopEnd);
const char *loopName = pb->GetStr(kAnimLoop);
plString loopName = plString::FromUtf8(pb->GetStr(kAnimLoop));
msg->SetLoopName(loopName);
}
break;
@ -481,13 +481,14 @@ void plResponderCmdAnim::GetWaitPoints(IParamBlock2 *pb, WaitPoints& waitPoints)
return;
plAnimComponent *animComp = (plAnimComponent*)GetComponent(pb);
const char *animName = animComp->GetAnimName();
plString animName = animComp->GetAnimName();
if (animComp)
{
plNotetrackAnim notetrackAnim(animComp, nil);
plAnimInfo info = notetrackAnim.GetAnimInfo(animName);
while (const char *marker = info.GetNextMarkerName())
plString marker;
while (!(marker = info.GetNextMarkerName()).IsNull())
waitPoints.push_back(marker);
}
}
@ -507,11 +508,11 @@ void plResponderCmdAnim::CreateWait(plMaxNode* node, plErrorMsg* pErrMsg, IParam
eventMsg->fRepeats = 0;
eventMsg->fUser = waitInfo.callbackUser;
if (waitInfo.point)
if (!waitInfo.point.IsNull())
{
// FIXME COLIN - Error checking here?
plAnimComponent *animComp = (plAnimComponent*)GetComponent(pb);
const char *animName = animComp->GetAnimName();
plString animName = animComp->GetAnimName();
plNotetrackAnim notetrackAnim(animComp, nil);
plAnimInfo info = notetrackAnim.GetAnimInfo(animName);
@ -752,18 +753,19 @@ void plResponderAnimProc::ILoadUser(HWND hWnd, IParamBlock2 *pb)
plComponentBase *comp = plResponderCmdAnim::Instance().GetComponent(pb);
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
plNotetrackAnim anim(comp, nil);
plAnimInfo info = anim.GetAnimInfo(animName);
// 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);
if (!strcmp(loopName, savedName))
if (!loopName.Compare(savedName))
ComboBox_SetCurSel(hLoop, idx);
}

6
Sources/Tools/MaxComponent/plResponderCmd.h

@ -55,11 +55,11 @@ class plMaxNode;
class ResponderWaitInfo
{
public:
const char* responderName; // For error messages
plString responderName; // For error messages
plMessage *msg; // Message created by the responder command
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
};
@ -81,7 +81,7 @@ public:
virtual void SetupProperties(plMaxNode* node, plErrorMsg* pErrMsg, IParamBlock2* pb) {}
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?
virtual bool IsWaitable(IParamBlock2 *pb) { return false; }
// 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];
ResponderWaitInfo waitInfo;
waitInfo.responderName = GetINode()->GetName();
waitInfo.responderName = plString::FromUtf8(GetINode()->GetName());
waitInfo.receiver = responder->GetKey();
waitInfo.callbackUser = numCallbacks++;
waitInfo.msg = cmds[convertedIdx].fMsg;
waitInfo.point = nil;
waitInfo.point = plString::Null;
IParamBlock2 *pb = (IParamBlock2*)statePB->GetReferenceTarget(kStateCmdParams, 0, i);
plResponderCmd *cmd = plResponderCmd::Find(pb);
@ -525,7 +525,7 @@ void plResponderComponent::IConvertCmdWaits(plMaxNode* node, plErrorMsg* pErrMsg
int convertedIdx = cmdIdxs[wait];
ResponderWaitInfo waitInfo;
waitInfo.responderName = GetINode()->GetName();
waitInfo.responderName = plString::FromUtf8(GetINode()->GetName());
waitInfo.receiver = responder->GetKey();
waitInfo.callbackUser = numCallbacks++;
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"
"the same command since the first command will automatically\n"
"delay any commands further down the list",
waitInfo.responderName, node->GetName()).Show();
waitInfo.responderName.c_str(), node->GetName()).Show();
pErrMsg->Set(false);
}
else

46
Sources/Tools/MaxComponent/plResponderMtl.cpp

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

6
Sources/Tools/MaxComponent/plResponderMtl.h

@ -52,7 +52,7 @@ class Mtl;
class plMaxNodeBase;
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
{
@ -74,7 +74,7 @@ public:
virtual void CreateWait(plMaxNode* node, plErrorMsg* pErrMsg, IParamBlock2 *pb, ResponderWaitInfo& waitInfo);
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);
}
const char* ResponderWait::GetWaitPoint(IParamBlock2* waitPB)
plString ResponderWait::GetWaitPoint(IParamBlock2* waitPB)
{
const char* point = waitPB->GetStr(kWaitPoint);
if (point && *point == '\0')
return nil;
return point;
return plString::Null;
return plString::FromUtf8(point);
}
/////////////////////////////////////////////////////////////////////////////

3
Sources/Tools/MaxComponent/plResponderWait.h

@ -46,6 +46,7 @@ class IParamBlock2;
class plKey;
class plMessage;
class plResponderModifier;
class plString;
namespace ResponderWait
{
@ -62,5 +63,5 @@ namespace ResponderWait
bool GetWaitOnMe(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;
}
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;
}
@ -1299,7 +1299,7 @@ void plVisRegionComponent::ICheckVisRegion(const plLocation& loc)
return;
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);
@ -1465,7 +1465,7 @@ hsBool plRelevanceRegionComponent::Convert(plMaxNode *node, plErrorMsg *errMsg)
return true;
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);
hsgResMgr::ResMgr()->SendRef(softKey, refMsg, plRefFlags::kActiveRef);
@ -1561,7 +1561,7 @@ plVisRegion* plEffVisSetComponent::GetVisRegion(plMaxNode* node)
if( !fVisReg )
{
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::kReplaceNormal, fCompPB->GetInt(kHideNormal));

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

Loading…
Cancel
Save