mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Convert anim name in plAnimStage to a plString
This commit is contained in:
@ -77,8 +77,7 @@ class plAGAnim;
|
|||||||
|
|
||||||
// PLANIMSTAGE default ctor
|
// PLANIMSTAGE default ctor
|
||||||
plAnimStage::plAnimStage()
|
plAnimStage::plAnimStage()
|
||||||
: fAnimName(nil),
|
: fNotify(0),
|
||||||
fNotify(0),
|
|
||||||
fArmature(nil),
|
fArmature(nil),
|
||||||
fBrain(nil),
|
fBrain(nil),
|
||||||
fForwardType(kForwardNone),
|
fForwardType(kForwardNone),
|
||||||
@ -102,8 +101,9 @@ plAnimStage::plAnimStage()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
plAnimStage::plAnimStage(const char *animName, uint8_t notify)
|
plAnimStage::plAnimStage(const plString &animName, uint8_t notify)
|
||||||
: fNotify(notify),
|
: fAnimName(animName),
|
||||||
|
fNotify(notify),
|
||||||
fArmature(nil),
|
fArmature(nil),
|
||||||
fBrain(nil),
|
fBrain(nil),
|
||||||
fForwardType(kForwardAuto), // different from default
|
fForwardType(kForwardAuto), // different from default
|
||||||
@ -125,19 +125,19 @@ plAnimStage::plAnimStage(const char *animName, uint8_t notify)
|
|||||||
fReverseOnIdle(false),
|
fReverseOnIdle(false),
|
||||||
fDone(false)
|
fDone(false)
|
||||||
{
|
{
|
||||||
fAnimName = hsStrcpy(animName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// PLANIMSTAGE canonical ctor
|
// PLANIMSTAGE canonical ctor
|
||||||
plAnimStage::plAnimStage(const char *animName,
|
plAnimStage::plAnimStage(const plString &animName,
|
||||||
uint8_t notify,
|
uint8_t notify,
|
||||||
ForwardType forward,
|
ForwardType forward,
|
||||||
BackType back,
|
BackType back,
|
||||||
AdvanceType advance,
|
AdvanceType advance,
|
||||||
RegressType regress,
|
RegressType regress,
|
||||||
int loops)
|
int loops)
|
||||||
: fArmature(nil),
|
: fAnimName(animName),
|
||||||
|
fArmature(nil),
|
||||||
fBrain(nil),
|
fBrain(nil),
|
||||||
fNotify(notify),
|
fNotify(notify),
|
||||||
fForwardType(forward),
|
fForwardType(forward),
|
||||||
@ -159,10 +159,9 @@ plAnimStage::plAnimStage(const char *animName,
|
|||||||
fReverseOnIdle(false),
|
fReverseOnIdle(false),
|
||||||
fDone(false)
|
fDone(false)
|
||||||
{
|
{
|
||||||
fAnimName = hsStrcpy(animName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
plAnimStage::plAnimStage(const char *animName,
|
plAnimStage::plAnimStage(const plString &animName,
|
||||||
uint8_t notify,
|
uint8_t notify,
|
||||||
ForwardType forward,
|
ForwardType forward,
|
||||||
BackType back,
|
BackType back,
|
||||||
@ -173,7 +172,8 @@ plAnimStage::plAnimStage(const char *animName,
|
|||||||
int advanceTo,
|
int advanceTo,
|
||||||
bool doRegressTo,
|
bool doRegressTo,
|
||||||
int regressTo)
|
int regressTo)
|
||||||
: fArmature(nil),
|
: fAnimName(animName),
|
||||||
|
fArmature(nil),
|
||||||
fBrain(nil),
|
fBrain(nil),
|
||||||
fNotify(notify),
|
fNotify(notify),
|
||||||
fForwardType(forward),
|
fForwardType(forward),
|
||||||
@ -195,15 +195,11 @@ plAnimStage::plAnimStage(const char *animName,
|
|||||||
fReverseOnIdle(false),
|
fReverseOnIdle(false),
|
||||||
fDone(false)
|
fDone(false)
|
||||||
{
|
{
|
||||||
fAnimName = hsStrcpy(animName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PLANIMSTAGE dtor
|
// PLANIMSTAGE dtor
|
||||||
plAnimStage::~plAnimStage()
|
plAnimStage::~plAnimStage()
|
||||||
{
|
{
|
||||||
if(fAnimName)
|
|
||||||
delete[] fAnimName;
|
|
||||||
|
|
||||||
hsAssert(fAnimInstance == nil, "plAnimStage still has anim instance during destruction. (that's bad.)");
|
hsAssert(fAnimInstance == nil, "plAnimStage still has anim instance during destruction. (that's bad.)");
|
||||||
// we could delete the animation instance here, but it should have been deleted already...
|
// we could delete the animation instance here, but it should have been deleted already...
|
||||||
// *** check back in a while....
|
// *** check back in a while....
|
||||||
@ -213,7 +209,7 @@ plAnimStage::~plAnimStage()
|
|||||||
// ----------
|
// ----------
|
||||||
const plAnimStage& plAnimStage::operator=(const plAnimStage& src)
|
const plAnimStage& plAnimStage::operator=(const plAnimStage& src)
|
||||||
{
|
{
|
||||||
fAnimName = hsStrcpy(src.fAnimName);
|
fAnimName = src.fAnimName;
|
||||||
fNotify = src.fNotify;
|
fNotify = src.fNotify;
|
||||||
fForwardType = src.fForwardType;
|
fForwardType = src.fForwardType;
|
||||||
fBackType = src.fBackType;
|
fBackType = src.fBackType;
|
||||||
@ -260,12 +256,12 @@ plAGAnimInstance * plAnimStage::Attach(plArmatureMod *armature, plArmatureBrain
|
|||||||
fAnimInstance->SetCurrentTime(fLocalTime);
|
fAnimInstance->SetCurrentTime(fLocalTime);
|
||||||
#ifdef DEBUG_MULTISTAGE
|
#ifdef DEBUG_MULTISTAGE
|
||||||
char sbuf[256];
|
char sbuf[256];
|
||||||
sprintf(sbuf,"AnimStage::Attach - attaching stage %s",fAnimName);
|
snprintf(sbuf, sizeof(sbuf), "AnimStage::Attach - attaching stage %s", fAnimName.c_str());
|
||||||
plAvatarMgr::GetInstance()->GetLog()->AddLine(sbuf);
|
plAvatarMgr::GetInstance()->GetLog()->AddLine(sbuf);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
char buf[256];
|
char buf[256];
|
||||||
sprintf(buf, "Can't find animation <%s> for animation stage. Anything could happen.", fAnimName);
|
snprintf(buf, sizeof(buf), "Can't find animation <%s> for animation stage. Anything could happen.", fAnimName.c_str());
|
||||||
hsAssert(false, buf);
|
hsAssert(false, buf);
|
||||||
#ifdef DEBUG_MULTISTAGE
|
#ifdef DEBUG_MULTISTAGE
|
||||||
plAvatarMgr::GetInstance()->GetLog()->AddLine(buf);
|
plAvatarMgr::GetInstance()->GetLog()->AddLine(buf);
|
||||||
@ -332,10 +328,10 @@ bool plAnimStage::Detach(plArmatureMod *armature)
|
|||||||
|
|
||||||
#ifdef DEBUG_MULTISTAGE
|
#ifdef DEBUG_MULTISTAGE
|
||||||
char sbuf[256];
|
char sbuf[256];
|
||||||
sprintf(sbuf,"AnimStage::Detach - detaching stage %s",fAnimName);
|
snprintf(sbuf, sizeof(sbuf), "AnimStage::Detach - detaching stage %s", fAnimName.c_str());
|
||||||
plAvatarMgr::GetInstance()->GetLog()->AddLine(sbuf);
|
plAvatarMgr::GetInstance()->GetLog()->AddLine(sbuf);
|
||||||
#endif
|
#endif
|
||||||
// hsStatusMessageF("Detaching plAnimStage <%s>", fAnimName);
|
// hsStatusMessageF("Detaching plAnimStage <%s>", fAnimName.c_str());
|
||||||
if(fArmature) {
|
if(fArmature) {
|
||||||
fArmature = nil;
|
fArmature = nil;
|
||||||
|
|
||||||
@ -346,9 +342,7 @@ bool plAnimStage::Detach(plArmatureMod *armature)
|
|||||||
}
|
}
|
||||||
#ifdef DEBUG_MULTISTAGE
|
#ifdef DEBUG_MULTISTAGE
|
||||||
} else {
|
} else {
|
||||||
char sbuf[256];
|
plAvatarMgr::GetInstance()->GetLog()->AddLine("AnimStage::Detach: stage already detached");
|
||||||
sprintf(sbuf,"AnimStage::Detach: stage already detached");
|
|
||||||
plAvatarMgr::GetInstance()->GetLog()->AddLine(sbuf);
|
|
||||||
#endif
|
#endif
|
||||||
// hsStatusMessageF("Detach: stage already detached.");
|
// hsStatusMessageF("Detach: stage already detached.");
|
||||||
}
|
}
|
||||||
@ -535,7 +529,7 @@ bool plAnimStage::ITryAdvance(plArmatureMod *avMod)
|
|||||||
bool stageDone = false;
|
bool stageDone = false;
|
||||||
|
|
||||||
|
|
||||||
// hsStatusMessageF("Sending advance message for stage <%s>\n", fAnimName);
|
// hsStatusMessageF("Sending advance message for stage <%s>\n", fAnimName.c_str());
|
||||||
if(fAdvanceType == kAdvanceAuto || fAdvanceType == kAdvanceOnMove) {
|
if(fAdvanceType == kAdvanceAuto || fAdvanceType == kAdvanceOnMove) {
|
||||||
stageDone = true;
|
stageDone = true;
|
||||||
}
|
}
|
||||||
@ -562,7 +556,7 @@ bool plAnimStage::ITryRegress(plArmatureMod *avMod)
|
|||||||
// we may want to rename this to "ReachedStageEnd"
|
// we may want to rename this to "ReachedStageEnd"
|
||||||
ISendNotify(kNotifyRegress, proEventData::kRegressPrevStage, avMod, fBrain);
|
ISendNotify(kNotifyRegress, proEventData::kRegressPrevStage, avMod, fBrain);
|
||||||
|
|
||||||
// hsStatusMessageF("Sending regress message for stage <%s>\n", fAnimName);
|
// hsStatusMessageF("Sending regress message for stage <%s>\n", fAnimName.c_str());
|
||||||
if(fRegressType == kRegressAuto) {
|
if(fRegressType == kRegressAuto) {
|
||||||
stageDone = true;
|
stageDone = true;
|
||||||
}
|
}
|
||||||
@ -570,12 +564,6 @@ bool plAnimStage::ITryRegress(plArmatureMod *avMod)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GETANIMNAME
|
|
||||||
const char * plAnimStage::GetAnimName()
|
|
||||||
{
|
|
||||||
return fAnimName;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GETFORWARDTYPE
|
// GETFORWARDTYPE
|
||||||
plAnimStage::ForwardType plAnimStage::GetForwardType()
|
plAnimStage::ForwardType plAnimStage::GetForwardType()
|
||||||
{
|
{
|
||||||
@ -730,25 +718,22 @@ int plAnimStage::GetPrevStage(int curStage)
|
|||||||
// DUMPDEBUG
|
// DUMPDEBUG
|
||||||
void plAnimStage::DumpDebug(bool active, int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt)
|
void plAnimStage::DumpDebug(bool active, int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt)
|
||||||
{
|
{
|
||||||
std::string str;
|
plStringStream str;
|
||||||
|
|
||||||
str += fAnimName;
|
str << fAnimName;
|
||||||
str += " ";
|
str << " ";
|
||||||
|
|
||||||
if(fLoops) {
|
if(fLoops)
|
||||||
sprintf(strBuf, "loop(%d/%d)", fCurLoop, fLoops);
|
str << plString::Format("loop(%d/%d)", fCurLoop, fLoops);
|
||||||
str += strBuf;
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(strBuf, "time: (%f/%f)", fLocalTime, fLength);
|
str << plString::Format("time: (%f/%f)", fLocalTime, fLength);
|
||||||
str += strBuf;
|
|
||||||
|
|
||||||
if(active)
|
if(active)
|
||||||
debugTxt.DrawString(x, y, str.c_str(), 0, 255, 0);
|
debugTxt.DrawString(x, y, str.GetString().c_str(), 0, 255, 0);
|
||||||
else if(fAnimInstance)
|
else if(fAnimInstance)
|
||||||
debugTxt.DrawString(x, y, str.c_str());
|
debugTxt.DrawString(x, y, str.GetString().c_str());
|
||||||
else
|
else
|
||||||
debugTxt.DrawString(x, y, str.c_str(), 255, 255, 0);
|
debugTxt.DrawString(x, y, str.GetString().c_str(), 255, 255, 0);
|
||||||
|
|
||||||
y += lineHeight;
|
y += lineHeight;
|
||||||
}
|
}
|
||||||
@ -756,8 +741,7 @@ void plAnimStage::DumpDebug(bool active, int &x, int &y, int lineHeight, char *s
|
|||||||
// READ
|
// READ
|
||||||
void plAnimStage::Read(hsStream *stream, hsResMgr *mgr)
|
void plAnimStage::Read(hsStream *stream, hsResMgr *mgr)
|
||||||
{
|
{
|
||||||
delete [] fAnimName;
|
fAnimName = stream->ReadSafeString_TEMP();
|
||||||
fAnimName = stream->ReadSafeString();
|
|
||||||
fNotify = stream->ReadByte();
|
fNotify = stream->ReadByte();
|
||||||
fForwardType = (ForwardType)stream->ReadLE32();
|
fForwardType = (ForwardType)stream->ReadLE32();
|
||||||
fBackType = (BackType)stream->ReadLE32();
|
fBackType = (BackType)stream->ReadLE32();
|
||||||
|
@ -50,6 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "hsMatrix44.h"
|
#include "hsMatrix44.h"
|
||||||
#include "pnFactory/plCreatable.h"
|
#include "pnFactory/plCreatable.h"
|
||||||
|
#include "plString.h"
|
||||||
|
|
||||||
class plMessage;
|
class plMessage;
|
||||||
class plAGAnimInstance;
|
class plAGAnimInstance;
|
||||||
@ -158,7 +159,7 @@ public:
|
|||||||
animation attempts to reposition the avatar by having a
|
animation attempts to reposition the avatar by having a
|
||||||
channel attached to the avatar's handle.
|
channel attached to the avatar's handle.
|
||||||
*/
|
*/
|
||||||
plAnimStage(const char *animName,
|
plAnimStage(const plString &animName,
|
||||||
uint8_t notify,
|
uint8_t notify,
|
||||||
ForwardType forward,
|
ForwardType forward,
|
||||||
BackType backward,
|
BackType backward,
|
||||||
@ -172,7 +173,7 @@ public:
|
|||||||
will be played after this one, depending on which direction the stage is
|
will be played after this one, depending on which direction the stage is
|
||||||
moving.
|
moving.
|
||||||
*/
|
*/
|
||||||
plAnimStage(const char *animName,
|
plAnimStage(const plString &animName,
|
||||||
uint8_t notify,
|
uint8_t notify,
|
||||||
ForwardType forward,
|
ForwardType forward,
|
||||||
BackType back,
|
BackType back,
|
||||||
@ -189,7 +190,7 @@ public:
|
|||||||
\param animName The name of the animation controlled by this stage.
|
\param animName The name of the animation controlled by this stage.
|
||||||
\param notify Flags for when to send notify messages
|
\param notify Flags for when to send notify messages
|
||||||
*/
|
*/
|
||||||
plAnimStage(const char *animName, uint8_t notify);
|
plAnimStage(const plString &animName, uint8_t notify);
|
||||||
virtual ~plAnimStage();
|
virtual ~plAnimStage();
|
||||||
const plAnimStage& operator=(const plAnimStage& src);
|
const plAnimStage& operator=(const plAnimStage& src);
|
||||||
|
|
||||||
@ -200,7 +201,7 @@ public:
|
|||||||
bool MoveRelative(double worldTime, float delta, float &overage, plArmatureMod *avMod);
|
bool MoveRelative(double worldTime, float delta, float &overage, plArmatureMod *avMod);
|
||||||
|
|
||||||
/** The name of the animation associated with this stage. */
|
/** The name of the animation associated with this stage. */
|
||||||
const char * GetAnimName();
|
plString GetAnimName() const { return fAnimName; }
|
||||||
|
|
||||||
ForwardType GetForwardType();
|
ForwardType GetForwardType();
|
||||||
void SetForwardType(ForwardType t);
|
void SetForwardType(ForwardType t);
|
||||||
@ -254,14 +255,14 @@ protected:
|
|||||||
|
|
||||||
bool ISendNotify(uint32_t notifyMask, uint32_t notifyType, plArmatureMod *armature, plArmatureBrain *brain);
|
bool ISendNotify(uint32_t notifyMask, uint32_t notifyType, plArmatureMod *armature, plArmatureBrain *brain);
|
||||||
|
|
||||||
char *fAnimName; // the name of our animation
|
plString fAnimName; // the name of our animation
|
||||||
uint8_t fNotify; // flags for which events will cause notification events
|
uint8_t fNotify; // flags for which events will cause notification events
|
||||||
int fLoops; // how many times will this animation loop (after initial playthrough?)
|
int fLoops; // how many times will this animation loop (after initial playthrough?)
|
||||||
|
|
||||||
bool fDoAdvanceTo; // advance to a specific stage instead of n + 1
|
bool fDoAdvanceTo; // advance to a specific stage instead of n + 1
|
||||||
uint32_t fAdvanceTo; // the stage to advance to, provided fDoAdvanceTo is true
|
uint32_t fAdvanceTo; // the stage to advance to, provided fDoAdvanceTo is true
|
||||||
bool fDoRegressTo; // regress to a specific stage instaed of n - 1
|
bool fDoRegressTo; // regress to a specific stage instaed of n - 1
|
||||||
uint32_t fRegressTo; // the stage to regress true, provided fDoRegressTo is true
|
uint32_t fRegressTo; // the stage to regress true, provided fDoRegressTo is true
|
||||||
|
|
||||||
// --- these are derived & kept for bookkeeping
|
// --- these are derived & kept for bookkeeping
|
||||||
plAGAnimInstance *fAnimInstance;
|
plAGAnimInstance *fAnimInstance;
|
||||||
|
@ -229,7 +229,7 @@ bool plAvBrainGeneric::MatchAnimNames(const char *names[], int count)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
if (strcmp(names[i], GetStage(i)->GetAnimName()))
|
if (GetStage(i)->GetAnimName() != names[i])
|
||||||
return false; // different names.
|
return false; // different names.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ bool plAvatarSDLModifier::IPutStageIn(plArmatureMod *avMod, plAnimStage *stage,
|
|||||||
{
|
{
|
||||||
if(stage)
|
if(stage)
|
||||||
{
|
{
|
||||||
dstState->FindVar(StandardStageVarNames::kStrName)->Set(stage->GetAnimName());
|
dstState->FindVar(StandardStageVarNames::kStrName)->Set(stage->GetAnimName().c_str());
|
||||||
dstState->FindVar(StandardStageVarNames::kStrNumLoops)->Set(stage->GetNumLoops());
|
dstState->FindVar(StandardStageVarNames::kStrNumLoops)->Set(stage->GetNumLoops());
|
||||||
dstState->FindVar(StandardStageVarNames::kStrForward)->Set((int)stage->GetForwardType());
|
dstState->FindVar(StandardStageVarNames::kStrForward)->Set((int)stage->GetForwardType());
|
||||||
dstState->FindVar(StandardStageVarNames::kStrBackward)->Set((int)stage->GetBackType());
|
dstState->FindVar(StandardStageVarNames::kStrBackward)->Set((int)stage->GetBackType());
|
||||||
|
@ -145,7 +145,7 @@ bool plMultistageBehMod::MsgReceive(plMessage* msg)
|
|||||||
plAnimStage* stage = new plAnimStage;
|
plAnimStage* stage = new plAnimStage;
|
||||||
*stage = *((*fStages)[i]);
|
*stage = *((*fStages)[i]);
|
||||||
stages->push_back(stage);
|
stages->push_back(stage);
|
||||||
if (strstr(stage->GetAnimName(),"adder") != nil)
|
if (stage->GetAnimName().Find("adder") >= 0)
|
||||||
ladder = true;
|
ladder = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user