From 57577aa4c163b01572b21914defe34e7ee24104b Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 24 Jul 2012 15:55:13 +0200 Subject: parts of the new unlock system, still got to wrap up some stuff --- src/koopatlas/mapdata.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/koopatlas/mapdata.cpp') diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp index 9c84c4a..dd4646b 100644 --- a/src/koopatlas/mapdata.cpp +++ b/src/koopatlas/mapdata.cpp @@ -173,6 +173,7 @@ void dKPMapData_c::fixup() { fixRef(data->layers); fixRef(data->tilesets); + fixRef(data->unlockData); for (int iLayer = 0; iLayer < data->layerCount; iLayer++) { dKPLayer_s *layer = fixRef(data->layers[iLayer]); @@ -225,10 +226,7 @@ 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); + /*SaveBlock *save = GetSaveFile()->GetBlock(-1); for (int i = 0; i < pathLayer->pathCount; i++) { dKPPath_s *path = pathLayer->paths[i]; @@ -242,8 +240,10 @@ void dKPMapData_c::fixup() { else path->isAvailable = false; } - } + }*/ + + // before we finish here, create the Node Extra classes // first off, count how many we need... int count = 0; -- cgit v1.2.3 From 0d20c172706178e5df2d426fcf5cb1b7ae85c225 Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 25 Jul 2012 00:36:07 +0200 Subject: moving to desktop --- src/koopatlas/mapdata.cpp | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'src/koopatlas/mapdata.cpp') diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp index dd4646b..650f1e3 100644 --- a/src/koopatlas/mapdata.cpp +++ b/src/koopatlas/mapdata.cpp @@ -226,23 +226,6 @@ void dKPMapData_c::fixup() { } - /*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; - } - }*/ - - // before we finish here, create the Node Extra classes // first off, count how many we need... -- cgit v1.2.3 From 6895c831ad320c14b01ccabe1c8adcec354e3f9f Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 25 Jul 2012 14:10:39 +0200 Subject: lots more work completed, basic unlocks working --- src/koopatlas/mapdata.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'src/koopatlas/mapdata.cpp') diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp index 650f1e3..63fd0b7 100644 --- a/src/koopatlas/mapdata.cpp +++ b/src/koopatlas/mapdata.cpp @@ -2,17 +2,31 @@ // HELPER FUNCTIONS -dKPPath_s *dKPNode_s::getOppositeExitTo(dKPPath_s *path) { +dKPPath_s *dKPNode_s::getOppositeExitTo(dKPPath_s *path, bool mustBeAvailable) { for (int i = 0; i < 4; i++) { dKPPath_s *check = exits[i]; - if (check != 0 && check != path) + if (check != 0 && check != path) { + if (mustBeAvailable && !check->isAvailable) + continue; + return check; + } } return 0; } +int dKPNode_s::getExitCount(bool mustBeAvailable) { + int ct = 0; + + for (int i = 0; i < 4; i++) + if (exits[i] && (mustBeAvailable ? exits[i]->isAvailable : true)) + ct++; + + return ct; +} + bool dKPNode_s::isUnlocked() { for (int i = 0; i < 4; i++) if (exits[i]) @@ -89,6 +103,20 @@ void dKPNode_s::setupNodeExtra() { this->extra->mallocator.unlink(); } +void dKPNode_s::setLayerAlpha(u8 alpha) { + if (tileLayer) + tileLayer->alpha = alpha; + if (doodadLayer) + doodadLayer->alpha = alpha; +} + +void dKPPath_s::setLayerAlpha(u8 alpha) { + if (tileLayer) + tileLayer->alpha = alpha; + if (doodadLayer) + doodadLayer->alpha = alpha; +} + int dKPLayer_s::findNodeID(dKPNode_s *node) { for (int i = 0; i < nodeCount; i++) if (nodes[i] == node) -- cgit v1.2.3