[Scummvm-cvs-logs] CVS: scummvm/saga interface.cpp,1.24,1.25 objectmap.cpp,1.20,1.21 objectmap.h,1.8,1.9 render.cpp,1.33,1.34 render.h,1.14,1.15 saga.cpp,1.51,1.52 saga.h,1.39,1.40 scene.cpp,1.41,1.42 scene.h,1.12,1.13

Eugene Sandulenko sev at users.sourceforge.net
Thu Oct 7 16:04:35 CEST 2004


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

Modified Files:
	interface.cpp objectmap.cpp objectmap.h render.cpp render.h 
	saga.cpp saga.h scene.cpp scene.h 
Log Message:
Turn ObjectMap into real object.


Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- interface.cpp	5 Oct 2004 02:16:26 -0000	1.24
+++ interface.cpp	7 Oct 2004 23:02:19 -0000	1.25
@@ -484,7 +484,7 @@
 	int script_num;
 	Point iactor_pt;
 
-	hit_object = _vm->_objectMap->hitTest(imouse_pt, &object_num);
+	hit_object = _vm->_scene->_objectMap->hitTest(imouse_pt, &object_num);
 
 	if (hit_object != R_SUCCESS) {
 		// Player clicked on empty spot - walk here regardless of verb
@@ -493,10 +493,10 @@
 		return R_SUCCESS;
 	}
 
