[Scummvm-cvs-logs] scummvm master -> 7f23c91de9a784ebbd92a566f9c20cfc2f8a7534

csnover csnover at users.noreply.github.com
Fri Aug 19 22:23:26 CEST 2016


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

Summary:
eae6891404 SCI32: Fix kGlobalToLocal and kLocalToGlobal
4e1a9be816 SCI32: Remove CoordAdjuster32, at least for the moment
6708b58faf SCI: Remove references to SCI32 features from SCI16 video player
e55b774584 SCI32: Add kPlayVMDGetStatus kernel call
051eae4639 SCI32: Increase maximum line width for graphics
0a4a2567a3 SCI32: Partially implement kCD
c4250c05d0 SCI32: Enable multi-disc audio resources
b106ba1102 SCI: Avoid attempts to use exe/txt/dll files as patches
dc093742b3 SCI32: Bug fixes to PQ:SWAT script bugs and kList calls
da62a99a00 SCI32: Remove unused ResourceManager from GfxFrameout
7f23c91de9 SCI32: Fix limited data range comparison warning


Commit: eae689140458efa657cefc549a3670c60d42bb12
    https://github.com/scummvm/scummvm/commit/eae689140458efa657cefc549a3670c60d42bb12
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-08-19T15:23:10-05:00

Commit Message:
SCI32: Fix kGlobalToLocal and kLocalToGlobal

Fixes (at least) the native SCI save dialogs.

Changed paths:
    engines/sci/engine/kernel.h
    engines/sci/engine/kernel_tables.h
    engines/sci/engine/kevent.cpp



diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index fffb7c9..4ddddd9 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -426,6 +426,8 @@ reg_t kSetNowSeen32(EngineState *s, int argc, reg_t *argv);
 reg_t kBaseSetter32(EngineState *s, int argc, reg_t *argv);
 reg_t kShakeScreen32(EngineState *s, int argc, reg_t *argv);
 reg_t kPlatform32(EngineState *s, int argc, reg_t *argv);
