From 295eb27c2dcdda10a7dd10cfe387ab6a422c2aee Mon Sep 17 00:00:00 2001 From: Jason Hooks Date: Fri, 6 Jan 2012 18:23:41 -0500 Subject: [PATCH] Better Text Indices; Better file output --- apps/openmw/mwrender/animation.cpp | 6 ++++++ components/nifogre/ogre_nif_loader.cpp | 23 +++++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 346f5a86b..f15bbb074 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -34,8 +34,14 @@ namespace MWRender{ time = startTime; } else if(textmappings){ + std::string startName = groupname + ": start"; std::string stopName = groupname + ": stop"; + + if(loops > 1){ + startName = groupname + ": loop start"; + std::string stopName = groupname + ": loop stop"; + } std::cout << "StartName:" << startName << "\n"; bool first = false; for(std::map::iterator iter = textmappings->begin(); iter != textmappings->end(); iter++){ diff --git a/components/nifogre/ogre_nif_loader.cpp b/components/nifogre/ogre_nif_loader.cpp index 500d5496b..380301551 100644 --- a/components/nifogre/ogre_nif_loader.cpp +++ b/components/nifogre/ogre_nif_loader.cpp @@ -1006,11 +1006,26 @@ void NIFLoader::handleNode(Nif::Node *node, int flags, replace(text.begin(), text.end(), '\n', '/'); text.erase(std::remove(text.begin(), text.end(), '\r'), text.end()); - if(text.at(0) == '/') - text.erase(0, 1); - file << "Time: " << textiter->time << "|" << text << "\n"; + int i = 0; + while(i < text.length()){ + while(i < text.length() && text.at(i) == '/' ){ + i++; + } + int first = i; + int length = 0; + while(i < text.length() && text.at(i) != '/' ){ + i++; + length++; + } + if(first < text.length()){ + //length = text.length() - first; + std::string sub = text.substr(first, length); + + file << "Time: " << textiter->time << "|" << sub << "\n"; - textmappings[text] = textiter->time; + textmappings[sub] = textiter->time; + } + } } file.close(); }