[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.86,1.87 animation.cpp,1.37,1.38 animation.h,1.19,1.20 font.cpp,1.26,1.27 font.h,1.11,1.12 game.cpp,1.52,1.53 image.cpp,1.21,1.22 input.cpp,1.32,1.33 interface.cpp,1.59,1.60 interface.h,1.27,1.28 ite_introproc.cpp,1.47,1.48 music.cpp,1.45,1.46 palanim.cpp,1.20,1.21 rscfile.cpp,1.19,1.20 saga.cpp,1.86,1.87 saga.h,1.70,1.71 scene.cpp,1.79,1.80 sfuncs.cpp,1.75,1.76 sndres.cpp,1.39,1.40 sound.cpp,1.21,1.22 sprite.cpp,1.40,1.41 sthread.cpp,1.56,1.57

Andrew Kurushin h00ligan at users.sourceforge.net
Tue Jan 11 13:12:02 CET 2005


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

Modified Files:
	actor.cpp animation.cpp animation.h font.cpp font.h game.cpp 
	image.cpp input.cpp interface.cpp interface.h 
	ite_introproc.cpp music.cpp palanim.cpp rscfile.cpp saga.cpp 
	saga.h scene.cpp sfuncs.cpp sndres.cpp sound.cpp sprite.cpp 
	sthread.cpp 
Log Message:
- remove game.h & image.h
- all display information of current game goes to SagaEngine
- remove GameFontIds
- hide SagaEngine _gameId,_gameType & etc with methods getGameId(), getGameType()

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- actor.cpp	9 Jan 2005 21:36:20 -0000	1.86
+++ actor.cpp	11 Jan 2005 21:10:19 -0000	1.87
@@ -136,7 +136,7 @@
 	ActorData *actor;
 	debug(9, "Actor::Actor()");
 
-	if (_vm->_gameType == GType_IHNM) {
+	if (_vm->getGameType() == GType_IHNM) {
 		warning("Actors aren't implemented for IHNM yet");
 		return;
 	}
@@ -155,7 +155,7 @@
 	_centerActor = _protagonist = NULL;
 	_lastTickMsec = 0;
 
-	_yCellCount = _vm->getStatusYOffset() + 1;
+	_yCellCount = _vm->getSceneHeight();
 	_xCellCount = _vm->getDisplayWidth();
 
 	_pathCell = (int8*) malloc(_yCellCount * _xCellCount * sizeof(*_pathCell));
@@ -163,8 +163,8 @@
 
 	_pathRect.left = 0;
 	_pathRect.right = _vm->getDisplayWidth();
-	_pathRect.top = _vm->getPathYOffset();
-	_pathRect.bottom = _vm->getStatusYOffset();
+	_pathRect.top = _vm->getDisplayInfo().pathStartY;
+	_pathRect.bottom = _vm->getSceneHeight();
 
 	// Get actor resource file context
 	_actorContext = _vm->getFileContext(GAME_RESOURCEFILE, 0);
@@ -395,7 +395,7 @@
 	location.toScreenPointXY(point);
 	
 	if ((point.x < 5) || (point.x >= _vm->getDisplayWidth() - 5) ||
-		(point.y < 0) || (point.y > _vm->getStatusYOffset())) {
+		(point.y < 0) || (point.y > _vm->getSceneHeight())) {
 		return false;
 	}
 	
@@ -410,7 +410,7 @@
 	ActorLocation possibleLocation;
 	Point delta;
 	
-	if (_vm->_gameType == GType_IHNM) {
+	if (_vm->getGameType() == GType_IHNM) {
 		warning("Actors aren't implemented for IHNM yet");
 		return;
 	}
@@ -883,7 +883,7 @@
 	if (_vm->_scene->getFlags() & kSceneFlagISO) {
 		//todo: it
 	} else {
-		middle = _vm->getStatusYOffset() - actor->location.y / ACTOR_LMULT;
+		middle = _vm->getSceneHeight() - actor->location.y / ACTOR_LMULT;
 
 		_vm->_scene->getSlopes(beginSlope, endSlope);
 

Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- animation.cpp	9 Jan 2005 23:41:20 -0000	1.37
+++ animation.cpp	11 Jan 2005 21:10:19 -0000	1.38
@@ -94,7 +94,7 @@
 	new_anim->maxframe = ah.maxframe;
 	new_anim->loopframe = ah.loopframe;
 
-	if (_vm->_gameType == GType_ITE) {
+	if (_vm->getGameType() == GType_ITE) {
 		// Cache frame offsets
 		new_anim->frame_offsets = (size_t *)malloc((new_anim->maxframe + 1) * sizeof(*new_anim->frame_offsets));
 		if (new_anim->frame_offsets == NULL) {
@@ -200,7 +200,7 @@
 
 	if (anim->completed < anim->cycles) {
 		frame = anim->current_frame;
-		if (_vm->_gameType == GType_ITE) {
+		if (_vm->getGameType() == GType_ITE) {
 			// FIXME: if start > 0, then this works incorrectly
 			result = ITE_DecodeFrame(anim->resdata, anim->resdata_len, anim->frame_offsets[frame], display_buf,
 									_vm->getDisplayWidth() * _vm->getDisplayHeight());
@@ -401,7 +401,7 @@
 		return FAILURE;
 	}
 
-	if (_vm->_gameType == GType_ITE) {
+	if (_vm->getGameType() == GType_ITE) {
 		free(anim->frame_offsets);
 		anim->frame_offsets = NULL;
 	}
@@ -482,7 +482,7 @@
 
 
 	fh.x_start = readS.readUint16BE();
-	if (_vm->_features & GF_BIG_ENDIAN_DATA)
+	if (_vm->getFeatures() & GF_BIG_ENDIAN_DATA)
 		fh.y_start = readS.readUint16BE();
 	else
 		fh.y_start = readS.readByte();
@@ -537,7 +537,7 @@
 		case SAGA_FRAME_ROW_END: // End of row
 			x_vector = readS.readSint16BE();
 			
-			if (_vm->_features & GF_BIG_ENDIAN_DATA)
+			if (_vm->getFeatures() & GF_BIG_ENDIAN_DATA)
 				new_row = readS.readSint16BE();
 			else
 				new_row = readS.readByte();
@@ -877,7 +877,7 @@
 				break;
 			case SAGA_FRAME_ROW_END: // End of row marker
 				readS.readSint16BE();
-				if (_vm->_features & GF_BIG_ENDIAN_DATA)
+				if (_vm->getFeatures() & GF_BIG_ENDIAN_DATA)
 					readS.readSint16BE();
 				else
 					readS.readByte();

Index: animation.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- animation.h	3 Jan 2005 17:39:20 -0000	1.19
+++ animation.h	11 Jan 2005 21:10:19 -0000	1.20
@@ -33,7 +33,7 @@
 #define MAX_ANIMATIONS 7
 #define DEFAULT_FRAME_TIME 140
 
-#define SAGA_FRAME_HEADER_LEN (_vm->_features & GF_MAC_RESOURCES ? 13 : 12)
+#define SAGA_FRAME_HEADER_LEN (_vm->getFeatures() & GF_MAC_RESOURCES ? 13 : 12)
 
 #define SAGA_FRAME_START 0xF
 #define SAGA_FRAME_END 0x3F

Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- font.cpp	11 Jan 2005 00:51:58 -0000	1.26
+++ font.cpp	11 Jan 2005 21:10:19 -0000	1.27
@@ -43,15 +43,15 @@
 
 	assert(_vm->getFontsCount() > 0);
 
-	_nFonts = _vm->getFontsCount();
+	_nFonts = 0;
 
-	_fonts = (FONT **)malloc(_nFonts * sizeof(*_fonts));
+	_fonts = (FONT **)malloc(_vm->getFontsCount() * sizeof(*_fonts));
 	if (_fonts == NULL) {
 		error("Font::Font(): Memory allocation failure.");
 	}
 
-	for (i = 0; i < _nFonts; i++) {
-		loadFont(_vm->getFontDescription(i)->font_rn, _vm->getFontDescription(i)->font_id);
+	for (i = 0; i < _vm->getFontsCount(); i++) {
+		loadFont(_vm->getFontDescription(i)->fontResourceId);
 	}
 
 	_initialized = true;
@@ -80,7 +80,7 @@
 */
 }
 
-int Font::loadFont(uint32 font_rn, int font_id) {
+int Font::loadFont(uint32 fontResourceId) {
 	FONT_HEADER fh;
 	FONT *font;
 	FONT_STYLE *normal_font;
@@ -89,12 +89,8 @@
 	int nbits;
 	int c;
 
-	if ((font_id < 0) || (font_id >= _nFonts)) {
-		return FAILURE;
-	}
-
 	// Load font resource
-	if (RSC_LoadResource(_fontContext, font_rn, &fontres_p, &fontres_len) != SUCCESS) {
+	if (RSC_LoadResource(_fontContext, fontResourceId, &fontres_p, &fontres_len) != SUCCESS) {
 		error("Font::loadFont(): Couldn't load font resource.");
 	}
 
@@ -116,7 +112,7 @@
 	fh.c_width = readS.readUint16();
 	fh.row_length = readS.readUint16();
 
-	debug(1, "Font::loadFont(): Reading font resource #%d...", font_rn);
+	debug(1, "Font::loadFont(): Reading fontResourceId %d...", fontResourceId);
 
 	debug(2, "Character width: %d", fh.c_width);
 	debug(2, "Character height: %d", fh.c_height);
@@ -165,7 +161,7 @@
 	font->outline_loaded = 1;
 
 	// Set font data 
-	_fonts[font_id] = font;
+	_fonts[_nFonts++] = font;
 
 	return SUCCESS;
 }

Index: font.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- font.h	11 Jan 2005 00:51:58 -0000	1.11
+++ font.h	11 Jan 2005 21:10:19 -0000	1.12
@@ -108,7 +108,7 @@
 
  private:
 
-	int loadFont(uint32 font_rn, int font_id);
+	int loadFont(uint32 fontResourceId);
 	FONT_STYLE *createOutline(FONT_STYLE * src_font);
 	int outFont(FONT_STYLE *font, SURFACE * ds, const char *draw_str, size_t draw_str_ct,
 				int text_x, int text_y, int color, int flags);

Index: game.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/game.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- game.cpp	11 Jan 2005 19:40:17 -0000	1.52
+++ game.cpp	11 Jan 2005 21:10:19 -0000	1.53
@@ -36,14 +36,46 @@
 #include "saga/interface.h"
 #include "saga/scene.h"
 
-#include "saga/game.h"
-
 namespace Saga {
 
 static int detectGame(const FSList &fslist, bool mode = false);
 
-// Inherit the Earth - DOS Demo version
+// ITE section
+static GameDisplayInfo ITE_DisplayInfo = {
+	320, 200,
+	
+	35,
+	137,
+
+	137,
+	320,
+	12,
+	2,
+	186,
+	15,
+
+	147,
+	15,
+	96,
+	
+	5, 4,
+	274, 4,
+
+	181, 155,
+	2, 4,
+	29, 20,
+	1, 0,
+	3, 1
+};
 
+static GameResourceDescription ITE_Resources = {
+	RID_ITE_SCENE_LUT,  // Scene lookup table RN
+	RID_ITE_SCRIPT_LUT, // Script lookup table RN
+	RID_ITE_COMMAND_PANEL,
+	RID_ITE_DIALOGUE_PANEL
+};
+
+// Inherit the Earth - DOS Demo version
 static GameFileDescription ITEDEMO_GameFiles[] = {
 	{"ite.rsc", GAME_RESOURCEFILE},
 	{"ite.dmo", GAME_DEMOFILE},
@@ -52,8 +84,8 @@
 };
 
 static GameFontDescription ITEDEMO_GameFonts[] = {
-	{GAME_FONT_SMALL, 0},
-	{GAME_FONT_MEDIUM, 1}
+	{0},
+	{1}
 }; 
 
 static GameSoundInfo ITEDEMO_GameSound = {
@@ -61,8 +93,8 @@
 };
 
 static GameFontDescription ITEMACDEMO_GameFonts[] = {
-	{GAME_FONT_MEDIUM, 0},
-	{GAME_FONT_SMALL, 2}
+	{0},
+	{2}
 }; 
 
 // Inherit the Earth - Wyrmkeep Win32 Demo version
@@ -92,8 +124,8 @@
 };
 
 static GameFontDescription ITEWINDEMO_GameFonts[] = {
-	{GAME_FONT_MEDIUM, 0},
-	{GAME_FONT_SMALL, 2}
+	{0},
+	{2}
 }; 
 
 // Inherit the Earth - Mac Wyrmkeep version
@@ -113,16 +145,9 @@
 };
 
 static GameFontDescription ITEDISK_GameFonts[] = {
-	{GAME_FONT_MEDIUM, 0},
-	{GAME_FONT_LARGE, 1},
-	{GAME_FONT_SMALL, 2}
-};
-
-static GameResourceDescription ITE_Resources = {
-	RID_ITE_SCENE_LUT,  // Scene lookup table RN
-	RID_ITE_SCRIPT_LUT, // Script lookup table RN
-	RID_ITE_COMMAND_PANEL,
-	RID_ITE_DIALOGUE_PANEL
+	{2},
+	{0},
+	{1}
 };
 
 static GameSoundInfo ITE_GameSound = {
@@ -138,9 +163,9 @@
 };
 
 static GameFontDescription ITECD_GameFonts[] = {
-	{GAME_FONT_MEDIUM, 0},
-	{GAME_FONT_LARGE, 1},
-	{GAME_FONT_SMALL, 2}
+	{2},
+	{0},
+	{1}
 };
 
 static GameSoundInfo ITECD_GameSound = {
@@ -150,6 +175,42 @@
 	0
 };
 
+// IHNM section
+
+static GameDisplayInfo IHNM_DisplayInfo = {
+	640, 480,
+	
+	0, //TODO: correct pathStartY
+	304, //TODO: correct sceneHeight
+
+	304,
+	640,
+	24,
+	8,
+	186,
+	11,
+
+	147,
+	15,
+	96,
+
+	5, 4,
+	-1, -1,
+
+	0, 0, //TODO: fill it all
+	0, 0,
+	0, 0,
+	0, 0,
+	0, 0
+};
+
+static GameResourceDescription IHNM_Resources = {
+	RID_IHNM_SCENE_LUT,  // Scene lookup table RN
+	RID_IHNM_SCRIPT_LUT, // Script lookup table RN
+	RID_IHNM_COMMAND_PANEL,
+	RID_IHNM_DIALOGUE_PANEL
+};
+
 // I Have No Mouth and I Must Scream - Demo version
 static GameFileDescription IHNMDEMO_GameFiles[] = {
 	{"scream.res", GAME_RESOURCEFILE},
@@ -192,20 +253,13 @@
 };
 
 static GameFontDescription IHNMCD_GameFonts[] = {
-	{GAME_FONT_MEDIUM, 2},
-	{GAME_FONT_LARGE, 3},
-	{GAME_FONT_SMALL, 4},
-	{GAME_FONT_SMALL2, 5},
-	{GAME_FONT_MEDIUM2, 6},
-	{GAME_FONT_LARGE2, 7},
-	{GAME_FONT_LARGE3, 8}
-};
-
-static GameResourceDescription IHNM_Resources = {
-	RID_IHNM_SCENE_LUT,  // Scene lookup table RN
-	RID_IHNM_SCRIPT_LUT, // Script lookup table RN
-	RID_IHNM_COMMAND_PANEL,
-	RID_IHNM_DIALOGUE_PANEL
+	{2},
+	{3},
+	{4},
+	{5},
+	{6},
+	{7},
+	{8}
 };
 
 static GameSoundInfo IHNM_GameSound = {
@@ -332,8 +386,7 @@
 		GType_ITE,
 		GID_ITE_DEMO_G, // Game id
 		"Inherit the Earth (DOS Demo)", // Game title
-		320, 200, // Logical resolution
-		137, // Scene viewport height
+		&ITE_DisplayInfo,
 		ITE_DEFAULT_SCENE, // Starting scene number
 		&ITE_Resources,
 		ARRAYSIZE(ITEDEMO_GameFiles), // Game datafiles
@@ -350,8 +403,7 @@
 		GType_ITE,
 		GID_ITE_MACDEMO2,
 		"Inherit the Earth (MAC Demo)",
-		320, 200,
-		137,
+		&ITE_DisplayInfo,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFiles),
@@ -368,8 +420,7 @@
 		GType_ITE,
 		GID_ITE_MACDEMO1,
 		"Inherit the Earth (early MAC Demo)",
-		320, 200,
-		137,
+		&ITE_DisplayInfo,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFiles),
@@ -386,8 +437,7 @@
 		GType_ITE,
 		GID_ITE_MACCD,
 		"Inherit the Earth (MAC CD)",
-		320, 200,
-		137,
+		&ITE_DisplayInfo,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEMACCD_GameFiles),
@@ -405,8 +455,7 @@
 		GType_ITE,
 		GID_ITE_LINDEMO,
 		"Inherit the Earth (Linux Demo)",
-		320, 200,
-		137,
+		&ITE_DisplayInfo,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITELINDEMO_GameFiles),
@@ -423,8 +472,7 @@
 		GType_ITE,
 		GID_ITE_WINDEMO2,
 		"Inherit the Earth (Win32 Demo)",
-		320, 200,
-		137,
+		&ITE_DisplayInfo,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFiles),
@@ -441,8 +489,7 @@
 		GType_ITE,
 		GID_ITE_WINDEMO1,
 		"Inherit the Earth (early Win32 Demo)",
-		320, 200,
-		137,
+		&ITE_DisplayInfo,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEWINDEMO_GameFiles),
@@ -460,8 +507,7 @@
 		GType_ITE,
 		GID_ITE_LINCD,
 		"Inherit the Earth (Linux CD Version)",
-		320, 200,
-		137,
+		&ITE_DisplayInfo,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITELINCD_GameFiles),
@@ -478,8 +524,7 @@
 		GType_ITE,
 		GID_ITE_CD_G,
 		"Inherit the Earth (DOS CD Version)",
-		320, 200,
-		137,
+		&ITE_DisplayInfo,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITECD_GameFiles),
@@ -496,8 +541,7 @@
 		GType_ITE,
 		GID_ITE_CD_DE,
 		"Inherit the Earth (De DOS CD Version)",
-		320, 200,
-		137,
+		&ITE_DisplayInfo,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITECD_GameFiles),
@@ -514,8 +558,7 @@
 		GType_ITE,
 		GID_ITE_CD,
 		"Inherit the Earth (DOS/Win32 CD Version)",
-		320, 200,
-		137,
+		&ITE_DisplayInfo,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITECD_GameFiles),
@@ -532,8 +575,7 @@
 		GType_ITE,
 		GID_ITE_DISK_DE,
 		"Inherit the Earth (De DOS Floppy)",
-		320, 200,
-		137,
+		&ITE_DisplayInfo,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEDISK_GameFiles),
@@ -550,8 +592,7 @@
 		GType_ITE,
 		GID_ITE_DISK_G,
 		"Inherit the Earth (DOS Floppy)",
-		320, 200,
-		137,
+		&ITE_DisplayInfo,
 		ITE_DEFAULT_SCENE,
 		&ITE_Resources,
 		ARRAYSIZE(ITEDISK_GameFiles),
@@ -568,8 +609,7 @@
 		GType_IHNM,
 		GID_IHNM_DEMO,
 		"I Have No Mouth and I Must Scream (DOS Demo)",
-		640, 480,
-		7,
+		&IHNM_DisplayInfo,
 		0,
 		&IHNM_Resources,
 		ARRAYSIZE(IHNMDEMO_GameFiles),
@@ -586,8 +626,7 @@
 		GType_IHNM,
 		GID_IHNM_CD,
 		"I Have No Mouth and I Must Scream (DOS)",
-		640, 480,
-		7,
+		&IHNM_DisplayInfo,
 		152,
 		&IHNM_Resources,
 		ARRAYSIZE(IHNMCD_GameFiles),
@@ -604,8 +643,7 @@
 		GType_IHNM,
 		GID_IHNM_CD_DE,
 		"I Have No Mouth and I Must Scream (DE DOS)",
-		640, 480,
-		7,
+		&IHNM_DisplayInfo,
 		152,
 		&IHNM_Resources,
 		ARRAYSIZE(IHNMCDDE_GameFiles),
@@ -630,7 +668,6 @@
 		warning("Error loading game resource files.");
 		return FAILURE;
 	}
