From 4ec93865045c4455c3a59344c09b3c43ca2e86ed Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 18 Jun 2011 02:45:04 +0200 Subject: brres files with a key that does not begin in 3D are bound now --- src/wmresourcemng.cpp | 12 ++++++++---- 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 -- cgit v1.2.3