Don't clip out the group name from the textkeys

actorid
Chris Robinson 12 years ago
parent 6c85d6763a
commit 7d59340ed6

@ -243,14 +243,16 @@ void Animation::calcAnimVelocity()
if(track && track->getNumKeyFrames() > 1)
{
const std::string loopstart = mCurrentGroup+": loop start";
const std::string loopstop = mCurrentGroup+": loop stop";
float loopstarttime = 0.0f;
float loopstoptime = mCurrentAnim->getLength();
NifOgre::TextKeyMap::const_iterator keyiter = mCurrentKeys->begin();
while(keyiter != mCurrentKeys->end())
{
if(keyiter->second == "loop start")
if(keyiter->second == loopstart)
loopstarttime = keyiter->first;
else if(keyiter->second == "loop stop")
else if(keyiter->second == loopstop)
{
loopstoptime = keyiter->first;
break;
@ -383,12 +385,6 @@ void Animation::reset(const std::string &start, const std::string &stop)
bool Animation::handleEvent(float time, const std::string &evt)
{
if(evt == "start" || evt == "loop start")
{
/* Do nothing */
return true;
}
if(evt.compare(0, 7, "sound: ") == 0)
{
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
@ -402,21 +398,36 @@ bool Animation::handleEvent(float time, const std::string &evt)
return true;
}
if(evt == "loop stop")
if(evt.compare(0, mCurrentGroup.size(), mCurrentGroup) != 0 ||
evt.compare(mCurrentGroup.size(), 2, ": ") != 0)
{
// Not ours
return true;
}
size_t off = mCurrentGroup.size()+2;
size_t len = evt.size() - off;
if(evt.compare(off, len, "start") == 0 || evt.compare(off, len, "loop start") == 0)
{
/* Do nothing */
return true;
}
if(evt.compare(off, len, "loop stop") == 0)
{
if(mLooping)
{
reset("loop start");
reset(mCurrentGroup+": loop start");
if(mCurrentTime >= time)
return false;
return true;
}
}
else if(evt == "stop")
else if(evt.compare(off, len, "stop") == 0)
{
if(mLooping)
{
reset("loop start");
reset(mCurrentGroup+": loop start");
if(mCurrentTime >= time)
return false;
return true;
@ -424,7 +435,7 @@ bool Animation::handleEvent(float time, const std::string &evt)
// fall-through
}
if(mController)
mController->markerEvent(time, evt);
mController->markerEvent(time, evt.substr(off));
return true;
}
@ -455,7 +466,7 @@ void Animation::play(const std::string &groupname, const std::string &start, con
if(!found)
throw std::runtime_error("Failed to find animation "+groupname);
reset(start, stop);
reset(mCurrentGroup+": "+start, mCurrentGroup+": "+stop);
setLooping(loop);
mPlaying = true;
}

@ -282,17 +282,7 @@ void NIFSkeletonLoader::loadResource(Ogre::Resource *resource)
buildAnimation(skel, currentgroup, ctrls, targets, keyiter->first, lastkeyiter->first);
TextKeyMap::const_iterator insiter(keyiter);
TextKeyMap groupkeys;
do {
sep = insiter->second.find(':');
if(sep == currentgroup.length() && insiter->second.compare(0, sep, currentgroup) == 0)
groupkeys.insert(std::make_pair(insiter->first, insiter->second.substr(sep+2)));
else if((sep == sizeof("soundgen")-1 && insiter->second.compare(0, sep, "soundgen") == 0) ||
(sep == sizeof("sound")-1 && insiter->second.compare(0, sep, "sound") == 0))
groupkeys.insert(std::make_pair(insiter->first, insiter->second));
} while(insiter++ != lastkeyiter);
TextKeyMap groupkeys(keyiter, ++lastkeyiter);
bindings.setUserAny(std::string(sTextKeyExtraDataID)+"@"+currentgroup, Ogre::Any(groupkeys));
}
}

Loading…
Cancel
Save