-	object_flags = _vm->_objectMap->getFlags(object_num);
+	object_flags = _vm->_scene->_objectMap->getFlags(object_num);
 
 	if (object_flags & R_OBJECT_NORMAL) {
-		if ((script_num = _vm->_objectMap->getEPNum(object_num)) != -1) {
+		if ((script_num = _vm->_scene->_objectMap->getEPNum(object_num)) != -1) {
 			// Set active verb in script module
 			_vm->_sdata->putWord(4, 4, I_VerbData[_activeVerb].s_verb);
 
@@ -525,7 +525,7 @@
 
 	new_status[0] = 0;
 
-	hit_object = _vm->_objectMap->hitTest(imouse_pt, &object_num);
+	hit_object = _vm->_scene->_objectMap->hitTest(imouse_pt, &object_num);
 
 	if (hit_object != R_SUCCESS) {
 		// Cursor over nothing - just display current verb
@@ -533,9 +533,9 @@
 		return R_SUCCESS;
 	}
 
-	object_flags = _vm->_objectMap->getFlags(object_num);
+	object_flags = _vm->_scene->_objectMap->getFlags(object_num);
 
-	object_name = _vm->_objectMap->getName(object_num);
+	object_name = _vm->_scene->_objectMap->getName(object_num);
 
 	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.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- objectmap.cpp	5 Oct 2004 02:16:26 -0000	1.20
+++ objectmap.cpp	7 Oct 2004 23:02:19 -0000	1.21
@@ -36,33 +36,16 @@
 
 namespace Saga {
 
-static void CF_object_info(int argc, char *argv[], void *refCon);
-
-int ObjectMap::reg() {
-	CVAR_RegisterFunc(CF_object_info, "object_info", NULL, R_CVAR_NONE, 0, 0, this);
-
-	return R_SUCCESS;
-}
-
 // Initializes the object map module, creates module allocation context
-ObjectMap::ObjectMap(Gfx *gfx) {
-	debug(0, "ObjectMap Module: Initializing...");
-	_gfx = gfx;
-	_initialized = 1;
-	_objects_loaded = 0;
-	_names_loaded = 0;
+ObjectMap::ObjectMap(SagaEngine *vm) : _vm(vm) {
+	_objectsLoaded = false;
+	_namesLoaded = false;
 }
 
 // Shuts down the object map module, destroys module allocation context
 ObjectMap::~ObjectMap() {
-	debug(0, "ObjectMap Module: Shutting down...");
-
 	freeMem();
 	freeNames();
-
-	debug(0, "ObjectMap Module: Shutdown OK.");
-
-	_initialized = 0;
 }
 
 // Loads an object map resource ( objects ( clickareas ( points ) ) ) 
@@ -75,35 +58,30 @@
 
 	MemoryReadStream readS(om_res, om_res_len);
 
-	if (!_initialized) {
-		warning("Error: Object map module not initialized");
-		return R_FAILURE;
-	}
-
-	if (_objects_loaded) {
+	if (_objectsLoaded) {
 		freeMem();
 	}
 
 	// Obtain object count N and allocate space for N objects
-	_n_objects = readS.readUint16LE();
+	_nObjects = readS.readUint16LE();
 
-	_object_maps = (R_OBJECTMAP_ENTRY *)malloc(_n_objects * sizeof *_object_maps);
+	_objectMaps = (R_OBJECTMAP_ENTRY *)malloc(_nObjects * sizeof *_objectMaps);
 
-	if (_object_maps == NULL) {
+	if (_objectMaps == NULL) {
 		warning("Error: Memory allocation failed");
 		return R_MEM;
 	}
 
 	// Load all N objects
-	for (i = 0; i < _n_objects; i++) {
-		object_map = &_object_maps[i];
+	for (i = 0; i < _nObjects; i++) {
+		object_map = &_objectMaps[i];
 		object_map->flags = readS.readByte();
-		object_map->n_clickareas = readS.readByte();
+		object_map->nClickareas = readS.readByte();
 		object_map->defaultVerb = readS.readByte();
 		readS.readByte();
-		object_map->object_num = readS.readUint16LE();
-		object_map->script_num = readS.readUint16LE();
-		object_map->clickareas = (R_CLICKAREA *)malloc(object_map->n_clickareas * sizeof *(object_map->clickareas));
+		object_map->objectNum = readS.readUint16LE();
+		object_map->scriptNum = readS.readUint16LE();
+		object_map->clickareas = (R_CLICKAREA *)malloc(object_map->nClickareas * sizeof *(object_map->clickareas));
 
 		if (object_map->clickareas == NULL) {
 			warning("Error: Memory allocation failed");
@@ -111,7 +89,7 @@
 		}
 
 		// Load all clickareas for this object
-		for (k = 0; k < object_map->n_clickareas; k++) {
+		for (k = 0; k < object_map->nClickareas; k++) {
 			clickarea = &object_map->clickareas[k];
 			clickarea->n_points = readS.readUint16LE();
 			assert(clickarea->n_points != 0);
@@ -129,11 +107,11 @@
 				point->y = readS.readSint16LE();
 			}
 			debug(2, "ObjectMap::load(): Read %d points for clickarea %d in object %d.",
-					clickarea->n_points, k, object_map->object_num);
+					clickarea->n_points, k, object_map->objectNum);
 		}
 	}
 
-	_objects_loaded = 1;
+	_objectsLoaded = true;
 
 	return R_SUCCESS;
 }
@@ -145,24 +123,24 @@
 
 	int i, k;
 
-	if (!_objects_loaded) {
+	if (!_objectsLoaded) {
 		return R_FAILURE;
 	}
 
-	for (i = 0; i < _n_objects; i++) {
-		object_map = &_object_maps[i];
-		for (k = 0; k < object_map->n_clickareas; k++) {
+	for (i = 0; i < _nObjects; i++) {
+		object_map = &_objectMaps[i];
+		for (k = 0; k < object_map->nClickareas; k++) {
 			clickarea = &object_map->clickareas[k];
 			free(clickarea->points);
 		}
 		free(object_map->clickareas);
 	}
 
-	if (_n_objects) {
-		free(_object_maps);
+	if (_nObjects) {
+		free(_objectMaps);
 	}
 
-	_objects_loaded = 0;
+	_objectsLoaded = false;
 
 	return R_SUCCESS;
 }
@@ -177,14 +155,14 @@
 
 	MemoryReadStream readS(onl_res, onl_res_len);
 
-	if (_names_loaded) {
+	if (_namesLoaded) {
 		freeNames();
 	}
 
 	table_len = readS.readUint16LE();
 
 	n_names = table_len / 2 - 2;
-	_n_names = n_names;
+	_nNames = n_names;
 
 	debug(2, "ObjectMap::loadNames: Loading %d object names.", n_names);
 	_names = (const char **)malloc(n_names * sizeof *_names);
@@ -201,22 +179,22 @@
 		debug(3, "Loaded object name string: %s", _names[i]);
 	}
 
-	_names_loaded = 1;
+	_namesLoaded = true;
 
 	return R_SUCCESS;
 }
 
 // Frees all storage allocated for the current object name list data
 int ObjectMap::freeNames() {
-	if (!_names_loaded) {
+	if (!_namesLoaded) {
 		return R_FAILURE;
 	}
 
-	if (_n_names) {
+	if (_nNames) {
 		free(_names);
 	}
 
-	_names_loaded = 0;
+	_namesLoaded = false;
 	return R_SUCCESS;
 }
 
@@ -225,8 +203,8 @@
 // corresponding to 'object' and returns R_SUCCESS. Otherwise it returns
 // R_FAILURE.
 const char *ObjectMap::getName(int object) {
-	assert(_names_loaded);
-	assert((object > 0) && (object <= _n_names));
+	assert(_namesLoaded);
+	assert((object > 0) && (object <= _nNames));
 
 	return _names[object - 1];
 }
@@ -234,12 +212,12 @@
 const uint16 ObjectMap::getFlags(int object) {
 	int i;
 
-	assert(_names_loaded);
-	assert((object > 0) && (object <= _n_names));
+	assert(_namesLoaded);
+	assert((object > 0) && (object <= _nNames));
 
-	for (i = 0; i < _n_objects; i++) {
-		if (_object_maps[i].object_num == object) {
-			return _object_maps[i].flags;
+	for (i = 0; i < _nObjects; i++) {
+		if (_objectMaps[i].objectNum == object) {
+			return _objectMaps[i].flags;
 		}
 	}
 
@@ -253,14 +231,14 @@
 const int ObjectMap::getEPNum(int object) {
 	int i;
 
-	assert(_names_loaded);
+	assert(_namesLoaded);
 
-	if ((object < 0) || (object > (_n_objects + 1)))
+	if ((object < 0) || (object > (_nObjects + 1)))
 		return -1;
 
-	for (i = 0; i < _n_objects; i++)
-		if (_object_maps[i].object_num == object)
-			return _object_maps[i].script_num;
+	for (i = 0; i < _nObjects; i++)
+		if (_objectMaps[i].objectNum == object)
+			return _objectMaps[i].scriptNum;
 
 	return -1;
 }
@@ -277,52 +255,50 @@
 	int draw_txt = 0;
 
 	int hit_object = 0;
-	int object_num = 0;
+	int objectNum = 0;
 
 	int pointcount = 0;
 	int i, k;
 
-	assert(_initialized);
-
-	if (!_objects_loaded) {
+	if (!_objectsLoaded) {
 		return R_FAILURE;
 	}
 
 	if (imouse_pt != NULL) {
-		if (hitTest(imouse_pt, &object_num) == R_SUCCESS) {
+		if (hitTest(imouse_pt, &objectNum) == R_SUCCESS) {
 			hit_object = 1;
 		}
 	}
 
-	for (i = 0; i < _n_objects; i++) {
+	for (i = 0; i < _nObjects; i++) {
 		draw_color = color;
-		if (hit_object && (object_num == _object_maps[i].object_num)) {
+		if (hit_object && (objectNum == _objectMaps[i].objectNum)) {
 			snprintf(txt_buf, sizeof txt_buf, "obj %d: v %d, f %X",
-					_object_maps[i].object_num,
-					_object_maps[i].defaultVerb,
-					_object_maps[i].flags);
+					_objectMaps[i].objectNum,
+					_objectMaps[i].defaultVerb,
+					_objectMaps[i].flags);
 			draw_txt = 1;
 			draw_color = color2;
 		}
 
-		object_map = &_object_maps[i];
+		object_map = &_objectMaps[i];
 
-		for (k = 0; k < object_map->n_clickareas; k++) {
+		for (k = 0; k < object_map->nClickareas; k++) {
 			clickarea = &object_map->clickareas[k];
 			pointcount = 0;
 			if (clickarea->n_points == 2) {
 				// 2 points represent a box
-				_gfx->drawFrame(ds, &clickarea->points[0], &clickarea->points[1], draw_color);
+				_vm->_gfx->drawFrame(ds, &clickarea->points[0], &clickarea->points[1], draw_color);
 			} else if (clickarea->n_points > 2) {
 				// Otherwise draw a polyline
-				_gfx->drawPolyLine(ds, clickarea->points, clickarea->n_points, draw_color);
+				_vm->_gfx->drawPolyLine(ds, clickarea->points, clickarea->n_points, draw_color);
 			}
 		}
 	}
 
 	if (draw_txt) {
 		_vm->_font->draw(SMALL_FONT_ID, ds, txt_buf, 0, 2, 2,
-				_gfx->getWhite(), _gfx->getBlack(), FONT_OUTLINE);
+				_vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
 	}
 
 	return R_SUCCESS;
@@ -353,7 +329,7 @@
 	return inside_flag;
 }
 
-int ObjectMap::hitTest(Point * imouse_pt, int *object_num) {
+int ObjectMap::hitTest(Point *imouse_pt, int *objectNum) {
 	Point imouse;
 	R_OBJECTMAP_ENTRY *object_map;
 	R_CLICKAREA *clickarea;
@@ -362,17 +338,17 @@
 
 	int i, k;
 
-	assert((imouse_pt != NULL) && (object_num != NULL));
+	assert((imouse_pt != NULL) && (objectNum != NULL));
 
 	imouse.x = imouse_pt->x;
 	imouse.y = imouse_pt->y;
 
 	// Loop through all scene objects
-	for (i = 0; i < _n_objects; i++) {
-		object_map = &_object_maps[i];
+	for (i = 0; i < _nObjects; i++) {
+		object_map = &_objectMaps[i];
 
 		// Hit-test all clickareas for this object
-		for (k = 0; k < object_map->n_clickareas; k++) {
+		for (k = 0; k < object_map->nClickareas; k++) {
 			clickarea = &object_map->clickareas[k];
 			n_points = clickarea->n_points;
 			points = clickarea->points;
@@ -382,51 +358,40 @@
 				if ((imouse.x > points[0].x) && (imouse.x <= points[1].x) &&
 					(imouse.y > points[0].y) &&
 					(imouse.y <= points[1].y)) {
-						*object_num = object_map->object_num;
+						*objectNum = object_map->objectNum;
 						return R_SUCCESS;
 				}
 			} else if (n_points > 2) {
 				// Hit-test a polygon
 				if (MATH_HitTestPoly(points, n_points, imouse)) {
-					*object_num = object_map->object_num;
+					*objectNum = object_map->objectNum;
 					return R_SUCCESS;
 				}
 			}
 		}
 	}
 
-	*object_num = 0;
+	*objectNum = 0;
 
 	return R_FAILURE;
 }
 
-void ObjectMap::objectInfo(int argc, char *argv[]) {
+void ObjectMap::info(void) {
 	int i;
 
-	(void)(argc);
-	(void)(argv);
-
-	if (!_initialized) {
-		return;
-	}
-
-	_vm->_console->print("%d objects loaded.", _n_objects);
+	_vm->_console->print("%d objects loaded.", _nObjects);
 
-	for (i = 0; i < _n_objects; i++) {
+	for (i = 0; i < _nObjects; i++) {
 		_vm->_console->print("%s:", _names[i]);
 		_vm->_console->print("%d. verb: %d, flags: %X, name_i: %d, scr_n: %d, ca_ct: %d", i, 
-					_object_maps[i].defaultVerb,
-					_object_maps[i].flags,
-					_object_maps[i].object_num,
-					_object_maps[i].script_num,
-					_object_maps[i].n_clickareas);
+					_objectMaps[i].defaultVerb,
+					_objectMaps[i].flags,
+					_objectMaps[i].objectNum,
+					_objectMaps[i].scriptNum,
+					_objectMaps[i].nClickareas);
 	}
 
 	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.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- objectmap.h	5 Oct 2004 02:16:26 -0000	1.8
+++ objectmap.h	7 Oct 2004 23:02:19 -0000	1.9
@@ -42,10 +42,10 @@
 	byte flags;
 	byte defaultVerb;
 
-	int object_num;
-	int script_num;
+	int objectNum;
+	int scriptNum;
 
-	int n_clickareas;
+	int nClickareas;
 	R_CLICKAREA *clickareas;
 };
 
@@ -54,7 +54,7 @@
 class ObjectMap{
 public:
 	int reg(void);
-	ObjectMap(Gfx *gfx);
+	ObjectMap(SagaEngine *vm);
 	~ObjectMap(void);
 	int load(const byte *om_res, size_t om_res_len);
 	int freeMem(void);
@@ -63,20 +63,20 @@
 	const char *getName(int object);
 	const uint16 getFlags(int object);
 	const int getEPNum(int object);
-	int draw(R_SURFACE *draw_surface, Point *imouse_pt, int color, int color2);
+	int draw(R_SURFACE *draw_surface, Point *imousePt, int color, int color2);
 	int hitTest(Point *imouse_pt, int *object_num);
-	void objectInfo(int argc, char *argv[]);
+	void info(void);
+
 private:
-	int _initialized;
 
-	int _objects_loaded;
-	int _n_objects;
-	R_OBJECTMAP_ENTRY *_object_maps;
+	bool _objectsLoaded;
+	int _nObjects;
+	R_OBJECTMAP_ENTRY *_objectMaps;
 
-	int _names_loaded;
-	int _n_names;
+	bool _namesLoaded;
+	int _nNames;
 	const char **_names;
-	Gfx *_gfx;
+	SagaEngine *_vm;
 };
 
 } // End of namespace Saga

Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- render.cpp	7 Oct 2004 22:31:39 -0000	1.33
+++ render.cpp	7 Oct 2004 23:02:19 -0000	1.34
@@ -34,6 +34,7 @@
 #include "saga/scene.h"
 #include "saga/text.h"
 
+#include "saga/actionmap.h"
 #include "saga/objectmap.h"
 
 #include "saga/render.h"
@@ -47,11 +48,9 @@
 	return R_SUCCESS;
 }
 
-Render::Render(SagaEngine *vm, OSystem *system, Gfx *gfx, ObjectMap *omap) {
+Render::Render(SagaEngine *vm, OSystem *system) {
 	_vm = vm;
 	_system = system;
-	_gfx = gfx;
-	_omap = omap;
 	_initialized = false;
 
 	R_GAME_DISPLAYINFO disp_info;
@@ -87,7 +86,7 @@
 	_tmp_buf_w = tmp_w;
 	_tmp_buf_h = tmp_h;
 
-	_backbuf_surface = _gfx->getBackBuffer();
+	_backbuf_surface = _vm->_gfx->getBackBuffer();
 	_flags = 0;
 
 	_initialized = true;
@@ -135,8 +134,8 @@
 
 	// Display scene maps, if applicable
 	if (getFlags() & RF_OBJECTMAP_TEST) {
-		_omap->draw(backbuf_surface, &mouse_pt, _gfx->getWhite(), _gfx->getBlack());
-		_vm->_scene->drawActionMap(backbuf_surface, _gfx->matchColor(R_RGB_RED));
+		_vm->_scene->_objectMap->draw(backbuf_surface, &mouse_pt, _vm->_gfx->getWhite(), _vm->_gfx->getBlack());
+		_vm->_scene->_actionMap->draw(backbuf_surface, _vm->_gfx->matchColor(R_RGB_RED));
 	}
 
 	// Draw queued actors
@@ -155,7 +154,7 @@
 		sprintf(txt_buf, "%d", _fps);
 		fps_width = _vm->_font->getStringWidth(SMALL_FONT_ID, txt_buf, 0, FONT_NORMAL);
 		_vm->_font->draw(SMALL_FONT_ID, backbuf_surface, txt_buf, 0, backbuf_surface->buf_w - fps_width, 2,
-					_gfx->getWhite(), _gfx->getBlack(), FONT_OUTLINE);
+					_vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
 	}
 
 	// Display "paused game" message, if applicable
@@ -163,7 +162,7 @@
 		int msg_len = strlen(R_PAUSEGAME_MSG);
 		int msg_w = _vm->_font->getStringWidth(BIG_FONT_ID, R_PAUSEGAME_MSG, msg_len, FONT_OUTLINE);
 		_vm->_font->draw(BIG_FONT_ID, backbuf_surface, R_PAUSEGAME_MSG, msg_len,
-				(backbuf_surface->buf_w - msg_w) / 2, 90, _gfx->getWhite(), _gfx->getBlack(), FONT_OUTLINE);
+				(backbuf_surface->buf_w - msg_w) / 2, 90, _vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE);
 	}
 
 	// Update user interface
@@ -173,12 +172,12 @@
 	// Display text formatting test, if applicable
 	if (_flags & RF_TEXT_TEST) {
 		_vm->textDraw(MEDIUM_FONT_ID, backbuf_surface, test_txt, mouse_pt.x, mouse_pt.y,
-				_gfx->getWhite(), _gfx->getBlack(), FONT_OUTLINE | FONT_CENTERED);
+				_vm->_gfx->getWhite(), _vm->_gfx->getBlack(), FONT_OUTLINE | FONT_CENTERED);
 	}
 
 	// Display palette test, if applicable
 	if (_flags & RF_PALETTE_TEST) {
-		_gfx->drawPalette(backbuf_surface);
+		_vm->_gfx->drawPalette(backbuf_surface);
 	}
 
 	// Draw console

Index: render.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- render.h	3 Aug 2004 01:07:34 -0000	1.14
+++ render.h	7 Oct 2004 23:02:19 -0000	1.15
@@ -52,7 +52,7 @@
 class Render {
 public:
 	int reg(void);
-	Render(SagaEngine *vm, OSystem *system, Gfx *gfx, ObjectMap *omap);
+	Render(SagaEngine *vm, OSystem *system);
 	~Render(void);
 	bool initialized();
 	int drawScene(void);
@@ -70,8 +70,6 @@
 	SagaEngine *_vm;
 	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.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- saga.cpp	7 Oct 2004 22:31:39 -0000	1.51
+++ saga.cpp	7 Oct 2004 23:02:19 -0000	1.52
@@ -50,7 +50,6 @@
 #include "saga/sdata.h"
 #include "saga/sndres.h"
 #include "saga/sprite.h"
-#include "saga/objectmap.h"
 #include "saga/sound.h"
 #include "saga/music.h"
 #include "saga/game_mod.h"
@@ -184,9 +183,8 @@
 	_gfx = new Gfx(_system, disp_info.logical_w, disp_info.logical_h);
 
 	_isoMap = new IsoMap(_gfx);
-	_objectMap = new ObjectMap(_gfx);
 	
-	_render = new Render(this, _system, _gfx, _objectMap);
+	_render = new Render(this, _system);
 	if (!_render->initialized()) {
 		return;
 	}
@@ -205,7 +203,6 @@
 	_script->reg();
 	_render->reg();
 	_anim->reg();
-	_objectMap->reg();
 
 	_previousTicks = _system->getMillis();
 
@@ -254,7 +251,6 @@
 	delete _interface;
 	delete _render;
 	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.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- saga.h	7 Oct 2004 22:31:39 -0000	1.39
+++ saga.h	7 Oct 2004 23:02:19 -0000	1.40
@@ -46,7 +46,6 @@
 class Anim;
 class Render;
 class IsoMap;
-class ObjectMap;
 class Gfx;
 class SData;
 class Script;
@@ -100,7 +99,6 @@
 	Anim *_anim;
 	Render *_render;
 	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.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- scene.cpp	7 Oct 2004 22:31:39 -0000	1.41
+++ scene.cpp	7 Oct 2004 23:02:19 -0000	1.42
@@ -49,6 +49,7 @@
 static void CF_scenechange(int argc, char *argv[], void *refCon);
 static void CF_sceneinfo(int argc, char *argv[], void *refCon);
 static void CF_actioninfo(int argc, char *argv[], void *refCon);
+static void CF_objectinfo(int argc, char *argv[], void *refCon);
 
 
 int Scene::reg() {
@@ -57,6 +58,7 @@
 	CVAR_RegisterFunc(CF_sceneinfo, "scene_info", NULL, R_CVAR_NONE, 0, 0, this);
 	CVAR_RegisterFunc(CF_actioninfo,
 					  "action_info", NULL, R_CVAR_NONE, 0, 0, this);
+	CVAR_RegisterFunc(CF_objectinfo, "object_info", NULL, R_CVAR_NONE, 0, 0, this);
 
 	return R_SUCCESS;
 }
@@ -627,6 +629,8 @@
 	const byte *pal_p;
 	int i;
 
+	_objectMap = new ObjectMap(_vm);
+
 	// Process the scene resource list
 	for (i = 0; i < _resListEntries; i++) {
 		res_data = _resList[i].res_data;
@@ -670,11 +674,11 @@
 			break;
 		case SAGA_OBJECT_NAME_LIST:
 			debug(0, "Loading object name list resource...");
-			_vm->_objectMap->loadNames(_resList[i].res_data, _resList[i].res_data_len);
+			_objectMap->loadNames(_resList[i].res_data, _resList[i].res_data_len);
 			break;
 		case SAGA_OBJECT_MAP:
 			debug(0, "Loading object map resource...");
-			if (_vm->_objectMap->load(res_data,
+			if (_objectMap->load(res_data,
 				res_data_len) != R_SUCCESS) {
 				warning("Scene::ProcessSceneResources(): Error loading object map resource");
 				return R_FAILURE;
@@ -851,7 +855,7 @@
 	_vm->_anim->reset();
 
 	_vm->_palanim->freePalAnim();
-	_vm->_objectMap->freeMem();
+	delete _objectMap;
 	delete _actionMap;
 
 	ys_dll_destroy(_animList);
@@ -924,6 +928,14 @@
 	((Scene *)refCon)->_actionMap->info();
 }
 
+static void CF_objectinfo(int argc, char *argv[], void *refCon) {
+	(void)(argc);
+	(void)(argv);
+
+	((Scene *)refCon)->_objectMap->info();
+}
+
+
 int Scene::defaultScene(int param, R_SCENE_INFO *scene_info) {
 	R_EVENT event;
 

Index: scene.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- scene.h	7 Oct 2004 22:31:39 -0000	1.12
+++ scene.h	7 Oct 2004 23:02:19 -0000	1.13
@@ -27,10 +27,12 @@
 #define SAGA_SCENE_H
 
 #include "saga/text.h"
-#include "saga/actionmap.h"
 
 namespace Saga {
 
+class ActionMap;
+class ObjectMap;
+
 enum R_SCENE_MODES {
 	R_SCENE_MODE_INVALID,
 	R_SCENE_MODE_NORMAL,
@@ -236,8 +238,6 @@
 	void sceneInfoCmd(int argc, char *argv[]);
 	void sceneChangeCmd(int argc, char *argv[]);
 
-	void drawActionMap(R_SURFACE *ds, int color) { _actionMap->draw(ds, color); }
-
  private:
 	int loadScene(int scene, int load_flag, R_SCENE_PROC scene_proc, R_SCENE_DESC *, 
 				  int fadeIn);
@@ -276,6 +276,7 @@
 
  public:
 	ActionMap *_actionMap;
+	ObjectMap *_objectMap;
 
  private:
 	int IHNMStartProc();





More information about the Scummvm-git-logs mailing list