diff options
author | Treeki <treeki@gmail.com> | 2012-07-23 03:09:38 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-07-23 03:09:38 +0200 |
commit | 873b0352478f0bf27ee3123e46d3bae5cb2720fb (patch) | |
tree | 4061ff0ec393ea8db6782e54b8c9d3fe16831b9d /src | |
parent | 1b80d8bc9a41497a8394af371e6ddca2c75a2b72 (diff) | |
download | kamek-873b0352478f0bf27ee3123e46d3bae5cb2720fb.tar.gz kamek-873b0352478f0bf27ee3123e46d3bae5cb2720fb.zip |
added Level Node Extra stuff. untested in game, but it compiles
Diffstat (limited to 'src')
-rw-r--r-- | src/koopatlas/mapdata.cpp | 23 | ||||
-rw-r--r-- | src/koopatlas/mapdata.h | 17 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp index 826d478..7fd2d17 100644 --- a/src/koopatlas/mapdata.cpp +++ b/src/koopatlas/mapdata.cpp @@ -33,11 +33,15 @@ int dKPLayer_s::findNodeID(dKPNode_s *node) { dKPMapData_c::dKPMapData_c() { data = 0; fixedUp = false; + levelNodeExtraArray = 0; tilesetLoaders = 0; tilesetsLoaded = false; } dKPMapData_c::~dKPMapData_c() { + if (levelNodeExtraArray) + delete[] levelNodeExtraArray; + unloadTilesets(); m_fileLoader.unload(); @@ -153,6 +157,25 @@ void dKPMapData_c::fixup() { } } + + // before we finish here, create the Node Extra classes + // first off, count how many we need... + int count = 0; + for (int nodeIdx = 0; nodeIdx < pathLayer->nodeCount; nodeIdx++) { + if (pathLayer->nodes[nodeIdx]->type == dKPNode_s::LEVEL) + count++; + } + + levelNodeExtraArray = new dKPNodeExtra_c[count]; + + int extraIdx = 0; + + for (int nodeIdx = 0; nodeIdx < pathLayer->nodeCount; nodeIdx++) { + if (pathLayer->nodes[nodeIdx]->type == dKPNode_s::LEVEL) { + pathLayer->nodes[nodeIdx]->extra = &levelNodeExtraArray[extraIdx]; + extraIdx++; + } + } } diff --git a/src/koopatlas/mapdata.h b/src/koopatlas/mapdata.h index 9f40433..6739086 100644 --- a/src/koopatlas/mapdata.h +++ b/src/koopatlas/mapdata.h @@ -7,6 +7,8 @@ // forward declarations struct dKPLayer_s; +class dKPNodeExtra_c; + /****************************************************************************** * Doodads ******************************************************************************/ @@ -68,6 +70,11 @@ struct dKPNode_s { dKPLayer_s *tileLayer, *doodadLayer; NodeTypes type; + + dKPNodeExtra_c *extra; + + // The union is placed at the very end so we can leave out padding in the + // kpbin union { struct { u8 levelNumber[2]; }; // FORWARDS COMPATIBILITY: @@ -208,10 +215,20 @@ class dKPMapData_c { dDvdLoader_c bgLoader; dDvdLoader_c nodeLoader; + dKPNodeExtra_c *levelNodeExtraArray; + dKPMapData_c(); bool load(const char *filename); ~dKPMapData_c(); }; + +// Currently only available for LEVEL nodes +class dKPNodeExtra_c { + public: + mMtx matrix; + m3d::mdl_c model; +}; + #endif |