diff options
Diffstat (limited to '')
-rw-r--r-- | src/wmresourcemng.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/wmresourcemng.cpp b/src/wmresourcemng.cpp index 4a71753..241dff3 100644 --- a/src/wmresourcemng.cpp +++ b/src/wmresourcemng.cpp @@ -59,7 +59,11 @@ bool dWMResourceMng_c::loadSet(const char *setName) { isLoadingComplete &= (resLoaders[i].load(setData->getName(i)) != 0); } - // if they are ALL loaded, then we'll return true! + // if they are ALL loaded, then this will be true + if (isLoadingComplete) { + prepareResources(); + } + return isLoadingComplete; } @@ -76,3 +80,30 @@ void *dWMResourceMng_c::operator[](u32 key) { return 0; } + +void dWMResourceMng_c::prepareResources() { + // first off, initialise every brres file used + for (int i = 0; i < resCount(); i++) { + if ((keyForIndex(i) >> 16) == '3D') { + nw4r::g3d::ResFile resFile(dataForIndex(i)); + resFile.CheckRevision(); + resFile.Init(); + } + } + + // now that they're all initialised, loop through the brres files and bind + // them to every other file ... because I don't think it's a good idea to + // bind them before they've been initialised + for (int i = 0; i < resCount(); i++) { + if ((keyForIndex(i) >> 16) == '3D') { + nw4r::g3d::ResFile firstFile(dataForIndex(i)); + + for (int j = 0; j < resCount(); j++) { + nw4r::g3d::ResFile secondFile(dataForIndex(j)); + + firstFile.Bind(secondFile); + } + } + } +} + |