[Scummvm-cvs-logs] scummvm master -> d95b5331fb266de492c45d348ccb8313ca7824aa

bluegr md5 at scummvm.org
Fri Mar 4 21:06:38 CET 2011


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
bc992d77de SCI: Enable fade transitions for SCI1 EGA games
5b9677da72 SCI: Cleaned up some view type checks
d95b5331fb SCI: Some palette related changes


Commit: bc992d77de75076aae5badde98755b1db6b9d9a5
    https://github.com/scummvm/scummvm/commit/bc992d77de75076aae5badde98755b1db6b9d9a5
Author: md5 (md5 at scummvm.org)
Date: 2011-03-04T12:04:11-08:00

Commit Message:
SCI: Enable fade transitions for SCI1 EGA games

Changed paths:
    engines/sci/graphics/transitions.cpp
    engines/sci/graphics/transitions.h
    engines/sci/sci.cpp



diff --git a/engines/sci/graphics/transitions.cpp b/engines/sci/graphics/transitions.cpp
index 7643812..fac9a97 100644
--- a/engines/sci/graphics/transitions.cpp
+++ b/engines/sci/graphics/transitions.cpp
@@ -39,8 +39,8 @@ namespace Sci {
 
 //#define DISABLE_TRANSITIONS	// uncomment to disable room transitions (for development only! helps in testing games quickly)
 
-GfxTransitions::GfxTransitions(GfxScreen *screen, GfxPalette *palette, bool isVGA)
-	: _screen(screen), _palette(palette), _isVGA(isVGA) {
+GfxTransitions::GfxTransitions(GfxScreen *screen, GfxPalette *palette)
+	: _screen(screen), _palette(palette) {
 	init();
 }
 
@@ -272,7 +272,7 @@ void GfxTransitions::doTransition(int16 number, bool blackoutFlag) {
 }
 
 void GfxTransitions::setNewPalette(bool blackoutFlag) {
-	if (!blackoutFlag && _isVGA)
+	if (!blackoutFlag)
 		_palette->setOnScreen();
 }
 
diff --git a/engines/sci/graphics/transitions.h b/engines/sci/graphics/transitions.h
index 674b7a8..a8f0ca6 100644
--- a/engines/sci/graphics/transitions.h
+++ b/engines/sci/graphics/transitions.h
@@ -65,7 +65,7 @@ class Screen;
  */
 class GfxTransitions {
 public:
-	GfxTransitions(GfxScreen *screen, GfxPalette *palette, bool isVGA);
+	GfxTransitions(GfxScreen *screen, GfxPalette *palette);
 	~GfxTransitions();
 
 	void setup(int16 number, bool blackoutFlag);
@@ -97,7 +97,6 @@ private:
 	GfxScreen *_screen;
 	GfxPalette *_palette;
 
-	bool _isVGA;
 	const GfxTransitionTranslateEntry *_translationTable;
 	int16 _number;
 	bool _blackoutFlag;
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index b590103..89a81dc 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -642,7 +642,7 @@ void SciEngine::initGraphics() {
 		_gfxCoordAdjuster = new GfxCoordAdjuster16(_gfxPorts);
 		_gfxCursor->init(_gfxCoordAdjuster, _eventMan);
 		_gfxCompare = new GfxCompare(_gamestate->_segMan, _kernel, _gfxCache, _gfxScreen, _gfxCoordAdjuster);
-		_gfxTransitions = new GfxTransitions(_gfxScreen, _gfxPalette, _resMan->isVGA());
+		_gfxTransitions = new GfxTransitions(_gfxScreen, _gfxPalette);
 		_gfxPaint16 = new GfxPaint16(_resMan, _gamestate->_segMan, _kernel, _gfxCache, _gfxPorts, _gfxCoordAdjuster, _gfxScreen, _gfxPalette, _gfxTransitions, _audio);
 		_gfxPaint = _gfxPaint16;
 		_gfxAnimate = new GfxAnimate(_gamestate, _gfxCache, _gfxPorts, _gfxPaint16, _gfxScreen, _gfxPalette, _gfxCursor, _gfxTransitions);


Commit: 5b9677da72efadf566be2a666bd9ca44ca35adc8
    https://github.com/scummvm/scummvm/commit/5b9677da72efadf566be2a666bd9ca44ca35adc8
Author: md5 (md5 at scummvm.org)
Date: 2011-03-04T12:04:12-08:00

Commit Message:
SCI: Cleaned up some view type checks

Changed paths:
    engines/sci/graphics/picture.cpp
    engines/sci/graphics/screen.cpp
    engines/sci/graphics/view.cpp



diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index 91fa2e7..60b40ee 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -733,7 +733,7 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) {
 					}
 					break;
 				case PIC_OPX_VGA_SET_PALETTE:
-					if (_resMan->isAmiga32color()) {
+					if (_resMan->getViewType() == kViewAmiga) {
 						if ((data[curPos] == 0x00) && (data[curPos + 1] == 0x01) && ((data[curPos + 32] & 0xF0) != 0xF0)) {
 							// Left-Over VGA palette, we simply ignore it
 							curPos += 256 + 4 + 1024;
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index ace69c6..757fdc5 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -113,7 +113,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
 	_unditherState = true;
 	_fontIsUpscaled = false;
 
-	if (_resMan->isVGA() || (_resMan->isAmiga32color())) {
+	if (_resMan->getViewType() != kViewEga) {
 		// It is not 100% accurate to set white to be 255 for Amiga 32-color
 		// games. But 255 is defined as white in our SCI at all times, so it
 		// doesn't matter.
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index f9bbee4..9e6854e 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -104,9 +104,9 @@ void GfxView::initData(GuiResourceId resourceId) {
 	}
 
 	switch (curViewType) {
-	case kViewEga: // View-format SCI0 (and Amiga 16 colors)
+	case kViewEga: // SCI0 (and Amiga 16 colors)
 		isEGA = true;
-	case kViewAmiga: // View-format Amiga (32 colors)
+	case kViewAmiga: // Amiga (32 colors)
 	case kViewVga: // View-format SCI1
 		// LoopCount:WORD MirrorMask:WORD Version:WORD PaletteOffset:WORD LoopOffset0:WORD LoopOffset1:WORD...
 
@@ -412,7 +412,7 @@ void GfxView::unpackCel(int16 loopNo, int16 celNo, byte *outPtr, uint32 pixelCou
 
 		rlePtr = _resourceData + celInfo->offsetRLE;
 		if (!celInfo->offsetLiteral) { // no additional literal data
-			if (_resMan->isAmiga32color()) {
+			if (_resMan->getViewType() == kViewAmiga) {
 				// decompression for amiga views
 				while (pixelNo < pixelCount) {
 					pixel = *rlePtr++;
@@ -531,9 +531,8 @@ const byte *GfxView::getBitmap(int16 loopNo, int16 celNo) {
 	// unpack the actual cel bitmap data
 	unpackCel(loopNo, celNo, pBitmap, pixelCount);
 
-	if (!_resMan->isVGA()) {
+	if (_resMan->getViewType() == kViewEga)
 		unditherBitmap(pBitmap, width, height, _loop[loopNo].cel[celNo].clearKey);
-	}
 
 	// mirroring the cel if needed
 	if (_loop[loopNo].mirrorFlag) {


Commit: d95b5331fb266de492c45d348ccb8313ca7824aa
    https://github.com/scummvm/scummvm/commit/d95b5331fb266de492c45d348ccb8313ca7824aa
Author: md5 (md5 at scummvm.org)
Date: 2011-03-04T12:04:13-08:00

Commit Message:
SCI: Some palette related changes

- Moved palette color count inside the GfxPalette class
- Enabled all of the kPalette subops for 16 color SCI1 games, apart from
the ones for intensity palette animation, and palette resource loading
- Removed isVGA() and isAmiga32color() methods from the resource manager -
they ended up in having inconsistent code

Changed paths:
    engines/sci/engine/kgraphics.cpp
    engines/sci/graphics/palette.cpp
    engines/sci/graphics/palette.h
    engines/sci/resource.h



diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index ca794e9..6ec8748 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -253,9 +253,7 @@ reg_t kGraph(EngineState *s, int argc, reg_t *argv) {
 }
 
 reg_t kGraphGetColorCount(EngineState *s, int argc, reg_t *argv) {
-	if (g_sci->getResMan()->isAmiga32color())
-		return make_reg(0, 32);
-	return make_reg(0, !g_sci->getResMan()->isVGA() ? 16 : 256);
+	return make_reg(0, g_sci->_gfxPalette->getTotalColorCount());
 }
 
 reg_t kGraphDrawLine(EngineState *s, int argc, reg_t *argv) {
@@ -551,8 +549,6 @@ reg_t kSetNowSeen(EngineState *s, int argc, reg_t *argv) {
 	return s->r_acc;
 }
 
-// we are called on EGA/amiga games as well, this doesnt make sense.
-//  doing this would actually break the system EGA/amiga palette
 reg_t kPalette(EngineState *s, int argc, reg_t *argv) {
 	if (!s)
 		return make_reg(0, getSciVersion());
@@ -560,86 +556,83 @@ reg_t kPalette(EngineState *s, int argc, reg_t *argv) {
 }
 
 reg_t kPaletteSetFromResource(EngineState *s, int argc, reg_t *argv) {
-	if (g_sci->getResMan()->isVGA()) {
-		GuiResourceId resourceId = argv[0].toUint16();
-		bool force = false;
-		if (argc == 2)
-			force = argv[1].toUint16() == 2 ? true : false;
-		g_sci->_gfxPalette->kernelSetFromResource(resourceId, force);
-	}
+	GuiResourceId resourceId = argv[0].toUint16();
+	bool force = false;
+	if (argc == 2)
+		force = argv[1].toUint16() == 2 ? true : false;
+
+	// Non-VGA games don't use palette resources
+	if (g_sci->_gfxPalette->getTotalColorCount() < 256)
+		return s->r_acc;
+
+	g_sci->_gfxPalette->kernelSetFromResource(resourceId, force);
 	return s->r_acc;
 }
 
 reg_t kPaletteSetFlag(EngineState *s, int argc, reg_t *argv) {
-	if (g_sci->getResMan()->isVGA()) {
-		uint16 fromColor = CLIP<uint16>(argv[0].toUint16(), 1, 255);
-		uint16 toColor = CLIP<uint16>(argv[1].toUint16(), 1, 255);
-		uint16 flags = argv[2].toUint16();
-		g_sci->_gfxPalette->kernelSetFlag(fromColor, toColor, flags);
-	}
+	uint16 fromColor = CLIP<uint16>(argv[0].toUint16(), 1, 255);
+	uint16 toColor = CLIP<uint16>(argv[1].toUint16(), 1, 255);
+	uint16 flags = argv[2].toUint16();
+	g_sci->_gfxPalette->kernelSetFlag(fromColor, toColor, flags);
 	return s->r_acc;
 }
 
 reg_t kPaletteUnsetFlag(EngineState *s, int argc, reg_t *argv) {
-	if (g_sci->getResMan()->isVGA()) {
-		uint16 fromColor = CLIP<uint16>(argv[0].toUint16(), 1, 255);
-		uint16 toColor = CLIP<uint16>(argv[1].toUint16(), 1, 255);
-		uint16 flags = argv[2].toUint16();
-		g_sci->_gfxPalette->kernelUnsetFlag(fromColor, toColor, flags);
-	}
+	uint16 fromColor = CLIP<uint16>(argv[0].toUint16(), 1, 255);
+	uint16 toColor = CLIP<uint16>(argv[1].toUint16(), 1, 255);
+	uint16 flags = argv[2].toUint16();
+	g_sci->_gfxPalette->kernelUnsetFlag(fromColor, toColor, flags);
 	return s->r_acc;
 }
 
 reg_t kPaletteSetIntensity(EngineState *s, int argc, reg_t *argv) {
-	if (g_sci->getResMan()->isVGA()) {
-		uint16 fromColor = CLIP<uint16>(argv[0].toUint16(), 1, 255);
-		uint16 toColor = CLIP<uint16>(argv[1].toUint16(), 1, 255);
-		uint16 intensity = argv[2].toUint16();
-		bool setPalette = (argc < 4) ? true : (argv[3].isNull()) ? true : false;
+	uint16 fromColor = CLIP<uint16>(argv[0].toUint16(), 1, 255);
+	uint16 toColor = CLIP<uint16>(argv[1].toUint16(), 1, 255);
+	uint16 intensity = argv[2].toUint16();
+	bool setPalette = (argc < 4) ? true : (argv[3].isNull()) ? true : false;
 
-		g_sci->_gfxPalette->kernelSetIntensity(fromColor, toColor, intensity, setPalette);
-	}
+	// Palette intensity in non-VGA SCI1 games has been removed
+	if (g_sci->_gfxPalette->getTotalColorCount() < 256)
+		return s->r_acc;
+
+	g_sci->_gfxPalette->kernelSetIntensity(fromColor, toColor, intensity, setPalette);
 	return s->r_acc;
 }
 
 reg_t kPaletteFindColor(EngineState *s, int argc, reg_t *argv) {
-	if (g_sci->getResMan()->isVGA()) {
-		uint16 r = argv[0].toUint16();
-		uint16 g = argv[1].toUint16();
-		uint16 b = argv[2].toUint16();
-		return make_reg(0, g_sci->_gfxPalette->kernelFindColor(r, g, b));
-	}
-	return NULL_REG;
+	uint16 r = argv[0].toUint16();
+	uint16 g = argv[1].toUint16();
+	uint16 b = argv[2].toUint16();
+	return make_reg(0, g_sci->_gfxPalette->kernelFindColor(r, g, b));
 }
 
 reg_t kPaletteAnimate(EngineState *s, int argc, reg_t *argv) {
-	if (g_sci->getResMan()->isVGA()) {
-		int16 argNr;
-		bool paletteChanged = false;
-		for (argNr = 0; argNr < argc; argNr += 3) {
-			uint16 fromColor = argv[argNr].toUint16();
-			uint16 toColor = argv[argNr + 1].toUint16();
-			int16 speed = argv[argNr + 2].toSint16();
-			if (g_sci->_gfxPalette->kernelAnimate(fromColor, toColor, speed))
-				paletteChanged = true;
-		}
-		if (paletteChanged)
-			g_sci->_gfxPalette->kernelAnimateSet();
+	int16 argNr;
+	bool paletteChanged = false;
+
+	// Palette animation in non-VGA SCI1 games has been removed
+	if (g_sci->_gfxPalette->getTotalColorCount() < 256)
+		return s->r_acc;
+
+	for (argNr = 0; argNr < argc; argNr += 3) {
+		uint16 fromColor = argv[argNr].toUint16();
+		uint16 toColor = argv[argNr + 1].toUint16();
+		int16 speed = argv[argNr + 2].toSint16();
+		if (g_sci->_gfxPalette->kernelAnimate(fromColor, toColor, speed))
+			paletteChanged = true;
 	}
+	if (paletteChanged)
+		g_sci->_gfxPalette->kernelAnimateSet();
+
 	return s->r_acc;
 }
 
 reg_t kPaletteSave(EngineState *s, int argc, reg_t *argv) {
-	if (g_sci->getResMan()->isVGA()) {
-		return g_sci->_gfxPalette->kernelSave();
-	}
-	return NULL_REG;
+	return g_sci->_gfxPalette->kernelSave();
 }
 
 reg_t kPaletteRestore(EngineState *s, int argc, reg_t *argv) {
-	if (g_sci->getResMan()->isVGA()) {
-		g_sci->_gfxPalette->kernelRestore(argv[0]);
-	}
+	g_sci->_gfxPalette->kernelRestore(argv[0]);
 	return argv[0];
 }
 
diff --git a/engines/sci/graphics/palette.cpp b/engines/sci/graphics/palette.cpp
index 683f436..1b3e259 100644
--- a/engines/sci/graphics/palette.cpp
+++ b/engines/sci/graphics/palette.cpp
@@ -76,6 +76,21 @@ GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen, bool useMergi
 #ifdef ENABLE_SCI32
 	_clutTable = 0;
 #endif
+
+	switch (_resMan->getViewType()) {
+	case kViewVga:
+	case kViewVga11:
+		_totalScreenColors = 256;
+		break;
+	case kViewAmiga:
+		_totalScreenColors = 32;
+		break;
+	case kViewEga:
+		_totalScreenColors = 16;
+		break;
+	default:
+		error("GfxPalette: Unknown view type");
+	}
 }
 
 GfxPalette::~GfxPalette() {
@@ -97,7 +112,7 @@ bool GfxPalette::isMerging() {
 void GfxPalette::setDefault() {
 	if (_resMan->getViewType() == kViewEga)
 		setEGA();
-	else if (_resMan->isAmiga32color())
+	else if (_resMan->getViewType() == kViewAmiga)
 		setAmiga();
 	else
 		kernelSetFromResource(999, true);
diff --git a/engines/sci/graphics/palette.h b/engines/sci/graphics/palette.h
index 317401a..d2e5151 100644
--- a/engines/sci/graphics/palette.h
+++ b/engines/sci/graphics/palette.h
@@ -54,6 +54,7 @@ public:
 	bool merge(Palette *pFrom, bool force, bool forceRealMerge);
 	uint16 matchColor(byte r, byte g, byte b);
 	void getSys(Palette *pal);
+	uint16 getTotalColorCount() const { return _totalScreenColors; }
 
 	void setOnScreen();
 	void copySysPaletteToScreen();
@@ -123,6 +124,7 @@ private:
 	uint16 _palVaryTicks;
 	int _palVaryPaused;
 	int _palVarySignal;
+	uint16 _totalScreenColors;
 
 	void loadMacIconBarPalette();
 	byte *_macClut;
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 76b5a42..e941f66 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -331,8 +331,6 @@ public:
 	int getAudioLanguage() const;
 	void changeAudioDirectory(Common::String path);
 	bool isGMTrackIncluded();
-	bool isVGA() const { return (_viewType == kViewVga) || (_viewType == kViewVga11); }
-	bool isAmiga32color() const { return _viewType == kViewAmiga; }
 	bool isSci11Mac() const { return _volVersion == kResVersionSci11Mac; }
 	ViewType getViewType() const { return _viewType; }
 	const char *getMapVersionDesc() const { return versionDescription(_mapVersion); }






More information about the Scummvm-git-logs mailing list