From 5f03da589c0d0eb22e73993198a709ddb95f2960 Mon Sep 17 00:00:00 2001
From: Colin Noga <Tempus@chronometry.ca>
Date: Wed, 18 Jul 2012 21:50:37 -0500
Subject: Putting the build into working order.

---
 src/koopatlas/map.cpp     | 12 +++++++-----
 src/koopatlas/mapdata.cpp | 11 ++++++-----
 src/koopatlas/mapdata.h   |  1 +
 3 files changed, 14 insertions(+), 10 deletions(-)

(limited to 'src')

diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp
index 38610e6..bca294c 100644
--- a/src/koopatlas/map.cpp
+++ b/src/koopatlas/map.cpp
@@ -312,7 +312,7 @@ void dWMMap_c::renderer_c::renderDoodadLayer(dKPLayer_s *layer) {
 						elapsed = anim->frameCount - 1 - elapsed;
 
 					if (elapsed >= anim->frameCount) {
-						if (elapsed >= (anim->frameCount + delay)) {
+						if (elapsed >= (anim->frameCount + anim->delay)) {
 
 							// we've reached the end
 							switch (anim->loop) {
@@ -419,8 +419,10 @@ void dWMMap_c::renderer_c::renderDoodadLayer(dKPLayer_s *layer) {
 }
 
 void dWMMap_c::renderer_c::renderPathLayer(dKPLayer_s *layer) {
+	return;
+
 	for (int i = 0; i < layer->nodeCount; i++) {
-		dKPNode_s **node = layer->nodes[i];
+		dKPNode_s *node = layer->nodes[i];
 
 		int world = node->levelNumber[0];
 		int level = node->levelNumber[1];
@@ -455,9 +457,9 @@ void dWMMap_c::renderer_c::renderPathLayer(dKPLayer_s *layer) {
 		else
 			node->color.setCurrentFrame(3); // Red
 
-		matrix.translation(node->x, node->y, 500.0); }
-		matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z);
-		node->model.setDrawMatrix(matrix);
+		node->matrix.translation(node->x, node->y, 500.0);
+		node->matrix.applyRotationYXZ(0, 0, 0);
+		node->model.setDrawMatrix(node->matrix);
 		node->model.setScale(1.0f, 1.0f, 1.0f);
 		node->model.calcWorld(false);
 
diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp
index 4a51519..524fb4f 100644
--- a/src/koopatlas/mapdata.cpp
+++ b/src/koopatlas/mapdata.cpp
@@ -50,9 +50,9 @@ bool dKPMapData_c::load(const char *filename) {
 
 	bool didLoadTilesets = loadTilesets();
 	bool didLoadBG = (bgLoader.load("/Maps/Water.brres") != 0);
-	bool nodeLoader.load("/Maps/visCobCourse.brres");
+	bool didLoadNode = nodeLoader.load("/Maps/visCobCourse.brres");
 
-	return didLoadTilesets && didLoadBG;
+	return didLoadTilesets && didLoadBG && didLoadNode;
 }
 
 bool dKPMapData_c::loadTilesets() {
@@ -90,13 +90,14 @@ void dKPMapData_c::unloadTilesets() {
 	}
 
 	bgLoader.unload();
-	nodeLoader.unload()
+	nodeLoader.unload();
 }
 
 void dKPMapData_c::fixup() {
 	fixedUp = true;
 
 	fixRef(data->layers);
+	fixRef(data->tilesets);
 
 	for (int iLayer = 0; iLayer < data->layerCount; iLayer++) {
 		dKPLayer_s *layer = fixRef(data->layers[iLayer]);
@@ -143,6 +144,7 @@ void dKPMapData_c::fixup() {
 					if (node->type == dKPNode_s::CHANGE)
 						fixRef(node->destMap);
 					else if (node->type == dKPNode_s::LEVEL) {
+						break;
 
 						node->allocator.link(-1, GameHeaps[0], 0, 0x20);
 
@@ -155,7 +157,7 @@ void dKPMapData_c::fixup() {
 						nw4r::g3d::ResAnmVis anmRes = rf.GetResAnmVis("cobCourse");
 
 						node->model.setup(mdl, &node->allocator, 0x224, 1, 0);
-						node->color.setup(mdl, anmRes, &node->allocator, 0, 1);
+						node->color.setup(mdl, anmRes, &node->allocator, 0);
 						node->color.bind(&node->model, anmRes, 0);
 						node->model.bindAnim(&node->color, 0.0f);
 						SetupTextures_MapObj(&node->model, 0);
@@ -165,7 +167,6 @@ void dKPMapData_c::fixup() {
 		}
 	}
 
-	fixRef(data->tilesets);
 }
 
 
diff --git a/src/koopatlas/mapdata.h b/src/koopatlas/mapdata.h
index c4d16b5..bb9e6c8 100644
--- a/src/koopatlas/mapdata.h
+++ b/src/koopatlas/mapdata.h
@@ -2,6 +2,7 @@
 #define __KOOPATLAS_MAPDATA_H
 
 #include <game.h>
+#include <g3dhax.h>
 
 // forward declarations
 struct dKPLayer_s;
-- 
cgit v1.2.3