diff options
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/mapdata.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp index f65d038..9c84c4a 100644 --- a/src/koopatlas/mapdata.cpp +++ b/src/koopatlas/mapdata.cpp @@ -16,7 +16,7 @@ dKPPath_s *dKPNode_s::getOppositeExitTo(dKPPath_s *path) { bool dKPNode_s::isUnlocked() { for (int i = 0; i < 4; i++) if (exits[i]) - if (exits[i]) + if (exits[i]->isAvailable) return true; return false; } @@ -39,6 +39,8 @@ void dKPNode_s::setupNodeExtra() { const char *colour; + OSReport("Level %d-%d, isUnlocked: %d, exitComplete: %d", world, level, isUnlocked, exitComplete); + // Is it unlocked? if (!isUnlocked) colour = "g3d/black.brres"; @@ -56,7 +58,7 @@ void dKPNode_s::setupNodeExtra() { // Is it a shop? else if (level == 41) - const char *colour = "g3d/shop.brres"; + colour = "g3d/shop.brres"; // Is it complete? else if ((exitComplete) || (secretComplete)) { @@ -165,6 +167,8 @@ void dKPMapData_c::unloadTilesets() { } void dKPMapData_c::fixup() { + OSReport("Setting up Nodes"); + fixedUp = true; fixRef(data->layers); @@ -222,6 +226,25 @@ void dKPMapData_c::fixup() { // before we finish here, create the Node Extra classes + + // before the first off, do the unlocking. + SaveBlock *save = GetSaveFile()->GetBlock(-1); + for (int i = 0; i < pathLayer->pathCount; i++) { + dKPPath_s *path = pathLayer->paths[i]; + + if (path->unlockType > 0) { + u32 conds = save->GetLevelCondition(path->unlockLevelNumber[0] - 1, path->unlockLevelNumber[1] - 1); + + if (path->unlockType == 1 && (conds & COND_NORMAL)) + path->isAvailable = true; + else if (path->unlockType == 2 && (conds & COND_SECRET)) + path->isAvailable = true; + else + path->isAvailable = false; + } + } + + // first off, count how many we need... int count = 0; for (int nodeIdx = 0; nodeIdx < pathLayer->nodeCount; nodeIdx++) { |