aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2011-10-19 23:44:34 +0300
committerFilippos Karapetis2011-10-19 23:52:51 +0300
commit935eaa175bb6df628f0118e70a59b895f65e92a1 (patch)
tree14f5b5ec5441418a1ba94b937bc3db2f24c88835
parent9549583242f4efc445f134c63109f599319b1e26 (diff)
downloadscummvm-rg350-935eaa175bb6df628f0118e70a59b895f65e92a1.tar.gz
scummvm-rg350-935eaa175bb6df628f0118e70a59b895f65e92a1.tar.bz2
scummvm-rg350-935eaa175bb6df628f0118e70a59b895f65e92a1.zip
SCI: Move the palette merging checking code inside the GfxPalette class
-rw-r--r--engines/sci/graphics/palette.cpp11
-rw-r--r--engines/sci/graphics/palette.h2
-rw-r--r--engines/sci/resource.cpp2
-rw-r--r--engines/sci/resource.h2
-rw-r--r--engines/sci/sci.cpp11
5 files changed, 13 insertions, 15 deletions
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index a96d40b948..b52af38675 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -37,7 +37,7 @@
namespace Sci {
-GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen, bool useMerging)
+GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen)
: _resMan(resMan), _screen(screen) {
int16 color;
@@ -65,7 +65,14 @@ GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen, bool useMergi
// the real merging done in earlier games. If we use the copying over, we
// will get issues because some views have marked all colors as being used
// and those will overwrite the current palette in that case
- _useMerging = useMerging;
+ if (getSciVersion() < SCI_VERSION_1_1)
+ _useMerging = true;
+ else if (getSciVersion() == SCI_VERSION_1_1)
+ // there are some games that use inbetween SCI1.1 interpreter, so we have
+ // to detect if the current game is merging or copying
+ _useMerging = _resMan->detectPaletteMergingSci11();
+ else // SCI32
+ _useMerging = false;
palVaryInit();
diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h
index 243420cc47..a9ea1c32de 100644
--- a/engines/sci/graphics/palette.h
+++ b/engines/sci/graphics/palette.h
@@ -36,7 +36,7 @@ class GfxScreen;
*/
class GfxPalette : public Common::Serializable {
public:
- GfxPalette(ResourceManager *resMan, GfxScreen *screen, bool useMerging);
+ GfxPalette(ResourceManager *resMan, GfxScreen *screen);
~GfxPalette();
bool isMerging();
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index d1eb350c94..c50d1b8d8a 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -2355,7 +2355,7 @@ bool ResourceManager::detectFontExtended() {
}
// detects, if SCI1.1 game uses palette merging or copying - this is supposed to only get used on SCI1.1 games
-bool ResourceManager::detectForPaletteMergingForSci11() {
+bool ResourceManager::detectPaletteMergingSci11() {
// Load palette 999 (default palette)
Resource *res = findResource(ResourceId(kResourceTypePalette, 999), false);
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index f450f1b397..47602de017 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -354,7 +354,7 @@ public:
// Detects, if standard font of current game includes extended characters (>0x80)
bool detectFontExtended();
// Detects, if SCI1.1 game uses palette merging
- bool detectForPaletteMergingForSci11();
+ bool detectPaletteMergingSci11();
// Detects, if SCI0EARLY game also has SCI0EARLY sound resources
bool detectEarlySound();
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 6c1b6e4dd6..1d0d63870d 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -609,16 +609,7 @@ void SciEngine::initGraphics() {
if (hasMacIconBar())
_gfxMacIconBar = new GfxMacIconBar();
- bool paletteMerging = true;
- if (getSciVersion() >= SCI_VERSION_1_1) {
- // there are some games that use inbetween SCI1.1 interpreter, so we have to detect if it's merging or copying
- if (getSciVersion() == SCI_VERSION_1_1)
- paletteMerging = _resMan->detectForPaletteMergingForSci11();
- else
- paletteMerging = false;
- }
-
- _gfxPalette = new GfxPalette(_resMan, _gfxScreen, paletteMerging);
+ _gfxPalette = new GfxPalette(_resMan, _gfxScreen);
_gfxCache = new GfxCache(_resMan, _gfxScreen, _gfxPalette);
_gfxCursor = new GfxCursor(_resMan, _gfxPalette, _gfxScreen);