[Scummvm-cvs-logs] CVS: scummvm/saga actionmap.cpp,1.9,1.10 actionmap.h,1.5,1.6 render.cpp,1.15,1.16 render.h,1.9,1.10 saga.cpp,1.24,1.25 saga.h,1.17,1.18 scene.cpp,1.14,1.15 actionmap_mod.h,1.3,NONE

Eugene Sandulenko sev at users.sourceforge.net
Sat Jul 31 17:04:01 CEST 2004


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

Modified Files:
	actionmap.cpp actionmap.h render.cpp render.h saga.cpp saga.h 
	scene.cpp 
Removed Files:
	actionmap_mod.h 
Log Message:
Objectize actionmap.cpp


Index: actionmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actionmap.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- actionmap.cpp	31 Jul 2004 23:33:14 -0000	1.9
+++ actionmap.cpp	1 Aug 2004 00:03:45 -0000	1.10
@@ -29,25 +29,24 @@
 #include "console_mod.h"
 #include "gfx_mod.h"
 
-#include "actionmap_mod.h"
 #include "actionmap.h"
 
 namespace Saga {
-static R_ACTIONMAP_INFO ActmapModule;
 
-int ACTIONMAP_Register(void) {
+static void CF_action_info(int argc, char *argv[], void *refCon);
+
+int ActionMap::reg(void) {
 	CVAR_RegisterFunc(CF_action_info,
-					  "action_info", NULL, R_CVAR_NONE, 0, 0, NULL);
+					  "action_info", NULL, R_CVAR_NONE, 0, 0, this);
 	return R_SUCCESS;
 }
 
-int ACTIONMAP_Init(void) {
+ActionMap::ActionMap(void) {
 	debug(0, "ACTIONMAP Module: Initializing...");
-	ActmapModule.init = 1;
-	return R_SUCCESS;
+	_initialized = true;
 }
 
-int ACTIONMAP_Load(const byte * exmap_res, size_t exmap_res_len) {
+int ActionMap::load(const byte * exmap_res, size_t exmap_res_len) {
 	// Loads exit map data from specified exit map resource
 	R_ACTIONMAP_ENTRY *exmap_entry;
 	R_POINT *exmap_pt_tbl;
@@ -55,7 +54,7 @@
 	int exit_ct;
 	int i, pt;
 
-	assert(ActmapModule.init);
+	assert(_initialized);
 	assert(exmap_res != NULL);
 
 	MemoryReadStream *readS = new MemoryReadStream(exmap_res, exmap_res_len);
@@ -98,68 +97,68 @@
 		exmap_entry[i].pt_tbl = exmap_pt_tbl;
 	}
 
-	ActmapModule.exits_loaded = 1;
-	ActmapModule.n_exits = exit_ct;
-	ActmapModule.exits_tbl = exmap_entry;
+	_exits_loaded = 1;
+	_n_exits = exit_ct;
+	_exits_tbl = exmap_entry;
 
-	ActmapModule.exmap_res = exmap_res;
-	ActmapModule.exmap_res_len = exmap_res_len;
+	_exmap_res = exmap_res;
+	_exmap_res_len = exmap_res_len;
 
 	return R_SUCCESS;
 }
 
-int ACTIONMAP_Free(void) {
+int ActionMap::freeMap(void) {
 	// Frees the currently loaded exit map data
 	R_ACTIONMAP_ENTRY *exmap_entry;
 	int i;
 
-	if (!ActmapModule.exits_loaded) {
+	if (!_exits_loaded) {
 		return R_SUCCESS;
 	}
 
-	for (i = 0; i < ActmapModule.n_exits; i++) {
-		exmap_entry = &ActmapModule.exits_tbl[i];
+	for (i = 0; i < _n_exits; i++) {
+		exmap_entry = &_exits_tbl[i];
 
 		free(exmap_entry->pt_tbl);
 	}
 
-	free(ActmapModule.exits_tbl);
+	free(_exits_tbl);
 
-	ActmapModule.exits_loaded = 0;
-	ActmapModule.exits_tbl = NULL;
-	ActmapModule.n_exits = 0;
+	_exits_loaded = 0;
+	_exits_tbl = NULL;
+	_n_exits = 0;
 
 	return R_SUCCESS;
 }
 
-int ACTIONMAP_Shutdown(void) {
+int ActionMap::shutdown(void) {
 	return R_SUCCESS;
 }
 
-int ACTIONMAP_Draw(R_SURFACE * ds, int color) {
+int ActionMap::draw(R_SURFACE * ds, int color) {
 	int i;
 
-	assert(ActmapModule.init);
+	assert(_initialized);
 
-	if (!ActmapModule.exits_loaded) {
+	if (!_exits_loaded) {
 		return R_FAILURE;
 	}
 
-	for (i = 0; i < ActmapModule.n_exits; i++) {
-		if (ActmapModule.exits_tbl[i].pt_count == 2) {
+	for (i = 0; i < _n_exits; i++) {
+		if (_exits_tbl[i].pt_count == 2) {
 			GFX_DrawFrame(ds,
-				&ActmapModule.exits_tbl[i].pt_tbl[0],
-				&ActmapModule.exits_tbl[i].pt_tbl[1], color);
-		} else if (ActmapModule.exits_tbl[i].pt_count > 2) {
-			GFX_DrawPolyLine(ds, ActmapModule.exits_tbl[i].pt_tbl,
-							 ActmapModule.exits_tbl[i].pt_count, color);
+				&_exits_tbl[i].pt_tbl[0],
+				&_exits_tbl[i].pt_tbl[1], color);
+		} else if (_exits_tbl[i].pt_count > 2) {
+			GFX_DrawPolyLine(ds, _exits_tbl[i].pt_tbl,
+							 _exits_tbl[i].pt_count, color);
 		}
 	}
 
 	return R_SUCCESS;
 }
 
-void CF_action_info(int argc, char *argv[], void *refCon) {
+void ActionMap::actionInfo(int argc, char *argv[]) {
 	R_POINT *pt;
 
 	int i;
@@ -168,28 +167,30 @@
 	(void)(argc);
 	(void)(argv);
 
-	if (!ActmapModule.exits_loaded) {
+	if (!_exits_loaded) {
 		return;
 	}
 
-	CON_Print("%d exits loaded.\n", ActmapModule.n_exits);
+	CON_Print("%d exits loaded.\n", _n_exits);
 
-	for (i = 0; i < ActmapModule.n_exits; i++) {
+	for (i = 0; i < _n_exits; i++) {
 		CON_Print ("Action %d: Exit to: %d; Pts: %d; Unk0: %d Unk2: %d Scr_N: %d",
-				   i, ActmapModule.exits_tbl[i].exit_scene,
-				   ActmapModule.exits_tbl[i].pt_count,
-				   ActmapModule.exits_tbl[i].unknown00,
-				   ActmapModule.exits_tbl[i].unknown02,
-				   ActmapModule.exits_tbl[i].unknown06);
+				   i, _exits_tbl[i].exit_scene,
+				   _exits_tbl[i].pt_count,
+				   _exits_tbl[i].unknown00,
+				   _exits_tbl[i].unknown02,
+				   _exits_tbl[i].unknown06);
 
-		for (pt_i = 0; pt_i < ActmapModule.exits_tbl[i].pt_count; pt_i++) {
-			pt = &ActmapModule.exits_tbl[i].pt_tbl[pt_i];
+		for (pt_i = 0; pt_i < _exits_tbl[i].pt_count; pt_i++) {
+			pt = &_exits_tbl[i].pt_tbl[pt_i];
 
 			CON_Print("   pt: %d (%d, %d)", pt_i, pt->x, pt->y);
 		}
 	}
+}
 
-	return;
+static void CF_action_info(int argc, char *argv[], void *refCon) {
+	((ActionMap *)refCon)->actionInfo(argc, argv);
 }
 
 } // End of namespace Saga

Index: actionmap.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actionmap.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- actionmap.h	31 Jul 2004 23:33:14 -0000	1.5
+++ actionmap.h	1 Aug 2004 00:03:45 -0000	1.6
@@ -38,16 +38,27 @@
 	R_POINT *pt_tbl;
 };
 
-struct R_ACTIONMAP_INFO {
-	int init;
-	int exits_loaded;
-	int n_exits;
-	R_ACTIONMAP_ENTRY *exits_tbl;
-	const byte *exmap_res;
-	size_t exmap_res_len;
-};
+class ActionMap {
+ public:
+	int reg(void);
+	ActionMap(void);
 
-void CF_action_info(int argc, char *argv[], void *refCon);
+	int load(const byte *exmap_res, size_t exmap_res_len);
+	int draw(R_SURFACE *ds, int color);
+
+	int freeMap(void);
+	int shutdown(void);
+
+	void actionInfo(int argc, char *argv[]);
+
+private:
+	bool _initialized;
+	int _exits_loaded;
+	int _n_exits;
+	R_ACTIONMAP_ENTRY *_exits_tbl;
+	const byte *_exmap_res;
+	size_t _exmap_res_len;
+};
 
 } // End of namespace Saga
 

Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- render.cpp	31 Jul 2004 23:33:14 -0000	1.15
+++ render.cpp	1 Aug 2004 00:03:45 -0000	1.16
@@ -37,7 +37,7 @@
 #include "sprite_mod.h"
 #include "text_mod.h"
 
-#include "actionmap_mod.h"
+#include "actionmap.h"
 #include "objectmap_mod.h"
 
 #include "render.h"
@@ -50,7 +50,7 @@
 	return R_SUCCESS;
 }
 
-Render::Render(OSystem *system) : _system(system), _initialized(false) {
+Render::Render(SagaEngine *vm, OSystem *system) : _vm(vm), _system(system), _initialized(false) {
 	R_GAME_DISPLAYINFO disp_info;
 	int tmp_w, tmp_h, tmp_bytepp;
 
@@ -136,7 +136,7 @@
 	// Display scene maps, if applicable
 	if (getFlags() & RF_OBJECTMAP_TEST) {
 		OBJECTMAP_Draw(backbuf_surface, &mouse_pt, GFX_GetWhite(), GFX_GetBlack());
-		ACTIONMAP_Draw(backbuf_surface, GFX_MatchColor(R_RGB_RED));
+		_vm->_actionMap->draw(backbuf_surface, GFX_MatchColor(R_RGB_RED));
 	}
 
 	// Draw queued actors

Index: render.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- render.h	31 Jul 2004 23:00:48 -0000	1.9
+++ render.h	1 Aug 2004 00:03:45 -0000	1.10
@@ -52,7 +52,7 @@
 class Render {
 public:
 	int reg(void);
-	Render(OSystem *system);
+	Render(SagaEngine *vm, OSystem *system);
 	~Render(void);
 	bool initialized();
 	int drawScene(void);

Index: saga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- saga.cpp	31 Jul 2004 23:33:14 -0000	1.24
+++ saga.cpp	1 Aug 2004 00:03:45 -0000	1.25
@@ -43,7 +43,7 @@
 #include "console_mod.h"
 #include "cvar_mod.h"
 #include "events_mod.h"
-#include "actionmap_mod.h"
+#include "actionmap.h"
 #include "font_mod.h"
 #include "game_mod.h"
 #include "game.h"
@@ -119,7 +119,6 @@
 
 	GAME_Register();
 
-	ACTIONMAP_Register();
 	OBJECTMAP_Register();
 	SCRIPT_Register();
 	ACTOR_Register();
@@ -158,7 +157,7 @@
 	FONT_Init();
 	SPRITE_Init();
 	_anim = new Anim();
-	ACTIONMAP_Init();
+	_actionMap = new ActionMap();
 	OBJECTMAP_Init();
 	ISOMAP_Init();
 	SCRIPT_Init();
@@ -194,7 +193,7 @@
 	}
 
 	// Initialize graphics
-	_render = new Render(_system);
+	_render = new Render(this, _system);
 	if (!_render->initialized()) {
 		return;
 	}
@@ -207,6 +206,7 @@
 
 	_render->reg();
 	_anim->reg();
+	_actionMap->reg();
 
 	SYSTIMER_ResetMSCounter();
 

Index: saga.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- saga.h	31 Jul 2004 23:00:48 -0000	1.17
+++ saga.h	1 Aug 2004 00:03:45 -0000	1.18
@@ -43,6 +43,7 @@
 class Music;
 class Anim;
 class Render;
+class ActionMap;
 
 using Common::MemoryReadStream;
 
@@ -71,6 +72,7 @@
 	Music *_music;
 	Anim *_anim;
 	Render *_render;
+	ActionMap *_actionMap;
 
 private:
 	int decodeBGImageRLE(const byte *inbuf, size_t inbuf_len, byte *outbuf, size_t outbuf_len);

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- scene.cpp	31 Jul 2004 23:33:14 -0000	1.14
+++ scene.cpp	1 Aug 2004 00:03:45 -0000	1.15
@@ -32,7 +32,7 @@
 #include "console_mod.h"
 #include "cvar_mod.h"
 #include "events_mod.h"
-#include "actionmap_mod.h"
+#include "actionmap.h"
 #include "gfx_mod.h"
 #include "isomap_mod.h"
 #include "script_mod.h"
@@ -622,7 +622,7 @@
 			break;
 		case SAGA_ACTION_MAP:
 			debug(0, "Loading exit map resource...");
-			if (ACTIONMAP_Load(res_data, res_data_len) != R_SUCCESS) {
+			if (_vm->_actionMap->load(res_data, res_data_len) != R_SUCCESS) {
 				warning("Error loading exit map resource");
 				return R_FAILURE;
 			}
@@ -792,7 +792,7 @@
 
 	PALANIM_Free();
 	OBJECTMAP_Free();
-	ACTIONMAP_Free();
+	_vm->_actionMap->freeMap();
 
 	ys_dll_destroy(SceneModule.anim_list);
 

--- actionmap_mod.h DELETED ---





More information about the Scummvm-git-logs mailing list