[Scummvm-cvs-logs] CVS: scummvm/saga interface.cpp,1.13,1.14 objectmap.cpp,1.13,1.14 objectmap.h,1.5,1.6 render.cpp,1.21,1.22 render.h,1.12,1.13 saga.cpp,1.33,1.34 saga.h,1.24,1.25 scene.cpp,1.22,1.23 objectmap_mod.h,1.3,NONE

Jonathan Gray khalek at users.sourceforge.net
Mon Aug 2 08:45:06 CEST 2004


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30746

Modified Files:
	interface.cpp objectmap.cpp objectmap.h render.cpp render.h 
	saga.cpp saga.h scene.cpp 
Removed Files:
	objectmap_mod.h 
Log Message:
create objectMap class

Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- interface.cpp	1 Aug 2004 19:53:29 -0000	1.13
+++ interface.cpp	2 Aug 2004 15:44:18 -0000	1.14
@@ -30,7 +30,7 @@
 #include "actor_mod.h"
 #include "console_mod.h"
 #include "font_mod.h"
-#include "objectmap_mod.h"
+#include "objectmap.h"
 #include "rscfile_mod.h"
 #include "script_mod.h"
 #include "sprite_mod.h"
@@ -480,7 +480,7 @@
 	int script_num;
 	R_POINT iactor_pt;
 
-	hit_object = OBJECTMAP_HitTest(imouse_pt, &object_num);
+	hit_object = _vm->_objectMap->hitTest(imouse_pt, &object_num);
 
 	if (hit_object != R_SUCCESS) {
 		// Player clicked on empty spot - walk here regardless of verb
@@ -489,13 +489,13 @@
 		return R_SUCCESS;
 	}
 