+reg_t kGlobalToLocal32(EngineState *s, int argc, reg_t *argv);
+reg_t kLocalToGlobal32(EngineState *s, int argc, reg_t *argv);
 
 reg_t kDoAudio32(EngineState *s, int argc, reg_t *argv);
 reg_t kDoAudioInit(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index ae3162e..deb3f3c 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -657,8 +657,10 @@ static SciKernelMapEntry s_kernelMap[] = {
 	{ MAP_CALL(GetSaveDir),        SIG_EVERYWHERE,           "",                      NULL,            NULL },
 	{ MAP_CALL(GetSaveFiles),      SIG_EVERYWHERE,           "rrr",                   NULL,            NULL },
 	{ MAP_CALL(GetTime),           SIG_EVERYWHERE,           "(i)",                   NULL,            NULL },
-	{ MAP_CALL(GlobalToLocal),     SIG_SCI32, SIGFOR_ALL,    "oo",                    NULL,            NULL },
-	{ MAP_CALL(GlobalToLocal),     SIG_EVERYWHERE,           "o",                     NULL,            NULL },
+	{ MAP_CALL(GlobalToLocal),     SIG_SCI16, SIGFOR_ALL,    "o",                     NULL,            NULL },
+#ifdef ENABLE_SCI32
+	{ "GlobalToLocal", kGlobalToLocal32, SIG_SCI32, SIGFOR_ALL, "oo",                 NULL,            NULL },
+#endif
 	{ MAP_CALL(Graph),             SIG_EVERYWHERE,           NULL,                    kGraph_subops,   NULL },
 	{ MAP_CALL(HaveMouse),         SIG_EVERYWHERE,           "",                      NULL,            NULL },
 	{ MAP_CALL(HiliteControl),     SIG_EVERYWHERE,           "o",                     NULL,            NULL },
@@ -669,8 +671,10 @@ static SciKernelMapEntry s_kernelMap[] = {
 	{ MAP_CALL(Joystick),          SIG_EVERYWHERE,           "i(.*)",                 NULL,            NULL }, // subop
 	{ MAP_CALL(LastNode),          SIG_EVERYWHERE,           "l",                     NULL,            NULL },
 	{ MAP_CALL(Load),              SIG_EVERYWHERE,           "ii(i*)",                NULL,            NULL },
-	{ MAP_CALL(LocalToGlobal),     SIG_SCI32, SIGFOR_ALL,    "oo",                    NULL,            NULL },
-	{ MAP_CALL(LocalToGlobal),     SIG_EVERYWHERE,           "o",                     NULL,            NULL },
+	{ MAP_CALL(LocalToGlobal),     SIG_SCI16, SIGFOR_ALL,    "o",                     NULL,            NULL },
+#ifdef ENABLE_SCI32
+	{ "LocalToGlobal", kLocalToGlobal32, SIG_SCI32, SIGFOR_ALL, "oo",                 NULL,            NULL },
+#endif
 	{ MAP_CALL(Lock),              SIG_EVERYWHERE,           "ii(i)",                 NULL,            NULL },
 	{ MAP_CALL(MapKeyToDir),       SIG_EVERYWHERE,           "o",                     NULL,            NULL },
 	{ MAP_CALL(Memory),            SIG_EVERYWHERE,           "i(.*)",                 NULL,            kMemory_workarounds }, // subop
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index 56ee2f5..9250e0f 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -34,6 +34,9 @@
 #include "sci/graphics/coordadjuster.h"
 #include "sci/graphics/cursor.h"
 #include "sci/graphics/maciconbar.h"
+#ifdef ENABLE_SCI32
+#include "sci/graphics/frameout.h"
+#endif
 
 namespace Sci {
 
@@ -58,10 +61,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
 	if (g_debug_simulated_key && (mask & SCI_EVENT_KEYBOARD)) {
 		// In case we use a simulated event we query the current mouse position
 		mousePos = g_sci->_gfxCursor->getPosition();
-#ifdef ENABLE_SCI32
-		if (getSciVersion() >= SCI_VERSION_2_1_EARLY)
-			g_sci->_gfxCoordAdjuster->fromDisplayToScript(mousePos.y, mousePos.x);
-#endif
+
 		// Limit the mouse cursor position, if necessary
 		g_sci->_gfxCursor->refreshPosition();
 
@@ -284,14 +284,13 @@ reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv) {
 
 reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) {
 	reg_t obj = argv[0];
-	reg_t planeObject = argc > 1 ? argv[1] : NULL_REG; // SCI32
 	SegManager *segMan = s->_segMan;
 
 	if (obj.getSegment()) {
 		int16 x = readSelectorValue(segMan, obj, SELECTOR(x));
 		int16 y = readSelectorValue(segMan, obj, SELECTOR(y));
 
-		g_sci->_gfxCoordAdjuster->kernelGlobalToLocal(x, y, planeObject);
+		g_sci->_gfxCoordAdjuster->kernelGlobalToLocal(x, y);
 
 		writeSelectorValue(segMan, obj, SELECTOR(x), x);
 		writeSelectorValue(segMan, obj, SELECTOR(y), y);
@@ -303,14 +302,13 @@ reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) {
 
 reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv) {
 	reg_t obj = argv[0];
-	reg_t planeObject = argc > 1 ? argv[1] : NULL_REG; // SCI32
 	SegManager *segMan = s->_segMan;
 
 	if (obj.getSegment()) {
 		int16 x = readSelectorValue(segMan, obj, SELECTOR(x));
 		int16 y = readSelectorValue(segMan, obj, SELECTOR(y));
 
-		g_sci->_gfxCoordAdjuster->kernelLocalToGlobal(x, y, planeObject);
+		g_sci->_gfxCoordAdjuster->kernelLocalToGlobal(x, y);
 
 		writeSelectorValue(segMan, obj, SELECTOR(x), x);
 		writeSelectorValue(segMan, obj, SELECTOR(y), y);
@@ -325,4 +323,52 @@ reg_t kJoystick(EngineState *s, int argc, reg_t *argv) {
 	return NULL_REG;
 }
 
+#ifdef ENABLE_SCI32
+reg_t kGlobalToLocal32(EngineState *s, int argc, reg_t *argv) {
+	const reg_t result = argv[0];
+	const reg_t planeObj = argv[1];
+
+	bool visible = true;
+	Plane *plane = g_sci->_gfxFrameout->getVisiblePlanes().findByObject(planeObj);
+	if (plane == nullptr) {
+		plane = g_sci->_gfxFrameout->getPlanes().findByObject(planeObj);
+		visible = false;
+	}
+	if (plane == nullptr) {
+		error("kGlobalToLocal: Plane %04x:%04x not found", PRINT_REG(planeObj));
+	}
+
+	const int16 x = readSelectorValue(s->_segMan, result, SELECTOR(x)) - plane->_gameRect.left;
+	const int16 y = readSelectorValue(s->_segMan, result, SELECTOR(y)) - plane->_gameRect.top;
+
+	writeSelectorValue(s->_segMan, result, SELECTOR(x), x);
+	writeSelectorValue(s->_segMan, result, SELECTOR(y), y);
+
+	return make_reg(0, visible);
+}
+
+reg_t kLocalToGlobal32(EngineState *s, int argc, reg_t *argv) {
+	const reg_t result = argv[0];
+	const reg_t planeObj = argv[1];
+
+	bool visible = true;
+	Plane *plane = g_sci->_gfxFrameout->getVisiblePlanes().findByObject(planeObj);
+	if (plane == nullptr) {
+		plane = g_sci->_gfxFrameout->getPlanes().findByObject(planeObj);
+		visible = false;
+	}
+	if (plane == nullptr) {
+		error("kLocalToGlobal: Plane %04x:%04x not found", PRINT_REG(planeObj));
+	}
+
+	const int16 x = readSelectorValue(s->_segMan, result, SELECTOR(x)) + plane->_gameRect.left;
+	const int16 y = readSelectorValue(s->_segMan, result, SELECTOR(y)) + plane->_gameRect.top;
+
+	writeSelectorValue(s->_segMan, result, SELECTOR(x), x);
+	writeSelectorValue(s->_segMan, result, SELECTOR(y), y);
+
+	return make_reg(0, visible);
+}
+#endif
+
 } // End of namespace Sci


Commit: 4e1a9be816c14593b37a672b0789528b1719a199
    https://github.com/scummvm/scummvm/commit/4e1a9be816c14593b37a672b0789528b1719a199
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-08-19T15:23:10-05:00

Commit Message:
SCI32: Remove CoordAdjuster32, at least for the moment

This may come back in the future to deduplicate some gfx code,
but SCI32 had two different inlined ways of doing coordinate
conversions with different rounding methods, so CoordAdjuster32
didn't get used when the graphics system was rewritten.

At the moment, SCI32 code uses the mulru/mulinc methods from
helper.h for scaling up/down coordinates.

Changed paths:
    engines/sci/engine/kgraphics32.cpp
    engines/sci/graphics/compare.cpp
    engines/sci/graphics/compare.h
    engines/sci/graphics/coordadjuster.cpp
    engines/sci/graphics/coordadjuster.h
    engines/sci/graphics/cursor.cpp
    engines/sci/graphics/cursor.h
    engines/sci/graphics/frameout.cpp
    engines/sci/graphics/frameout.h
    engines/sci/graphics/paint16.cpp
    engines/sci/graphics/paint16.h
    engines/sci/graphics/picture.cpp
    engines/sci/graphics/picture.h
    engines/sci/graphics/text16.cpp
    engines/sci/graphics/view.cpp
    engines/sci/graphics/view.h
    engines/sci/sci.cpp
    engines/sci/sci.h



diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index 182f2cb..aa9fc18 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -37,7 +37,6 @@
 #include "sci/graphics/cache.h"
 #include "sci/graphics/compare.h"
 #include "sci/graphics/controls16.h"
-#include "sci/graphics/coordadjuster.h"
 #include "sci/graphics/palette.h"
 #include "sci/graphics/paint16.h"
 #include "sci/graphics/picture.h"
diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp
index 130416f..36026a8 100644
--- a/engines/sci/graphics/compare.cpp
+++ b/engines/sci/graphics/compare.cpp
@@ -37,7 +37,7 @@
 
 namespace Sci {
 
-GfxCompare::GfxCompare(SegManager *segMan, GfxCache *cache, GfxScreen *screen, GfxCoordAdjuster *coordAdjuster)
+GfxCompare::GfxCompare(SegManager *segMan, GfxCache *cache, GfxScreen *screen, GfxCoordAdjuster16 *coordAdjuster)
 	: _segMan(segMan), _cache(cache), _screen(screen), _coordAdjuster(coordAdjuster) {
 }
 
diff --git a/engines/sci/graphics/compare.h b/engines/sci/graphics/compare.h
index c700598..dd65b90 100644
--- a/engines/sci/graphics/compare.h
+++ b/engines/sci/graphics/compare.h
@@ -34,7 +34,7 @@ class Screen;
  */
 class GfxCompare {
 public:
-	GfxCompare(SegManager *segMan, GfxCache *cache, GfxScreen *screen, GfxCoordAdjuster *coordAdjuster);
+	GfxCompare(SegManager *segMan, GfxCache *cache, GfxScreen *screen, GfxCoordAdjuster16 *coordAdjuster);
 	~GfxCompare();
 
 	uint16 kernelOnControl(byte screenMask, const Common::Rect &rect);
@@ -50,7 +50,7 @@ private:
 	SegManager *_segMan;
 	GfxCache *_cache;
 	GfxScreen *_screen;
-	GfxCoordAdjuster *_coordAdjuster;
+	GfxCoordAdjuster16 *_coordAdjuster;
 
 	uint16 isOnControl(uint16 screenMask, const Common::Rect &rect);
 
diff --git a/engines/sci/graphics/coordadjuster.cpp b/engines/sci/graphics/coordadjuster.cpp
index 93dff10..2f22d19 100644
--- a/engines/sci/graphics/coordadjuster.cpp
+++ b/engines/sci/graphics/coordadjuster.cpp
@@ -32,9 +32,6 @@
 
 namespace Sci {
 
-GfxCoordAdjuster::GfxCoordAdjuster() {
-}
-
 GfxCoordAdjuster16::GfxCoordAdjuster16(GfxPorts *ports)
 	: _ports(ports) {
 }
@@ -83,53 +80,4 @@ Common::Rect GfxCoordAdjuster16::pictureGetDisplayArea() {
 	return displayArea;
 }
 
-#ifdef ENABLE_SCI32
-GfxCoordAdjuster32::GfxCoordAdjuster32(SegManager *segMan)
-	: _segMan(segMan) {
-	_scriptsRunningWidth = 0;
-	_scriptsRunningHeight = 0;
-}
-
-GfxCoordAdjuster32::~GfxCoordAdjuster32() {
-}
-
-void GfxCoordAdjuster32::kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject) {
-	uint16 planeTop = readSelectorValue(_segMan, planeObject, SELECTOR(top));
-	uint16 planeLeft = readSelectorValue(_segMan, planeObject, SELECTOR(left));
-
-	y -= planeTop;
-	x -= planeLeft;
-}
-void GfxCoordAdjuster32::kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject) {
-	uint16 planeTop = readSelectorValue(_segMan, planeObject, SELECTOR(top));
-	uint16 planeLeft = readSelectorValue(_segMan, planeObject, SELECTOR(left));
-
-	x += planeLeft;
-	y += planeTop;
-}
-
-void GfxCoordAdjuster32::setScriptsResolution(uint16 width, uint16 height) {
-	_scriptsRunningWidth = width;
-	_scriptsRunningHeight = height;
-}
-
-void GfxCoordAdjuster32::fromDisplayToScript(int16 &y, int16 &x) {
-	y = ((y * _scriptsRunningHeight) / g_sci->_gfxScreen->getHeight());
-	x = ((x * _scriptsRunningWidth) / g_sci->_gfxScreen->getWidth());
-}
-
-void GfxCoordAdjuster32::fromScriptToDisplay(int16 &y, int16 &x) {
-	y = ((y * g_sci->_gfxScreen->getHeight()) / _scriptsRunningHeight);
-	x = ((x * g_sci->_gfxScreen->getWidth()) / _scriptsRunningWidth);
-}
-
-void GfxCoordAdjuster32::pictureSetDisplayArea(Common::Rect displayArea) {
-	_pictureDisplayArea = displayArea;
-}
-
-Common::Rect GfxCoordAdjuster32::pictureGetDisplayArea() {
-	return _pictureDisplayArea;
-}
-#endif
-
 } // End of namespace Sci
diff --git a/engines/sci/graphics/coordadjuster.h b/engines/sci/graphics/coordadjuster.h
index cb0227f..f7ebd3e 100644
--- a/engines/sci/graphics/coordadjuster.h
+++ b/engines/sci/graphics/coordadjuster.h
@@ -35,27 +35,7 @@ class GfxPorts;
  *  most of the time sci32 doesn't do any coordinate adjustment at all
  *  sci16 does a lot of port adjustment on given coordinates
  */
-class GfxCoordAdjuster {
-public:
-	GfxCoordAdjuster();
-	virtual ~GfxCoordAdjuster() { }
-
-	virtual void kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject = NULL_REG) { }
-	virtual void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG) { }
-
-	virtual Common::Rect onControl(Common::Rect rect) { return rect; }
-	virtual void setCursorPos(Common::Point &pos) { }
-	virtual void moveCursor(Common::Point &pos) { }
-
-	virtual void setScriptsResolution(uint16 width, uint16 height) { }
-	virtual void fromScriptToDisplay(int16 &y, int16 &x) { }
-	virtual void fromDisplayToScript(int16 &y, int16 &x) { }
-
-	virtual Common::Rect pictureGetDisplayArea() { return Common::Rect(0, 0); }
-private:
-};
-
-class GfxCoordAdjuster16 : public GfxCoordAdjuster {
+class GfxCoordAdjuster16 {
 public:
 	GfxCoordAdjuster16(GfxPorts *ports);
 	~GfxCoordAdjuster16();
@@ -73,32 +53,6 @@ private:
 	GfxPorts *_ports;
 };
 
-#ifdef ENABLE_SCI32
-class GfxCoordAdjuster32 : public GfxCoordAdjuster {
-public:
-	GfxCoordAdjuster32(SegManager *segMan);
-	~GfxCoordAdjuster32();
-
-	void kernelGlobalToLocal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
-	void kernelLocalToGlobal(int16 &x, int16 &y, reg_t planeObject = NULL_REG);
-
-	void setScriptsResolution(uint16 width, uint16 height);
-	void fromScriptToDisplay(int16 &y, int16 &x);
-	void fromDisplayToScript(int16 &y, int16 &x);
-
-	void pictureSetDisplayArea(Common::Rect displayArea);
-	Common::Rect pictureGetDisplayArea();
-
-private:
-	SegManager *_segMan;
-
-	Common::Rect _pictureDisplayArea;
-
-	uint16 _scriptsRunningWidth;
-	uint16 _scriptsRunningHeight;
-};
-#endif
-
 } // End of namespace Sci
 
 #endif
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index f5dd473..c322912 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -80,7 +80,7 @@ GfxCursor::~GfxCursor() {
 	kernelClearZoomZone();
 }
 
-void GfxCursor::init(GfxCoordAdjuster *coordAdjuster, EventManager *event) {
+void GfxCursor::init(GfxCoordAdjuster16 *coordAdjuster, EventManager *event) {
 	_coordAdjuster = coordAdjuster;
 	_event = event;
 }
diff --git a/engines/sci/graphics/cursor.h b/engines/sci/graphics/cursor.h
index 5125469..c57d9da 100644
--- a/engines/sci/graphics/cursor.h
+++ b/engines/sci/graphics/cursor.h
@@ -55,7 +55,7 @@ public:
 	GfxCursor(ResourceManager *resMan, GfxPalette *palette, GfxScreen *screen);
 	~GfxCursor();
 
-	void init(GfxCoordAdjuster *coordAdjuster, EventManager *event);
+	void init(GfxCoordAdjuster16 *coordAdjuster, EventManager *event);
 
 	void kernelShow();
 	void kernelHide();
@@ -103,7 +103,7 @@ private:
 	ResourceManager *_resMan;
 	GfxScreen *_screen;
 	GfxPalette *_palette;
-	GfxCoordAdjuster *_coordAdjuster;
+	GfxCoordAdjuster16 *_coordAdjuster;
 	EventManager *_event;
 
 	int _upscaledHires;
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index 333ed76..e690a3e 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -40,7 +40,6 @@
 #include "sci/engine/selector.h"
 #include "sci/engine/vm.h"
 #include "sci/graphics/cache.h"
-#include "sci/graphics/coordadjuster.h"
 #include "sci/graphics/compare.h"
 #include "sci/graphics/cursor32.h"
 #include "sci/graphics/font.h"
@@ -58,7 +57,7 @@
 
 namespace Sci {
 
-GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor) :
+GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor) :
 	_isHiRes(ConfMan.getBool("enable_high_resolution_graphics")),
 	_palette(palette),
 	_cursor(cursor),
@@ -105,20 +104,6 @@ GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAd
 		// default script width for other games is 320x200
 		break;
 	}
-
-	// TODO: Nothing in the renderer really uses this. Currently,
-	// the cursor renderer does, and kLocalToGlobal/kGlobalToLocal
-	// do, but in the real engine (1) the cursor is handled in
-	// frameOut, and (2) functions do a very simple lookup of the
-	// plane and arithmetic with the plane's gameRect. In
-	// principle, CoordAdjuster could be reused for
-	// convertGameRectToPlaneRect, but it is not super clear yet
-	// what the benefit would be to do that.
-	_coordAdjuster = (GfxCoordAdjuster32 *)coordAdjuster;
-
-	// TODO: Script resolution is hard-coded per game;
-	// also this must be set or else the engine will crash
-	_coordAdjuster->setScriptsResolution(_currentBuffer.scriptWidth, _currentBuffer.scriptHeight);
 }
 
 GfxFrameout::~GfxFrameout() {
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index 92e38fa..05e9e4e 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -31,7 +31,6 @@ typedef Common::Array<DrawList> ScreenItemListList;
 typedef Common::Array<RectList> EraseListList;
 
 class GfxCursor32;
-class GfxCoordAdjuster32;
 class GfxTransitions32;
 struct PlaneShowStyle;
 
@@ -42,13 +41,12 @@ struct PlaneShowStyle;
 class GfxFrameout {
 private:
 	GfxCursor32 *_cursor;
-	GfxCoordAdjuster32 *_coordAdjuster;
 	GfxPalette32 *_palette;
 	ResourceManager *_resMan;
 	SegManager *_segMan;
 
 public:
-	GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor);
+	GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor);
 	~GfxFrameout();
 
 	bool _isHiRes;
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index 6004e9c..91817d4 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -41,7 +41,7 @@
 
 namespace Sci {
 
-GfxPaint16::GfxPaint16(ResourceManager *resMan, SegManager *segMan, GfxCache *cache, GfxPorts *ports, GfxCoordAdjuster *coordAdjuster, GfxScreen *screen, GfxPalette *palette, GfxTransitions *transitions, AudioPlayer *audio)
+GfxPaint16::GfxPaint16(ResourceManager *resMan, SegManager *segMan, GfxCache *cache, GfxPorts *ports, GfxCoordAdjuster16 *coordAdjuster, GfxScreen *screen, GfxPalette *palette, GfxTransitions *transitions, AudioPlayer *audio)
 	: _resMan(resMan), _segMan(segMan), _cache(cache), _ports(ports),
 	  _coordAdjuster(coordAdjuster), _screen(screen), _palette(palette),
 	  _transitions(transitions), _audio(audio), _EGAdrawingVisualize(false) {
diff --git a/engines/sci/graphics/paint16.h b/engines/sci/graphics/paint16.h
index 317388b..6fc9cbb 100644
--- a/engines/sci/graphics/paint16.h
+++ b/engines/sci/graphics/paint16.h
@@ -36,7 +36,7 @@ class GfxView;
  */
 class GfxPaint16 {
 public:
-	GfxPaint16(ResourceManager *resMan, SegManager *segMan, GfxCache *cache, GfxPorts *ports, GfxCoordAdjuster *coordAdjuster, GfxScreen *screen, GfxPalette *palette, GfxTransitions *transitions, AudioPlayer *audio);
+	GfxPaint16(ResourceManager *resMan, SegManager *segMan, GfxCache *cache, GfxPorts *ports, GfxCoordAdjuster16 *coordAdjuster, GfxScreen *screen, GfxPalette *palette, GfxTransitions *transitions, AudioPlayer *audio);
 	~GfxPaint16();
 
 	void init(GfxAnimate *animate, GfxText16 *text16);
@@ -91,7 +91,7 @@ private:
 	GfxAnimate *_animate;
 	GfxCache *_cache;
 	GfxPorts *_ports;
-	GfxCoordAdjuster *_coordAdjuster;
+	GfxCoordAdjuster16 *_coordAdjuster;
 	GfxScreen *_screen;
 	GfxPalette *_palette;
 	GfxText16 *_text16;
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index 2eab391..0025b24 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -35,7 +35,7 @@ namespace Sci {
 
 //#define DEBUG_PICTURE_DRAW
 
-GfxPicture::GfxPicture(ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize)
+GfxPicture::GfxPicture(ResourceManager *resMan, GfxCoordAdjuster16 *coordAdjuster, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize)
 	: _resMan(resMan), _coordAdjuster(coordAdjuster), _ports(ports), _screen(screen), _palette(palette), _resourceId(resourceId), _EGAdrawingVisualize(EGAdrawingVisualize) {
 	assert(resourceId != -1);
 	initData(resourceId);
diff --git a/engines/sci/graphics/picture.h b/engines/sci/graphics/picture.h
index 942fa0f..1be1ae3 100644
--- a/engines/sci/graphics/picture.h
+++ b/engines/sci/graphics/picture.h
@@ -38,7 +38,7 @@ enum {
 class GfxPorts;
 class GfxScreen;
 class GfxPalette;
-class GfxCoordAdjuster;
+class GfxCoordAdjuster16;
 class ResourceManager;
 class Resource;
 
@@ -48,7 +48,7 @@ class Resource;
  */
 class GfxPicture {
 public:
-	GfxPicture(ResourceManager *resMan, GfxCoordAdjuster *coordAdjuster, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize = false);
+	GfxPicture(ResourceManager *resMan, GfxCoordAdjuster16 *coordAdjuster, GfxPorts *ports, GfxScreen *screen, GfxPalette *palette, GuiResourceId resourceId, bool EGAdrawingVisualize = false);
 	~GfxPicture();
 
 	GuiResourceId getResourceId();
@@ -84,7 +84,7 @@ private:
 	void vectorPatternTexturedCircle(Common::Rect box, byte size, byte color, byte prio, byte control, byte texture);
 
 	ResourceManager *_resMan;
-	GfxCoordAdjuster *_coordAdjuster;
+	GfxCoordAdjuster16 *_coordAdjuster;
 	GfxPorts *_ports;
 	GfxScreen *_screen;
 	GfxPalette *_palette;
diff --git a/engines/sci/graphics/text16.cpp b/engines/sci/graphics/text16.cpp
index b0f2c52..cb6e614 100644
--- a/engines/sci/graphics/text16.cpp
+++ b/engines/sci/graphics/text16.cpp
@@ -633,7 +633,7 @@ reg_t GfxText16::allocAndFillReferenceRectArray() {
 	if (rectCount) {
 		reg_t rectArray;
 		byte *rectArrayPtr = g_sci->getEngineState()->_segMan->allocDynmem(4 * 2 * (rectCount + 1), "text code reference rects", &rectArray);
-		GfxCoordAdjuster *coordAdjuster = g_sci->_gfxCoordAdjuster;
+		GfxCoordAdjuster16 *coordAdjuster = g_sci->_gfxCoordAdjuster;
 		for (uint curRect = 0; curRect < rectCount; curRect++) {
 			coordAdjuster->kernelLocalToGlobal(_codeRefRects[curRect].left, _codeRefRects[curRect].top);
 			coordAdjuster->kernelLocalToGlobal(_codeRefRects[curRect].right, _codeRefRects[curRect].bottom);
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 1939e66..0c09fcb 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -351,18 +351,6 @@ void GfxView::initData(GuiResourceId resourceId) {
 				celData += celSize;
 			}
 		}
-#ifdef ENABLE_SCI32
-		// adjust width/height returned to scripts
-		if (_sci2ScaleRes != SCI_VIEW_NATIVERES_NONE) {
-			for (loopNo = 0; loopNo < _loopCount; loopNo++)
-				for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++)
-					_screen->adjustBackUpscaledCoordinates(_loop[loopNo].cel[celNo].scriptWidth, _loop[loopNo].cel[celNo].scriptHeight, _sci2ScaleRes);
-		} else if ((getSciVersion() >= SCI_VERSION_2_1_EARLY) && (getSciVersion() <= SCI_VERSION_2_1_LATE)) {
-			for (loopNo = 0; loopNo < _loopCount; loopNo++)
-				for (celNo = 0; celNo < _loop[loopNo].celCount; celNo++)
-					_coordAdjuster->fromDisplayToScript(_loop[loopNo].cel[celNo].scriptHeight, _loop[loopNo].cel[celNo].scriptWidth);
-		}
-#endif
 		break;
 
 	default:
diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h
index 96b48c0..5e42246 100644
--- a/engines/sci/graphics/view.h
+++ b/engines/sci/graphics/view.h
@@ -92,7 +92,7 @@ private:
 	void unditherBitmap(byte *bitmap, int16 width, int16 height, byte clearKey);
 
 	ResourceManager *_resMan;
-	GfxCoordAdjuster *_coordAdjuster;
+	GfxCoordAdjuster16 *_coordAdjuster;
 	GfxScreen *_screen;
 	GfxPalette *_palette;
 
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index bca1aae..cb82538 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -732,12 +732,11 @@ void SciEngine::initGraphics() {
 #ifdef ENABLE_SCI32
 	if (getSciVersion() >= SCI_VERSION_2) {
 		// SCI32 graphic objects creation
-		_gfxCoordAdjuster = new GfxCoordAdjuster32(_gamestate->_segMan);
 		_gfxCursor32 = new GfxCursor32();
 		_gfxCompare = new GfxCompare(_gamestate->_segMan, _gfxCache, nullptr, _gfxCoordAdjuster);
 		_gfxPaint32 = new GfxPaint32(_gamestate->_segMan);
 		_gfxTransitions32 = new GfxTransitions32(_gamestate->_segMan);
-		_gfxFrameout = new GfxFrameout(_gamestate->_segMan, _resMan, _gfxCoordAdjuster, _gfxPalette32, _gfxTransitions32, _gfxCursor32);
+		_gfxFrameout = new GfxFrameout(_gamestate->_segMan, _resMan, _gfxPalette32, _gfxTransitions32, _gfxCursor32);
 		_gfxCursor32->init(_gfxFrameout->getCurrentBuffer());
 		_gfxText32 = new GfxText32(_gamestate->_segMan, _gfxCache);
 		_gfxControls32 = new GfxControls32(_gamestate->_segMan, _gfxCache, _gfxText32);
diff --git a/engines/sci/sci.h b/engines/sci/sci.h
index 001430f..b336eb8 100644
--- a/engines/sci/sci.h
+++ b/engines/sci/sci.h
@@ -75,7 +75,7 @@ class GfxCache;
 class GfxCompare;
 class GfxControls16;
 class GfxControls32;
-class GfxCoordAdjuster;
+class GfxCoordAdjuster16;
 class GfxCursor;
 class GfxMacIconBar;
 class GfxMenu;
@@ -369,7 +369,7 @@ public:
 	GfxCompare *_gfxCompare;
 	GfxControls16 *_gfxControls16; // Controls for 16-bit gfx
 	GfxControls32 *_gfxControls32; // Controls for 32-bit gfx
-	GfxCoordAdjuster *_gfxCoordAdjuster;
+	GfxCoordAdjuster16 *_gfxCoordAdjuster;
 	GfxCursor *_gfxCursor;
 	GfxMenu *_gfxMenu; // Menu for 16-bit gfx
 	GfxPalette *_gfxPalette16;


Commit: 6708b58faf145158b47e2184f8d776fa6426305e
    https://github.com/scummvm/scummvm/commit/6708b58faf145158b47e2184f8d776fa6426305e
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-08-19T15:23:10-05:00

Commit Message:
SCI: Remove references to SCI32 features from SCI16 video player

Changed paths:
    engines/sci/engine/kvideo.cpp
    engines/sci/engine/state.cpp
    engines/sci/engine/state.h



diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp
index 9e5da20..f61673e 100644
--- a/engines/sci/engine/kvideo.cpp
+++ b/engines/sci/engine/kvideo.cpp
@@ -72,11 +72,10 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) {
 	uint16 y = (screenHeight - height) / 2;
 
 	bool skipVideo = false;
-	EngineState *s = g_sci->getEngineState();
 
 	if (videoDecoder->hasDirtyPalette()) {
-		const byte *palette = videoDecoder->getPalette() + s->_vmdPalStart * 3;
-		g_system->getPaletteManager()->setPalette(palette, s->_vmdPalStart, s->_vmdPalEnd - s->_vmdPalStart);
+		const byte *palette = videoDecoder->getPalette();
+		g_system->getPaletteManager()->setPalette(palette, 0, 255);
 	}
 
 	while (!g_engine->shouldQuit() && !videoDecoder->endOfVideo() && !skipVideo) {
@@ -85,7 +84,7 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) {
 
 			if (frame) {
 				if (scaleBuffer) {
-					// TODO: Probably should do aspect ratio correction in e.g. GK1 Windows
+					// TODO: Probably should do aspect ratio correction in KQ6
 					g_sci->_gfxScreen->scale2x((const byte *)frame->getPixels(), scaleBuffer, videoDecoder->getWidth(), videoDecoder->getHeight(), bytesPerPixel);
 					g_system->copyRectToScreen(scaleBuffer, pitch, x, y, width, height);
 				} else {
@@ -93,8 +92,8 @@ void playVideo(Video::VideoDecoder *videoDecoder, VideoState videoState) {
 				}
 
 				if (videoDecoder->hasDirtyPalette()) {
-					const byte *palette = videoDecoder->getPalette() + s->_vmdPalStart * 3;
-					g_system->getPaletteManager()->setPalette(palette, s->_vmdPalStart, s->_vmdPalEnd - s->_vmdPalStart);
+					const byte *palette = videoDecoder->getPalette();
+					g_system->getPaletteManager()->setPalette(palette, 0, 255);
 				}
 
 				g_system->updateScreen();
diff --git a/engines/sci/engine/state.cpp b/engines/sci/engine/state.cpp
index 2c85907..a338bef 100644
--- a/engines/sci/engine/state.cpp
+++ b/engines/sci/engine/state.cpp
@@ -121,9 +121,6 @@ void EngineState::reset(bool isRestoring) {
 
 	_videoState.reset();
 	_syncedAudioOptions = false;
-
-	_vmdPalStart = 0;
-	_vmdPalEnd = 256;
 }
 
 void EngineState::speedThrottler(uint32 neededSleep) {
diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h
index dd8d76f..baa912b 100644
--- a/engines/sci/engine/state.h
+++ b/engines/sci/engine/state.h
@@ -203,7 +203,6 @@ public:
 
 	// TODO: Excise video code from the state manager
 	VideoState _videoState;
-	uint16 _vmdPalStart, _vmdPalEnd;
 	bool _syncedAudioOptions;
 
 	/**


Commit: e55b7745845e39ba385bff07d8dc45fa7317a4cb
    https://github.com/scummvm/scummvm/commit/e55b7745845e39ba385bff07d8dc45fa7317a4cb
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-08-19T15:23:10-05:00

Commit Message:
SCI32: Add kPlayVMDGetStatus kernel call

Used by Lighthouse.

Changed paths:
    engines/sci/engine/kernel.h
    engines/sci/engine/kernel_tables.h
    engines/sci/engine/kvideo.cpp
    engines/sci/graphics/video32.cpp
    engines/sci/graphics/video32.h



diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 4ddddd9..4208ae3 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -466,6 +466,7 @@ reg_t kPlayVMD(EngineState *s, int argc, reg_t *argv);
 reg_t kPlayVMDOpen(EngineState *s, int argc, reg_t *argv);
 reg_t kPlayVMDInit(EngineState *s, int argc, reg_t *argv);
 reg_t kPlayVMDClose(EngineState *s, int argc, reg_t *argv);
+reg_t kPlayVMDGetStatus(EngineState *s, int argc, reg_t *argv);
 reg_t kPlayVMDPlayUntilEvent(EngineState *s, int argc, reg_t *argv);
 reg_t kPlayVMDShowCursor(EngineState *s, int argc, reg_t *argv);
 reg_t kPlayVMDSetBlackoutArea(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index deb3f3c..3e04827 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -451,6 +451,7 @@ static const SciKernelMapSubEntry kPlayVMD_subops[] = {
 	{ SIG_SINCE_SCI21,     0, MAP_CALL(PlayVMDOpen),               "r(i)(i)",              NULL },
 	{ SIG_SINCE_SCI21,     1, MAP_CALL(PlayVMDInit),               "ii(i)(i)(ii)",         NULL },
 	{ SIG_SINCE_SCI21,     6, MAP_CALL(PlayVMDClose),              "",                     NULL },
+	{ SIG_SINCE_SCI21,    10, MAP_CALL(PlayVMDGetStatus),          "",                     NULL },
 	{ SIG_SINCE_SCI21,    14, MAP_CALL(PlayVMDPlayUntilEvent),     "i(i)(i)",              NULL },
 	{ SIG_SINCE_SCI21,    16, MAP_CALL(PlayVMDShowCursor),         "i",                    NULL },
 	{ SIG_SINCE_SCI21,    17, MAP_DUMMY(PlayVMDStartBlob),         "",                     NULL },
diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp
index f61673e..b539c84 100644
--- a/engines/sci/engine/kvideo.cpp
+++ b/engines/sci/engine/kvideo.cpp
@@ -425,6 +425,10 @@ reg_t kPlayVMDClose(EngineState *s, int argc, reg_t *argv) {
 	return make_reg(0, g_sci->_video32->getVMDPlayer().close());
 }
 
+reg_t kPlayVMDGetStatus(EngineState *s, int argc, reg_t *argv) {
+	return make_reg(0, g_sci->_video32->getVMDPlayer().getStatus());
+}
+
 reg_t kPlayVMDPlayUntilEvent(EngineState *s, int argc, reg_t *argv) {
 	const VMDPlayer::EventFlags flags = (VMDPlayer::EventFlags)argv[0].toUint16();
 	const int16 lastFrameNo = argc > 1 ? argv[1].toSint16() : -1;
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index b4b14d6..8b1d4ef 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -613,6 +613,22 @@ VMDPlayer::IOStatus VMDPlayer::close() {
 	return kIOSuccess;
 }
 
+VMDPlayer::VMDStatus VMDPlayer::getStatus() const {
+	if (!_isOpen) {
+		return kVMDNotOpen;
+	}
+	if (_decoder->isPaused()) {
+		return kVMDPaused;
+	}
+	if (_decoder->isPlaying()) {
+		return kVMDPlaying;
+	}
+	if (_decoder->endOfVideo()) {
+		return kVMDFinished;
+	}
+	return kVMDOpen;
+}
+
 VMDPlayer::EventFlags VMDPlayer::kernelPlayUntilEvent(const EventFlags flags, const int16 lastFrameNo, const int16 yieldInterval) {
 	assert(lastFrameNo >= -1);
 
diff --git a/engines/sci/graphics/video32.h b/engines/sci/graphics/video32.h
index 3ea2442..75b8fb2 100644
--- a/engines/sci/graphics/video32.h
+++ b/engines/sci/graphics/video32.h
@@ -268,6 +268,15 @@ public:
 		kEventFlagReverse      = 0x80
 	};
 
+	enum VMDStatus {
+		kVMDNotOpen  = 0,
+		kVMDOpen     = 1,
+		kVMDPlaying  = 2,
+		kVMDPaused   = 3,
+		kVMDStopped  = 4,
+		kVMDFinished = 5
+	};
+
 	VMDPlayer(SegManager *segMan, EventManager *eventMan);
 	~VMDPlayer();
 
@@ -295,6 +304,11 @@ public:
 	 */
 	IOStatus close();
 
+	/**
+	 * Gets the playback status of the VMD player.
+	 */
+	VMDStatus getStatus() const;
+
 	// NOTE: Was WaitForEvent in SSCI
 	EventFlags kernelPlayUntilEvent(const EventFlags flags, const int16 lastFrameNo, const int16 yieldInterval);
 


Commit: 051eae46390fe7289365f68ea2321c098d60748a
    https://github.com/scummvm/scummvm/commit/051eae46390fe7289365f68ea2321c098d60748a
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-08-19T15:23:10-05:00

Commit Message:
SCI32: Increase maximum line width for graphics

Torin renders pics that are wider than 1024px; SCI3 bumps the
maximum line width to 4k.

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



diff --git a/engines/sci/graphics/celobj32.cpp b/engines/sci/graphics/celobj32.cpp
index c5b1133..d053fa2 100644
--- a/engines/sci/graphics/celobj32.cpp
+++ b/engines/sci/graphics/celobj32.cpp
@@ -164,8 +164,8 @@ struct SCALER_Scale {
 	const byte *_row;
 	READER _reader;
 	int16 _x;
-	static int16 _valuesX[1024];
-	static int16 _valuesY[1024];
+	static int16 _valuesX[4096];
+	static int16 _valuesY[4096];
 
 	SCALER_Scale(const CelObj &celObj, const Common::Rect &targetRect, const Common::Point &scaledPosition, const Ratio scaleX, const Ratio scaleY) :
 	_row(nullptr),
@@ -249,9 +249,9 @@ struct SCALER_Scale {
 };
 
 template<bool FLIP, typename READER>
-int16 SCALER_Scale<FLIP, READER>::_valuesX[1024];
+int16 SCALER_Scale<FLIP, READER>::_valuesX[4096];
 template<bool FLIP, typename READER>
-int16 SCALER_Scale<FLIP, READER>::_valuesY[1024];
+int16 SCALER_Scale<FLIP, READER>::_valuesY[4096];
 
 #pragma mark -
 #pragma mark CelObj - Resource readers
@@ -283,7 +283,7 @@ public:
 struct READER_Compressed {
 private:
 	const byte *const _resource;
-	byte _buffer[1024];
+	byte _buffer[4096];
 	uint32 _controlOffset;
 	uint32 _dataOffset;
 	uint32 _uncompressedDataOffset;
diff --git a/engines/sci/graphics/celobj32.h b/engines/sci/graphics/celobj32.h
index e58fb50..21e86d0 100644
--- a/engines/sci/graphics/celobj32.h
+++ b/engines/sci/graphics/celobj32.h
@@ -147,7 +147,7 @@ struct CelScalerTable {
 	 * the correct column to read from the source bitmap
 	 * when drawing a scaled version of the source bitmap.
 	 */
-	int valuesX[1024];
+	int valuesX[4096];
 
 	/**
 	 * The ratio used to generate the x-values.
@@ -159,7 +159,7 @@ struct CelScalerTable {
 	 * the correct row to read from a source bitmap when
 	 * drawing a scaled version of the source bitmap.
 	 */
-	int valuesY[1024];
+	int valuesY[4096];
 
 	/**
 	 * The ratio used to generate the y-values.


Commit: 0a4a2567a3b8f42f6aad9f03e7619bd88a25322d
    https://github.com/scummvm/scummvm/commit/0a4a2567a3b8f42f6aad9f03e7619bd88a25322d
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-08-19T15:23:10-05:00

Commit Message:
SCI32: Partially implement kCD

Changed paths:
    engines/sci/engine/kernel.h
    engines/sci/engine/kernel_tables.h
    engines/sci/engine/kfile.cpp
    engines/sci/resource.cpp
    engines/sci/resource.h



diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h
index 4208ae3..90f582c 100644
--- a/engines/sci/engine/kernel.h
+++ b/engines/sci/engine/kernel.h
@@ -610,6 +610,8 @@ reg_t kSave(EngineState *s, int argc, reg_t *argv);
 reg_t kAutoSave(EngineState *s, int argc, reg_t *argv);
 reg_t kList(EngineState *s, int argc, reg_t *argv);
 reg_t kCD(EngineState *s, int argc, reg_t *argv);
+reg_t kCheckCD(EngineState *s, int argc, reg_t *argv);
+reg_t kGetSavedCD(EngineState *s, int argc, reg_t *argv);
 reg_t kAddPicAt(EngineState *s, int argc, reg_t *argv);
 reg_t kAddBefore(EngineState *s, int argc, reg_t *argv);
 reg_t kMoveToFront(EngineState *s, int argc, reg_t *argv);
diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 3e04827..7386175 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -396,6 +396,13 @@ static const SciKernelMapSubEntry kBitmap_subops[] = {
 };
 
 //    version,         subId, function-mapping,                    signature,              workarounds
+static const SciKernelMapSubEntry kCD_subops[] = {
+	{ SIG_SINCE_SCI21MID,  0, MAP_CALL(CheckCD),                   "(i)",                  NULL },
+	{ SIG_SINCE_SCI21MID,  1, MAP_CALL(GetSavedCD),                "",                     NULL },
+	SCI_SUBOPENTRY_TERMINATOR
+};
+
+//    version,         subId, function-mapping,                    signature,              workarounds
 static const SciKernelMapSubEntry kList_subops[] = {
 	{ SIG_SINCE_SCI21,     0, MAP_CALL(NewList),                   "",                     NULL },
 	{ SIG_SINCE_SCI21,     1, MAP_CALL(DisposeList),               "l",                    NULL },
@@ -871,7 +878,7 @@ static SciKernelMapEntry s_kernelMap[] = {
 	{ MAP_DUMMY(PointSize),        SIG_EVERYWHERE,           "(.*)",                  NULL,            NULL },
 
 	// SCI2.1 Kernel Functions
-	{ MAP_CALL(CD),                SIG_EVERYWHERE,           "(.*)",                  NULL,            NULL },
+	{ MAP_CALL(CD),                SIG_SINCE_SCI21MID, SIGFOR_ALL, "(.*)",            kCD_subops,      NULL },
 	{ MAP_CALL(IsOnMe),            SIG_EVERYWHERE,           "iioi",                  NULL,            NULL },
 	{ MAP_CALL(List),              SIG_SINCE_SCI21, SIGFOR_ALL, "(.*)",               kList_subops,    NULL },
 	{ MAP_CALL(MulDiv),            SIG_EVERYWHERE,           "iii",                   NULL,            NULL },
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index 3bcadd1..a3a97eb 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -40,6 +40,9 @@
 #include "sci/engine/savegame.h"
 #include "sci/sound/audio.h"
 #include "sci/console.h"
+#ifdef ENABLE_SCI32
+#include "sci/resource.h"
+#endif
 
 namespace Sci {
 
@@ -196,26 +199,25 @@ reg_t kValidPath(EngineState *s, int argc, reg_t *argv) {
 #ifdef ENABLE_SCI32
 
 reg_t kCD(EngineState *s, int argc, reg_t *argv) {
-	// TODO: Stub
-	switch (argv[0].toUint16()) {
-	case 0:
-		if (argc == 1) {
-			// Check if a disc is in the drive
-			return TRUE_REG;
-		} else {
-			// Check if the specified disc is in the drive
-			// and return the current disc number. We just
-			// return the requested disc number.
-			return argv[1];
-		}
-	case 1:
-		// Return the current CD number
-		return make_reg(0, 1);
-	default:
-		warning("CD(%d)", argv[0].toUint16());
+	if (!s)
+		return make_reg(0, getSciVersion());
+	error("not supposed to call this");
+}
+
+reg_t kCheckCD(EngineState *s, int argc, reg_t *argv) {
+	const int16 cdNo = argc > 0 ? argv[0].toSint16() : 0;
+
+	if (cdNo) {
+		g_sci->getResMan()->findDisc(cdNo);
 	}
 
-	return NULL_REG;
+	return make_reg(0, g_sci->getResMan()->getCurrentDiscNo());
+}
+
+reg_t kGetSavedCD(EngineState *s, int argc, reg_t *argv) {
+	// TODO: This is wrong, CD number needs to be available prior to
+	// the save game being loaded
+	return make_reg(0, g_sci->getResMan()->getCurrentDiscNo());
 }
 
 #endif
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 48278e3..26b8a32 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -859,6 +859,13 @@ void ResourceManager::addResourcesFromChunk(uint16 id) {
 	scanNewSources();
 }
 
+void ResourceManager::findDisc(const int16 discNo) {
+	// Since all resources are expected to be copied from the original discs
+	// into a single game directory, this call just records the number of the CD
+	// that the game has requested
+	_currentDiscNo = discNo;
+}
+
 #endif
 
 void ResourceManager::freeResourceSources() {
@@ -878,7 +885,9 @@ void ResourceManager::init() {
 	_LRU.clear();
 	_resMap.clear();
 	_audioMapSCI1 = NULL;
-
+#ifdef ENABLE_SCI32
+	_currentDiscNo = 1;
+#endif
 	// FIXME: put this in an Init() function, so that we can error out if detection fails completely
 
 	_mapVersion = detectMapVersion();
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index f70bf48..49cc523 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -397,6 +397,24 @@ public:
 	 * resource manager.
 	 */
 	void addResourcesFromChunk(uint16 id);
+
+	/**
+	 * Updates the currently active disc number.
+	 */
+	void findDisc(const int16 discNo);
+
+	/**
+	 * Gets the currently active disc number.
+	 */
+	int16 getCurrentDiscNo() const { return _currentDiscNo; }
+
+private:
+	/**
+	 * The currently active disc number.
+	 */
+	int16 _currentDiscNo;
+
+public:
 #endif
 
 	bool detectHires();


Commit: c4250c05d02dc25fb20e8314ec960bec5ac59779
    https://github.com/scummvm/scummvm/commit/c4250c05d02dc25fb20e8314ec960bec5ac59779
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-08-19T15:23:10-05:00

Commit Message:
SCI32: Enable multi-disc audio resources

Phant1, PQ:SWAT, GK2, and Phant2 all have different audio maps
and audio volumes on each CD. In order to make this work within
ScummVM, where CDs are never swapped, each RESOURCE.AUD for these
games must be renamed to RESAUD.00x and each RESOURCE.SFX renamed
to RESSFX.00x.

Changed paths:
    engines/sci/detection.cpp
    engines/sci/resource.cpp
    engines/sci/resource.h
    engines/sci/resource_audio.cpp
    engines/sci/resource_intern.h



diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp
index f5797dc..ad2b0f3 100644
--- a/engines/sci/detection.cpp
+++ b/engines/sci/detection.cpp
@@ -565,8 +565,8 @@ const ADGameDescription *SciMetaEngine::fallbackDetect(const FileMap &allFiles,
 	// the file should be over 10MB, as it contains all the game speech and is usually
 	// around 450MB+. The size check is for some floppy game versions like KQ6 floppy, which
 	// also have a small resource.aud file
-	if (allFiles.contains("resource.aud") || allFiles.contains("audio001.002")) {
-		Common::FSNode file = allFiles.contains("resource.aud") ? allFiles["resource.aud"] :  allFiles["audio001.002"];
+	if (allFiles.contains("resource.aud") || allFiles.contains("resaud.001") || allFiles.contains("audio001.002")) {
+		Common::FSNode file = allFiles.contains("resource.aud") ? allFiles["resource.aud"] : (allFiles.contains("resaud.001") ? allFiles["resaud.001"] : allFiles["audio001.002"]);
 		Common::SeekableReadStream *tmpStream = file.createReadStream();
 		if (tmpStream->size() > 10 * 1024 * 1024) {
 			// We got a CD version, so set the CD flag accordingly
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 26b8a32..f2321f5 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -573,6 +573,9 @@ Resource *ResourceManager::testResource(ResourceId id) {
 }
 
 int ResourceManager::addAppropriateSources() {
+#ifdef ENABLE_SCI32
+	_multiDiscAudio = false;
+#endif
 	if (Common::File::exists("resource.map")) {
 		// SCI0-SCI2 file naming scheme
 		ResourceSource *map = addExternalMap("resource.map");
@@ -615,6 +618,10 @@ int ResourceManager::addAppropriateSources() {
 		if (mapFiles.empty() || files.empty() || mapFiles.size() != files.size())
 			return 0;
 
+		if (Common::File::exists("resaud.001")) {
+			_multiDiscAudio = true;
+		}
+
 		for (Common::ArchiveMemberList::const_iterator mapIterator = mapFiles.begin(); mapIterator != mapFiles.end(); ++mapIterator) {
 			Common::String mapName = (*mapIterator)->getName();
 			int mapNumber = atoi(strrchr(mapName.c_str(), '.') + 1);
@@ -1747,11 +1754,42 @@ int ResourceManager::readResourceMapSCI1(ResourceSource *map) {
 				// if we use the first entries in the resource file, half of the
 				// game will be English and umlauts will also be missing :P
 				if (resource->_source->getSourceType() == kSourceVolume) {
+					// Maps are read during the scanning process (below), so
+					// need to be treated as unallocated in order for the new
+					// data from this volume to be picked up and used
+					if (resId.getType() == kResourceTypeMap) {
+						resource->_status = kResStatusNoMalloc;
+					}
 					resource->_source = source;
 					resource->_fileOffset = fileOffset;
 					resource->size = 0;
 				}
 			}
+
+#ifdef ENABLE_SCI32
+			// Different CDs may have different audio maps on each disc. The
+			// ResourceManager does not know how to deal with this; it expects
+			// each resource ID to be unique across an entire game. To work
+			// around this problem, all audio maps from this disc must be
+			// processed immediately, since they will be replaced by the audio
+			// map from the next disc on the next call to readResourceMapSCI1
+			if (_multiDiscAudio && resId.getType() == kResourceTypeMap) {
+				IntMapResourceSource *audioMap = static_cast<IntMapResourceSource *>(addSource(new IntMapResourceSource("MAP", mapVolumeNr, resId.getNumber())));
+				Common::String volumeName;
+				if (resId.getNumber() == 65535) {
+					volumeName = Common::String::format("RESSFX.%03d", mapVolumeNr);
+				} else {
+					volumeName = Common::String::format("RESAUD.%03d", mapVolumeNr);
+				}
+
+				ResourceSource *audioVolume = addSource(new AudioVolumeResourceSource(this, volumeName, audioMap, mapVolumeNr));
+				if (!audioMap->_scanned) {
+					audioVolume->_scanned = true;
+					audioMap->_scanned = true;
+					audioMap->scanSource(this);
+				}
+			}
+#endif
 		}
 	}
 
diff --git a/engines/sci/resource.h b/engines/sci/resource.h
index 49cc523..70db590 100644
--- a/engines/sci/resource.h
+++ b/engines/sci/resource.h
@@ -296,6 +296,7 @@ protected:
 
 typedef Common::HashMap<ResourceId, Resource *, ResourceIdHash> ResourceMap;
 
+class IntMapResourceSource;
 class ResourceManager {
 	// FIXME: These 'friend' declarations are meant to be a temporary hack to
 	// ease transition to the ResourceSource class system.
@@ -414,6 +415,12 @@ private:
 	 */
 	int16 _currentDiscNo;
 
+	/**
+	 * If true, the game has multiple audio volumes that contain different
+	 * audio files for each disc.
+	 */
+	bool _multiDiscAudio;
+
 public:
 #endif
 
@@ -538,7 +545,7 @@ protected:
 	 * @param map The map
 	 * @return 0 on success, an SCI_ERROR_* code otherwise
 	 */
-	int readAudioMapSCI11(ResourceSource *map);
+	int readAudioMapSCI11(IntMapResourceSource *map);
 
 	/**
 	 * Reads SCI1 audio map files.
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index 5ab443a..cbc4a02 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -277,7 +277,7 @@ void ResourceManager::removeAudioResource(ResourceId resId) {
 // w syncSize (iff seq has bit 7 set)
 // w syncAscSize (iff seq has bit 6 set)
 
-int ResourceManager::readAudioMapSCI11(ResourceSource *map) {
+int ResourceManager::readAudioMapSCI11(IntMapResourceSource *map) {
 #ifndef ENABLE_SCI32
 	// SCI32 support is not built in. Check if this is a SCI32 game
 	// and if it is abort here.
@@ -286,17 +286,19 @@ int ResourceManager::readAudioMapSCI11(ResourceSource *map) {
 #endif
 
 	uint32 offset = 0;
-	Resource *mapRes = findResource(ResourceId(kResourceTypeMap, map->_volumeNumber), false);
+	Resource *mapRes = findResource(ResourceId(kResourceTypeMap, map->_mapNumber), false);
 
 	if (!mapRes) {
-		warning("Failed to open %i.MAP", map->_volumeNumber);
+		warning("Failed to open %i.MAP", map->_mapNumber);
 		return SCI_ERROR_RESMAP_NOT_FOUND;
 	}
 
-	ResourceSource *src = findVolume(map, 0);
+	ResourceSource *src = findVolume(map, map->_volumeNumber);
 
-	if (!src)
+	if (!src) {
+		warning("Failed to find volume for %i.MAP", map->_mapNumber);
 		return SCI_ERROR_NO_RESOURCE_FILES_FOUND;
+	}
 
 	byte *ptr = mapRes->data;
 
@@ -309,7 +311,7 @@ int ResourceManager::readAudioMapSCI11(ResourceSource *map) {
 			break;
 	}
 
-	if (map->_volumeNumber == 65535) {
+	if (map->_mapNumber == 65535) {
 		while (ptr < mapRes->data + mapRes->size) {
 			uint16 n = READ_LE_UINT16(ptr);
 			ptr += 2;
@@ -327,7 +329,7 @@ int ResourceManager::readAudioMapSCI11(ResourceSource *map) {
 
 			addResource(ResourceId(kResourceTypeAudio, n), src, offset);
 		}
-	} else if (map->_volumeNumber == 0 && entrySize == 10 && ptr[3] == 0) {
+	} else if (map->_mapNumber == 0 && entrySize == 10 && ptr[3] == 0) {
 		// QFG3 demo format
 		// ptr[3] would be 'seq' in the normal format and cannot possibly be 0
 		while (ptr < mapRes->data + mapRes->size) {
@@ -344,7 +346,7 @@ int ResourceManager::readAudioMapSCI11(ResourceSource *map) {
 
 			addResource(ResourceId(kResourceTypeAudio, n), src, offset, size);
 		}
-	} else if (map->_volumeNumber == 0 && entrySize == 8 && READ_LE_UINT16(ptr + 2) == 0xffff) {
+	} else if (map->_mapNumber == 0 && entrySize == 8 && READ_LE_UINT16(ptr + 2) == 0xffff) {
 		// LB2 Floppy/Mother Goose SCI1.1 format
 		Common::SeekableReadStream *stream = getVolumeFile(src);
 
@@ -400,7 +402,7 @@ int ResourceManager::readAudioMapSCI11(ResourceSource *map) {
 				// FIXME: The sync36 resource seems to be two bytes too big in KQ6CD
 				// (bytes taken from the RAVE resource right after it)
 				if (syncSize > 0)
-					addResource(ResourceId(kResourceTypeSync36, map->_volumeNumber, n & 0xffffff3f), src, offset, syncSize);
+					addResource(ResourceId(kResourceTypeSync36, map->_mapNumber, n & 0xffffff3f), src, offset, syncSize);
 			}
 
 			if (n & 0x40) {
@@ -410,12 +412,12 @@ int ResourceManager::readAudioMapSCI11(ResourceSource *map) {
 				ptr += 2;
 
 				if (kq6HiresSyncSize > 0) {
-					addResource(ResourceId(kResourceTypeRave, map->_volumeNumber, n & 0xffffff3f), src, offset + syncSize, kq6HiresSyncSize);
+					addResource(ResourceId(kResourceTypeRave, map->_mapNumber, n & 0xffffff3f), src, offset + syncSize, kq6HiresSyncSize);
 					syncSize += kq6HiresSyncSize;
 				}
 			}
 
-			addResource(ResourceId(kResourceTypeAudio36, map->_volumeNumber, n & 0xffffff3f), src, offset + syncSize);
+			addResource(ResourceId(kResourceTypeAudio36, map->_mapNumber, n & 0xffffff3f), src, offset + syncSize);
 		}
 	}
 
@@ -937,13 +939,21 @@ void AudioVolumeResourceSource::loadResource(ResourceManager *resMan, Resource *
 }
 
 bool ResourceManager::addAudioSources() {
+#ifdef ENABLE_SCI32
+	// Multi-disc audio is added during addAppropriateSources for those titles
+	// that require it
+	if (_multiDiscAudio) {
+		return true;
+	}
+#endif
+
 	Common::List<ResourceId> resources = listResources(kResourceTypeMap);
 	Common::List<ResourceId>::iterator itr;
 
 	for (itr = resources.begin(); itr != resources.end(); ++itr) {
-		ResourceSource *src = addSource(new IntMapResourceSource("MAP", itr->getNumber()));
+		ResourceSource *src = addSource(new IntMapResourceSource("MAP", 0, itr->getNumber()));
 
-		if ((itr->getNumber() == 65535) && Common::File::exists("RESOURCE.SFX"))
+		if (itr->getNumber() == 65535 && Common::File::exists("RESOURCE.SFX"))
 			addSource(new AudioVolumeResourceSource(this, "RESOURCE.SFX", src, 0));
 		else if (Common::File::exists("RESOURCE.AUD"))
 			addSource(new AudioVolumeResourceSource(this, "RESOURCE.AUD", src, 0));
@@ -991,7 +1001,7 @@ void ResourceManager::changeAudioDirectory(Common::String path) {
 		if ((it->getNumber() == 65535))
 			continue;
 
-		ResourceSource *src = addSource(new IntMapResourceSource(mapName, it->getNumber()));
+		ResourceSource *src = addSource(new IntMapResourceSource(mapName, 0, it->getNumber()));
 		addSource(new AudioVolumeResourceSource(this, audioResourceName, src, 0));
 	}
 
diff --git a/engines/sci/resource_intern.h b/engines/sci/resource_intern.h
index 461d684..fe4b0a9 100644
--- a/engines/sci/resource_intern.h
+++ b/engines/sci/resource_intern.h
@@ -134,8 +134,9 @@ public:
 
 class IntMapResourceSource : public ResourceSource {
 public:
-	IntMapResourceSource(const Common::String &name, int volNum)
-		: ResourceSource(kSourceIntMap, name, volNum) {
+	uint16 _mapNumber;
+	IntMapResourceSource(const Common::String &name, int volNum, int mapNum)
+		: ResourceSource(kSourceIntMap, name, volNum), _mapNumber(mapNum) {
 	}
 
 	virtual void scanSource(ResourceManager *resMan);


Commit: b106ba1102739381aac1813fcfbac2461c9e6b7d
    https://github.com/scummvm/scummvm/commit/b106ba1102739381aac1813fcfbac2461c9e6b7d
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-08-19T15:23:10-05:00

Commit Message:
SCI: Avoid attempts to use exe/txt/dll files as patches

Fixes some false warnings when games try to read in non-patch
files with names that start with A/B/S/T.

Changed paths:
    engines/sci/resource.cpp



diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index f2321f5..2bd941b 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -1493,6 +1493,12 @@ void ResourceManager::readResourcePatchesBase36() {
 		for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); ++x) {
 			name = (*x)->getName();
 
+			// The S/T prefixes often conflict with non-patch files and generate
+			// spurious warnings about invalid patches
+			if (name.hasSuffix(".DLL") || name.hasSuffix(".EXE") || name.hasSuffix(".TXT")) {
+				continue;
+			}
+
 			ResourceId resource36 = convertPatchNameBase36((ResourceType)i, name);
 
 			/*


Commit: dc093742b3d92868019e2c826dbce5151ee4e48b
    https://github.com/scummvm/scummvm/commit/dc093742b3d92868019e2c826dbce5151ee4e48b
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-08-19T15:23:10-05:00

Commit Message:
SCI32: Bug fixes to PQ:SWAT script bugs and kList calls

Changed paths:
    engines/sci/engine/kernel_tables.h
    engines/sci/engine/workarounds.cpp



diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 7386175..68611b0 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -413,8 +413,8 @@ static const SciKernelMapSubEntry kList_subops[] = {
 	{ SIG_SINCE_SCI21,     6, MAP_CALL(NextNode),                  "n",                    NULL },
 	{ SIG_SINCE_SCI21,     7, MAP_CALL(PrevNode),                  "n",                    NULL },
 	{ SIG_SINCE_SCI21,     8, MAP_CALL(NodeValue),                 "[n0]",                 NULL },
-	{ SIG_SINCE_SCI21,     9, MAP_CALL(AddAfter),                  "lnn.",                 NULL },
-	{ SIG_SINCE_SCI21,    10, MAP_CALL(AddToFront),                "ln.",                  NULL },
+	{ SIG_SINCE_SCI21,     9, MAP_CALL(AddAfter),                  "lnn(.)",               NULL },
+	{ SIG_SINCE_SCI21,    10, MAP_CALL(AddToFront),                "ln(.)",                NULL },
 	{ SIG_SINCE_SCI21,    11, MAP_CALL(AddToEnd),                  "ln(.)",                NULL },
 	{ SIG_SINCE_SCI21,    12, MAP_CALL(AddBefore),                 "ln.",                  NULL },
 	{ SIG_SINCE_SCI21,    13, MAP_CALL(MoveToFront),               "ln",                   NULL },
diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 15f229f..bc13908 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -329,7 +329,7 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
 	{ GID_PEPPER,         -1,   894,  0,            "Package", "doVerb",                          NULL,     3, { WORKAROUND_FAKE,   0 } }, // using the hand on the book in the inventory - bug #5154
 	{ GID_PEPPER,        150,   928,  0,           "Narrator", "startText",                       NULL,     0, { WORKAROUND_FAKE,   0 } }, // happens during the non-interactive demo of Pepper
 	{ GID_PQ4,            -1,    25,  0,         "iconToggle", "select",                          NULL,     1, { WORKAROUND_FAKE,   0 } }, // when toggling the icon bar to auto-hide or not
-	{ GID_PQSWAT,         -1, 64950,  0,               "View", "handleEvent",                     NULL,     0, { WORKAROUND_FAKE,   0 } }, // Using the menu in the beginning
+	{ GID_PQSWAT,         -1, 64950,  0,                 NULL, "handleEvent",                     NULL,     0, { WORKAROUND_FAKE,   0 } }, // Using any menus in-game
 	{ GID_QFG1,           -1,   210,  0,          "Encounter", "init",           sig_uninitread_qfg1_1,     0, { WORKAROUND_FAKE,   0 } }, // qfg1/hq1: going to the brigands hideout
 	{ GID_QFG1VGA,        16,    16,  0,        "lassoFailed", "changeState",                     NULL,    -1, { WORKAROUND_FAKE,   0 } }, // qfg1vga: casting the "fetch" spell in the screen with the flowers, temps 0 and 1 - bug #5309
 	{ GID_QFG1VGA,        -1,   210,  0,          "Encounter", "init",        sig_uninitread_qfg1vga_1,     0, { WORKAROUND_FAKE,   0 } }, // qfg1vga: going to the brigands hideout - bug #5515


Commit: da62a99a00c625886b1a3297387f1c164ce23861
    https://github.com/scummvm/scummvm/commit/da62a99a00c625886b1a3297387f1c164ce23861
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-08-19T15:23:10-05:00

Commit Message:
SCI32: Remove unused ResourceManager from GfxFrameout

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



diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index e690a3e..4e0aa22 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -57,11 +57,10 @@
 
 namespace Sci {
 
-GfxFrameout::GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor) :
+GfxFrameout::GfxFrameout(SegManager *segMan, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor) :
 	_isHiRes(ConfMan.getBool("enable_high_resolution_graphics")),
 	_palette(palette),
 	_cursor(cursor),
-	_resMan(resMan),
 	_segMan(segMan),
 	_transitions(transitions),
 	_benchmarkingFinished(false),
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index 05e9e4e..e4caffd 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -42,11 +42,10 @@ class GfxFrameout {
 private:
 	GfxCursor32 *_cursor;
 	GfxPalette32 *_palette;
-	ResourceManager *_resMan;
 	SegManager *_segMan;
 
 public:
-	GfxFrameout(SegManager *segMan, ResourceManager *resMan, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor);
+	GfxFrameout(SegManager *segMan, GfxPalette32 *palette, GfxTransitions32 *transitions, GfxCursor32 *cursor);
 	~GfxFrameout();
 
 	bool _isHiRes;
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index cb82538..6c51060 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -736,7 +736,7 @@ void SciEngine::initGraphics() {
 		_gfxCompare = new GfxCompare(_gamestate->_segMan, _gfxCache, nullptr, _gfxCoordAdjuster);
 		_gfxPaint32 = new GfxPaint32(_gamestate->_segMan);
 		_gfxTransitions32 = new GfxTransitions32(_gamestate->_segMan);
-		_gfxFrameout = new GfxFrameout(_gamestate->_segMan, _resMan, _gfxPalette32, _gfxTransitions32, _gfxCursor32);
+		_gfxFrameout = new GfxFrameout(_gamestate->_segMan, _gfxPalette32, _gfxTransitions32, _gfxCursor32);
 		_gfxCursor32->init(_gfxFrameout->getCurrentBuffer());
 		_gfxText32 = new GfxText32(_gamestate->_segMan, _gfxCache);
 		_gfxControls32 = new GfxControls32(_gamestate->_segMan, _gfxCache, _gfxText32);


Commit: 7f23c91de9a784ebbd92a566f9c20cfc2f8a7534
    https://github.com/scummvm/scummvm/commit/7f23c91de9a784ebbd92a566f9c20cfc2f8a7534
Author: Colin Snover (github.com at zetafleet.com)
Date: 2016-08-19T15:23:10-05:00

Commit Message:
SCI32: Fix limited data range comparison warning

On at least DC platform, the ShowStyleType enum is fit to a 4-bit
data size, so the 16-bit input value needs to be checked for
validity *before* it is cast to a 4-bit ShowStyleType.

Changed paths:
    engines/sci/engine/kgraphics32.cpp
    engines/sci/graphics/transitions32.cpp



diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index aa9fc18..13a209e 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -366,7 +366,7 @@ reg_t kMessageBox(EngineState *s, int argc, reg_t *argv) {
  * effect
  */
 reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
-	ShowStyleType type = (ShowStyleType)argv[0].toUint16();
+	const uint16 type = argv[0].toUint16();
 	reg_t planeObj = argv[1];
 	int16 seconds = argv[2].toSint16();
 	// NOTE: This value seems to indicate whether the transition is an
@@ -401,6 +401,10 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
 		divisions = argc > 9 ? argv[9].toSint16() : -1;
 	}
 
+	if ((getSciVersion() < SCI_VERSION_2_1_MIDDLE && g_sci->getGameId() != GID_KQ7 && type == 15) || type > 15) {
+		error("Illegal show style %d for plane %04x:%04x", type, PRINT_REG(planeObj));
+	}
+
 // TODO: Reuse later for SCI2 and SCI3 implementation and then discard
 //	warning("kSetShowStyle: effect %d, plane: %04x:%04x (%s), sec: %d, "
 //			"dir: %d, prio: %d, animate: %d, ref frame: %d, black screen: %d, "
@@ -412,7 +416,7 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
 	// NOTE: The order of planeObj and showStyle are reversed
 	// because this is how SCI3 called the corresponding method
 	// on the KernelMgr
-	g_sci->_gfxTransitions32->kernelSetShowStyle(argc, planeObj, type, seconds, back, priority, animate, refFrame, pFadeArray, divisions, blackScreen);
+	g_sci->_gfxTransitions32->kernelSetShowStyle(argc, planeObj, (ShowStyleType)type, seconds, back, priority, animate, refFrame, pFadeArray, divisions, blackScreen);
 
 	return s->r_acc;
 }
diff --git a/engines/sci/graphics/transitions32.cpp b/engines/sci/graphics/transitions32.cpp
index bceb0fa..37f608d 100644
--- a/engines/sci/graphics/transitions32.cpp
+++ b/engines/sci/graphics/transitions32.cpp
@@ -203,10 +203,6 @@ void GfxTransitions32::kernelSetShowStyle(const uint16 argc, const reg_t planeOb
 		color = 0;
 	}
 
-	if ((getSciVersion() < SCI_VERSION_2_1_MIDDLE && g_sci->getGameId() != GID_KQ7 && type == 15) || type > 15) {
-		error("Illegal show style %d for plane %04x:%04x", type, PRINT_REG(planeObj));
-	}
-
 	Plane *plane = g_sci->_gfxFrameout->getPlanes().findByObject(planeObj);
 	if (plane == nullptr) {
 		error("Plane %04x:%04x is not present in active planes list", PRINT_REG(planeObj));






More information about the Scummvm-git-logs mailing list