diff options
author | Treeki <treeki@gmail.com> | 2011-03-13 02:34:58 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-03-13 02:34:58 +0100 |
commit | 72b2cb8e1bcb9970136efc8dc57b20b95ff7d082 (patch) | |
tree | 2aee80a8c1037068691f6cb988b0726c862ba449 /src | |
parent | e73bd67e8c61fcbca13cf36a8490d44f90e7cefa (diff) | |
download | kamek-72b2cb8e1bcb9970136efc8dc57b20b95ff7d082.tar.gz kamek-72b2cb8e1bcb9970136efc8dc57b20b95ff7d082.zip |
compiles now! untested, though. also did some work on dWMResourceMng_c
Diffstat (limited to 'src')
-rw-r--r-- | src/wmresourcemng.cpp | 33 | ||||
-rw-r--r-- | src/worldmap.cpp | 14 | ||||
-rw-r--r-- | src/worldmap.h | 4 |
3 files changed, 47 insertions, 4 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); + } + } + } +} + diff --git a/src/worldmap.cpp b/src/worldmap.cpp index e0e3d58..45d3d24 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -249,15 +249,23 @@ int dScNewerWorldMap_c::onExecute() { /**********************************************************************/
// STATE_END_DVD : Wait for files to load, end DVD
- case STATE_END_DVD:
+ // Also, load the WM Set files
+ case STATE_END_DVD: {
+
+ bool didEndDVD = false, didWMSetLoad = false;
if (!DVD_StillLoading(GetDVDClass2())) {
if (DVD_End()) {
- this->state = STATE_SETUP_WAIT;
+ didEndDVD = true;
}
}
- break;
+ didWMSetLoad = resMng.loadSet("SMGoldwood");
+
+ if (didEndDVD && didWMSetLoad)
+ this->state = STATE_SETUP_WAIT;
+
+ } break;
/**********************************************************************/
// STATE_SETUP_WAIT : Waiting for the world map managers to be set up
diff --git a/src/worldmap.h b/src/worldmap.h index a1d5b12..d30d907 100644 --- a/src/worldmap.h +++ b/src/worldmap.h @@ -61,6 +61,8 @@ private: WMResSetHeader *setData;
+ void prepareResources();
+
public:
dWMResourceMng_c();
~dWMResourceMng_c();
@@ -150,6 +152,8 @@ public: void *levelInfo;
FileHandle levelInfoFH;
+ dWMResourceMng_c resMng;
+
mHeapAllocator_c allocator;
File modelFile;
m3d::mdl_c model;
|