-	if (OBJECTMAP_GetFlags(object_num, &object_flags) != R_SUCCESS) {
+	if (_vm->_objectMap->getFlags(object_num, &object_flags) != R_SUCCESS) {
 		CON_Print("Invalid object number: %d\n", object_num);
 		return R_FAILURE;
 	}
 
 	if (object_flags & R_OBJECT_NORMAL) {
-		if (OBJECTMAP_GetEPNum(object_num, &script_num) == R_SUCCESS) {
+		if (_vm->_objectMap->getEPNum(object_num, &script_num) == R_SUCCESS) {
 			// Set active verb in script module
 			_vm->_sdata->putWord(4, 4, I_VerbData[IfModule.active_verb].s_verb);
 
@@ -524,7 +524,7 @@
 
 	new_status[0] = 0;
 
-	hit_object = OBJECTMAP_HitTest(imouse_pt, &object_num);
+	hit_object = _vm->_objectMap->hitTest(imouse_pt, &object_num);
 
 	if (hit_object != R_SUCCESS) {
 		// Cursor over nothing - just display current verb
@@ -532,12 +532,12 @@
 		return R_SUCCESS;
 	}
 
-	if (OBJECTMAP_GetFlags(object_num, &object_flags) != R_SUCCESS) {
+	if (_vm->_objectMap->getFlags(object_num, &object_flags) != R_SUCCESS) {
 		CON_Print("Invalid object number: %d\n", object_num);
 		return R_FAILURE;
 	}
 
-	OBJECTMAP_GetName(object_num, &object_name);
+	_vm->_objectMap->getName(object_num, &object_name);
 
 	if (object_flags & R_OBJECT_NORMAL) {
 		// Normal scene object - display as subject of verb

Index: objectmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- objectmap.cpp	1 Aug 2004 23:24:22 -0000	1.13
+++ objectmap.cpp	2 Aug 2004 15:44:18 -0000	1.14
@@ -32,47 +32,39 @@
 #include "cvar_mod.h"
 #include "console_mod.h"
 #include "font_mod.h"
-
-#include "objectmap_mod.h"
 #include "objectmap.h"
 
 namespace Saga {
 
-static R_OBJECTMAP_INFO OMInfo;
+static void CF_object_info(int argc, char *argv[], void *refCon);
 
-int OBJECTMAP_Register() {
+int ObjectMap::reg() {
 	CVAR_RegisterFunc(CF_object_info, "object_info", NULL, R_CVAR_NONE, 0, 0, NULL);
 
 	return R_SUCCESS;
 }
 
 // Initializes the object map module, creates module allocation context
-int OBJECTMAP_Init() {
-	debug(0, "OBJECTMAP Module: Initializing...");
-
-	OMInfo.initialized = 1;
-	return R_SUCCESS;
+ObjectMap::ObjectMap(Gfx *gfx) {
+	debug(0, "ObjectMap Module: Initializing...");
+	_gfx = gfx;
+	_initialized = 1;
 }
 
 // Shuts down the object map module, destroys module allocation context
-int OBJECTMAP_Shutdown() {
-	if (!OMInfo.initialized) {
-		return R_FAILURE;
-	}
-
-	debug(0, "OBJECTMAP Module: Shutting down...");
+ObjectMap::~ObjectMap() {
+	debug(0, "ObjectMap Module: Shutting down...");
 
-	OBJECTMAP_Free();
-	OBJECTMAP_FreeNames();
+	freeMem();
+	freeNames();
 
-	debug(0, "OBJECTMAP Module: Shutdown AOK.");
+	debug(0, "ObjectMap Module: Shutdown AOK.");
 
-	OMInfo.initialized = 0;
-	return R_SUCCESS;
+	_initialized = 0;
 }
 
 // Loads an object map resource ( objects ( clickareas ( points ) ) ) 
-int OBJECTMAP_Load(const byte *om_res, size_t om_res_len) {
+int ObjectMap::load(const byte *om_res, size_t om_res_len) {
 	R_OBJECTMAP_ENTRY *object_map;
 	R_CLICKAREA *clickarea;
 	R_POINT *point;
@@ -81,28 +73,28 @@
 
 	MemoryReadStream readS(om_res, om_res_len);
 
-	if (!OMInfo.initialized) {
+	if (!_initialized) {
 		warning("Error: Object map module not initialized");
 		return R_FAILURE;
 	}
 
-	if (OMInfo.objects_loaded) {
-		OBJECTMAP_Free();
+	if (_objects_loaded) {
+		freeMem();
 	}
 
 	// Obtain object count N and allocate space for N objects
-	OMInfo.n_objects = readS.readUint16LE();
+	_n_objects = readS.readUint16LE();
 
-	OMInfo.object_maps = (R_OBJECTMAP_ENTRY *)malloc(OMInfo.n_objects * sizeof *OMInfo.object_maps);
+	_object_maps = (R_OBJECTMAP_ENTRY *)malloc(_n_objects * sizeof *_object_maps);
 
-	if (OMInfo.object_maps == NULL) {
+	if (_object_maps == NULL) {
 		warning("Error: Memory allocation failed");
 		return R_MEM;
 	}
 
 	// Load all N objects
-	for (i = 0; i < OMInfo.n_objects; i++) {
-		object_map = &OMInfo.object_maps[i];
+	for (i = 0; i < _n_objects; i++) {
+		object_map = &_object_maps[i];
 		object_map->unknown0 = readS.readByte();
 		object_map->n_clickareas = readS.readByte();
 		object_map->flags = readS.readUint16LE();
@@ -133,29 +125,29 @@
 				point->x = readS.readSint16LE();
 				point->y = readS.readSint16LE();
 			}
-			debug(2, "OBJECTMAP_Load(): Read %d points for clickarea %d in object %d.",
+			debug(2, "ObjectMap::load(): Read %d points for clickarea %d in object %d.",
 					clickarea->n_points, k, object_map->object_num);
 		}
 	}
 
-	OMInfo.objects_loaded = 1;
+	_objects_loaded = 1;
 
 	return R_SUCCESS;
 }
 
 // Frees all storage allocated for the current object map data
-int OBJECTMAP_Free() {
+int ObjectMap::freeMem() {
 	R_OBJECTMAP_ENTRY *object_map;
 	R_CLICKAREA *clickarea;
 
 	int i, k;
 
-	if (!OMInfo.objects_loaded) {
+	if (!_objects_loaded) {
 		return R_FAILURE;
 	}
 
-	for (i = 0; i < OMInfo.n_objects; i++) {
-		object_map = &OMInfo.object_maps[i];
+	for (i = 0; i < _n_objects; i++) {
+		object_map = &_object_maps[i];
 		for (k = 0; k < object_map->n_clickareas; k++) {
 			clickarea = &object_map->clickareas[k];
 			free(clickarea->points);
@@ -163,17 +155,17 @@
 		free(object_map->clickareas);
 	}
 
-	if (OMInfo.n_objects) {
-		free(OMInfo.object_maps);
+	if (_n_objects) {
+		free(_object_maps);
 	}
 
-	OMInfo.objects_loaded = 0;
+	_objects_loaded = 0;
 
 	return R_SUCCESS;
 }
 
 // Loads an object name list resource
-int OBJECTMAP_LoadNames(const unsigned char *onl_res, size_t onl_res_len) {
+int ObjectMap::loadNames(const unsigned char *onl_res, size_t onl_res_len) {
 	int table_len;
 	int n_names;
 	size_t name_offset;
@@ -182,46 +174,46 @@
 
 	MemoryReadStream readS(onl_res, onl_res_len);
 
-	if (OMInfo.names_loaded) {
-		OBJECTMAP_FreeNames();
+	if (_names_loaded) {
+		freeNames();
 	}
 
 	table_len = readS.readUint16LE();
 
 	n_names = table_len / 2 - 2;
-	OMInfo.n_names = n_names;
+	_n_names = n_names;
 
-	debug(2, "OBJECTMAP_LoadNames: Loading %d object names.", n_names);
-	OMInfo.names = (const char **)malloc(n_names * sizeof *OMInfo.names);
+	debug(2, "ObjectMap::loadNames: Loading %d object names.", n_names);
+	_names = (const char **)malloc(n_names * sizeof *_names);
 
-	if (OMInfo.names == NULL) {
+	if (_names == NULL) {
 		warning("Error: Memory allocation failed");
 		return R_MEM;
 	}
 
 	for (i = 0; i < n_names; i++) {
 		name_offset = readS.readUint16LE();
-		OMInfo.names[i] = (const char *)(onl_res + name_offset);
+		_names[i] = (const char *)(onl_res + name_offset);
 
-		debug(3, "Loaded object name string: %s", OMInfo.names[i]);
+		debug(3, "Loaded object name string: %s", _names[i]);
 	}
 
-	OMInfo.names_loaded = 1;
+	_names_loaded = 1;
 
 	return R_SUCCESS;
 }
 
 // Frees all storage allocated for the current object name list data
-int OBJECTMAP_FreeNames() {
-	if (!OMInfo.names_loaded) {
+int ObjectMap::freeNames() {
+	if (!_names_loaded) {
 		return R_FAILURE;
 	}
 
-	if (OMInfo.n_names) {
-		free(OMInfo.names);
+	if (_n_names) {
+		free(_names);
 	}
 
-	OMInfo.names_loaded = 0;
+	_names_loaded = 0;
 	return R_SUCCESS;
 }
 
@@ -229,34 +221,34 @@
 // name list resource, the funciton sets '*name' to the descriptive string
 // corresponding to 'object' and returns R_SUCCESS. Otherwise it returns
 // R_FAILURE.
-int OBJECTMAP_GetName(int object, const char **name) {
-	if (!OMInfo.names_loaded) {
+int ObjectMap::getName(int object, const char **name) {
+	if (!_names_loaded) {
 		return R_FAILURE;
 	}
 
-	if ((object <= 0) || (object > OMInfo.n_names)) {
+	if ((object <= 0) || (object > _n_names)) {
 		return R_FAILURE;
 	}
 
-	*name = OMInfo.names[object - 1];
+	*name = _names[object - 1];
 
 	return R_SUCCESS;
 }
 
-int OBJECTMAP_GetFlags(int object, uint16 *flags) {
+int ObjectMap::getFlags(int object, uint16 *flags) {
 	int i;
 
-	if (!OMInfo.names_loaded) {
+	if (!_names_loaded) {
 		return R_FAILURE;
 	}
 
-	if ((object <= 0) || (object > OMInfo.n_names)) {
+	if ((object <= 0) || (object > _n_names)) {
 		return R_FAILURE;
 	}
 
-	for (i = 0; i < OMInfo.n_objects; i++) {
-		if (OMInfo.object_maps[i].object_num == object) {
-			*flags = OMInfo.object_maps[i].flags;
+	for (i = 0; i < _n_objects; i++) {
+		if (_object_maps[i].object_num == object) {
+			*flags = _object_maps[i].flags;
 			return R_SUCCESS;
 		}
 	}
@@ -268,22 +260,22 @@
 // name list resource, the funciton sets '*ep_num' to the entrypoint number
 // corresponding to 'object' and returns R_SUCCESS. Otherwise, it returns
 // R_FAILURE.
-int OBJECTMAP_GetEPNum(int object, int *ep_num) {
+int ObjectMap::getEPNum(int object, int *ep_num) {
 	int i;
 
-	if (!OMInfo.names_loaded) {
+	if (!_names_loaded) {
 		return R_FAILURE;
 	}
 
-	if ((object < 0) || (object > (OMInfo.n_objects + 1))) {
+	if ((object < 0) || (object > (_n_objects + 1))) {
 		return R_FAILURE;
 	}
 
-	for (i = 0; i < OMInfo.n_objects; i++) {
+	for (i = 0; i < _n_objects; i++) {
 
-		if (OMInfo.object_maps[i].object_num == object) {
+		if (_object_maps[i].object_num == object) {
 
-			*ep_num = OMInfo.object_maps[i].script_num;
+			*ep_num = _object_maps[i].script_num;
 			return R_SUCCESS;
 		}
 	}
@@ -293,7 +285,7 @@
 
 // Uses Gfx::drawLine to display all clickareas for each object in the 
 // currently loaded object map resource.
-int OBJECTMAP_Draw(R_SURFACE *ds, R_POINT *imouse_pt, int color, int color2) {
+int ObjectMap::draw(R_SURFACE *ds, R_POINT *imouse_pt, int color, int color2) {
 	R_OBJECTMAP_ENTRY *object_map;
 	R_CLICKAREA *clickarea;
 
@@ -308,47 +300,47 @@
 	int pointcount = 0;
 	int i, k;
 
-	assert(OMInfo.initialized);
+	assert(_initialized);
 
-	if (!OMInfo.objects_loaded) {
+	if (!_objects_loaded) {
 		return R_FAILURE;
 	}
 
 	if (imouse_pt != NULL) {
-		if (OBJECTMAP_HitTest(imouse_pt, &object_num) == R_SUCCESS) {
+		if (hitTest(imouse_pt, &object_num) == R_SUCCESS) {
 			hit_object = 1;
 		}
 	}
 
-	for (i = 0; i < OMInfo.n_objects; i++) {
+	for (i = 0; i < _n_objects; i++) {
 		draw_color = color;
-		if (hit_object && (object_num == OMInfo.object_maps[i].object_num)) {
+		if (hit_object && (object_num == _object_maps[i].object_num)) {
 			snprintf(txt_buf, sizeof txt_buf, "obj %d: ? %d, f %X",
-					OMInfo.object_maps[i].object_num,
-					OMInfo.object_maps[i].unknown0,
-					OMInfo.object_maps[i].flags);
+					_object_maps[i].object_num,
+					_object_maps[i].unknown0,
+					_object_maps[i].flags);
 			draw_txt = 1;
 			draw_color = color2;
 		}
 
-		object_map = &OMInfo.object_maps[i];
+		object_map = &_object_maps[i];
 
 		for (k = 0; k < object_map->n_clickareas; k++) {
 			clickarea = &object_map->clickareas[k];
 			pointcount = 0;
 			if (clickarea->n_points == 2) {
 				// 2 points represent a box
-				_vm->_gfx->drawFrame(ds, &clickarea->points[0], &clickarea->points[1], draw_color);
+				_gfx->drawFrame(ds, &clickarea->points[0], &clickarea->points[1], draw_color);
 			} else if (clickarea->n_points > 2) {
 				// Otherwise draw a polyline
-				_vm->_gfx->drawPolyLine(ds, clickarea->points, clickarea->n_points, draw_color);
+				_gfx->drawPolyLine(ds, clickarea->points, clickarea->n_points, draw_color);
 			}
 		}
 	}
 
 	if (draw_txt) {
 		FONT_Draw(SMALL_FONT_ID, ds, txt_buf, 0, 2, 2,
-				_vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
+				_gfx->getWhite(), _gfx->getBlack(), FONT_OUTLINE);
 	}
 
 	return R_SUCCESS;
@@ -379,7 +371,7 @@
 	return inside_flag;
 }
 
-int OBJECTMAP_HitTest(R_POINT * imouse_pt, int *object_num) {
+int ObjectMap::hitTest(R_POINT * imouse_pt, int *object_num) {
 	R_POINT imouse;
 	R_OBJECTMAP_ENTRY *object_map;
 	R_CLICKAREA *clickarea;
@@ -394,8 +386,8 @@
 	imouse.y = imouse_pt->y;
 
 	// Loop through all scene objects
-	for (i = 0; i < OMInfo.n_objects; i++) {
-		object_map = &OMInfo.object_maps[i];
+	for (i = 0; i < _n_objects; i++) {
+		object_map = &_object_maps[i];
 
 		// Hit-test all clickareas for this object
 		for (k = 0; k < object_map->n_clickareas; k++) {
@@ -426,28 +418,32 @@
 	return R_FAILURE;
 }
 
-static void CF_object_info(int argc, char *argv[], void *refCon) {
+void ObjectMap::objectInfo(int argc, char *argv[]) {
 	int i;
 
 	(void)(argc);
 	(void)(argv);
 
-	if (!OMInfo.initialized) {
+	if (!_initialized) {
 		return;
 	}
 
-	CON_Print("%d objects loaded.", OMInfo.n_objects);
+	CON_Print("%d objects loaded.", _n_objects);
 
-	for (i = 0; i < OMInfo.n_objects; i++) {
-		CON_Print("%s:", OMInfo.names[i]);
-		CON_Print("%d. Unk1: %d, flags: %X, name_i: %d, scr_n: %d, ca_ct: %d", i, OMInfo.object_maps[i].unknown0,
-					OMInfo.object_maps[i].flags,
-					OMInfo.object_maps[i].object_num,
-					OMInfo.object_maps[i].script_num,
-					OMInfo.object_maps[i].n_clickareas);
+	for (i = 0; i < _n_objects; i++) {
+		CON_Print("%s:", _names[i]);
+		CON_Print("%d. Unk1: %d, flags: %X, name_i: %d, scr_n: %d, ca_ct: %d", i, _object_maps[i].unknown0,
+					_object_maps[i].flags,
+					_object_maps[i].object_num,
+					_object_maps[i].script_num,
+					_object_maps[i].n_clickareas);
 	}
 
 	return;
 }
 
+static void CF_object_info(int argc, char *argv[], void *refCon) {
+	((ObjectMap *)refCon)->objectInfo(argc, argv);
+}
+
 } // End of namespace Saga

Index: objectmap.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- objectmap.h	31 Jul 2004 23:33:14 -0000	1.5
+++ objectmap.h	2 Aug 2004 15:44:18 -0000	1.6
@@ -28,6 +28,10 @@
 
 namespace Saga {
 
+enum R_OBJECT_FLAGS {
+	R_OBJECT_NORMAL = 0x02
+};
+
 struct R_CLICKAREA {
 	int n_points;
 	R_POINT *points;
@@ -44,19 +48,35 @@
 	R_CLICKAREA *clickareas;
 };
 
-struct R_OBJECTMAP_INFO {
-	int initialized;
+class Gfx;
 
-	int objects_loaded;
-	int n_objects;
-	R_OBJECTMAP_ENTRY *object_maps;
+class ObjectMap{
+public:
+	int reg(void);
+	ObjectMap(Gfx *gfx);
+	~ObjectMap(void);
+	int load(const byte *om_res, size_t om_res_len);
+	int freeMem(void);
+	int loadNames(const byte *onl_res, size_t onl_res_len);
+	int freeNames();
+	int getName(int object, const char **name);
+	int getFlags(int object, uint16 *flags);
+	int getEPNum(int object, int *ep_num);
+	int draw(R_SURFACE *draw_surface, R_POINT *imouse_pt, int color, int color2);
+	int hitTest(R_POINT *imouse_pt, int *object_num);
+	void objectInfo(int argc, char *argv[]);
+private:
+	int _initialized;
 
-	int names_loaded;
-	int n_names;
-	const char **names;
-};
+	int _objects_loaded;
+	int _n_objects;
+	R_OBJECTMAP_ENTRY *_object_maps;
 
-static void CF_object_info(int argc, char *argv[], void *refCon);
+	int _names_loaded;
+	int _n_names;
+	const char **_names;
+	Gfx *_gfx;
+};
 
 } // End of namespace Saga
 

Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- render.cpp	2 Aug 2004 12:41:40 -0000	1.21
+++ render.cpp	2 Aug 2004 15:44:18 -0000	1.22
@@ -36,7 +36,7 @@
 #include "text_mod.h"
 
 #include "actionmap.h"
-#include "objectmap_mod.h"
+#include "objectmap.h"
 
 #include "render.h"
 #include <common/timer.h>
@@ -49,10 +49,11 @@
 	return R_SUCCESS;
 }
 
-Render::Render(SagaEngine *vm, OSystem *system, Gfx *gfx) {
+Render::Render(SagaEngine *vm, OSystem *system, Gfx *gfx, ObjectMap *omap) {
 	_vm = vm;
 	_system = system;
 	_gfx = gfx;
+	_omap = omap;
 	_initialized = false;
 
 	R_GAME_DISPLAYINFO disp_info;
@@ -136,7 +137,7 @@
 
 	// Display scene maps, if applicable
 	if (getFlags() & RF_OBJECTMAP_TEST) {
-		OBJECTMAP_Draw(backbuf_surface, &mouse_pt, _gfx->getWhite(), _gfx->getBlack());
+		_omap->draw(backbuf_surface, &mouse_pt, _gfx->getWhite(), _gfx->getBlack());
 		_vm->_actionMap->draw(backbuf_surface, _gfx->matchColor(R_RGB_RED));
 	}
 

Index: render.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- render.h	1 Aug 2004 12:06:12 -0000	1.12
+++ render.h	2 Aug 2004 15:44:18 -0000	1.13
@@ -52,7 +52,7 @@
 class Render {
 public:
 	int reg(void);
-	Render(SagaEngine *vm, OSystem *system, Gfx *gfx);
+	Render(SagaEngine *vm, OSystem *system, Gfx *gfx, ObjectMap *omap);
 	~Render(void);
 	bool initialized();
 	int drawScene(void);
@@ -71,6 +71,7 @@
 	OSystem *_system;
 	bool _initialized;
 	Gfx *_gfx;
+	ObjectMap *_omap;
 
 	// Module data
 	R_SURFACE *_backbuf_surface;

Index: saga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- saga.cpp	2 Aug 2004 14:51:48 -0000	1.33
+++ saga.cpp	2 Aug 2004 15:44:18 -0000	1.34
@@ -53,7 +53,7 @@
 #include "sndres.h"
 #include "sprite_mod.h"
 #include "text_mod.h"
-#include "objectmap_mod.h"
+#include "objectmap.h"
 #include "sound.h"
 #include "music.h"
 #include "game_mod.h"
@@ -117,7 +117,6 @@
 	CON_Register(); // Register console cvars first
 
 	GAME_Register();
-	OBJECTMAP_Register();
 	ACTOR_Register();
 	SCENE_Register();
 
@@ -154,7 +153,6 @@
 	FONT_Init();
 	SPRITE_Init();
 	_anim = new Anim(this);
-	OBJECTMAP_Init();
 	_script = new Script();
 	_sdata = new SData();
 	INTERFACE_Init(); // requires script module
@@ -190,14 +188,15 @@
 	GAME_GetDisplayInfo(&disp_info);
 	_gfx = new Gfx(_system, disp_info.logical_w, disp_info.logical_h);
 
-	_render = new Render(this, _system, _gfx);
+	_isoMap = new IsoMap(_gfx);
+	_actionMap = new ActionMap(this);
+	_objectMap = new ObjectMap(_gfx);
+	
+	_render = new Render(this, _system, _gfx, _objectMap);
 	if (!_render->initialized()) {
 		return;
 	}
 
-	_isomap = new IsoMap(_gfx);
-	_actionMap = new ActionMap(this);
-
 	// Initialize system specific sound
 	_sound = new Sound(this, _mixer, MainData.sound_enabled);
 	if (!MainData.sound_enabled) {
@@ -208,6 +207,7 @@
 	_render->reg();
 	_anim->reg();
 	_actionMap->reg();
+	_objectMap->reg();
 
 	_previousTicks = _system->get_msecs();
 
@@ -247,7 +247,6 @@
 	ACTOR_Shutdown();
 	delete _script;
 	SPRITE_Shutdown();
-	OBJECTMAP_Shutdown();
 	FONT_Shutdown();
 	CON_Shutdown();
 	CVAR_Shutdown();
@@ -255,6 +254,8 @@
 
 	delete _render;
 	delete _actionMap;
+	delete _isoMap;
+	delete _objectMap;
 	delete _sndRes;
 	delete _sdata;
 	// Shutdown system modules */

Index: saga.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- saga.h	2 Aug 2004 14:51:48 -0000	1.24
+++ saga.h	2 Aug 2004 15:44:18 -0000	1.25
@@ -44,6 +44,7 @@
 class Render;
 class ActionMap;
 class IsoMap;
+class ObjectMap;
 class Gfx;
 class SData;
 class Script;
@@ -95,7 +96,8 @@
 	Anim *_anim;
 	Render *_render;
 	ActionMap *_actionMap;
-	IsoMap *_isomap;
+	IsoMap *_isoMap;
+	ObjectMap *_objectMap;
 	Gfx *_gfx;
 	SData *_sdata;
 	Script *_script;

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- scene.cpp	2 Aug 2004 14:51:48 -0000	1.22
+++ scene.cpp	2 Aug 2004 15:44:18 -0000	1.23
@@ -34,7 +34,7 @@
 #include "actionmap.h"
 #include "isomap.h"
 #include "script_mod.h"
-#include "objectmap_mod.h"
+#include "objectmap.h"
 #include "palanim_mod.h"
 #include "render.h"
 #include "rscfile_mod.h"
@@ -611,11 +611,11 @@
 			break;
 		case SAGA_OBJECT_NAME_LIST:
 			debug(0, "Loading object name list resource...");
-			OBJECTMAP_LoadNames(SceneModule.reslist[i].res_data, SceneModule.reslist[i].res_data_len);
+			_vm->_objectMap->loadNames(SceneModule.reslist[i].res_data, SceneModule.reslist[i].res_data_len);
 			break;
 		case SAGA_OBJECT_MAP:
 			debug(0, "Loading object map resource...");
-			if (OBJECTMAP_Load(res_data,
+			if (_vm->_objectMap->load(res_data,
 				res_data_len) != R_SUCCESS) {
 				warning("Error loading object map resource");
 				return R_FAILURE;
@@ -636,7 +636,7 @@
 
 			debug(0, "Loading isometric tileset resource.");
 
-			if (_vm->_isomap->loadTileset(res_data, res_data_len) != R_SUCCESS) {
+			if (_vm->_isoMap->loadTileset(res_data, res_data_len) != R_SUCCESS) {
 				warning("ProcessSceneResources: Error loading isometric tileset resource");
 				return R_FAILURE;
 			}
@@ -651,7 +651,7 @@
 
 			debug(0, "Loading isometric metamap resource.");
 
-			if (_vm->_isomap->loadMetamap(res_data, res_data_len) != R_SUCCESS) {
+			if (_vm->_isoMap->loadMetamap(res_data, res_data_len) != R_SUCCESS) {
 				warning("ProcessSceneResources: Error loading isometric metamap resource");
 				return R_FAILURE;
 			}
@@ -666,7 +666,7 @@
 
 			debug(0, "Loading isometric metatileset resource.");
 
-			if (_vm->_isomap->loadMetaTileset(res_data, res_data_len) != R_SUCCESS) {
+			if (_vm->_isoMap->loadMetaTileset(res_data, res_data_len) != R_SUCCESS) {
 				warning("ProcessSceneResources: Error loading isometric tileset resource");
 				return R_FAILURE;
 			}
@@ -736,7 +736,7 @@
 						MAX(disp_info.scene_h, SceneModule.bg.h), NULL, &bg_pt);
 		break;
 	case R_SCENE_MODE_ISO:
-		_vm->_isomap->draw(dst_s);
+		_vm->_isoMap->draw(dst_s);
 		break;
 	default:
 		// Unknown scene mode
@@ -789,7 +789,7 @@
 	_vm->_anim->reset();
 
 	PALANIM_Free();
-	OBJECTMAP_Free();
+	_vm->_objectMap->freeMem();
 	_vm->_actionMap->freeMap();
 
 	ys_dll_destroy(SceneModule.anim_list);

--- objectmap_mod.h DELETED ---





More information about the Scummvm-git-logs mailing list