mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-06 06:10:45 +00:00
Misc code cleanups, little SkeletalSprite loading improvement.
- Removed some unused member variables. - The BBGE_BUILD_WIDESCREEN define is now gone. - Added an TiXMLDocument cache to prevent parsing the same file once for each entity on the map with the same skeletal. - Removed Lua func entity_warpToPathStart, which was essentially a no-op because Entity::followingPath was always NULL. Removed related code. - Set texture wrap only when required. (Some changes taken from https://bitbucket.org/mattbierner/ios-aquaria, special thanks for changeset 72d6460d9e60)
This commit is contained in:
parent
568178bbb4
commit
9b63b400d5
23 changed files with 209 additions and 764 deletions
|
@ -30,6 +30,21 @@ std::string SkeletalSprite::skinPath = "skins/";
|
|||
|
||||
std::string SkeletalSprite::secondaryAnimationPath = "";
|
||||
|
||||
static std::map<std::string, TiXmlDocument> skelCache;
|
||||
|
||||
static TiXmlDocument& _retrieveSkeletalXML(const std::string& name)
|
||||
{
|
||||
TiXmlDocument& doc = skelCache[name];
|
||||
if (!doc.RootElement())
|
||||
doc.LoadFile(name);
|
||||
return doc;
|
||||
}
|
||||
|
||||
void SkeletalSprite::clearCache()
|
||||
{
|
||||
skelCache.clear();
|
||||
}
|
||||
|
||||
|
||||
void SkeletalKeyframe::copyAllButTime(SkeletalKeyframe *copy)
|
||||
{
|
||||
|
@ -842,7 +857,8 @@ void SkeletalSprite::saveSkeletal(const std::string &fn)
|
|||
file = animationPath + filename + ".xml";
|
||||
|
||||
int i = 0;
|
||||
TiXmlDocument xml;
|
||||
TiXmlDocument& xml = _retrieveSkeletalXML(file);
|
||||
xml.Clear();
|
||||
|
||||
TiXmlElement animationLayers("AnimationLayers");
|
||||
for (i = 0; i < animLayers.size(); i++)
|
||||
|
@ -1141,8 +1157,6 @@ Animation *SkeletalSprite::getAnimation(std::string anim)
|
|||
|
||||
void SkeletalSprite::loadSkin(const std::string &fn)
|
||||
{
|
||||
TiXmlDocument d;
|
||||
|
||||
std::string file;
|
||||
|
||||
if (!secondaryAnimationPath.empty())
|
||||
|
@ -1162,7 +1176,7 @@ void SkeletalSprite::loadSkin(const std::string &fn)
|
|||
errorLog("Could not load skin[" + file + "]");
|
||||
return;
|
||||
}
|
||||
d.LoadFile(file);
|
||||
TiXmlDocument& d = _retrieveSkeletalXML(file);
|
||||
|
||||
TiXmlElement *bonesXml = d.FirstChildElement("Bones");
|
||||
if (bonesXml)
|
||||
|
@ -1294,7 +1308,7 @@ void SkeletalSprite::loadSkeletal(const std::string &fn)
|
|||
|
||||
loaded = true;
|
||||
|
||||
TiXmlDocument xml;
|
||||
TiXmlDocument& xml = _retrieveSkeletalXML(file);
|
||||
xml.LoadFile(file.c_str());
|
||||
|
||||
TiXmlElement *bones = xml.FirstChildElement("Bones");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue