[Scummvm-git-logs] scummvm master -> c59df76164573928d189503a93e10e87b3b7b590

bluegr noreply at scummvm.org
Sat Apr 16 11:23:19 UTC 2022


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

Summary:
c59df76164 SCUMM: Refactor the workaround for the broken sample in Indy4


Commit: c59df76164573928d189503a93e10e87b3b7b590
    https://github.com/scummvm/scummvm/commit/c59df76164573928d189503a93e10e87b3b7b590
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2022-04-16T14:23:02+03:00

Commit Message:
SCUMM: Refactor the workaround for the broken sample in Indy4

This makes the workaround code more self-contained

Changed paths:
    devtools/create_project/scripts/prebuild.cmd
    engines/dragons/actor.cpp
    engines/dragons/actor.h
    engines/dragons/actorresource.cpp
    engines/dragons/actorresource.h
    engines/dragons/background.cpp
    engines/dragons/background.h
    engines/dragons/bag.cpp
    engines/dragons/bigfile.cpp
    engines/dragons/bigfile.h
    engines/dragons/credits.cpp
    engines/dragons/cursor.cpp
    engines/dragons/cutscene.cpp
    engines/dragons/dragonflg.cpp
    engines/dragons/dragonflg.h
    engines/dragons/dragonimg.cpp
    engines/dragons/dragonini.cpp
    engines/dragons/dragonini.h
    engines/dragons/dragonobd.cpp
    engines/dragons/dragonrms.cpp
    engines/dragons/dragons.cpp
    engines/dragons/dragons.h
    engines/dragons/font.cpp
    engines/dragons/font.h
    engines/dragons/inventory.cpp
    engines/dragons/inventory.h
    engines/dragons/metaengine.cpp
    engines/dragons/midimusicplayer.cpp
    engines/dragons/minigame1.cpp
    engines/dragons/minigame2.cpp
    engines/dragons/minigame3.cpp
    engines/dragons/minigame4.cpp
    engines/dragons/minigame5.cpp
    engines/dragons/saveload.cpp
    engines/dragons/scene.cpp
    engines/dragons/scene.h
    engines/dragons/screen.cpp
    engines/dragons/screen.h
    engines/dragons/scriptopcodes.cpp
    engines/dragons/scriptopcodes.h
    engines/dragons/sequenceopcodes.cpp
    engines/dragons/sequenceopcodes.h
    engines/dragons/sound.cpp
    engines/dragons/sound.h
    engines/dragons/specialopcodes.cpp
    engines/dragons/specialopcodes.h
    engines/dragons/strplayer.cpp
    engines/dragons/strplayer.h
    engines/dragons/talk.cpp
    engines/dragons/talk.h
    engines/dragons/vabsound.cpp
    engines/dragons/vabsound.h
    engines/sci/engine/script_patches.cpp
    engines/scumm/sound.cpp
    engines/trecision/video.cpp
    engines/trecision/video.h


diff --git a/devtools/create_project/scripts/prebuild.cmd b/devtools/create_project/scripts/prebuild.cmd
index 0efaab190c5..401c18ad9b0 100644
--- a/devtools/create_project/scripts/prebuild.cmd
+++ b/devtools/create_project/scripts/prebuild.cmd
@@ -14,7 +14,7 @@ if "%~1"=="" goto error_root
 if "%~2"=="" goto error_target
 
 REM Run the revision script
- at call cscript "%~1/devtools/create_project/scripts/revision.vbs" "%~1" "%~2" 1>NUL
+REM @call cscript "%~1/devtools/create_project/scripts/revision.vbs" "%~1" "%~2" 1>NUL
 if not %errorlevel% == 0 goto error_script
 goto done
 
diff --git a/engines/dragons/actor.cpp b/engines/dragons/actor.cpp
index c9a3f949f10..508090af2bc 100644
--- a/engines/dragons/actor.cpp
+++ b/engines/dragons/actor.cpp
@@ -354,7 +354,7 @@ bool Actor::startWalk(int16 destX, int16 destY, uint16 flags) {
 		// More adjusting of the source position
 		bool needAdjustSourcePoint = true;
 		for (int pointIndex = 0; pointIndex < kPathPointsCount; ++pointIndex) {
-			const Common::Point pt = getEngine()->_scene->getPoint(pointIndex);
+			const ::Common::Point pt = getEngine()->_scene->getPoint(pointIndex);
 			if (pt.x != -1 && canWalkLine(actorX1, actorY1, pt.x, pt.y, flags)) {
 				needAdjustSourcePoint = false;
 				break;
@@ -362,7 +362,7 @@ bool Actor::startWalk(int16 destX, int16 destY, uint16 flags) {
 		}
 		if (needAdjustSourcePoint) {
 			for (int pointIndex = 0; needAdjustSourcePoint && pointIndex < kPathPointsCount; ++pointIndex) {
-				const Common::Point pt = getEngine()->_scene->getPoint(pointIndex);
+				const ::Common::Point pt = getEngine()->_scene->getPoint(pointIndex);
 				for (int deltaIndex = 0; needAdjustSourcePoint && deltaIndex < 8; ++deltaIndex) {
 					const int deltaX = kAdjustXTbl[deltaIndex];
 					const int deltaY = kAdjustYTbl[deltaIndex];
@@ -379,7 +379,7 @@ bool Actor::startWalk(int16 destX, int16 destY, uint16 flags) {
 		// More adjusting of the destination position
 		bool needAdjustDestPoint = true;
 		for (int pointIndex = 0; pointIndex < kPathPointsCount; ++pointIndex) {
-			const Common::Point pt = getEngine()->_scene->getPoint(pointIndex);
+			const ::Common::Point pt = getEngine()->_scene->getPoint(pointIndex);
 			if (pt.x != -1 && canWalkLine(destX, destY, pt.x, pt.y, flags)) {
 				needAdjustDestPoint = false;
 				break;
@@ -387,7 +387,7 @@ bool Actor::startWalk(int16 destX, int16 destY, uint16 flags) {
 		}
 		if (needAdjustDestPoint) {
 			for (int pointIndex = 0; needAdjustDestPoint && pointIndex < kPathPointsCount; ++pointIndex) {
-				const Common::Point pt = getEngine()->_scene->getPoint(pointIndex);
+				const ::Common::Point pt = getEngine()->_scene->getPoint(pointIndex);
 				for (int deltaIndex = 0; needAdjustDestPoint && deltaIndex < 8; ++deltaIndex) {
 					const int deltaX = kAdjustXTbl[deltaIndex];
 					const int deltaY = kAdjustYTbl[deltaIndex];
@@ -412,11 +412,11 @@ bool Actor::startWalk(int16 destX, int16 destY, uint16 flags) {
 			return false;
 		}
 		pathPointProcessed[foundPointIndex] = true;
-		const Common::Point pt = getEngine()->_scene->getPoint(foundPointIndex);
+		const ::Common::Point pt = getEngine()->_scene->getPoint(foundPointIndex);
 		tempDestX1 = pt.x;
 		tempDestY1 = pt.y;
 		if (pathPointsIndex >= 2) {
-			const Common::Point prevPt = getEngine()->_scene->getPoint(_walkPointsTbl[pathPointsIndex - 2]);
+			const ::Common::Point prevPt = getEngine()->_scene->getPoint(_walkPointsTbl[pathPointsIndex - 2]);
 			if (canWalkLine(pt.x, pt.y, prevPt.x, prevPt.y, flags)) {
 				--pathPointsIndex;
 			}
@@ -464,7 +464,7 @@ bool Actor::startWalk(int16 destX, int16 destY, uint16 flags) {
 		_finalWalkDestX = -1;
 		_finalWalkDestY = -1;
 	} else {
-		const Common::Point pt = getEngine()->_scene->getPoint(_walkPointsTbl[_walkPointsIndex]);
+		const ::Common::Point pt = getEngine()->_scene->getPoint(_walkPointsTbl[_walkPointsIndex]);
 		_walkDestX = pt.x;
 		_walkDestY = pt.y;
 	}
diff --git a/engines/dragons/actor.h b/engines/dragons/actor.h
index ecdddd3884f..5dedef4d024 100644
--- a/engines/dragons/actor.h
+++ b/engines/dragons/actor.h
@@ -58,7 +58,7 @@ enum ActorFrameFlags {
 
 class ActorManager {
 public:
-	typedef Common::Array<Actor> Actors;
+	typedef ::Common::Array<Actor> Actors;
 	typedef Actors::iterator ActorsIterator;
 
 private:
diff --git a/engines/dragons/actorresource.cpp b/engines/dragons/actorresource.cpp
index 74a51b3a22e..7f4214c9f7a 100644
--- a/engines/dragons/actorresource.cpp
+++ b/engines/dragons/actorresource.cpp
@@ -38,14 +38,14 @@ ActorResource *ActorResourceLoader::load(uint32 resourceId) {
 	const char *filename = actorResourceFiles[resourceId];
 	uint32 size;
 	byte *scrData = _bigFileArchive->load(filename, size);
-	Common::SeekableReadStream *readStream = new Common::MemoryReadStream(scrData, size, DisposeAfterUse::NO);
+	::Common::SeekableReadStream *readStream = new ::Common::MemoryReadStream(scrData, size, DisposeAfterUse::NO);
 
 	debug(1, "Loading '%s'", filename);
 	actorResource->load(resourceId, scrData, *readStream);
 	return actorResource;
 }
 
-bool ActorResource::load(uint32 id, byte *dataStart, Common::SeekableReadStream &stream) {
+bool ActorResource::load(uint32 id, byte *dataStart, ::Common::SeekableReadStream &stream) {
 	_id = id;
 	_data = dataStart;
 	_fileSize = stream.size();
@@ -154,7 +154,7 @@ byte *ActorResource::getSequenceData(int16 sequenceId) {
 }
 
 ActorFrame *ActorResource::loadFrameHeader(uint16 frameOffset) {
-	Common::SeekableReadStream *stream = new Common::MemoryReadStream(_data + frameOffset, sizeof(ActorFrame), DisposeAfterUse::NO);
+	Common::SeekableReadStream *stream = new ::Common::MemoryReadStream(_data + frameOffset, sizeof(ActorFrame), DisposeAfterUse::NO);
 
 	ActorFrame *frame = new ActorFrame;
 	frame->xOffset = stream->readSint16LE();
diff --git a/engines/dragons/actorresource.h b/engines/dragons/actorresource.h
index c352a7169b4..f2dd3052e9e 100644
--- a/engines/dragons/actorresource.h
+++ b/engines/dragons/actorresource.h
@@ -68,7 +68,7 @@ private:
 public:
 	ActorResource();
 	~ActorResource();
-	bool load(uint32 id, byte *dataStart, Common::SeekableReadStream &stream);
+	bool load(uint32 id, byte *dataStart, ::Common::SeekableReadStream &stream);
 	Graphics::Surface *loadFrame(ActorFrame &frameNumber, byte *palette);
 	ActorFrame *loadFrameHeader(uint16 frameOffset);
 
diff --git a/engines/dragons/background.cpp b/engines/dragons/background.cpp
index d08e48e681c..3fb5d69d373 100644
--- a/engines/dragons/background.cpp
+++ b/engines/dragons/background.cpp
@@ -45,7 +45,7 @@ void PriorityLayer::load(TileMap &tileMap, byte *tiles) {
 	memcpy(_values, tiles, tileSize);
 }
 
-int16 PriorityLayer::getPriority(Common::Point pos) {
+int16 PriorityLayer::getPriority(::Common::Point pos) {
 	pos.x = CLIP<int16>(pos.x, 0, _width - 1);
 	pos.y = CLIP<int16>(pos.y, 0, _height - 1);
 	const int16 tx = pos.x / TILE_WIDTH, sx = pos.x % TILE_WIDTH;
@@ -87,9 +87,9 @@ Background::Background() : _priorityLayer(nullptr), _points2(nullptr), _data(nul
 	_layerSurface[0] = nullptr;
 	_layerSurface[1] = nullptr;
 	_layerSurface[2] = nullptr;
-	_layerOffset[0] = Common::Point(0, 0);
-	_layerOffset[1] = Common::Point(0, 0);
-	_layerOffset[2] = Common::Point(0, 0);
+	_layerOffset[0] = ::Common::Point(0, 0);
+	_layerOffset[1] = ::Common::Point(0, 0);
+	_layerOffset[2] = ::Common::Point(0, 0);
 	_layerAlphaMode[0] = NONE;
 	_layerAlphaMode[1] = NONE;
 	_layerAlphaMode[2] = NONE;
@@ -112,7 +112,7 @@ Background::~Background() {
 }
 
 bool Background::load(byte *dataStart, uint32 size) {
-	Common::MemoryReadStream stream(dataStart, size, DisposeAfterUse::NO);
+	::Common::MemoryReadStream stream(dataStart, size, DisposeAfterUse::NO);
 	_data = dataStart;
 
 	stream.read(_palette, 512);
@@ -169,8 +169,8 @@ bool Background::load(byte *dataStart, uint32 size) {
 	return false;
 }
 
-Common::Point *Background::loadPoints(Common::SeekableReadStream &stream) {
-	Common::Point *points = new Common::Point[0x20];
+::Common::Point *Background::loadPoints(::Common::SeekableReadStream &stream) {
+	::Common::Point *points = new ::Common::Point[0x20];
 
 	for (int i = 0; i < 0x20; i++) {
 		points[i].x = stream.readUint16LE();
@@ -216,7 +216,7 @@ void drawTileToSurface(Graphics::Surface *surface, byte *palette, byte *tile, ui
 	}
 }
 
-Common::Point Background::getPoint2(uint32 pointIndex) {
+::Common::Point Background::getPoint2(uint32 pointIndex) {
 	assert (pointIndex < 0x20);
 	return _points2[pointIndex];
 }
@@ -231,7 +231,7 @@ uint16 Background::getHeight() {
 	return _layerSurface[1]->h;
 }
 
-int16 Background::getPriorityAtPoint(Common::Point pos) {
+int16 Background::getPriorityAtPoint(::Common::Point pos) {
 	if (pos.x < 0 || pos.x >= getWidth() || pos.y < 0 || pos.y >= getHeight()) {
 		return -1;
 	}
@@ -280,12 +280,12 @@ void Background::setPalette(byte *newPalette) {
 	}
 }
 
-void Background::setLayerOffset(uint8 layerNumber, Common::Point offset) {
+void Background::setLayerOffset(uint8 layerNumber, ::Common::Point offset) {
 	assert(layerNumber < 4);
 	_layerOffset[layerNumber] = offset;
 }
 
-Common::Point Background::getLayerOffset(uint8 layerNumber) {
+::Common::Point Background::getLayerOffset(uint8 layerNumber) {
 	assert(layerNumber < 4);
 	return _layerOffset[layerNumber];
 }
@@ -318,7 +318,7 @@ Background *BackgroundResourceLoader::load(const char *filename) {
 	return bg;
 }
 
-void ScaleLayer::load(Common::SeekableReadStream &stream) {
+void ScaleLayer::load(::Common::SeekableReadStream &stream) {
 	for (int i = 0; i < 32; i++) {
 		_bands[i]._y = stream.readSint16LE();
 		_bands[i]._priority = stream.readSint16LE();
diff --git a/engines/dragons/background.h b/engines/dragons/background.h
index ae490634861..82cb54581ac 100644
--- a/engines/dragons/background.h
+++ b/engines/dragons/background.h
@@ -52,7 +52,7 @@ class ScaleLayer {
 public:
 	ScaleLayer();
 	~ScaleLayer();
-	void load(Common::SeekableReadStream &stream);
+	void load(::Common::SeekableReadStream &stream);
 	uint16 getScale(uint16 y);
 	void backup();
 	void restore();
@@ -89,9 +89,9 @@ private:
 	ScaleLayer _scaleLayer;
 	byte _palette[512];
 	Graphics::Surface *_layerSurface[3];
-	Common::Point *_points2;
+	::Common::Point *_points2;
 	uint8 _layerPriority[3];
-	Common::Point _layerOffset[3];
+	::Common::Point _layerOffset[3];
 	AlphaBlendMode _layerAlphaMode[3];
 
 public:
@@ -112,8 +112,8 @@ public:
 	void setMgLayerPriority(uint8 newPriority) { _layerPriority[1] = newPriority; }
 	void setFgLayerPriority(uint8 newPriority) { _layerPriority[2] = newPriority; }
 
-	int16 getPriorityAtPoint(Common::Point pos);
-	Common::Point getPoint2(uint32 pointIndex);
+	int16 getPriorityAtPoint(::Common::Point pos);
+	::Common::Point getPoint2(uint32 pointIndex);
 	byte *getPalette() { return _palette; }
 
 	void overlayPriorityTileMap(byte *data, int16 x, int16 y, int16 w, int16 h);
@@ -121,7 +121,7 @@ public:
 	void overlayImage(uint16 layerNum, byte *data, int16 x, int16 y, int16 w, int16 h);
 	void restoreTiles(uint16 layerNum, int16 x, int16 y, int16 w, int16 h);
 	void setPalette(byte *newPalette);
-	void setLayerOffset(uint8 layerNumber, Common::Point offset);
+	void setLayerOffset(uint8 layerNumber, ::Common::Point offset);
 	Common::Point getLayerOffset(uint8 layerNumber);
 	ScaleLayer *getScaleLayer() { return &_scaleLayer; }
 
@@ -129,7 +129,7 @@ public:
 	void setLayerAlphaMode(uint8 layerNumber, Dragons::AlphaBlendMode mode);
 
 private:
-	Common::Point *loadPoints(Common::SeekableReadStream &stream);
+	::Common::Point *loadPoints(::Common::SeekableReadStream &stream);
 	Graphics::Surface *initGfxLayer(TileMap &tileMap);
 	void loadGfxLayer(Graphics::Surface *surface, TileMap &tileMap, byte *tiles);
 
@@ -138,7 +138,7 @@ private:
 class PriorityLayer {
 public:
 	void load(TileMap &tileMap, byte *tiles);
-	int16 getPriority(Common::Point pos);
+	int16 getPriority(::Common::Point pos);
 	void overlayTileMap(byte *data, int16 x, int16 y, int16 w, int16 h);
 	void restoreTileMap(int16 x, int16 y, int16 w, int16 h);
 protected:
diff --git a/engines/dragons/bag.cpp b/engines/dragons/bag.cpp
index 3eac3e3c1ef..970e2d56be2 100644
--- a/engines/dragons/bag.cpp
+++ b/engines/dragons/bag.cpp
@@ -47,7 +47,7 @@ void Bag::updatePosition(Common::Point newPos) {
 }
 
 void Bag::draw() {
-	_screen->copyRectToSurface(*_surface, _position.x, _position.y, Common::Rect(_surface->w, _surface->h));
+	_screen->copyRectToSurface(*_surface, _position.x, _position.y, ::Common::Rect(_surface->w, _surface->h));
 }
 
 void Bag::load(BigfileArchive *bigFileArchive) {
@@ -56,7 +56,7 @@ void Bag::load(BigfileArchive *bigFileArchive) {
 	byte *tiles;
 	uint32 size;
 	byte *scrData = bigFileArchive->load("bag.scr", size);
-	Common::MemoryReadStream stream(scrData, size, DisposeAfterUse::YES);
+	::Common::MemoryReadStream stream(scrData, size, DisposeAfterUse::YES);
 
 	stream.seek(0x4);
 	stream.read(pal, 512);
diff --git a/engines/dragons/bigfile.cpp b/engines/dragons/bigfile.cpp
index 255608cf8e4..3db2b5eddb9 100644
--- a/engines/dragons/bigfile.cpp
+++ b/engines/dragons/bigfile.cpp
@@ -19,7 +19,7 @@
  *
  */
 #include "dragons/bigfile.h"
-#include "dragons/dragons.h"
+//#include "dragons/dragons.h"
 
 namespace Dragons {
 
@@ -34,12 +34,12 @@ uint32 BigfileArchive::getResourceId(const char *filename) {
 }
 
 BigfileArchive::BigfileArchive(DragonsEngine *vm, const char *filename) :_vm(vm), _fd(nullptr) {
-	_fd = new Common::File();
+	_fd = new ::Common::File();
 	if (!_fd->open(filename)) {
 		error("BigfileArchive::BigfileArchive() Could not open %s", filename);
 	}
 
-	_totalRecords = _vm->getBigFileTotalRecords();
+	//_totalRecords = _vm->getBigFileTotalRecords();
 	_fileInfoTbl.resize(_totalRecords);
 
 	loadFileInfoTbl();
@@ -57,7 +57,7 @@ void BigfileArchive::loadFileInfoTbl() {
 		error("Failed to open dragon.exe");
 	}
 
-	fd.seek(_vm->getBigFileInfoTblFromDragonEXE());
+	//fd.seek(_vm->getBigFileInfoTblFromDragonEXE());
 
 	for (int i = 0; i < _totalRecords; i++) {
 		fd.read(filename, 16);
diff --git a/engines/dragons/bigfile.h b/engines/dragons/bigfile.h
index b2786946bdd..afcc43f7ce6 100644
--- a/engines/dragons/bigfile.h
+++ b/engines/dragons/bigfile.h
@@ -29,7 +29,7 @@ namespace Dragons {
 class DragonsEngine;
 
 struct FileInfo {
-	Common::String filename;
+	::Common::String filename;
 	uint32 offset;
 	uint32 size;
 	FileInfo() {
@@ -42,9 +42,9 @@ struct FileInfo {
 class BigfileArchive {
 private:
 	DragonsEngine *_vm;
-	Common::File *_fd;
+	::Common::File *_fd;
 	uint16 _totalRecords;
-	Common::Array<FileInfo> _fileInfoTbl;
+	::Common::Array<FileInfo> _fileInfoTbl;
 
 public:
 	BigfileArchive(DragonsEngine *vm, const char *filename);
diff --git a/engines/dragons/credits.cpp b/engines/dragons/credits.cpp
index 9d7f5e4c4d6..24c4287a78f 100644
--- a/engines/dragons/credits.cpp
+++ b/engines/dragons/credits.cpp
@@ -18,17 +18,17 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
-#include "dragons/credits.h"
 
 #include "common/system.h"
-#include "dragons/bigfile.h"
-#include "dragons/dragons.h"
+#include "dragons/credits.h"
+//#include "dragons/bigfile.h"
+//#include "dragons/dragons.h"
 #include "dragons/screen.h"
 #include "dragons/font.h"
 
 namespace Dragons {
 
-void creditsUpdateFunction() {
+/* void creditsUpdateFunction() {
 	getEngine()->_credits->update();
 }
 
@@ -43,16 +43,16 @@ Credits::Credits(DragonsEngine *vm, FontManager *fontManager, BigfileArchive *bi
 	_dataLength = 0;
 	_curPosition = 0;
 }
-
+*/
 void Credits::start() {
-	_surface = new Graphics::Surface();
-	_surface->create(320, 208, Graphics::PixelFormat::createFormatCLUT8());
+	//_surface = new Graphics::Surface();
+	//_surface->create(320, 208, Graphics::PixelFormat::createFormatCLUT8());
 	_updateCounter = 0x78;
 	_curPosition = 0;
-	_creditsData = _bigfileArchive->load("credits.txt", _dataLength);
+	//_creditsData = _bigfileArchive->load("credits.txt", _dataLength);
 	_curPtr = (char *)_creditsData;
 	assert(_creditsData);
-	_vm->setVsyncUpdateFunction(creditsUpdateFunction);
+	//_vm->setVsyncUpdateFunction(creditsUpdateFunction);
 	_running = true;
 }
 
@@ -62,12 +62,12 @@ bool Credits::isRunning() {
 
 void Credits::draw() {
 	if (_running) {
-		_vm->_screen->copyRectToSurface8bppWrappedY(*_surface, _vm->_screen->getPalette(2), _yOffset);
+		//_vm->_screen->copyRectToSurface8bppWrappedY(*_surface, _vm->_screen->getPalette(2), _yOffset);
 	}
 }
 
 void Credits::cleanup() {
-	_vm->setVsyncUpdateFunction(nullptr);
+	//_vm->setVsyncUpdateFunction(nullptr);
 	_surface->free();
 	delete _surface;
 }
diff --git a/engines/dragons/cursor.cpp b/engines/dragons/cursor.cpp
index 4e5e40b64c7..bdff96e4db1 100644
--- a/engines/dragons/cursor.cpp
+++ b/engines/dragons/cursor.cpp
@@ -32,6 +32,7 @@
 
 namespace Dragons {
 
+	/*
 Cursor::Cursor(DragonsEngine *vm): _vm(vm), _actor(nullptr), _x(0), _y(0) {
 	_sequenceID = 0;
 	_data_800728b0_cursor_seqID = 0;
@@ -42,7 +43,7 @@ Cursor::Cursor(DragonsEngine *vm): _vm(vm), _actor(nullptr), _x(0), _y(0) {
 	_iniItemInHand = 0;
 	_handPointerSequenceID = _vm->getCursorHandPointerSequenceID();
 }
-
+*/
 void Cursor::init(ActorManager *actorManager, DragonINIResource *dragonINIResource) {
 	_sequenceID = 0;
 	_actor = actorManager->loadActor(0, 0); //Load cursor
@@ -55,7 +56,7 @@ void Cursor::init(ActorManager *actorManager, DragonINIResource *dragonINIResour
 	_actor->_flags |= (ACTOR_FLAG_40 | Dragons::ACTOR_FLAG_80 | Dragons::ACTOR_FLAG_100 |
 					   ACTOR_FLAG_200);
 
-	dragonINIResource->getFlickerRecord()->actor = _actor; //TODO is this correct?
+	//dragonINIResource->getFlickerRecord()->actor = _actor; //TODO is this correct?
 	dragonINIResource->getFlickerRecord()->flags |= INI_FLAG_1;
 	_iniUnderCursor = 0;
 	_iniItemInHand = 0;
@@ -205,14 +206,14 @@ int16 Cursor::updateIniFromScene() {
 			// 0x80028a10
 			if (ini->flags & 1) {
 				// 0x80028b18
-				if (ini->actor->isFlagSet(ACTOR_FLAG_40) && ini->actor->isFlagSet(ACTOR_FLAG_8)) {
+				/* if (ini->actor->isFlagSet(ACTOR_FLAG_40) && ini->actor->isFlagSet(ACTOR_FLAG_8)) {
 					int16 iniActorXPosition = ini->actor->_x_pos - ini->actor->_frame->xOffset;
 					int16 iniActorYPosition = ini->actor->_y_pos - ini->actor->_frame->yOffset;
 					if (cursorX >= iniActorXPosition && cursorX < iniActorXPosition + ini->actor->_frame->width
 							&& cursorY >= iniActorYPosition && cursorY < iniActorYPosition + ini->actor->_frame->height) {
 						cursorOverIni = i + 1;
 					}
-				}
+				}*/
 			} else {
 				// 0x80028a24
 				if (ini->imgId != -1) {
diff --git a/engines/dragons/cutscene.cpp b/engines/dragons/cutscene.cpp
index ad4fdaf3f37..7edd40fb3a0 100644
--- a/engines/dragons/cutscene.cpp
+++ b/engines/dragons/cutscene.cpp
@@ -31,10 +31,10 @@
 #include "dragons/talk.h"
 
 namespace Dragons {
-
-CutScene::CutScene(DragonsEngine *vm): _vm(vm) {
+class DragonsEngine;
+	/* CutScene::CutScene(DragonsEngine *vm) : _vm(vm) {
 	loadPalettes();
-}
+}*/
 
 CutScene::~CutScene() {
 	if (_palettes) {
@@ -542,14 +542,14 @@ void CutScene::diamondScene() {
 	byte palette[512];
 
 	_vm->setUnkFlags(ENGINE_UNK1_FLAG_2);
-	actorId = _vm->getINI(0x257)->actor;
+	/* actorId = _vm->getINI(0x257)->actor;
 	actorId_03 = _vm->getINI(0x259)->actor;
 	actorId_01 = _vm->getINI(0x258)->actor;
 	actorId_03->setFlag(ACTOR_FLAG_100);
 	actorId_03->_priorityLayer = 4;
 	actorId_00 = _vm->getINI(0x256)->actor;
 	_vm->setFlags(ENGINE_FLAG_20000);
-	actorId_02 = _vm->getINI(0x25a)->actor;
+	actorId_02 = _vm->getINI(0x25a)->actor;*/
 	if ((_vm->_talk->somethingTextAndSpeechAndAnimRelated(actorId_02, 1, 0, 0x4294a, 0x2601) != 2) && !actorId->actorSetSequenceAndWaitAllowSkip(2)) {
 		actorId->updateSequence(3);
 		if (!actorId_01->actorSetSequenceAndWaitAllowSkip(0x18)) {
@@ -924,7 +924,7 @@ void CutScene::tournamentCutScene() {
 	uint16 dialogText[1000];
 
 	tournamentUpdateCameraX = 0x140;
-	_vm->setVsyncUpdateFunction(tournamentUpdateFunction);
+	//_vm->setVsyncUpdateFunction(tournamentUpdateFunction);
 	_vm->_talk->loadText(_vm->getDialogTextId(0x4C40C), dialogText, 1000);
 	_vm->_talk->displayDialogAroundPoint(dialogText, 0, 0, 0x1e01, 1, _vm->getDialogTextId(0x4C40C));
 
@@ -939,10 +939,11 @@ void CutScene::tournamentCutScene() {
 
 	_vm->_talk->loadText(_vm->getDialogTextId(0x4C6E8), dialogText, 1000);
 	_vm->_talk->displayDialogAroundPoint(dialogText, 0, 0, 0x1e01, 1, _vm->getDialogTextId(0x4C6E8));
-	_vm->setVsyncUpdateFunction(nullptr);
+	//_vm->setVsyncUpdateFunction(nullptr);
 	_vm->setFlags(ENGINE_FLAG_20000);
 	_vm->fadeToBlack();
-	Actor *actor = _vm->_dragonINIResource->getRecord(0x02BE)->actor;
+	Actor *actor;
+	//= _vm->_dragonINIResource->getRecord(0x02BE)->actor;
 	_vm->_screen->loadPalette(0, actor->_actorResource->getPalette());
 	_vm->_scene->_camera.x = 0;
 	_vm->playOrStopSound(0);
diff --git a/engines/dragons/dragonflg.cpp b/engines/dragons/dragonflg.cpp
index a535f949e9f..1a5ca6799d3 100644
--- a/engines/dragons/dragonflg.cpp
+++ b/engines/dragons/dragonflg.cpp
@@ -78,7 +78,7 @@ void Properties::getProperyPos(uint32 propertyId, uint &index, byte &mask) {
 	mask = 1 << (propertyId % 8);
 }
 
-void Properties::save(uint numberToWrite, Common::WriteStream *out) {
+void Properties::save(uint numberToWrite, ::Common::WriteStream *out) {
 	assert(numberToWrite % 8 == 0);
 	assert(numberToWrite <= _count);
 	out->write(_properties, numberToWrite / 8);
diff --git a/engines/dragons/dragonflg.h b/engines/dragons/dragonflg.h
index f51c2780eef..cfc12abadc5 100644
--- a/engines/dragons/dragonflg.h
+++ b/engines/dragons/dragonflg.h
@@ -36,7 +36,7 @@ public:
 	void clear();
 	bool get(uint32 propertyId);
 	void set(uint32 propertyId, bool value);
-	void save(uint numberToWrite, Common::WriteStream *out);
+	void save(uint numberToWrite, ::Common::WriteStream *out);
 	void print(char *prefix);
 
 private:
diff --git a/engines/dragons/dragonimg.cpp b/engines/dragons/dragonimg.cpp
index b5de6e3beed..d7e6424a312 100644
--- a/engines/dragons/dragonimg.cpp
+++ b/engines/dragons/dragonimg.cpp
@@ -20,19 +20,20 @@
  */
 #include "common/memstream.h"
 #include "dragons/dragonimg.h"
-#include "dragons/bigfile.h"
+//#include "dragons/bigfile.h"
 
 namespace Dragons {
 
 DragonImg::DragonImg(BigfileArchive *bigfileArchive) {
 	uint32 fileSize;
-	byte *iptData = bigfileArchive->load("dragon.ipt", fileSize);
-	Common::SeekableReadStream *iptReadStream = new Common::MemoryReadStream(iptData, fileSize, DisposeAfterUse::YES);
+	byte *iptData;
+	//= bigfileArchive->load("dragon.ipt", fileSize);
+	::Common::SeekableReadStream *iptReadStream = new ::Common::MemoryReadStream(iptData, fileSize, DisposeAfterUse::YES);
 
 	_count = fileSize / 4;
 
-	_imgData = bigfileArchive->load("dragon.img", fileSize);
-	Common::SeekableReadStream *imgReadStream = new Common::MemoryReadStream(_imgData, fileSize, DisposeAfterUse::NO);
+	//_imgData = bigfileArchive->load("dragon.img", fileSize);
+	::Common::SeekableReadStream *imgReadStream = new ::Common::MemoryReadStream(_imgData, fileSize, DisposeAfterUse::NO);
 
 
 	_imgObjects = new Img[_count];
diff --git a/engines/dragons/dragonini.cpp b/engines/dragons/dragonini.cpp
index c70d6bd281f..ea3a4e462ec 100644
--- a/engines/dragons/dragonini.cpp
+++ b/engines/dragons/dragonini.cpp
@@ -20,26 +20,29 @@
  */
 #include "common/debug.h"
 #include "common/memstream.h"
+//#include "dragons/bigfile.h"
 #include "dragons/dragonini.h"
 
 namespace Dragons {
 
 #define DRAGON_INI_STRUCT_SIZE 0x22
-DragonINIResource::DragonINIResource(BigfileArchive *bigfileArchive): _bigfileArchive(bigfileArchive), _dragonINI(nullptr) {
+/* DragonINIResource::DragonINIResource(BigfileArchive *bigfileArchive) : _bigfileArchive(bigfileArchive), _dragonINI(nullptr) {
 	reset();
-}
+}*/
 
 void DragonINIResource::reset() {
 	uint32 fileSize;
-	byte *data = _bigfileArchive->load("dragon.ini", fileSize);
-	Common::SeekableReadStream *readStream = new Common::MemoryReadStream(data, fileSize, DisposeAfterUse::YES);
+	byte *data;
+	//= _bigfileArchive->load("dragon.ini", fileSize);
+	//::Common::SeekableReadStream *readStream;
+	//= new ::Common::MemoryReadStream(data, fileSize, DisposeAfterUse::YES);
 
 	if (!_dragonINI) {
 		_count = fileSize / DRAGON_INI_STRUCT_SIZE;
-		_dragonINI = new DragonINI[_count];
+		//_dragonINI = new DragonINI[_count];
 	}
 
-	for (int i = 0; i < _count; i++) {
+	/* for (int i = 0; i < _count; i++) {
 		_dragonINI[i].id = (uint16)i;
 		_dragonINI[i].iptIndex_maybe = readStream->readSint16LE();
 		_dragonINI[i].imgId = readStream->readSint16LE();
@@ -48,7 +51,7 @@ void DragonINIResource::reset() {
 		_dragonINI[i].inventorySequenceId = readStream->readSint16LE();
 		uint16 v = readStream->readUint16LE();
 		assert(v == 0); // actorId
-		_dragonINI[i].actor = nullptr;
+		//_dragonINI[i].actor = nullptr;
 		_dragonINI[i].sceneId = readStream->readUint16LE();
 		_dragonINI[i].direction = readStream->readSint16LE();
 		_dragonINI[i].counter = readStream->readSint16LE();
@@ -64,7 +67,7 @@ void DragonINIResource::reset() {
 
 	_flickerINI = &_dragonINI[0];
 
-	delete readStream;
+	delete readStream;*/
 }
 
 DragonINI *DragonINIResource::getRecord(uint16 index) {
diff --git a/engines/dragons/dragonini.h b/engines/dragons/dragonini.h
index 6e54f6ff49c..f42e25cedb5 100644
--- a/engines/dragons/dragonini.h
+++ b/engines/dragons/dragonini.h
@@ -22,11 +22,11 @@
 #define DRAGONS_DRAGONINI_H
 
 #include "common/system.h"
-#include "dragons/bigfile.h"
 
 namespace Dragons {
 
 class Actor;
+class BigfileArchive;
 
 enum IniFlags {
 	INI_FLAG_1 = 0x1,
@@ -47,7 +47,8 @@ struct DragonINI {
 	int16 actorResourceId;
 	uint16 sequenceId;
 	int16 inventorySequenceId;
-	Actor *actor;
+	//Actor *actor;
+	void *actor;
 	uint16 sceneId;
 	int16 direction;
 	int16 counter;
diff --git a/engines/dragons/dragonobd.cpp b/engines/dragons/dragonobd.cpp
index f9857a4bc43..00a63067a5f 100644
--- a/engines/dragons/dragonobd.cpp
+++ b/engines/dragons/dragonobd.cpp
@@ -20,19 +20,19 @@
  */
 #include "common/memstream.h"
 #include "dragons/dragonobd.h"
-#include "dragons/bigfile.h"
+//#include "dragons/bigfile.h"
 
 namespace Dragons {
 
 DragonOBD::DragonOBD(BigfileArchive *bigfileArchive) {
 	uint32 size;
-	byte *optData = bigfileArchive->load("dragon.opt", size);
-	_optReadStream = new Common::MemoryReadStream(optData, size, DisposeAfterUse::YES);
+	//byte *optData = bigfileArchive->load("dragon.opt", size);
+	//_optReadStream = new ::Common::MemoryReadStream(optData, size, DisposeAfterUse::YES);
 
-	byte *sptData = bigfileArchive->load("dragon.spt", size);
-	_sptReadStream = new Common::MemoryReadStream(sptData, size, DisposeAfterUse::YES);
+	//byte *sptData = bigfileArchive->load("dragon.spt", size);
+	//_sptReadStream = new ::Common::MemoryReadStream(sptData, size, DisposeAfterUse::YES);
 
-	_data = bigfileArchive->load("dragon.obd", _dataSize);
+	//_data = bigfileArchive->load("dragon.obd", _dataSize);
 }
 
 byte *DragonOBD::getObdAtOffset(uint32 offset) {
diff --git a/engines/dragons/dragonrms.cpp b/engines/dragons/dragonrms.cpp
index 3f09f05eac3..0017e81daac 100644
--- a/engines/dragons/dragonrms.cpp
+++ b/engines/dragons/dragonrms.cpp
@@ -30,7 +30,7 @@ namespace Dragons {
 DragonRMS::DragonRMS(BigfileArchive *bigfileArchive, DragonOBD *dragonOBD) : _dragonOBD(dragonOBD) {
 	uint32 fileSize;
 	byte *data = bigfileArchive->load("dragon.rms", fileSize);
-	Common::SeekableReadStream *readStream = new Common::MemoryReadStream(data, fileSize, DisposeAfterUse::YES);
+	Common::SeekableReadStream *readStream = new ::Common::MemoryReadStream(data, fileSize, DisposeAfterUse::YES);
 
 	_count = fileSize / DRAGON_RMS_STRUCT_SIZE;
 
diff --git a/engines/dragons/dragons.cpp b/engines/dragons/dragons.cpp
index cf54e8bad65..d17581ee855 100644
--- a/engines/dragons/dragons.cpp
+++ b/engines/dragons/dragons.cpp
@@ -141,19 +141,19 @@ void DragonsEngine::updateEvents() {
 	while (_eventMan->pollEvent(event)) {
 //		_input->processEvent(event);
 		switch (event.type) {
-		case Common::EVENT_QUIT:
+		case ::Common::EVENT_QUIT:
 			quitGame();
 			break;
-		case Common::EVENT_MOUSEMOVE:
+		case ::Common::EVENT_MOUSEMOVE:
 			_cursor->updatePosition(event.mouse.x, event.mouse.y);
 			break;
-		case Common::EVENT_WHEELDOWN:
+		case ::Common::EVENT_WHEELDOWN:
 			_mouseWheel = MOUSE_WHEEL_DOWN;
 			break;
-		case Common::EVENT_WHEELUP:
+		case ::Common::EVENT_WHEELUP:
 			_mouseWheel = MOUSE_WHEEL_UP;
 			break;
-		case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+		case ::Common::EVENT_CUSTOM_ENGINE_ACTION_START:
 			if (event.customType == Dragons::kDragonsActionLeft) {
 				_leftKeyDown = true;
 			} else if (event.customType == Dragons::kDragonsActionRight) {
@@ -180,7 +180,7 @@ void DragonsEngine::updateEvents() {
 				_debugMode = !_debugMode;
 			}
 			break;
-		case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
+		case ::Common::EVENT_CUSTOM_ENGINE_ACTION_END:
 			if (event.customType == Dragons::kDragonsActionLeft) {
 				_leftKeyUp = true;
 				_leftKeyDown = false;
@@ -226,7 +226,7 @@ void DragonsEngine::updateEvents() {
 
 Common::Error DragonsEngine::run() {
 	if(!checkAudioVideoFiles()) {
-		return Common::kNoGameDataFoundError;
+		return ::Common::kNoGameDataFoundError;
 	}
 
 	_screen = new Screen();
@@ -284,7 +284,7 @@ Common::Error DragonsEngine::run() {
 	delete _strPlayer;
 
 	debug("Ok");
-	return Common::kNoError;
+	return ::Common::kNoError;
 }
 
 uint16 DragonsEngine::ipt_img_file_related() {
@@ -1324,17 +1324,17 @@ void DragonsEngine::runSceneUpdaterFunction() {
 	}
 }
 
-void DragonsEngine::setSceneUpdateFunction(void (*newUpdateFunction)()) {
-	_sceneUpdateFunction = newUpdateFunction;
-}
+//void DragonsEngine::setSceneUpdateFunction(void (*newUpdateFunction)()) {
+//	_sceneUpdateFunction = newUpdateFunction;
+//}
 
 void DragonsEngine::clearSceneUpdateFunction() {
 	setSceneUpdateFunction(nullptr);
 }
 
-void DragonsEngine::setVsyncUpdateFunction(void (*newUpdateFunction)()) {
-	_vsyncUpdateFunction = newUpdateFunction;
-}
+//void DragonsEngine::setVsyncUpdateFunction(void (*newUpdateFunction)()) {
+//	_vsyncUpdateFunction = newUpdateFunction;
+//}
 
 void DragonsEngine::seedRandom(int32 seed) {
 	_randomState = seed * -0x2b0e2b0f;
@@ -1463,28 +1463,28 @@ void DragonsEngine::updatePaletteCycling() {
 
 uint32 DragonsEngine::getFontOffsetFromDragonEXE() {
 	switch (_language) {
-	case Common::EN_USA :
-	case Common::RU_RUS : return 0x4a144;
-	case Common::EN_GRB : return 0x4b4fc;
-	case Common::DE_DEU : return 0x4af5c;
-	case Common::FR_FRA : return 0x4b158;
+	case ::Common::EN_USA :
+	case ::Common::RU_RUS : return 0x4a144;
+	case ::Common::EN_GRB : return 0x4b4fc;
+	case ::Common::DE_DEU : return 0x4af5c;
+	case ::Common::FR_FRA : return 0x4b158;
 	default : error("Unable to get font offset from dragon.exe for %s", getLanguageCode(_language));
 	}
 }
 
 uint32 DragonsEngine::getSpeechTblOffsetFromDragonEXE() {
 	switch (_language) {
-	case Common::EN_USA :
-	case Common::RU_RUS : return 0x4e138;
-	case Common::EN_GRB : return 0x4f4f4;
-	case Common::DE_DEU : return 0x4f0a4;
-	case Common::FR_FRA : return 0x4f2a0;
+	case ::Common::EN_USA :
+	case ::Common::RU_RUS : return 0x4e138;
+	case ::Common::EN_GRB : return 0x4f4f4;
+	case ::Common::DE_DEU : return 0x4f0a4;
+	case ::Common::FR_FRA : return 0x4f2a0;
 	default : error("Unable to get speech table offset from dragon.exe for %s", getLanguageCode(_language));
 	}
 }
 
 uint16 DragonsEngine::getBigFileTotalRecords() {
-	if (_language == Common::EN_USA || _language == Common::EN_GRB || _language == Common::RU_RUS) {
+	if (_language == ::Common::EN_USA || _language == ::Common::EN_GRB || _language == ::Common::RU_RUS) {
 		return 576;
 	}
 	return 588;
@@ -1492,11 +1492,11 @@ uint16 DragonsEngine::getBigFileTotalRecords() {
 
 uint32 DragonsEngine::getBigFileInfoTblFromDragonEXE() {
 	switch (_language) {
-	case Common::EN_USA :
-	case Common::RU_RUS : return 0x4a238;
-	case Common::EN_GRB : return 0x4b5f4;
-	case Common::DE_DEU : return 0x4b054;
-	case Common::FR_FRA : return 0x4b250;
+	case ::Common::EN_USA :
+	case ::Common::RU_RUS : return 0x4a238;
+	case ::Common::EN_GRB : return 0x4b5f4;
+	case ::Common::DE_DEU : return 0x4b054;
+	case ::Common::FR_FRA : return 0x4b250;
 	default :
 		error("Unable to get bigfile info table offset from dragon.exe for %s", getLanguageCode(_language));
 	}
@@ -1504,11 +1504,11 @@ uint32 DragonsEngine::getBigFileInfoTblFromDragonEXE() {
 
 uint32 DragonsEngine::getCutscenePaletteOffsetFromDragonEXE() {
 	switch (_language) {
-	case Common::EN_USA :
-	case Common::RU_RUS : return 0x5336c;
-	case Common::EN_GRB : return 0x54628;
-	case Common::DE_DEU : return 0x541d8;
-	case Common::FR_FRA : return 0x543d4;
+	case ::Common::EN_USA :
+	case ::Common::RU_RUS : return 0x5336c;
+	case ::Common::EN_GRB : return 0x54628;
+	case ::Common::DE_DEU : return 0x541d8;
+	case ::Common::FR_FRA : return 0x543d4;
 	default :
 		error("Unable to get cutscene palette table offset from dragon.exe for %s", getLanguageCode(_language));
 	}
@@ -1516,11 +1516,11 @@ uint32 DragonsEngine::getCutscenePaletteOffsetFromDragonEXE() {
 
 uint32 DragonsEngine::defaultResponseOffsetFromDragonEXE() {
 	switch (_language) {
-	case Common::EN_USA :
-	case Common::RU_RUS : return 0x541b0;
-	case Common::EN_GRB : return 0x55470;
-	case Common::DE_DEU : return 0x55020;
-	case Common::FR_FRA : return 0x5521c;
+	case ::Common::EN_USA :
+	case ::Common::RU_RUS : return 0x541b0;
+	case ::Common::EN_GRB : return 0x55470;
+	case ::Common::DE_DEU : return 0x55020;
+	case ::Common::FR_FRA : return 0x5521c;
 	default :
 		error("Unable to get response offset table offset from dragon.exe for %s", getLanguageCode(_language));
 	}
@@ -1701,7 +1701,7 @@ void DragonsEngine::loadingScreen() {
 	actor->setFlag(ACTOR_FLAG_200);
 	actor->setFlag(ACTOR_FLAG_80);
 
-	if (_language == Common::DE_DEU || _language == Common::FR_FRA) {
+	if (_language == ::Common::DE_DEU || _language == ::Common::FR_FRA) {
 		actor = _actorManager->loadActor(0,0x84,0,0,6);
 		actor->setFlag(ACTOR_FLAG_100);
 		actor->setFlag(ACTOR_FLAG_200);
@@ -1825,13 +1825,13 @@ void DragonsEngine::syncSoundSettings() {
 }
 
 uint16 DragonsEngine::getCursorHandPointerSequenceID() {
-	return _language == Common::DE_DEU || _language == Common::FR_FRA ? 0x86 : 0x84;
+	return _language == ::Common::DE_DEU || _language == ::Common::FR_FRA ? 0x86 : 0x84;
 }
 
 uint32 DragonsEngine::getMiniGame3StartingDialog() {
 	switch (_language) {
-	case Common::DE_DEU : return 0x5456;
-	case Common::FR_FRA : return 0x509C;
+	case ::Common::DE_DEU : return 0x5456;
+	case ::Common::FR_FRA : return 0x509C;
 	default : break;
 	}
 	return 0x479A;
@@ -1839,15 +1839,15 @@ uint32 DragonsEngine::getMiniGame3StartingDialog() {
 
 uint32 DragonsEngine::getMiniGame3PickAHatDialog() {
 	switch (_language) {
-	case Common::DE_DEU : return 0x2E32E;
-	case Common::FR_FRA : return 0x2F180;
+	case ::Common::DE_DEU : return 0x2E32E;
+	case ::Common::FR_FRA : return 0x2F180;
 	default : break;
 	}
 	return 0x2958A;
 }
 
 uint32 DragonsEngine::getMiniGame3DataOffset() {
-	if (_language == Common::DE_DEU || _language == Common::FR_FRA) {
+	if (_language == ::Common::DE_DEU || _language == ::Common::FR_FRA) {
 		return 0x265c;
 	}
 	return 0x4914;
@@ -1855,9 +1855,9 @@ uint32 DragonsEngine::getMiniGame3DataOffset() {
 
 uint32 DragonsEngine::getDialogTextId(uint32 textId) {
 	switch (_language) {
-	case Common::EN_GRB : return getDialogTextIdGrb(textId);
-	case Common::DE_DEU : return getDialogTextIdDe(textId);
-	case Common::FR_FRA : return getDialogTextIdFr(textId);
+	case ::Common::EN_GRB : return getDialogTextIdGrb(textId);
+	case ::Common::DE_DEU : return getDialogTextIdDe(textId);
+	case ::Common::FR_FRA : return getDialogTextIdFr(textId);
 	default : break;
 	}
 	return textId;
@@ -2438,8 +2438,8 @@ uint32 DragonsEngine::getDialogTextIdFr(uint32 textId) {
 	return textId;
 }
 
-void (*DragonsEngine::getSceneUpdateFunction())() {
-	return _sceneUpdateFunction;
-}
+//void (*DragonsEngine::getSceneUpdateFunction())() {
+//	return _sceneUpdateFunction;
+//}
 
 } // End of namespace Dragons
diff --git a/engines/dragons/dragons.h b/engines/dragons/dragons.h
index ad8c9d22543..30aa870dc16 100644
--- a/engines/dragons/dragons.h
+++ b/engines/dragons/dragons.h
@@ -29,7 +29,7 @@
 namespace Dragons {
 
 struct SaveHeader {
-	Common::String description;
+	::Common::String description;
 	uint32 version;
 	uint32 flags;
 	uint32 saveDate;
@@ -182,7 +182,7 @@ public:
 	SoundManager *_sound;
 	StrPlayer *_strPlayer;
 
-	PaletteCyclingInstruction _paletteCyclingTbl[8];
+	//PaletteCyclingInstruction _paletteCyclingTbl[8];
 
 	bool _isLoadingDialogAudio;
 	uint16 _videoFlags; // TODO move to screen?
@@ -193,7 +193,7 @@ public:
 	uint16 _sceneId1; //TODO wire this up. I think it might be where to restore save game from?
 
 private:
-	Common::Language _language;
+	::Common::Language _language;
 	BigfileArchive *_bigfileArchive;
 	DragonFLG *_dragonFLG;
 	DragonVAR *_dragonVAR;
@@ -202,7 +202,7 @@ private:
 	uint32 _nextUpdatetime;
 	uint32 _flags;
 	uint32 _unkFlags1;
-	Common::Point _cursorPosition;
+	::Common::Point _cursorPosition;
 	uint32 _flickerIdleCounter;
 	uint32 _bit_flags_8006fbd8;
 	//unk
@@ -240,8 +240,8 @@ private:
 	bool _isGamePaused;
 	bool _inMenu;
 
-	void (*_sceneUpdateFunction)();
-	void (*_vsyncUpdateFunction)();
+	//void (*_sceneUpdateFunction)();
+	//void (*_vsyncUpdateFunction)();
 protected:
 	bool hasFeature(EngineFeature f) const override;
 public:
@@ -252,12 +252,12 @@ public:
 	Common::Error run() override;
 
 	Common::String getSavegameFilename(int num);
-	static Common::String getSavegameFilename(const Common::String &target, int num);
-	static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *in, SaveHeader &header, bool skipThumbnail = true);
+	static ::Common::String getSavegameFilename(const ::Common::String &target, int num);
+	static kReadSaveHeaderError readSaveHeader(::Common::SeekableReadStream *in, SaveHeader &header, bool skipThumbnail = true);
 
 	Common::Error loadGameState(int slot) override;
 	bool canLoadGameStateCurrently() override;
-	Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave) override;
+	Common::Error saveGameState(int slot, const ::Common::String &desc, bool isAutosave) override;
 	bool canSaveGameStateCurrently() override;
 	void syncSoundSettings() override;
 
@@ -304,11 +304,11 @@ public:
 	void reset();
 
 	void runSceneUpdaterFunction();
-	void setSceneUpdateFunction(void (*newUpdateFunction)());
+	//void setSceneUpdateFunction(void (*newUpdateFunction)());
 	void clearSceneUpdateFunction();
-	void (*getSceneUpdateFunction())();
+	//void (*getSceneUpdateFunction())();
 
-	void setVsyncUpdateFunction(void (*newUpdateFunction)());
+	//void setVsyncUpdateFunction(void (*newUpdateFunction)());
 	bool isVsyncUpdaterFunctionRunning();
 	void runVsyncUpdaterFunction();
 
diff --git a/engines/dragons/font.cpp b/engines/dragons/font.cpp
index 9069720963c..4db97655f93 100644
--- a/engines/dragons/font.cpp
+++ b/engines/dragons/font.cpp
@@ -87,7 +87,7 @@ void Font::renderToSurface(Graphics::Surface *surface, int16 x, int16 y, uint16
 FontManager::FontManager(DragonsEngine *vm, Screen *screen, BigfileArchive *bigfileArchive): _vm(vm), _screen(screen), _numTextEntries(0) {
 	uint32 fileSize;
 	byte *data = bigfileArchive->load("fntfiles.dat", fileSize);
-	Common::SeekableReadStream *readStream = new Common::MemoryReadStream(data, fileSize, DisposeAfterUse::YES);
+	Common::SeekableReadStream *readStream = new ::Common::MemoryReadStream(data, fileSize, DisposeAfterUse::YES);
 
 	_fonts[0] = loadFont(0, *readStream);
 	_fonts[1] = loadFont(1, *readStream);
@@ -124,7 +124,7 @@ void FontManager::addText(int16 x, int16 y, uint16 *text, uint16 length, uint8 f
 
 void FontManager::draw() {
 	if(_numTextEntries > 0) {
-		_screen->copyRectToSurface8bpp(*_surface, _screen->getPalette(2), 0, 0, Common::Rect(_surface->w, _surface->h), false, NORMAL);
+		_screen->copyRectToSurface8bpp(*_surface, _screen->getPalette(2), 0, 0, ::Common::Rect(_surface->w, _surface->h), false, NORMAL);
 	}
 }
 
@@ -133,7 +133,7 @@ void FontManager::clearText() {
 	_surface->fillRect(Common::Rect(_surface->w, _surface->h), 0);
 }
 
-Font *FontManager::loadFont(uint16 index, Common::SeekableReadStream &stream) {
+Font *FontManager::loadFont(uint16 index, ::Common::SeekableReadStream &stream) {
 	Common::File fd;
 	if (!fd.open("dragon.exe")) {
 		error("Failed to open dragon.exe");
diff --git a/engines/dragons/font.h b/engines/dragons/font.h
index c72d2ff7d4a..954aeb95065 100644
--- a/engines/dragons/font.h
+++ b/engines/dragons/font.h
@@ -74,7 +74,7 @@ public:
 	void clearTextDialog(uint32 x1, uint32 y1, uint32 x2, uint32 y2);
 
 private:
-	Font *loadFont(uint16 index, Common::SeekableReadStream &stream);
+	Font *loadFont(uint16 index, ::Common::SeekableReadStream &stream);
 	void drawBoxChar(uint32 x, uint32 y, uint8 tileIndex);
 };
 
diff --git a/engines/dragons/inventory.cpp b/engines/dragons/inventory.cpp
index 7373ff44f83..e90a9edbd5a 100644
--- a/engines/dragons/inventory.cpp
+++ b/engines/dragons/inventory.cpp
@@ -74,7 +74,7 @@ Inventory::Inventory(DragonsEngine *vm) : _vm(vm) {
 	_inventionBookPrevSceneUpdateFunc = nullptr;
 	_inventionBookPrevSceneId = 0;
 	_inventionBookPrevFlickerINISceneId = 0;
-	_inventionBookPrevFlickerINIPosition = Common::Point(0, 0);
+	_inventionBookPrevFlickerINIPosition = ::Common::Point(0, 0);
 }
 
 void Inventory::init(ActorManager *actorManager, BackgroundResourceLoader *backgroundResourceLoader, Bag *bag, DragonINIResource *dragonIniResource) {
@@ -119,7 +119,7 @@ void Inventory::updateVisibility() {
 }
 
 Common::Point Inventory::getPosition() {
-	return Common::Point(positionTable[_screenPositionIndex].x, positionTable[_screenPositionIndex].y);
+	return ::Common::Point(positionTable[_screenPositionIndex].x, positionTable[_screenPositionIndex].y);
 }
 
 void Inventory::setActorFlag400() {
@@ -291,7 +291,7 @@ void Inventory::openInventionBook() {
 	DragonINI *flicker = _vm->_dragonINIResource->getFlickerRecord();
 	if (flicker && flicker->actor) {
 		_inventionBookPrevFlickerINISceneId = flicker->sceneId;
-		_inventionBookPrevFlickerINIPosition = Common::Point(flicker->actor->_x_pos, flicker->actor->_y_pos);
+		_inventionBookPrevFlickerINIPosition = ::Common::Point(flicker->actor->_x_pos, flicker->actor->_y_pos);
 		flicker->sceneId = 0;
 	}
 	_vm->_scene->setSceneId(2);
diff --git a/engines/dragons/inventory.h b/engines/dragons/inventory.h
index 9eb6417d623..f68155648c5 100644
--- a/engines/dragons/inventory.h
+++ b/engines/dragons/inventory.h
@@ -54,7 +54,7 @@ private:
 	InventoryState _state;
 	Bag *_bag;
 
-	void (*_inventionBookPrevSceneUpdateFunc)();
+	//void (*_inventionBookPrevSceneUpdateFunc)();
 	uint16 _inventionBookPrevSceneId;
 	uint16 _inventionBookPrevFlickerINISceneId;
 	Common::Point _inventionBookPrevFlickerINIPosition;
diff --git a/engines/dragons/metaengine.cpp b/engines/dragons/metaengine.cpp
index f635be6747c..d67675357ea 100644
--- a/engines/dragons/metaengine.cpp
+++ b/engines/dragons/metaengine.cpp
@@ -57,7 +57,7 @@ bool DragonsMetaEngine::hasFeature(MetaEngineFeature f) const {
 }
 
 void DragonsMetaEngine::removeSaveState(const char *target, int slot) const {
-	Common::String fileName = Common::String::format("%s.%03d", target, slot);
+	Common::String fileName = ::Common::String::format("%s.%03d", target, slot);
 	g_system->getSavefileManager()->removeSavefile(fileName);
 }
 
@@ -122,9 +122,9 @@ Common::Error DragonsMetaEngine::createInstance(OSystem *syst, Engine **engine,
 		                       "https://wiki.scummvm.org/index.php?title=Datafiles#Blazing_Dragons");
 		break;
 	default:
-		return Common::kUnsupportedGameidError;
+		return ::Common::kUnsupportedGameidError;
 	}
-	return Common::kNoError;
+	return ::Common::kNoError;
 }
 
 Common::KeymapArray DragonsMetaEngine::initKeymaps(const char *target) const {
diff --git a/engines/dragons/midimusicplayer.cpp b/engines/dragons/midimusicplayer.cpp
index 6f4d4990845..dc09d07ab4c 100644
--- a/engines/dragons/midimusicplayer.cpp
+++ b/engines/dragons/midimusicplayer.cpp
@@ -179,7 +179,7 @@ Common::SeekableReadStream *MidiMusicPlayer::loadSoundFont(BigfileArchive *bigFi
 	delete vab;
 	delete memFile;
 
-	return new Common::MemoryReadStream(bytes, size, DisposeAfterUse::YES);
+	return new ::Common::MemoryReadStream(bytes, size, DisposeAfterUse::YES);
 }
 
 } // End of namespace Dragons
diff --git a/engines/dragons/minigame1.cpp b/engines/dragons/minigame1.cpp
index fad5b6022c1..300beba576d 100644
--- a/engines/dragons/minigame1.cpp
+++ b/engines/dragons/minigame1.cpp
@@ -92,7 +92,7 @@ void Minigame1::run() {
 	Actor *wheelsActor;
 	Actor *dustSpriteActor;
 
-	Common::File *fd = new Common::File();
+	Common::File *fd = new ::Common::File();
 	if (!fd->open("arc1.bin")) {
 		error("Failed to open arc1.bin");
 	}
diff --git a/engines/dragons/minigame2.cpp b/engines/dragons/minigame2.cpp
index ff07bcf48ad..ba390ca8d40 100644
--- a/engines/dragons/minigame2.cpp
+++ b/engines/dragons/minigame2.cpp
@@ -103,7 +103,7 @@ void Minigame2::run(int16 param_1, uint16 param_2, int16 param_3) {
 	originalInventoryType = _vm->_inventory->getState();
 	flicker = _vm->_dragonINIResource->getFlickerRecord();
 
-	Common::File *fd = new Common::File();
+	Common::File *fd = new ::Common::File();
 	if (!fd->open("arc2.bin")) {
 		error("Failed to open arc2.bin");
 	}
diff --git a/engines/dragons/minigame3.cpp b/engines/dragons/minigame3.cpp
index 9438f4f56c6..e95314b00f4 100644
--- a/engines/dragons/minigame3.cpp
+++ b/engines/dragons/minigame3.cpp
@@ -121,7 +121,7 @@ void Minigame3::run() {
 	int16 unkXPosTbl[20];
 
 
-	Common::File *fd = new Common::File();
+	Common::File *fd = new ::Common::File();
 	if (!fd->open("arc3.bin")) {
 		error("Failed to open arc3.bin");
 	}
@@ -742,7 +742,7 @@ void Minigame3::run() {
 }
 
 void Minigame3::updateBackgroundLayerOffset(uint32 layerNumber, int16 xOffset, int16 yOffset) {
-	_vm->_scene->setLayerOffset(layerNumber, Common::Point(xOffset, yOffset));
+	_vm->_scene->setLayerOffset(layerNumber, ::Common::Point(xOffset, yOffset));
 }
 
 void Minigame3::fun_80017f70_paletteRelated(uint16 param_1) {
diff --git a/engines/dragons/minigame4.cpp b/engines/dragons/minigame4.cpp
index fd8911cf3e2..bfac7099ee8 100644
--- a/engines/dragons/minigame4.cpp
+++ b/engines/dragons/minigame4.cpp
@@ -154,7 +154,7 @@ uint16 Minigame4::runDanceBattle() {
 	uint16 round3StepPositionTbl [20];
 	uint16 round3DurationTbl [20];
 
-	Common::File *fd = new Common::File();
+	Common::File *fd = new ::Common::File();
 	if (!fd->open("arc4.bin")) {
 		error("Failed to open arc4.bin");
 	}
@@ -322,9 +322,9 @@ void videoUpdaterFunction() {
 	static uint16 layer2XOffset = 0;
 	static uint16 layer0XOffset = 0;
 	DragonsEngine *vm = getEngine();
-	vm->_scene->setLayerOffset(2, Common::Point(layer2XOffset, 0));
+	vm->_scene->setLayerOffset(2, ::Common::Point(layer2XOffset, 0));
 	layer2XOffset = (layer2XOffset + 3) % 512;
-	vm->_scene->setLayerOffset(0, Common::Point(layer0XOffset, 0));
+	vm->_scene->setLayerOffset(0, ::Common::Point(layer0XOffset, 0));
 	layer0XOffset = (layer0XOffset + 4) % 512;
 }
 
diff --git a/engines/dragons/minigame5.cpp b/engines/dragons/minigame5.cpp
index e40fbb6a8d0..4d6f4aab21d 100644
--- a/engines/dragons/minigame5.cpp
+++ b/engines/dragons/minigame5.cpp
@@ -75,7 +75,7 @@ void Minigame5::run() {
 	short local_10;
 	uint32 savedEngineFlags;
 
-	Common::File *fd = new Common::File();
+	Common::File *fd = new ::Common::File();
 	if (!fd->open("arc5.bin")) {
 		error("Failed to open arc5.bin");
 	}
diff --git a/engines/dragons/saveload.cpp b/engines/dragons/saveload.cpp
index 48445e8f162..df6a6b57310 100644
--- a/engines/dragons/saveload.cpp
+++ b/engines/dragons/saveload.cpp
@@ -142,23 +142,23 @@ bool DragonsEngine::loadgame(const char *filename) {
 
 Common::Error DragonsEngine::loadGameState(int slot) {
 	if (!loadgame(getSavegameFilename(slot).c_str()))
-		return Common::kReadingFailed;
-	return Common::kNoError;
+		return ::Common::kReadingFailed;
+	return ::Common::kNoError;
 }
 
-Common::Error DragonsEngine::saveGameState(int slot, const Common::String &description, bool isAutoSave) {
+Common::Error DragonsEngine::saveGameState(int slot, const ::Common::String &description, bool isAutoSave) {
 	if (!savegame(getSavegameFilename(slot).c_str(), description.c_str()))
-		return Common::kWritingFailed;
-	return Common::kNoError;
+		return ::Common::kWritingFailed;
+	return ::Common::kNoError;
 }
 
 Common::String DragonsEngine::getSavegameFilename(int num) {
 	return getSavegameFilename(_targetName, num);
 }
 
-Common::String DragonsEngine::getSavegameFilename(const Common::String &target, int num) {
+Common::String DragonsEngine::getSavegameFilename(const ::Common::String &target, int num) {
 	assert(num >= 0 && num <= 999);
-	return Common::String::format("%s.%03d", target.c_str(), num);
+	return ::Common::String::format("%s.%03d", target.c_str(), num);
 }
 
 } // End of namespace Illusions
diff --git a/engines/dragons/scene.cpp b/engines/dragons/scene.cpp
index e362ea2fea8..1ad8dbf4760 100644
--- a/engines/dragons/scene.cpp
+++ b/engines/dragons/scene.cpp
@@ -267,7 +267,7 @@ void Scene::loadSceneData(uint32 sceneId, uint32 cameraPointId) {
 //				int y = ini->y - actor->_frame_vram_y;
 //				if (x >= 0 && y >= 0 && x + s->w < 320 && y + s->h < 200) {
 //					debug("Actor %d, %d %d (%d, %d)", actor->_actorID, ini->actorResourceId, ini->flags, ini->x, ini->y);
-//					_stage->getFgLayer()->copyRectToSurface(*s, x, y, Common::Rect(s->w, s->h));
+//					_stage->getFgLayer()->copyRectToSurface(*s, x, y, ::Common::Rect(s->w, s->h));
 //				}
 				}
 				// _stage->getFgLayer()->drawLine(ini->x, ini->y, ini->x + 8, ini->y + 8, 0x7c00);
@@ -387,9 +387,9 @@ void Scene::draw() {
 					debug(5, "Actor %d %s (%d, %d) w:%d h:%d Priority: %d Scale: %d", actor->_actorID, actor->_actorResource->getFilename(), x,
 						  y,
 						  s->w, s->h, actor->_priorityLayer, actor->_scale);
-					_screen->copyRectToSurface8bpp(*s, actor->getPalette(), x, y, Common::Rect(s->w, s->h), (bool)(actor->_frame->flags & FRAME_FLAG_FLIP_X), actor->isFlagSet(ACTOR_FLAG_8000) ? NONE : NORMAL, actor->_scale);
+					_screen->copyRectToSurface8bpp(*s, actor->getPalette(), x, y, ::Common::Rect(s->w, s->h), (bool)(actor->_frame->flags & FRAME_FLAG_FLIP_X), actor->isFlagSet(ACTOR_FLAG_8000) ? NONE : NORMAL, actor->_scale);
 					if (_vm->isDebugMode()) {
-						_screen->drawRect(0x7fff, Common::Rect(x, y, x + s->w, y + s->h), actor->_actorID);
+						_screen->drawRect(0x7fff, ::Common::Rect(x, y, x + s->w, y + s->h), actor->_actorID);
 						drawActorNumber(x + s->w, y + 8, actor->_actorID);
 					}
 				}
@@ -495,7 +495,7 @@ void Scene::drawActorNumber(int16 x, int16 y, uint16 actorId) {
 	_vm->_fontManager->addText(x, y, text, strlen(text8), 1);
 }
 
-void Scene::setLayerOffset(uint8 layerNumber, Common::Point offset) {
+void Scene::setLayerOffset(uint8 layerNumber, ::Common::Point offset) {
 	_stage->setLayerOffset(layerNumber, offset);
 }
 
@@ -503,9 +503,9 @@ Common::Point Scene::getLayerOffset(uint8 layerNumber) {
 	return _stage->getLayerOffset(layerNumber);
 }
 
-void Scene::drawBgLayer(uint8 layerNumber, Common::Rect rect, Graphics::Surface *surface) {
+void Scene::drawBgLayer(uint8 layerNumber, ::Common::Rect rect, Graphics::Surface *surface) {
 	Common::Point offset = _stage->getLayerOffset(layerNumber);
-//	Common::Rect clippedRect = _screen->clipRectToRect(offset.x, offset.y, rect, Common::Rect(_stage->getBgLayer()->w, _stage->getBgLayer()->h));
+//	Common::Rect clippedRect = _screen->clipRectToRect(offset.x, offset.y, rect, ::Common::Rect(_stage->getBgLayer()->w, _stage->getBgLayer()->h));
 	rect.left += rect.left + offset.x < 0 ? -(rect.left + offset.x) : offset.x;
 	if (rect.right + offset.x > surface->w) {
 		rect.right = surface->w - 1;
diff --git a/engines/dragons/scene.h b/engines/dragons/scene.h
index 0303c87383b..81209f97b62 100644
--- a/engines/dragons/scene.h
+++ b/engines/dragons/scene.h
@@ -40,7 +40,7 @@ struct DragonINI;
 
 class Scene {
 public:
-	Common::Point _camera;
+	::Common::Point _camera;
 	int16 _mapTransitionEffectSceneID;
 
 private:
@@ -78,14 +78,14 @@ public:
 	void setMgLayerPriority(uint8 newPriority);
 	void setFgLayerPriority(uint8 newPriority);
 
-	void setLayerOffset(uint8 layerNumber, Common::Point offset);
+	void setLayerOffset(uint8 layerNumber, ::Common::Point offset);
 	Common::Point getLayerOffset(uint8 layerNumber);
 	ScaleLayer *getScaleLayer();
 	void setLayerAlphaMode(uint8 layerNumber, AlphaBlendMode mode);
 private:
 	void resetActorFrameFlags();
 	void drawActorNumber(int16 x, int16 y, uint16 actorId);
-	void drawBgLayer(uint8 layerNumber, Common::Rect rect, Graphics::Surface *surface);
+	void drawBgLayer(uint8 layerNumber, ::Common::Rect rect, Graphics::Surface *surface);
 };
 
 } // End of namespace Dragons
diff --git a/engines/dragons/screen.cpp b/engines/dragons/screen.cpp
index 39b50031ca3..51431c9a7a4 100644
--- a/engines/dragons/screen.cpp
+++ b/engines/dragons/screen.cpp
@@ -34,14 +34,14 @@ Screen::Screen() {
 	initGraphics(320, 200, &_pixelFormat);
 	_backSurface = new Graphics::Surface();
 	_backSurface->create(320, 200, _pixelFormat);
-	_screenShakeOffset = Common::Point();
+	_screenShakeOffset = ::Common::Point();
 }
 
 void Screen::updateScreen() {
 	if (_screenShakeOffset.x != 0 || _screenShakeOffset.y != 0) {
 		g_system->fillScreen(0); //TODO this is meant for 8bit screens. we should use system shake here.
 	}
-	Common::Rect clipRect = clipRectToScreen(_screenShakeOffset.x,  _screenShakeOffset.y, Common::Rect(_backSurface->w, _backSurface->h));
+	Common::Rect clipRect = clipRectToScreen(_screenShakeOffset.x,  _screenShakeOffset.y, ::Common::Rect(_backSurface->w, _backSurface->h));
 	g_system->copyRectToScreen((byte*)_backSurface->getBasePtr(clipRect.left, clipRect.top),
 			_backSurface->pitch,
 			_screenShakeOffset.x < 0 ? 0 : _screenShakeOffset.x, _screenShakeOffset.y < 0 ? 0 : _screenShakeOffset.y,
@@ -64,7 +64,7 @@ void Screen::copyRectToSurface(const Graphics::Surface &srcSurface, int destX, i
 	copyRectToSurface(srcSurface.getBasePtr(0, 0), srcSurface.pitch, srcSurface.w, 0, destX, destY, srcSurface.w, srcSurface.h, false, NONE);
 }
 
-void Screen::copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, const Common::Rect srcRect, bool flipX, AlphaBlendMode alpha) {
+void Screen::copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, const ::Common::Rect srcRect, bool flipX, AlphaBlendMode alpha) {
 	Common::Rect clipRect = clipRectToScreen(destX,  destY, srcRect);
 	if (clipRect.width() == 0 || clipRect.height() == 0) {
 		return;
@@ -80,7 +80,7 @@ void Screen::copyRectToSurface(const Graphics::Surface &srcSurface, int destX, i
 	copyRectToSurface(srcSurface.getBasePtr(clipRect.left, clipRect.top), srcSurface.pitch, srcSurface.w, clipRect.left, destX, destY, clipRect.width(), clipRect.height(), flipX, alpha);
 }
 
-void Screen::copyRectToSurface8bpp(const Graphics::Surface &srcSurface, const byte *palette, int destX, int destY, const Common::Rect srcRect, bool flipX, AlphaBlendMode alpha, uint16 scale) {
+void Screen::copyRectToSurface8bpp(const Graphics::Surface &srcSurface, const byte *palette, int destX, int destY, const ::Common::Rect srcRect, bool flipX, AlphaBlendMode alpha, uint16 scale) {
 	if (scale != DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE) {
 		drawScaledSprite(_backSurface, (const byte *)srcSurface.getBasePtr(0, 0),
 				srcRect.width(), srcRect.height(),
@@ -264,11 +264,11 @@ void Screen::drawScaledSprite(Graphics::Surface *destSurface, const byte *source
 	}
 }
 
-Common::Rect Screen::clipRectToScreen(int destX, int destY, const Common::Rect rect) {
-	return clipRectToRect(destX, destY, rect, Common::Rect(320, 200));
+Common::Rect Screen::clipRectToScreen(int destX, int destY, const ::Common::Rect rect) {
+	return clipRectToRect(destX, destY, rect, ::Common::Rect(320, 200));
 }
 
-Common::Rect Screen::clipRectToRect(int destX, int destY, const Common::Rect rect, const Common::Rect containerRect) {
+Common::Rect Screen::clipRectToRect(int destX, int destY, const ::Common::Rect rect, const ::Common::Rect containerRect) {
 	int16 x, y, w, h;
 	x = rect.left;
 	y = rect.top;
@@ -309,7 +309,7 @@ Common::Rect Screen::clipRectToRect(int destX, int destY, const Common::Rect rec
 		h = 0;
 	}
 
-	return Common::Rect(x, y, x + w, y + h);
+	return ::Common::Rect(x, y, x + w, y + h);
 }
 
 void Screen::updatePaletteTransparency(uint16 paletteNum, uint16 startOffset, uint16 endOffset, bool isTransparent) {
@@ -382,7 +382,7 @@ void Screen::clearScreen() {
 	_backSurface->fillRect(Common::Rect(0, 0, _backSurface->w, _backSurface->h), 0);
 }
 
-void Screen::drawRect(uint16 colour, Common::Rect rect, int id) {
+void Screen::drawRect(uint16 colour, ::Common::Rect rect, int id) {
 	Common::Rect clippedRect = clipRectToScreen(0, 0, rect);
 	//top
 	_backSurface->drawLine(clippedRect.left, clippedRect.top, clippedRect.right, clippedRect.top, colour);
@@ -414,7 +414,7 @@ void Screen::copyRectToSurface8bppWrappedY(const Graphics::Surface &srcSurface,
 	}
 }
 
-void Screen::copyRectToSurface8bppWrappedX(const Graphics::Surface &srcSurface, const byte *palette, Common::Rect srcRect,
+void Screen::copyRectToSurface8bppWrappedX(const Graphics::Surface &srcSurface, const byte *palette, ::Common::Rect srcRect,
 										   AlphaBlendMode alpha) {
 	// Copy buffer data to internal buffer
 	const byte *src = (const byte *)srcSurface.getBasePtr(0, 0);
@@ -470,12 +470,12 @@ void Screen::drawFlatQuads(uint16 priorityLayer) {
 		if (_flatQuads[i].flags & 1u && _flatQuads[i].priorityLayer == priorityLayer) {
 			//TODO need to support semitrans mode.
 			//TODO check if we need to support non-rectangular quads.
-			fillRect(_flatQuads[i].colour, Common::Rect(_flatQuads[i].points[0].x, _flatQuads[i].points[0].y, _flatQuads[i].points[3].x + 1, _flatQuads[i].points[3].y + 1));
+			fillRect(_flatQuads[i].colour, ::Common::Rect(_flatQuads[i].points[0].x, _flatQuads[i].points[0].y, _flatQuads[i].points[3].x + 1, _flatQuads[i].points[3].y + 1));
 		}
 	}
 }
 
-void Screen::fillRect(uint16 colour, Common::Rect rect) {
+void Screen::fillRect(uint16 colour, ::Common::Rect rect) {
 	_backSurface->fillRect(rect, colour);
 }
 
diff --git a/engines/dragons/screen.h b/engines/dragons/screen.h
index d0ca83ee504..c2fb3d5ba88 100644
--- a/engines/dragons/screen.h
+++ b/engines/dragons/screen.h
@@ -78,19 +78,19 @@ public:
 
 	Graphics::PixelFormat getPixelFormat() { return _pixelFormat; }
 	void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY);
-	void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, Common::Rect srcRect, bool flipX = false, AlphaBlendMode alpha = NONE);
-	void copyRectToSurface8bpp(const Graphics::Surface &srcSurface, const byte *palette, int destX, int destY, Common::Rect srcRect, bool flipX = false, AlphaBlendMode alpha = NONE, uint16 scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE);
-	void copyRectToSurface8bppWrappedX(const Graphics::Surface &srcSurface, const byte *palette, Common::Rect srcRect, AlphaBlendMode alpha = NONE);
+	void copyRectToSurface(const Graphics::Surface &srcSurface, int destX, int destY, ::Common::Rect srcRect, bool flipX = false, AlphaBlendMode alpha = NONE);
+	void copyRectToSurface8bpp(const Graphics::Surface &srcSurface, const byte *palette, int destX, int destY, ::Common::Rect srcRect, bool flipX = false, AlphaBlendMode alpha = NONE, uint16 scale = DRAGONS_ENGINE_SPRITE_100_PERCENT_SCALE);
+	void copyRectToSurface8bppWrappedX(const Graphics::Surface &srcSurface, const byte *palette, ::Common::Rect srcRect, AlphaBlendMode alpha = NONE);
 	void updateScreen();
 	void loadPalette(uint16 paletteNum, const byte *palette);
 	byte *getPalette(uint16 paletteNum);
 	void setPaletteRecord(uint16 paletteNum, uint16 offset, uint16 newValue);
 	void updatePaletteTransparency(uint16 paletteNum, uint16 startOffset, uint16 endOffset, bool isTransparent);
 	void clearScreen();
-	void drawRect(uint16 colour, Common::Rect rect, int id);
-	void fillRect(uint16 colour, Common::Rect rect);
-	Common::Rect clipRectToScreen(int destX, int destY, const Common::Rect rect);
-	Common::Rect clipRectToRect(int destX, int destY, const Common::Rect rect, const Common::Rect containerRect);
+	void drawRect(uint16 colour, ::Common::Rect rect, int id);
+	void fillRect(uint16 colour, ::Common::Rect rect);
+	Common::Rect clipRectToScreen(int destX, int destY, const ::Common::Rect rect);
+	Common::Rect clipRectToRect(int destX, int destY, const ::Common::Rect rect, const ::Common::Rect containerRect);
 
 	void setScreenShakeOffset(int16 x, int16 y);
 
diff --git a/engines/dragons/scriptopcodes.cpp b/engines/dragons/scriptopcodes.cpp
index b8cd2fdeafd..59ff6050764 100644
--- a/engines/dragons/scriptopcodes.cpp
+++ b/engines/dragons/scriptopcodes.cpp
@@ -93,7 +93,7 @@ void ScriptOpcodes::execOpcode(ScriptOpCall &scriptOpCall) {
 	(*_opcodes[scriptOpCall._op])(scriptOpCall);
 }
 
-typedef Common::Functor1Mem<ScriptOpCall&, void, ScriptOpcodes> ScriptOpcodeI;
+typedef ::Common::Functor1Mem<ScriptOpCall&, void, ScriptOpcodes> ScriptOpcodeI;
 #define OPCODE(op, func) \
 	_opcodes[op] = new ScriptOpcodeI(this, &ScriptOpcodes::func); \
 	_opcodeNames[op] = #func;
diff --git a/engines/dragons/scriptopcodes.h b/engines/dragons/scriptopcodes.h
index 019db5fc9d0..21b0728c84b 100644
--- a/engines/dragons/scriptopcodes.h
+++ b/engines/dragons/scriptopcodes.h
@@ -46,7 +46,7 @@ struct ScriptOpCall {
 	uint32 readUint32();
 };
 
-typedef Common::Functor1<ScriptOpCall&, void> ScriptOpcode;
+typedef ::Common::Functor1<ScriptOpCall&, void> ScriptOpcode;
 
 class DragonFLG;
 class SpecialOpcodes;
diff --git a/engines/dragons/sequenceopcodes.cpp b/engines/dragons/sequenceopcodes.cpp
index 26b79411ba4..588708e1363 100644
--- a/engines/dragons/sequenceopcodes.cpp
+++ b/engines/dragons/sequenceopcodes.cpp
@@ -65,7 +65,7 @@ void SequenceOpcodes::execOpcode(Actor *control, OpCall &opCall) {
 	(*_opcodes[opCall._op])(control, opCall);
 }
 
-typedef Common::Functor2Mem<Actor*, OpCall&, void, SequenceOpcodes> SequenceOpcodeI;
+typedef ::Common::Functor2Mem<Actor*, OpCall&, void, SequenceOpcodes> SequenceOpcodeI;
 #define OPCODE(op, func) \
 	_opcodes[op] = new SequenceOpcodeI(this, &SequenceOpcodes::func); \
 	_opcodeNames[op] = #func;
diff --git a/engines/dragons/sequenceopcodes.h b/engines/dragons/sequenceopcodes.h
index b8dfc917743..665fcb4781a 100644
--- a/engines/dragons/sequenceopcodes.h
+++ b/engines/dragons/sequenceopcodes.h
@@ -52,7 +52,7 @@ struct OpCall {
 #define ARG_INT16(name) int16 name = opCall.readSint16(); debug(5, "ARG_INT16(" #name " = %d)", name);
 #define ARG_UINT32(name) uint32 name = opCall.readUint32(); debug(5, "ARG_UINT32(" #name " = %08X)", name);
 
-typedef Common::Functor2<Actor*, OpCall&, void> SequenceOpcode;
+typedef ::Common::Functor2<Actor*, OpCall&, void> SequenceOpcode;
 
 class SequenceOpcodes {
 public:
diff --git a/engines/dragons/sound.cpp b/engines/dragons/sound.cpp
index 8b1f1cff2e6..ae4eb210095 100644
--- a/engines/dragons/sound.cpp
+++ b/engines/dragons/sound.cpp
@@ -42,13 +42,6 @@
 
 namespace Dragons {
 
-struct SpeechLocation {
-	uint32 talkId;
-	uint16 sectorStart;
-	int8 startOffset;
-	uint16 sectorEnd;
-} SpeechLocation;
-
 void CdIntToPos_0(uint32 param_1) { //, byte *param_2)
 	int iVar1;
 	int iVar2;
@@ -88,7 +81,7 @@ void SoundManager::playSpeech(uint32 textIndex) {
 		return;
 	}
 
-	Common::File *fd = new Common::File();
+	Common::File *fd = new ::Common::File();
 	if (!fd->open("dtspeech.xa")) {
 		error("Failed to open dtspeech.xa");
 	}
@@ -106,8 +99,8 @@ bool SoundManager::isSpeechPlaying() {
 	return _vm->_mixer->isSoundHandleActive(_speechHandle);
 }
 
-bool SoundManager::getSpeechLocation(uint32 talkId, struct SpeechLocation *location) {
-	Common::File *fd = new Common::File();
+bool SoundManager::getSpeechLocation(uint32 talkId, SpeechLocation *location) {
+	Common::File *fd = new ::Common::File();
 	if (!fd->open("dragon.exe")) {
 		error("Failed to open dragon.exe");
 	}
@@ -162,7 +155,7 @@ static const int s_xaTable[5][2] = {
 	{ 122, -60 }
 };
 
-void SoundManager::PSXAudioTrack::queueAudioFromSector(Audio::QueuingAudioStream *audStream, Common::SeekableReadStream *sector) {
+void SoundManager::PSXAudioTrack::queueAudioFromSector(Audio::QueuingAudioStream *audStream, ::Common::SeekableReadStream *sector) {
 	sector->skip(24);
 
 	// This XA audio is different (yet similar) from normal XA audio! Watch out!
@@ -386,8 +379,8 @@ VabSound * SoundManager::loadVab(const char *headerFilename, const char *bodyFil
 	byte *headData = _bigFileArchive->load(headerFilename, headSize);
 	byte *bodyData = _bigFileArchive->load(bodyFilename, bodySize);
 
-	Common::SeekableReadStream *headStream = new Common::MemoryReadStream(headData, headSize, DisposeAfterUse::YES);
-	Common::SeekableReadStream *bodyStream = new Common::MemoryReadStream(bodyData, bodySize, DisposeAfterUse::YES);
+	Common::SeekableReadStream *headStream = new ::Common::MemoryReadStream(headData, headSize, DisposeAfterUse::YES);
+	Common::SeekableReadStream *bodyStream = new ::Common::MemoryReadStream(bodyData, bodySize, DisposeAfterUse::YES);
 
 	return new VabSound(headStream, bodyStream);
 }
@@ -466,7 +459,7 @@ void SoundManager::loadMsf(uint32 sceneId) {
 		uint32 msfSize;
 		byte *msfData = _bigFileArchive->load(msfFileName, msfSize);
 
-		Common::SeekableReadStream *msfStream = new Common::MemoryReadStream(msfData, msfSize, DisposeAfterUse::YES);
+		Common::SeekableReadStream *msfStream = new ::Common::MemoryReadStream(msfData, msfSize, DisposeAfterUse::YES);
 
 		stopAllVoices();
 
@@ -530,7 +523,7 @@ void SoundManager::playMusic(int16 song) {
 
 	uint32 dataSize;
 	byte *seqData = _bigFileArchive->load(filename, dataSize);
-	Common::MemoryReadStream *seq = new Common::MemoryReadStream(seqData, dataSize, DisposeAfterUse::YES);
+	Common::MemoryReadStream *seq = new ::Common::MemoryReadStream(seqData, dataSize, DisposeAfterUse::YES);
 	_midiPlayer->playSong(seq);
 	delete seq;
 }
diff --git a/engines/dragons/sound.h b/engines/dragons/sound.h
index 8c87b95c844..973d01b64da 100644
--- a/engines/dragons/sound.h
+++ b/engines/dragons/sound.h
@@ -33,7 +33,13 @@ class DragonsEngine;
 class BigfileArchive;
 class DragonRMS;
 class VabSound;
-struct SpeechLocation;
+
+struct SpeechLocation {
+	uint32 talkId;
+	uint16 sectorStart;
+	int8 startOffset;
+	uint16 sectorEnd;
+};
 
 typedef struct Voice {
 	int16 soundID;
@@ -97,7 +103,7 @@ private:
 
 	VabSound * loadVab(const char *headerFilename, const char *bodyFilename);
 
-	bool getSpeechLocation(uint32 talkId, struct SpeechLocation *location);
+	bool getSpeechLocation(uint32 talkId, SpeechLocation *location);
 	bool isVoicePlaying(uint16 soundID);
 	Audio::SoundHandle *getVoiceHandle(uint16 soundID);
 	void stopVoicePlaying(uint16 soundID);
@@ -116,7 +122,7 @@ private:
 		Audio::QueuingAudioStream *createNewAudioStream(Common::File *fd, uint16 sectorStart, int8 startOffset, uint16 sectorEnd);
 
 	private:
-		void queueAudioFromSector(Audio::QueuingAudioStream *audStream, Common::SeekableReadStream *sector);
+		void queueAudioFromSector(Audio::QueuingAudioStream *audStream, ::Common::SeekableReadStream *sector);
 	};
 };
 
diff --git a/engines/dragons/specialopcodes.cpp b/engines/dragons/specialopcodes.cpp
index 44e5303a2fc..86268807117 100644
--- a/engines/dragons/specialopcodes.cpp
+++ b/engines/dragons/specialopcodes.cpp
@@ -71,7 +71,7 @@ void SpecialOpcodes::run(int16 op) {
 	(*_opcodes[op])();
 }
 
-typedef Common::Functor0Mem<void, SpecialOpcodes> SpecialOpcodeI;
+typedef ::Common::Functor0Mem<void, SpecialOpcodes> SpecialOpcodeI;
 #define OPCODE(op, func) \
 	_opcodes[op] = new SpecialOpcodeI(this, &SpecialOpcodes::func); \
 	_opcodeNames[op] = #func;
@@ -1563,7 +1563,7 @@ void castleFogUpdateFunction() {
 		if (castleFogXOffset < 0) {
 			castleFogXOffset = 0x13f;
 		}
-		vm->_scene->setLayerOffset(2, Common::Point(castleFogXOffset, 0));
+		vm->_scene->setLayerOffset(2, ::Common::Point(castleFogXOffset, 0));
 		specialOpCounter = 6;
 	} else {
 		specialOpCounter--;
diff --git a/engines/dragons/specialopcodes.h b/engines/dragons/specialopcodes.h
index bb603161f9e..7b58fdd64dd 100644
--- a/engines/dragons/specialopcodes.h
+++ b/engines/dragons/specialopcodes.h
@@ -32,7 +32,7 @@ namespace Dragons {
 
 class DragonsEngine;
 
-typedef Common::Functor0<void> SpecialOpcode;
+typedef ::Common::Functor0<void> SpecialOpcode;
 
 class SpecialOpcodes {
 public:
diff --git a/engines/dragons/strplayer.cpp b/engines/dragons/strplayer.cpp
index 5b789124e23..d6bb96e0b96 100644
--- a/engines/dragons/strplayer.cpp
+++ b/engines/dragons/strplayer.cpp
@@ -29,7 +29,7 @@ StrPlayer::StrPlayer(DragonsEngine *vm, Screen *screen) : _vm(vm), _screen(scree
 	_decoder = new Video::PSXStreamDecoder(Video::PSXStreamDecoder::kCD2x);
 }
 
-void StrPlayer::playVideo(const Common::String &filename) {
+void StrPlayer::playVideo(const ::Common::String &filename) {
 	bool skipped = false;
 
 	if (!_decoder->loadFile(filename)) {
@@ -42,14 +42,14 @@ void StrPlayer::playVideo(const Common::String &filename) {
 			const Graphics::Surface *frame = _decoder->decodeNextFrame();
 			if (frame) {
 				_screen->clearScreen();
-				_screen->copyRectToSurface(*frame, 0, 0, Common::Rect(frame->w, frame->h));
+				_screen->copyRectToSurface(*frame, 0, 0, ::Common::Rect(frame->w, frame->h));
 				_screen->updateScreen();
 			}
 		}
 
 		Common::Event event;
 		while (_vm->_system->getEventManager()->pollEvent(event)) {
-			if (event.type == Common::EVENT_CUSTOM_ENGINE_ACTION_END
+			if (event.type == ::Common::EVENT_CUSTOM_ENGINE_ACTION_END
 				&& (event.customType == Dragons::kDragonsActionSelect || event.customType == Dragons::kDragonsActionEnter)) {
 				skipped = true;
 			}
diff --git a/engines/dragons/strplayer.h b/engines/dragons/strplayer.h
index ce0584dedf8..5bdffa3e738 100644
--- a/engines/dragons/strplayer.h
+++ b/engines/dragons/strplayer.h
@@ -36,7 +36,7 @@ public:
 	StrPlayer(DragonsEngine *vm, Screen *screen);
 	~StrPlayer();
 
-	void playVideo(const Common::String &filename);
+	void playVideo(const ::Common::String &filename);
 private:
 };
 
diff --git a/engines/dragons/talk.cpp b/engines/dragons/talk.cpp
index 8adbd7da69c..8f3e30df9a2 100644
--- a/engines/dragons/talk.cpp
+++ b/engines/dragons/talk.cpp
@@ -835,7 +835,7 @@ TalkDialogEntry *Talk::displayTalkDialogMenu(Common::Array<TalkDialogEntry*> dia
 	goto LAB_800317a4;
 }
 
-void Talk::exitTalkMenu(bool isFlag8Set, bool isFlag100Set, Common::Array<TalkDialogEntry*> dialogEntries) {
+void Talk::exitTalkMenu(bool isFlag8Set, bool isFlag100Set, ::Common::Array<TalkDialogEntry*> dialogEntries) {
 	_vm->clearFlags(ENGINE_FLAG_8);
 	_vm->clearFlags(ENGINE_FLAG_100);
 
@@ -949,7 +949,7 @@ uint32 Talk::extractTextIndex(Common::File *fd, uint16 offset) {
 }
 
 void Talk::initDefaultResponseTable() {
-	Common::File *fd = new Common::File();
+	Common::File *fd = new ::Common::File();
 	if (!fd->open("dragon.exe")) {
 		error("Failed to open dragon.exe");
 	}
diff --git a/engines/dragons/talk.h b/engines/dragons/talk.h
index ba49e9c5949..446ff7a723b 100644
--- a/engines/dragons/talk.h
+++ b/engines/dragons/talk.h
@@ -95,7 +95,7 @@ private:
 	void copyTextToBuffer(uint16 *destBuffer, byte *src, uint32 destBufferLength);
 	uint32 wideStrLen(uint16 *text);
 	TalkDialogEntry *displayTalkDialogMenu(Common::Array<TalkDialogEntry*> dialogEntries);
-	void exitTalkMenu(bool isFlag8Set, bool isFlag100Set, Common::Array<TalkDialogEntry*> dialogEntries);
+	void exitTalkMenu(bool isFlag8Set, bool isFlag100Set, ::Common::Array<TalkDialogEntry*> dialogEntries);
 	uint32 getDefaultResponseTextIndex();
 	void initDefaultResponseTable();
 	uint32 strlenUTF16(uint16 *text);
diff --git a/engines/dragons/vabsound.cpp b/engines/dragons/vabsound.cpp
index 9fd68a11e34..2054f26e3e7 100644
--- a/engines/dragons/vabsound.cpp
+++ b/engines/dragons/vabsound.cpp
@@ -36,7 +36,7 @@ VabSound::VabSound(Common::SeekableReadStream *msfData, const DragonsEngine *_vm
 	_vbData = new byte[dataSize];
 	msfData->read(_vbData, dataSize);
 
-//		_vbData = new Common::MemoryReadStream(newData, dataSize, DisposeAfterUse::YES);
+//		_vbData = new ::Common::MemoryReadStream(newData, dataSize, DisposeAfterUse::YES);
 //
 //		Audio::AudioStream *str = Audio::makeXAStream(_vbData, 11025);
 //		Audio::SoundHandle _speechHandle;
@@ -45,7 +45,7 @@ VabSound::VabSound(Common::SeekableReadStream *msfData, const DragonsEngine *_vm
 	delete msfData;
 }
 
-VabSound::VabSound(Common::SeekableReadStream *vhData, Common::SeekableReadStream *vbData): _toneAttrs(nullptr), _vbData(nullptr) {
+VabSound::VabSound(Common::SeekableReadStream *vhData, ::Common::SeekableReadStream *vbData): _toneAttrs(nullptr), _vbData(nullptr) {
 	loadHeader(vhData);
 
 	assert(vhData->pos() == vhData->size());
@@ -110,7 +110,7 @@ Audio::AudioStream *VabSound::getAudioStream(uint16 program, uint16 key) {
 	debug(3, "Playing program %d, Key %d, numTones: %d, vagID %d, vagOffset: %x, size: %x adjustedSampleRate: %d",
 	   program, key, _programAttrs[program].tones, vagID, _vagOffsets[vagID], _vagSizes[vagID], sampleRate);
 	Audio::AudioStream *str = Audio::makeXAStream(
-			new Common::MemoryReadStream(&_vbData[_vagOffsets[vagID]], _vagSizes[vagID], DisposeAfterUse::NO),
+			new ::Common::MemoryReadStream(&_vbData[_vagOffsets[vagID]], _vagSizes[vagID], DisposeAfterUse::NO),
 			sampleRate,
 			DisposeAfterUse::YES);
 	return str;
diff --git a/engines/dragons/vabsound.h b/engines/dragons/vabsound.h
index 832e8d023e1..ebf2ce810c7 100644
--- a/engines/dragons/vabsound.h
+++ b/engines/dragons/vabsound.h
@@ -107,7 +107,7 @@ public:
 	 * @param dataHeader
 	 * @param dataBody
 	 */
-	VabSound(Common::SeekableReadStream* vhData, Common::SeekableReadStream* vbData);
+	VabSound(Common::SeekableReadStream* vhData, ::Common::SeekableReadStream* vbData);
 
 	~VabSound();
 
diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp
index d0d33d98287..e77b31e9dc3 100644
--- a/engines/sci/engine/script_patches.cpp
+++ b/engines/sci/engine/script_patches.cpp
@@ -22398,6 +22398,447 @@ static const SciScriptPatcherEntry torinSignatures[] = {
 
 #endif
 
+//// REMOVE THESE - START /////////////////////////////////////////////////////////////////////////
+
+/*
+Cannot be removed (integral parts of games):
+- Freddy Pharkas drug mixing puzzle
+- Longbow coat of arms/tree names/druid hand code
+- SQ5 planet coordinates
+*/
+
+// Electronic door lock
+static const uint16 brain1Cp[] = {
+	// These two patches are mutually exclusive
+
+	// Patch 1: Removes the CP screen completely and the door always opens
+	/*
+	SIG_MAGICDWORD,
+	0x8f, 0x01,            // lsp 01
+	0x35, 0x03,            // ldi 03
+	0x1a,                  // eq?
+	0x30, 0x2f, 0x00,      // bnt 002f  [08b5]
+	0x82, 0x38, 0x02,      // lal 0238
+	0x30, 0x0e, 0x00,      // bnt 000e  [089a]
+	0
+	*/
+	// Patch 2: Keeps asking for the CP each time, but the answer is always
+	// ignored and the door opens all the time
+	SIG_MAGICDWORD,
+	0x38, 0xc2, 0x00,      // pushi 00c2
+	0x76,                  // push0
+	0x72, 0x62, 0x3c,      // lofsa 3c62
+	0x4a, 0x04,            // send 04
+	0x30, 0x1a, 0x00,      // bnt 001a  [08c0]
+	SIG_END
+};
+
+static const uint16 brain1PatchCp[] = {
+	//PATCH_ADDTOOFFSET(+11),	// Patch 1
+	PATCH_ADDTOOFFSET(+9),	// Patch 2
+	0x34, 0x00, 0x00, // ldi 0000
+	PATCH_END
+};
+
+// Island location
+static const uint16 brain2Cp[] = {
+	SIG_MAGICDWORD,
+	0x89, 0x46,         // lsg 46
+	0x78,               // push1
+	0x40, 0x1a, 0x07, 0x04, // call 071a  [0c84] 04
+	0x22,               // lt?
+	0x30, 0x74, 0x00,   // bnt 0074  [05e3]
+	SIG_END
+};
+
+static const uint16 brain2PatchCp[] = {
+	PATCH_ADDTOOFFSET(+8),
+	0x32, 0x28, 0x00,	// jmp 0028 [0597] (skip past all checks and accept any answer)
+	PATCH_END
+};
+
+// Face paint
+static const uint16 ecoQuest2Cp[] = {
+	SIG_MAGICDWORD,
+	0x8b, 0x1f,        // lsl 1f
+	0x83, 0x1e,        // lal 1e
+	0x1a,              // eq?
+	0x31, 0x15,        // bnt 15  [06c4]
+	SIG_END
+};
+
+static const uint16 ecoQuest2PatchCp[] = {
+	PATCH_ADDTOOFFSET(+5),
+	0x35, 0x00,      // ldi 00
+	PATCH_END
+
+};
+
+// Startup questions
+static const uint16 kq4Cp[] = {
+	SIG_MAGICDWORD,
+	0x8b, 0x23,      // lsl 23
+	0x83, 0x02,      // lal 02
+	0x1a,            // eq?
+	0x30,            // bnt (2 bytes, failure offset)
+	SIG_END
+};
+
+static const uint16 kq4PatchCp[] = {
+	PATCH_ADDTOOFFSET(+5),
+	0x34, 0x00, 0x00, // ldi 0000 (never jump)
+	PATCH_END
+};
+
+// Random spells
+static const uint16 kq5Cp[] = {
+	SIG_MAGICDWORD,
+	0x36,             // push
+	0x45, 0x1a, 0x02, // callb 1a 02
+	0x85, 0x00,       // lat 00
+	0x48,             // ret
+	SIG_END
+};
+
+static const uint16 kq5PatchCp[] = {
+	PATCH_ADDTOOFFSET(+4),
+	0x35, 0x01,      // ldi 01 (answer was correct)
+	PATCH_END
+};
+
+// Isle of the Sacred Mountain cliffs questions
+static const uint16 kq6Cp[] = {
+	SIG_MAGICDWORD,
+	0x63, 0x78,      // pToa 78 (correctButton)
+	0x1a,            // eq?
+	0x2f, 0x05,      // bt 05  [0bc6]
+	SIG_END
+};
+
+static const uint16 kq6PatchCp[] = {
+	PATCH_ADDTOOFFSET(+3),
+	0x33, 0x08,       // jmp 0x08 [0bc9] (answer is always correct and skip the bnt)
+	PATCH_END
+};
+
+// Age verification
+static const uint16 larry1Cp[] = {
+	SIG_MAGICDWORD,
+	0x8b, 0x03,          // lsl 03
+	0x83, 0x04,          // lal 04
+	0x1a,                // eq?
+	0x2e, 0x05, 0x00,    // bt 0005  [0679]
+	SIG_END
+};
+
+static const uint16 larry1PatchCp[] = {
+	PATCH_ADDTOOFFSET(+5),
+	0x32, 0x07, 0x00,       // jmp 0007 (answer is always correct and skip the bnt)
+	PATCH_END
+};
+
+// Girl matching
+static const uint16 larry2Cp[] = {
+	SIG_MAGICDWORD,
+	0x43, 0x49, 0x04, // callk StrCmp[49] 04
+	0x18,             // not
+	0x30, 0x0d, 0x00, // bnt 000d  [05cc]
+	SIG_END
+};
+
+static const uint16 larry2PatchCp[] = {
+	PATCH_ADDTOOFFSET(+4),
+	0x34, 0x00, 0x00, // ldi 0000 (never jump)
+	PATCH_END
+};
+
+// Age verification
+static const uint16 larry3Cp1[] = {
+	SIG_MAGICDWORD,
+	0x8b, 0x05,       // lsl 05
+	0x83, 0x06,       // lal 06
+	0x1a,             // eq?
+	0x30, 0x38, 0x00, // bnt 0038  [055b]
+	SIG_END
+};
+
+static const uint16 larry3PatchCp1[] = {
+	PATCH_ADDTOOFFSET(+5),
+	0x34, 0x00, 0x00, // ldi 0000
+	PATCH_END
+};
+
+// Ticket number
+static const uint16 larry3Cp2[] = {
+	SIG_MAGICDWORD,
+	0x3c,             // dup
+	0x35, 0x02,       // ldi 02
+	0x1a,             // eq?
+	0x30, 0x94, 0x00, // bnt 0094  [0fac]
+	SIG_END
+};
+
+static const uint16 larry3PatchCp2[] = {
+	PATCH_ADDTOOFFSET(+13),
+	0x32,             // jmp
+	PATCH_END
+};
+
+// Locker combination
+static const uint16 larry3Cp3[] = {
+	SIG_MAGICDWORD,
+	0x8b, 0x00,       // lsl 00
+	0x81, 0x93,       // lag 93
+	0x1c,             // ne?
+	0x2e, 0x0d, 0x00, // bt 000d  [0527]
+	SIG_END
+};
+
+static const uint16 larry3PatchCp3[] = {
+	PATCH_ADDTOOFFSET(+5),
+	0x32, 0x1d, 0x00, // jmp 001d  [0537]
+	PATCH_END
+};
+
+// Airport terminal
+static const uint16 larry5Cp[] = {
+	SIG_MAGICDWORD,
+	0x3c,			// dup
+	0x83, 0x10,		// lal 10
+	0x93, 0x04,		// lali 04
+	0x1a,           // eq?
+	0x30, 0x0b, 0x00,	// bnt 000b  [0108]
+	SIG_END
+};
+
+static const uint16 larry5PatchCp[] = {
+	PATCH_ADDTOOFFSET(+6),
+	0x34, 0x00, 0x00, // ldi 0000
+	PATCH_END
+};
+
+// Fingerprint matching
+static const uint16 laurabow1Cp[] = {
+	SIG_MAGICDWORD,
+	0x83, 0x00,      // lal 00
+	0x02,            // add
+	0x93, 0x35,      // lali 0x35
+	0x1a,            // eq?
+	0x30,            // bnt (failure offset)
+	SIG_END
+};
+
+static const uint16 laurabow1PatchCp[] = {
+	PATCH_ADDTOOFFSET(+6),
+	0x34, 0x00, 0x00, // ldi 0000 (dummy - never fail)
+	PATCH_END
+};
+
+// Egyptian gods questions
+static const uint16 laurabow2Cp[] = {
+	SIG_MAGICDWORD,
+	0x8b, 0x01,       // lsl 01
+	0x35, 0x01,       // ldi 01
+	0x04,             // sub
+	0x93, 0x04,       // lali 04
+	0x1a,             // eq?
+	0x31, 0x0b,       // bnt 0b  [0329]
+	SIG_END
+};
+
+static const uint16 laurabow2PatchCp[] = {
+	PATCH_ADDTOOFFSET(+8),
+	0x35, 0x00,        // ldi 00
+	PATCH_END
+};
+
+// Gemstones: accept any gemstone
+static const uint16 longbowCp1[] = {
+	SIG_MAGICDWORD,
+	0x46, 0xe7, 0x03, 0x05, 0x00, // calle 03e7 0005 X
+	SIG_ADDTOOFFSET(+1), // [skip 1 bytes, calle parameter]
+	0x30, 0x13, 0x00,  // bnt 0013
+	SIG_END
+};
+
+static const uint16 longbowPatchCp1[] = {
+	PATCH_ADDTOOFFSET(+6),
+	0x34, 0x00, 0x00, // ldi 0000 (dummy - never fail)
+	PATCH_END
+};
+
+// Gemstones: allow the same gemstone to be clicked more than once
+static const uint16 longbowCp2[] = {
+	SIG_MAGICDWORD,
+	0x8f, 0x01,       // lsp 01
+	0x35, 0x03,       // ldi 03
+	0x1a,             // eq?
+	0x30,             // bnt X
+	SIG_ADDTOOFFSET(+2), // [skip 2 bytes, bnt offset]
+	0xc3, 0x0e,       // +al 0e
+	0x8b,             // lsl X
+	SIG_ADDTOOFFSET(+1), // [skip 1 bytes, lsl variable]
+	0x35, 0x00,       // ldi 00
+	0x1a,             // eq?
+	0x30,             // bnt X
+	SIG_END
+};
+
+static const uint16 longbowPatchCp2[] = {
+	PATCH_ADDTOOFFSET(+15),
+	0x34, 0x00, 0x00, // ldi 0000 (dummy - never fail)
+	PATCH_END
+};
+
+// Suspect matching
+static const uint16 pq2Cp[] = {
+	SIG_MAGICDWORD,
+	0x35, 0x00,      // ldi 00
+	0xa1, 0x04,      // sag 04
+	0x3a,            // toss
+	0x81, 0x04,      // lag 04
+	0x30, 0x0c, 0x00,// bnt 000c  [01ce]
+	SIG_END
+};
+
+static const uint16 pq2PatchCp[] = {
+	PATCH_ADDTOOFFSET(+7),
+	0x32,			// jmp (name entry is always correct)
+	PATCH_END
+};
+
+// Arcada library
+static const uint16 sq1Cp1[] = {
+	SIG_MAGICDWORD,
+	0x43, 0x45, 0x04,  // callk StrCmp[45] 04
+	0x36,              // push
+	0x35, 0x00,        // ldi 00
+	0x1a,              // eq?
+	0x30, 0x09, 0x00,  // bnt 0009  [083d]
+	SIG_END
+};
+
+// Deltaur navigational code
+static const uint16 sq1Cp2[] = {
+	SIG_MAGICDWORD,
+	0x43, 0x45, 0x04,  // callk StrCmp[45] 04
+	0x36,              // push
+	0x35, 0x00,        // ldi 00
+	0x1a,              // eq?
+	0x30, 0x26, 0x00,  // bnt 0026  [05ac]
+	SIG_END
+};
+
+static const uint16 sq1PatchCp[] = {
+	PATCH_ADDTOOFFSET(+7),
+	0x34, 0x00, 0x00, // ldi 0000 (dummy - never fail)
+	PATCH_END
+};
+
+// Time shuttle
+static const uint16 sq4Cp[] = {
+	SIG_MAGICDWORD,
+	0x5b, 0x02, 0x15,// lea 02 15
+	0x36,            // push
+	0x43, 0x45, 0x04,// callk StrCmp[45] 04
+	0x18,            // not
+	0x30, 0x2a, 0x00,// bnt 002a  [0620]
+	SIG_END
+};
+
+static const uint16 sq4PatchCp[] = {
+	PATCH_ADDTOOFFSET(+8),
+	0x34, 0x00, 0x00, // ldi 0000 (dummy - never fail)
+	PATCH_END
+};
+
+static const SciScriptPatcherEntry brain1AltSignatures[] = {
+	//{  true,    120, "cp",              1,     brain1Cp, brain1PatchCp },	// Patch 1
+	{  true,    120, "cp",              1,     brain1Cp, brain1PatchCp },	// Patch 2
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry brain2Signatures[] = {
+	{  true,    130, "cp",              1,    brain2Cp, brain2PatchCp },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry ecoquest2AltSignatures[] = {
+	{  true,    390, "cp",              1,   ecoQuest2Cp, ecoQuest2PatchCp },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry kq4AltSignatures[] = {
+	{  true,    701, "cp",              1,    kq4Cp, kq4PatchCp },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry kq5AltSignatures[] = {
+	{  true,    754, "cp",              1,    kq5Cp, kq5PatchCp },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry kq6AltSignatures[] = {
+	{  true,     21, "cp",              1,    kq6Cp, kq6PatchCp },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry larry1AltSignatures[] = {
+	{  true,    720, "cp",              1,    larry1Cp, larry1PatchCp },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry larry2AltSignatures[] = {
+	{  true,     10, "cp",              1,     larry2Cp, larry2PatchCp },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry larry3AltSignatures[] = {
+	{  true,    140, "cp1",             1,     larry3Cp1, larry3PatchCp1 },
+	{  true,    420, "cp2",             1,     larry3Cp2, larry3PatchCp2 },
+	{  true,    370, "cp3",             1,     larry3Cp3, larry3PatchCp3 },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry larry5AltSignatures[] = {
+	{  true,    258, "cp",              1,     larry5Cp, larry5PatchCp },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry laurabowAltSignatures[] = {
+	{  true,    414, "cp",              3,     laurabow1Cp, laurabow1PatchCp },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry laurabow2AltSignatures[] = {
+	{  true,     18, "cp",              1,     laurabow2Cp, laurabow2PatchCp },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry longbowAltSignatures[] = {
+	{  true,    621, "cp1",             9,     longbowCp1, longbowPatchCp1 },
+	{  true,    621, "cp2",             9,     longbowCp2, longbowPatchCp2 },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry pq2AltSignatures[] = {
+	{  true,    701, "cp",              1,     pq2Cp, pq2PatchCp },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry sq1vgaAltSignatures[] = {
+	{  true,    103, "cp1",             1,     sq1Cp1, sq1PatchCp },
+	{  true,    400, "cp2",             1,     sq1Cp2, sq1PatchCp },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+static const SciScriptPatcherEntry sq4AltSignatures[] = {
+	{  true,    815, "cp",              1,     sq4Cp, sq4PatchCp },
+	SCI_SIGNATUREENTRY_TERMINATOR
+};
+
+//// REMOVE THESE - END /////////////////////////////////////////////////////////////////////////
+
 // =================================================================================
 
 ScriptPatcher::ScriptPatcher() {
@@ -23018,6 +23459,80 @@ void ScriptPatcher::processScript(uint16 scriptNr, SciSpan<byte> scriptData) {
 		break;
 	}
 
+	//// REMOVE THESE - START ////////////////////////////////////
+	delete[] _runtimeTable; // have to do this to reset the table
+	_runtimeTable = NULL;
+
+	switch (gameId) {
+	case GID_CASTLEBRAIN:
+		if (scriptNr == 120)
+			signatureTable = brain1AltSignatures;
+		break;
+	case GID_ECOQUEST2:
+		if (scriptNr == 390)
+			signatureTable = ecoquest2AltSignatures;
+		break;
+	case GID_ISLANDBRAIN:
+		if (scriptNr == 130)
+			signatureTable = brain2Signatures;
+		break;
+	case GID_KQ4:
+		if (scriptNr == 701)
+			signatureTable = kq4AltSignatures;
+		break;
+	case GID_KQ5:
+		if (scriptNr == 754)
+			signatureTable = kq5AltSignatures;
+		break;
+	case GID_KQ6:
+		if (scriptNr == 21)
+			signatureTable = kq6AltSignatures;
+		break;
+	case GID_LAURABOW:
+		if (scriptNr == 414)
+			signatureTable = laurabowAltSignatures;
+		break;
+	case GID_LAURABOW2:
+		if (scriptNr == 18)
+			signatureTable = laurabow2AltSignatures;
+		break;
+	case GID_LONGBOW:
+		if (scriptNr == 621)
+			signatureTable = longbowAltSignatures;
+		break;
+	case GID_LSL1:
+		if (scriptNr == 720)
+			signatureTable = larry1AltSignatures;
+		break;
+	case GID_LSL2:
+		if (scriptNr == 10)
+			signatureTable = larry2AltSignatures;
+		break;
+	case GID_LSL3:
+		if (scriptNr == 140 || scriptNr == 420 || scriptNr == 370)
+			signatureTable = larry3AltSignatures;
+		break;
+	case GID_LSL5:
+		if (scriptNr == 258)
+			signatureTable = larry5AltSignatures;
+		break;
+	case GID_PQ2:
+		if (scriptNr == 701)
+			signatureTable = pq2AltSignatures;
+		break;
+	case GID_SQ1:
+		if (scriptNr == 103 || scriptNr == 400)
+			signatureTable = sq1vgaAltSignatures;
+		break;
+	case GID_SQ4:
+		if (scriptNr == 815)
+			signatureTable = sq4AltSignatures;
+		break;
+	default:
+		break;
+	}
+	//// REMOVE THESE - END //////////////////////////////////////
+
 	if (signatureTable) {
 		_isMacSci11 = (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_1_1);
 
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp
index 50e0435b82f..86fb717c787 100644
--- a/engines/scumm/sound.cpp
+++ b/engines/scumm/sound.cpp
@@ -648,14 +648,43 @@ static int compareMP3OffsetTable(const void *a, const void *b) {
 	return ((const MP3OffsetTable *)a)->org_offset - ((const MP3OffsetTable *)b)->org_offset;
 }
 
+static Audio::AudioStream *checkForBrokenIndy4Sample(Common::SeekableReadStream *file, uint32 offset) {
+	// WORKAROUND: Check for original Indy4 MONSTER.SOU bug
+	// The speech sample at VCTL offset 0x76ccbca ("Hey you!") which is used
+	// when Indy gets caught on the German submarine seems to not be a VOC
+	// but raw PCM s16be at (this is a guess) 44.1 kHz with a bogus VOC header.
+	// To work around this we skip the VOC header and decode the raw PCM data.
+	// Fixes Trac#10559
+	byte vocHeader[32];
+
+	file->read(vocHeader, 32);
+	// If the bogus VOC header isn't found, don't apply the workaround
+	if (memcmp(vocHeader, "Creative Voice File\x1a\x1a\x00\x0a\x01\x29\x11\x01\x02\x50\x01\xa6\x00", 32) != 0) {
+		file->seek(-32, SEEK_CUR);
+		return nullptr;
+	}
+
+	const int size = 86016; // size of speech sample
+	offset += 32; // size of VOC header
+	return Audio::makeRawStream(
+		new Common::SeekableSubReadStream(
+			file,
+			offset,
+			offset + size,
+			DisposeAfterUse::YES
+		),
+		44100,
+		Audio::FLAG_16BITS,
+		DisposeAfterUse::YES
+	);
+}
+
 void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle *handle) {
 	int num = 0, i;
 	int id = -1;
 	int size = 0;
 	Common::ScopedPtr<ScummFile> file;
 
-	bool _sampleIsPCMS16BE44100 = false;
-
 	if (_vm->_game.id == GID_CMI || (_vm->_game.id == GID_DIG && !(_vm->_game.features & GF_DEMO))) {
 		// COMI (full & demo), DIG (full)
 		_sfxMode |= mode;
@@ -816,16 +845,6 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
 			size = result->compressed_size;
 #endif
 		} else {
-			// WORKAROUND: Original Indy4 MONSTER.SOU bug
-			// The speech sample at VCTL offset 0x76ccbca ("Hey you!") which is used
-			// when Indy gets caught on the German submarine seems to not be a VOC
-			// but raw PCM s16be at (this is a guess) 44.1 kHz with a bogus VOC header.
-			// To work around this we skip the VOC header and decode the raw PCM data.
-			// Fixes Trac#10559
-			if (mode == 2 && _vm->_game.id == GID_INDY4 && offset == 0x76ccbca) {
-				_sampleIsPCMS16BE44100 = true;
-				size = 86016; // size of speech sample
-			}
 			offset += 8;
 		}
 
@@ -889,25 +908,17 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
 #endif
 			break;
 		default:
-			if (_sampleIsPCMS16BE44100) {
-				byte *vocHeader = new byte[32];
-
-				file->read(vocHeader, 32);
-				// Don't apply the Indy4 MONSTER.SOU workaround if we don't find the bogus VOC header
-				if (memcmp(vocHeader, "Creative Voice File\x1a\x1a\x00\x0a\x01\x29\x11\x01\x02\x50\x01\xa6\x00", 32) != 0) {
-					_sampleIsPCMS16BE44100 = false;
-				}
-
-				delete[] vocHeader;
-				file->seek(-32, SEEK_CUR);
+			if (mode == 2 && _vm->_game.id == GID_INDY4 && offset == 0x76ccbd4)
+				input = checkForBrokenIndy4Sample(file.release(), offset);
+
+			if (!input) {
+				input = Audio::makeVOCStream(
+					file.release(),
+					Audio::FLAG_UNSIGNED,
+					DisposeAfterUse::YES
+				);
 			}
 
-			if (_sampleIsPCMS16BE44100) {
-				offset += 32;
-				input = Audio::makeRawStream(new Common::SeekableSubReadStream(file.release(), offset, offset + size, DisposeAfterUse::YES), 44100, Audio::FLAG_16BITS, DisposeAfterUse::YES);
-			} else {
-				input = Audio::makeVOCStream(file.release(), Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
-			}
 			break;
 		}
 
diff --git a/engines/trecision/video.cpp b/engines/trecision/video.cpp
index 4951dbf16fb..27e29c18269 100644
--- a/engines/trecision/video.cpp
+++ b/engines/trecision/video.cpp
@@ -123,44 +123,59 @@ bool NightlongSmackerDecoder::endOfFrames() const {
 
 // ----------------------------------------------------------------------------
 
-NightlongAmigaDecoder::AmigaVideoTrack::AmigaVideoTrack(const Common::String &fileName) {
+NightlongAmigaDecoder::AmigaVideoTrack::AmigaVideoTrack(const Common::String &fileName):
+	_rgb555Format(2, 5, 5, 5, 0, 10, 5, 0, 0){
 	memset(_palette, 0, sizeof(_palette));
+	_curFrame = 0;
+	_frameCount = 10; // TODO: Anything > 1 to keep playing till the audio is done
 
-	Common::File *stream = new Common::File();
-	stream->open(fileName);
+	// TODO: Hardcoded for inventory items. Find them for all videos
+	const int width = 48;
+	const int height = 40;
+
+	_surface = new Graphics::Surface();
+	_surface->create(width, height, _rgb555Format);
+
+	_videoStream = new Common::File();
+	_videoStream->open(fileName);
 
-	if (!stream->isOpen())
+	if (!_videoStream->isOpen())
 		return;
 
-	_curFrame = 0;
-	_frameCount = 10; // TODO: Anything > 1 to keep playing till the audio is done
+	if (!(fileName.hasPrefix("I") && fileName.hasSuffix(".an")))
+		return;
 
 	// TODO: some videos have more than 256 entries
-	/*uint16 palEntries = stream->readUint16LE();
-	stream->skip(2); // unknown
+	uint16 palEntries = _videoStream->readUint16LE();
+	_videoStream->skip(2); // unknown
 	for (uint16 i = 0; i < palEntries; i++) {
-		_palette[i * 3] = stream->readByte();
-		_palette[i * 3 + 1] = stream->readByte();
-		_palette[i * 3 + 2] = stream->readByte();
-		stream->skip(1); // unused alpha channel
-	}*/
+		if (i < 256) {
+			_palette[i * 3] = _videoStream->readByte();
+			_palette[i * 3 + 1] = _videoStream->readByte();
+			_palette[i * 3 + 2] = _videoStream->readByte();
+			_videoStream->skip(1); // unused alpha channel
+		} else {
+			_videoStream->skip(4);
+		}
+	}
+}
 
-	delete stream;
+NightlongAmigaDecoder::AmigaVideoTrack::~AmigaVideoTrack() {
+	_surface->free();
+	delete _surface;
+	delete _videoStream;
 }
 
 uint16 NightlongAmigaDecoder::AmigaVideoTrack::getWidth() const {
-	// TODO
-	return 0;
+	return _surface->w;
 }
 
 uint16 NightlongAmigaDecoder::AmigaVideoTrack::getHeight() const {
-	// TODO
-	return 0;
+	return _surface->h;
 }
 
 Graphics::PixelFormat NightlongAmigaDecoder::AmigaVideoTrack::getPixelFormat() const {
-	// TODO
-	return g_system->getScreenFormat();
+	return _surface->format;
 }
 
 uint32 NightlongAmigaDecoder::AmigaVideoTrack::getNextFrameStartTime() const {
@@ -169,8 +184,15 @@ uint32 NightlongAmigaDecoder::AmigaVideoTrack::getNextFrameStartTime() const {
 }
 
 const Graphics::Surface *NightlongAmigaDecoder::AmigaVideoTrack::decodeNextFrame() {
-	// TODO
-	return nullptr;
+	for (uint16 y = 0; y < _surface->h; ++y) {
+		for (uint16 x = 0; x < _surface->w; ++x) {
+			_surface->setPixel(x, y, _videoStream->readUint16LE());
+		}
+	}
+
+	_curFrame++;
+
+	return _surface;
 }
 
 NightlongAmigaDecoder::AmigaAudioTrack::AmigaAudioTrack(const Common::String &fileName) :
@@ -208,12 +230,11 @@ bool NightlongAmigaDecoder::forceSeekToFrame(uint frame) {
 
 const Common::Rect *NightlongAmigaDecoder::getNextDirtyRect() {
 	// TODO
-	return &_lastDirtyRect;
+	return getCurFrame() == 0 ? &_lastDirtyRect : nullptr;
 }
 
 bool NightlongAmigaDecoder::endOfFrames() const {
-	//return getCurFrame() >= (int32)getFrameCount() - 1;
-	return true;
+	return getCurFrame() >= (int32)getFrameCount() - 1;
 }
 
 } // namespace Trecision
diff --git a/engines/trecision/video.h b/engines/trecision/video.h
index d612607df9a..c3d6bd19f21 100644
--- a/engines/trecision/video.h
+++ b/engines/trecision/video.h
@@ -22,6 +22,7 @@
 #ifndef TRECISION_VIDEO_H
 #define TRECISION_VIDEO_H
 
+#include "common/file.h"
 #include "common/stream.h"
 #include "common/serializer.h"
 #include "video/smk_decoder.h"
@@ -62,11 +63,15 @@ private:
 	class AmigaVideoTrack : public VideoTrack {
 	public:
 		AmigaVideoTrack(const Common::String &fileName);
+		~AmigaVideoTrack();
 
 	private:
+		const Graphics::PixelFormat _rgb555Format;
 		byte _palette[3 * 256];
 		int _curFrame;
 		uint32 _frameCount;
+		Graphics::Surface *_surface;
+		Common::File *_videoStream;
 
 		uint16 getWidth() const override;
 		uint16 getHeight() const override;




More information about the Scummvm-git-logs mailing list