|
|
@ -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(); |
|
|
|