summaryrefslogtreecommitdiff
path: root/src/koopatlas/mapdata.cpp
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-07-22 21:26:01 -0500
committerColin Noga <Tempus@chronometry.ca>2012-07-22 21:26:01 -0500
commit248e7915227efa19a443f22aa6f80fe52a5a3b3a (patch)
tree7dcfa8829f4ce8277fb606022b0ad8bbee2c0741 /src/koopatlas/mapdata.cpp
parent873b0352478f0bf27ee3123e46d3bae5cb2720fb (diff)
downloadkamek-248e7915227efa19a443f22aa6f80fe52a5a3b3a.tar.gz
kamek-248e7915227efa19a443f22aa6f80fe52a5a3b3a.zip
Added node model rendering junk - non working.
Diffstat (limited to '')
-rw-r--r--src/koopatlas/mapdata.cpp70
1 files changed, 67 insertions, 3 deletions
diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp
index 7fd2d17..f65d038 100644
--- a/src/koopatlas/mapdata.cpp
+++ b/src/koopatlas/mapdata.cpp
@@ -21,6 +21,71 @@ bool dKPNode_s::isUnlocked() {
return false;
}
+void dKPNode_s::setupNodeExtra() {
+ int world = this->levelNumber[0];
+ int level = this->levelNumber[1];
+
+ SaveBlock *save = GetSaveFile()->GetBlock(-1);
+ u32 conds = save->GetLevelCondition(world-1, level-1);
+
+ bool isUnlocked = this->isUnlocked();
+ bool exitComplete = false;
+ bool secretComplete = false;
+
+ if (conds & 0x10)
+ exitComplete = true;
+ if (conds & 0x20)
+ secretComplete = true;
+
+ const char *colour;
+
+ // Is it unlocked?
+ if (!isUnlocked)
+ colour = "g3d/black.brres";
+
+ // Is it a one time level?
+ else if ((level >= 30) && (level <= 37)) {
+ // Is it complete?
+ if (exitComplete)
+ colour = "g3d/yellow.brres";
+
+ // It's still available
+ else
+ colour = "g3d/green.brres";
+ }
+
+ // Is it a shop?
+ else if (level == 41)
+ const char *colour = "g3d/shop.brres";
+
+ // Is it complete?
+ else if ((exitComplete) || (secretComplete)) {
+ // Does it have two exits?
+ if ((this->hasSecret) && (!exitComplete) && (!secretComplete))
+ colour = "g3d/blue.brres";
+
+ // Does it have one exit?
+ else if ((!this->hasSecret) && (exitComplete))
+ colour = "g3d/blue.brres";
+
+ // All exits are complete
+ else
+ colour = "g3d/purple.brres";
+ }
+ // Not complete after all
+ else
+ colour = "g3d/red.brres";
+
+ // model time
+ this->extra->mallocator.link(-1, GameHeaps[0], 0, 0x20);
+
+ nw4r::g3d::ResFile rg(getResource("cobCourse", colour));
+ this->extra->model.setup(rg.GetResMdl("cobCourse"), &this->extra->mallocator, 0x224, 1, 0);
+ this->extra->matrix.identity();
+ SetupTextures_MapObj(&this->extra->model, 0);
+
+ this->extra->mallocator.unlink();
+}
int dKPLayer_s::findNodeID(dKPNode_s *node) {
for (int i = 0; i < nodeCount; i++)
@@ -58,9 +123,8 @@ bool dKPMapData_c::load(const char *filename) {
bool didLoadTilesets = loadTilesets();
bool didLoadBG = (bgLoader.load("/Maps/Water.brres") != 0);
- bool didLoadNode = nodeLoader.load("/Maps/visCobCourse.brres");
- return didLoadTilesets && didLoadBG && didLoadNode;
+ return didLoadTilesets && didLoadBG;
}
bool dKPMapData_c::loadTilesets() {
@@ -98,7 +162,6 @@ void dKPMapData_c::unloadTilesets() {
}
bgLoader.unload();
- nodeLoader.unload();
}
void dKPMapData_c::fixup() {
@@ -173,6 +236,7 @@ void dKPMapData_c::fixup() {
for (int nodeIdx = 0; nodeIdx < pathLayer->nodeCount; nodeIdx++) {
if (pathLayer->nodes[nodeIdx]->type == dKPNode_s::LEVEL) {
pathLayer->nodes[nodeIdx]->extra = &levelNodeExtraArray[extraIdx];
+ pathLayer->nodes[nodeIdx]->setupNodeExtra();
extraIdx++;
}
}