[Scummvm-cvs-logs] SF.net SVN: scummvm:[38984] scummvm/trunk/engines/sci

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Feb 28 23:19:23 CET 2009


Revision: 38984
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38984&view=rev
Author:   fingolfin
Date:     2009-02-28 22:19:22 +0000 (Sat, 28 Feb 2009)

Log Message:
-----------
SCI: Renamed ResourceManager::sci_version to _sciVersion, to avoid var shadowing warnings; some other tweaks

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/engine/game.cpp
    scummvm/trunk/engines/sci/engine/kernel.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/savegame.cfsml
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/engine/scriptconsole.cpp
    scummvm/trunk/engines/sci/sci.cpp
    scummvm/trunk/engines/sci/scicore/resource.cpp
    scummvm/trunk/engines/sci/scicore/resource.h
    scummvm/trunk/engines/sci/scicore/vocab_debug.cpp

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2009-02-28 22:10:07 UTC (rev 38983)
+++ scummvm/trunk/engines/sci/console.cpp	2009-02-28 22:19:22 UTC (rev 38984)
@@ -45,7 +45,7 @@
 bool Console::cmdGetVersion(int argc, const char **argv) {
 	int ver = _vm->getVersion();
 
-	DebugPrintf("Resource file version:        %s\n", sci_version_types[_vm->getResMgr()->sci_version]);
+	DebugPrintf("Resource file version:        %s\n", sci_version_types[_vm->getResMgr()->_sciVersion]);
 
 	DebugPrintf("Emulated interpreter version: %d.%03d.%03d\n",
 		SCI_VERSION_MAJOR(ver), SCI_VERSION_MINOR(ver), SCI_VERSION_PATCHLEVEL(ver));

Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp	2009-02-28 22:10:07 UTC (rev 38983)
+++ scummvm/trunk/engines/sci/engine/game.cpp	2009-02-28 22:19:22 UTC (rev 38984)
@@ -47,7 +47,7 @@
 
 	sciprintf("Initializing vocabulary\n");
 
-	if ((s->resmgr->sci_version < SCI_VERSION_01_VGA) && (s->parser_words = vocab_get_words(s->resmgr, &(s->parser_words_nr)))) {
+	if ((s->resmgr->_sciVersion < SCI_VERSION_01_VGA) && (s->parser_words = vocab_get_words(s->resmgr, &(s->parser_words_nr)))) {
 		s->parser_suffices = vocab_get_suffices(s->resmgr, &(s->parser_suffices_nr));
 		if ((s->parser_branches = vocab_get_branches(s->resmgr, &(s->parser_branches_nr))))
 			// Now build a GNF grammar out of this
@@ -124,7 +124,7 @@
 	gfx_color_t transparent;
 	sciprintf("Initializing graphics\n");
 
-	if (s->resmgr->sci_version <= SCI_VERSION_01) {
+	if (s->resmgr->_sciVersion <= SCI_VERSION_01) {
 		int i;
 
 		for (i = 0; i < 16; i++) {
@@ -185,7 +185,7 @@
 	font_nr = -1;
 	do {
 		resource = s->resmgr->testResource(sci_font, ++font_nr);
-	} while ((!resource) && (font_nr < sci_max_resource_nr[s->resmgr->sci_version]));
+	} while ((!resource) && (font_nr < sci_max_resource_nr[s->resmgr->_sciVersion]));
 
 	if (!resource) {
 		sciprintf("No text font was found.\n");
@@ -198,7 +198,7 @@
 	s->iconbar_port = gfxw_new_port(s->visual, NULL, gfx_rect(0, 0, 320, 200), s->ega_colors[0], transparent);
 	s->iconbar_port->flags |= GFXW_FLAG_NO_IMPLICIT_SWITCH;
 
-	if (s->resmgr->sci_version >= SCI_VERSION_01_VGA) {
+	if (s->resmgr->_sciVersion >= SCI_VERSION_01_VGA) {
 		// This bit sets the foreground and background colors in VGA SCI games
 		gfx_color_t fgcolor;
 		gfx_color_t bgcolor;
@@ -267,7 +267,7 @@
 }
 
 int game_init_sound(EngineState *s, int sound_flags) {
-	if (s->resmgr->sci_version >= SCI_VERSION_01)
+	if (s->resmgr->_sciVersion >= SCI_VERSION_01)
 		sound_flags |= SFX_STATE_FLAG_MULTIPLAY;
 
 	s->sfx_init_flags = sound_flags;
@@ -611,7 +611,7 @@
 	s->successor = NULL; // No successor
 	s->status_bar_text = NULL; // Status bar is blank
 	s->status_bar_foreground = 0;
-	s->status_bar_background = s->resmgr->sci_version >= SCI_VERSION_01_VGA ? 255 : 15;
+	s->status_bar_background = s->resmgr->_sciVersion >= SCI_VERSION_01_VGA ? 255 : 15;
 
 	SystemString *str = &s->sys_strings->strings[SYS_STRING_PARSER_BASE];
 	str->name = strdup("parser-base");

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2009-02-28 22:10:07 UTC (rev 38983)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2009-02-28 22:19:22 UTC (rev 38984)
@@ -736,7 +736,7 @@
 	int mapped = 0;
 	int ignored = 0;
 	int functions_nr = s->kernel_names_nr;
-	int max_functions_nr = sci_max_allowed_unknown_kernel_functions[s->resmgr->sci_version];
+	int max_functions_nr = sci_max_allowed_unknown_kernel_functions[s->resmgr->_sciVersion];
 
 	if (functions_nr < max_functions_nr) {
 		warning("SCI version believed to have %d kernel"

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-02-28 22:10:07 UTC (rev 38983)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-02-28 22:19:22 UTC (rev 38984)
@@ -270,7 +270,7 @@
 static gfx_pixmap_color_t white = {GFX_COLOR_INDEX_UNMAPPED, 255, 255, 255};
 
 gfx_pixmap_color_t *get_pic_color(EngineState *s, int color) {
-	if (s->resmgr->sci_version < SCI_VERSION_01_VGA)
+	if (s->resmgr->_sciVersion < SCI_VERSION_01_VGA)
 		return &(s->ega_colors[color].visual);
 
 	if (color == 255)
@@ -287,7 +287,7 @@
 static gfx_color_t graph_map_color(EngineState *s, int color, int priority, int control) {
 	gfx_color_t retval;
 
-	if (s->resmgr->sci_version < SCI_VERSION_01_VGA) {
+	if (s->resmgr->_sciVersion < SCI_VERSION_01_VGA) {
 		retval = s->ega_colors[(color >=0 && color < 16)? color : 0];
 		gfxop_set_color(s->gfx_state, &retval, (color < 0) ? -1 : retval.visual.r, retval.visual.g, retval.visual.b,
 		                (color == -1) ? 255 : 0, priority, control);
@@ -506,7 +506,7 @@
 
 	case K_GRAPH_GET_COLORS_NR:
 
-		return make_reg(0, (s->resmgr->sci_version < SCI_VERSION_01_VGA) ? 0x10 : 0x100);
+		return make_reg(0, (s->resmgr->_sciVersion < SCI_VERSION_01_VGA) ? 0x10 : 0x100);
 		break;
 
 	case K_GRAPH_DRAW_LINE: {
@@ -2463,7 +2463,7 @@
 	bgcolor.mask = 0;
 
 	if (SKPV_OR_ALT(8 + argextra, 255) >= 0) {
-		if (s->resmgr->sci_version < SCI_VERSION_01_VGA)
+		if (s->resmgr->_sciVersion < SCI_VERSION_01_VGA)
 			bgcolor.visual = *(get_pic_color(s, SKPV_OR_ALT(8 + argextra, 15)));
 		else
 			bgcolor.visual = *(get_pic_color(s, SKPV_OR_ALT(8 + argextra, 255)));
@@ -2481,7 +2481,7 @@
 	black.visual = *(get_pic_color(s, 0));
 	black.mask = GFX_MASK_VISUAL;
 	black.alpha = 0;
-	lWhite.visual = *(get_pic_color(s, s->resmgr->sci_version < SCI_VERSION_01_VGA ? 15 : 255)), lWhite.mask = GFX_MASK_VISUAL;
+	lWhite.visual = *(get_pic_color(s, s->resmgr->_sciVersion < SCI_VERSION_01_VGA ? 15 : 255)), lWhite.mask = GFX_MASK_VISUAL;
 	lWhite.alpha = 0;
 
 	window = sciw_new_window(s, gfx_rect(x, y, xl, yl), s->titlebar_port->font_nr, fgcolor, bgcolor,
@@ -3131,10 +3131,10 @@
 
 			temp = KP_SINT(argv[argpt++]);
 			SCIkdebug(SCIkGRAPHICS, "Display: set_color(%d)\n", temp);
-			if ((s->resmgr->sci_version < SCI_VERSION_01_VGA) && temp >= 0 && temp <= 15)
+			if ((s->resmgr->_sciVersion < SCI_VERSION_01_VGA) && temp >= 0 && temp <= 15)
 				color0 = (s->ega_colors[temp]);
 			else
-				if ((s->resmgr->sci_version >= SCI_VERSION_01_VGA) && temp >= 0 && temp < 256) {
+				if ((s->resmgr->_sciVersion >= SCI_VERSION_01_VGA) && temp >= 0 && temp < 256) {
 					color0.visual = *(get_pic_color(s, temp));
 					color0.mask = GFX_MASK_VISUAL;
 				} else
@@ -3148,10 +3148,10 @@
 
 			temp = KP_SINT(argv[argpt++]);
 			SCIkdebug(SCIkGRAPHICS, "Display: set_bg_color(%d)\n", temp);
-			if ((s->resmgr->sci_version < SCI_VERSION_01_VGA) && temp >= 0 && temp <= 15)
+			if ((s->resmgr->_sciVersion < SCI_VERSION_01_VGA) && temp >= 0 && temp <= 15)
 				bg_color = s->ega_colors[temp];
 			else
-				if ((s->resmgr->sci_version >= SCI_VERSION_01_VGA) && temp >= 0 && temp <= 256) {
+				if ((s->resmgr->_sciVersion >= SCI_VERSION_01_VGA) && temp >= 0 && temp <= 256) {
 					bg_color.visual = *get_pic_color(s, temp);
 					bg_color.mask = GFX_MASK_VISUAL;
 				} else

Modified: scummvm/trunk/engines/sci/engine/savegame.cfsml
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cfsml	2009-02-28 22:10:07 UTC (rev 38983)
+++ scummvm/trunk/engines/sci/engine/savegame.cfsml	2009-02-28 22:19:22 UTC (rev 38984)
@@ -846,7 +846,7 @@
 }
 
 static void load_script(EngineState *s, SegmentId seg) {
-	resource_t *script, *heap = NULL;
+	Resource *script, *heap = NULL;
 	Script *scr = &(s->seg_manager->heap[seg]->data.script);
 
 	scr->buf = (byte *)malloc(scr->buf_size);
@@ -1007,7 +1007,7 @@
 
 static void reconstruct_sounds(EngineState *s) {
 	song_t *seeker;
-	int it_type = s->resmgr->sci_version >= SCI_VERSION_01 ? SCI_SONG_ITERATOR_TYPE_SCI1 : SCI_SONG_ITERATOR_TYPE_SCI0;
+	int it_type = s->resmgr->_sciVersion >= SCI_VERSION_01 ? SCI_SONG_ITERATOR_TYPE_SCI1 : SCI_SONG_ITERATOR_TYPE_SCI0;
 
 	if (s->sound.songlib.lib)
 		seeker = *(s->sound.songlib.lib);

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2009-02-28 22:10:07 UTC (rev 38983)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2009-02-28 22:19:22 UTC (rev 38984)
@@ -5103,7 +5103,7 @@
 
 static void reconstruct_sounds(EngineState *s) {
 	song_t *seeker;
-	int it_type = s->resmgr->sci_version >= SCI_VERSION_01 ? SCI_SONG_ITERATOR_TYPE_SCI1 : SCI_SONG_ITERATOR_TYPE_SCI0;
+	int it_type = s->resmgr->_sciVersion >= SCI_VERSION_01 ? SCI_SONG_ITERATOR_TYPE_SCI1 : SCI_SONG_ITERATOR_TYPE_SCI0;
 
 	if (s->sound.songlib.lib)
 		seeker = *(s->sound.songlib.lib);

Modified: scummvm/trunk/engines/sci/engine/scriptconsole.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/scriptconsole.cpp	2009-02-28 22:10:07 UTC (rev 38983)
+++ scummvm/trunk/engines/sci/engine/scriptconsole.cpp	2009-02-28 22:19:22 UTC (rev 38984)
@@ -840,7 +840,7 @@
 				if (res == -1)
 					sciprintf("Unknown resource type: '%s'\n", cmd_params[0].str);
 				else {
-					for (i = 0; i < sci_max_resource_nr[s->resmgr->sci_version]; i++)
+					for (i = 0; i < sci_max_resource_nr[s->resmgr->_sciVersion]; i++)
 						if (s->resmgr->testResource(res, i))
 							sciprintf("%s.%03d\n", sci_resource_types[res], i);
 				}

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2009-02-28 22:10:07 UTC (rev 38983)
+++ scummvm/trunk/engines/sci/sci.cpp	2009-02-28 22:19:22 UTC (rev 38984)
@@ -214,7 +214,7 @@
 		return Common::kNoGameDataFoundError;
 	}
 
-	script_adjust_opcode_formats(_resmgr->sci_version);
+	script_adjust_opcode_formats(_resmgr->_sciVersion);
 
 #if 0
 	printf("Mapping instruments to General Midi\n");
@@ -247,7 +247,7 @@
 
 	gfx_state_t gfx_state;
 	gfx_state.driver = &gfx_driver_scummvm;
-	gfx_state.version = _resmgr->sci_version;
+	gfx_state.version = _resmgr->_sciVersion;
 	gamestate->gfx_state = &gfx_state;
 
 	// Default config:

Modified: scummvm/trunk/engines/sci/scicore/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/resource.cpp	2009-02-28 22:10:07 UTC (rev 38983)
+++ scummvm/trunk/engines/sci/scicore/resource.cpp	2009-02-28 22:19:22 UTC (rev 38984)
@@ -225,12 +225,12 @@
 
 	// First try lower-case name
 	if (res->source->source_type == RESSOURCE_TYPE_DIRECTORY) {
-		if (!patch_sprintfers[sci_version]) {
-			error("Resource manager's SCI version (%d) has no patch file name printers", sci_version);
+		if (!patch_sprintfers[_sciVersion]) {
+			error("Resource manager's SCI version (%d) has no patch file name printers", _sciVersion);
 		}
 
 		// Get patch file name
-		patch_sprintfers[sci_version](filename, res);
+		patch_sprintfers[_sciVersion](filename, res);
 
 		// FIXME: Instead of using SearchMan, maybe we should only search
 		// a single dir specified by this RESSOURCE_TYPE_DIRECTORY ResourceSource?
@@ -249,12 +249,12 @@
 
 	if (res->source->source_type == RESSOURCE_TYPE_DIRECTORY)
 		loadFromPatchFile(file, res, filename);
-	else if (!decompressors[sci_version]) {
+	else if (!decompressors[_sciVersion]) {
 		// Check whether we support this at all
-		error("Resource manager's SCI version (%d) is invalid", sci_version);
+		error("Resource manager's SCI version (%d) is invalid", _sciVersion);
 	} else {
 		int error = // Decompress from regular resource file
-		    decompressors[sci_version](res, file, sci_version);
+		    decompressors[_sciVersion](res, file, _sciVersion);
 
 		if (error) {
 			sciprintf("Error %d occured while reading %s.%03d from resource file: %s\n",
@@ -287,7 +287,7 @@
 	Resource *res;
 	int i;
 
-	mgr->sci_version = SCI_VERSION_AUTODETECT;
+	mgr->_sciVersion = SCI_VERSION_AUTODETECT;
 
 	for (i = 0; i < 1000; i++) {
 		res = mgr->testResource(sci_view, i);
@@ -308,8 +308,8 @@
 		file.close();
 
 		if (compression == 3) {
-			mgr->sci_version = SCI_VERSION_01_VGA;
-			return mgr->sci_version;
+			mgr->_sciVersion = SCI_VERSION_01_VGA;
+			return mgr->_sciVersion;
 		}
 	}
 
@@ -333,12 +333,12 @@
 		file.close();
 
 		if (compression == 3) {
-			mgr->sci_version = SCI_VERSION_01_VGA;
-			return mgr->sci_version;
+			mgr->_sciVersion = SCI_VERSION_01_VGA;
+			return mgr->_sciVersion;
 		}
 	}
 
-	return mgr->sci_version;
+	return mgr->_sciVersion;
 }
 
 int ResourceManager::addAppropriateSources() {
@@ -364,15 +364,15 @@
 }
 
 int ResourceManager::scanNewSources(int *detected_version, ResourceSource *source) {
-	int preset_version = sci_version;
+	int preset_version = _sciVersion;
 	int resource_error = 0;
-	int dummy = sci_version;
+	int dummy = _sciVersion;
 	//Resource **concat_ptr = &(mgr->_resources[mgr->_resourcesNr - 1].next);
 
 	if (detected_version == NULL)
 		detected_version = &dummy;
 
-	*detected_version = sci_version;
+	*detected_version = _sciVersion;
 	if (source->next)
 		scanNewSources(detected_version, source->next);
 
@@ -380,7 +380,7 @@
 		source->scanned = true;
 		switch (source->source_type) {
 		case RESSOURCE_TYPE_DIRECTORY:
-			if (sci_version <= SCI_VERSION_01)
+			if (_sciVersion <= SCI_VERSION_01)
 				readResourcePatchesSCI0(source);
 			else
 				readResourcePatchesSCI1(source);
@@ -426,7 +426,7 @@
 				}
 			}
 
-			sci_version = *detected_version;
+			_sciVersion = *detected_version;
 			break;
 		default:
 			break;
@@ -455,7 +455,7 @@
 	_resources = NULL;
 	_resourcesNr = 0;
 	_sources = NULL;
-	sci_version = version;
+	_sciVersion = version;
 
 	lru_first = NULL;
 	lru_last = NULL;
@@ -517,11 +517,11 @@
 		case SCI_VERSION_1: {
 			Resource *res = testResource(sci_script, 0);
 
-			sci_version = version = SCI_VERSION_1_EARLY;
+			_sciVersion = version = SCI_VERSION_1_EARLY;
 			loadResource(res, true);
 
 			if (res->status == SCI_STATUS_NOMALLOC)
-				sci_version = version = SCI_VERSION_1_LATE;
+				_sciVersion = version = SCI_VERSION_1_LATE;
 			break;
 		}
 		case SCI_VERSION_1_1:
@@ -536,7 +536,7 @@
 		qsort(_resources, _resourcesNr, sizeof(Resource), resourcecmp); // Sort resources
 	}
 
-	sci_version = version;
+	_sciVersion = version;
 }
 
 void ResourceManager::freeAltSources(resource_altsource_t *dynressrc) {
@@ -546,10 +546,10 @@
 	}
 }
 
-void ResourceManager::freeResources(Resource *resources, int _resourcesNr) {
+void ResourceManager::freeResources(Resource *resources, int resourcesNr) {
 	int i;
 
-	for (i = 0; i < _resourcesNr; i++) {
+	for (i = 0; i < resourcesNr; i++) {
 		Resource *res = resources + i;
 
 		// FIXME: alt_sources->next may point to an invalid memory location
@@ -658,8 +658,8 @@
 Resource *ResourceManager::findResource(int type, int number, int lock) {
 	Resource *retval;
 
-	if (number >= sci_max_resource_nr[sci_version]) {
-		int modded_number = number % sci_max_resource_nr[sci_version];
+	if (number >= sci_max_resource_nr[_sciVersion]) {
+		int modded_number = number % sci_max_resource_nr[_sciVersion];
 		sciprintf("[resmgr] Requested invalid resource %s.%d, mapped to %s.%d\n",
 		          sci_resource_types[type], number, sci_resource_types[type], modded_number);
 		number = modded_number;

Modified: scummvm/trunk/engines/sci/scicore/resource.h
===================================================================
--- scummvm/trunk/engines/sci/scicore/resource.h	2009-02-28 22:10:07 UTC (rev 38983)
+++ scummvm/trunk/engines/sci/scicore/resource.h	2009-02-28 22:19:22 UTC (rev 38984)
@@ -162,7 +162,7 @@
 
 class ResourceManager {
 public:
-	int sci_version; /* SCI resource version to use */
+	int _sciVersion; /* SCI resource version to use */
 	/**
 	 * Creates a new FreeSCI resource manager.
 	 * @param version		The SCI version to look for; use SCI_VERSION_AUTODETECT

Modified: scummvm/trunk/engines/sci/scicore/vocab_debug.cpp
===================================================================
--- scummvm/trunk/engines/sci/scicore/vocab_debug.cpp	2009-02-28 22:10:07 UTC (rev 38983)
+++ scummvm/trunk/engines/sci/scicore/vocab_debug.cpp	2009-02-28 22:19:22 UTC (rev 38984)
@@ -367,7 +367,7 @@
 }
 
 char **vocabulary_get_knames(ResourceManager *resmgr, int *count) {
-	switch (resmgr->sci_version) {
+	switch (resmgr->_sciVersion) {
 	case SCI_VERSION_0:
 	case SCI_VERSION_01:
 	case SCI_VERSION_01_VGA:


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list