MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / loadAnimations

Method loadAnimations

src/content/AnimationLibrary.cpp:46–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44 }
45
46 bool AnimationLibrary::loadAnimations()
47 {
48 // both .MDS and .MSB, where .MDS has precedence
49 std::map<std::string, bool> msb_loaded; // true = is MDS
50
51 std::string ext_mds = ".MDS";
52 std::string ext_msb = ".MSB";
53
54 for (auto fn : m_World.getEngine()->getVDFSIndex().getKnownFiles())
55 {
56 Utils::upper(fn);
57 const auto fnSplit = Utils::splitExtension(fn);
58 auto& withoutExt = fnSplit.first;
59 auto& extension = fnSplit.second;
60
61 if (extension == ext_mds)
62 {
63 ZenParser zen(fn, m_World.getEngine()->getVDFSIndex());
64 ModelScriptTextParser p(zen);
65 p.setStrict(false); // TODO: should be configurable
66 if (!loadModelScript(fn, p))
67 ; //return false;
68
69 // MDS always overwrites
70 msb_loaded[withoutExt] = true;
71 }
72 else if (extension == ext_msb)
73 {
74 auto it = msb_loaded.find(withoutExt);
75 if (it != msb_loaded.end() && it->second == true)
76 {
77 // an MDS was loaded before
78 continue;
79 }
80
81 ZenParser zen(fn, m_World.getEngine()->getVDFSIndex());
82 ModelScriptBinParser p(zen);
83 if (!loadModelScript(fn, p))
84 ; //return false;
85
86 msb_loaded[withoutExt] = false;
87 }
88 else
89 continue;
90 }
91
92 return true;
93 }
94
95 Handle::AnimationDataHandle AnimationLibrary::loadMAN(const std::string& name)
96 {

Callers 1

initMethod · 0.80

Calls 3

getEngineMethod · 0.80
findMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected