From 873b0352478f0bf27ee3123e46d3bae5cb2720fb Mon Sep 17 00:00:00 2001 From: Treeki Date: Mon, 23 Jul 2012 03:09:38 +0200 Subject: added Level Node Extra stuff. untested in game, but it compiles --- src/koopatlas/mapdata.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/koopatlas/mapdata.cpp') 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++; + } + } } -- cgit v1.2.3