diff options
author | Treeki <treeki@gmail.com> | 2011-03-13 00:19:13 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-03-13 00:19:13 +0100 |
commit | b0e0d63eab1e11d1a7f841afdc7eb18e7a9de3ba (patch) | |
tree | 82802511dfa1f34b27c2b6ea708c4a5d94f40717 /src/worldmapdata.cpp | |
parent | 7d4e4c0b34a613dd3c0220475ae4e448197522c1 (diff) | |
download | kamek-b0e0d63eab1e11d1a7f841afdc7eb18e7a9de3ba.tar.gz kamek-b0e0d63eab1e11d1a7f841afdc7eb18e7a9de3ba.zip |
this branch now features only the level select stuff
Diffstat (limited to '')
-rw-r--r-- | src/worldmapdata.cpp | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/src/worldmapdata.cpp b/src/worldmapdata.cpp deleted file mode 100644 index 0473bbb..0000000 --- a/src/worldmapdata.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "worldmapdata.h" - -WorldMapData::WorldMapData() { - -} - -WorldMapData::~WorldMapData() { - FreeFile(&this->fh); -} - -bool WorldMapData::load(const char *filename) { - OSReport("Loading WM Data file: %s\n", filename); - - u32 ptr = (u32)LoadFile(&this->fh, filename); - WMDataHeader *header = (WMDataHeader*)ptr; - - OSReport("Loaded WM Data file @ %p\n", ptr); - - // first off, fix the list pointers - header->pathList = (WMPathDef**)((u32)header->pathList + ptr); - header->pointList = (WMPathPoint**)((u32)header->pointList + ptr); - header->segmentList = (WMPathSegment**)((u32)header->segmentList + ptr); - header->actionList = (WMPathAction**)((u32)header->actionList + ptr); - - // now, fix every pointer in the lists - OSReport("Fixing up list pointers\n"); - for (int i = 0; i < header->pathCount; i++) - header->pathList[i] = (WMPathDef*)((u32)header->pathList[i] + ptr); - - for (int i = 0; i < header->pointCount; i++) - header->pointList[i] = (WMPathPoint*)((u32)header->pointList[i] + ptr); - - for (int i = 0; i < header->segmentCount; i++) - header->segmentList[i] = (WMPathSegment*)((u32)header->segmentList[i] + ptr); - - for (int i = 0; i < header->actionCount; i++) - header->actionList[i] = (WMPathAction*)((u32)header->actionList[i] + ptr); - - // next up, fix every pointer in these structs - OSReport("Fixing up path pointers [%d]\n", header->pathCount); - for (int i = 0; i < header->pathCount; i++) { - WMPathDef *thisPath = header->pathList[i]; - //OSReport("Path @ %p - Index: %d - Segments: %d\n", thisPath, i, thisPath->segCount); - - thisPath->startPoint = header->pointList[(u32)thisPath->startPoint]; - thisPath->endPoint = header->pointList[(u32)thisPath->endPoint]; - - for (int j = 0; j < thisPath->segCount; j++) { - thisPath->segments[j] = header->segmentList[(u32)thisPath->segments[j]]; - } - } - - OSReport("Fixing up point pointers [%d]\n", header->pointCount); - for (int i = 0; i < header->pointCount; i++) { - WMPathPoint *thisPoint = header->pointList[i]; - - for (int j = 0; j < 4; j++) { - if ((u32)thisPoint->exits.asArray[j].path == -1) { - thisPoint->exits.asArray[j].path = 0; - } else { - thisPoint->exits.asArray[j].path = header->pathList[(u32)thisPoint->exits.asArray[j].path]; - } - } - } - - OSReport("Fixing up segment pointers [%d]\n", header->segmentCount); - for (int i = 0; i < header->segmentCount; i++) { - WMPathSegment *thisSegment = header->segmentList[i]; - - if ((u32)thisSegment->action == -1) { - thisSegment->action = 0; - } else { - thisSegment->action = header->actionList[(u32)thisSegment->action]; - } - } - - OSReport("Load complete\n"); - - return true; -} - - - -int WorldMapData::getPointID(WMPathPoint *point) { - WMDataHeader *header = (WMDataHeader*)this->fh.filePtr; - - for (int i = 0; i < header->pointCount; i++) { - if (header->pointList[i] == point) - return i; - } - - return -1; -} |