diff options
author | Treeki <treeki@gmail.com> | 2011-06-18 02:45:04 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-06-18 02:45:04 +0200 |
commit | 4ec93865045c4455c3a59344c09b3c43ca2e86ed (patch) | |
tree | b08dcf73a0c99ee180f2f90c1bd05f8e7a5aa333 /src | |
parent | a070ddd52b89cc3bb11aa2fd0a3a4818ca15ef43 (diff) | |
download | kamek-4ec93865045c4455c3a59344c09b3c43ca2e86ed.tar.gz kamek-4ec93865045c4455c3a59344c09b3c43ca2e86ed.zip |
brres files with a key that does not begin in 3D are bound now
Diffstat (limited to '')
-rw-r--r-- | src/wmresourcemng.cpp | 12 | ||||
-rw-r--r-- | src/wmresourcemng.h | 5 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/wmresourcemng.cpp b/src/wmresourcemng.cpp index 741abb2..9854fc2 100644 --- a/src/wmresourcemng.cpp +++ b/src/wmresourcemng.cpp @@ -112,7 +112,8 @@ void *dWMResourceMng_c::operator[](u32 key) { void dWMResourceMng_c::prepareResources() { // first off, initialise every brres file used for (int i = 0; i < resCount(); i++) { - if ((keyForIndex(i) >> 16) == '3D') { + //if ((keyForIndex(i) >> 16) == '3D') { + if (isResFile_byIndex(i)) { nw4r::g3d::ResFile resFile(dataForIndex(i)); resFile.CheckRevision(); resFile.Init(); @@ -123,13 +124,16 @@ void dWMResourceMng_c::prepareResources() { // 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') { + //if ((keyForIndex(i) >> 16) == '3D') { + if (isResFile_byIndex(i)) { nw4r::g3d::ResFile firstFile(dataForIndex(i)); for (int j = 0; j < resCount(); j++) { - nw4r::g3d::ResFile secondFile(dataForIndex(j)); + if (isResFile_byIndex(j)) { + nw4r::g3d::ResFile secondFile(dataForIndex(j)); - firstFile.Bind(secondFile); + firstFile.Bind(secondFile); + } } } } diff --git a/src/wmresourcemng.h b/src/wmresourcemng.h index 910acf1..4789856 100644 --- a/src/wmresourcemng.h +++ b/src/wmresourcemng.h @@ -51,6 +51,11 @@ public: void *dataForIndex(u32 index) { return resLoaders[index].buffer; } + + // TODO: refactor this, it's a bit strange atm + bool isResFile_byIndex(u32 index) { + return (memcmp(dataForIndex(index), "bres", 4) == 0); + } }; #endif |