From 053170b827defd19db852a9caa647c9a469e417b Mon Sep 17 00:00:00 2001
From: Treeki <treeki@gmail.com>
Date: Wed, 28 Mar 2012 01:23:46 +0200
Subject: fixes to WM code, and mHeap namespace

---
 include/game.h            | 9 +++++++++
 kamek_pal.x               | 6 ++++++
 src/koopatlas/core.cpp    | 3 ++-
 src/koopatlas/core.h      | 4 ++--
 src/koopatlas/map.cpp     | 9 ++++++---
 src/koopatlas/mapdata.cpp | 2 +-
 6 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/include/game.h b/include/game.h
index efe5fa6..3691fc7 100755
--- a/include/game.h
+++ b/include/game.h
@@ -2911,5 +2911,14 @@ class ClassWithCameraInfo {
 };
 
 
+namespace mHeap {
+	extern void *archiveHeap;
+	extern void *commandHeap;
+	extern void *dylinkHeap;
+	extern void *assertHeap;
+	extern void *gameHeaps[3];
+};
+
+
 #endif
 
diff --git a/kamek_pal.x b/kamek_pal.x
index 9447514..48bebf2 100644
--- a/kamek_pal.x
+++ b/kamek_pal.x
@@ -42,6 +42,12 @@ SECTIONS {
 	CosFIdx__Q24nw4r4mathFf = 0x80237D80;
 	SinCosFIdx__Q24nw4r4mathFPfPff = 0x80237DE0;
 
+	archiveHeap__5mHeap = 0x8042A72C;
+	commandHeap__5mHeap = 0x8042A730;
+	dylinkHeap__5mHeap = 0x8042A734;
+	assertHeap__5mHeap = 0x8042A738;
+	gameHeaps__5mHeap = 0x80377F48;
+
 	init__18StandOnTopColliderFP13dStageActor_cfffffsUcP7Point2d = 0x800DB270;
 	__ct__18StandOnTopColliderFv = 0x800DB220;
 	__dt__18StandOnTopColliderFv = 0x80044400;
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp
index de06453..5e15d99 100644
--- a/src/koopatlas/core.cpp
+++ b/src/koopatlas/core.cpp
@@ -230,7 +230,7 @@ bool WMInit_SetupExtra(void *ptr) {
 	wm->player->modelHandler->mdlClass->startAnimation(0, 1.2f, 10.0f, 0.0f);
 
 	dKPNode_s *cNode = wm->pathManager.currentNode;
-	wm->player->pos = (Vec){cNode->x, -cNode->y, wm->player->pos.y};
+	wm->player->pos = (Vec){cNode->x, -cNode->y, wm->player->pos.z};
 
 	// is last param correct? must check :/
 	wm->map = (dWMMap_c*)CreateParentedObject(WM_MAP, wm, 0, 0);
@@ -858,6 +858,7 @@ u32 dScKoopatlas_c::iterateMapList(u32(*callback)(u32,const char *,int,int), u32
 	while (true) {
 		u8 chr = *ptr;
 		if (chr == 13) {
+			*ptr = 0;
 			++ptr;
 			continue;
 		}
diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h
index 6a76cc4..fc517b2 100644
--- a/src/koopatlas/core.h
+++ b/src/koopatlas/core.h
@@ -19,13 +19,13 @@
 #ifdef WM_DEBUGGING
 #define MapReport OSReport
 #else
-inline void MapReport(const char *str, ...) { }
+#define MapReport(...)
 #endif
 
 #ifdef WM_SPAMMY_DEBUGGING
 #define SpammyReport OSReport
 #else
-inline void SpammyReport(const char *str, ...) { }
+#define SpammyReport(...)
 #endif
 
 void NewerMapDrawFunc();
diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp
index 5e2b813..fa5c120 100644
--- a/src/koopatlas/map.cpp
+++ b/src/koopatlas/map.cpp
@@ -6,18 +6,21 @@
 //#define DOODAD_DEBUGGING
 
 #ifdef TILE_DEBUGGING
+#define TileReport OSReport
 #else
-inline void TileReport(const char *str, ...) { }
+#define TileReport(...)
 #endif
 
 #ifdef BOUND_DEBUGGING
+#define BoundReport OSReport
 #else
-inline void BoundReport(const char *str, ...) { }
+#define BoundReport(...)
 #endif
 
 #ifdef DOODAD_DEBUGGING
+#define DoodadReport OSReport
 #else
-inline void DoodadReport(const char *str, ...) { }
+#define DoodadReport(...)
 #endif
 
 dWMMap_c *dWMMap_c::instance = 0;
diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp
index eaf9c75..6838741 100644
--- a/src/koopatlas/mapdata.cpp
+++ b/src/koopatlas/mapdata.cpp
@@ -40,7 +40,7 @@ dKPMapData_c::~dKPMapData_c() {
 }
 
 bool dKPMapData_c::load(const char *filename) {
-	data = (dKPMapFile_s*)m_fileLoader.load(filename);
+	data = (dKPMapFile_s*)m_fileLoader.load(filename, 0, mHeap::archiveHeap);
 
 	if (data == 0)
 		return false;
-- 
cgit v1.2.3