diff options
author | Treeki <treeki@gmail.com> | 2011-03-13 03:18:43 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-03-13 03:18:43 +0100 |
commit | 485c95c4fc071f954c7f808b0a89eb37d147c57b (patch) | |
tree | 1dff747edc9a33322daaa8b3bdd37eca0db01690 /src | |
parent | 72b2cb8e1bcb9970136efc8dc57b20b95ff7d082 (diff) | |
download | kamek-485c95c4fc071f954c7f808b0a89eb37d147c57b.tar.gz kamek-485c95c4fc071f954c7f808b0a89eb37d147c57b.zip |
WMResourceMng now works! also, a bit more cleanup
Diffstat (limited to '')
-rw-r--r-- | src/wmresourcemng.cpp | 12 | ||||
-rw-r--r-- | src/worldmap.cpp | 30 | ||||
-rw-r--r-- | src/worldmap.h | 2 |
3 files changed, 27 insertions, 17 deletions
diff --git a/src/wmresourcemng.cpp b/src/wmresourcemng.cpp index 241dff3..ade1222 100644 --- a/src/wmresourcemng.cpp +++ b/src/wmresourcemng.cpp @@ -7,6 +7,8 @@ dWMResourceMng_c::dWMResourceMng_c() { hasSetPath = false; isSetLoaded = false; isLoadingComplete = false; + + MapReport("dWMResourceMng_c constructed @ %p\n", this); } dWMResourceMng_c::~dWMResourceMng_c() { @@ -37,6 +39,8 @@ bool dWMResourceMng_c::loadSet(const char *setName) { if (!hasSetPath) { snprintf(setPath, sizeof(setPath), "/Maps/%s.fileset", setName); hasSetPath = true; + + MapReport("Generated set path: %s\n", setPath); } void *result = setLoader.load(setPath); @@ -46,6 +50,8 @@ bool dWMResourceMng_c::loadSet(const char *setName) { // cool, we've got it, now load everything here setData = (WMResSetHeader*)result; + MapReport("Set loaded! Data: %p - Count: %d\n", result, setData->count); + resLoaders = new dDvdLoader_c[setData->count]; isSetLoaded = true; @@ -56,7 +62,11 @@ bool dWMResourceMng_c::loadSet(const char *setName) { bool isLoadingComplete = true; for (int i = 0; i < setData->count; i++) { - isLoadingComplete &= (resLoaders[i].load(setData->getName(i)) != 0); + void *thisResource = resLoaders[i].load(setData->getName(i)); + + MapReport("Load(%s) result: %p\n", setData->getName(i), thisResource); + + isLoadingComplete &= (thisResource != 0); } // if they are ALL loaded, then this will be true diff --git a/src/worldmap.cpp b/src/worldmap.cpp index 45d3d24..62f3de2 100644 --- a/src/worldmap.cpp +++ b/src/worldmap.cpp @@ -7,12 +7,12 @@ dScNewerWorldMap_c *dScNewerWorldMap_c::instance = 0; dScNewerWorldMap_c *dScNewerWorldMap_c::build() {
// return new dScNewerWorldMap_c;
- OSReport("Creating WorldMap\n");
+ MapReport("Creating WorldMap\n");
void *buffer = AllocFromGameHeap1(sizeof(dScNewerWorldMap_c));
dScNewerWorldMap_c *c = new(buffer) dScNewerWorldMap_c;
- OSReport("Created WorldMap @ %p\n", c);
+ MapReport("Created WorldMap @ %p\n", c);
instance = c;
return c;
@@ -361,13 +361,13 @@ int dScNewerWorldMap_c::onExecute() { switch (CSMENU_CURRENT(this->csMenu)) {
case 0:
// Star Coins
- //OSReport("Star Coins was pressed\n");
+ MapReport("Star Coins was pressed\n");
this->state = STATE_NORMAL;
break;
case 1:
// Add/Drop Players
- //OSReport("Add/Drop Players was pressed\n");
+ MapReport("Add/Drop Players was pressed\n");
this->state = STATE_PLAYER_CHANGE_WAIT;
NPCHG_ACTIVE(this->numPeopleChange) = true;
WpadShit(10);
@@ -376,7 +376,7 @@ int dScNewerWorldMap_c::onExecute() { case 2:
// Save or Quick Save
- //OSReport("Save or Quick Save was pressed\n");
+ MapReport("Save or Quick Save was pressed\n");
if (GetSaveFile()->GetBlock(-1)->bitfield & 2) {
this->state = STATE_SAVE_OPEN;
YESNO_TYPE(this->yesNoWindow) = 1;
@@ -393,7 +393,7 @@ int dScNewerWorldMap_c::onExecute() { case 3:
// Title Screen
- //OSReport("Title Screen was pressed\n");
+ MapReport("Title Screen was pressed\n");
this->state = STATE_TITLE_CONFIRM_OPEN_WAIT;
YESNO_VISIBLE(this->yesNoWindow) = true;
YESNO_TYPE(this->yesNoWindow) = 10;
@@ -744,32 +744,32 @@ int dScNewerWorldMap_c::onDraw() { -// Todo: move to .LZ files and dDvd::loader_c
+// Todo: move to .LZ files and dDvd::loader_c and WM_MAP
void dScNewerWorldMap_c::LoadModel() {
- OSReport("Loading Goldwood model...\n");
- modelFile.openCompressed("/NewerRes/Maps/SMGoldwood.brres");
+ MapReport("Loading Goldwood model...\n");
+ modelFile.openCompressed("/Maps/SMGoldwood_bLZ.brres");
nw4r::g3d::ResFile resfile(modelFile.ptr());
if (!resfile.CheckRevision())
- OSReport("Warning: Revision check failed!\n");
+ MapReport("Warning: Revision check failed!\n");
resfile.Init();
if (!resfile.Bind(resfile))
- OSReport("Warning: ResFile bind failed!\n");
+ MapReport("Warning: ResFile bind failed!\n");
void *mdl = resfile.GetResMdl("GoldwoodBase");
- OSReport("Obtained ResMdl: %p\n", mdl);
+ MapReport("Obtained ResMdl: %p\n", mdl);
- OSReport(this->allocator.link(-1, GameHeaps[0], 0, 0x20) ? "Success\n" : "Fail\n");
- OSReport(this->model.setup(&mdl, &this->allocator, 0, 1, 0) ? "Success\n" : "Fail\n");
+ MapReport(this->allocator.link(-1, GameHeaps[0], 0, 0x20) ? "Success\n" : "Fail\n");
+ MapReport(this->model.setup(&mdl, &this->allocator, 0, 1, 0) ? "Success\n" : "Fail\n");
SetupTextures_Map(&model, 1);
this->allocator.unlink();
- OSReport("Done loading model!\n");
+ MapReport("Done loading model!\n");
Mtx asdf;
MTXIdentity(asdf);
diff --git a/src/worldmap.h b/src/worldmap.h index d30d907..ea1cd93 100644 --- a/src/worldmap.h +++ b/src/worldmap.h @@ -8,7 +8,7 @@ // TODO: add Save Error state
-//#define WM_DEBUGGING
+#define WM_DEBUGGING
#include <common.h>
#include <game.h>
|