From d7b06b7d4267c0ea6ff537455f940deed303eefb Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 28 Feb 2009 22:19:22 +0000 Subject: SCI: Renamed ResourceManager::sci_version to _sciVersion, to avoid var shadowing warnings; some other tweaks svn-id: r38984 --- engines/sci/console.cpp | 2 +- engines/sci/engine/game.cpp | 12 ++++----- engines/sci/engine/kernel.cpp | 2 +- engines/sci/engine/kgraphics.cpp | 18 ++++++------- engines/sci/engine/savegame.cfsml | 4 +-- engines/sci/engine/savegame.cpp | 2 +- engines/sci/engine/scriptconsole.cpp | 2 +- engines/sci/sci.cpp | 4 +-- engines/sci/scicore/resource.cpp | 50 ++++++++++++++++++------------------ engines/sci/scicore/resource.h | 2 +- engines/sci/scicore/vocab_debug.cpp | 2 +- 11 files changed, 50 insertions(+), 50 deletions(-) (limited to 'engines') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 558121f133..31fac56bae 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -45,7 +45,7 @@ Console::~Console() { 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)); diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp index 3b53dcb659..597735d771 100644 --- a/engines/sci/engine/game.cpp +++ b/engines/sci/engine/game.cpp @@ -47,7 +47,7 @@ static int _init_vocabulary(EngineState *s) { // initialize vocabulary and relat 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 @@ int _reset_graphics_input(EngineState *s) { 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 @@ int _reset_graphics_input(EngineState *s) { 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 @@ int _reset_graphics_input(EngineState *s) { 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 @@ static void _free_graphics_input(EngineState *s) { } 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 @@ int game_init(EngineState *s) { 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"); diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index afd01ee17a..f36f34dd92 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -736,7 +736,7 @@ int script_map_kernel(EngineState *s) { 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" diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index b90153e98d..522ca74d5b 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -270,7 +270,7 @@ void graph_restore_box(EngineState *s, reg_t handle) { 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 @@ gfx_pixmap_color_t *get_pic_color(EngineState *s, int color) { 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 @@ reg_t kGraph(EngineState *s, int funct_nr, int argc, reg_t *argv) { 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 @@ reg_t kNewWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) { 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 @@ reg_t kNewWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) { 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 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { 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 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) { 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 diff --git a/engines/sci/engine/savegame.cfsml b/engines/sci/engine/savegame.cfsml index 9d8833715e..6de4b737fc 100644 --- a/engines/sci/engine/savegame.cfsml +++ b/engines/sci/engine/savegame.cfsml @@ -846,7 +846,7 @@ static int clone_entry_used(CloneTable *table, int n) { } 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 @@ song_iterator_t *new_fast_forward_iterator(song_iterator_t *it, int delta); 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); diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index dedcc84090..02c11a5d7a 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -5103,7 +5103,7 @@ song_iterator_t *new_fast_forward_iterator(song_iterator_t *it, int delta); 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); diff --git a/engines/sci/engine/scriptconsole.cpp b/engines/sci/engine/scriptconsole.cpp index f46c3ccf5c..ca7cdcfd18 100644 --- a/engines/sci/engine/scriptconsole.cpp +++ b/engines/sci/engine/scriptconsole.cpp @@ -840,7 +840,7 @@ static int c_list(EngineState *s) { 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); } diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 04113284fe..ff3c8c4e79 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -214,7 +214,7 @@ Common::Error SciEngine::go() { 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 @@ Common::Error SciEngine::go() { 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: diff --git a/engines/sci/scicore/resource.cpp b/engines/sci/scicore/resource.cpp index f438212594..75448d6ab9 100644 --- a/engines/sci/scicore/resource.cpp +++ b/engines/sci/scicore/resource.cpp @@ -225,12 +225,12 @@ void ResourceManager::loadResource(Resource *res, bool protect) { // 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 @@ void ResourceManager::loadResource(Resource *res, bool protect) { 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 @@ int sci_test_view_type(ResourceManager *mgr) { 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 @@ int sci_test_view_type(ResourceManager *mgr) { 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 @@ int sci_test_view_type(ResourceManager *mgr) { 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::addAppropriateSources() { } 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 @@ int ResourceManager::scanNewSources(int *detected_version, ResourceSource *sourc 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 @@ int ResourceManager::scanNewSources(int *detected_version, ResourceSource *sourc } } - sci_version = *detected_version; + _sciVersion = *detected_version; break; default: break; @@ -455,7 +455,7 @@ ResourceManager::ResourceManager(int version, int maxMemory) { _resources = NULL; _resourcesNr = 0; _sources = NULL; - sci_version = version; + _sciVersion = version; lru_first = NULL; lru_last = NULL; @@ -517,11 +517,11 @@ ResourceManager::ResourceManager(int version, int maxMemory) { 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 @@ ResourceManager::ResourceManager(int version, int maxMemory) { 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::freeAltSources(resource_altsource_t *dynressrc) { } } -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 @@ void ResourceManager::freeOldResources(int last_invulnerable) { 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; diff --git a/engines/sci/scicore/resource.h b/engines/sci/scicore/resource.h index 08a5f97001..3d74ecb982 100644 --- a/engines/sci/scicore/resource.h +++ b/engines/sci/scicore/resource.h @@ -162,7 +162,7 @@ public: 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 diff --git a/engines/sci/scicore/vocab_debug.cpp b/engines/sci/scicore/vocab_debug.cpp index b5d8dd5d55..a2e2739a8f 100644 --- a/engines/sci/scicore/vocab_debug.cpp +++ b/engines/sci/scicore/vocab_debug.cpp @@ -367,7 +367,7 @@ static char **vocabulary_get_knames1(ResourceManager *resmgr, int *count) { } 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: -- cgit v1.2.3