-
 	// Load dialogue file 
 	loadLanguage();
 
@@ -642,7 +679,7 @@
 	File test_file;
 
 
-	if (_gameType == GType_ITE) {
+	if (getGameType() == GType_ITE) {
 		snprintf(lang_file, MAXPATH, "%s%s.%s", GAME_ITE_LANG_PREFIX, _gameLanguage, GAME_LANG_EXT);
 		if (!test_file.open(lang_file)) {
 			debug(0, "Couldn't open language file %s. Using default (US English)", lang_file);
@@ -825,14 +862,11 @@
 
 	_gameNumber = gameNumber;
 	_gameDescription = &gameDescriptions[gameNumber];
-
-	_gameId = _gameDescription->gameId;
-	_gameType = _gameDescription->gameType;
-	_features = _gameDescription->features;
+	_gameDisplayInfo = *_gameDescription->gameDisplayInfo;
 
 	gameFileCount = _gameDescription->filesCount;
 	
-	_gameFileContexts = (RSCFILE_CONTEXT **)malloc(gameFileCount * sizeof(*_gameFileContexts));
+	_gameFileContexts = (RSCFILE_CONTEXT **)realloc(_gameFileContexts, gameFileCount * sizeof(*_gameFileContexts));
 	//TODO: on exit - FREE!
 	if (_gameFileContexts == NULL) {
 		error("SagaEngine::loadGame not enough memory");
@@ -854,20 +888,4 @@
 	return SUCCESS;
 }
 
-int SagaEngine::getPathYOffset() { //fixme: should be in GameDesc
-	if (_gameType == GType_ITE) {
-		return 35;
-	} else {
-		return 35; //fixme i don't know exact value
-	}
-}
-
-int SagaEngine::getStatusYOffset() { //fixme: should be in GameDesc
-	if (_gameType == GType_ITE) {
-		return ITE_STATUS_Y;
-	} else {
-		return IHNM_STATUS_Y;
-	}
-}
-
 } // End of namespace Saga

Index: image.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/image.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- image.cpp	1 Jan 2005 16:18:36 -0000	1.21
+++ image.cpp	11 Jan 2005 21:10:19 -0000	1.22
@@ -24,7 +24,6 @@
 // SAGA Image resource management routines
 #include "saga/saga.h"
 
-#include "saga/image.h"
 #include "saga/stream.h"
 
 namespace Saga {
@@ -92,7 +91,7 @@
 	unbankBGImage(out_buf, decode_buf, hdr.width, hdr.height);
 
 	// For some reason bg images in IHNM are upside down
-	if (_vm->_gameType == GType_IHNM) {
+	if (_vm->getGameType() == GType_IHNM) {
 		flipImage(out_buf, hdr.width, hdr.height);
 	}
 

Index: input.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/input.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- input.cpp	7 Jan 2005 00:57:43 -0000	1.32
+++ input.cpp	11 Jan 2005 21:10:19 -0000	1.33
@@ -111,7 +111,7 @@
 			imousePt = _mousePos;
 			break;
 		case OSystem::EVENT_QUIT:
-			g_system->quit();
+			_system->quit();
 			break;
 		default:
 			break;

Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- interface.cpp	11 Jan 2005 00:51:58 -0000	1.59
+++ interface.cpp	11 Jan 2005 21:10:19 -0000	1.60
@@ -50,37 +50,6 @@
 	{I_VERB_GIVE, "verb_give", "Give", kVerbGive}
 };
 
-static INTERFACE_DESC ITE_interface = {
-	ITE_STATUS_Y,
-	ITE_STATUS_W,
-	ITE_STATUS_H,
-	ITE_STATUS_TEXT_Y,
-	ITE_STATUS_TXTCOL,
-	ITE_STATUS_BGCOL,
-
-	ITE_CMD_TEXT_COL,
-	ITE_CMD_TEXT_SHADOWCOL,
-	ITE_CMD_TEXT_HILITECOL,
-
-	COMMAND_DEFAULT_BUTTON,
-
-	ITE_LPORTRAIT_X,
-	ITE_LPORTRAIT_Y,
-	ITE_RPORTRAIT_X,
-	ITE_RPORTRAIT_Y,
-
-	ITE_INVENTORY_XSTART,
-	ITE_INVENTORY_YSTART,
-	ITE_INVENTORY_ROWS,
-	ITE_INVENTORY_COLUMNS,
-	ITE_INVENTORY_ICON_WIDTH,
-	ITE_INVENTORY_ICON_HEIGHT,
-	ITE_INVENTORY_ICON_XOFFSET,
-	ITE_INVENTORY_ICON_YOFFSET,
-	ITE_INVENTORY_XSPACING,
-	ITE_INVENTORY_YSPACING
-};
-
 static InterfaceButton ITEMainPanel[] = {
 	{5, 4, 46, 47, "Portrait", 0, 0, BUTTON_NONE, 0}, //TODO: remove?
 	// "Walk To" and "Talk To" share button sprites
@@ -105,36 +74,6 @@
 	{306, 41, 314, 45, "InvDown", 0, 0, BUTTON_NONE, 0}
 };
 
-static INTERFACE_DESC IHNM_interface = {
-	IHNM_STATUS_Y,
-	IHNM_STATUS_W,
-	IHNM_STATUS_H,
-	IHNM_STATUS_TEXT_Y,
-	IHNM_STATUS_TXTCOL,
-	IHNM_STATUS_BGCOL,
-
-	IHNM_CMD_TEXT_COL,
-	IHNM_CMD_TEXT_SHADOWCOL,
-	IHNM_CMD_TEXT_HILITECOL,
-
-	COMMAND_DEFAULT_BUTTON,
-
-	IHNM_LPORTRAIT_X,
-	IHNM_LPORTRAIT_Y,
-	IHNM_RPORTRAIT_X,
-	IHNM_RPORTRAIT_Y,
-
-	IHNM_INVENTORY_XSTART,
-	IHNM_INVENTORY_YSTART,
-	IHNM_INVENTORY_ROWS,
-	IHNM_INVENTORY_COLUMNS,
-	IHNM_INVENTORY_ICON_WIDTH,
-	IHNM_INVENTORY_ICON_HEIGHT,
-	IHNM_INVENTORY_ICON_XOFFSET,
-	IHNM_INVENTORY_ICON_YOFFSET,
-	IHNM_INVENTORY_XSPACING,
-	IHNM_INVENTORY_YSPACING
-};
 
 static InterfaceButton IHNMMainPanel[] = {
 	{5, 4, 46, 47, "Portrait", 0, 0, 0, 0}
@@ -179,17 +118,15 @@
 	}
 
 	// Initialize interface data by game type
-	if (_vm->_gameType == GType_ITE) {
+	if (_vm->getGameType() == GType_ITE) {
 		// Load Inherit the Earth interface desc
 		_mainPanel.buttons = ITEMainPanel;
 		_mainPanel.nbuttons = ARRAYSIZE(ITEMainPanel);
 
-		_iDesc = ITE_interface;
-	} else if (_vm->_gameType == GType_IHNM) {
+	} else if (_vm->getGameType() == GType_IHNM) {
 		// Load I Have No Mouth interface desc
 		_mainPanel.buttons = IHNMMainPanel;
 		_mainPanel.nbuttons = ARRAYSIZE(IHNMMainPanel);
-		_iDesc = IHNM_interface;
 	} else {
 		return;
 	}
@@ -229,7 +166,7 @@
 	_conversePanel.x = 0;
 	_conversePanel.y = 149;
 
-	_mainPanel.set_button = COMMAND_DEFAULT_BUTTON;
+	_mainPanel.set_button = 1;
 	_leftPortrait = 0;
 	_rightPortrait = 0;
 
@@ -394,15 +331,15 @@
 
 	if (_panelMode == kPanelMain || _panelMode == kPanelConverse ||
 		_lockedMode == kPanelMain || _lockedMode == kPanelConverse) {
-			leftPortraitPoint.x = base.x + _iDesc.lportrait_x;
-			leftPortraitPoint.y = base.y + _iDesc.lportrait_y;
+			leftPortraitPoint.x = base.x + _vm->getDisplayInfo().leftPortraitX;
+			leftPortraitPoint.y = base.y + _vm->getDisplayInfo().leftPortraitY;
 			_vm->_sprite->draw(backBuffer, _defPortraits, _leftPortrait, leftPortraitPoint, 256);
 		}
 		
 
-	if (!_inMainMode && _iDesc.rportrait_x >= 0) {
-		rightPortraitPoint.x = base.x + _iDesc.rportrait_x;
-		rightPortraitPoint.y = base.y + _iDesc.rportrait_y;
+	if (!_inMainMode && _vm->getDisplayInfo().rightPortraitX >= 0) {
+		rightPortraitPoint.x = base.x + _vm->getDisplayInfo().rightPortraitX;
+		rightPortraitPoint.y = base.y + _vm->getDisplayInfo().rightPortraitY;
 
 		_vm->_sprite->draw(backBuffer, _scenePortraits, _rightPortrait, rightPortraitPoint, 256);
 	}
@@ -429,7 +366,7 @@
 
 	if (_panelMode == kPanelMain) { // FIXME: HACK
 		// Update playfield space ( only if cursor is inside )
-		if (imouse_y < _vm->getStatusYOffset()) {
+		if (imouse_y < _vm->getSceneHeight()) {
 			// Mouse is in playfield space
 			if (update_flag == UPDATE_MOUSEMOVE) {
 				handlePlayfieldUpdate(back_buf, imousePt);
@@ -459,23 +396,23 @@
 	// Disable this for IHNM for now, since that game uses the full screen
 	// in some cases.
 
-	if (_vm->_gameType == GType_IHNM) {
+	if (_vm->getGameType() == GType_IHNM) {
 		return SUCCESS;
 	}
 
 
 	// Erase background of status bar
 	rect.left = 0;
-	rect.top = _iDesc.status_y;
+	rect.top = _vm->getDisplayInfo().statusY;
 	rect.right = _vm->getDisplayWidth();
-	rect.bottom = _iDesc.status_y + _iDesc.status_h;
+	rect.bottom = _vm->getDisplayInfo().statusY + _vm->getDisplayInfo().statusHeight;
 
-	drawRect(ds, &rect, _iDesc.status_bgcol);
+	drawRect(ds, &rect, _vm->getDisplayInfo().statusBGColor);
 
 	string_w = _vm->_font->getStringWidth(SMALL_FONT_ID, _statusText, 0, 0);
 
-	_vm->_font->draw(SMALL_FONT_ID, ds, _statusText, 0, (_iDesc.status_w / 2) - (string_w / 2),
-			_iDesc.status_y + _iDesc.status_txt_y, _iDesc.status_txt_col, 0, 0);
+	_vm->_font->draw(SMALL_FONT_ID, ds, _statusText, 0, (_vm->getDisplayInfo().statusWidth / 2) - (string_w / 2),
+			_vm->getDisplayInfo().statusY + _vm->getDisplayInfo().statusTextY, _vm->getDisplayInfo().statusTextColor, 0, 0);
 
 	return SUCCESS;
 }
@@ -733,10 +670,10 @@
 	int row = 0;
 	int col = 0;
 
-	int x = _iDesc.inv_xstart + _iDesc.inv_icon_xoffset;
-	int y = _iDesc.inv_ystart + _iDesc.inv_icon_yoffset;
-	int width = _iDesc.inv_icon_width + _iDesc.inv_xspacing;
-	int height = _iDesc.inv_icon_height + _iDesc.inv_yspacing;
+	int x = _vm->getDisplayInfo().inventoryX + _vm->getDisplayInfo().inventoryIconX;
+	int y = _vm->getDisplayInfo().inventoryY + _vm->getDisplayInfo().inventoryIconY;
+	int width = _vm->getDisplayInfo().inventoryIconWidth + _vm->getDisplayInfo().inventoryXSpacing;
+	int height = _vm->getDisplayInfo().inventoryIconHeight + _vm->getDisplayInfo().inventoryYSpacing;
 	Point drawPoint;
 
 	for (int i = 0; i < _inventoryCount; i++) {
@@ -750,8 +687,8 @@
 			ObjectTable[_inventory[i]].spritelistRn,
 			drawPoint, 256);
 
-		if (++col >= _iDesc.inv_columns) {
-			if (++row >= _iDesc.inv_rows) {
+		if (++col >= _vm->getDisplayInfo().inventoryColumns) {
+			if (++row >= _vm->getDisplayInfo().inventoryRows) {
 				break;
 			}
 			col = 0;
@@ -763,22 +700,22 @@
 	int row = 0;
 	int col = 0;
 
-	int xbase = _iDesc.inv_xstart;
-	int ybase = _iDesc.inv_ystart;
-	int width = _iDesc.inv_icon_width + _iDesc.inv_xspacing;
-	int height = _iDesc.inv_icon_height + _iDesc.inv_yspacing;
+	int xbase = _vm->getDisplayInfo().inventoryX;
+	int ybase = _vm->getDisplayInfo().inventoryY;
+	int width = _vm->getDisplayInfo().inventoryIconWidth + _vm->getDisplayInfo().inventoryXSpacing;
+	int height = _vm->getDisplayInfo().inventoryIconHeight + _vm->getDisplayInfo().inventoryYSpacing;
 
 	for (int i = 0; i < _inventoryCount; i++) {
 		int x = xbase + col * width;
 		int y = ybase + row * height;
 
-		if (imousePt.x >= x && imousePt.x < x + _iDesc.inv_icon_width && imousePt.y >= y && imousePt.y < y + _iDesc.inv_icon_height) {
+		if (imousePt.x >= x && imousePt.x < x + _vm->getDisplayInfo().inventoryIconWidth && imousePt.y >= y && imousePt.y < y + _vm->getDisplayInfo().inventoryIconHeight) {
 			*ibutton = i;
 			return SUCCESS;
 		}
 
-		if (++col >= _iDesc.inv_columns) {
-			if (++row >= _iDesc.inv_rows) {
+		if (++col >= _vm->getDisplayInfo().inventoryColumns) {
+			if (++row >= _vm->getDisplayInfo().inventoryRows) {
 				break;
 			}
 			col = 0;
@@ -954,7 +891,7 @@
 
 		if (_converseTextCount > i) {
 			const char *str = _converseText[relpos].text;
-			char bullet[] = { 0xb7, 0 };
+			char bullet[] = { (char)0xb7, 0 };
 			int scry = i * CONVERSE_TEXT_HEIGHT + _conversePanel.y + y;
 			byte tcolor, bcolor;
 

Index: interface.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- interface.h	11 Jan 2005 00:51:58 -0000	1.27
+++ interface.h	11 Jan 2005 21:10:20 -0000	1.28
@@ -42,65 +42,6 @@
 
 #define STATUS_TEXT_LEN 128
 
-#define COMMAND_DEFAULT_BUTTON 1
-
-// Inherit the Earth interface values
-#define ITE_STATUS_Y      137
-#define ITE_STATUS_W      320
-#define ITE_STATUS_H      12
-#define ITE_STATUS_TEXT_Y 2
-#define ITE_STATUS_TXTCOL 186
-#define ITE_STATUS_BGCOL  15
-
-#define ITE_CMD_TEXT_COL       147
-#define ITE_CMD_TEXT_SHADOWCOL 15
-#define ITE_CMD_TEXT_HILITECOL 96
-
-#define ITE_LPORTRAIT_X 5
-#define ITE_LPORTRAIT_Y 4
-#define ITE_RPORTRAIT_X 274
-#define ITE_RPORTRAIT_Y 4
-
-#define ITE_INVENTORY_XSTART 181
-#define ITE_INVENTORY_YSTART 155
-#define ITE_INVENTORY_ROWS 2
-#define ITE_INVENTORY_COLUMNS 4
-#define ITE_INVENTORY_ICON_WIDTH 29
-#define ITE_INVENTORY_ICON_HEIGHT 20
-#define ITE_INVENTORY_ICON_XOFFSET 1
-#define ITE_INVENTORY_ICON_YOFFSET 0
-#define ITE_INVENTORY_XSPACING 3
-#define ITE_INVENTORY_YSPACING 1
-
-// IHNMAIMS interface values
-#define IHNM_STATUS_Y      304
-#define IHNM_STATUS_W      640
-#define IHNM_STATUS_H      24
-#define IHNM_STATUS_TEXT_Y 8
-#define IHNM_STATUS_TXTCOL 186
-#define IHNM_STATUS_BGCOL  11
-
-#define IHNM_CMD_TEXT_COL       147
-#define IHNM_CMD_TEXT_SHADOWCOL 15
-#define IHNM_CMD_TEXT_HILITECOL 96
-
-#define IHNM_LPORTRAIT_X 5
-#define IHNM_LPORTRAIT_Y 4
-#define IHNM_RPORTRAIT_X -1
-#define IHNM_RPORTRAIT_Y -1
-
-// TODO
-#define IHNM_INVENTORY_XSTART 0
-#define IHNM_INVENTORY_YSTART 0
-#define IHNM_INVENTORY_ROWS 0
-#define IHNM_INVENTORY_COLUMNS 0
-#define IHNM_INVENTORY_ICON_WIDTH 0
-#define IHNM_INVENTORY_ICON_HEIGHT 0
-#define IHNM_INVENTORY_ICON_XOFFSET 0
-#define IHNM_INVENTORY_ICON_YOFFSET 0
-#define IHNM_INVENTORY_XSPACING 0
-#define IHNM_INVENTORY_YSPACING 0
-
 // Converse-specific stuff
 #define CONVERSE_MAX_TEXTS      64
 #define CONVERSE_MAX_TEXT_WIDTH (256 - 60)
@@ -127,11 +68,10 @@
 	BUTTON_NONE = 0x0,
 	BUTTON_LABEL = 0x01,
 	BUTTON_BITMAP = 0x02,
-	BUTTON_SET = 0x04
+	BUTTON_SET = 0x04,
+	BUTTON_VERB = BUTTON_LABEL | BUTTON_BITMAP | BUTTON_SET
 };
 
-#define BUTTON_VERB ( BUTTON_LABEL | BUTTON_BITMAP | BUTTON_SET )
-
 struct InterfaceButton {
 	int x1;
 	int y1;
@@ -153,42 +93,12 @@
 	size_t img_len;
 	int img_w;
 	int img_h;
-	int set_button;
+	int set_button;//TODO: remove
 	int nbuttons;
 	InterfaceButton *buttons;
 	SpriteList sprites;
 };
 
-struct INTERFACE_DESC {
-	int status_y;
-	int status_w;
-	int status_h;
-	int status_txt_y;
-	int status_txt_col;
-	int status_bgcol;
-	int cmd_txt_col;
-	int cmd_txt_shadowcol;
-	int cmd_txt_hilitecol;
-	int cmd_defaultbutton;
-	int lportrait_x;
-	int lportrait_y;
-	int rportrait_x;
-	int rportrait_y;
-	int inv_xstart;
-	int inv_ystart;
-	int inv_rows;
-	int inv_columns;
-	int inv_icon_width;
-	int inv_icon_height;
-	int inv_icon_xoffset;
-	int inv_icon_yoffset;
-	int inv_xspacing;
-	int inv_yspacing;
-};
-
-struct INTERFACE_MODULE {
-};
-
 enum INTERFACE_VERBS {
 	I_VERB_WALKTO,
 	I_VERB_LOOKAT,
@@ -270,7 +180,6 @@
 	bool _initialized;
 	bool _active;
 	RSCFILE_CONTEXT *_interfaceContext;
-	INTERFACE_DESC _iDesc;
 	int _panelMode;
 	int _savedMode;
 	int _lockedMode;

Index: ite_introproc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/ite_introproc.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- ite_introproc.cpp	10 Jan 2005 07:56:23 -0000	1.47
+++ ite_introproc.cpp	11 Jan 2005 21:10:20 -0000	1.48
@@ -189,11 +189,11 @@
 	// The assumption here is that all WyrmKeep versions have the same
 	// credits, regardless of which operating system they're for.
 
-	if (_vm->_features & GF_WYRMKEEP) {
+	if (_vm->getFeatures() & GF_WYRMKEEP) {
 		game = kITEWyrmKeep;
-	} else if (_vm->_features & GF_MAC_RESOURCES) {
+	} else if (_vm->getFeatures() & GF_MAC_RESOURCES) {
 		game = kITEMac;
-	} else if (_vm->_gameId == GID_ITE_CD_G) {
+	} else if (_vm->getGameId() == GID_ITE_CD_G) {
 		game = kITEPCCD;
 	} else {
 		game = kITEPC;
@@ -324,14 +324,14 @@
 		// playback
 		int lastAnim;
 
-		if (_vm->_features & GF_WYRMKEEP) {
-			if (_vm->_features & GF_MAC_RESOURCES) {
+		if (_vm->getFeatures() & GF_WYRMKEEP) {
+			if (_vm->getFeatures() & GF_MAC_RESOURCES) {
 				lastAnim = 3;
 			} else {
 				lastAnim = 2;
 			}
 		} else {
-			if (_vm->_features & GF_MAC_RESOURCES) {
+			if (_vm->getFeatures() & GF_MAC_RESOURCES) {
 				lastAnim = 4;
 			} else {
 				lastAnim = 5;

Index: music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/music.cpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- music.cpp	1 Jan 2005 16:18:36 -0000	1.45
+++ music.cpp	11 Jan 2005 21:10:20 -0000	1.46
@@ -138,7 +138,7 @@
 		if (len & 1)
 			len--;
 
-		if (_vm->_features & GF_BIG_ENDIAN_DATA) {			
+		if (_vm->getFeatures() & GF_BIG_ENDIAN_DATA) {			
 			uint16 *ptr16 = (uint16 *)ptr;
 			for (uint32 i = 0; i < (len / 2); i++)
 				ptr16[i] = TO_BE_16(ptr16[i]);
@@ -297,7 +297,7 @@
 	_musicInitialized = 1;
 	_mixer->setVolumeForSoundType(SoundMixer::kMusicAudioDataType, ConfMan.getInt("music_volume"));
 
-	if (_vm->_gameType == GType_ITE) {
+	if (_vm->getGameType() == GType_ITE) {
 		File file;
 		byte footerBuf[ARRAYSIZE(_digiTableITECD) * 8];
 
@@ -406,7 +406,7 @@
 	MidiParser *parser;
 	File midiFile;
 
-	if (_vm->_gameType == GType_ITE) {
+	if (_vm->getGameType() == GType_ITE) {
 		if (music_rn >= 9 && music_rn <= 34) {
 			if (flags == MUSIC_DEFAULT) {
 				flags = _midiTableITECD[music_rn - 9].flags;
@@ -456,7 +456,7 @@
 	} else {
 		// Load MIDI/XMI resource data
 
-		if (_vm->_gameType == GType_ITE) {
+		if (_vm->getGameType() == GType_ITE) {
 			rsc_ctxt = _vm->getFileContext(GAME_RESOURCEFILE, 0);
 		} else {
 			// I've listened to music from both the FM and the GM

Index: palanim.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/palanim.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- palanim.cpp	1 Jan 2005 16:18:36 -0000	1.20
+++ palanim.cpp	11 Jan 2005 21:10:20 -0000	1.21
@@ -56,7 +56,7 @@
 
 	MemoryReadStreamEndian readS(resdata, resdata_len, IS_BIG_ENDIAN);
 
-	if (_vm->_gameType == GType_IHNM) {
+	if (_vm->getGameType() == GType_IHNM) {
 		return SUCCESS;
 	}
 

Index: rscfile.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/rscfile.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- rscfile.cpp	6 Jan 2005 14:02:53 -0000	1.19
+++ rscfile.cpp	11 Jan 2005 21:10:20 -0000	1.20
@@ -253,7 +253,7 @@
 			break;
 		}
 
-	if (!(_vm->_features & GF_WYRMKEEP))
+	if (!(_vm->getFeatures() & GF_WYRMKEEP))
 		substnum = -1;
 
 	if (substnum != -1) {
@@ -305,7 +305,7 @@
 int RSC_ConvertID(int id) {
 	int res = id;
 
-	if (_vm->_features & GF_MAC_RESOURCES) {
+	if (_vm->getFeatures() & GF_MAC_RESOURCES) {
 		if (res > 1537)
 			res -= 2;
 		else if (res == 1535 || res == 1536) {

Index: saga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.cpp,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- saga.cpp	10 Jan 2005 22:05:41 -0000	1.86
+++ saga.cpp	11 Jan 2005 21:10:20 -0000	1.87
@@ -42,7 +42,6 @@
 #include "saga/console.h"
 #include "saga/events.h"
 #include "saga/font.h"
-#include "saga/game.h"
 #include "saga/interface.h"
 #include "saga/isomap.h"
 #include "saga/script.h"
@@ -93,6 +92,8 @@
 	: Engine(syst) {
 
 	_console = NULL;
+	_gameFileContexts = NULL;
+	_quit = false;
 
 	// The Linux version of Inherit the Earth puts all data files in an
 	// 'itedata' sub-directory, except for voices.rsc
@@ -119,6 +120,32 @@
 }
 
 SagaEngine::~SagaEngine() {
+	int i;
+
+	delete _scene;
+	delete _actor;
+	delete _script;
+	delete _sprite;
+	delete _font;
+	delete _console;
+	delete _events;
+	delete _palanim;
+
+	delete _interface;
+	delete _render;
+	delete _isoMap;
+	delete _sndRes;
+	// Shutdown system modules */
+	delete _music;
+	delete _sound;
+	delete _anim;
+
+	if (_gameFileContexts != NULL) {
+		for (i = 0; i < _gameDescription->filesCount; i++) {
+			RSC_DestroyContext(_gameFileContexts[i]);
+		}
+	}
+	free(_gameFileContexts);
 }
 
 void SagaEngine::errorString(const char *buf1, char *buf2) {
@@ -224,7 +251,7 @@
 	_scene->startScene();
 	uint32 currentTicks;
 
-	for (;;) {
+	while(!_quit) {
 		if (_console->isAttached())
 			_console->onFrame();
 
@@ -244,7 +271,7 @@
 				msec = MAX_TIME_DELTA;
 			}
 
-			if (!_vm->_scene->isInDemo() && _gameType == GType_ITE)
+			if (!_vm->_scene->isInDemo() && getGameType() == GType_ITE)
 				if (_vm->_interface->getMode() == kPanelMain ||
 						 _vm->_interface->getMode() == kPanelConverse ||
 						 _vm->_interface->getMode() == kPanelNull)
@@ -258,29 +285,7 @@
 		_system->delayMillis(10);
 	}
 	
-	//return 0;
-}
-
-void SagaEngine::shutdown() {
-	delete _scene;
-	delete _actor;
-	delete _script;
-	delete _sprite;
-	delete _font;
-	delete _console;
-	delete _events;
-	delete _palanim;
-
-	delete _interface;
-	delete _render;
-	delete _isoMap;
-	delete _sndRes;
-	// Shutdown system modules */
-	delete _music;
-	delete _sound;
-	delete _anim;
-
-	_system->quit();
+	return 0;
 }
 
 void SagaEngine::loadStrings(StringsTable &stringsTable, const byte *stringsPointer, size_t stringsLength) {

Index: saga.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- saga.h	11 Jan 2005 13:25:01 -0000	1.70
+++ saga.h	11 Jan 2005 21:10:20 -0000	1.71
@@ -28,6 +28,7 @@
 #include "common/scummsys.h"
 #include "base/engine.h"
 #include "base/gameDetector.h"
+#include "base/plugins.h"
 
 #include "common/stream.h"
 #include "common/rect.h"
@@ -62,10 +63,16 @@
 #define GAME_ITE_LANG_PREFIX "ite_"
 #define GAME_LANG_EXT "lng"
 
+#define MIN_IMG_RLECODE    3
+#define MODEX_SCANLINE_LIMIT 200
+
+#define SAGA_IMAGE_DATA_OFFSET 776
+#define SAGA_IMAGE_HEADER_LEN  8
+
 #define PBOUNDS(n,max) (((n)>=(0))&&((n)<(max)))
 #define MAXPATH 512
 
-#define IS_BIG_ENDIAN ((_vm->_features & GF_BIG_ENDIAN_DATA) != 0)
+#define IS_BIG_ENDIAN ((_vm->getFeatures() & GF_BIG_ENDIAN_DATA) != 0)
 
 #define ID_NOTHING 0
 #define ID_PROTAG 1
@@ -124,6 +131,12 @@
 	kHitZoneTerminus = (1 << 3)
 };
 
+
+struct IMAGE_HEADER {
+	int width;
+	int height;
+};
+
 struct StringsTable {
 	byte *stringsPointer;
 	int stringsCount;
@@ -201,16 +214,6 @@
 	GAME_SOUND_VOX
 };
 
-enum GameFontIds {
-	GAME_FONT_SMALL = 0,
-	GAME_FONT_MEDIUM,
-	GAME_FONT_LARGE,
-	GAME_FONT_SMALL2,
-	GAME_FONT_MEDIUM2,
-	GAME_FONT_LARGE2,
-	GAME_FONT_LARGE3
-};
-
 enum GameFeatures {
 	GF_VOX_VOICES      = 1 << 0,
 	GF_BIG_ENDIAN_DATA = 1 << 1,
@@ -227,8 +230,7 @@
 };
 
 struct GameFontDescription {
-	uint16 font_id;
-	uint32 font_rn;
+	uint32 fontResourceId;
 };
 
 struct GameResourceDescription {
@@ -246,7 +248,36 @@
 struct GameDisplayInfo {
 	int logicalWidth;
 	int logicalHeight;
-	int scene_h;
+	
+	int pathStartY;
+	int sceneHeight;
+
+	int statusY;
+	int statusWidth;
+	int statusHeight;
+	int statusTextY;
+	int statusTextColor;
+	int statusBGColor;
+
+	int verbTextColor;
+	int verbTextShadowColor;
+	int verbTextActiveColor;
+
+	int leftPortraitX;
+	int leftPortraitY;
+	int rightPortraitX;
+	int rightPortraitY;
+
+	int inventoryX;
+	int inventoryY;
+	int inventoryRows;
+	int inventoryColumns;
+	int inventoryIconWidth;
+	int inventoryIconHeight;
+	int inventoryIconX;
+	int inventoryIconY;
+	int inventoryXSpacing;
+	int inventoryYSpacing;
 };
 
 struct GameDescription {
@@ -254,9 +285,7 @@
 	SAGAGameType gameType;
 	GameIds gameId;
 	const char *title;
-	int gd_logical_w;
-	int gd_logical_h;
-	int gd_scene_h;
+	GameDisplayInfo *gameDisplayInfo;
 	int startSceneNumber;
 	GameResourceDescription *resourceDescription;
 	int filesCount;
@@ -297,6 +326,8 @@
 	return objectId >> 13;
 }
 
+DetectedGameList GAME_ProbeGame(const FSList &fslist);
+
 class SagaEngine : public Engine {
 	void errorString(const char *buf_input, char *buf_output);
 
@@ -307,22 +338,12 @@
 public:
 	SagaEngine(GameDetector * detector, OSystem * syst);
 	virtual ~SagaEngine();
-
-	void shutdown();
+	void shutDown() { _quit = true; }
 
 	int _soundEnabled;
 	int _musicEnabled;
-	
-	char _gameLanguage[GAME_LANGSTR_LIMIT];
-	RSCFILE_CONTEXT **_gameFileContexts;
-
-//current game description
-	int _gameId;
-	int _gameType;
-	uint32 _features;
-	int _gameNumber;
-	GameDescription *_gameDescription;
 
+	
 	SndRes *_sndRes;
 	Sound *_sound;
 	Music *_music;
@@ -379,23 +400,39 @@
  private:
 	Point _mousePos;
 
+	bool _quit;
+	char _gameLanguage[GAME_LANGSTR_LIMIT];
+	RSCFILE_CONTEXT **_gameFileContexts;
+
+//current game description
+	int _gameNumber;
+	GameDescription *_gameDescription;
+	GameDisplayInfo _gameDisplayInfo;
+
 public:
 	int initGame(void);
 	RSCFILE_CONTEXT *getFileContext(uint16 type, int param);
 public:
 	const GameResourceDescription *getResourceDescription() { return _gameDescription->resourceDescription; }
 	const GameSoundInfo *getSoundInfo() { return _gameDescription->soundInfo; }
+
 	const GameFontDescription *getFontDescription(int index) { 
 		assert(index < _gameDescription->fontsCount);
 		return &_gameDescription->fontDescriptions[index];
 	}
 	int getFontsCount() const { return _gameDescription->fontsCount; }
 
-	int getStartSceneNumber() { return _gameDescription->startSceneNumber; }
-	int getDisplayWidth() { return _gameDescription->gd_logical_w; }
-	int getDisplayHeight() { return _gameDescription->gd_logical_h;}
-	int getStatusYOffset();
-	int getPathYOffset();
+	int getGameId() const { return _gameDescription->gameId; }
+	int getGameType() const { return _gameDescription->gameType; }
+	uint32 getFeatures() const { return _gameDescription->features; }
+	int getGameNumber() const { return _gameNumber; }
+	int getStartSceneNumber() const { return _gameDescription->startSceneNumber; }
+
+
+	int getDisplayWidth() const { return _gameDisplayInfo.logicalWidth; }
+	int getDisplayHeight() const { return _gameDisplayInfo.logicalHeight;}
+	int getSceneHeight() const { return _gameDisplayInfo.sceneHeight; }
+	const GameDisplayInfo & getDisplayInfo() { return _gameDisplayInfo; }
 private:
 	int loadLanguage(void);
 	int loadGame(int gameNumber);

Index: scene.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/scene.cpp,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- scene.cpp	9 Jan 2005 23:41:22 -0000	1.79
+++ scene.cpp	11 Jan 2005 21:10:20 -0000	1.80
@@ -80,8 +80,7 @@
 	_sceneMax = _sceneCount - 1;
 	_sceneLUT = (int *)malloc(_sceneMax * sizeof(*_sceneLUT));
 	if (_sceneLUT == NULL) {
-		warning("Scene::Scene(): Memory allocation failed");
-		return;
+		error("Scene::Scene(): Memory allocation failed");
 	}
 
 	MemoryReadStreamEndian readS(scene_lut_p, scene_lut_len, IS_BIG_ENDIAN);
@@ -171,7 +170,7 @@
 	event.op = EVENT_HIDE;
 	_vm->_events->queue(&event);
 
-	switch (_vm->_gameType) {
+	switch (_vm->getGameType()) {
 	case GType_ITE:
 		ITEStartProc();
 		break;
@@ -310,8 +309,8 @@
 }
 
 void Scene::getSlopes(int &beginSlope, int &endSlope) {
-	beginSlope = _vm->getStatusYOffset() - _desc.beginSlope; 
-	endSlope = _vm->getStatusYOffset() - _desc.endSlope;
+	beginSlope = _vm->getSceneHeight() - _desc.beginSlope; 
+	endSlope = _vm->getSceneHeight() - _desc.endSlope;
 }
 
 int Scene::getBGInfo(SCENE_BGINFO *bginfo) {
@@ -332,8 +331,8 @@
 		x = (_vm->getDisplayWidth() - _bg.w) / 2;
 	}
 
-	if (_bg.h < _vm->getStatusYOffset()) {
-		y = (_vm->getStatusYOffset() - _bg.h) / 2;
+	if (_bg.h < _vm->getSceneHeight()) {
+		y = (_vm->getSceneHeight() - _bg.h) / 2;
 	}
 
 	bginfo->bg_x = x;
@@ -909,7 +908,7 @@
 		_vm->_isoMap->draw(dst_s);
 	} else {
 		bufToSurface(dst_s, buf_info.bg_buf, _vm->getDisplayWidth(),
-						MAX(_vm->getStatusYOffset(), _bg.h), NULL, &bg_pt);
+						MAX(_vm->getSceneHeight(), _bg.h), NULL, &bg_pt);
 	}
 
 	return SUCCESS;

Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- sfuncs.cpp	9 Jan 2005 23:41:22 -0000	1.75
+++ sfuncs.cpp	11 Jan 2005 21:10:36 -0000	1.76
@@ -1054,7 +1054,7 @@
 	event.data = back_buf;
 	event.param = 138;
 	event.param2 = 0;
-	event.param3 = _vm->getStatusYOffset();
+	event.param3 = _vm->getSceneHeight();
 	event.param4 = 0;
 	event.param5 = _vm->getDisplayWidth();
 
@@ -1074,7 +1074,7 @@
 	text_entry.color = _vm->_gfx->getWhite();
 	text_entry.effect_color = _vm->_gfx->getBlack();
 	text_entry.text_x = _vm->getDisplayWidth() / 2;
-	text_entry.text_y = (_vm->getStatusYOffset() - _vm->_font->getHeight(MEDIUM_FONT_ID)) / 2;
+	text_entry.text_y = (_vm->getSceneHeight() - _vm->_font->getHeight(MEDIUM_FONT_ID)) / 2;
 	text_entry.font_id = MEDIUM_FONT_ID;
 	text_entry.flags = FONT_OUTLINE | FONT_CENTERED;
 	text_entry.string = getScriptString(stringId);

Index: sndres.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sndres.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- sndres.cpp	11 Jan 2005 08:32:10 -0000	1.39
+++ sndres.cpp	11 Jan 2005 21:10:36 -0000	1.40
@@ -78,7 +78,7 @@
 
 	debug(0, "SndRes::playVoice(%ld)", voice_rn);
 
-	if (_vm->_gameType == GType_ITE && voice_rn == 4) {
+	if (_vm->getGameType() == GType_ITE && voice_rn == 4) {
 		// The Wyrmkeep release of Inherit the Earth provides a
 		// separate file (p2_a.voc or P2_A.iaf), to correct voice 4 in
 		// the intro. Use that, if available.
@@ -122,7 +122,7 @@
 		return FAILURE;
 	}
 
-	if (_vm->_features & GF_VOX_VOICES && !voiceFile)
+	if (_vm->getFeatures() & GF_VOX_VOICES && !voiceFile)
 		_vm->_sound->playVoxVoice(&snd_buffer);
 	else
 		_vm->_sound->playVoice(&snd_buffer);
@@ -241,7 +241,7 @@
 	// (p2_a.voc or P2_A.iaf), to correct voice 4 in the intro. Use that,
 	// if available.
 
-	if (_vm->_gameType == GType_ITE && voice_rn == 4) {
+	if (_vm->getGameType() == GType_ITE && voice_rn == 4) {
 		if (f.open("p2_a.voc")) {
 			result = SUCCESS;
 			length = f.size();
@@ -265,7 +265,7 @@
 		}
 	}
 
-	if (_vm->_features & GF_VOX_VOICES && !voiceFile) {
+	if (_vm->getFeatures() & GF_VOX_VOICES && !voiceFile) {
 		// Rough hack, fix this to be accurate
 		ms_f = (double)length / 22050 * 2000.0;
 		ms_i = (int)ms_f;

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sound.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- sound.cpp	1 Jan 2005 16:18:36 -0000	1.21
+++ sound.cpp	11 Jan 2005 21:10:36 -0000	1.22
@@ -166,7 +166,7 @@
 
 	if (buf->s_samplebits == 16) {
 		flags |= SoundMixer::FLAG_16BITS;
-		if (!(_vm->_features & GF_BIG_ENDIAN_DATA))
+		if (!(_vm->getFeatures() & GF_BIG_ENDIAN_DATA))
 			flags |= SoundMixer::FLAG_LITTLE_ENDIAN;
 	}
 	if (buf->s_stereo)

Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sprite.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- sprite.cpp	9 Jan 2005 15:36:54 -0000	1.40
+++ sprite.cpp	11 Jan 2005 21:10:36 -0000	1.41
@@ -106,7 +106,7 @@
 
 	for (i = oldSpriteCount; i < spriteList.spriteCount; i++) {
 		spriteInfo = &spriteList.infoList[i];
-		if (_vm->_features & GF_MAC_RESOURCES)
+		if (_vm->getFeatures() & GF_MAC_RESOURCES)
 			offset = readS.readUint32();
 		else
 			offset = readS.readUint16();
@@ -118,9 +118,9 @@
 		spritePointer = spriteListData;
 		spritePointer += offset;
 
-		MemoryReadStream readS2(spritePointer, (_vm->_features & GF_MAC_RESOURCES) ? 8 : 4);
+		MemoryReadStream readS2(spritePointer, (_vm->getFeatures() & GF_MAC_RESOURCES) ? 8 : 4);
 
-		if (!(_vm->_features & GF_MAC_RESOURCES)) {
+		if (!(_vm->getFeatures() & GF_MAC_RESOURCES)) {
 			spriteInfo->xAlign = readS2.readSByte();
 			spriteInfo->yAlign = readS2.readSByte();
 

Index: sthread.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sthread.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- sthread.cpp	8 Jan 2005 20:30:07 -0000	1.56
+++ sthread.cpp	11 Jan 2005 21:10:36 -0000	1.57
@@ -758,7 +758,7 @@
 				}
 				// now data contains last string index
 
-				if (_vm->_gameId == GID_ITE_DISK_G) { // special ITE dos
+				if (_vm->getGameId() == GID_ITE_DISK_G) { // special ITE dos
 					if ((_vm->_scene->currentSceneNumber() == ITE_DEFAULT_SCENE) && (data >= 288) && (data <= (RID_SCENE1_VOICE_138 - RID_SCENE1_VOICE_009 + 288))) {
 						sampleResourceId = RID_SCENE1_VOICE_009 + data - 288;
 					}





More information about the Scummvm-git-logs mailing list