mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
Fix string usage that was broken from enabling the Max plugin build
This commit is contained in:
@ -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);
|
||||
|
@ -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. */
|
||||
@ -199,17 +199,17 @@ protected:
|
||||
ApplicatorVec fApps; /// our animation channels
|
||||
float fBlend; /// requested blend factor
|
||||
|
||||
float fStart; /// the start time of the beginning of the animation (usually 0)
|
||||
float fEnd; /// the end time of the animation
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
#endif
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,9 +139,9 @@ 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
|
||||
hsBool fAutoApply; // evaluate animation automatically during IEval call
|
||||
hsBool fEnabled; // if not enabled, we don't eval any of our anims
|
||||
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
|
||||
|
||||
// APPLYING THE ANIMATION
|
||||
virtual hsBool IEval(double secs, float del, uint32_t dirty);
|
||||
|
@ -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.
|
||||
|
@ -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()
|
||||
|
@ -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,16 +388,16 @@ 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;
|
||||
CtrlMessageVec fQueuedCtrlMessages; // input messages we haven't processed
|
||||
float fMouseFrameTurnStrength; // Sum turnage from mouse delta messages since last eval.
|
||||
float fMouseFrameTurnStrength; // Sum turnage from mouse delta messages since last eval.
|
||||
plKey fFootSoundSOKey; // The Scene Object we attach to targets for footstep sounds
|
||||
plKey fLinkSoundSOKey; // Same thing for linking... wwwwawAWAWAwawa...
|
||||
plKey fLinkInAnimKey; // Set when we link out, this is the anim to play (backwards) when we link in.
|
||||
static float fMouseTurnSensitivity;
|
||||
static float fMouseTurnSensitivity;
|
||||
plArmatureUpdateMsg *fUpdateMsg;
|
||||
|
||||
// Trying to be a good lad here and align all our bools and bytes...
|
||||
@ -443,7 +443,7 @@ protected:
|
||||
// strings for animations, age names, footstep sounds, etc
|
||||
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 );
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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;}
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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,11 +106,11 @@ public:
|
||||
|
||||
protected:
|
||||
// public members
|
||||
char* 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
|
||||
float fSetTime; // set the animation to this time
|
||||
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
|
||||
float fSetTime; // set the animation to this time
|
||||
hsBool fStart; // start the animation playing? (attaching only)
|
||||
hsBool fLoop; // turn on looping? (attaching only)
|
||||
hsBool fAttach; // attach? (otherwise detach)
|
||||
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user