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

bluegr noreply at scummvm.org
Sun Nov 15 10:40:29 UTC 2026


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

Summary:
8ce700d82d SNATCHER: new engine initial commit
75eda52892 GRAPHICS: SegaCD rendering code - refactor and move to Common
ef50122ff5 SNATCHER: start work on graphics code
c478868c8b KYRA: (EOB) - minor cleanup
5ecd32d04a KYRA: (EOB/SegaCD) - fix gfx endianness inconsistencies
3729bbbfb7 SNATCHER: partly implement startup/intro
b8d87f7884 SNATCHER: more intro work
4df85f37f8 GRAPHICS: (SegaGfx) - rewrite render routine
5d8263f0c9 SNATCHER: fix some intro transitions
2ef0cfe866 SNATCHER: add detection entry
902b4bc581 SNATCHER: fix intro glitches
95b4f2a567 SNATCHER: more work on the audio code
6697523adf SNATCHER: fix graphics glitches and work on main menu
8e718585d0 SNATCHER: work on script code and fix bugs
420697c4b1 SNATCHER: work on scripts and text rendering
6537234d36 SNATCHER: add verb interface, script work, etc.
7d8d07e7e9 SNATCHER: add save/load support
5eb9c36bf7 GRAPHICS: (Sega renderer) - add option for aspect ratio correction
7a2d646e19 SNATCHER: implement action sequences
5631e047eb GRAPHICS: (Sega Renderer) - fix prio sprite rendering
273446a3b4 SNATCHER: various fixes
5a895720b1 SNATCHER: implement missing parts
0ecbd2080e SNATCHER: more fixes
af67c7d533 SNATCHER: fix pal version
8ab37f09f7 SNATCHER: add support for native saveload dialog
0c1e422963 SNATCHER: add default key map
a6e1321783 SNATCHER: fix last blocker bug
a73e2b9395 KYRA: fix warning
bc94f3acc1 SNATCHER: fix warnings
401b6307cd SNATCHER: fix palette glitch
db43ef2fc4 SNATCHER: minor intro timing fix
72df2131cf SNATCHER: add launcher options dialog
0b6835ac22 SNATCHER: fix minor palette glitch
22486923d0 SNATCHER: fix transition glitch and GMM handling
5e69418527 SNATCHER: minor pcm cache adjust
6973209d8d SNATCHER: minor fixes and cleanup
e4c2a3373e SNATCHER: fix savegame handling
5f91396a39 SNATCHER: remove experimental code
273de1b112 SNATCHER: fix warning
005a6303d7 SNATCHER: fix engine reset
6670af18fd SNATCHER: remove debug artefacts
ae3a3bbddd SNATCHER: remove unused code
797a27b619 SNATCHER: add safety checks for script and resource reads
5815b8e102 SNATCHER: fix warnings
e68ee254c2 SNATCHER: more cleanup
4fc7773964 SNATCHER: fix component deps
400d6e6c0f SNATCHER: add more mem address labels
e4015eb7c4 SNATCHER: add more data to savegames to avoid glitches
d07e5b750b SNATCHER: (Save/Load) - restore hilite verb
ef203bb72f SNATCHER: add basic support for fan translations
44851d4c43 SNATCHER: minor cleanup and comment fixes
22fbf04914 SNATCHER: fix memory leaks
fcd6f6d4fa KYRA: (EOB/SegaCD) - fix for BE machines
6b7b3e6599 SNATCHER: clear temp buffer when loading savegames
e61201c2ba SNATCHER: (Sega Audio) - fix pcm audio regression
c60c312adb SNATCHER: (Sega Renderer) - add sanity check
88d92de841 SNATCHER: fix regression
8fff148145 KYRA: rename sega renderer class
cf23a602b0 SNATCHER: improve GMM saving/loading


Commit: 8ce700d82dd28446a4c308268f98b85c5b3bf32b
    https://github.com/scummvm/scummvm/commit/8ce700d82dd28446a4c308268f98b85c5b3bf32b
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: new engine initial commit

(detection and other skeleton code, no actual game code)

Changed paths:
  A engines/snatcher/POTFILES
  A engines/snatcher/configure.engine
  A engines/snatcher/detection.cpp
  A engines/snatcher/detection.h
  A engines/snatcher/detection_tables.h
  A engines/snatcher/graphics.cpp
  A engines/snatcher/graphics.h
  A engines/snatcher/metaengine.cpp
  A engines/snatcher/module.mk
  A engines/snatcher/render.h
  A engines/snatcher/render_scd.cpp
  A engines/snatcher/resource.cpp
  A engines/snatcher/resource.h
  A engines/snatcher/snatcher.cpp
  A engines/snatcher/snatcher.h
  A engines/snatcher/sound.cpp
  A engines/snatcher/sound.h
  A engines/snatcher/sound_device.h
  A engines/snatcher/sound_device_null.cpp
  A engines/snatcher/sound_device_scd.cpp


diff --git a/engines/snatcher/POTFILES b/engines/snatcher/POTFILES
new file mode 100644
index 00000000000..1b090beb384
--- /dev/null
+++ b/engines/snatcher/POTFILES
@@ -0,0 +1,2 @@
+engines/snatcher/detection.cpp
+
diff --git a/engines/snatcher/configure.engine b/engines/snatcher/configure.engine
new file mode 100644
index 00000000000..ad1b48f45de
--- /dev/null
+++ b/engines/snatcher/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine snatcher "Snatcher" no
diff --git a/engines/snatcher/detection.cpp b/engines/snatcher/detection.cpp
new file mode 100644
index 00000000000..f3e3710a89d
--- /dev/null
+++ b/engines/snatcher/detection.cpp
@@ -0,0 +1,51 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "common/translation.h"
+#include "engines/advancedDetector.h"
+#include "base/plugins.h"
+#include "audio/mididrv.h"
+
+#include "snatcher/detection.h"
+#include "snatcher/detection_tables.h"
+
+class SnatcherMetaEngineDetection : public AdvancedMetaEngineDetection<SnatcherGameDescription> {
+public:
+	SnatcherMetaEngineDetection() : AdvancedMetaEngineDetection(adGameDescs, gameList) {
+		_md5Bytes = 1024 * 1024;
+		_maxScanDepth = 2;
+		_directoryGlobs = 0;
+	}
+
+	const char *getName() const override {
+		return "snatcher";
+	}
+
+	const char *getEngineName() const override {
+		return "snatcher";
+	}
+
+	const char *getOriginalCopyright() const override {
+		return "Snatcher (C) Konami";
+	}
+};
+
+REGISTER_PLUGIN_STATIC(SNATCHER_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, SnatcherMetaEngineDetection);
diff --git a/engines/snatcher/detection.h b/engines/snatcher/detection.h
new file mode 100644
index 00000000000..a75ed8edd52
--- /dev/null
+++ b/engines/snatcher/detection.h
@@ -0,0 +1,57 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_DETECTION_H
+#define SNATCHER_DETECTION_H
+
+#include "engines/advancedDetector.h"
+
+namespace Snatcher {
+
+enum {
+	GI_SNATCHER = 0
+};
+
+struct GameDescription {
+	byte gameID;
+	int soundOptions;
+	Common::Language lang;
+	Common::Platform platform;
+
+	// language overwrites of fan translations (only needed for multilingual games)
+	Common::Language fanLang;
+	Common::Language replacedLang;
+	
+};
+
+} // End of namespace Snatcher
+
+namespace {
+
+struct SnatcherGameDescription {
+	AD_GAME_DESCRIPTION_HELPERS(ad_desc);
+	ADGameDescription ad_desc;
+	Snatcher::GameDescription ex_desc;
+};
+
+} // End of anonymous namespace
+
+#endif // SNATCHER_DETECTION_H
diff --git a/engines/snatcher/detection_tables.h b/engines/snatcher/detection_tables.h
new file mode 100644
index 00000000000..c770a0d70d1
--- /dev/null
+++ b/engines/snatcher/detection_tables.h
@@ -0,0 +1,52 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+namespace {
+
+#define FLAGS(id, sound) { id, sound, Common::UNK_LANG, Common::kPlatformUnknown, Common::UNK_LANG, Common::UNK_LANG }
+#define FLAGS_FAN(id, sound, fanLang, repLang) { id, sound, Common::UNK_LANG, Common::kPlatformUnknown, fanLang, repLang }
+
+#define SNATCHER_FLAGS(sound) FLAGS(Snatcher::GI_SNATCHER, sound)
+
+const SnatcherGameDescription adGameDescs[] = {
+	{
+		{
+			"snatcher",
+			0,
+			AD_ENTRY2s(	"DATA_B0.BIN",	"63170d11da5ebc3a66ecf0fc2d23e78a", 24176,
+						"DATA_J0.BIN",	"4cd2c1d16b116c1cf1f38f8114c9c2ff", 43004),
+			Common::EN_ANY,
+			Common::kPlatformSegaCD,
+			ADGF_TESTING,
+			GUIO2(GUIO_NOSPEECHVOLUME, GUIO_MIDISEGACD)
+		},
+		SNATCHER_FLAGS(MDT_SEGACD)
+	},
+
+	{ AD_TABLE_END_MARKER, FLAGS(0, MDT_NONE) }
+};
+
+const PlainGameDescriptor gameList[] = {
+	{ "snatcher", "Snatcher" },
+	{ 0, 0 }
+};
+
+} // End of anonymous namespace
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
new file mode 100644
index 00000000000..4c7a128930f
--- /dev/null
+++ b/engines/snatcher/graphics.cpp
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "snatcher/render.h"
+#include "snatcher/graphics.h"
+
+namespace Snatcher {
+
+GraphicsEngine::GraphicsEngine(Common::Platform platform) : _renderer(0) {
+	_renderer = Renderer::create(platform);
+	assert(_renderer);
+}
+
+GraphicsEngine::~GraphicsEngine() {
+	delete _renderer;
+}
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
new file mode 100644
index 00000000000..52d27219107
--- /dev/null
+++ b/engines/snatcher/graphics.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_GRAPHICS_H
+#define SNATCHER_GRAPHICS_H
+
+#include "common/platform.h"
+
+namespace Snatcher {
+
+class Renderer;
+
+class GraphicsEngine {
+public:
+	GraphicsEngine(Common::Platform platform);
+	~GraphicsEngine();
+
+private:
+	Renderer *_renderer;
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_GRAPHICS_H
diff --git a/engines/snatcher/metaengine.cpp b/engines/snatcher/metaengine.cpp
new file mode 100644
index 00000000000..c0e336b0694
--- /dev/null
+++ b/engines/snatcher/metaengine.cpp
@@ -0,0 +1,200 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "snatcher/detection.h"
+#include "snatcher/snatcher.h"
+#include "common/config-manager.h"
+#include "common/system.h"
+#include "common/savefile.h"
+/*#include "common/translation.h"*/
+
+#include "engines/advancedDetector.h"
+
+#include "base/plugins.h"
+
+
+const ADExtraGuiOptionsMap gameGuiOptions[] = {
+	AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
+class SnatcherMetaEngine : public AdvancedMetaEngine<SnatcherGameDescription> {
+public:
+    const char *getName() const override {
+		return "snatcher";
+	}
+
+	const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
+    bool hasFeature(MetaEngineFeature f) const override;
+	Common::Error createInstance(OSystem *syst, Engine **engine, const SnatcherGameDescription *desc) const override;
+
+	SaveStateList listSaves(const char *target) const override;
+	int getMaximumSaveSlot() const override;
+	bool removeSaveState(const char *target, int slot) const override;
+	SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
+	virtual int getAutosaveSlot() const override { return 999; }
+
+	Common::KeymapArray initKeymaps(const char *target) const override;
+};
+
+const ADExtraGuiOptionsMap *SnatcherMetaEngine::getAdvancedExtraGuiOptions() const {
+	return gameGuiOptions;
+}
+
+bool SnatcherMetaEngine::hasFeature(MetaEngineFeature f) const {
+	return
+	    (f == kSupportsListSaves) ||
+	    (f == kSupportsLoadingDuringStartup) ||
+	    (f == kSupportsDeleteSave) ||
+	    (f == kSavesSupportMetaInfo) ||
+	    (f == kSavesSupportThumbnail) ||
+		(f == kSimpleSavesNames);
+}
+
+bool Snatcher::SnatcherEngine::hasFeature(EngineFeature f) const {
+	return
+	    (f == kSupportsReturnToLauncher) ||
+	    (f == kSupportsLoadingDuringRuntime) ||
+	    (f == kSupportsSavingDuringRuntime) ||
+	    (f == kSupportsSubtitleOptions);
+}
+
+Common::Error SnatcherMetaEngine::createInstance(OSystem *syst, Engine **engine, const SnatcherGameDescription *desc) const {
+	const SnatcherGameDescription *gd = (const SnatcherGameDescription*)desc;
+	Snatcher::GameDescription dsc = gd->ex_desc;
+
+	Common::Platform platform = Common::parsePlatform(ConfMan.get("platform"));
+	if (platform != Common::kPlatformUnknown)
+		dsc.platform = platform;
+
+	if (dsc.lang == Common::UNK_LANG) {
+		Common::Language lang = Common::parseLanguage(ConfMan.get("language"));
+		if (lang != Common::UNK_LANG)
+			dsc.lang = lang;
+		else
+			dsc.lang = Common::EN_ANY;
+	}
+
+	switch (dsc.gameID) {
+	case Snatcher::GI_SNATCHER:
+		*engine = new Snatcher::SnatcherEngine(syst, dsc);
+		break;
+	default:
+		return Common::kUnsupportedGameidError;
+	}
+
+	return Common::kNoError;
+}
+
+SaveStateList SnatcherMetaEngine::listSaves(const char *target) const {
+	/*Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+	Snatcher::SnatcherEngine::SaveHeader header;
+	Common::String pattern = target;
+	pattern += ".###";
+
+	Common::StringArray filenames;
+	filenames = saveFileMan->listSavefiles(pattern);
+	*/
+	SaveStateList saveList;
+	/*for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
+		// Obtain the last 3 digits of the filename, since they correspond to the save slot
+		int slotNum = atoi(file->c_str() + file->size() - 3);
+
+		if (slotNum >= 0 && slotNum <= 999) {
+			Common::InSaveFile *in = saveFileMan->openForLoading(*file);
+			if (in) {
+				if (Kyra::KyraEngine_v1::readSaveHeader(in, header) == Kyra::KyraEngine_v1::kRSHENoError) {
+					// WORKAROUND: Old savegames are using 'German' as description for kyra3 restart game save (slot 0),
+					// since that looks odd we replace it by "New Game".
+					if (slotNum == 0 && header.gameID == Kyra::GI_KYRA3)
+						header.description = "New Game";
+
+					saveList.push_back(SaveStateDescriptor(slotNum, header.description));
+				}
+				delete in;
+			}
+		}
+	}*/
+
+	// Sort saves based on slot number.
+	Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
+	return saveList;
+}
+
+int SnatcherMetaEngine::getMaximumSaveSlot() const {
+	return 999;
+}
+
+bool SnatcherMetaEngine::removeSaveState(const char *target, int slot) const {
+	//Common::String filename = Snatcher::SnatcherEngine::getSavegameFilename(target, slot);
+	//g_system->getSavefileManager()->removeSavefile(filename);
+	return true;
+}
+
+SaveStateDescriptor SnatcherMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+	/*Common::String filename = Snatcher::SnatcherEngine::getSavegameFilename(target, slot);
+	Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename);
+	const bool nonKyraGame = ConfMan.getDomain(target)->getVal("gameid").equalsIgnoreCase("lol") || ConfMan.getDomain(target)->getVal("gameid").equalsIgnoreCase("eob") || ConfMan.getDomain(target)->getVal("gameid").equalsIgnoreCase("eob2");
+
+	if (in) {
+		Kyra::KyraEngine_v1::SaveHeader header;
+		Kyra::KyraEngine_v1::ReadSaveHeaderError error;
+
+		error = Kyra::KyraEngine_v1::readSaveHeader(in, header, false);
+		delete in;
+
+		if (error == Kyra::KyraEngine_v1::kRSHENoError) {
+			SaveStateDescriptor desc(slot, header.description);
+
+			// Slot 0 is used for the 'restart game' save in all three Kyrandia games, thus
+			// we prevent it from being deleted.
+			desc.setDeletableFlag(slot != 0 || nonKyraGame);
+
+			// We don't allow quick saves (slot 990 till 998) to be overwritten.
+			// The same goes for the 'Autosave', which is slot 999. Slot 0 will also
+			// be protected in Kyra 1-3, since it's the 'restart game' save.
+			desc.setWriteProtectedFlag((slot == 0 && !nonKyraGame) || slot >= 990);
+			desc.setThumbnail(header.thumbnail);
+
+			return desc;
+		}
+	}*/
+
+	SaveStateDescriptor desc(this, slot, Common::String());
+
+	// We don't allow quick saves (slot 990 till 998) to be overwritten.
+	// The same goes for the 'Autosave', which is slot 999. Slot 0 will also
+	// be protected in Kyra 1-3, since it's the 'restart game' save.
+
+
+	//desc.setWriteProtectedFlag((slot == 0 && !nonKyraGame) || slot >= 990);
+
+	return desc;
+}
+
+Common::KeymapArray SnatcherMetaEngine::initKeymaps(const char *target) const {
+	return AdvancedMetaEngine::initKeymaps(target);
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(SNATCHER)
+	REGISTER_PLUGIN_DYNAMIC(SNATCHER, PLUGIN_TYPE_ENGINE, SnatcherMetaEngine);
+#else
+	REGISTER_PLUGIN_STATIC(SNATCHER, PLUGIN_TYPE_ENGINE, SnatcherMetaEngine);
+#endif
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
new file mode 100644
index 00000000000..fdce0b469e6
--- /dev/null
+++ b/engines/snatcher/module.mk
@@ -0,0 +1,22 @@
+MODULE := engines/snatcher
+
+MODULE_OBJS := \
+	graphics.o \
+	metaengine.o \
+	render_scd.o \
+	resource.o \
+	snatcher.o \
+	sound.o \
+	sound_device_null.o \
+	sound_device_scd.o
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_SNATCHER), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
+
+# Detection objects
+DETECT_OBJS += $(MODULE)/detection.o
diff --git a/engines/snatcher/render.h b/engines/snatcher/render.h
new file mode 100644
index 00000000000..538282a7249
--- /dev/null
+++ b/engines/snatcher/render.h
@@ -0,0 +1,53 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_RENDER_H
+#define SNATCHER_RENDER_H
+
+#include "common/platform.h"
+
+namespace Snatcher {
+
+class Renderer {
+public:
+	virtual ~Renderer() {}
+
+protected:
+	Renderer() {}
+
+private:
+	static Renderer *createSegaRenderer();
+
+public:
+	static Renderer *create(Common::Platform platform) {
+		switch (platform) {
+		case Common::kPlatformSegaCD:
+			return createSegaRenderer();
+		default:
+			break;
+		};
+		return 0;
+	}
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_RENDER_H
diff --git a/engines/snatcher/render_scd.cpp b/engines/snatcher/render_scd.cpp
new file mode 100644
index 00000000000..c2c4c8014f2
--- /dev/null
+++ b/engines/snatcher/render_scd.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "snatcher/render.h"
+
+namespace Snatcher {
+
+class SegaRenderer : public Renderer {
+public:
+	SegaRenderer() : Renderer() {}
+	~SegaRenderer() override {}
+private:
+};
+
+Renderer *Renderer::createSegaRenderer() {
+	return new SegaRenderer();
+}
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
new file mode 100644
index 00000000000..12930a926fe
--- /dev/null
+++ b/engines/snatcher/resource.cpp
@@ -0,0 +1,28 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "snatcher/resource.h"
+
+namespace Snatcher {
+
+///
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
new file mode 100644
index 00000000000..3b5544c1a7c
--- /dev/null
+++ b/engines/snatcher/resource.h
@@ -0,0 +1,31 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_RESOURCE_H
+#define SNATCHER_RESOURCE_H
+
+namespace Snatcher {
+
+///
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_RESOURCE_H
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
new file mode 100644
index 00000000000..f7c9e6887e6
--- /dev/null
+++ b/engines/snatcher/snatcher.cpp
@@ -0,0 +1,83 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "snatcher/graphics.h"
+#include "snatcher/snatcher.h"
+#include "snatcher/sound.h"
+#include "common/error.h"
+
+namespace Snatcher {
+
+SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _gfx(0), _snd(0) {
+
+}
+
+SnatcherEngine::~SnatcherEngine() {
+	delete _gfx;
+	delete _snd;
+}
+
+Common::Error SnatcherEngine::run() {
+	registerDefaultSettings();
+
+	if (!initResource())
+		return Common::Error(Common::kReadingFailed);
+
+	if (!initSound(_game.platform, _game.soundOptions))
+		return Common::Error(Common::kAudioDeviceInitFailed);
+
+	if (!initGraphics(_game.platform))
+		return Common::Error(Common::kUnknownError);
+
+	return Common::Error(start() ? Common::kNoError : Common::kUnknownError);
+}
+
+bool SnatcherEngine::initResource() {
+	return true;
+}
+
+bool SnatcherEngine::initGraphics(Common::Platform platform) {
+	_gfx = new GraphicsEngine(platform);
+	return _gfx;
+}
+
+bool SnatcherEngine::initSound(Common::Platform platform, int soundOptions) {
+	_snd = new SoundEngine(platform, soundOptions);
+	return _snd;
+}
+
+bool SnatcherEngine::start() {
+	return true;
+}
+
+void SnatcherEngine::registerDefaultSettings() {
+	//ConfMan.registerDefault("cdaudio", true);
+}
+
+void SnatcherEngine::syncSoundSettings() {
+
+}
+
+void SnatcherEngine::pauseEngineIntern(bool pause) {
+
+}
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
new file mode 100644
index 00000000000..c53b527fca4
--- /dev/null
+++ b/engines/snatcher/snatcher.h
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_H
+#define SNATCHER_H
+
+#include "snatcher/detection.h"
+
+#include "engines/engine.h"
+
+class SnatcherMetaEngine;
+
+namespace Snatcher {
+
+class GraphicsEngine;
+class SoundEngine;
+
+class SnatcherEngine : public Engine {
+public:
+	SnatcherEngine(OSystem *system, GameDescription &dsc);
+	~SnatcherEngine() override;
+
+private:
+	// Startup
+	Common::Error run() override;
+	bool initResource();
+	bool initGraphics(Common::Platform platform);
+	bool initSound(Common::Platform platform, int soundOptions);
+	bool start();	
+
+	// ConfigManager sync
+	void registerDefaultSettings();
+	void syncSoundSettings() override;
+
+	// GMM
+	void pauseEngineIntern(bool pause) override;
+
+	// MetaEngine
+	bool hasFeature(EngineFeature f) const override;
+	GameDescription _game;
+
+	// Graphics
+	GraphicsEngine *_gfx;
+
+	// Sound
+	SoundEngine *_snd;
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_H
diff --git a/engines/snatcher/sound.cpp b/engines/snatcher/sound.cpp
new file mode 100644
index 00000000000..ab1ee22c106
--- /dev/null
+++ b/engines/snatcher/sound.cpp
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "snatcher/sound_device.h"
+#include "snatcher/sound.h"
+
+namespace Snatcher {
+
+SoundEngine::SoundEngine(Common::Platform platform, int soundOptions) : _dev(0) {
+	_dev = SoundDevice::create(platform, soundOptions);
+	assert(_dev);
+}
+
+SoundEngine::~SoundEngine() {
+	delete _dev;
+}
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/sound.h b/engines/snatcher/sound.h
new file mode 100644
index 00000000000..f9eabcdc84b
--- /dev/null
+++ b/engines/snatcher/sound.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_SOUND_H
+#define SNATCHER_SOUND_H
+
+#include "common/platform.h"
+
+namespace Snatcher {
+
+class SoundDevice;
+
+class SoundEngine {
+public:
+	SoundEngine(Common::Platform platform, int soundOptions);
+	~SoundEngine();
+
+private:
+	SoundDevice *_dev;
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_SOUND_H
diff --git a/engines/snatcher/sound_device.h b/engines/snatcher/sound_device.h
new file mode 100644
index 00000000000..65279e073af
--- /dev/null
+++ b/engines/snatcher/sound_device.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_SOUND_DEVICE_H
+#define SNATCHER_SOUND_DEVICE_H
+
+#include "audio//mididrv.h"
+#include "common/platform.h"
+
+namespace Snatcher {
+
+class SoundDevice {
+public:
+	virtual ~SoundDevice() {}
+
+protected:
+	SoundDevice() {}
+
+private:
+	static SoundDevice *createNullSoundDevice();
+	static SoundDevice *createSegaSoundDevice();
+
+public:
+	static SoundDevice *create(Common::Platform platform, int soundOptions) {
+		MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(soundOptions);
+		MusicType musicType = MidiDriver::getMusicType(dev);
+
+		if (musicType == MT_INVALID || musicType == MT_NULL)
+			return createNullSoundDevice();
+
+		switch (platform) {
+		case Common::kPlatformSegaCD:
+			return createSegaSoundDevice();
+		default:
+			break;
+		};
+
+		return 0;
+	}
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_SOUND_DEVICE_H
diff --git a/engines/snatcher/sound_device_null.cpp b/engines/snatcher/sound_device_null.cpp
new file mode 100644
index 00000000000..df95cc239d6
--- /dev/null
+++ b/engines/snatcher/sound_device_null.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "snatcher/sound_device.h"
+
+namespace Snatcher {
+
+class NullSoundDevice : public SoundDevice {
+public:
+	NullSoundDevice() : SoundDevice() {}
+	~NullSoundDevice() override {}
+private:
+};
+
+SoundDevice *SoundDevice::createNullSoundDevice() {
+	return new NullSoundDevice();
+}
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
new file mode 100644
index 00000000000..5641f35d742
--- /dev/null
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -0,0 +1,37 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "snatcher/sound_device.h"
+
+namespace Snatcher {
+
+class SegaSoundDevice : public SoundDevice {
+public:
+	SegaSoundDevice() : SoundDevice() {}
+	~SegaSoundDevice() override {}
+private:
+};
+
+SoundDevice *SoundDevice::createSegaSoundDevice() {
+	return new SegaSoundDevice();
+}
+
+} // End of namespace Snatcher


Commit: 75eda5289206161171ef353ab80173027d962165
    https://github.com/scummvm/scummvm/commit/75eda5289206161171ef353ab80173027d962165
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
GRAPHICS: SegaCD rendering code - refactor and move to Common

(make it available for other engines)

Changed paths:
  A graphics/segagfx.cpp
  A graphics/segagfx.h
    engines/kyra/engine/chargen.cpp
    engines/kyra/engine/eob.cpp
    engines/kyra/graphics/screen_eob.h
    engines/kyra/graphics/screen_eob_segacd.cpp
    engines/kyra/graphics/screen_eob_segacd.h
    engines/kyra/gui/gui_eob.cpp
    engines/kyra/gui/gui_eob_segacd.cpp
    engines/kyra/sequence/seqplayer_eob_segacd.cpp
    engines/kyra/sequence/seqplayer_eob_segacd.h
    engines/kyra/sequence/sequences_eob.cpp
    engines/kyra/text/text_eob_segacd.cpp
    engines/kyra/text/text_eob_segacd.h
    engines/snatcher/render_scd.cpp
    graphics/module.mk


diff --git a/engines/kyra/engine/chargen.cpp b/engines/kyra/engine/chargen.cpp
index ebe09ef37c1..e746e23e787 100644
--- a/engines/kyra/engine/chargen.cpp
+++ b/engines/kyra/engine/chargen.cpp
@@ -313,7 +313,7 @@ void CharacterGenerator::init(bool defaultParty) {
 		_screen->sega_getRenderer()->loadToVRAM(&cgb[0x21E0], 0x1400, 0x8220);
 		for (int i = 0; i < 10; i++)
 			_screen->sega_getRenderer()->fillRectWithTiles(1, i << 2, 0, 4, 4, 0x4411 + (i << 4), true);
-		_screen->sega_getRenderer()->render(2);
+		_screen->sega_getRenderer()->renderToPage(2);
 		_screen->_curPage = 2;
 		_chargenMagicShapes = new uint8*[10];
 		for (int i = 0; i < 10; i++)
@@ -327,7 +327,7 @@ void CharacterGenerator::init(bool defaultParty) {
 		_screen->sega_getRenderer()->fillRectWithTiles(0, 0, 0, 40, 28, 0);
 		_screen->sega_getRenderer()->fillRectWithTiles(1, 0, 0, 40, 28, 0);
 		_screen->sega_getRenderer()->fillRectWithTiles(1, 0, 0, 40, 26, 1, true);
-		_screen->sega_getRenderer()->render(0);
+		_screen->sega_getRenderer()->renderToPage(0);
 
 		for (int i = 0; i < 4; ++i)
 			_screen->copyRegion(_chargenBoxX[i], _chargenBoxY[i] + 1, i << 5, 128, 32, 32, 0, 2, Screen::CR_NO_P_CHECK);
@@ -570,7 +570,7 @@ void CharacterGenerator::checkForCompleteParty() {
 
 	if (_vm->gameFlags().platform == Common::kPlatformSegaCD) {
 		_screen->setFontStyles(_screen->_currentFont, cs);
-		_screen->sega_getRenderer()->render(0, 18, 8, 20, 16);
+		_screen->sega_getRenderer()->renderToPage(0, 18, 8, 20, 16);
 	}
 
 	_screen->updateScreen();
@@ -589,13 +589,13 @@ void CharacterGenerator::drawButton(int index, int buttonState) {
 				// since it seems weird to have the button still there, even when it is dysfunctional.
 				_screen->sega_getRenderer()->fillRectWithTiles(0, 3, 23, 11, 1, 0x39C, true);
 				_screen->sega_getRenderer()->fillRectWithTiles(0, 3, 24, 11, 1, 0x3C4, true);
-				_screen->sega_getRenderer()->render(0, 3, 23, 11, 2);
+				_screen->sega_getRenderer()->renderToPage(0, 3, 23, 11, 2);
 			}
 			return;
 		}
 		const uint8 *bt = &_chargenSegaButtonCoords[index * 5];
 		_screen->sega_getRenderer()->fillRectWithTiles(0, bt[0], bt[1], bt[2], bt[3], (index > 9 ? 0x24BC : 0x2411) + bt[4] + (buttonState ? (bt[2] * bt[3]) : 0), true);
-		_screen->sega_getRenderer()->render(0, bt[0], bt[1], bt[2], bt[3]);
+		_screen->sega_getRenderer()->renderToPage(0, bt[0], bt[1], bt[2], bt[3]);
 		if (buttonState)
 			_screen->updateScreen();
 		return;
@@ -694,7 +694,7 @@ int CharacterGenerator::viewDeleteCharacter() {
 					_characters[_activeBox].faceShape = 0;
 					if (_vm->_flags.platform == Common::kPlatformSegaCD) {
 						_screen->sega_getRenderer()->memsetVRAM((((_chargenBoxY[_activeBox] + 41) >> 3) * 40 + (_chargenBoxX[_activeBox] >> 3)) << 5, 0, 224);
-						_screen->sega_getRenderer()->render(0, (_chargenBoxX[_activeBox] >> 3) - 1, (_chargenBoxY[_activeBox] + 41) >> 3, 7, 1);
+						_screen->sega_getRenderer()->renderToPage(0, (_chargenBoxX[_activeBox] >> 3) - 1, (_chargenBoxY[_activeBox] + 41) >> 3, 7, 1);
 					} else {
 						processNameInput(_activeBox, _vm->guiSettings()->colors.guiColorBlack);
 					}
@@ -764,7 +764,7 @@ void CharacterGenerator::createPartyMember() {
 			if (_vm->gameFlags().platform == Common::kPlatformSegaCD) {
 				_screen->sega_loadTextBackground(_wndBackgrnd, 10240);
 				_vm->_txt->printShadedText(_chargenStrings2[11], 0, 0);
-				_screen->sega_getRenderer()->render(0, 18, 8, 20, 2);
+				_screen->sega_getRenderer()->renderToPage(0, 18, 8, 20, 2);
 				if (!_vm->shouldQuit())
 					_vm->_gui->getTextInput(_characters[_activeBox].name, (_chargenBoxX[_activeBox] >> 3) - 1, _chargenBoxY[_activeBox] + 41, 7, 0xFF, 0x00, 0xFF);
 			} else {
@@ -804,7 +804,7 @@ int CharacterGenerator::raceSexMenu() {
 
 	_vm->_gui->simpleMenu_setup(1, 0, _chargenRaceSexStrings, -1, 0, 0, _menuColor1, _menuColor2, _menuColor3);
 	if (_vm->_flags.platform == Common::kPlatformSegaCD)
-		_screen->sega_getRenderer()->render(0, 18, 8, 20, 16);
+		_screen->sega_getRenderer()->renderToPage(0, 18, 8, 20, 16);
 	_screen->updateScreen();
 	int16 res = -1;
 
@@ -812,7 +812,7 @@ int CharacterGenerator::raceSexMenu() {
 		uint32 frameEnd = _vm->_system->getMillis() + 8;
 		res = _vm->_gui->simpleMenu_process(1, _chargenRaceSexStrings, 0, -1, 0);
 		if (_vm->_flags.platform == Common::kPlatformSegaCD)
-			_screen->sega_getRenderer()->render(0, 18, 8, 20, 16);
+			_screen->sega_getRenderer()->renderToPage(0, 18, 8, 20, 16);
 		_screen->updateScreen();
 		updateMagicShapes();
 		_vm->delayUntil(frameEnd);
@@ -850,7 +850,7 @@ int CharacterGenerator::classMenu(int raceSex) {
 	itemsMask &= _classMenuMasks[raceSex / 2];
 	_vm->_gui->simpleMenu_setup(2, 15, _chargenClassStrings, itemsMask, 0, 0, _menuColor1, _menuColor2, _menuColor3);
 	if (_vm->_flags.platform == Common::kPlatformSegaCD)
-		_screen->sega_getRenderer()->render(0, 18, 8, 20, 16);
+		_screen->sega_getRenderer()->renderToPage(0, 18, 8, 20, 16);
 	_screen->updateScreen();
 
 	_vm->_mouseX = _vm->_mouseY = 0;
@@ -880,7 +880,7 @@ int CharacterGenerator::classMenu(int raceSex) {
 		} else {
 			res = _vm->_gui->simpleMenu_process(2, _chargenClassStrings, 0, itemsMask, 0);
 			if (_vm->_flags.platform == Common::kPlatformSegaCD) {
-				_screen->sega_getRenderer()->render(0, 18, 8, 20, 16);
+				_screen->sega_getRenderer()->renderToPage(0, 18, 8, 20, 16);
 			} else if (backBtnHiLite) {
 				drawButton(5, 0);
 				backBtnHiLite = false;
@@ -926,7 +926,7 @@ int CharacterGenerator::alignmentMenu(int cClass) {
 	itemsMask &= _alignmentMenuMasks[cClass];
 	_vm->_gui->simpleMenu_setup(3, 9, _chargenAlignmentStrings, itemsMask, 0, 0, _menuColor1, _menuColor2, _menuColor3);
 	if (_vm->_flags.platform == Common::kPlatformSegaCD)
-		_screen->sega_getRenderer()->render(0, 18, 8, 20, 16);
+		_screen->sega_getRenderer()->renderToPage(0, 18, 8, 20, 16);
 	_screen->updateScreen();
 
 	_vm->_mouseX = _vm->_mouseY = 0;
@@ -956,7 +956,7 @@ int CharacterGenerator::alignmentMenu(int cClass) {
 		} else {
 			res = _vm->_gui->simpleMenu_process(3, _chargenAlignmentStrings, 0, itemsMask, 0);
 			if (_vm->_flags.platform == Common::kPlatformSegaCD) {
-				_screen->sega_getRenderer()->render(0, 18, 9, 20, 16);
+				_screen->sega_getRenderer()->renderToPage(0, 18, 9, 20, 16);
 			} else if (backBtnHiLite) {
 				drawButton(5, 0);
 				backBtnHiLite = false;
@@ -1344,7 +1344,7 @@ void CharacterGenerator::printStats(int index, int mode) {
 	}
 
 	if (_vm->_flags.platform == Common::kPlatformSegaCD) {
-		_screen->sega_getRenderer()->render(0, 18, 8, 20, 16);
+		_screen->sega_getRenderer()->renderToPage(0, 18, 8, 20, 16);
 		if (mode != 4)
 			_screen->drawShape(0, c->faceShape, 208, 66, 0);
 	} else
@@ -1422,7 +1422,7 @@ int CharacterGenerator::modifyStat(int index, int8 *stat1, int8 *stat2) {
 	if (_vm->_flags.platform == Common::kPlatformSegaCD) {
 		Common::String statStr = index ? Common::String::format("%02d", *s1) : _vm->getCharStrength(*s1, *s2, true);
 		_vm->_txt->printShadedText(statStr.c_str(), b->x - 112, b->y - 64, 0x55);
-		_screen->sega_getRenderer()->render(0, (b->x + 32) >> 3, b->y >> 3, 5, 1);
+		_screen->sega_getRenderer()->renderToPage(0, (b->x + 32) >> 3, b->y >> 3, 5, 1);
 	} else if (_vm->game() == GI_EOB2 && _vm->gameFlags().lang == Common::Language::ZH_TWN) {
 		_screen->setFont(Screen::FID_8_FNT);
 		Common::String statStr = index ? Common::String::format("%d", *s1) : _vm->getCharStrength(*s1, *s2);
@@ -1530,7 +1530,7 @@ int CharacterGenerator::modifyStat(int index, int8 *stat1, int8 *stat2) {
 			Common::String statStr = index ? Common::String::format("%02d", *s1) : _vm->getCharStrength(*s1, *s2, true);
 			printStats(_activeBox, 3);
 			_vm->_txt->printShadedText(statStr.c_str(), b->x - 112, b->y - 64, 0x55);
-			_screen->sega_getRenderer()->render(0, (b->x + 32) >> 3, b->y >> 3, 5, 1);
+			_screen->sega_getRenderer()->renderToPage(0, (b->x + 32) >> 3, b->y >> 3, 5, 1);
 		} else if (_vm->game() == GI_EOB2 && _vm->gameFlags().lang == Common::Language::ZH_TWN) {
 			Common::String statStr = index ? Common::String::format("%d", *s1) : _vm->getCharStrength(*s1, *s2);
 			_screen->copyRegion(b->x - 115, b->y - 63, b->x + 29, b->y + 1, index == 6 ? 20 : 40, 13, 2, 0, Screen::CR_NO_P_CHECK);
diff --git a/engines/kyra/engine/eob.cpp b/engines/kyra/engine/eob.cpp
index 32812176e23..5fcb602be5c 100644
--- a/engines/kyra/engine/eob.cpp
+++ b/engines/kyra/engine/eob.cpp
@@ -184,7 +184,7 @@ Common::Error EoBEngine::init() {
 	const uint8 **shapeBuffer = new const uint8*[numSprites]; \
 	_screen->sega_encodeShapesFromSprites(shapeBuffer, in + (resOffset), numSprites, spriteWidth, spriteHeight, 3, false); \
 	releaseShpArr(shapeBuffer, numSprites); \
-	_screen->sega_getRenderer()->render(Screen_EoB::kSegaInitShapesPage, -1, -1, -1, -1, true); \
+	_screen->sega_getRenderer()->renderToPage(Screen_EoB::kSegaInitShapesPage, -1, -1, -1, -1, true); \
 	_screen->sega_getAnimator()->clearSprites(); \
 	int cp = _screen->setCurPage(Screen_EoB::kSegaInitShapesPage); \
 	singleShape = _screen->encodeShape(0, 0, numSprites  * (spriteWidth >> 3), spriteHeight); \
@@ -260,7 +260,7 @@ void EoBEngine::loadItemsAndDecorationsShapes() {
 	for (int i = 0; i < 4; ++i)
 		_screen->sega_getRenderer()->loadToVRAM(_redGridTile, 8, 0x52A0 + i * 8);
 	_screen->sega_getRenderer()->fillRectWithTiles(1, 0, 4, 4, 4, 0x6295);
-	_screen->sega_getRenderer()->render(Screen_EoB::kSegaInitShapesPage, 0, 4, 4, 4);
+	_screen->sega_getRenderer()->renderToPage(Screen_EoB::kSegaInitShapesPage, 0, 4, 4, 4);
 	_screen->drawShape(Screen_EoB::kSegaInitShapesPage, _weaponSlotShapes[1], 0, 0, 0);
 	_screen->drawShape(Screen_EoB::kSegaInitShapesPage, _weaponSlotShapes[1], 0, 16, 0);
 	_weaponSlotGrid = _screen->encodeShape(0, 0, 4, 16);
@@ -1046,7 +1046,7 @@ void EoBEngine::displayParchment(int id) {
 		gui_drawCharPortraitWithStats(i);
 	}
 
-	SegaRenderer *r = _screen->sega_getRenderer();
+	SCDRenderer *r = _screen->sega_getRenderer();
 	r->fillRectWithTiles(0, 0, 0, 40, 28, 0);
 	r->fillRectWithTiles(1, 0, 0, 40, 28, 0);
 	_screen->sega_getAnimator()->clearSprites();
@@ -1064,7 +1064,7 @@ void EoBEngine::displayParchment(int id) {
 		_txt->printShadedText(strings[curPage++], 16, 16, 0x22, 0, 208, 216, 16, false);
 		_screen->sega_loadTextBufferToVRAM(0, 0x20, 22464);
 		r->fillRectWithTiles(0, 7, 0, 26, 27, 0x4001, true);
-		r->render(0);
+		r->renderToPage(0);
 
 		_screen->sega_fadeToNeutral(1);
 
@@ -1135,7 +1135,7 @@ bool EoBEngine::checkPartyStatusExtra() {
 		snd_stopSound();
 
 		Common::SeekableReadStreamEndian *in = _res->createEndianAwareReadStream("GO");
-		SegaRenderer *r = _screen->sega_getRenderer();
+		SCDRenderer *r = _screen->sega_getRenderer();
 		r->loadStreamToVRAM(in, 0x20);
 		delete in;
 
@@ -1159,7 +1159,7 @@ bool EoBEngine::checkPartyStatusExtra() {
 		_screen->setFontStyles(_screen->_currentFont, cs);
 		_screen->sega_loadTextBufferToVRAM(0, 0xA3A0, 7296);
 		r->fillRectWithTiles(0, 1, 20, 38, 6, 0x651D, true);
-		r->render(0);
+		r->renderToPage(0);
 
 		snd_playSoundEffect(0x5086);
 
@@ -1181,7 +1181,7 @@ bool EoBEngine::checkPartyStatusExtra() {
 		for (int i = 0; i < 7; ++i)
 			_screen->sega_getAnimator()->initSprite(i, 104 + (i << 4), 80, 0x4501 + (i << 2), 5);
 		_screen->sega_getAnimator()->update();
-		r->render(0);
+		r->renderToPage(0);
 
 		_screen->sega_paletteOps(2, 0, 5);
 
diff --git a/engines/kyra/graphics/screen_eob.h b/engines/kyra/graphics/screen_eob.h
index 02529345142..895b8371933 100644
--- a/engines/kyra/graphics/screen_eob.h
+++ b/engines/kyra/graphics/screen_eob.h
@@ -31,10 +31,10 @@
 namespace Kyra {
 
 class EoBCoreEngine;
-class SegaRenderer;
+class SCDRenderer;
 class SegaAnimator;
 class Screen_EoB : public Screen {
-friend class SegaRenderer;
+friend class SCDRenderer;
 public:
 	// The purpose of this enum is to keep better track of which page is used
 	// when and for which purpose. We use the pages for more backup operations
@@ -159,7 +159,7 @@ public:
 	uint8 *sega_convertShape(const uint8 *src, int w, int h, int pal, int hOffs = 0);
 	void sega_encodeShapesFromSprites(const uint8 **dst, const uint8 *src, int numShapes, int w, int h, int pal, bool removeSprites = true);
 
-	SegaRenderer *sega_getRenderer() const { return _segaRenderer; }
+	SCDRenderer *sega_getRenderer() const { return _segaRenderer; }
 	SegaAnimator *sega_getAnimator() const { return _segaAnimator; }
 
 private:
@@ -223,7 +223,7 @@ private:
 
 	PaletteFader *_palFaders;
 	bool _specialColorReplace;
-	SegaRenderer *_segaRenderer;
+	SCDRenderer *_segaRenderer;
 	SegaAnimator *_segaAnimator;
 	uint16 _segaCurPalette[64];
 	uint16 *_segaCustomPalettes;
diff --git a/engines/kyra/graphics/screen_eob_segacd.cpp b/engines/kyra/graphics/screen_eob_segacd.cpp
index aaa28ef964e..486594dce78 100644
--- a/engines/kyra/graphics/screen_eob_segacd.cpp
+++ b/engines/kyra/graphics/screen_eob_segacd.cpp
@@ -30,13 +30,13 @@
 namespace Kyra {
 
 void Screen_EoB::sega_initGraphics() {
-	_segaRenderer = new SegaRenderer(this);
+	_segaRenderer = new SCDRenderer(this);
 	_segaRenderer->setResolution(320, 224);
-	_segaRenderer->setPlaneTableLocation(SegaRenderer::kPlaneA, 0xC000);
-	_segaRenderer->setPlaneTableLocation(SegaRenderer::kPlaneB, 0xE000);
-	_segaRenderer->setPlaneTableLocation(SegaRenderer::kWindowPlane, 0xF000);
+	_segaRenderer->setPlaneTableLocation(SCDRenderer::kPlaneA, 0xC000);
+	_segaRenderer->setPlaneTableLocation(SCDRenderer::kPlaneB, 0xE000);
+	_segaRenderer->setPlaneTableLocation(SCDRenderer::kWindowPlane, 0xF000);
 	_segaRenderer->setupPlaneAB(512, 512);
-	_segaRenderer->setupWindowPlane(0, 0, SegaRenderer::kWinToLeft, SegaRenderer::kWinToTop);
+	_segaRenderer->setupWindowPlane(0, 0, SCDRenderer::kWinToLeft, SCDRenderer::kWinToTop);
 	_segaRenderer->setHScrollTableLocation(0xD800);
 	_segaRenderer->setSpriteTableLocation(0xDC00);
 	_segaAnimator = new SegaAnimator(_segaRenderer);
@@ -343,7 +343,7 @@ void Screen_EoB::sega_encodeShapesFromSprites(const uint8 **dst, const uint8 *sr
 		}
 
 		_segaAnimator->update();
-		_segaRenderer->render(Screen_EoB::kSegaInitShapesPage, -1, -1, -1, -1, true);
+		_segaRenderer->renderToPage(Screen_EoB::kSegaInitShapesPage, -1, -1, -1, -1, true);
 
 		for (int i = l; i < s; ++i)
 			dst[i] = encodeShape((((i % 80) * w) % SCREEN_W) >> 3, ((i % 80) / (SCREEN_W / w)) * h, w >> 3, h);
@@ -360,148 +360,14 @@ void Screen_EoB::sega_encodeShapesFromSprites(const uint8 **dst, const uint8 *sr
 	setCurPage(cp);
 }
 
-#if SEGA_PERFORMANCE
-#define mRenderLineFragment(hFlip, oddStart, oddEnd, useMask, dst, mask, src, start, end, pal) \
-{ \
-	int rlfOffs = 0; \
-	if (hFlip) \
-		rlfOffs |= 4; \
-	if (oddStart) \
-		rlfOffs |= 2; \
-	if (oddEnd) \
-		rlfOffs |= 1; \
-	if (useMask) \
-		(this->*_renderLineFragmentM[rlfOffs])(dst, mask, src, start, end, pal); \
-	else \
-		(this->*_renderLineFragmentD[rlfOffs])(dst, src, start, end, pal); \
-}
-#else
-#define mRenderLineFragment(hFlip, oddStart, oddEnd, useMask, dst, mask, src, start, end, pal) \
-{ \
-	if (hFlip) \
-		renderLineFragment<true>(dst, mask, src, start, end, pal); \
-	else \
-		renderLineFragment<false>(dst, mask, src, start, end, pal); \
-}
-#endif
-
-SegaRenderer::SegaRenderer(Screen_EoB *screen) : _screen(screen), _prioChainStart(0), _prioChainEnd(0), _pitch(64), _hScrollMode(0), _hScrollTable(0), _vScrollMode(0), _spriteTable(0), _numSpritesMax(0), _spriteMask(0)
-#if SEGA_PERFORMANCE
-, _renderLineFragmentD(0), _renderLineFragmentM(0)
-#endif
-{
-	_vram = new uint8[0x10000]();
-	assert(_vram);
-	_vsram = new uint16[40]();
-	assert(_vsram);
-
-#if SEGA_PERFORMANCE
-	static const SegaRenderer::renderFuncD funcD[8] = {
-		&SegaRenderer::renderLineFragmentD<false, false, false>,
-		&SegaRenderer::renderLineFragmentD<false, false, true>,
-		&SegaRenderer::renderLineFragmentD<false, true, false>,
-		&SegaRenderer::renderLineFragmentD<false, true, true>,
-		&SegaRenderer::renderLineFragmentD<true, false, false>,
-		&SegaRenderer::renderLineFragmentD<true, false, true>,
-		&SegaRenderer::renderLineFragmentD<true, true, false>,
-		&SegaRenderer::renderLineFragmentD<true, true, true>
-	};
-
-	static const SegaRenderer::renderFuncM funcM[8] = {
-		&SegaRenderer::renderLineFragmentM<false, false, false>,
-		&SegaRenderer::renderLineFragmentM<false, false, true>,
-		&SegaRenderer::renderLineFragmentM<false, true, false>,
-		&SegaRenderer::renderLineFragmentM<false, true, true>,
-		&SegaRenderer::renderLineFragmentM<true, false, false>,
-		&SegaRenderer::renderLineFragmentM<true, false, true>,
-		&SegaRenderer::renderLineFragmentM<true, true, false>,
-		&SegaRenderer::renderLineFragmentM<true, true, true>
-	};
-
-	_renderLineFragmentD = funcD;
-	_renderLineFragmentM = funcM;
-#endif
-
+SCDRenderer::SCDRenderer(Screen_EoB *screen) : Graphics::SegaRenderer(), _screen(screen) {
 	setResolution(320, 224);
 }
 
-SegaRenderer::~SegaRenderer() {
-	delete[] _vram;
-	delete[] _vsram;
-	delete[] _spriteMask;
-}
-
-void SegaRenderer::setResolution(int w, int h) {
-	assert(w == 320 || w == 256);
-	assert(h == 224 || h == 240);
-
-	_screenW = w;
-	_screenH = h;
-	_blocksW = w >> 3;
-	_blocksH = h >> 3;
-	_numSpritesMax = w >> 2;
-
-	delete[] _spriteMask;
-	_spriteMask = new uint8[w * h]();
-	assert(_spriteMask);
-}
-
-void SegaRenderer::setPlaneTableLocation(int plane, uint16 addr) {
-	assert(plane >= kPlaneA && plane <= kWindowPlane);
-	_planes[plane].nameTable = (uint16*)(&_vram[addr]);
+SCDRenderer::~SCDRenderer() {
 }
 
-void SegaRenderer::setupPlaneAB(int pixelWidth, int pixelHeigth) {
-	for (int i = 0; i < 2; ++i) {
-		if (pixelWidth != -1)
-			_planes[i].w = pixelWidth >> 3;
-		if (pixelHeigth != -1)
-			_planes[i].h = pixelHeigth >> 3;
-		_planes[i].mod = _planes[i].h;
-		_planes[i].nameTableSize = _planes[i].w * _planes[i].h;
-	}
-}
-
-void SegaRenderer::setupWindowPlane(int blockX, int blockY, int horizontalMode, int verticalMode) {
-	if (blockX != -1)
-		_planes[kWindowPlane].blockX = horizontalMode ? blockX : 0;
-	if (blockY != -1)
-		_planes[kWindowPlane].blockY = verticalMode ? blockY : 0;
-	_planes[kWindowPlane].w = horizontalMode ? _blocksW - blockX : blockX;
-	_planes[kWindowPlane].h = verticalMode ? _blocksH - blockY : blockY;
-	_planes[kWindowPlane].mod = _planes[kWindowPlane].blockY + _planes[kWindowPlane].h;
-	_planes[kWindowPlane].nameTableSize = _planes[kWindowPlane].w * _planes[kWindowPlane].h;
-}
-
-void SegaRenderer::setHScrollTableLocation(int addr) {
-	assert(addr <= 0xFFFF);
-	_hScrollTable = (uint16*)(&_vram[addr]);
-}
-
-void SegaRenderer::setSpriteTableLocation(int addr) {
-	assert(addr <= 0xFFFF);
-	_spriteTable = (uint16*)(&_vram[addr]);
-}
-
-void SegaRenderer::setPitch(int pitch) {
-	_pitch = pitch;
-}
-
-void SegaRenderer::setHScrollMode(int mode) {
-	_hScrollMode = mode;
-}
-
-void SegaRenderer::setVScrollMode(int mode) {
-	_vScrollMode = mode;
-}
-
-void SegaRenderer::loadToVRAM(const void *data, uint16 dataSize, uint16 addr) {
-	assert(data);
-	assert(addr + dataSize <= 0x10000);
-	memcpy(_vram + addr, data, dataSize);
-}
-
-void SegaRenderer::loadStreamToVRAM(Common::SeekableReadStream *in, uint16 addr, bool compressedData) {
+void SCDRenderer::loadStreamToVRAM(Common::SeekableReadStream *in, uint16 addr, bool compressedData) {
 	assert(in);
 	uint8 *dst = _vram + addr;
 
@@ -520,12 +386,7 @@ void SegaRenderer::loadStreamToVRAM(Common::SeekableReadStream *in, uint16 addr,
 	}
 }
 
-void SegaRenderer::memsetVRAM(int addr, uint8 val, int len) {
-	assert(addr + len <= 0x10000);
-	memset(_vram + addr, val, len);
-}
-
-void SegaRenderer::fillRectWithTiles(int vramArea, int x, int y, int w, int h, uint16 nameTblEntry, bool incr, bool topToBottom, const uint16 *patternTable) {
+void SCDRenderer::fillRectWithTiles(int vramArea, int x, int y, int w, int h, uint16 nameTblEntry, bool incr, bool topToBottom, const uint16 *patternTable) {
 	uint16 addr = vramArea ? (vramArea == 1 ? 0xE000 : 0xF000) : 0xC000;
 	if (y & 0x8000) {
 		y &= ~0x8000;
@@ -583,30 +444,7 @@ void SegaRenderer::fillRectWithTiles(int vramArea, int x, int y, int w, int h, u
 	}
 }
 
-void SegaRenderer::writeUint16VSRAM(int addr, uint16 value) {
-	assert(addr < 80);
-	assert(!(addr & 1));
-	_vsram[addr >> 1] = value;
-}
-
-void SegaRenderer::writeUint8VRAM(int addr, uint8 value) {
-	assert(addr < 0x10000);
-	_vram[addr] = value;
-}
-
-void SegaRenderer::writeUint16VRAM(int addr, uint16 value) {
-	assert(addr < 0x10000);
-	*((uint16*)(_vram + addr)) = value;
-}
-
-void SegaRenderer::clearPlanes() {
-	for (int i = 0; i < 3; ++i) {
-		if (_planes[i].nameTableSize)
-			memset(_planes[i].nameTable, 0, _planes[i].nameTableSize * sizeof(uint16));
-	}
-}
-
-void SegaRenderer::render(int destPageNum, int renderBlockX, int renderBlockY, int renderBlockWidth, int renderBlockHeight, bool spritesOnly) {
+void SCDRenderer::renderToPage(int destPageNum, int renderBlockX, int renderBlockY, int renderBlockWidth, int renderBlockHeight, bool spritesOnly) {
 	if (renderBlockX == -1)
 		renderBlockX = 0;
 	if (renderBlockY == -1)
@@ -616,343 +454,12 @@ void SegaRenderer::render(int destPageNum, int renderBlockX, int renderBlockY, i
 	if (renderBlockHeight == -1)
 		renderBlockHeight = _blocksH;
 
-	uint8 *renderBuffer = _screen->getPagePtr(destPageNum);
-	// This also ensures that a dirty rect is created if necessary
-	_screen->fillRect(renderBlockX << 3, renderBlockY << 3, ((renderBlockX + renderBlockWidth) << 3) - 1, ((renderBlockY + renderBlockHeight) << 3) - 1, 0, destPageNum);
-
-	// Plane B
-	if (!spritesOnly)
-		renderPlanePart(kPlaneB, renderBuffer, renderBlockX, renderBlockY, renderBlockX + renderBlockWidth, renderBlockY + renderBlockHeight);
-
-	// Plane A (only draw if the nametable is not identical to that of plane B)
-	if (_planes[kPlaneA].nameTable != _planes[kPlaneB].nameTable && !spritesOnly) {
-		// If the window plane is active the rendering of plane A becomes more tedious because the window plane
-		// kind of replaces plane A in the space that is covered by it.
-		if (_planes[kWindowPlane].nameTableSize) {
-			SegaPlane *p = &_planes[kWindowPlane];
-			renderPlanePart(kPlaneA, renderBuffer, MAX<int>(0, renderBlockX), MAX<int>(0, renderBlockY), MIN<int>(p->blockX, renderBlockX + renderBlockWidth), MIN<int>(_blocksH, renderBlockY + renderBlockHeight));
-			renderPlanePart(kPlaneA, renderBuffer, MAX<int>(0, renderBlockX), MAX<int>(0, renderBlockY), MIN<int>(_blocksW, renderBlockX + renderBlockWidth), MIN<int>(p->blockY, renderBlockY + renderBlockHeight));
-			renderPlanePart(kPlaneA, renderBuffer, MAX<int>(p->blockX + p->w, renderBlockX), MAX<int>(0, renderBlockY), MIN<int>(_blocksW, renderBlockX + renderBlockWidth), MIN<int>(_blocksH, renderBlockY + renderBlockHeight));
-			renderPlanePart(kPlaneA, renderBuffer, MAX<int>(0, renderBlockX), MAX<int>(p->blockY + p->h, renderBlockY), MIN<int>(_blocksW, renderBlockX + renderBlockWidth), MIN<int>(_blocksH, renderBlockY + renderBlockHeight));
-		} else {
-			renderPlanePart(kPlaneA, renderBuffer, renderBlockX, renderBlockY, renderBlockX + renderBlockWidth, renderBlockY + renderBlockHeight);
-		}
-	}
-
-	// Window Plane
-	if (_planes[kWindowPlane].nameTableSize && !spritesOnly) {
-		SegaPlane *p = &_planes[kWindowPlane];
-		renderPlanePart(kWindowPlane, renderBuffer, MIN<int>(p->blockX, renderBlockX + renderBlockWidth), MIN<int>(p->blockY, renderBlockY + renderBlockHeight), MAX<int>(p->blockX + p->w, renderBlockX), MAX<int>(p->blockY + p->h, renderBlockY));
-	}
-
-	// Sprites
-	memset(_spriteMask, 0xFF, (uint32)_screenW * (uint32)_screenH * sizeof(uint8));
-	const uint16 *pos = _spriteTable;
-	for (int i = 0; i < _numSpritesMax && pos; ++i) {
-		int y = *pos++ & 0x3FF;
-		uint8 bH = ((*pos >> 8) & 3) + 1;
-		uint8 bW = ((*pos >> 10) & 3) + 1;
-		uint8 next = *pos++ & 0x7F;
-		uint16 pal = ((*pos >> 13) & 3) << 4;
-		bool prio = (*pos & 0x8000);
-		bool hflip = (*pos & 0x800);
-		bool vflip = (*pos & 0x1000);
-		uint16 tile = *pos++ & 0x7FF;
-		int x = *pos & 0x3FF;
-
-		// Sprite masking. Can't happen really, since the animator automatically adds 128 to x and y coords for all sprites.
-		assert(!(x == 0 && y >= 128));
-
-		assert(!hflip);
-		assert(!vflip);
-
-		x -= 128;
-		y -= 128;
-
-		/*if ((x >> 3) < renderBlockX) {
-			bW = MIN<int>(0, (int)bW - (renderBlockX - (x >> 3)));
-			x = (renderBlockX << 3);
-
-		}
-
-		if ((y >> 3) < renderBlockY) {
-			bH = MIN<int>(0, (int)bH - (renderBlockY - (y >> 3)));
-			y = (renderBlockY << 3);
-		}
-
-		bW = MIN<int>(bW, renderBlockWidth);
-		bH = MIN<int>(bH, renderBlockHeight);*/
-
-		uint8 *dst = renderBuffer + y * _screenW + x;
-		uint8 *msk = _spriteMask + y * _screenW + x;
-
-		for (int blX = 0; blX < bW; ++blX) {
-			uint8 *dst2 = dst;
-			uint8 *msk2 = msk;
-			for (int blY = 0; blY < bH; ++blY) {
-				renderSpriteTile(dst, msk, x + (blX << 3), y + (blY << 3), tile++, pal, vflip, hflip, prio);
-				dst += (_screenW << 3);
-				msk += (_screenW << 3);
-			}
-			dst = dst2 + 8;
-			msk = msk2 + 8;
-		}
-
-		pos = next ? &_spriteTable[next << 2] : 0;
-	}
-
-	// Priority Tiles
-	// Instead of going through all rendering passes for all planes again (only now drawing the
-	// prio tiles instead of the non-priority tiles) I have collected the data for the priority
-	// tiles on the way and put that data into a chain. Should be faster...
-	for (PrioTileRenderObj *e = _prioChainStart; e; e = e->_next)
-		mRenderLineFragment(e->_hflip, e->_start & 1, e->_end & 1, e->_mask, e->_dst, e->_mask, e->_src, e->_start, e->_end, e->_pal)
-
-	clearPrioChain();
-}
-
-void SegaRenderer::renderPlanePart(int plane, uint8 *dstBuffer, int x1, int y1, int x2, int y2) {
-	SegaPlane *p = &_planes[plane];
-	uint8 *dst = dstBuffer + (y1 << 3) * _screenW + (x1 << 3);
-
-	for (int y = y1; y < y2; ++y) {
-		int hScrollTableIndex = (plane == kWindowPlane) ? -1 : (_hScrollMode == kHScrollFullScreen) ? plane : (y1 << 4) + plane;
-		uint8 *dst2 = dst;
-		for (int x = x1; x < x2; ++x) {
-			int vScrollTableIndex = (plane == kWindowPlane) ? -1 : (_vScrollMode == kVScrollFullScreen) ? plane : (x & ~1) + plane;
-			uint16 vscrNt = 0;
-			uint16 vscrPxStart = 0;
-			uint16 vscrPxEnd = 8;
-
-			if (vScrollTableIndex != -1) {
-				vscrNt = _vsram[vScrollTableIndex] & 0x3FF;
-				vscrPxStart = vscrNt & 7;
-				vscrNt >>= 3;
-			}
-
-			int ty = (vscrNt + y) % p->mod;
-
-			renderPlaneTile(dst, x, &p->nameTable[ty * _pitch], vscrPxStart, vscrPxEnd, hScrollTableIndex, _pitch);
-
-			if (vscrPxStart) {
-				ty = (ty + 1) % p->mod;
-				uint16 dstOffs = (vscrPxEnd - vscrPxStart) * _screenW;
-				vscrPxEnd = vscrPxStart;
-				vscrPxStart = 0;
-				renderPlaneTile(dst + dstOffs, x, &p->nameTable[ty * _pitch], vscrPxStart, vscrPxEnd, hScrollTableIndex, _pitch);
-			}
-			dst += 8;
-		}
-		dst = dst2 + (_screenW << 3);
-	}
-}
-
-void SegaRenderer::renderPlaneTile(uint8 *dst, int ntblX, const uint16 *ntblLine, int vScrollLSBStart, int vScrollLSBEnd, int hScrollTableIndex, uint16 pitch) {
-	for (int bY = vScrollLSBStart; bY < vScrollLSBEnd; ++bY) {
-		uint8 *dst2 = dst;
-		uint16 hscrNt = 0;
-		uint16 hscrPx = 0;
-
-		if (hScrollTableIndex != -1) {
-			hscrNt = (-_hScrollTable[hScrollTableIndex]) & 0x3FF;
-			hscrPx = hscrNt & 7;
-			hscrNt >>= 3;
-		}
-
-		const uint16 *pNt = &ntblLine[(ntblX + hscrNt) % pitch];
-		if (pNt < (const uint16*)(&_vram[0x10000])) {
-			uint16 nt = *pNt;
-			uint16 pal = ((nt >> 13) & 3) << 4;
-			bool hflip = (nt & 0x800);
-			int y = bY % 8;
-			if (nt & 0x1000) // vflip
-				y = 7 - y;
-
-			// We skip the priority tiles here and draw them later
-			if (nt & 0x8000)
-				initPrioRenderTask(dst, 0, &_vram[((nt & 0x7FF) << 5) + (y << 2) + (hscrPx >> 1)], hscrPx, 8, pal, hflip);
-			else
-				mRenderLineFragment(hflip, hscrPx & 1, 0, 0, dst, 0, &_vram[((nt & 0x7FF) << 5) + (y << 2) + (hscrPx >> 1)], hscrPx, 8, pal);
-		}
-
-		if (hscrPx) {
-			dst += (8 - hscrPx);
-			pNt = &ntblLine[(ntblX + hscrNt + 1) % pitch];
-			if (pNt < (const uint16*)(&_vram[0x10000])) {
-				uint16 nt = *pNt;
-				uint16 pal = ((nt >> 13) & 3) << 4;
-				bool hflip = (nt & 0x800);
-				int y = bY % 8;
-				if (nt & 0x1000) // vflip
-					y = 7 - y;
-
-				// We skip the priority tiles here and draw them later
-				if (nt & 0x8000)
-					initPrioRenderTask(dst, 0, &_vram[((nt & 0x7FF) << 5) + (y << 2)], 0, hscrPx, pal, hflip);
-				else
-					mRenderLineFragment(hflip, 0, hscrPx & 1, 0, dst, 0, &_vram[((nt & 0x7FF) << 5) + (y << 2)], 0, hscrPx, pal)
-			}
-		}
-
-		if (hScrollTableIndex != -1 && _hScrollMode == kHScroll1PixelRows)
-			hScrollTableIndex += 2;
-		dst = dst2 + _screenW;
-	}
-}
-
-#undef vflip
-
-void SegaRenderer::renderSpriteTile(uint8 *dst, uint8 *mask, int x, int y, uint16 tile, uint8 pal, bool vflip, bool hflip, bool prio) {
-	if (y <= -8 || y >= _screenH || x <= -8 || x >= _screenW)
-		return;
-
-	const uint8 *src = &_vram[tile << 5];
-	if (vflip)
-		src += 31;
-
-	if (y < 0) {
-		dst -= (y * _screenW);
-		mask -= (y * _screenW);
-	} if (x < 0) {
-		dst -= x;
-		mask -= x;
-	}
-
-	int xstart = CLIP<int>(-x, 0, 7);
-	int xend = CLIP<int>(_screenW - x, 0, 8);
-	src += (xstart >> 1);
-
-	int ystart = CLIP<int>(-y, 0, 7);
-	int yend = CLIP<int>(_screenH - y, 0, 8);
-	src += (ystart << 2);
-
-	for (int bY = ystart; bY < yend; ++bY) {
-		uint8 *dst2 = dst;
-		uint8 *msk2 = mask;
-
-		if (prio)
-			initPrioRenderTask(dst, mask, src, xstart, xend, pal, hflip);
-		else
-			mRenderLineFragment(hflip, xstart & 1, xend & 1, 1, dst, mask, src, xstart, xend, pal);
-
-		src += 4;
-		dst = dst2 + _screenW;
-		mask = msk2 + _screenW;
-	}
-}
-
-#if SEGA_PERFORMANCE
-template<bool hflip, bool oddStart, bool oddEnd> void SegaRenderer::renderLineFragmentM(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal) {
-	if (hflip)
-		src += ((end - 1 - start) >> 1);
-
-	for (int i = (end - start) >> 1; i; --i) {
-		uint8 col = hflip ? (oddEnd ? *src-- >> 4 : *src & 0x0F) : (oddStart ? *src++ & 0x0F : *src >> 4);
-		uint8 col2 = hflip ? (oddEnd ? *src & 0x0F : *src-- >> 4) : (oddStart ? *src >> 4 : *src++ & 0x0F);
-		if (col & *mask) {
-			*dst = pal | col;
-			*mask = 0;
-		}
-		dst++;
-		mask++;
-		if (col2 & *mask) {
-			*dst = pal | col2;
-			*mask = 0;
-		}
-		dst++;
-		mask++;
-	}
-	if (oddStart != oddEnd) {
-		uint8 col = hflip ? (oddEnd ? *src-- >> 4 : *src & 0x0F) : (oddStart ? *src++ & 0x0F : *src >> 4);
-		if (col & *mask) {
-			*dst = pal | col;
-			*mask = 0;
-		}
-		dst++;
-		mask++;
-	}
-}
-
-template<bool hflip, bool oddStart, bool oddEnd> void SegaRenderer::renderLineFragmentD(uint8 *dst, const uint8 *src, int start, int end, uint8 pal) {
-	if (hflip)
-		src += ((end - 1 - start) >> 1);
-
-	for (int i = (end - start) >> 1; i; --i) {
-		uint8 col = hflip ? (oddEnd ? *src-- >> 4 : *src & 0x0F) : (oddStart ? *src++ & 0x0F : *src >> 4);
-		uint8 col2 = hflip ? (oddEnd ? *src & 0x0F : *src-- >> 4) : (oddStart ? *src >> 4 : *src++ & 0x0F);
-		if (col)
-			*dst = pal | col;
-		dst++;
-		if (col2)
-			*dst = pal | col2;
-		dst++;
-	}
-	if (oddStart != oddEnd) {
-		uint8 col = hflip ? (oddEnd ? *src-- >> 4 : *src & 0x0F) : (oddStart ? *src++ & 0x0F : *src >> 4);
-		if (col)
-			*dst = pal | col;
-		dst++;
-	}
-}
-#else
-template<bool hflip> void SegaRenderer::renderLineFragment(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal) {
-	if (hflip) {
-		src += ((end - 1 - start) >> 1);
-		if (end & 1) {
-			start++;
-			end++;
-		}
-	}
-
-	if (mask) {
-		for (int bX = start; bX < end; ++bX) {
-			uint8 col = hflip ? ((bX & 1) ? *src-- >> 4 : *src & 0x0F) : ((bX & 1) ? *src++ & 0x0F : *src >> 4);
-			if (col & *mask) {
-				*dst = pal | col;
-				*mask = 0;
-			}
-			dst++;
-			mask++;
-		}
-	} else {
-		for (int bX = start; bX < end; ++bX) {
-			uint8 col = hflip ? ((bX & 1) ? *src-- >> 4 : *src & 0x0F) : ((bX & 1) ? *src++ & 0x0F : *src >> 4);
-			if (col)
-				*dst = pal | col;
-			dst++;
-		}
-	}
-}
-#endif
-
-#undef mRenderLineFragment
-
-void SegaRenderer::initPrioRenderTask(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal, bool hflip) {
-#if SEGA_USE_MEMPOOL
-	_prioChainEnd =	new (_prioRenderMemPool) PrioTileRenderObj(_prioChainEnd, dst, mask, src, start, end, pal, hflip);
-#else
-	_prioChainEnd = new PrioTileRenderObj(_prioChainEnd, dst, mask, src, start, end, pal, hflip);
-#endif
-	if (!_prioChainStart)
-		_prioChainStart = _prioChainEnd;
-}
-
-void SegaRenderer::clearPrioChain() {
-	while (_prioChainEnd) {
-		_prioChainEnd->_next = 0;
-		PrioTileRenderObj *e = _prioChainEnd->_pred;
-#if SEGA_USE_MEMPOOL
-		_prioRenderMemPool.deleteChunk(_prioChainEnd);
-#else
-		delete _prioChainEnd;
-#endif
-		_prioChainEnd = e;
-	}
-	_prioChainStart = 0;
+	_screen->addDirtyRect(renderBlockX << 3, renderBlockY << 3, ((renderBlockX + renderBlockWidth) << 3) - 1, ((renderBlockY + renderBlockHeight) << 3) - 1);
+	Graphics::SegaRenderer::render(_screen->getPagePtr(destPageNum), renderBlockX, renderBlockY, renderBlockWidth, renderBlockHeight, spritesOnly);
 }
 
-SegaAnimator::SegaAnimator(SegaRenderer *renderer) : _renderer(renderer), _needUpdate(false) {
-	_sprites = new Sprite[80]();
+SegaAnimator::SegaAnimator(SCDRenderer *renderer) : _renderer(renderer), _needUpdate(false) {
+	_sprites = new Sprite[80];
 	assert(_sprites);
 	_tempBuffer = new uint16[320]();
 	assert(_tempBuffer);
@@ -1214,7 +721,7 @@ const uint8 *SegaCDFont::getGlyphData(uint16 c, uint8 &charWidth, uint8 &charHei
 	return res;
 }
 
-ScrollManager::ScrollManager(SegaRenderer *renderer) : _renderer(renderer) {
+ScrollManager::ScrollManager(SCDRenderer *renderer) : _renderer(renderer) {
 	_vScrollTimers = new ScrollTimer[2];
 	assert(_vScrollTimers);
 	_hScrollTimers = new ScrollTimer[2];
diff --git a/engines/kyra/graphics/screen_eob_segacd.h b/engines/kyra/graphics/screen_eob_segacd.h
index 7c70e40c0bc..863f623c7d5 100644
--- a/engines/kyra/graphics/screen_eob_segacd.h
+++ b/engines/kyra/graphics/screen_eob_segacd.h
@@ -24,138 +24,28 @@
 
 #ifdef ENABLE_EOB
 
-#define SEGA_PERFORMANCE		true
-#define SEGA_USE_MEMPOOL		true
-
 #include "kyra/graphics/screen_eob.h"
-
-#if SEGA_USE_MEMPOOL
-#include "common/memorypool.h"
-#endif
+#include "graphics/segagfx.h"
 
 namespace Kyra {
 
-class SegaRenderer {
+class SCDRenderer : public Graphics::SegaRenderer {
 public:
-	enum Plane {
-		kPlaneA = 0,
-		kPlaneB = 1,
-		kWindowPlane = 2
-	};
-
-	enum WindowMode {
-		kWinToLeft = 0,
-		kWinToTop = 0,
-		kWinToRight = 1,
-		kWinToBottom = 1
-	};
-
-	enum HScrollMode {
-		kHScrollFullScreen = 0,
-		kHScroll8PixelRows,
-		kHScroll1PixelRows
-	};
-
-	enum VScrollMode {
-		kVScrollFullScreen = 0,
-		kVScroll16PixelStrips
-	};
+	SCDRenderer(Screen_EoB *screen);
+	~SCDRenderer();
 
-public:
-	SegaRenderer(Screen_EoB *screen);
-	~SegaRenderer();
-
-	void setResolution(int w, int h);
-	void setPlaneTableLocation(int plane, uint16 addr);
-	// The hardware allows/demands separate modification of the vertical and horizontal properties.
-	// To allow this without making another function the w/h parameters can be set to -1 which will
-	// keep the existing value for that property.
-	void setupPlaneAB(int pixelWidth, int pixelHeigth);
-	// The hardware allows/demands separate modification of the vertical and horizontal properties.
-	// To allow this without making another function the blockX/Y parameters can be set to -1 which
-	// will keep the existing value for that property.
-	void setupWindowPlane(int blockX, int blockY, int horizontalMode, int verticalMode);
-	void setHScrollTableLocation(int addr);
-	void setSpriteTableLocation(int addr);
-	void setPitch(int pitch);
-	void setHScrollMode(int mode);
-	void setVScrollMode(int mode);
-
-	void loadToVRAM(const void *data, uint16 dataSize, uint16 addr);
 	void loadStreamToVRAM(Common::SeekableReadStream *in, uint16 addr, bool compressedData = false);
-	void memsetVRAM(int addr, uint8 val, int len);
 	void fillRectWithTiles(int vramArea, int x, int y, int w, int h, uint16 nameTblEntry, bool incr = false, bool topToBottom = false, const uint16 *patternTable = 0);
-	void writeUint16VSRAM(int addr, uint16 value);
-	void writeUint8VRAM(int addr, uint8 value);
-	void writeUint16VRAM(int addr, uint16 value);
-	void clearPlanes();
-
-	void render(int destPageNum, int renderLeft = -1, int renderTop = -1, int renderWidth = -1, int renderHeight = -1, bool spritesOnly = false);
-private:
-	void renderPlanePart(int plane, uint8 *dstBuffer, int x1, int y1, int x2, int y2);
-	void renderPlaneTile(uint8 *dst, int destX, const uint16 *nameTable, int vScrollLSBStart, int vScrollLSBEnd, int hScrollTableIndex, uint16 pitch);
-	void renderSpriteTile(uint8 *dst, uint8 *mask, int x, int y, uint16 tile, uint8 pal, bool vflip, bool hflip, bool prio);
-#if SEGA_PERFORMANCE
-	template<bool hflip, bool oddStart, bool oddEnd> void renderLineFragmentM(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal);
-	template<bool hflip, bool oddStart, bool oddEnd> void renderLineFragmentD(uint8 *dst, const uint8 *src, int start, int end, uint8 pal);
-	typedef void(SegaRenderer::*renderFuncM)(uint8*, uint8*, const uint8*, int, int, uint8);
-	typedef void(SegaRenderer::*renderFuncD)(uint8*, const uint8*, int, int, uint8);
-	const renderFuncM *_renderLineFragmentM;
-	const renderFuncD *_renderLineFragmentD;
-#else
-	template<bool hflip> void renderLineFragment(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal);
-#endif
-
-	void initPrioRenderTask(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal, bool hflip);
-	void clearPrioChain();
 
-	struct SegaPlane {
-		SegaPlane() : blockX(0), blockY(0), w(0), h(0), mod(0), nameTable(0), nameTableSize(0) {}
-		int blockX, blockY;
-		uint16 w, h, mod;
-		uint16 *nameTable;
-		uint16 nameTableSize;
-	};
-
-	SegaPlane _planes[3];
-	uint8 *_vram;
-	uint16 *_vsram;
-	uint16 *_hScrollTable;
-	uint16 *_spriteTable;
-	uint8 *_spriteMask;
-	uint8 _hScrollMode;
-	uint8 _vScrollMode;
-	uint16 _pitch;
-	uint16 _numSpritesMax;
-
-	struct PrioTileRenderObj {
-		PrioTileRenderObj(PrioTileRenderObj *chainEnd, uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal, bool hflip) :
-			_pred(chainEnd), _next(0), _dst(dst), _mask(mask), _src(src), _start(start), _end(end), _pal(pal), _hflip(hflip) {
-			if (_pred)
-				_pred->_next = this;
-		}
-		uint8 *_dst;
-		uint8 *_mask;
-		const uint8 *_src;
-		int _start;
-		int _end;
-		uint8 _pal;
-		bool _hflip;
-		PrioTileRenderObj *_pred;
-		PrioTileRenderObj *_next;
-	};
+	void renderToPage(int destPageNum, int renderBlockX = -1, int renderBlockY = -1, int renderBlockWidth = -1, int renderBlockHeight = -1, bool spritesOnly = false);
 
-#if SEGA_USE_MEMPOOL
-	Common::ObjectPool<PrioTileRenderObj> _prioRenderMemPool;
-#endif
-	PrioTileRenderObj *_prioChainStart, *_prioChainEnd;
-	uint16 _screenW, _screenH, _blocksW, _blocksH;
+private:
 	Screen_EoB *_screen;
 };
 
 class SegaAnimator {
 public:
-	SegaAnimator(SegaRenderer *renderer);
+	SegaAnimator(SCDRenderer *renderer);
 	~SegaAnimator();
 
 	void initSprite(int id, int16 x, int16 y, uint16 nameTbl, uint16 hw);
@@ -176,13 +66,13 @@ private:
 
 	uint16 *_tempBuffer;
 	Sprite *_sprites;
-	SegaRenderer *_renderer;
+	SCDRenderer *_renderer;
 	bool _needUpdate;
 };
 
 class ScrollManager {
 public:
-	ScrollManager(SegaRenderer *renderer);
+	ScrollManager(SCDRenderer *renderer);
 	~ScrollManager();
 
 	void setVScrollTimers(uint16 destA, int incrA, int delayA, uint16 destB, int incrB, int delayB);
@@ -202,7 +92,7 @@ private:
 
 	ScrollTimer *_vScrollTimers;
 	ScrollTimer *_hScrollTimers;
-	SegaRenderer *_renderer;
+	SCDRenderer *_renderer;
 };
 
 } // End of namespace Kyra
diff --git a/engines/kyra/gui/gui_eob.cpp b/engines/kyra/gui/gui_eob.cpp
index a3ed5e6f8f6..c2f4c3a1e8e 100644
--- a/engines/kyra/gui/gui_eob.cpp
+++ b/engines/kyra/gui/gui_eob.cpp
@@ -2439,7 +2439,7 @@ void GUI_EoB::runCampMenu() {
 					prevHighlightButton = 0;
 				}
 			} else if (_vm->gameFlags().platform == Common::kPlatformSegaCD && newMenu == 2) {
-				_screen->sega_getRenderer()->render(0, 0, 0, 22, 21);
+				_screen->sega_getRenderer()->renderToPage(0, 0, 0, 22, 21);
 			}
 
 			lastMenu = newMenu;
@@ -2973,7 +2973,7 @@ int GUI_EoB::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo
 					_screen->sega_setTextBuffer(segaCharBuf, 32);
 					_vm->_txt->printShadedText(sufx, 0, 0, textColor1, 0, -1, -1, 0, false);
 					_screen->sega_loadTextBufferToVRAM(0, ((y >> 3) * 40 + x + pos + 1) << 5, 32);
-					_screen->sega_getRenderer()->render(0, x + pos, y >> 3, 1, 1);
+					_screen->sega_getRenderer()->renderToPage(0, x + pos, y >> 3, 1, 1);
 					_screen->sega_setTextBuffer(0, 0);
 				} else if (cursorState) {
 					_screen->copyRegion((pos + 1) << 3, 200 - _textInputHeight, (x + pos) << 3, y, 8, _textInputHeight, 2, 0, Screen::CR_NO_P_CHECK);
@@ -3098,7 +3098,7 @@ int GUI_EoB::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo
 			_vm->_txt->printShadedText(dest, 0, 0, textColor1, 0, -1, -1, 0, false);
 			_screen->setFontStyles(_screen->_currentFont, cs);
 			_screen->sega_loadTextBufferToVRAM(0, ((y >> 3) * 40 + x + 1) << 5, destMaxLen << 5);
-			_screen->sega_getRenderer()->render(0, x, y >> 3, destMaxLen, 1);
+			_screen->sega_getRenderer()->renderToPage(0, x, y >> 3, destMaxLen, 1);
 			_screen->sega_setTextBuffer(0, 0);
 		} else {
 			_screen->copyRegion(0, 200 - _textInputHeight, (x - 1) << 3, y, (destMaxLen + 2) << 3, _textInputHeight, 2, 0, Screen::CR_NO_P_CHECK);
@@ -3122,7 +3122,7 @@ int GUI_EoB::getTextInput(char *dest, int x, int y, int destMaxLen, int textColo
 			_screen->sega_setTextBuffer(segaCharBuf, 32);
 			_vm->_txt->printShadedText(sufx, 0, 0, textColor1, 0, -1, -1, 0, false);
 			_screen->sega_loadTextBufferToVRAM(0, ((y >> 3) * 40 + x + pos + 1) << 5, 32);
-			_screen->sega_getRenderer()->render(0, x + pos, y >> 3, 1, 1);
+			_screen->sega_getRenderer()->renderToPage(0, x + pos, y >> 3, 1, 1);
 			_screen->sega_setTextBuffer(0, 0);
 		} else if (cursorState) {
 			_screen->printText(sufx, (x + pos) << 3, y, textColor1, cursorColor);
@@ -3529,7 +3529,7 @@ int GUI_EoB::selectSaveSlotDialog(int x, int y, int id) {
 				_screen->sega_clearTextBuffer(0);
 				_vm->_txt->printShadedText(Common::String::format("%03d/989", sli).c_str(), 0, 0, 0xFF, 0xCC, -1, -1, 0, false);
 				_screen->sega_loadTextBufferToVRAM(0, 64, 224);
-				_screen->sega_getRenderer()->render(0, (_saveSlotX + 8) >> 3, (_saveSlotY + 152) >> 3, 7, 1);
+				_screen->sega_getRenderer()->renderToPage(0, (_saveSlotX + 8) >> 3, (_saveSlotY + 152) >> 3, 7, 1);
 			} else {
 				Screen::FontId of = _screen->setFont(Screen::FID_6_FNT);
 				_screen->set16bitShadingLevel(4);
@@ -3701,7 +3701,7 @@ void GUI_EoB::runMemorizePrayMenu(int charIndex, int spellType) {
 
 			_screen->setCurPage(0);
 			if (_vm->gameFlags().platform == Common::kPlatformSegaCD)
-				_screen->sega_getRenderer()->render(0, 0, 10, 22, 9);
+				_screen->sega_getRenderer()->renderToPage(0, 0, 10, 22, 9);
 			else
 				_screen->copyRegion(0, 50, 0, 50, 176, 72, 2, 0, Screen::CR_NO_P_CHECK);
 			lastHighLightText = -1;
@@ -3713,7 +3713,7 @@ void GUI_EoB::runMemorizePrayMenu(int charIndex, int spellType) {
 				_screen->sega_clearTextBuffer(0);
 				_vm->_txt->printShadedText(Common::String::format(_vm->_menuStringsMgc[1], (char)(np[lastHighLightButton] - numAssignedSpellsPerBookPage[lastHighLightButton] + 79), (char)(np[lastHighLightButton] + 79)).c_str(), 0, 2, 0x55, 0xCC, 160, 16, 0, false);
 				_screen->sega_loadTextBufferToVRAM(0, 0x5560, 1280);
-				_screen->sega_getRenderer()->render(0, 1, 8, 20, 2);
+				_screen->sega_getRenderer()->renderToPage(0, 1, 8, 20, 2);
 			} else {
 				_screen->set16bitShadingLevel(4);
 				_screen->printShadedText(Common::String::format(_vm->_menuStringsMgc[1], np[lastHighLightButton] - numAssignedSpellsPerBookPage[lastHighLightButton], np[lastHighLightButton]).c_str(), _vm->_flags.lang == Common::Language::ZH_TWN ? 4 : 8, _vm->_flags.lang == Common::Language::ZH_TWN ? 40 : 38, _vm->guiSettings()->colors.guiColorLightBlue, _vm->guiSettings()->colors.fill, _vm->guiSettings()->colors.guiColorBlack);
@@ -4616,7 +4616,7 @@ Button *GUI_EoB::initMenu(int id) {
 	}
 
 	if (_vm->gameFlags().platform == Common::kPlatformSegaCD)
-		_screen->sega_getRenderer()->render(0, 0, 0, 22, 21);
+		_screen->sega_getRenderer()->renderToPage(0, 0, 0, 22, 21);
 	else
 		_screen->copyRegion(_screen->_curDim->sx << 3, _screen->_curDim->sy, _screen->_curDim->sx << 3, _screen->_curDim->sy, _screen->_curDim->w << 3, _screen->_curDim->h, 2, 0, Screen::CR_NO_P_CHECK);
 
diff --git a/engines/kyra/gui/gui_eob_segacd.cpp b/engines/kyra/gui/gui_eob_segacd.cpp
index a9313160792..372b0adecdb 100644
--- a/engines/kyra/gui/gui_eob_segacd.cpp
+++ b/engines/kyra/gui/gui_eob_segacd.cpp
@@ -63,7 +63,7 @@ void EoBEngine::gui_drawPlayField(bool refresh, bool screenUpdt) {
 	_txt->clearDim(0);
 	_screen->sega_getAnimator()->clearSprites();
 	_screen->sega_getAnimator()->update();
-	SegaRenderer *r = _screen->sega_getRenderer();
+	SCDRenderer *r = _screen->sega_getRenderer();
 	r->fillRectWithTiles(0, 0, 0, 40, 28, 0);
 	r->fillRectWithTiles(1, 0, 0, 40, 28, 0);
 
@@ -110,7 +110,7 @@ void EoBEngine::gui_drawPlayField(bool refresh, bool screenUpdt) {
 	_screen->copyRegionToBuffer(0, 173, 0, 6, 120, _shakeBackBuffer1);
 	_screen->copyRegionToBuffer(0, 0, 117, 179, 6, _shakeBackBuffer2);
 
-	// Since we're not going to draw the character portrait boxes with the SegaRenderer but rather with our "normal" code, we have to backup
+	// Since we're not going to draw the character portrait boxes with the SCDRenderer but rather with our "normal" code, we have to backup
 	// some parts of the background between the character portraits. Unlike in the other versions the red splat shapes overlaps with that space.
 	for (int i = 0; i < 6; ++i) {
 		delete[] _redSplatBG[i];
@@ -137,7 +137,7 @@ void EoBEngine::gui_setupPlayFieldHelperPages(bool keepText) {
 	if (!keepText)
 		_txt->clearDim(0);
 
-	SegaRenderer *r = _screen->sega_getRenderer();
+	SCDRenderer *r = _screen->sega_getRenderer();
 	r->loadToVRAM(_scrYellow, 4992, 0x3CE0);
 	r->fillRectWithTiles(0, 0, 0, 22, 21, 0);
 	r->fillRectWithTiles(0, 22, 0, 18, 21, 0);
@@ -149,11 +149,11 @@ void EoBEngine::gui_setupPlayFieldHelperPages(bool keepText) {
 	// r->fillRectWithTiles(0, 0, 1, 22, 14, 0xE295, true, true);
 	// Text field tiles
 	r->fillRectWithTiles(0, 1, 22, 35, 3, 0x2597, true);
-	r->render(0);
+	r->renderToPage(0);
 	r->fillRectWithTiles(1, 22, 0, 18, 21, 0x6444, true, true, _invPattern);
-	r->render(2);
+	r->renderToPage(2);
 	r->fillRectWithTiles(1, 22, 0, 18, 21, 0x6444, true, true, _statsPattern);
-	r->render(Screen_EoB::kSegaRenderPage);
+	r->renderToPage(Screen_EoB::kSegaRenderPage);
 	_screen->copyRegion(184, 1, 176, 168, guiSettings()->charBoxCoords.boxWidth, 24, 0, 2, Screen::CR_NO_P_CHECK);
 	_screen->copyRegion(184, 25, 240, 168, guiSettings()->charBoxCoords.boxWidth, guiSettings()->charBoxCoords.boxHeight - 24, 0, 2, Screen::CR_NO_P_CHECK);
 }
@@ -187,7 +187,7 @@ void EoBEngine::gui_drawCharacterStatsPage() {
 		return;
 	}
 
-	SegaRenderer *r = _screen->sega_getRenderer();
+	SCDRenderer *r = _screen->sega_getRenderer();
 	EoBCharacter *c = &_characters[_updateCharNum];
 
 	memset(_tempPattern, 0, 792);
@@ -225,7 +225,7 @@ void EoBEngine::gui_drawCharacterStatsPage() {
 	}
 
 	r->fillRectWithTiles(0, 22, 0, 18, 21, 0, true, true, _tempPattern);
-	r->render(2, 22, 5, 18, 16);
+	r->renderToPage(2, 22, 5, 18, 16);
 }
 
 void EoBEngine::gui_displayMap() {
@@ -243,7 +243,7 @@ void EoBEngine::gui_displayMap() {
 		gui_drawCharPortraitWithStats(i);
 	}
 
-	SegaRenderer *r = _screen->sega_getRenderer();
+	SCDRenderer *r = _screen->sega_getRenderer();
 	r->fillRectWithTiles(0, 0, 0, 40, 28, 0);
 	r->fillRectWithTiles(1, 0, 0, 40, 28, 0);
 	_screen->sega_getAnimator()->clearSprites();
@@ -276,7 +276,7 @@ void EoBEngine::gui_displayMap() {
 	r->fillRectWithTiles(0, 31, 16, 8, 2, 0x63E1, true);
 
 	drawMapPage(_currentLevel);
-	r->render(0);
+	r->renderToPage(0);
 	_screen->sega_fadeToNeutral(3);
 
 	gui_resetButtonList();
@@ -303,7 +303,7 @@ void EoBEngine::gui_displayMap() {
 		}
 
 		if (needupdate) {
-			r->render(0);
+			r->renderToPage(0);
 			_screen->updateScreen();
 		}
 		delayUntil(del);
@@ -327,7 +327,7 @@ void EoBEngine::gui_drawSpellbook() {
 		return;
 	}
 
-	SegaRenderer *r = _screen->sega_getRenderer();
+	SCDRenderer *r = _screen->sega_getRenderer();
 	r->fillRectWithTiles(0, 10, 15, 12, 7, 0);
 	r->fillRectWithTiles(1, 10, 15, 12, 7, 0x6429);
 	memset(_tempPattern, 0, 168);
@@ -347,7 +347,7 @@ void EoBEngine::gui_drawSpellbook() {
 	}
 
 	r->fillRectWithTiles(0, 10, 15, 12, 7, 0, true, false, _tempPattern);
-	r->render(Screen_EoB::kSegaRenderPage, 10, 15, 12, 7);
+	r->renderToPage(Screen_EoB::kSegaRenderPage, 10, 15, 12, 7);
 
 	// The original SegaCD version actually doesn't disable the spell book after use but closes it instead.
 	if (!_closeSpellbookAfterUse) {
@@ -415,7 +415,7 @@ void EoBEngine::gui_updateAnimations() {
 	}
 	if (redrawCompass) {
 		_screen->sega_getRenderer()->loadToVRAM(_compassData + (_compassAnimPhase & 0x0F) * 0x500, 0x500, 0xEE00);
-		_screen->sega_getRenderer()->render(0, 11, 15, 10, 6);
+		_screen->sega_getRenderer()->renderToPage(0, 11, 15, 10, 6);
 		updScreen = true;
 	}
 
@@ -510,7 +510,7 @@ void EoBEngine::makeNameShapes(int charId) {
 	}
 	delete[] in;
 
-	_screen->sega_getRenderer()->render(_screen->_curPage, 0, 0, 8, 12);
+	_screen->sega_getRenderer()->renderToPage(_screen->_curPage, 0, 0, 8, 12);
 	for (int i = first; i <= last; ++i) {
 		if (!_characters[i].flags)
 			continue;
@@ -609,7 +609,7 @@ void EoBEngine::drawMapPage(int level) {
 	_txt->printShadedText(_mapStrings3[level - 1], 0, 0, 0xCC, 0, 48, 16, 0, false);
 	_screen->setFontStyles(_screen->_currentFont, cs);
 	_screen->sega_loadTextBufferToVRAM(0, 0x7920, 384);
-	SegaRenderer *r = _screen->sega_getRenderer();
+	SCDRenderer *r = _screen->sega_getRenderer();
 	r->fillRectWithTiles(0, 23, 8, 6, 2, 0x63C9, true);
 
 	Common::SeekableReadStreamEndian *in = _sres->resStreamEndian(hasLevelMap(level) ? 2 + level : 2);
@@ -663,7 +663,7 @@ void EoBEngine::drawDialogueButtons() {
 	}
 
 	_screen->sega_loadTextBufferToVRAM(0, 0xA380, 7296);
-	_screen->sega_getRenderer()->render(0);
+	_screen->sega_getRenderer()->renderToPage(0);
 }
 
 GUI_EoB_SegaCD::GUI_EoB_SegaCD(EoBEngine *vm) : GUI_EoB(vm), _vm(vm), _clickableCharactersNumPages(vm->_textInputCharacterLinesSize) {
@@ -706,7 +706,7 @@ void GUI_EoB_SegaCD::initMemorizePrayMenu(int spellType) {
 	_screen->sega_clearTextBuffer(0);
 	_vm->_txt->printShadedText(_vm->_menuStringsSpells[spellType ? 17 : 14], 0, 2, 0xFF, 0xCC, 160, 16, 0, false);
 	_screen->sega_loadTextBufferToVRAM(0, 0x5060, 2560);
-	_screen->sega_getRenderer()->render(0, 1, 4, 20, 2);
+	_screen->sega_getRenderer()->renderToPage(0, 1, 4, 20, 2);
 }
 
 void GUI_EoB_SegaCD::initScribeScrollMenu() {
@@ -716,7 +716,7 @@ void GUI_EoB_SegaCD::initScribeScrollMenu() {
 	_screen->sega_clearTextBuffer(0);
 	_vm->_txt->printShadedText(getMenuString(48), 0, 3, 0xFF, 0xCC, 160, 16, 0, false);
 	_screen->sega_loadTextBufferToVRAM(0, 0x5060, 2560);
-	_screen->sega_getRenderer()->render(0, 1, 4, 20, 2);
+	_screen->sega_getRenderer()->renderToPage(0, 1, 4, 20, 2);
 }
 
 void GUI_EoB_SegaCD::printScribeScrollSpellString(const int16 *menuItems, int id, bool highlight) {
@@ -725,7 +725,7 @@ void GUI_EoB_SegaCD::printScribeScrollSpellString(const int16 *menuItems, int id
 	memset(buf, 0, sizeof(buf));
 	_vm->printSpellbookString(&buf[1], _vm->_mageSpellList[menuItems[id]], highlight ? 0x6223 : 0x63C9);
 	_screen->sega_getRenderer()->fillRectWithTiles(0, 1, 10 + id, 20, 1, 0,  true, false, buf);
-	_screen->sega_getRenderer()->render(0, 1, 10 + id, 20, 1);
+	_screen->sega_getRenderer()->renderToPage(0, 1, 10 + id, 20, 1);
 }
 
 void GUI_EoB_SegaCD::drawSaveSlotDialog(int x, int y, int id) {
@@ -742,7 +742,7 @@ void GUI_EoB_SegaCD::drawSaveSlotDialog(int x, int y, int id) {
 	_vm->_txt->printShadedText(_vm->_saveLoadStrings[2 + id], 0, 3, 0xFF, 0xCC, 160, 16, 0, false);
 	_screen->setFontStyles(_screen->_currentFont, cs);
 	_screen->sega_loadTextBufferToVRAM(0, 0x5060, 1280);
-	_screen->sega_getRenderer()->render(0, x >> 3, (y >> 3) + 1, 22, 21);
+	_screen->sega_getRenderer()->renderToPage(0, x >> 3, (y >> 3) + 1, 22, 21);
 }
 
 bool GUI_EoB_SegaCD::confirmDialogue(int id) {
@@ -761,7 +761,7 @@ bool GUI_EoB_SegaCD::confirmDialogue(int id) {
 	_screen->sega_loadTextBufferToVRAM(0, 0x5060, 10240);
 	_screen->sega_getRenderer()->fillRectWithTiles(0, 1, 0, 20, 20, 0);
 	_screen->sega_getRenderer()->fillRectWithTiles(0, 1, 5, 20, 8, 0x6283, true);
-	_screen->sega_getRenderer()->render(0, 1, 0, 22, 20);
+	_screen->sega_getRenderer()->renderToPage(0, 1, 0, 22, 20);
 	_screen->updateScreen();
 
 	Button *buttonList = initMenu(5);
@@ -828,7 +828,7 @@ void GUI_EoB_SegaCD::displayTextBox(int id, int textColor, bool wait) {
 	_screen->sega_loadTextBufferToVRAM(0, 0x5060, 3200);
 	_screen->setFontStyles(_screen->_currentFont, cs);
 	_screen->sega_getRenderer()->fillRectWithTiles(0, 1, 6, 20, 5, 0x6283, true);
-	_screen->sega_getRenderer()->render(0, 0, 1, 22, 19);
+	_screen->sega_getRenderer()->renderToPage(0, 0, 1, 22, 19);
 	_screen->updateScreen();
 	if (!wait)
 		return;
@@ -849,7 +849,7 @@ void GUI_EoB_SegaCD::drawMenuButton(Button *b, bool clicked, bool highlight, boo
 
 	_screen->sega_getRenderer()->loadToVRAM(&_campMenu[(0x1CE + t.srcOffs + (clicked ? 1 : 0) * ((b->width * b->height) >> 6)) << 5], (b->width * b->height) >> 1, t.nameTbl << 5);
 	_screen->sega_getRenderer()->fillRectWithTiles(0, b->x >> 3, b->y >> 3, b->width >> 3, b->height >> 3, 0x4000 + t.nameTbl, true);
-	_screen->sega_getRenderer()->render(0, b->x >> 3, b->y >> 3, b->width >> 3, b->height >> 3);
+	_screen->sega_getRenderer()->renderToPage(0, b->x >> 3, b->y >> 3, b->width >> 3, b->height >> 3);
 }
 
 void GUI_EoB_SegaCD::drawSaveSlotButton(int slot, int redrawBox, bool highlight) {
@@ -890,7 +890,7 @@ void GUI_EoB_SegaCD::drawSaveSlotButton(int slot, int redrawBox, bool highlight)
 	}
 
 	_screen->sega_loadTextBufferToVRAM(0, 0x5560, 4800);
-	_screen->sega_getRenderer()->render(0, (_saveSlotX >> 3) + (_saveSlotX ? 1 : 2), (_saveSlotY >> 3) + (_saveSlotY ? 6 : 7) + (slot << 1), 21, 2);
+	_screen->sega_getRenderer()->renderToPage(0, (_saveSlotX >> 3) + (_saveSlotX ? 1 : 2), (_saveSlotY >> 3) + (_saveSlotY ? 6 : 7) + (slot << 1), 21, 2);
 }
 
 int GUI_EoB_SegaCD::getHighlightSlot() {
@@ -936,14 +936,14 @@ void GUI_EoB_SegaCD::memorizePrayMenuPrintString(int spellId, int bookPageIndex,
 	} else {
 		_screen->sega_getRenderer()->fillRectWithTiles(0, 1, 10 + bookPageIndex, 20, 1, 0);
 	}
-	_screen->sega_getRenderer()->render(0, 1, 10 + bookPageIndex, 20, 1);
+	_screen->sega_getRenderer()->renderToPage(0, 1, 10 + bookPageIndex, 20, 1);
 }
 
 void GUI_EoB_SegaCD::updateOptionsStrings() {
 	uint16 ntblInputMode[3] = { 0x34C, 0x360, 0x30C };
 	int speed = _vm->_configMouse ? _vm->_mouseSpeed : _vm->_padSpeed;
 
-	SegaRenderer *r = _screen->sega_getRenderer();
+	SCDRenderer *r = _screen->sega_getRenderer();
 	r->loadToVRAM(&_campMenu[(0x1CE + (_vm->_configMouse ? 0x240 : 0x24C)) << 5], 0x180, 0x42E0);
 	r->loadToVRAM(&_campMenu[(0x1CE + (_vm->_configMusic ? 0x258 : 0x264)) << 5], 0x180, 0x4460);
 	r->loadToVRAM(&_campMenu[(0x1CE + (_vm->_configSounds ? 0x258 : 0x264)) << 5], 0x180, 0x45E0);
@@ -958,7 +958,7 @@ void GUI_EoB_SegaCD::updateOptionsStrings() {
 }
 
 void GUI_EoB_SegaCD::restParty_updateRestTime(int hours, bool init) {
-	SegaRenderer *r = _screen->sega_getRenderer();
+	SCDRenderer *r = _screen->sega_getRenderer();
 	if (init)
 		r->fillRectWithTiles(0, 1, 4, 20, 17, 0);
 	_screen->sega_clearTextBuffer(0);
@@ -972,7 +972,7 @@ void GUI_EoB_SegaCD::restParty_updateRestTime(int hours, bool init) {
 	_screen->sega_loadTextBufferToVRAM(0, 0x5060, 5120);
 	r->fillRectWithTiles(0, 1, 4, 20, 2, 0x6000);
 	r->fillRectWithTiles(0, 1, 6, 20, 6, 0x6283, true);
-	r->render(0, 0, 0, 22, 17);
+	r->renderToPage(0, 0, 0, 22, 17);
 	_screen->updateScreen();
 	_vm->delay(160);
 }
@@ -1004,7 +1004,7 @@ uint16 GUI_EoB_SegaCD::checkClickableCharactersSelection() {
 		printClickableCharacters(_clickableCharactersPage);
 		if (highlight != -1)
 			printClickableCharacter(highlight, 0x55);
-		_screen->sega_getRenderer()->render(0, 18, 10, 20, 14);
+		_screen->sega_getRenderer()->renderToPage(0, 18, 10, 20, 14);
 		_menuCur = highlight;
 	}
 
@@ -1047,7 +1047,7 @@ void GUI_EoB_SegaCD::printClickableCharacters(int page) {
 		printClickableCharacter(i, 0xFF);
 	for (int i = 200; i < 203; ++i)
 		printClickableCharacter(i, 0xFF);
-	_screen->sega_getRenderer()->render(0, 18, 10, 20, 14);
+	_screen->sega_getRenderer()->renderToPage(0, 18, 10, 20, 14);
 }
 
 void GUI_EoB_SegaCD::printClickableCharacter(int id, int col) {
diff --git a/engines/kyra/sequence/seqplayer_eob_segacd.cpp b/engines/kyra/sequence/seqplayer_eob_segacd.cpp
index 39cfe907405..2a630aaeb4e 100644
--- a/engines/kyra/sequence/seqplayer_eob_segacd.cpp
+++ b/engines/kyra/sequence/seqplayer_eob_segacd.cpp
@@ -120,7 +120,7 @@ SegaSequencePlayer::~SegaSequencePlayer() {
 }
 
 bool SegaSequencePlayer::play(int id) {
-	_renderer->render(0);
+	_renderer->renderToPage(0);
 	_screen->sega_fadeToBlack(2);
 	_screen->clearPage(0);
 
@@ -273,7 +273,7 @@ void SegaSequencePlayer::run(const uint8 *data) {
 			_scrollManager->fastForward();
 		} else {
 			_scrollManager->updateScrollTimers();
-			_renderer->render(0);
+			_renderer->renderToPage(0);
 			_screen->sega_updatePaletteFaders(-1);
 			_screen->updateScreen();
 		}
@@ -557,7 +557,7 @@ void SegaSequencePlayer::s_orbZoomEffect(const uint8*) {
 		_renderer->loadToVRAM(_scaleOutBuffer, 0x5800, 0x2AA0);
 
 		if (!_fastForward) {
-			_renderer->render(0);
+			_renderer->renderToPage(0);
 			_screen->updateScreen();
 			_vm->delayUntil(nextFrame);
 		}
diff --git a/engines/kyra/sequence/seqplayer_eob_segacd.h b/engines/kyra/sequence/seqplayer_eob_segacd.h
index d5287fd19f7..907de8a74f8 100644
--- a/engines/kyra/sequence/seqplayer_eob_segacd.h
+++ b/engines/kyra/sequence/seqplayer_eob_segacd.h
@@ -32,7 +32,7 @@ namespace Common {
 namespace Kyra {
 class EoBEngine;
 class Screen_EoB;
-class SegaRenderer;
+class SCDRenderer;
 class SegaCDResource;
 class SegaSequencePlayer {
 public:
@@ -92,7 +92,7 @@ private:
 
 	EoBEngine *_vm;
 	Screen_EoB *_screen;
-	SegaRenderer *_renderer;
+	SCDRenderer *_renderer;
 	SegaAnimator *_animator;
 	SegaCDResource *_res;
 	ScrollManager *_scrollManager;
diff --git a/engines/kyra/sequence/sequences_eob.cpp b/engines/kyra/sequence/sequences_eob.cpp
index f68ede99308..899e8411b0c 100644
--- a/engines/kyra/sequence/sequences_eob.cpp
+++ b/engines/kyra/sequence/sequences_eob.cpp
@@ -2282,7 +2282,7 @@ int EoBEngine::mainMenuLoop() {
 		_screen->setScreenDim(28);
 		_gui->simpleMenu_setup(8, 0, _mainMenuStrings, -1, 0, 0, col1, col2, col3);
 		if (_flags.platform == Common::kPlatformSegaCD)
-			_screen->sega_getRenderer()->render(0);
+			_screen->sega_getRenderer()->renderToPage(0);
 		_screen->updateScreen();
 
 		while (sel == -1 && !shouldQuit()) {
@@ -2464,9 +2464,9 @@ void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 	SegaRenderer *r = _screen->sega_getRenderer();
 
 	r->setPitch(128);
-	r->setPlaneTableLocation(SegaRenderer::kPlaneA, 0xE000);
+	r->setPlaneTableLocation(SCDRenderer::kPlaneA, 0xE000);
 	r->setupPlaneAB(1024, 256);
-	r->setHScrollMode(SegaRenderer::kHScroll1PixelRows);
+	r->setHScrollMode(SCDRenderer::kHScroll1PixelRows);
 
 	r->fillRectWithTiles(0, 0, 0, 40, 28, 0);
 	r->fillRectWithTiles(1, 0, 0, 128, 28, 1);
@@ -2482,7 +2482,7 @@ void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 	delete in;
 
 	_screen->sega_selectPalette(50, 0, 0);
-	r->render(0);
+	r->renderToPage(0);
 
 	_allowSkip = true;
 	resetSkipFlag();
@@ -2499,7 +2499,7 @@ void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 		r->loadStreamToVRAM(in, 32, !containerAlt);
 		delete in;
 
-		r->render(0);
+		r->renderToPage(0);
 		_screen->updateScreen();
 
 		_screen->sega_paletteOps(6, 0, 0);
@@ -2509,7 +2509,7 @@ void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 			uint32 end = _system->getMillis() + 16;
 			updateScrollState(scrollTable, ii / 30);
 			r->loadToVRAM(scrollTable, 0x400, 0xD800);
-			r->render(0);
+			r->renderToPage(0);
 			_screen->updateScreen();
 			mod--;
 			delayUntil(end);
@@ -2525,7 +2525,7 @@ void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 			uint32 end = _system->getMillis() + 16;
 			updateScrollState(scrollTable, ii / 10);
 			r->loadToVRAM(scrollTable, 0x400, 0xD800);
-			r->render(0);
+			r->renderToPage(0);
 			_screen->updateScreen();
 			mod++;
 			delayUntil(end);
@@ -2536,9 +2536,9 @@ void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 
 	delete[] scrollTable;
 	_screen->sega_fadeToBlack(0);
-	r->setPlaneTableLocation(SegaRenderer::kPlaneA, 0xC000);
+	r->setPlaneTableLocation(SCDRenderer::kPlaneA, 0xC000);
 	r->setupPlaneAB(512, 512);
-	r->setHScrollMode(SegaRenderer::kHScrollFullScreen);
+	r->setHScrollMode(SCDRenderer::kHScrollFullScreen);
 	r->memsetVRAM(0xD800, 0, 0x400);
 	r->setPitch(64);
 	_screen->sega_selectPalette(0, 0);
@@ -2555,7 +2555,7 @@ void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 	}
 	r->fillRectWithTiles(1, 0, 0, 40, 28, 1, true);
 	r->fillRectWithTiles(0, 0, 0, 40, 28, 0);
-	r->render(0);
+	r->renderToPage(0);
 	if (!(jumpToTitle || shouldQuit() || skipFlag()))
 		_screen->sega_fadeToNeutral(3);
 
@@ -2566,7 +2566,7 @@ void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 	resetSkipFlag();
 
 	r->fillRectWithTiles(1, 0, 19, 40, 9, 1);
-	r->render(0);
+	r->renderToPage(0);
 	_screen->sega_fadeToNeutral(3);
 }
 
@@ -2577,7 +2577,7 @@ void EoBEngine::seq_segaFinalCredits() {
 	int temp = 0;
 	const uint8 *grid = _staticres->loadRawData(kEoB1CreditsTileGrid, temp);
 	const char *const *strings = _staticres->loadStrings(kEoB1CreditsStrings2, temp);
-	SegaRenderer *r = _screen->sega_getRenderer();
+	SCDRenderer *r = _screen->sega_getRenderer();
 	_screen->sega_fadeToBlack(0);
 	_screen->sega_selectPalette(7, 3, true);
 	_txt->clearDim(4);
@@ -2593,7 +2593,7 @@ void EoBEngine::seq_segaFinalCredits() {
 	r->memsetVRAM(32, 0xCC, 32);
 	r->loadToVRAM(grid, 64, 64);
 	r->memsetVRAM(0x140, 0, 0x7800);
-	r->render(0);
+	r->renderToPage(0);
 
 	delay(320);
 
@@ -2612,7 +2612,7 @@ void EoBEngine::seq_segaFinalCredits() {
 		for (int i = 0; i < 32; ++i) {
 			uint32 del = _system->getMillis() + 16;
 			scrMan->updateScrollTimers();
-			r->render(0);
+			r->renderToPage(0);
 			_screen->updateScreen();
 			delayUntil(del);
 		}
@@ -2670,7 +2670,7 @@ void EoBEngine::seq_segaFinalCredits() {
 	r->fillRectWithTiles(0, 0, 0, 40, 28, 0);
 	r->fillRectWithTiles(1, 0, 0, 40, 28, 0);
 	r->fillRectWithTiles(0, 14, 9, 12, 8, 0x45A0, true);
-	r->render(0);
+	r->renderToPage(0);
 
 	_screen->sega_fadeToNeutral(3);
 
@@ -2687,7 +2687,7 @@ void EoBEngine::seq_segaShowStats() {
 	if (shouldQuit())
 		return;
 
-	SegaRenderer *r = _screen->sega_getRenderer();
+	SCDRenderer *r = _screen->sega_getRenderer();
 	_txt->clearDim(5);
 
 	int styles = Font::kStyleFullWidth;
@@ -2754,7 +2754,7 @@ void EoBEngine::seq_segaShowStats() {
 	r->fillRectWithTiles(0, 0, 0, 40, 28, 0);
 	r->fillRectWithTiles(1, 0, 0, 40, 28, 0);
 	r->fillRectWithTiles(0, 0, 3, 40, 22, 0x4001, true);
-	r->render(0);
+	r->renderToPage(0);
 
 	// This is a custom palette that gets loaded at the beginning of the ending sequence.
 	// Aborting that sequence too early might lead to wrong colors here...
@@ -2791,7 +2791,7 @@ void EoBEngine::seq_segaSetupSequence(int sequenceId) {
 	_screen->clearPage(0);
 
 	// transposeScreenOutputY(0);
-	_screen->sega_getRenderer()->setupWindowPlane(0, (sequenceId == 53 || sequenceId == 54) ? 23 : 18, SegaRenderer::kWinToRight, SegaRenderer::kWinToBottom);
+	_screen->sega_getRenderer()->setupWindowPlane(0, (sequenceId == 53 || sequenceId == 54) ? 23 : 18, SCDRenderer::kWinToRight, SCDRenderer::kWinToBottom);
 	_screen->sega_getRenderer()->memsetVRAM(0xD840, 0xEE, 512);
 	_screen->sega_getAnimator()->clearSprites();
 	_screen->setScreenDim(2);
@@ -2801,11 +2801,11 @@ void EoBEngine::seq_segaRestoreAfterSequence() {
 	if (_flags.platform != Common::kPlatformSegaCD)
 		return;
 
-	SegaRenderer *r = _screen->sega_getRenderer();
+	SCDRenderer *r = _screen->sega_getRenderer();
 	_screen->sega_fadeToBlack(1);
 	_screen->sega_getAnimator()->clearSprites();
 	_screen->sega_getAnimator()->update();
-	r->setupWindowPlane(0, 0, SegaRenderer::kWinToLeft, SegaRenderer::kWinToTop);
+	r->setupWindowPlane(0, 0, SCDRenderer::kWinToLeft, SCDRenderer::kWinToTop);
 	r->fillRectWithTiles(0, 0, 0, 40, 28, 0x2000);
 	r->fillRectWithTiles(1, 0, 0, 40, 28, 0x2000);
 	r->writeUint16VSRAM(0, 0);
diff --git a/engines/kyra/text/text_eob_segacd.cpp b/engines/kyra/text/text_eob_segacd.cpp
index d6aece4059d..ab7a90e6dd0 100644
--- a/engines/kyra/text/text_eob_segacd.cpp
+++ b/engines/kyra/text/text_eob_segacd.cpp
@@ -56,12 +56,12 @@ void TextDisplayer_SegaCD::printDialogueText(const char *str, bool wait) {
 	if (wait) {
 		printShadedText(str, 32, 12);
 		_engine->resetSkipFlag();
-		_renderer->render(0);
+		_renderer->renderToPage(0);
 		_screen->updateScreen();
 		_engine->delay(500);
 	} else {
 		printShadedText(str, 0, 0);
-		_renderer->render(0);
+		_renderer->renderToPage(0);
 		_screen->updateScreen();
 	}
 
@@ -169,7 +169,7 @@ void TextDisplayer_SegaCD::displayText(char *str, ...) {
 	if (tc != -1)
 		SWAP(_textColor, tc);
 
-	_renderer->render(Screen_EoB::kSegaRenderPage);
+	_renderer->renderToPage(Screen_EoB::kSegaRenderPage);
 	_screen->setFontStyles(Screen::FID_8_FNT, cs);
 	_screen->copyRegion(8, 176, 8, 176, 280, 24, Screen_EoB::kSegaRenderPage, 0, Screen::CR_NO_P_CHECK);
 	_screen->sega_setTextBuffer(0, 0);
diff --git a/engines/kyra/text/text_eob_segacd.h b/engines/kyra/text/text_eob_segacd.h
index 4bc7cd8c143..66bb8bcb364 100644
--- a/engines/kyra/text/text_eob_segacd.h
+++ b/engines/kyra/text/text_eob_segacd.h
@@ -50,7 +50,7 @@ private:
 	void copyTextBufferLine(uint16 srcY, uint16 dstY, uint16 lineHeight, uint16 pitch);
 
 	Screen_EoB *_screen;
-	SegaRenderer *_renderer;
+	SCDRenderer *_renderer;
 	EoBEngine *_engine;
 	uint8 *_msgRenderBuffer;
 	uint32 _msgRenderBufferSize;
diff --git a/engines/snatcher/render_scd.cpp b/engines/snatcher/render_scd.cpp
index c2c4c8014f2..b3496a11d75 100644
--- a/engines/snatcher/render_scd.cpp
+++ b/engines/snatcher/render_scd.cpp
@@ -23,15 +23,15 @@
 
 namespace Snatcher {
 
-class SegaRenderer : public Renderer {
+class SCDRenderer : public Renderer {
 public:
-	SegaRenderer() : Renderer() {}
-	~SegaRenderer() override {}
+	SCDRenderer() : Renderer() {}
+	~SCDRenderer() override {}
 private:
 };
 
 Renderer *Renderer::createSegaRenderer() {
-	return new SegaRenderer();
+	return new SCDRenderer();
 }
 
 } // End of namespace Snatcher
diff --git a/graphics/module.mk b/graphics/module.mk
index be67b5c3237..2f325c78a48 100644
--- a/graphics/module.mk
+++ b/graphics/module.mk
@@ -60,6 +60,7 @@ MODULE_OBJS := \
 	scaler/thumbnail_intern.o \
 	screen.o \
 	scaler/normal.o \
+	segagfx.o \
 	surface.o \
 	svg.o \
 	transform_struct.o \
diff --git a/graphics/segagfx.cpp b/graphics/segagfx.cpp
new file mode 100644
index 00000000000..474563fb08c
--- /dev/null
+++ b/graphics/segagfx.cpp
@@ -0,0 +1,574 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#include "graphics/segagfx.h"
+#include "graphics/surface.h"
+#include "common/rect.h"
+
+namespace Graphics {
+
+#if SEGA_PERFORMANCE
+#define mRenderLineFragment(hFlip, oddStart, oddEnd, useMask, dst, mask, src, start, end, pal) \
+{ \
+	int rlfOffs = 0; \
+	if (hFlip) \
+		rlfOffs |= 4; \
+	if (oddStart) \
+		rlfOffs |= 2; \
+	if (oddEnd) \
+		rlfOffs |= 1; \
+	if (useMask) \
+		(this->*_renderLineFragmentM[rlfOffs])(dst, mask, src, start, end, pal); \
+	else \
+		(this->*_renderLineFragmentD[rlfOffs])(dst, src, start, end, pal); \
+}
+#else
+#define mRenderLineFragment(hFlip, oddStart, oddEnd, useMask, dst, mask, src, start, end, pal) \
+{ \
+	if (hFlip) \
+		renderLineFragment<true>(dst, mask, src, start, end, pal); \
+	else \
+		renderLineFragment<false>(dst, mask, src, start, end, pal); \
+}
+#endif
+
+SegaRenderer::SegaRenderer() : _prioChainStart(0), _prioChainEnd(0), _pitch(64), _hScrollMode(0), _hScrollTable(0), _vScrollMode(0), _spriteTable(0), _numSpritesMax(0), _spriteMask(0), _backgroundColor(0)
+#if SEGA_PERFORMANCE
+, _renderLineFragmentD(0), _renderLineFragmentM(0)
+#endif
+{
+	_vram = new uint8[0x10000];
+	assert(_vram);
+	memset(_vram, 0, 0x10000 * sizeof(uint8));
+	_vsram = new uint16[40];
+	assert(_vsram);
+	memset(_vsram, 0, 40 * sizeof(uint16));
+
+#if SEGA_PERFORMANCE
+	static const SegaRenderer::renderFuncD funcD[8] = {
+		&SegaRenderer::renderLineFragmentD<false, false, false>,
+		&SegaRenderer::renderLineFragmentD<false, false, true>,
+		&SegaRenderer::renderLineFragmentD<false, true, false>,
+		&SegaRenderer::renderLineFragmentD<false, true, true>,
+		&SegaRenderer::renderLineFragmentD<true, false, false>,
+		&SegaRenderer::renderLineFragmentD<true, false, true>,
+		&SegaRenderer::renderLineFragmentD<true, true, false>,
+		&SegaRenderer::renderLineFragmentD<true, true, true>
+	};
+
+	static const SegaRenderer::renderFuncM funcM[8] = {
+		&SegaRenderer::renderLineFragmentM<false, false, false>,
+		&SegaRenderer::renderLineFragmentM<false, false, true>,
+		&SegaRenderer::renderLineFragmentM<false, true, false>,
+		&SegaRenderer::renderLineFragmentM<false, true, true>,
+		&SegaRenderer::renderLineFragmentM<true, false, false>,
+		&SegaRenderer::renderLineFragmentM<true, false, true>,
+		&SegaRenderer::renderLineFragmentM<true, true, false>,
+		&SegaRenderer::renderLineFragmentM<true, true, true>
+	};
+
+	_renderLineFragmentD = funcD;
+	_renderLineFragmentM = funcM;
+#endif
+
+	setResolution(320, 224);
+}
+
+SegaRenderer::~SegaRenderer() {
+	delete[] _vram;
+	delete[] _vsram;
+	delete[] _spriteMask;
+}
+
+void SegaRenderer::setResolution(int w, int h) {
+	assert(w == 320 || w == 256);
+	assert(h == 224 || h == 240);
+
+	_screenW = w;
+	_screenH = h;
+	_blocksW = w >> 3;
+	_blocksH = h >> 3;
+	_numSpritesMax = w >> 2;
+
+	delete[] _spriteMask;
+	_spriteMask = new uint8[w * h];
+	assert(_spriteMask);
+	memset(_spriteMask, 0, w * h * sizeof(uint8));
+}
+
+void SegaRenderer::setPlaneTableLocation(int plane, uint16 addr) {
+	assert(plane >= kPlaneA && plane <= kWindowPlane);
+	_planes[plane].nameTable = (uint16*)(&_vram[addr]);
+}
+
+void SegaRenderer::setupPlaneAB(int pixelWidth, int pixelHeigth) {
+	for (int i = 0; i < 2; ++i) {
+		if (pixelWidth != -1)
+			_planes[i].w = pixelWidth >> 3;
+		if (pixelHeigth != -1)
+			_planes[i].h = pixelHeigth >> 3;
+		_planes[i].mod = _planes[i].h;
+		_planes[i].nameTableSize = _planes[i].w * _planes[i].h;
+	}
+}
+
+void SegaRenderer::setupWindowPlane(int blockX, int blockY, int horizontalMode, int verticalMode) {
+	if (blockX != -1)
+		_planes[kWindowPlane].blockX = horizontalMode ? blockX : 0;
+	if (blockY != -1)
+		_planes[kWindowPlane].blockY = verticalMode ? blockY : 0;
+	_planes[kWindowPlane].w = horizontalMode ? _blocksW - blockX : blockX;
+	_planes[kWindowPlane].h = verticalMode ? _blocksH - blockY : blockY;
+	_planes[kWindowPlane].mod = _planes[kWindowPlane].blockY + _planes[kWindowPlane].h;
+	_planes[kWindowPlane].nameTableSize = _planes[kWindowPlane].w * _planes[kWindowPlane].h;
+}
+
+void SegaRenderer::setHScrollTableLocation(int addr) {
+	assert(addr <= 0xFFFF);
+	_hScrollTable = (uint16*)(&_vram[addr]);
+}
+
+void SegaRenderer::setSpriteTableLocation(int addr) {
+	assert(addr <= 0xFFFF);
+	_spriteTable = (uint16*)(&_vram[addr]);
+}
+
+void SegaRenderer::setPitch(int pitch) {
+	_pitch = pitch;
+}
+
+void SegaRenderer::setHScrollMode(int mode) {
+	_hScrollMode = mode;
+}
+
+void SegaRenderer::setVScrollMode(int mode) {
+	_vScrollMode = mode;
+}
+
+void SegaRenderer::loadToVRAM(const void *data, uint16 len, uint16 addr) {
+	assert(data);
+	assert(addr + len <= 0x10000);
+	memcpy(_vram + addr, data, len);
+}
+
+void SegaRenderer::memsetVRAM(int addr, uint8 val, int len) {
+	assert(addr + len <= 0x10000);
+	memset(_vram + addr, val, len);
+}
+
+void SegaRenderer::writeUint16VSRAM(int addr, uint16 value) {
+	assert(addr < 80);
+	assert(!(addr & 1));
+	_vsram[addr >> 1] = value;
+}
+
+void SegaRenderer::writeUint8VRAM(int addr, uint8 value) {
+	assert(addr < 0x10000);
+	_vram[addr] = value;
+}
+
+void SegaRenderer::writeUint16VRAM(int addr, uint16 value) {
+	assert(addr < 0x10000);
+	*((uint16*)(_vram + addr)) = value;
+}
+
+void SegaRenderer::clearPlanes() {
+	for (int i = 0; i < 3; ++i) {
+		if (_planes[i].nameTableSize)
+			memset(_planes[i].nameTable, 0, _planes[i].nameTableSize * sizeof(uint16));
+	}
+}
+
+void SegaRenderer::render(Surface *surf, int renderBlockX, int renderBlockY, int renderBlockWidth, int renderBlockHeight, bool spritesOnly) {
+	if ((_screenW != surf->w) || (_screenH != surf->h))
+		error("SegaRenderer::render(): Render target surface needs to be have the same width and height as passed to SegaRenderer::setResolution().");
+
+	if (surf->format.bpp() > 1)
+		error("SegaRenderer::render(): Unsupported color mode in render target surface.");
+
+	render((uint8*)surf->getPixels(), renderBlockX, renderBlockY, renderBlockWidth, renderBlockHeight, spritesOnly);
+}
+
+void SegaRenderer::render(uint8 *dest, int renderBlockX, int renderBlockY, int renderBlockWidth, int renderBlockHeight, bool spritesOnly) {
+	if (renderBlockX == -1)
+		renderBlockX = 0;
+	if (renderBlockY == -1)
+		renderBlockY = 0;
+	if (renderBlockWidth == -1)
+		renderBlockWidth = _blocksW;
+	if (renderBlockHeight == -1)
+		renderBlockHeight = _blocksH;
+
+	assert(dest);
+	uint8 *renderBuffer = dest;
+
+	fillBackground(dest, renderBlockX, renderBlockY, renderBlockWidth, renderBlockHeight);
+
+	// Plane B
+	if (!spritesOnly)
+		renderPlanePart(kPlaneB, renderBuffer, renderBlockX, renderBlockY, renderBlockX + renderBlockWidth, renderBlockY + renderBlockHeight);
+
+	// Plane A (only draw if the nametable is not identical to that of plane B)
+	if (_planes[kPlaneA].nameTable != _planes[kPlaneB].nameTable && !spritesOnly) {
+		// If the window plane is active the rendering of plane A becomes more tedious because the window plane
+		// kind of replaces plane A in the space that is covered by it.
+		if (_planes[kWindowPlane].nameTableSize) {
+			SegaPlane *p = &_planes[kWindowPlane];
+			renderPlanePart(kPlaneA, renderBuffer, MAX<int>(0, renderBlockX), MAX<int>(0, renderBlockY), MIN<int>(p->blockX, renderBlockX + renderBlockWidth), MIN<int>(_blocksH, renderBlockY + renderBlockHeight));
+			renderPlanePart(kPlaneA, renderBuffer, MAX<int>(0, renderBlockX), MAX<int>(0, renderBlockY), MIN<int>(_blocksW, renderBlockX + renderBlockWidth), MIN<int>(p->blockY, renderBlockY + renderBlockHeight));
+			renderPlanePart(kPlaneA, renderBuffer, MAX<int>(p->blockX + p->w, renderBlockX), MAX<int>(0, renderBlockY), MIN<int>(_blocksW, renderBlockX + renderBlockWidth), MIN<int>(_blocksH, renderBlockY + renderBlockHeight));
+			renderPlanePart(kPlaneA, renderBuffer, MAX<int>(0, renderBlockX), MAX<int>(p->blockY + p->h, renderBlockY), MIN<int>(_blocksW, renderBlockX + renderBlockWidth), MIN<int>(_blocksH, renderBlockY + renderBlockHeight));
+		} else {
+			renderPlanePart(kPlaneA, renderBuffer, renderBlockX, renderBlockY, renderBlockX + renderBlockWidth, renderBlockY + renderBlockHeight);
+		}
+	}
+
+	// Window Plane
+	if (_planes[kWindowPlane].nameTableSize && !spritesOnly) {
+		SegaPlane *p = &_planes[kWindowPlane];
+		renderPlanePart(kWindowPlane, renderBuffer, MIN<int>(p->blockX, renderBlockX + renderBlockWidth), MIN<int>(p->blockY, renderBlockY + renderBlockHeight), MAX<int>(p->blockX + p->w, renderBlockX), MAX<int>(p->blockY + p->h, renderBlockY));
+	}
+
+	// Sprites
+	memset(_spriteMask, 0xFF, (uint32)_screenW * (uint32)_screenH * sizeof(uint8));
+	const uint16 *pos = _spriteTable;
+	for (int i = 0; i < _numSpritesMax && pos; ++i) {
+		int y = *pos++ & 0x3FF;
+		uint8 bH = ((*pos >> 8) & 3) + 1;
+		uint8 bW = ((*pos >> 10) & 3) + 1;
+		uint8 next = *pos++ & 0x7F;
+		uint16 pal = ((*pos >> 13) & 3) << 4;
+		bool prio = (*pos & 0x8000);
+		bool hflip = (*pos & 0x800);
+		bool vflip = (*pos & 0x1000);
+		uint16 tile = *pos++ & 0x7FF;
+		int x = *pos & 0x3FF;
+
+		// Sprite masking. Can't happen in EOB at least, since the animator automatically adds 128 to x and y coords for all sprites.
+		// If this triggers anywhere else it will need to be added...
+		assert(!(x == 0 && y >= 128));
+
+		assert(!hflip);
+		assert(!vflip);
+
+		x -= 128;
+		y -= 128;
+
+		/*if ((x >> 3) < renderBlockX) {
+			bW = MIN<int>(0, (int)bW - (renderBlockX - (x >> 3)));
+			x = (renderBlockX << 3);
+
+		}
+
+		if ((y >> 3) < renderBlockY) {
+			bH = MIN<int>(0, (int)bH - (renderBlockY - (y >> 3)));
+			y = (renderBlockY << 3);
+		}
+
+		bW = MIN<int>(bW, renderBlockWidth);
+		bH = MIN<int>(bH, renderBlockHeight);*/
+
+		uint8 *dst = renderBuffer + y * _screenW + x;
+		uint8 *msk = _spriteMask + y * _screenW + x;
+
+		for (int blX = 0; blX < bW; ++blX) {
+			uint8 *dst2 = dst;
+			uint8 *msk2 = msk;
+			for (int blY = 0; blY < bH; ++blY) {
+				renderSpriteTile(dst, msk, x + (blX << 3), y + (blY << 3), tile++, pal, vflip, hflip, prio);
+				dst += (_screenW << 3);
+				msk += (_screenW << 3);
+			}
+			dst = dst2 + 8;
+			msk = msk2 + 8;
+		}
+
+		pos = next ? &_spriteTable[next << 2] : 0;
+	}
+
+	// Priority Tiles
+	// Instead of going through all rendering passes for all planes again (only now drawing the
+	// prio tiles instead of the non-priority tiles) I have collected the data for the priority
+	// tiles on the way and put that data into a chain. Should be faster...
+	for (PrioTileRenderObj *e = _prioChainStart; e; e = e->_next)
+		mRenderLineFragment(e->_hflip, e->_start & 1, e->_end & 1, e->_mask, e->_dst, e->_mask, e->_src, e->_start, e->_end, e->_pal)
+
+	clearPrioChain();
+}
+
+void SegaRenderer::fillBackground(uint8 *dst, int blockX, int blockY, int blockW, int blockH) {
+	uint32 *pos = (uint32*)(dst + (blockY << 3) * _screenW + (blockX << 3));
+	blockW <<= 1;
+	blockH <<= 3;
+	int pitch = _screenW >> 2;
+
+	uint32 fill = (_backgroundColor << 24) | (_backgroundColor << 16) | (_backgroundColor << 8) | _backgroundColor;
+	while (blockH--) {
+		uint32 *pos2 = pos;
+		for (int x = 0; x < blockW; ++x)
+			*pos2++ = fill;
+		pos += pitch;
+	}
+}
+
+void SegaRenderer::renderPlanePart(int plane, uint8 *dstBuffer, int x1, int y1, int x2, int y2) {
+	SegaPlane *p = &_planes[plane];
+	uint8 *dst = dstBuffer + (y1 << 3) * _screenW + (x1 << 3);
+
+	for (int y = y1; y < y2; ++y) {
+		int hScrollTableIndex = (plane == kWindowPlane) ? -1 : (_hScrollMode == kHScrollFullScreen) ? plane : (y1 << 4) + plane;
+		uint8 *dst2 = dst;
+		for (int x = x1; x < x2; ++x) {
+			int vScrollTableIndex = (plane == kWindowPlane) ? -1 : (_vScrollMode == kVScrollFullScreen) ? plane : (x & ~1) + plane;
+			uint16 vscrNt = 0;
+			uint16 vscrPxStart = 0;
+			uint16 vscrPxEnd = 8;
+
+			if (vScrollTableIndex != -1) {
+				vscrNt = _vsram[vScrollTableIndex] & 0x3FF;
+				vscrPxStart = vscrNt & 7;
+				vscrNt >>= 3;
+			}
+
+			int ty = (vscrNt + y) % p->mod;
+
+			renderPlaneTile(dst, x, &p->nameTable[ty * _pitch], vscrPxStart, vscrPxEnd, hScrollTableIndex, _pitch);
+
+			if (vscrPxStart) {
+				ty = (ty + 1) % p->mod;
+				uint16 dstOffs = (vscrPxEnd - vscrPxStart) * _screenW;
+				vscrPxEnd = vscrPxStart;
+				vscrPxStart = 0;
+				renderPlaneTile(dst + dstOffs, x, &p->nameTable[ty * _pitch], vscrPxStart, vscrPxEnd, hScrollTableIndex, _pitch);
+			}
+			dst += 8;
+		}
+		dst = dst2 + (_screenW << 3);
+	}
+}
+
+void SegaRenderer::renderPlaneTile(uint8 *dst, int ntblX, const uint16 *ntblLine, int vScrollLSBStart, int vScrollLSBEnd, int hScrollTableIndex, uint16 pitch) {
+	for (int bY = vScrollLSBStart; bY < vScrollLSBEnd; ++bY) {
+		uint8 *dst2 = dst;
+		uint16 hscrNt = 0;
+		uint16 hscrPx = 0;
+
+		if (hScrollTableIndex != -1) {
+			hscrNt = (-_hScrollTable[hScrollTableIndex]) & 0x3FF;
+			hscrPx = hscrNt & 7;
+			hscrNt >>= 3;
+		}
+
+		const uint16 *pNt = &ntblLine[(ntblX + hscrNt) % pitch];
+		if (pNt < (const uint16*)(&_vram[0x10000])) {
+			uint16 nt = *pNt;
+			uint16 pal = ((nt >> 13) & 3) << 4;
+			bool hflip = (nt & 0x800);
+			int y = bY % 8;
+			if (nt & 0x1000) // vflip
+				y = 7 - y;
+
+			// We skip the priority tiles here and draw them later
+			if (nt & 0x8000)
+				initPrioRenderTask(dst, 0, &_vram[((nt & 0x7FF) << 5) + (y << 2) + (hscrPx >> 1)], hscrPx, 8, pal, hflip);
+			else
+				mRenderLineFragment(hflip, hscrPx & 1, 0, 0, dst, 0, &_vram[((nt & 0x7FF) << 5) + (y << 2) + (hscrPx >> 1)], hscrPx, 8, pal);
+		}
+
+		if (hscrPx) {
+			dst += (8 - hscrPx);
+			pNt = &ntblLine[(ntblX + hscrNt + 1) % pitch];
+			if (pNt < (const uint16*)(&_vram[0x10000])) {
+				uint16 nt = *pNt;
+				uint16 pal = ((nt >> 13) & 3) << 4;
+				bool hflip = (nt & 0x800);
+				int y = bY % 8;
+				if (nt & 0x1000) // vflip
+					y = 7 - y;
+
+				// We skip the priority tiles here and draw them later
+				if (nt & 0x8000)
+					initPrioRenderTask(dst, 0, &_vram[((nt & 0x7FF) << 5) + (y << 2)], 0, hscrPx, pal, hflip);
+				else
+					mRenderLineFragment(hflip, 0, hscrPx & 1, 0, dst, 0, &_vram[((nt & 0x7FF) << 5) + (y << 2)], 0, hscrPx, pal)
+			}
+		}
+
+		if (hScrollTableIndex != -1 && _hScrollMode == kHScroll1PixelRows)
+			hScrollTableIndex += 2;
+		dst = dst2 + _screenW;
+	}
+}
+
+#undef vflip
+
+void SegaRenderer::renderSpriteTile(uint8 *dst, uint8 *mask, int x, int y, uint16 tile, uint8 pal, bool vflip, bool hflip, bool prio) {
+	if (y <= -8 || y >= _screenH || x <= -8 || x >= _screenW)
+		return;
+
+	const uint8 *src = &_vram[tile << 5];
+	if (vflip)
+		src += 31;
+
+	if (y < 0) {
+		dst -= (y * _screenW);
+		mask -= (y * _screenW);
+	} if (x < 0) {
+		dst -= x;
+		mask -= x;
+	}
+
+	int xstart = CLIP<int>(-x, 0, 7);
+	int xend = CLIP<int>(_screenW - x, 0, 8);
+	src += (xstart >> 1);
+
+	int ystart = CLIP<int>(-y, 0, 7);
+	int yend = CLIP<int>(_screenH - y, 0, 8);
+	src += (ystart << 2);
+
+	for (int bY = ystart; bY < yend; ++bY) {
+		uint8 *dst2 = dst;
+		uint8 *msk2 = mask;
+
+		if (prio)
+			initPrioRenderTask(dst, mask, src, xstart, xend, pal, hflip);
+		else
+			mRenderLineFragment(hflip, xstart & 1, xend & 1, 1, dst, mask, src, xstart, xend, pal);
+
+		src += 4;
+		dst = dst2 + _screenW;
+		mask = msk2 + _screenW;
+	}
+}
+
+#if SEGA_PERFORMANCE
+template<bool hflip, bool oddStart, bool oddEnd> void SegaRenderer::renderLineFragmentM(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal) {
+	if (hflip)
+		src += ((end - 1 - start) >> 1);
+
+	for (int i = (end - start) >> 1; i; --i) {
+		uint8 col = hflip ? (oddEnd ? *src-- >> 4 : *src & 0x0F) : (oddStart ? *src++ & 0x0F : *src >> 4);
+		uint8 col2 = hflip ? (oddEnd ? *src & 0x0F : *src-- >> 4) : (oddStart ? *src >> 4 : *src++ & 0x0F);
+		if (col & *mask) {
+			*dst = pal | col;
+			*mask = 0;
+		}
+		dst++;
+		mask++;
+		if (col2 & *mask) {
+			*dst = pal | col2;
+			*mask = 0;
+		}
+		dst++;
+		mask++;
+	}
+	if (oddStart != oddEnd) {
+		uint8 col = hflip ? (oddEnd ? *src-- >> 4 : *src & 0x0F) : (oddStart ? *src++ & 0x0F : *src >> 4);
+		if (col & *mask) {
+			*dst = pal | col;
+			*mask = 0;
+		}
+		dst++;
+		mask++;
+	}
+}
+
+template<bool hflip, bool oddStart, bool oddEnd> void SegaRenderer::renderLineFragmentD(uint8 *dst, const uint8 *src, int start, int end, uint8 pal) {
+	if (hflip)
+		src += ((end - 1 - start) >> 1);
+
+	for (int i = (end - start) >> 1; i; --i) {
+		uint8 col = hflip ? (oddEnd ? *src-- >> 4 : *src & 0x0F) : (oddStart ? *src++ & 0x0F : *src >> 4);
+		uint8 col2 = hflip ? (oddEnd ? *src & 0x0F : *src-- >> 4) : (oddStart ? *src >> 4 : *src++ & 0x0F);
+		if (col)
+			*dst = pal | col;
+		dst++;
+		if (col2)
+			*dst = pal | col2;
+		dst++;
+	}
+	if (oddStart != oddEnd) {
+		uint8 col = hflip ? (oddEnd ? *src-- >> 4 : *src & 0x0F) : (oddStart ? *src++ & 0x0F : *src >> 4);
+		if (col)
+			*dst = pal | col;
+		dst++;
+	}
+}
+#else
+template<bool hflip> void SegaRenderer::renderLineFragment(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal) {
+	if (hflip) {
+		src += ((end - 1 - start) >> 1);
+		if (end & 1) {
+			start++;
+			end++;
+		}
+	}
+
+	if (mask) {
+		for (int bX = start; bX < end; ++bX) {
+			uint8 col = hflip ? ((bX & 1) ? *src-- >> 4 : *src & 0x0F) : ((bX & 1) ? *src++ & 0x0F : *src >> 4);
+			if (col & *mask) {
+				*dst = pal | col;
+				*mask = 0;
+			}
+			dst++;
+			mask++;
+		}
+	} else {
+		for (int bX = start; bX < end; ++bX) {
+			uint8 col = hflip ? ((bX & 1) ? *src-- >> 4 : *src & 0x0F) : ((bX & 1) ? *src++ & 0x0F : *src >> 4);
+			if (col)
+				*dst = pal | col;
+			dst++;
+		}
+	}
+}
+#endif
+
+#undef mRenderLineFragment
+
+void SegaRenderer::initPrioRenderTask(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal, bool hflip) {
+#if SEGA_USE_MEMPOOL
+	_prioChainEnd =	new (_prioRenderMemPool) PrioTileRenderObj(_prioChainEnd, dst, mask, src, start, end, pal, hflip);
+#else
+	_prioChainEnd = new PrioTileRenderObj(_prioChainEnd, dst, mask, src, start, end, pal, hflip);
+#endif
+	if (!_prioChainStart)
+		_prioChainStart = _prioChainEnd;
+}
+
+void SegaRenderer::clearPrioChain() {
+	while (_prioChainEnd) {
+		_prioChainEnd->_next = 0;
+		PrioTileRenderObj *e = _prioChainEnd->_pred;
+#if SEGA_USE_MEMPOOL
+		_prioRenderMemPool.deleteChunk(_prioChainEnd);
+#else
+		delete _prioChainEnd;
+#endif
+		_prioChainEnd = e;
+	}
+	_prioChainStart = 0;
+}
+
+} // End of namespace Graphics
+
diff --git a/graphics/segagfx.h b/graphics/segagfx.h
new file mode 100644
index 00000000000..1558d9b18b0
--- /dev/null
+++ b/graphics/segagfx.h
@@ -0,0 +1,264 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef GRAPHICS_SEGAGFX_H
+#define GRAPHICS_SEGAGFX_H
+
+#define SEGA_PERFORMANCE		true
+#define SEGA_USE_MEMPOOL		true
+
+#if SEGA_USE_MEMPOOL
+#include "common/memorypool.h"
+#endif
+
+namespace Graphics {
+
+struct Surface;
+
+/**
+ * SegaRenderer
+ *
+ * This class allows rendering the content of a virtual Sega VDP video ram (including all planes with their respective
+ * coords and scroll states and including sprites) to a "normal" CLUT8 buffer. It can be used as a base class to have
+ * better access to the vram (see e. g. EOB I SegaCD). The renderer handles the 4 palettes of the VDP (with 16 colors
+ * each) by flagging the pixels with (paletteNo << 4), e. g. a pixel of palette 1, color 5 will be rendered as 0x15.
+ * This has to be kept in mind when writing the palette code for your engine. Also, there is no parsing of control
+ * register opcodes to set up plane dimensions, table locations etc., since I didn't see any need for that. This has
+ * to be done through the public setup methods of the renderer.
+ */
+class SegaRenderer {
+public:
+	enum Plane {
+		kPlaneA = 0,
+		kPlaneB = 1,
+		kWindowPlane = 2
+	};
+
+	enum WindowMode {
+		kWinToLeft = 0,
+		kWinToTop = 0,
+		kWinToRight = 1,
+		kWinToBottom = 1
+	};
+
+	enum HScrollMode {
+		kHScrollFullScreen = 0,
+		kHScroll8PixelRows,
+		kHScroll1PixelRows
+	};
+
+	enum VScrollMode {
+		kVScrollFullScreen = 0,
+		kVScroll16PixelStrips
+	};
+
+public:
+	SegaRenderer();
+	~SegaRenderer();
+
+	/**
+	 * Set target render buffer resolution for internal purposes of this renderer only. It will not interact in any way with the ScummVM backend.
+	 * @param w:		pixel width, 320 or 256 allowed
+	 * @param h:		pixel height, 224 or 240 allowed
+	 */
+	void setResolution(int w, int h);
+
+	/**
+	 * Set address for a plane's nametable.
+	 * @param plane:	plane id (from Plane enum)
+	 * @param addr:		address in the vdp vram
+	 */
+	void setPlaneTableLocation(int plane, uint16 addr);
+
+	/**
+	 * Set pixel width and/or height for planes A and B.
+	 * @param pixelWidth:	1024, 512 or 256 allowed
+	 * @param pixelHeight:	1024, 512 or 256 allowed
+	 *
+	 * The hardware allows/demands separate modification of the vertical and horizontal properties.
+	 * To allow this without making another function one of the pixelWidth/pixelHeight parameters
+	 * can be set to -1 which will keep the existing value for that property.
+	 */
+	void setupPlaneAB(int pixelWidth, int pixelHeigth);
+
+	/**
+	 * Set pixel width and/or height and drawing mode for the window plane.
+	 * @param pixelWidth:		1024, 512 or 256 allowed
+	 * @param pixelHeight:		1024, 512 or 256 allowed
+	 * @param horizontalMode:	kWinToLeft or kWinToRight
+	 * @param verticalMode:		kWinToTop or kWinToBottom
+	 *
+	 * The hardware allows/demands separate modification of the vertical and horizontal properties.
+	 * To allow this without making another function one of the pixelWidth/pixelHeight parameters
+	 * can be set to -1 which will keep the existing value for that property.
+	 */
+	void setupWindowPlane(int blockX, int blockY, int horizontalMode, int verticalMode);
+
+	/**
+	 * Set address for the horizontal scroll table.
+	 * @param addr:		address in the vdp vram
+	 */
+	void setHScrollTableLocation(int addr);
+
+	/**
+	 * Set address for the sprite table.
+	 * @param addr:		address in the vdp vram
+	 */
+	void setSpriteTableLocation(int addr);
+
+	/**
+	 * Set plane pitch in (8 pixels wide) blocks.
+	 * @param pitch:	pitch
+	 */
+	void setPitch(int pitch);
+
+	/**
+	 * Set horizontal scroll mode.
+	 * @param mode:		see enum HScrollMode
+	 */
+	void setHScrollMode(int mode);
+
+	/**
+	 * Set vertical scroll mode.
+	 * @param mode:		see enum VScrollMode
+	 */
+	void setVScrollMode(int mode);
+
+	/**
+	 * Load data from a buffer to a vram address.
+	 * @param data:		source data ptr
+	 * @param len:		byte size of data
+	 * @param addr:		target address in the vdp vram
+	 */
+	void loadToVRAM(const void *data, uint16 len, uint16 addr);
+
+	/**
+	 * Fill vram area with bytes of the specified value.
+	 * @param addr:		target address in the vdp vram
+	 * @param val:		fill value
+	 * @param len:		byte size of fill area
+	 */
+	void memsetVRAM(int addr, uint8 val, int len);
+
+	/**
+	 * Write uint16 value into vs ram. No endianness corrections take place here.
+	 * @param addr:		target address in the vdp vs ram
+	 * @param val:		value
+	 */
+	void writeUint16VSRAM(int addr, uint16 value);
+
+	/**
+	 * Write uint8 value into vram.
+	 * @param addr:		target address in the vdp vram
+	 * @param val:		value
+	 */
+	void writeUint8VRAM(int addr, uint8 value);
+
+	/**
+	 * Write uint16 value into vram. No endianness corrections take place here.
+	 * @param addr:		target address in the vdp vram
+	 * @param val:		value
+	 */
+	void writeUint16VRAM(int addr, uint16 value);
+
+	/**
+	 * Fills all planes with 0.
+	 */
+	void clearPlanes();
+
+	/**
+	 * Render vram in its current state to the target buffer/surface.
+	 * @param surf/dest:		target surface or buffer
+	 * @param renderBlockX, renderBlockY, renderBlockWidth, renderBlockHeight:
+								block (8x8 pixels) coordinates of target render area. Values of -1 for maximum range / full screen rendering.
+	 * @param spritesOnly:		skip rendering of the planes and only render the sprites.
+	 */
+	void render(Surface *surf, int renderBlockX = -1, int renderBlockY = -1, int renderBlockWidth = -1, int renderBlockHeight = -1, bool spritesOnly = false);
+	void render(uint8 *dest, int renderBlockX = -1, int renderBlockY = -1, int renderBlockWidth = -1, int renderBlockHeight = -1, bool spritesOnly = false);
+
+protected:
+	uint16 _screenW, _screenH, _blocksW, _blocksH;
+	uint8 *_vram;
+	uint16 *_vsram;
+	uint16 _pitch;
+
+private:
+	void fillBackground(uint8 *dst, int x, int y, int w, int h);
+	void renderPlanePart(int plane, uint8 *dstBuffer, int x1, int y1, int x2, int y2);
+	void renderPlaneTile(uint8 *dst, int destX, const uint16 *nameTable, int vScrollLSBStart, int vScrollLSBEnd, int hScrollTableIndex, uint16 pitch);
+	void renderSpriteTile(uint8 *dst, uint8 *mask, int x, int y, uint16 tile, uint8 pal, bool vflip, bool hflip, bool prio);
+#if SEGA_PERFORMANCE
+	template<bool hflip, bool oddStart, bool oddEnd> void renderLineFragmentM(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal);
+	template<bool hflip, bool oddStart, bool oddEnd> void renderLineFragmentD(uint8 *dst, const uint8 *src, int start, int end, uint8 pal);
+	typedef void(SegaRenderer::*renderFuncM)(uint8*, uint8*, const uint8*, int, int, uint8);
+	typedef void(SegaRenderer::*renderFuncD)(uint8*, const uint8*, int, int, uint8);
+	const renderFuncM *_renderLineFragmentM;
+	const renderFuncD *_renderLineFragmentD;
+#else
+	template<bool hflip> void renderLineFragment(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal);
+#endif
+
+	void initPrioRenderTask(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal, bool hflip);
+	void clearPrioChain();
+
+	struct SegaPlane {
+		SegaPlane() : blockX(0), blockY(0), w(0), h(0), mod(0), nameTable(0), nameTableSize(0) {}
+		int blockX, blockY;
+		uint16 w, h, mod;
+		uint16 *nameTable;
+		uint16 nameTableSize;
+	};
+
+	SegaPlane _planes[3];
+	uint16 *_hScrollTable;
+	uint16 *_spriteTable;
+	uint8 *_spriteMask;
+	uint8 _hScrollMode;
+	uint8 _vScrollMode;
+	uint16 _numSpritesMax;
+	uint8 _backgroundColor;
+
+	struct PrioTileRenderObj {
+		PrioTileRenderObj(PrioTileRenderObj *chainEnd, uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal, bool hflip) :
+			_pred(chainEnd), _next(0), _dst(dst), _mask(mask), _src(src), _start(start), _end(end), _pal(pal), _hflip(hflip) {
+			if (_pred)
+				_pred->_next = this;
+		}
+		uint8 *_dst;
+		uint8 *_mask;
+		const uint8 *_src;
+		int _start;
+		int _end;
+		uint8 _pal;
+		bool _hflip;
+		PrioTileRenderObj *_pred;
+		PrioTileRenderObj *_next;
+	};
+
+#if SEGA_USE_MEMPOOL
+	Common::ObjectPool<PrioTileRenderObj> _prioRenderMemPool;
+#endif
+	PrioTileRenderObj *_prioChainStart, *_prioChainEnd;
+};
+
+} // End of namespace Graphics
+
+#endif // GRAPHICS_SEGAGFX_H


Commit: ef50122ff55cd62e0c6ca39ac3d10c6ea88a8ecd
    https://github.com/scummvm/scummvm/commit/ef50122ff55cd62e0c6ca39ac3d10c6ea88a8ecd
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: start work on graphics code

More skeleton code. This is still in the early research/experiment stage. Add palette handling (this should actually be quite usable already).

Changed paths:
  A engines/snatcher/palette.h
  A engines/snatcher/palette_scd.cpp
  A engines/snatcher/palevent_scd.h
  A engines/snatcher/scene.h
  A engines/snatcher/scene/scene_d0.cpp
  A engines/snatcher/scene/scene_d1.cpp
  A engines/snatcher/scene/scene_d2.cpp
  A engines/snatcher/scene_imp.h
    engines/snatcher/detection.h
    engines/snatcher/detection_tables.h
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/module.mk
    engines/snatcher/render.h
    engines/snatcher/render_scd.cpp
    engines/snatcher/resource.cpp
    engines/snatcher/resource.h
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h


diff --git a/engines/snatcher/detection.h b/engines/snatcher/detection.h
index a75ed8edd52..8bf7780a8cf 100644
--- a/engines/snatcher/detection.h
+++ b/engines/snatcher/detection.h
@@ -35,6 +35,7 @@ struct GameDescription {
 	int soundOptions;
 	Common::Language lang;
 	Common::Platform platform;
+	bool isBigEndian;
 
 	// language overwrites of fan translations (only needed for multilingual games)
 	Common::Language fanLang;
diff --git a/engines/snatcher/detection_tables.h b/engines/snatcher/detection_tables.h
index c770a0d70d1..2b501b1f2ad 100644
--- a/engines/snatcher/detection_tables.h
+++ b/engines/snatcher/detection_tables.h
@@ -21,10 +21,10 @@
 
 namespace {
 
-#define FLAGS(id, sound) { id, sound, Common::UNK_LANG, Common::kPlatformUnknown, Common::UNK_LANG, Common::UNK_LANG }
-#define FLAGS_FAN(id, sound, fanLang, repLang) { id, sound, Common::UNK_LANG, Common::kPlatformUnknown, fanLang, repLang }
+#define FLAGS(id, a, b) { id, a, Common::UNK_LANG, Common::kPlatformUnknown, b, Common::UNK_LANG, Common::UNK_LANG }
+#define FLAGS_FAN(id, a, b, fanLang, repLang) { id, a, Common::UNK_LANG, Common::kPlatformUnknown, b, fanLang, repLang }
 
-#define SNATCHER_FLAGS(sound) FLAGS(Snatcher::GI_SNATCHER, sound)
+#define SNATCHER_FLAGS(a, b) FLAGS(Snatcher::GI_SNATCHER, a, b)
 
 const SnatcherGameDescription adGameDescs[] = {
 	{
@@ -38,10 +38,10 @@ const SnatcherGameDescription adGameDescs[] = {
 			ADGF_TESTING,
 			GUIO2(GUIO_NOSPEECHVOLUME, GUIO_MIDISEGACD)
 		},
-		SNATCHER_FLAGS(MDT_SEGACD)
+		SNATCHER_FLAGS(MDT_SEGACD, true)
 	},
 
-	{ AD_TABLE_END_MARKER, FLAGS(0, MDT_NONE) }
+	{ AD_TABLE_END_MARKER, FLAGS(0, MDT_NONE, false) }
 };
 
 const PlainGameDescriptor gameList[] = {
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 4c7a128930f..b53ea2244ae 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -19,18 +19,35 @@
 *
 */
 
+#include "snatcher/palette.h"
 #include "snatcher/render.h"
 #include "snatcher/graphics.h"
 
+#include "common/system.h"
+
 namespace Snatcher {
 
-GraphicsEngine::GraphicsEngine(Common::Platform platform) : _renderer(0) {
+GraphicsEngine::GraphicsEngine(OSystem *system, Common::Platform platform) : _system(system), _renderer(0) {
 	_renderer = Renderer::create(platform);
+	_palette = Palette::create(_system->getPaletteManager(), platform);
 	assert(_renderer);
 }
 
 GraphicsEngine::~GraphicsEngine() {
 	delete _renderer;
+	delete _palette;
+}
+
+void GraphicsEngine::enqueuePaletteEvent(const uint8 *data, uint32 curPos) {
+	_palette->enqueueEvent(data, curPos);
+}
+
+void GraphicsEngine::nextFrame() {
+	//if (!_skipManyEvents) {
+		//_blockPalEvent = false;
+		_palette->processEventQueue();
+	//}
+	_system->updateScreen();
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 52d27219107..921b71f9132 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -22,19 +22,31 @@
 #ifndef SNATCHER_GRAPHICS_H
 #define SNATCHER_GRAPHICS_H
 
+#include "snatcher/render.h"
 #include "common/platform.h"
 
+class OSystem;
+
 namespace Snatcher {
 
-class Renderer;
+class Palette;
 
 class GraphicsEngine {
 public:
-	GraphicsEngine(Common::Platform platform);
+	GraphicsEngine(OSystem *system, Common::Platform platform);
 	~GraphicsEngine();
 
+	void enqueuePaletteEvent(const uint8 *data, uint32 curPos);
+
+	void nextFrame();
+
+	uint16 screenWidth() const { return _renderer ? _renderer->screenWidth() : 0; }
+	uint16 screenHeight() const { return _renderer ? _renderer->screenHeight() : 0; }
+
 private:
 	Renderer *_renderer;
+	Palette *_palette;
+	OSystem *_system;
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index fdce0b469e6..47240329921 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -3,8 +3,12 @@ MODULE := engines/snatcher
 MODULE_OBJS := \
 	graphics.o \
 	metaengine.o \
+	palette_scd.o \
 	render_scd.o \
 	resource.o \
+	scene/scene_d0.o \
+	scene/scene_d1.o \
+	scene/scene_d2.o \
 	snatcher.o \
 	sound.o \
 	sound_device_null.o \
diff --git a/engines/snatcher/palette.h b/engines/snatcher/palette.h
new file mode 100644
index 00000000000..2206d6aa69b
--- /dev/null
+++ b/engines/snatcher/palette.h
@@ -0,0 +1,59 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_PALETTE_H
+#define SNATCHER_PALETTE_H
+
+#include "common/platform.h"
+
+class PaletteManager;
+
+namespace Snatcher {
+
+class Palette {
+public:
+	Palette(PaletteManager *pm) : _palMan(pm) {}
+	virtual ~Palette() {}
+
+	virtual bool enqueueEvent(const uint8*, uint32) { return true; }
+	virtual void processEventQueue() {}
+
+protected:
+	PaletteManager *_palMan;
+
+private:
+	static Palette *createSegaPalette(PaletteManager *pm);
+
+public:
+	static Palette *create(PaletteManager *pm, Common::Platform platform) {
+		switch (platform) {
+		case Common::kPlatformSegaCD:
+			return createSegaPalette(pm);
+		default:
+			break;
+		};
+		return 0;
+	}
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_PALETTE_H
diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
new file mode 100644
index 00000000000..652c397ef53
--- /dev/null
+++ b/engines/snatcher/palette_scd.cpp
@@ -0,0 +1,390 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "snatcher/palette.h"
+#include "snatcher/palevent_scd.h"
+
+#include "common/algorithm.h"
+#include "common/array.h"
+#include "common/endian.h"
+#include "common/func.h"
+#include "common/textconsole.h"
+#include "graphics/paletteman.h"
+
+namespace Snatcher {
+
+class SCDPalette : public Palette {
+public:
+	SCDPalette(PaletteManager *pm);
+	~SCDPalette() override;
+
+	bool enqueueEvent(const uint8 *data, uint32 curPos) override;
+	void processEventQueue() override;
+
+private:
+	typedef Common::Functor1Mem<PalEventSCD*, void, SCDPalette> EventProc;
+	Common::Array<EventProc*> _eventProcs;
+
+	void event_palSet(PalEventSCD *evt);
+	void event_palFadeFromBlack(PalEventSCD *evt);
+	void event_palFadeToBlack(PalEventSCD *evt);
+	void event_palFadeFromWhite(PalEventSCD *evt);
+	void event_palFadeToWhite(PalEventSCD *evt);
+	void event_palCycle(PalEventSCD *evt);
+	void event_palFadeToColor(PalEventSCD *evt);
+	void event_palFade2(PalEventSCD *evt);
+	void event_palFadeFrom(PalEventSCD *evt);
+	void event_palClear(PalEventSCD *evt);
+
+	bool updateDelay(PalEventSCD *evt);
+	void fadeStep(uint16 *modColor, uint16 toR, uint16 toG, uint16 toB);
+
+	void updateSystemPalette();
+
+	PalEventSCD *_eventQueue;
+	PalEventSCD *_eventCurPos;
+
+	uint16 *_colors;
+	uint8 *_internalPalette;
+	uint8 _updateFlags;
+};
+
+SCDPalette::SCDPalette(PaletteManager *pm) : Palette(pm), _eventProcs(), _eventQueue(0), _eventCurPos(0), _colors(0), _internalPalette(0), _updateFlags(0) {
+#define P_OP(a)	_eventProcs.push_back(new EventProc(this, &SCDPalette::event_##a));
+	_eventProcs.push_back(0);
+	P_OP(palSet);
+	P_OP(palFadeFromBlack);
+	P_OP(palFadeToBlack);
+	P_OP(palFadeFromWhite);
+	P_OP(palFadeToWhite);
+	P_OP(palCycle);
+	P_OP(palFadeToColor);
+	P_OP(palFade2);
+	P_OP(palFadeFrom);
+	P_OP(palClear);
+#undef P_OP
+
+	_eventQueue = _eventCurPos = new PalEventSCD[12];
+	memset(_eventQueue, 0, 12 * sizeof(PalEventSCD));
+	_colors = new uint16[128];
+	memset(_colors, 0, 128 * sizeof(uint16));
+	_internalPalette = new uint8[256];
+	memset(_internalPalette, 0, 256 * sizeof(uint8));
+}
+
+SCDPalette::~SCDPalette() {
+	delete[] _eventQueue;
+	delete[] _colors;
+	delete[] _internalPalette;
+
+	for (Common::Array<EventProc*>::iterator i = _eventProcs.begin(); i != _eventProcs.end(); ++i)
+		delete *i;
+}
+
+bool SCDPalette::enqueueEvent(const uint8 *data, uint32 curPos) {
+	const uint8 *dataStart = data;
+	data = &data[curPos];
+
+	for (int i = 0; i < 12; ++i) {
+		if (++_eventCurPos > &_eventQueue[11])
+			_eventCurPos = _eventQueue;
+		if (_eventCurPos->cmd)
+			continue;
+
+		_eventCurPos->cmd = *data++;
+		_eventCurPos->delay = *data++;
+		_eventCurPos->countDown = 0;
+		_eventCurPos->destOffset = *data++;
+		_eventCurPos->len = (*data++) + 1;
+		_eventCurPos->srcOffsets = _eventCurPos->srcOffsetCur = (uint32*)data;
+		_eventCurPos->srcOrig = dataStart;
+		_eventCurPos->progress = 0;
+
+		if (_eventCurPos->cmd & 0x80) {
+			_eventCurPos->cmd &= ~0x80;
+			for (int ii = 0; ii < 12; ++ii) {
+				if (_eventQueue[ii].cmd == 6)
+					_eventQueue[ii].cmd = 0;
+			}
+		}
+		return true;
+	}
+
+	return false;
+}
+
+void SCDPalette::processEventQueue() {
+	PalEventSCD *p = _eventCurPos;
+	for (int i = 0; i < 12; ++i) {
+		if (++p > &_eventQueue[11])
+			p = _eventQueue;
+
+		if (!p->cmd)
+			continue;
+
+		if (p->cmd > _eventProcs.size())
+			error("SCDPalette::processEventQueue(): Invalid opcode 0x%02x", p->cmd);
+
+		if (_eventProcs[p->cmd]->isValid())
+			(*_eventProcs[p->cmd])(p);
+	}
+
+	//if (_updateFlags & 1)
+		updateSystemPalette();
+
+	//if (_updateFlags & 2)
+		updateSystemPalette();
+	_updateFlags = 0;
+}
+
+void SCDPalette::event_palSet(PalEventSCD *evt) {
+	if (updateDelay(evt))
+		return;
+
+	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
+	assert(srcOffs >= 0x28000);
+	const uint16 *src = (const uint16*)&evt->srcOrig[srcOffs - 0x28000];
+
+	for (int i = 0; i < evt->len; ++i)
+		*dst++ = READ_BE_UINT16(src++);
+
+	if (READ_BE_UINT16(++evt->srcOffsetCur) == 0xFFFF)
+		evt->cmd = 0;	
+}
+
+void SCDPalette::event_palFadeFromBlack(PalEventSCD *evt) {
+	uint16 *dst = &_colors[evt->destOffset >> 1];
+	Common::fill<uint16*, uint16>(dst, &dst[evt->len], 0);
+	evt->cmd = 9;
+	event_palFadeFrom(evt);
+}
+
+void SCDPalette::event_palFadeToBlack(PalEventSCD *evt) {
+	if (updateDelay(evt))
+		return;
+
+	uint16 *dst = &_colors[evt->destOffset >> 1];
+	for (int i = 0; i < evt->len; ++i) {
+		if (*dst & 0xF)
+			*dst -= 0x2;
+		if (*dst & 0xF0)
+			*dst -= 0x20;
+		if (*dst & 0xF00)
+			*dst -= 0x200;
+	}
+	if (++evt->progress == 8)
+		evt->cmd = 0;
+}
+
+void SCDPalette::event_palFadeFromWhite(PalEventSCD *evt) {
+	uint16 *dst = &_colors[evt->destOffset >> 1];
+	Common::fill<uint16*, uint16>(dst, &dst[evt->len], 0xEEE);
+	evt->cmd = 9;
+	event_palFadeFrom(evt);
+}
+
+void SCDPalette::event_palFadeToWhite(PalEventSCD *evt) {
+	if (updateDelay(evt))
+		return;
+
+	uint16 *dst = &_colors[evt->destOffset >> 1];
+	for (int i = 0; i < evt->len; ++i) {
+		if ((*dst & 0xF) < 0xE)
+			*dst += 0x2;
+		if ((*dst & 0xF0) < 0xE0)
+			*dst += 0x20;
+		if ((*dst & 0xF00) < 0xE00)
+			*dst += 0x200;
+	}
+	if (++evt->progress == 8)
+		evt->cmd = 0;
+}
+
+void SCDPalette::event_palCycle(PalEventSCD *evt) {
+	if (updateDelay(evt))
+		return;
+
+	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
+	assert(srcOffs >= 0x28000);
+	const uint16 *src = (const uint16*)&evt->srcOrig[srcOffs - 0x28000];
+
+	for (int i = 0; i < evt->len; ++i)
+		*dst++ = READ_BE_UINT16(src++);
+
+	if (READ_BE_UINT16(++evt->srcOffsetCur) == 0xFFFF)
+		evt->srcOffsetCur = evt->srcOffsets;
+}
+
+void SCDPalette::event_palFadeToColor(PalEventSCD *evt) {
+	if (updateDelay(evt))
+		return;
+
+	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
+	assert(srcOffs >= 0x28000);
+	uint16 col = READ_BE_UINT16(&evt->srcOrig[srcOffs - 0x28000]);
+
+	for (int i = 0; i < evt->len; ++i)
+		fadeStep(dst++, col & 0xF, col & 0xF0, col & 0xF00);
+
+	if (++evt->progress == 8)
+		evt->cmd = 0;
+}
+
+void SCDPalette::event_palFade2(PalEventSCD *evt) {
+	if (updateDelay(evt))
+		return;
+
+	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
+	assert(srcOffs >= 0x28000);
+	const uint16 *src = (const uint16*)&evt->srcOrig[srcOffs - 0x28000];
+
+	for (int i = 0; i < evt->len; ++i) {
+		uint16 col = READ_BE_UINT16(src++);
+		uint8 r = col & 0xF;
+		uint8 g = (col & 0xF0) >> 4;
+		uint8 b = (col & 0xF00) >> 8;
+		col = ((r + g + b) / 3) & 0xFFFE;		
+		fadeStep(dst++, col & 0xF, (col << 4) & 0xF0, (col << 8) & 0xF00);
+	}
+
+	if (++evt->progress == 8)
+		evt->cmd = 0;
+}
+
+void SCDPalette::event_palFadeFrom(PalEventSCD *evt) {
+	if (updateDelay(evt))
+		return;
+
+	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
+	assert(srcOffs >= 0x28000);
+	const uint16 *src = (const uint16*)&evt->srcOrig[srcOffs - 0x28000];
+
+	for (int i = 0; i < evt->len; ++i) {
+		uint16 col = READ_BE_UINT16(src++);
+		fadeStep(dst++, col & 0xF, col & 0xF0, col & 0xF00);
+	}
+
+	if (++evt->progress == 8)
+		evt->cmd = 0;
+}
+
+
+void SCDPalette::event_palClear(PalEventSCD *evt) {
+	if (updateDelay(evt))
+		return;
+
+	uint16 *dst = &_colors[evt->destOffset >> 1];
+	Common::fill<uint16*, uint16>(dst, &dst[evt->len], 0);
+	evt->cmd = 0;
+}
+
+bool SCDPalette::updateDelay(PalEventSCD *evt) {
+	if (evt->countDown) {
+		evt->countDown--;
+		return true;
+	}
+
+	evt->countDown = evt->delay;
+	_updateFlags |= ((evt->destOffset & 0x80) ? 2 : 1);
+	return false;
+}
+
+void SCDPalette::fadeStep(uint16 *modColor, uint16 toR, uint16 toG, uint16 toB) {
+	uint16 r = *modColor & 0xF;
+	uint16 g = *modColor & 0xF0;
+	uint16 b = *modColor & 0xF00;
+
+	if (r < toR)
+		r += 0x2;
+	else if (r > toR)
+		r -= 0x2;
+
+	if (g < toG)
+		g += 0x20;
+	else if (g > toG)
+		g -= 0x20;
+
+	if (b < toB)
+		b += 0x200;
+	else if (b > toB)
+		b -= 0x200;
+
+	*modColor = (r | g | b);
+}
+
+void SCDPalette::updateSystemPalette() {
+	const uint16 *src = &_colors[0 << 6];
+	uint8 *dst = _internalPalette;
+
+
+	/*uint8 rgbColors[48];
+	uint8 *dst = rgbColors;
+
+	if (srcPalID >= 31 && srcPalID <= 38) {
+		src = &_segaCustomPalettes[(srcPalID - 31) << 4];
+	} else if (srcPalID >= 0) {
+		int temp = 0;
+		const uint16 *palettes = _vm->staticres()->loadRawDataBe16(kEoB1PalettesSega, temp);
+		if (!palettes)
+			return;
+		src = &palettes[srcPalID << 4];
+	}
+	*/
+	// R: bits 1, 2, 3   G: bits 5, 6, 7   B: bits 9, 10, 11
+	for (int i = 0; i < 64; ++i) {
+		uint16 in = *src++;
+		//_segaCurPalette[dstPalID << 4 | i] = in;
+#if 0
+		static const uint8 col[8] = { 0, 52, 87, 116, 144, 172, 206, 255 };
+		*dst++ = col[(in & 0x00F) >> 1];
+		*dst++ = col[(in & 0x0F0) >> 5];
+		*dst++ = col[(in & 0xF00) >> 9];
+#else
+		*dst++ = ((in & 0x00F) >> 1) * 255 / 7;
+		*dst++ = ((in & 0x0F0) >> 5) * 255 / 7;
+		*dst++ = ((in & 0xF00) >> 9) * 255 / 7;
+#endif
+	}
+
+	/*getPalette(0).copy(rgbColors, 0, 16, dstPalID << 4);
+
+	if (_specialColorReplace) {
+		const uint8 swapColors[6] = { 0x08, 0x09, 0x0C, 0x0D, 0x0E, 0x0F };
+		for (int i = 0; i < 6; ++i)
+			getPalette(0).copy(getPalette(0), 0x10 | swapColors[i], 1, swapColors[i]);
+	}
+
+	if (set)
+		setScreenPalette(getPalette(0));
+		*/
+	_palMan->setPalette(_internalPalette, 0, 256);
+}
+
+Palette *Palette::createSegaPalette(PaletteManager *pm) {
+	return new SCDPalette(pm);
+}
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/palevent_scd.h b/engines/snatcher/palevent_scd.h
new file mode 100644
index 00000000000..ea56669e5b4
--- /dev/null
+++ b/engines/snatcher/palevent_scd.h
@@ -0,0 +1,46 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_PALEVENT_SCD_H
+#define SNATCHER_PALEVENT_SCD_H
+
+#include "common/scummsys.h"
+
+namespace Snatcher {
+
+struct PalEventSCD {
+	uint8 cmd;
+	uint8 delay;
+	uint8 countDown;
+	uint8 destOffset;
+	uint8 len;
+	const uint32 *srcOffsetCur;
+	const uint32 *srcOffsets;
+	const uint8 *srcOrig;
+	uint8 progress;
+	uint8 fD;
+	uint8 fE;
+	uint8 fF;
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_PALEVENT_SCD_H
diff --git a/engines/snatcher/render.h b/engines/snatcher/render.h
index 538282a7249..4353570be1e 100644
--- a/engines/snatcher/render.h
+++ b/engines/snatcher/render.h
@@ -30,6 +30,8 @@ class Renderer {
 public:
 	virtual ~Renderer() {}
 
+	virtual uint16 screenWidth() const = 0;
+	virtual uint16 screenHeight() const = 0;
 protected:
 	Renderer() {}
 
diff --git a/engines/snatcher/render_scd.cpp b/engines/snatcher/render_scd.cpp
index b3496a11d75..b513729aae0 100644
--- a/engines/snatcher/render_scd.cpp
+++ b/engines/snatcher/render_scd.cpp
@@ -25,9 +25,14 @@ namespace Snatcher {
 
 class SCDRenderer : public Renderer {
 public:
-	SCDRenderer() : Renderer() {}
+	SCDRenderer() : Renderer(), _screenWidth(320), _screenHeight(224) {}
 	~SCDRenderer() override {}
+
+	uint16 screenWidth() const { return _screenWidth; }
+	uint16 screenHeight() const { return _screenHeight; }
+
 private:
+	const uint16 _screenWidth, _screenHeight;
 };
 
 Renderer *Renderer::createSegaRenderer() {
diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index 12930a926fe..5f905b66252 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -20,9 +20,191 @@
 */
 
 #include "snatcher/resource.h"
+#include "snatcher/snatcher.h"
+#include "snatcher/scene.h"
+
+#include "common/stream.h"
 
 namespace Snatcher {
 
-///
+class EndianWrapper : public Common::SeekableReadStreamEndian {
+public:
+	EndianWrapper(Common::SeekableReadStream *stream, bool bigEndian, bool disposeAfterUse = true) : Common::SeekableReadStreamEndian(bigEndian), Common::ReadStreamEndian(bigEndian), _stream(stream), _dispose(disposeAfterUse) {}
+	~EndianWrapper() override { if (_dispose) delete _stream; }
+
+	// Common::Stream interface
+	bool err() const override { return _stream->err(); }
+
+	// Common::ReadStream interface
+	bool eos() const override { return _stream->eos(); }
+	uint32 read(void *dataPtr, uint32 dataSize) override { return _stream->read(dataPtr, dataSize); }
+
+	// Common::SeekableReadStream interface
+	int32 pos() const override { return _stream->pos(); }
+	int32 size() const override { return _stream->size(); }
+	bool seek(int32 offset, int whence = SEEK_SET) override { return _stream->seek(offset, whence); }
+
+private:
+	Common::SeekableReadStream *_stream;
+	bool _dispose;
+};
+
+FIO::FIO(SnatcherEngine *vm, bool isBigEndian) : _vm(vm), _bigEndianTarget(isBigEndian) {
+	_files.add("global_search", &SearchMan, 0, false);
+}
+
+FIO::~FIO() {
+}
+
+SceneResource *FIO::createSceneResource(int index) {
+	return (index >= 0 && index < _resFileListSize)  ? new SceneResource(_vm, this, _resFileList[index], index) : 0;
+}
+
+Common::SeekableReadStream *FIO::readStream(const Common::Path &file) {
+	return _files.createReadStreamForMember(file);
+}
+
+Common::SeekableReadStreamEndian *FIO::readStreamEndian(const Common::Path &file, EndianMode em) {
+	Common::SeekableReadStream *stream = readStream(file);
+	return stream ? new EndianWrapper(stream, (em == kForceBE) ? true : (em == kForceLE ? false : _bigEndianTarget)) : 0;
+}
+
+uint8 *FIO::fileData(const Common::Path &file, uint32 *fileSize) {
+	Common::SeekableReadStream *s = readStream(file);
+
+	uint32 size = s ? s->size() : 0;
+	if (fileSize)
+		*fileSize = size;
+
+	if (!s)
+		return 0;
+
+	uint8 *data = new uint8[size];
+	s->read(data, size);
+	delete s;
+
+	return data;
+}
+
+const char *FIO::_resFileList[97] = {
+	"DATA_A0.BIN",	"DATA_B0.BIN",	"DATA_D0.BIN",	"DATA_D1.BIN",	"DATA_D2.BIN",	"DATA_F0.BIN",	"DATA_F4.BIN",	"DATA_G0.BIN",
+	"DATA_H00.BIN",	"DATA_H01.BIN",	"DATA_H02.BIN",	"DATA_H03.BIN",	"DATA_H04.BIN",	"DATA_H05.BIN",	"DATA_H06.BIN",	"DATA_H07.BIN",
+	"DATA_H08.BIN",	"DATA_H09.BIN",	"DATA_H11.BIN",	"DATA_H12.BIN",	"DATA_H13.BIN",	"DATA_H14.BIN",	"DATA_H15.BIN",	"DATA_I0.BIN",
+	"DATA_J0.BIN",	"DATA_K1.BIN",	"DATA_M0.BIN",	"DATA_O0.BIN",	"DATA_P0.BIN",	"DATA_Q3.BIN",	"DATA_Q5.BIN",	"DATA_Q8.BIN",
+	"DATA_S0.BIN",	"DATA_S1.BIN",	"DATA_S2.BIN",	"DATA_T0.BIN",	"DATA_U0.BIN",	"DATA_Y00.BIN",	"DATA_Y01.BIN",	"DATA_Y03.BIN",
+	"DATA_Y04.BIN",	"DATA_Y05.BIN",	"DATA_Y06.BIN",	"DATA_Y07.BIN",	"DATA_Y08.BIN",	"DATA_Y09.BIN",	"DATA_Y10.BIN",	"DATA_Y11.BIN",
+	"DATA_Y12.BIN",	"DATA_Y13.BIN",	"DATA_Y14.BIN",	"DATA_Y15.BIN",	"DATA_Y16.BIN",	"FMWR_1.BIN",	"PCMDRMDT.BIN",	"PCMLD_01.BIN",
+	"PCMLT_01.BIN",	"SP00.BIN",		"SP01.BIN",		"SP02.BIN",		"SP03.BIN",		"SP04.BIN",		"SP05.BIN",		"SP06.BIN",
+	"SP07.BIN",		"SP08.BIN",		"SP09.BIN",		"SP10.BIN",		"SP11.BIN",		"SP12.BIN",		"SP13.BIN",		"SP14.BIN",
+	"SP15.BIN",		"SP16.BIN",		"SP17.BIN",		"SP18.BIN",		"SP19.BIN",		"SP20.BIN",		"SP21.BIN",		"SP22.BIN",
+	"SP23.BIN",		"SP24.BIN",		"SP25.BIN",		"SP26.BIN",		"SP27.BIN",		"SP28.BIN",		"SP29.BIN",		"SP30.BIN",
+	"SP31.BIN",		"SP32.BIN",		"SP33.BIN",		"SP34.BIN",		"SP35.BIN",		"SP36.BIN",		"SP37.BIN",		"SP38.BIN",
+	"SUBCODE.BIN"
+};
+
+const int FIO::_resFileListSize = ARRAYSIZE(_resFileList);
+
+SceneResource::SceneResource(SnatcherEngine *vm, FIO *fio, const char *resFile, int index) : _vm(vm), _fio(fio), _resFile(resFile), _resIndex(index), _data(0), _dataSize(0), _handler(0) {
+	_handler = _shList[_resIndex] ? (_shList[_resIndex])(_vm, this, _fio) : 0;
+
+	assert(!_resFile.empty());
+	_data = _fio->fileData(_resFile, &_dataSize);
+
+	/*Common::SeekableReadStreamEndian *s = _fio->readStreamEndian(_resFile);
+	if (!s)
+		error("SceneResource::loadData(): Failed to load file '%s', _resFile");
+	_data = _fio->*/
+
+	//s->skip(4);
+
+	/*uint32 tableStart = s->readUint32();
+	assert(tableStart > 0x28000);
+	tableStart -= 0x28000;
+	s->seek(tableStart);
+
+	uint16 dataStart = 0xFFFF;
+	uint16 pos = 0;
+	while (pos < dataStart) {
+		uint16 val = s->readUint16();
+		if (val < pos || (val + tableStart) >= s->size())
+			break;
+		pos += 2;
+		dataStart = MIN<int>(val, dataStart);
+	}
+	_tableSize = pos >> 1;
+	_table = new const uint8*[_tableSize];
+	*/
+	/*for (int i = 0; i < _tableSize; ++i) {
+		s->seek(tableStart + (i << 1));
+		s->seek(tableStart + s->readUint16());
+
+		int32 cmdStart = s->pos();
+
+		for (bool checkLen = (s->readSByte() >= 0); checkLen; checkLen = (s->readSByte() >= 0))
+			s->skip(s->readByte());
+
+		uint32 size = s->pos() - cmdStart + 1;
+		uint8 *data = new uint8[size];
+
+		s->seek(cmdStart);
+		s->read(data, size);
+		_table[i] = data;
+	}*/
+
+	//delete s;
+}
+
+SceneResource::~SceneResource() {
+	/*if (_table) {
+		for (uint16 i = 0; i < _tableSize; ++i)
+			delete _table[i];
+		delete[] _table;
+		_table = 0;
+		_tableSize = 0;
+	}*/
+
+	delete[] _data;
+	delete _handler;
+}
+
+const uint8 *SceneResource::getData(int offset) const {
+	assert(offset >= 0x28000);
+	return _data + offset - 0x28000;
+}
+
+const uint8 *SceneResource::getDataFromTable(int offset, int tableEntry) const {
+	const uint8 *data = getData(offset);
+	return data + READ_BE_UINT16(data + (tableEntry << 1));
+}
+
+const uint8 *SceneResource::getDataFromMainTable(int tableEntry) const {
+	return getDataFromTable(READ_BE_UINT32(getData(0x28004)), tableEntry);
+}
+
+void SceneResource::startScene() {
+	if (_handler)
+		(*_handler)();
+}
+
+#define S(id) &createSceneHandler_##id
+#define INVALD 0
+
+SceneResource::SHFactory *const SceneResource::_shList[97] = {
+	INVALD, INVALD, S(D0 ), S(D1 ), S(D2 ), INVALD, INVALD, INVALD,
+	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
+	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
+	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
+	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
+	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
+	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
+	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
+	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
+	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
+	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
+	INVALD, INVALD, INVALD, INVALD
+};
+
+#undef INVALD
+#undef S
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index 3b5544c1a7c..da784915b1d 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -22,9 +22,88 @@
 #ifndef SNATCHER_RESOURCE_H
 #define SNATCHER_RESOURCE_H
 
+#include "common/fs.h"
+#include "common/scummsys.h"
+#include "common/str.h"
+
+namespace Common {
+class SeekableReadStream;
+class SeekableReadStreamEndian;
+} // End of namespace Common
+
 namespace Snatcher {
 
-///
+class SnatcherEngine;
+class SceneResource;
+class FIO;
+
+class SceneHandler {
+public:
+	SceneHandler(SnatcherEngine *vm, SceneResource *scn, FIO *fio) : _vm(vm), _scene(scn), _fio(fio) {}
+	virtual ~SceneHandler() {}
+	virtual void operator()() = 0;
+protected:
+	SnatcherEngine *_vm;
+	SceneResource *_scene;
+	FIO *_fio;
+};
+
+class SceneResource {
+	friend class FIO;
+public:
+	~SceneResource();
+
+	const uint8 *getData(int offset) const;
+	const uint8 *getDataFromTable(int offset, int tableEntry) const;
+	const uint8 *getDataFromMainTable(int tableEntry) const;
+
+	void startScene();
+
+private:
+	SceneResource(SnatcherEngine *vm, FIO *fio, const char *resFile, int index);
+
+	const uint8 *_data;
+	uint32 _dataSize;
+	//const uint8 **_table;
+	//uint16 _tableSize;
+
+	SnatcherEngine *_vm;
+	FIO *_fio;
+	const int _resIndex;
+	Common::Path _resFile;
+	SceneHandler *_handler;
+
+	typedef SceneHandler*(SHFactory)(SnatcherEngine*, SceneResource*, FIO*);
+	static SHFactory *const _shList[97];
+};
+
+class FIO {
+public:
+	FIO(SnatcherEngine *vm, bool isBigEndian);
+	~FIO();
+
+	SceneResource *createSceneResource(int index);
+
+	enum EndianMode {
+		kPlatformEndianness = 0,
+		kForceLE,
+		kForceBE
+	};
+
+	Common::SeekableReadStream *readStream(const Common::Path &file);
+	Common::SeekableReadStreamEndian *readStreamEndian(const Common::Path &file, EndianMode em = kPlatformEndianness);
+	uint8 *fileData(const Common::Path &file, uint32 *fileSize);
+
+private:
+	Common::SearchSet _files;
+
+	SnatcherEngine *_vm;
+	bool _bigEndianTarget;
+
+private:
+	static const char *_resFileList[97];
+	static const int _resFileListSize;
+};
 
 } // End of namespace Snatcher
 
diff --git a/engines/snatcher/scene.h b/engines/snatcher/scene.h
new file mode 100644
index 00000000000..f7334cbdfd6
--- /dev/null
+++ b/engines/snatcher/scene.h
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_SCENE_H
+#define SNATCHER_SCENE_H
+
+namespace Snatcher {
+
+class SceneHandler;
+class SnatcherEngine;
+class SceneResource;
+class FIO;
+
+#define declSHF(id) \
+	SceneHandler *createSceneHandler_##id(SnatcherEngine*, SceneResource*, FIO*)
+
+declSHF(D0);
+declSHF(D1);
+declSHF(D2);
+
+#undef declSHF
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_SCENE_H
diff --git a/engines/snatcher/scene/scene_d0.cpp b/engines/snatcher/scene/scene_d0.cpp
new file mode 100644
index 00000000000..2682c8e19fa
--- /dev/null
+++ b/engines/snatcher/scene/scene_d0.cpp
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "snatcher/resource.h"
+#include "snatcher/scene_imp.h"
+
+namespace Snatcher {
+
+#define SCImp Scene_D0
+
+SH_HEAD_BEGIN(D0)
+// declarations
+SH_HEAD_END(D0)
+
+SH_IMP_CTOR(D0) {
+
+}
+
+SCImp::~SCImp() {
+
+}
+
+void SCImp::operator()() {
+
+}
+
+// functions
+
+#undef SCImp
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/scene/scene_d1.cpp b/engines/snatcher/scene/scene_d1.cpp
new file mode 100644
index 00000000000..c96e6b561af
--- /dev/null
+++ b/engines/snatcher/scene/scene_d1.cpp
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "snatcher/resource.h"
+#include "snatcher/scene_imp.h"
+
+namespace Snatcher {
+
+#define SCImp Scene_D1
+
+SH_HEAD_BEGIN(D1)
+// declarations
+SH_HEAD_END(D1)
+
+SH_IMP_CTOR(D1) {
+
+}
+
+SCImp::~SCImp() {
+
+}
+
+void SCImp::operator()() {
+
+}
+
+// functions
+
+#undef SCImp
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene/scene_d2.cpp
new file mode 100644
index 00000000000..e260c2dd1c8
--- /dev/null
+++ b/engines/snatcher/scene/scene_d2.cpp
@@ -0,0 +1,49 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "snatcher/resource.h"
+#include "snatcher/scene_imp.h"
+
+namespace Snatcher {
+
+#define SCImp Scene_D2
+
+SH_HEAD_BEGIN(D2)
+// declarations
+SH_HEAD_END(D2)
+
+SH_IMP_CTOR(D2) {
+
+}
+
+SCImp::~SCImp() {
+
+}
+
+void SCImp::operator()() {
+
+}
+
+// functions
+
+#undef SCImp
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/scene_imp.h b/engines/snatcher/scene_imp.h
new file mode 100644
index 00000000000..7be6f188746
--- /dev/null
+++ b/engines/snatcher/scene_imp.h
@@ -0,0 +1,42 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_SCENE_IMP_H
+#define SNATCHER_SCENE_IMP_H
+
+namespace Snatcher {
+
+#define SH_HEAD_BEGIN(id) \
+	class Scene_##id : public SceneHandler { \
+	public: \
+		Scene_##id(SnatcherEngine *vm, SceneResource *scn, FIO *fio); \
+		~Scene_##id() override; \
+		void operator()() override; \
+	private:
+
+#define SH_HEAD_END(id) }; \
+	SceneHandler *createSceneHandler_##id(SnatcherEngine *vm, SceneResource *scn, FIO *fio) { return new Scene_##id(vm, scn, fio); }
+#define SH_IMP_CTOR(id) \
+	Scene_##id::Scene_##id(SnatcherEngine *vm, SceneResource *scn, FIO *fio) : SceneHandler(vm, scn, fio)
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_SCENE_IMP_H
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index f7c9e6887e6..1fcaaddfde5 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -20,19 +20,26 @@
 */
 
 #include "snatcher/graphics.h"
+#include "snatcher/resource.h"
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
-#include "common/error.h"
+
+#include "common/events.h"
+#include "common/system.h"
+
+#include "engines/util.h"
 
 namespace Snatcher {
 
-SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _gfx(0), _snd(0) {
+SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(0), _scene(0), _gfx(0), _snd(0) {
 
 }
 
 SnatcherEngine::~SnatcherEngine() {
+	delete _scene;
 	delete _gfx;
 	delete _snd;
+	delete _fio;
 }
 
 Common::Error SnatcherEngine::run() {
@@ -44,30 +51,198 @@ Common::Error SnatcherEngine::run() {
 	if (!initSound(_game.platform, _game.soundOptions))
 		return Common::Error(Common::kAudioDeviceInitFailed);
 
-	if (!initGraphics(_game.platform))
+	if (!initGfx(_game.platform))
 		return Common::Error(Common::kUnknownError);
 
 	return Common::Error(start() ? Common::kNoError : Common::kUnknownError);
 }
 
 bool SnatcherEngine::initResource() {
-	return true;
+	return (_fio = new FIO(this, _game.isBigEndian));
 }
 
-bool SnatcherEngine::initGraphics(Common::Platform platform) {
-	_gfx = new GraphicsEngine(platform);
-	return _gfx;
+bool SnatcherEngine::initGfx(Common::Platform platform) {
+	if (_gfx = new GraphicsEngine(_system, platform)) {
+		initGraphics(_gfx->screenWidth(), _gfx->screenHeight());
+		return true;
+	}
+	return false;
 }
 
 bool SnatcherEngine::initSound(Common::Platform platform, int soundOptions) {
-	_snd = new SoundEngine(platform, soundOptions);
-	return _snd;
+	return (_snd = new SoundEngine(platform, soundOptions));
 }
 
+struct Struct80 {
+	uint16 cmd;
+	uint8 f2;
+	uint8 f3;
+	uint8 f4;
+	uint8 f5;
+	uint32 f6;
+	uint32 fa;
+
+	uint16 fe;
+	uint8 f10;
+	uint8 f11;
+	uint16 f12;
+	uint8 f14;
+	uint8 f15;
+	uint8 f16;
+	uint8 f1c;
+
+	uint8 f25;
+	uint8 f26;
+	uint8 f27;
+	uint16 f28;
+	uint16 f2a;
+	uint8 f2c;
+	uint8 f2d;
+
+	uint32 offs_2e;
+	const uint8 *ptr_32;
+	const uint8 *ptr_36;
+
+	const uint8 *ptr_40;
+	const uint8 *ptr_44;
+	uint16 prev;
+	uint16 next;
+	uint16 next2;
+	uint8 f4e;
+	uint8 f4f;
+};
+
+Struct80 _s80[64];
+//memset(_s80, 0, 64 * sizeof(Struct80));
+uint8 _vc1_var_788A_flags;
+uint8 _vc1_var_78BC;
+uint8 _vc1_var_78BD;
+uint16 _vc1_var_78BE;
+const uint8 *_cpos_7880;
+bool _var_7886;
+uint8 _var_7893;
+
+uint16 _word_B6406;
+
 bool SnatcherEngine::start() {
+	_scene = _fio->createSceneResource(2);
+
+	const uint8 *scstart = _scene->getData(0x28000);
+	const uint8 *sc = _scene->getDataFromMainTable(0);
+	//
+	memset(_s80, 0, 64 * sizeof(Struct80));
+	//
+	for (uint8 cmd = *sc++; cmd != 0xFF; cmd = *sc++) {
+		uint8 len = *sc++;
+		const uint8 *next = sc + len;
+
+		switch (cmd) {
+		case 0:
+			_gfx->enqueuePaletteEvent(scstart, sc - scstart);
+			break;
+
+		case 1:
+			_vc1_var_788A_flags &= ~1;
+			_vc1_var_78BD = _vc1_var_78BC;
+			_vc1_var_78BE = 0;
+			_cpos_7880 = sc;
+			_var_7886 = true;
+			break;
+
+		case 2: {
+			while (sc < next) {
+				assert(*sc < ARRAYSIZE(_s80));
+				Struct80 *s = &_s80[*sc++];
+				if (s->cmd)
+					return 0;
+
+				s->cmd = 1;
+				s->f25 = *sc++;
+				s->f6 = READ_BE_UINT16(sc);
+				sc += 2;
+				s->fa = READ_BE_UINT16(sc);
+				sc += 2;
+				s->offs_2e = READ_BE_UINT32(sc);
+				sc += 4;
+				s->ptr_32 = sc + READ_BE_UINT16(sc) + 2;
+				sc += 2;
+				s->f28 = 0xFFFF;
+
+				uint8 v = *s->ptr_32;
+				for (bool l = true; l; ) {
+					if (v == 0xA1 || v == 0xA7) {
+						s->f16 = s->ptr_32[1];
+						v = s->ptr_32[4];
+					} else {
+						if (!(v & 0x80))
+							s->ptr_36 = _scene->getDataFromTable(s->offs_2e, v);
+						l = false;
+					}
+				}
+			}
+		} break;
+
+		case 3: 
+		case 4: {
+			while (sc < next) {
+				uint16 i1 = *sc++;
+				uint16 i2 = *sc++;
+				assert(i1 < ARRAYSIZE(_s80) && i2 < ARRAYSIZE(_s80));
+				Struct80 *s1 = &_s80[i1];
+				Struct80 *s2 = &_s80[i2];
+				s2->next2 = s1->next;
+				s1->next = i2;
+				s2->prev = i1;
+			}
+		} break;
+
+		case 5:
+		case 6:
+		case 7:
+			_var_7893 = sc[1];
+			break;
+		case 8:
+			_word_B6406 = READ_BE_UINT16(sc);
+			break;
+		case 9:
+			_vc1_var_78BC = sc[1];
+			break;
+		default:
+			error("Unknown opcode 0x%02x", cmd);
+		}
+
+		sc = next;
+	}
+
+	while (!shouldQuit()) {
+		uint32 nextFrame = _system->getMillis() + 16;
+
+		_gfx->nextFrame();
+
+		delayUntil(nextFrame);
+	}
+
 	return true;
 }
 
+void SnatcherEngine::delayUntil(uint32 end) {
+	uint32 cur = _system->getMillis();
+	while (!shouldQuit() && cur < end) {
+		updateEvents();
+		int ms = MIN<int>(end - cur, 4);
+		_system->delayMillis(ms);
+		cur = _system->getMillis();
+	} 
+}
+
+void SnatcherEngine::updateEvents() {
+	Common::Event evt;
+	while (_eventMan->pollEvent(evt)) {
+		/*
+		*/
+	}
+}
+
 void SnatcherEngine::registerDefaultSettings() {
 	//ConfMan.registerDefault("cdaudio", true);
 }
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index c53b527fca4..c63e2610980 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -31,7 +31,9 @@ class SnatcherMetaEngine;
 namespace Snatcher {
 
 class GraphicsEngine;
+class FIO;
 class SoundEngine;
+class SceneResource;
 
 class SnatcherEngine : public Engine {
 public:
@@ -42,9 +44,13 @@ private:
 	// Startup
 	Common::Error run() override;
 	bool initResource();
-	bool initGraphics(Common::Platform platform);
+	bool initGfx(Common::Platform platform);
 	bool initSound(Common::Platform platform, int soundOptions);
-	bool start();	
+
+	// Main loop
+	bool start();
+	void delayUntil(uint32 end);
+	void updateEvents();
 
 	// ConfigManager sync
 	void registerDefaultSettings();
@@ -57,6 +63,10 @@ private:
 	bool hasFeature(EngineFeature f) const override;
 	GameDescription _game;
 
+	// Resource
+	FIO *_fio;
+	SceneResource *_scene;
+
 	// Graphics
 	GraphicsEngine *_gfx;
 


Commit: c478868c8be650b023d374730d89900ccb100a9d
    https://github.com/scummvm/scummvm/commit/c478868c8be650b023d374730d89900ccb100a9d
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
KYRA: (EOB) - minor cleanup

Changed paths:
    engines/kyra/gui/gui_eob.cpp
    engines/kyra/sequence/sequences_eob.cpp


diff --git a/engines/kyra/gui/gui_eob.cpp b/engines/kyra/gui/gui_eob.cpp
index c2f4c3a1e8e..b584f76dea5 100644
--- a/engines/kyra/gui/gui_eob.cpp
+++ b/engines/kyra/gui/gui_eob.cpp
@@ -2335,7 +2335,7 @@ int GUI_EoB::simpleMenu_process(int sd, const char *const *strings, void *b, int
 		simpleMenu_printButton(sd, currentItem, strings[simpleMenu_getMenuItem(currentItem, menuItemsMask, itemOffset)], false, false);
 		simpleMenu_printButton(sd, newItem, strings[simpleMenu_getMenuItem(newItem, menuItemsMask, itemOffset)], true, false);
 		if (_vm->gameFlags().platform == Common::kPlatformSegaCD) {
-			_screen->sega_getRenderer()->render(0, 6, 20, 26, 5);
+			_screen->sega_getRenderer()->renderToPage(0, 6, 20, 26, 5);
 		}
 		_screen->updateScreen();
 	}
diff --git a/engines/kyra/sequence/sequences_eob.cpp b/engines/kyra/sequence/sequences_eob.cpp
index 899e8411b0c..243fde6feac 100644
--- a/engines/kyra/sequence/sequences_eob.cpp
+++ b/engines/kyra/sequence/sequences_eob.cpp
@@ -2461,7 +2461,7 @@ void EoBEngine::seq_xdeath() {
 
 void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 	uint16 *scrollTable = new uint16[0x200]();
-	SegaRenderer *r = _screen->sega_getRenderer();
+	SCDRenderer *r = _screen->sega_getRenderer();
 
 	r->setPitch(128);
 	r->setPlaneTableLocation(SCDRenderer::kPlaneA, 0xE000);


Commit: 5ecd32d04a47eb531c78fee41eea90e807387313
    https://github.com/scummvm/scummvm/commit/5ecd32d04a47eb531c78fee41eea90e807387313
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
KYRA: (EOB/SegaCD) - fix gfx endianness inconsistencies

These were kind of on purpose with EOB, since it was easy
enough to keep the values under control. But with Snatcher,
the vram data transfers can be more automated / low level,
so this has to be correct.

Also implement sprite flipping (not needed for EOB,  but
for Snatcher).

Changed paths:
    engines/kyra/graphics/screen_eob_segacd.cpp
    engines/kyra/sequence/sequences_eob.cpp
    graphics/segagfx.cpp
    graphics/segagfx.h


diff --git a/engines/kyra/graphics/screen_eob_segacd.cpp b/engines/kyra/graphics/screen_eob_segacd.cpp
index 486594dce78..5b74e7628d7 100644
--- a/engines/kyra/graphics/screen_eob_segacd.cpp
+++ b/engines/kyra/graphics/screen_eob_segacd.cpp
@@ -403,7 +403,7 @@ void SCDRenderer::fillRectWithTiles(int vramArea, int x, int y, int w, int h, ui
 		while (h--) {
 			const uint16 *pos = patternTable;
 			for (int i = w; i; --i)
-				*dst++ = nameTblEntry + *pos++;
+				*dst++ = TO_BE_16(nameTblEntry + *pos++);
 			dst += ptch;
 			patternTable += w;
 		}
@@ -412,7 +412,7 @@ void SCDRenderer::fillRectWithTiles(int vramArea, int x, int y, int w, int h, ui
 			while (w--) {
 				uint16 *dst2 = dst;
 				for (int i = h; i; --i) {
-					*dst = nameTblEntry++;
+					*dst = TO_BE_16(nameTblEntry++);
 					dst += _pitch;
 				}
 				dst = ++dst2;
@@ -420,7 +420,7 @@ void SCDRenderer::fillRectWithTiles(int vramArea, int x, int y, int w, int h, ui
 		} else {
 			while (h--) {
 				for (int i = w; i; --i)
-					*dst++ = nameTblEntry++;
+					*dst++ = TO_BE_16(nameTblEntry++);
 				dst += ptch;
 			}
 		}
@@ -429,7 +429,7 @@ void SCDRenderer::fillRectWithTiles(int vramArea, int x, int y, int w, int h, ui
 			while (w--) {
 				uint16 *dst2 = dst;
 				for (int i = h; i; --i) {
-					*dst = nameTblEntry;
+					*dst = TO_BE_16(nameTblEntry);
 					dst += _pitch;
 				}
 				dst = ++dst2;
@@ -437,7 +437,7 @@ void SCDRenderer::fillRectWithTiles(int vramArea, int x, int y, int w, int h, ui
 		} else {
 			while (h--) {
 				for (int i = w; i; --i)
-					*dst++ = nameTblEntry;
+					*dst++ = TO_BE_16(nameTblEntry);
 				dst += ptch;
 			}
 		}
@@ -463,9 +463,10 @@ SegaAnimator::SegaAnimator(SCDRenderer *renderer) : _renderer(renderer), _needUp
 	assert(_sprites);
 	_tempBuffer = new uint16[320]();
 	assert(_tempBuffer);
-	int linkCnt = 1;
-	for (int i = 1; i < 317; i += 4)
-		_tempBuffer[i] = linkCnt++;
+	int linkCnt = 0x1;
+	for (int i = 1; i < 317; i += 4) {
+		_tempBuffer[i] = TO_BE_16(linkCnt++);
+	}
 	clearSprites();
 	_renderer->memsetVRAM(0xDC00, 0, 0x400);
 }
@@ -532,11 +533,10 @@ void SegaAnimator::update() {
 	for (Sprite *s = _sprites; s != &_sprites[80]; ++s) {
 		if (s->x == 0x4000)
 			continue;
-		*dst++ = (uint16)(s->y + 128);
-		*dst = (*dst & 0xFF) | (s->hw << 8);
-		dst++;
-		*dst++ = s->nameTbl;
-		*dst++ = (uint16)(s->x + 128);
+		*dst++ = TO_BE_16(s->y + 128);
+		*dst++ = (*dst & 0xFF00) | (s->hw & 0xFF);
+		*dst++ = TO_BE_16(s->nameTbl);
+		*dst++ = TO_BE_16(s->x + 128);
 	}
 
 	for (; dst < &_tempBuffer[320]; dst += 4)
@@ -765,17 +765,17 @@ void ScrollManager::updateScrollTimers() {
 		t._timer = t._delay;
 	}
 
-	_renderer->writeUint16VSRAM(0, _vScrollTimers[0]._offsCur);
-	_renderer->writeUint16VSRAM(2, _vScrollTimers[1]._offsCur);
-	_renderer->writeUint16VRAM(0xD800, _hScrollTimers[0]._offsCur);
-	_renderer->writeUint16VRAM(0xD802, _hScrollTimers[1]._offsCur);
+	_renderer->writeUint16VSRAM(0, TO_BE_16(_vScrollTimers[0]._offsCur));
+	_renderer->writeUint16VSRAM(2, TO_BE_16(_vScrollTimers[1]._offsCur));
+	_renderer->writeUint16VRAM(0xD800, TO_BE_16(_hScrollTimers[0]._offsCur));
+	_renderer->writeUint16VRAM(0xD802, TO_BE_16(_hScrollTimers[1]._offsCur));
 }
 
 void ScrollManager::fastForward() {
-	_renderer->writeUint16VSRAM(0, _vScrollTimers[0]._offsDest);
-	_renderer->writeUint16VSRAM(2, _vScrollTimers[1]._offsDest);
-	_renderer->writeUint16VRAM(0xD800, _hScrollTimers[0]._offsDest);
-	_renderer->writeUint16VRAM(0xD802, _hScrollTimers[1]._offsDest);
+	_renderer->writeUint16VSRAM(0, TO_BE_16(_vScrollTimers[0]._offsDest));
+	_renderer->writeUint16VSRAM(2, TO_BE_16(_vScrollTimers[1]._offsDest));
+	_renderer->writeUint16VRAM(0xD800, TO_BE_16(_hScrollTimers[0]._offsDest));
+	_renderer->writeUint16VRAM(0xD802, TO_BE_16(_hScrollTimers[1]._offsDest));
 }
 
 } // End of namespace Kyra
diff --git a/engines/kyra/sequence/sequences_eob.cpp b/engines/kyra/sequence/sequences_eob.cpp
index 243fde6feac..aee8f994de9 100644
--- a/engines/kyra/sequence/sequences_eob.cpp
+++ b/engines/kyra/sequence/sequences_eob.cpp
@@ -2457,7 +2457,7 @@ void EoBEngine::seq_xdeath() {
 
 #define updateScrollState(scrollTable, step) \
 	for (int iii = 0; iii < 228; ++iii) \
-		((int16*)scrollTable)[iii << 1] = ((int16*)scrollTable)[(iii << 1) + 1] = (iii & 1) ? -step : step;
+		((int16*)scrollTable)[iii << 1] = ((int16*)scrollTable)[(iii << 1) + 1] = TO_BE_16((iii & 1) ? -step : step);
 
 void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 	uint16 *scrollTable = new uint16[0x200]();
diff --git a/graphics/segagfx.cpp b/graphics/segagfx.cpp
index 474563fb08c..51f0abb46c8 100644
--- a/graphics/segagfx.cpp
+++ b/graphics/segagfx.cpp
@@ -252,24 +252,23 @@ void SegaRenderer::render(uint8 *dest, int renderBlockX, int renderBlockY, int r
 	memset(_spriteMask, 0xFF, (uint32)_screenW * (uint32)_screenH * sizeof(uint8));
 	const uint16 *pos = _spriteTable;
 	for (int i = 0; i < _numSpritesMax && pos; ++i) {
-		int y = *pos++ & 0x3FF;
-		uint8 bH = ((*pos >> 8) & 3) + 1;
-		uint8 bW = ((*pos >> 10) & 3) + 1;
-		uint8 next = *pos++ & 0x7F;
-		uint16 pal = ((*pos >> 13) & 3) << 4;
-		bool prio = (*pos & 0x8000);
-		bool hflip = (*pos & 0x800);
-		bool vflip = (*pos & 0x1000);
-		uint16 tile = *pos++ & 0x7FF;
-		int x = *pos & 0x3FF;
+		int y = FROM_BE_16(*pos++) & 0x3FF;
+		uint16 in = FROM_BE_16(*pos++);
+		uint8 bH = ((in >> 8) & 3) + 1;
+		uint8 bW = ((in >> 10) & 3) + 1;
+		uint8 next = in & 0x7F;
+		in = FROM_BE_16(*pos++);
+		uint16 pal = ((in >> 13) & 3) << 4;
+		bool prio = (in & 0x8000);
+		bool hflip = (in & 0x800);
+		bool vflip = (in & 0x1000);
+		uint16 tile = in++ & 0x7FF;
+		int x = FROM_BE_16(*pos) & 0x3FF;
 
 		// Sprite masking. Can't happen in EOB at least, since the animator automatically adds 128 to x and y coords for all sprites.
-		// If this triggers anywhere else it will need to be added...
+		// Same in Snatcher. If this triggers anywhere else it will need to be added...
 		assert(!(x == 0 && y >= 128));
 
-		assert(!hflip);
-		assert(!vflip);
-
 		x -= 128;
 		y -= 128;
 
@@ -289,15 +288,31 @@ void SegaRenderer::render(uint8 *dest, int renderBlockX, int renderBlockY, int r
 
 		uint8 *dst = renderBuffer + y * _screenW + x;
 		uint8 *msk = _spriteMask + y * _screenW + x;
+		int8 hstep = 0;
+		int8 vstep = 1;
+
+		if (hflip)
+			tile += ((bW - 1) * bH);
+
+		if (vflip) {
+			tile += (bH - 1);
+			vstep = -1;
+			hstep = hflip ? 0 : 2 * bH;
+		} else {
+			hstep = hflip ? -2 * bH : 0;
+		}
+
 
 		for (int blX = 0; blX < bW; ++blX) {
 			uint8 *dst2 = dst;
 			uint8 *msk2 = msk;
 			for (int blY = 0; blY < bH; ++blY) {
-				renderSpriteTile(dst, msk, x + (blX << 3), y + (blY << 3), tile++, pal, vflip, hflip, prio);
+				renderSpriteTile(dst, msk, x + (blX << 3), y + (blY << 3), tile, pal, vflip, hflip, prio);
+				tile += vstep;
 				dst += (_screenW << 3);
 				msk += (_screenW << 3);
 			}
+			tile += hstep;
 			dst = dst2 + 8;
 			msk = msk2 + 8;
 		}
@@ -309,7 +324,7 @@ void SegaRenderer::render(uint8 *dest, int renderBlockX, int renderBlockY, int r
 	// Instead of going through all rendering passes for all planes again (only now drawing the
 	// prio tiles instead of the non-priority tiles) I have collected the data for the priority
 	// tiles on the way and put that data into a chain. Should be faster...
-	for (PrioTileRenderObj *e = _prioChainStart; e; e = e->_next)
+	for (const PrioTileRenderObj *e = _prioChainStart; e; e = e->_next)
 		mRenderLineFragment(e->_hflip, e->_start & 1, e->_end & 1, e->_mask, e->_dst, e->_mask, e->_src, e->_start, e->_end, e->_pal)
 
 	clearPrioChain();
@@ -344,7 +359,7 @@ void SegaRenderer::renderPlanePart(int plane, uint8 *dstBuffer, int x1, int y1,
 			uint16 vscrPxEnd = 8;
 
 			if (vScrollTableIndex != -1) {
-				vscrNt = _vsram[vScrollTableIndex] & 0x3FF;
+				vscrNt = FROM_BE_16(_vsram[vScrollTableIndex]) & 0x3FF;
 				vscrPxStart = vscrNt & 7;
 				vscrNt >>= 3;
 			}
@@ -373,14 +388,14 @@ void SegaRenderer::renderPlaneTile(uint8 *dst, int ntblX, const uint16 *ntblLine
 		uint16 hscrPx = 0;
 
 		if (hScrollTableIndex != -1) {
-			hscrNt = (-_hScrollTable[hScrollTableIndex]) & 0x3FF;
+			hscrNt = (-(FROM_BE_16(_hScrollTable[hScrollTableIndex]))) & 0x3FF;
 			hscrPx = hscrNt & 7;
 			hscrNt >>= 3;
 		}
 
 		const uint16 *pNt = &ntblLine[(ntblX + hscrNt) % pitch];
 		if (pNt < (const uint16*)(&_vram[0x10000])) {
-			uint16 nt = *pNt;
+			uint16 nt = FROM_BE_16(*pNt);
 			uint16 pal = ((nt >> 13) & 3) << 4;
 			bool hflip = (nt & 0x800);
 			int y = bY % 8;
@@ -398,7 +413,7 @@ void SegaRenderer::renderPlaneTile(uint8 *dst, int ntblX, const uint16 *ntblLine
 			dst += (8 - hscrPx);
 			pNt = &ntblLine[(ntblX + hscrNt + 1) % pitch];
 			if (pNt < (const uint16*)(&_vram[0x10000])) {
-				uint16 nt = *pNt;
+				uint16 nt = FROM_BE_16(*pNt);
 				uint16 pal = ((nt >> 13) & 3) << 4;
 				bool hflip = (nt & 0x800);
 				int y = bY % 8;
@@ -419,15 +434,11 @@ void SegaRenderer::renderPlaneTile(uint8 *dst, int ntblX, const uint16 *ntblLine
 	}
 }
 
-#undef vflip
-
 void SegaRenderer::renderSpriteTile(uint8 *dst, uint8 *mask, int x, int y, uint16 tile, uint8 pal, bool vflip, bool hflip, bool prio) {
 	if (y <= -8 || y >= _screenH || x <= -8 || x >= _screenW)
 		return;
 
 	const uint8 *src = &_vram[tile << 5];
-	if (vflip)
-		src += 31;
 
 	if (y < 0) {
 		dst -= (y * _screenW);
@@ -443,7 +454,8 @@ void SegaRenderer::renderSpriteTile(uint8 *dst, uint8 *mask, int x, int y, uint1
 
 	int ystart = CLIP<int>(-y, 0, 7);
 	int yend = CLIP<int>(_screenH - y, 0, 8);
-	src += (ystart << 2);
+	src += ((vflip ? (7 - ystart) : ystart) << 2);
+	int incr = vflip ? -4 : 4;
 
 	for (int bY = ystart; bY < yend; ++bY) {
 		uint8 *dst2 = dst;
@@ -454,7 +466,7 @@ void SegaRenderer::renderSpriteTile(uint8 *dst, uint8 *mask, int x, int y, uint1
 		else
 			mRenderLineFragment(hflip, xstart & 1, xend & 1, 1, dst, mask, src, xstart, xend, pal);
 
-		src += 4;
+		src += incr;
 		dst = dst2 + _screenW;
 		mask = msk2 + _screenW;
 	}
diff --git a/graphics/segagfx.h b/graphics/segagfx.h
index 1558d9b18b0..4833e0fe89d 100644
--- a/graphics/segagfx.h
+++ b/graphics/segagfx.h
@@ -159,7 +159,7 @@ public:
 	void memsetVRAM(int addr, uint8 val, int len);
 
 	/**
-	 * Write uint16 value into vs ram. No endianness corrections take place here.
+	 * Write uint16 value into vs ram. Values must be BE.
 	 * @param addr:		target address in the vdp vs ram
 	 * @param val:		value
 	 */
@@ -173,7 +173,7 @@ public:
 	void writeUint8VRAM(int addr, uint8 value);
 
 	/**
-	 * Write uint16 value into vram. No endianness corrections take place here.
+	 * Write uint16 value into vram. Values must be BE.
 	 * @param addr:		target address in the vdp vram
 	 * @param val:		value
 	 */


Commit: 3729bbbfb7827fb60f0edeaf3fa78e0afe198332
    https://github.com/scummvm/scummvm/commit/3729bbbfb7827fb60f0edeaf3fa78e0afe198332
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: partly implement startup/intro

(intro runs very glitchy)

Changed paths:
  A engines/snatcher/util.cpp
  A engines/snatcher/util.h
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/metaengine.cpp
    engines/snatcher/module.mk
    engines/snatcher/palette.h
    engines/snatcher/palette_scd.cpp
    engines/snatcher/palevent_scd.h
    engines/snatcher/render.h
    engines/snatcher/render_scd.cpp
    engines/snatcher/resource.cpp
    engines/snatcher/resource.h
    engines/snatcher/scene.h
    engines/snatcher/scene/scene_d0.cpp
    engines/snatcher/scene/scene_d1.cpp
    engines/snatcher/scene/scene_d2.cpp
    engines/snatcher/scene_imp.h
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/sound.cpp
    engines/snatcher/sound.h
    engines/snatcher/sound_device.h
    engines/snatcher/sound_device_null.cpp
    engines/snatcher/sound_device_scd.cpp


diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index b53ea2244ae..78d49155f21 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -19,35 +19,186 @@
 *
 */
 
+
 #include "snatcher/palette.h"
 #include "snatcher/render.h"
+#include "snatcher/resource.h"
 #include "snatcher/graphics.h"
-
+#include "common/endian.h"
 #include "common/system.h"
 
 namespace Snatcher {
 
-GraphicsEngine::GraphicsEngine(OSystem *system, Common::Platform platform) : _system(system), _renderer(0) {
-	_renderer = Renderer::create(platform);
-	_palette = Palette::create(_system->getPaletteManager(), platform);
+GraphicsEngine::GraphicsEngine(OSystem *system, Common::Platform platform) : _system(system), _renderer(0), _dataMode(0), _screen(nullptr), _flags(0) {
+	_renderer = Renderer::create(platform, _state);
+	_palette = Palette::create(_system->getPaletteManager(), platform, _state);
+	_screen = new uint8[_renderer->screenWidth() * _renderer->screenHeight()]();
 	assert(_renderer);
+	assert(_palette);
+	assert(_screen);
 }
 
 GraphicsEngine::~GraphicsEngine() {
 	delete _renderer;
 	delete _palette;
+	delete[] _screen;
 }
 
-void GraphicsEngine::enqueuePaletteEvent(const uint8 *data, uint32 curPos) {
-	_palette->enqueueEvent(data, curPos);
+//uint8 _vc1_var_788A_flags;
+//bool _var_7886;
+uint8 _gfxScript_byte_3;
+
+//int16 _wordRAM__TABLE48__03;
+//int16 _gg_A__, _gg_A__cntDwn;
+
+
+//uint8 _gg_B;
+//uint32 _gg_dword_787A;
+//bool gfx1_sub1() { return true; }
+//void gfx1_sub2() {}
+//
+
+void GraphicsEngine::runScript(ResourcePointer res, int func) {
+	ResourcePointer sc = ResourcePointer(res.dataStart, READ_BE_UINT32(res.dataStart + 4)).getDataFromTable(func);
+
+	for (uint8 cmd = *sc++; cmd != 0xFF; cmd = *sc++) {
+		uint8 len = *sc++;
+		const uint8 *next = sc + len;
+
+		switch (cmd) {
+		case 0:
+			assert(_palette);
+			_palette->enqueueEvent(sc);
+			break;
+		case 1:
+			_state.clearFlag(1, 0);
+			_renderer->initData(sc, _dataMode);
+			_state.setVar(8, 1);
+			break;
+		case 2:
+			_renderer->initSprites(sc, len);
+			break;
+		case 3: 
+		case 4:
+			_renderer->linkSprites(sc, len);
+			break;
+
+		case 5:
+		case 6:
+		case 7:
+			_gfxScript_byte_3 = sc[1];
+			break;
+		case 8:
+			_renderer->setPlaneMode(READ_BE_UINT16(sc()));
+			break;
+		case 9:
+			_dataMode = sc[1];
+			// Multi part data transfer for more than 2048 bytes. This is just due to original hardware limitations
+			// (in particular, the dma transfer from word ram to vram). We can just copy the whole thing at once...
+			break;
+		default:
+			error("Unknown opcode 0x%02x", cmd);
+		}
+
+		sc = next;
+	}
+}
+
+void GraphicsEngine::enqueuePaletteEvent(ResourcePointer res) {
+	_palette->enqueueEvent(res);
+}
+
+void GraphicsEngine::enqueueCopyCommands(ResourcePointer res) {
+	_renderer->enqueueCopyCommands(res);
+}
+
+void GraphicsEngine::doCommand(uint8 cmd) {
+	_renderer->doCommand(cmd);
+}
+
+void GraphicsEngine::updateAnimations() {
+	_renderer->updateAnimations();
 }
 
 void GraphicsEngine::nextFrame() {
 	//if (!_skipManyEvents) {
-		//_blockPalEvent = false;
-		_palette->processEventQueue();
+		//_renderer->processEventQueue();
 	//}
+
+	//if (!_skipManyEvents) {
+		//_blockPalEvent = false;
+
+	// update_vint_tables_8F00_
+	//vram_updt1();
+	_palette->processEventQueue();
+	//vintUpdateGfxStructs6();
+	_renderer->updateScreen(_screen);
+	_system->copyRectToScreen(_screen, _renderer->screenWidth(), 0, 0, _renderer->screenWidth(), _renderer->screenHeight());
+	//if (_doSCriptBuff)
+	//
+		//}
+	_palette->updateSystemPalette();
 	_system->updateScreen();
+
+	_state.nextFrame();
+}
+
+void GraphicsEngine::reset(int mode) {
+	if (mode & kRestoreDefaultsExt)
+		restoreDefaultsExt();
+	if (mode & kRestoreDefaults)
+		restoreDefaults();
+	if (mode & kClearPalEvents)
+		_palette->clearEvents();
+	if (mode & kClearSprites)
+		_renderer->clearSprites();
+	if (mode & kResetGfxStructs6)
+		_renderer->clearCopyCommands();
+}
+
+void GraphicsEngine::setVar(uint8 var, uint8 val) {
+	_state.setVar(var, val);
+}
+
+uint16 GraphicsEngine::screenWidth() const {
+	return _renderer ? _renderer->screenWidth() : 0;
+}
+
+uint16 GraphicsEngine::screenHeight() const {
+	return _renderer ? _renderer->screenHeight() : 0;
+}
+
+bool GraphicsEngine::busy() const {
+	return ((_state.getVar(0) != 0) || (_state.getVar(8) != 0));
+}
+
+void GraphicsEngine::restoreDefaultsExt() {
+	if (!_state.getVar(4))
+		restoreDefaults();
+	_palette->clearEvents();
+
+	if (_state.getVar(5)) {
+		_palette->setDefaults(1);
+		_state.setVar(5, 0);
+	}
+
+	_renderer->clearCopyCommands();
+	//withD0_FF_FD_FC(0xFC);
+	_renderer->clearSprites();
+
+	if (!(_state.testFlag(4, 1)))
+		_state.setVar(0, 1);
+	_state.setVar(4, 0);
+}
+
+void GraphicsEngine::restoreDefaults() {
+	_state.setVar(3, 1);
+	if (_state.testFlag(1, 0))
+		return;
+	_state.setFlag(1, 0);
+	_palette->clearEvents();
+	_palette->setDefaults(0);
+	_state.setVar(2, 1);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 921b71f9132..ea6c57b212b 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -22,28 +22,101 @@
 #ifndef SNATCHER_GRAPHICS_H
 #define SNATCHER_GRAPHICS_H
 
-#include "snatcher/render.h"
 #include "common/platform.h"
+#include "snatcher/resource.h"
 
 class OSystem;
 
 namespace Snatcher {
 
 class Palette;
+class Renderer;
+class SceneModule;
 
 class GraphicsEngine {
 public:
 	GraphicsEngine(OSystem *system, Common::Platform platform);
 	~GraphicsEngine();
 
-	void enqueuePaletteEvent(const uint8 *data, uint32 curPos);
+	void runScript(ResourcePointer res, int func);
+	void enqueuePaletteEvent(ResourcePointer res);
+	void enqueueCopyCommands(ResourcePointer res);
+	void doCommand(uint8 cmd);
 
+	void updateAnimations();
 	void nextFrame();
 
-	uint16 screenWidth() const { return _renderer ? _renderer->screenWidth() : 0; }
-	uint16 screenHeight() const { return _renderer ? _renderer->screenHeight() : 0; }
+	enum ResetType : uint16 {
+		kClearPalEvents			=	1 << 0,
+		kRestoreDefaults		=	1 << 1,
+		kRestoreDefaultsExt		=	1 << 2,
+		kResetGfxStructs6		=	1 << 3,
+		kClearSprites			=	1 << 4
+	};
+
+	void reset(int mode);
+
+	void setVar(uint8 var, uint8 val);
+
+	uint16 screenWidth() const;
+	uint16 screenHeight() const;
+
+	bool busy() const;
+
+public:
+	struct State {
+		State() {
+			memset(vars, 0, sizeof(vars));
+			_frameCounter = 0;
+		}
+
+		uint8 getVar(uint8 var) const {
+			assert(var < ARRAYSIZE(vars));
+			return vars[var];
+		}
+
+		void setVar(uint8 var, uint8 val) {
+			assert(var < ARRAYSIZE(vars));
+			vars[var] = val;
+		}
+
+		bool testFlag(uint8 var, uint8 bit) const {
+			assert(var < ARRAYSIZE(vars));
+			return vars[var] & (1 << bit);
+		}
+
+		void setFlag(uint8 var, uint8 bit) {
+			assert(var < ARRAYSIZE(vars));
+			vars[var] |= (1 << bit);
+		}
+
+		void clearFlag(uint8 var, uint8 bit) {
+			assert(var < ARRAYSIZE(vars));
+			vars[var] &= ~(1 << bit);
+		}
+
+		uint16 frameCount() const {
+			return _frameCounter;
+		}
+
+		void nextFrame() {
+			++_frameCounter;
+		}
+	
+	private:
+		uint8 vars[10];
+		uint16 _frameCounter;
+	};
 
 private:
+	void restoreDefaultsExt();
+	void restoreDefaults();
+
+	State _state;
+	uint8 _dataMode;
+	uint8 _flags;
+
+	byte *_screen;
 	Renderer *_renderer;
 	Palette *_palette;
 	OSystem *_system;
diff --git a/engines/snatcher/metaengine.cpp b/engines/snatcher/metaengine.cpp
index c0e336b0694..d8de8aec188 100644
--- a/engines/snatcher/metaengine.cpp
+++ b/engines/snatcher/metaengine.cpp
@@ -177,7 +177,8 @@ SaveStateDescriptor SnatcherMetaEngine::querySaveMetaInfos(const char *target, i
 		}
 	}*/
 
-	SaveStateDescriptor desc(this, slot, Common::String());
+	Common::String dmy;
+	SaveStateDescriptor desc(this, slot, dmy);
 
 	// We don't allow quick saves (slot 990 till 998) to be overwritten.
 	// The same goes for the 'Autosave', which is slot 999. Slot 0 will also
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index 47240329921..f7374acf5ed 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -12,7 +12,8 @@ MODULE_OBJS := \
 	snatcher.o \
 	sound.o \
 	sound_device_null.o \
-	sound_device_scd.o
+	sound_device_scd.o \
+	util.o
 
 # This module can be built as a plugin
 ifeq ($(ENABLE_SNATCHER), DYNAMIC_PLUGIN)
diff --git a/engines/snatcher/palette.h b/engines/snatcher/palette.h
index 2206d6aa69b..c8c89e49a36 100644
--- a/engines/snatcher/palette.h
+++ b/engines/snatcher/palette.h
@@ -23,6 +23,7 @@
 #define SNATCHER_PALETTE_H
 
 #include "common/platform.h"
+#include "snatcher/graphics.h"
 
 class PaletteManager;
 
@@ -30,23 +31,27 @@ namespace Snatcher {
 
 class Palette {
 public:
-	Palette(PaletteManager *pm) : _palMan(pm) {}
+	Palette(PaletteManager *pm, GraphicsEngine::State &state) : _palMan(pm), _gfxState(state) {}
 	virtual ~Palette() {}
 
-	virtual bool enqueueEvent(const uint8*, uint32) { return true; }
+	virtual bool enqueueEvent(ResourcePointer &res) { return true; }
 	virtual void processEventQueue() {}
+	virtual void clearEvents() {}
+	virtual void setDefaults(int mode) {}
+	virtual void updateSystemPalette() {}
 
 protected:
 	PaletteManager *_palMan;
+	GraphicsEngine::State &_gfxState;
 
 private:
-	static Palette *createSegaPalette(PaletteManager *pm);
+	static Palette *createSegaPalette(PaletteManager *pm, GraphicsEngine::State &state);
 
 public:
-	static Palette *create(PaletteManager *pm, Common::Platform platform) {
+	static Palette *create(PaletteManager *pm, Common::Platform platform, GraphicsEngine::State &state) {
 		switch (platform) {
 		case Common::kPlatformSegaCD:
-			return createSegaPalette(pm);
+			return createSegaPalette(pm, state);
 		default:
 			break;
 		};
diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index 652c397ef53..1f33553f8e9 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -19,6 +19,7 @@
 *
 */
 
+#include "snatcher/graphics.h"
 #include "snatcher/palette.h"
 #include "snatcher/palevent_scd.h"
 
@@ -31,13 +32,18 @@
 
 namespace Snatcher {
 
+class GraphicsEngine;
 class SCDPalette : public Palette {
 public:
-	SCDPalette(PaletteManager *pm);
+	SCDPalette(PaletteManager *pm, GraphicsEngine::State &state);
 	~SCDPalette() override;
 
-	bool enqueueEvent(const uint8 *data, uint32 curPos) override;
+	bool enqueueEvent(ResourcePointer &res) override;
 	void processEventQueue() override;
+	void clearEvents() override;
+	void setDefaults(int mode) override;
+
+	void updateSystemPalette() override;
 
 private:
 	typedef Common::Functor1Mem<PalEventSCD*, void, SCDPalette> EventProc;
@@ -50,26 +56,24 @@ private:
 	void event_palFadeToWhite(PalEventSCD *evt);
 	void event_palCycle(PalEventSCD *evt);
 	void event_palFadeToColor(PalEventSCD *evt);
-	void event_palFade2(PalEventSCD *evt);
-	void event_palFadeFrom(PalEventSCD *evt);
+	void event_palFadeToGrey(PalEventSCD *evt);
+	void event_palFadeToPal(PalEventSCD *evt);
 	void event_palClear(PalEventSCD *evt);
 
 	bool updateDelay(PalEventSCD *evt);
 	void fadeStep(uint16 *modColor, uint16 toR, uint16 toG, uint16 toB);
 
-	void updateSystemPalette();
-
 	PalEventSCD *_eventQueue;
 	PalEventSCD *_eventCurPos;
 
 	uint16 *_colors;
-	uint8 *_internalPalette;
-	uint8 _updateFlags;
+	uint16 *_colors2;
+	uint8 *_sysPalette;
 };
 
-SCDPalette::SCDPalette(PaletteManager *pm) : Palette(pm), _eventProcs(), _eventQueue(0), _eventCurPos(0), _colors(0), _internalPalette(0), _updateFlags(0) {
+SCDPalette::SCDPalette(PaletteManager *pm, GraphicsEngine::State &state) : Palette(pm, state), _eventProcs(), _eventQueue(nullptr), _eventCurPos(nullptr), _colors(nullptr), _colors2(nullptr), _sysPalette(nullptr) {
 #define P_OP(a)	_eventProcs.push_back(new EventProc(this, &SCDPalette::event_##a));
-	_eventProcs.push_back(0);
+	_eventProcs.push_back(nullptr);
 	P_OP(palSet);
 	P_OP(palFadeFromBlack);
 	P_OP(palFadeToBlack);
@@ -77,45 +81,42 @@ SCDPalette::SCDPalette(PaletteManager *pm) : Palette(pm), _eventProcs(), _eventQ
 	P_OP(palFadeToWhite);
 	P_OP(palCycle);
 	P_OP(palFadeToColor);
-	P_OP(palFade2);
-	P_OP(palFadeFrom);
+	P_OP(palFadeToGrey);
+	P_OP(palFadeToPal);
 	P_OP(palClear);
 #undef P_OP
 
 	_eventQueue = _eventCurPos = new PalEventSCD[12];
-	memset(_eventQueue, 0, 12 * sizeof(PalEventSCD));
-	_colors = new uint16[128];
-	memset(_colors, 0, 128 * sizeof(uint16));
-	_internalPalette = new uint8[256];
-	memset(_internalPalette, 0, 256 * sizeof(uint8));
+	_colors = new uint16[128]();
+	_colors2 = new uint16[128]();
+	_sysPalette = new uint8[256]();
 }
 
 SCDPalette::~SCDPalette() {
 	delete[] _eventQueue;
 	delete[] _colors;
-	delete[] _internalPalette;
+	delete[] _colors2;
+	delete[] _sysPalette;
 
 	for (Common::Array<EventProc*>::iterator i = _eventProcs.begin(); i != _eventProcs.end(); ++i)
 		delete *i;
 }
 
-bool SCDPalette::enqueueEvent(const uint8 *data, uint32 curPos) {
-	const uint8 *dataStart = data;
-	data = &data[curPos];
-
+bool SCDPalette::enqueueEvent(ResourcePointer &res) {
 	for (int i = 0; i < 12; ++i) {
 		if (++_eventCurPos > &_eventQueue[11])
 			_eventCurPos = _eventQueue;
 		if (_eventCurPos->cmd)
 			continue;
 
-		_eventCurPos->cmd = *data++;
-		_eventCurPos->delay = *data++;
+		_eventCurPos->res = res;
+		_eventCurPos->cmd = *res++;
+		_eventCurPos->delay = *res++;
 		_eventCurPos->countDown = 0;
-		_eventCurPos->destOffset = *data++;
-		_eventCurPos->len = (*data++) + 1;
-		_eventCurPos->srcOffsets = _eventCurPos->srcOffsetCur = (uint32*)data;
-		_eventCurPos->srcOrig = dataStart;
+		_eventCurPos->destFlag = (*res() & 0x80);
+		_eventCurPos->destOffset = (*res++ & 0x7F) >> 1;
+		_eventCurPos->len = (*res++) + 1;
+		_eventCurPos->srcOffsets = _eventCurPos->srcOffsetCur = reinterpret_cast<const uint32*>(res());
 		_eventCurPos->progress = 0;
 
 		if (_eventCurPos->cmd & 0x80) {
@@ -132,6 +133,10 @@ bool SCDPalette::enqueueEvent(const uint8 *data, uint32 curPos) {
 }
 
 void SCDPalette::processEventQueue() {
+	if (_gfxState.getVar(8))
+		return;
+	_gfxState.setVar(2, 0);
+
 	PalEventSCD *p = _eventCurPos;
 	for (int i = 0; i < 12; ++i) {
 		if (++p > &_eventQueue[11])
@@ -147,23 +152,117 @@ void SCDPalette::processEventQueue() {
 			(*_eventProcs[p->cmd])(p);
 	}
 
-	//if (_updateFlags & 1)
-		updateSystemPalette();
+	updateSystemPalette();
+}
+
+void SCDPalette::clearEvents() {
+	for (int i = 0; i < 12; ++i)
+		_eventQueue[i].clear();
+}
 
-	//if (_updateFlags & 2)
-		updateSystemPalette();
-	_updateFlags = 0;
+void SCDPalette::setDefaults(int mode) {
+	if (mode == 0) {
+		int cnt = (_gfxState.testFlag(1, 1) || _gfxState.getVar(5)) ? 64 : 48;
+		_gfxState.clearFlag(1, 1);
+		Common::fill<uint16*, uint16>(&_colors[64 - cnt], &_colors[cnt], 0);
+		if (_gfxState.testFlag(1, 2)) {
+			_gfxState.clearFlag(1, 2);
+			Common::fill<uint16*, uint16>(&_colors[80], &_colors[128], 0);
+			_gfxState.setFlag(7, 1);
+		}
+	} else if (mode == 1) {
+		static const uint16 colors[] =  { 0x000, 0xEEE, 0x0EE, 0x86E, 0xEE0, 0xE42, 0x4E0, 0x000 };
+		Common::copy<const uint16*, uint16*>(colors, &colors[ARRAYSIZE(colors)], _colors);
+	}
+	_gfxState.setFlag(7, 0);
+}
+
+/*void SCDPalette::selectPalette(uint32 sel) {
+	static const uint16 colors[] = {
+		0x0eee, 0x0000, 0x0ccc, 0x0aaa, 0x0888, 0x0222, 0x0caa, 0x0aaa,
+		0x0a88, 0x0888, 0x0866, 0x0866, 0x0644, 0x0644, 0x0444, 0x0422,
+		0x0eee, 0x0000, 0x008e, 0x008c, 0x006c, 0x004a, 0x00ee, 0x00ce,
+		0x00ce, 0x00ae, 0x00ac, 0x008c, 0x008c, 0x006c, 0x006c, 0x004a,
+		0x0eee, 0x0000, 0x006e, 0x004c, 0x004c, 0x0028, 0x008e, 0x006e,
+		0x004e, 0x000c, 0x000c, 0x000a, 0x000a, 0x0008, 0x0008, 0x0006,
+		0x0000, 0x0000, 0x0000, 0x0020, 0x0040, 0x0060, 0x0080, 0x00a0,
+		0x00c0, 0x0aea, 0x06c6, 0x08e8, 0x0eee, 0x0000, 0x0000, 0x0000,
+		0x0000, 0x0000, 0x0600, 0x0800, 0x0a00, 0x0e00, 0x0000, 0x0000,
+		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
+		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0060, 0x0080, 0x00a0,
+		0x00c0, 0x0aea, 0x06c6, 0x08e8, 0x0eee, 0x0000, 0x0000, 0x0000,
+		0x0000, 0x0eee, 0x00ee, 0x000e, 0x0ee0, 0x0e00, 0x00e0, 0x0600,
+		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+	};
+}*/
+
+void SCDPalette::updateSystemPalette() {
+	if (!_gfxState.testFlag(7, 0) && !_gfxState.testFlag(7, 1))
+		return;
+
+	if (_gfxState.testFlag(7, 0))
+		Common::copy<const uint16*, uint16*>(_colors, &_colors[64], _colors2);
+
+	if (_gfxState.testFlag(7, 1))
+		Common::copy<const uint16*, uint16*>(&_colors[64], &_colors[128], &_colors2[64]);
+
+	_gfxState.clearFlag(7, 0);
+	_gfxState.clearFlag(7, 1);
+
+	const uint16 *src = &_colors2[0 << 6];
+	uint8 *dst = _sysPalette;
+
+	/*uint8 rgbColors[48];
+	uint8 *dst = rgbColors;
+
+	if (srcPalID >= 31 && srcPalID <= 38) {
+		src = &_segaCustomPalettes[(srcPalID - 31) << 4];
+	} else if (srcPalID >= 0) {
+		int temp = 0;
+		const uint16 *palettes = _vm->staticres()->loadRawDataBe16(kEoB1PalettesSega, temp);
+		if (!palettes)
+			return;
+		src = &palettes[srcPalID << 4];
+	}
+	*/
+	// R: bits 1, 2, 3   G: bits 5, 6, 7   B: bits 9, 10, 11
+	for (int i = 0; i < 64; ++i) {
+		uint16 in = *src++;
+		//_segaCurPalette[dstPalID << 4 | i] = in;
+#if 0
+		static const uint8 col[8] = { 0, 52, 87, 116, 144, 172, 206, 255 };
+		*dst++ = col[(in & 0x00F) >> 1];
+		*dst++ = col[(in & 0x0F0) >> 5];
+		*dst++ = col[(in & 0xF00) >> 9];
+#else
+		*dst++ = ((in & 0x00F) >> 1) * 255 / 7;
+		*dst++ = ((in & 0x0F0) >> 5) * 255 / 7;
+		*dst++ = ((in & 0xF00) >> 9) * 255 / 7;
+#endif
+	}
+
+	/*getPalette(0).copy(rgbColors, 0, 16, dstPalID << 4);
+
+	if (_specialColorReplace) {
+		const uint8 swapColors[6] = { 0x08, 0x09, 0x0C, 0x0D, 0x0E, 0x0F };
+		for (int i = 0; i < 6; ++i)
+			getPalette(0).copy(getPalette(0), 0x10 | swapColors[i], 1, swapColors[i]);
+	}
+
+	if (set)
+		setScreenPalette(getPalette(0));
+		*/
+	_palMan->setPalette(_sysPalette, 0, 256);
 }
 
 void SCDPalette::event_palSet(PalEventSCD *evt) {
 	if (updateDelay(evt))
 		return;
 
-	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint16 *dst = &_colors[evt->destOffset];
 	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
 	assert(srcOffs >= 0x28000);
-	const uint16 *src = (const uint16*)&evt->srcOrig[srcOffs - 0x28000];
-
+	const uint16 *src = reinterpret_cast<const uint16*>(ResourcePointer(evt->res.dataStart, srcOffs)());
 	for (int i = 0; i < evt->len; ++i)
 		*dst++ = READ_BE_UINT16(src++);
 
@@ -172,17 +271,17 @@ void SCDPalette::event_palSet(PalEventSCD *evt) {
 }
 
 void SCDPalette::event_palFadeFromBlack(PalEventSCD *evt) {
-	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint16 *dst = &_colors[evt->destOffset];
 	Common::fill<uint16*, uint16>(dst, &dst[evt->len], 0);
 	evt->cmd = 9;
-	event_palFadeFrom(evt);
+	event_palFadeToPal(evt);
 }
 
 void SCDPalette::event_palFadeToBlack(PalEventSCD *evt) {
 	if (updateDelay(evt))
 		return;
 
-	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint16 *dst = &_colors[evt->destOffset];
 	for (int i = 0; i < evt->len; ++i) {
 		if (*dst & 0xF)
 			*dst -= 0x2;
@@ -190,23 +289,24 @@ void SCDPalette::event_palFadeToBlack(PalEventSCD *evt) {
 			*dst -= 0x20;
 		if (*dst & 0xF00)
 			*dst -= 0x200;
+		++dst;
 	}
 	if (++evt->progress == 8)
 		evt->cmd = 0;
 }
 
 void SCDPalette::event_palFadeFromWhite(PalEventSCD *evt) {
-	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint16 *dst = &_colors[evt->destOffset];
 	Common::fill<uint16*, uint16>(dst, &dst[evt->len], 0xEEE);
 	evt->cmd = 9;
-	event_palFadeFrom(evt);
+	event_palFadeToPal(evt);
 }
 
 void SCDPalette::event_palFadeToWhite(PalEventSCD *evt) {
 	if (updateDelay(evt))
 		return;
 
-	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint16 *dst = &_colors[evt->destOffset];
 	for (int i = 0; i < evt->len; ++i) {
 		if ((*dst & 0xF) < 0xE)
 			*dst += 0x2;
@@ -214,6 +314,7 @@ void SCDPalette::event_palFadeToWhite(PalEventSCD *evt) {
 			*dst += 0x20;
 		if ((*dst & 0xF00) < 0xE00)
 			*dst += 0x200;
+		++dst;
 	}
 	if (++evt->progress == 8)
 		evt->cmd = 0;
@@ -223,11 +324,10 @@ void SCDPalette::event_palCycle(PalEventSCD *evt) {
 	if (updateDelay(evt))
 		return;
 
-	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint16 *dst = &_colors[evt->destOffset];
 	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
 	assert(srcOffs >= 0x28000);
-	const uint16 *src = (const uint16*)&evt->srcOrig[srcOffs - 0x28000];
-
+	const uint16 *src = reinterpret_cast<const uint16*>(ResourcePointer(evt->res.dataStart, srcOffs)());
 	for (int i = 0; i < evt->len; ++i)
 		*dst++ = READ_BE_UINT16(src++);
 
@@ -239,10 +339,10 @@ void SCDPalette::event_palFadeToColor(PalEventSCD *evt) {
 	if (updateDelay(evt))
 		return;
 
-	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint16 *dst = &_colors[evt->destOffset];
 	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
 	assert(srcOffs >= 0x28000);
-	uint16 col = READ_BE_UINT16(&evt->srcOrig[srcOffs - 0x28000]);
+	uint16 col = READ_BE_UINT16(ResourcePointer(evt->res.dataStart, srcOffs)());
 
 	for (int i = 0; i < evt->len; ++i)
 		fadeStep(dst++, col & 0xF, col & 0xF0, col & 0xF00);
@@ -251,14 +351,14 @@ void SCDPalette::event_palFadeToColor(PalEventSCD *evt) {
 		evt->cmd = 0;
 }
 
-void SCDPalette::event_palFade2(PalEventSCD *evt) {
+void SCDPalette::event_palFadeToGrey(PalEventSCD *evt) {
 	if (updateDelay(evt))
 		return;
 
-	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint16 *dst = &_colors[evt->destOffset];
 	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
 	assert(srcOffs >= 0x28000);
-	const uint16 *src = (const uint16*)&evt->srcOrig[srcOffs - 0x28000];
+	const uint16 *src = reinterpret_cast<const uint16*>(ResourcePointer(evt->res.dataStart, srcOffs)());
 
 	for (int i = 0; i < evt->len; ++i) {
 		uint16 col = READ_BE_UINT16(src++);
@@ -273,14 +373,14 @@ void SCDPalette::event_palFade2(PalEventSCD *evt) {
 		evt->cmd = 0;
 }
 
-void SCDPalette::event_palFadeFrom(PalEventSCD *evt) {
+void SCDPalette::event_palFadeToPal(PalEventSCD *evt) {
 	if (updateDelay(evt))
 		return;
 
-	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint16 *dst = &_colors[evt->destOffset];
 	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
 	assert(srcOffs >= 0x28000);
-	const uint16 *src = (const uint16*)&evt->srcOrig[srcOffs - 0x28000];
+	const uint16 *src = reinterpret_cast<const uint16*>(ResourcePointer(evt->res.dataStart, srcOffs)());
 
 	for (int i = 0; i < evt->len; ++i) {
 		uint16 col = READ_BE_UINT16(src++);
@@ -296,7 +396,7 @@ void SCDPalette::event_palClear(PalEventSCD *evt) {
 	if (updateDelay(evt))
 		return;
 
-	uint16 *dst = &_colors[evt->destOffset >> 1];
+	uint16 *dst = &_colors[evt->destOffset];
 	Common::fill<uint16*, uint16>(dst, &dst[evt->len], 0);
 	evt->cmd = 0;
 }
@@ -308,7 +408,7 @@ bool SCDPalette::updateDelay(PalEventSCD *evt) {
 	}
 
 	evt->countDown = evt->delay;
-	_updateFlags |= ((evt->destOffset & 0x80) ? 2 : 1);
+	_gfxState.setFlag(7, evt->destFlag ? 1 : 0);
 	return false;
 }
 
@@ -335,56 +435,8 @@ void SCDPalette::fadeStep(uint16 *modColor, uint16 toR, uint16 toG, uint16 toB)
 	*modColor = (r | g | b);
 }
 
-void SCDPalette::updateSystemPalette() {
-	const uint16 *src = &_colors[0 << 6];
-	uint8 *dst = _internalPalette;
-
-
-	/*uint8 rgbColors[48];
-	uint8 *dst = rgbColors;
-
-	if (srcPalID >= 31 && srcPalID <= 38) {
-		src = &_segaCustomPalettes[(srcPalID - 31) << 4];
-	} else if (srcPalID >= 0) {
-		int temp = 0;
-		const uint16 *palettes = _vm->staticres()->loadRawDataBe16(kEoB1PalettesSega, temp);
-		if (!palettes)
-			return;
-		src = &palettes[srcPalID << 4];
-	}
-	*/
-	// R: bits 1, 2, 3   G: bits 5, 6, 7   B: bits 9, 10, 11
-	for (int i = 0; i < 64; ++i) {
-		uint16 in = *src++;
-		//_segaCurPalette[dstPalID << 4 | i] = in;
-#if 0
-		static const uint8 col[8] = { 0, 52, 87, 116, 144, 172, 206, 255 };
-		*dst++ = col[(in & 0x00F) >> 1];
-		*dst++ = col[(in & 0x0F0) >> 5];
-		*dst++ = col[(in & 0xF00) >> 9];
-#else
-		*dst++ = ((in & 0x00F) >> 1) * 255 / 7;
-		*dst++ = ((in & 0x0F0) >> 5) * 255 / 7;
-		*dst++ = ((in & 0xF00) >> 9) * 255 / 7;
-#endif
-	}
-
-	/*getPalette(0).copy(rgbColors, 0, 16, dstPalID << 4);
-
-	if (_specialColorReplace) {
-		const uint8 swapColors[6] = { 0x08, 0x09, 0x0C, 0x0D, 0x0E, 0x0F };
-		for (int i = 0; i < 6; ++i)
-			getPalette(0).copy(getPalette(0), 0x10 | swapColors[i], 1, swapColors[i]);
-	}
-
-	if (set)
-		setScreenPalette(getPalette(0));
-		*/
-	_palMan->setPalette(_internalPalette, 0, 256);
-}
-
-Palette *Palette::createSegaPalette(PaletteManager *pm) {
-	return new SCDPalette(pm);
+Palette *Palette::createSegaPalette(PaletteManager *pm, GraphicsEngine::State &state) {
+	return new SCDPalette(pm, state);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/palevent_scd.h b/engines/snatcher/palevent_scd.h
index ea56669e5b4..ded870670b4 100644
--- a/engines/snatcher/palevent_scd.h
+++ b/engines/snatcher/palevent_scd.h
@@ -27,14 +27,31 @@
 namespace Snatcher {
 
 struct PalEventSCD {
+	PalEventSCD() : cmd(0), delay(0), countDown(0), destOffset(0), destFlag(false), len(0), srcOffsetCur(0), srcOffsets(0), res(), progress(0), fD(0), fE(0), fF(0) {}
+	void clear() {
+		cmd = 0;
+		delay = 0;
+		countDown = 0;
+		destOffset = 0;
+		destFlag = false;
+		len = 0;
+		res = ResourcePointer();
+		srcOffsetCur = 0;
+		srcOffsets = 0;
+		progress = 0;
+		fD = 0;
+		fE = 0;
+		fF = 0;
+	}
 	uint8 cmd;
 	uint8 delay;
 	uint8 countDown;
 	uint8 destOffset;
+	bool destFlag;
 	uint8 len;
 	const uint32 *srcOffsetCur;
 	const uint32 *srcOffsets;
-	const uint8 *srcOrig;
+	ResourcePointer res;
 	uint8 progress;
 	uint8 fD;
 	uint8 fE;
diff --git a/engines/snatcher/render.h b/engines/snatcher/render.h
index 4353570be1e..6936d6c2c92 100644
--- a/engines/snatcher/render.h
+++ b/engines/snatcher/render.h
@@ -23,6 +23,8 @@
 #define SNATCHER_RENDER_H
 
 #include "common/platform.h"
+#include "snatcher/graphics.h"
+#include "snatcher/resource.h"
 
 namespace Snatcher {
 
@@ -30,19 +32,32 @@ class Renderer {
 public:
 	virtual ~Renderer() {}
 
+	virtual void enqueueCopyCommands(ResourcePointer &res) = 0;
+	virtual void doCommand(uint8 cmd) = 0;
+	virtual void clearCopyCommands() = 0;
+	virtual void initData(ResourcePointer &res, uint8 mode) = 0;
+	virtual void initSprites(ResourcePointer &res, uint16 len) = 0;
+	virtual void linkSprites(ResourcePointer &res, uint16 len) = 0;
+	virtual void clearSprites(int mode = 0) = 0;
+	virtual void setPlaneMode(uint16 mode) = 0;
+	virtual void updateScreen(uint8 *screen) = 0;
+	virtual void updateAnimations() = 0;
+
 	virtual uint16 screenWidth() const = 0;
 	virtual uint16 screenHeight() const = 0;
+
 protected:
-	Renderer() {}
+	Renderer(GraphicsEngine::State &state) : _gfxState(state) {}
+	GraphicsEngine::State &_gfxState;
 
 private:
-	static Renderer *createSegaRenderer();
+	static Renderer *createSegaRenderer(GraphicsEngine::State &state);
 
 public:
-	static Renderer *create(Common::Platform platform) {
+	static Renderer *create(Common::Platform platform, GraphicsEngine::State &state) {
 		switch (platform) {
 		case Common::kPlatformSegaCD:
-			return createSegaRenderer();
+			return createSegaRenderer(state);
 		default:
 			break;
 		};
diff --git a/engines/snatcher/render_scd.cpp b/engines/snatcher/render_scd.cpp
index b513729aae0..280cdea3705 100644
--- a/engines/snatcher/render_scd.cpp
+++ b/engines/snatcher/render_scd.cpp
@@ -19,24 +19,1461 @@
 *
 */
 
+
+#include "common/endian.h"
+#include "graphics/segagfx.h"
+#include "snatcher/graphics.h"
 #include "snatcher/render.h"
+#include "snatcher/resource.h"
+#include "snatcher/util.h"
 
 namespace Snatcher {
 
-class SCDRenderer : public Renderer {
+struct Sprite {
+	Sprite() : enable(0), delay(0), f4(0), drawFlags(0), posX(0), posY(0), fe(0), f10(0), f11(0), f12(0), f13(0), f14(0), f15(0), f16(0), f18(0), f1c(0), f20(0), f24(0), controlFlags(0), f26(0), f27(0), frame(0), f2a(0), f2c(0), f2d(0), offs_2e(0), res(), animData(0), spriteData(0), speedX(0), speedY(0), prev(0), next(0), next2(0), f4e(0), f4f(0) {}
+
+	void clear() {
+		*this = Common::move(Sprite());
+		/*enable = 0;
+		delay = 0;
+		f4 = 0;
+		drawFlags = 0;
+		posX = 0;
+		posY = 0;
+		fe = 0;
+		f10 = 0;
+		f11 = 0;
+		f12 = 0;
+		f13 = 0;
+		f14 = 0;
+		f15 = 0;
+		f16 = 0;
+		f18 = 0;
+		f1c = 0;
+		f20 = 0;
+		f24 = 0;
+		controlFlags = 0;
+		f26 = 0;
+		f27 = 0;
+		frame = 0;
+		f2a = 0;
+		f2c = 0;
+		f2d = 0;
+		offs_2e = 0;
+		res = ResourcePointer();
+		animData = 0;
+		spriteData = 0;
+		speedX = 0;
+		speedY = 0;
+		prev = 0;
+		next = 0;
+		next2 = 0;
+		f4e = 0;
+		f4f = 0;*/
+	}
+
+	uint16 enable;
+	uint16 delay;
+	uint8 f4;
+	uint8 drawFlags;
+	uint32 posX;
+	uint32 posY;
+
+	uint16 fe;
+	uint8 f10;
+	uint8 f11;
+	uint16 f12;
+	uint8 f13;
+	uint8 f14;
+	uint8 f15;
+	uint8 f16;
+	uint16 f18;
+	uint8 f1c;
+	uint32 f20;
+	uint8 f24;
+	uint8 controlFlags;
+	uint8 f26;
+	uint8 f27;
+	uint16 frame;
+	int16 f2a;
+	uint8 f2c;
+	uint8 f2d;
+
+	uint32 offs_2e;
+	ResourcePointer res;
+	const uint8 *animData;
+	const uint16 *spriteData;
+
+	int32 speedX;
+	int32 speedY;
+	uint16 prev;
+	uint16 next;
+	uint16 next2;
+	uint8 f4e;
+	uint8 f4f;
+};
+
+class GraphicsEngine;
+class Renderer_SCD : public Renderer {
 public:
-	SCDRenderer() : Renderer(), _screenWidth(320), _screenHeight(224) {}
-	~SCDRenderer() override {}
+	Renderer_SCD(GraphicsEngine::State &state);
+	~Renderer_SCD() override;
 
-	uint16 screenWidth() const { return _screenWidth; }
-	uint16 screenHeight() const { return _screenHeight; }
+	void enqueueCopyCommands(ResourcePointer &res) override;
+	void doCommand(uint8 cmd) override;
+	void clearCopyCommands() override;
+	void initData(ResourcePointer &res, uint8 mode) override;
+	void initSprites(ResourcePointer &res, uint16 len) override;
+	void linkSprites(ResourcePointer &res, uint16 len) override;
+	void clearSprites(int mode = 0) override;
+	void setPlaneMode(uint16 mode) override;
+
+	void updateScreen(uint8 *screen) override;
+	void updateAnimations() override;
+
+	uint16 screenWidth() const override { return _screenWidth; }
+	uint16 screenHeight() const override { return _screenHeight; }
 
 private:
+	void loadDataFromGfxScript();
+	void executeCopyCommands();
+	void drawSprites();
+	void executeGfxCommands();
+	void reconfigPlanes();
+	void updateScrollState();
+
+	void drawSprite(Sprite &a);
+	void updateAnim32Spec(Sprite &s);
+	bool updateAnimationsFlag4(Sprite &s);
+	void runAnimScript(Sprite &s);
+
 	const uint16 _screenWidth, _screenHeight;
+
+	ResourcePointer _transferData;
+	uint8 *_tempBuffer;
+	uint16 *_spriteBuffer;
+	uint8 _transferMode;
+	uint16 _transferDelay;
+	uint16 _clearFlags;
+	uint8 _mode;
+	uint8 _modeChange;
+	int16 _vScrollStateA;
+	int16 _vScrollStateB;
+	int16 _hScrollStateA;
+	int16 _hScrollStateB;
+	uint16 *_hScrollTable;
+	uint16 _hScrollTableLen;
+	bool _scrollStateChanged;
+	bool _vScrollDisable;
+
+	Graphics::SegaRenderer *_sr;
+
+private:
+	Sprite *_sprites;
+
+	struct CopyCommand {
+		CopyCommand() : cmd(0), progress(0), ptr(0), res(), c(0), d(0) {}
+		void clear() {
+			cmd = 0;
+			progress = 0;
+			ptr = 0;
+			res = ResourcePointer();
+			c = 0;
+			d = 0;
+		}
+		uint8 cmd;
+		uint8 progress;
+		const uint8 *ptr;
+		ResourcePointer res;
+		uint8 c;
+		uint8 d;
+	};
+
+	CopyCommand *_copyCommands;
+
+private:
+	typedef Common::Functor2Mem<Sprite&, const uint8*, int, Renderer_SCD> GfxAnimFunc;
+	Common::Array<GfxAnimFunc*> _animProcs;
+
+	void makeAnimFunctions();
+
+	int anim_00(Sprite &s, const uint8 *data);
+	int anim_01(Sprite &s, const uint8 *data);
+	int anim_02(Sprite &s, const uint8 *data);
+	int anim_03(Sprite &s, const uint8 *data);
+	int anim_04(Sprite &s, const uint8 *data);
+	int anim_05(Sprite &s, const uint8 *data);
+	int anim_06(Sprite &s, const uint8 *data);
+	int anim_07(Sprite &s, const uint8 *data);
+	int anim_08(Sprite &s, const uint8 *data);
+	int anim_09(Sprite &s, const uint8 *data);
+	int anim_10(Sprite &s, const uint8 *data);
+	int anim_11(Sprite &s, const uint8 *data);
+	int anim_12(Sprite &s, const uint8 *data);
+	int anim_13(Sprite &s, const uint8 *data);
+	int anim_14(Sprite &s, const uint8 *data);
+	int anim_15(Sprite &s, const uint8 *data);
+	int anim_16(Sprite &s, const uint8 *data);
+	int anim_20(Sprite &s, const uint8 *data);
+	int anim_21(Sprite &s, const uint8 *data);
+	int anim_22(Sprite &s, const uint8 *data);
+	int anim_23(Sprite &s, const uint8 *data);
+	int anim_24(Sprite &s, const uint8 *data);
+	int anim_25(Sprite &s, const uint8 *data);
+	int anim_27(Sprite &s, const uint8 *data);
+	int anim_28(Sprite &s, const uint8 *data);
+	int anim_29(Sprite &s, const uint8 *data);
+	int anim_30(Sprite &s, const uint8 *data);
+	int anim_31(Sprite &s, const uint8 *data);
+	int anim_32(Sprite &s, const uint8 *data);
+	int anim_34(Sprite &s, const uint8 *data);
+	int anim_35(Sprite &s, const uint8 *data);
+	int anim_36(Sprite &s, const uint8 *data);
+	int anim_37(Sprite &s, const uint8 *data);
+	int anim_38(Sprite &s, const uint8 *data);
+	int anim_39(Sprite &s, const uint8 *data);
+	int anim_40(Sprite &s, const uint8 *data);
+	int anim_41(Sprite &s, const uint8 *data);
+	int anim_42(Sprite &s, const uint8 *data);
+	int anim_43(Sprite &s, const uint8 *data);
+	int anim_44(Sprite &s, const uint8 *data);
+	int anim_45(Sprite &s, const uint8 *data);
+	int anim_46(Sprite &s, const uint8 *data);
+	int anim_47(Sprite &s, const uint8 *data);
+	int anim_99(Sprite &s, const uint8 *data);
 };
 
-Renderer *Renderer::createSegaRenderer() {
-	return new SCDRenderer();
+Renderer_SCD::Renderer_SCD(GraphicsEngine::State &state) : Renderer(state), _screenWidth(256), _screenHeight(224), _transferData(), _transferMode(0),
+	_transferDelay(0), _clearFlags(0), _mode(1), _modeChange(0), _tempBuffer(nullptr), _spriteBuffer(nullptr), _sr(nullptr), _sprites(nullptr), _copyCommands(nullptr),
+	_vScrollStateA(0), _vScrollStateB(0), _hScrollStateA(0), _hScrollStateB(0), _hScrollTable(nullptr), _hScrollTableLen(0), _vScrollDisable(false), _scrollStateChanged(false) {
+
+	makeAnimFunctions();
+
+	_sr = new Graphics::SegaRenderer();
+	assert(_sr);
+
+	_tempBuffer = new uint8[0x10000]();
+	assert(_tempBuffer);
+
+	_spriteBuffer = new uint16[0x100]();
+	assert(_spriteBuffer);
+
+	_sprites = new Sprite[64];
+	assert(_sprites);
+
+	_copyCommands = new CopyCommand[7];
+	assert(_copyCommands);
+
+	_hScrollTable = new uint16[0x200]();
+	assert(_hScrollTable);
+
+	_sr->setResolution(_screenWidth, _screenHeight);
+	_sr->setupWindowPlane(0, 0, Graphics::SegaRenderer::kWinToLeft, Graphics::SegaRenderer::kWinToTop);
+	_sr->setVScrollMode(Graphics::SegaRenderer::kVScrollFullScreen);
+	_sr->setHScrollMode(Graphics::SegaRenderer::kHScrollFullScreen);
+	_sr->setPitch(64);
+
+	reconfigPlanes();
+}
+
+Renderer_SCD::~Renderer_SCD() {
+	delete _sr;
+	delete[] _tempBuffer;
+	delete[] _spriteBuffer;
+	delete[] _sprites;
+	delete[] _copyCommands;
+	delete[] _hScrollTable;
+
+	for (uint i = 0; i < _animProcs.size(); ++i) \
+		delete _animProcs[i];
+}
+
+void Renderer_SCD::enqueueCopyCommands(ResourcePointer &res) {
+	for (CopyCommand *it = _copyCommands; it < &_copyCommands[7]; ++it) {
+		if (it->cmd != 0)
+			continue;
+		it->res = res;
+		it->cmd = *res++;
+		it->progress = 0;
+		it->ptr = ++res;
+		break;
+	}
+}
+
+void Renderer_SCD::doCommand(uint8 cmd) {
+	struct CmdState {
+		bool needScroll;
+		uint16 word1;
+		uint16 word2;
+		uint16 word3;
+		uint16 word4;
+		uint8 cmd_7orabove;
+		uint8 cmd_0to6;
+		uint8 cmd_FF_or_FC;
+		uint16 word18;
+		uint16 word1C;
+		uint16 word28;
+		uint16 word2C;
+		uint16 word30;
+		uint16 word34;
+		uint16 word38;
+		uint16 word3C;
+	} _cmdState;
+
+	_gfxState.setVar(3, 1);
+
+	if (cmd == 0xFF || cmd == 0xFC) {
+		memset(&_cmdState, 0, sizeof(_cmdState));
+		_hScrollStateA = _hScrollStateB = _vScrollStateA = _vScrollStateB = 0;
+		_cmdState.cmd_FF_or_FC = cmd;
+	} else {
+		if (cmd >= 7 && cmd != 0xFD) {
+			_cmdState.cmd_7orabove = cmd;
+		} else {
+			_cmdState.cmd_0to6 = cmd;
+			_cmdState.needScroll = (cmd < 3) ? cmd : 0;
+		}
+	}
+}
+
+void Renderer_SCD::clearCopyCommands() {
+	for (CopyCommand *it = _copyCommands; it < &_copyCommands[7]; ++it)
+		it->clear();
+}
+
+void Renderer_SCD::initData(ResourcePointer &res, uint8 mode) {
+	_transferData = res;
+	_transferMode = mode;
+}
+
+void Renderer_SCD::initSprites(ResourcePointer &res, uint16 len) {
+	const uint8 *next = res + len;
+	const uint8 *data = res();
+	while (data < next) {
+		assert(*data < (64 * sizeof(Sprite)));
+		Sprite *s = &_sprites[*data++];
+		if (s->enable)
+			return;
+
+		s->clear();
+		s->enable = 1;
+		s->res = res;
+		s->controlFlags = *data++;
+		s->posX = READ_BE_UINT16(data);
+		data += 2;
+		s->posY = READ_BE_UINT16(data);
+		data += 2;
+		s->offs_2e = READ_BE_UINT32(data);
+		data += 4;
+		s->animData = data + READ_BE_UINT16(data) + 2;
+		data += 2;
+		s->frame = 0xFFFF;
+
+		uint8 v = *s->animData;
+		for (bool l = true; l; ) {
+			if (v == 0xA1 || v == 0xA7) {
+				s->f16 = s->animData[1];
+				v = s->animData[4];
+			} else {
+				if (!(v & 0x80))
+					s->spriteData = reinterpret_cast<const uint16*>(res.makeAbsPtr(s->offs_2e).getDataFromTable(v)());
+				l = false;
+			}
+		}
+	}
+}
+
+void Renderer_SCD::linkSprites(ResourcePointer &res, uint16 len) {
+	const uint8 *next = res + len;
+	const uint8 *data = res();
+	while (data < next) {
+		uint16 i1 = *data++;
+		uint16 i2 = *data++;
+		assert(i1 < ARRAYSIZE(_sprites) && i2 < ARRAYSIZE(_sprites));
+		Sprite *s1 = &_sprites[i1];
+		Sprite *s2 = &_sprites[i2];
+		s2->next2 = s1->next;
+		s1->next = i2;
+		s2->prev = i1;
+	}
+}
+
+void Renderer_SCD::clearSprites(int mode) {
+	if (mode) {
+		for (int i = 1; i < 64; ++i) {
+			Sprite *s = &_sprites[i];
+			if (s->enable && !(s->f4e & 1))
+				s->clear();
+		}
+	} else {
+		for (int i = 1; i < 64; ++i)
+			_sprites[i].clear();
+	}
+}
+void Renderer_SCD::setPlaneMode(uint16 mode) {
+	assert(mode >> 8 == 0);
+	_modeChange = mode & 0xFF;;
+}
+
+void Renderer_SCD::updateScreen(uint8 *screen) {
+	if (_gfxState.getVar(9)) {
+		_sr->setPlaneTableLocation(Graphics::SegaRenderer::kPlaneB, _gfxState.getVar(9) == 0xFF ? 0xE000 : 0xC000);
+		_gfxState.setVar(9, 0);
+	}
+
+	if (_clearFlags & 1)
+		_sr->memsetVRAM(0xE000, 0, 0x2000);
+	if (_clearFlags & 2)
+		_sr->memsetVRAM(0xC000, 0, 0x2000);
+	_clearFlags = 0;
+
+	if (_modeChange)
+		reconfigPlanes();
+
+	loadDataFromGfxScript();
+	executeCopyCommands();
+	drawSprites();
+	executeGfxCommands();
+
+	_sr->render(screen);
+}
+
+uint16 _anima_a1 = 0;
+uint16 _anima_a2 = 0;
+uint16 _anima_a3 = 0;
+void Renderer_SCD::updateAnimations() {
+	for (Sprite *s = _sprites; s < &_sprites[64]; ++s) {
+		_anima_a2 = _anima_a1;
+		if ((s->f1c || s->f26) && _anima_a3)
+			continue;
+
+		do {
+			if (!s->enable)
+				break;
+			if (s->controlFlags & 4) {
+				if (updateAnimationsFlag4(*s))
+					break;
+				s->controlFlags &= ~4;
+			}
+			runAnimScript(*s);
+			if (--_anima_a2 < 0)
+				break;
+		} while (s->f26);
+	}
+
+	for (Sprite *s = _sprites; s < &_sprites[64]; ++s) {
+		if (!s->enable || (s->f1c & _anima_a3))
+			continue;
+
+		uint16 offs = s->frame == 0xFFFF ? 0 : s->frame;
+		const uint8 *in = &s->animData[offs << 2];
+		if (!(*in & 0x80))
+			s->spriteData = reinterpret_cast<const uint16*>(s->res.makeAbsPtr(s->offs_2e).getDataFromTable(*in)());
+
+		if (s->controlFlags & 1) {
+			s->posX += s->speedX;
+			s->posY += s->speedY;
+		}
+	}
+
+}
+void Renderer_SCD::loadDataFromGfxScript() {
+	if (_gfxState.getVar(0)) {
+		if (_gfxState.getVar(0) == 1) {
+			_gfxState.setVar(0, 2);
+			_clearFlags = 3;
+		} else {
+			_gfxState.setVar(0, 0);
+		}
+		return;
+	}
+
+	if (!_gfxState.getVar(8))
+		return;
+	
+	if (_transferDelay) {
+		--_transferDelay;
+		return;
+	}
+
+	if (*reinterpret_cast<const uint16*>(_transferData()) == 0xFFFF) {
+		_gfxState.setVar(8, 0);
+		return;
+	}
+
+	_transferDelay = READ_BE_UINT16(_transferData() + 4);
+	const byte *src = _transferData.makeAbsPtr(READ_BE_UINT32(_transferData()) & 0xFFFFFF)();
+	uint16 addr = READ_BE_UINT16(_transferData() + 6);
+
+	if (!_transferMode) {
+		_transferData += 8;
+		uint32 len = READ_BE_UINT16(src);
+		if (len != Util::decodeSCDData(src + 2, _tempBuffer))
+			error("%s(): Decode size mismatch", __FUNCTION__);
+		_sr->loadToVRAM(_tempBuffer, len, addr);
+		return;
+	}
+
+	assert(0);
+
+	// multi part transfer: not needed (this is just due to original hardware limitations with the word ram and dma transfer)
+
+	/*int D7 = 0;
+	if (_transferOffset) {
+		D7 = 0;//processGfxScriptCase1_set_dstA5_to_238000_etc();
+		//len = D7;
+	}*/
+
+	//_transferSrc = 0x238000;
+	//_transferVRAMAddr += _transferOffset;
+	//_transferSrc += _transferOffset;
+
+	//if (_transferLen >= 0x800) {
+	//	_transferLen -= 0x800;
+	//	_transferOffset += 0x800;
+	//	D7 = 0x800;
+	/*} else {
+		D7 = _transferLen;
+		_transferOffset = 0;
+		_transferCommands += 8;
+	}*/
+	// code = 2
+	// ga_comm_loc_E322_writeWordRam_codeD6_dstA5_srcA6_lenD7
+}
+
+void Renderer_SCD::executeCopyCommands() {
+	if (_gfxState.getVar(8))
+		return;
+
+	static const uint8 offs[] =	{ 0x02, 0x03, 0x01, 0x03, 0x00, 0x02, 0x00, 0x01 };
+	static const uint8 mask[] =	{ 0xF0, 0x0F, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F };
+
+	for (CopyCommand *it = _copyCommands; it < &_copyCommands[7]; ++it) {
+		if (it->cmd == 0)
+			continue;
+
+		bool loop = (it->cmd & 0x40);
+		int section = (it->cmd & 0x30) >> 4;
+		uint8 *s = _tempBuffer + section * 0x2000;
+		const uint8 *bptr = nullptr;
+		uint8 a = 0;
+		uint8 b = 0;
+
+		if ((it->cmd & 0x0F) < 4 && (it->cmd & 0x0F) != 1 && !(it->cmd & 0x80)) {
+			uint32 len = READ_BE_UINT16(it->ptr);
+			if (len != Util::decodeSCDData(it->ptr + 2, s))
+				error("%s(): Decode size mismatch", __FUNCTION__);
+		}
+
+		switch (it->cmd & 0x0F) {
+		case 0:
+			_sr->loadToVRAM(s + READ_BE_UINT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
+			it->ptr += 10;
+			if (READ_BE_UINT16(it->ptr) == 0xFFFF) {
+				it->cmd = 0;
+				break;
+			}
+			break;
+		case 1:
+			for (bool rept = true; rept; ) {
+				memcpy(s + READ_BE_UINT16(it->ptr + 6), it->res.makeAbsPtr(READ_BE_UINT32(it->ptr))(), READ_BE_UINT16(it->ptr + 8));
+				_sr->loadToVRAM(s + READ_BE_UINT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
+				it->ptr += 10;
+				if (READ_BE_UINT16(it->ptr) == 0xFFFF) {
+					it->cmd = 0;
+					rept = false;
+				}
+			}
+			break;
+		case 2:
+			it->cmd |= 0x80;
+			for (bool rept = true; rept; ) {
+				_sr->loadToVRAM(s + READ_BE_UINT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
+				if (bptr)
+					it->ptr = bptr;
+				it->ptr += 10;
+				if (READ_BE_UINT16(it->ptr) == 0xFFFF) {
+					it->cmd = 0;
+					rept = false;
+				}
+				bptr = it->ptr - 4;
+				it->ptr = it->res.makeAbsPtr(READ_BE_UINT32(bptr))();
+			}
+			break;
+		case 3:
+			a = it->progress & 7;
+			b = (a + (((it->progress >> 3) * 5) & 7)) & 7;
+			a = (a << 2) + offs[b];
+			s += (a + READ_BE_UINT16(it->ptr + 6));
+			b = mask[b];
+			a = READ_BE_UINT16(it->ptr + 8) >> 5;
+			while (a--) {
+				*s &= b;
+				s += 32;
+			}
+			s = _tempBuffer + section * 0x2000;
+			_sr->loadToVRAM(s + READ_BE_UINT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
+			if (++it->progress == 65)
+				it->cmd = 0;
+			break;
+		case 4:
+			if (it->progress == 0)
+				memset(s, 0, 32);
+			a = it->progress & 7;
+			b = (a + (((it->progress >> 3) * 5) & 7)) & 7;
+			a = (a << 2) + offs[b];
+			b = (mask[b] ^ 0xFF) & 0x77;
+			s[a] |= b;
+			_sr->loadToVRAM(s, 32, 0);
+			if (++it->progress == 65)
+				it->cmd = 0;
+			break;
+		default:
+			error("%s(): Invalid instruction", __FUNCTION__);
+			break;
+		}
+
+		if (!loop)
+			break;
+	}
+}
+
+void Renderer_SCD::drawSprites() {
+	for (int i = 63; i >= 0; --i) {
+		Sprite &s = _sprites[i];
+		if (s.enable && s.spriteData != nullptr && !(s.controlFlags & 2) && s.delay != 0xFFFF && !(s.delay & _gfxState.frameCount()))
+			drawSprite(s);
+		if (i == 32)
+			updateAnim32Spec(s);
+	}
+}
+
+void Renderer_SCD::executeGfxCommands() {
+
+}
+
+static const uint8 src0000[] = {
+	0x13, 0x00, 0xaa, 0x00, 0x1c, 0x01, 0x11, 0x1c,
+	0x01, 0x22, 0x04, 0x01, 0x33, 0x04, 0x01, 0xaa,
+	0x44, 0x91, 0x55, 0x91, 0x77, 0x91, 0x99, 0x91,
+	0xbf, 0xa8, 0x01, 0x10, 0x01, 0x18, 0xa1, 0x01,
+	0x28, 0x01, 0x30, 0xff, 0x04, 0x01, 0x95, 0x06,
+	0x69, 0x05, 0x01, 0x6e, 0x70, 0x99, 0x09, 0x00,
+	0x00, 0x3f, 0x3b, 0xd3, 0xa7, 0x77, 0x78, 0x89,
+	0xab, 0x99, 0xaa, 0xac, 0xcc, 0x78, 0x9a, 0xbc,
+	0xcc, 0x56, 0x7a, 0xbb, 0xcc, 0x05, 0x56, 0x5a,
+	0xaa, 0x00, 0x00, 0x85, 0x77, 0x00, 0x07, 0x00,
+	0x27, 0x50, 0x15, 0xae, 0xc8, 0x05, 0x50, 0x50,
+	0x05, 0x87, 0x00, 0x57, 0x79, 0x90, 0x00, 0xaa,
+	0xba, 0x00, 0x00, 0xcc, 0xb7, 0x94, 0xa5, 0x50,
+	0x95, 0x84, 0xa7, 0x88, 0xab, 0x9c, 0x57, 0xa9,
+	0x00, 0x3b, 0xb4, 0x08, 0x80, 0x00, 0x68, 0x75,
+	0x05, 0x71, 0x0a, 0x3d, 0x55, 0x00, 0x23, 0xab,
+	0xd3, 0x77, 0x55, 0x05, 0x7a, 0x67, 0x79, 0x87,
+	0xac, 0x77, 0x8a, 0xbc, 0xcc, 0x98, 0x9a, 0xab,
+	0xcc, 0x77, 0x77, 0x7a, 0xcc, 0x56, 0x66, 0x57,
+	0xcc, 0x05, 0x55, 0x55, 0x00, 0x52, 0x59, 0x00,
+	0x4a, 0x58, 0x00, 0x7e, 0x77, 0x00, 0x85, 0x4f,
+	0x00, 0x2e, 0x01, 0xb3, 0xa7, 0x9f, 0x05, 0x85,
+	0x87, 0x7a, 0x96, 0x95, 0x00, 0x68, 0x00, 0x1e,
+	0xcc, 0x00, 0x5f, 0xcc, 0xa7, 0x00, 0x78, 0x42,
+	0xca, 0x89, 0xcc, 0xcb, 0xa5, 0x00, 0x87, 0x98,
+	0xf2, 0x75, 0x8f, 0x55, 0x75, 0x01, 0x76, 0x16,
+	0xbb, 0x27, 0x06, 0xcd, 0x57, 0x55, 0x56, 0x66,
+	0x7a, 0x77, 0x77, 0x89, 0xac, 0xaa, 0xab, 0xbc,
+	0xcc, 0x77, 0x78, 0xbb, 0xcc, 0x55, 0x56, 0x67,
+	0xac, 0xb5, 0x00, 0x9e, 0x7b, 0x00, 0x1c, 0x5a,
+	0x22, 0x21, 0x84, 0x08, 0x94, 0x5d, 0x21, 0x0a,
+	0x05, 0x21, 0x0b, 0x21, 0x36, 0x01, 0xd6, 0x90,
+	0x94, 0xa5, 0x1d, 0x94, 0xb7, 0x00, 0x84, 0x00,
+	0x7b, 0x03, 0x84, 0xba, 0x98, 0x75, 0x7f, 0xac,
+	0x9b, 0x02, 0xf6, 0x2f, 0x3b, 0x04, 0xc1, 0x02,
+	0xd8, 0x01, 0xe0, 0x05, 0x20, 0xba, 0x56, 0x66,
+	0x8a, 0xcc, 0x00, 0x7f, 0xcc, 0x99, 0x04, 0x9a,
+	0xcc, 0x98, 0xbc, 0xcc, 0x55, 0x68, 0x99, 0xfa,
+	0xac, 0x20, 0x95, 0x7a, 0x01, 0x9c, 0x31, 0x39,
+	0x01, 0x46, 0x01, 0x88, 0x01, 0x60, 0xc7, 0x01,
+	0xe8, 0x01, 0xf0, 0x01, 0xf8, 0xcc, 0xca, 0x70,
+	0x03, 0x84, 0x00, 0x80, 0x0f, 0x21, 0x18, 0x21,
+	0x20, 0x21, 0x28, 0x29, 0x3f, 0x00, 0x45, 0x33,
+	0x22, 0x69, 0x84, 0x55, 0x33, 0x94, 0x55, 0x21,
+	0xf9, 0xa4, 0x04, 0xdd, 0x03, 0x04, 0x5e, 0xa4,
+	0x45, 0x5c, 0x41, 0x34, 0xee, 0x04, 0x01, 0x41,
+	0x38, 0x2b, 0x05, 0x0c, 0x04, 0x20, 0x32, 0x03,
+	0x20, 0xe2, 0xb4, 0xff, 0xff, 0x8e, 0xf2, 0x9c,
+	0x01, 0x10, 0x40, 0x9e, 0x20, 0x00, 0x00, 0xb4,
+	0x76, 0x30, 0x04, 0x04, 0x00, 0x73, 0x23, 0x04,
+	0x04, 0x00, 0x1b, 0x1d, 0x01, 0x04, 0x55, 0x20,
+	0xf8, 0x5e, 0x94, 0x5d, 0x00, 0x9f, 0xee, 0x94,
+	0xdd, 0x7b, 0xa4, 0x00, 0x97, 0xee, 0x00, 0x13,
+	0x98, 0x84, 0x01, 0x84, 0xdd, 0x67, 0x91, 0x05,
+	0x08, 0x0f, 0x0c, 0x22, 0x22, 0x8c, 0x00, 0x8c,
+	0xe2, 0xb1, 0x98, 0xd2, 0x22, 0x23, 0xa4, 0x00,
+	0x97, 0x20, 0x00, 0x13, 0xf6, 0x30, 0xa4, 0x00,
+	0x93, 0x00, 0xa4, 0x19, 0x84, 0x44, 0x18, 0xa4,
+	0x36, 0x45, 0x24, 0xb1, 0x40, 0x76, 0x04, 0x94,
+	0x00, 0x9a, 0x55, 0xdd, 0xe9, 0x00, 0x90, 0xcc,
+	0xcc, 0xb8, 0x5c, 0x98, 0xa4, 0x00, 0x7d, 0xf5,
+	0x00, 0x13, 0xcc, 0x9b, 0xcc, 0x01, 0x88, 0x97,
+	0x06, 0x08, 0x15, 0x0c, 0x75, 0x0c, 0x20, 0xd2,
+	0x9c, 0xc2, 0x00, 0x43, 0xc1, 0x22, 0xd2, 0x22,
+	0x22, 0x00, 0xc2, 0x22, 0x23, 0x00, 0x88, 0x20,
+	0x7e, 0x00, 0x00, 0xaf, 0x94, 0x20, 0x48, 0x20,
+	0x41, 0x25, 0x54, 0x63, 0x37, 0x45, 0x63, 0x94,
+	0x20, 0xc0, 0x04, 0x55, 0x5b, 0x00, 0x93, 0x84,
+	0x45, 0x54, 0x55, 0xcc, 0x40, 0x30, 0xbb, 0x9f,
+	0xbb, 0x01, 0x84, 0xbb, 0x5f, 0x91, 0x01, 0x5c,
+	0xa8, 0x15, 0x0c, 0x18, 0x20, 0x22, 0x8c, 0xb2,
+	0xf6, 0x22, 0x00, 0x8f, 0x98, 0x22, 0xb4, 0x9b,
+	0x8c, 0x20, 0x3c, 0x3e, 0xb2, 0x00, 0x89, 0x25,
+	0xd0, 0x21, 0xcc, 0x3c, 0x48, 0x2d, 0xdb, 0x55,
+	0x04, 0x3f, 0x41, 0x74, 0x27, 0x64, 0x20, 0x5c,
+	0x00, 0xc8, 0x20, 0xe5, 0x93, 0xbb, 0x55, 0xc8,
+	0x55, 0xaa, 0xaa, 0x93, 0xaa, 0x45, 0x8b, 0x8c,
+	0xfe, 0x5a, 0x9c, 0x00, 0x91, 0x97, 0xb1, 0x01,
+	0x9c, 0x04, 0x0b, 0x06, 0x0c, 0xbb, 0x11, 0x14,
+	0x1c, 0x20, 0x33, 0x82, 0x81, 0x04, 0x0c, 0xa2,
+	0x00, 0x5f, 0x06, 0x22, 0x97, 0x84, 0xa3, 0x23,
+	0x23, 0xb3, 0x33, 0xc4, 0x33, 0x30, 0x40, 0xf3,
+	0x00, 0x33, 0x44, 0x20, 0x6c, 0x21, 0x74, 0x9f,
+	0x21, 0x70, 0x40, 0xc0, 0x41, 0xb8, 0x5c, 0x2c,
+	0x00, 0x32, 0x44, 0x55, 0x93, 0x2a, 0x55, 0x93,
+	0x59, 0x93, 0x99, 0x05, 0x18, 0x04, 0x44, 0xd6,
+	0x44, 0x01, 0xd8, 0xa1, 0x99, 0x01, 0xd8, 0x99,
+	0x04, 0x01, 0x01, 0x30, 0xbf, 0x00, 0x1b, 0x05,
+	0x01, 0x02, 0x17, 0x01, 0xa8, 0x05, 0x20, 0x03,
+	0x18, 0x59, 0x0a, 0x34, 0x0f, 0x09, 0x20, 0x05,
+	0x0c, 0x11, 0x14, 0x14, 0x20, 0x44, 0xaa, 0xaa,
+	0x44, 0x26, 0x44, 0x86, 0x61, 0xd6, 0x33, 0x00,
+	0x04, 0x18, 0x44, 0xaa, 0xf4, 0xa4, 0x44, 0x05,
+	0x01, 0x40, 0x82, 0x07, 0xd1, 0x00, 0x2b, 0x08,
+	0x01, 0x7f, 0x10, 0xf1, 0x05, 0x34, 0x37, 0x11,
+	0x5d, 0x09, 0x20, 0xf8, 0x61, 0x4c, 0x20, 0xfc,
+	0x04, 0x91, 0x40, 0xc4, 0x45, 0x55, 0x58, 0x97,
+	0x99, 0x05, 0x87, 0x52, 0x88, 0x8b, 0x88, 0x88,
+	0x00, 0xfb, 0x99, 0x97, 0x88, 0xfd, 0x97, 0x99,
+	0x97, 0xb1, 0x21, 0x18, 0x0d, 0x0c, 0x11, 0x14,
+	0x04, 0x0c, 0x4a, 0x94, 0x00, 0x3f, 0x33, 0x87,
+	0x93, 0x32, 0x87, 0x32, 0x40, 0x23, 0x88, 0x82,
+	0x22, 0x30, 0x99, 0x60, 0x45, 0x88, 0x03, 0x40,
+	0xbc, 0x8b, 0x20, 0x00, 0x43, 0x33, 0x00, 0x00,
+	0xd7, 0x93, 0x39, 0xd8, 0x41, 0x9c, 0x05, 0x03,
+	0xa8, 0x00, 0x40, 0xb0, 0x01, 0xac, 0x45, 0x67,
+	0x74, 0x55, 0x01, 0xa4, 0x57, 0x77, 0x77, 0x00,
+	0xaf, 0x88, 0xde, 0x55, 0x87, 0x88, 0x94, 0x9b,
+	0x88, 0x00, 0x13, 0xb1, 0x6f, 0x01, 0x88, 0x09,
+	0x08, 0x15, 0x0c, 0x04, 0x20, 0x72, 0xa4, 0x00,
+	0xb0, 0x22, 0xf3, 0x00, 0x4b, 0x94, 0x72, 0x22,
+	0x00, 0xaf, 0x40, 0x84, 0x40, 0x80, 0x41, 0x84,
+	0x1f, 0x60, 0x65, 0x41, 0x88, 0xb4, 0x64, 0x78,
+	0x22, 0x34, 0x05, 0x55, 0x56, 0x55, 0x20, 0x38,
+	0x57, 0x00, 0x8f, 0x56, 0x20, 0x3c, 0x66, 0x8f,
+	0x55, 0x52, 0x77, 0x94, 0x66, 0x45, 0x8f, 0x66,
+	0x01, 0x74, 0x66, 0xa7, 0x91, 0x05, 0x08, 0x0f,
+	0x0c, 0x72, 0x22, 0x8c, 0x22, 0x00, 0x6c, 0xd3,
+	0x84, 0xa8, 0x66, 0x62, 0x9c, 0x72, 0x03, 0x08,
+	0x9f, 0x7e, 0x23, 0x65, 0xdc, 0xa4, 0x21, 0x24,
+	0x3e, 0x28, 0x2a, 0x2c, 0x21, 0x21, 0x56, 0xea,
+	0x66, 0x03, 0x04, 0x66, 0x0b, 0x04, 0x56, 0x03,
+	0x04, 0x1e, 0x01, 0x00, 0x84, 0xeb, 0xa4, 0x00,
+	0x8f, 0x20, 0x04, 0x04, 0x30, 0xa4, 0x8b, 0xb4,
+	0xf3, 0x22, 0x01, 0x23, 0x90, 0x05, 0x54, 0x9c,
+	0x01, 0x78, 0x0a, 0xa1, 0x01, 0x68, 0xfe, 0x54,
+	0x40, 0xc4, 0x64, 0x7c, 0x01, 0x94, 0x0a, 0x20,
+	0x01, 0x63, 0x41, 0xe3, 0x65, 0x82, 0xcb, 0x0d,
+	0xde, 0x01, 0x64, 0x55, 0x20, 0x7d, 0x55, 0x55,
+	0xa4, 0x0e, 0x1f, 0x08, 0x00, 0x20, 0x02, 0x00,
+	0x99, 0x24, 0x33, 0x33, 0x20, 0x10, 0x5e, 0xee,
+	0xee, 0x02, 0xa4, 0x5d, 0xdd, 0xdd, 0x62, 0x05,
+	0x83, 0xdd, 0x25, 0xcc, 0x81, 0x94, 0xc3, 0xd5,
+	0x21, 0xb4, 0x33, 0x94, 0xe3, 0x04, 0x04, 0x32,
+	0x20, 0x3f, 0x05, 0x04, 0xa7, 0x21, 0x54, 0x40,
+	0x94, 0x84, 0x83, 0x20, 0xb4, 0x77, 0x00, 0x1d,
+	0xed, 0x05, 0x04, 0x63, 0x00, 0x30, 0xa4, 0x00,
+	0x00, 0x60, 0x84, 0x40, 0xa6, 0x91, 0x00, 0x5d,
+	0x00, 0x25, 0xee, 0x94, 0xdd, 0xdd, 0xa4, 0xb0,
+	0x02, 0x5c, 0xcc, 0xcc, 0xa4, 0x00, 0x7e, 0x00,
+	0x00, 0x7e
+};
+
+static const uint8 src2000[] = {
+	0x0c, 0x00, 0x4a, 0x00, 0x1e, 0x01, 0x11, 0x03,
+	0x04, 0x01, 0x17, 0x94, 0x70, 0xff, 0x03, 0x04,
+	0x01, 0x17, 0x9f, 0x03, 0x08, 0x00, 0x15, 0x94,
+	0x82, 0x05, 0x11, 0xe3, 0x0c, 0x3f, 0x05, 0x20,
+	0x11, 0x11, 0x17, 0x09, 0x08, 0xb4, 0x05, 0x49,
+	0x60, 0x11, 0x11, 0x70, 0x01, 0x77, 0x03, 0x08,
+	0x00, 0x64, 0x17, 0x7f, 0x00, 0x2c, 0xa8, 0x06,
+	0x44, 0x01, 0x62, 0x81, 0x04, 0x64, 0x87, 0x10,
+	0xbd, 0x00, 0x70, 0x71, 0x87, 0xc1, 0x07, 0x17,
+	0x07, 0x00, 0x00, 0x70, 0x00, 0x11, 0x71, 0x02,
+	0x3c, 0x02, 0x1c, 0x11, 0x00, 0x3c, 0xff, 0x83,
+	0x02, 0x8e, 0x8c, 0x88, 0x06, 0x60, 0x08, 0x4c,
+	0x0f, 0xa2, 0x01, 0xd5, 0xff, 0x01, 0x24, 0x08,
+	0x04, 0x02, 0xdd, 0x04, 0xa0, 0x05, 0x0b, 0x09,
+	0x20, 0x04, 0x33, 0x05, 0x3f, 0xf8, 0x01, 0x71,
+	0x71, 0x01, 0x70, 0x00, 0x80, 0x00, 0x88, 0xac,
+	0x0d, 0x70, 0xff, 0x24, 0x38, 0x06, 0xd8, 0x1a,
+	0x90, 0x21, 0x6f, 0x00, 0x30, 0x21, 0x03, 0x2c,
+	0x53, 0x22, 0x18, 0x7f, 0x1e, 0x01, 0x07, 0x40,
+	0x29, 0x86, 0x07, 0xe8, 0x07, 0x07, 0x03, 0x2c,
+	0x20, 0x7c, 0x17, 0xf5, 0xa2, 0x11, 0x20, 0x78,
+	0x71, 0xba, 0xa2, 0x22, 0x8c, 0x02, 0x75, 0xff,
+	0x03, 0xd8, 0x2b, 0x00, 0x25, 0x28, 0x09, 0x40,
+	0x02, 0x29, 0x03, 0xb5, 0x01, 0xbc, 0x21, 0xe8,
+	0xfb, 0x08, 0x20, 0x02, 0x49, 0x01, 0x01, 0x54,
+	0x0d, 0x60, 0x20, 0xf4, 0x02, 0x84, 0x06, 0x04,
+	0xfa, 0x77, 0x00, 0x3c, 0x10, 0x05, 0xc1, 0x21,
+	0x34, 0x06, 0x73, 0x02, 0x94, 0x0c, 0xa0, 0xff,
+	0x0c, 0x20, 0x0d, 0xc0, 0x41, 0x78, 0x41, 0x6e,
+	0x33, 0xe8, 0x0c, 0xc0, 0x10, 0x40, 0x0c, 0x14,
+	0xff, 0x02, 0xc8, 0x0a, 0xc0, 0x2d, 0x70, 0x2f,
+	0x7c, 0x12, 0x20, 0x47, 0xdf, 0x2c, 0x94, 0x46,
+	0x7b, 0xff, 0x2b, 0xfd, 0x25, 0xfc, 0x4e, 0x04,
+	0x0e, 0x35, 0x2c, 0xe1, 0x29, 0x80, 0x49, 0x55,
+	0x06, 0x08, 0xff, 0x20, 0x80, 0x21, 0x78, 0x61,
+	0x38, 0x40, 0xc8, 0x62, 0x48, 0x60, 0xa2, 0x23,
+	0xac, 0x45, 0x00, 0xff, 0x27, 0x24, 0x22, 0x50,
+	0x26, 0xf0, 0x61, 0xb3, 0x0a, 0x1c, 0x06, 0x0c,
+	0x01, 0x18, 0x4b, 0x20, 0x9f, 0x69, 0x43, 0x27,
+	0xa0, 0x21, 0x53, 0x23, 0xfc, 0x09, 0x02, 0x11,
+	0x70, 0x45, 0x3f, 0xff, 0x03, 0x70, 0x25, 0xe0,
+	0x01, 0x2c, 0x46, 0x0c, 0x02, 0x80, 0x0b, 0x20,
+	0x48, 0x0c, 0x65, 0xa0, 0xff, 0x0a, 0x80, 0x08,
+	0xbc, 0x25, 0x50, 0x09, 0x78, 0x08, 0xdc, 0x05,
+	0xe0, 0x02, 0xa8, 0x51, 0xfc, 0xff, 0x47, 0xc0,
+	0x43, 0xf1, 0x08, 0x04, 0xa2, 0x02, 0x17, 0x06,
+	0x60, 0x03, 0x10, 0x41, 0xeb, 0x7f, 0x03, 0xc4,
+	0x25, 0x94, 0x73, 0x57, 0x09, 0xe0, 0x62, 0x1a,
+	0xa2, 0x40, 0x7c, 0x11, 0xfc, 0x71, 0x71, 0x67,
+	0x26, 0x62, 0x16, 0x61, 0xd6, 0x25, 0x7c, 0x60,
+	0xbc, 0x02, 0xc0, 0xff, 0x25, 0xa0, 0x44, 0x41,
+	0x29, 0xa0, 0x09, 0xdc, 0x48, 0x50, 0x2c, 0x04,
+	0x66, 0x70, 0x12, 0x40, 0x59, 0x23, 0x24, 0x77,
+	0x00, 0x00, 0x93, 0x10, 0x40, 0x10, 0x67, 0x84,
+	0x00, 0xff, 0x02, 0x20, 0x29, 0x80, 0x23, 0xf4,
+	0x6f, 0xa0, 0x36, 0x05, 0x2d, 0xa0, 0x11, 0xc0,
+	0x0d, 0x18, 0xb7, 0x02, 0x9c, 0x47, 0xe8, 0x20,
+	0x35, 0x17, 0x09, 0x04, 0x20, 0x48, 0x10, 0x00,
+	0xbb, 0xfe, 0x10, 0x20, 0x38, 0x03, 0x40, 0x40,
+	0xfe, 0x06, 0x90, 0x49, 0xec, 0x00, 0x18, 0x64,
+	0xaf, 0xfe, 0x11, 0x0a, 0x20, 0x47, 0x00, 0x46,
+	0xa0, 0x6a, 0x5c, 0x45, 0x2f, 0x45, 0xc1, 0x21,
+	0xc7, 0xff, 0x01, 0xfc, 0x0d, 0x04, 0x45, 0x20,
+	0x00, 0x88, 0x02, 0x8c, 0x42, 0x20, 0x01, 0x44,
+	0x41, 0x24, 0xff, 0x03, 0x08, 0x66, 0xa0, 0x62,
+	0xd4, 0x0c, 0x04, 0x66, 0xa0, 0x41, 0x73, 0x63,
+	0x44, 0x45, 0x14, 0xff, 0x1e, 0x01, 0x06, 0xb8,
+	0x04, 0x8c, 0x05, 0x6c, 0x1a, 0x30, 0x02, 0xb5,
+	0x40, 0xd8, 0x46, 0xe0, 0xff, 0x4b, 0xc0, 0x50,
+	0x48, 0x0a, 0x41, 0x6a, 0x88, 0x47, 0x00, 0x66,
+	0x51, 0x6d, 0x7c, 0x25, 0x40, 0xff, 0x0d, 0x40,
+	0x42, 0xe4, 0x42, 0x4c, 0x44, 0xa2, 0x22, 0x78,
+	0x42, 0x44, 0x4e, 0x4c, 0x0a, 0x80, 0xfe, 0x17,
+	0x0c, 0x5c, 0x4b, 0xec, 0x6e, 0x08, 0x64, 0xa0,
+	0x66, 0x09, 0x54, 0xa0, 0x15, 0x21, 0xef, 0x45,
+	0x54, 0x0b, 0x12, 0x22, 0x38, 0x20, 0xd3, 0x71,
+	0x01, 0x18, 0x47, 0x20, 0x71, 0x00, 0xbb, 0x2c,
+	0x40, 0x40, 0xc8, 0x70, 0x40, 0xbc, 0x4a, 0xcc,
+	0x2a, 0xa0, 0x71, 0x14, 0xc0, 0xff, 0x2e, 0x80,
+	0x6b, 0x80, 0x12, 0x40, 0x28, 0x18, 0x39, 0x40,
+	0x09, 0x22, 0x07, 0x40, 0x33, 0x7f, 0xff, 0x25,
+	0x0c, 0x23, 0xf8, 0x48, 0x20, 0x41, 0xdf, 0x61,
+	0x34, 0x41, 0xfc, 0x04, 0x0c, 0x40, 0x67, 0xff,
+	0x21, 0x25, 0x0b, 0xa0, 0x2d, 0x9c, 0x0d, 0xc0,
+	0x09, 0xdc, 0x61, 0xbe, 0x0c, 0xff, 0x41, 0x21,
+	0xff, 0x29, 0x3c, 0x21, 0x8c, 0x0b, 0x40, 0x00,
+	0x23, 0x20, 0x98, 0x22, 0x7c, 0x21, 0xa8, 0x6c,
+	0x4c, 0xff, 0x4f, 0x9c, 0x2b, 0x44, 0x63, 0x50,
+	0x42, 0x8c, 0x05, 0xd0, 0x47, 0x40, 0x41, 0x2b,
+	0x03, 0x17, 0xff, 0x06, 0x0c, 0x47, 0x37, 0x68,
+	0xdf, 0x11, 0x10, 0x0b, 0x35, 0x00, 0x1d, 0x09,
+	0x4d, 0x04, 0x5f, 0xbc, 0x71, 0x77, 0x07, 0x11,
+	0x6d, 0xb9, 0x61, 0x13, 0x00, 0xce, 0x17, 0x40,
+	0x3b, 0x7f, 0x60, 0x26, 0x40, 0x38, 0x60, 0x08,
+	0x00, 0xde, 0x42, 0x78, 0x20, 0x19, 0x1f, 0x00
+};
+
+static const uint8 srcPlaneA[] = {
+	0x10, 0x00, 0xfc, 0x40, 0x00, 0x1e, 0x02, 0x1a,
+	0x02, 0x1e, 0x01, 0x1c, 0x01, 0x1e, 0x62, 0x1e,
+	0x80, 0xff, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x02,
+	0x1e, 0x80, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x02,
+	0x1e, 0x80, 0x87, 0x1e, 0x01, 0x1e, 0x80, 0x0f,
+	0x58, 0x20, 0x14, 0x20, 0x15, 0x04, 0x02, 0x78,
+	0x16, 0x20, 0x17, 0x11, 0x30, 0x1e, 0x01, 0x1e,
+	0x80, 0x1a, 0x80, 0x19, 0xc4, 0x20, 0x1a, 0x04,
+	0x02, 0x1b, 0x20, 0x1c, 0x1e, 0x80, 0x1e, 0x01,
+	0x03, 0x1e, 0x80, 0x0a, 0x58, 0x20, 0x1d, 0x20,
+	0x1e, 0x20, 0x1f, 0x7b, 0xb2, 0x81, 0x21, 0x13,
+	0x30, 0x1e, 0x01, 0x1e, 0x80, 0x18, 0x80, 0x22,
+	0x10, 0x20, 0x23, 0x20, 0x24, 0xb2, 0x25, 0x20,
+	0x26, 0x0f, 0x1e, 0x80, 0x1e, 0x01, 0x19, 0x80,
+	0x0d, 0x18, 0x20, 0x27, 0x20, 0x28, 0x10, 0x20,
+	0x29, 0x20, 0x2a, 0x92, 0x2b, 0x20, 0x2c, 0xfc,
+	0x20, 0x2d, 0x1e, 0x38, 0x1e, 0x01, 0x1e, 0x80,
+	0x23, 0xf2, 0xcd, 0x18, 0x20, 0x2e, 0x20, 0x2f,
+	0x20, 0x30, 0x20, 0x31, 0x20, 0x32, 0x20, 0x33,
+	0x20, 0x34, 0x20, 0x35, 0x20, 0x36, 0x20, 0x37,
+	0x1e, 0x38, 0x07, 0x1e, 0x01, 0x1e, 0x80, 0x05,
+	0xf8, 0x38, 0x20, 0x39, 0x20, 0x3a, 0x11, 0xb2,
+	0x3b, 0x20, 0x3c, 0x66, 0xa6, 0x14, 0x40, 0x15,
+	0x79, 0x04, 0x02, 0x16, 0x40, 0x6a, 0x08, 0x1e,
+	0x01, 0x1e, 0x80, 0x4a, 0xf0, 0x3d, 0x10, 0x20,
+	0x3e, 0x20, 0x3f, 0xb2, 0x40, 0x20, 0x41, 0x41,
+	0x06, 0x7e, 0x18, 0x40, 0x19, 0x40, 0x1a, 0x04,
+	0x02, 0x1b, 0x1e, 0x40, 0x6a, 0x08, 0x1e, 0x01,
+	0x1e, 0x80, 0x0a, 0x80, 0x42, 0x20, 0x43, 0x11,
+	0x04, 0x02, 0x44, 0x20, 0x45, 0x06, 0x80, 0x1d,
+	0x40, 0x1e, 0xe4, 0x40, 0x1f, 0xb2, 0x20, 0x40,
+	0x6c, 0x08, 0x1e, 0x01, 0x1e, 0x80, 0x41, 0x48,
+	0xf0, 0x46, 0x20, 0x47, 0x20, 0x48, 0x04, 0x02,
+	0x49, 0x41, 0x68, 0x24, 0x22, 0x40, 0x23, 0x40,
+	0x24, 0xb2, 0x25, 0x1e, 0x40, 0x6c, 0x08, 0x1e,
+	0x01, 0x1e, 0x80, 0x08, 0x80, 0x4a, 0x20, 0x4b,
+	0x14, 0x20, 0x4c, 0x04, 0x02, 0x4d, 0x04, 0x7c,
+	0x27, 0x40, 0x28, 0x10, 0x40, 0x29, 0x40, 0x2a,
+	0x92, 0x2b, 0x40, 0x2c, 0xfe, 0x40, 0x66, 0x08,
+	0x1e, 0x80, 0x1e, 0x01, 0x7b, 0x80, 0x20, 0xf4,
+	0xca, 0x2e, 0x40, 0x2f, 0x40, 0x30, 0x40, 0x31,
+	0x40, 0x32, 0x40, 0x33, 0x40, 0x34, 0x40, 0x35,
+	0x40, 0x36, 0x40, 0x68, 0x08, 0x0f, 0x1e, 0x80,
+	0x1e, 0x01, 0x2b, 0x00, 0x0d, 0x50, 0x40, 0x38,
+	0x40, 0x39, 0xe4, 0x40, 0x3a, 0xb2, 0x3b, 0x40,
+	0x60, 0x08, 0x0d, 0x28, 0x1e, 0x80, 0x03, 0x1e,
+	0x01, 0x19, 0x80, 0x40, 0x3d, 0x40, 0x3e, 0x40,
+	0x3f, 0x7f, 0xb2, 0x81, 0x62, 0x08, 0x1e, 0x80,
+	0x1e, 0x01, 0x1e, 0x80, 0x09, 0x80, 0x42, 0xe4,
+	0x40, 0x43, 0x04, 0x02, 0x44, 0x40, 0x62, 0x08,
+	0x1e, 0x80, 0x1e, 0x01, 0x03, 0x1e, 0x80, 0x06,
+	0x50, 0x40, 0x46, 0x40, 0x47, 0x40, 0x48, 0x3f,
+	0x04, 0x02, 0x64, 0x08, 0x1e, 0x80, 0x1e, 0x01,
+	0x57, 0x80, 0x0e, 0x5e, 0x4a, 0x40, 0xe8, 0x4b,
+	0x40, 0x4c, 0x04, 0x02, 0x4d, 0x15, 0x7a, 0x1e,
+	0x80, 0x1e, 0x01, 0xff, 0x19, 0xd8, 0x1e, 0x02,
+	0x1e, 0x80, 0x1e, 0x01, 0x33, 0x80, 0xd9, 0x51,
+	0x00, 0x52, 0x00, 0x53, 0x00, 0x54, 0x00, 0x55,
+	0x00, 0x56, 0x00, 0x57, 0x00, 0x58, 0x00, 0x59,
+	0x00, 0x5a, 0x00, 0x5b, 0x00, 0x5c, 0x00, 0x5d,
+	0x00, 0x5e, 0x00, 0x5f, 0x00, 0x4e, 0x00, 0x4f,
+	0x1e, 0x80, 0x1e, 0x01, 0xff, 0x57, 0x80, 0xde,
+	0x00, 0x60, 0x00, 0x61, 0x00, 0x62, 0x00, 0x63,
+	0x00, 0x64, 0x00, 0x65, 0x00, 0x66, 0x00, 0x67,
+	0x00, 0x68, 0x00, 0x69, 0x00, 0x6a, 0x00, 0x6b,
+	0x00, 0x6c, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x6f,
+	0x00, 0x90, 0x00, 0x91, 0x00, 0x92, 0x1e, 0x80,
+	0x1e, 0x01, 0x16, 0x80, 0xdd, 0x70, 0x00, 0x71,
+	0x00, 0x72, 0x00, 0x73, 0x00, 0x74, 0x00, 0x75,
+	0x00, 0x76, 0x00, 0x77, 0x00, 0x78, 0x00, 0x79,
+	0x00, 0x7a, 0x00, 0x7b, 0x00, 0x7c, 0x00, 0x7d,
+	0x00, 0x7e, 0x00, 0x7f, 0x00, 0x50, 0x00, 0x93,
+	0x00, 0x94, 0x1e, 0x78, 0x1e, 0x01, 0xff, 0x16,
+	0x80, 0xc5, 0x80, 0x00, 0x81, 0x00, 0x82, 0x00,
+	0x83, 0x00, 0x84, 0x00, 0x85, 0x00, 0x86, 0x9e,
+	0xcd, 0x88, 0x00, 0x89, 0x00, 0x8a, 0x00, 0x8b,
+	0x00, 0x8c, 0x00, 0x8d, 0x00, 0x8e, 0x00, 0x8f,
+	0x00, 0x87, 0x00, 0x95, 0x00, 0x96, 0x1e, 0x80,
+	0x1e, 0x01, 0x5e, 0x80, 0x1e, 0x02, 0xff, 0x1e,
+	0x01, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x80, 0x1e,
+	0x01, 0x1e, 0x01, 0x1e, 0x98, 0x1e, 0x28, 0xff,
+	0x1e, 0x01, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x01,
+	0x1e, 0x01, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x01,
+	0x7f, 0x1e, 0x01, 0x1e, 0x01, 0x1e, 0x80, 0x1e,
+	0x01, 0x1e, 0x01, 0x50, 0x80, 0x1f
+};
+
+static const uint8 srcPlaneB[] = {
+	0x10, 0x00, 0xfc, 0x00, 0x01, 0x1e, 0x02, 0x1b,
+	0x02, 0x1e, 0x01, 0x1c, 0x01, 0x1e, 0x62, 0x1b,
+	0x02, 0xbc, 0x60, 0x02, 0x1e, 0x02, 0x1a, 0x02,
+	0x1e, 0x62, 0x1d, 0x80, 0x03, 0x1e, 0x02, 0xff,
+	0x1a, 0x02, 0x1e, 0x62, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
+	0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
+	0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x07, 0x1e, 0x02,
+	0x0d, 0x02, 0x1f, 0x00
+};
+
+void Renderer_SCD::reconfigPlanes() {
+	if (_modeChange == 0xFF)
+		_mode = 1;
+	else if (_modeChange)
+		_mode = 2;
+
+	static const uint16 dimCfgData[3][2] = {
+		{512, 512},
+		{256, 512},
+		{512, 256}
+	};
+
+	static const uint16 memCfgData[3][5] = {
+		{0xE000, 0xC000, 0xB000, 0xBE00, 0xB800},
+		{0xE000, 0xC000, 0xF000, 0xFE00, 0xF800},
+		{0xE000, 0xC000, 0xF000, 0xFE00, 0xF800}
+	};
+
+	_sr->setupPlaneAB(dimCfgData[_mode][0], dimCfgData[_mode][1]);
+	_sr->setPitch(dimCfgData[_mode][0] >> 3);
+
+	const uint16 *in = memCfgData[_mode];
+	_sr->setPlaneTableLocation(Graphics::SegaRenderer::kPlaneA, *in++);
+	_sr->setPlaneTableLocation(Graphics::SegaRenderer::kPlaneB, *in++);
+	_sr->setPlaneTableLocation(Graphics::SegaRenderer::kWindowPlane, *in++);
+	_sr->setSpriteTableLocation(*in++);
+	_sr->setHScrollTableLocation(*in);
+
+	in = memCfgData[_mode];
+	_sr->memsetVRAM(*in++, 0, 0x1000);
+	_sr->memsetVRAM(*in++, 0, 0x1000);
+	in += 2;
+	_sr->memsetVRAM(*in, 0, 0x200);
+	_sr->memsetVRAM(0, 0, _mode ? 0xC000 : 0xB000);
+
+	static const uint8 data[] = {
+		0x33, 0x2e, 0x21, 0x34, 0x23, 0x28, 0x25, 0x32,
+		0x00, 0x34, 0x2d, 0x00, 0x29, 0x33, 0x21, 0x00,
+		0x34, 0x32, 0x21, 0x24, 0x25, 0x2d, 0x21, 0x32,
+		0x2b, 0x00, 0x2f, 0x26, 0x00, 0x2b, 0x2f, 0x2e,
+		0x21, 0x2d, 0x29, 0x00, 0x23, 0x2f, 0x0e, 0x0c,
+		0x2c, 0x34, 0x24, 0x0e, 0x34, 0x2d, 0x00, 0x21,
+		0x2e, 0x24, 0x00, 0x5f, 0x00, 0x11, 0x19, 0x19,
+		0x14, 0x00, 0x2b, 0x2f, 0x2e, 0x21, 0x2d, 0x29,
+		0x00, 0x23, 0x2f, 0x0e, 0x0c, 0x2c, 0x34, 0x24,
+		0x0e, 0x00, 0x2c, 0x29, 0x23, 0x25, 0x2e, 0x33,
+		0x25, 0x24, 0x00, 0x22, 0x39, 0x00, 0x33, 0x25,
+		0x27, 0x21, 0x00, 0x25, 0x2e, 0x34, 0x25, 0x32,
+		0x30, 0x32, 0x29, 0x33, 0x25, 0x33, 0x0c, 0x2c,
+		0x34, 0x24, 0x0e
+	};
+
+	uint16 *d = new uint16[ARRAYSIZE(data)];
+	for (int i = 0; i < ARRAYSIZE(data); ++i)
+		d[i] = TO_BE_16(data[i] | 0x100);
+
+	_sr->loadToVRAM(d, 22, 0xE294);
+	_sr->loadToVRAM(&d[12], 4, 0xE39C);
+	_sr->loadToVRAM(&d[14], 60, 0xE482);
+	_sr->loadToVRAM(&d[44], 58, 0xE704);
+	_sr->loadToVRAM(&d[74], 22, 0xEA94);
+	_sr->loadToVRAM(&d[86], 42, 0xEB8C);
+	
+	delete[] d;
+
+	uint32 len = Util::decodeSCDData(src0000 + 2, _tempBuffer);
+	_sr->loadToVRAM(_tempBuffer, len, 0);
+	len = Util::decodeSCDData(src2000 + 2, _tempBuffer);
+	_sr->loadToVRAM(_tempBuffer, len, 0x2000);
+	len = Util::decodeSCDData(srcPlaneA + 2, _tempBuffer);
+	_sr->loadToVRAM(_tempBuffer, len, 0xE000);
+	len = Util::decodeSCDData(srcPlaneB + 2, _tempBuffer);
+	_sr->loadToVRAM(_tempBuffer, len, 0xC000);
+	
+	_modeChange = 0;
+}
+
+void Renderer_SCD::updateScrollState() {
+	if (!_scrollStateChanged)
+		return;
+
+	if (!_vScrollDisable) {
+		_sr->writeUint16VSRAM(0, TO_BE_16((uint16)(-_vScrollStateA) & 0x3FF));
+		_sr->writeUint16VSRAM(2, TO_BE_16((uint16)(-_vScrollStateB) & 0x3FF));
+	}
+
+	if (_hScrollTableLen) {
+		_sr->loadToVRAM(_hScrollTable, 0x400, 0xF800);
+	} else {
+		uint16 addr = _mode ? 0xF800 : 0xB800;
+		_sr->writeUint16VRAM(addr, TO_BE_16((uint16)_hScrollStateA & 0x3FF));
+		_sr->writeUint16VRAM(addr + 2, TO_BE_16((uint16)_hScrollStateB & 0x3FF));
+	}
+
+	_scrollStateChanged = false;
+}
+
+void Renderer_SCD::drawSprite(Sprite &s) {
+	const uint16 *in = s.spriteData;
+	uint16 num = FROM_BE_16(*in++);
+	uint16 *d = _spriteBuffer;
+	memset(d, 0, 8);
+	int nxt = 1;
+
+	uint32 curY = s.posY + 0x800000;
+	uint32 curX = s.posX + 0x800000;
+
+	if (s.drawFlags & 4) {
+		curX += _hScrollStateA;
+		curY += _vScrollStateA;
+	}
+
+	if (s.drawFlags & 8) {
+		curX += _hScrollStateB;
+		curY += _vScrollStateB;
+	}
+
+	uint16 flip = (s.drawFlags & 3) << 11;
+	uint16 p = ((s.f18 & 4) << 13) | ((s.f18 & 0xF8) >> 3);
+
+	for (int i = 0; i < num && nxt < 65; ++i) {
+		uint16 origY = FROM_BE_16(*in++);
+		uint16 hw = FROM_BE_16(*in++);
+
+		if (s.drawFlags & 2)
+			origY = -origY - (((hw >> 5) & 0x18) + 8);
+
+		uint16 tl = FROM_BE_16(*in++);
+		uint16 origX = FROM_BE_16(*in++);
+
+		if (s.drawFlags & 1)
+			origX = -origX - (((hw >> 7) & 0x18) + 8);
+
+		tl = (tl | p) ^ flip;
+		if (s.f16 & 0x80) {
+			uint16 v = (s.f16 & 3) << 13;
+			tl = (tl & 0x9FFF) | v;
+		}
+
+		*d++ = TO_BE_16(origY + (curY >> 16));
+		*d++ = TO_BE_16(hw + (nxt++));
+		*d++ = TO_BE_16(tl);
+		*d++ = TO_BE_16(origX + (curX >> 16));
+	}
+
+	if (d - 3 > _spriteBuffer)
+		*(reinterpret_cast<uint8*>(d) - 5) = 0;
+
+	_sr->loadToVRAM(_spriteBuffer, (d - _spriteBuffer) * sizeof(uint16), 0xFE00);
+}
+
+void Renderer_SCD::updateAnim32Spec(Sprite &s) {
+
+}
+
+bool Renderer_SCD::updateAnimationsFlag4(Sprite &s) {
+	return false;
+}
+
+void Renderer_SCD::runAnimScript(Sprite &s) {
+	if (--s.f2a > 0) {
+		if (s.animData[s.frame << 2] != 0x97)
+			s.controlFlags &= ~2;
+		return;
+	}
+
+	int incr = (s.f4f == 0) ? 1 : 0;
+
+	while (incr != -1) {
+		s.frame += incr;
+		s.controlFlags &= ~2;
+		const uint8 *in = &s.animData[s.frame << 2];
+		uint8 op = *in;
+		if (op < 0x80) {
+			incr = anim_99(s, in + 1);
+		} else {
+			op -= 0x80;
+			assert(op < _animProcs.size());
+			if (_animProcs[op]->isValid())
+				incr = (*_animProcs[op])(s, in + 1);
+		}
+	}
+}
+
+#define ANM(x) &Renderer_SCD::anim_##x
+void Renderer_SCD::makeAnimFunctions() {
+	typedef int (Renderer_SCD::*AnimFunc)(Sprite&, const uint8*);
+	static const AnimFunc funcTbl[] = {
+		ANM(00),
+		ANM(01),
+		ANM(02),
+		ANM(03),
+		ANM(04),
+		ANM(05),
+		ANM(06),
+		ANM(07),
+		ANM(08),
+		ANM(09),
+		ANM(10),
+		ANM(11),
+		ANM(12),
+		ANM(13),
+		ANM(14),
+		ANM(15),
+		ANM(16),
+		ANM(16),
+		ANM(16),
+		ANM(16),
+		ANM(20),
+		ANM(21),
+		ANM(22),
+		ANM(23),
+		ANM(24),
+		ANM(25),
+		ANM(25),
+		ANM(27),
+		ANM(28),
+		ANM(29),
+		ANM(30),
+		ANM(31),
+		ANM(32),
+		ANM(32),
+		ANM(34),
+		ANM(35),
+		ANM(36),
+		ANM(37),
+		ANM(38),
+		ANM(39),
+		ANM(40),
+		ANM(41),
+		ANM(42),
+		ANM(43),
+		ANM(44),
+		ANM(45),
+		ANM(46),
+		ANM(47)
+	};
+
+	for (uint i = 0; i < ARRAYSIZE(funcTbl); ++i) \
+		_animProcs.push_back(new GfxAnimFunc(this, funcTbl[i]));
+}
+#undef ANM
+
+int Renderer_SCD::anim_00(Sprite &s, const uint8 *data) {
+	s.clear();
+	return -1;
+}
+
+int Renderer_SCD::anim_01(Sprite &s, const uint8 *data) {
+	return 0;
+}
+
+int Renderer_SCD::anim_02(Sprite &s, const uint8 *data) {
+	return 0;
+//	return 1;
+}
+
+int Renderer_SCD::anim_03(Sprite &s, const uint8 *data) {
+	return 0;
+	//	return 1;
+}
+
+int Renderer_SCD::anim_04(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_05(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_06(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_07(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_08(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_09(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_10(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_11(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_12(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_13(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_14(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_15(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_16(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_20(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_21(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_22(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_23(Sprite &s, const uint8 *data) {
+	//pl
+	return -1;
+}
+
+int Renderer_SCD::anim_24(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_25(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_27(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_28(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_29(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_30(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_31(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_32(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_34(Sprite &s, const uint8 *data) {
+	return 1;
+	//return -1;
+}
+
+int Renderer_SCD::anim_35(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_36(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_37(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_38(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_39(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_40(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_41(Sprite &s, const uint8 *data) {
+	return 1;
+	//return -1;
+}
+
+int Renderer_SCD::anim_42(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_43(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_44(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_45(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_46(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+int Renderer_SCD::anim_47(Sprite &s, const uint8 *data) {
+	return 1;
+}
+
+uint16 _rand_o_1 = 0;
+uint16 _rand_o_2 = 0;
+
+uint16 arand() {
+	_rand_o_1 += ((_rand_o_1 & 0xFF) << 8);
+	_rand_o_1 += _rand_o_2;
+	_rand_o_1 += ((_rand_o_2 << 8) | (_rand_o_2 >> 8));
+	if ((_rand_o_2 & 0xFF) + (_rand_o_2 >> 8) > 0xFF)
+		_rand_o_1++;
+	_rand_o_2 = (((_rand_o_2 & 0xFF) + (_rand_o_2 >> 8)) & 0xFF) | (_rand_o_2 & 0xFF00);
+	if (_rand_o_2 + 1 > 0xFFFF);
+		_rand_o_1++;
+	_rand_o_2++;
+	return _rand_o_1;
+}
+
+int16 subai(int16 a, int16 b) {
+	return ((b * arand()) >> 16) + a;
+}
+
+int Renderer_SCD::anim_99(Sprite &s, const uint8 *data) {
+	if (*data++) {
+		int d3 = *data++;
+		int d4 = *data++ - d3;
+		s.f2a = subai(d3, d4);
+	} else {
+		s.f2a = READ_BE_INT16(data);
+	}
+	return -1;
+}
+
+Renderer *Renderer::createSegaRenderer(GraphicsEngine::State &state) {
+	return new Renderer_SCD(state);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index 5f905b66252..22b0c174576 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -40,9 +40,9 @@ public:
 	uint32 read(void *dataPtr, uint32 dataSize) override { return _stream->read(dataPtr, dataSize); }
 
 	// Common::SeekableReadStream interface
-	int32 pos() const override { return _stream->pos(); }
-	int32 size() const override { return _stream->size(); }
-	bool seek(int32 offset, int whence = SEEK_SET) override { return _stream->seek(offset, whence); }
+	int64 pos() const override { return _stream->pos(); }
+	int64 size() const override { return _stream->size(); }
+	bool seek(int64 offset, int whence = SEEK_SET) override { return _stream->seek(offset, whence); }
 
 private:
 	Common::SeekableReadStream *_stream;
@@ -56,8 +56,8 @@ FIO::FIO(SnatcherEngine *vm, bool isBigEndian) : _vm(vm), _bigEndianTarget(isBig
 FIO::~FIO() {
 }
 
-SceneResource *FIO::createSceneResource(int index) {
-	return (index >= 0 && index < _resFileListSize)  ? new SceneResource(_vm, this, _resFileList[index], index) : 0;
+SceneModule *FIO::loadModule(int index) {
+	return (index >= 0 && index < _resFileListSize)  ? new SceneModule(_vm, this, _resFileList[index], index) : 0;
 }
 
 Common::SeekableReadStream *FIO::readStream(const Common::Path &file) {
@@ -104,11 +104,10 @@ const char *FIO::_resFileList[97] = {
 
 const int FIO::_resFileListSize = ARRAYSIZE(_resFileList);
 
-SceneResource::SceneResource(SnatcherEngine *vm, FIO *fio, const char *resFile, int index) : _vm(vm), _fio(fio), _resFile(resFile), _resIndex(index), _data(0), _dataSize(0), _handler(0) {
-	_handler = _shList[_resIndex] ? (_shList[_resIndex])(_vm, this, _fio) : 0;
-
+SceneModule::SceneModule(SnatcherEngine *vm, FIO *fio, const char *resFile, int index) : _vm(vm), _fio(fio), _resFile(resFile), _resIndex(index), _data(0), _dataSize(0), _updateHandler(0) {
 	assert(!_resFile.empty());
 	_data = _fio->fileData(_resFile, &_dataSize);
+	_updateHandler = _shList[_resIndex] ? (_shList[_resIndex])(_vm, this, _fio) : 0;
 
 	/*Common::SeekableReadStreamEndian *s = _fio->readStreamEndian(_resFile);
 	if (!s)
@@ -154,7 +153,7 @@ SceneResource::SceneResource(SnatcherEngine *vm, FIO *fio, const char *resFile,
 	//delete s;
 }
 
-SceneResource::~SceneResource() {
+SceneModule::~SceneModule() {
 	/*if (_table) {
 		for (uint16 i = 0; i < _tableSize; ++i)
 			delete _table[i];
@@ -164,33 +163,34 @@ SceneResource::~SceneResource() {
 	}*/
 
 	delete[] _data;
-	delete _handler;
+	delete _updateHandler;
 }
 
-const uint8 *SceneResource::getData(int offset) const {
+const uint8 *SceneModule::getData(int offset) const {
 	assert(offset >= 0x28000);
 	return _data + offset - 0x28000;
 }
 
-const uint8 *SceneResource::getDataFromTable(int offset, int tableEntry) const {
-	const uint8 *data = getData(offset);
-	return data + READ_BE_UINT16(data + (tableEntry << 1));
-}
-
-const uint8 *SceneResource::getDataFromMainTable(int tableEntry) const {
+/*const uint8 *SceneModule::getDataFromMainTable(int tableEntry) const {
 	return getDataFromTable(READ_BE_UINT32(getData(0x28004)), tableEntry);
+}*/
+
+ResourcePointer SceneModule::getPtr(int offset) const {
+	if (offset > 0x28000)
+		offset -= 0x28000;
+	return ResourcePointer(getData(0x28000), offset);
 }
 
-void SceneResource::startScene() {
-	if (_handler)
-		(*_handler)();
+void SceneModule::run(GameState &state) {
+	if (_updateHandler)
+		(*_updateHandler)(state);
 }
 
 #define S(id) &createSceneHandler_##id
 #define INVALD 0
 
-SceneResource::SHFactory *const SceneResource::_shList[97] = {
-	INVALD, INVALD, S(D0 ), S(D1 ), S(D2 ), INVALD, INVALD, INVALD,
+SceneModule::SHFactory *const SceneModule::_shList[97] = {
+	INVALD, INVALD, S(D0), S(D1), S(D2), INVALD, INVALD, INVALD,
 	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
 	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
 	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index da784915b1d..bfb888a2c52 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -22,7 +22,9 @@
 #ifndef SNATCHER_RESOURCE_H
 #define SNATCHER_RESOURCE_H
 
+#include "common/endian.h"
 #include "common/fs.h"
+#include "common/func.h"
 #include "common/scummsys.h"
 #include "common/str.h"
 
@@ -34,33 +36,59 @@ class SeekableReadStreamEndian;
 namespace Snatcher {
 
 class SnatcherEngine;
-class SceneResource;
+class SceneModule;
 class FIO;
 
+struct GameState {
+	int16 frameNo;
+	int16 frameState;
+	int16 finish;
+	int16 progressMain;
+	int16 progressSub;
+	int16 counter;
+	int16 modIndex;
+	int16 initState;
+};
+
 class SceneHandler {
 public:
-	SceneHandler(SnatcherEngine *vm, SceneResource *scn, FIO *fio) : _vm(vm), _scene(scn), _fio(fio) {}
+	SceneHandler(SnatcherEngine *vm, SceneModule *scn, FIO *fio) : _vm(vm), _module(scn), _fio(fio) {}
 	virtual ~SceneHandler() {}
-	virtual void operator()() = 0;
+	virtual void operator()(GameState &state) = 0;
 protected:
 	SnatcherEngine *_vm;
-	SceneResource *_scene;
+	SceneModule *_module;
 	FIO *_fio;
 };
 
-class SceneResource {
+struct ResourcePointer {
+	ResourcePointer() : dataStart(0), offset(0) {}
+	ResourcePointer(const uint8 *data, uint32 offs) : dataStart(data), offset(offs >= 0x28000 ? offs - 0x28000 : offs) {}
+	const uint8 *dataStart;
+	uint32 offset;
+	const uint8 *operator()() const { return dataStart + offset; }
+	const uint8 *operator++(int) { return dataStart + (offset++); }
+	const uint8 *operator++() { return dataStart + (++offset); }
+	const uint8 *operator+(int inc) const { return dataStart + offset + inc; }
+	void operator+=(int inc) { offset += inc; }
+	void operator=(const uint8 *ptr) { offset = ptr - dataStart; }
+	uint8 operator[](int index) const { return dataStart[offset + index]; }
+	ResourcePointer getDataFromTable(int tableEntry) const { return ResourcePointer(dataStart, offset + READ_BE_UINT16(dataStart + offset + (tableEntry << 1))); }
+	ResourcePointer makeAbsPtr(uint32 offs) const { return ResourcePointer(dataStart, offs); }
+};
+
+class SceneModule {
 	friend class FIO;
 public:
-	~SceneResource();
+	~SceneModule();
 
 	const uint8 *getData(int offset) const;
-	const uint8 *getDataFromTable(int offset, int tableEntry) const;
-	const uint8 *getDataFromMainTable(int tableEntry) const;
+	ResourcePointer getPtr(int offset) const;
 
-	void startScene();
+	void run(GameState &state);
 
 private:
-	SceneResource(SnatcherEngine *vm, FIO *fio, const char *resFile, int index);
+	SceneModule(SnatcherEngine *vm, FIO *fio, const char *resFile, int index);
 
 	const uint8 *_data;
 	uint32 _dataSize;
@@ -71,9 +99,9 @@ private:
 	FIO *_fio;
 	const int _resIndex;
 	Common::Path _resFile;
-	SceneHandler *_handler;
+	SceneHandler *_updateHandler;
 
-	typedef SceneHandler*(SHFactory)(SnatcherEngine*, SceneResource*, FIO*);
+	typedef SceneHandler*(SHFactory)(SnatcherEngine*, SceneModule*, FIO*);
 	static SHFactory *const _shList[97];
 };
 
@@ -82,7 +110,7 @@ public:
 	FIO(SnatcherEngine *vm, bool isBigEndian);
 	~FIO();
 
-	SceneResource *createSceneResource(int index);
+	SceneModule *loadModule(int index);
 
 	enum EndianMode {
 		kPlatformEndianness = 0,
diff --git a/engines/snatcher/scene.h b/engines/snatcher/scene.h
index f7334cbdfd6..ef3fb1ed555 100644
--- a/engines/snatcher/scene.h
+++ b/engines/snatcher/scene.h
@@ -26,11 +26,11 @@ namespace Snatcher {
 
 class SceneHandler;
 class SnatcherEngine;
-class SceneResource;
+class SceneModule;
 class FIO;
 
 #define declSHF(id) \
-	SceneHandler *createSceneHandler_##id(SnatcherEngine*, SceneResource*, FIO*)
+	SceneHandler *createSceneHandler_##id(SnatcherEngine*, SceneModule*, FIO*)
 
 declSHF(D0);
 declSHF(D1);
diff --git a/engines/snatcher/scene/scene_d0.cpp b/engines/snatcher/scene/scene_d0.cpp
index 2682c8e19fa..12cc769234c 100644
--- a/engines/snatcher/scene/scene_d0.cpp
+++ b/engines/snatcher/scene/scene_d0.cpp
@@ -19,31 +19,241 @@
 *
 */
 
+
+#include "snatcher/snatcher.h"
+#include "snatcher/graphics.h"
+#include "snatcher/sound.h"
 #include "snatcher/resource.h"
 #include "snatcher/scene_imp.h"
+#include "common/endian.h"
 
 namespace Snatcher {
 
-#define SCImp Scene_D0
-
 SH_HEAD_BEGIN(D0)
 // declarations
+SH_DCL_FRM(00)
+SH_DCL_FRM(01)
+SH_DCL_FRM(02)
+SH_DCL_FRM(03)
+SH_DCL_FRM(04)
+SH_DCL_FRM(05)
+SH_DCL_FRM(07)
+SH_DCL_FRM(08)
+SH_DCL_FRM(09)
+SH_DCL_FRM(10)
+SH_DCL_FRM(11)
+SH_DCL_FRM(12)
+SH_DCL_FRM(14)
+SH_DCL_FRM(16)
+SH_DCL_FRM(18)
+SH_DCL_FRM(20)
+SH_DCL_FRM(22)
+SH_DCL_FRM(24)
+SH_DCL_FRM(26)
+SH_DCL_FRM(28)
+SH_DCL_FRM(30)
+SH_DCL_FRM(31)
+SH_DCL_FRM(32)
+SH_DCL_FRM(34)
+
+const uint32 *_timeStamp;
+
 SH_HEAD_END(D0)
 
+SH_IMP_FRMTBL(D0) {
+	SH_FRM(00),
+	SH_FRM(01),
+	SH_FRM(02),
+	SH_FRM(03),
+	SH_FRM(04),
+	SH_FRM(05),
+	SH_FRM(01),
+	SH_FRM(07),
+	SH_FRM(08),
+	SH_FRM(09),
+	SH_FRM(10),
+	SH_FRM(11),
+	SH_FRM(12),
+	SH_FRM(08),
+	SH_FRM(14),
+	SH_FRM(08),
+	SH_FRM(16),
+	SH_FRM(08),
+	SH_FRM(18),
+	SH_FRM(08),
+	SH_FRM(20),
+	SH_FRM(08),
+	SH_FRM(22),
+	SH_FRM(08),
+	SH_FRM(24),
+	SH_FRM(08),
+	SH_FRM(26),
+	SH_FRM(08),
+	SH_FRM(28),
+	SH_FRM(08),
+	SH_FRM(30),
+	SH_FRM(31),
+	SH_FRM(32),
+	SH_FRM(01),
+	SH_FRM(34)
+};
+
 SH_IMP_CTOR(D0) {
+	SH_CTOR_MAKEPROCS(D0);
+
+	uint32 *t = new uint32[35];
+	const uint8 *in = _module->getData(0x2A85C);
+	for (int i = 0; i < 35; ++i) {
+		t[i] = READ_BE_UINT32(in);
+		in += 6;
+	}
+	_timeStamp = t;
+}
+
+SH_IMP_DTOR(D0)	{
+	SH_DTOR_DELPROCS(D0);
+	delete[] _timeStamp;
+}
+
+SH_IMPL_UPDT(D0) {
+	if (state.frameNo == -1) {
+		if (state.frameState == 0) {
+			_vm->sound()->musicPlay(5);
+			++state.frameState;
+		} else if (_vm->sound()->musicIsPlaying()) {
+			state.frameNo = 0;
+			state.frameState = 0;
+		}
+		return;
+	}
+
+	if (state.frameNo >= (int)_frameProcs.size() || !_frameProcs[state.frameNo]->isValid()) {
+		error("%s(): Invalid call to frame proc %d", __FUNCTION__, state.frameNo);
+	} else if (_vm->sound()->musicGetTime() >= _timeStamp[state.frameNo]) {
+		(*_frameProcs[state.frameNo])(state);
+		++state.frameNo;
+	} else if (_vm->_commandsFromMain & 0x80) {
+		state.finish = -1;
+		state.frameNo = 0;
+	}
+}
+
+SH_IMPL_FRM(D0, 00) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 0);
+}
+
+SH_IMPL_FRM(D0, 01) {
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2A4A));
+}
+
+SH_IMPL_FRM(D0, 02) {
+	/**/
+}
+
+SH_IMPL_FRM(D0, 03) {
+	_vm->sound()->musicPlay(4);
+}
+
+SH_IMPL_FRM(D0, 04) {
+	--state.frameNo;
+	if (_vm->sound()->musicIsPlaying()) {
+		++state.frameNo;
+		state.frameState = 0;
+	}
+}
+
+SH_IMPL_FRM(D0, 05) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 1);
+}
+
+SH_IMPL_FRM(D0, 07) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 2);
+}
 
+SH_IMPL_FRM(D0, 08) {
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2A66));
 }
 
-SCImp::~SCImp() {
+SH_IMPL_FRM(D0, 09) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 3);
+}
 
+SH_IMPL_FRM(D0, 10) {
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2A58));
 }
 
-void SCImp::operator()() {
+SH_IMPL_FRM(D0, 11) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 4);
+}
 
+SH_IMPL_FRM(D0, 12) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 5);
 }
 
-// functions
+SH_IMPL_FRM(D0, 14) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 6);
+}
 
-#undef SCImp
+SH_IMPL_FRM(D0, 16) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 7);
+}
+
+SH_IMPL_FRM(D0, 18) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 8);
+}
+
+SH_IMPL_FRM(D0, 20) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 9);
+}
+
+SH_IMPL_FRM(D0, 22) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 10);
+}
+
+SH_IMPL_FRM(D0, 24) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 11);
+}
+
+SH_IMPL_FRM(D0, 26) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 12);
+}
+
+SH_IMPL_FRM(D0, 28) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 13);
+}
+
+SH_IMPL_FRM(D0, 30) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 14);
+}
+
+SH_IMPL_FRM(D0, 31) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->runScript(_module->getPtr(0), 15);
+}
+
+SH_IMPL_FRM(D0, 32) {
+	//_sprites[16].controlFlags = 1;
+}
+
+SH_IMPL_FRM(D0, 34) {
+	state.finish = 1;
+	state.frameNo = 0;
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+}
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/scene/scene_d1.cpp b/engines/snatcher/scene/scene_d1.cpp
index c96e6b561af..e247a4911ed 100644
--- a/engines/snatcher/scene/scene_d1.cpp
+++ b/engines/snatcher/scene/scene_d1.cpp
@@ -19,31 +19,197 @@
 *
 */
 
+
+#include "snatcher/snatcher.h"
+#include "snatcher/graphics.h"
+#include "snatcher/sound.h"
 #include "snatcher/resource.h"
 #include "snatcher/scene_imp.h"
+#include "common/endian.h"
 
 namespace Snatcher {
 
-#define SCImp Scene_D1
-
 SH_HEAD_BEGIN(D1)
 // declarations
+SH_DCL_FRM(00)
+SH_DCL_FRM(01)
+SH_DCL_FRM(02)
+SH_DCL_FRM(04)
+SH_DCL_FRM(05)
+SH_DCL_FRM(06)
+SH_DCL_FRM(07)
+SH_DCL_FRM(08)
+SH_DCL_FRM(09)
+SH_DCL_FRM(11)
+SH_DCL_FRM(13)
+SH_DCL_FRM(15)
+SH_DCL_FRM(17)
+SH_DCL_FRM(19)
+SH_DCL_FRM(21)
+SH_DCL_FRM(22)
+SH_DCL_FRM(23)
+SH_DCL_FRM(25)
+SH_DCL_FRM(27)
+SH_DCL_FRM(28)
+
+const uint32 *_timeStamp;
+
 SH_HEAD_END(D1)
 
+SH_IMP_FRMTBL(D1) {
+	SH_FRM(00),
+	SH_FRM(01),
+	SH_FRM(02),
+	SH_FRM(01),
+	SH_FRM(04),
+	SH_FRM(05),
+	SH_FRM(06),
+	SH_FRM(07),
+	SH_FRM(08),
+	SH_FRM(09),
+	SH_FRM(01),
+	SH_FRM(11),
+	SH_FRM(01),
+	SH_FRM(13),
+	SH_FRM(01),
+	SH_FRM(15),
+	SH_FRM(01),
+	SH_FRM(17),
+	SH_FRM(01),
+	SH_FRM(19),
+	SH_FRM(01),
+	SH_FRM(21),
+	SH_FRM(22),
+	SH_FRM(23),
+	SH_FRM(22),
+	SH_FRM(25),
+	SH_FRM(22),
+	SH_FRM(27),
+	SH_FRM(28)
+};
+
 SH_IMP_CTOR(D1) {
+	SH_CTOR_MAKEPROCS(D1);
+
+	uint32 *t = new uint32[29];
+	const uint8 *in = _module->getData(0x2929A);
+	for (int i = 0; i < 29; ++i) {
+		t[i] = READ_BE_UINT32(in);
+		in += 6;
+	}
+	_timeStamp = t;
+}
+
+SH_IMP_DTOR(D1)	{
+	SH_DTOR_DELPROCS(D1);
+	delete[] _timeStamp;
+}
+
+SH_IMPL_UPDT(D1) {
+	if (state.frameNo == -1) {
+		if (state.frameState == 0) {
+			_vm->sound()->musicPlay(3);
+			++state.frameState;
+		} else if (_vm->sound()->musicIsPlaying()) {
+			state.frameNo = 0;
+			state.frameState = 0;
+		}
+		return;
+	}
+
+	if (state.frameNo >= (int)_frameProcs.size() || !_frameProcs[state.frameNo]->isValid()) {
+		error("%s(): Invalid call to frame proc %d", __FUNCTION__, state.frameNo);
+	} else if (_vm->sound()->musicGetTime() >= _timeStamp[state.frameNo]) {
+		(*_frameProcs[state.frameNo])(state);
+		++state.frameNo;
+	} else if (_vm->_commandsFromMain & 0x80) {
+		state.finish = -1;
+		state.frameNo = 0;
+	}
+}
+
+SH_IMPL_FRM(D1, 00) {
+	_vm->gfx()->runScript(_module->getPtr(0), 0);
+}
+
+SH_IMPL_FRM(D1, 01) {
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x142C));
+}
+
+SH_IMPL_FRM(D1, 02) {
+	_vm->gfx()->runScript(_module->getPtr(0), 1);
+}
+
+SH_IMPL_FRM(D1, 04) {
+	_vm->gfx()->runScript(_module->getPtr(0), 2);
+	//_cmdState.word1C = 0x110;
+	_vm->gfx()->doCommand(1);
+}
+
+SH_IMPL_FRM(D1, 05) {
+	_vm->gfx()->doCommand(8);
+}
+
+SH_IMPL_FRM(D1, 06) {
+	_vm->gfx()->doCommand(9);
+}
 
+SH_IMPL_FRM(D1, 07) {
+	_vm->gfx()->doCommand(10);
 }
 
-SCImp::~SCImp() {
+SH_IMPL_FRM(D1, 08) {
+	_vm->gfx()->doCommand(11);
+}
 
+SH_IMPL_FRM(D1, 09) {
+	_vm->gfx()->doCommand(12);
 }
 
-void SCImp::operator()() {
+SH_IMPL_FRM(D1, 11) {
+	_vm->gfx()->runScript(_module->getPtr(0), 3);
+}
 
+SH_IMPL_FRM(D1, 13) {
+	_vm->gfx()->runScript(_module->getPtr(0), 4);
 }
 
-// functions
+SH_IMPL_FRM(D1, 15) {
+	_vm->gfx()->runScript(_module->getPtr(0), 5);
+}
 
-#undef SCImp
+SH_IMPL_FRM(D1, 17) {
+	_vm->gfx()->runScript(_module->getPtr(0), 6);
+}
+
+SH_IMPL_FRM(D1, 19) {
+	_vm->gfx()->runScript(_module->getPtr(0), 7);
+}
+
+SH_IMPL_FRM(D1, 21) {
+	_vm->gfx()->runScript(_module->getPtr(0), 8);
+}
+
+SH_IMPL_FRM(D1, 22) {
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x143A));
+}
+
+SH_IMPL_FRM(D1, 23) {
+	_vm->gfx()->runScript(_module->getPtr(0), 9);
+}
+
+SH_IMPL_FRM(D1, 25) {
+	_vm->gfx()->runScript(_module->getPtr(0), 10);
+}
+
+SH_IMPL_FRM(D1, 27) {
+	_vm->gfx()->runScript(_module->getPtr(0), 11);
+}
+
+SH_IMPL_FRM(D1, 28) {
+	state.finish = 1;
+	state.frameNo = 0;
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+}
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene/scene_d2.cpp
index e260c2dd1c8..1ea7eff73a7 100644
--- a/engines/snatcher/scene/scene_d2.cpp
+++ b/engines/snatcher/scene/scene_d2.cpp
@@ -19,31 +19,399 @@
 *
 */
 
+
+#include "snatcher/snatcher.h"
+#include "snatcher/graphics.h"
+#include "snatcher/sound.h"
 #include "snatcher/resource.h"
 #include "snatcher/scene_imp.h"
 
 namespace Snatcher {
 
-#define SCImp Scene_D2
-
 SH_HEAD_BEGIN(D2)
 // declarations
+SH_DCL_FRM(00)
+SH_DCL_FRM(01)
+SH_DCL_FRM(02)
+SH_DCL_FRM(03)
+SH_DCL_FRM(04)
+SH_DCL_FRM(05)
+SH_DCL_FRM(06)
+SH_DCL_FRM(07)
+SH_DCL_FRM(08)
+SH_DCL_FRM(09)
+SH_DCL_FRM(10)
+SH_DCL_FRM(11)
+SH_DCL_FRM(12)
+
 SH_HEAD_END(D2)
 
+SH_IMP_FRMTBL(D2) {
+	SH_FRM(00),
+	SH_FRM(01),
+	SH_FRM(02),
+	SH_FRM(03),
+	SH_FRM(04),
+	SH_FRM(05),
+	SH_FRM(06),
+	SH_FRM(07),
+	SH_FRM(08),
+	SH_FRM(09),
+	SH_FRM(10),
+	SH_FRM(11),
+	SH_FRM(12)
+};
+
 SH_IMP_CTOR(D2) {
+	SH_CTOR_MAKEPROCS(D2);
+}
+
+SH_IMP_DTOR(D2)	{
+	SH_DTOR_DELPROCS(D2);
+}
+
+SH_IMPL_UPDT(D2) {
+	if (state.frameNo >= (int)_frameProcs.size() || !_frameProcs[state.frameNo]->isValid())
+		error("%s(): Invalid call to frame proc %d", __FUNCTION__, state.frameNo);
+	else
+		(*_frameProcs[state.frameNo])(state);
+}
+
+bool hasRAMCart = true; 
+int _state_ua_1 = 0;
+bool hasSaveFiles = false;
+bool hasFreeBuram = true;
+uint8 _bua1 = 0;
+uint8 _bua2 = 0;
+uint8 _bua3 = 0;
+uint8 _buram_0 = 0;
+bool _buram_2 = true;
+uint8 wordA = 0;
+uint8 wordB = 0;
+int16 _moduleWord = -1;
+
+// functions
+SH_IMPL_FRM(D2, 00) {
+	switch (state.frameState) {
+	case 0:
+		//enqueueCommunicationStatus2Command(_state_ua_1 ? 0xF3 : 0xF4, 0);
+		_vm->sound()->pcmDoCommand(_state_ua_1 ? 0xFC : 0xFD, -1);
+		//_d2state = 0;
+		//buramCheck();
+		++state.frameState;
+		break;
+	case 1:
+		if (hasRAMCart) {
+			++state.frameNo;
+			state.frameState = 0;
+		} else {
+			_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+			_vm->gfx()->runScript(_module->getPtr(0), 1); // RAM Cart select screen
+			++state.frameState;
+		}
+		break;
+	case 2:
+		if (_vm->_commandsFromMain & 3) {
+			_bua2 &= 2;
+			_buram_0 ^= 1;
+		}
+		if (_vm->_commandsFromMain & 0x80) {
+			state.counter = 10;
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
+			++state.frameState;
+		}
+		break;
+	default:
+		if (--state.counter)
+			return;
+		if (_buram_0)
+			hasRAMCart = _buram_2;
+		++state.frameNo;
+		state.frameState = 0;
+		break;
+	}
+}
 
+SH_IMPL_FRM(D2, 01) {
+	if (!state.frameState) {
+		_vm->sound()->musicPlay(2);
+		++state.frameState;
+	} else if (_vm->sound()->musicIsPlaying()) {
+		++state.frameNo;
+		state.frameState = 0;
+	}	
 }
 
-SCImp::~SCImp() {
+SH_IMPL_FRM(D2, 02) {
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->doCommand(1);
+	//__unk_8F1C = 0x100;
+	_vm->gfx()->runScript(_module->getPtr(0), 0);
+	state.counter = 24;
+	++state.frameNo;
+	state.frameState = 0;
+}
 
+SH_IMPL_FRM(D2, 03) {
+	if (--state.counter)
+		return;
+	_vm->gfx()->doCommand(7);
+	state.counter = 4;
+	++state.frameNo;
+	state.frameState = 0;
 }
 
-void SCImp::operator()() {
+SH_IMPL_FRM(D2, 04) {
+	if (--state.counter)
+		return;
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x08E6));
+	state.counter = 86;
+	++state.frameNo;
+	state.frameState = 0;
+}
 
+SH_IMPL_FRM(D2, 05) {
+	if (--state.counter)
+		return;
+	++state.frameNo;
+	state.frameState = 0;
 }
 
-// functions
+SH_IMPL_FRM(D2, 06) {
+	switch (state.frameState) {
+	case 0:
+		if (hasRAMCart) {
+			++state.frameNo;
+			state.frameState = 0;
+		} else {
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x0944));
+			++state.frameState;
+			state.counter = 17;
+		}
+		break;
+	case 1:
+		if (--state.counter)
+			return;
+		_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+		_vm->gfx()->runScript(_module->getPtr(0), 2);
+		++state.frameState;
+		break;
+	default:
+		//if (_vm->_commandsFromMain & 0x80)
+		/**/
+		break;
+	}
+}
+
+SH_IMPL_FRM(D2, 07) {
+	switch (state.frameState) {
+	case 0:
+		// loadSaveFile();
+		++state.frameState;
+		break;
+	default:
+		++state.frameNo;
+		if (hasSaveFiles)
+			++state.frameNo;
+		state.frameState = 0;
+		break;
+	}
+}
+
+SH_IMPL_FRM(D2, 08) {
+	switch (state.frameState) {
+	case 0:
+		// buramCheckSpace();
+		++state.frameState;
+		break;
+	case 1:
+		if (hasFreeBuram) {
+			++state.frameNo;
+			state.frameState = 0;
+		} else {
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x0944));
+			state.counter = 17;
+			++state.frameState;
+		}
+		break;
+	case 2:
+		if (--state.counter)
+			return;
+		_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+		_vm->gfx()->runScript(_module->getPtr(0), 3);
+		++state.frameState;
+		break;
+	default:
+		//if (_vm->_commandsFromMain & 0x80)
+		/**/
+		break;
+	}
+}
+
+SH_IMPL_FRM(D2, 09) {
+	uint8 &b = hasSaveFiles ? _bua1 : _bua2;
+	switch (state.frameState) {
+	case 0:
+		_vm->gfx()->doCommand(0xFF);
+		state.frameState += (hasSaveFiles ? 1 : 2);
+		b &= 2;
+		break;
+	case 1:
+		if (_vm->_commandsFromMain & 3)
+			_bua2 &= 2;
+		if (_vm->_commandsFromMain & 0x80) {
+			_bua1 = 3;
+			wordA = 1;
+			if (wordB == 3) {
+				wordA = 0;
+				++state.frameNo;
+			}
+			++state.frameNo;
+			state.frameState = 0;
+			_bua3 = 56;
+			//enqueueCommunicationStatus2Command(0);
+			_bua2 = _bua1 = 3;
+			_moduleWord = 0;
+		}
+		break;
+	default:
+		if (_vm->_commandsFromMain & 0x80) {
+			++state.frameNo;
+			state.frameState = 0;
+		}
+		break;
+	}
+}
+
+SH_IMPL_FRM(D2, 10) {
+	switch (state.frameState) {
+	case 0:
+		if (state.counter == 3) {
 
-#undef SCImp
+		}
+		if (state.counter != 21) {;
+			_vm->gfx()->enqueueCopyCommands(_module->getPtr(0x29142).getDataFromTable(state.counter));
+			if (state.counter != 0)
+				_vm->gfx()->enqueueCopyCommands(_module->getPtr(0x29412).getDataFromTable(state.counter));
+			++state.counter;
+			return;
+		}
+		++state.frameNo;
+		state.frameState = 0;
+		break;
+	case 1:
+		if (state.counter == 20) {
+			if (1/*_varVar*/) {
+				state.counter = 2;
+				++state.frameState;
+				_vm->gfx()->enqueueCopyCommands(_module->getPtr(29806));
+			} else {
+				state.counter = 0;
+				++state.frameNo;
+				state.frameState = 0;
+			}
+		} else {
+			_vm->gfx()->enqueueCopyCommands(_module->getPtr(0x296C6).getDataFromTable(state.counter++));
+		}
+		break;
+	case 2:
+		break;
+	case 3:
+		break;
+	case 4:
+		break;
+	default:
+		break;
+	}
+}
+
+SH_IMPL_FRM(D2, 11) {
+	switch (state.frameState) {
+	case 0:
+		if (state.counter < 24) {
+			_vm->gfx()->enqueueCopyCommands(_module->getPtr(0x29292).getDataFromTable(state.counter));
+			if (state.counter != 0)
+				_vm->gfx()->enqueueCopyCommands(_module->getPtr(0x29554).getDataFromTable(state.counter));
+			++state.counter;
+			return;
+		}
+		/*state.countDown = 10;
+		_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
+		++state.frameState;*/
+
+		_vm->sound()->pcmDoCommand(56, -1);
+		_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
+		state.counter = 10;
+		state.frameState = 0;
+		++state.frameNo;
+		break;
+	case 1:
+		if (--state.counter)
+			return;
+		_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+		_vm->gfx()->runScript(_module->getPtr(0), 7);
+		++state.frameState;
+		break;
+	case 2:
+		state.counter  = 0;
+		//
+		++state.frameState;
+		break;
+	case 3:
+		if (_vm->_commandsFromMain & 0x80) {
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
+			state.counter = 10;
+			state.frameState = 0;
+			++state.frameNo;
+			return;
+		}
+
+		//animDo:sub_2985E
+
+		switch (state.counter) {
+		case 0:
+			++state.counter;
+			break;
+		case 1:
+			++state.counter;
+			break;
+		case 2:
+			++state.counter;
+			break;
+		case 3:
+			state.counter += 2;
+			break;
+		case 4:
+			--state.counter;
+			break;
+		case 5:
+			state.counter = 10;
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
+			++state.frameState;
+			break;
+		default:
+			break;
+		}
+		break;
+	case 4:
+		if (--state.counter)
+			return;
+		_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+		_vm->gfx()->runScript(_module->getPtr(0), 8);
+		state.frameState = 0;
+		break;
+	default:
+		break;
+	}
+}
+
+SH_IMPL_FRM(D2, 12) {
+	if (--state.counter)
+		return;
+	state.finish = 1;
+	state.frameNo = 0;
+	state.frameState = 0;
+	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+}
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/scene_imp.h b/engines/snatcher/scene_imp.h
index 7be6f188746..edf84a1d9cf 100644
--- a/engines/snatcher/scene_imp.h
+++ b/engines/snatcher/scene_imp.h
@@ -27,16 +27,37 @@ namespace Snatcher {
 #define SH_HEAD_BEGIN(id) \
 	class Scene_##id : public SceneHandler { \
 	public: \
-		Scene_##id(SnatcherEngine *vm, SceneResource *scn, FIO *fio); \
+		Scene_##id(SnatcherEngine *vm, SceneModule *scn, FIO *fio); \
 		~Scene_##id() override; \
-		void operator()() override; \
-	private:
+		void operator()(GameState &state) override; \
+	private: \
+		typedef Common::Functor1Mem<GameState&, void, Scene_##id> FrameProc; \
+		typedef void(Scene_##id::*FrameProcTblEntry)(GameState&); \
+		Common::Array<FrameProc*> _frameProcs; \
+		static const FrameProcTblEntry frameProcTable[];		
 
 #define SH_HEAD_END(id) }; \
-	SceneHandler *createSceneHandler_##id(SnatcherEngine *vm, SceneResource *scn, FIO *fio) { return new Scene_##id(vm, scn, fio); }
+	SceneHandler *createSceneHandler_##id(SnatcherEngine *vm, SceneModule *scn, FIO *fio) { return new Scene_##id(vm, scn, fio); }
+#define SH_IMP_FRMTBL(id) \
+	const Scene_##id::FrameProcTblEntry Scene_##id::frameProcTable[] =
+#define SH_FRM(no) \
+	&frameUpdate##no
 #define SH_IMP_CTOR(id) \
-	Scene_##id::Scene_##id(SnatcherEngine *vm, SceneResource *scn, FIO *fio) : SceneHandler(vm, scn, fio)
-
+	Scene_##id::Scene_##id(SnatcherEngine *vm, SceneModule *scn, FIO *fio) : SceneHandler(vm, scn, fio)
+#define SH_CTOR_MAKEPROCS(id) \
+	for (uint i = 0; i < ARRAYSIZE(frameProcTable); ++i) \
+		_frameProcs.push_back(new FrameProc(this, frameProcTable[i]));
+#define SH_IMP_DTOR(id) \
+	Scene_##id::~Scene_##id()
+#define SH_DTOR_DELPROCS(id) \
+	for (uint i = 0; i < _frameProcs.size(); ++i) \
+		delete _frameProcs[i];
+#define SH_IMPL_UPDT(id) \
+	void Scene_##id::operator()(GameState &state)
+#define SH_DCL_FRM(no) \
+	void frameUpdate##no(GameState &state);
+#define SH_IMPL_FRM(id, no) \
+	void Scene_##id::frameUpdate##no(GameState &state)
 } // End of namespace Snatcher
 
 #endif // SNATCHER_SCENE_IMP_H
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 1fcaaddfde5..ab658a92b16 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -24,6 +24,7 @@
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
 
+#include "common/endian.h"
 #include "common/events.h"
 #include "common/system.h"
 
@@ -31,12 +32,11 @@
 
 namespace Snatcher {
 
-SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(0), _scene(0), _gfx(0), _snd(0) {
-
+SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _gfx(nullptr), _snd(nullptr), _commandsFromMain(0) {
 }
 
 SnatcherEngine::~SnatcherEngine() {
-	delete _scene;
+	delete _module;
 	delete _gfx;
 	delete _snd;
 	delete _fio;
@@ -73,152 +73,37 @@ bool SnatcherEngine::initSound(Common::Platform platform, int soundOptions) {
 	return (_snd = new SoundEngine(platform, soundOptions));
 }
 
-struct Struct80 {
-	uint16 cmd;
-	uint8 f2;
-	uint8 f3;
-	uint8 f4;
-	uint8 f5;
-	uint32 f6;
-	uint32 fa;
-
-	uint16 fe;
-	uint8 f10;
-	uint8 f11;
-	uint16 f12;
-	uint8 f14;
-	uint8 f15;
-	uint8 f16;
-	uint8 f1c;
-
-	uint8 f25;
-	uint8 f26;
-	uint8 f27;
-	uint16 f28;
-	uint16 f2a;
-	uint8 f2c;
-	uint8 f2d;
-
-	uint32 offs_2e;
-	const uint8 *ptr_32;
-	const uint8 *ptr_36;
-
-	const uint8 *ptr_40;
-	const uint8 *ptr_44;
-	uint16 prev;
-	uint16 next;
-	uint16 next2;
-	uint8 f4e;
-	uint8 f4f;
-};
-
-Struct80 _s80[64];
-//memset(_s80, 0, 64 * sizeof(Struct80));
-uint8 _vc1_var_788A_flags;
-uint8 _vc1_var_78BC;
-uint8 _vc1_var_78BD;
-uint16 _vc1_var_78BE;
-const uint8 *_cpos_7880;
-bool _var_7886;
-uint8 _var_7893;
-
-uint16 _word_B6406;
-
 bool SnatcherEngine::start() {
-	_scene = _fio->createSceneResource(2);
-
-	const uint8 *scstart = _scene->getData(0x28000);
-	const uint8 *sc = _scene->getDataFromMainTable(0);
-	//
-	memset(_s80, 0, 64 * sizeof(Struct80));
-	//
-	for (uint8 cmd = *sc++; cmd != 0xFF; cmd = *sc++) {
-		uint8 len = *sc++;
-		const uint8 *next = sc + len;
-
-		switch (cmd) {
-		case 0:
-			_gfx->enqueuePaletteEvent(scstart, sc - scstart);
-			break;
+	GameState state;
+	memset(&state, 0, sizeof(GameState));
 
-		case 1:
-			_vc1_var_788A_flags &= ~1;
-			_vc1_var_78BD = _vc1_var_78BC;
-			_vc1_var_78BE = 0;
-			_cpos_7880 = sc;
-			_var_7886 = true;
-			break;
+	uint32 frameLen = (1000 << 16) / 60;
+	uint32 frameTimer = 0;
 
-		case 2: {
-			while (sc < next) {
-				assert(*sc < ARRAYSIZE(_s80));
-				Struct80 *s = &_s80[*sc++];
-				if (s->cmd)
-					return 0;
-
-				s->cmd = 1;
-				s->f25 = *sc++;
-				s->f6 = READ_BE_UINT16(sc);
-				sc += 2;
-				s->fa = READ_BE_UINT16(sc);
-				sc += 2;
-				s->offs_2e = READ_BE_UINT32(sc);
-				sc += 4;
-				s->ptr_32 = sc + READ_BE_UINT16(sc) + 2;
-				sc += 2;
-				s->f28 = 0xFFFF;
-
-				uint8 v = *s->ptr_32;
-				for (bool l = true; l; ) {
-					if (v == 0xA1 || v == 0xA7) {
-						s->f16 = s->ptr_32[1];
-						v = s->ptr_32[4];
-					} else {
-						if (!(v & 0x80))
-							s->ptr_36 = _scene->getDataFromTable(s->offs_2e, v);
-						l = false;
-					}
-				}
-			}
-		} break;
-
-		case 3: 
-		case 4: {
-			while (sc < next) {
-				uint16 i1 = *sc++;
-				uint16 i2 = *sc++;
-				assert(i1 < ARRAYSIZE(_s80) && i2 < ARRAYSIZE(_s80));
-				Struct80 *s1 = &_s80[i1];
-				Struct80 *s2 = &_s80[i2];
-				s2->next2 = s1->next;
-				s1->next = i2;
-				s2->prev = i1;
-			}
-		} break;
+	while (!shouldQuit()) {
+		frameTimer += frameLen;
+		uint32 nextFrame = _system->getMillis() + (frameTimer >> 16);
+		frameTimer &= 0xFFFF;
 
-		case 5:
-		case 6:
-		case 7:
-			_var_7893 = sc[1];
-			break;
-		case 8:
-			_word_B6406 = READ_BE_UINT16(sc);
-			break;
-		case 9:
-			_vc1_var_78BC = sc[1];
-			break;
-		default:
-			error("Unknown opcode 0x%02x", cmd);
-		}
+		int _sub_doMainScript = 0;
 
-		sc = next;
-	}
+		if (runInitSequence(state))
+			continue;
 
-	while (!shouldQuit()) {
-		uint32 nextFrame = _system->getMillis() + 16;
+		if (!_gfx->busy()) {
+			//subVintSub_2();
+			bool blockedUpdt = _sub_doMainScript;
+			if (_sub_doMainScript) {
+				//subVint_mainScriptRun__36Cases();
+				blockedUpdt = _gfx->busy();
+			}
+			if (!blockedUpdt) {
+				updateScene(state);
+				_gfx->updateAnimations();
+			}
+		}
 
 		_gfx->nextFrame();
-
 		delayUntil(nextFrame);
 	}
 
@@ -238,8 +123,243 @@ void SnatcherEngine::delayUntil(uint32 end) {
 void SnatcherEngine::updateEvents() {
 	Common::Event evt;
 	while (_eventMan->pollEvent(evt)) {
-		/*
-		*/
+		switch (evt.type) {
+		case Common::EVENT_LBUTTONDOWN:
+			_commandsFromMain |= (1 << 7);
+			break;
+		default:
+			_commandsFromMain = 0;
+			break;
+		}
+	}
+}
+
+bool SnatcherEngine::runInitSequence(GameState &gameState) {
+	if (gameState.initState == -1)
+		return false;
+
+	gameState.initState = -1;
+
+	return true;
+}
+
+void SnatcherEngine::updateScene(GameState &state) {
+	int _main_switch_1_0_orM1_postIntr = 0;
+	uint16 _word_unk_Flags = 0;
+	int _word_unk_11 = 0;
+	int _sub_val_2 = 0;
+	int _unlCDREadSeekWord = 0;
+	uint8 _uniobyte_7891 = 0;
+	bool _sub_bool_5 = false;
+
+	uint8 _wordRAM__TABLE48__word_B6400[48];
+	memset(_wordRAM__TABLE48__word_B6400, 0, 48);
+
+	uint16 _word_8F00_table_00[16];
+	memset(_word_8F00_table_00, 0, 16 * sizeof(uint16));
+
+	switch (state.progressMain) {
+	case -1:
+		_snd->musicStop();
+		state.progressMain = 0;
+		break;
+	case 0:
+		switch (state.progressSub) {
+		case 0:
+			++state.progressSub;
+			break;
+		case 1:
+			if (!_snd->musicIsPlaying()) {
+				delete _module;
+				_module = _fio->loadModule(4);
+				assert(_module);
+				++state.progressSub;
+			}
+			break;
+		case 2:
+			++state.progressSub;
+			break;
+		case 3:
+			//if (*(uint16*)(&_wordRAM__TABLE48__word_B6400[0])) {
+				state.progressSub = 0;
+				state.finish = 0;
+				++state.progressMain;
+			//}
+			break;
+		default:
+			break;
+		}
+		break;
+	case 1:
+		switch (state.progressSub) {
+		case 0:
+			state.frameNo = 0;
+			++state.progressSub;
+			_snd->pcmPlayEffect(30);
+			break;
+		case 1:
+			if (!(_word_unk_Flags & 0x0F))
+				++state.progressSub;
+			break;
+		case 2:
+			if (_module)
+				_module->run(state);
+			if (state.finish) {
+				state.progressSub = 0;
+				state.finish = 0;
+				state.progressMain = _word_unk_11 ? 7 : state.progressMain + 1;
+				state.modIndex = 0;
+				_main_switch_1_0_orM1_postIntr = 1;
+			}
+			break;
+		default:
+			break;
+		}
+		break;
+	case 2:
+		switch (state.progressSub) {
+		case 0:
+			if (!(_sub_val_2 & 0x1F)) {
+				if (!_snd->musicIsPlaying()) {
+					uint8 scids[] = { 3, 2 };
+					delete _module;
+					assert(state.modIndex < ARRAYSIZE(scids));
+					_module = _fio->loadModule(scids[state.modIndex]);
+					assert(_module);
+					++state.progressSub;
+				} else {
+					_snd->musicStop();
+				}
+			}
+			break;
+		case 1:
+			if (!(_sub_val_2 & 0x1F)) {
+				// startup__runWithFileFunc(2)
+				_unlCDREadSeekWord = 0;
+				state.frameNo = -1;
+				++state.progressSub;
+			}
+			break;
+		case 2:
+			if (_module)
+				_module->run(state);
+			if (state.finish < 0) {
+				state.finish = 0;
+				state.counter = 10;
+				++state.progressSub;
+				static byte data[] = { 0x83,  0x0,  0x00, 0x3F };
+				_gfx->enqueuePaletteEvent(ResourcePointer(data, 0));
+			} else if (state.finish) {
+				if (state.modIndex == 0) {
+					++state.modIndex;
+					state.finish = 0;
+				}
+				_gfx->reset(GraphicsEngine::kClearSprites);
+				state.progressSub = 0;
+			}
+			break;
+		case 3:
+			if (--state.counter == 1) {
+				static const byte cmd[] = {
+					0x01, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xFF, 0xFF,
+					0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+					0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+				};
+				_gfx->enqueueCopyCommands(ResourcePointer(cmd, 0));
+			} else if (state.counter == 0) {
+				state.finish = -1;
+				state.progressSub = 0;
+				_gfx->reset(GraphicsEngine::kRestoreDefaultsExt);
+			}
+			break;
+		default:
+			break;
+		}
+		if (state.finish) {
+			state.finish = 0;
+			state.progressMain = 7;
+			state.progressSub = 0;
+			//withD0_FF_FD_FC(0xFF);
+			_gfx->setVar(9, 1);
+			_gfx->reset(GraphicsEngine::kClearPalEvents | GraphicsEngine::kClearSprites);
+		}
+		break;
+	case 3:
+		_wordRAM__TABLE48__word_B6400[2] = 1;
+		state.finish = 0;
+		state.progressMain = 0;
+		state.progressSub = 0;
+		memset(_word_8F00_table_00, 0, 16 * sizeof(uint16));
+		break;
+	case 5:
+		if (state.finish) {
+			++state.progressMain;
+			state.progressSub = 0;
+			state.finish = 0;
+		}
+		break;
+	case 6:
+		switch (state.progressSub) {
+		case 0:
+			//if (_s80[31].cmd == 0) {
+				_gfx->reset(GraphicsEngine::kRestoreDefaults | GraphicsEngine::kClearSprites);
+				_uniobyte_7891 = 0xFF;
+				++state.progressSub;
+				state.frameNo = -1;
+				state.frameState = 0;
+			//}
+			break;
+		case 1:
+			if (!_snd->musicIsPlaying()) {
+				delete _module;
+				_module = _fio->loadModule(52);
+				assert(_module);
+				++state.progressSub;
+			}
+			break;
+		case 2:
+			// startup__runWithFileFunc(2)
+			_unlCDREadSeekWord = 0;
+			++state.progressSub;
+			break;
+		case 3:
+			if (_module)
+				_module->run(state);
+			if (state.finish) {
+				_sub_bool_5 = true;
+				++state.progressSub;
+			}
+			break;
+		default:
+			break;
+		}
+	case 7:
+		switch (state.progressSub) {
+		case 0:
+			_snd->musicStop();
+			//loadFile56 PCMLT_01.BIN
+			++state.progressSub;
+			break;
+		case 1:
+		case 3:
+			// startup__runWithFileFunc(2)
+			_unlCDREadSeekWord = 0;
+			++state.progressSub;
+			break;
+		case 2:
+			//loadFile54 PCMDRMDT.BIN
+			++state.progressSub;
+			break;
+		case 4:
+			state.progressMain = 5;
+			state.progressSub = 0;
+			_main_switch_1_0_orM1_postIntr = -1;
+			break;
+		default:
+			break;
+		}
+	default:
+		break;
 	}
 }
 
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index c63e2610980..eff8645e308 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -33,13 +33,17 @@ namespace Snatcher {
 class GraphicsEngine;
 class FIO;
 class SoundEngine;
-class SceneResource;
+class SceneModule;
+struct GameState;
 
 class SnatcherEngine : public Engine {
 public:
 	SnatcherEngine(OSystem *system, GameDescription &dsc);
 	~SnatcherEngine() override;
 
+	SoundEngine *sound() const { return _snd; }
+	GraphicsEngine *gfx() const { return _gfx; }
+
 private:
 	// Startup
 	Common::Error run() override;
@@ -52,6 +56,9 @@ private:
 	void delayUntil(uint32 end);
 	void updateEvents();
 
+	bool runInitSequence(GameState &state);
+	void updateScene(GameState &state);
+
 	// ConfigManager sync
 	void registerDefaultSettings();
 	void syncSoundSettings() override;
@@ -65,13 +72,16 @@ private:
 
 	// Resource
 	FIO *_fio;
-	SceneResource *_scene;
+	SceneModule *_module;
 
 	// Graphics
 	GraphicsEngine *_gfx;
 
 	// Sound
 	SoundEngine *_snd;
+public:
+	// Input
+	byte _commandsFromMain;
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/sound.cpp b/engines/snatcher/sound.cpp
index ab1ee22c106..8901ed3b6ed 100644
--- a/engines/snatcher/sound.cpp
+++ b/engines/snatcher/sound.cpp
@@ -24,7 +24,7 @@
 
 namespace Snatcher {
 
-SoundEngine::SoundEngine(Common::Platform platform, int soundOptions) : _dev(0) {
+SoundEngine::SoundEngine(Common::Platform platform, int soundOptions) : _dev(nullptr) {
 	_dev = SoundDevice::create(platform, soundOptions);
 	assert(_dev);
 }
@@ -33,4 +33,45 @@ SoundEngine::~SoundEngine() {
 	delete _dev;
 }
 
+void SoundEngine::musicPlay(int track) {
+	_dev->musicPlay(track);
+}
+
+void SoundEngine::musicStop() {
+	_dev->musicStop();
+}
+
+bool SoundEngine::musicIsPlaying() const {
+	return _dev->musicIsPlaying();
+}
+
+uint32 SoundEngine::musicGetTime() const {
+	return _dev->musicGetTime();
+}
+
+void SoundEngine::pcmPlayEffect(int track) {
+	_dev->pcmPlayEffect(track);
+}
+
+void SoundEngine::pcmDoCommand(int cmd, int arg) {
+	_dev->pcmDoCommand(cmd, arg);
+}
+
+SoundDevice *SoundDevice::create(Common::Platform platform, int soundOptions) {
+	MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(soundOptions);
+	MusicType musicType = MidiDriver::getMusicType(dev);
+
+	if (musicType == MT_INVALID || musicType == MT_NULL)
+		return createNullSoundDevice();
+
+	switch (platform) {
+	case Common::kPlatformSegaCD:
+		return createSegaSoundDevice();
+	default:
+		break;
+	};
+
+	return 0;
+}
+
 } // End of namespace Snatcher
diff --git a/engines/snatcher/sound.h b/engines/snatcher/sound.h
index f9eabcdc84b..c11f531b95a 100644
--- a/engines/snatcher/sound.h
+++ b/engines/snatcher/sound.h
@@ -33,6 +33,14 @@ public:
 	SoundEngine(Common::Platform platform, int soundOptions);
 	~SoundEngine();
 
+	void musicPlay(int track);
+	void musicStop();
+	bool musicIsPlaying() const;
+	uint32 musicGetTime() const;
+
+	void pcmPlayEffect(int track);
+	void pcmDoCommand(int cmd, int arg);
+
 private:
 	SoundDevice *_dev;
 };
diff --git a/engines/snatcher/sound_device.h b/engines/snatcher/sound_device.h
index 65279e073af..bf037ca2ca1 100644
--- a/engines/snatcher/sound_device.h
+++ b/engines/snatcher/sound_device.h
@@ -31,30 +31,25 @@ class SoundDevice {
 public:
 	virtual ~SoundDevice() {}
 
+	virtual void musicPlay(int track) = 0;
+	virtual void musicStop() = 0;
+	virtual bool musicIsPlaying() const = 0;
+	virtual uint32 musicGetTime() const = 0;
+
+	virtual void pcmPlayEffect(int track) = 0;
+	virtual void pcmDoCommand(int cmd, int arg) = 0;
+
 protected:
-	SoundDevice() {}
+	SoundDevice() : _musicStartTime(0) {}
+
+	uint32 _musicStartTime;
 
 private:
 	static SoundDevice *createNullSoundDevice();
 	static SoundDevice *createSegaSoundDevice();
 
 public:
-	static SoundDevice *create(Common::Platform platform, int soundOptions) {
-		MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(soundOptions);
-		MusicType musicType = MidiDriver::getMusicType(dev);
-
-		if (musicType == MT_INVALID || musicType == MT_NULL)
-			return createNullSoundDevice();
-
-		switch (platform) {
-		case Common::kPlatformSegaCD:
-			return createSegaSoundDevice();
-		default:
-			break;
-		};
-
-		return 0;
-	}
+	static SoundDevice *create(Common::Platform platform, int soundOptions);
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/sound_device_null.cpp b/engines/snatcher/sound_device_null.cpp
index df95cc239d6..3d6e21808ac 100644
--- a/engines/snatcher/sound_device_null.cpp
+++ b/engines/snatcher/sound_device_null.cpp
@@ -19,17 +19,43 @@
 *
 */
 
+#include "common/system.h"
 #include "snatcher/sound_device.h"
+#include "snatcher/util.h"
 
 namespace Snatcher {
 
 class NullSoundDevice : public SoundDevice {
 public:
-	NullSoundDevice() : SoundDevice() {}
+	NullSoundDevice() : SoundDevice(), _playing(false) {}
 	~NullSoundDevice() override {}
+
+	void musicPlay(int track) override { }
+	void musicStop() override { }
+	bool musicIsPlaying() const override;
+	uint32 musicGetTime() const override;
+
+	void pcmPlayEffect(int track) override;
+	void pcmDoCommand(int cmd, int arg) override;
 private:
+	bool _playing;
 };
 
+bool NullSoundDevice::musicIsPlaying() const {
+	return true;
+}
+
+uint32 NullSoundDevice::musicGetTime() const {
+	uint32 relTime = 0;
+	return Util::makeBCDTimeStamp(relTime);
+}
+
+void NullSoundDevice::pcmPlayEffect(int track) {
+}
+
+void NullSoundDevice::pcmDoCommand(int cmd, int arg) {
+}
+
 SoundDevice *SoundDevice::createNullSoundDevice() {
 	return new NullSoundDevice();
 }
diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
index 5641f35d742..50047183c9f 100644
--- a/engines/snatcher/sound_device_scd.cpp
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -19,17 +19,59 @@
 *
 */
 
+
+#include "backends/audiocd/audiocd.h"
+#include "common/system.h"
+
 #include "snatcher/sound_device.h"
+#include "snatcher/util.h"
 
 namespace Snatcher {
 
 class SegaSoundDevice : public SoundDevice {
 public:
-	SegaSoundDevice() : SoundDevice() {}
+	SegaSoundDevice();
 	~SegaSoundDevice() override {}
+
+	void musicPlay(int track) override;
+	void musicStop() override;
+	bool musicIsPlaying() const override;
+	uint32 musicGetTime() const override;
+
+	void pcmPlayEffect(int track) override;
+	void pcmDoCommand(int cmd, int arg) override;
+
 private:
 };
 
+SegaSoundDevice::SegaSoundDevice() : SoundDevice() {
+
+}
+
+void SegaSoundDevice::musicPlay(int track) {
+	g_system->getAudioCDManager()->play(track - 1, 1, 0, 0);
+	_musicStartTime = g_system->getMillis();
+}
+
+void SegaSoundDevice::musicStop() {
+	g_system->getAudioCDManager()->stop();
+}
+
+bool SegaSoundDevice::musicIsPlaying() const {
+	return g_system->getAudioCDManager()->isPlaying();
+}
+
+uint32 SegaSoundDevice::musicGetTime() const {
+	uint32 relTime = musicIsPlaying() ? g_system->getMillis() - _musicStartTime : 0;
+	return Util::makeBCDTimeStamp(relTime);
+}
+
+void SegaSoundDevice::pcmPlayEffect(int track) {
+}
+
+void SegaSoundDevice::pcmDoCommand(int cmd, int arg) {
+}
+
 SoundDevice *SoundDevice::createSegaSoundDevice() {
 	return new SegaSoundDevice();
 }
diff --git a/engines/snatcher/util.cpp b/engines/snatcher/util.cpp
new file mode 100644
index 00000000000..2ae31b21565
--- /dev/null
+++ b/engines/snatcher/util.cpp
@@ -0,0 +1,95 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#include "common/endian.h"
+#include "common/textconsole.h"
+#include "snatcher/util.h"
+
+namespace Snatcher {
+namespace Util {
+
+uint32 decodeSCDData(const uint8 *src, uint8 *dst) {
+	const uint8 *dstStart = dst;
+
+	uint8 bits = 0;
+	uint8 code = 0;
+	uint8 op = 0;
+	uint8 len = 0;
+	uint16 offs = 0;
+
+	for (bool loop = true; loop; ) {
+		if (!bits--) {
+			code = *src++;
+			bits = 7;
+		}
+
+		op = code & 1; 
+		code >>= 1;
+
+		if (op == 0) {
+			*dst++ = *src++;
+			continue;
+		}
+
+		op = *src++;
+
+		if (op == 0x1F) {
+			loop = false;
+			break;
+		} else if (op & 0x80) {
+			if (op & 0x40) {
+				op -= 184;
+				while (op--)
+					*dst++ = *src++;
+				continue;
+			} else {
+				len = (op >> 4) - 6;
+				offs = op & 0x0F;
+			}
+		} else {
+			len = (op & 0x1F) + 3;
+			offs = ((op & 0xE0) << 3) | (*src++);
+		}
+
+		const uint8 *s2 = dst - offs;
+		assert(s2 >= dstStart);
+		while (len--)
+			*dst++ = *s2++;
+	}
+
+	return (dst - dstStart);
+}
+
+uint8 toDecimal(uint8 v) {
+	return (v / 10) << 4 | (v % 10);
+}
+
+uint32 makeBCDTimeStamp(uint32 msecs) {
+	uint32 min = toDecimal(msecs / 60000);
+	uint32 sec = toDecimal((msecs / 1000) % 60);
+	uint32 frm = toDecimal((msecs % 1000) * 1000000 / 13333333);
+	// BCD time code mm:ss:ff:md (md = mode: 00 = CD-DA, 01 = CD-ROM mode 1, 02 = CD-ROM mode 2; irrelevant to us)
+	return ((min & 0xFF) << 24) | ((sec & 0xFF) << 16) | ((frm & 0xFF) << 8);
+}
+
+} // End of namespace Util
+} // End of namespace Snatcher
diff --git a/engines/snatcher/util.h b/engines/snatcher/util.h
new file mode 100644
index 00000000000..0676a7b3edc
--- /dev/null
+++ b/engines/snatcher/util.h
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#ifndef SNATCHER_UTIL_H
+#define SNATCHER_UTIL_H
+
+#include "common/scummsys.h"
+
+namespace Snatcher {
+namespace Util {
+
+extern uint32 decodeSCDData(const uint8 *src, uint8 *dst);
+
+extern uint32 makeBCDTimeStamp(uint32 msecs);
+
+} // End of namespace Util
+} // End of namespace Snatcher
+
+#endif // SNATCHER_SOUND_H


Commit: b8d87f7884f7d127fb73d211033070cf637ef619
    https://github.com/scummvm/scummvm/commit/b8d87f7884f7d127fb73d211033070cf637ef619
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: more intro work

Changed paths:
  A engines/snatcher/info.h
  A engines/snatcher/scroll.h
  A engines/snatcher/scroll_scd.cpp
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/module.mk
    engines/snatcher/palette.h
    engines/snatcher/palette_scd.cpp
    engines/snatcher/render.h
    engines/snatcher/render_scd.cpp
    engines/snatcher/resource.cpp
    engines/snatcher/resource.h
    engines/snatcher/scene/scene_d0.cpp
    engines/snatcher/scene/scene_d1.cpp
    engines/snatcher/scene/scene_d2.cpp
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/sound.cpp
    engines/snatcher/sound.h
    engines/snatcher/sound_device.h
    engines/snatcher/sound_device_null.cpp
    engines/snatcher/sound_device_scd.cpp
    engines/snatcher/util.cpp
    engines/snatcher/util.h


diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 78d49155f21..33df3747460 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -20,21 +20,23 @@
 */
 
 
+#include "snatcher/graphics.h"
 #include "snatcher/palette.h"
 #include "snatcher/render.h"
 #include "snatcher/resource.h"
-#include "snatcher/graphics.h"
+#include "snatcher/scroll.h"
 #include "common/endian.h"
 #include "common/system.h"
 
 namespace Snatcher {
 
-GraphicsEngine::GraphicsEngine(OSystem *system, Common::Platform platform) : _system(system), _renderer(0), _dataMode(0), _screen(nullptr), _flags(0) {
-	_renderer = Renderer::create(platform, _state);
+GraphicsEngine::GraphicsEngine(OSystem *system, Common::Platform platform, const VMInfo &vmstate) : _system(system), _state(vmstate), _renderer(0), _dataMode(0), _screen(nullptr), _flags(0) {
 	_palette = Palette::create(_system->getPaletteManager(), platform, _state);
-	_screen = new uint8[_renderer->screenWidth() * _renderer->screenHeight()]();
-	assert(_renderer);
 	assert(_palette);
+	_scroll = ScrollManager::create(platform, _state);
+	_renderer = Renderer::create(platform, _state, _palette, _scroll);
+	assert(_renderer);
+	_screen = new uint8[_renderer->screenWidth() * _renderer->screenHeight()]();
 	assert(_screen);
 }
 
@@ -44,26 +46,14 @@ GraphicsEngine::~GraphicsEngine() {
 	delete[] _screen;
 }
 
-//uint8 _vc1_var_788A_flags;
-//bool _var_7886;
 uint8 _gfxScript_byte_3;
 
-//int16 _wordRAM__TABLE48__03;
-//int16 _gg_A__, _gg_A__cntDwn;
-
-
-//uint8 _gg_B;
-//uint32 _gg_dword_787A;
-//bool gfx1_sub1() { return true; }
-//void gfx1_sub2() {}
-//
-
 void GraphicsEngine::runScript(ResourcePointer res, int func) {
 	ResourcePointer sc = ResourcePointer(res.dataStart, READ_BE_UINT32(res.dataStart + 4)).getDataFromTable(func);
 
 	for (uint8 cmd = *sc++; cmd != 0xFF; cmd = *sc++) {
 		uint8 len = *sc++;
-		const uint8 *next = sc + len;
+		ResourcePointer next = sc + len;
 
 		switch (cmd) {
 		case 0:
@@ -76,11 +66,11 @@ void GraphicsEngine::runScript(ResourcePointer res, int func) {
 			_state.setVar(8, 1);
 			break;
 		case 2:
-			_renderer->initSprites(sc, len);
+			_renderer->initAnimations(sc, len);
 			break;
 		case 3: 
 		case 4:
-			_renderer->linkSprites(sc, len);
+			_renderer->linkAnimations(sc, len);
 			break;
 
 		case 5:
@@ -89,7 +79,7 @@ void GraphicsEngine::runScript(ResourcePointer res, int func) {
 			_gfxScript_byte_3 = sc[1];
 			break;
 		case 8:
-			_renderer->setPlaneMode(READ_BE_UINT16(sc()));
+			_renderer->setPlaneMode(sc.readUINT16());
 			break;
 		case 9:
 			_dataMode = sc[1];
@@ -108,12 +98,19 @@ void GraphicsEngine::enqueuePaletteEvent(ResourcePointer res) {
 	_palette->enqueueEvent(res);
 }
 
-void GraphicsEngine::enqueueCopyCommands(ResourcePointer res) {
-	_renderer->enqueueCopyCommands(res);
+bool GraphicsEngine::enqueueCopyCommands(ResourcePointer res) {
+	return _renderer->enqueueCopyCommands(res);
 }
 
-void GraphicsEngine::doCommand(uint8 cmd) {
-	_renderer->doCommand(cmd);
+void GraphicsEngine::setScrollStep(uint8 mode, int16 step) {
+	if (mode < 4)
+		_scroll->setDirectionAndSpeed(mode, step);
+	else
+		_scroll->setSingleStep(mode & 3, step);
+}
+
+void GraphicsEngine::scrollCommand(uint8 cmd) {
+	_scroll->doCommand(cmd);
 }
 
 void GraphicsEngine::updateAnimations() {
@@ -121,22 +118,10 @@ void GraphicsEngine::updateAnimations() {
 }
 
 void GraphicsEngine::nextFrame() {
-	//if (!_skipManyEvents) {
-		//_renderer->processEventQueue();
-	//}
-
-	//if (!_skipManyEvents) {
-		//_blockPalEvent = false;
-
-	// update_vint_tables_8F00_
-	//vram_updt1();
 	_palette->processEventQueue();
-	//vintUpdateGfxStructs6();
 	_renderer->updateScreen(_screen);
+
 	_system->copyRectToScreen(_screen, _renderer->screenWidth(), 0, 0, _renderer->screenWidth(), _renderer->screenHeight());
-	//if (_doSCriptBuff)
-	//
-		//}
 	_palette->updateSystemPalette();
 	_system->updateScreen();
 
@@ -144,22 +129,44 @@ void GraphicsEngine::nextFrame() {
 }
 
 void GraphicsEngine::reset(int mode) {
-	if (mode & kRestoreDefaultsExt)
+	if (mode & kResetSetDefaultsExt)
 		restoreDefaultsExt();
-	if (mode & kRestoreDefaults)
+	if (mode & kResetSetDefaults)
 		restoreDefaults();
-	if (mode & kClearPalEvents)
+	if (mode & kResetPalEvents)
 		_palette->clearEvents();
-	if (mode & kClearSprites)
-		_renderer->clearSprites();
-	if (mode & kResetGfxStructs6)
+	if (mode & kResetSprites)
+		_renderer->clearAnimations();
+	if (mode & kResetCopyCmds)
 		_renderer->clearCopyCommands();
+	if (mode & kResetScrollState)
+		_scroll->clear();
 }
 
 void GraphicsEngine::setVar(uint8 var, uint8 val) {
 	_state.setVar(var, val);
 }
 
+void GraphicsEngine::setAnimControlFlags(uint8 animObjId, int flags) {
+	_renderer->anim_setControlFlags(animObjId, flags);
+}
+
+void GraphicsEngine::clearAnimControlFlags(uint8 animObjId, int flags) {
+	_renderer->anim_clearControlFlags(animObjId, flags);
+}
+
+void GraphicsEngine::setAnimFrame(uint8 animObjId, uint16 frameNo) {
+	_renderer->anim_setFrame(animObjId, frameNo);
+}
+
+uint16 GraphicsEngine::getAnimCurFrame(uint8 animObjId) const {
+	return _renderer->anim_getCurFrameNo(animObjId);
+}
+
+bool GraphicsEngine::isAnimEnabled(uint8 animObjId) const {
+	return _renderer->anim_isEnabled(animObjId);
+}
+
 uint16 GraphicsEngine::screenWidth() const {
 	return _renderer ? _renderer->screenWidth() : 0;
 }
@@ -168,8 +175,12 @@ uint16 GraphicsEngine::screenHeight() const {
 	return _renderer ? _renderer->screenHeight() : 0;
 }
 
-bool GraphicsEngine::busy() const {
-	return ((_state.getVar(0) != 0) || (_state.getVar(8) != 0));
+bool GraphicsEngine::busy(int type) const {
+	if (type == 0)
+		return ((_state.getVar(0) != 0) || (_state.getVar(8) != 0));
+	if (type == 1)
+		return _state.getVar(3);
+	return false;
 }
 
 void GraphicsEngine::restoreDefaultsExt() {
@@ -183,8 +194,8 @@ void GraphicsEngine::restoreDefaultsExt() {
 	}
 
 	_renderer->clearCopyCommands();
-	//withD0_FF_FD_FC(0xFC);
-	_renderer->clearSprites();
+	_scroll->doCommand(0xFC);
+	_renderer->clearAnimations();
 
 	if (!(_state.testFlag(4, 1)))
 		_state.setVar(0, 1);
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index ea6c57b212b..b6fca6c6b9f 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -23,6 +23,7 @@
 #define SNATCHER_GRAPHICS_H
 
 #include "common/platform.h"
+#include "snatcher/info.h"
 #include "snatcher/resource.h"
 
 class OSystem;
@@ -30,44 +31,68 @@ class OSystem;
 namespace Snatcher {
 
 class Palette;
+class ScrollManager;
 class Renderer;
 class SceneModule;
 
 class GraphicsEngine {
 public:
-	GraphicsEngine(OSystem *system, Common::Platform platform);
+	GraphicsEngine(OSystem *system, Common::Platform platform, const VMInfo &vmstate);
 	~GraphicsEngine();
 
 	void runScript(ResourcePointer res, int func);
 	void enqueuePaletteEvent(ResourcePointer res);
-	void enqueueCopyCommands(ResourcePointer res);
-	void doCommand(uint8 cmd);
+	bool enqueueCopyCommands(ResourcePointer res);
+
+	enum ScrollMode : uint8 {
+		kHorzA		= 0,
+		kVertA		= 1,
+		kHorzB		= 2,
+		kVertB		= 3,
+		kSingleStep = 4
+	};
+
+	void setScrollStep(uint8 mode, int16 step);
+	void scrollCommand(uint8 cmd);
 
 	void updateAnimations();
 	void nextFrame();
 
 	enum ResetType : uint16 {
-		kClearPalEvents			=	1 << 0,
-		kRestoreDefaults		=	1 << 1,
-		kRestoreDefaultsExt		=	1 << 2,
-		kResetGfxStructs6		=	1 << 3,
-		kClearSprites			=	1 << 4
+		kResetPalEvents			=	1 << 0,
+		kResetSetDefaults		=	1 << 1,
+		kResetSetDefaultsExt	=	1 << 2,
+		kResetCopyCmds			=	1 << 3,
+		kResetSprites			=	1 << 4,
+		kResetScrollState		=	1 << 5
 	};
 
 	void reset(int mode);
 
 	void setVar(uint8 var, uint8 val);
 
+	enum AnimFlags : int {
+		kAnimPause				=	1 << 0,
+		kAnimHide				=	1 << 1,
+		kAnimAudioSync			=	1 << 2
+	};
+
+	void setAnimControlFlags(uint8 animObjId, int flags);
+	void clearAnimControlFlags(uint8 animObjId, int flags);
+	void setAnimFrame(uint8 animObjId, uint16 frameNo);
+	uint16 getAnimCurFrame(uint8 animObjId) const;
+	bool isAnimEnabled(uint8 animObjId) const;
+
 	uint16 screenWidth() const;
 	uint16 screenHeight() const;
 
-	bool busy() const;
+	bool busy(int type) const;
 
 public:
-	struct State {
-		State() {
+	struct GfxState {
+		GfxState(const VMInfo &vminfo) : vm(vminfo) {
 			memset(vars, 0, sizeof(vars));
-			_frameCounter = 0;
+			frameCounter = 0;
 		}
 
 		uint8 getVar(uint8 var) const {
@@ -96,29 +121,39 @@ public:
 		}
 
 		uint16 frameCount() const {
-			return _frameCounter;
+			return frameCounter;
 		}
 
 		void nextFrame() {
-			++_frameCounter;
+			++frameCounter;
+		}
+
+		uint32 getAudioSync() const {
+			return vm.audioSync;
+		}
+
+		uint16 getDropFrames() const {
+			return vm.dropFrames;
 		}
 	
 	private:
-		uint8 vars[10];
-		uint16 _frameCounter;
+		uint8 vars[11];
+		uint16 frameCounter;
+		const VMInfo &vm;
 	};
 
 private:
 	void restoreDefaultsExt();
 	void restoreDefaults();
 
-	State _state;
+	GfxState _state;
 	uint8 _dataMode;
 	uint8 _flags;
 
 	byte *_screen;
 	Renderer *_renderer;
 	Palette *_palette;
+	ScrollManager *_scroll;
 	OSystem *_system;
 };
 
diff --git a/engines/snatcher/info.h b/engines/snatcher/info.h
new file mode 100644
index 00000000000..e50716c8b32
--- /dev/null
+++ b/engines/snatcher/info.h
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_INFO_H
+#define SNATCHER_INFO_H
+
+
+#include "common/scummsys.h"
+
+namespace Snatcher {
+
+struct VMInfo {
+	VMInfo() : dropFrames(0), audioSync(0) {}
+	int16 dropFrames;
+	uint32 audioSync;
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_INFO_H
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index f7374acf5ed..a29dcd23d72 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS := \
 	scene/scene_d1.o \
 	scene/scene_d2.o \
 	snatcher.o \
+	scroll_scd.o \
 	sound.o \
 	sound_device_null.o \
 	sound_device_scd.o \
diff --git a/engines/snatcher/palette.h b/engines/snatcher/palette.h
index c8c89e49a36..0ff7f67226e 100644
--- a/engines/snatcher/palette.h
+++ b/engines/snatcher/palette.h
@@ -31,7 +31,7 @@ namespace Snatcher {
 
 class Palette {
 public:
-	Palette(PaletteManager *pm, GraphicsEngine::State &state) : _palMan(pm), _gfxState(state) {}
+	Palette(PaletteManager *pm, GraphicsEngine::GfxState &state) : _palMan(pm), _gfxState(state) {}
 	virtual ~Palette() {}
 
 	virtual bool enqueueEvent(ResourcePointer &res) { return true; }
@@ -42,13 +42,13 @@ public:
 
 protected:
 	PaletteManager *_palMan;
-	GraphicsEngine::State &_gfxState;
+	GraphicsEngine::GfxState &_gfxState;
 
 private:
-	static Palette *createSegaPalette(PaletteManager *pm, GraphicsEngine::State &state);
+	static Palette *createSegaPalette(PaletteManager *pm, GraphicsEngine::GfxState &state);
 
 public:
-	static Palette *create(PaletteManager *pm, Common::Platform platform, GraphicsEngine::State &state) {
+	static Palette *create(PaletteManager *pm, Common::Platform platform, GraphicsEngine::GfxState &state) {
 		switch (platform) {
 		case Common::kPlatformSegaCD:
 			return createSegaPalette(pm, state);
diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index 1f33553f8e9..7c15755515d 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -25,6 +25,7 @@
 
 #include "common/algorithm.h"
 #include "common/array.h"
+#include "common/debug.h"
 #include "common/endian.h"
 #include "common/func.h"
 #include "common/textconsole.h"
@@ -35,7 +36,7 @@ namespace Snatcher {
 class GraphicsEngine;
 class SCDPalette : public Palette {
 public:
-	SCDPalette(PaletteManager *pm, GraphicsEngine::State &state);
+	SCDPalette(PaletteManager *pm, GraphicsEngine::GfxState &state);
 	~SCDPalette() override;
 
 	bool enqueueEvent(ResourcePointer &res) override;
@@ -71,7 +72,7 @@ private:
 	uint8 *_sysPalette;
 };
 
-SCDPalette::SCDPalette(PaletteManager *pm, GraphicsEngine::State &state) : Palette(pm, state), _eventProcs(), _eventQueue(nullptr), _eventCurPos(nullptr), _colors(nullptr), _colors2(nullptr), _sysPalette(nullptr) {
+SCDPalette::SCDPalette(PaletteManager *pm, GraphicsEngine::GfxState &state) : Palette(pm, state), _eventProcs(), _eventQueue(nullptr), _eventCurPos(nullptr), _colors(nullptr), _colors2(nullptr), _sysPalette(nullptr) {
 #define P_OP(a)	_eventProcs.push_back(new EventProc(this, &SCDPalette::event_##a));
 	_eventProcs.push_back(nullptr);
 	P_OP(palSet);
@@ -114,11 +115,13 @@ bool SCDPalette::enqueueEvent(ResourcePointer &res) {
 		_eventCurPos->delay = *res++;
 		_eventCurPos->countDown = 0;
 		_eventCurPos->destFlag = (*res() & 0x80);
-		_eventCurPos->destOffset = (*res++ & 0x7F) >> 1;
+		_eventCurPos->destOffset = (*res++) >> 1;
 		_eventCurPos->len = (*res++) + 1;
 		_eventCurPos->srcOffsets = _eventCurPos->srcOffsetCur = reinterpret_cast<const uint32*>(res());
 		_eventCurPos->progress = 0;
 
+		debug("%s(): Changing color range %d to %d", __FUNCTION__, _eventCurPos->destOffset, _eventCurPos->destOffset + _eventCurPos->len);
+
 		if (_eventCurPos->cmd & 0x80) {
 			_eventCurPos->cmd &= ~0x80;
 			for (int ii = 0; ii < 12; ++ii) {
@@ -164,6 +167,7 @@ void SCDPalette::setDefaults(int mode) {
 	if (mode == 0) {
 		int cnt = (_gfxState.testFlag(1, 1) || _gfxState.getVar(5)) ? 64 : 48;
 		_gfxState.clearFlag(1, 1);
+		debug("%s(): Clearing palette range %d to %d", __FUNCTION__, 64 - cnt, 64);
 		Common::fill<uint16*, uint16>(&_colors[64 - cnt], &_colors[cnt], 0);
 		if (_gfxState.testFlag(1, 2)) {
 			_gfxState.clearFlag(1, 2);
@@ -212,19 +216,6 @@ void SCDPalette::updateSystemPalette() {
 	const uint16 *src = &_colors2[0 << 6];
 	uint8 *dst = _sysPalette;
 
-	/*uint8 rgbColors[48];
-	uint8 *dst = rgbColors;
-
-	if (srcPalID >= 31 && srcPalID <= 38) {
-		src = &_segaCustomPalettes[(srcPalID - 31) << 4];
-	} else if (srcPalID >= 0) {
-		int temp = 0;
-		const uint16 *palettes = _vm->staticres()->loadRawDataBe16(kEoB1PalettesSega, temp);
-		if (!palettes)
-			return;
-		src = &palettes[srcPalID << 4];
-	}
-	*/
 	// R: bits 1, 2, 3   G: bits 5, 6, 7   B: bits 9, 10, 11
 	for (int i = 0; i < 64; ++i) {
 		uint16 in = *src++;
@@ -241,17 +232,6 @@ void SCDPalette::updateSystemPalette() {
 #endif
 	}
 
-	/*getPalette(0).copy(rgbColors, 0, 16, dstPalID << 4);
-
-	if (_specialColorReplace) {
-		const uint8 swapColors[6] = { 0x08, 0x09, 0x0C, 0x0D, 0x0E, 0x0F };
-		for (int i = 0; i < 6; ++i)
-			getPalette(0).copy(getPalette(0), 0x10 | swapColors[i], 1, swapColors[i]);
-	}
-
-	if (set)
-		setScreenPalette(getPalette(0));
-		*/
 	_palMan->setPalette(_sysPalette, 0, 256);
 }
 
@@ -395,7 +375,7 @@ void SCDPalette::event_palFadeToPal(PalEventSCD *evt) {
 void SCDPalette::event_palClear(PalEventSCD *evt) {
 	if (updateDelay(evt))
 		return;
-
+	debug("%s(): Clearing color range %d to %d", __FUNCTION__, evt->destOffset, evt->destOffset + evt->len);
 	uint16 *dst = &_colors[evt->destOffset];
 	Common::fill<uint16*, uint16>(dst, &dst[evt->len], 0);
 	evt->cmd = 0;
@@ -435,7 +415,7 @@ void SCDPalette::fadeStep(uint16 *modColor, uint16 toR, uint16 toG, uint16 toB)
 	*modColor = (r | g | b);
 }
 
-Palette *Palette::createSegaPalette(PaletteManager *pm, GraphicsEngine::State &state) {
+Palette *Palette::createSegaPalette(PaletteManager *pm, GraphicsEngine::GfxState &state) {
 	return new SCDPalette(pm, state);
 }
 
diff --git a/engines/snatcher/render.h b/engines/snatcher/render.h
index 6936d6c2c92..cad46a3cfd5 100644
--- a/engines/snatcher/render.h
+++ b/engines/snatcher/render.h
@@ -32,32 +32,37 @@ class Renderer {
 public:
 	virtual ~Renderer() {}
 
-	virtual void enqueueCopyCommands(ResourcePointer &res) = 0;
-	virtual void doCommand(uint8 cmd) = 0;
+	virtual bool enqueueCopyCommands(ResourcePointer &res) = 0;
 	virtual void clearCopyCommands() = 0;
 	virtual void initData(ResourcePointer &res, uint8 mode) = 0;
-	virtual void initSprites(ResourcePointer &res, uint16 len) = 0;
-	virtual void linkSprites(ResourcePointer &res, uint16 len) = 0;
-	virtual void clearSprites(int mode = 0) = 0;
+	virtual void initAnimations(ResourcePointer &res, uint16 len) = 0;
+	virtual void linkAnimations(ResourcePointer &res, uint16 len) = 0;
+	virtual void clearAnimations(int mode = 0) = 0;
 	virtual void setPlaneMode(uint16 mode) = 0;
 	virtual void updateScreen(uint8 *screen) = 0;
 	virtual void updateAnimations() = 0;
 
+	virtual void anim_setControlFlags(uint8 animObjId, int flags) = 0;
+	virtual void anim_clearControlFlags(uint8 animObjId, int flags) = 0;
+	virtual void anim_setFrame(uint8 animObjId, uint16 frameNo) = 0;
+	virtual uint16 anim_getCurFrameNo(uint8 animObjId) const = 0;
+	virtual bool anim_isEnabled(uint8 animObjId) const = 0;
+
 	virtual uint16 screenWidth() const = 0;
 	virtual uint16 screenHeight() const = 0;
 
 protected:
-	Renderer(GraphicsEngine::State &state) : _gfxState(state) {}
-	GraphicsEngine::State &_gfxState;
+	Renderer(GraphicsEngine::GfxState &state) : _gfxState(state) {}
+	GraphicsEngine::GfxState &_gfxState;
 
 private:
-	static Renderer *createSegaRenderer(GraphicsEngine::State &state);
+	static Renderer *createSegaRenderer(GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr);
 
 public:
-	static Renderer *create(Common::Platform platform, GraphicsEngine::State &state) {
+	static Renderer *create(Common::Platform platform, GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr) {
 		switch (platform) {
 		case Common::kPlatformSegaCD:
-			return createSegaRenderer(state);
+			return createSegaRenderer(state, pal, scr);
 		default:
 			break;
 		};
diff --git a/engines/snatcher/render_scd.cpp b/engines/snatcher/render_scd.cpp
index 280cdea3705..403339d7e8c 100644
--- a/engines/snatcher/render_scd.cpp
+++ b/engines/snatcher/render_scd.cpp
@@ -20,23 +20,25 @@
 */
 
 
+#include "common/debug.h"
 #include "common/endian.h"
 #include "graphics/segagfx.h"
 #include "snatcher/graphics.h"
+#include "snatcher/palette.h"
 #include "snatcher/render.h"
 #include "snatcher/resource.h"
+#include "snatcher/scroll.h"
 #include "snatcher/util.h"
 
 namespace Snatcher {
 
-struct Sprite {
-	Sprite() : enable(0), delay(0), f4(0), drawFlags(0), posX(0), posY(0), fe(0), f10(0), f11(0), f12(0), f13(0), f14(0), f15(0), f16(0), f18(0), f1c(0), f20(0), f24(0), controlFlags(0), f26(0), f27(0), frame(0), f2a(0), f2c(0), f2d(0), offs_2e(0), res(), animData(0), spriteData(0), speedX(0), speedY(0), prev(0), next(0), next2(0), f4e(0), f4f(0) {}
+struct AnimObject {
+	AnimObject() : enable(0), delay(0), drawFlags(0), posX(0), posY(0), speedXa(0), speedYa(0), f16(0), f18(0), f1c(0), timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0), res(), scriptData(), spriteData(0), speedX(0), speedY(0), parent(0), children(0), next(0), f4e(0), f4f(0) {}
 
 	void clear() {
-		*this = Common::move(Sprite());
+		*this = Common::move(AnimObject());
 		/*enable = 0;
 		delay = 0;
-		f4 = 0;
 		drawFlags = 0;
 		posX = 0;
 		posY = 0;
@@ -51,6 +53,9 @@ struct Sprite {
 		f18 = 0;
 		f1c = 0;
 		f20 = 0;
+		f21 = 0;
+		f22 = 0;
+		f23 = 0;
 		f24 = 0;
 		controlFlags = 0;
 		f26 = 0;
@@ -74,41 +79,35 @@ struct Sprite {
 
 	uint16 enable;
 	uint16 delay;
-	uint8 f4;
-	uint8 drawFlags;
+	uint16 drawFlags;
 	uint32 posX;
 	uint32 posY;
 
-	uint16 fe;
-	uint8 f10;
-	uint8 f11;
-	uint16 f12;
-	uint8 f13;
-	uint8 f14;
-	uint8 f15;
+	uint32 speedXa;
+	uint32 speedYa;
 	uint8 f16;
 	uint16 f18;
 	uint8 f1c;
-	uint32 f20;
+	uint8 timeStamp;
 	uint8 f24;
 	uint8 controlFlags;
-	uint8 f26;
-	uint8 f27;
+	uint8 allowFrameDrop;
+	uint8 frameSeqCounter;
 	uint16 frame;
-	int16 f2a;
+	int16 frameDelay;
 	uint8 f2c;
 	uint8 f2d;
 
-	uint32 offs_2e;
+	uint32 spriteTableLocation;
 	ResourcePointer res;
-	const uint8 *animData;
+	ResourcePointer scriptData;
 	const uint16 *spriteData;
 
-	int32 speedX;
-	int32 speedY;
-	uint16 prev;
+	uint32 speedX;
+	uint32 speedY;
+	uint16 parent;
+	uint16 children;
 	uint16 next;
-	uint16 next2;
 	uint8 f4e;
 	uint8 f4f;
 };
@@ -116,21 +115,26 @@ struct Sprite {
 class GraphicsEngine;
 class Renderer_SCD : public Renderer {
 public:
-	Renderer_SCD(GraphicsEngine::State &state);
+	Renderer_SCD(GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr);
 	~Renderer_SCD() override;
 
-	void enqueueCopyCommands(ResourcePointer &res) override;
-	void doCommand(uint8 cmd) override;
+	bool enqueueCopyCommands(ResourcePointer &res) override;
 	void clearCopyCommands() override;
 	void initData(ResourcePointer &res, uint8 mode) override;
-	void initSprites(ResourcePointer &res, uint16 len) override;
-	void linkSprites(ResourcePointer &res, uint16 len) override;
-	void clearSprites(int mode = 0) override;
+	void initAnimations(ResourcePointer &res, uint16 len) override;
+	void linkAnimations(ResourcePointer &res, uint16 len) override;
+	void clearAnimations(int mode = 0) override;
 	void setPlaneMode(uint16 mode) override;
 
 	void updateScreen(uint8 *screen) override;
 	void updateAnimations() override;
 
+	void anim_setControlFlags(uint8 animObjId, int flags) override;
+	void anim_clearControlFlags(uint8 animObjId, int flags) override;
+	void anim_setFrame(uint8 animObjId, uint16 frameNo) override;
+	uint16 anim_getCurFrameNo(uint8 animObjId) const override;
+	bool anim_isEnabled(uint8 animObjId) const override;
+
 	uint16 screenWidth() const override { return _screenWidth; }
 	uint16 screenHeight() const override { return _screenHeight; }
 
@@ -138,14 +142,13 @@ private:
 	void loadDataFromGfxScript();
 	void executeCopyCommands();
 	void drawSprites();
-	void executeGfxCommands();
 	void reconfigPlanes();
 	void updateScrollState();
 
-	void drawSprite(Sprite &a);
-	void updateAnim32Spec(Sprite &s);
-	bool updateAnimationsFlag4(Sprite &s);
-	void runAnimScript(Sprite &s);
+	void drawSprite(AnimObject &a);
+	void updateAnim32Spec(AnimObject &a);
+	bool reachedAudioTimeStamp(AnimObject &a) const;
+	void runAnimScript(AnimObject &a);
 
 	const uint16 _screenWidth, _screenHeight;
 
@@ -157,19 +160,12 @@ private:
 	uint16 _clearFlags;
 	uint8 _mode;
 	uint8 _modeChange;
-	int16 _vScrollStateA;
-	int16 _vScrollStateB;
-	int16 _hScrollStateA;
-	int16 _hScrollStateB;
-	uint16 *_hScrollTable;
-	uint16 _hScrollTableLen;
-	bool _scrollStateChanged;
-	bool _vScrollDisable;
-
 	Graphics::SegaRenderer *_sr;
+	Palette *_pal;
+	ScrollManager *_scroll;
 
 private:
-	Sprite *_sprites;
+	AnimObject *_animations;
 
 	struct CopyCommand {
 		CopyCommand() : cmd(0), progress(0), ptr(0), res(), c(0), d(0) {}
@@ -192,60 +188,61 @@ private:
 	CopyCommand *_copyCommands;
 
 private:
-	typedef Common::Functor2Mem<Sprite&, const uint8*, int, Renderer_SCD> GfxAnimFunc;
+	typedef Common::Functor2Mem<AnimObject&, const uint8*, int, Renderer_SCD> GfxAnimFunc;
 	Common::Array<GfxAnimFunc*> _animProcs;
 
 	void makeAnimFunctions();
 
-	int anim_00(Sprite &s, const uint8 *data);
-	int anim_01(Sprite &s, const uint8 *data);
-	int anim_02(Sprite &s, const uint8 *data);
-	int anim_03(Sprite &s, const uint8 *data);
-	int anim_04(Sprite &s, const uint8 *data);
-	int anim_05(Sprite &s, const uint8 *data);
-	int anim_06(Sprite &s, const uint8 *data);
-	int anim_07(Sprite &s, const uint8 *data);
-	int anim_08(Sprite &s, const uint8 *data);
-	int anim_09(Sprite &s, const uint8 *data);
-	int anim_10(Sprite &s, const uint8 *data);
-	int anim_11(Sprite &s, const uint8 *data);
-	int anim_12(Sprite &s, const uint8 *data);
-	int anim_13(Sprite &s, const uint8 *data);
-	int anim_14(Sprite &s, const uint8 *data);
-	int anim_15(Sprite &s, const uint8 *data);
-	int anim_16(Sprite &s, const uint8 *data);
-	int anim_20(Sprite &s, const uint8 *data);
-	int anim_21(Sprite &s, const uint8 *data);
-	int anim_22(Sprite &s, const uint8 *data);
-	int anim_23(Sprite &s, const uint8 *data);
-	int anim_24(Sprite &s, const uint8 *data);
-	int anim_25(Sprite &s, const uint8 *data);
-	int anim_27(Sprite &s, const uint8 *data);
-	int anim_28(Sprite &s, const uint8 *data);
-	int anim_29(Sprite &s, const uint8 *data);
-	int anim_30(Sprite &s, const uint8 *data);
-	int anim_31(Sprite &s, const uint8 *data);
-	int anim_32(Sprite &s, const uint8 *data);
-	int anim_34(Sprite &s, const uint8 *data);
-	int anim_35(Sprite &s, const uint8 *data);
-	int anim_36(Sprite &s, const uint8 *data);
-	int anim_37(Sprite &s, const uint8 *data);
-	int anim_38(Sprite &s, const uint8 *data);
-	int anim_39(Sprite &s, const uint8 *data);
-	int anim_40(Sprite &s, const uint8 *data);
-	int anim_41(Sprite &s, const uint8 *data);
-	int anim_42(Sprite &s, const uint8 *data);
-	int anim_43(Sprite &s, const uint8 *data);
-	int anim_44(Sprite &s, const uint8 *data);
-	int anim_45(Sprite &s, const uint8 *data);
-	int anim_46(Sprite &s, const uint8 *data);
-	int anim_47(Sprite &s, const uint8 *data);
-	int anim_99(Sprite &s, const uint8 *data);
+	int anim_remove(AnimObject &a, const uint8 *data);
+	int anim_setFrame(AnimObject &a, const uint8 *data);
+	int anim_seqSetFrame(AnimObject &a, const uint8 *data);
+	int anim_rndSeqSetFrame(AnimObject &a, const uint8 *data);
+	int anim_setX(AnimObject &a, const uint8 *data);
+	int anim_setY(AnimObject &a, const uint8 *data);
+	int anim_06(AnimObject &a, const uint8 *data);
+	int anim_07(AnimObject &a, const uint8 *data);
+	int anim_palEvent(AnimObject &a, const uint8 *data);
+	int anim_palReset(AnimObject &a, const uint8 *data);
+	int anim_copyCmds(AnimObject &a, const uint8 *data);
+	int anim_11(AnimObject &a, const uint8 *data);
+	int anim_12(AnimObject &a, const uint8 *data);
+	int anim_13(AnimObject &a, const uint8 *data);
+	int anim_14(AnimObject &a, const uint8 *data);
+	int anim_15(AnimObject &a, const uint8 *data);
+	int anim_pause(AnimObject &a, const uint8 *data);
+	int anim_resumeAndUnsyncOther(AnimObject &a, const uint8 *data);
+	int anim_removeOther(AnimObject &a, const uint8 *data);
+	int anim_pauseAndHideOther(AnimObject &a, const uint8 *data);
+	int anim_hide(AnimObject &a, const uint8 *data);
+	int anim_24(AnimObject &a, const uint8 *data);
+	int anim_audioSync(AnimObject &a, const uint8 *data);
+	int anim_27(AnimObject &a, const uint8 *data);
+	int anim_28(AnimObject &a, const uint8 *data);
+	int anim_29(AnimObject &a, const uint8 *data);
+	int anim_30(AnimObject &a, const uint8 *data);
+	int anim_31(AnimObject &a, const uint8 *data);
+	int anim_setDrawFlags(AnimObject &a, const uint8 *data);
+	int anim_34(AnimObject &a, const uint8 *data);
+	int anim_35(AnimObject &a, const uint8 *data);
+	int anim_36(AnimObject &a, const uint8 *data);
+	int anim_37(AnimObject &a, const uint8 *data);
+	int anim_38(AnimObject &a, const uint8 *data);
+	int anim_39(AnimObject &a, const uint8 *data);
+	int anim_40(AnimObject &a, const uint8 *data);
+	int anim_41(AnimObject &a, const uint8 *data);
+	int anim_42(AnimObject &a, const uint8 *data);
+	int anim_43(AnimObject &a, const uint8 *data);
+	int anim_allowFrameDrop(AnimObject &a, const uint8 *data);
+	int anim_45(AnimObject &a, const uint8 *data);
+	int anim_46(AnimObject &a, const uint8 *data);
+	int anim_47(AnimObject &a, const uint8 *data);
+
+	int anim_updateFrameDelay(AnimObject &a, const uint8 *data);
+	void anim_setGroupParameter(AnimObject &a, int pata, uint16 val = 0, bool recursive = false);
 };
 
-Renderer_SCD::Renderer_SCD(GraphicsEngine::State &state) : Renderer(state), _screenWidth(256), _screenHeight(224), _transferData(), _transferMode(0),
-	_transferDelay(0), _clearFlags(0), _mode(1), _modeChange(0), _tempBuffer(nullptr), _spriteBuffer(nullptr), _sr(nullptr), _sprites(nullptr), _copyCommands(nullptr),
-	_vScrollStateA(0), _vScrollStateB(0), _hScrollStateA(0), _hScrollStateB(0), _hScrollTable(nullptr), _hScrollTableLen(0), _vScrollDisable(false), _scrollStateChanged(false) {
+Renderer_SCD::Renderer_SCD(GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr) : Renderer(state), _pal(pal), _scroll(scr), _screenWidth(256), _screenHeight(224), _transferData(), _transferMode(0),
+	_transferDelay(0), _clearFlags(0), _mode(1), _modeChange(0), _tempBuffer(nullptr), _spriteBuffer(nullptr), _sr(nullptr), _animations(nullptr), _copyCommands(nullptr) {
 
 	makeAnimFunctions();
 
@@ -258,15 +255,12 @@ Renderer_SCD::Renderer_SCD(GraphicsEngine::State &state) : Renderer(state), _scr
 	_spriteBuffer = new uint16[0x100]();
 	assert(_spriteBuffer);
 
-	_sprites = new Sprite[64];
-	assert(_sprites);
+	_animations = new AnimObject[64];
+	assert(_animations);
 
 	_copyCommands = new CopyCommand[7];
 	assert(_copyCommands);
 
-	_hScrollTable = new uint16[0x200]();
-	assert(_hScrollTable);
-
 	_sr->setResolution(_screenWidth, _screenHeight);
 	_sr->setupWindowPlane(0, 0, Graphics::SegaRenderer::kWinToLeft, Graphics::SegaRenderer::kWinToTop);
 	_sr->setVScrollMode(Graphics::SegaRenderer::kVScrollFullScreen);
@@ -280,15 +274,14 @@ Renderer_SCD::~Renderer_SCD() {
 	delete _sr;
 	delete[] _tempBuffer;
 	delete[] _spriteBuffer;
-	delete[] _sprites;
+	delete[] _animations;
 	delete[] _copyCommands;
-	delete[] _hScrollTable;
 
 	for (uint i = 0; i < _animProcs.size(); ++i) \
 		delete _animProcs[i];
 }
 
-void Renderer_SCD::enqueueCopyCommands(ResourcePointer &res) {
+bool Renderer_SCD::enqueueCopyCommands(ResourcePointer &res) {
 	for (CopyCommand *it = _copyCommands; it < &_copyCommands[7]; ++it) {
 		if (it->cmd != 0)
 			continue;
@@ -296,44 +289,9 @@ void Renderer_SCD::enqueueCopyCommands(ResourcePointer &res) {
 		it->cmd = *res++;
 		it->progress = 0;
 		it->ptr = ++res;
-		break;
-	}
-}
-
-void Renderer_SCD::doCommand(uint8 cmd) {
-	struct CmdState {
-		bool needScroll;
-		uint16 word1;
-		uint16 word2;
-		uint16 word3;
-		uint16 word4;
-		uint8 cmd_7orabove;
-		uint8 cmd_0to6;
-		uint8 cmd_FF_or_FC;
-		uint16 word18;
-		uint16 word1C;
-		uint16 word28;
-		uint16 word2C;
-		uint16 word30;
-		uint16 word34;
-		uint16 word38;
-		uint16 word3C;
-	} _cmdState;
-
-	_gfxState.setVar(3, 1);
-
-	if (cmd == 0xFF || cmd == 0xFC) {
-		memset(&_cmdState, 0, sizeof(_cmdState));
-		_hScrollStateA = _hScrollStateB = _vScrollStateA = _vScrollStateB = 0;
-		_cmdState.cmd_FF_or_FC = cmd;
-	} else {
-		if (cmd >= 7 && cmd != 0xFD) {
-			_cmdState.cmd_7orabove = cmd;
-		} else {
-			_cmdState.cmd_0to6 = cmd;
-			_cmdState.needScroll = (cmd < 3) ? cmd : 0;
-		}
+		return true;
 	}
+	return false;
 }
 
 void Renderer_SCD::clearCopyCommands() {
@@ -346,68 +304,66 @@ void Renderer_SCD::initData(ResourcePointer &res, uint8 mode) {
 	_transferMode = mode;
 }
 
-void Renderer_SCD::initSprites(ResourcePointer &res, uint16 len) {
-	const uint8 *next = res + len;
-	const uint8 *data = res();
-	while (data < next) {
-		assert(*data < (64 * sizeof(Sprite)));
-		Sprite *s = &_sprites[*data++];
-		if (s->enable)
+void Renderer_SCD::initAnimations(ResourcePointer &res, uint16 len) {
+	ResourcePointer next = res + len;
+	ResourcePointer in = res;
+	while (in < next) {
+		assert(in[0] < 64);
+		AnimObject *a = &_animations[*in++];
+		if (a->enable)
 			return;
 
-		s->clear();
-		s->enable = 1;
-		s->res = res;
-		s->controlFlags = *data++;
-		s->posX = READ_BE_UINT16(data);
-		data += 2;
-		s->posY = READ_BE_UINT16(data);
-		data += 2;
-		s->offs_2e = READ_BE_UINT32(data);
-		data += 4;
-		s->animData = data + READ_BE_UINT16(data) + 2;
-		data += 2;
-		s->frame = 0xFFFF;
-
-		uint8 v = *s->animData;
+		a->clear();
+		a->enable = 1;
+		a->res = res;
+		a->controlFlags = *in++;
+		a->posX = in.readIncrSINT16() << 16;
+		a->posY = in.readIncrSINT16() << 16;
+		a->spriteTableLocation = in.readIncrUINT32();
+		int16 offs = in.readIncrSINT16();
+		a->scriptData = in + offs;
+		a->frame = 0xFFFF;
+
+		uint8 cmd = a->scriptData[0];
 		for (bool l = true; l; ) {
-			if (v == 0xA1 || v == 0xA7) {
-				s->f16 = s->animData[1];
-				v = s->animData[4];
+			if (cmd == 0xA1 || cmd == 0xA7) {
+				a->f16 = a->scriptData[1];
+				cmd = a->scriptData[4];
+				assert(cmd != 0xA1 && cmd != 0xA7); // The original code would theoretically allow a deadlock here.
 			} else {
-				if (!(v & 0x80))
-					s->spriteData = reinterpret_cast<const uint16*>(res.makeAbsPtr(s->offs_2e).getDataFromTable(v)());
+				if (!(cmd & 0x80))
+					a->spriteData = reinterpret_cast<const uint16*>(res.makeAbsPtr(a->spriteTableLocation).getDataFromTable(cmd)());
 				l = false;
 			}
 		}
 	}
 }
 
-void Renderer_SCD::linkSprites(ResourcePointer &res, uint16 len) {
-	const uint8 *next = res + len;
-	const uint8 *data = res();
-	while (data < next) {
-		uint16 i1 = *data++;
-		uint16 i2 = *data++;
-		assert(i1 < ARRAYSIZE(_sprites) && i2 < ARRAYSIZE(_sprites));
-		Sprite *s1 = &_sprites[i1];
-		Sprite *s2 = &_sprites[i2];
-		s2->next2 = s1->next;
-		s1->next = i2;
-		s2->prev = i1;
+void Renderer_SCD::linkAnimations(ResourcePointer &res, uint16 len) {
+	ResourcePointer next = res + len;
+	ResourcePointer in = res;
+	while (in < next) {
+		uint16 p = *in++;
+		uint16 c = *in++;
+		assert(p < 64 && c < 64);
+		AnimObject *pPr = &_animations[p];
+		AnimObject *pCh = &_animations[c];
+		pCh->next = pPr->children;
+		pPr->children = c;
+		pCh->parent = p;
 	}
 }
 
-void Renderer_SCD::clearSprites(int mode) {
+void Renderer_SCD::clearAnimations(int mode) {
 	if (mode) {
 		for (int i = 1; i < 64; ++i) {
-			Sprite *s = &_sprites[i];
+			AnimObject *s = &_animations[i];
 			if (s->enable && !(s->f4e & 1))
 				s->clear();
 		}
 	} else {
 		for (int i = 1; i < 64; ++i)
-			_sprites[i].clear();
+			_animations[i].clear();
 	}
 }
 void Renderer_SCD::setPlaneMode(uint16 mode) {
@@ -433,50 +389,75 @@ void Renderer_SCD::updateScreen(uint8 *screen) {
 	loadDataFromGfxScript();
 	executeCopyCommands();
 	drawSprites();
-	executeGfxCommands();
+	updateScrollState();
 
 	_sr->render(screen);
 }
 
-uint16 _anima_a1 = 0;
-uint16 _anima_a2 = 0;
-uint16 _anima_a3 = 0;
 void Renderer_SCD::updateAnimations() {
-	for (Sprite *s = _sprites; s < &_sprites[64]; ++s) {
-		_anima_a2 = _anima_a1;
-		if ((s->f1c || s->f26) && _anima_a3)
+	for (AnimObject *s = _animations; s < &_animations[64]; ++s) {
+		int16 dropFrames = _gfxState.getDropFrames();
+		if ((s->f1c || s->allowFrameDrop) && _gfxState.getVar(10))
 			continue;
-
+		if (dropFrames)
+			debug("%s(): Dropping %d frames for anim %d", __FUNCTION__, dropFrames, s - _animations);
 		do {
 			if (!s->enable)
 				break;
-			if (s->controlFlags & 4) {
-				if (updateAnimationsFlag4(*s))
+			if (s->controlFlags & GraphicsEngine::kAnimAudioSync) {
+				if (!reachedAudioTimeStamp(*s))
 					break;
-				s->controlFlags &= ~4;
+				s->controlFlags &= ~GraphicsEngine::kAnimAudioSync;
 			}
-			runAnimScript(*s);
-			if (--_anima_a2 < 0)
+			if (s->controlFlags & GraphicsEngine::kAnimPause)
 				break;
-		} while (s->f26);
+
+			runAnimScript(*s);
+
+		} while (--dropFrames >= 0 && s->allowFrameDrop);
 	}
 
-	for (Sprite *s = _sprites; s < &_sprites[64]; ++s) {
-		if (!s->enable || (s->f1c & _anima_a3))
+	for (AnimObject *s = _animations; s < &_animations[64]; ++s) {
+		if (!s->enable || (s->f1c & _gfxState.getVar(10)))
 			continue;
 
-		uint16 offs = s->frame == 0xFFFF ? 0 : s->frame;
-		const uint8 *in = &s->animData[offs << 2];
-		if (!(*in & 0x80))
-			s->spriteData = reinterpret_cast<const uint16*>(s->res.makeAbsPtr(s->offs_2e).getDataFromTable(*in)());
+		uint8 cmd = s->scriptData[(s->frame == 0xFFFF ? 0 : s->frame) << 2];
+		if (!(cmd & 0x80))
+			s->spriteData = reinterpret_cast<const uint16*>(s->res.makeAbsPtr(s->spriteTableLocation).getDataFromTable(cmd)());
 
-		if (s->controlFlags & 1) {
+		if (!(s->controlFlags & GraphicsEngine::kAnimPause)) {
 			s->posX += s->speedX;
 			s->posY += s->speedY;
 		}
 	}
+}
+
+void Renderer_SCD::anim_setControlFlags(uint8 animObjId, int flags) {
+	assert(animObjId < 64);
+	flags &= 7;
+	_animations[animObjId].controlFlags |= flags;
+}
+
+void Renderer_SCD::anim_clearControlFlags(uint8 animObjId, int flags) {
+	assert(animObjId < 64);
+	_animations[animObjId].controlFlags &= ~flags;
+}
+
+void Renderer_SCD::anim_setFrame(uint8 animObjId, uint16 frameNo) {
+	assert(animObjId < 64);
+	_animations[animObjId].frame = frameNo;
+}
+
+uint16 Renderer_SCD::anim_getCurFrameNo(uint8 animObjId) const {
+	assert(animObjId < 64);
+	return _animations[animObjId].frame;
+}
 
+bool Renderer_SCD::anim_isEnabled(uint8 animObjId) const {
+	assert(animObjId < 64);
+	return _animations[animObjId].enable != 0;
 }
+
 void Renderer_SCD::loadDataFromGfxScript() {
 	if (_gfxState.getVar(0)) {
 		if (_gfxState.getVar(0) == 1) {
@@ -496,17 +477,16 @@ void Renderer_SCD::loadDataFromGfxScript() {
 		return;
 	}
 
-	if (*reinterpret_cast<const uint16*>(_transferData()) == 0xFFFF) {
+	if (_transferData.readUINT16() == 0xFFFF) {
 		_gfxState.setVar(8, 0);
 		return;
 	}
 
-	_transferDelay = READ_BE_UINT16(_transferData() + 4);
-	const byte *src = _transferData.makeAbsPtr(READ_BE_UINT32(_transferData()) & 0xFFFFFF)();
-	uint16 addr = READ_BE_UINT16(_transferData() + 6);
+	const byte *src = _transferData.makeAbsPtr(_transferData.readIncrUINT32() & 0xFFFFFF)();
+	_transferDelay = _transferData.readIncrUINT16();
+	uint16 addr = _transferData.readIncrUINT16();
 
 	if (!_transferMode) {
-		_transferData += 8;
 		uint32 len = READ_BE_UINT16(src);
 		if (len != Util::decodeSCDData(src + 2, _tempBuffer))
 			error("%s(): Decode size mismatch", __FUNCTION__);
@@ -560,14 +540,15 @@ void Renderer_SCD::executeCopyCommands() {
 		uint8 b = 0;
 
 		if ((it->cmd & 0x0F) < 4 && (it->cmd & 0x0F) != 1 && !(it->cmd & 0x80)) {
-			uint32 len = READ_BE_UINT16(it->ptr);
-			if (len != Util::decodeSCDData(it->ptr + 2, s))
+			const uint8 *cmp = it->res.makeAbsPtr(READ_BE_UINT32(it->ptr))();
+			uint32 len = READ_BE_UINT16(cmp);
+			if (len != Util::decodeSCDData(cmp + 2, s))
 				error("%s(): Decode size mismatch", __FUNCTION__);
 		}
 
 		switch (it->cmd & 0x0F) {
 		case 0:
-			_sr->loadToVRAM(s + READ_BE_UINT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
+			_sr->loadToVRAM(s + READ_BE_INT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
 			it->ptr += 10;
 			if (READ_BE_UINT16(it->ptr) == 0xFFFF) {
 				it->cmd = 0;
@@ -576,8 +557,8 @@ void Renderer_SCD::executeCopyCommands() {
 			break;
 		case 1:
 			for (bool rept = true; rept; ) {
-				memcpy(s + READ_BE_UINT16(it->ptr + 6), it->res.makeAbsPtr(READ_BE_UINT32(it->ptr))(), READ_BE_UINT16(it->ptr + 8));
-				_sr->loadToVRAM(s + READ_BE_UINT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
+				memcpy(s + READ_BE_INT16(it->ptr + 6), it->res.makeAbsPtr(READ_BE_UINT32(it->ptr))(), READ_BE_UINT16(it->ptr + 8));
+				_sr->loadToVRAM(s + READ_BE_INT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
 				it->ptr += 10;
 				if (READ_BE_UINT16(it->ptr) == 0xFFFF) {
 					it->cmd = 0;
@@ -588,7 +569,7 @@ void Renderer_SCD::executeCopyCommands() {
 		case 2:
 			it->cmd |= 0x80;
 			for (bool rept = true; rept; ) {
-				_sr->loadToVRAM(s + READ_BE_UINT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
+				_sr->loadToVRAM(s + READ_BE_INT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
 				if (bptr)
 					it->ptr = bptr;
 				it->ptr += 10;
@@ -601,10 +582,11 @@ void Renderer_SCD::executeCopyCommands() {
 			}
 			break;
 		case 3:
+			it->cmd |= 0x80;
 			a = it->progress & 7;
 			b = (a + (((it->progress >> 3) * 5) & 7)) & 7;
 			a = (a << 2) + offs[b];
-			s += (a + READ_BE_UINT16(it->ptr + 6));
+			s += (a + READ_BE_INT16(it->ptr + 6));
 			b = mask[b];
 			a = READ_BE_UINT16(it->ptr + 8) >> 5;
 			while (a--) {
@@ -612,7 +594,7 @@ void Renderer_SCD::executeCopyCommands() {
 				s += 32;
 			}
 			s = _tempBuffer + section * 0x2000;
-			_sr->loadToVRAM(s + READ_BE_UINT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
+			_sr->loadToVRAM(s + READ_BE_INT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
 			if (++it->progress == 65)
 				it->cmd = 0;
 			break;
@@ -640,18 +622,14 @@ void Renderer_SCD::executeCopyCommands() {
 
 void Renderer_SCD::drawSprites() {
 	for (int i = 63; i >= 0; --i) {
-		Sprite &s = _sprites[i];
-		if (s.enable && s.spriteData != nullptr && !(s.controlFlags & 2) && s.delay != 0xFFFF && !(s.delay & _gfxState.frameCount()))
-			drawSprite(s);
+		AnimObject &a = _animations[i];
+		if (a.enable && a.spriteData != nullptr && !(a.controlFlags & GraphicsEngine::kAnimHide) && a.delay != 0xFFFF && !(a.delay & _gfxState.frameCount()))
+			drawSprite(a);
 		if (i == 32)
-			updateAnim32Spec(s);
+			updateAnim32Spec(a);
 	}
 }
 
-void Renderer_SCD::executeGfxCommands() {
-
-}
-
 static const uint8 src0000[] = {
 	0x13, 0x00, 0xaa, 0x00, 0x1c, 0x01, 0x11, 0x1c,
 	0x01, 0x22, 0x04, 0x01, 0x33, 0x04, 0x01, 0xaa,
@@ -1098,64 +1076,67 @@ void Renderer_SCD::reconfigPlanes() {
 }
 
 void Renderer_SCD::updateScrollState() {
-	if (!_scrollStateChanged)
+	if (!_scroll->nextFrame())
 		return;
 
-	if (!_vScrollDisable) {
-		_sr->writeUint16VSRAM(0, TO_BE_16((uint16)(-_vScrollStateA) & 0x3FF));
-		_sr->writeUint16VSRAM(2, TO_BE_16((uint16)(-_vScrollStateB) & 0x3FF));
+	const ScrollManager::ScrollState &s = _scroll->getState();
+
+	if (!s.disableVScroll) {
+		_sr->writeUint16VSRAM(0, TO_BE_16(s.offsets[ScrollManager::kVertA] & 0x3FF));
+		_sr->writeUint16VSRAM(2, TO_BE_16(s.offsets[ScrollManager::kVertB] & 0x3FF));
 	}
 
-	if (_hScrollTableLen) {
-		_sr->loadToVRAM(_hScrollTable, 0x400, 0xF800);
+	if (s.lineScrollMode) {
+		for (int i = 0; i < s.hScrollTableNumEntries; ++i)
+			_sr->writeUint16VRAM(0xF822 + i * 4, TO_BE_16(s.hScrollTable[i] & 0x3FF));
 	} else {
 		uint16 addr = _mode ? 0xF800 : 0xB800;
-		_sr->writeUint16VRAM(addr, TO_BE_16((uint16)_hScrollStateA & 0x3FF));
-		_sr->writeUint16VRAM(addr + 2, TO_BE_16((uint16)_hScrollStateB & 0x3FF));
+		_sr->writeUint16VRAM(addr, TO_BE_16(s.offsets[ScrollManager::kHorzA] & 0x3FF));
+		_sr->writeUint16VRAM(addr + 2, TO_BE_16(s.offsets[ScrollManager::kHorzB] & 0x3FF));
 	}
-
-	_scrollStateChanged = false;
 }
 
-void Renderer_SCD::drawSprite(Sprite &s) {
-	const uint16 *in = s.spriteData;
+void Renderer_SCD::drawSprite(AnimObject &a) {
+	const uint16 *in = a.spriteData;
 	uint16 num = FROM_BE_16(*in++);
 	uint16 *d = _spriteBuffer;
 	memset(d, 0, 8);
 	int nxt = 1;
 
-	uint32 curY = s.posY + 0x800000;
-	uint32 curX = s.posX + 0x800000;
+	uint32 curY = a.posY + 0x800000;
+	uint32 curX = a.posX + 0x800000;
 
-	if (s.drawFlags & 4) {
-		curX += _hScrollStateA;
-		curY += _vScrollStateA;
+	if (a.drawFlags & 4) {
+		const ScrollManager::ScrollState &s = _scroll->getState();
+		curX += s.offsets[ScrollManager::kHorzA];
+		curY += s.offsets[ScrollManager::kVertA];
 	}
 
-	if (s.drawFlags & 8) {
-		curX += _hScrollStateB;
-		curY += _vScrollStateB;
+	if (a.drawFlags & 8) {
+		const ScrollManager::ScrollState &s = _scroll->getState();
+		curX += s.offsets[ScrollManager::kHorzB];
+		curY += s.offsets[ScrollManager::kVertB];
 	}
 
-	uint16 flip = (s.drawFlags & 3) << 11;
-	uint16 p = ((s.f18 & 4) << 13) | ((s.f18 & 0xF8) >> 3);
+	uint16 flip = (a.drawFlags & 3) << 11;
+	uint16 p = ((a.f18 & 4) << 13) | ((a.f18 & 0xF8) >> 3);
 
 	for (int i = 0; i < num && nxt < 65; ++i) {
 		uint16 origY = FROM_BE_16(*in++);
 		uint16 hw = FROM_BE_16(*in++);
 
-		if (s.drawFlags & 2)
+		if (a.drawFlags & 2)
 			origY = -origY - (((hw >> 5) & 0x18) + 8);
 
 		uint16 tl = FROM_BE_16(*in++);
 		uint16 origX = FROM_BE_16(*in++);
 
-		if (s.drawFlags & 1)
+		if (a.drawFlags & 1)
 			origX = -origX - (((hw >> 7) & 0x18) + 8);
 
 		tl = (tl | p) ^ flip;
-		if (s.f16 & 0x80) {
-			uint16 v = (s.f16 & 3) << 13;
+		if (a.f16 & 0x80) {
+			uint16 v = (a.f16 & 3) << 13;
 			tl = (tl & 0x9FFF) | v;
 		}
 
@@ -1171,77 +1152,80 @@ void Renderer_SCD::drawSprite(Sprite &s) {
 	_sr->loadToVRAM(_spriteBuffer, (d - _spriteBuffer) * sizeof(uint16), 0xFE00);
 }
 
-void Renderer_SCD::updateAnim32Spec(Sprite &s) {
+void Renderer_SCD::updateAnim32Spec(AnimObject &a) {
 
 }
 
-bool Renderer_SCD::updateAnimationsFlag4(Sprite &s) {
-	return false;
+bool Renderer_SCD::reachedAudioTimeStamp(AnimObject &a) const {
+	return _gfxState.getAudioSync() >= a.timeStamp;
 }
 
-void Renderer_SCD::runAnimScript(Sprite &s) {
-	if (--s.f2a > 0) {
-		if (s.animData[s.frame << 2] != 0x97)
-			s.controlFlags &= ~2;
+void Renderer_SCD::runAnimScript(AnimObject &a) {
+	if (--a.frameDelay > 0) {
+		if (a.scriptData[a.frame << 2] != 0x97)
+			a.controlFlags &= ~GraphicsEngine::kAnimHide;
 		return;
 	}
 
-	int incr = (s.f4f == 0) ? 1 : 0;
+	int incr = (a.f4f == 0) ? 1 : 0;
 
 	while (incr != -1) {
-		s.frame += incr;
-		s.controlFlags &= ~2;
-		const uint8 *in = &s.animData[s.frame << 2];
-		uint8 op = *in;
-		if (op < 0x80) {
-			incr = anim_99(s, in + 1);
+		a.frame += incr;
+		a.controlFlags &= ~GraphicsEngine::kAnimHide;
+		const uint8 *in = a.scriptData() + (a.frame << 2);
+		uint8 opcode = *in++;
+		if (opcode & 0x80) {
+			opcode -= 0x80;
+			debug("%s(): anim: %d, opcode %d", __FUNCTION__, &a - _animations, opcode);
+			assert(opcode < _animProcs.size());
+			if (_animProcs[opcode]->isValid())
+				incr = (*_animProcs[opcode])(a, in);
+			else
+				error("%s(): Invalid opcode %d", __FUNCTION__, opcode);
 		} else {
-			op -= 0x80;
-			assert(op < _animProcs.size());
-			if (_animProcs[op]->isValid())
-				incr = (*_animProcs[op])(s, in + 1);
+			incr = anim_updateFrameDelay(a, in);
 		}
 	}
 }
 
 #define ANM(x) &Renderer_SCD::anim_##x
 void Renderer_SCD::makeAnimFunctions() {
-	typedef int (Renderer_SCD::*AnimFunc)(Sprite&, const uint8*);
+	typedef int (Renderer_SCD::*AnimFunc)(AnimObject&, const uint8*);
 	static const AnimFunc funcTbl[] = {
-		ANM(00),
-		ANM(01),
-		ANM(02),
-		ANM(03),
-		ANM(04),
-		ANM(05),
+		ANM(remove),
+		ANM(setFrame),
+		ANM(seqSetFrame),
+		ANM(rndSeqSetFrame),
+		ANM(setX),
+		ANM(setY),
 		ANM(06),
 		ANM(07),
-		ANM(08),
-		ANM(09),
-		ANM(10),
+		ANM(palEvent),
+		ANM(palReset),
+		ANM(copyCmds),
 		ANM(11),
 		ANM(12),
 		ANM(13),
 		ANM(14),
 		ANM(15),
-		ANM(16),
-		ANM(16),
-		ANM(16),
-		ANM(16),
-		ANM(20),
-		ANM(21),
-		ANM(22),
-		ANM(23),
+		ANM(pause),
+		ANM(pause),
+		ANM(pause),
+		ANM(pause),
+		ANM(resumeAndUnsyncOther),
+		ANM(removeOther),
+		ANM(pauseAndHideOther),
+		ANM(hide),
 		ANM(24),
-		ANM(25),
-		ANM(25),
+		ANM(audioSync),
+		ANM(audioSync),
 		ANM(27),
 		ANM(28),
 		ANM(29),
 		ANM(30),
 		ANM(31),
-		ANM(32),
-		ANM(32),
+		ANM(setDrawFlags),
+		ANM(setDrawFlags),
 		ANM(34),
 		ANM(35),
 		ANM(36),
@@ -1252,7 +1236,7 @@ void Renderer_SCD::makeAnimFunctions() {
 		ANM(41),
 		ANM(42),
 		ANM(43),
-		ANM(44),
+		ANM(allowFrameDrop),
 		ANM(45),
 		ANM(46),
 		ANM(47)
@@ -1263,217 +1247,303 @@ void Renderer_SCD::makeAnimFunctions() {
 }
 #undef ANM
 
-int Renderer_SCD::anim_00(Sprite &s, const uint8 *data) {
-	s.clear();
+uint16 animRand(uint16 a, uint16 b) {
+	return ((b * Util::rngMakeNumber()) >> 16) + a;
+}
+
+int Renderer_SCD::anim_remove(AnimObject &a, const uint8 *data) {
+	a.clear();
 	return -1;
 }
 
-int Renderer_SCD::anim_01(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_setFrame(AnimObject &a, const uint8 *data) {
+	a.frame = *data;
 	return 0;
 }
 
-int Renderer_SCD::anim_02(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_seqSetFrame(AnimObject &a, const uint8 *data) {
+	if (a.frameSeqCounter == *data++) {
+		a.frameSeqCounter = 0;
+		return 1;
+	}
+	++a.frameSeqCounter;
+	a.frame = *++data;
 	return 0;
-//	return 1;
 }
 
-int Renderer_SCD::anim_03(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_rndSeqSetFrame(AnimObject &a, const uint8 *data) {
+	if (a.frameSeqCounter == 0)
+		a.frameSeqCounter = animRand(2, (uint16)data[1] - data[0]) & 0xFF;
+	if (a.frameSeqCounter == data[1]) {
+		a.frameSeqCounter = 0;
+		return 1;
+	}
+	++a.frameSeqCounter;
+	a.frame = data[2];
 	return 0;
-	//	return 1;
 }
 
-int Renderer_SCD::anim_04(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_setX(AnimObject &a, const uint8 *data) {
+	uint16 xdiff = READ_BE_UINT16(data + 1) - (a.posX >> 16);
+	a.frameDelay = -1;
+	anim_setGroupParameter(a, 0, xdiff);
 	return 1;
 }
 
-int Renderer_SCD::anim_05(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_setY(AnimObject &a, const uint8 *data) {
+	uint16 ydiff = READ_BE_UINT16(data + 1) - (a.posY >> 16);
+	a.frameDelay = -1;
+	anim_setGroupParameter(a, 1, ydiff);
 	return 1;
 }
 
-int Renderer_SCD::anim_06(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_06(AnimObject &a, const uint8 *data) {
+	a.speedXa = (READ_BE_UINT16(data + 1) << 16) | (*data << 8);
+	anim_setGroupParameter(a, 2);
 	return 1;
 }
 
-int Renderer_SCD::anim_07(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_07(AnimObject &a, const uint8 *data) {
+	a.speedYa = (READ_BE_UINT16(data + 1) << 16) | (*data << 8);
+	anim_setGroupParameter(a, 3);
 	return 1;
 }
 
-int Renderer_SCD::anim_08(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_palEvent(AnimObject &a, const uint8 *data) {
+	if (_gfxState.getVar(2))
+		return 1;
+	ResourcePointer r = a.scriptData + READ_BE_INT16(data + 1);
+	_pal->enqueueEvent(r);
+	_gfxState.setVar(3, 1);
 	return 1;
 }
 
-int Renderer_SCD::anim_09(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_palReset(AnimObject &a, const uint8 *data) {
+	_pal->clearEvents();
 	return 1;
 }
 
-int Renderer_SCD::anim_10(Sprite &s, const uint8 *data) {
-	return 1;
+int Renderer_SCD::anim_copyCmds(AnimObject &a, const uint8 *data) {
+	ResourcePointer r = a.scriptData + READ_BE_INT16(data + 1);
+	return enqueueCopyCommands(r) ? 1 : -1;
 }
 
-int Renderer_SCD::anim_11(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_11(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_12(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_12(AnimObject &a, const uint8 *data) {
+	_scroll->doCommand(1);
+	_scroll->setSingleStep(*data ? ScrollManager::kHorzB : ScrollManager::kHorzA, READ_BE_INT16(data + 1));
 	return 1;
 }
 
-int Renderer_SCD::anim_13(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_13(AnimObject &a, const uint8 *data) {
+	_scroll->doCommand(1);
+	_scroll->setSingleStep(*data ? ScrollManager::kVertB : ScrollManager::kVertA, READ_BE_INT16(data + 1));
 	return 1;
 }
 
-int Renderer_SCD::anim_14(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_14(AnimObject &a, const uint8 *data) {
+	_scroll->doCommand(2);
+	_scroll->setDirectionAndSpeed(*data ? ScrollManager::kHorzB : ScrollManager::kHorzA, READ_BE_INT16(data + 1));
 	return 1;
 }
 
-int Renderer_SCD::anim_15(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_15(AnimObject &a, const uint8 *data) {
+	_scroll->doCommand(2);
+	_scroll->setDirectionAndSpeed(*data ? ScrollManager::kVertB : ScrollManager::kVertA, READ_BE_INT16(data + 1));
 	return 1;
 }
 
-int Renderer_SCD::anim_16(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_pause(AnimObject &a, const uint8 *data) {
+	anim_setGroupParameter(a, 5);
 	return 1;
 }
 
-int Renderer_SCD::anim_20(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_resumeAndUnsyncOther(AnimObject &a, const uint8 *data) {
+	assert(*data < 64);
+	anim_setGroupParameter(_animations[*data], 4);
 	return 1;
 }
 
-int Renderer_SCD::anim_21(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_removeOther(AnimObject &a, const uint8 *data) {
+	assert(*data < 64);
+	_animations[*data].clear();
 	return 1;
 }
 
-int Renderer_SCD::anim_22(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_pauseAndHideOther(AnimObject &a, const uint8 *data) {
+	assert(*data < 64);
+	_animations[*data].controlFlags = GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide;
 	return 1;
 }
 
-int Renderer_SCD::anim_23(Sprite &s, const uint8 *data) {
-	//pl
-	return -1;
+int Renderer_SCD::anim_hide(AnimObject &a, const uint8 *data) {
+	a.controlFlags |= GraphicsEngine::kAnimHide;
+	return anim_updateFrameDelay(a, data);
 }
 
-int Renderer_SCD::anim_24(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_24(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_25(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_audioSync(AnimObject &a, const uint8 *data) {
+	a.timeStamp = data[0] << 24 | data[1] << 16 | data[2] << 8;
+	a.controlFlags |= GraphicsEngine::kAnimAudioSync;
 	return 1;
 }
 
-int Renderer_SCD::anim_27(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_27(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_28(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_28(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_29(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_29(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_30(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_30(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_31(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_31(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_32(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_setDrawFlags(AnimObject &a, const uint8 *data) {
+	a.drawFlags = READ_BE_UINT16(data + 1);
 	return 1;
 }
 
-int Renderer_SCD::anim_34(Sprite &s, const uint8 *data) {
-	return 1;
-	//return -1;
+int Renderer_SCD::anim_34(AnimObject &a, const uint8 *data) {
+	a.f4f = 0;
+	if (_gfxState.getVar(8) == 0)
+		return 1;
+	a.f4f = 1;
+	return -1;
 }
 
-int Renderer_SCD::anim_35(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_35(AnimObject &a, const uint8 *data) {
+	_gfxState.setVar(5, 1);
 	return 1;
 }
 
-int Renderer_SCD::anim_36(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_36(AnimObject &a, const uint8 *data) {
+	_gfxState.setFlag(1, 0);
 	return 1;
 }
 
-int Renderer_SCD::anim_37(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_37(AnimObject &a, const uint8 *data) {
+	static const uint8 cmd[] = { 0x25, 0x00 };
+	ResourcePointer r(data, 0);
+	enqueueCopyCommands(r);
 	return 1;
 }
 
-int Renderer_SCD::anim_38(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_38(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_39(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_39(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_40(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_40(AnimObject &a, const uint8 *data) {
+	//gfxDoCommand_D0(*data);
 	return 1;
 }
 
-int Renderer_SCD::anim_41(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_41(AnimObject &a, const uint8 *data) {
 	return 1;
 	//return -1;
 }
 
-int Renderer_SCD::anim_42(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_42(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_43(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_43(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_44(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_allowFrameDrop(AnimObject &a, const uint8 *data) {
+	a.allowFrameDrop = 1;
 	return 1;
 }
 
-int Renderer_SCD::anim_45(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_45(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_46(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_46(AnimObject &a, const uint8 *data) {
+	_gfxState.setFlag(1, 1);
 	return 1;
 }
 
-int Renderer_SCD::anim_47(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_47(AnimObject &a, const uint8 *data) {
+	a.f1c = *data;
 	return 1;
 }
 
-uint16 _rand_o_1 = 0;
-uint16 _rand_o_2 = 0;
-
-uint16 arand() {
-	_rand_o_1 += ((_rand_o_1 & 0xFF) << 8);
-	_rand_o_1 += _rand_o_2;
-	_rand_o_1 += ((_rand_o_2 << 8) | (_rand_o_2 >> 8));
-	if ((_rand_o_2 & 0xFF) + (_rand_o_2 >> 8) > 0xFF)
-		_rand_o_1++;
-	_rand_o_2 = (((_rand_o_2 & 0xFF) + (_rand_o_2 >> 8)) & 0xFF) | (_rand_o_2 & 0xFF00);
-	if (_rand_o_2 + 1 > 0xFFFF);
-		_rand_o_1++;
-	_rand_o_2++;
-	return _rand_o_1;
-}
-
-int16 subai(int16 a, int16 b) {
-	return ((b * arand()) >> 16) + a;
-}
-
-int Renderer_SCD::anim_99(Sprite &s, const uint8 *data) {
+int Renderer_SCD::anim_updateFrameDelay(AnimObject &a, const uint8 *data) {
 	if (*data++) {
-		int d3 = *data++;
-		int d4 = *data++ - d3;
-		s.f2a = subai(d3, d4);
+		uint16 v1 = *data++;
+		uint16 v2 = *data - v1;
+		a.frameDelay = animRand(v1, v2);
 	} else {
-		s.f2a = READ_BE_INT16(data);
+		a.frameDelay = READ_BE_INT16(data);
 	}
+	debug("%s(): anim: %d, setting delay %d", __FUNCTION__,  &a - _animations, a.frameDelay);
 	return -1;
 }
 
-Renderer *Renderer::createSegaRenderer(GraphicsEngine::State &state) {
-	return new Renderer_SCD(state);
+void Renderer_SCD::anim_setGroupParameter(AnimObject &a, int para, uint16 val, bool recursive) {
+	AnimObject *ta = &a;
+	for (int n = ta->children; n || !recursive; n = recursive ? ta->next : 0) {
+		if (recursive)
+			ta = &_animations[n];
+		switch (para) {
+		case 0:
+			ta->posX += (val << 16);
+			break;
+		case 1:
+			ta->posY += (val << 16);
+			break;
+		case 2:
+			a.speedX = a.speedXa;
+			if (ta->parent)
+				a.speedX += _animations[ta->parent].speedX;
+			break;
+		case 3:
+			a.speedY = a.speedYa;
+			if (ta->parent)
+				a.speedY += _animations[ta->parent].speedY;
+			break;
+		case 4:
+			ta->controlFlags &= GraphicsEngine::kAnimHide;
+			break;
+		case 5:
+			ta->controlFlags |= GraphicsEngine::kAnimPause;
+			break;
+		case 6:
+			ta->controlFlags = GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide;
+			break;
+		default:
+			error("%s(): unhandled para %d", __FUNCTION__, para);
+			break;
+
+		}
+		recursive = true;
+		anim_setGroupParameter(*ta, para, val, true);
+	}
+}
+
+Renderer *Renderer::createSegaRenderer(GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr) {
+	return new Renderer_SCD(state, pal, scr);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index 22b0c174576..951c639e41f 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -108,77 +108,15 @@ SceneModule::SceneModule(SnatcherEngine *vm, FIO *fio, const char *resFile, int
 	assert(!_resFile.empty());
 	_data = _fio->fileData(_resFile, &_dataSize);
 	_updateHandler = _shList[_resIndex] ? (_shList[_resIndex])(_vm, this, _fio) : 0;
-
-	/*Common::SeekableReadStreamEndian *s = _fio->readStreamEndian(_resFile);
-	if (!s)
-		error("SceneResource::loadData(): Failed to load file '%s', _resFile");
-	_data = _fio->*/
-
-	//s->skip(4);
-
-	/*uint32 tableStart = s->readUint32();
-	assert(tableStart > 0x28000);
-	tableStart -= 0x28000;
-	s->seek(tableStart);
-
-	uint16 dataStart = 0xFFFF;
-	uint16 pos = 0;
-	while (pos < dataStart) {
-		uint16 val = s->readUint16();
-		if (val < pos || (val + tableStart) >= s->size())
-			break;
-		pos += 2;
-		dataStart = MIN<int>(val, dataStart);
-	}
-	_tableSize = pos >> 1;
-	_table = new const uint8*[_tableSize];
-	*/
-	/*for (int i = 0; i < _tableSize; ++i) {
-		s->seek(tableStart + (i << 1));
-		s->seek(tableStart + s->readUint16());
-
-		int32 cmdStart = s->pos();
-
-		for (bool checkLen = (s->readSByte() >= 0); checkLen; checkLen = (s->readSByte() >= 0))
-			s->skip(s->readByte());
-
-		uint32 size = s->pos() - cmdStart + 1;
-		uint8 *data = new uint8[size];
-
-		s->seek(cmdStart);
-		s->read(data, size);
-		_table[i] = data;
-	}*/
-
-	//delete s;
 }
 
 SceneModule::~SceneModule() {
-	/*if (_table) {
-		for (uint16 i = 0; i < _tableSize; ++i)
-			delete _table[i];
-		delete[] _table;
-		_table = 0;
-		_tableSize = 0;
-	}*/
-
 	delete[] _data;
 	delete _updateHandler;
 }
 
-const uint8 *SceneModule::getData(int offset) const {
-	assert(offset >= 0x28000);
-	return _data + offset - 0x28000;
-}
-
-/*const uint8 *SceneModule::getDataFromMainTable(int tableEntry) const {
-	return getDataFromTable(READ_BE_UINT32(getData(0x28004)), tableEntry);
-}*/
-
 ResourcePointer SceneModule::getPtr(int offset) const {
-	if (offset > 0x28000)
-		offset -= 0x28000;
-	return ResourcePointer(getData(0x28000), offset);
+	return ResourcePointer(_data, offset);
 }
 
 void SceneModule::run(GameState &state) {
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index bfb888a2c52..38c01833a95 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -62,18 +62,30 @@ protected:
 };
 
 struct ResourcePointer {
-	ResourcePointer() : dataStart(0), offset(0) {}
-	ResourcePointer(const uint8 *data, uint32 offs) : dataStart(data), offset(offs >= 0x28000 ? offs - 0x28000 : offs) {}
+	ResourcePointer() : dataStart(0), offset(0), startAddr(0x28000) {}
+	ResourcePointer(const uint8 *data, uint32 offs) : dataStart(data), offset(offs), startAddr(0x28000) { if (offset >= startAddr) offset -= startAddr; }
 	const uint8 *dataStart;
 	uint32 offset;
+	uint32 startAddr;
 	const uint8 *operator()() const { return dataStart + offset; }
 	const uint8 *operator++(int) { return dataStart + (offset++); }
 	const uint8 *operator++() { return dataStart + (++offset); }
-	const uint8 *operator+(int inc) const { return dataStart + offset + inc; }
+	uint16 readUINT16() { return READ_BE_UINT16(dataStart + offset); }
+	uint16 readSINT16() { return READ_BE_INT16(dataStart + offset); }
+	uint32 readUINT32() { return READ_BE_UINT32(dataStart + offset); }
+	uint32 readSINT32() { return READ_BE_INT32(dataStart + offset); }
+	uint16 readIncrUINT16() { uint16 r = READ_BE_UINT16(dataStart + offset); offset += 2; return r; }
+	uint16 readIncrSINT16() { int16 r = READ_BE_INT16(dataStart + offset); offset += 2; return r; }
+	uint32 readIncrUINT32() { uint32 r = READ_BE_UINT32(dataStart + offset); offset += 4; return r; }
+	uint32 readIncrSINT32() { int32 r = READ_BE_INT32(dataStart + offset); offset += 4; return r; }
+	ResourcePointer operator+(int inc) const { return ResourcePointer(dataStart, offset + startAddr + inc); }
+	bool operator<(const ResourcePointer &ptr) const { assert(dataStart == ptr.dataStart); return offset < ptr.offset; }
+	bool operator>(const ResourcePointer &ptr) const { assert(dataStart == ptr.dataStart); return offset > ptr.offset; }
+	bool operator==(const ResourcePointer &ptr) const { return dataStart == ptr.dataStart && offset == ptr.offset; }
 	void operator+=(int inc) { offset += inc; }
 	void operator=(const uint8 *ptr) { offset = ptr - dataStart; }
 	uint8 operator[](int index) const { return dataStart[offset + index]; }
-	ResourcePointer getDataFromTable(int tableEntry) const { return ResourcePointer(dataStart, offset + READ_BE_UINT16(dataStart + offset + (tableEntry << 1))); }
+	ResourcePointer getDataFromTable(int tableEntry) const { return ResourcePointer(dataStart, offset + startAddr + READ_BE_UINT16(dataStart + offset + (tableEntry << 1))); }
 	ResourcePointer makeAbsPtr(uint32 offs) const { return ResourcePointer(dataStart, offs); }
 };
 
@@ -82,7 +94,6 @@ class SceneModule {
 public:
 	~SceneModule();
 
-	const uint8 *getData(int offset) const;
 	ResourcePointer getPtr(int offset) const;
 
 	void run(GameState &state);
@@ -92,9 +103,6 @@ private:
 
 	const uint8 *_data;
 	uint32 _dataSize;
-	//const uint8 **_table;
-	//uint16 _tableSize;
-
 	SnatcherEngine *_vm;
 	FIO *_fio;
 	const int _resIndex;
diff --git a/engines/snatcher/scene/scene_d0.cpp b/engines/snatcher/scene/scene_d0.cpp
index 12cc769234c..9677bf2e939 100644
--- a/engines/snatcher/scene/scene_d0.cpp
+++ b/engines/snatcher/scene/scene_d0.cpp
@@ -102,7 +102,7 @@ SH_IMP_CTOR(D0) {
 	SH_CTOR_MAKEPROCS(D0);
 
 	uint32 *t = new uint32[35];
-	const uint8 *in = _module->getData(0x2A85C);
+	const uint8 *in = _module->getPtr(0x2A85C)();
 	for (int i = 0; i < 35; ++i) {
 		t[i] = READ_BE_UINT32(in);
 		in += 6;
@@ -139,7 +139,7 @@ SH_IMPL_UPDT(D0) {
 }
 
 SH_IMPL_FRM(D0, 00) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 0);
 }
 
@@ -164,12 +164,12 @@ SH_IMPL_FRM(D0, 04) {
 }
 
 SH_IMPL_FRM(D0, 05) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 1);
 }
 
 SH_IMPL_FRM(D0, 07) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 2);
 }
 
@@ -178,7 +178,7 @@ SH_IMPL_FRM(D0, 08) {
 }
 
 SH_IMPL_FRM(D0, 09) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 3);
 }
 
@@ -187,62 +187,62 @@ SH_IMPL_FRM(D0, 10) {
 }
 
 SH_IMPL_FRM(D0, 11) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 4);
 }
 
 SH_IMPL_FRM(D0, 12) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 5);
 }
 
 SH_IMPL_FRM(D0, 14) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 6);
 }
 
 SH_IMPL_FRM(D0, 16) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 7);
 }
 
 SH_IMPL_FRM(D0, 18) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 8);
 }
 
 SH_IMPL_FRM(D0, 20) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 9);
 }
 
 SH_IMPL_FRM(D0, 22) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 10);
 }
 
 SH_IMPL_FRM(D0, 24) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 11);
 }
 
 SH_IMPL_FRM(D0, 26) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 12);
 }
 
 SH_IMPL_FRM(D0, 28) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 13);
 }
 
 SH_IMPL_FRM(D0, 30) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 14);
 }
 
 SH_IMPL_FRM(D0, 31) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 15);
 }
 
@@ -253,7 +253,7 @@ SH_IMPL_FRM(D0, 32) {
 SH_IMPL_FRM(D0, 34) {
 	state.finish = 1;
 	state.frameNo = 0;
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/scene/scene_d1.cpp b/engines/snatcher/scene/scene_d1.cpp
index e247a4911ed..00fd62c9dfd 100644
--- a/engines/snatcher/scene/scene_d1.cpp
+++ b/engines/snatcher/scene/scene_d1.cpp
@@ -92,7 +92,7 @@ SH_IMP_CTOR(D1) {
 	SH_CTOR_MAKEPROCS(D1);
 
 	uint32 *t = new uint32[29];
-	const uint8 *in = _module->getData(0x2929A);
+	const uint8 *in = _module->getPtr(0x2929A)();
 	for (int i = 0; i < 29; ++i) {
 		t[i] = READ_BE_UINT32(in);
 		in += 6;
@@ -142,28 +142,28 @@ SH_IMPL_FRM(D1, 02) {
 
 SH_IMPL_FRM(D1, 04) {
 	_vm->gfx()->runScript(_module->getPtr(0), 2);
-	//_cmdState.word1C = 0x110;
-	_vm->gfx()->doCommand(1);
+	_vm->gfx()->setScrollStep(GraphicsEngine::kVertA | GraphicsEngine::kSingleStep, 0x110);
+	_vm->gfx()->scrollCommand(1);
 }
 
 SH_IMPL_FRM(D1, 05) {
-	_vm->gfx()->doCommand(8);
+	_vm->gfx()->scrollCommand(8);
 }
 
 SH_IMPL_FRM(D1, 06) {
-	_vm->gfx()->doCommand(9);
+	_vm->gfx()->scrollCommand(9);
 }
 
 SH_IMPL_FRM(D1, 07) {
-	_vm->gfx()->doCommand(10);
+	_vm->gfx()->scrollCommand(10);
 }
 
 SH_IMPL_FRM(D1, 08) {
-	_vm->gfx()->doCommand(11);
+	_vm->gfx()->scrollCommand(11);
 }
 
 SH_IMPL_FRM(D1, 09) {
-	_vm->gfx()->doCommand(12);
+	_vm->gfx()->scrollCommand(12);
 }
 
 SH_IMPL_FRM(D1, 11) {
@@ -209,7 +209,7 @@ SH_IMPL_FRM(D1, 27) {
 SH_IMPL_FRM(D1, 28) {
 	state.finish = 1;
 	state.frameNo = 0;
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene/scene_d2.cpp
index 1ea7eff73a7..32b8e994858 100644
--- a/engines/snatcher/scene/scene_d2.cpp
+++ b/engines/snatcher/scene/scene_d2.cpp
@@ -79,15 +79,12 @@ SH_IMPL_UPDT(D2) {
 
 bool hasRAMCart = true; 
 int _state_ua_1 = 0;
-bool hasSaveFiles = false;
+bool hasSaveFiles = true;
 bool hasFreeBuram = true;
-uint8 _bua1 = 0;
-uint8 _bua2 = 0;
 uint8 _bua3 = 0;
 uint8 _buram_0 = 0;
 bool _buram_2 = true;
 uint8 wordA = 0;
-uint8 wordB = 0;
 int16 _moduleWord = -1;
 
 // functions
@@ -105,14 +102,14 @@ SH_IMPL_FRM(D2, 00) {
 			++state.frameNo;
 			state.frameState = 0;
 		} else {
-			_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+			_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 			_vm->gfx()->runScript(_module->getPtr(0), 1); // RAM Cart select screen
 			++state.frameState;
 		}
 		break;
 	case 2:
 		if (_vm->_commandsFromMain & 3) {
-			_bua2 &= 2;
+			_vm->gfx()->clearAnimControlFlags(16, ~GraphicsEngine::kAnimHide);
 			_buram_0 ^= 1;
 		}
 		if (_vm->_commandsFromMain & 0x80) {
@@ -143,9 +140,9 @@ SH_IMPL_FRM(D2, 01) {
 }
 
 SH_IMPL_FRM(D2, 02) {
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
-	_vm->gfx()->doCommand(1);
-	//__unk_8F1C = 0x100;
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
+	_vm->gfx()->scrollCommand(1);
+	_vm->gfx()->setScrollStep(GraphicsEngine::kVertA | GraphicsEngine::kSingleStep, 0x100);
 	_vm->gfx()->runScript(_module->getPtr(0), 0);
 	state.counter = 24;
 	++state.frameNo;
@@ -155,7 +152,7 @@ SH_IMPL_FRM(D2, 02) {
 SH_IMPL_FRM(D2, 03) {
 	if (--state.counter)
 		return;
-	_vm->gfx()->doCommand(7);
+	_vm->gfx()->scrollCommand(7);
 	state.counter = 4;
 	++state.frameNo;
 	state.frameState = 0;
@@ -192,7 +189,7 @@ SH_IMPL_FRM(D2, 06) {
 	case 1:
 		if (--state.counter)
 			return;
-		_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+		_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 		_vm->gfx()->runScript(_module->getPtr(0), 2);
 		++state.frameState;
 		break;
@@ -237,7 +234,7 @@ SH_IMPL_FRM(D2, 08) {
 	case 2:
 		if (--state.counter)
 			return;
-		_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+		_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 		_vm->gfx()->runScript(_module->getPtr(0), 3);
 		++state.frameState;
 		break;
@@ -249,20 +246,19 @@ SH_IMPL_FRM(D2, 08) {
 }
 
 SH_IMPL_FRM(D2, 09) {
-	uint8 &b = hasSaveFiles ? _bua1 : _bua2;
 	switch (state.frameState) {
 	case 0:
-		_vm->gfx()->doCommand(0xFF);
+		_vm->gfx()->scrollCommand(0xFF);
+		_vm->gfx()->clearAnimControlFlags(hasSaveFiles ? 17 : 16, ~GraphicsEngine::kAnimHide);
 		state.frameState += (hasSaveFiles ? 1 : 2);
-		b &= 2;
 		break;
 	case 1:
 		if (_vm->_commandsFromMain & 3)
-			_bua2 &= 2;
+			_vm->gfx()->clearAnimControlFlags(17, ~GraphicsEngine::kAnimHide);
 		if (_vm->_commandsFromMain & 0x80) {
-			_bua1 = 3;
+			_vm->gfx()->setAnimControlFlags(17, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 			wordA = 1;
-			if (wordB == 3) {
+			if (_vm->gfx()->getAnimCurFrame(17) == 3) {
 				wordA = 0;
 				++state.frameNo;
 			}
@@ -270,7 +266,8 @@ SH_IMPL_FRM(D2, 09) {
 			state.frameState = 0;
 			_bua3 = 56;
 			//enqueueCommunicationStatus2Command(0);
-			_bua2 = _bua1 = 3;
+			_vm->gfx()->setAnimControlFlags(16, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+			_vm->gfx()->setAnimControlFlags(17, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 			_moduleWord = 0;
 		}
 		break;
@@ -296,6 +293,16 @@ SH_IMPL_FRM(D2, 10) {
 			++state.counter;
 			return;
 		}
+		_vm->gfx()->clearAnimControlFlags(24, 0xFF);
+		_vm->gfx()->clearAnimControlFlags(25, 0xFF);
+
+
+
+		_vm->gfx()->setAnimControlFlags(24, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+		_vm->gfx()->setAnimControlFlags(25, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+		++state.frameState;
+		state.counter = 0;
+
 		++state.frameNo;
 		state.frameState = 0;
 		break;
@@ -315,6 +322,12 @@ SH_IMPL_FRM(D2, 10) {
 		}
 		break;
 	case 2:
+		if (--state.counter)
+			return;
+		--state.frameNo;
+		state.frameState = 1;
+		_vm->gfx()->setAnimControlFlags(17, GraphicsEngine::kAnimPause);
+		_vm->gfx()->setAnimFrame(17, 0);
 		break;
 	case 3:
 		break;
@@ -348,7 +361,7 @@ SH_IMPL_FRM(D2, 11) {
 	case 1:
 		if (--state.counter)
 			return;
-		_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+		_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 		_vm->gfx()->runScript(_module->getPtr(0), 7);
 		++state.frameState;
 		break;
@@ -396,7 +409,7 @@ SH_IMPL_FRM(D2, 11) {
 	case 4:
 		if (--state.counter)
 			return;
-		_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+		_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 		_vm->gfx()->runScript(_module->getPtr(0), 8);
 		state.frameState = 0;
 		break;
@@ -411,7 +424,7 @@ SH_IMPL_FRM(D2, 12) {
 	state.finish = 1;
 	state.frameNo = 0;
 	state.frameState = 0;
-	_vm->gfx()->reset(GraphicsEngine::kRestoreDefaultsExt);
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/scroll.h b/engines/snatcher/scroll.h
new file mode 100644
index 00000000000..e7131e1eae5
--- /dev/null
+++ b/engines/snatcher/scroll.h
@@ -0,0 +1,87 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_SCROLL_H
+#define SNATCHER_SCROLL_H
+
+//#include "common/platform.h"
+//#include "snatcher/graphics.h"
+//#include "snatcher/resource.h"
+#include "common/scummsys.h"
+
+namespace Snatcher {
+
+class ScrollManager {
+public:
+	enum {
+		kHorzA = 0,
+		kVertA = 1,
+		kHorzB = 2,
+		kVertB = 3
+	};
+
+	struct ScrollState {
+		int16 offsets[4];
+		const int16 *hScrollTable;
+		uint16 hScrollTableNumEntries;
+		bool disableVScroll;
+		bool lineScrollMode;
+		bool hINTEnable;
+		int hINTCounter;
+		void *hINTProc;
+	};
+
+	ScrollManager() {
+		memset(&_result, 0, sizeof(_result));
+	}
+
+	virtual ~ScrollManager() {}
+	virtual void doCommand(int cmd) = 0;
+	virtual void setSingleStep(int mode, int16 step) = 0;
+	virtual void setDirectionAndSpeed(int mode, int16 incr) = 0;
+	virtual void clear() = 0;
+	virtual bool nextFrame() = 0;
+
+	const ScrollState &getState() const {
+		return _result;
+	}
+
+protected:
+	ScrollState _result;
+
+private:
+	static ScrollManager *createSegaScrollManager(GraphicsEngine::GfxState &state);
+
+public:
+	static ScrollManager *create(Common::Platform platform, GraphicsEngine::GfxState &state) {
+		switch (platform) {
+		case Common::kPlatformSegaCD:
+			return createSegaScrollManager(state);
+		default:
+			break;
+		};
+		return 0;
+	}
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_RENDER_H
diff --git a/engines/snatcher/scroll_scd.cpp b/engines/snatcher/scroll_scd.cpp
new file mode 100644
index 00000000000..4f632a71ef5
--- /dev/null
+++ b/engines/snatcher/scroll_scd.cpp
@@ -0,0 +1,531 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#include "snatcher/graphics.h"
+#include "snatcher/scroll.h"
+
+namespace Snatcher {
+
+class ScrollInternalState {
+public:
+	ScrollInternalState() : _offsSingle(0), _offsRep(0), _curPos(0), _curResult(0), _factor(1) {}
+
+	void singleStep(int16 step) {
+		_offsSingle = step << 16;
+	}
+
+	void setDirectionAndSpeed(int16 incr) {
+		_offsRep = incr << 16;
+	}
+
+	void setFactor(int16 factor) {
+		_factor = factor;
+	}
+
+	void clear() {
+		_offsSingle = 0;
+		_offsRep = 0;
+		_curPos = 0;
+		_curResult = 0;
+	}
+
+	bool recalc(bool singleStepABS) {
+		_curPos = singleStepABS ? _offsSingle : _offsSingle + _curPos;
+		_offsSingle = 0;
+		int32 t = (_offsRep >> 16);
+		_curPos += (t << 8);
+		int16 r = _curPos >> 16;
+		bool changed = (_curResult != r);
+		_curResult = r;
+		return changed;
+	}
+
+	int16 getOffset() const {
+		return _curResult * _factor;
+	}
+
+private:
+	int32 _offsSingle;
+	int32 _offsRep;
+	int32 _curPos;
+	int16 _curResult;
+	int16 _factor;
+};
+
+class ScrollManager_SCD : public ScrollManager {
+public:
+	enum {
+		kHorzA = 0,
+		kVertA = 1,
+		kHorzB = 2,
+		kVertB = 3
+	};
+
+	ScrollManager_SCD(GraphicsEngine::GfxState &state);
+	~ScrollManager_SCD() override;
+
+	void doCommand(int cmd) override;
+
+	void setSingleStep(int mode, int16 step) override {
+		assert(mode < 4);
+		_internalState[mode].singleStep(step);
+	}
+
+	void setDirectionAndSpeed(int mode, int16 incr) override {
+		assert(mode < 4);
+		_internalState[mode].setDirectionAndSpeed(incr);
+	}
+
+	void clear() override;
+	bool nextFrame() override;
+
+private:
+	bool processCmdInternal();
+	void startTransition();
+
+	GraphicsEngine::GfxState &_gfxState;
+	ScrollInternalState *_internalState;
+	int16 *_hScrollTable;
+	uint16 _hScrollTableLen;
+
+	uint8 _scrollType;
+	uint8 _scrollCommandExt;
+	uint8 _scrollCommand;
+	uint8 _resetCommand;
+
+	uint8 _nextStep;
+	uint8 _lastStep;
+	uint8 _scrollCmd_0xff_0xfd_0xfc_or0to6_last;
+	uint8 _nextStepExt;
+	uint8 _lastStepExt;
+	int16 _lastVScrollOffset;
+	int16 _lastHScrollOffset;
+	int16 _scrollFlagttt;
+	int16 _scrollu_7;
+	int16 _hint_proc;
+	int16 _transitionType;
+	int16 _transitionState;
+	int16 _scrollu_5;
+	int16 _subPara;
+	uint32 _scroll__DA;
+	uint16 _scroll__DB;
+	bool _needRefresh;
+
+private:
+	typedef Common::Functor1Mem<int, void, ScrollManager_SCD> ScrollFunc;
+	Common::Array<ScrollFunc*> _scrollProcs;
+
+	void makeFunctions();
+	void doCommandIntern(int cmd, int arg);
+
+	void scrUpdt_dummy(int arg);
+	void scrUpdt_setHScrollFullScreen(int arg);
+	void scrUpdt_03(int arg);
+	void scrUpdt_04(int arg);
+	void scrUpdt_05(int arg);
+	void scrUpdt_06(int arg);
+	void scrUpdt_07(int arg);
+	void scrUpdt_08(int arg);
+	void scrUpdt_13(int arg);
+	void scrUpdt_14(int arg);
+	void scrUpdt_15(int arg);
+	void scrUpdt_16(int arg);
+	void scrUpdt_17(int arg);
+	void scrUpdt_18(int arg);
+	void scrUpdt_19(int arg);
+	void scrUpdt_20(int arg);
+	void scrUpdt_21(int arg);
+	void scrUpdt_22(int arg);
+	void scrUpdt_23(int arg);
+	void scrUpdt_24(int arg);
+	void scrUpdt_25(int arg);
+	void scrUpdt_26(int arg);
+	void scrUpdt_27(int arg);
+	void scrUpdt_28(int arg);
+	void scrUpdt_29(int arg);
+};
+
+
+ScrollManager_SCD::ScrollManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0), _hint_proc(0),
+	_scrollCommandExt(0), _scrollCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _scroll__DA(0), _scroll__DB(0), _scrollCmd_0xff_0xfd_0xfc_or0to6_last(0),
+	_lastVScrollOffset(0), _scrollFlagttt(0), _scrollu_7(0), _transitionType(0), _transitionState(0), _scrollu_5(0), _subPara(0), _lastHScrollOffset(0), _needRefresh(false) {
+	_internalState = new ScrollInternalState[4];
+	assert(_internalState);
+	_internalState[kVertA].setFactor(-1);
+	_internalState[kVertB].setFactor(-1);
+	_hScrollTable = new int16[0x200]();
+	assert(_hScrollTable);
+	makeFunctions();
+}
+
+ScrollManager_SCD::~ScrollManager_SCD() {
+	delete[] _internalState;
+	delete[] _hScrollTable;
+	for (uint i = 0; i < _scrollProcs.size(); ++i) \
+		delete _scrollProcs[i];
+}
+
+void ScrollManager_SCD::doCommand(int cmd) {
+	_gfxState.setVar(3, 1);
+
+	if (cmd == 0xFF || cmd == 0xFC) {
+		clear();
+		_resetCommand = cmd;
+	} else {
+		if (cmd >= 7 && cmd != 0xFD) {
+			_scrollCommandExt = cmd;
+		} else {
+			_scrollCommand = cmd;
+			_scrollType = (cmd < 3) ? cmd | ((cmd & 1) << 4) : 0;
+		}
+	}
+}
+
+void ScrollManager_SCD::clear() {
+	for (int i = 0; i < 4; ++i) 
+		_internalState[i].clear();
+	memset(&_result, 0, sizeof(_result));
+	_scrollType = 0;
+	_scrollCommandExt = 0;
+	_scrollCommand = 0;
+	_resetCommand = 0;
+}
+
+bool ScrollManager_SCD::nextFrame() {
+	if (_resetCommand == 0) {
+		if (_scrollCommandExt)
+			_nextStepExt = _scrollCommandExt;
+		if (_scrollCommand)
+			_nextStep = _scrollCommand;
+		_scrollCommandExt = 0;
+	} else {
+		_nextStep = _resetCommand;
+		_resetCommand = 0;
+		_scrollCommandExt = 0;
+		// _wordRAM__TABLE48__09 = 0;
+		// _wordRAM__TABLE48__0A = 0;
+	}
+
+	if (_nextStepExt != _lastStepExt || _lastStepExt == 0) {
+		if (_nextStepExt == 0xFE) {
+			_scrollu_7 = 0;
+			_transitionType = 0;
+			_nextStepExt = 0;
+			if (_lastStepExt == 23) {
+				_lastVScrollOffset = 0;
+				if (_scrollFlagttt) {
+					_scrollFlagttt = 0;
+					_nextStepExt = _lastStepExt = 15;
+				}
+			}
+		} else if (_nextStepExt != 0 && (_nextStepExt != 15 || _lastStepExt != 23)) {
+			_lastStepExt = _nextStepExt;
+			_transitionState = _scrollu_5 = _subPara = 0;
+
+		} else if (_nextStepExt != 0) {
+			_nextStepExt = 23;
+			_scrollFlagttt = 1;
+		}
+	}
+
+	startTransition();
+
+	bool changed = false;
+	bool reset = _nextStep == 0xFF || _nextStep == 0xFC;
+	bool needRefresh = processCmdInternal();
+
+	if (needRefresh && _scrollType != 0 && !reset) {
+		for (int i = 0; i < 4; ++i) {
+			if (_internalState[i].recalc(_scrollType & 0x10))
+				changed = true;
+			_result.offsets[i] = _internalState[i].getOffset();
+		}
+		_result.hScrollTable = _hScrollTable;
+		_result.hScrollTableNumEntries = _hScrollTableLen;
+		_result.disableVScroll = (_scrollCmd_0xff_0xfd_0xfc_or0to6_last != 0);
+		_scrollType &= ~0x10;
+	}
+
+	return changed || reset;
+}
+
+bool ScrollManager_SCD::processCmdInternal() {
+	if ((_nextStep != _lastStep || _lastStep == 0) && _nextStep != 0) {
+		if (_nextStep == 0xFF || _nextStep == 0xFC) {
+			if (_nextStep == 0xFF)
+				_result.hINTEnable = false;
+			_nextStep = _lastStep = 0;
+			_nextStepExt = 0;
+			_transitionType = 0;
+			_transitionState = _scrollu_5 = _subPara = _scrollu_7 = 0;
+			_scrollFlagttt = 0;
+			_scroll__DA = 0;
+			_scroll__DB = 0;
+			_lastHScrollOffset = 0;
+			_lastVScrollOffset = 0;
+			_needRefresh = false;
+			_scrollCmd_0xff_0xfd_0xfc_or0to6_last = 0;
+			_result.lineScrollMode = false;
+			//_scrolloa = 0;
+			//_scrollob = 0;
+			return _needRefresh;
+		} else if (_nextStep == 0xFD) {
+			_scrollCmd_0xff_0xfd_0xfc_or0to6_last |= 0x80;
+		} else {
+			_lastStep = _nextStep;
+			if (_nextStep < 3) {
+				_needRefresh = false;
+				//_scrolloa = 0;
+				//_scrollob = 0;
+			} else {
+				_scroll__DA = 0;
+				_scrollCmd_0xff_0xfd_0xfc_or0to6_last = 0;
+			}
+		}
+	}
+
+	bool b = false;
+	if (_scrollCmd_0xff_0xfd_0xfc_or0to6_last != 0) {
+		if (_scrollCmd_0xff_0xfd_0xfc_or0to6_last & 0x80)
+			b = true;
+		else
+			doCommandIntern(_scrollCmd_0xff_0xfd_0xfc_or0to6_last, 0);
+	}
+
+	if (!b && _nextStep != 0)
+		doCommandIntern(_nextStep, _subPara);
+
+	doCommandIntern(_nextStepExt, _subPara);
+
+	return _needRefresh;
+}
+
+void ScrollManager_SCD::startTransition() {
+	if (_transitionType == 0)
+		return;
+
+	switch (_transitionType) {
+	case 1:
+		_result.hINTCounter = 15;
+		//_result.hINTProc = (void *)_hint_proc7;
+		if (--_transitionState <= 0)
+			return;
+		_result.offsets[kVertA] = _result.offsets[kVertB] = (_transitionState > 1) ? 0x30 : 0x10;
+		break;
+	case 2:
+	case 3:
+	case 4:
+	case 5:
+	case 6:
+		_result.hINTCounter = 7;
+		break;
+	case 7:
+	case 8:
+		break;
+	case 9:
+		break;
+	case 10:
+	case 11:
+		break;
+	case 12:
+	case 13:
+	case 14:
+	case 15:
+	case 16:
+		break;
+	case 17:
+		break;
+	case 18:
+	case 19:
+	case 20:
+	case 21:
+		break;
+	case 22:
+	case 23:
+		break;
+	default:
+		break;
+	}
+	_result.hINTEnable = true;
+}
+
+#define SF(x) &ScrollManager_SCD::scrUpdt_##x
+void ScrollManager_SCD::makeFunctions() {
+	typedef void (ScrollManager_SCD::*ScrFunc)(int);
+	static const ScrFunc funcTbl[] = {
+		SF(dummy),
+		SF(setHScrollFullScreen),
+		SF(setHScrollFullScreen),
+		SF(03),
+		SF(04),
+		SF(05),
+		SF(06),
+		SF(07),
+		SF(08),
+		SF(08),
+		SF(08),
+		SF(08),
+		SF(08),
+		SF(13),
+		SF(14),
+		SF(15),
+		SF(16),
+		SF(17),
+		SF(18),
+		SF(19),
+		SF(20),
+		SF(21),
+		SF(22),
+		SF(23),
+		SF(24),
+		SF(25),
+		SF(26),
+		SF(27),
+		SF(28),
+		SF(29)
+	};
+
+	for (uint i = 0; i < ARRAYSIZE(funcTbl); ++i) \
+		_scrollProcs.push_back(new ScrollFunc(this, funcTbl[i]));
+}
+#undef SF
+
+void ScrollManager_SCD::doCommandIntern(int cmd, int arg) {
+	if (_scrollProcs[cmd]->isValid())
+		(*_scrollProcs[cmd])(arg);
+	else
+		error("%s(): Invalid opcode %d", __FUNCTION__, cmd);
+}
+
+void ScrollManager_SCD::scrUpdt_dummy(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_setHScrollFullScreen(int arg) {
+	_result.lineScrollMode  = false;
+	_needRefresh = true;
+}
+
+void ScrollManager_SCD::scrUpdt_03(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_04(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_05(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_06(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_07(int arg) {
+	if (arg == 0) {
+		_transitionType = 1;
+		_hint_proc = 3278;
+		_transitionState = 5;
+		++_subPara;
+		_nextStep = 0;
+		_lastHScrollOffset = 0;
+		_lastVScrollOffset = 0;
+		_needRefresh = false;
+		//_scrolloa = 0;
+		//_scrollob = 0;
+	} else if (arg == 1) {
+		if (_transitionState < 0) {
+			_nextStep = _lastStep = 0;
+			_nextStepExt = 0;
+			_transitionType = 0;
+			_transitionState = _scrollu_5 = _subPara = _scrollu_7 = 0;
+			_scrollFlagttt = 0;
+			_scroll__DA = 0;
+			_scroll__DB = 0;
+			_lastHScrollOffset = 0;
+			_lastVScrollOffset = 0;
+			_needRefresh = false;
+			_scrollCmd_0xff_0xfd_0xfc_or0to6_last = 0;
+			_result.lineScrollMode = false;
+			//_scrolloa = 0;
+			//_scrollob = 0;
+		}
+	} else {
+		error("%s(): Invalid arg %d", __FUNCTION__, arg);
+	}
+}
+
+void ScrollManager_SCD::scrUpdt_08(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_13(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_14(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_15(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_16(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_17(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_18(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_19(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_20(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_21(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_22(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_23(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_24(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_25(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_26(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_27(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_28(int arg) {
+}
+
+void ScrollManager_SCD::scrUpdt_29(int arg) {
+}
+
+ScrollManager *ScrollManager::createSegaScrollManager(GraphicsEngine::GfxState &state) {
+	return new ScrollManager_SCD(state);
+}
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index ab658a92b16..0269365025a 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -23,6 +23,7 @@
 #include "snatcher/resource.h"
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
+#include "snatcher/util.h"
 
 #include "common/endian.h"
 #include "common/events.h"
@@ -32,7 +33,7 @@
 
 namespace Snatcher {
 
-SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _gfx(nullptr), _snd(nullptr), _commandsFromMain(0) {
+SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _gfx(nullptr), _snd(nullptr), _commandsFromMain(0), _gfxInfo() {
 }
 
 SnatcherEngine::~SnatcherEngine() {
@@ -62,7 +63,7 @@ bool SnatcherEngine::initResource() {
 }
 
 bool SnatcherEngine::initGfx(Common::Platform platform) {
-	if (_gfx = new GraphicsEngine(_system, platform)) {
+	if (_gfx = new GraphicsEngine(_system, platform, _gfxInfo)) {
 		initGraphics(_gfx->screenWidth(), _gfx->screenHeight());
 		return true;
 	}
@@ -74,12 +75,16 @@ bool SnatcherEngine::initSound(Common::Platform platform, int soundOptions) {
 }
 
 bool SnatcherEngine::start() {
+	Util::rngReset();
 	GameState state;
 	memset(&state, 0, sizeof(GameState));
 
-	uint32 frameLen = (1000 << 16) / 60;
+	const uint32 frameLen = (1000 << 16) / 60;
 	uint32 frameTimer = 0;
 
+	int16 countTo5 = 0;
+	int16 runspeed = 0;
+
 	while (!shouldQuit()) {
 		frameTimer += frameLen;
 		uint32 nextFrame = _system->getMillis() + (frameTimer >> 16);
@@ -90,20 +95,41 @@ bool SnatcherEngine::start() {
 		if (runInitSequence(state))
 			continue;
 
-		if (!_gfx->busy()) {
-			//subVintSub_2();
-			bool blockedUpdt = _sub_doMainScript;
-			if (_sub_doMainScript) {
-				//subVint_mainScriptRun__36Cases();
-				blockedUpdt = _gfx->busy();
+		_gfxInfo.audioSync = _snd->musicIsPlaying() ? _snd->musicGetTime() : 0;
+		Util::rngMakeNumber();
+
+		_gfx->setVar(3, 0);
+		_gfx->setVar(10, 0);
+		countTo5 += runspeed;
+		int numLoops = (countTo5 == 5) ? 2 : 1;
+
+		for (int i = 0; i < numLoops; ++i) {
+			if (!_gfx->busy(0)) {
+				//subVintSub_2();
+				bool blockedUpdt = _sub_doMainScript;
+				if (_sub_doMainScript) {
+					//subVint_mainScriptRun__36Cases();
+					blockedUpdt = _gfx->busy(0);
+				}
+				if (!blockedUpdt) {
+					updateModuleState(state);
+					_gfx->updateAnimations();
+				}
 			}
-			if (!blockedUpdt) {
-				updateScene(state);
-				_gfx->updateAnimations();
+
+			if (numLoops == 2) {
+				if (_gfx->busy(1)) {
+					--countTo5;
+					numLoops = 1;
+				} else {
+					countTo5 = 0;
+					_gfx->setVar(10, 1);
+				}
 			}
 		}
 
 		_gfx->nextFrame();
+		updateEvents();
 		delayUntil(nextFrame);
 	}
 
@@ -111,13 +137,11 @@ bool SnatcherEngine::start() {
 }
 
 void SnatcherEngine::delayUntil(uint32 end) {
+	const uint32 frameLen = (1000 << 16) / 60;
 	uint32 cur = _system->getMillis();
-	while (!shouldQuit() && cur < end) {
-		updateEvents();
-		int ms = MIN<int>(end - cur, 4);
-		_system->delayMillis(ms);
-		cur = _system->getMillis();
-	} 
+	_gfxInfo.dropFrames = /*cur > end ? ((cur - end) << 16) / frameLen :*/ 0;
+	if (cur < end)
+		_system->delayMillis(end - cur);
 }
 
 void SnatcherEngine::updateEvents() {
@@ -143,21 +167,18 @@ bool SnatcherEngine::runInitSequence(GameState &gameState) {
 	return true;
 }
 
-void SnatcherEngine::updateScene(GameState &state) {
+void SnatcherEngine::updateModuleState(GameState &state) {
 	int _main_switch_1_0_orM1_postIntr = 0;
 	uint16 _word_unk_Flags = 0;
 	int _word_unk_11 = 0;
 	int _sub_val_2 = 0;
 	int _unlCDREadSeekWord = 0;
-	uint8 _uniobyte_7891 = 0;
+	uint8 _triggerPalFlag7Etc = 0;
 	bool _sub_bool_5 = false;
 
 	uint8 _wordRAM__TABLE48__word_B6400[48];
 	memset(_wordRAM__TABLE48__word_B6400, 0, 48);
 
-	uint16 _word_8F00_table_00[16];
-	memset(_word_8F00_table_00, 0, 16 * sizeof(uint16));
-
 	switch (state.progressMain) {
 	case -1:
 		_snd->musicStop();
@@ -247,14 +268,14 @@ void SnatcherEngine::updateScene(GameState &state) {
 				state.finish = 0;
 				state.counter = 10;
 				++state.progressSub;
-				static byte data[] = { 0x83,  0x0,  0x00, 0x3F };
+				static byte data[] = { 0x83, 0x00, 0x00, 0x3F };
 				_gfx->enqueuePaletteEvent(ResourcePointer(data, 0));
 			} else if (state.finish) {
 				if (state.modIndex == 0) {
 					++state.modIndex;
 					state.finish = 0;
 				}
-				_gfx->reset(GraphicsEngine::kClearSprites);
+				_gfx->reset(GraphicsEngine::kResetSprites);
 				state.progressSub = 0;
 			}
 			break;
@@ -269,7 +290,7 @@ void SnatcherEngine::updateScene(GameState &state) {
 			} else if (state.counter == 0) {
 				state.finish = -1;
 				state.progressSub = 0;
-				_gfx->reset(GraphicsEngine::kRestoreDefaultsExt);
+				_gfx->reset(GraphicsEngine::kResetSetDefaultsExt);
 			}
 			break;
 		default:
@@ -279,9 +300,9 @@ void SnatcherEngine::updateScene(GameState &state) {
 			state.finish = 0;
 			state.progressMain = 7;
 			state.progressSub = 0;
-			//withD0_FF_FD_FC(0xFF);
+			_gfx->scrollCommand(0xFF);
 			_gfx->setVar(9, 1);
-			_gfx->reset(GraphicsEngine::kClearPalEvents | GraphicsEngine::kClearSprites);
+			_gfx->reset(GraphicsEngine::kResetPalEvents | GraphicsEngine::kResetSprites);
 		}
 		break;
 	case 3:
@@ -289,7 +310,7 @@ void SnatcherEngine::updateScene(GameState &state) {
 		state.finish = 0;
 		state.progressMain = 0;
 		state.progressSub = 0;
-		memset(_word_8F00_table_00, 0, 16 * sizeof(uint16));
+		_gfx->reset(GraphicsEngine::kResetScrollState);
 		break;
 	case 5:
 		if (state.finish) {
@@ -301,13 +322,13 @@ void SnatcherEngine::updateScene(GameState &state) {
 	case 6:
 		switch (state.progressSub) {
 		case 0:
-			//if (_s80[31].cmd == 0) {
-				_gfx->reset(GraphicsEngine::kRestoreDefaults | GraphicsEngine::kClearSprites);
-				_uniobyte_7891 = 0xFF;
+			if (!_gfx->isAnimEnabled(31)) {
+				_gfx->reset(GraphicsEngine::kResetSetDefaults | GraphicsEngine::kResetSprites);
+				_triggerPalFlag7Etc = 0xFF;
 				++state.progressSub;
 				state.frameNo = -1;
 				state.frameState = 0;
-			//}
+			}
 			break;
 		case 1:
 			if (!_snd->musicIsPlaying()) {
@@ -372,7 +393,7 @@ void SnatcherEngine::syncSoundSettings() {
 }
 
 void SnatcherEngine::pauseEngineIntern(bool pause) {
-
+	_snd->pause(pause);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index eff8645e308..119539833ce 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -23,7 +23,7 @@
 #define SNATCHER_H
 
 #include "snatcher/detection.h"
-
+#include "snatcher/info.h"
 #include "engines/engine.h"
 
 class SnatcherMetaEngine;
@@ -57,7 +57,7 @@ private:
 	void updateEvents();
 
 	bool runInitSequence(GameState &state);
-	void updateScene(GameState &state);
+	void updateModuleState(GameState &state);
 
 	// ConfigManager sync
 	void registerDefaultSettings();
@@ -76,9 +76,11 @@ private:
 
 	// Graphics
 	GraphicsEngine *_gfx;
+	VMInfo _gfxInfo;
 
 	// Sound
 	SoundEngine *_snd;
+
 public:
 	// Input
 	byte _commandsFromMain;
diff --git a/engines/snatcher/sound.cpp b/engines/snatcher/sound.cpp
index 8901ed3b6ed..0ac86a0b166 100644
--- a/engines/snatcher/sound.cpp
+++ b/engines/snatcher/sound.cpp
@@ -57,6 +57,10 @@ void SoundEngine::pcmDoCommand(int cmd, int arg) {
 	_dev->pcmDoCommand(cmd, arg);
 }
 
+void SoundEngine::pause(bool toggle) {
+	_dev->pause(toggle);
+}
+
 SoundDevice *SoundDevice::create(Common::Platform platform, int soundOptions) {
 	MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(soundOptions);
 	MusicType musicType = MidiDriver::getMusicType(dev);
diff --git a/engines/snatcher/sound.h b/engines/snatcher/sound.h
index c11f531b95a..7f734050875 100644
--- a/engines/snatcher/sound.h
+++ b/engines/snatcher/sound.h
@@ -41,6 +41,8 @@ public:
 	void pcmPlayEffect(int track);
 	void pcmDoCommand(int cmd, int arg);
 
+	void pause(bool toggle);
+
 private:
 	SoundDevice *_dev;
 };
diff --git a/engines/snatcher/sound_device.h b/engines/snatcher/sound_device.h
index bf037ca2ca1..a4ac6e49230 100644
--- a/engines/snatcher/sound_device.h
+++ b/engines/snatcher/sound_device.h
@@ -39,6 +39,8 @@ public:
 	virtual void pcmPlayEffect(int track) = 0;
 	virtual void pcmDoCommand(int cmd, int arg) = 0;
 
+	virtual void pause(bool toggle) = 0;
+
 protected:
 	SoundDevice() : _musicStartTime(0) {}
 
diff --git a/engines/snatcher/sound_device_null.cpp b/engines/snatcher/sound_device_null.cpp
index 3d6e21808ac..7a19545be4b 100644
--- a/engines/snatcher/sound_device_null.cpp
+++ b/engines/snatcher/sound_device_null.cpp
@@ -37,6 +37,8 @@ public:
 
 	void pcmPlayEffect(int track) override;
 	void pcmDoCommand(int cmd, int arg) override;
+
+	void pause(bool toggle) override;
 private:
 	bool _playing;
 };
@@ -56,6 +58,10 @@ void NullSoundDevice::pcmPlayEffect(int track) {
 void NullSoundDevice::pcmDoCommand(int cmd, int arg) {
 }
 
+void NullSoundDevice::pause(bool toggle) {
+
+}
+
 SoundDevice *SoundDevice::createNullSoundDevice() {
 	return new NullSoundDevice();
 }
diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
index 50047183c9f..07116976bb4 100644
--- a/engines/snatcher/sound_device_scd.cpp
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -41,20 +41,27 @@ public:
 	void pcmPlayEffect(int track) override;
 	void pcmDoCommand(int cmd, int arg) override;
 
+	void pause(bool toggle) override;
+
 private:
+	int _lastTrack;
+	uint32 _pauseStartTime;
 };
 
-SegaSoundDevice::SegaSoundDevice() : SoundDevice() {
+SegaSoundDevice::SegaSoundDevice() : SoundDevice(), _lastTrack(-1), _pauseStartTime(0) {
 
 }
 
 void SegaSoundDevice::musicPlay(int track) {
+	assert(track > 0);
 	g_system->getAudioCDManager()->play(track - 1, 1, 0, 0);
+	_lastTrack = track;
 	_musicStartTime = g_system->getMillis();
 }
 
 void SegaSoundDevice::musicStop() {
 	g_system->getAudioCDManager()->stop();
+	_lastTrack = -1;
 }
 
 bool SegaSoundDevice::musicIsPlaying() const {
@@ -72,6 +79,29 @@ void SegaSoundDevice::pcmPlayEffect(int track) {
 void SegaSoundDevice::pcmDoCommand(int cmd, int arg) {
 }
 
+
+void SegaSoundDevice::pause(bool toggle) {
+	if (toggle) {
+		if (_pauseStartTime == 0) {
+			if (musicIsPlaying()) {
+				_pauseStartTime = g_system->getMillis();
+				g_system->getAudioCDManager()->stop();
+			} else {
+				_lastTrack = -1;
+				_pauseStartTime = 0;
+			}
+		}
+	} else {
+		if (_pauseStartTime != 0) {
+			if (_lastTrack != -1)
+				g_system->getAudioCDManager()->play(_lastTrack - 1, 1, (_pauseStartTime - _musicStartTime) / (1000 / 75), 0);
+			int pauseDuration = g_system->getMillis() - _pauseStartTime;
+			_musicStartTime += (pauseDuration - (pauseDuration % (1000 / 75)));
+			_pauseStartTime = 0;
+		}
+	}
+}
+
 SoundDevice *SoundDevice::createSegaSoundDevice() {
 	return new SegaSoundDevice();
 }
diff --git a/engines/snatcher/util.cpp b/engines/snatcher/util.cpp
index 2ae31b21565..411cd652aaf 100644
--- a/engines/snatcher/util.cpp
+++ b/engines/snatcher/util.cpp
@@ -91,5 +91,26 @@ uint32 makeBCDTimeStamp(uint32 msecs) {
 	return ((min & 0xFF) << 24) | ((sec & 0xFF) << 16) | ((frm & 0xFF) << 8);
 }
 
+uint16 rndC1 = 0;
+uint16 rndC2 = 0;
+
+void rngReset() {
+	rndC1 = 0;
+	rndC2 = 0;
+}
+
+uint16 rngMakeNumber() {
+	rndC1 += ((rndC1 & 0xFF) << 8);
+	rndC1 += rndC2;
+	rndC1 += ((rndC2 << 8) | (rndC2 >> 8));
+	if ((rndC2 & 0xFF) + (rndC2 >> 8) > 0xFF)
+		rndC1++;
+	rndC2 = (((rndC2 & 0xFF) + (rndC2 >> 8)) & 0xFF) | (rndC2 & 0xFF00);
+	if (rndC2 + 1 > 0xFFFF);
+		rndC1++;
+	rndC2++;
+	return rndC1;
+}
+
 } // End of namespace Util
 } // End of namespace Snatcher
diff --git a/engines/snatcher/util.h b/engines/snatcher/util.h
index 0676a7b3edc..1799627fb25 100644
--- a/engines/snatcher/util.h
+++ b/engines/snatcher/util.h
@@ -32,6 +32,9 @@ extern uint32 decodeSCDData(const uint8 *src, uint8 *dst);
 
 extern uint32 makeBCDTimeStamp(uint32 msecs);
 
+extern void rngReset();
+extern uint16 rngMakeNumber();
+
 } // End of namespace Util
 } // End of namespace Snatcher
 


Commit: 4df85f37f83aa1101d5169dd9799eb430e1b3c76
    https://github.com/scummvm/scummvm/commit/4df85f37f83aa1101d5169dd9799eb430e1b3c76
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
GRAPHICS: (SegaGfx) - rewrite render routine

I had to change the rendering strategy to draw line by line. Snatcher
makes use of horizontal interrupts for certain effects, which isn't
possible if I keep rendering each plane separately (and tile by tile).
I also had to introduce 16/32 bit rendering, since the horizontal
interrupt handler may change the palette colors and this wouldn't
work with 8 bit rendering. Fix several bugs in the process...

Changed paths:
    engines/kyra/graphics/screen_eob_segacd.cpp
    engines/kyra/sequence/sequences_eob.cpp
    graphics/segagfx.cpp
    graphics/segagfx.h


diff --git a/engines/kyra/graphics/screen_eob_segacd.cpp b/engines/kyra/graphics/screen_eob_segacd.cpp
index 5b74e7628d7..2deff1d46c6 100644
--- a/engines/kyra/graphics/screen_eob_segacd.cpp
+++ b/engines/kyra/graphics/screen_eob_segacd.cpp
@@ -454,8 +454,13 @@ void SCDRenderer::renderToPage(int destPageNum, int renderBlockX, int renderBloc
 	if (renderBlockHeight == -1)
 		renderBlockHeight = _blocksH;
 
-	_screen->addDirtyRect(renderBlockX << 3, renderBlockY << 3, ((renderBlockX + renderBlockWidth) << 3) - 1, ((renderBlockY + renderBlockHeight) << 3) - 1);
-	Graphics::SegaRenderer::render(_screen->getPagePtr(destPageNum), renderBlockX, renderBlockY, renderBlockWidth, renderBlockHeight, spritesOnly);
+	if (spritesOnly) {
+		renderSprites(_screen->getPagePtr(destPageNum), nullptr);
+	} else {
+		if (destPageNum == 0)
+			_screen->addDirtyRect(renderBlockX << 3, renderBlockY << 3, renderBlockWidth << 3, renderBlockHeight << 3);
+		render(_screen->getPagePtr(destPageNum), renderBlockX << 3, renderBlockY << 3, renderBlockWidth << 3, renderBlockHeight << 3);
+	}
 }
 
 SegaAnimator::SegaAnimator(SCDRenderer *renderer) : _renderer(renderer), _needUpdate(false) {
diff --git a/engines/kyra/sequence/sequences_eob.cpp b/engines/kyra/sequence/sequences_eob.cpp
index aee8f994de9..3161805fab3 100644
--- a/engines/kyra/sequence/sequences_eob.cpp
+++ b/engines/kyra/sequence/sequences_eob.cpp
@@ -2463,7 +2463,6 @@ void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 	uint16 *scrollTable = new uint16[0x200]();
 	SCDRenderer *r = _screen->sega_getRenderer();
 
-	r->setPitch(128);
 	r->setPlaneTableLocation(SCDRenderer::kPlaneA, 0xE000);
 	r->setupPlaneAB(1024, 256);
 	r->setHScrollMode(SCDRenderer::kHScroll1PixelRows);
@@ -2540,7 +2539,6 @@ void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 	r->setupPlaneAB(512, 512);
 	r->setHScrollMode(SCDRenderer::kHScrollFullScreen);
 	r->memsetVRAM(0xD800, 0, 0x400);
-	r->setPitch(64);
 	_screen->sega_selectPalette(0, 0);
 	in = containerAlt ? new Common::SeekableReadStreamEndianWrapper(new Common::SeekableSubReadStream(containerAlt, last * 35840, (last + 1) * 35840), true, DisposeAfterUse::YES) : _sres->resStreamEndian(last);
 	r->loadStreamToVRAM(in, 32, !containerAlt);
@@ -2791,7 +2789,7 @@ void EoBEngine::seq_segaSetupSequence(int sequenceId) {
 	_screen->clearPage(0);
 
 	// transposeScreenOutputY(0);
-	_screen->sega_getRenderer()->setupWindowPlane(0, (sequenceId == 53 || sequenceId == 54) ? 23 : 18, SCDRenderer::kWinToRight, SCDRenderer::kWinToBottom);
+	_screen->sega_getRenderer()->setupWindowPlane(0, (sequenceId == 53 || sequenceId == 54) ? 23 : 18, SCDRenderer::kWinToLeft, SCDRenderer::kWinToBottom);
 	_screen->sega_getRenderer()->memsetVRAM(0xD840, 0xEE, 512);
 	_screen->sega_getAnimator()->clearSprites();
 	_screen->setScreenDim(2);
diff --git a/graphics/segagfx.cpp b/graphics/segagfx.cpp
index 51f0abb46c8..cf907f28a7b 100644
--- a/graphics/segagfx.cpp
+++ b/graphics/segagfx.cpp
@@ -20,50 +20,28 @@
 */
 
 
+#include "graphics/pixelformat.h"
 #include "graphics/segagfx.h"
 #include "graphics/surface.h"
 #include "common/rect.h"
 
 namespace Graphics {
 
-#if SEGA_PERFORMANCE
-#define mRenderLineFragment(hFlip, oddStart, oddEnd, useMask, dst, mask, src, start, end, pal) \
-{ \
-	int rlfOffs = 0; \
-	if (hFlip) \
-		rlfOffs |= 4; \
-	if (oddStart) \
-		rlfOffs |= 2; \
-	if (oddEnd) \
-		rlfOffs |= 1; \
-	if (useMask) \
-		(this->*_renderLineFragmentM[rlfOffs])(dst, mask, src, start, end, pal); \
-	else \
-		(this->*_renderLineFragmentD[rlfOffs])(dst, src, start, end, pal); \
-}
-#else
-#define mRenderLineFragment(hFlip, oddStart, oddEnd, useMask, dst, mask, src, start, end, pal) \
-{ \
-	if (hFlip) \
-		renderLineFragment<true>(dst, mask, src, start, end, pal); \
-	else \
-		renderLineFragment<false>(dst, mask, src, start, end, pal); \
-}
-#endif
-
-SegaRenderer::SegaRenderer() : _prioChainStart(0), _prioChainEnd(0), _pitch(64), _hScrollMode(0), _hScrollTable(0), _vScrollMode(0), _spriteTable(0), _numSpritesMax(0), _spriteMask(0), _backgroundColor(0)
-#if SEGA_PERFORMANCE
-, _renderLineFragmentD(0), _renderLineFragmentM(0)
-#endif
-{
-	_vram = new uint8[0x10000];
+SegaRenderer::SegaRenderer(const PixelFormat *systemPixelFormat) : _pixelFormat(systemPixelFormat ? *systemPixelFormat : PixelFormat::createFormatCLUT8()),	_pitch(64), _hScrollMode(0),
+	_hScrollTable(0), _vScrollMode(0), _spriteTable(0), _numSpritesMax(0), _spriteMask(0), _spriteMaskPrio(0), _backgroundColor(0), _planes{SegaPlane(), SegaPlane(), SegaPlane()},
+	_vram(nullptr), _vsram(nullptr), _tempBufferSprites(nullptr), _tempBufferSpritesPrio(nullptr), _tempBufferPlanes(nullptr), _tempBufferPlanesPrio(nullptr), _renderColorTable(nullptr),
+	_rr(kUnspecified), _renderLineFragmentD(0), _renderLineFragmentM(0), _hINTEnable(false), _hINTCounter(0), _hINTCounterNext(0), _hINTHandler(nullptr), _destPitch(0), _displayEnabled(true) {
+
+	_vram = new uint8[0x10000]();
 	assert(_vram);
-	memset(_vram, 0, 0x10000 * sizeof(uint8));
-	_vsram = new uint16[40];
+	_vsram = new uint16[40]();
 	assert(_vsram);
-	memset(_vsram, 0, 40 * sizeof(uint16));
 
-#if SEGA_PERFORMANCE
+	if (_pixelFormat.bytesPerPixel > 1) {
+		_renderColorTable = new uint32[0x100]();
+		assert(_renderColorTable);
+	}
+
 	static const SegaRenderer::renderFuncD funcD[8] = {
 		&SegaRenderer::renderLineFragmentD<false, false, false>,
 		&SegaRenderer::renderLineFragmentD<false, false, true>,
@@ -88,7 +66,6 @@ SegaRenderer::SegaRenderer() : _prioChainStart(0), _prioChainEnd(0), _pitch(64),
 
 	_renderLineFragmentD = funcD;
 	_renderLineFragmentM = funcM;
-#endif
 
 	setResolution(320, 224);
 }
@@ -97,6 +74,11 @@ SegaRenderer::~SegaRenderer() {
 	delete[] _vram;
 	delete[] _vsram;
 	delete[] _spriteMask;
+	delete[] _spriteMaskPrio;
+	delete[] _tempBufferSprites;
+	delete[] _tempBufferSpritesPrio;
+	delete[] _tempBufferPlanes;
+	delete[] _tempBufferPlanesPrio;
 }
 
 void SegaRenderer::setResolution(int w, int h) {
@@ -105,14 +87,32 @@ void SegaRenderer::setResolution(int w, int h) {
 
 	_screenW = w;
 	_screenH = h;
+	_destPitch = w * _pixelFormat.bytesPerPixel;
 	_blocksW = w >> 3;
 	_blocksH = h >> 3;
 	_numSpritesMax = w >> 2;
 
+	delete[] _tempBufferSprites;
+	delete[] _tempBufferSpritesPrio;
+	delete[] _tempBufferPlanes;
+	delete[] _tempBufferPlanesPrio;
 	delete[] _spriteMask;
-	_spriteMask = new uint8[w * h];
+	delete[] _spriteMaskPrio;
+
+	if (_pixelFormat.bytesPerPixel > 1) {
+		_tempBufferPlanes = new uint8[_screenW * _screenH]();
+		assert(_tempBufferPlanes);
+	}
+	_tempBufferSprites = new uint8[_screenW * _screenH]();
+	assert(_tempBufferSprites);
+	_tempBufferSpritesPrio = new uint8[_screenW * _screenH]();
+	assert(_tempBufferSpritesPrio);
+	_tempBufferPlanesPrio = new uint8[_screenW]();
+	assert(_tempBufferPlanesPrio);
+	_spriteMask = new uint8[_screenW * _screenH]();
 	assert(_spriteMask);
-	memset(_spriteMask, 0, w * h * sizeof(uint8));
+	_spriteMaskPrio = new uint8[_screenW * _screenH]();
+	assert(_spriteMaskPrio);
 }
 
 void SegaRenderer::setPlaneTableLocation(int plane, uint16 addr) {
@@ -129,17 +129,20 @@ void SegaRenderer::setupPlaneAB(int pixelWidth, int pixelHeigth) {
 		_planes[i].mod = _planes[i].h;
 		_planes[i].nameTableSize = _planes[i].w * _planes[i].h;
 	}
+	_pitch = pixelWidth >> 3;
 }
 
-void SegaRenderer::setupWindowPlane(int blockX, int blockY, int horizontalMode, int verticalMode) {
-	if (blockX != -1)
-		_planes[kWindowPlane].blockX = horizontalMode ? blockX : 0;
-	if (blockY != -1)
-		_planes[kWindowPlane].blockY = verticalMode ? blockY : 0;
-	_planes[kWindowPlane].w = horizontalMode ? _blocksW - blockX : blockX;
-	_planes[kWindowPlane].h = verticalMode ? _blocksH - blockY : blockY;
-	_planes[kWindowPlane].mod = _planes[kWindowPlane].blockY + _planes[kWindowPlane].h;
-	_planes[kWindowPlane].nameTableSize = _planes[kWindowPlane].w * _planes[kWindowPlane].h;
+void SegaRenderer::setupWindowPlane(int baseX, int baseY, int horizontalMode, int verticalMode) {
+	if (baseX != -1) {
+		baseX <<= 1; // The column unit size is 2 tiles (16 pixels)
+		_planes[kWindowPlane].blockX = horizontalMode ? baseX : 0;
+	}
+	if (baseY != -1) // The line unit size is 1 tile (8 pixels)
+		_planes[kWindowPlane].blockY = verticalMode ? baseY : 0;
+	_planes[kWindowPlane].w = horizontalMode ? _blocksW - baseX : baseX;
+	_planes[kWindowPlane].h = verticalMode ? _blocksH - baseY : baseY;
+	_planes[kWindowPlane].mod = _blocksH;
+	_planes[kWindowPlane].nameTableSize = (_planes[kWindowPlane].w || _planes[kWindowPlane].h) ? _blocksH * _pitch : 0;
 }
 
 void SegaRenderer::setHScrollTableLocation(int addr) {
@@ -152,10 +155,6 @@ void SegaRenderer::setSpriteTableLocation(int addr) {
 	_spriteTable = (uint16*)(&_vram[addr]);
 }
 
-void SegaRenderer::setPitch(int pitch) {
-	_pitch = pitch;
-}
-
 void SegaRenderer::setHScrollMode(int mode) {
 	_hScrollMode = mode;
 }
@@ -164,6 +163,10 @@ void SegaRenderer::setVScrollMode(int mode) {
 	_vScrollMode = mode;
 }
 
+void SegaRenderer::enableDisplay(bool enable) {
+	_displayEnabled = enable;
+}
+
 void SegaRenderer::loadToVRAM(const void *data, uint16 len, uint16 addr) {
 	assert(data);
 	assert(addr + len <= 0x10000);
@@ -198,59 +201,172 @@ void SegaRenderer::clearPlanes() {
 	}
 }
 
-void SegaRenderer::render(Surface *surf, int renderBlockX, int renderBlockY, int renderBlockWidth, int renderBlockHeight, bool spritesOnly) {
-	if ((_screenW != surf->w) || (_screenH != surf->h))
-		error("SegaRenderer::render(): Render target surface needs to be have the same width and height as passed to SegaRenderer::setResolution().");
-
-	if (surf->format.bpp() > 1)
-		error("SegaRenderer::render(): Unsupported color mode in render target surface.");
-
-	render((uint8*)surf->getPixels(), renderBlockX, renderBlockY, renderBlockWidth, renderBlockHeight, spritesOnly);
-}
-
-void SegaRenderer::render(uint8 *dest, int renderBlockX, int renderBlockY, int renderBlockWidth, int renderBlockHeight, bool spritesOnly) {
-	if (renderBlockX == -1)
-		renderBlockX = 0;
-	if (renderBlockY == -1)
-		renderBlockY = 0;
-	if (renderBlockWidth == -1)
-		renderBlockWidth = _blocksW;
-	if (renderBlockHeight == -1)
-		renderBlockHeight = _blocksH;
-
-	assert(dest);
-	uint8 *renderBuffer = dest;
-
-	fillBackground(dest, renderBlockX, renderBlockY, renderBlockWidth, renderBlockHeight);
+void SegaRenderer::render(void *dst, int x, int y, int w, int h) {
+	if (x == -1)
+		x = 0;
+	if (y == -1)
+		y = 0;
+	if (w == -1)
+		w = _screenW;
+	if (h == -1)
+		h = _screenH;
+
+	_rr = kUnspecified;
+	int y2 = y + h;
+
+	assert(dst);
+	assert(x >= 0 && x + w <= _screenW);
+	assert(w > 0);
+	assert(y >= 0 && y2 <= _screenH);
+	assert(h > 0);
+
+	memset(_tempBufferSprites, _backgroundColor, _screenW * _screenH);
+	memset(_tempBufferSpritesPrio, _backgroundColor, _screenW * _screenH);
+	renderSprites(_tempBufferSprites, _tempBufferSpritesPrio, x, y, w, h);
+
+	MergeLinesProc ml = getLineHandler();
+
+	uint8 *rd1 = _pixelFormat.bytesPerPixel == 1 ? reinterpret_cast<uint8*>(dst) : _tempBufferPlanes;
+	uint8 *rd2 = _tempBufferSprites;
+	uint8 *rd3 = _tempBufferSpritesPrio;
+
+	int16 wY1 = _planes[kWindowPlane].blockY << 3;
+	int16 wY2 = wY1 + (_planes[kWindowPlane].h << 3);
+	int16 wX1 = _planes[kWindowPlane].blockX << 3;
+	int16 wX2 = wX1 + (_planes[kWindowPlane].w << 3);
+
+	rd1 += (y * _screenW + x);
+	rd2 += (y * _screenW + x);
+	rd3 += (y * _screenW + x);
+	uint8 *d = reinterpret_cast<uint8*>(dst) + (y * _destPitch + x * _pixelFormat.bytesPerPixel);
+
+	if (x == 0 && y == 0 && w == _screenW && h == _screenH) {
+		memset(rd1, _backgroundColor, _screenW * _screenH);
+	} else {
+		uint8 *rd4 = rd1;
+		for (int y1 = y; y1 < y2; ++y1) {
+			memset(rd4, _backgroundColor, w);
+			rd4 += _screenW;
+		}
+	}
 
-	// Plane B
-	if (!spritesOnly)
-		renderPlanePart(kPlaneB, renderBuffer, renderBlockX, renderBlockY, renderBlockX + renderBlockWidth, renderBlockY + renderBlockHeight);
+	_hINTCounter = 0;
+	for (int i = 0; i <= y; ++i) {
+		hINTUpdate();
+		ml = getLineHandler();
+	}
 
-	// Plane A (only draw if the nametable is not identical to that of plane B)
-	if (_planes[kPlaneA].nameTable != _planes[kPlaneB].nameTable && !spritesOnly) {
-		// If the window plane is active the rendering of plane A becomes more tedious because the window plane
-		// kind of replaces plane A in the space that is covered by it.
-		if (_planes[kWindowPlane].nameTableSize) {
-			SegaPlane *p = &_planes[kWindowPlane];
-			renderPlanePart(kPlaneA, renderBuffer, MAX<int>(0, renderBlockX), MAX<int>(0, renderBlockY), MIN<int>(p->blockX, renderBlockX + renderBlockWidth), MIN<int>(_blocksH, renderBlockY + renderBlockHeight));
-			renderPlanePart(kPlaneA, renderBuffer, MAX<int>(0, renderBlockX), MAX<int>(0, renderBlockY), MIN<int>(_blocksW, renderBlockX + renderBlockWidth), MIN<int>(p->blockY, renderBlockY + renderBlockHeight));
-			renderPlanePart(kPlaneA, renderBuffer, MAX<int>(p->blockX + p->w, renderBlockX), MAX<int>(0, renderBlockY), MIN<int>(_blocksW, renderBlockX + renderBlockWidth), MIN<int>(_blocksH, renderBlockY + renderBlockHeight));
-			renderPlanePart(kPlaneA, renderBuffer, MAX<int>(0, renderBlockX), MAX<int>(p->blockY + p->h, renderBlockY), MIN<int>(_blocksW, renderBlockX + renderBlockWidth), MIN<int>(_blocksH, renderBlockY + renderBlockHeight));
+	if (_planes[kPlaneA].nameTable != _planes[kPlaneB].nameTable) {
+		// Include plane A (only draw if the nametable is not identical to that of plane B)
+		if (_planes[kWindowPlane].nameTableSize != 0) {
+			// With window plane, if available
+			for (int y1 = y; y1 < y2; ++y1) {
+				memset (_tempBufferPlanesPrio, 0, _screenW);
+				if (_displayEnabled) {					
+					renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneB, y1, x, w);
+					if (y1 >= wY1 && y1 < wY2) {
+						renderPlaneLine<true>(rd1, _tempBufferPlanesPrio, kWindowPlane, y1, x, w);
+					} else {
+						int tmpX = (x > wX1) ? x : wX1;
+						int tmpW = (x + w < wX2) ? w : wX2 - tmpX;
+						if (tmpW > 0)
+							renderPlaneLine<true>(rd1, _tempBufferPlanesPrio, kWindowPlane, y1, tmpX, tmpW);
+						if (x < wX1)
+							renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneA, y1, x, wX1 - x);
+						else if (x + w > wX2)
+							renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneA, y1, wX2, x + w - wX2);
+					}
+				}
+
+				(this->*ml)(d, rd1, rd2, _tempBufferPlanesPrio, rd3, x, w);
+				rd1 += _screenW;
+				rd2 += _screenW;
+				rd3 += _screenW;
+				d += _destPitch;
+
+				hINTUpdate();
+				ml = getLineHandler();
+			}
 		} else {
-			renderPlanePart(kPlaneA, renderBuffer, renderBlockX, renderBlockY, renderBlockX + renderBlockWidth, renderBlockY + renderBlockHeight);
+			// Without window plane
+			for (int y1 = y; y1 < y2; ++y1) {
+				memset (_tempBufferPlanesPrio, 0, _screenW);
+				if (_displayEnabled) {	
+					renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneB, y1, x, w);
+					renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneA, y1, x, w);
+				}
+
+				(this->*ml)(d, rd1, rd2, _tempBufferPlanesPrio, rd3, x, w);
+				rd1 += _screenW;
+				rd2 += _screenW;
+				rd3 += _screenW;
+				d += _destPitch;
+
+				hINTUpdate();
+				ml = getLineHandler();
+			}
 		}
-	}
+	} else if (_planes[kWindowPlane].nameTableSize != 0) {
+		// Include window plane if available
+		for (int y1 = y; y1 < y2; ++y1) {
+			memset (_tempBufferPlanesPrio, 0, _screenW);
+			if (_displayEnabled) {
+				renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneB, y1, x, w);
+				if (y1 >= wY1 && y1 < wY2) {
+					renderPlaneLine<true>(rd1, _tempBufferPlanesPrio, kWindowPlane, y1, x, w);
+				} else {
+					int tmpX = (x > wX1) ? x : wX1;
+					int tmpW = (x + w < wX2) ? w : wX2 - tmpX;
+					if (tmpW > 0)
+						renderPlaneLine<true>(rd1, _tempBufferPlanesPrio, kWindowPlane, y1, tmpX, tmpW);
+				}
+			}
 
-	// Window Plane
-	if (_planes[kWindowPlane].nameTableSize && !spritesOnly) {
-		SegaPlane *p = &_planes[kWindowPlane];
-		renderPlanePart(kWindowPlane, renderBuffer, MIN<int>(p->blockX, renderBlockX + renderBlockWidth), MIN<int>(p->blockY, renderBlockY + renderBlockHeight), MAX<int>(p->blockX + p->w, renderBlockX), MAX<int>(p->blockY + p->h, renderBlockY));
+			(this->*ml)(d, rd1, rd2, _tempBufferPlanesPrio, rd3, x, w);
+			rd1 += _screenW;
+			rd2 += _screenW;
+			rd3 += _screenW;
+			d += _destPitch;
+
+			hINTUpdate();
+			ml = getLineHandler();
+		}
+	} else {
+		// Only plane B
+		for (int y1 = y; y1 < y2; ++y1) {
+			memset (_tempBufferPlanesPrio, 0, _screenW);
+			if (_displayEnabled)
+				renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneB, y1, x, w);
+
+			(this->*ml)(d, rd1, rd2, _tempBufferPlanesPrio, rd3, x, w);
+			rd1 += _screenW;
+			rd2 += _screenW;
+			rd3 += _screenW;
+			d += _destPitch;
+
+			hINTUpdate();
+			ml = getLineHandler();
+		}
 	}
+}
 
-	// Sprites
-	memset(_spriteMask, 0xFF, (uint32)_screenW * (uint32)_screenH * sizeof(uint8));
+void SegaRenderer::renderSprites(uint8 *dst, uint8 *dstPrio, int clipX, int clipY, int clipW, int clipH) {
+	if (clipX == -1)
+		clipX = 0;
+	if (clipY == -1)
+		clipY = 0;
+	if (clipW == -1)
+		clipW = _screenW;
+	if (clipH == -1)
+		clipH = _screenH;
+
+	memset(_spriteMask, 0xFF, _screenW * _screenH);
+	memset(_spriteMaskPrio, 0xFF, _screenW * _screenH);
 	const uint16 *pos = _spriteTable;
+
+	int clipX2 = clipX + clipW;
+	int clipY2 = clipY + clipH;
+
 	for (int i = 0; i < _numSpritesMax && pos; ++i) {
 		int y = FROM_BE_16(*pos++) & 0x3FF;
 		uint16 in = FROM_BE_16(*pos++);
@@ -264,30 +380,24 @@ void SegaRenderer::render(uint8 *dest, int renderBlockX, int renderBlockY, int r
 		bool vflip = (in & 0x1000);
 		uint16 tile = in++ & 0x7FF;
 		int x = FROM_BE_16(*pos) & 0x3FF;
-
-		// Sprite masking. Can't happen in EOB at least, since the animator automatically adds 128 to x and y coords for all sprites.
-		// Same in Snatcher. If this triggers anywhere else it will need to be added...
-		assert(!(x == 0 && y >= 128));
-
-		x -= 128;
-		y -= 128;
-
-		/*if ((x >> 3) < renderBlockX) {
-			bW = MIN<int>(0, (int)bW - (renderBlockX - (x >> 3)));
-			x = (renderBlockX << 3);
-
-		}
-
-		if ((y >> 3) < renderBlockY) {
-			bH = MIN<int>(0, (int)bH - (renderBlockY - (y >> 3)));
-			y = (renderBlockY << 3);
+		uint16 pres = dstPrio != nullptr && prio ? kHasPrioSprites : kHasSprites;
+		bool renderedSomething = false;
+		bool spriteMasking = (x == 0 && (y & 0x1FF) >= 128);
+
+		x = (x & 0x1FF) - 128;
+		y = (y & 0x1FF) - 128;
+
+		uint8 *d = (dstPrio != nullptr && prio ? dstPrio : dst) + y * _screenW + x;
+		uint8 *msk = (dstPrio != nullptr && prio ? _spriteMaskPrio : _spriteMask) + y * _screenW + x;
+
+		if (spriteMasking) {
+			int mH = MIN<int>(bH << 3, _screenH - y);
+			if (mH > 0)
+				memset(msk + 128, 0,  mH * _screenW);
+			pos = next ? &_spriteTable[next << 2] : 0;
+			continue;
 		}
 
-		bW = MIN<int>(bW, renderBlockWidth);
-		bH = MIN<int>(bH, renderBlockHeight);*/
-
-		uint8 *dst = renderBuffer + y * _screenW + x;
-		uint8 *msk = _spriteMask + y * _screenW + x;
 		int8 hstep = 0;
 		int8 vstep = 1;
 
@@ -302,32 +412,93 @@ void SegaRenderer::render(uint8 *dest, int renderBlockX, int renderBlockY, int r
 			hstep = hflip ? -2 * bH : 0;
 		}
 
+		int spitch = _screenW << 3;
 
 		for (int blX = 0; blX < bW; ++blX) {
-			uint8 *dst2 = dst;
+			if (x >= clipX2)
+				break;
+
+			uint8 *dst2 = d;
 			uint8 *msk2 = msk;
-			for (int blY = 0; blY < bH; ++blY) {
-				renderSpriteTile(dst, msk, x + (blX << 3), y + (blY << 3), tile, pal, vflip, hflip, prio);
-				tile += vstep;
-				dst += (_screenW << 3);
-				msk += (_screenW << 3);
+			
+			if (x > clipX - 8) {
+				SprTileProc tr = (x < 0 || x > _screenW - 8) ? &SegaRenderer::renderSpriteTileXClipped : &SegaRenderer::renderSpriteTileDef;
+				int y2 = y;
+
+				for (int blY = 0; blY < bH; ++blY) {
+					if (y >= clipY2)
+						break;
+
+					if (y > clipY - 8) {
+						(this->*tr)(d, msk, x, y, tile, pal, vflip, hflip);
+						renderedSomething = true;
+					}
+
+					tile += vstep;
+					d += spitch;
+					msk += spitch;
+					y += 8;
+				}
+				y = y2;
+			} else {
+				tile += (vstep * bH);
 			}
+
 			tile += hstep;
-			dst = dst2 + 8;
+			x += 8;
+			d = dst2 + 8;
 			msk = msk2 + 8;
 		}
 
+		if (renderedSomething)
+			_rr |= pres;
+
 		pos = next ? &_spriteTable[next << 2] : 0;
 	}
+}
+
+template<typename T> void SegaRenderer::refresh(T *dst, int x, int y, int w, int h) {
+	if (sizeof(T) == 1)
+		return;
+
+	uint8 *rd1 = tempBufferPlanes + (y * _screenW + x);
+	dst += (y * _screenW + x);
+
+	if (x == 0 && y == 0 && w == _screenW && h == _screenH) {
+		for (uint32 s = w * h; s; --s)
+			*dst++ = _renderColorTable[*rd1++];
+	} else {
+		uint16 pitch = _screenW - w;
+		while (h--) {
+			for (int x1 = x; x1 < x + w; ++x1)
+				*dst++ = _renderColorTable[*rd1++];
+			rd1 += pitch;
+			dst += pitch;
+		}
+	}
+}
+
+void SegaRenderer::setRenderColorTable(const uint8 *colors, uint16 first, uint16 num) {
+	if (_renderColorTable == nullptr)
+		return;
+
+	uint32 *dst = _renderColorTable + first; 
+	while (num--) {
+		*dst++ = _pixelFormat.RGBToColor(colors[0], colors[1], colors[2]);
+		colors += 3;
+	}
+}
 
-	// Priority Tiles
-	// Instead of going through all rendering passes for all planes again (only now drawing the
-	// prio tiles instead of the non-priority tiles) I have collected the data for the priority
-	// tiles on the way and put that data into a chain. Should be faster...
-	for (const PrioTileRenderObj *e = _prioChainStart; e; e = e->_next)
-		mRenderLineFragment(e->_hflip, e->_start & 1, e->_end & 1, e->_mask, e->_dst, e->_mask, e->_src, e->_start, e->_end, e->_pal)
+void SegaRenderer::hINT_enable(bool enable) {
+	_hINTEnable = enable;
+}
 
-	clearPrioChain();
+void SegaRenderer::hINT_setCounter(uint8 counter) {
+	_hINTCounterNext = counter;
+}
+
+void SegaRenderer::hINT_setHandler(const HINTHandler *hdl) {
+	_hINTHandler = hdl;
 }
 
 void SegaRenderer::fillBackground(uint8 *dst, int blockX, int blockY, int blockW, int blockH) {
@@ -345,99 +516,185 @@ void SegaRenderer::fillBackground(uint8 *dst, int blockX, int blockY, int blockW
 	}
 }
 
-void SegaRenderer::renderPlanePart(int plane, uint8 *dstBuffer, int x1, int y1, int x2, int y2) {
-	SegaPlane *p = &_planes[plane];
-	uint8 *dst = dstBuffer + (y1 << 3) * _screenW + (x1 << 3);
-
-	for (int y = y1; y < y2; ++y) {
-		int hScrollTableIndex = (plane == kWindowPlane) ? -1 : (_hScrollMode == kHScrollFullScreen) ? plane : (y1 << 4) + plane;
-		uint8 *dst2 = dst;
-		for (int x = x1; x < x2; ++x) {
-			int vScrollTableIndex = (plane == kWindowPlane) ? -1 : (_vScrollMode == kVScrollFullScreen) ? plane : (x & ~1) + plane;
-			uint16 vscrNt = 0;
-			uint16 vscrPxStart = 0;
-			uint16 vscrPxEnd = 8;
-
-			if (vScrollTableIndex != -1) {
-				vscrNt = FROM_BE_16(_vsram[vScrollTableIndex]) & 0x3FF;
-				vscrPxStart = vscrNt & 7;
-				vscrNt >>= 3;
-			}
-
-			int ty = (vscrNt + y) % p->mod;
-
-			renderPlaneTile(dst, x, &p->nameTable[ty * _pitch], vscrPxStart, vscrPxEnd, hScrollTableIndex, _pitch);
-
-			if (vscrPxStart) {
-				ty = (ty + 1) % p->mod;
-				uint16 dstOffs = (vscrPxEnd - vscrPxStart) * _screenW;
-				vscrPxEnd = vscrPxStart;
-				vscrPxStart = 0;
-				renderPlaneTile(dst + dstOffs, x, &p->nameTable[ty * _pitch], vscrPxStart, vscrPxEnd, hScrollTableIndex, _pitch);
-			}
-			dst += 8;
+template<bool isWindow> void SegaRenderer::renderPlaneLine(uint8 *planeBuffPos, uint8 *planePrioBuffPos, int srcPlane, int y, int clipX, int clipW) {
+	SegaPlane *p = &_planes[isWindow ? kWindowPlane : srcPlane];
+
+	int16 vbX = clipX >> 3;
+	uint16 hscrNt = vbX;
+	uint16 hscrPxFirst = clipX & 7;
+	uint16 hscrPxLast = MIN<uint16>(clipW, 8);
+	uint16 oddFlag = 0;
+	uint16 hStep = hscrPxLast;
+	uint16 vscrNt = y >> 3;
+	uint16 vscrPxStart = y & 7;
+	uint8 *d1 = planeBuffPos;
+	uint8 *d2 = planePrioBuffPos;
+
+	if (!isWindow) {
+		hscrNt = clipX + (-FROM_BE_16(_hScrollTable[_hScrollMode == kHScrollFullScreen ? srcPlane : ((_hScrollMode == kHScroll1PixelRows ? y : (y & ~7)) << 1) + srcPlane]) & 0x3FF);
+		hscrPxFirst = hscrNt & 7;
+		hscrNt >>= 3;
+		oddFlag = (hscrPxFirst & 1) << 1;
+		hStep -= hscrPxFirst;
+		if (_vScrollMode == kVScrollFullScreen) {
+			vscrNt = y + (FROM_BE_16(_vsram[srcPlane]) & 0x3FF);
+			vscrPxStart = vscrNt & 7;
+			vscrNt >>= 3;
 		}
-		dst = dst2 + (_screenW << 3);
 	}
-}
-
-void SegaRenderer::renderPlaneTile(uint8 *dst, int ntblX, const uint16 *ntblLine, int vScrollLSBStart, int vScrollLSBEnd, int hScrollTableIndex, uint16 pitch) {
-	for (int bY = vScrollLSBStart; bY < vScrollLSBEnd; ++bY) {
-		uint8 *dst2 = dst;
-		uint16 hscrNt = 0;
-		uint16 hscrPx = 0;
 
-		if (hScrollTableIndex != -1) {
-			hscrNt = (-(FROM_BE_16(_hScrollTable[hScrollTableIndex]))) & 0x3FF;
-			hscrPx = hscrNt & 7;
-			hscrNt >>= 3;
+	while (clipW) {
+		if (!isWindow && _vScrollMode == kVScroll16PixelStrips) {
+			vscrNt = y + (FROM_BE_16(_vsram[((vbX % _blocksW) & ~1) + srcPlane]) & 0x3FF);
+			vscrPxStart = vscrNt & 7;
+			vscrNt >>= 3;
 		}
 
-		const uint16 *pNt = &ntblLine[(ntblX + hscrNt) % pitch];
+		const uint16 *pNt = &p->nameTable[(vscrNt % p->mod) * _pitch + (hscrNt % _pitch)];
+
 		if (pNt < (const uint16*)(&_vram[0x10000])) {
 			uint16 nt = FROM_BE_16(*pNt);
 			uint16 pal = ((nt >> 13) & 3) << 4;
 			bool hflip = (nt & 0x800);
-			int y = bY % 8;
-			if (nt & 0x1000) // vflip
-				y = 7 - y;
-
-			// We skip the priority tiles here and draw them later
-			if (nt & 0x8000)
-				initPrioRenderTask(dst, 0, &_vram[((nt & 0x7FF) << 5) + (y << 2) + (hscrPx >> 1)], hscrPx, 8, pal, hflip);
-			else
-				mRenderLineFragment(hflip, hscrPx & 1, 0, 0, dst, 0, &_vram[((nt & 0x7FF) << 5) + (y << 2) + (hscrPx >> 1)], hscrPx, 8, pal);
+			int yl = (nt & 0x1000) ? 7 - vscrPxStart : vscrPxStart;
+
+			renderFuncD proc = _renderLineFragmentD[(hflip ? 4 : 0) | oddFlag];
+			(this->*proc)((nt &0x8000) ? d2 : d1, &_vram[((nt & 0x7FF) << 5) + (yl << 2) + (hscrPxFirst >> 1)], hscrPxFirst, hscrPxLast, pal);
 		}
 
-		if (hscrPx) {
-			dst += (8 - hscrPx);
-			pNt = &ntblLine[(ntblX + hscrNt + 1) % pitch];
-			if (pNt < (const uint16*)(&_vram[0x10000])) {
-				uint16 nt = FROM_BE_16(*pNt);
-				uint16 pal = ((nt >> 13) & 3) << 4;
-				bool hflip = (nt & 0x800);
-				int y = bY % 8;
-				if (nt & 0x1000) // vflip
-					y = 7 - y;
-
-				// We skip the priority tiles here and draw them later
-				if (nt & 0x8000)
-					initPrioRenderTask(dst, 0, &_vram[((nt & 0x7FF) << 5) + (y << 2)], 0, hscrPx, pal, hflip);
-				else
-					mRenderLineFragment(hflip, 0, hscrPx & 1, 0, dst, 0, &_vram[((nt & 0x7FF) << 5) + (y << 2)], 0, hscrPx, pal)
+		++vbX;
+		++hscrNt;
+		d1 += hStep;
+		d2 += hStep;
+		clipW -= hStep;
+		hscrPxFirst = 0;
+
+		if (clipW >= 8) {
+			hStep = 8;
+			oddFlag = 0;
+			continue;
+		}
+
+		hscrPxLast = hStep = clipW;
+		oddFlag = hscrPxLast & 1;
+	}
+}
+
+template<typename T, bool withSprites, bool withPrioSprites> void SegaRenderer::mergeLines(void *dst, uint8 *bottomLayer, const uint8 *spriteLayer, const uint8 *prioLayer, const uint8 *prioSpriteLayer, int clipX, int clipW) {
+	T *d = reinterpret_cast<T*>(dst);
+
+	if (sizeof(T) == 1) {
+		if (!bottomLayer)
+			bottomLayer = reinterpret_cast<uint8*>(dst);
+		assert(bottomLayer);
+	}
+
+	if (withPrioSprites) {
+		if (withSprites) {
+			while (clipW--) {
+				if (*prioSpriteLayer)
+					*bottomLayer = *prioSpriteLayer;
+				else if (*prioLayer)
+					*bottomLayer = *prioLayer;
+				else if (*spriteLayer)
+					*bottomLayer = *spriteLayer;
+
+				if (sizeof(T) > 1)
+					*d++ = _renderColorTable[*bottomLayer];
+
+				++bottomLayer;
+				++spriteLayer;
+				++prioLayer;
+				++prioSpriteLayer;
+			}
+		} else {
+			while (clipW--) {
+				if (*prioSpriteLayer)
+					*bottomLayer = *prioSpriteLayer;
+				else if (*prioLayer)
+					*bottomLayer = *prioLayer;
+
+				if (sizeof(T) > 1)
+					*d++ = _renderColorTable[*bottomLayer];
+
+				++bottomLayer;
+				++prioLayer;
+				++prioSpriteLayer;
 			}
 		}
+	} else if (withSprites) {
+		while (clipW--) {
+			if (*prioLayer)
+				*bottomLayer = *prioLayer;
+			else if (*spriteLayer)
+				*bottomLayer = *spriteLayer;
+
+			if (sizeof(T) > 1)
+				*d++ = _renderColorTable[*bottomLayer];
+
+			++bottomLayer;
+			++spriteLayer;
+			++prioLayer;
+		}
+	} else {
+		while (clipW--) {
+			if (*prioLayer)
+				*bottomLayer = *prioLayer;
 
-		if (hScrollTableIndex != -1 && _hScrollMode == kHScroll1PixelRows)
-			hScrollTableIndex += 2;
-		dst = dst2 + _screenW;
+			if (sizeof(T) > 1)
+				*d++ = _renderColorTable[*bottomLayer];
+
+			++bottomLayer;
+			++prioLayer;
+		}
 	}
 }
 
-void SegaRenderer::renderSpriteTile(uint8 *dst, uint8 *mask, int x, int y, uint16 tile, uint8 pal, bool vflip, bool hflip, bool prio) {
-	if (y <= -8 || y >= _screenH || x <= -8 || x >= _screenW)
-		return;
+SegaRenderer::MergeLinesProc SegaRenderer::getLineHandler() const {
+	static const MergeLinesProc mpc[] = {
+		nullptr,
+		&SegaRenderer::mergeLines<uint8, false, false>,
+		&SegaRenderer::mergeLines<uint16, false, false>,
+		nullptr,
+		&SegaRenderer::mergeLines<uint32, false, false>,
+		&SegaRenderer::mergeLines<uint8, true, false>,
+		&SegaRenderer::mergeLines<uint16, true, false>,
+		nullptr,
+		&SegaRenderer::mergeLines<uint32, true, false>,
+		&SegaRenderer::mergeLines<uint8, false, true>,
+		&SegaRenderer::mergeLines<uint16, false, true>,
+		nullptr,
+		&SegaRenderer::mergeLines<uint32, false, true>,
+		&SegaRenderer::mergeLines<uint8, true, true>,
+		&SegaRenderer::mergeLines<uint16, true, true>,
+		nullptr,
+		&SegaRenderer::mergeLines<uint32, true, true>
+	};
+
+	uint index = _pixelFormat.bytesPerPixel;
+	if (_displayEnabled) {
+		if (_rr & kHasSprites)
+			index += 4;
+		if (_rr & kHasPrioSprites)
+			index += 8;
+	}
+
+	assert(index < ARRAYSIZE(mpc));
+	MergeLinesProc res = mpc[index];
+	assert(res);
 
+	return res;
+}
+
+void SegaRenderer::hINTUpdate() {
+	if (!_hINTCounter--) {
+		if (_hINTEnable && _hINTHandler && _hINTHandler->isValid())
+			(*_hINTHandler)(this);
+		_hINTCounter = _hINTCounterNext;
+	}
+}
+
+void SegaRenderer::renderSpriteTileXClipped(uint8 *dst, uint8 *mask, int x, int y, uint16 tile, uint8 pal, bool vflip, bool hflip) {
 	const uint8 *src = &_vram[tile << 5];
 
 	if (y < 0) {
@@ -457,14 +714,40 @@ void SegaRenderer::renderSpriteTile(uint8 *dst, uint8 *mask, int x, int y, uint1
 	src += ((vflip ? (7 - ystart) : ystart) << 2);
 	int incr = vflip ? -4 : 4;
 
+	renderFuncM proc = _renderLineFragmentM[(hflip ? 4 : 0) | ((xstart & 1) ? 2 : 0) | ((xend & 1) ? 1 : 0)];
+
 	for (int bY = ystart; bY < yend; ++bY) {
 		uint8 *dst2 = dst;
 		uint8 *msk2 = mask;
 
-		if (prio)
-			initPrioRenderTask(dst, mask, src, xstart, xend, pal, hflip);
-		else
-			mRenderLineFragment(hflip, xstart & 1, xend & 1, 1, dst, mask, src, xstart, xend, pal);
+		(this->*proc)(dst, mask, src, xstart, xend, pal);
+
+		src += incr;
+		dst = dst2 + _screenW;
+		mask = msk2 + _screenW;
+	}
+}
+
+void SegaRenderer::renderSpriteTileDef(uint8 *dst, uint8 *mask, int x, int y, uint16 tile, uint8 pal, bool vflip, bool hflip) {
+	const uint8 *src = &_vram[tile << 5];
+
+	if (y < 0) {
+		dst -= (y * _screenW);
+		mask -= (y * _screenW);
+	}
+
+	int ystart = CLIP<int>(-y, 0, 7);
+	int yend = CLIP<int>(_screenH - y, 0, 8);
+	src += ((vflip ? (7 - ystart) : ystart) << 2);
+	int incr = vflip ? -4 : 4;
+
+	renderFuncM proc = _renderLineFragmentM[hflip ? 4 : 0];
+
+	for (int bY = ystart; bY < yend; ++bY) {
+		uint8 *dst2 = dst;
+		uint8 *msk2 = mask;
+
+		(this->*proc)(dst, mask, src, 0, 8, pal);
 
 		src += incr;
 		dst = dst2 + _screenW;
@@ -472,7 +755,6 @@ void SegaRenderer::renderSpriteTile(uint8 *dst, uint8 *mask, int x, int y, uint1
 	}
 }
 
-#if SEGA_PERFORMANCE
 template<bool hflip, bool oddStart, bool oddEnd> void SegaRenderer::renderLineFragmentM(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal) {
 	if (hflip)
 		src += ((end - 1 - start) >> 1);
@@ -499,8 +781,6 @@ template<bool hflip, bool oddStart, bool oddEnd> void SegaRenderer::renderLineFr
 			*dst = pal | col;
 			*mask = 0;
 		}
-		dst++;
-		mask++;
 	}
 }
 
@@ -522,64 +802,7 @@ template<bool hflip, bool oddStart, bool oddEnd> void SegaRenderer::renderLineFr
 		uint8 col = hflip ? (oddEnd ? *src-- >> 4 : *src & 0x0F) : (oddStart ? *src++ & 0x0F : *src >> 4);
 		if (col)
 			*dst = pal | col;
-		dst++;
-	}
-}
-#else
-template<bool hflip> void SegaRenderer::renderLineFragment(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal) {
-	if (hflip) {
-		src += ((end - 1 - start) >> 1);
-		if (end & 1) {
-			start++;
-			end++;
-		}
-	}
-
-	if (mask) {
-		for (int bX = start; bX < end; ++bX) {
-			uint8 col = hflip ? ((bX & 1) ? *src-- >> 4 : *src & 0x0F) : ((bX & 1) ? *src++ & 0x0F : *src >> 4);
-			if (col & *mask) {
-				*dst = pal | col;
-				*mask = 0;
-			}
-			dst++;
-			mask++;
-		}
-	} else {
-		for (int bX = start; bX < end; ++bX) {
-			uint8 col = hflip ? ((bX & 1) ? *src-- >> 4 : *src & 0x0F) : ((bX & 1) ? *src++ & 0x0F : *src >> 4);
-			if (col)
-				*dst = pal | col;
-			dst++;
-		}
-	}
-}
-#endif
-
-#undef mRenderLineFragment
-
-void SegaRenderer::initPrioRenderTask(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal, bool hflip) {
-#if SEGA_USE_MEMPOOL
-	_prioChainEnd =	new (_prioRenderMemPool) PrioTileRenderObj(_prioChainEnd, dst, mask, src, start, end, pal, hflip);
-#else
-	_prioChainEnd = new PrioTileRenderObj(_prioChainEnd, dst, mask, src, start, end, pal, hflip);
-#endif
-	if (!_prioChainStart)
-		_prioChainStart = _prioChainEnd;
-}
-
-void SegaRenderer::clearPrioChain() {
-	while (_prioChainEnd) {
-		_prioChainEnd->_next = 0;
-		PrioTileRenderObj *e = _prioChainEnd->_pred;
-#if SEGA_USE_MEMPOOL
-		_prioRenderMemPool.deleteChunk(_prioChainEnd);
-#else
-		delete _prioChainEnd;
-#endif
-		_prioChainEnd = e;
 	}
-	_prioChainStart = 0;
 }
 
 } // End of namespace Graphics
diff --git a/graphics/segagfx.h b/graphics/segagfx.h
index 4833e0fe89d..f8be03cc961 100644
--- a/graphics/segagfx.h
+++ b/graphics/segagfx.h
@@ -22,15 +22,12 @@
 #ifndef GRAPHICS_SEGAGFX_H
 #define GRAPHICS_SEGAGFX_H
 
-#define SEGA_PERFORMANCE		true
-#define SEGA_USE_MEMPOOL		true
-
-#if SEGA_USE_MEMPOOL
-#include "common/memorypool.h"
-#endif
+#include "common/func.h"
+#include "graphics/pixelformat.h"
 
 namespace Graphics {
 
+struct PixelFormat;
 struct Surface;
 
 /**
@@ -71,7 +68,7 @@ public:
 	};
 
 public:
-	SegaRenderer();
+	SegaRenderer(const PixelFormat *systemPixelFormat = nullptr);
 	~SegaRenderer();
 
 	/**
@@ -101,16 +98,16 @@ public:
 
 	/**
 	 * Set pixel width and/or height and drawing mode for the window plane.
-	 * @param pixelWidth:		1024, 512 or 256 allowed
-	 * @param pixelHeight:		1024, 512 or 256 allowed
-	 * @param horizontalMode:	kWinToLeft or kWinToRight
-	 * @param verticalMode:		kWinToTop or kWinToBottom
+	 * @param baseX:				base x coordinate (in 16 px units)
+	 * @param baseY:				base y coordinate (in  8 px units)
+	 * @param horizontalMode:		kWinToLeft or kWinToRight (window is either from the left of the screen to base x or from base x to the right of the screen)
+	 * @param verticalMode:			kWinToTop or kWinToBottom (window is either from the top of the screen to base y or from base y to the bottom of the screen)
 	 *
 	 * The hardware allows/demands separate modification of the vertical and horizontal properties.
 	 * To allow this without making another function one of the pixelWidth/pixelHeight parameters
 	 * can be set to -1 which will keep the existing value for that property.
 	 */
-	void setupWindowPlane(int blockX, int blockY, int horizontalMode, int verticalMode);
+	void setupWindowPlane(int baseX, int baseY, int horizontalMode, int verticalMode);
 
 	/**
 	 * Set address for the horizontal scroll table.
@@ -124,12 +121,6 @@ public:
 	 */
 	void setSpriteTableLocation(int addr);
 
-	/**
-	 * Set plane pitch in (8 pixels wide) blocks.
-	 * @param pitch:	pitch
-	 */
-	void setPitch(int pitch);
-
 	/**
 	 * Set horizontal scroll mode.
 	 * @param mode:		see enum HScrollMode
@@ -142,6 +133,12 @@ public:
 	 */
 	void setVScrollMode(int mode);
 
+	/**
+	 * Enable display or fill with background color.
+	 * @param enable:	true = display, false = fill with background color
+	 */
+	void enableDisplay(bool enable);
+
 	/**
 	 * Load data from a buffer to a vram address.
 	 * @param data:		source data ptr
@@ -191,38 +188,88 @@ public:
 								block (8x8 pixels) coordinates of target render area. Values of -1 for maximum range / full screen rendering.
 	 * @param spritesOnly:		skip rendering of the planes and only render the sprites.
 	 */
-	void render(Surface *surf, int renderBlockX = -1, int renderBlockY = -1, int renderBlockWidth = -1, int renderBlockHeight = -1, bool spritesOnly = false);
-	void render(uint8 *dest, int renderBlockX = -1, int renderBlockY = -1, int renderBlockWidth = -1, int renderBlockHeight = -1, bool spritesOnly = false);
+	//void render(Surface *surf, int renderBlockX = -1, int renderBlockY = -1, int renderBlockWidth = -1, int renderBlockHeight = -1, bool spritesOnly = false);
+	//void render(uint8 *dest, int renderBlockX = -1, int renderBlockY = -1, int renderBlockWidth = -1, int renderBlockHeight = -1, bool spritesOnly = false);
+
+	/**
+	 * Render vram in its current state to the target buffer/surface.
+	 * @param surf/dst:		Target surface or buffer.
+	 * @param x, y, w, h:		Pixel coordinates of source and target render area. Values of -1 for maximum range / full screen rendering.
+	 */
+	void render(void *dst, int x = -1, int y = -1, int w = -1, int h = -1);
+
+	/**
+	 * Render sprites only
+	 * @param dst:								Target buffer for non-prio sprites.
+	 * @param dstPrio:							Target buffer for prio sprites.
+	 * @param clipX, clipY, clipW, clipH:		Pixel coordinates of source and target render area. Values of -1 for maximum range / full screen rendering.
+	 */
+	void renderSprites(uint8 *dst, uint8 *dstPrio, int clipX = -1, int clipY = -1, int clipW = -1, int clipH = -1);
+
+	/**
+	 * Refresh a part of the target buffer/surface with the latest render() result.
+	 * The only purpose of this function (at least for me) is to convert the pixels of non-8bit dest buffers/surfaces to a changed palette.
+	 * @param dst:				Target surface or buffer.
+	 * @param x, y, w, h:		Pixel coordinates of target render area. Values of -1 for maximum range / full screen refresh.
+	 */
+	template<typename T> void refresh(T *dest, int x = -1, int y = -1, int w = -1, int h = -1);
+
+	/**
+	 * Set palette for render operations on non-8bit dest buffers/surfaces
+	 * @param colors:			8bit palette for the final color conversion of the rendered surface/buffer.
+	 * @param numColors:		Number of colors in the palette.
+	 */
+	void setRenderColorTable(const uint8 *colors, uint16 first, uint16 num);
+
+public:
+	class HINTClient {
+	public:
+		virtual ~HINTClient() {}
+		virtual void hINTCallback(SegaRenderer *sr) = 0;
+	};
+	typedef Common::Functor1Mem<SegaRenderer*, void, HINTClient> HINTHandler;
+
+	/**
+	 * Horizontal Interrupt
+	 * @hINT_enable:			enable/disable
+	 * @hINT_setCounter			number of scan lines between hINT handler invocation
+	 * @hINT_setHandler			set hINT handler callback
+	 */
+	void hINT_enable(bool enable);
+	void hINT_setCounter(uint8 counter);
+	void hINT_setHandler(const HINTHandler *hdl);
 
 protected:
 	uint16 _screenW, _screenH, _blocksW, _blocksH;
+	uint16 _destPitch;
 	uint8 *_vram;
 	uint16 *_vsram;
 	uint16 _pitch;
 
 private:
 	void fillBackground(uint8 *dst, int x, int y, int w, int h);
-	void renderPlanePart(int plane, uint8 *dstBuffer, int x1, int y1, int x2, int y2);
-	void renderPlaneTile(uint8 *dst, int destX, const uint16 *nameTable, int vScrollLSBStart, int vScrollLSBEnd, int hScrollTableIndex, uint16 pitch);
-	void renderSpriteTile(uint8 *dst, uint8 *mask, int x, int y, uint16 tile, uint8 pal, bool vflip, bool hflip, bool prio);
-#if SEGA_PERFORMANCE
+	template<bool isWindow> void renderPlaneLine(uint8 *planeBuffPos, uint8 *planePrioBuffPos, int srcPlane, int y, int clipX, int clipW);
+	template<typename T, bool withSprites, bool withPrioSprites> void mergeLines(void *dst, uint8 *bottomLayer, const uint8 *spriteLayer, const uint8 *prioLayer, const uint8 *prioSpriteLayer, int clipX, int clipW);
+
+	typedef void (SegaRenderer::*MergeLinesProc)(void*, uint8*, const uint8*, const uint8*, const uint8*, int, int);
+	MergeLinesProc getLineHandler() const;
+	void hINTUpdate();
+
+	void renderSpriteTileXClipped(uint8 *dst, uint8 *mask, int x, int y, uint16 tile, uint8 pal, bool vflip, bool hflip);
+	void renderSpriteTileDef(uint8 *dst, uint8 *mask, int x, int y, uint16 tile, uint8 pal, bool vflip, bool hflip);
+	typedef void (SegaRenderer::*SprTileProc)(uint8*, uint8*, int, int, uint16, uint8, bool, bool);
+
 	template<bool hflip, bool oddStart, bool oddEnd> void renderLineFragmentM(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal);
 	template<bool hflip, bool oddStart, bool oddEnd> void renderLineFragmentD(uint8 *dst, const uint8 *src, int start, int end, uint8 pal);
 	typedef void(SegaRenderer::*renderFuncM)(uint8*, uint8*, const uint8*, int, int, uint8);
 	typedef void(SegaRenderer::*renderFuncD)(uint8*, const uint8*, int, int, uint8);
 	const renderFuncM *_renderLineFragmentM;
 	const renderFuncD *_renderLineFragmentD;
-#else
-	template<bool hflip> void renderLineFragment(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal);
-#endif
-
-	void initPrioRenderTask(uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal, bool hflip);
-	void clearPrioChain();
 
 	struct SegaPlane {
 		SegaPlane() : blockX(0), blockY(0), w(0), h(0), mod(0), nameTable(0), nameTableSize(0) {}
 		int blockX, blockY;
-		uint16 w, h, mod;
+		uint16 w, h, mod, pitch;
 		uint16 *nameTable;
 		uint16 nameTableSize;
 	};
@@ -231,32 +278,33 @@ private:
 	uint16 *_hScrollTable;
 	uint16 *_spriteTable;
 	uint8 *_spriteMask;
+	uint8 *_spriteMaskPrio;
 	uint8 _hScrollMode;
 	uint8 _vScrollMode;
 	uint16 _numSpritesMax;
 	uint8 _backgroundColor;
 
-	struct PrioTileRenderObj {
-		PrioTileRenderObj(PrioTileRenderObj *chainEnd, uint8 *dst, uint8 *mask, const uint8 *src, int start, int end, uint8 pal, bool hflip) :
-			_pred(chainEnd), _next(0), _dst(dst), _mask(mask), _src(src), _start(start), _end(end), _pal(pal), _hflip(hflip) {
-			if (_pred)
-				_pred->_next = this;
-		}
-		uint8 *_dst;
-		uint8 *_mask;
-		const uint8 *_src;
-		int _start;
-		int _end;
-		uint8 _pal;
-		bool _hflip;
-		PrioTileRenderObj *_pred;
-		PrioTileRenderObj *_next;
+	uint8 *_tempBufferSprites;
+	uint8 *_tempBufferSpritesPrio;
+	uint8 *_tempBufferPlanes;
+	uint8 *_tempBufferPlanesPrio;
+	uint32 *_renderColorTable;
+
+	const PixelFormat _pixelFormat;
+	bool _displayEnabled;
+
+	enum RenderResult : uint16 {
+		kUnspecified		=		0,
+		kHasSprites			=		1	<<	0,
+		kHasPrioSprites		=		1	<<	1
 	};
 
-#if SEGA_USE_MEMPOOL
-	Common::ObjectPool<PrioTileRenderObj> _prioRenderMemPool;
-#endif
-	PrioTileRenderObj *_prioChainStart, *_prioChainEnd;
+	uint16 _rr;
+
+	bool _hINTEnable;
+	uint8 _hINTCounterNext;
+	uint8 _hINTCounter;
+	const HINTHandler *_hINTHandler;
 };
 
 } // End of namespace Graphics


Commit: 5d8263f0c9d869c3cd901673c6d65be82ce2d005
    https://github.com/scummvm/scummvm/commit/5d8263f0c9d869c3cd901673c6d65be82ce2d005
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix some intro transitions

Changed paths:
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/palette.h
    engines/snatcher/palette_scd.cpp
    engines/snatcher/render.h
    engines/snatcher/render_scd.cpp
    engines/snatcher/scene/scene_d0.cpp
    engines/snatcher/scene/scene_d1.cpp
    engines/snatcher/scene/scene_d2.cpp
    engines/snatcher/scroll.h
    engines/snatcher/scroll_scd.cpp
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h


diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 33df3747460..1455f23e285 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -27,22 +27,26 @@
 #include "snatcher/scroll.h"
 #include "common/endian.h"
 #include "common/system.h"
+#include "graphics/pixelformat.h"
 
 namespace Snatcher {
 
-GraphicsEngine::GraphicsEngine(OSystem *system, Common::Platform platform, const VMInfo &vmstate) : _system(system), _state(vmstate), _renderer(0), _dataMode(0), _screen(nullptr), _flags(0) {
-	_palette = Palette::create(_system->getPaletteManager(), platform, _state);
+GraphicsEngine::GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate) : _system(system), _state(vmstate),
+	_renderer(0), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _flags(0) {
+
+	_palette = Palette::create(pxf, _system->getPaletteManager(), platform, _state);
 	assert(_palette);
 	_scroll = ScrollManager::create(platform, _state);
-	_renderer = Renderer::create(platform, _state, _palette, _scroll);
+	_renderer = Renderer::create(pxf, platform, _state, _palette, _scroll);
 	assert(_renderer);
-	_screen = new uint8[_renderer->screenWidth() * _renderer->screenHeight()]();
+	_screen = new uint8[_renderer->screenWidth() * _renderer->screenHeight() * pxf->bytesPerPixel]();
 	assert(_screen);
 }
 
 GraphicsEngine::~GraphicsEngine() {
 	delete _renderer;
 	delete _palette;
+	delete _scroll;
 	delete[] _screen;
 }
 
@@ -119,10 +123,10 @@ void GraphicsEngine::updateAnimations() {
 
 void GraphicsEngine::nextFrame() {
 	_palette->processEventQueue();
+	_palette->updateSystemPalette();
 	_renderer->updateScreen(_screen);
 
-	_system->copyRectToScreen(_screen, _renderer->screenWidth(), 0, 0, _renderer->screenWidth(), _renderer->screenHeight());
-	_palette->updateSystemPalette();
+	_system->copyRectToScreen(_screen, _renderer->screenWidth() * _bpp, 0, 0, _renderer->screenWidth(), _renderer->screenHeight());
 	_system->updateScreen();
 
 	_state.nextFrame();
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index b6fca6c6b9f..d654566692f 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -22,12 +22,17 @@
 #ifndef SNATCHER_GRAPHICS_H
 #define SNATCHER_GRAPHICS_H
 
+#include "common/func.h"
 #include "common/platform.h"
 #include "snatcher/info.h"
 #include "snatcher/resource.h"
 
 class OSystem;
 
+namespace Graphics {
+	struct PixelFormat;
+}
+
 namespace Snatcher {
 
 class Palette;
@@ -37,7 +42,7 @@ class SceneModule;
 
 class GraphicsEngine {
 public:
-	GraphicsEngine(OSystem *system, Common::Platform platform, const VMInfo &vmstate);
+	GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate);
 	~GraphicsEngine();
 
 	void runScript(ResourcePointer res, int func);
@@ -147,6 +152,7 @@ private:
 	void restoreDefaults();
 
 	GfxState _state;
+	const uint8 _bpp;
 	uint8 _dataMode;
 	uint8 _flags;
 
diff --git a/engines/snatcher/palette.h b/engines/snatcher/palette.h
index 0ff7f67226e..d542169ce89 100644
--- a/engines/snatcher/palette.h
+++ b/engines/snatcher/palette.h
@@ -23,15 +23,22 @@
 #define SNATCHER_PALETTE_H
 
 #include "common/platform.h"
+#include "graphics/pixelformat.h"
 #include "snatcher/graphics.h"
 
 class PaletteManager;
 
+namespace Graphics {
+	struct PixelFormat;
+}
+
 namespace Snatcher {
 
 class Palette {
 public:
-	Palette(PaletteManager *pm, GraphicsEngine::GfxState &state) : _palMan(pm), _gfxState(state) {}
+	Palette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state) : _pixelFormat(pxf ? *pxf : Graphics::PixelFormat::createFormatCLUT8()), _palMan(pm), _gfxState(state) {
+		assert(pm);
+	}
 	virtual ~Palette() {}
 
 	virtual bool enqueueEvent(ResourcePointer &res) { return true; }
@@ -39,19 +46,23 @@ public:
 	virtual void clearEvents() {}
 	virtual void setDefaults(int mode) {}
 	virtual void updateSystemPalette() {}
+	virtual void hINTCallback(void*) {}
+
+	virtual const uint8 *getSystemPalette() const { return nullptr; }
 
 protected:
+	const Graphics::PixelFormat _pixelFormat;
 	PaletteManager *_palMan;
 	GraphicsEngine::GfxState &_gfxState;
 
 private:
-	static Palette *createSegaPalette(PaletteManager *pm, GraphicsEngine::GfxState &state);
+	static Palette *createSegaPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state);
 
 public:
-	static Palette *create(PaletteManager *pm, Common::Platform platform, GraphicsEngine::GfxState &state) {
+	static Palette *create(const Graphics::PixelFormat *pxf, PaletteManager *pm, Common::Platform platform, GraphicsEngine::GfxState &state) {
 		switch (platform) {
 		case Common::kPlatformSegaCD:
-			return createSegaPalette(pm, state);
+			return createSegaPalette(pxf, pm, state);
 		default:
 			break;
 		};
diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index 7c15755515d..9f7e3790f35 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -29,22 +29,26 @@
 #include "common/endian.h"
 #include "common/func.h"
 #include "common/textconsole.h"
+
 #include "graphics/paletteman.h"
+#include "graphics/pixelformat.h"
+#include "graphics/segagfx.h"
 
 namespace Snatcher {
 
 class GraphicsEngine;
 class SCDPalette : public Palette {
 public:
-	SCDPalette(PaletteManager *pm, GraphicsEngine::GfxState &state);
+	SCDPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state);
 	~SCDPalette() override;
 
 	bool enqueueEvent(ResourcePointer &res) override;
 	void processEventQueue() override;
 	void clearEvents() override;
 	void setDefaults(int mode) override;
-
 	void updateSystemPalette() override;
+	void hINTCallback(void *segaRenderer) override;
+	const uint8 *getSystemPalette() const override { return _sysPalette; }
 
 private:
 	typedef Common::Functor1Mem<PalEventSCD*, void, SCDPalette> EventProc;
@@ -70,9 +74,21 @@ private:
 	uint16 *_colors;
 	uint16 *_colors2;
 	uint8 *_sysPalette;
+
+private:
+	typedef Common::Functor1Mem<Graphics::SegaRenderer*, void, SCDPalette> HINTFunc;
+	Common::Array<HINTFunc*> _hINTProcs;
+	const HINTFunc *_hINTHandler;
+
+	void setHINTHandler(uint8 num);
+
+	void hIntHandler_00(Graphics::SegaRenderer *sr);
+	void hIntHandler_23(Graphics::SegaRenderer *sr);
 };
 
-SCDPalette::SCDPalette(PaletteManager *pm, GraphicsEngine::GfxState &state) : Palette(pm, state), _eventProcs(), _eventQueue(nullptr), _eventCurPos(nullptr), _colors(nullptr), _colors2(nullptr), _sysPalette(nullptr) {
+SCDPalette::SCDPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state) : Palette(pxf, pm, state), _eventProcs(),
+	_eventQueue(nullptr), _eventCurPos(nullptr), _colors(nullptr), _colors2(nullptr), _sysPalette(nullptr), _hINTHandler(nullptr) {
+
 #define P_OP(a)	_eventProcs.push_back(new EventProc(this, &SCDPalette::event_##a));
 	_eventProcs.push_back(nullptr);
 	P_OP(palSet);
@@ -87,6 +103,10 @@ SCDPalette::SCDPalette(PaletteManager *pm, GraphicsEngine::GfxState &state) : Pa
 	P_OP(palClear);
 #undef P_OP
 
+	_hINTProcs.resize(24);
+	_hINTProcs[0] = new HINTFunc(this, &SCDPalette::hIntHandler_00);
+	_hINTProcs[23] = new HINTFunc(this, &SCDPalette::hIntHandler_23);
+
 	_eventQueue = _eventCurPos = new PalEventSCD[12];
 	_colors = new uint16[128]();
 	_colors2 = new uint16[128]();
@@ -99,7 +119,9 @@ SCDPalette::~SCDPalette() {
 	delete[] _colors2;
 	delete[] _sysPalette;
 
-	for (Common::Array<EventProc*>::iterator i = _eventProcs.begin(); i != _eventProcs.end(); ++i)
+	for (Common::Array<EventProc*>::const_iterator i = _eventProcs.begin(); i != _eventProcs.end(); ++i)
+		delete *i;
+	for (Common::Array<HINTFunc*>::const_iterator i = _hINTProcs.begin(); i != _hINTProcs.end(); ++i)
 		delete *i;
 }
 
@@ -120,8 +142,6 @@ bool SCDPalette::enqueueEvent(ResourcePointer &res) {
 		_eventCurPos->srcOffsets = _eventCurPos->srcOffsetCur = reinterpret_cast<const uint32*>(res());
 		_eventCurPos->progress = 0;
 
-		debug("%s(): Changing color range %d to %d", __FUNCTION__, _eventCurPos->destOffset, _eventCurPos->destOffset + _eventCurPos->len);
-
 		if (_eventCurPos->cmd & 0x80) {
 			_eventCurPos->cmd &= ~0x80;
 			for (int ii = 0; ii < 12; ++ii) {
@@ -167,7 +187,6 @@ void SCDPalette::setDefaults(int mode) {
 	if (mode == 0) {
 		int cnt = (_gfxState.testFlag(1, 1) || _gfxState.getVar(5)) ? 64 : 48;
 		_gfxState.clearFlag(1, 1);
-		debug("%s(): Clearing palette range %d to %d", __FUNCTION__, 64 - cnt, 64);
 		Common::fill<uint16*, uint16>(&_colors[64 - cnt], &_colors[cnt], 0);
 		if (_gfxState.testFlag(1, 2)) {
 			_gfxState.clearFlag(1, 2);
@@ -232,7 +251,15 @@ void SCDPalette::updateSystemPalette() {
 #endif
 	}
 
-	_palMan->setPalette(_sysPalette, 0, 256);
+	if (_pixelFormat.bytesPerPixel == 1)
+		_palMan->setPalette(_sysPalette, 0, 256);
+}
+
+void SCDPalette::hINTCallback(void *segaRenderer) {
+	Graphics::SegaRenderer *sr = static_cast<Graphics::SegaRenderer *>(segaRenderer);
+
+
+	sr->setRenderColorTable(_sysPalette, 0, 64);
 }
 
 void SCDPalette::event_palSet(PalEventSCD *evt) {
@@ -375,7 +402,6 @@ void SCDPalette::event_palFadeToPal(PalEventSCD *evt) {
 void SCDPalette::event_palClear(PalEventSCD *evt) {
 	if (updateDelay(evt))
 		return;
-	debug("%s(): Clearing color range %d to %d", __FUNCTION__, evt->destOffset, evt->destOffset + evt->len);
 	uint16 *dst = &_colors[evt->destOffset];
 	Common::fill<uint16*, uint16>(dst, &dst[evt->len], 0);
 	evt->cmd = 0;
@@ -415,8 +441,23 @@ void SCDPalette::fadeStep(uint16 *modColor, uint16 toR, uint16 toG, uint16 toB)
 	*modColor = (r | g | b);
 }
 
-Palette *Palette::createSegaPalette(PaletteManager *pm, GraphicsEngine::GfxState &state) {
-	return new SCDPalette(pm, state);
+void SCDPalette::setHINTHandler(uint8 num) {
+	if (num < _hINTProcs.size())
+		_hINTHandler = _hINTProcs[num];
+	 else
+		error("%s(): Invalid HINT handler %d", __FUNCTION__, num);
+}
+
+void SCDPalette::hIntHandler_00(Graphics::SegaRenderer *segaRenderer) {
+	
+}
+
+void SCDPalette::hIntHandler_23(Graphics::SegaRenderer *segaRenderer) {
+	
+}
+
+Palette *Palette::createSegaPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state) {
+	return new SCDPalette(pxf, pm, state);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/render.h b/engines/snatcher/render.h
index cad46a3cfd5..47a1fc0a9ee 100644
--- a/engines/snatcher/render.h
+++ b/engines/snatcher/render.h
@@ -56,13 +56,13 @@ protected:
 	GraphicsEngine::GfxState &_gfxState;
 
 private:
-	static Renderer *createSegaRenderer(GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr);
+	static Renderer *createSegaRenderer(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr);
 
 public:
-	static Renderer *create(Common::Platform platform, GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr) {
+	static Renderer *create(const Graphics::PixelFormat *pxf, Common::Platform platform, GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr) {
 		switch (platform) {
 		case Common::kPlatformSegaCD:
-			return createSegaRenderer(state, pal, scr);
+			return createSegaRenderer(pxf, state, pal, scr);
 		default:
 			break;
 		};
diff --git a/engines/snatcher/render_scd.cpp b/engines/snatcher/render_scd.cpp
index 403339d7e8c..6c0334469a0 100644
--- a/engines/snatcher/render_scd.cpp
+++ b/engines/snatcher/render_scd.cpp
@@ -22,6 +22,7 @@
 
 #include "common/debug.h"
 #include "common/endian.h"
+#include "graphics/pixelformat.h"
 #include "graphics/segagfx.h"
 #include "snatcher/graphics.h"
 #include "snatcher/palette.h"
@@ -33,7 +34,7 @@
 namespace Snatcher {
 
 struct AnimObject {
-	AnimObject() : enable(0), delay(0), drawFlags(0), posX(0), posY(0), speedXa(0), speedYa(0), f16(0), f18(0), f1c(0), timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0), res(), scriptData(), spriteData(0), speedX(0), speedY(0), parent(0), children(0), next(0), f4e(0), f4f(0) {}
+	AnimObject() : enable(0), slowDown(0), drawFlags(0), posX(0), posY(0), speedXa(0), speedYa(0), f16(0), f18(0), f1c(0), timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0), res(), scriptData(), spriteData(0), speedX(0), speedY(0), parent(0), children(0), next(0), f4e(0), f4f(0) {}
 
 	void clear() {
 		*this = Common::move(AnimObject());
@@ -78,7 +79,7 @@ struct AnimObject {
 	}
 
 	uint16 enable;
-	uint16 delay;
+	uint16 slowDown;
 	uint16 drawFlags;
 	uint32 posX;
 	uint32 posY;
@@ -113,9 +114,9 @@ struct AnimObject {
 };
 
 class GraphicsEngine;
-class Renderer_SCD : public Renderer {
+class Renderer_SCD : public Renderer, public Graphics::SegaRenderer::HINTClient {
 public:
-	Renderer_SCD(GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr);
+	Renderer_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr);
 	~Renderer_SCD() override;
 
 	bool enqueueCopyCommands(ResourcePointer &res) override;
@@ -138,6 +139,8 @@ public:
 	uint16 screenWidth() const override { return _screenWidth; }
 	uint16 screenHeight() const override { return _screenHeight; }
 
+	void hINTCallback(Graphics::SegaRenderer *sr) override;
+
 private:
 	void loadDataFromGfxScript();
 	void executeCopyCommands();
@@ -163,6 +166,7 @@ private:
 	Graphics::SegaRenderer *_sr;
 	Palette *_pal;
 	ScrollManager *_scroll;
+	const Graphics::SegaRenderer::HINTHandler _hINTClientProc;
 
 private:
 	AnimObject *_animations;
@@ -241,12 +245,14 @@ private:
 	void anim_setGroupParameter(AnimObject &a, int pata, uint16 val = 0, bool recursive = false);
 };
 
-Renderer_SCD::Renderer_SCD(GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr) : Renderer(state), _pal(pal), _scroll(scr), _screenWidth(256), _screenHeight(224), _transferData(), _transferMode(0),
-	_transferDelay(0), _clearFlags(0), _mode(1), _modeChange(0), _tempBuffer(nullptr), _spriteBuffer(nullptr), _sr(nullptr), _animations(nullptr), _copyCommands(nullptr) {
+Renderer_SCD::Renderer_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr) : Renderer(state), _pal(pal), _scroll(scr), _mode(1),
+	_modeChange(0), _screenWidth(256), _screenHeight(224), _transferData(), _transferMode(0), _transferDelay(0), _clearFlags(0), _tempBuffer(nullptr), _spriteBuffer(nullptr), _sr(nullptr),
+		_animations(nullptr), _copyCommands(nullptr), _hINTClientProc(Graphics::SegaRenderer::HINTHandler(this, &Graphics::SegaRenderer::HINTClient::hINTCallback)) {
 
 	makeAnimFunctions();
 
-	_sr = new Graphics::SegaRenderer();
+	assert(pxf);
+	_sr = new Graphics::SegaRenderer(pxf);
 	assert(_sr);
 
 	_tempBuffer = new uint8[0x10000]();
@@ -265,7 +271,7 @@ Renderer_SCD::Renderer_SCD(GraphicsEngine::GfxState &state, Palette *pal, Scroll
 	_sr->setupWindowPlane(0, 0, Graphics::SegaRenderer::kWinToLeft, Graphics::SegaRenderer::kWinToTop);
 	_sr->setVScrollMode(Graphics::SegaRenderer::kVScrollFullScreen);
 	_sr->setHScrollMode(Graphics::SegaRenderer::kHScrollFullScreen);
-	_sr->setPitch(64);
+	_sr->hINT_setHandler(&_hINTClientProc);
 
 	reconfigPlanes();
 }
@@ -391,6 +397,7 @@ void Renderer_SCD::updateScreen(uint8 *screen) {
 	drawSprites();
 	updateScrollState();
 
+	_sr->setRenderColorTable(_pal->getSystemPalette(), 0, 64);
 	_sr->render(screen);
 }
 
@@ -458,6 +465,13 @@ bool Renderer_SCD::anim_isEnabled(uint8 animObjId) const {
 	return _animations[animObjId].enable != 0;
 }
 
+void Renderer_SCD::hINTCallback(Graphics::SegaRenderer *sr) {
+	if (_pal)
+		_pal->hINTCallback(sr);
+	if (_scroll)
+		_scroll->hINTCallback(sr);
+}
+
 void Renderer_SCD::loadDataFromGfxScript() {
 	if (_gfxState.getVar(0)) {
 		if (_gfxState.getVar(0) == 1) {
@@ -623,7 +637,7 @@ void Renderer_SCD::executeCopyCommands() {
 void Renderer_SCD::drawSprites() {
 	for (int i = 63; i >= 0; --i) {
 		AnimObject &a = _animations[i];
-		if (a.enable && a.spriteData != nullptr && !(a.controlFlags & GraphicsEngine::kAnimHide) && a.delay != 0xFFFF && !(a.delay & _gfxState.frameCount()))
+		if (a.enable && a.spriteData != nullptr && !(a.controlFlags & GraphicsEngine::kAnimHide) && a.slowDown != 0xFFFF && !(a.slowDown & _gfxState.frameCount()))
 			drawSprite(a);
 		if (i == 32)
 			updateAnim32Spec(a);
@@ -1017,7 +1031,6 @@ void Renderer_SCD::reconfigPlanes() {
 	};
 
 	_sr->setupPlaneAB(dimCfgData[_mode][0], dimCfgData[_mode][1]);
-	_sr->setPitch(dimCfgData[_mode][0] >> 3);
 
 	const uint16 *in = memCfgData[_mode];
 	_sr->setPlaneTableLocation(Graphics::SegaRenderer::kPlaneA, *in++);
@@ -1081,6 +1094,13 @@ void Renderer_SCD::updateScrollState() {
 
 	const ScrollManager::ScrollState &s = _scroll->getState();
 
+	if (s.hInt.needUpdate) {
+		_sr->hINT_enable(s.hInt.enable);
+		_sr->hINT_setCounter(s.hInt.counter);
+		if (!s.hInt.enable)
+			_sr->enableDisplay(true);
+	}
+
 	if (!s.disableVScroll) {
 		_sr->writeUint16VSRAM(0, TO_BE_16(s.offsets[ScrollManager::kVertA] & 0x3FF));
 		_sr->writeUint16VSRAM(2, TO_BE_16(s.offsets[ScrollManager::kVertB] & 0x3FF));
@@ -1100,7 +1120,7 @@ void Renderer_SCD::drawSprite(AnimObject &a) {
 	const uint16 *in = a.spriteData;
 	uint16 num = FROM_BE_16(*in++);
 	uint16 *d = _spriteBuffer;
-	memset(d, 0, 8);
+	memset(d, 0, 4 * sizeof(uint16));
 	int nxt = 1;
 
 	uint32 curY = a.posY + 0x800000;
@@ -1542,8 +1562,8 @@ void Renderer_SCD::anim_setGroupParameter(AnimObject &a, int para, uint16 val, b
 	}
 }
 
-Renderer *Renderer::createSegaRenderer(GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr) {
-	return new Renderer_SCD(state, pal, scr);
+Renderer *Renderer::createSegaRenderer(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr) {
+	return new Renderer_SCD(pxf, state, pal, scr);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/scene/scene_d0.cpp b/engines/snatcher/scene/scene_d0.cpp
index 9677bf2e939..b366ccbdf60 100644
--- a/engines/snatcher/scene/scene_d0.cpp
+++ b/engines/snatcher/scene/scene_d0.cpp
@@ -132,7 +132,7 @@ SH_IMPL_UPDT(D0) {
 	} else if (_vm->sound()->musicGetTime() >= _timeStamp[state.frameNo]) {
 		(*_frameProcs[state.frameNo])(state);
 		++state.frameNo;
-	} else if (_vm->_commandsFromMain & 0x80) {
+	} else if (_vm->inputFlag() & 0x80) {
 		state.finish = -1;
 		state.frameNo = 0;
 	}
diff --git a/engines/snatcher/scene/scene_d1.cpp b/engines/snatcher/scene/scene_d1.cpp
index 00fd62c9dfd..81820c730a2 100644
--- a/engines/snatcher/scene/scene_d1.cpp
+++ b/engines/snatcher/scene/scene_d1.cpp
@@ -122,7 +122,7 @@ SH_IMPL_UPDT(D1) {
 	} else if (_vm->sound()->musicGetTime() >= _timeStamp[state.frameNo]) {
 		(*_frameProcs[state.frameNo])(state);
 		++state.frameNo;
-	} else if (_vm->_commandsFromMain & 0x80) {
+	} else if (_vm->inputFlag() & 0x80) {
 		state.finish = -1;
 		state.frameNo = 0;
 	}
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene/scene_d2.cpp
index 32b8e994858..a56a5cd52b8 100644
--- a/engines/snatcher/scene/scene_d2.cpp
+++ b/engines/snatcher/scene/scene_d2.cpp
@@ -108,11 +108,11 @@ SH_IMPL_FRM(D2, 00) {
 		}
 		break;
 	case 2:
-		if (_vm->_commandsFromMain & 3) {
+		if (_vm->inputFlag() & 3) {
 			_vm->gfx()->clearAnimControlFlags(16, ~GraphicsEngine::kAnimHide);
 			_buram_0 ^= 1;
 		}
-		if (_vm->_commandsFromMain & 0x80) {
+		if (_vm->inputFlag() & 0x80) {
 			state.counter = 10;
 			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
 			++state.frameState;
@@ -253,9 +253,9 @@ SH_IMPL_FRM(D2, 09) {
 		state.frameState += (hasSaveFiles ? 1 : 2);
 		break;
 	case 1:
-		if (_vm->_commandsFromMain & 3)
+		if (_vm->inputFlag() & 3)
 			_vm->gfx()->clearAnimControlFlags(17, ~GraphicsEngine::kAnimHide);
-		if (_vm->_commandsFromMain & 0x80) {
+		if (_vm->inputFlag() & 0x80) {
 			_vm->gfx()->setAnimControlFlags(17, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 			wordA = 1;
 			if (_vm->gfx()->getAnimCurFrame(17) == 3) {
@@ -272,7 +272,7 @@ SH_IMPL_FRM(D2, 09) {
 		}
 		break;
 	default:
-		if (_vm->_commandsFromMain & 0x80) {
+		if (_vm->inputFlag() & 0x80) {
 			++state.frameNo;
 			state.frameState = 0;
 		}
@@ -371,7 +371,7 @@ SH_IMPL_FRM(D2, 11) {
 		++state.frameState;
 		break;
 	case 3:
-		if (_vm->_commandsFromMain & 0x80) {
+		if (_vm->inputFlag() & 0x80) {
 			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
 			state.counter = 10;
 			state.frameState = 0;
diff --git a/engines/snatcher/scroll.h b/engines/snatcher/scroll.h
index e7131e1eae5..8b2e3b6d675 100644
--- a/engines/snatcher/scroll.h
+++ b/engines/snatcher/scroll.h
@@ -44,9 +44,11 @@ public:
 		uint16 hScrollTableNumEntries;
 		bool disableVScroll;
 		bool lineScrollMode;
-		bool hINTEnable;
-		int hINTCounter;
-		void *hINTProc;
+		struct HINT {
+			bool needUpdate;
+			bool enable;
+			uint8 counter;
+		} hInt;
 	};
 
 	ScrollManager() {
@@ -59,10 +61,8 @@ public:
 	virtual void setDirectionAndSpeed(int mode, int16 incr) = 0;
 	virtual void clear() = 0;
 	virtual bool nextFrame() = 0;
-
-	const ScrollState &getState() const {
-		return _result;
-	}
+	virtual void hINTCallback(void*) {}
+	const ScrollState &getState() const { return _result; }
 
 protected:
 	ScrollState _result;
diff --git a/engines/snatcher/scroll_scd.cpp b/engines/snatcher/scroll_scd.cpp
index 4f632a71ef5..5b43b17cc2a 100644
--- a/engines/snatcher/scroll_scd.cpp
+++ b/engines/snatcher/scroll_scd.cpp
@@ -22,12 +22,13 @@
 
 #include "snatcher/graphics.h"
 #include "snatcher/scroll.h"
+#include "graphics/segagfx.h"
 
 namespace Snatcher {
 
 class ScrollInternalState {
 public:
-	ScrollInternalState() : _offsSingle(0), _offsRep(0), _curPos(0), _curResult(0), _factor(1) {}
+	ScrollInternalState() : _offsSingle(0), _offsRep(0), _curPos(0), _curResult(0), _factor(1), _override(0) {}
 
 	void singleStep(int16 step) {
 		_offsSingle = step << 16;
@@ -41,6 +42,10 @@ public:
 		_factor = factor;
 	}
 
+	void setNextOffset(int16 offs) {
+		_override = offs;
+	}
+
 	void clear() {
 		_offsSingle = 0;
 		_offsRep = 0;
@@ -59,8 +64,8 @@ public:
 		return changed;
 	}
 
-	int16 getOffset() const {
-		return _curResult * _factor;
+	int16 getOffset(bool override) const {
+		return override ? _override : _curResult * _factor;
 	}
 
 private:
@@ -69,9 +74,10 @@ private:
 	int32 _curPos;
 	int16 _curResult;
 	int16 _factor;
+	int16 _override;
 };
 
-class ScrollManager_SCD : public ScrollManager {
+class ScrollManager_SCD final : public ScrollManager {
 public:
 	enum {
 		kHorzA = 0,
@@ -98,9 +104,12 @@ public:
 	void clear() override;
 	bool nextFrame() override;
 
+	void hINTCallback(void *segaRenderer) override;
+
 private:
-	bool processCmdInternal();
-	void startTransition();
+	void processCmdInternal();
+	void processTransition();
+	void resetVars(int groupFlags);
 
 	GraphicsEngine::GfxState &_gfxState;
 	ScrollInternalState *_internalState;
@@ -117,18 +126,17 @@ private:
 	uint8 _scrollCmd_0xff_0xfd_0xfc_or0to6_last;
 	uint8 _nextStepExt;
 	uint8 _lastStepExt;
-	int16 _lastVScrollOffset;
-	int16 _lastHScrollOffset;
 	int16 _scrollFlagttt;
 	int16 _scrollu_7;
 	int16 _hint_proc;
 	int16 _transitionType;
 	int16 _transitionState;
+	int16 _transitionStep;
 	int16 _scrollu_5;
 	int16 _subPara;
 	uint32 _scroll__DA;
 	uint16 _scroll__DB;
-	bool _needRefresh;
+	bool useEngineScrollOffsets;
 
 private:
 	typedef Common::Functor1Mem<int, void, ScrollManager_SCD> ScrollFunc;
@@ -138,13 +146,13 @@ private:
 	void doCommandIntern(int cmd, int arg);
 
 	void scrUpdt_dummy(int arg);
-	void scrUpdt_setHScrollFullScreen(int arg);
+	void scrUpdt_engineScroll(int arg);
 	void scrUpdt_03(int arg);
 	void scrUpdt_04(int arg);
 	void scrUpdt_05(int arg);
 	void scrUpdt_06(int arg);
-	void scrUpdt_07(int arg);
-	void scrUpdt_08(int arg);
+	void scrUpdt_screenShutter(int arg);
+	void scrUpdt_revealShutter(int arg);
 	void scrUpdt_13(int arg);
 	void scrUpdt_14(int arg);
 	void scrUpdt_15(int arg);
@@ -162,12 +170,20 @@ private:
 	void scrUpdt_27(int arg);
 	void scrUpdt_28(int arg);
 	void scrUpdt_29(int arg);
-};
 
+	typedef Common::Functor1Mem<Graphics::SegaRenderer*, void, ScrollManager_SCD> HINTFunc;
+	Common::Array<HINTFunc*> _hINTProcs;
+	const HINTFunc *_hINTHandler;
+
+	void setHINTHandler(uint8 num);
 
-ScrollManager_SCD::ScrollManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0), _hint_proc(0),
-	_scrollCommandExt(0), _scrollCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _scroll__DA(0), _scroll__DB(0), _scrollCmd_0xff_0xfd_0xfc_or0to6_last(0),
-	_lastVScrollOffset(0), _scrollFlagttt(0), _scrollu_7(0), _transitionType(0), _transitionState(0), _scrollu_5(0), _subPara(0), _lastHScrollOffset(0), _needRefresh(false) {
+	void hIntHandler_screenShutter(Graphics::SegaRenderer *sr);
+	void hIntHandler_revealShutter(Graphics::SegaRenderer *sr);
+};
+
+ScrollManager_SCD::ScrollManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0), _hint_proc(0), _transitionStep(0),
+	_scrollCommandExt(0), _scrollCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _scroll__DA(0), _scroll__DB(0), _scrollCmd_0xff_0xfd_0xfc_or0to6_last(0), _scrollFlagttt(0),
+	_scrollu_7(0), _transitionType(0), _transitionState(0), _scrollu_5(0), _subPara(0), useEngineScrollOffsets(false), _hINTHandler(nullptr) {
 	_internalState = new ScrollInternalState[4];
 	assert(_internalState);
 	_internalState[kVertA].setFactor(-1);
@@ -180,8 +196,10 @@ ScrollManager_SCD::ScrollManager_SCD(GraphicsEngine::GfxState &state) : _gfxStat
 ScrollManager_SCD::~ScrollManager_SCD() {
 	delete[] _internalState;
 	delete[] _hScrollTable;
-	for (uint i = 0; i < _scrollProcs.size(); ++i) \
-		delete _scrollProcs[i];
+	for (Common::Array<ScrollFunc*>::const_iterator i = _scrollProcs.begin(); i != _scrollProcs.end(); ++i)
+		delete *i;
+	for (Common::Array<HINTFunc*>::const_iterator i = _hINTProcs.begin(); i != _hINTProcs.end(); ++i)
+		delete *i;
 }
 
 void ScrollManager_SCD::doCommand(int cmd) {
@@ -216,7 +234,7 @@ bool ScrollManager_SCD::nextFrame() {
 			_nextStepExt = _scrollCommandExt;
 		if (_scrollCommand)
 			_nextStep = _scrollCommand;
-		_scrollCommandExt = 0;
+		_scrollCommand = _scrollCommandExt = 0;
 	} else {
 		_nextStep = _resetCommand;
 		_resetCommand = 0;
@@ -227,37 +245,36 @@ bool ScrollManager_SCD::nextFrame() {
 
 	if (_nextStepExt != _lastStepExt || _lastStepExt == 0) {
 		if (_nextStepExt == 0xFE) {
-			_scrollu_7 = 0;
-			_transitionType = 0;
-			_nextStepExt = 0;
 			if (_lastStepExt == 23) {
-				_lastVScrollOffset = 0;
+				_internalState[kVertA].setNextOffset(0);
+				_internalState[kVertB].setNextOffset(0);
 				if (_scrollFlagttt) {
-					_scrollFlagttt = 0;
+					resetVars(0x30);
 					_nextStepExt = _lastStepExt = 15;
+				} else {
+					resetVars(0x18);
 				}
 			}
 		} else if (_nextStepExt != 0 && (_nextStepExt != 15 || _lastStepExt != 23)) {
 			_lastStepExt = _nextStepExt;
-			_transitionState = _scrollu_5 = _subPara = 0;
-
+			resetVars(0x40);
 		} else if (_nextStepExt != 0) {
 			_nextStepExt = 23;
 			_scrollFlagttt = 1;
 		}
 	}
 
-	startTransition();
+	processTransition();
 
 	bool changed = false;
 	bool reset = _nextStep == 0xFF || _nextStep == 0xFC;
-	bool needRefresh = processCmdInternal();
 
-	if (needRefresh && _scrollType != 0 && !reset) {
+	if (_scrollType != 0 && !reset) {
 		for (int i = 0; i < 4; ++i) {
 			if (_internalState[i].recalc(_scrollType & 0x10))
 				changed = true;
-			_result.offsets[i] = _internalState[i].getOffset();
+			_result.offsets[i] = _internalState[i].getOffset(!(changed || useEngineScrollOffsets));
+			_internalState[i].setNextOffset(_result.offsets[i]);
 		}
 		_result.hScrollTable = _hScrollTable;
 		_result.hScrollTableNumEntries = _hScrollTableLen;
@@ -265,37 +282,27 @@ bool ScrollManager_SCD::nextFrame() {
 		_scrollType &= ~0x10;
 	}
 
-	return changed || reset;
+	processCmdInternal();
+
+	return changed || reset || _result.hInt.needUpdate;
+}
+
+void ScrollManager_SCD::hINTCallback(void *segaRenderer) {
+	if (_hINTHandler && _hINTHandler->isValid())
+		(*_hINTHandler)(static_cast<Graphics::SegaRenderer *>(segaRenderer));
 }
 
-bool ScrollManager_SCD::processCmdInternal() {
+void ScrollManager_SCD::processCmdInternal() {
 	if ((_nextStep != _lastStep || _lastStep == 0) && _nextStep != 0) {
 		if (_nextStep == 0xFF || _nextStep == 0xFC) {
-			if (_nextStep == 0xFF)
-				_result.hINTEnable = false;
-			_nextStep = _lastStep = 0;
-			_nextStepExt = 0;
-			_transitionType = 0;
-			_transitionState = _scrollu_5 = _subPara = _scrollu_7 = 0;
-			_scrollFlagttt = 0;
-			_scroll__DA = 0;
-			_scroll__DB = 0;
-			_lastHScrollOffset = 0;
-			_lastVScrollOffset = 0;
-			_needRefresh = false;
-			_scrollCmd_0xff_0xfd_0xfc_or0to6_last = 0;
-			_result.lineScrollMode = false;
-			//_scrolloa = 0;
-			//_scrollob = 0;
-			return _needRefresh;
+			resetVars(_nextStep == 0xFF ? 0x0F : 0x0E);
+			return;
 		} else if (_nextStep == 0xFD) {
 			_scrollCmd_0xff_0xfd_0xfc_or0to6_last |= 0x80;
 		} else {
 			_lastStep = _nextStep;
 			if (_nextStep < 3) {
-				_needRefresh = false;
-				//_scrolloa = 0;
-				//_scrollob = 0;
+				resetVars(0x08);
 			} else {
 				_scroll__DA = 0;
 				_scrollCmd_0xff_0xfd_0xfc_or0to6_last = 0;
@@ -315,76 +322,107 @@ bool ScrollManager_SCD::processCmdInternal() {
 		doCommandIntern(_nextStep, _subPara);
 
 	doCommandIntern(_nextStepExt, _subPara);
-
-	return _needRefresh;
 }
 
-void ScrollManager_SCD::startTransition() {
+void ScrollManager_SCD::processTransition() {
+	_result.hInt.enable = false;
 	if (_transitionType == 0)
 		return;
 
+	_transitionStep = 0;
+
 	switch (_transitionType) {
 	case 1:
-		_result.hINTCounter = 15;
-		//_result.hINTProc = (void *)_hint_proc7;
-		if (--_transitionState <= 0)
+		_result.hInt.counter = 15;
+		if (--_transitionState <= 0) {
+			_internalState[kVertA].setNextOffset(0);
+			_internalState[kVertB].setNextOffset(0);
 			return;
-		_result.offsets[kVertA] = _result.offsets[kVertB] = (_transitionState > 1) ? 0x30 : 0x10;
+		}
+		_internalState[kVertA].setNextOffset(_transitionState > 1 ? 0x30 : 0x10);
+		_internalState[kVertB].setNextOffset(_transitionState > 1 ? 0x30 : 0x10);
 		break;
-	case 2:
-	case 3:
-	case 4:
-	case 5:
-	case 6:
-		_result.hINTCounter = 7;
+	case 2: case 3: case 4: case 5: case 6:
+		_result.hInt.counter = 7;
 		break;
-	case 7:
-	case 8:
+	case 7: case 8:
 		break;
 	case 9:
 		break;
-	case 10:
-	case 11:
+	case 10: case 11:
 		break;
-	case 12:
-	case 13:
-	case 14:
-	case 15:
-	case 16:
+	case 12: case 13: case 14: case 15: case 16:
 		break;
 	case 17:
 		break;
-	case 18:
-	case 19:
-	case 20:
-	case 21:
+	case 18: case 19: case 20: case 21:
 		break;
-	case 22:
-	case 23:
+	case 22: case 23:
 		break;
 	default:
 		break;
 	}
-	_result.hINTEnable = true;
+	_result.hInt.enable = true;
+	_result.hInt.needUpdate = true;
+}
+
+void ScrollManager_SCD::resetVars(int groupFlags) {
+	if (groupFlags & 0x01) {
+		_result.hInt.enable = false;
+		_result.hInt.needUpdate = true;
+	}
+	if (groupFlags & 0x02) {
+		_scrollCmd_0xff_0xfd_0xfc_or0to6_last = 0;
+		_scroll__DA = 0;
+		_scroll__DB = 0;
+		_nextStepExt = 0;
+		_transitionType = _transitionState = _scrollu_5 = _subPara = _scrollu_7 = 0;
+		_scrollFlagttt = 0;
+
+	}
+	if (groupFlags & 0x04) {
+		_nextStep = _lastStep = 0;
+		_result.lineScrollMode = false;
+		for (int i = 0; i < 4; ++i)
+			_internalState[i].setNextOffset(0);
+	}
+	if (groupFlags & 0x08) {
+		useEngineScrollOffsets = false;
+		//_scrolloa = 0;
+		//_scrollob = 0;
+	}
+	if (groupFlags & 0x10) {
+		_nextStepExt = _lastStepExt = 0;
+		_transitionType = _scrollu_7 = 0;
+	}
+	if (groupFlags & 0x20) {
+		_scrollFlagttt = 0;
+		_internalState[kVertA].setNextOffset(0);
+		_internalState[kVertB].setNextOffset(0);
+	}
+	if (groupFlags & 0x40) {
+		_transitionState = _scrollu_5 = _subPara = 0;
+	}
 }
 
 #define SF(x) &ScrollManager_SCD::scrUpdt_##x
+#define HF(x) &ScrollManager_SCD::hIntHandler_##x
 void ScrollManager_SCD::makeFunctions() {
 	typedef void (ScrollManager_SCD::*ScrFunc)(int);
 	static const ScrFunc funcTbl[] = {
 		SF(dummy),
-		SF(setHScrollFullScreen),
-		SF(setHScrollFullScreen),
+		SF(engineScroll),
+		SF(engineScroll),
 		SF(03),
 		SF(04),
 		SF(05),
 		SF(06),
-		SF(07),
-		SF(08),
-		SF(08),
-		SF(08),
-		SF(08),
-		SF(08),
+		SF(screenShutter),
+		SF(revealShutter),
+		SF(revealShutter),
+		SF(revealShutter),
+		SF(revealShutter),
+		SF(revealShutter),
 		SF(13),
 		SF(14),
 		SF(15),
@@ -406,7 +444,26 @@ void ScrollManager_SCD::makeFunctions() {
 
 	for (uint i = 0; i < ARRAYSIZE(funcTbl); ++i) \
 		_scrollProcs.push_back(new ScrollFunc(this, funcTbl[i]));
+
+	typedef void (ScrollManager_SCD::*HIFunc)(Graphics::SegaRenderer*);
+	static const HIFunc funcTbl2[] = {
+		nullptr,
+		nullptr,
+		nullptr,
+		nullptr,
+		nullptr,
+		nullptr,
+		nullptr,
+		HF(screenShutter),
+		HF(revealShutter),
+		nullptr,
+		nullptr
+	};
+
+	for (uint i = 0; i < ARRAYSIZE(funcTbl2); ++i) \
+		_hINTProcs.push_back(new HINTFunc(this, funcTbl2[i]));
 }
+#undef HF
 #undef SF
 
 void ScrollManager_SCD::doCommandIntern(int cmd, int arg) {
@@ -419,9 +476,9 @@ void ScrollManager_SCD::doCommandIntern(int cmd, int arg) {
 void ScrollManager_SCD::scrUpdt_dummy(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_setHScrollFullScreen(int arg) {
-	_result.lineScrollMode  = false;
-	_needRefresh = true;
+void ScrollManager_SCD::scrUpdt_engineScroll(int arg) {
+	_result.lineScrollMode = false;
+	useEngineScrollOffsets = true;
 }
 
 void ScrollManager_SCD::scrUpdt_03(int arg) {
@@ -436,41 +493,39 @@ void ScrollManager_SCD::scrUpdt_05(int arg) {
 void ScrollManager_SCD::scrUpdt_06(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_07(int arg) {
+void ScrollManager_SCD::scrUpdt_screenShutter(int arg) {
 	if (arg == 0) {
 		_transitionType = 1;
-		_hint_proc = 3278;
+		setHINTHandler(7);
 		_transitionState = 5;
 		++_subPara;
-		_nextStep = 0;
-		_lastHScrollOffset = 0;
-		_lastVScrollOffset = 0;
-		_needRefresh = false;
-		//_scrolloa = 0;
-		//_scrollob = 0;
+		resetVars(0x0C);
 	} else if (arg == 1) {
-		if (_transitionState < 0) {
-			_nextStep = _lastStep = 0;
-			_nextStepExt = 0;
-			_transitionType = 0;
-			_transitionState = _scrollu_5 = _subPara = _scrollu_7 = 0;
-			_scrollFlagttt = 0;
-			_scroll__DA = 0;
-			_scroll__DB = 0;
-			_lastHScrollOffset = 0;
-			_lastVScrollOffset = 0;
-			_needRefresh = false;
-			_scrollCmd_0xff_0xfd_0xfc_or0to6_last = 0;
-			_result.lineScrollMode = false;
-			//_scrolloa = 0;
-			//_scrollob = 0;
-		}
+		if (_transitionState < 0)
+			resetVars(0x0F);
 	} else {
 		error("%s(): Invalid arg %d", __FUNCTION__, arg);
 	}
 }
 
-void ScrollManager_SCD::scrUpdt_08(int arg) {
+void ScrollManager_SCD::scrUpdt_revealShutter(int arg) {
+	if (arg == 0) {
+		_transitionType = _nextStepExt - 6;
+		setHINTHandler(8);
+		_transitionState = 23;
+		++_subPara;
+		resetVars(0x0C);
+		_transitionState |= ((_transitionState & 0xFC) << 6);
+	} else {
+		_transitionState = (--_transitionState) & 0xFF;
+		if ((int8)(_transitionState) >= 0) {
+			_transitionState |= ((_transitionState & 0xFC) << 6);
+		} else {
+			_transitionState = 0;
+			if (_nextStepExt == 12)
+				resetVars(0x0F);
+		}
+	}
 }
 
 void ScrollManager_SCD::scrUpdt_13(int arg) {
@@ -524,6 +579,69 @@ void ScrollManager_SCD::scrUpdt_28(int arg) {
 void ScrollManager_SCD::scrUpdt_29(int arg) {
 }
 
+void ScrollManager_SCD::setHINTHandler(uint8 num) {
+	if (num < _hINTProcs.size())
+		_hINTHandler = _hINTProcs[num];
+	 else
+		error("%s(): Invalid HINT handler %d", __FUNCTION__, num);
+}
+
+void ScrollManager_SCD::hIntHandler_screenShutter(Graphics::SegaRenderer *sr) {
+	if (_transitionState <= 0 || _transitionStep == (_transitionState == 1 ? 8 : 10)) {
+		_result.hInt.enable = false;
+		sr->hINT_enable(false);
+		sr->enableDisplay(true);
+	} else if (_transitionStep == (_transitionState == 1 ? 6 : 4)) {
+		sr->enableDisplay(false);
+	} else if (_transitionStep == 7) {
+		sr->writeUint16VSRAM(0, TO_BE_16(_transitionState == 1 ? 0x3F0 : 0x3D0));
+	}
+	++_transitionStep;
+}
+
+void ScrollManager_SCD::hIntHandler_revealShutter(Graphics::SegaRenderer *sr) {
+	static const int8 actions[5][8] = {
+		{  0,  0,  7,  1,  8,  2, -1, -1 },
+		{  0,  4,  9,  3, 10,  1, 11,  2 },
+		{  0,  4, 12,  3, 13,  1, 14,  2 },
+		{  0,  4, 15,  3, 16,  1, 17,  2 },
+		{  0,  4, 18,  3, 19,  1, 20,  2 }
+	};
+
+	if (_transitionType < 2 || _transitionType > 6)
+		error("%s(): Invalid transition type %d", __FUNCTION__, _transitionType);
+
+	int a = -1;
+	for (const int8 *it = actions[_transitionType - 2]; it < &actions[_transitionType - 2][8] && a == -1; it += 2) {
+		if (_transitionStep == it[0])
+			a = it[1];
+	}
+
+	switch (a) {
+	case 0:
+	case 4:
+		sr->enableDisplay(true);
+		if (a == 4)
+			break;
+	// fall through
+	case 3:
+		sr->writeUint16VSRAM(0, TO_BE_16(-(_transitionState >> 8)));
+		break;
+	case 1:
+		sr->writeUint16VSRAM(0, TO_BE_16(_transitionState >> 8));
+		break;
+	case 2:
+		sr->enableDisplay(false);
+		sr->hINT_enable(false);
+		_result.hInt.enable = false;
+		break;
+	default:
+		break;
+	}
+
+	++_transitionStep;
+}
+
 ScrollManager *ScrollManager::createSegaScrollManager(GraphicsEngine::GfxState &state) {
 	return new ScrollManager_SCD(state);
 }
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 0269365025a..4ae8305b42f 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -27,13 +27,23 @@
 
 #include "common/endian.h"
 #include "common/events.h"
+#include "common/list.h"
 #include "common/system.h"
 
+#include "graphics/pixelformat.h"
+
 #include "engines/util.h"
 
+// Snatcher makes use of horizontal interrupts. These can be invoked after any given count of rendered scan lines.
+// These interrupts are mostly used for changing vertical scroll offsets, but some effects also change the colors.
+// In ScummVM, this can only work if we use at least 16bit color depth. 8 bit rendering will not allow the already
+// rendered pixels to keep their colors. So the following setting may cause color glitches and is just there for
+// backends that can't handle the required color depth.
+#define			SNATCHER_GFXMODE_8BIT			false
+
 namespace Snatcher {
 
-SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _gfx(nullptr), _snd(nullptr), _commandsFromMain(0), _gfxInfo() {
+SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _gfx(nullptr), _snd(nullptr), _keyInput(0), _lastKey(0), _gfxInfo() {
 }
 
 SnatcherEngine::~SnatcherEngine() {
@@ -52,7 +62,7 @@ Common::Error SnatcherEngine::run() {
 	if (!initSound(_game.platform, _game.soundOptions))
 		return Common::Error(Common::kAudioDeviceInitFailed);
 
-	if (!initGfx(_game.platform))
+	if (!initGfx(_game.platform, SNATCHER_GFXMODE_8BIT))
 		return Common::Error(Common::kUnknownError);
 
 	return Common::Error(start() ? Common::kNoError : Common::kUnknownError);
@@ -62,11 +72,33 @@ bool SnatcherEngine::initResource() {
 	return (_fio = new FIO(this, _game.isBigEndian));
 }
 
-bool SnatcherEngine::initGfx(Common::Platform platform) {
-	if (_gfx = new GraphicsEngine(_system, platform, _gfxInfo)) {
-		initGraphics(_gfx->screenWidth(), _gfx->screenHeight());
+bool SnatcherEngine::initGfx(Common::Platform platform, bool use8BitColorMode) {
+	Graphics::PixelFormat pxf;
+
+	if (use8BitColorMode) {
+		pxf = Graphics::PixelFormat::createFormatCLUT8();
+	} else {
+		Graphics::PixelFormat pxf16bit;
+		Common::List<Graphics::PixelFormat> modes = _system->getSupportedFormats();
+		for (Common::List<Graphics::PixelFormat>::const_iterator g = modes.begin(); g != modes.end() && pxf.bytesPerPixel == 0; ++g) {
+			if (g->aBits())
+				continue;
+			if (g->bytesPerPixel == 4)
+				pxf = *g;
+			else if (g->bytesPerPixel == 2)
+				pxf16bit = *g;
+		}
+		if (pxf.bytesPerPixel == 0)
+			pxf = pxf16bit;
+		if (pxf.bytesPerPixel == 0)
+			error("%s(): No suitable color mode found", __FUNCTION__);
+	}
+
+	if (_gfx = new GraphicsEngine(&pxf, _system, platform, _gfxInfo)) {
+		initGraphics(_gfx->screenWidth(), _gfx->screenHeight(), &pxf);
 		return true;
 	}
+
 	return false;
 }
 
@@ -137,24 +169,74 @@ bool SnatcherEngine::start() {
 }
 
 void SnatcherEngine::delayUntil(uint32 end) {
-	const uint32 frameLen = (1000 << 16) / 60;
 	uint32 cur = _system->getMillis();
 	_gfxInfo.dropFrames = /*cur > end ? ((cur - end) << 16) / frameLen :*/ 0;
 	if (cur < end)
 		_system->delayMillis(end - cur);
 }
 
+struct InputEvent {
+	Common::EventType pressType;
+	Common::EventType releaseType;
+	Common::KeyCode kc;
+	uint16 kFlag;
+	uint16 internalEvent;
+};
+
+static const InputEvent _inputEvents[] = {
+	{ Common::EVENT_LBUTTONDOWN, Common::EVENT_LBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x80 },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_UP, 0x00, 0x01 },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP8, Common::KBD_NUM, 0x01 },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_DOWN, 0x00, 0x02 },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP2, Common::KBD_NUM, 0x02 },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_LEFT, 0x00, 0x04 },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP4, Common::KBD_NUM, 0x04 },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_RIGHT, 0x00, 0x08 },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP6, Common::KBD_NUM, 0x08 }
+};
+
 void SnatcherEngine::updateEvents() {
 	Common::Event evt;
+	_keyInput = 0;
 	while (_eventMan->pollEvent(evt)) {
-		switch (evt.type) {
+		for (const InputEvent &k : _inputEvents) {
+			if (evt.type == k.pressType && (k.kc == Common::KEYCODE_INVALID || evt.kbd.keycode == k.kc) && (k.kFlag == 0 || (evt.kbd.flags & k.kFlag))) {
+				if (!(_lastKey & k.internalEvent)) {
+					_keyInput |= k.internalEvent;
+					_lastKey |= k.internalEvent;
+				}
+			} else if (evt.type == k.releaseType && (k.kc == Common::KEYCODE_INVALID || evt.kbd.keycode == k.kc) && (k.kFlag == 0 || (evt.kbd.flags & k.kFlag))) {
+				_lastKey &= ~k.internalEvent;
+			}
+		}
+
+		/*switch (evt.type) {
 		case Common::EVENT_LBUTTONDOWN:
-			_commandsFromMain |= (1 << 7);
+			_keyPressed |= (1 << 7);
+			break;
+		case Common::EVENT_LBUTTONUP:
+			_commandsFromMain |= _keyPressed;
+			break;
+		case Common::EVENT_KEYDOWN:
+			switch (evt.kbd.keycode) {
+			case Common::KEYCODE_LEFT:
+				break;
+			case Common::KEYCODE_RIGHT:
+				break;
+			case Common::KEYCODE_DOWN:
+			case Common::KEYCODE_KP2:
+				_keyPressed |= 2;
+				break;
+
+			if (!_keyPressed && (evt.kbd.keycode == Common::KEYCODE_DOWN || evt.kbd.keycode == Common::KEYCODE_UP || (evt.kbd.keycode == Common::KEYCODE_KP8 && (evt.kbd.flags & Common::KBD_NUM)) || (evt.kbd.keycode == Common::KEYCODE_KP2 && (evt.kbd.flags & Common::KBD_NUM))))
+				_keyPressed |= 3;
+		case Common::EVENT_KEYUP:
+			_commandsFromMain |= _keyPressed;
 			break;
 		default:
-			_commandsFromMain = 0;
+			_keyPressed = 0;
 			break;
-		}
+		}*/
 	}
 }
 
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index 119539833ce..2a194820782 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -48,7 +48,7 @@ private:
 	// Startup
 	Common::Error run() override;
 	bool initResource();
-	bool initGfx(Common::Platform platform);
+	bool initGfx(Common::Platform platform, bool use8BitColorMode);
 	bool initSound(Common::Platform platform, int soundOptions);
 
 	// Main loop
@@ -81,9 +81,11 @@ private:
 	// Sound
 	SoundEngine *_snd;
 
-public:
 	// Input
-	byte _commandsFromMain;
+	uint8 _lastKey;
+	uint8 _keyInput;
+public:
+	uint8 inputFlag() const { return _keyInput; }
 };
 
 } // End of namespace Snatcher


Commit: 2ef0cfe866cc1507790f183283bcbaa256a7b799
    https://github.com/scummvm/scummvm/commit/2ef0cfe866cc1507790f183283bcbaa256a7b799
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: add detection entry

Changed paths:
    engines/snatcher/detection_tables.h


diff --git a/engines/snatcher/detection_tables.h b/engines/snatcher/detection_tables.h
index 2b501b1f2ad..2f2ac4ba565 100644
--- a/engines/snatcher/detection_tables.h
+++ b/engines/snatcher/detection_tables.h
@@ -30,9 +30,22 @@ const SnatcherGameDescription adGameDescs[] = {
 	{
 		{
 			"snatcher",
-			0,
+			"US",
 			AD_ENTRY2s(	"DATA_B0.BIN",	"63170d11da5ebc3a66ecf0fc2d23e78a", 24176,
-						"DATA_J0.BIN",	"4cd2c1d16b116c1cf1f38f8114c9c2ff", 43004),
+						"SP05.BIN",		"e0486f6c73778cddd11f9618776125f4", 35756),
+			Common::EN_ANY,
+			Common::kPlatformSegaCD,
+			ADGF_TESTING,
+			GUIO2(GUIO_NOSPEECHVOLUME, GUIO_MIDISEGACD)
+		},
+		SNATCHER_FLAGS(MDT_SEGACD, true)
+	},
+	{
+		{
+			"snatcher",
+			"EU",
+			AD_ENTRY2s(	"DATA_B0.BIN",	"63170d11da5ebc3a66ecf0fc2d23e78a", 24176,
+						"SP05.BIN",		"a4ee2ea44629f64bd5d04e0d3160d7a5", 35756),
 			Common::EN_ANY,
 			Common::kPlatformSegaCD,
 			ADGF_TESTING,


Commit: 902b4bc58108ab318d3ffc9d3946ee120e59baf0
    https://github.com/scummvm/scummvm/commit/902b4bc58108ab318d3ffc9d3946ee120e59baf0
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix intro glitches

Almost all visual glitches should be gone now. The only thing I currenty
know of are the flames during the Neo Kobe city sequence which seem
to leave behind one or two pixels in some cases (but a bit random).
Also add boot logo/copyright screens.

Changed paths:
  A engines/snatcher/staticres.cpp
  A engines/snatcher/staticres.h
  A engines/snatcher/transition.h
  A engines/snatcher/transition_scd.cpp
  R engines/snatcher/scroll.h
  R engines/snatcher/scroll_scd.cpp
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/module.mk
    engines/snatcher/palette.h
    engines/snatcher/palette_scd.cpp
    engines/snatcher/render.h
    engines/snatcher/render_scd.cpp
    engines/snatcher/resource.h
    engines/snatcher/scene/scene_d0.cpp
    engines/snatcher/scene/scene_d1.cpp
    engines/snatcher/scene/scene_d2.cpp
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/sound.cpp
    engines/snatcher/sound.h
    engines/snatcher/sound_device.h
    engines/snatcher/sound_device_scd.cpp
    engines/snatcher/util.cpp


diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 1455f23e285..68c5f6fac66 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -24,7 +24,7 @@
 #include "snatcher/palette.h"
 #include "snatcher/render.h"
 #include "snatcher/resource.h"
-#include "snatcher/scroll.h"
+#include "snatcher/transition.h"
 #include "common/endian.h"
 #include "common/system.h"
 #include "graphics/pixelformat.h"
@@ -32,25 +32,25 @@
 namespace Snatcher {
 
 GraphicsEngine::GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate) : _system(system), _state(vmstate),
-	_renderer(0), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _flags(0) {
-
+	_renderer(nullptr), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _flags(0) {
+	assert(system);
 	_palette = Palette::create(pxf, _system->getPaletteManager(), platform, _state);
 	assert(_palette);
-	_scroll = ScrollManager::create(platform, _state);
-	_renderer = Renderer::create(pxf, platform, _state, _palette, _scroll);
+	_trs = TransitionManager::create(platform, _state);
+	_renderer = Renderer::create(pxf, platform, _state, _palette, _trs);
 	assert(_renderer);
-	_screen = new uint8[_renderer->screenWidth() * _renderer->screenHeight() * pxf->bytesPerPixel]();
+	_screen = new uint8[_renderer->screenWidth() * _renderer->screenHeight() * (pxf ? pxf->bytesPerPixel : 1)]();
 	assert(_screen);
 }
 
 GraphicsEngine::~GraphicsEngine() {
 	delete _renderer;
 	delete _palette;
-	delete _scroll;
+	delete _trs;
 	delete[] _screen;
 }
 
-uint8 _gfxScript_byte_3;
+uint8 _transitionType;
 
 void GraphicsEngine::runScript(ResourcePointer res, int func) {
 	ResourcePointer sc = ResourcePointer(res.dataStart, READ_BE_UINT32(res.dataStart + 4)).getDataFromTable(func);
@@ -80,7 +80,7 @@ void GraphicsEngine::runScript(ResourcePointer res, int func) {
 		case 5:
 		case 6:
 		case 7:
-			_gfxScript_byte_3 = sc[1];
+			_transitionType = sc[1];
 			break;
 		case 8:
 			_renderer->setPlaneMode(sc.readUINT16());
@@ -102,19 +102,19 @@ void GraphicsEngine::enqueuePaletteEvent(ResourcePointer res) {
 	_palette->enqueueEvent(res);
 }
 
-bool GraphicsEngine::enqueueCopyCommands(ResourcePointer res) {
-	return _renderer->enqueueCopyCommands(res);
+bool GraphicsEngine::enqueueDrawCommands(ResourcePointer res) {
+	return _renderer->enqueueDrawCommands(res);
 }
 
 void GraphicsEngine::setScrollStep(uint8 mode, int16 step) {
 	if (mode < 4)
-		_scroll->setDirectionAndSpeed(mode, step);
+		_trs->scroll_setDirectionAndSpeed(mode, step);
 	else
-		_scroll->setSingleStep(mode & 3, step);
+		_trs->scroll_setSingleStep(mode & 3, step);
 }
 
 void GraphicsEngine::scrollCommand(uint8 cmd) {
-	_scroll->doCommand(cmd);
+	_trs->doCommand(cmd);
 }
 
 void GraphicsEngine::updateAnimations() {
@@ -139,12 +139,12 @@ void GraphicsEngine::reset(int mode) {
 		restoreDefaults();
 	if (mode & kResetPalEvents)
 		_palette->clearEvents();
-	if (mode & kResetSprites)
+	if (mode & kResetAnimations)
 		_renderer->clearAnimations();
 	if (mode & kResetCopyCmds)
-		_renderer->clearCopyCommands();
+		_renderer->clearDrawCommands();
 	if (mode & kResetScrollState)
-		_scroll->clear();
+		_trs->clear();
 }
 
 void GraphicsEngine::setVar(uint8 var, uint8 val) {
@@ -155,6 +155,10 @@ void GraphicsEngine::setAnimControlFlags(uint8 animObjId, int flags) {
 	_renderer->anim_setControlFlags(animObjId, flags);
 }
 
+void GraphicsEngine::addAnimControlFlags(uint8 animObjId, int flags) {
+	_renderer->anim_addControlFlags(animObjId, flags);
+}
+
 void GraphicsEngine::clearAnimControlFlags(uint8 animObjId, int flags) {
 	_renderer->anim_clearControlFlags(animObjId, flags);
 }
@@ -187,6 +191,13 @@ bool GraphicsEngine::busy(int type) const {
 	return false;
 }
 
+int GraphicsEngine::displayBootSequenceFrame(int frameNo) {
+	int res = _renderer->drawBootSequenceFrame(_screen, frameNo);
+	_system->copyRectToScreen(_screen, _renderer->screenWidth() * _bpp, 0, 0, _renderer->screenWidth(), _renderer->screenHeight());
+	_system->updateScreen();
+	return res;
+}
+
 void GraphicsEngine::restoreDefaultsExt() {
 	if (!_state.getVar(4))
 		restoreDefaults();
@@ -197,9 +208,9 @@ void GraphicsEngine::restoreDefaultsExt() {
 		_state.setVar(5, 0);
 	}
 
-	_renderer->clearCopyCommands();
-	_scroll->doCommand(0xFC);
-	_renderer->clearAnimations();
+	_renderer->clearDrawCommands();
+	_trs->doCommand(0xFC);
+	_renderer->clearAnimations(1);
 
 	if (!(_state.testFlag(4, 1)))
 		_state.setVar(0, 1);
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index d654566692f..2a908726db8 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -36,7 +36,7 @@ namespace Graphics {
 namespace Snatcher {
 
 class Palette;
-class ScrollManager;
+class TransitionManager;
 class Renderer;
 class SceneModule;
 
@@ -47,7 +47,7 @@ public:
 
 	void runScript(ResourcePointer res, int func);
 	void enqueuePaletteEvent(ResourcePointer res);
-	bool enqueueCopyCommands(ResourcePointer res);
+	bool enqueueDrawCommands(ResourcePointer res);
 
 	enum ScrollMode : uint8 {
 		kHorzA		= 0,
@@ -68,7 +68,7 @@ public:
 		kResetSetDefaults		=	1 << 1,
 		kResetSetDefaultsExt	=	1 << 2,
 		kResetCopyCmds			=	1 << 3,
-		kResetSprites			=	1 << 4,
+		kResetAnimations		=	1 << 4,
 		kResetScrollState		=	1 << 5
 	};
 
@@ -77,12 +77,14 @@ public:
 	void setVar(uint8 var, uint8 val);
 
 	enum AnimFlags : int {
+		kAnimNone 				=	0,
 		kAnimPause				=	1 << 0,
 		kAnimHide				=	1 << 1,
 		kAnimAudioSync			=	1 << 2
 	};
 
 	void setAnimControlFlags(uint8 animObjId, int flags);
+	void addAnimControlFlags(uint8 animObjId, int flags);
 	void clearAnimControlFlags(uint8 animObjId, int flags);
 	void setAnimFrame(uint8 animObjId, uint16 frameNo);
 	uint16 getAnimCurFrame(uint8 animObjId) const;
@@ -93,6 +95,8 @@ public:
 
 	bool busy(int type) const;
 
+	int displayBootSequenceFrame(int frameNo);
+
 public:
 	struct GfxState {
 		GfxState(const VMInfo &vminfo) : vm(vminfo) {
@@ -159,7 +163,7 @@ private:
 	byte *_screen;
 	Renderer *_renderer;
 	Palette *_palette;
-	ScrollManager *_scroll;
+	TransitionManager *_trs;
 	OSystem *_system;
 };
 
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index a29dcd23d72..bcdb66d2cfc 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -10,10 +10,10 @@ MODULE_OBJS := \
 	scene/scene_d1.o \
 	scene/scene_d2.o \
 	snatcher.o \
-	scroll_scd.o \
 	sound.o \
-	sound_device_null.o \
 	sound_device_scd.o \
+	statires.o \
+	transition_scd.o \
 	util.o
 
 # This module can be built as a plugin
diff --git a/engines/snatcher/palette.h b/engines/snatcher/palette.h
index d542169ce89..7c5ea9a1bc7 100644
--- a/engines/snatcher/palette.h
+++ b/engines/snatcher/palette.h
@@ -50,6 +50,12 @@ public:
 
 	virtual const uint8 *getSystemPalette() const { return nullptr; }
 
+	virtual void selectPalettes(uint32) {}
+	virtual void getPresetColor(int pal, int index, uint8 &r, uint8 &g, uint8 &b) const {}
+	virtual void setColor(int index, uint8 r, uint8 g, uint8 b) {}
+	virtual void getColor(int index, uint8 &r, uint8 &g, uint8 &b) const {}
+	virtual void adjustColor(int index, int8 r, int8 g, int8 b) {}
+
 protected:
 	const Graphics::PixelFormat _pixelFormat;
 	PaletteManager *_palMan;
diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index 9f7e3790f35..70e2959ca8c 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -50,6 +50,12 @@ public:
 	void hINTCallback(void *segaRenderer) override;
 	const uint8 *getSystemPalette() const override { return _sysPalette; }
 
+	void selectPalettes(uint32) override;
+	void getPresetColor(int pal, int index, uint8 &r, uint8 &g, uint8 &b) const override;
+	void setColor(int index, uint8 r, uint8 g, uint8 b) override;
+	void getColor(int index, uint8 &r, uint8 &g, uint8 &b) const override;
+	void adjustColor(int index, int8 r, int8 g, int8 b) override;
+
 private:
 	typedef Common::Functor1Mem<PalEventSCD*, void, SCDPalette> EventProc;
 	Common::Array<EventProc*> _eventProcs;
@@ -200,24 +206,52 @@ void SCDPalette::setDefaults(int mode) {
 	_gfxState.setFlag(7, 0);
 }
 
-/*void SCDPalette::selectPalette(uint32 sel) {
-	static const uint16 colors[] = {
-		0x0eee, 0x0000, 0x0ccc, 0x0aaa, 0x0888, 0x0222, 0x0caa, 0x0aaa,
-		0x0a88, 0x0888, 0x0866, 0x0866, 0x0644, 0x0644, 0x0444, 0x0422,
-		0x0eee, 0x0000, 0x008e, 0x008c, 0x006c, 0x004a, 0x00ee, 0x00ce,
-		0x00ce, 0x00ae, 0x00ac, 0x008c, 0x008c, 0x006c, 0x006c, 0x004a,
-		0x0eee, 0x0000, 0x006e, 0x004c, 0x004c, 0x0028, 0x008e, 0x006e,
-		0x004e, 0x000c, 0x000c, 0x000a, 0x000a, 0x0008, 0x0008, 0x0006,
-		0x0000, 0x0000, 0x0000, 0x0020, 0x0040, 0x0060, 0x0080, 0x00a0,
-		0x00c0, 0x0aea, 0x06c6, 0x08e8, 0x0eee, 0x0000, 0x0000, 0x0000,
-		0x0000, 0x0000, 0x0600, 0x0800, 0x0a00, 0x0e00, 0x0000, 0x0000,
-		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
-		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0060, 0x0080, 0x00a0,
-		0x00c0, 0x0aea, 0x06c6, 0x08e8, 0x0eee, 0x0000, 0x0000, 0x0000,
-		0x0000, 0x0eee, 0x00ee, 0x000e, 0x0ee0, 0x0e00, 0x00e0, 0x0600,
-		0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
-	};
-}*/
+static const uint16 _presetColors[7][16] = {
+	{ 0x0eee, 0x0000, 0x0ccc, 0x0aaa, 0x0888, 0x0222, 0x0caa, 0x0aaa, 0x0a88, 0x0888, 0x0866, 0x0866, 0x0644, 0x0644, 0x0444, 0x0422 },
+	{ 0x0eee, 0x0000, 0x008e, 0x008c, 0x006c, 0x004a, 0x00ee, 0x00ce, 0x00ce, 0x00ae, 0x00ac, 0x008c, 0x008c, 0x006c, 0x006c, 0x004a },
+	{ 0x0eee, 0x0000, 0x006e, 0x004c, 0x004c, 0x0028, 0x008e, 0x006e, 0x004e, 0x000c, 0x000c, 0x000a, 0x000a, 0x0008, 0x0008, 0x0006 },
+	{ 0x0000, 0x0000, 0x0000, 0x0020, 0x0040, 0x0060, 0x0080, 0x00a0, 0x00c0, 0x0aea, 0x06c6, 0x08e8, 0x0eee, 0x0000, 0x0000, 0x0000 },
+	{ 0x0000, 0x0000, 0x0600, 0x0800, 0x0a00, 0x0e00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+	{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0060, 0x0080, 0x00a0, 0x00c0, 0x0aea, 0x06c6, 0x08e8, 0x0eee, 0x0000, 0x0000, 0x0000 },
+	{ 0x0000, 0x0eee, 0x00ee, 0x000e, 0x0ee0, 0x0e00, 0x00e0, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }
+};
+
+void SCDPalette::selectPalettes(uint32 sel) {
+	for (int i = 0; i < 4; ++i) {
+		uint8 p = (sel >> (24 - 8 * i)) & 0xFF;
+		if (p == 0xFF)
+			continue;
+		assert(p < ARRAYSIZE(_presetColors));
+		Common::copy<const uint16 *, uint16 *>(_presetColors[p], _presetColors[p + 1], &_colors[i << 4]);
+	}
+	_gfxState.setFlag(7, 0);
+}
+
+void SCDPalette::getPresetColor(int pal, int index, uint8 &r, uint8 &g, uint8 &b) const {
+	assert(pal < ARRAYSIZE(_presetColors));
+	assert(index < ARRAYSIZE(_presetColors[0]));
+	r = (_presetColors[pal][index] & 0xF00) >> 8;
+	g = (_presetColors[pal][index] & 0xF0) >> 4;
+	b = _presetColors[pal][index] & 0xF;
+}
+
+void SCDPalette::setColor(int index, uint8 r, uint8 g, uint8 b) {
+	assert(index >= 0 && index < 64);
+	_colors[index] = (r & 0x0E) << 8 | (g & 0x0E) << 4 | (b & 0x0E);
+	_gfxState.setFlag(7, 0);
+}
+
+void SCDPalette::getColor(int index, uint8 &r, uint8 &g, uint8 &b) const {
+	r = (_colors[index] & 0xF00) >> 8;
+	g = (_colors[index] & 0xF0) >> 4;
+	b = _colors[index] & 0xF;
+}
+
+void SCDPalette::adjustColor(int index, int8 r, int8 g, int8 b) {
+	assert(index >= 0 && index < 64);
+	_colors[index] = (((((_colors[index] & 0xE00) >> 8) + (r & 0x0E)) & 0x0E) << 8) | (((((_colors[index] & 0xE0) >> 4) + (g & 0x0E)) & 0x0E) << 4) | (((_colors[index] + (b & 0x0E)) & 0x0E));
+	_gfxState.setFlag(7, 0);
+}
 
 void SCDPalette::updateSystemPalette() {
 	if (!_gfxState.testFlag(7, 0) && !_gfxState.testFlag(7, 1))
diff --git a/engines/snatcher/render.h b/engines/snatcher/render.h
index 47a1fc0a9ee..8ddbc02d49a 100644
--- a/engines/snatcher/render.h
+++ b/engines/snatcher/render.h
@@ -32,8 +32,8 @@ class Renderer {
 public:
 	virtual ~Renderer() {}
 
-	virtual bool enqueueCopyCommands(ResourcePointer &res) = 0;
-	virtual void clearCopyCommands() = 0;
+	virtual bool enqueueDrawCommands(ResourcePointer &res) = 0;
+	virtual void clearDrawCommands() = 0;
 	virtual void initData(ResourcePointer &res, uint8 mode) = 0;
 	virtual void initAnimations(ResourcePointer &res, uint16 len) = 0;
 	virtual void linkAnimations(ResourcePointer &res, uint16 len) = 0;
@@ -43,6 +43,7 @@ public:
 	virtual void updateAnimations() = 0;
 
 	virtual void anim_setControlFlags(uint8 animObjId, int flags) = 0;
+	virtual void anim_addControlFlags(uint8 animObjId, int flags) = 0;
 	virtual void anim_clearControlFlags(uint8 animObjId, int flags) = 0;
 	virtual void anim_setFrame(uint8 animObjId, uint16 frameNo) = 0;
 	virtual uint16 anim_getCurFrameNo(uint8 animObjId) const = 0;
@@ -51,15 +52,20 @@ public:
 	virtual uint16 screenWidth() const = 0;
 	virtual uint16 screenHeight() const = 0;
 
+	// This is special code from the CD-ROM boot sectors that does not
+	// share anything with the rest of the game. So it makes sense to
+	// keep it separate.
+	virtual int drawBootSequenceFrame(uint8 *screen, int frameNo) = 0;
+
 protected:
 	Renderer(GraphicsEngine::GfxState &state) : _gfxState(state) {}
 	GraphicsEngine::GfxState &_gfxState;
 
 private:
-	static Renderer *createSegaRenderer(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr);
+	static Renderer *createSegaRenderer(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr);
 
 public:
-	static Renderer *create(const Graphics::PixelFormat *pxf, Common::Platform platform, GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr) {
+	static Renderer *create(const Graphics::PixelFormat *pxf, Common::Platform platform, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr) {
 		switch (platform) {
 		case Common::kPlatformSegaCD:
 			return createSegaRenderer(pxf, state, pal, scr);
diff --git a/engines/snatcher/render_scd.cpp b/engines/snatcher/render_scd.cpp
index 6c0334469a0..902fcb73606 100644
--- a/engines/snatcher/render_scd.cpp
+++ b/engines/snatcher/render_scd.cpp
@@ -28,68 +28,51 @@
 #include "snatcher/palette.h"
 #include "snatcher/render.h"
 #include "snatcher/resource.h"
-#include "snatcher/scroll.h"
+#include "snatcher/staticres.h"
+#include "snatcher/transition.h"
 #include "snatcher/util.h"
 
+
 namespace Snatcher {
 
+//#define		ANIM_DEBUG
+
 struct AnimObject {
-	AnimObject() : enable(0), slowDown(0), drawFlags(0), posX(0), posY(0), speedXa(0), speedYa(0), f16(0), f18(0), f1c(0), timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0), res(), scriptData(), spriteData(0), speedX(0), speedY(0), parent(0), children(0), next(0), f4e(0), f4f(0) {}
+	AnimObject(int num) : id(num), enable(0), fadeLevel(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), f16(0), f18(0), f1c(0), timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0), res(), scriptData(), spriteData(0), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), f4e(0), f4f(0) {}
 
 	void clear() {
-		*this = Common::move(AnimObject());
-		/*enable = 0;
-		delay = 0;
-		drawFlags = 0;
-		posX = 0;
-		posY = 0;
-		fe = 0;
-		f10 = 0;
-		f11 = 0;
-		f12 = 0;
-		f13 = 0;
-		f14 = 0;
-		f15 = 0;
+		enable = fadeLevel = drawFlags = 0;
+		posX = posY = 0;
+		relSpeedX = relSpeedY = 0;
 		f16 = 0;
 		f18 = 0;
 		f1c = 0;
-		f20 = 0;
-		f21 = 0;
-		f22 = 0;
-		f23 = 0;
+		timeStamp = 0;
 		f24 = 0;
-		controlFlags = 0;
-		f26 = 0;
-		f27 = 0;
+		controlFlags = allowFrameDrop = frameSeqCounter = 0;
 		frame = 0;
-		f2a = 0;
-		f2c = 0;
-		f2d = 0;
-		offs_2e = 0;
-		res = ResourcePointer();
-		animData = 0;
-		spriteData = 0;
-		speedX = 0;
-		speedY = 0;
-		prev = 0;
-		next = 0;
-		next2 = 0;
-		f4e = 0;
-		f4f = 0;*/
+		frameDelay = 0;
+		f2c = f2d = 0;
+		spriteTableLocation = 0;
+		res = scriptData = ResourcePointer();
+		spriteData = nullptr;
+		absSpeedX = absSpeedY = 0;
+		parent = children = next = 0;
+		f4e = f4f = 0;
 	}
 
 	uint16 enable;
-	uint16 slowDown;
+	uint16 fadeLevel;
 	uint16 drawFlags;
-	uint32 posX;
-	uint32 posY;
+	int32 posX;
+	int32 posY;
 
-	uint32 speedXa;
-	uint32 speedYa;
+	int32 relSpeedX;
+	int32 relSpeedY;
 	uint8 f16;
 	uint16 f18;
 	uint8 f1c;
-	uint8 timeStamp;
+	uint32 timeStamp;
 	uint8 f24;
 	uint8 controlFlags;
 	uint8 allowFrameDrop;
@@ -104,23 +87,25 @@ struct AnimObject {
 	ResourcePointer scriptData;
 	const uint16 *spriteData;
 
-	uint32 speedX;
-	uint32 speedY;
+	int32 absSpeedX;
+	int32 absSpeedY;
 	uint16 parent;
 	uint16 children;
 	uint16 next;
 	uint8 f4e;
 	uint8 f4f;
+
+	const uint8 id;
 };
 
 class GraphicsEngine;
 class Renderer_SCD : public Renderer, public Graphics::SegaRenderer::HINTClient {
 public:
-	Renderer_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr);
+	Renderer_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr);
 	~Renderer_SCD() override;
 
-	bool enqueueCopyCommands(ResourcePointer &res) override;
-	void clearCopyCommands() override;
+	bool enqueueDrawCommands(ResourcePointer &res) override;
+	void clearDrawCommands() override;
 	void initData(ResourcePointer &res, uint8 mode) override;
 	void initAnimations(ResourcePointer &res, uint16 len) override;
 	void linkAnimations(ResourcePointer &res, uint16 len) override;
@@ -131,6 +116,7 @@ public:
 	void updateAnimations() override;
 
 	void anim_setControlFlags(uint8 animObjId, int flags) override;
+	void anim_addControlFlags(uint8 animObjId, int flags) override;
 	void anim_clearControlFlags(uint8 animObjId, int flags) override;
 	void anim_setFrame(uint8 animObjId, uint16 frameNo) override;
 	uint16 anim_getCurFrameNo(uint8 animObjId) const override;
@@ -143,12 +129,12 @@ public:
 
 private:
 	void loadDataFromGfxScript();
-	void executeCopyCommands();
-	void drawSprites();
+	void executeDrawCommands();
+	void drawAnimSprites();
 	void reconfigPlanes();
 	void updateScrollState();
 
-	void drawSprite(AnimObject &a);
+	void generateSpriteData(AnimObject &a, uint16 &spritesCurIndex, uint16 *&spritesBufferCurPos);
 	void updateAnim32Spec(AnimObject &a);
 	bool reachedAudioTimeStamp(AnimObject &a) const;
 	void runAnimScript(AnimObject &a);
@@ -165,57 +151,67 @@ private:
 	uint8 _modeChange;
 	Graphics::SegaRenderer *_sr;
 	Palette *_pal;
-	ScrollManager *_scroll;
+	TransitionManager *_trs;
 	const Graphics::SegaRenderer::HINTHandler _hINTClientProc;
 
 private:
-	AnimObject *_animations;
+	AnimObject **_animations;
 
-	struct CopyCommand {
-		CopyCommand() : cmd(0), progress(0), ptr(0), res(), c(0), d(0) {}
+	struct DrawCommand {
+		DrawCommand() : cmd(0), progress(0), ptr(0), res() {}
 		void clear() {
 			cmd = 0;
 			progress = 0;
 			ptr = 0;
 			res = ResourcePointer();
-			c = 0;
-			d = 0;
 		}
 		uint8 cmd;
 		uint8 progress;
 		const uint8 *ptr;
 		ResourcePointer res;
-		uint8 c;
-		uint8 d;
 	};
 
-	CopyCommand *_copyCommands;
+	DrawCommand *_drawCommands;
 
 private:
+#ifndef ANIM_DEBUG
 	typedef Common::Functor2Mem<AnimObject&, const uint8*, int, Renderer_SCD> GfxAnimFunc;
+#else
+	class GfxAnimFunc : public Common::Functor2Mem<AnimObject&, const uint8*, int, Renderer_SCD> {
+	public:
+		typedef int (Renderer_SCD::*AnimFunc)(AnimObject&, const uint8*);
+		GfxAnimFunc(Renderer_SCD *gfx, AnimFunc func, const char *desc) : Common::Functor2Mem<AnimObject &, const uint8*, int, Renderer_SCD>(gfx, func), _desc(Common::String("anim_") + desc) {}
+		int operator()(AnimObject &a, const uint8 *data) {
+			debug("%s():   anim: %02d,   data: [%02x %02x %02x]", _desc.c_str(), a.id, data[0], data[1], data[2]);
+			return Functor2Mem<AnimObject &, const uint8*, int, Renderer_SCD>::operator()(a, data);
+		}
+	private:
+		Common::String _desc;
+	};
+#endif
 	Common::Array<GfxAnimFunc*> _animProcs;
 
 	void makeAnimFunctions();
 
-	int anim_remove(AnimObject &a, const uint8 *data);
+	int anim_terminate(AnimObject &a, const uint8 *data);
 	int anim_setFrame(AnimObject &a, const uint8 *data);
 	int anim_seqSetFrame(AnimObject &a, const uint8 *data);
 	int anim_rndSeqSetFrame(AnimObject &a, const uint8 *data);
 	int anim_setX(AnimObject &a, const uint8 *data);
 	int anim_setY(AnimObject &a, const uint8 *data);
-	int anim_06(AnimObject &a, const uint8 *data);
-	int anim_07(AnimObject &a, const uint8 *data);
+	int anim_setSpeedX(AnimObject &a, const uint8 *data);
+	int anim_setSpeedY(AnimObject &a, const uint8 *data);
 	int anim_palEvent(AnimObject &a, const uint8 *data);
 	int anim_palReset(AnimObject &a, const uint8 *data);
 	int anim_copyCmds(AnimObject &a, const uint8 *data);
-	int anim_11(AnimObject &a, const uint8 *data);
-	int anim_12(AnimObject &a, const uint8 *data);
-	int anim_13(AnimObject &a, const uint8 *data);
-	int anim_14(AnimObject &a, const uint8 *data);
-	int anim_15(AnimObject &a, const uint8 *data);
+	int anim_nop(AnimObject &a, const uint8 *data);
+	int anim_scrollSingleStepH(AnimObject &a, const uint8 *data);
+	int anim_scrollSingleStepV(AnimObject &a, const uint8 *data);
+	int anim_scrollStartH(AnimObject &a, const uint8 *data);
+	int anim_scrollStartV(AnimObject &a, const uint8 *data);
 	int anim_pause(AnimObject &a, const uint8 *data);
 	int anim_resumeAndUnsyncOther(AnimObject &a, const uint8 *data);
-	int anim_removeOther(AnimObject &a, const uint8 *data);
+	int anim_terminateOther(AnimObject &a, const uint8 *data);
 	int anim_pauseAndHideOther(AnimObject &a, const uint8 *data);
 	int anim_hide(AnimObject &a, const uint8 *data);
 	int anim_24(AnimObject &a, const uint8 *data);
@@ -242,12 +238,21 @@ private:
 	int anim_47(AnimObject &a, const uint8 *data);
 
 	int anim_updateFrameDelay(AnimObject &a, const uint8 *data);
-	void anim_setGroupParameter(AnimObject &a, int pata, uint16 val = 0, bool recursive = false);
+	void anim_setGroupParameter(AnimObject &a, int pata, int16 val = 0, bool recursive = false);
+
+public:
+	// boot logo animation
+	int drawBootSequenceFrame(uint8 *screen, int frameNo) override;
+private:
+	int32 _bootsDelay, _bootsTotalFrames;
+	uint16 _bootsHScroll, _bootsVScroll, _bootsCol;
+	uint8 *_bootsSprTbl;
 };
 
-Renderer_SCD::Renderer_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr) : Renderer(state), _pal(pal), _scroll(scr), _mode(1),
+Renderer_SCD::Renderer_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr) : Renderer(state), _pal(pal), _trs(scr), _mode(1),
 	_modeChange(0), _screenWidth(256), _screenHeight(224), _transferData(), _transferMode(0), _transferDelay(0), _clearFlags(0), _tempBuffer(nullptr), _spriteBuffer(nullptr), _sr(nullptr),
-		_animations(nullptr), _copyCommands(nullptr), _hINTClientProc(Graphics::SegaRenderer::HINTHandler(this, &Graphics::SegaRenderer::HINTClient::hINTCallback)) {
+		_animations(nullptr), _drawCommands(nullptr), _hINTClientProc(Graphics::SegaRenderer::HINTHandler(this, &Graphics::SegaRenderer::HINTClient::hINTCallback)), _bootsDelay(0), _bootsSprTbl(nullptr),
+			_bootsTotalFrames(0), _bootsHScroll(0), _bootsVScroll(0), _bootsCol(0) {
 
 	makeAnimFunctions();
 
@@ -261,11 +266,15 @@ Renderer_SCD::Renderer_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::Gfx
 	_spriteBuffer = new uint16[0x100]();
 	assert(_spriteBuffer);
 
-	_animations = new AnimObject[64];
-	assert(_animations);
+	_drawCommands = new DrawCommand[7]();
+	assert(_drawCommands);
 
-	_copyCommands = new CopyCommand[7];
-	assert(_copyCommands);
+	_animations = new AnimObject*[64]();
+	assert(_animations);
+	for (int i = 0; i < 64; ++i) {
+		_animations[i] = new AnimObject(i);
+		assert(_animations[i]);
+	}
 
 	_sr->setResolution(_screenWidth, _screenHeight);
 	_sr->setupWindowPlane(0, 0, Graphics::SegaRenderer::kWinToLeft, Graphics::SegaRenderer::kWinToTop);
@@ -280,15 +289,20 @@ Renderer_SCD::~Renderer_SCD() {
 	delete _sr;
 	delete[] _tempBuffer;
 	delete[] _spriteBuffer;
-	delete[] _animations;
-	delete[] _copyCommands;
+	delete[] _drawCommands;
+
+	if (_animations) {
+		for (int i = 0; i < 64; ++i) 
+			delete _animations[i];
+		delete[] _animations;
+	}
 
 	for (uint i = 0; i < _animProcs.size(); ++i) \
 		delete _animProcs[i];
 }
 
-bool Renderer_SCD::enqueueCopyCommands(ResourcePointer &res) {
-	for (CopyCommand *it = _copyCommands; it < &_copyCommands[7]; ++it) {
+bool Renderer_SCD::enqueueDrawCommands(ResourcePointer &res) {
+	for (DrawCommand *it = _drawCommands; it < &_drawCommands[7]; ++it) {
 		if (it->cmd != 0)
 			continue;
 		it->res = res;
@@ -300,8 +314,8 @@ bool Renderer_SCD::enqueueCopyCommands(ResourcePointer &res) {
 	return false;
 }
 
-void Renderer_SCD::clearCopyCommands() {
-	for (CopyCommand *it = _copyCommands; it < &_copyCommands[7]; ++it)
+void Renderer_SCD::clearDrawCommands() {
+	for (DrawCommand *it = _drawCommands; it < &_drawCommands[7]; ++it)
 		it->clear();
 }
 
@@ -315,7 +329,7 @@ void Renderer_SCD::initAnimations(ResourcePointer &res, uint16 len) {
 	ResourcePointer in = res;
 	while (in < next) {
 		assert(in[0] < 64);
-		AnimObject *a = &_animations[*in++];
+		AnimObject *a = _animations[*in++];
 		if (a->enable)
 			return;
 
@@ -352,8 +366,8 @@ void Renderer_SCD::linkAnimations(ResourcePointer &res, uint16 len) {
 		uint16 p = *in++;
 		uint16 c = *in++;
 		assert(p < 64 && c < 64);
-		AnimObject *pPr = &_animations[p];
-		AnimObject *pCh = &_animations[c];
+		AnimObject *pPr = _animations[p];
+		AnimObject *pCh = _animations[c];
 		pCh->next = pPr->children;
 		pPr->children = c;
 		pCh->parent = p;
@@ -363,13 +377,13 @@ void Renderer_SCD::linkAnimations(ResourcePointer &res, uint16 len) {
 void Renderer_SCD::clearAnimations(int mode) {
 	if (mode) {
 		for (int i = 1; i < 64; ++i) {
-			AnimObject *s = &_animations[i];
+			AnimObject *s = _animations[i];
 			if (s->enable && !(s->f4e & 1))
 				s->clear();
 		}
 	} else {
-		for (int i = 1; i < 64; ++i)
-			_animations[i].clear();
+		for (int i = 0; i < 64; ++i)
+			_animations[i]->clear();
 	}
 }
 void Renderer_SCD::setPlaneMode(uint16 mode) {
@@ -393,8 +407,8 @@ void Renderer_SCD::updateScreen(uint8 *screen) {
 		reconfigPlanes();
 
 	loadDataFromGfxScript();
-	executeCopyCommands();
-	drawSprites();
+	executeDrawCommands();
+	drawAnimSprites();
 	updateScrollState();
 
 	_sr->setRenderColorTable(_pal->getSystemPalette(), 0, 64);
@@ -402,12 +416,13 @@ void Renderer_SCD::updateScreen(uint8 *screen) {
 }
 
 void Renderer_SCD::updateAnimations() {
-	for (AnimObject *s = _animations; s < &_animations[64]; ++s) {
+	for (int i = 0; i < 64; ++i) {
+		AnimObject *s = _animations[i];
 		int16 dropFrames = _gfxState.getDropFrames();
 		if ((s->f1c || s->allowFrameDrop) && _gfxState.getVar(10))
 			continue;
 		if (dropFrames)
-			debug("%s(): Dropping %d frames for anim %d", __FUNCTION__, dropFrames, s - _animations);
+			debug("%s(): Dropping %d frames for anim %d", __FUNCTION__, dropFrames, s->id);
 		do {
 			if (!s->enable)
 				break;
@@ -424,7 +439,8 @@ void Renderer_SCD::updateAnimations() {
 		} while (--dropFrames >= 0 && s->allowFrameDrop);
 	}
 
-	for (AnimObject *s = _animations; s < &_animations[64]; ++s) {
+	for (int i = 0; i < 64; ++i) {
+		AnimObject *s = _animations[i];
 		if (!s->enable || (s->f1c & _gfxState.getVar(10)))
 			continue;
 
@@ -433,8 +449,8 @@ void Renderer_SCD::updateAnimations() {
 			s->spriteData = reinterpret_cast<const uint16*>(s->res.makeAbsPtr(s->spriteTableLocation).getDataFromTable(cmd)());
 
 		if (!(s->controlFlags & GraphicsEngine::kAnimPause)) {
-			s->posX += s->speedX;
-			s->posY += s->speedY;
+			s->posX += s->absSpeedX;
+			s->posY += s->absSpeedY;
 		}
 	}
 }
@@ -442,34 +458,40 @@ void Renderer_SCD::updateAnimations() {
 void Renderer_SCD::anim_setControlFlags(uint8 animObjId, int flags) {
 	assert(animObjId < 64);
 	flags &= 7;
-	_animations[animObjId].controlFlags |= flags;
+	_animations[animObjId]->controlFlags = flags;
+}
+
+void Renderer_SCD::anim_addControlFlags(uint8 animObjId, int flags) {
+	assert(animObjId < 64);
+	flags &= 7;
+	_animations[animObjId]->controlFlags |= flags;
 }
 
 void Renderer_SCD::anim_clearControlFlags(uint8 animObjId, int flags) {
 	assert(animObjId < 64);
-	_animations[animObjId].controlFlags &= ~flags;
+	_animations[animObjId]->controlFlags &= ~flags;
 }
 
 void Renderer_SCD::anim_setFrame(uint8 animObjId, uint16 frameNo) {
 	assert(animObjId < 64);
-	_animations[animObjId].frame = frameNo;
+	_animations[animObjId]->frame = frameNo;
 }
 
 uint16 Renderer_SCD::anim_getCurFrameNo(uint8 animObjId) const {
 	assert(animObjId < 64);
-	return _animations[animObjId].frame;
+	return _animations[animObjId]->frame;
 }
 
 bool Renderer_SCD::anim_isEnabled(uint8 animObjId) const {
 	assert(animObjId < 64);
-	return _animations[animObjId].enable != 0;
+	return _animations[animObjId]->enable != 0;
 }
 
 void Renderer_SCD::hINTCallback(Graphics::SegaRenderer *sr) {
 	if (_pal)
 		_pal->hINTCallback(sr);
-	if (_scroll)
-		_scroll->hINTCallback(sr);
+	if (_trs)
+		_trs->hINTCallback(sr);
 }
 
 void Renderer_SCD::loadDataFromGfxScript() {
@@ -535,25 +557,24 @@ void Renderer_SCD::loadDataFromGfxScript() {
 	// ga_comm_loc_E322_writeWordRam_codeD6_dstA5_srcA6_lenD7
 }
 
-void Renderer_SCD::executeCopyCommands() {
+void Renderer_SCD::executeDrawCommands() {
 	if (_gfxState.getVar(8))
 		return;
 
 	static const uint8 offs[] =	{ 0x02, 0x03, 0x01, 0x03, 0x00, 0x02, 0x00, 0x01 };
-	static const uint8 mask[] =	{ 0xF0, 0x0F, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F };
+	static const uint8 mask[] =	{ 0xF0, 0x0F, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F };
 
-	for (CopyCommand *it = _copyCommands; it < &_copyCommands[7]; ++it) {
+	for (DrawCommand *it = _drawCommands; it < &_drawCommands[7]; ++it) {
 		if (it->cmd == 0)
 			continue;
 
 		bool loop = (it->cmd & 0x40);
 		int section = (it->cmd & 0x30) >> 4;
 		uint8 *s = _tempBuffer + section * 0x2000;
-		const uint8 *bptr = nullptr;
-		uint8 a = 0;
+		uint16 a = 0;
 		uint8 b = 0;
 
-		if ((it->cmd & 0x0F) < 4 && (it->cmd & 0x0F) != 1 && !(it->cmd & 0x80)) {
+		if ((it->cmd & 0x0F) < 5 && (it->cmd & 0x0F) != 2 && !(it->cmd & 0x80)) {
 			const uint8 *cmp = it->res.makeAbsPtr(READ_BE_UINT32(it->ptr))();
 			uint32 len = READ_BE_UINT16(cmp);
 			if (len != Util::decodeSCDData(cmp + 2, s))
@@ -562,6 +583,7 @@ void Renderer_SCD::executeCopyCommands() {
 
 		switch (it->cmd & 0x0F) {
 		case 0:
+		case 1:
 			_sr->loadToVRAM(s + READ_BE_INT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
 			it->ptr += 10;
 			if (READ_BE_UINT16(it->ptr) == 0xFFFF) {
@@ -569,7 +591,7 @@ void Renderer_SCD::executeCopyCommands() {
 				break;
 			}
 			break;
-		case 1:
+		case 2:
 			for (bool rept = true; rept; ) {
 				memcpy(s + READ_BE_INT16(it->ptr + 6), it->res.makeAbsPtr(READ_BE_UINT32(it->ptr))(), READ_BE_UINT16(it->ptr + 8));
 				_sr->loadToVRAM(s + READ_BE_INT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
@@ -580,22 +602,20 @@ void Renderer_SCD::executeCopyCommands() {
 				}
 			}
 			break;
-		case 2:
+		case 3:
 			it->cmd |= 0x80;
 			for (bool rept = true; rept; ) {
 				_sr->loadToVRAM(s + READ_BE_INT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
-				if (bptr)
-					it->ptr = bptr;
 				it->ptr += 10;
 				if (READ_BE_UINT16(it->ptr) == 0xFFFF) {
 					it->cmd = 0;
 					rept = false;
+				} else {
+					it->ptr -= 4;
 				}
-				bptr = it->ptr - 4;
-				it->ptr = it->res.makeAbsPtr(READ_BE_UINT32(bptr))();
 			}
 			break;
-		case 3:
+		case 4:
 			it->cmd |= 0x80;
 			a = it->progress & 7;
 			b = (a + (((it->progress >> 3) * 5) & 7)) & 7;
@@ -612,7 +632,7 @@ void Renderer_SCD::executeCopyCommands() {
 			if (++it->progress == 65)
 				it->cmd = 0;
 			break;
-		case 4:
+		case 5:
 			if (it->progress == 0)
 				memset(s, 0, 32);
 			a = it->progress & 7;
@@ -634,383 +654,24 @@ void Renderer_SCD::executeCopyCommands() {
 	}
 }
 
-void Renderer_SCD::drawSprites() {
-	for (int i = 63; i >= 0; --i) {
-		AnimObject &a = _animations[i];
-		if (a.enable && a.spriteData != nullptr && !(a.controlFlags & GraphicsEngine::kAnimHide) && a.slowDown != 0xFFFF && !(a.slowDown & _gfxState.frameCount()))
-			drawSprite(a);
-		if (i == 32)
+void Renderer_SCD::drawAnimSprites() {
+	uint16 *d = _spriteBuffer;
+	memset(d, 0, 4 * sizeof(uint16));
+	uint16 nxt = 1;
+
+	for (int i = 0; i < 64; ++i) {
+		AnimObject &a = *_animations[i];
+		if (a.enable && a.spriteData != nullptr && !(a.controlFlags & GraphicsEngine::kAnimHide) && a.fadeLevel != 0xFFFF && !(a.fadeLevel & _gfxState.frameCount()))
+			generateSpriteData(a, nxt, d);
+		if (i == 31)
 			updateAnim32Spec(a);
 	}
-}
 
-static const uint8 src0000[] = {
-	0x13, 0x00, 0xaa, 0x00, 0x1c, 0x01, 0x11, 0x1c,
-	0x01, 0x22, 0x04, 0x01, 0x33, 0x04, 0x01, 0xaa,
-	0x44, 0x91, 0x55, 0x91, 0x77, 0x91, 0x99, 0x91,
-	0xbf, 0xa8, 0x01, 0x10, 0x01, 0x18, 0xa1, 0x01,
-	0x28, 0x01, 0x30, 0xff, 0x04, 0x01, 0x95, 0x06,
-	0x69, 0x05, 0x01, 0x6e, 0x70, 0x99, 0x09, 0x00,
-	0x00, 0x3f, 0x3b, 0xd3, 0xa7, 0x77, 0x78, 0x89,
-	0xab, 0x99, 0xaa, 0xac, 0xcc, 0x78, 0x9a, 0xbc,
-	0xcc, 0x56, 0x7a, 0xbb, 0xcc, 0x05, 0x56, 0x5a,
-	0xaa, 0x00, 0x00, 0x85, 0x77, 0x00, 0x07, 0x00,
-	0x27, 0x50, 0x15, 0xae, 0xc8, 0x05, 0x50, 0x50,
-	0x05, 0x87, 0x00, 0x57, 0x79, 0x90, 0x00, 0xaa,
-	0xba, 0x00, 0x00, 0xcc, 0xb7, 0x94, 0xa5, 0x50,
-	0x95, 0x84, 0xa7, 0x88, 0xab, 0x9c, 0x57, 0xa9,
-	0x00, 0x3b, 0xb4, 0x08, 0x80, 0x00, 0x68, 0x75,
-	0x05, 0x71, 0x0a, 0x3d, 0x55, 0x00, 0x23, 0xab,
-	0xd3, 0x77, 0x55, 0x05, 0x7a, 0x67, 0x79, 0x87,
-	0xac, 0x77, 0x8a, 0xbc, 0xcc, 0x98, 0x9a, 0xab,
-	0xcc, 0x77, 0x77, 0x7a, 0xcc, 0x56, 0x66, 0x57,
-	0xcc, 0x05, 0x55, 0x55, 0x00, 0x52, 0x59, 0x00,
-	0x4a, 0x58, 0x00, 0x7e, 0x77, 0x00, 0x85, 0x4f,
-	0x00, 0x2e, 0x01, 0xb3, 0xa7, 0x9f, 0x05, 0x85,
-	0x87, 0x7a, 0x96, 0x95, 0x00, 0x68, 0x00, 0x1e,
-	0xcc, 0x00, 0x5f, 0xcc, 0xa7, 0x00, 0x78, 0x42,
-	0xca, 0x89, 0xcc, 0xcb, 0xa5, 0x00, 0x87, 0x98,
-	0xf2, 0x75, 0x8f, 0x55, 0x75, 0x01, 0x76, 0x16,
-	0xbb, 0x27, 0x06, 0xcd, 0x57, 0x55, 0x56, 0x66,
-	0x7a, 0x77, 0x77, 0x89, 0xac, 0xaa, 0xab, 0xbc,
-	0xcc, 0x77, 0x78, 0xbb, 0xcc, 0x55, 0x56, 0x67,
-	0xac, 0xb5, 0x00, 0x9e, 0x7b, 0x00, 0x1c, 0x5a,
-	0x22, 0x21, 0x84, 0x08, 0x94, 0x5d, 0x21, 0x0a,
-	0x05, 0x21, 0x0b, 0x21, 0x36, 0x01, 0xd6, 0x90,
-	0x94, 0xa5, 0x1d, 0x94, 0xb7, 0x00, 0x84, 0x00,
-	0x7b, 0x03, 0x84, 0xba, 0x98, 0x75, 0x7f, 0xac,
-	0x9b, 0x02, 0xf6, 0x2f, 0x3b, 0x04, 0xc1, 0x02,
-	0xd8, 0x01, 0xe0, 0x05, 0x20, 0xba, 0x56, 0x66,
-	0x8a, 0xcc, 0x00, 0x7f, 0xcc, 0x99, 0x04, 0x9a,
-	0xcc, 0x98, 0xbc, 0xcc, 0x55, 0x68, 0x99, 0xfa,
-	0xac, 0x20, 0x95, 0x7a, 0x01, 0x9c, 0x31, 0x39,
-	0x01, 0x46, 0x01, 0x88, 0x01, 0x60, 0xc7, 0x01,
-	0xe8, 0x01, 0xf0, 0x01, 0xf8, 0xcc, 0xca, 0x70,
-	0x03, 0x84, 0x00, 0x80, 0x0f, 0x21, 0x18, 0x21,
-	0x20, 0x21, 0x28, 0x29, 0x3f, 0x00, 0x45, 0x33,
-	0x22, 0x69, 0x84, 0x55, 0x33, 0x94, 0x55, 0x21,
-	0xf9, 0xa4, 0x04, 0xdd, 0x03, 0x04, 0x5e, 0xa4,
-	0x45, 0x5c, 0x41, 0x34, 0xee, 0x04, 0x01, 0x41,
-	0x38, 0x2b, 0x05, 0x0c, 0x04, 0x20, 0x32, 0x03,
-	0x20, 0xe2, 0xb4, 0xff, 0xff, 0x8e, 0xf2, 0x9c,
-	0x01, 0x10, 0x40, 0x9e, 0x20, 0x00, 0x00, 0xb4,
-	0x76, 0x30, 0x04, 0x04, 0x00, 0x73, 0x23, 0x04,
-	0x04, 0x00, 0x1b, 0x1d, 0x01, 0x04, 0x55, 0x20,
-	0xf8, 0x5e, 0x94, 0x5d, 0x00, 0x9f, 0xee, 0x94,
-	0xdd, 0x7b, 0xa4, 0x00, 0x97, 0xee, 0x00, 0x13,
-	0x98, 0x84, 0x01, 0x84, 0xdd, 0x67, 0x91, 0x05,
-	0x08, 0x0f, 0x0c, 0x22, 0x22, 0x8c, 0x00, 0x8c,
-	0xe2, 0xb1, 0x98, 0xd2, 0x22, 0x23, 0xa4, 0x00,
-	0x97, 0x20, 0x00, 0x13, 0xf6, 0x30, 0xa4, 0x00,
-	0x93, 0x00, 0xa4, 0x19, 0x84, 0x44, 0x18, 0xa4,
-	0x36, 0x45, 0x24, 0xb1, 0x40, 0x76, 0x04, 0x94,
-	0x00, 0x9a, 0x55, 0xdd, 0xe9, 0x00, 0x90, 0xcc,
-	0xcc, 0xb8, 0x5c, 0x98, 0xa4, 0x00, 0x7d, 0xf5,
-	0x00, 0x13, 0xcc, 0x9b, 0xcc, 0x01, 0x88, 0x97,
-	0x06, 0x08, 0x15, 0x0c, 0x75, 0x0c, 0x20, 0xd2,
-	0x9c, 0xc2, 0x00, 0x43, 0xc1, 0x22, 0xd2, 0x22,
-	0x22, 0x00, 0xc2, 0x22, 0x23, 0x00, 0x88, 0x20,
-	0x7e, 0x00, 0x00, 0xaf, 0x94, 0x20, 0x48, 0x20,
-	0x41, 0x25, 0x54, 0x63, 0x37, 0x45, 0x63, 0x94,
-	0x20, 0xc0, 0x04, 0x55, 0x5b, 0x00, 0x93, 0x84,
-	0x45, 0x54, 0x55, 0xcc, 0x40, 0x30, 0xbb, 0x9f,
-	0xbb, 0x01, 0x84, 0xbb, 0x5f, 0x91, 0x01, 0x5c,
-	0xa8, 0x15, 0x0c, 0x18, 0x20, 0x22, 0x8c, 0xb2,
-	0xf6, 0x22, 0x00, 0x8f, 0x98, 0x22, 0xb4, 0x9b,
-	0x8c, 0x20, 0x3c, 0x3e, 0xb2, 0x00, 0x89, 0x25,
-	0xd0, 0x21, 0xcc, 0x3c, 0x48, 0x2d, 0xdb, 0x55,
-	0x04, 0x3f, 0x41, 0x74, 0x27, 0x64, 0x20, 0x5c,
-	0x00, 0xc8, 0x20, 0xe5, 0x93, 0xbb, 0x55, 0xc8,
-	0x55, 0xaa, 0xaa, 0x93, 0xaa, 0x45, 0x8b, 0x8c,
-	0xfe, 0x5a, 0x9c, 0x00, 0x91, 0x97, 0xb1, 0x01,
-	0x9c, 0x04, 0x0b, 0x06, 0x0c, 0xbb, 0x11, 0x14,
-	0x1c, 0x20, 0x33, 0x82, 0x81, 0x04, 0x0c, 0xa2,
-	0x00, 0x5f, 0x06, 0x22, 0x97, 0x84, 0xa3, 0x23,
-	0x23, 0xb3, 0x33, 0xc4, 0x33, 0x30, 0x40, 0xf3,
-	0x00, 0x33, 0x44, 0x20, 0x6c, 0x21, 0x74, 0x9f,
-	0x21, 0x70, 0x40, 0xc0, 0x41, 0xb8, 0x5c, 0x2c,
-	0x00, 0x32, 0x44, 0x55, 0x93, 0x2a, 0x55, 0x93,
-	0x59, 0x93, 0x99, 0x05, 0x18, 0x04, 0x44, 0xd6,
-	0x44, 0x01, 0xd8, 0xa1, 0x99, 0x01, 0xd8, 0x99,
-	0x04, 0x01, 0x01, 0x30, 0xbf, 0x00, 0x1b, 0x05,
-	0x01, 0x02, 0x17, 0x01, 0xa8, 0x05, 0x20, 0x03,
-	0x18, 0x59, 0x0a, 0x34, 0x0f, 0x09, 0x20, 0x05,
-	0x0c, 0x11, 0x14, 0x14, 0x20, 0x44, 0xaa, 0xaa,
-	0x44, 0x26, 0x44, 0x86, 0x61, 0xd6, 0x33, 0x00,
-	0x04, 0x18, 0x44, 0xaa, 0xf4, 0xa4, 0x44, 0x05,
-	0x01, 0x40, 0x82, 0x07, 0xd1, 0x00, 0x2b, 0x08,
-	0x01, 0x7f, 0x10, 0xf1, 0x05, 0x34, 0x37, 0x11,
-	0x5d, 0x09, 0x20, 0xf8, 0x61, 0x4c, 0x20, 0xfc,
-	0x04, 0x91, 0x40, 0xc4, 0x45, 0x55, 0x58, 0x97,
-	0x99, 0x05, 0x87, 0x52, 0x88, 0x8b, 0x88, 0x88,
-	0x00, 0xfb, 0x99, 0x97, 0x88, 0xfd, 0x97, 0x99,
-	0x97, 0xb1, 0x21, 0x18, 0x0d, 0x0c, 0x11, 0x14,
-	0x04, 0x0c, 0x4a, 0x94, 0x00, 0x3f, 0x33, 0x87,
-	0x93, 0x32, 0x87, 0x32, 0x40, 0x23, 0x88, 0x82,
-	0x22, 0x30, 0x99, 0x60, 0x45, 0x88, 0x03, 0x40,
-	0xbc, 0x8b, 0x20, 0x00, 0x43, 0x33, 0x00, 0x00,
-	0xd7, 0x93, 0x39, 0xd8, 0x41, 0x9c, 0x05, 0x03,
-	0xa8, 0x00, 0x40, 0xb0, 0x01, 0xac, 0x45, 0x67,
-	0x74, 0x55, 0x01, 0xa4, 0x57, 0x77, 0x77, 0x00,
-	0xaf, 0x88, 0xde, 0x55, 0x87, 0x88, 0x94, 0x9b,
-	0x88, 0x00, 0x13, 0xb1, 0x6f, 0x01, 0x88, 0x09,
-	0x08, 0x15, 0x0c, 0x04, 0x20, 0x72, 0xa4, 0x00,
-	0xb0, 0x22, 0xf3, 0x00, 0x4b, 0x94, 0x72, 0x22,
-	0x00, 0xaf, 0x40, 0x84, 0x40, 0x80, 0x41, 0x84,
-	0x1f, 0x60, 0x65, 0x41, 0x88, 0xb4, 0x64, 0x78,
-	0x22, 0x34, 0x05, 0x55, 0x56, 0x55, 0x20, 0x38,
-	0x57, 0x00, 0x8f, 0x56, 0x20, 0x3c, 0x66, 0x8f,
-	0x55, 0x52, 0x77, 0x94, 0x66, 0x45, 0x8f, 0x66,
-	0x01, 0x74, 0x66, 0xa7, 0x91, 0x05, 0x08, 0x0f,
-	0x0c, 0x72, 0x22, 0x8c, 0x22, 0x00, 0x6c, 0xd3,
-	0x84, 0xa8, 0x66, 0x62, 0x9c, 0x72, 0x03, 0x08,
-	0x9f, 0x7e, 0x23, 0x65, 0xdc, 0xa4, 0x21, 0x24,
-	0x3e, 0x28, 0x2a, 0x2c, 0x21, 0x21, 0x56, 0xea,
-	0x66, 0x03, 0x04, 0x66, 0x0b, 0x04, 0x56, 0x03,
-	0x04, 0x1e, 0x01, 0x00, 0x84, 0xeb, 0xa4, 0x00,
-	0x8f, 0x20, 0x04, 0x04, 0x30, 0xa4, 0x8b, 0xb4,
-	0xf3, 0x22, 0x01, 0x23, 0x90, 0x05, 0x54, 0x9c,
-	0x01, 0x78, 0x0a, 0xa1, 0x01, 0x68, 0xfe, 0x54,
-	0x40, 0xc4, 0x64, 0x7c, 0x01, 0x94, 0x0a, 0x20,
-	0x01, 0x63, 0x41, 0xe3, 0x65, 0x82, 0xcb, 0x0d,
-	0xde, 0x01, 0x64, 0x55, 0x20, 0x7d, 0x55, 0x55,
-	0xa4, 0x0e, 0x1f, 0x08, 0x00, 0x20, 0x02, 0x00,
-	0x99, 0x24, 0x33, 0x33, 0x20, 0x10, 0x5e, 0xee,
-	0xee, 0x02, 0xa4, 0x5d, 0xdd, 0xdd, 0x62, 0x05,
-	0x83, 0xdd, 0x25, 0xcc, 0x81, 0x94, 0xc3, 0xd5,
-	0x21, 0xb4, 0x33, 0x94, 0xe3, 0x04, 0x04, 0x32,
-	0x20, 0x3f, 0x05, 0x04, 0xa7, 0x21, 0x54, 0x40,
-	0x94, 0x84, 0x83, 0x20, 0xb4, 0x77, 0x00, 0x1d,
-	0xed, 0x05, 0x04, 0x63, 0x00, 0x30, 0xa4, 0x00,
-	0x00, 0x60, 0x84, 0x40, 0xa6, 0x91, 0x00, 0x5d,
-	0x00, 0x25, 0xee, 0x94, 0xdd, 0xdd, 0xa4, 0xb0,
-	0x02, 0x5c, 0xcc, 0xcc, 0xa4, 0x00, 0x7e, 0x00,
-	0x00, 0x7e
-};
-
-static const uint8 src2000[] = {
-	0x0c, 0x00, 0x4a, 0x00, 0x1e, 0x01, 0x11, 0x03,
-	0x04, 0x01, 0x17, 0x94, 0x70, 0xff, 0x03, 0x04,
-	0x01, 0x17, 0x9f, 0x03, 0x08, 0x00, 0x15, 0x94,
-	0x82, 0x05, 0x11, 0xe3, 0x0c, 0x3f, 0x05, 0x20,
-	0x11, 0x11, 0x17, 0x09, 0x08, 0xb4, 0x05, 0x49,
-	0x60, 0x11, 0x11, 0x70, 0x01, 0x77, 0x03, 0x08,
-	0x00, 0x64, 0x17, 0x7f, 0x00, 0x2c, 0xa8, 0x06,
-	0x44, 0x01, 0x62, 0x81, 0x04, 0x64, 0x87, 0x10,
-	0xbd, 0x00, 0x70, 0x71, 0x87, 0xc1, 0x07, 0x17,
-	0x07, 0x00, 0x00, 0x70, 0x00, 0x11, 0x71, 0x02,
-	0x3c, 0x02, 0x1c, 0x11, 0x00, 0x3c, 0xff, 0x83,
-	0x02, 0x8e, 0x8c, 0x88, 0x06, 0x60, 0x08, 0x4c,
-	0x0f, 0xa2, 0x01, 0xd5, 0xff, 0x01, 0x24, 0x08,
-	0x04, 0x02, 0xdd, 0x04, 0xa0, 0x05, 0x0b, 0x09,
-	0x20, 0x04, 0x33, 0x05, 0x3f, 0xf8, 0x01, 0x71,
-	0x71, 0x01, 0x70, 0x00, 0x80, 0x00, 0x88, 0xac,
-	0x0d, 0x70, 0xff, 0x24, 0x38, 0x06, 0xd8, 0x1a,
-	0x90, 0x21, 0x6f, 0x00, 0x30, 0x21, 0x03, 0x2c,
-	0x53, 0x22, 0x18, 0x7f, 0x1e, 0x01, 0x07, 0x40,
-	0x29, 0x86, 0x07, 0xe8, 0x07, 0x07, 0x03, 0x2c,
-	0x20, 0x7c, 0x17, 0xf5, 0xa2, 0x11, 0x20, 0x78,
-	0x71, 0xba, 0xa2, 0x22, 0x8c, 0x02, 0x75, 0xff,
-	0x03, 0xd8, 0x2b, 0x00, 0x25, 0x28, 0x09, 0x40,
-	0x02, 0x29, 0x03, 0xb5, 0x01, 0xbc, 0x21, 0xe8,
-	0xfb, 0x08, 0x20, 0x02, 0x49, 0x01, 0x01, 0x54,
-	0x0d, 0x60, 0x20, 0xf4, 0x02, 0x84, 0x06, 0x04,
-	0xfa, 0x77, 0x00, 0x3c, 0x10, 0x05, 0xc1, 0x21,
-	0x34, 0x06, 0x73, 0x02, 0x94, 0x0c, 0xa0, 0xff,
-	0x0c, 0x20, 0x0d, 0xc0, 0x41, 0x78, 0x41, 0x6e,
-	0x33, 0xe8, 0x0c, 0xc0, 0x10, 0x40, 0x0c, 0x14,
-	0xff, 0x02, 0xc8, 0x0a, 0xc0, 0x2d, 0x70, 0x2f,
-	0x7c, 0x12, 0x20, 0x47, 0xdf, 0x2c, 0x94, 0x46,
-	0x7b, 0xff, 0x2b, 0xfd, 0x25, 0xfc, 0x4e, 0x04,
-	0x0e, 0x35, 0x2c, 0xe1, 0x29, 0x80, 0x49, 0x55,
-	0x06, 0x08, 0xff, 0x20, 0x80, 0x21, 0x78, 0x61,
-	0x38, 0x40, 0xc8, 0x62, 0x48, 0x60, 0xa2, 0x23,
-	0xac, 0x45, 0x00, 0xff, 0x27, 0x24, 0x22, 0x50,
-	0x26, 0xf0, 0x61, 0xb3, 0x0a, 0x1c, 0x06, 0x0c,
-	0x01, 0x18, 0x4b, 0x20, 0x9f, 0x69, 0x43, 0x27,
-	0xa0, 0x21, 0x53, 0x23, 0xfc, 0x09, 0x02, 0x11,
-	0x70, 0x45, 0x3f, 0xff, 0x03, 0x70, 0x25, 0xe0,
-	0x01, 0x2c, 0x46, 0x0c, 0x02, 0x80, 0x0b, 0x20,
-	0x48, 0x0c, 0x65, 0xa0, 0xff, 0x0a, 0x80, 0x08,
-	0xbc, 0x25, 0x50, 0x09, 0x78, 0x08, 0xdc, 0x05,
-	0xe0, 0x02, 0xa8, 0x51, 0xfc, 0xff, 0x47, 0xc0,
-	0x43, 0xf1, 0x08, 0x04, 0xa2, 0x02, 0x17, 0x06,
-	0x60, 0x03, 0x10, 0x41, 0xeb, 0x7f, 0x03, 0xc4,
-	0x25, 0x94, 0x73, 0x57, 0x09, 0xe0, 0x62, 0x1a,
-	0xa2, 0x40, 0x7c, 0x11, 0xfc, 0x71, 0x71, 0x67,
-	0x26, 0x62, 0x16, 0x61, 0xd6, 0x25, 0x7c, 0x60,
-	0xbc, 0x02, 0xc0, 0xff, 0x25, 0xa0, 0x44, 0x41,
-	0x29, 0xa0, 0x09, 0xdc, 0x48, 0x50, 0x2c, 0x04,
-	0x66, 0x70, 0x12, 0x40, 0x59, 0x23, 0x24, 0x77,
-	0x00, 0x00, 0x93, 0x10, 0x40, 0x10, 0x67, 0x84,
-	0x00, 0xff, 0x02, 0x20, 0x29, 0x80, 0x23, 0xf4,
-	0x6f, 0xa0, 0x36, 0x05, 0x2d, 0xa0, 0x11, 0xc0,
-	0x0d, 0x18, 0xb7, 0x02, 0x9c, 0x47, 0xe8, 0x20,
-	0x35, 0x17, 0x09, 0x04, 0x20, 0x48, 0x10, 0x00,
-	0xbb, 0xfe, 0x10, 0x20, 0x38, 0x03, 0x40, 0x40,
-	0xfe, 0x06, 0x90, 0x49, 0xec, 0x00, 0x18, 0x64,
-	0xaf, 0xfe, 0x11, 0x0a, 0x20, 0x47, 0x00, 0x46,
-	0xa0, 0x6a, 0x5c, 0x45, 0x2f, 0x45, 0xc1, 0x21,
-	0xc7, 0xff, 0x01, 0xfc, 0x0d, 0x04, 0x45, 0x20,
-	0x00, 0x88, 0x02, 0x8c, 0x42, 0x20, 0x01, 0x44,
-	0x41, 0x24, 0xff, 0x03, 0x08, 0x66, 0xa0, 0x62,
-	0xd4, 0x0c, 0x04, 0x66, 0xa0, 0x41, 0x73, 0x63,
-	0x44, 0x45, 0x14, 0xff, 0x1e, 0x01, 0x06, 0xb8,
-	0x04, 0x8c, 0x05, 0x6c, 0x1a, 0x30, 0x02, 0xb5,
-	0x40, 0xd8, 0x46, 0xe0, 0xff, 0x4b, 0xc0, 0x50,
-	0x48, 0x0a, 0x41, 0x6a, 0x88, 0x47, 0x00, 0x66,
-	0x51, 0x6d, 0x7c, 0x25, 0x40, 0xff, 0x0d, 0x40,
-	0x42, 0xe4, 0x42, 0x4c, 0x44, 0xa2, 0x22, 0x78,
-	0x42, 0x44, 0x4e, 0x4c, 0x0a, 0x80, 0xfe, 0x17,
-	0x0c, 0x5c, 0x4b, 0xec, 0x6e, 0x08, 0x64, 0xa0,
-	0x66, 0x09, 0x54, 0xa0, 0x15, 0x21, 0xef, 0x45,
-	0x54, 0x0b, 0x12, 0x22, 0x38, 0x20, 0xd3, 0x71,
-	0x01, 0x18, 0x47, 0x20, 0x71, 0x00, 0xbb, 0x2c,
-	0x40, 0x40, 0xc8, 0x70, 0x40, 0xbc, 0x4a, 0xcc,
-	0x2a, 0xa0, 0x71, 0x14, 0xc0, 0xff, 0x2e, 0x80,
-	0x6b, 0x80, 0x12, 0x40, 0x28, 0x18, 0x39, 0x40,
-	0x09, 0x22, 0x07, 0x40, 0x33, 0x7f, 0xff, 0x25,
-	0x0c, 0x23, 0xf8, 0x48, 0x20, 0x41, 0xdf, 0x61,
-	0x34, 0x41, 0xfc, 0x04, 0x0c, 0x40, 0x67, 0xff,
-	0x21, 0x25, 0x0b, 0xa0, 0x2d, 0x9c, 0x0d, 0xc0,
-	0x09, 0xdc, 0x61, 0xbe, 0x0c, 0xff, 0x41, 0x21,
-	0xff, 0x29, 0x3c, 0x21, 0x8c, 0x0b, 0x40, 0x00,
-	0x23, 0x20, 0x98, 0x22, 0x7c, 0x21, 0xa8, 0x6c,
-	0x4c, 0xff, 0x4f, 0x9c, 0x2b, 0x44, 0x63, 0x50,
-	0x42, 0x8c, 0x05, 0xd0, 0x47, 0x40, 0x41, 0x2b,
-	0x03, 0x17, 0xff, 0x06, 0x0c, 0x47, 0x37, 0x68,
-	0xdf, 0x11, 0x10, 0x0b, 0x35, 0x00, 0x1d, 0x09,
-	0x4d, 0x04, 0x5f, 0xbc, 0x71, 0x77, 0x07, 0x11,
-	0x6d, 0xb9, 0x61, 0x13, 0x00, 0xce, 0x17, 0x40,
-	0x3b, 0x7f, 0x60, 0x26, 0x40, 0x38, 0x60, 0x08,
-	0x00, 0xde, 0x42, 0x78, 0x20, 0x19, 0x1f, 0x00
-};
-
-static const uint8 srcPlaneA[] = {
-	0x10, 0x00, 0xfc, 0x40, 0x00, 0x1e, 0x02, 0x1a,
-	0x02, 0x1e, 0x01, 0x1c, 0x01, 0x1e, 0x62, 0x1e,
-	0x80, 0xff, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x02,
-	0x1e, 0x80, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x02,
-	0x1e, 0x80, 0x87, 0x1e, 0x01, 0x1e, 0x80, 0x0f,
-	0x58, 0x20, 0x14, 0x20, 0x15, 0x04, 0x02, 0x78,
-	0x16, 0x20, 0x17, 0x11, 0x30, 0x1e, 0x01, 0x1e,
-	0x80, 0x1a, 0x80, 0x19, 0xc4, 0x20, 0x1a, 0x04,
-	0x02, 0x1b, 0x20, 0x1c, 0x1e, 0x80, 0x1e, 0x01,
-	0x03, 0x1e, 0x80, 0x0a, 0x58, 0x20, 0x1d, 0x20,
-	0x1e, 0x20, 0x1f, 0x7b, 0xb2, 0x81, 0x21, 0x13,
-	0x30, 0x1e, 0x01, 0x1e, 0x80, 0x18, 0x80, 0x22,
-	0x10, 0x20, 0x23, 0x20, 0x24, 0xb2, 0x25, 0x20,
-	0x26, 0x0f, 0x1e, 0x80, 0x1e, 0x01, 0x19, 0x80,
-	0x0d, 0x18, 0x20, 0x27, 0x20, 0x28, 0x10, 0x20,
-	0x29, 0x20, 0x2a, 0x92, 0x2b, 0x20, 0x2c, 0xfc,
-	0x20, 0x2d, 0x1e, 0x38, 0x1e, 0x01, 0x1e, 0x80,
-	0x23, 0xf2, 0xcd, 0x18, 0x20, 0x2e, 0x20, 0x2f,
-	0x20, 0x30, 0x20, 0x31, 0x20, 0x32, 0x20, 0x33,
-	0x20, 0x34, 0x20, 0x35, 0x20, 0x36, 0x20, 0x37,
-	0x1e, 0x38, 0x07, 0x1e, 0x01, 0x1e, 0x80, 0x05,
-	0xf8, 0x38, 0x20, 0x39, 0x20, 0x3a, 0x11, 0xb2,
-	0x3b, 0x20, 0x3c, 0x66, 0xa6, 0x14, 0x40, 0x15,
-	0x79, 0x04, 0x02, 0x16, 0x40, 0x6a, 0x08, 0x1e,
-	0x01, 0x1e, 0x80, 0x4a, 0xf0, 0x3d, 0x10, 0x20,
-	0x3e, 0x20, 0x3f, 0xb2, 0x40, 0x20, 0x41, 0x41,
-	0x06, 0x7e, 0x18, 0x40, 0x19, 0x40, 0x1a, 0x04,
-	0x02, 0x1b, 0x1e, 0x40, 0x6a, 0x08, 0x1e, 0x01,
-	0x1e, 0x80, 0x0a, 0x80, 0x42, 0x20, 0x43, 0x11,
-	0x04, 0x02, 0x44, 0x20, 0x45, 0x06, 0x80, 0x1d,
-	0x40, 0x1e, 0xe4, 0x40, 0x1f, 0xb2, 0x20, 0x40,
-	0x6c, 0x08, 0x1e, 0x01, 0x1e, 0x80, 0x41, 0x48,
-	0xf0, 0x46, 0x20, 0x47, 0x20, 0x48, 0x04, 0x02,
-	0x49, 0x41, 0x68, 0x24, 0x22, 0x40, 0x23, 0x40,
-	0x24, 0xb2, 0x25, 0x1e, 0x40, 0x6c, 0x08, 0x1e,
-	0x01, 0x1e, 0x80, 0x08, 0x80, 0x4a, 0x20, 0x4b,
-	0x14, 0x20, 0x4c, 0x04, 0x02, 0x4d, 0x04, 0x7c,
-	0x27, 0x40, 0x28, 0x10, 0x40, 0x29, 0x40, 0x2a,
-	0x92, 0x2b, 0x40, 0x2c, 0xfe, 0x40, 0x66, 0x08,
-	0x1e, 0x80, 0x1e, 0x01, 0x7b, 0x80, 0x20, 0xf4,
-	0xca, 0x2e, 0x40, 0x2f, 0x40, 0x30, 0x40, 0x31,
-	0x40, 0x32, 0x40, 0x33, 0x40, 0x34, 0x40, 0x35,
-	0x40, 0x36, 0x40, 0x68, 0x08, 0x0f, 0x1e, 0x80,
-	0x1e, 0x01, 0x2b, 0x00, 0x0d, 0x50, 0x40, 0x38,
-	0x40, 0x39, 0xe4, 0x40, 0x3a, 0xb2, 0x3b, 0x40,
-	0x60, 0x08, 0x0d, 0x28, 0x1e, 0x80, 0x03, 0x1e,
-	0x01, 0x19, 0x80, 0x40, 0x3d, 0x40, 0x3e, 0x40,
-	0x3f, 0x7f, 0xb2, 0x81, 0x62, 0x08, 0x1e, 0x80,
-	0x1e, 0x01, 0x1e, 0x80, 0x09, 0x80, 0x42, 0xe4,
-	0x40, 0x43, 0x04, 0x02, 0x44, 0x40, 0x62, 0x08,
-	0x1e, 0x80, 0x1e, 0x01, 0x03, 0x1e, 0x80, 0x06,
-	0x50, 0x40, 0x46, 0x40, 0x47, 0x40, 0x48, 0x3f,
-	0x04, 0x02, 0x64, 0x08, 0x1e, 0x80, 0x1e, 0x01,
-	0x57, 0x80, 0x0e, 0x5e, 0x4a, 0x40, 0xe8, 0x4b,
-	0x40, 0x4c, 0x04, 0x02, 0x4d, 0x15, 0x7a, 0x1e,
-	0x80, 0x1e, 0x01, 0xff, 0x19, 0xd8, 0x1e, 0x02,
-	0x1e, 0x80, 0x1e, 0x01, 0x33, 0x80, 0xd9, 0x51,
-	0x00, 0x52, 0x00, 0x53, 0x00, 0x54, 0x00, 0x55,
-	0x00, 0x56, 0x00, 0x57, 0x00, 0x58, 0x00, 0x59,
-	0x00, 0x5a, 0x00, 0x5b, 0x00, 0x5c, 0x00, 0x5d,
-	0x00, 0x5e, 0x00, 0x5f, 0x00, 0x4e, 0x00, 0x4f,
-	0x1e, 0x80, 0x1e, 0x01, 0xff, 0x57, 0x80, 0xde,
-	0x00, 0x60, 0x00, 0x61, 0x00, 0x62, 0x00, 0x63,
-	0x00, 0x64, 0x00, 0x65, 0x00, 0x66, 0x00, 0x67,
-	0x00, 0x68, 0x00, 0x69, 0x00, 0x6a, 0x00, 0x6b,
-	0x00, 0x6c, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x6f,
-	0x00, 0x90, 0x00, 0x91, 0x00, 0x92, 0x1e, 0x80,
-	0x1e, 0x01, 0x16, 0x80, 0xdd, 0x70, 0x00, 0x71,
-	0x00, 0x72, 0x00, 0x73, 0x00, 0x74, 0x00, 0x75,
-	0x00, 0x76, 0x00, 0x77, 0x00, 0x78, 0x00, 0x79,
-	0x00, 0x7a, 0x00, 0x7b, 0x00, 0x7c, 0x00, 0x7d,
-	0x00, 0x7e, 0x00, 0x7f, 0x00, 0x50, 0x00, 0x93,
-	0x00, 0x94, 0x1e, 0x78, 0x1e, 0x01, 0xff, 0x16,
-	0x80, 0xc5, 0x80, 0x00, 0x81, 0x00, 0x82, 0x00,
-	0x83, 0x00, 0x84, 0x00, 0x85, 0x00, 0x86, 0x9e,
-	0xcd, 0x88, 0x00, 0x89, 0x00, 0x8a, 0x00, 0x8b,
-	0x00, 0x8c, 0x00, 0x8d, 0x00, 0x8e, 0x00, 0x8f,
-	0x00, 0x87, 0x00, 0x95, 0x00, 0x96, 0x1e, 0x80,
-	0x1e, 0x01, 0x5e, 0x80, 0x1e, 0x02, 0xff, 0x1e,
-	0x01, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x80, 0x1e,
-	0x01, 0x1e, 0x01, 0x1e, 0x98, 0x1e, 0x28, 0xff,
-	0x1e, 0x01, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x01,
-	0x1e, 0x01, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x01,
-	0x7f, 0x1e, 0x01, 0x1e, 0x01, 0x1e, 0x80, 0x1e,
-	0x01, 0x1e, 0x01, 0x50, 0x80, 0x1f
-};
+	if (d - 3 > _spriteBuffer)
+		*(reinterpret_cast<uint8*>(d) - 5) = 0;
 
-static const uint8 srcPlaneB[] = {
-	0x10, 0x00, 0xfc, 0x00, 0x01, 0x1e, 0x02, 0x1b,
-	0x02, 0x1e, 0x01, 0x1c, 0x01, 0x1e, 0x62, 0x1b,
-	0x02, 0xbc, 0x60, 0x02, 0x1e, 0x02, 0x1a, 0x02,
-	0x1e, 0x62, 0x1d, 0x80, 0x03, 0x1e, 0x02, 0xff,
-	0x1a, 0x02, 0x1e, 0x62, 0x1e, 0x02, 0x1e, 0x02,
-	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
-	0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
-	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
-	0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
-	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
-	0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
-	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
-	0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02,
-	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
-	0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e,
-	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
-	0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02,
-	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
-	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e,
-	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
-	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff,
-	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
-	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
-	0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
-	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
-	0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
-	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
-	0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
-	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
-	0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02,
-	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
-	0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e,
-	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
-	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x07, 0x1e, 0x02,
-	0x0d, 0x02, 0x1f, 0x00
-};
+	_sr->loadToVRAM(_spriteBuffer, (d - _spriteBuffer) * sizeof(uint16), 0xFE00);
+}
 
 void Renderer_SCD::reconfigPlanes() {
 	if (_modeChange == 0xFF)
@@ -1045,54 +706,15 @@ void Renderer_SCD::reconfigPlanes() {
 	in += 2;
 	_sr->memsetVRAM(*in, 0, 0x200);
 	_sr->memsetVRAM(0, 0, _mode ? 0xC000 : 0xB000);
-
-	static const uint8 data[] = {
-		0x33, 0x2e, 0x21, 0x34, 0x23, 0x28, 0x25, 0x32,
-		0x00, 0x34, 0x2d, 0x00, 0x29, 0x33, 0x21, 0x00,
-		0x34, 0x32, 0x21, 0x24, 0x25, 0x2d, 0x21, 0x32,
-		0x2b, 0x00, 0x2f, 0x26, 0x00, 0x2b, 0x2f, 0x2e,
-		0x21, 0x2d, 0x29, 0x00, 0x23, 0x2f, 0x0e, 0x0c,
-		0x2c, 0x34, 0x24, 0x0e, 0x34, 0x2d, 0x00, 0x21,
-		0x2e, 0x24, 0x00, 0x5f, 0x00, 0x11, 0x19, 0x19,
-		0x14, 0x00, 0x2b, 0x2f, 0x2e, 0x21, 0x2d, 0x29,
-		0x00, 0x23, 0x2f, 0x0e, 0x0c, 0x2c, 0x34, 0x24,
-		0x0e, 0x00, 0x2c, 0x29, 0x23, 0x25, 0x2e, 0x33,
-		0x25, 0x24, 0x00, 0x22, 0x39, 0x00, 0x33, 0x25,
-		0x27, 0x21, 0x00, 0x25, 0x2e, 0x34, 0x25, 0x32,
-		0x30, 0x32, 0x29, 0x33, 0x25, 0x33, 0x0c, 0x2c,
-		0x34, 0x24, 0x0e
-	};
-
-	uint16 *d = new uint16[ARRAYSIZE(data)];
-	for (int i = 0; i < ARRAYSIZE(data); ++i)
-		d[i] = TO_BE_16(data[i] | 0x100);
-
-	_sr->loadToVRAM(d, 22, 0xE294);
-	_sr->loadToVRAM(&d[12], 4, 0xE39C);
-	_sr->loadToVRAM(&d[14], 60, 0xE482);
-	_sr->loadToVRAM(&d[44], 58, 0xE704);
-	_sr->loadToVRAM(&d[74], 22, 0xEA94);
-	_sr->loadToVRAM(&d[86], 42, 0xEB8C);
-	
-	delete[] d;
-
-	uint32 len = Util::decodeSCDData(src0000 + 2, _tempBuffer);
-	_sr->loadToVRAM(_tempBuffer, len, 0);
-	len = Util::decodeSCDData(src2000 + 2, _tempBuffer);
-	_sr->loadToVRAM(_tempBuffer, len, 0x2000);
-	len = Util::decodeSCDData(srcPlaneA + 2, _tempBuffer);
-	_sr->loadToVRAM(_tempBuffer, len, 0xE000);
-	len = Util::decodeSCDData(srcPlaneB + 2, _tempBuffer);
-	_sr->loadToVRAM(_tempBuffer, len, 0xC000);
 	
 	_modeChange = 0;
 }
 
 void Renderer_SCD::updateScrollState() {
-	if (!_scroll->nextFrame())
+	if (!_trs->nextFrame())
 		return;
 
-	const ScrollManager::ScrollState &s = _scroll->getState();
+	const TransitionManager::ScrollState &s = _trs->scroll_getState();
 
 	if (s.hInt.needUpdate) {
 		_sr->hINT_enable(s.hInt.enable);
@@ -1102,8 +724,8 @@ void Renderer_SCD::updateScrollState() {
 	}
 
 	if (!s.disableVScroll) {
-		_sr->writeUint16VSRAM(0, TO_BE_16(s.offsets[ScrollManager::kVertA] & 0x3FF));
-		_sr->writeUint16VSRAM(2, TO_BE_16(s.offsets[ScrollManager::kVertB] & 0x3FF));
+		_sr->writeUint16VSRAM(0, TO_BE_16(s.realOffsets[TransitionManager::kVertA] & 0x3FF));
+		_sr->writeUint16VSRAM(2, TO_BE_16(s.realOffsets[TransitionManager::kVertB] & 0x3FF));
 	}
 
 	if (s.lineScrollMode) {
@@ -1111,45 +733,42 @@ void Renderer_SCD::updateScrollState() {
 			_sr->writeUint16VRAM(0xF822 + i * 4, TO_BE_16(s.hScrollTable[i] & 0x3FF));
 	} else {
 		uint16 addr = _mode ? 0xF800 : 0xB800;
-		_sr->writeUint16VRAM(addr, TO_BE_16(s.offsets[ScrollManager::kHorzA] & 0x3FF));
-		_sr->writeUint16VRAM(addr + 2, TO_BE_16(s.offsets[ScrollManager::kHorzB] & 0x3FF));
+		_sr->writeUint16VRAM(addr, TO_BE_16(s.realOffsets[TransitionManager::kHorzA] & 0x3FF));
+		_sr->writeUint16VRAM(addr + 2, TO_BE_16(s.realOffsets[TransitionManager::kHorzB] & 0x3FF));
 	}
 }
 
-void Renderer_SCD::drawSprite(AnimObject &a) {
+void Renderer_SCD::generateSpriteData(AnimObject &a, uint16 &spritesCurIndex, uint16 *&spritesBufferCurPos) {
 	const uint16 *in = a.spriteData;
-	uint16 num = FROM_BE_16(*in++);
-	uint16 *d = _spriteBuffer;
-	memset(d, 0, 4 * sizeof(uint16));
-	int nxt = 1;
+	uint16 num = FROM_BE_16(*in++) + 1;
 
-	uint32 curY = a.posY + 0x800000;
-	uint32 curX = a.posX + 0x800000;
+	int32 curY = a.posY + 0x800000;
+	int32 curX = a.posX + 0x800000;
 
 	if (a.drawFlags & 4) {
-		const ScrollManager::ScrollState &s = _scroll->getState();
-		curX += s.offsets[ScrollManager::kHorzA];
-		curY += s.offsets[ScrollManager::kVertA];
+		const TransitionManager::ScrollState &s = _trs->scroll_getState();
+		curX += (s.unmodifiedOffsets[TransitionManager::kHorzA] << 16);
+		curY += (s.unmodifiedOffsets[TransitionManager::kVertA] << 16);
 	}
 
 	if (a.drawFlags & 8) {
-		const ScrollManager::ScrollState &s = _scroll->getState();
-		curX += s.offsets[ScrollManager::kHorzB];
-		curY += s.offsets[ScrollManager::kVertB];
+		const TransitionManager::ScrollState &s = _trs->scroll_getState();
+		curX += (s.unmodifiedOffsets[TransitionManager::kHorzB] << 16);
+		curY += (s.unmodifiedOffsets[TransitionManager::kVertB] << 16);
 	}
 
 	uint16 flip = (a.drawFlags & 3) << 11;
 	uint16 p = ((a.f18 & 4) << 13) | ((a.f18 & 0xF8) >> 3);
 
-	for (int i = 0; i < num && nxt < 65; ++i) {
-		uint16 origY = FROM_BE_16(*in++);
+	for (int i = 0; i < num && spritesCurIndex < 65; ++i) {
+		int16 origY = FROM_BE_16(*in++);
 		uint16 hw = FROM_BE_16(*in++);
 
 		if (a.drawFlags & 2)
 			origY = -origY - (((hw >> 5) & 0x18) + 8);
 
 		uint16 tl = FROM_BE_16(*in++);
-		uint16 origX = FROM_BE_16(*in++);
+		int16 origX = FROM_BE_16(*in++);
 
 		if (a.drawFlags & 1)
 			origX = -origX - (((hw >> 7) & 0x18) + 8);
@@ -1160,20 +779,25 @@ void Renderer_SCD::drawSprite(AnimObject &a) {
 			tl = (tl & 0x9FFF) | v;
 		}
 
-		*d++ = TO_BE_16(origY + (curY >> 16));
-		*d++ = TO_BE_16(hw + (nxt++));
-		*d++ = TO_BE_16(tl);
-		*d++ = TO_BE_16(origX + (curX >> 16));
+		*spritesBufferCurPos++ = TO_BE_16(origY + (curY >> 16));
+		*spritesBufferCurPos++ = TO_BE_16(hw + (spritesCurIndex++));
+		*spritesBufferCurPos++ = TO_BE_16(tl);
+		*spritesBufferCurPos++ = TO_BE_16(origX + (curX >> 16));
 	}
-
-	if (d - 3 > _spriteBuffer)
-		*(reinterpret_cast<uint8*>(d) - 5) = 0;
-
-	_sr->loadToVRAM(_spriteBuffer, (d - _spriteBuffer) * sizeof(uint16), 0xFE00);
 }
 
 void Renderer_SCD::updateAnim32Spec(AnimObject &a) {
-
+	int _animSpec_activate = 0;
+	switch (_animSpec_activate) {
+	case 0:
+
+		break;
+	case 1:
+	case 2:
+		break;
+	default:
+		break;
+	}
 }
 
 bool Renderer_SCD::reachedAudioTimeStamp(AnimObject &a) const {
@@ -1196,7 +820,6 @@ void Renderer_SCD::runAnimScript(AnimObject &a) {
 		uint8 opcode = *in++;
 		if (opcode & 0x80) {
 			opcode -= 0x80;
-			debug("%s(): anim: %d, opcode %d", __FUNCTION__, &a - _animations, opcode);
 			assert(opcode < _animProcs.size());
 			if (_animProcs[opcode]->isValid())
 				incr = (*_animProcs[opcode])(a, in);
@@ -1208,32 +831,41 @@ void Renderer_SCD::runAnimScript(AnimObject &a) {
 	}
 }
 
-#define ANM(x) &Renderer_SCD::anim_##x
 void Renderer_SCD::makeAnimFunctions() {
+#ifndef ANIM_DEBUG
+	#define ANM(x) &Renderer_SCD::anim_##x
 	typedef int (Renderer_SCD::*AnimFunc)(AnimObject&, const uint8*);
 	static const AnimFunc funcTbl[] = {
-		ANM(remove),
+#else
+	#define ANM(x) {&Renderer_SCD::anim_##x, #x}
+	struct FuncTblEntry {
+		GfxAnimFunc::AnimFunc func;
+		const char *desc;
+	};
+	static const FuncTblEntry funcTbl[] = {
+#endif
+		ANM(terminate),
 		ANM(setFrame),
 		ANM(seqSetFrame),
 		ANM(rndSeqSetFrame),
 		ANM(setX),
 		ANM(setY),
-		ANM(06),
-		ANM(07),
+		ANM(setSpeedX),
+		ANM(setSpeedY),
 		ANM(palEvent),
 		ANM(palReset),
 		ANM(copyCmds),
-		ANM(11),
-		ANM(12),
-		ANM(13),
-		ANM(14),
-		ANM(15),
+		ANM(nop),
+		ANM(scrollSingleStepH),
+		ANM(scrollSingleStepV),
+		ANM(scrollStartH),
+		ANM(scrollStartV),
 		ANM(pause),
 		ANM(pause),
 		ANM(pause),
 		ANM(pause),
 		ANM(resumeAndUnsyncOther),
-		ANM(removeOther),
+		ANM(terminateOther),
 		ANM(pauseAndHideOther),
 		ANM(hide),
 		ANM(24),
@@ -1262,16 +894,20 @@ void Renderer_SCD::makeAnimFunctions() {
 		ANM(47)
 	};
 
-	for (uint i = 0; i < ARRAYSIZE(funcTbl); ++i) \
+	for (uint i = 0; i < ARRAYSIZE(funcTbl); ++i)
+#ifndef ANIM_DEBUG
 		_animProcs.push_back(new GfxAnimFunc(this, funcTbl[i]));
-}
+#else
+		_animProcs.push_back(new GfxAnimFunc(this, funcTbl[i].func, funcTbl[i].desc));
+#endif
 #undef ANM
+}
 
 uint16 animRand(uint16 a, uint16 b) {
 	return ((b * Util::rngMakeNumber()) >> 16) + a;
 }
 
-int Renderer_SCD::anim_remove(AnimObject &a, const uint8 *data) {
+int Renderer_SCD::anim_terminate(AnimObject &a, const uint8 *data) {
 	a.clear();
 	return -1;
 }
@@ -1304,27 +940,27 @@ int Renderer_SCD::anim_rndSeqSetFrame(AnimObject &a, const uint8 *data) {
 }
 
 int Renderer_SCD::anim_setX(AnimObject &a, const uint8 *data) {
-	uint16 xdiff = READ_BE_UINT16(data + 1) - (a.posX >> 16);
+	int16 xdiff = READ_BE_UINT16(data + 1) - (a.posX >> 16);
 	a.frameDelay = -1;
 	anim_setGroupParameter(a, 0, xdiff);
 	return 1;
 }
 
 int Renderer_SCD::anim_setY(AnimObject &a, const uint8 *data) {
-	uint16 ydiff = READ_BE_UINT16(data + 1) - (a.posY >> 16);
+	int16 ydiff = READ_BE_UINT16(data + 1) - (a.posY >> 16);
 	a.frameDelay = -1;
 	anim_setGroupParameter(a, 1, ydiff);
 	return 1;
 }
 
-int Renderer_SCD::anim_06(AnimObject &a, const uint8 *data) {
-	a.speedXa = (READ_BE_UINT16(data + 1) << 16) | (*data << 8);
+int Renderer_SCD::anim_setSpeedX(AnimObject &a, const uint8 *data) {
+	a.relSpeedX = (int32)((READ_BE_UINT16(data + 1) << 16) | (*data << 8));
 	anim_setGroupParameter(a, 2);
 	return 1;
 }
 
-int Renderer_SCD::anim_07(AnimObject &a, const uint8 *data) {
-	a.speedYa = (READ_BE_UINT16(data + 1) << 16) | (*data << 8);
+int Renderer_SCD::anim_setSpeedY(AnimObject &a, const uint8 *data) {
+	a.relSpeedY = (int32)((READ_BE_UINT16(data + 1) << 16) | (*data << 8));
 	anim_setGroupParameter(a, 3);
 	return 1;
 }
@@ -1345,34 +981,34 @@ int Renderer_SCD::anim_palReset(AnimObject &a, const uint8 *data) {
 
 int Renderer_SCD::anim_copyCmds(AnimObject &a, const uint8 *data) {
 	ResourcePointer r = a.scriptData + READ_BE_INT16(data + 1);
-	return enqueueCopyCommands(r) ? 1 : -1;
+	return enqueueDrawCommands(r) ? 1 : -1;
 }
 
-int Renderer_SCD::anim_11(AnimObject &a, const uint8 *data) {
+int Renderer_SCD::anim_nop(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_12(AnimObject &a, const uint8 *data) {
-	_scroll->doCommand(1);
-	_scroll->setSingleStep(*data ? ScrollManager::kHorzB : ScrollManager::kHorzA, READ_BE_INT16(data + 1));
+int Renderer_SCD::anim_scrollSingleStepH(AnimObject &a, const uint8 *data) {
+	_trs->doCommand(1);
+	_trs->scroll_setSingleStep(*data ? TransitionManager::kHorzB : TransitionManager::kHorzA, READ_BE_INT16(data + 1));
 	return 1;
 }
 
-int Renderer_SCD::anim_13(AnimObject &a, const uint8 *data) {
-	_scroll->doCommand(1);
-	_scroll->setSingleStep(*data ? ScrollManager::kVertB : ScrollManager::kVertA, READ_BE_INT16(data + 1));
+int Renderer_SCD::anim_scrollSingleStepV(AnimObject &a, const uint8 *data) {
+	_trs->doCommand(1);
+	_trs->scroll_setSingleStep(*data ? TransitionManager::kVertB : TransitionManager::kVertA, READ_BE_INT16(data + 1));
 	return 1;
 }
 
-int Renderer_SCD::anim_14(AnimObject &a, const uint8 *data) {
-	_scroll->doCommand(2);
-	_scroll->setDirectionAndSpeed(*data ? ScrollManager::kHorzB : ScrollManager::kHorzA, READ_BE_INT16(data + 1));
+int Renderer_SCD::anim_scrollStartH(AnimObject &a, const uint8 *data) {
+	_trs->doCommand(2);
+	_trs->scroll_setDirectionAndSpeed(*data ? TransitionManager::kHorzB : TransitionManager::kHorzA, READ_BE_INT16(data + 1));
 	return 1;
 }
 
-int Renderer_SCD::anim_15(AnimObject &a, const uint8 *data) {
-	_scroll->doCommand(2);
-	_scroll->setDirectionAndSpeed(*data ? ScrollManager::kVertB : ScrollManager::kVertA, READ_BE_INT16(data + 1));
+int Renderer_SCD::anim_scrollStartV(AnimObject &a, const uint8 *data) {
+	_trs->doCommand(2);
+	_trs->scroll_setDirectionAndSpeed(*data ? TransitionManager::kVertB : TransitionManager::kVertA, READ_BE_INT16(data + 1));
 	return 1;
 }
 
@@ -1383,19 +1019,19 @@ int Renderer_SCD::anim_pause(AnimObject &a, const uint8 *data) {
 
 int Renderer_SCD::anim_resumeAndUnsyncOther(AnimObject &a, const uint8 *data) {
 	assert(*data < 64);
-	anim_setGroupParameter(_animations[*data], 4);
+	anim_setGroupParameter(*_animations[*data], 4);
 	return 1;
 }
 
-int Renderer_SCD::anim_removeOther(AnimObject &a, const uint8 *data) {
+int Renderer_SCD::anim_terminateOther(AnimObject &a, const uint8 *data) {
 	assert(*data < 64);
-	_animations[*data].clear();
+	_animations[*data]->clear();
 	return 1;
 }
 
 int Renderer_SCD::anim_pauseAndHideOther(AnimObject &a, const uint8 *data) {
 	assert(*data < 64);
-	_animations[*data].controlFlags = GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide;
+	_animations[*data]->controlFlags = GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide;
 	return 1;
 }
 
@@ -1405,6 +1041,7 @@ int Renderer_SCD::anim_hide(AnimObject &a, const uint8 *data) {
 }
 
 int Renderer_SCD::anim_24(AnimObject &a, const uint8 *data) {
+	a.f4e |= 2;
 	return 1;
 }
 
@@ -1415,10 +1052,14 @@ int Renderer_SCD::anim_audioSync(AnimObject &a, const uint8 *data) {
 }
 
 int Renderer_SCD::anim_27(AnimObject &a, const uint8 *data) {
+	a.f4e |= 1;
+	_gfxState.setVar(4, *data);
 	return 1;
 }
 
 int Renderer_SCD::anim_28(AnimObject &a, const uint8 *data) {
+	a.f4e |= 0x80;
+	_gfxState.setVar(4, a.f4e);
 	return 1;
 }
 
@@ -1460,7 +1101,7 @@ int Renderer_SCD::anim_36(AnimObject &a, const uint8 *data) {
 int Renderer_SCD::anim_37(AnimObject &a, const uint8 *data) {
 	static const uint8 cmd[] = { 0x25, 0x00 };
 	ResourcePointer r(data, 0);
-	enqueueCopyCommands(r);
+	enqueueDrawCommands(r);
 	return 1;
 }
 
@@ -1517,15 +1158,14 @@ int Renderer_SCD::anim_updateFrameDelay(AnimObject &a, const uint8 *data) {
 	} else {
 		a.frameDelay = READ_BE_INT16(data);
 	}
-	debug("%s(): anim: %d, setting delay %d", __FUNCTION__,  &a - _animations, a.frameDelay);
 	return -1;
 }
 
-void Renderer_SCD::anim_setGroupParameter(AnimObject &a, int para, uint16 val, bool recursive) {
+void Renderer_SCD::anim_setGroupParameter(AnimObject &a, int para, int16 val, bool recursive) {
 	AnimObject *ta = &a;
 	for (int n = ta->children; n || !recursive; n = recursive ? ta->next : 0) {
 		if (recursive)
-			ta = &_animations[n];
+			ta = _animations[n];
 		switch (para) {
 		case 0:
 			ta->posX += (val << 16);
@@ -1534,14 +1174,14 @@ void Renderer_SCD::anim_setGroupParameter(AnimObject &a, int para, uint16 val, b
 			ta->posY += (val << 16);
 			break;
 		case 2:
-			a.speedX = a.speedXa;
+			a.absSpeedX = a.relSpeedX;
 			if (ta->parent)
-				a.speedX += _animations[ta->parent].speedX;
+				a.absSpeedX += _animations[ta->parent]->absSpeedX;
 			break;
 		case 3:
-			a.speedY = a.speedYa;
+			a.absSpeedY = a.relSpeedY;
 			if (ta->parent)
-				a.speedY += _animations[ta->parent].speedY;
+				a.absSpeedY += _animations[ta->parent]->absSpeedY;
 			break;
 		case 4:
 			ta->controlFlags &= GraphicsEngine::kAnimHide;
@@ -1562,7 +1202,222 @@ void Renderer_SCD::anim_setGroupParameter(AnimObject &a, int para, uint16 val, b
 	}
 }
 
-Renderer *Renderer::createSegaRenderer(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, ScrollManager *scr) {
+// Boot logo sequence code. This has nothing to do with the engine graphics code, so I put it at the end, to keep the ugly mess out of sight...
+int Renderer_SCD::drawBootSequenceFrame(uint8 *screen, int frameNo)  {
+	uint16 *tmp = reinterpret_cast<uint16*>(_tempBuffer);
+	uint32 len = 0;
+	uint16 val = 0;
+	uint8 r = 0;
+	uint8 g = 0;
+	uint8 b = 0;
+
+	static const uint16 colors[] = {
+		0x0000, 0x0000, 0x0020, 0x0040, 0x0060, 0x0080, 0x00A0
+	};
+
+	switch (frameNo) {
+	case 0:
+		_mode = 0;
+		reconfigPlanes();
+		len = READ_BE_UINT16(StaticRes_SCD::_bootSeqData[0]);
+		if (len != Util::decodeSCDData(StaticRes_SCD::_bootSeqData[0] + 2, _tempBuffer))
+			error("%s(): Decode size mismatch", __FUNCTION__);
+		_sr->loadToVRAM(_tempBuffer, len, 0x000);
+		len = READ_BE_UINT16(StaticRes_SCD::_bootSeqData[1]);
+		if (len != Util::decodeSCDData(StaticRes_SCD::_bootSeqData[1] + 2, _tempBuffer))
+			error("%s(): Decode size mismatch", __FUNCTION__);
+		_sr->loadToVRAM(_tempBuffer, len, 0x2000);
+		_pal->selectPalettes(0x06060606);
+
+		for (int i = 0; i < 107; ++i)
+			tmp[i] = TO_BE_16(StaticRes_SCD::_bootSeqData[4][i] | 0x100);
+
+		_sr->loadToVRAM(tmp, 22, 0xE294);
+		_sr->loadToVRAM(&tmp[12], 4, 0xE39C);
+		_sr->loadToVRAM(&tmp[14], 60, 0xE482);
+		_sr->loadToVRAM(&tmp[44], 58, 0xE704);
+		_sr->loadToVRAM(&tmp[74], 22, 0xEA94);
+		_sr->loadToVRAM(&tmp[86], 42, 0xEB8C);
+
+		if (++_bootsDelay == 180) {
+			_bootsDelay = 0;
+			++frameNo;
+		}
+		break;
+
+	case 1:
+		++frameNo;
+		break;
+
+	case 2:
+		_pal->selectPalettes(0x04040405);
+		for (int i = 0; i < 7; ++i)
+			_pal->setColor(50 + i, (colors[i] >> 8) & 0x0F, (colors[i] >> 4) & 0x0F, colors[i] & 0x0F);
+		len = READ_BE_UINT16(StaticRes_SCD::_bootSeqData[3]);
+		if (len != Util::decodeSCDData(StaticRes_SCD::_bootSeqData[3] + 2, _tempBuffer))
+			error("%s(): Decode size mismatch", __FUNCTION__);
+		_sr->loadToVRAM(_tempBuffer, len, 0xC000);
+		_sr->enableDisplay(false);
+		if (++_bootsDelay == 2) {
+			_bootsDelay = 0;
+			++frameNo;
+		}
+		break;
+
+	case 3:
+		_bootsSprTbl = new uint8[128]();
+		len = READ_BE_UINT16(StaticRes_SCD::_bootSeqData[2]);
+		if (len != Util::decodeSCDData(StaticRes_SCD::_bootSeqData[2] + 2, _tempBuffer))
+			error("%s(): Decode size mismatch", __FUNCTION__);
+		_sr->loadToVRAM(_tempBuffer, len, 0xE000);
+		val = TO_BE_16(0x6001);
+		for (int i = 0; i < 3072; i += 2)
+			_sr->writeUint16VRAM(0xE140 + i, val);
+		val = TO_BE_16(0x6002);
+		for (int i = 0; i < 64; i += 2)
+			_sr->writeUint16VRAM(0xE0C0 + i, val);
+		val = TO_BE_16(0x6003);
+		for (int i = 0; i < 64; i += 2)
+			_sr->writeUint16VRAM(0xE140 + i, val);
+		_sr->writeUint16VRAM(0xE080, 0x6002);
+		_sr->writeUint16VRAM(0xE100, 0x6003);
+		WRITE_BE_UINT16(_bootsSprTbl, 0x0088);
+		WRITE_BE_UINT16(_bootsSprTbl + 2, 0x0500);
+		WRITE_BE_UINT16(_bootsSprTbl + 4, 0xE004);
+		WRITE_BE_UINT16(_bootsSprTbl + 6, 0x0080);
+		_sr->enableDisplay(true);
+		++frameNo;
+		break;
+
+	case 4:
+		_bootsSprTbl[5] = ((((_bootsTotalFrames >> 1) & 3) + 1) << 2);
+		WRITE_BE_UINT16(_bootsSprTbl + 6, READ_BE_UINT16(_bootsSprTbl + 6) + 6);
+		_bootsHScroll = (_bootsHScroll + 6) & 0x1FF;
+		if (_bootsHScroll > 0x100) {
+			_bootsHScroll = 0x100;
+			_bootsDelay = 16;
+			_bootsCol = 5;
+			++frameNo;
+		}
+		break;
+
+	case 5:
+		if (--_bootsDelay < 0) {
+			++frameNo;
+		} else if (!(_bootsDelay & 7)) {
+			for (int i = _bootsCol; i >= 0; --i)
+				_pal->adjustColor(57, 0, 2, 0);
+			++_bootsCol;
+		}
+		break;
+
+	case 6:
+		_bootsVScroll = (_bootsVScroll - 2) & 0x3FF;
+		if (_bootsVScroll <= 0x318) {
+			_bootsCol = 15;
+			_pal->selectPalettes(0xFF01FFFF);
+			_pal->setColor(16, 0, 0, 0);
+			++frameNo;
+		}
+		break;
+
+	case 7:
+		if (_bootsTotalFrames & 1)
+			break;
+
+		for (int i = 0; i < 16 - _bootsCol; ++i) {
+			_pal->getPresetColor(1, 6 + i, r, g, b);
+			_pal->setColor(16 + _bootsCol + i, r, g, b);
+			_pal->getPresetColor(2, 6 + i, r, g, b);
+			_pal->setColor(32 + _bootsCol + i, r, g, b);
+		}
+
+		if (--_bootsCol == 5) {
+			_bootsCol = 15;
+			_pal->selectPalettes(0x00FFFFFF);
+			_pal->setColor(0, 0, 0, 0);
+			++frameNo;
+		}
+
+		break;
+
+	case 8:
+		if (_bootsTotalFrames & 1)
+			break;
+
+		for (int i = 0; i < 16 - _bootsCol; ++i) {
+			_pal->getPresetColor(0, 6 + i, r, g, b);
+			_pal->setColor(_bootsCol + i, r, g, b);
+		}
+
+		if (--_bootsCol == 5) {
+			_bootsDelay = 3;
+			++frameNo;
+		}
+
+		break;
+
+	case 9:
+		if (--_bootsDelay == 0) {
+			_bootsDelay = 3;
+			_pal->adjustColor(0, 2, 2, 2);
+			_pal->getColor(0, r, g, b);
+			if (r == 0x0E && g == 0x0E && b == 0x0E) {
+				_pal->selectPalettes(0x00010203);
+				_bootsDelay = 512;
+				++frameNo;
+			}
+		}
+		break;
+
+	case 10:
+		if (--_bootsDelay == 0) {
+			_bootsDelay = 40;
+			memset(_bootsSprTbl, 0, 8);
+			++frameNo;
+		}
+		break;
+
+	case 11:
+		if (--_bootsDelay == 0) {
+			setPlaneMode(0xFF);
+			delete[] _bootsSprTbl;
+			_bootsSprTbl = nullptr;
+			frameNo = -1;
+		} else if (!(_bootsDelay & 1)) {
+			for (int i = 0; i < 64; ++i) {
+				_pal->getColor(0, r, g, b);
+				if (r >= 2)
+					r -= 2;
+				if (g >= 2)
+					g -= 2;
+				if (b >= 2)
+					b -= 2;
+				_pal->setColor(i, r, g, b);
+			}
+		}
+		break;
+
+	default:
+		break;
+	}
+
+	++_bootsTotalFrames;
+
+	_sr->writeUint16VSRAM(0, TO_BE_16(_bootsVScroll & 0x3FF));
+	_sr->writeUint16VRAM(0xB800, TO_BE_16(_bootsHScroll & 0x3FF));
+	if (_bootsSprTbl)
+		_sr->loadToVRAM(_bootsSprTbl, 64 * sizeof(uint16), 0xBE00);
+
+	_pal->updateSystemPalette();
+	_sr->setRenderColorTable(_pal->getSystemPalette(), 0, 64);
+	_sr->render(screen);
+
+	return frameNo;	
+}
+
+
+Renderer *Renderer::createSegaRenderer(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr) {
 	return new Renderer_SCD(pxf, state, pal, scr);
 }
 
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index 38c01833a95..e148c0a5baf 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -43,11 +43,13 @@ struct GameState {
 	int16 frameNo;
 	int16 frameState;
 	int16 finish;
-	int16 progressMain;
-	int16 progressSub;
+	int16 modProcessTop;
+	int16 modProcessSub;
 	int16 counter;
 	int16 modIndex;
-	int16 initState;
+	int16 menuSelect;
+	int16 main_switch_1_0_orM1_postIntr;
+	int16 topLevelState;
 };
 
 class SceneHandler {
diff --git a/engines/snatcher/scene/scene_d0.cpp b/engines/snatcher/scene/scene_d0.cpp
index b366ccbdf60..b7dd7bf6257 100644
--- a/engines/snatcher/scene/scene_d0.cpp
+++ b/engines/snatcher/scene/scene_d0.cpp
@@ -178,6 +178,7 @@ SH_IMPL_FRM(D0, 08) {
 }
 
 SH_IMPL_FRM(D0, 09) {
+	_vm->gfx()->setVar(9, 0xFF);
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 3);
 }
@@ -187,6 +188,7 @@ SH_IMPL_FRM(D0, 10) {
 }
 
 SH_IMPL_FRM(D0, 11) {
+	_vm->gfx()->setVar(9, 1);
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 4);
 }
@@ -247,7 +249,7 @@ SH_IMPL_FRM(D0, 31) {
 }
 
 SH_IMPL_FRM(D0, 32) {
-	//_sprites[16].controlFlags = 1;
+	_vm->gfx()->setAnimControlFlags(16, GraphicsEngine::kAnimPause);
 }
 
 SH_IMPL_FRM(D0, 34) {
diff --git a/engines/snatcher/scene/scene_d1.cpp b/engines/snatcher/scene/scene_d1.cpp
index 81820c730a2..1fada80d1a2 100644
--- a/engines/snatcher/scene/scene_d1.cpp
+++ b/engines/snatcher/scene/scene_d1.cpp
@@ -129,6 +129,7 @@ SH_IMPL_UPDT(D1) {
 }
 
 SH_IMPL_FRM(D1, 00) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 0);
 }
 
@@ -137,10 +138,12 @@ SH_IMPL_FRM(D1, 01) {
 }
 
 SH_IMPL_FRM(D1, 02) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 1);
 }
 
 SH_IMPL_FRM(D1, 04) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 2);
 	_vm->gfx()->setScrollStep(GraphicsEngine::kVertA | GraphicsEngine::kSingleStep, 0x110);
 	_vm->gfx()->scrollCommand(1);
@@ -167,26 +170,32 @@ SH_IMPL_FRM(D1, 09) {
 }
 
 SH_IMPL_FRM(D1, 11) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 3);
 }
 
 SH_IMPL_FRM(D1, 13) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 4);
 }
 
 SH_IMPL_FRM(D1, 15) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 5);
 }
 
 SH_IMPL_FRM(D1, 17) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 6);
 }
 
 SH_IMPL_FRM(D1, 19) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 7);
 }
 
 SH_IMPL_FRM(D1, 21) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 8);
 }
 
@@ -195,14 +204,17 @@ SH_IMPL_FRM(D1, 22) {
 }
 
 SH_IMPL_FRM(D1, 23) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 9);
 }
 
 SH_IMPL_FRM(D1, 25) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 10);
 }
 
 SH_IMPL_FRM(D1, 27) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 11);
 }
 
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene/scene_d2.cpp
index a56a5cd52b8..3d198e091c7 100644
--- a/engines/snatcher/scene/scene_d2.cpp
+++ b/engines/snatcher/scene/scene_d2.cpp
@@ -44,6 +44,10 @@ SH_DCL_FRM(10)
 SH_DCL_FRM(11)
 SH_DCL_FRM(12)
 
+// local vars
+int16 _option;
+bool _loadCancelled;
+
 SH_HEAD_END(D2)
 
 SH_IMP_FRMTBL(D2) {
@@ -62,7 +66,7 @@ SH_IMP_FRMTBL(D2) {
 	SH_FRM(12)
 };
 
-SH_IMP_CTOR(D2) {
+SH_IMP_CTOR(D2), _option(0), _loadCancelled(false) {
 	SH_CTOR_MAKEPROCS(D2);
 }
 
@@ -79,13 +83,15 @@ SH_IMPL_UPDT(D2) {
 
 bool hasRAMCart = true; 
 int _state_ua_1 = 0;
-bool hasSaveFiles = true;
+int _hasSaveSlotFlag = 15;
+int _saveFileCurID = 0;
 bool hasFreeBuram = true;
 uint8 _bua3 = 0;
 uint8 _buram_0 = 0;
 bool _buram_2 = true;
-uint8 wordA = 0;
-int16 _moduleWord = -1;
+
+int16 _sceneState_ua_2 = 0;
+int16 _sceneState_ua_3 = 0;
 
 // functions
 SH_IMPL_FRM(D2, 00) {
@@ -208,7 +214,7 @@ SH_IMPL_FRM(D2, 07) {
 		break;
 	default:
 		++state.frameNo;
-		if (hasSaveFiles)
+		if (_hasSaveSlotFlag)
 			++state.frameNo;
 		state.frameState = 0;
 		break;
@@ -246,79 +252,101 @@ SH_IMPL_FRM(D2, 08) {
 }
 
 SH_IMPL_FRM(D2, 09) {
+	bool fin = false;
 	switch (state.frameState) {
 	case 0:
 		_vm->gfx()->scrollCommand(0xFF);
-		_vm->gfx()->clearAnimControlFlags(hasSaveFiles ? 17 : 16, ~GraphicsEngine::kAnimHide);
-		state.frameState += (hasSaveFiles ? 1 : 2);
+		_vm->gfx()->clearAnimControlFlags(_hasSaveSlotFlag ? 17 : 16, ~GraphicsEngine::kAnimHide);
+		state.frameState += (_hasSaveSlotFlag ? 1 : 2);
 		break;
 	case 1:
 		if (_vm->inputFlag() & 3)
 			_vm->gfx()->clearAnimControlFlags(17, ~GraphicsEngine::kAnimHide);
 		if (_vm->inputFlag() & 0x80) {
 			_vm->gfx()->setAnimControlFlags(17, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
-			wordA = 1;
+			state.menuSelect = 1;
 			if (_vm->gfx()->getAnimCurFrame(17) == 3) {
-				wordA = 0;
+				state.menuSelect = 0;
 				++state.frameNo;
 			}
-			++state.frameNo;
-			state.frameState = 0;
-			_bua3 = 56;
-			//enqueueCommunicationStatus2Command(0);
-			_vm->gfx()->setAnimControlFlags(16, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
-			_vm->gfx()->setAnimControlFlags(17, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
-			_moduleWord = 0;
+			fin = true;
 		}
 		break;
 	default:
 		if (_vm->inputFlag() & 0x80) {
 			++state.frameNo;
 			state.frameState = 0;
+			fin = true;
 		}
 		break;
 	}
+	if (fin) {
+		++state.frameNo;
+		state.frameState = 0;
+		_bua3 = 56;
+		//enqueueCommunicationStatus2Command(0);
+		_vm->gfx()->setAnimControlFlags(16, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+		_vm->gfx()->setAnimControlFlags(17, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+		_option = 0;
+	}
 }
 
 SH_IMPL_FRM(D2, 10) {
+	bool fin = false;
 	switch (state.frameState) {
 	case 0:
 		if (state.counter == 3) {
 
 		}
 		if (state.counter != 21) {;
-			_vm->gfx()->enqueueCopyCommands(_module->getPtr(0x29142).getDataFromTable(state.counter));
+			_vm->gfx()->enqueueDrawCommands(_module->getPtr(0x29142).getDataFromTable(state.counter));
 			if (state.counter != 0)
-				_vm->gfx()->enqueueCopyCommands(_module->getPtr(0x29412).getDataFromTable(state.counter));
+				_vm->gfx()->enqueueDrawCommands(_module->getPtr(0x29412).getDataFromTable(state.counter));
 			++state.counter;
 			return;
 		}
 		_vm->gfx()->clearAnimControlFlags(24, 0xFF);
 		_vm->gfx()->clearAnimControlFlags(25, 0xFF);
+		
 
+		do {
+			if (_vm->inputFlag() & 1)
+				--_saveFileCurID;
+			if (_vm->inputFlag() & 2)
+				++_saveFileCurID;
+			_saveFileCurID &= 3;
+		} while (!(_hasSaveSlotFlag & (1 << _saveFileCurID)));
 
+		_vm->gfx()->setAnimFrame(24, _saveFileCurID << 2);
+		_vm->gfx()->setAnimFrame(25, _saveFileCurID << 2);
 
-		_vm->gfx()->setAnimControlFlags(24, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
-		_vm->gfx()->setAnimControlFlags(25, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
-		++state.frameState;
-		state.counter = 0;
-
-		++state.frameNo;
-		state.frameState = 0;
+		if (_vm->inputFlag() & 0x80) {
+			_loadCancelled = 0;
+			fin = true;
+		} else if (_vm->inputFlag() & 0x10) {
+			_loadCancelled = 1;
+			fin = true;
+		}
+		if (fin) {
+			_vm->gfx()->setAnimControlFlags(24, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+			_vm->gfx()->setAnimControlFlags(25, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+			++state.frameState;
+			state.counter = 0;
+		}
 		break;
 	case 1:
 		if (state.counter == 20) {
-			if (1/*_varVar*/) {
+			if (_loadCancelled) {
 				state.counter = 2;
 				++state.frameState;
-				_vm->gfx()->enqueueCopyCommands(_module->getPtr(29806));
+				_vm->gfx()->enqueueDrawCommands(_module->getPtr(0x29806));
 			} else {
 				state.counter = 0;
 				++state.frameNo;
 				state.frameState = 0;
 			}
 		} else {
-			_vm->gfx()->enqueueCopyCommands(_module->getPtr(0x296C6).getDataFromTable(state.counter++));
+			_vm->gfx()->enqueueDrawCommands(_module->getPtr(0x296C6).getDataFromTable(state.counter++));
 		}
 		break;
 	case 2:
@@ -339,24 +367,53 @@ SH_IMPL_FRM(D2, 10) {
 }
 
 SH_IMPL_FRM(D2, 11) {
+	int fin = 0;
 	switch (state.frameState) {
 	case 0:
 		if (state.counter < 24) {
-			_vm->gfx()->enqueueCopyCommands(_module->getPtr(0x29292).getDataFromTable(state.counter));
+			_vm->gfx()->enqueueDrawCommands(_module->getPtr(0x29292).getDataFromTable(state.counter));
 			if (state.counter != 0)
-				_vm->gfx()->enqueueCopyCommands(_module->getPtr(0x29554).getDataFromTable(state.counter));
+				_vm->gfx()->enqueueDrawCommands(_module->getPtr(0x29554).getDataFromTable(state.counter));
 			++state.counter;
 			return;
 		}
-		/*state.countDown = 10;
-		_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
-		++state.frameState;*/
 
-		_vm->sound()->pcmDoCommand(56, -1);
-		_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
-		state.counter = 10;
-		state.frameState = 0;
-		++state.frameNo;
+		for (int i = 32; i < 37; ++i)
+			_vm->gfx()->clearAnimControlFlags(i, 0xFF);
+
+		do {
+		if (_vm->inputFlag() & 1)
+			--_option;
+		if (_vm->inputFlag() & 2)
+			++_option;
+		_option = (_option + 5) % 5;
+
+		} while (_option == 3 && !_sceneState_ua_2);
+
+		//sub11_0_Do_sub_28F9C();
+		//sub11_0_dd();
+
+		_vm->gfx()->setAnimFrame(32, _option << 2);
+		_vm->gfx()->setAnimFrame(33, ((_option ? 2 : 0) + _sceneState_ua_2) << 1);
+		_vm->gfx()->setAnimFrame(36, _sceneState_ua_2 & 2);
+		_vm->gfx()->setAnimFrame(34, ((_option != 1 ? 6 : 0) + _sceneState_ua_3) << 1);
+		_vm->gfx()->setAnimFrame(35, ((_option != 2 ? 2 : 0) + _state_ua_1) << 1);
+		
+		if (_vm->inputFlag() & 0x80)
+			fin = (_option != 3) ? 1 : 3;
+		else if (_vm->inputFlag() & 0x70)
+			fin = (_option == 4) ? 1 : (_option == 3 ? 3 : 0);
+		if (fin) {
+			_vm->sound()->pcmDoCommand(55 + fin, -1);
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x290F2));
+			state.counter = 10;
+			if (fin == 1) {
+				state.frameState = 0;
+				++state.frameNo;
+			} else {
+				++state.frameState;
+			}
+		}
 		break;
 	case 1:
 		if (--state.counter)
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 4ae8305b42f..a1012e753c1 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -43,7 +43,8 @@
 
 namespace Snatcher {
 
-SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _gfx(nullptr), _snd(nullptr), _keyInput(0), _lastKey(0), _gfxInfo() {
+SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _gfx(nullptr), _snd(nullptr), _keyInput(0), _lastKeys(0),
+	_releaseKeys(0), _keyRepeat(false), _gfxInfo(), _frameLen((100000 << 14) / (6000000 / 1001)) {
 }
 
 SnatcherEngine::~SnatcherEngine() {
@@ -106,26 +107,54 @@ bool SnatcherEngine::initSound(Common::Platform platform, int soundOptions) {
 	return (_snd = new SoundEngine(platform, soundOptions));
 }
 
+void SnatcherEngine::playBootSequence() {
+	uint32 frameTimer = 0;
+	int curFrame = 0;
+
+	while (curFrame != -1 && !shouldQuit()) {
+		frameTimer += _frameLen;
+		uint32 nextFrame = _system->getMillis() + (frameTimer >> 14);
+		frameTimer &= 0x3FFF;
+
+		curFrame = _gfx->displayBootSequenceFrame(curFrame);
+
+		switch (curFrame) {
+		case 0:
+		case -1:
+			_snd->fmStartSound(242);
+			break;
+		case 7:
+			_snd->fmStartSound(63);
+			break;
+		default:
+			break;
+		}
+
+		checkEvents();
+		delayUntil(nextFrame);
+	}
+}
+
 bool SnatcherEngine::start() {
+	playBootSequence();
+
 	Util::rngReset();
 	GameState state;
 	memset(&state, 0, sizeof(GameState));
 
-	const uint32 frameLen = (1000 << 16) / 60;
 	uint32 frameTimer = 0;
 
 	int16 countTo5 = 0;
 	int16 runspeed = 0;
 
 	while (!shouldQuit()) {
-		frameTimer += frameLen;
-		uint32 nextFrame = _system->getMillis() + (frameTimer >> 16);
-		frameTimer &= 0xFFFF;
+		frameTimer += _frameLen;
+		uint32 nextFrame = _system->getMillis() + (frameTimer >> 14);
+		frameTimer &= 0x3FFF;
 
 		int _sub_doMainScript = 0;
 
-		if (runInitSequence(state))
-			continue;
+		updateTopLevelState(state);
 
 		_gfxInfo.audioSync = _snd->musicIsPlaying() ? _snd->musicGetTime() : 0;
 		Util::rngMakeNumber();
@@ -161,7 +190,7 @@ bool SnatcherEngine::start() {
 		}
 
 		_gfx->nextFrame();
-		updateEvents();
+		checkEvents();
 		delayUntil(nextFrame);
 	}
 
@@ -170,7 +199,7 @@ bool SnatcherEngine::start() {
 
 void SnatcherEngine::delayUntil(uint32 end) {
 	uint32 cur = _system->getMillis();
-	_gfxInfo.dropFrames = /*cur > end ? ((cur - end) << 16) / frameLen :*/ 0;
+	_gfxInfo.dropFrames = /*cur > end ? ((cur - end) << 14) / _frameLen :*/ 0;
 	if (cur < end)
 		_system->delayMillis(end - cur);
 }
@@ -183,8 +212,8 @@ struct InputEvent {
 	uint16 internalEvent;
 };
 
-static const InputEvent _inputEvents[] = {
-	{ Common::EVENT_LBUTTONDOWN, Common::EVENT_LBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x80 },
+static const InputEvent _defaultKeyEvents[] = {
+	// Arrow buttons
 	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_UP, 0x00, 0x01 },
 	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP8, Common::KBD_NUM, 0x01 },
 	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_DOWN, 0x00, 0x02 },
@@ -192,67 +221,69 @@ static const InputEvent _inputEvents[] = {
 	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_LEFT, 0x00, 0x04 },
 	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP4, Common::KBD_NUM, 0x04 },
 	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_RIGHT, 0x00, 0x08 },
-	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP6, Common::KBD_NUM, 0x08 }
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP6, Common::KBD_NUM, 0x08},
+	{ Common::EVENT_WHEELUP, Common::EVENT_INVALID, Common::KEYCODE_INVALID, 0x00, 0x01 },
+	{ Common::EVENT_WHEELDOWN, Common::EVENT_INVALID, Common::KEYCODE_INVALID, 0x00, 0x02 },
+
+	// A, B, C buttons
+	{ Common::EVENT_LBUTTONDOWN, Common::EVENT_LBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x10 },
+	{ Common::EVENT_MBUTTONDOWN, Common::EVENT_MBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x20 },
+	{ Common::EVENT_RBUTTONDOWN, Common::EVENT_RBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x40 },
+	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_a, 0x00, 0x10},
+	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_b, 0x00, 0x20},
+	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_c, 0x00, 0x40},
+
+	// Start button
+	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_RETURN, 0x00, 0x80},
+	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_SPACE, 0x00, 0x80},
 };
 
-void SnatcherEngine::updateEvents() {
+void SnatcherEngine::checkEvents() {
 	Common::Event evt;
-	_keyInput = 0;
+	_lastKeys &= ~_releaseKeys;
+	_keyInput = _releaseKeys = 0;
+
 	while (_eventMan->pollEvent(evt)) {
-		for (const InputEvent &k : _inputEvents) {
+		for (const InputEvent &k : _defaultKeyEvents) {
 			if (evt.type == k.pressType && (k.kc == Common::KEYCODE_INVALID || evt.kbd.keycode == k.kc) && (k.kFlag == 0 || (evt.kbd.flags & k.kFlag))) {
-				if (!(_lastKey & k.internalEvent)) {
+				if (!(_lastKeys & k.internalEvent)) {
 					_keyInput |= k.internalEvent;
-					_lastKey |= k.internalEvent;
+					_lastKeys |= k.internalEvent;
+					if (_keyRepeat || k.releaseType == Common::EVENT_INVALID)
+						_releaseKeys |= k.internalEvent;
 				}
-			} else if (evt.type == k.releaseType && (k.kc == Common::KEYCODE_INVALID || evt.kbd.keycode == k.kc) && (k.kFlag == 0 || (evt.kbd.flags & k.kFlag))) {
-				_lastKey &= ~k.internalEvent;
+			} else if ((evt.type == k.releaseType) && (k.kc == Common::KEYCODE_INVALID || evt.kbd.keycode == k.kc) && (k.kFlag == 0 || (evt.kbd.flags & k.kFlag))) {
+				_lastKeys &= ~k.internalEvent;
 			}
 		}
-
-		/*switch (evt.type) {
-		case Common::EVENT_LBUTTONDOWN:
-			_keyPressed |= (1 << 7);
-			break;
-		case Common::EVENT_LBUTTONUP:
-			_commandsFromMain |= _keyPressed;
-			break;
-		case Common::EVENT_KEYDOWN:
-			switch (evt.kbd.keycode) {
-			case Common::KEYCODE_LEFT:
-				break;
-			case Common::KEYCODE_RIGHT:
-				break;
-			case Common::KEYCODE_DOWN:
-			case Common::KEYCODE_KP2:
-				_keyPressed |= 2;
-				break;
-
-			if (!_keyPressed && (evt.kbd.keycode == Common::KEYCODE_DOWN || evt.kbd.keycode == Common::KEYCODE_UP || (evt.kbd.keycode == Common::KEYCODE_KP8 && (evt.kbd.flags & Common::KBD_NUM)) || (evt.kbd.keycode == Common::KEYCODE_KP2 && (evt.kbd.flags & Common::KBD_NUM))))
-				_keyPressed |= 3;
-		case Common::EVENT_KEYUP:
-			_commandsFromMain |= _keyPressed;
-			break;
-		default:
-			_keyPressed = 0;
-			break;
-		}*/
 	}
 }
 
-bool SnatcherEngine::runInitSequence(GameState &gameState) {
-	if (gameState.initState == -1)
-		return false;
-
-	gameState.initState = -1;
-
-	return true;
+void SnatcherEngine::updateTopLevelState(GameState &state) {
+	switch (state.topLevelState) {
+	case 0:
+		if (state.main_switch_1_0_orM1_postIntr == -1) {
+			++state.topLevelState;
+		}
+		break;
+	case 1:
+		break;
+	case 2:
+		break;
+	case 3:
+		break;
+	case 4:
+		break;
+	case 5:
+		break;
+	default:
+		error("%s(): Invalid state %d", __FUNCTION__, state.topLevelState);
+		break;
+	}
 }
 
 void SnatcherEngine::updateModuleState(GameState &state) {
-	int _main_switch_1_0_orM1_postIntr = 0;
 	uint16 _word_unk_Flags = 0;
-	int _word_unk_11 = 0;
 	int _sub_val_2 = 0;
 	int _unlCDREadSeekWord = 0;
 	uint8 _triggerPalFlag7Etc = 0;
@@ -261,32 +292,32 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 	uint8 _wordRAM__TABLE48__word_B6400[48];
 	memset(_wordRAM__TABLE48__word_B6400, 0, 48);
 
-	switch (state.progressMain) {
+	switch (state.modProcessTop) {
 	case -1:
 		_snd->musicStop();
-		state.progressMain = 0;
+		state.modProcessTop = 0;
 		break;
 	case 0:
-		switch (state.progressSub) {
+		switch (state.modProcessSub) {
 		case 0:
-			++state.progressSub;
+			++state.modProcessSub;
 			break;
 		case 1:
 			if (!_snd->musicIsPlaying()) {
 				delete _module;
 				_module = _fio->loadModule(4);
 				assert(_module);
-				++state.progressSub;
+				++state.modProcessSub;
 			}
 			break;
 		case 2:
-			++state.progressSub;
+			++state.modProcessSub;
 			break;
 		case 3:
 			//if (*(uint16*)(&_wordRAM__TABLE48__word_B6400[0])) {
-				state.progressSub = 0;
+				state.modProcessSub = 0;
 				state.finish = 0;
-				++state.progressMain;
+				++state.modProcessTop;
 			//}
 			break;
 		default:
@@ -294,25 +325,25 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 		}
 		break;
 	case 1:
-		switch (state.progressSub) {
+		switch (state.modProcessSub) {
 		case 0:
 			state.frameNo = 0;
-			++state.progressSub;
+			++state.modProcessSub;
 			_snd->pcmPlayEffect(30);
 			break;
 		case 1:
 			if (!(_word_unk_Flags & 0x0F))
-				++state.progressSub;
+				++state.modProcessSub;
 			break;
 		case 2:
 			if (_module)
 				_module->run(state);
 			if (state.finish) {
-				state.progressSub = 0;
+				state.modProcessSub = 0;
 				state.finish = 0;
-				state.progressMain = _word_unk_11 ? 7 : state.progressMain + 1;
+				state.modProcessTop = state.menuSelect ? 7 : state.modProcessTop + 1;
 				state.modIndex = 0;
-				_main_switch_1_0_orM1_postIntr = 1;
+				state.main_switch_1_0_orM1_postIntr = 1;
 			}
 			break;
 		default:
@@ -320,16 +351,16 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 		}
 		break;
 	case 2:
-		switch (state.progressSub) {
+		switch (state.modProcessSub) {
 		case 0:
 			if (!(_sub_val_2 & 0x1F)) {
 				if (!_snd->musicIsPlaying()) {
-					uint8 scids[] = { 3, 2 };
+					static const uint8 scids[] = { 3, 2 };
 					delete _module;
 					assert(state.modIndex < ARRAYSIZE(scids));
 					_module = _fio->loadModule(scids[state.modIndex]);
 					assert(_module);
-					++state.progressSub;
+					++state.modProcessSub;
 				} else {
 					_snd->musicStop();
 				}
@@ -340,7 +371,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 				// startup__runWithFileFunc(2)
 				_unlCDREadSeekWord = 0;
 				state.frameNo = -1;
-				++state.progressSub;
+				++state.modProcessSub;
 			}
 			break;
 		case 2:
@@ -349,7 +380,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			if (state.finish < 0) {
 				state.finish = 0;
 				state.counter = 10;
-				++state.progressSub;
+				++state.modProcessSub;
 				static byte data[] = { 0x83, 0x00, 0x00, 0x3F };
 				_gfx->enqueuePaletteEvent(ResourcePointer(data, 0));
 			} else if (state.finish) {
@@ -357,8 +388,8 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 					++state.modIndex;
 					state.finish = 0;
 				}
-				_gfx->reset(GraphicsEngine::kResetSprites);
-				state.progressSub = 0;
+				_gfx->reset(GraphicsEngine::kResetAnimations);
+				state.modProcessSub = 0;
 			}
 			break;
 		case 3:
@@ -368,10 +399,10 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 					0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 					0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 				};
-				_gfx->enqueueCopyCommands(ResourcePointer(cmd, 0));
+				_gfx->enqueueDrawCommands(ResourcePointer(cmd, 0));
 			} else if (state.counter == 0) {
 				state.finish = -1;
-				state.progressSub = 0;
+				state.modProcessSub = 0;
 				_gfx->reset(GraphicsEngine::kResetSetDefaultsExt);
 			}
 			break;
@@ -380,34 +411,36 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 		}
 		if (state.finish) {
 			state.finish = 0;
-			state.progressMain = 7;
-			state.progressSub = 0;
+			state.modProcessTop = 7;
+			state.modProcessSub = 0;
 			_gfx->scrollCommand(0xFF);
 			_gfx->setVar(9, 1);
-			_gfx->reset(GraphicsEngine::kResetPalEvents | GraphicsEngine::kResetSprites);
+			_gfx->reset(GraphicsEngine::kResetPalEvents | GraphicsEngine::kResetAnimations);
 		}
 		break;
 	case 3:
 		_wordRAM__TABLE48__word_B6400[2] = 1;
 		state.finish = 0;
-		state.progressMain = 0;
-		state.progressSub = 0;
+		state.modProcessTop = 0;
+		state.modProcessSub = 0;
 		_gfx->reset(GraphicsEngine::kResetScrollState);
 		break;
 	case 5:
+		// bset    #3,(GA_SUB__COMMUNICATION_FLAG+1).
 		if (state.finish) {
-			++state.progressMain;
-			state.progressSub = 0;
+			// bclr    #3,(GA_SUB__COMMUNICATION_FLAG+1).l
+			++state.modProcessTop;
+			state.modProcessSub = 0;
 			state.finish = 0;
 		}
 		break;
 	case 6:
-		switch (state.progressSub) {
+		switch (state.modProcessSub) {
 		case 0:
 			if (!_gfx->isAnimEnabled(31)) {
-				_gfx->reset(GraphicsEngine::kResetSetDefaults | GraphicsEngine::kResetSprites);
+				_gfx->reset(GraphicsEngine::kResetSetDefaults | GraphicsEngine::kResetAnimations);
 				_triggerPalFlag7Etc = 0xFF;
-				++state.progressSub;
+				++state.modProcessSub;
 				state.frameNo = -1;
 				state.frameState = 0;
 			}
@@ -417,46 +450,46 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 				delete _module;
 				_module = _fio->loadModule(52);
 				assert(_module);
-				++state.progressSub;
+				++state.modProcessSub;
 			}
 			break;
 		case 2:
 			// startup__runWithFileFunc(2)
 			_unlCDREadSeekWord = 0;
-			++state.progressSub;
+			++state.modProcessSub;
 			break;
 		case 3:
 			if (_module)
 				_module->run(state);
 			if (state.finish) {
 				_sub_bool_5 = true;
-				++state.progressSub;
+				++state.modProcessSub;
 			}
 			break;
 		default:
 			break;
 		}
 	case 7:
-		switch (state.progressSub) {
+		switch (state.modProcessSub) {
 		case 0:
 			_snd->musicStop();
 			//loadFile56 PCMLT_01.BIN
-			++state.progressSub;
+			++state.modProcessSub;
 			break;
 		case 1:
 		case 3:
 			// startup__runWithFileFunc(2)
 			_unlCDREadSeekWord = 0;
-			++state.progressSub;
+			++state.modProcessSub;
 			break;
 		case 2:
 			//loadFile54 PCMDRMDT.BIN
-			++state.progressSub;
+			++state.modProcessSub;
 			break;
 		case 4:
-			state.progressMain = 5;
-			state.progressSub = 0;
-			_main_switch_1_0_orM1_postIntr = -1;
+			state.modProcessTop = 5;
+			state.modProcessSub = 0;
+			state.main_switch_1_0_orM1_postIntr = -1;
 			break;
 		default:
 			break;
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index 2a194820782..b0a9d00df4d 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -50,15 +50,18 @@ private:
 	bool initResource();
 	bool initGfx(Common::Platform platform, bool use8BitColorMode);
 	bool initSound(Common::Platform platform, int soundOptions);
+	void playBootSequence();
 
 	// Main loop
 	bool start();
 	void delayUntil(uint32 end);
-	void updateEvents();
+	void checkEvents();
 
-	bool runInitSequence(GameState &state);
+	void updateTopLevelState(GameState &state);
 	void updateModuleState(GameState &state);
 
+	const uint32 _frameLen;
+
 	// ConfigManager sync
 	void registerDefaultSettings();
 	void syncSoundSettings() override;
@@ -81,11 +84,16 @@ private:
 	// Sound
 	SoundEngine *_snd;
 
-	// Input
-	uint8 _lastKey;
-	uint8 _keyInput;
 public:
+	// Input
 	uint8 inputFlag() const { return _keyInput; }
+	void toggleKeyRepeat(bool enableRepeat) { _keyRepeat = enableRepeat; }
+
+private:
+	uint8 _lastKeys;
+	uint8 _keyInput;
+	uint8 _releaseKeys;
+	bool _keyRepeat;
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/sound.cpp b/engines/snatcher/sound.cpp
index 0ac86a0b166..85ad14d6c66 100644
--- a/engines/snatcher/sound.cpp
+++ b/engines/snatcher/sound.cpp
@@ -49,6 +49,10 @@ uint32 SoundEngine::musicGetTime() const {
 	return _dev->musicGetTime();
 }
 
+void SoundEngine::fmStartSound(int track) {
+	_dev->fmStartSound(track);
+}
+
 void SoundEngine::pcmPlayEffect(int track) {
 	_dev->pcmPlayEffect(track);
 }
@@ -65,8 +69,13 @@ SoundDevice *SoundDevice::create(Common::Platform platform, int soundOptions) {
 	MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(soundOptions);
 	MusicType musicType = MidiDriver::getMusicType(dev);
 
-	if (musicType == MT_INVALID || musicType == MT_NULL)
-		return createNullSoundDevice();
+	if (musicType == MT_INVALID)
+		return nullptr;
+
+	// TODO: We still need to create the appropriate sound device, since the game
+	// heavily relies on audio sync for its animations. We'll just have to handle
+	// it via volume settings.
+	// if (musicType == MT_NULL)
 
 	switch (platform) {
 	case Common::kPlatformSegaCD:
@@ -75,7 +84,7 @@ SoundDevice *SoundDevice::create(Common::Platform platform, int soundOptions) {
 		break;
 	};
 
-	return 0;
+	return nullptr;
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/sound.h b/engines/snatcher/sound.h
index 7f734050875..9ee598d07ff 100644
--- a/engines/snatcher/sound.h
+++ b/engines/snatcher/sound.h
@@ -38,6 +38,8 @@ public:
 	bool musicIsPlaying() const;
 	uint32 musicGetTime() const;
 
+	void fmStartSound(int track);
+
 	void pcmPlayEffect(int track);
 	void pcmDoCommand(int cmd, int arg);
 
diff --git a/engines/snatcher/sound_device.h b/engines/snatcher/sound_device.h
index a4ac6e49230..37384dc9457 100644
--- a/engines/snatcher/sound_device.h
+++ b/engines/snatcher/sound_device.h
@@ -36,6 +36,8 @@ public:
 	virtual bool musicIsPlaying() const = 0;
 	virtual uint32 musicGetTime() const = 0;
 
+	virtual void fmStartSound(int track) = 0;
+
 	virtual void pcmPlayEffect(int track) = 0;
 	virtual void pcmDoCommand(int cmd, int arg) = 0;
 
@@ -47,7 +49,6 @@ protected:
 	uint32 _musicStartTime;
 
 private:
-	static SoundDevice *createNullSoundDevice();
 	static SoundDevice *createSegaSoundDevice();
 
 public:
diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
index 07116976bb4..b42605a6819 100644
--- a/engines/snatcher/sound_device_scd.cpp
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -38,6 +38,8 @@ public:
 	bool musicIsPlaying() const override;
 	uint32 musicGetTime() const override;
 
+	void fmStartSound(int track) override;
+
 	void pcmPlayEffect(int track) override;
 	void pcmDoCommand(int cmd, int arg) override;
 
@@ -73,6 +75,10 @@ uint32 SegaSoundDevice::musicGetTime() const {
 	return Util::makeBCDTimeStamp(relTime);
 }
 
+void SegaSoundDevice::fmStartSound(int track) {
+
+}
+
 void SegaSoundDevice::pcmPlayEffect(int track) {
 }
 
diff --git a/engines/snatcher/staticres.cpp b/engines/snatcher/staticres.cpp
new file mode 100644
index 00000000000..c931c0ba5c9
--- /dev/null
+++ b/engines/snatcher/staticres.cpp
@@ -0,0 +1,197 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#include "common/scummsys.h"
+
+namespace Snatcher {
+
+namespace StaticRes_SCD {
+// This is boot sequence data from the first 16 sectors of the CD-ROM which aren't
+// accessible through the file system. So I put the data here...
+
+static const uint8 _bootTileData1[] = {
+	0x13, 0x00, 0xaa, 0x00, 0x1c, 0x01, 0x11, 0x1c, 0x01, 0x22, 0x04, 0x01, 0x33, 0x04, 0x01, 0xaa, 0x44, 0x91, 0x55, 0x91, 0x77, 0x91, 0x99, 0x91, 0xbf, 0xa8, 0x01, 0x10, 0x01, 0x18, 0xa1, 0x01,
+	0x28, 0x01, 0x30, 0xff, 0x04, 0x01, 0x95, 0x06, 0x69, 0x05, 0x01, 0x6e, 0x70, 0x99, 0x09, 0x00, 0x00, 0x3f, 0x3b, 0xd3, 0xa7, 0x77, 0x78, 0x89, 0xab, 0x99, 0xaa, 0xac, 0xcc, 0x78, 0x9a, 0xbc,
+	0xcc, 0x56, 0x7a, 0xbb, 0xcc, 0x05, 0x56, 0x5a, 0xaa, 0x00, 0x00, 0x85, 0x77, 0x00, 0x07, 0x00, 0x27, 0x50, 0x15, 0xae, 0xc8, 0x05, 0x50, 0x50, 0x05, 0x87, 0x00, 0x57, 0x79, 0x90, 0x00, 0xaa,
+	0xba, 0x00, 0x00, 0xcc, 0xb7, 0x94, 0xa5, 0x50, 0x95, 0x84, 0xa7, 0x88, 0xab, 0x9c, 0x57, 0xa9, 0x00, 0x3b, 0xb4, 0x08, 0x80, 0x00, 0x68, 0x75, 0x05, 0x71, 0x0a, 0x3d, 0x55, 0x00, 0x23, 0xab,
+	0xd3, 0x77, 0x55, 0x05, 0x7a, 0x67, 0x79, 0x87, 0xac, 0x77, 0x8a, 0xbc, 0xcc, 0x98, 0x9a, 0xab, 0xcc, 0x77, 0x77, 0x7a, 0xcc, 0x56, 0x66, 0x57, 0xcc, 0x05, 0x55, 0x55, 0x00, 0x52, 0x59, 0x00,
+	0x4a, 0x58, 0x00, 0x7e, 0x77, 0x00, 0x85, 0x4f, 0x00, 0x2e, 0x01, 0xb3, 0xa7, 0x9f, 0x05, 0x85, 0x87, 0x7a, 0x96, 0x95, 0x00, 0x68, 0x00, 0x1e, 0xcc, 0x00, 0x5f, 0xcc, 0xa7, 0x00, 0x78, 0x42,
+	0xca, 0x89, 0xcc, 0xcb, 0xa5, 0x00, 0x87, 0x98, 0xf2, 0x75, 0x8f, 0x55, 0x75, 0x01, 0x76, 0x16, 0xbb, 0x27, 0x06, 0xcd, 0x57, 0x55, 0x56, 0x66, 0x7a, 0x77, 0x77, 0x89, 0xac, 0xaa, 0xab, 0xbc,
+	0xcc, 0x77, 0x78, 0xbb, 0xcc, 0x55, 0x56, 0x67, 0xac, 0xb5, 0x00, 0x9e, 0x7b, 0x00, 0x1c, 0x5a, 0x22, 0x21, 0x84, 0x08, 0x94, 0x5d, 0x21, 0x0a, 0x05, 0x21, 0x0b, 0x21, 0x36, 0x01, 0xd6, 0x90,
+	0x94, 0xa5, 0x1d, 0x94, 0xb7, 0x00, 0x84, 0x00, 0x7b, 0x03, 0x84, 0xba, 0x98, 0x75, 0x7f, 0xac, 0x9b, 0x02, 0xf6, 0x2f, 0x3b, 0x04, 0xc1, 0x02, 0xd8, 0x01, 0xe0, 0x05, 0x20, 0xba, 0x56, 0x66,
+	0x8a, 0xcc, 0x00, 0x7f, 0xcc, 0x99, 0x04, 0x9a, 0xcc, 0x98, 0xbc, 0xcc, 0x55, 0x68, 0x99, 0xfa, 0xac, 0x20, 0x95, 0x7a, 0x01, 0x9c, 0x31, 0x39, 0x01, 0x46, 0x01, 0x88, 0x01, 0x60, 0xc7, 0x01,
+	0xe8, 0x01, 0xf0, 0x01, 0xf8, 0xcc, 0xca, 0x70, 0x03, 0x84, 0x00, 0x80, 0x0f, 0x21, 0x18, 0x21, 0x20, 0x21, 0x28, 0x29, 0x3f, 0x00, 0x45, 0x33, 0x22, 0x69, 0x84, 0x55, 0x33, 0x94, 0x55, 0x21,
+	0xf9, 0xa4, 0x04, 0xdd, 0x03, 0x04, 0x5e, 0xa4, 0x45, 0x5c, 0x41, 0x34, 0xee, 0x04, 0x01, 0x41, 0x38, 0x2b, 0x05, 0x0c, 0x04, 0x20, 0x32, 0x03, 0x20, 0xe2, 0xb4, 0xff, 0xff, 0x8e, 0xf2, 0x9c,
+	0x01, 0x10, 0x40, 0x9e, 0x20, 0x00, 0x00, 0xb4, 0x76, 0x30, 0x04, 0x04, 0x00, 0x73, 0x23, 0x04, 0x04, 0x00, 0x1b, 0x1d, 0x01, 0x04, 0x55, 0x20, 0xf8, 0x5e, 0x94, 0x5d, 0x00, 0x9f, 0xee, 0x94,
+	0xdd, 0x7b, 0xa4, 0x00, 0x97, 0xee, 0x00, 0x13, 0x98, 0x84, 0x01, 0x84, 0xdd, 0x67, 0x91, 0x05, 0x08, 0x0f, 0x0c, 0x22, 0x22, 0x8c, 0x00, 0x8c, 0xe2, 0xb1, 0x98, 0xd2, 0x22, 0x23, 0xa4, 0x00,
+	0x97, 0x20, 0x00, 0x13, 0xf6, 0x30, 0xa4, 0x00, 0x93, 0x00, 0xa4, 0x19, 0x84, 0x44, 0x18, 0xa4, 0x36, 0x45, 0x24, 0xb1, 0x40, 0x76, 0x04, 0x94, 0x00, 0x9a, 0x55, 0xdd, 0xe9, 0x00, 0x90, 0xcc,
+	0xcc, 0xb8, 0x5c, 0x98, 0xa4, 0x00, 0x7d, 0xf5, 0x00, 0x13, 0xcc, 0x9b, 0xcc, 0x01, 0x88, 0x97, 0x06, 0x08, 0x15, 0x0c, 0x75, 0x0c, 0x20, 0xd2, 0x9c, 0xc2, 0x00, 0x43, 0xc1, 0x22, 0xd2, 0x22,
+	0x22, 0x00, 0xc2, 0x22, 0x23, 0x00, 0x88, 0x20, 0x7e, 0x00, 0x00, 0xaf, 0x94, 0x20, 0x48, 0x20, 0x41, 0x25, 0x54, 0x63, 0x37, 0x45, 0x63, 0x94, 0x20, 0xc0, 0x04, 0x55, 0x5b, 0x00, 0x93, 0x84,
+	0x45, 0x54, 0x55, 0xcc, 0x40, 0x30, 0xbb, 0x9f, 0xbb, 0x01, 0x84, 0xbb, 0x5f, 0x91, 0x01, 0x5c, 0xa8, 0x15, 0x0c, 0x18, 0x20, 0x22, 0x8c, 0xb2, 0xf6, 0x22, 0x00, 0x8f, 0x98, 0x22, 0xb4, 0x9b,
+	0x8c, 0x20, 0x3c, 0x3e, 0xb2, 0x00, 0x89, 0x25, 0xd0, 0x21, 0xcc, 0x3c, 0x48, 0x2d, 0xdb, 0x55, 0x04, 0x3f, 0x41, 0x74, 0x27, 0x64, 0x20, 0x5c, 0x00, 0xc8, 0x20, 0xe5, 0x93, 0xbb, 0x55, 0xc8,
+	0x55, 0xaa, 0xaa, 0x93, 0xaa, 0x45, 0x8b, 0x8c, 0xfe, 0x5a, 0x9c, 0x00, 0x91, 0x97, 0xb1, 0x01, 0x9c, 0x04, 0x0b, 0x06, 0x0c, 0xbb, 0x11, 0x14, 0x1c, 0x20, 0x33, 0x82, 0x81, 0x04, 0x0c, 0xa2,
+	0x00, 0x5f, 0x06, 0x22, 0x97, 0x84, 0xa3, 0x23, 0x23, 0xb3, 0x33, 0xc4, 0x33, 0x30, 0x40, 0xf3, 0x00, 0x33, 0x44, 0x20, 0x6c, 0x21, 0x74, 0x9f, 0x21, 0x70, 0x40, 0xc0, 0x41, 0xb8, 0x5c, 0x2c,
+	0x00, 0x32, 0x44, 0x55, 0x93, 0x2a, 0x55, 0x93, 0x59, 0x93, 0x99, 0x05, 0x18, 0x04, 0x44, 0xd6, 0x44, 0x01, 0xd8, 0xa1, 0x99, 0x01, 0xd8, 0x99, 0x04, 0x01, 0x01, 0x30, 0xbf, 0x00, 0x1b, 0x05,
+	0x01, 0x02, 0x17, 0x01, 0xa8, 0x05, 0x20, 0x03, 0x18, 0x59, 0x0a, 0x34, 0x0f, 0x09, 0x20, 0x05, 0x0c, 0x11, 0x14, 0x14, 0x20, 0x44, 0xaa, 0xaa, 0x44, 0x26, 0x44, 0x86, 0x61, 0xd6, 0x33, 0x00,
+	0x04, 0x18, 0x44, 0xaa, 0xf4, 0xa4, 0x44, 0x05, 0x01, 0x40, 0x82, 0x07, 0xd1, 0x00, 0x2b, 0x08, 0x01, 0x7f, 0x10, 0xf1, 0x05, 0x34, 0x37, 0x11, 0x5d, 0x09, 0x20, 0xf8, 0x61, 0x4c, 0x20, 0xfc,
+	0x04, 0x91, 0x40, 0xc4, 0x45, 0x55, 0x58, 0x97, 0x99, 0x05, 0x87, 0x52, 0x88, 0x8b, 0x88, 0x88, 0x00, 0xfb, 0x99, 0x97, 0x88, 0xfd, 0x97, 0x99, 0x97, 0xb1, 0x21, 0x18, 0x0d, 0x0c, 0x11, 0x14,
+	0x04, 0x0c, 0x4a, 0x94, 0x00, 0x3f, 0x33, 0x87, 0x93, 0x32, 0x87, 0x32, 0x40, 0x23, 0x88, 0x82, 0x22, 0x30, 0x99, 0x60, 0x45, 0x88, 0x03, 0x40, 0xbc, 0x8b, 0x20, 0x00, 0x43, 0x33, 0x00, 0x00,
+	0xd7, 0x93, 0x39, 0xd8, 0x41, 0x9c, 0x05, 0x03, 0xa8, 0x00, 0x40, 0xb0, 0x01, 0xac, 0x45, 0x67, 0x74, 0x55, 0x01, 0xa4, 0x57, 0x77, 0x77, 0x00, 0xaf, 0x88, 0xde, 0x55, 0x87, 0x88, 0x94, 0x9b,
+	0x88, 0x00, 0x13, 0xb1, 0x6f, 0x01, 0x88, 0x09, 0x08, 0x15, 0x0c, 0x04, 0x20, 0x72, 0xa4, 0x00, 0xb0, 0x22, 0xf3, 0x00, 0x4b, 0x94, 0x72, 0x22, 0x00, 0xaf, 0x40, 0x84, 0x40, 0x80, 0x41, 0x84,
+	0x1f, 0x60, 0x65, 0x41, 0x88, 0xb4, 0x64, 0x78, 0x22, 0x34, 0x05, 0x55, 0x56, 0x55, 0x20, 0x38, 0x57, 0x00, 0x8f, 0x56, 0x20, 0x3c, 0x66, 0x8f, 0x55, 0x52, 0x77, 0x94, 0x66, 0x45, 0x8f, 0x66,
+	0x01, 0x74, 0x66, 0xa7, 0x91, 0x05, 0x08, 0x0f, 0x0c, 0x72, 0x22, 0x8c, 0x22, 0x00, 0x6c, 0xd3, 0x84, 0xa8, 0x66, 0x62, 0x9c, 0x72, 0x03, 0x08, 0x9f, 0x7e, 0x23, 0x65, 0xdc, 0xa4, 0x21, 0x24,
+	0x3e, 0x28, 0x2a, 0x2c, 0x21, 0x21, 0x56, 0xea, 0x66, 0x03, 0x04, 0x66, 0x0b, 0x04, 0x56, 0x03, 0x04, 0x1e, 0x01, 0x00, 0x84, 0xeb, 0xa4, 0x00, 0x8f, 0x20, 0x04, 0x04, 0x30, 0xa4, 0x8b, 0xb4,
+	0xf3, 0x22, 0x01, 0x23, 0x90, 0x05, 0x54, 0x9c, 0x01, 0x78, 0x0a, 0xa1, 0x01, 0x68, 0xfe, 0x54, 0x40, 0xc4, 0x64, 0x7c, 0x01, 0x94, 0x0a, 0x20, 0x01, 0x63, 0x41, 0xe3, 0x65, 0x82, 0xcb, 0x0d,
+	0xde, 0x01, 0x64, 0x55, 0x20, 0x7d, 0x55, 0x55, 0xa4, 0x0e, 0x1f, 0x08, 0x00, 0x20, 0x02, 0x00, 0x99, 0x24, 0x33, 0x33, 0x20, 0x10, 0x5e, 0xee, 0xee, 0x02, 0xa4, 0x5d, 0xdd, 0xdd, 0x62, 0x05,
+	0x83, 0xdd, 0x25, 0xcc, 0x81, 0x94, 0xc3, 0xd5, 0x21, 0xb4, 0x33, 0x94, 0xe3, 0x04, 0x04, 0x32, 0x20, 0x3f, 0x05, 0x04, 0xa7, 0x21, 0x54, 0x40, 0x94, 0x84, 0x83, 0x20, 0xb4, 0x77, 0x00, 0x1d,
+	0xed, 0x05, 0x04, 0x63, 0x00, 0x30, 0xa4, 0x00, 0x00, 0x60, 0x84, 0x40, 0xa6, 0x91, 0x00, 0x5d, 0x00, 0x25, 0xee, 0x94, 0xdd, 0xdd, 0xa4, 0xb0, 0x02, 0x5c, 0xcc, 0xcc, 0xa4, 0x00, 0x7e, 0x00,
+	0x00, 0x7e, 0x08, 0x02, 0xee, 0xe3, 0x00, 0x1e, 0x32, 0x02, 0x5e, 0xdd, 0x50, 0x20, 0x25, 0xdd, 0xd3, 0x00, 0x85, 0xc0, 0x00, 0x7d, 0x32, 0x51, 0x02, 0x20, 0x22, 0x22, 0x33, 0x91, 0xee, 0x81,
+	0xe3, 0x21, 0x94, 0x32, 0xdd, 0xdd, 0xd3, 0x00, 0x3e, 0x32, 0x4d, 0x41, 0x00, 0x9a, 0x5c, 0xcc, 0x32, 0x05, 0xcc, 0x01, 0x61, 0x00, 0xf4, 0x23, 0x5e, 0x02, 0xbc, 0x4e, 0x00, 0x21, 0x00, 0xbb,
+	0xb1, 0x00, 0xbf, 0x9e, 0x22, 0x00, 0x5e, 0x42, 0x7c, 0x00, 0x37, 0x94, 0xee, 0x30, 0x00, 0x1f, 0xca, 0xd3, 0x05, 0x20, 0x23, 0x00, 0x80, 0x00, 0x35, 0x94, 0x00, 0x41, 0x25, 0x00, 0xd3, 0x24,
+	0x00, 0xa9, 0x5e, 0x20, 0x03, 0x04, 0x5d, 0x32, 0xe5, 0x00, 0xa5, 0xc2, 0x84, 0xcc, 0xc3, 0x94, 0x08, 0x80, 0xb1, 0x07, 0x08, 0x60, 0xb1, 0x00, 0xdd, 0x22, 0x32, 0x00, 0x24, 0x33, 0xc7, 0x00,
+	0xbb, 0x01, 0xbf, 0x00, 0xc3, 0x5d, 0xdd, 0x32, 0x01, 0xa2, 0x01, 0xc0, 0x13, 0x94, 0x04, 0xe0, 0x00, 0xee, 0x20, 0x41, 0xee, 0xe2, 0x00, 0x04, 0x00, 0xdd, 0x20, 0x24, 0xdd, 0x30, 0x00, 0x02,
+	0xcc, 0xe1, 0x00, 0x6d, 0xc3, 0x00, 0x00, 0x25, 0x22, 0x20, 0x20, 0x80, 0x22, 0x7c, 0x6b, 0x94, 0x00, 0xdd, 0xdd, 0x20, 0x83, 0xdd, 0x00, 0xfb, 0x93, 0xc4, 0x26, 0x5c, 0x0a, 0x40, 0x00, 0x44,
+	0xdd, 0xd3, 0x03, 0x04, 0xcc, 0xc3, 0xdf, 0x03, 0x04, 0x22, 0x00, 0x00, 0x80, 0x22, 0x60, 0xb4, 0x5d, 0x22, 0x60, 0x00, 0xbf, 0x56, 0xcc, 0xa4, 0x2c, 0x40, 0xe3, 0x00, 0xbb, 0xd2, 0x00, 0x5f,
+	0x32, 0x5b, 0x00, 0xbc, 0xa4, 0x30, 0x00, 0xf0, 0x00, 0xa2, 0x24, 0x20, 0x82, 0x5e, 0xfc, 0xee, 0x20, 0x24, 0xa0, 0x41, 0x04, 0x21, 0x9c, 0x41, 0x04, 0x10, 0x40, 0x20, 0x84, 0x7d, 0x02, 0x40,
+	0x30, 0x40, 0x1f, 0x01, 0x81, 0x49, 0x70, 0x21, 0x4c, 0x21, 0x50, 0x25, 0x19, 0x05, 0x04, 0x25, 0xbb, 0x81, 0x94, 0xb3, 0x25, 0xaa, 0x88, 0xaa, 0xa5, 0x5a, 0x84, 0xaa, 0x59, 0x99, 0x05, 0x01,
+	0x40, 0x93, 0x59, 0x88, 0x88, 0x83, 0x58, 0x01, 0x20, 0x5b, 0xbb, 0x94, 0x00, 0x1b, 0xa3, 0x00, 0x1f, 0xc1, 0x32, 0x99, 0x99, 0xa3, 0x20, 0x99, 0x99, 0x32, 0x00, 0x84, 0x30, 0x40, 0x5c, 0xa7,
+	0xc7, 0x82, 0x00, 0xb3, 0x20, 0x25, 0xbb, 0x32, 0x02, 0x5b, 0xbb, 0x20, 0x02, 0x5a, 0xaa, 0x00, 0x00, 0x45, 0x84, 0x99, 0x99, 0xa4, 0x02, 0x00, 0x49, 0xab, 0xc1, 0x02, 0x58, 0x88, 0x88, 0xbb,
+	0xb2, 0x00, 0x00, 0xbb, 0x40, 0x68, 0xaa, 0x94, 0xa2, 0x40, 0x90, 0x92, 0x00, 0x75, 0xfe, 0x30, 0x44, 0x9c, 0x02, 0x9d, 0x00, 0x7d, 0x03, 0x04, 0x01, 0x3c, 0x04, 0x40, 0x01, 0x3c, 0xc1, 0x94,
+	0x05, 0x88, 0x88, 0x84, 0xb3, 0x00, 0x5c, 0xa4, 0x56, 0xa3, 0x00, 0x20, 0xa4, 0x92, 0x00, 0x5c, 0x42, 0x00, 0x1c, 0x32, 0x55, 0x94, 0x22, 0x01, 0x60, 0xb5, 0x00, 0xa1, 0x45, 0x00, 0xa0, 0x35,
+	0x55, 0x03, 0x20, 0x93, 0x00, 0x20, 0x32, 0x94, 0x30, 0x94, 0x20, 0x3e, 0x25, 0x40, 0xfe, 0x00, 0xbd, 0xb4, 0x00, 0xdd, 0x00, 0x23, 0xaa, 0x35, 0x17, 0x00, 0xd9, 0xa4, 0x00, 0x43, 0x92, 0x00,
+	0x9f, 0x30, 0xb3, 0x00, 0xe8, 0x02, 0x5b, 0x32, 0x94, 0x30, 0x00, 0xbd, 0x02, 0xc4, 0x00, 0xb9, 0x93, 0x06, 0xc4, 0x01, 0x60, 0xbb, 0x42, 0x02, 0x42, 0xaa, 0xa3, 0x00, 0xe1, 0x00, 0x30, 0x02,
+	0x5a, 0x99, 0x20, 0x02, 0x59, 0x93, 0x31, 0x00, 0x25, 0x92, 0x22, 0x22, 0x20, 0x20, 0x00, 0x80, 0xb3, 0x20, 0x92, 0x00, 0xa4, 0xaa, 0xa3, 0x03, 0x04, 0x99, 0x93, 0x06, 0x04, 0xaa, 0x02, 0x60,
+	0x78, 0x02, 0x00, 0xbf, 0xbb, 0x94, 0xb4, 0x00, 0x3e, 0x0e, 0xa4, 0x02, 0xc3, 0x03, 0x9f, 0x01, 0xbf, 0x32, 0x58, 0x88, 0x83, 0x0a, 0x22, 0x00, 0x1f, 0x30, 0x94, 0x22, 0x5a, 0xaa, 0xa3, 0x32,
+	0x05, 0x94, 0x25, 0x59, 0x20, 0x78, 0x03, 0x04, 0x95, 0x99, 0x50, 0x58, 0x88, 0x85, 0x88, 0x20, 0x1f, 0x5b, 0x00, 0x3f, 0x5b, 0xc8, 0xaa, 0xaa, 0xa4, 0x02, 0xc2, 0x99, 0x99, 0x04, 0xbe, 0x00,
+	0xc2, 0x48, 0x88, 0x30, 0x58, 0x00, 0xa0, 0xb3, 0x02, 0x00, 0xde, 0x02, 0xcd, 0x20, 0x9b, 0x05, 0x84, 0x00, 0xf6, 0x93, 0x20, 0x94, 0xc2, 0x22, 0x59, 0x99, 0x32, 0x02, 0x59, 0x88, 0x32, 0x25,
+	0x88, 0x4d, 0x60, 0x38, 0x58, 0x03, 0x04, 0xac, 0x25, 0x77, 0xb4, 0x02, 0x92, 0x57, 0x94, 0x56, 0x66, 0x8f, 0x66, 0x66, 0x20, 0x22, 0x07, 0x20, 0x26, 0x21, 0x2a, 0x84, 0x77, 0x73, 0x20, 0x02,
+	0x77, 0xac, 0x72, 0x00, 0x84, 0x60, 0x04, 0x66, 0x20, 0xa5, 0x66, 0x20, 0xa5, 0x0b, 0x40, 0x04, 0xa4, 0x20, 0x00, 0xec, 0x20, 0x57, 0x77, 0x77, 0xaa, 0x32, 0x04, 0x04, 0x73, 0x00, 0x3b, 0x63,
+	0x94, 0x66, 0x21, 0xe4, 0x73, 0x06, 0x04, 0x00, 0x21, 0x02, 0x54, 0x84, 0x00, 0x4a, 0x94, 0x46, 0x54, 0x66, 0x32, 0x8d, 0x46, 0x24, 0xe8, 0x02, 0x00, 0x4f, 0x25, 0xe0, 0x73, 0x22, 0x35, 0x47,
+	0x77, 0x04, 0x01, 0x00, 0x3b, 0xb1, 0x25, 0x20, 0xa3, 0x83, 0x20, 0x88, 0x42, 0x48, 0x84, 0x40, 0x77, 0xb8, 0x77, 0x74, 0x22, 0x94, 0xc5, 0x02, 0x77, 0x77, 0x40, 0x25, 0x66, 0x64, 0x00, 0x25,
+	0x64, 0x50, 0x02, 0x56, 0x40, 0x04, 0x83, 0x04, 0x24, 0xaa, 0x82, 0x00, 0x5f, 0x30, 0x94, 0x20, 0x00, 0x3f, 0x20, 0x00, 0x7f, 0x72, 0x00, 0x84, 0x62, 0x00, 0x01, 0xba, 0x00, 0xdb, 0x04, 0x04,
+	0x77, 0x7a, 0x77, 0x07, 0x04, 0x66, 0x02, 0xe0, 0x00, 0x9f, 0x00, 0xbc, 0x01, 0xc0, 0x82, 0x16, 0x00, 0x00, 0xbf, 0x00, 0x5c, 0x30, 0x01, 0x9e, 0x57, 0x66, 0x63, 0x51, 0x20, 0x01, 0x63, 0x05,
+	0x66, 0x40, 0x64, 0x88, 0x00, 0x60, 0x88, 0xc1, 0x00, 0x60, 0x88, 0x57, 0x77, 0x73, 0x55, 0x00, 0xdb, 0x00, 0x84, 0xea, 0x32, 0x00, 0x5c, 0x20, 0x84, 0x63, 0x84, 0x21, 0xe4, 0x05, 0x01, 0xe2,
+	0x55, 0x81, 0x77, 0x22, 0x22, 0x24, 0x44, 0x00, 0x61, 0xa4, 0xfd, 0x00, 0x5b, 0x25, 0x05, 0x04, 0x00, 0x3b, 0x00, 0x43, 0x03, 0x04, 0x22, 0x1e, 0x20, 0x22, 0xf5, 0x00, 0xbf, 0x22, 0x00, 0xbb,
+	0x02, 0x20, 0x68, 0x00, 0x7c, 0x01, 0x80, 0x20, 0x64, 0x77, 0x20, 0x68, 0x00, 0x5c, 0x84, 0x62, 0x20, 0x99, 0x04, 0x7c, 0x03, 0x80, 0x77, 0xea, 0x73, 0x04, 0x04, 0x32, 0x00, 0x9d, 0x20, 0xa4,
+	0x02, 0xfd, 0x20, 0x05, 0xde, 0x30, 0x21, 0xa6, 0x21, 0x60, 0x04, 0x04, 0x24, 0x80, 0x63, 0x21, 0xbb, 0x02, 0x7f, 0x84, 0x00, 0x58, 0x00, 0x62, 0x57, 0x77, 0x32, 0x05, 0x25, 0x80, 0x25, 0x20,
+	0x00, 0x56, 0x21, 0x04, 0x44, 0x44, 0x84, 0x55, 0x55, 0x5c, 0x00, 0x22, 0x81, 0x61, 0x6f, 0x0d, 0x01, 0x44, 0x20, 0x9d, 0x55, 0xa7, 0x20, 0xa4, 0x12, 0x1d, 0x00, 0x21, 0x04, 0x44, 0x81, 0x02,
+	0x00, 0xf9, 0x01, 0x15, 0x40, 0x32, 0x00, 0x25, 0x54, 0x52, 0x00, 0x02, 0xda, 0x25, 0x00, 0x5d, 0x02, 0x12, 0x60, 0x81, 0x45, 0x00, 0x3f, 0x00, 0x7e, 0x5b, 0x13, 0x62, 0x00, 0x3c, 0x54, 0x40,
+	0x1f, 0x00, 0x83, 0x02, 0x13, 0xa0, 0x44, 0x60, 0x42, 0x00, 0x55, 0x55, 0x50, 0x00, 0x7f, 0x13, 0xa0, 0x43, 0xbd, 0x00, 0xc0, 0x52, 0x43, 0x64, 0x12, 0x20, 0xc2, 0x44, 0x42, 0x25, 0x44, 0x55,
+	0x50, 0x25, 0x55, 0x22, 0x20, 0x34, 0x00, 0x42, 0x20, 0x00, 0x7d, 0x00, 0x41, 0x22, 0x15, 0x41, 0x20, 0x41, 0x94, 0x00, 0xa0, 0x14, 0x40, 0x43, 0xed, 0x00, 0x60, 0x55, 0x00, 0x60, 0x35, 0x60,
+	0x42, 0x00, 0xdd, 0x20, 0x21, 0x00, 0x60, 0x75, 0x32, 0x20, 0x54, 0x02, 0xe0, 0x52, 0x00, 0x5e, 0x13, 0xc2, 0x20, 0xbf, 0x42, 0xa5, 0x20, 0xbf, 0x52, 0x15, 0x60, 0x02, 0x54, 0x23, 0xa0, 0x02,
+	0x14, 0x80, 0x90, 0x5b, 0xbb, 0xbb, 0xb3, 0x94, 0x32, 0xaa, 0x81, 0xa1, 0xb4, 0x99, 0x99, 0x93, 0x20, 0x03, 0x04, 0x32, 0x40, 0xdc, 0x06, 0x32, 0x34, 0x38, 0x20, 0x8c, 0x02, 0x2b, 0xbb, 0x00,
+	0x2b, 0x96, 0xb2, 0x12, 0x74, 0x61, 0xd4, 0xb2, 0x20, 0x78, 0x3b, 0xb2, 0x20, 0xba, 0x13, 0xc3, 0xb3, 0xdd, 0xdd, 0x03, 0xb3, 0xd3, 0x33, 0x3b, 0x23, 0xd2, 0x00, 0x03, 0x04, 0xdd, 0xdd, 0x84,
+	0xd3, 0x33, 0x03, 0x08, 0xb3, 0xd2, 0x00, 0xa4, 0xd2, 0x3b, 0x20, 0x00, 0x24, 0x3d, 0x2b, 0x94, 0x23, 0xb2, 0xb4, 0xd2, 0x03, 0x3b, 0x98, 0xa4, 0x0b, 0x00, 0x18, 0x00, 0x1c, 0x00, 0x45, 0x22,
+	0x00, 0xd0, 0x03, 0x3b, 0xbb, 0x00, 0x85, 0x33, 0x31, 0xe0, 0x01, 0x64, 0x1d, 0x01, 0x6c, 0x30, 0x35, 0x9f, 0x1c, 0x01, 0x1f, 0x00, 0x10, 0x00, 0xfc, 0x00, 0x01, 0x1e, 0x02, 0x1b, 0x02, 0x1e,
+	0x01, 0x1c, 0x01, 0x1e, 0x62, 0x1b, 0x02, 0xbc, 0x60, 0x02, 0x1e, 0x02, 0x1a, 0x02, 0x1e, 0x62, 0x1d, 0x80, 0x03, 0x1e, 0x02, 0xff, 0x1a, 0x02, 0x1e, 0x62, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff,
+	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x07, 0x1e, 0x02, 0x0d, 0x02, 0x1f, 0x00
+};
+
+ static const uint8 _bootTileData2[] = {
+	0x0c, 0x00, 0x4a, 0x00, 0x1e, 0x01, 0x11, 0x03,	0x04, 0x01, 0x17, 0x94, 0x70, 0xff, 0x03, 0x04,	0x01, 0x17, 0x9f, 0x03, 0x08, 0x00, 0x15, 0x94,	0x82, 0x05, 0x11, 0xe3, 0x0c, 0x3f, 0x05, 0x20,
+	0x11, 0x11, 0x17, 0x09, 0x08, 0xb4, 0x05, 0x49,	0x60, 0x11, 0x11, 0x70, 0x01, 0x77, 0x03, 0x08,	0x00, 0x64, 0x17, 0x7f, 0x00, 0x2c, 0xa8, 0x06,	0x44, 0x01, 0x62, 0x81, 0x04, 0x64, 0x87, 0x10,
+	0xbd, 0x00, 0x70, 0x71, 0x87, 0xc1, 0x07, 0x17,	0x07, 0x00, 0x00, 0x70, 0x00, 0x11, 0x71, 0x02,	0x3c, 0x02, 0x1c, 0x11, 0x00, 0x3c, 0xff, 0x83,	0x02, 0x8e, 0x8c, 0x88, 0x06, 0x60, 0x08, 0x4c,
+	0x0f, 0xa2, 0x01, 0xd5, 0xff, 0x01, 0x24, 0x08,	0x04, 0x02, 0xdd, 0x04, 0xa0, 0x05, 0x0b, 0x09,	0x20, 0x04, 0x33, 0x05, 0x3f, 0xf8, 0x01, 0x71,	0x71, 0x01, 0x70, 0x00, 0x80, 0x00, 0x88, 0xac,
+	0x0d, 0x70, 0xff, 0x24, 0x38, 0x06, 0xd8, 0x1a,	0x90, 0x21, 0x6f, 0x00, 0x30, 0x21, 0x03, 0x2c,	0x53, 0x22, 0x18, 0x7f, 0x1e, 0x01, 0x07, 0x40,	0x29, 0x86, 0x07, 0xe8, 0x07, 0x07, 0x03, 0x2c,
+	0x20, 0x7c, 0x17, 0xf5, 0xa2, 0x11, 0x20, 0x78,	0x71, 0xba, 0xa2, 0x22, 0x8c, 0x02, 0x75, 0xff,	0x03, 0xd8, 0x2b, 0x00, 0x25, 0x28, 0x09, 0x40,	0x02, 0x29, 0x03, 0xb5, 0x01, 0xbc, 0x21, 0xe8,
+	0xfb, 0x08, 0x20, 0x02, 0x49, 0x01, 0x01, 0x54,	0x0d, 0x60, 0x20, 0xf4, 0x02, 0x84, 0x06, 0x04,	0xfa, 0x77, 0x00, 0x3c, 0x10, 0x05, 0xc1, 0x21,	0x34, 0x06, 0x73, 0x02, 0x94, 0x0c, 0xa0, 0xff,
+	0x0c, 0x20, 0x0d, 0xc0, 0x41, 0x78, 0x41, 0x6e,	0x33, 0xe8, 0x0c, 0xc0, 0x10, 0x40, 0x0c, 0x14,	0xff, 0x02, 0xc8, 0x0a, 0xc0, 0x2d, 0x70, 0x2f,	0x7c, 0x12, 0x20, 0x47, 0xdf, 0x2c, 0x94, 0x46,
+	0x7b, 0xff, 0x2b, 0xfd, 0x25, 0xfc, 0x4e, 0x04,	0x0e, 0x35, 0x2c, 0xe1, 0x29, 0x80, 0x49, 0x55,	0x06, 0x08, 0xff, 0x20, 0x80, 0x21, 0x78, 0x61,	0x38, 0x40, 0xc8, 0x62, 0x48, 0x60, 0xa2, 0x23,
+	0xac, 0x45, 0x00, 0xff, 0x27, 0x24, 0x22, 0x50,	0x26, 0xf0, 0x61, 0xb3, 0x0a, 0x1c, 0x06, 0x0c,	0x01, 0x18, 0x4b, 0x20, 0x9f, 0x69, 0x43, 0x27,	0xa0, 0x21, 0x53, 0x23, 0xfc, 0x09, 0x02, 0x11,
+	0x70, 0x45, 0x3f, 0xff, 0x03, 0x70, 0x25, 0xe0,	0x01, 0x2c, 0x46, 0x0c, 0x02, 0x80, 0x0b, 0x20,	0x48, 0x0c, 0x65, 0xa0, 0xff, 0x0a, 0x80, 0x08,	0xbc, 0x25, 0x50, 0x09, 0x78, 0x08, 0xdc, 0x05,
+	0xe0, 0x02, 0xa8, 0x51, 0xfc, 0xff, 0x47, 0xc0,	0x43, 0xf1, 0x08, 0x04, 0xa2, 0x02, 0x17, 0x06,	0x60, 0x03, 0x10, 0x41, 0xeb, 0x7f, 0x03, 0xc4,	0x25, 0x94, 0x73, 0x57, 0x09, 0xe0, 0x62, 0x1a,
+	0xa2, 0x40, 0x7c, 0x11, 0xfc, 0x71, 0x71, 0x67,	0x26, 0x62, 0x16, 0x61, 0xd6, 0x25, 0x7c, 0x60,	0xbc, 0x02, 0xc0, 0xff, 0x25, 0xa0, 0x44, 0x41,	0x29, 0xa0, 0x09, 0xdc, 0x48, 0x50, 0x2c, 0x04,
+	0x66, 0x70, 0x12, 0x40, 0x59, 0x23, 0x24, 0x77,	0x00, 0x00, 0x93, 0x10, 0x40, 0x10, 0x67, 0x84,	0x00, 0xff, 0x02, 0x20, 0x29, 0x80, 0x23, 0xf4,	0x6f, 0xa0, 0x36, 0x05, 0x2d, 0xa0, 0x11, 0xc0,
+	0x0d, 0x18, 0xb7, 0x02, 0x9c, 0x47, 0xe8, 0x20,	0x35, 0x17, 0x09, 0x04, 0x20, 0x48, 0x10, 0x00,	0xbb, 0xfe, 0x10, 0x20, 0x38, 0x03, 0x40, 0x40,	0xfe, 0x06, 0x90, 0x49, 0xec, 0x00, 0x18, 0x64,
+	0xaf, 0xfe, 0x11, 0x0a, 0x20, 0x47, 0x00, 0x46,	0xa0, 0x6a, 0x5c, 0x45, 0x2f, 0x45, 0xc1, 0x21,	0xc7, 0xff, 0x01, 0xfc, 0x0d, 0x04, 0x45, 0x20,	0x00, 0x88, 0x02, 0x8c, 0x42, 0x20, 0x01, 0x44,
+	0x41, 0x24, 0xff, 0x03, 0x08, 0x66, 0xa0, 0x62,	0xd4, 0x0c, 0x04, 0x66, 0xa0, 0x41, 0x73, 0x63,	0x44, 0x45, 0x14, 0xff, 0x1e, 0x01, 0x06, 0xb8,	0x04, 0x8c, 0x05, 0x6c, 0x1a, 0x30, 0x02, 0xb5,
+	0x40, 0xd8, 0x46, 0xe0, 0xff, 0x4b, 0xc0, 0x50,	0x48, 0x0a, 0x41, 0x6a, 0x88, 0x47, 0x00, 0x66,	0x51, 0x6d, 0x7c, 0x25, 0x40, 0xff, 0x0d, 0x40,	0x42, 0xe4, 0x42, 0x4c, 0x44, 0xa2, 0x22, 0x78,
+	0x42, 0x44, 0x4e, 0x4c, 0x0a, 0x80, 0xfe, 0x17,	0x0c, 0x5c, 0x4b, 0xec, 0x6e, 0x08, 0x64, 0xa0,	0x66, 0x09, 0x54, 0xa0, 0x15, 0x21, 0xef, 0x45,	0x54, 0x0b, 0x12, 0x22, 0x38, 0x20, 0xd3, 0x71,
+	0x01, 0x18, 0x47, 0x20, 0x71, 0x00, 0xbb, 0x2c,	0x40, 0x40, 0xc8, 0x70, 0x40, 0xbc, 0x4a, 0xcc,	0x2a, 0xa0, 0x71, 0x14, 0xc0, 0xff, 0x2e, 0x80,	0x6b, 0x80, 0x12, 0x40, 0x28, 0x18, 0x39, 0x40,
+	0x09, 0x22, 0x07, 0x40, 0x33, 0x7f, 0xff, 0x25,	0x0c, 0x23, 0xf8, 0x48, 0x20, 0x41, 0xdf, 0x61,	0x34, 0x41, 0xfc, 0x04, 0x0c, 0x40, 0x67, 0xff,	0x21, 0x25, 0x0b, 0xa0, 0x2d, 0x9c, 0x0d, 0xc0,
+	0x09, 0xdc, 0x61, 0xbe, 0x0c, 0xff, 0x41, 0x21,	0xff, 0x29, 0x3c, 0x21, 0x8c, 0x0b, 0x40, 0x00,	0x23, 0x20, 0x98, 0x22, 0x7c, 0x21, 0xa8, 0x6c,	0x4c, 0xff, 0x4f, 0x9c, 0x2b, 0x44, 0x63, 0x50,
+	0x42, 0x8c, 0x05, 0xd0, 0x47, 0x40, 0x41, 0x2b,	0x03, 0x17, 0xff, 0x06, 0x0c, 0x47, 0x37, 0x68,	0xdf, 0x11, 0x10, 0x0b, 0x35, 0x00, 0x1d, 0x09,	0x4d, 0x04, 0x5f, 0xbc, 0x71, 0x77, 0x07, 0x11,
+	0x6d, 0xb9, 0x61, 0x13, 0x00, 0xce, 0x17, 0x40,	0x3b, 0x7f, 0x60, 0x26, 0x40, 0x38, 0x60, 0x08,	0x00, 0xde, 0x42, 0x78, 0x20, 0x19, 0x1f, 0x00
+};
+
+static const uint8 _bootNtblA[] = {
+	0x10, 0x00, 0xfc, 0x00, 0x01, 0x1e, 0x02, 0x1b,	0x02, 0x1e, 0x01, 0x1c, 0x01, 0x1e, 0x62, 0x1b, 0x02, 0xbc, 0x60, 0x02, 0x1e, 0x02, 0x1a, 0x02,	0x1e, 0x62, 0x1d, 0x80, 0x03, 0x1e, 0x02, 0xff,
+	0x1a, 0x02, 0x1e, 0x62, 0x1e, 0x02, 0x1e, 0x02,	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,	0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,	0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e,	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02,	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,	0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e,	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02,	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e,	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0xff,	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,	0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,	0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,	0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,	0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e, 0x02,	0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02,	0x1e, 0x02, 0x1e, 0x02, 0xff, 0x1e, 0x02, 0x1e,
+	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e, 0x02, 0x1e,	0x02, 0x1e, 0x02, 0x1e, 0x02, 0x07, 0x1e, 0x02,	0x0d, 0x02, 0x1f, 0x00
+};
+
+static const uint8 _bootNtblB[] = {
+	0x10, 0x00, 0xfc, 0x40, 0x00, 0x1e, 0x02, 0x1a,	0x02, 0x1e, 0x01, 0x1c, 0x01, 0x1e, 0x62, 0x1e,	0x80, 0xff, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x02,	0x1e, 0x80, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x02,
+	0x1e, 0x80, 0x87, 0x1e, 0x01, 0x1e, 0x80, 0x0f,	0x58, 0x20, 0x14, 0x20, 0x15, 0x04, 0x02, 0x78,	0x16, 0x20, 0x17, 0x11, 0x30, 0x1e, 0x01, 0x1e,	0x80, 0x1a, 0x80, 0x19, 0xc4, 0x20, 0x1a, 0x04,
+	0x02, 0x1b, 0x20, 0x1c, 0x1e, 0x80, 0x1e, 0x01,	0x03, 0x1e, 0x80, 0x0a, 0x58, 0x20, 0x1d, 0x20,	0x1e, 0x20, 0x1f, 0x7b, 0xb2, 0x81, 0x21, 0x13,	0x30, 0x1e, 0x01, 0x1e, 0x80, 0x18, 0x80, 0x22,
+	0x10, 0x20, 0x23, 0x20, 0x24, 0xb2, 0x25, 0x20,	0x26, 0x0f, 0x1e, 0x80, 0x1e, 0x01, 0x19, 0x80,	0x0d, 0x18, 0x20, 0x27, 0x20, 0x28, 0x10, 0x20,	0x29, 0x20, 0x2a, 0x92, 0x2b, 0x20, 0x2c, 0xfc,
+	0x20, 0x2d, 0x1e, 0x38, 0x1e, 0x01, 0x1e, 0x80,	0x23, 0xf2, 0xcd, 0x18, 0x20, 0x2e, 0x20, 0x2f,	0x20, 0x30, 0x20, 0x31, 0x20, 0x32, 0x20, 0x33,	0x20, 0x34, 0x20, 0x35, 0x20, 0x36, 0x20, 0x37,
+	0x1e, 0x38, 0x07, 0x1e, 0x01, 0x1e, 0x80, 0x05,	0xf8, 0x38, 0x20, 0x39, 0x20, 0x3a, 0x11, 0xb2,	0x3b, 0x20, 0x3c, 0x66, 0xa6, 0x14, 0x40, 0x15,	0x79, 0x04, 0x02, 0x16, 0x40, 0x6a, 0x08, 0x1e,
+	0x01, 0x1e, 0x80, 0x4a, 0xf0, 0x3d, 0x10, 0x20,	0x3e, 0x20, 0x3f, 0xb2, 0x40, 0x20, 0x41, 0x41,	0x06, 0x7e, 0x18, 0x40, 0x19, 0x40, 0x1a, 0x04,	0x02, 0x1b, 0x1e, 0x40, 0x6a, 0x08, 0x1e, 0x01,
+	0x1e, 0x80, 0x0a, 0x80, 0x42, 0x20, 0x43, 0x11,	0x04, 0x02, 0x44, 0x20, 0x45, 0x06, 0x80, 0x1d,	0x40, 0x1e, 0xe4, 0x40, 0x1f, 0xb2, 0x20, 0x40,	0x6c, 0x08, 0x1e, 0x01, 0x1e, 0x80, 0x41, 0x48,
+	0xf0, 0x46, 0x20, 0x47, 0x20, 0x48, 0x04, 0x02,	0x49, 0x41, 0x68, 0x24, 0x22, 0x40, 0x23, 0x40,	0x24, 0xb2, 0x25, 0x1e, 0x40, 0x6c, 0x08, 0x1e,	0x01, 0x1e, 0x80, 0x08, 0x80, 0x4a, 0x20, 0x4b,
+	0x14, 0x20, 0x4c, 0x04, 0x02, 0x4d, 0x04, 0x7c,	0x27, 0x40, 0x28, 0x10, 0x40, 0x29, 0x40, 0x2a,	0x92, 0x2b, 0x40, 0x2c, 0xfe, 0x40, 0x66, 0x08,	0x1e, 0x80, 0x1e, 0x01, 0x7b, 0x80, 0x20, 0xf4,
+	0xca, 0x2e, 0x40, 0x2f, 0x40, 0x30, 0x40, 0x31,	0x40, 0x32, 0x40, 0x33, 0x40, 0x34, 0x40, 0x35,	0x40, 0x36, 0x40, 0x68, 0x08, 0x0f, 0x1e, 0x80,	0x1e, 0x01, 0x2b, 0x00, 0x0d, 0x50, 0x40, 0x38,
+	0x40, 0x39, 0xe4, 0x40, 0x3a, 0xb2, 0x3b, 0x40,	0x60, 0x08, 0x0d, 0x28, 0x1e, 0x80, 0x03, 0x1e,	0x01, 0x19, 0x80, 0x40, 0x3d, 0x40, 0x3e, 0x40,	0x3f, 0x7f, 0xb2, 0x81, 0x62, 0x08, 0x1e, 0x80,
+	0x1e, 0x01, 0x1e, 0x80, 0x09, 0x80, 0x42, 0xe4,	0x40, 0x43, 0x04, 0x02, 0x44, 0x40, 0x62, 0x08,	0x1e, 0x80, 0x1e, 0x01, 0x03, 0x1e, 0x80, 0x06,	0x50, 0x40, 0x46, 0x40, 0x47, 0x40, 0x48, 0x3f,
+	0x04, 0x02, 0x64, 0x08, 0x1e, 0x80, 0x1e, 0x01,	0x57, 0x80, 0x0e, 0x5e, 0x4a, 0x40, 0xe8, 0x4b,	0x40, 0x4c, 0x04, 0x02, 0x4d, 0x15, 0x7a, 0x1e,	0x80, 0x1e, 0x01, 0xff, 0x19, 0xd8, 0x1e, 0x02,
+	0x1e, 0x80, 0x1e, 0x01, 0x33, 0x80, 0xd9, 0x51,	0x00, 0x52, 0x00, 0x53, 0x00, 0x54, 0x00, 0x55,	0x00, 0x56, 0x00, 0x57, 0x00, 0x58, 0x00, 0x59,	0x00, 0x5a, 0x00, 0x5b, 0x00, 0x5c, 0x00, 0x5d,
+	0x00, 0x5e, 0x00, 0x5f, 0x00, 0x4e, 0x00, 0x4f,	0x1e, 0x80, 0x1e, 0x01, 0xff, 0x57, 0x80, 0xde,	0x00, 0x60, 0x00, 0x61, 0x00, 0x62, 0x00, 0x63,	0x00, 0x64, 0x00, 0x65, 0x00, 0x66, 0x00, 0x67,
+	0x00, 0x68, 0x00, 0x69, 0x00, 0x6a, 0x00, 0x6b,	0x00, 0x6c, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x6f,	0x00, 0x90, 0x00, 0x91, 0x00, 0x92, 0x1e, 0x80,	0x1e, 0x01, 0x16, 0x80, 0xdd, 0x70, 0x00, 0x71,
+	0x00, 0x72, 0x00, 0x73, 0x00, 0x74, 0x00, 0x75,	0x00, 0x76, 0x00, 0x77, 0x00, 0x78, 0x00, 0x79,	0x00, 0x7a, 0x00, 0x7b, 0x00, 0x7c, 0x00, 0x7d,	0x00, 0x7e, 0x00, 0x7f, 0x00, 0x50, 0x00, 0x93,
+	0x00, 0x94, 0x1e, 0x78, 0x1e, 0x01, 0xff, 0x16,	0x80, 0xc5, 0x80, 0x00, 0x81, 0x00, 0x82, 0x00,	0x83, 0x00, 0x84, 0x00, 0x85, 0x00, 0x86, 0x9e,	0xcd, 0x88, 0x00, 0x89, 0x00, 0x8a, 0x00, 0x8b,
+	0x00, 0x8c, 0x00, 0x8d, 0x00, 0x8e, 0x00, 0x8f,	0x00, 0x87, 0x00, 0x95, 0x00, 0x96, 0x1e, 0x80,	0x1e, 0x01, 0x5e, 0x80, 0x1e, 0x02, 0xff, 0x1e,	0x01, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x80, 0x1e,
+	0x01, 0x1e, 0x01, 0x1e, 0x98, 0x1e, 0x28, 0xff,	0x1e, 0x01, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x01,	0x1e, 0x01, 0x1e, 0x01, 0x1e, 0x80, 0x1e, 0x01,	0x7f, 0x1e, 0x01, 0x1e, 0x01, 0x1e, 0x80, 0x1e,
+	0x01, 0x1e, 0x01, 0x50, 0x80, 0x1f
+};
+
+static const uint8 _cpyrNote[] = {
+	0x33, 0x2e, 0x21, 0x34, 0x23, 0x28, 0x25, 0x32,	0x00, 0x34, 0x2d, 0x00, 0x29, 0x33, 0x21, 0x00, 0x34, 0x32, 0x21, 0x24, 0x25, 0x2d, 0x21, 0x32,	0x2b, 0x00, 0x2f,
+	0x26, 0x00, 0x2b, 0x2f, 0x2e, 0x21, 0x2d, 0x29, 0x00, 0x23, 0x2f, 0x0e, 0x0c, 0x2c, 0x34, 0x24, 0x0e, 0x34, 0x2d, 0x00, 0x21, 0x2e, 0x24, 0x00, 0x5f, 0x00, 0x11,
+	0x19, 0x19, 0x14, 0x00, 0x2b, 0x2f, 0x2e, 0x21, 0x2d, 0x29, 0x00, 0x23, 0x2f, 0x0e, 0x0c, 0x2c, 0x34, 0x24,	0x0e, 0x00, 0x2c, 0x29, 0x23, 0x25, 0x2e, 0x33,	0x25,
+	0x24, 0x00, 0x22, 0x39, 0x00, 0x33, 0x25, 0x27, 0x21, 0x00, 0x25, 0x2e, 0x34, 0x25, 0x32, 0x30, 0x32, 0x29, 0x33, 0x25, 0x33, 0x0c, 0x2c, 0x34, 0x24, 0x0e
+};
+
+extern const uint8 *const _bootSeqData[] = {
+	_bootTileData1,
+	_bootTileData2,
+	_bootNtblA,
+	_bootNtblB,
+	_cpyrNote
+};
+
+} // End of namespace StaticRes_SCD
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/staticres.h b/engines/snatcher/staticres.h
new file mode 100644
index 00000000000..ab2df4dcb3f
--- /dev/null
+++ b/engines/snatcher/staticres.h
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#ifndef SNATCHER_STATICRES_H
+#define SNATCHER_STATICRES_H
+
+#include "common/scummsys.h"
+
+namespace Snatcher {
+
+namespace StaticRes_SCD {
+
+	extern const uint8 *const _bootSeqData[4];
+
+} // End of namespace StaticRes
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_SOUND_H
diff --git a/engines/snatcher/scroll.h b/engines/snatcher/transition.h
similarity index 71%
rename from engines/snatcher/scroll.h
rename to engines/snatcher/transition.h
index 8b2e3b6d675..c104a1ec98c 100644
--- a/engines/snatcher/scroll.h
+++ b/engines/snatcher/transition.h
@@ -19,17 +19,14 @@
 *
 */
 
-#ifndef SNATCHER_SCROLL_H
-#define SNATCHER_SCROLL_H
+#ifndef SNATCHER_TRANSITION_H
+#define SNATCHER_TRANSITION_H
 
-//#include "common/platform.h"
-//#include "snatcher/graphics.h"
-//#include "snatcher/resource.h"
 #include "common/scummsys.h"
 
 namespace Snatcher {
 
-class ScrollManager {
+class TransitionManager {
 public:
 	enum {
 		kHorzA = 0,
@@ -39,7 +36,8 @@ public:
 	};
 
 	struct ScrollState {
-		int16 offsets[4];
+		int16 realOffsets[4];
+		int16 unmodifiedOffsets[4];
 		const int16 *hScrollTable;
 		uint16 hScrollTableNumEntries;
 		bool disableVScroll;
@@ -51,30 +49,30 @@ public:
 		} hInt;
 	};
 
-	ScrollManager() {
+	TransitionManager() {
 		memset(&_result, 0, sizeof(_result));
 	}
 
-	virtual ~ScrollManager() {}
+	virtual ~TransitionManager() {}
 	virtual void doCommand(int cmd) = 0;
-	virtual void setSingleStep(int mode, int16 step) = 0;
-	virtual void setDirectionAndSpeed(int mode, int16 incr) = 0;
+	virtual void scroll_setSingleStep(int mode, int16 step) = 0;
+	virtual void scroll_setDirectionAndSpeed(int mode, int16 incr) = 0;
 	virtual void clear() = 0;
 	virtual bool nextFrame() = 0;
 	virtual void hINTCallback(void*) {}
-	const ScrollState &getState() const { return _result; }
+	const ScrollState &scroll_getState() const { return _result; }
 
 protected:
 	ScrollState _result;
 
 private:
-	static ScrollManager *createSegaScrollManager(GraphicsEngine::GfxState &state);
+	static TransitionManager *createSegaTransitionManager(GraphicsEngine::GfxState &state);
 
 public:
-	static ScrollManager *create(Common::Platform platform, GraphicsEngine::GfxState &state) {
+	static TransitionManager *create(Common::Platform platform, GraphicsEngine::GfxState &state) {
 		switch (platform) {
 		case Common::kPlatformSegaCD:
-			return createSegaScrollManager(state);
+			return createSegaTransitionManager(state);
 		default:
 			break;
 		};
diff --git a/engines/snatcher/scroll_scd.cpp b/engines/snatcher/transition_scd.cpp
similarity index 61%
rename from engines/snatcher/scroll_scd.cpp
rename to engines/snatcher/transition_scd.cpp
index 5b43b17cc2a..4734eba153e 100644
--- a/engines/snatcher/scroll_scd.cpp
+++ b/engines/snatcher/transition_scd.cpp
@@ -21,7 +21,7 @@
 
 
 #include "snatcher/graphics.h"
-#include "snatcher/scroll.h"
+#include "snatcher/transition.h"
 #include "graphics/segagfx.h"
 
 namespace Snatcher {
@@ -64,10 +64,14 @@ public:
 		return changed;
 	}
 
-	int16 getOffset(bool override) const {
+	int16 getRealOffset(bool override) const {
 		return override ? _override : _curResult * _factor;
 	}
 
+	int16 getUnmodifiedOffset() const {
+		return _curResult;
+	}
+
 private:
 	int32 _offsSingle;
 	int32 _offsRep;
@@ -77,7 +81,7 @@ private:
 	int16 _override;
 };
 
-class ScrollManager_SCD final : public ScrollManager {
+class TransitionManager_SCD final : public TransitionManager {
 public:
 	enum {
 		kHorzA = 0,
@@ -86,17 +90,17 @@ public:
 		kVertB = 3
 	};
 
-	ScrollManager_SCD(GraphicsEngine::GfxState &state);
-	~ScrollManager_SCD() override;
+	TransitionManager_SCD(GraphicsEngine::GfxState &state);
+	~TransitionManager_SCD() override;
 
 	void doCommand(int cmd) override;
 
-	void setSingleStep(int mode, int16 step) override {
+	void scroll_setSingleStep(int mode, int16 step) override {
 		assert(mode < 4);
 		_internalState[mode].singleStep(step);
 	}
 
-	void setDirectionAndSpeed(int mode, int16 incr) override {
+	void scroll_setDirectionAndSpeed(int mode, int16 incr) override {
 		assert(mode < 4);
 		_internalState[mode].setDirectionAndSpeed(incr);
 	}
@@ -117,61 +121,61 @@ private:
 	uint16 _hScrollTableLen;
 
 	uint8 _scrollType;
-	uint8 _scrollCommandExt;
-	uint8 _scrollCommand;
+	uint8 _trsCommandExt;
+	uint8 _trsCommand;
 	uint8 _resetCommand;
 
 	uint8 _nextStep;
 	uint8 _lastStep;
-	uint8 _scrollCmd_0xff_0xfd_0xfc_or0to6_last;
+	uint8 _trsCmd_0xff_0xfd_0xfc_or0to6_last;
 	uint8 _nextStepExt;
 	uint8 _lastStepExt;
-	int16 _scrollFlagttt;
-	int16 _scrollu_7;
+	int16 _trsFlagttt;
+	int16 _trsu_7;
 	int16 _hint_proc;
 	int16 _transitionType;
 	int16 _transitionState;
 	int16 _transitionStep;
-	int16 _scrollu_5;
+	int16 _trsu_5;
 	int16 _subPara;
-	uint32 _scroll__DA;
-	uint16 _scroll__DB;
+	uint32 _trs__DA;
+	uint16 _trs__DB;
 	bool useEngineScrollOffsets;
 
 private:
-	typedef Common::Functor1Mem<int, void, ScrollManager_SCD> ScrollFunc;
-	Common::Array<ScrollFunc*> _scrollProcs;
+	typedef Common::Functor1Mem<int, void, TransitionManager_SCD> TrsFunc;
+	Common::Array<TrsFunc*> _trsProcs;
 
 	void makeFunctions();
 	void doCommandIntern(int cmd, int arg);
 
-	void scrUpdt_dummy(int arg);
-	void scrUpdt_engineScroll(int arg);
-	void scrUpdt_03(int arg);
-	void scrUpdt_04(int arg);
-	void scrUpdt_05(int arg);
-	void scrUpdt_06(int arg);
-	void scrUpdt_screenShutter(int arg);
-	void scrUpdt_revealShutter(int arg);
-	void scrUpdt_13(int arg);
-	void scrUpdt_14(int arg);
-	void scrUpdt_15(int arg);
-	void scrUpdt_16(int arg);
-	void scrUpdt_17(int arg);
-	void scrUpdt_18(int arg);
-	void scrUpdt_19(int arg);
-	void scrUpdt_20(int arg);
-	void scrUpdt_21(int arg);
-	void scrUpdt_22(int arg);
-	void scrUpdt_23(int arg);
-	void scrUpdt_24(int arg);
-	void scrUpdt_25(int arg);
-	void scrUpdt_26(int arg);
-	void scrUpdt_27(int arg);
-	void scrUpdt_28(int arg);
-	void scrUpdt_29(int arg);
-
-	typedef Common::Functor1Mem<Graphics::SegaRenderer*, void, ScrollManager_SCD> HINTFunc;
+	void trsUpdt_dummy(int arg);
+	void trsUpdt_engineScroll(int arg);
+	void trsUpdt_03(int arg);
+	void trsUpdt_04(int arg);
+	void trsUpdt_05(int arg);
+	void trsUpdt_06(int arg);
+	void trsUpdt_screenShutter(int arg);
+	void trsUpdt_revealShutter(int arg);
+	void trsUpdt_13(int arg);
+	void trsUpdt_14(int arg);
+	void trsUpdt_15(int arg);
+	void trsUpdt_16(int arg);
+	void trsUpdt_17(int arg);
+	void trsUpdt_18(int arg);
+	void trsUpdt_19(int arg);
+	void trsUpdt_20(int arg);
+	void trsUpdt_21(int arg);
+	void trsUpdt_22(int arg);
+	void trsUpdt_23(int arg);
+	void trsUpdt_24(int arg);
+	void trsUpdt_25(int arg);
+	void trsUpdt_26(int arg);
+	void trsUpdt_27(int arg);
+	void trsUpdt_28(int arg);
+	void trsUpdt_29(int arg);
+
+	typedef Common::Functor1Mem<Graphics::SegaRenderer*, void, TransitionManager_SCD> HINTFunc;
 	Common::Array<HINTFunc*> _hINTProcs;
 	const HINTFunc *_hINTHandler;
 
@@ -181,9 +185,9 @@ private:
 	void hIntHandler_revealShutter(Graphics::SegaRenderer *sr);
 };
 
-ScrollManager_SCD::ScrollManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0), _hint_proc(0), _transitionStep(0),
-	_scrollCommandExt(0), _scrollCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _scroll__DA(0), _scroll__DB(0), _scrollCmd_0xff_0xfd_0xfc_or0to6_last(0), _scrollFlagttt(0),
-	_scrollu_7(0), _transitionType(0), _transitionState(0), _scrollu_5(0), _subPara(0), useEngineScrollOffsets(false), _hINTHandler(nullptr) {
+TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0), _hint_proc(0), _transitionStep(0),
+	_trsCommandExt(0), _trsCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _trs__DA(0), _trs__DB(0), _trsCmd_0xff_0xfd_0xfc_or0to6_last(0), _trsFlagttt(0),
+	_trsu_7(0), _transitionType(0), _transitionState(0), _trsu_5(0), _subPara(0), useEngineScrollOffsets(false), _hINTHandler(nullptr) {
 	_internalState = new ScrollInternalState[4];
 	assert(_internalState);
 	_internalState[kVertA].setFactor(-1);
@@ -193,16 +197,16 @@ ScrollManager_SCD::ScrollManager_SCD(GraphicsEngine::GfxState &state) : _gfxStat
 	makeFunctions();
 }
 
-ScrollManager_SCD::~ScrollManager_SCD() {
+TransitionManager_SCD::~TransitionManager_SCD() {
 	delete[] _internalState;
 	delete[] _hScrollTable;
-	for (Common::Array<ScrollFunc*>::const_iterator i = _scrollProcs.begin(); i != _scrollProcs.end(); ++i)
+	for (Common::Array<TrsFunc*>::const_iterator i = _trsProcs.begin(); i != _trsProcs.end(); ++i)
 		delete *i;
 	for (Common::Array<HINTFunc*>::const_iterator i = _hINTProcs.begin(); i != _hINTProcs.end(); ++i)
 		delete *i;
 }
 
-void ScrollManager_SCD::doCommand(int cmd) {
+void TransitionManager_SCD::doCommand(int cmd) {
 	_gfxState.setVar(3, 1);
 
 	if (cmd == 0xFF || cmd == 0xFC) {
@@ -210,35 +214,35 @@ void ScrollManager_SCD::doCommand(int cmd) {
 		_resetCommand = cmd;
 	} else {
 		if (cmd >= 7 && cmd != 0xFD) {
-			_scrollCommandExt = cmd;
+			_trsCommandExt = cmd;
 		} else {
-			_scrollCommand = cmd;
+			_trsCommand = cmd;
 			_scrollType = (cmd < 3) ? cmd | ((cmd & 1) << 4) : 0;
 		}
 	}
 }
 
-void ScrollManager_SCD::clear() {
+void TransitionManager_SCD::clear() {
 	for (int i = 0; i < 4; ++i) 
 		_internalState[i].clear();
 	memset(&_result, 0, sizeof(_result));
 	_scrollType = 0;
-	_scrollCommandExt = 0;
-	_scrollCommand = 0;
+	_trsCommandExt = 0;
+	_trsCommand = 0;
 	_resetCommand = 0;
 }
 
-bool ScrollManager_SCD::nextFrame() {
+bool TransitionManager_SCD::nextFrame() {
 	if (_resetCommand == 0) {
-		if (_scrollCommandExt)
-			_nextStepExt = _scrollCommandExt;
-		if (_scrollCommand)
-			_nextStep = _scrollCommand;
-		_scrollCommand = _scrollCommandExt = 0;
+		if (_trsCommandExt)
+			_nextStepExt = _trsCommandExt;
+		if (_trsCommand)
+			_nextStep = _trsCommand;
+		_trsCommand = _trsCommandExt = 0;
 	} else {
 		_nextStep = _resetCommand;
 		_resetCommand = 0;
-		_scrollCommandExt = 0;
+		_trsCommandExt = 0;
 		// _wordRAM__TABLE48__09 = 0;
 		// _wordRAM__TABLE48__0A = 0;
 	}
@@ -248,7 +252,7 @@ bool ScrollManager_SCD::nextFrame() {
 			if (_lastStepExt == 23) {
 				_internalState[kVertA].setNextOffset(0);
 				_internalState[kVertB].setNextOffset(0);
-				if (_scrollFlagttt) {
+				if (_trsFlagttt) {
 					resetVars(0x30);
 					_nextStepExt = _lastStepExt = 15;
 				} else {
@@ -260,7 +264,7 @@ bool ScrollManager_SCD::nextFrame() {
 			resetVars(0x40);
 		} else if (_nextStepExt != 0) {
 			_nextStepExt = 23;
-			_scrollFlagttt = 1;
+			_trsFlagttt = 1;
 		}
 	}
 
@@ -273,12 +277,13 @@ bool ScrollManager_SCD::nextFrame() {
 		for (int i = 0; i < 4; ++i) {
 			if (_internalState[i].recalc(_scrollType & 0x10))
 				changed = true;
-			_result.offsets[i] = _internalState[i].getOffset(!(changed || useEngineScrollOffsets));
-			_internalState[i].setNextOffset(_result.offsets[i]);
+			_result.realOffsets[i] = _internalState[i].getRealOffset(!(changed || useEngineScrollOffsets));
+			_result.unmodifiedOffsets[i] = _internalState[i].getUnmodifiedOffset();
+			_internalState[i].setNextOffset(_result.realOffsets[i]);
 		}
 		_result.hScrollTable = _hScrollTable;
 		_result.hScrollTableNumEntries = _hScrollTableLen;
-		_result.disableVScroll = (_scrollCmd_0xff_0xfd_0xfc_or0to6_last != 0);
+		_result.disableVScroll = (_trsCmd_0xff_0xfd_0xfc_or0to6_last != 0);
 		_scrollType &= ~0x10;
 	}
 
@@ -287,35 +292,35 @@ bool ScrollManager_SCD::nextFrame() {
 	return changed || reset || _result.hInt.needUpdate;
 }
 
-void ScrollManager_SCD::hINTCallback(void *segaRenderer) {
+void TransitionManager_SCD::hINTCallback(void *segaRenderer) {
 	if (_hINTHandler && _hINTHandler->isValid())
 		(*_hINTHandler)(static_cast<Graphics::SegaRenderer *>(segaRenderer));
 }
 
-void ScrollManager_SCD::processCmdInternal() {
+void TransitionManager_SCD::processCmdInternal() {
 	if ((_nextStep != _lastStep || _lastStep == 0) && _nextStep != 0) {
 		if (_nextStep == 0xFF || _nextStep == 0xFC) {
 			resetVars(_nextStep == 0xFF ? 0x0F : 0x0E);
 			return;
 		} else if (_nextStep == 0xFD) {
-			_scrollCmd_0xff_0xfd_0xfc_or0to6_last |= 0x80;
+			_trsCmd_0xff_0xfd_0xfc_or0to6_last |= 0x80;
 		} else {
 			_lastStep = _nextStep;
 			if (_nextStep < 3) {
 				resetVars(0x08);
 			} else {
-				_scroll__DA = 0;
-				_scrollCmd_0xff_0xfd_0xfc_or0to6_last = 0;
+				_trs__DA = 0;
+				_trsCmd_0xff_0xfd_0xfc_or0to6_last = 0;
 			}
 		}
 	}
 
 	bool b = false;
-	if (_scrollCmd_0xff_0xfd_0xfc_or0to6_last != 0) {
-		if (_scrollCmd_0xff_0xfd_0xfc_or0to6_last & 0x80)
+	if (_trsCmd_0xff_0xfd_0xfc_or0to6_last != 0) {
+		if (_trsCmd_0xff_0xfd_0xfc_or0to6_last & 0x80)
 			b = true;
 		else
-			doCommandIntern(_scrollCmd_0xff_0xfd_0xfc_or0to6_last, 0);
+			doCommandIntern(_trsCmd_0xff_0xfd_0xfc_or0to6_last, 0);
 	}
 
 	if (!b && _nextStep != 0)
@@ -324,7 +329,7 @@ void ScrollManager_SCD::processCmdInternal() {
 	doCommandIntern(_nextStepExt, _subPara);
 }
 
-void ScrollManager_SCD::processTransition() {
+void TransitionManager_SCD::processTransition() {
 	_result.hInt.enable = false;
 	if (_transitionType == 0)
 		return;
@@ -366,18 +371,18 @@ void ScrollManager_SCD::processTransition() {
 	_result.hInt.needUpdate = true;
 }
 
-void ScrollManager_SCD::resetVars(int groupFlags) {
+void TransitionManager_SCD::resetVars(int groupFlags) {
 	if (groupFlags & 0x01) {
 		_result.hInt.enable = false;
 		_result.hInt.needUpdate = true;
 	}
 	if (groupFlags & 0x02) {
-		_scrollCmd_0xff_0xfd_0xfc_or0to6_last = 0;
-		_scroll__DA = 0;
-		_scroll__DB = 0;
+		_trsCmd_0xff_0xfd_0xfc_or0to6_last = 0;
+		_trs__DA = 0;
+		_trs__DB = 0;
 		_nextStepExt = 0;
-		_transitionType = _transitionState = _scrollu_5 = _subPara = _scrollu_7 = 0;
-		_scrollFlagttt = 0;
+		_transitionType = _transitionState = _trsu_5 = _subPara = _trsu_7 = 0;
+		_trsFlagttt = 0;
 
 	}
 	if (groupFlags & 0x04) {
@@ -388,64 +393,64 @@ void ScrollManager_SCD::resetVars(int groupFlags) {
 	}
 	if (groupFlags & 0x08) {
 		useEngineScrollOffsets = false;
-		//_scrolloa = 0;
-		//_scrollob = 0;
+		//_trsoa = 0;
+		//_trsob = 0;
 	}
 	if (groupFlags & 0x10) {
 		_nextStepExt = _lastStepExt = 0;
-		_transitionType = _scrollu_7 = 0;
+		_transitionType = _trsu_7 = 0;
 	}
 	if (groupFlags & 0x20) {
-		_scrollFlagttt = 0;
+		_trsFlagttt = 0;
 		_internalState[kVertA].setNextOffset(0);
 		_internalState[kVertB].setNextOffset(0);
 	}
 	if (groupFlags & 0x40) {
-		_transitionState = _scrollu_5 = _subPara = 0;
+		_transitionState = _trsu_5 = _subPara = 0;
 	}
 }
 
-#define SF(x) &ScrollManager_SCD::scrUpdt_##x
-#define HF(x) &ScrollManager_SCD::hIntHandler_##x
-void ScrollManager_SCD::makeFunctions() {
-	typedef void (ScrollManager_SCD::*ScrFunc)(int);
+#define TF(x) &TransitionManager_SCD::trsUpdt_##x
+#define HF(x) &TransitionManager_SCD::hIntHandler_##x
+void TransitionManager_SCD::makeFunctions() {
+	typedef void (TransitionManager_SCD::*ScrFunc)(int);
 	static const ScrFunc funcTbl[] = {
-		SF(dummy),
-		SF(engineScroll),
-		SF(engineScroll),
-		SF(03),
-		SF(04),
-		SF(05),
-		SF(06),
-		SF(screenShutter),
-		SF(revealShutter),
-		SF(revealShutter),
-		SF(revealShutter),
-		SF(revealShutter),
-		SF(revealShutter),
-		SF(13),
-		SF(14),
-		SF(15),
-		SF(16),
-		SF(17),
-		SF(18),
-		SF(19),
-		SF(20),
-		SF(21),
-		SF(22),
-		SF(23),
-		SF(24),
-		SF(25),
-		SF(26),
-		SF(27),
-		SF(28),
-		SF(29)
+		TF(dummy),
+		TF(engineScroll),
+		TF(engineScroll),
+		TF(03),
+		TF(04),
+		TF(05),
+		TF(06),
+		TF(screenShutter),
+		TF(revealShutter),
+		TF(revealShutter),
+		TF(revealShutter),
+		TF(revealShutter),
+		TF(revealShutter),
+		TF(13),
+		TF(14),
+		TF(15),
+		TF(16),
+		TF(17),
+		TF(18),
+		TF(19),
+		TF(20),
+		TF(21),
+		TF(22),
+		TF(23),
+		TF(24),
+		TF(25),
+		TF(26),
+		TF(27),
+		TF(28),
+		TF(29)
 	};
 
 	for (uint i = 0; i < ARRAYSIZE(funcTbl); ++i) \
-		_scrollProcs.push_back(new ScrollFunc(this, funcTbl[i]));
+		_trsProcs.push_back(new TrsFunc(this, funcTbl[i]));
 
-	typedef void (ScrollManager_SCD::*HIFunc)(Graphics::SegaRenderer*);
+	typedef void (TransitionManager_SCD::*HIFunc)(Graphics::SegaRenderer*);
 	static const HIFunc funcTbl2[] = {
 		nullptr,
 		nullptr,
@@ -464,36 +469,36 @@ void ScrollManager_SCD::makeFunctions() {
 		_hINTProcs.push_back(new HINTFunc(this, funcTbl2[i]));
 }
 #undef HF
-#undef SF
+#undef TF
 
-void ScrollManager_SCD::doCommandIntern(int cmd, int arg) {
-	if (_scrollProcs[cmd]->isValid())
-		(*_scrollProcs[cmd])(arg);
+void TransitionManager_SCD::doCommandIntern(int cmd, int arg) {
+	if (_trsProcs[cmd]->isValid())
+		(*_trsProcs[cmd])(arg);
 	else
 		error("%s(): Invalid opcode %d", __FUNCTION__, cmd);
 }
 
-void ScrollManager_SCD::scrUpdt_dummy(int arg) {
+void TransitionManager_SCD::trsUpdt_dummy(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_engineScroll(int arg) {
+void TransitionManager_SCD::trsUpdt_engineScroll(int arg) {
 	_result.lineScrollMode = false;
 	useEngineScrollOffsets = true;
 }
 
-void ScrollManager_SCD::scrUpdt_03(int arg) {
+void TransitionManager_SCD::trsUpdt_03(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_04(int arg) {
+void TransitionManager_SCD::trsUpdt_04(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_05(int arg) {
+void TransitionManager_SCD::trsUpdt_05(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_06(int arg) {
+void TransitionManager_SCD::trsUpdt_06(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_screenShutter(int arg) {
+void TransitionManager_SCD::trsUpdt_screenShutter(int arg) {
 	if (arg == 0) {
 		_transitionType = 1;
 		setHINTHandler(7);
@@ -508,7 +513,7 @@ void ScrollManager_SCD::scrUpdt_screenShutter(int arg) {
 	}
 }
 
-void ScrollManager_SCD::scrUpdt_revealShutter(int arg) {
+void TransitionManager_SCD::trsUpdt_revealShutter(int arg) {
 	if (arg == 0) {
 		_transitionType = _nextStepExt - 6;
 		setHINTHandler(8);
@@ -528,65 +533,65 @@ void ScrollManager_SCD::scrUpdt_revealShutter(int arg) {
 	}
 }
 
-void ScrollManager_SCD::scrUpdt_13(int arg) {
+void TransitionManager_SCD::trsUpdt_13(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_14(int arg) {
+void TransitionManager_SCD::trsUpdt_14(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_15(int arg) {
+void TransitionManager_SCD::trsUpdt_15(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_16(int arg) {
+void TransitionManager_SCD::trsUpdt_16(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_17(int arg) {
+void TransitionManager_SCD::trsUpdt_17(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_18(int arg) {
+void TransitionManager_SCD::trsUpdt_18(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_19(int arg) {
+void TransitionManager_SCD::trsUpdt_19(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_20(int arg) {
+void TransitionManager_SCD::trsUpdt_20(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_21(int arg) {
+void TransitionManager_SCD::trsUpdt_21(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_22(int arg) {
+void TransitionManager_SCD::trsUpdt_22(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_23(int arg) {
+void TransitionManager_SCD::trsUpdt_23(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_24(int arg) {
+void TransitionManager_SCD::trsUpdt_24(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_25(int arg) {
+void TransitionManager_SCD::trsUpdt_25(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_26(int arg) {
+void TransitionManager_SCD::trsUpdt_26(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_27(int arg) {
+void TransitionManager_SCD::trsUpdt_27(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_28(int arg) {
+void TransitionManager_SCD::trsUpdt_28(int arg) {
 }
 
-void ScrollManager_SCD::scrUpdt_29(int arg) {
+void TransitionManager_SCD::trsUpdt_29(int arg) {
 }
 
-void ScrollManager_SCD::setHINTHandler(uint8 num) {
+void TransitionManager_SCD::setHINTHandler(uint8 num) {
 	if (num < _hINTProcs.size())
 		_hINTHandler = _hINTProcs[num];
 	 else
 		error("%s(): Invalid HINT handler %d", __FUNCTION__, num);
 }
 
-void ScrollManager_SCD::hIntHandler_screenShutter(Graphics::SegaRenderer *sr) {
+void TransitionManager_SCD::hIntHandler_screenShutter(Graphics::SegaRenderer *sr) {
 	if (_transitionState <= 0 || _transitionStep == (_transitionState == 1 ? 8 : 10)) {
 		_result.hInt.enable = false;
 		sr->hINT_enable(false);
@@ -599,7 +604,7 @@ void ScrollManager_SCD::hIntHandler_screenShutter(Graphics::SegaRenderer *sr) {
 	++_transitionStep;
 }
 
-void ScrollManager_SCD::hIntHandler_revealShutter(Graphics::SegaRenderer *sr) {
+void TransitionManager_SCD::hIntHandler_revealShutter(Graphics::SegaRenderer *sr) {
 	static const int8 actions[5][8] = {
 		{  0,  0,  7,  1,  8,  2, -1, -1 },
 		{  0,  4,  9,  3, 10,  1, 11,  2 },
@@ -642,8 +647,8 @@ void ScrollManager_SCD::hIntHandler_revealShutter(Graphics::SegaRenderer *sr) {
 	++_transitionStep;
 }
 
-ScrollManager *ScrollManager::createSegaScrollManager(GraphicsEngine::GfxState &state) {
-	return new ScrollManager_SCD(state);
+TransitionManager *TransitionManager::createSegaTransitionManager(GraphicsEngine::GfxState &state) {
+	return new TransitionManager_SCD(state);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/util.cpp b/engines/snatcher/util.cpp
index 411cd652aaf..59640c5cb7f 100644
--- a/engines/snatcher/util.cpp
+++ b/engines/snatcher/util.cpp
@@ -91,25 +91,52 @@ uint32 makeBCDTimeStamp(uint32 msecs) {
 	return ((min & 0xFF) << 24) | ((sec & 0xFF) << 16) | ((frm & 0xFF) << 8);
 }
 
-uint16 rndC1 = 0;
-uint16 rndC2 = 0;
+union RNDC {
+	RNDC() : b(0) {}
+	uint8 a[2];
+	uint16 b;
+};
+
+RNDC rndC1;
+RNDC rndC2;
+
+uint8 rndH = 0;
+uint8 rndL = 1;
+
+//uint16 rndC1q = 0;
+//uint16 rndC2q = 0;
 
 void rngReset() {
-	rndC1 = 0;
-	rndC2 = 0;
+	rndC1.b = 0;
+	rndC2.b = 0;
+	//rndC1q = 0;
+	//rndC2q = 0;
+	rndH = FROM_BE_16(0x100) & 0xFF;
+	rndL = rndH ^ 1;
 }
 
 uint16 rngMakeNumber() {
-	rndC1 += ((rndC1 & 0xFF) << 8);
-	rndC1 += rndC2;
-	rndC1 += ((rndC2 << 8) | (rndC2 >> 8));
-	if ((rndC2 & 0xFF) + (rndC2 >> 8) > 0xFF)
-		rndC1++;
-	rndC2 = (((rndC2 & 0xFF) + (rndC2 >> 8)) & 0xFF) | (rndC2 & 0xFF00);
-	if (rndC2 + 1 > 0xFFFF);
-		rndC1++;
-	rndC2++;
-	return rndC1;
+	rndC1.a[rndH] += rndC1.a[rndL];
+	rndC1.b += rndC2.b;
+	rndC1.b += SWAP_BYTES_16(rndC2.b);
+	if (rndC2.a[rndH] + rndC2.a[rndL] > 0xFF)
+		rndC1.b++;
+	rndC2.a[rndH] += rndC2.a[rndL];
+	if (rndC2.b + 1 > 0xFFFF)
+		rndC1.b++;
+	rndC2.b++;
+
+	/*rndC1q += ((rndC1q & 0xFF) << 8);
+	rndC1q += rndC2q;
+	rndC1q += ((rndC2q << 8) | (rndC2q >> 8));
+	if ((rndC2q & 0xFF) + (rndC2q >> 8) > 0xFF)
+		rndC1q++;
+	rndC2q = (((rndC2q & 0xFF) + (rndC2q >> 8)) & 0xFF) | (rndC2q & 0xFF00);
+	if (rndC2q + 1 > 0xFFFF)
+		rndC1q++;
+	rndC2q++;
+		assert(rndC1q == rndC1.b);*/
+	return rndC1.b;
 }
 
 } // End of namespace Util


Commit: 95b4f2a5676e2af321ca01dff06480e925195bbb
    https://github.com/scummvm/scummvm/commit/95b4f2a5676e2af321ca01dff06480e925195bbb
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: more work on the audio code

Support for fm and pcm sounds.

Changed paths:
  A engines/snatcher/staticres_types.h
  R engines/snatcher/sound_device_null.cpp
    audio/softsynth/fmtowns_pc98/pcm_common.cpp
    audio/softsynth/fmtowns_pc98/pcm_common.h
    audio/softsynth/fmtowns_pc98/sega_audio.cpp
    audio/softsynth/fmtowns_pc98/sega_audio.h
    engines/snatcher/detection.h
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/module.mk
    engines/snatcher/render.h
    engines/snatcher/render_scd.cpp
    engines/snatcher/resource.cpp
    engines/snatcher/resource.h
    engines/snatcher/scene/scene_d0.cpp
    engines/snatcher/scene/scene_d1.cpp
    engines/snatcher/scene/scene_d2.cpp
    engines/snatcher/scene_imp.h
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/sound.cpp
    engines/snatcher/sound.h
    engines/snatcher/sound_device.h
    engines/snatcher/sound_device_scd.cpp
    engines/snatcher/staticres.cpp
    engines/snatcher/staticres.h
    engines/snatcher/transition_scd.cpp
    graphics/segagfx.cpp


diff --git a/audio/softsynth/fmtowns_pc98/pcm_common.cpp b/audio/softsynth/fmtowns_pc98/pcm_common.cpp
index 25aa54f5482..d76bb5ad382 100644
--- a/audio/softsynth/fmtowns_pc98/pcm_common.cpp
+++ b/audio/softsynth/fmtowns_pc98/pcm_common.cpp
@@ -48,6 +48,7 @@ void PCMChannel_Base::updateOutput() {
 	_pos += _step;
 
 	if (_pos >= _dataEnd) {
+		dataEndHandler();
 		if (_loopStart != _dataEnd) {
 			_pos = _loopStart;
 			_dataEnd = _loopStart + _loopLen;
diff --git a/audio/softsynth/fmtowns_pc98/pcm_common.h b/audio/softsynth/fmtowns_pc98/pcm_common.h
index bf33767a938..626aa06b690 100644
--- a/audio/softsynth/fmtowns_pc98/pcm_common.h
+++ b/audio/softsynth/fmtowns_pc98/pcm_common.h
@@ -42,6 +42,7 @@ public:
 	bool isActive() const;
 	void activate();
 	void deactivate();
+	uint16 pos() const;
 
 protected:
 	void setData(const int8 *data, uint32 dataEnd, uint32 dataStart = 0);
@@ -52,6 +53,7 @@ protected:
 
 private:
 	virtual void stopInternal() = 0;
+	virtual void dataEndHandler() {}
 
 	uint8 _panLeft;
 	uint8 _panRight;
diff --git a/audio/softsynth/fmtowns_pc98/sega_audio.cpp b/audio/softsynth/fmtowns_pc98/sega_audio.cpp
index a8d59bddef9..0550acebce7 100644
--- a/audio/softsynth/fmtowns_pc98/sega_audio.cpp
+++ b/audio/softsynth/fmtowns_pc98/sega_audio.cpp
@@ -24,18 +24,30 @@
 #include "audio/softsynth/fmtowns_pc98/pcm_common.h"
 #include "common/mutex.h"
 
+
 class SegaPCMChannel final : public PCMChannel_Base {
 public:
-	SegaPCMChannel() : PCMChannel_Base(), _playing(false) {}
-	~SegaPCMChannel() override {}
+	SegaPCMChannel(SegaAudioInterfaceInternal *sai) : PCMChannel_Base(), _sai(sai), _playing(false), _stream(), _streamSamplesLeft(0), _streamFeedLen(0), _streamStartAddr(0), _streamTempBuff(nullptr) {}
+	~SegaPCMChannel() override;
 
-	void play(const int8 *data, uint16 dataSize, uint16 startAddress, uint16 loopStart, uint16 loopLen, uint16 pitch, uint8 pan, uint8 vol);
+	void play(const int8 *data, uint16 dataSize, uint16 startAddress, uint16 loopStart, uint16 loopLen, uint16 rate, uint8 pan, uint8 vol);
+	void playStream(Common::SharedPtr<Common::SeekableReadStream> &stream, const int8 *data, uint16 memAreaStartAddr, uint16 memAreaSize, uint16 rate, uint8 pan, uint8 vol);
 	void stop();
 	bool isPlaying() const override;
 
 private:
 	void stopInternal() override;
+	void dataEndHandler() override;
+	void feed();
 	bool _playing;
+
+	Common::SharedPtr<Common::SeekableReadStream> _stream;
+	uint8 *_streamTempBuff;
+	uint32 _streamSamplesLeft;
+	uint16 _streamStartAddr;
+	uint16 _streamFeedLen;
+	SegaAudioInterfaceInternal *_sai;
+	Common::Mutex _mutex2;
 };
 
 class SegaPSG {
@@ -91,8 +103,10 @@ public:
 	bool init() override;
 
 	void loadPCMData(uint16 address, const uint8 *data, uint16 dataLen);
-	void playPCMChannel(uint8 channel, uint8 dataStart, uint16 loopStart, uint16 pitch, uint8 pan, uint8 vol);
+	void playPCMChannel(uint8 channel, uint8 dataStart, uint16 loopStart, uint16 rate, uint8 pan, uint8 vol);
+	void playPCMStream(Common::SharedPtr<Common::SeekableReadStream> &stream, uint8 memStart, uint16 memAreaSize, uint8 channel, uint16 rate, uint8 pan, uint8 vol);
 	void stopPCMChannel(uint8 channel);
+	bool isPCMChannelPlaying(uint8 channel) const;
 
 	void psgWrite(uint8 data);
 
@@ -194,7 +208,7 @@ bool SegaAudioInterfaceInternal::init() {
 	_psgDev = new SegaPSG(7670454 / 72, 16);
 	_pcmDev = new PCMDevice_Base(33300, 16, 8);
 	for (int i = 0; i < 8; ++i) {
-		_pcmChan[i] = new SegaPCMChannel();
+		_pcmChan[i] = new SegaPCMChannel(this);
 		_pcmDev->assignChannel(i, _pcmChan[i]);
 	}
 
@@ -217,8 +231,19 @@ void SegaAudioInterfaceInternal::loadPCMData(uint16 address, const uint8 *data,
 	if (!_ready)
 		return;
 	Common::StackLock lock(_mutex);
-	while (dataSize--)
-		_pcmBanks[address++] = (*data & 0x80) ? (*data++ & 0x7F) : -*data++;
+	// According to the manual, 0 is the minimum, 127 the center and 253 the maximum. 255 is the stop marker.
+	// We take that into account when converting the samples to our signed internal format.
+	while (dataSize--) {
+		uint8 val = *data++;
+		if (val == 0xFF) {
+			_pcmBanks[address++] = -128; // We use -128 as the stop marker.
+		} else if (val == 0xFE) {
+			_pcmBanks[address++] = 126; // Shouldn't occur.
+		} else {
+			++val;
+			_pcmBanks[address++] = val & 0x80 ? val & 0x7F : -val;
+		}
+	}
 }
 
 void SegaAudioInterfaceInternal::playPCMChannel(uint8 channel, uint8 dataStart, uint16 loopStart, uint16 rate, uint8 pan, uint8 vol) {
@@ -229,6 +254,14 @@ void SegaAudioInterfaceInternal::playPCMChannel(uint8 channel, uint8 dataStart,
 	_pcmChan[channel]->play(_pcmBanks, pcmCountSamples(dataStart << 8), dataStart << 8, loopStart, pcmCountSamples(loopStart), rate, pan, vol);
 }
 
+void SegaAudioInterfaceInternal::playPCMStream(Common::SharedPtr<Common::SeekableReadStream> &stream, uint8 memStart, uint16 memAreaSize, uint8 channel, uint16 rate, uint8 pan, uint8 vol) {
+	if (!_ready)
+		return;
+	Common::StackLock lock(_mutex);
+	assert(channel < 8);
+	_pcmChan[channel]->playStream(stream, _pcmBanks, memStart << 8, memAreaSize, rate, pan, vol);
+}
+
 void SegaAudioInterfaceInternal::stopPCMChannel(uint8 channel) {
 	if (!_ready)
 		return;
@@ -237,6 +270,13 @@ void SegaAudioInterfaceInternal::stopPCMChannel(uint8 channel) {
 	_pcmChan[channel]->stop();
 }
 
+bool SegaAudioInterfaceInternal::isPCMChannelPlaying(uint8 channel) const {
+	if (!_ready)
+		return 0;
+	assert(channel < 8);
+	return _pcmChan[channel]->isPlaying();
+}
+
 void SegaAudioInterfaceInternal::psgWrite(uint8 data) {
 	if (!_ready)
 		return;
@@ -326,32 +366,74 @@ uint16 SegaAudioInterfaceInternal::pcmCountSamples(uint16 address) const {
 	const int8 *end = &_pcmBanks[0xFFFF];
 	const int8 *pos = start;
 	for (; pos <= end; ++pos) {
-		if (*pos == 0x7F)
+		if (*pos == -128)
 			break;
 	}
 	return pos - start;
 }
 
+SegaPCMChannel::~SegaPCMChannel() {
+	delete[] _streamTempBuff;
+}
+
 void SegaPCMChannel::play(const int8 *data, uint16 dataSize, uint16 startAddress, uint16 loopStart, uint16 loopLen, uint16 rate, uint8 pan, uint8 vol) {
 	setData(data, (startAddress + dataSize) << 11, startAddress << 11);
-	setupLoop(loopLen ? loopStart : (startAddress + dataSize), loopLen);
+	if (_streamTempBuff != nullptr)
+		setupLoop(loopLen ? loopStart : (startAddress + dataSize), loopLen);
 	setRate(rate);
 	setPanPos(pan);
 	setVolume(vol);
 	activate();
+	Common::StackLock lock(_mutex2);
 	_playing = true;
 }
 
+void SegaPCMChannel::playStream(Common::SharedPtr<Common::SeekableReadStream> &stream, const int8 *data, uint16 memAreaStartAddr, uint16 memAreaSize, uint16 rate, uint8 pan, uint8 vol) {
+	_stream = stream;
+	_streamSamplesLeft = stream->size();
+	_streamFeedLen = memAreaSize;
+	delete[] _streamTempBuff;
+	_streamTempBuff = new uint8[memAreaSize]();
+	_streamStartAddr = memAreaStartAddr;
+	feed();
+	play(data, memAreaSize, memAreaStartAddr, 0, 0, rate, pan, vol);
+}
+
 void SegaPCMChannel::stop() {
 	stopInternal();
 }
 
 bool SegaPCMChannel::isPlaying() const {
+	Common::StackLock lock(_mutex2);
 	return _playing;
 }
 
 void SegaPCMChannel::stopInternal() {
+	Common::StackLock lock(_mutex2);
 	_playing = false;
+	delete[] _streamTempBuff;
+	_streamTempBuff = nullptr;
+	_stream.reset();
+}
+
+void SegaPCMChannel::dataEndHandler() {
+	if (_stream.get() && _streamSamplesLeft)
+		feed();
+}
+
+void SegaPCMChannel::feed() {
+	uint32 readSize = MIN<uint32>(_streamFeedLen, _streamSamplesLeft);
+	if (readSize) {
+		_stream.get()->read(_streamTempBuff, readSize);
+		_streamSamplesLeft -= readSize;
+		_sai->loadPCMData(_streamStartAddr, _streamTempBuff, readSize);
+	} else {
+		delete[] _streamTempBuff;
+		_streamTempBuff = nullptr;
+		_stream.reset();
+	}
+	if (_playing)
+		setupLoop(_streamSamplesLeft ? _streamStartAddr : (_streamStartAddr + _streamFeedLen), readSize);
 }
 
 SegaPSG::SegaPSG(int samplingRate, int deviceVolume) : _intRate(3579545), _extRate(samplingRate), _deviceVolume(deviceVolume), _numChannels(3), _cr(-1),
@@ -450,10 +532,18 @@ void SegaAudioInterface::playPCMChannel(uint8 channel, uint8 dataStart, uint16 l
 	_internal->playPCMChannel(channel, dataStart, loopStart, rate, pan, vol);
 }
 
+void SegaAudioInterface::playPCMStream(Common::SharedPtr<Common::SeekableReadStream> &stream, uint8 memStart, uint16 memAreaSize, uint8 channel, uint16 rate, uint8 pan, uint8 vol) {
+	_internal->playPCMStream(stream, memStart, memAreaSize, channel, rate, pan, vol);
+}
+
 void SegaAudioInterface::stopPCMChannel(uint8 channel) {
 	_internal->stopPCMChannel(channel);
 }
 
+bool SegaAudioInterface::isPCMChannelPlaying(uint8 channel) const {
+	return _internal->isPCMChannelPlaying(channel);
+}
+
 void SegaAudioInterface::writeReg(uint8 part, uint8 regAddress, uint8 value) {
 	_internal->writeReg(part, regAddress, value);
 }
diff --git a/audio/softsynth/fmtowns_pc98/sega_audio.h b/audio/softsynth/fmtowns_pc98/sega_audio.h
index 0dd2e1d8424..bb162a902dd 100644
--- a/audio/softsynth/fmtowns_pc98/sega_audio.h
+++ b/audio/softsynth/fmtowns_pc98/sega_audio.h
@@ -22,7 +22,9 @@
 #ifndef SEGA_AUDIO_H
 #define SEGA_AUDIO_H
 
+#include "common/ptr.h"
 #include "common/scummsys.h"
+#include "common/stream.h"
 
 namespace Audio {
 class Mixer;
@@ -46,9 +48,20 @@ public:
 	void reset();
 
 	void loadPCMData(uint16 address, const uint8 *data, uint16 dataSize);
-	void playPCMChannel(uint8 channel, uint8 dataStart, uint16 loopStart, uint16 rate, uint8 pan, uint8 env);
+	void playPCMChannel(uint8 channel, uint8 dataStart, uint16 loopStart, uint16 rate, uint8 pan, uint8 vol);
 	void stopPCMChannel(uint8 channel);
+	// Convenience function. The chip only allows to read out the data position and derive the state from that.
+	// But this wouldn't work with our stream play function, since it requires tracking the stream state, too.
+	// So, we just return the data that we actually want...
+	bool isPCMChannelPlaying(uint8 channel) const;
 
+	// Convenience function, since it is so much easier to implement this on this level than having the samples buffer
+	// invoke a callback into the engine
+	// @ memstart: same 8-bit format as dataStart (in playPCMChannel), begin of the buffer in the PCM memory area
+	// @ memAreaSize: byte size of the buffer in the PCM memory area
+	void playPCMStream(Common::SharedPtr<Common::SeekableReadStream> &stream, uint8 memStart, uint16 memAreaSize, uint8 channel, uint16 rate, uint8 pan, uint8 vol);
+
+	// OPN registers
 	void writeReg(uint8 part, uint8 regAddress, uint8 value);
 	uint8 readReg(uint8 part, uint8 regAddress);
 
diff --git a/engines/snatcher/detection.h b/engines/snatcher/detection.h
index 8bf7780a8cf..3f6a83555d5 100644
--- a/engines/snatcher/detection.h
+++ b/engines/snatcher/detection.h
@@ -31,7 +31,7 @@ enum {
 };
 
 struct GameDescription {
-	byte gameID;
+	uint8 gameID;
 	int soundOptions;
 	Common::Language lang;
 	Common::Platform platform;
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 68c5f6fac66..d9ea37b4e08 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -113,7 +113,7 @@ void GraphicsEngine::setScrollStep(uint8 mode, int16 step) {
 		_trs->scroll_setSingleStep(mode & 3, step);
 }
 
-void GraphicsEngine::scrollCommand(uint8 cmd) {
+void GraphicsEngine::transitionCommand(uint8 cmd) {
 	_trs->doCommand(cmd);
 }
 
@@ -175,6 +175,10 @@ bool GraphicsEngine::isAnimEnabled(uint8 animObjId) const {
 	return _renderer->anim_isEnabled(animObjId);
 }
 
+void GraphicsEngine::gunTestAnimUpdate() {
+	_renderer->anim_gunTestUpdate();
+}
+
 uint16 GraphicsEngine::screenWidth() const {
 	return _renderer ? _renderer->screenWidth() : 0;
 }
@@ -191,6 +195,14 @@ bool GraphicsEngine::busy(int type) const {
 	return false;
 }
 
+uint16 GraphicsEngine::frameCount() const {
+	return _state.frameCount();
+}
+
+void GraphicsEngine::createMouseCursor(bool show) {
+	_renderer->createMouseCursor();
+}
+
 int GraphicsEngine::displayBootSequenceFrame(int frameNo) {
 	int res = _renderer->drawBootSequenceFrame(_screen, frameNo);
 	_system->copyRectToScreen(_screen, _renderer->screenWidth() * _bpp, 0, 0, _renderer->screenWidth(), _renderer->screenHeight());
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 2a908726db8..cec6d7e61c2 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -58,7 +58,7 @@ public:
 	};
 
 	void setScrollStep(uint8 mode, int16 step);
-	void scrollCommand(uint8 cmd);
+	void transitionCommand(uint8 cmd);
 
 	void updateAnimations();
 	void nextFrame();
@@ -90,10 +90,15 @@ public:
 	uint16 getAnimCurFrame(uint8 animObjId) const;
 	bool isAnimEnabled(uint8 animObjId) const;
 
+	void gunTestAnimUpdate();
+
 	uint16 screenWidth() const;
 	uint16 screenHeight() const;
 
 	bool busy(int type) const;
+	uint16 frameCount() const;
+
+	void createMouseCursor(bool show);
 
 	int displayBootSequenceFrame(int frameNo);
 
@@ -160,7 +165,7 @@ private:
 	uint8 _dataMode;
 	uint8 _flags;
 
-	byte *_screen;
+	uint8 *_screen;
 	Renderer *_renderer;
 	Palette *_palette;
 	TransitionManager *_trs;
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index bcdb66d2cfc..cd56ae71552 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -12,7 +12,7 @@ MODULE_OBJS := \
 	snatcher.o \
 	sound.o \
 	sound_device_scd.o \
-	statires.o \
+	staticres.o \
 	transition_scd.o \
 	util.o
 
diff --git a/engines/snatcher/render.h b/engines/snatcher/render.h
index 8ddbc02d49a..c16a218c9b2 100644
--- a/engines/snatcher/render.h
+++ b/engines/snatcher/render.h
@@ -48,10 +48,16 @@ public:
 	virtual void anim_setFrame(uint8 animObjId, uint16 frameNo) = 0;
 	virtual uint16 anim_getCurFrameNo(uint8 animObjId) const = 0;
 	virtual bool anim_isEnabled(uint8 animObjId) const = 0;
+	virtual void anim_gunTestUpdate() = 0;
 
 	virtual uint16 screenWidth() const = 0;
 	virtual uint16 screenHeight() const = 0;
 
+	// The original game does not have mouse control on any platform. But
+	// the Sega CD version supports a lightgun. So we do have some fundamentals
+	// on which we can set this this up...
+	virtual void createMouseCursor() = 0;
+
 	// This is special code from the CD-ROM boot sectors that does not
 	// share anything with the rest of the game. So it makes sense to
 	// keep it separate.
diff --git a/engines/snatcher/render_scd.cpp b/engines/snatcher/render_scd.cpp
index 902fcb73606..6aeed8baa44 100644
--- a/engines/snatcher/render_scd.cpp
+++ b/engines/snatcher/render_scd.cpp
@@ -38,8 +38,8 @@ namespace Snatcher {
 //#define		ANIM_DEBUG
 
 struct AnimObject {
-	AnimObject(int num) : id(num), enable(0), fadeLevel(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), f16(0), f18(0), f1c(0), timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0), res(), scriptData(), spriteData(0), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), f4e(0), f4f(0) {}
-
+	AnimObject(int num) : id(num), enable(0), fadeLevel(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), f16(0), f18(0), f1c(0), timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0), res(), scriptData(), spriteData(0), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), f4e(0), f4f(0), f3a(0), f3c(0), f3e(0) {}
+	
 	void clear() {
 		enable = fadeLevel = drawFlags = 0;
 		posX = posY = 0;
@@ -59,6 +59,7 @@ struct AnimObject {
 		absSpeedX = absSpeedY = 0;
 		parent = children = next = 0;
 		f4e = f4f = 0;
+		f3a = f3c = f3e = 0;
 	}
 
 	uint16 enable;
@@ -81,12 +82,13 @@ struct AnimObject {
 	int16 frameDelay;
 	uint8 f2c;
 	uint8 f2d;
-
 	uint32 spriteTableLocation;
 	ResourcePointer res;
 	ResourcePointer scriptData;
 	const uint16 *spriteData;
-
+	uint16 f3a;
+	uint16 f3c;
+	uint16 f3e;
 	int32 absSpeedX;
 	int32 absSpeedY;
 	uint16 parent;
@@ -121,10 +123,13 @@ public:
 	void anim_setFrame(uint8 animObjId, uint16 frameNo) override;
 	uint16 anim_getCurFrameNo(uint8 animObjId) const override;
 	bool anim_isEnabled(uint8 animObjId) const override;
+	void anim_gunTestUpdate() override;
 
 	uint16 screenWidth() const override { return _screenWidth; }
 	uint16 screenHeight() const override { return _screenHeight; }
 
+	void createMouseCursor() override;
+
 	void hINTCallback(Graphics::SegaRenderer *sr) override;
 
 private:
@@ -487,6 +492,23 @@ bool Renderer_SCD::anim_isEnabled(uint8 animObjId) const {
 	return _animations[animObjId]->enable != 0;
 }
 
+void Renderer_SCD::anim_gunTestUpdate() {
+	for (int i = 0; i < 3; ++i) {
+		AnimObject &a = *_animations[17 + i];
+		a.controlFlags = GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide;
+		if (a.absSpeedX)
+			a.controlFlags = GraphicsEngine::kAnimPause;
+		if (a.f3a == 1) {
+			if (++a.f3c >= 16) {
+				a.f3c = 0;
+				a.absSpeedX ^= 0x100;
+				if (++a.f3e >= 6)
+					a.f3a = 0;
+			}
+		}
+	}
+}
+
 void Renderer_SCD::hINTCallback(Graphics::SegaRenderer *sr) {
 	if (_pal)
 		_pal->hINTCallback(sr);
@@ -518,7 +540,7 @@ void Renderer_SCD::loadDataFromGfxScript() {
 		return;
 	}
 
-	const byte *src = _transferData.makeAbsPtr(_transferData.readIncrUINT32() & 0xFFFFFF)();
+	const uint8 *src = _transferData.makeAbsPtr(_transferData.readIncrUINT32() & 0xFFFFFF)();
 	_transferDelay = _transferData.readIncrUINT16();
 	uint16 addr = _transferData.readIncrUINT16();
 
@@ -1100,7 +1122,7 @@ int Renderer_SCD::anim_36(AnimObject &a, const uint8 *data) {
 
 int Renderer_SCD::anim_37(AnimObject &a, const uint8 *data) {
 	static const uint8 cmd[] = { 0x25, 0x00 };
-	ResourcePointer r(data, 0);
+	ResourcePointer r(cmd, 0);
 	enqueueDrawCommands(r);
 	return 1;
 }
@@ -1202,6 +1224,12 @@ void Renderer_SCD::anim_setGroupParameter(AnimObject &a, int para, int16 val, bo
 	}
 }
 
+void Renderer_SCD::createMouseCursor() {
+	// This will obviously only work when the necessary animation has been loaded.
+	anim_setControlFlags(16, GraphicsEngine::kAnimPause);
+	//_sr->renderSprites(
+}
+
 // Boot logo sequence code. This has nothing to do with the engine graphics code, so I put it at the end, to keep the ugly mess out of sight...
 int Renderer_SCD::drawBootSequenceFrame(uint8 *screen, int frameNo)  {
 	uint16 *tmp = reinterpret_cast<uint16*>(_tempBuffer);
diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index 951c639e41f..b443dc16bde 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -57,16 +57,11 @@ FIO::~FIO() {
 }
 
 SceneModule *FIO::loadModule(int index) {
-	return (index >= 0 && index < _resFileListSize)  ? new SceneModule(_vm, this, _resFileList[index], index) : 0;
+	return (index >= 0 && index < _resFileListSize) ? new SceneModule(_vm, this, _resFileList[index], index) : 0;
 }
 
-Common::SeekableReadStream *FIO::readStream(const Common::Path &file) {
-	return _files.createReadStreamForMember(file);
-}
-
-Common::SeekableReadStreamEndian *FIO::readStreamEndian(const Common::Path &file, EndianMode em) {
-	Common::SeekableReadStream *stream = readStream(file);
-	return stream ? new EndianWrapper(stream, (em == kForceBE) ? true : (em == kForceLE ? false : _bigEndianTarget)) : 0;
+const uint8 *FIO::fileData(int index, uint32 *fileSize) {
+	return (index >= 0 && index < _resFileListSize) ? fileData(_resFileList[index], fileSize) : nullptr;
 }
 
 uint8 *FIO::fileData(const Common::Path &file, uint32 *fileSize) {
@@ -76,8 +71,10 @@ uint8 *FIO::fileData(const Common::Path &file, uint32 *fileSize) {
 	if (fileSize)
 		*fileSize = size;
 
-	if (!s)
-		return 0;
+	if (!s) {
+		warning("%s(): Unable to open file %s", file.baseName().c_str());
+		return nullptr;
+	}
 
 	uint8 *data = new uint8[size];
 	s->read(data, size);
@@ -86,6 +83,23 @@ uint8 *FIO::fileData(const Common::Path &file, uint32 *fileSize) {
 	return data;
 }
 
+Common::SeekableReadStream *FIO::readStream(int index) {
+	return (index >= 0 && index < _resFileListSize) ? readStream(_resFileList[index]) : nullptr;
+}
+
+Common::SeekableReadStream *FIO::readStream(const Common::Path &file) {
+	return _files.createReadStreamForMember(file);
+}
+
+Common::SeekableReadStreamEndian *FIO::readStreamEndian(int index, EndianMode em) {
+	return (index >= 0 && index < _resFileListSize) ? readStreamEndian(_resFileList[index], em) : nullptr;
+}
+
+Common::SeekableReadStreamEndian *FIO::readStreamEndian(const Common::Path &file, EndianMode em) {
+	Common::SeekableReadStream *stream = readStream(file);
+	return stream ? new EndianWrapper(stream, (em == kForceBE) ? true : (em == kForceLE ? false : _bigEndianTarget)) : nullptr;
+}
+
 const char *FIO::_resFileList[97] = {
 	"DATA_A0.BIN",	"DATA_B0.BIN",	"DATA_D0.BIN",	"DATA_D1.BIN",	"DATA_D2.BIN",	"DATA_F0.BIN",	"DATA_F4.BIN",	"DATA_G0.BIN",
 	"DATA_H00.BIN",	"DATA_H01.BIN",	"DATA_H02.BIN",	"DATA_H03.BIN",	"DATA_H04.BIN",	"DATA_H05.BIN",	"DATA_H06.BIN",	"DATA_H07.BIN",
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index e148c0a5baf..941604b4c1a 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -25,6 +25,7 @@
 #include "common/endian.h"
 #include "common/fs.h"
 #include "common/func.h"
+#include "common/rect.h"
 #include "common/scummsys.h"
 #include "common/str.h"
 
@@ -39,7 +40,23 @@ class SnatcherEngine;
 class SceneModule;
 class FIO;
 
+struct Config {
+	Config() : volumeMusic(0), volumeSFX(0), volumeSpeech(0), lightGunAvailable(1), useLightGun(0), controllerSetup(0), disableStereo(0), hasRAMCart(1), hasFreeBuram(1), lightGunBias() {}
+	int16 volumeMusic;
+	int16 volumeSFX;
+	int16 volumeSpeech;
+	int16 lightGunAvailable;
+	int16 useLightGun;
+	int16 controllerSetup;
+	int16 disableStereo;
+	int16 hasRAMCart;
+	int16 hasFreeBuram;
+	Common::Point lightGunBias;
+};
+
 struct GameState {
+	GameState() : frameNo(0), frameState(0), finish(0), modProcessTop(0), modProcessSub(0), counter(0), modIndex(0), menuSelect(0),
+				  main_switch_1_0_orM1_postIntr(-1), topLevelState(0), conf(Config()) {}
 	int16 frameNo;
 	int16 frameState;
 	int16 finish;
@@ -50,6 +67,7 @@ struct GameState {
 	int16 menuSelect;
 	int16 main_switch_1_0_orM1_postIntr;
 	int16 topLevelState;
+	Config conf;
 };
 
 class SceneHandler {
@@ -120,21 +138,23 @@ public:
 	FIO(SnatcherEngine *vm, bool isBigEndian);
 	~FIO();
 
-	SceneModule *loadModule(int index);
-
 	enum EndianMode {
 		kPlatformEndianness = 0,
 		kForceLE,
 		kForceBE
 	};
 
+	SceneModule *loadModule(int index);
+	const uint8 *fileData(int index, uint32 *fileSize);
+	uint8 *fileData(const Common::Path &file, uint32 *fileSize);
+	Common::SeekableReadStream *readStream(int index);
 	Common::SeekableReadStream *readStream(const Common::Path &file);
+	Common::SeekableReadStreamEndian *readStreamEndian(int index, EndianMode em = kPlatformEndianness);
 	Common::SeekableReadStreamEndian *readStreamEndian(const Common::Path &file, EndianMode em = kPlatformEndianness);
-	uint8 *fileData(const Common::Path &file, uint32 *fileSize);
+	
 
 private:
 	Common::SearchSet _files;
-
 	SnatcherEngine *_vm;
 	bool _bigEndianTarget;
 
diff --git a/engines/snatcher/scene/scene_d0.cpp b/engines/snatcher/scene/scene_d0.cpp
index b7dd7bf6257..348e5f53f2d 100644
--- a/engines/snatcher/scene/scene_d0.cpp
+++ b/engines/snatcher/scene/scene_d0.cpp
@@ -61,41 +61,41 @@ const uint32 *_timeStamp;
 SH_HEAD_END(D0)
 
 SH_IMP_FRMTBL(D0) {
-	SH_FRM(00),
-	SH_FRM(01),
-	SH_FRM(02),
-	SH_FRM(03),
-	SH_FRM(04),
-	SH_FRM(05),
-	SH_FRM(01),
-	SH_FRM(07),
-	SH_FRM(08),
-	SH_FRM(09),
-	SH_FRM(10),
-	SH_FRM(11),
-	SH_FRM(12),
-	SH_FRM(08),
-	SH_FRM(14),
-	SH_FRM(08),
-	SH_FRM(16),
-	SH_FRM(08),
-	SH_FRM(18),
-	SH_FRM(08),
-	SH_FRM(20),
-	SH_FRM(08),
-	SH_FRM(22),
-	SH_FRM(08),
-	SH_FRM(24),
-	SH_FRM(08),
-	SH_FRM(26),
-	SH_FRM(08),
-	SH_FRM(28),
-	SH_FRM(08),
-	SH_FRM(30),
-	SH_FRM(31),
-	SH_FRM(32),
-	SH_FRM(01),
-	SH_FRM(34)
+	SH_FRM(D0, 00),
+	SH_FRM(D0, 01),
+	SH_FRM(D0, 02),
+	SH_FRM(D0, 03),
+	SH_FRM(D0, 04),
+	SH_FRM(D0, 05),
+	SH_FRM(D0, 01),
+	SH_FRM(D0, 07),
+	SH_FRM(D0, 08),
+	SH_FRM(D0, 09),
+	SH_FRM(D0, 10),
+	SH_FRM(D0, 11),
+	SH_FRM(D0, 12),
+	SH_FRM(D0, 08),
+	SH_FRM(D0, 14),
+	SH_FRM(D0, 08),
+	SH_FRM(D0, 16),
+	SH_FRM(D0, 08),
+	SH_FRM(D0, 18),
+	SH_FRM(D0, 08),
+	SH_FRM(D0, 20),
+	SH_FRM(D0, 08),
+	SH_FRM(D0, 22),
+	SH_FRM(D0, 08),
+	SH_FRM(D0, 24),
+	SH_FRM(D0, 08),
+	SH_FRM(D0, 26),
+	SH_FRM(D0, 08),
+	SH_FRM(D0, 28),
+	SH_FRM(D0, 08),
+	SH_FRM(D0, 30),
+	SH_FRM(D0, 31),
+	SH_FRM(D0, 32),
+	SH_FRM(D0, 01),
+	SH_FRM(D0, 34)
 };
 
 SH_IMP_CTOR(D0) {
@@ -118,9 +118,9 @@ SH_IMP_DTOR(D0)	{
 SH_IMPL_UPDT(D0) {
 	if (state.frameNo == -1) {
 		if (state.frameState == 0) {
-			_vm->sound()->musicPlay(5);
+			_vm->sound()->cdaPlay(5);
 			++state.frameState;
-		} else if (_vm->sound()->musicIsPlaying()) {
+		} else if (_vm->sound()->cdaIsPlaying()) {
 			state.frameNo = 0;
 			state.frameState = 0;
 		}
@@ -129,10 +129,10 @@ SH_IMPL_UPDT(D0) {
 
 	if (state.frameNo >= (int)_frameProcs.size() || !_frameProcs[state.frameNo]->isValid()) {
 		error("%s(): Invalid call to frame proc %d", __FUNCTION__, state.frameNo);
-	} else if (_vm->sound()->musicGetTime() >= _timeStamp[state.frameNo]) {
+	} else if (_vm->sound()->cdaGetTime() >= _timeStamp[state.frameNo]) {
 		(*_frameProcs[state.frameNo])(state);
 		++state.frameNo;
-	} else if (_vm->inputFlag() & 0x80) {
+	} else if (_vm->input().controllerFlags & 0x80) {
 		state.finish = -1;
 		state.frameNo = 0;
 	}
@@ -152,12 +152,12 @@ SH_IMPL_FRM(D0, 02) {
 }
 
 SH_IMPL_FRM(D0, 03) {
-	_vm->sound()->musicPlay(4);
+	_vm->sound()->cdaPlay(4);
 }
 
 SH_IMPL_FRM(D0, 04) {
 	--state.frameNo;
-	if (_vm->sound()->musicIsPlaying()) {
+	if (_vm->sound()->cdaIsPlaying()) {
 		++state.frameNo;
 		state.frameState = 0;
 	}
diff --git a/engines/snatcher/scene/scene_d1.cpp b/engines/snatcher/scene/scene_d1.cpp
index 1fada80d1a2..fd7af40d676 100644
--- a/engines/snatcher/scene/scene_d1.cpp
+++ b/engines/snatcher/scene/scene_d1.cpp
@@ -57,35 +57,35 @@ const uint32 *_timeStamp;
 SH_HEAD_END(D1)
 
 SH_IMP_FRMTBL(D1) {
-	SH_FRM(00),
-	SH_FRM(01),
-	SH_FRM(02),
-	SH_FRM(01),
-	SH_FRM(04),
-	SH_FRM(05),
-	SH_FRM(06),
-	SH_FRM(07),
-	SH_FRM(08),
-	SH_FRM(09),
-	SH_FRM(01),
-	SH_FRM(11),
-	SH_FRM(01),
-	SH_FRM(13),
-	SH_FRM(01),
-	SH_FRM(15),
-	SH_FRM(01),
-	SH_FRM(17),
-	SH_FRM(01),
-	SH_FRM(19),
-	SH_FRM(01),
-	SH_FRM(21),
-	SH_FRM(22),
-	SH_FRM(23),
-	SH_FRM(22),
-	SH_FRM(25),
-	SH_FRM(22),
-	SH_FRM(27),
-	SH_FRM(28)
+	SH_FRM(D1, 00),
+	SH_FRM(D1, 01),
+	SH_FRM(D1, 02),
+	SH_FRM(D1, 01),
+	SH_FRM(D1, 04),
+	SH_FRM(D1, 05),
+	SH_FRM(D1, 06),
+	SH_FRM(D1, 07),
+	SH_FRM(D1, 08),
+	SH_FRM(D1, 09),
+	SH_FRM(D1, 01),
+	SH_FRM(D1, 11),
+	SH_FRM(D1, 01),
+	SH_FRM(D1, 13),
+	SH_FRM(D1, 01),
+	SH_FRM(D1, 15),
+	SH_FRM(D1, 01),
+	SH_FRM(D1, 17),
+	SH_FRM(D1, 01),
+	SH_FRM(D1, 19),
+	SH_FRM(D1, 01),
+	SH_FRM(D1, 21),
+	SH_FRM(D1, 22),
+	SH_FRM(D1, 23),
+	SH_FRM(D1, 22),
+	SH_FRM(D1, 25),
+	SH_FRM(D1, 22),
+	SH_FRM(D1, 27),
+	SH_FRM(D1, 28)
 };
 
 SH_IMP_CTOR(D1) {
@@ -108,9 +108,9 @@ SH_IMP_DTOR(D1)	{
 SH_IMPL_UPDT(D1) {
 	if (state.frameNo == -1) {
 		if (state.frameState == 0) {
-			_vm->sound()->musicPlay(3);
+			_vm->sound()->cdaPlay(3);
 			++state.frameState;
-		} else if (_vm->sound()->musicIsPlaying()) {
+		} else if (_vm->sound()->cdaIsPlaying()) {
 			state.frameNo = 0;
 			state.frameState = 0;
 		}
@@ -119,10 +119,10 @@ SH_IMPL_UPDT(D1) {
 
 	if (state.frameNo >= (int)_frameProcs.size() || !_frameProcs[state.frameNo]->isValid()) {
 		error("%s(): Invalid call to frame proc %d", __FUNCTION__, state.frameNo);
-	} else if (_vm->sound()->musicGetTime() >= _timeStamp[state.frameNo]) {
+	} else if (_vm->sound()->cdaGetTime() >= _timeStamp[state.frameNo]) {
 		(*_frameProcs[state.frameNo])(state);
 		++state.frameNo;
-	} else if (_vm->inputFlag() & 0x80) {
+	} else if (_vm->input().controllerFlags & 0x80) {
 		state.finish = -1;
 		state.frameNo = 0;
 	}
@@ -146,27 +146,27 @@ SH_IMPL_FRM(D1, 04) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->runScript(_module->getPtr(0), 2);
 	_vm->gfx()->setScrollStep(GraphicsEngine::kVertA | GraphicsEngine::kSingleStep, 0x110);
-	_vm->gfx()->scrollCommand(1);
+	_vm->gfx()->transitionCommand(1);
 }
 
 SH_IMPL_FRM(D1, 05) {
-	_vm->gfx()->scrollCommand(8);
+	_vm->gfx()->transitionCommand(8);
 }
 
 SH_IMPL_FRM(D1, 06) {
-	_vm->gfx()->scrollCommand(9);
+	_vm->gfx()->transitionCommand(9);
 }
 
 SH_IMPL_FRM(D1, 07) {
-	_vm->gfx()->scrollCommand(10);
+	_vm->gfx()->transitionCommand(10);
 }
 
 SH_IMPL_FRM(D1, 08) {
-	_vm->gfx()->scrollCommand(11);
+	_vm->gfx()->transitionCommand(11);
 }
 
 SH_IMPL_FRM(D1, 09) {
-	_vm->gfx()->scrollCommand(12);
+	_vm->gfx()->transitionCommand(12);
 }
 
 SH_IMPL_FRM(D1, 11) {
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene/scene_d2.cpp
index 3d198e091c7..54bd50573b2 100644
--- a/engines/snatcher/scene/scene_d2.cpp
+++ b/engines/snatcher/scene/scene_d2.cpp
@@ -46,27 +46,28 @@ SH_DCL_FRM(12)
 
 // local vars
 int16 _option;
+uint16 _counter2;
 bool _loadCancelled;
 
 SH_HEAD_END(D2)
 
 SH_IMP_FRMTBL(D2) {
-	SH_FRM(00),
-	SH_FRM(01),
-	SH_FRM(02),
-	SH_FRM(03),
-	SH_FRM(04),
-	SH_FRM(05),
-	SH_FRM(06),
-	SH_FRM(07),
-	SH_FRM(08),
-	SH_FRM(09),
-	SH_FRM(10),
-	SH_FRM(11),
-	SH_FRM(12)
+	SH_FRM(D2, 00),
+	SH_FRM(D2, 01),
+	SH_FRM(D2, 02),
+	SH_FRM(D2, 03),
+	SH_FRM(D2, 04),
+	SH_FRM(D2, 05),
+	SH_FRM(D2, 06),
+	SH_FRM(D2, 07),
+	SH_FRM(D2, 08),
+	SH_FRM(D2, 09),
+	SH_FRM(D2, 10),
+	SH_FRM(D2, 11),
+	SH_FRM(D2, 12)
 };
 
-SH_IMP_CTOR(D2), _option(0), _loadCancelled(false) {
+SH_IMP_CTOR(D2), _option(0), _counter2(0), _loadCancelled(false) {
 	SH_CTOR_MAKEPROCS(D2);
 }
 
@@ -81,30 +82,24 @@ SH_IMPL_UPDT(D2) {
 		(*_frameProcs[state.frameNo])(state);
 }
 
-bool hasRAMCart = true; 
-int _state_ua_1 = 0;
 int _hasSaveSlotFlag = 15;
 int _saveFileCurID = 0;
-bool hasFreeBuram = true;
 uint8 _bua3 = 0;
 uint8 _buram_0 = 0;
 bool _buram_2 = true;
 
-int16 _sceneState_ua_2 = 0;
-int16 _sceneState_ua_3 = 0;
-
 // functions
 SH_IMPL_FRM(D2, 00) {
 	switch (state.frameState) {
 	case 0:
-		//enqueueCommunicationStatus2Command(_state_ua_1 ? 0xF3 : 0xF4, 0);
-		_vm->sound()->pcmDoCommand(_state_ua_1 ? 0xFC : 0xFD, -1);
+		_vm->sound()->fmSendCommand(state.conf.disableStereo ? 243 : 244, 0);
+		_vm->sound()->pcmSendCommand(state.conf.disableStereo ? 252 : 253, -1);
 		//_d2state = 0;
 		//buramCheck();
 		++state.frameState;
 		break;
 	case 1:
-		if (hasRAMCart) {
+		if (state.conf.hasRAMCart) {
 			++state.frameNo;
 			state.frameState = 0;
 		} else {
@@ -114,11 +109,11 @@ SH_IMPL_FRM(D2, 00) {
 		}
 		break;
 	case 2:
-		if (_vm->inputFlag() & 3) {
+		if (_vm->input().controllerFlags & 3) {
 			_vm->gfx()->clearAnimControlFlags(16, ~GraphicsEngine::kAnimHide);
 			_buram_0 ^= 1;
 		}
-		if (_vm->inputFlag() & 0x80) {
+		if (_vm->input().controllerFlags & 0x80) {
 			state.counter = 10;
 			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
 			++state.frameState;
@@ -128,7 +123,7 @@ SH_IMPL_FRM(D2, 00) {
 		if (--state.counter)
 			return;
 		if (_buram_0)
-			hasRAMCart = _buram_2;
+			state.conf.hasRAMCart = _buram_2;
 		++state.frameNo;
 		state.frameState = 0;
 		break;
@@ -137,9 +132,9 @@ SH_IMPL_FRM(D2, 00) {
 
 SH_IMPL_FRM(D2, 01) {
 	if (!state.frameState) {
-		_vm->sound()->musicPlay(2);
+		_vm->sound()->cdaPlay(2);
 		++state.frameState;
-	} else if (_vm->sound()->musicIsPlaying()) {
+	} else if (_vm->sound()->cdaIsPlaying()) {
 		++state.frameNo;
 		state.frameState = 0;
 	}	
@@ -147,7 +142,7 @@ SH_IMPL_FRM(D2, 01) {
 
 SH_IMPL_FRM(D2, 02) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->scrollCommand(1);
+	_vm->gfx()->transitionCommand(1);
 	_vm->gfx()->setScrollStep(GraphicsEngine::kVertA | GraphicsEngine::kSingleStep, 0x100);
 	_vm->gfx()->runScript(_module->getPtr(0), 0);
 	state.counter = 24;
@@ -158,7 +153,7 @@ SH_IMPL_FRM(D2, 02) {
 SH_IMPL_FRM(D2, 03) {
 	if (--state.counter)
 		return;
-	_vm->gfx()->scrollCommand(7);
+	_vm->gfx()->transitionCommand(7);
 	state.counter = 4;
 	++state.frameNo;
 	state.frameState = 0;
@@ -183,7 +178,7 @@ SH_IMPL_FRM(D2, 05) {
 SH_IMPL_FRM(D2, 06) {
 	switch (state.frameState) {
 	case 0:
-		if (hasRAMCart) {
+		if (state.conf.hasRAMCart) {
 			++state.frameNo;
 			state.frameState = 0;
 		} else {
@@ -228,7 +223,7 @@ SH_IMPL_FRM(D2, 08) {
 		++state.frameState;
 		break;
 	case 1:
-		if (hasFreeBuram) {
+		if (state.conf.hasFreeBuram) {
 			++state.frameNo;
 			state.frameState = 0;
 		} else {
@@ -255,14 +250,14 @@ SH_IMPL_FRM(D2, 09) {
 	bool fin = false;
 	switch (state.frameState) {
 	case 0:
-		_vm->gfx()->scrollCommand(0xFF);
+		_vm->gfx()->transitionCommand(0xFF);
 		_vm->gfx()->clearAnimControlFlags(_hasSaveSlotFlag ? 17 : 16, ~GraphicsEngine::kAnimHide);
 		state.frameState += (_hasSaveSlotFlag ? 1 : 2);
 		break;
 	case 1:
-		if (_vm->inputFlag() & 3)
+		if (_vm->input().controllerFlags & 3)
 			_vm->gfx()->clearAnimControlFlags(17, ~GraphicsEngine::kAnimHide);
-		if (_vm->inputFlag() & 0x80) {
+		if (_vm->input().controllerFlags & 0x80) {
 			_vm->gfx()->setAnimControlFlags(17, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 			state.menuSelect = 1;
 			if (_vm->gfx()->getAnimCurFrame(17) == 3) {
@@ -273,7 +268,7 @@ SH_IMPL_FRM(D2, 09) {
 		}
 		break;
 	default:
-		if (_vm->inputFlag() & 0x80) {
+		if (_vm->input().controllerFlags & 0x80) {
 			++state.frameNo;
 			state.frameState = 0;
 			fin = true;
@@ -284,7 +279,7 @@ SH_IMPL_FRM(D2, 09) {
 		++state.frameNo;
 		state.frameState = 0;
 		_bua3 = 56;
-		//enqueueCommunicationStatus2Command(0);
+		_vm->sound()->fmSendCommand(56, 0);
 		_vm->gfx()->setAnimControlFlags(16, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 		_vm->gfx()->setAnimControlFlags(17, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 		_option = 0;
@@ -310,9 +305,9 @@ SH_IMPL_FRM(D2, 10) {
 		
 
 		do {
-			if (_vm->inputFlag() & 1)
+			if (_vm->input().controllerFlags & 1)
 				--_saveFileCurID;
-			if (_vm->inputFlag() & 2)
+			if (_vm->input().controllerFlags & 2)
 				++_saveFileCurID;
 			_saveFileCurID &= 3;
 		} while (!(_hasSaveSlotFlag & (1 << _saveFileCurID)));
@@ -320,11 +315,13 @@ SH_IMPL_FRM(D2, 10) {
 		_vm->gfx()->setAnimFrame(24, _saveFileCurID << 2);
 		_vm->gfx()->setAnimFrame(25, _saveFileCurID << 2);
 
-		if (_vm->inputFlag() & 0x80) {
-			_loadCancelled = 0;
+		if (_vm->input().controllerFlags & 0x80) {
+			_bua3 = 56;
+			_vm->sound()->fmSendCommand(56, 0);
+			_loadCancelled = false;
 			fin = true;
-		} else if (_vm->inputFlag() & 0x10) {
-			_loadCancelled = 1;
+		} else if (_vm->input().controllerFlags & 0x10) {
+			_loadCancelled = true;
 			fin = true;
 		}
 		if (fin) {
@@ -382,29 +379,46 @@ SH_IMPL_FRM(D2, 11) {
 			_vm->gfx()->clearAnimControlFlags(i, 0xFF);
 
 		do {
-		if (_vm->inputFlag() & 1)
+		if (_vm->input().controllerFlags & 1)
 			--_option;
-		if (_vm->inputFlag() & 2)
+		if (_vm->input().controllerFlags & 2)
 			++_option;
 		_option = (_option + 5) % 5;
 
-		} while (_option == 3 && !_sceneState_ua_2);
+		} while (_option == 3 && !state.conf.useLightGun);
+
+		if (!state.conf.lightGunAvailable) {
+			state.conf.useLightGun = 0;
+			if (_option == 3)
+				_option = 4;
+		}
 
-		//sub11_0_Do_sub_28F9C();
-		//sub11_0_dd();
+		if (_option == 0) {
+			if (state.conf.lightGunAvailable && _vm->input().controllerFlags & 0x0C)
+				state.conf.useLightGun ^= 1;
+		} else if (_option == 1) {
+			if (_vm->input().controllerFlags & 8)
+				++state.conf.controllerSetup;
+			if (_vm->input().controllerFlags & 4)
+				--state.conf.controllerSetup;
+			state.conf.controllerSetup = (state.conf.controllerSetup + 5) % 5;
+		} else if (_option == 2) {
+			if (_vm->input().controllerFlags & 0x0C)
+				state.conf.disableStereo ^= 1;
+		}		
 
 		_vm->gfx()->setAnimFrame(32, _option << 2);
-		_vm->gfx()->setAnimFrame(33, ((_option ? 2 : 0) + _sceneState_ua_2) << 1);
-		_vm->gfx()->setAnimFrame(36, _sceneState_ua_2 & 2);
-		_vm->gfx()->setAnimFrame(34, ((_option != 1 ? 6 : 0) + _sceneState_ua_3) << 1);
-		_vm->gfx()->setAnimFrame(35, ((_option != 2 ? 2 : 0) + _state_ua_1) << 1);
+		_vm->gfx()->setAnimFrame(33, ((_option ? 2 : 0) + state.conf.useLightGun) << 1);
+		_vm->gfx()->setAnimFrame(36, state.conf.useLightGun << 1);
+		_vm->gfx()->setAnimFrame(34, ((_option != 1 ? 6 : 0) + state.conf.controllerSetup) << 1);
+		_vm->gfx()->setAnimFrame(35, ((_option != 2 ? 2 : 0) + state.conf.disableStereo) << 1);
 		
-		if (_vm->inputFlag() & 0x80)
+		if (_vm->input().controllerFlags & 0x80)
 			fin = (_option != 3) ? 1 : 3;
-		else if (_vm->inputFlag() & 0x70)
+		else if (_vm->input().controllerFlags & 0x70)
 			fin = (_option == 4) ? 1 : (_option == 3 ? 3 : 0);
 		if (fin) {
-			_vm->sound()->pcmDoCommand(55 + fin, -1);
+			_vm->sound()->pcmSendCommand(55 + fin, -1);
 			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x290F2));
 			state.counter = 10;
 			if (fin == 1) {
@@ -424,11 +438,23 @@ SH_IMPL_FRM(D2, 11) {
 		break;
 	case 2:
 		state.counter  = 0;
-		//
+		_counter2 = 0;
+		_vm->gfx()->setAnimControlFlags(16, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+		_vm->gfx()->setAnimFrame(16, 0);
+		_vm->gfx()->setAnimFrame(17, 0);
+		_vm->gfx()->setAnimFrame(18, 0);
+		_vm->gfx()->setAnimFrame(19, 0);
+		//anim17 3a:0
+		//anim17 absSpeedX:0
+		//anim18 3a:0
+		//anim18 absSpeedX:0
+		//anim19 3a:0
+		//anim19 absSpeedX:0
+
 		++state.frameState;
 		break;
 	case 3:
-		if (_vm->inputFlag() & 0x80) {
+		if (_vm->input().controllerFlags & 0x80) {
 			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
 			state.counter = 10;
 			state.frameState = 0;
@@ -436,16 +462,28 @@ SH_IMPL_FRM(D2, 11) {
 			return;
 		}
 
-		//animDo:sub_2985E
+		_vm->gfx()->gunTestAnimUpdate();
 
 		switch (state.counter) {
 		case 0:
-			++state.counter;
+			if (_vm->input().controllerFlags & 0x70) {
+				//a18.f3a = 1;
+				//a18.speedX = 0x100;
+				++state.counter;
+			}
 			break;
 		case 1:
+			_vm->sound()->pcmSendCommand(57, -1);
+			//a18.f3a = 0;
+			//a18.speedX = 0;
+			//a19.f3a = 1;
+			//a19.speedX = 1;
 			++state.counter;
 			break;
 		case 2:
+			_vm->gfx()->setAnimControlFlags(16, GraphicsEngine::kAnimPause);
+			//a16: posX = 117;
+			//a16: posY = 93;
 			++state.counter;
 			break;
 		case 3:
@@ -455,6 +493,8 @@ SH_IMPL_FRM(D2, 11) {
 			--state.counter;
 			break;
 		case 5:
+			if (++_counter2 < 180)
+				return;
 			state.counter = 10;
 			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
 			++state.frameState;
diff --git a/engines/snatcher/scene_imp.h b/engines/snatcher/scene_imp.h
index edf84a1d9cf..b56106ebf28 100644
--- a/engines/snatcher/scene_imp.h
+++ b/engines/snatcher/scene_imp.h
@@ -40,8 +40,8 @@ namespace Snatcher {
 	SceneHandler *createSceneHandler_##id(SnatcherEngine *vm, SceneModule *scn, FIO *fio) { return new Scene_##id(vm, scn, fio); }
 #define SH_IMP_FRMTBL(id) \
 	const Scene_##id::FrameProcTblEntry Scene_##id::frameProcTable[] =
-#define SH_FRM(no) \
-	&frameUpdate##no
+#define SH_FRM(id, no) \
+	&Scene_##id::frameUpdate##no
 #define SH_IMP_CTOR(id) \
 	Scene_##id::Scene_##id(SnatcherEngine *vm, SceneModule *scn, FIO *fio) : SceneHandler(vm, scn, fio)
 #define SH_CTOR_MAKEPROCS(id) \
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index a1012e753c1..a6ba7514d9c 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -24,14 +24,12 @@
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
 #include "snatcher/util.h"
-
+#include "common/config-manager.h"
 #include "common/endian.h"
 #include "common/events.h"
 #include "common/list.h"
 #include "common/system.h"
-
 #include "graphics/pixelformat.h"
-
 #include "engines/util.h"
 
 // Snatcher makes use of horizontal interrupts. These can be invoked after any given count of rendered scan lines.
@@ -43,8 +41,9 @@
 
 namespace Snatcher {
 
-SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _gfx(nullptr), _snd(nullptr), _keyInput(0), _lastKeys(0),
-	_releaseKeys(0), _keyRepeat(false), _gfxInfo(), _frameLen((100000 << 14) / (6000000 / 1001)) {
+SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _gfx(nullptr), _snd(nullptr), _input(), _lastKeys(0),
+	_releaseKeys(0), _keyRepeat(false), _gfxInfo(), _frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
+	assert(system);
 }
 
 SnatcherEngine::~SnatcherEngine() {
@@ -60,7 +59,7 @@ Common::Error SnatcherEngine::run() {
 	if (!initResource())
 		return Common::Error(Common::kReadingFailed);
 
-	if (!initSound(_game.platform, _game.soundOptions))
+	if (!initSound(_system->getMixer(),	_game.platform, _game.soundOptions))
 		return Common::Error(Common::kAudioDeviceInitFailed);
 
 	if (!initGfx(_game.platform, SNATCHER_GFXMODE_8BIT))
@@ -95,7 +94,8 @@ bool SnatcherEngine::initGfx(Common::Platform platform, bool use8BitColorMode) {
 			error("%s(): No suitable color mode found", __FUNCTION__);
 	}
 
-	if (_gfx = new GraphicsEngine(&pxf, _system, platform, _gfxInfo)) {
+	_gfx = new GraphicsEngine(&pxf, _system, platform, _gfxInfo);
+	if (_gfx) {
 		initGraphics(_gfx->screenWidth(), _gfx->screenHeight(), &pxf);
 		return true;
 	}
@@ -103,44 +103,39 @@ bool SnatcherEngine::initGfx(Common::Platform platform, bool use8BitColorMode) {
 	return false;
 }
 
-bool SnatcherEngine::initSound(Common::Platform platform, int soundOptions) {
-	return (_snd = new SoundEngine(platform, soundOptions));
+bool SnatcherEngine::initSound(Audio::Mixer *mixer, Common::Platform platform, int soundOptions) {
+	assert(_mixer);
+	assert(_fio);
+	_snd = new SoundEngine(_fio, platform, soundOptions);
+	return (_snd && _snd->init(mixer));
 }
 
-void SnatcherEngine::playBootSequence() {
+void SnatcherEngine::playBootSequence(const GameState &state) {
 	uint32 frameTimer = 0;
-	int curFrame = 0;
+	int curSeqState = 0;
+	_snd->fmSendCommand(242, -1);
 
-	while (curFrame != -1 && !shouldQuit()) {
+	while (curSeqState != -1 && !shouldQuit()) {
 		frameTimer += _frameLen;
 		uint32 nextFrame = _system->getMillis() + (frameTimer >> 14);
 		frameTimer &= 0x3FFF;
 
-		curFrame = _gfx->displayBootSequenceFrame(curFrame);
+		int nextState = _gfx->displayBootSequenceFrame(curSeqState);
+		if (curSeqState == 6 && nextState == 7)
+			_snd->fmSendCommand(101, -1);// 65, 76, 86, 88, 89, 94, 98, 100, 101 (pitch bend), 72 (pb special), 74 (vbr)
+		curSeqState = nextState;
 
-		switch (curFrame) {
-		case 0:
-		case -1:
-			_snd->fmStartSound(242);
-			break;
-		case 7:
-			_snd->fmStartSound(63);
-			break;
-		default:
-			break;
-		}
-
-		checkEvents();
+		checkEvents(state);
+		_snd->update();
 		delayUntil(nextFrame);
 	}
 }
 
 bool SnatcherEngine::start() {
-	playBootSequence();
-
 	Util::rngReset();
 	GameState state;
-	memset(&state, 0, sizeof(GameState));
+
+	playBootSequence(state);
 
 	uint32 frameTimer = 0;
 
@@ -156,7 +151,7 @@ bool SnatcherEngine::start() {
 
 		updateTopLevelState(state);
 
-		_gfxInfo.audioSync = _snd->musicIsPlaying() ? _snd->musicGetTime() : 0;
+		_gfxInfo.audioSync = _snd->cdaIsPlaying() ? _snd->cdaGetTime() : 0;
 		Util::rngMakeNumber();
 
 		_gfx->setVar(3, 0);
@@ -190,7 +185,8 @@ bool SnatcherEngine::start() {
 		}
 
 		_gfx->nextFrame();
-		checkEvents();
+		_snd->update();
+		checkEvents(state);
 		delayUntil(nextFrame);
 	}
 
@@ -210,47 +206,59 @@ struct InputEvent {
 	Common::KeyCode kc;
 	uint16 kFlag;
 	uint16 internalEvent;
+	bool updateCoords;
 };
 
 static const InputEvent _defaultKeyEvents[] = {
 	// Arrow buttons
-	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_UP, 0x00, 0x01 },
-	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP8, Common::KBD_NUM, 0x01 },
-	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_DOWN, 0x00, 0x02 },
-	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP2, Common::KBD_NUM, 0x02 },
-	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_LEFT, 0x00, 0x04 },
-	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP4, Common::KBD_NUM, 0x04 },
-	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_RIGHT, 0x00, 0x08 },
-	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP6, Common::KBD_NUM, 0x08},
-	{ Common::EVENT_WHEELUP, Common::EVENT_INVALID, Common::KEYCODE_INVALID, 0x00, 0x01 },
-	{ Common::EVENT_WHEELDOWN, Common::EVENT_INVALID, Common::KEYCODE_INVALID, 0x00, 0x02 },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_UP, 0x00, 0x01, false },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP8, Common::KBD_NUM, 0x01, false },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_DOWN, 0x00, 0x02, false },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP2, Common::KBD_NUM, 0x02, false },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_LEFT, 0x00, 0x04, false },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP4, Common::KBD_NUM, 0x04, false },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_RIGHT, 0x00, 0x08, false },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP6, Common::KBD_NUM, 0x08, false},
+	{ Common::EVENT_WHEELUP, Common::EVENT_INVALID, Common::KEYCODE_INVALID, 0x00, 0x01, false },
+	{ Common::EVENT_WHEELDOWN, Common::EVENT_INVALID, Common::KEYCODE_INVALID, 0x00, 0x02, false },
 
 	// A, B, C buttons
-	{ Common::EVENT_LBUTTONDOWN, Common::EVENT_LBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x10 },
-	{ Common::EVENT_MBUTTONDOWN, Common::EVENT_MBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x20 },
-	{ Common::EVENT_RBUTTONDOWN, Common::EVENT_RBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x40 },
-	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_a, 0x00, 0x10},
-	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_b, 0x00, 0x20},
-	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_c, 0x00, 0x40},
+	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_a, 0x00, 0x10, false},
+	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_b, 0x00, 0x20, false},
+	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_c, 0x00, 0x40, false},
+
+	{ Common::EVENT_MBUTTONDOWN, Common::EVENT_MBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x20, false },
+	{ Common::EVENT_RBUTTONDOWN, Common::EVENT_RBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x40, false },
+
+
+	// Lightgun
+	{ Common::EVENT_LBUTTONDOWN, Common::EVENT_LBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x100, true },
 
 	// Start button
-	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_RETURN, 0x00, 0x80},
-	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_SPACE, 0x00, 0x80},
+	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_RETURN, 0x00, 0x80, false},
+	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_SPACE, 0x00, 0x80, false},
 };
 
-void SnatcherEngine::checkEvents() {
+void SnatcherEngine::checkEvents(const GameState &state) {
 	Common::Event evt;
 	_lastKeys &= ~_releaseKeys;
-	_keyInput = _releaseKeys = 0;
+	_releaseKeys = 0;
+	_input.controllerFlags = 0;
+	Common::Point mouse;
 
 	while (_eventMan->pollEvent(evt)) {
 		for (const InputEvent &k : _defaultKeyEvents) {
 			if (evt.type == k.pressType && (k.kc == Common::KEYCODE_INVALID || evt.kbd.keycode == k.kc) && (k.kFlag == 0 || (evt.kbd.flags & k.kFlag))) {
 				if (!(_lastKeys & k.internalEvent)) {
-					_keyInput |= k.internalEvent;
+					_input.controllerFlags |= k.internalEvent;
 					_lastKeys |= k.internalEvent;
 					if (_keyRepeat || k.releaseType == Common::EVENT_INVALID)
 						_releaseKeys |= k.internalEvent;
+					if (k.updateCoords) {
+						_realLightGunPos = evt.mouse;
+						_input.lightGunPos.x = CLIP<int>(evt.mouse.x - state.conf.lightGunBias.x, 0, _gfx->screenWidth() - 1);
+						_input.lightGunPos.y = CLIP<int>(evt.mouse.y - state.conf.lightGunBias.y, 0, _gfx->screenHeight() - 1);
+					}
 				}
 			} else if ((evt.type == k.releaseType) && (k.kc == Common::KEYCODE_INVALID || evt.kbd.keycode == k.kc) && (k.kFlag == 0 || (evt.kbd.flags & k.kFlag))) {
 				_lastKeys &= ~k.internalEvent;
@@ -283,18 +291,13 @@ void SnatcherEngine::updateTopLevelState(GameState &state) {
 }
 
 void SnatcherEngine::updateModuleState(GameState &state) {
-	uint16 _word_unk_Flags = 0;
-	int _sub_val_2 = 0;
 	int _unlCDREadSeekWord = 0;
 	uint8 _triggerPalFlag7Etc = 0;
 	bool _sub_bool_5 = false;
 
-	uint8 _wordRAM__TABLE48__word_B6400[48];
-	memset(_wordRAM__TABLE48__word_B6400, 0, 48);
-
 	switch (state.modProcessTop) {
 	case -1:
-		_snd->musicStop();
+		_snd->cdaStop();
 		state.modProcessTop = 0;
 		break;
 	case 0:
@@ -303,7 +306,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			++state.modProcessSub;
 			break;
 		case 1:
-			if (!_snd->musicIsPlaying()) {
+			if (!_snd->cdaIsPlaying()) {
 				delete _module;
 				_module = _fio->loadModule(4);
 				assert(_module);
@@ -329,10 +332,10 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 		case 0:
 			state.frameNo = 0;
 			++state.modProcessSub;
-			_snd->pcmPlayEffect(30);
+			_snd->pcmInitSound(30);
 			break;
 		case 1:
-			if (!(_word_unk_Flags & 0x0F))
+			if (!(_snd->pcmGetStatus() & 0x0F))
 				++state.modProcessSub;
 			break;
 		case 2:
@@ -353,8 +356,8 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 	case 2:
 		switch (state.modProcessSub) {
 		case 0:
-			if (!(_sub_val_2 & 0x1F)) {
-				if (!_snd->musicIsPlaying()) {
+			if (!(_gfx->frameCount() & 0x1F)) {
+				if (!_snd->cdaIsPlaying()) {
 					static const uint8 scids[] = { 3, 2 };
 					delete _module;
 					assert(state.modIndex < ARRAYSIZE(scids));
@@ -362,12 +365,12 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 					assert(_module);
 					++state.modProcessSub;
 				} else {
-					_snd->musicStop();
+					_snd->cdaStop();
 				}
 			}
 			break;
 		case 1:
-			if (!(_sub_val_2 & 0x1F)) {
+			if (!(_gfx->frameCount() & 0x1F)) {
 				// startup__runWithFileFunc(2)
 				_unlCDREadSeekWord = 0;
 				state.frameNo = -1;
@@ -381,7 +384,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 				state.finish = 0;
 				state.counter = 10;
 				++state.modProcessSub;
-				static byte data[] = { 0x83, 0x00, 0x00, 0x3F };
+				static const uint8 data[] = { 0x83, 0x00, 0x00, 0x3F };
 				_gfx->enqueuePaletteEvent(ResourcePointer(data, 0));
 			} else if (state.finish) {
 				if (state.modIndex == 0) {
@@ -394,7 +397,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			break;
 		case 3:
 			if (--state.counter == 1) {
-				static const byte cmd[] = {
+				static const uint8 cmd[] = {
 					0x01, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xFF, 0xFF,
 					0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 					0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@@ -413,13 +416,13 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			state.finish = 0;
 			state.modProcessTop = 7;
 			state.modProcessSub = 0;
-			_gfx->scrollCommand(0xFF);
+			_gfx->transitionCommand(0xFF);
 			_gfx->setVar(9, 1);
 			_gfx->reset(GraphicsEngine::kResetPalEvents | GraphicsEngine::kResetAnimations);
 		}
 		break;
 	case 3:
-		_wordRAM__TABLE48__word_B6400[2] = 1;
+		//_wordRAM__TABLE48__word_B6400[2] = 1;
 		state.finish = 0;
 		state.modProcessTop = 0;
 		state.modProcessSub = 0;
@@ -446,7 +449,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			}
 			break;
 		case 1:
-			if (!_snd->musicIsPlaying()) {
+			if (!_snd->cdaIsPlaying()) {
 				delete _module;
 				_module = _fio->loadModule(52);
 				assert(_module);
@@ -469,10 +472,11 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 		default:
 			break;
 		}
+		break;
 	case 7:
 		switch (state.modProcessSub) {
 		case 0:
-			_snd->musicStop();
+			_snd->cdaStop();
 			//loadFile56 PCMLT_01.BIN
 			++state.modProcessSub;
 			break;
@@ -504,11 +508,38 @@ void SnatcherEngine::registerDefaultSettings() {
 }
 
 void SnatcherEngine::syncSoundSettings() {
+	Engine::syncSoundSettings();
+
+	if (!_snd)
+		return;
+
+	int volMusic = 192;
+	int volSFX = 192;
+	bool mute = false;
+
+	if (ConfMan.hasKey("mute"))
+		mute = ConfMan.getBool("mute");
+	if (!mute) {
+	if (ConfMan.hasKey("music_volume"))
+		volMusic = ConfMan.getInt("music_volume");
+	if (ConfMan.hasKey("sfx_volume"))
+		volSFX = ConfMan.getInt("sfx_volume");
+	} else {
+		volMusic = 0;
+		volSFX = 0;
+	}
 
+	_snd->setMusicVolume(volMusic);
+	_snd->setSoundEffectVolume(volSFX);
 }
 
 void SnatcherEngine::pauseEngineIntern(bool pause) {
 	_snd->pause(pause);
 }
 
+void SnatcherEngine::calibrateLightGun(GameState &state) {
+	state.conf.lightGunBias.x = _realLightGunPos.x - (_gfx->screenWidth() / 2);
+	state.conf.lightGunBias.y = _realLightGunPos.y - (_gfx->screenHeight() / 2);
+}
+
 } // End of namespace Snatcher
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index b0a9d00df4d..1044774a21e 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -22,9 +22,11 @@
 #ifndef SNATCHER_H
 #define SNATCHER_H
 
+#include "common/rect.h"
+#include "engines/engine.h"
 #include "snatcher/detection.h"
 #include "snatcher/info.h"
-#include "engines/engine.h"
+
 
 class SnatcherMetaEngine;
 
@@ -49,13 +51,13 @@ private:
 	Common::Error run() override;
 	bool initResource();
 	bool initGfx(Common::Platform platform, bool use8BitColorMode);
-	bool initSound(Common::Platform platform, int soundOptions);
-	void playBootSequence();
+	bool initSound(Audio::Mixer *mixer, Common::Platform platform, int soundOptions);
+	void playBootSequence(const GameState &state);
 
 	// Main loop
 	bool start();
 	void delayUntil(uint32 end);
-	void checkEvents();
+	void checkEvents(const GameState &state);
 
 	void updateTopLevelState(GameState &state);
 	void updateModuleState(GameState &state);
@@ -86,14 +88,23 @@ private:
 
 public:
 	// Input
-	uint8 inputFlag() const { return _keyInput; }
+	struct Input {
+		Input() : controllerFlags(0), lightGunPos() {}
+		uint16 controllerFlags;
+		Common::Point lightGunPos;
+	};
+
+	const Input &input() const { return _input; }
+	void calibrateLightGun(GameState &state);
 	void toggleKeyRepeat(bool enableRepeat) { _keyRepeat = enableRepeat; }
 
 private:
-	uint8 _lastKeys;
-	uint8 _keyInput;
-	uint8 _releaseKeys;
+	uint16 _lastKeys;
+	uint16 _releaseKeys;
+	Common::Point _realLightGunPos;
 	bool _keyRepeat;
+	
+	Input _input;
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/sound.cpp b/engines/snatcher/sound.cpp
index 85ad14d6c66..048d8c29760 100644
--- a/engines/snatcher/sound.cpp
+++ b/engines/snatcher/sound.cpp
@@ -24,8 +24,8 @@
 
 namespace Snatcher {
 
-SoundEngine::SoundEngine(Common::Platform platform, int soundOptions) : _dev(nullptr) {
-	_dev = SoundDevice::create(platform, soundOptions);
+SoundEngine::SoundEngine(FIO *fio, Common::Platform platform, int soundOptions) : _dev(nullptr) {
+	_dev = SoundDevice::create(fio, platform, soundOptions);
 	assert(_dev);
 }
 
@@ -33,39 +33,63 @@ SoundEngine::~SoundEngine() {
 	delete _dev;
 }
 
-void SoundEngine::musicPlay(int track) {
-	_dev->musicPlay(track);
+bool SoundEngine::init(Audio::Mixer *mixer) {
+	return _dev->init(mixer);
 }
 
-void SoundEngine::musicStop() {
-	_dev->musicStop();
+void SoundEngine::cdaPlay(int track) {
+	_dev->cdaPlay(track);
 }
 
-bool SoundEngine::musicIsPlaying() const {
-	return _dev->musicIsPlaying();
+void SoundEngine::cdaStop() {
+	_dev->cdaStop();
 }
 
-uint32 SoundEngine::musicGetTime() const {
-	return _dev->musicGetTime();
+bool SoundEngine::cdaIsPlaying() const {
+	return _dev->cdaIsPlaying();
 }
 
-void SoundEngine::fmStartSound(int track) {
-	_dev->fmStartSound(track);
+uint32 SoundEngine::cdaGetTime() const {
+	return _dev->cdaGetTime();
 }
 
-void SoundEngine::pcmPlayEffect(int track) {
-	_dev->pcmPlayEffect(track);
+void SoundEngine::fmSendCommand(int cmd, int arg) {
+	_dev->fmSendCommand(cmd, arg);
 }
 
-void SoundEngine::pcmDoCommand(int cmd, int arg) {
-	_dev->pcmDoCommand(cmd, arg);
+uint8 SoundEngine::fmGetStatus() const {
+	return _dev->fmGetStatus();
+}
+
+void SoundEngine::pcmSendCommand(int cmd, int arg) {
+	_dev->pcmSendCommand(cmd, arg);
+}
+
+void SoundEngine::pcmInitSound(int sndId) {
+	_dev->pcmInitSound(sndId);
+}
+
+uint8 SoundEngine::pcmGetStatus() const {
+	return _dev->pcmGetStatus();
 }
 
 void SoundEngine::pause(bool toggle) {
 	_dev->pause(toggle);
 }
 
-SoundDevice *SoundDevice::create(Common::Platform platform, int soundOptions) {
+void SoundEngine::update() {
+	_dev->update();
+}
+
+void SoundEngine::setMusicVolume(int vol) {
+	_dev->setMusicVolume(vol);
+}
+
+void SoundEngine::setSoundEffectVolume(int vol) {
+	_dev->setSoundEffectVolume(vol);
+}
+
+SoundDevice *SoundDevice::create(FIO *fio, Common::Platform platform, int soundOptions) {
 	MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(soundOptions);
 	MusicType musicType = MidiDriver::getMusicType(dev);
 
@@ -79,7 +103,7 @@ SoundDevice *SoundDevice::create(Common::Platform platform, int soundOptions) {
 
 	switch (platform) {
 	case Common::kPlatformSegaCD:
-		return createSegaSoundDevice();
+		return createSegaSoundDevice(fio);
 	default:
 		break;
 	};
diff --git a/engines/snatcher/sound.h b/engines/snatcher/sound.h
index 9ee598d07ff..9afc4c157cb 100644
--- a/engines/snatcher/sound.h
+++ b/engines/snatcher/sound.h
@@ -24,26 +24,39 @@
 
 #include "common/platform.h"
 
+namespace Audio {
+class Mixer;
+}
+
 namespace Snatcher {
 
 class SoundDevice;
+class FIO;
 
 class SoundEngine {
 public:
-	SoundEngine(Common::Platform platform, int soundOptions);
+	SoundEngine(FIO *fio, Common::Platform platform, int soundOptions);
 	~SoundEngine();
 
-	void musicPlay(int track);
-	void musicStop();
-	bool musicIsPlaying() const;
-	uint32 musicGetTime() const;
+	bool init(Audio::Mixer *mixer);
+
+	void cdaPlay(int track);
+	void cdaStop();
+	bool cdaIsPlaying() const;
+	uint32 cdaGetTime() const;
 
-	void fmStartSound(int track);
+	void fmSendCommand(int cmd, int arg);
+	uint8 fmGetStatus() const;
 
-	void pcmPlayEffect(int track);
-	void pcmDoCommand(int cmd, int arg);
+	void pcmSendCommand(int cmd, int arg);
+	void pcmInitSound(int sndId);
+	uint8 pcmGetStatus() const;
 
 	void pause(bool toggle);
+	void update();
+
+	void setMusicVolume(int vol);
+	void setSoundEffectVolume(int vol);
 
 private:
 	SoundDevice *_dev;
diff --git a/engines/snatcher/sound_device.h b/engines/snatcher/sound_device.h
index 37384dc9457..c4a2f59a5e2 100644
--- a/engines/snatcher/sound_device.h
+++ b/engines/snatcher/sound_device.h
@@ -22,26 +22,40 @@
 #ifndef SNATCHER_SOUND_DEVICE_H
 #define SNATCHER_SOUND_DEVICE_H
 
-#include "audio//mididrv.h"
+#include "audio/mididrv.h"
 #include "common/platform.h"
 
+namespace Audio {
+class Mixer;
+}
+
 namespace Snatcher {
 
+class FIO;
+
 class SoundDevice {
 public:
 	virtual ~SoundDevice() {}
 
-	virtual void musicPlay(int track) = 0;
-	virtual void musicStop() = 0;
-	virtual bool musicIsPlaying() const = 0;
-	virtual uint32 musicGetTime() const = 0;
+	virtual bool init(Audio::Mixer *mixer) = 0;
 
-	virtual void fmStartSound(int track) = 0;
+	virtual void cdaPlay(int track) = 0;
+	virtual void cdaStop() = 0;
+	virtual bool cdaIsPlaying() const = 0;
+	virtual uint32 cdaGetTime() const = 0;
 
-	virtual void pcmPlayEffect(int track) = 0;
-	virtual void pcmDoCommand(int cmd, int arg) = 0;
+	virtual void fmSendCommand(int cmd, int arg) = 0;
+	virtual uint8 fmGetStatus() const = 0;
+
+	virtual void pcmSendCommand(int cmd, int arg) = 0;
+	virtual void pcmInitSound(int sndId) = 0;
+	virtual uint8 pcmGetStatus() const = 0;
 
 	virtual void pause(bool toggle) = 0;
+	virtual void update() = 0;
+
+	virtual void setMusicVolume(int vol) = 0;
+	virtual void setSoundEffectVolume(int vol) = 0;
 
 protected:
 	SoundDevice() : _musicStartTime(0) {}
@@ -49,10 +63,10 @@ protected:
 	uint32 _musicStartTime;
 
 private:
-	static SoundDevice *createSegaSoundDevice();
+	static SoundDevice *createSegaSoundDevice(FIO *fio);
 
 public:
-	static SoundDevice *create(Common::Platform platform, int soundOptions);
+	static SoundDevice *create(FIO *fio, Common::Platform platform, int soundOptions);
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/sound_device_null.cpp b/engines/snatcher/sound_device_null.cpp
deleted file mode 100644
index 7a19545be4b..00000000000
--- a/engines/snatcher/sound_device_null.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
-*
-* ScummVM is the legal property of its developers, whose names
-* are too numerous to list here. Please refer to the COPYRIGHT
-* file distributed with this source distribution.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*
-*/
-
-#include "common/system.h"
-#include "snatcher/sound_device.h"
-#include "snatcher/util.h"
-
-namespace Snatcher {
-
-class NullSoundDevice : public SoundDevice {
-public:
-	NullSoundDevice() : SoundDevice(), _playing(false) {}
-	~NullSoundDevice() override {}
-
-	void musicPlay(int track) override { }
-	void musicStop() override { }
-	bool musicIsPlaying() const override;
-	uint32 musicGetTime() const override;
-
-	void pcmPlayEffect(int track) override;
-	void pcmDoCommand(int cmd, int arg) override;
-
-	void pause(bool toggle) override;
-private:
-	bool _playing;
-};
-
-bool NullSoundDevice::musicIsPlaying() const {
-	return true;
-}
-
-uint32 NullSoundDevice::musicGetTime() const {
-	uint32 relTime = 0;
-	return Util::makeBCDTimeStamp(relTime);
-}
-
-void NullSoundDevice::pcmPlayEffect(int track) {
-}
-
-void NullSoundDevice::pcmDoCommand(int cmd, int arg) {
-}
-
-void NullSoundDevice::pause(bool toggle) {
-
-}
-
-SoundDevice *SoundDevice::createNullSoundDevice() {
-	return new NullSoundDevice();
-}
-
-} // End of namespace Snatcher
diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
index b42605a6819..81fdfc26fd3 100644
--- a/engines/snatcher/sound_device_scd.cpp
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -20,76 +20,1836 @@
 */
 
 
+#include "audio/softsynth/fmtowns_pc98/sega_audio.h"
 #include "backends/audiocd/audiocd.h"
+#include "common/array.h"
+#include "common/func.h"
+#include "common/ptr.h"
+#include "common/substream.h"
 #include "common/system.h"
+#include "snatcher/resource.h"
+#include "snatcher/sound_device.h"
+#include "snatcher/staticres.h"
+#include "snatcher/util.h"
+
+
+#define SNDDRV_DEBUG
+
+namespace Snatcher {
+
+class MessageHandler {
+public:
+	MessageHandler() : _mutex(), _msgCntW(0), _msgCntR(0) {
+		_msg[0] = _msg[1] = _msg[2] = 0;
+	}
+
+	void write(uint8 a, uint8 b, uint8 c) {
+		Common::StackLock lock(_mutex);
+		_msg[0] = a;
+		_msg[1] = b;
+		_msg[2] = c;
+		++_msgCntW;
+	}
+
+	void read(uint8 &a, uint8 &b, uint8 &c) {
+		Common::StackLock lock(_mutex);
+		a = _msg[0];
+		b = _msg[1];
+		c = _msg[2];
+		_msgCntR = _msgCntW;
+	}
+
+	void clear() {
+		Common::StackLock lock(_mutex);
+		_msg[0] = _msg[1] = _msg[2] = _msgCntW = _msgCntR = 0;
+	}
+
+	bool hasNewMsg() const {
+		Common::StackLock lock(_mutex);
+		return (_msgCntR != _msgCntW);
+	}
+
+private:
+	uint8 _msg[3];
+	uint8 _msgCntW;
+	uint8 _msgCntR;
+	Common::Mutex _mutex;
+};
+
+class KonamiMCDAudioDriver;
+class SegaSoundDevice : public SoundDevice {
+public:
+	SegaSoundDevice(FIO *fio);
+	~SegaSoundDevice() override;
+
+	bool init(Audio::Mixer *mixer) override;
+
+	void cdaPlay(int track) override;
+	void cdaStop() override;
+	bool cdaIsPlaying() const override;
+	uint32 cdaGetTime() const override;
+
+	void fmSendCommand(int cmd, int arg) override;
+	uint8 fmGetStatus() const override;
+	void pcmSendCommand(int cmd, int arg) override;
+	void pcmInitSound(int sndId) override;
+	uint8 pcmGetStatus() const override;
+
+	void pause(bool toggle) override;
+	void update() override;
+
+	void setMusicVolume(int vol) override;
+	void setSoundEffectVolume(int vol) override;
+
+private:
+	bool fmLoadData();
+	void fmUpdateVolumeFader();
+	void fmHandleCmdQueue();
+
+	uint8 *_fmCmdQueue;
+	uint8 _fmCmdQueueWPos;
+	uint8 _fmCmdQueueRPos;
+	uint8 _fmVolume1;
+	uint8 _fmLastVolume1;
+	uint8 _fmVolume2;
+	uint8 _fmLastVolume2;
+
+	MessageHandler _driverMsg;
+	KonamiMCDAudioDriver *_fmDriver;
+
+private:
+	bool pcmLoadData();
+	void pcmDisableStereoMode(bool disable);
+	void pcmStop();
+	void pcmStartSound(uint8 sndId, int8 unit, uint8 d2 = 0);
+
+	void pcmCheckPlayStatus();
+	void pcmHandleDriverMessage();
+	void pcmDelayedStart();
+
+	typedef Common::SharedPtr<Common::SeekableReadStream> SmpStrPtr;
+	SmpStrPtr createSamplesStream(uint32 addr) const;
+
+	struct PCMResourceInfo {
+		uint8 prio;
+		uint8 mode;
+		uint8 vol;
+		uint8 pan;
+		uint16 sector;
+		uint16 numSectors;
+	};
+
+	struct PCMResidentDataInfo {
+		uint8 prio;
+		uint8 unit;
+		uint8 c;
+		uint8 pan;
+		uint16 rate;
+		uint32 addr;
+	};
+
+	struct PCMInstrumentInfo {
+		uint32 addr;
+		uint32 loopst;
+	};
+
+	struct PCMSound {
+		uint8 flags;
+		uint8 id;
+		uint8 prio;
+		uint8 unit;
+		uint32 addr;
+		uint8 f16;
+		uint8 vol;
+		uint8 pan;
+		uint16 rate;
+	};
+
+	void pcmResetUnit(uint8 unit, PCMSound &s);
+	void pcmStartSoundInternal(uint8 unit, uint8 chan, PCMSound &s);
+	void pcmStartInstrument(uint8 unit, uint8 sndId, uint8 vol);
+
+	uint8 calcVolume(uint8 unit, PCMSound &s) const;
+	uint8 calcPan(PCMSound &s) const;
+
+	PCMResourceInfo *_pcmResourceInfo;
+	PCMResidentDataInfo *_pcmResidentDataInfo;
+	PCMInstrumentInfo *_pcmInstrumentInfo;
+	PCMSound *_pcmSounds;
+	bool _pcmDisableStereo;
+	int16 _pcmResourceNumber;
+	uint8 _pcmState;
+	uint8 _pcmMode;
+	uint8 _faderFlags;
+	uint8 _faderTimer1;
+	uint8 _faderTimer2;
+	bool _unkVolCond;
+	uint8 _pcmMsgFromDriver[4];
+	uint8 *_temp;
+
+private:
+	int _lastTrack;
+	uint32 _pauseStartTime;
+	FIO *_fio;
+	SegaAudioInterface *_sai;
+};
+
+struct SndDriverState {
+	SndDriverState() : flags(0), volume1(0), volume2(0), volUpdate(0), chanUse(0), progress(0), result(0) {
+		msg[0] = msg[1] = msg[2] = 0;
+		sfxId[0] = sfxId[1] = 0;
+		restore[0] = restore[1] = 0;
+	}
+
+	void clear() {
+		flags = 0;
+		volume1 = volume2 = 0;
+		volUpdate = 0;
+		chanUse = 0;
+		progress = result = 0;
+		msg[0] = msg[1] = msg[2] = 0;
+		sfxId[0] = sfxId[1] = 0;
+		restore[0] = restore[1] = 0;
+
+	}
+
+	enum Flags : uint16 {
+		kSndLockSfxChan1 =		1		<<		0,
+		kSndLockSfxChan2 =		1		<<		1,
+		kSndFadeoutDone =		1		<<		3,
+		kSndKeepPanPos =		1		<<		5,
+		kSndSfxMode =			1		<<		6,
+		kSndSfxIsPlaying =		1		<<		7,
+		kSndPitchAdjust =		1		<<		10,
+		kSndDisableStereo =		1		<<		11,
+		kSndParseBreak =		1		<<		12,
+		kSndSfxStarting =		1		<<		13,
+		kSndBlockChannels =		1		<<		14
+	};
+
+	uint8 volume1, volume2;
+	uint16 flags;
+	uint16 volUpdate;
+	uint16 chanUse;
+	uint8 msg[3];
+	uint8 sfxId[2];
+	uint8 restore[2];
+	uint8 progress;
+	uint8 result;
+};
+
+class KonamiMCDSndChannel {
+public:
+	KonamiMCDSndChannel(int id, SegaAudioInterface *sai, SndDriverState &state);
+	virtual ~KonamiMCDSndChannel() {}
+
+	void clear();
+
+	void loadInstrumentData(const uint8 *data, uint32 dataSize);
+	void initSound(const uint8 *data, const uint8 *dataEnd, uint8 sndId, int16 prio);
+	void setVolume(int vol);
+	void writeReg(uint8 reg, uint8 val);
+
+	void stop();
+	void off();
+
+	bool busy() const { return _sndId != 0; }
+	uint8 getId() const { return _id; }
+	uint8 getNumber() const { return _num; }
+	uint8 getPrio() const { return _prio; }
+
+	virtual bool checkTicker() = 0;
+	virtual void update() = 0;
+
+protected:
+	void nextTick(const uint8 *&data);
+	void updateVolumeAndFrequency();
+
+	void chanOff();
+	virtual void noteOn(uint8 note, const uint8 *&data);
+	void runOpcode(uint8 opcode, const uint8 *&data);
+	void addToMessage(uint8 cmd, const uint8 *&data);
+
+	void panEffect();
+	void applyLFOSensitivity();
+	void applyAmpModSensitivity();
+	void checkNoteTimer();
+	void applyVolumeSlide();
+
+	void keyOff();
+	void keyOn();
+
+	void programChange(const uint8 *&data);
+	void setPitchBend(const uint8 *&data);
+	void calcPitchBend(uint16 lastFreq);
+	void jump(const uint8 *&data);
+	void checkPtr(const uint8 *data, uint8 bytesNeeded, const char *caller);
+	void finish();
+
+	void applyPitchBend();
+	int16 getVbrModifier();
+	void applyFreqModifiers(int16 vbrMod);
+
+	void recalcAndSetChannelVolume();
+	void setParameter(uint8 para, uint8 val);
+	void setFrequency(uint16 frq);
+	void setProgram(uint8 prg);
+
+	bool blockedBySfx() const {
+		return ((_state.flags & SndDriverState::kSndSfxIsPlaying) &&
+			((_id == 4 && ((_state.flags & (SndDriverState::kSndSfxMode | SndDriverState::kSndLockSfxChan1)) == SndDriverState::kSndLockSfxChan1)) ||
+				(_id == 5 && ((_state.flags & (SndDriverState::kSndSfxMode | SndDriverState::kSndLockSfxChan2)) == SndDriverState::kSndLockSfxChan2))));
+	}
+
+protected:
+	enum Flags : uint8 {
+		KChSubroutine		=		1		<<		2,
+		KChPortamento		=		1		<<		4,
+		kChBlockVolume		=		1		<<		5,
+		kChFinishedTheme	=		1		<<		6,
+		kChRepeatingTheme	=		1		<<		7
+	};
+
+	uint8 _sndId, _prio, _section1RepeatCounter, _section2RepeatCounter, _speed, _ticker, _pitchBendSteps, _pitchBendDuration, _pitchBendDelayTimer, _pitchBendDelay, _vbrDelayTimer, _vbrState,
+		_vbrRate, _vbrDepthModulationRateCounter, _vbrDelay, _vbrDepthModulationRate, _vbrDepth, _velocity, _volSlideDuration, _volSlideDest, _panEffectRateCounter, _panEffectRate, _panPosition,
+		_panEffectType, _panEffectState, _noteTimer, _eventDelay, _noteDuration, _lastNoteDuration, _eventDelayTimer, _pbExtTimer, _pbExtSpeed, _flags, _program, _enableDelayedEffects, _algorithm,
+		_lfoSensitivity, _ampModSensitivity, _lfoSensitivityDelay, _ampModSensitivityDelay, _lfoSensitivityDelayTimer, _ampModSensitivityDelayTimer, _regB4, _resetFlag, _signalNoteOff, _volTotal;
+	uint8 _tl[4];
+	int8 _transposeMSB;
+	int16 _section1VolAdjust, _section2VolAdjust, _section1Transpose, _section2Transpose, _volSlideRate, _pitchBendRate, _pitchBendDist, _vbrDepthRate, _transposeLSB;
+	uint16 _volume, _freqTotal, _pitchBendDest, _vbrDepthCur, _pbExtPos, _pbExtMask, _decayRate, _decayPhase, _freqLast;
+	const uint8 *_returnPos, *_themeStart, *_resumeAfterThemePos, *_sectionMarker1, *_sectionMarker2, *_trackCurPos, *_trackStart, *_dataEnd;
+	const uint8 _id, _num, _part, _regOffs;
+	SegaAudioInterface *_sai;
+
+	const uint8 *_instrumentData;
+	uint32 _instrumentDataSize;
+
+	SndDriverState &_state;
+
+private:
+	void makeFunctions();
+
+	void op_nop(const uint8*&);
+	void op_break_toneOff(const uint8 *&data);
+	void op_break_keepTone(const uint8 *&data);
+	void op_programChange(const uint8 *&data);
+	void op_panPos(const uint8 *&data);
+	void op_vibrato(const uint8 *&data);
+	void op_pitchBendSpecial(const uint8 *&data);
+	void op_setRepeatSectionMarker1(const uint8 *&data);
+	void op_repeatSection1(const uint8 *&data);
+	void op_setRepeatSectionMarker2(const uint8 *&data);
+	void op_repeatSection2(const uint8 *&data);
+	void op_setSpeed(const uint8 *&data);
+	void op_panEffect(const uint8 *&data);
+	void op_transposeCr(const uint8 *&data);
+	void op_toggleLFO(const uint8 *&data);
+	void op_setVolume(const uint8 *&data);
+	void op_volumeSlide(const uint8 *&data);
+	void op_portamento(const uint8 *&data);
+	void op_pitchWheel(const uint8 *&data);
+	void op_transposeFn(const uint8 *&data);
+	void op_lfoSensivity(const uint8 *&data);
+	void op_ampModSensitivity(const uint8 *&data);
+	void op_setThemeMarker(const uint8 *&data);
+	void op_repeatTheme(const uint8 *&data);
+	void op_vibratoDepthModulation(const uint8 *&data);
+	void op_envRate(const uint8 *&data);
+	void op_changePitchBendMod(const uint8 *&data);
+	void op_jump(const uint8 *&data);
+	void op_jumpToSubroutine(const uint8 *&data);
+	void op_return(const uint8 *&data);
+
+#ifdef SNDDRV_DEBUG
+	typedef Common::Functor1Mem<const uint8*&, void, KonamiMCDSndChannel> ChanOpcodeFunc;
+	struct ChanOpcode {
+		ChanOpcode(ChanOpcodeFunc *func, const char *desc, int chan, int dataLen) : _func(func), _desc(desc), _chan(chan), _dataLen(dataLen) {}
+		~ChanOpcode() { delete _func; }
+		bool isValid() { return _func->isValid(); }
+		void operator()(const uint8*& data) const {
+			Common::String dstr = "";
+			for (int i = 0; i < _dataLen; ++i)
+				dstr += Common::String::format("%02X ", data[i]);
+			debug( "Channel %d: %s() [ %s]", _chan, _desc, dstr.c_str());
+			(*_func)(data);
+		}
+		ChanOpcodeFunc *_func;
+		const char *_desc;
+		const int _dataLen;
+		const int _chan;
+	};
+#else
+	typedef Common::Functor1Mem<const uint8*&, void, KonamiMCDSndChannel> ChanOpcode;
+#endif	
+	Common::Array<Common::SharedPtr<ChanOpcode> > _opcodes;
+
+	static const uint8 _carrier[8];
+};
+
+class KonamiMCDSndChannelDef : public KonamiMCDSndChannel {
+public:
+	KonamiMCDSndChannelDef(int id, SegaAudioInterface *sai, SndDriverState &state) : KonamiMCDSndChannel(id, sai, state) {}
+	~KonamiMCDSndChannelDef() override {}
+	bool checkTicker() override;
+	void update() override;
+};
+
+class KonamiMCDSndChannelRtm : public KonamiMCDSndChannel {
+public:
+	KonamiMCDSndChannelRtm(int id, SegaAudioInterface *sai, SndDriverState &state) : KonamiMCDSndChannel(id, sai, state) {}
+	~KonamiMCDSndChannelRtm() override {}
+	bool checkTicker() override;
+	void update() override;
+};
+
+class KonamiMCDAudioDriver : public SegaAudioPluginDriver {
+public:
+	KonamiMCDAudioDriver(Audio::Mixer *mixer, MessageHandler *msg = nullptr);
+	~KonamiMCDAudioDriver();
+
+	bool init();
+	bool loadData(const uint8 *data, uint32 dataSize);
+
+	void doCommand(int cmd, int arg);
+	void setVolume(uint8 vol1, uint8 vol2);
+
+	uint8 getStatus() const;
+
+	void timerCallbackA() override;
+
+private:
+	void reset();
+	void stopChannels(int scope);
+	void disableStereoMode(bool disable);
+
+	void handleComList();
+	void nextTick();
+
+	void startSound(uint8 sndId);
+
+	void updateRtmChannels();
+	void updateSfxChannels();
+
+	const uint8 *getTrack(uint32 index) const;
+
+	SndDriverState _state;
+
+	uint8 _curSfxPrio;
+	uint8 _curTrackPrio;
+
+	uint8 _comList[32];
+	uint8 _comListWritePos;
+	uint8 _comListWritePosPrev;
+	uint8 _comListReadPos;
+
+	MessageHandler *_msg;
+
+	KonamiMCDSndChannel **_channels;
+	SegaAudioInterface *_sai;
+
+	uint8 *_instrumentData;
+	const uint16 _instrumentDataSize;
+	uint8 *_trackData;
+	const uint16 _trackDataSize;
+	uint16 _trackDataSize2;
+	uint8 *_trackDataEnd;
+};
+
+KonamiMCDSndChannel::KonamiMCDSndChannel(int id, SegaAudioInterface *sai, SndDriverState &state) : _num(id), _id(id > 7 ? id - 4 : id), _sai(sai), _state(state),
+	_regOffs((id < 7 ? id : id - 1) % 3), _part(id < 3 ? 0 : 1), _prio(0), _freqLast(0), _sndId(0), _section1RepeatCounter(0), _speed(0), _ticker(0),
+	_ampModSensitivity(0), _pitchBendSteps(0), _vbrDepthModulationRate(0), _vbrDepth(0), _velocity(0), _volSlideDuration(0), _panEffectRateCounter(0), _noteTimer(0), _eventDelayTimer(0),
+	_panEffectRate(0), _panPosition(0), _panEffectType(0),	_panEffectState(0), _pbExtSpeed(0), _transposeMSB(0), _flags(0), _program(0), _enableDelayedEffects(0), _algorithm(0),
+	_lfoSensitivityDelay(0), _regB4(0), _resetFlag(0), _section1VolAdjust(0), _section2VolAdjust(0), _section1Transpose(0), _section2Transpose(0), _pitchBendDuration(0), _volume(0),
+	_vbrDepthCur(0), _transposeLSB(0), _decayRate(0), _decayPhase(0), _pbExtTimer(0), _pbExtPos(0), _pbExtMask(0), _themeStart(nullptr), _resumeAfterThemePos(nullptr),
+	_sectionMarker1(nullptr), _sectionMarker2(nullptr), _pitchBendDelay(0), _trackCurPos(nullptr), _volTotal(0), _returnPos(nullptr), _lfoSensitivity(0), _eventDelay(0),
+	_noteDuration(0), _lastNoteDuration(0), _pitchBendDelayTimer(0), _freqTotal(0), _pitchBendRate(0), _pitchBendDest(0), _vbrDelayTimer(0), _vbrDepthModulationRateCounter(0),
+	_vbrState(0), _vbrRate(0), _vbrDepthRate(0), _volSlideRate(0), _pitchBendDist(0), _ampModSensitivityDelay(0), _instrumentData(nullptr), _vbrDelay(0),
+	_lfoSensitivityDelayTimer(0), _ampModSensitivityDelayTimer(0), _signalNoteOff(0), _section2RepeatCounter(0), _instrumentDataSize(0) {
+	_tl[0] = _tl[1] = _tl[2] = _tl[3] = 0;
+	makeFunctions();
+}
+
+void KonamiMCDSndChannel::clear() {
+	_sndId = _prio = _speed = _ticker = _pitchBendSteps = _vbrDepthModulationRate = _vbrDepth = _velocity = _volSlideDuration = _panEffectRateCounter = _noteTimer = _pbExtTimer = _pbExtSpeed = 0;
+	_flags = _program = _enableDelayedEffects = _tl[0] = _tl[1] = _tl[2] = _tl[3] = _vbrDelay = _lfoSensitivityDelayTimer = _ampModSensitivityDelayTimer = _signalNoteOff = _algorithm = 0;
+	_lfoSensitivityDelay = _resetFlag = _regB4 = _eventDelayTimer = _pitchBendDuration = _pitchBendDelay = _ampModSensitivity = _lfoSensitivity = 0;
+	_transposeMSB = 0;
+	_noteTimer = _eventDelay = _noteDuration = _lastNoteDuration = _volTotal = _panEffectRate = _panPosition = _panEffectType = _panEffectState = _pitchBendDelayTimer = _vbrDelayTimer = 0;
+	_vbrDepthModulationRateCounter = _vbrState = _vbrRate = _ampModSensitivityDelay = 0;
+	_section1RepeatCounter = _section2RepeatCounter = _section1VolAdjust = _section2VolAdjust = _decayPhase = _section1Transpose = _vbrDepthCur = _decayRate = _freqTotal = 0;
+	_pitchBendRate = _pitchBendDest = _vbrDepthRate = _freqLast = _pbExtPos = _pbExtMask = _volume = _volSlideRate = _pitchBendDist = 0;
+	_section1Transpose = _section2Transpose = _transposeLSB = 0;
+	_themeStart = _resumeAfterThemePos = _sectionMarker1 = _sectionMarker2 = _trackCurPos = _returnPos = nullptr;
+	_state.volUpdate &= ~(1 << _id);
+}
+
+void KonamiMCDSndChannel::loadInstrumentData(const uint8 *data, uint32 dataSize) {
+	_instrumentData = data;
+	_instrumentDataSize = dataSize;
+}
+
+void KonamiMCDSndChannel::initSound(const uint8 *data, const uint8 *dataEnd, uint8 sndId, int16 prio) {
+	_sndId = sndId;
+	_trackStart = _themeStart = _sectionMarker1 = _sectionMarker2 = _trackCurPos = data;
+	_dataEnd = dataEnd;
+	_speed = _program = 0xFF;
+	_eventDelayTimer = _ticker = 1;
+	_volume = 0x7F00;
+	_velocity = 0x7F;
+	_flags = 0;
+
+	if (prio != -1) {
+		_prio = prio;
+		_flags |= 1;
+	}
+
+	_pbExtSpeed = _volSlideDuration = _panEffectRateCounter = _section2RepeatCounter = _section1RepeatCounter = _noteTimer = _eventDelay = _noteDuration = 
+		_lastNoteDuration = _regB4 = _lfoSensitivityDelay = _ampModSensitivityDelay = _pitchBendDuration = _vbrDepthModulationRate = _vbrDepth = _pitchBendSteps = _volTotal = 0;
+	_transposeMSB = 0;
+	_section1VolAdjust = _section2VolAdjust = _section1Transpose = _vbrDepthCur = _decayRate = _freqLast = 0;
+	_section1Transpose = _section2Transpose = _transposeLSB = 0;
+	_state.volUpdate &= ~(1 << _id);
+
+	if (_id < 6)
+		_resetFlag = 1;
+}
+
+void KonamiMCDSndChannel::setVolume(int vol) {
+	if (blockedBySfx())
+		return;
+
+	static const uint8 volReg[] = { 0x40, 0x48, 0x44, 0x4C };
+	uint8 cr = _carrier[_algorithm];
+
+	for (int i = 3; i >= 0; --i) {
+		if (cr & 0x80)
+			writeReg(volReg[i], MIN<uint16>(_tl[i] + 127 - vol, 127));
+		cr <<= 1;
+	}
+}
+
+void KonamiMCDSndChannel::writeReg(uint8 reg, uint8 val) {
+	_sai->writeReg(_part, reg + _regOffs, val);
+}
+
+void KonamiMCDSndChannel::stop() {
+	_sndId = _prio = 0;
+	if (_id < 6)
+		_resetFlag = 1;
+}
+
+void KonamiMCDSndChannel::off() {
+	for (uint8 r = 0x80; r < 0x90; r += 4)
+		writeReg(r, 0xFF);
+	keyOff();
+}
+
+bool KonamiMCDSndChannelDef::checkTicker() {
+	bool oflw = (_ticker + _speed) > 0xFF;
+	_ticker += _speed;
+	return oflw;
+}
+
+bool KonamiMCDSndChannelRtm::checkTicker() {
+	bool oflw = (_ticker + _speed) > 0xFF;
+	_ticker += _speed;
+	if (!oflw || --_eventDelayTimer)
+		return false;
+	return true;
+}
+
+void KonamiMCDSndChannelDef::update() {
+	if ((_num == 4 || _num == 5) && _state.restore[_num - 4]) {
+		_state.flags |= SndDriverState::kSndKeepPanPos;
+		setProgram(_program);
+		_state.flags &= ~SndDriverState::kSndKeepPanPos;
+		_decayPhase = 0xFFFF;
+		recalcAndSetChannelVolume();
+		_state.restore[_num - 4] = 0;
+	}
+
+	if (_resetFlag) {
+		setParameter(0, 0);
+		chanOff();
+		_resetFlag = 0;
+	}
+
+	if (_sndId == 0)
+		return;
+
+	if (checkTicker()) {
+		_enableDelayedEffects = 1;
+		nextTick(_trackCurPos);
+	} else {
+		_enableDelayedEffects = 0;
+		updateVolumeAndFrequency();
+	}
+}
+
+void KonamiMCDSndChannelRtm::update() {
+	for (bool lp = true; lp; ) {
+		checkPtr(_trackCurPos, 1, __FUNCTION__);
+		uint8 in = *_trackCurPos++;
+		if (in < 96)
+			continue;
+		if (in < 224) {
+			addToMessage(in - 96, _trackCurPos);
+			lp = false;
+		} else {
+			_state.flags &= ~SndDriverState::kSndParseBreak;
+			runOpcode(in - 224, _trackCurPos);
+			lp = !(_state.flags & SndDriverState::kSndParseBreak);
+		}
+	}
+}
+
+void KonamiMCDSndChannel::nextTick(const uint8 *&data) {
+	if (--_eventDelayTimer == 0) {
+		for (bool lp = true; lp; ) {
+			checkPtr(data, 1, __FUNCTION__);
+			uint8 in = *data++;
+			if (in > 223) {
+				_state.flags &= ~SndDriverState::kSndParseBreak;
+				runOpcode(in - 224, data);
+				lp = !(_state.flags & SndDriverState::kSndParseBreak);
+			} else if ((in & 0x7F) > 95) {
+				continue;
+			} else if (in) {
+				noteOn(in, data);
+				lp = false;
+			}
+		}
+	} else {
+		if (_panEffectRate != 0)
+			panEffect();
+
+		if (_lfoSensitivityDelay)
+			applyLFOSensitivity();
+
+		if (_ampModSensitivityDelay)
+			applyAmpModSensitivity();
+
+		if (_noteDuration != 0 && _noteDuration != 127)
+			checkNoteTimer();
+
+		if (_eventDelayTimer == 1 && (_id & 1) && *data == 0xE2)
+			programChange(++data);
+
+		updateVolumeAndFrequency();
+	}
+}
+
+void KonamiMCDSndChannel::updateVolumeAndFrequency() {
+	_state.flags &= ~SndDriverState::kSndPitchAdjust;
+	if (_pitchBendSteps)
+		applyPitchBend();
+
+	int16 v = getVbrModifier();
+	applyFreqModifiers(v);
+
+	if (_flags & kChBlockVolume) {
+		_flags &= ~kChBlockVolume;
+		return;
+	}
+
+	if (_volSlideDuration)
+		applyVolumeSlide();
+
+	if (_state.volume1 != 0xFF || _state.volume2 != 0xFF)
+		_state.volUpdate = 0x33F;
+
+	if (_state.volUpdate & (1 << _id))
+		recalcAndSetChannelVolume();
+}
+
+void KonamiMCDSndChannel::chanOff() {
+	if (!blockedBySfx()) {
+		for (uint8 r = 0x80; r < 0x90; r += 4)
+			writeReg(r, 0xFF);
+	}
+	keyOff();
+}
+
+void KonamiMCDSndChannel::noteOn(uint8 note, const uint8 *&data) {
+#ifdef SNDDRV_DEBUG
+	const uint8 *dbgStart = data;
+#endif
+	if (_signalNoteOff) {
+		_signalNoteOff = 0;
+		keyOff();
+	}
+	_state.volUpdate |= (1 << _id);
+
+	if (!(note & 0x80)) {
+		checkPtr(data, 1, __FUNCTION__);
+		_eventDelay = *data++;
+	}
+
+	_eventDelayTimer = _eventDelay;
+
+	checkPtr(data, 1, __FUNCTION__);
+	uint8 a = *data++; // if flagged with 0x80, this is the new duration, otherwise it's the velocity
+	uint8 b = (a & 0x80) ? _noteDuration : a;
+
+	if (b != 0 && b != 127 && _eventDelay == 1)
+		_signalNoteOff = 1;
+	_noteDuration = b;
+
+	if (a & 0x80) {
+		_velocity = a & 0x7F;
+	} else {
+		checkPtr(data, 1, __FUNCTION__);
+		_velocity = (*data++) & 0x7F;
+	}
+
+	_noteTimer = (_noteDuration != 0 && _noteDuration != 127) ? MAX<uint8>(1, (_noteDuration * 2 * _eventDelay) >> 8) : _eventDelay;
+
+	uint16 fn = _freqTotal;
+	_freqTotal = (((note + _transposeMSB) << 8) + _section1Transpose + _section2Transpose + _transposeLSB) & 0x7FFF;
+
+	_vbrDelayTimer = _vbrDelay;
+	_lfoSensitivityDelayTimer = _lfoSensitivityDelay;
+	_ampModSensitivityDelayTimer = _ampModSensitivityDelay;
+	_vbrDepthModulationRateCounter = _vbrDepthModulationRate;
+	if (_vbrDepthModulationRateCounter != 0)
+		_vbrDepthCur = 0;
+	_vbrState = 0;
+	_decayPhase = 0;
+
+	checkPtr(data, 1, __FUNCTION__);
+	if (!*data)
+		++data;
+
+	if (*data == 0xF3) {
+		setPitchBend(data);
+	} else {
+		_pitchBendSteps = _pitchBendDuration;
+		if (_pitchBendDuration)
+			calcPitchBend(fn);
+	}
+
+	setFrequency(_freqTotal);
+
+	if (_lfoSensitivityDelay)
+		setParameter(1, 0);
+
+	if (_ampModSensitivityDelay)
+		setParameter(2, 0);
+
+	if (_flags & kChBlockVolume) {
+		_flags &= ~kChBlockVolume;
+	} else {
+		if (_volSlideDuration)
+			applyVolumeSlide();
+
+		if (_state.volume1 != 0xFF || _state.volume2 != 0xFF)
+			_state.volUpdate = 0x33F;
+
+		if (_state.volUpdate & (1 << _id))
+			recalcAndSetChannelVolume();
+	}
+
+	if (_lastNoteDuration != 127)
+		keyOn();
+
+	_lastNoteDuration = _noteDuration;
+
+#ifdef SNDDRV_DEBUG
+	Common::String dbgMsg = Common::String::format("%02X ", note);
+	for (int i = 0; i < data - dbgStart; ++i)
+		dbgMsg += Common::String::format("%02X ", dbgStart[i]);
+	debug("Channel %d: noteOn(): [ %s]", _num, dbgMsg.c_str());
+#endif
+}
+
+void KonamiMCDSndChannel::runOpcode(uint8 opcode, const uint8 *&data) {
+	if (opcode < _opcodes.size() && _opcodes[opcode]->isValid())
+		(*_opcodes[opcode])(data);
+	else
+		error("%s(): Invalid opcode %d", __FUNCTION__, opcode);
+}
+
+void KonamiMCDSndChannel::addToMessage(uint8 cmd, const uint8 *&data) {
+	if (_id == 7)
+		_state.msg[1] |= (cmd << 3); 
+	else
+		_state.msg[0] |= cmd;
+
+	uint16 v = 0;
+	checkPtr(data, 3, __FUNCTION__);
+	_eventDelayTimer = _eventDelay = *data++;
+	_lastNoteDuration = *data++;
+	v = ((*data++) * (_volume >> 8)) >> 9;
+
+	if (_id == 7) {
+		_state.msg[2] |= (v & 0xFF);
+	} else {
+		_state.msg[1] |= (v & 7);
+		_state.msg[2] |= ((v << 2) & 0x60);
+	}
+}
+
+void KonamiMCDSndChannel::panEffect() {
+	static const uint8 panTable[4][12] = {
+		{ 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80, 0x40, 0x80 },
+		{ 0xc0, 0x40, 0xc0, 0x80, 0xc0, 0x40, 0xc0, 0x80, 0xc0, 0x40, 0xc0, 0x80 },
+		{ 0xc0, 0x40, 0x80, 0xc0, 0x40, 0x80, 0xc0, 0x40, 0x80, 0xc0, 0x40, 0x80 },
+		{ 0xc0, 0x80, 0x40, 0xc0, 0x80, 0x40, 0xc0, 0x80, 0x40, 0xc0, 0x80, 0x40 }
+	};
+
+	if (--_panEffectRateCounter)
+		return;
+	_panEffectRateCounter = _panEffectRate;
+
+	assert(_panEffectType < 4);
+	assert(_panEffectState < 12);
+	_panPosition = panTable[_panEffectType][_panEffectState];
+	_panEffectState = (_panEffectState + 1) % 12;
+
+	setParameter(3, _panPosition);
+}
+
+void KonamiMCDSndChannel::applyLFOSensitivity() {
+	if (_lfoSensitivityDelayTimer && !--_lfoSensitivityDelayTimer)
+		setParameter(1, _lfoSensitivity);
+}
+
+void KonamiMCDSndChannel::applyAmpModSensitivity() {
+	if (_ampModSensitivityDelayTimer && !--_ampModSensitivityDelayTimer)
+		setParameter(2, _ampModSensitivity);
+}
+
+void KonamiMCDSndChannel::checkNoteTimer() {
+	if (_noteTimer != 0) {
+		if (--_noteTimer)
+			return;
+		keyOff();
+	}
+
+	if (_decayRate != 0) {
+		_state.volUpdate |= (1 << _id);
+		_decayPhase = MIN<uint32>(_decayPhase + _decayRate, 0xFFFF);
+	}
+}
+
+void KonamiMCDSndChannel::applyPitchBend() {
+	if (_pitchBendDelayTimer) {
+		if (_enableDelayedEffects)
+			--_pitchBendDelayTimer;
+		return;
+	}
+
+	if (--_pitchBendSteps)
+		_freqTotal += _pitchBendRate;
+	else
+		_freqTotal = _pitchBendDest;
+
+	_state.flags |= SndDriverState::kSndPitchAdjust;
+}
+
+void KonamiMCDSndChannel::applyVolumeSlide() {
+	if (--_volSlideDuration)
+		_volume += _volSlideRate;
+	else
+		_volume = _volSlideDest << 8;
+	_state.volUpdate |= (1 << _id);
+}
+
+void KonamiMCDSndChannel::keyOff() {
+	if (blockedBySfx() || _id > 5)
+ 		return;
+	_sai->writeReg(0, 0x28, _id + (_id > 2 ? 1 : 0));
+}
+
+void KonamiMCDSndChannel::keyOn() {
+	if (blockedBySfx() || _id > 5)
+		return;
+	_sai->writeReg(0, 0x28, 0xF0 + _id + (_id > 2 ? 1 : 0));
+}
+
+void KonamiMCDSndChannel::programChange(const uint8 *&data) {
+	checkPtr(data, 1, __FUNCTION__);
+	uint8 prg = *data++;
+	if (prg == _program)
+		return;
+	_program = prg;
+	_decayRate = 0;
+	setProgram(prg);
+}
+
+void KonamiMCDSndChannel::setPitchBend(const uint8 *&data) {
+	++data;
+	checkPtr(data, 3, __FUNCTION__);
+	_pitchBendDelayTimer = *data++;
+	_pitchBendSteps = *data++;
+	_pitchBendDest = (_transposeMSB + *data++) << 8;
+	if (!_pitchBendSteps)
+		return;
+	checkPtr(data, 3, __FUNCTION__);
+	++data;
+	_pitchBendRate = READ_LE_INT16(data); // really LE
+	data += 2;
+}
+
+void KonamiMCDSndChannel::calcPitchBend(uint16 lastFreq) {
+	_pitchBendDelayTimer = _pitchBendDelay;
+	if (_flags & KChPortamento) {
+		SWAP(_freqTotal, lastFreq);
+		if (lastFreq >= 0x8000)
+			lastFreq = 0;
+		else if (lastFreq >= 0x6000)
+			lastFreq = 0x5FFF;
+		_pitchBendDest = lastFreq;
+
+		int16 diff = lastFreq - _freqTotal;
+		if (diff == 0)
+			diff = 1;
+
+		_pitchBendRate = diff / _pitchBendSteps;
+
+	} else {
+		_pitchBendDest = _freqTotal;
+		_freqTotal -= _pitchBendDist;
+	}
+}
+
+void KonamiMCDSndChannel::jump(const uint8 *&data) {
+	checkPtr(data, 4, __FUNCTION__);
+	data += READ_BE_INT32(data);
+	checkPtr(data, 1, __FUNCTION__);
+}
+
+void KonamiMCDSndChannel::checkPtr(const uint8 *data, uint8 bytesNeeded, const char *caller) {
+	if (data < _trackStart || data > _dataEnd - bytesNeeded)
+		error("%s(): Invalid memory access attempt", caller);
+}
+
+void KonamiMCDSndChannel::finish() {
+	if ((_state.flags & SndDriverState::kSndSfxIsPlaying) && (_id == 4 || _id == 5) && (_state.flags & (_id - 3))) {
+		_state.flags &= ~(_id - 3);
+		_state.sfxId[_id - 4] = 0;
+		_state.restore[_id - 4] = 1;
+		_prio = 0;
+		_sai->setSoundEffectChanMask(0x1E00 | ((_state.flags & (SndDriverState::kSndLockSfxChan1 | SndDriverState::kSndLockSfxChan2)) << 4));
+	}
+
+	if (!(_state.flags & (SndDriverState::kSndLockSfxChan1 | SndDriverState::kSndLockSfxChan2))) {
+		_state.flags &= ~SndDriverState::kSndSfxIsPlaying;
+		_state.progress |= 0x40;
+	}
+}
+
+int16 KonamiMCDSndChannel::getVbrModifier() {
+	if (!_vbrDepth || _vbrDelayTimer) {
+		if (_vbrDepth && _enableDelayedEffects)
+			--_vbrDelayTimer;
+		return 0;
+	}
+
+	if (_vbrDepthModulationRateCounter && _enableDelayedEffects) {
+		if (--_vbrDepthModulationRateCounter) {
+			_vbrDepthCur += _vbrDepthRate;
+		} else {
+			_vbrDepthCur = _vbrDepth << 8;
+		}
+	}
+
+	_vbrState += _vbrRate;
+	_state.flags |= SndDriverState::kSndPitchAdjust;
+
+	static const uint8 vbrTable[] = {
+		0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+		0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+		0x20, 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11,
+		0x10, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01
+	};
+
+	int16 res = vbrTable[(_vbrState >> 1) & 0x3F] * (_vbrDepthCur >> 8);
+	if (!(_vbrDepth & 0x80))
+		res >>= 2;
+
+	return (_vbrState & 0x80) ? -res : res;
+}
+
+void KonamiMCDSndChannel::applyFreqModifiers(int16 vbrMod) {
+	int16 pbExtMod = 0;
+	if (_pbExtSpeed) {
+		bool ovflw = (_pbExtTimer + _pbExtSpeed > 0xFF);
+		_pbExtTimer += _pbExtSpeed;
+		if (!ovflw)
+			return;
+		pbExtMod = READ_BE_INT16(StaticRes_SCD::_fmSndPitchSpecialTable + _pbExtPos) & _pbExtMask;
+		_pbExtPos = (_pbExtPos + 1) & 0x1FF;
+	}
+
+	if (!pbExtMod && !(_state.flags & SndDriverState::kSndPitchAdjust))
+		return;
+
+	setFrequency(vbrMod + pbExtMod + _freqTotal);
+}
+
+void KonamiMCDSndChannel::recalcAndSetChannelVolume() {
+	int vol = MAX<int>(0, _velocity - (_decayPhase >> 8) - (127 - (_volume >> 8)) + _section1VolAdjust + _section2VolAdjust);
+	if (vol < 128)
+		vol = 64 + (vol >> 1);
+	else
+		vol = 127;
+	_volTotal = vol;
+
+	if (_state.volume2 != 0xFF)
+		vol = (vol * (_state.volume2 >> 1)) >> 7;
+
+	if (_state.volume1 != 0xFF) {
+		if (!(_state.flags & SndDriverState::kSndSfxMode) || (_id != 4 && _id != 5) || !(_state.flags & (_id - 3)))
+			vol = (vol * (_state.volume1 >> 1)) >> 7;
+	}
+
+	setVolume(vol & 0xFF);
+	_state.volUpdate &= ~(1 << _id);
+}
+
+void KonamiMCDSndChannel::setParameter(uint8 para, uint8 val) {
+	static const uint8 mask[4] = { 0xC0, 0xF0, 0xCF, 0x3F };
+	assert(para < ARRAYSIZE(mask));
+	_regB4 &= mask[para];
+
+	if (para > 0) {
+		if (blockedBySfx())
+			return;
+		_regB4 |= val;
+	}
+
+	// Stereo disabled
+	if (_state.flags & SndDriverState::kSndDisableStereo)
+		_regB4 |= 0xC0;
+
+	writeReg(0xB4, _regB4);
+}
+
+void KonamiMCDSndChannel::setFrequency(uint16 frq) {
+	if (blockedBySfx())
+		return;
+
+	static const uint8 freqTableA[128] = {
+		0x26, 0x28, 0x2c, 0x2d, 0x30, 0x34, 0x36, 0x39, 0x3d, 0x40, 0x44, 0x49, 0x26, 0x28, 0x2c, 0x2d,
+		0x30, 0x34, 0x36, 0x39, 0x3d, 0x40, 0x44, 0x49, 0x26, 0x28, 0x2c, 0x2d, 0x30, 0x34, 0x36, 0x39,
+		0x3d, 0x40, 0x44, 0x49, 0x26, 0x28, 0x2c, 0x2d, 0x30, 0x34, 0x36, 0x39, 0x3d, 0x40, 0x44, 0x49,
+		0x26, 0x28, 0x2c, 0x2d, 0x30, 0x34, 0x36, 0x39, 0x3d, 0x40, 0x44, 0x49, 0x26, 0x28, 0x2c, 0x2d,
+		0x30, 0x34, 0x36, 0x39, 0x3d, 0x40, 0x44, 0x49, 0x26, 0x28, 0x2c, 0x2d, 0x30, 0x34, 0x36, 0x39,
+		0x3d, 0x40, 0x44, 0x49, 0x26, 0x28, 0x2c, 0x2d, 0x30, 0x34, 0x36, 0x39, 0x3d, 0x40, 0x44, 0x49,
+		0x06, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x0a, 0x09, 0x0a, 0x0b, 0x0b, 0x0c, 0x0d, 0x0e, 0x0e,
+		0x0f, 0x10, 0x11, 0x24, 0x13, 0x14, 0x16, 0x16, 0x18, 0x1a, 0x1b, 0x1d, 0x1e, 0x20, 0x22, 0x25
+	};
+
+	static const uint16 freqTableB[128] = {
+		0x0284, 0x02aa, 0x02d2, 0x02fe, 0x032b, 0x035b, 0x038f, 0x03c5,	0x03fe, 0x043b, 0x047b, 0x04bf, 0x0a84, 0x0aaa, 0x0ad2, 0x0afe,
+		0x0b2b, 0x0b5b, 0x0b8f, 0x0bc5, 0x0bfe, 0x0c3b, 0x0c7b, 0x0cbf,	0x1284, 0x12aa, 0x12d2, 0x12fe, 0x132b, 0x135b, 0x138f, 0x13c5,
+		0x13fe, 0x143b, 0x147b, 0x14bf, 0x1a84, 0x1aaa, 0x1ad2, 0x1afe,	0x1b2b, 0x1b5b, 0x1b8f, 0x1bc5, 0x1bfe, 0x1c3b, 0x1c7b, 0x1cbf,
+		0x2284, 0x22aa, 0x22d2, 0x22fe, 0x232b, 0x235b, 0x238f, 0x23c5,	0x23fe, 0x243b, 0x247b, 0x24bf, 0x2a84, 0x2aaa, 0x2ad2, 0x2afe,
+		0x2b2b, 0x2b5b, 0x2b8f, 0x2bc5, 0x2bfe, 0x2c3b, 0x2c7b, 0x2cbf,	0x3284, 0x32aa, 0x32d2, 0x32fe, 0x332b, 0x335b, 0x338f, 0x33c5,
+		0x33fe, 0x343b, 0x347b, 0x34bf, 0x3a84, 0x3aaa, 0x3ad2, 0x3afe, 0x3b2b, 0x3b5b, 0x3b8f, 0x3bc5, 0x3bfe, 0x3c3b, 0x3c7b, 0x3cbf,
+		0x3d08, 0x006b, 0x0071, 0x0078, 0x007f, 0x0087, 0x008f, 0x0097, 0x00a1, 0x00aa, 0x00b4, 0x00bf, 0x00ca, 0x00d6, 0x00e3, 0x00f1,
+		0x00ff, 0x010e, 0x011e, 0x012f, 0x0142, 0x0155, 0x0169, 0x017f, 0x0195, 0x01ad, 0x01c7, 0x01e2, 0x01ff, 0x021d, 0x023d, 0x025f
+	};
+
+	frq &= 0x7fff;
+	_freqLast = frq;
+
+	frq = (((frq & 0xFF) * freqTableA[frq >> 8]) >> 8) + freqTableB[frq >> 8];
+
+	writeReg(0xA4, frq >> 8);
+	writeReg(0xA0, frq & 0xFF);
+}
+
+void KonamiMCDSndChannel::setProgram(uint8 prg) {
+	if (blockedBySfx())
+		return;
+#ifdef SNDDRV_DEBUG
+	debug("Channel %d: Setting program %d", _num, prg);
+#endif
+	const uint8 *in = _instrumentData;
+	assert(in);
+	assert((uint32)(prg << 2) < _instrumentDataSize);
+	in = in + READ_BE_UINT32(in + (prg << 2));
+	assert(in < _instrumentData + _instrumentDataSize);
+
+	writeReg(0xB0, *in);
+	_algorithm = (*in++) & 7;
+	uint8 cr = _carrier[_algorithm] >> 4;
+
+	static const uint8 regSteps[] = { 0x00, 0x08, 0x04, 0x0C };
+
+	for (int i = 0x00; i < 4; i += 1) {
+		writeReg(0x30 + regSteps[i], *in++);
+		writeReg(0x40 + regSteps[i], (cr & 1) ? 0xFF : *in);
+		_tl[i] = *in++;
+		cr >>= 1;
+		for (uint8 reg = 0x50; reg < 0x90; reg += 0x10)
+			writeReg(reg + regSteps[i], *in++);
+	}
+
+	if (!(_state.flags & SndDriverState::kSndKeepPanPos)) {
+		_panPosition = 0xC0;
+		_panEffectRate = 0;
+	}
+
+	setParameter(3, _panPosition);
+}
+
+void KonamiMCDSndChannel::makeFunctions() {
+#ifdef SNDDRV_DEBUG
+	#define OP(x) { &KonamiMCDSndChannel::op_##x, #x }
+	#define FnObj ChanOpcode(new ChanOpcodeFunc(this, opcTable[i].func), opcTable[i].name, _num, dbytes[i])
+	typedef void(KonamiMCDSndChannel::*OpFunc)(const uint8*&);
+	static const uint8 dbytes[] = {
+		1, 2, 1, 1, 3, 3, 0, 3, 0, 3, 1, 2, 1, 1, 1, 2,
+		1, 3, 1, 0, 2, 2, 0, 0, 0, 1, 0, 1, 2, 4, 4, 0
+	};
+	struct TableEntry {
+		OpFunc func;
+		const char *name;
+	};
+#else
+	#define OP(x) &KonamiMCDSndChannel::op_##x
+	#define FnObj ChanOpcode(this, opcTable[i])
+	typedef void(KonamiMCDSndChannel::*TableEntry)(const uint8*&);
+#endif
+
+	static const TableEntry opcTable[] = {
+		OP(break_toneOff),
+		OP(break_keepTone),
+		OP(programChange),
+		OP(panPos),
+		OP(vibrato),
+		OP(pitchBendSpecial),
+		OP(setRepeatSectionMarker1),
+		OP(repeatSection1),
+		OP(setRepeatSectionMarker2),
+		OP(repeatSection2),
+		OP(setSpeed),
+		OP(panEffect),
+		OP(transposeCr),
+		OP(toggleLFO),
+		OP(setVolume),
+		OP(volumeSlide),
+		OP(portamento),
+		OP(pitchWheel),
+		OP(transposeFn),
+		OP(nop),
+		OP(lfoSensivity),
+		OP(ampModSensitivity),
+		OP(setThemeMarker),
+		OP(repeatTheme),
+		OP(nop),
+		OP(vibratoDepthModulation),
+		OP(nop),
+		OP(envRate),
+		OP(changePitchBendMod),
+		OP(jump),
+		OP(jumpToSubroutine),
+		OP(return)
+	};
+
+	for (int i = 0; i < ARRAYSIZE(opcTable); ++i)
+		_opcodes.push_back(Common::SharedPtr<ChanOpcode>(new FnObj));
+
+#undef OP
+#undef FnObj
+}
+
+void KonamiMCDSndChannel::op_nop(const uint8*&) {
+	// No operation
+}
+
+void KonamiMCDSndChannel::op_break_toneOff(const uint8 *&data) {
+	checkPtr(data, 1, __FUNCTION__);
+	_eventDelayTimer = _eventDelay = *data++;
+	_noteDuration = _lastNoteDuration = _noteTimer = _velocity = 0;
+	keyOff();
+	_state.flags |= SndDriverState::kSndParseBreak;
+}
+
+void KonamiMCDSndChannel::op_break_keepTone(const uint8 *&data) {
+	checkPtr(data, 2, __FUNCTION__);
+	_eventDelayTimer = _eventDelay = *data++;
+	_noteDuration = _lastNoteDuration = *data++;
+	_noteTimer = MAX<uint8>(1, (_noteDuration * 2 * _eventDelay) >> 8);
+	_state.flags |= SndDriverState::kSndParseBreak;
+}
+
+void KonamiMCDSndChannel::op_programChange(const uint8 *&data) {
+	programChange(data);
+}
+
+void KonamiMCDSndChannel::op_panPos(const uint8 *&data) {
+	static const uint8 flags[] = { 0x80, 0xC0, 0x40, 0x00 };
+	assert(*data < ARRAYSIZE(flags));
+	checkPtr(data, 1, __FUNCTION__);
+	_panPosition = flags[*data++];
+	_panEffectRate = 0;
+	setParameter(3, _panPosition);
+}
+
+void KonamiMCDSndChannel::op_vibrato(const uint8 *&data) {
+	checkPtr(data, 3, __FUNCTION__);
+	_vbrDelay = *data++;
+	_vbrRate = *data++;
+	_vbrDepth = *data++;
+	_vbrDepthCur = _vbrDepth << 8;
+	_vbrDepthModulationRate = 0;
+}
+
+void KonamiMCDSndChannel::op_pitchBendSpecial(const uint8 *&data) {
+	checkPtr(data, 3, __FUNCTION__);
+	_pbExtSpeed = *data++;
+	_pbExtMask = READ_BE_UINT16(data);
+	_pbExtPos = 0;
+	_pbExtTimer = 0;
+}
+
+void KonamiMCDSndChannel::op_setRepeatSectionMarker1(const uint8 *&data) {
+	_sectionMarker1 = data;
+}
+
+void KonamiMCDSndChannel::op_repeatSection1(const uint8 *&data) {
+	checkPtr(data, 3, __FUNCTION__);
+	uint8 val = *data++;
+	if (val == 0 || val != ++_section1RepeatCounter) {
+		int8 in = *data++;
+		if (in) {
+			_section1VolAdjust += in;
+			_state.volUpdate |= (1 << _id);
+		}
+		in = *data++;
+		_section1Transpose += (in << 3);
+		data = _sectionMarker1;
+
+	} else {
+		_section1RepeatCounter = 0;
+		_section1VolAdjust = 0;
+		_section1Transpose = 0;
+		data += 2;
+	}
+}
 
-#include "snatcher/sound_device.h"
-#include "snatcher/util.h"
+void KonamiMCDSndChannel::op_setRepeatSectionMarker2(const uint8 *&data) {
+	_sectionMarker2 = data;
+	_section2RepeatCounter = 0;
+	_section2VolAdjust = 0;
+	_section2Transpose = 0;
+}
 
-namespace Snatcher {
+void KonamiMCDSndChannel::op_repeatSection2(const uint8 *&data) {
+	checkPtr(data, 3, __FUNCTION__);
+	uint8 val = *data++;
+	if (val == 0 || val != ++_section2RepeatCounter) {
+		int8 in = *data++;
+		if (in) {
+			_section2VolAdjust += in;
+			_state.volUpdate |= (1 << _id);
+		}
+		in = *data++;
+		_section2Transpose += (in << 3);
+		data = _sectionMarker2;
+	} else {
+		data += 2;
+	}
+}
 
-class SegaSoundDevice : public SoundDevice {
-public:
-	SegaSoundDevice();
-	~SegaSoundDevice() override {}
+void KonamiMCDSndChannel::op_setSpeed(const uint8 *&data) {
+	checkPtr(data, 1, __FUNCTION__);
+	if (/*_palMode*/0)
+		_speed = MIN<uint>(((*data++ * 6) / 5) + 2, 0xFF);
+	else
+		_speed = *data++;
+}
 
-	void musicPlay(int track) override;
-	void musicStop() override;
-	bool musicIsPlaying() const override;
-	uint32 musicGetTime() const override;
+void KonamiMCDSndChannel::op_panEffect(const uint8 *&data) {
+	checkPtr(data, 2, __FUNCTION__);
+	_panEffectRate = _panEffectRateCounter = *data++;
+	_panEffectType = *data++;
+	setParameter(3, _panEffectType == 3 ? 0x40 : 0x80);
+	_panEffectState = 0;
+}
 
-	void fmStartSound(int track) override;
+void KonamiMCDSndChannel::op_transposeCr(const uint8 *&data) {
+	checkPtr(data, 1, __FUNCTION__);
+	_transposeMSB = (int8)*data++;
+}
 
-	void pcmPlayEffect(int track) override;
-	void pcmDoCommand(int cmd, int arg) override;
+void KonamiMCDSndChannel::op_toggleLFO(const uint8 *&data) {
+	checkPtr(data, 1, __FUNCTION__);
+	uint8 val = *data++;
+	if (blockedBySfx())
+		return;
+	_sai->writeReg(0, 0x22, 0x08 | val);
+}
 
-	void pause(bool toggle) override;
+void KonamiMCDSndChannel::op_setVolume(const uint8 *&data) {
+	checkPtr(data, 1, __FUNCTION__);
+	_volume = (*data++) << 8;
+	_volSlideDuration = 0;
+}
 
-private:
-	int _lastTrack;
-	uint32 _pauseStartTime;
+void KonamiMCDSndChannel::op_volumeSlide(const uint8 *&data) {
+	checkPtr(data, 2, __FUNCTION__);
+	_volSlideDuration = MAX<uint>(1, *data++);
+	_volSlideDest = *data++;
+	int16 diff = (_volSlideDest << 8) - _volume;
+	_volSlideRate = diff / _volSlideDuration;
+}
+
+void KonamiMCDSndChannel::op_portamento(const uint8 *&data) {
+	checkPtr(data, 1, __FUNCTION__);
+	_pitchBendDuration = *data++;
+	_pitchBendDelay = 0;
+	_flags |= KChPortamento;
+}
+
+void KonamiMCDSndChannel::op_pitchWheel(const uint8 *&data) {
+	checkPtr(data, 3, __FUNCTION__);
+	_pitchBendDelay = *data++;
+	_pitchBendDuration = *data++;
+	_pitchBendDist = (int8)(*data++) << 8;
+	_flags &= ~KChPortamento;
+}
+
+void KonamiMCDSndChannel::op_transposeFn(const uint8 *&data) {
+	checkPtr(data, 1, __FUNCTION__);
+	_transposeLSB = (int8)(*data++) * 4;
+}
+
+void KonamiMCDSndChannel::op_lfoSensivity(const uint8 *&data) {
+	checkPtr(data, 2, __FUNCTION__);
+	_lfoSensitivityDelay = *data++;
+	_lfoSensitivity = (*data++) << 4;
+	if (_lfoSensitivityDelay == 0)
+		setParameter(1, _lfoSensitivity);
+}
+
+void KonamiMCDSndChannel::op_ampModSensitivity(const uint8 *&data) {
+	checkPtr(data, 2, __FUNCTION__);
+	_ampModSensitivityDelay = *data++;
+	_ampModSensitivity = (*data++) << 4;
+	if (_ampModSensitivityDelay == 0)
+		setParameter(2, _ampModSensitivity);
+}
+
+void KonamiMCDSndChannel::op_setThemeMarker(const uint8 *&data) {
+	_themeStart = data;
+	_flags &= ~(kChFinishedTheme | kChRepeatingTheme);
+}
+
+void KonamiMCDSndChannel::op_repeatTheme(const uint8 *&data) {
+	if (_flags & kChFinishedTheme) {
+		_flags = (_flags & ~kChFinishedTheme) | kChRepeatingTheme;
+		_resumeAfterThemePos = data;
+		data = _themeStart;
+	} else if (_flags & kChRepeatingTheme) {
+		_flags = (_flags & ~kChRepeatingTheme) | kChFinishedTheme;
+		data = _resumeAfterThemePos;
+	} else {
+		_flags |= kChFinishedTheme;
+	}
+}
+
+void KonamiMCDSndChannel::op_vibratoDepthModulation(const uint8 *&data) {
+	checkPtr(data, 1, __FUNCTION__);
+	_vbrDepthModulationRate = *data++;
+	if (_vbrDepthModulationRate)
+		_vbrDepthRate = (int16)((_vbrDepth << 8) / _vbrDepthModulationRate);
+}
+
+void KonamiMCDSndChannel::op_envRate(const uint8 *&data) {
+	checkPtr(data, 1, __FUNCTION__);
+	_decayRate = (*data++) << 5;
+}
+
+void KonamiMCDSndChannel::op_changePitchBendMod(const uint8 *&data) {
+	checkPtr(data, 2, __FUNCTION__);
+	_pitchBendRate = READ_LE_INT16(data); // really LE
+	data += 2;
+}
+
+void KonamiMCDSndChannel::op_jump(const uint8 *&data) {
+	jump(data);
+}
+
+void KonamiMCDSndChannel::op_jumpToSubroutine(const uint8 *&data) {
+	_returnPos = data + 4;
+	_flags |= KChSubroutine;
+	jump(data);
+}
+
+void KonamiMCDSndChannel::op_return(const uint8 *&data) {
+	if (_flags & KChSubroutine) {
+		_flags &= ~KChSubroutine;
+		data = _returnPos;
+	} else {
+		_sndId = 0;
+		if (_id < 6) {
+			_flags |= kChBlockVolume;
+			chanOff();
+			keyOff();
+			finish();
+		}
+
+		_state.flags |= SndDriverState::kSndParseBreak;
+		if (!(_state.flags & SndDriverState::kSndSfxMode)) {
+			_state.chanUse &= ~(1 << _id);
+			if (_state.chanUse == 0)
+				_state.progress |= 0x80;
+		}
+
+		_state.result = _state.progress;
+		if (_state.progress & 0xC0)
+			_state.progress = ((_state.progress & 0x0F) + 1) % 16;
+		_state.result |= _state.progress;
+	}
+}
+
+const uint8 KonamiMCDSndChannel::_carrier[8] = {
+	0x80, 0x80, 0x80, 0x80, 0xA0, 0xE0, 0xE0, 0xF0
 };
 
-SegaSoundDevice::SegaSoundDevice() : SoundDevice(), _lastTrack(-1), _pauseStartTime(0) {
+KonamiMCDAudioDriver::KonamiMCDAudioDriver(Audio::Mixer *mixer, MessageHandler *msg) : SegaAudioPluginDriver(), _msg(msg), _sai(nullptr), _channels(nullptr), _state(),
+	_instrumentData(nullptr), _trackData(nullptr), _curTrackPrio(0), _comListWritePos(0), _comListWritePosPrev(0), _comListReadPos(0), _curSfxPrio(0),
+		_instrumentDataSize(7680), _trackDataSize(2630), _trackDataSize2(0), _trackDataEnd(nullptr) {
+
+	_sai = new SegaAudioInterface(mixer, this);
+	assert(_sai);
+
+	_channels = new KonamiMCDSndChannel*[10]();
+	assert(_channels);
+	for (int i = 0; i < 6; ++i)
+		_channels[i] = new KonamiMCDSndChannelDef(i, _sai, _state);
+	for (int i = 6; i < 8; ++i)
+		_channels[i] = new KonamiMCDSndChannelRtm(i, _sai, _state);
+	for (int i = 8; i < 10; ++i)
+		_channels[i] = new KonamiMCDSndChannelDef(i, _sai, _state);
+	memset(_comList, 0, sizeof(_comList));
+}
+
+KonamiMCDAudioDriver::~KonamiMCDAudioDriver() {
+	delete _sai;
+	if (_channels) {
+		for (int i = 0; i < 10; ++i)
+			delete _channels[i];
+		delete[] _channels;
+	}
+	delete[] _instrumentData;
+	delete[] _trackData;
+}
+
+bool KonamiMCDAudioDriver::init() {
+	if (!_sai->init())
+		return false;
+	_sai->writeReg(0, 0x26, 0xE9);
+	_sai->writeReg(0, 0x27, 0x3F);
+
+	return true;
+}
+
+bool KonamiMCDAudioDriver::loadData(const uint8 *data, uint32 dataSize) {
+	if (!data)
+		return false;
+
+	if (dataSize < _instrumentDataSize)
+		return false;
+
+	delete[] _instrumentData;
+	_instrumentData = new uint8[_instrumentDataSize]();
+	assert(_instrumentData);
+	memcpy(_instrumentData, data, _instrumentDataSize);
+	dataSize -= _instrumentDataSize;
+	data += _instrumentDataSize;
+
+	if (dataSize < _trackDataSize)
+		return false;
+
+	delete[] _trackData;
+	_trackData = new uint8[dataSize]();
+	assert(_trackData);
+	memcpy(_trackData, data, dataSize);
+
+	_trackDataSize2 = dataSize - _trackDataSize;
+	_trackDataEnd = _trackData + dataSize;
+
+	for (int i = 0; i < 10; ++i)
+		_channels[i]->loadInstrumentData(_instrumentData, _instrumentDataSize);
+
+	return true;
+}
+
+void KonamiMCDAudioDriver::doCommand(int cmd, int arg) {
+	SegaAudioInterface::MutexLock lock(_sai->stackLockMutex());
+
+	if (cmd >= 241) {
+		switch (cmd) {
+		case 241:
+			reset();
+			break;
+		case 242:
+			stopChannels(0);
+			break;
+		case 243:
+			disableStereoMode(true);
+			break;
+		case 244:
+			disableStereoMode(false);
+			break;
+		default:
+			break;
+		}
+	} else if (cmd < 123) {
+		if (cmd > 49 && cmd < 63) {
+			const StaticRes_SCD::FMSoundTrackDef &d = StaticRes_SCD::_fmSndTrackDefs[cmd - 1];
+			if (_curTrackPrio <= d.prio) {
+				_curTrackPrio = d.prio;
+				_comListWritePosPrev = _comListWritePos;
+			}
+		}
+
+		_comList[_comListWritePos++] = cmd;
+		if (_comListWritePos == sizeof(_comList))
+			_comListWritePos = 0;
+	}	
+}
+
+void KonamiMCDAudioDriver::setVolume(uint8 vol1, uint8 vol2) {
+	SegaAudioInterface::MutexLock lock(_sai->stackLockMutex());
+	_state.volume1 = vol1;
+	_state.volume2 = vol2;
+}
+
+uint8 KonamiMCDAudioDriver::getStatus() const {
+	SegaAudioInterface::MutexLock lock(_sai->stackLockMutex());
+	return _state.result;
+}
+
+void KonamiMCDAudioDriver::timerCallbackA() {
+	handleComList();
+	nextTick();
+}
+
+void KonamiMCDAudioDriver::reset() {
+	if (_msg != nullptr)
+		_msg->clear();
+
+	_state.clear();
+	_comListReadPos = _comListWritePos = _comListWritePosPrev = 0;
+	_curTrackPrio = _curSfxPrio = 0;
+
+	for (int i = 0; i < 10; ++i)
+		_channels[i]->clear();
+
+	for (int i = 0; i < 6; ++i)
+		_channels[i]->off();
+}
+
+void KonamiMCDAudioDriver::stopChannels(int scope) {
+	for (int i = 0; i < 6; ++i) {
+		if (_channels[i]->busy())
+			_channels[i]->setVolume(0);
+	}
+	scope = scope ? 8 : 10;
+	for (int i = 0; i < scope; ++i)
+		_channels[i]->stop();
+}
+
+void KonamiMCDAudioDriver::disableStereoMode(bool disable) {
+	if (disable)
+		_state.flags |= SndDriverState::kSndDisableStereo;
+	else
+		_state.flags &= ~SndDriverState::kSndDisableStereo;
+}
+
+void KonamiMCDAudioDriver::handleComList() {
+	if (_comListWritePos == _comListReadPos)
+		return;
+	if (_comListWritePosPrev == _comListReadPos)
+		_curTrackPrio = 0;
+
+	uint8 cmd = _comList[_comListReadPos++];
+		if (_comListReadPos == sizeof(_comList))
+			_comListReadPos = 0;
+
+	switch (cmd) {
+	case 0:
+		break;
+	case 241:
+		reset();
+		break;
+	case 242:
+		stopChannels(0);
+		break;
+	case 243:
+		disableStereoMode(true);
+		break;
+	case 244:
+		disableStereoMode(false);
+		break;
+	default:
+		startSound(cmd);
+		break;
+	}
+}
+
+void KonamiMCDAudioDriver::nextTick() {
+	if (_state.volume1 < 21 || _state.volume2 < 21) {
+		if (!(_state.flags & SndDriverState::kSndFadeoutDone)) {
+			_state.flags |= SndDriverState::kSndFadeoutDone;
+			stopChannels(1);
+		}			
+	} else {
+		_state.flags &= ~SndDriverState::kSndFadeoutDone;
+		if (!(_state.flags & SndDriverState::kSndBlockChannels)) {
+			for (int i = 0; i < 6; ++i)
+				_channels[i]->update();
+		}
+
+		updateRtmChannels();
+
+		if (_state.flags & SndDriverState::kSndBlockChannels) {
+			_state.flags &= ~SndDriverState::kSndBlockChannels;
+			return;
+		}
+	}
+
+	updateSfxChannels();
+}
+
+void KonamiMCDAudioDriver::startSound(uint8 sndId) {
+	if ((sndId - 1) >= ARRAYSIZE(StaticRes_SCD::_fmSndTrackDefs))
+		error("%s(): Sound ID %d out of range", __FUNCTION__, sndId);
+
+	const StaticRes_SCD::FMSoundTrackDef &d = StaticRes_SCD::_fmSndTrackDefs[sndId - 1];
+
+	_state.flags &= ~SndDriverState::kSndFadeoutDone;
+
+	if (d.a & 0x0F) {
+		_state.chanUse = 0;
+		_state.flags &= ~SndDriverState::kSndSfxStarting;
+		stopChannels(0);
+	} else {
+		_state.flags |= SndDriverState::kSndSfxStarting;
+	}
+
+	if ((_state.flags & SndDriverState::kSndSfxStarting) || (d.poly < 6))
+		_state.flags &= ~SndDriverState::kSndBlockChannels;
+	else
+		_state.flags |= SndDriverState::kSndBlockChannels;
+
+	KonamiMCDSndChannel **c = &_channels[d.chan];
+	uint8 prio = (d.chan & 1) << 7;
+
+	if (sndId < 50) {
+		if (_state.sfxId[1] != sndId) {
+			if (_state.sfxId[0] != sndId) {
+				if ((*c)->getPrio() < d.prio) {
+					_state.sfxId[1] = sndId;
+				} else {
+					--c;
+					if ((*c)->getPrio() > d.prio)
+						return;
+					_state.sfxId[0] = sndId;
+				}
+			} else {
+				--c;
+			}
+		}
+	}
+
+	assert(c >= _channels);
+
+	if (_state.flags & SndDriverState::kSndSfxStarting) {
+		_state.flags &= ~(SndDriverState::kSndKeepPanPos | SndDriverState::kSndSfxMode | SndDriverState::kSndSfxIsPlaying);
+		_curSfxPrio = prio;
+	} else {
+		_state.flags &= ~(SndDriverState::kSndSfxIsPlaying - 1);
+	}
+
+	const uint8 *ptr = getTrack(d.track);
+	const uint32 *offs = reinterpret_cast<const uint32*>(ptr);
 
+	for (int i = 0; i <= d.poly; ++i) {
+		if (_state.flags & SndDriverState::kSndSfxStarting) {
+			if ((*c)->getNumber() == 9)
+				_state.flags |= SndDriverState::kSndLockSfxChan2;
+			else if ((*c)->getNumber() == 8)
+				_state.flags |= SndDriverState::kSndLockSfxChan1;
+			_sai->setSoundEffectChanMask(0x1E00 | ((_state.flags & (SndDriverState::kSndLockSfxChan1 | SndDriverState::kSndLockSfxChan2)) << 4));
+		}
+
+		(*c)->initSound(ptr + READ_BE_UINT32(offs++), _trackDataEnd, sndId, (_state.flags & SndDriverState::kSndSfxStarting) ? _curSfxPrio : -1);
+#ifdef SNDDRV_DEBUG
+		debug("Starting sound %d on channel %d", sndId, (*c)->getNumber());
+#endif
+		if (!(_state.flags & SndDriverState::kSndSfxStarting))
+			_state.chanUse |= (1 << (*c)->getId());
+		++c;
+	}
+}
+
+void KonamiMCDAudioDriver::updateRtmChannels() {
+	_state.msg[0] = _state.msg[1] = _state.msg[2] = 0;
+
+	for (int i = 6; i < 8; ++i) {
+		KonamiMCDSndChannel *c = _channels[i];
+		if (!c->busy())
+			continue;
+
+		if (c->checkTicker())
+			c->update();
+	}
+
+	if (_msg != nullptr && (_state.msg[0] || _state.msg[1] || _state.msg[2]))
+		_msg->write(_state.msg[0], _state.msg[1], _state.msg[2]);
+}
+
+void KonamiMCDAudioDriver::updateSfxChannels() {
+	if (!(_state.flags & SndDriverState::kSndBlockChannels)) {
+		_state.flags &= ~(SndDriverState::kSndKeepPanPos | SndDriverState::kSndSfxMode | SndDriverState::kSndSfxIsPlaying);
+		if (_state.flags & (SndDriverState::kSndLockSfxChan1 | SndDriverState::kSndLockSfxChan2)) {
+			_state.flags |= (SndDriverState::kSndSfxIsPlaying | SndDriverState::kSndSfxMode);
+			for (int i = 8; i < 10; ++i)
+				_channels[i]->update();
+		}
+	}
+	_state.flags &= ~SndDriverState::kSndSfxMode;
+}
+
+const uint8 *KonamiMCDAudioDriver::getTrack(uint32 index) const {
+	uint32 offset = (_state.flags & SndDriverState::kSndSfxStarting) ? 0: _trackDataSize;
+	uint32 totalSize = (_state.flags & SndDriverState::kSndSfxStarting) ? _trackDataSize : _trackDataSize2;
+	assert((index << 2) < totalSize);
+	const uint8 *res = _trackData + offset;
+	res = res + READ_BE_UINT32(&res[index << 2]);
+	assert(res < _trackData + _trackDataSize + _trackDataSize2);
+	return res;
+}
+
+SegaSoundDevice::SegaSoundDevice(FIO *fio) : _fio(fio), SoundDevice(), _sai(nullptr), _lastTrack(-1), _pauseStartTime(0), _pcmResourceInfo(nullptr), _pcmResidentDataInfo(nullptr), _pcmInstrumentInfo(nullptr),
+	_pcmSounds(nullptr), _pcmDisableStereo(false), _temp(nullptr), _pcmResourceNumber(0), _pcmState(0), _pcmMode(0), _faderFlags(0), _faderTimer1(0), _faderTimer2(0), _unkVolCond(false), 
+		_fmVolume1(0xFF), _fmLastVolume1(0), _fmVolume2(0xFF), _fmLastVolume2(0), _fmCmdQueue(nullptr), _fmCmdQueueWPos(0), _fmCmdQueueRPos(0), _fmDriver(nullptr), _driverMsg()	{
+	_temp = new uint8[0x8000]();
+	assert(_temp);
+	_pcmSounds = new PCMSound[4]();
+	assert(_pcmSounds);
+	_fmCmdQueue = new uint8[128]();
+	assert(_fmCmdQueue);
+}
+
+SegaSoundDevice::~SegaSoundDevice() {
+	delete _sai;
+	delete _fmDriver;
+	delete[] _pcmResourceInfo;
+	delete[] _pcmResidentDataInfo;
+	delete[] _pcmInstrumentInfo;
+	delete[] _temp;
+	delete[] _pcmSounds;
+	delete[] _fmCmdQueue;
+}
+
+bool SegaSoundDevice::init(Audio::Mixer *mixer) {
+	_fmDriver = new KonamiMCDAudioDriver(mixer, &_driverMsg);
+	if (!_fmDriver)
+		return false;
+
+	_sai = new SegaAudioInterface(mixer, nullptr);
+	if (!_sai || !_sai->init() || !_fmDriver->init())
+		return false;
+	// Setup first 4 pcm channels as sound effect channels.
+	_sai->setSoundEffectChanMask(0x1E00);
+
+	if (!fmLoadData() || !pcmLoadData()) {
+		delete _sai;
+		delete _fmDriver;
+		return false;
+	}
+
+	return true;
 }
 
-void SegaSoundDevice::musicPlay(int track) {
+void SegaSoundDevice::cdaPlay(int track) {
 	assert(track > 0);
 	g_system->getAudioCDManager()->play(track - 1, 1, 0, 0);
 	_lastTrack = track;
 	_musicStartTime = g_system->getMillis();
 }
 
-void SegaSoundDevice::musicStop() {
+void SegaSoundDevice::cdaStop() {
 	g_system->getAudioCDManager()->stop();
 	_lastTrack = -1;
 }
 
-bool SegaSoundDevice::musicIsPlaying() const {
+bool SegaSoundDevice::cdaIsPlaying() const {
 	return g_system->getAudioCDManager()->isPlaying();
 }
 
-uint32 SegaSoundDevice::musicGetTime() const {
-	uint32 relTime = musicIsPlaying() ? g_system->getMillis() - _musicStartTime : 0;
+uint32 SegaSoundDevice::cdaGetTime() const {
+	uint32 relTime = cdaIsPlaying() ? g_system->getMillis() - _musicStartTime : 0;
 	return Util::makeBCDTimeStamp(relTime);
 }
 
-void SegaSoundDevice::fmStartSound(int track) {
+void SegaSoundDevice::fmSendCommand(int cmd, int arg) {
+	if (cmd == 0xFF) {
+		_faderFlags |= 4;
+		return;
+	}
+	if (cmd < 241 && arg)
+		_faderFlags &= ~4;
+
+	_fmCmdQueue[_fmCmdQueueWPos++] = cmd;
+	if (_fmCmdQueueWPos == 128)
+		_fmCmdQueueWPos = 0;
+}
 
+uint8 SegaSoundDevice::fmGetStatus() const {
+	return _fmDriver->getStatus();
 }
 
-void SegaSoundDevice::pcmPlayEffect(int track) {
+void SegaSoundDevice::pcmSendCommand(int cmd, int arg) {
+	if (cmd >= 248) {
+		switch (cmd) {
+		case 252:
+			pcmDisableStereoMode(true);
+			break;
+		case 253:
+			pcmDisableStereoMode(false);
+			break;
+		case 255:
+			_pcmState &= ~8;
+			pcmStop();
+			break;
+		default:
+			break;
+		}
+	} else {
+		_pcmState |= 8;
+		pcmStartSound(cmd, arg);
+	}	
 }
 
-void SegaSoundDevice::pcmDoCommand(int cmd, int arg) {
+void SegaSoundDevice::pcmInitSound(int sndId) {
+	_pcmResourceNumber = sndId;
+	_pcmMode = _pcmResourceInfo[_pcmResourceNumber].mode;
+	if (_pcmResourceInfo[_pcmResourceNumber].mode == 1) {
+		_pcmState |= 4;
+	} else {
+		_pcmState = (_pcmState & ~8) | 1;
+	}
 }
 
+uint8 SegaSoundDevice::pcmGetStatus() const {
+	return _pcmState;
+}
 
-void SegaSoundDevice::pause(bool toggle) {
+void SegaSoundDevice::pause(bool toggle) {	
 	if (toggle) {
 		if (_pauseStartTime == 0) {
-			if (musicIsPlaying()) {
+			if (cdaIsPlaying()) {
 				_pauseStartTime = g_system->getMillis();
 				g_system->getAudioCDManager()->stop();
 			} else {
@@ -106,10 +1866,361 @@ void SegaSoundDevice::pause(bool toggle) {
 			_pauseStartTime = 0;
 		}
 	}
+	g_system->getMixer()->pauseAll(toggle);
+}
+
+void SegaSoundDevice::update() {
+	pcmCheckPlayStatus();
+	pcmHandleDriverMessage();
+	fmUpdateVolumeFader();
+	pcmDelayedStart();
+	fmHandleCmdQueue();
+}
+
+void SegaSoundDevice::setMusicVolume(int vol) {
+	_sai->setMusicVolume(vol);
+}
+
+void SegaSoundDevice::setSoundEffectVolume(int vol) {
+	_sai->setSoundEffectVolume(vol);
+}
+
+bool SegaSoundDevice::fmLoadData() {
+	uint32 dataSize = 0;
+	const uint8 *data = _fio->fileData(53, &dataSize);
+	if (!data || !dataSize)
+		return false;
+
+	bool res = _fmDriver->loadData(data, dataSize);
+
+	delete[] data;
+
+	return res;
+}
+
+static const uint8 volTable[] = {
+	0x00, 0x00, 0x00, 0x00, 0x1e, 0x23, 0x28, 0x2c, 0x30, 0x34, 0x38, 0x3b, 0x3e, 0x42, 0x45, 0x47,
+	0x4a, 0x4d, 0x50, 0x52, 0x55, 0x57, 0x59, 0x5c, 0x5e, 0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c,
+	0x6e, 0x70, 0x72, 0x73, 0x75, 0x77, 0x79, 0x7a, 0x7c, 0x7e, 0x7f, 0x81, 0x82, 0x84, 0x85, 0x87,
+	0x88, 0x8a, 0x8b, 0x8d, 0x8e, 0x8f, 0x91, 0x92, 0x93, 0x95, 0x96, 0x97, 0x98, 0x9a, 0x9b, 0x9c,
+	0x9d, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae,
+	0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd,
+	0xbe, 0xbf, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xcb, 0xcc,
+	0xcd, 0xce, 0xce, 0xcf, 0xce, 0xcf, 0xcf, 0xcf, 0xd0, 0xd1, 0xd1, 0xd2, 0xd3, 0xd3, 0xd4, 0xd5,
+	0xd5, 0xd6, 0xd7, 0xd7, 0xd8, 0xd8, 0xd9, 0xda, 0xda, 0xdb, 0xdb, 0xdc, 0xdc, 0xdd, 0xde, 0xde,
+	0xdf, 0xdf, 0xe0, 0xe0, 0xe1, 0xe1, 0xe2, 0xe2, 0xe3, 0xe3, 0xe4, 0xe4, 0xe5, 0xe5, 0xe6, 0xe6,
+	0xe7, 0xe7, 0xe8, 0xe8, 0xe9, 0xe9, 0xe9, 0xea, 0xea, 0xeb, 0xeb, 0xec, 0xec, 0xec, 0xed, 0xed,
+	0xee, 0xee, 0xee, 0xef, 0xef, 0xef, 0xf0, 0xf0, 0xf0, 0xf1, 0xf1, 0xf2, 0xf2, 0xf2, 0xf3, 0xf3,
+	0xf3, 0xf3, 0xf4, 0xf4, 0xf4, 0xf5, 0xf5, 0xf5, 0xf6, 0xf6, 0xf6, 0xf6, 0xf7, 0xf7, 0xf7, 0xf7,
+	0xf8, 0xf8, 0xf8, 0xf8, 0xf9, 0xf9, 0xf9, 0xf9, 0xfa, 0xfa, 0xfa, 0xfa, 0xfa, 0xfb, 0xfb, 0xfb,
+	0xfb, 0xfb, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfe, 0xfe,
+	0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
+};
+
+void SegaSoundDevice::fmUpdateVolumeFader() {
+	_fmVolume2 = _unkVolCond ? 112 : 255;
+	if (_faderFlags & 4) {
+		_faderFlags &= ~3;
+		if (++_faderTimer1 != 1)
+			return;
+		_faderTimer1 = 0;
+		if (_fmVolume1 >= 3)
+			_fmVolume1 -= 3;
+		
+	} else if (_faderFlags & 1) {
+		if (++_faderTimer2 != 2)
+			return;
+		_faderTimer2 = 0;
+		if (_fmVolume1 >= 154) {
+			_fmVolume1 -= 2;
+		} else {
+			_faderFlags &= ~1;
+			_faderTimer2 = 0;
+		}
+
+	} else if (_faderFlags & 2) {
+		if (++_faderTimer2 != 3)
+			return;
+		_faderTimer2 = 0;
+		if (_fmVolume1 < 255) {
+			_fmVolume1 += 2;
+		} else {
+			_faderFlags &= ~2;
+			_faderTimer2 = 0;
+		}
+	}
+}
+
+void SegaSoundDevice::fmHandleCmdQueue() {
+	if (_fmCmdQueueRPos != _fmCmdQueueWPos) {
+		_fmDriver->doCommand(_fmCmdQueue[_fmCmdQueueRPos++], 0);
+		if (_fmCmdQueueRPos == 128)
+			_fmCmdQueueRPos = 0;
+	}
+	if ((_fmVolume1 != _fmLastVolume1) || (_fmVolume2 != _fmLastVolume2)) {
+		_fmLastVolume1 = _fmVolume1;
+		_fmLastVolume2 = _fmVolume2;
+		_fmDriver->setVolume(volTable[_fmVolume1], volTable[_fmVolume2]);
+	}
+}
+
+bool SegaSoundDevice::pcmLoadData() {
+	uint32 dataSize = 0;
+	const uint8 *data = _fio->fileData(56, &dataSize);
+	if (!data || dataSize < 0x44A0)
+		return false;
+
+	_pcmResourceInfo = new PCMResourceInfo[0x800]();
+	assert(_pcmResourceInfo);
+	PCMResourceInfo *p1 = _pcmResourceInfo;
+	_pcmResidentDataInfo = new PCMResidentDataInfo[248]();
+	assert(_pcmResidentDataInfo);
+	PCMResidentDataInfo *p2 = _pcmResidentDataInfo;
+
+	const uint8 *in = data;
+	for (int i = 0; i < 0x800; ++i) {
+		p1->prio = *in++;
+		p1->mode = *in++;
+		p1->vol = *in++;
+		p1->pan = *in++;
+		p1->sector = READ_BE_UINT16(in);
+		in += 2;
+		p1->numSectors = READ_BE_UINT16(in);
+		in += 2;
+		p1++;
+	}
+
+	for (int i = 0; i < 0x4A; ++i) {
+		p2->prio = *in++;
+		p2->unit = *in++;
+		p2->c = *in++;
+		p2->pan = *in++;
+		p2->rate = READ_BE_UINT16(in);
+		in += 2;
+		p2->addr = READ_BE_UINT32(in);
+		in += 10;
+		p2++;
+	}
+
+	delete[] data;
+
+	// Extra setup for the pcm data that is used by sound driver instruments.
+	_pcmInstrumentInfo = new PCMInstrumentInfo[13]();
+	assert(_pcmInstrumentInfo);
+	uint16 dstAddr = 0x8000;
+
+	for (int i = 1; i < 13; ++i) {
+		if (i == 6 || i == 8 || i == 9 || i == 10)
+			continue;
+
+		SmpStrPtr str = createSamplesStream(_pcmResidentDataInfo[i].addr + 0x10);
+		int64 sz = str->size() - 1;
+		uint8 *smp = new uint8[sz + 2]();
+		str->read(smp, sz);
+		smp[sz] = 0x80;
+		smp[sz + 1] = 0xFF;
+
+		_pcmInstrumentInfo[i].addr = dstAddr;
+		_pcmInstrumentInfo[i].loopst = dstAddr + sz;
+
+		// Load and permanently keep pcm data for the sound driver instruments in pcm memory.
+		_sai->loadPCMData(dstAddr, smp, sz + 2);
+		dstAddr += (sz + 2);
+
+		if (dstAddr & 0xFF)
+			dstAddr = (dstAddr + 0xFF) & ~0xFF;
+
+		delete[] smp;
+	}
+
+	return true;
+}
+
+void SegaSoundDevice::pcmDisableStereoMode(bool disable) {
+	_pcmDisableStereo = disable ? true : false;
+}
+
+void SegaSoundDevice::pcmStop() {
+	for (int i = 0; i < 8; ++i)
+		_sai->stopPCMChannel(i);
+}
+
+void SegaSoundDevice::pcmStartSound(uint8 sndId, int8 unit, uint8 vol) {
+	if (unit < -1 || unit > 1)
+		return;
+
+	PCMResidentDataInfo &p = _pcmResidentDataInfo[sndId];
+	if (unit == -1)
+		unit = p.unit;
+
+	if (unit > 3)
+		error("%s(): PCM unit %d out of bounds", __FUNCTION__, unit);
+
+	PCMSound &s = _pcmSounds[unit];
+	if (s.prio > p.prio)
+		return;
+	pcmResetUnit(unit, s);
+	s.unit = p.unit;
+	s.f16 = p.c;
+	s.vol = vol ? (p.c * vol) >> 8 : p.c;
+	s.pan = p.pan;
+	s.rate = p.rate;
+	s.addr = p.addr + 0x10;
+
+	pcmStartSoundInternal(unit, unit << 1, s);
+	pcmStartSoundInternal(unit, (unit << 1) | 1, s);
+
+	s.prio = p.prio;
+}
+
+void SegaSoundDevice::pcmCheckPlayStatus() {
+	for (int i = 0; i < 2; ++i) {
+		PCMSound &s = _pcmSounds[i];
+		if (s.prio == 0)
+			continue;
+
+		s.flags &= ~2;
+		if (!_sai->isPCMChannelPlaying(i << 1) && !_sai->isPCMChannelPlaying(((i << 1) | 1))) {
+			pcmResetUnit(i, s);
+			_pcmState &= ~8;
+			_pcmState &= ~2;
+			_pcmMode = 0;
+		}
+	}
+}
+
+void SegaSoundDevice::pcmHandleDriverMessage() {
+	if (!_driverMsg.hasNewMsg())
+		return;
+
+	uint8 a = 0;
+	uint8 b = 0;
+	uint8 c = 0;
+
+	_driverMsg.read(a, b, c);
+
+	if ((a & 0x1F) && a < 13)
+		pcmStartInstrument(2, a, ((b & 7) | ((c & 0x60) >> 2)) << 3);
+	if ((b & 0xF8) && (b >> 3) < 13)
+		pcmStartInstrument(3, b >> 3, (c & 0x1F) << 3);
+}
+
+void SegaSoundDevice::pcmDelayedStart() {
+	if (_pcmState & 1) {
+		PCMSound &s = _pcmSounds[0];
+		PCMResourceInfo &p = _pcmResourceInfo[_pcmResourceNumber];
+		s.addr = 0x65000;
+		s.prio = p.prio;
+		s.vol = p.vol;
+		s.pan = p.pan;
+		s.rate = 0x400;
+
+		pcmStartSoundInternal(0, 0, s);
+		pcmStartSoundInternal(0, 1, s);
+		pcmStartSoundInternal(0, 2, s);
+		pcmStartSoundInternal(0, 3, s);
+
+		_pcmState = (_pcmState & ~1) | 2;
+	}
+	_pcmState &= ~4;
+}
+
+SegaSoundDevice::SmpStrPtr SegaSoundDevice::createSamplesStream(uint32 addr) const {
+	uint32 numSamples = 0;
+
+	Common::SeekableReadStream *str = _fio->readStream(addr < 0x65000 ? 54 : 55);
+	if (!str)
+		error("%s(): Error reading file", __FUNCTION__);
+
+	uint32 start = addr < 0x65000 ? addr - 0x55000 : _pcmResourceInfo[_pcmResourceNumber].sector * 0x800 + addr - 0x65000;
+	uint32 max = addr < 0x65000 ? 0x10000 : _pcmResourceInfo[_pcmResourceNumber].numSectors * 0x800;
+
+	str->seek(start, SEEK_SET);
+	numSamples = 0;
+
+	for (bool loop = true; loop; ) {
+		uint32 readSize = MIN<uint32>(0x8000, str->size() - str->pos());
+		readSize = str->read(_temp, readSize);
+		for (uint32 i = 0; i < readSize; ++i) {
+			if (_temp[i] == 0xFF) {
+				loop = false;
+				readSize = i;
+			}
+		}
+		if (readSize == 0)
+			error("%s(): Error reading file", __FUNCTION__);
+
+		numSamples += readSize;
+		// The samples are supposed to have a 'FF' end marker, but we should still provide
+		// an abort condition for corrupted files or other unexpected cases.
+		if (numSamples > max)
+			error("%s(): Samples stream overflow", __FUNCTION__);
+	}
+
+	str->seek(0);
+	Common::SeekableSubReadStream *subStr = new Common::SeekableSubReadStream(str, start, start + numSamples, DisposeAfterUse::YES);
+
+	return SmpStrPtr(subStr);
+}
+
+void SegaSoundDevice::pcmResetUnit(uint8 unit, PCMSound &s) {
+	s.prio = 0;
+	s.flags &= ~1;
+	_sai->stopPCMChannel(unit << 1);
+	_sai->stopPCMChannel((unit << 1) | 1);
+}
+
+void SegaSoundDevice::pcmStartSoundInternal(uint8 unit, uint8 chan, PCMSound &s) {
+	SmpStrPtr smp = createSamplesStream(s.addr);
+	_sai->playPCMStream(smp, chan << 5, 0x2000, chan, s.rate, calcPan(s), calcVolume(unit, s));
+}
+
+void SegaSoundDevice::pcmStartInstrument(uint8 unit, uint8 sndId, uint8 vol) {
+	if (sndId == 6 || sndId == 8 || sndId == 9 || sndId == 10)
+		return;
+
+	PCMResidentDataInfo &p = _pcmResidentDataInfo[sndId];
+	PCMInstrumentInfo &ins = _pcmInstrumentInfo[sndId];
+	PCMSound &s = _pcmSounds[unit];
+
+	s.id = sndId;
+	if (s.prio > p.prio)
+		return;
+	pcmResetUnit(unit, s);
+
+	s.unit = p.unit;
+	s.f16 = p.c;
+	s.vol = vol ? (p.c * vol) >> 8 : p.c;
+	s.pan = p.pan;
+	s.rate = p.rate;
+
+	_sai->playPCMChannel(unit << 1, ins.addr >> 8, ins.loopst, s.rate, calcPan(s), calcVolume(unit, s));
+	_sai->playPCMChannel((unit << 1) | 1, ins.addr >> 8, ins.loopst, s.rate, calcPan(s), calcVolume(unit, s));
+
+	s.prio = p.prio;
+}
+
+uint8 SegaSoundDevice::calcVolume(uint8 unit, PCMSound &s) const {
+	uint8 vol = s.vol;
+	if (_unkVolCond)
+		vol = (vol * 112) >> 8;
+	if (unit >= 2 && _fmVolume1 != 0xFF)
+		vol = (vol * _fmVolume1) >> 8;
+	return vol;
+}
+
+uint8 SegaSoundDevice::calcPan(PCMSound &s) const {
+	uint8 pan = (s.pan << 4) | (s.pan >> 4);
+	if (_pcmDisableStereo) {
+		pan = ((pan & 0x0F) + (pan >> 4)) >> 1;
+		pan = pan | (pan << 4);
+	}
+	return pan;
 }
 
-SoundDevice *SoundDevice::createSegaSoundDevice() {
-	return new SegaSoundDevice();
+SoundDevice *SoundDevice::createSegaSoundDevice(FIO *fio) {
+	return new SegaSoundDevice(fio);
 }
 
 } // End of namespace Snatcher
+
diff --git a/engines/snatcher/staticres.cpp b/engines/snatcher/staticres.cpp
index c931c0ba5c9..878d838a652 100644
--- a/engines/snatcher/staticres.cpp
+++ b/engines/snatcher/staticres.cpp
@@ -21,12 +21,13 @@
 
 
 #include "common/scummsys.h"
+#include "snatcher/staticres_types.h"
+
 
 namespace Snatcher {
 
 namespace StaticRes_SCD {
-// This is boot sequence data from the first 16 sectors of the CD-ROM which aren't
-// accessible through the file system. So I put the data here...
+// This is data from the first 16 sectors of the CD-ROM which isn't accessible through the file system. So I put the data here...
 
 static const uint8 _bootTileData1[] = {
 	0x13, 0x00, 0xaa, 0x00, 0x1c, 0x01, 0x11, 0x1c, 0x01, 0x22, 0x04, 0x01, 0x33, 0x04, 0x01, 0xaa, 0x44, 0x91, 0x55, 0x91, 0x77, 0x91, 0x99, 0x91, 0xbf, 0xa8, 0x01, 0x10, 0x01, 0x18, 0xa1, 0x01,
@@ -184,7 +185,7 @@ static const uint8 _cpyrNote[] = {
 	0x24, 0x00, 0x22, 0x39, 0x00, 0x33, 0x25, 0x27, 0x21, 0x00, 0x25, 0x2e, 0x34, 0x25, 0x32, 0x30, 0x32, 0x29, 0x33, 0x25, 0x33, 0x0c, 0x2c, 0x34, 0x24, 0x0e
 };
 
-extern const uint8 *const _bootSeqData[] = {
+extern const uint8 *const _bootSeqData[5] = {
 	_bootTileData1,
 	_bootTileData2,
 	_bootNtblA,
@@ -192,6 +193,166 @@ extern const uint8 *const _bootSeqData[] = {
 	_cpyrNote
 };
 
+extern const FMSoundTrackDef _fmSndTrackDefs[122] {
+	{ 0x00, 0x00, 0x09, 0x03, 0x00 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x01 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x02 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x03 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x04 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x05 },
+	{ 0x00, 0x00, 0x09, 0x02, 0x06 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x07 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x08 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x09 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x0a },
+	{ 0x00, 0x00, 0x09, 0x03, 0x0b },
+	{ 0x00, 0x00, 0x09, 0x10, 0x0c },
+	{ 0x00, 0x00, 0x09, 0x10, 0x0d },
+	{ 0x00, 0x00, 0x09, 0x10, 0x0e },
+	{ 0x00, 0x00, 0x09, 0x03, 0x0f },
+	{ 0x00, 0x00, 0x09, 0x01, 0x10 },
+	{ 0x00, 0x00, 0x09, 0x02, 0x11 },
+	{ 0x00, 0x00, 0x09, 0x04, 0x12 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x13 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x14 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x15 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x16 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x17 },
+	{ 0x00, 0x00, 0x09, 0x01, 0x18 },
+	{ 0x00, 0x00, 0x09, 0x0f, 0x19 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x1a },
+	{ 0x00, 0x00, 0x09, 0x10, 0x1b },
+	{ 0x00, 0x00, 0x09, 0x01, 0x1c },
+	{ 0x00, 0x00, 0x09, 0x10, 0x1d },
+	{ 0x00, 0x00, 0x09, 0x10, 0x1e },
+	{ 0x00, 0x00, 0x09, 0x10, 0x1f },
+	{ 0x00, 0x00, 0x09, 0x10, 0x20 },
+	{ 0x00, 0x00, 0x09, 0x03, 0x21 },
+	{ 0x00, 0x00, 0x09, 0x01, 0x22 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x23 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x24 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x25 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x26 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x27 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x28 },
+	{ 0x00, 0x00, 0x09, 0x10, 0x29 },
+	{ 0x00, 0x00, 0x09, 0x03, 0x2a },
+	{ 0x00, 0x00, 0x09, 0x10, 0x2b },
+	{ 0x00, 0x00, 0x09, 0x10, 0x2c },
+	{ 0x00, 0x00, 0x09, 0x10, 0x2d },
+	{ 0x00, 0x00, 0x09, 0x10, 0x2e },
+	{ 0x00, 0x00, 0x09, 0x10, 0x2f },
+	{ 0x00, 0x00, 0x09, 0x10, 0x30 },
+	{ 0x00, 0x01, 0x08, 0x10, 0x31 },
+	{ 0x00, 0x01, 0x08, 0x10, 0x32 },
+	{ 0x00, 0x01, 0x08, 0x10, 0x33 },
+	{ 0x00, 0x01, 0x08, 0x20, 0x34 },
+	{ 0x00, 0x01, 0x08, 0x10, 0x35 },
+	{ 0x00, 0x01, 0x08, 0x10, 0x36 },
+	{ 0x00, 0x01, 0x08, 0x10, 0x37 },
+	{ 0x00, 0x01, 0x08, 0x10, 0x38 },
+	{ 0x00, 0x01, 0x08, 0x10, 0x39 },
+	{ 0x00, 0x01, 0x08, 0x10, 0x3a },
+	{ 0x00, 0x01, 0x08, 0x10, 0x3b },
+	{ 0x00, 0x01, 0x08, 0x11, 0x3c },
+	{ 0x00, 0x01, 0x08, 0x10, 0x3d },
+	{ 0x01, 0x07, 0x00, 0x80, 0x00 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x01 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x02 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x03 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x04 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x05 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x06 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x07 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x08 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x09 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x0a },
+	{ 0x01, 0x07, 0x00, 0x80, 0x0b },
+	{ 0x01, 0x07, 0x00, 0x80, 0x0c },
+	{ 0x01, 0x07, 0x00, 0x80, 0x0d },
+	{ 0x01, 0x07, 0x00, 0x80, 0x0e },
+	{ 0x01, 0x07, 0x00, 0x80, 0x0f },
+	{ 0x01, 0x07, 0x00, 0x80, 0x10 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x11 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x12 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x13 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x14 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x15 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x16 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x17 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x18 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x19 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x1a },
+	{ 0x01, 0x07, 0x00, 0x80, 0x1b },
+	{ 0x01, 0x07, 0x00, 0x80, 0x1c },
+	{ 0x01, 0x07, 0x00, 0x80, 0x1d },
+	{ 0x01, 0x07, 0x00, 0x80, 0x1e },
+	{ 0x01, 0x07, 0x00, 0x80, 0x1f },
+	{ 0x01, 0x07, 0x00, 0x80, 0x20 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x21 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x22 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x23 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x24 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x25 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x26 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x27 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x28 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x29 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x2a },
+	{ 0x01, 0x07, 0x00, 0x80, 0x2b },
+	{ 0x01, 0x07, 0x00, 0x80, 0x2c },
+	{ 0x01, 0x07, 0x00, 0x80, 0x2d },
+	{ 0x01, 0x07, 0x00, 0x80, 0x2e },
+	{ 0x01, 0x07, 0x00, 0x80, 0x2f },
+	{ 0x01, 0x07, 0x00, 0x80, 0x30 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x31 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x32 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x33 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x34 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x35 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x36 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x37 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x38 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x39 },
+	{ 0x01, 0x07, 0x00, 0x80, 0x3a },
+	{ 0x01, 0x07, 0x00, 0x80, 0x3b }
+};
+
+extern const uint8 _fmSndPitchSpecialTable[512] = {
+	0x9f, 0x3c, 0xb2, 0x52, 0xaf, 0x45, 0xc7, 0x89, 0x10, 0x7f, 0xe0, 0x9d, 0xdc, 0x1f, 0x61, 0x16,
+	0x39, 0xc9, 0x9c, 0xeb, 0x57, 0x08, 0x66, 0xf8, 0x5a, 0x24, 0xbf, 0x0e, 0x3e, 0x15, 0x4b, 0xdb,
+	0xab, 0xf5, 0x31, 0x0c, 0x43, 0x02, 0x55, 0xde, 0x41, 0xda, 0xbd, 0xae, 0x19, 0xb0, 0x48, 0x57,
+	0xba, 0xa3, 0x36, 0x0b, 0xf9, 0xdf, 0x17, 0xa8, 0x04, 0x0c, 0xe0, 0x91, 0x18, 0x5d, 0xdd, 0xd3,
+	0x28, 0x8a, 0xf2, 0x11, 0x59, 0x6f, 0x06, 0x0a, 0x34, 0x2a, 0x79, 0xac, 0x5e, 0xa7, 0x83, 0xc6,
+	0x39, 0xc1, 0xb4, 0x3a, 0x3f, 0xfe, 0x4f, 0xef, 0x1f, 0x00, 0x30, 0x99, 0x4c, 0x28, 0x83, 0xed,
+	0x8a, 0x2f, 0x2c, 0x66, 0x3f, 0xd6, 0x6c, 0xb7, 0x49, 0x22, 0xbc, 0x65, 0xfa, 0xcf, 0x02, 0xb1,
+	0x46, 0xf0, 0x9a, 0xd7, 0xe2, 0x0f, 0x11, 0xc5, 0x74, 0xf6, 0x7a, 0x2c, 0x8f, 0xfb, 0x19, 0x6a,
+	0xe5, 0x75, 0x51, 0x4a, 0xff, 0xb8, 0x7f, 0x62, 0xdb, 0x4f, 0x14, 0xe8, 0xc2, 0xd6, 0x62, 0xb9,
+	0xc2, 0xad, 0xa6, 0xd5, 0x29, 0xf7, 0x14, 0x2e, 0x6c, 0x18, 0x8e, 0xa4, 0xc1, 0xa0, 0x7e, 0x32,
+	0xa9, 0xbe, 0xe6, 0x15, 0xb6, 0x7d, 0xf8, 0xa0, 0xe6, 0x12, 0x7a, 0x67, 0x47, 0xd2, 0x03, 0x58,
+	0xfd, 0xd1, 0x9e, 0x31, 0x9b, 0x50, 0x54, 0xa5, 0xec, 0x72, 0x70, 0xd5, 0xb6, 0x9b, 0x82, 0x7c,
+	0xa1, 0xc5, 0x72, 0xb9, 0xa8, 0x33, 0x8b, 0xeb, 0x59, 0x9e, 0x29, 0x87, 0x8e, 0x36, 0xad, 0x86,
+	0xea, 0xe4, 0xd4, 0x37, 0x92, 0xae, 0x45, 0xf0, 0x6e, 0x24, 0xd0, 0xf3, 0xcb, 0x95, 0x71, 0xe8,
+	0xc6, 0x38, 0xed, 0x71, 0x44, 0x22, 0x2b, 0x60, 0xc0, 0x26, 0xf9, 0x53, 0x5a, 0xc4, 0x2d, 0x74,
+	0xc8, 0x50, 0x8d, 0xf7, 0xac, 0x01, 0x79, 0xbd, 0x52, 0x10, 0x5e, 0x67, 0xb0, 0x01, 0xa6, 0xff,
+	0x5f, 0xce, 0x54, 0x64, 0x5c, 0xe7, 0xba, 0x32, 0x96, 0xfc, 0x00, 0xe9, 0xcc, 0x77, 0xdc, 0x60,
+	0xb5, 0x92, 0x4d, 0x84, 0x1c, 0x68, 0xee, 0x4e, 0xaf, 0xab, 0x07, 0x87, 0x9f, 0x93, 0xbf, 0x88,
+	0xf1, 0xcd, 0x80, 0xd7, 0x4a, 0xe5, 0x20, 0x4e, 0x63, 0x44, 0xda, 0x78, 0x8f, 0x07, 0xf3, 0x40,
+	0x98, 0x6b, 0x37, 0xa2, 0xf4, 0x21, 0x1e, 0x96, 0x13, 0x7e, 0x09, 0xea, 0x3d, 0x27, 0x86, 0x4d,
+	0xbe, 0x8b, 0xcd, 0xd0, 0xfb, 0xa3, 0x1b, 0x97, 0x2a, 0xbc, 0x1a, 0x8c, 0x73, 0x4c, 0x46, 0x6f,
+	0xde, 0x26, 0x8c, 0xb8, 0x33, 0xaa, 0x0e, 0xbb, 0x21, 0xd8, 0x89, 0x3b, 0x97, 0x1d, 0xbb, 0x23,
+	0x48, 0x90, 0x69, 0xfa, 0xc9, 0x76, 0xce, 0xe7, 0x1b, 0x7b, 0x1a, 0x2b, 0x78, 0xc0, 0x03, 0x08,
+	0x6b, 0xcf, 0xcc, 0xb3, 0x6d, 0xa9, 0xb2, 0x3a, 0x16, 0xa1, 0x56, 0x95, 0x0b, 0x17, 0xf1, 0x12,
+	0x99, 0x13, 0xd8, 0x81, 0x56, 0x38, 0xf5, 0x3e, 0xd1, 0xb1, 0xe3, 0xe1, 0xb3, 0x2e, 0x84, 0xef,
+	0x5b, 0x04, 0x64, 0x5d, 0xb5, 0x0a, 0x5b, 0x1d, 0x94, 0x06, 0xd9, 0xe4, 0x0d, 0xfd, 0x6d, 0xa2,
+	0x4b, 0xf6, 0x65, 0xa5, 0xcb, 0xaa, 0x5f, 0xe3, 0x70, 0x1e, 0xf2, 0x93, 0x82, 0x63, 0x27, 0xee,
+	0xe2, 0x1c, 0x98, 0x23, 0xca, 0x0d, 0xec, 0xd9, 0x05, 0xf4, 0x3b, 0x53, 0x9d, 0x73, 0x3c, 0xc3,
+	0xd4, 0xfe, 0xe1, 0xdd, 0x61, 0x69, 0x90, 0x2d, 0x2f, 0x8d, 0x51, 0xc4, 0xa4, 0x7c, 0x43, 0x88,
+	0x34, 0x5c, 0x85, 0xb4, 0x7d, 0x25, 0x30, 0x58, 0x85, 0x68, 0x35, 0xc7, 0x47, 0x20, 0x05, 0x35,
+	0x09, 0x25, 0x80, 0x55, 0xca, 0x6a, 0x91, 0xfc, 0xc8, 0xd3, 0x0f, 0xa7, 0xc3, 0x9a, 0x6e, 0x94,
+	0x9c, 0x42, 0xdf, 0x77, 0x42, 0x40, 0xd2, 0x76, 0x3d, 0x41, 0x81, 0x75, 0xb7, 0x49, 0xe9, 0x7b
+};
+
 } // End of namespace StaticRes_SCD
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/staticres.h b/engines/snatcher/staticres.h
index ab2df4dcb3f..6eceae702bd 100644
--- a/engines/snatcher/staticres.h
+++ b/engines/snatcher/staticres.h
@@ -24,12 +24,16 @@
 #define SNATCHER_STATICRES_H
 
 #include "common/scummsys.h"
+#include "snatcher/staticres_types.h"
 
 namespace Snatcher {
 
 namespace StaticRes_SCD {
 
-	extern const uint8 *const _bootSeqData[4];
+	extern const uint8 *const _bootSeqData[5];
+
+	extern const FMSoundTrackDef _fmSndTrackDefs[122];
+	extern const uint8 _fmSndPitchSpecialTable[512];
 
 } // End of namespace StaticRes
 
diff --git a/engines/snatcher/staticres_types.h b/engines/snatcher/staticres_types.h
new file mode 100644
index 00000000000..5463c5daa32
--- /dev/null
+++ b/engines/snatcher/staticres_types.h
@@ -0,0 +1,44 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#ifndef SNATCHER_STATICRES_TYPES_H
+#define SNATCHER_STATICRES_TYPES_H
+
+#include "common/scummsys.h"
+
+namespace Snatcher {
+
+namespace StaticRes_SCD {
+
+	struct FMSoundTrackDef {
+		uint8 a;
+		uint8 poly;
+		uint8 chan;
+		uint8 prio;
+		uint8 track;
+	};
+
+} // End of namespace StaticRes
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_SOUND_H
diff --git a/engines/snatcher/transition_scd.cpp b/engines/snatcher/transition_scd.cpp
index 4734eba153e..66d62a07e12 100644
--- a/engines/snatcher/transition_scd.cpp
+++ b/engines/snatcher/transition_scd.cpp
@@ -522,7 +522,8 @@ void TransitionManager_SCD::trsUpdt_revealShutter(int arg) {
 		resetVars(0x0C);
 		_transitionState |= ((_transitionState & 0xFC) << 6);
 	} else {
-		_transitionState = (--_transitionState) & 0xFF;
+		--_transitionState;
+		_transitionState &= 0xFF;
 		if ((int8)(_transitionState) >= 0) {
 			_transitionState |= ((_transitionState & 0xFC) << 6);
 		} else {
diff --git a/graphics/segagfx.cpp b/graphics/segagfx.cpp
index cf907f28a7b..aa69c53ea24 100644
--- a/graphics/segagfx.cpp
+++ b/graphics/segagfx.cpp
@@ -461,7 +461,7 @@ template<typename T> void SegaRenderer::refresh(T *dst, int x, int y, int w, int
 	if (sizeof(T) == 1)
 		return;
 
-	uint8 *rd1 = tempBufferPlanes + (y * _screenW + x);
+	uint8 *rd1 = _tempBufferPlanes + (y * _screenW + x);
 	dst += (y * _screenW + x);
 
 	if (x == 0 && y == 0 && w == _screenW && h == _screenH) {


Commit: 6697523adfe898380523beb53025ffda6fa1dcfc
    https://github.com/scummvm/scummvm/commit/6697523adfe898380523beb53025ffda6fa1dcfc
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix graphics glitches and work on main menu

Changed paths:
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/render.h
    engines/snatcher/render_scd.cpp
    engines/snatcher/resource.h
    engines/snatcher/scene/scene_d2.cpp
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/sound_device_scd.cpp
    graphics/segagfx.cpp


diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index d9ea37b4e08..3846a05c721 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -171,12 +171,32 @@ uint16 GraphicsEngine::getAnimCurFrame(uint8 animObjId) const {
 	return _renderer->anim_getCurFrameNo(animObjId);
 }
 
+void GraphicsEngine::setAnimPosX(uint8 animObjId, int16 x) {
+	_renderer->anim_setPosX(animObjId, x);
+}
+
+void GraphicsEngine::setAnimPosY(uint8 animObjId, int16 y) {
+	_renderer->anim_setPosY(animObjId, y);
+}
+
+void GraphicsEngine::setAnimSpeedX(uint8 animObjId, int16 speedX) {
+	_renderer->anim_setSpeedX(animObjId, speedX);
+}
+
+void GraphicsEngine::setAnimSpeedY(uint8 animObjId, int16 speedY) {
+	_renderer->anim_setSpeedY(animObjId, speedY);
+}
+
+void GraphicsEngine::toggleAnimBlink(uint8 animObjId, bool enable) {
+	_renderer->anim_toggleBlink(animObjId, enable);
+}
+
 bool GraphicsEngine::isAnimEnabled(uint8 animObjId) const {
 	return _renderer->anim_isEnabled(animObjId);
 }
 
-void GraphicsEngine::gunTestAnimUpdate() {
-	_renderer->anim_gunTestUpdate();
+void GraphicsEngine::updateAnimBlink() {
+	_renderer->anim_updateBlink();
 }
 
 uint16 GraphicsEngine::screenWidth() const {
@@ -203,8 +223,8 @@ void GraphicsEngine::createMouseCursor(bool show) {
 	_renderer->createMouseCursor();
 }
 
-int GraphicsEngine::displayBootSequenceFrame(int frameNo) {
-	int res = _renderer->drawBootSequenceFrame(_screen, frameNo);
+int GraphicsEngine::displayBootLogoFrame(int frameNo) {
+	int res = _renderer->drawBootLogoFrame(_screen, frameNo);
 	_system->copyRectToScreen(_screen, _renderer->screenWidth() * _bpp, 0, 0, _renderer->screenWidth(), _renderer->screenHeight());
 	_system->updateScreen();
 	return res;
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index cec6d7e61c2..768d0872146 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -88,9 +88,14 @@ public:
 	void clearAnimControlFlags(uint8 animObjId, int flags);
 	void setAnimFrame(uint8 animObjId, uint16 frameNo);
 	uint16 getAnimCurFrame(uint8 animObjId) const;
+	void setAnimPosX(uint8 animObjId, int16 x);
+	void setAnimPosY(uint8 animObjId, int16 y);
+	void setAnimSpeedX(uint8 animObjId, int16 speedX);
+	void setAnimSpeedY(uint8 animObjId, int16 speedY);
+	void toggleAnimBlink(uint8 animObjId, bool enable);
 	bool isAnimEnabled(uint8 animObjId) const;
 
-	void gunTestAnimUpdate();
+	void updateAnimBlink();
 
 	uint16 screenWidth() const;
 	uint16 screenHeight() const;
@@ -100,7 +105,7 @@ public:
 
 	void createMouseCursor(bool show);
 
-	int displayBootSequenceFrame(int frameNo);
+	int displayBootLogoFrame(int frameNo);
 
 public:
 	struct GfxState {
diff --git a/engines/snatcher/render.h b/engines/snatcher/render.h
index c16a218c9b2..db46f991c5b 100644
--- a/engines/snatcher/render.h
+++ b/engines/snatcher/render.h
@@ -47,8 +47,13 @@ public:
 	virtual void anim_clearControlFlags(uint8 animObjId, int flags) = 0;
 	virtual void anim_setFrame(uint8 animObjId, uint16 frameNo) = 0;
 	virtual uint16 anim_getCurFrameNo(uint8 animObjId) const = 0;
+	virtual void anim_setPosX(uint8 animObjId, int16 x) = 0;
+	virtual void anim_setPosY(uint8 animObjId, int16 y) = 0;
+	virtual void anim_setSpeedX(uint8 animObjId, int16 speedX) = 0;
+	virtual void anim_setSpeedY(uint8 animObjId, int16 speedY) = 0;
+	virtual void anim_toggleBlink(uint8 animObjId, bool enable) = 0;
 	virtual bool anim_isEnabled(uint8 animObjId) const = 0;
-	virtual void anim_gunTestUpdate() = 0;
+	virtual void anim_updateBlink() = 0;
 
 	virtual uint16 screenWidth() const = 0;
 	virtual uint16 screenHeight() const = 0;
@@ -61,7 +66,7 @@ public:
 	// This is special code from the CD-ROM boot sectors that does not
 	// share anything with the rest of the game. So it makes sense to
 	// keep it separate.
-	virtual int drawBootSequenceFrame(uint8 *screen, int frameNo) = 0;
+	virtual int drawBootLogoFrame(uint8 *screen, int frameNo) = 0;
 
 protected:
 	Renderer(GraphicsEngine::GfxState &state) : _gfxState(state) {}
diff --git a/engines/snatcher/render_scd.cpp b/engines/snatcher/render_scd.cpp
index 6aeed8baa44..f1773905048 100644
--- a/engines/snatcher/render_scd.cpp
+++ b/engines/snatcher/render_scd.cpp
@@ -31,14 +31,16 @@
 #include "snatcher/staticres.h"
 #include "snatcher/transition.h"
 #include "snatcher/util.h"
-
+#include "common/system.h"
 
 namespace Snatcher {
 
 //#define		ANIM_DEBUG
 
 struct AnimObject {
-	AnimObject(int num) : id(num), enable(0), fadeLevel(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), f16(0), f18(0), f1c(0), timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0), res(), scriptData(), spriteData(0), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), f4e(0), f4f(0), f3a(0), f3c(0), f3e(0) {}
+	AnimObject(int num) : id(num), enable(0), fadeLevel(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), f16(0), f18(0), f1c(0),
+		timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0),
+			res(), scriptData(), spriteData(nullptr), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), f4e(0), f4f(0), blink(0), blinkCounter(0), blinkDuration(0) {}
 	
 	void clear() {
 		enable = fadeLevel = drawFlags = 0;
@@ -59,7 +61,8 @@ struct AnimObject {
 		absSpeedX = absSpeedY = 0;
 		parent = children = next = 0;
 		f4e = f4f = 0;
-		f3a = f3c = f3e = 0;
+		blink = blinkCounter = blinkDuration = 0;
+
 	}
 
 	uint16 enable;
@@ -86,9 +89,9 @@ struct AnimObject {
 	ResourcePointer res;
 	ResourcePointer scriptData;
 	const uint16 *spriteData;
-	uint16 f3a;
-	uint16 f3c;
-	uint16 f3e;
+	uint16 blink;
+	uint16 blinkCounter;
+	uint16 blinkDuration;
 	int32 absSpeedX;
 	int32 absSpeedY;
 	uint16 parent;
@@ -122,8 +125,13 @@ public:
 	void anim_clearControlFlags(uint8 animObjId, int flags) override;
 	void anim_setFrame(uint8 animObjId, uint16 frameNo) override;
 	uint16 anim_getCurFrameNo(uint8 animObjId) const override;
+	void anim_setPosX(uint8 animObjId, int16 x) override;
+	void anim_setPosY(uint8 animObjId, int16 y) override;
+	void anim_setSpeedX(uint8 animObjId, int16 speedX) override;
+	void anim_setSpeedY(uint8 animObjId, int16 speedY) override;
+	void anim_toggleBlink(uint8 animObjId, bool enable) override;
 	bool anim_isEnabled(uint8 animObjId) const override;
-	void anim_gunTestUpdate() override;
+	void anim_updateBlink() override;
 
 	uint16 screenWidth() const override { return _screenWidth; }
 	uint16 screenHeight() const override { return _screenHeight; }
@@ -247,7 +255,7 @@ private:
 
 public:
 	// boot logo animation
-	int drawBootSequenceFrame(uint8 *screen, int frameNo) override;
+	int drawBootLogoFrame(uint8 *screen, int frameNo) override;
 private:
 	int32 _bootsDelay, _bootsTotalFrames;
 	uint16 _bootsHScroll, _bootsVScroll, _bootsCol;
@@ -487,23 +495,48 @@ uint16 Renderer_SCD::anim_getCurFrameNo(uint8 animObjId) const {
 	return _animations[animObjId]->frame;
 }
 
+void Renderer_SCD::anim_setPosX(uint8 animObjId, int16 x) {
+	assert(animObjId < 64);
+	_animations[animObjId]->posX = x << 16;
+}
+
+void Renderer_SCD::anim_setPosY(uint8 animObjId, int16 y) {
+	assert(animObjId < 64);
+	_animations[animObjId]->posY = y << 16;
+}
+
+void Renderer_SCD::anim_setSpeedX(uint8 animObjId, int16 speedX) {
+	assert(animObjId < 64);
+	_animations[animObjId]->absSpeedX = speedX << 16;
+}
+
+void Renderer_SCD::anim_setSpeedY(uint8 animObjId, int16 speedY) {
+	assert(animObjId < 64);
+	_animations[animObjId]->absSpeedY = speedY << 16;
+}
+
+void Renderer_SCD::anim_toggleBlink(uint8 animObjId, bool enable) {
+	assert(animObjId < 64);
+	_animations[animObjId]->blink = enable ? 1 : 0;
+}
+
 bool Renderer_SCD::anim_isEnabled(uint8 animObjId) const {
 	assert(animObjId < 64);
 	return _animations[animObjId]->enable != 0;
 }
 
-void Renderer_SCD::anim_gunTestUpdate() {
+void Renderer_SCD::anim_updateBlink() {
 	for (int i = 0; i < 3; ++i) {
 		AnimObject &a = *_animations[17 + i];
 		a.controlFlags = GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide;
 		if (a.absSpeedX)
 			a.controlFlags = GraphicsEngine::kAnimPause;
-		if (a.f3a == 1) {
-			if (++a.f3c >= 16) {
-				a.f3c = 0;
-				a.absSpeedX ^= 0x100;
-				if (++a.f3e >= 6)
-					a.f3a = 0;
+		if (a.blink == 1) {
+			if (++a.blinkCounter >= 16) {
+				a.blinkCounter = 0;
+				a.absSpeedX ^= (1 << 16);
+				if (++a.blinkDuration >= 6)
+					a.blink = 0;
 			}
 		}
 	}
@@ -680,19 +713,20 @@ void Renderer_SCD::drawAnimSprites() {
 	uint16 *d = _spriteBuffer;
 	memset(d, 0, 4 * sizeof(uint16));
 	uint16 nxt = 1;
-
+	debug("%s():", __FUNCTION__);
 	for (int i = 0; i < 64; ++i) {
 		AnimObject &a = *_animations[i];
-		if (a.enable && a.spriteData != nullptr && !(a.controlFlags & GraphicsEngine::kAnimHide) && a.fadeLevel != 0xFFFF && !(a.fadeLevel & _gfxState.frameCount()))
+		if (a.enable && a.spriteData != nullptr && !(a.controlFlags & GraphicsEngine::kAnimHide) && a.fadeLevel != 0xFFFF && !(a.fadeLevel & _gfxState.frameCount())) {
+			debug("		anim: %02d at x = %d, y = %d", i, a.posX >> 16, a.posY >> 16);
 			generateSpriteData(a, nxt, d);
-		if (i == 31)
+		} if (i == 31)
 			updateAnim32Spec(a);
 	}
 
 	if (d - 3 > _spriteBuffer)
 		*(reinterpret_cast<uint8*>(d) - 5) = 0;
 
-	_sr->loadToVRAM(_spriteBuffer, (d - _spriteBuffer) * sizeof(uint16), 0xFE00);
+	_sr->loadToVRAM(_spriteBuffer, MAX<uint>(4, d - _spriteBuffer) * sizeof(uint16), 0xFE00);
 }
 
 void Renderer_SCD::reconfigPlanes() {
@@ -1227,11 +1261,24 @@ void Renderer_SCD::anim_setGroupParameter(AnimObject &a, int para, int16 val, bo
 void Renderer_SCD::createMouseCursor() {
 	// This will obviously only work when the necessary animation has been loaded.
 	anim_setControlFlags(16, GraphicsEngine::kAnimPause);
-	//_sr->renderSprites(
+	anim_setFrame(16, 0);
+	
+	memset(_tempBuffer, 0, 0x10000);
+	updateAnimations();
+	drawAnimSprites();
+	_sr->renderSprites(_tempBuffer, nullptr);
+	anim_setControlFlags(16, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+
+	for (int i = 1; i < 24; ++i)
+		memcpy(_tempBuffer + i * 24, _tempBuffer + i * _screenWidth, 24);
+
+	g_system->setMouseCursor(_tempBuffer, 24, 24, 12, 12, 4);
+	g_system->setCursorPalette(_pal->getSystemPalette(), 0, 64);
+	g_system->showMouse(true);
 }
 
 // Boot logo sequence code. This has nothing to do with the engine graphics code, so I put it at the end, to keep the ugly mess out of sight...
-int Renderer_SCD::drawBootSequenceFrame(uint8 *screen, int frameNo)  {
+int Renderer_SCD::drawBootLogoFrame(uint8 *screen, int frameNo)  {
 	uint16 *tmp = reinterpret_cast<uint16*>(_tempBuffer);
 	uint32 len = 0;
 	uint16 val = 0;
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index 941604b4c1a..55cf3fb51cd 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -41,7 +41,7 @@ class SceneModule;
 class FIO;
 
 struct Config {
-	Config() : volumeMusic(0), volumeSFX(0), volumeSpeech(0), lightGunAvailable(1), useLightGun(0), controllerSetup(0), disableStereo(0), hasRAMCart(1), hasFreeBuram(1), lightGunBias() {}
+	Config() : volumeMusic(0), volumeSFX(0), volumeSpeech(0), lightGunAvailable(1), useLightGun(0), controllerSetup(0), disableStereo(0), hasRAMCart(1), hasFreeBuram(1), lightGunBias(0, -16) {}
 	int16 volumeMusic;
 	int16 volumeSFX;
 	int16 volumeSpeech;
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene/scene_d2.cpp
index 54bd50573b2..e5bd1a34556 100644
--- a/engines/snatcher/scene/scene_d2.cpp
+++ b/engines/snatcher/scene/scene_d2.cpp
@@ -434,6 +434,7 @@ SH_IMPL_FRM(D2, 11) {
 			return;
 		_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 		_vm->gfx()->runScript(_module->getPtr(0), 7);
+		_vm->gfx()->createMouseCursor(true);
 		++state.frameState;
 		break;
 	case 2:
@@ -444,12 +445,12 @@ SH_IMPL_FRM(D2, 11) {
 		_vm->gfx()->setAnimFrame(17, 0);
 		_vm->gfx()->setAnimFrame(18, 0);
 		_vm->gfx()->setAnimFrame(19, 0);
-		//anim17 3a:0
-		//anim17 absSpeedX:0
-		//anim18 3a:0
-		//anim18 absSpeedX:0
-		//anim19 3a:0
-		//anim19 absSpeedX:0
+		_vm->gfx()->toggleAnimBlink(17, false);
+		_vm->gfx()->setAnimSpeedX(17, 0);
+		_vm->gfx()->toggleAnimBlink(18, false);
+		_vm->gfx()->setAnimSpeedX(18, 0);
+		_vm->gfx()->toggleAnimBlink(19, 0);
+		_vm->gfx()->setAnimSpeedX(19, false);
 
 		++state.frameState;
 		break;
@@ -457,39 +458,51 @@ SH_IMPL_FRM(D2, 11) {
 		if (_vm->input().controllerFlags & 0x80) {
 			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
 			state.counter = 10;
-			state.frameState = 0;
-			++state.frameNo;
+			++state.frameState;
 			return;
 		}
 
-		_vm->gfx()->gunTestAnimUpdate();
+		_vm->gfx()->updateAnimBlink();
 
 		switch (state.counter) {
 		case 0:
-			if (_vm->input().controllerFlags & 0x70) {
-				//a18.f3a = 1;
-				//a18.speedX = 0x100;
-				++state.counter;
-			}
+			_vm->gfx()->toggleAnimBlink(18, true);
+			_vm->gfx()->setAnimSpeedX(18, 1);
+			++state.counter;
 			break;
 		case 1:
-			_vm->sound()->pcmSendCommand(57, -1);
-			//a18.f3a = 0;
-			//a18.speedX = 0;
-			//a19.f3a = 1;
-			//a19.speedX = 1;
-			++state.counter;
+			if (_vm->input().controllerFlags & 0x100) {
+				_vm->sound()->pcmSendCommand(57, -1);
+				_vm->gfx()->toggleAnimBlink(18, false);
+				_vm->gfx()->setAnimSpeedX(18, 0);
+				_vm->gfx()->toggleAnimBlink(19, true);
+				_vm->gfx()->setAnimSpeedX(19, 1);
+				++state.counter;
+			}
 			break;
 		case 2:
+			_vm->calibrateLightGun(state);
 			_vm->gfx()->setAnimControlFlags(16, GraphicsEngine::kAnimPause);
-			//a16: posX = 117;
-			//a16: posY = 93;
+			_vm->gfx()->setAnimPosX(16, 117);
+			_vm->gfx()->setAnimPosY(16, 93);
 			++state.counter;
 			break;
 		case 3:
-			state.counter += 2;
+			if (_vm->input().controllerFlags & 0x200) {
+				_vm->gfx()->toggleAnimBlink(17, true);
+				_vm->gfx()->setAnimSpeedX(17, 1);
+				_vm->gfx()->toggleAnimBlink(19, false);
+				_vm->gfx()->setAnimSpeedX(19, 0);
+				state.counter += 2;
+				_vm->sound()->fmSendCommand(29, 0);
+			} else if (_vm->input().controllerFlags & 0x100) {
+				_vm->sound()->pcmSendCommand(57, -1);
+				state.counter++;
+			}
 			break;
 		case 4:
+			_vm->gfx()->setAnimPosX(16, _vm->input().lightGunPos.x - 11);
+			_vm->gfx()->setAnimPosY(16, _vm->input().lightGunPos.y - 35);
 			--state.counter;
 			break;
 		case 5:
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index a6ba7514d9c..1e438cc2060 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -110,7 +110,7 @@ bool SnatcherEngine::initSound(Audio::Mixer *mixer, Common::Platform platform, i
 	return (_snd && _snd->init(mixer));
 }
 
-void SnatcherEngine::playBootSequence(const GameState &state) {
+void SnatcherEngine::playBootLogoAnimation(const GameState &state) {
 	uint32 frameTimer = 0;
 	int curSeqState = 0;
 	_snd->fmSendCommand(242, -1);
@@ -120,9 +120,9 @@ void SnatcherEngine::playBootSequence(const GameState &state) {
 		uint32 nextFrame = _system->getMillis() + (frameTimer >> 14);
 		frameTimer &= 0x3FFF;
 
-		int nextState = _gfx->displayBootSequenceFrame(curSeqState);
+		int nextState = _gfx->displayBootLogoFrame(curSeqState);
 		if (curSeqState == 6 && nextState == 7)
-			_snd->fmSendCommand(101, -1);// 65, 76, 86, 88, 89, 94, 98, 100, 101 (pitch bend), 72 (pb special), 74 (vbr)
+			_snd->fmSendCommand(63, -1);
 		curSeqState = nextState;
 
 		checkEvents(state);
@@ -135,7 +135,7 @@ bool SnatcherEngine::start() {
 	Util::rngReset();
 	GameState state;
 
-	playBootSequence(state);
+	playBootLogoAnimation(state);
 
 	uint32 frameTimer = 0;
 
@@ -228,15 +228,16 @@ static const InputEvent _defaultKeyEvents[] = {
 	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_c, 0x00, 0x40, false},
 
 	{ Common::EVENT_MBUTTONDOWN, Common::EVENT_MBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x20, false },
-	{ Common::EVENT_RBUTTONDOWN, Common::EVENT_RBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x40, false },
 
+	// Start button
+	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_RETURN, 0x00, 0x80, false},
+	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_SPACE, 0x00, 0x80, false},
 
 	// Lightgun
 	{ Common::EVENT_LBUTTONDOWN, Common::EVENT_LBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x100, true },
 
-	// Start button
-	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_RETURN, 0x00, 0x80, false},
-	{Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_SPACE, 0x00, 0x80, false},
+	// Lightgun Start button
+	{ Common::EVENT_RBUTTONDOWN, Common::EVENT_RBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x200, false },
 };
 
 void SnatcherEngine::checkEvents(const GameState &state) {
@@ -256,8 +257,10 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 						_releaseKeys |= k.internalEvent;
 					if (k.updateCoords) {
 						_realLightGunPos = evt.mouse;
-						_input.lightGunPos.x = CLIP<int>(evt.mouse.x - state.conf.lightGunBias.x, 0, _gfx->screenWidth() - 1);
-						_input.lightGunPos.y = CLIP<int>(evt.mouse.y - state.conf.lightGunBias.y, 0, _gfx->screenHeight() - 1);
+						// The lightgun coordinates are supposed to be based on a 256 x 256 system, with 128 being
+						// the screen center. I solve this by always adding -16 to the y-bias.
+						_input.lightGunPos.x = CLIP<int>(_realLightGunPos.x - state.conf.lightGunBias.x, 0, 255);
+						_input.lightGunPos.y = CLIP<int>(_realLightGunPos.y - state.conf.lightGunBias.y, 0, 255);
 					}
 				}
 			} else if ((evt.type == k.releaseType) && (k.kc == Common::KEYCODE_INVALID || evt.kbd.keycode == k.kc) && (k.kFlag == 0 || (evt.kbd.flags & k.kFlag))) {
@@ -504,7 +507,6 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 }
 
 void SnatcherEngine::registerDefaultSettings() {
-	//ConfMan.registerDefault("cdaudio", true);
 }
 
 void SnatcherEngine::syncSoundSettings() {
@@ -540,6 +542,9 @@ void SnatcherEngine::pauseEngineIntern(bool pause) {
 void SnatcherEngine::calibrateLightGun(GameState &state) {
 	state.conf.lightGunBias.x = _realLightGunPos.x - (_gfx->screenWidth() / 2);
 	state.conf.lightGunBias.y = _realLightGunPos.y - (_gfx->screenHeight() / 2);
+	// The lightgun coordinates are supposed to be based on a 256 x 256 system, with 128 being
+	// the screen center. I solve this by always adding -16 to the y-bias.
+	state.conf.lightGunBias.y -= ((256 - _gfx->screenHeight()) / 2);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index 1044774a21e..c3e11a2ba14 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -52,7 +52,7 @@ private:
 	bool initResource();
 	bool initGfx(Common::Platform platform, bool use8BitColorMode);
 	bool initSound(Audio::Mixer *mixer, Common::Platform platform, int soundOptions);
-	void playBootSequence(const GameState &state);
+	void playBootLogoAnimation(const GameState &state);
 
 	// Main loop
 	bool start();
diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
index 81fdfc26fd3..539fbd4abf9 100644
--- a/engines/snatcher/sound_device_scd.cpp
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -33,8 +33,6 @@
 #include "snatcher/util.h"
 
 
-#define SNDDRV_DEBUG
-
 namespace Snatcher {
 
 class MessageHandler {
@@ -142,7 +140,7 @@ private:
 	struct PCMResidentDataInfo {
 		uint8 prio;
 		uint8 unit;
-		uint8 c;
+		uint8 vol;
 		uint8 pan;
 		uint16 rate;
 		uint32 addr;
@@ -159,8 +157,8 @@ private:
 		uint8 prio;
 		uint8 unit;
 		uint32 addr;
-		uint8 f16;
-		uint8 vol;
+		uint8 volBase;
+		uint8 volEff;
 		uint8 pan;
 		uint16 rate;
 	};
@@ -1993,7 +1991,7 @@ bool SegaSoundDevice::pcmLoadData() {
 	for (int i = 0; i < 0x4A; ++i) {
 		p2->prio = *in++;
 		p2->unit = *in++;
-		p2->c = *in++;
+		p2->vol = *in++;
 		p2->pan = *in++;
 		p2->rate = READ_BE_UINT16(in);
 		in += 2;
@@ -2061,8 +2059,8 @@ void SegaSoundDevice::pcmStartSound(uint8 sndId, int8 unit, uint8 vol) {
 		return;
 	pcmResetUnit(unit, s);
 	s.unit = p.unit;
-	s.f16 = p.c;
-	s.vol = vol ? (p.c * vol) >> 8 : p.c;
+	s.volBase = p.vol;
+	s.volEff = vol ? (p.vol * vol) >> 8 : p.vol;
 	s.pan = p.pan;
 	s.rate = p.rate;
 	s.addr = p.addr + 0x10;
@@ -2111,7 +2109,7 @@ void SegaSoundDevice::pcmDelayedStart() {
 		PCMResourceInfo &p = _pcmResourceInfo[_pcmResourceNumber];
 		s.addr = 0x65000;
 		s.prio = p.prio;
-		s.vol = p.vol;
+		s.volEff = p.vol;
 		s.pan = p.pan;
 		s.rate = 0x400;
 
@@ -2189,8 +2187,8 @@ void SegaSoundDevice::pcmStartInstrument(uint8 unit, uint8 sndId, uint8 vol) {
 	pcmResetUnit(unit, s);
 
 	s.unit = p.unit;
-	s.f16 = p.c;
-	s.vol = vol ? (p.c * vol) >> 8 : p.c;
+	s.volBase = p.vol;
+	s.volEff = vol ? (p.vol * vol) >> 8 : p.vol;
 	s.pan = p.pan;
 	s.rate = p.rate;
 
@@ -2201,7 +2199,7 @@ void SegaSoundDevice::pcmStartInstrument(uint8 unit, uint8 sndId, uint8 vol) {
 }
 
 uint8 SegaSoundDevice::calcVolume(uint8 unit, PCMSound &s) const {
-	uint8 vol = s.vol;
+	uint8 vol = s.volEff;
 	if (_unkVolCond)
 		vol = (vol * 112) >> 8;
 	if (unit >= 2 && _fmVolume1 != 0xFF)
diff --git a/graphics/segagfx.cpp b/graphics/segagfx.cpp
index aa69c53ea24..d63e91da5c0 100644
--- a/graphics/segagfx.cpp
+++ b/graphics/segagfx.cpp
@@ -426,10 +426,7 @@ void SegaRenderer::renderSprites(uint8 *dst, uint8 *dstPrio, int clipX, int clip
 				int y2 = y;
 
 				for (int blY = 0; blY < bH; ++blY) {
-					if (y >= clipY2)
-						break;
-
-					if (y > clipY - 8) {
+					if (y > clipY - 8 && y < clipY2) {
 						(this->*tr)(d, msk, x, y, tile, pal, vflip, hflip);
 						renderedSomething = true;
 					}


Commit: 8e718585d0b853b05a2f4c5e60cf9bd2afc11a4b
    https://github.com/scummvm/scummvm/commit/8e718585d0b853b05a2f4c5e60cf9bd2afc11a4b
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: work on script code and fix bugs

The first scene now shows up and the music plays.

Changed paths:
  A engines/snatcher/animator.h
  A engines/snatcher/animator_scd.cpp
  A engines/snatcher/script.cpp
  A engines/snatcher/script.h
  R engines/snatcher/render.h
  R engines/snatcher/render_scd.cpp
    audio/softsynth/fmtowns_pc98/sega_audio.cpp
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/info.h
    engines/snatcher/module.mk
    engines/snatcher/resource.h
    engines/snatcher/scene/scene_d0.cpp
    engines/snatcher/scene/scene_d2.cpp
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/sound.cpp
    engines/snatcher/sound.h
    engines/snatcher/sound_device.h
    engines/snatcher/sound_device_scd.cpp


diff --git a/audio/softsynth/fmtowns_pc98/sega_audio.cpp b/audio/softsynth/fmtowns_pc98/sega_audio.cpp
index 0550acebce7..8c37ae1802f 100644
--- a/audio/softsynth/fmtowns_pc98/sega_audio.cpp
+++ b/audio/softsynth/fmtowns_pc98/sega_audio.cpp
@@ -395,8 +395,9 @@ void SegaPCMChannel::playStream(Common::SharedPtr<Common::SeekableReadStream> &s
 	delete[] _streamTempBuff;
 	_streamTempBuff = new uint8[memAreaSize]();
 	_streamStartAddr = memAreaStartAddr;
+	uint16 dataSize = _streamSamplesLeft < memAreaSize ? _streamSamplesLeft : memAreaSize;
 	feed();
-	play(data, memAreaSize, memAreaStartAddr, 0, 0, rate, pan, vol);
+	play(data, dataSize, memAreaStartAddr, 0, 0, rate, pan, vol);
 }
 
 void SegaPCMChannel::stop() {
diff --git a/engines/snatcher/render.h b/engines/snatcher/animator.h
similarity index 67%
rename from engines/snatcher/render.h
rename to engines/snatcher/animator.h
index db46f991c5b..a325e869299 100644
--- a/engines/snatcher/render.h
+++ b/engines/snatcher/animator.h
@@ -28,9 +28,10 @@
 
 namespace Snatcher {
 
-class Renderer {
+class SoundEngine;
+class Animator {
 public:
-	virtual ~Renderer() {}
+	virtual ~Animator() {}
 
 	virtual bool enqueueDrawCommands(ResourcePointer &res) = 0;
 	virtual void clearDrawCommands() = 0;
@@ -42,18 +43,9 @@ public:
 	virtual void updateScreen(uint8 *screen) = 0;
 	virtual void updateAnimations() = 0;
 
-	virtual void anim_setControlFlags(uint8 animObjId, int flags) = 0;
-	virtual void anim_addControlFlags(uint8 animObjId, int flags) = 0;
-	virtual void anim_clearControlFlags(uint8 animObjId, int flags) = 0;
-	virtual void anim_setFrame(uint8 animObjId, uint16 frameNo) = 0;
-	virtual uint16 anim_getCurFrameNo(uint8 animObjId) const = 0;
-	virtual void anim_setPosX(uint8 animObjId, int16 x) = 0;
-	virtual void anim_setPosY(uint8 animObjId, int16 y) = 0;
-	virtual void anim_setSpeedX(uint8 animObjId, int16 speedX) = 0;
-	virtual void anim_setSpeedY(uint8 animObjId, int16 speedY) = 0;
-	virtual void anim_toggleBlink(uint8 animObjId, bool enable) = 0;
-	virtual bool anim_isEnabled(uint8 animObjId) const = 0;
-	virtual void anim_updateBlink() = 0;
+	virtual void setAnimParameter(uint8 animObjId, int param, int32 value) = 0;
+	virtual void setAnimGroupParameter(uint8 animObjId, int groupOp, int32 value = 0) = 0;
+	virtual int32 getAnimParameter(uint8 animObjId, int param) const = 0;
 
 	virtual uint16 screenWidth() const = 0;
 	virtual uint16 screenHeight() const = 0;
@@ -69,17 +61,17 @@ public:
 	virtual int drawBootLogoFrame(uint8 *screen, int frameNo) = 0;
 
 protected:
-	Renderer(GraphicsEngine::GfxState &state) : _gfxState(state) {}
+	Animator(GraphicsEngine::GfxState &state) : _gfxState(state) {}
 	GraphicsEngine::GfxState &_gfxState;
 
 private:
-	static Renderer *createSegaRenderer(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr);
+	static Animator *createSCDAnimator(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd);
 
 public:
-	static Renderer *create(const Graphics::PixelFormat *pxf, Common::Platform platform, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr) {
+	static Animator *create(const Graphics::PixelFormat *pxf, Common::Platform platform, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd) {
 		switch (platform) {
 		case Common::kPlatformSegaCD:
-			return createSegaRenderer(pxf, state, pal, scr);
+			return createSCDAnimator(pxf, state, pal, scr, snd);
 		default:
 			break;
 		};
diff --git a/engines/snatcher/render_scd.cpp b/engines/snatcher/animator_scd.cpp
similarity index 73%
rename from engines/snatcher/render_scd.cpp
rename to engines/snatcher/animator_scd.cpp
index f1773905048..77963f43bac 100644
--- a/engines/snatcher/render_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -26,8 +26,9 @@
 #include "graphics/segagfx.h"
 #include "snatcher/graphics.h"
 #include "snatcher/palette.h"
-#include "snatcher/render.h"
+#include "snatcher/animator.h"
 #include "snatcher/resource.h"
+#include "snatcher/sound.h"
 #include "snatcher/staticres.h"
 #include "snatcher/transition.h"
 #include "snatcher/util.h"
@@ -38,12 +39,12 @@ namespace Snatcher {
 //#define		ANIM_DEBUG
 
 struct AnimObject {
-	AnimObject(int num) : id(num), enable(0), fadeLevel(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), f16(0), f18(0), f1c(0),
+	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), f16(0), f18(0), f1c(0),
 		timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0),
-			res(), scriptData(), spriteData(nullptr), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), f4e(0), f4f(0), blink(0), blinkCounter(0), blinkDuration(0) {}
+			res(), scriptData(), spriteData(nullptr), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), scriptComFlags(0), f4f(0), blink(0), blinkCounter(0), blinkDuration(0) {}
 	
 	void clear() {
-		enable = fadeLevel = drawFlags = 0;
+		enable = blinkRate = drawFlags = 0;
 		posX = posY = 0;
 		relSpeedX = relSpeedY = 0;
 		f16 = 0;
@@ -60,13 +61,13 @@ struct AnimObject {
 		spriteData = nullptr;
 		absSpeedX = absSpeedY = 0;
 		parent = children = next = 0;
-		f4e = f4f = 0;
+		scriptComFlags = f4f = 0;
 		blink = blinkCounter = blinkDuration = 0;
 
 	}
 
 	uint16 enable;
-	uint16 fadeLevel;
+	uint16 blinkRate;
 	uint16 drawFlags;
 	int32 posX;
 	int32 posY;
@@ -97,17 +98,17 @@ struct AnimObject {
 	uint16 parent;
 	uint16 children;
 	uint16 next;
-	uint8 f4e;
+	uint8 scriptComFlags;
 	uint8 f4f;
 
 	const uint8 id;
 };
 
 class GraphicsEngine;
-class Renderer_SCD : public Renderer, public Graphics::SegaRenderer::HINTClient {
+class Animator_SCD : public Animator, public Graphics::SegaRenderer::HINTClient {
 public:
-	Renderer_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr);
-	~Renderer_SCD() override;
+	Animator_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd);
+	~Animator_SCD() override;
 
 	bool enqueueDrawCommands(ResourcePointer &res) override;
 	void clearDrawCommands() override;
@@ -120,18 +121,9 @@ public:
 	void updateScreen(uint8 *screen) override;
 	void updateAnimations() override;
 
-	void anim_setControlFlags(uint8 animObjId, int flags) override;
-	void anim_addControlFlags(uint8 animObjId, int flags) override;
-	void anim_clearControlFlags(uint8 animObjId, int flags) override;
-	void anim_setFrame(uint8 animObjId, uint16 frameNo) override;
-	uint16 anim_getCurFrameNo(uint8 animObjId) const override;
-	void anim_setPosX(uint8 animObjId, int16 x) override;
-	void anim_setPosY(uint8 animObjId, int16 y) override;
-	void anim_setSpeedX(uint8 animObjId, int16 speedX) override;
-	void anim_setSpeedY(uint8 animObjId, int16 speedY) override;
-	void anim_toggleBlink(uint8 animObjId, bool enable) override;
-	bool anim_isEnabled(uint8 animObjId) const override;
-	void anim_updateBlink() override;
+	void setAnimParameter(uint8 animObjId, int param, int32 value) override;
+	void setAnimGroupParameter(uint8 animObjId, int groupOp, int32 value = 0) override;
+	int32 getAnimParameter(uint8 animObjId, int param) const override;
 
 	uint16 screenWidth() const override { return _screenWidth; }
 	uint16 screenHeight() const override { return _screenHeight; }
@@ -162,9 +154,11 @@ private:
 	uint16 _clearFlags;
 	uint8 _mode;
 	uint8 _modeChange;
+	uint16 _frameCount3Dwn;
 	Graphics::SegaRenderer *_sr;
 	Palette *_pal;
 	TransitionManager *_trs;
+	SoundEngine *_snd;
 	const Graphics::SegaRenderer::HINTHandler _hINTClientProc;
 
 private:
@@ -188,15 +182,15 @@ private:
 
 private:
 #ifndef ANIM_DEBUG
-	typedef Common::Functor2Mem<AnimObject&, const uint8*, int, Renderer_SCD> GfxAnimFunc;
+	typedef Common::Functor2Mem<AnimObject&, const uint8*, int, Animator_SCD> GfxAnimFunc;
 #else
-	class GfxAnimFunc : public Common::Functor2Mem<AnimObject&, const uint8*, int, Renderer_SCD> {
+	class GfxAnimFunc : public Common::Functor2Mem<AnimObject&, const uint8*, int, Animator_SCD> {
 	public:
-		typedef int (Renderer_SCD::*AnimFunc)(AnimObject&, const uint8*);
-		GfxAnimFunc(Renderer_SCD *gfx, AnimFunc func, const char *desc) : Common::Functor2Mem<AnimObject &, const uint8*, int, Renderer_SCD>(gfx, func), _desc(Common::String("anim_") + desc) {}
-		int operator()(AnimObject &a, const uint8 *data) {
-			debug("%s():   anim: %02d,   data: [%02x %02x %02x]", _desc.c_str(), a.id, data[0], data[1], data[2]);
-			return Functor2Mem<AnimObject &, const uint8*, int, Renderer_SCD>::operator()(a, data);
+		typedef int (Animator_SCD::*AnimFunc)(AnimObject&, const uint8*);
+		GfxAnimFunc(Animator_SCD *gfx, AnimFunc func, const char *desc) : Common::Functor2Mem<AnimObject &, const uint8*, int, Animator_SCD>(gfx, func), _desc(Common::String("anim_") + desc) {}
+		int operator()(AnimObject &len, const uint8 *data) {
+			debug("%s():   anim: %02d,   data: [%02x %02x %02x]", _desc.c_str(), len.id, data[0], data[1], data[2]);
+			return Functor2Mem<AnimObject &, const uint8*, int, Animator_SCD>::operator()(len, data);
 		}
 	private:
 		Common::String _desc;
@@ -227,13 +221,13 @@ private:
 	int anim_terminateOther(AnimObject &a, const uint8 *data);
 	int anim_pauseAndHideOther(AnimObject &a, const uint8 *data);
 	int anim_hide(AnimObject &a, const uint8 *data);
-	int anim_24(AnimObject &a, const uint8 *data);
+	int anim_setScriptComFlag(AnimObject &a, const uint8 *data);
 	int anim_audioSync(AnimObject &a, const uint8 *data);
 	int anim_27(AnimObject &a, const uint8 *data);
 	int anim_28(AnimObject &a, const uint8 *data);
 	int anim_29(AnimObject &a, const uint8 *data);
 	int anim_30(AnimObject &a, const uint8 *data);
-	int anim_31(AnimObject &a, const uint8 *data);
+	int anim_pcmCommand(AnimObject &a, const uint8 *data);
 	int anim_setDrawFlags(AnimObject &a, const uint8 *data);
 	int anim_34(AnimObject &a, const uint8 *data);
 	int anim_35(AnimObject &a, const uint8 *data);
@@ -242,7 +236,7 @@ private:
 	int anim_38(AnimObject &a, const uint8 *data);
 	int anim_39(AnimObject &a, const uint8 *data);
 	int anim_40(AnimObject &a, const uint8 *data);
-	int anim_41(AnimObject &a, const uint8 *data);
+	int anim_pcmSync(AnimObject &a, const uint8 *data);
 	int anim_42(AnimObject &a, const uint8 *data);
 	int anim_43(AnimObject &a, const uint8 *data);
 	int anim_allowFrameDrop(AnimObject &a, const uint8 *data);
@@ -262,8 +256,8 @@ private:
 	uint8 *_bootsSprTbl;
 };
 
-Renderer_SCD::Renderer_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr) : Renderer(state), _pal(pal), _trs(scr), _mode(1),
-	_modeChange(0), _screenWidth(256), _screenHeight(224), _transferData(), _transferMode(0), _transferDelay(0), _clearFlags(0), _tempBuffer(nullptr), _spriteBuffer(nullptr), _sr(nullptr),
+Animator_SCD::Animator_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd) : Animator(state), _pal(pal), _trs(scr), _snd(snd), _mode(1),
+	_modeChange(0), _screenWidth(256), _screenHeight(224), _transferData(), _transferMode(0), _transferDelay(0), _clearFlags(0), _tempBuffer(nullptr), _spriteBuffer(nullptr), _sr(nullptr), _frameCount3Dwn(0),
 		_animations(nullptr), _drawCommands(nullptr), _hINTClientProc(Graphics::SegaRenderer::HINTHandler(this, &Graphics::SegaRenderer::HINTClient::hINTCallback)), _bootsDelay(0), _bootsSprTbl(nullptr),
 			_bootsTotalFrames(0), _bootsHScroll(0), _bootsVScroll(0), _bootsCol(0) {
 
@@ -298,7 +292,7 @@ Renderer_SCD::Renderer_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::Gfx
 	reconfigPlanes();
 }
 
-Renderer_SCD::~Renderer_SCD() {
+Animator_SCD::~Animator_SCD() {
 	delete _sr;
 	delete[] _tempBuffer;
 	delete[] _spriteBuffer;
@@ -310,11 +304,11 @@ Renderer_SCD::~Renderer_SCD() {
 		delete[] _animations;
 	}
 
-	for (uint i = 0; i < _animProcs.size(); ++i) \
+	for (uint i = 0; i < _animProcs.size(); ++i)
 		delete _animProcs[i];
 }
 
-bool Renderer_SCD::enqueueDrawCommands(ResourcePointer &res) {
+bool Animator_SCD::enqueueDrawCommands(ResourcePointer &res) {
 	for (DrawCommand *it = _drawCommands; it < &_drawCommands[7]; ++it) {
 		if (it->cmd != 0)
 			continue;
@@ -327,17 +321,17 @@ bool Renderer_SCD::enqueueDrawCommands(ResourcePointer &res) {
 	return false;
 }
 
-void Renderer_SCD::clearDrawCommands() {
+void Animator_SCD::clearDrawCommands() {
 	for (DrawCommand *it = _drawCommands; it < &_drawCommands[7]; ++it)
 		it->clear();
 }
 
-void Renderer_SCD::initData(ResourcePointer &res, uint8 mode) {
+void Animator_SCD::initData(ResourcePointer &res, uint8 mode) {
 	_transferData = res;
 	_transferMode = mode;
 }
 
-void Renderer_SCD::initAnimations(ResourcePointer &res, uint16 len) {
+void Animator_SCD::initAnimations(ResourcePointer &res, uint16 len) {
 	ResourcePointer next = res + len;
 	ResourcePointer in = res;
 	while (in < next) {
@@ -372,7 +366,7 @@ void Renderer_SCD::initAnimations(ResourcePointer &res, uint16 len) {
 	}
 }
 
-void Renderer_SCD::linkAnimations(ResourcePointer &res, uint16 len) {
+void Animator_SCD::linkAnimations(ResourcePointer &res, uint16 len) {
 	ResourcePointer next = res + len;
 	ResourcePointer in = res;
 	while (in < next) {
@@ -387,11 +381,11 @@ void Renderer_SCD::linkAnimations(ResourcePointer &res, uint16 len) {
 	}
 }
 
-void Renderer_SCD::clearAnimations(int mode) {
+void Animator_SCD::clearAnimations(int mode) {
 	if (mode) {
 		for (int i = 1; i < 64; ++i) {
 			AnimObject *s = _animations[i];
-			if (s->enable && !(s->f4e & 1))
+			if (s->enable && !(s->scriptComFlags & 1))
 				s->clear();
 		}
 	} else {
@@ -399,12 +393,12 @@ void Renderer_SCD::clearAnimations(int mode) {
 			_animations[i]->clear();
 	}
 }
-void Renderer_SCD::setPlaneMode(uint16 mode) {
+void Animator_SCD::setPlaneMode(uint16 mode) {
 	assert(mode >> 8 == 0);
 	_modeChange = mode & 0xFF;;
 }
 
-void Renderer_SCD::updateScreen(uint8 *screen) {
+void Animator_SCD::updateScreen(uint8 *screen) {
 	if (_gfxState.getVar(9)) {
 		_sr->setPlaneTableLocation(Graphics::SegaRenderer::kPlaneB, _gfxState.getVar(9) == 0xFF ? 0xE000 : 0xC000);
 		_gfxState.setVar(9, 0);
@@ -428,7 +422,7 @@ void Renderer_SCD::updateScreen(uint8 *screen) {
 	_sr->render(screen);
 }
 
-void Renderer_SCD::updateAnimations() {
+void Animator_SCD::updateAnimations() {
 	for (int i = 0; i < 64; ++i) {
 		AnimObject *s = _animations[i];
 		int16 dropFrames = _gfxState.getDropFrames();
@@ -468,88 +462,173 @@ void Renderer_SCD::updateAnimations() {
 	}
 }
 
-void Renderer_SCD::anim_setControlFlags(uint8 animObjId, int flags) {
+void Animator_SCD::setAnimParameter(uint8 animObjId, int param, int32 value) {
 	assert(animObjId < 64);
-	flags &= 7;
-	_animations[animObjId]->controlFlags = flags;
-}
-
-void Renderer_SCD::anim_addControlFlags(uint8 animObjId, int flags) {
-	assert(animObjId < 64);
-	flags &= 7;
-	_animations[animObjId]->controlFlags |= flags;
-}
-
-void Renderer_SCD::anim_clearControlFlags(uint8 animObjId, int flags) {
-	assert(animObjId < 64);
-	_animations[animObjId]->controlFlags &= ~flags;
-}
-
-void Renderer_SCD::anim_setFrame(uint8 animObjId, uint16 frameNo) {
-	assert(animObjId < 64);
-	_animations[animObjId]->frame = frameNo;
-}
-
-uint16 Renderer_SCD::anim_getCurFrameNo(uint8 animObjId) const {
-	assert(animObjId < 64);
-	return _animations[animObjId]->frame;
-}
-
-void Renderer_SCD::anim_setPosX(uint8 animObjId, int16 x) {
-	assert(animObjId < 64);
-	_animations[animObjId]->posX = x << 16;
-}
+	AnimObject &a = *_animations[animObjId];
 
-void Renderer_SCD::anim_setPosY(uint8 animObjId, int16 y) {
-	assert(animObjId < 64);
-	_animations[animObjId]->posY = y << 16;
-}
-
-void Renderer_SCD::anim_setSpeedX(uint8 animObjId, int16 speedX) {
-	assert(animObjId < 64);
-	_animations[animObjId]->absSpeedX = speedX << 16;
-}
+	switch (param) {
+	case GraphicsEngine::kAnimParaEnable:
+		a.enable = value ? 1 : 0;
+		break;
+	case GraphicsEngine::kAnimParaBlinkRate:
+		a.blinkRate = value;
+		break;
+	case GraphicsEngine::kAnimParaDrawFlags:
+		a.drawFlags = value;
+		break;
+	case GraphicsEngine::kAnimParaPosX:
+		a.posX = value << 16;
+		break;
+	case GraphicsEngine::kAnimParaPosY:
+		a.posY = value << 16;
+		break;
+	case GraphicsEngine::kAnimParaRelSpeedX:
+		a.relSpeedX = value << 16;
+		break;
+	case GraphicsEngine::kAnimParaRelSpeedY:
+		a.relSpeedY = value << 16;
+		break;
+	case GraphicsEngine::kAnimParaF16:
+		a.f16 = value;
+		break;
+	case GraphicsEngine::kAnimParaF18:
+		a.f18 = value;
+		break;
+	case GraphicsEngine::kAnimParaF1c:
+		a.f1c = value;
+		break;
+	case GraphicsEngine::kAnimParaTimeStamp:
+		a.timeStamp = (uint32)value;
+		break;
+	case GraphicsEngine::kAnimParaF24:
+		a.f24 = value;
+		break;
+	case GraphicsEngine::kAnimParaControlFlags:
+		a.controlFlags = value;
+		break;
+	case GraphicsEngine::kAnimParaAllowFrameDrop:
+		a.allowFrameDrop = value;
+		break;
+	case GraphicsEngine::kAnimParaFrameSeqCounter:
+		a.frameSeqCounter = value;
+		break;
+	case GraphicsEngine::kAnimParaFrame:
+		a.frame = value;
+		break;
+	case GraphicsEngine::kAnimParaFrameDelay:
+		a.frameDelay = value;
+		break;
+	case GraphicsEngine::kAnimParaF2c:
+		a.f2c = value;
+		break;
+	case GraphicsEngine::kAnimParaF2d:
+		a.f2d = value;
+		break;
+	case GraphicsEngine::kAnimParaBlink:
+		a.blink = value ? 1 : 0;
+		break;
+	case GraphicsEngine::kAnimParaBlinkCounter:
+		a.blinkCounter = value;
+		break;
+	case GraphicsEngine::kAnimParaBlinkDuration:
+		a.blinkDuration = value;
+		break;
+	case GraphicsEngine::kAnimParaAbsSpeedX:
+		a.absSpeedX = value << 16;
+		break;
+	case GraphicsEngine::kAnimParaAbsSpeedY:
+		a.absSpeedY = value << 16;
+		break;
+	case GraphicsEngine::kAnimParaScriptComFlags:
+		a.scriptComFlags = value;
+		break;
+	case GraphicsEngine::kAnimParaF4f:
+		a.f4f = value;
+		break;
 
-void Renderer_SCD::anim_setSpeedY(uint8 animObjId, int16 speedY) {
-	assert(animObjId < 64);
-	_animations[animObjId]->absSpeedY = speedY << 16;
+	default:
+		error("%s(): Unknown parameter %d", __FUNCTION__, param);
+		break;
+	}
 }
 
-void Renderer_SCD::anim_toggleBlink(uint8 animObjId, bool enable) {
+void Animator_SCD::setAnimGroupParameter(uint8 animObjId, int groupOp, int32 value) {
 	assert(animObjId < 64);
-	_animations[animObjId]->blink = enable ? 1 : 0;
+	AnimObject &a = *_animations[animObjId];
+	anim_setGroupParameter(a, groupOp, value);	
 }
 
-bool Renderer_SCD::anim_isEnabled(uint8 animObjId) const {
+int32 Animator_SCD::getAnimParameter(uint8 animObjId, int param) const {
 	assert(animObjId < 64);
-	return _animations[animObjId]->enable != 0;
-}
-
-void Renderer_SCD::anim_updateBlink() {
-	for (int i = 0; i < 3; ++i) {
-		AnimObject &a = *_animations[17 + i];
-		a.controlFlags = GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide;
-		if (a.absSpeedX)
-			a.controlFlags = GraphicsEngine::kAnimPause;
-		if (a.blink == 1) {
-			if (++a.blinkCounter >= 16) {
-				a.blinkCounter = 0;
-				a.absSpeedX ^= (1 << 16);
-				if (++a.blinkDuration >= 6)
-					a.blink = 0;
-			}
-		}
+	AnimObject &a = *_animations[animObjId];
+
+	switch (param) {
+	case GraphicsEngine::kAnimParaEnable:
+		return a.enable;
+	case GraphicsEngine::kAnimParaBlinkRate:
+		return a.blinkRate;
+	case GraphicsEngine::kAnimParaDrawFlags:
+		return a.drawFlags;
+	case GraphicsEngine::kAnimParaPosX:
+		return a.posX >> 16;
+	case GraphicsEngine::kAnimParaPosY:
+		return a.posY >> 16;
+	case GraphicsEngine::kAnimParaRelSpeedX:
+		return a.relSpeedX >> 16;
+	case GraphicsEngine::kAnimParaRelSpeedY:
+		return a.relSpeedY >> 16;
+	case GraphicsEngine::kAnimParaF16:
+		return a.f16;
+	case GraphicsEngine::kAnimParaF18:
+		return a.f18;
+	case GraphicsEngine::kAnimParaF1c:
+		return a.f1c;
+	case GraphicsEngine::kAnimParaTimeStamp:
+		return (int32)a.timeStamp;
+	case GraphicsEngine::kAnimParaF24:
+		return a.f24;
+	case GraphicsEngine::kAnimParaControlFlags:
+		return a.controlFlags;
+	case GraphicsEngine::kAnimParaAllowFrameDrop:
+		return a.allowFrameDrop;
+	case GraphicsEngine::kAnimParaFrameSeqCounter:
+		return a.frameSeqCounter;
+	case GraphicsEngine::kAnimParaFrame:
+		return a.frame;
+	case GraphicsEngine::kAnimParaFrameDelay:
+		return a.frameDelay;
+	case GraphicsEngine::kAnimParaF2c:
+		return a.f2c;
+	case GraphicsEngine::kAnimParaF2d:
+		return a.f2d;
+	case GraphicsEngine::kAnimParaBlink:
+		return a.blink;
+	case GraphicsEngine::kAnimParaBlinkCounter:
+		return a.blinkCounter;
+	case GraphicsEngine::kAnimParaBlinkDuration:
+		return a.blinkDuration;
+	case GraphicsEngine::kAnimParaAbsSpeedX:
+		return a.absSpeedX >> 16;
+	case GraphicsEngine::kAnimParaAbsSpeedY:
+		return a.absSpeedY >> 16;
+	case GraphicsEngine::kAnimParaScriptComFlags:
+		return a.scriptComFlags;
+	case GraphicsEngine::kAnimParaF4f:
+		return a.f4f;
+	default:
+		error("%s(): Unknown parameter %d", __FUNCTION__, param);
+		break;
 	}
 }
 
-void Renderer_SCD::hINTCallback(Graphics::SegaRenderer *sr) {
+void Animator_SCD::hINTCallback(Graphics::SegaRenderer *sr) {
 	if (_pal)
 		_pal->hINTCallback(sr);
 	if (_trs)
 		_trs->hINTCallback(sr);
 }
 
-void Renderer_SCD::loadDataFromGfxScript() {
+void Animator_SCD::loadDataFromGfxScript() {
 	if (_gfxState.getVar(0)) {
 		if (_gfxState.getVar(0) == 1) {
 			_gfxState.setVar(0, 2);
@@ -612,7 +691,7 @@ void Renderer_SCD::loadDataFromGfxScript() {
 	// ga_comm_loc_E322_writeWordRam_codeD6_dstA5_srcA6_lenD7
 }
 
-void Renderer_SCD::executeDrawCommands() {
+void Animator_SCD::executeDrawCommands() {
 	if (_gfxState.getVar(8))
 		return;
 
@@ -632,8 +711,18 @@ void Renderer_SCD::executeDrawCommands() {
 		if ((it->cmd & 0x0F) < 5 && (it->cmd & 0x0F) != 2 && !(it->cmd & 0x80)) {
 			const uint8 *cmp = it->res.makeAbsPtr(READ_BE_UINT32(it->ptr))();
 			uint32 len = READ_BE_UINT16(cmp);
-			if (len != Util::decodeSCDData(cmp + 2, s))
-				error("%s(): Decode size mismatch", __FUNCTION__);
+			if (len != 0) {
+				if (len != Util::decodeSCDData(cmp + 2, s))
+					error("%s(): Decode size mismatch", __FUNCTION__);
+			} else {
+				len = READ_BE_UINT16(it->ptr + 8);
+				int16 of = READ_BE_INT16(it->ptr + 6);
+				// This is only for weird hard coded cases. We do make some checks to see if it is sane enough...
+				if (len != 0 && of == 0)
+					 memcpy(s, cmp, len);
+				else
+					error("%s(): Unhandeled condition", __FUNCTION__);
+			}
 		}
 
 		switch (it->cmd & 0x0F) {
@@ -709,17 +798,16 @@ void Renderer_SCD::executeDrawCommands() {
 	}
 }
 
-void Renderer_SCD::drawAnimSprites() {
+void Animator_SCD::drawAnimSprites() {
 	uint16 *d = _spriteBuffer;
 	memset(d, 0, 4 * sizeof(uint16));
 	uint16 nxt = 1;
-	debug("%s():", __FUNCTION__);
+
 	for (int i = 0; i < 64; ++i) {
 		AnimObject &a = *_animations[i];
-		if (a.enable && a.spriteData != nullptr && !(a.controlFlags & GraphicsEngine::kAnimHide) && a.fadeLevel != 0xFFFF && !(a.fadeLevel & _gfxState.frameCount())) {
-			debug("		anim: %02d at x = %d, y = %d", i, a.posX >> 16, a.posY >> 16);
+		if (a.enable && a.spriteData != nullptr && !(a.controlFlags & GraphicsEngine::kAnimHide) && a.blinkRate != 0xFFFF && !(a.blinkRate & _gfxState.frameCount()))
 			generateSpriteData(a, nxt, d);
-		} if (i == 31)
+		if (i == 31)
 			updateAnim32Spec(a);
 	}
 
@@ -729,7 +817,7 @@ void Renderer_SCD::drawAnimSprites() {
 	_sr->loadToVRAM(_spriteBuffer, MAX<uint>(4, d - _spriteBuffer) * sizeof(uint16), 0xFE00);
 }
 
-void Renderer_SCD::reconfigPlanes() {
+void Animator_SCD::reconfigPlanes() {
 	if (_modeChange == 0xFF)
 		_mode = 1;
 	else if (_modeChange)
@@ -766,7 +854,7 @@ void Renderer_SCD::reconfigPlanes() {
 	_modeChange = 0;
 }
 
-void Renderer_SCD::updateScrollState() {
+void Animator_SCD::updateScrollState() {
 	if (!_trs->nextFrame())
 		return;
 
@@ -794,7 +882,7 @@ void Renderer_SCD::updateScrollState() {
 	}
 }
 
-void Renderer_SCD::generateSpriteData(AnimObject &a, uint16 &spritesCurIndex, uint16 *&spritesBufferCurPos) {
+void Animator_SCD::generateSpriteData(AnimObject &a, uint16 &spritesCurIndex, uint16 *&spritesBufferCurPos) {
 	const uint16 *in = a.spriteData;
 	uint16 num = FROM_BE_16(*in++) + 1;
 
@@ -842,7 +930,7 @@ void Renderer_SCD::generateSpriteData(AnimObject &a, uint16 &spritesCurIndex, ui
 	}
 }
 
-void Renderer_SCD::updateAnim32Spec(AnimObject &a) {
+void Animator_SCD::updateAnim32Spec(AnimObject &a) {
 	int _animSpec_activate = 0;
 	switch (_animSpec_activate) {
 	case 0:
@@ -856,11 +944,11 @@ void Renderer_SCD::updateAnim32Spec(AnimObject &a) {
 	}
 }
 
-bool Renderer_SCD::reachedAudioTimeStamp(AnimObject &a) const {
+bool Animator_SCD::reachedAudioTimeStamp(AnimObject &a) const {
 	return _gfxState.getAudioSync() >= a.timeStamp;
 }
 
-void Renderer_SCD::runAnimScript(AnimObject &a) {
+void Animator_SCD::runAnimScript(AnimObject &a) {
 	if (--a.frameDelay > 0) {
 		if (a.scriptData[a.frame << 2] != 0x97)
 			a.controlFlags &= ~GraphicsEngine::kAnimHide;
@@ -887,10 +975,10 @@ void Renderer_SCD::runAnimScript(AnimObject &a) {
 	}
 }
 
-void Renderer_SCD::makeAnimFunctions() {
+void Animator_SCD::makeAnimFunctions() {
 #ifndef ANIM_DEBUG
-	#define ANM(x) &Renderer_SCD::anim_##x
-	typedef int (Renderer_SCD::*AnimFunc)(AnimObject&, const uint8*);
+	#define ANM(x) &Animator_SCD::anim_##x
+	typedef int (Animator_SCD::*AnimFunc)(AnimObject&, const uint8*);
 	static const AnimFunc funcTbl[] = {
 #else
 	#define ANM(x) {&Renderer_SCD::anim_##x, #x}
@@ -924,14 +1012,14 @@ void Renderer_SCD::makeAnimFunctions() {
 		ANM(terminateOther),
 		ANM(pauseAndHideOther),
 		ANM(hide),
-		ANM(24),
+		ANM(setScriptComFlag),
 		ANM(audioSync),
 		ANM(audioSync),
 		ANM(27),
 		ANM(28),
 		ANM(29),
 		ANM(30),
-		ANM(31),
+		ANM(pcmCommand),
 		ANM(setDrawFlags),
 		ANM(setDrawFlags),
 		ANM(34),
@@ -941,7 +1029,7 @@ void Renderer_SCD::makeAnimFunctions() {
 		ANM(38),
 		ANM(39),
 		ANM(40),
-		ANM(41),
+		ANM(pcmSync),
 		ANM(42),
 		ANM(43),
 		ANM(allowFrameDrop),
@@ -963,17 +1051,17 @@ uint16 animRand(uint16 a, uint16 b) {
 	return ((b * Util::rngMakeNumber()) >> 16) + a;
 }
 
-int Renderer_SCD::anim_terminate(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_terminate(AnimObject &a, const uint8 *data) {
 	a.clear();
 	return -1;
 }
 
-int Renderer_SCD::anim_setFrame(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_setFrame(AnimObject &a, const uint8 *data) {
 	a.frame = *data;
 	return 0;
 }
 
-int Renderer_SCD::anim_seqSetFrame(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_seqSetFrame(AnimObject &a, const uint8 *data) {
 	if (a.frameSeqCounter == *data++) {
 		a.frameSeqCounter = 0;
 		return 1;
@@ -983,7 +1071,7 @@ int Renderer_SCD::anim_seqSetFrame(AnimObject &a, const uint8 *data) {
 	return 0;
 }
 
-int Renderer_SCD::anim_rndSeqSetFrame(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_rndSeqSetFrame(AnimObject &a, const uint8 *data) {
 	if (a.frameSeqCounter == 0)
 		a.frameSeqCounter = animRand(2, (uint16)data[1] - data[0]) & 0xFF;
 	if (a.frameSeqCounter == data[1]) {
@@ -995,33 +1083,33 @@ int Renderer_SCD::anim_rndSeqSetFrame(AnimObject &a, const uint8 *data) {
 	return 0;
 }
 
-int Renderer_SCD::anim_setX(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_setX(AnimObject &a, const uint8 *data) {
 	int16 xdiff = READ_BE_UINT16(data + 1) - (a.posX >> 16);
 	a.frameDelay = -1;
 	anim_setGroupParameter(a, 0, xdiff);
 	return 1;
 }
 
-int Renderer_SCD::anim_setY(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_setY(AnimObject &a, const uint8 *data) {
 	int16 ydiff = READ_BE_UINT16(data + 1) - (a.posY >> 16);
 	a.frameDelay = -1;
 	anim_setGroupParameter(a, 1, ydiff);
 	return 1;
 }
 
-int Renderer_SCD::anim_setSpeedX(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_setSpeedX(AnimObject &a, const uint8 *data) {
 	a.relSpeedX = (int32)((READ_BE_UINT16(data + 1) << 16) | (*data << 8));
 	anim_setGroupParameter(a, 2);
 	return 1;
 }
 
-int Renderer_SCD::anim_setSpeedY(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_setSpeedY(AnimObject &a, const uint8 *data) {
 	a.relSpeedY = (int32)((READ_BE_UINT16(data + 1) << 16) | (*data << 8));
 	anim_setGroupParameter(a, 3);
 	return 1;
 }
 
-int Renderer_SCD::anim_palEvent(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_palEvent(AnimObject &a, const uint8 *data) {
 	if (_gfxState.getVar(2))
 		return 1;
 	ResourcePointer r = a.scriptData + READ_BE_INT16(data + 1);
@@ -1030,113 +1118,115 @@ int Renderer_SCD::anim_palEvent(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_palReset(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_palReset(AnimObject &a, const uint8 *data) {
 	_pal->clearEvents();
 	return 1;
 }
 
-int Renderer_SCD::anim_copyCmds(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_copyCmds(AnimObject &a, const uint8 *data) {
 	ResourcePointer r = a.scriptData + READ_BE_INT16(data + 1);
 	return enqueueDrawCommands(r) ? 1 : -1;
 }
 
-int Renderer_SCD::anim_nop(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_nop(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_scrollSingleStepH(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_scrollSingleStepH(AnimObject &a, const uint8 *data) {
 	_trs->doCommand(1);
 	_trs->scroll_setSingleStep(*data ? TransitionManager::kHorzB : TransitionManager::kHorzA, READ_BE_INT16(data + 1));
 	return 1;
 }
 
-int Renderer_SCD::anim_scrollSingleStepV(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_scrollSingleStepV(AnimObject &a, const uint8 *data) {
 	_trs->doCommand(1);
 	_trs->scroll_setSingleStep(*data ? TransitionManager::kVertB : TransitionManager::kVertA, READ_BE_INT16(data + 1));
 	return 1;
 }
 
-int Renderer_SCD::anim_scrollStartH(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_scrollStartH(AnimObject &a, const uint8 *data) {
 	_trs->doCommand(2);
 	_trs->scroll_setDirectionAndSpeed(*data ? TransitionManager::kHorzB : TransitionManager::kHorzA, READ_BE_INT16(data + 1));
 	return 1;
 }
 
-int Renderer_SCD::anim_scrollStartV(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_scrollStartV(AnimObject &a, const uint8 *data) {
 	_trs->doCommand(2);
 	_trs->scroll_setDirectionAndSpeed(*data ? TransitionManager::kVertB : TransitionManager::kVertA, READ_BE_INT16(data + 1));
 	return 1;
 }
 
-int Renderer_SCD::anim_pause(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_pause(AnimObject &a, const uint8 *data) {
 	anim_setGroupParameter(a, 5);
 	return 1;
 }
 
-int Renderer_SCD::anim_resumeAndUnsyncOther(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_resumeAndUnsyncOther(AnimObject &a, const uint8 *data) {
 	assert(*data < 64);
 	anim_setGroupParameter(*_animations[*data], 4);
 	return 1;
 }
 
-int Renderer_SCD::anim_terminateOther(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_terminateOther(AnimObject &a, const uint8 *data) {
 	assert(*data < 64);
 	_animations[*data]->clear();
 	return 1;
 }
 
-int Renderer_SCD::anim_pauseAndHideOther(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_pauseAndHideOther(AnimObject &a, const uint8 *data) {
 	assert(*data < 64);
 	_animations[*data]->controlFlags = GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide;
 	return 1;
 }
 
-int Renderer_SCD::anim_hide(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_hide(AnimObject &a, const uint8 *data) {
 	a.controlFlags |= GraphicsEngine::kAnimHide;
 	return anim_updateFrameDelay(a, data);
 }
 
-int Renderer_SCD::anim_24(AnimObject &a, const uint8 *data) {
-	a.f4e |= 2;
+int Animator_SCD::anim_setScriptComFlag(AnimObject &a, const uint8 *data) {
+	a.scriptComFlags |= 2;
 	return 1;
 }
 
-int Renderer_SCD::anim_audioSync(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_audioSync(AnimObject &a, const uint8 *data) {
 	a.timeStamp = data[0] << 24 | data[1] << 16 | data[2] << 8;
 	a.controlFlags |= GraphicsEngine::kAnimAudioSync;
 	return 1;
 }
 
-int Renderer_SCD::anim_27(AnimObject &a, const uint8 *data) {
-	a.f4e |= 1;
+int Animator_SCD::anim_27(AnimObject &a, const uint8 *data) {
+	a.scriptComFlags |= 1;
 	_gfxState.setVar(4, *data);
 	return 1;
 }
 
-int Renderer_SCD::anim_28(AnimObject &a, const uint8 *data) {
-	a.f4e |= 0x80;
-	_gfxState.setVar(4, a.f4e);
+int Animator_SCD::anim_28(AnimObject &a, const uint8 *data) {
+	a.scriptComFlags |= 0x80;
+	_gfxState.setVar(4, a.scriptComFlags);
 	return 1;
 }
 
-int Renderer_SCD::anim_29(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_29(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_30(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_30(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_31(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_pcmCommand(AnimObject &a, const uint8 *data) {
+	if (1/*!_byteUnkli*/ && !(_snd->pcmGetStatus() & 0x07))
+		_snd->pcmSendCommand(*data, -1);
 	return 1;
 }
 
-int Renderer_SCD::anim_setDrawFlags(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_setDrawFlags(AnimObject &a, const uint8 *data) {
 	a.drawFlags = READ_BE_UINT16(data + 1);
 	return 1;
 }
 
-int Renderer_SCD::anim_34(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_34(AnimObject &a, const uint8 *data) {
 	a.f4f = 0;
 	if (_gfxState.getVar(8) == 0)
 		return 1;
@@ -1144,69 +1234,73 @@ int Renderer_SCD::anim_34(AnimObject &a, const uint8 *data) {
 	return -1;
 }
 
-int Renderer_SCD::anim_35(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_35(AnimObject &a, const uint8 *data) {
 	_gfxState.setVar(5, 1);
 	return 1;
 }
 
-int Renderer_SCD::anim_36(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_36(AnimObject &a, const uint8 *data) {
 	_gfxState.setFlag(1, 0);
 	return 1;
 }
 
-int Renderer_SCD::anim_37(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_37(AnimObject &a, const uint8 *data) {
 	static const uint8 cmd[] = { 0x25, 0x00 };
 	ResourcePointer r(cmd, 0);
 	enqueueDrawCommands(r);
 	return 1;
 }
 
-int Renderer_SCD::anim_38(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_38(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_39(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_39(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_40(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_40(AnimObject &a, const uint8 *data) {
 	//gfxDoCommand_D0(*data);
 	return 1;
 }
 
-int Renderer_SCD::anim_41(AnimObject &a, const uint8 *data) {
-	return 1;
-	//return -1;
+int Animator_SCD::anim_pcmSync(AnimObject &a, const uint8 *data) {
+	a.f4f = 0;
+	if (_snd->pcmGetStatus() & 0x02)
+		return 1;
+	a.f4f = 1;
+	return -1;
 }
 
-int Renderer_SCD::anim_42(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_42(AnimObject &a, const uint8 *data) {
+	_frameCount3Dwn = *data ? _gfxState.frameCount2() - _frameCount3Dwn : _gfxState.frameCount2();
 	return 1;
 }
 
-int Renderer_SCD::anim_43(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_43(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_allowFrameDrop(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_allowFrameDrop(AnimObject &a, const uint8 *data) {
 	a.allowFrameDrop = 1;
 	return 1;
 }
 
-int Renderer_SCD::anim_45(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_45(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Renderer_SCD::anim_46(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_46(AnimObject &a, const uint8 *data) {
 	_gfxState.setFlag(1, 1);
 	return 1;
 }
 
-int Renderer_SCD::anim_47(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_47(AnimObject &a, const uint8 *data) {
 	a.f1c = *data;
 	return 1;
 }
 
-int Renderer_SCD::anim_updateFrameDelay(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_updateFrameDelay(AnimObject &a, const uint8 *data) {
 	if (*data++) {
 		uint16 v1 = *data++;
 		uint16 v2 = *data - v1;
@@ -1217,7 +1311,7 @@ int Renderer_SCD::anim_updateFrameDelay(AnimObject &a, const uint8 *data) {
 	return -1;
 }
 
-void Renderer_SCD::anim_setGroupParameter(AnimObject &a, int para, int16 val, bool recursive) {
+void Animator_SCD::anim_setGroupParameter(AnimObject &a, int para, int16 val, bool recursive) {
 	AnimObject *ta = &a;
 	for (int n = ta->children; n || !recursive; n = recursive ? ta->next : 0) {
 		if (recursive)
@@ -1248,6 +1342,11 @@ void Renderer_SCD::anim_setGroupParameter(AnimObject &a, int para, int16 val, bo
 		case 6:
 			ta->controlFlags = GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide;
 			break;
+		case 7:
+			ta->controlFlags = ta->scriptComFlags = 0;
+			ta->frameDelay = -1;
+			ta->frame = 0xFFFF;
+			break;
 		default:
 			error("%s(): unhandled para %d", __FUNCTION__, para);
 			break;
@@ -1258,16 +1357,16 @@ void Renderer_SCD::anim_setGroupParameter(AnimObject &a, int para, int16 val, bo
 	}
 }
 
-void Renderer_SCD::createMouseCursor() {
+void Animator_SCD::createMouseCursor() {
 	// This will obviously only work when the necessary animation has been loaded.
-	anim_setControlFlags(16, GraphicsEngine::kAnimPause);
-	anim_setFrame(16, 0);
+	//anim_setControlFlags(16, GraphicsEngine::kAnimPause);
+	//anim_setFrame(16, 0);
 	
 	memset(_tempBuffer, 0, 0x10000);
 	updateAnimations();
 	drawAnimSprites();
 	_sr->renderSprites(_tempBuffer, nullptr);
-	anim_setControlFlags(16, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+	//anim_setControlFlags(16, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 
 	for (int i = 1; i < 24; ++i)
 		memcpy(_tempBuffer + i * 24, _tempBuffer + i * _screenWidth, 24);
@@ -1278,7 +1377,7 @@ void Renderer_SCD::createMouseCursor() {
 }
 
 // Boot logo sequence code. This has nothing to do with the engine graphics code, so I put it at the end, to keep the ugly mess out of sight...
-int Renderer_SCD::drawBootLogoFrame(uint8 *screen, int frameNo)  {
+int Animator_SCD::drawBootLogoFrame(uint8 *screen, int frameNo)  {
 	uint16 *tmp = reinterpret_cast<uint16*>(_tempBuffer);
 	uint32 len = 0;
 	uint16 val = 0;
@@ -1492,8 +1591,8 @@ int Renderer_SCD::drawBootLogoFrame(uint8 *screen, int frameNo)  {
 }
 
 
-Renderer *Renderer::createSegaRenderer(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr) {
-	return new Renderer_SCD(pxf, state, pal, scr);
+Animator *Animator::createSCDAnimator(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd) {
+	return new Animator_SCD(pxf, state, pal, scr, snd);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 3846a05c721..5ddc75a121b 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -22,7 +22,7 @@
 
 #include "snatcher/graphics.h"
 #include "snatcher/palette.h"
-#include "snatcher/render.h"
+#include "snatcher/animator.h"
 #include "snatcher/resource.h"
 #include "snatcher/transition.h"
 #include "common/endian.h"
@@ -31,20 +31,20 @@
 
 namespace Snatcher {
 
-GraphicsEngine::GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate) : _system(system), _state(vmstate),
-	_renderer(nullptr), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _flags(0) {
+GraphicsEngine::GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate, SoundEngine *snd) : _system(system), _state(vmstate),
+	_animator(nullptr), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _flags(0) {
 	assert(system);
 	_palette = Palette::create(pxf, _system->getPaletteManager(), platform, _state);
 	assert(_palette);
 	_trs = TransitionManager::create(platform, _state);
-	_renderer = Renderer::create(pxf, platform, _state, _palette, _trs);
-	assert(_renderer);
-	_screen = new uint8[_renderer->screenWidth() * _renderer->screenHeight() * (pxf ? pxf->bytesPerPixel : 1)]();
+	_animator = Animator::create(pxf, platform, _state, _palette, _trs, snd);
+	assert(_animator);
+	_screen = new uint8[_animator->screenWidth() * _animator->screenHeight() * (pxf ? pxf->bytesPerPixel : 1)]();
 	assert(_screen);
 }
 
 GraphicsEngine::~GraphicsEngine() {
-	delete _renderer;
+	delete _animator;
 	delete _palette;
 	delete _trs;
 	delete[] _screen;
@@ -66,15 +66,15 @@ void GraphicsEngine::runScript(ResourcePointer res, int func) {
 			break;
 		case 1:
 			_state.clearFlag(1, 0);
-			_renderer->initData(sc, _dataMode);
+			_animator->initData(sc, _dataMode);
 			_state.setVar(8, 1);
 			break;
 		case 2:
-			_renderer->initAnimations(sc, len);
+			_animator->initAnimations(sc, len);
 			break;
 		case 3: 
 		case 4:
-			_renderer->linkAnimations(sc, len);
+			_animator->linkAnimations(sc, len);
 			break;
 
 		case 5:
@@ -83,7 +83,7 @@ void GraphicsEngine::runScript(ResourcePointer res, int func) {
 			_transitionType = sc[1];
 			break;
 		case 8:
-			_renderer->setPlaneMode(sc.readUINT16());
+			_animator->setPlaneMode(sc.readUINT16());
 			break;
 		case 9:
 			_dataMode = sc[1];
@@ -91,7 +91,7 @@ void GraphicsEngine::runScript(ResourcePointer res, int func) {
 			// (in particular, the dma transfer from word ram to vram). We can just copy the whole thing at once...
 			break;
 		default:
-			error("Unknown opcode 0x%02x", cmd);
+			error("%s(): Unknown opcode 0x%02x", __FUNCTION__, cmd);
 		}
 
 		sc = next;
@@ -103,7 +103,7 @@ void GraphicsEngine::enqueuePaletteEvent(ResourcePointer res) {
 }
 
 bool GraphicsEngine::enqueueDrawCommands(ResourcePointer res) {
-	return _renderer->enqueueDrawCommands(res);
+	return _animator->enqueueDrawCommands(res);
 }
 
 void GraphicsEngine::setScrollStep(uint8 mode, int16 step) {
@@ -118,15 +118,15 @@ void GraphicsEngine::transitionCommand(uint8 cmd) {
 }
 
 void GraphicsEngine::updateAnimations() {
-	_renderer->updateAnimations();
+	_animator->updateAnimations();
 }
 
 void GraphicsEngine::nextFrame() {
 	_palette->processEventQueue();
 	_palette->updateSystemPalette();
-	_renderer->updateScreen(_screen);
+	_animator->updateScreen(_screen);
 
-	_system->copyRectToScreen(_screen, _renderer->screenWidth() * _bpp, 0, 0, _renderer->screenWidth(), _renderer->screenHeight());
+	_system->copyRectToScreen(_screen, _animator->screenWidth() * _bpp, 0, 0, _animator->screenWidth(), _animator->screenHeight());
 	_system->updateScreen();
 
 	_state.nextFrame();
@@ -140,9 +140,9 @@ void GraphicsEngine::reset(int mode) {
 	if (mode & kResetPalEvents)
 		_palette->clearEvents();
 	if (mode & kResetAnimations)
-		_renderer->clearAnimations();
+		_animator->clearAnimations();
 	if (mode & kResetCopyCmds)
-		_renderer->clearDrawCommands();
+		_animator->clearDrawCommands();
 	if (mode & kResetScrollState)
 		_trs->clear();
 }
@@ -151,67 +151,49 @@ void GraphicsEngine::setVar(uint8 var, uint8 val) {
 	_state.setVar(var, val);
 }
 
-void GraphicsEngine::setAnimControlFlags(uint8 animObjId, int flags) {
-	_renderer->anim_setControlFlags(animObjId, flags);
+uint8 GraphicsEngine::getVar(uint8 var) const {
+	return _state.getVar(var);
 }
 
-void GraphicsEngine::addAnimControlFlags(uint8 animObjId, int flags) {
-	_renderer->anim_addControlFlags(animObjId, flags);
+void GraphicsEngine::setAnimParameter(uint8 animObjId, int param, int32 value) {
+	_animator->setAnimParameter(animObjId, param, value);
 }
 
-void GraphicsEngine::clearAnimControlFlags(uint8 animObjId, int flags) {
-	_renderer->anim_clearControlFlags(animObjId, flags);
+void GraphicsEngine::setAnimGroupParameter(uint8 animObjId, int groupOp, int32 value) {
+	_animator->setAnimGroupParameter(animObjId, groupOp, value);
 }
 
-void GraphicsEngine::setAnimFrame(uint8 animObjId, uint16 frameNo) {
-	_renderer->anim_setFrame(animObjId, frameNo);
+int32 GraphicsEngine::getAnimParameter(uint8 animObjId, int param) const {
+	return _animator->getAnimParameter(animObjId, param);
 }
 
-uint16 GraphicsEngine::getAnimCurFrame(uint8 animObjId) const {
-	return _renderer->anim_getCurFrameNo(animObjId);
+void GraphicsEngine::addAnimParameterFlags(uint8 animObjId, int param, int flags) {
+	setAnimParameter(animObjId, param, getAnimParameter(animObjId, param) | flags);
 }
 
-void GraphicsEngine::setAnimPosX(uint8 animObjId, int16 x) {
-	_renderer->anim_setPosX(animObjId, x);
+void GraphicsEngine::clearAnimParameterFlags(uint8 animObjId, int param, int flags) {
+	setAnimParameter(animObjId, param, getAnimParameter(animObjId, param) & ~flags);
 }
 
-void GraphicsEngine::setAnimPosY(uint8 animObjId, int16 y) {
-	_renderer->anim_setPosY(animObjId, y);
-}
-
-void GraphicsEngine::setAnimSpeedX(uint8 animObjId, int16 speedX) {
-	_renderer->anim_setSpeedX(animObjId, speedX);
-}
-
-void GraphicsEngine::setAnimSpeedY(uint8 animObjId, int16 speedY) {
-	_renderer->anim_setSpeedY(animObjId, speedY);
-}
-
-void GraphicsEngine::toggleAnimBlink(uint8 animObjId, bool enable) {
-	_renderer->anim_toggleBlink(animObjId, enable);
-}
-
-bool GraphicsEngine::isAnimEnabled(uint8 animObjId) const {
-	return _renderer->anim_isEnabled(animObjId);
-}
-
-void GraphicsEngine::updateAnimBlink() {
-	_renderer->anim_updateBlink();
+bool GraphicsEngine::testAnimParameterFlags(uint8 animObjId, int param, int flags) const {
+	return (getAnimParameter(animObjId, param) & flags);
 }
 
 uint16 GraphicsEngine::screenWidth() const {
-	return _renderer ? _renderer->screenWidth() : 0;
+	return _animator ? _animator->screenWidth() : 0;
 }
 
 uint16 GraphicsEngine::screenHeight() const {
-	return _renderer ? _renderer->screenHeight() : 0;
+	return _animator ? _animator->screenHeight() : 0;
 }
 
 bool GraphicsEngine::busy(int type) const {
 	if (type == 0)
 		return ((_state.getVar(0) != 0) || (_state.getVar(8) != 0));
-	if (type == 1)
+	else if (type == 1)
 		return _state.getVar(3);
+	else if (type == 2)
+		return ((_state.getVar(4) & 0x7F) || (_state.testFlag(1, 0)));
 	return false;
 }
 
@@ -220,12 +202,12 @@ uint16 GraphicsEngine::frameCount() const {
 }
 
 void GraphicsEngine::createMouseCursor(bool show) {
-	_renderer->createMouseCursor();
+	_animator->createMouseCursor();
 }
 
 int GraphicsEngine::displayBootLogoFrame(int frameNo) {
-	int res = _renderer->drawBootLogoFrame(_screen, frameNo);
-	_system->copyRectToScreen(_screen, _renderer->screenWidth() * _bpp, 0, 0, _renderer->screenWidth(), _renderer->screenHeight());
+	int res = _animator->drawBootLogoFrame(_screen, frameNo);
+	_system->copyRectToScreen(_screen, _animator->screenWidth() * _bpp, 0, 0, _animator->screenWidth(), _animator->screenHeight());
 	_system->updateScreen();
 	return res;
 }
@@ -240,9 +222,9 @@ void GraphicsEngine::restoreDefaultsExt() {
 		_state.setVar(5, 0);
 	}
 
-	_renderer->clearDrawCommands();
+	_animator->clearDrawCommands();
 	_trs->doCommand(0xFC);
-	_renderer->clearAnimations(1);
+	_animator->clearAnimations(1);
 
 	if (!(_state.testFlag(4, 1)))
 		_state.setVar(0, 1);
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 768d0872146..bdabdcbdbc8 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -37,12 +37,13 @@ namespace Snatcher {
 
 class Palette;
 class TransitionManager;
-class Renderer;
+class Animator;
 class SceneModule;
+class SoundEngine;
 
 class GraphicsEngine {
 public:
-	GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate);
+	GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate, SoundEngine *snd);
 	~GraphicsEngine();
 
 	void runScript(ResourcePointer res, int func);
@@ -75,6 +76,36 @@ public:
 	void reset(int mode);
 
 	void setVar(uint8 var, uint8 val);
+	uint8 getVar(uint8 var) const;
+
+	enum AnimParameters : int {
+		kAnimParaEnable = 0,
+		kAnimParaBlinkRate,
+		kAnimParaDrawFlags,
+		kAnimParaPosX,
+		kAnimParaPosY,
+		kAnimParaRelSpeedX,
+		kAnimParaRelSpeedY,
+		kAnimParaF16,
+		kAnimParaF18,
+		kAnimParaF1c,
+		kAnimParaTimeStamp,
+		kAnimParaF24,
+		kAnimParaControlFlags,
+		kAnimParaAllowFrameDrop,
+		kAnimParaFrameSeqCounter,
+		kAnimParaFrame,
+		kAnimParaFrameDelay,
+		kAnimParaF2c,
+		kAnimParaF2d,
+		kAnimParaBlink,
+		kAnimParaBlinkCounter,
+		kAnimParaBlinkDuration,
+		kAnimParaAbsSpeedX,
+		kAnimParaAbsSpeedY,
+		kAnimParaScriptComFlags,
+		kAnimParaF4f
+	};
 
 	enum AnimFlags : int {
 		kAnimNone 				=	0,
@@ -83,19 +114,12 @@ public:
 		kAnimAudioSync			=	1 << 2
 	};
 
-	void setAnimControlFlags(uint8 animObjId, int flags);
-	void addAnimControlFlags(uint8 animObjId, int flags);
-	void clearAnimControlFlags(uint8 animObjId, int flags);
-	void setAnimFrame(uint8 animObjId, uint16 frameNo);
-	uint16 getAnimCurFrame(uint8 animObjId) const;
-	void setAnimPosX(uint8 animObjId, int16 x);
-	void setAnimPosY(uint8 animObjId, int16 y);
-	void setAnimSpeedX(uint8 animObjId, int16 speedX);
-	void setAnimSpeedY(uint8 animObjId, int16 speedY);
-	void toggleAnimBlink(uint8 animObjId, bool enable);
-	bool isAnimEnabled(uint8 animObjId) const;
-
-	void updateAnimBlink();
+	void setAnimParameter(uint8 animObjId, int param, int32 value);
+	void setAnimGroupParameter(uint8 animObjId, int groupOp, int32 value = 0);
+	int32 getAnimParameter(uint8 animObjId, int param) const;
+	void addAnimParameterFlags(uint8 animObjId, int param, int flags);
+	void clearAnimParameterFlags(uint8 animObjId, int param, int flags);
+	bool testAnimParameterFlags(uint8 animObjId, int param, int flags) const;
 
 	uint16 screenWidth() const;
 	uint16 screenHeight() const;
@@ -154,9 +178,13 @@ public:
 		uint16 getDropFrames() const {
 			return vm.dropFrames;
 		}
+
+		uint16 frameCount2() const {
+			return vm.frameCounter;
+		}
 	
 	private:
-		uint8 vars[11];
+		uint8 vars[12];
 		uint16 frameCounter;
 		const VMInfo &vm;
 	};
@@ -171,7 +199,7 @@ private:
 	uint8 _flags;
 
 	uint8 *_screen;
-	Renderer *_renderer;
+	Animator *_animator;
 	Palette *_palette;
 	TransitionManager *_trs;
 	OSystem *_system;
diff --git a/engines/snatcher/info.h b/engines/snatcher/info.h
index e50716c8b32..4e9cb0b58eb 100644
--- a/engines/snatcher/info.h
+++ b/engines/snatcher/info.h
@@ -28,8 +28,9 @@
 namespace Snatcher {
 
 struct VMInfo {
-	VMInfo() : dropFrames(0), audioSync(0) {}
+	VMInfo() : dropFrames(0), audioSync(0), frameCounter(0) {}
 	int16 dropFrames;
+	uint16 frameCounter;
 	uint32 audioSync;
 };
 
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index cd56ae71552..d6d3537c81e 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -1,14 +1,15 @@
 MODULE := engines/snatcher
 
 MODULE_OBJS := \
+	animator_scd.o \
 	graphics.o \
 	metaengine.o \
 	palette_scd.o \
-	render_scd.o \
 	resource.o \
 	scene/scene_d0.o \
 	scene/scene_d1.o \
 	scene/scene_d2.o \
+	script.o \
 	snatcher.o \
 	sound.o \
 	sound_device_scd.o \
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index 55cf3fb51cd..0729d4722c7 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -55,8 +55,7 @@ struct Config {
 };
 
 struct GameState {
-	GameState() : frameNo(0), frameState(0), finish(0), modProcessTop(0), modProcessSub(0), counter(0), modIndex(0), menuSelect(0),
-				  main_switch_1_0_orM1_postIntr(-1), topLevelState(0), conf(Config()) {}
+	GameState() : frameNo(0), frameState(0), finish(0), modProcessTop(0), modProcessSub(0), counter(0), modIndex(0), menuSelect(0), introState(0), chapter(0), conf(Config()) {}
 	int16 frameNo;
 	int16 frameState;
 	int16 finish;
@@ -65,8 +64,8 @@ struct GameState {
 	int16 counter;
 	int16 modIndex;
 	int16 menuSelect;
-	int16 main_switch_1_0_orM1_postIntr;
-	int16 topLevelState;
+	int16 introState;
+	int16 chapter;
 	Config conf;
 };
 
@@ -82,11 +81,19 @@ protected:
 };
 
 struct ResourcePointer {
-	ResourcePointer() : dataStart(0), offset(0), startAddr(0x28000) {}
-	ResourcePointer(const uint8 *data, uint32 offs) : dataStart(data), offset(offs), startAddr(0x28000) { if (offset >= startAddr) offset -= startAddr; }
+	ResourcePointer() : dataStart(0), offset(0), moduleLocation(0x28000), ownBuffer(false) {}
+	ResourcePointer(const uint8 *data, uint32 offs, uint32 loc = 0x28000, bool assignBufferOwnership = false) : dataStart(data), offset(offs), moduleLocation(loc), ownBuffer(assignBufferOwnership) {
+		if (offset >= moduleLocation)
+			offset -= moduleLocation;
+	}
+	~ResourcePointer() {
+		if (ownBuffer && dataStart)
+			delete[] dataStart;
+	}
 	const uint8 *dataStart;
 	uint32 offset;
-	uint32 startAddr;
+	uint32 moduleLocation;
+	bool ownBuffer;
 	const uint8 *operator()() const { return dataStart + offset; }
 	const uint8 *operator++(int) { return dataStart + (offset++); }
 	const uint8 *operator++() { return dataStart + (++offset); }
@@ -98,15 +105,15 @@ struct ResourcePointer {
 	uint16 readIncrSINT16() { int16 r = READ_BE_INT16(dataStart + offset); offset += 2; return r; }
 	uint32 readIncrUINT32() { uint32 r = READ_BE_UINT32(dataStart + offset); offset += 4; return r; }
 	uint32 readIncrSINT32() { int32 r = READ_BE_INT32(dataStart + offset); offset += 4; return r; }
-	ResourcePointer operator+(int inc) const { return ResourcePointer(dataStart, offset + startAddr + inc); }
-	bool operator<(const ResourcePointer &ptr) const { assert(dataStart == ptr.dataStart); return offset < ptr.offset; }
-	bool operator>(const ResourcePointer &ptr) const { assert(dataStart == ptr.dataStart); return offset > ptr.offset; }
-	bool operator==(const ResourcePointer &ptr) const { return dataStart == ptr.dataStart && offset == ptr.offset; }
+	ResourcePointer operator+(int inc) const { return ResourcePointer(dataStart, offset + moduleLocation + inc, moduleLocation); }
+	bool operator<(const ResourcePointer &ptr) const { assert(dataStart == ptr.dataStart && moduleLocation == ptr.moduleLocation); return offset < ptr.offset; }
+	bool operator>(const ResourcePointer &ptr) const { assert(dataStart == ptr.dataStart && moduleLocation == ptr.moduleLocation); return offset > ptr.offset; }
+	bool operator==(const ResourcePointer &ptr) const { return dataStart == ptr.dataStart && offset == ptr.offset && moduleLocation == ptr.moduleLocation; }
 	void operator+=(int inc) { offset += inc; }
 	void operator=(const uint8 *ptr) { offset = ptr - dataStart; }
 	uint8 operator[](int index) const { return dataStart[offset + index]; }
-	ResourcePointer getDataFromTable(int tableEntry) const { return ResourcePointer(dataStart, offset + startAddr + READ_BE_UINT16(dataStart + offset + (tableEntry << 1))); }
-	ResourcePointer makeAbsPtr(uint32 offs) const { return ResourcePointer(dataStart, offs); }
+	ResourcePointer getDataFromTable(int tableEntry) const { return ResourcePointer(dataStart, offset + moduleLocation + READ_BE_UINT16(dataStart + offset + tableEntry * 2), moduleLocation); }
+	ResourcePointer makeAbsPtr(uint32 offs) const { return ResourcePointer(dataStart, offs, moduleLocation); }
 };
 
 class SceneModule {
diff --git a/engines/snatcher/scene/scene_d0.cpp b/engines/snatcher/scene/scene_d0.cpp
index 348e5f53f2d..cb49fe00972 100644
--- a/engines/snatcher/scene/scene_d0.cpp
+++ b/engines/snatcher/scene/scene_d0.cpp
@@ -249,7 +249,7 @@ SH_IMPL_FRM(D0, 31) {
 }
 
 SH_IMPL_FRM(D0, 32) {
-	_vm->gfx()->setAnimControlFlags(16, GraphicsEngine::kAnimPause);
+	_vm->gfx()->setAnimParameter(16, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause);
 }
 
 SH_IMPL_FRM(D0, 34) {
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene/scene_d2.cpp
index e5bd1a34556..82e849cf293 100644
--- a/engines/snatcher/scene/scene_d2.cpp
+++ b/engines/snatcher/scene/scene_d2.cpp
@@ -44,6 +44,9 @@ SH_DCL_FRM(10)
 SH_DCL_FRM(11)
 SH_DCL_FRM(12)
 
+// extra functions
+void updateAnimBlink();
+
 // local vars
 int16 _option;
 uint16 _counter2;
@@ -110,7 +113,7 @@ SH_IMPL_FRM(D2, 00) {
 		break;
 	case 2:
 		if (_vm->input().controllerFlags & 3) {
-			_vm->gfx()->clearAnimControlFlags(16, ~GraphicsEngine::kAnimHide);
+			_vm->gfx()->clearAnimParameterFlags(16, GraphicsEngine::kAnimParaControlFlags, ~GraphicsEngine::kAnimHide);
 			_buram_0 ^= 1;
 		}
 		if (_vm->input().controllerFlags & 0x80) {
@@ -251,16 +254,16 @@ SH_IMPL_FRM(D2, 09) {
 	switch (state.frameState) {
 	case 0:
 		_vm->gfx()->transitionCommand(0xFF);
-		_vm->gfx()->clearAnimControlFlags(_hasSaveSlotFlag ? 17 : 16, ~GraphicsEngine::kAnimHide);
+		_vm->gfx()->clearAnimParameterFlags(_hasSaveSlotFlag ? 17 : 16, GraphicsEngine::kAnimParaControlFlags, ~GraphicsEngine::kAnimHide);
 		state.frameState += (_hasSaveSlotFlag ? 1 : 2);
 		break;
 	case 1:
 		if (_vm->input().controllerFlags & 3)
-			_vm->gfx()->clearAnimControlFlags(17, ~GraphicsEngine::kAnimHide);
+			_vm->gfx()->clearAnimParameterFlags(17, GraphicsEngine::kAnimParaControlFlags, ~GraphicsEngine::kAnimHide);
 		if (_vm->input().controllerFlags & 0x80) {
-			_vm->gfx()->setAnimControlFlags(17, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+			_vm->gfx()->setAnimParameter(17, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 			state.menuSelect = 1;
-			if (_vm->gfx()->getAnimCurFrame(17) == 3) {
+			if (_vm->gfx()->getAnimParameter(17, GraphicsEngine::kAnimParaFrame) == 3) {
 				state.menuSelect = 0;
 				++state.frameNo;
 			}
@@ -280,8 +283,8 @@ SH_IMPL_FRM(D2, 09) {
 		state.frameState = 0;
 		_bua3 = 56;
 		_vm->sound()->fmSendCommand(56, 0);
-		_vm->gfx()->setAnimControlFlags(16, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
-		_vm->gfx()->setAnimControlFlags(17, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+		_vm->gfx()->setAnimParameter(16, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+		_vm->gfx()->setAnimParameter(17, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 		_option = 0;
 	}
 }
@@ -300,9 +303,8 @@ SH_IMPL_FRM(D2, 10) {
 			++state.counter;
 			return;
 		}
-		_vm->gfx()->clearAnimControlFlags(24, 0xFF);
-		_vm->gfx()->clearAnimControlFlags(25, 0xFF);
-		
+		_vm->gfx()->clearAnimParameterFlags(24, GraphicsEngine::kAnimParaControlFlags, 0xFF);
+		_vm->gfx()->clearAnimParameterFlags(25, GraphicsEngine::kAnimParaControlFlags, 0xFF);		
 
 		do {
 			if (_vm->input().controllerFlags & 1)
@@ -312,8 +314,8 @@ SH_IMPL_FRM(D2, 10) {
 			_saveFileCurID &= 3;
 		} while (!(_hasSaveSlotFlag & (1 << _saveFileCurID)));
 
-		_vm->gfx()->setAnimFrame(24, _saveFileCurID << 2);
-		_vm->gfx()->setAnimFrame(25, _saveFileCurID << 2);
+		_vm->gfx()->setAnimParameter(24, GraphicsEngine::kAnimParaFrame, _saveFileCurID << 2);
+		_vm->gfx()->setAnimParameter(25, GraphicsEngine::kAnimParaFrame, _saveFileCurID << 2);
 
 		if (_vm->input().controllerFlags & 0x80) {
 			_bua3 = 56;
@@ -325,8 +327,8 @@ SH_IMPL_FRM(D2, 10) {
 			fin = true;
 		}
 		if (fin) {
-			_vm->gfx()->setAnimControlFlags(24, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
-			_vm->gfx()->setAnimControlFlags(25, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+			_vm->gfx()->setAnimParameter(24, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+			_vm->gfx()->setAnimParameter(25, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 			++state.frameState;
 			state.counter = 0;
 		}
@@ -351,8 +353,8 @@ SH_IMPL_FRM(D2, 10) {
 			return;
 		--state.frameNo;
 		state.frameState = 1;
-		_vm->gfx()->setAnimControlFlags(17, GraphicsEngine::kAnimPause);
-		_vm->gfx()->setAnimFrame(17, 0);
+		_vm->gfx()->setAnimParameter(17, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause);
+		_vm->gfx()->setAnimParameter(17, GraphicsEngine::kAnimParaFrame, 0);
 		break;
 	case 3:
 		break;
@@ -376,15 +378,14 @@ SH_IMPL_FRM(D2, 11) {
 		}
 
 		for (int i = 32; i < 37; ++i)
-			_vm->gfx()->clearAnimControlFlags(i, 0xFF);
+			_vm->gfx()->clearAnimParameterFlags(i, GraphicsEngine::kAnimParaControlFlags, 0xFF);
 
 		do {
-		if (_vm->input().controllerFlags & 1)
-			--_option;
-		if (_vm->input().controllerFlags & 2)
-			++_option;
-		_option = (_option + 5) % 5;
-
+			if (_vm->input().controllerFlags & 1)
+				--_option;
+			if (_vm->input().controllerFlags & 2)
+				++_option;
+			_option = (_option + 5) % 5;
 		} while (_option == 3 && !state.conf.useLightGun);
 
 		if (!state.conf.lightGunAvailable) {
@@ -407,12 +408,12 @@ SH_IMPL_FRM(D2, 11) {
 				state.conf.disableStereo ^= 1;
 		}		
 
-		_vm->gfx()->setAnimFrame(32, _option << 2);
-		_vm->gfx()->setAnimFrame(33, ((_option ? 2 : 0) + state.conf.useLightGun) << 1);
-		_vm->gfx()->setAnimFrame(36, state.conf.useLightGun << 1);
-		_vm->gfx()->setAnimFrame(34, ((_option != 1 ? 6 : 0) + state.conf.controllerSetup) << 1);
-		_vm->gfx()->setAnimFrame(35, ((_option != 2 ? 2 : 0) + state.conf.disableStereo) << 1);
-		
+		_vm->gfx()->setAnimParameter(32, GraphicsEngine::kAnimParaFrame, _option << 2);
+		_vm->gfx()->setAnimParameter(33, GraphicsEngine::kAnimParaFrame, ((_option ? 2 : 0) + state.conf.useLightGun) << 1);
+		_vm->gfx()->setAnimParameter(36, GraphicsEngine::kAnimParaFrame, state.conf.useLightGun << 1);
+		_vm->gfx()->setAnimParameter(34, GraphicsEngine::kAnimParaFrame, ((_option != 1 ? 6 : 0) + state.conf.controllerSetup) << 1);
+		_vm->gfx()->setAnimParameter(35, GraphicsEngine::kAnimParaFrame, ((_option != 2 ? 2 : 0) + state.conf.disableStereo) << 1);
+
 		if (_vm->input().controllerFlags & 0x80)
 			fin = (_option != 3) ? 1 : 3;
 		else if (_vm->input().controllerFlags & 0x70)
@@ -440,17 +441,13 @@ SH_IMPL_FRM(D2, 11) {
 	case 2:
 		state.counter  = 0;
 		_counter2 = 0;
-		_vm->gfx()->setAnimControlFlags(16, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
-		_vm->gfx()->setAnimFrame(16, 0);
-		_vm->gfx()->setAnimFrame(17, 0);
-		_vm->gfx()->setAnimFrame(18, 0);
-		_vm->gfx()->setAnimFrame(19, 0);
-		_vm->gfx()->toggleAnimBlink(17, false);
-		_vm->gfx()->setAnimSpeedX(17, 0);
-		_vm->gfx()->toggleAnimBlink(18, false);
-		_vm->gfx()->setAnimSpeedX(18, 0);
-		_vm->gfx()->toggleAnimBlink(19, 0);
-		_vm->gfx()->setAnimSpeedX(19, false);
+		_vm->gfx()->setAnimParameter(16, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+		for (int i = 0; i < 4; ++i)
+			_vm->gfx()->setAnimParameter(16 + i, GraphicsEngine::kAnimParaFrame, 0);
+		for (int i = 0; i < 3; ++i) {
+			_vm->gfx()->setAnimParameter(16 + i, GraphicsEngine::kAnimParaBlink, 0);
+			_vm->gfx()->setAnimParameter(16 + i, GraphicsEngine::kAnimParaAbsSpeedX, 0);
+		}
 
 		++state.frameState;
 		break;
@@ -462,37 +459,37 @@ SH_IMPL_FRM(D2, 11) {
 			return;
 		}
 
-		_vm->gfx()->updateAnimBlink();
+		updateAnimBlink();
 
 		switch (state.counter) {
 		case 0:
-			_vm->gfx()->toggleAnimBlink(18, true);
-			_vm->gfx()->setAnimSpeedX(18, 1);
+			_vm->gfx()->setAnimParameter(18, GraphicsEngine::kAnimParaBlink, 1);
+			_vm->gfx()->setAnimParameter(18, GraphicsEngine::kAnimParaAbsSpeedX, 1);
 			++state.counter;
 			break;
 		case 1:
 			if (_vm->input().controllerFlags & 0x100) {
 				_vm->sound()->pcmSendCommand(57, -1);
-				_vm->gfx()->toggleAnimBlink(18, false);
-				_vm->gfx()->setAnimSpeedX(18, 0);
-				_vm->gfx()->toggleAnimBlink(19, true);
-				_vm->gfx()->setAnimSpeedX(19, 1);
+				_vm->gfx()->setAnimParameter(18, GraphicsEngine::kAnimParaBlink, 0);
+				_vm->gfx()->setAnimParameter(18, GraphicsEngine::kAnimParaAbsSpeedX, 0);
+				_vm->gfx()->setAnimParameter(19, GraphicsEngine::kAnimParaBlink, 1);
+				_vm->gfx()->setAnimParameter(19, GraphicsEngine::kAnimParaAbsSpeedX, 1);
 				++state.counter;
 			}
 			break;
 		case 2:
 			_vm->calibrateLightGun(state);
-			_vm->gfx()->setAnimControlFlags(16, GraphicsEngine::kAnimPause);
-			_vm->gfx()->setAnimPosX(16, 117);
-			_vm->gfx()->setAnimPosY(16, 93);
+			_vm->gfx()->setAnimParameter(16, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause);
+			_vm->gfx()->setAnimParameter(16, GraphicsEngine::kAnimParaPosX, 117);
+			_vm->gfx()->setAnimParameter(16, GraphicsEngine::kAnimParaPosY, 93);
 			++state.counter;
 			break;
 		case 3:
 			if (_vm->input().controllerFlags & 0x200) {
-				_vm->gfx()->toggleAnimBlink(17, true);
-				_vm->gfx()->setAnimSpeedX(17, 1);
-				_vm->gfx()->toggleAnimBlink(19, false);
-				_vm->gfx()->setAnimSpeedX(19, 0);
+				_vm->gfx()->setAnimParameter(17, GraphicsEngine::kAnimParaBlink, 1);
+				_vm->gfx()->setAnimParameter(17, GraphicsEngine::kAnimParaAbsSpeedX, 1);
+				_vm->gfx()->setAnimParameter(19, GraphicsEngine::kAnimParaBlink, 0);
+				_vm->gfx()->setAnimParameter(19, GraphicsEngine::kAnimParaAbsSpeedX, 0);
 				state.counter += 2;
 				_vm->sound()->fmSendCommand(29, 0);
 			} else if (_vm->input().controllerFlags & 0x100) {
@@ -501,8 +498,8 @@ SH_IMPL_FRM(D2, 11) {
 			}
 			break;
 		case 4:
-			_vm->gfx()->setAnimPosX(16, _vm->input().lightGunPos.x - 11);
-			_vm->gfx()->setAnimPosY(16, _vm->input().lightGunPos.y - 35);
+			_vm->gfx()->setAnimParameter(16, GraphicsEngine::kAnimParaPosX, _vm->input().lightGunPos.x - 11);
+			_vm->gfx()->setAnimParameter(16, GraphicsEngine::kAnimParaPosY, _vm->input().lightGunPos.y - 35);
 			--state.counter;
 			break;
 		case 5:
@@ -537,4 +534,26 @@ SH_IMPL_FRM(D2, 12) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 }
 
+void Scene_D2::updateAnimBlink() {
+	for (int i = 0; i < 3; ++i) {
+		_vm->gfx()->setAnimParameter(17 + i, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+		int speedx = _vm->gfx()->getAnimParameter(17 + i, GraphicsEngine::kAnimParaAbsSpeedX);
+		if (speedx)
+			_vm->gfx()->setAnimParameter(17 + i, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause);
+		if (_vm->gfx()->getAnimParameter(17 + i, GraphicsEngine::kAnimParaBlink)) {
+			int bc = _vm->gfx()->getAnimParameter(17 + i, GraphicsEngine::kAnimParaBlinkCounter);
+			if (++bc >= 16) {
+				bc = 0;
+				int bd = _vm->gfx()->getAnimParameter(17 + i, GraphicsEngine::kAnimParaBlinkDuration) + 1;
+				_vm->gfx()->setAnimParameter(17 + i, GraphicsEngine::kAnimParaAbsSpeedX, 0);
+				_vm->gfx()->setAnimParameter(17 + i, GraphicsEngine::kAnimParaAbsSpeedX, speedx ^ 1);
+				_vm->gfx()->setAnimParameter(17 + i, GraphicsEngine::kAnimParaBlinkDuration, bd);
+				if (bd >= 6)
+					_vm->gfx()->setAnimParameter(17 + i, GraphicsEngine::kAnimParaBlink, 0);
+			}
+			_vm->gfx()->setAnimParameter(17 + i, GraphicsEngine::kAnimParaBlinkCounter, bc);
+		}
+	}
+}
+
 } // End of namespace Snatcher
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
new file mode 100644
index 00000000000..fea48c504c1
--- /dev/null
+++ b/engines/snatcher/script.cpp
@@ -0,0 +1,1216 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#include "common/endian.h"
+#include "snatcher/graphics.h"
+#include "snatcher/resource.h"
+#include "snatcher/script.h"
+#include "snatcher/snatcher.h"
+#include "snatcher/sound.h"
+
+
+namespace Snatcher {
+
+CmdQueue::CmdQueue(SnatcherEngine *vm) : _vm(vm), _data(nullptr), _readPos(0), _writePos(nullptr), _enable(false), _progress(-1), _currentOpcode(0) {
+	_data = new uint16[256]();
+	makeFunctions();
+	reset();
+}
+
+CmdQueue::~CmdQueue() {
+	delete[] _data;
+	for (Common::Array<CmdQueOpcode*>::iterator i = _opcodes.begin(); i != _opcodes.end(); ++ i)
+		delete *i;
+}
+
+void CmdQueue::reset() {
+	memset(_data, 0, 256);
+	_readPos = _writePos = _data;
+	_enable = false;
+	_progress = -1;
+}
+
+void CmdQueue::writeUInt16(uint16 val) {
+	*_writePos++ = val;
+}
+
+void CmdQueue::writeUInt32(uint32 val) {
+	*reinterpret_cast<uint32*>(_writePos) = val;
+	_writePos += 2;
+}
+
+void CmdQueue::run() {
+	if (!_enable)
+		return;
+
+	if (_progress == -1) {
+		_currentOpcode = *_readPos++;
+		_progress = 0;
+	}
+
+	if (_currentOpcode < _opcodes.size() && _opcodes[_currentOpcode]->isValid())
+		(*_opcodes[_currentOpcode])(_readPos);
+	else
+		error("%s(): Invalid opcode %d", __FUNCTION__, _currentOpcode);
+}
+
+void CmdQueue::makeFunctions() {
+#define OP(x) &CmdQueue::m_##x
+	typedef void (CmdQueue::*SFunc)(const uint16*&);
+	static const SFunc funcTbl[] = {
+		OP(end),
+		OP(01),
+		OP(02),
+		OP(03),
+		OP(04),
+		OP(05),
+		OP(06),
+		OP(fmMusicStart),
+		OP(gfxOps),
+		OP(animOps),
+		OP(pcmWait),
+		OP(11),
+		OP(12),
+		OP(mmSeq),
+		OP(14),
+		OP(gfxReset),
+		OP(waitFrames),
+		OP(loadResource),
+		OP(gfxStart),
+		OP(fmMusicWait),
+		OP(20),
+		OP(21),
+		OP(22),
+		OP(23),
+		OP(24),
+		OP(25),
+		OP(26),
+		OP(27),
+		OP(28),
+		OP(29),
+		OP(30),
+		OP(31),
+		OP(32),
+		OP(33),
+		OP(34),
+		OP(35)
+	};
+#undef OP
+
+	for (uint i = 0; i < ARRAYSIZE(funcTbl); ++i)
+		_opcodes.push_back(new CmdQueOpcode(this, funcTbl[i]));
+}
+
+void CmdQueue::m_end(const uint16 *&data) {
+	reset();
+}
+
+void CmdQueue::m_01(const uint16 *&data) {
+}
+
+void CmdQueue::m_02(const uint16 *&data) {
+}
+
+void CmdQueue::m_03(const uint16 *&data) {
+}
+
+void CmdQueue::m_04(const uint16 *&data) {
+}
+
+void CmdQueue::m_05(const uint16 *&data) {
+}
+
+void CmdQueue::m_06(const uint16 *&data) {
+}
+
+void CmdQueue::m_fmMusicStart(const uint16 *&data) {
+	uint8 cmd = *data++;
+	_vm->sound()->fmSendCommand(cmd, 1);
+	_vm->sound()->_fmPlayingTracks.music = (cmd == 0xFF) ? 0 : cmd;
+	_progress = -1;
+}
+
+void CmdQueue::m_gfxOps(const uint16 *&data) {
+}
+
+void CmdQueue::m_animOps(const uint16 *&data) {
+	switch (data[0]) {
+	case 0:
+	case 1:
+	case 2:
+		_vm->gfx()->setAnimGroupParameter(data[1], data[0] + 4);
+		break;
+	case 3:
+		if (_vm->gfx()->getAnimParameter(data[1], GraphicsEngine::kAnimParaEnable)) {
+			if (!_vm->gfx()->testAnimParameterFlags(data[1], GraphicsEngine::kAnimParaScriptComFlags, 2))
+				return;
+			_vm->gfx()->clearAnimParameterFlags(data[1], GraphicsEngine::kAnimParaScriptComFlags, 2);
+		}
+		break;
+	case 4:
+		_vm->gfx()->setAnimParameter(data[1], GraphicsEngine::kAnimParaScriptComFlags, 0xFF);
+		break;
+	case 5:
+		_vm->gfx()->setAnimGroupParameter(data[1], 7);
+		break;
+	default:
+		error("%s(): Unknown command %d", __FUNCTION__, data[0]);
+	}
+	data += 2;
+	_progress = -1;
+}
+
+void CmdQueue::m_pcmWait(const uint16 *&data) {
+	if (_progress == 0) {
+		_counter = 3600;
+		++_progress;
+	}
+	if (--_counter == 0 || !(_vm->sound()->pcmGetStatus() & 0x0F)) 
+		_progress = -1;
+}
+
+void CmdQueue::m_11(const uint16 *&data) {
+}
+
+void CmdQueue::m_12(const uint16 *&data) {
+}
+
+void CmdQueue::m_mmSeq(const uint16 *&data) {
+	if (_progress == 0) {
+		_vm->sound()->pcmInitSound(*data);
+		//_c13Valu = 0xFF;
+		++_progress;
+	} else if (_progress == 1) {
+		++_progress;
+	} else if (_progress == 2) {
+		if (_vm->_scd->makeAbsPtr(0x13FEC)[*data] != 0xFF)
+			_vm->gfx()->setVar(11, 1);
+		if (!_vm->gfx()->getVar(11)) {
+			_progress = -1;
+		} else {
+			_vm->gfx()->setVar(3, 1);
+			++_progress;
+		}
+
+	} else {
+		uint8 f = _vm->_scd->makeAbsPtr(0x13FEC)[*data];
+		if (f != 0xFF) {
+			//_vm->gfx()->dataMode = 1;
+			_vm->gfx()->runScript(_vm->_module->getPtr(0), f);
+			//_vm->gfx()->dataMode = 0;
+		}
+		_progress = -1;
+	}
+	if (_progress == -1)
+		++data;
+}
+
+void CmdQueue::m_14(const uint16 *&data) {
+}
+
+void CmdQueue::m_gfxReset(const uint16 *&data) {
+	if (_progress == 0) {
+		if (!_vm->gfx()->busy(2)) {
+			_vm->gfx()->reset(GraphicsEngine::kResetSetDefaults);
+		} else {
+			_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
+			++_progress;
+		}
+	} else {
+		// original: is file done loading
+		_progress = -1;
+	}
+}
+
+void CmdQueue::m_waitFrames(const uint16 *&data) {
+	if (_progress == 0) {
+		_counter = 0;
+		++_progress;
+	}
+	if (++_counter != *data)
+		return;
+
+	_counter = 0;
+	_progress = -1;
+	++data;
+}
+void CmdQueue::m_loadResource(const uint16 *&data) {
+	if (_progress == 0) {
+		_vm->sound()->cdaStop();
+		++_progress;
+	} else if (_progress == 1) {
+		uint32 dest = *reinterpret_cast<const uint32*>(data);
+		data += 2;
+		uint16 index = *data++;
+		++_progress;
+
+		if (dest == 0x1A800) {
+			assert(_vm->_script);
+			delete[] _vm->_script->data;
+			_vm->_script->data = _vm->_fio->fileData(index, &_vm->_script->dataSize);
+			assert(_vm->_script->data);
+			_vm->_script->curFileNo = index;
+		} else if (dest == 0x28000) {
+			delete _vm->_module;
+			_vm->_module = _vm->_fio->loadModule(index);
+			assert(_vm->_module);
+		} else {
+			error("%s(): Unexpected target address 0x%08x", __FUNCTION__, dest);
+		}
+
+	} else {
+		// original: is file done loading
+		_progress = -1;
+	}
+}
+
+void CmdQueue::m_gfxStart(const uint16 *&data) {
+	_vm->gfx()->runScript(_vm->_module->getPtr(0), *data++);
+	_progress = -1;
+}
+
+void CmdQueue::m_fmMusicWait(const uint16 *&data) {
+	if (_progress == 0) {
+		_counter = 2700;
+		++_progress;
+	}
+	if (--_counter == 0 || (_vm->sound()->_fmPlayingTracks.music == 0)) 
+		_progress = -1;
+}
+
+void CmdQueue::m_20(const uint16 *&data) {
+}
+
+void CmdQueue::m_21(const uint16 *&data) {
+}
+
+void CmdQueue::m_22(const uint16 *&data) {
+}
+
+void CmdQueue::m_23(const uint16 *&data) {
+}
+
+void CmdQueue::m_24(const uint16 *&data) {
+}
+
+void CmdQueue::m_25(const uint16 *&data) {
+}
+
+void CmdQueue::m_26(const uint16 *&data) {
+}
+
+void CmdQueue::m_27(const uint16 *&data) {
+}
+
+void CmdQueue::m_28(const uint16 *&data) {
+}
+
+void CmdQueue::m_29(const uint16 *&data) {
+}
+
+void CmdQueue::m_30(const uint16 *&data) {
+}
+
+void CmdQueue::m_31(const uint16 *&data) {
+}
+
+void CmdQueue::m_32(const uint16 *&data) {
+}
+
+void CmdQueue::m_33(const uint16 *&data) {
+}
+
+void CmdQueue::m_34(const uint16 *&data) {
+}
+
+void CmdQueue::m_35(const uint16 *&data) {
+}
+
+ScriptEngine::ScriptEngine(SnatcherEngine *vm, CmdQueue *que, ResourcePointer *scd) : _vm(vm), _que(que), _var(nullptr), _curPos(0), _op(0), /*_v1(0), _v2(0),*/ _v3(0), _v5(0), _buf352(nullptr) {
+	_var = new uint8[0x100]();
+	_arrays[0] = _var;
+	_arrays[1] = _var + 18;
+	_arrays[2] = _arrays[1] + 64;
+	_arrays[3] = _arrays[2] + 32;
+	_arrays[4] = _arrays[3] + 38;
+	_arrays[5] = _arrays[4] + 8;
+	_buf352 = new uint8[352]();
+
+	makeOpcodeTable(scd);
+}
+
+ScriptEngine::~ScriptEngine() {
+	delete[] _var;
+	delete[] _buf352;
+}
+
+void ScriptEngine::resetArrays() {
+	static const uint8 arraySize[] = { 0x08, 0x1F, 0x0F, 0x12, 0x03, 0x10 };
+	memset(_var, 0, 0x100);
+	for (int i = 0; i < ARRAYSIZE(_arrays); ++i)
+		_arrays[i][0] = arraySize[i];
+}
+
+void ScriptEngine::run(Script *script) {
+	assert(script);
+
+	if (script->newPos != -1) {
+		script->curPos = script->newPos;
+		script->newPos = -1;
+	}
+	_curPos = script->curPos;
+	script->sp = script->bp;
+	_script = script;
+
+	runOpcode(_curPos);
+}
+
+void ScriptEngine::cleanupState() {
+
+}
+
+void ScriptEngine::runOpcode(int offset) {
+	uint8 op = getOpcode(offset);
+	if (_opcodes[op].proc->isValid())
+		(*_opcodes[op].proc)();
+	else
+		error("%s(): Invalid opcode %d", __FUNCTION__, op);
+}
+
+#define S_FRAME(x) _script->sp += (x)
+#define S_WRBYTE(x, y) _script->sp[x] = (uint8)(y)
+#define S_INCBYTE(x) _script->sp[x]++
+#define S_DECBYTE(x) _script->sp[x]--
+#define S_ADDBYTE(x, y) _script->sp[x] += (uint8)(y)
+#define S_SUBBYTE(x, y) _script->sp[x] -= (uint8)(y)
+#define S_WRWORD(x, y) *(uint16*)(_script->sp + x) = (uint16)(y)
+#define S_RDBYTE(x) _script->sp[x]
+#define S_RDWORD(x) *(uint16*)(_script->sp + x)
+#define S_PUSH(x) S_FRAME(-2); S_WRWORD(0, x)
+#define S_POP() S_RDWORD(0); S_FRAME(2);
+#define ARR_SIZE(x)	_arrays[x][0]
+#define ARR_POS(x)	_arrays[x][1]
+#define ARR_WRITE(a, p, v) WRITE_BE_UINT16(_arrays[a] + 2 + 2 * p, v);
+#define ARR_READ(a, p) READ_BE_UINT16(_arrays[a] + 2 + 2 * p);
+
+void ScriptEngine::getOpcodeProps(int offset, int &len, int &f1, int &f2) {
+	uint8 op = getOpcode(offset);
+	len = _opcodes[op].len;
+	f1 = _opcodes[op].flags >> 4;
+	f2 = _opcodes[op].flags & 0x0F;
+}
+
+void ScriptEngine::runOpcode(int &offset, int len, int &result) {
+	if (len == 4) {
+		runOpcode(offset);
+		stackOps_unkParseTo(offset);
+	} else if (len == 1) {
+		getFlag(READ_BE_UINT16(_script->data + offset), result);
+		offset += 2;
+	} else if (len == 3 || len == 5) {
+		result = READ_BE_UINT16(_script->data + offset);
+		offset += 2;
+	} else {
+		error("%s(): Invalid opcode length %d", __FUNCTION__, len);
+	}
+}
+
+static const uint16 maskTable[] = {
+	0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
+	0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
+};
+
+void ScriptEngine::getFlag(int pos, int &result) {
+	const uint8 *in = &_buf352[pos >> 7];
+	result = (in[0] << 24 | in[1] << 16 | in[2] << 8);
+	uint8 v2 = pos & 0x0F;
+	uint8 v1 = v2 + 1 + ((pos >> 4) & 7);
+	result = (((uint32)result << v1) | ((uint32)result >> (32 - v1))) & maskTable[v2];
+}
+
+void ScriptEngine::setFlag(int pos, int val) {
+	uint8 v2 = pos & 0x0F;
+	uint8 v1 = v2 + 1 + ((pos >> 4) & 7);
+
+	uint16 msk = maskTable[v1];
+	val &= msk;
+	msk = ~msk;
+
+	uint8 *in = &_buf352[pos >> 7];
+	int cur = (in[0] << 24 | in[1] << 16 | in[2] << 8);
+
+	msk = (((uint32)msk << (32 - v1)) | ((uint32)msk >> v1));
+	val = (((uint32)val << (32 - v1)) | ((uint32)val >> v1));
+
+	val |= (cur & msk);
+	*in++ = (val >> 24) & 0xFF;
+	*in++ = (val >> 16) & 0xFF;
+	*in++ = (val >> 8) & 0xFF;
+}
+
+uint8 ScriptEngine::countFunctionOps(int offset) {
+	S_FRAME(-2);
+	S_WRBYTE(0, 0);
+
+	int r1 = 0;
+	int r2 = 0;
+	int r3 = 0;
+
+	for (bool lp = true; lp; ) {
+		S_INCBYTE(0);
+		if (!isExecFuncOpcode(offset))
+			break;
+		if (stackOps_checkFor52(offset, r1))
+			S_ADDBYTE(0, r1 - 1);
+		getOpcodeProps(offset, r1, r2, r3);
+		if (r2 == 7)
+			break;
+		if (opcodeHasFlag8(offset)) {
+			offset = READ_BE_UINT16(_script->data + offset + 1);
+		} else {
+			++offset;
+			stackOps_unkParseTo(offset);
+		}
+	}
+
+	uint8 res = S_RDBYTE(0);
+	S_FRAME(2);
+	return res;
+}
+
+void ScriptEngine::seekToFunctionOp(int &offset, int arg) {
+	S_FRAME(-2);
+	S_WRBYTE(0, arg);
+
+	int r1 = 0;
+	int r2 = 0;
+	int r3 = 0;
+
+	for (bool lp = true; lp; ) {
+		if (!isExecFuncOpcode(offset))
+			break;
+		if (stackOps_checkFor52(offset, r1))
+			S_SUBBYTE(0, r1 - 1);
+		S_SUBBYTE(0, 1);
+		if ((int8)S_RDBYTE(0) <= 0) {
+			skipOnFlag8(offset);
+			break;
+		}
+		if (opcodeHasFlag8(offset)) {
+			offset = READ_BE_UINT16(_script->data + offset + 1);
+		} else {
+			getOpcodeProps(offset, r1, r2, r3);
+			if (r1 == 4)
+				stackOps_unkParseTo(++offset);
+			else
+				offset += 3;
+		}
+	}
+
+	S_FRAME(2);
+}
+
+bool ScriptEngine::isExecFuncOpcode(int offset) {
+	uint8 op = getOpcode(offset);
+	return (op >= 30 && op <= 39);
+}
+
+bool ScriptEngine::stackOps_checkFor52(int offset, int &result) {
+	S_PUSH(offset);
+
+	int len = 0;
+	int f1 = 0;
+	int f2 = 0;
+
+	getOpcodeProps(offset, len, f1, f2);
+	if (len == 4) {
+		skipOnFlag8(offset);
+		uint8 op = getOpcode(offset);
+		if (op == 52 || op == 53) {
+			result = READ_BE_UINT16(_script->data + offset + 1);
+			return true;
+		}
+	}
+
+	S_FRAME(2);
+	return false;
+}
+
+bool ScriptEngine::opcodeHasFlag8(int offset) {
+	int len = 0;
+	int f1 = 0;
+	int f2 = 0;
+	getOpcodeProps(offset, len, f1, f2);
+	return ((f1 | f2) & 8);
+}
+
+bool ScriptEngine::OPC_4_ss() {
+	if (ARR_POS(1) || _script->newPos != -1)
+		return false;
+	if (_script->scriptStateByteUnk) {
+		int r1 = 0;
+		if (!getArrayLastEntry(0, r1))
+			return true;
+		return (_script->unkislp > r1);
+	}
+	return (_script->unkislp == ARR_POS(2));
+}
+
+void ScriptEngine::skipOnFlag8(int &offset) {
+	offset += (opcodeHasFlag8(offset) ? 3 : 1);
+}
+
+void ScriptEngine::stackOps_unkParseTo(int &offset) {
+	for (bool lp = true; lp; ) {
+		if (opcodeHasFlag8(offset)) {
+			offset = READ_BE_UINT16(_script->data + offset + 1);
+			continue;
+		}
+		S_FRAME(-4);
+		lp = false;
+
+		int len = 0;
+		int f1 = 0;
+		int f2 = 0;
+		getOpcodeProps(offset, len, f1, f2);
+		S_WRBYTE(0, len);
+		S_WRBYTE(1, f1);
+		S_WRBYTE(2, f2);
+		++offset;
+
+		if (len == 4)
+			stackOps_unkParseTo(offset);
+		else if (len != 0 && len != 7)
+			offset += 2;
+
+		uint8 b = S_RDBYTE(1);
+		if (b == 4)
+			stackOps_unkParseTo(offset);
+		else if (b != 0 && b != 7)
+			offset += 2;
+
+		b = S_RDBYTE(2);
+		if (b == 4)
+			stackOps_unkParseTo(offset);
+		else if (b != 0 && b != 7)
+			offset += 2;
+	}
+
+	S_FRAME(4);
+}
+
+bool ScriptEngine::getArrayLastEntry(int arrNo, int &result) {
+	assert(arrNo < ARRAYSIZE(_arrays));
+	return getArrayEntry(arrNo, ARR_POS(arrNo) - 1, result);
+}
+
+bool ScriptEngine::popArrayLastEntry(int arrNo, int &result) {
+	assert(arrNo < ARRAYSIZE(_arrays));
+	if (!ARR_POS(arrNo))
+		return false;
+	getArrayLastEntry(arrNo, result);
+	--ARR_POS(arrNo);
+	return true;
+}
+
+bool ScriptEngine::getArrayEntry(int arrNo, int pos, int &result) {
+	assert(arrNo < ARRAYSIZE(_arrays));
+	if (ARR_POS(arrNo) <= pos)
+		return false;
+	result = ARR_READ(arrNo, pos);
+	return true;
+}
+
+bool ScriptEngine::setArrayLastEntry(int arrNo, int val) {
+	assert(arrNo < ARRAYSIZE(_arrays));
+	if (ARR_SIZE(arrNo) <= ARR_POS(arrNo))
+		return false;
+	int pos = ARR_POS(arrNo)++;
+	if (ARR_POS(arrNo) <= pos)
+		return false;
+	ARR_WRITE(arrNo, pos, val);
+	return true;
+}
+
+uint8 ScriptEngine::getOpcode(int offset) {
+	if ((uint)offset >= _script->dataSize)
+		error("%s(): Offset %d is out of bounds", __FUNCTION__, offset);
+	uint8 op = _script->data[offset];
+	if (op >= _opcodes.size())
+		error("%s(): Opcode %d is out of bounds", __FUNCTION__, op);
+	return op;
+}
+
+void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
+#ifndef SNATCHER_SCRIPT_DEBUG
+	#define OP(x) &ScriptEngine::o_##x
+	typedef void (ScriptEngine::*SFunc)();
+#else
+	#define OP(x) {&ScriptEngine::o_##x, #x}
+	struct SFunc {
+		ScriptEngineProc::ScrFunc func;
+		const char *desc;
+	};
+#endif
+	static const SFunc funcTbl[] = {
+		OP(animOps),
+		OP(01),
+		OP(01),
+		OP(01),
+		OP(mmSequence),
+		OP(05),
+		OP(06),
+		OP(06),
+		OP(06),
+		OP(06),
+		OP(fmMusicStart),
+		OP(11),
+		OP(12),
+		OP(13),
+		OP(14),
+		OP(15),
+		OP(16),
+		OP(16),
+		OP(16),
+		OP(19),
+		OP(20),
+		OP(21),
+		OP(22),
+		OP(23),
+		OP(24),
+		OP(24),
+		OP(26),
+		OP(26),
+		OP(28),
+		OP(28),
+		OP(executeFunction),
+		OP(executeFunction),
+		OP(executeFunction),
+		OP(executeFunction),
+		OP(executeFunction),
+		OP(executeFunction),
+		OP(executeFunction),
+		OP(executeFunction),
+		OP(executeFunction),
+		OP(executeFunction),
+		OP(40),
+		OP(40),
+		OP(42),
+		OP(break),
+		OP(break),
+		OP(nop),
+		OP(46),
+		OP(46),
+		OP(startFunction),
+		OP(49),
+		OP(49),
+		OP(49),
+		OP(52),
+		OP(52),
+		OP(54),
+		OP(54),
+		OP(56),
+		OP(57),
+		OP(loadScript),
+		OP(59),
+		OP(59),
+		OP(loadModuleAndStartGfx),
+		OP(62),
+		OP(63),
+		OP(64),
+		OP(subOps),
+		OP(subOps),
+		OP(gfxOps),
+		OP(gfxOps),
+		OP(animWait),
+		OP(pcmSoundWait),
+		OP(fmMusicWait),
+		OP(72),
+		OP(73),
+		OP(waitFrames)
+	};
+#undef OP
+
+	const uint8 *in = scd->makeAbsPtr(0x16CDC)();
+
+	for (uint i = 0; i < ARRAYSIZE(funcTbl); ++i) {
+#ifndef SNATCHER_SCRIPT_DEBUG
+		_opcodes.push_back(ScriptEngineOpcode(in[0], in[1], new ScriptEngineProc(this, funcTbl[i])));
+#else
+		_opcodes.push_back(ScriptEngineOpcode(in[0], in[1], new ScriptEngineProc(this, funcTbl[i].func, funcTbl[i].desc, in[0], in[1])));
+#endif
+		in += 4;
+	}
+}
+
+void ScriptEngine::o_nop() {
+}
+
+void ScriptEngine::o_animOps() {
+	if (!OPC_4_ss())
+		return;
+	_que->writeUInt16(0x09);
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 4));
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 2));
+}
+
+void ScriptEngine::o_01() {
+
+}
+
+void ScriptEngine::o_mmSequence() {
+	if (!OPC_4_ss())
+		return;
+	_que->writeUInt16(0x0D);
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 1));
+}
+
+void ScriptEngine::o_05() {
+}
+
+void ScriptEngine::o_06() {
+}
+
+void ScriptEngine::o_fmMusicStart() {
+	if (!OPC_4_ss())
+		return;
+	_que->writeUInt16(0x07);
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 1));
+}
+
+void ScriptEngine::o_11() {
+	
+}
+
+void ScriptEngine::o_12() {
+	int cp = _script->curPos;
+	setArrayLastEntry(5, cp);
+	_curPos = _script->curPos = READ_BE_UINT16(_script->data + _curPos + 1);
+	runOpcode(_curPos);
+	popArrayLastEntry(5, cp);
+	_script->curPos = cp;
+}
+
+void ScriptEngine::o_13() {
+}
+
+void ScriptEngine::o_14() {
+}
+
+void ScriptEngine::o_15() {
+}
+
+void ScriptEngine::o_16() {
+}
+
+void ScriptEngine::o_19() {
+}
+
+void ScriptEngine::o_20() {
+}
+
+void ScriptEngine::o_21() {
+
+}
+
+void ScriptEngine::o_22() {
+	int len = 0;
+	int f1 = 0;
+	int f2 = 0;
+
+	getOpcodeProps(_curPos, len, f1, f2);
+	++_curPos;
+	int r1 = 0;
+	runOpcode(_curPos, len, r1);
+	int r2 = 0;
+	runOpcode(_curPos, f1, r2);
+	_v5 = (r1 > r2) ? -1 : 0;
+}
+
+void ScriptEngine::o_23() {
+}
+
+void ScriptEngine::o_24() {
+}
+
+void ScriptEngine::o_26() {
+	int len = 0;
+	int f1 = 0;
+	int f2 = 0;
+
+	getOpcodeProps(_curPos, len, f1, f2);
+
+	int pos = ++_curPos;
+	runOpcode(pos, len, _v5);
+	if (!_v5)
+		return;
+
+	_curPos = pos;
+	runOpcode(pos);
+}
+
+void ScriptEngine::o_28() {
+	if (!OPC_4_ss())
+		return;
+
+	int len = 0;
+	int f1 = 0;
+	int f2 = 0;
+
+	getOpcodeProps(_curPos, len, f1, f2);
+	S_PUSH(READ_BE_UINT16(_script->data + _curPos + 1));
+	_curPos += 3;
+	int res = 0;
+	runOpcode(_curPos, f1, res);
+	int pos = S_POP();
+	setFlag(pos, res);
+}
+
+
+void ScriptEngine::o_executeFunction() {
+	S_FRAME(-4);
+
+	S_WRBYTE(0, countFunctionOps(_curPos));
+	S_WRBYTE(1, 1);
+	S_WRWORD(2, _curPos);
+	
+	for (bool lp = true; lp; ) {
+		uint8 cnt = S_RDBYTE(1);
+		int offs = S_RDWORD(2);
+		seekToFunctionOp(offs, cnt);
+		_curPos = offs;
+		runOpcode(_curPos);
+
+		if (S_RDBYTE(0) == S_RDBYTE(1))
+			lp = false;
+		else
+			S_INCBYTE(1);
+	}
+
+	S_FRAME(4);
+}
+
+void ScriptEngine::o_40() {
+
+}
+
+void ScriptEngine::o_42() {
+}
+
+void ScriptEngine::o_break() {
+	if (!OPC_4_ss())
+		return;
+
+	int len = 0;
+	int f1 = 0;
+	int f2 = 0;
+
+	getOpcodeProps(_curPos, len, f1, f2);
+	int pos = _curPos + 1;
+	if (len != 5) {
+		int num = READ_BE_UINT16(_script->data + pos);
+		pos += 2;
+		if (_script->curFileNo != num) {
+			_script->curFileNo = num;
+			_que->writeUInt16(0x11);
+			_que->writeUInt32(0x1A800);
+			_que->writeUInt16(num);
+		}
+	}
+	_script->newPos = READ_BE_UINT16(_script->data + pos);
+}
+
+void ScriptEngine::o_46() {
+	int len = 0;
+	int f1 = 0;
+	int f2 = 0;
+	int pos = _curPos;
+	getOpcodeProps(_curPos, len, f1, f2);
+	runOpcode(_curPos, len, _v5);
+	_v5 = _v5 ? 0 : -1;
+}
+
+void ScriptEngine::o_startFunction() {
+	runOpcode(++_curPos);
+}
+
+void ScriptEngine::o_49() {
+}
+
+void ScriptEngine::o_52() {
+}
+
+void ScriptEngine::o_54() {
+}
+
+void ScriptEngine::o_56() {
+	if (_script->newPos != -1)
+		return;
+
+	int pos = _curPos;
+
+	if (ARR_POS(2) == _script->unkislp) {
+		int val = READ_BE_UINT16(_script->data + pos + 1);
+
+		if (ARR_SIZE(1) <= ARR_POS(1)) {
+			//_v1 = 0;
+			debug("Array 1 is full");
+		} else {
+			pos = ARR_POS(1)++;
+			if (ARR_POS(1) <= pos) {
+				//_v0 = 0;
+				debug("Array 1 is full");
+			} else {
+				ARR_WRITE(1, pos, val);
+				//_v1 = -1;
+			}
+		}
+
+	} else {
+		getArrayEntry(2, _script->unkislp, _v3);
+		if (READ_BE_UINT16(_script->data + pos + 1) != _v3)
+			return;
+
+		++_script->unkislp;
+		_curPos += 3;
+
+		runOpcode(_curPos);
+
+		if (ARR_POS(2) == _script->unkislp) {
+			if (ARR_POS(1))
+				_script->scriptStateByteUnk = 0xFF;
+		}
+		--_script->unkislp;
+	}
+}
+
+void ScriptEngine::o_57() {
+}
+
+void ScriptEngine::o_loadScript() {
+	int res = 0;
+	popArrayLastEntry(3, res);
+	_script->newPos = res;
+	popArrayLastEntry(3, res);
+	if (_script->curFileNo == res)
+		return;
+	_que->writeUInt16(0x11);
+	_que->writeUInt32(0x1A800);
+	_que->writeUInt16(res);
+}
+
+void ScriptEngine::o_59() {
+}
+
+void ScriptEngine::o_loadModuleAndStartGfx() {
+	if (!OPC_4_ss())
+		return;
+	int16 num = READ_BE_INT16(_script->data + _curPos + 1);
+
+	if (_script->curGfxScript == num)
+		return;
+
+	_que->writeUInt16(0x0F);
+
+	if ((_script->curGfxScript >> 8) != (num >> 8)) {
+		_que->writeUInt16(0x11);
+		_que->writeUInt32(0x28000);
+		_que->writeUInt16(num >> 8);
+	}
+
+	_que->writeUInt16(0x12);
+	_que->writeUInt16(num & 0xFF);
+
+	_script->curGfxScript = num;
+}
+
+void ScriptEngine::o_62() {
+}
+
+void ScriptEngine::o_63() {
+}
+
+void ScriptEngine::o_64() {
+}
+
+void ScriptEngine::o_subOps() {
+	if (!OPC_4_ss())
+		return;
+
+	int len = 0;
+	int f1 = 0;
+	int f2 = 0;
+
+	getOpcodeProps(_curPos, len, f1, f2);
+	int op = READ_BE_UINT16(_script->data + _curPos + (len == 4 ? 2 : 1));
+	uint16 addr = 0;
+	uint16 val = 0;
+
+	switch (op) {
+	case 0:
+		_que->writeUInt16(0x04);
+		break;
+	case 1:
+		_que->writeUInt16(0x1E);
+		_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 4));
+		//saveState_sub_14F12();
+		break;
+	case 2:
+		_que->writeUInt16(0x21);
+		break;
+	case 3:
+		_que->writeUInt16(0x1F);
+		break;
+	case 4:
+		//_scr_wd_00 = READ_BE_UINT16(_script->data + _curPos + 4);
+		//_scr_wd_01 = _scr_wd_02 = _scr_wd_03 = _scr_wd_04 = 0;
+		//_scr_bt_00 = true;
+		_que->writeUInt16(0x18);
+		break;
+	case 5:
+		addr = READ_BE_UINT16(_script->data + _curPos + 4);
+		_v5 = 0;//READ_BE_UINT16(addr);
+		debug ("READ VAR: Addr 0x%04x", addr);
+		break;
+	case 6:
+		addr = READ_BE_UINT16(_script->data + _curPos + 5);
+		val = READ_BE_UINT16(_script->data + _curPos + 7);
+		if (addr == 0xFFFF) // 79F0
+			_vm->sound()->setUnkCond(val);
+		else
+			debug ("WRITE VAR: Addr 0x%04x, Val 0x%04x", addr, val);
+		// WRITE_BE_UINT16(addr, val);
+		break;
+	case 7:
+		_que->writeUInt16(0x1D);
+		_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 4) ? 1 : 0);
+		break;
+	case 8:
+		if (READ_BE_UINT16(_script->data + _curPos + 4) == 0) {
+			_que->writeUInt16(0x09);
+			_que->writeUInt16(0x02);
+			_que->writeUInt16(0x01);
+		} else {
+			_que->writeUInt16(0x15);
+			_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 8));
+			_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 10));
+		}
+		break;
+	case 9:
+		/*_vm->_gameState.chapter = */READ_BE_UINT16(_script->data + _curPos + 4) + 2;
+		break;
+	case 10:
+		/*_doTransition? = */READ_BE_UINT16(_script->data + _curPos + 4);
+		/*if (_doTransition == 1)
+			_transDW1 = _transDW2 = 0;*/
+		break;
+	case 11:
+		/*if (READ_BE_UINT16(_script->data + _curPos + 4))
+			restoreGfxAndSoundAfterLoad();
+		else
+			animSpecOther();
+			*/
+		break;
+	case 12:
+		_buf352[53] &= 0xF8;
+		memset(_buf352 + 54, 0, 298);
+		break;
+	case 13:
+		_que->writeUInt16(0x1B);
+		_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 5));
+		_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 8));
+		_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 10));
+		break;
+	default:
+		break;
+	}
+}
+
+void ScriptEngine::o_gfxOps() {
+	if (!OPC_4_ss())
+		return;
+
+	int len = 0;
+	int f1 = 0;
+	int f2 = 0;
+
+	getOpcodeProps(_curPos, len, f1, f2);
+	int pos = _curPos + 1;
+
+	_que->writeUInt16(0x08);
+	if (len == 4) {
+		_que->writeUInt16(READ_BE_UINT16(_script->data + pos + 1));
+		pos += 3;
+	} else {
+		_que->writeUInt16(0);
+	}
+	_que->writeUInt16(READ_BE_UINT16(_script->data + pos));
+}
+
+void ScriptEngine::o_animWait() {
+	if (!OPC_4_ss())
+		return;
+	_que->writeUInt16(0x09);
+	_que->writeUInt16(0x03);
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 1));
+}
+
+void ScriptEngine::o_pcmSoundWait() {
+	if (OPC_4_ss())
+		_que->writeUInt16(0x0A);
+}
+
+void ScriptEngine::o_fmMusicWait() {
+	if (OPC_4_ss())
+		_que->writeUInt16(0x13);
+}
+
+void ScriptEngine::o_72() {
+}
+
+void ScriptEngine::o_73() {
+}
+
+void ScriptEngine::o_waitFrames() {
+	if (!OPC_4_ss())
+		return;
+	_que->writeUInt16(0x10);
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 1));
+}
+
+#undef S_FRAME
+#undef S_WRBYTE
+#undef S_WRWORD
+#undef S_RDBYTE
+#undef S_RDWORD
+#undef S_INCBYTE
+#undef S_DECBYTE
+#undef S_ADDBYTE
+#undef S_SUBBYTE
+#undef S_PUSH
+#undef S_POP
+#undef ARR_SIZE
+#undef ARR_POS
+#undef ARR_WRITE
+#undef ARR_READ
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/script.h b/engines/snatcher/script.h
new file mode 100644
index 00000000000..6e55b0801c1
--- /dev/null
+++ b/engines/snatcher/script.h
@@ -0,0 +1,250 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_SCRIPT_H
+#define SNATCHER_SCRIPT_H
+
+
+#include "common/ptr.h"
+#include "snatcher/resource.h"
+
+#define		SNATCHER_SCRIPT_DEBUG
+
+namespace Snatcher {
+
+class FIO;
+class SnatcherEngine;
+
+class CmdQueue {
+public:
+	CmdQueue(SnatcherEngine *vm);
+	~CmdQueue();
+	void reset();
+	void writeUInt16(uint16 val);
+	void writeUInt32(uint32 val);
+	void enable() { _enable = true; }	
+	bool running() const { return _enable; }
+	void run();
+
+private:
+	const uint16 *_readPos;
+	uint16 *_data;
+	uint16 *_writePos;
+	uint16 _currentOpcode;
+	int16 _progress;
+	uint16 _counter;
+	bool _enable;
+
+	SnatcherEngine *_vm;
+
+private:
+	void makeFunctions();
+
+	void m_end(const uint16 *&data);
+	void m_01(const uint16 *&data);
+	void m_02(const uint16 *&data);
+	void m_03(const uint16 *&data);
+	void m_04(const uint16 *&data);
+	void m_05(const uint16 *&data);
+	void m_06(const uint16 *&data);
+	void m_fmMusicStart(const uint16 *&data);
+	void m_gfxOps(const uint16 *&data);
+	void m_animOps(const uint16 *&data);
+	void m_pcmWait(const uint16 *&data);
+	void m_11(const uint16 *&data);
+	void m_12(const uint16 *&data);
+	void m_mmSeq(const uint16 *&data);
+	void m_14(const uint16 *&data);
+	void m_gfxReset(const uint16 *&data);
+	void m_waitFrames(const uint16 *&data);
+	void m_loadResource(const uint16 *&data);
+	void m_gfxStart(const uint16 *&data);
+	void m_fmMusicWait(const uint16 *&data);
+	void m_20(const uint16 *&data);
+	void m_21(const uint16 *&data);
+	void m_22(const uint16 *&data);
+	void m_23(const uint16 *&data);
+	void m_24(const uint16 *&data);
+	void m_25(const uint16 *&data);
+	void m_26(const uint16 *&data);
+	void m_27(const uint16 *&data);
+	void m_28(const uint16 *&data);
+	void m_29(const uint16 *&data);
+	void m_30(const uint16 *&data);
+	void m_31(const uint16 *&data);
+	void m_32(const uint16 *&data);
+	void m_33(const uint16 *&data);
+	void m_34(const uint16 *&data);
+	void m_35(const uint16 *&data);
+
+	typedef Common::Functor1Mem<const uint16*&, void, CmdQueue> CmdQueOpcode;
+	Common::Array<CmdQueOpcode*> _opcodes;
+};
+
+struct Script {
+	Script() : scriptStateByteUnk(0), unkislp(0), data(nullptr), dataSize(0), curPos(0), newPos(-1), curFileNo(0), curGfxScript(-1), stack(nullptr), stackSize(0x600), sp(nullptr), bp(nullptr) {
+		stack = new uint8[stackSize]();
+		sp = bp = &stack[stackSize];
+	}
+	~Script() {
+		delete[] stack;
+	}
+	uint8 scriptStateByteUnk;
+	uint8 unkislp;
+	uint8 curFileNo;
+	int16 curGfxScript;
+	const uint8 *data;
+	uint32 dataSize;
+	int curPos;
+	int newPos;
+	uint8 *stack;
+	const uint32 stackSize;
+	uint8 *sp;
+	uint8 *bp;
+};
+
+class ScriptEngine {
+public:
+	ScriptEngine(SnatcherEngine *vm, CmdQueue *que, ResourcePointer *scd);
+	~ScriptEngine();
+
+	//void writeVar(uint16 arrayNo, uint16 pos, uint8 val);
+	void resetArrays();
+	void run(Script *script);
+	void cleanupState();
+
+private:
+	SnatcherEngine *_vm;
+	CmdQueue *_que;
+	Script *_script;
+
+	uint8 *_var;
+	uint8 *_arrays[6];
+	uint8 *_buf352;
+	int _curPos;
+	int /*_v1, _v2, */_v3, _v5;
+	uint _op;
+
+private:
+	void runOpcode(int offset);
+	void getOpcodeProps(int offset, int &len, int &f1, int &f2);
+	void runOpcode(int &offset, int len, int &result);
+	void getFlag(int arg, int &result);
+	void setFlag(int arg, int val);
+
+	uint8 countFunctionOps(int offset);
+	void seekToFunctionOp(int &offset, int arg);
+	bool isExecFuncOpcode(int offset);
+	bool stackOps_checkFor52(int offset, int &result);
+	bool opcodeHasFlag8(int offset);
+	bool OPC_4_ss();
+	void skipOnFlag8(int &offset);
+	void stackOps_unkParseTo(int &offset);
+
+	bool getArrayLastEntry(int arrNo, int &result);
+	bool popArrayLastEntry(int arrNo, int &result);
+	bool getArrayEntry(int arrNo, int val, int &result);
+	bool setArrayLastEntry(int arrNo, int val);
+
+	uint8 getOpcode(int offset);
+
+private:
+	void makeOpcodeTable(ResourcePointer *scd);
+
+	void o_nop();
+	void o_animOps();
+	void o_01();
+	void o_mmSequence();
+	void o_05();
+	void o_06();
+	void o_fmMusicStart();
+	void o_11();
+	void o_12();
+	void o_13();
+	void o_14();
+	void o_15();
+	void o_16();
+	void o_19();
+	void o_20();
+	void o_21();
+	void o_22();
+	void o_23();
+	void o_24();
+	void o_26();
+	void o_28();
+	void o_executeFunction();
+	void o_40();
+	void o_42();
+	void o_break();
+	void o_46();
+	void o_startFunction();
+	void o_49();
+	void o_52();
+	void o_54();
+	void o_56();
+	void o_57();
+	void o_loadScript();
+	void o_59();
+	void o_loadModuleAndStartGfx();
+	void o_62();
+	void o_63();
+	void o_64();
+	void o_subOps();
+	void o_gfxOps();
+	void o_animWait();
+	void o_pcmSoundWait();
+	void o_fmMusicWait();
+	void o_72();
+	void o_73();
+	void o_waitFrames();
+
+#ifndef SNATCHER_SCRIPT_DEBUG
+	typedef Common::Functor0Mem<void, ScriptEngine> ScriptEngineProc;
+#else
+	class ScriptEngineProc : public Common::Functor0Mem<void, ScriptEngine> {
+	public:
+		typedef void (ScriptEngine::*ScrFunc)();
+		ScriptEngineProc(ScriptEngine *se, ScrFunc func, const char *desc, uint8 len, uint8 flg) : Common::Functor0Mem<void, ScriptEngine>(se, func), _desc(Common::String("o_") + desc) {
+			_desc += Common::String::format("() [len: %d, flags: 0x%02x]", len, flg);
+		}
+		void operator()() {
+			debug("%s", _desc.c_str());
+			Functor0Mem<void, ScriptEngine>::operator()();
+		}
+	private:
+		Common::String _desc;
+	};
+#endif
+
+	struct ScriptEngineOpcode {
+		ScriptEngineOpcode() : len(0), flags(0), proc(nullptr) {}
+		ScriptEngineOpcode(uint8 v1, uint8 v2, ScriptEngineProc *p) : len(v1), flags(v2), proc(Common::SharedPtr<ScriptEngineProc>(p)) {}
+		~ScriptEngineOpcode() {}
+		uint8 len;
+		uint8 flags;
+		Common::SharedPtr<ScriptEngineProc> proc;
+	};
+	Common::Array<ScriptEngineOpcode> _opcodes;
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_SCRIPT
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 1e438cc2060..d2800f90c02 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -21,6 +21,7 @@
 
 #include "snatcher/graphics.h"
 #include "snatcher/resource.h"
+#include "snatcher/script.h"
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
 #include "snatcher/util.h"
@@ -41,8 +42,8 @@
 
 namespace Snatcher {
 
-SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _gfx(nullptr), _snd(nullptr), _input(), _lastKeys(0),
-	_releaseKeys(0), _keyRepeat(false), _gfxInfo(), _frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
+SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _scd(nullptr), _gfx(nullptr), _snd(nullptr), _input(),
+	_scriptEngine(nullptr), _cmdQueue(nullptr), _script(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _gfxInfo(), _frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
 	assert(system);
 }
 
@@ -51,6 +52,10 @@ SnatcherEngine::~SnatcherEngine() {
 	delete _gfx;
 	delete _snd;
 	delete _fio;
+	delete _scd;
+	delete _scriptEngine;
+	delete _cmdQueue;
+	delete _script;
 }
 
 Common::Error SnatcherEngine::run() {
@@ -63,18 +68,36 @@ Common::Error SnatcherEngine::run() {
 		return Common::Error(Common::kAudioDeviceInitFailed);
 
 	if (!initGfx(_game.platform, SNATCHER_GFXMODE_8BIT))
+		return Common::Error(Common::kUnsupportedColorMode);
+
+	if (!initScriptEngine())
 		return Common::Error(Common::kUnknownError);
 
 	return Common::Error(start() ? Common::kNoError : Common::kUnknownError);
 }
 
 bool SnatcherEngine::initResource() {
-	return (_fio = new FIO(this, _game.isBigEndian));
+	_fio = new FIO(this, _game.isBigEndian);
+	if (!_fio)
+		return false;
+
+	uint32 size = 0;
+	const uint8 *data = _fio->fileData(96, &size);
+	if (!data)
+		return false;
+	_scd = new ResourcePointer(data, 0, 0xD400, true);
+	if (!_scd)
+		return false;
+
+	return true;
 }
 
 bool SnatcherEngine::initGfx(Common::Platform platform, bool use8BitColorMode) {
 	Graphics::PixelFormat pxf;
 
+	// Currently, the animation code needs access to the sound engine. Maybe this can be improved later...
+	assert(_snd);
+
 	if (use8BitColorMode) {
 		pxf = Graphics::PixelFormat::createFormatCLUT8();
 	} else {
@@ -94,7 +117,7 @@ bool SnatcherEngine::initGfx(Common::Platform platform, bool use8BitColorMode) {
 			error("%s(): No suitable color mode found", __FUNCTION__);
 	}
 
-	_gfx = new GraphicsEngine(&pxf, _system, platform, _gfxInfo);
+	_gfx = new GraphicsEngine(&pxf, _system, platform, _gfxInfo, _snd);
 	if (_gfx) {
 		initGraphics(_gfx->screenWidth(), _gfx->screenHeight(), &pxf);
 		return true;
@@ -110,6 +133,19 @@ bool SnatcherEngine::initSound(Audio::Mixer *mixer, Common::Platform platform, i
 	return (_snd && _snd->init(mixer));
 }
 
+bool SnatcherEngine::initScriptEngine() {
+	_cmdQueue = new CmdQueue(this);
+	if (!_cmdQueue)
+		return false;
+	_scriptEngine = new ScriptEngine(this, _cmdQueue, _scd);
+	if (!_scriptEngine)
+		return false;
+	_script = new Script();
+	if (!_script)
+		return false;
+	return true;
+}
+
 void SnatcherEngine::playBootLogoAnimation(const GameState &state) {
 	uint32 frameTimer = 0;
 	int curSeqState = 0;
@@ -147,9 +183,7 @@ bool SnatcherEngine::start() {
 		uint32 nextFrame = _system->getMillis() + (frameTimer >> 14);
 		frameTimer &= 0x3FFF;
 
-		int _sub_doMainScript = 0;
-
-		updateTopLevelState(state);
+		updateChapter(state);
 
 		_gfxInfo.audioSync = _snd->cdaIsPlaying() ? _snd->cdaGetTime() : 0;
 		Util::rngMakeNumber();
@@ -161,13 +195,12 @@ bool SnatcherEngine::start() {
 
 		for (int i = 0; i < numLoops; ++i) {
 			if (!_gfx->busy(0)) {
-				//subVintSub_2();
-				bool blockedUpdt = _sub_doMainScript;
-				if (_sub_doMainScript) {
-					//subVint_mainScriptRun__36Cases();
-					blockedUpdt = _gfx->busy(0);
+				bool blockedMod = _cmdQueue->running();
+				if (_cmdQueue->running()) {
+					_cmdQueue->run();
+					blockedMod = _gfx->busy(0);
 				}
-				if (!blockedUpdt) {
+				if (!blockedMod) {
 					updateModuleState(state);
 					_gfx->updateAnimations();
 				}
@@ -258,7 +291,7 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 					if (k.updateCoords) {
 						_realLightGunPos = evt.mouse;
 						// The lightgun coordinates are supposed to be based on a 256 x 256 system, with 128 being
-						// the screen center. I solve this by always adding -16 to the y-bias.
+						// the screen center. I solve this by always adding the diff to the y-bias.
 						_input.lightGunPos.x = CLIP<int>(_realLightGunPos.x - state.conf.lightGunBias.x, 0, 255);
 						_input.lightGunPos.y = CLIP<int>(_realLightGunPos.y - state.conf.lightGunBias.y, 0, 255);
 					}
@@ -270,33 +303,57 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 	}
 }
 
-void SnatcherEngine::updateTopLevelState(GameState &state) {
-	switch (state.topLevelState) {
+void SnatcherEngine::updateChapter(GameState &state) {
+	switch (state.chapter) {
 	case 0:
-		if (state.main_switch_1_0_orM1_postIntr == -1) {
-			++state.topLevelState;
-		}
+		// Intro and main menu
+		if (state.introState == -1)
+			++state.chapter;
 		break;
+
 	case 1:
+		// Init first scene or load savegame
+		_scriptEngine->resetArrays();
+		if (state.menuSelect == 0) {
+			_cmdQueue->writeUInt16(0x11);
+			_cmdQueue->writeUInt32(0x1A800);
+			_cmdQueue->writeUInt16(0x3F);
+			_cmdQueue->writeUInt16(15);
+		} else {
+			/* load savegame */
+		}
+
+		_cmdQueue->enable();
+		++state.chapter;
+		state.chapter |= 0x80;
 		break;
+
 	case 2:
+		_scriptEngine->run(_script);
+		_cmdQueue->enable();
+		state.chapter |= 0x80;
 		break;
+
 	case 3:
 		break;
+
 	case 4:
 		break;
+
 	case 5:
 		break;
+
 	default:
-		error("%s(): Invalid state %d", __FUNCTION__, state.topLevelState);
+		if (_cmdQueue->running() || (_snd->pcmGetStatus() & 7))
+			return;
+		state.chapter &= ~0x80;
 		break;
 	}
 }
 
 void SnatcherEngine::updateModuleState(GameState &state) {
-	int _unlCDREadSeekWord = 0;
-	uint8 _triggerPalFlag7Etc = 0;
 	bool _sub_bool_5 = false;
+	++_gfxInfo.frameCounter;
 
 	switch (state.modProcessTop) {
 	case -1:
@@ -349,7 +406,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 				state.finish = 0;
 				state.modProcessTop = state.menuSelect ? 7 : state.modProcessTop + 1;
 				state.modIndex = 0;
-				state.main_switch_1_0_orM1_postIntr = 1;
+				state.introState = 1;
 			}
 			break;
 		default:
@@ -375,7 +432,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 		case 1:
 			if (!(_gfx->frameCount() & 0x1F)) {
 				// startup__runWithFileFunc(2)
-				_unlCDREadSeekWord = 0;
+				//_unlCDREadSeekWord = 0;
 				state.frameNo = -1;
 				++state.modProcessSub;
 			}
@@ -387,8 +444,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 				state.finish = 0;
 				state.counter = 10;
 				++state.modProcessSub;
-				static const uint8 data[] = { 0x83, 0x00, 0x00, 0x3F };
-				_gfx->enqueuePaletteEvent(ResourcePointer(data, 0));
+				_gfx->enqueuePaletteEvent(_scd->makeAbsPtr(0x14B1C));
 			} else if (state.finish) {
 				if (state.modIndex == 0) {
 					++state.modIndex;
@@ -400,12 +456,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			break;
 		case 3:
 			if (--state.counter == 1) {
-				static const uint8 cmd[] = {
-					0x01, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xFF, 0xFF,
-					0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-					0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-				};
-				_gfx->enqueueDrawCommands(ResourcePointer(cmd, 0));
+				_gfx->enqueueDrawCommands(_scd->makeAbsPtr(0x14B4E));
 			} else if (state.counter == 0) {
 				state.finish = -1;
 				state.modProcessSub = 0;
@@ -443,9 +494,9 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 	case 6:
 		switch (state.modProcessSub) {
 		case 0:
-			if (!_gfx->isAnimEnabled(31)) {
+			if (!_gfx->getAnimParameter(31, GraphicsEngine::kAnimParaEnable)) {
 				_gfx->reset(GraphicsEngine::kResetSetDefaults | GraphicsEngine::kResetAnimations);
-				_triggerPalFlag7Etc = 0xFF;
+				_gfx->setVar(11, 0xFF);
 				++state.modProcessSub;
 				state.frameNo = -1;
 				state.frameState = 0;
@@ -461,7 +512,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			break;
 		case 2:
 			// startup__runWithFileFunc(2)
-			_unlCDREadSeekWord = 0;
+			//_unlCDREadSeekWord = 0;
 			++state.modProcessSub;
 			break;
 		case 3:
@@ -480,23 +531,22 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 		switch (state.modProcessSub) {
 		case 0:
 			_snd->cdaStop();
-			//loadFile56 PCMLT_01.BIN
+			// original: start load PCMLT_01.BIN
 			++state.modProcessSub;
 			break;
 		case 1:
 		case 3:
-			// startup__runWithFileFunc(2)
-			_unlCDREadSeekWord = 0;
+			// original: check if file loaded
 			++state.modProcessSub;
 			break;
 		case 2:
-			//loadFile54 PCMDRMDT.BIN
+			// original: start load PCMDRMDT.BIN
 			++state.modProcessSub;
 			break;
 		case 4:
 			state.modProcessTop = 5;
 			state.modProcessSub = 0;
-			state.main_switch_1_0_orM1_postIntr = -1;
+			state.introState = -1;
 			break;
 		default:
 			break;
@@ -543,7 +593,7 @@ void SnatcherEngine::calibrateLightGun(GameState &state) {
 	state.conf.lightGunBias.x = _realLightGunPos.x - (_gfx->screenWidth() / 2);
 	state.conf.lightGunBias.y = _realLightGunPos.y - (_gfx->screenHeight() / 2);
 	// The lightgun coordinates are supposed to be based on a 256 x 256 system, with 128 being
-	// the screen center. I solve this by always adding -16 to the y-bias.
+	// the screen center. I just add the diff to the y-bias...
 	state.conf.lightGunBias.y -= ((256 - _gfx->screenHeight()) / 2);
 }
 
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index c3e11a2ba14..d6510ae7172 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -34,11 +34,17 @@ namespace Snatcher {
 
 class GraphicsEngine;
 class FIO;
+class CmdQueue;
+class ScriptEngine;
 class SoundEngine;
 class SceneModule;
+
 struct GameState;
+struct ResourcePointer;
+struct Script;
 
 class SnatcherEngine : public Engine {
+friend class CmdQueue;
 public:
 	SnatcherEngine(OSystem *system, GameDescription &dsc);
 	~SnatcherEngine() override;
@@ -52,6 +58,7 @@ private:
 	bool initResource();
 	bool initGfx(Common::Platform platform, bool use8BitColorMode);
 	bool initSound(Audio::Mixer *mixer, Common::Platform platform, int soundOptions);
+	bool initScriptEngine();
 	void playBootLogoAnimation(const GameState &state);
 
 	// Main loop
@@ -59,7 +66,7 @@ private:
 	void delayUntil(uint32 end);
 	void checkEvents(const GameState &state);
 
-	void updateTopLevelState(GameState &state);
+	void updateChapter(GameState &state);
 	void updateModuleState(GameState &state);
 
 	const uint32 _frameLen;
@@ -78,6 +85,7 @@ private:
 	// Resource
 	FIO *_fio;
 	SceneModule *_module;
+	ResourcePointer *_scd;
 
 	// Graphics
 	GraphicsEngine *_gfx;
@@ -86,6 +94,11 @@ private:
 	// Sound
 	SoundEngine *_snd;
 
+	// Script
+	CmdQueue *_cmdQueue;
+	ScriptEngine *_scriptEngine;
+	Script *_script; 
+
 public:
 	// Input
 	struct Input {
diff --git a/engines/snatcher/sound.cpp b/engines/snatcher/sound.cpp
index 048d8c29760..b9d6bf23de1 100644
--- a/engines/snatcher/sound.cpp
+++ b/engines/snatcher/sound.cpp
@@ -79,6 +79,20 @@ void SoundEngine::pause(bool toggle) {
 
 void SoundEngine::update() {
 	_dev->update();
+
+	uint8 fms = fmGetStatus();
+	if (_fmPlayingTracks.sync == (fms & 0x0F))
+		return;
+
+	if (fms & 0x80)
+		_fmPlayingTracks.music = 0;
+	if (fms & 0x40)
+		_fmPlayingTracks.sfx = 0;
+	_fmPlayingTracks.sync = fms & 0x0F;
+}
+
+void SoundEngine::setUnkCond(bool enable) {
+	_dev->setUnkCond(enable);
 }
 
 void SoundEngine::setMusicVolume(int vol) {
diff --git a/engines/snatcher/sound.h b/engines/snatcher/sound.h
index 9afc4c157cb..b70c1662062 100644
--- a/engines/snatcher/sound.h
+++ b/engines/snatcher/sound.h
@@ -55,9 +55,20 @@ public:
 	void pause(bool toggle);
 	void update();
 
+	void setUnkCond(bool enable);
+
 	void setMusicVolume(int vol);
 	void setSoundEffectVolume(int vol);
 
+	struct FMPlayingTracks {
+		FMPlayingTracks() : music(0), sfx(0), sync(0) {}
+		uint8 music;
+		uint8 sfx;
+		uint8 sync;
+	};
+
+	FMPlayingTracks _fmPlayingTracks;
+
 private:
 	SoundDevice *_dev;
 };
diff --git a/engines/snatcher/sound_device.h b/engines/snatcher/sound_device.h
index c4a2f59a5e2..107015e95d9 100644
--- a/engines/snatcher/sound_device.h
+++ b/engines/snatcher/sound_device.h
@@ -54,6 +54,8 @@ public:
 	virtual void pause(bool toggle) = 0;
 	virtual void update() = 0;
 
+	virtual void setUnkCond(bool enable) = 0;
+
 	virtual void setMusicVolume(int vol) = 0;
 	virtual void setSoundEffectVolume(int vol) = 0;
 
diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
index 539fbd4abf9..4acf63739f5 100644
--- a/engines/snatcher/sound_device_scd.cpp
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -96,6 +96,8 @@ public:
 	void pause(bool toggle) override;
 	void update() override;
 
+	void setUnkCond(bool enable) override;
+
 	void setMusicVolume(int vol) override;
 	void setSoundEffectVolume(int vol) override;
 
@@ -1400,8 +1402,8 @@ void KonamiMCDSndChannel::op_return(const uint8 *&data) {
 				_state.progress |= 0x80;
 		}
 
-		_state.result = _state.progress;
-		if (_state.progress & 0xC0)
+		_state.result = _state.progress & 0xC0;
+		if (_state.result)
 			_state.progress = ((_state.progress & 0x0F) + 1) % 16;
 		_state.result |= _state.progress;
 	}
@@ -1833,9 +1835,13 @@ void SegaSoundDevice::pcmSendCommand(int cmd, int arg) {
 void SegaSoundDevice::pcmInitSound(int sndId) {
 	_pcmResourceNumber = sndId;
 	_pcmMode = _pcmResourceInfo[_pcmResourceNumber].mode;
-	if (_pcmResourceInfo[_pcmResourceNumber].mode == 1) {
+	if (_pcmMode == 1) {
 		_pcmState |= 4;
-	} else {
+	} else if (_pcmMode == 2 || _pcmMode == 0x82) {
+		if (_pcmMode == 2) {
+			_faderTimer2 = 0;
+			_faderFlags = (_faderFlags & ~2) | 1;
+		}
 		_pcmState = (_pcmState & ~8) | 1;
 	}
 }
@@ -1875,6 +1881,10 @@ void SegaSoundDevice::update() {
 	fmHandleCmdQueue();
 }
 
+void SegaSoundDevice::setUnkCond(bool enable) {
+	_unkVolCond = enable;
+}
+
 void SegaSoundDevice::setMusicVolume(int vol) {
 	_sai->setMusicVolume(vol);
 }
@@ -2072,7 +2082,15 @@ void SegaSoundDevice::pcmStartSound(uint8 sndId, int8 unit, uint8 vol) {
 }
 
 void SegaSoundDevice::pcmCheckPlayStatus() {
-	for (int i = 0; i < 2; ++i) {
+	int num = (_pcmMode == 2 || _pcmMode == 0x82) ? 4 : 2;
+	uint8 flg = (_pcmMode == 2 || _pcmMode == 0x82) ? 2 : 8;
+
+	if (_pcmMode == 2) {
+		_faderTimer2 = 0;
+		_faderFlags = (_faderFlags & ~1) | 2;
+	}
+	
+	for (int i = 0; i < num; ++i) {
 		PCMSound &s = _pcmSounds[i];
 		if (s.prio == 0)
 			continue;
@@ -2080,8 +2098,7 @@ void SegaSoundDevice::pcmCheckPlayStatus() {
 		s.flags &= ~2;
 		if (!_sai->isPCMChannelPlaying(i << 1) && !_sai->isPCMChannelPlaying(((i << 1) | 1))) {
 			pcmResetUnit(i, s);
-			_pcmState &= ~8;
-			_pcmState &= ~2;
+			_pcmState &= ~flg;
 			_pcmMode = 0;
 		}
 	}


Commit: 420697c4b191bd8bc8bdde85d32b68dfd257bd6a
    https://github.com/scummvm/scummvm/commit/420697c4b191bd8bc8bdde85d32b68dfd257bd6a
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: work on scripts and text rendering

(game is now able to reach the first scene)

Changed paths:
  A engines/snatcher/text.h
  A engines/snatcher/text_scd.cpp
    engines/snatcher/animator.h
    engines/snatcher/animator_scd.cpp
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/module.mk
    engines/snatcher/palette_scd.cpp
    engines/snatcher/resource.cpp
    engines/snatcher/resource.h
    engines/snatcher/scene/scene_d2.cpp
    engines/snatcher/script.cpp
    engines/snatcher/script.h
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/transition.h
    engines/snatcher/transition_scd.cpp


diff --git a/engines/snatcher/animator.h b/engines/snatcher/animator.h
index a325e869299..cbd0dba0167 100644
--- a/engines/snatcher/animator.h
+++ b/engines/snatcher/animator.h
@@ -40,6 +40,10 @@ public:
 	virtual void linkAnimations(ResourcePointer &res, uint16 len) = 0;
 	virtual void clearAnimations(int mode = 0) = 0;
 	virtual void setPlaneMode(uint16 mode) = 0;
+
+	virtual void resetTextFields() = 0;
+	virtual void renderTextBuffer(const uint8 *textBuffer, uint16 firstLine, uint8 numLines) = 0;
+
 	virtual void updateScreen(uint8 *screen) = 0;
 	virtual void updateAnimations() = 0;
 
diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index 77963f43bac..cdb7f8096cc 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -57,7 +57,8 @@ struct AnimObject {
 		frameDelay = 0;
 		f2c = f2d = 0;
 		spriteTableLocation = 0;
-		res = scriptData = ResourcePointer();
+		res = ResourcePointer();
+		scriptData = ResourcePointer();
 		spriteData = nullptr;
 		absSpeedX = absSpeedY = 0;
 		parent = children = next = 0;
@@ -118,6 +119,9 @@ public:
 	void clearAnimations(int mode = 0) override;
 	void setPlaneMode(uint16 mode) override;
 
+	void resetTextFields() override;
+	void renderTextBuffer(const uint8 *textBuffer, uint16 firstLine, uint8 numLines) override;
+
 	void updateScreen(uint8 *screen) override;
 	void updateAnimations() override;
 
@@ -359,7 +363,7 @@ void Animator_SCD::initAnimations(ResourcePointer &res, uint16 len) {
 				assert(cmd != 0xA1 && cmd != 0xA7); // The original code would theoretically allow a deadlock here.
 			} else {
 				if (!(cmd & 0x80))
-					a->spriteData = reinterpret_cast<const uint16*>(res.makeAbsPtr(a->spriteTableLocation).getDataFromTable(cmd)());
+					a->spriteData = reinterpret_cast<const uint16*>(res.makePtr(a->spriteTableLocation).getDataFromTable(cmd)());
 				l = false;
 			}
 		}
@@ -398,6 +402,45 @@ void Animator_SCD::setPlaneMode(uint16 mode) {
 	_modeChange = mode & 0xFF;;
 }
 
+void Animator_SCD::resetTextFields() {
+	uint8 *s = _tempBuffer + 0x5000;
+	uint16 *d = reinterpret_cast<uint16*>(s);
+	for (int i = 0; i < 255; ++i)
+		*d++ = TO_BE_16(0x8000 + i);
+	*d = TO_BE_16(0x8000);
+	_sr->loadToVRAM(s, 512, 0xEC80);
+	_clearFlags |= 4;
+	memset(_tempBuffer + 0x6000, 0, 0x1FE0);
+	s = _tempBuffer + 0x7FE0;
+	d = reinterpret_cast<uint16*>(s);
+	for (int i = 0; i < 16; ++i)
+		*d++ = 0x7777;
+	_sr->loadToVRAM(s, 32, 0x1FE0);
+}
+
+void Animator_SCD::renderTextBuffer(const uint8 *textBuffer, uint16 firstLine, uint8 numLines) {
+	uint16 start = firstLine << 10;
+	uint16 len = numLines << 10;
+	textBuffer += start;
+	uint8 *s = _tempBuffer + 0x6000 + start;
+	uint8 *d = s;
+	for (int i = 0; i < len; ++i) {
+		uint8 in = *textBuffer++;
+		uint8 h = in & 0xF0;
+		uint8 l = in & 0x0F;
+		if (h) {
+			if (l)
+				*d = in;
+			else
+				*d = (*d & 0x0F) | h;
+		} else if (l) {
+			*d = (*d & 0xF0) | l;
+		}
+		++d;
+	}	
+	_sr->loadToVRAM(s, len, start);
+}
+
 void Animator_SCD::updateScreen(uint8 *screen) {
 	if (_gfxState.getVar(9)) {
 		_sr->setPlaneTableLocation(Graphics::SegaRenderer::kPlaneB, _gfxState.getVar(9) == 0xFF ? 0xE000 : 0xC000);
@@ -408,6 +451,8 @@ void Animator_SCD::updateScreen(uint8 *screen) {
 		_sr->memsetVRAM(0xE000, 0, 0x2000);
 	if (_clearFlags & 2)
 		_sr->memsetVRAM(0xC000, 0, 0x2000);
+	if (_clearFlags & 4)
+		_sr->memsetVRAM(0, 0, 0x1FE0);
 	_clearFlags = 0;
 
 	if (_modeChange)
@@ -453,7 +498,7 @@ void Animator_SCD::updateAnimations() {
 
 		uint8 cmd = s->scriptData[(s->frame == 0xFFFF ? 0 : s->frame) << 2];
 		if (!(cmd & 0x80))
-			s->spriteData = reinterpret_cast<const uint16*>(s->res.makeAbsPtr(s->spriteTableLocation).getDataFromTable(cmd)());
+			s->spriteData = reinterpret_cast<const uint16*>(s->res.makePtr(s->spriteTableLocation).getDataFromTable(cmd)());
 
 		if (!(s->controlFlags & GraphicsEngine::kAnimPause)) {
 			s->posX += s->absSpeedX;
@@ -632,7 +677,7 @@ void Animator_SCD::loadDataFromGfxScript() {
 	if (_gfxState.getVar(0)) {
 		if (_gfxState.getVar(0) == 1) {
 			_gfxState.setVar(0, 2);
-			_clearFlags = 3;
+			_clearFlags |= 3;
 		} else {
 			_gfxState.setVar(0, 0);
 		}
@@ -652,7 +697,7 @@ void Animator_SCD::loadDataFromGfxScript() {
 		return;
 	}
 
-	const uint8 *src = _transferData.makeAbsPtr(_transferData.readIncrUINT32() & 0xFFFFFF)();
+	const uint8 *src = _transferData.makePtr(_transferData.readIncrUINT32() & 0xFFFFFF)();
 	_transferDelay = _transferData.readIncrUINT16();
 	uint16 addr = _transferData.readIncrUINT16();
 
@@ -709,7 +754,7 @@ void Animator_SCD::executeDrawCommands() {
 		uint8 b = 0;
 
 		if ((it->cmd & 0x0F) < 5 && (it->cmd & 0x0F) != 2 && !(it->cmd & 0x80)) {
-			const uint8 *cmp = it->res.makeAbsPtr(READ_BE_UINT32(it->ptr))();
+			const uint8 *cmp = it->res.makePtr(READ_BE_UINT32(it->ptr))();
 			uint32 len = READ_BE_UINT16(cmp);
 			if (len != 0) {
 				if (len != Util::decodeSCDData(cmp + 2, s))
@@ -737,7 +782,7 @@ void Animator_SCD::executeDrawCommands() {
 			break;
 		case 2:
 			for (bool rept = true; rept; ) {
-				memcpy(s + READ_BE_INT16(it->ptr + 6), it->res.makeAbsPtr(READ_BE_UINT32(it->ptr))(), READ_BE_UINT16(it->ptr + 8));
+				memcpy(s + READ_BE_INT16(it->ptr + 6), it->res.makePtr(READ_BE_UINT32(it->ptr))(), READ_BE_UINT16(it->ptr + 8));
 				_sr->loadToVRAM(s + READ_BE_INT16(it->ptr + 6), READ_BE_UINT16(it->ptr + 8), READ_BE_UINT16(it->ptr + 4));
 				it->ptr += 10;
 				if (READ_BE_UINT16(it->ptr) == 0xFFFF) {
@@ -981,7 +1026,7 @@ void Animator_SCD::makeAnimFunctions() {
 	typedef int (Animator_SCD::*AnimFunc)(AnimObject&, const uint8*);
 	static const AnimFunc funcTbl[] = {
 #else
-	#define ANM(x) {&Renderer_SCD::anim_##x, #x}
+	#define ANM(x) {&Animator_SCD::anim_##x, #x}
 	struct FuncTblEntry {
 		GfxAnimFunc::AnimFunc func;
 		const char *desc;
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 5ddc75a121b..7e0826be1b8 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -24,6 +24,7 @@
 #include "snatcher/palette.h"
 #include "snatcher/animator.h"
 #include "snatcher/resource.h"
+#include "snatcher/text.h"
 #include "snatcher/transition.h"
 #include "common/endian.h"
 #include "common/system.h"
@@ -32,12 +33,13 @@
 namespace Snatcher {
 
 GraphicsEngine::GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate, SoundEngine *snd) : _system(system), _state(vmstate),
-	_animator(nullptr), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _flags(0) {
+	_animator(nullptr), _text(nullptr), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _flags(0), _verbAreaType(0) {
 	assert(system);
 	_palette = Palette::create(pxf, _system->getPaletteManager(), platform, _state);
 	assert(_palette);
 	_trs = TransitionManager::create(platform, _state);
 	_animator = Animator::create(pxf, platform, _state, _palette, _trs, snd);
+	_text = TextRenderer::create(platform, _animator);
 	assert(_animator);
 	_screen = new uint8[_animator->screenWidth() * _animator->screenHeight() * (pxf ? pxf->bytesPerPixel : 1)]();
 	assert(_screen);
@@ -48,12 +50,11 @@ GraphicsEngine::~GraphicsEngine() {
 	delete _palette;
 	delete _trs;
 	delete[] _screen;
+	delete _text;
 }
 
-uint8 _transitionType;
-
 void GraphicsEngine::runScript(ResourcePointer res, int func) {
-	ResourcePointer sc = ResourcePointer(res.dataStart, READ_BE_UINT32(res.dataStart + 4)).getDataFromTable(func);
+	ResourcePointer sc = res.makePtr(READ_BE_INT32(res() + 4)).getDataFromTable(func);
 
 	for (uint8 cmd = *sc++; cmd != 0xFF; cmd = *sc++) {
 		uint8 len = *sc++;
@@ -80,7 +81,7 @@ void GraphicsEngine::runScript(ResourcePointer res, int func) {
 		case 5:
 		case 6:
 		case 7:
-			_transitionType = sc[1];
+			_verbAreaType = sc[1];
 			break;
 		case 8:
 			_animator->setPlaneMode(sc.readUINT16());
@@ -106,6 +107,10 @@ bool GraphicsEngine::enqueueDrawCommands(ResourcePointer res) {
 	return _animator->enqueueDrawCommands(res);
 }
 
+void GraphicsEngine::initAnimations(ResourcePointer res, uint16 len) {
+	_animator->initAnimations(res, len);
+}
+
 void GraphicsEngine::setScrollStep(uint8 mode, int16 step) {
 	if (mode < 4)
 		_trs->scroll_setDirectionAndSpeed(mode, step);
@@ -117,10 +122,41 @@ void GraphicsEngine::transitionCommand(uint8 cmd) {
 	_trs->doCommand(cmd);
 }
 
+void GraphicsEngine::setTextFont(const uint8 *font, uint32 fontSize, const uint8 *charWidthTable, uint32 charWidthTableSize) {
+	_text->setFont(font, fontSize);
+	_text->setCharWidthTable(charWidthTable, charWidthTableSize);
+}
+
+void GraphicsEngine::printText(const uint8 *text) {
+	_text->enqueuePrintJob(text);
+}
+
+void GraphicsEngine::setTextPrintDelay(uint16 delay) {
+	_text->setPrintDelay(delay);
+}
+/*
+void GraphicsEngine::setTextColor(uint8 color) {
+	_text->setColor(color);
+}*/
+
+bool GraphicsEngine::isTextInQueue() const {
+	return _text->needsPrint();
+}
+
+void GraphicsEngine::resetTextFields() {
+	_animator->resetTextFields();
+	_text->reset();
+}
+
 void GraphicsEngine::updateAnimations() {
 	_animator->updateAnimations();
 }
 
+void GraphicsEngine::updateText() {
+	if (_text->needsPrint())
+		_text->draw();
+}
+
 void GraphicsEngine::nextFrame() {
 	_palette->processEventQueue();
 	_palette->updateSystemPalette();
@@ -201,6 +237,10 @@ uint16 GraphicsEngine::frameCount() const {
 	return _state.frameCount();
 }
 
+uint8 GraphicsEngine::getVerbAreaType() const {
+	return _verbAreaType;
+}
+
 void GraphicsEngine::createMouseCursor(bool show) {
 	_animator->createMouseCursor();
 }
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index bdabdcbdbc8..03bb90ecf6f 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -40,6 +40,7 @@ class TransitionManager;
 class Animator;
 class SceneModule;
 class SoundEngine;
+class TextRenderer;
 
 class GraphicsEngine {
 public:
@@ -49,6 +50,7 @@ public:
 	void runScript(ResourcePointer res, int func);
 	void enqueuePaletteEvent(ResourcePointer res);
 	bool enqueueDrawCommands(ResourcePointer res);
+	void initAnimations(ResourcePointer res, uint16 len);
 
 	enum ScrollMode : uint8 {
 		kHorzA		= 0,
@@ -61,7 +63,16 @@ public:
 	void setScrollStep(uint8 mode, int16 step);
 	void transitionCommand(uint8 cmd);
 
+	void setTextFont(const uint8 *font, uint32 fontSize, const uint8 *charWidthTable, uint32 charWidthTableSize);
+	void printText(const uint8 *text);
+	void setTextPrintDelay(uint16 delay);
+	//void setTextColor(uint8 color);
+	bool isTextInQueue() const;
+
+	void resetTextFields();
+
 	void updateAnimations();
+	void updateText();
 	void nextFrame();
 
 	enum ResetType : uint16 {
@@ -127,6 +138,8 @@ public:
 	bool busy(int type) const;
 	uint16 frameCount() const;
 
+	uint8 getVerbAreaType() const;
+
 	void createMouseCursor(bool show);
 
 	int displayBootLogoFrame(int frameNo);
@@ -196,11 +209,13 @@ private:
 	GfxState _state;
 	const uint8 _bpp;
 	uint8 _dataMode;
+	uint8 _verbAreaType;
 	uint8 _flags;
 
 	uint8 *_screen;
 	Animator *_animator;
 	Palette *_palette;
+	TextRenderer *_text;
 	TransitionManager *_trs;
 	OSystem *_system;
 };
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index d6d3537c81e..cd6e5e10205 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -14,6 +14,7 @@ MODULE_OBJS := \
 	sound.o \
 	sound_device_scd.o \
 	staticres.o \
+	text_scd.o \
 	transition_scd.o \
 	util.o
 
diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index 70e2959ca8c..959e1352474 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -180,8 +180,6 @@ void SCDPalette::processEventQueue() {
 		if (_eventProcs[p->cmd]->isValid())
 			(*_eventProcs[p->cmd])(p);
 	}
-
-	updateSystemPalette();
 }
 
 void SCDPalette::clearEvents() {
@@ -254,9 +252,15 @@ void SCDPalette::adjustColor(int index, int8 r, int8 g, int8 b) {
 }
 
 void SCDPalette::updateSystemPalette() {
-	if (!_gfxState.testFlag(7, 0) && !_gfxState.testFlag(7, 1))
+	if (!_gfxState.getVar(7) && !_gfxState.getVar(11))
 		return;
 
+	if (_gfxState.getVar(11) == 0xFF) {
+		_gfxState.setFlag(7, 0);
+		_gfxState.setVar(11, 0);
+		// hint set
+	}
+
 	if (_gfxState.testFlag(7, 0))
 		Common::copy<const uint16*, uint16*>(_colors, &_colors[64], _colors2);
 
@@ -266,6 +270,12 @@ void SCDPalette::updateSystemPalette() {
 	_gfxState.clearFlag(7, 0);
 	_gfxState.clearFlag(7, 1);
 
+	if (_gfxState.testFlag(7, 2)) {
+		Common::fill<uint16*, uint16>(_colors2, &_colors2[64], 0xEEE);
+		_gfxState.setFlag(7, 0);
+		_gfxState.clearFlag(7, 2);
+	}
+
 	const uint16 *src = &_colors2[0 << 6];
 	uint8 *dst = _sysPalette;
 
@@ -302,8 +312,7 @@ void SCDPalette::event_palSet(PalEventSCD *evt) {
 
 	uint16 *dst = &_colors[evt->destOffset];
 	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
-	assert(srcOffs >= 0x28000);
-	const uint16 *src = reinterpret_cast<const uint16*>(ResourcePointer(evt->res.dataStart, srcOffs)());
+	const uint16 *src = reinterpret_cast<const uint16*>(evt->res.makePtr(srcOffs)());
 	for (int i = 0; i < evt->len; ++i)
 		*dst++ = READ_BE_UINT16(src++);
 
@@ -367,8 +376,7 @@ void SCDPalette::event_palCycle(PalEventSCD *evt) {
 
 	uint16 *dst = &_colors[evt->destOffset];
 	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
-	assert(srcOffs >= 0x28000);
-	const uint16 *src = reinterpret_cast<const uint16*>(ResourcePointer(evt->res.dataStart, srcOffs)());
+	const uint16 *src = reinterpret_cast<const uint16*>(evt->res.makePtr(srcOffs)());
 	for (int i = 0; i < evt->len; ++i)
 		*dst++ = READ_BE_UINT16(src++);
 
@@ -382,8 +390,7 @@ void SCDPalette::event_palFadeToColor(PalEventSCD *evt) {
 
 	uint16 *dst = &_colors[evt->destOffset];
 	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
-	assert(srcOffs >= 0x28000);
-	uint16 col = READ_BE_UINT16(ResourcePointer(evt->res.dataStart, srcOffs)());
+	uint16 col = READ_BE_UINT16(evt->res.makePtr(srcOffs)());
 
 	for (int i = 0; i < evt->len; ++i)
 		fadeStep(dst++, col & 0xF, col & 0xF0, col & 0xF00);
@@ -398,8 +405,7 @@ void SCDPalette::event_palFadeToGrey(PalEventSCD *evt) {
 
 	uint16 *dst = &_colors[evt->destOffset];
 	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
-	assert(srcOffs >= 0x28000);
-	const uint16 *src = reinterpret_cast<const uint16*>(ResourcePointer(evt->res.dataStart, srcOffs)());
+	const uint16 *src = reinterpret_cast<const uint16*>(evt->res.makePtr(srcOffs)());
 
 	for (int i = 0; i < evt->len; ++i) {
 		uint16 col = READ_BE_UINT16(src++);
@@ -420,8 +426,7 @@ void SCDPalette::event_palFadeToPal(PalEventSCD *evt) {
 
 	uint16 *dst = &_colors[evt->destOffset];
 	uint32 srcOffs = READ_BE_UINT32(evt->srcOffsetCur);
-	assert(srcOffs >= 0x28000);
-	const uint16 *src = reinterpret_cast<const uint16*>(ResourcePointer(evt->res.dataStart, srcOffs)());
+	const uint16 *src = reinterpret_cast<const uint16*>(evt->res.makePtr(srcOffs)());
 
 	for (int i = 0; i < evt->len; ++i) {
 		uint16 col = READ_BE_UINT16(src++);
diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index b443dc16bde..192070b1562 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -60,7 +60,7 @@ SceneModule *FIO::loadModule(int index) {
 	return (index >= 0 && index < _resFileListSize) ? new SceneModule(_vm, this, _resFileList[index], index) : 0;
 }
 
-const uint8 *FIO::fileData(int index, uint32 *fileSize) {
+uint8 *FIO::fileData(int index, uint32 *fileSize) {
 	return (index >= 0 && index < _resFileListSize) ? fileData(_resFileList[index], fileSize) : nullptr;
 }
 
@@ -72,7 +72,7 @@ uint8 *FIO::fileData(const Common::Path &file, uint32 *fileSize) {
 		*fileSize = size;
 
 	if (!s) {
-		warning("%s(): Unable to open file %s", file.baseName().c_str());
+		warning("%s(): Unable to open file %s", __FUNCTION__, file.baseName().c_str());
 		return nullptr;
 	}
 
@@ -118,6 +118,149 @@ const char *FIO::_resFileList[97] = {
 
 const int FIO::_resFileListSize = ARRAYSIZE(_resFileList);
 
+ResourcePointer::ResourcePointer() : _dataStart(nullptr), _writeableDataStart(nullptr), _offset(0), _moduleLocation(0x28000), _ownBuffer(false) {}
+
+ResourcePointer::ResourcePointer(const uint8 *data, uint32 offs, uint32 loc, bool assignBufferOwnership) : _dataStart(data), _writeableDataStart(nullptr), _offset(offs), _moduleLocation(loc), _ownBuffer(assignBufferOwnership) {
+	if (_offset >= _moduleLocation)
+		_offset -= _moduleLocation;
+}
+
+ResourcePointer::ResourcePointer(uint8 *data, uint32 offs, uint32 loc, bool assignBufferOwnership) : _dataStart(data), _writeableDataStart(data), _offset(offs), _moduleLocation(loc), _ownBuffer(assignBufferOwnership) {
+	if (_offset >= _moduleLocation)
+		_offset -= _moduleLocation;
+}
+
+ResourcePointer::ResourcePointer(const ResourcePointer &ptr) : _dataStart(ptr._dataStart), _offset(ptr._offset), _moduleLocation(ptr._moduleLocation), _writeableDataStart(ptr._writeableDataStart), _ownBuffer(false) {
+	assert(ptr._ownBuffer == false);
+}
+
+ResourcePointer::ResourcePointer(ResourcePointer &&ptr) noexcept : _dataStart(ptr._dataStart), _offset(ptr._offset), _moduleLocation(ptr._moduleLocation), _writeableDataStart(ptr._writeableDataStart), _ownBuffer(ptr._ownBuffer) {
+	ptr._ownBuffer = false;
+}
+
+ResourcePointer::~ResourcePointer() {
+	if (_ownBuffer && _dataStart)
+		delete[] _dataStart;
+}
+
+const uint8 *ResourcePointer::operator()() const {
+	return _dataStart + _offset;
+}
+
+const uint8 *ResourcePointer::operator++(int) {
+	return _dataStart + (_offset++);
+}
+
+const uint8 *ResourcePointer::ResourcePointer::operator++() {
+	return _dataStart + (++_offset);
+}
+
+uint16 ResourcePointer::readUINT16() const {
+	return READ_BE_UINT16(_dataStart + _offset);
+}
+
+uint16 ResourcePointer::readSINT16() const {
+	return READ_BE_INT16(_dataStart + _offset);
+}
+
+uint32 ResourcePointer::readUINT32() const {
+	return READ_BE_UINT32(_dataStart + _offset);
+}
+
+uint32 ResourcePointer::readSINT32() const {
+	return READ_BE_INT32(_dataStart + _offset);
+}
+
+uint16 ResourcePointer::readIncrUINT16() {
+	uint16 r = READ_BE_UINT16(_dataStart + _offset);
+	_offset += 2;
+	return r;
+}
+
+uint16 ResourcePointer::readIncrSINT16() {
+	int16 r = READ_BE_INT16(_dataStart + _offset);
+	_offset += 2;
+	return r;
+}
+
+uint32 ResourcePointer::readIncrUINT32() {
+	uint32 r = READ_BE_UINT32(_dataStart + _offset);
+	_offset += 4;
+	return r;
+}
+
+uint32 ResourcePointer::readIncrSINT32() {
+	int32 r = READ_BE_INT32(_dataStart + _offset);
+	_offset += 4;
+	return r;
+}
+
+void ResourcePointer::writeUINT32(uint32 value) {
+	assert(_writeableDataStart);
+	WRITE_BE_UINT32(_writeableDataStart + _offset, value);
+}
+
+ResourcePointer ResourcePointer::operator+(int inc) const {
+	return _writeableDataStart ?
+		ResourcePointer(_writeableDataStart, _offset + _moduleLocation + inc, _moduleLocation) :
+			ResourcePointer(_dataStart, _offset + _moduleLocation + inc, _moduleLocation);
+}
+
+bool ResourcePointer::operator<(const ResourcePointer &ptr) const {
+	assert(_dataStart == ptr._dataStart && _moduleLocation == ptr._moduleLocation);
+	return _offset < ptr._offset;
+}
+
+bool ResourcePointer::operator>(const ResourcePointer &ptr) const {
+	assert(_dataStart == ptr._dataStart && _moduleLocation == ptr._moduleLocation);
+	return _offset > ptr._offset;
+}
+
+bool ResourcePointer::operator==(const ResourcePointer &ptr) const {
+	return _dataStart == ptr._dataStart && _offset == ptr._offset && _moduleLocation == ptr._moduleLocation;
+}
+
+void ResourcePointer::operator+=(int inc) {
+	_offset += inc;
+}
+
+void ResourcePointer::operator=(const uint8 *ptr) {
+	_offset = ptr - _dataStart;
+}
+
+void ResourcePointer::operator=(const ResourcePointer &ptr) {
+	assert(ptr._ownBuffer == false);
+	_dataStart = ptr._dataStart;
+	_writeableDataStart = ptr._writeableDataStart;
+	_offset = ptr._offset;
+	_moduleLocation = ptr._moduleLocation;
+}
+
+void ResourcePointer::operator=(ResourcePointer &&ptr) noexcept {
+	_dataStart = ptr._dataStart;
+	_writeableDataStart = ptr._writeableDataStart;
+	_offset = ptr._offset;
+	_moduleLocation = ptr._moduleLocation;
+	_ownBuffer = ptr._ownBuffer;
+	ptr._ownBuffer = false;
+}
+
+uint8 ResourcePointer::operator[](int index) const {
+	return _dataStart[_offset + index];
+}
+
+ResourcePointer ResourcePointer::getDataFromTable(int tableEntry) const {
+	return _writeableDataStart ?
+		ResourcePointer(_writeableDataStart, _offset + _moduleLocation + READ_BE_INT16(_dataStart + _offset + tableEntry * 2), _moduleLocation) :
+			ResourcePointer(_dataStart, _offset + _moduleLocation + READ_BE_INT16(_dataStart + _offset + tableEntry * 2), _moduleLocation);
+}
+
+ResourcePointer ResourcePointer::makePtr(uint32 offs) const {
+	return _writeableDataStart ?
+		ResourcePointer(_writeableDataStart, offs, _moduleLocation) :
+			ResourcePointer(_dataStart, offs, _moduleLocation);
+}
+
 SceneModule::SceneModule(SnatcherEngine *vm, FIO *fio, const char *resFile, int index) : _vm(vm), _fio(fio), _resFile(resFile), _resIndex(index), _data(0), _dataSize(0), _updateHandler(0) {
 	assert(!_resFile.empty());
 	_data = _fio->fileData(_resFile, &_dataSize);
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index 0729d4722c7..b69408c0d60 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -55,7 +55,7 @@ struct Config {
 };
 
 struct GameState {
-	GameState() : frameNo(0), frameState(0), finish(0), modProcessTop(0), modProcessSub(0), counter(0), modIndex(0), menuSelect(0), introState(0), chapter(0), conf(Config()) {}
+	GameState() : frameNo(0), frameState(0), finish(0), modProcessTop(0), modProcessSub(0), counter(0), modIndex(0), menuSelect(0), prologue(0), chapter(0), conf(Config()) {}
 	int16 frameNo;
 	int16 frameState;
 	int16 finish;
@@ -64,7 +64,7 @@ struct GameState {
 	int16 counter;
 	int16 modIndex;
 	int16 menuSelect;
-	int16 introState;
+	int16 prologue;
 	int16 chapter;
 	Config conf;
 };
@@ -80,40 +80,44 @@ protected:
 	FIO *_fio;
 };
 
-struct ResourcePointer {
-	ResourcePointer() : dataStart(0), offset(0), moduleLocation(0x28000), ownBuffer(false) {}
-	ResourcePointer(const uint8 *data, uint32 offs, uint32 loc = 0x28000, bool assignBufferOwnership = false) : dataStart(data), offset(offs), moduleLocation(loc), ownBuffer(assignBufferOwnership) {
-		if (offset >= moduleLocation)
-			offset -= moduleLocation;
-	}
-	~ResourcePointer() {
-		if (ownBuffer && dataStart)
-			delete[] dataStart;
-	}
-	const uint8 *dataStart;
-	uint32 offset;
-	uint32 moduleLocation;
-	bool ownBuffer;
-	const uint8 *operator()() const { return dataStart + offset; }
-	const uint8 *operator++(int) { return dataStart + (offset++); }
-	const uint8 *operator++() { return dataStart + (++offset); }
-	uint16 readUINT16() { return READ_BE_UINT16(dataStart + offset); }
-	uint16 readSINT16() { return READ_BE_INT16(dataStart + offset); }
-	uint32 readUINT32() { return READ_BE_UINT32(dataStart + offset); }
-	uint32 readSINT32() { return READ_BE_INT32(dataStart + offset); }
-	uint16 readIncrUINT16() { uint16 r = READ_BE_UINT16(dataStart + offset); offset += 2; return r; }
-	uint16 readIncrSINT16() { int16 r = READ_BE_INT16(dataStart + offset); offset += 2; return r; }
-	uint32 readIncrUINT32() { uint32 r = READ_BE_UINT32(dataStart + offset); offset += 4; return r; }
-	uint32 readIncrSINT32() { int32 r = READ_BE_INT32(dataStart + offset); offset += 4; return r; }
-	ResourcePointer operator+(int inc) const { return ResourcePointer(dataStart, offset + moduleLocation + inc, moduleLocation); }
-	bool operator<(const ResourcePointer &ptr) const { assert(dataStart == ptr.dataStart && moduleLocation == ptr.moduleLocation); return offset < ptr.offset; }
-	bool operator>(const ResourcePointer &ptr) const { assert(dataStart == ptr.dataStart && moduleLocation == ptr.moduleLocation); return offset > ptr.offset; }
-	bool operator==(const ResourcePointer &ptr) const { return dataStart == ptr.dataStart && offset == ptr.offset && moduleLocation == ptr.moduleLocation; }
-	void operator+=(int inc) { offset += inc; }
-	void operator=(const uint8 *ptr) { offset = ptr - dataStart; }
-	uint8 operator[](int index) const { return dataStart[offset + index]; }
-	ResourcePointer getDataFromTable(int tableEntry) const { return ResourcePointer(dataStart, offset + moduleLocation + READ_BE_UINT16(dataStart + offset + tableEntry * 2), moduleLocation); }
-	ResourcePointer makeAbsPtr(uint32 offs) const { return ResourcePointer(dataStart, offs, moduleLocation); }
+class ResourcePointer {
+public:
+	ResourcePointer();
+	explicit ResourcePointer(const uint8 *data, uint32 offs, uint32 loc = 0x28000, bool assignBufferOwnership = false);
+	explicit ResourcePointer(uint8 *data, uint32 offs, uint32 loc = 0x28000, bool assignBufferOwnership = false);
+	ResourcePointer(const ResourcePointer &ptr);
+	ResourcePointer(ResourcePointer &&ptr) noexcept;
+	~ResourcePointer();
+
+	const uint8 *operator()() const;
+	const uint8 *operator++(int);
+	const uint8 *operator++();
+	uint16 readUINT16() const;
+	uint16 readSINT16() const;
+	uint32 readUINT32() const;
+	uint32 readSINT32() const;
+	uint16 readIncrUINT16();
+	uint16 readIncrSINT16();
+	uint32 readIncrUINT32();
+	uint32 readIncrSINT32();
+	void writeUINT32(uint32 value);
+	ResourcePointer operator+(int inc) const;
+	bool operator<(const ResourcePointer &ptr) const;
+	bool operator>(const ResourcePointer &ptr) const;
+	bool operator==(const ResourcePointer &ptr) const;
+	void operator+=(int inc);
+	void operator=(const uint8 *ptr);
+	void operator=(const ResourcePointer &ptr);
+	void operator=(ResourcePointer &&ptr) noexcept;
+	uint8 operator[](int index) const;
+	ResourcePointer getDataFromTable(int tableEntry) const;
+	ResourcePointer makePtr(uint32 offs) const;
+private:
+	const uint8 *_dataStart;
+	uint8 *_writeableDataStart;
+	uint32 _offset;
+	uint32 _moduleLocation;
+	bool _ownBuffer;
 };
 
 class SceneModule {
@@ -152,7 +156,7 @@ public:
 	};
 
 	SceneModule *loadModule(int index);
-	const uint8 *fileData(int index, uint32 *fileSize);
+	uint8 *fileData(int index, uint32 *fileSize);
 	uint8 *fileData(const Common::Path &file, uint32 *fileSize);
 	Common::SeekableReadStream *readStream(int index);
 	Common::SeekableReadStream *readStream(const Common::Path &file);
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene/scene_d2.cpp
index 82e849cf293..cca82d3e69a 100644
--- a/engines/snatcher/scene/scene_d2.cpp
+++ b/engines/snatcher/scene/scene_d2.cpp
@@ -441,6 +441,7 @@ SH_IMPL_FRM(D2, 11) {
 	case 2:
 		state.counter  = 0;
 		_counter2 = 0;
+		_vm->allowLightGunInput(true);
 		_vm->gfx()->setAnimParameter(16, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 		for (int i = 0; i < 4; ++i)
 			_vm->gfx()->setAnimParameter(16 + i, GraphicsEngine::kAnimParaFrame, 0);
@@ -456,6 +457,7 @@ SH_IMPL_FRM(D2, 11) {
 			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
 			state.counter = 10;
 			++state.frameState;
+			_vm->allowLightGunInput(false);
 			return;
 		}
 
@@ -490,6 +492,7 @@ SH_IMPL_FRM(D2, 11) {
 				_vm->gfx()->setAnimParameter(17, GraphicsEngine::kAnimParaAbsSpeedX, 1);
 				_vm->gfx()->setAnimParameter(19, GraphicsEngine::kAnimParaBlink, 0);
 				_vm->gfx()->setAnimParameter(19, GraphicsEngine::kAnimParaAbsSpeedX, 0);
+				_vm->allowLightGunInput(false);
 				state.counter += 2;
 				_vm->sound()->fmSendCommand(29, 0);
 			} else if (_vm->input().controllerFlags & 0x100) {
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index fea48c504c1..fae4818e477 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -30,14 +30,18 @@
 
 namespace Snatcher {
 
-CmdQueue::CmdQueue(SnatcherEngine *vm) : _vm(vm), _data(nullptr), _readPos(0), _writePos(nullptr), _enable(false), _progress(-1), _currentOpcode(0) {
+CmdQueue::CmdQueue(SnatcherEngine *vm) : _vm(vm), _data(nullptr), _readPos(0), _writePos(nullptr), _enable(false), _progress(-1), _currentOpcode(0), _sceneId(0),
+	_textLineBreak(0), _counter(0), _opcodes(), _textBuffer(nullptr), _textColor(0), /*_makestrbt1(0),*/ _textY(0), _textY2(0), _sceneTextOffsCur(0), _textLineEnd(0),
+		_sceneInfo(0), _sceneTextOffset(0), _sceneTextOffsStart(0), _waitCursorFrame(0), _waitCursorAnimDelay(0) {
 	_data = new uint16[256]();
+	_textBuffer = new uint8[0x100]();
 	makeFunctions();
 	reset();
 }
 
 CmdQueue::~CmdQueue() {
 	delete[] _data;
+	delete[] _textBuffer;
 	for (Common::Array<CmdQueOpcode*>::iterator i = _opcodes.begin(); i != _opcodes.end(); ++ i)
 		delete *i;
 }
@@ -58,34 +62,36 @@ void CmdQueue::writeUInt32(uint32 val) {
 	_writePos += 2;
 }
 
-void CmdQueue::run() {
+void CmdQueue::run(GameState &state) {
 	if (!_enable)
 		return;
 
-	if (_progress == -1) {
-		_currentOpcode = *_readPos++;
-		_progress = 0;
-	}
+	do {
+		if (_progress == -1) {
+			_currentOpcode = *_readPos++;
+			_progress = 0;
+		}
 
-	if (_currentOpcode < _opcodes.size() && _opcodes[_currentOpcode]->isValid())
-		(*_opcodes[_currentOpcode])(_readPos);
-	else
-		error("%s(): Invalid opcode %d", __FUNCTION__, _currentOpcode);
+		if (_currentOpcode < _opcodes.size() && _opcodes[_currentOpcode]->isValid())
+			(*_opcodes[_currentOpcode])(state, _readPos);
+		else
+			error("%s(): Invalid opcode %d", __FUNCTION__, _currentOpcode);
+	} while (_currentOpcode != 0 && _progress == -1);
 }
 
 void CmdQueue::makeFunctions() {
 #define OP(x) &CmdQueue::m_##x
-	typedef void (CmdQueue::*SFunc)(const uint16*&);
+	typedef void (CmdQueue::*SFunc)(GameState &state, const uint16*&);
 	static const SFunc funcTbl[] = {
 		OP(end),
-		OP(01),
+		OP(initAnimations),
 		OP(02),
-		OP(03),
+		OP(drawCommands),
 		OP(04),
-		OP(05),
+		OP(printText),
 		OP(06),
 		OP(fmMusicStart),
-		OP(gfxOps),
+		OP(displayDialog),
 		OP(animOps),
 		OP(pcmWait),
 		OP(11),
@@ -99,7 +105,7 @@ void CmdQueue::makeFunctions() {
 		OP(fmMusicWait),
 		OP(20),
 		OP(21),
-		OP(22),
+		OP(resetTextFields),
 		OP(23),
 		OP(24),
 		OP(25),
@@ -111,7 +117,7 @@ void CmdQueue::makeFunctions() {
 		OP(31),
 		OP(32),
 		OP(33),
-		OP(34),
+		OP(palOps),
 		OP(35)
 	};
 #undef OP
@@ -120,39 +126,181 @@ void CmdQueue::makeFunctions() {
 		_opcodes.push_back(new CmdQueOpcode(this, funcTbl[i]));
 }
 
-void CmdQueue::m_end(const uint16 *&data) {
+void CmdQueue::m_end(GameState &state, const uint16 *&data) {
 	reset();
 }
 
-void CmdQueue::m_01(const uint16 *&data) {
+void CmdQueue::m_initAnimations(GameState &state, const uint16 *&data) {
+	uint32 addr = *reinterpret_cast<const uint32*>(data);
+	data += 2;
+	ResourcePointer in = (addr >= 0x28000 ? _vm->_module->getPtr(addr) : _vm->_scd->makePtr(addr));
+	uint16 len = 0;
+	const uint8 *s = in();
+	int dbgTimeout = 0;
+
+	while (*s != 0xFF && dbgTimeout < 100) {
+		s += 12;
+		len += 12;
+		++dbgTimeout;
+	}
+
+	if (dbgTimeout >= 100) {
+		error("%s(): Error reading animation data", __FUNCTION__);
+		return;
+	}
+
+	_vm->gfx()->initAnimations(in, len);
+	_progress = -1;
 }
 
-void CmdQueue::m_02(const uint16 *&data) {
+void CmdQueue::m_02(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_03(const uint16 *&data) {
+void CmdQueue::m_drawCommands(GameState &state, const uint16 *&data) {
+	uint32 addr = *reinterpret_cast<const uint32*>(data);
+	data += 2;
+	_vm->gfx()->enqueueDrawCommands(addr >= 0x28000 ? _vm->_module->getPtr(addr) : _vm->_scd->makePtr(addr));
+	_progress = -1;
 }
 
-void CmdQueue::m_04(const uint16 *&data) {
+void CmdQueue::m_04(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_05(const uint16 *&data) {
+void CmdQueue::m_printText(GameState &state, const uint16 *&data) {
+	if (_vm->gfx()->isTextInQueue())
+		return;
+	uint32 addr = *reinterpret_cast<const uint32*>(data);
+	data += 2;
+	_vm->gfx()->printText(addr >= 0x28000 ? _vm->_module->getPtr(addr)() : _vm->_scd->makePtr(addr)());
+	_progress = -1;
 }
 
-void CmdQueue::m_06(const uint16 *&data) {
+void CmdQueue::m_06(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_fmMusicStart(const uint16 *&data) {
+void CmdQueue::m_fmMusicStart(GameState &state, const uint16 *&data) {
 	uint8 cmd = *data++;
 	_vm->sound()->fmSendCommand(cmd, 1);
 	_vm->sound()->_fmPlayingTracks.music = (cmd == 0xFF) ? 0 : cmd;
 	_progress = -1;
 }
 
-void CmdQueue::m_gfxOps(const uint16 *&data) {
+int _gfxOps_var1 = 0;
+uint8  _gfxOps10_sub_974B = 0;
+uint8 _gfxOps10_sub_974E = 0;
+uint16 _gfxOps10_subword_974C = 0;
+
+//uint8 _c13Valu = 0;
+
+void CmdQueue::m_displayDialog(GameState &state, const uint16 *&data) {
+	if (_gfxOps_var1 || (_vm->input().controllerFlags & 0x100))
+		_vm->gfx()->setTextPrintDelay(0);
+
+	if (_vm->gfx()->isTextInQueue())
+		return;
+
+	switch (_progress) {
+	case 0:
+		for (int i = 5; i < 15; ++i)
+			_vm->gfx()->setAnimParameter(i, GraphicsEngine::kAnimParaEnable, 0);
+		_vm->gfx()->setAnimParameter(0, GraphicsEngine::kAnimParaEnable, 0);
+		_vm->gfx()->enqueuePaletteEvent(_vm->_scd->makePtr(0x13622));
+		++_progress;
+		break;
+
+	case 1:
+		_vm->gfx()->setVar(11, 0xFF);
+		_progress = 9;
+		break;
+
+	case 2:
+		if (_sceneId == 0) {
+			_vm->gfx()->transitionCommand(21);
+			//_c13Valu = 0xFF;
+			_textY = _textY2;
+		} else if (_sceneId == 0xFF) {
+			_textY = _textY2;
+		} else {
+			printSceneEntryStringHead();
+		}
+		++_progress;
+		break;
+
+	case 3:
+		printSceneEntryStringBody(state);
+		if (checkStringProgress())
+			++_progress;
+		break;
+
+	case 4:
+		_waitCursorFrame = 0;
+		_waitCursorAnimDelay = 1;
+		if (!_sceneId)
+			_vm->gfx()->setAnimParameter(31, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide);
+		++_progress;
+		break;
+
+	case 5:
+		if (!waitWithCursorAnim())
+			return;
+		_vm->gfx()->transitionCommand(0xFE);
+		if (_textLineEnd) {
+			_progress = 6;
+			if (!_sceneId)
+				_vm->gfx()->setAnimParameter(31, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+		} else {
+			_progress = 7;
+		}
+		break;
+
+	case 6:
+		_sceneTextOffset = _sceneInfo = 0;
+		//if (!_sceneId)
+		//	_c13Valu = 0xFF;
+		_progress = -1;
+		break;
+
+	case 7:
+		_vm->gfx()->resetTextFields();
+		++_progress;
+		break;
+
+	case 8:
+		_vm->gfx()->transitionCommand(_vm->gfx()->getVerbAreaType() == 0 ? 15 : (_vm->gfx()->getVerbAreaType() == 1 ? 20 : 22));
+		_progress = 2;
+		break;
+
+	case 9:
+		_sceneInfo = *data++;
+		_sceneTextOffset = *data++;
+		_vm->gfx()->enqueueDrawCommands(_vm->_scd->makePtr(0xECB6));
+		++_progress;
+		break;
+
+	case 10:
+		_sceneTextOffsStart = _sceneTextOffset;
+		_vm->gfx()->resetTextFields();
+		_sceneId = (_sceneInfo & 0xFF) - 1;
+
+		_sceneTextOffsCur = _sceneTextOffsStart;
+		_textLineEnd = 0;
+		_gfxOps10_sub_974B = _gfxOps10_sub_974E = 0;
+		_gfxOps10_subword_974C = 0;
+
+		_textColor = 1;
+
+		_vm->gfx()->transitionCommand(_vm->gfx()->getVerbAreaType() == 0 ? 15 : (_vm->gfx()->getVerbAreaType() == 1 ? 20 : 22));
+		//_c13Valu = 0;
+		_progress = 2;
+		break;
+
+	default:
+		error("%s(): Unknown state %d", __FUNCTION__, _progress);
+		break;
+	}
 }
 
-void CmdQueue::m_animOps(const uint16 *&data) {
+void CmdQueue::m_animOps(GameState &state, const uint16 *&data) {
 	switch (data[0]) {
 	case 0:
 	case 1:
@@ -179,7 +327,7 @@ void CmdQueue::m_animOps(const uint16 *&data) {
 	_progress = -1;
 }
 
-void CmdQueue::m_pcmWait(const uint16 *&data) {
+void CmdQueue::m_pcmWait(GameState &state, const uint16 *&data) {
 	if (_progress == 0) {
 		_counter = 3600;
 		++_progress;
@@ -188,13 +336,13 @@ void CmdQueue::m_pcmWait(const uint16 *&data) {
 		_progress = -1;
 }
 
-void CmdQueue::m_11(const uint16 *&data) {
+void CmdQueue::m_11(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_12(const uint16 *&data) {
+void CmdQueue::m_12(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_mmSeq(const uint16 *&data) {
+void CmdQueue::m_mmSeq(GameState &state, const uint16 *&data) {
 	if (_progress == 0) {
 		_vm->sound()->pcmInitSound(*data);
 		//_c13Valu = 0xFF;
@@ -202,7 +350,7 @@ void CmdQueue::m_mmSeq(const uint16 *&data) {
 	} else if (_progress == 1) {
 		++_progress;
 	} else if (_progress == 2) {
-		if (_vm->_scd->makeAbsPtr(0x13FEC)[*data] != 0xFF)
+		if (_vm->_scd->makePtr(0x13FEC)[*data] != 0xFF)
 			_vm->gfx()->setVar(11, 1);
 		if (!_vm->gfx()->getVar(11)) {
 			_progress = -1;
@@ -212,7 +360,7 @@ void CmdQueue::m_mmSeq(const uint16 *&data) {
 		}
 
 	} else {
-		uint8 f = _vm->_scd->makeAbsPtr(0x13FEC)[*data];
+		uint8 f = _vm->_scd->makePtr(0x13FEC)[*data];
 		if (f != 0xFF) {
 			//_vm->gfx()->dataMode = 1;
 			_vm->gfx()->runScript(_vm->_module->getPtr(0), f);
@@ -224,10 +372,10 @@ void CmdQueue::m_mmSeq(const uint16 *&data) {
 		++data;
 }
 
-void CmdQueue::m_14(const uint16 *&data) {
+void CmdQueue::m_14(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_gfxReset(const uint16 *&data) {
+void CmdQueue::m_gfxReset(GameState &state, const uint16 *&data) {
 	if (_progress == 0) {
 		if (!_vm->gfx()->busy(2)) {
 			_vm->gfx()->reset(GraphicsEngine::kResetSetDefaults);
@@ -236,12 +384,11 @@ void CmdQueue::m_gfxReset(const uint16 *&data) {
 			++_progress;
 		}
 	} else {
-		// original: is file done loading
 		_progress = -1;
 	}
 }
 
-void CmdQueue::m_waitFrames(const uint16 *&data) {
+void CmdQueue::m_waitFrames(GameState &state, const uint16 *&data) {
 	if (_progress == 0) {
 		_counter = 0;
 		++_progress;
@@ -253,7 +400,7 @@ void CmdQueue::m_waitFrames(const uint16 *&data) {
 	_progress = -1;
 	++data;
 }
-void CmdQueue::m_loadResource(const uint16 *&data) {
+void CmdQueue::m_loadResource(GameState &state, const uint16 *&data) {
 	if (_progress == 0) {
 		_vm->sound()->cdaStop();
 		++_progress;
@@ -264,10 +411,9 @@ void CmdQueue::m_loadResource(const uint16 *&data) {
 		++_progress;
 
 		if (dest == 0x1A800) {
-			assert(_vm->_script);
-			delete[] _vm->_script->data;
 			_vm->_script->data = _vm->_fio->fileData(index, &_vm->_script->dataSize);
 			assert(_vm->_script->data);
+			_vm->_script->res = ResourcePointer(_vm->_script->data, 0, 0x1A800, true);
 			_vm->_script->curFileNo = index;
 		} else if (dest == 0x28000) {
 			delete _vm->_module;
@@ -283,12 +429,12 @@ void CmdQueue::m_loadResource(const uint16 *&data) {
 	}
 }
 
-void CmdQueue::m_gfxStart(const uint16 *&data) {
+void CmdQueue::m_gfxStart(GameState &state, const uint16 *&data) {
 	_vm->gfx()->runScript(_vm->_module->getPtr(0), *data++);
 	_progress = -1;
 }
 
-void CmdQueue::m_fmMusicWait(const uint16 *&data) {
+void CmdQueue::m_fmMusicWait(GameState &state, const uint16 *&data) {
 	if (_progress == 0) {
 		_counter = 2700;
 		++_progress;
@@ -297,52 +443,166 @@ void CmdQueue::m_fmMusicWait(const uint16 *&data) {
 		_progress = -1;
 }
 
-void CmdQueue::m_20(const uint16 *&data) {
+void CmdQueue::m_20(GameState &state, const uint16 *&data) {
+}
+
+void CmdQueue::m_21(GameState &state, const uint16 *&data) {
+}
+
+void CmdQueue::m_resetTextFields(GameState &state, const uint16 *&data) {
+	_vm->gfx()->resetTextFields();
+	_progress = -1;
+}
+
+void CmdQueue::m_23(GameState &state, const uint16 *&data) {
+}
+
+void CmdQueue::m_24(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_21(const uint16 *&data) {
+void CmdQueue::m_25(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_22(const uint16 *&data) {
+void CmdQueue::m_26(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_23(const uint16 *&data) {
+void CmdQueue::m_27(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_24(const uint16 *&data) {
+void CmdQueue::m_28(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_25(const uint16 *&data) {
+void CmdQueue::m_29(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_26(const uint16 *&data) {
+void CmdQueue::m_30(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_27(const uint16 *&data) {
+void CmdQueue::m_31(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_28(const uint16 *&data) {
+void CmdQueue::m_32(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_29(const uint16 *&data) {
+void CmdQueue::m_33(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_30(const uint16 *&data) {
+void CmdQueue::m_palOps(GameState &state, const uint16 *&data) {
+	uint32 addr = *reinterpret_cast<const uint32*>(data);
+	_vm->gfx()->enqueuePaletteEvent(addr >= 0x28000 ? _vm->_module->getPtr(addr) : _vm->_scd->makePtr(addr));
+	data += 2;
+	_progress = -1;
 }
 
-void CmdQueue::m_31(const uint16 *&data) {
+void CmdQueue::m_35(GameState &state, const uint16 *&data) {
 }
 
-void CmdQueue::m_32(const uint16 *&data) {
+void CmdQueue::printSceneEntryStringHead() {
+	static const uint8 strHead[] = { 0xFC, 0x00, 0xF9, 0x01, 0xFB, 0x10, 0x00, 0xFE };
+	const uint8 *s = _vm->_scd->makePtr(0x13552).getDataFromTable(_sceneId)();
+	memcpy(_textBuffer, strHead, sizeof(strHead));
+	_textBuffer[6] = _textY2;
+	_textBuffer[8] = (*s & 0x80) ? 3 : (*s++ & 7);
+	uint8 *d = _textBuffer + 9;
+
+	for (int i = 0; i < 25; ++i) {
+		*d++ = *s;
+		if (*s++ == 0xFF)
+			break;
+	}
+
+	assert(*(d - 1) == 0xFF);
+
+	_vm->gfx()->printText(_textBuffer);
+	_textY = _textY2 + 9;
 }
 
-void CmdQueue::m_33(const uint16 *&data) {
+void CmdQueue::printSceneEntryStringBody(GameState &state) {
+	static const uint8 strHead[] = { 0xFC, 0x01, 0xF9, 0x01, 0xFE, 0x00, 0xFB };
+	static const uint8 buttonTable[3][6] = {
+		{ 'A', 'A', 'B', 'C', 'C', 'B' },
+		{ 'B', 'C', 'A', 'A', 'B', 'C' },
+		{ 'C', 'B', 'C', 'B', 'A', 'A' }
+	};
+
+	memcpy(_textBuffer, strHead, sizeof(strHead));
+	_textBuffer[5] = _textColor;
+	uint8 *d = _textBuffer + sizeof(strHead);
+	//_makestrbt1 = 0xFF;
+	*d++ = _sceneId ? 24 : 40;
+	*d++ = _textY;
+
+	_textLineBreak = 0;
+	const uint8 *s = _vm->_script->res.makePtr(0x1E000)() + _sceneTextOffsCur;
+	for (int i = 0; i < 50;++i) {
+		uint8 in = *s++;
+		++_sceneTextOffsCur;
+		switch (in) {
+		case 0xFF:
+			_textLineEnd = 1;
+			i = 49;
+			break;
+		case 0xF6:
+			_textLineBreak = 3;
+			i = 49;
+			break;;
+		case 0xF4:
+			_sceneInfo = 2;
+			break;
+		case 0xF2:
+			_textLineBreak = 1;
+			i = 49;
+			break;
+		case 0xF0:
+		case 0xEE:
+		case 0xEC:
+			*d++ = buttonTable[(in - 0xEC) >> 1][state.conf.controllerSetup];
+			break;
+		default:
+			if (in < 0xF8) {
+				*d++ = in;
+			} else {
+				*d++ = 0xFE;
+				*d++ = _textColor = in & 7;
+			}
+			break;
+		}
+	}
+
+	*d++ = 0xFF;
+	_vm->gfx()->printText(_textBuffer);
 }
 
-void CmdQueue::m_34(const uint16 *&data) {
+bool CmdQueue::checkStringProgress() {
+	if (_textLineEnd || _textLineBreak == 3)
+		return true;
+	_textY += 9;
+	return (_textY > 56);
 }
 
-void CmdQueue::m_35(const uint16 *&data) {
+bool CmdQueue::waitWithCursorAnim() {
+	if (_vm->input().controllerFlagsRemapped & 0x20)
+		return true;
+	if ((_waitCursorAnimDelay && --_waitCursorAnimDelay) || _sceneId == 0)
+		return false;
+	const uint8 *s = _vm->_scd->makePtr(0x1391C)() + _waitCursorFrame;
+
+	ResourcePointer drw = _vm->_scd->makePtr(_vm->gfx()->getVerbAreaType() == 0 ? 0x1387C : (_vm->gfx()->getVerbAreaType() == 1 ? 0x13894 : 0x138AC));
+
+	uint32 frm = 0x138C4 + _waitCursorFrame * 4;
+	(drw + 2).writeUINT32(frm);
+	(drw + 12).writeUINT32(frm + 4);
+
+	_vm->gfx()->enqueueDrawCommands(drw);
+
+	_waitCursorFrame += 2;
+	_waitCursorAnimDelay = s[1];
+	if (s[3])
+		return false;
+	if (_sceneInfo >> 8)
+		return true;
+	_waitCursorFrame = 0;
+	return false;
 }
 
 ScriptEngine::ScriptEngine(SnatcherEngine *vm, CmdQueue *que, ResourcePointer *scd) : _vm(vm), _que(que), _var(nullptr), _curPos(0), _op(0), /*_v1(0), _v2(0),*/ _v3(0), _v5(0), _buf352(nullptr) {
@@ -373,10 +633,6 @@ void ScriptEngine::resetArrays() {
 void ScriptEngine::run(Script *script) {
 	assert(script);
 
-	if (script->newPos != -1) {
-		script->curPos = script->newPos;
-		script->newPos = -1;
-	}
 	_curPos = script->curPos;
 	script->sp = script->bp;
 	_script = script;
@@ -384,18 +640,6 @@ void ScriptEngine::run(Script *script) {
 	runOpcode(_curPos);
 }
 
-void ScriptEngine::cleanupState() {
-
-}
-
-void ScriptEngine::runOpcode(int offset) {
-	uint8 op = getOpcode(offset);
-	if (_opcodes[op].proc->isValid())
-		(*_opcodes[op].proc)();
-	else
-		error("%s(): Invalid opcode %d", __FUNCTION__, op);
-}
-
 #define S_FRAME(x) _script->sp += (x)
 #define S_WRBYTE(x, y) _script->sp[x] = (uint8)(y)
 #define S_INCBYTE(x) _script->sp[x]++
@@ -409,8 +653,40 @@ void ScriptEngine::runOpcode(int offset) {
 #define S_POP() S_RDWORD(0); S_FRAME(2);
 #define ARR_SIZE(x)	_arrays[x][0]
 #define ARR_POS(x)	_arrays[x][1]
-#define ARR_WRITE(a, p, v) WRITE_BE_UINT16(_arrays[a] + 2 + 2 * p, v);
-#define ARR_READ(a, p) READ_BE_UINT16(_arrays[a] + 2 + 2 * p);
+#define ARR_READ(a, p) READ_BE_UINT16(_arrays[a] + 2 + 2 * (p))
+#define ARR_WRITE(a, p, v) WRITE_BE_UINT16(_arrays[a] + 2 + 2 * (p), v)
+
+bool ScriptEngine::postProcess(Script *script) {
+	if (script->newPos != -1) {
+		if (ARR_SIZE(4) <= ARR_POS(4)) {
+			for (int i = 0; i < ARR_POS(4) - 1; ++i)
+				ARR_WRITE(4, i, ARR_READ(4, i + 1));
+			--ARR_POS(4);
+		}
+		setArrayLastEntry(4, script->curPos);
+		script->curPos = script->newPos;
+		script->newPos = -1;
+	}
+
+	if (ARR_POS(1) != 0)
+		return true;
+
+	int r0 = 0;
+	getArrayLastEntry(0, r0);
+	if (r0 < ARR_POS(2))
+		ARR_POS(2) = r0;
+	ARR_POS(1) = 0;
+
+	return false;
+}
+
+void ScriptEngine::runOpcode(int offset) {
+	uint8 op = getOpcode(offset);
+	if (_opcodes[op].proc->isValid())
+		(*_opcodes[op].proc)();
+	else
+		error("%s(): Invalid opcode %d", __FUNCTION__, op);
+}
 
 void ScriptEngine::getOpcodeProps(int offset, int &len, int &f1, int &f2) {
 	uint8 op = getOpcode(offset);
@@ -739,8 +1015,8 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 		OP(64),
 		OP(subOps),
 		OP(subOps),
-		OP(gfxOps),
-		OP(gfxOps),
+		OP(displayDialog),
+		OP(displayDialog),
 		OP(animWait),
 		OP(pcmSoundWait),
 		OP(fmMusicWait),
@@ -750,7 +1026,7 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 	};
 #undef OP
 
-	const uint8 *in = scd->makeAbsPtr(0x16CDC)();
+	const uint8 *in = scd->makePtr(0x16CDC)();
 
 	for (uint i = 0; i < ARRAYSIZE(funcTbl); ++i) {
 #ifndef SNATCHER_SCRIPT_DEBUG
@@ -1145,7 +1421,7 @@ void ScriptEngine::o_subOps() {
 	}
 }
 
-void ScriptEngine::o_gfxOps() {
+void ScriptEngine::o_displayDialog() {
 	if (!OPC_4_ss())
 		return;
 
diff --git a/engines/snatcher/script.h b/engines/snatcher/script.h
index 6e55b0801c1..ba6de5c59d8 100644
--- a/engines/snatcher/script.h
+++ b/engines/snatcher/script.h
@@ -40,9 +40,9 @@ public:
 	void reset();
 	void writeUInt16(uint16 val);
 	void writeUInt32(uint32 val);
-	void enable() { _enable = true; }	
-	bool running() const { return _enable; }
-	void run();
+	void start() { _enable = true; }	
+	bool enabled() const { return _enable; }
+	void run(GameState &state);
 
 private:
 	const uint16 *_readPos;
@@ -58,49 +58,70 @@ private:
 private:
 	void makeFunctions();
 
-	void m_end(const uint16 *&data);
-	void m_01(const uint16 *&data);
-	void m_02(const uint16 *&data);
-	void m_03(const uint16 *&data);
-	void m_04(const uint16 *&data);
-	void m_05(const uint16 *&data);
-	void m_06(const uint16 *&data);
-	void m_fmMusicStart(const uint16 *&data);
-	void m_gfxOps(const uint16 *&data);
-	void m_animOps(const uint16 *&data);
-	void m_pcmWait(const uint16 *&data);
-	void m_11(const uint16 *&data);
-	void m_12(const uint16 *&data);
-	void m_mmSeq(const uint16 *&data);
-	void m_14(const uint16 *&data);
-	void m_gfxReset(const uint16 *&data);
-	void m_waitFrames(const uint16 *&data);
-	void m_loadResource(const uint16 *&data);
-	void m_gfxStart(const uint16 *&data);
-	void m_fmMusicWait(const uint16 *&data);
-	void m_20(const uint16 *&data);
-	void m_21(const uint16 *&data);
-	void m_22(const uint16 *&data);
-	void m_23(const uint16 *&data);
-	void m_24(const uint16 *&data);
-	void m_25(const uint16 *&data);
-	void m_26(const uint16 *&data);
-	void m_27(const uint16 *&data);
-	void m_28(const uint16 *&data);
-	void m_29(const uint16 *&data);
-	void m_30(const uint16 *&data);
-	void m_31(const uint16 *&data);
-	void m_32(const uint16 *&data);
-	void m_33(const uint16 *&data);
-	void m_34(const uint16 *&data);
-	void m_35(const uint16 *&data);
-
-	typedef Common::Functor1Mem<const uint16*&, void, CmdQueue> CmdQueOpcode;
+	void m_end(GameState &state, const uint16 *&data);
+	void m_initAnimations(GameState &state, const uint16 *&data);
+	void m_02(GameState &state, const uint16 *&data);
+	void m_drawCommands(GameState &state, const uint16 *&data);
+	void m_04(GameState &state, const uint16 *&data);
+	void m_printText(GameState &state, const uint16 *&data);
+	void m_06(GameState &state, const uint16 *&data);
+	void m_fmMusicStart(GameState &state, const uint16 *&data);
+	void m_displayDialog(GameState &state, const uint16 *&data);
+	void m_animOps(GameState &state, const uint16 *&data);
+	void m_pcmWait(GameState &state, const uint16 *&data);
+	void m_11(GameState &state, const uint16 *&data);
+	void m_12(GameState &state, const uint16 *&data);
+	void m_mmSeq(GameState &state, const uint16 *&data);
+	void m_14(GameState &state, const uint16 *&data);
+	void m_gfxReset(GameState &state, const uint16 *&data);
+	void m_waitFrames(GameState &state, const uint16 *&data);
+	void m_loadResource(GameState &state, const uint16 *&data);
+	void m_gfxStart(GameState &state, const uint16 *&data);
+	void m_fmMusicWait(GameState &state, const uint16 *&data);
+	void m_20(GameState &state, const uint16 *&data);
+	void m_21(GameState &state, const uint16 *&data);
+	void m_resetTextFields(GameState &state, const uint16 *&data);
+	void m_23(GameState &state, const uint16 *&data);
+	void m_24(GameState &state, const uint16 *&data);
+	void m_25(GameState &state, const uint16 *&data);
+	void m_26(GameState &state, const uint16 *&data);
+	void m_27(GameState &state, const uint16 *&data);
+	void m_28(GameState &state, const uint16 *&data);
+	void m_29(GameState &state, const uint16 *&data);
+	void m_30(GameState &state, const uint16 *&data);
+	void m_31(GameState &state, const uint16 *&data);
+	void m_32(GameState &state, const uint16 *&data);
+	void m_33(GameState &state, const uint16 *&data);
+	void m_palOps(GameState &state, const uint16 *&data);
+	void m_35(GameState &state, const uint16 *&data);
+
+	typedef Common::Functor2Mem<GameState&, const uint16*&, void, CmdQueue> CmdQueOpcode;
 	Common::Array<CmdQueOpcode*> _opcodes;
+
+private:
+	void printSceneEntryStringHead();
+	void printSceneEntryStringBody(GameState &state);
+	bool checkStringProgress();
+	bool waitWithCursorAnim();
+
+	uint8 *_textBuffer;
+	uint8 _textColor;
+	uint8 _textY;
+	uint8 _textY2;
+	//uint8 _makestrbt1;
+	uint8 _sceneId;
+	uint8 _textLineBreak;
+	uint8 _textLineEnd;
+	uint16 _sceneTextOffsCur;
+	uint16 _sceneInfo;
+	uint16 _sceneTextOffset;
+	uint16 _sceneTextOffsStart;
+	uint8 _waitCursorFrame;
+	uint8 _waitCursorAnimDelay;
 };
 
 struct Script {
-	Script() : scriptStateByteUnk(0), unkislp(0), data(nullptr), dataSize(0), curPos(0), newPos(-1), curFileNo(0), curGfxScript(-1), stack(nullptr), stackSize(0x600), sp(nullptr), bp(nullptr) {
+	Script() : scriptStateByteUnk(0), unkislp(0), data(nullptr), dataSize(0), curPos(0), newPos(-1), curFileNo(0), curGfxScript(-1), stack(nullptr), stackSize(0x600), sp(nullptr), bp(nullptr), res() {
 		stack = new uint8[stackSize]();
 		sp = bp = &stack[stackSize];
 	}
@@ -111,6 +132,7 @@ struct Script {
 	uint8 unkislp;
 	uint8 curFileNo;
 	int16 curGfxScript;
+	ResourcePointer res;
 	const uint8 *data;
 	uint32 dataSize;
 	int curPos;
@@ -129,7 +151,7 @@ public:
 	//void writeVar(uint16 arrayNo, uint16 pos, uint8 val);
 	void resetArrays();
 	void run(Script *script);
-	void cleanupState();
+	bool postProcess(Script *script);
 
 private:
 	SnatcherEngine *_vm;
@@ -208,7 +230,7 @@ private:
 	void o_63();
 	void o_64();
 	void o_subOps();
-	void o_gfxOps();
+	void o_displayDialog();
 	void o_animWait();
 	void o_pcmSoundWait();
 	void o_fmMusicWait();
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index d2800f90c02..9e31af36a89 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -24,6 +24,7 @@
 #include "snatcher/script.h"
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
+#include "snatcher/text.h"
 #include "snatcher/util.h"
 #include "common/config-manager.h"
 #include "common/endian.h"
@@ -43,7 +44,8 @@
 namespace Snatcher {
 
 SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _scd(nullptr), _gfx(nullptr), _snd(nullptr), _input(),
-	_scriptEngine(nullptr), _cmdQueue(nullptr), _script(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _gfxInfo(), _frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
+	_scriptEngine(nullptr), _cmdQueue(nullptr), _script(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _enableLightGun(false), _gfxInfo(),
+		_frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
 	assert(system);
 }
 
@@ -82,7 +84,7 @@ bool SnatcherEngine::initResource() {
 		return false;
 
 	uint32 size = 0;
-	const uint8 *data = _fio->fileData(96, &size);
+	uint8 *data = _fio->fileData(96, &size);
 	if (!data)
 		return false;
 	_scd = new ResourcePointer(data, 0, 0xD400, true);
@@ -120,6 +122,7 @@ bool SnatcherEngine::initGfx(Common::Platform platform, bool use8BitColorMode) {
 	_gfx = new GraphicsEngine(&pxf, _system, platform, _gfxInfo, _snd);
 	if (_gfx) {
 		initGraphics(_gfx->screenWidth(), _gfx->screenHeight(), &pxf);
+		_gfx->setTextFont(_scd->makePtr(0x14B7C)(), 816, _scd->makePtr(0x14EAC)(), 102);
 		return true;
 	}
 
@@ -171,7 +174,10 @@ bool SnatcherEngine::start() {
 	Util::rngReset();
 	GameState state;
 
-	playBootLogoAnimation(state);
+	//playBootLogoAnimation(state);
+	state.prologue = -1;
+	state.modProcessTop = 7;
+	state.modProcessSub = 4;
 
 	uint32 frameTimer = 0;
 
@@ -195,9 +201,9 @@ bool SnatcherEngine::start() {
 
 		for (int i = 0; i < numLoops; ++i) {
 			if (!_gfx->busy(0)) {
-				bool blockedMod = _cmdQueue->running();
-				if (_cmdQueue->running()) {
-					_cmdQueue->run();
+				bool blockedMod = _cmdQueue->enabled();
+				if (_cmdQueue->enabled()) {
+					_cmdQueue->run(state);
 					blockedMod = _gfx->busy(0);
 				}
 				if (!blockedMod) {
@@ -206,6 +212,8 @@ bool SnatcherEngine::start() {
 				}
 			}
 
+			_gfx->updateText();
+
 			if (numLoops == 2) {
 				if (_gfx->busy(1)) {
 					--countTo5;
@@ -217,9 +225,10 @@ bool SnatcherEngine::start() {
 			}
 		}
 
+		checkEvents(state);
+
 		_gfx->nextFrame();
 		_snd->update();
-		checkEvents(state);
 		delayUntil(nextFrame);
 	}
 
@@ -273,11 +282,17 @@ static const InputEvent _defaultKeyEvents[] = {
 	{ Common::EVENT_RBUTTONDOWN, Common::EVENT_RBUTTONUP, Common::KEYCODE_INVALID, 0x00, 0x200, false },
 };
 
+static const uint8 _scdKeyConfigs[6][3] = {
+	{ 6, 4, 5 }, { 6, 5, 4 },
+	{ 4, 6, 5 }, { 4, 5, 6 },
+	{ 5, 4, 6 }, { 5, 6, 4 }
+};
+
 void SnatcherEngine::checkEvents(const GameState &state) {
 	Common::Event evt;
 	_lastKeys &= ~_releaseKeys;
 	_releaseKeys = 0;
-	_input.controllerFlags = 0;
+	_input.controllerFlags = _input.controllerFlagsRemapped = 0;
 	Common::Point mouse;
 
 	while (_eventMan->pollEvent(evt)) {
@@ -285,6 +300,10 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 			if (evt.type == k.pressType && (k.kc == Common::KEYCODE_INVALID || evt.kbd.keycode == k.kc) && (k.kFlag == 0 || (evt.kbd.flags & k.kFlag))) {
 				if (!(_lastKeys & k.internalEvent)) {
 					_input.controllerFlags |= k.internalEvent;
+					if (k.internalEvent & 0x70) // The A, B and C buttons can be reconfigured in the main menu. This applies the setting.
+						_input.controllerFlagsRemapped |= (1 << _scdKeyConfigs[state.conf.controllerSetup][k.internalEvent >> 5]);
+					else
+						_input.controllerFlagsRemapped |= k.internalEvent;
 					_lastKeys |= k.internalEvent;
 					if (_keyRepeat || k.releaseType == Common::EVENT_INVALID)
 						_releaseKeys |= k.internalEvent;
@@ -301,14 +320,35 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 			}
 		}
 	}
+
+	if (_enableLightGun && _input.controllerFlags & 0x100)
+		_gfx->setVar(7, 4);
 }
 
 void SnatcherEngine::updateChapter(GameState &state) {
 	switch (state.chapter) {
 	case 0:
 		// Intro and main menu
-		if (state.introState == -1)
-			++state.chapter;
+		if (state.prologue != -1)
+			break;
+
+		if (state.menuSelect == 0)
+			_gfx->setVar(1, _gfx->getVar(1) | 2);
+		else
+			_gfx->setVar(5, 1);
+
+		_cmdQueue->writeUInt16(0x16);
+		_cmdQueue->writeUInt16(0x03);
+		_cmdQueue->writeUInt32(0xECB6);
+		_cmdQueue->writeUInt16(0x03);
+		_cmdQueue->writeUInt32(0xECC4);
+		_cmdQueue->writeUInt16(0x01);
+		_cmdQueue->writeUInt32(0xED0E);
+		_cmdQueue->start();
+
+		++state.chapter;
+		state.chapter |= 0x80;
+
 		break;
 
 	case 1:
@@ -323,15 +363,16 @@ void SnatcherEngine::updateChapter(GameState &state) {
 			/* load savegame */
 		}
 
-		_cmdQueue->enable();
+		_cmdQueue->start();
 		++state.chapter;
 		state.chapter |= 0x80;
 		break;
 
 	case 2:
+		// Act I
 		_scriptEngine->run(_script);
-		_cmdQueue->enable();
-		state.chapter |= 0x80;
+		_cmdQueue->start();
+		state.chapter |= 0xC0;
 		break;
 
 	case 3:
@@ -344,9 +385,27 @@ void SnatcherEngine::updateChapter(GameState &state) {
 		break;
 
 	default:
-		if (_cmdQueue->running() || (_snd->pcmGetStatus() & 7))
-			return;
-		state.chapter &= ~0x80;
+		if (state.chapter & 0x80) {
+			if (!(_cmdQueue->enabled() || (_snd->pcmGetStatus() & 7)))
+				state.chapter &= ~0x80;
+		} else if (state.chapter & 0x40) {
+			//_unkScrByte = 0;
+			if (_scriptEngine->postProcess(_script)) {
+				for (int i = 5; i < 15; ++i)
+					_gfx->setAnimParameter(i, GraphicsEngine::kAnimParaEnable, 0);
+				_cmdQueue->writeUInt16(0x22);
+				_cmdQueue->writeUInt32(0x139D0);
+				_cmdQueue->start();
+				state.chapter |= 0xA0;
+			}				
+			state.chapter &= ~0x40;
+		} else if (state.chapter & 0x20) {
+			_gfx->setVar(11, 0xFF);
+			//unkPostScriptUpdt
+			//updt_mult_sub_11004
+			//scriptUnkProcess
+			state.chapter &= ~0x20;
+		}		
 		break;
 	}
 }
@@ -406,7 +465,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 				state.finish = 0;
 				state.modProcessTop = state.menuSelect ? 7 : state.modProcessTop + 1;
 				state.modIndex = 0;
-				state.introState = 1;
+				state.prologue = 1;
 			}
 			break;
 		default:
@@ -431,8 +490,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			break;
 		case 1:
 			if (!(_gfx->frameCount() & 0x1F)) {
-				// startup__runWithFileFunc(2)
-				//_unlCDREadSeekWord = 0;
+				// original: check whether file is loaded
 				state.frameNo = -1;
 				++state.modProcessSub;
 			}
@@ -444,7 +502,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 				state.finish = 0;
 				state.counter = 10;
 				++state.modProcessSub;
-				_gfx->enqueuePaletteEvent(_scd->makeAbsPtr(0x14B1C));
+				_gfx->enqueuePaletteEvent(_scd->makePtr(0x14B1C));
 			} else if (state.finish) {
 				if (state.modIndex == 0) {
 					++state.modIndex;
@@ -456,7 +514,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			break;
 		case 3:
 			if (--state.counter == 1) {
-				_gfx->enqueueDrawCommands(_scd->makeAbsPtr(0x14B4E));
+				_gfx->enqueueDrawCommands(_scd->makePtr(0x14B4E));
 			} else if (state.counter == 0) {
 				state.finish = -1;
 				state.modProcessSub = 0;
@@ -546,7 +604,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 		case 4:
 			state.modProcessTop = 5;
 			state.modProcessSub = 0;
-			state.introState = -1;
+			state.prologue = -1;
 			break;
 		default:
 			break;
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index d6510ae7172..1f1ca5aaf55 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -35,12 +35,12 @@ namespace Snatcher {
 class GraphicsEngine;
 class FIO;
 class CmdQueue;
+class ResourcePointer;
 class ScriptEngine;
 class SoundEngine;
 class SceneModule;
 
 struct GameState;
-struct ResourcePointer;
 struct Script;
 
 class SnatcherEngine : public Engine {
@@ -102,20 +102,23 @@ private:
 public:
 	// Input
 	struct Input {
-		Input() : controllerFlags(0), lightGunPos() {}
+		Input() : controllerFlags(0), controllerFlagsRemapped(0), lightGunPos() {}
 		uint16 controllerFlags;
+		uint16 controllerFlagsRemapped;
 		Common::Point lightGunPos;
 	};
 
 	const Input &input() const { return _input; }
 	void calibrateLightGun(GameState &state);
 	void toggleKeyRepeat(bool enableRepeat) { _keyRepeat = enableRepeat; }
+	void allowLightGunInput(bool enable) { _enableLightGun = enable; }
 
 private:
 	uint16 _lastKeys;
 	uint16 _releaseKeys;
 	Common::Point _realLightGunPos;
 	bool _keyRepeat;
+	bool _enableLightGun;
 	
 	Input _input;
 };
diff --git a/engines/snatcher/text.h b/engines/snatcher/text.h
new file mode 100644
index 00000000000..8f0a23be1d9
--- /dev/null
+++ b/engines/snatcher/text.h
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#ifndef SNATCHER_TEXT_H
+#define SNATCHER_TEXT_H
+
+#include "common/platform.h"
+#include "common/scummsys.h"
+
+namespace Snatcher {
+
+class Animator;
+class TextRenderer {
+public:
+
+	TextRenderer() {}
+	virtual ~TextRenderer() {}
+
+	virtual void setFont(const uint8 *font, uint32 fontSize) = 0;
+	virtual void setCharWidthTable(const uint8 *table, uint32 tableSize) = 0;
+
+	virtual void enqueuePrintJob(const uint8 *text) = 0;
+	virtual void setPrintDelay(int delay) = 0;
+	//virtual void setColor(uint8 color) = 0;
+
+	virtual void draw() = 0;
+	virtual void reset() = 0;
+	//virtual void requestRefresh(bool req) = 0;
+	virtual bool needsPrint() const = 0;
+
+protected:
+
+private:
+	static TextRenderer *createSegaTextRenderer(Animator *animator);
+
+public:
+	static TextRenderer *create(Common::Platform platform, Animator *animator) {
+		switch (platform) {
+		case Common::kPlatformSegaCD:
+			return createSegaTextRenderer(animator);
+		default:
+			break;
+		};
+		return 0;
+	}
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_SOUND_H
diff --git a/engines/snatcher/text_scd.cpp b/engines/snatcher/text_scd.cpp
new file mode 100644
index 00000000000..4d035b90ab7
--- /dev/null
+++ b/engines/snatcher/text_scd.cpp
@@ -0,0 +1,236 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#include "snatcher/animator.h"
+#include "snatcher/text.h"
+
+namespace Snatcher {
+
+class TextRenderer_SCD : public TextRenderer {
+public:
+	TextRenderer_SCD(Animator *animator);
+	~TextRenderer_SCD() override;
+
+	void setFont(const uint8 *font, uint32 fontSize) override;
+	void setCharWidthTable(const uint8 *table, uint32 tableSize) override;
+
+	void enqueuePrintJob(const uint8 *text) override;
+	void setPrintDelay(int delay) override;
+	//void setColor(uint8 color) override;
+
+	void draw() override;
+	void reset() override { _needDraw = false; }
+	bool needsPrint() const override { return _needDraw; }
+
+private:
+	void drawGlyph(uint16 ch);
+
+	bool _needDraw;
+	bool _block;
+	uint16 _curX;
+	uint16 _curY;
+	bool _fixedWith9;
+	uint16 _printDelay;
+	uint16 _printDelayCounter;
+	uint8 _color;
+	uint8 _pscr_byt1;
+	uint8 _pscr_byt2;
+	uint8 _pscr_byt3;
+	uint8 _pscr_byt8;
+	int16 _pscr_wd;
+	const uint8 *_textPtr;
+	uint8 *_renderBuffer;
+	Animator *_animator;
+	const uint8 *_font;
+	uint32 _fontSize;
+	const uint8 *_charWidthTable;
+	uint32 _charWidthTableSize;
+};
+
+TextRenderer_SCD::TextRenderer_SCD(Animator *animator) : TextRenderer(), _animator(animator), _textPtr(nullptr), _renderBuffer(nullptr), _needDraw(false), _block(false), _printDelay(0), _printDelayCounter(0), _color(0),
+	_curX(0), _curY(0), _fixedWith9(false), _font(nullptr), _fontSize(0), _charWidthTable(nullptr), _charWidthTableSize(0), _pscr_byt8(0), _pscr_wd(0), _pscr_byt1(0), _pscr_byt2(0), _pscr_byt3(0) {
+	_renderBuffer = new uint8[0x2000]();
+	assert(_renderBuffer);
+}
+
+TextRenderer_SCD::~TextRenderer_SCD() {
+	delete[] _renderBuffer;
+}
+
+void TextRenderer_SCD::setFont(const uint8 *font, uint32 fontSize) {
+	_font = font;
+	_fontSize = fontSize;
+}
+
+void TextRenderer_SCD::setCharWidthTable(const uint8 *table, uint32 tableSize) {
+	_charWidthTable = table;
+	_charWidthTableSize = tableSize;
+}
+
+void TextRenderer_SCD::enqueuePrintJob(const uint8 *text) {
+	_textPtr = text;
+	_needDraw = true;
+	_printDelayCounter = _printDelay = 0;
+}
+
+void TextRenderer_SCD::setPrintDelay(int delay) {
+	_printDelay = delay;
+}
+/*
+void TextRenderer_SCD::setColor(uint8 color) {
+	_color = color;
+}
+*/
+void TextRenderer_SCD::draw() {
+	if (!_needDraw || _block)
+		return;
+
+	memset(_renderBuffer, 0, 0x2000);
+
+	int firstRow = -1;
+	int numRows = 0;
+	const uint8 *s = _textPtr;
+
+	for (bool lp1 = true; lp1; ) {
+		if (_printDelayCounter) {
+			_printDelayCounter--;
+			lp1 = false;
+		} else {
+			for (bool lp2 = true; lp2; ) {
+				_printDelayCounter = _printDelay;
+				uint8 in = *s++;
+				switch (in) {
+				case 0xFF:
+					_needDraw = lp1 = lp2 = false;
+					break;
+				case 0xFE:
+					_color = *s++;
+					break;
+				case 0xFD:
+					_curY += 9;
+					_curX = 24;
+					_pscr_byt8 += (*s++ << 2);
+					break;
+				case 0xFC:
+					_printDelayCounter = _printDelay = *s++;
+					lp2 = false;
+					break;
+				case 0xFB:
+					_curX = *s++;
+					_curY = *s++;
+					break;
+				case 0xFA:
+					_pscr_byt1 = *s++;
+					_pscr_byt2 = *s++;
+					_block = true;
+					lp1 = lp2 = false;
+					break;
+				case 0xF9:
+					_pscr_byt3 = *s++;
+					break;
+				case 0xF8:
+					_pscr_wd = (*s++ << 8) | (*s++);
+					break;
+				case 0xF7:
+					_fixedWith9 = *s++ ? true : false;
+					break;
+				default:
+					if (in < 32) {
+						_pscr_byt8 += (in << 2);
+					} else {
+						in -= 32;
+
+						firstRow = (firstRow == -1) ? (_curY >> 3) : MIN<int16>(firstRow, _curY >> 3);
+						numRows = MAX<int16>(numRows, ((_curY + 7) >> 3) - firstRow + 1);
+
+						drawGlyph(in);
+
+						if (_fixedWith9) {
+							_curX += 9;
+						} else {
+							if (in < _charWidthTableSize)
+								_curX += _charWidthTable[in];
+							else
+								error("%s(): Invalid char %04X", __FUNCTION__, in);
+						}
+						lp2 = false;
+					}
+					break;
+				}
+			}
+		}
+	}
+	_textPtr = s;
+	if (numRows)
+		_animator->renderTextBuffer(_renderBuffer, firstRow, numRows);
+}
+
+void TextRenderer_SCD::drawGlyph(uint16 ch) {
+	uint16 x = _curX;
+	if (_fixedWith9 && (ch == 17 || ch == 41))
+		++x;
+
+	const uint8 *src = _font + (ch << 3);
+	uint8 *dst = _renderBuffer + ((_curY & ~7) << 7) + ((_curY & 7) << 2) + ((x & ~7) << 2) + ((x & 7) >> 1);
+	assert(dst < _renderBuffer + 0x2000);
+
+	if ((uint)(ch << 3) >= _fontSize)
+		error("%s(): Invalid char %04X", __FUNCTION__, ch);
+
+	uint8 dY = _curY & 7;
+	uint8 dX = x & 7;
+	uint8 c1 = _color & 0x0F;
+	uint8 c2 = _color << 4;
+
+	for (int h = 0; h < 8; ++h) {
+		uint8 *d = dst;
+		uint8 dXX = dX;
+		uint8 in = *src++;
+
+		for (int w = 7; w >= 0; --w) {
+			if (in & (1 << w)) {
+				if (dXX & 1)
+					*d = (*d & 0xF0) | c1;
+				else
+					*d = (*d & 0x0F) | c2;
+			}
+			if (dXX & 1)
+				++d;
+			if (++dXX == 8)
+				d += 28;
+			assert(d < _renderBuffer + 0x2000);
+		}
+
+		dst += 4;
+		if (++dY == 8) {
+			dY = 0;
+			dst += 992;
+		}
+		assert(dst < _renderBuffer + 0x2000);
+	}
+}
+
+TextRenderer *TextRenderer::createSegaTextRenderer(Animator *animator) {
+	return new TextRenderer_SCD(animator);
+}
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/transition.h b/engines/snatcher/transition.h
index c104a1ec98c..e55d1779428 100644
--- a/engines/snatcher/transition.h
+++ b/engines/snatcher/transition.h
@@ -22,6 +22,7 @@
 #ifndef SNATCHER_TRANSITION_H
 #define SNATCHER_TRANSITION_H
 
+#include "common/platform.h"
 #include "common/scummsys.h"
 
 namespace Snatcher {
diff --git a/engines/snatcher/transition_scd.cpp b/engines/snatcher/transition_scd.cpp
index 66d62a07e12..f547337d3e7 100644
--- a/engines/snatcher/transition_scd.cpp
+++ b/engines/snatcher/transition_scd.cpp
@@ -159,7 +159,7 @@ private:
 	void trsUpdt_revealShutter(int arg);
 	void trsUpdt_13(int arg);
 	void trsUpdt_14(int arg);
-	void trsUpdt_15(int arg);
+	void trsUpdt_showTextArea(int arg);
 	void trsUpdt_16(int arg);
 	void trsUpdt_17(int arg);
 	void trsUpdt_18(int arg);
@@ -183,6 +183,7 @@ private:
 
 	void hIntHandler_screenShutter(Graphics::SegaRenderer *sr);
 	void hIntHandler_revealShutter(Graphics::SegaRenderer *sr);
+	void hIntHandler_showTextArea(Graphics::SegaRenderer *sr);
 };
 
 TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0), _hint_proc(0), _transitionStep(0),
@@ -243,8 +244,6 @@ bool TransitionManager_SCD::nextFrame() {
 		_nextStep = _resetCommand;
 		_resetCommand = 0;
 		_trsCommandExt = 0;
-		// _wordRAM__TABLE48__09 = 0;
-		// _wordRAM__TABLE48__0A = 0;
 	}
 
 	if (_nextStepExt != _lastStepExt || _lastStepExt == 0) {
@@ -258,6 +257,8 @@ bool TransitionManager_SCD::nextFrame() {
 				} else {
 					resetVars(0x18);
 				}
+			} else {
+				resetVars(0x18);
 			}
 		} else if (_nextStepExt != 0 && (_nextStepExt != 15 || _lastStepExt != 23)) {
 			_lastStepExt = _nextStepExt;
@@ -353,6 +354,7 @@ void TransitionManager_SCD::processTransition() {
 	case 7: case 8:
 		break;
 	case 9:
+		_result.hInt.counter = 7;
 		break;
 	case 10: case 11:
 		break;
@@ -430,7 +432,7 @@ void TransitionManager_SCD::makeFunctions() {
 		TF(revealShutter),
 		TF(13),
 		TF(14),
-		TF(15),
+		TF(showTextArea),
 		TF(16),
 		TF(17),
 		TF(18),
@@ -462,7 +464,12 @@ void TransitionManager_SCD::makeFunctions() {
 		HF(screenShutter),
 		HF(revealShutter),
 		nullptr,
-		nullptr
+		nullptr,
+		nullptr,
+		nullptr,
+		nullptr,
+		nullptr,
+		HF(showTextArea)
 	};
 
 	for (uint i = 0; i < ARRAYSIZE(funcTbl2); ++i) \
@@ -540,7 +547,13 @@ void TransitionManager_SCD::trsUpdt_13(int arg) {
 void TransitionManager_SCD::trsUpdt_14(int arg) {
 }
 
-void TransitionManager_SCD::trsUpdt_15(int arg) {
+void TransitionManager_SCD::trsUpdt_showTextArea(int arg) {
+	if (arg != 0)
+		return;
+	_transitionType = 9;
+	setHINTHandler(15);
+	_transitionState = 256;
+	++_subPara;
 }
 
 void TransitionManager_SCD::trsUpdt_16(int arg) {
@@ -648,6 +661,16 @@ void TransitionManager_SCD::hIntHandler_revealShutter(Graphics::SegaRenderer *sr
 	++_transitionStep;
 }
 
+void TransitionManager_SCD::hIntHandler_showTextArea(Graphics::SegaRenderer *sr) {
+	if (_transitionStep++ != 17)
+		return;
+	sr->writeUint16VSRAM(0, TO_BE_16(_transitionState));
+	sr->writeUint16VSRAM(2, TO_BE_16(_transitionState));
+	sr->writeUint16VRAM(0xF800, 0);
+	sr->writeUint16VRAM(0xF802, 0);
+	_result.hInt.enable = false;
+}
+
 TransitionManager *TransitionManager::createSegaTransitionManager(GraphicsEngine::GfxState &state) {
 	return new TransitionManager_SCD(state);
 }


Commit: 6537234d3689611d2c1e8f928c9cde789340194c
    https://github.com/scummvm/scummvm/commit/6537234d3689611d2c1e8f928c9cde789340194c
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: add verb interface, script work, etc.

The verb interface is mostly complete, including the
usage of the 'Jordan' computer. There are two more
modes for the verb interface I haven't encountered yet,
so it might still be necessary to make some additions.

Changed paths:
  A engines/snatcher/saveload.cpp
  A engines/snatcher/saveload.h
  A engines/snatcher/ui.cpp
  A engines/snatcher/ui.h
    audio/softsynth/fmtowns_pc98/sega_audio.cpp
    engines/snatcher/animator.h
    engines/snatcher/animator_scd.cpp
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/module.mk
    engines/snatcher/palette.h
    engines/snatcher/palette_scd.cpp
    engines/snatcher/resource.cpp
    engines/snatcher/resource.h
    engines/snatcher/scene/scene_d0.cpp
    engines/snatcher/scene/scene_d1.cpp
    engines/snatcher/scene/scene_d2.cpp
    engines/snatcher/script.cpp
    engines/snatcher/script.h
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/sound.cpp
    engines/snatcher/sound.h
    engines/snatcher/sound_device_scd.cpp
    engines/snatcher/text.h
    engines/snatcher/text_scd.cpp
    engines/snatcher/transition.h
    engines/snatcher/transition_scd.cpp
    engines/snatcher/util.cpp
    engines/snatcher/util.h
    graphics/segagfx.cpp
    graphics/segagfx.h


diff --git a/audio/softsynth/fmtowns_pc98/sega_audio.cpp b/audio/softsynth/fmtowns_pc98/sega_audio.cpp
index 8c37ae1802f..06a3ac6d15e 100644
--- a/audio/softsynth/fmtowns_pc98/sega_audio.cpp
+++ b/audio/softsynth/fmtowns_pc98/sega_audio.cpp
@@ -418,7 +418,7 @@ void SegaPCMChannel::stopInternal() {
 }
 
 void SegaPCMChannel::dataEndHandler() {
-	if (_stream.get() && _streamSamplesLeft)
+	if (_stream.get())
 		feed();
 }
 
@@ -428,13 +428,9 @@ void SegaPCMChannel::feed() {
 		_stream.get()->read(_streamTempBuff, readSize);
 		_streamSamplesLeft -= readSize;
 		_sai->loadPCMData(_streamStartAddr, _streamTempBuff, readSize);
-	} else {
-		delete[] _streamTempBuff;
-		_streamTempBuff = nullptr;
-		_stream.reset();
 	}
 	if (_playing)
-		setupLoop(_streamSamplesLeft ? _streamStartAddr : (_streamStartAddr + _streamFeedLen), readSize);
+		setupLoop(readSize ? _streamStartAddr : (_streamStartAddr + _streamFeedLen), readSize);
 }
 
 SegaPSG::SegaPSG(int samplingRate, int deviceVolume) : _intRate(3579545), _extRate(samplingRate), _deviceVolume(deviceVolume), _numChannels(3), _cr(-1),
diff --git a/engines/snatcher/animator.h b/engines/snatcher/animator.h
index cbd0dba0167..aa52dcd363b 100644
--- a/engines/snatcher/animator.h
+++ b/engines/snatcher/animator.h
@@ -19,8 +19,8 @@
 *
 */
 
-#ifndef SNATCHER_RENDER_H
-#define SNATCHER_RENDER_H
+#ifndef SNATCHER_ANIMATOR_H
+#define SNATCHER_ANIMATOR_H
 
 #include "common/platform.h"
 #include "snatcher/graphics.h"
@@ -36,13 +36,15 @@ public:
 	virtual bool enqueueDrawCommands(ResourcePointer &res) = 0;
 	virtual void clearDrawCommands() = 0;
 	virtual void initData(ResourcePointer &res, uint8 mode) = 0;
-	virtual void initAnimations(ResourcePointer &res, uint16 len) = 0;
+	virtual void initAnimations(ResourcePointer &res, uint16 len, bool dontUpdate) = 0;
 	virtual void linkAnimations(ResourcePointer &res, uint16 len) = 0;
 	virtual void clearAnimations(int mode = 0) = 0;
 	virtual void setPlaneMode(uint16 mode) = 0;
 
 	virtual void resetTextFields() = 0;
-	virtual void renderTextBuffer(const uint8 *textBuffer, uint16 firstLine, uint8 numLines) = 0;
+	virtual void clearJordanInputField() = 0;
+	virtual uint8 *getTextRenderBuffer() const = 0;
+	virtual void renderTextBuffer(uint16 firstLine, uint8 numLines) = 0;
 
 	virtual void updateScreen(uint8 *screen) = 0;
 	virtual void updateAnimations() = 0;
@@ -85,4 +87,4 @@ public:
 
 } // End of namespace Snatcher
 
-#endif // SNATCHER_RENDER_H
+#endif // SNATCHER_ANIMATOR_H
diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index cdb7f8096cc..105f884bafd 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -41,7 +41,7 @@ namespace Snatcher {
 struct AnimObject {
 	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), f16(0), f18(0), f1c(0),
 		timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0),
-			res(), scriptData(), spriteData(nullptr), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), scriptComFlags(0), f4f(0), blink(0), blinkCounter(0), blinkDuration(0) {}
+			res(), scriptData(), spriteData(nullptr), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), scriptComFlags(0), freeze(0), blink(0), blinkCounter(0), blinkDuration(0) {}
 	
 	void clear() {
 		enable = blinkRate = drawFlags = 0;
@@ -62,7 +62,7 @@ struct AnimObject {
 		spriteData = nullptr;
 		absSpeedX = absSpeedY = 0;
 		parent = children = next = 0;
-		scriptComFlags = f4f = 0;
+		scriptComFlags = freeze = 0;
 		blink = blinkCounter = blinkDuration = 0;
 
 	}
@@ -100,7 +100,7 @@ struct AnimObject {
 	uint16 children;
 	uint16 next;
 	uint8 scriptComFlags;
-	uint8 f4f;
+	uint8 freeze;
 
 	const uint8 id;
 };
@@ -114,13 +114,15 @@ public:
 	bool enqueueDrawCommands(ResourcePointer &res) override;
 	void clearDrawCommands() override;
 	void initData(ResourcePointer &res, uint8 mode) override;
-	void initAnimations(ResourcePointer &res, uint16 len) override;
+	void initAnimations(ResourcePointer &res, uint16 len, bool dontUpdate) override;
 	void linkAnimations(ResourcePointer &res, uint16 len) override;
 	void clearAnimations(int mode = 0) override;
 	void setPlaneMode(uint16 mode) override;
 
 	void resetTextFields() override;
-	void renderTextBuffer(const uint8 *textBuffer, uint16 firstLine, uint8 numLines) override;
+	void clearJordanInputField() override;
+	uint8 *getTextRenderBuffer() const override;
+	void renderTextBuffer(uint16 firstLine, uint8 numLines) override;
 
 	void updateScreen(uint8 *screen) override;
 	void updateAnimations() override;
@@ -214,7 +216,7 @@ private:
 	int anim_setSpeedY(AnimObject &a, const uint8 *data);
 	int anim_palEvent(AnimObject &a, const uint8 *data);
 	int anim_palReset(AnimObject &a, const uint8 *data);
-	int anim_copyCmds(AnimObject &a, const uint8 *data);
+	int anim_drawCmds(AnimObject &a, const uint8 *data);
 	int anim_nop(AnimObject &a, const uint8 *data);
 	int anim_scrollSingleStepH(AnimObject &a, const uint8 *data);
 	int anim_scrollSingleStepV(AnimObject &a, const uint8 *data);
@@ -229,7 +231,7 @@ private:
 	int anim_audioSync(AnimObject &a, const uint8 *data);
 	int anim_27(AnimObject &a, const uint8 *data);
 	int anim_28(AnimObject &a, const uint8 *data);
-	int anim_29(AnimObject &a, const uint8 *data);
+	int anim_fmSoundEffect(AnimObject &a, const uint8 *data);
 	int anim_30(AnimObject &a, const uint8 *data);
 	int anim_pcmCommand(AnimObject &a, const uint8 *data);
 	int anim_setDrawFlags(AnimObject &a, const uint8 *data);
@@ -240,9 +242,9 @@ private:
 	int anim_38(AnimObject &a, const uint8 *data);
 	int anim_39(AnimObject &a, const uint8 *data);
 	int anim_40(AnimObject &a, const uint8 *data);
-	int anim_pcmSync(AnimObject &a, const uint8 *data);
+	int anim_speechSync(AnimObject &a, const uint8 *data);
 	int anim_42(AnimObject &a, const uint8 *data);
-	int anim_43(AnimObject &a, const uint8 *data);
+	int anim_toggleExtraPalette(AnimObject &a, const uint8 *data);
 	int anim_allowFrameDrop(AnimObject &a, const uint8 *data);
 	int anim_45(AnimObject &a, const uint8 *data);
 	int anim_46(AnimObject &a, const uint8 *data);
@@ -335,14 +337,14 @@ void Animator_SCD::initData(ResourcePointer &res, uint8 mode) {
 	_transferMode = mode;
 }
 
-void Animator_SCD::initAnimations(ResourcePointer &res, uint16 len) {
+void Animator_SCD::initAnimations(ResourcePointer &res, uint16 len, bool dontUpdate) {
 	ResourcePointer next = res + len;
 	ResourcePointer in = res;
 	while (in < next) {
 		assert(in[0] < 64);
 		AnimObject *a = _animations[*in++];
-		if (a->enable)
-			return;
+		//if (a->enable && dontUpdate)
+		//	return;
 
 		a->clear();
 		a->enable = 1;
@@ -418,27 +420,20 @@ void Animator_SCD::resetTextFields() {
 	_sr->loadToVRAM(s, 32, 0x1FE0);
 }
 
-void Animator_SCD::renderTextBuffer(const uint8 *textBuffer, uint16 firstLine, uint8 numLines) {
+void Animator_SCD::clearJordanInputField() {
+	// Clear the text line on the JORDAN monitor display
+	memset(_tempBuffer + 0x6C00, 0, 0x320);
+}
+
+
+uint8 *Animator_SCD::getTextRenderBuffer() const {
+	return _tempBuffer + 0x6000;
+}
+
+void Animator_SCD::renderTextBuffer(uint16 firstLine, uint8 numLines) {
 	uint16 start = firstLine << 10;
 	uint16 len = numLines << 10;
-	textBuffer += start;
-	uint8 *s = _tempBuffer + 0x6000 + start;
-	uint8 *d = s;
-	for (int i = 0; i < len; ++i) {
-		uint8 in = *textBuffer++;
-		uint8 h = in & 0xF0;
-		uint8 l = in & 0x0F;
-		if (h) {
-			if (l)
-				*d = in;
-			else
-				*d = (*d & 0x0F) | h;
-		} else if (l) {
-			*d = (*d & 0xF0) | l;
-		}
-		++d;
-	}	
-	_sr->loadToVRAM(s, len, start);
+	_sr->loadToVRAM(_tempBuffer + 0x6000 + start, len, start);
 }
 
 void Animator_SCD::updateScreen(uint8 *screen) {
@@ -448,9 +443,9 @@ void Animator_SCD::updateScreen(uint8 *screen) {
 	}
 
 	if (_clearFlags & 1)
-		_sr->memsetVRAM(0xE000, 0, 0x2000);
+		_sr->memsetVRAM(0xE000, 0, 0x1000);
 	if (_clearFlags & 2)
-		_sr->memsetVRAM(0xC000, 0, 0x2000);
+		_sr->memsetVRAM(0xC000, 0, 0x1000);
 	if (_clearFlags & 4)
 		_sr->memsetVRAM(0, 0, 0x1FE0);
 	_clearFlags = 0;
@@ -463,6 +458,11 @@ void Animator_SCD::updateScreen(uint8 *screen) {
 	drawAnimSprites();
 	updateScrollState();
 
+	if (!_trs->scroll_getState().hInt.enable && (_gfxState.getVar(11) != 0) && (_gfxState.getVar(11) != 0xFF)) {
+		_sr->hINT_setCounter(0);
+		_sr->hINT_enable(true);
+	}
+
 	_sr->setRenderColorTable(_pal->getSystemPalette(), 0, 64);
 	_sr->render(screen);
 }
@@ -499,7 +499,6 @@ void Animator_SCD::updateAnimations() {
 		uint8 cmd = s->scriptData[(s->frame == 0xFFFF ? 0 : s->frame) << 2];
 		if (!(cmd & 0x80))
 			s->spriteData = reinterpret_cast<const uint16*>(s->res.makePtr(s->spriteTableLocation).getDataFromTable(cmd)());
-
 		if (!(s->controlFlags & GraphicsEngine::kAnimPause)) {
 			s->posX += s->absSpeedX;
 			s->posY += s->absSpeedY;
@@ -587,8 +586,8 @@ void Animator_SCD::setAnimParameter(uint8 animObjId, int param, int32 value) {
 	case GraphicsEngine::kAnimParaScriptComFlags:
 		a.scriptComFlags = value;
 		break;
-	case GraphicsEngine::kAnimParaF4f:
-		a.f4f = value;
+	case GraphicsEngine::kAnimFreezeFlag:
+		a.freeze = value;
 		break;
 
 	default:
@@ -658,8 +657,8 @@ int32 Animator_SCD::getAnimParameter(uint8 animObjId, int param) const {
 		return a.absSpeedY >> 16;
 	case GraphicsEngine::kAnimParaScriptComFlags:
 		return a.scriptComFlags;
-	case GraphicsEngine::kAnimParaF4f:
-		return a.f4f;
+	case GraphicsEngine::kAnimFreezeFlag:
+		return a.freeze;
 	default:
 		error("%s(): Unknown parameter %d", __FUNCTION__, param);
 		break;
@@ -701,15 +700,13 @@ void Animator_SCD::loadDataFromGfxScript() {
 	_transferDelay = _transferData.readIncrUINT16();
 	uint16 addr = _transferData.readIncrUINT16();
 
-	if (!_transferMode) {
+	//if (!_transferMode) {
 		uint32 len = READ_BE_UINT16(src);
 		if (len != Util::decodeSCDData(src + 2, _tempBuffer))
 			error("%s(): Decode size mismatch", __FUNCTION__);
 		_sr->loadToVRAM(_tempBuffer, len, addr);
 		return;
-	}
-
-	assert(0);
+	//}
 
 	// multi part transfer: not needed (this is just due to original hardware limitations with the word ram and dma transfer)
 
@@ -1000,7 +997,7 @@ void Animator_SCD::runAnimScript(AnimObject &a) {
 		return;
 	}
 
-	int incr = (a.f4f == 0) ? 1 : 0;
+	int incr = (a.freeze == 0) ? 1 : 0;
 
 	while (incr != -1) {
 		a.frame += incr;
@@ -1043,7 +1040,7 @@ void Animator_SCD::makeAnimFunctions() {
 		ANM(setSpeedY),
 		ANM(palEvent),
 		ANM(palReset),
-		ANM(copyCmds),
+		ANM(drawCmds),
 		ANM(nop),
 		ANM(scrollSingleStepH),
 		ANM(scrollSingleStepV),
@@ -1062,7 +1059,7 @@ void Animator_SCD::makeAnimFunctions() {
 		ANM(audioSync),
 		ANM(27),
 		ANM(28),
-		ANM(29),
+		ANM(fmSoundEffect),
 		ANM(30),
 		ANM(pcmCommand),
 		ANM(setDrawFlags),
@@ -1074,9 +1071,9 @@ void Animator_SCD::makeAnimFunctions() {
 		ANM(38),
 		ANM(39),
 		ANM(40),
-		ANM(pcmSync),
+		ANM(speechSync),
 		ANM(42),
-		ANM(43),
+		ANM(toggleExtraPalette),
 		ANM(allowFrameDrop),
 		ANM(45),
 		ANM(46),
@@ -1092,10 +1089,6 @@ void Animator_SCD::makeAnimFunctions() {
 #undef ANM
 }
 
-uint16 animRand(uint16 a, uint16 b) {
-	return ((b * Util::rngMakeNumber()) >> 16) + a;
-}
-
 int Animator_SCD::anim_terminate(AnimObject &a, const uint8 *data) {
 	a.clear();
 	return -1;
@@ -1118,7 +1111,7 @@ int Animator_SCD::anim_seqSetFrame(AnimObject &a, const uint8 *data) {
 
 int Animator_SCD::anim_rndSeqSetFrame(AnimObject &a, const uint8 *data) {
 	if (a.frameSeqCounter == 0)
-		a.frameSeqCounter = animRand(2, (uint16)data[1] - data[0]) & 0xFF;
+		a.frameSeqCounter = Util::rngGetNumberFromRange(2, (uint16)data[1] - data[0]) & 0xFF;
 	if (a.frameSeqCounter == data[1]) {
 		a.frameSeqCounter = 0;
 		return 1;
@@ -1168,7 +1161,7 @@ int Animator_SCD::anim_palReset(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Animator_SCD::anim_copyCmds(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_drawCmds(AnimObject &a, const uint8 *data) {
 	ResourcePointer r = a.scriptData + READ_BE_INT16(data + 1);
 	return enqueueDrawCommands(r) ? 1 : -1;
 }
@@ -1252,7 +1245,9 @@ int Animator_SCD::anim_28(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Animator_SCD::anim_29(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_fmSoundEffect(AnimObject &a, const uint8 *data) {
+	if (!_snd->fmGetStatus().blocked)
+		_snd->fmSendCommand(*data, 0, 2);
 	return 1;
 }
 
@@ -1261,7 +1256,7 @@ int Animator_SCD::anim_30(AnimObject &a, const uint8 *data) {
 }
 
 int Animator_SCD::anim_pcmCommand(AnimObject &a, const uint8 *data) {
-	if (1/*!_byteUnkli*/ && !(_snd->pcmGetStatus() & 0x07))
+	if (!_snd->pcmGetStatus().blocked && !(_snd->pcmGetStatus().statusBits & 0x07))
 		_snd->pcmSendCommand(*data, -1);
 	return 1;
 }
@@ -1272,10 +1267,10 @@ int Animator_SCD::anim_setDrawFlags(AnimObject &a, const uint8 *data) {
 }
 
 int Animator_SCD::anim_34(AnimObject &a, const uint8 *data) {
-	a.f4f = 0;
+	a.freeze = 0;
 	if (_gfxState.getVar(8) == 0)
 		return 1;
-	a.f4f = 1;
+	a.freeze = 1;
 	return -1;
 }
 
@@ -1309,11 +1304,11 @@ int Animator_SCD::anim_40(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Animator_SCD::anim_pcmSync(AnimObject &a, const uint8 *data) {
-	a.f4f = 0;
-	if (_snd->pcmGetStatus() & 0x02)
+int Animator_SCD::anim_speechSync(AnimObject &a, const uint8 *data) {
+	a.freeze = 0;
+	if (_snd->pcmGetStatus().statusBits & 0x02)
 		return 1;
-	a.f4f = 1;
+	a.freeze = 1;
 	return -1;
 }
 
@@ -1322,7 +1317,8 @@ int Animator_SCD::anim_42(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Animator_SCD::anim_43(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_toggleExtraPalette(AnimObject &a, const uint8 *data) {
+	_gfxState.setVar(11, *data);
 	return 1;
 }
 
@@ -1349,7 +1345,7 @@ int Animator_SCD::anim_updateFrameDelay(AnimObject &a, const uint8 *data) {
 	if (*data++) {
 		uint16 v1 = *data++;
 		uint16 v2 = *data - v1;
-		a.frameDelay = animRand(v1, v2);
+		a.frameDelay = Util::rngGetNumberFromRange(v1, v2);
 	} else {
 		a.frameDelay = READ_BE_INT16(data);
 	}
@@ -1628,7 +1624,7 @@ int Animator_SCD::drawBootLogoFrame(uint8 *screen, int frameNo)  {
 	if (_bootsSprTbl)
 		_sr->loadToVRAM(_bootsSprTbl, 64 * sizeof(uint16), 0xBE00);
 
-	_pal->updateSystemPalette();
+	_pal->update();
 	_sr->setRenderColorTable(_pal->getSystemPalette(), 0, 64);
 	_sr->render(screen);
 
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 7e0826be1b8..e697392bb83 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -54,7 +54,7 @@ GraphicsEngine::~GraphicsEngine() {
 }
 
 void GraphicsEngine::runScript(ResourcePointer res, int func) {
-	ResourcePointer sc = res.makePtr(READ_BE_INT32(res() + 4)).getDataFromTable(func);
+	ResourcePointer sc = res.getDataFromTable(func);
 
 	for (uint8 cmd = *sc++; cmd != 0xFF; cmd = *sc++) {
 		uint8 len = *sc++;
@@ -71,7 +71,7 @@ void GraphicsEngine::runScript(ResourcePointer res, int func) {
 			_state.setVar(8, 1);
 			break;
 		case 2:
-			_animator->initAnimations(sc, len);
+			_animator->initAnimations(sc, len, true);
 			break;
 		case 3: 
 		case 4:
@@ -107,8 +107,8 @@ bool GraphicsEngine::enqueueDrawCommands(ResourcePointer res) {
 	return _animator->enqueueDrawCommands(res);
 }
 
-void GraphicsEngine::initAnimations(ResourcePointer res, uint16 len) {
-	_animator->initAnimations(res, len);
+void GraphicsEngine::initAnimations(ResourcePointer res, uint16 len, bool dontUpdate) {
+	_animator->initAnimations(res, len, dontUpdate);
 }
 
 void GraphicsEngine::setScrollStep(uint8 mode, int16 step) {
@@ -122,6 +122,10 @@ void GraphicsEngine::transitionCommand(uint8 cmd) {
 	_trs->doCommand(cmd);
 }
 
+bool GraphicsEngine::transitionStateBusy() const {
+	return _trs->scroll_getState().busy;
+}
+
 void GraphicsEngine::setTextFont(const uint8 *font, uint32 fontSize, const uint8 *charWidthTable, uint32 charWidthTableSize) {
 	_text->setFont(font, fontSize);
 	_text->setCharWidthTable(charWidthTable, charWidthTableSize);
@@ -148,6 +152,18 @@ void GraphicsEngine::resetTextFields() {
 	_text->reset();
 }
 
+void GraphicsEngine::clearJordanInputField() {
+	_animator->clearJordanInputField();
+}
+
+uint8 GraphicsEngine::getVerbAreaType() const {
+	return _verbAreaType;
+}
+
+bool GraphicsEngine::isVerbsTabActive() const {
+	return _trs->scroll_getState().verbsTabVisible;
+}
+
 void GraphicsEngine::updateAnimations() {
 	_animator->updateAnimations();
 }
@@ -159,7 +175,7 @@ void GraphicsEngine::updateText() {
 
 void GraphicsEngine::nextFrame() {
 	_palette->processEventQueue();
-	_palette->updateSystemPalette();
+	_palette->update();
 	_animator->updateScreen(_screen);
 
 	_system->copyRectToScreen(_screen, _animator->screenWidth() * _bpp, 0, 0, _animator->screenWidth(), _animator->screenHeight());
@@ -237,10 +253,6 @@ uint16 GraphicsEngine::frameCount() const {
 	return _state.frameCount();
 }
 
-uint8 GraphicsEngine::getVerbAreaType() const {
-	return _verbAreaType;
-}
-
 void GraphicsEngine::createMouseCursor(bool show) {
 	_animator->createMouseCursor();
 }
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 03bb90ecf6f..8282af77313 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -50,7 +50,7 @@ public:
 	void runScript(ResourcePointer res, int func);
 	void enqueuePaletteEvent(ResourcePointer res);
 	bool enqueueDrawCommands(ResourcePointer res);
-	void initAnimations(ResourcePointer res, uint16 len);
+	void initAnimations(ResourcePointer res, uint16 len, bool dontUpdate);
 
 	enum ScrollMode : uint8 {
 		kHorzA		= 0,
@@ -62,14 +62,17 @@ public:
 
 	void setScrollStep(uint8 mode, int16 step);
 	void transitionCommand(uint8 cmd);
+	bool transitionStateBusy() const;
 
 	void setTextFont(const uint8 *font, uint32 fontSize, const uint8 *charWidthTable, uint32 charWidthTableSize);
 	void printText(const uint8 *text);
 	void setTextPrintDelay(uint16 delay);
 	//void setTextColor(uint8 color);
 	bool isTextInQueue() const;
-
 	void resetTextFields();
+	void clearJordanInputField();
+	uint8 getVerbAreaType() const;
+	bool isVerbsTabActive() const;
 
 	void updateAnimations();
 	void updateText();
@@ -115,7 +118,7 @@ public:
 		kAnimParaAbsSpeedX,
 		kAnimParaAbsSpeedY,
 		kAnimParaScriptComFlags,
-		kAnimParaF4f
+		kAnimFreezeFlag
 	};
 
 	enum AnimFlags : int {
@@ -138,8 +141,6 @@ public:
 	bool busy(int type) const;
 	uint16 frameCount() const;
 
-	uint8 getVerbAreaType() const;
-
 	void createMouseCursor(bool show);
 
 	int displayBootLogoFrame(int frameNo);
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index cd6e5e10205..ac71e62ca7c 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS := \
 	metaengine.o \
 	palette_scd.o \
 	resource.o \
+	saveload.o \
 	scene/scene_d0.o \
 	scene/scene_d1.o \
 	scene/scene_d2.o \
@@ -16,6 +17,7 @@ MODULE_OBJS := \
 	staticres.o \
 	text_scd.o \
 	transition_scd.o \
+	ui.o \
 	util.o
 
 # This module can be built as a plugin
diff --git a/engines/snatcher/palette.h b/engines/snatcher/palette.h
index 7c5ea9a1bc7..98170abae8c 100644
--- a/engines/snatcher/palette.h
+++ b/engines/snatcher/palette.h
@@ -45,7 +45,7 @@ public:
 	virtual void processEventQueue() {}
 	virtual void clearEvents() {}
 	virtual void setDefaults(int mode) {}
-	virtual void updateSystemPalette() {}
+	virtual void update() {}
 	virtual void hINTCallback(void*) {}
 
 	virtual const uint8 *getSystemPalette() const { return nullptr; }
diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index 959e1352474..1ef30c49a05 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -46,7 +46,7 @@ public:
 	void processEventQueue() override;
 	void clearEvents() override;
 	void setDefaults(int mode) override;
-	void updateSystemPalette() override;
+	void update() override;
 	void hINTCallback(void *segaRenderer) override;
 	const uint8 *getSystemPalette() const override { return _sysPalette; }
 
@@ -57,6 +57,8 @@ public:
 	void adjustColor(int index, int8 r, int8 g, int8 b) override;
 
 private:
+	void updateSystemPalette();
+
 	typedef Common::Functor1Mem<PalEventSCD*, void, SCDPalette> EventProc;
 	Common::Array<EventProc*> _eventProcs;
 
@@ -88,12 +90,13 @@ private:
 
 	void setHINTHandler(uint8 num);
 
-	void hIntHandler_00(Graphics::SegaRenderer *sr);
+	void hIntHandler_characterChatPortraitPalette(Graphics::SegaRenderer *sr);
 	void hIntHandler_23(Graphics::SegaRenderer *sr);
+	int _transitionStep;
 };
 
 SCDPalette::SCDPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state) : Palette(pxf, pm, state), _eventProcs(),
-	_eventQueue(nullptr), _eventCurPos(nullptr), _colors(nullptr), _colors2(nullptr), _sysPalette(nullptr), _hINTHandler(nullptr) {
+	_eventQueue(nullptr), _eventCurPos(nullptr), _colors(nullptr), _colors2(nullptr), _sysPalette(nullptr), _hINTHandler(nullptr), _transitionStep(0) {
 
 #define P_OP(a)	_eventProcs.push_back(new EventProc(this, &SCDPalette::event_##a));
 	_eventProcs.push_back(nullptr);
@@ -110,7 +113,7 @@ SCDPalette::SCDPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, Gra
 #undef P_OP
 
 	_hINTProcs.resize(24);
-	_hINTProcs[0] = new HINTFunc(this, &SCDPalette::hIntHandler_00);
+	_hINTProcs[0] = new HINTFunc(this, &SCDPalette::hIntHandler_characterChatPortraitPalette);
 	_hINTProcs[23] = new HINTFunc(this, &SCDPalette::hIntHandler_23);
 
 	_eventQueue = _eventCurPos = new PalEventSCD[12];
@@ -251,18 +254,22 @@ void SCDPalette::adjustColor(int index, int8 r, int8 g, int8 b) {
 	_gfxState.setFlag(7, 0);
 }
 
-void SCDPalette::updateSystemPalette() {
+void SCDPalette::update() {
 	if (!_gfxState.getVar(7) && !_gfxState.getVar(11))
 		return;
 
 	if (_gfxState.getVar(11) == 0xFF) {
 		_gfxState.setFlag(7, 0);
 		_gfxState.setVar(11, 0);
-		// hint set
+	} else if (_gfxState.getVar(11)) {
+		setHINTHandler(0);;
 	}
 
-	if (_gfxState.testFlag(7, 0))
+	bool palChanged = false;
+	if (_gfxState.testFlag(7, 0) || _gfxState.getVar(11)) {
 		Common::copy<const uint16*, uint16*>(_colors, &_colors[64], _colors2);
+		palChanged = true;
+	}
 
 	if (_gfxState.testFlag(7, 1))
 		Common::copy<const uint16*, uint16*>(&_colors[64], &_colors[128], &_colors2[64]);
@@ -274,15 +281,29 @@ void SCDPalette::updateSystemPalette() {
 		Common::fill<uint16*, uint16>(_colors2, &_colors2[64], 0xEEE);
 		_gfxState.setFlag(7, 0);
 		_gfxState.clearFlag(7, 2);
+		palChanged = true;
 	}
 
-	const uint16 *src = &_colors2[0 << 6];
+	if (palChanged)
+		updateSystemPalette();
+}
+
+void SCDPalette::hINTCallback(void *segaRenderer) {
+	Graphics::SegaRenderer *sr = static_cast<Graphics::SegaRenderer*>(segaRenderer);
+	if (_gfxState.getVar(11) && _hINTHandler && _hINTHandler->isValid()) {
+		(*_hINTHandler)(sr);
+		updateSystemPalette();
+		sr->setRenderColorTable(_sysPalette, 0, 64);
+	}
+}
+
+void SCDPalette::updateSystemPalette() {
+	const uint16 *src = _colors2;
 	uint8 *dst = _sysPalette;
 
 	// R: bits 1, 2, 3   G: bits 5, 6, 7   B: bits 9, 10, 11
 	for (int i = 0; i < 64; ++i) {
 		uint16 in = *src++;
-		//_segaCurPalette[dstPalID << 4 | i] = in;
 #if 0
 		static const uint8 col[8] = { 0, 52, 87, 116, 144, 172, 206, 255 };
 		*dst++ = col[(in & 0x00F) >> 1];
@@ -299,13 +320,6 @@ void SCDPalette::updateSystemPalette() {
 		_palMan->setPalette(_sysPalette, 0, 256);
 }
 
-void SCDPalette::hINTCallback(void *segaRenderer) {
-	Graphics::SegaRenderer *sr = static_cast<Graphics::SegaRenderer *>(segaRenderer);
-
-
-	sr->setRenderColorTable(_sysPalette, 0, 64);
-}
-
 void SCDPalette::event_palSet(PalEventSCD *evt) {
 	if (updateDelay(evt))
 		return;
@@ -485,13 +499,18 @@ void SCDPalette::setHINTHandler(uint8 num) {
 		_hINTHandler = _hINTProcs[num];
 	 else
 		error("%s(): Invalid HINT handler %d", __FUNCTION__, num);
+	_transitionStep = 0;
 }
 
-void SCDPalette::hIntHandler_00(Graphics::SegaRenderer *segaRenderer) {
-	
+void SCDPalette::hIntHandler_characterChatPortraitPalette(Graphics::SegaRenderer *sr) {
+	if (_transitionStep++ != 136)
+		return;
+	Common::copy<const uint16*, uint16*>(&_colors2[80], &_colors2[128], &_colors2[16]);
+	sr->hINT_setCounter(255);
+	sr->hINT_enable(false);
 }
 
-void SCDPalette::hIntHandler_23(Graphics::SegaRenderer *segaRenderer) {
+void SCDPalette::hIntHandler_23(Graphics::SegaRenderer *sr) {
 	
 }
 
diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index 192070b1562..6a802bd0a72 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -65,6 +65,7 @@ uint8 *FIO::fileData(int index, uint32 *fileSize) {
 }
 
 uint8 *FIO::fileData(const Common::Path &file, uint32 *fileSize) {
+	debug("%s(): Loading file %s", __FUNCTION__, file.baseName().c_str());
 	Common::SeekableReadStream *s = readStream(file);
 
 	uint32 size = s ? s->size() : 0;
@@ -88,6 +89,7 @@ Common::SeekableReadStream *FIO::readStream(int index) {
 }
 
 Common::SeekableReadStream *FIO::readStream(const Common::Path &file) {
+	debug("%s(): Loading file %s", __FUNCTION__, file.baseName().c_str());
 	return _files.createReadStreamForMember(file);
 }
 
@@ -276,6 +278,10 @@ ResourcePointer SceneModule::getPtr(int offset) const {
 	return ResourcePointer(_data, offset);
 }
 
+ResourcePointer SceneModule::getGfxData() const {
+	return getPtr(READ_BE_UINT32(_data + 4));
+}
+
 void SceneModule::run(GameState &state) {
 	if (_updateHandler)
 		(*_updateHandler)(state);
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index b69408c0d60..0d044329486 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -55,7 +55,7 @@ struct Config {
 };
 
 struct GameState {
-	GameState() : frameNo(0), frameState(0), finish(0), modProcessTop(0), modProcessSub(0), counter(0), modIndex(0), menuSelect(0), prologue(0), chapter(0), conf(Config()) {}
+	GameState() : frameNo(0), frameState(0), finish(0), modProcessTop(0), modProcessSub(0), counter(0), modIndex(0), menuSelect(0), prologue(0), chapter(0), chapterSub(0), conf(Config()) {}
 	int16 frameNo;
 	int16 frameState;
 	int16 finish;
@@ -66,6 +66,7 @@ struct GameState {
 	int16 menuSelect;
 	int16 prologue;
 	int16 chapter;
+	int16 chapterSub;
 	Config conf;
 };
 
@@ -126,6 +127,7 @@ public:
 	~SceneModule();
 
 	ResourcePointer getPtr(int offset) const;
+	ResourcePointer getGfxData() const;
 
 	void run(GameState &state);
 
diff --git a/engines/snatcher/saveload.cpp b/engines/snatcher/saveload.cpp
new file mode 100644
index 00000000000..7163adc1a16
--- /dev/null
+++ b/engines/snatcher/saveload.cpp
@@ -0,0 +1,28 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#include "snatcher/saveload.h"
+
+
+namespace Snatcher {
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/saveload.h b/engines/snatcher/saveload.h
new file mode 100644
index 00000000000..87b13241541
--- /dev/null
+++ b/engines/snatcher/saveload.h
@@ -0,0 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#ifndef SNATCHER_SAVELOAD_H
+#define SNATCHER_SAVELOAD_H
+
+
+namespace Snatcher {
+
+
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_SAVELOAD_H
diff --git a/engines/snatcher/scene/scene_d0.cpp b/engines/snatcher/scene/scene_d0.cpp
index cb49fe00972..68ccda62a31 100644
--- a/engines/snatcher/scene/scene_d0.cpp
+++ b/engines/snatcher/scene/scene_d0.cpp
@@ -140,11 +140,11 @@ SH_IMPL_UPDT(D0) {
 
 SH_IMPL_FRM(D0, 00) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 0);
+	_vm->gfx()->runScript(_module->getGfxData(), 0);
 }
 
 SH_IMPL_FRM(D0, 01) {
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2A4A));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2AA4A));
 }
 
 SH_IMPL_FRM(D0, 02) {
@@ -165,87 +165,87 @@ SH_IMPL_FRM(D0, 04) {
 
 SH_IMPL_FRM(D0, 05) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 1);
+	_vm->gfx()->runScript(_module->getGfxData(), 1);
 }
 
 SH_IMPL_FRM(D0, 07) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 2);
+	_vm->gfx()->runScript(_module->getGfxData(), 2);
 }
 
 SH_IMPL_FRM(D0, 08) {
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2A66));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2AA66));
 }
 
 SH_IMPL_FRM(D0, 09) {
 	_vm->gfx()->setVar(9, 0xFF);
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 3);
+	_vm->gfx()->runScript(_module->getGfxData(), 3);
 }
 
 SH_IMPL_FRM(D0, 10) {
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2A58));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2AA58));
 }
 
 SH_IMPL_FRM(D0, 11) {
 	_vm->gfx()->setVar(9, 1);
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 4);
+	_vm->gfx()->runScript(_module->getGfxData(), 4);
 }
 
 SH_IMPL_FRM(D0, 12) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 5);
+	_vm->gfx()->runScript(_module->getGfxData(), 5);
 }
 
 SH_IMPL_FRM(D0, 14) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 6);
+	_vm->gfx()->runScript(_module->getGfxData(), 6);
 }
 
 SH_IMPL_FRM(D0, 16) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 7);
+	_vm->gfx()->runScript(_module->getGfxData(), 7);
 }
 
 SH_IMPL_FRM(D0, 18) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 8);
+	_vm->gfx()->runScript(_module->getGfxData(), 8);
 }
 
 SH_IMPL_FRM(D0, 20) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 9);
+	_vm->gfx()->runScript(_module->getGfxData(), 9);
 }
 
 SH_IMPL_FRM(D0, 22) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 10);
+	_vm->gfx()->runScript(_module->getGfxData(), 10);
 }
 
 SH_IMPL_FRM(D0, 24) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 11);
+	_vm->gfx()->runScript(_module->getGfxData(), 11);
 }
 
 SH_IMPL_FRM(D0, 26) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 12);
+	_vm->gfx()->runScript(_module->getGfxData(), 12);
 }
 
 SH_IMPL_FRM(D0, 28) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 13);
+	_vm->gfx()->runScript(_module->getGfxData(), 13);
 }
 
 SH_IMPL_FRM(D0, 30) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 14);
+	_vm->gfx()->runScript(_module->getGfxData(), 14);
 }
 
 SH_IMPL_FRM(D0, 31) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 15);
+	_vm->gfx()->runScript(_module->getGfxData(), 15);
 }
 
 SH_IMPL_FRM(D0, 32) {
diff --git a/engines/snatcher/scene/scene_d1.cpp b/engines/snatcher/scene/scene_d1.cpp
index fd7af40d676..f44745f61d4 100644
--- a/engines/snatcher/scene/scene_d1.cpp
+++ b/engines/snatcher/scene/scene_d1.cpp
@@ -130,21 +130,21 @@ SH_IMPL_UPDT(D1) {
 
 SH_IMPL_FRM(D1, 00) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 0);
+	_vm->gfx()->runScript(_module->getGfxData(), 0);
 }
 
 SH_IMPL_FRM(D1, 01) {
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x142C));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2942C));
 }
 
 SH_IMPL_FRM(D1, 02) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 1);
+	_vm->gfx()->runScript(_module->getGfxData(), 1);
 }
 
 SH_IMPL_FRM(D1, 04) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 2);
+	_vm->gfx()->runScript(_module->getGfxData(), 2);
 	_vm->gfx()->setScrollStep(GraphicsEngine::kVertA | GraphicsEngine::kSingleStep, 0x110);
 	_vm->gfx()->transitionCommand(1);
 }
@@ -171,51 +171,51 @@ SH_IMPL_FRM(D1, 09) {
 
 SH_IMPL_FRM(D1, 11) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 3);
+	_vm->gfx()->runScript(_module->getGfxData(), 3);
 }
 
 SH_IMPL_FRM(D1, 13) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 4);
+	_vm->gfx()->runScript(_module->getGfxData(), 4);
 }
 
 SH_IMPL_FRM(D1, 15) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 5);
+	_vm->gfx()->runScript(_module->getGfxData(), 5);
 }
 
 SH_IMPL_FRM(D1, 17) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 6);
+	_vm->gfx()->runScript(_module->getGfxData(), 6);
 }
 
 SH_IMPL_FRM(D1, 19) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 7);
+	_vm->gfx()->runScript(_module->getGfxData(), 7);
 }
 
 SH_IMPL_FRM(D1, 21) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 8);
+	_vm->gfx()->runScript(_module->getGfxData(), 8);
 }
 
 SH_IMPL_FRM(D1, 22) {
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x143A));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2943A));
 }
 
 SH_IMPL_FRM(D1, 23) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 9);
+	_vm->gfx()->runScript(_module->getGfxData(), 9);
 }
 
 SH_IMPL_FRM(D1, 25) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 10);
+	_vm->gfx()->runScript(_module->getGfxData(), 10);
 }
 
 SH_IMPL_FRM(D1, 27) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-	_vm->gfx()->runScript(_module->getPtr(0), 11);
+	_vm->gfx()->runScript(_module->getGfxData(), 11);
 }
 
 SH_IMPL_FRM(D1, 28) {
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene/scene_d2.cpp
index cca82d3e69a..0980bd7e6ee 100644
--- a/engines/snatcher/scene/scene_d2.cpp
+++ b/engines/snatcher/scene/scene_d2.cpp
@@ -87,7 +87,6 @@ SH_IMPL_UPDT(D2) {
 
 int _hasSaveSlotFlag = 15;
 int _saveFileCurID = 0;
-uint8 _bua3 = 0;
 uint8 _buram_0 = 0;
 bool _buram_2 = true;
 
@@ -107,7 +106,7 @@ SH_IMPL_FRM(D2, 00) {
 			state.frameState = 0;
 		} else {
 			_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-			_vm->gfx()->runScript(_module->getPtr(0), 1); // RAM Cart select screen
+			_vm->gfx()->runScript(_module->getGfxData(), 1); // RAM Cart select screen
 			++state.frameState;
 		}
 		break;
@@ -118,7 +117,7 @@ SH_IMPL_FRM(D2, 00) {
 		}
 		if (_vm->input().controllerFlags & 0x80) {
 			state.counter = 10;
-			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x290F2));
 			++state.frameState;
 		}
 		break;
@@ -147,7 +146,7 @@ SH_IMPL_FRM(D2, 02) {
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 	_vm->gfx()->transitionCommand(1);
 	_vm->gfx()->setScrollStep(GraphicsEngine::kVertA | GraphicsEngine::kSingleStep, 0x100);
-	_vm->gfx()->runScript(_module->getPtr(0), 0);
+	_vm->gfx()->runScript(_module->getGfxData(), 0);
 	state.counter = 24;
 	++state.frameNo;
 	state.frameState = 0;
@@ -165,7 +164,7 @@ SH_IMPL_FRM(D2, 03) {
 SH_IMPL_FRM(D2, 04) {
 	if (--state.counter)
 		return;
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x08E6));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x288E6));
 	state.counter = 86;
 	++state.frameNo;
 	state.frameState = 0;
@@ -185,7 +184,7 @@ SH_IMPL_FRM(D2, 06) {
 			++state.frameNo;
 			state.frameState = 0;
 		} else {
-			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x0944));
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x28944));
 			++state.frameState;
 			state.counter = 17;
 		}
@@ -194,7 +193,7 @@ SH_IMPL_FRM(D2, 06) {
 		if (--state.counter)
 			return;
 		_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-		_vm->gfx()->runScript(_module->getPtr(0), 2);
+		_vm->gfx()->runScript(_module->getGfxData(), 2);
 		++state.frameState;
 		break;
 	default:
@@ -230,7 +229,7 @@ SH_IMPL_FRM(D2, 08) {
 			++state.frameNo;
 			state.frameState = 0;
 		} else {
-			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x0944));
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x28944));
 			state.counter = 17;
 			++state.frameState;
 		}
@@ -239,12 +238,10 @@ SH_IMPL_FRM(D2, 08) {
 		if (--state.counter)
 			return;
 		_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-		_vm->gfx()->runScript(_module->getPtr(0), 3);
+		_vm->gfx()->runScript(_module->getGfxData(), 3);
 		++state.frameState;
 		break;
 	default:
-		//if (_vm->_commandsFromMain & 0x80)
-		/**/
 		break;
 	}
 }
@@ -281,8 +278,7 @@ SH_IMPL_FRM(D2, 09) {
 	if (fin) {
 		++state.frameNo;
 		state.frameState = 0;
-		_bua3 = 56;
-		_vm->sound()->fmSendCommand(56, 0);
+		_vm->sound()->fmSendCommand(56, 0, 2);
 		_vm->gfx()->setAnimParameter(16, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 		_vm->gfx()->setAnimParameter(17, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 		_option = 0;
@@ -318,8 +314,7 @@ SH_IMPL_FRM(D2, 10) {
 		_vm->gfx()->setAnimParameter(25, GraphicsEngine::kAnimParaFrame, _saveFileCurID << 2);
 
 		if (_vm->input().controllerFlags & 0x80) {
-			_bua3 = 56;
-			_vm->sound()->fmSendCommand(56, 0);
+			_vm->sound()->fmSendCommand(56, 0, 2);
 			_loadCancelled = false;
 			fin = true;
 		} else if (_vm->input().controllerFlags & 0x10) {
@@ -434,7 +429,7 @@ SH_IMPL_FRM(D2, 11) {
 		if (--state.counter)
 			return;
 		_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-		_vm->gfx()->runScript(_module->getPtr(0), 7);
+		_vm->gfx()->runScript(_module->getGfxData(), 7);
 		_vm->gfx()->createMouseCursor(true);
 		++state.frameState;
 		break;
@@ -454,7 +449,7 @@ SH_IMPL_FRM(D2, 11) {
 		break;
 	case 3:
 		if (_vm->input().controllerFlags & 0x80) {
-			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x290F2));
 			state.counter = 10;
 			++state.frameState;
 			_vm->allowLightGunInput(false);
@@ -494,7 +489,7 @@ SH_IMPL_FRM(D2, 11) {
 				_vm->gfx()->setAnimParameter(19, GraphicsEngine::kAnimParaAbsSpeedX, 0);
 				_vm->allowLightGunInput(false);
 				state.counter += 2;
-				_vm->sound()->fmSendCommand(29, 0);
+				_vm->sound()->fmSendCommand(29, 0, 2);
 			} else if (_vm->input().controllerFlags & 0x100) {
 				_vm->sound()->pcmSendCommand(57, -1);
 				state.counter++;
@@ -509,7 +504,7 @@ SH_IMPL_FRM(D2, 11) {
 			if (++_counter2 < 180)
 				return;
 			state.counter = 10;
-			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x10F2));
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x290F2));
 			++state.frameState;
 			break;
 		default:
@@ -520,7 +515,7 @@ SH_IMPL_FRM(D2, 11) {
 		if (--state.counter)
 			return;
 		_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
-		_vm->gfx()->runScript(_module->getPtr(0), 8);
+		_vm->gfx()->runScript(_module->getGfxData(), 8);
 		state.frameState = 0;
 		break;
 	default:
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index fae4818e477..9268789163a 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -26,22 +26,20 @@
 #include "snatcher/script.h"
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
+#include "snatcher/ui.h"
+#include "snatcher/util.h"
 
 
 namespace Snatcher {
 
-CmdQueue::CmdQueue(SnatcherEngine *vm) : _vm(vm), _data(nullptr), _readPos(0), _writePos(nullptr), _enable(false), _progress(-1), _currentOpcode(0), _sceneId(0),
-	_textLineBreak(0), _counter(0), _opcodes(), _textBuffer(nullptr), _textColor(0), /*_makestrbt1(0),*/ _textY(0), _textY2(0), _sceneTextOffsCur(0), _textLineEnd(0),
-		_sceneInfo(0), _sceneTextOffset(0), _sceneTextOffsStart(0), _waitCursorFrame(0), _waitCursorAnimDelay(0) {
+CmdQueue::CmdQueue(SnatcherEngine *vm) : _vm(vm), _data(nullptr), _readPos(0), _writePos(nullptr), _enable(false), _progress(-1), _currentOpcode(0),  _counter(0), _opcodes() {
 	_data = new uint16[256]();
-	_textBuffer = new uint8[0x100]();
 	makeFunctions();
 	reset();
 }
 
 CmdQueue::~CmdQueue() {
 	delete[] _data;
-	delete[] _textBuffer;
 	for (Common::Array<CmdQueOpcode*>::iterator i = _opcodes.begin(); i != _opcodes.end(); ++ i)
 		delete *i;
 }
@@ -62,7 +60,7 @@ void CmdQueue::writeUInt32(uint32 val) {
 	_writePos += 2;
 }
 
-void CmdQueue::run(GameState &state) {
+void CmdQueue::run() {
 	if (!_enable)
 		return;
 
@@ -73,7 +71,7 @@ void CmdQueue::run(GameState &state) {
 		}
 
 		if (_currentOpcode < _opcodes.size() && _opcodes[_currentOpcode]->isValid())
-			(*_opcodes[_currentOpcode])(state, _readPos);
+			(*_opcodes[_currentOpcode])(_readPos);
 		else
 			error("%s(): Invalid opcode %d", __FUNCTION__, _currentOpcode);
 	} while (_currentOpcode != 0 && _progress == -1);
@@ -81,7 +79,7 @@ void CmdQueue::run(GameState &state) {
 
 void CmdQueue::makeFunctions() {
 #define OP(x) &CmdQueue::m_##x
-	typedef void (CmdQueue::*SFunc)(GameState &state, const uint16*&);
+	typedef void (CmdQueue::*SFunc)(const uint16*&);
 	static const SFunc funcTbl[] = {
 		OP(end),
 		OP(initAnimations),
@@ -95,8 +93,8 @@ void CmdQueue::makeFunctions() {
 		OP(animOps),
 		OP(pcmWait),
 		OP(11),
-		OP(12),
-		OP(mmSeq),
+		OP(pcmSound),
+		OP(chatWithPortraitAnim),
 		OP(14),
 		OP(gfxReset),
 		OP(waitFrames),
@@ -104,21 +102,21 @@ void CmdQueue::makeFunctions() {
 		OP(gfxStart),
 		OP(fmMusicWait),
 		OP(20),
-		OP(21),
+		OP(invItemCloseUp),
 		OP(resetTextFields),
 		OP(23),
 		OP(24),
 		OP(25),
 		OP(26),
 		OP(27),
-		OP(28),
-		OP(29),
+		OP(fmSoundEffect),
+		OP(pcmBlock),
 		OP(30),
 		OP(31),
 		OP(32),
 		OP(33),
 		OP(palOps),
-		OP(35)
+		OP(clearJordanInputField)
 	};
 #undef OP
 
@@ -126,11 +124,11 @@ void CmdQueue::makeFunctions() {
 		_opcodes.push_back(new CmdQueOpcode(this, funcTbl[i]));
 }
 
-void CmdQueue::m_end(GameState &state, const uint16 *&data) {
+void CmdQueue::m_end(const uint16 *&data) {
 	reset();
 }
 
-void CmdQueue::m_initAnimations(GameState &state, const uint16 *&data) {
+void CmdQueue::m_initAnimations(const uint16 *&data) {
 	uint32 addr = *reinterpret_cast<const uint32*>(data);
 	data += 2;
 	ResourcePointer in = (addr >= 0x28000 ? _vm->_module->getPtr(addr) : _vm->_scd->makePtr(addr));
@@ -149,24 +147,26 @@ void CmdQueue::m_initAnimations(GameState &state, const uint16 *&data) {
 		return;
 	}
 
-	_vm->gfx()->initAnimations(in, len);
+	_vm->gfx()->initAnimations(in, len, false);
 	_progress = -1;
 }
 
-void CmdQueue::m_02(GameState &state, const uint16 *&data) {
+void CmdQueue::m_02(const uint16 *&data) {
 }
 
-void CmdQueue::m_drawCommands(GameState &state, const uint16 *&data) {
+void CmdQueue::m_drawCommands(const uint16 *&data) {
 	uint32 addr = *reinterpret_cast<const uint32*>(data);
 	data += 2;
 	_vm->gfx()->enqueueDrawCommands(addr >= 0x28000 ? _vm->_module->getPtr(addr) : _vm->_scd->makePtr(addr));
 	_progress = -1;
 }
 
-void CmdQueue::m_04(GameState &state, const uint16 *&data) {
+void CmdQueue::m_04(const uint16 *&data) {
+	_vm->sound()->fmBlock(true);
+	_progress = -1;
 }
 
-void CmdQueue::m_printText(GameState &state, const uint16 *&data) {
+void CmdQueue::m_printText(const uint16 *&data) {
 	if (_vm->gfx()->isTextInQueue())
 		return;
 	uint32 addr = *reinterpret_cast<const uint32*>(data);
@@ -175,132 +175,23 @@ void CmdQueue::m_printText(GameState &state, const uint16 *&data) {
 	_progress = -1;
 }
 
-void CmdQueue::m_06(GameState &state, const uint16 *&data) {
+void CmdQueue::m_06(const uint16 *&data) {
 }
 
-void CmdQueue::m_fmMusicStart(GameState &state, const uint16 *&data) {
+void CmdQueue::m_fmMusicStart(const uint16 *&data) {
 	uint8 cmd = *data++;
-	_vm->sound()->fmSendCommand(cmd, 1);
-	_vm->sound()->_fmPlayingTracks.music = (cmd == 0xFF) ? 0 : cmd;
+	_vm->sound()->fmSendCommand(cmd, 1, 1);
 	_progress = -1;
 }
 
-int _gfxOps_var1 = 0;
-uint8  _gfxOps10_sub_974B = 0;
-uint8 _gfxOps10_sub_974E = 0;
-uint16 _gfxOps10_subword_974C = 0;
-
-//uint8 _c13Valu = 0;
-
-void CmdQueue::m_displayDialog(GameState &state, const uint16 *&data) {
-	if (_gfxOps_var1 || (_vm->input().controllerFlags & 0x100))
-		_vm->gfx()->setTextPrintDelay(0);
-
-	if (_vm->gfx()->isTextInQueue())
-		return;
-
-	switch (_progress) {
-	case 0:
-		for (int i = 5; i < 15; ++i)
-			_vm->gfx()->setAnimParameter(i, GraphicsEngine::kAnimParaEnable, 0);
-		_vm->gfx()->setAnimParameter(0, GraphicsEngine::kAnimParaEnable, 0);
-		_vm->gfx()->enqueuePaletteEvent(_vm->_scd->makePtr(0x13622));
-		++_progress;
-		break;
-
-	case 1:
-		_vm->gfx()->setVar(11, 0xFF);
-		_progress = 9;
-		break;
-
-	case 2:
-		if (_sceneId == 0) {
-			_vm->gfx()->transitionCommand(21);
-			//_c13Valu = 0xFF;
-			_textY = _textY2;
-		} else if (_sceneId == 0xFF) {
-			_textY = _textY2;
-		} else {
-			printSceneEntryStringHead();
-		}
-		++_progress;
-		break;
-
-	case 3:
-		printSceneEntryStringBody(state);
-		if (checkStringProgress())
-			++_progress;
-		break;
-
-	case 4:
-		_waitCursorFrame = 0;
-		_waitCursorAnimDelay = 1;
-		if (!_sceneId)
-			_vm->gfx()->setAnimParameter(31, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide);
-		++_progress;
-		break;
-
-	case 5:
-		if (!waitWithCursorAnim())
-			return;
-		_vm->gfx()->transitionCommand(0xFE);
-		if (_textLineEnd) {
-			_progress = 6;
-			if (!_sceneId)
-				_vm->gfx()->setAnimParameter(31, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
-		} else {
-			_progress = 7;
-		}
-		break;
-
-	case 6:
-		_sceneTextOffset = _sceneInfo = 0;
-		//if (!_sceneId)
-		//	_c13Valu = 0xFF;
+void CmdQueue::m_displayDialog(const uint16 *&data) {
+	if (_vm->_ui->displayDialog(data[0], data[1], _vm->input().controllerFlagsRemapped)) {
 		_progress = -1;
-		break;
-
-	case 7:
-		_vm->gfx()->resetTextFields();
-		++_progress;
-		break;
-
-	case 8:
-		_vm->gfx()->transitionCommand(_vm->gfx()->getVerbAreaType() == 0 ? 15 : (_vm->gfx()->getVerbAreaType() == 1 ? 20 : 22));
-		_progress = 2;
-		break;
-
-	case 9:
-		_sceneInfo = *data++;
-		_sceneTextOffset = *data++;
-		_vm->gfx()->enqueueDrawCommands(_vm->_scd->makePtr(0xECB6));
-		++_progress;
-		break;
-
-	case 10:
-		_sceneTextOffsStart = _sceneTextOffset;
-		_vm->gfx()->resetTextFields();
-		_sceneId = (_sceneInfo & 0xFF) - 1;
-
-		_sceneTextOffsCur = _sceneTextOffsStart;
-		_textLineEnd = 0;
-		_gfxOps10_sub_974B = _gfxOps10_sub_974E = 0;
-		_gfxOps10_subword_974C = 0;
-
-		_textColor = 1;
-
-		_vm->gfx()->transitionCommand(_vm->gfx()->getVerbAreaType() == 0 ? 15 : (_vm->gfx()->getVerbAreaType() == 1 ? 20 : 22));
-		//_c13Valu = 0;
-		_progress = 2;
-		break;
-
-	default:
-		error("%s(): Unknown state %d", __FUNCTION__, _progress);
-		break;
+		data += 2;
 	}
 }
 
-void CmdQueue::m_animOps(GameState &state, const uint16 *&data) {
+void CmdQueue::m_animOps(const uint16 *&data) {
 	switch (data[0]) {
 	case 0:
 	case 1:
@@ -327,22 +218,25 @@ void CmdQueue::m_animOps(GameState &state, const uint16 *&data) {
 	_progress = -1;
 }
 
-void CmdQueue::m_pcmWait(GameState &state, const uint16 *&data) {
+void CmdQueue::m_pcmWait(const uint16 *&data) {
 	if (_progress == 0) {
 		_counter = 3600;
 		++_progress;
 	}
-	if (--_counter == 0 || !(_vm->sound()->pcmGetStatus() & 0x0F)) 
+	if (--_counter == 0 || !(_vm->sound()->pcmGetStatus().statusBits & 0x0F)) 
 		_progress = -1;
 }
 
-void CmdQueue::m_11(GameState &state, const uint16 *&data) {
+void CmdQueue::m_11(const uint16 *&data) {
 }
 
-void CmdQueue::m_12(GameState &state, const uint16 *&data) {
+void CmdQueue::m_pcmSound(const uint16 *&data) {
+	if (!_vm->sound()->pcmGetStatus().blocked && !(_vm->sound()->pcmGetStatus().statusBits & 0x07))
+		_vm->sound()->pcmSendCommand(*data++, -1);
+	_progress = -1;
 }
 
-void CmdQueue::m_mmSeq(GameState &state, const uint16 *&data) {
+void CmdQueue::m_chatWithPortraitAnim(const uint16 *&data) {
 	if (_progress == 0) {
 		_vm->sound()->pcmInitSound(*data);
 		//_c13Valu = 0xFF;
@@ -363,7 +257,7 @@ void CmdQueue::m_mmSeq(GameState &state, const uint16 *&data) {
 		uint8 f = _vm->_scd->makePtr(0x13FEC)[*data];
 		if (f != 0xFF) {
 			//_vm->gfx()->dataMode = 1;
-			_vm->gfx()->runScript(_vm->_module->getPtr(0), f);
+			_vm->gfx()->runScript(_vm->_module->getGfxData(), f);
 			//_vm->gfx()->dataMode = 0;
 		}
 		_progress = -1;
@@ -372,10 +266,10 @@ void CmdQueue::m_mmSeq(GameState &state, const uint16 *&data) {
 		++data;
 }
 
-void CmdQueue::m_14(GameState &state, const uint16 *&data) {
+void CmdQueue::m_14(const uint16 *&data) {
 }
 
-void CmdQueue::m_gfxReset(GameState &state, const uint16 *&data) {
+void CmdQueue::m_gfxReset(const uint16 *&data) {
 	if (_progress == 0) {
 		if (!_vm->gfx()->busy(2)) {
 			_vm->gfx()->reset(GraphicsEngine::kResetSetDefaults);
@@ -388,7 +282,7 @@ void CmdQueue::m_gfxReset(GameState &state, const uint16 *&data) {
 	}
 }
 
-void CmdQueue::m_waitFrames(GameState &state, const uint16 *&data) {
+void CmdQueue::m_waitFrames(const uint16 *&data) {
 	if (_progress == 0) {
 		_counter = 0;
 		++_progress;
@@ -400,7 +294,7 @@ void CmdQueue::m_waitFrames(GameState &state, const uint16 *&data) {
 	_progress = -1;
 	++data;
 }
-void CmdQueue::m_loadResource(GameState &state, const uint16 *&data) {
+void CmdQueue::m_loadResource(const uint16 *&data) {
 	if (_progress == 0) {
 		_vm->sound()->cdaStop();
 		++_progress;
@@ -411,10 +305,11 @@ void CmdQueue::m_loadResource(GameState &state, const uint16 *&data) {
 		++_progress;
 
 		if (dest == 0x1A800) {
+			delete[] _vm->_script->data;
 			_vm->_script->data = _vm->_fio->fileData(index, &_vm->_script->dataSize);
 			assert(_vm->_script->data);
-			_vm->_script->res = ResourcePointer(_vm->_script->data, 0, 0x1A800, true);
 			_vm->_script->curFileNo = index;
+			_vm->_ui->setScriptTextResource(_vm->_script->getTextResource());
 		} else if (dest == 0x28000) {
 			delete _vm->_module;
 			_vm->_module = _vm->_fio->loadModule(index);
@@ -429,235 +324,134 @@ void CmdQueue::m_loadResource(GameState &state, const uint16 *&data) {
 	}
 }
 
-void CmdQueue::m_gfxStart(GameState &state, const uint16 *&data) {
-	_vm->gfx()->runScript(_vm->_module->getPtr(0), *data++);
+void CmdQueue::m_gfxStart(const uint16 *&data) {
+	_vm->gfx()->runScript(_vm->_module->getGfxData(), *data++);
 	_progress = -1;
 }
 
-void CmdQueue::m_fmMusicWait(GameState &state, const uint16 *&data) {
+void CmdQueue::m_fmMusicWait(const uint16 *&data) {
 	if (_progress == 0) {
 		_counter = 2700;
 		++_progress;
 	}
-	if (--_counter == 0 || (_vm->sound()->_fmPlayingTracks.music == 0)) 
+	if (--_counter == 0 || (_vm->sound()->fmGetStatus().music == 0)) 
 		_progress = -1;
 }
 
-void CmdQueue::m_20(GameState &state, const uint16 *&data) {
+void CmdQueue::m_20(const uint16 *&data) {
 }
 
-void CmdQueue::m_21(GameState &state, const uint16 *&data) {
+void CmdQueue::m_invItemCloseUp(const uint16 *&data) {
+	if (_vm->gfx()->getVar(8))
+		return;
+
+	_vm->gfx()->runScript(_vm->_scd->makePtr(0x146CE), *data++);
+	ResourcePointer coords = _vm->_scd->makePtr(0x144C6) + ((*data++) << 2);
+	_vm->gfx()->setAnimParameter(1, GraphicsEngine::kAnimParaPosX, coords.readIncrSINT16());
+	_vm->gfx()->setAnimParameter(1, GraphicsEngine::kAnimParaPosY, coords.readIncrSINT16());
+
+	_progress = -1;
 }
 
-void CmdQueue::m_resetTextFields(GameState &state, const uint16 *&data) {
+void CmdQueue::m_resetTextFields(const uint16 *&data) {
 	_vm->gfx()->resetTextFields();
 	_progress = -1;
 }
 
-void CmdQueue::m_23(GameState &state, const uint16 *&data) {
+void CmdQueue::m_23(const uint16 *&data) {
 }
 
-void CmdQueue::m_24(GameState &state, const uint16 *&data) {
+void CmdQueue::m_24(const uint16 *&data) {
+//shooting practice
 }
 
-void CmdQueue::m_25(GameState &state, const uint16 *&data) {
+void CmdQueue::m_25(const uint16 *&data) {
 }
 
-void CmdQueue::m_26(GameState &state, const uint16 *&data) {
+void CmdQueue::m_26(const uint16 *&data) {
 }
 
-void CmdQueue::m_27(GameState &state, const uint16 *&data) {
+void CmdQueue::m_27(const uint16 *&data) {
 }
 
-void CmdQueue::m_28(GameState &state, const uint16 *&data) {
+void CmdQueue::m_fmSoundEffect(const uint16 *&data) {
+	uint8 cmd = *data++;
+	_vm->sound()->fmSendCommand(cmd, 0, 2);
+	_progress = -1;
 }
 
-void CmdQueue::m_29(GameState &state, const uint16 *&data) {
+void CmdQueue::m_pcmBlock(const uint16 *&data) {
+	_vm->sound()->pcmBlock(*data++);
+	_progress = -1;
 }
 
-void CmdQueue::m_30(GameState &state, const uint16 *&data) {
+void CmdQueue::m_30(const uint16 *&data) {
 }
 
-void CmdQueue::m_31(GameState &state, const uint16 *&data) {
+void CmdQueue::m_31(const uint16 *&data) {
 }
 
-void CmdQueue::m_32(GameState &state, const uint16 *&data) {
+void CmdQueue::m_32(const uint16 *&data) {
 }
 
-void CmdQueue::m_33(GameState &state, const uint16 *&data) {
+void CmdQueue::m_33(const uint16 *&data) {
 }
 
-void CmdQueue::m_palOps(GameState &state, const uint16 *&data) {
+void CmdQueue::m_palOps(const uint16 *&data) {
 	uint32 addr = *reinterpret_cast<const uint32*>(data);
 	_vm->gfx()->enqueuePaletteEvent(addr >= 0x28000 ? _vm->_module->getPtr(addr) : _vm->_scd->makePtr(addr));
 	data += 2;
 	_progress = -1;
 }
 
-void CmdQueue::m_35(GameState &state, const uint16 *&data) {
-}
-
-void CmdQueue::printSceneEntryStringHead() {
-	static const uint8 strHead[] = { 0xFC, 0x00, 0xF9, 0x01, 0xFB, 0x10, 0x00, 0xFE };
-	const uint8 *s = _vm->_scd->makePtr(0x13552).getDataFromTable(_sceneId)();
-	memcpy(_textBuffer, strHead, sizeof(strHead));
-	_textBuffer[6] = _textY2;
-	_textBuffer[8] = (*s & 0x80) ? 3 : (*s++ & 7);
-	uint8 *d = _textBuffer + 9;
-
-	for (int i = 0; i < 25; ++i) {
-		*d++ = *s;
-		if (*s++ == 0xFF)
-			break;
-	}
-
-	assert(*(d - 1) == 0xFF);
-
-	_vm->gfx()->printText(_textBuffer);
-	_textY = _textY2 + 9;
-}
-
-void CmdQueue::printSceneEntryStringBody(GameState &state) {
-	static const uint8 strHead[] = { 0xFC, 0x01, 0xF9, 0x01, 0xFE, 0x00, 0xFB };
-	static const uint8 buttonTable[3][6] = {
-		{ 'A', 'A', 'B', 'C', 'C', 'B' },
-		{ 'B', 'C', 'A', 'A', 'B', 'C' },
-		{ 'C', 'B', 'C', 'B', 'A', 'A' }
-	};
-
-	memcpy(_textBuffer, strHead, sizeof(strHead));
-	_textBuffer[5] = _textColor;
-	uint8 *d = _textBuffer + sizeof(strHead);
-	//_makestrbt1 = 0xFF;
-	*d++ = _sceneId ? 24 : 40;
-	*d++ = _textY;
-
-	_textLineBreak = 0;
-	const uint8 *s = _vm->_script->res.makePtr(0x1E000)() + _sceneTextOffsCur;
-	for (int i = 0; i < 50;++i) {
-		uint8 in = *s++;
-		++_sceneTextOffsCur;
-		switch (in) {
-		case 0xFF:
-			_textLineEnd = 1;
-			i = 49;
-			break;
-		case 0xF6:
-			_textLineBreak = 3;
-			i = 49;
-			break;;
-		case 0xF4:
-			_sceneInfo = 2;
-			break;
-		case 0xF2:
-			_textLineBreak = 1;
-			i = 49;
-			break;
-		case 0xF0:
-		case 0xEE:
-		case 0xEC:
-			*d++ = buttonTable[(in - 0xEC) >> 1][state.conf.controllerSetup];
-			break;
-		default:
-			if (in < 0xF8) {
-				*d++ = in;
-			} else {
-				*d++ = 0xFE;
-				*d++ = _textColor = in & 7;
-			}
-			break;
-		}
-	}
-
-	*d++ = 0xFF;
-	_vm->gfx()->printText(_textBuffer);
-}
-
-bool CmdQueue::checkStringProgress() {
-	if (_textLineEnd || _textLineBreak == 3)
-		return true;
-	_textY += 9;
-	return (_textY > 56);
-}
-
-bool CmdQueue::waitWithCursorAnim() {
-	if (_vm->input().controllerFlagsRemapped & 0x20)
-		return true;
-	if ((_waitCursorAnimDelay && --_waitCursorAnimDelay) || _sceneId == 0)
-		return false;
-	const uint8 *s = _vm->_scd->makePtr(0x1391C)() + _waitCursorFrame;
-
-	ResourcePointer drw = _vm->_scd->makePtr(_vm->gfx()->getVerbAreaType() == 0 ? 0x1387C : (_vm->gfx()->getVerbAreaType() == 1 ? 0x13894 : 0x138AC));
-
-	uint32 frm = 0x138C4 + _waitCursorFrame * 4;
-	(drw + 2).writeUINT32(frm);
-	(drw + 12).writeUINT32(frm + 4);
-
-	_vm->gfx()->enqueueDrawCommands(drw);
-
-	_waitCursorFrame += 2;
-	_waitCursorAnimDelay = s[1];
-	if (s[3])
-		return false;
-	if (_sceneInfo >> 8)
-		return true;
-	_waitCursorFrame = 0;
-	return false;
+void CmdQueue::m_clearJordanInputField(const uint16 *&data) {
+	_vm->gfx()->clearJordanInputField();
+	_progress = -1;
 }
 
-ScriptEngine::ScriptEngine(SnatcherEngine *vm, CmdQueue *que, ResourcePointer *scd) : _vm(vm), _que(que), _var(nullptr), _curPos(0), _op(0), /*_v1(0), _v2(0),*/ _v3(0), _v5(0), _buf352(nullptr) {
-	_var = new uint8[0x100]();
-	_arrays[0] = _var;
-	_arrays[1] = _var + 18;
-	_arrays[2] = _arrays[1] + 64;
-	_arrays[3] = _arrays[2] + 32;
-	_arrays[4] = _arrays[3] + 38;
-	_arrays[5] = _arrays[4] + 8;
-	_buf352 = new uint8[352]();
-
+ScriptEngine::ScriptEngine(CmdQueue *que, UI *ui, ResourcePointer *scd) : _que(que), _ui(ui), _arrayData(nullptr), _pos1(0), _pos2(0), _op(0), /*_v1(0), _v2(0), _v3(0),*/ _result(0), _flagsTable(nullptr) {
+	_flagsTable = new uint8[352]();
+	_arrayData = new uint8[0x100]();
 	makeOpcodeTable(scd);
+	resetArrays();
+	_ui->setScriptVerbsArray(&_arrays[1]);
+	_ui->setScriptSentenceArray(&_arrays[2]);
 }
 
 ScriptEngine::~ScriptEngine() {
-	delete[] _var;
-	delete[] _buf352;
+	delete[] _arrayData;
+	delete[] _flagsTable;
 }
 
 void ScriptEngine::resetArrays() {
-	static const uint8 arraySize[] = { 0x08, 0x1F, 0x0F, 0x12, 0x03, 0x10 };
-	memset(_var, 0, 0x100);
-	for (int i = 0; i < ARRAYSIZE(_arrays); ++i)
-		_arrays[i][0] = arraySize[i];
+	static const uint8 arraySizes[] = { 0x08, 0x1F, 0x0F, 0x12, 0x03, 0x10 };
+	memset(_arrayData, 0, 0x100);
+
+	uint8 *pos = _arrayData;
+	for (int i = 0; i < ARRAYSIZE(_arrays); ++i) {
+		_arrays[i] = ScriptArray(pos , arraySizes[i]);
+		pos += ((arraySizes[i] + 1) << 1);
+	}
 }
 
 void ScriptEngine::run(Script *script) {
 	assert(script);
 
-	_curPos = script->curPos;
-	script->sp = script->bp;
 	_script = script;
+	_pos1 = script->curPos;
+	//script->sp = script->bp;
+	script->sentenceDone = 0;
+
+	runOpcode();
+}
 
-	runOpcode(_curPos);
-}
-
-#define S_FRAME(x) _script->sp += (x)
-#define S_WRBYTE(x, y) _script->sp[x] = (uint8)(y)
-#define S_INCBYTE(x) _script->sp[x]++
-#define S_DECBYTE(x) _script->sp[x]--
-#define S_ADDBYTE(x, y) _script->sp[x] += (uint8)(y)
-#define S_SUBBYTE(x, y) _script->sp[x] -= (uint8)(y)
-#define S_WRWORD(x, y) *(uint16*)(_script->sp + x) = (uint16)(y)
-#define S_RDBYTE(x) _script->sp[x]
-#define S_RDWORD(x) *(uint16*)(_script->sp + x)
-#define S_PUSH(x) S_FRAME(-2); S_WRWORD(0, x)
-#define S_POP() S_RDWORD(0); S_FRAME(2);
-#define ARR_SIZE(x)	_arrays[x][0]
-#define ARR_POS(x)	_arrays[x][1]
-#define ARR_READ(a, p) READ_BE_UINT16(_arrays[a] + 2 + 2 * (p))
-#define ARR_WRITE(a, p, v) WRITE_BE_UINT16(_arrays[a] + 2 + 2 * (p), v)
+#define ARR_SIZE(x) _arrays[x].size()
+#define ARR_POS(x) _arrays[x].pos()
+#define ARR_READ(x, y) _arrays[x].read(y)
+#define ARR_WRITE(x, y, z) _arrays[x].write(y, z)
 
 bool ScriptEngine::postProcess(Script *script) {
-	if (script->newPos != -1) {
+	if (script->newPos != 0xFFFF) {
 		if (ARR_SIZE(4) <= ARR_POS(4)) {
 			for (int i = 0; i < ARR_POS(4) - 1; ++i)
 				ARR_WRITE(4, i, ARR_READ(4, i + 1));
@@ -665,13 +459,14 @@ bool ScriptEngine::postProcess(Script *script) {
 		}
 		setArrayLastEntry(4, script->curPos);
 		script->curPos = script->newPos;
-		script->newPos = -1;
+		script->newPos = 0xFFFF;
+		_ui->resetVerbSelection();
 	}
 
 	if (ARR_POS(1) != 0)
 		return true;
 
-	int r0 = 0;
+	uint16 r0 = 0;
 	getArrayLastEntry(0, r0);
 	if (r0 < ARR_POS(2))
 		ARR_POS(2) = r0;
@@ -680,33 +475,54 @@ bool ScriptEngine::postProcess(Script *script) {
 	return false;
 }
 
-void ScriptEngine::runOpcode(int offset) {
-	uint8 op = getOpcode(offset);
+void ScriptEngine::processInput() {
+	uint16 val = 0;
+	if ((int8)_ui->getSelectedVerb() < 0) {
+		getArrayLastEntry(0, val);
+		if (ARR_POS(2) != val) {
+			if (ARR_POS(2))
+				--ARR_POS(2);
+		}
+	} else {
+		getArrayEntry(1, _ui->getSelectedVerb() - 1, val);
+		setArrayLastEntry(2, val);
+	}
+	ARR_POS(1) = 0;
+}
+
+void ScriptEngine::runOpcode() {
+	uint8 op = getOpcode(_pos1);
 	if (_opcodes[op].proc->isValid())
+#ifdef SNATCHER_SCRIPT_DEBUG
+		(*_opcodes[op].proc)(_pos1);
+#else
 		(*_opcodes[op].proc)();
+#endif
 	else
 		error("%s(): Invalid opcode %d", __FUNCTION__, op);
 }
 
-void ScriptEngine::getOpcodeProps(int offset, int &len, int &f1, int &f2) {
-	uint8 op = getOpcode(offset);
-	len = _opcodes[op].len;
-	f1 = _opcodes[op].flags >> 4;
-	f2 = _opcodes[op].flags & 0x0F;
-}
-
-void ScriptEngine::runOpcode(int &offset, int len, int &result) {
-	if (len == 4) {
-		runOpcode(offset);
-		stackOps_unkParseTo(offset);
-	} else if (len == 1) {
-		getFlag(READ_BE_UINT16(_script->data + offset), result);
-		offset += 2;
-	} else if (len == 3 || len == 5) {
-		result = READ_BE_UINT16(_script->data + offset);
-		offset += 2;
+void ScriptEngine::getOpcodeProperties(uint16 &m1, uint16 &m2, uint16 &u) {
+	uint8 op = getOpcode(_pos2);
+	m1 = _opcodes[op].len;
+	m2 = _opcodes[op].flags >> 4;
+	u = _opcodes[op].flags & 0x0F;
+}
+
+void ScriptEngine::runOpcodeOrReadVar(uint16 mode, uint16 &result) {
+	if (mode == 4) {
+		int cpos = _pos1;
+		runOpcode();
+		_pos2 = cpos;
+		jump();
+	} else if (mode == 1) {
+		getFlags(READ_BE_UINT16(_script->data + _pos1), result);
+		_pos2 = _pos1 + 2;
+	} else if (mode == 3 || mode == 5) {
+		result = READ_BE_UINT16(_script->data + _pos1);
+		_pos2 = _pos1 + 2;
 	} else {
-		error("%s(): Invalid opcode length %d", __FUNCTION__, len);
+		error("%s(): Invalid opcode length %d", __FUNCTION__, mode);
 	}
 }
 
@@ -715,191 +531,180 @@ static const uint16 maskTable[] = {
 	0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
 };
 
-void ScriptEngine::getFlag(int pos, int &result) {
-	const uint8 *in = &_buf352[pos >> 7];
-	result = (in[0] << 24 | in[1] << 16 | in[2] << 8);
-	uint8 v2 = pos & 0x0F;
-	uint8 v1 = v2 + 1 + ((pos >> 4) & 7);
-	result = (((uint32)result << v1) | ((uint32)result >> (32 - v1))) & maskTable[v2];
+void ScriptEngine::getFlags(uint16 sel, uint16 &result) {
+	assert(sel < 0xAF80);
+	const uint8 *in = &_flagsTable[sel >> 7];
+	uint32 r = (in[0] << 24 | in[1] << 16 | in[2] << 8);
+	uint8 v2 = sel & 0x0F;
+	uint8 v1 = v2 + 1 + ((sel >> 4) & 7);
+	result = ((r << v1) | (r >> (32 - v1))) & maskTable[v2];
+	debug ("GETFLAGS: sel 0x%04X, 0x%02x%02x%02x", sel, *in, *(in+1), *(in+2));
 }
 
-void ScriptEngine::setFlag(int pos, int val) {
-	uint8 v2 = pos & 0x0F;
-	uint8 v1 = v2 + 1 + ((pos >> 4) & 7);
+void ScriptEngine::setFlags(uint16 sel, uint32 flags) {
+	uint8 v2 = sel & 0x0F;
+	uint8 v1 = v2 + 1 + ((sel >> 4) & 7);
 
-	uint16 msk = maskTable[v1];
-	val &= msk;
+	uint32 msk = maskTable[v2];
+	flags &= msk;
 	msk = ~msk;
 
-	uint8 *in = &_buf352[pos >> 7];
-	int cur = (in[0] << 24 | in[1] << 16 | in[2] << 8);
+	assert(sel < 0xAF80);
+	uint8 *in = &_flagsTable[sel >> 7];
+	uint32 cur = (in[0] << 24 | in[1] << 16 | in[2] << 8);
 
-	msk = (((uint32)msk << (32 - v1)) | ((uint32)msk >> v1));
-	val = (((uint32)val << (32 - v1)) | ((uint32)val >> v1));
+	msk = ((msk << (32 - v1)) | (msk >> v1));
+	flags = ((flags << (32 - v1)) | (flags >> v1));
 
-	val |= (cur & msk);
-	*in++ = (val >> 24) & 0xFF;
-	*in++ = (val >> 16) & 0xFF;
-	*in++ = (val >> 8) & 0xFF;
-}
+	flags |= (cur & msk);
+	*in++ = (flags >> 24) & 0xFF;
+	*in++ = (flags >> 16) & 0xFF;
+	*in++ = (flags >> 8) & 0xFF;
 
-uint8 ScriptEngine::countFunctionOps(int offset) {
-	S_FRAME(-2);
-	S_WRBYTE(0, 0);
+	debug ("SETVAR: sel 0x%04X, 0x%02x%02x%02x", sel, *(in-3), *(in-2), *(in-1));
+}
 
-	int r1 = 0;
-	int r2 = 0;
-	int r3 = 0;
+uint8 ScriptEngine::countFunctionOps() {
+	uint8 cnt = 0;
+	uint16 r1 = 0;
+	uint16 r2 = 0;
+	uint16 r3 = 0;
 
 	for (bool lp = true; lp; ) {
-		S_INCBYTE(0);
-		if (!isExecFuncOpcode(offset))
+		++cnt;
+		if (!isExecFuncOpcode())
 			break;
-		if (stackOps_checkFor52(offset, r1))
-			S_ADDBYTE(0, r1 - 1);
-		getOpcodeProps(offset, r1, r2, r3);
+		if (stackOps_checkFor52(r1))
+			cnt += (r1 - 1);
+		getOpcodeProperties(r1, r2, r3);
 		if (r2 == 7)
 			break;
-		if (opcodeHasFlag8(offset)) {
-			offset = READ_BE_UINT16(_script->data + offset + 1);
+		if (opcodeHasFlag8()) {
+			_pos2 = READ_BE_UINT16(_script->data + _pos2 + 1);
 		} else {
-			++offset;
-			stackOps_unkParseTo(offset);
+			++_pos2;
+			jump();
 		}
 	}
 
-	uint8 res = S_RDBYTE(0);
-	S_FRAME(2);
-	return res;
+	return cnt;
 }
 
-void ScriptEngine::seekToFunctionOp(int &offset, int arg) {
-	S_FRAME(-2);
-	S_WRBYTE(0, arg);
-
-	int r1 = 0;
-	int r2 = 0;
-	int r3 = 0;
+void ScriptEngine::seekToFunctionOp(int num) {
+	uint16 r1 = 0;
+	uint16 r2 = 0;
+	uint16 r3 = 0;
 
 	for (bool lp = true; lp; ) {
-		if (!isExecFuncOpcode(offset))
+		if (!isExecFuncOpcode())
 			break;
-		if (stackOps_checkFor52(offset, r1))
-			S_SUBBYTE(0, r1 - 1);
-		S_SUBBYTE(0, 1);
-		if ((int8)S_RDBYTE(0) <= 0) {
-			skipOnFlag8(offset);
+		if (stackOps_checkFor52(r1))
+			num -= (r1 - 1);
+		--num;
+		if (num <= 0) {
+			skipOnFlag8();
 			break;
 		}
-		if (opcodeHasFlag8(offset)) {
-			offset = READ_BE_UINT16(_script->data + offset + 1);
+		if (opcodeHasFlag8()) {
+			_pos2 = READ_BE_UINT16(_script->data + _pos2 + 1);
 		} else {
-			getOpcodeProps(offset, r1, r2, r3);
-			if (r1 == 4)
-				stackOps_unkParseTo(++offset);
-			else
-				offset += 3;
+			getOpcodeProperties(r1, r2, r3);
+			if (r1 == 4) {
+				++_pos2;
+				jump();
+			} else {
+				_pos2 += 3;
+			}
 		}
 	}
-
-	S_FRAME(2);
 }
 
-bool ScriptEngine::isExecFuncOpcode(int offset) {
-	uint8 op = getOpcode(offset);
+bool ScriptEngine::isExecFuncOpcode() {
+	uint8 op = getOpcode(_pos2);
 	return (op >= 30 && op <= 39);
 }
 
-bool ScriptEngine::stackOps_checkFor52(int offset, int &result) {
-	S_PUSH(offset);
+bool ScriptEngine::stackOps_checkFor52(uint16 &result) {
+	uint16 m = 0;
+	uint16 f1 = 0;
+	uint16 f2 = 0;
+	int cpos = _pos2;
+	bool res = false;
 
-	int len = 0;
-	int f1 = 0;
-	int f2 = 0;
-
-	getOpcodeProps(offset, len, f1, f2);
-	if (len == 4) {
-		skipOnFlag8(offset);
-		uint8 op = getOpcode(offset);
+	getOpcodeProperties(m, f1, f2);
+	if (m == 4) {
+		skipOnFlag8();
+		uint8 op = getOpcode(_pos2);
 		if (op == 52 || op == 53) {
-			result = READ_BE_UINT16(_script->data + offset + 1);
-			return true;
+			result = READ_BE_UINT16(_script->data + _pos2 + 1);
+			res = true;
 		}
 	}
-
-	S_FRAME(2);
-	return false;
+	_pos2 = cpos;
+	return res;
 }
 
-bool ScriptEngine::opcodeHasFlag8(int offset) {
-	int len = 0;
-	int f1 = 0;
-	int f2 = 0;
-	getOpcodeProps(offset, len, f1, f2);
+bool ScriptEngine::opcodeHasFlag8() {
+	uint16 ln = 0;
+	uint16 f1 = 0;
+	uint16 f2 = 0;
+	getOpcodeProperties(ln, f1, f2);
 	return ((f1 | f2) & 8);
 }
 
-bool ScriptEngine::OPC_4_ss() {
-	if (ARR_POS(1) || _script->newPos != -1)
+bool ScriptEngine::evalFinished() {
+	if (ARR_POS(1) || _script->newPos != 0xFFFF)
 		return false;
-	if (_script->scriptStateByteUnk) {
-		int r1 = 0;
+	if (_script->sentenceDone) {
+		uint16 r1 = 0;
 		if (!getArrayLastEntry(0, r1))
 			return true;
-		return (_script->unkislp > r1);
+		return (_script->sentencePos > r1);
 	}
-	return (_script->unkislp == ARR_POS(2));
+	return (_script->sentencePos == ARR_POS(2));
 }
 
-void ScriptEngine::skipOnFlag8(int &offset) {
-	offset += (opcodeHasFlag8(offset) ? 3 : 1);
+void ScriptEngine::skipOnFlag8() {
+	_pos2 += (opcodeHasFlag8() ? 3 : 1);
 }
 
-void ScriptEngine::stackOps_unkParseTo(int &offset) {
+void ScriptEngine::jump() {
 	for (bool lp = true; lp; ) {
-		if (opcodeHasFlag8(offset)) {
-			offset = READ_BE_UINT16(_script->data + offset + 1);
+		if (opcodeHasFlag8()) {
+			_pos2 = READ_BE_UINT16(_script->data + _pos2 + 1);
 			continue;
 		}
-		S_FRAME(-4);
 		lp = false;
 
-		int len = 0;
-		int f1 = 0;
-		int f2 = 0;
-		getOpcodeProps(offset, len, f1, f2);
-		S_WRBYTE(0, len);
-		S_WRBYTE(1, f1);
-		S_WRBYTE(2, f2);
-		++offset;
+		uint16 len = 0;
+		uint16 f1 = 0;
+		uint16 f2 = 0;
+		getOpcodeProperties(len, f1, f2);
+		++_pos2;
 
 		if (len == 4)
-			stackOps_unkParseTo(offset);
+			jump();
 		else if (len != 0 && len != 7)
-			offset += 2;
-
-		uint8 b = S_RDBYTE(1);
-		if (b == 4)
-			stackOps_unkParseTo(offset);
-		else if (b != 0 && b != 7)
-			offset += 2;
-
-		b = S_RDBYTE(2);
-		if (b == 4)
-			stackOps_unkParseTo(offset);
-		else if (b != 0 && b != 7)
-			offset += 2;
-	}
+			_pos2 += 2;
 
-	S_FRAME(4);
+		if (f1 == 4)
+			jump();
+		else if (f1 != 0 && f1 != 7)
+			_pos2 += 2;
+
+		if (f2 == 4)
+			jump();
+		else if (f2 != 0 && f2 != 7)
+			_pos2 += 2;
+	}
 }
 
-bool ScriptEngine::getArrayLastEntry(int arrNo, int &result) {
+bool ScriptEngine::getArrayLastEntry(uint16 arrNo, uint16 &result) {
 	assert(arrNo < ARRAYSIZE(_arrays));
 	return getArrayEntry(arrNo, ARR_POS(arrNo) - 1, result);
 }
 
-bool ScriptEngine::popArrayLastEntry(int arrNo, int &result) {
+bool ScriptEngine::popArrayLastEntry(uint16 arrNo, uint16 &result) {
 	assert(arrNo < ARRAYSIZE(_arrays));
 	if (!ARR_POS(arrNo))
 		return false;
@@ -908,7 +713,7 @@ bool ScriptEngine::popArrayLastEntry(int arrNo, int &result) {
 	return true;
 }
 
-bool ScriptEngine::getArrayEntry(int arrNo, int pos, int &result) {
+bool ScriptEngine::getArrayEntry(uint16 arrNo, uint8 pos, uint16 &result) {
 	assert(arrNo < ARRAYSIZE(_arrays));
 	if (ARR_POS(arrNo) <= pos)
 		return false;
@@ -916,11 +721,11 @@ bool ScriptEngine::getArrayEntry(int arrNo, int pos, int &result) {
 	return true;
 }
 
-bool ScriptEngine::setArrayLastEntry(int arrNo, int val) {
+bool ScriptEngine::setArrayLastEntry(uint16 arrNo, uint16 val) {
 	assert(arrNo < ARRAYSIZE(_arrays));
 	if (ARR_SIZE(arrNo) <= ARR_POS(arrNo))
 		return false;
-	int pos = ARR_POS(arrNo)++;
+	uint8 pos = ARR_POS(arrNo)++;
 	if (ARR_POS(arrNo) <= pos)
 		return false;
 	ARR_WRITE(arrNo, pos, val);
@@ -936,6 +741,31 @@ uint8 ScriptEngine::getOpcode(int offset) {
 	return op;
 }
 
+void ScriptEngine::writeHostMemory(uint16 addr, uint16 val) {
+	// The scripts have the wonderful capability to directly write into the sub cpu memory.
+	// It is limited to 16bit addresses at least. I hope that in practice, this will only
+	// happen for some global variables. We will just have to catch every case whenever a
+	// new address comes up...
+	switch (addr) {
+	case 0x79F0:
+		break;
+	case 0x971a:
+		_ui->setInterpreterMode(val);
+		break;
+	case 0xFFFF:
+		// This is an exception that is caught even in the original code.
+		//_vm->sound()->setUnkCond(val);
+		val = val;
+		break;
+	default:
+		error("%s(): Unhandled address 0x%04X", __FUNCTION__, addr);
+	}
+}
+
+#ifdef SNATCHER_SCRIPT_DEBUG
+int ScriptEngine::ScriptEngineProc::_recursion = 0;
+#endif
+
 void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 #ifndef SNATCHER_SCRIPT_DEBUG
 	#define OP(x) &ScriptEngine::o_##x
@@ -949,33 +779,33 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 #endif
 	static const SFunc funcTbl[] = {
 		OP(animOps),
-		OP(01),
-		OP(01),
-		OP(01),
-		OP(mmSequence),
+		OP(eval_add),
+		OP(eval_add),
+		OP(eval_add),
+		OP(chatWithPortraitAnim),
 		OP(05),
-		OP(06),
-		OP(06),
-		OP(06),
-		OP(06),
+		OP(eval_and),
+		OP(eval_and),
+		OP(eval_and),
+		OP(eval_and),
 		OP(fmMusicStart),
-		OP(11),
+		OP(callSubRoutine),
 		OP(12),
 		OP(13),
 		OP(14),
-		OP(15),
-		OP(16),
-		OP(16),
-		OP(16),
-		OP(19),
-		OP(20),
+		OP(fmSoundEffect),
+		OP(eval_equal),
+		OP(eval_equal),
+		OP(eval_equal),
+		OP(clearFlags),
+		OP(setFlags),
 		OP(21),
-		OP(22),
+		OP(eval_greater),
 		OP(23),
 		OP(24),
 		OP(24),
-		OP(26),
-		OP(26),
+		OP(jumpIf),
+		OP(jumpIf),
 		OP(28),
 		OP(28),
 		OP(executeFunction),
@@ -994,27 +824,27 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 		OP(break),
 		OP(break),
 		OP(nop),
-		OP(46),
-		OP(46),
-		OP(startFunction),
-		OP(49),
-		OP(49),
-		OP(49),
+		OP(eval_true),
+		OP(eval_true),
+		OP(start),
+		OP(eval_or),
+		OP(eval_or),
+		OP(eval_or),
 		OP(52),
 		OP(52),
 		OP(54),
 		OP(54),
-		OP(56),
+		OP(verbOps),
 		OP(57),
-		OP(loadScript),
+		OP(returnFromSubRoutine),
 		OP(59),
 		OP(59),
 		OP(loadModuleAndStartGfx),
 		OP(62),
-		OP(63),
+		OP(switchToNextOp),
 		OP(64),
-		OP(subOps),
-		OP(subOps),
+		OP(sysOps),
+		OP(sysOps),
 		OP(displayDialog),
 		OP(displayDialog),
 		OP(animWait),
@@ -1042,46 +872,92 @@ void ScriptEngine::o_nop() {
 }
 
 void ScriptEngine::o_animOps() {
-	if (!OPC_4_ss())
+	if (!evalFinished())
 		return;
 	_que->writeUInt16(0x09);
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 4));
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 2));
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 4));
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 2));
 }
 
-void ScriptEngine::o_01() {
+void ScriptEngine::o_eval_add() {
+	uint16 m1 = 0;
+	uint16 m2 = 0;
+	uint16 f2 = 0;
 
+	_pos2 = _pos1++;
+	getOpcodeProperties(m1, m2, f2);
+	runOpcodeOrReadVar(m1, _result);
+	f2 = _result;
+	_pos1 = _pos2;
+	runOpcodeOrReadVar(m2, _result);
+	_result += f2;
 }
 
-void ScriptEngine::o_mmSequence() {
-	if (!OPC_4_ss())
+void ScriptEngine::o_chatWithPortraitAnim() {
+	if (!evalFinished())
 		return;
 	_que->writeUInt16(0x0D);
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 1));
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
 }
 
 void ScriptEngine::o_05() {
 }
 
-void ScriptEngine::o_06() {
+void ScriptEngine::o_eval_and() {
+	uint16 m1 = 0;
+	uint16 m2 = 0;
+	uint16 f2 = 0;
+
+	_pos2 = _pos1++;
+	getOpcodeProperties(m1, m2, f2);
+	runOpcodeOrReadVar(m1, _result);
+	f2 = _result;
+	_pos1 = _pos2;
+	runOpcodeOrReadVar(m2, _result);
+	_result &= f2;
 }
 
 void ScriptEngine::o_fmMusicStart() {
-	if (!OPC_4_ss())
+	if (!evalFinished())
 		return;
 	_que->writeUInt16(0x07);
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 1));
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
 }
 
-void ScriptEngine::o_11() {
-	
+void ScriptEngine::o_callSubRoutine() {
+	if (!evalFinished())
+		return;
+	uint16 m = 0;
+	uint16 f1 = 0;
+	uint16 u = 0;
+
+	setArrayLastEntry(3, _script->curFileNo);
+
+	_pos2 = _pos1;
+	getOpcodeProperties(m, f1, u);
+	++_pos2;
+
+	if (m != 5) {
+		uint16 no = READ_BE_UINT16(_script->data + _pos2 + 1);
+		_que->writeUInt16(0x11);
+		_que->writeUInt32(0x1A800);
+		_que->writeUInt16(no);
+		_script->curFileNo = no;
+		_pos2 += 3;
+	}
+
+	if (!getArrayEntry(5, 0, u))
+		u = _script->curPos;
+	setArrayLastEntry(3, u);
+
+	_script->newPos = READ_BE_UINT16(_script->data + _pos2);
 }
 
 void ScriptEngine::o_12() {
-	int cp = _script->curPos;
+	uint16 cp = _script->curPos;
 	setArrayLastEntry(5, cp);
-	_curPos = _script->curPos = READ_BE_UINT16(_script->data + _curPos + 1);
-	runOpcode(_curPos);
+	_pos1 = _script->curPos = READ_BE_UINT16(_script->data + _pos1 + 1);
+	runOpcode();
 	popArrayLastEntry(5, cp);
 	_script->curPos = cp;
 }
@@ -1090,99 +966,129 @@ void ScriptEngine::o_13() {
 }
 
 void ScriptEngine::o_14() {
+	if (!evalFinished())
+		return;
+
+	uint16 r1 = 0;
+	uint16 sel = READ_BE_UINT16(_script->data + _pos1 + 1);
+	getFlags(sel, r1);
+
+	uint16 r2 = (0xFFFFFFFF >> (15 - (sel & 0x0F))) & 0xFFFF;
+	if (r2 != r1)
+		setFlags(sel, r1 + 1);
 }
 
-void ScriptEngine::o_15() {
+void ScriptEngine::o_fmSoundEffect() {
+	if (!evalFinished())
+		return;
+	_que->writeUInt16(0x1C);
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
 }
 
-void ScriptEngine::o_16() {
+void ScriptEngine::o_eval_equal() {
+	uint16 m1 = 0;
+	uint16 m2 = 0;
+	uint16 f2 = 0;
+
+	_pos2 = _pos1++;
+	getOpcodeProperties(m1, m2, f2);
+	runOpcodeOrReadVar(m1, _result);
+	f2 = _result;
+	_pos1 = _pos2;
+	runOpcodeOrReadVar(m2, _result);
+	_result = (_result == f2) ? 0xFFFF : 0;
 }
 
-void ScriptEngine::o_19() {
+void ScriptEngine::o_clearFlags() {
+	if (!evalFinished())
+		return;
+	setFlags(READ_BE_UINT16(_script->data + _pos1 + 1), 0);
 }
 
-void ScriptEngine::o_20() {
+void ScriptEngine::o_setFlags() {
+	if (!evalFinished())
+		return;
+	setFlags(READ_BE_UINT16(_script->data + _pos1 + 1), 0xFFFF);
 }
 
 void ScriptEngine::o_21() {
-
+	uint16 n = READ_BE_UINT16(_script->data + _pos1 + 1);
+	if (!getArrayEntry(4, ARR_POS(4) - n, _result))
+		_result = 0xFFFF;
 }
 
-void ScriptEngine::o_22() {
-	int len = 0;
-	int f1 = 0;
-	int f2 = 0;
-
-	getOpcodeProps(_curPos, len, f1, f2);
-	++_curPos;
-	int r1 = 0;
-	runOpcode(_curPos, len, r1);
-	int r2 = 0;
-	runOpcode(_curPos, f1, r2);
-	_v5 = (r1 > r2) ? -1 : 0;
+void ScriptEngine::o_eval_greater() {
+	uint16 m1 = 0;
+	uint16 m2 = 0;
+	uint16 r1 = 0;
+	_pos2 = _pos1++;
+	getOpcodeProperties(m1, m2, r1);
+	runOpcodeOrReadVar(m1, _result);
+	_pos1 = _pos2;
+	r1 = _result;
+	runOpcodeOrReadVar(m2, _result);
+	_result = (r1 > _result) ? 0xFFFF : 0;
 }
 
 void ScriptEngine::o_23() {
 }
 
 void ScriptEngine::o_24() {
-}
-
-void ScriptEngine::o_26() {
-	int len = 0;
-	int f1 = 0;
-	int f2 = 0;
-
-	getOpcodeProps(_curPos, len, f1, f2);
-
-	int pos = ++_curPos;
-	runOpcode(pos, len, _v5);
-	if (!_v5)
+	uint16 mode = 0;
+	uint16 f1 = 0;
+	uint16 f2 = 0;
+	_pos2 = _pos1;
+	getOpcodeProperties(mode, f1, f2);
+	uint16 np = READ_BE_UINT16(_script->data + _pos1 + 1);
+	_pos1 += 3;
+	runOpcodeOrReadVar(mode, _result);
+	_pos1 = _result ? _pos2 : np;
+	runOpcode();
+}
+
+void ScriptEngine::o_jumpIf() {
+	uint16 mode = 0;
+	uint16 f1 = 0;
+	uint16 f2 = 0;
+	_pos2 = _pos1++;
+	getOpcodeProperties(mode, f1, f2);
+	runOpcodeOrReadVar(mode, _result);
+	if (!_result)
 		return;
-
-	_curPos = pos;
-	runOpcode(pos);
+	_pos1 = _pos2;
+	runOpcode();
 }
 
 void ScriptEngine::o_28() {
-	if (!OPC_4_ss())
+	if (!evalFinished())
 		return;
 
-	int len = 0;
-	int f1 = 0;
-	int f2 = 0;
-
-	getOpcodeProps(_curPos, len, f1, f2);
-	S_PUSH(READ_BE_UINT16(_script->data + _curPos + 1));
-	_curPos += 3;
-	int res = 0;
-	runOpcode(_curPos, f1, res);
-	int pos = S_POP();
-	setFlag(pos, res);
+	uint16 len = 0;
+	uint16 mode = 0;
+	uint16 f2 = 0;
+	_pos2 = _pos1;
+	getOpcodeProperties(len, mode, f2);
+	uint16 sel = READ_BE_UINT16(_script->data + _pos1 + 1);
+	_pos1 += 3;
+	runOpcodeOrReadVar(mode, _result);
+	setFlags(sel, _result);
 }
 
-
 void ScriptEngine::o_executeFunction() {
-	S_FRAME(-4);
-
-	S_WRBYTE(0, countFunctionOps(_curPos));
-	S_WRBYTE(1, 1);
-	S_WRWORD(2, _curPos);
+	_pos2 = _pos1;
+	uint8 num = countFunctionOps();
+	uint8 cnt = 1;
+	int orig = _pos1;
 	
 	for (bool lp = true; lp; ) {
-		uint8 cnt = S_RDBYTE(1);
-		int offs = S_RDWORD(2);
-		seekToFunctionOp(offs, cnt);
-		_curPos = offs;
-		runOpcode(_curPos);
+		_pos2 = orig;
+		seekToFunctionOp(cnt);
+		_pos1 = _pos2;
+		runOpcode();
 
-		if (S_RDBYTE(0) == S_RDBYTE(1))
+		if (cnt++ == num)
 			lp = false;
-		else
-			S_INCBYTE(1);
 	}
-
-	S_FRAME(4);
 }
 
 void ScriptEngine::o_40() {
@@ -1193,18 +1099,19 @@ void ScriptEngine::o_42() {
 }
 
 void ScriptEngine::o_break() {
-	if (!OPC_4_ss())
+	if (!evalFinished())
 		return;
 
-	int len = 0;
-	int f1 = 0;
-	int f2 = 0;
+	uint16 m = 0;
+	uint16 f1 = 0;
+	uint16 f2 = 0;
+	_pos2 = _pos1;
 
-	getOpcodeProps(_curPos, len, f1, f2);
-	int pos = _curPos + 1;
-	if (len != 5) {
-		int num = READ_BE_UINT16(_script->data + pos);
-		pos += 2;
+	getOpcodeProperties(m, f1, f2);
+	++_pos2;
+	if (m != 5) {
+		int num = READ_BE_UINT16(_script->data + _pos2 + 1);
+		_pos2 += 3;
 		if (_script->curFileNo != num) {
 			_script->curFileNo = num;
 			_que->writeUInt16(0x11);
@@ -1212,78 +1119,114 @@ void ScriptEngine::o_break() {
 			_que->writeUInt16(num);
 		}
 	}
-	_script->newPos = READ_BE_UINT16(_script->data + pos);
+	_script->newPos = READ_BE_UINT16(_script->data + _pos2);
 }
 
-void ScriptEngine::o_46() {
-	int len = 0;
-	int f1 = 0;
-	int f2 = 0;
-	int pos = _curPos;
-	getOpcodeProps(_curPos, len, f1, f2);
-	runOpcode(_curPos, len, _v5);
-	_v5 = _v5 ? 0 : -1;
+void ScriptEngine::o_eval_true() {
+	uint16 mode = 0;
+	uint16 f1 = 0;
+	uint16 f2 = 0;
+	_pos2 = _pos1++;
+	getOpcodeProperties(mode, f1, f2);
+	runOpcodeOrReadVar(mode, _result);
+	_result = _result ? 0 : 0xFFFF;
 }
 
-void ScriptEngine::o_startFunction() {
-	runOpcode(++_curPos);
+void ScriptEngine::o_start() {
+	++_pos1;
+	runOpcode();
 }
 
-void ScriptEngine::o_49() {
+void ScriptEngine::o_eval_or() {
+	uint16 m1 = 0;
+	uint16 m2 = 0;
+	uint16 f2 = 0;
+
+	_pos2 = _pos1++;
+	getOpcodeProperties(m1, m2, f2);
+	runOpcodeOrReadVar(m1, _result);
+	f2 = _result;
+	_pos1 = _pos2;
+	runOpcodeOrReadVar(m2, _result);
+	_result |= f2;
 }
 
 void ScriptEngine::o_52() {
+	uint16 ln = 0;
+	uint16 f1 = 0;
+	uint16 f2 = 0;
+	getOpcodeProperties(ln, f1, f2);
+	if (f1 == 7)
+		return;
+	_pos1 += 3;
+	runOpcode();
 }
 
 void ScriptEngine::o_54() {
+	if (!evalFinished())
+		return;
+
+	uint16 m1 = 0;
+	uint16 m2 = 0;
+	uint16 r = 0;
+	getArrayLastEntry(0, r);
+
+	if (_script->sentencePos <= r)
+		return;
+	setArrayLastEntry(0, _script->sentencePos);
+
+	_pos2 = _pos1;
+	getOpcodeProperties(m1, m2, r);
+	if (m2 != 4)
+		return;
+
+	++_pos1;
+	runOpcode();
 }
 
-void ScriptEngine::o_56() {
-	if (_script->newPos != -1)
+void ScriptEngine::o_verbOps() {
+	if (_script->newPos != 0xFFFF)
 		return;
 
-	int pos = _curPos;
+	_pos2 = _pos1;
 
-	if (ARR_POS(2) == _script->unkislp) {
-		int val = READ_BE_UINT16(_script->data + pos + 1);
+	if (ARR_POS(2) == _script->sentencePos) {
+		uint16 val = READ_BE_UINT16(_script->data + _pos2 + 1);
 
-		if (ARR_SIZE(1) <= ARR_POS(1)) {
-			//_v1 = 0;
-			debug("Array 1 is full");
-		} else {
-			pos = ARR_POS(1)++;
-			if (ARR_POS(1) <= pos) {
-				//_v0 = 0;
-				debug("Array 1 is full");
-			} else {
-				ARR_WRITE(1, pos, val);
-				//_v1 = -1;
-			}
-		}
+		if (setArrayLastEntry(1, val))
+			debug("ADD verb %d", val);
+		else
+			debug("Verb array overflow");
 
 	} else {
-		getArrayEntry(2, _script->unkislp, _v3);
-		if (READ_BE_UINT16(_script->data + pos + 1) != _v3)
+		uint16 val = 0;
+		getArrayEntry(2, _script->sentencePos, val);
+		if (READ_BE_UINT16(_script->data + _pos2 + 1) != val)
 			return;
+		debug("PROCESS verb %d", val);
+		++_script->sentencePos;
+		_pos1 += 3;
 
-		++_script->unkislp;
-		_curPos += 3;
-
-		runOpcode(_curPos);
+		runOpcode();
 
-		if (ARR_POS(2) == _script->unkislp) {
-			if (ARR_POS(1))
-				_script->scriptStateByteUnk = 0xFF;
+		if (ARR_POS(2) == _script->sentencePos) {
+			if (ARR_POS(1) == 0)
+				_script->sentenceDone = 0xFF;
 		}
-		--_script->unkislp;
+		--_script->sentencePos;
 	}
 }
 
 void ScriptEngine::o_57() {
+	if (!evalFinished())
+		return;
+
+	if (ARR_POS(0))
+		--ARR_POS(0);
 }
 
-void ScriptEngine::o_loadScript() {
-	int res = 0;
+void ScriptEngine::o_returnFromSubRoutine() {
+	uint16 res = 0;
 	popArrayLastEntry(3, res);
 	_script->newPos = res;
 	popArrayLastEntry(3, res);
@@ -1295,12 +1238,31 @@ void ScriptEngine::o_loadScript() {
 }
 
 void ScriptEngine::o_59() {
+	uint16 m = 0;
+	uint16 f1 = 0;
+	uint16 f2 = 0;
+	_pos2 = _pos1;
+	getOpcodeProperties(m, f1, f2);
+	uint16 val = READ_BE_UINT16(_script->data + _pos2 + 1);
+	if (m == 5) {
+		_result = 0;
+		for (int i = 0; i < ARR_POS(5) && !_result; ++i) {
+			if (ARR_READ(5, i) == val)
+				_result = 1;
+		}
+	} else if (val != 0) {
+		uint8 e = -(val - ARR_POS(5));
+		if (!getArrayEntry(5, e, _result))
+			_result = 0xFFFF;
+	} else {
+		_result = _script->curPos;
+	}
 }
 
 void ScriptEngine::o_loadModuleAndStartGfx() {
-	if (!OPC_4_ss())
+	if (!evalFinished())
 		return;
-	int16 num = READ_BE_INT16(_script->data + _curPos + 1);
+	int16 num = READ_BE_INT16(_script->data + _pos1 + 1);
 
 	if (_script->curGfxScript == num)
 		return;
@@ -1320,34 +1282,54 @@ void ScriptEngine::o_loadModuleAndStartGfx() {
 }
 
 void ScriptEngine::o_62() {
-}
-
-void ScriptEngine::o_63() {
+	uint16 sel = READ_BE_UINT16(_script->data + _pos1 + 1);
+	_pos2 = _pos1 + 3;
+	uint16 f = Util::rngGetNumberFromRange(1, countFunctionOps()) & 0xFF;
+	_pos2 = _pos1 + 3;
+	seekToFunctionOp(f);
+	_pos1 = _pos2;
+	runOpcode();
+	setFlags(sel, f);
+}
+
+void ScriptEngine::o_switchToNextOp() {
+	_pos2 = _pos1 + 3;
+	uint16 cnt = countFunctionOps();
+	uint16 sel = READ_BE_UINT16(_script->data + _pos1 + 1);
+	uint16 val = 0;
+	getFlags(sel, val);
+	_pos2 = _pos1 + 3;
+	seekToFunctionOp(++val);
+	_pos1 = _pos2;
+	runOpcode();
+	if (ARR_POS(1) == 0 && val != cnt)
+		setFlags(sel, val);
 }
 
 void ScriptEngine::o_64() {
 }
 
-void ScriptEngine::o_subOps() {
-	if (!OPC_4_ss())
+void ScriptEngine::o_sysOps() {
+	if (!evalFinished())
 		return;
 
-	int len = 0;
-	int f1 = 0;
-	int f2 = 0;
-
-	getOpcodeProps(_curPos, len, f1, f2);
-	int op = READ_BE_UINT16(_script->data + _curPos + (len == 4 ? 2 : 1));
+	uint16 m = 0;
+	uint16 f1 = 0;
+	uint16 f2 = 0;
+	_pos2 = _pos1;
+	getOpcodeProperties(m, f1, f2);
+	_pos2 += (m == 4 ? 2 : 1);
+	uint16 sub = READ_BE_UINT16(_script->data + _pos2);
 	uint16 addr = 0;
 	uint16 val = 0;
 
-	switch (op) {
+	switch (sub) {
 	case 0:
 		_que->writeUInt16(0x04);
 		break;
 	case 1:
 		_que->writeUInt16(0x1E);
-		_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 4));
+		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 4));
 		//saveState_sub_14F12();
 		break;
 	case 2:
@@ -1357,64 +1339,62 @@ void ScriptEngine::o_subOps() {
 		_que->writeUInt16(0x1F);
 		break;
 	case 4:
-		//_scr_wd_00 = READ_BE_UINT16(_script->data + _curPos + 4);
+		//_scr_wd_00 = READ_BE_UINT16(_script->data + _pos1 + 4);
 		//_scr_wd_01 = _scr_wd_02 = _scr_wd_03 = _scr_wd_04 = 0;
 		//_scr_bt_00 = true;
 		_que->writeUInt16(0x18);
 		break;
 	case 5:
-		addr = READ_BE_UINT16(_script->data + _curPos + 4);
-		_v5 = 0;//READ_BE_UINT16(addr);
+		addr = READ_BE_UINT16(_script->data + _pos1 + 4);
+		_result = 0;//READ_BE_UINT16(addr);
 		debug ("READ VAR: Addr 0x%04x", addr);
 		break;
 	case 6:
-		addr = READ_BE_UINT16(_script->data + _curPos + 5);
-		val = READ_BE_UINT16(_script->data + _curPos + 7);
-		if (addr == 0xFFFF) // 79F0
-			_vm->sound()->setUnkCond(val);
-		else
-			debug ("WRITE VAR: Addr 0x%04x, Val 0x%04x", addr, val);
-		// WRITE_BE_UINT16(addr, val);
+		addr = READ_BE_UINT16(_script->data + _pos1 + 5);
+		val = READ_BE_UINT16(_script->data + _pos1 + 7);
+		writeHostMemory(addr, val);
 		break;
 	case 7:
 		_que->writeUInt16(0x1D);
-		_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 4) ? 1 : 0);
+		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 4) ? 1 : 0);
 		break;
 	case 8:
-		if (READ_BE_UINT16(_script->data + _curPos + 4) == 0) {
+		if (READ_BE_UINT16(_script->data + _pos1 + 4) == 0) {
 			_que->writeUInt16(0x09);
 			_que->writeUInt16(0x02);
 			_que->writeUInt16(0x01);
 		} else {
+			// Show inventory item close-up
 			_que->writeUInt16(0x15);
-			_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 8));
-			_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 10));
+			_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 8));
+			_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 10));
 		}
 		break;
 	case 9:
-		/*_vm->_gameState.chapter = */READ_BE_UINT16(_script->data + _curPos + 4) + 2;
+		val = /*_vm->_gameState.chapter = */READ_BE_UINT16(_script->data + _pos1 + 4) + 2;
 		break;
 	case 10:
-		/*_doTransition? = */READ_BE_UINT16(_script->data + _curPos + 4);
-		/*if (_doTransition == 1)
+		val = READ_BE_UINT16(_script->data + _pos1 + 4);
+		_ui->setVerbsTabLayout(val);
+		/*if (val == 1)
 			_transDW1 = _transDW2 = 0;*/
 		break;
 	case 11:
-		/*if (READ_BE_UINT16(_script->data + _curPos + 4))
+		/*if (READ_BE_UINT16(_script->data + _pos1 + 4))
 			restoreGfxAndSoundAfterLoad();
 		else
 			animSpecOther();
 			*/
 		break;
 	case 12:
-		_buf352[53] &= 0xF8;
-		memset(_buf352 + 54, 0, 298);
+		_flagsTable[53] &= 0xF8;
+		memset(_flagsTable + 54, 0, 298);
 		break;
 	case 13:
 		_que->writeUInt16(0x1B);
-		_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 5));
-		_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 8));
-		_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 10));
+		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 5));
+		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 8));
+		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 10));
 		break;
 	default:
 		break;
@@ -1422,41 +1402,42 @@ void ScriptEngine::o_subOps() {
 }
 
 void ScriptEngine::o_displayDialog() {
-	if (!OPC_4_ss())
+	if (!evalFinished())
 		return;
 
-	int len = 0;
-	int f1 = 0;
-	int f2 = 0;
+	uint16 m = 0;
+	uint16 f1 = 0;
+	uint16 f2 = 0;
+	_pos2 = _pos1;
 
-	getOpcodeProps(_curPos, len, f1, f2);
-	int pos = _curPos + 1;
+	getOpcodeProperties(m, f1, f2);
+	++_pos2;
 
 	_que->writeUInt16(0x08);
-	if (len == 4) {
-		_que->writeUInt16(READ_BE_UINT16(_script->data + pos + 1));
-		pos += 3;
+	if (m == 4) {
+		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos2 + 1));
+		_pos2 += 3;
 	} else {
 		_que->writeUInt16(0);
 	}
-	_que->writeUInt16(READ_BE_UINT16(_script->data + pos));
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos2));
 }
 
 void ScriptEngine::o_animWait() {
-	if (!OPC_4_ss())
+	if (!evalFinished())
 		return;
 	_que->writeUInt16(0x09);
 	_que->writeUInt16(0x03);
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 1));
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
 }
 
 void ScriptEngine::o_pcmSoundWait() {
-	if (OPC_4_ss())
+	if (evalFinished())
 		_que->writeUInt16(0x0A);
 }
 
 void ScriptEngine::o_fmMusicWait() {
-	if (OPC_4_ss())
+	if (evalFinished())
 		_que->writeUInt16(0x13);
 }
 
@@ -1467,26 +1448,15 @@ void ScriptEngine::o_73() {
 }
 
 void ScriptEngine::o_waitFrames() {
-	if (!OPC_4_ss())
+	if (!evalFinished())
 		return;
 	_que->writeUInt16(0x10);
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _curPos + 1));
-}
-
-#undef S_FRAME
-#undef S_WRBYTE
-#undef S_WRWORD
-#undef S_RDBYTE
-#undef S_RDWORD
-#undef S_INCBYTE
-#undef S_DECBYTE
-#undef S_ADDBYTE
-#undef S_SUBBYTE
-#undef S_PUSH
-#undef S_POP
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
+}
+
 #undef ARR_SIZE
 #undef ARR_POS
-#undef ARR_WRITE
 #undef ARR_READ
+#undef ARR_WRITE
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/script.h b/engines/snatcher/script.h
index ba6de5c59d8..577ca33c461 100644
--- a/engines/snatcher/script.h
+++ b/engines/snatcher/script.h
@@ -22,16 +22,17 @@
 #ifndef SNATCHER_SCRIPT_H
 #define SNATCHER_SCRIPT_H
 
-
+#include "common/array.h"
+#include "common/func.h"
 #include "common/ptr.h"
-#include "snatcher/resource.h"
 
 #define		SNATCHER_SCRIPT_DEBUG
 
 namespace Snatcher {
 
-class FIO;
+class ResourcePointer;
 class SnatcherEngine;
+class UI;
 
 class CmdQueue {
 public:
@@ -42,7 +43,7 @@ public:
 	void writeUInt32(uint32 val);
 	void start() { _enable = true; }	
 	bool enabled() const { return _enable; }
-	void run(GameState &state);
+	void run();
 
 private:
 	const uint16 *_readPos;
@@ -58,178 +59,188 @@ private:
 private:
 	void makeFunctions();
 
-	void m_end(GameState &state, const uint16 *&data);
-	void m_initAnimations(GameState &state, const uint16 *&data);
-	void m_02(GameState &state, const uint16 *&data);
-	void m_drawCommands(GameState &state, const uint16 *&data);
-	void m_04(GameState &state, const uint16 *&data);
-	void m_printText(GameState &state, const uint16 *&data);
-	void m_06(GameState &state, const uint16 *&data);
-	void m_fmMusicStart(GameState &state, const uint16 *&data);
-	void m_displayDialog(GameState &state, const uint16 *&data);
-	void m_animOps(GameState &state, const uint16 *&data);
-	void m_pcmWait(GameState &state, const uint16 *&data);
-	void m_11(GameState &state, const uint16 *&data);
-	void m_12(GameState &state, const uint16 *&data);
-	void m_mmSeq(GameState &state, const uint16 *&data);
-	void m_14(GameState &state, const uint16 *&data);
-	void m_gfxReset(GameState &state, const uint16 *&data);
-	void m_waitFrames(GameState &state, const uint16 *&data);
-	void m_loadResource(GameState &state, const uint16 *&data);
-	void m_gfxStart(GameState &state, const uint16 *&data);
-	void m_fmMusicWait(GameState &state, const uint16 *&data);
-	void m_20(GameState &state, const uint16 *&data);
-	void m_21(GameState &state, const uint16 *&data);
-	void m_resetTextFields(GameState &state, const uint16 *&data);
-	void m_23(GameState &state, const uint16 *&data);
-	void m_24(GameState &state, const uint16 *&data);
-	void m_25(GameState &state, const uint16 *&data);
-	void m_26(GameState &state, const uint16 *&data);
-	void m_27(GameState &state, const uint16 *&data);
-	void m_28(GameState &state, const uint16 *&data);
-	void m_29(GameState &state, const uint16 *&data);
-	void m_30(GameState &state, const uint16 *&data);
-	void m_31(GameState &state, const uint16 *&data);
-	void m_32(GameState &state, const uint16 *&data);
-	void m_33(GameState &state, const uint16 *&data);
-	void m_palOps(GameState &state, const uint16 *&data);
-	void m_35(GameState &state, const uint16 *&data);
-
-	typedef Common::Functor2Mem<GameState&, const uint16*&, void, CmdQueue> CmdQueOpcode;
-	Common::Array<CmdQueOpcode*> _opcodes;
-
-private:
-	void printSceneEntryStringHead();
-	void printSceneEntryStringBody(GameState &state);
-	bool checkStringProgress();
-	bool waitWithCursorAnim();
+	void m_end(const uint16 *&data);
+	void m_initAnimations(const uint16 *&data);
+	void m_02(const uint16 *&data);
+	void m_drawCommands(const uint16 *&data);
+	void m_04(const uint16 *&data);
+	void m_printText(const uint16 *&data);
+	void m_06(const uint16 *&data);
+	void m_fmMusicStart(const uint16 *&data);
+	void m_displayDialog(const uint16 *&data);
+	void m_animOps(const uint16 *&data);
+	void m_pcmWait(const uint16 *&data);
+	void m_11(const uint16 *&data);
+	void m_pcmSound(const uint16 *&data);
+	void m_chatWithPortraitAnim(const uint16 *&data);
+	void m_14(const uint16 *&data);
+	void m_gfxReset(const uint16 *&data);
+	void m_waitFrames(const uint16 *&data);
+	void m_loadResource(const uint16 *&data);
+	void m_gfxStart(const uint16 *&data);
+	void m_fmMusicWait(const uint16 *&data);
+	void m_20(const uint16 *&data);
+	void m_invItemCloseUp(const uint16 *&data);
+	void m_resetTextFields(const uint16 *&data);
+	void m_23(const uint16 *&data);
+	void m_24(const uint16 *&data);
+	void m_25(const uint16 *&data);
+	void m_26(const uint16 *&data);
+	void m_27(const uint16 *&data);
+	void m_fmSoundEffect(const uint16 *&data);
+	void m_pcmBlock(const uint16 *&data);
+	void m_30(const uint16 *&data);
+	void m_31(const uint16 *&data);
+	void m_32(const uint16 *&data);
+	void m_33(const uint16 *&data);
+	void m_palOps(const uint16 *&data);
+	void m_clearJordanInputField(const uint16 *&data);
 
-	uint8 *_textBuffer;
-	uint8 _textColor;
-	uint8 _textY;
-	uint8 _textY2;
-	//uint8 _makestrbt1;
-	uint8 _sceneId;
-	uint8 _textLineBreak;
-	uint8 _textLineEnd;
-	uint16 _sceneTextOffsCur;
-	uint16 _sceneInfo;
-	uint16 _sceneTextOffset;
-	uint16 _sceneTextOffsStart;
-	uint8 _waitCursorFrame;
-	uint8 _waitCursorAnimDelay;
+	typedef Common::Functor1Mem<const uint16*&, void, CmdQueue> CmdQueOpcode;
+	Common::Array<CmdQueOpcode*> _opcodes;	
 };
 
 struct Script {
-	Script() : scriptStateByteUnk(0), unkislp(0), data(nullptr), dataSize(0), curPos(0), newPos(-1), curFileNo(0), curGfxScript(-1), stack(nullptr), stackSize(0x600), sp(nullptr), bp(nullptr), res() {
-		stack = new uint8[stackSize]();
-		sp = bp = &stack[stackSize];
+	Script(uint32 textResourceOffset) : sentenceDone(0), sentencePos(0), data(nullptr), dataSize(0), curPos(0), newPos(0xFFFF), curFileNo(0), curGfxScript(-1), textResOffset(textResourceOffset) /*,
+		stack(nullptr), stackSize(0x600), sp(nullptr), bp(nullptr)*/ {
+		// stack = new uint8[stackSize]();
+		// sp = bp = &stack[stackSize];
 	}
 	~Script() {
-		delete[] stack;
+		// delete[] stack;
+		delete[] data;
 	}
-	uint8 scriptStateByteUnk;
-	uint8 unkislp;
+	const uint8 *getTextResource() const {
+		return data + textResOffset;
+	}
+	uint8 sentenceDone;
+	uint8 sentencePos;
 	uint8 curFileNo;
 	int16 curGfxScript;
-	ResourcePointer res;
 	const uint8 *data;
 	uint32 dataSize;
-	int curPos;
-	int newPos;
-	uint8 *stack;
-	const uint32 stackSize;
-	uint8 *sp;
-	uint8 *bp;
+	uint16 curPos;
+	uint16 newPos;
+	//uint8 *stack;
+	//const uint32 stackSize;
+	const uint32 textResOffset;
+	//uint8 *sp;
+	//uint8 *bp;
+};
+
+class ScriptArray {
+public:
+	ScriptArray() : _data(nullptr) {}
+	ScriptArray(uint8 *data, uint8 size) : _data(data) {
+		*data = size;
+	}
+	uint8 size() const { return _data[0]; }
+	uint8 pos() const {	return _data[1]; }
+	uint8 &pos() { return _data[1]; }
+	uint16 read(uint8 entry) const {
+		if (entry >= size())
+			error("ScriptArrayEntry::read: entry %d out of bounds", entry);
+		return *((uint16*)&_data[2 + entry * 2]);
+	}
+	void write(uint8 entry, uint16 val) {
+		if (entry >= size())
+			error("ScriptArrayEntry::write: entry %d out of bounds", entry);
+		*((uint16*)&_data[2 + entry * 2]) = val;
+	}
+private:
+	uint8 *_data;
 };
 
 class ScriptEngine {
 public:
-	ScriptEngine(SnatcherEngine *vm, CmdQueue *que, ResourcePointer *scd);
+	ScriptEngine(CmdQueue *que, UI *ui, ResourcePointer *scd);
 	~ScriptEngine();
 
-	//void writeVar(uint16 arrayNo, uint16 pos, uint8 val);
 	void resetArrays();
 	void run(Script *script);
 	bool postProcess(Script *script);
+	void processInput();
 
 private:
-	SnatcherEngine *_vm;
 	CmdQueue *_que;
+	UI *_ui;
 	Script *_script;
 
-	uint8 *_var;
-	uint8 *_arrays[6];
-	uint8 *_buf352;
-	int _curPos;
-	int /*_v1, _v2, */_v3, _v5;
+	uint8 *_arrayData;
+	ScriptArray _arrays[6];
+	uint8 *_flagsTable;
+	int _pos1;
+	int _pos2;
+	uint16 /*_v1, _v2, _v3,*/ _result;
 	uint _op;
 
 private:
-	void runOpcode(int offset);
-	void getOpcodeProps(int offset, int &len, int &f1, int &f2);
-	void runOpcode(int &offset, int len, int &result);
-	void getFlag(int arg, int &result);
-	void setFlag(int arg, int val);
+	void runOpcode();
+	void getOpcodeProperties(uint16 &m1, uint16 &m2, uint16 &u);
+	void runOpcodeOrReadVar(uint16 mode, uint16 &result);
+	void getFlags(uint16 sel, uint16 &result);
+	void setFlags(uint16 sel, uint32 flags);
 
-	uint8 countFunctionOps(int offset);
-	void seekToFunctionOp(int &offset, int arg);
-	bool isExecFuncOpcode(int offset);
-	bool stackOps_checkFor52(int offset, int &result);
-	bool opcodeHasFlag8(int offset);
-	bool OPC_4_ss();
-	void skipOnFlag8(int &offset);
-	void stackOps_unkParseTo(int &offset);
+	uint8 countFunctionOps();
+	void seekToFunctionOp(int num);
+	bool isExecFuncOpcode();
+	bool stackOps_checkFor52(uint16 &result);
+	bool opcodeHasFlag8();
+	bool evalFinished();
+	void skipOnFlag8();
+	void jump();
 
-	bool getArrayLastEntry(int arrNo, int &result);
-	bool popArrayLastEntry(int arrNo, int &result);
-	bool getArrayEntry(int arrNo, int val, int &result);
-	bool setArrayLastEntry(int arrNo, int val);
+	bool getArrayLastEntry(uint16 arrNo, uint16 &result);
+	bool popArrayLastEntry(uint16 arrNo, uint16 &result);
+	bool getArrayEntry(uint16 arrNo, uint8 pos, uint16 &result);
+	bool setArrayLastEntry(uint16 arrNo, uint16 val);
 
 	uint8 getOpcode(int offset);
 
+	void writeHostMemory(uint16 addr, uint16 val);
+
 private:
 	void makeOpcodeTable(ResourcePointer *scd);
 
 	void o_nop();
 	void o_animOps();
-	void o_01();
-	void o_mmSequence();
+	void o_eval_add();
+	void o_chatWithPortraitAnim();
 	void o_05();
-	void o_06();
+	void o_eval_and();
 	void o_fmMusicStart();
-	void o_11();
+	void o_callSubRoutine();
 	void o_12();
 	void o_13();
 	void o_14();
-	void o_15();
-	void o_16();
-	void o_19();
-	void o_20();
+	void o_fmSoundEffect();
+	void o_eval_equal();
+	void o_clearFlags();
+	void o_setFlags();
 	void o_21();
-	void o_22();
+	void o_eval_greater();
 	void o_23();
 	void o_24();
-	void o_26();
+	void o_jumpIf();
 	void o_28();
 	void o_executeFunction();
 	void o_40();
 	void o_42();
 	void o_break();
-	void o_46();
-	void o_startFunction();
-	void o_49();
+	void o_eval_true();
+	void o_start();
+	void o_eval_or();
 	void o_52();
 	void o_54();
-	void o_56();
+	void o_verbOps();
 	void o_57();
-	void o_loadScript();
+	void o_returnFromSubRoutine();
 	void o_59();
 	void o_loadModuleAndStartGfx();
 	void o_62();
-	void o_63();
+	void o_switchToNextOp();
 	void o_64();
-	void o_subOps();
+	void o_sysOps();
 	void o_displayDialog();
 	void o_animWait();
 	void o_pcmSoundWait();
@@ -246,12 +257,19 @@ private:
 		typedef void (ScriptEngine::*ScrFunc)();
 		ScriptEngineProc(ScriptEngine *se, ScrFunc func, const char *desc, uint8 len, uint8 flg) : Common::Functor0Mem<void, ScriptEngine>(se, func), _desc(Common::String("o_") + desc) {
 			_desc += Common::String::format("() [len: %d, flags: 0x%02x]", len, flg);
+			_recursion = 0;
 		}
-		void operator()() {
-			debug("%s", _desc.c_str());
+		void operator()(int pos) {
+			Common::String spc;
+			for (int i = 0; i < _recursion; ++i)
+				spc += "|--";
+			debug("0x%04x: %s%s", pos, spc.c_str(), _desc.c_str());
+			++_recursion;
 			Functor0Mem<void, ScriptEngine>::operator()();
+			--_recursion;
 		}
 	private:
+		static int _recursion;
 		Common::String _desc;
 	};
 #endif
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 9e31af36a89..b28d57c4452 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -25,6 +25,7 @@
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
 #include "snatcher/text.h"
+#include "snatcher/ui.h"
 #include "snatcher/util.h"
 #include "common/config-manager.h"
 #include "common/endian.h"
@@ -44,7 +45,7 @@
 namespace Snatcher {
 
 SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _scd(nullptr), _gfx(nullptr), _snd(nullptr), _input(),
-	_scriptEngine(nullptr), _cmdQueue(nullptr), _script(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _enableLightGun(false), _gfxInfo(),
+	_scriptEngine(nullptr), _cmdQueue(nullptr), _script(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _enableLightGun(false), _ui(nullptr), _gfxInfo(),
 		_frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
 	assert(system);
 }
@@ -58,6 +59,7 @@ SnatcherEngine::~SnatcherEngine() {
 	delete _scriptEngine;
 	delete _cmdQueue;
 	delete _script;
+	delete _ui;
 }
 
 Common::Error SnatcherEngine::run() {
@@ -120,8 +122,10 @@ bool SnatcherEngine::initGfx(Common::Platform platform, bool use8BitColorMode) {
 	}
 
 	_gfx = new GraphicsEngine(&pxf, _system, platform, _gfxInfo, _snd);
+
 	if (_gfx) {
 		initGraphics(_gfx->screenWidth(), _gfx->screenHeight(), &pxf);
+		assert(_scd);
 		_gfx->setTextFont(_scd->makePtr(0x14B7C)(), 816, _scd->makePtr(0x14EAC)(), 102);
 		return true;
 	}
@@ -132,20 +136,34 @@ bool SnatcherEngine::initGfx(Common::Platform platform, bool use8BitColorMode) {
 bool SnatcherEngine::initSound(Audio::Mixer *mixer, Common::Platform platform, int soundOptions) {
 	assert(_mixer);
 	assert(_fio);
+
 	_snd = new SoundEngine(_fio, platform, soundOptions);
-	return (_snd && _snd->init(mixer));
+	if (!_snd || !_snd->init(mixer))
+		return false;
+
+	syncSoundSettings();
+
+	return true;
 }
 
 bool SnatcherEngine::initScriptEngine() {
 	_cmdQueue = new CmdQueue(this);
 	if (!_cmdQueue)
 		return false;
-	_scriptEngine = new ScriptEngine(this, _cmdQueue, _scd);
+
+	assert(_scd);
+	_ui = new UI(_gfx, _cmdQueue, _scd);
+	if (!_ui)
+		return false;
+
+	_scriptEngine = new ScriptEngine(_cmdQueue, _ui, _scd);
 	if (!_scriptEngine)
 		return false;
-	_script = new Script();
+
+	_script = new Script(0x3800);
 	if (!_script)
 		return false;
+
 	return true;
 }
 
@@ -203,7 +221,7 @@ bool SnatcherEngine::start() {
 			if (!_gfx->busy(0)) {
 				bool blockedMod = _cmdQueue->enabled();
 				if (_cmdQueue->enabled()) {
-					_cmdQueue->run(state);
+					_cmdQueue->run();
 					blockedMod = _gfx->busy(0);
 				}
 				if (!blockedMod) {
@@ -254,13 +272,17 @@ struct InputEvent {
 static const InputEvent _defaultKeyEvents[] = {
 	// Arrow buttons
 	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_UP, 0x00, 0x01, false },
-	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP8, Common::KBD_NUM, 0x01, false },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP8, 0x00, 0x01, false },
 	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_DOWN, 0x00, 0x02, false },
-	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP2, Common::KBD_NUM, 0x02, false },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP2, 0x00, 0x02, false },
 	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_LEFT, 0x00, 0x04, false },
-	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP4, Common::KBD_NUM, 0x04, false },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP4, 0x00, 0x04, false },
 	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_RIGHT, 0x00, 0x08, false },
-	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP6, Common::KBD_NUM, 0x08, false},
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP6, 0x00, 0x08, false},
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP7, 0x00, 0x05, false },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP9, 0x00, 0x09, false },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP3, 0x00, 0x0A, false },
+	{ Common::EVENT_KEYDOWN, Common::EVENT_KEYUP, Common::KEYCODE_KP1, 0x00, 0x06, false },
 	{ Common::EVENT_WHEELUP, Common::EVENT_INVALID, Common::KEYCODE_INVALID, 0x00, 0x01, false },
 	{ Common::EVENT_WHEELDOWN, Common::EVENT_INVALID, Common::KEYCODE_INVALID, 0x00, 0x02, false },
 
@@ -300,10 +322,12 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 			if (evt.type == k.pressType && (k.kc == Common::KEYCODE_INVALID || evt.kbd.keycode == k.kc) && (k.kFlag == 0 || (evt.kbd.flags & k.kFlag))) {
 				if (!(_lastKeys & k.internalEvent)) {
 					_input.controllerFlags |= k.internalEvent;
-					if (k.internalEvent & 0x70) // The A, B and C buttons can be reconfigured in the main menu. This applies the setting.
-						_input.controllerFlagsRemapped |= (1 << _scdKeyConfigs[state.conf.controllerSetup][k.internalEvent >> 5]);
-					else
-						_input.controllerFlagsRemapped |= k.internalEvent;
+					// The A, B and C buttons can be reconfigured in the main menu. This applies the setting.
+					for (int f = 0; f < 3; ++f) {
+						if (k.internalEvent & (f << 5)) 
+							_input.controllerFlagsRemapped |= (1 << _scdKeyConfigs[state.conf.controllerSetup][f]);
+					}
+					_input.controllerFlagsRemapped |= (k.internalEvent & ~0x70);
 					_lastKeys |= k.internalEvent;
 					if (_keyRepeat || k.releaseType == Common::EVENT_INVALID)
 						_releaseKeys |= k.internalEvent;
@@ -326,6 +350,18 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 }
 
 void SnatcherEngine::updateChapter(GameState &state) {
+	// The chapterSub variable is an invention to emulate the interaction between the main thread and the
+	// vertical interrupt handlers in the original code. It may complicate things a bit (e. g. I have to
+	// provide means to drop out of several involved functions and continue with them later), but I still
+	// like this better than making the code multi-threaded, using a timer proc.
+
+	if (state.chapterSub & 0x80) {
+		if (!(_cmdQueue->enabled() || (_snd->pcmGetStatus().statusBits & 7)))
+			state.chapterSub &= ~0x80;
+		else
+			return;
+	}
+
 	switch (state.chapter) {
 	case 0:
 		// Intro and main menu
@@ -347,7 +383,7 @@ void SnatcherEngine::updateChapter(GameState &state) {
 		_cmdQueue->start();
 
 		++state.chapter;
-		state.chapter |= 0x80;
+		state.chapterSub |= 0x80;
 
 		break;
 
@@ -363,16 +399,38 @@ void SnatcherEngine::updateChapter(GameState &state) {
 			/* load savegame */
 		}
 
+		_ui->setControllerConfig(state.conf.controllerSetup);
+
 		_cmdQueue->start();
 		++state.chapter;
-		state.chapter |= 0x80;
+		state.chapterSub |= 0x80;
 		break;
 
 	case 2:
 		// Act I
-		_scriptEngine->run(_script);
-		_cmdQueue->start();
-		state.chapter |= 0xC0;
+		if (state.chapterSub & 0x40) {
+			if (_scriptEngine->postProcess(_script)) {
+				for (int i = 5; i < 15; ++i)
+					_gfx->setAnimParameter(i, GraphicsEngine::kAnimParaEnable, 0);
+				_cmdQueue->writeUInt16(0x22);
+				_cmdQueue->writeUInt32(0x139D0);
+				_cmdQueue->start();
+				state.chapterSub |= 0xA0;
+			}				
+			state.chapterSub &= ~0x40;
+		} else if (state.chapterSub & 0x20) {
+			_gfx->setVar(11, 0xFF);
+			if (!_ui->drawVerbs() || !_ui->verbsTabInputPrompt(_input.controllerFlagsRemapped)) {
+				state.chapterSub |= 0x80;
+			} else {
+				_scriptEngine->processInput();
+				state.chapterSub &= ~0x20;
+			}
+		} else if (state.chapterSub == 0) {
+			_scriptEngine->run(_script);
+			_cmdQueue->start();
+			state.chapterSub |= 0xC0;
+		}
 		break;
 
 	case 3:
@@ -385,27 +443,6 @@ void SnatcherEngine::updateChapter(GameState &state) {
 		break;
 
 	default:
-		if (state.chapter & 0x80) {
-			if (!(_cmdQueue->enabled() || (_snd->pcmGetStatus() & 7)))
-				state.chapter &= ~0x80;
-		} else if (state.chapter & 0x40) {
-			//_unkScrByte = 0;
-			if (_scriptEngine->postProcess(_script)) {
-				for (int i = 5; i < 15; ++i)
-					_gfx->setAnimParameter(i, GraphicsEngine::kAnimParaEnable, 0);
-				_cmdQueue->writeUInt16(0x22);
-				_cmdQueue->writeUInt32(0x139D0);
-				_cmdQueue->start();
-				state.chapter |= 0xA0;
-			}				
-			state.chapter &= ~0x40;
-		} else if (state.chapter & 0x20) {
-			_gfx->setVar(11, 0xFF);
-			//unkPostScriptUpdt
-			//updt_mult_sub_11004
-			//scriptUnkProcess
-			state.chapter &= ~0x20;
-		}		
 		break;
 	}
 }
@@ -454,7 +491,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			_snd->pcmInitSound(30);
 			break;
 		case 1:
-			if (!(_snd->pcmGetStatus() & 0x0F))
+			if (!(_snd->pcmGetStatus().statusBits & 0x0F))
 				++state.modProcessSub;
 			break;
 		case 2:
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index 1f1ca5aaf55..2c44b1f948c 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -39,6 +39,7 @@ class ResourcePointer;
 class ScriptEngine;
 class SoundEngine;
 class SceneModule;
+class UI;
 
 struct GameState;
 struct Script;
@@ -90,6 +91,7 @@ private:
 	// Graphics
 	GraphicsEngine *_gfx;
 	VMInfo _gfxInfo;
+	UI *_ui;
 
 	// Sound
 	SoundEngine *_snd;
diff --git a/engines/snatcher/sound.cpp b/engines/snatcher/sound.cpp
index b9d6bf23de1..685dd27c5e8 100644
--- a/engines/snatcher/sound.cpp
+++ b/engines/snatcher/sound.cpp
@@ -53,12 +53,17 @@ uint32 SoundEngine::cdaGetTime() const {
 	return _dev->cdaGetTime();
 }
 
-void SoundEngine::fmSendCommand(int cmd, int arg) {
-	_dev->fmSendCommand(cmd, arg);
+void SoundEngine::fmSendCommand(int cmd, int restoreVolume, int trackType) {
+	_dev->fmSendCommand(cmd, restoreVolume);
+
+	if (trackType == 1)
+		_fmStatus.music = (cmd == 0xFF) ? 0 : cmd;
+	else if (trackType == 2)
+		_fmStatus.sfx = (cmd == 61) ? 0 : cmd;
 }
 
-uint8 SoundEngine::fmGetStatus() const {
-	return _dev->fmGetStatus();
+const SoundEngine::FMStatus &SoundEngine::fmGetStatus() const {
+	return _fmStatus;
 }
 
 void SoundEngine::pcmSendCommand(int cmd, int arg) {
@@ -69,8 +74,8 @@ void SoundEngine::pcmInitSound(int sndId) {
 	_dev->pcmInitSound(sndId);
 }
 
-uint8 SoundEngine::pcmGetStatus() const {
-	return _dev->pcmGetStatus();
+const SoundEngine::PCMStatus &SoundEngine::pcmGetStatus() const {
+	return _pcmStatus;
 }
 
 void SoundEngine::pause(bool toggle) {
@@ -80,15 +85,17 @@ void SoundEngine::pause(bool toggle) {
 void SoundEngine::update() {
 	_dev->update();
 
-	uint8 fms = fmGetStatus();
-	if (_fmPlayingTracks.sync == (fms & 0x0F))
+	_pcmStatus.statusBits = _dev->pcmGetStatus();
+
+	uint8 fms = _dev->fmGetStatus();
+	if (_fmStatus.sync == (fms & 0x0F))
 		return;
 
 	if (fms & 0x80)
-		_fmPlayingTracks.music = 0;
+		_fmStatus.music = 0;
 	if (fms & 0x40)
-		_fmPlayingTracks.sfx = 0;
-	_fmPlayingTracks.sync = fms & 0x0F;
+		_fmStatus.sfx = 0;
+	_fmStatus.sync = fms & 0x0F;
 }
 
 void SoundEngine::setUnkCond(bool enable) {
diff --git a/engines/snatcher/sound.h b/engines/snatcher/sound.h
index b70c1662062..c168ed893bd 100644
--- a/engines/snatcher/sound.h
+++ b/engines/snatcher/sound.h
@@ -45,12 +45,28 @@ public:
 	bool cdaIsPlaying() const;
 	uint32 cdaGetTime() const;
 
-	void fmSendCommand(int cmd, int arg);
-	uint8 fmGetStatus() const;
+	struct FMStatus {
+		FMStatus() : music(0), sfx(0), sync(0), blocked(0) {}
+		uint8 music;
+		uint8 sfx;
+		uint8 sync;
+		uint8 blocked;
+	};
+
+	void fmSendCommand(int cmd, int restoreVolume, int trackType = 0);
+	const FMStatus &fmGetStatus() const;
+	void fmBlock(int block) { _fmStatus.blocked = block; }
+
+	struct PCMStatus {
+		PCMStatus() : statusBits(0), blocked(0) {}
+		uint8 statusBits;
+		uint8 blocked;
+	};
 
 	void pcmSendCommand(int cmd, int arg);
 	void pcmInitSound(int sndId);
-	uint8 pcmGetStatus() const;
+	const PCMStatus &pcmGetStatus() const;
+	void pcmBlock(int block) { _pcmStatus.blocked = block; }
 
 	void pause(bool toggle);
 	void update();
@@ -60,16 +76,9 @@ public:
 	void setMusicVolume(int vol);
 	void setSoundEffectVolume(int vol);
 
-	struct FMPlayingTracks {
-		FMPlayingTracks() : music(0), sfx(0), sync(0) {}
-		uint8 music;
-		uint8 sfx;
-		uint8 sync;
-	};
-
-	FMPlayingTracks _fmPlayingTracks;
-
 private:
+	FMStatus _fmStatus;
+	PCMStatus _pcmStatus;
 	SoundDevice *_dev;
 };
 
diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
index 4acf63739f5..41215746b8f 100644
--- a/engines/snatcher/sound_device_scd.cpp
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -25,7 +25,7 @@
 #include "common/array.h"
 #include "common/func.h"
 #include "common/ptr.h"
-#include "common/substream.h"
+#include "common/memstream.h"
 #include "common/system.h"
 #include "snatcher/resource.h"
 #include "snatcher/sound_device.h"
@@ -87,7 +87,7 @@ public:
 	bool cdaIsPlaying() const override;
 	uint32 cdaGetTime() const override;
 
-	void fmSendCommand(int cmd, int arg) override;
+	void fmSendCommand(int cmd, int restoreVolume) override;
 	uint8 fmGetStatus() const override;
 	void pcmSendCommand(int cmd, int arg) override;
 	void pcmInitSound(int sndId) override;
@@ -128,7 +128,15 @@ private:
 	void pcmDelayedStart();
 
 	typedef Common::SharedPtr<Common::SeekableReadStream> SmpStrPtr;
-	SmpStrPtr createSamplesStream(uint32 addr) const;
+	struct PCMCacheEntry {
+		PCMCacheEntry(uint32 ad, int16 no, Common::SharedPtr<uint8> ptr, uint32 sz) : addr(ad), resNo(no), data(ptr), dataSize(sz) {}
+		uint32 addr;
+		int16 resNo;
+		Common::SharedPtr<const uint8> data;
+		uint32 dataSize;
+	};
+	Common::Array<PCMCacheEntry> _pcmCache;
+	SmpStrPtr createSamplesStream(uint32 addr);
 
 	struct PCMResourceInfo {
 		uint8 prio;
@@ -176,6 +184,7 @@ private:
 	PCMResidentDataInfo *_pcmResidentDataInfo;
 	PCMInstrumentInfo *_pcmInstrumentInfo;
 	PCMSound *_pcmSounds;
+
 	bool _pcmDisableStereo;
 	int16 _pcmResourceNumber;
 	uint8 _pcmState;
@@ -1793,13 +1802,15 @@ uint32 SegaSoundDevice::cdaGetTime() const {
 	return Util::makeBCDTimeStamp(relTime);
 }
 
-void SegaSoundDevice::fmSendCommand(int cmd, int arg) {
+void SegaSoundDevice::fmSendCommand(int cmd, int restoreVolume) {
 	if (cmd == 0xFF) {
 		_faderFlags |= 4;
 		return;
 	}
-	if (cmd < 241 && arg)
+	if (cmd < 241 && restoreVolume) {
 		_faderFlags &= ~4;
+		_fmVolume1 = 0xFF;
+	}
 
 	_fmCmdQueue[_fmCmdQueueWPos++] = cmd;
 	if (_fmCmdQueueWPos == 128)
@@ -2082,22 +2093,30 @@ void SegaSoundDevice::pcmStartSound(uint8 sndId, int8 unit, uint8 vol) {
 }
 
 void SegaSoundDevice::pcmCheckPlayStatus() {
-	int num = (_pcmMode == 2 || _pcmMode == 0x82) ? 4 : 2;
+	int nu = (_pcmMode == 2 || _pcmMode == 0x82) ? 1 : 2;
+	int nc = (_pcmMode == 2 || _pcmMode == 0x82) ? 4 : 2;
 	uint8 flg = (_pcmMode == 2 || _pcmMode == 0x82) ? 2 : 8;
 
-	if (_pcmMode == 2) {
-		_faderTimer2 = 0;
-		_faderFlags = (_faderFlags & ~1) | 2;
-	}
-	
-	for (int i = 0; i < num; ++i) {
+	if (_pcmState & 1)
+		return;
+
+	for (int i = 0; i < nu; ++i) {
 		PCMSound &s = _pcmSounds[i];
 		if (s.prio == 0)
 			continue;
-
 		s.flags &= ~2;
-		if (!_sai->isPCMChannelPlaying(i << 1) && !_sai->isPCMChannelPlaying(((i << 1) | 1))) {
+
+		bool finished = true;
+		for (int ii = 0; ii < nc; ++ii) {
+			if (_sai->isPCMChannelPlaying((i << 1) + ii))
+				finished = false;
+		}
+		if (finished) {
 			pcmResetUnit(i, s);
+			if (_pcmMode == 2) {
+				_faderTimer2 = 0;
+				_faderFlags = (_faderFlags & ~1) | 2;
+			}
 			_pcmState &= ~flg;
 			_pcmMode = 0;
 		}
@@ -2140,9 +2159,14 @@ void SegaSoundDevice::pcmDelayedStart() {
 	_pcmState &= ~4;
 }
 
-SegaSoundDevice::SmpStrPtr SegaSoundDevice::createSamplesStream(uint32 addr) const {
+SegaSoundDevice::SmpStrPtr SegaSoundDevice::createSamplesStream(uint32 addr) {
 	uint32 numSamples = 0;
 
+	for (Common::Array<PCMCacheEntry>::const_iterator i = _pcmCache.begin(); i != _pcmCache.end(); ++i) {
+		if (i->addr == addr && i->resNo == _pcmResourceNumber)
+			return SmpStrPtr(new Common::MemoryReadStream(i->data.get(), i->dataSize, DisposeAfterUse::NO));
+	}
+
 	Common::SeekableReadStream *str = _fio->readStream(addr < 0x65000 ? 54 : 55);
 	if (!str)
 		error("%s(): Error reading file", __FUNCTION__);
@@ -2172,10 +2196,15 @@ SegaSoundDevice::SmpStrPtr SegaSoundDevice::createSamplesStream(uint32 addr) con
 			error("%s(): Samples stream overflow", __FUNCTION__);
 	}
 
-	str->seek(0);
-	Common::SeekableSubReadStream *subStr = new Common::SeekableSubReadStream(str, start, start + numSamples, DisposeAfterUse::YES);
+	str->seek(start, SEEK_SET);
+	uint8 *buff = new uint8[numSamples]();
+	str->read(buff, numSamples);
+
+	_pcmCache.push_back(PCMCacheEntry(addr, _pcmResourceNumber, Common::SharedPtr<uint8>(buff, Common::ArrayDeleter<const uint8>()), numSamples));
+	if (_pcmCache.size() > 10)
+		_pcmCache.erase(_pcmCache.begin());
 
-	return SmpStrPtr(subStr);
+	return SmpStrPtr(new Common::MemoryReadStream(buff, numSamples, DisposeAfterUse::NO));
 }
 
 void SegaSoundDevice::pcmResetUnit(uint8 unit, PCMSound &s) {
diff --git a/engines/snatcher/text.h b/engines/snatcher/text.h
index 8f0a23be1d9..8230b5a2779 100644
--- a/engines/snatcher/text.h
+++ b/engines/snatcher/text.h
@@ -66,4 +66,4 @@ public:
 
 } // End of namespace Snatcher
 
-#endif // SNATCHER_SOUND_H
+#endif // SNATCHER_TEXT_H
diff --git a/engines/snatcher/text_scd.cpp b/engines/snatcher/text_scd.cpp
index 4d035b90ab7..fd4f2d6b8de 100644
--- a/engines/snatcher/text_scd.cpp
+++ b/engines/snatcher/text_scd.cpp
@@ -58,7 +58,6 @@ private:
 	uint8 _pscr_byt8;
 	int16 _pscr_wd;
 	const uint8 *_textPtr;
-	uint8 *_renderBuffer;
 	Animator *_animator;
 	const uint8 *_font;
 	uint32 _fontSize;
@@ -66,14 +65,11 @@ private:
 	uint32 _charWidthTableSize;
 };
 
-TextRenderer_SCD::TextRenderer_SCD(Animator *animator) : TextRenderer(), _animator(animator), _textPtr(nullptr), _renderBuffer(nullptr), _needDraw(false), _block(false), _printDelay(0), _printDelayCounter(0), _color(0),
+TextRenderer_SCD::TextRenderer_SCD(Animator *animator) : TextRenderer(), _animator(animator), _textPtr(nullptr), _needDraw(false), _block(false), _printDelay(0), _printDelayCounter(0), _color(0),
 	_curX(0), _curY(0), _fixedWith9(false), _font(nullptr), _fontSize(0), _charWidthTable(nullptr), _charWidthTableSize(0), _pscr_byt8(0), _pscr_wd(0), _pscr_byt1(0), _pscr_byt2(0), _pscr_byt3(0) {
-	_renderBuffer = new uint8[0x2000]();
-	assert(_renderBuffer);
 }
 
 TextRenderer_SCD::~TextRenderer_SCD() {
-	delete[] _renderBuffer;
 }
 
 void TextRenderer_SCD::setFont(const uint8 *font, uint32 fontSize) {
@@ -104,8 +100,6 @@ void TextRenderer_SCD::draw() {
 	if (!_needDraw || _block)
 		return;
 
-	memset(_renderBuffer, 0, 0x2000);
-
 	int firstRow = -1;
 	int numRows = 0;
 	const uint8 *s = _textPtr;
@@ -181,7 +175,7 @@ void TextRenderer_SCD::draw() {
 	}
 	_textPtr = s;
 	if (numRows)
-		_animator->renderTextBuffer(_renderBuffer, firstRow, numRows);
+		_animator->renderTextBuffer(firstRow, numRows);
 }
 
 void TextRenderer_SCD::drawGlyph(uint16 ch) {
@@ -190,8 +184,9 @@ void TextRenderer_SCD::drawGlyph(uint16 ch) {
 		++x;
 
 	const uint8 *src = _font + (ch << 3);
-	uint8 *dst = _renderBuffer + ((_curY & ~7) << 7) + ((_curY & 7) << 2) + ((x & ~7) << 2) + ((x & 7) >> 1);
-	assert(dst < _renderBuffer + 0x2000);
+	uint8 *renderBuffer = _animator->getTextRenderBuffer();
+	uint8 *dst = renderBuffer + ((_curY & ~7) << 7) + ((_curY & 7) << 2) + ((x & ~7) << 2) + ((x & 7) >> 1);
+	assert(dst < renderBuffer + 0x2000);
 
 	if ((uint)(ch << 3) >= _fontSize)
 		error("%s(): Invalid char %04X", __FUNCTION__, ch);
@@ -217,7 +212,7 @@ void TextRenderer_SCD::drawGlyph(uint16 ch) {
 				++d;
 			if (++dXX == 8)
 				d += 28;
-			assert(d < _renderBuffer + 0x2000);
+			assert(d < renderBuffer + 0x2000);
 		}
 
 		dst += 4;
@@ -225,7 +220,7 @@ void TextRenderer_SCD::drawGlyph(uint16 ch) {
 			dY = 0;
 			dst += 992;
 		}
-		assert(dst < _renderBuffer + 0x2000);
+		assert(dst < renderBuffer + 0x2000);
 	}
 }
 
diff --git a/engines/snatcher/transition.h b/engines/snatcher/transition.h
index e55d1779428..30e0c289f1e 100644
--- a/engines/snatcher/transition.h
+++ b/engines/snatcher/transition.h
@@ -43,6 +43,8 @@ public:
 		uint16 hScrollTableNumEntries;
 		bool disableVScroll;
 		bool lineScrollMode;
+		bool verbsTabVisible;
+		bool busy;
 		struct HINT {
 			bool needUpdate;
 			bool enable;
@@ -83,4 +85,4 @@ public:
 
 } // End of namespace Snatcher
 
-#endif // SNATCHER_RENDER_H
+#endif // SNATCHER_TRANSITION_H
diff --git a/engines/snatcher/transition_scd.cpp b/engines/snatcher/transition_scd.cpp
index f547337d3e7..191f3b5f096 100644
--- a/engines/snatcher/transition_scd.cpp
+++ b/engines/snatcher/transition_scd.cpp
@@ -131,12 +131,12 @@ private:
 	uint8 _nextStepExt;
 	uint8 _lastStepExt;
 	int16 _trsFlagttt;
-	int16 _trsu_7;
 	int16 _hint_proc;
 	int16 _transitionType;
 	int16 _transitionState;
+	int16 _transitionState2;
 	int16 _transitionStep;
-	int16 _trsu_5;
+	int16 _tmpScrollOffset;
 	int16 _subPara;
 	uint32 _trs__DA;
 	uint16 _trs__DB;
@@ -157,16 +157,16 @@ private:
 	void trsUpdt_06(int arg);
 	void trsUpdt_screenShutter(int arg);
 	void trsUpdt_revealShutter(int arg);
-	void trsUpdt_13(int arg);
-	void trsUpdt_14(int arg);
-	void trsUpdt_showTextArea(int arg);
-	void trsUpdt_16(int arg);
-	void trsUpdt_17(int arg);
-	void trsUpdt_18(int arg);
-	void trsUpdt_19(int arg);
-	void trsUpdt_20(int arg);
-	void trsUpdt_21(int arg);
-	void trsUpdt_22(int arg);
+	void trsUpdt_showStdVerbsTab(int arg);
+	void trsUpdt_hideStdVerbsTab(int arg);
+	void trsUpdt_showDialogueTab1(int arg);
+	void trsUpdt_showVirtKeybTab(int arg);
+	void trsUpdt_hideVirtKeybTab(int arg);
+	void trsUpdt_showSmallVerbsTab(int arg);
+	void trsUpdt_hideSmallVerbsTab(int arg);
+	void trsUpdt_showDialogueTab2(int arg);
+	void trsUpdt_showMonitorTextField(int arg);
+	void trsUpdt_showDefaultTextScreen(int arg);
 	void trsUpdt_23(int arg);
 	void trsUpdt_24(int arg);
 	void trsUpdt_25(int arg);
@@ -175,20 +175,31 @@ private:
 	void trsUpdt_28(int arg);
 	void trsUpdt_29(int arg);
 
+	void textScreenTrsUpdate(int type, int hIntHandlerNo, int state);
+
 	typedef Common::Functor1Mem<Graphics::SegaRenderer*, void, TransitionManager_SCD> HINTFunc;
 	Common::Array<HINTFunc*> _hINTProcs;
 	const HINTFunc *_hINTHandler;
 
 	void setHINTHandler(uint8 num);
 
+	void hIntHandler_showVirtKeybTabStep1(Graphics::SegaRenderer *sr);
+	void hIntHandler_showVirtKeybTabStep2(Graphics::SegaRenderer *sr);
+	void hIntHandler_hideVirtKeybTabStep1(Graphics::SegaRenderer *sr);
+	void hIntHandler_hideVirtKeybTabStep2(Graphics::SegaRenderer *sr);
 	void hIntHandler_screenShutter(Graphics::SegaRenderer *sr);
 	void hIntHandler_revealShutter(Graphics::SegaRenderer *sr);
-	void hIntHandler_showTextArea(Graphics::SegaRenderer *sr);
+	void hIntHandler_toggleStdVerbsTab(Graphics::SegaRenderer *sr);
+	void hIntHandler_showDialogueTab1(Graphics::SegaRenderer *sr);
+	void hIntHandler_toggleSmallVerbsTab(Graphics::SegaRenderer *sr);
+	void hIntHandler_showDialogueTab2(Graphics::SegaRenderer *sr);
+	void hIntHandler_showMonitorTextField(Graphics::SegaRenderer *sr);
+	void hIntHandler_showDefaultTextScreen(Graphics::SegaRenderer *sr);
 };
 
 TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0), _hint_proc(0), _transitionStep(0),
 	_trsCommandExt(0), _trsCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _trs__DA(0), _trs__DB(0), _trsCmd_0xff_0xfd_0xfc_or0to6_last(0), _trsFlagttt(0),
-	_trsu_7(0), _transitionType(0), _transitionState(0), _trsu_5(0), _subPara(0), useEngineScrollOffsets(false), _hINTHandler(nullptr) {
+		_transitionType(0), _transitionState(0), _transitionState2(0), _tmpScrollOffset(0), _subPara(0), useEngineScrollOffsets(false), _hINTHandler(nullptr) {
 	_internalState = new ScrollInternalState[4];
 	assert(_internalState);
 	_internalState[kVertA].setFactor(-1);
@@ -260,12 +271,12 @@ bool TransitionManager_SCD::nextFrame() {
 			} else {
 				resetVars(0x18);
 			}
-		} else if (_nextStepExt != 0 && (_nextStepExt != 15 || _lastStepExt != 23)) {
-			_lastStepExt = _nextStepExt;
-			resetVars(0x40);
-		} else if (_nextStepExt != 0) {
+		} else if (_nextStepExt == 15 && _lastStepExt == 23) {
 			_nextStepExt = 23;
 			_trsFlagttt = 1;
+		} else if (_nextStepExt != 0) {
+			_lastStepExt = _nextStepExt;
+			resetVars(0x40);	
 		}
 	}
 
@@ -289,12 +300,13 @@ bool TransitionManager_SCD::nextFrame() {
 	}
 
 	processCmdInternal();
+	_result.busy = _lastStepExt;
 
 	return changed || reset || _result.hInt.needUpdate;
 }
 
 void TransitionManager_SCD::hINTCallback(void *segaRenderer) {
-	if (_hINTHandler && _hINTHandler->isValid())
+	if (_result.hInt.enable && _hINTHandler && _hINTHandler->isValid())
 		(*_hINTHandler)(static_cast<Graphics::SegaRenderer *>(segaRenderer));
 }
 
@@ -352,17 +364,26 @@ void TransitionManager_SCD::processTransition() {
 		_result.hInt.counter = 7;
 		break;
 	case 7: case 8:
+		_result.hInt.counter = 0;
 		break;
 	case 9:
 		_result.hInt.counter = 7;
 		break;
 	case 10: case 11:
+		_result.hInt.counter = 0;
 		break;
 	case 12: case 13: case 14: case 15: case 16:
+		_result.hInt.counter = 7;
 		break;
 	case 17:
+		_result.hInt.counter = 7;
+		//_internalState[kVertA].setNextOffset(_scrollu9);
+		//_internalState[kVertB].setNextOffset(_scrollu9);
 		break;
 	case 18: case 19: case 20: case 21:
+		_result.hInt.counter = 7;
+		_internalState[kVertA].setNextOffset(0);
+		_internalState[kVertB].setNextOffset(_transitionState);
 		break;
 	case 22: case 23:
 		break;
@@ -383,7 +404,8 @@ void TransitionManager_SCD::resetVars(int groupFlags) {
 		_trs__DA = 0;
 		_trs__DB = 0;
 		_nextStepExt = 0;
-		_transitionType = _transitionState = _trsu_5 = _subPara = _trsu_7 = 0;
+		_transitionType = _transitionState = _tmpScrollOffset = _subPara = 0;
+		_result.verbsTabVisible = false;
 		_trsFlagttt = 0;
 
 	}
@@ -400,7 +422,8 @@ void TransitionManager_SCD::resetVars(int groupFlags) {
 	}
 	if (groupFlags & 0x10) {
 		_nextStepExt = _lastStepExt = 0;
-		_transitionType = _trsu_7 = 0;
+		_transitionType = 0;
+		_result.verbsTabVisible = false;
 	}
 	if (groupFlags & 0x20) {
 		_trsFlagttt = 0;
@@ -408,7 +431,7 @@ void TransitionManager_SCD::resetVars(int groupFlags) {
 		_internalState[kVertB].setNextOffset(0);
 	}
 	if (groupFlags & 0x40) {
-		_transitionState = _trsu_5 = _subPara = 0;
+		_transitionState = _tmpScrollOffset = _subPara = 0;
 	}
 }
 
@@ -430,16 +453,16 @@ void TransitionManager_SCD::makeFunctions() {
 		TF(revealShutter),
 		TF(revealShutter),
 		TF(revealShutter),
-		TF(13),
-		TF(14),
-		TF(showTextArea),
-		TF(16),
-		TF(17),
-		TF(18),
-		TF(19),
-		TF(20),
-		TF(21),
-		TF(22),
+		TF(showStdVerbsTab),
+		TF(hideStdVerbsTab),
+		TF(showDialogueTab1),
+		TF(showVirtKeybTab),
+		TF(hideVirtKeybTab),
+		TF(showSmallVerbsTab),
+		TF(hideSmallVerbsTab),
+		TF(showDialogueTab2),
+		TF(showMonitorTextField),
+		TF(showDefaultTextScreen),
 		TF(23),
 		TF(24),
 		TF(25),
@@ -454,10 +477,10 @@ void TransitionManager_SCD::makeFunctions() {
 
 	typedef void (TransitionManager_SCD::*HIFunc)(Graphics::SegaRenderer*);
 	static const HIFunc funcTbl2[] = {
-		nullptr,
-		nullptr,
-		nullptr,
-		nullptr,
+		HF(showVirtKeybTabStep1),
+		HF(showVirtKeybTabStep2),
+		HF(hideVirtKeybTabStep1),
+		HF(hideVirtKeybTabStep2),
 		nullptr,
 		nullptr,
 		nullptr,
@@ -467,9 +490,16 @@ void TransitionManager_SCD::makeFunctions() {
 		nullptr,
 		nullptr,
 		nullptr,
+		HF(toggleStdVerbsTab),
 		nullptr,
+		HF(showDialogueTab1),
 		nullptr,
-		HF(showTextArea)
+		nullptr,
+		HF(toggleSmallVerbsTab),
+		nullptr,
+		HF(showDialogueTab2),
+		HF(showMonitorTextField),
+		HF(showDefaultTextScreen)
 	};
 
 	for (uint i = 0; i < ARRAYSIZE(funcTbl2); ++i) \
@@ -541,40 +571,170 @@ void TransitionManager_SCD::trsUpdt_revealShutter(int arg) {
 	}
 }
 
-void TransitionManager_SCD::trsUpdt_13(int arg) {
+void TransitionManager_SCD::trsUpdt_showStdVerbsTab(int arg) {
+	if (arg == 0) {
+		_transitionType = 7;
+		setHINTHandler(13);
+		_transitionState = 252;
+		_tmpScrollOffset = 144;
+		++_subPara;
+	} else if (arg == 1) {
+		_transitionState -= 19;
+		_tmpScrollOffset += 19;
+		if (_tmpScrollOffset > 255) {
+			_transitionState = 136;
+			_tmpScrollOffset = 256;
+			_result.verbsTabVisible = true;
+			++_subPara;
+		}
+	}
 }
 
-void TransitionManager_SCD::trsUpdt_14(int arg) {
+void TransitionManager_SCD::trsUpdt_hideStdVerbsTab(int arg) {
+	if (arg == 0) {
+		_transitionType = 8;
+		setHINTHandler(13);
+		_transitionState = 140;
+		_tmpScrollOffset = 256;
+		++_subPara;
+	} else if (arg == 1) {
+		_transitionState += 19;
+		_tmpScrollOffset -= 19;
+		if (_tmpScrollOffset < 144) {
+			_tmpScrollOffset = 144;
+			++_subPara;
+		}
+	} else {
+		resetVars(0x18);
+	}
 }
 
-void TransitionManager_SCD::trsUpdt_showTextArea(int arg) {
-	if (arg != 0)
-		return;
-	_transitionType = 9;
-	setHINTHandler(15);
-	_transitionState = 256;
-	++_subPara;
+void TransitionManager_SCD::trsUpdt_showDialogueTab1(int arg) {
+	if (arg == 0)
+		textScreenTrsUpdate(9, 15, 256);
 }
 
-void TransitionManager_SCD::trsUpdt_16(int arg) {
+void TransitionManager_SCD::trsUpdt_showVirtKeybTab(int arg) {
+	switch (arg) {
+	case 0:
+		_transitionType = 10;
+		setHINTHandler(0);
+		_transitionState = 100;
+		++_subPara;
+		break;
+	case 1:
+		_transitionState += 3;
+		if (_transitionState < 117)
+			return;
+		_transitionState = 117;
+		setHINTHandler(1);
+		++_subPara;
+		break;
+	case 2:
+		_transitionState = 0;
+		++_subPara;
+		break;
+	case 3:
+		_transitionState += 10;
+		if (_transitionState < 112)
+			return;
+		_transitionState = 112;
+		++_subPara;
+		break;
+	case 4:
+		_result.verbsTabVisible = true;
+		++_subPara;
+		break;
+	default:
+		break;
+	}
 }
 
-void TransitionManager_SCD::trsUpdt_17(int arg) {
+void TransitionManager_SCD::trsUpdt_hideVirtKeybTab(int arg) {
+	switch (arg) {
+	case 0:
+		_transitionType = 11;
+		setHINTHandler(2);
+		_transitionState = 112;
+		_transitionState2 = 117;
+		_tmpScrollOffset = 320;
+		++_subPara;
+		break;
+	case 1:
+		_transitionState2 -= 3;
+		_tmpScrollOffset += 3;
+		if (_transitionState2 < 101) {
+			_transitionState2 = 101;
+			++_subPara;
+		}
+		break;
+	case 2:
+		_transitionState = 112;
+		++_subPara;
+		break;
+	case 3:
+		setHINTHandler(3);
+		++_subPara;
+		break;
+	case 4:
+		_transitionState -= 10;
+		if (_transitionState < 0) {
+			_transitionState = 0;
+			++_subPara;
+		}
+		break;
+	default:
+		resetVars(0x18);
+		break;
+	}
 }
 
-void TransitionManager_SCD::trsUpdt_18(int arg) {
+void TransitionManager_SCD::trsUpdt_showSmallVerbsTab(int arg) {
+	if (arg == 0) {
+		_transitionType = 12;
+		setHINTHandler(18);
+		_transitionState = 144;
+		++_subPara;
+	} else if (arg == 1) {
+		_transitionState += 19;
+		if (_transitionState > 239) {
+			_transitionState = 240;
+			_result.verbsTabVisible = true;
+			++_subPara;
+		}
+	}
 }
 
-void TransitionManager_SCD::trsUpdt_19(int arg) {
+void TransitionManager_SCD::trsUpdt_hideSmallVerbsTab(int arg) {
+	if (arg == 0) {
+		_transitionType = 13;
+		setHINTHandler(18);
+		_transitionState = 240;
+		++_subPara;
+	} else if (arg == 1) {
+		_transitionState -= 19;
+		if (_transitionState < 144) {
+			_transitionState = 144;
+			++_subPara;
+		}
+	} else {
+		resetVars(0x18);
+	}
 }
 
-void TransitionManager_SCD::trsUpdt_20(int arg) {
+void TransitionManager_SCD::trsUpdt_showDialogueTab2(int arg) {
+	if (arg == 0)
+		textScreenTrsUpdate(14, 20, 240);
 }
 
-void TransitionManager_SCD::trsUpdt_21(int arg) {
+void TransitionManager_SCD::trsUpdt_showMonitorTextField(int arg) {
+	if (arg == 0)
+		textScreenTrsUpdate(15, 21, 328);
 }
 
-void TransitionManager_SCD::trsUpdt_22(int arg) {
+void TransitionManager_SCD::trsUpdt_showDefaultTextScreen(int arg) {
+	if (arg == 0)
+		textScreenTrsUpdate(16, 22, 232);
 }
 
 void TransitionManager_SCD::trsUpdt_23(int arg) {
@@ -598,6 +758,14 @@ void TransitionManager_SCD::trsUpdt_28(int arg) {
 void TransitionManager_SCD::trsUpdt_29(int arg) {
 }
 
+void TransitionManager_SCD::textScreenTrsUpdate(int type, int hIntHandlerNo, int state) {
+	_transitionType = type;
+	setHINTHandler(hIntHandlerNo);
+	_transitionState = state;
+	++_subPara;
+}
+
+
 void TransitionManager_SCD::setHINTHandler(uint8 num) {
 	if (num < _hINTProcs.size())
 		_hINTHandler = _hINTProcs[num];
@@ -605,6 +773,57 @@ void TransitionManager_SCD::setHINTHandler(uint8 num) {
 		error("%s(): Invalid HINT handler %d", __FUNCTION__, num);
 }
 
+void TransitionManager_SCD::hIntHandler_showVirtKeybTabStep1(Graphics::SegaRenderer *sr) {
+	if (_transitionStep == 99) {
+		sr->writeUint16VSRAM(0, TO_BE_16(0x140));
+		sr->writeUint16VSRAM(2, TO_BE_16(0x140));
+	} else if (_transitionStep == _transitionState) {
+		sr->writeUint16VSRAM(0, TO_BE_16(_result.realOffsets[kVertA]));
+		sr->writeUint16VSRAM(2, TO_BE_16(_result.realOffsets[kVertB]));
+		_result.hInt.enable = false;
+	}
+	++_transitionStep;
+}
+
+void TransitionManager_SCD::hIntHandler_showVirtKeybTabStep2(Graphics::SegaRenderer *sr) {
+	if (_transitionStep == 99) {
+		sr->writeUint16VSRAM(0, TO_BE_16(0x140));
+		sr->writeUint16VSRAM(2, TO_BE_16(0x140));
+	} else if (_transitionStep == 117) {
+		sr->writeUint16VSRAM(0, TO_BE_16(_result.realOffsets[kVertA]));
+		sr->writeUint16VSRAM(2, TO_BE_16(_result.realOffsets[kVertB]));
+	} else if (_transitionStep == 143) {
+		sr->writeUint16VSRAM(0, TO_BE_16(_transitionState));
+		sr->writeUint16VSRAM(2, TO_BE_16(_transitionState));
+		_result.hInt.enable = false;
+	}
+	++_transitionStep;
+}
+
+void TransitionManager_SCD::hIntHandler_hideVirtKeybTabStep1(Graphics::SegaRenderer *sr) {
+	if (_transitionStep == 99) {
+		sr->writeUint16VSRAM(0, TO_BE_16(_tmpScrollOffset));
+		sr->writeUint16VSRAM(2, TO_BE_16(_tmpScrollOffset));
+	} else if (_transitionStep == 143) {
+		sr->writeUint16VSRAM(0, TO_BE_16(0x70));
+		sr->writeUint16VSRAM(2, TO_BE_16(0x70));
+		_result.hInt.enable = false;
+	} else if (_transitionStep == _transitionState2) {
+		sr->writeUint16VSRAM(0, TO_BE_16(_result.realOffsets[kVertA]));
+		sr->writeUint16VSRAM(2, TO_BE_16(_result.realOffsets[kVertB]));
+	}
+	++_transitionStep;
+}
+
+void TransitionManager_SCD::hIntHandler_hideVirtKeybTabStep2(Graphics::SegaRenderer *sr) {
+	if (_transitionStep == 143) {
+		sr->writeUint16VSRAM(0, TO_BE_16(_transitionState));
+		sr->writeUint16VSRAM(2, TO_BE_16(_transitionState));
+		_result.hInt.enable = false;
+	}
+	++_transitionStep;
+}
+
 void TransitionManager_SCD::hIntHandler_screenShutter(Graphics::SegaRenderer *sr) {
 	if (_transitionState <= 0 || _transitionStep == (_transitionState == 1 ? 8 : 10)) {
 		_result.hInt.enable = false;
@@ -661,7 +880,17 @@ void TransitionManager_SCD::hIntHandler_revealShutter(Graphics::SegaRenderer *sr
 	++_transitionStep;
 }
 
-void TransitionManager_SCD::hIntHandler_showTextArea(Graphics::SegaRenderer *sr) {
+void TransitionManager_SCD::hIntHandler_toggleStdVerbsTab(Graphics::SegaRenderer *sr) {
+	if (_transitionStep++ != _transitionState)
+		return;
+	sr->writeUint16VSRAM(0, TO_BE_16(_tmpScrollOffset));
+	sr->writeUint16VSRAM(2, TO_BE_16(_tmpScrollOffset));
+	sr->writeUint16VRAM(0xF800, 0);
+	sr->writeUint16VRAM(0xF802, 0);
+	_result.hInt.enable = false;
+}
+
+void TransitionManager_SCD::hIntHandler_showDialogueTab1(Graphics::SegaRenderer *sr) {
 	if (_transitionStep++ != 17)
 		return;
 	sr->writeUint16VSRAM(0, TO_BE_16(_transitionState));
@@ -671,6 +900,37 @@ void TransitionManager_SCD::hIntHandler_showTextArea(Graphics::SegaRenderer *sr)
 	_result.hInt.enable = false;
 }
 
+void TransitionManager_SCD::hIntHandler_toggleSmallVerbsTab(Graphics::SegaRenderer *sr) {
+	if (_transitionStep++ != 19)
+		return;
+	sr->writeUint16VSRAM(0, TO_BE_16(_transitionState));
+	sr->writeUint16VSRAM(2, TO_BE_16(_transitionState));
+	sr->writeUint16VRAM(0xF800, 0);
+	sr->writeUint16VRAM(0xF802, 0);
+	_result.hInt.enable = false;
+}
+
+void TransitionManager_SCD::hIntHandler_showDialogueTab2(Graphics::SegaRenderer *sr) {
+	if (_transitionStep++ != 19)
+		return;
+	sr->writeUint16VSRAM(0, TO_BE_16(_transitionState));
+	_result.hInt.enable = false;
+}
+
+void TransitionManager_SCD::hIntHandler_showMonitorTextField(Graphics::SegaRenderer *sr) {
+	if (_transitionStep++ != 8)
+		return;
+	sr->writeUint16VSRAM(0, TO_BE_16(_transitionState));
+	_result.hInt.enable = false;
+}
+
+void TransitionManager_SCD::hIntHandler_showDefaultTextScreen(Graphics::SegaRenderer *sr) {
+	if (_transitionStep++ != 20)
+		return;
+	sr->writeUint16VSRAM(0, TO_BE_16(_transitionState));
+	_result.hInt.enable = false;
+}
+
 TransitionManager *TransitionManager::createSegaTransitionManager(GraphicsEngine::GfxState &state) {
 	return new TransitionManager_SCD(state);
 }
diff --git a/engines/snatcher/ui.cpp b/engines/snatcher/ui.cpp
new file mode 100644
index 00000000000..e1da47add04
--- /dev/null
+++ b/engines/snatcher/ui.cpp
@@ -0,0 +1,1093 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#include "snatcher/graphics.h"
+#include "snatcher/resource.h"
+#include "snatcher/script.h"
+#include "snatcher/ui.h"
+
+
+namespace Snatcher {
+
+UI::UI(GraphicsEngine *gfx, CmdQueue *que, ResourcePointer *scd) : _gfx(gfx), _que(que), _scd(scd), _sceneId(0), _textLineBreak(0), _dialogTextBuffer(nullptr), _textColor(0),
+	_scriptTextResource(nullptr),/*_makestrbt1(0),*/ _textY(0), _textY2(0), _sceneTextOffsCur(0), _textLineEnd(0), _sceneInfo(0), _sceneTextOffset(0), _transDW1(0), _transDW2(0),
+		_sceneTextOffsStart(0), _waitCursorFrame(0), _waitCursorAnimDelay(0), _progress(-1), _progress2(-1), _controllerCfg(0), _verbsTabLayout(0), _verbsInterpreterMode(0),
+			_una_6(0), _numVerbsFirstPage(0), _numVerbsLastPage(0), _una_3(0), _numVerbsMax(0), _una_rr_hi(0), _una_rr_lo(0), _verbsTabCurPage(0), _lastVerbDrawn(0), _verbTextBuffer(nullptr), _scriptVerbsArray(nullptr),
+				_scriptSentenceArray(nullptr), _prevSelectedVerb(0), _selectedVerb(0), _lastHiliteVerb(0), _hiliteVerb(0), _transit_02(0), _textInputMarginLeft(0), _drawVerbsWd1(0),
+					_textInputColumnCur(0), _textInputColumnMax(0), _textInputCursorState(0), _textInputCursorBlinkCnt(0), _underscoreStr(nullptr), _textInputStr(nullptr), _vkeybPosTotal(0),
+						_vkeybColumnWidth(0), _verbsTabLayoutMap(nullptr), _verbsTabOffsX(0), _verbsTabOffsY(0), _hilitePosX(0), _hilitePosY(0), _vkeybVisible(false) {
+
+	_dialogTextBuffer = new uint8[256]();
+	_verbTextBuffer = new uint8[50]();
+	_underscoreStr = new uint8[12]();
+	_textInputStr = new uint8[30]();
+}
+
+UI::~UI() {
+	delete[] _dialogTextBuffer;
+	delete[] _verbTextBuffer;
+	delete[] _underscoreStr;
+	delete[] _textInputStr;
+}
+
+bool UI::displayDialog(int sceneInfo, int sceneTextOffset, uint16 inputFlags) {
+	if (_progress == -1)
+		_progress = 0;
+
+	if (/*_gfxOps_var1 || */(inputFlags & 0x100))
+		_gfx->setTextPrintDelay(0);
+
+	if (_gfx->isTextInQueue())
+		return false;
+
+	switch (_progress) {
+	case 0:
+		for (int i = 5; i < 15; ++i)
+			_gfx->setAnimParameter(i, GraphicsEngine::kAnimParaEnable, 0);
+		_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaEnable, 0);
+		_gfx->enqueuePaletteEvent(_scd->makePtr(0x13622));
+		++_progress;
+		break;
+
+	case 1:
+		_gfx->setVar(11, 0xFF);
+		_progress = 9;
+		break;
+
+	case 2:
+		if (_sceneId == 0) {
+			_gfx->transitionCommand(21);
+			//_c13Valu = 0xFF;
+			_textY = _textY2;
+		} else if (_sceneId == 0xFF) {
+			_textY = _textY2;
+		} else {
+			printDialogStringHead();
+		}
+		++_progress;
+		break;
+
+	case 3:
+		printDialogStringBody();
+		if (checkStringPrintProgress())
+			++_progress;
+		break;
+
+	case 4:
+		_waitCursorFrame = 0;
+		_waitCursorAnimDelay = 1;
+		if (!_sceneId)
+			_gfx->setAnimParameter(31, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide);
+		++_progress;
+		break;
+
+	case 5:
+		if (!waitWithCursorAnim(inputFlags))
+			return false;
+		_gfx->transitionCommand(0xFE);
+		if (_textLineEnd) {
+			_progress = 6;
+			if (!_sceneId)
+				_gfx->setAnimParameter(31, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+		} else {
+			_progress = 7;
+		}
+		break;
+
+	case 6:
+		_sceneTextOffset = _sceneInfo = 0;
+		//if (!_sceneId)
+		//	_c13Valu = 0xFF;
+		_progress = -1;
+		break;
+
+	case 7:
+		_gfx->resetTextFields();
+		++_progress;
+		break;
+
+	case 8:
+		_gfx->transitionCommand(_gfx->getVerbAreaType() == 0 ? 15 : (_gfx->getVerbAreaType() == 1 ? 20 : 22));
+		_progress = 2;
+		break;
+
+	case 9:
+		_sceneInfo = sceneInfo;
+		_sceneTextOffset = sceneTextOffset;
+		_gfx->enqueueDrawCommands(_scd->makePtr(0xECB6));
+		++_progress;
+		break;
+
+	case 10:
+		_sceneTextOffsStart = _sceneTextOffset;
+		_gfx->resetTextFields();
+		_sceneId = (_sceneInfo & 0xFF) - 1;
+
+		_sceneTextOffsCur = _sceneTextOffsStart;
+		_textLineEnd = 0;
+		//_gfxOps10_sub_974B = _gfxOps10_sub_974E = 0;
+		//_gfxOps10_subword_974C = 0;
+		_textColor = 1;
+
+		_gfx->transitionCommand(_gfx->getVerbAreaType() == 0 ? 15 : (_gfx->getVerbAreaType() == 1 ? 20 : 22));
+		//_c13Valu = 0;
+		_progress = 2;
+		break;
+
+	default:
+		error("%s(): Unknown state %d", __FUNCTION__, _progress);
+		break;
+	}
+
+	return (_progress == -1);
+}
+
+bool UI::drawVerbs() {
+	if (_progress2 == -1)
+		_progress2 = 0;
+
+	if (_verbsInterpreterMode == 2) 
+		_progress2 |= 0x80;
+
+	if (_progress2 == 0) {
+		if (_gfx->getVerbAreaType()) {
+			_una_6 = 5;
+			_numVerbsFirstPage = 4;
+			_numVerbsLastPage = 3;
+			_una_3 = 4;
+			_numVerbsMax = 6;
+		} else {
+			_una_6 = 6;
+			_numVerbsFirstPage = 5;
+			_numVerbsLastPage = 2;
+			_una_3 = 3;
+			_numVerbsMax = 7;
+		}
+
+		if (_scriptVerbsArray->pos() >= 9) {
+			if (_scriptTextResource[_scriptVerbsArray->read(0)] < 'A') {
+				_verbsTabLayout = 2;
+				_que->writeUInt16(0x22);
+				_que->writeUInt32(0x1138C);
+			} else {
+				_verbsTabLayout = 3;
+				_que->writeUInt16(0x22);
+				_que->writeUInt32(0x11382);
+			}
+			_que->start();
+			_progress2 = 1;
+			return false;
+		}
+	}
+
+	if (_progress2 <= 1) {
+		_que->writeUInt16(0x16);
+		_que->start();
+		_progress2 = 2;
+		return false;
+	}
+
+	if (_verbsTabLayout < 2) {
+		if (_progress2 == 2) {
+			_una_rr_hi = _una_rr_lo = 0;
+
+			static const uint8 strHead[] = { 0xFC, 0x00, 0xF9, 0x01, 0xFE, 0x04, 0xFB };
+			memcpy(_verbTextBuffer, strHead, sizeof(strHead));
+			_verbTextBuffer[41] = 0xFF;
+
+			_verbsTabCurPage = 0;
+			bool sp7 = (_scriptVerbsArray->pos() == 7 && _gfx->getVerbAreaType() != 0);
+			if (sp7) {
+				_numVerbsLastPage = 2;
+				_una_3 = 3;
+			}
+			if (_scriptVerbsArray->pos() == 8 || sp7) {
+				_verbsTabCurPage = 1;
+				if (_scriptSentenceArray->pos() == 0) {
+					if (_una_6 <= _prevSelectedVerb) {
+						_verbsTabCurPage = 2;
+						_prevSelectedVerb -= _numVerbsFirstPage;
+					}
+				}
+			}
+			_progress2 = 3;
+		}
+
+		if (_progress2 >= 3 && _progress2 < 97) {
+			uint8 res = (_progress2 - 3 < _numVerbsMax) ? drawVerb(_progress2 - 3) : 0xFF;
+			if (res == 0xFF) {
+				_lastVerbDrawn = _progress2 - 3;
+				_progress2 = 97;
+			} else if (res != 0x80) {
+				_verbTextBuffer[7] = 0x10;
+				_verbTextBuffer[8] = res * 9;
+				_gfx->printText(_verbTextBuffer);
+			} else {
+				_que->start();
+			}
+			if (_progress2 < 97) {
+				++_progress2;
+				return false;
+			}
+		}
+
+		if (_progress2 == 97) {
+			if (_verbsTabCurPage == 2)
+				_lastVerbDrawn = _numVerbsMax;
+
+			_selectedVerb = 0;
+			uint8 v = 0;
+			if (_scriptSentenceArray->pos() == 0) {
+				if (_prevSelectedVerb <= _lastVerbDrawn - 1)
+					v = _prevSelectedVerb;
+			}
+			_selectedVerb = 0;
+			_hiliteVerb = _lastHiliteVerb = v;
+			++_progress2;
+		}
+
+		if (_progress2 == 98) {
+			drawHiliteVerb(0);
+			++_progress2;
+			return false;
+		}
+
+		if (_progress2 == 99) {
+			_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaPosX, 16);
+			drawHiliteVerb(1);
+			++_progress2;
+			return false;
+		}
+	} else {
+		if (_progress2 == 2) {
+			if (_verbsTabLayout == 2) {
+				_que->writeUInt16(0x05);
+				_que->writeUInt32(0x11454);
+				_que->start();
+			}
+			++_progress2;
+			return false;
+		}
+		if (_progress2 == 3) {
+			if (_verbsTabLayout == 2) {
+				_gfx->transitionCommand(15);
+			} else {
+				_gfx->transitionCommand(16);
+				_vkeybVisible = true;
+			}
+			++_progress2;
+			return false;
+		}
+		if (_progress2 == 4) {
+			_textInputMarginLeft = 64;
+			_textInputColumnCur = 0;
+			if (_textInputColumnMax == 0) {
+				_textInputColumnMax = (_verbsTabLayout == 2) ? 10 : 17;
+				_textInputMarginLeft = (_verbsTabLayout == 2) ? 24 : 48;
+				_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaFrame, _verbsTabLayout == 2 ? 2 : 0);
+			}
+			++_progress2;
+		}
+		if (_progress2 == 5) {
+			if (drawUnderscoreString())
+				++_progress2;
+			return false;
+		}
+		if (_progress2 == 6) {
+			_textInputCursorState = 0;
+			_textInputColumnCur = 0;
+			drawUnderscoreCursor();
+			++_progress2;
+			return false;
+		}
+		if (_progress2 == 7) {
+			const uint8 *src = _scd->makePtr(0x11D12)();
+			uint8 *dst = _dialogTextBuffer;
+			for (int i = 0; i < 256; ++i) {
+				*dst = *src++;
+				if (*dst++ == 0xFF)
+					break;
+			}
+			_dialogTextBuffer[5] = _dialogTextBuffer[46] = _textInputMarginLeft;
+			_dialogTextBuffer[6] = _dialogTextBuffer[47] = 24;
+			memset(_textInputStr, 0, 30);
+			_selectedVerb = 0;
+
+			static const uint8 offs[] = { 0x2D, 0x06, 0x1B, 0x1A, 0xC0, 0x87, 0x10, 0x90 };
+
+			_vkeybPosTotal = offs[((_verbsTabLayout - 2) << 1)];
+			_vkeybColumnWidth = offs[((_verbsTabLayout - 2) << 1) + 1];
+			_verbsTabOffsX = offs[((_verbsTabLayout - 2) << 1) + 4];
+			_verbsTabOffsY = offs[((_verbsTabLayout - 2) << 1) + 5];
+			adjustHilitePos();
+
+			_progress2 = 100;
+			return false;
+		}
+	}
+
+	return true;
+}
+
+bool UI::verbsTabInputPrompt(uint16 inputFlags) {
+	assert (_progress2 >= 100);
+	if (_verbsInterpreterMode == 2) {
+		if (_progress2 & 0x80) {
+			verbSelect2setResult();
+			_progress2 &= ~0x80;
+			if (_progress2 < 104)
+				_progress2 = 104;
+		}
+	} else {
+		if (_progress2 == 100) {
+			if (_verbsTabLayout < 2)
+				_gfx->transitionCommand(_gfx->getVerbAreaType() ? 18 : 13);
+			++_progress2;
+		}
+
+		if (_progress2 == 101) {
+			if (!_gfx->isVerbsTabActive())
+				return false;
+			++_progress2;
+		}
+
+		if (_progress2 == 102) {
+			_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaEnable, 1);
+			if (_verbsTabLayout >= 2) {
+				_verbsTabLayoutMap = _scd->makePtr(_verbsTabLayout == 3 ? 0x11512 : 0x114DC)();
+				_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
+				_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
+				_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaFrame, _verbsTabLayout == 2 ? 2 : 0);
+			} else {
+				_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaControlFlags, 0);
+			}
+			++_progress2;
+			return false;
+		}
+
+		if ((_progress2 & 0xFF) == 103) {
+			verbsTabHandleInput(inputFlags);
+			if (_selectedVerb == 0)
+				return false;
+			++_progress2;
+		}
+
+		if (_progress2 & 0x100) {
+			if (verbSelect2())
+				virtKeybPrint();
+			else if (_selectedVerb != 0)
+				++_progress2;
+			return false;
+		}
+
+		if (_progress2 & 0x200) {
+			virtKeybPrint();
+			return false;
+		}
+	}
+
+	if (_progress2 == 104) {
+		_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
+		++_progress2;
+	}
+
+	if (_verbsTabLayout < 2) {
+		if (_progress2 == 105) {
+			_gfx->transitionCommand(_gfx->getVerbAreaType() ? 19 : 14);
+			++_progress2;
+		}
+
+		if (_progress2 == 106) {
+			if (_gfx->transitionStateBusy())
+				return false;
+			++_progress2;
+		}
+		if (_progress2 == 107)
+			_drawVerbsWd1 = _textInputColumnMax = 0;
+
+		if (_progress2 >= 109 && _progress <= 127) {
+			verbTabSwapPage();
+			if (_progress2 == 103) {
+				drawHiliteVerb(0);
+				_progress2 |= 0x100;
+			}
+			return false;
+		}
+
+	} else {
+		if (_progress2 == 105) {
+			_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
+			_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
+			if (_verbsTabLayout == 2)
+				_gfx->transitionCommand(0xFE);
+			else if (_vkeybVisible) {
+				_vkeybVisible = false;
+				_gfx->transitionCommand(17);
+			}
+			++_progress2;
+			return false;
+		}
+
+		if (_progress2 == 106) {
+			if (_gfx->transitionStateBusy())
+				return false;
+			++_progress2;
+		}
+
+		if (_progress2 == 107) {
+			_que->writeUInt16(0x16);
+			_que->start();
+			++_progress2;
+			return false;
+		}
+
+		if (_progress2 == 108) {
+			if (++_verbsInterpreterMode != 2) {
+				_verbsInterpreterMode = 0;
+				_verbsTabLayout = 0;
+			}
+			_drawVerbsWd1 = 0;
+			_textInputColumnMax = 0;
+		}
+	}
+
+	_progress2 = -1;
+	return true;
+}
+
+void UI::setVerbsTabLayout(uint16 layout) {
+	_verbsTabLayout = layout;
+	if (layout == 1)
+		_transDW1 = _transDW2 = 0;
+}
+
+void UI::setInterpreterMode(uint16 mode) {
+	_verbsInterpreterMode = mode;
+}
+
+void UI::printDialogStringHead() {
+	static const uint8 strHead[] = { 0xFC, 0x00, 0xF9, 0x01, 0xFB, 0x10, 0x00, 0xFE };
+	const uint8 *s = _scd->makePtr(0x13552).getDataFromTable(_sceneId)();
+	memcpy(_dialogTextBuffer, strHead, sizeof(strHead));
+	_dialogTextBuffer[6] = _textY2;
+	_dialogTextBuffer[8] = (*s & 0x80) ? 3 : (*s++ & 7);
+	uint8 *d = _dialogTextBuffer + 9;
+
+	for (int i = 0; i < 25; ++i) {
+		*d++ = *s;
+		if (*s++ == 0xFF)
+			break;
+	}
+
+	assert(*(d - 1) == 0xFF);
+
+	_gfx->printText(_dialogTextBuffer);
+	_textY = _textY2 + 9;
+}
+
+void UI::printDialogStringBody() {
+	static const uint8 strHead[] = { 0xFC, 0x01, 0xF9, 0x01, 0xFE, 0x00, 0xFB };
+	static const uint8 buttonTable[3][6] = {
+		{ 'A', 'A', 'B', 'C', 'C', 'B' },
+		{ 'B', 'C', 'A', 'A', 'B', 'C' },
+		{ 'C', 'B', 'C', 'B', 'A', 'A' }
+	};
+
+	memcpy(_dialogTextBuffer, strHead, sizeof(strHead));
+	_dialogTextBuffer[5] = _textColor;
+	uint8 *d = _dialogTextBuffer + sizeof(strHead);
+	//_makestrbt1 = 0xFF;
+	*d++ = _sceneId ? 24 : 40;
+	*d++ = _textY;
+
+	_textLineBreak = 0;
+	assert(_scriptTextResource);
+	const uint8 *s = _scriptTextResource + _sceneTextOffsCur;
+	for (int i = 0; i < 50;++i) {
+		uint8 in = *s++;
+		++_sceneTextOffsCur;
+		switch (in) {
+		case 0xFF:
+			_textLineEnd = 1;
+			i = 49;
+			break;
+		case 0xF6:
+			_textLineBreak = 3;
+			i = 49;
+			break;;
+		case 0xF4:
+			_sceneInfo = 2;
+			break;
+		case 0xF2:
+			_textLineBreak = 1;
+			i = 49;
+			break;
+		case 0xF0:
+		case 0xEE:
+		case 0xEC:
+			*d++ = buttonTable[(in - 0xEC) >> 1][_controllerCfg];
+			break;
+		default:
+			if (in < 0xF8) {
+				*d++ = in;
+			} else {
+				*d++ = 0xFE;
+				*d++ = _textColor = in & 7;
+			}
+			break;
+		}
+	}
+
+	*d++ = 0xFF;
+	_gfx->printText(_dialogTextBuffer);
+}
+
+bool UI::checkStringPrintProgress() {
+	if (_textLineEnd || _textLineBreak == 3)
+		return true;
+	_textY += 9;
+	return (_textY > 56);
+}
+
+bool UI::waitWithCursorAnim(uint16 inputFlags) {
+	if (inputFlags & 0x20)
+		return true;
+	if ((_waitCursorAnimDelay && --_waitCursorAnimDelay) || _sceneId == 0)
+		return false;
+	const uint8 *s = _scd->makePtr(0x1391C)() + _waitCursorFrame;
+
+	ResourcePointer drw = _scd->makePtr(_gfx->getVerbAreaType() == 0 ? 0x1387C : (_gfx->getVerbAreaType() == 1 ? 0x13894 : 0x138AC));
+
+	uint32 frm = 0x138C4 + _waitCursorFrame * 4;
+	(drw + 2).writeUINT32(frm);
+	(drw + 12).writeUINT32(frm + 4);
+
+	_gfx->enqueueDrawCommands(drw);
+
+	_waitCursorFrame += 2;
+	_waitCursorAnimDelay = s[1];
+	if (s[3])
+		return false;
+	if (_sceneInfo >> 8)
+		return true;
+	_waitCursorFrame = 0;
+	return false;
+}
+
+uint8 UI::drawVerb(uint8 id) {
+	uint8 cid = id;
+	if (_verbsTabCurPage == 1 && _una_6 == id) {
+		_que->writeUInt16(0x05);
+		_que->writeUInt32(_gfx->getVerbAreaType() ? 0x10F26 : 0x10F10);
+		return 0x80;
+	} else if (_verbsTabCurPage > 1) {
+		if (id == 0) {
+			_que->writeUInt16(0x05);
+			_que->writeUInt32(0x10EFA);
+			return 0x80;
+		} else {
+			id += _numVerbsFirstPage;
+		}
+	}
+
+	if (id >= _scriptVerbsArray->pos())
+		return 0xFF;
+
+	uint16 offs = _scriptVerbsArray->read(id);
+	const uint8 *s = _scriptTextResource + offs;
+	uint8 *d = _verbTextBuffer + 9;
+	for (int i = 0; i < 33; ++i) {
+		*d = *s++;
+		if (*d++ == 0xFF)
+			break;
+	}
+	Common::String dbg((const char*)_verbTextBuffer + 9, (const char*)_verbTextBuffer + 32);
+	debug("VERB %d: %s", id, dbg.substr(0,  dbg.findFirstOf((char)0xFF, 0)).c_str());
+	_verbTextBuffer[47] = 0xFF;
+
+	return cid;
+}
+
+void UI::drawHiliteVerb(uint8 id) {
+	uint8 res = 0;
+	if (id == 0) {
+		_verbTextBuffer[5] = 4;
+		res = drawVerb(_lastHiliteVerb);
+	} else {
+		_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaPosX, 16);
+		_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaPosY, _hiliteVerb * 9 + 143 + (_gfx->getVerbAreaType() ? 16 : 0));
+		_verbTextBuffer[5] = 1;
+		res = drawVerb(_hiliteVerb);
+	}
+	if (res != 0x80) {
+		_verbTextBuffer[7] = 0x10;
+		_verbTextBuffer[8] = res * 9;
+		_gfx->printText(_verbTextBuffer);
+	} else {
+		_que->start();
+	}
+	if (id == 1) {
+		_lastHiliteVerb = _hiliteVerb;
+		_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaControlFlags, 0);
+	}
+}
+
+bool UI::drawUnderscoreString() {
+	static const uint8 underscoreStr[] = { 0xFC, 0x00, 0xF9, 0x01, 0xFB, 0x00, 0x8, 0xFE, 0x01, 0x5F, 0xFF };
+	memcpy(_underscoreStr, underscoreStr, sizeof(underscoreStr));
+	_underscoreStr[5] = _textInputColumnCur * 9 + _textInputMarginLeft;
+	_underscoreStr[6] = 33;
+	_gfx->printText(_underscoreStr);
+	return (++_textInputColumnCur == _textInputColumnMax);
+}
+
+void UI::drawUnderscoreCursor() {
+	if (_textInputCursorState) {
+		_underscoreStr[8] = 1;
+		_textInputCursorState = 0;
+	} else {
+		_underscoreStr[5] = _textInputColumnCur * 9 + _textInputMarginLeft;
+		_underscoreStr[8] = 0;
+		++_textInputCursorState;
+	}
+	_gfx->printText(_underscoreStr);
+	_textInputCursorBlinkCnt = 32;
+}
+
+void UI::verbSelect2setResult() {
+	int pos = _textInputColumnCur;
+	if (_textInputStr[pos])
+		++pos;
+
+	uint8 *d = &_dialogTextBuffer[9];
+	d[pos] = 0xFF;
+	int i = 0;
+	for (; i < 247; ++i) {
+		if (d[i] == 0xFF || d[i] != ' ')
+			break;
+	}
+	if (d[i] == 0xFF || i == 247) {
+		d[0] = ' ';
+		d[1] = 0xFF;
+	}
+
+	for (i = 0; i < _scriptVerbsArray->size(); ++i) {
+		uint16 val = _scriptVerbsArray->read(i);
+		if (verbSelect2checkSelection(val))
+			break;
+	}
+
+	_selectedVerb = (i == _scriptVerbsArray->size()) ? 1 : i + 1;
+}
+
+void UI::verbsTabHandleInput(uint16 inputFlags) {
+	if (_progress2 & 0x100) {
+		if (_verbsTabLayout < 2)
+			drawHiliteVerb(1);
+		else
+			virtKeybBackspace();
+		_progress2 &= ~0x100;
+		return;
+	}
+	if (_progress2 & 0x400) {
+		if (_gfx->getAnimParameter(62, GraphicsEngine::kAnimParaControlFlags) != (GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause))
+			return;
+		_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaPosX, _hilitePosX);
+		_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaPosY, _hilitePosY);
+		_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
+		if (_progress2 & 0x800)
+			verbSelect2setResult();
+		_progress2 &= ~0xC00;
+		return;
+	}
+
+	if (_verbsTabLayout == 0) {
+		uint8 in = verbsTabCheckInputFlags(inputFlags);
+		if (_scriptVerbsArray->pos() == 1) {
+			if (in == 0x10) {
+				if (_scriptSentenceArray->pos() != 0)
+					_selectedVerb = 0xFF;
+			} else if (in == 0x20) {
+				verbSelect();
+			}
+		} else {
+			if (in == 1 || in == 4) {
+				for (bool lp = true; lp; ) {
+					lp = false;
+					if (--_hiliteVerb < 0) {
+						_hiliteVerb = _lastVerbDrawn - 1;
+						if (_verbsTabCurPage) {
+							if (_verbsTabCurPage == 1)
+								_hiliteVerb = _numVerbsLastPage;
+							else
+								--_hiliteVerb;
+							verbTabSwapPage();
+						}
+					} else if (_hiliteVerb == 0 && _verbsTabCurPage == 2) {
+						lp = true;
+						continue;
+					}
+				}
+				if (_progress2 == 103) {
+					drawHiliteVerb(0);
+					_progress2 |= 0x100;
+				}
+
+			} else if (in == 2 || in == 8) {
+				for (bool lp = true; lp; ) {
+					lp = false;
+					if ((++_hiliteVerb + 1 == _lastVerbDrawn) && (_verbsTabCurPage == 1)) {
+						lp = true;
+						continue;
+					}
+				}
+				if ((_hiliteVerb == _lastVerbDrawn) || (_verbsTabCurPage == 2 && _hiliteVerb == _una_3)) {
+					_hiliteVerb = 0;
+					if (_verbsTabCurPage) {
+						if (_verbsTabCurPage == 1)
+							_hiliteVerb = 1;
+						verbTabSwapPage();
+					}
+				}
+				if (_progress2 == 103) {
+					drawHiliteVerb(0);
+					_progress2 |= 0x100;
+				}
+			} else if (in == 0x10) {
+				if (_scriptSentenceArray->pos() != 0)
+					_selectedVerb = 0xFF;
+			} else if (in == 0x20) {
+				verbSelect();
+			}
+		}
+	} else if (_verbsTabLayout == 1) {
+
+	} else {
+		if (--_textInputCursorBlinkCnt == 0)
+			drawUnderscoreCursor();
+
+		uint8 in = verbsTabCheckInputFlags(inputFlags);
+
+		if (in & 1) {
+			for (int cr = _vkeybPosTotal - _vkeybColumnWidth; verbsTabMoveHilite(cr); )
+				cr -= _vkeybColumnWidth;
+
+		} else if (in & 2) {
+			for (int cr = _vkeybPosTotal + _vkeybColumnWidth; verbsTabMoveHilite(cr); )
+				cr += _vkeybColumnWidth;
+
+		} else if (in & 8) {
+			for (int cr = _vkeybPosTotal + 1; verbsTabMoveHilite(cr); )
+				++cr;
+
+		} else if (in & 4) {
+			for (int cr = _vkeybPosTotal - 1; verbsTabMoveHilite(cr); )
+				--cr;
+
+		} else if (in & 0x10) {
+			virtKeybBackspace();
+		} else if ((_drawVerbsWd1 == 0) && (in & 0x80)) {
+			virtKeybStart();
+		} else if (in & 0x20) {
+			if (verbSelect2())
+				virtKeybPrint();
+		}
+	}
+}
+
+uint8 UI::verbsTabCheckInputFlags(uint16 inputFlags) {
+	return inputFlags;
+}
+
+bool UI::verbsTabMoveHilite(int &pos) {
+	switch (_verbsTabLayoutMap[pos]) {
+	case 0:
+		break;
+	case 1:
+		return true;
+	case 2:
+		while (verbsTabMoveHilite(++pos)) {}
+		break;
+	case 3:
+		while(verbsTabMoveHilite(--pos)) {}
+		break;
+	case 4:
+		do {
+			pos += _vkeybColumnWidth;
+		} while(verbsTabMoveHilite(pos));
+		break;
+	case 5:
+		do {
+			pos -= _vkeybColumnWidth;
+		} while(verbsTabMoveHilite(pos));
+		break;
+	case 6:
+		pos += _vkeybColumnWidth;
+		while(verbsTabMoveHilite(--pos)) {}
+		break;
+	case 7:
+		pos -= _vkeybColumnWidth;
+		while(verbsTabMoveHilite(++pos)) {}
+		break;
+	default:
+		_vkeybPosTotal = pos;
+		adjustHilitePos();
+	}
+	return false;
+}
+
+void UI::adjustHilitePos() {
+	_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
+	_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaFrame, _verbsTabLayout == 2 ? 2 : 0);
+	_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
+
+	int rows = 1;
+	int remX = _vkeybPosTotal;
+	while (_vkeybColumnWidth <= remX) {
+		remX -= _vkeybColumnWidth;
+		++rows;
+	}
+
+	_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaPosX, (remX << 3) + _verbsTabOffsX);
+	_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaPosX, (remX << 3) + _verbsTabOffsX);
+	_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaPosY, (rows << 3) + _verbsTabOffsY);
+	_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaPosY, (rows << 3) + _verbsTabOffsY);
+}
+
+void UI::verbTabSwapPage() {
+	if (_progress2 == 103) {
+		_progress2 = 109;
+		_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
+		_que->writeUInt16(0x16);
+		_que->start();
+		_verbTextBuffer[5] = 4;
+		_verbsTabCurPage ^= 3;
+	} else {
+		uint8 res = (_progress2 - 109 < _numVerbsMax) ? drawVerb(_progress2 - 109) : 0xFF;
+		if (res == 0xFF) {
+			_progress2 = 103;
+		} else if (res != 0x80) {
+			_verbTextBuffer[7] = 0x10;
+			_verbTextBuffer[8] = res * 9;
+			_gfx->printText(_verbTextBuffer);
+		} else {
+			_que->start();
+		}
+		if (_progress2 == 103)
+			_lastHiliteVerb = _hiliteVerb;
+		else
+			++_progress2;
+	}
+}
+
+void UI::verbSelect() {
+	if ((_verbsTabCurPage == 1 && _hiliteVerb == _una_6) || (_verbsTabCurPage == 2 && _hiliteVerb == 0))
+		return;
+
+	_selectedVerb = _hiliteVerb + 1;
+
+	if (_verbsTabCurPage == 2)
+		_selectedVerb += _numVerbsFirstPage;
+
+	if (_scriptSentenceArray->pos() == 0)
+		_prevSelectedVerb = _selectedVerb - 1;
+
+	_que->writeUInt16(0x1C);
+	_que->writeUInt16(0x1D);
+	_que->start();
+}
+
+bool UI::verbSelect2() {
+	if (_drawVerbsWd1) {
+		return false;
+
+	} else {
+		if (!(_progress2 & 0x100)) {
+			_que->writeUInt16(0x1C);
+			_que->writeUInt16(0x1D);
+			_que->start();
+			_progress2 = 0x100;
+			return false;
+		}
+
+		uint8 r = _verbsTabLayoutMap[_vkeybPosTotal];
+
+		if (_progress2 == 0x100) {
+			if (_verbsTabLayout == 3) {
+				uint8 frm = _scd->makePtr(0x115CA)[_vkeybPosTotal];
+				_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaFrame, frm);
+				_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
+			}
+			++_progress2;
+			if (r == 8 || r == 9) {
+				_que->writeUInt16(0x1C);
+				_que->writeUInt16(0x1D);
+				_que->start();
+				return false;
+			}
+		}
+
+		bool reslt = true;
+		if (_progress2 == 0x101) {
+			if (r == 8) {
+				_progress2 |= 0xC00;
+				reslt = false;
+
+			} else if (r == 9) {
+				if (_textInputColumnCur != 0) {
+					if (!_textInputStr[_textInputColumnCur])
+						_textInputColumnCur--;
+					_textInputStr[_textInputColumnCur] = 0;
+				} else {
+					reslt = false;
+				}
+			} else if (_textInputColumnCur < _textInputColumnMax) {
+				_textInputStr[_textInputColumnCur] = r;
+				if (_textInputColumnCur + 1 < _textInputColumnMax)
+					++_textInputColumnCur;
+			} else {
+				reslt = false;
+			}
+			_progress2 = reslt ? 0x200 : (_progress2 & 0xC00) | 103;
+		}
+		return reslt;
+	}
+}
+
+void UI::virtKeybBackspace() {
+	if (!(_progress2 & 0x100)) {
+		if (_verbsTabLayout == 3) {
+			_hilitePosX = _gfx->getAnimParameter(62, GraphicsEngine::kAnimParaPosX);
+			_hilitePosY = _gfx->getAnimParameter(62, GraphicsEngine::kAnimParaPosY);
+			_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaPosX, 88);
+			_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaPosY, 192);
+			_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaFrame, 104);
+			_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
+			if (_vkeybPosTotal != 139)
+				_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
+		}
+		_que->writeUInt16(0x1C);
+		_que->writeUInt16(0x1D);
+		_que->start();
+		_progress2 |= 0x100;
+		return;
+	} else {
+		if (_textInputColumnCur != 0) {
+			if (!_textInputStr[_textInputColumnCur])
+				_textInputColumnCur--;
+			_textInputStr[_textInputColumnCur] = 0;
+		}
+		_progress2 |= 0x400;
+		virtKeybPrint();
+	}
+}
+
+void UI::virtKeybStart() {
+	if (_verbsTabLayout == 3) {
+		_hilitePosX = _gfx->getAnimParameter(62, GraphicsEngine::kAnimParaPosX);
+		_hilitePosY = _gfx->getAnimParameter(62, GraphicsEngine::kAnimParaPosY);
+		_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaPosX, 200);
+		_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaPosY, 192);
+		_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaFrame, 108);
+		_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
+		_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
+	}
+	_que->writeUInt16(0x1C);
+	_que->writeUInt16(0x1D);
+	_que->start();
+
+	_progress2 |= 0xC00;
+}
+
+bool UI::verbSelect2checkSelection(uint16 val) {
+	const uint8 *s1 = &_scriptTextResource[val];
+	const uint8 *s2 = &_dialogTextBuffer[9];
+
+	if (_verbsInterpreterMode == 1) {
+		for (int i = 0; i < 247; ++i) {
+			if (*s1 == 0xFF)
+				return false;
+			if (*s1++ == *s2)
+				break;
+		}
+	} else {
+		for (int i = 0; i < 247; ++i) {
+			if (*s1 != *s2++)
+				return false;
+			if (*s1++ == 0xFF)
+				break;
+		}
+	}
+	return true;
+}
+
+void UI::virtKeybPrint() {
+	int pr = _progress2 & ~0x400;
+
+	if (!(_progress2 & 0x200)) {
+		_progress2 = (_progress2 & ~0xFF) | 0x200;
+		return;
+	}
+	if (pr == 0x200) {
+		_que->writeUInt16(0x23);
+		_que->start();
+		++_progress2;
+		return;
+	}
+	if (pr == 0x201) {
+		uint8 *d = &_dialogTextBuffer[9];
+		for (int i = 0; i < 18; ++i) {
+			if (_textInputStr[i] != 0)
+				*d++ = _textInputStr[i];
+		}
+		if (d == &_dialogTextBuffer[9])
+			*d++ = ' ';
+		*d++ = 0xFF;
+
+		_que->writeUInt16(0x05);
+		_que->writeUInt32(0x11946);
+		_que->start();
+		++_progress2;
+		return;
+	}
+	if (pr == 0x202) {
+		_gfx->printText(_dialogTextBuffer);
+		++_progress2;
+		return;
+	}
+	if (pr == 0x203) {
+		_que->writeUInt16(0x05);
+		_que->writeUInt32(0x11942);
+		_que->start();
+		++_progress2;
+			return;
+	}
+	if (pr == 0x204) {
+		drawUnderscoreCursor();
+		_progress2 = (_progress2 & ~0x2FF) | 103;
+	}
+
+	if (_drawVerbsWd1 == 0)
+		return;
+}
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/ui.h b/engines/snatcher/ui.h
new file mode 100644
index 00000000000..6854d6ea515
--- /dev/null
+++ b/engines/snatcher/ui.h
@@ -0,0 +1,147 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#ifndef SNATCHER_UI_H
+#define SNATCHER_UI_H
+
+
+#include "common/scummsys.h"
+
+namespace Snatcher {
+
+class CmdQueue;
+class GraphicsEngine;
+class ResourcePointer;
+class ScriptArray;
+class UI {
+public:
+	UI(GraphicsEngine *gfx, CmdQueue *que, ResourcePointer *scd);
+	~UI();
+
+	void setControllerConfig(uint8 cfg) { _controllerCfg = cfg; }
+	void setScriptTextResource(const uint8 *textResource) { _scriptTextResource = textResource; }
+
+	bool displayDialog(int sceneInfo, int sceneTextOffset, uint16 inputFlags);
+
+	bool drawVerbs();
+	bool verbsTabInputPrompt(uint16 inputFlags);
+
+	void setScriptVerbsArray(const ScriptArray *verbsArray) { _scriptVerbsArray = verbsArray; }
+	void setScriptSentenceArray(const ScriptArray *sentenceArray) { _scriptSentenceArray = sentenceArray; }
+
+	int8 getSelectedVerb() const { return (int8)_selectedVerb; }
+	void resetVerbSelection() { _prevSelectedVerb = 0; }
+	void setVerbsTabLayout(uint16 layout);
+	void setInterpreterMode(uint16 mode);
+	
+private:
+	void printDialogStringHead();
+	void printDialogStringBody();
+	bool checkStringPrintProgress();
+	bool waitWithCursorAnim(uint16 inputFlags);
+
+	uint8 _textColor;
+	uint8 _textY;
+	uint8 _textY2;
+	//uint8 _makestrbt1;
+	uint8 _sceneId;
+	uint8 _textLineBreak;
+	uint8 _textLineEnd;
+	uint16 _sceneTextOffsCur;
+	uint16 _sceneInfo;
+	uint16 _sceneTextOffset;
+	uint16 _sceneTextOffsStart;
+	uint8 _waitCursorFrame;
+	uint8 _waitCursorAnimDelay;
+	uint8 *_dialogTextBuffer;
+
+	const uint8 *_scriptTextResource;
+	uint8 _controllerCfg;
+	int16 _progress;
+
+private:
+	uint8 drawVerb(uint8 id);
+	void drawHiliteVerb(uint8 id);
+	bool drawUnderscoreString();
+	void drawUnderscoreCursor();
+	void verbSelect2setResult();
+	void verbsTabHandleInput(uint16 inputFlags);
+	uint8 verbsTabCheckInputFlags(uint16 inputFlags);
+	bool verbsTabMoveHilite(int &pos);
+	void adjustHilitePos();
+	void verbTabSwapPage();
+	void verbSelect();
+	bool verbSelect2();
+	void virtKeybBackspace();
+	void virtKeybStart();
+	bool verbSelect2checkSelection(uint16 val);
+	void virtKeybPrint();
+
+	uint16 _verbsInterpreterMode;
+	uint8 _una_6;
+	uint8 _numVerbsFirstPage;
+	uint8 _numVerbsLastPage;
+	uint8 _una_3;
+	uint8 _prevSelectedVerb;
+	uint8 _numVerbsMax;
+	uint8 _una_rr_hi;
+	uint8 _una_rr_lo;
+	uint8 _verbsTabCurPage;
+	uint8 _transit_02;
+	int16 _transDW1;
+	int16 _transDW2;
+	int16 _drawVerbsWd1;
+	uint8 _textInputMarginLeft;
+	int16 _textInputColumnCur;
+	int16 _textInputColumnMax;
+	uint8 _textInputCursorState;
+	uint8 _textInputCursorBlinkCnt;
+	uint8 _selectedVerb;
+	uint8 _vkeybPosTotal;
+	uint8 _vkeybColumnWidth;
+	uint8 _verbsTabOffsX;
+	uint8 _verbsTabOffsY;
+	
+	int8 _lastHiliteVerb;
+	int8 _hiliteVerb;
+	uint8 _lastVerbDrawn;
+	uint8 *_verbTextBuffer;
+	uint8 *_underscoreStr;
+	uint8 *_textInputStr;
+	const uint8 *_verbsTabLayoutMap;
+	uint16 _verbsTabLayout;
+	int16 _hilitePosX;
+	int16 _hilitePosY;
+	bool _vkeybVisible;
+	const ScriptArray *_scriptVerbsArray;
+	const ScriptArray *_scriptSentenceArray;
+	int16 _progress2;
+
+private:
+	GraphicsEngine *_gfx;
+	CmdQueue *_que;
+	ResourcePointer *_scd;
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_UI_H
diff --git a/engines/snatcher/util.cpp b/engines/snatcher/util.cpp
index 59640c5cb7f..95ef34eb6c6 100644
--- a/engines/snatcher/util.cpp
+++ b/engines/snatcher/util.cpp
@@ -103,14 +103,9 @@ RNDC rndC2;
 uint8 rndH = 0;
 uint8 rndL = 1;
 
-//uint16 rndC1q = 0;
-//uint16 rndC2q = 0;
-
 void rngReset() {
 	rndC1.b = 0;
 	rndC2.b = 0;
-	//rndC1q = 0;
-	//rndC2q = 0;
 	rndH = FROM_BE_16(0x100) & 0xFF;
 	rndL = rndH ^ 1;
 }
@@ -125,19 +120,12 @@ uint16 rngMakeNumber() {
 	if (rndC2.b + 1 > 0xFFFF)
 		rndC1.b++;
 	rndC2.b++;
-
-	/*rndC1q += ((rndC1q & 0xFF) << 8);
-	rndC1q += rndC2q;
-	rndC1q += ((rndC2q << 8) | (rndC2q >> 8));
-	if ((rndC2q & 0xFF) + (rndC2q >> 8) > 0xFF)
-		rndC1q++;
-	rndC2q = (((rndC2q & 0xFF) + (rndC2q >> 8)) & 0xFF) | (rndC2q & 0xFF00);
-	if (rndC2q + 1 > 0xFFFF)
-		rndC1q++;
-	rndC2q++;
-		assert(rndC1q == rndC1.b);*/
 	return rndC1.b;
 }
 
+uint16 rngGetNumberFromRange(uint16 min, uint16 range) {
+	return ((range * rngMakeNumber()) >> 16) + min;
+}
+
 } // End of namespace Util
 } // End of namespace Snatcher
diff --git a/engines/snatcher/util.h b/engines/snatcher/util.h
index 1799627fb25..04549fad0df 100644
--- a/engines/snatcher/util.h
+++ b/engines/snatcher/util.h
@@ -34,6 +34,7 @@ extern uint32 makeBCDTimeStamp(uint32 msecs);
 
 extern void rngReset();
 extern uint16 rngMakeNumber();
+extern uint16 rngGetNumberFromRange(uint16 min, uint16 range);
 
 } // End of namespace Util
 } // End of namespace Snatcher
diff --git a/graphics/segagfx.cpp b/graphics/segagfx.cpp
index d63e91da5c0..01c94597087 100644
--- a/graphics/segagfx.cpp
+++ b/graphics/segagfx.cpp
@@ -261,7 +261,7 @@ void SegaRenderer::render(void *dst, int x, int y, int w, int h) {
 		if (_planes[kWindowPlane].nameTableSize != 0) {
 			// With window plane, if available
 			for (int y1 = y; y1 < y2; ++y1) {
-				memset (_tempBufferPlanesPrio, 0, _screenW);
+				memset(_tempBufferPlanesPrio, 0, _screenW);
 				if (_displayEnabled) {					
 					renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneB, y1, x, w);
 					if (y1 >= wY1 && y1 < wY2) {
@@ -290,7 +290,7 @@ void SegaRenderer::render(void *dst, int x, int y, int w, int h) {
 		} else {
 			// Without window plane
 			for (int y1 = y; y1 < y2; ++y1) {
-				memset (_tempBufferPlanesPrio, 0, _screenW);
+				memset(_tempBufferPlanesPrio, 0, _screenW);
 				if (_displayEnabled) {	
 					renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneB, y1, x, w);
 					renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneA, y1, x, w);
@@ -309,7 +309,7 @@ void SegaRenderer::render(void *dst, int x, int y, int w, int h) {
 	} else if (_planes[kWindowPlane].nameTableSize != 0) {
 		// Include window plane if available
 		for (int y1 = y; y1 < y2; ++y1) {
-			memset (_tempBufferPlanesPrio, 0, _screenW);
+			memset(_tempBufferPlanesPrio, 0, _screenW);
 			if (_displayEnabled) {
 				renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneB, y1, x, w);
 				if (y1 >= wY1 && y1 < wY2) {
@@ -334,7 +334,7 @@ void SegaRenderer::render(void *dst, int x, int y, int w, int h) {
 	} else {
 		// Only plane B
 		for (int y1 = y; y1 < y2; ++y1) {
-			memset (_tempBufferPlanesPrio, 0, _screenW);
+			memset(_tempBufferPlanesPrio, 0, _screenW);
 			if (_displayEnabled)
 				renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneB, y1, x, w);
 
diff --git a/graphics/segagfx.h b/graphics/segagfx.h
index f8be03cc961..d2b82140c21 100644
--- a/graphics/segagfx.h
+++ b/graphics/segagfx.h
@@ -267,7 +267,7 @@ private:
 	const renderFuncD *_renderLineFragmentD;
 
 	struct SegaPlane {
-		SegaPlane() : blockX(0), blockY(0), w(0), h(0), mod(0), nameTable(0), nameTableSize(0) {}
+		SegaPlane() : blockX(0), blockY(0), w(0), h(0), mod(0), pitch(0), nameTable(0), nameTableSize(0) {}
 		int blockX, blockY;
 		uint16 w, h, mod, pitch;
 		uint16 *nameTable;


Commit: 7d8d07e7e911c62a29f69a970ad3fd5db59b7671
    https://github.com/scummvm/scummvm/commit/7d8d07e7e911c62a29f69a970ad3fd5db59b7671
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: add save/load support

Changed paths:
  A engines/snatcher/memory.cpp
  A engines/snatcher/memory.h
  A engines/snatcher/state.h
    engines/snatcher/animator_scd.cpp
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/metaengine.cpp
    engines/snatcher/module.mk
    engines/snatcher/resource.h
    engines/snatcher/saveload.cpp
    engines/snatcher/saveload.h
    engines/snatcher/scene/scene_d2.cpp
    engines/snatcher/script.cpp
    engines/snatcher/script.h
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/sound.cpp
    engines/snatcher/sound.h
    engines/snatcher/sound_device.h
    engines/snatcher/sound_device_scd.cpp
    engines/snatcher/transition_scd.cpp
    engines/snatcher/ui.cpp
    engines/snatcher/ui.h


diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index 105f884bafd..4466f4c9db7 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -39,7 +39,7 @@ namespace Snatcher {
 //#define		ANIM_DEBUG
 
 struct AnimObject {
-	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), f16(0), f18(0), f1c(0),
+	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), palette(0), f18(0), f1c(0),
 		timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0),
 			res(), scriptData(), spriteData(nullptr), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), scriptComFlags(0), freeze(0), blink(0), blinkCounter(0), blinkDuration(0) {}
 	
@@ -47,7 +47,7 @@ struct AnimObject {
 		enable = blinkRate = drawFlags = 0;
 		posX = posY = 0;
 		relSpeedX = relSpeedY = 0;
-		f16 = 0;
+		palette = 0;
 		f18 = 0;
 		f1c = 0;
 		timeStamp = 0;
@@ -72,10 +72,9 @@ struct AnimObject {
 	uint16 drawFlags;
 	int32 posX;
 	int32 posY;
-
 	int32 relSpeedX;
 	int32 relSpeedY;
-	uint8 f16;
+	uint8 palette;
 	uint16 f18;
 	uint8 f1c;
 	uint32 timeStamp;
@@ -240,13 +239,13 @@ private:
 	int anim_36(AnimObject &a, const uint8 *data);
 	int anim_37(AnimObject &a, const uint8 *data);
 	int anim_38(AnimObject &a, const uint8 *data);
-	int anim_39(AnimObject &a, const uint8 *data);
-	int anim_40(AnimObject &a, const uint8 *data);
+	int anim_setPalette(AnimObject &a, const uint8 *data);
+	int anim_transition(AnimObject &a, const uint8 *data);
 	int anim_speechSync(AnimObject &a, const uint8 *data);
 	int anim_42(AnimObject &a, const uint8 *data);
 	int anim_toggleExtraPalette(AnimObject &a, const uint8 *data);
 	int anim_allowFrameDrop(AnimObject &a, const uint8 *data);
-	int anim_45(AnimObject &a, const uint8 *data);
+	int anim_fmMusic(AnimObject &a, const uint8 *data);
 	int anim_46(AnimObject &a, const uint8 *data);
 	int anim_47(AnimObject &a, const uint8 *data);
 
@@ -291,8 +290,6 @@ Animator_SCD::Animator_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::Gfx
 
 	_sr->setResolution(_screenWidth, _screenHeight);
 	_sr->setupWindowPlane(0, 0, Graphics::SegaRenderer::kWinToLeft, Graphics::SegaRenderer::kWinToTop);
-	_sr->setVScrollMode(Graphics::SegaRenderer::kVScrollFullScreen);
-	_sr->setHScrollMode(Graphics::SegaRenderer::kHScrollFullScreen);
 	_sr->hINT_setHandler(&_hINTClientProc);
 
 	reconfigPlanes();
@@ -342,10 +339,10 @@ void Animator_SCD::initAnimations(ResourcePointer &res, uint16 len, bool dontUpd
 	ResourcePointer in = res;
 	while (in < next) {
 		assert(in[0] < 64);
+		int dg = in[0];
 		AnimObject *a = _animations[*in++];
 		//if (a->enable && dontUpdate)
 		//	return;
-
 		a->clear();
 		a->enable = 1;
 		a->res = res;
@@ -360,7 +357,7 @@ void Animator_SCD::initAnimations(ResourcePointer &res, uint16 len, bool dontUpd
 		uint8 cmd = a->scriptData[0];
 		for (bool l = true; l; ) {
 			if (cmd == 0xA1 || cmd == 0xA7) {
-				a->f16 = a->scriptData[1];
+				a->palette = a->scriptData[1];
 				cmd = a->scriptData[4];
 				assert(cmd != 0xA1 && cmd != 0xA7); // The original code would theoretically allow a deadlock here.
 			} else {
@@ -533,7 +530,7 @@ void Animator_SCD::setAnimParameter(uint8 animObjId, int param, int32 value) {
 		a.relSpeedY = value << 16;
 		break;
 	case GraphicsEngine::kAnimParaF16:
-		a.f16 = value;
+		a.palette = value;
 		break;
 	case GraphicsEngine::kAnimParaF18:
 		a.f18 = value;
@@ -622,7 +619,7 @@ int32 Animator_SCD::getAnimParameter(uint8 animObjId, int param) const {
 	case GraphicsEngine::kAnimParaRelSpeedY:
 		return a.relSpeedY >> 16;
 	case GraphicsEngine::kAnimParaF16:
-		return a.f16;
+		return a.palette;
 	case GraphicsEngine::kAnimParaF18:
 		return a.f18;
 	case GraphicsEngine::kAnimParaF1c:
@@ -877,6 +874,13 @@ void Animator_SCD::reconfigPlanes() {
 		{0xE000, 0xC000, 0xF000, 0xFE00, 0xF800}
 	};
 
+	if (_mode == 0 || _modeChange != 0) {
+		_sr->memsetVRAM(0, 0, 0x10000);
+		_sr->setVScrollMode(Graphics::SegaRenderer::kVScrollFullScreen);
+		_sr->setHScrollMode(Graphics::SegaRenderer::kHScrollFullScreen);
+		_sr->hINT_enable(false);
+	}
+
 	_sr->setupPlaneAB(dimCfgData[_mode][0], dimCfgData[_mode][1]);
 
 	const uint16 *in = memCfgData[_mode];
@@ -909,15 +913,17 @@ void Animator_SCD::updateScrollState() {
 			_sr->enableDisplay(true);
 	}
 
-	if (!s.disableVScroll) {
+	//if (!s.disableVScroll) {
 		_sr->writeUint16VSRAM(0, TO_BE_16(s.realOffsets[TransitionManager::kVertA] & 0x3FF));
 		_sr->writeUint16VSRAM(2, TO_BE_16(s.realOffsets[TransitionManager::kVertB] & 0x3FF));
-	}
+	//}
 
 	if (s.lineScrollMode) {
+		_sr->setHScrollMode(Graphics::SegaRenderer::kHScroll1PixelRows);
 		for (int i = 0; i < s.hScrollTableNumEntries; ++i)
 			_sr->writeUint16VRAM(0xF822 + i * 4, TO_BE_16(s.hScrollTable[i] & 0x3FF));
 	} else {
+		_sr->setHScrollMode(Graphics::SegaRenderer::kHScrollFullScreen);
 		uint16 addr = _mode ? 0xF800 : 0xB800;
 		_sr->writeUint16VRAM(addr, TO_BE_16(s.realOffsets[TransitionManager::kHorzA] & 0x3FF));
 		_sr->writeUint16VRAM(addr + 2, TO_BE_16(s.realOffsets[TransitionManager::kHorzB] & 0x3FF));
@@ -960,8 +966,8 @@ void Animator_SCD::generateSpriteData(AnimObject &a, uint16 &spritesCurIndex, ui
 			origX = -origX - (((hw >> 7) & 0x18) + 8);
 
 		tl = (tl | p) ^ flip;
-		if (a.f16 & 0x80) {
-			uint16 v = (a.f16 & 3) << 13;
+		if (a.palette & 0x80) {
+			uint16 v = (a.palette & 3) << 13;
 			tl = (tl & 0x9FFF) | v;
 		}
 
@@ -1069,13 +1075,13 @@ void Animator_SCD::makeAnimFunctions() {
 		ANM(36),
 		ANM(37),
 		ANM(38),
-		ANM(39),
-		ANM(40),
+		ANM(setPalette),
+		ANM(transition),
 		ANM(speechSync),
 		ANM(42),
 		ANM(toggleExtraPalette),
 		ANM(allowFrameDrop),
-		ANM(45),
+		ANM(fmMusic),
 		ANM(46),
 		ANM(47)
 	};
@@ -1295,12 +1301,13 @@ int Animator_SCD::anim_38(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Animator_SCD::anim_39(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_setPalette(AnimObject &a, const uint8 *data) {
+	a.palette = *data;
 	return 1;
 }
 
-int Animator_SCD::anim_40(AnimObject &a, const uint8 *data) {
-	//gfxDoCommand_D0(*data);
+int Animator_SCD::anim_transition(AnimObject &a, const uint8 *data) {
+	_trs->doCommand(*data);
 	return 1;
 }
 
@@ -1327,7 +1334,8 @@ int Animator_SCD::anim_allowFrameDrop(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Animator_SCD::anim_45(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_fmMusic(AnimObject &a, const uint8 *data) {
+	_snd->fmSendCommand(*data, 1, 1);
 	return 1;
 }
 
@@ -1365,14 +1373,14 @@ void Animator_SCD::anim_setGroupParameter(AnimObject &a, int para, int16 val, bo
 			ta->posY += (val << 16);
 			break;
 		case 2:
-			a.absSpeedX = a.relSpeedX;
+			ta->absSpeedX = ta->relSpeedX;
 			if (ta->parent)
-				a.absSpeedX += _animations[ta->parent]->absSpeedX;
+				ta->absSpeedX += _animations[ta->parent]->absSpeedX;
 			break;
 		case 3:
-			a.absSpeedY = a.relSpeedY;
+			ta->absSpeedY = ta->relSpeedY;
 			if (ta->parent)
-				a.absSpeedY += _animations[ta->parent]->absSpeedY;
+				ta->absSpeedY += _animations[ta->parent]->absSpeedY;
 			break;
 		case 4:
 			ta->controlFlags &= GraphicsEngine::kAnimHide;
@@ -1432,8 +1440,10 @@ int Animator_SCD::drawBootLogoFrame(uint8 *screen, int frameNo)  {
 
 	switch (frameNo) {
 	case 0:
-		_mode = 0;
+		_mode = 0; 
 		reconfigPlanes();
+		_bootsDelay = _bootsTotalFrames = 0;
+		_bootsHScroll = _bootsVScroll =  _bootsCol = 0;
 		len = READ_BE_UINT16(StaticRes_SCD::_bootSeqData[0]);
 		if (len != Util::decodeSCDData(StaticRes_SCD::_bootSeqData[0] + 2, _tempBuffer))
 			error("%s(): Decode size mismatch", __FUNCTION__);
@@ -1454,16 +1464,16 @@ int Animator_SCD::drawBootLogoFrame(uint8 *screen, int frameNo)  {
 		_sr->loadToVRAM(&tmp[74], 22, 0xEA94);
 		_sr->loadToVRAM(&tmp[86], 42, 0xEB8C);
 
+		++frameNo;		
+		break;
+
+	case 1:
 		if (++_bootsDelay == 180) {
 			_bootsDelay = 0;
 			++frameNo;
 		}
 		break;
 
-	case 1:
-		++frameNo;
-		break;
-
 	case 2:
 		_pal->selectPalettes(0x04040405);
 		for (int i = 0; i < 7; ++i)
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index e697392bb83..04f38adb37e 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -27,6 +27,7 @@
 #include "snatcher/text.h"
 #include "snatcher/transition.h"
 #include "common/endian.h"
+#include "common/stream.h"
 #include "common/system.h"
 #include "graphics/pixelformat.h"
 
@@ -43,6 +44,8 @@ GraphicsEngine::GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system
 	assert(_animator);
 	_screen = new uint8[_animator->screenWidth() * _animator->screenHeight() * (pxf ? pxf->bytesPerPixel : 1)]();
 	assert(_screen);
+	_animSaveLoadData = new uint8[64]();
+	assert(_animSaveLoadData);
 }
 
 GraphicsEngine::~GraphicsEngine() {
@@ -51,6 +54,7 @@ GraphicsEngine::~GraphicsEngine() {
 	delete _trs;
 	delete[] _screen;
 	delete _text;
+	delete[] _animSaveLoadData;
 }
 
 void GraphicsEngine::runScript(ResourcePointer res, int func) {
@@ -253,6 +257,58 @@ uint16 GraphicsEngine::frameCount() const {
 	return _state.frameCount();
 }
 
+void GraphicsEngine::loadState(Common::SeekableReadStream *in) {
+	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
+		error("%s(): Save file invalid or corrupt", __FUNCTION__);
+	in->read(_animSaveLoadData, 64);
+}
+
+void GraphicsEngine::saveState(Common::SeekableWriteStream *out) {
+	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
+	for (int i = 0; i < 64; ++i) {
+		uint8 v = 0;
+		if (getAnimParameter(i, kAnimParaEnable)) {
+			v |= 0x80;
+			uint8 cf = getAnimParameter(i, kAnimParaScriptComFlags);
+			if (cf & 0x80) {
+				v |= 0x40;
+			} else {
+				v |= (getAnimParameter(i, kAnimParaControlFlags) & 0x03);
+				v |= (getAnimParameter(i, kAnimParaF24) & 0x0C);
+				if (cf & 1)
+					v |= 0x10;
+				if (getAnimParameter(i, kAnimParaAllowFrameDrop))
+					v |= 0x20;
+			}
+		}
+		_animSaveLoadData[i] = v;
+	}
+	out->write(_animSaveLoadData, 64);
+}
+
+void GraphicsEngine::postLoadProcess() {
+	for (int i = 0; i < 64; ++i) {
+		if (!getAnimParameter(i, kAnimParaEnable))
+			continue;
+		uint8 v = _animSaveLoadData[i];
+		if (!(v & 0x80)) {
+			setAnimParameter(i, kAnimParaEnable, 0);
+			continue;
+		}
+		if (v & 0x40)
+			continue;
+		uint8 cf = getAnimParameter(i, kAnimParaControlFlags) & 0xFC;
+		setAnimParameter(i, kAnimParaControlFlags, cf | (v & 0x03));
+		cf = getAnimParameter(i, kAnimParaF24) & 0xF3;
+		setAnimParameter(i, kAnimParaF24, cf | (v & 0x0C));
+		if (v & 0x10)
+			setAnimParameter(i, kAnimParaScriptComFlags, getAnimParameter(i, kAnimParaScriptComFlags) | 1);
+		else 
+			setAnimParameter(i, kAnimParaScriptComFlags, getAnimParameter(i, kAnimParaScriptComFlags) & ~1);
+		setAnimParameter(i, kAnimParaAllowFrameDrop, (v & 0x20) ? 1 : 0);
+	}
+}
+
 void GraphicsEngine::createMouseCursor(bool show) {
 	_animator->createMouseCursor();
 }
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 8282af77313..0def0d7b21f 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -29,9 +29,13 @@
 
 class OSystem;
 
+namespace Common {
+class SeekableWriteStream;
+} // namespace Common
+
 namespace Graphics {
-	struct PixelFormat;
-}
+struct PixelFormat;
+} // namespace Graphics
 
 namespace Snatcher {
 
@@ -141,6 +145,10 @@ public:
 	bool busy(int type) const;
 	uint16 frameCount() const;
 
+	void loadState(Common::SeekableReadStream *in);
+	void saveState(Common::SeekableWriteStream *out);
+	void postLoadProcess();
+
 	void createMouseCursor(bool show);
 
 	int displayBootLogoFrame(int frameNo);
@@ -213,6 +221,8 @@ private:
 	uint8 _verbAreaType;
 	uint8 _flags;
 
+	uint8 *_animSaveLoadData;
+
 	uint8 *_screen;
 	Animator *_animator;
 	Palette *_palette;
diff --git a/engines/snatcher/memory.cpp b/engines/snatcher/memory.cpp
new file mode 100644
index 00000000000..755b8e21118
--- /dev/null
+++ b/engines/snatcher/memory.cpp
@@ -0,0 +1,80 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#include "snatcher/memory.h"
+#include "snatcher/saveload.h"
+#include "snatcher/snatcher.h"
+#include "snatcher/sound.h"
+#include "snatcher/state.h"
+#include "snatcher/ui.h"
+
+namespace Snatcher {
+
+uint16 MemAccessHandler::readWord(uint16 addr) {
+	int result = 0;
+
+	switch (addr) {
+	case 0x7972:
+		result = _state->conf.useLightGun ? 1 : 0;
+		break;
+	case 0x79E0:
+		// BURAM status
+		return 0;
+	case 0x79E2:
+	case 0x79E4:
+	case 0x79E6:
+	case 0x79E8:
+		// Save slots
+		result = _saveMan->isSaveSlotUsed((addr - 0x79E0) >> 1) ? 1 : 0; // The correct start address is 0x79E2, but we want to skip the autosave slot 0 here.
+		break;
+	case 0x79F0:
+		break;
+	case 0x971A:
+		break;
+	default:
+		error("%s(): Unhandled address 0x%04X", __FUNCTION__, addr);
+	}
+
+	return result;
+}
+
+void MemAccessHandler::writeWord(uint16 addr, uint16 val) {
+	switch (addr) {
+	case 0x79F0:
+		break;
+	case 0x971a:
+		_ui->setInterpreterMode(val);
+		break;
+	case 0xFFFF:
+		// This is an exception that is caught even in the original code.
+		_vm->sound()->reduceVolume2(val);
+		break;
+	default:
+		error("%s(): Unhandled address 0x%04X", __FUNCTION__, addr);
+	}
+}
+
+void MemAccessHandler::setGameState(GameState *state) {
+	_state = state;
+}
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/memory.h b/engines/snatcher/memory.h
new file mode 100644
index 00000000000..b67b80139d3
--- /dev/null
+++ b/engines/snatcher/memory.h
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#ifndef SNATCHER_MEMORY_H
+#define SNATCHER_MEMORY_H
+
+#include "common/scummsys.h"
+
+namespace Snatcher {
+
+class SaveLoadManager;
+class SnatcherEngine;
+class UI;
+struct GameState;
+
+// The script engine has opcodes that allow reading and writing into memory, at least for 16-bit addresses.
+// We could just create a 64K buffer and let that happen, but eventually we would have to route the values
+// to the affected parts of the engine, anyway.
+
+class MemAccessHandler {
+public:
+	MemAccessHandler(SnatcherEngine *vm, UI *ui, SaveLoadManager *saveMan) : _vm(vm), _ui(ui), _saveMan(saveMan) {}
+	~MemAccessHandler() {}
+
+	uint16 readWord(uint16 addr);
+	void writeWord(uint16 addr, uint16 val);
+
+	void setGameState(GameState *state);
+
+private:
+	SnatcherEngine *_vm;
+	UI *_ui;
+	SaveLoadManager *_saveMan;
+	GameState *_state;
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_MEMORY_H
diff --git a/engines/snatcher/metaengine.cpp b/engines/snatcher/metaengine.cpp
index d8de8aec188..468e5870a04 100644
--- a/engines/snatcher/metaengine.cpp
+++ b/engines/snatcher/metaengine.cpp
@@ -20,11 +20,11 @@
 */
 
 #include "snatcher/detection.h"
+#include "snatcher/saveload.h"
 #include "snatcher/snatcher.h"
 #include "common/config-manager.h"
 #include "common/system.h"
 #include "common/savefile.h"
-/*#include "common/translation.h"*/
 
 #include "engines/advancedDetector.h"
 
@@ -49,7 +49,7 @@ public:
 	int getMaximumSaveSlot() const override;
 	bool removeSaveState(const char *target, int slot) const override;
 	SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
-	virtual int getAutosaveSlot() const override { return 999; }
+	int getAutosaveSlot() const override { return 0; }
 
 	Common::KeymapArray initKeymaps(const char *target) const override;
 };
@@ -65,6 +65,8 @@ bool SnatcherMetaEngine::hasFeature(MetaEngineFeature f) const {
 	    (f == kSupportsDeleteSave) ||
 	    (f == kSavesSupportMetaInfo) ||
 	    (f == kSavesSupportThumbnail) ||
+		(f == kSavesSupportCreationDate) ||
+		(f == kSavesSupportPlayTime) ||
 		(f == kSimpleSavesNames);
 }
 
@@ -73,7 +75,7 @@ bool Snatcher::SnatcherEngine::hasFeature(EngineFeature f) const {
 	    (f == kSupportsReturnToLauncher) ||
 	    (f == kSupportsLoadingDuringRuntime) ||
 	    (f == kSupportsSavingDuringRuntime) ||
-	    (f == kSupportsSubtitleOptions);
+	    (f == kSupportsChangingOptionsDuringRuntime);
 }
 
 Common::Error SnatcherMetaEngine::createInstance(OSystem *syst, Engine **engine, const SnatcherGameDescription *desc) const {
@@ -104,36 +106,28 @@ Common::Error SnatcherMetaEngine::createInstance(OSystem *syst, Engine **engine,
 }
 
 SaveStateList SnatcherMetaEngine::listSaves(const char *target) const {
-	/*Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
-	Snatcher::SnatcherEngine::SaveHeader header;
-	Common::String pattern = target;
+	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+	Snatcher::SaveLoadManager::SaveHeader header;
+	Common::String pattern(target);
 	pattern += ".###";
 
 	Common::StringArray filenames;
 	filenames = saveFileMan->listSavefiles(pattern);
-	*/
+	
 	SaveStateList saveList;
-	/*for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
+	for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
 		// Obtain the last 3 digits of the filename, since they correspond to the save slot
-		int slotNum = atoi(file->c_str() + file->size() - 3);
-
-		if (slotNum >= 0 && slotNum <= 999) {
+		int slot = atoi(file->substr(file->size() - 3, 3).c_str());
+		if (slot >= 0 && slot <= getMaximumSaveSlot()) {
 			Common::InSaveFile *in = saveFileMan->openForLoading(*file);
 			if (in) {
-				if (Kyra::KyraEngine_v1::readSaveHeader(in, header) == Kyra::KyraEngine_v1::kRSHENoError) {
-					// WORKAROUND: Old savegames are using 'German' as description for kyra3 restart game save (slot 0),
-					// since that looks odd we replace it by "New Game".
-					if (slotNum == 0 && header.gameID == Kyra::GI_KYRA3)
-						header.description = "New Game";
-
-					saveList.push_back(SaveStateDescriptor(slotNum, header.description));
-				}
+				if (Snatcher::SaveLoadManager::readSaveHeader(in, header))
+					saveList.push_back(SaveStateDescriptor(this, slot, header.desc));
 				delete in;
 			}
 		}
-	}*/
+	}
 
-	// Sort saves based on slot number.
 	Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
 	return saveList;
 }
@@ -143,49 +137,30 @@ int SnatcherMetaEngine::getMaximumSaveSlot() const {
 }
 
 bool SnatcherMetaEngine::removeSaveState(const char *target, int slot) const {
-	//Common::String filename = Snatcher::SnatcherEngine::getSavegameFilename(target, slot);
-	//g_system->getSavefileManager()->removeSavefile(filename);
+	Common::String filename = Snatcher::SaveLoadManager::getSavegameFilename(slot, target);
+	g_system->getSavefileManager()->removeSavefile(filename);
 	return true;
 }
 
 SaveStateDescriptor SnatcherMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
-	/*Common::String filename = Snatcher::SnatcherEngine::getSavegameFilename(target, slot);
+	Common::String filename = Snatcher::SaveLoadManager::getSavegameFilename(slot, target);
 	Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename);
-	const bool nonKyraGame = ConfMan.getDomain(target)->getVal("gameid").equalsIgnoreCase("lol") || ConfMan.getDomain(target)->getVal("gameid").equalsIgnoreCase("eob") || ConfMan.getDomain(target)->getVal("gameid").equalsIgnoreCase("eob2");
-
-	if (in) {
-		Kyra::KyraEngine_v1::SaveHeader header;
-		Kyra::KyraEngine_v1::ReadSaveHeaderError error;
-
-		error = Kyra::KyraEngine_v1::readSaveHeader(in, header, false);
-		delete in;
-
-		if (error == Kyra::KyraEngine_v1::kRSHENoError) {
-			SaveStateDescriptor desc(slot, header.description);
-
-			// Slot 0 is used for the 'restart game' save in all three Kyrandia games, thus
-			// we prevent it from being deleted.
-			desc.setDeletableFlag(slot != 0 || nonKyraGame);
 
-			// We don't allow quick saves (slot 990 till 998) to be overwritten.
-			// The same goes for the 'Autosave', which is slot 999. Slot 0 will also
-			// be protected in Kyra 1-3, since it's the 'restart game' save.
-			desc.setWriteProtectedFlag((slot == 0 && !nonKyraGame) || slot >= 990);
-			desc.setThumbnail(header.thumbnail);
-
-			return desc;
-		}
-	}*/
-
-	Common::String dmy;
-	SaveStateDescriptor desc(this, slot, dmy);
-
-	// We don't allow quick saves (slot 990 till 998) to be overwritten.
-	// The same goes for the 'Autosave', which is slot 999. Slot 0 will also
-	// be protected in Kyra 1-3, since it's the 'restart game' save.
+	Common::String d;
+	SaveStateDescriptor desc(this, slot, d);
+	Snatcher::SaveLoadManager::SaveHeader header;
 
+	if (in && Snatcher::SaveLoadManager::readSaveHeader(in, header)) {
+		desc.setDescription(header.desc);
+		desc.setThumbnail(header.thumbnail);
+		desc.setPlayTime(header.totalPlayTime * 1000);
+		desc.setSaveDate(header.td.tm_year + 1900, header.td.tm_mon + 1, header.td.tm_mday);
+		desc.setSaveTime(header.td.tm_hour, header.td.tm_min);
+	}
 
-	//desc.setWriteProtectedFlag((slot == 0 && !nonKyraGame) || slot >= 990);
+	// We don't allow the autosave slot to be overwritten.
+	desc.setWriteProtectedFlag(slot == getAutosaveSlot());
+	delete in;
 
 	return desc;
 }
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index ac71e62ca7c..e5d50eea208 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/snatcher
 MODULE_OBJS := \
 	animator_scd.o \
 	graphics.o \
+	memory.o \
 	metaengine.o \
 	palette_scd.o \
 	resource.o \
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index 0d044329486..ff6c9623449 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -22,12 +22,9 @@
 #ifndef SNATCHER_RESOURCE_H
 #define SNATCHER_RESOURCE_H
 
-#include "common/endian.h"
 #include "common/fs.h"
-#include "common/func.h"
-#include "common/rect.h"
 #include "common/scummsys.h"
-#include "common/str.h"
+#include "snatcher/state.h"
 
 namespace Common {
 class SeekableReadStream;
@@ -40,36 +37,6 @@ class SnatcherEngine;
 class SceneModule;
 class FIO;
 
-struct Config {
-	Config() : volumeMusic(0), volumeSFX(0), volumeSpeech(0), lightGunAvailable(1), useLightGun(0), controllerSetup(0), disableStereo(0), hasRAMCart(1), hasFreeBuram(1), lightGunBias(0, -16) {}
-	int16 volumeMusic;
-	int16 volumeSFX;
-	int16 volumeSpeech;
-	int16 lightGunAvailable;
-	int16 useLightGun;
-	int16 controllerSetup;
-	int16 disableStereo;
-	int16 hasRAMCart;
-	int16 hasFreeBuram;
-	Common::Point lightGunBias;
-};
-
-struct GameState {
-	GameState() : frameNo(0), frameState(0), finish(0), modProcessTop(0), modProcessSub(0), counter(0), modIndex(0), menuSelect(0), prologue(0), chapter(0), chapterSub(0), conf(Config()) {}
-	int16 frameNo;
-	int16 frameState;
-	int16 finish;
-	int16 modProcessTop;
-	int16 modProcessSub;
-	int16 counter;
-	int16 modIndex;
-	int16 menuSelect;
-	int16 prologue;
-	int16 chapter;
-	int16 chapterSub;
-	Config conf;
-};
-
 class SceneHandler {
 public:
 	SceneHandler(SnatcherEngine *vm, SceneModule *scn, FIO *fio) : _vm(vm), _module(scn), _fio(fio) {}
diff --git a/engines/snatcher/saveload.cpp b/engines/snatcher/saveload.cpp
index 7163adc1a16..de61bcf0a0d 100644
--- a/engines/snatcher/saveload.cpp
+++ b/engines/snatcher/saveload.cpp
@@ -20,9 +20,255 @@
 */
 
 
+#include "snatcher/graphics.h"
 #include "snatcher/saveload.h"
+#include "snatcher/script.h"
+#include "snatcher/snatcher.h"
+#include "snatcher/sound.h"
+#include "common/algorithm.h"
+#include "common/config-manager.h"
+#include "common/savefile.h"
+#include "engines/engine.h"
+#include "graphics/scaler.h"
+#include "graphics/surface.h"
+#include "graphics/thumbnail.h"
 
 
+#define SNATCHER_SAVEFILE_VERSION		0
+
 namespace Snatcher {
 
+SaveLoadManager::SaveLoadManager(SnatcherEngine *vm) : _vm(vm), _pendingSaveLoad(0), _enableSaving(true), _tryLoadFromLauncher(true), _desc() {
+	ConfMan.registerDefault("controller_conf", 0);
+	ConfMan.registerDefault("disable_stereo", false);
+	ConfMan.registerDefault("lightgun_usage", false);
+	ConfMan.registerDefault("lightgun_biasX", 0);
+	ConfMan.registerDefault("lightgun_biasY", 0);
+}
+
+SaveLoadManager::~SaveLoadManager() {
+}
+
+void SaveLoadManager::loadSettings(Config &config) {
+	if (ConfMan.hasKey("controller_conf"))
+		config.controllerSetup = ConfMan.getInt("controller_conf");
+	if (ConfMan.hasKey("disable_stereo"))
+		config.disableStereo = ConfMan.getBool("disable_stereo") ? 1 : 0;
+	if (ConfMan.hasKey("lightgun_usage"))
+		config.useLightGun = ConfMan.getBool("lightgun_usage") ? 1 : 0;
+	if (ConfMan.hasKey("lightgun_biasX"))
+		config.lightGunBias.x = ConfMan.getInt("lightgun_biasX");
+	if (ConfMan.hasKey("lightgun_biasY"))
+		config.lightGunBias.y = ConfMan.getInt("lightgun_biasY");
+	if (_tryLoadFromLauncher && ConfMan.hasKey("save_slot")) {
+		requestLoad(ConfMan.getInt("save_slot"));
+		_tryLoadFromLauncher = false;
+	}
+}
+
+void SaveLoadManager::saveSettings(const Config &config) {
+	ConfMan.setInt("controller_conf", config.controllerSetup);
+	ConfMan.setBool("disable_stereo", config.disableStereo != 0);
+	ConfMan.setBool("lightgun_usage", config.useLightGun != 0);
+	ConfMan.setInt("lightgun_biasX", config.lightGunBias.x);
+	ConfMan.setInt("lightgun_biasY", config.lightGunBias.y);
+}
+
+void SaveLoadManager::updateSaveSlotsState(GameState &state) {
+	state.saveSlotUsage = 0;
+	for (int i = 0; i < 4; ++i) {
+		if (isSaveSlotUsed(i + 1)) // Skip autosave slot 0
+			state.saveSlotUsage |= (1 << i);
+	}
+}
+
+void SaveLoadManager::requestLoad(int slot) {
+	_pendingSaveLoad = slot + 1;
+}
+
+void SaveLoadManager::requestSave(int slot, const Common::String &desc) {
+	_pendingSaveLoad = -(slot + 1);
+	_desc = desc;
+}
+
+void SaveLoadManager::handleSaveLoad(GameState &state) {
+	if (_pendingSaveLoad > 0)
+		loadState(_pendingSaveLoad - 1, state);
+	else if (_pendingSaveLoad < 0)
+		saveState(-_pendingSaveLoad - 1, state);
+	_pendingSaveLoad = 0;
+}
+
+bool SaveLoadManager::isSaveSlotUsed(int16 slot) const {
+	if (slot < 0 || slot > 999)
+		return false;
+
+	Common::String fileName = getSavegameFilename(slot, _vm->_targetName);
+	Common::SeekableReadStream *in = _vm->_saveFileMan->openForLoading(fileName);
+	if (!in)
+		return false;
+
+	delete in;
+	return true;
+}
+
+bool SaveLoadManager::isSavingEnabled() const {
+	return _enableSaving;
+}
+
+void SaveLoadManager::enableSaving(bool enable) {
+	_enableSaving = enable;
+}
+
+Common::String SaveLoadManager::getSavegameFilename(int slot, const Common::String target) {
+	assert(slot >= 0 && slot <= 999);
+	return target + Common::String::format(".%03d", slot);
+}
+
+bool SaveLoadManager::readSaveHeader(Common::SeekableReadStream *saveFile, SaveHeader &header) {
+	if (saveFile == nullptr || saveFile->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
+		return false;
+
+	header.version = saveFile->readUint32BE();
+	if (header.version > SNATCHER_SAVEFILE_VERSION)
+		return false;
+	header.platform = saveFile->readUint32BE();
+	header.lang = saveFile->readUint32BE();
+	header.desc = saveFile->readString('\0', saveFile->readUint32BE());
+
+	Graphics::Surface *srf = nullptr;
+	if (!Graphics::loadThumbnail(*saveFile, srf))
+		return false;
+	header.thumbnail = Common::SharedPtr<Graphics::Surface>(srf, Graphics::SurfaceDeleter());
+
+	header.td.tm_sec = saveFile->readUint32BE();
+	header.td.tm_min = saveFile->readUint32BE();
+	header.td.tm_hour = saveFile->readUint32BE();
+	header.td.tm_mday = saveFile->readUint32BE();
+	header.td.tm_mon = saveFile->readUint32BE();
+	header.td.tm_year = saveFile->readUint32BE();
+	header.td.tm_wday = saveFile->readUint32BE();
+
+	header.totalPlayTime = saveFile->readUint32BE();
+	header.saveCount = saveFile->readSint16BE();
+
+	return true;
+}
+
+void SaveLoadManager::loadState(int slot, GameState &state) {
+	SaveHeader header;
+	Common::InSaveFile *in = openFileForLoading(slot, state, header);
+
+	_vm->_keyRepeat = in->readByte();
+	_vm->_enableLightGun = in->readByte();
+
+	state.chapter = in->readSint16BE();
+	state.chapterSub = in->readSint16BE();
+	state.counter = in->readSint16BE();
+	state.finish = in->readSint16BE();
+	state.frameNo = in->readSint16BE();
+	state.frameState = in->readSint16BE();
+	state.menuSelect = in->readSint16BE();
+	state.modIndex = in->readSint16BE();
+	state.modProcessSub = in->readSint16BE();
+	state.modProcessTop = in->readSint16BE();
+	state.prologue = in->readSint16BE();
+
+	_vm->_scriptEngine->loadState(in, state.script);
+	_vm->_cmdQueue->loadState(in);
+	_vm->gfx()->loadState(in);
+	_vm->sound()->loadState(in);
+
+	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
+		error("%s(): Save file invalid or corrupt", __FUNCTION__);
+
+	delete in;
+
+	if (state.prologue == -1) {
+		state.chapter = 0;
+		state.chapterSub = 0;
+		state.menuSelect = 1;
+	}
+}
+
+void SaveLoadManager::saveState(int slot, GameState &state) {
+	Common::OutSaveFile *out = openFileForSaving(slot, _desc, state);
+
+	out->writeByte(_vm->_keyRepeat);
+	out->writeByte(_vm->_enableLightGun);
+
+	out->writeSint16BE(state.chapter);
+	out->writeSint16BE(state.chapterSub);
+	out->writeSint16BE(state.counter);
+	out->writeSint16BE(state.finish);
+	out->writeSint16BE(state.frameNo);
+	out->writeSint16BE(state.frameState);
+	out->writeSint16BE(state.menuSelect);
+	out->writeSint16BE(state.modIndex);
+	out->writeSint16BE(state.modProcessSub);
+	out->writeSint16BE(state.modProcessTop);
+	out->writeSint16BE(state.prologue);
+
+	_vm->_scriptEngine->saveState(out, state.script);
+	_vm->_cmdQueue->saveState(out);
+	_vm->gfx()->saveState(out);
+	_vm->sound()->saveState(out);
+
+	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
+	
+	out->finalize();
+	delete out;
+
+	updateSaveSlotsState(state);
+}
+
+Common::SeekableReadStream *SaveLoadManager::openFileForLoading(int slot, GameState &state, SaveHeader &header) {
+	Common::String fileName = getSavegameFilename(slot, _vm->_targetName);
+	Common::SeekableReadStream *in = _vm->_saveFileMan->openForLoading(fileName);
+	if (!in)
+		error("%s(): Unable to open savegame file", __FUNCTION__);
+
+	readSaveHeader(in, header);
+	state.totalPlayTime = header.totalPlayTime;
+	state.saveCount = header.saveCount;
+
+	return in;
+}
+
+Common::OutSaveFile *SaveLoadManager::openFileForSaving(int slot, const Common::String &desc, GameState &state) {
+	Common::String fileName = getSavegameFilename(slot, _vm->_targetName);
+	Common::OutSaveFile *out = _vm->_saveFileMan->openForSaving(fileName);
+	if (!out)
+		error("%s(): Unable to create savegame file", __FUNCTION__);
+
+	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
+	out->writeUint32BE(SNATCHER_SAVEFILE_VERSION);
+	out->writeUint32BE(_vm->_game.platform);
+	out->writeUint32BE(_vm->_game.lang);
+	out->writeUint32BE(desc.size());
+	out->write(desc.c_str(), desc.size());
+
+	Graphics::Surface tn;
+	if (!::createThumbnailFromScreen(&tn))
+		error("%s(): Unable to create thumbnail", __FUNCTION__);
+
+	Graphics::saveThumbnail(*out, tn);
+	
+	TimeDate td;
+	_vm->_system->getTimeAndDate(td);
+
+	out->writeSint32BE(td.tm_sec);
+	out->writeSint32BE(td.tm_min);
+	out->writeSint32BE(td.tm_hour);
+	out->writeSint32BE(td.tm_mday);
+	out->writeSint32BE(td.tm_mon);
+	out->writeSint32BE(td.tm_year);
+	out->writeSint32BE(td.tm_wday);
+
+	out->writeUint32BE(state.totalPlayTime);
+	out->writeSint16BE(state.saveCount);
+
+	return out;
+}
+
 } // End of namespace Snatcher
diff --git a/engines/snatcher/saveload.h b/engines/snatcher/saveload.h
index 87b13241541..9a884541e36 100644
--- a/engines/snatcher/saveload.h
+++ b/engines/snatcher/saveload.h
@@ -23,10 +23,72 @@
 #ifndef SNATCHER_SAVELOAD_H
 #define SNATCHER_SAVELOAD_H
 
+#include "common/ptr.h"
+#include "common/str.h"
+#include "common/system.h"
+#include "snatcher/state.h"
+
+namespace Common {
+class SeekableReadStream;
+class OutSaveFile;
+}
+
+namespace Graphics {
+struct Surface;
+}
 
 namespace Snatcher {
 
+class SnatcherEngine;
+class SaveLoadManager {
+public:
+	SaveLoadManager(SnatcherEngine *vm);
+	~SaveLoadManager();
+
+	void loadSettings(Config &config);
+	void saveSettings(const Config &config);
+	void updateSaveSlotsState(GameState &state);
+
+	void requestLoad(int slot);
+	void requestSave(int slot, const Common::String &desc);
+
+	void handleSaveLoad(GameState &state);
+
+	bool isSaveSlotUsed(int16 slot) const;
+	bool isSavingEnabled() const;
+	void enableSaving(bool enable);
+
+public:
+	struct SaveHeader {
+		SaveHeader() : version(0), lang(0), platform(0), desc(), thumbnail(), totalPlayTime(0), saveCount(0) {
+			memset(&td, 0, sizeof(TimeDate));
+		}
+		uint32 version;
+		uint32 lang;
+		uint32 platform;
+		Common::String desc;
+		TimeDate td;
+		Common::SharedPtr<Graphics::Surface> thumbnail;
+		uint32 totalPlayTime;
+		int16 saveCount;
+	};
+
+	static Common::String getSavegameFilename(int slot, Common::String target);
+	static bool readSaveHeader(Common::SeekableReadStream *saveFile, SaveHeader &header);
+
+private:
+	void loadState(int slot, GameState &state);
+	void saveState(int slot, GameState &state);
+
+	Common::SeekableReadStream *openFileForLoading(int slot, GameState &state, SaveHeader &header);
+	Common::OutSaveFile *openFileForSaving(int slot, const Common::String &desc, GameState &state);
 
+	SnatcherEngine *_vm;
+	Common::String _desc;
+	int _pendingSaveLoad;
+	bool _tryLoadFromLauncher;
+	bool _enableSaving;
+};
 
 } // End of namespace Snatcher
 
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene/scene_d2.cpp
index 0980bd7e6ee..d9279ae0bb9 100644
--- a/engines/snatcher/scene/scene_d2.cpp
+++ b/engines/snatcher/scene/scene_d2.cpp
@@ -49,8 +49,11 @@ void updateAnimBlink();
 
 // local vars
 int16 _option;
+uint16 _curSaveFile;
 uint16 _counter2;
 bool _loadCancelled;
+uint8 _buram0;
+bool _buram2;
 
 SH_HEAD_END(D2)
 
@@ -70,7 +73,7 @@ SH_IMP_FRMTBL(D2) {
 	SH_FRM(D2, 12)
 };
 
-SH_IMP_CTOR(D2), _option(0), _counter2(0), _loadCancelled(false) {
+SH_IMP_CTOR(D2), _option(0), _curSaveFile(0), _counter2(0), _loadCancelled(false), _buram2(true), _buram0(0) {
 	SH_CTOR_MAKEPROCS(D2);
 }
 
@@ -85,11 +88,6 @@ SH_IMPL_UPDT(D2) {
 		(*_frameProcs[state.frameNo])(state);
 }
 
-int _hasSaveSlotFlag = 15;
-int _saveFileCurID = 0;
-uint8 _buram_0 = 0;
-bool _buram_2 = true;
-
 // functions
 SH_IMPL_FRM(D2, 00) {
 	switch (state.frameState) {
@@ -113,7 +111,7 @@ SH_IMPL_FRM(D2, 00) {
 	case 2:
 		if (_vm->input().controllerFlags & 3) {
 			_vm->gfx()->clearAnimParameterFlags(16, GraphicsEngine::kAnimParaControlFlags, ~GraphicsEngine::kAnimHide);
-			_buram_0 ^= 1;
+			_buram0 ^= 1;
 		}
 		if (_vm->input().controllerFlags & 0x80) {
 			state.counter = 10;
@@ -124,8 +122,8 @@ SH_IMPL_FRM(D2, 00) {
 	default:
 		if (--state.counter)
 			return;
-		if (_buram_0)
-			state.conf.hasRAMCart = _buram_2;
+		if (_buram0)
+			state.conf.hasRAMCart = _buram2;
 		++state.frameNo;
 		state.frameState = 0;
 		break;
@@ -206,12 +204,11 @@ SH_IMPL_FRM(D2, 06) {
 SH_IMPL_FRM(D2, 07) {
 	switch (state.frameState) {
 	case 0:
-		// loadSaveFile();
 		++state.frameState;
 		break;
 	default:
 		++state.frameNo;
-		if (_hasSaveSlotFlag)
+		if (state.saveSlotUsage)
 			++state.frameNo;
 		state.frameState = 0;
 		break;
@@ -251,8 +248,8 @@ SH_IMPL_FRM(D2, 09) {
 	switch (state.frameState) {
 	case 0:
 		_vm->gfx()->transitionCommand(0xFF);
-		_vm->gfx()->clearAnimParameterFlags(_hasSaveSlotFlag ? 17 : 16, GraphicsEngine::kAnimParaControlFlags, ~GraphicsEngine::kAnimHide);
-		state.frameState += (_hasSaveSlotFlag ? 1 : 2);
+		_vm->gfx()->clearAnimParameterFlags(state.saveSlotUsage ? 17 : 16, GraphicsEngine::kAnimParaControlFlags, ~GraphicsEngine::kAnimHide);
+		state.frameState += (state.saveSlotUsage ? 1 : 2);
 		break;
 	case 1:
 		if (_vm->input().controllerFlags & 3)
@@ -304,14 +301,14 @@ SH_IMPL_FRM(D2, 10) {
 
 		do {
 			if (_vm->input().controllerFlags & 1)
-				--_saveFileCurID;
+				--_curSaveFile;
 			if (_vm->input().controllerFlags & 2)
-				++_saveFileCurID;
-			_saveFileCurID &= 3;
-		} while (!(_hasSaveSlotFlag & (1 << _saveFileCurID)));
+				++_curSaveFile;
+			_curSaveFile &= 3;
+		} while (!(state.saveSlotUsage & (1 << _curSaveFile)));
 
-		_vm->gfx()->setAnimParameter(24, GraphicsEngine::kAnimParaFrame, _saveFileCurID << 2);
-		_vm->gfx()->setAnimParameter(25, GraphicsEngine::kAnimParaFrame, _saveFileCurID << 2);
+		_vm->gfx()->setAnimParameter(24, GraphicsEngine::kAnimParaFrame, _curSaveFile << 2);
+		_vm->gfx()->setAnimParameter(25, GraphicsEngine::kAnimParaFrame, _curSaveFile << 2);
 
 		if (_vm->input().controllerFlags & 0x80) {
 			_vm->sound()->fmSendCommand(56, 0, 2);
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index 9268789163a..961afa74f53 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -20,19 +20,21 @@
 */
 
 
-#include "common/endian.h"
 #include "snatcher/graphics.h"
+#include "snatcher/memory.h"
 #include "snatcher/resource.h"
+#include "snatcher/saveload.h"
 #include "snatcher/script.h"
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
 #include "snatcher/ui.h"
 #include "snatcher/util.h"
-
+#include "common/savefile.h"
+#include "common/stream.h"
 
 namespace Snatcher {
 
-CmdQueue::CmdQueue(SnatcherEngine *vm) : _vm(vm), _data(nullptr), _readPos(0), _writePos(nullptr), _enable(false), _progress(-1), _currentOpcode(0),  _counter(0), _opcodes() {
+CmdQueue::CmdQueue(SnatcherEngine *vm) : _vm(vm), _data(nullptr), _readPos(0), _writePos(nullptr), _enable(false), _progress(-1), _currentOpcode(0),  _counter(0), _state(nullptr), _opcodes() {
 	_data = new uint16[256]();
 	makeFunctions();
 	reset();
@@ -60,10 +62,12 @@ void CmdQueue::writeUInt32(uint32 val) {
 	_writePos += 2;
 }
 
-void CmdQueue::run() {
+void CmdQueue::run(GameState &state) {
 	if (!_enable)
 		return;
 
+	_state = &state;
+
 	do {
 		if (_progress == -1) {
 			_currentOpcode = *_readPos++;
@@ -77,6 +81,16 @@ void CmdQueue::run() {
 	} while (_currentOpcode != 0 && _progress == -1);
 }
 
+void CmdQueue::loadState(Common::SeekableReadStream *in) {
+	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
+		error("%s(): Save file invalid or corrupt", __FUNCTION__);
+}
+
+void CmdQueue::saveState(Common::SeekableWriteStream *out) {
+	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
+
+}
+
 void CmdQueue::makeFunctions() {
 #define OP(x) &CmdQueue::m_##x
 	typedef void (CmdQueue::*SFunc)(const uint16*&);
@@ -85,17 +99,17 @@ void CmdQueue::makeFunctions() {
 		OP(initAnimations),
 		OP(02),
 		OP(drawCommands),
-		OP(04),
+		OP(fmSfxBlock),
 		OP(printText),
 		OP(06),
 		OP(fmMusicStart),
 		OP(displayDialog),
 		OP(animOps),
 		OP(pcmWait),
-		OP(11),
+		OP(cdaWait),
 		OP(pcmSound),
 		OP(chatWithPortraitAnim),
-		OP(14),
+		OP(cdaPlay),
 		OP(gfxReset),
 		OP(waitFrames),
 		OP(loadResource),
@@ -106,14 +120,14 @@ void CmdQueue::makeFunctions() {
 		OP(resetTextFields),
 		OP(23),
 		OP(24),
-		OP(25),
+		OP(fmSfxWait),
 		OP(26),
 		OP(27),
 		OP(fmSoundEffect),
 		OP(pcmBlock),
-		OP(30),
+		OP(saveGame),
 		OP(31),
-		OP(32),
+		OP(gfxPostLoadProcess),
 		OP(33),
 		OP(palOps),
 		OP(clearJordanInputField)
@@ -152,6 +166,16 @@ void CmdQueue::m_initAnimations(const uint16 *&data) {
 }
 
 void CmdQueue::m_02(const uint16 *&data) {
+	if (_progress == 0) {
+		_vm->gfx()->reset(GraphicsEngine::kResetPalEvents);
+		for (int i = 0; i < 64; ++i)
+			_vm->gfx()->setAnimParameter(i, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause);
+		_vm->gfx()->enqueuePaletteEvent(_vm->_scd->makePtr(0x100D8));
+		_counter = 48;
+		++_progress;
+	} else if (--_counter == 0) {
+		_progress = -1;
+	}
 }
 
 void CmdQueue::m_drawCommands(const uint16 *&data) {
@@ -161,7 +185,7 @@ void CmdQueue::m_drawCommands(const uint16 *&data) {
 	_progress = -1;
 }
 
-void CmdQueue::m_04(const uint16 *&data) {
+void CmdQueue::m_fmSfxBlock(const uint16 *&data) {
 	_vm->sound()->fmBlock(true);
 	_progress = -1;
 }
@@ -227,7 +251,9 @@ void CmdQueue::m_pcmWait(const uint16 *&data) {
 		_progress = -1;
 }
 
-void CmdQueue::m_11(const uint16 *&data) {
+void CmdQueue::m_cdaWait(const uint16 *&data) {
+	if (!_vm->sound()->cdaIsPlaying())
+		_progress = -1;
 }
 
 void CmdQueue::m_pcmSound(const uint16 *&data) {
@@ -266,7 +292,16 @@ void CmdQueue::m_chatWithPortraitAnim(const uint16 *&data) {
 		++data;
 }
 
-void CmdQueue::m_14(const uint16 *&data) {
+void CmdQueue::m_cdaPlay(const uint16 *&data) {
+	if (_progress == 0) {
+		_vm->sound()->cdaPlay(*data++);
+		++_progress;
+	} else if (_progress == 1) {
+		if (_vm->sound()->cdaIsPlaying())
+			++_progress;
+	} else {
+		_progress = -1;
+	}
 }
 
 void CmdQueue::m_gfxReset(const uint16 *&data) {
@@ -305,11 +340,11 @@ void CmdQueue::m_loadResource(const uint16 *&data) {
 		++_progress;
 
 		if (dest == 0x1A800) {
-			delete[] _vm->_script->data;
-			_vm->_script->data = _vm->_fio->fileData(index, &_vm->_script->dataSize);
-			assert(_vm->_script->data);
-			_vm->_script->curFileNo = index;
-			_vm->_ui->setScriptTextResource(_vm->_script->getTextResource());
+			delete[] _state->script.data;
+			_state->script.data = _vm->_fio->fileData(index, &_state->script.dataSize);
+			assert(_state->script.data);
+			_state->script.curFileNo = index;
+			_vm->_ui->setScriptTextResource(_state->script.getTextResource());
 		} else if (dest == 0x28000) {
 			delete _vm->_module;
 			_vm->_module = _vm->_fio->loadModule(index);
@@ -365,7 +400,13 @@ void CmdQueue::m_24(const uint16 *&data) {
 //shooting practice
 }
 
-void CmdQueue::m_25(const uint16 *&data) {
+void CmdQueue::m_fmSfxWait(const uint16 *&data) {
+	if (_progress == 0) {
+		_counter = 600;
+		++_progress;
+	}
+	if (--_counter == 0 || (_vm->sound()->fmGetStatus().sfx == 0)) 
+		_progress = -1;
 }
 
 void CmdQueue::m_26(const uint16 *&data) {
@@ -385,13 +426,21 @@ void CmdQueue::m_pcmBlock(const uint16 *&data) {
 	_progress = -1;
 }
 
-void CmdQueue::m_30(const uint16 *&data) {
+void CmdQueue::m_saveGame(const uint16 *&data) {
+	int slot = *data++;
+	Common::String desc(Common::String::format("SNATCHER_%02d", slot));
+	_vm->saveGameState(slot, desc);
+	_progress = -1;
 }
 
 void CmdQueue::m_31(const uint16 *&data) {
 }
 
-void CmdQueue::m_32(const uint16 *&data) {
+void CmdQueue::m_gfxPostLoadProcess(const uint16 *&data) {
+	_vm->gfx()->runScript(_vm->_module->getGfxData(), *data++);
+	_vm->gfx()->updateAnimations();
+	_vm->gfx()->postLoadProcess();
+	_progress = -1;
 }
 
 void CmdQueue::m_33(const uint16 *&data) {
@@ -409,9 +458,9 @@ void CmdQueue::m_clearJordanInputField(const uint16 *&data) {
 	_progress = -1;
 }
 
-ScriptEngine::ScriptEngine(CmdQueue *que, UI *ui, ResourcePointer *scd) : _que(que), _ui(ui), _arrayData(nullptr), _pos1(0), _pos2(0), _op(0), /*_v1(0), _v2(0), _v3(0),*/ _result(0), _flagsTable(nullptr) {
+ScriptEngine::ScriptEngine(CmdQueue *que, UI *ui, MemAccessHandler *mem, ResourcePointer *scd) : _que(que), _ui(ui), _mem(mem), _arrayData(nullptr), _pos1(0), _pos2(0), _op(0), /*_v1(0), _v2(0), _v3(0),*/ _result(0), _flagsTable(nullptr) {
 	_flagsTable = new uint8[352]();
-	_arrayData = new uint8[0x100]();
+	_arrayData = new uint8[256]();
 	makeOpcodeTable(scd);
 	resetArrays();
 	_ui->setScriptVerbsArray(&_arrays[1]);
@@ -425,7 +474,7 @@ ScriptEngine::~ScriptEngine() {
 
 void ScriptEngine::resetArrays() {
 	static const uint8 arraySizes[] = { 0x08, 0x1F, 0x0F, 0x12, 0x03, 0x10 };
-	memset(_arrayData, 0, 0x100);
+	memset(_arrayData, 0, 256);
 
 	uint8 *pos = _arrayData;
 	for (int i = 0; i < ARRAYSIZE(_arrays); ++i) {
@@ -434,13 +483,10 @@ void ScriptEngine::resetArrays() {
 	}
 }
 
-void ScriptEngine::run(Script *script) {
-	assert(script);
-
-	_script = script;
-	_pos1 = script->curPos;
-	//script->sp = script->bp;
-	script->sentenceDone = 0;
+void ScriptEngine::run(Script &script) {
+	_script = &script;
+	_pos1 = script.curPos;
+	script.sentenceDone = 0;
 
 	runOpcode();
 }
@@ -450,16 +496,16 @@ void ScriptEngine::run(Script *script) {
 #define ARR_READ(x, y) _arrays[x].read(y)
 #define ARR_WRITE(x, y, z) _arrays[x].write(y, z)
 
-bool ScriptEngine::postProcess(Script *script) {
-	if (script->newPos != 0xFFFF) {
+bool ScriptEngine::postProcess(Script &script) {
+	if (script.newPos != 0xFFFF) {
 		if (ARR_SIZE(4) <= ARR_POS(4)) {
 			for (int i = 0; i < ARR_POS(4) - 1; ++i)
 				ARR_WRITE(4, i, ARR_READ(4, i + 1));
 			--ARR_POS(4);
 		}
-		setArrayLastEntry(4, script->curPos);
-		script->curPos = script->newPos;
-		script->newPos = 0xFFFF;
+		setArrayLastEntry(4, script.curPos);
+		script.curPos = script.newPos;
+		script.newPos = 0xFFFF;
 		_ui->resetVerbSelection();
 	}
 
@@ -490,6 +536,45 @@ void ScriptEngine::processInput() {
 	ARR_POS(1) = 0;
 }
 
+void ScriptEngine::loadState(Common::SeekableReadStream *in, Script &script) {
+	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
+		error("%s(): Save file invalid or corrupt", __FUNCTION__);
+
+	uint16 *d = reinterpret_cast<uint16*>(_arrayData);
+	for (int i = 0; i < 128; ++i)
+		d[i] = in->readUint16BE();
+	in->read(_flagsTable, 352);
+
+	script.sentenceDone = in->readByte();
+	script.sentencePos = in->readByte();
+	script.curFileNo = in->readByte();
+	script.curGfxScript = in->readSint16BE();
+	script.curPos = in->readUint16BE();
+
+	ARR_POS(0) = 0;
+	ARR_POS(1) = 0;
+	ARR_POS(2) = 0;
+	ARR_POS(3) = 0;
+	ARR_POS(5) = 0;
+}
+
+void ScriptEngine::saveState(Common::SeekableWriteStream *out, Script &script) {
+	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
+
+	const uint16 *s = reinterpret_cast<const uint16*>(_arrayData);
+	for (int i = 0; i < 128; ++i)
+		out->writeUint16BE(s[i]);
+	out->write(_flagsTable, 352);
+
+	out->writeByte(script.sentenceDone);
+	out->writeByte(script.sentencePos);
+	out->writeByte(script.curFileNo);
+	out->writeSint16BE(script.curGfxScript);
+	uint16 pos = script.curPos;
+	getArrayEntry(5, 0, pos);
+	out->writeUint16BE(pos);
+}
+
 void ScriptEngine::runOpcode() {
 	uint8 op = getOpcode(_pos1);
 	if (_opcodes[op].proc->isValid())
@@ -741,27 +826,6 @@ uint8 ScriptEngine::getOpcode(int offset) {
 	return op;
 }
 
-void ScriptEngine::writeHostMemory(uint16 addr, uint16 val) {
-	// The scripts have the wonderful capability to directly write into the sub cpu memory.
-	// It is limited to 16bit addresses at least. I hope that in practice, this will only
-	// happen for some global variables. We will just have to catch every case whenever a
-	// new address comes up...
-	switch (addr) {
-	case 0x79F0:
-		break;
-	case 0x971a:
-		_ui->setInterpreterMode(val);
-		break;
-	case 0xFFFF:
-		// This is an exception that is caught even in the original code.
-		//_vm->sound()->setUnkCond(val);
-		val = val;
-		break;
-	default:
-		error("%s(): Unhandled address 0x%04X", __FUNCTION__, addr);
-	}
-}
-
 #ifdef SNATCHER_SCRIPT_DEBUG
 int ScriptEngine::ScriptEngineProc::_recursion = 0;
 #endif
@@ -791,7 +855,7 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 		OP(fmMusicStart),
 		OP(callSubRoutine),
 		OP(12),
-		OP(13),
+		OP(cdaPlay),
 		OP(14),
 		OP(fmSoundEffect),
 		OP(eval_equal),
@@ -850,8 +914,8 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 		OP(animWait),
 		OP(pcmSoundWait),
 		OP(fmMusicWait),
-		OP(72),
-		OP(73),
+		OP(cdaWait),
+		OP(fmSfxWait),
 		OP(waitFrames)
 	};
 #undef OP
@@ -901,6 +965,10 @@ void ScriptEngine::o_chatWithPortraitAnim() {
 }
 
 void ScriptEngine::o_05() {
+	if (!evalFinished())
+		return;
+	_que->writeUInt16(0x0C);
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
 }
 
 void ScriptEngine::o_eval_and() {
@@ -962,7 +1030,12 @@ void ScriptEngine::o_12() {
 	_script->curPos = cp;
 }
 
-void ScriptEngine::o_13() {
+void ScriptEngine::o_cdaPlay() {
+	if (!evalFinished())
+		return;
+	_que->writeUInt16(0x0E);
+	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
+
 }
 
 void ScriptEngine::o_14() {
@@ -1325,9 +1398,11 @@ void ScriptEngine::o_sysOps() {
 
 	switch (sub) {
 	case 0:
+		// Block fm music
 		_que->writeUInt16(0x04);
 		break;
 	case 1:
+		// Save game state
 		_que->writeUInt16(0x1E);
 		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 4));
 		//saveState_sub_14F12();
@@ -1339,22 +1414,28 @@ void ScriptEngine::o_sysOps() {
 		_que->writeUInt16(0x1F);
 		break;
 	case 4:
+		// Start action sequence
 		//_scr_wd_00 = READ_BE_UINT16(_script->data + _pos1 + 4);
 		//_scr_wd_01 = _scr_wd_02 = _scr_wd_03 = _scr_wd_04 = 0;
 		//_scr_bt_00 = true;
 		_que->writeUInt16(0x18);
 		break;
 	case 5:
+		// The scripts have the wonderful capability to read from and write into
+		// the sub cpu memory. It is limited to 16bit addresses at least. I hope
+		// that in practice, this will only happen for some global variables. We
+		// will just have to catch every case whenever a new address comes up...
 		addr = READ_BE_UINT16(_script->data + _pos1 + 4);
-		_result = 0;//READ_BE_UINT16(addr);
-		debug ("READ VAR: Addr 0x%04x", addr);
+		_result = _mem->readWord(addr);
 		break;
 	case 6:
+		// See case 5
 		addr = READ_BE_UINT16(_script->data + _pos1 + 5);
 		val = READ_BE_UINT16(_script->data + _pos1 + 7);
-		writeHostMemory(addr, val);
+		_mem->writeWord(addr, val);
 		break;
 	case 7:
+		// Block pcm sounds
 		_que->writeUInt16(0x1D);
 		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 4) ? 1 : 0);
 		break;
@@ -1371,7 +1452,7 @@ void ScriptEngine::o_sysOps() {
 		}
 		break;
 	case 9:
-		val = /*_vm->_gameState.chapter = */READ_BE_UINT16(_script->data + _pos1 + 4) + 2;
+		_script->chapter = READ_BE_UINT16(_script->data + _pos1 + 4) + 2;
 		break;
 	case 10:
 		val = READ_BE_UINT16(_script->data + _pos1 + 4);
@@ -1441,10 +1522,14 @@ void ScriptEngine::o_fmMusicWait() {
 		_que->writeUInt16(0x13);
 }
 
-void ScriptEngine::o_72() {
+void ScriptEngine::o_cdaWait() {
+	if (evalFinished())
+		_que->writeUInt16(0x0B);
 }
 
-void ScriptEngine::o_73() {
+void ScriptEngine::o_fmSfxWait() {
+	if (evalFinished())
+		_que->writeUInt16(0x19);
 }
 
 void ScriptEngine::o_waitFrames() {
diff --git a/engines/snatcher/script.h b/engines/snatcher/script.h
index 577ca33c461..c1e5f6d7704 100644
--- a/engines/snatcher/script.h
+++ b/engines/snatcher/script.h
@@ -28,6 +28,11 @@
 
 #define		SNATCHER_SCRIPT_DEBUG
 
+namespace Common {
+class SeekableReadStream;
+class SeekableWriteStream;
+} // namespace Common
+
 namespace Snatcher {
 
 class ResourcePointer;
@@ -41,9 +46,12 @@ public:
 	void reset();
 	void writeUInt16(uint16 val);
 	void writeUInt32(uint32 val);
-	void start() { _enable = true; }	
+	void start() { _enable = (_writePos != _data); }
 	bool enabled() const { return _enable; }
-	void run();
+	void run(GameState &state);
+
+	void loadState(Common::SeekableReadStream *in);
+	void saveState(Common::SeekableWriteStream *out);
 
 private:
 	const uint16 *_readPos;
@@ -55,6 +63,7 @@ private:
 	bool _enable;
 
 	SnatcherEngine *_vm;
+	GameState *_state;
 
 private:
 	void makeFunctions();
@@ -63,17 +72,17 @@ private:
 	void m_initAnimations(const uint16 *&data);
 	void m_02(const uint16 *&data);
 	void m_drawCommands(const uint16 *&data);
-	void m_04(const uint16 *&data);
+	void m_fmSfxBlock(const uint16 *&data);
 	void m_printText(const uint16 *&data);
 	void m_06(const uint16 *&data);
 	void m_fmMusicStart(const uint16 *&data);
 	void m_displayDialog(const uint16 *&data);
 	void m_animOps(const uint16 *&data);
 	void m_pcmWait(const uint16 *&data);
-	void m_11(const uint16 *&data);
+	void m_cdaWait(const uint16 *&data);
 	void m_pcmSound(const uint16 *&data);
 	void m_chatWithPortraitAnim(const uint16 *&data);
-	void m_14(const uint16 *&data);
+	void m_cdaPlay(const uint16 *&data);
 	void m_gfxReset(const uint16 *&data);
 	void m_waitFrames(const uint16 *&data);
 	void m_loadResource(const uint16 *&data);
@@ -84,14 +93,14 @@ private:
 	void m_resetTextFields(const uint16 *&data);
 	void m_23(const uint16 *&data);
 	void m_24(const uint16 *&data);
-	void m_25(const uint16 *&data);
+	void m_fmSfxWait(const uint16 *&data);
 	void m_26(const uint16 *&data);
 	void m_27(const uint16 *&data);
 	void m_fmSoundEffect(const uint16 *&data);
 	void m_pcmBlock(const uint16 *&data);
-	void m_30(const uint16 *&data);
+	void m_saveGame(const uint16 *&data);
 	void m_31(const uint16 *&data);
-	void m_32(const uint16 *&data);
+	void m_gfxPostLoadProcess(const uint16 *&data);
 	void m_33(const uint16 *&data);
 	void m_palOps(const uint16 *&data);
 	void m_clearJordanInputField(const uint16 *&data);
@@ -100,34 +109,6 @@ private:
 	Common::Array<CmdQueOpcode*> _opcodes;	
 };
 
-struct Script {
-	Script(uint32 textResourceOffset) : sentenceDone(0), sentencePos(0), data(nullptr), dataSize(0), curPos(0), newPos(0xFFFF), curFileNo(0), curGfxScript(-1), textResOffset(textResourceOffset) /*,
-		stack(nullptr), stackSize(0x600), sp(nullptr), bp(nullptr)*/ {
-		// stack = new uint8[stackSize]();
-		// sp = bp = &stack[stackSize];
-	}
-	~Script() {
-		// delete[] stack;
-		delete[] data;
-	}
-	const uint8 *getTextResource() const {
-		return data + textResOffset;
-	}
-	uint8 sentenceDone;
-	uint8 sentencePos;
-	uint8 curFileNo;
-	int16 curGfxScript;
-	const uint8 *data;
-	uint32 dataSize;
-	uint16 curPos;
-	uint16 newPos;
-	//uint8 *stack;
-	//const uint32 stackSize;
-	const uint32 textResOffset;
-	//uint8 *sp;
-	//uint8 *bp;
-};
-
 class ScriptArray {
 public:
 	ScriptArray() : _data(nullptr) {}
@@ -151,18 +132,23 @@ private:
 	uint8 *_data;
 };
 
+class MemAccessHandler;
 class ScriptEngine {
 public:
-	ScriptEngine(CmdQueue *que, UI *ui, ResourcePointer *scd);
+	ScriptEngine(CmdQueue *que, UI *ui, MemAccessHandler *mem, ResourcePointer *scd);
 	~ScriptEngine();
 
 	void resetArrays();
-	void run(Script *script);
-	bool postProcess(Script *script);
+	void run(Script &script);
+	bool postProcess(Script &script);
 	void processInput();
 
+	void loadState(Common::SeekableReadStream *in, Script &script);
+	void saveState(Common::SeekableWriteStream *out, Script &script);
+
 private:
 	CmdQueue *_que;
+	MemAccessHandler *_mem;
 	UI *_ui;
 	Script *_script;
 
@@ -171,7 +157,7 @@ private:
 	uint8 *_flagsTable;
 	int _pos1;
 	int _pos2;
-	uint16 /*_v1, _v2, _v3,*/ _result;
+	uint16 _result;
 	uint _op;
 
 private:
@@ -197,8 +183,6 @@ private:
 
 	uint8 getOpcode(int offset);
 
-	void writeHostMemory(uint16 addr, uint16 val);
-
 private:
 	void makeOpcodeTable(ResourcePointer *scd);
 
@@ -211,7 +195,7 @@ private:
 	void o_fmMusicStart();
 	void o_callSubRoutine();
 	void o_12();
-	void o_13();
+	void o_cdaPlay();
 	void o_14();
 	void o_fmSoundEffect();
 	void o_eval_equal();
@@ -245,8 +229,8 @@ private:
 	void o_animWait();
 	void o_pcmSoundWait();
 	void o_fmMusicWait();
-	void o_72();
-	void o_73();
+	void o_cdaWait();
+	void o_fmSfxWait();
 	void o_waitFrames();
 
 #ifndef SNATCHER_SCRIPT_DEBUG
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index b28d57c4452..bebf0b8d110 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -20,7 +20,9 @@
 */
 
 #include "snatcher/graphics.h"
+#include "snatcher/memory.h"
 #include "snatcher/resource.h"
+#include "snatcher/saveload.h"
 #include "snatcher/script.h"
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
@@ -45,26 +47,25 @@
 namespace Snatcher {
 
 SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _scd(nullptr), _gfx(nullptr), _snd(nullptr), _input(),
-	_scriptEngine(nullptr), _cmdQueue(nullptr), _script(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _enableLightGun(false), _ui(nullptr), _gfxInfo(),
-		_frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
+	_scriptEngine(nullptr), _cmdQueue(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _enableLightGun(false), _ui(nullptr), _gfxInfo(), _saveMan(nullptr), _reset(false),
+		_memHandler(nullptr), _frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
 	assert(system);
 }
 
 SnatcherEngine::~SnatcherEngine() {
-	delete _module;
-	delete _gfx;
-	delete _snd;
+	delete _cmdQueue;
 	delete _fio;
+	delete _gfx;
+	delete _memHandler;	
+	delete _module;
+	delete _saveMan;
 	delete _scd;
 	delete _scriptEngine;
-	delete _cmdQueue;
-	delete _script;
+	delete _snd;
 	delete _ui;
 }
 
 Common::Error SnatcherEngine::run() {
-	registerDefaultSettings();
-
 	if (!initResource())
 		return Common::Error(Common::kReadingFailed);
 
@@ -74,10 +75,19 @@ Common::Error SnatcherEngine::run() {
 	if (!initGfx(_game.platform, SNATCHER_GFXMODE_8BIT))
 		return Common::Error(Common::kUnsupportedColorMode);
 
+	if (!initSaveLoad())
+		return Common::Error(Common::kUnknownError);
+
 	if (!initScriptEngine())
 		return Common::Error(Common::kUnknownError);
 
-	return Common::Error(start() ? Common::kNoError : Common::kUnknownError);
+	bool result = false;
+	while (!shouldQuit()) {
+		reset();
+		result = start();
+	}
+
+	return result ? Common::kNoError : Common::kUnknownError;
 }
 
 bool SnatcherEngine::initResource() {
@@ -133,6 +143,11 @@ bool SnatcherEngine::initGfx(Common::Platform platform, bool use8BitColorMode) {
 	return false;
 }
 
+bool SnatcherEngine::initSaveLoad() {
+	_saveMan = new SaveLoadManager(this);
+	return (_saveMan != nullptr);
+}
+
 bool SnatcherEngine::initSound(Audio::Mixer *mixer, Common::Platform platform, int soundOptions) {
 	assert(_mixer);
 	assert(_fio);
@@ -156,21 +171,27 @@ bool SnatcherEngine::initScriptEngine() {
 	if (!_ui)
 		return false;
 
-	_scriptEngine = new ScriptEngine(_cmdQueue, _ui, _scd);
-	if (!_scriptEngine)
-		return false;
+	_memHandler = new MemAccessHandler(this, _ui, _saveMan);
+	assert(_memHandler);
 
-	_script = new Script(0x3800);
-	if (!_script)
+	_scriptEngine = new ScriptEngine(_cmdQueue, _ui, _memHandler, _scd);
+	if (!_scriptEngine)
 		return false;
 
 	return true;
 }
 
+void SnatcherEngine::reset() {
+	_gfx->reset(GraphicsEngine::kResetPalEvents | GraphicsEngine::kResetAnimations | GraphicsEngine::kResetCopyCmds | GraphicsEngine::kResetScrollState);
+	_snd->fmSendCommand(0xF1, 1);
+	_snd->pcmSendCommand(0xFF, -1);
+	_snd->cdaStop();
+}
+
 void SnatcherEngine::playBootLogoAnimation(const GameState &state) {
 	uint32 frameTimer = 0;
 	int curSeqState = 0;
-	_snd->fmSendCommand(242, -1);
+	_snd->fmSendCommand(0xF2, -1);
 
 	while (curSeqState != -1 && !shouldQuit()) {
 		frameTimer += _frameLen;
@@ -191,18 +212,20 @@ void SnatcherEngine::playBootLogoAnimation(const GameState &state) {
 bool SnatcherEngine::start() {
 	Util::rngReset();
 	GameState state;
+	_saveMan->loadSettings(state.conf);
+	_saveMan->updateSaveSlotsState(state);
+	_memHandler->setGameState(&state);
 
 	//playBootLogoAnimation(state);
-	state.prologue = -1;
-	state.modProcessTop = 7;
-	state.modProcessSub = 4;
 
+	_reset = false;
 	uint32 frameTimer = 0;
+	uint32 playTimer = 0;
 
 	int16 countTo5 = 0;
 	int16 runspeed = 0;
 
-	while (!shouldQuit()) {
+	while (!shouldQuit() && !_reset) {
 		frameTimer += _frameLen;
 		uint32 nextFrame = _system->getMillis() + (frameTimer >> 14);
 		frameTimer &= 0x3FFF;
@@ -221,7 +244,7 @@ bool SnatcherEngine::start() {
 			if (!_gfx->busy(0)) {
 				bool blockedMod = _cmdQueue->enabled();
 				if (_cmdQueue->enabled()) {
-					_cmdQueue->run();
+					_cmdQueue->run(state);
 					blockedMod = _gfx->busy(0);
 				}
 				if (!blockedMod) {
@@ -245,9 +268,19 @@ bool SnatcherEngine::start() {
 
 		checkEvents(state);
 
+		_saveMan->handleSaveLoad(state);
+
 		_gfx->nextFrame();
 		_snd->update();
 		delayUntil(nextFrame);
+
+		if (state.modProcessTop == 5) {
+			playTimer += _frameLen;
+			if (playTimer >= (1000 << 14)) {
+				playTimer -= (1000 << 14);
+				++state.totalPlayTime;
+			}
+		}
 	}
 
 	return true;
@@ -373,6 +406,7 @@ void SnatcherEngine::updateChapter(GameState &state) {
 		else
 			_gfx->setVar(5, 1);
 
+		_cmdQueue->reset();
 		_cmdQueue->writeUInt16(0x16);
 		_cmdQueue->writeUInt16(0x03);
 		_cmdQueue->writeUInt32(0xECB6);
@@ -389,14 +423,30 @@ void SnatcherEngine::updateChapter(GameState &state) {
 
 	case 1:
 		// Init first scene or load savegame
-		_scriptEngine->resetArrays();
+		_cmdQueue->writeUInt16(0x11);
+		_cmdQueue->writeUInt32(0x1A800);
 		if (state.menuSelect == 0) {
-			_cmdQueue->writeUInt16(0x11);
-			_cmdQueue->writeUInt32(0x1A800);
+			// Enter first scene	
 			_cmdQueue->writeUInt16(0x3F);
-			_cmdQueue->writeUInt16(15);
+			_cmdQueue->writeUInt16(0x0F);
 		} else {
-			/* load savegame */
+			// Restore saved state
+			_cmdQueue->writeUInt16(state.script.curFileNo);
+			_cmdQueue->writeUInt16(0x0F);
+			_cmdQueue->writeUInt16(0x11);
+			_cmdQueue->writeUInt32(0x28000);
+			_cmdQueue->writeUInt16(state.script.curGfxScript >> 8);
+			if (_snd->pcmGetStatus().resourceId2 != -1) {
+				_cmdQueue->writeUInt16(0x0D);
+				_cmdQueue->writeUInt16(_snd->pcmGetStatus().resourceId2);
+				_cmdQueue->writeUInt16(0x0A);
+			}
+			_cmdQueue->writeUInt16(0x20);
+			_cmdQueue->writeUInt16(state.script.curGfxScript & 0xFF);
+			_cmdQueue->writeUInt16(0x07);
+			_cmdQueue->writeUInt16(_snd->fmGetStatus().music);
+			_snd->pcmBlock(_snd->pcmGetStatus().blocked);
+			_snd->reduceVolume2(_snd->fmGetStatus().reduceVol2);
 		}
 
 		_ui->setControllerConfig(state.conf.controllerSetup);
@@ -409,7 +459,7 @@ void SnatcherEngine::updateChapter(GameState &state) {
 	case 2:
 		// Act I
 		if (state.chapterSub & 0x40) {
-			if (_scriptEngine->postProcess(_script)) {
+			if (_scriptEngine->postProcess(state.script)) {
 				for (int i = 5; i < 15; ++i)
 					_gfx->setAnimParameter(i, GraphicsEngine::kAnimParaEnable, 0);
 				_cmdQueue->writeUInt16(0x22);
@@ -427,7 +477,7 @@ void SnatcherEngine::updateChapter(GameState &state) {
 				state.chapterSub &= ~0x20;
 			}
 		} else if (state.chapterSub == 0) {
-			_scriptEngine->run(_script);
+			_scriptEngine->run(state.script);
 			_cmdQueue->start();
 			state.chapterSub |= 0xC0;
 		}
@@ -437,6 +487,10 @@ void SnatcherEngine::updateChapter(GameState &state) {
 		break;
 
 	case 4:
+		// Reset
+		_cmdQueue->writeUInt16(0x02);
+		_cmdQueue->start();
+		_reset = true;
 		break;
 
 	case 5:
@@ -473,11 +527,9 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			++state.modProcessSub;
 			break;
 		case 3:
-			//if (*(uint16*)(&_wordRAM__TABLE48__word_B6400[0])) {
-				state.modProcessSub = 0;
-				state.finish = 0;
-				++state.modProcessTop;
-			//}
+			state.modProcessSub = 0;
+			state.finish = 0;
+			++state.modProcessTop;
 			break;
 		default:
 			break;
@@ -498,6 +550,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			if (_module)
 				_module->run(state);
 			if (state.finish) {
+				_saveMan->saveSettings(state.conf);
 				state.modProcessSub = 0;
 				state.finish = 0;
 				state.modProcessTop = state.menuSelect ? 7 : state.modProcessTop + 1;
@@ -651,9 +704,6 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 	}
 }
 
-void SnatcherEngine::registerDefaultSettings() {
-}
-
 void SnatcherEngine::syncSoundSettings() {
 	Engine::syncSoundSettings();
 
@@ -684,6 +734,24 @@ void SnatcherEngine::pauseEngineIntern(bool pause) {
 	_snd->pause(pause);
 }
 
+bool SnatcherEngine::canLoadGameStateCurrently(Common::U32String*) {
+	return true;
+}
+
+bool SnatcherEngine::canSaveGameStateCurrently(Common::U32String *msg) {
+	return _saveMan->isSavingEnabled();
+}
+
+Common::Error SnatcherEngine::loadGameState(int slot) {
+	_saveMan->requestLoad(slot);
+	return Common::kNoError;
+}
+
+Common::Error SnatcherEngine::saveGameState(int slot, const Common::String &desc, bool isAutosave) {
+	_saveMan->requestSave(slot, desc);
+	return Common::kNoError;
+}
+
 void SnatcherEngine::calibrateLightGun(GameState &state) {
 	state.conf.lightGunBias.x = _realLightGunPos.x - (_gfx->screenWidth() / 2);
 	state.conf.lightGunBias.y = _realLightGunPos.y - (_gfx->screenHeight() / 2);
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index 2c44b1f948c..8b368dc79ae 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -27,14 +27,13 @@
 #include "snatcher/detection.h"
 #include "snatcher/info.h"
 
-
 class SnatcherMetaEngine;
 
 namespace Snatcher {
 
 class GraphicsEngine;
 class FIO;
-class CmdQueue;
+class MemAccessHandler;
 class ResourcePointer;
 class ScriptEngine;
 class SoundEngine;
@@ -46,6 +45,7 @@ struct Script;
 
 class SnatcherEngine : public Engine {
 friend class CmdQueue;
+friend class SaveLoadManager;
 public:
 	SnatcherEngine(OSystem *system, GameDescription &dsc);
 	~SnatcherEngine() override;
@@ -58,8 +58,10 @@ private:
 	Common::Error run() override;
 	bool initResource();
 	bool initGfx(Common::Platform platform, bool use8BitColorMode);
+	bool initSaveLoad();
 	bool initSound(Audio::Mixer *mixer, Common::Platform platform, int soundOptions);
 	bool initScriptEngine();
+	void reset();
 	void playBootLogoAnimation(const GameState &state);
 
 	// Main loop
@@ -71,13 +73,19 @@ private:
 	void updateModuleState(GameState &state);
 
 	const uint32 _frameLen;
+	bool _reset;
 
 	// ConfigManager sync
-	void registerDefaultSettings();
 	void syncSoundSettings() override;
 
-	// GMM
+	// GMM, Save, Load
 	void pauseEngineIntern(bool pause) override;
+	bool canLoadGameStateCurrently(Common::U32String*) override;
+	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
+	Common::Error loadGameState(int slot) override;
+	Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
+
+	SaveLoadManager *_saveMan;
 
 	// MetaEngine
 	bool hasFeature(EngineFeature f) const override;
@@ -98,8 +106,8 @@ private:
 
 	// Script
 	CmdQueue *_cmdQueue;
+	MemAccessHandler *_memHandler;
 	ScriptEngine *_scriptEngine;
-	Script *_script; 
 
 public:
 	// Input
diff --git a/engines/snatcher/sound.cpp b/engines/snatcher/sound.cpp
index 685dd27c5e8..ca1a5857e4c 100644
--- a/engines/snatcher/sound.cpp
+++ b/engines/snatcher/sound.cpp
@@ -21,6 +21,7 @@
 
 #include "snatcher/sound_device.h"
 #include "snatcher/sound.h"
+#include "common/stream.h"
 
 namespace Snatcher {
 
@@ -86,6 +87,7 @@ void SoundEngine::update() {
 	_dev->update();
 
 	_pcmStatus.statusBits = _dev->pcmGetStatus();
+	_pcmStatus.resourceId = _dev->pcmGetResourceId();
 
 	uint8 fms = _dev->fmGetStatus();
 	if (_fmStatus.sync == (fms & 0x0F))
@@ -98,8 +100,9 @@ void SoundEngine::update() {
 	_fmStatus.sync = fms & 0x0F;
 }
 
-void SoundEngine::setUnkCond(bool enable) {
-	_dev->setUnkCond(enable);
+void SoundEngine::reduceVolume2(bool enable) {
+	_dev->reduceVolume2(enable);
+	_fmStatus.reduceVol2 = enable;
 }
 
 void SoundEngine::setMusicVolume(int vol) {
@@ -110,6 +113,23 @@ void SoundEngine::setSoundEffectVolume(int vol) {
 	_dev->setSoundEffectVolume(vol);
 }
 
+void SoundEngine::loadState(Common::SeekableReadStream *in) {
+	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
+		error("%s(): Save file invalid or corrupt", __FUNCTION__);
+	_pcmStatus.resourceId = _pcmStatus.resourceId2 = in->readSint16BE();
+	_pcmStatus.blocked = in->readByte();
+	_fmStatus.music = in->readByte();
+	_fmStatus.reduceVol2 = in->readByte();
+}
+
+void SoundEngine::saveState(Common::SeekableWriteStream *out) {
+	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
+	out->writeSint16BE(_pcmStatus.resourceId);
+	out->writeByte(_pcmStatus.blocked);
+	out->writeByte(_fmStatus.music);
+	out->writeByte(_fmStatus.reduceVol2);
+}
+
 SoundDevice *SoundDevice::create(FIO *fio, Common::Platform platform, int soundOptions) {
 	MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(soundOptions);
 	MusicType musicType = MidiDriver::getMusicType(dev);
diff --git a/engines/snatcher/sound.h b/engines/snatcher/sound.h
index c168ed893bd..568b12b11f5 100644
--- a/engines/snatcher/sound.h
+++ b/engines/snatcher/sound.h
@@ -26,7 +26,12 @@
 
 namespace Audio {
 class Mixer;
-}
+} // namespace Audio
+
+namespace Common {
+class SeekableReadStream;
+class SeekableWriteStream;
+} // namespace Common
 
 namespace Snatcher {
 
@@ -46,11 +51,12 @@ public:
 	uint32 cdaGetTime() const;
 
 	struct FMStatus {
-		FMStatus() : music(0), sfx(0), sync(0), blocked(0) {}
+		FMStatus() : music(0), sfx(0), sync(0), blocked(0), reduceVol2(0) {}
 		uint8 music;
 		uint8 sfx;
 		uint8 sync;
 		uint8 blocked;
+		uint8 reduceVol2;
 	};
 
 	void fmSendCommand(int cmd, int restoreVolume, int trackType = 0);
@@ -58,9 +64,11 @@ public:
 	void fmBlock(int block) { _fmStatus.blocked = block; }
 
 	struct PCMStatus {
-		PCMStatus() : statusBits(0), blocked(0) {}
+		PCMStatus() : statusBits(0), blocked(0), resourceId(-1), resourceId2(-1) {}
 		uint8 statusBits;
 		uint8 blocked;
+		int16 resourceId;
+		int16 resourceId2;
 	};
 
 	void pcmSendCommand(int cmd, int arg);
@@ -71,11 +79,14 @@ public:
 	void pause(bool toggle);
 	void update();
 
-	void setUnkCond(bool enable);
+	void reduceVolume2(bool enable);
 
 	void setMusicVolume(int vol);
 	void setSoundEffectVolume(int vol);
 
+	void loadState(Common::SeekableReadStream *in);
+	void saveState(Common::SeekableWriteStream *out);
+
 private:
 	FMStatus _fmStatus;
 	PCMStatus _pcmStatus;
diff --git a/engines/snatcher/sound_device.h b/engines/snatcher/sound_device.h
index 107015e95d9..d930197ee13 100644
--- a/engines/snatcher/sound_device.h
+++ b/engines/snatcher/sound_device.h
@@ -50,11 +50,12 @@ public:
 	virtual void pcmSendCommand(int cmd, int arg) = 0;
 	virtual void pcmInitSound(int sndId) = 0;
 	virtual uint8 pcmGetStatus() const = 0;
+	virtual int16 pcmGetResourceId() const = 0;
 
 	virtual void pause(bool toggle) = 0;
 	virtual void update() = 0;
 
-	virtual void setUnkCond(bool enable) = 0;
+	virtual void reduceVolume2(bool enable) = 0;
 
 	virtual void setMusicVolume(int vol) = 0;
 	virtual void setSoundEffectVolume(int vol) = 0;
diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
index 41215746b8f..d548ef5b6ab 100644
--- a/engines/snatcher/sound_device_scd.cpp
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -92,11 +92,12 @@ public:
 	void pcmSendCommand(int cmd, int arg) override;
 	void pcmInitSound(int sndId) override;
 	uint8 pcmGetStatus() const override;
+	int16 pcmGetResourceId() const override;
 
 	void pause(bool toggle) override;
 	void update() override;
 
-	void setUnkCond(bool enable) override;
+	void reduceVolume2(bool enable) override;
 
 	void setMusicVolume(int vol) override;
 	void setSoundEffectVolume(int vol) override;
@@ -192,7 +193,7 @@ private:
 	uint8 _faderFlags;
 	uint8 _faderTimer1;
 	uint8 _faderTimer2;
-	bool _unkVolCond;
+	bool _reduceVolume2;
 	uint8 _pcmMsgFromDriver[4];
 	uint8 *_temp;
 
@@ -1740,7 +1741,7 @@ const uint8 *KonamiMCDAudioDriver::getTrack(uint32 index) const {
 }
 
 SegaSoundDevice::SegaSoundDevice(FIO *fio) : _fio(fio), SoundDevice(), _sai(nullptr), _lastTrack(-1), _pauseStartTime(0), _pcmResourceInfo(nullptr), _pcmResidentDataInfo(nullptr), _pcmInstrumentInfo(nullptr),
-	_pcmSounds(nullptr), _pcmDisableStereo(false), _temp(nullptr), _pcmResourceNumber(0), _pcmState(0), _pcmMode(0), _faderFlags(0), _faderTimer1(0), _faderTimer2(0), _unkVolCond(false), 
+	_pcmSounds(nullptr), _pcmDisableStereo(false), _temp(nullptr), _pcmResourceNumber(-1), _pcmState(0), _pcmMode(0), _faderFlags(0), _faderTimer1(0), _faderTimer2(0), _reduceVolume2(false), 
 		_fmVolume1(0xFF), _fmLastVolume1(0), _fmVolume2(0xFF), _fmLastVolume2(0), _fmCmdQueue(nullptr), _fmCmdQueueWPos(0), _fmCmdQueueRPos(0), _fmDriver(nullptr), _driverMsg()	{
 	_temp = new uint8[0x8000]();
 	assert(_temp);
@@ -1845,6 +1846,9 @@ void SegaSoundDevice::pcmSendCommand(int cmd, int arg) {
 
 void SegaSoundDevice::pcmInitSound(int sndId) {
 	_pcmResourceNumber = sndId;
+	if (sndId < 0)
+		return;
+
 	_pcmMode = _pcmResourceInfo[_pcmResourceNumber].mode;
 	if (_pcmMode == 1) {
 		_pcmState |= 4;
@@ -1861,6 +1865,10 @@ uint8 SegaSoundDevice::pcmGetStatus() const {
 	return _pcmState;
 }
 
+int16 SegaSoundDevice::pcmGetResourceId() const {
+	return _pcmResourceNumber;
+}
+
 void SegaSoundDevice::pause(bool toggle) {	
 	if (toggle) {
 		if (_pauseStartTime == 0) {
@@ -1892,8 +1900,8 @@ void SegaSoundDevice::update() {
 	fmHandleCmdQueue();
 }
 
-void SegaSoundDevice::setUnkCond(bool enable) {
-	_unkVolCond = enable;
+void SegaSoundDevice::reduceVolume2(bool enable) {
+	_reduceVolume2 = enable;
 }
 
 void SegaSoundDevice::setMusicVolume(int vol) {
@@ -1937,7 +1945,7 @@ static const uint8 volTable[] = {
 };
 
 void SegaSoundDevice::fmUpdateVolumeFader() {
-	_fmVolume2 = _unkVolCond ? 112 : 255;
+	_fmVolume2 = _reduceVolume2 ? 112 : 255;
 	if (_faderFlags & 4) {
 		_faderFlags &= ~3;
 		if (++_faderTimer1 != 1)
@@ -2142,6 +2150,7 @@ void SegaSoundDevice::pcmHandleDriverMessage() {
 void SegaSoundDevice::pcmDelayedStart() {
 	if (_pcmState & 1) {
 		PCMSound &s = _pcmSounds[0];
+		assert(_pcmResourceNumber >= 0);
 		PCMResourceInfo &p = _pcmResourceInfo[_pcmResourceNumber];
 		s.addr = 0x65000;
 		s.prio = p.prio;
@@ -2155,6 +2164,7 @@ void SegaSoundDevice::pcmDelayedStart() {
 		pcmStartSoundInternal(0, 3, s);
 
 		_pcmState = (_pcmState & ~1) | 2;
+		_pcmResourceNumber = -1;
 	}
 	_pcmState &= ~4;
 }
@@ -2171,6 +2181,7 @@ SegaSoundDevice::SmpStrPtr SegaSoundDevice::createSamplesStream(uint32 addr) {
 	if (!str)
 		error("%s(): Error reading file", __FUNCTION__);
 
+	assert(addr < 0x65000 || _pcmResourceNumber >= 0);
 	uint32 start = addr < 0x65000 ? addr - 0x55000 : _pcmResourceInfo[_pcmResourceNumber].sector * 0x800 + addr - 0x65000;
 	uint32 max = addr < 0x65000 ? 0x10000 : _pcmResourceInfo[_pcmResourceNumber].numSectors * 0x800;
 
@@ -2246,7 +2257,7 @@ void SegaSoundDevice::pcmStartInstrument(uint8 unit, uint8 sndId, uint8 vol) {
 
 uint8 SegaSoundDevice::calcVolume(uint8 unit, PCMSound &s) const {
 	uint8 vol = s.volEff;
-	if (_unkVolCond)
+	if (_reduceVolume2)
 		vol = (vol * 112) >> 8;
 	if (unit >= 2 && _fmVolume1 != 0xFF)
 		vol = (vol * _fmVolume1) >> 8;
diff --git a/engines/snatcher/state.h b/engines/snatcher/state.h
new file mode 100644
index 00000000000..e509fcfdb7a
--- /dev/null
+++ b/engines/snatcher/state.h
@@ -0,0 +1,90 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_STATE_H
+#define SNATCHER_STATE_H
+
+#include "common/rect.h"
+#include "common/scummsys.h"
+
+namespace Snatcher {
+
+class SnatcherEngine;
+class SceneModule;
+class FIO;
+
+struct Config {
+	Config() : volumeMusic(0), volumeSFX(0), volumeSpeech(0), lightGunAvailable(1), useLightGun(0), controllerSetup(0), disableStereo(0), hasRAMCart(1), hasFreeBuram(1), lightGunBias(0, -16) {}
+	int16 volumeMusic;
+	int16 volumeSFX;
+	int16 volumeSpeech;
+	int16 lightGunAvailable;
+	int16 useLightGun;
+	int16 controllerSetup;
+	int16 disableStereo;
+	int16 hasRAMCart;
+	int16 hasFreeBuram;
+	Common::Point lightGunBias;
+};
+
+struct Script {
+	Script(uint32 textResourceOffset, int16 &chaptr) : sentenceDone(0), sentencePos(0), data(nullptr), dataSize(0), curPos(0), newPos(0xFFFF), curFileNo(0), curGfxScript(-1), chapter(chaptr), textResOffset(textResourceOffset) {}
+	~Script() {
+		delete[] data;
+	}
+	const uint8 *getTextResource() const {
+		return data + textResOffset;
+	}
+	uint8 sentenceDone;
+	uint8 sentencePos;
+	uint8 curFileNo;
+	int16 curGfxScript;
+	const uint8 *data;
+	uint32 dataSize;
+	uint16 curPos;
+	uint16 newPos;
+	int16 &chapter;
+	const uint32 textResOffset;
+};
+
+struct GameState {
+	GameState() : frameNo(0), frameState(0), finish(0), modProcessTop(0), modProcessSub(0), counter(0), modIndex(0), menuSelect(0), prologue(0), chapter(0), chapterSub(0), saveSlotUsage(0), saveCount(0), conf(Config()), script(0x3800, chapter), totalPlayTime(0) {}
+	int16 frameNo;
+	int16 frameState;
+	int16 finish;
+	int16 modProcessTop;
+	int16 modProcessSub;
+	int16 counter;
+	int16 modIndex;
+	int16 menuSelect;
+	int16 prologue;
+	int16 chapter;
+	int16 chapterSub;
+	int16 saveSlotUsage;
+	int16 saveCount;
+	Config conf;
+	Script script;
+	uint32 totalPlayTime;
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_STATE_H
diff --git a/engines/snatcher/transition_scd.cpp b/engines/snatcher/transition_scd.cpp
index 191f3b5f096..be3c35d052b 100644
--- a/engines/snatcher/transition_scd.cpp
+++ b/engines/snatcher/transition_scd.cpp
@@ -22,6 +22,7 @@
 
 #include "snatcher/graphics.h"
 #include "snatcher/transition.h"
+#include "common/endian.h"
 #include "graphics/segagfx.h"
 
 namespace Snatcher {
@@ -127,7 +128,7 @@ private:
 
 	uint8 _nextStep;
 	uint8 _lastStep;
-	uint8 _trsCmd_0xff_0xfd_0xfc_or0to6_last;
+	uint8 _lineScrollOp;
 	uint8 _nextStepExt;
 	uint8 _lastStepExt;
 	int16 _trsFlagttt;
@@ -138,9 +139,14 @@ private:
 	int16 _transitionStep;
 	int16 _tmpScrollOffset;
 	int16 _subPara;
-	uint32 _trs__DA;
+	int16 _lineScrollOpState;
+	int16 _lineScrollTimer1;
+	int16 _lineScrollTimer2;
+	int16 _lineScrollTimer3;
+	int16 _lineScrollTimer4;
+	int16 _lineScrollTimer5;
 	uint16 _trs__DB;
-	bool useEngineScrollOffsets;
+	bool _useEngineScrollOffsets;
 
 private:
 	typedef Common::Functor1Mem<int, void, TransitionManager_SCD> TrsFunc;
@@ -151,9 +157,9 @@ private:
 
 	void trsUpdt_dummy(int arg);
 	void trsUpdt_engineScroll(int arg);
-	void trsUpdt_03(int arg);
+	void trsUpdt_skyParallaxScroll(int arg);
 	void trsUpdt_04(int arg);
-	void trsUpdt_05(int arg);
+	void trsUpdt_videoPhoneInterference(int arg);
 	void trsUpdt_06(int arg);
 	void trsUpdt_screenShutter(int arg);
 	void trsUpdt_revealShutter(int arg);
@@ -175,6 +181,9 @@ private:
 	void trsUpdt_28(int arg);
 	void trsUpdt_29(int arg);
 
+	void lineScrollInit();
+	void lineScrollTableFill(uint16 start, uint16 len, uint16 val);
+	void lineScrollTableDecr(uint16 start, uint16 len);
 	void textScreenTrsUpdate(int type, int hIntHandlerNo, int state);
 
 	typedef Common::Functor1Mem<Graphics::SegaRenderer*, void, TransitionManager_SCD> HINTFunc;
@@ -198,8 +207,8 @@ private:
 };
 
 TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0), _hint_proc(0), _transitionStep(0),
-	_trsCommandExt(0), _trsCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _trs__DA(0), _trs__DB(0), _trsCmd_0xff_0xfd_0xfc_or0to6_last(0), _trsFlagttt(0),
-		_transitionType(0), _transitionState(0), _transitionState2(0), _tmpScrollOffset(0), _subPara(0), useEngineScrollOffsets(false), _hINTHandler(nullptr) {
+	_trsCommandExt(0), _trsCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _lineScrollOpState(0), _lineScrollTimer1(0), _lineScrollTimer2(0), _lineScrollTimer3(0), _lineScrollTimer4(0),
+		_lineScrollTimer5(0), _trs__DB(0), _lineScrollOp(0), _trsFlagttt(0), _transitionType(0), _transitionState(0), _transitionState2(0), _tmpScrollOffset(0), _subPara(0), _useEngineScrollOffsets(false), _hINTHandler(nullptr) {
 	_internalState = new ScrollInternalState[4];
 	assert(_internalState);
 	_internalState[kVertA].setFactor(-1);
@@ -283,26 +292,29 @@ bool TransitionManager_SCD::nextFrame() {
 	processTransition();
 
 	bool changed = false;
-	bool reset = _nextStep == 0xFF || _nextStep == 0xFC;
+	bool reset = (_nextStep == 0xFF || _nextStep == 0xFC);
 
-	if (_scrollType != 0 && !reset) {
+	if (_scrollType && !reset) {
 		for (int i = 0; i < 4; ++i) {
 			if (_internalState[i].recalc(_scrollType & 0x10))
 				changed = true;
-			_result.realOffsets[i] = _internalState[i].getRealOffset(!(changed || useEngineScrollOffsets));
+			_result.realOffsets[i] = _internalState[i].getRealOffset(!(changed || _useEngineScrollOffsets));
 			_result.unmodifiedOffsets[i] = _internalState[i].getUnmodifiedOffset();
 			_internalState[i].setNextOffset(_result.realOffsets[i]);
 		}
-		_result.hScrollTable = _hScrollTable;
-		_result.hScrollTableNumEntries = _hScrollTableLen;
-		_result.disableVScroll = (_trsCmd_0xff_0xfd_0xfc_or0to6_last != 0);
 		_scrollType &= ~0x10;
 	}
 
 	processCmdInternal();
 	_result.busy = _lastStepExt;
 
-	return changed || reset || _result.hInt.needUpdate;
+	if (_result.hScrollTable != _hScrollTable || _result.hScrollTableNumEntries != _hScrollTableLen) {
+		_result.hScrollTable = _hScrollTable;
+		_result.hScrollTableNumEntries = _hScrollTableLen;
+		_result.disableVScroll = (_lineScrollOp != 0);
+	}
+
+	return changed || reset || _lastStep || _lastStepExt || _result.hInt.needUpdate;
 }
 
 void TransitionManager_SCD::hINTCallback(void *segaRenderer) {
@@ -316,24 +328,24 @@ void TransitionManager_SCD::processCmdInternal() {
 			resetVars(_nextStep == 0xFF ? 0x0F : 0x0E);
 			return;
 		} else if (_nextStep == 0xFD) {
-			_trsCmd_0xff_0xfd_0xfc_or0to6_last |= 0x80;
+			_lineScrollOp |= 0x80;
 		} else {
 			_lastStep = _nextStep;
 			if (_nextStep < 3) {
 				resetVars(0x08);
 			} else {
-				_trs__DA = 0;
-				_trsCmd_0xff_0xfd_0xfc_or0to6_last = 0;
+				_lineScrollOpState = 0;
+				_lineScrollOp = 0;
 			}
 		}
 	}
 
 	bool b = false;
-	if (_trsCmd_0xff_0xfd_0xfc_or0to6_last != 0) {
-		if (_trsCmd_0xff_0xfd_0xfc_or0to6_last & 0x80)
+	if (_lineScrollOp != 0) {
+		if (_lineScrollOp & 0x80)
 			b = true;
 		else
-			doCommandIntern(_trsCmd_0xff_0xfd_0xfc_or0to6_last, 0);
+			doCommandIntern(_lineScrollOp, 0);
 	}
 
 	if (!b && _nextStep != 0)
@@ -400,8 +412,8 @@ void TransitionManager_SCD::resetVars(int groupFlags) {
 		_result.hInt.needUpdate = true;
 	}
 	if (groupFlags & 0x02) {
-		_trsCmd_0xff_0xfd_0xfc_or0to6_last = 0;
-		_trs__DA = 0;
+		_lineScrollOp = 0;
+		_lineScrollOpState = 0;
 		_trs__DB = 0;
 		_nextStepExt = 0;
 		_transitionType = _transitionState = _tmpScrollOffset = _subPara = 0;
@@ -416,7 +428,7 @@ void TransitionManager_SCD::resetVars(int groupFlags) {
 			_internalState[i].setNextOffset(0);
 	}
 	if (groupFlags & 0x08) {
-		useEngineScrollOffsets = false;
+		_useEngineScrollOffsets = false;
 		//_trsoa = 0;
 		//_trsob = 0;
 	}
@@ -443,9 +455,9 @@ void TransitionManager_SCD::makeFunctions() {
 		TF(dummy),
 		TF(engineScroll),
 		TF(engineScroll),
-		TF(03),
+		TF(skyParallaxScroll),
 		TF(04),
-		TF(05),
+		TF(videoPhoneInterference),
 		TF(06),
 		TF(screenShutter),
 		TF(revealShutter),
@@ -520,16 +532,104 @@ void TransitionManager_SCD::trsUpdt_dummy(int arg) {
 
 void TransitionManager_SCD::trsUpdt_engineScroll(int arg) {
 	_result.lineScrollMode = false;
-	useEngineScrollOffsets = true;
+	_useEngineScrollOffsets = true;
 }
 
-void TransitionManager_SCD::trsUpdt_03(int arg) {
+void TransitionManager_SCD::trsUpdt_skyParallaxScroll(int arg) {
+	if (!_lineScrollOp) {
+		lineScrollInit();
+		return;
+	}
+
+	++_lineScrollTimer1;
+	++_lineScrollTimer2;
+	++_lineScrollTimer3;
+	++_lineScrollTimer4;
+	++_lineScrollTimer5;
+
+	uint16 f = _gfxState.frameCount();
+
+	if (!(f & 1)) {	
+		lineScrollTableDecr(0, 8);
+		_hScrollTableLen = 8;
+	}
+	if (!(f & 3)) {
+		lineScrollTableDecr(8, 9);
+		_hScrollTableLen = 17;
+	}
+	if (_lineScrollTimer1 == 6) {
+		_lineScrollTimer1 = 0;
+		lineScrollTableDecr(17, 12);
+		_hScrollTableLen = 29;
+	}
+	if (!(f & 7)) {
+		lineScrollTableDecr(29, 10);
+		_hScrollTableLen = 39;
+	}
+	if (_lineScrollTimer2 == 10) {
+		_lineScrollTimer2 = 0;
+		lineScrollTableDecr(39, 8);
+		_hScrollTableLen = 47;
+	}
+	if (_lineScrollTimer3 == 12) {
+		_lineScrollTimer3 = 0;
+		lineScrollTableDecr(47, 6);
+		_hScrollTableLen += 53;
+	}
+	if (_lineScrollTimer4 == 14) {
+		_lineScrollTimer4 = 0;
+		lineScrollTableDecr(53, 5);
+		_hScrollTableLen = 58;
+	}
+	if (!(f & 0x0F)) {
+		lineScrollTableDecr(58, 4);
+		_hScrollTableLen = 62;
+	}
+	if (_lineScrollTimer5 == 18) {
+		_lineScrollTimer5 = 0;
+		lineScrollTableDecr(62, 3);
+		_hScrollTableLen = 65;
+	}
 }
 
 void TransitionManager_SCD::trsUpdt_04(int arg) {
 }
 
-void TransitionManager_SCD::trsUpdt_05(int arg) {
+void TransitionManager_SCD::trsUpdt_videoPhoneInterference(int arg) {
+	switch (_lineScrollOpState) {
+		case 0:
+			++_lineScrollOpState;
+			lineScrollInit();
+			break;
+		case 1:
+			++_lineScrollOpState;
+			_hScrollTableLen = 112;
+			lineScrollTableFill(48, 3, 0x3F8);
+			lineScrollTableFill(51, 2, 0x3F4);
+			lineScrollTableFill(53, 3, 0x3F8);
+			lineScrollTableFill(72, 24, 2);
+			lineScrollTableFill(96, 16, 4);
+			break;
+		case 2:
+			if (++_lineScrollTimer1 < 8)
+				return;
+			_result.lineScrollMode = false;
+			++_lineScrollOpState;
+			break;
+		case 3:
+			if (++_lineScrollTimer2 < 13)
+				return;
+			_result.lineScrollMode = true;
+			++_lineScrollOpState;
+			break;
+		case 4:
+			if (++_lineScrollTimer3 == 7)
+				resetVars(0x0F);
+			break;
+		default:
+			error("%s(): Invalid state %d", __FUNCTION__, _lineScrollOpState);
+			break;
+	}
 }
 
 void TransitionManager_SCD::trsUpdt_06(int arg) {
@@ -758,6 +858,25 @@ void TransitionManager_SCD::trsUpdt_28(int arg) {
 void TransitionManager_SCD::trsUpdt_29(int arg) {
 }
 
+void TransitionManager_SCD::lineScrollInit() {
+	_lineScrollOp = _nextStep;
+	_nextStep = 0;
+	_hScrollTableLen = 128;
+	_useEngineScrollOffsets = false;
+	_lineScrollTimer1 = _lineScrollTimer3 = _lineScrollTimer5 = 0;
+	Common::fill<int16*>(_hScrollTable, &_hScrollTable[0x100], 0);
+	_result.lineScrollMode = true;
+}
+
+void TransitionManager_SCD::lineScrollTableFill(uint16 start, uint16 len, uint16 val) {
+	Common::fill<int16*>(&_hScrollTable[start], &_hScrollTable[start + len], val);
+}
+
+void TransitionManager_SCD::lineScrollTableDecr(uint16 start, uint16 len) {
+	for (int16 *d = &_hScrollTable[start]; d < &_hScrollTable[start + len]; ++d)
+		*d = (*d - 1) & 0x3FF;
+}
+
 void TransitionManager_SCD::textScreenTrsUpdate(int type, int hIntHandlerNo, int state) {
 	_transitionType = type;
 	setHINTHandler(hIntHandlerNo);
diff --git a/engines/snatcher/ui.cpp b/engines/snatcher/ui.cpp
index e1da47add04..17f8ae49258 100644
--- a/engines/snatcher/ui.cpp
+++ b/engines/snatcher/ui.cpp
@@ -24,6 +24,7 @@
 #include "snatcher/resource.h"
 #include "snatcher/script.h"
 #include "snatcher/ui.h"
+#include "common/stream.h"
 
 
 namespace Snatcher {
@@ -31,7 +32,7 @@ namespace Snatcher {
 UI::UI(GraphicsEngine *gfx, CmdQueue *que, ResourcePointer *scd) : _gfx(gfx), _que(que), _scd(scd), _sceneId(0), _textLineBreak(0), _dialogTextBuffer(nullptr), _textColor(0),
 	_scriptTextResource(nullptr),/*_makestrbt1(0),*/ _textY(0), _textY2(0), _sceneTextOffsCur(0), _textLineEnd(0), _sceneInfo(0), _sceneTextOffset(0), _transDW1(0), _transDW2(0),
 		_sceneTextOffsStart(0), _waitCursorFrame(0), _waitCursorAnimDelay(0), _progress(-1), _progress2(-1), _controllerCfg(0), _verbsTabLayout(0), _verbsInterpreterMode(0),
-			_una_6(0), _numVerbsFirstPage(0), _numVerbsLastPage(0), _una_3(0), _numVerbsMax(0), _una_rr_hi(0), _una_rr_lo(0), _verbsTabCurPage(0), _lastVerbDrawn(0), _verbTextBuffer(nullptr), _scriptVerbsArray(nullptr),
+			_lastVerbFirstPage(0), _numVerbsFirstPage(0), _numVerbsLastPage(0), _lastVerbLastPage(0), _numVerbsMax(0), _una_rr_hi(0), _una_rr_lo(0), _verbsTabCurPage(0), _lastVerbDrawn(0), _verbTextBuffer(nullptr), _scriptVerbsArray(nullptr),
 				_scriptSentenceArray(nullptr), _prevSelectedVerb(0), _selectedVerb(0), _lastHiliteVerb(0), _hiliteVerb(0), _transit_02(0), _textInputMarginLeft(0), _drawVerbsWd1(0),
 					_textInputColumnCur(0), _textInputColumnMax(0), _textInputCursorState(0), _textInputCursorBlinkCnt(0), _underscoreStr(nullptr), _textInputStr(nullptr), _vkeybPosTotal(0),
 						_vkeybColumnWidth(0), _verbsTabLayoutMap(nullptr), _verbsTabOffsX(0), _verbsTabOffsY(0), _hilitePosX(0), _hilitePosY(0), _vkeybVisible(false) {
@@ -170,16 +171,16 @@ bool UI::drawVerbs() {
 
 	if (_progress2 == 0) {
 		if (_gfx->getVerbAreaType()) {
-			_una_6 = 5;
+			_lastVerbFirstPage = 5;
 			_numVerbsFirstPage = 4;
 			_numVerbsLastPage = 3;
-			_una_3 = 4;
+			_lastVerbLastPage = 4;
 			_numVerbsMax = 6;
 		} else {
-			_una_6 = 6;
+			_lastVerbFirstPage = 6;
 			_numVerbsFirstPage = 5;
 			_numVerbsLastPage = 2;
-			_una_3 = 3;
+			_lastVerbLastPage = 3;
 			_numVerbsMax = 7;
 		}
 
@@ -218,12 +219,12 @@ bool UI::drawVerbs() {
 			bool sp7 = (_scriptVerbsArray->pos() == 7 && _gfx->getVerbAreaType() != 0);
 			if (sp7) {
 				_numVerbsLastPage = 2;
-				_una_3 = 3;
+				_lastVerbLastPage = 3;
 			}
 			if (_scriptVerbsArray->pos() == 8 || sp7) {
 				_verbsTabCurPage = 1;
 				if (_scriptSentenceArray->pos() == 0) {
-					if (_una_6 <= _prevSelectedVerb) {
+					if (_lastVerbFirstPage <= _prevSelectedVerb) {
 						_verbsTabCurPage = 2;
 						_prevSelectedVerb -= _numVerbsFirstPage;
 					}
@@ -484,6 +485,20 @@ void UI::setInterpreterMode(uint16 mode) {
 	_verbsInterpreterMode = mode;
 }
 
+void UI::loadState(Common::SeekableReadStream *in) {
+	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
+		error("%s(): Save file invalid or corrupt", __FUNCTION__);
+	_verbsTabLayout = in->readUint16BE();
+	_verbsInterpreterMode = in->readUint16BE();
+	_progress = _progress2 = -1;
+}
+
+void UI::saveState(Common::SeekableWriteStream *out) {
+	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
+	out->writeUint16BE(_verbsTabLayout);
+	out->writeUint16BE(_verbsInterpreterMode);
+}
+
 void UI::printDialogStringHead() {
 	static const uint8 strHead[] = { 0xFC, 0x00, 0xF9, 0x01, 0xFB, 0x10, 0x00, 0xFE };
 	const uint8 *s = _scd->makePtr(0x13552).getDataFromTable(_sceneId)();
@@ -595,7 +610,7 @@ bool UI::waitWithCursorAnim(uint16 inputFlags) {
 
 uint8 UI::drawVerb(uint8 id) {
 	uint8 cid = id;
-	if (_verbsTabCurPage == 1 && _una_6 == id) {
+	if (_verbsTabCurPage == 1 && _lastVerbFirstPage == id) {
 		_que->writeUInt16(0x05);
 		_que->writeUInt32(_gfx->getVerbAreaType() ? 0x10F26 : 0x10F10);
 		return 0x80;
@@ -760,7 +775,7 @@ void UI::verbsTabHandleInput(uint16 inputFlags) {
 						continue;
 					}
 				}
-				if ((_hiliteVerb == _lastVerbDrawn) || (_verbsTabCurPage == 2 && _hiliteVerb == _una_3)) {
+				if ((_hiliteVerb == _lastVerbDrawn) || (_verbsTabCurPage == 2 && _hiliteVerb == _lastVerbLastPage)) {
 					_hiliteVerb = 0;
 					if (_verbsTabCurPage) {
 						if (_verbsTabCurPage == 1)
@@ -900,7 +915,7 @@ void UI::verbTabSwapPage() {
 }
 
 void UI::verbSelect() {
-	if ((_verbsTabCurPage == 1 && _hiliteVerb == _una_6) || (_verbsTabCurPage == 2 && _hiliteVerb == 0))
+	if ((_verbsTabCurPage == 1 && _hiliteVerb == _lastVerbFirstPage) || (_verbsTabCurPage == 2 && _hiliteVerb == 0))
 		return;
 
 	_selectedVerb = _hiliteVerb + 1;
diff --git a/engines/snatcher/ui.h b/engines/snatcher/ui.h
index 6854d6ea515..55a52f218a9 100644
--- a/engines/snatcher/ui.h
+++ b/engines/snatcher/ui.h
@@ -26,6 +26,11 @@
 
 #include "common/scummsys.h"
 
+namespace Common {
+class SeekableReadStream;
+class SeekableWriteStream;
+} // namespace Common
+
 namespace Snatcher {
 
 class CmdQueue;
@@ -52,6 +57,9 @@ public:
 	void resetVerbSelection() { _prevSelectedVerb = 0; }
 	void setVerbsTabLayout(uint16 layout);
 	void setInterpreterMode(uint16 mode);
+
+	void loadState(Common::SeekableReadStream *in);
+	void saveState(Common::SeekableWriteStream *out);
 	
 private:
 	void printDialogStringHead();
@@ -97,10 +105,10 @@ private:
 	void virtKeybPrint();
 
 	uint16 _verbsInterpreterMode;
-	uint8 _una_6;
+	uint8 _lastVerbFirstPage;
 	uint8 _numVerbsFirstPage;
 	uint8 _numVerbsLastPage;
-	uint8 _una_3;
+	uint8 _lastVerbLastPage;
 	uint8 _prevSelectedVerb;
 	uint8 _numVerbsMax;
 	uint8 _una_rr_hi;


Commit: 5eb9c36bf735def90804c45268ad06be66b898b9
    https://github.com/scummvm/scummvm/commit/5eb9c36bf735def90804c45268ad06be66b898b9
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
GRAPHICS: (Sega renderer) - add option for aspect ratio correction

The backend option won't work for these resolutions and I can provide
the option in the renderer at low cpu cost. Also, this implementation
is  more flexible, allowing far more ratio and scaling parameters.

The code can be disabled via macro if it turns out not to be needed.

Changed paths:
    engines/snatcher/animator.h
    engines/snatcher/animator_scd.cpp
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    graphics/segagfx.cpp
    graphics/segagfx.h


diff --git a/engines/snatcher/animator.h b/engines/snatcher/animator.h
index aa52dcd363b..584b03314ea 100644
--- a/engines/snatcher/animator.h
+++ b/engines/snatcher/animator.h
@@ -55,6 +55,8 @@ public:
 
 	virtual uint16 screenWidth() const = 0;
 	virtual uint16 screenHeight() const = 0;
+	virtual uint16 realScreenWidth() const = 0;
+	virtual uint16 realScreenHeight() const = 0;
 
 	// The original game does not have mouse control on any platform. But
 	// the Sega CD version supports a lightgun. So we do have some fundamentals
diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index 4466f4c9db7..c4fb7db465d 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -42,7 +42,7 @@ struct AnimObject {
 	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), palette(0), f18(0), f1c(0),
 		timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0),
 			res(), scriptData(), spriteData(nullptr), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), scriptComFlags(0), freeze(0), blink(0), blinkCounter(0), blinkDuration(0) {}
-	
+
 	void clear() {
 		enable = blinkRate = drawFlags = 0;
 		posX = posY = 0;
@@ -132,6 +132,8 @@ public:
 
 	uint16 screenWidth() const override { return _screenWidth; }
 	uint16 screenHeight() const override { return _screenHeight; }
+	uint16 realScreenWidth() const override { return _realScreenWidth; }
+	uint16 realScreenHeight() const override { return _realScreenHeight; }
 
 	void createMouseCursor() override;
 
@@ -149,7 +151,8 @@ private:
 	bool reachedAudioTimeStamp(AnimObject &a) const;
 	void runAnimScript(AnimObject &a);
 
-	const uint16 _screenWidth, _screenHeight;
+	int _screenWidth, _screenHeight;
+	int _realScreenWidth, _realScreenHeight;
 
 	ResourcePointer _transferData;
 	uint8 *_tempBuffer;
@@ -263,8 +266,8 @@ private:
 
 Animator_SCD::Animator_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd) : Animator(state), _pal(pal), _trs(scr), _snd(snd), _mode(1),
 	_modeChange(0), _screenWidth(256), _screenHeight(224), _transferData(), _transferMode(0), _transferDelay(0), _clearFlags(0), _tempBuffer(nullptr), _spriteBuffer(nullptr), _sr(nullptr), _frameCount3Dwn(0),
-		_animations(nullptr), _drawCommands(nullptr), _hINTClientProc(Graphics::SegaRenderer::HINTHandler(this, &Graphics::SegaRenderer::HINTClient::hINTCallback)), _bootsDelay(0), _bootsSprTbl(nullptr),
-			_bootsTotalFrames(0), _bootsHScroll(0), _bootsVScroll(0), _bootsCol(0) {
+		_animations(nullptr), _drawCommands(nullptr), _hINTClientProc(Graphics::SegaRenderer::HINTHandler(this, &Graphics::SegaRenderer::HINTClient::hINTCallback)), _realScreenWidth(0), _realScreenHeight(0),
+			_bootsDelay(0), _bootsSprTbl(nullptr), _bootsTotalFrames(0), _bootsHScroll(0), _bootsVScroll(0), _bootsCol(0) {
 
 	makeAnimFunctions();
 
@@ -289,6 +292,8 @@ Animator_SCD::Animator_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::Gfx
 	}
 
 	_sr->setResolution(_screenWidth, _screenHeight);
+	_sr->toggleAspectRatioCorrection(true);
+	_sr->getRealResolution(_realScreenWidth, _realScreenHeight);
 	_sr->setupWindowPlane(0, 0, Graphics::SegaRenderer::kWinToLeft, Graphics::SegaRenderer::kWinToTop);
 	_sr->hINT_setHandler(&_hINTClientProc);
 
@@ -302,7 +307,7 @@ Animator_SCD::~Animator_SCD() {
 	delete[] _drawCommands;
 
 	if (_animations) {
-		for (int i = 0; i < 64; ++i) 
+		for (int i = 0; i < 64; ++i)
 			delete _animations[i];
 		delete[] _animations;
 	}
@@ -339,7 +344,6 @@ void Animator_SCD::initAnimations(ResourcePointer &res, uint16 len, bool dontUpd
 	ResourcePointer in = res;
 	while (in < next) {
 		assert(in[0] < 64);
-		int dg = in[0];
 		AnimObject *a = _animations[*in++];
 		//if (a->enable && dontUpdate)
 		//	return;
@@ -596,7 +600,7 @@ void Animator_SCD::setAnimParameter(uint8 animObjId, int param, int32 value) {
 void Animator_SCD::setAnimGroupParameter(uint8 animObjId, int groupOp, int32 value) {
 	assert(animObjId < 64);
 	AnimObject &a = *_animations[animObjId];
-	anim_setGroupParameter(a, groupOp, value);	
+	anim_setGroupParameter(a, groupOp, value);
 }
 
 int32 Animator_SCD::getAnimParameter(uint8 animObjId, int param) const {
@@ -682,7 +686,7 @@ void Animator_SCD::loadDataFromGfxScript() {
 
 	if (!_gfxState.getVar(8))
 		return;
-	
+
 	if (_transferDelay) {
 		--_transferDelay;
 		return;
@@ -896,7 +900,7 @@ void Animator_SCD::reconfigPlanes() {
 	in += 2;
 	_sr->memsetVRAM(*in, 0, 0x200);
 	_sr->memsetVRAM(0, 0, _mode ? 0xC000 : 0xB000);
-	
+
 	_modeChange = 0;
 }
 
@@ -1410,7 +1414,7 @@ void Animator_SCD::createMouseCursor() {
 	// This will obviously only work when the necessary animation has been loaded.
 	//anim_setControlFlags(16, GraphicsEngine::kAnimPause);
 	//anim_setFrame(16, 0);
-	
+
 	memset(_tempBuffer, 0, 0x10000);
 	updateAnimations();
 	drawAnimSprites();
@@ -1440,7 +1444,7 @@ int Animator_SCD::drawBootLogoFrame(uint8 *screen, int frameNo)  {
 
 	switch (frameNo) {
 	case 0:
-		_mode = 0; 
+		_mode = 0;
 		reconfigPlanes();
 		_bootsDelay = _bootsTotalFrames = 0;
 		_bootsHScroll = _bootsVScroll =  _bootsCol = 0;
@@ -1464,7 +1468,7 @@ int Animator_SCD::drawBootLogoFrame(uint8 *screen, int frameNo)  {
 		_sr->loadToVRAM(&tmp[74], 22, 0xEA94);
 		_sr->loadToVRAM(&tmp[86], 42, 0xEB8C);
 
-		++frameNo;		
+		++frameNo;
 		break;
 
 	case 1:
@@ -1638,7 +1642,7 @@ int Animator_SCD::drawBootLogoFrame(uint8 *screen, int frameNo)  {
 	_sr->setRenderColorTable(_pal->getSystemPalette(), 0, 64);
 	_sr->render(screen);
 
-	return frameNo;	
+	return frameNo;
 }
 
 
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 04f38adb37e..5260a5f833f 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -42,7 +42,7 @@ GraphicsEngine::GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system
 	_animator = Animator::create(pxf, platform, _state, _palette, _trs, snd);
 	_text = TextRenderer::create(platform, _animator);
 	assert(_animator);
-	_screen = new uint8[_animator->screenWidth() * _animator->screenHeight() * (pxf ? pxf->bytesPerPixel : 1)]();
+	_screen = new uint8[_animator->realScreenWidth() * _animator->realScreenHeight() * (pxf ? pxf->bytesPerPixel : 1)]();
 	assert(_screen);
 	_animSaveLoadData = new uint8[64]();
 	assert(_animSaveLoadData);
@@ -77,7 +77,7 @@ void GraphicsEngine::runScript(ResourcePointer res, int func) {
 		case 2:
 			_animator->initAnimations(sc, len, true);
 			break;
-		case 3: 
+		case 3:
 		case 4:
 			_animator->linkAnimations(sc, len);
 			break;
@@ -182,7 +182,7 @@ void GraphicsEngine::nextFrame() {
 	_palette->update();
 	_animator->updateScreen(_screen);
 
-	_system->copyRectToScreen(_screen, _animator->screenWidth() * _bpp, 0, 0, _animator->screenWidth(), _animator->screenHeight());
+	_system->copyRectToScreen(_screen, _animator->realScreenWidth() * _bpp, 0, 0, _animator->realScreenWidth(), _animator->realScreenHeight());
 	_system->updateScreen();
 
 	_state.nextFrame();
@@ -243,6 +243,14 @@ uint16 GraphicsEngine::screenHeight() const {
 	return _animator ? _animator->screenHeight() : 0;
 }
 
+uint16 GraphicsEngine::realScreenWidth() const {
+	return _animator ? _animator->realScreenWidth() : 0;
+}
+
+uint16 GraphicsEngine::realScreenHeight() const {
+	return _animator ? _animator->realScreenHeight() : 0;
+}
+
 bool GraphicsEngine::busy(int type) const {
 	if (type == 0)
 		return ((_state.getVar(0) != 0) || (_state.getVar(8) != 0));
@@ -303,7 +311,7 @@ void GraphicsEngine::postLoadProcess() {
 		setAnimParameter(i, kAnimParaF24, cf | (v & 0x0C));
 		if (v & 0x10)
 			setAnimParameter(i, kAnimParaScriptComFlags, getAnimParameter(i, kAnimParaScriptComFlags) | 1);
-		else 
+		else
 			setAnimParameter(i, kAnimParaScriptComFlags, getAnimParameter(i, kAnimParaScriptComFlags) & ~1);
 		setAnimParameter(i, kAnimParaAllowFrameDrop, (v & 0x20) ? 1 : 0);
 	}
@@ -315,7 +323,7 @@ void GraphicsEngine::createMouseCursor(bool show) {
 
 int GraphicsEngine::displayBootLogoFrame(int frameNo) {
 	int res = _animator->drawBootLogoFrame(_screen, frameNo);
-	_system->copyRectToScreen(_screen, _animator->screenWidth() * _bpp, 0, 0, _animator->screenWidth(), _animator->screenHeight());
+	_system->copyRectToScreen(_screen, _animator->realScreenWidth() * _bpp, 0, 0, _animator->realScreenWidth(), _animator->realScreenHeight());
 	_system->updateScreen();
 	return res;
 }
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 0def0d7b21f..1d6951d28c9 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -126,7 +126,7 @@ public:
 	};
 
 	enum AnimFlags : int {
-		kAnimNone 				=	0,
+		kAnimNone				=	0,
 		kAnimPause				=	1 << 0,
 		kAnimHide				=	1 << 1,
 		kAnimAudioSync			=	1 << 2
@@ -141,6 +141,8 @@ public:
 
 	uint16 screenWidth() const;
 	uint16 screenHeight() const;
+	uint16 realScreenWidth() const;
+	uint16 realScreenHeight() const;
 
 	bool busy(int type) const;
 	uint16 frameCount() const;
@@ -204,7 +206,7 @@ public:
 		uint16 frameCount2() const {
 			return vm.frameCounter;
 		}
-	
+
 	private:
 		uint8 vars[12];
 		uint16 frameCounter;
diff --git a/graphics/segagfx.cpp b/graphics/segagfx.cpp
index 01c94597087..b5716768ed4 100644
--- a/graphics/segagfx.cpp
+++ b/graphics/segagfx.cpp
@@ -30,8 +30,12 @@ namespace Graphics {
 SegaRenderer::SegaRenderer(const PixelFormat *systemPixelFormat) : _pixelFormat(systemPixelFormat ? *systemPixelFormat : PixelFormat::createFormatCLUT8()),	_pitch(64), _hScrollMode(0),
 	_hScrollTable(0), _vScrollMode(0), _spriteTable(0), _numSpritesMax(0), _spriteMask(0), _spriteMaskPrio(0), _backgroundColor(0), _planes{SegaPlane(), SegaPlane(), SegaPlane()},
 	_vram(nullptr), _vsram(nullptr), _tempBufferSprites(nullptr), _tempBufferSpritesPrio(nullptr), _tempBufferPlanes(nullptr), _tempBufferPlanesPrio(nullptr), _renderColorTable(nullptr),
-	_rr(kUnspecified), _renderLineFragmentD(0), _renderLineFragmentM(0), _hINTEnable(false), _hINTCounter(0), _hINTCounterNext(0), _hINTHandler(nullptr), _destPitch(0), _displayEnabled(true) {
-
+	_rr(kUnspecified), _renderLineFragmentD(0), _renderLineFragmentM(0), _hINTEnable(false), _hINTCounter(0), _hINTCounterNext(0), _hINTHandler(nullptr), _destPitch(0), _displayEnabled(true),
+	_realW(0), _realH(0)
+#if(BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
+	, _arcIncX(0), _arcCntX(0), _arcIncY(0), _arcCntY(0), _xyAspectRatio(1.0), _scaleFactor(1.0)
+#endif
+{
 	_vram = new uint8[0x10000]();
 	assert(_vram);
 	_vsram = new uint16[40]();
@@ -68,6 +72,9 @@ SegaRenderer::SegaRenderer(const PixelFormat *systemPixelFormat) : _pixelFormat(
 	_renderLineFragmentM = funcM;
 
 	setResolution(320, 224);
+#if(BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
+	setAspectRatioCorrection();
+#endif
 }
 
 SegaRenderer::~SegaRenderer() {
@@ -113,6 +120,39 @@ void SegaRenderer::setResolution(int w, int h) {
 	assert(_spriteMask);
 	_spriteMaskPrio = new uint8[_screenW * _screenH]();
 	assert(_spriteMaskPrio);
+#if(!BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
+	_realW = _screenW;
+	_realH = _screenH;
+}
+#else
+	setAspectRatioCorrection(_xyAspectRatio, _scaleFactor);
+}
+
+void SegaRenderer::setAspectRatioCorrection(double xyAspectRatio, double scaleFactor) {
+	assert (xyAspectRatio > 0.0 || xyAspectRatio <= 2.0 || scaleFactor > 0.0 || scaleFactor <= 8.0);
+
+	_xyAspectRatio = xyAspectRatio;
+	_scaleFactor = scaleFactor;
+	_arcCntX = _arcIncY = 0;
+	_arcIncX = _arcIncY = trunc(scaleFactor * 0x10000);
+
+	double screenRatio = (double)_screenW / _screenH;
+
+	if (screenRatio > xyAspectRatio)
+		_arcIncY = trunc((scaleFactor * 0x10000) / xyAspectRatio);
+	else if (screenRatio < xyAspectRatio)
+		_arcIncX = trunc(xyAspectRatio * scaleFactor * 0x10000);
+
+	_realW = (_screenW * _arcIncX) >> 16;
+	_realH = (_screenH * _arcIncY) >> 16;
+
+	_destPitch = _realW * _pixelFormat.bytesPerPixel;
+}
+#endif
+
+void SegaRenderer::getRealResolution(int &w, int &h) {
+	w = _realW;
+	h = _realH;
 }
 
 void SegaRenderer::setPlaneTableLocation(int plane, uint16 addr) {
@@ -201,6 +241,32 @@ void SegaRenderer::clearPlanes() {
 	}
 }
 
+#if(BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
+#define MERGE_LINES \
+	(this->*ml)(d, rd1, rd2, _tempBufferPlanesPrio, rd3, w); \
+	rd1 += _screenW; \
+	rd2 += _screenW; \
+	rd3 += _screenW; \
+	d += _destPitch; \
+	_arcCntY += (_arcIncY - 0x10000); \
+	while (_arcCntY >= 0x10000) { \
+		_arcCntY -= 0x10000; \
+		memcpy(d, d - _destPitch, w2); \
+		d += _destPitch; \
+	} \
+	hINTUpdate(); \
+	ml = getLineHandler()
+#else
+#define MERGE_LINES \
+	(this->*ml)(d, rd1, rd2, _tempBufferPlanesPrio, rd3, w); \
+	rd1 += _screenW; \
+	rd2 += _screenW; \
+	rd3 += _screenW; \
+	d += _destPitch; \
+	hINTUpdate(); \
+	ml = getLineHandler()
+#endif
+
 void SegaRenderer::render(void *dst, int x, int y, int w, int h) {
 	if (x == -1)
 		x = 0;
@@ -213,6 +279,9 @@ void SegaRenderer::render(void *dst, int x, int y, int w, int h) {
 
 	_rr = kUnspecified;
 	int y2 = y + h;
+#if(BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
+	int w2 = ((w * _arcIncX) >> 16) * _pixelFormat.bytesPerPixel;
+#endif
 
 	assert(dst);
 	assert(x >= 0 && x + w <= _screenW);
@@ -238,7 +307,14 @@ void SegaRenderer::render(void *dst, int x, int y, int w, int h) {
 	rd1 += (y * _screenW + x);
 	rd2 += (y * _screenW + x);
 	rd3 += (y * _screenW + x);
-	uint8 *d = reinterpret_cast<uint8*>(dst) + (y * _destPitch + x * _pixelFormat.bytesPerPixel);
+
+#if(BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
+	uint8 *d = reinterpret_cast<uint8*>(dst) + (((y * _arcIncY) >> 16) * _destPitch + ((x * _arcIncX) >> 16) * _pixelFormat.bytesPerPixel);
+	_arcCntX = (x * _arcIncX) & 0xFFFF;
+	_arcCntY = (y * _arcIncY) & 0xFFFF;
+#else
+	uint8 *d = reinterpret_cast<uint8*>(dst) + y * _destPitch + x * _pixelFormat.bytesPerPixel;
+#endif
 
 	if (x == 0 && y == 0 && w == _screenW && h == _screenH) {
 		memset(rd1, _backgroundColor, _screenW * _screenH);
@@ -262,7 +338,7 @@ void SegaRenderer::render(void *dst, int x, int y, int w, int h) {
 			// With window plane, if available
 			for (int y1 = y; y1 < y2; ++y1) {
 				memset(_tempBufferPlanesPrio, 0, _screenW);
-				if (_displayEnabled) {					
+				if (_displayEnabled) {
 					renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneB, y1, x, w);
 					if (y1 >= wY1 && y1 < wY2) {
 						renderPlaneLine<true>(rd1, _tempBufferPlanesPrio, kWindowPlane, y1, x, w);
@@ -278,32 +354,18 @@ void SegaRenderer::render(void *dst, int x, int y, int w, int h) {
 					}
 				}
 
-				(this->*ml)(d, rd1, rd2, _tempBufferPlanesPrio, rd3, x, w);
-				rd1 += _screenW;
-				rd2 += _screenW;
-				rd3 += _screenW;
-				d += _destPitch;
-
-				hINTUpdate();
-				ml = getLineHandler();
+				MERGE_LINES;
 			}
 		} else {
 			// Without window plane
 			for (int y1 = y; y1 < y2; ++y1) {
 				memset(_tempBufferPlanesPrio, 0, _screenW);
-				if (_displayEnabled) {	
+				if (_displayEnabled) {
 					renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneB, y1, x, w);
 					renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneA, y1, x, w);
 				}
 
-				(this->*ml)(d, rd1, rd2, _tempBufferPlanesPrio, rd3, x, w);
-				rd1 += _screenW;
-				rd2 += _screenW;
-				rd3 += _screenW;
-				d += _destPitch;
-
-				hINTUpdate();
-				ml = getLineHandler();
+				MERGE_LINES;
 			}
 		}
 	} else if (_planes[kWindowPlane].nameTableSize != 0) {
@@ -322,14 +384,7 @@ void SegaRenderer::render(void *dst, int x, int y, int w, int h) {
 				}
 			}
 
-			(this->*ml)(d, rd1, rd2, _tempBufferPlanesPrio, rd3, x, w);
-			rd1 += _screenW;
-			rd2 += _screenW;
-			rd3 += _screenW;
-			d += _destPitch;
-
-			hINTUpdate();
-			ml = getLineHandler();
+			MERGE_LINES;
 		}
 	} else {
 		// Only plane B
@@ -338,17 +393,11 @@ void SegaRenderer::render(void *dst, int x, int y, int w, int h) {
 			if (_displayEnabled)
 				renderPlaneLine<false>(rd1, _tempBufferPlanesPrio, kPlaneB, y1, x, w);
 
-			(this->*ml)(d, rd1, rd2, _tempBufferPlanesPrio, rd3, x, w);
-			rd1 += _screenW;
-			rd2 += _screenW;
-			rd3 += _screenW;
-			d += _destPitch;
-
-			hINTUpdate();
-			ml = getLineHandler();
+			MERGE_LINES;
 		}
 	}
 }
+#undef MERGE_LINES
 
 void SegaRenderer::renderSprites(uint8 *dst, uint8 *dstPrio, int clipX, int clipY, int clipW, int clipH) {
 	if (clipX == -1)
@@ -420,7 +469,7 @@ void SegaRenderer::renderSprites(uint8 *dst, uint8 *dstPrio, int clipX, int clip
 
 			uint8 *dst2 = d;
 			uint8 *msk2 = msk;
-			
+
 			if (x > clipX - 8) {
 				SprTileProc tr = (x < 0 || x > _screenW - 8) ? &SegaRenderer::renderSpriteTileXClipped : &SegaRenderer::renderSpriteTileDef;
 				int y2 = y;
@@ -479,7 +528,7 @@ void SegaRenderer::setRenderColorTable(const uint8 *colors, uint16 first, uint16
 	if (_renderColorTable == nullptr)
 		return;
 
-	uint32 *dst = _renderColorTable + first; 
+	uint32 *dst = _renderColorTable + first;
 	while (num--) {
 		*dst++ = _pixelFormat.RGBToColor(colors[0], colors[1], colors[2]);
 		colors += 3;
@@ -577,7 +626,34 @@ template<bool isWindow> void SegaRenderer::renderPlaneLine(uint8 *planeBuffPos,
 	}
 }
 
-template<typename T, bool withSprites, bool withPrioSprites> void SegaRenderer::mergeLines(void *dst, uint8 *bottomLayer, const uint8 *spriteLayer, const uint8 *prioLayer, const uint8 *prioSpriteLayer, int clipX, int clipW) {
+#if(BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
+#define ML_SETPIXEL \
+if (adjustAspectRatio) { \
+	arcCnt += _arcIncX; \
+	if (sizeof(T) > 1) { \
+		while (arcCnt >= 0x10000) { \
+			arcCnt -= 0x10000; \
+			*d++ = _renderColorTable[*bottomLayer]; \
+		} \
+	} else { \
+		arcCnt -= 0x10000; \
+		while (arcCnt >= 0x10000) { \
+			arcCnt -= 0x10000; \
+			bottomLayer[1] = bottomLayer[0]; \
+			++bottomLayer; \
+		} \
+	} \
+} else { \
+	if (sizeof(T) > 1) \
+		*d++ = _renderColorTable[*bottomLayer]; \
+}
+#else
+#define ML_SETPIXEL \
+	if (sizeof(T) > 1) \
+		*d++ = _renderColorTable[*bottomLayer];
+#endif
+
+template<typename T, bool withSprites, bool withPrioSprites, bool adjustAspectRatio> void SegaRenderer::mergeLines(void *dst, uint8 *bottomLayer, const uint8 *spriteLayer, const uint8 *prioLayer, const uint8 *prioSpriteLayer, int clipW) {
 	T *d = reinterpret_cast<T*>(dst);
 
 	if (sizeof(T) == 1) {
@@ -586,6 +662,10 @@ template<typename T, bool withSprites, bool withPrioSprites> void SegaRenderer::
 		assert(bottomLayer);
 	}
 
+#if(BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
+	uint32 arcCnt = _arcCntX;
+#endif
+
 	if (withPrioSprites) {
 		if (withSprites) {
 			while (clipW--) {
@@ -596,9 +676,7 @@ template<typename T, bool withSprites, bool withPrioSprites> void SegaRenderer::
 				else if (*spriteLayer)
 					*bottomLayer = *spriteLayer;
 
-				if (sizeof(T) > 1)
-					*d++ = _renderColorTable[*bottomLayer];
-
+				ML_SETPIXEL
 				++bottomLayer;
 				++spriteLayer;
 				++prioLayer;
@@ -611,9 +689,7 @@ template<typename T, bool withSprites, bool withPrioSprites> void SegaRenderer::
 				else if (*prioLayer)
 					*bottomLayer = *prioLayer;
 
-				if (sizeof(T) > 1)
-					*d++ = _renderColorTable[*bottomLayer];
-
+				ML_SETPIXEL
 				++bottomLayer;
 				++prioLayer;
 				++prioSpriteLayer;
@@ -626,9 +702,7 @@ template<typename T, bool withSprites, bool withPrioSprites> void SegaRenderer::
 			else if (*spriteLayer)
 				*bottomLayer = *spriteLayer;
 
-			if (sizeof(T) > 1)
-				*d++ = _renderColorTable[*bottomLayer];
-
+			ML_SETPIXEL
 			++bottomLayer;
 			++spriteLayer;
 			++prioLayer;
@@ -638,34 +712,52 @@ template<typename T, bool withSprites, bool withPrioSprites> void SegaRenderer::
 			if (*prioLayer)
 				*bottomLayer = *prioLayer;
 
-			if (sizeof(T) > 1)
-				*d++ = _renderColorTable[*bottomLayer];
-
+			ML_SETPIXEL
 			++bottomLayer;
 			++prioLayer;
 		}
 	}
 }
+#undef ML_SETPIXEL
 
 SegaRenderer::MergeLinesProc SegaRenderer::getLineHandler() const {
 	static const MergeLinesProc mpc[] = {
 		nullptr,
-		&SegaRenderer::mergeLines<uint8, false, false>,
-		&SegaRenderer::mergeLines<uint16, false, false>,
+		&SegaRenderer::mergeLines<uint8, false, false, false>,
+		&SegaRenderer::mergeLines<uint16, false, false, false>,
+		nullptr,
+		&SegaRenderer::mergeLines<uint32, false, false, false>,
+		&SegaRenderer::mergeLines<uint8, true, false, false>,
+		&SegaRenderer::mergeLines<uint16, true, false, false>,
+		nullptr,
+		&SegaRenderer::mergeLines<uint32, true, false, false>,
+		&SegaRenderer::mergeLines<uint8, false, true, false>,
+		&SegaRenderer::mergeLines<uint16, false, true, false>,
+		nullptr,
+		&SegaRenderer::mergeLines<uint32, false, true, false>,
+		&SegaRenderer::mergeLines<uint8, true, true, false>,
+		&SegaRenderer::mergeLines<uint16, true, true, false>,
+		nullptr,
+		&SegaRenderer::mergeLines<uint32, true, true, false>,
+#if(BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
+		nullptr,
+		&SegaRenderer::mergeLines<uint8, false, false, true>,
+		&SegaRenderer::mergeLines<uint16, false, false, true>,
 		nullptr,
-		&SegaRenderer::mergeLines<uint32, false, false>,
-		&SegaRenderer::mergeLines<uint8, true, false>,
-		&SegaRenderer::mergeLines<uint16, true, false>,
+		&SegaRenderer::mergeLines<uint32, false, false, true>,
+		&SegaRenderer::mergeLines<uint8, true, false, true>,
+		&SegaRenderer::mergeLines<uint16, true, false, true>,
 		nullptr,
-		&SegaRenderer::mergeLines<uint32, true, false>,
-		&SegaRenderer::mergeLines<uint8, false, true>,
-		&SegaRenderer::mergeLines<uint16, false, true>,
+		&SegaRenderer::mergeLines<uint32, true, false, true>,
+		&SegaRenderer::mergeLines<uint8, false, true, true>,
+		&SegaRenderer::mergeLines<uint16, false, true, true>,
 		nullptr,
-		&SegaRenderer::mergeLines<uint32, false, true>,
-		&SegaRenderer::mergeLines<uint8, true, true>,
-		&SegaRenderer::mergeLines<uint16, true, true>,
+		&SegaRenderer::mergeLines<uint32, false, true, true>,
+		&SegaRenderer::mergeLines<uint8, true, true, true>,
+		&SegaRenderer::mergeLines<uint16, true, true, true>,
 		nullptr,
-		&SegaRenderer::mergeLines<uint32, true, true>
+		&SegaRenderer::mergeLines<uint32, true, true, true>
+#endif
 	};
 
 	uint index = _pixelFormat.bytesPerPixel;
@@ -674,6 +766,10 @@ SegaRenderer::MergeLinesProc SegaRenderer::getLineHandler() const {
 			index += 4;
 		if (_rr & kHasPrioSprites)
 			index += 8;
+#if(BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
+		if (_arcIncX != 0x10000)
+			index += 17;
+#endif
 	}
 
 	assert(index < ARRAYSIZE(mpc));
diff --git a/graphics/segagfx.h b/graphics/segagfx.h
index d2b82140c21..8cee612cbc3 100644
--- a/graphics/segagfx.h
+++ b/graphics/segagfx.h
@@ -25,6 +25,9 @@
 #include "common/func.h"
 #include "graphics/pixelformat.h"
 
+// It could probably be disabled if the backend does this in satisfactory way
+#define BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT				true
+
 namespace Graphics {
 
 struct PixelFormat;
@@ -78,6 +81,29 @@ public:
 	 */
 	void setResolution(int w, int h);
 
+#if(BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
+	/**
+	 * Enable or disable aspect ratio correction. This can be achieved rather cost-effectively with a scale factor of 1.0 (no scaling).
+	 * Unfortunately, some of the relevant resolutions here aren't really made for this. While it may be visually bearable to correct a 320x224
+	 * image to 320x240, this will not be the case for Snatcher's 256x224 resolution. The text font glyphs will be distorted in a very ugly
+	 * and obvious way.That's why we have the scaling. Set it to 2.0 and the corrected image will be okay. Keep in mind though, how this will
+	 * interact with and/or impact a scaler or shader setting. So it might make sense not to overdo it with the scale factor (apart from
+	 * the obvious, that the aspect ratio correction will not come anywhere near as cheap any more).
+	 * 
+	 * @param xyAspectRatio:		desired x/y ratio. E. g., for 4 : 3, type '4.0 / 3.0'. To turn it off, use 1.0.
+	 * @param scaleFactor:			scale factor for the aspect ratio correction, e. g. 1.0 for no scaling, 2.0 for double size
+	 */
+	void setAspectRatioCorrection(double xyAspectRatio = 1.0, double scaleFactor = 1.0);
+#endif
+
+	/**
+	 * Get the screen pixel width and height required to init the backend. These will be the same values as passed to setResolution() if the aspect
+	 * ratio correction is set to off, but it will differ when that option is enabled.
+	 * @param w:		pixel width,
+	 * @param h:		pixel height
+	 */
+	void getRealResolution(int &w, int &h);
+
 	/**
 	 * Set address for a plane's nametable.
 	 * @param plane:	plane id (from Plane enum)
@@ -241,6 +267,7 @@ public:
 
 protected:
 	uint16 _screenW, _screenH, _blocksW, _blocksH;
+	uint16 _realW, _realH;
 	uint16 _destPitch;
 	uint8 *_vram;
 	uint16 *_vsram;
@@ -249,9 +276,9 @@ protected:
 private:
 	void fillBackground(uint8 *dst, int x, int y, int w, int h);
 	template<bool isWindow> void renderPlaneLine(uint8 *planeBuffPos, uint8 *planePrioBuffPos, int srcPlane, int y, int clipX, int clipW);
-	template<typename T, bool withSprites, bool withPrioSprites> void mergeLines(void *dst, uint8 *bottomLayer, const uint8 *spriteLayer, const uint8 *prioLayer, const uint8 *prioSpriteLayer, int clipX, int clipW);
+	template<typename T, bool withSprites, bool withPrioSprites, bool adjustAspectRatio> void mergeLines(void *dst, uint8 *bottomLayer, const uint8 *spriteLayer, const uint8 *prioLayer, const uint8 *prioSpriteLayer, int clipW);
 
-	typedef void (SegaRenderer::*MergeLinesProc)(void*, uint8*, const uint8*, const uint8*, const uint8*, int, int);
+	typedef void (SegaRenderer::*MergeLinesProc)(void*, uint8*, const uint8*, const uint8*, const uint8*, int);
 	MergeLinesProc getLineHandler() const;
 	void hINTUpdate();
 
@@ -305,6 +332,12 @@ private:
 	uint8 _hINTCounterNext;
 	uint8 _hINTCounter;
 	const HINTHandler *_hINTHandler;
+
+#if(BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
+	// Aspect ratio correction
+	uint32 _arcIncX, _arcIncY, _arcCntX, _arcCntY;
+	double _xyAspectRatio, _scaleFactor;
+#endif
 };
 
 } // End of namespace Graphics


Commit: 7a2d646e19352b6214833bbaf0f4d170275c20cd
    https://github.com/scummvm/scummvm/commit/7a2d646e19352b6214833bbaf0f4d170275c20cd
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: implement action sequences

Changed paths:
  A engines/snatcher/action.cpp
  A engines/snatcher/action.h
    engines/snatcher/animator.h
    engines/snatcher/animator_scd.cpp
    engines/snatcher/detection.h
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/memory.cpp
    engines/snatcher/memory.h
    engines/snatcher/metaengine.cpp
    engines/snatcher/module.mk
    engines/snatcher/palette_scd.cpp
    engines/snatcher/resource.cpp
    engines/snatcher/resource.h
    engines/snatcher/saveload.cpp
    engines/snatcher/scene/scene_d0.cpp
    engines/snatcher/scene/scene_d1.cpp
    engines/snatcher/scene/scene_d2.cpp
    engines/snatcher/scene_imp.h
    engines/snatcher/script.cpp
    engines/snatcher/script.h
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/sound_device_scd.cpp
    engines/snatcher/transition_scd.cpp
    engines/snatcher/ui.cpp
    engines/snatcher/ui.h
    engines/snatcher/util.cpp


diff --git a/engines/snatcher/action.cpp b/engines/snatcher/action.cpp
new file mode 100644
index 00000000000..e875901bd86
--- /dev/null
+++ b/engines/snatcher/action.cpp
@@ -0,0 +1,852 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#include "snatcher/action.h"
+#include "snatcher/graphics.h"
+#include "snatcher/resource.h"
+#include "snatcher/snatcher.h"
+#include "snatcher/sound.h"
+#include "snatcher/util.h"
+#include "common/endian.h"
+
+
+namespace Snatcher {
+
+ActionSequenceHandler::ActionSequenceHandler(SnatcherEngine *vm, ResourcePointer *scd) : _vm(vm), _scd(scd), _stage(0), _counter1(0), _counter2(0), _progressMSB(0), _progressLSB(0),
+	_weaponState(0), _enemyAttackSpeed(0), _active(false), _handleShotPhase(0), _updateEnemiesPhase(0), _enemyAttackStatus(0), _targetField(0), _hscrollB(0), _vscrollB(0),
+		_enemyAppearanceCount(0), _civilianAppearanceCount(0), _shoot_78F2(0), _nextEnemyAppearanceTimer(0), _enemyAttackTimer(0), _shoot_78EE(0), _shoot_78EC(0), _result(),
+			_attackerId(0), _animNo(0), _shoot_7912(0), _projectileCoords(nullptr) {
+	_projectileCoords = new int16[18]();
+}
+
+ActionSequenceHandler::~ActionSequenceHandler() {
+	delete[] _projectileCoords;
+}
+
+#define animSet(x, y, z) \
+	_vm->gfx()->setAnimParameter(x, GraphicsEngine::kAnimPara##y, z)
+#define animGet(x, y) \
+	_vm->gfx()->getAnimParameter(x, GraphicsEngine::kAnimPara##y)
+
+bool ActionSequenceHandler::run(bool useLightGun) {
+	_useLightGun = useLightGun;
+	switch (_progressMSB) {
+	case 0:
+		switch (_progressLSB) {
+		case 0:
+			++_progressLSB;
+			_counter1 = 0;
+			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(0x11E7E));
+			break;
+		case 1:
+			if (++_counter1 < 2)
+				break;
+			_counter1 = 0;
+			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(0x11E6A));
+			if (_stage == 0 || _stage == 11) {
+				_progressLSB += 2;
+			} else {
+				_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x11EE6));
+				if (_stage != 5) {
+					_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x11ED8));
+					_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x11EF4));
+				}
+				++_progressLSB;
+			}
+			break;
+		case 2:
+			//hscrollB
+			//vscrollB
+			++_progressLSB;
+			break;
+		case 3:
+			animSet(48, Enable, 0);
+			animSet(48, ControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
+			animSet(48, F2c, 6);
+			resetVars();
+			animSet(21, Enable, 0);
+			animSet(21, ControlFlags, GraphicsEngine::kAnimNone);
+			animSet(21, F17, 0xFF);
+			animSet(24, Enable, 0);
+			animSet(24, ControlFlags, GraphicsEngine::kAnimNone);
+			animSet(22, Enable, 0);
+			animSet(22, ControlFlags, GraphicsEngine::kAnimNone);
+			animSet(23, Enable, 0);
+			animSet(23, ControlFlags, GraphicsEngine::kAnimNone);
+			_counter2 = 0;
+			_shoot_78F2 = 0;
+			initStage();
+
+			_nextEnemyAppearanceTimer = _scd->makePtr(0x11F60)[_stage];
+			_progressMSB = _scd->makePtr(0x11F50)[_stage];
+			_progressLSB = 0;
+
+			if (_enemyAttackSpeed == 0)
+				_enemyAttackSpeed = _scd->makePtr(0x11F70)[_stage];
+			break;
+
+		default:
+			break;
+		}
+		break;
+
+	case 1:
+		switch (_handleShotPhase) {
+		case 0:
+			animSet(56, ControlFlags, GraphicsEngine::kAnimPause);
+			animSet(57, ControlFlags, GraphicsEngine::kAnimPause);
+			animSet(56, Frame, 1);
+			animSet(57, Frame, 1);
+			_enemyAttackTimer = 128;
+			++_handleShotPhase;
+			break;
+		case 1:
+			if (_enemyAttackTimer == 0) {
+				++_handleShotPhase;
+			} else {
+				if (!(_enemyAttackTimer & 0x3F))
+					_vm->sound()->fmSendCommand(17, 0);
+				--_enemyAttackTimer;
+			}
+			break;
+		case 2:
+			animSet(56, Enable, 0);
+			animSet(57, Enable, 0);
+			_vm->sound()->fmSendCommand(18, 0);
+			_handleShotPhase = 0;
+			++_progressMSB;
+			break;
+		default:
+			break;
+		}
+		break;
+
+	case 2:
+		handleWeaponDrawAndTargetSelection();
+		handleShot();
+		if (_stage == 14) {
+			if (_shoot_78EE) {
+				animSet(22, PosX, 112);
+				animSet(22, PosY, 56);
+			}
+			if (++_counter2 >= 256) {
+				++_progressMSB;
+				_progressLSB = 0;
+			}
+		} else {
+			updateEnemies();
+			updateStage();
+			enemyAttack();
+			checkFinished();
+		}
+		break;
+
+	case 3:
+		if (_civilianAppearanceCount && _civilianAppearanceCount == _result.civiliansShot)
+			_result.allCiviliansShot = 1;
+		if (_stage != 0 && _stage != 11)
+			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(_result.hitsTaken < 6 ? 0x11E92 : 0x11E8C));
+		animSet(22, Enable, 0);
+		animSet(23, Enable, 0);
+		_vm->allowLightGunInput(false);
+		_counter1 = 0;
+		_vm->sound()->fmSendCommand(0xFF, 0);
+		++_progressMSB;
+		break;
+
+	case 4:
+		switch (_progressLSB) {
+		case 0:
+			if (_vm->sound()->pcmGetStatus().statusBits & 8)
+				break;
+			if ((_scd->makePtr(_useLightGun ? 0x11FC0 : 0x11FB0)[_stage] == 1) || (++_counter1 >= 64)) {
+					++_progressLSB;
+			} else if (_result.hitsTaken < 6) {
+				handleWeaponDrawAndTargetSelection();
+				handleShot();
+			}
+			break;
+		case 1:
+			++_progressLSB;
+			animSet(21, Enable, 0);
+			_vm->gfx()->reset(GraphicsEngine::kResetPalEvents);
+			break;
+		case 2:
+			++_progressLSB;
+			_counter1 = 0;
+			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(0x11E7E));
+			break;
+		case 3:
+			if (_stage != 0 && _stage != 11) {
+				if (++_counter1 < 2)
+					break;
+				_counter1 = 0;
+				_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x11F02));
+			}
+			++_progressLSB;
+			break;
+		case 4:
+			if (++_counter1 < 2)
+				break;
+			_counter1 = 0;
+			++_progressMSB;
+			_progressLSB = 0;
+			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(0x11E74));
+			break;
+		default:
+			break;
+		}
+		break;
+
+	case 5:
+		if (++_counter1 < 2)
+			break;
+		_weaponState = _enemyAttackSpeed = _progressMSB = 0;
+		_vm->allowLightGunInput(false);
+		_active = false;
+		break;
+
+	default:
+		break;
+	}
+
+	return _active;
+}
+
+bool ActionSequenceHandler::resetScore() {
+	if (_vm->gfx()->frameCount() & 1)
+		return true;
+
+	int16 a = 0;
+	int16 b = 0;
+	bool res = true;
+
+	switch(_progressMSB) {
+	case 0:
+		a = animGet(58, Frame);
+		if (a > 0) {
+			animSet(58, Frame, --a);
+			b = animGet(59, Frame);
+			if (b > a)
+				animSet(59, Frame, --b);
+		} else {
+			++_progressMSB;
+		}
+		break;
+	case 1:
+		animSet(58, ControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+		animSet(59, ControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+		animSet(58, Frame, 0);
+		animSet(59, Frame, 0);
+		++_progressMSB;
+		break;
+	default:
+		_progressMSB = 0;
+		res = false;
+		break;
+	}
+
+	return res;
+}
+
+void ActionSequenceHandler::setup(uint16 stage) {
+	_stage = stage;
+	_counter1 = 0;
+	_counter2 = 0;
+	_progressMSB = 0;
+	_progressLSB = 0;
+	_active = true;
+}
+
+void ActionSequenceHandler::resetVars() {
+	_weaponState = 0;
+	_handleShotPhase = 0;
+	_updateEnemiesPhase = _enemyAttackStatus = _targetField = 0;
+	_hscrollB = _vscrollB = 0;
+	_result = Result();
+	_enemyAppearanceCount = _civilianAppearanceCount = 0;
+	_shoot_7912 = _attackerId = 0;
+	_animNo = 0;
+}
+
+void ActionSequenceHandler::initStage() {
+	uint8 e = _scd->makePtr(0x11FD0)[_stage];
+	for (int i = 0; i < 9; ++i) {
+		animSet(32 + i, Frame, 2);
+		animSet(32 + i, FrameDelay, 0);
+		animSet(32 + i, F24, 0);
+		animSet(32 + i, Enable, e);
+	}
+	const int16 *in = reinterpret_cast<const int16*>(_scd->makePtr(0x11FEC)());
+	for (int i = 0; i < 18; ++i)
+		_projectileCoords[i] = FROM_BE_16(*in++);
+
+	switch (_stage) {
+	case 2:
+		_projectileCoords[1] = _projectileCoords[4] = 72;
+		_projectileCoords[10] = 8;
+		_projectileCoords[13] = 35;
+		break;
+	case 5:
+		_projectileCoords[1] = 93;
+		_projectileCoords[10] = 54;
+		break;
+	case 6:
+		_projectileCoords[6] = 38;
+		_projectileCoords[15] = 72;
+		break;
+	case 7:
+		_projectileCoords[5] = 150;
+		_projectileCoords[14] = 48;
+		break;
+	case 9:
+		_projectileCoords[1] = 96;
+		_projectileCoords[10] = 0;
+		break;
+	case 10:
+		_projectileCoords[9] = 0;
+		_projectileCoords[11] = 0;
+		_projectileCoords[15] = 88;
+		_projectileCoords[17] = 88;
+		break;
+	case 13:
+		_projectileCoords[9] = 24;
+		_projectileCoords[11] = 24;
+		_projectileCoords[12] = 40;
+		_projectileCoords[4] = 110;
+		_projectileCoords[13] = 39;
+		_projectileCoords[14] = 40;
+		break;
+	default:
+		break;
+	}
+}
+
+void ActionSequenceHandler::handleWeaponDrawAndTargetSelection() {
+	if (_weaponState < 2) {
+		animSet(23, PosX, 0);
+		animSet(23, PosY, 0);
+		if (_shoot_78F2 || _progressMSB >= 4)
+			return;
+
+		uint16 in = _vm->input().singleFrameControllerFlagsRemapped;
+
+		if ((!_useLightGun && (in & 0x40)) || (_useLightGun && (in & 0x200))) {
+			_vm->allowLightGunInput(false);
+			_weaponState ^= 1;
+			int16 enableAnim = 0;
+			if (_weaponState) {
+				_vm->sound()->pcmSendCommand(_scd->makePtr(0x11F20)[_stage], -1);
+				_result.weaponDrawn = enableAnim = 1;
+				if (_useLightGun) {
+					_vm->allowLightGunInput(true);
+					animSet(22, Enable, 0);
+				}
+			}
+			if (!_weaponState || !_useLightGun) {
+				animSet(22, Enable, enableAnim);
+				animSet(22, PosX, 112);
+				animSet(22, PosY, 56);
+				_targetField = 4;
+			}
+			animSet(23, Enable, enableAnim);
+		}
+
+		if (!_weaponState || _useLightGun || _shoot_78EE)
+			return;
+
+		in = _vm->input().sustainedControllerFlagsRemapped;
+		uint8 horz = 0;
+		uint8 vert = 0;
+		_targetField = 4;
+
+		if (in & 8) {
+			horz += 2;
+			_targetField += 1;
+		}
+		if (in & 4)
+			_targetField -= 1;
+		else
+			horz += 2;
+		if (in & 2) {
+			vert += 2;
+			_targetField += 3;
+		}
+		if (in & 1)
+			_targetField -= 3;
+		else
+			vert += 2;
+
+		animSet(22, PosX, (_scd->makePtr(0x11FE0) + horz).readSINT16());
+		animSet(22, PosY, (_scd->makePtr(0x11FE6) + vert).readSINT16());
+
+	} else {
+		if (_weaponState & 2) {
+			int16 r = Util::rngMakeNumber() & 0x0F;
+			animSet(23, PosX, r - 8);
+			animSet(22, PosY, animGet(22, PosY) + r - 8);
+			r = Util::rngMakeNumber() & 0x0F;
+			animSet(23, PosY, r - 8);
+			animSet(22, PosX, animGet(22, PosX) + r - 8);
+			_enemyAttackTimer = (_enemyAttackSpeed >> 2) + 24;
+		}
+		_weaponState -= 2;
+	}
+}
+
+void ActionSequenceHandler::handleShot() {
+	if (_useLightGun) {
+		int16 v = animGet(21, F2c);
+		if (v && ++v >= 2) {
+			v = 0;
+			_targetField = 0;
+			if (_vm->input().lightGunPos.x >= 160)
+				_targetField = 2;
+			else if (_vm->input().lightGunPos.x >= 96)
+				_targetField = 1;
+			if (_vm->input().lightGunPos.y >= 88)
+				_targetField += 6;
+			else if (_vm->input().lightGunPos.x >= 48)
+				_targetField += 3;
+		}
+		animSet(21, F2c, v);
+	}
+
+	uint16 in = _vm->input().singleFrameControllerFlagsRemapped;
+	int16 tf = (_stage == 14) ? 4 : _targetField;
+	int16 vl = 0;
+
+	for (bool loop = true; loop;) {
+		loop = false;
+		switch (_handleShotPhase) {
+		case 0:
+			if (animGet(21, Enable) || animGet(21, F17) != 0xFF || _progressMSB == 4 || _weaponState != 1)
+				break;
+			if ((!_useLightGun && ((in & 0x40) || !(in & 0x20))) || (_useLightGun && ((in & 0x200) || !(in & 0x100))))
+				break;
+			if (_stage == 14)
+				_shoot_78EE = 1;
+			++_result.shotsFired;
+			_handleShotPhase = 4;
+			if (_useLightGun)
+				animSet(21, F2c, 1);
+			break;
+
+		case 1:
+			animSet(21, Enable, 1);
+			animSet(21, FrameDelay, 2);
+			animSet(21, Frame, 0);
+			animSet(21, F17, tf);
+			animSet(21, PosX, (_scd->makePtr(0x11FEC) + (tf << 1)).readSINT16());
+			animSet(21, PosY, (_scd->makePtr(0x11FFE) + (tf << 1)).readSINT16());
+			_vm->sound()->pcmSendCommand(_scd->makePtr(0x11F30)[_stage], -1);
+			++_handleShotPhase;
+			break;
+
+		case 2:
+			if (animGet(21, Frame) >= 4) {
+				if (_stage == 14) {
+					_result.civiliansShot = 1;
+					_progressMSB = 3;
+					_progressLSB = 0;
+					_vm->sound()->pcmSendCommand(71, -1);
+				} else {
+					++_handleShotPhase;
+				}
+			}
+			break;
+
+		case 3:
+			tf = animGet(21, F17);
+			vl = animGet(32 + tf, F24) & 0x0F;
+			if (vl < 2 || vl > 4) {
+				if (_stage != 10) {
+					if (_useLightGun || _scd->makePtr(0x11FD0)[_stage] == 0) {
+						if (_enemyAttackSpeed < ((_stage == 0 || _stage == 11 || !_useLightGun) ? 32 : 48))
+								++_enemyAttackSpeed;
+					}
+
+					if (++_result.shotsMissed == 0)
+						_result.shotsMissed = 0xFF;
+				}
+
+			} else {
+				vl = animGet(32 + tf, F24) & 0xF0;
+				animSet(32 + tf, F24, vl | 6);
+				if ((vl >> 4) & 1) {
+					if ((_result.enemiesShot & 7) == 7 && _enemyAttackSpeed >= 2)
+						_enemyAttackSpeed -= 2;
+					++_result.enemiesShot;
+
+					if (_stage == 0 || _stage == 11) {
+						animSet(59, Enable, 1);
+						animSet(59, ControlFlags, GraphicsEngine::kAnimPause);
+						animSet(59, Frame, animGet(59, Frame) + 1);
+					}
+					_vm->sound()->pcmSendCommand(_scd->makePtr(0x11F10)[_stage], -1);
+
+				} else {
+					++_result.civiliansShot;
+					if (_enemyAttackSpeed >= 2)
+						_enemyAttackSpeed -= 2;
+					if (_scd->makePtr(0x11FD0)[_stage] == 0)
+						_vm->sound()->pcmSendCommand(14, -1);
+				}
+
+				if (_stage == 9) {
+					_vm->allowLightGunInput(false);
+					_shoot_78F2 = 1;
+				}
+			}
+			if (_stage == 10) {
+				if (_scd->makePtr(0x12CE2)[tf] & 2) {
+					_vm->sound()->pcmSendCommand(50, -1);
+					_vm->sound()->fmSendCommand(19, 0);
+					if (_result.hitsTaken < 6) {
+						vl = animGet(48, F2c) - 1;
+						animSet(48, F2c, vl);
+						(_scd->makePtr(0x12EA8) + 6).writeUINT16((_scd->makePtr(0x12EBC) + (vl << 1)).readUINT16());
+						_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x12EA8));
+						++_result.hitsTaken;
+					}
+
+				} else {
+					if (++_result.shotsMissed == 0)
+						_result.shotsMissed = 0xFF;
+				}
+			}
+
+			animSet(21, F17, 0xFF);
+			animSet(21, Enable, 0);
+			_handleShotPhase = 0;
+
+			break;
+
+		case 4:
+			++_handleShotPhase;
+			if (_enemyAttackSpeed < 16)
+				loop = true;
+			break;
+
+		case 5:
+			_handleShotPhase = 1;
+			if (_enemyAttackSpeed < 4)
+				loop = true;
+			break;
+
+		default:
+			break;
+
+		}
+	}
+}
+
+void ActionSequenceHandler::updateEnemies() {
+	_shoot_78EC = 0;
+	for (int i = 32; i < 41; ++i) {
+		int16 a = animGet(i, F24);
+		int16 b = 0;
+		if (a != 0xFF)
+			b = a & 0x0F;
+		if (b)
+			++_shoot_78EC;
+		switch (b) {
+		case 0:
+			b = _vm->gfx()->getAnimScriptByte(i, 0);
+			if (b == 2) {
+				animSet(i, ControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+			} else if (b < 128 && a != 0xFF) {
+				animSet(i, Enable, 1);
+			} else {
+				animSet(i, F24, 0xFF);
+				animSet(i, ControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+				animSet(i, Enable, 0);
+			}
+			break;
+
+		case 1:
+		case 2:
+		case 3:
+		case 4:
+		case 5:
+			if (b == 1) {
+				animSet(i, ControlFlags, GraphicsEngine::kAnimNone);
+			} else if (b < 5) {
+				a = animGet(i, F2c) - 1;
+				animSet(i, F2c, a);
+			}
+			if (b > 1 && b < 5 && a >= 0)
+				break;
+
+			a = _vm->gfx()->getAnimScriptByte(i, b);
+			if (a == animGet(i, Frame)) {
+				animSet(i, Frame, a + 2);
+				animSet(i, F24, animGet(i, F24) + 1);
+				a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
+				animSet(i, F2c, a + _enemyAttackSpeed);
+			}
+
+			if (b == 1)
+				break;
+
+			if ((animGet(i, F24) & 0x0F) == b) {
+				if (b < 5)
+					animSet(i, F2c, 0);
+				break;
+			}
+
+			if (b == 5) {
+				animSet(i, Frame, animGet(i, Frame) - 2);
+				if (_scd->makePtr(0x11FD0)[_stage] == 0 && animGet(i, F24) >= 48)
+					++_result.hitsTaken;
+				animSet(i, F24, 0);
+				break;
+			}
+
+			if (_scd->makePtr(0x11FD0)[_stage] == 0)
+				break;					
+
+			if (b == 2 && (_result.enemiesShot <= _scd->makePtr(_useLightGun ? 0x11F90 : 0x11F80)[_stage]))
+				break;
+
+			if (b == 4 && !(_scd->makePtr(0x11FD0)[_stage] & 0x80) && ((_result.enemiesShot <= _scd->makePtr(_useLightGun ? 0x11F90 : 0x11F80)[_stage]) || (_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] >= 6)))
+				break;
+
+			if (b == 3) {
+				if ((animGet(i, F24) & 0xF0) != 0x20 && !_enemyAttackStatus && !_enemyAttackTimer && _weaponState < 2) {
+					_attackerId = i - 32;
+					_enemyAttackStatus = 1;
+				}
+			} else {
+				animSet(i, F24, (animGet(i, F24) & 0xF0) + 7 - b);
+				animSet(i, Frame, _vm->gfx()->getAnimScriptByte(i, 6 - b) + 2);
+				a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
+				animSet(i, F2c, a + _enemyAttackSpeed);
+			}
+			break;
+
+		case 6:
+			animSet(i, F24, (animGet(i, F24) & 0xF0) + 7);
+			animSet(i, Frame, _vm->gfx()->getAnimScriptByte(i, 6));
+			a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
+			animSet(i, F2c, a + _enemyAttackSpeed);
+			break;
+
+		case 7:
+			a = _vm->gfx()->getAnimScriptByte(i, b);
+			if (a == animGet(i, Frame)) {
+				animSet(i, Frame, a + 2);
+				animSet(i, F24, animGet(i, F24) + 1);
+				a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
+				animSet(i, F2c, a + _enemyAttackSpeed);
+			}
+
+			if ((animGet(i, F24) & 0x0F) != 8)
+				break;
+
+			animSet(i, Frame, animGet(i, Frame) - 2);
+			animSet(i, F24, 0);
+
+			if (_stage != 0 && _stage != 11 && _stage != 7)
+				animSet(i, ControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+			break;
+
+		default:
+			break;
+		}
+	}
+}
+void ActionSequenceHandler::updateStage() {
+	if (_updateEnemiesPhase == 0) {
+		if (--_nextEnemyAppearanceTimer >= 0)
+			return;
+
+		uint8 v =_scd->makePtr(_useLightGun ? 0x11F90 : 0x11F80)[_stage];
+		if (v && _result.enemiesShot >= v)
+			return;
+
+		v = _scd->makePtr(0x11FA0)[_stage];
+		if (v && _enemyAppearanceCount == v)
+			return;
+
+		if (_shoot_78EC == _scd->makePtr(_useLightGun ? 0x11FC0 : 0x11FB0)[_stage])
+			return;
+
+		_nextEnemyAppearanceTimer = 16 + _enemyAttackSpeed + (_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1);
+		if (_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] >= 7)
+			_nextEnemyAppearanceTimer = 5;
+		_updateEnemiesPhase = 1;
+
+	} else if (_updateEnemiesPhase == 1) {
+		uint8 num = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F];
+		_animNo = num + 32;
+		int16 v = animGet(_animNo, F24);
+		if (v == 0xFF || ((v & 0x0F) != 0))
+			return;
+
+		_updateEnemiesPhase = 2;
+		++_enemyAppearanceCount;
+
+		switch (_stage) {
+		case 0:
+			v = _scd->makePtr(0x12C9A)[_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] & 3];
+			_vm->gfx()->animCopySpec(26 + v - 1, _animNo);
+			animSet(_animNo, Frame, 2);
+			break;
+		case 2:
+			v = _shoot_7912 | (num < 3 ? 1 : 0);
+			_vm->gfx()->animCopySpec(26 + v, _animNo);
+			_shoot_7912 = (v & 2) ^ 2;
+			v = (v << 1) | 1;
+			break;
+		case 4:
+			_vm->gfx()->animCopySpec(26, _animNo);
+			v = 1;
+			break;
+		case 10:
+			v = _scd->makePtr(0x12CE2)[num];
+			break;
+		case 11:
+			v = _scd->makePtr(0x12C9A)[_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F]];
+			_vm->gfx()->animCopySpec(26 + v + 1, _animNo);
+			animSet(_animNo, Frame, 2);
+			break;
+		case 14:
+			v = 2;
+			break;
+		default:
+			v = 1;
+			break;
+		}
+
+		v = v << 4;
+		animSet(_animNo, F24, v);
+
+		if (v == 0x20) {
+			++_civilianAppearanceCount;
+			--_enemyAppearanceCount;
+		}
+
+	} else {
+		uint8 v = _vm->gfx()->getAnimScriptByte(_animNo, 0);
+		animSet(_animNo, Frame, v != 2 ? v + 2 : 2);
+		animSet(_animNo, Enable, 1);
+		if (animGet(_animNo, F24) != 0x20 && (_stage == 0 || _stage == 11)) {
+			animSet(58, Enable, 1);
+			animSet(58, ControlFlags, GraphicsEngine::kAnimPause);
+			animSet(58, Frame, animGet(58, Frame) + 1);
+		}
+
+		animSet(_animNo, F24, (animGet(_animNo, F24) & 0xF0) | 1);
+		_updateEnemiesPhase = 0;
+
+		if (_stage == 0 || _stage == 11)
+			_vm->sound()->fmSendCommand(34, 0);
+	}
+}
+
+void ActionSequenceHandler::enemyAttack() {
+	if (!_scd->makePtr(0x11FD0)[_stage])
+		return;
+
+	if (_enemyAttackStatus == 0) {
+		animSet(24, Enable, 0);
+		animSet(24, Frame, 0);
+		if (_enemyAttackTimer)
+			--_enemyAttackTimer;
+	} else if (_enemyAttackStatus == 1) {
+		animSet(24, PosX, _projectileCoords[_attackerId]);
+		animSet(24, PosY, _projectileCoords[_attackerId + 9]);
+		animSet(24, Enable, 1);
+		animSet(24, Frame, 2);
+		_enemyAttackStatus = 2;
+		uint8 snd = _scd->makePtr(0x11F40)[_stage];
+		if (snd)
+			_vm->sound()->pcmSendCommand(snd, -1);
+	} else if (_enemyAttackStatus == 2) {
+		if (_vm->gfx()->getAnimScriptByte(24, 0) == animGet(24, Frame))
+			_enemyAttackStatus = 3;
+	} else if (_enemyAttackStatus == 3) {
+		_weaponState += 56;
+		_enemyAttackStatus = 0;
+		animSet(24, Enable, 0);
+		if (_stage == 4)
+			_vm->sound()->pcmSendCommand(52, -1);
+		else
+			_vm->sound()->fmSendCommand(19, 0);
+		if (_result.hitsTaken < 6) {
+			int16 vl = animGet(48, F2c) - 1;
+			animSet(48, F2c, vl);
+			(_scd->makePtr(0x12EA8) + 6).writeUINT16((_scd->makePtr(0x12EBC) + (vl << 1)).readUINT16());
+			_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x12EA8));
+			++_result.hitsTaken;
+		}
+	}
+}
+
+void ActionSequenceHandler::checkFinished() {
+	if (_scd->makePtr(0x11FD0)[_stage] && _result.hitsTaken >= 6) {
+		for (int i = 32; i < 41; ++i)
+			animSet(i, ControlFlags, animGet(i, ControlFlags) | GraphicsEngine::kAnimPause);
+		_vm->gfx()->reset(GraphicsEngine::kResetPalEvents);
+		_progressMSB = 3;
+		_result.hitsTaken = 6;
+	} else {
+		uint8 v = _scd->makePtr(_useLightGun ? 0x11F90 : 0x11F80)[_stage];
+		if (v && _result.enemiesShot < v)
+			return;
+
+		v = _scd->makePtr(0x11FA0)[_stage];
+		if (v && (_updateEnemiesPhase || (_enemyAppearanceCount < v)))
+			return;
+
+		if (_scd->makePtr(_useLightGun ? 0x11FC0 : 0x11FB0)[_stage] != 1 && _enemyAttackStatus != 0)
+			return;
+
+		if (_handleShotPhase != 0)
+			return;
+
+		for (int i = 32; i < 41; ++i) {
+			int16 a = animGet(i, F24);
+			if (a == 0xFF)
+				continue;
+			if ((a & 0x0F) != 0)
+				return;
+			if (_scd->makePtr(0x11FD0)[_stage] == 0 || _stage == 7)
+				continue;
+			animSet(i, Enable, 0);
+		}
+
+		if (_stage == 0 || _stage == 11) {
+			animSet(56, Enable, 1);
+			animSet(57, Enable, 1);
+			animSet(56, Frame, 2);
+			animSet(57, Frame, 2);
+		}
+		_progressMSB = 3;
+	}
+}
+
+#undef animSet
+#undef animGet
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/action.h b/engines/snatcher/action.h
new file mode 100644
index 00000000000..6c55129085f
--- /dev/null
+++ b/engines/snatcher/action.h
@@ -0,0 +1,104 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#ifndef SNATCHER_ACTION_H
+#define SNATCHER_ACTION_H
+
+#include "common/scummsys.h"
+
+namespace Common {
+
+} // namespace Common
+
+namespace Snatcher {
+
+class ResourcePointer;
+class SnatcherEngine;
+class ActionSequenceHandler {
+public:
+	ActionSequenceHandler(SnatcherEngine *vm, ResourcePointer *scd);
+	~ActionSequenceHandler();
+
+	bool run(bool useLightGun);
+	bool resetScore();
+	void setup(uint16 stage);
+
+	struct Result {
+		Result() : hitsTaken(0), shotsFired(0), shotsMissed(0), enemiesShot(0), civiliansShot(0), allCiviliansShot(0), weaponDrawn(0)  {}
+		uint8 hitsTaken;
+		uint8 shotsFired;
+		uint8 shotsMissed;
+		uint8 enemiesShot;
+		uint8 civiliansShot;
+		uint8 allCiviliansShot;
+		uint8 weaponDrawn;
+	};
+
+	const Result &getResult() const { return _result; }
+
+private:
+	void resetVars();
+	void initStage();
+	void handleWeaponDrawAndTargetSelection();
+	void handleShot();
+	void updateEnemies();
+	void updateStage();
+	void enemyAttack();
+	void checkFinished();
+
+	uint16 _stage;
+	int16 _progressMSB;
+	int16 _progressLSB;
+	int16 _weaponState;
+	int16 _enemyAttackSpeed;
+	int16 _handleShotPhase;
+	int16 _updateEnemiesPhase;
+	int16 _enemyAttackStatus;
+	int16 _targetField;
+	int16 _hscrollB;
+	int16 _vscrollB;
+	int16 _enemyAppearanceCount;
+	int16 _shoot_7912;
+	int16 _civiliansShot;
+	int16 _civilianAppearanceCount;
+	int16 _shoot_78F2;
+	int16 _nextEnemyAppearanceTimer;
+	int16 _animNo;
+	int16 _enemyAttackTimer;
+	int16 _shoot_78EE;
+	int16 _counter1;
+	int16 _counter2;
+	int16 _shoot_78EC;
+	int16 _attackerId;
+	int16 *_projectileCoords;
+	bool _active;
+
+	SnatcherEngine *_vm;
+	ResourcePointer *_scd;
+	bool _useLightGun;
+
+	Result _result;
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_ACTION_H
diff --git a/engines/snatcher/animator.h b/engines/snatcher/animator.h
index 584b03314ea..5889a34e796 100644
--- a/engines/snatcher/animator.h
+++ b/engines/snatcher/animator.h
@@ -52,6 +52,8 @@ public:
 	virtual void setAnimParameter(uint8 animObjId, int param, int32 value) = 0;
 	virtual void setAnimGroupParameter(uint8 animObjId, int groupOp, int32 value = 0) = 0;
 	virtual int32 getAnimParameter(uint8 animObjId, int param) const = 0;
+	virtual uint8 getAnimScriptByte(uint8 animObjId, uint16 offset) const = 0;
+	virtual void animCopySpec(uint8 srcAnimObjId, uint8 dstAnimObjId) = 0;
 
 	virtual uint16 screenWidth() const = 0;
 	virtual uint16 screenHeight() const = 0;
@@ -73,13 +75,13 @@ protected:
 	GraphicsEngine::GfxState &_gfxState;
 
 private:
-	static Animator *createSCDAnimator(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd);
+	static Animator *createSCDAnimator(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd, bool enableAspectRatioCorrection);
 
 public:
-	static Animator *create(const Graphics::PixelFormat *pxf, Common::Platform platform, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd) {
+	static Animator *create(const Graphics::PixelFormat *pxf, Common::Platform platform, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd, bool enableAspectRatioCorrection) {
 		switch (platform) {
 		case Common::kPlatformSegaCD:
-			return createSCDAnimator(pxf, state, pal, scr, snd);
+			return createSCDAnimator(pxf, state, pal, scr, snd, enableAspectRatioCorrection);
 		default:
 			break;
 		};
diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index c4fb7db465d..3036dac6cc1 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -39,7 +39,7 @@ namespace Snatcher {
 //#define		ANIM_DEBUG
 
 struct AnimObject {
-	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), palette(0), f18(0), f1c(0),
+	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), palette(0), f17(0), f18(0), f1c(0),
 		timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0),
 			res(), scriptData(), spriteData(nullptr), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), scriptComFlags(0), freeze(0), blink(0), blinkCounter(0), blinkDuration(0) {}
 
@@ -48,7 +48,7 @@ struct AnimObject {
 		posX = posY = 0;
 		relSpeedX = relSpeedY = 0;
 		palette = 0;
-		f18 = 0;
+		f17 = f18 = 0;
 		f1c = 0;
 		timeStamp = 0;
 		f24 = 0;
@@ -75,6 +75,7 @@ struct AnimObject {
 	int32 relSpeedX;
 	int32 relSpeedY;
 	uint8 palette;
+	uint16 f17;
 	uint16 f18;
 	uint8 f1c;
 	uint32 timeStamp;
@@ -107,7 +108,7 @@ struct AnimObject {
 class GraphicsEngine;
 class Animator_SCD : public Animator, public Graphics::SegaRenderer::HINTClient {
 public:
-	Animator_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd);
+	Animator_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd, bool enableAspectRatioCorrection);
 	~Animator_SCD() override;
 
 	bool enqueueDrawCommands(ResourcePointer &res) override;
@@ -129,6 +130,8 @@ public:
 	void setAnimParameter(uint8 animObjId, int param, int32 value) override;
 	void setAnimGroupParameter(uint8 animObjId, int groupOp, int32 value = 0) override;
 	int32 getAnimParameter(uint8 animObjId, int param) const override;
+	uint8 getAnimScriptByte(uint8 animObjId, uint16 offset) const override;
+	void animCopySpec(uint8 srcAnimObjId, uint8 dstAnimObjId) override;
 
 	uint16 screenWidth() const override { return _screenWidth; }
 	uint16 screenHeight() const override { return _screenHeight; }
@@ -240,8 +243,8 @@ private:
 	int anim_34(AnimObject &a, const uint8 *data);
 	int anim_35(AnimObject &a, const uint8 *data);
 	int anim_36(AnimObject &a, const uint8 *data);
-	int anim_37(AnimObject &a, const uint8 *data);
-	int anim_38(AnimObject &a, const uint8 *data);
+	int anim_fadeOut(AnimObject &a, const uint8 *data);
+	int anim_fadeIn(AnimObject &a, const uint8 *data);
 	int anim_setPalette(AnimObject &a, const uint8 *data);
 	int anim_transition(AnimObject &a, const uint8 *data);
 	int anim_speechSync(AnimObject &a, const uint8 *data);
@@ -264,7 +267,7 @@ private:
 	uint8 *_bootsSprTbl;
 };
 
-Animator_SCD::Animator_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd) : Animator(state), _pal(pal), _trs(scr), _snd(snd), _mode(1),
+Animator_SCD::Animator_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd, bool enableAspectRatioCorrection) : Animator(state), _pal(pal), _trs(scr), _snd(snd), _mode(1),
 	_modeChange(0), _screenWidth(256), _screenHeight(224), _transferData(), _transferMode(0), _transferDelay(0), _clearFlags(0), _tempBuffer(nullptr), _spriteBuffer(nullptr), _sr(nullptr), _frameCount3Dwn(0),
 		_animations(nullptr), _drawCommands(nullptr), _hINTClientProc(Graphics::SegaRenderer::HINTHandler(this, &Graphics::SegaRenderer::HINTClient::hINTCallback)), _realScreenWidth(0), _realScreenHeight(0),
 			_bootsDelay(0), _bootsSprTbl(nullptr), _bootsTotalFrames(0), _bootsHScroll(0), _bootsVScroll(0), _bootsCol(0) {
@@ -292,7 +295,8 @@ Animator_SCD::Animator_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::Gfx
 	}
 
 	_sr->setResolution(_screenWidth, _screenHeight);
-	_sr->toggleAspectRatioCorrection(true);
+	if (enableAspectRatioCorrection)
+		_sr->setAspectRatioCorrection(4.0 / 3.0, 2.0);
 	_sr->getRealResolution(_realScreenWidth, _realScreenHeight);
 	_sr->setupWindowPlane(0, 0, Graphics::SegaRenderer::kWinToLeft, Graphics::SegaRenderer::kWinToTop);
 	_sr->hINT_setHandler(&_hINTClientProc);
@@ -533,9 +537,12 @@ void Animator_SCD::setAnimParameter(uint8 animObjId, int param, int32 value) {
 	case GraphicsEngine::kAnimParaRelSpeedY:
 		a.relSpeedY = value << 16;
 		break;
-	case GraphicsEngine::kAnimParaF16:
+	case GraphicsEngine::kAnimParaPalette:
 		a.palette = value;
 		break;
+	case GraphicsEngine::kAnimParaF17:
+		a.f17 = value;
+		break;
 	case GraphicsEngine::kAnimParaF18:
 		a.f18 = value;
 		break;
@@ -622,8 +629,10 @@ int32 Animator_SCD::getAnimParameter(uint8 animObjId, int param) const {
 		return a.relSpeedX >> 16;
 	case GraphicsEngine::kAnimParaRelSpeedY:
 		return a.relSpeedY >> 16;
-	case GraphicsEngine::kAnimParaF16:
+	case GraphicsEngine::kAnimParaPalette:
 		return a.palette;
+	case GraphicsEngine::kAnimParaF17:
+		return a.f17;
 	case GraphicsEngine::kAnimParaF18:
 		return a.f18;
 	case GraphicsEngine::kAnimParaF1c:
@@ -666,6 +675,22 @@ int32 Animator_SCD::getAnimParameter(uint8 animObjId, int param) const {
 	}
 }
 
+uint8 Animator_SCD::getAnimScriptByte(uint8 animObjId, uint16 offset) const {
+	assert(animObjId < 64);
+	return _animations[animObjId]->scriptData[offset];
+}
+
+void Animator_SCD::animCopySpec(uint8 srcAnimObjId, uint8 dstAnimObjId) {
+	assert(srcAnimObjId < 64 && dstAnimObjId < 64);
+	AnimObject &src = *_animations[srcAnimObjId];
+	AnimObject &dst = *_animations[dstAnimObjId];
+	dst.palette = src.palette;
+	dst.frameDelay = src.frameDelay;
+	dst.spriteTableLocation = src.spriteTableLocation;
+	dst.scriptData = src.scriptData;
+	dst.spriteData = src.spriteData;
+}
+
 void Animator_SCD::hINTCallback(Graphics::SegaRenderer *sr) {
 	if (_pal)
 		_pal->hINTCallback(sr);
@@ -1077,8 +1102,8 @@ void Animator_SCD::makeAnimFunctions() {
 		ANM(34),
 		ANM(35),
 		ANM(36),
-		ANM(37),
-		ANM(38),
+		ANM(fadeOut),
+		ANM(fadeIn),
 		ANM(setPalette),
 		ANM(transition),
 		ANM(speechSync),
@@ -1294,14 +1319,17 @@ int Animator_SCD::anim_36(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Animator_SCD::anim_37(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_fadeOut(AnimObject &a, const uint8 *data) {
 	static const uint8 cmd[] = { 0x25, 0x00 };
 	ResourcePointer r(cmd, 0);
 	enqueueDrawCommands(r);
 	return 1;
 }
 
-int Animator_SCD::anim_38(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_fadeIn(AnimObject &a, const uint8 *data) {
+	static const uint8 cmd[] = { 0xA4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x20 };
+	ResourcePointer r(cmd, 0);
+	enqueueDrawCommands(r);
 	return 1;
 }
 
@@ -1415,7 +1443,7 @@ void Animator_SCD::createMouseCursor() {
 	//anim_setControlFlags(16, GraphicsEngine::kAnimPause);
 	//anim_setFrame(16, 0);
 
-	memset(_tempBuffer, 0, 0x10000);
+	/*memset(_tempBuffer, 0, 0x10000);
 	updateAnimations();
 	drawAnimSprites();
 	_sr->renderSprites(_tempBuffer, nullptr);
@@ -1426,7 +1454,7 @@ void Animator_SCD::createMouseCursor() {
 
 	g_system->setMouseCursor(_tempBuffer, 24, 24, 12, 12, 4);
 	g_system->setCursorPalette(_pal->getSystemPalette(), 0, 64);
-	g_system->showMouse(true);
+	g_system->showMouse(true);*/
 }
 
 // Boot logo sequence code. This has nothing to do with the engine graphics code, so I put it at the end, to keep the ugly mess out of sight...
@@ -1646,8 +1674,8 @@ int Animator_SCD::drawBootLogoFrame(uint8 *screen, int frameNo)  {
 }
 
 
-Animator *Animator::createSCDAnimator(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd) {
-	return new Animator_SCD(pxf, state, pal, scr, snd);
+Animator *Animator::createSCDAnimator(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd, bool enableAspectRatioCorrection) {
+	return new Animator_SCD(pxf, state, pal, scr, snd, enableAspectRatioCorrection);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/detection.h b/engines/snatcher/detection.h
index 3f6a83555d5..197a1c0a3a1 100644
--- a/engines/snatcher/detection.h
+++ b/engines/snatcher/detection.h
@@ -40,7 +40,7 @@ struct GameDescription {
 	// language overwrites of fan translations (only needed for multilingual games)
 	Common::Language fanLang;
 	Common::Language replacedLang;
-	
+
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 5260a5f833f..9ecab95f60c 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -33,13 +33,13 @@
 
 namespace Snatcher {
 
-GraphicsEngine::GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate, SoundEngine *snd) : _system(system), _state(vmstate),
+GraphicsEngine::GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate, SoundEngine *snd, bool enableAspectRatioCorrection) : _system(system), _state(vmstate),
 	_animator(nullptr), _text(nullptr), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _flags(0), _verbAreaType(0) {
 	assert(system);
 	_palette = Palette::create(pxf, _system->getPaletteManager(), platform, _state);
 	assert(_palette);
 	_trs = TransitionManager::create(platform, _state);
-	_animator = Animator::create(pxf, platform, _state, _palette, _trs, snd);
+	_animator = Animator::create(pxf, platform, _state, _palette, _trs, snd, enableAspectRatioCorrection);
 	_text = TextRenderer::create(platform, _animator);
 	assert(_animator);
 	_screen = new uint8[_animator->realScreenWidth() * _animator->realScreenHeight() * (pxf ? pxf->bytesPerPixel : 1)]();
@@ -142,10 +142,6 @@ void GraphicsEngine::printText(const uint8 *text) {
 void GraphicsEngine::setTextPrintDelay(uint16 delay) {
 	_text->setPrintDelay(delay);
 }
-/*
-void GraphicsEngine::setTextColor(uint8 color) {
-	_text->setColor(color);
-}*/
 
 bool GraphicsEngine::isTextInQueue() const {
 	return _text->needsPrint();
@@ -223,6 +219,10 @@ int32 GraphicsEngine::getAnimParameter(uint8 animObjId, int param) const {
 	return _animator->getAnimParameter(animObjId, param);
 }
 
+uint8 GraphicsEngine::getAnimScriptByte(uint8 animObjId, uint16 offset) const {
+	return _animator->getAnimScriptByte(animObjId, offset);
+}
+
 void GraphicsEngine::addAnimParameterFlags(uint8 animObjId, int param, int flags) {
 	setAnimParameter(animObjId, param, getAnimParameter(animObjId, param) | flags);
 }
@@ -235,6 +235,10 @@ bool GraphicsEngine::testAnimParameterFlags(uint8 animObjId, int param, int flag
 	return (getAnimParameter(animObjId, param) & flags);
 }
 
+void GraphicsEngine::animCopySpec(uint8 srcAnimObjId, uint8 dstAnimObjId) {
+	_animator->animCopySpec(srcAnimObjId, dstAnimObjId);
+}
+
 uint16 GraphicsEngine::screenWidth() const {
 	return _animator ? _animator->screenWidth() : 0;
 }
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 1d6951d28c9..8a526a7637a 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -48,7 +48,7 @@ class TextRenderer;
 
 class GraphicsEngine {
 public:
-	GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate, SoundEngine *snd);
+	GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate, SoundEngine *snd, bool enableAspectRatioCorrection);
 	~GraphicsEngine();
 
 	void runScript(ResourcePointer res, int func);
@@ -71,7 +71,6 @@ public:
 	void setTextFont(const uint8 *font, uint32 fontSize, const uint8 *charWidthTable, uint32 charWidthTableSize);
 	void printText(const uint8 *text);
 	void setTextPrintDelay(uint16 delay);
-	//void setTextColor(uint8 color);
 	bool isTextInQueue() const;
 	void resetTextFields();
 	void clearJordanInputField();
@@ -104,7 +103,8 @@ public:
 		kAnimParaPosY,
 		kAnimParaRelSpeedX,
 		kAnimParaRelSpeedY,
-		kAnimParaF16,
+		kAnimParaPalette,
+		kAnimParaF17,
 		kAnimParaF18,
 		kAnimParaF1c,
 		kAnimParaTimeStamp,
@@ -135,9 +135,11 @@ public:
 	void setAnimParameter(uint8 animObjId, int param, int32 value);
 	void setAnimGroupParameter(uint8 animObjId, int groupOp, int32 value = 0);
 	int32 getAnimParameter(uint8 animObjId, int param) const;
+	uint8 getAnimScriptByte(uint8 animObjId, uint16 offset) const;
 	void addAnimParameterFlags(uint8 animObjId, int param, int flags);
 	void clearAnimParameterFlags(uint8 animObjId, int param, int flags);
 	bool testAnimParameterFlags(uint8 animObjId, int param, int flags) const;
+	void animCopySpec(uint8 srcAnimObjId, uint8 dstAnimObjId);
 
 	uint16 screenWidth() const;
 	uint16 screenHeight() const;
diff --git a/engines/snatcher/memory.cpp b/engines/snatcher/memory.cpp
index 755b8e21118..2f9881c4a8f 100644
--- a/engines/snatcher/memory.cpp
+++ b/engines/snatcher/memory.cpp
@@ -20,6 +20,7 @@
 */
 
 
+#include "snatcher/action.h"
 #include "snatcher/memory.h"
 #include "snatcher/saveload.h"
 #include "snatcher/snatcher.h"
@@ -33,8 +34,29 @@ uint16 MemAccessHandler::readWord(uint16 addr) {
 	int result = 0;
 
 	switch (addr) {
+	case 0x7908:
+		result = _aseq->getResult().shotsFired;
+		break;
+	case 0x790A:
+		result = _aseq->getResult().enemiesShot;
+		break;
+	case 0x790C:
+		result = _aseq->getResult().civiliansShot;
+		break;
+	case 0x790E:
+		result = _aseq->getResult().shotsMissed;
+		break;
+	case 0x7910:
+		result = _aseq->getResult().hitsTaken;
+		break;
+	case 0x7916:
+		result = _aseq->getResult().allCiviliansShot;
+		break;
+	case 0x7918:
+		result = _aseq->getResult().weaponDrawn;
+		break;
 	case 0x7972:
-		result = _state->conf.useLightGun ? 1 : 0;
+		result = /*_state->conf.useLightGun ? 1 :*/ 0;
 		break;
 	case 0x79E0:
 		// BURAM status
diff --git a/engines/snatcher/memory.h b/engines/snatcher/memory.h
index b67b80139d3..e301ffa90c3 100644
--- a/engines/snatcher/memory.h
+++ b/engines/snatcher/memory.h
@@ -27,6 +27,7 @@
 
 namespace Snatcher {
 
+class ActionSequenceHandler;
 class SaveLoadManager;
 class SnatcherEngine;
 class UI;
@@ -38,7 +39,7 @@ struct GameState;
 
 class MemAccessHandler {
 public:
-	MemAccessHandler(SnatcherEngine *vm, UI *ui, SaveLoadManager *saveMan) : _vm(vm), _ui(ui), _saveMan(saveMan) {}
+	MemAccessHandler(SnatcherEngine *vm, UI *ui, ActionSequenceHandler *aseq, SaveLoadManager *saveMan) : _vm(vm), _ui(ui), _aseq(aseq), _saveMan(saveMan) {}
 	~MemAccessHandler() {}
 
 	uint16 readWord(uint16 addr);
@@ -49,6 +50,7 @@ public:
 private:
 	SnatcherEngine *_vm;
 	UI *_ui;
+	ActionSequenceHandler *_aseq;
 	SaveLoadManager *_saveMan;
 	GameState *_state;
 };
diff --git a/engines/snatcher/metaengine.cpp b/engines/snatcher/metaengine.cpp
index 468e5870a04..f85655d1361 100644
--- a/engines/snatcher/metaengine.cpp
+++ b/engines/snatcher/metaengine.cpp
@@ -113,7 +113,7 @@ SaveStateList SnatcherMetaEngine::listSaves(const char *target) const {
 
 	Common::StringArray filenames;
 	filenames = saveFileMan->listSavefiles(pattern);
-	
+
 	SaveStateList saveList;
 	for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
 		// Obtain the last 3 digits of the filename, since they correspond to the save slot
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index e5d50eea208..d82ddd40ec8 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -1,6 +1,7 @@
 MODULE := engines/snatcher
 
 MODULE_OBJS := \
+	action.o \
 	animator_scd.o \
 	graphics.o \
 	memory.o \
diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index 1ef30c49a05..a14d1cdcf81 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -331,7 +331,7 @@ void SCDPalette::event_palSet(PalEventSCD *evt) {
 		*dst++ = READ_BE_UINT16(src++);
 
 	if (READ_BE_UINT16(++evt->srcOffsetCur) == 0xFFFF)
-		evt->cmd = 0;	
+		evt->cmd = 0;
 }
 
 void SCDPalette::event_palFadeFromBlack(PalEventSCD *evt) {
@@ -426,7 +426,7 @@ void SCDPalette::event_palFadeToGrey(PalEventSCD *evt) {
 		uint8 r = col & 0xF;
 		uint8 g = (col & 0xF0) >> 4;
 		uint8 b = (col & 0xF00) >> 8;
-		col = ((r + g + b) / 3) & 0xFFFE;		
+		col = ((r + g + b) / 3) & 0xFFFE;
 		fadeStep(dst++, col & 0xF, (col << 4) & 0xF0, (col << 8) & 0xF00);
 	}
 
@@ -511,7 +511,7 @@ void SCDPalette::hIntHandler_characterChatPortraitPalette(Graphics::SegaRenderer
 }
 
 void SCDPalette::hIntHandler_23(Graphics::SegaRenderer *sr) {
-	
+
 }
 
 Palette *Palette::createSegaPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state) {
diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index 6a802bd0a72..0c87eb83d23 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -197,6 +197,11 @@ uint32 ResourcePointer::readIncrSINT32() {
 	return r;
 }
 
+void ResourcePointer::writeUINT16(uint16 value) {
+	assert(_writeableDataStart);
+	WRITE_BE_UINT16(_writeableDataStart + _offset, value);
+}
+
 void ResourcePointer::writeUINT32(uint32 value) {
 	assert(_writeableDataStart);
 	WRITE_BE_UINT32(_writeableDataStart + _offset, value);
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index ff6c9623449..26e8c2467da 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -68,6 +68,7 @@ public:
 	uint16 readIncrSINT16();
 	uint32 readIncrUINT32();
 	uint32 readIncrSINT32();
+	void writeUINT16(uint16 value);
 	void writeUINT32(uint32 value);
 	ResourcePointer operator+(int inc) const;
 	bool operator<(const ResourcePointer &ptr) const;
@@ -131,7 +132,7 @@ public:
 	Common::SeekableReadStream *readStream(const Common::Path &file);
 	Common::SeekableReadStreamEndian *readStreamEndian(int index, EndianMode em = kPlatformEndianness);
 	Common::SeekableReadStreamEndian *readStreamEndian(const Common::Path &file, EndianMode em = kPlatformEndianness);
-	
+
 
 private:
 	Common::SearchSet _files;
diff --git a/engines/snatcher/saveload.cpp b/engines/snatcher/saveload.cpp
index de61bcf0a0d..8901fdad3fd 100644
--- a/engines/snatcher/saveload.cpp
+++ b/engines/snatcher/saveload.cpp
@@ -215,7 +215,7 @@ void SaveLoadManager::saveState(int slot, GameState &state) {
 	_vm->sound()->saveState(out);
 
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
-	
+
 	out->finalize();
 	delete out;
 
@@ -253,7 +253,7 @@ Common::OutSaveFile *SaveLoadManager::openFileForSaving(int slot, const Common::
 		error("%s(): Unable to create thumbnail", __FUNCTION__);
 
 	Graphics::saveThumbnail(*out, tn);
-	
+
 	TimeDate td;
 	_vm->_system->getTimeAndDate(td);
 
diff --git a/engines/snatcher/scene/scene_d0.cpp b/engines/snatcher/scene/scene_d0.cpp
index 68ccda62a31..58bd756ea16 100644
--- a/engines/snatcher/scene/scene_d0.cpp
+++ b/engines/snatcher/scene/scene_d0.cpp
@@ -132,7 +132,7 @@ SH_IMPL_UPDT(D0) {
 	} else if (_vm->sound()->cdaGetTime() >= _timeStamp[state.frameNo]) {
 		(*_frameProcs[state.frameNo])(state);
 		++state.frameNo;
-	} else if (_vm->input().controllerFlags & 0x80) {
+	} else if (_vm->input().singleFrameControllerFlags & 0x80) {
 		state.finish = -1;
 		state.frameNo = 0;
 	}
diff --git a/engines/snatcher/scene/scene_d1.cpp b/engines/snatcher/scene/scene_d1.cpp
index f44745f61d4..05c247b384d 100644
--- a/engines/snatcher/scene/scene_d1.cpp
+++ b/engines/snatcher/scene/scene_d1.cpp
@@ -122,7 +122,7 @@ SH_IMPL_UPDT(D1) {
 	} else if (_vm->sound()->cdaGetTime() >= _timeStamp[state.frameNo]) {
 		(*_frameProcs[state.frameNo])(state);
 		++state.frameNo;
-	} else if (_vm->input().controllerFlags & 0x80) {
+	} else if (_vm->input().singleFrameControllerFlags & 0x80) {
 		state.finish = -1;
 		state.frameNo = 0;
 	}
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene/scene_d2.cpp
index d9279ae0bb9..7fd91f91205 100644
--- a/engines/snatcher/scene/scene_d2.cpp
+++ b/engines/snatcher/scene/scene_d2.cpp
@@ -109,11 +109,11 @@ SH_IMPL_FRM(D2, 00) {
 		}
 		break;
 	case 2:
-		if (_vm->input().controllerFlags & 3) {
+		if (_vm->input().singleFrameControllerFlags & 3) {
 			_vm->gfx()->clearAnimParameterFlags(16, GraphicsEngine::kAnimParaControlFlags, ~GraphicsEngine::kAnimHide);
 			_buram0 ^= 1;
 		}
-		if (_vm->input().controllerFlags & 0x80) {
+		if (_vm->input().singleFrameControllerFlags & 0x80) {
 			state.counter = 10;
 			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x290F2));
 			++state.frameState;
@@ -137,7 +137,7 @@ SH_IMPL_FRM(D2, 01) {
 	} else if (_vm->sound()->cdaIsPlaying()) {
 		++state.frameNo;
 		state.frameState = 0;
-	}	
+	}
 }
 
 SH_IMPL_FRM(D2, 02) {
@@ -252,9 +252,9 @@ SH_IMPL_FRM(D2, 09) {
 		state.frameState += (state.saveSlotUsage ? 1 : 2);
 		break;
 	case 1:
-		if (_vm->input().controllerFlags & 3)
+		if (_vm->input().singleFrameControllerFlags & 3)
 			_vm->gfx()->clearAnimParameterFlags(17, GraphicsEngine::kAnimParaControlFlags, ~GraphicsEngine::kAnimHide);
-		if (_vm->input().controllerFlags & 0x80) {
+		if (_vm->input().singleFrameControllerFlags & 0x80) {
 			_vm->gfx()->setAnimParameter(17, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 			state.menuSelect = 1;
 			if (_vm->gfx()->getAnimParameter(17, GraphicsEngine::kAnimParaFrame) == 3) {
@@ -265,7 +265,7 @@ SH_IMPL_FRM(D2, 09) {
 		}
 		break;
 	default:
-		if (_vm->input().controllerFlags & 0x80) {
+		if (_vm->input().singleFrameControllerFlags & 0x80) {
 			++state.frameNo;
 			state.frameState = 0;
 			fin = true;
@@ -297,12 +297,12 @@ SH_IMPL_FRM(D2, 10) {
 			return;
 		}
 		_vm->gfx()->clearAnimParameterFlags(24, GraphicsEngine::kAnimParaControlFlags, 0xFF);
-		_vm->gfx()->clearAnimParameterFlags(25, GraphicsEngine::kAnimParaControlFlags, 0xFF);		
+		_vm->gfx()->clearAnimParameterFlags(25, GraphicsEngine::kAnimParaControlFlags, 0xFF);
 
 		do {
-			if (_vm->input().controllerFlags & 1)
+			if (_vm->input().singleFrameControllerFlags & 1)
 				--_curSaveFile;
-			if (_vm->input().controllerFlags & 2)
+			if (_vm->input().singleFrameControllerFlags & 2)
 				++_curSaveFile;
 			_curSaveFile &= 3;
 		} while (!(state.saveSlotUsage & (1 << _curSaveFile)));
@@ -310,11 +310,11 @@ SH_IMPL_FRM(D2, 10) {
 		_vm->gfx()->setAnimParameter(24, GraphicsEngine::kAnimParaFrame, _curSaveFile << 2);
 		_vm->gfx()->setAnimParameter(25, GraphicsEngine::kAnimParaFrame, _curSaveFile << 2);
 
-		if (_vm->input().controllerFlags & 0x80) {
+		if (_vm->input().singleFrameControllerFlags & 0x80) {
 			_vm->sound()->fmSendCommand(56, 0, 2);
 			_loadCancelled = false;
 			fin = true;
-		} else if (_vm->input().controllerFlags & 0x10) {
+		} else if (_vm->input().singleFrameControllerFlags & 0x10) {
 			_loadCancelled = true;
 			fin = true;
 		}
@@ -373,9 +373,9 @@ SH_IMPL_FRM(D2, 11) {
 			_vm->gfx()->clearAnimParameterFlags(i, GraphicsEngine::kAnimParaControlFlags, 0xFF);
 
 		do {
-			if (_vm->input().controllerFlags & 1)
+			if (_vm->input().singleFrameControllerFlags & 1)
 				--_option;
-			if (_vm->input().controllerFlags & 2)
+			if (_vm->input().singleFrameControllerFlags & 2)
 				++_option;
 			_option = (_option + 5) % 5;
 		} while (_option == 3 && !state.conf.useLightGun);
@@ -387,18 +387,18 @@ SH_IMPL_FRM(D2, 11) {
 		}
 
 		if (_option == 0) {
-			if (state.conf.lightGunAvailable && _vm->input().controllerFlags & 0x0C)
+			if (state.conf.lightGunAvailable && _vm->input().singleFrameControllerFlags & 0x0C)
 				state.conf.useLightGun ^= 1;
 		} else if (_option == 1) {
-			if (_vm->input().controllerFlags & 8)
+			if (_vm->input().singleFrameControllerFlags & 8)
 				++state.conf.controllerSetup;
-			if (_vm->input().controllerFlags & 4)
+			if (_vm->input().singleFrameControllerFlags & 4)
 				--state.conf.controllerSetup;
 			state.conf.controllerSetup = (state.conf.controllerSetup + 5) % 5;
 		} else if (_option == 2) {
-			if (_vm->input().controllerFlags & 0x0C)
+			if (_vm->input().singleFrameControllerFlags & 0x0C)
 				state.conf.disableStereo ^= 1;
-		}		
+		}
 
 		_vm->gfx()->setAnimParameter(32, GraphicsEngine::kAnimParaFrame, _option << 2);
 		_vm->gfx()->setAnimParameter(33, GraphicsEngine::kAnimParaFrame, ((_option ? 2 : 0) + state.conf.useLightGun) << 1);
@@ -406,9 +406,9 @@ SH_IMPL_FRM(D2, 11) {
 		_vm->gfx()->setAnimParameter(34, GraphicsEngine::kAnimParaFrame, ((_option != 1 ? 6 : 0) + state.conf.controllerSetup) << 1);
 		_vm->gfx()->setAnimParameter(35, GraphicsEngine::kAnimParaFrame, ((_option != 2 ? 2 : 0) + state.conf.disableStereo) << 1);
 
-		if (_vm->input().controllerFlags & 0x80)
+		if (_vm->input().singleFrameControllerFlags & 0x80)
 			fin = (_option != 3) ? 1 : 3;
-		else if (_vm->input().controllerFlags & 0x70)
+		else if (_vm->input().singleFrameControllerFlags & 0x70)
 			fin = (_option == 4) ? 1 : (_option == 3 ? 3 : 0);
 		if (fin) {
 			_vm->sound()->pcmSendCommand(55 + fin, -1);
@@ -445,7 +445,7 @@ SH_IMPL_FRM(D2, 11) {
 		++state.frameState;
 		break;
 	case 3:
-		if (_vm->input().controllerFlags & 0x80) {
+		if (_vm->input().singleFrameControllerFlags & 0x80) {
 			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x290F2));
 			state.counter = 10;
 			++state.frameState;
@@ -462,7 +462,7 @@ SH_IMPL_FRM(D2, 11) {
 			++state.counter;
 			break;
 		case 1:
-			if (_vm->input().controllerFlags & 0x100) {
+			if (_vm->input().singleFrameControllerFlags & 0x100) {
 				_vm->sound()->pcmSendCommand(57, -1);
 				_vm->gfx()->setAnimParameter(18, GraphicsEngine::kAnimParaBlink, 0);
 				_vm->gfx()->setAnimParameter(18, GraphicsEngine::kAnimParaAbsSpeedX, 0);
@@ -479,7 +479,7 @@ SH_IMPL_FRM(D2, 11) {
 			++state.counter;
 			break;
 		case 3:
-			if (_vm->input().controllerFlags & 0x200) {
+			if (_vm->input().singleFrameControllerFlags & 0x200) {
 				_vm->gfx()->setAnimParameter(17, GraphicsEngine::kAnimParaBlink, 1);
 				_vm->gfx()->setAnimParameter(17, GraphicsEngine::kAnimParaAbsSpeedX, 1);
 				_vm->gfx()->setAnimParameter(19, GraphicsEngine::kAnimParaBlink, 0);
@@ -487,7 +487,7 @@ SH_IMPL_FRM(D2, 11) {
 				_vm->allowLightGunInput(false);
 				state.counter += 2;
 				_vm->sound()->fmSendCommand(29, 0, 2);
-			} else if (_vm->input().controllerFlags & 0x100) {
+			} else if (_vm->input().singleFrameControllerFlags & 0x100) {
 				_vm->sound()->pcmSendCommand(57, -1);
 				state.counter++;
 			}
diff --git a/engines/snatcher/scene_imp.h b/engines/snatcher/scene_imp.h
index b56106ebf28..2376b206d75 100644
--- a/engines/snatcher/scene_imp.h
+++ b/engines/snatcher/scene_imp.h
@@ -34,7 +34,7 @@ namespace Snatcher {
 		typedef Common::Functor1Mem<GameState&, void, Scene_##id> FrameProc; \
 		typedef void(Scene_##id::*FrameProcTblEntry)(GameState&); \
 		Common::Array<FrameProc*> _frameProcs; \
-		static const FrameProcTblEntry frameProcTable[];		
+		static const FrameProcTblEntry frameProcTable[];
 
 #define SH_HEAD_END(id) }; \
 	SceneHandler *createSceneHandler_##id(SnatcherEngine *vm, SceneModule *scn, FIO *fio) { return new Scene_##id(vm, scn, fio); }
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index 961afa74f53..03db40cdc80 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -20,6 +20,7 @@
 */
 
 
+#include "snatcher/action.h"
 #include "snatcher/graphics.h"
 #include "snatcher/memory.h"
 #include "snatcher/resource.h"
@@ -119,14 +120,14 @@ void CmdQueue::makeFunctions() {
 		OP(invItemCloseUp),
 		OP(resetTextFields),
 		OP(23),
-		OP(24),
+		OP(shooterSequenceRun),
 		OP(fmSfxWait),
 		OP(26),
 		OP(27),
 		OP(fmSoundEffect),
 		OP(pcmBlock),
 		OP(saveGame),
-		OP(31),
+		OP(shooterSequenceResetScore),
 		OP(gfxPostLoadProcess),
 		OP(33),
 		OP(palOps),
@@ -209,7 +210,7 @@ void CmdQueue::m_fmMusicStart(const uint16 *&data) {
 }
 
 void CmdQueue::m_displayDialog(const uint16 *&data) {
-	if (_vm->_ui->displayDialog(data[0], data[1], _vm->input().controllerFlagsRemapped)) {
+	if (_vm->_ui->displayDialog(data[0], data[1], _vm->input().singleFrameControllerFlagsRemapped)) {
 		_progress = -1;
 		data += 2;
 	}
@@ -247,7 +248,7 @@ void CmdQueue::m_pcmWait(const uint16 *&data) {
 		_counter = 3600;
 		++_progress;
 	}
-	if (--_counter == 0 || !(_vm->sound()->pcmGetStatus().statusBits & 0x0F)) 
+	if (--_counter == 0 || !(_vm->sound()->pcmGetStatus().statusBits & 0x0F))
 		_progress = -1;
 }
 
@@ -369,7 +370,7 @@ void CmdQueue::m_fmMusicWait(const uint16 *&data) {
 		_counter = 2700;
 		++_progress;
 	}
-	if (--_counter == 0 || (_vm->sound()->fmGetStatus().music == 0)) 
+	if (--_counter == 0 || (_vm->sound()->fmGetStatus().music == 0))
 		_progress = -1;
 }
 
@@ -396,8 +397,9 @@ void CmdQueue::m_resetTextFields(const uint16 *&data) {
 void CmdQueue::m_23(const uint16 *&data) {
 }
 
-void CmdQueue::m_24(const uint16 *&data) {
-//shooting practice
+void CmdQueue::m_shooterSequenceRun(const uint16 *&data) {
+	if (!_vm->_aseq->run(/*_state->conf.useLightGun*/0))
+		_progress = -1;
 }
 
 void CmdQueue::m_fmSfxWait(const uint16 *&data) {
@@ -405,7 +407,7 @@ void CmdQueue::m_fmSfxWait(const uint16 *&data) {
 		_counter = 600;
 		++_progress;
 	}
-	if (--_counter == 0 || (_vm->sound()->fmGetStatus().sfx == 0)) 
+	if (--_counter == 0 || (_vm->sound()->fmGetStatus().sfx == 0))
 		_progress = -1;
 }
 
@@ -433,7 +435,9 @@ void CmdQueue::m_saveGame(const uint16 *&data) {
 	_progress = -1;
 }
 
-void CmdQueue::m_31(const uint16 *&data) {
+void CmdQueue::m_shooterSequenceResetScore(const uint16 *&data) {
+	if (!_vm->_aseq->resetScore())
+		_progress = -1;
 }
 
 void CmdQueue::m_gfxPostLoadProcess(const uint16 *&data) {
@@ -458,7 +462,7 @@ void CmdQueue::m_clearJordanInputField(const uint16 *&data) {
 	_progress = -1;
 }
 
-ScriptEngine::ScriptEngine(CmdQueue *que, UI *ui, MemAccessHandler *mem, ResourcePointer *scd) : _que(que), _ui(ui), _mem(mem), _arrayData(nullptr), _pos1(0), _pos2(0), _op(0), /*_v1(0), _v2(0), _v3(0),*/ _result(0), _flagsTable(nullptr) {
+ScriptEngine::ScriptEngine(CmdQueue *que, UI *ui, ActionSequenceHandler *aseq, MemAccessHandler *mem, ResourcePointer *scd) : _que(que), _ui(ui), _aseq(aseq), _mem(mem), _arrayData(nullptr), _pos1(0), _pos2(0), _op(0), /*_v1(0), _v2(0), _v3(0),*/ _result(0), _flagsTable(nullptr) {
 	_flagsTable = new uint8[352]();
 	_arrayData = new uint8[256]();
 	makeOpcodeTable(scd);
@@ -623,7 +627,6 @@ void ScriptEngine::getFlags(uint16 sel, uint16 &result) {
 	uint8 v2 = sel & 0x0F;
 	uint8 v1 = v2 + 1 + ((sel >> 4) & 7);
 	result = ((r << v1) | (r >> (32 - v1))) & maskTable[v2];
-	debug ("GETFLAGS: sel 0x%04X, 0x%02x%02x%02x", sel, *in, *(in+1), *(in+2));
 }
 
 void ScriptEngine::setFlags(uint16 sel, uint32 flags) {
@@ -645,8 +648,6 @@ void ScriptEngine::setFlags(uint16 sel, uint32 flags) {
 	*in++ = (flags >> 24) & 0xFF;
 	*in++ = (flags >> 16) & 0xFF;
 	*in++ = (flags >> 8) & 0xFF;
-
-	debug ("SETVAR: sel 0x%04X, 0x%02x%02x%02x", sel, *(in-3), *(in-2), *(in-1));
 }
 
 uint8 ScriptEngine::countFunctionOps() {
@@ -864,12 +865,12 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 		OP(clearFlags),
 		OP(setFlags),
 		OP(21),
-		OP(eval_greater),
-		OP(23),
-		OP(24),
-		OP(24),
-		OP(jumpIf),
-		OP(jumpIf),
+		OP(eval_less),
+		OP(eval_lessOrSame),
+		OP(do_either_or),
+		OP(do_either_or),
+		OP(do_if),
+		OP(do_if),
 		OP(28),
 		OP(28),
 		OP(executeFunction),
@@ -1090,7 +1091,7 @@ void ScriptEngine::o_21() {
 		_result = 0xFFFF;
 }
 
-void ScriptEngine::o_eval_greater() {
+void ScriptEngine::o_eval_less() {
 	uint16 m1 = 0;
 	uint16 m2 = 0;
 	uint16 r1 = 0;
@@ -1100,13 +1101,23 @@ void ScriptEngine::o_eval_greater() {
 	_pos1 = _pos2;
 	r1 = _result;
 	runOpcodeOrReadVar(m2, _result);
-	_result = (r1 > _result) ? 0xFFFF : 0;
+	_result = (_result < r1) ? 0xFFFF : 0;
 }
 
-void ScriptEngine::o_23() {
+void ScriptEngine::o_eval_lessOrSame() {
+	uint16 m1 = 0;
+	uint16 m2 = 0;
+	uint16 r1 = 0;
+	_pos2 = _pos1++;
+	getOpcodeProperties(m1, m2, r1);
+	runOpcodeOrReadVar(m1, _result);
+	_pos1 = _pos2;
+	r1 = _result;
+	runOpcodeOrReadVar(m2, _result);
+	_result = (_result <= r1) ? 0xFFFF : 0;
 }
 
-void ScriptEngine::o_24() {
+void ScriptEngine::o_do_either_or() {
 	uint16 mode = 0;
 	uint16 f1 = 0;
 	uint16 f2 = 0;
@@ -1119,7 +1130,7 @@ void ScriptEngine::o_24() {
 	runOpcode();
 }
 
-void ScriptEngine::o_jumpIf() {
+void ScriptEngine::o_do_if() {
 	uint16 mode = 0;
 	uint16 f1 = 0;
 	uint16 f2 = 0;
@@ -1152,7 +1163,7 @@ void ScriptEngine::o_executeFunction() {
 	uint8 num = countFunctionOps();
 	uint8 cnt = 1;
 	int orig = _pos1;
-	
+
 	for (bool lp = true; lp; ) {
 		_pos2 = orig;
 		seekToFunctionOp(cnt);
@@ -1405,7 +1416,6 @@ void ScriptEngine::o_sysOps() {
 		// Save game state
 		_que->writeUInt16(0x1E);
 		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 4));
-		//saveState_sub_14F12();
 		break;
 	case 2:
 		_que->writeUInt16(0x21);
@@ -1415,9 +1425,7 @@ void ScriptEngine::o_sysOps() {
 		break;
 	case 4:
 		// Start action sequence
-		//_scr_wd_00 = READ_BE_UINT16(_script->data + _pos1 + 4);
-		//_scr_wd_01 = _scr_wd_02 = _scr_wd_03 = _scr_wd_04 = 0;
-		//_scr_bt_00 = true;
+		_aseq->setup(READ_BE_UINT16(_script->data + _pos1 + 4));
 		_que->writeUInt16(0x18);
 		break;
 	case 5:
diff --git a/engines/snatcher/script.h b/engines/snatcher/script.h
index c1e5f6d7704..cce685853db 100644
--- a/engines/snatcher/script.h
+++ b/engines/snatcher/script.h
@@ -35,6 +35,7 @@ class SeekableWriteStream;
 
 namespace Snatcher {
 
+class ActionSequenceHandler;
 class ResourcePointer;
 class SnatcherEngine;
 class UI;
@@ -92,21 +93,21 @@ private:
 	void m_invItemCloseUp(const uint16 *&data);
 	void m_resetTextFields(const uint16 *&data);
 	void m_23(const uint16 *&data);
-	void m_24(const uint16 *&data);
+	void m_shooterSequenceRun(const uint16 *&data);
 	void m_fmSfxWait(const uint16 *&data);
 	void m_26(const uint16 *&data);
 	void m_27(const uint16 *&data);
 	void m_fmSoundEffect(const uint16 *&data);
 	void m_pcmBlock(const uint16 *&data);
 	void m_saveGame(const uint16 *&data);
-	void m_31(const uint16 *&data);
+	void m_shooterSequenceResetScore(const uint16 *&data);
 	void m_gfxPostLoadProcess(const uint16 *&data);
 	void m_33(const uint16 *&data);
 	void m_palOps(const uint16 *&data);
 	void m_clearJordanInputField(const uint16 *&data);
 
 	typedef Common::Functor1Mem<const uint16*&, void, CmdQueue> CmdQueOpcode;
-	Common::Array<CmdQueOpcode*> _opcodes;	
+	Common::Array<CmdQueOpcode*> _opcodes;
 };
 
 class ScriptArray {
@@ -135,7 +136,7 @@ private:
 class MemAccessHandler;
 class ScriptEngine {
 public:
-	ScriptEngine(CmdQueue *que, UI *ui, MemAccessHandler *mem, ResourcePointer *scd);
+	ScriptEngine(CmdQueue *que, UI *ui, ActionSequenceHandler *aseq, MemAccessHandler *mem, ResourcePointer *scd);
 	~ScriptEngine();
 
 	void resetArrays();
@@ -149,6 +150,7 @@ public:
 private:
 	CmdQueue *_que;
 	MemAccessHandler *_mem;
+	ActionSequenceHandler *_aseq;
 	UI *_ui;
 	Script *_script;
 
@@ -202,10 +204,10 @@ private:
 	void o_clearFlags();
 	void o_setFlags();
 	void o_21();
-	void o_eval_greater();
-	void o_23();
-	void o_24();
-	void o_jumpIf();
+	void o_eval_less();
+	void o_eval_lessOrSame();
+	void o_do_either_or();
+	void o_do_if();
 	void o_28();
 	void o_executeFunction();
 	void o_40();
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index bebf0b8d110..d90d5a416f4 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -19,6 +19,7 @@
 *
 */
 
+#include "snatcher/action.h"
 #include "snatcher/graphics.h"
 #include "snatcher/memory.h"
 #include "snatcher/resource.h"
@@ -47,16 +48,17 @@
 namespace Snatcher {
 
 SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _scd(nullptr), _gfx(nullptr), _snd(nullptr), _input(),
-	_scriptEngine(nullptr), _cmdQueue(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _enableLightGun(false), _ui(nullptr), _gfxInfo(), _saveMan(nullptr), _reset(false),
+	_scriptEngine(nullptr), _cmdQueue(nullptr), _aseq(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _enableLightGun(false), _ui(nullptr), _gfxInfo(), _saveMan(nullptr), _reset(false),
 		_memHandler(nullptr), _frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
 	assert(system);
 }
 
 SnatcherEngine::~SnatcherEngine() {
+	delete _aseq;
 	delete _cmdQueue;
 	delete _fio;
 	delete _gfx;
-	delete _memHandler;	
+	delete _memHandler;
 	delete _module;
 	delete _saveMan;
 	delete _scd;
@@ -131,10 +133,10 @@ bool SnatcherEngine::initGfx(Common::Platform platform, bool use8BitColorMode) {
 			error("%s(): No suitable color mode found", __FUNCTION__);
 	}
 
-	_gfx = new GraphicsEngine(&pxf, _system, platform, _gfxInfo, _snd);
+	_gfx = new GraphicsEngine(&pxf, _system, platform, _gfxInfo, _snd, ConfMan.getBool("aspect_ratio"));
 
 	if (_gfx) {
-		initGraphics(_gfx->screenWidth(), _gfx->screenHeight(), &pxf);
+		initGraphics(_gfx->realScreenWidth(), _gfx->realScreenHeight(), &pxf);
 		assert(_scd);
 		_gfx->setTextFont(_scd->makePtr(0x14B7C)(), 816, _scd->makePtr(0x14EAC)(), 102);
 		return true;
@@ -171,10 +173,14 @@ bool SnatcherEngine::initScriptEngine() {
 	if (!_ui)
 		return false;
 
-	_memHandler = new MemAccessHandler(this, _ui, _saveMan);
+	_aseq = new ActionSequenceHandler(this, _scd);
+	if (!_aseq)
+		return false;
+
+	_memHandler = new MemAccessHandler(this, _ui, _aseq, _saveMan);
 	assert(_memHandler);
 
-	_scriptEngine = new ScriptEngine(_cmdQueue, _ui, _memHandler, _scd);
+	_scriptEngine = new ScriptEngine(_cmdQueue, _ui, _aseq, _memHandler, _scd);
 	if (!_scriptEngine)
 		return false;
 
@@ -347,38 +353,60 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 	Common::Event evt;
 	_lastKeys &= ~_releaseKeys;
 	_releaseKeys = 0;
-	_input.controllerFlags = _input.controllerFlagsRemapped = 0;
+	_input.singleFrameControllerFlags = _input.singleFrameControllerFlagsRemapped = 0;
 	Common::Point mouse;
 
 	while (_eventMan->pollEvent(evt)) {
 		for (const InputEvent &k : _defaultKeyEvents) {
 			if (evt.type == k.pressType && (k.kc == Common::KEYCODE_INVALID || evt.kbd.keycode == k.kc) && (k.kFlag == 0 || (evt.kbd.flags & k.kFlag))) {
+				if (k.kc != Common::KEYCODE_INVALID && k.releaseType != Common::EVENT_INVALID) {
+					_input.sustainedControllerFlags |= k.internalEvent;
+					// The A, B and C buttons can be reconfigured in the main menu. This applies the setting.
+					for (int f = 0; f < 3; ++f) {
+						if (k.internalEvent & ((1 << f) << 4))
+							_input.sustainedControllerFlagsRemapped |= (1 << _scdKeyConfigs[state.conf.controllerSetup][f]);
+					}
+					_input.sustainedControllerFlagsRemapped |= (k.internalEvent & ~0x70);
+				}
+
 				if (!(_lastKeys & k.internalEvent)) {
-					_input.controllerFlags |= k.internalEvent;
+					_input.singleFrameControllerFlags |= k.internalEvent;
 					// The A, B and C buttons can be reconfigured in the main menu. This applies the setting.
 					for (int f = 0; f < 3; ++f) {
-						if (k.internalEvent & (f << 5)) 
-							_input.controllerFlagsRemapped |= (1 << _scdKeyConfigs[state.conf.controllerSetup][f]);
+						if (k.internalEvent & ((1 << f) << 4))
+							_input.singleFrameControllerFlagsRemapped |= (1 << _scdKeyConfigs[state.conf.controllerSetup][f]);
 					}
-					_input.controllerFlagsRemapped |= (k.internalEvent & ~0x70);
+					_input.singleFrameControllerFlagsRemapped |= (k.internalEvent & ~0x70);
 					_lastKeys |= k.internalEvent;
 					if (_keyRepeat || k.releaseType == Common::EVENT_INVALID)
 						_releaseKeys |= k.internalEvent;
 					if (k.updateCoords) {
 						_realLightGunPos = evt.mouse;
+						// Revert aspect ratio correction, if necessary.
+						_realLightGunPos.x = (_realLightGunPos.x * _gfx->screenWidth()) / _gfx->realScreenWidth();
+						_realLightGunPos.y = (_realLightGunPos.y * _gfx->screenHeight()) / _gfx->realScreenHeight();
 						// The lightgun coordinates are supposed to be based on a 256 x 256 system, with 128 being
 						// the screen center. I solve this by always adding the diff to the y-bias.
 						_input.lightGunPos.x = CLIP<int>(_realLightGunPos.x - state.conf.lightGunBias.x, 0, 255);
 						_input.lightGunPos.y = CLIP<int>(_realLightGunPos.y - state.conf.lightGunBias.y, 0, 255);
 					}
 				}
+
 			} else if ((evt.type == k.releaseType) && (k.kc == Common::KEYCODE_INVALID || evt.kbd.keycode == k.kc) && (k.kFlag == 0 || (evt.kbd.flags & k.kFlag))) {
 				_lastKeys &= ~k.internalEvent;
+				if (k.kc != Common::KEYCODE_INVALID && k.releaseType != Common::EVENT_INVALID) {
+					_input.sustainedControllerFlags &= ~k.internalEvent;
+					for (int f = 0; f < 3; ++f) {
+						if (k.internalEvent & ((1 << f) << 4))
+							_input.sustainedControllerFlagsRemapped &= ~(1 << _scdKeyConfigs[state.conf.controllerSetup][f]);
+					}
+					_input.sustainedControllerFlagsRemapped &= ~(k.internalEvent & ~0x70);
+				}
 			}
 		}
 	}
 
-	if (_enableLightGun && _input.controllerFlags & 0x100)
+	if (_enableLightGun && _input.singleFrameControllerFlags & 0x100)
 		_gfx->setVar(7, 4);
 }
 
@@ -426,7 +454,7 @@ void SnatcherEngine::updateChapter(GameState &state) {
 		_cmdQueue->writeUInt16(0x11);
 		_cmdQueue->writeUInt32(0x1A800);
 		if (state.menuSelect == 0) {
-			// Enter first scene	
+			// Enter first scene
 			_cmdQueue->writeUInt16(0x3F);
 			_cmdQueue->writeUInt16(0x0F);
 		} else {
@@ -466,11 +494,11 @@ void SnatcherEngine::updateChapter(GameState &state) {
 				_cmdQueue->writeUInt32(0x139D0);
 				_cmdQueue->start();
 				state.chapterSub |= 0xA0;
-			}				
+			}
 			state.chapterSub &= ~0x40;
 		} else if (state.chapterSub & 0x20) {
 			_gfx->setVar(11, 0xFF);
-			if (!_ui->drawVerbs() || !_ui->verbsTabInputPrompt(_input.controllerFlagsRemapped)) {
+			if (!_ui->drawVerbs() || !_ui->verbsTabInputPrompt(_input.singleFrameControllerFlagsRemapped)) {
 				state.chapterSub |= 0x80;
 			} else {
 				_scriptEngine->processInput();
@@ -760,4 +788,9 @@ void SnatcherEngine::calibrateLightGun(GameState &state) {
 	state.conf.lightGunBias.y -= ((256 - _gfx->screenHeight()) / 2);
 }
 
+void SnatcherEngine::allowLightGunInput(bool enable) {
+	_enableLightGun = enable;
+	_system->showMouse(enable);
+}
+
 } // End of namespace Snatcher
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index 8b368dc79ae..3d124136008 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -31,6 +31,7 @@ class SnatcherMetaEngine;
 
 namespace Snatcher {
 
+class ActionSequenceHandler;
 class GraphicsEngine;
 class FIO;
 class MemAccessHandler;
@@ -99,6 +100,9 @@ private:
 	// Graphics
 	GraphicsEngine *_gfx;
 	VMInfo _gfxInfo;
+
+	// Interface
+	ActionSequenceHandler *_aseq;
 	UI *_ui;
 
 	// Sound
@@ -112,16 +116,18 @@ private:
 public:
 	// Input
 	struct Input {
-		Input() : controllerFlags(0), controllerFlagsRemapped(0), lightGunPos() {}
-		uint16 controllerFlags;
-		uint16 controllerFlagsRemapped;
+		Input() : singleFrameControllerFlags(0), sustainedControllerFlags(0), singleFrameControllerFlagsRemapped(0), sustainedControllerFlagsRemapped(0), lightGunPos() {}
+		uint16 singleFrameControllerFlags;
+		uint16 sustainedControllerFlags;
+		uint16 singleFrameControllerFlagsRemapped;
+		uint16 sustainedControllerFlagsRemapped;
 		Common::Point lightGunPos;
 	};
 
 	const Input &input() const { return _input; }
 	void calibrateLightGun(GameState &state);
 	void toggleKeyRepeat(bool enableRepeat) { _keyRepeat = enableRepeat; }
-	void allowLightGunInput(bool enable) { _enableLightGun = enable; }
+	void allowLightGunInput(bool enable);
 
 private:
 	uint16 _lastKeys;
@@ -129,7 +135,7 @@ private:
 	Common::Point _realLightGunPos;
 	bool _keyRepeat;
 	bool _enableLightGun;
-	
+
 	Input _input;
 };
 
diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
index d548ef5b6ab..50dc01489dd 100644
--- a/engines/snatcher/sound_device_scd.cpp
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -391,7 +391,7 @@ private:
 	};
 #else
 	typedef Common::Functor1Mem<const uint8*&, void, KonamiMCDSndChannel> ChanOpcode;
-#endif	
+#endif
 	Common::Array<Common::SharedPtr<ChanOpcode> > _opcodes;
 
 	static const uint8 _carrier[8];
@@ -514,7 +514,7 @@ void KonamiMCDSndChannel::initSound(const uint8 *data, const uint8 *dataEnd, uin
 		_flags |= 1;
 	}
 
-	_pbExtSpeed = _volSlideDuration = _panEffectRateCounter = _section2RepeatCounter = _section1RepeatCounter = _noteTimer = _eventDelay = _noteDuration = 
+	_pbExtSpeed = _volSlideDuration = _panEffectRateCounter = _section2RepeatCounter = _section1RepeatCounter = _noteTimer = _eventDelay = _noteDuration =
 		_lastNoteDuration = _regB4 = _lfoSensitivityDelay = _ampModSensitivityDelay = _pitchBendDuration = _vbrDepthModulationRate = _vbrDepth = _pitchBendSteps = _volTotal = 0;
 	_transposeMSB = 0;
 	_section1VolAdjust = _section2VolAdjust = _section1Transpose = _vbrDepthCur = _decayRate = _freqLast = 0;
@@ -782,7 +782,7 @@ void KonamiMCDSndChannel::runOpcode(uint8 opcode, const uint8 *&data) {
 
 void KonamiMCDSndChannel::addToMessage(uint8 cmd, const uint8 *&data) {
 	if (_id == 7)
-		_state.msg[1] |= (cmd << 3); 
+		_state.msg[1] |= (cmd << 3);
 	else
 		_state.msg[0] |= cmd;
 
@@ -868,7 +868,7 @@ void KonamiMCDSndChannel::applyVolumeSlide() {
 
 void KonamiMCDSndChannel::keyOff() {
 	if (blockedBySfx() || _id > 5)
- 		return;
+		return;
 	_sai->writeReg(0, 0x28, _id + (_id > 2 ? 1 : 0));
 }
 
@@ -1524,7 +1524,7 @@ void KonamiMCDAudioDriver::doCommand(int cmd, int arg) {
 		_comList[_comListWritePos++] = cmd;
 		if (_comListWritePos == sizeof(_comList))
 			_comListWritePos = 0;
-	}	
+	}
 }
 
 void KonamiMCDAudioDriver::setVolume(uint8 vol1, uint8 vol2) {
@@ -1611,7 +1611,7 @@ void KonamiMCDAudioDriver::nextTick() {
 		if (!(_state.flags & SndDriverState::kSndFadeoutDone)) {
 			_state.flags |= SndDriverState::kSndFadeoutDone;
 			stopChannels(1);
-		}			
+		}
 	} else {
 		_state.flags &= ~SndDriverState::kSndFadeoutDone;
 		if (!(_state.flags & SndDriverState::kSndBlockChannels)) {
@@ -1741,7 +1741,7 @@ const uint8 *KonamiMCDAudioDriver::getTrack(uint32 index) const {
 }
 
 SegaSoundDevice::SegaSoundDevice(FIO *fio) : _fio(fio), SoundDevice(), _sai(nullptr), _lastTrack(-1), _pauseStartTime(0), _pcmResourceInfo(nullptr), _pcmResidentDataInfo(nullptr), _pcmInstrumentInfo(nullptr),
-	_pcmSounds(nullptr), _pcmDisableStereo(false), _temp(nullptr), _pcmResourceNumber(-1), _pcmState(0), _pcmMode(0), _faderFlags(0), _faderTimer1(0), _faderTimer2(0), _reduceVolume2(false), 
+	_pcmSounds(nullptr), _pcmDisableStereo(false), _temp(nullptr), _pcmResourceNumber(-1), _pcmState(0), _pcmMode(0), _faderFlags(0), _faderTimer1(0), _faderTimer2(0), _reduceVolume2(false),
 		_fmVolume1(0xFF), _fmLastVolume1(0), _fmVolume2(0xFF), _fmLastVolume2(0), _fmCmdQueue(nullptr), _fmCmdQueueWPos(0), _fmCmdQueueRPos(0), _fmDriver(nullptr), _driverMsg()	{
 	_temp = new uint8[0x8000]();
 	assert(_temp);
@@ -1841,7 +1841,7 @@ void SegaSoundDevice::pcmSendCommand(int cmd, int arg) {
 	} else {
 		_pcmState |= 8;
 		pcmStartSound(cmd, arg);
-	}	
+	}
 }
 
 void SegaSoundDevice::pcmInitSound(int sndId) {
@@ -1869,7 +1869,7 @@ int16 SegaSoundDevice::pcmGetResourceId() const {
 	return _pcmResourceNumber;
 }
 
-void SegaSoundDevice::pause(bool toggle) {	
+void SegaSoundDevice::pause(bool toggle) {
 	if (toggle) {
 		if (_pauseStartTime == 0) {
 			if (cdaIsPlaying()) {
@@ -1953,7 +1953,7 @@ void SegaSoundDevice::fmUpdateVolumeFader() {
 		_faderTimer1 = 0;
 		if (_fmVolume1 >= 3)
 			_fmVolume1 -= 3;
-		
+
 	} else if (_faderFlags & 1) {
 		if (++_faderTimer2 != 2)
 			return;
diff --git a/engines/snatcher/transition_scd.cpp b/engines/snatcher/transition_scd.cpp
index be3c35d052b..ba9c966d090 100644
--- a/engines/snatcher/transition_scd.cpp
+++ b/engines/snatcher/transition_scd.cpp
@@ -244,7 +244,7 @@ void TransitionManager_SCD::doCommand(int cmd) {
 }
 
 void TransitionManager_SCD::clear() {
-	for (int i = 0; i < 4; ++i) 
+	for (int i = 0; i < 4; ++i)
 		_internalState[i].clear();
 	memset(&_result, 0, sizeof(_result));
 	_scrollType = 0;
@@ -285,7 +285,7 @@ bool TransitionManager_SCD::nextFrame() {
 			_trsFlagttt = 1;
 		} else if (_nextStepExt != 0) {
 			_lastStepExt = _nextStepExt;
-			resetVars(0x40);	
+			resetVars(0x40);
 		}
 	}
 
@@ -549,7 +549,7 @@ void TransitionManager_SCD::trsUpdt_skyParallaxScroll(int arg) {
 
 	uint16 f = _gfxState.frameCount();
 
-	if (!(f & 1)) {	
+	if (!(f & 1)) {
 		lineScrollTableDecr(0, 8);
 		_hScrollTableLen = 8;
 	}
diff --git a/engines/snatcher/ui.cpp b/engines/snatcher/ui.cpp
index 17f8ae49258..faab843ddc5 100644
--- a/engines/snatcher/ui.cpp
+++ b/engines/snatcher/ui.cpp
@@ -54,7 +54,7 @@ bool UI::displayDialog(int sceneInfo, int sceneTextOffset, uint16 inputFlags) {
 	if (_progress == -1)
 		_progress = 0;
 
-	if (/*_gfxOps_var1 || */(inputFlags & 0x100))
+	if (inputFlags & 0x100)
 		_gfx->setTextPrintDelay(0);
 
 	if (_gfx->isTextInQueue())
@@ -166,7 +166,7 @@ bool UI::drawVerbs() {
 	if (_progress2 == -1)
 		_progress2 = 0;
 
-	if (_verbsInterpreterMode == 2) 
+	if (_verbsInterpreterMode == 2)
 		_progress2 |= 0x80;
 
 	if (_progress2 == 0) {
@@ -550,7 +550,7 @@ void UI::printDialogStringBody() {
 			i = 49;
 			break;;
 		case 0xF4:
-			_sceneInfo = 2;
+			_sceneInfo = (_sceneInfo & 0xFF) | 0x200;
 			break;
 		case 0xF2:
 			_textLineBreak = 1;
diff --git a/engines/snatcher/ui.h b/engines/snatcher/ui.h
index 55a52f218a9..0d437bcdfb2 100644
--- a/engines/snatcher/ui.h
+++ b/engines/snatcher/ui.h
@@ -60,7 +60,7 @@ public:
 
 	void loadState(Common::SeekableReadStream *in);
 	void saveState(Common::SeekableWriteStream *out);
-	
+
 private:
 	void printDialogStringHead();
 	void printDialogStringBody();
@@ -128,7 +128,7 @@ private:
 	uint8 _vkeybColumnWidth;
 	uint8 _verbsTabOffsX;
 	uint8 _verbsTabOffsY;
-	
+
 	int8 _lastHiliteVerb;
 	int8 _hiliteVerb;
 	uint8 _lastVerbDrawn;
diff --git a/engines/snatcher/util.cpp b/engines/snatcher/util.cpp
index 95ef34eb6c6..f191254bff7 100644
--- a/engines/snatcher/util.cpp
+++ b/engines/snatcher/util.cpp
@@ -42,7 +42,7 @@ uint32 decodeSCDData(const uint8 *src, uint8 *dst) {
 			bits = 7;
 		}
 
-		op = code & 1; 
+		op = code & 1;
 		code >>= 1;
 
 		if (op == 0) {


Commit: 5631e047eb1cd0495ecd5cd53e5cefe1f31787a8
    https://github.com/scummvm/scummvm/commit/5631e047eb1cd0495ecd5cd53e5cefe1f31787a8
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
GRAPHICS: (Sega Renderer) - fix prio sprite rendering

The Sega VDP doc is a bit unclear about this aspect of how sprites
priority works. This patch fixes a Snatcher glitch for which I had
compared emulator video memory content with our own, finding
absolutely no difference, so it had to be something with the prio
rendering. Apparently, this is the correct interpretation of the doc...

Changed paths:
    graphics/segagfx.cpp
    graphics/segagfx.h


diff --git a/graphics/segagfx.cpp b/graphics/segagfx.cpp
index b5716768ed4..5a59a12cc5a 100644
--- a/graphics/segagfx.cpp
+++ b/graphics/segagfx.cpp
@@ -28,10 +28,9 @@
 namespace Graphics {
 
 SegaRenderer::SegaRenderer(const PixelFormat *systemPixelFormat) : _pixelFormat(systemPixelFormat ? *systemPixelFormat : PixelFormat::createFormatCLUT8()),	_pitch(64), _hScrollMode(0),
-	_hScrollTable(0), _vScrollMode(0), _spriteTable(0), _numSpritesMax(0), _spriteMask(0), _spriteMaskPrio(0), _backgroundColor(0), _planes{SegaPlane(), SegaPlane(), SegaPlane()},
-	_vram(nullptr), _vsram(nullptr), _tempBufferSprites(nullptr), _tempBufferSpritesPrio(nullptr), _tempBufferPlanes(nullptr), _tempBufferPlanesPrio(nullptr), _renderColorTable(nullptr),
-	_rr(kUnspecified), _renderLineFragmentD(0), _renderLineFragmentM(0), _hINTEnable(false), _hINTCounter(0), _hINTCounterNext(0), _hINTHandler(nullptr), _destPitch(0), _displayEnabled(true),
-	_realW(0), _realH(0)
+	_hScrollTable(0), _vScrollMode(0), _spriteTable(0), _numSpritesMax(0), _spriteMask(0), _backgroundColor(0), _planes{SegaPlane(), SegaPlane(), SegaPlane()}, _vram(nullptr), _vsram(nullptr),
+	_tempBufferSprites(nullptr), _tempBufferSpritesPrio(nullptr), _tempBufferPlanes(nullptr), _tempBufferPlanesPrio(nullptr), _renderColorTable(nullptr), _rr(kUnspecified),
+	_renderLineFragmentD(0), _renderLineFragmentM(0), _hINTEnable(false), _hINTCounter(0), _hINTCounterNext(0), _hINTHandler(nullptr), _destPitch(0), _displayEnabled(true), _realW(0), _realH(0)
 #if(BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
 	, _arcIncX(0), _arcCntX(0), _arcIncY(0), _arcCntY(0), _xyAspectRatio(1.0), _scaleFactor(1.0)
 #endif
@@ -81,7 +80,6 @@ SegaRenderer::~SegaRenderer() {
 	delete[] _vram;
 	delete[] _vsram;
 	delete[] _spriteMask;
-	delete[] _spriteMaskPrio;
 	delete[] _tempBufferSprites;
 	delete[] _tempBufferSpritesPrio;
 	delete[] _tempBufferPlanes;
@@ -104,7 +102,6 @@ void SegaRenderer::setResolution(int w, int h) {
 	delete[] _tempBufferPlanes;
 	delete[] _tempBufferPlanesPrio;
 	delete[] _spriteMask;
-	delete[] _spriteMaskPrio;
 
 	if (_pixelFormat.bytesPerPixel > 1) {
 		_tempBufferPlanes = new uint8[_screenW * _screenH]();
@@ -118,8 +115,6 @@ void SegaRenderer::setResolution(int w, int h) {
 	assert(_tempBufferPlanesPrio);
 	_spriteMask = new uint8[_screenW * _screenH]();
 	assert(_spriteMask);
-	_spriteMaskPrio = new uint8[_screenW * _screenH]();
-	assert(_spriteMaskPrio);
 #if(!BUILD_SEGAGFX_ASPECT_RATIO_CORRECTION_SUPPORT)
 	_realW = _screenW;
 	_realH = _screenH;
@@ -410,7 +405,6 @@ void SegaRenderer::renderSprites(uint8 *dst, uint8 *dstPrio, int clipX, int clip
 		clipH = _screenH;
 
 	memset(_spriteMask, 0xFF, _screenW * _screenH);
-	memset(_spriteMaskPrio, 0xFF, _screenW * _screenH);
 	const uint16 *pos = _spriteTable;
 
 	int clipX2 = clipX + clipW;
@@ -437,7 +431,7 @@ void SegaRenderer::renderSprites(uint8 *dst, uint8 *dstPrio, int clipX, int clip
 		y = (y & 0x1FF) - 128;
 
 		uint8 *d = (dstPrio != nullptr && prio ? dstPrio : dst) + y * _screenW + x;
-		uint8 *msk = (dstPrio != nullptr && prio ? _spriteMaskPrio : _spriteMask) + y * _screenW + x;
+		uint8 *msk = _spriteMask + y * _screenW + x;
 
 		if (spriteMasking) {
 			int mH = MIN<int>(bH << 3, _screenH - y);
diff --git a/graphics/segagfx.h b/graphics/segagfx.h
index 8cee612cbc3..386bb349f10 100644
--- a/graphics/segagfx.h
+++ b/graphics/segagfx.h
@@ -43,6 +43,11 @@ struct Surface;
  * This has to be kept in mind when writing the palette code for your engine. Also, there is no parsing of control
  * register opcodes to set up plane dimensions, table locations etc., since I didn't see any need for that. This has
  * to be done through the public setup methods of the renderer.
+ *
+ * Things that are currently not emulated:
+ * - The sprites-per-scanline limit (since I never saw a situation that would require it)
+ * - The sprite-masking implementation is not fully correct. I started to implement it, when I thought that I needed
+ *   it, but stopped fine-tuning it, when I realized that it actually wouldn't be used anywhere.
  */
 class SegaRenderer {
 public:
@@ -305,7 +310,7 @@ private:
 	uint16 *_hScrollTable;
 	uint16 *_spriteTable;
 	uint8 *_spriteMask;
-	uint8 *_spriteMaskPrio;
+	//uint8 *_spriteMaskPrio;
 	uint8 _hScrollMode;
 	uint8 _vScrollMode;
 	uint16 _numSpritesMax;


Commit: 273446a3b42ccbad5860390ec99ca27511bdde8d
    https://github.com/scummvm/scummvm/commit/273446a3b42ccbad5860390ec99ca27511bdde8d
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: various fixes

(videophone and other gfx glitches,
lightgun emulation via mouse, etc.)

Changed paths:
    engines/snatcher/action.cpp
    engines/snatcher/animator.h
    engines/snatcher/animator_scd.cpp
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/memory.cpp
    engines/snatcher/memory.h
    engines/snatcher/palette_scd.cpp
    engines/snatcher/saveload.cpp
    engines/snatcher/saveload.h
    engines/snatcher/scene/scene_d2.cpp
    engines/snatcher/script.cpp
    engines/snatcher/script.h
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/state.h
    engines/snatcher/text_scd.cpp
    engines/snatcher/transition_scd.cpp
    engines/snatcher/ui.cpp
    engines/snatcher/ui.h


diff --git a/engines/snatcher/action.cpp b/engines/snatcher/action.cpp
index e875901bd86..0639c1cd1f1 100644
--- a/engines/snatcher/action.cpp
+++ b/engines/snatcher/action.cpp
@@ -415,6 +415,12 @@ void ActionSequenceHandler::handleWeaponDrawAndTargetSelection() {
 
 void ActionSequenceHandler::handleShot() {
 	if (_useLightGun) {
+		// Weirdly, during the calibration they substract an offset, but not here. When testing with an emulator,
+		// the aiming is not satisfactory either, so I guess this is either an original bug or it really does
+		// behave differently with a real light gun (y-coords aren't that eays to get there, depending on the
+		// TV, the distance from the TV etc.).
+		const int16 yOffs = -24;
+
 		int16 v = animGet(21, F2c);
 		if (v && ++v >= 2) {
 			v = 0;
@@ -423,9 +429,9 @@ void ActionSequenceHandler::handleShot() {
 				_targetField = 2;
 			else if (_vm->input().lightGunPos.x >= 96)
 				_targetField = 1;
-			if (_vm->input().lightGunPos.y >= 88)
+			if (_vm->input().lightGunPos.y + yOffs >= 88)
 				_targetField += 6;
-			else if (_vm->input().lightGunPos.x >= 48)
+			else if (_vm->input().lightGunPos.y + yOffs>= 48)
 				_targetField += 3;
 		}
 		animSet(21, F2c, v);
diff --git a/engines/snatcher/animator.h b/engines/snatcher/animator.h
index 5889a34e796..3653fef876f 100644
--- a/engines/snatcher/animator.h
+++ b/engines/snatcher/animator.h
@@ -42,7 +42,7 @@ public:
 	virtual void setPlaneMode(uint16 mode) = 0;
 
 	virtual void resetTextFields() = 0;
-	virtual void clearJordanInputField() = 0;
+	virtual void clearTextInputLine() = 0;
 	virtual uint8 *getTextRenderBuffer() const = 0;
 	virtual void renderTextBuffer(uint16 firstLine, uint8 numLines) = 0;
 
diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index 3036dac6cc1..6676815c9b7 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -20,10 +20,6 @@
 */
 
 
-#include "common/debug.h"
-#include "common/endian.h"
-#include "graphics/pixelformat.h"
-#include "graphics/segagfx.h"
 #include "snatcher/graphics.h"
 #include "snatcher/palette.h"
 #include "snatcher/animator.h"
@@ -33,6 +29,11 @@
 #include "snatcher/transition.h"
 #include "snatcher/util.h"
 #include "common/system.h"
+#include "common/debug.h"
+#include "common/endian.h"
+#include "graphics/cursorman.h"
+#include "graphics/pixelformat.h"
+#include "graphics/segagfx.h"
 
 namespace Snatcher {
 
@@ -64,7 +65,6 @@ struct AnimObject {
 		parent = children = next = 0;
 		scriptComFlags = freeze = 0;
 		blink = blinkCounter = blinkDuration = 0;
-
 	}
 
 	uint16 enable;
@@ -120,7 +120,7 @@ public:
 	void setPlaneMode(uint16 mode) override;
 
 	void resetTextFields() override;
-	void clearJordanInputField() override;
+	void clearTextInputLine() override;
 	uint8 *getTextRenderBuffer() const override;
 	void renderTextBuffer(uint16 firstLine, uint8 numLines) override;
 
@@ -199,9 +199,9 @@ private:
 	public:
 		typedef int (Animator_SCD::*AnimFunc)(AnimObject&, const uint8*);
 		GfxAnimFunc(Animator_SCD *gfx, AnimFunc func, const char *desc) : Common::Functor2Mem<AnimObject &, const uint8*, int, Animator_SCD>(gfx, func), _desc(Common::String("anim_") + desc) {}
-		int operator()(AnimObject &len, const uint8 *data) {
-			debug("%s():   anim: %02d,   data: [%02x %02x %02x]", _desc.c_str(), len.id, data[0], data[1], data[2]);
-			return Functor2Mem<AnimObject &, const uint8*, int, Animator_SCD>::operator()(len, data);
+		int operator()(AnimObject &a, const uint8 *data) {
+			debug("%s():   anim: %02d,   data: [%02x %02x %02x]", _desc.c_str(), a.id, data[0], data[1], data[2]);
+			return Functor2Mem<AnimObject &, const uint8*, int, Animator_SCD>::operator()(a, data);
 		}
 	private:
 		Common::String _desc;
@@ -349,8 +349,8 @@ void Animator_SCD::initAnimations(ResourcePointer &res, uint16 len, bool dontUpd
 	while (in < next) {
 		assert(in[0] < 64);
 		AnimObject *a = _animations[*in++];
-		//if (a->enable && dontUpdate)
-		//	return;
+		if ((a->enable & 0xF0) && dontUpdate)
+			return;
 		a->clear();
 		a->enable = 1;
 		a->res = res;
@@ -404,6 +404,7 @@ void Animator_SCD::clearAnimations(int mode) {
 			_animations[i]->clear();
 	}
 }
+
 void Animator_SCD::setPlaneMode(uint16 mode) {
 	assert(mode >> 8 == 0);
 	_modeChange = mode & 0xFF;;
@@ -425,7 +426,7 @@ void Animator_SCD::resetTextFields() {
 	_sr->loadToVRAM(s, 32, 0x1FE0);
 }
 
-void Animator_SCD::clearJordanInputField() {
+void Animator_SCD::clearTextInputLine() {
 	// Clear the text line on the JORDAN monitor display
 	memset(_tempBuffer + 0x6C00, 0, 0x320);
 }
@@ -478,8 +479,6 @@ void Animator_SCD::updateAnimations() {
 		int16 dropFrames = _gfxState.getDropFrames();
 		if ((s->f1c || s->allowFrameDrop) && _gfxState.getVar(10))
 			continue;
-		if (dropFrames)
-			debug("%s(): Dropping %d frames for anim %d", __FUNCTION__, dropFrames, s->id);
 		do {
 			if (!s->enable)
 				break;
@@ -1439,22 +1438,40 @@ void Animator_SCD::anim_setGroupParameter(AnimObject &a, int para, int16 val, bo
 }
 
 void Animator_SCD::createMouseCursor() {
-	// This will obviously only work when the necessary animation has been loaded.
-	//anim_setControlFlags(16, GraphicsEngine::kAnimPause);
-	//anim_setFrame(16, 0);
-
-	/*memset(_tempBuffer, 0, 0x10000);
-	updateAnimations();
-	drawAnimSprites();
-	_sr->renderSprites(_tempBuffer, nullptr);
-	//anim_setControlFlags(16, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
+	static const uint8 mouseCursorData[] = {
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
+		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+		0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+	};
 
-	for (int i = 1; i < 24; ++i)
-		memcpy(_tempBuffer + i * 24, _tempBuffer + i * _screenWidth, 24);
+	static const uint8 palData[] = { 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF };
 
-	g_system->setMouseCursor(_tempBuffer, 24, 24, 12, 12, 4);
-	g_system->setCursorPalette(_pal->getSystemPalette(), 0, 64);
-	g_system->showMouse(true);*/
+	CursorMan.replaceCursorPalette(palData, 254, 2);
+	CursorMan.replaceCursor(mouseCursorData, 27, 27, 13, 13, 0);
 }
 
 // Boot logo sequence code. This has nothing to do with the engine graphics code, so I put it at the end, to keep the ugly mess out of sight...
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 9ecab95f60c..6994986d53b 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -152,8 +152,8 @@ void GraphicsEngine::resetTextFields() {
 	_text->reset();
 }
 
-void GraphicsEngine::clearJordanInputField() {
-	_animator->clearJordanInputField();
+void GraphicsEngine::clearTextInputLine() {
+	_animator->clearTextInputLine();
 }
 
 uint8 GraphicsEngine::getVerbAreaType() const {
@@ -321,7 +321,7 @@ void GraphicsEngine::postLoadProcess() {
 	}
 }
 
-void GraphicsEngine::createMouseCursor(bool show) {
+void GraphicsEngine::createMouseCursor() {
 	_animator->createMouseCursor();
 }
 
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 8a526a7637a..c6d48a8fafb 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -73,7 +73,7 @@ public:
 	void setTextPrintDelay(uint16 delay);
 	bool isTextInQueue() const;
 	void resetTextFields();
-	void clearJordanInputField();
+	void clearTextInputLine();
 	uint8 getVerbAreaType() const;
 	bool isVerbsTabActive() const;
 
@@ -153,7 +153,7 @@ public:
 	void saveState(Common::SeekableWriteStream *out);
 	void postLoadProcess();
 
-	void createMouseCursor(bool show);
+	void createMouseCursor();
 
 	int displayBootLogoFrame(int frameNo);
 
diff --git a/engines/snatcher/memory.cpp b/engines/snatcher/memory.cpp
index 2f9881c4a8f..088aaf831f6 100644
--- a/engines/snatcher/memory.cpp
+++ b/engines/snatcher/memory.cpp
@@ -56,7 +56,7 @@ uint16 MemAccessHandler::readWord(uint16 addr) {
 		result = _aseq->getResult().weaponDrawn;
 		break;
 	case 0x7972:
-		result = /*_state->conf.useLightGun ? 1 :*/ 0;
+		result = _state->conf.useLightGun ? 1 : 0;
 		break;
 	case 0x79E0:
 		// BURAM status
@@ -83,11 +83,19 @@ void MemAccessHandler::writeWord(uint16 addr, uint16 val) {
 	switch (addr) {
 	case 0x79F0:
 		break;
-	case 0x971a:
+	case 0x9718:
+		_ui->setInputStringLength(val);
+		break;
+	case 0x971A:
 		_ui->setInterpreterMode(val);
+	case 0x971C:
+		_ui->setHeadLineYOffset(val);
+		break;
+	case 0x971E:
+		_ui->setVideoPhoneMode(val);
 		break;
 	case 0xFFFF:
-		// This is an exception that is caught even in the original code.
+		// The 0xFFFF "address" is an exception that is also handled separately in the original code.
 		_vm->sound()->reduceVolume2(val);
 		break;
 	default:
@@ -99,4 +107,12 @@ void MemAccessHandler::setGameState(GameState *state) {
 	_state = state;
 }
 
+void MemAccessHandler::saveTempState() {
+	_saveMan->saveTempState(_state->script);
+}
+
+void MemAccessHandler::restoreTempState() {
+	_saveMan->restoreTempState(_state->script);
+}
+
 } // End of namespace Snatcher
diff --git a/engines/snatcher/memory.h b/engines/snatcher/memory.h
index e301ffa90c3..83b8fa5bd4c 100644
--- a/engines/snatcher/memory.h
+++ b/engines/snatcher/memory.h
@@ -35,7 +35,9 @@ struct GameState;
 
 // The script engine has opcodes that allow reading and writing into memory, at least for 16-bit addresses.
 // We could just create a 64K buffer and let that happen, but eventually we would have to route the values
-// to the affected parts of the engine, anyway.
+// to the affected parts of the engine, anyway. For now, my impression is that the memory writes are mostly
+// used to configure the verb interface while the reads are mostly for evaluation of the action sequeunce
+// results and also for querying the savegame environment.
 
 class MemAccessHandler {
 public:
@@ -47,6 +49,9 @@ public:
 
 	void setGameState(GameState *state);
 
+	void saveTempState();
+	void restoreTempState();
+
 private:
 	SnatcherEngine *_vm;
 	UI *_ui;
diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index a14d1cdcf81..cb913b9a717 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -91,7 +91,7 @@ private:
 	void setHINTHandler(uint8 num);
 
 	void hIntHandler_characterChatPortraitPalette(Graphics::SegaRenderer *sr);
-	void hIntHandler_23(Graphics::SegaRenderer *sr);
+	void hIntHandler_28(Graphics::SegaRenderer *sr);
 	int _transitionStep;
 };
 
@@ -112,9 +112,8 @@ SCDPalette::SCDPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, Gra
 	P_OP(palClear);
 #undef P_OP
 
-	_hINTProcs.resize(24);
-	_hINTProcs[0] = new HINTFunc(this, &SCDPalette::hIntHandler_characterChatPortraitPalette);
-	_hINTProcs[23] = new HINTFunc(this, &SCDPalette::hIntHandler_23);
+	_hINTProcs.push_back(new HINTFunc(this, &SCDPalette::hIntHandler_characterChatPortraitPalette));
+	_hINTProcs.push_back(new HINTFunc(this, &SCDPalette::hIntHandler_28));
 
 	_eventQueue = _eventCurPos = new PalEventSCD[12];
 	_colors = new uint16[128]();
@@ -510,7 +509,7 @@ void SCDPalette::hIntHandler_characterChatPortraitPalette(Graphics::SegaRenderer
 	sr->hINT_enable(false);
 }
 
-void SCDPalette::hIntHandler_23(Graphics::SegaRenderer *sr) {
+void SCDPalette::hIntHandler_28(Graphics::SegaRenderer *sr) {
 
 }
 
diff --git a/engines/snatcher/saveload.cpp b/engines/snatcher/saveload.cpp
index 8901fdad3fd..550184d8004 100644
--- a/engines/snatcher/saveload.cpp
+++ b/engines/snatcher/saveload.cpp
@@ -25,8 +25,10 @@
 #include "snatcher/script.h"
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
+#include "snatcher/ui.h"
 #include "common/algorithm.h"
 #include "common/config-manager.h"
+#include "common/memstream.h"
 #include "common/savefile.h"
 #include "engines/engine.h"
 #include "graphics/scaler.h"
@@ -74,7 +76,7 @@ void SaveLoadManager::saveSettings(const Config &config) {
 	ConfMan.setInt("lightgun_biasY", config.lightGunBias.y);
 }
 
-void SaveLoadManager::updateSaveSlotsState(GameState &state) {
+void SaveLoadManager::updateSaveSlotsStatus(GameState &state) {
 	state.saveSlotUsage = 0;
 	for (int i = 0; i < 4; ++i) {
 		if (isSaveSlotUsed(i + 1)) // Skip autosave slot 0
@@ -120,6 +122,22 @@ void SaveLoadManager::enableSaving(bool enable) {
 	_enableSaving = enable;
 }
 
+void SaveLoadManager::saveTempState(Script &script) {
+	Common::MemoryWriteStreamDynamic out(DisposeAfterUse::NO);
+	_vm->_scriptEngine->saveState(&out, script, true);
+	_vm->gfx()->saveState(&out);
+	_vm->sound()->saveState(&out);
+	_vm->_ui->saveState(&out);
+	_tempState = Common::SharedPtr<Common::MemoryReadStream>(new Common::MemoryReadStream(out.getData(), out.size(), DisposeAfterUse::YES));
+}
+
+void SaveLoadManager::restoreTempState(Script &script) {
+	_vm->_scriptEngine->loadState(_tempState.get(), script, true);
+	_vm->gfx()->loadState(_tempState.get());
+	_vm->sound()->loadState(_tempState.get());
+	_vm->_ui->loadState(_tempState.get());
+}
+
 Common::String SaveLoadManager::getSavegameFilename(int slot, const Common::String target) {
 	assert(slot >= 0 && slot <= 999);
 	return target + Common::String::format(".%03d", slot);
@@ -162,8 +180,8 @@ void SaveLoadManager::loadState(int slot, GameState &state) {
 	_vm->_keyRepeat = in->readByte();
 	_vm->_enableLightGun = in->readByte();
 
-	state.chapter = in->readSint16BE();
-	state.chapterSub = in->readSint16BE();
+	state.phase = in->readSint16BE();
+	state.phaseFlags = in->readSint16BE();
 	state.counter = in->readSint16BE();
 	state.finish = in->readSint16BE();
 	state.frameNo = in->readSint16BE();
@@ -174,10 +192,11 @@ void SaveLoadManager::loadState(int slot, GameState &state) {
 	state.modProcessTop = in->readSint16BE();
 	state.prologue = in->readSint16BE();
 
-	_vm->_scriptEngine->loadState(in, state.script);
+	_vm->_scriptEngine->loadState(in, state.script, false);
 	_vm->_cmdQueue->loadState(in);
 	_vm->gfx()->loadState(in);
 	_vm->sound()->loadState(in);
+	_vm->_ui->loadState(in);
 
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
@@ -185,8 +204,8 @@ void SaveLoadManager::loadState(int slot, GameState &state) {
 	delete in;
 
 	if (state.prologue == -1) {
-		state.chapter = 0;
-		state.chapterSub = 0;
+		state.phase = 0;
+		state.phaseFlags = 0;
 		state.menuSelect = 1;
 	}
 }
@@ -197,8 +216,8 @@ void SaveLoadManager::saveState(int slot, GameState &state) {
 	out->writeByte(_vm->_keyRepeat);
 	out->writeByte(_vm->_enableLightGun);
 
-	out->writeSint16BE(state.chapter);
-	out->writeSint16BE(state.chapterSub);
+	out->writeSint16BE(state.phase);
+	out->writeSint16BE(state.phaseFlags);
 	out->writeSint16BE(state.counter);
 	out->writeSint16BE(state.finish);
 	out->writeSint16BE(state.frameNo);
@@ -209,17 +228,18 @@ void SaveLoadManager::saveState(int slot, GameState &state) {
 	out->writeSint16BE(state.modProcessTop);
 	out->writeSint16BE(state.prologue);
 
-	_vm->_scriptEngine->saveState(out, state.script);
+	_vm->_scriptEngine->saveState(out, state.script, false);
 	_vm->_cmdQueue->saveState(out);
 	_vm->gfx()->saveState(out);
 	_vm->sound()->saveState(out);
+	_vm->_ui->saveState(out);
 
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
 
 	out->finalize();
 	delete out;
 
-	updateSaveSlotsState(state);
+	updateSaveSlotsStatus(state);
 }
 
 Common::SeekableReadStream *SaveLoadManager::openFileForLoading(int slot, GameState &state, SaveHeader &header) {
diff --git a/engines/snatcher/saveload.h b/engines/snatcher/saveload.h
index 9a884541e36..547f1651ab4 100644
--- a/engines/snatcher/saveload.h
+++ b/engines/snatcher/saveload.h
@@ -24,7 +24,7 @@
 #define SNATCHER_SAVELOAD_H
 
 #include "common/ptr.h"
-#include "common/str.h"
+#include "common/memstream.h"
 #include "common/system.h"
 #include "snatcher/state.h"
 
@@ -47,7 +47,7 @@ public:
 
 	void loadSettings(Config &config);
 	void saveSettings(const Config &config);
-	void updateSaveSlotsState(GameState &state);
+	void updateSaveSlotsStatus(GameState &state);
 
 	void requestLoad(int slot);
 	void requestSave(int slot, const Common::String &desc);
@@ -58,6 +58,9 @@ public:
 	bool isSavingEnabled() const;
 	void enableSaving(bool enable);
 
+	void saveTempState(Script &script);
+	void restoreTempState(Script &script);
+
 public:
 	struct SaveHeader {
 		SaveHeader() : version(0), lang(0), platform(0), desc(), thumbnail(), totalPlayTime(0), saveCount(0) {
@@ -88,6 +91,8 @@ private:
 	int _pendingSaveLoad;
 	bool _tryLoadFromLauncher;
 	bool _enableSaving;
+
+	Common::SharedPtr<Common::MemoryReadStream> _tempState;
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene/scene_d2.cpp
index 7fd91f91205..ff9270bad58 100644
--- a/engines/snatcher/scene/scene_d2.cpp
+++ b/engines/snatcher/scene/scene_d2.cpp
@@ -427,7 +427,6 @@ SH_IMPL_FRM(D2, 11) {
 			return;
 		_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 		_vm->gfx()->runScript(_module->getGfxData(), 7);
-		_vm->gfx()->createMouseCursor(true);
 		++state.frameState;
 		break;
 	case 2:
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index 03db40cdc80..a70daf634bc 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -131,7 +131,7 @@ void CmdQueue::makeFunctions() {
 		OP(gfxPostLoadProcess),
 		OP(33),
 		OP(palOps),
-		OP(clearJordanInputField)
+		OP(clearTextInputLine)
 	};
 #undef OP
 
@@ -398,7 +398,7 @@ void CmdQueue::m_23(const uint16 *&data) {
 }
 
 void CmdQueue::m_shooterSequenceRun(const uint16 *&data) {
-	if (!_vm->_aseq->run(/*_state->conf.useLightGun*/0))
+	if (!_vm->_aseq->run(_state->conf.useLightGun))
 		_progress = -1;
 }
 
@@ -457,8 +457,8 @@ void CmdQueue::m_palOps(const uint16 *&data) {
 	_progress = -1;
 }
 
-void CmdQueue::m_clearJordanInputField(const uint16 *&data) {
-	_vm->gfx()->clearJordanInputField();
+void CmdQueue::m_clearTextInputLine(const uint16 *&data) {
+	_vm->gfx()->clearTextInputLine();
 	_progress = -1;
 }
 
@@ -540,43 +540,54 @@ void ScriptEngine::processInput() {
 	ARR_POS(1) = 0;
 }
 
-void ScriptEngine::loadState(Common::SeekableReadStream *in, Script &script) {
+void ScriptEngine::loadState(Common::SeekableReadStream *in, Script &script, bool onlyTempData) {
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
 
-	uint16 *d = reinterpret_cast<uint16*>(_arrayData);
-	for (int i = 0; i < 128; ++i)
-		d[i] = in->readUint16BE();
-	in->read(_flagsTable, 352);
+	if (!onlyTempData) {
+		uint16 *d = reinterpret_cast<uint16*>(_arrayData);
+		for (int i = 0; i < 128; ++i)
+			d[i] = in->readUint16BE();
+		in->read(_flagsTable, 352);
+
+		script.sentenceDone = in->readByte();
+		script.sentencePos = in->readByte();
+	}
 
-	script.sentenceDone = in->readByte();
-	script.sentencePos = in->readByte();
 	script.curFileNo = in->readByte();
 	script.curGfxScript = in->readSint16BE();
-	script.curPos = in->readUint16BE();
 
-	ARR_POS(0) = 0;
-	ARR_POS(1) = 0;
-	ARR_POS(2) = 0;
-	ARR_POS(3) = 0;
-	ARR_POS(5) = 0;
+	if (!onlyTempData) {
+		script.curPos = in->readUint16BE();
+		ARR_POS(0) = 0;
+		ARR_POS(1) = 0;
+		ARR_POS(2) = 0;
+		ARR_POS(3) = 0;
+		ARR_POS(5) = 0;
+	}
 }
 
-void ScriptEngine::saveState(Common::SeekableWriteStream *out, Script &script) {
+void ScriptEngine::saveState(Common::SeekableWriteStream *out, Script &script, bool onlyTempData) {
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
 
-	const uint16 *s = reinterpret_cast<const uint16*>(_arrayData);
-	for (int i = 0; i < 128; ++i)
-		out->writeUint16BE(s[i]);
-	out->write(_flagsTable, 352);
+	if (!onlyTempData) {
+		const uint16 *s = reinterpret_cast<const uint16*>(_arrayData);
+		for (int i = 0; i < 128; ++i)
+			out->writeUint16BE(s[i]);
+		out->write(_flagsTable, 352);
+
+		out->writeByte(script.sentenceDone);
+		out->writeByte(script.sentencePos);
+	}
 
-	out->writeByte(script.sentenceDone);
-	out->writeByte(script.sentencePos);
 	out->writeByte(script.curFileNo);
 	out->writeSint16BE(script.curGfxScript);
-	uint16 pos = script.curPos;
-	getArrayEntry(5, 0, pos);
-	out->writeUint16BE(pos);
+
+	if (!onlyTempData) {
+		uint16 pos = script.curPos;
+		getArrayEntry(5, 0, pos);
+		out->writeUint16BE(pos);
+	}
 }
 
 void ScriptEngine::runOpcode() {
@@ -866,7 +877,7 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 		OP(setFlags),
 		OP(21),
 		OP(eval_less),
-		OP(eval_lessOrSame),
+		OP(eval_lessOrEqual),
 		OP(do_either_or),
 		OP(do_either_or),
 		OP(do_if),
@@ -883,9 +894,9 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 		OP(executeFunction),
 		OP(executeFunction),
 		OP(executeFunction),
-		OP(40),
-		OP(40),
-		OP(42),
+		OP(eval_greater),
+		OP(eval_greater),
+		OP(eval_greaterOrEqual),
 		OP(break),
 		OP(break),
 		OP(nop),
@@ -1104,7 +1115,7 @@ void ScriptEngine::o_eval_less() {
 	_result = (_result < r1) ? 0xFFFF : 0;
 }
 
-void ScriptEngine::o_eval_lessOrSame() {
+void ScriptEngine::o_eval_lessOrEqual() {
 	uint16 m1 = 0;
 	uint16 m2 = 0;
 	uint16 r1 = 0;
@@ -1175,13 +1186,33 @@ void ScriptEngine::o_executeFunction() {
 	}
 }
 
-void ScriptEngine::o_40() {
+void ScriptEngine::o_eval_greater() {
+	uint16 m1 = 0;
+	uint16 m2 = 0;
+	uint16 f2 = 0;
 
+	_pos2 = _pos1++;
+	getOpcodeProperties(m1, m2, f2);
+	runOpcodeOrReadVar(m1, _result);
+	f2 = _result;
+	_pos1 = _pos2;
+	runOpcodeOrReadVar(m2, _result);
+	_result = (_result > f2) ? 0xFFFF : 0;
 }
 
-void ScriptEngine::o_42() {
-}
+void ScriptEngine::o_eval_greaterOrEqual() {
+	uint16 m1 = 0;
+	uint16 m2 = 0;
+	uint16 f2 = 0;
 
+	_pos2 = _pos1++;
+	getOpcodeProperties(m1, m2, f2);
+	runOpcodeOrReadVar(m1, _result);
+	f2 = _result;
+	_pos1 = _pos2;
+	runOpcodeOrReadVar(m2, _result);
+	_result = (_result >= f2) ? 0xFFFF : 0;
+}
 void ScriptEngine::o_break() {
 	if (!evalFinished())
 		return;
@@ -1335,8 +1366,7 @@ void ScriptEngine::o_59() {
 				_result = 1;
 		}
 	} else if (val != 0) {
-		uint8 e = -(val - ARR_POS(5));
-		if (!getArrayEntry(5, e, _result))
+		if (!getArrayEntry(5, ARR_POS(5) - val, _result))
 			_result = 0xFFFF;
 	} else {
 		_result = _script->curPos;
@@ -1460,7 +1490,7 @@ void ScriptEngine::o_sysOps() {
 		}
 		break;
 	case 9:
-		_script->chapter = READ_BE_UINT16(_script->data + _pos1 + 4) + 2;
+		_script->phase = READ_BE_UINT16(_script->data + _pos1 + 4) + 2;
 		break;
 	case 10:
 		val = READ_BE_UINT16(_script->data + _pos1 + 4);
@@ -1469,11 +1499,12 @@ void ScriptEngine::o_sysOps() {
 			_transDW1 = _transDW2 = 0;*/
 		break;
 	case 11:
-		/*if (READ_BE_UINT16(_script->data + _pos1 + 4))
-			restoreGfxAndSoundAfterLoad();
-		else
-			animSpecOther();
-			*/
+		if (READ_BE_UINT16(_script->data + _pos1 + 4)) {
+			_mem->restoreTempState();
+			_script->phase = 1;
+		} else {
+			_mem->saveTempState();
+		}
 		break;
 	case 12:
 		_flagsTable[53] &= 0xF8;
diff --git a/engines/snatcher/script.h b/engines/snatcher/script.h
index cce685853db..c1c874d26c0 100644
--- a/engines/snatcher/script.h
+++ b/engines/snatcher/script.h
@@ -26,7 +26,7 @@
 #include "common/func.h"
 #include "common/ptr.h"
 
-#define		SNATCHER_SCRIPT_DEBUG
+//#define		SNATCHER_SCRIPT_DEBUG
 
 namespace Common {
 class SeekableReadStream;
@@ -104,7 +104,7 @@ private:
 	void m_gfxPostLoadProcess(const uint16 *&data);
 	void m_33(const uint16 *&data);
 	void m_palOps(const uint16 *&data);
-	void m_clearJordanInputField(const uint16 *&data);
+	void m_clearTextInputLine(const uint16 *&data);
 
 	typedef Common::Functor1Mem<const uint16*&, void, CmdQueue> CmdQueOpcode;
 	Common::Array<CmdQueOpcode*> _opcodes;
@@ -144,8 +144,8 @@ public:
 	bool postProcess(Script &script);
 	void processInput();
 
-	void loadState(Common::SeekableReadStream *in, Script &script);
-	void saveState(Common::SeekableWriteStream *out, Script &script);
+	void loadState(Common::SeekableReadStream *in, Script &script, bool onlyTempData);
+	void saveState(Common::SeekableWriteStream *out, Script &script, bool onlyTempData);
 
 private:
 	CmdQueue *_que;
@@ -205,13 +205,13 @@ private:
 	void o_setFlags();
 	void o_21();
 	void o_eval_less();
-	void o_eval_lessOrSame();
+	void o_eval_lessOrEqual();
 	void o_do_either_or();
 	void o_do_if();
 	void o_28();
 	void o_executeFunction();
-	void o_40();
-	void o_42();
+	void o_eval_greater();
+	void o_eval_greaterOrEqual();
 	void o_break();
 	void o_eval_true();
 	void o_start();
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index d90d5a416f4..34c6636da35 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -35,6 +35,7 @@
 #include "common/events.h"
 #include "common/list.h"
 #include "common/system.h"
+#include "graphics/cursorman.h"
 #include "graphics/pixelformat.h"
 #include "engines/util.h"
 
@@ -139,6 +140,7 @@ bool SnatcherEngine::initGfx(Common::Platform platform, bool use8BitColorMode) {
 		initGraphics(_gfx->realScreenWidth(), _gfx->realScreenHeight(), &pxf);
 		assert(_scd);
 		_gfx->setTextFont(_scd->makePtr(0x14B7C)(), 816, _scd->makePtr(0x14EAC)(), 102);
+		_gfx->createMouseCursor();
 		return true;
 	}
 
@@ -219,7 +221,7 @@ bool SnatcherEngine::start() {
 	Util::rngReset();
 	GameState state;
 	_saveMan->loadSettings(state.conf);
-	_saveMan->updateSaveSlotsState(state);
+	_saveMan->updateSaveSlotsStatus(state);
 	_memHandler->setGameState(&state);
 
 	//playBootLogoAnimation(state);
@@ -236,7 +238,7 @@ bool SnatcherEngine::start() {
 		uint32 nextFrame = _system->getMillis() + (frameTimer >> 14);
 		frameTimer &= 0x3FFF;
 
-		updateChapter(state);
+		updateMainState(state);
 
 		_gfxInfo.audioSync = _snd->cdaIsPlaying() ? _snd->cdaGetTime() : 0;
 		Util::rngMakeNumber();
@@ -294,7 +296,7 @@ bool SnatcherEngine::start() {
 
 void SnatcherEngine::delayUntil(uint32 end) {
 	uint32 cur = _system->getMillis();
-	_gfxInfo.dropFrames = /*cur > end ? ((cur - end) << 14) / _frameLen :*/ 0;
+	_gfxInfo.dropFrames = cur > end ? ((cur - end) << 14) / _frameLen : 0;
 	if (cur < end)
 		_system->delayMillis(end - cur);
 }
@@ -389,6 +391,7 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 						// the screen center. I solve this by always adding the diff to the y-bias.
 						_input.lightGunPos.x = CLIP<int>(_realLightGunPos.x - state.conf.lightGunBias.x, 0, 255);
 						_input.lightGunPos.y = CLIP<int>(_realLightGunPos.y - state.conf.lightGunBias.y, 0, 255);
+						debug("Lightgun position: (%d, %d)", _input.lightGunPos.x, _input.lightGunPos.y);
 					}
 				}
 
@@ -410,20 +413,20 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 		_gfx->setVar(7, 4);
 }
 
-void SnatcherEngine::updateChapter(GameState &state) {
-	// The chapterSub variable is an invention to emulate the interaction between the main thread and the
+void SnatcherEngine::updateMainState(GameState &state) {
+	// The phaseFlags variable is an invention to emulate the interaction between the main thread and the
 	// vertical interrupt handlers in the original code. It may complicate things a bit (e. g. I have to
 	// provide means to drop out of several involved functions and continue with them later), but I still
-	// like this better than making the code multi-threaded, using a timer proc.
+	// like this better than making the code multi-threaded (using a timer proc as vint handler replacment).
 
-	if (state.chapterSub & 0x80) {
+	if (state.phaseFlags & 0x80) {
 		if (!(_cmdQueue->enabled() || (_snd->pcmGetStatus().statusBits & 7)))
-			state.chapterSub &= ~0x80;
+			state.phaseFlags &= ~0x80;
 		else
 			return;
 	}
 
-	switch (state.chapter) {
+	switch (state.phase) {
 	case 0:
 		// Intro and main menu
 		if (state.prologue != -1)
@@ -444,13 +447,14 @@ void SnatcherEngine::updateChapter(GameState &state) {
 		_cmdQueue->writeUInt32(0xED0E);
 		_cmdQueue->start();
 
-		++state.chapter;
-		state.chapterSub |= 0x80;
+		++state.phase;
+		state.phaseFlags |= 0x80;
 
 		break;
 
 	case 1:
 		// Init first scene or load savegame
+		state.phaseFlags = 0;
 		_cmdQueue->writeUInt16(0x11);
 		_cmdQueue->writeUInt32(0x1A800);
 		if (state.menuSelect == 0) {
@@ -480,34 +484,34 @@ void SnatcherEngine::updateChapter(GameState &state) {
 		_ui->setControllerConfig(state.conf.controllerSetup);
 
 		_cmdQueue->start();
-		++state.chapter;
-		state.chapterSub |= 0x80;
+		++state.phase;
+		state.phaseFlags |= 0x80;
 		break;
 
 	case 2:
 		// Act I
-		if (state.chapterSub & 0x40) {
+		if (state.phaseFlags & 0x40) {
 			if (_scriptEngine->postProcess(state.script)) {
 				for (int i = 5; i < 15; ++i)
 					_gfx->setAnimParameter(i, GraphicsEngine::kAnimParaEnable, 0);
 				_cmdQueue->writeUInt16(0x22);
 				_cmdQueue->writeUInt32(0x139D0);
 				_cmdQueue->start();
-				state.chapterSub |= 0xA0;
+				state.phaseFlags |= 0xA0;
 			}
-			state.chapterSub &= ~0x40;
-		} else if (state.chapterSub & 0x20) {
+			state.phaseFlags &= ~0x40;
+		} else if (state.phaseFlags & 0x20) {
 			_gfx->setVar(11, 0xFF);
 			if (!_ui->drawVerbs() || !_ui->verbsTabInputPrompt(_input.singleFrameControllerFlagsRemapped)) {
-				state.chapterSub |= 0x80;
+				state.phaseFlags |= 0x80;
 			} else {
 				_scriptEngine->processInput();
-				state.chapterSub &= ~0x20;
+				state.phaseFlags &= ~0x20;
 			}
-		} else if (state.chapterSub == 0) {
+		} else if (state.phaseFlags == 0) {
 			_scriptEngine->run(state.script);
 			_cmdQueue->start();
-			state.chapterSub |= 0xC0;
+			state.phaseFlags |= 0xC0;
 		}
 		break;
 
@@ -652,16 +656,13 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 		}
 		break;
 	case 3:
-		//_wordRAM__TABLE48__word_B6400[2] = 1;
 		state.finish = 0;
 		state.modProcessTop = 0;
 		state.modProcessSub = 0;
 		_gfx->reset(GraphicsEngine::kResetScrollState);
 		break;
 	case 5:
-		// bset    #3,(GA_SUB__COMMUNICATION_FLAG+1).
 		if (state.finish) {
-			// bclr    #3,(GA_SUB__COMMUNICATION_FLAG+1).l
 			++state.modProcessTop;
 			state.modProcessSub = 0;
 			state.finish = 0;
@@ -687,8 +688,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			}
 			break;
 		case 2:
-			// startup__runWithFileFunc(2)
-			//_unlCDREadSeekWord = 0;
+			//original: check if file loaded
 			++state.modProcessSub;
 			break;
 		case 3:
@@ -790,7 +790,8 @@ void SnatcherEngine::calibrateLightGun(GameState &state) {
 
 void SnatcherEngine::allowLightGunInput(bool enable) {
 	_enableLightGun = enable;
-	_system->showMouse(enable);
+	_gfx->createMouseCursor();
+	CursorMan.showMouse(enable);
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index 3d124136008..9e80f53f747 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -70,7 +70,7 @@ private:
 	void delayUntil(uint32 end);
 	void checkEvents(const GameState &state);
 
-	void updateChapter(GameState &state);
+	void updateMainState(GameState &state);
 	void updateModuleState(GameState &state);
 
 	const uint32 _frameLen;
diff --git a/engines/snatcher/state.h b/engines/snatcher/state.h
index e509fcfdb7a..41e937069a7 100644
--- a/engines/snatcher/state.h
+++ b/engines/snatcher/state.h
@@ -46,7 +46,7 @@ struct Config {
 };
 
 struct Script {
-	Script(uint32 textResourceOffset, int16 &chaptr) : sentenceDone(0), sentencePos(0), data(nullptr), dataSize(0), curPos(0), newPos(0xFFFF), curFileNo(0), curGfxScript(-1), chapter(chaptr), textResOffset(textResourceOffset) {}
+	Script(uint32 textResourceOffset, int16 &chaptr) : sentenceDone(0), sentencePos(0), data(nullptr), dataSize(0), curPos(0), newPos(0xFFFF), curFileNo(0), curGfxScript(-1), phase(chaptr), textResOffset(textResourceOffset) {}
 	~Script() {
 		delete[] data;
 	}
@@ -61,12 +61,12 @@ struct Script {
 	uint32 dataSize;
 	uint16 curPos;
 	uint16 newPos;
-	int16 &chapter;
+	int16 &phase;
 	const uint32 textResOffset;
 };
 
 struct GameState {
-	GameState() : frameNo(0), frameState(0), finish(0), modProcessTop(0), modProcessSub(0), counter(0), modIndex(0), menuSelect(0), prologue(0), chapter(0), chapterSub(0), saveSlotUsage(0), saveCount(0), conf(Config()), script(0x3800, chapter), totalPlayTime(0) {}
+	GameState() : frameNo(0), frameState(0), finish(0), modProcessTop(0), modProcessSub(0), counter(0), modIndex(0), menuSelect(0), prologue(0), phase(0), phaseFlags(0), saveSlotUsage(0), saveCount(0), conf(Config()), script(0x3800, phase), totalPlayTime(0) {}
 	int16 frameNo;
 	int16 frameState;
 	int16 finish;
@@ -76,8 +76,8 @@ struct GameState {
 	int16 modIndex;
 	int16 menuSelect;
 	int16 prologue;
-	int16 chapter;
-	int16 chapterSub;
+	int16 phase;
+	int16 phaseFlags;
 	int16 saveSlotUsage;
 	int16 saveCount;
 	Config conf;
diff --git a/engines/snatcher/text_scd.cpp b/engines/snatcher/text_scd.cpp
index fd4f2d6b8de..7aaa3b99405 100644
--- a/engines/snatcher/text_scd.cpp
+++ b/engines/snatcher/text_scd.cpp
@@ -203,6 +203,7 @@ void TextRenderer_SCD::drawGlyph(uint16 ch) {
 
 		for (int w = 7; w >= 0; --w) {
 			if (in & (1 << w)) {
+				assert(d < renderBuffer + 0x2000);
 				if (dXX & 1)
 					*d = (*d & 0xF0) | c1;
 				else
@@ -212,7 +213,7 @@ void TextRenderer_SCD::drawGlyph(uint16 ch) {
 				++d;
 			if (++dXX == 8)
 				d += 28;
-			assert(d < renderBuffer + 0x2000);
+			
 		}
 
 		dst += 4;
@@ -220,7 +221,6 @@ void TextRenderer_SCD::drawGlyph(uint16 ch) {
 			dY = 0;
 			dst += 992;
 		}
-		assert(dst < renderBuffer + 0x2000);
 	}
 }
 
diff --git a/engines/snatcher/transition_scd.cpp b/engines/snatcher/transition_scd.cpp
index ba9c966d090..5c838a67f67 100644
--- a/engines/snatcher/transition_scd.cpp
+++ b/engines/snatcher/transition_scd.cpp
@@ -131,7 +131,7 @@ private:
 	uint8 _lineScrollOp;
 	uint8 _nextStepExt;
 	uint8 _lastStepExt;
-	int16 _trsFlagttt;
+	int16 _restoreDlgTab;
 	int16 _hint_proc;
 	int16 _transitionType;
 	int16 _transitionState;
@@ -173,10 +173,10 @@ private:
 	void trsUpdt_showDialogueTab2(int arg);
 	void trsUpdt_showMonitorTextField(int arg);
 	void trsUpdt_showDefaultTextScreen(int arg);
-	void trsUpdt_23(int arg);
+	void trsUpdt_videoPhoneCallStart(int arg);
 	void trsUpdt_24(int arg);
-	void trsUpdt_25(int arg);
-	void trsUpdt_26(int arg);
+	void trsUpdt_videoPhoneCallEnd1(int arg);
+	void trsUpdt_videoPhoneCallEnd2(int arg);
 	void trsUpdt_27(int arg);
 	void trsUpdt_28(int arg);
 	void trsUpdt_29(int arg);
@@ -192,6 +192,7 @@ private:
 
 	void setHINTHandler(uint8 num);
 
+	void hIntHandler_dummy(Graphics::SegaRenderer*);
 	void hIntHandler_showVirtKeybTabStep1(Graphics::SegaRenderer *sr);
 	void hIntHandler_showVirtKeybTabStep2(Graphics::SegaRenderer *sr);
 	void hIntHandler_hideVirtKeybTabStep1(Graphics::SegaRenderer *sr);
@@ -204,11 +205,13 @@ private:
 	void hIntHandler_showDialogueTab2(Graphics::SegaRenderer *sr);
 	void hIntHandler_showMonitorTextField(Graphics::SegaRenderer *sr);
 	void hIntHandler_showDefaultTextScreen(Graphics::SegaRenderer *sr);
+	void hIntHandler_videoPhoneCallStart(Graphics::SegaRenderer *sr);
+	void hIntHandler_videoPhoneCallEnd(Graphics::SegaRenderer *sr);
 };
 
 TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0), _hint_proc(0), _transitionStep(0),
 	_trsCommandExt(0), _trsCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _lineScrollOpState(0), _lineScrollTimer1(0), _lineScrollTimer2(0), _lineScrollTimer3(0), _lineScrollTimer4(0),
-		_lineScrollTimer5(0), _trs__DB(0), _lineScrollOp(0), _trsFlagttt(0), _transitionType(0), _transitionState(0), _transitionState2(0), _tmpScrollOffset(0), _subPara(0), _useEngineScrollOffsets(false), _hINTHandler(nullptr) {
+		_lineScrollTimer5(0), _trs__DB(0), _lineScrollOp(0), _restoreDlgTab(0), _transitionType(0), _transitionState(0), _transitionState2(0), _tmpScrollOffset(0), _subPara(0), _useEngineScrollOffsets(false), _hINTHandler(nullptr) {
 	_internalState = new ScrollInternalState[4];
 	assert(_internalState);
 	_internalState[kVertA].setFactor(-1);
@@ -271,7 +274,7 @@ bool TransitionManager_SCD::nextFrame() {
 			if (_lastStepExt == 23) {
 				_internalState[kVertA].setNextOffset(0);
 				_internalState[kVertB].setNextOffset(0);
-				if (_trsFlagttt) {
+				if (_restoreDlgTab) {
 					resetVars(0x30);
 					_nextStepExt = _lastStepExt = 15;
 				} else {
@@ -282,7 +285,7 @@ bool TransitionManager_SCD::nextFrame() {
 			}
 		} else if (_nextStepExt == 15 && _lastStepExt == 23) {
 			_nextStepExt = 23;
-			_trsFlagttt = 1;
+			_restoreDlgTab = 1;
 		} else if (_nextStepExt != 0) {
 			_lastStepExt = _nextStepExt;
 			resetVars(0x40);
@@ -365,12 +368,14 @@ void TransitionManager_SCD::processTransition() {
 	case 1:
 		_result.hInt.counter = 15;
 		if (--_transitionState <= 0) {
+			_result.realOffsets[kVertA] = 0;
+			_result.realOffsets[kVertB] = 0;
 			_internalState[kVertA].setNextOffset(0);
 			_internalState[kVertB].setNextOffset(0);
 			return;
 		}
-		_internalState[kVertA].setNextOffset(_transitionState > 1 ? 0x30 : 0x10);
-		_internalState[kVertB].setNextOffset(_transitionState > 1 ? 0x30 : 0x10);
+		_result.realOffsets[kVertA] = _transitionState > 1 ? 0x30 : 0x10;
+		_result.realOffsets[kVertB] = _transitionState > 1 ? 0x30 : 0x10;
 		break;
 	case 2: case 3: case 4: case 5: case 6:
 		_result.hInt.counter = 7;
@@ -389,13 +394,13 @@ void TransitionManager_SCD::processTransition() {
 		break;
 	case 17:
 		_result.hInt.counter = 7;
-		//_internalState[kVertA].setNextOffset(_scrollu9);
-		//_internalState[kVertB].setNextOffset(_scrollu9);
+		_result.realOffsets[kVertA] = 0;
+		_result.realOffsets[kVertB] = _transitionState2;
 		break;
 	case 18: case 19: case 20: case 21:
 		_result.hInt.counter = 7;
-		_internalState[kVertA].setNextOffset(0);
-		_internalState[kVertB].setNextOffset(_transitionState);
+		_result.realOffsets[kVertA] = 0;
+		_result.realOffsets[kVertB] = _transitionState;
 		break;
 	case 22: case 23:
 		break;
@@ -418,14 +423,18 @@ void TransitionManager_SCD::resetVars(int groupFlags) {
 		_nextStepExt = 0;
 		_transitionType = _transitionState = _tmpScrollOffset = _subPara = 0;
 		_result.verbsTabVisible = false;
-		_trsFlagttt = 0;
+		_restoreDlgTab = 0;
 
 	}
 	if (groupFlags & 0x04) {
 		_nextStep = _lastStep = 0;
 		_result.lineScrollMode = false;
-		for (int i = 0; i < 4; ++i)
-			_internalState[i].setNextOffset(0);
+		for (int i = 0; i < 4; ++i) {
+			if (_scrollType == 0)
+				_result.realOffsets[i] = 0;
+			else
+				_internalState[i].setNextOffset(0);
+		}
 	}
 	if (groupFlags & 0x08) {
 		_useEngineScrollOffsets = false;
@@ -438,9 +447,13 @@ void TransitionManager_SCD::resetVars(int groupFlags) {
 		_result.verbsTabVisible = false;
 	}
 	if (groupFlags & 0x20) {
-		_trsFlagttt = 0;
-		_internalState[kVertA].setNextOffset(0);
-		_internalState[kVertB].setNextOffset(0);
+		_restoreDlgTab = 0;
+		if (_scrollType == 0) {
+			_result.realOffsets[kVertA] = _result.realOffsets[kVertB] = 0;
+		} else {
+			_internalState[kVertA].setNextOffset(0);
+			_internalState[kVertB].setNextOffset(0);
+		}
 	}
 	if (groupFlags & 0x40) {
 		_transitionState = _tmpScrollOffset = _subPara = 0;
@@ -475,10 +488,10 @@ void TransitionManager_SCD::makeFunctions() {
 		TF(showDialogueTab2),
 		TF(showMonitorTextField),
 		TF(showDefaultTextScreen),
-		TF(23),
+		TF(videoPhoneCallStart),
 		TF(24),
-		TF(25),
-		TF(26),
+		TF(videoPhoneCallEnd1),
+		TF(videoPhoneCallEnd2),
 		TF(27),
 		TF(28),
 		TF(29)
@@ -493,25 +506,27 @@ void TransitionManager_SCD::makeFunctions() {
 		HF(showVirtKeybTabStep2),
 		HF(hideVirtKeybTabStep1),
 		HF(hideVirtKeybTabStep2),
-		nullptr,
-		nullptr,
-		nullptr,
+		HF(dummy),
+		HF(dummy),
+		HF(dummy),
 		HF(screenShutter),
 		HF(revealShutter),
-		nullptr,
-		nullptr,
-		nullptr,
-		nullptr,
+		HF(dummy),
+		HF(dummy),
+		HF(dummy),
+		HF(dummy),
 		HF(toggleStdVerbsTab),
-		nullptr,
+		HF(dummy),
 		HF(showDialogueTab1),
-		nullptr,
-		nullptr,
+		HF(dummy),
+		HF(dummy),
 		HF(toggleSmallVerbsTab),
-		nullptr,
+		HF(dummy),
 		HF(showDialogueTab2),
 		HF(showMonitorTextField),
-		HF(showDefaultTextScreen)
+		HF(showDefaultTextScreen),
+		HF(videoPhoneCallStart),
+		HF(videoPhoneCallEnd)
 	};
 
 	for (uint i = 0; i < ARRAYSIZE(funcTbl2); ++i) \
@@ -837,16 +852,50 @@ void TransitionManager_SCD::trsUpdt_showDefaultTextScreen(int arg) {
 		textScreenTrsUpdate(16, 22, 232);
 }
 
-void TransitionManager_SCD::trsUpdt_23(int arg) {
+void TransitionManager_SCD::trsUpdt_videoPhoneCallStart(int arg) {
+	if (_tmpScrollOffset == 0) {
+		_transitionState2 = 48;
+		++_tmpScrollOffset;
+	} else {
+		if (_tmpScrollOffset == 1) {
+			_transitionState2 += 8;
+			if (_transitionState2 > 96) {
+				_transitionState2 = 96;
+				++_tmpScrollOffset;
+			}
+		}
+		_transitionType = 17;
+		setHINTHandler(23);
+	}
 }
 
 void TransitionManager_SCD::trsUpdt_24(int arg) {
 }
 
-void TransitionManager_SCD::trsUpdt_25(int arg) {
+void TransitionManager_SCD::trsUpdt_videoPhoneCallEnd1(int arg) {
+	if (arg != 0)
+		return;
+	_transitionType = 19;
+	setHINTHandler(24);
+	_transitionState = 96;
+	++_subPara;
 }
 
-void TransitionManager_SCD::trsUpdt_26(int arg) {
+void TransitionManager_SCD::trsUpdt_videoPhoneCallEnd2(int arg) {
+	if (arg == 0) {
+		_transitionType = 20;
+		setHINTHandler(24);
+		_transitionState = 96;
+		++_subPara;
+	} else if (arg == 1) {
+		_transitionState -= 8;
+		if (_transitionState < 48) {
+			_transitionState = 48;
+			++_subPara;
+		}
+	} else {
+		resetVars(0x30);
+	}
 }
 
 void TransitionManager_SCD::trsUpdt_27(int arg) {
@@ -884,7 +933,6 @@ void TransitionManager_SCD::textScreenTrsUpdate(int type, int hIntHandlerNo, int
 	++_subPara;
 }
 
-
 void TransitionManager_SCD::setHINTHandler(uint8 num) {
 	if (num < _hINTProcs.size())
 		_hINTHandler = _hINTProcs[num];
@@ -892,6 +940,9 @@ void TransitionManager_SCD::setHINTHandler(uint8 num) {
 		error("%s(): Invalid HINT handler %d", __FUNCTION__, num);
 }
 
+void TransitionManager_SCD::hIntHandler_dummy(Graphics::SegaRenderer*) {
+}
+
 void TransitionManager_SCD::hIntHandler_showVirtKeybTabStep1(Graphics::SegaRenderer *sr) {
 	if (_transitionStep == 99) {
 		sr->writeUint16VSRAM(0, TO_BE_16(0x140));
@@ -1050,6 +1101,27 @@ void TransitionManager_SCD::hIntHandler_showDefaultTextScreen(Graphics::SegaRend
 	_result.hInt.enable = false;
 }
 
+void TransitionManager_SCD::hIntHandler_videoPhoneCallStart(Graphics::SegaRenderer *sr) {
+	if (_transitionStep == 9) {
+		sr->writeUint16VSRAM(0, 0);
+		sr->writeUint16VSRAM(2, TO_BE_16((-_transitionState2) & 0x3FF));
+	} else if (_transitionStep == 17) {
+		sr->writeUint16VSRAM(0, TO_BE_16(_result.realOffsets[kVertA]));
+		sr->writeUint16VSRAM(2, TO_BE_16(_result.realOffsets[kVertB]));
+		_result.hInt.enable = false;
+	}
+	++_transitionStep;
+}
+
+void TransitionManager_SCD::hIntHandler_videoPhoneCallEnd(Graphics::SegaRenderer *sr) {
+	if (_transitionStep == 9) {
+		sr->writeUint16VSRAM(0, 0);
+		sr->writeUint16VSRAM(2, TO_BE_16((-_transitionState) & 0x3FF));
+		_result.hInt.enable = false;
+	}
+	++_transitionStep;
+}
+
 TransitionManager *TransitionManager::createSegaTransitionManager(GraphicsEngine::GfxState &state) {
 	return new TransitionManager_SCD(state);
 }
diff --git a/engines/snatcher/ui.cpp b/engines/snatcher/ui.cpp
index faab843ddc5..d479bb1b041 100644
--- a/engines/snatcher/ui.cpp
+++ b/engines/snatcher/ui.cpp
@@ -30,10 +30,10 @@
 namespace Snatcher {
 
 UI::UI(GraphicsEngine *gfx, CmdQueue *que, ResourcePointer *scd) : _gfx(gfx), _que(que), _scd(scd), _sceneId(0), _textLineBreak(0), _dialogTextBuffer(nullptr), _textColor(0),
-	_scriptTextResource(nullptr),/*_makestrbt1(0),*/ _textY(0), _textY2(0), _sceneTextOffsCur(0), _textLineEnd(0), _sceneInfo(0), _sceneTextOffset(0), _transDW1(0), _transDW2(0),
+	_scriptTextResource(nullptr),/*_makestrbt1(0),*/ _textY(0), _headLineYOffset(0), _sceneTextOffsCur(0), _textLineEnd(0), _sceneInfo(0), _sceneTextOffset(0), _transDW1(0), _transDW2(0),
 		_sceneTextOffsStart(0), _waitCursorFrame(0), _waitCursorAnimDelay(0), _progress(-1), _progress2(-1), _controllerCfg(0), _verbsTabLayout(0), _verbsInterpreterMode(0),
-			_lastVerbFirstPage(0), _numVerbsFirstPage(0), _numVerbsLastPage(0), _lastVerbLastPage(0), _numVerbsMax(0), _una_rr_hi(0), _una_rr_lo(0), _verbsTabCurPage(0), _lastVerbDrawn(0), _verbTextBuffer(nullptr), _scriptVerbsArray(nullptr),
-				_scriptSentenceArray(nullptr), _prevSelectedVerb(0), _selectedVerb(0), _lastHiliteVerb(0), _hiliteVerb(0), _transit_02(0), _textInputMarginLeft(0), _drawVerbsWd1(0),
+			_lastVerbFirstPage(0), _numVerbsFirstPage(0), _numVerbsLastPage(0), _lastVerbLastPage(0), _numVerbsMax(0), _verbsTabCurPage(0), _lastVerbDrawn(0), _verbTextBuffer(nullptr), _scriptVerbsArray(nullptr),
+				_scriptSentenceArray(nullptr), _prevSelectedVerb(0), _selectedVerb(0), _lastHiliteVerb(0), _hiliteVerb(0), _transit_02(0), _textInputMarginLeft(0), _videoPhoneMode(0),
 					_textInputColumnCur(0), _textInputColumnMax(0), _textInputCursorState(0), _textInputCursorBlinkCnt(0), _underscoreStr(nullptr), _textInputStr(nullptr), _vkeybPosTotal(0),
 						_vkeybColumnWidth(0), _verbsTabLayoutMap(nullptr), _verbsTabOffsX(0), _verbsTabOffsY(0), _hilitePosX(0), _hilitePosY(0), _vkeybVisible(false) {
 
@@ -78,9 +78,9 @@ bool UI::displayDialog(int sceneInfo, int sceneTextOffset, uint16 inputFlags) {
 		if (_sceneId == 0) {
 			_gfx->transitionCommand(21);
 			//_c13Valu = 0xFF;
-			_textY = _textY2;
+			_textY = _headLineYOffset;
 		} else if (_sceneId == 0xFF) {
-			_textY = _textY2;
+			_textY = _headLineYOffset;
 		} else {
 			printDialogStringHead();
 		}
@@ -209,12 +209,10 @@ bool UI::drawVerbs() {
 
 	if (_verbsTabLayout < 2) {
 		if (_progress2 == 2) {
-			_una_rr_hi = _una_rr_lo = 0;
-
 			static const uint8 strHead[] = { 0xFC, 0x00, 0xF9, 0x01, 0xFE, 0x04, 0xFB };
 			memcpy(_verbTextBuffer, strHead, sizeof(strHead));
 			_verbTextBuffer[41] = 0xFF;
-
+			_headLineYOffset = 0;
 			_verbsTabCurPage = 0;
 			bool sp7 = (_scriptVerbsArray->pos() == 7 && _gfx->getVerbAreaType() != 0);
 			if (sp7) {
@@ -366,7 +364,7 @@ bool UI::verbsTabInputPrompt(uint16 inputFlags) {
 		}
 
 		if (_progress2 == 101) {
-			if (!_gfx->isVerbsTabActive())
+			if (_verbsTabLayout < 2 && !_gfx->isVerbsTabActive())
 				return false;
 			++_progress2;
 		}
@@ -423,7 +421,7 @@ bool UI::verbsTabInputPrompt(uint16 inputFlags) {
 			++_progress2;
 		}
 		if (_progress2 == 107)
-			_drawVerbsWd1 = _textInputColumnMax = 0;
+			_videoPhoneMode = _textInputColumnMax = 0;
 
 		if (_progress2 >= 109 && _progress <= 127) {
 			verbTabSwapPage();
@@ -466,7 +464,7 @@ bool UI::verbsTabInputPrompt(uint16 inputFlags) {
 				_verbsInterpreterMode = 0;
 				_verbsTabLayout = 0;
 			}
-			_drawVerbsWd1 = 0;
+			_videoPhoneMode = 0;
 			_textInputColumnMax = 0;
 		}
 	}
@@ -503,7 +501,7 @@ void UI::printDialogStringHead() {
 	static const uint8 strHead[] = { 0xFC, 0x00, 0xF9, 0x01, 0xFB, 0x10, 0x00, 0xFE };
 	const uint8 *s = _scd->makePtr(0x13552).getDataFromTable(_sceneId)();
 	memcpy(_dialogTextBuffer, strHead, sizeof(strHead));
-	_dialogTextBuffer[6] = _textY2;
+	_dialogTextBuffer[6] = _headLineYOffset;
 	_dialogTextBuffer[8] = (*s & 0x80) ? 3 : (*s++ & 7);
 	uint8 *d = _dialogTextBuffer + 9;
 
@@ -516,7 +514,7 @@ void UI::printDialogStringHead() {
 	assert(*(d - 1) == 0xFF);
 
 	_gfx->printText(_dialogTextBuffer);
-	_textY = _textY2 + 9;
+	_textY = _headLineYOffset + 9;
 }
 
 void UI::printDialogStringBody() {
@@ -820,7 +818,7 @@ void UI::verbsTabHandleInput(uint16 inputFlags) {
 
 		} else if (in & 0x10) {
 			virtKeybBackspace();
-		} else if ((_drawVerbsWd1 == 0) && (in & 0x80)) {
+		} else if ((_videoPhoneMode == 0) && (in & 0x80)) {
 			virtKeybStart();
 		} else if (in & 0x20) {
 			if (verbSelect2())
@@ -932,8 +930,18 @@ void UI::verbSelect() {
 }
 
 bool UI::verbSelect2() {
-	if (_drawVerbsWd1) {
-		return false;
+	uint8 r = _verbsTabLayoutMap[_vkeybPosTotal];
+
+	if (_videoPhoneMode) {
+		if (!(_progress2 & 0x100)) {
+			if (r == '*')
+				_gfx->setAnimParameter(2, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
+			else if (r == '#')
+				_gfx->setAnimParameter(3, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
+			else
+				_gfx->setAnimParameter(r & 0x1F, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
+			_progress2 = 0x101;
+		}
 
 	} else {
 		if (!(_progress2 & 0x100)) {
@@ -942,9 +950,7 @@ bool UI::verbSelect2() {
 			_que->start();
 			_progress2 = 0x100;
 			return false;
-		}
-
-		uint8 r = _verbsTabLayoutMap[_vkeybPosTotal];
+		}	
 
 		if (_progress2 == 0x100) {
 			if (_verbsTabLayout == 3) {
@@ -960,32 +966,32 @@ bool UI::verbSelect2() {
 				return false;
 			}
 		}
+	}
 
-		bool reslt = true;
-		if (_progress2 == 0x101) {
-			if (r == 8) {
-				_progress2 |= 0xC00;
-				reslt = false;
-
-			} else if (r == 9) {
-				if (_textInputColumnCur != 0) {
-					if (!_textInputStr[_textInputColumnCur])
-						_textInputColumnCur--;
-					_textInputStr[_textInputColumnCur] = 0;
-				} else {
-					reslt = false;
-				}
-			} else if (_textInputColumnCur < _textInputColumnMax) {
-				_textInputStr[_textInputColumnCur] = r;
-				if (_textInputColumnCur + 1 < _textInputColumnMax)
-					++_textInputColumnCur;
+	bool reslt = true;
+	if (_progress2 == 0x101) {
+		if (r == 8) {
+			_progress2 |= 0xC00;
+			reslt = false;
+
+		} else if (r == 9) {
+			if (_textInputColumnCur != 0) {
+				if (!_textInputStr[_textInputColumnCur])
+					_textInputColumnCur--;
+				_textInputStr[_textInputColumnCur] = 0;
 			} else {
 				reslt = false;
 			}
-			_progress2 = reslt ? 0x200 : (_progress2 & 0xC00) | 103;
+		} else if (_textInputColumnCur < _textInputColumnMax) {
+			_textInputStr[_textInputColumnCur] = r;
+			if (_textInputColumnCur + 1 < _textInputColumnMax)
+				++_textInputColumnCur;
+		} else {
+			reslt = false;
 		}
-		return reslt;
+		_progress2 = reslt ? 0x200 : (_progress2 & 0xC00) | 103;
 	}
+	return reslt;
 }
 
 void UI::virtKeybBackspace() {
@@ -1099,10 +1105,13 @@ void UI::virtKeybPrint() {
 	if (pr == 0x204) {
 		drawUnderscoreCursor();
 		_progress2 = (_progress2 & ~0x2FF) | 103;
-	}
 
-	if (_drawVerbsWd1 == 0)
-		return;
+		if (_videoPhoneMode != 0) {
+			uint8 v = _textInputStr[0];
+			if (_textInputStr[_scd->makePtr(0x11938)[(v == '*' || v == '#') ? 2 : (v & 0x0F)] - 1])
+				verbSelect2setResult();
+		}
+	}
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/ui.h b/engines/snatcher/ui.h
index 0d437bcdfb2..8afdab451a3 100644
--- a/engines/snatcher/ui.h
+++ b/engines/snatcher/ui.h
@@ -57,6 +57,9 @@ public:
 	void resetVerbSelection() { _prevSelectedVerb = 0; }
 	void setVerbsTabLayout(uint16 layout);
 	void setInterpreterMode(uint16 mode);
+	void setVideoPhoneMode(uint16 enable) { _videoPhoneMode = enable; }
+	void setInputStringLength(uint16 length) { _textInputColumnMax = length; }
+	void setHeadLineYOffset(int16 offs) { _headLineYOffset = offs; };
 
 	void loadState(Common::SeekableReadStream *in);
 	void saveState(Common::SeekableWriteStream *out);
@@ -69,8 +72,7 @@ private:
 
 	uint8 _textColor;
 	uint8 _textY;
-	uint8 _textY2;
-	//uint8 _makestrbt1;
+	int16 _headLineYOffset;
 	uint8 _sceneId;
 	uint8 _textLineBreak;
 	uint8 _textLineEnd;
@@ -111,13 +113,11 @@ private:
 	uint8 _lastVerbLastPage;
 	uint8 _prevSelectedVerb;
 	uint8 _numVerbsMax;
-	uint8 _una_rr_hi;
-	uint8 _una_rr_lo;
 	uint8 _verbsTabCurPage;
 	uint8 _transit_02;
 	int16 _transDW1;
 	int16 _transDW2;
-	int16 _drawVerbsWd1;
+	int16 _videoPhoneMode;
 	uint8 _textInputMarginLeft;
 	int16 _textInputColumnCur;
 	int16 _textInputColumnMax;


Commit: 5a895720b14adb442c3350a6d4b1113ef9120a47
    https://github.com/scummvm/scummvm/commit/5a895720b14adb442c3350a6d4b1113ef9120a47
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: implement missing parts

Game is now completeable, but there are still
severe issues.

Changed paths:
  A engines/snatcher/scene_d0.cpp
  A engines/snatcher/scene_d1.cpp
  A engines/snatcher/scene_d2.cpp
  A engines/snatcher/scene_y16.cpp
  R engines/snatcher/scene/scene_d0.cpp
  R engines/snatcher/scene/scene_d1.cpp
  R engines/snatcher/scene/scene_d2.cpp
    engines/snatcher/action.cpp
    engines/snatcher/action.h
    engines/snatcher/animator_scd.cpp
    engines/snatcher/graphics.h
    engines/snatcher/memory.cpp
    engines/snatcher/module.mk
    engines/snatcher/palette_scd.cpp
    engines/snatcher/resource.cpp
    engines/snatcher/scene.h
    engines/snatcher/script.cpp
    engines/snatcher/script.h
    engines/snatcher/snatcher.cpp
    engines/snatcher/sound.cpp
    engines/snatcher/transition_scd.cpp
    engines/snatcher/ui.cpp
    engines/snatcher/ui.h


diff --git a/engines/snatcher/action.cpp b/engines/snatcher/action.cpp
index 0639c1cd1f1..257bb03f489 100644
--- a/engines/snatcher/action.cpp
+++ b/engines/snatcher/action.cpp
@@ -32,8 +32,8 @@
 namespace Snatcher {
 
 ActionSequenceHandler::ActionSequenceHandler(SnatcherEngine *vm, ResourcePointer *scd) : _vm(vm), _scd(scd), _stage(0), _counter1(0), _counter2(0), _progressMSB(0), _progressLSB(0),
-	_weaponState(0), _enemyAttackSpeed(0), _active(false), _handleShotPhase(0), _updateEnemiesPhase(0), _enemyAttackStatus(0), _targetField(0), _hscrollB(0), _vscrollB(0),
-		_enemyAppearanceCount(0), _civilianAppearanceCount(0), _shoot_78F2(0), _nextEnemyAppearanceTimer(0), _enemyAttackTimer(0), _shoot_78EE(0), _shoot_78EC(0), _result(),
+	_weaponState(0), _enemySpeed(0), _active(false), _handleShotPhase(0), _updateEnemiesPhase(0), _enemyAttackStatus(0), _targetField(0), _hscrollB(0), _vscrollB(0),
+		_enemyAppearanceCount(0), _civilianAppearanceCount(0), _abortFight(0), _nextEnemyAppearanceTimer(0), _enemyAttackTimer(0), _shoot_78EE(0), _shoot_78EC(0), _result(),
 			_attackerId(0), _animNo(0), _shoot_7912(0), _projectileCoords(nullptr) {
 	_projectileCoords = new int16[18]();
 }
@@ -81,11 +81,11 @@ bool ActionSequenceHandler::run(bool useLightGun) {
 		case 3:
 			animSet(48, Enable, 0);
 			animSet(48, ControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
-			animSet(48, F2c, 6);
+			animSet(48, ActionTimer, 6);
 			resetVars();
 			animSet(21, Enable, 0);
 			animSet(21, ControlFlags, GraphicsEngine::kAnimNone);
-			animSet(21, F17, 0xFF);
+			animSet(21, Target, 0xFF);
 			animSet(24, Enable, 0);
 			animSet(24, ControlFlags, GraphicsEngine::kAnimNone);
 			animSet(22, Enable, 0);
@@ -93,15 +93,15 @@ bool ActionSequenceHandler::run(bool useLightGun) {
 			animSet(23, Enable, 0);
 			animSet(23, ControlFlags, GraphicsEngine::kAnimNone);
 			_counter2 = 0;
-			_shoot_78F2 = 0;
+			_abortFight = 0;
 			initStage();
 
 			_nextEnemyAppearanceTimer = _scd->makePtr(0x11F60)[_stage];
 			_progressMSB = _scd->makePtr(0x11F50)[_stage];
 			_progressLSB = 0;
 
-			if (_enemyAttackSpeed == 0)
-				_enemyAttackSpeed = _scd->makePtr(0x11F70)[_stage];
+			if (_enemySpeed == 0)
+				_enemySpeed = _scd->makePtr(0x11F70)[_stage];
 			break;
 
 		default:
@@ -220,7 +220,7 @@ bool ActionSequenceHandler::run(bool useLightGun) {
 	case 5:
 		if (++_counter1 < 2)
 			break;
-		_weaponState = _enemyAttackSpeed = _progressMSB = 0;
+		_weaponState = _enemySpeed = _progressMSB = 0;
 		_vm->allowLightGunInput(false);
 		_active = false;
 		break;
@@ -277,6 +277,10 @@ void ActionSequenceHandler::setup(uint16 stage) {
 	_active = true;
 }
 
+void ActionSequenceHandler::setDifficulty(uint16 setting) {
+	_enemySpeed = setting;
+}
+
 void ActionSequenceHandler::resetVars() {
 	_weaponState = 0;
 	_handleShotPhase = 0;
@@ -345,7 +349,7 @@ void ActionSequenceHandler::handleWeaponDrawAndTargetSelection() {
 	if (_weaponState < 2) {
 		animSet(23, PosX, 0);
 		animSet(23, PosY, 0);
-		if (_shoot_78F2 || _progressMSB >= 4)
+		if (_abortFight || _progressMSB >= 4)
 			return;
 
 		uint16 in = _vm->input().singleFrameControllerFlagsRemapped;
@@ -407,7 +411,7 @@ void ActionSequenceHandler::handleWeaponDrawAndTargetSelection() {
 			r = Util::rngMakeNumber() & 0x0F;
 			animSet(23, PosY, r - 8);
 			animSet(22, PosX, animGet(22, PosX) + r - 8);
-			_enemyAttackTimer = (_enemyAttackSpeed >> 2) + 24;
+			_enemyAttackTimer = (_enemySpeed >> 2) + 24;
 		}
 		_weaponState -= 2;
 	}
@@ -415,13 +419,13 @@ void ActionSequenceHandler::handleWeaponDrawAndTargetSelection() {
 
 void ActionSequenceHandler::handleShot() {
 	if (_useLightGun) {
-		// Weirdly, during the calibration they substract an offset, but not here. When testing with an emulator,
-		// the aiming is not satisfactory either, so I guess this is either an original bug or it really does
-		// behave differently with a real light gun (y-coords aren't that eays to get there, depending on the
+		// Weirdly, during the calibration, the original substracts an y-offset, but not here. When testing with an
+		// emulator, the aiming is not satisfactory either, so I guess this is either an original bug or it really
+		// does behave differently with a real light gun (y-coords aren't that easy to get there, depending on the
 		// TV, the distance from the TV etc.).
 		const int16 yOffs = -24;
 
-		int16 v = animGet(21, F2c);
+		int16 v = animGet(21, ActionTimer);
 		if (v && ++v >= 2) {
 			v = 0;
 			_targetField = 0;
@@ -434,7 +438,7 @@ void ActionSequenceHandler::handleShot() {
 			else if (_vm->input().lightGunPos.y + yOffs>= 48)
 				_targetField += 3;
 		}
-		animSet(21, F2c, v);
+		animSet(21, ActionTimer, v);
 	}
 
 	uint16 in = _vm->input().singleFrameControllerFlagsRemapped;
@@ -445,7 +449,7 @@ void ActionSequenceHandler::handleShot() {
 		loop = false;
 		switch (_handleShotPhase) {
 		case 0:
-			if (animGet(21, Enable) || animGet(21, F17) != 0xFF || _progressMSB == 4 || _weaponState != 1)
+			if (animGet(21, Enable) || (animGet(21, Target) != 0xFF) || _progressMSB == 4 || _weaponState != 1)
 				break;
 			if ((!_useLightGun && ((in & 0x40) || !(in & 0x20))) || (_useLightGun && ((in & 0x200) || !(in & 0x100))))
 				break;
@@ -454,14 +458,14 @@ void ActionSequenceHandler::handleShot() {
 			++_result.shotsFired;
 			_handleShotPhase = 4;
 			if (_useLightGun)
-				animSet(21, F2c, 1);
+				animSet(21, ActionTimer, 1);
 			break;
 
 		case 1:
 			animSet(21, Enable, 1);
 			animSet(21, FrameDelay, 2);
 			animSet(21, Frame, 0);
-			animSet(21, F17, tf);
+			animSet(21, Target, tf);
 			animSet(21, PosX, (_scd->makePtr(0x11FEC) + (tf << 1)).readSINT16());
 			animSet(21, PosY, (_scd->makePtr(0x11FFE) + (tf << 1)).readSINT16());
 			_vm->sound()->pcmSendCommand(_scd->makePtr(0x11F30)[_stage], -1);
@@ -482,13 +486,13 @@ void ActionSequenceHandler::handleShot() {
 			break;
 
 		case 3:
-			tf = animGet(21, F17);
+			tf = animGet(21, Target);
 			vl = animGet(32 + tf, F24) & 0x0F;
 			if (vl < 2 || vl > 4) {
 				if (_stage != 10) {
 					if (_useLightGun || _scd->makePtr(0x11FD0)[_stage] == 0) {
-						if (_enemyAttackSpeed < ((_stage == 0 || _stage == 11 || !_useLightGun) ? 32 : 48))
-								++_enemyAttackSpeed;
+						if (_enemySpeed < ((_stage == 0 || _stage == 11 || !_useLightGun) ? 32 : 48))
+								++_enemySpeed;
 					}
 
 					if (++_result.shotsMissed == 0)
@@ -499,8 +503,8 @@ void ActionSequenceHandler::handleShot() {
 				vl = animGet(32 + tf, F24) & 0xF0;
 				animSet(32 + tf, F24, vl | 6);
 				if ((vl >> 4) & 1) {
-					if ((_result.enemiesShot & 7) == 7 && _enemyAttackSpeed >= 2)
-						_enemyAttackSpeed -= 2;
+					if ((_result.enemiesShot & 7) == 7 && _enemySpeed >= 2)
+						_enemySpeed -= 2;
 					++_result.enemiesShot;
 
 					if (_stage == 0 || _stage == 11) {
@@ -512,15 +516,15 @@ void ActionSequenceHandler::handleShot() {
 
 				} else {
 					++_result.civiliansShot;
-					if (_enemyAttackSpeed >= 2)
-						_enemyAttackSpeed -= 2;
+					if (_enemySpeed >= 2)
+						_enemySpeed -= 2;
 					if (_scd->makePtr(0x11FD0)[_stage] == 0)
 						_vm->sound()->pcmSendCommand(14, -1);
 				}
 
 				if (_stage == 9) {
 					_vm->allowLightGunInput(false);
-					_shoot_78F2 = 1;
+					_abortFight = 1;
 				}
 			}
 			if (_stage == 10) {
@@ -528,8 +532,8 @@ void ActionSequenceHandler::handleShot() {
 					_vm->sound()->pcmSendCommand(50, -1);
 					_vm->sound()->fmSendCommand(19, 0);
 					if (_result.hitsTaken < 6) {
-						vl = animGet(48, F2c) - 1;
-						animSet(48, F2c, vl);
+						vl = animGet(48, ActionTimer) - 1;
+						animSet(48, ActionTimer, vl);
 						(_scd->makePtr(0x12EA8) + 6).writeUINT16((_scd->makePtr(0x12EBC) + (vl << 1)).readUINT16());
 						_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x12EA8));
 						++_result.hitsTaken;
@@ -541,7 +545,7 @@ void ActionSequenceHandler::handleShot() {
 				}
 			}
 
-			animSet(21, F17, 0xFF);
+			animSet(21, Target, 0xFF);
 			animSet(21, Enable, 0);
 			_handleShotPhase = 0;
 
@@ -549,13 +553,13 @@ void ActionSequenceHandler::handleShot() {
 
 		case 4:
 			++_handleShotPhase;
-			if (_enemyAttackSpeed < 16)
+			if (_enemySpeed < 16)
 				loop = true;
 			break;
 
 		case 5:
 			_handleShotPhase = 1;
-			if (_enemyAttackSpeed < 4)
+			if (_enemySpeed < 4)
 				loop = true;
 			break;
 
@@ -597,8 +601,8 @@ void ActionSequenceHandler::updateEnemies() {
 			if (b == 1) {
 				animSet(i, ControlFlags, GraphicsEngine::kAnimNone);
 			} else if (b < 5) {
-				a = animGet(i, F2c) - 1;
-				animSet(i, F2c, a);
+				a = animGet(i, ActionTimer) - 1;
+				animSet(i, ActionTimer, a);
 			}
 			if (b > 1 && b < 5 && a >= 0)
 				break;
@@ -607,8 +611,9 @@ void ActionSequenceHandler::updateEnemies() {
 			if (a == animGet(i, Frame)) {
 				animSet(i, Frame, a + 2);
 				animSet(i, F24, animGet(i, F24) + 1);
+				debug("Enemy %d F24: %d -> %d", i, a-1, a);
 				a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
-				animSet(i, F2c, a + _enemyAttackSpeed);
+				animSet(i, ActionTimer, a + _enemySpeed);
 			}
 
 			if (b == 1)
@@ -616,7 +621,7 @@ void ActionSequenceHandler::updateEnemies() {
 
 			if ((animGet(i, F24) & 0x0F) == b) {
 				if (b < 5)
-					animSet(i, F2c, 0);
+					animSet(i, ActionTimer, 0);
 				break;
 			}
 
@@ -646,7 +651,7 @@ void ActionSequenceHandler::updateEnemies() {
 				animSet(i, F24, (animGet(i, F24) & 0xF0) + 7 - b);
 				animSet(i, Frame, _vm->gfx()->getAnimScriptByte(i, 6 - b) + 2);
 				a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
-				animSet(i, F2c, a + _enemyAttackSpeed);
+				animSet(i, ActionTimer, a + _enemySpeed);
 			}
 			break;
 
@@ -654,7 +659,7 @@ void ActionSequenceHandler::updateEnemies() {
 			animSet(i, F24, (animGet(i, F24) & 0xF0) + 7);
 			animSet(i, Frame, _vm->gfx()->getAnimScriptByte(i, 6));
 			a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
-			animSet(i, F2c, a + _enemyAttackSpeed);
+			animSet(i, ActionTimer, a + _enemySpeed);
 			break;
 
 		case 7:
@@ -663,7 +668,7 @@ void ActionSequenceHandler::updateEnemies() {
 				animSet(i, Frame, a + 2);
 				animSet(i, F24, animGet(i, F24) + 1);
 				a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
-				animSet(i, F2c, a + _enemyAttackSpeed);
+				animSet(i, ActionTimer, a + _enemySpeed);
 			}
 
 			if ((animGet(i, F24) & 0x0F) != 8)
@@ -697,7 +702,7 @@ void ActionSequenceHandler::updateStage() {
 		if (_shoot_78EC == _scd->makePtr(_useLightGun ? 0x11FC0 : 0x11FB0)[_stage])
 			return;
 
-		_nextEnemyAppearanceTimer = 16 + _enemyAttackSpeed + (_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1);
+		_nextEnemyAppearanceTimer = 16 + _enemySpeed + (_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1);
 		if (_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] >= 7)
 			_nextEnemyAppearanceTimer = 5;
 		_updateEnemiesPhase = 1;
@@ -800,8 +805,8 @@ void ActionSequenceHandler::enemyAttack() {
 		else
 			_vm->sound()->fmSendCommand(19, 0);
 		if (_result.hitsTaken < 6) {
-			int16 vl = animGet(48, F2c) - 1;
-			animSet(48, F2c, vl);
+			int16 vl = animGet(48, ActionTimer) - 1;
+			animSet(48, ActionTimer, vl);
 			(_scd->makePtr(0x12EA8) + 6).writeUINT16((_scd->makePtr(0x12EBC) + (vl << 1)).readUINT16());
 			_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x12EA8));
 			++_result.hitsTaken;
diff --git a/engines/snatcher/action.h b/engines/snatcher/action.h
index 6c55129085f..9f947d740d2 100644
--- a/engines/snatcher/action.h
+++ b/engines/snatcher/action.h
@@ -41,6 +41,7 @@ public:
 	bool run(bool useLightGun);
 	bool resetScore();
 	void setup(uint16 stage);
+	void setDifficulty(uint16 setting);
 
 	struct Result {
 		Result() : hitsTaken(0), shotsFired(0), shotsMissed(0), enemiesShot(0), civiliansShot(0), allCiviliansShot(0), weaponDrawn(0)  {}
@@ -69,7 +70,7 @@ private:
 	int16 _progressMSB;
 	int16 _progressLSB;
 	int16 _weaponState;
-	int16 _enemyAttackSpeed;
+	int16 _enemySpeed;
 	int16 _handleShotPhase;
 	int16 _updateEnemiesPhase;
 	int16 _enemyAttackStatus;
@@ -80,7 +81,7 @@ private:
 	int16 _shoot_7912;
 	int16 _civiliansShot;
 	int16 _civilianAppearanceCount;
-	int16 _shoot_78F2;
+	int16 _abortFight;
 	int16 _nextEnemyAppearanceTimer;
 	int16 _animNo;
 	int16 _enemyAttackTimer;
diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index 6676815c9b7..172c23420f5 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -37,11 +37,11 @@
 
 namespace Snatcher {
 
-//#define		ANIM_DEBUG
+#define		ANIM_DEBUG
 
 struct AnimObject {
-	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), palette(0), f17(0), f18(0), f1c(0),
-		timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), f2c(0), f2d(0), spriteTableLocation(0),
+	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), palette(0), target(0), f18(0), f1c(0),
+		timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), actionTimer(0), spriteTableLocation(0),
 			res(), scriptData(), spriteData(nullptr), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), scriptComFlags(0), freeze(0), blink(0), blinkCounter(0), blinkDuration(0) {}
 
 	void clear() {
@@ -49,14 +49,14 @@ struct AnimObject {
 		posX = posY = 0;
 		relSpeedX = relSpeedY = 0;
 		palette = 0;
-		f17 = f18 = 0;
+		target = f18 = 0;
 		f1c = 0;
 		timeStamp = 0;
 		f24 = 0;
 		controlFlags = allowFrameDrop = frameSeqCounter = 0;
 		frame = 0;
 		frameDelay = 0;
-		f2c = f2d = 0;
+		actionTimer = 0;
 		spriteTableLocation = 0;
 		res = ResourcePointer();
 		scriptData = ResourcePointer();
@@ -75,7 +75,7 @@ struct AnimObject {
 	int32 relSpeedX;
 	int32 relSpeedY;
 	uint8 palette;
-	uint16 f17;
+	uint16 target;
 	uint16 f18;
 	uint8 f1c;
 	uint32 timeStamp;
@@ -85,8 +85,7 @@ struct AnimObject {
 	uint8 frameSeqCounter;
 	uint16 frame;
 	int16 frameDelay;
-	uint8 f2c;
-	uint8 f2d;
+	int16 actionTimer;
 	uint32 spriteTableLocation;
 	ResourcePointer res;
 	ResourcePointer scriptData;
@@ -150,7 +149,7 @@ private:
 	void updateScrollState();
 
 	void generateSpriteData(AnimObject &a, uint16 &spritesCurIndex, uint16 *&spritesBufferCurPos);
-	void updateAnim32Spec(AnimObject &a);
+	void generateSnowSprites(uint16 &spritesCurIndex, uint16 *&spritesBufferCurPos);
 	bool reachedAudioTimeStamp(AnimObject &a) const;
 	void runAnimScript(AnimObject &a);
 
@@ -165,7 +164,7 @@ private:
 	uint16 _clearFlags;
 	uint8 _mode;
 	uint8 _modeChange;
-	uint16 _frameCount3Dwn;
+	uint16 _frameCountDown;
 	Graphics::SegaRenderer *_sr;
 	Palette *_pal;
 	TransitionManager *_trs;
@@ -234,7 +233,7 @@ private:
 	int anim_hide(AnimObject &a, const uint8 *data);
 	int anim_setScriptComFlag(AnimObject &a, const uint8 *data);
 	int anim_audioSync(AnimObject &a, const uint8 *data);
-	int anim_27(AnimObject &a, const uint8 *data);
+	int anim_protect(AnimObject &a, const uint8 *data);
 	int anim_28(AnimObject &a, const uint8 *data);
 	int anim_fmSoundEffect(AnimObject &a, const uint8 *data);
 	int anim_30(AnimObject &a, const uint8 *data);
@@ -268,7 +267,7 @@ private:
 };
 
 Animator_SCD::Animator_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd, bool enableAspectRatioCorrection) : Animator(state), _pal(pal), _trs(scr), _snd(snd), _mode(1),
-	_modeChange(0), _screenWidth(256), _screenHeight(224), _transferData(), _transferMode(0), _transferDelay(0), _clearFlags(0), _tempBuffer(nullptr), _spriteBuffer(nullptr), _sr(nullptr), _frameCount3Dwn(0),
+	_modeChange(0), _screenWidth(256), _screenHeight(224), _transferData(), _transferMode(0), _transferDelay(0), _clearFlags(0), _tempBuffer(nullptr), _spriteBuffer(nullptr), _sr(nullptr), _frameCountDown(0),
 		_animations(nullptr), _drawCommands(nullptr), _hINTClientProc(Graphics::SegaRenderer::HINTHandler(this, &Graphics::SegaRenderer::HINTClient::hINTCallback)), _realScreenWidth(0), _realScreenHeight(0),
 			_bootsDelay(0), _bootsSprTbl(nullptr), _bootsTotalFrames(0), _bootsHScroll(0), _bootsVScroll(0), _bootsCol(0) {
 
@@ -407,7 +406,7 @@ void Animator_SCD::clearAnimations(int mode) {
 
 void Animator_SCD::setPlaneMode(uint16 mode) {
 	assert(mode >> 8 == 0);
-	_modeChange = mode & 0xFF;;
+	_modeChange = mode & 0xFF;
 }
 
 void Animator_SCD::resetTextFields() {
@@ -514,6 +513,9 @@ void Animator_SCD::setAnimParameter(uint8 animObjId, int param, int32 value) {
 	assert(animObjId < 64);
 	AnimObject &a = *_animations[animObjId];
 
+	if (animObjId == 36)
+		debug("%s(): animObjId: %d, param: %d, value: %d", __FUNCTION__, animObjId, param, value);
+
 	switch (param) {
 	case GraphicsEngine::kAnimParaEnable:
 		a.enable = value ? 1 : 0;
@@ -539,8 +541,8 @@ void Animator_SCD::setAnimParameter(uint8 animObjId, int param, int32 value) {
 	case GraphicsEngine::kAnimParaPalette:
 		a.palette = value;
 		break;
-	case GraphicsEngine::kAnimParaF17:
-		a.f17 = value;
+	case GraphicsEngine::kAnimParaTarget:
+		a.target = value;
 		break;
 	case GraphicsEngine::kAnimParaF18:
 		a.f18 = value;
@@ -569,11 +571,8 @@ void Animator_SCD::setAnimParameter(uint8 animObjId, int param, int32 value) {
 	case GraphicsEngine::kAnimParaFrameDelay:
 		a.frameDelay = value;
 		break;
-	case GraphicsEngine::kAnimParaF2c:
-		a.f2c = value;
-		break;
-	case GraphicsEngine::kAnimParaF2d:
-		a.f2d = value;
+	case GraphicsEngine::kAnimParaActionTimer:
+		a.actionTimer = value;
 		break;
 	case GraphicsEngine::kAnimParaBlink:
 		a.blink = value ? 1 : 0;
@@ -630,8 +629,8 @@ int32 Animator_SCD::getAnimParameter(uint8 animObjId, int param) const {
 		return a.relSpeedY >> 16;
 	case GraphicsEngine::kAnimParaPalette:
 		return a.palette;
-	case GraphicsEngine::kAnimParaF17:
-		return a.f17;
+	case GraphicsEngine::kAnimParaTarget:
+		return a.target;
 	case GraphicsEngine::kAnimParaF18:
 		return a.f18;
 	case GraphicsEngine::kAnimParaF1c:
@@ -650,10 +649,8 @@ int32 Animator_SCD::getAnimParameter(uint8 animObjId, int param) const {
 		return a.frame;
 	case GraphicsEngine::kAnimParaFrameDelay:
 		return a.frameDelay;
-	case GraphicsEngine::kAnimParaF2c:
-		return a.f2c;
-	case GraphicsEngine::kAnimParaF2d:
-		return a.f2d;
+	case GraphicsEngine::kAnimParaActionTimer:
+		return a.actionTimer;
 	case GraphicsEngine::kAnimParaBlink:
 		return a.blink;
 	case GraphicsEngine::kAnimParaBlinkCounter:
@@ -676,6 +673,7 @@ int32 Animator_SCD::getAnimParameter(uint8 animObjId, int param) const {
 
 uint8 Animator_SCD::getAnimScriptByte(uint8 animObjId, uint16 offset) const {
 	assert(animObjId < 64);
+	debug ("%s(): anim %d, scriptdata %p", __FUNCTION__, animObjId, _animations[animObjId]->scriptData());
 	return _animations[animObjId]->scriptData[offset];
 }
 
@@ -875,7 +873,7 @@ void Animator_SCD::drawAnimSprites() {
 		if (a.enable && a.spriteData != nullptr && !(a.controlFlags & GraphicsEngine::kAnimHide) && a.blinkRate != 0xFFFF && !(a.blinkRate & _gfxState.frameCount()))
 			generateSpriteData(a, nxt, d);
 		if (i == 31)
-			updateAnim32Spec(a);
+			generateSnowSprites(nxt, d);
 	}
 
 	if (d - 3 > _spriteBuffer)
@@ -1006,17 +1004,112 @@ void Animator_SCD::generateSpriteData(AnimObject &a, uint16 &spritesCurIndex, ui
 	}
 }
 
-void Animator_SCD::updateAnim32Spec(AnimObject &a) {
-	int _animSpec_activate = 0;
-	switch (_animSpec_activate) {
-	case 0:
+void Animator_SCD::generateSnowSprites(uint16 &spritesCurIndex, uint16 *&spritesBufferCurPos) {
+	uint8 mode = _gfxState.getVar(12);
+	if (mode == 0)
+		return;
 
-		break;
-	case 1:
-	case 2:
-		break;
-	default:
-		break;
+	static const uint8 xcoords[] = {
+		0xb8, 0x18, 0x50, 0xd8, 0x30, 0xa8, 0x80, 0xc4, 0x78, 0x10, 0xc8, 0x68, 0x40, 0xf8, 0x70, 0xa0,
+		0x38, 0xe8, 0x58, 0xb0, 0x08, 0x9c, 0x90, 0x5c, 0x28, 0xa4, 0x70, 0x20, 0x60, 0xd0, 0xe0, 0x7c
+	};
+
+	uint16 h = _gfxState.frameCount() >> 1;
+
+	if (mode < 3) {
+		static const uint16 tiles[] = { 
+			0x0301, 0x0303, 0x0305, 0x0302, 0x0448, 0x0448,	0x0448, 0x0448, 0x044c, 0x044c, 0x044c, 0x044c
+		};
+		static const int8 xoffs[] = {
+			-1, 0, 1, -1, 0, 1, -1, 0, -1, 1, -1, 1, 0, -1, 0, -1
+		};
+		
+		uint16 mi = (mode - 1) << 3;
+
+		for (int i = (mode ^ 3) << 4; i >= 0 && spritesCurIndex < 65; --i) {
+			uint16 tl = FROM_BE_16(spritesBufferCurPos[2]);
+			uint16 x = (FROM_BE_16(spritesBufferCurPos[3]) & 0xFF) - 0x80;
+
+			uint16 ci = spritesCurIndex - 1;
+			uint16 y = ((spritesCurIndex & 3) ? ((ci << 4) + h) >> 1 : ((ci ^ 0xFF) << 3) + h) + 8;
+
+			if (tiles[((((ci + x) >> 2) & 6) + mi) >> 1] == (tl & 0x7FF)) {
+				tl = 0x2000;
+				x = xcoords[ci & 0x1F];
+			}
+
+			x = (xoffs[(ci + h) & 0x0F] + x) & 0xFF;
+			if (x >= (mode == 2 ? 56 : 32)) {
+				if (x >= (mode == 2 ? 176 : 224))
+					y = 0;
+				if (y >= (mode == 2 ? 120 : 136))
+					y = 0;
+			} else {
+				y = 0;
+			}
+
+			tl = (tl & 0xF800) | tiles[((((ci + x) >> 2) & 6) + mi) >> 1];
+
+			*spritesBufferCurPos++ = TO_BE_16(y + 0x80);
+			*spritesBufferCurPos++ = TO_BE_16((mode == 2 ? 0x500 : 0) | (spritesCurIndex++));
+			*spritesBufferCurPos++ = TO_BE_16(tl);
+			*spritesBufferCurPos++ = TO_BE_16(x + 0x80);		
+		}
+
+	} else if (mode < 13) {
+		static const uint16 tiles[] = { 
+			0x03C4, 0x03C8, 0x03CC, 0x03D0, 0x03D4, 0x03D8
+		};
+		static const uint8 xoffsm[] = {
+			0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
+			0x01, 0x00, 0x01, 0x01, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x00, 0x01, 0x02, 0x01,
+			0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x02, 0x01,
+			0x01, 0x02, 0x01, 0x03, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x03,
+			0x02, 0x03, 0x01, 0x02, 0x03, 0x01, 0x02, 0x01, 0x01, 0x02, 0x02, 0x03, 0x02, 0x02, 0x02, 0x01,
+			0x02, 0x04, 0x03, 0x03, 0x02, 0x01, 0x03, 0x03, 0x04, 0x03, 0x04, 0x02, 0x03, 0x02, 0x02, 0x03,
+			0x04, 0x05, 0x03, 0x02, 0x05, 0x04, 0x04, 0x02, 0x03, 0x04, 0x05, 0x03, 0x04, 0x05, 0x03, 0x04,
+			0x04, 0x05, 0x04, 0x04, 0x04, 0x03, 0x05, 0x04, 0x03, 0x04, 0x03, 0x05, 0x04, 0x04, 0x03, 0x04
+		};
+		static const uint8 xoffsf[] = {
+			0x00, 0x08, 0x10, 0x20, 0x28, 0x16, 0x18, 0x00
+		};
+
+		uint16 mi = (mode - 3) << 4;
+
+		for (int i = 32; i >= 0 && spritesCurIndex < 65; --i) {
+			uint16 tl = FROM_BE_16(spritesBufferCurPos[2]);
+			int16 x = (FROM_BE_16(spritesBufferCurPos[3]) & 0xFF) - 0x80;
+
+			int16 ci = spritesCurIndex - 1;
+			int16 y = ((spritesCurIndex & 3) ? ((ci << 4) + h) >> 1 : ((ci ^ 0xFF) << 3) + h) & 0x7F;
+
+			if (tiles[(((ci + x) >> 2) & 6) >> 1] == (tl & 0x7FF)) {
+				tl = 0x4000;
+				x = xcoords[ci & 0x1F];
+			}
+
+			if (x < 128) {
+				x -= xoffsm[((ci + h) & 0x0F) + mi];
+				//if (x < 16)
+				//	x = 127 - xoffsf[_gfxState.frameCount() & 7];
+			} else {
+				x = (x + xoffsm[((ci + h) & 0x0F) + mi]) & 0xFF;
+				//if (x >= 216)
+				//	x = 128 + xoffsf[_gfxState.frameCount() & 7];
+			}
+
+			if (x < 16)
+				y = 0;
+			else if (y >= 112)
+				y = -4;
+
+			tl = (tl & 0xF800) | tiles[(((ci + x) >> 2) & 6) >> 1];
+
+			*spritesBufferCurPos++ = TO_BE_16(y + 0x80);
+			*spritesBufferCurPos++ = TO_BE_16(0x500 | (spritesCurIndex++));
+			*spritesBufferCurPos++ = TO_BE_16(tl);
+			*spritesBufferCurPos++ = TO_BE_16(x + 0x80);
+		}
 	}
 }
 
@@ -1091,7 +1184,7 @@ void Animator_SCD::makeAnimFunctions() {
 		ANM(setScriptComFlag),
 		ANM(audioSync),
 		ANM(audioSync),
-		ANM(27),
+		ANM(protect),
 		ANM(28),
 		ANM(fmSoundEffect),
 		ANM(30),
@@ -1267,7 +1360,7 @@ int Animator_SCD::anim_audioSync(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Animator_SCD::anim_27(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_protect(AnimObject &a, const uint8 *data) {
 	a.scriptComFlags |= 1;
 	_gfxState.setVar(4, *data);
 	return 1;
@@ -1351,7 +1444,7 @@ int Animator_SCD::anim_speechSync(AnimObject &a, const uint8 *data) {
 }
 
 int Animator_SCD::anim_42(AnimObject &a, const uint8 *data) {
-	_frameCount3Dwn = *data ? _gfxState.frameCount2() - _frameCount3Dwn : _gfxState.frameCount2();
+	_frameCountDown = *data ? _gfxState.frameCount2() - _frameCountDown : _gfxState.frameCount2();
 	return 1;
 }
 
@@ -1393,7 +1486,9 @@ int Animator_SCD::anim_updateFrameDelay(AnimObject &a, const uint8 *data) {
 
 void Animator_SCD::anim_setGroupParameter(AnimObject &a, int para, int16 val, bool recursive) {
 	AnimObject *ta = &a;
-	for (int n = ta->children; n || !recursive; n = recursive ? ta->next : 0) {
+	bool root = !recursive;
+	for (int n = ta->children; n || root; n = recursive ? ta->next : 0) {
+		root = false;
 		if (recursive)
 			ta = _animations[n];
 		switch (para) {
@@ -1430,9 +1525,7 @@ void Animator_SCD::anim_setGroupParameter(AnimObject &a, int para, int16 val, bo
 		default:
 			error("%s(): unhandled para %d", __FUNCTION__, para);
 			break;
-
 		}
-		recursive = true;
 		anim_setGroupParameter(*ta, para, val, true);
 	}
 }
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index c6d48a8fafb..070de1209f3 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -104,7 +104,7 @@ public:
 		kAnimParaRelSpeedX,
 		kAnimParaRelSpeedY,
 		kAnimParaPalette,
-		kAnimParaF17,
+		kAnimParaTarget,
 		kAnimParaF18,
 		kAnimParaF1c,
 		kAnimParaTimeStamp,
@@ -114,8 +114,7 @@ public:
 		kAnimParaFrameSeqCounter,
 		kAnimParaFrame,
 		kAnimParaFrameDelay,
-		kAnimParaF2c,
-		kAnimParaF2d,
+		kAnimParaActionTimer,
 		kAnimParaBlink,
 		kAnimParaBlinkCounter,
 		kAnimParaBlinkDuration,
@@ -210,7 +209,7 @@ public:
 		}
 
 	private:
-		uint8 vars[12];
+		uint8 vars[13];
 		uint16 frameCounter;
 		const VMInfo &vm;
 	};
diff --git a/engines/snatcher/memory.cpp b/engines/snatcher/memory.cpp
index 088aaf831f6..c5e5e6590a9 100644
--- a/engines/snatcher/memory.cpp
+++ b/engines/snatcher/memory.cpp
@@ -21,6 +21,7 @@
 
 
 #include "snatcher/action.h"
+#include "snatcher/graphics.h"
 #include "snatcher/memory.h"
 #include "snatcher/saveload.h"
 #include "snatcher/snatcher.h"
@@ -70,6 +71,12 @@ uint16 MemAccessHandler::readWord(uint16 addr) {
 		break;
 	case 0x79F0:
 		break;
+	case 0x96D6:
+		result = _ui->getFlashLightStatus().inputFlags;
+		break;
+	case 0x96DC:
+		result = _ui->getFlashLightStatus().posData;
+		break;
 	case 0x971A:
 		break;
 	default:
@@ -81,6 +88,12 @@ uint16 MemAccessHandler::readWord(uint16 addr) {
 
 void MemAccessHandler::writeWord(uint16 addr, uint16 val) {
 	switch (addr) {
+	case 0x78E2:
+		_aseq->setDifficulty(val);
+		break;
+	case 0x79EE:
+		_vm->gfx()->setVar(12, val);
+		break;
 	case 0x79F0:
 		break;
 	case 0x9718:
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index d82ddd40ec8..ef88b737d48 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -9,9 +9,10 @@ MODULE_OBJS := \
 	palette_scd.o \
 	resource.o \
 	saveload.o \
-	scene/scene_d0.o \
-	scene/scene_d1.o \
-	scene/scene_d2.o \
+	scene_d0.o \
+	scene_d1.o \
+	scene_d2.o \
+	scene_y16.o \
 	script.o \
 	snatcher.o \
 	sound.o \
diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index cb913b9a717..31b9e4d804d 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -90,8 +90,8 @@ private:
 
 	void setHINTHandler(uint8 num);
 
+	void hIntHandler_dummy(Graphics::SegaRenderer*) {}
 	void hIntHandler_characterChatPortraitPalette(Graphics::SegaRenderer *sr);
-	void hIntHandler_28(Graphics::SegaRenderer *sr);
 	int _transitionStep;
 };
 
@@ -113,7 +113,7 @@ SCDPalette::SCDPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, Gra
 #undef P_OP
 
 	_hINTProcs.push_back(new HINTFunc(this, &SCDPalette::hIntHandler_characterChatPortraitPalette));
-	_hINTProcs.push_back(new HINTFunc(this, &SCDPalette::hIntHandler_28));
+	_hINTProcs.push_back(new HINTFunc(this, &SCDPalette::hIntHandler_dummy));
 
 	_eventQueue = _eventCurPos = new PalEventSCD[12];
 	_colors = new uint16[128]();
@@ -261,7 +261,7 @@ void SCDPalette::update() {
 		_gfxState.setFlag(7, 0);
 		_gfxState.setVar(11, 0);
 	} else if (_gfxState.getVar(11)) {
-		setHINTHandler(0);;
+		setHINTHandler(0);
 	}
 
 	bool palChanged = false;
@@ -509,10 +509,6 @@ void SCDPalette::hIntHandler_characterChatPortraitPalette(Graphics::SegaRenderer
 	sr->hINT_enable(false);
 }
 
-void SCDPalette::hIntHandler_28(Graphics::SegaRenderer *sr) {
-
-}
-
 Palette *Palette::createSegaPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state) {
 	return new SCDPalette(pxf, pm, state);
 }
diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index 0c87eb83d23..7e88550786e 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -65,7 +65,6 @@ uint8 *FIO::fileData(int index, uint32 *fileSize) {
 }
 
 uint8 *FIO::fileData(const Common::Path &file, uint32 *fileSize) {
-	debug("%s(): Loading file %s", __FUNCTION__, file.baseName().c_str());
 	Common::SeekableReadStream *s = readStream(file);
 
 	uint32 size = s ? s->size() : 0;
@@ -89,7 +88,6 @@ Common::SeekableReadStream *FIO::readStream(int index) {
 }
 
 Common::SeekableReadStream *FIO::readStream(const Common::Path &file) {
-	debug("%s(): Loading file %s", __FUNCTION__, file.baseName().c_str());
 	return _files.createReadStreamForMember(file);
 }
 
@@ -302,7 +300,7 @@ SceneModule::SHFactory *const SceneModule::_shList[97] = {
 	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
 	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
 	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
-	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
+	INVALD, INVALD, INVALD, INVALD, S(Y16), INVALD, INVALD, INVALD,
 	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
 	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
 	INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD, INVALD,
diff --git a/engines/snatcher/scene.h b/engines/snatcher/scene.h
index ef3fb1ed555..f365d56622f 100644
--- a/engines/snatcher/scene.h
+++ b/engines/snatcher/scene.h
@@ -35,6 +35,7 @@ class FIO;
 declSHF(D0);
 declSHF(D1);
 declSHF(D2);
+declSHF(Y16);
 
 #undef declSHF
 
diff --git a/engines/snatcher/scene/scene_d0.cpp b/engines/snatcher/scene_d0.cpp
similarity index 100%
rename from engines/snatcher/scene/scene_d0.cpp
rename to engines/snatcher/scene_d0.cpp
diff --git a/engines/snatcher/scene/scene_d1.cpp b/engines/snatcher/scene_d1.cpp
similarity index 100%
rename from engines/snatcher/scene/scene_d1.cpp
rename to engines/snatcher/scene_d1.cpp
diff --git a/engines/snatcher/scene/scene_d2.cpp b/engines/snatcher/scene_d2.cpp
similarity index 100%
rename from engines/snatcher/scene/scene_d2.cpp
rename to engines/snatcher/scene_d2.cpp
diff --git a/engines/snatcher/scene_y16.cpp b/engines/snatcher/scene_y16.cpp
new file mode 100644
index 00000000000..7f34dc2ae7b
--- /dev/null
+++ b/engines/snatcher/scene_y16.cpp
@@ -0,0 +1,257 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#include "snatcher/snatcher.h"
+#include "snatcher/graphics.h"
+#include "snatcher/sound.h"
+#include "snatcher/resource.h"
+#include "snatcher/scene_imp.h"
+#include "common/endian.h"
+
+namespace Snatcher {
+
+SH_HEAD_BEGIN(Y16)
+// declarations
+SH_DCL_FRM(00)
+SH_DCL_FRM(01)
+SH_DCL_FRM(02)
+SH_DCL_FRM(04)
+SH_DCL_FRM(06)
+SH_DCL_FRM(08)
+SH_DCL_FRM(10)
+SH_DCL_FRM(12)
+SH_DCL_FRM(13)
+SH_DCL_FRM(14)
+SH_DCL_FRM(15)
+SH_DCL_FRM(16)
+SH_DCL_FRM(17)
+SH_DCL_FRM(18)
+SH_DCL_FRM(19)
+SH_DCL_FRM(20)
+SH_DCL_FRM(21)
+SH_DCL_FRM(22)
+SH_DCL_FRM(23)
+SH_DCL_FRM(25)
+SH_DCL_FRM(26)
+SH_DCL_FRM(27)
+
+const uint32 *_timeStamp;
+
+SH_HEAD_END(Y16)
+
+SH_IMP_FRMTBL(Y16) {
+	SH_FRM(Y16, 00),
+	SH_FRM(Y16, 01),
+	SH_FRM(Y16, 02),
+	SH_FRM(Y16, 01),
+	SH_FRM(Y16, 04),
+	SH_FRM(Y16, 01),
+	SH_FRM(Y16, 06),
+	SH_FRM(Y16, 01),
+	SH_FRM(Y16, 08),
+	SH_FRM(Y16, 01),
+	SH_FRM(Y16, 10),
+	SH_FRM(Y16, 01),
+	SH_FRM(Y16, 12),
+	SH_FRM(Y16, 13),
+	SH_FRM(Y16, 14),
+	SH_FRM(Y16, 15),
+	SH_FRM(Y16, 16),
+	SH_FRM(Y16, 17),
+	SH_FRM(Y16, 18),
+	SH_FRM(Y16, 19),
+	SH_FRM(Y16, 20),
+	SH_FRM(Y16, 21),
+	SH_FRM(Y16, 22),
+	SH_FRM(Y16, 23),
+	SH_FRM(Y16, 22),
+	SH_FRM(Y16, 25),
+	SH_FRM(Y16, 26),
+	SH_FRM(Y16, 27)
+};
+
+SH_IMP_CTOR(Y16) {
+	SH_CTOR_MAKEPROCS(Y16);
+
+	uint32 *t = new uint32[28];
+	const uint8 *in = _module->getPtr(0x290FE)();
+	for (int i = 0; i < 28; ++i) {
+		t[i] = READ_BE_UINT32(in);
+		in += 6;
+	}
+	_timeStamp = t;
+}
+
+SH_IMP_DTOR(Y16)	{
+	SH_DTOR_DELPROCS(Y16);
+	delete[] _timeStamp;
+}
+
+SH_IMPL_UPDT(Y16) {
+	if (state.frameNo == -1) {
+		if (state.frameState == 0) {
+			_vm->sound()->cdaPlay(19);
+			++state.frameState;
+		} else if (_vm->sound()->cdaIsPlaying()) {
+			state.frameNo = 0;
+			state.frameState = 0;
+		}
+		return;
+	}
+
+	if (state.frameNo >= (int)_frameProcs.size() || !_frameProcs[state.frameNo]->isValid()) {
+		error("%s(): Invalid call to frame proc %d", __FUNCTION__, state.frameNo);
+	} else if (_vm->sound()->cdaGetTime() >= _timeStamp[state.frameNo]) {
+		(*_frameProcs[state.frameNo])(state);
+		++state.frameNo;
+	}
+}
+
+SH_IMPL_FRM(Y16, 00) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
+	_vm->gfx()->runScript(_module->getGfxData(), 0);
+}
+
+SH_IMPL_FRM(Y16, 01) {
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2931A));
+}
+
+SH_IMPL_FRM(Y16, 02) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
+	_vm->gfx()->runScript(_module->getGfxData(), 1);
+}
+
+SH_IMPL_FRM(Y16, 04) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
+	_vm->gfx()->runScript(_module->getGfxData(), 2);
+}
+
+SH_IMPL_FRM(Y16, 06) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
+	_vm->gfx()->runScript(_module->getGfxData(), 3);
+}
+
+SH_IMPL_FRM(Y16, 08) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
+	_vm->gfx()->runScript(_module->getGfxData(), 4);
+}
+
+SH_IMPL_FRM(Y16, 10) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
+	_vm->gfx()->runScript(_module->getGfxData(), 5);
+}
+
+SH_IMPL_FRM(Y16, 12) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
+	_vm->gfx()->runScript(_module->getGfxData(), 6);
+}
+
+SH_IMPL_FRM(Y16, 13) {
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x292F0));
+}
+
+SH_IMPL_FRM(Y16, 14) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
+	_vm->gfx()->runScript(_module->getGfxData(), 7);
+}
+
+SH_IMPL_FRM(Y16, 15) {
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x292FE));
+}
+
+SH_IMPL_FRM(Y16, 16) {
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
+	_vm->gfx()->runScript(_module->getGfxData(), 8);
+}
+
+SH_IMPL_FRM(Y16, 17) {
+	if (_vm->sound()->cdaIsPlaying()) {
+		--state.frameNo;
+		return;
+	}
+	state.counter = 300;
+	if (state.saveCount)
+		state.frameNo = 24;
+}
+
+SH_IMPL_FRM(Y16, 18) {
+	if (--state.counter) {
+		--state.frameNo;
+		return;
+	}
+	state.counter = 64;
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x292E2));
+}
+
+SH_IMPL_FRM(Y16, 19) {
+	if (--state.counter) {
+		--state.frameNo;
+		return;
+	}
+}
+
+SH_IMPL_FRM(Y16, 20) {
+	_vm->sound()->cdaPlay(2);
+}
+
+SH_IMPL_FRM(Y16, 21) {
+	if (_vm->sound()->cdaIsPlaying())
+		state.counter = 24;
+	else
+		--state.frameNo;
+}
+
+SH_IMPL_FRM(Y16, 22) {
+	if (--state.counter) {
+		--state.frameNo;
+		return;
+	}
+}
+
+SH_IMPL_FRM(Y16, 23) {
+	state.counter = 300;
+	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
+	_vm->gfx()->runScript(_module->getGfxData(), 9);
+}
+
+SH_IMPL_FRM(Y16, 25) {
+	if (!(_vm->input().singleFrameControllerFlags & 0x80)) {
+		--state.frameNo;
+		return;
+	}
+	state.counter = 64;
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x292E2));
+}
+
+SH_IMPL_FRM(Y16, 26) {
+	if (--state.counter) {
+		--state.frameNo;
+		return;
+	}
+}
+
+SH_IMPL_FRM(Y16, 27) {
+	state.frameNo = 0;
+	state.finish = 1;
+}
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index a70daf634bc..2b2ab2320f0 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -123,7 +123,7 @@ void CmdQueue::makeFunctions() {
 		OP(shooterSequenceRun),
 		OP(fmSfxWait),
 		OP(26),
-		OP(27),
+		OP(cdaSync),
 		OP(fmSoundEffect),
 		OP(pcmBlock),
 		OP(saveGame),
@@ -414,7 +414,12 @@ void CmdQueue::m_fmSfxWait(const uint16 *&data) {
 void CmdQueue::m_26(const uint16 *&data) {
 }
 
-void CmdQueue::m_27(const uint16 *&data) {
+void CmdQueue::m_cdaSync(const uint16 *&data) {
+	uint32 ts = (data[0] & 0xFF) << 24 | (data[1] & 0xFF) << 16 | (data[2] & 0xFF) << 8;
+	if (ts > _vm->sound()->cdaGetTime())
+		return;
+	data += 3;
+	_progress = -1;
 }
 
 void CmdQueue::m_fmSoundEffect(const uint16 *&data) {
@@ -865,8 +870,8 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 		OP(eval_and),
 		OP(eval_and),
 		OP(fmMusicStart),
-		OP(callSubRoutine),
-		OP(12),
+		OP(runSubScript),
+		OP(callSubroutine),
 		OP(cdaPlay),
 		OP(14),
 		OP(fmSoundEffect),
@@ -912,7 +917,7 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 		OP(54),
 		OP(verbOps),
 		OP(57),
-		OP(returnFromSubRoutine),
+		OP(returnFromSubScript),
 		OP(59),
 		OP(59),
 		OP(loadModuleAndStartGfx),
@@ -1004,7 +1009,7 @@ void ScriptEngine::o_fmMusicStart() {
 	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
 }
 
-void ScriptEngine::o_callSubRoutine() {
+void ScriptEngine::o_runSubScript() {
 	if (!evalFinished())
 		return;
 	uint16 m = 0;
@@ -1033,7 +1038,7 @@ void ScriptEngine::o_callSubRoutine() {
 	_script->newPos = READ_BE_UINT16(_script->data + _pos2);
 }
 
-void ScriptEngine::o_12() {
+void ScriptEngine::o_callSubroutine() {
 	uint16 cp = _script->curPos;
 	setArrayLastEntry(5, cp);
 	_pos1 = _script->curPos = READ_BE_UINT16(_script->data + _pos1 + 1);
@@ -1308,9 +1313,7 @@ void ScriptEngine::o_verbOps() {
 	if (ARR_POS(2) == _script->sentencePos) {
 		uint16 val = READ_BE_UINT16(_script->data + _pos2 + 1);
 
-		if (setArrayLastEntry(1, val))
-			debug("ADD verb %d", val);
-		else
+		if (!setArrayLastEntry(1, val))
 			debug("Verb array overflow");
 
 	} else {
@@ -1318,7 +1321,7 @@ void ScriptEngine::o_verbOps() {
 		getArrayEntry(2, _script->sentencePos, val);
 		if (READ_BE_UINT16(_script->data + _pos2 + 1) != val)
 			return;
-		debug("PROCESS verb %d", val);
+
 		++_script->sentencePos;
 		_pos1 += 3;
 
@@ -1340,7 +1343,7 @@ void ScriptEngine::o_57() {
 		--ARR_POS(0);
 }
 
-void ScriptEngine::o_returnFromSubRoutine() {
+void ScriptEngine::o_returnFromSubScript() {
 	uint16 res = 0;
 	popArrayLastEntry(3, res);
 	_script->newPos = res;
@@ -1494,9 +1497,7 @@ void ScriptEngine::o_sysOps() {
 		break;
 	case 10:
 		val = READ_BE_UINT16(_script->data + _pos1 + 4);
-		_ui->setVerbsTabLayout(val);
-		/*if (val == 1)
-			_transDW1 = _transDW2 = 0;*/
+		_ui->setVerbInterfaceMode(val);
 		break;
 	case 11:
 		if (READ_BE_UINT16(_script->data + _pos1 + 4)) {
@@ -1507,10 +1508,13 @@ void ScriptEngine::o_sysOps() {
 		}
 		break;
 	case 12:
+		// This happens when starting a new act. Apparently, only a small portion of the game
+		// variables is needed for the whole game. The rest gets cleared and can be repurposed.
 		_flagsTable[53] &= 0xF8;
 		memset(_flagsTable + 54, 0, 298);
 		break;
 	case 13:
+		// CD-Audio sync
 		_que->writeUInt16(0x1B);
 		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 5));
 		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 8));
diff --git a/engines/snatcher/script.h b/engines/snatcher/script.h
index c1c874d26c0..75b5580cd8b 100644
--- a/engines/snatcher/script.h
+++ b/engines/snatcher/script.h
@@ -26,7 +26,7 @@
 #include "common/func.h"
 #include "common/ptr.h"
 
-//#define		SNATCHER_SCRIPT_DEBUG
+#define		SNATCHER_SCRIPT_DEBUG
 
 namespace Common {
 class SeekableReadStream;
@@ -96,7 +96,7 @@ private:
 	void m_shooterSequenceRun(const uint16 *&data);
 	void m_fmSfxWait(const uint16 *&data);
 	void m_26(const uint16 *&data);
-	void m_27(const uint16 *&data);
+	void m_cdaSync(const uint16 *&data);
 	void m_fmSoundEffect(const uint16 *&data);
 	void m_pcmBlock(const uint16 *&data);
 	void m_saveGame(const uint16 *&data);
@@ -195,8 +195,8 @@ private:
 	void o_05();
 	void o_eval_and();
 	void o_fmMusicStart();
-	void o_callSubRoutine();
-	void o_12();
+	void o_runSubScript();
+	void o_callSubroutine();
 	void o_cdaPlay();
 	void o_14();
 	void o_fmSoundEffect();
@@ -220,7 +220,7 @@ private:
 	void o_54();
 	void o_verbOps();
 	void o_57();
-	void o_returnFromSubRoutine();
+	void o_returnFromSubScript();
 	void o_59();
 	void o_loadModuleAndStartGfx();
 	void o_62();
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 34c6636da35..bcd3be70638 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -224,7 +224,7 @@ bool SnatcherEngine::start() {
 	_saveMan->updateSaveSlotsStatus(state);
 	_memHandler->setGameState(&state);
 
-	//playBootLogoAnimation(state);
+	playBootLogoAnimation(state);
 
 	_reset = false;
 	uint32 frameTimer = 0;
@@ -249,6 +249,8 @@ bool SnatcherEngine::start() {
 		int numLoops = (countTo5 == 5) ? 2 : 1;
 
 		for (int i = 0; i < numLoops; ++i) {
+			_ui->moveFlashLight();
+
 			if (!_gfx->busy(0)) {
 				bool blockedMod = _cmdQueue->enabled();
 				if (_cmdQueue->enabled()) {
@@ -391,7 +393,6 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 						// the screen center. I solve this by always adding the diff to the y-bias.
 						_input.lightGunPos.x = CLIP<int>(_realLightGunPos.x - state.conf.lightGunBias.x, 0, 255);
 						_input.lightGunPos.y = CLIP<int>(_realLightGunPos.y - state.conf.lightGunBias.y, 0, 255);
-						debug("Lightgun position: (%d, %d)", _input.lightGunPos.x, _input.lightGunPos.y);
 					}
 				}
 
@@ -454,7 +455,6 @@ void SnatcherEngine::updateMainState(GameState &state) {
 
 	case 1:
 		// Init first scene or load savegame
-		state.phaseFlags = 0;
 		_cmdQueue->writeUInt16(0x11);
 		_cmdQueue->writeUInt32(0x1A800);
 		if (state.menuSelect == 0) {
@@ -489,7 +489,7 @@ void SnatcherEngine::updateMainState(GameState &state) {
 		break;
 
 	case 2:
-		// Act I
+		// Ingame logic
 		if (state.phaseFlags & 0x40) {
 			if (_scriptEngine->postProcess(state.script)) {
 				for (int i = 5; i < 15; ++i)
@@ -502,7 +502,7 @@ void SnatcherEngine::updateMainState(GameState &state) {
 			state.phaseFlags &= ~0x40;
 		} else if (state.phaseFlags & 0x20) {
 			_gfx->setVar(11, 0xFF);
-			if (!_ui->drawVerbs() || !_ui->verbsTabInputPrompt(_input.singleFrameControllerFlagsRemapped)) {
+			if (!_ui->drawVerbs() || !_ui->verbsTabInputPrompt(_input)) {
 				state.phaseFlags |= 0x80;
 			} else {
 				_scriptEngine->processInput();
@@ -516,6 +516,9 @@ void SnatcherEngine::updateMainState(GameState &state) {
 		break;
 
 	case 3:
+		// Ending sequence
+		state.phase = 5;
+		state.finish = 1;
 		break;
 
 	case 4:
@@ -525,9 +528,6 @@ void SnatcherEngine::updateMainState(GameState &state) {
 		_reset = true;
 		break;
 
-	case 5:
-		break;
-
 	default:
 		break;
 	}
diff --git a/engines/snatcher/sound.cpp b/engines/snatcher/sound.cpp
index ca1a5857e4c..62f5d8f2494 100644
--- a/engines/snatcher/sound.cpp
+++ b/engines/snatcher/sound.cpp
@@ -61,6 +61,8 @@ void SoundEngine::fmSendCommand(int cmd, int restoreVolume, int trackType) {
 		_fmStatus.music = (cmd == 0xFF) ? 0 : cmd;
 	else if (trackType == 2)
 		_fmStatus.sfx = (cmd == 61) ? 0 : cmd;
+	else if (cmd == 0xFF)
+		_fmStatus.music = _fmStatus.sfx = 0;
 }
 
 const SoundEngine::FMStatus &SoundEngine::fmGetStatus() const {
@@ -137,11 +139,6 @@ SoundDevice *SoundDevice::create(FIO *fio, Common::Platform platform, int soundO
 	if (musicType == MT_INVALID)
 		return nullptr;
 
-	// TODO: We still need to create the appropriate sound device, since the game
-	// heavily relies on audio sync for its animations. We'll just have to handle
-	// it via volume settings.
-	// if (musicType == MT_NULL)
-
 	switch (platform) {
 	case Common::kPlatformSegaCD:
 		return createSegaSoundDevice(fio);
diff --git a/engines/snatcher/transition_scd.cpp b/engines/snatcher/transition_scd.cpp
index 5c838a67f67..a0bdc8a7fc2 100644
--- a/engines/snatcher/transition_scd.cpp
+++ b/engines/snatcher/transition_scd.cpp
@@ -158,9 +158,9 @@ private:
 	void trsUpdt_dummy(int arg);
 	void trsUpdt_engineScroll(int arg);
 	void trsUpdt_skyParallaxScroll(int arg);
-	void trsUpdt_04(int arg);
+	void trsUpdt_floorParallaxScroll(int arg);
 	void trsUpdt_videoPhoneInterference(int arg);
-	void trsUpdt_06(int arg);
+	void trsUpdt_scrollSceneBottomRows(int arg);
 	void trsUpdt_screenShutter(int arg);
 	void trsUpdt_revealShutter(int arg);
 	void trsUpdt_showStdVerbsTab(int arg);
@@ -173,17 +173,18 @@ private:
 	void trsUpdt_showDialogueTab2(int arg);
 	void trsUpdt_showMonitorTextField(int arg);
 	void trsUpdt_showDefaultTextScreen(int arg);
-	void trsUpdt_videoPhoneCallStart(int arg);
-	void trsUpdt_24(int arg);
-	void trsUpdt_videoPhoneCallEnd1(int arg);
-	void trsUpdt_videoPhoneCallEnd2(int arg);
-	void trsUpdt_27(int arg);
-	void trsUpdt_28(int arg);
-	void trsUpdt_29(int arg);
+	void trsUpdt_videoPhoneCallStart1(int arg);
+	void trsUpdt_videoPhoneCallStart2(int arg);
+	void trsUpdt_videoPhoneCallEnd1a(int arg);
+	void trsUpdt_videoPhoneCallEnd1b(int arg);
+	void trsUpdt_videoPhoneCallStart3(int arg);
+	void trsUpdt_videoPhoneCallEnd2a(int arg);
+	void trsUpdt_videoPhoneCallEnd2b(int arg);
 
 	void lineScrollInit();
 	void lineScrollTableFill(uint16 start, uint16 len, uint16 val);
 	void lineScrollTableDecr(uint16 start, uint16 len);
+	void lineScrollTableIncr(uint16 start, uint16 len, int16 offset);
 	void textScreenTrsUpdate(int type, int hIntHandlerNo, int state);
 
 	typedef Common::Functor1Mem<Graphics::SegaRenderer*, void, TransitionManager_SCD> HINTFunc;
@@ -193,10 +194,10 @@ private:
 	void setHINTHandler(uint8 num);
 
 	void hIntHandler_dummy(Graphics::SegaRenderer*);
-	void hIntHandler_showVirtKeybTabStep1(Graphics::SegaRenderer *sr);
-	void hIntHandler_showVirtKeybTabStep2(Graphics::SegaRenderer *sr);
-	void hIntHandler_hideVirtKeybTabStep1(Graphics::SegaRenderer *sr);
-	void hIntHandler_hideVirtKeybTabStep2(Graphics::SegaRenderer *sr);
+	void hIntHandler_showInputTextLine(Graphics::SegaRenderer *sr);
+	void hIntHandler_showVirtKeybTab(Graphics::SegaRenderer *sr);
+	void hIntHandler_hideInputTextLine(Graphics::SegaRenderer *sr);
+	void hIntHandler_hideVirtKeybTab(Graphics::SegaRenderer *sr);
 	void hIntHandler_screenShutter(Graphics::SegaRenderer *sr);
 	void hIntHandler_revealShutter(Graphics::SegaRenderer *sr);
 	void hIntHandler_toggleStdVerbsTab(Graphics::SegaRenderer *sr);
@@ -206,7 +207,8 @@ private:
 	void hIntHandler_showMonitorTextField(Graphics::SegaRenderer *sr);
 	void hIntHandler_showDefaultTextScreen(Graphics::SegaRenderer *sr);
 	void hIntHandler_videoPhoneCallStart(Graphics::SegaRenderer *sr);
-	void hIntHandler_videoPhoneCallEnd(Graphics::SegaRenderer *sr);
+	void hIntHandler_videoPhoneShutter(Graphics::SegaRenderer *sr);
+	void hIntHandler_videoPhoneCallEnd2(Graphics::SegaRenderer *sr);
 };
 
 TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0), _hint_proc(0), _transitionStep(0),
@@ -269,11 +271,12 @@ bool TransitionManager_SCD::nextFrame() {
 		_trsCommandExt = 0;
 	}
 
+	processTransition();
+
 	if (_nextStepExt != _lastStepExt || _lastStepExt == 0) {
 		if (_nextStepExt == 0xFE) {
 			if (_lastStepExt == 23) {
-				_internalState[kVertA].setNextOffset(0);
-				_internalState[kVertB].setNextOffset(0);
+				_result.realOffsets[kVertA] = _result.realOffsets[kVertB] = 0;
 				if (_restoreDlgTab) {
 					resetVars(0x30);
 					_nextStepExt = _lastStepExt = 15;
@@ -292,8 +295,6 @@ bool TransitionManager_SCD::nextFrame() {
 		}
 	}
 
-	processTransition();
-
 	bool changed = false;
 	bool reset = (_nextStep == 0xFF || _nextStep == 0xFC);
 
@@ -403,6 +404,9 @@ void TransitionManager_SCD::processTransition() {
 		_result.realOffsets[kVertB] = _transitionState;
 		break;
 	case 22: case 23:
+		_result.hInt.counter = 0;
+		_result.realOffsets[kVertA] = 0;
+		_result.realOffsets[kVertB] = _transitionState;
 		break;
 	default:
 		break;
@@ -420,11 +424,10 @@ void TransitionManager_SCD::resetVars(int groupFlags) {
 		_lineScrollOp = 0;
 		_lineScrollOpState = 0;
 		_trs__DB = 0;
-		_nextStepExt = 0;
+		_nextStepExt = _lastStepExt = 0;
 		_transitionType = _transitionState = _tmpScrollOffset = _subPara = 0;
 		_result.verbsTabVisible = false;
 		_restoreDlgTab = 0;
-
 	}
 	if (groupFlags & 0x04) {
 		_nextStep = _lastStep = 0;
@@ -469,9 +472,9 @@ void TransitionManager_SCD::makeFunctions() {
 		TF(engineScroll),
 		TF(engineScroll),
 		TF(skyParallaxScroll),
-		TF(04),
+		TF(floorParallaxScroll),
 		TF(videoPhoneInterference),
-		TF(06),
+		TF(scrollSceneBottomRows),
 		TF(screenShutter),
 		TF(revealShutter),
 		TF(revealShutter),
@@ -488,13 +491,13 @@ void TransitionManager_SCD::makeFunctions() {
 		TF(showDialogueTab2),
 		TF(showMonitorTextField),
 		TF(showDefaultTextScreen),
-		TF(videoPhoneCallStart),
-		TF(24),
-		TF(videoPhoneCallEnd1),
-		TF(videoPhoneCallEnd2),
-		TF(27),
-		TF(28),
-		TF(29)
+		TF(videoPhoneCallStart1),
+		TF(videoPhoneCallStart2),
+		TF(videoPhoneCallEnd1a),
+		TF(videoPhoneCallEnd1b),
+		TF(videoPhoneCallStart3),
+		TF(videoPhoneCallEnd2a),
+		TF(videoPhoneCallEnd2b)
 	};
 
 	for (uint i = 0; i < ARRAYSIZE(funcTbl); ++i) \
@@ -502,10 +505,10 @@ void TransitionManager_SCD::makeFunctions() {
 
 	typedef void (TransitionManager_SCD::*HIFunc)(Graphics::SegaRenderer*);
 	static const HIFunc funcTbl2[] = {
-		HF(showVirtKeybTabStep1),
-		HF(showVirtKeybTabStep2),
-		HF(hideVirtKeybTabStep1),
-		HF(hideVirtKeybTabStep2),
+		HF(showInputTextLine),
+		HF(showVirtKeybTab),
+		HF(hideInputTextLine),
+		HF(hideVirtKeybTab),
 		HF(dummy),
 		HF(dummy),
 		HF(dummy),
@@ -526,7 +529,11 @@ void TransitionManager_SCD::makeFunctions() {
 		HF(showMonitorTextField),
 		HF(showDefaultTextScreen),
 		HF(videoPhoneCallStart),
-		HF(videoPhoneCallEnd)
+		HF(videoPhoneShutter),
+		HF(dummy),
+		HF(dummy),
+		HF(dummy),
+		HF(videoPhoneCallEnd2)
 	};
 
 	for (uint i = 0; i < ARRAYSIZE(funcTbl2); ++i) \
@@ -607,7 +614,43 @@ void TransitionManager_SCD::trsUpdt_skyParallaxScroll(int arg) {
 	}
 }
 
-void TransitionManager_SCD::trsUpdt_04(int arg) {
+void TransitionManager_SCD::trsUpdt_floorParallaxScroll(int arg) {
+	if (!_lineScrollOp) {
+		lineScrollInit();
+		return;
+	}
+
+	++_lineScrollTimer1;
+	++_lineScrollTimer2;
+	++_lineScrollTimer3;
+	++_lineScrollTimer4;
+	++_lineScrollTimer5;
+
+	if (_lineScrollTimer1 == 7) {
+		_lineScrollTimer1 = 0;
+		lineScrollTableIncr(0, 112, 1);
+		_hScrollTableLen = 112;
+	}
+	if (_lineScrollTimer2 == 6) {
+		_lineScrollTimer2 = 0;
+		lineScrollTableIncr(112, 4, 1);
+		_hScrollTableLen = 116;
+	}
+	if (_lineScrollTimer3 == 5) {
+		_lineScrollTimer3 = 0;
+		lineScrollTableIncr(116, 4, 1);
+		_hScrollTableLen = 120;
+	}
+	if (_lineScrollTimer4 == 4) {
+		_lineScrollTimer4 = 0;
+		lineScrollTableIncr(120, 4, 1);
+		_hScrollTableLen = 124;
+	}
+	if (_lineScrollTimer5 == 3) {
+		_lineScrollTimer5 = 0;
+		lineScrollTableIncr(124, 4, 1);
+		_hScrollTableLen = 128;
+	}
 }
 
 void TransitionManager_SCD::trsUpdt_videoPhoneInterference(int arg) {
@@ -647,7 +690,14 @@ void TransitionManager_SCD::trsUpdt_videoPhoneInterference(int arg) {
 	}
 }
 
-void TransitionManager_SCD::trsUpdt_06(int arg) {
+void TransitionManager_SCD::trsUpdt_scrollSceneBottomRows(int arg) {
+	if (_lineScrollOp == 0) {
+		lineScrollInit();
+	} else {
+		_hScrollTableLen = 128;
+		lineScrollTableIncr(112, 9, -2);
+		lineScrollTableIncr(121, 7, 2);
+	}
 }
 
 void TransitionManager_SCD::trsUpdt_screenShutter(int arg) {
@@ -852,7 +902,7 @@ void TransitionManager_SCD::trsUpdt_showDefaultTextScreen(int arg) {
 		textScreenTrsUpdate(16, 22, 232);
 }
 
-void TransitionManager_SCD::trsUpdt_videoPhoneCallStart(int arg) {
+void TransitionManager_SCD::trsUpdt_videoPhoneCallStart1(int arg) {
 	if (_tmpScrollOffset == 0) {
 		_transitionState2 = 48;
 		++_tmpScrollOffset;
@@ -869,10 +919,24 @@ void TransitionManager_SCD::trsUpdt_videoPhoneCallStart(int arg) {
 	}
 }
 
-void TransitionManager_SCD::trsUpdt_24(int arg) {
+void TransitionManager_SCD::trsUpdt_videoPhoneCallStart2(int arg) {
+	if (arg == 0) {
+		_transitionType = 18;
+		setHINTHandler(24);
+		_transitionState = -64;
+		++_subPara;
+	} else if (arg == 1) {
+		_transitionState += 8;
+		if (_transitionState > 0) {
+			_transitionState = 0;
+			++_subPara;
+		}
+	} else {
+		resetVars(0x10);
+	}
 }
 
-void TransitionManager_SCD::trsUpdt_videoPhoneCallEnd1(int arg) {
+void TransitionManager_SCD::trsUpdt_videoPhoneCallEnd1a(int arg) {
 	if (arg != 0)
 		return;
 	_transitionType = 19;
@@ -881,7 +945,7 @@ void TransitionManager_SCD::trsUpdt_videoPhoneCallEnd1(int arg) {
 	++_subPara;
 }
 
-void TransitionManager_SCD::trsUpdt_videoPhoneCallEnd2(int arg) {
+void TransitionManager_SCD::trsUpdt_videoPhoneCallEnd1b(int arg) {
 	if (arg == 0) {
 		_transitionType = 20;
 		setHINTHandler(24);
@@ -898,13 +962,39 @@ void TransitionManager_SCD::trsUpdt_videoPhoneCallEnd2(int arg) {
 	}
 }
 
-void TransitionManager_SCD::trsUpdt_27(int arg) {
+void TransitionManager_SCD::trsUpdt_videoPhoneCallStart3(int arg) {
+	if (arg != 0)
+		return;
+	_transitionType = 21;
+	_transitionState = -64;
+	setHINTHandler(24);
+	++_subPara;
 }
 
-void TransitionManager_SCD::trsUpdt_28(int arg) {
+void TransitionManager_SCD::trsUpdt_videoPhoneCallEnd2a(int arg) {
+	if (arg != 0)
+		return;
+	_transitionType = 22;
+	_transitionState = 96;
+	setHINTHandler(28);
+	++_subPara;
 }
 
-void TransitionManager_SCD::trsUpdt_29(int arg) {
+void TransitionManager_SCD::trsUpdt_videoPhoneCallEnd2b(int arg) {
+	if (arg == 0) {
+		_transitionType = 23;
+		setHINTHandler(28);
+		_transitionState = 96;
+		++_subPara;
+	} else if (arg == 1) {
+		_transitionState -= 8;
+		if (_transitionState < 48) {
+			_transitionState = 48;
+			++_subPara;
+		}
+	} else {
+		resetVars(0x30);
+	}
 }
 
 void TransitionManager_SCD::lineScrollInit() {
@@ -922,8 +1012,12 @@ void TransitionManager_SCD::lineScrollTableFill(uint16 start, uint16 len, uint16
 }
 
 void TransitionManager_SCD::lineScrollTableDecr(uint16 start, uint16 len) {
+	lineScrollTableIncr(start, len, -1);
+}
+
+void TransitionManager_SCD::lineScrollTableIncr(uint16 start, uint16 len, int16 offset) {
 	for (int16 *d = &_hScrollTable[start]; d < &_hScrollTable[start + len]; ++d)
-		*d = (*d - 1) & 0x3FF;
+		*d = (*d + offset) & 0x3FF;
 }
 
 void TransitionManager_SCD::textScreenTrsUpdate(int type, int hIntHandlerNo, int state) {
@@ -938,12 +1032,14 @@ void TransitionManager_SCD::setHINTHandler(uint8 num) {
 		_hINTHandler = _hINTProcs[num];
 	 else
 		error("%s(): Invalid HINT handler %d", __FUNCTION__, num);
+	if (num == 28)
+		_gfxState.setVar(11, 1);
 }
 
 void TransitionManager_SCD::hIntHandler_dummy(Graphics::SegaRenderer*) {
 }
 
-void TransitionManager_SCD::hIntHandler_showVirtKeybTabStep1(Graphics::SegaRenderer *sr) {
+void TransitionManager_SCD::hIntHandler_showInputTextLine(Graphics::SegaRenderer *sr) {
 	if (_transitionStep == 99) {
 		sr->writeUint16VSRAM(0, TO_BE_16(0x140));
 		sr->writeUint16VSRAM(2, TO_BE_16(0x140));
@@ -955,7 +1051,7 @@ void TransitionManager_SCD::hIntHandler_showVirtKeybTabStep1(Graphics::SegaRende
 	++_transitionStep;
 }
 
-void TransitionManager_SCD::hIntHandler_showVirtKeybTabStep2(Graphics::SegaRenderer *sr) {
+void TransitionManager_SCD::hIntHandler_showVirtKeybTab(Graphics::SegaRenderer *sr) {
 	if (_transitionStep == 99) {
 		sr->writeUint16VSRAM(0, TO_BE_16(0x140));
 		sr->writeUint16VSRAM(2, TO_BE_16(0x140));
@@ -970,7 +1066,7 @@ void TransitionManager_SCD::hIntHandler_showVirtKeybTabStep2(Graphics::SegaRende
 	++_transitionStep;
 }
 
-void TransitionManager_SCD::hIntHandler_hideVirtKeybTabStep1(Graphics::SegaRenderer *sr) {
+void TransitionManager_SCD::hIntHandler_hideInputTextLine(Graphics::SegaRenderer *sr) {
 	if (_transitionStep == 99) {
 		sr->writeUint16VSRAM(0, TO_BE_16(_tmpScrollOffset));
 		sr->writeUint16VSRAM(2, TO_BE_16(_tmpScrollOffset));
@@ -985,7 +1081,7 @@ void TransitionManager_SCD::hIntHandler_hideVirtKeybTabStep1(Graphics::SegaRende
 	++_transitionStep;
 }
 
-void TransitionManager_SCD::hIntHandler_hideVirtKeybTabStep2(Graphics::SegaRenderer *sr) {
+void TransitionManager_SCD::hIntHandler_hideVirtKeybTab(Graphics::SegaRenderer *sr) {
 	if (_transitionStep == 143) {
 		sr->writeUint16VSRAM(0, TO_BE_16(_transitionState));
 		sr->writeUint16VSRAM(2, TO_BE_16(_transitionState));
@@ -1074,9 +1170,6 @@ void TransitionManager_SCD::hIntHandler_toggleSmallVerbsTab(Graphics::SegaRender
 	if (_transitionStep++ != 19)
 		return;
 	sr->writeUint16VSRAM(0, TO_BE_16(_transitionState));
-	sr->writeUint16VSRAM(2, TO_BE_16(_transitionState));
-	sr->writeUint16VRAM(0xF800, 0);
-	sr->writeUint16VRAM(0xF802, 0);
 	_result.hInt.enable = false;
 }
 
@@ -1113,7 +1206,7 @@ void TransitionManager_SCD::hIntHandler_videoPhoneCallStart(Graphics::SegaRender
 	++_transitionStep;
 }
 
-void TransitionManager_SCD::hIntHandler_videoPhoneCallEnd(Graphics::SegaRenderer *sr) {
+void TransitionManager_SCD::hIntHandler_videoPhoneShutter(Graphics::SegaRenderer *sr) {
 	if (_transitionStep == 9) {
 		sr->writeUint16VSRAM(0, 0);
 		sr->writeUint16VSRAM(2, TO_BE_16((-_transitionState) & 0x3FF));
@@ -1122,6 +1215,16 @@ void TransitionManager_SCD::hIntHandler_videoPhoneCallEnd(Graphics::SegaRenderer
 	++_transitionStep;
 }
 
+void TransitionManager_SCD::hIntHandler_videoPhoneCallEnd2(Graphics::SegaRenderer *sr) {
+	if (_transitionStep == 72) {
+		sr->writeUint16VSRAM(0, 0);
+		sr->writeUint16VSRAM(2, TO_BE_16((-_transitionState) & 0x3FF));
+	} else if (_transitionStep == 136) {
+		_result.hInt.enable = false;
+	}
+	++_transitionStep;
+}
+
 TransitionManager *TransitionManager::createSegaTransitionManager(GraphicsEngine::GfxState &state) {
 	return new TransitionManager_SCD(state);
 }
diff --git a/engines/snatcher/ui.cpp b/engines/snatcher/ui.cpp
index d479bb1b041..57c1d62f00c 100644
--- a/engines/snatcher/ui.cpp
+++ b/engines/snatcher/ui.cpp
@@ -23,17 +23,19 @@
 #include "snatcher/graphics.h"
 #include "snatcher/resource.h"
 #include "snatcher/script.h"
+#include "snatcher/snatcher.h"
 #include "snatcher/ui.h"
+#include "snatcher/util.h"
 #include "common/stream.h"
 
 
 namespace Snatcher {
 
 UI::UI(GraphicsEngine *gfx, CmdQueue *que, ResourcePointer *scd) : _gfx(gfx), _que(que), _scd(scd), _sceneId(0), _textLineBreak(0), _dialogTextBuffer(nullptr), _textColor(0),
-	_scriptTextResource(nullptr),/*_makestrbt1(0),*/ _textY(0), _headLineYOffset(0), _sceneTextOffsCur(0), _textLineEnd(0), _sceneInfo(0), _sceneTextOffset(0), _transDW1(0), _transDW2(0),
-		_sceneTextOffsStart(0), _waitCursorFrame(0), _waitCursorAnimDelay(0), _progress(-1), _progress2(-1), _controllerCfg(0), _verbsTabLayout(0), _verbsInterpreterMode(0),
+	_scriptTextResource(nullptr),/*_makestrbt1(0),*/ _textY(0), _headLineYOffset(0), _sceneTextOffsCur(0), _textLineEnd(0), _sceneInfo(0), _sceneTextOffset(0), _flashLight(),
+		_sceneTextOffsStart(0), _waitCursorFrame(0), _waitCursorAnimDelay(0), _progress(-1), _progress2(-1), _controllerCfg(0), _verbInterfaceMode(0), _verbsInterpreterMode(0),
 			_lastVerbFirstPage(0), _numVerbsFirstPage(0), _numVerbsLastPage(0), _lastVerbLastPage(0), _numVerbsMax(0), _verbsTabCurPage(0), _lastVerbDrawn(0), _verbTextBuffer(nullptr), _scriptVerbsArray(nullptr),
-				_scriptSentenceArray(nullptr), _prevSelectedVerb(0), _selectedVerb(0), _lastHiliteVerb(0), _hiliteVerb(0), _transit_02(0), _textInputMarginLeft(0), _videoPhoneMode(0),
+				_scriptSentenceArray(nullptr), _prevSelectedVerb(0), _selectedVerb(0), _lastHiliteVerb(0), _hiliteVerb(0), _textInputMarginLeft(0), _videoPhoneMode(0),
 					_textInputColumnCur(0), _textInputColumnMax(0), _textInputCursorState(0), _textInputCursorBlinkCnt(0), _underscoreStr(nullptr), _textInputStr(nullptr), _vkeybPosTotal(0),
 						_vkeybColumnWidth(0), _verbsTabLayoutMap(nullptr), _verbsTabOffsX(0), _verbsTabOffsY(0), _hilitePosX(0), _hilitePosY(0), _vkeybVisible(false) {
 
@@ -186,11 +188,11 @@ bool UI::drawVerbs() {
 
 		if (_scriptVerbsArray->pos() >= 9) {
 			if (_scriptTextResource[_scriptVerbsArray->read(0)] < 'A') {
-				_verbsTabLayout = 2;
+				_verbInterfaceMode = 2;
 				_que->writeUInt16(0x22);
 				_que->writeUInt32(0x1138C);
 			} else {
-				_verbsTabLayout = 3;
+				_verbInterfaceMode = 3;
 				_que->writeUInt16(0x22);
 				_que->writeUInt32(0x11382);
 			}
@@ -207,7 +209,7 @@ bool UI::drawVerbs() {
 		return false;
 	}
 
-	if (_verbsTabLayout < 2) {
+	if (_verbInterfaceMode < 2) {
 		if (_progress2 == 2) {
 			static const uint8 strHead[] = { 0xFC, 0x00, 0xF9, 0x01, 0xFE, 0x04, 0xFB };
 			memcpy(_verbTextBuffer, strHead, sizeof(strHead));
@@ -278,7 +280,7 @@ bool UI::drawVerbs() {
 		}
 	} else {
 		if (_progress2 == 2) {
-			if (_verbsTabLayout == 2) {
+			if (_verbInterfaceMode == 2) {
 				_que->writeUInt16(0x05);
 				_que->writeUInt32(0x11454);
 				_que->start();
@@ -287,7 +289,7 @@ bool UI::drawVerbs() {
 			return false;
 		}
 		if (_progress2 == 3) {
-			if (_verbsTabLayout == 2) {
+			if (_verbInterfaceMode == 2) {
 				_gfx->transitionCommand(15);
 			} else {
 				_gfx->transitionCommand(16);
@@ -300,9 +302,9 @@ bool UI::drawVerbs() {
 			_textInputMarginLeft = 64;
 			_textInputColumnCur = 0;
 			if (_textInputColumnMax == 0) {
-				_textInputColumnMax = (_verbsTabLayout == 2) ? 10 : 17;
-				_textInputMarginLeft = (_verbsTabLayout == 2) ? 24 : 48;
-				_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaFrame, _verbsTabLayout == 2 ? 2 : 0);
+				_textInputColumnMax = (_verbInterfaceMode == 2) ? 10 : 17;
+				_textInputMarginLeft = (_verbInterfaceMode == 2) ? 24 : 48;
+				_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaFrame, _verbInterfaceMode == 2 ? 2 : 0);
 			}
 			++_progress2;
 		}
@@ -333,10 +335,10 @@ bool UI::drawVerbs() {
 
 			static const uint8 offs[] = { 0x2D, 0x06, 0x1B, 0x1A, 0xC0, 0x87, 0x10, 0x90 };
 
-			_vkeybPosTotal = offs[((_verbsTabLayout - 2) << 1)];
-			_vkeybColumnWidth = offs[((_verbsTabLayout - 2) << 1) + 1];
-			_verbsTabOffsX = offs[((_verbsTabLayout - 2) << 1) + 4];
-			_verbsTabOffsY = offs[((_verbsTabLayout - 2) << 1) + 5];
+			_vkeybPosTotal = offs[((_verbInterfaceMode - 2) << 1)];
+			_vkeybColumnWidth = offs[((_verbInterfaceMode - 2) << 1) + 1];
+			_verbsTabOffsX = offs[((_verbInterfaceMode - 2) << 1) + 4];
+			_verbsTabOffsY = offs[((_verbInterfaceMode - 2) << 1) + 5];
 			adjustHilitePos();
 
 			_progress2 = 100;
@@ -347,7 +349,7 @@ bool UI::drawVerbs() {
 	return true;
 }
 
-bool UI::verbsTabInputPrompt(uint16 inputFlags) {
+bool UI::verbsTabInputPrompt(const SnatcherEngine::Input &input) {
 	assert (_progress2 >= 100);
 	if (_verbsInterpreterMode == 2) {
 		if (_progress2 & 0x80) {
@@ -358,24 +360,24 @@ bool UI::verbsTabInputPrompt(uint16 inputFlags) {
 		}
 	} else {
 		if (_progress2 == 100) {
-			if (_verbsTabLayout < 2)
+			if (_verbInterfaceMode < 2)
 				_gfx->transitionCommand(_gfx->getVerbAreaType() ? 18 : 13);
 			++_progress2;
 		}
 
 		if (_progress2 == 101) {
-			if (_verbsTabLayout < 2 && !_gfx->isVerbsTabActive())
+			if (_verbInterfaceMode < 2 && !_gfx->isVerbsTabActive())
 				return false;
 			++_progress2;
 		}
 
 		if (_progress2 == 102) {
 			_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaEnable, 1);
-			if (_verbsTabLayout >= 2) {
-				_verbsTabLayoutMap = _scd->makePtr(_verbsTabLayout == 3 ? 0x11512 : 0x114DC)();
+			if (_verbInterfaceMode >= 2) {
+				_verbsTabLayoutMap = _scd->makePtr(_verbInterfaceMode == 3 ? 0x11512 : 0x114DC)();
 				_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
 				_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
-				_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaFrame, _verbsTabLayout == 2 ? 2 : 0);
+				_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaFrame, _verbInterfaceMode == 2 ? 2 : 0);
 			} else {
 				_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaControlFlags, 0);
 			}
@@ -384,7 +386,7 @@ bool UI::verbsTabInputPrompt(uint16 inputFlags) {
 		}
 
 		if ((_progress2 & 0xFF) == 103) {
-			verbsTabHandleInput(inputFlags);
+			verbsTabHandleInput(input);
 			if (_selectedVerb == 0)
 				return false;
 			++_progress2;
@@ -409,7 +411,7 @@ bool UI::verbsTabInputPrompt(uint16 inputFlags) {
 		++_progress2;
 	}
 
-	if (_verbsTabLayout < 2) {
+	if (_verbInterfaceMode < 2) {
 		if (_progress2 == 105) {
 			_gfx->transitionCommand(_gfx->getVerbAreaType() ? 19 : 14);
 			++_progress2;
@@ -436,7 +438,7 @@ bool UI::verbsTabInputPrompt(uint16 inputFlags) {
 		if (_progress2 == 105) {
 			_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
 			_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
-			if (_verbsTabLayout == 2)
+			if (_verbInterfaceMode == 2)
 				_gfx->transitionCommand(0xFE);
 			else if (_vkeybVisible) {
 				_vkeybVisible = false;
@@ -462,7 +464,7 @@ bool UI::verbsTabInputPrompt(uint16 inputFlags) {
 		if (_progress2 == 108) {
 			if (++_verbsInterpreterMode != 2) {
 				_verbsInterpreterMode = 0;
-				_verbsTabLayout = 0;
+				_verbInterfaceMode = 0;
 			}
 			_videoPhoneMode = 0;
 			_textInputColumnMax = 0;
@@ -473,27 +475,31 @@ bool UI::verbsTabInputPrompt(uint16 inputFlags) {
 	return true;
 }
 
-void UI::setVerbsTabLayout(uint16 layout) {
-	_verbsTabLayout = layout;
-	if (layout == 1)
-		_transDW1 = _transDW2 = 0;
+void UI::moveFlashLight() {
+	if (_verbInterfaceMode != 1)
+		return;
+	_gfx->transitionCommand(1);
+	_gfx->setScrollStep(GraphicsEngine::kSingleStep | GraphicsEngine::kHorzA, (_flashLight.posX >> 16) + ((Util::rngMakeNumber() & 0x8000) ? 1 : 0));
+	_gfx->setScrollStep(GraphicsEngine::kSingleStep | GraphicsEngine::kVertA, (_flashLight.posY >> 16) - 40 + ((Util::rngMakeNumber() & 0x8000) ? 1 : 0));
 }
 
-void UI::setInterpreterMode(uint16 mode) {
-	_verbsInterpreterMode = mode;
+void UI::setVerbInterfaceMode(uint16 mode) {
+	_verbInterfaceMode = mode;
+	if (mode == 1)
+		_flashLight.posX = _flashLight.posY = 0;
 }
 
 void UI::loadState(Common::SeekableReadStream *in) {
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
-	_verbsTabLayout = in->readUint16BE();
+	_verbInterfaceMode = in->readUint16BE();
 	_verbsInterpreterMode = in->readUint16BE();
 	_progress = _progress2 = -1;
 }
 
 void UI::saveState(Common::SeekableWriteStream *out) {
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
-	out->writeUint16BE(_verbsTabLayout);
+	out->writeUint16BE(_verbInterfaceMode);
 	out->writeUint16BE(_verbsInterpreterMode);
 }
 
@@ -546,7 +552,7 @@ void UI::printDialogStringBody() {
 		case 0xF6:
 			_textLineBreak = 3;
 			i = 49;
-			break;;
+			break;
 		case 0xF4:
 			_sceneInfo = (_sceneInfo & 0xFF) | 0x200;
 			break;
@@ -712,9 +718,9 @@ void UI::verbSelect2setResult() {
 	_selectedVerb = (i == _scriptVerbsArray->size()) ? 1 : i + 1;
 }
 
-void UI::verbsTabHandleInput(uint16 inputFlags) {
+void UI::verbsTabHandleInput(const SnatcherEngine::Input &input) {
 	if (_progress2 & 0x100) {
-		if (_verbsTabLayout < 2)
+		if (_verbInterfaceMode < 2)
 			drawHiliteVerb(1);
 		else
 			virtKeybBackspace();
@@ -733,8 +739,32 @@ void UI::verbsTabHandleInput(uint16 inputFlags) {
 		return;
 	}
 
-	if (_verbsTabLayout == 0) {
-		uint8 in = verbsTabCheckInputFlags(inputFlags);
+	if (_verbInterfaceMode < 2) {
+		if (_verbInterfaceMode == 1) {
+			if (_scriptSentenceArray->pos() == 0) {
+				if (input.sustainedControllerFlagsRemapped & 0x10) {
+					//_c13Valu = 0xFF;
+					uint8 in = _flashLight.inputFlags = input.sustainedControllerFlagsRemapped;
+					_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
+					if (in & 1)
+						moveFlashLight(0, -0x20000);
+					if (in & 2)
+						moveFlashLight(0, 0x20000);
+					if (in & 8)
+						moveFlashLight(0x20000, 0);
+					if (in & 4)
+						moveFlashLight(-0x20000, 0);
+				} else {
+					//_c13Valu = 0;
+					_flashLight.posData = checkFlashLightPos(((_flashLight.posX >> 16) + 72) >> 2, ((_flashLight.posY >> 16) + 40) >> 2);
+					_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
+				}
+			}
+			if (_scriptSentenceArray->pos() == 0 && (input.sustainedControllerFlagsRemapped & 0x10))
+				return; // No handling of the verbs section when moving around the flashlight
+		}
+
+		uint8 in = input.singleFrameControllerFlagsRemapped;
 		if (_scriptVerbsArray->pos() == 1) {
 			if (in == 0x10) {
 				if (_scriptSentenceArray->pos() != 0)
@@ -792,13 +822,11 @@ void UI::verbsTabHandleInput(uint16 inputFlags) {
 				verbSelect();
 			}
 		}
-	} else if (_verbsTabLayout == 1) {
-
 	} else {
 		if (--_textInputCursorBlinkCnt == 0)
 			drawUnderscoreCursor();
 
-		uint8 in = verbsTabCheckInputFlags(inputFlags);
+		uint8 in = input.singleFrameControllerFlagsRemapped;
 
 		if (in & 1) {
 			for (int cr = _vkeybPosTotal - _vkeybColumnWidth; verbsTabMoveHilite(cr); )
@@ -827,10 +855,6 @@ void UI::verbsTabHandleInput(uint16 inputFlags) {
 	}
 }
 
-uint8 UI::verbsTabCheckInputFlags(uint16 inputFlags) {
-	return inputFlags;
-}
-
 bool UI::verbsTabMoveHilite(int &pos) {
 	switch (_verbsTabLayoutMap[pos]) {
 	case 0:
@@ -870,7 +894,7 @@ bool UI::verbsTabMoveHilite(int &pos) {
 
 void UI::adjustHilitePos() {
 	_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
-	_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaFrame, _verbsTabLayout == 2 ? 2 : 0);
+	_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaFrame, _verbInterfaceMode == 2 ? 2 : 0);
 	_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
 
 	int rows = 1;
@@ -953,7 +977,7 @@ bool UI::verbSelect2() {
 		}	
 
 		if (_progress2 == 0x100) {
-			if (_verbsTabLayout == 3) {
+			if (_verbInterfaceMode == 3) {
 				uint8 frm = _scd->makePtr(0x115CA)[_vkeybPosTotal];
 				_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaFrame, frm);
 				_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
@@ -996,7 +1020,7 @@ bool UI::verbSelect2() {
 
 void UI::virtKeybBackspace() {
 	if (!(_progress2 & 0x100)) {
-		if (_verbsTabLayout == 3) {
+		if (_verbInterfaceMode == 3) {
 			_hilitePosX = _gfx->getAnimParameter(62, GraphicsEngine::kAnimParaPosX);
 			_hilitePosY = _gfx->getAnimParameter(62, GraphicsEngine::kAnimParaPosY);
 			_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaPosX, 88);
@@ -1023,7 +1047,7 @@ void UI::virtKeybBackspace() {
 }
 
 void UI::virtKeybStart() {
-	if (_verbsTabLayout == 3) {
+	if (_verbInterfaceMode == 3) {
 		_hilitePosX = _gfx->getAnimParameter(62, GraphicsEngine::kAnimParaPosX);
 		_hilitePosY = _gfx->getAnimParameter(62, GraphicsEngine::kAnimParaPosY);
 		_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaPosX, 200);
@@ -1114,4 +1138,26 @@ void UI::virtKeybPrint() {
 	}
 }
 
+uint8 UI::checkFlashLightPos(int16 x, int16 y) {
+	return _scd->makePtr(0x109E8)[y * 36 + x];
+}
+
+void UI::moveFlashLight(int32 offsX, int32 offsY) {
+	if (offsX == 0) {
+		assert(offsY != 0);
+		int32 nY = _flashLight.posY + offsY;
+		if (nY >= -0x270000 && nY < 0x250000)
+			_flashLight.posY = nY;
+
+	} else if (offsY == 0) {
+		assert(offsX != 0);
+		int32 nX = _flashLight.posX + offsX;
+		if (nX >= -0x470000 && nX < 0x450000)
+			_flashLight.posX = nX;
+	} else {
+		error("%s(): Invalid parameters", __FUNCTION__);
+	}
+	debug ("FLASHLIGHT: X: %d, Y: %d", _flashLight.posX >> 16, _flashLight.posY >> 16);
+}
+
 } // End of namespace Snatcher
diff --git a/engines/snatcher/ui.h b/engines/snatcher/ui.h
index 8afdab451a3..bd151573e1d 100644
--- a/engines/snatcher/ui.h
+++ b/engines/snatcher/ui.h
@@ -48,15 +48,28 @@ public:
 	bool displayDialog(int sceneInfo, int sceneTextOffset, uint16 inputFlags);
 
 	bool drawVerbs();
-	bool verbsTabInputPrompt(uint16 inputFlags);
+	bool verbsTabInputPrompt(const SnatcherEngine::Input &input);
+	void moveFlashLight();
 
 	void setScriptVerbsArray(const ScriptArray *verbsArray) { _scriptVerbsArray = verbsArray; }
 	void setScriptSentenceArray(const ScriptArray *sentenceArray) { _scriptSentenceArray = sentenceArray; }
 
 	int8 getSelectedVerb() const { return (int8)_selectedVerb; }
+
 	void resetVerbSelection() { _prevSelectedVerb = 0; }
-	void setVerbsTabLayout(uint16 layout);
-	void setInterpreterMode(uint16 mode);
+
+	struct FlashLightStatus {
+		FlashLightStatus() : inputFlags(0), posData(0), posX(0), posY(0) {}
+		uint16 inputFlags;
+		int32 posX;
+		int32 posY;
+		uint8 posData;
+	};
+
+	const FlashLightStatus &getFlashLightStatus() const { return _flashLight; }
+
+	void setVerbInterfaceMode(uint16 mode);
+	void setInterpreterMode(uint16 mode) { _verbsInterpreterMode = mode; }
 	void setVideoPhoneMode(uint16 enable) { _videoPhoneMode = enable; }
 	void setInputStringLength(uint16 length) { _textInputColumnMax = length; }
 	void setHeadLineYOffset(int16 offs) { _headLineYOffset = offs; };
@@ -94,8 +107,7 @@ private:
 	bool drawUnderscoreString();
 	void drawUnderscoreCursor();
 	void verbSelect2setResult();
-	void verbsTabHandleInput(uint16 inputFlags);
-	uint8 verbsTabCheckInputFlags(uint16 inputFlags);
+	void verbsTabHandleInput(const SnatcherEngine::Input &input);
 	bool verbsTabMoveHilite(int &pos);
 	void adjustHilitePos();
 	void verbTabSwapPage();
@@ -105,6 +117,8 @@ private:
 	void virtKeybStart();
 	bool verbSelect2checkSelection(uint16 val);
 	void virtKeybPrint();
+	uint8 checkFlashLightPos(int16 x, int16 y);
+	void moveFlashLight(int32 offsX, int32 offsY);
 
 	uint16 _verbsInterpreterMode;
 	uint8 _lastVerbFirstPage;
@@ -114,9 +128,6 @@ private:
 	uint8 _prevSelectedVerb;
 	uint8 _numVerbsMax;
 	uint8 _verbsTabCurPage;
-	uint8 _transit_02;
-	int16 _transDW1;
-	int16 _transDW2;
 	int16 _videoPhoneMode;
 	uint8 _textInputMarginLeft;
 	int16 _textInputColumnCur;
@@ -136,7 +147,7 @@ private:
 	uint8 *_underscoreStr;
 	uint8 *_textInputStr;
 	const uint8 *_verbsTabLayoutMap;
-	uint16 _verbsTabLayout;
+	uint16 _verbInterfaceMode;
 	int16 _hilitePosX;
 	int16 _hilitePosY;
 	bool _vkeybVisible;
@@ -144,6 +155,8 @@ private:
 	const ScriptArray *_scriptSentenceArray;
 	int16 _progress2;
 
+	FlashLightStatus _flashLight;
+
 private:
 	GraphicsEngine *_gfx;
 	CmdQueue *_que;


Commit: 0ecbd2080e216a4c26b55ddd816b313e489824fc
    https://github.com/scummvm/scummvm/commit/0ecbd2080e216a4c26b55ddd816b313e489824fc
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: more fixes

(snow flake animations, shooter crash,
hanging animation, etc.)

Changed paths:
    engines/snatcher/POTFILES
    engines/snatcher/action.cpp
    engines/snatcher/action.h
    engines/snatcher/animator_scd.cpp
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/saveload.cpp
    engines/snatcher/script.cpp
    engines/snatcher/script.h
    engines/snatcher/snatcher.cpp
    engines/snatcher/text_scd.cpp
    engines/snatcher/ui.cpp


diff --git a/engines/snatcher/POTFILES b/engines/snatcher/POTFILES
index 1b090beb384..4fc3553056e 100644
--- a/engines/snatcher/POTFILES
+++ b/engines/snatcher/POTFILES
@@ -1,2 +1 @@
 engines/snatcher/detection.cpp
-
diff --git a/engines/snatcher/action.cpp b/engines/snatcher/action.cpp
index 257bb03f489..403f4e5cdab 100644
--- a/engines/snatcher/action.cpp
+++ b/engines/snatcher/action.cpp
@@ -33,7 +33,7 @@ namespace Snatcher {
 
 ActionSequenceHandler::ActionSequenceHandler(SnatcherEngine *vm, ResourcePointer *scd) : _vm(vm), _scd(scd), _stage(0), _counter1(0), _counter2(0), _progressMSB(0), _progressLSB(0),
 	_weaponState(0), _enemySpeed(0), _active(false), _handleShotPhase(0), _updateEnemiesPhase(0), _enemyAttackStatus(0), _targetField(0), _hscrollB(0), _vscrollB(0),
-		_enemyAppearanceCount(0), _civilianAppearanceCount(0), _abortFight(0), _nextEnemyAppearanceTimer(0), _enemyAttackTimer(0), _shoot_78EE(0), _shoot_78EC(0), _result(),
+		_enemyAppearanceCount(0), _civilianAppearanceCount(0), _abortFight(0), _nextEnemyAppearanceTimer(0), _enemyAttackTimer(0), _shoot_78EE(0), _activeEnemies(0), _result(),
 			_attackerId(0), _animNo(0), _shoot_7912(0), _projectileCoords(nullptr) {
 	_projectileCoords = new int16[18]();
 }
@@ -297,7 +297,7 @@ void ActionSequenceHandler::initStage() {
 	for (int i = 0; i < 9; ++i) {
 		animSet(32 + i, Frame, 2);
 		animSet(32 + i, FrameDelay, 0);
-		animSet(32 + i, F24, 0);
+		animSet(32 + i, Phase, 0);
 		animSet(32 + i, Enable, e);
 	}
 	const int16 *in = reinterpret_cast<const int16*>(_scd->makePtr(0x11FEC)());
@@ -487,7 +487,7 @@ void ActionSequenceHandler::handleShot() {
 
 		case 3:
 			tf = animGet(21, Target);
-			vl = animGet(32 + tf, F24) & 0x0F;
+			vl = animGet(32 + tf, Phase) & 0x0F;
 			if (vl < 2 || vl > 4) {
 				if (_stage != 10) {
 					if (_useLightGun || _scd->makePtr(0x11FD0)[_stage] == 0) {
@@ -500,8 +500,8 @@ void ActionSequenceHandler::handleShot() {
 				}
 
 			} else {
-				vl = animGet(32 + tf, F24) & 0xF0;
-				animSet(32 + tf, F24, vl | 6);
+				vl = animGet(32 + tf, Phase) & 0xF0;
+				animSet(32 + tf, Phase, vl | 6);
 				if ((vl >> 4) & 1) {
 					if ((_result.enemiesShot & 7) == 7 && _enemySpeed >= 2)
 						_enemySpeed -= 2;
@@ -571,14 +571,14 @@ void ActionSequenceHandler::handleShot() {
 }
 
 void ActionSequenceHandler::updateEnemies() {
-	_shoot_78EC = 0;
+	_activeEnemies = 0;
 	for (int i = 32; i < 41; ++i) {
-		int16 a = animGet(i, F24);
+		int16 a = animGet(i, Phase);
 		int16 b = 0;
 		if (a != 0xFF)
 			b = a & 0x0F;
 		if (b)
-			++_shoot_78EC;
+			++_activeEnemies;
 		switch (b) {
 		case 0:
 			b = _vm->gfx()->getAnimScriptByte(i, 0);
@@ -587,7 +587,7 @@ void ActionSequenceHandler::updateEnemies() {
 			} else if (b < 128 && a != 0xFF) {
 				animSet(i, Enable, 1);
 			} else {
-				animSet(i, F24, 0xFF);
+				animSet(i, Phase, 0xFF);
 				animSet(i, ControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
 				animSet(i, Enable, 0);
 			}
@@ -610,8 +610,7 @@ void ActionSequenceHandler::updateEnemies() {
 			a = _vm->gfx()->getAnimScriptByte(i, b);
 			if (a == animGet(i, Frame)) {
 				animSet(i, Frame, a + 2);
-				animSet(i, F24, animGet(i, F24) + 1);
-				debug("Enemy %d F24: %d -> %d", i, a-1, a);
+				animSet(i, Phase, animGet(i, Phase) + 1);
 				a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
 				animSet(i, ActionTimer, a + _enemySpeed);
 			}
@@ -619,7 +618,7 @@ void ActionSequenceHandler::updateEnemies() {
 			if (b == 1)
 				break;
 
-			if ((animGet(i, F24) & 0x0F) == b) {
+			if ((animGet(i, Phase) & 0x0F) == b) {
 				if (b < 5)
 					animSet(i, ActionTimer, 0);
 				break;
@@ -627,14 +626,14 @@ void ActionSequenceHandler::updateEnemies() {
 
 			if (b == 5) {
 				animSet(i, Frame, animGet(i, Frame) - 2);
-				if (_scd->makePtr(0x11FD0)[_stage] == 0 && animGet(i, F24) >= 48)
+				if (_scd->makePtr(0x11FD0)[_stage] == 0 && animGet(i, Phase) >= 48)
 					++_result.hitsTaken;
-				animSet(i, F24, 0);
+				animSet(i, Phase, 0);
 				break;
 			}
 
 			if (_scd->makePtr(0x11FD0)[_stage] == 0)
-				break;					
+				break;
 
 			if (b == 2 && (_result.enemiesShot <= _scd->makePtr(_useLightGun ? 0x11F90 : 0x11F80)[_stage]))
 				break;
@@ -643,12 +642,12 @@ void ActionSequenceHandler::updateEnemies() {
 				break;
 
 			if (b == 3) {
-				if ((animGet(i, F24) & 0xF0) != 0x20 && !_enemyAttackStatus && !_enemyAttackTimer && _weaponState < 2) {
+				if ((animGet(i, Phase) & 0xF0) != 0x20 && !_enemyAttackStatus && !_enemyAttackTimer && _weaponState < 2) {
 					_attackerId = i - 32;
 					_enemyAttackStatus = 1;
 				}
 			} else {
-				animSet(i, F24, (animGet(i, F24) & 0xF0) + 7 - b);
+				animSet(i, Phase, (animGet(i, Phase) & 0xF0) + 7 - b);
 				animSet(i, Frame, _vm->gfx()->getAnimScriptByte(i, 6 - b) + 2);
 				a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
 				animSet(i, ActionTimer, a + _enemySpeed);
@@ -656,7 +655,7 @@ void ActionSequenceHandler::updateEnemies() {
 			break;
 
 		case 6:
-			animSet(i, F24, (animGet(i, F24) & 0xF0) + 7);
+			animSet(i, Phase, (animGet(i, Phase) & 0xF0) + 7);
 			animSet(i, Frame, _vm->gfx()->getAnimScriptByte(i, 6));
 			a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
 			animSet(i, ActionTimer, a + _enemySpeed);
@@ -666,16 +665,16 @@ void ActionSequenceHandler::updateEnemies() {
 			a = _vm->gfx()->getAnimScriptByte(i, b);
 			if (a == animGet(i, Frame)) {
 				animSet(i, Frame, a + 2);
-				animSet(i, F24, animGet(i, F24) + 1);
+				animSet(i, Phase, animGet(i, Phase) + 1);
 				a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
 				animSet(i, ActionTimer, a + _enemySpeed);
 			}
 
-			if ((animGet(i, F24) & 0x0F) != 8)
+			if ((animGet(i, Phase) & 0x0F) != 8)
 				break;
 
 			animSet(i, Frame, animGet(i, Frame) - 2);
-			animSet(i, F24, 0);
+			animSet(i, Phase, 0);
 
 			if (_stage != 0 && _stage != 11 && _stage != 7)
 				animSet(i, ControlFlags, GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide);
@@ -699,7 +698,7 @@ void ActionSequenceHandler::updateStage() {
 		if (v && _enemyAppearanceCount == v)
 			return;
 
-		if (_shoot_78EC == _scd->makePtr(_useLightGun ? 0x11FC0 : 0x11FB0)[_stage])
+		if (_activeEnemies == _scd->makePtr(_useLightGun ? 0x11FC0 : 0x11FB0)[_stage])
 			return;
 
 		_nextEnemyAppearanceTimer = 16 + _enemySpeed + (_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1);
@@ -710,7 +709,7 @@ void ActionSequenceHandler::updateStage() {
 	} else if (_updateEnemiesPhase == 1) {
 		uint8 num = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F];
 		_animNo = num + 32;
-		int16 v = animGet(_animNo, F24);
+		int16 v = animGet(_animNo, Phase);
 		if (v == 0xFF || ((v & 0x0F) != 0))
 			return;
 
@@ -750,7 +749,7 @@ void ActionSequenceHandler::updateStage() {
 		}
 
 		v = v << 4;
-		animSet(_animNo, F24, v);
+		animSet(_animNo, Phase, v);
 
 		if (v == 0x20) {
 			++_civilianAppearanceCount;
@@ -761,13 +760,13 @@ void ActionSequenceHandler::updateStage() {
 		uint8 v = _vm->gfx()->getAnimScriptByte(_animNo, 0);
 		animSet(_animNo, Frame, v != 2 ? v + 2 : 2);
 		animSet(_animNo, Enable, 1);
-		if (animGet(_animNo, F24) != 0x20 && (_stage == 0 || _stage == 11)) {
+		if (animGet(_animNo, Phase) != 0x20 && (_stage == 0 || _stage == 11)) {
 			animSet(58, Enable, 1);
 			animSet(58, ControlFlags, GraphicsEngine::kAnimPause);
 			animSet(58, Frame, animGet(58, Frame) + 1);
 		}
 
-		animSet(_animNo, F24, (animGet(_animNo, F24) & 0xF0) | 1);
+		animSet(_animNo, Phase, (animGet(_animNo, Phase) & 0xF0) | 1);
 		_updateEnemiesPhase = 0;
 
 		if (_stage == 0 || _stage == 11)
@@ -837,7 +836,7 @@ void ActionSequenceHandler::checkFinished() {
 			return;
 
 		for (int i = 32; i < 41; ++i) {
-			int16 a = animGet(i, F24);
+			int16 a = animGet(i, Phase);
 			if (a == 0xFF)
 				continue;
 			if ((a & 0x0F) != 0)
diff --git a/engines/snatcher/action.h b/engines/snatcher/action.h
index 9f947d740d2..67459a22a1b 100644
--- a/engines/snatcher/action.h
+++ b/engines/snatcher/action.h
@@ -88,7 +88,7 @@ private:
 	int16 _shoot_78EE;
 	int16 _counter1;
 	int16 _counter2;
-	int16 _shoot_78EC;
+	int16 _activeEnemies;
 	int16 _attackerId;
 	int16 *_projectileCoords;
 	bool _active;
diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index 172c23420f5..ebdeef5c854 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -41,7 +41,7 @@ namespace Snatcher {
 
 struct AnimObject {
 	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), palette(0), target(0), f18(0), f1c(0),
-		timeStamp(0), f24(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), actionTimer(0), spriteTableLocation(0),
+		timeStamp(0), phase(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), actionTimer(0), spriteTableLocation(0),
 			res(), scriptData(), spriteData(nullptr), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), scriptComFlags(0), freeze(0), blink(0), blinkCounter(0), blinkDuration(0) {}
 
 	void clear() {
@@ -52,7 +52,7 @@ struct AnimObject {
 		target = f18 = 0;
 		f1c = 0;
 		timeStamp = 0;
-		f24 = 0;
+		phase = 0;
 		controlFlags = allowFrameDrop = frameSeqCounter = 0;
 		frame = 0;
 		frameDelay = 0;
@@ -79,7 +79,7 @@ struct AnimObject {
 	uint16 f18;
 	uint8 f1c;
 	uint32 timeStamp;
-	uint8 f24;
+	uint8 phase;
 	uint8 controlFlags;
 	uint8 allowFrameDrop;
 	uint8 frameSeqCounter;
@@ -149,7 +149,7 @@ private:
 	void updateScrollState();
 
 	void generateSpriteData(AnimObject &a, uint16 &spritesCurIndex, uint16 *&spritesBufferCurPos);
-	void generateSnowSprites(uint16 &spritesCurIndex, uint16 *&spritesBufferCurPos);
+	void generateSnowFlakesSpriteData(uint16 &spritesCurIndex, uint16 *&spritesBufferCurPos);
 	bool reachedAudioTimeStamp(AnimObject &a) const;
 	void runAnimScript(AnimObject &a);
 
@@ -513,9 +513,6 @@ void Animator_SCD::setAnimParameter(uint8 animObjId, int param, int32 value) {
 	assert(animObjId < 64);
 	AnimObject &a = *_animations[animObjId];
 
-	if (animObjId == 36)
-		debug("%s(): animObjId: %d, param: %d, value: %d", __FUNCTION__, animObjId, param, value);
-
 	switch (param) {
 	case GraphicsEngine::kAnimParaEnable:
 		a.enable = value ? 1 : 0;
@@ -553,8 +550,8 @@ void Animator_SCD::setAnimParameter(uint8 animObjId, int param, int32 value) {
 	case GraphicsEngine::kAnimParaTimeStamp:
 		a.timeStamp = (uint32)value;
 		break;
-	case GraphicsEngine::kAnimParaF24:
-		a.f24 = value;
+	case GraphicsEngine::kAnimParaPhase:
+		a.phase = value;
 		break;
 	case GraphicsEngine::kAnimParaControlFlags:
 		a.controlFlags = value;
@@ -637,8 +634,8 @@ int32 Animator_SCD::getAnimParameter(uint8 animObjId, int param) const {
 		return a.f1c;
 	case GraphicsEngine::kAnimParaTimeStamp:
 		return (int32)a.timeStamp;
-	case GraphicsEngine::kAnimParaF24:
-		return a.f24;
+	case GraphicsEngine::kAnimParaPhase:
+		return a.phase;
 	case GraphicsEngine::kAnimParaControlFlags:
 		return a.controlFlags;
 	case GraphicsEngine::kAnimParaAllowFrameDrop:
@@ -673,8 +670,7 @@ int32 Animator_SCD::getAnimParameter(uint8 animObjId, int param) const {
 
 uint8 Animator_SCD::getAnimScriptByte(uint8 animObjId, uint16 offset) const {
 	assert(animObjId < 64);
-	debug ("%s(): anim %d, scriptdata %p", __FUNCTION__, animObjId, _animations[animObjId]->scriptData());
-	return _animations[animObjId]->scriptData[offset];
+	return (_animations[animObjId]->scriptData() != nullptr) ? _animations[animObjId]->scriptData[offset] : 0;
 }
 
 void Animator_SCD::animCopySpec(uint8 srcAnimObjId, uint8 dstAnimObjId) {
@@ -873,7 +869,7 @@ void Animator_SCD::drawAnimSprites() {
 		if (a.enable && a.spriteData != nullptr && !(a.controlFlags & GraphicsEngine::kAnimHide) && a.blinkRate != 0xFFFF && !(a.blinkRate & _gfxState.frameCount()))
 			generateSpriteData(a, nxt, d);
 		if (i == 31)
-			generateSnowSprites(nxt, d);
+			generateSnowFlakesSpriteData(nxt, d);
 	}
 
 	if (d - 3 > _spriteBuffer)
@@ -1004,26 +1000,30 @@ void Animator_SCD::generateSpriteData(AnimObject &a, uint16 &spritesCurIndex, ui
 	}
 }
 
-void Animator_SCD::generateSnowSprites(uint16 &spritesCurIndex, uint16 *&spritesBufferCurPos) {
+void Animator_SCD::generateSnowFlakesSpriteData(uint16 &spritesCurIndex, uint16 *&spritesBufferCurPos) {
 	uint8 mode = _gfxState.getVar(12);
 	if (mode == 0)
 		return;
 
-	static const uint8 xcoords[] = {
+	static const uint8 startX[] = {
 		0xb8, 0x18, 0x50, 0xd8, 0x30, 0xa8, 0x80, 0xc4, 0x78, 0x10, 0xc8, 0x68, 0x40, 0xf8, 0x70, 0xa0,
 		0x38, 0xe8, 0x58, 0xb0, 0x08, 0x9c, 0x90, 0x5c, 0x28, 0xa4, 0x70, 0x20, 0x60, 0xd0, 0xe0, 0x7c
 	};
 
 	uint16 h = _gfxState.frameCount() >> 1;
 
+	// Mode 1 is used outside the church in act 3.
+	// Modes 3 - 12 appear when sitting inside the turbo cycle.
+	// A higher number setting increases the speed of the snowflakes.
+
 	if (mode < 3) {
-		static const uint16 tiles[] = { 
+		static const uint16 tiles[] = {
 			0x0301, 0x0303, 0x0305, 0x0302, 0x0448, 0x0448,	0x0448, 0x0448, 0x044c, 0x044c, 0x044c, 0x044c
 		};
 		static const int8 xoffs[] = {
 			-1, 0, 1, -1, 0, 1, -1, 0, -1, 1, -1, 1, 0, -1, 0, -1
 		};
-		
+
 		uint16 mi = (mode - 1) << 3;
 
 		for (int i = (mode ^ 3) << 4; i >= 0 && spritesCurIndex < 65; --i) {
@@ -1031,14 +1031,13 @@ void Animator_SCD::generateSnowSprites(uint16 &spritesCurIndex, uint16 *&sprites
 			uint16 x = (FROM_BE_16(spritesBufferCurPos[3]) & 0xFF) - 0x80;
 
 			uint16 ci = spritesCurIndex - 1;
-			uint16 y = ((spritesCurIndex & 3) ? ((ci << 4) + h) >> 1 : ((ci ^ 0xFF) << 3) + h) + 8;
-
-			if (tiles[((((ci + x) >> 2) & 6) + mi) >> 1] == (tl & 0x7FF)) {
+			uint16 y = (((spritesCurIndex & 3) ? ((ci << 4) + h) >> 1 : ((ci ^ 0xFF) << 3) + h) & 0x7F) + 8;
+			if (tiles[((((ci + x) >> 2) & 6) + mi) >> 1] != (tl & 0x7FF)) {
 				tl = 0x2000;
-				x = xcoords[ci & 0x1F];
+				x = startX[ci & 0x1F];
 			}
 
-			x = (xoffs[(ci + h) & 0x0F] + x) & 0xFF;
+			x = (x + xoffs[(ci + h) & 0x0F]) & 0xFF;
 			if (x >= (mode == 2 ? 56 : 32)) {
 				if (x >= (mode == 2 ? 176 : 224))
 					y = 0;
@@ -1053,11 +1052,11 @@ void Animator_SCD::generateSnowSprites(uint16 &spritesCurIndex, uint16 *&sprites
 			*spritesBufferCurPos++ = TO_BE_16(y + 0x80);
 			*spritesBufferCurPos++ = TO_BE_16((mode == 2 ? 0x500 : 0) | (spritesCurIndex++));
 			*spritesBufferCurPos++ = TO_BE_16(tl);
-			*spritesBufferCurPos++ = TO_BE_16(x + 0x80);		
+			*spritesBufferCurPos++ = TO_BE_16(x + 0x80);
 		}
 
 	} else if (mode < 13) {
-		static const uint16 tiles[] = { 
+		static const uint16 tiles[] = {
 			0x03C4, 0x03C8, 0x03CC, 0x03D0, 0x03D4, 0x03D8
 		};
 		static const uint8 xoffsm[] = {
@@ -1078,30 +1077,30 @@ void Animator_SCD::generateSnowSprites(uint16 &spritesCurIndex, uint16 *&sprites
 
 		for (int i = 32; i >= 0 && spritesCurIndex < 65; --i) {
 			uint16 tl = FROM_BE_16(spritesBufferCurPos[2]);
-			int16 x = (FROM_BE_16(spritesBufferCurPos[3]) & 0xFF) - 0x80;
+			uint16 x = (FROM_BE_16(spritesBufferCurPos[3]) & 0xFF) - 0x80;
 
-			int16 ci = spritesCurIndex - 1;
-			int16 y = ((spritesCurIndex & 3) ? ((ci << 4) + h) >> 1 : ((ci ^ 0xFF) << 3) + h) & 0x7F;
+			uint16 ci = spritesCurIndex - 1;
+			uint16 y = ((spritesCurIndex & 3) ? ((ci << 4) + h) >> 1 : ((ci ^ 0xFF) << 3) + h) & 0x7F;
 
-			if (tiles[(((ci + x) >> 2) & 6) >> 1] == (tl & 0x7FF)) {
+			if (tiles[(((ci + x) >> 2) & 6) >> 1] != (tl & 0x7FF)) {
 				tl = 0x4000;
-				x = xcoords[ci & 0x1F];
+				x = startX[ci & 0x1F];
 			}
 
 			if (x < 128) {
 				x -= xoffsm[((ci + h) & 0x0F) + mi];
-				//if (x < 16)
-				//	x = 127 - xoffsf[_gfxState.frameCount() & 7];
+				if (x < 16)
+					x = 127 - xoffsf[_gfxState.frameCount() & 7];
 			} else {
 				x = (x + xoffsm[((ci + h) & 0x0F) + mi]) & 0xFF;
-				//if (x >= 216)
-				//	x = 128 + xoffsf[_gfxState.frameCount() & 7];
+				if (x >= 216)
+					x = 128 + xoffsf[_gfxState.frameCount() & 7];
 			}
 
 			if (x < 16)
 				y = 0;
 			else if (y >= 112)
-				y = -4;
+				y = 0xFFFC;
 
 			tl = (tl & 0xF800) | tiles[(((ci + x) >> 2) & 6) >> 1];
 
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 6994986d53b..28b76d773d3 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -273,6 +273,8 @@ void GraphicsEngine::loadState(Common::SeekableReadStream *in) {
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
 	in->read(_animSaveLoadData, 64);
+	//for (int i = 0; i < 13; ++i)
+	//	_state.setVar(i, in->readByte());
 }
 
 void GraphicsEngine::saveState(Common::SeekableWriteStream *out) {
@@ -286,7 +288,7 @@ void GraphicsEngine::saveState(Common::SeekableWriteStream *out) {
 				v |= 0x40;
 			} else {
 				v |= (getAnimParameter(i, kAnimParaControlFlags) & 0x03);
-				v |= (getAnimParameter(i, kAnimParaF24) & 0x0C);
+				v |= (getAnimParameter(i, kAnimParaPhase) & 0x0C);
 				if (cf & 1)
 					v |= 0x10;
 				if (getAnimParameter(i, kAnimParaAllowFrameDrop))
@@ -296,6 +298,8 @@ void GraphicsEngine::saveState(Common::SeekableWriteStream *out) {
 		_animSaveLoadData[i] = v;
 	}
 	out->write(_animSaveLoadData, 64);
+	for (int i = 0; i < 13; ++i)
+		out->writeByte(_state.getVar(i));
 }
 
 void GraphicsEngine::postLoadProcess() {
@@ -311,8 +315,8 @@ void GraphicsEngine::postLoadProcess() {
 			continue;
 		uint8 cf = getAnimParameter(i, kAnimParaControlFlags) & 0xFC;
 		setAnimParameter(i, kAnimParaControlFlags, cf | (v & 0x03));
-		cf = getAnimParameter(i, kAnimParaF24) & 0xF3;
-		setAnimParameter(i, kAnimParaF24, cf | (v & 0x0C));
+		cf = getAnimParameter(i, kAnimParaPhase) & 0xF3;
+		setAnimParameter(i, kAnimParaPhase, cf | (v & 0x0C));
 		if (v & 0x10)
 			setAnimParameter(i, kAnimParaScriptComFlags, getAnimParameter(i, kAnimParaScriptComFlags) | 1);
 		else
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 070de1209f3..5c3b19ad100 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -108,7 +108,7 @@ public:
 		kAnimParaF18,
 		kAnimParaF1c,
 		kAnimParaTimeStamp,
-		kAnimParaF24,
+		kAnimParaPhase,
 		kAnimParaControlFlags,
 		kAnimParaAllowFrameDrop,
 		kAnimParaFrameSeqCounter,
diff --git a/engines/snatcher/saveload.cpp b/engines/snatcher/saveload.cpp
index 550184d8004..891a2c79132 100644
--- a/engines/snatcher/saveload.cpp
+++ b/engines/snatcher/saveload.cpp
@@ -286,7 +286,7 @@ Common::OutSaveFile *SaveLoadManager::openFileForSaving(int slot, const Common::
 	out->writeSint32BE(td.tm_wday);
 
 	out->writeUint32BE(state.totalPlayTime);
-	out->writeSint16BE(state.saveCount);
+	out->writeSint16BE(++state.saveCount);
 
 	return out;
 }
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index 2b2ab2320f0..e7611cd4b63 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -98,7 +98,7 @@ void CmdQueue::makeFunctions() {
 	static const SFunc funcTbl[] = {
 		OP(end),
 		OP(initAnimations),
-		OP(02),
+		OP(animPauseAll),
 		OP(drawCommands),
 		OP(fmSfxBlock),
 		OP(printText),
@@ -116,20 +116,20 @@ void CmdQueue::makeFunctions() {
 		OP(loadResource),
 		OP(gfxStart),
 		OP(fmMusicWait),
-		OP(20),
+		OP(nop),
 		OP(invItemCloseUp),
 		OP(resetTextFields),
-		OP(23),
+		OP(unused),
 		OP(shooterSequenceRun),
 		OP(fmSfxWait),
-		OP(26),
+		OP(nop2),
 		OP(cdaSync),
 		OP(fmSoundEffect),
 		OP(pcmBlock),
 		OP(saveGame),
 		OP(shooterSequenceResetScore),
 		OP(gfxPostLoadProcess),
-		OP(33),
+		OP(waitForStartButton),
 		OP(palOps),
 		OP(clearTextInputLine)
 	};
@@ -166,7 +166,7 @@ void CmdQueue::m_initAnimations(const uint16 *&data) {
 	_progress = -1;
 }
 
-void CmdQueue::m_02(const uint16 *&data) {
+void CmdQueue::m_animPauseAll(const uint16 *&data) {
 	if (_progress == 0) {
 		_vm->gfx()->reset(GraphicsEngine::kResetPalEvents);
 		for (int i = 0; i < 64; ++i)
@@ -266,7 +266,7 @@ void CmdQueue::m_pcmSound(const uint16 *&data) {
 void CmdQueue::m_chatWithPortraitAnim(const uint16 *&data) {
 	if (_progress == 0) {
 		_vm->sound()->pcmInitSound(*data);
-		//_c13Valu = 0xFF;
+		//_unused13 = 0xFF;
 		++_progress;
 	} else if (_progress == 1) {
 		++_progress;
@@ -374,7 +374,8 @@ void CmdQueue::m_fmMusicWait(const uint16 *&data) {
 		_progress = -1;
 }
 
-void CmdQueue::m_20(const uint16 *&data) {
+void CmdQueue::m_nop(const uint16 *&data) {
+	_progress = -1;
 }
 
 void CmdQueue::m_invItemCloseUp(const uint16 *&data) {
@@ -394,7 +395,8 @@ void CmdQueue::m_resetTextFields(const uint16 *&data) {
 	_progress = -1;
 }
 
-void CmdQueue::m_23(const uint16 *&data) {
+void CmdQueue::m_unused(const uint16 *&data) {
+	//_unused13 = 0xFF;
 }
 
 void CmdQueue::m_shooterSequenceRun(const uint16 *&data) {
@@ -411,7 +413,9 @@ void CmdQueue::m_fmSfxWait(const uint16 *&data) {
 		_progress = -1;
 }
 
-void CmdQueue::m_26(const uint16 *&data) {
+void CmdQueue::m_nop2(const uint16 *&data) {
+	++data;
+	_progress = -1;
 }
 
 void CmdQueue::m_cdaSync(const uint16 *&data) {
@@ -452,7 +456,9 @@ void CmdQueue::m_gfxPostLoadProcess(const uint16 *&data) {
 	_progress = -1;
 }
 
-void CmdQueue::m_33(const uint16 *&data) {
+void CmdQueue::m_waitForStartButton(const uint16 *&data) {
+	if (_vm->input().singleFrameControllerFlags & 0x80)
+		_progress = -1;
 }
 
 void CmdQueue::m_palOps(const uint16 *&data) {
@@ -860,69 +866,69 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 #endif
 	static const SFunc funcTbl[] = {
 		OP(animOps),
-		OP(eval_add),
-		OP(eval_add),
-		OP(eval_add),
+		OP(evalAdd),
+		OP(evalAdd),
+		OP(evalAdd),
 		OP(chatWithPortraitAnim),
-		OP(05),
-		OP(eval_and),
-		OP(eval_and),
-		OP(eval_and),
-		OP(eval_and),
+		OP(pcmSound),
+		OP(evalAnd),
+		OP(evalAnd),
+		OP(evalAnd),
+		OP(evalAnd),
 		OP(fmMusicStart),
 		OP(runSubScript),
 		OP(callSubroutine),
 		OP(cdaPlay),
-		OP(14),
+		OP(incrCounter),
 		OP(fmSoundEffect),
-		OP(eval_equal),
-		OP(eval_equal),
-		OP(eval_equal),
+		OP(evalEquals),
+		OP(evalEquals),
+		OP(evalEquals),
 		OP(clearFlags),
 		OP(setFlags),
-		OP(21),
-		OP(eval_less),
-		OP(eval_lessOrEqual),
-		OP(do_either_or),
-		OP(do_either_or),
-		OP(do_if),
-		OP(do_if),
-		OP(28),
-		OP(28),
-		OP(executeFunction),
-		OP(executeFunction),
-		OP(executeFunction),
-		OP(executeFunction),
-		OP(executeFunction),
-		OP(executeFunction),
-		OP(executeFunction),
-		OP(executeFunction),
-		OP(executeFunction),
-		OP(executeFunction),
-		OP(eval_greater),
-		OP(eval_greater),
-		OP(eval_greaterOrEqual),
+		OP(getPrevPosition),
+		OP(evalLess),
+		OP(evalLessOrEqual),
+		OP(doEitherOr),
+		OP(doEitherOr),
+		OP(doIf),
+		OP(doIf),
+		OP(setResult),
+		OP(setResult),
+		OP(execFunc),
+		OP(execFunc),
+		OP(execFunc),
+		OP(execFunc),
+		OP(execFunc),
+		OP(execFunc),
+		OP(execFunc),
+		OP(execFunc),
+		OP(execFunc),
+		OP(execFunc),
+		OP(evalGreater),
+		OP(evalGreater),
+		OP(evalGreaterOrEqual),
 		OP(break),
 		OP(break),
 		OP(nop),
-		OP(eval_true),
-		OP(eval_true),
+		OP(evalTrue),
+		OP(evalTrue),
 		OP(start),
-		OP(eval_or),
-		OP(eval_or),
-		OP(eval_or),
-		OP(52),
-		OP(52),
-		OP(54),
-		OP(54),
+		OP(evalOr),
+		OP(evalOr),
+		OP(evalOr),
+		OP(condExec),
+		OP(condExec),
+		OP(sentenceRecurseBegin),
+		OP(sentenceRecurseBegin),
 		OP(verbOps),
-		OP(57),
+		OP(sentenceRecurseEnd),
 		OP(returnFromSubScript),
-		OP(59),
-		OP(59),
+		OP(checkSubRecurseState),
+		OP(checkSubRecurseState),
 		OP(loadModuleAndStartGfx),
-		OP(62),
-		OP(switchToNextOp),
+		OP(randomSwitch),
+		OP(sequentialSwitch),
 		OP(64),
 		OP(sysOps),
 		OP(sysOps),
@@ -960,7 +966,7 @@ void ScriptEngine::o_animOps() {
 	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 2));
 }
 
-void ScriptEngine::o_eval_add() {
+void ScriptEngine::o_evalAdd() {
 	uint16 m1 = 0;
 	uint16 m2 = 0;
 	uint16 f2 = 0;
@@ -981,14 +987,14 @@ void ScriptEngine::o_chatWithPortraitAnim() {
 	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
 }
 
-void ScriptEngine::o_05() {
+void ScriptEngine::o_pcmSound() {
 	if (!evalFinished())
 		return;
 	_que->writeUInt16(0x0C);
 	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
 }
 
-void ScriptEngine::o_eval_and() {
+void ScriptEngine::o_evalAnd() {
 	uint16 m1 = 0;
 	uint16 m2 = 0;
 	uint16 f2 = 0;
@@ -1055,7 +1061,7 @@ void ScriptEngine::o_cdaPlay() {
 
 }
 
-void ScriptEngine::o_14() {
+void ScriptEngine::o_incrCounter() {
 	if (!evalFinished())
 		return;
 
@@ -1075,7 +1081,7 @@ void ScriptEngine::o_fmSoundEffect() {
 	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
 }
 
-void ScriptEngine::o_eval_equal() {
+void ScriptEngine::o_evalEquals() {
 	uint16 m1 = 0;
 	uint16 m2 = 0;
 	uint16 f2 = 0;
@@ -1101,13 +1107,13 @@ void ScriptEngine::o_setFlags() {
 	setFlags(READ_BE_UINT16(_script->data + _pos1 + 1), 0xFFFF);
 }
 
-void ScriptEngine::o_21() {
+void ScriptEngine::o_getPrevPosition() {
 	uint16 n = READ_BE_UINT16(_script->data + _pos1 + 1);
 	if (!getArrayEntry(4, ARR_POS(4) - n, _result))
 		_result = 0xFFFF;
 }
 
-void ScriptEngine::o_eval_less() {
+void ScriptEngine::o_evalLess() {
 	uint16 m1 = 0;
 	uint16 m2 = 0;
 	uint16 r1 = 0;
@@ -1120,7 +1126,7 @@ void ScriptEngine::o_eval_less() {
 	_result = (_result < r1) ? 0xFFFF : 0;
 }
 
-void ScriptEngine::o_eval_lessOrEqual() {
+void ScriptEngine::o_evalLessOrEqual() {
 	uint16 m1 = 0;
 	uint16 m2 = 0;
 	uint16 r1 = 0;
@@ -1133,7 +1139,7 @@ void ScriptEngine::o_eval_lessOrEqual() {
 	_result = (_result <= r1) ? 0xFFFF : 0;
 }
 
-void ScriptEngine::o_do_either_or() {
+void ScriptEngine::o_doEitherOr() {
 	uint16 mode = 0;
 	uint16 f1 = 0;
 	uint16 f2 = 0;
@@ -1146,7 +1152,7 @@ void ScriptEngine::o_do_either_or() {
 	runOpcode();
 }
 
-void ScriptEngine::o_do_if() {
+void ScriptEngine::o_doIf() {
 	uint16 mode = 0;
 	uint16 f1 = 0;
 	uint16 f2 = 0;
@@ -1159,7 +1165,7 @@ void ScriptEngine::o_do_if() {
 	runOpcode();
 }
 
-void ScriptEngine::o_28() {
+void ScriptEngine::o_setResult() {
 	if (!evalFinished())
 		return;
 
@@ -1174,7 +1180,7 @@ void ScriptEngine::o_28() {
 	setFlags(sel, _result);
 }
 
-void ScriptEngine::o_executeFunction() {
+void ScriptEngine::o_execFunc() {
 	_pos2 = _pos1;
 	uint8 num = countFunctionOps();
 	uint8 cnt = 1;
@@ -1191,7 +1197,7 @@ void ScriptEngine::o_executeFunction() {
 	}
 }
 
-void ScriptEngine::o_eval_greater() {
+void ScriptEngine::o_evalGreater() {
 	uint16 m1 = 0;
 	uint16 m2 = 0;
 	uint16 f2 = 0;
@@ -1205,7 +1211,7 @@ void ScriptEngine::o_eval_greater() {
 	_result = (_result > f2) ? 0xFFFF : 0;
 }
 
-void ScriptEngine::o_eval_greaterOrEqual() {
+void ScriptEngine::o_evalGreaterOrEqual() {
 	uint16 m1 = 0;
 	uint16 m2 = 0;
 	uint16 f2 = 0;
@@ -1242,7 +1248,7 @@ void ScriptEngine::o_break() {
 	_script->newPos = READ_BE_UINT16(_script->data + _pos2);
 }
 
-void ScriptEngine::o_eval_true() {
+void ScriptEngine::o_evalTrue() {
 	uint16 mode = 0;
 	uint16 f1 = 0;
 	uint16 f2 = 0;
@@ -1257,7 +1263,7 @@ void ScriptEngine::o_start() {
 	runOpcode();
 }
 
-void ScriptEngine::o_eval_or() {
+void ScriptEngine::o_evalOr() {
 	uint16 m1 = 0;
 	uint16 m2 = 0;
 	uint16 f2 = 0;
@@ -1271,7 +1277,7 @@ void ScriptEngine::o_eval_or() {
 	_result |= f2;
 }
 
-void ScriptEngine::o_52() {
+void ScriptEngine::o_condExec() {
 	uint16 ln = 0;
 	uint16 f1 = 0;
 	uint16 f2 = 0;
@@ -1282,7 +1288,7 @@ void ScriptEngine::o_52() {
 	runOpcode();
 }
 
-void ScriptEngine::o_54() {
+void ScriptEngine::o_sentenceRecurseBegin() {
 	if (!evalFinished())
 		return;
 
@@ -1335,7 +1341,7 @@ void ScriptEngine::o_verbOps() {
 	}
 }
 
-void ScriptEngine::o_57() {
+void ScriptEngine::o_sentenceRecurseEnd() {
 	if (!evalFinished())
 		return;
 
@@ -1355,7 +1361,7 @@ void ScriptEngine::o_returnFromSubScript() {
 	_que->writeUInt16(res);
 }
 
-void ScriptEngine::o_59() {
+void ScriptEngine::o_checkSubRecurseState() {
 	uint16 m = 0;
 	uint16 f1 = 0;
 	uint16 f2 = 0;
@@ -1398,7 +1404,7 @@ void ScriptEngine::o_loadModuleAndStartGfx() {
 	_script->curGfxScript = num;
 }
 
-void ScriptEngine::o_62() {
+void ScriptEngine::o_randomSwitch() {
 	uint16 sel = READ_BE_UINT16(_script->data + _pos1 + 1);
 	_pos2 = _pos1 + 3;
 	uint16 f = Util::rngGetNumberFromRange(1, countFunctionOps()) & 0xFF;
@@ -1409,7 +1415,7 @@ void ScriptEngine::o_62() {
 	setFlags(sel, f);
 }
 
-void ScriptEngine::o_switchToNextOp() {
+void ScriptEngine::o_sequentialSwitch() {
 	_pos2 = _pos1 + 3;
 	uint16 cnt = countFunctionOps();
 	uint16 sel = READ_BE_UINT16(_script->data + _pos1 + 1);
@@ -1509,7 +1515,7 @@ void ScriptEngine::o_sysOps() {
 		break;
 	case 12:
 		// This happens when starting a new act. Apparently, only a small portion of the game
-		// variables is needed for the whole game. The rest gets cleared and can be repurposed.
+		// variables is needed for the whole game. The rest gets cleared and can be reused.
 		_flagsTable[53] &= 0xF8;
 		memset(_flagsTable + 54, 0, 298);
 		break;
diff --git a/engines/snatcher/script.h b/engines/snatcher/script.h
index 75b5580cd8b..af352f2b341 100644
--- a/engines/snatcher/script.h
+++ b/engines/snatcher/script.h
@@ -71,7 +71,7 @@ private:
 
 	void m_end(const uint16 *&data);
 	void m_initAnimations(const uint16 *&data);
-	void m_02(const uint16 *&data);
+	void m_animPauseAll(const uint16 *&data);
 	void m_drawCommands(const uint16 *&data);
 	void m_fmSfxBlock(const uint16 *&data);
 	void m_printText(const uint16 *&data);
@@ -89,20 +89,20 @@ private:
 	void m_loadResource(const uint16 *&data);
 	void m_gfxStart(const uint16 *&data);
 	void m_fmMusicWait(const uint16 *&data);
-	void m_20(const uint16 *&data);
+	void m_nop(const uint16 *&data);
 	void m_invItemCloseUp(const uint16 *&data);
 	void m_resetTextFields(const uint16 *&data);
-	void m_23(const uint16 *&data);
+	void m_unused(const uint16 *&data);
 	void m_shooterSequenceRun(const uint16 *&data);
 	void m_fmSfxWait(const uint16 *&data);
-	void m_26(const uint16 *&data);
+	void m_nop2(const uint16 *&data);
 	void m_cdaSync(const uint16 *&data);
 	void m_fmSoundEffect(const uint16 *&data);
 	void m_pcmBlock(const uint16 *&data);
 	void m_saveGame(const uint16 *&data);
 	void m_shooterSequenceResetScore(const uint16 *&data);
 	void m_gfxPostLoadProcess(const uint16 *&data);
-	void m_33(const uint16 *&data);
+	void m_waitForStartButton(const uint16 *&data);
 	void m_palOps(const uint16 *&data);
 	void m_clearTextInputLine(const uint16 *&data);
 
@@ -190,41 +190,41 @@ private:
 
 	void o_nop();
 	void o_animOps();
-	void o_eval_add();
+	void o_evalAdd();
 	void o_chatWithPortraitAnim();
-	void o_05();
-	void o_eval_and();
+	void o_pcmSound();
+	void o_evalAnd();
 	void o_fmMusicStart();
 	void o_runSubScript();
 	void o_callSubroutine();
 	void o_cdaPlay();
-	void o_14();
+	void o_incrCounter();
 	void o_fmSoundEffect();
-	void o_eval_equal();
+	void o_evalEquals();
 	void o_clearFlags();
 	void o_setFlags();
-	void o_21();
-	void o_eval_less();
-	void o_eval_lessOrEqual();
-	void o_do_either_or();
-	void o_do_if();
-	void o_28();
-	void o_executeFunction();
-	void o_eval_greater();
-	void o_eval_greaterOrEqual();
+	void o_getPrevPosition();
+	void o_evalLess();
+	void o_evalLessOrEqual();
+	void o_doEitherOr();
+	void o_doIf();
+	void o_setResult();
+	void o_execFunc();
+	void o_evalGreater();
+	void o_evalGreaterOrEqual();
 	void o_break();
-	void o_eval_true();
+	void o_evalTrue();
 	void o_start();
-	void o_eval_or();
-	void o_52();
-	void o_54();
+	void o_evalOr();
+	void o_condExec();
+	void o_sentenceRecurseBegin();
 	void o_verbOps();
-	void o_57();
+	void o_sentenceRecurseEnd();
 	void o_returnFromSubScript();
-	void o_59();
+	void o_checkSubRecurseState();
 	void o_loadModuleAndStartGfx();
-	void o_62();
-	void o_switchToNextOp();
+	void o_randomSwitch();
+	void o_sequentialSwitch();
 	void o_64();
 	void o_sysOps();
 	void o_displayDialog();
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index bcd3be70638..60dd594b4ae 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -84,8 +84,8 @@ Common::Error SnatcherEngine::run() {
 	if (!initScriptEngine())
 		return Common::Error(Common::kUnknownError);
 
-	bool result = false;
-	while (!shouldQuit()) {
+	bool result = true;
+	while (result && !shouldQuit()) {
 		reset();
 		result = start();
 	}
@@ -197,6 +197,9 @@ void SnatcherEngine::reset() {
 }
 
 void SnatcherEngine::playBootLogoAnimation(const GameState &state) {
+	if (ConfMan.hasKey("save_slot"))
+		return; // Skip logo animation when loading a savegame from the launcher
+
 	uint32 frameTimer = 0;
 	int curSeqState = 0;
 	_snd->fmSendCommand(0xF2, -1);
@@ -411,7 +414,7 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 	}
 
 	if (_enableLightGun && _input.singleFrameControllerFlags & 0x100)
-		_gfx->setVar(7, 4);
+		_gfx->setVar(7, _gfx->getVar(7) | 4);
 }
 
 void SnatcherEngine::updateMainState(GameState &state) {
@@ -529,6 +532,7 @@ void SnatcherEngine::updateMainState(GameState &state) {
 		break;
 
 	default:
+		// Infinite loop (maybe change this to quit the engine instead)
 		break;
 	}
 }
diff --git a/engines/snatcher/text_scd.cpp b/engines/snatcher/text_scd.cpp
index 7aaa3b99405..b9e71ad208f 100644
--- a/engines/snatcher/text_scd.cpp
+++ b/engines/snatcher/text_scd.cpp
@@ -213,7 +213,7 @@ void TextRenderer_SCD::drawGlyph(uint16 ch) {
 				++d;
 			if (++dXX == 8)
 				d += 28;
-			
+
 		}
 
 		dst += 4;
diff --git a/engines/snatcher/ui.cpp b/engines/snatcher/ui.cpp
index 57c1d62f00c..bba25559fe1 100644
--- a/engines/snatcher/ui.cpp
+++ b/engines/snatcher/ui.cpp
@@ -79,7 +79,7 @@ bool UI::displayDialog(int sceneInfo, int sceneTextOffset, uint16 inputFlags) {
 	case 2:
 		if (_sceneId == 0) {
 			_gfx->transitionCommand(21);
-			//_c13Valu = 0xFF;
+			//_unused13 = 0xFF;
 			_textY = _headLineYOffset;
 		} else if (_sceneId == 0xFF) {
 			_textY = _headLineYOffset;
@@ -119,7 +119,7 @@ bool UI::displayDialog(int sceneInfo, int sceneTextOffset, uint16 inputFlags) {
 	case 6:
 		_sceneTextOffset = _sceneInfo = 0;
 		//if (!_sceneId)
-		//	_c13Valu = 0xFF;
+		//	_unused13 = 0xFF;
 		_progress = -1;
 		break;
 
@@ -152,7 +152,7 @@ bool UI::displayDialog(int sceneInfo, int sceneTextOffset, uint16 inputFlags) {
 		_textColor = 1;
 
 		_gfx->transitionCommand(_gfx->getVerbAreaType() == 0 ? 15 : (_gfx->getVerbAreaType() == 1 ? 20 : 22));
-		//_c13Valu = 0;
+		//_unused13 = 0;
 		_progress = 2;
 		break;
 
@@ -639,8 +639,6 @@ uint8 UI::drawVerb(uint8 id) {
 		if (*d++ == 0xFF)
 			break;
 	}
-	Common::String dbg((const char*)_verbTextBuffer + 9, (const char*)_verbTextBuffer + 32);
-	debug("VERB %d: %s", id, dbg.substr(0,  dbg.findFirstOf((char)0xFF, 0)).c_str());
 	_verbTextBuffer[47] = 0xFF;
 
 	return cid;
@@ -743,7 +741,7 @@ void UI::verbsTabHandleInput(const SnatcherEngine::Input &input) {
 		if (_verbInterfaceMode == 1) {
 			if (_scriptSentenceArray->pos() == 0) {
 				if (input.sustainedControllerFlagsRemapped & 0x10) {
-					//_c13Valu = 0xFF;
+					//_unused13 = 0xFF;
 					uint8 in = _flashLight.inputFlags = input.sustainedControllerFlagsRemapped;
 					_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
 					if (in & 1)
@@ -755,7 +753,7 @@ void UI::verbsTabHandleInput(const SnatcherEngine::Input &input) {
 					if (in & 4)
 						moveFlashLight(-0x20000, 0);
 				} else {
-					//_c13Valu = 0;
+					//_unused13 = 0;
 					_flashLight.posData = checkFlashLightPos(((_flashLight.posX >> 16) + 72) >> 2, ((_flashLight.posY >> 16) + 40) >> 2);
 					_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
 				}
@@ -974,7 +972,7 @@ bool UI::verbSelect2() {
 			_que->start();
 			_progress2 = 0x100;
 			return false;
-		}	
+		}
 
 		if (_progress2 == 0x100) {
 			if (_verbInterfaceMode == 3) {


Commit: af67c7d533c73e95fc994c8d903d057a1bba83f1
    https://github.com/scummvm/scummvm/commit/af67c7d533c73e95fc994c8d903d057a1bba83f1
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix pal version

Some tables have different values due to the different timing
and at least one table has a slightly differenty location. I have
added a memory mapping table that will probably be useful
when trying to add support for the PCE version. I haven't
implement pal timing, since converting the few table values
as necessary is definitely the more relyable way to go here.

Changed paths:
  A engines/snatcher/mem_mapping.cpp
  A engines/snatcher/mem_mapping.h
    engines/snatcher/action.cpp
    engines/snatcher/action.h
    engines/snatcher/detection.h
    engines/snatcher/detection_tables.h
    engines/snatcher/module.mk
    engines/snatcher/script.cpp
    engines/snatcher/snatcher.cpp
    engines/snatcher/ui.cpp


diff --git a/engines/snatcher/action.cpp b/engines/snatcher/action.cpp
index 403f4e5cdab..fd055c28346 100644
--- a/engines/snatcher/action.cpp
+++ b/engines/snatcher/action.cpp
@@ -22,6 +22,7 @@
 
 #include "snatcher/action.h"
 #include "snatcher/graphics.h"
+#include "snatcher/mem_mapping.h"
 #include "snatcher/resource.h"
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
@@ -31,7 +32,7 @@
 
 namespace Snatcher {
 
-ActionSequenceHandler::ActionSequenceHandler(SnatcherEngine *vm, ResourcePointer *scd) : _vm(vm), _scd(scd), _stage(0), _counter1(0), _counter2(0), _progressMSB(0), _progressLSB(0),
+ActionSequenceHandler::ActionSequenceHandler(SnatcherEngine *vm, ResourcePointer *scd, bool palTiming) : _vm(vm), _scd(scd), _palTiming(palTiming), _stage(0), _counter1(0), _counter2(0), _progressMSB(0), _progressLSB(0),
 	_weaponState(0), _enemySpeed(0), _active(false), _handleShotPhase(0), _updateEnemiesPhase(0), _enemyAttackStatus(0), _targetField(0), _hscrollB(0), _vscrollB(0),
 		_enemyAppearanceCount(0), _civilianAppearanceCount(0), _abortFight(0), _nextEnemyAppearanceTimer(0), _enemyAttackTimer(0), _shoot_78EE(0), _activeEnemies(0), _result(),
 			_attackerId(0), _animNo(0), _shoot_7912(0), _projectileCoords(nullptr) {
@@ -47,6 +48,13 @@ ActionSequenceHandler::~ActionSequenceHandler() {
 #define animGet(x, y) \
 	_vm->gfx()->getAnimParameter(x, GraphicsEngine::kAnimPara##y)
 
+uint16 fromPAL(uint16 value) {
+	// Convert the PAL value to NTSC equivalent. The original game's VINT interrupt obviously runs at a different speed for PAL versions, so the
+	// timer tables have been adjusted to produce the same result. We just convert the values from the tables so that they match the NTSC version.
+	uint32 clc = value * 0x3C0000 / 0x32;
+	return (clc >> 16) + ((clc & 0xFFFF) ? 1 : 0);
+}
+
 bool ActionSequenceHandler::run(bool useLightGun) {
 	_useLightGun = useLightGun;
 	switch (_progressMSB) {
@@ -55,20 +63,20 @@ bool ActionSequenceHandler::run(bool useLightGun) {
 		case 0:
 			++_progressLSB;
 			_counter1 = 0;
-			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(0x11E7E));
+			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(MemMapping::MEM_PALDATA_02));
 			break;
 		case 1:
 			if (++_counter1 < 2)
 				break;
 			_counter1 = 0;
-			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(0x11E6A));
+			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(MemMapping::MEM_PALDATA_00));
 			if (_stage == 0 || _stage == 11) {
 				_progressLSB += 2;
 			} else {
-				_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x11EE6));
+				_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_02));
 				if (_stage != 5) {
-					_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x11ED8));
-					_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x11EF4));
+					_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_01));
+					_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_03));
 				}
 				++_progressLSB;
 			}
@@ -96,12 +104,17 @@ bool ActionSequenceHandler::run(bool useLightGun) {
 			_abortFight = 0;
 			initStage();
 
-			_nextEnemyAppearanceTimer = _scd->makePtr(0x11F60)[_stage];
-			_progressMSB = _scd->makePtr(0x11F50)[_stage];
+			_nextEnemyAppearanceTimer = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_05)[_stage];
+			if (_palTiming)
+				_nextEnemyAppearanceTimer = fromPAL(_nextEnemyAppearanceTimer);
+			_progressMSB = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_04)[_stage];
 			_progressLSB = 0;
 
-			if (_enemySpeed == 0)
-				_enemySpeed = _scd->makePtr(0x11F70)[_stage];
+			if (_enemySpeed == 0) {
+				_enemySpeed = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_06)[_stage];
+				if (_palTiming)
+					_enemySpeed = fromPAL(_enemySpeed);
+			}
 			break;
 
 		default:
@@ -164,7 +177,7 @@ bool ActionSequenceHandler::run(bool useLightGun) {
 		if (_civilianAppearanceCount && _civilianAppearanceCount == _result.civiliansShot)
 			_result.allCiviliansShot = 1;
 		if (_stage != 0 && _stage != 11)
-			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(_result.hitsTaken < 6 ? 0x11E92 : 0x11E8C));
+			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(_result.hitsTaken < 6 ? MemMapping::MEM_PALDATA_04 : MemMapping::MEM_PALDATA_03));
 		animSet(22, Enable, 0);
 		animSet(23, Enable, 0);
 		_vm->allowLightGunInput(false);
@@ -178,7 +191,7 @@ bool ActionSequenceHandler::run(bool useLightGun) {
 		case 0:
 			if (_vm->sound()->pcmGetStatus().statusBits & 8)
 				break;
-			if ((_scd->makePtr(_useLightGun ? 0x11FC0 : 0x11FB0)[_stage] == 1) || (++_counter1 >= 64)) {
+			if ((_scd->makePtr(_useLightGun ? MemMapping::MEM_ACTIONSEQDATA_11 : MemMapping::MEM_ACTIONSEQDATA_10)[_stage] == 1) || (++_counter1 >= 64)) {
 					++_progressLSB;
 			} else if (_result.hitsTaken < 6) {
 				handleWeaponDrawAndTargetSelection();
@@ -193,14 +206,14 @@ bool ActionSequenceHandler::run(bool useLightGun) {
 		case 2:
 			++_progressLSB;
 			_counter1 = 0;
-			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(0x11E7E));
+			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(MemMapping::MEM_PALDATA_02));
 			break;
 		case 3:
 			if (_stage != 0 && _stage != 11) {
 				if (++_counter1 < 2)
 					break;
 				_counter1 = 0;
-				_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x11F02));
+				_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_04));
 			}
 			++_progressLSB;
 			break;
@@ -210,7 +223,7 @@ bool ActionSequenceHandler::run(bool useLightGun) {
 			_counter1 = 0;
 			++_progressMSB;
 			_progressLSB = 0;
-			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(0x11E74));
+			_vm->gfx()->enqueuePaletteEvent(_scd->makePtr(MemMapping::MEM_PALDATA_01));
 			break;
 		default:
 			break;
@@ -293,14 +306,14 @@ void ActionSequenceHandler::resetVars() {
 }
 
 void ActionSequenceHandler::initStage() {
-	uint8 e = _scd->makePtr(0x11FD0)[_stage];
+	uint8 e = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_12)[_stage];
 	for (int i = 0; i < 9; ++i) {
 		animSet(32 + i, Frame, 2);
 		animSet(32 + i, FrameDelay, 0);
 		animSet(32 + i, Phase, 0);
 		animSet(32 + i, Enable, e);
 	}
-	const int16 *in = reinterpret_cast<const int16*>(_scd->makePtr(0x11FEC)());
+	const int16 *in = reinterpret_cast<const int16*>(_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_15)());
 	for (int i = 0; i < 18; ++i)
 		_projectileCoords[i] = FROM_BE_16(*in++);
 
@@ -359,7 +372,7 @@ void ActionSequenceHandler::handleWeaponDrawAndTargetSelection() {
 			_weaponState ^= 1;
 			int16 enableAnim = 0;
 			if (_weaponState) {
-				_vm->sound()->pcmSendCommand(_scd->makePtr(0x11F20)[_stage], -1);
+				_vm->sound()->pcmSendCommand(_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_01)[_stage], -1);
 				_result.weaponDrawn = enableAnim = 1;
 				if (_useLightGun) {
 					_vm->allowLightGunInput(true);
@@ -400,8 +413,8 @@ void ActionSequenceHandler::handleWeaponDrawAndTargetSelection() {
 		else
 			vert += 2;
 
-		animSet(22, PosX, (_scd->makePtr(0x11FE0) + horz).readSINT16());
-		animSet(22, PosY, (_scd->makePtr(0x11FE6) + vert).readSINT16());
+		animSet(22, PosX, (_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_13) + horz).readSINT16());
+		animSet(22, PosY, (_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_14) + vert).readSINT16());
 
 	} else {
 		if (_weaponState & 2) {
@@ -466,9 +479,9 @@ void ActionSequenceHandler::handleShot() {
 			animSet(21, FrameDelay, 2);
 			animSet(21, Frame, 0);
 			animSet(21, Target, tf);
-			animSet(21, PosX, (_scd->makePtr(0x11FEC) + (tf << 1)).readSINT16());
-			animSet(21, PosY, (_scd->makePtr(0x11FFE) + (tf << 1)).readSINT16());
-			_vm->sound()->pcmSendCommand(_scd->makePtr(0x11F30)[_stage], -1);
+			animSet(21, PosX, (_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_15) + (tf << 1)).readSINT16());
+			animSet(21, PosY, (_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_16) + (tf << 1)).readSINT16());
+			_vm->sound()->pcmSendCommand(_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_02)[_stage], -1);
 			++_handleShotPhase;
 			break;
 
@@ -490,7 +503,7 @@ void ActionSequenceHandler::handleShot() {
 			vl = animGet(32 + tf, Phase) & 0x0F;
 			if (vl < 2 || vl > 4) {
 				if (_stage != 10) {
-					if (_useLightGun || _scd->makePtr(0x11FD0)[_stage] == 0) {
+					if (_useLightGun || _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_12)[_stage] == 0) {
 						if (_enemySpeed < ((_stage == 0 || _stage == 11 || !_useLightGun) ? 32 : 48))
 								++_enemySpeed;
 					}
@@ -512,13 +525,13 @@ void ActionSequenceHandler::handleShot() {
 						animSet(59, ControlFlags, GraphicsEngine::kAnimPause);
 						animSet(59, Frame, animGet(59, Frame) + 1);
 					}
-					_vm->sound()->pcmSendCommand(_scd->makePtr(0x11F10)[_stage], -1);
+					_vm->sound()->pcmSendCommand(_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_00)[_stage], -1);
 
 				} else {
 					++_result.civiliansShot;
 					if (_enemySpeed >= 2)
 						_enemySpeed -= 2;
-					if (_scd->makePtr(0x11FD0)[_stage] == 0)
+					if (_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_12)[_stage] == 0)
 						_vm->sound()->pcmSendCommand(14, -1);
 				}
 
@@ -528,14 +541,14 @@ void ActionSequenceHandler::handleShot() {
 				}
 			}
 			if (_stage == 10) {
-				if (_scd->makePtr(0x12CE2)[tf] & 2) {
+				if (_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_19)[tf] & 2) {
 					_vm->sound()->pcmSendCommand(50, -1);
 					_vm->sound()->fmSendCommand(19, 0);
 					if (_result.hitsTaken < 6) {
 						vl = animGet(48, ActionTimer) - 1;
 						animSet(48, ActionTimer, vl);
-						(_scd->makePtr(0x12EA8) + 6).writeUINT16((_scd->makePtr(0x12EBC) + (vl << 1)).readUINT16());
-						_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x12EA8));
+						(_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_20) + 6).writeUINT16((_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_21) + (vl << 1)).readUINT16());
+						_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_20));
 						++_result.hitsTaken;
 					}
 
@@ -611,7 +624,7 @@ void ActionSequenceHandler::updateEnemies() {
 			if (a == animGet(i, Frame)) {
 				animSet(i, Frame, a + 2);
 				animSet(i, Phase, animGet(i, Phase) + 1);
-				a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
+				a = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_17)[Util::rngMakeNumber() & 0x1F] << 1;
 				animSet(i, ActionTimer, a + _enemySpeed);
 			}
 
@@ -626,19 +639,19 @@ void ActionSequenceHandler::updateEnemies() {
 
 			if (b == 5) {
 				animSet(i, Frame, animGet(i, Frame) - 2);
-				if (_scd->makePtr(0x11FD0)[_stage] == 0 && animGet(i, Phase) >= 48)
+				if (_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_12)[_stage] == 0 && animGet(i, Phase) >= 48)
 					++_result.hitsTaken;
 				animSet(i, Phase, 0);
 				break;
 			}
 
-			if (_scd->makePtr(0x11FD0)[_stage] == 0)
+			if (_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_12)[_stage] == 0)
 				break;
 
-			if (b == 2 && (_result.enemiesShot <= _scd->makePtr(_useLightGun ? 0x11F90 : 0x11F80)[_stage]))
+			if (b == 2 && (_result.enemiesShot <= _scd->makePtr(_useLightGun ? MemMapping::MEM_ACTIONSEQDATA_08 : MemMapping::MEM_ACTIONSEQDATA_07)[_stage]))
 				break;
 
-			if (b == 4 && !(_scd->makePtr(0x11FD0)[_stage] & 0x80) && ((_result.enemiesShot <= _scd->makePtr(_useLightGun ? 0x11F90 : 0x11F80)[_stage]) || (_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] >= 6)))
+			if (b == 4 && !(_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_12)[_stage] & 0x80) && ((_result.enemiesShot <= _scd->makePtr(_useLightGun ? MemMapping::MEM_ACTIONSEQDATA_08 : MemMapping::MEM_ACTIONSEQDATA_07)[_stage]) || (_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_17)[Util::rngMakeNumber() & 0x1F] >= 6)))
 				break;
 
 			if (b == 3) {
@@ -649,7 +662,7 @@ void ActionSequenceHandler::updateEnemies() {
 			} else {
 				animSet(i, Phase, (animGet(i, Phase) & 0xF0) + 7 - b);
 				animSet(i, Frame, _vm->gfx()->getAnimScriptByte(i, 6 - b) + 2);
-				a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
+				a = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_17)[Util::rngMakeNumber() & 0x1F] << 1;
 				animSet(i, ActionTimer, a + _enemySpeed);
 			}
 			break;
@@ -657,7 +670,7 @@ void ActionSequenceHandler::updateEnemies() {
 		case 6:
 			animSet(i, Phase, (animGet(i, Phase) & 0xF0) + 7);
 			animSet(i, Frame, _vm->gfx()->getAnimScriptByte(i, 6));
-			a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
+			a = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_17)[Util::rngMakeNumber() & 0x1F] << 1;
 			animSet(i, ActionTimer, a + _enemySpeed);
 			break;
 
@@ -666,7 +679,7 @@ void ActionSequenceHandler::updateEnemies() {
 			if (a == animGet(i, Frame)) {
 				animSet(i, Frame, a + 2);
 				animSet(i, Phase, animGet(i, Phase) + 1);
-				a = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1;
+				a = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_17)[Util::rngMakeNumber() & 0x1F] << 1;
 				animSet(i, ActionTimer, a + _enemySpeed);
 			}
 
@@ -690,24 +703,24 @@ void ActionSequenceHandler::updateStage() {
 		if (--_nextEnemyAppearanceTimer >= 0)
 			return;
 
-		uint8 v =_scd->makePtr(_useLightGun ? 0x11F90 : 0x11F80)[_stage];
+		uint8 v =_scd->makePtr(_useLightGun ? MemMapping::MEM_ACTIONSEQDATA_08 : MemMapping::MEM_ACTIONSEQDATA_07)[_stage];
 		if (v && _result.enemiesShot >= v)
 			return;
 
-		v = _scd->makePtr(0x11FA0)[_stage];
+		v = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_09)[_stage];
 		if (v && _enemyAppearanceCount == v)
 			return;
 
-		if (_activeEnemies == _scd->makePtr(_useLightGun ? 0x11FC0 : 0x11FB0)[_stage])
+		if (_activeEnemies == _scd->makePtr(_useLightGun ? MemMapping::MEM_ACTIONSEQDATA_11 : MemMapping::MEM_ACTIONSEQDATA_10)[_stage])
 			return;
 
-		_nextEnemyAppearanceTimer = 16 + _enemySpeed + (_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] << 1);
-		if (_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] >= 7)
+		_nextEnemyAppearanceTimer = 16 + _enemySpeed + (_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_17)[Util::rngMakeNumber() & 0x1F] << 1);
+		if (_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_17)[Util::rngMakeNumber() & 0x1F] >= 7)
 			_nextEnemyAppearanceTimer = 5;
 		_updateEnemiesPhase = 1;
 
 	} else if (_updateEnemiesPhase == 1) {
-		uint8 num = _scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F];
+		uint8 num = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_17)[Util::rngMakeNumber() & 0x1F];
 		_animNo = num + 32;
 		int16 v = animGet(_animNo, Phase);
 		if (v == 0xFF || ((v & 0x0F) != 0))
@@ -718,7 +731,7 @@ void ActionSequenceHandler::updateStage() {
 
 		switch (_stage) {
 		case 0:
-			v = _scd->makePtr(0x12C9A)[_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F] & 3];
+			v = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_18)[_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_17)[Util::rngMakeNumber() & 0x1F] & 3];
 			_vm->gfx()->animCopySpec(26 + v - 1, _animNo);
 			animSet(_animNo, Frame, 2);
 			break;
@@ -733,10 +746,10 @@ void ActionSequenceHandler::updateStage() {
 			v = 1;
 			break;
 		case 10:
-			v = _scd->makePtr(0x12CE2)[num];
+			v = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_19)[num];
 			break;
 		case 11:
-			v = _scd->makePtr(0x12C9A)[_scd->makePtr(0x12010)[Util::rngMakeNumber() & 0x1F]];
+			v = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_18)[_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_17)[Util::rngMakeNumber() & 0x1F]];
 			_vm->gfx()->animCopySpec(26 + v + 1, _animNo);
 			animSet(_animNo, Frame, 2);
 			break;
@@ -775,7 +788,7 @@ void ActionSequenceHandler::updateStage() {
 }
 
 void ActionSequenceHandler::enemyAttack() {
-	if (!_scd->makePtr(0x11FD0)[_stage])
+	if (!_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_12)[_stage])
 		return;
 
 	if (_enemyAttackStatus == 0) {
@@ -789,7 +802,7 @@ void ActionSequenceHandler::enemyAttack() {
 		animSet(24, Enable, 1);
 		animSet(24, Frame, 2);
 		_enemyAttackStatus = 2;
-		uint8 snd = _scd->makePtr(0x11F40)[_stage];
+		uint8 snd = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_03)[_stage];
 		if (snd)
 			_vm->sound()->pcmSendCommand(snd, -1);
 	} else if (_enemyAttackStatus == 2) {
@@ -806,30 +819,30 @@ void ActionSequenceHandler::enemyAttack() {
 		if (_result.hitsTaken < 6) {
 			int16 vl = animGet(48, ActionTimer) - 1;
 			animSet(48, ActionTimer, vl);
-			(_scd->makePtr(0x12EA8) + 6).writeUINT16((_scd->makePtr(0x12EBC) + (vl << 1)).readUINT16());
-			_vm->gfx()->enqueueDrawCommands(_scd->makePtr(0x12EA8));
+			(_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_20) + 6).writeUINT16((_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_21) + (vl << 1)).readUINT16());
+			_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_20));
 			++_result.hitsTaken;
 		}
 	}
 }
 
 void ActionSequenceHandler::checkFinished() {
-	if (_scd->makePtr(0x11FD0)[_stage] && _result.hitsTaken >= 6) {
+	if (_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_12)[_stage] && _result.hitsTaken >= 6) {
 		for (int i = 32; i < 41; ++i)
 			animSet(i, ControlFlags, animGet(i, ControlFlags) | GraphicsEngine::kAnimPause);
 		_vm->gfx()->reset(GraphicsEngine::kResetPalEvents);
 		_progressMSB = 3;
 		_result.hitsTaken = 6;
 	} else {
-		uint8 v = _scd->makePtr(_useLightGun ? 0x11F90 : 0x11F80)[_stage];
+		uint8 v = _scd->makePtr(_useLightGun ? MemMapping::MEM_ACTIONSEQDATA_08 : MemMapping::MEM_ACTIONSEQDATA_07)[_stage];
 		if (v && _result.enemiesShot < v)
 			return;
 
-		v = _scd->makePtr(0x11FA0)[_stage];
+		v = _scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_09)[_stage];
 		if (v && (_updateEnemiesPhase || (_enemyAppearanceCount < v)))
 			return;
 
-		if (_scd->makePtr(_useLightGun ? 0x11FC0 : 0x11FB0)[_stage] != 1 && _enemyAttackStatus != 0)
+		if (_scd->makePtr(_useLightGun ? MemMapping::MEM_ACTIONSEQDATA_11 : MemMapping::MEM_ACTIONSEQDATA_10)[_stage] != 1 && _enemyAttackStatus != 0)
 			return;
 
 		if (_handleShotPhase != 0)
@@ -841,7 +854,7 @@ void ActionSequenceHandler::checkFinished() {
 				continue;
 			if ((a & 0x0F) != 0)
 				return;
-			if (_scd->makePtr(0x11FD0)[_stage] == 0 || _stage == 7)
+			if (_scd->makePtr(MemMapping::MEM_ACTIONSEQDATA_12)[_stage] == 0 || _stage == 7)
 				continue;
 			animSet(i, Enable, 0);
 		}
diff --git a/engines/snatcher/action.h b/engines/snatcher/action.h
index 67459a22a1b..8c975eed29c 100644
--- a/engines/snatcher/action.h
+++ b/engines/snatcher/action.h
@@ -35,7 +35,7 @@ class ResourcePointer;
 class SnatcherEngine;
 class ActionSequenceHandler {
 public:
-	ActionSequenceHandler(SnatcherEngine *vm, ResourcePointer *scd);
+	ActionSequenceHandler(SnatcherEngine *vm, ResourcePointer *scd, bool palTiming);
 	~ActionSequenceHandler();
 
 	bool run(bool useLightGun);
@@ -96,6 +96,7 @@ private:
 	SnatcherEngine *_vm;
 	ResourcePointer *_scd;
 	bool _useLightGun;
+	const bool _palTiming;
 
 	Result _result;
 };
diff --git a/engines/snatcher/detection.h b/engines/snatcher/detection.h
index 197a1c0a3a1..5f5ada80cd1 100644
--- a/engines/snatcher/detection.h
+++ b/engines/snatcher/detection.h
@@ -36,11 +36,11 @@ struct GameDescription {
 	Common::Language lang;
 	Common::Platform platform;
 	bool isBigEndian;
+	bool usePALTiming;
 
 	// language overwrites of fan translations (only needed for multilingual games)
 	Common::Language fanLang;
 	Common::Language replacedLang;
-
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/detection_tables.h b/engines/snatcher/detection_tables.h
index 2f2ac4ba565..5639a457a9e 100644
--- a/engines/snatcher/detection_tables.h
+++ b/engines/snatcher/detection_tables.h
@@ -21,10 +21,10 @@
 
 namespace {
 
-#define FLAGS(id, a, b) { id, a, Common::UNK_LANG, Common::kPlatformUnknown, b, Common::UNK_LANG, Common::UNK_LANG }
-#define FLAGS_FAN(id, a, b, fanLang, repLang) { id, a, Common::UNK_LANG, Common::kPlatformUnknown, b, fanLang, repLang }
+#define FLAGS(id, a, b, c) { id, a, Common::UNK_LANG, Common::kPlatformUnknown, b, c, Common::UNK_LANG, Common::UNK_LANG }
+#define FLAGS_FAN(id, a, b, c, fanLang, repLang) { id, a, Common::UNK_LANG, Common::kPlatformUnknown, b, c, fanLang, repLang }
 
-#define SNATCHER_FLAGS(a, b) FLAGS(Snatcher::GI_SNATCHER, a, b)
+#define SNATCHER_FLAGS(a, b, c) FLAGS(Snatcher::GI_SNATCHER, a, b, c)
 
 const SnatcherGameDescription adGameDescs[] = {
 	{
@@ -38,7 +38,7 @@ const SnatcherGameDescription adGameDescs[] = {
 			ADGF_TESTING,
 			GUIO2(GUIO_NOSPEECHVOLUME, GUIO_MIDISEGACD)
 		},
-		SNATCHER_FLAGS(MDT_SEGACD, true)
+		SNATCHER_FLAGS(MDT_SEGACD, true, false)
 	},
 	{
 		{
@@ -51,10 +51,10 @@ const SnatcherGameDescription adGameDescs[] = {
 			ADGF_TESTING,
 			GUIO2(GUIO_NOSPEECHVOLUME, GUIO_MIDISEGACD)
 		},
-		SNATCHER_FLAGS(MDT_SEGACD, true)
+		SNATCHER_FLAGS(MDT_SEGACD, true, true)
 	},
 
-	{ AD_TABLE_END_MARKER, FLAGS(0, MDT_NONE, false) }
+	{ AD_TABLE_END_MARKER, FLAGS(0, MDT_NONE, false, false) }
 };
 
 const PlainGameDescriptor gameList[] = {
diff --git a/engines/snatcher/mem_mapping.cpp b/engines/snatcher/mem_mapping.cpp
new file mode 100644
index 00000000000..2825d0a9417
--- /dev/null
+++ b/engines/snatcher/mem_mapping.cpp
@@ -0,0 +1,145 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#include "snatcher/mem_mapping.h"
+
+namespace Snatcher {
+
+namespace MemMapping {
+
+uint32 MEM_GFXDATA_00                	=	0;
+uint32 MEM_RAWDATA_00                	=	0;
+uint32 MEM_UIDATA_00                 	=	0;
+uint32 MEM_UIDATA_01                 	=	0;
+uint32 MEM_UIDATA_02                 	=	0;
+uint32 MEM_UIDATA_03                 	=	0;
+uint32 MEM_UIDATA_04                 	=	0;
+uint32 MEM_UIDATA_05                 	=	0;
+uint32 MEM_PALDATA_00                	=	0;
+uint32 MEM_PALDATA_01                	=	0;
+uint32 MEM_PALDATA_02                	=	0;
+uint32 MEM_PALDATA_03                	=	0;
+uint32 MEM_PALDATA_04                	=	0;
+uint32 MEM_GFXDATA_01                	=	0;
+uint32 MEM_GFXDATA_02                	=	0;
+uint32 MEM_GFXDATA_03                	=	0;
+uint32 MEM_GFXDATA_04                	=	0;
+uint32 MEM_ACTIONSEQDATA_00          	=	0;
+uint32 MEM_ACTIONSEQDATA_01          	=	0;
+uint32 MEM_ACTIONSEQDATA_02          	=	0;
+uint32 MEM_ACTIONSEQDATA_03          	=	0;
+uint32 MEM_ACTIONSEQDATA_04          	=	0;
+uint32 MEM_ACTIONSEQDATA_05          	=	0;
+uint32 MEM_ACTIONSEQDATA_06          	=	0;
+uint32 MEM_ACTIONSEQDATA_07          	=	0;
+uint32 MEM_ACTIONSEQDATA_08          	=	0;
+uint32 MEM_ACTIONSEQDATA_09          	=	0;
+uint32 MEM_ACTIONSEQDATA_10          	=	0;
+uint32 MEM_ACTIONSEQDATA_11          	=	0;
+uint32 MEM_ACTIONSEQDATA_12          	=	0;
+uint32 MEM_ACTIONSEQDATA_13          	=	0;
+uint32 MEM_ACTIONSEQDATA_14          	=	0;
+uint32 MEM_ACTIONSEQDATA_15          	=	0;
+uint32 MEM_ACTIONSEQDATA_16          	=	0;
+uint32 MEM_ACTIONSEQDATA_17          	=	0;
+uint32 MEM_ACTIONSEQDATA_18          	=	0;
+uint32 MEM_ACTIONSEQDATA_19          	=	0;
+uint32 MEM_ACTIONSEQDATA_20          	=	0;
+uint32 MEM_ACTIONSEQDATA_21          	=	0;
+uint32 MEM_UIDATA_06                 	=	0;
+uint32 MEM_PALDATA_05                	=	0;
+uint32 MEM_UIDATA_07                 	=	0;
+uint32 MEM_UIDATA_08                 	=	0;
+uint32 MEM_UIDATA_09                 	=	0;
+uint32 MEM_UIDATA_10                 	=	0;
+uint32 MEM_RAWDATA_01                	=	0;
+uint32 MEM_RAWDATA_02                	=	0;
+uint32 MEM_RAWDATA_03                	=	0;
+uint32 MEM_PALDATA_06                	=	0;
+uint32 MEM_GFXDATA_05                	=	0;
+uint32 MEM_RAWDATA_04                	=	0;
+uint32 MEM_RAWDATA_05                	=	0;
+uint32 MEM_RAWDATA_06                	=	0;
+
+void initMapping(int mappingNum) {
+	MEM_GFXDATA_00                	=	0x0ECB6;
+	MEM_RAWDATA_00                	=	0x100D8;
+	MEM_UIDATA_00                 	=	0x109E8;
+	MEM_UIDATA_01                 	=	0x114DC;
+	MEM_UIDATA_02                 	=	0x11512;
+	MEM_UIDATA_03                 	=	0x115CA;
+	MEM_UIDATA_04                 	=	0x11938;
+	MEM_UIDATA_05                 	=	0x11D12;
+	MEM_PALDATA_00                	=	0x11E6A;
+	MEM_PALDATA_01                	=	0x11E74;
+	MEM_PALDATA_02                	=	0x11E7E;
+	MEM_PALDATA_03                	=	0x11E8C;
+	MEM_PALDATA_04                	=	0x11E92;
+	MEM_GFXDATA_01                	=	0x11ED8;
+	MEM_GFXDATA_02                	=	0x11EE6;
+	MEM_GFXDATA_03                	=	0x11EF4;
+	MEM_GFXDATA_04                	=	0x11F02;
+	MEM_ACTIONSEQDATA_00          	=	0x11F10;
+	MEM_ACTIONSEQDATA_01          	=	0x11F20;
+	MEM_ACTIONSEQDATA_02          	=	0x11F30;
+	MEM_ACTIONSEQDATA_03          	=	0x11F40;
+	MEM_ACTIONSEQDATA_04          	=	0x11F50;
+	MEM_ACTIONSEQDATA_05          	=	0x11F60;
+	MEM_ACTIONSEQDATA_06          	=	0x11F70;
+	MEM_ACTIONSEQDATA_07          	=	0x11F80;
+	MEM_ACTIONSEQDATA_08          	=	0x11F90;
+	MEM_ACTIONSEQDATA_09          	=	0x11FA0;
+	MEM_ACTIONSEQDATA_10          	=	0x11FB0;
+	MEM_ACTIONSEQDATA_11          	=	0x11FC0;
+	MEM_ACTIONSEQDATA_12          	=	0x11FD0;
+	MEM_ACTIONSEQDATA_13          	=	0x11FE0;
+	MEM_ACTIONSEQDATA_14          	=	0x11FE6;
+	MEM_ACTIONSEQDATA_15          	=	0x11FEC;
+	MEM_ACTIONSEQDATA_16          	=	0x11FFE;
+	MEM_ACTIONSEQDATA_17          	=	0x12010;
+	MEM_ACTIONSEQDATA_18          	=	0x12C9A;
+	MEM_ACTIONSEQDATA_19          	=	0x12CE2;
+	MEM_ACTIONSEQDATA_20          	=	0x12EA8;
+	MEM_ACTIONSEQDATA_21          	=	0x12EBC;
+	MEM_UIDATA_06                 	=	0x13552;
+	MEM_PALDATA_05                	=	0x13622;
+	MEM_UIDATA_07                 	=	0x1387C;
+	MEM_UIDATA_08                 	=	0x13894;
+	MEM_UIDATA_09                 	=	0x138AC;
+	MEM_UIDATA_10                 	=	0x1391C;
+	MEM_RAWDATA_01                	=	0x13FEC;
+	MEM_RAWDATA_02                	=	0x144C6;
+	MEM_RAWDATA_03                	=	0x146CE;
+	MEM_PALDATA_06                	=	0x14B1C;
+	MEM_GFXDATA_05                	=	0x14B4E;
+	MEM_RAWDATA_04                	=	0x14B7C;
+	MEM_RAWDATA_05                	=	0x14EAC;
+	MEM_RAWDATA_06                	=	0x16CDC;
+
+	if (mappingNum == 1)
+		MEM_RAWDATA_06              =	0x16CEC;
+}
+
+} // End of namespace MemMapping
+
+} // End of namespace Snatcher
+
+
diff --git a/engines/snatcher/mem_mapping.h b/engines/snatcher/mem_mapping.h
new file mode 100644
index 00000000000..468bcef5671
--- /dev/null
+++ b/engines/snatcher/mem_mapping.h
@@ -0,0 +1,92 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+#ifndef SNATCHER_MEM_MAPPING_H
+#define SNATCHER_MEM_MAPPING_H
+
+#include "common/scummsys.h"
+
+namespace Snatcher {
+
+namespace MemMapping {
+
+extern uint32 MEM_GFXDATA_00;
+extern uint32 MEM_RAWDATA_00;
+extern uint32 MEM_UIDATA_00;
+extern uint32 MEM_UIDATA_01;
+extern uint32 MEM_UIDATA_02;
+extern uint32 MEM_UIDATA_03;
+extern uint32 MEM_UIDATA_04;
+extern uint32 MEM_UIDATA_05;
+extern uint32 MEM_PALDATA_00;
+extern uint32 MEM_PALDATA_01;
+extern uint32 MEM_PALDATA_02;
+extern uint32 MEM_PALDATA_03;
+extern uint32 MEM_PALDATA_04;
+extern uint32 MEM_GFXDATA_01;
+extern uint32 MEM_GFXDATA_02;
+extern uint32 MEM_GFXDATA_03;
+extern uint32 MEM_GFXDATA_04;
+extern uint32 MEM_ACTIONSEQDATA_00;
+extern uint32 MEM_ACTIONSEQDATA_01;
+extern uint32 MEM_ACTIONSEQDATA_02;
+extern uint32 MEM_ACTIONSEQDATA_03;
+extern uint32 MEM_ACTIONSEQDATA_04;
+extern uint32 MEM_ACTIONSEQDATA_05;
+extern uint32 MEM_ACTIONSEQDATA_06;
+extern uint32 MEM_ACTIONSEQDATA_07;
+extern uint32 MEM_ACTIONSEQDATA_08;
+extern uint32 MEM_ACTIONSEQDATA_09;
+extern uint32 MEM_ACTIONSEQDATA_10;
+extern uint32 MEM_ACTIONSEQDATA_11;
+extern uint32 MEM_ACTIONSEQDATA_12;
+extern uint32 MEM_ACTIONSEQDATA_13;
+extern uint32 MEM_ACTIONSEQDATA_14;
+extern uint32 MEM_ACTIONSEQDATA_15;
+extern uint32 MEM_ACTIONSEQDATA_16;
+extern uint32 MEM_ACTIONSEQDATA_17;
+extern uint32 MEM_ACTIONSEQDATA_18;
+extern uint32 MEM_ACTIONSEQDATA_19;
+extern uint32 MEM_ACTIONSEQDATA_20;
+extern uint32 MEM_ACTIONSEQDATA_21;
+extern uint32 MEM_UIDATA_06;
+extern uint32 MEM_PALDATA_05;
+extern uint32 MEM_UIDATA_07;
+extern uint32 MEM_UIDATA_08;
+extern uint32 MEM_UIDATA_09;
+extern uint32 MEM_UIDATA_10;
+extern uint32 MEM_RAWDATA_01;
+extern uint32 MEM_RAWDATA_02;
+extern uint32 MEM_RAWDATA_03;
+extern uint32 MEM_PALDATA_06;
+extern uint32 MEM_GFXDATA_05;
+extern uint32 MEM_RAWDATA_04;
+extern uint32 MEM_RAWDATA_05;
+extern uint32 MEM_RAWDATA_06;
+
+extern void initMapping(int mappingNum);
+
+} // End of namespace MemMapping
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_MEM_MAPPING_H
+
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index ef88b737d48..18b3f97f176 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS := \
 	animator_scd.o \
 	graphics.o \
 	memory.o \
+	mem_mapping.o \
 	metaengine.o \
 	palette_scd.o \
 	resource.o \
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index e7611cd4b63..b0565e6b457 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -23,6 +23,7 @@
 #include "snatcher/action.h"
 #include "snatcher/graphics.h"
 #include "snatcher/memory.h"
+#include "snatcher/mem_mapping.h"
 #include "snatcher/resource.h"
 #include "snatcher/saveload.h"
 #include "snatcher/script.h"
@@ -171,7 +172,7 @@ void CmdQueue::m_animPauseAll(const uint16 *&data) {
 		_vm->gfx()->reset(GraphicsEngine::kResetPalEvents);
 		for (int i = 0; i < 64; ++i)
 			_vm->gfx()->setAnimParameter(i, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimPause);
-		_vm->gfx()->enqueuePaletteEvent(_vm->_scd->makePtr(0x100D8));
+		_vm->gfx()->enqueuePaletteEvent(_vm->_scd->makePtr(MemMapping::MEM_RAWDATA_00));
 		_counter = 48;
 		++_progress;
 	} else if (--_counter == 0) {
@@ -271,7 +272,7 @@ void CmdQueue::m_chatWithPortraitAnim(const uint16 *&data) {
 	} else if (_progress == 1) {
 		++_progress;
 	} else if (_progress == 2) {
-		if (_vm->_scd->makePtr(0x13FEC)[*data] != 0xFF)
+		if (_vm->_scd->makePtr(MemMapping::MEM_RAWDATA_01)[*data] != 0xFF)
 			_vm->gfx()->setVar(11, 1);
 		if (!_vm->gfx()->getVar(11)) {
 			_progress = -1;
@@ -281,7 +282,7 @@ void CmdQueue::m_chatWithPortraitAnim(const uint16 *&data) {
 		}
 
 	} else {
-		uint8 f = _vm->_scd->makePtr(0x13FEC)[*data];
+		uint8 f = _vm->_scd->makePtr(MemMapping::MEM_RAWDATA_01)[*data];
 		if (f != 0xFF) {
 			//_vm->gfx()->dataMode = 1;
 			_vm->gfx()->runScript(_vm->_module->getGfxData(), f);
@@ -382,8 +383,8 @@ void CmdQueue::m_invItemCloseUp(const uint16 *&data) {
 	if (_vm->gfx()->getVar(8))
 		return;
 
-	_vm->gfx()->runScript(_vm->_scd->makePtr(0x146CE), *data++);
-	ResourcePointer coords = _vm->_scd->makePtr(0x144C6) + ((*data++) << 2);
+	_vm->gfx()->runScript(_vm->_scd->makePtr(MemMapping::MEM_RAWDATA_03), *data++);
+	ResourcePointer coords = _vm->_scd->makePtr(MemMapping::MEM_RAWDATA_02) + ((*data++) << 2);
 	_vm->gfx()->setAnimParameter(1, GraphicsEngine::kAnimParaPosX, coords.readIncrSINT16());
 	_vm->gfx()->setAnimParameter(1, GraphicsEngine::kAnimParaPosY, coords.readIncrSINT16());
 
@@ -943,7 +944,7 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 	};
 #undef OP
 
-	const uint8 *in = scd->makePtr(0x16CDC)();
+	const uint8 *in = scd->makePtr(MemMapping::MEM_RAWDATA_06)();
 
 	for (uint i = 0; i < ARRAYSIZE(funcTbl); ++i) {
 #ifndef SNATCHER_SCRIPT_DEBUG
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 60dd594b4ae..3630933097e 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -22,6 +22,7 @@
 #include "snatcher/action.h"
 #include "snatcher/graphics.h"
 #include "snatcher/memory.h"
+#include "snatcher/mem_mapping.h"
 #include "snatcher/resource.h"
 #include "snatcher/saveload.h"
 #include "snatcher/script.h"
@@ -106,6 +107,8 @@ bool SnatcherEngine::initResource() {
 	if (!_scd)
 		return false;
 
+	MemMapping::initMapping(_game.usePALTiming ? 1 : 0);
+
 	return true;
 }
 
@@ -139,7 +142,7 @@ bool SnatcherEngine::initGfx(Common::Platform platform, bool use8BitColorMode) {
 	if (_gfx) {
 		initGraphics(_gfx->realScreenWidth(), _gfx->realScreenHeight(), &pxf);
 		assert(_scd);
-		_gfx->setTextFont(_scd->makePtr(0x14B7C)(), 816, _scd->makePtr(0x14EAC)(), 102);
+		_gfx->setTextFont(_scd->makePtr(MemMapping::MEM_RAWDATA_04)(), 816, _scd->makePtr(MemMapping::MEM_RAWDATA_05)(), 102);
 		_gfx->createMouseCursor();
 		return true;
 	}
@@ -175,7 +178,7 @@ bool SnatcherEngine::initScriptEngine() {
 	if (!_ui)
 		return false;
 
-	_aseq = new ActionSequenceHandler(this, _scd);
+	_aseq = new ActionSequenceHandler(this, _scd, _game.usePALTiming);
 	if (!_aseq)
 		return false;
 
@@ -628,7 +631,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 				state.finish = 0;
 				state.counter = 10;
 				++state.modProcessSub;
-				_gfx->enqueuePaletteEvent(_scd->makePtr(0x14B1C));
+				_gfx->enqueuePaletteEvent(_scd->makePtr(MemMapping::MEM_PALDATA_06));
 			} else if (state.finish) {
 				if (state.modIndex == 0) {
 					++state.modIndex;
@@ -640,7 +643,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			break;
 		case 3:
 			if (--state.counter == 1) {
-				_gfx->enqueueDrawCommands(_scd->makePtr(0x14B4E));
+				_gfx->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_05));
 			} else if (state.counter == 0) {
 				state.finish = -1;
 				state.modProcessSub = 0;
diff --git a/engines/snatcher/ui.cpp b/engines/snatcher/ui.cpp
index bba25559fe1..fbd5ba06266 100644
--- a/engines/snatcher/ui.cpp
+++ b/engines/snatcher/ui.cpp
@@ -21,6 +21,7 @@
 
 
 #include "snatcher/graphics.h"
+#include "snatcher/mem_mapping.h"
 #include "snatcher/resource.h"
 #include "snatcher/script.h"
 #include "snatcher/snatcher.h"
@@ -67,7 +68,7 @@ bool UI::displayDialog(int sceneInfo, int sceneTextOffset, uint16 inputFlags) {
 		for (int i = 5; i < 15; ++i)
 			_gfx->setAnimParameter(i, GraphicsEngine::kAnimParaEnable, 0);
 		_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaEnable, 0);
-		_gfx->enqueuePaletteEvent(_scd->makePtr(0x13622));
+		_gfx->enqueuePaletteEvent(_scd->makePtr(MemMapping::MEM_PALDATA_05));
 		++_progress;
 		break;
 
@@ -136,7 +137,7 @@ bool UI::displayDialog(int sceneInfo, int sceneTextOffset, uint16 inputFlags) {
 	case 9:
 		_sceneInfo = sceneInfo;
 		_sceneTextOffset = sceneTextOffset;
-		_gfx->enqueueDrawCommands(_scd->makePtr(0xECB6));
+		_gfx->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_00));
 		++_progress;
 		break;
 
@@ -321,7 +322,7 @@ bool UI::drawVerbs() {
 			return false;
 		}
 		if (_progress2 == 7) {
-			const uint8 *src = _scd->makePtr(0x11D12)();
+			const uint8 *src = _scd->makePtr(MemMapping::MEM_UIDATA_05)();
 			uint8 *dst = _dialogTextBuffer;
 			for (int i = 0; i < 256; ++i) {
 				*dst = *src++;
@@ -374,7 +375,7 @@ bool UI::verbsTabInputPrompt(const SnatcherEngine::Input &input) {
 		if (_progress2 == 102) {
 			_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaEnable, 1);
 			if (_verbInterfaceMode >= 2) {
-				_verbsTabLayoutMap = _scd->makePtr(_verbInterfaceMode == 3 ? 0x11512 : 0x114DC)();
+				_verbsTabLayoutMap = _scd->makePtr(_verbInterfaceMode == 3 ? MemMapping::MEM_UIDATA_02 : MemMapping::MEM_UIDATA_01)();
 				_gfx->setAnimParameter(0, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimHide | GraphicsEngine::kAnimPause);
 				_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
 				_gfx->setAnimParameter(63, GraphicsEngine::kAnimParaFrame, _verbInterfaceMode == 2 ? 2 : 0);
@@ -505,7 +506,7 @@ void UI::saveState(Common::SeekableWriteStream *out) {
 
 void UI::printDialogStringHead() {
 	static const uint8 strHead[] = { 0xFC, 0x00, 0xF9, 0x01, 0xFB, 0x10, 0x00, 0xFE };
-	const uint8 *s = _scd->makePtr(0x13552).getDataFromTable(_sceneId)();
+	const uint8 *s = _scd->makePtr(MemMapping::MEM_UIDATA_06).getDataFromTable(_sceneId)();
 	memcpy(_dialogTextBuffer, strHead, sizeof(strHead));
 	_dialogTextBuffer[6] = _headLineYOffset;
 	_dialogTextBuffer[8] = (*s & 0x80) ? 3 : (*s++ & 7);
@@ -592,9 +593,9 @@ bool UI::waitWithCursorAnim(uint16 inputFlags) {
 		return true;
 	if ((_waitCursorAnimDelay && --_waitCursorAnimDelay) || _sceneId == 0)
 		return false;
-	const uint8 *s = _scd->makePtr(0x1391C)() + _waitCursorFrame;
+	const uint8 *s = _scd->makePtr(MemMapping::MEM_UIDATA_10)() + _waitCursorFrame;
 
-	ResourcePointer drw = _scd->makePtr(_gfx->getVerbAreaType() == 0 ? 0x1387C : (_gfx->getVerbAreaType() == 1 ? 0x13894 : 0x138AC));
+	ResourcePointer drw = _scd->makePtr(_gfx->getVerbAreaType() == 0 ? MemMapping::MEM_UIDATA_07 : (_gfx->getVerbAreaType() == 1 ? MemMapping::MEM_UIDATA_08 : MemMapping::MEM_UIDATA_09));
 
 	uint32 frm = 0x138C4 + _waitCursorFrame * 4;
 	(drw + 2).writeUINT32(frm);
@@ -976,7 +977,7 @@ bool UI::verbSelect2() {
 
 		if (_progress2 == 0x100) {
 			if (_verbInterfaceMode == 3) {
-				uint8 frm = _scd->makePtr(0x115CA)[_vkeybPosTotal];
+				uint8 frm = _scd->makePtr(MemMapping::MEM_UIDATA_03)[_vkeybPosTotal];
 				_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaFrame, frm);
 				_gfx->setAnimParameter(62, GraphicsEngine::kAnimParaControlFlags, GraphicsEngine::kAnimNone);
 			}
@@ -1130,14 +1131,14 @@ void UI::virtKeybPrint() {
 
 		if (_videoPhoneMode != 0) {
 			uint8 v = _textInputStr[0];
-			if (_textInputStr[_scd->makePtr(0x11938)[(v == '*' || v == '#') ? 2 : (v & 0x0F)] - 1])
+			if (_textInputStr[_scd->makePtr(MemMapping::MEM_UIDATA_04)[(v == '*' || v == '#') ? 2 : (v & 0x0F)] - 1])
 				verbSelect2setResult();
 		}
 	}
 }
 
 uint8 UI::checkFlashLightPos(int16 x, int16 y) {
-	return _scd->makePtr(0x109E8)[y * 36 + x];
+	return _scd->makePtr(MemMapping::MEM_UIDATA_00)[y * 36 + x];
 }
 
 void UI::moveFlashLight(int32 offsX, int32 offsY) {
@@ -1155,7 +1156,6 @@ void UI::moveFlashLight(int32 offsX, int32 offsY) {
 	} else {
 		error("%s(): Invalid parameters", __FUNCTION__);
 	}
-	debug ("FLASHLIGHT: X: %d, Y: %d", _flashLight.posX >> 16, _flashLight.posY >> 16);
 }
 
 } // End of namespace Snatcher


Commit: 8ab37f09f7c1dd07956f40d808a0918ee62eb9c1
    https://github.com/scummvm/scummvm/commit/8ab37f09f7c1dd07956f40d808a0918ee62eb9c1
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: add support for native saveload dialog

Changed paths:
    engines/snatcher/animator.h
    engines/snatcher/animator_scd.cpp
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/memory.cpp
    engines/snatcher/saveload.cpp
    engines/snatcher/saveload.h
    engines/snatcher/scene_d0.cpp
    engines/snatcher/scene_d1.cpp
    engines/snatcher/scene_d2.cpp
    engines/snatcher/scene_y16.cpp
    engines/snatcher/snatcher.cpp
    engines/snatcher/sound_device_scd.cpp
    engines/snatcher/state.h
    engines/snatcher/util.cpp
    engines/snatcher/util.h


diff --git a/engines/snatcher/animator.h b/engines/snatcher/animator.h
index 3653fef876f..f17f4c7284a 100644
--- a/engines/snatcher/animator.h
+++ b/engines/snatcher/animator.h
@@ -23,6 +23,7 @@
 #define SNATCHER_ANIMATOR_H
 
 #include "common/platform.h"
+#include "snatcher/state.h"
 #include "snatcher/graphics.h"
 #include "snatcher/resource.h"
 
@@ -46,6 +47,8 @@ public:
 	virtual uint8 *getTextRenderBuffer() const = 0;
 	virtual void renderTextBuffer(uint16 firstLine, uint8 numLines) = 0;
 
+	virtual void updateSaveLoadDialog(SaveInfo &saveInfo) = 0;
+
 	virtual void updateScreen(uint8 *screen) = 0;
 	virtual void updateAnimations() = 0;
 
diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index ebdeef5c854..28597a89a3a 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -123,6 +123,8 @@ public:
 	uint8 *getTextRenderBuffer() const override;
 	void renderTextBuffer(uint16 firstLine, uint8 numLines) override;
 
+	void updateSaveLoadDialog(SaveInfo &saveInfo) override;
+
 	void updateScreen(uint8 *screen) override;
 	void updateAnimations() override;
 
@@ -441,6 +443,59 @@ void Animator_SCD::renderTextBuffer(uint16 firstLine, uint8 numLines) {
 	_sr->loadToVRAM(_tempBuffer + 0x6000 + start, len, start);
 }
 
+void Animator_SCD::updateSaveLoadDialog(SaveInfo &saveInfo) {
+	uint8 *dst = _tempBuffer + 0x256;
+	uint8 *dst2 = _tempBuffer + 0x1EE;
+
+	for (int i = 0; i < 4; ++i) {
+		if (saveInfo.slotUsage & (1 << i)) {
+			uint16 vl = 0;
+			uint16 tm = saveInfo.slots[i].playTime;
+			uint16 nm = saveInfo.slots[i].numSaves;
+
+			if ((tm >> 8) & 0xF0) {
+				vl = 0x4580 + (((tm >> 8) & 0xF0) >> 3);
+				WRITE_BE_UINT16(&dst[0x00], vl);
+				WRITE_BE_UINT16(&dst[0x40], vl + 1);
+			}
+			vl = 0x4580 + (((tm >> 8) & 0x0F) << 1);
+			WRITE_BE_UINT16(&dst[0x02], vl);
+			WRITE_BE_UINT16(&dst[0x42], vl + 1);
+			WRITE_BE_UINT16(&dst[0x04], 0x4594);
+			WRITE_BE_UINT16(&dst[0x44], 0x4595);
+			vl = 0x4580 + ((tm & 0xF0) >> 3);
+			WRITE_BE_UINT16(&dst[0x06], vl);
+			WRITE_BE_UINT16(&dst[0x46], vl + 1);
+			vl = 0x4580 + ((tm & 0x0F) << 1);
+			WRITE_BE_UINT16(&dst[0x08], vl);
+			WRITE_BE_UINT16(&dst[0x48], vl + 1);
+
+			vl = 0x4596 + saveInfo.slots[i].act;
+			WRITE_BE_UINT16(&dst2[0x00], vl);
+			WRITE_BE_UINT16(&dst2[0x40], vl + 1);
+
+			if (nm & 0xF0) {
+				vl = 0x4580 + ((nm & 0xF0) >> 3);
+				WRITE_BE_UINT16(&dst[0x16], vl);
+				WRITE_BE_UINT16(&dst[0x56], vl + 1);
+			}
+			vl = 0x4580 + ((nm & 0x0F) << 1);
+			WRITE_BE_UINT16(&dst[0x18], vl);
+			WRITE_BE_UINT16(&dst[0x58], vl + 1);
+
+		} else {
+			static const uint8 data[2][10] = {
+				{ 0x45, 0x9C, 0x45, 0x9D, 0x45, 0x9E, 0x45, 0x9F, 0x45, 0xA0 },
+				{ 0x45, 0xA1, 0x45, 0xA2, 0x45, 0xA3, 0x45, 0xA4, 0x45, 0xA5 }
+			};
+			memcpy(dst, data[0], 10);
+			memcpy(&dst[64], data[1], 10);
+		}
+		dst += 0x100;
+		dst2 += 0x100;
+	}
+}
+
 void Animator_SCD::updateScreen(uint8 *screen) {
 	if (_gfxState.getVar(9)) {
 		_sr->setPlaneTableLocation(Graphics::SegaRenderer::kPlaneB, _gfxState.getVar(9) == 0xFF ? 0xE000 : 0xC000);
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 28b76d773d3..0359a67a33c 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -164,6 +164,10 @@ bool GraphicsEngine::isVerbsTabActive() const {
 	return _trs->scroll_getState().verbsTabVisible;
 }
 
+void GraphicsEngine::updateSaveLoadDialog(SaveInfo &saveInfo) {
+	_animator->updateSaveLoadDialog(saveInfo);
+}
+
 void GraphicsEngine::updateAnimations() {
 	_animator->updateAnimations();
 }
@@ -269,15 +273,19 @@ uint16 GraphicsEngine::frameCount() const {
 	return _state.frameCount();
 }
 
-void GraphicsEngine::loadState(Common::SeekableReadStream *in) {
+void GraphicsEngine::loadState(Common::SeekableReadStream *in, bool onlyTempData) {
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
 	in->read(_animSaveLoadData, 64);
+
+	if (onlyTempData)
+		return;
+
 	//for (int i = 0; i < 13; ++i)
 	//	_state.setVar(i, in->readByte());
 }
 
-void GraphicsEngine::saveState(Common::SeekableWriteStream *out) {
+void GraphicsEngine::saveState(Common::SeekableWriteStream *out, bool onlyTempData) {
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
 	for (int i = 0; i < 64; ++i) {
 		uint8 v = 0;
@@ -298,6 +306,10 @@ void GraphicsEngine::saveState(Common::SeekableWriteStream *out) {
 		_animSaveLoadData[i] = v;
 	}
 	out->write(_animSaveLoadData, 64);
+
+	if (onlyTempData)
+		return;
+
 	for (int i = 0; i < 13; ++i)
 		out->writeByte(_state.getVar(i));
 }
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 5c3b19ad100..8679ff72118 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -77,6 +77,8 @@ public:
 	uint8 getVerbAreaType() const;
 	bool isVerbsTabActive() const;
 
+	void updateSaveLoadDialog(SaveInfo &saveInfo);
+
 	void updateAnimations();
 	void updateText();
 	void nextFrame();
@@ -148,8 +150,8 @@ public:
 	bool busy(int type) const;
 	uint16 frameCount() const;
 
-	void loadState(Common::SeekableReadStream *in);
-	void saveState(Common::SeekableWriteStream *out);
+	void loadState(Common::SeekableReadStream *in, bool onlyTempData);
+	void saveState(Common::SeekableWriteStream *out, bool onlyTempData);
 	void postLoadProcess();
 
 	void createMouseCursor();
diff --git a/engines/snatcher/memory.cpp b/engines/snatcher/memory.cpp
index c5e5e6590a9..8c12fa226cd 100644
--- a/engines/snatcher/memory.cpp
+++ b/engines/snatcher/memory.cpp
@@ -70,6 +70,7 @@ uint16 MemAccessHandler::readWord(uint16 addr) {
 		result = _saveMan->isSaveSlotUsed((addr - 0x79E0) >> 1) ? 1 : 0; // The correct start address is 0x79E2, but we want to skip the autosave slot 0 here.
 		break;
 	case 0x79F0:
+		result = _state->saveInfo.act;
 		break;
 	case 0x96D6:
 		result = _ui->getFlashLightStatus().inputFlags;
@@ -95,6 +96,7 @@ void MemAccessHandler::writeWord(uint16 addr, uint16 val) {
 		_vm->gfx()->setVar(12, val);
 		break;
 	case 0x79F0:
+		_state->saveInfo.act = val;
 		break;
 	case 0x9718:
 		_ui->setInputStringLength(val);
@@ -108,7 +110,8 @@ void MemAccessHandler::writeWord(uint16 addr, uint16 val) {
 		_ui->setVideoPhoneMode(val);
 		break;
 	case 0xFFFF:
-		// The 0xFFFF "address" is an exception that is also handled separately in the original code.
+		// The 0xFFFF "address" is an exception that is also handled separately in the original code (probably,
+		// because the actual address for that sound setting is outside the addressable 16-bit range)
 		_vm->sound()->reduceVolume2(val);
 		break;
 	default:
diff --git a/engines/snatcher/saveload.cpp b/engines/snatcher/saveload.cpp
index 891a2c79132..69dc897b113 100644
--- a/engines/snatcher/saveload.cpp
+++ b/engines/snatcher/saveload.cpp
@@ -26,6 +26,7 @@
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
 #include "snatcher/ui.h"
+#include "snatcher/util.h"
 #include "common/algorithm.h"
 #include "common/config-manager.h"
 #include "common/memstream.h"
@@ -77,10 +78,24 @@ void SaveLoadManager::saveSettings(const Config &config) {
 }
 
 void SaveLoadManager::updateSaveSlotsStatus(GameState &state) {
-	state.saveSlotUsage = 0;
+	state.saveInfo.slotUsage = 0;
+	SaveHeader header;
+
 	for (int i = 0; i < 4; ++i) {
-		if (isSaveSlotUsed(i + 1)) // Skip autosave slot 0
-			state.saveSlotUsage |= (1 << i);
+		if (!isSaveSlotUsed(i + 1)) // Skip autosave slot 0
+			continue;
+		state.saveInfo.slotUsage |= (1 << i);
+		Common::String fileName = getSavegameFilename(i + 1, _vm->_targetName);
+		Common::SeekableReadStream *in = _vm->_saveFileMan->openForLoading(fileName);
+		if (!in)
+			error("%s(): Unable to open savegame file", __FUNCTION__);
+
+		readSaveHeader(in, header);
+		state.saveInfo.slots[i].desc = header.desc;
+		state.saveInfo.slots[i].playTime = Util::makeBCDTimeStamp(header.totalPlayTime * 1000, Util::kBCD_HHMMSS) >> 16;
+		state.saveInfo.slots[i].numSaves = Util::toBCD(header.saveCount);
+		state.saveInfo.slots[i].act = header.act;
+		delete in;
 	}
 }
 
@@ -94,11 +109,13 @@ void SaveLoadManager::requestSave(int slot, const Common::String &desc) {
 }
 
 void SaveLoadManager::handleSaveLoad(GameState &state) {
-	if (_pendingSaveLoad > 0)
+	if (state.pendingSaveLoad)
+		loadState(state.pendingSaveLoad, state);
+	else if (_pendingSaveLoad > 0)
 		loadState(_pendingSaveLoad - 1, state);
 	else if (_pendingSaveLoad < 0)
 		saveState(-_pendingSaveLoad - 1, state);
-	_pendingSaveLoad = 0;
+	state.pendingSaveLoad = _pendingSaveLoad = 0;
 }
 
 bool SaveLoadManager::isSaveSlotUsed(int16 slot) const {
@@ -125,17 +142,20 @@ void SaveLoadManager::enableSaving(bool enable) {
 void SaveLoadManager::saveTempState(Script &script) {
 	Common::MemoryWriteStreamDynamic out(DisposeAfterUse::NO);
 	_vm->_scriptEngine->saveState(&out, script, true);
-	_vm->gfx()->saveState(&out);
+	_vm->gfx()->saveState(&out, true);
 	_vm->sound()->saveState(&out);
 	_vm->_ui->saveState(&out);
 	_tempState = Common::SharedPtr<Common::MemoryReadStream>(new Common::MemoryReadStream(out.getData(), out.size(), DisposeAfterUse::YES));
 }
 
 void SaveLoadManager::restoreTempState(Script &script) {
-	_vm->_scriptEngine->loadState(_tempState.get(), script, true);
-	_vm->gfx()->loadState(_tempState.get());
-	_vm->sound()->loadState(_tempState.get());
-	_vm->_ui->loadState(_tempState.get());
+	Common::MemoryReadStream *m = _tempState.get();
+	assert(m != nullptr);
+	m->seek(0);
+	_vm->_scriptEngine->loadState(m, script, true);
+	_vm->gfx()->loadState(m, true);
+	_vm->sound()->loadState(m);
+	_vm->_ui->loadState(m);
 }
 
 Common::String SaveLoadManager::getSavegameFilename(int slot, const Common::String target) {
@@ -168,6 +188,7 @@ bool SaveLoadManager::readSaveHeader(Common::SeekableReadStream *saveFile, SaveH
 	header.td.tm_wday = saveFile->readUint32BE();
 
 	header.totalPlayTime = saveFile->readUint32BE();
+	//header.act = saveFile->readSint16BE();
 	header.saveCount = saveFile->readSint16BE();
 
 	return true;
@@ -181,20 +202,27 @@ void SaveLoadManager::loadState(int slot, GameState &state) {
 	_vm->_enableLightGun = in->readByte();
 
 	state.phase = in->readSint16BE();
-	state.phaseFlags = in->readSint16BE();
+	state.updateFlags = in->readSint16BE();
 	state.counter = in->readSint16BE();
-	state.finish = in->readSint16BE();
+	state.modFinish = in->readSint16BE();
 	state.frameNo = in->readSint16BE();
 	state.frameState = in->readSint16BE();
 	state.menuSelect = in->readSint16BE();
 	state.modIndex = in->readSint16BE();
-	state.modProcessSub = in->readSint16BE();
-	state.modProcessTop = in->readSint16BE();
+	state.modPhaseSub = in->readSint16BE();
+	state.modPhaseTop = in->readSint16BE();
 	state.prologue = in->readSint16BE();
 
+	uint16 tsize = 0;//in->readUint16BE();
+	if (tsize) {
+		uint8 *tmp = new uint8[tsize];
+		in->read(tmp, tsize);
+		_tempState = Common::SharedPtr<Common::MemoryReadStream>(new Common::MemoryReadStream(tmp, tsize, DisposeAfterUse::YES));
+	}
+
 	_vm->_scriptEngine->loadState(in, state.script, false);
 	_vm->_cmdQueue->loadState(in);
-	_vm->gfx()->loadState(in);
+	_vm->gfx()->loadState(in, false);
 	_vm->sound()->loadState(in);
 	_vm->_ui->loadState(in);
 
@@ -205,7 +233,7 @@ void SaveLoadManager::loadState(int slot, GameState &state) {
 
 	if (state.prologue == -1) {
 		state.phase = 0;
-		state.phaseFlags = 0;
+		state.updateFlags = 0;
 		state.menuSelect = 1;
 	}
 }
@@ -217,20 +245,33 @@ void SaveLoadManager::saveState(int slot, GameState &state) {
 	out->writeByte(_vm->_enableLightGun);
 
 	out->writeSint16BE(state.phase);
-	out->writeSint16BE(state.phaseFlags);
+	out->writeSint16BE(state.updateFlags);
 	out->writeSint16BE(state.counter);
-	out->writeSint16BE(state.finish);
+	out->writeSint16BE(state.modFinish);
 	out->writeSint16BE(state.frameNo);
 	out->writeSint16BE(state.frameState);
 	out->writeSint16BE(state.menuSelect);
 	out->writeSint16BE(state.modIndex);
-	out->writeSint16BE(state.modProcessSub);
-	out->writeSint16BE(state.modProcessTop);
+	out->writeSint16BE(state.modPhaseSub);
+	out->writeSint16BE(state.modPhaseTop);
 	out->writeSint16BE(state.prologue);
 
+	Common::MemoryReadStream *m = _tempState.get();
+	if (m) {
+		m->seek(0);
+		uint32 tsize = m->size();
+		uint8 *tmp = new uint8[tsize];
+		m->read(tmp, tsize);
+		out->writeUint16BE(tsize);
+		out->write(tmp, tsize);
+		delete[] tmp;
+	} else {
+		out->writeUint16BE(0);
+	}
+
 	_vm->_scriptEngine->saveState(out, state.script, false);
 	_vm->_cmdQueue->saveState(out);
-	_vm->gfx()->saveState(out);
+	_vm->gfx()->saveState(out, false);
 	_vm->sound()->saveState(out);
 	_vm->_ui->saveState(out);
 
@@ -250,8 +291,8 @@ Common::SeekableReadStream *SaveLoadManager::openFileForLoading(int slot, GameSt
 
 	readSaveHeader(in, header);
 	state.totalPlayTime = header.totalPlayTime;
-	state.saveCount = header.saveCount;
-
+	state.saveInfo.act = header.act;
+	state.saveInfo.saveCount = header.saveCount;
 	return in;
 }
 
@@ -286,7 +327,8 @@ Common::OutSaveFile *SaveLoadManager::openFileForSaving(int slot, const Common::
 	out->writeSint32BE(td.tm_wday);
 
 	out->writeUint32BE(state.totalPlayTime);
-	out->writeSint16BE(++state.saveCount);
+	out->writeUint16BE(state.saveInfo.act);
+	out->writeSint16BE(++state.saveInfo.saveCount);
 
 	return out;
 }
diff --git a/engines/snatcher/saveload.h b/engines/snatcher/saveload.h
index 547f1651ab4..70ac6f611e1 100644
--- a/engines/snatcher/saveload.h
+++ b/engines/snatcher/saveload.h
@@ -63,7 +63,7 @@ public:
 
 public:
 	struct SaveHeader {
-		SaveHeader() : version(0), lang(0), platform(0), desc(), thumbnail(), totalPlayTime(0), saveCount(0) {
+		SaveHeader() : version(0), lang(0), platform(0), desc(), thumbnail(), totalPlayTime(0), saveCount(0), act(0) {
 			memset(&td, 0, sizeof(TimeDate));
 		}
 		uint32 version;
@@ -74,6 +74,7 @@ public:
 		Common::SharedPtr<Graphics::Surface> thumbnail;
 		uint32 totalPlayTime;
 		int16 saveCount;
+		int16 act;
 	};
 
 	static Common::String getSavegameFilename(int slot, Common::String target);
diff --git a/engines/snatcher/scene_d0.cpp b/engines/snatcher/scene_d0.cpp
index 58bd756ea16..f026ee132fa 100644
--- a/engines/snatcher/scene_d0.cpp
+++ b/engines/snatcher/scene_d0.cpp
@@ -133,7 +133,7 @@ SH_IMPL_UPDT(D0) {
 		(*_frameProcs[state.frameNo])(state);
 		++state.frameNo;
 	} else if (_vm->input().singleFrameControllerFlags & 0x80) {
-		state.finish = -1;
+		state.modFinish = -1;
 		state.frameNo = 0;
 	}
 }
@@ -253,7 +253,7 @@ SH_IMPL_FRM(D0, 32) {
 }
 
 SH_IMPL_FRM(D0, 34) {
-	state.finish = 1;
+	state.modFinish = 1;
 	state.frameNo = 0;
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 }
diff --git a/engines/snatcher/scene_d1.cpp b/engines/snatcher/scene_d1.cpp
index 05c247b384d..17897ac3155 100644
--- a/engines/snatcher/scene_d1.cpp
+++ b/engines/snatcher/scene_d1.cpp
@@ -123,7 +123,7 @@ SH_IMPL_UPDT(D1) {
 		(*_frameProcs[state.frameNo])(state);
 		++state.frameNo;
 	} else if (_vm->input().singleFrameControllerFlags & 0x80) {
-		state.finish = -1;
+		state.modFinish = -1;
 		state.frameNo = 0;
 	}
 }
@@ -219,7 +219,7 @@ SH_IMPL_FRM(D1, 27) {
 }
 
 SH_IMPL_FRM(D1, 28) {
-	state.finish = 1;
+	state.modFinish = 1;
 	state.frameNo = 0;
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
 }
diff --git a/engines/snatcher/scene_d2.cpp b/engines/snatcher/scene_d2.cpp
index ff9270bad58..4ca1d1b9a77 100644
--- a/engines/snatcher/scene_d2.cpp
+++ b/engines/snatcher/scene_d2.cpp
@@ -208,7 +208,7 @@ SH_IMPL_FRM(D2, 07) {
 		break;
 	default:
 		++state.frameNo;
-		if (state.saveSlotUsage)
+		if (state.saveInfo.slotUsage)
 			++state.frameNo;
 		state.frameState = 0;
 		break;
@@ -248,8 +248,8 @@ SH_IMPL_FRM(D2, 09) {
 	switch (state.frameState) {
 	case 0:
 		_vm->gfx()->transitionCommand(0xFF);
-		_vm->gfx()->clearAnimParameterFlags(state.saveSlotUsage ? 17 : 16, GraphicsEngine::kAnimParaControlFlags, ~GraphicsEngine::kAnimHide);
-		state.frameState += (state.saveSlotUsage ? 1 : 2);
+		_vm->gfx()->clearAnimParameterFlags(state.saveInfo.slotUsage ? 17 : 16, GraphicsEngine::kAnimParaControlFlags, ~GraphicsEngine::kAnimHide);
+		state.frameState += (state.saveInfo.slotUsage ? 1 : 2);
 		break;
 	case 1:
 		if (_vm->input().singleFrameControllerFlags & 3)
@@ -286,9 +286,8 @@ SH_IMPL_FRM(D2, 10) {
 	bool fin = false;
 	switch (state.frameState) {
 	case 0:
-		if (state.counter == 3) {
-
-		}
+		if (state.counter == 3)
+			_vm->gfx()->updateSaveLoadDialog(state.saveInfo);
 		if (state.counter != 21) {;
 			_vm->gfx()->enqueueDrawCommands(_module->getPtr(0x29142).getDataFromTable(state.counter));
 			if (state.counter != 0)
@@ -305,13 +304,14 @@ SH_IMPL_FRM(D2, 10) {
 			if (_vm->input().singleFrameControllerFlags & 2)
 				++_curSaveFile;
 			_curSaveFile &= 3;
-		} while (!(state.saveSlotUsage & (1 << _curSaveFile)));
+		} while (!(state.saveInfo.slotUsage & (1 << _curSaveFile)));
 
 		_vm->gfx()->setAnimParameter(24, GraphicsEngine::kAnimParaFrame, _curSaveFile << 2);
 		_vm->gfx()->setAnimParameter(25, GraphicsEngine::kAnimParaFrame, _curSaveFile << 2);
 
 		if (_vm->input().singleFrameControllerFlags & 0x80) {
 			_vm->sound()->fmSendCommand(56, 0, 2);
+			state.pendingSaveLoad = _curSaveFile + 1;
 			_loadCancelled = false;
 			fin = true;
 		} else if (_vm->input().singleFrameControllerFlags & 0x10) {
@@ -522,7 +522,7 @@ SH_IMPL_FRM(D2, 11) {
 SH_IMPL_FRM(D2, 12) {
 	if (--state.counter)
 		return;
-	state.finish = 1;
+	state.modFinish = 1;
 	state.frameNo = 0;
 	state.frameState = 0;
 	_vm->gfx()->reset(GraphicsEngine::kResetSetDefaultsExt);
diff --git a/engines/snatcher/scene_y16.cpp b/engines/snatcher/scene_y16.cpp
index 7f34dc2ae7b..230b24067d3 100644
--- a/engines/snatcher/scene_y16.cpp
+++ b/engines/snatcher/scene_y16.cpp
@@ -189,7 +189,7 @@ SH_IMPL_FRM(Y16, 17) {
 		return;
 	}
 	state.counter = 300;
-	if (state.saveCount)
+	if (state.saveInfo.saveCount)
 		state.frameNo = 24;
 }
 
@@ -251,7 +251,7 @@ SH_IMPL_FRM(Y16, 26) {
 
 SH_IMPL_FRM(Y16, 27) {
 	state.frameNo = 0;
-	state.finish = 1;
+	state.modFinish = 1;
 }
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 3630933097e..f10e85526ca 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -200,7 +200,7 @@ void SnatcherEngine::reset() {
 }
 
 void SnatcherEngine::playBootLogoAnimation(const GameState &state) {
-	if (ConfMan.hasKey("save_slot"))
+	if (!_reset && ConfMan.hasKey("save_slot"))
 		return; // Skip logo animation when loading a savegame from the launcher
 
 	uint32 frameTimer = 0;
@@ -228,6 +228,7 @@ bool SnatcherEngine::start() {
 	GameState state;
 	_saveMan->loadSettings(state.conf);
 	_saveMan->updateSaveSlotsStatus(state);
+	_saveMan->enableSaving(false);
 	_memHandler->setGameState(&state);
 
 	playBootLogoAnimation(state);
@@ -282,6 +283,8 @@ bool SnatcherEngine::start() {
 			}
 		}
 
+		_saveMan->enableSaving(state.phase == 2 && state.modPhaseTop == 5);
+
 		checkEvents(state);
 
 		_saveMan->handleSaveLoad(state);
@@ -290,7 +293,7 @@ bool SnatcherEngine::start() {
 		_snd->update();
 		delayUntil(nextFrame);
 
-		if (state.modProcessTop == 5) {
+		if (state.modPhaseTop == 5) {
 			playTimer += _frameLen;
 			if (playTimer >= (1000 << 14)) {
 				playTimer -= (1000 << 14);
@@ -421,14 +424,14 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 }
 
 void SnatcherEngine::updateMainState(GameState &state) {
-	// The phaseFlags variable is an invention to emulate the interaction between the main thread and the
+	// The updateFlags variable is an invention to emulate the interaction between the main thread and the
 	// vertical interrupt handlers in the original code. It may complicate things a bit (e. g. I have to
 	// provide means to drop out of several involved functions and continue with them later), but I still
 	// like this better than making the code multi-threaded (using a timer proc as vint handler replacment).
 
-	if (state.phaseFlags & 0x80) {
+	if (state.updateFlags & 0x80) {
 		if (!(_cmdQueue->enabled() || (_snd->pcmGetStatus().statusBits & 7)))
-			state.phaseFlags &= ~0x80;
+			state.updateFlags &= ~0x80;
 		else
 			return;
 	}
@@ -455,7 +458,7 @@ void SnatcherEngine::updateMainState(GameState &state) {
 		_cmdQueue->start();
 
 		++state.phase;
-		state.phaseFlags |= 0x80;
+		state.updateFlags |= 0x80;
 
 		break;
 
@@ -491,40 +494,40 @@ void SnatcherEngine::updateMainState(GameState &state) {
 
 		_cmdQueue->start();
 		++state.phase;
-		state.phaseFlags |= 0x80;
+		state.updateFlags |= 0x80;
 		break;
 
 	case 2:
 		// Ingame logic
-		if (state.phaseFlags & 0x40) {
+		if (state.updateFlags & 0x40) {
 			if (_scriptEngine->postProcess(state.script)) {
 				for (int i = 5; i < 15; ++i)
 					_gfx->setAnimParameter(i, GraphicsEngine::kAnimParaEnable, 0);
 				_cmdQueue->writeUInt16(0x22);
 				_cmdQueue->writeUInt32(0x139D0);
 				_cmdQueue->start();
-				state.phaseFlags |= 0xA0;
+				state.updateFlags |= 0xA0;
 			}
-			state.phaseFlags &= ~0x40;
-		} else if (state.phaseFlags & 0x20) {
+			state.updateFlags &= ~0x40;
+		} else if (state.updateFlags & 0x20) {
 			_gfx->setVar(11, 0xFF);
 			if (!_ui->drawVerbs() || !_ui->verbsTabInputPrompt(_input)) {
-				state.phaseFlags |= 0x80;
+				state.updateFlags |= 0x80;
 			} else {
 				_scriptEngine->processInput();
-				state.phaseFlags &= ~0x20;
+				state.updateFlags &= ~0x20;
 			}
-		} else if (state.phaseFlags == 0) {
+		} else if (state.updateFlags == 0) {
 			_scriptEngine->run(state.script);
 			_cmdQueue->start();
-			state.phaseFlags |= 0xC0;
+			state.updateFlags |= 0xC0;
 		}
 		break;
 
 	case 3:
 		// Ending sequence
 		state.phase = 5;
-		state.finish = 1;
+		state.modFinish = 1;
 		break;
 
 	case 4:
@@ -535,7 +538,9 @@ void SnatcherEngine::updateMainState(GameState &state) {
 		break;
 
 	default:
-		// Infinite loop (maybe change this to quit the engine instead)
+		// Infinite loop
+		// Possible TODO: Maybe change this to quit the engine instead. For the console hardware, there was
+		// not much choice except just letting it run, but we don't necessarily have to copy that behavior.
 		break;
 	}
 }
@@ -544,55 +549,55 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 	bool _sub_bool_5 = false;
 	++_gfxInfo.frameCounter;
 
-	switch (state.modProcessTop) {
+	switch (state.modPhaseTop) {
 	case -1:
 		_snd->cdaStop();
-		state.modProcessTop = 0;
+		state.modPhaseTop = 0;
 		break;
 	case 0:
-		switch (state.modProcessSub) {
+		switch (state.modPhaseSub) {
 		case 0:
-			++state.modProcessSub;
+			++state.modPhaseSub;
 			break;
 		case 1:
 			if (!_snd->cdaIsPlaying()) {
 				delete _module;
 				_module = _fio->loadModule(4);
 				assert(_module);
-				++state.modProcessSub;
+				++state.modPhaseSub;
 			}
 			break;
 		case 2:
-			++state.modProcessSub;
+			++state.modPhaseSub;
 			break;
 		case 3:
-			state.modProcessSub = 0;
-			state.finish = 0;
-			++state.modProcessTop;
+			state.modPhaseSub = 0;
+			state.modFinish = 0;
+			++state.modPhaseTop;
 			break;
 		default:
 			break;
 		}
 		break;
 	case 1:
-		switch (state.modProcessSub) {
+		switch (state.modPhaseSub) {
 		case 0:
 			state.frameNo = 0;
-			++state.modProcessSub;
+			++state.modPhaseSub;
 			_snd->pcmInitSound(30);
 			break;
 		case 1:
 			if (!(_snd->pcmGetStatus().statusBits & 0x0F))
-				++state.modProcessSub;
+				++state.modPhaseSub;
 			break;
 		case 2:
 			if (_module)
 				_module->run(state);
-			if (state.finish) {
+			if (state.modFinish) {
 				_saveMan->saveSettings(state.conf);
-				state.modProcessSub = 0;
-				state.finish = 0;
-				state.modProcessTop = state.menuSelect ? 7 : state.modProcessTop + 1;
+				state.modPhaseSub = 0;
+				state.modFinish = 0;
+				state.modPhaseTop = state.menuSelect ? 7 : state.modPhaseTop + 1;
 				state.modIndex = 0;
 				state.prologue = 1;
 			}
@@ -602,7 +607,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 		}
 		break;
 	case 2:
-		switch (state.modProcessSub) {
+		switch (state.modPhaseSub) {
 		case 0:
 			if (!(_gfx->frameCount() & 0x1F)) {
 				if (!_snd->cdaIsPlaying()) {
@@ -611,7 +616,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 					assert(state.modIndex < ARRAYSIZE(scids));
 					_module = _fio->loadModule(scids[state.modIndex]);
 					assert(_module);
-					++state.modProcessSub;
+					++state.modPhaseSub;
 				} else {
 					_snd->cdaStop();
 				}
@@ -621,67 +626,67 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			if (!(_gfx->frameCount() & 0x1F)) {
 				// original: check whether file is loaded
 				state.frameNo = -1;
-				++state.modProcessSub;
+				++state.modPhaseSub;
 			}
 			break;
 		case 2:
 			if (_module)
 				_module->run(state);
-			if (state.finish < 0) {
-				state.finish = 0;
+			if (state.modFinish < 0) {
+				state.modFinish = 0;
 				state.counter = 10;
-				++state.modProcessSub;
+				++state.modPhaseSub;
 				_gfx->enqueuePaletteEvent(_scd->makePtr(MemMapping::MEM_PALDATA_06));
-			} else if (state.finish) {
+			} else if (state.modFinish) {
 				if (state.modIndex == 0) {
 					++state.modIndex;
-					state.finish = 0;
+					state.modFinish = 0;
 				}
 				_gfx->reset(GraphicsEngine::kResetAnimations);
-				state.modProcessSub = 0;
+				state.modPhaseSub = 0;
 			}
 			break;
 		case 3:
 			if (--state.counter == 1) {
 				_gfx->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_05));
 			} else if (state.counter == 0) {
-				state.finish = -1;
-				state.modProcessSub = 0;
+				state.modFinish = -1;
+				state.modPhaseSub = 0;
 				_gfx->reset(GraphicsEngine::kResetSetDefaultsExt);
 			}
 			break;
 		default:
 			break;
 		}
-		if (state.finish) {
-			state.finish = 0;
-			state.modProcessTop = 7;
-			state.modProcessSub = 0;
+		if (state.modFinish) {
+			state.modFinish = 0;
+			state.modPhaseTop = 7;
+			state.modPhaseSub = 0;
 			_gfx->transitionCommand(0xFF);
 			_gfx->setVar(9, 1);
 			_gfx->reset(GraphicsEngine::kResetPalEvents | GraphicsEngine::kResetAnimations);
 		}
 		break;
 	case 3:
-		state.finish = 0;
-		state.modProcessTop = 0;
-		state.modProcessSub = 0;
+		state.modFinish = 0;
+		state.modPhaseTop = 0;
+		state.modPhaseSub = 0;
 		_gfx->reset(GraphicsEngine::kResetScrollState);
 		break;
 	case 5:
-		if (state.finish) {
-			++state.modProcessTop;
-			state.modProcessSub = 0;
-			state.finish = 0;
+		if (state.modFinish) {
+			++state.modPhaseTop;
+			state.modPhaseSub = 0;
+			state.modFinish = 0;
 		}
 		break;
 	case 6:
-		switch (state.modProcessSub) {
+		switch (state.modPhaseSub) {
 		case 0:
 			if (!_gfx->getAnimParameter(31, GraphicsEngine::kAnimParaEnable)) {
 				_gfx->reset(GraphicsEngine::kResetSetDefaults | GraphicsEngine::kResetAnimations);
 				_gfx->setVar(11, 0xFF);
-				++state.modProcessSub;
+				++state.modPhaseSub;
 				state.frameNo = -1;
 				state.frameState = 0;
 			}
@@ -691,19 +696,19 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 				delete _module;
 				_module = _fio->loadModule(52);
 				assert(_module);
-				++state.modProcessSub;
+				++state.modPhaseSub;
 			}
 			break;
 		case 2:
 			//original: check if file loaded
-			++state.modProcessSub;
+			++state.modPhaseSub;
 			break;
 		case 3:
 			if (_module)
 				_module->run(state);
-			if (state.finish) {
+			if (state.modFinish) {
 				_sub_bool_5 = true;
-				++state.modProcessSub;
+				++state.modPhaseSub;
 			}
 			break;
 		default:
@@ -711,24 +716,24 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 		}
 		break;
 	case 7:
-		switch (state.modProcessSub) {
+		switch (state.modPhaseSub) {
 		case 0:
 			_snd->cdaStop();
 			// original: start load PCMLT_01.BIN
-			++state.modProcessSub;
+			++state.modPhaseSub;
 			break;
 		case 1:
 		case 3:
 			// original: check if file loaded
-			++state.modProcessSub;
+			++state.modPhaseSub;
 			break;
 		case 2:
 			// original: start load PCMDRMDT.BIN
-			++state.modProcessSub;
+			++state.modPhaseSub;
 			break;
 		case 4:
-			state.modProcessTop = 5;
-			state.modProcessSub = 0;
+			state.modPhaseTop = 5;
+			state.modPhaseSub = 0;
 			state.prologue = -1;
 			break;
 		default:
diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
index 50dc01489dd..35b62d12490 100644
--- a/engines/snatcher/sound_device_scd.cpp
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -1800,7 +1800,7 @@ bool SegaSoundDevice::cdaIsPlaying() const {
 
 uint32 SegaSoundDevice::cdaGetTime() const {
 	uint32 relTime = cdaIsPlaying() ? g_system->getMillis() - _musicStartTime : 0;
-	return Util::makeBCDTimeStamp(relTime);
+	return Util::makeBCDTimeStamp(relTime, Util::kBCD_MMSSFR);
 }
 
 void SegaSoundDevice::fmSendCommand(int cmd, int restoreVolume) {
diff --git a/engines/snatcher/state.h b/engines/snatcher/state.h
index 41e937069a7..af6ea2fadc2 100644
--- a/engines/snatcher/state.h
+++ b/engines/snatcher/state.h
@@ -22,6 +22,7 @@
 #ifndef SNATCHER_STATE_H
 #define SNATCHER_STATE_H
 
+#include "common/str.h"
 #include "common/rect.h"
 #include "common/scummsys.h"
 
@@ -45,6 +46,20 @@ struct Config {
 	Common::Point lightGunBias;
 };
 
+struct SaveInfo {
+	SaveInfo() : slotUsage(0), saveCount(0), act(0) {}
+	struct Slot {
+		Slot() : playTime(0), numSaves(0), act(0), desc() {}
+		Common::String desc;
+		uint16 numSaves;
+		uint16 playTime;
+		uint8 act;
+	} slots[4];
+	int16 slotUsage;
+	int16 saveCount;
+	uint8 act;
+};
+
 struct Script {
 	Script(uint32 textResourceOffset, int16 &chaptr) : sentenceDone(0), sentencePos(0), data(nullptr), dataSize(0), curPos(0), newPos(0xFFFF), curFileNo(0), curGfxScript(-1), phase(chaptr), textResOffset(textResourceOffset) {}
 	~Script() {
@@ -66,20 +81,20 @@ struct Script {
 };
 
 struct GameState {
-	GameState() : frameNo(0), frameState(0), finish(0), modProcessTop(0), modProcessSub(0), counter(0), modIndex(0), menuSelect(0), prologue(0), phase(0), phaseFlags(0), saveSlotUsage(0), saveCount(0), conf(Config()), script(0x3800, phase), totalPlayTime(0) {}
+	GameState() : frameNo(0), frameState(0), modFinish(0), modPhaseTop(0), modPhaseSub(0), counter(0), modIndex(0), menuSelect(0), prologue(0), pendingSaveLoad(0), phase(0), updateFlags(0), saveInfo(), conf(), script(0x3800, phase), totalPlayTime(0) {}
 	int16 frameNo;
 	int16 frameState;
-	int16 finish;
-	int16 modProcessTop;
-	int16 modProcessSub;
+	int16 modFinish;
+	int16 modPhaseTop;
+	int16 modPhaseSub;
 	int16 counter;
 	int16 modIndex;
 	int16 menuSelect;
+	int16 pendingSaveLoad;
 	int16 prologue;
 	int16 phase;
-	int16 phaseFlags;
-	int16 saveSlotUsage;
-	int16 saveCount;
+	int16 updateFlags;
+	SaveInfo saveInfo;
 	Config conf;
 	Script script;
 	uint32 totalPlayTime;
diff --git a/engines/snatcher/util.cpp b/engines/snatcher/util.cpp
index f191254bff7..187991eeacb 100644
--- a/engines/snatcher/util.cpp
+++ b/engines/snatcher/util.cpp
@@ -79,14 +79,19 @@ uint32 decodeSCDData(const uint8 *src, uint8 *dst) {
 	return (dst - dstStart);
 }
 
-uint8 toDecimal(uint8 v) {
+uint8 toBCD(uint8 v) {
 	return (v / 10) << 4 | (v % 10);
 }
 
-uint32 makeBCDTimeStamp(uint32 msecs) {
-	uint32 min = toDecimal(msecs / 60000);
-	uint32 sec = toDecimal((msecs / 1000) % 60);
-	uint32 frm = toDecimal((msecs % 1000) * 1000000 / 13333333);
+uint32 makeBCDTimeStamp(uint32 msecs, BCDResolution res) {
+	uint32 hrs = toBCD((msecs / 3600000) % 24);
+	uint32 min = toBCD((msecs / 60000) % 60);
+	uint32 sec = toBCD((msecs / 1000) % 60);
+	uint32 frm = toBCD((msecs % 1000) * 1000000 / 13333333);
+
+	if (res == kBCD_HHMMSS) // BCD time code hh:mm:ss
+		return ((hrs & 0xFF) << 24) | ((min & 0xFF) << 16) | ((sec & 0xFF) << 8);
+
 	// BCD time code mm:ss:ff:md (md = mode: 00 = CD-DA, 01 = CD-ROM mode 1, 02 = CD-ROM mode 2; irrelevant to us)
 	return ((min & 0xFF) << 24) | ((sec & 0xFF) << 16) | ((frm & 0xFF) << 8);
 }
diff --git a/engines/snatcher/util.h b/engines/snatcher/util.h
index 04549fad0df..e152dc029aa 100644
--- a/engines/snatcher/util.h
+++ b/engines/snatcher/util.h
@@ -30,7 +30,13 @@ namespace Util {
 
 extern uint32 decodeSCDData(const uint8 *src, uint8 *dst);
 
-extern uint32 makeBCDTimeStamp(uint32 msecs);
+enum BCDResolution {
+	kBCD_MMSSFR = 0,
+	kBCD_HHMMSS
+};
+
+extern uint32 makeBCDTimeStamp(uint32 msecs, BCDResolution res);
+extern uint8 toBCD(uint8 v);
 
 extern void rngReset();
 extern uint16 rngMakeNumber();


Commit: 0c1e422963065f8b1421e288bc18150359da1607
    https://github.com/scummvm/scummvm/commit/0c1e422963065f8b1421e288bc18150359da1607
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: add default key map

Changed paths:
    engines/snatcher/POTFILES
    engines/snatcher/metaengine.cpp


diff --git a/engines/snatcher/POTFILES b/engines/snatcher/POTFILES
index 4fc3553056e..82e315529e7 100644
--- a/engines/snatcher/POTFILES
+++ b/engines/snatcher/POTFILES
@@ -1 +1 @@
-engines/snatcher/detection.cpp
+engines/snatcher/metaengine.cpp
diff --git a/engines/snatcher/metaengine.cpp b/engines/snatcher/metaengine.cpp
index f85655d1361..40b9d5b8078 100644
--- a/engines/snatcher/metaengine.cpp
+++ b/engines/snatcher/metaengine.cpp
@@ -25,11 +25,12 @@
 #include "common/config-manager.h"
 #include "common/system.h"
 #include "common/savefile.h"
-
+#include "common/translation.h"
 #include "engines/advancedDetector.h"
-
 #include "base/plugins.h"
-
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/keymapper.h"
+#include "backends/keymapper/standard-actions.h"
 
 const ADExtraGuiOptionsMap gameGuiOptions[] = {
 	AD_EXTRA_GUI_OPTIONS_TERMINATOR
@@ -165,8 +166,49 @@ SaveStateDescriptor SnatcherMetaEngine::querySaveMetaInfos(const char *target, i
 	return desc;
 }
 
+const char *const kLightGunKeymapName = "snlightgun";
+const char *const kControllerKeymapName = "sncontroller";
+
+void addKeymapAction(Common::Keymap *const keyMap, const char *actionId, const Common::U32String &actionDesc, const Common::Functor0Mem<void, Common::Action>::FuncType setEventProc, const Common::String &mapping1, const Common::String &mapping2) {
+	Common::Action *act = new Common::Action(actionId, actionDesc);
+	Common::Functor0Mem<void, Common::Action>(act, setEventProc)();
+	act->addDefaultInputMapping(mapping1);
+	act->addDefaultInputMapping(mapping2);
+	keyMap->addAction(act);
+}
+
+void addKeymapAction(Common::Keymap *const keyMap, const char *actionId, const Common::U32String &actionDesc, Common::KeyState eventKeyState, const Common::String &mapping1, const Common::String &mapping2) {
+	Common::Action *act = new Common::Action(actionId, actionDesc);
+	act->setKeyEvent(eventKeyState);
+	act->addDefaultInputMapping(mapping1);
+	act->addDefaultInputMapping(mapping2);
+	keyMap->addAction(act);
+}
+
 Common::KeymapArray SnatcherMetaEngine::initKeymaps(const char *target) const {
-	return AdvancedMetaEngine::initKeymaps(target);
+	Common::Keymap *keyMap1 = new Common::Keymap(Common::Keymap::kKeymapTypeGame, kLightGunKeymapName, "Snatcher - Lightgun");
+	Common::Keymap *keyMap2 = new Common::Keymap(Common::Keymap::kKeymapTypeGame, kControllerKeymapName, "Snatcher - Controller");
+	Common::KeymapArray res;
+
+	addKeymapAction(keyMap1, Common::kStandardActionLeftClick, _("Lightgun Fire Button"), &Common::Action::setLeftClickEvent, "MOUSE_LEFT", "JOY_LEFT_SHOULDER");
+	addKeymapAction(keyMap1, Common::kStandardActionRightClick, _("Lightgun Start Button"), &Common::Action::setRightClickEvent, "MOUSE_RIGHT", "JOY_RIGHT_SHOULDER");
+	res.push_back(keyMap1);
+
+	addKeymapAction(keyMap2, "CTRL_A", _("Controller Button A"), Common::KeyState(Common::KEYCODE_a, 'a'), "a", "JOY_A");
+	addKeymapAction(keyMap2, "CTRL_B", _("Controller Button B"), Common::KeyState(Common::KEYCODE_b, 'b'), "b", "JOY_B");
+	addKeymapAction(keyMap2, "CTRL_C", _("Controller Button C"), Common::KeyState(Common::KEYCODE_c, 'c'), "c", "JOY_X");
+	addKeymapAction(keyMap2, "CTRL_START", _("Controller Start Button"), Common::KeyState(Common::KEYCODE_SPACE, Common::ASCII_SPACE), "SPACE", "JOY_START");
+	addKeymapAction(keyMap2, "CTRL_UP", _("Controller Up"), Common::KeyState(Common::KEYCODE_UP), "UP", "JOY_UP");
+	addKeymapAction(keyMap2, "CTRL_DOWN", _("Controller Down"), Common::KeyState(Common::KEYCODE_DOWN), "DOWN", "JOY_DOWN");
+	addKeymapAction(keyMap2, "CTRL_LEFT", _("Controller Left"), Common::KeyState(Common::KEYCODE_LEFT), "LEFT", "JOY_LEFT");
+	addKeymapAction(keyMap2, "CTRL_RIGHT", _("Controller Right"), Common::KeyState(Common::KEYCODE_RIGHT), "RIGHT", "JOY_RIGHT");
+	addKeymapAction(keyMap2, "CTRL_UP_LEFT", _("Controller Up Left"), Common::KeyState(Common::KEYCODE_KP7), "UP_LEFT", "");
+	addKeymapAction(keyMap2, "CTRL_UP_RIGHT", _("Controller Up Right"), Common::KeyState(Common::KEYCODE_KP9), "UP_RIGHT", "");
+	addKeymapAction(keyMap2, "CTRL_DOWN_LEFT", _("Controller Down Left"), Common::KeyState(Common::KEYCODE_KP1), "DOWN_LEFT", "");
+	addKeymapAction(keyMap2, "CTRL_DOWN_RIGHT", _("Controller Down Right"), Common::KeyState(Common::KEYCODE_KP3), "DOWN_RIGHT", "");
+	res.push_back(keyMap2);
+
+	return res;
 }
 
 #if PLUGIN_ENABLED_DYNAMIC(SNATCHER)


Commit: a6e13217831243e143b3afadaf2432c0149534ac
    https://github.com/scummvm/scummvm/commit/a6e13217831243e143b3afadaf2432c0149534ac
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix last blocker bug

Game would hang in an infinite loop, just because
one waiting opcode executed too quickly by 1 frame.
Which caused the unpausing of an animation to happen
before its pausing. So it just remained frozen while the
script waited forever for it to complete.

Changed paths:
    engines/snatcher/animator_scd.cpp
    engines/snatcher/script.cpp
    engines/snatcher/script.h


diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index 28597a89a3a..bb7a1a3763c 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -1570,6 +1570,7 @@ void Animator_SCD::anim_setGroupParameter(AnimObject &a, int para, int16 val, bo
 			break;
 		case 6:
 			ta->controlFlags = GraphicsEngine::kAnimPause | GraphicsEngine::kAnimHide;
+			ta->scriptComFlags = 0;
 			break;
 		case 7:
 			ta->controlFlags = ta->scriptComFlags = 0;
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index b0565e6b457..d0797d84653 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -249,8 +249,10 @@ void CmdQueue::m_pcmWait(const uint16 *&data) {
 		_counter = 3600;
 		++_progress;
 	}
-	if (--_counter == 0 || !(_vm->sound()->pcmGetStatus().statusBits & 0x0F))
+	if (_progress == 2)
 		_progress = -1;
+	else if (--_counter == 0 || !(_vm->sound()->pcmGetStatus().statusBits & 0x0F))
+		++_progress;
 }
 
 void CmdQueue::m_cdaWait(const uint16 *&data) {
@@ -896,16 +898,16 @@ void ScriptEngine::makeOpcodeTable(ResourcePointer *scd) {
 		OP(doIf),
 		OP(setResult),
 		OP(setResult),
-		OP(execFunc),
-		OP(execFunc),
-		OP(execFunc),
-		OP(execFunc),
-		OP(execFunc),
-		OP(execFunc),
-		OP(execFunc),
-		OP(execFunc),
-		OP(execFunc),
-		OP(execFunc),
+		OP(runFunction),
+		OP(runFunction),
+		OP(runFunction),
+		OP(runFunction),
+		OP(runFunction),
+		OP(runFunction),
+		OP(runFunction),
+		OP(runFunction),
+		OP(runFunction),
+		OP(runFunction),
 		OP(evalGreater),
 		OP(evalGreater),
 		OP(evalGreaterOrEqual),
@@ -1181,7 +1183,7 @@ void ScriptEngine::o_setResult() {
 	setFlags(sel, _result);
 }
 
-void ScriptEngine::o_execFunc() {
+void ScriptEngine::o_runFunction() {
 	_pos2 = _pos1;
 	uint8 num = countFunctionOps();
 	uint8 cnt = 1;
diff --git a/engines/snatcher/script.h b/engines/snatcher/script.h
index af352f2b341..4d0e590a2aa 100644
--- a/engines/snatcher/script.h
+++ b/engines/snatcher/script.h
@@ -209,7 +209,7 @@ private:
 	void o_doEitherOr();
 	void o_doIf();
 	void o_setResult();
-	void o_execFunc();
+	void o_runFunction();
 	void o_evalGreater();
 	void o_evalGreaterOrEqual();
 	void o_break();


Commit: a73e2b9395a213e3cf1239f34fe489c76a1f58a3
    https://github.com/scummvm/scummvm/commit/a73e2b9395a213e3cf1239f34fe489c76a1f58a3
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
KYRA: fix warning

Changed paths:
    engines/kyra/graphics/screen_eob_segacd.cpp


diff --git a/engines/kyra/graphics/screen_eob_segacd.cpp b/engines/kyra/graphics/screen_eob_segacd.cpp
index 2deff1d46c6..aa8bd6fe022 100644
--- a/engines/kyra/graphics/screen_eob_segacd.cpp
+++ b/engines/kyra/graphics/screen_eob_segacd.cpp
@@ -539,7 +539,8 @@ void SegaAnimator::update() {
 		if (s->x == 0x4000)
 			continue;
 		*dst++ = TO_BE_16(s->y + 128);
-		*dst++ = (*dst & 0xFF00) | (s->hw & 0xFF);
+		uint16 a = (*dst & 0xFF00);
+		*dst++ = a | (s->hw & 0xFF);
 		*dst++ = TO_BE_16(s->nameTbl);
 		*dst++ = TO_BE_16(s->x + 128);
 	}


Commit: bc94f3acc146ff3adf6d74c2492cdad3919b5c90
    https://github.com/scummvm/scummvm/commit/bc94f3acc146ff3adf6d74c2492cdad3919b5c90
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix warnings

Changed paths:
    engines/snatcher/action.cpp
    engines/snatcher/action.h
    engines/snatcher/animator_scd.cpp
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/memory.cpp
    engines/snatcher/script.cpp
    engines/snatcher/script.h
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/sound_device_scd.cpp
    engines/snatcher/text_scd.cpp
    engines/snatcher/transition_scd.cpp
    engines/snatcher/util.cpp


diff --git a/engines/snatcher/action.cpp b/engines/snatcher/action.cpp
index fd055c28346..b039b5a3cad 100644
--- a/engines/snatcher/action.cpp
+++ b/engines/snatcher/action.cpp
@@ -35,7 +35,7 @@ namespace Snatcher {
 ActionSequenceHandler::ActionSequenceHandler(SnatcherEngine *vm, ResourcePointer *scd, bool palTiming) : _vm(vm), _scd(scd), _palTiming(palTiming), _stage(0), _counter1(0), _counter2(0), _progressMSB(0), _progressLSB(0),
 	_weaponState(0), _enemySpeed(0), _active(false), _handleShotPhase(0), _updateEnemiesPhase(0), _enemyAttackStatus(0), _targetField(0), _hscrollB(0), _vscrollB(0),
 		_enemyAppearanceCount(0), _civilianAppearanceCount(0), _abortFight(0), _nextEnemyAppearanceTimer(0), _enemyAttackTimer(0), _shoot_78EE(0), _activeEnemies(0), _result(),
-			_attackerId(0), _animNo(0), _shoot_7912(0), _projectileCoords(nullptr) {
+			_attackerId(0), _animNo(0), _stage2Temp(0), _projectileCoords(nullptr) {
 	_projectileCoords = new int16[18]();
 }
 
@@ -301,7 +301,7 @@ void ActionSequenceHandler::resetVars() {
 	_hscrollB = _vscrollB = 0;
 	_result = Result();
 	_enemyAppearanceCount = _civilianAppearanceCount = 0;
-	_shoot_7912 = _attackerId = 0;
+	_stage2Temp = _attackerId = 0;
 	_animNo = 0;
 }
 
@@ -736,9 +736,9 @@ void ActionSequenceHandler::updateStage() {
 			animSet(_animNo, Frame, 2);
 			break;
 		case 2:
-			v = _shoot_7912 | (num < 3 ? 1 : 0);
+			v = _stage2Temp | (num < 3 ? 1 : 0);
 			_vm->gfx()->animCopySpec(26 + v, _animNo);
-			_shoot_7912 = (v & 2) ^ 2;
+			_stage2Temp = (v & 2) ^ 2;
 			v = (v << 1) | 1;
 			break;
 		case 4:
diff --git a/engines/snatcher/action.h b/engines/snatcher/action.h
index 8c975eed29c..b5b80686739 100644
--- a/engines/snatcher/action.h
+++ b/engines/snatcher/action.h
@@ -78,8 +78,7 @@ private:
 	int16 _hscrollB;
 	int16 _vscrollB;
 	int16 _enemyAppearanceCount;
-	int16 _shoot_7912;
-	int16 _civiliansShot;
+	int16 _stage2Temp;
 	int16 _civilianAppearanceCount;
 	int16 _abortFight;
 	int16 _nextEnemyAppearanceTimer;
diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index bb7a1a3763c..5a1eefd951b 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -37,7 +37,7 @@
 
 namespace Snatcher {
 
-#define		ANIM_DEBUG
+//#define		ANIM_DEBUG
 
 struct AnimObject {
 	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), palette(0), target(0), f18(0), f1c(0),
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 0359a67a33c..1f57681af9c 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -33,8 +33,8 @@
 
 namespace Snatcher {
 
-GraphicsEngine::GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate, SoundEngine *snd, bool enableAspectRatioCorrection) : _system(system), _state(vmstate),
-	_animator(nullptr), _text(nullptr), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _flags(0), _verbAreaType(0) {
+GraphicsEngine::GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate, SoundEngine *snd, bool enableAspectRatioCorrection) :
+	_system(system), _state(vmstate), _animator(nullptr), _text(nullptr), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _verbAreaType(0) {
 	assert(system);
 	_palette = Palette::create(pxf, _system->getPaletteManager(), platform, _state);
 	assert(_palette);
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 8679ff72118..947c2739994 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -224,7 +224,6 @@ private:
 	const uint8 _bpp;
 	uint8 _dataMode;
 	uint8 _verbAreaType;
-	uint8 _flags;
 
 	uint8 *_animSaveLoadData;
 
diff --git a/engines/snatcher/memory.cpp b/engines/snatcher/memory.cpp
index 8c12fa226cd..3347bbaea31 100644
--- a/engines/snatcher/memory.cpp
+++ b/engines/snatcher/memory.cpp
@@ -103,6 +103,7 @@ void MemAccessHandler::writeWord(uint16 addr, uint16 val) {
 		break;
 	case 0x971A:
 		_ui->setInterpreterMode(val);
+		break;
 	case 0x971C:
 		_ui->setHeadLineYOffset(val);
 		break;
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index d0797d84653..d7fb855749d 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -476,7 +476,7 @@ void CmdQueue::m_clearTextInputLine(const uint16 *&data) {
 	_progress = -1;
 }
 
-ScriptEngine::ScriptEngine(CmdQueue *que, UI *ui, ActionSequenceHandler *aseq, MemAccessHandler *mem, ResourcePointer *scd) : _que(que), _ui(ui), _aseq(aseq), _mem(mem), _arrayData(nullptr), _pos1(0), _pos2(0), _op(0), /*_v1(0), _v2(0), _v3(0),*/ _result(0), _flagsTable(nullptr) {
+ScriptEngine::ScriptEngine(CmdQueue *que, UI *ui, ActionSequenceHandler *aseq, MemAccessHandler *mem, ResourcePointer *scd) : _que(que), _ui(ui), _aseq(aseq), _mem(mem), _arrayData(nullptr), _pos1(0), _pos2(0), _result(0), _flagsTable(nullptr) {
 	_flagsTable = new uint8[352]();
 	_arrayData = new uint8[256]();
 	makeOpcodeTable(scd);
diff --git a/engines/snatcher/script.h b/engines/snatcher/script.h
index 4d0e590a2aa..68e47f22a3e 100644
--- a/engines/snatcher/script.h
+++ b/engines/snatcher/script.h
@@ -26,7 +26,7 @@
 #include "common/func.h"
 #include "common/ptr.h"
 
-#define		SNATCHER_SCRIPT_DEBUG
+//#define		SNATCHER_SCRIPT_DEBUG
 
 namespace Common {
 class SeekableReadStream;
@@ -160,7 +160,6 @@ private:
 	int _pos1;
 	int _pos2;
 	uint16 _result;
-	uint _op;
 
 private:
 	void runOpcode();
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index f10e85526ca..66a40578be7 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -367,7 +367,6 @@ void SnatcherEngine::checkEvents(const GameState &state) {
 	_lastKeys &= ~_releaseKeys;
 	_releaseKeys = 0;
 	_input.singleFrameControllerFlags = _input.singleFrameControllerFlagsRemapped = 0;
-	Common::Point mouse;
 
 	while (_eventMan->pollEvent(evt)) {
 		for (const InputEvent &k : _defaultKeyEvents) {
@@ -546,7 +545,6 @@ void SnatcherEngine::updateMainState(GameState &state) {
 }
 
 void SnatcherEngine::updateModuleState(GameState &state) {
-	bool _sub_bool_5 = false;
 	++_gfxInfo.frameCounter;
 
 	switch (state.modPhaseTop) {
@@ -707,7 +705,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			if (_module)
 				_module->run(state);
 			if (state.modFinish) {
-				_sub_bool_5 = true;
+				_reset = true;
 				++state.modPhaseSub;
 			}
 			break;
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index 9e80f53f747..ccda03d17ec 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -32,10 +32,12 @@ class SnatcherMetaEngine;
 namespace Snatcher {
 
 class ActionSequenceHandler;
+class CmdQueue;
 class GraphicsEngine;
 class FIO;
 class MemAccessHandler;
 class ResourcePointer;
+class SaveLoadManager;
 class ScriptEngine;
 class SoundEngine;
 class SceneModule;
diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
index 35b62d12490..0d350525854 100644
--- a/engines/snatcher/sound_device_scd.cpp
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -194,7 +194,6 @@ private:
 	uint8 _faderTimer1;
 	uint8 _faderTimer2;
 	bool _reduceVolume2;
-	uint8 _pcmMsgFromDriver[4];
 	uint8 *_temp;
 
 private:
diff --git a/engines/snatcher/text_scd.cpp b/engines/snatcher/text_scd.cpp
index b9e71ad208f..21488f8a67e 100644
--- a/engines/snatcher/text_scd.cpp
+++ b/engines/snatcher/text_scd.cpp
@@ -22,6 +22,7 @@
 
 #include "snatcher/animator.h"
 #include "snatcher/text.h"
+#include "common/endian.h"
 
 namespace Snatcher {
 
@@ -35,7 +36,6 @@ public:
 
 	void enqueuePrintJob(const uint8 *text) override;
 	void setPrintDelay(int delay) override;
-	//void setColor(uint8 color) override;
 
 	void draw() override;
 	void reset() override { _needDraw = false; }
@@ -91,11 +91,7 @@ void TextRenderer_SCD::enqueuePrintJob(const uint8 *text) {
 void TextRenderer_SCD::setPrintDelay(int delay) {
 	_printDelay = delay;
 }
-/*
-void TextRenderer_SCD::setColor(uint8 color) {
-	_color = color;
-}
-*/
+
 void TextRenderer_SCD::draw() {
 	if (!_needDraw || _block)
 		return;
@@ -142,7 +138,8 @@ void TextRenderer_SCD::draw() {
 					_pscr_byt3 = *s++;
 					break;
 				case 0xF8:
-					_pscr_wd = (*s++ << 8) | (*s++);
+					_pscr_wd = READ_BE_INT16(s);
+					s += 2;
 					break;
 				case 0xF7:
 					_fixedWith9 = *s++ ? true : false;
diff --git a/engines/snatcher/transition_scd.cpp b/engines/snatcher/transition_scd.cpp
index a0bdc8a7fc2..625cd221df9 100644
--- a/engines/snatcher/transition_scd.cpp
+++ b/engines/snatcher/transition_scd.cpp
@@ -132,7 +132,6 @@ private:
 	uint8 _nextStepExt;
 	uint8 _lastStepExt;
 	int16 _restoreDlgTab;
-	int16 _hint_proc;
 	int16 _transitionType;
 	int16 _transitionState;
 	int16 _transitionState2;
@@ -211,7 +210,7 @@ private:
 	void hIntHandler_videoPhoneCallEnd2(Graphics::SegaRenderer *sr);
 };
 
-TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0), _hint_proc(0), _transitionStep(0),
+TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0), _transitionStep(0),
 	_trsCommandExt(0), _trsCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _lineScrollOpState(0), _lineScrollTimer1(0), _lineScrollTimer2(0), _lineScrollTimer3(0), _lineScrollTimer4(0),
 		_lineScrollTimer5(0), _trs__DB(0), _lineScrollOp(0), _restoreDlgTab(0), _transitionType(0), _transitionState(0), _transitionState2(0), _tmpScrollOffset(0), _subPara(0), _useEngineScrollOffsets(false), _hINTHandler(nullptr) {
 	_internalState = new ScrollInternalState[4];
diff --git a/engines/snatcher/util.cpp b/engines/snatcher/util.cpp
index 187991eeacb..6e670d1309e 100644
--- a/engines/snatcher/util.cpp
+++ b/engines/snatcher/util.cpp
@@ -89,15 +89,14 @@ uint32 makeBCDTimeStamp(uint32 msecs, BCDResolution res) {
 	uint32 sec = toBCD((msecs / 1000) % 60);
 	uint32 frm = toBCD((msecs % 1000) * 1000000 / 13333333);
 
-	if (res == kBCD_HHMMSS) // BCD time code hh:mm:ss
+	if (res == kBCD_HHMMSS) // BCD time code hh:mm:ss:00
 		return ((hrs & 0xFF) << 24) | ((min & 0xFF) << 16) | ((sec & 0xFF) << 8);
 
-	// BCD time code mm:ss:ff:md (md = mode: 00 = CD-DA, 01 = CD-ROM mode 1, 02 = CD-ROM mode 2; irrelevant to us)
+	// BCD time code mm:ss:ff:md (md = mode (irrelevant to us): 00 = CD-DA, 01 = CD-ROM mode 1, 02 = CD-ROM mode 2)
 	return ((min & 0xFF) << 24) | ((sec & 0xFF) << 16) | ((frm & 0xFF) << 8);
 }
 
 union RNDC {
-	RNDC() : b(0) {}
 	uint8 a[2];
 	uint16 b;
 };


Commit: 401b6307cdbb37489ea0a543d6d218132f74e9e2
    https://github.com/scummvm/scummvm/commit/401b6307cdbb37489ea0a543d6d218132f74e9e2
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix palette glitch

Changed paths:
    engines/snatcher/palette_scd.cpp
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h


diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index 31b9e4d804d..1dd06ed3e68 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -193,7 +193,7 @@ void SCDPalette::setDefaults(int mode) {
 	if (mode == 0) {
 		int cnt = (_gfxState.testFlag(1, 1) || _gfxState.getVar(5)) ? 64 : 48;
 		_gfxState.clearFlag(1, 1);
-		Common::fill<uint16*, uint16>(&_colors[64 - cnt], &_colors[cnt], 0);
+		Common::fill<uint16*, uint16>(&_colors[64 - cnt], &_colors[64], 0);
 		if (_gfxState.testFlag(1, 2)) {
 			_gfxState.clearFlag(1, 2);
 			Common::fill<uint16*, uint16>(&_colors[80], &_colors[128], 0);
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 66a40578be7..c285c678fdf 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -50,7 +50,7 @@
 namespace Snatcher {
 
 SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _scd(nullptr), _gfx(nullptr), _snd(nullptr), _input(),
-	_scriptEngine(nullptr), _cmdQueue(nullptr), _aseq(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _enableLightGun(false), _ui(nullptr), _gfxInfo(), _saveMan(nullptr), _reset(false),
+	_scriptEngine(nullptr), _cmdQueue(nullptr), _aseq(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _enableLightGun(false), _ui(nullptr), _gfxInfo(), _saveMan(nullptr), _reset(0),
 		_memHandler(nullptr), _frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
 	assert(system);
 }
@@ -233,14 +233,14 @@ bool SnatcherEngine::start() {
 
 	playBootLogoAnimation(state);
 
-	_reset = false;
+	_reset = 0;
 	uint32 frameTimer = 0;
 	uint32 playTimer = 0;
 
 	int16 countTo5 = 0;
 	int16 runspeed = 0;
 
-	while (!shouldQuit() && !_reset) {
+	while (!shouldQuit() && _reset != 1) {
 		frameTimer += _frameLen;
 		uint32 nextFrame = _system->getMillis() + (frameTimer >> 14);
 		frameTimer &= 0x3FFF;
@@ -300,6 +300,8 @@ bool SnatcherEngine::start() {
 				++state.totalPlayTime;
 			}
 		}
+		if (_reset)
+			--_reset;
 	}
 
 	return true;
@@ -533,7 +535,7 @@ void SnatcherEngine::updateMainState(GameState &state) {
 		// Reset
 		_cmdQueue->writeUInt16(0x02);
 		_cmdQueue->start();
-		_reset = true;
+		_reset = 100;
 		break;
 
 	default:
@@ -705,7 +707,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			if (_module)
 				_module->run(state);
 			if (state.modFinish) {
-				_reset = true;
+				_reset = 100;
 				++state.modPhaseSub;
 			}
 			break;
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index ccda03d17ec..02ddd3b1c11 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -76,7 +76,7 @@ private:
 	void updateModuleState(GameState &state);
 
 	const uint32 _frameLen;
-	bool _reset;
+	uint16 _reset;
 
 	// ConfigManager sync
 	void syncSoundSettings() override;


Commit: db43ef2fc4f423b273e147e73dfb5825c365620d
    https://github.com/scummvm/scummvm/commit/db43ef2fc4f423b273e147e73dfb5825c365620d
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: minor intro timing fix

Changed paths:
    engines/snatcher/palevent_scd.h
    engines/snatcher/resource.cpp
    engines/snatcher/resource.h
    engines/snatcher/script.cpp
    engines/snatcher/snatcher.cpp


diff --git a/engines/snatcher/palevent_scd.h b/engines/snatcher/palevent_scd.h
index ded870670b4..cc39003dd96 100644
--- a/engines/snatcher/palevent_scd.h
+++ b/engines/snatcher/palevent_scd.h
@@ -27,7 +27,7 @@
 namespace Snatcher {
 
 struct PalEventSCD {
-	PalEventSCD() : cmd(0), delay(0), countDown(0), destOffset(0), destFlag(false), len(0), srcOffsetCur(0), srcOffsets(0), res(), progress(0), fD(0), fE(0), fF(0) {}
+	PalEventSCD() : cmd(0), delay(0), countDown(0), destOffset(0), destFlag(false), len(0), srcOffsetCur(0), srcOffsets(0), res(), progress(0) {}
 	void clear() {
 		cmd = 0;
 		delay = 0;
@@ -39,9 +39,6 @@ struct PalEventSCD {
 		srcOffsetCur = 0;
 		srcOffsets = 0;
 		progress = 0;
-		fD = 0;
-		fE = 0;
-		fF = 0;
 	}
 	uint8 cmd;
 	uint8 delay;
@@ -53,9 +50,6 @@ struct PalEventSCD {
 	const uint32 *srcOffsets;
 	ResourcePointer res;
 	uint8 progress;
-	uint8 fD;
-	uint8 fE;
-	uint8 fF;
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index 7e88550786e..d8daf0a7e7f 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -24,6 +24,7 @@
 #include "snatcher/scene.h"
 
 #include "common/stream.h"
+#include "common/system.h"
 
 namespace Snatcher {
 
@@ -49,7 +50,7 @@ private:
 	bool _dispose;
 };
 
-FIO::FIO(SnatcherEngine *vm, bool isBigEndian) : _vm(vm), _bigEndianTarget(isBigEndian) {
+FIO::FIO(SnatcherEngine *vm, bool isBigEndian) : _vm(vm), _bigEndianTarget(isBigEndian), _loadingTimer(0) {
 	_files.add("global_search", &SearchMan, 0, false);
 }
 
@@ -61,6 +62,8 @@ SceneModule *FIO::loadModule(int index) {
 }
 
 uint8 *FIO::fileData(int index, uint32 *fileSize) {
+	if (index > 60)
+		debug("%s(): loading file %s", __FUNCTION__, _resFileList[index]);
 	return (index >= 0 && index < _resFileListSize) ? fileData(_resFileList[index], fileSize) : nullptr;
 }
 
@@ -80,9 +83,22 @@ uint8 *FIO::fileData(const Common::Path &file, uint32 *fileSize) {
 	s->read(data, size);
 	delete s;
 
+	// The single speed CD drive fetches one sector (2048 decoded bytes) every 13.5 milliseconds.
+	_loadingTimer = g_system->getMillis() + ((((size + 0x7FF) >> 11) * 27) >> 1);
+
 	return data;
 }
 
+bool FIO::loadingCompleted() {
+	if (_loadingTimer == 0)
+		return true;
+	if (g_system->getMillis() >= _loadingTimer) {
+		_loadingTimer = 0;
+		return true;
+	}
+	return false;
+}
+
 Common::SeekableReadStream *FIO::readStream(int index) {
 	return (index >= 0 && index < _resFileListSize) ? readStream(_resFileList[index]) : nullptr;
 }
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index 26e8c2467da..19174da5d0a 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -128,6 +128,7 @@ public:
 	SceneModule *loadModule(int index);
 	uint8 *fileData(int index, uint32 *fileSize);
 	uint8 *fileData(const Common::Path &file, uint32 *fileSize);
+	bool loadingCompleted();
 	Common::SeekableReadStream *readStream(int index);
 	Common::SeekableReadStream *readStream(const Common::Path &file);
 	Common::SeekableReadStreamEndian *readStreamEndian(int index, EndianMode em = kPlatformEndianness);
@@ -137,6 +138,7 @@ public:
 private:
 	Common::SearchSet _files;
 	SnatcherEngine *_vm;
+	uint32 _loadingTimer;
 	bool _bigEndianTarget;
 
 private:
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index d7fb855749d..49a3dfedfee 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -357,8 +357,10 @@ void CmdQueue::m_loadResource(const uint16 *&data) {
 			error("%s(): Unexpected target address 0x%08x", __FUNCTION__, dest);
 		}
 
-	} else {
-		// original: is file done loading
+		// We don't really check if the file has finished loading here (which it obviously has),
+		// we just try to emulate the original timing, since the original's delays are not always
+		// sufficient to match the desired total delay correctly.
+	} else if (_vm->_fio->loadingCompleted()) {
 		_progress = -1;
 	}
 }
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index c285c678fdf..600eed2be85 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -539,9 +539,6 @@ void SnatcherEngine::updateMainState(GameState &state) {
 		break;
 
 	default:
-		// Infinite loop
-		// Possible TODO: Maybe change this to quit the engine instead. For the console hardware, there was
-		// not much choice except just letting it run, but we don't necessarily have to copy that behavior.
 		break;
 	}
 }
@@ -624,7 +621,11 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			break;
 		case 1:
 			if (!(_gfx->frameCount() & 0x1F)) {
-				// original: check whether file is loaded
+				// We don't really check if the file has finished loading here (which it obviously has),
+				// we just try to emulate the original timing, since the original's delays are not always
+				// sufficient to match the desired total delay correctly.
+				if (!_fio->loadingCompleted())
+					break;
 				state.frameNo = -1;
 				++state.modPhaseSub;
 			}
@@ -700,7 +701,11 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			}
 			break;
 		case 2:
-			//original: check if file loaded
+			// We don't really check if the file has finished loading here (which it obviously has),
+			// we just try to emulate the original timing, since the original's delays are not always
+			// sufficient to match the desired total delay correctly.
+			if (!_fio->loadingCompleted())
+				break;
 			++state.modPhaseSub;
 			break;
 		case 3:


Commit: 72df2131cfc4bd92635bbf36394943ea924e8ea5
    https://github.com/scummvm/scummvm/commit/72df2131cfc4bd92635bbf36394943ea924e8ea5
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: add launcher options dialog

Changed paths:
    engines/snatcher/metaengine.cpp


diff --git a/engines/snatcher/metaengine.cpp b/engines/snatcher/metaengine.cpp
index 40b9d5b8078..6d381007158 100644
--- a/engines/snatcher/metaengine.cpp
+++ b/engines/snatcher/metaengine.cpp
@@ -27,6 +27,8 @@
 #include "common/savefile.h"
 #include "common/translation.h"
 #include "engines/advancedDetector.h"
+#include "gui/ThemeEval.h"
+#include "gui/widgets/popup.h"
 #include "base/plugins.h"
 #include "backends/keymapper/action.h"
 #include "backends/keymapper/keymapper.h"
@@ -52,6 +54,8 @@ public:
 	SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
 	int getAutosaveSlot() const override { return 0; }
 
+	GUI::OptionsContainerWidget *buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const override;
+
 	Common::KeymapArray initKeymaps(const char *target) const override;
 };
 
@@ -166,6 +170,92 @@ SaveStateDescriptor SnatcherMetaEngine::querySaveMetaInfos(const char *target, i
 	return desc;
 }
 
+class SnatcherOptionsWidget : public GUI::OptionsContainerWidget {
+public:
+	SnatcherOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain);
+	void load() override;
+	bool save() override;
+private:
+	void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
+
+	GUI::PopUpWidget *_buttonConfPopup;
+	GUI::CheckboxWidget *_enableLightgunBox;
+	GUI::CheckboxWidget *_monoSoundBox;
+};
+
+GUI::OptionsContainerWidget *SnatcherMetaEngine::buildEngineOptionsWidget(GUI::GuiObject *boss, const Common::String &name, const Common::String &target) const {
+	Common::Platform platform = Common::parsePlatform(ConfMan.get("platform", target));
+
+	switch (platform) {
+	case Common::kPlatformSegaCD:
+		return new SnatcherOptionsWidget(boss, name, target);
+		break;
+	default:
+		break;
+	}
+
+	return MetaEngine::buildEngineOptionsWidget(boss, name, target);
+}
+
+static const char *buttonConfStrings[6] = {
+	_s("A - Draw Blaster, B - Cancel, C - Select/Shoot"),
+	_s("A - Draw Blaster, B - Select/Shoot, C - Cancel"),
+	_s("A - Cancel, B - Draw Blaster, C - Select/Shoot"),
+	_s("A - Cancel, B - Select/Shoot, C - Draw Blaster"),
+	_s("A - Select/Shoot, B - Cancel, C - Draw Blaster"),
+	_s("A - Select/Shoot, B - Draw Blaster, C - Cancel")
+};	
+
+SnatcherOptionsWidget::SnatcherOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain) :
+	OptionsContainerWidget(boss, name, "SnatcherOptionsWidget", domain), _buttonConfPopup(nullptr), _enableLightgunBox(nullptr), _monoSoundBox(nullptr) {
+	GUI::StaticTextWidget *text = new GUI::StaticTextWidget(widgetsBoss(), "SnatcherOptionsWidget.ButtonRemapLabel", _("Buttons Config:"));
+	text->setAlign(Graphics::TextAlign::kTextAlignEnd);
+
+	_buttonConfPopup = new GUI::PopUpWidget(widgetsBoss(), "SnatcherOptionsWidget.ButtonRemapPopup",_("Select Controller Buttons Config"));
+	assert(_buttonConfPopup);
+	for (int i = 0; i < ARRAYSIZE(buttonConfStrings); ++i) {
+		Common::U32String entryLabel = Common::U32String(buttonConfStrings[i]);
+		_buttonConfPopup->appendEntry(entryLabel, i);
+	}
+	_buttonConfPopup->setSelected(0);
+
+	_enableLightgunBox = new GUI::CheckboxWidget(widgetsBoss(), "SnatcherOptionsWidget.EnableLightgunBox", _("Enable Lightgun"), _("Enable lightgun emulation via mouse."));
+	assert(_enableLightgunBox);
+	_monoSoundBox = new GUI::CheckboxWidget(widgetsBoss(), "SnatcherOptionsWidget.MonoSoundBox", _("Mono Sound Mode"), _("Disable stereo sound."));
+	assert(_monoSoundBox);
+}
+
+void SnatcherOptionsWidget::load() {
+	_buttonConfPopup->setSelected(ConfMan.hasKey("controller_conf", _domain) ? ConfMan.getInt("controller_conf", _domain) : 0);
+	_enableLightgunBox->setState(ConfMan.hasKey("lightgun_usage", _domain) && ConfMan.getBool("lightgun_usage", _domain));
+	_monoSoundBox->setState(!ConfMan.hasKey("disable_stereo", _domain) || ConfMan.getBool("disable_stereo", _domain));
+}
+
+bool SnatcherOptionsWidget::save() {
+	ConfMan.setInt("controller_conf", _buttonConfPopup->getSelected(), _domain);
+	ConfMan.setBool("lightgun_usage", _enableLightgunBox->getState(), _domain);
+	ConfMan.setBool("disable_stereo", _monoSoundBox->getState(), _domain);
+	return true;
+}
+
+void SnatcherOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const {
+	layouts.addDialog(layoutName, overlayedLayout)
+		.addLayout(GUI::ThemeLayout::kLayoutVertical)
+			.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+				.addPadding(0, 30, 0, 0)
+				.addWidget("ButtonRemapLabel", "OptionsLabel")
+				.addPadding(10, 0, 0, 0)
+				.addSpace(10)
+				.addWidget("ButtonRemapPopup", "PopupWidget")
+			.closeLayout()
+			.addPadding(0, 0, 10, 0)
+			.addWidget("EnableLightgunBox", "Checkbox")	
+			.addPadding(0, 0, 10, 0)
+			.addWidget("MonoSoundBox", "Checkbox")
+		.closeLayout()
+	.closeDialog();
+}
+
 const char *const kLightGunKeymapName = "snlightgun";
 const char *const kControllerKeymapName = "sncontroller";
 


Commit: 0b6835ac2206a35a77ba03de5b43fbcb6b6aaec0
    https://github.com/scummvm/scummvm/commit/0b6835ac2206a35a77ba03de5b43fbcb6b6aaec0
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix minor palette glitch

Changed paths:
    engines/snatcher/animator_scd.cpp
    engines/snatcher/graphics.cpp


diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index 5a1eefd951b..12b08435a30 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -232,7 +232,7 @@ private:
 	int anim_resumeAndUnsyncOther(AnimObject &a, const uint8 *data);
 	int anim_terminateOther(AnimObject &a, const uint8 *data);
 	int anim_pauseAndHideOther(AnimObject &a, const uint8 *data);
-	int anim_hide(AnimObject &a, const uint8 *data);
+	int anim_break(AnimObject &a, const uint8 *data);
 	int anim_setScriptComFlag(AnimObject &a, const uint8 *data);
 	int anim_audioSync(AnimObject &a, const uint8 *data);
 	int anim_protect(AnimObject &a, const uint8 *data);
@@ -1234,7 +1234,7 @@ void Animator_SCD::makeAnimFunctions() {
 		ANM(resumeAndUnsyncOther),
 		ANM(terminateOther),
 		ANM(pauseAndHideOther),
-		ANM(hide),
+		ANM(break),
 		ANM(setScriptComFlag),
 		ANM(audioSync),
 		ANM(audioSync),
@@ -1398,7 +1398,7 @@ int Animator_SCD::anim_pauseAndHideOther(AnimObject &a, const uint8 *data) {
 	return 1;
 }
 
-int Animator_SCD::anim_hide(AnimObject &a, const uint8 *data) {
+int Animator_SCD::anim_break(AnimObject &a, const uint8 *data) {
 	a.controlFlags |= GraphicsEngine::kAnimHide;
 	return anim_updateFrameDelay(a, data);
 }
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 1f57681af9c..faef76ef46a 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -179,8 +179,8 @@ void GraphicsEngine::updateText() {
 
 void GraphicsEngine::nextFrame() {
 	_palette->processEventQueue();
-	_palette->update();
 	_animator->updateScreen(_screen);
+	_palette->update();
 
 	_system->copyRectToScreen(_screen, _animator->realScreenWidth() * _bpp, 0, 0, _animator->realScreenWidth(), _animator->realScreenHeight());
 	_system->updateScreen();


Commit: 22486923d019d4b58e106ea1157bc803bea12f57
    https://github.com/scummvm/scummvm/commit/22486923d019d4b58e106ea1157bc803bea12f57
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix transition glitch and GMM handling

Changed paths:
    engines/snatcher/resource.cpp
    engines/snatcher/saveload.cpp
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/transition_scd.cpp


diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index d8daf0a7e7f..c40e2c8b276 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -62,8 +62,6 @@ SceneModule *FIO::loadModule(int index) {
 }
 
 uint8 *FIO::fileData(int index, uint32 *fileSize) {
-	if (index > 60)
-		debug("%s(): loading file %s", __FUNCTION__, _resFileList[index]);
 	return (index >= 0 && index < _resFileListSize) ? fileData(_resFileList[index], fileSize) : nullptr;
 }
 
diff --git a/engines/snatcher/saveload.cpp b/engines/snatcher/saveload.cpp
index 69dc897b113..b8c58c9a5b4 100644
--- a/engines/snatcher/saveload.cpp
+++ b/engines/snatcher/saveload.cpp
@@ -188,7 +188,8 @@ bool SaveLoadManager::readSaveHeader(Common::SeekableReadStream *saveFile, SaveH
 	header.td.tm_wday = saveFile->readUint32BE();
 
 	header.totalPlayTime = saveFile->readUint32BE();
-	//header.act = saveFile->readSint16BE();
+	//
+	header.act = //saveFile->readSint16BE();
 	header.saveCount = saveFile->readSint16BE();
 
 	return true;
@@ -212,7 +213,7 @@ void SaveLoadManager::loadState(int slot, GameState &state) {
 	state.modPhaseSub = in->readSint16BE();
 	state.modPhaseTop = in->readSint16BE();
 	state.prologue = in->readSint16BE();
-
+	//
 	uint16 tsize = 0;//in->readUint16BE();
 	if (tsize) {
 		uint8 *tmp = new uint8[tsize];
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 600eed2be85..f8fb33c63e4 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -51,7 +51,7 @@ namespace Snatcher {
 
 SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _scd(nullptr), _gfx(nullptr), _snd(nullptr), _input(),
 	_scriptEngine(nullptr), _cmdQueue(nullptr), _aseq(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _enableLightGun(false), _ui(nullptr), _gfxInfo(), _saveMan(nullptr), _reset(0),
-		_memHandler(nullptr), _frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
+		_updateGameSettings(false), _memHandler(nullptr), _frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
 	assert(system);
 }
 
@@ -289,9 +289,13 @@ bool SnatcherEngine::start() {
 
 		_saveMan->handleSaveLoad(state);
 
+		if (_updateGameSettings) {
+			_updateGameSettings = false;
+			_saveMan->loadSettings(state.conf);
+		}
+
 		_gfx->nextFrame();
 		_snd->update();
-		delayUntil(nextFrame);
 
 		if (state.modPhaseTop == 5) {
 			playTimer += _frameLen;
@@ -302,6 +306,8 @@ bool SnatcherEngine::start() {
 		}
 		if (_reset)
 			--_reset;
+
+		delayUntil(nextFrame);
 	}
 
 	return true;
@@ -775,6 +781,10 @@ void SnatcherEngine::syncSoundSettings() {
 	_snd->setSoundEffectVolume(volSFX);
 }
 
+void SnatcherEngine::applyGameSettings() {
+	_updateGameSettings = true;
+}
+
 void SnatcherEngine::pauseEngineIntern(bool pause) {
 	_snd->pause(pause);
 }
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index 02ddd3b1c11..61d95557ecb 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -80,6 +80,8 @@ private:
 
 	// ConfigManager sync
 	void syncSoundSettings() override;
+	void applyGameSettings() override;
+	bool _updateGameSettings;
 
 	// GMM, Save, Load
 	void pauseEngineIntern(bool pause) override;
diff --git a/engines/snatcher/transition_scd.cpp b/engines/snatcher/transition_scd.cpp
index 625cd221df9..bf5124a32ef 100644
--- a/engines/snatcher/transition_scd.cpp
+++ b/engines/snatcher/transition_scd.cpp
@@ -189,6 +189,7 @@ private:
 	typedef Common::Functor1Mem<Graphics::SegaRenderer*, void, TransitionManager_SCD> HINTFunc;
 	Common::Array<HINTFunc*> _hINTProcs;
 	const HINTFunc *_hINTHandler;
+	const HINTFunc *_hINTHandlerNext;
 
 	void setHINTHandler(uint8 num);
 
@@ -210,9 +211,10 @@ private:
 	void hIntHandler_videoPhoneCallEnd2(Graphics::SegaRenderer *sr);
 };
 
-TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0), _transitionStep(0),
-	_trsCommandExt(0), _trsCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _lineScrollOpState(0), _lineScrollTimer1(0), _lineScrollTimer2(0), _lineScrollTimer3(0), _lineScrollTimer4(0),
-		_lineScrollTimer5(0), _trs__DB(0), _lineScrollOp(0), _restoreDlgTab(0), _transitionType(0), _transitionState(0), _transitionState2(0), _tmpScrollOffset(0), _subPara(0), _useEngineScrollOffsets(false), _hINTHandler(nullptr) {
+TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0),
+	_transitionStep(0), _trsCommandExt(0), _trsCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _lineScrollOpState(0), _lineScrollTimer1(0),
+		_lineScrollTimer2(0), _lineScrollTimer3(0), _lineScrollTimer4(0), _lineScrollTimer5(0), _trs__DB(0), _lineScrollOp(0), _restoreDlgTab(0), _transitionType(0), _transitionState(0),
+			_transitionState2(0), _tmpScrollOffset(0), _subPara(0), _useEngineScrollOffsets(false), _hINTHandler(nullptr), _hINTHandlerNext(nullptr) {
 	_internalState = new ScrollInternalState[4];
 	assert(_internalState);
 	_internalState[kVertA].setFactor(-1);
@@ -225,6 +227,7 @@ TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) :
 TransitionManager_SCD::~TransitionManager_SCD() {
 	delete[] _internalState;
 	delete[] _hScrollTable;
+	_hINTHandler = _hINTHandlerNext = nullptr;
 	for (Common::Array<TrsFunc*>::const_iterator i = _trsProcs.begin(); i != _trsProcs.end(); ++i)
 		delete *i;
 	for (Common::Array<HINTFunc*>::const_iterator i = _hINTProcs.begin(); i != _hINTProcs.end(); ++i)
@@ -412,6 +415,7 @@ void TransitionManager_SCD::processTransition() {
 	}
 	_result.hInt.enable = true;
 	_result.hInt.needUpdate = true;
+	_hINTHandler = _hINTHandlerNext;
 }
 
 void TransitionManager_SCD::resetVars(int groupFlags) {
@@ -1028,7 +1032,7 @@ void TransitionManager_SCD::textScreenTrsUpdate(int type, int hIntHandlerNo, int
 
 void TransitionManager_SCD::setHINTHandler(uint8 num) {
 	if (num < _hINTProcs.size())
-		_hINTHandler = _hINTProcs[num];
+		_hINTHandlerNext = _hINTProcs[num];
 	 else
 		error("%s(): Invalid HINT handler %d", __FUNCTION__, num);
 	if (num == 28)


Commit: 5e694185274a4f2cdebe645b4a257add92efe5e9
    https://github.com/scummvm/scummvm/commit/5e694185274a4f2cdebe645b4a257add92efe5e9
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: minor pcm cache adjust

Changed paths:
    engines/snatcher/sound_device_scd.cpp


diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
index 0d350525854..631fd31e85b 100644
--- a/engines/snatcher/sound_device_scd.cpp
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -137,7 +137,7 @@ private:
 		uint32 dataSize;
 	};
 	Common::Array<PCMCacheEntry> _pcmCache;
-	SmpStrPtr createSamplesStream(uint32 addr);
+	SmpStrPtr getSamplesStream(uint32 addr);
 
 	struct PCMResourceInfo {
 		uint8 prio;
@@ -2039,7 +2039,7 @@ bool SegaSoundDevice::pcmLoadData() {
 		if (i == 6 || i == 8 || i == 9 || i == 10)
 			continue;
 
-		SmpStrPtr str = createSamplesStream(_pcmResidentDataInfo[i].addr + 0x10);
+		SmpStrPtr str = getSamplesStream(_pcmResidentDataInfo[i].addr + 0x10);
 		int64 sz = str->size() - 1;
 		uint8 *smp = new uint8[sz + 2]();
 		str->read(smp, sz);
@@ -2168,12 +2168,15 @@ void SegaSoundDevice::pcmDelayedStart() {
 	_pcmState &= ~4;
 }
 
-SegaSoundDevice::SmpStrPtr SegaSoundDevice::createSamplesStream(uint32 addr) {
+SegaSoundDevice::SmpStrPtr SegaSoundDevice::getSamplesStream(uint32 addr) {
 	uint32 numSamples = 0;
 
-	for (Common::Array<PCMCacheEntry>::const_iterator i = _pcmCache.begin(); i != _pcmCache.end(); ++i) {
-		if (i->addr == addr && i->resNo == _pcmResourceNumber)
-			return SmpStrPtr(new Common::MemoryReadStream(i->data.get(), i->dataSize, DisposeAfterUse::NO));
+	for (Common::Array<PCMCacheEntry>::iterator i = _pcmCache.begin(); i != _pcmCache.end(); ++i) {
+		if (i->addr != addr || i->resNo != _pcmResourceNumber)
+			continue;
+		_pcmCache.push_back(*i);
+		_pcmCache.erase(i);
+		return SmpStrPtr(new Common::MemoryReadStream(_pcmCache.back().data.get(), _pcmCache.back().dataSize, DisposeAfterUse::NO));
 	}
 
 	Common::SeekableReadStream *str = _fio->readStream(addr < 0x65000 ? 54 : 55);
@@ -2225,7 +2228,7 @@ void SegaSoundDevice::pcmResetUnit(uint8 unit, PCMSound &s) {
 }
 
 void SegaSoundDevice::pcmStartSoundInternal(uint8 unit, uint8 chan, PCMSound &s) {
-	SmpStrPtr smp = createSamplesStream(s.addr);
+	SmpStrPtr smp = getSamplesStream(s.addr);
 	_sai->playPCMStream(smp, chan << 5, 0x2000, chan, s.rate, calcPan(s), calcVolume(unit, s));
 }
 


Commit: 6973209d8d5cd03de6e7a16d732883e0e3143141
    https://github.com/scummvm/scummvm/commit/6973209d8d5cd03de6e7a16d732883e0e3143141
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: minor fixes and cleanup

Changed paths:
    engines/snatcher/animator_scd.cpp
    engines/snatcher/palette_scd.cpp
    engines/snatcher/text_scd.cpp
    engines/snatcher/util.cpp
    engines/snatcher/util.h


diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index 12b08435a30..a1257d43322 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -40,7 +40,7 @@ namespace Snatcher {
 //#define		ANIM_DEBUG
 
 struct AnimObject {
-	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), palette(0), target(0), f18(0), f1c(0),
+	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), palette(0), target(0), ovrTile(0), f1c(0),
 		timeStamp(0), phase(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), actionTimer(0), spriteTableLocation(0),
 			res(), scriptData(), spriteData(nullptr), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), scriptComFlags(0), freeze(0), blink(0), blinkCounter(0), blinkDuration(0) {}
 
@@ -49,7 +49,7 @@ struct AnimObject {
 		posX = posY = 0;
 		relSpeedX = relSpeedY = 0;
 		palette = 0;
-		target = f18 = 0;
+		target = ovrTile = 0;
 		f1c = 0;
 		timeStamp = 0;
 		phase = 0;
@@ -76,7 +76,7 @@ struct AnimObject {
 	int32 relSpeedY;
 	uint8 palette;
 	uint16 target;
-	uint16 f18;
+	uint16 ovrTile;
 	uint8 f1c;
 	uint32 timeStamp;
 	uint8 phase;
@@ -596,8 +596,8 @@ void Animator_SCD::setAnimParameter(uint8 animObjId, int param, int32 value) {
 	case GraphicsEngine::kAnimParaTarget:
 		a.target = value;
 		break;
-	case GraphicsEngine::kAnimParaF18:
-		a.f18 = value;
+	case GraphicsEngine::kAnimParaOvrTile:
+		a.ovrTile = value;
 		break;
 	case GraphicsEngine::kAnimParaF1c:
 		a.f1c = value;
@@ -683,8 +683,8 @@ int32 Animator_SCD::getAnimParameter(uint8 animObjId, int param) const {
 		return a.palette;
 	case GraphicsEngine::kAnimParaTarget:
 		return a.target;
-	case GraphicsEngine::kAnimParaF18:
-		return a.f18;
+	case GraphicsEngine::kAnimParaOvrTile:
+		return a.ovrTile;
 	case GraphicsEngine::kAnimParaF1c:
 		return a.f1c;
 	case GraphicsEngine::kAnimParaTimeStamp:
@@ -1027,7 +1027,7 @@ void Animator_SCD::generateSpriteData(AnimObject &a, uint16 &spritesCurIndex, ui
 	}
 
 	uint16 flip = (a.drawFlags & 3) << 11;
-	uint16 p = ((a.f18 & 4) << 13) | ((a.f18 & 0xF8) >> 3);
+	uint16 p = ((a.ovrTile & 4) << 13) | ((a.ovrTile & 0xF8) >> 3);
 
 	for (int i = 0; i < num && spritesCurIndex < 65; ++i) {
 		int16 origY = FROM_BE_16(*in++);
@@ -1587,39 +1587,26 @@ void Animator_SCD::anim_setGroupParameter(AnimObject &a, int para, int16 val, bo
 
 void Animator_SCD::createMouseCursor() {
 	static const uint8 mouseCursorData[] = {
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
-		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-		0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+		0x02, 0xd9, 0x98, 0x00, 0x00, 0x00, 0x93, 0x03, 0x06, 0x00, 0xff, 0x0a, 0x0e, 0xc7, 0x18, 0x1b, 0x1d, 0x36, 0x04,
+		0x4f, 0xff, 0xff, 0xff, 0x12, 0x53, 0x01, 0x16, 0xff, 0x00, 0x6c, 0x0f, 0x1d, 0x03, 0x2f, 0x02, 0x87, 0x0c, 0x3a,
+		0x04, 0x9b, 0x04, 0xa2, 0x09, 0xa9, 0xff, 0x0d, 0xb5, 0x08, 0xc5, 0x17, 0x1b, 0x0f, 0xea, 0x06, 0xfc, 0x2f, 0x05,
+		0x25, 0x17, 0x11, 0x3f, 0xff, 0x0b, 0x98, 0x0e, 0x64, 0x22, 0x03, 0x04, 0xd6, 0x21, 0x0f, 0x26, 0x17, 0x22, 0x19,
+		0x11, 0x90, 0xff, 0x1c, 0x51, 0x1d, 0xbd, 0x17, 0xd8, 0x3d, 0x29, 0x49, 0x0a, 0x30, 0x60, 0x0e, 0xe9, 0x23, 0xe2,
+		0xff, 0x35, 0xb0, 0x02, 0xfc, 0x34, 0xe6, 0x5a, 0x1c, 0x33, 0x9e, 0x38, 0xb9, 0x34, 0xd4, 0x1f
 	};
 
 	static const uint8 palData[] = { 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF };
 
+	uint16 len = READ_BE_UINT16(mouseCursorData);
+	uint8 *tmp = new uint8[len];
+	assert(tmp);
+	if (len != Util::decodeSCDData(mouseCursorData + 2, tmp))
+		error("%s(): Decode size mismatch", __FUNCTION__);
+
 	CursorMan.replaceCursorPalette(palData, 254, 2);
-	CursorMan.replaceCursor(mouseCursorData, 27, 27, 13, 13, 0);
+	CursorMan.replaceCursor(tmp, 27, 27, 13, 13, 0);
+
+	delete[] tmp;
 }
 
 // Boot logo sequence code. This has nothing to do with the engine graphics code, so I put it at the end, to keep the ugly mess out of sight...
diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index 1dd06ed3e68..f1229bd31d3 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -88,7 +88,8 @@ private:
 	Common::Array<HINTFunc*> _hINTProcs;
 	const HINTFunc *_hINTHandler;
 
-	void setHINTHandler(uint8 num);
+	void setHINTHandler(int8 num);
+	bool isValidHINTHandler() const { return _hINTHandler != nullptr && _hINTHandler->isValid(); }
 
 	void hIntHandler_dummy(Graphics::SegaRenderer*) {}
 	void hIntHandler_characterChatPortraitPalette(Graphics::SegaRenderer *sr);
@@ -258,14 +259,17 @@ void SCDPalette::update() {
 		return;
 
 	if (_gfxState.getVar(11) == 0xFF) {
-		_gfxState.setFlag(7, 0);
+		if (isValidHINTHandler()) {
+			_gfxState.setFlag(7, 0);
+			setHINTHandler(-1);
+		}
 		_gfxState.setVar(11, 0);
 	} else if (_gfxState.getVar(11)) {
 		setHINTHandler(0);
 	}
 
 	bool palChanged = false;
-	if (_gfxState.testFlag(7, 0) || _gfxState.getVar(11)) {
+	if (_gfxState.testFlag(7, 0) || (_gfxState.getVar(11))) {
 		Common::copy<const uint16*, uint16*>(_colors, &_colors[64], _colors2);
 		palChanged = true;
 	}
@@ -289,7 +293,7 @@ void SCDPalette::update() {
 
 void SCDPalette::hINTCallback(void *segaRenderer) {
 	Graphics::SegaRenderer *sr = static_cast<Graphics::SegaRenderer*>(segaRenderer);
-	if (_gfxState.getVar(11) && _hINTHandler && _hINTHandler->isValid()) {
+	if (_gfxState.getVar(11) && isValidHINTHandler()) {
 		(*_hINTHandler)(sr);
 		updateSystemPalette();
 		sr->setRenderColorTable(_sysPalette, 0, 64);
@@ -493,10 +497,12 @@ void SCDPalette::fadeStep(uint16 *modColor, uint16 toR, uint16 toG, uint16 toB)
 	*modColor = (r | g | b);
 }
 
-void SCDPalette::setHINTHandler(uint8 num) {
-	if (num < _hINTProcs.size())
+void SCDPalette::setHINTHandler(int8 num) {
+	if (num < 0)
+		_hINTHandler = nullptr;
+	else if (num < _hINTProcs.size())
 		_hINTHandler = _hINTProcs[num];
-	 else
+	else
 		error("%s(): Invalid HINT handler %d", __FUNCTION__, num);
 	_transitionStep = 0;
 }
diff --git a/engines/snatcher/text_scd.cpp b/engines/snatcher/text_scd.cpp
index 21488f8a67e..f0af855f8e5 100644
--- a/engines/snatcher/text_scd.cpp
+++ b/engines/snatcher/text_scd.cpp
@@ -48,7 +48,7 @@ private:
 	bool _block;
 	uint16 _curX;
 	uint16 _curY;
-	bool _fixedWith9;
+	bool _fixedWidth9;
 	uint16 _printDelay;
 	uint16 _printDelayCounter;
 	uint8 _color;
@@ -66,7 +66,7 @@ private:
 };
 
 TextRenderer_SCD::TextRenderer_SCD(Animator *animator) : TextRenderer(), _animator(animator), _textPtr(nullptr), _needDraw(false), _block(false), _printDelay(0), _printDelayCounter(0), _color(0),
-	_curX(0), _curY(0), _fixedWith9(false), _font(nullptr), _fontSize(0), _charWidthTable(nullptr), _charWidthTableSize(0), _pscr_byt8(0), _pscr_wd(0), _pscr_byt1(0), _pscr_byt2(0), _pscr_byt3(0) {
+	_curX(0), _curY(0), _fixedWidth9(false), _font(nullptr), _fontSize(0), _charWidthTable(nullptr), _charWidthTableSize(0), _pscr_byt8(0), _pscr_wd(0), _pscr_byt1(0), _pscr_byt2(0), _pscr_byt3(0) {
 }
 
 TextRenderer_SCD::~TextRenderer_SCD() {
@@ -142,7 +142,7 @@ void TextRenderer_SCD::draw() {
 					s += 2;
 					break;
 				case 0xF7:
-					_fixedWith9 = *s++ ? true : false;
+					_fixedWidth9 = *s++ ? true : false;
 					break;
 				default:
 					if (in < 32) {
@@ -155,7 +155,7 @@ void TextRenderer_SCD::draw() {
 
 						drawGlyph(in);
 
-						if (_fixedWith9) {
+						if (_fixedWidth9) {
 							_curX += 9;
 						} else {
 							if (in < _charWidthTableSize)
@@ -177,7 +177,7 @@ void TextRenderer_SCD::draw() {
 
 void TextRenderer_SCD::drawGlyph(uint16 ch) {
 	uint16 x = _curX;
-	if (_fixedWith9 && (ch == 17 || ch == 41))
+	if (_fixedWidth9 && (ch == 17 || ch == 41))
 		++x;
 
 	const uint8 *src = _font + (ch << 3);
diff --git a/engines/snatcher/util.cpp b/engines/snatcher/util.cpp
index 6e670d1309e..c020dfd58fc 100644
--- a/engines/snatcher/util.cpp
+++ b/engines/snatcher/util.cpp
@@ -24,6 +24,8 @@
 #include "common/textconsole.h"
 #include "snatcher/util.h"
 
+#include "common/array.h"
+
 namespace Snatcher {
 namespace Util {
 
@@ -83,6 +85,10 @@ uint8 toBCD(uint8 v) {
 	return (v / 10) << 4 | (v % 10);
 }
 
+uint8 fromBCD(uint8 v) {
+	return (v >> 4) * 10 + (v & 0x0F);
+}
+
 uint32 makeBCDTimeStamp(uint32 msecs, BCDResolution res) {
 	uint32 hrs = toBCD((msecs / 3600000) % 24);
 	uint32 min = toBCD((msecs / 60000) % 60);
@@ -96,6 +102,25 @@ uint32 makeBCDTimeStamp(uint32 msecs, BCDResolution res) {
 	return ((min & 0xFF) << 24) | ((sec & 0xFF) << 16) | ((frm & 0xFF) << 8);
 }
 
+uint32 decodeBCDTimeStamp(uint32 bcdTime, BCDResolution res) {
+	bcdTime >>= 8;
+	uint32 r = 0;
+
+	if (res == kBCD_MMSSFR) {
+		r += (fromBCD(bcdTime) * 27) / 2;
+		bcdTime >>= 8;
+	}
+	r += (fromBCD(bcdTime) * 1000);
+	bcdTime >>= 8;
+	r += (fromBCD(bcdTime) * 60000);
+	bcdTime >>= 8;
+
+	if (res == kBCD_HHMMSS)
+		r += (fromBCD(bcdTime) * 3600000);
+
+	return r;
+}
+
 union RNDC {
 	uint8 a[2];
 	uint16 b;
diff --git a/engines/snatcher/util.h b/engines/snatcher/util.h
index e152dc029aa..c5f9c924c8f 100644
--- a/engines/snatcher/util.h
+++ b/engines/snatcher/util.h
@@ -36,6 +36,7 @@ enum BCDResolution {
 };
 
 extern uint32 makeBCDTimeStamp(uint32 msecs, BCDResolution res);
+extern uint32 decodeBCDTimeStamp(uint32 bcdTime, BCDResolution res);
 extern uint8 toBCD(uint8 v);
 
 extern void rngReset();


Commit: e4c2a3373eb0939236b5d49ca603650cd716caa1
    https://github.com/scummvm/scummvm/commit/e4c2a3373eb0939236b5d49ca603650cd716caa1
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix savegame handling

- fix scripted saves (via Metal Gear)
- limit saving to situations where it can be technically supported
currently (I have experimented with extending this to as many
locations as possible, but it would require a full state save, including
the vram and pcm ram, which would make the savefiles much much
larger. Maybe it'll be added at some point...

Changed paths:
  A engines/snatcher/saveflags.h
    engines/snatcher/action.cpp
    engines/snatcher/action.h
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/saveload.cpp
    engines/snatcher/saveload.h
    engines/snatcher/script.cpp
    engines/snatcher/script.h
    engines/snatcher/snatcher.cpp
    engines/snatcher/sound.cpp
    engines/snatcher/sound.h
    engines/snatcher/sound_device.h
    engines/snatcher/sound_device_scd.cpp
    engines/snatcher/state.h
    engines/snatcher/transition.h
    engines/snatcher/transition_scd.cpp
    engines/snatcher/ui.cpp
    engines/snatcher/ui.h


diff --git a/engines/snatcher/action.cpp b/engines/snatcher/action.cpp
index b039b5a3cad..2e562d8d149 100644
--- a/engines/snatcher/action.cpp
+++ b/engines/snatcher/action.cpp
@@ -294,6 +294,10 @@ void ActionSequenceHandler::setDifficulty(uint16 setting) {
 	_enemySpeed = setting;
 }
 
+bool ActionSequenceHandler::canSaveHere() const {
+	return !_active;
+}
+
 void ActionSequenceHandler::resetVars() {
 	_weaponState = 0;
 	_handleShotPhase = 0;
diff --git a/engines/snatcher/action.h b/engines/snatcher/action.h
index b5b80686739..9e10118bf01 100644
--- a/engines/snatcher/action.h
+++ b/engines/snatcher/action.h
@@ -56,6 +56,8 @@ public:
 
 	const Result &getResult() const { return _result; }
 
+	bool canSaveHere() const;
+
 private:
 	void resetVars();
 	void initStage();
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index faef76ef46a..598e3b9b80c 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -27,6 +27,7 @@
 #include "snatcher/text.h"
 #include "snatcher/transition.h"
 #include "common/endian.h"
+#include "common/ptr.h"
 #include "common/stream.h"
 #include "common/system.h"
 #include "graphics/pixelformat.h"
@@ -34,7 +35,7 @@
 namespace Snatcher {
 
 GraphicsEngine::GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate, SoundEngine *snd, bool enableAspectRatioCorrection) :
-	_system(system), _state(vmstate), _animator(nullptr), _text(nullptr), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _verbAreaType(0) {
+	_system(system), _state(vmstate), _animator(nullptr), _text(nullptr), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _verbAreaType(0), _animSaveLoadData(nullptr), _animSaveLoadDataExt() {
 	assert(system);
 	_palette = Palette::create(pxf, _system->getPaletteManager(), platform, _state);
 	assert(_palette);
@@ -273,19 +274,28 @@ uint16 GraphicsEngine::frameCount() const {
 	return _state.frameCount();
 }
 
-void GraphicsEngine::loadState(Common::SeekableReadStream *in, bool onlyTempData) {
+void GraphicsEngine::loadState(Common::SeekableReadStream *in, SaveFlags flags) {
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
 	in->read(_animSaveLoadData, 64);
 
-	if (onlyTempData)
+	if (flags & (kSaveFlagsTempData/* | kSaveFlagsScriptedSave*/))
 		return;
 
-	//for (int i = 0; i < 13; ++i)
-	//	_state.setVar(i, in->readByte());
+	//uint16 size = in->readSint16BE();
+	//uint8 *data = new uint8[size]();
+	//assert(data);
+	//in->read(data, size);
+	//_animSaveLoadDataExt = Common::SharedPtr<const uint8>(data, Common::ArrayDeleter<const uint8>());
+	_animSaveLoadDataExt = true;
+
+	for (int i = 0; i < 13; ++i)
+		_state.setVar(i, in->readByte());
+
+	_trs->loadState(in);
 }
 
-void GraphicsEngine::saveState(Common::SeekableWriteStream *out, bool onlyTempData) {
+void GraphicsEngine::saveState(Common::SeekableWriteStream *out, SaveFlags flags) {
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
 	for (int i = 0; i < 64; ++i) {
 		uint8 v = 0;
@@ -307,11 +317,83 @@ void GraphicsEngine::saveState(Common::SeekableWriteStream *out, bool onlyTempDa
 	}
 	out->write(_animSaveLoadData, 64);
 
-	if (onlyTempData)
+	if (flags & (kSaveFlagsTempData /* | kSaveFlagsScriptedSave*/))
 		return;
 
+	/* int count = 0;
+	for (int i = 0; i < 64; ++i) {
+		if (_animSaveLoadData[i])
+			++count;
+	}
+	uint8 *data = new uint8[count * 29]();
+	uint8 *d = data;
+
+	for (int i = 0; i < 64; ++i) {
+		if (_animSaveLoadData[i] == 0)
+			continue;
+
+		uint8 v = (getAnimParameter(i, kAnimParaScriptComFlags) & 2) >> 1;
+		v |= getAnimParameter(i, kAnimParaDrawFlags) << 1;
+		v |= (getAnimParameter(i, kAnimFreezeFlag) ? 0x20 : 0);
+		*d++ = v;
+
+		uint16 b = getAnimParameter(i, kAnimParaPosX);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaPosY);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaRelSpeedX);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaRelSpeedY);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+
+		v = getAnimParameter(i, kAnimParaOvrTile) & 0xFC;
+		uint8 v2 = (getAnimParameter(i, kAnimParaPhase) & 0xF3);
+		b = ((v2 & 0xF0) << 8) | (v2 & 0x0F) | v;
+		v = getAnimParameter(i, kAnimParaPalette) & 0x83;
+		b |= (((v & 0x80) << 4) | ((v & 0x03) << 9));
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+
+		b = getAnimParameter(i, kAnimParaTarget);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		v = getAnimParameter(i, kAnimParaF1c);
+		*d++ = v;
+
+		uint32 t = getAnimParameter(i, kAnimParaTimeStamp);
+		WRITE_BE_UINT32(d, t);
+		d += 4;
+		v = getAnimParameter(i, kAnimParaFrameSeqCounter);
+		*d++ = v;
+		b = getAnimParameter(i, kAnimParaFrame);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaFrameDelay);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaActionTimer);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaAbsSpeedX);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaAbsSpeedY);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+	}
+
+	out->writeUint16BE(d - data);
+	out->write(data, d - data);
+	delete[] data;*/
+
 	for (int i = 0; i < 13; ++i)
 		out->writeByte(_state.getVar(i));
+
+	_trs->saveState(out);
 }
 
 void GraphicsEngine::postLoadProcess() {
@@ -335,6 +417,59 @@ void GraphicsEngine::postLoadProcess() {
 			setAnimParameter(i, kAnimParaScriptComFlags, getAnimParameter(i, kAnimParaScriptComFlags) & ~1);
 		setAnimParameter(i, kAnimParaAllowFrameDrop, (v & 0x20) ? 1 : 0);
 	}
+
+	if (!(_animSaveLoadDataExt))
+		return;
+
+	/* if (_animSaveLoadDataExt == nullptr)
+		return;
+
+	 const uint8 *s = _animSaveLoadDataExt.get();
+	for (int i = 0; i < 64; ++i) {
+		if (_animSaveLoadData[i] == 0)
+			continue;
+
+		uint16 v = *s++;
+		setAnimParameter(i, kAnimParaScriptComFlags, getAnimParameter(i, kAnimParaScriptComFlags) | ((v & 1) << 1));
+		setAnimParameter(i, kAnimParaDrawFlags, (v & 0x1E) >> 1);
+		setAnimParameter(i, kAnimFreezeFlag, (v & 0x20) >> 5);
+
+		setAnimParameter(i, kAnimParaPosX, READ_BE_INT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaPosY, READ_BE_INT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaRelSpeedX, READ_BE_INT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaRelSpeedY, READ_BE_INT16(s));
+		s += 2;
+
+		v = READ_BE_INT16(s);
+		s += 2;
+		setAnimParameter(i, kAnimParaOvrTile, v & 0xFC);
+		setAnimParameter(i, kAnimParaPhase, ((v >> 8) & 0xF0) | (v & 3));
+		setAnimParameter(i, kAnimParaPalette, ((v >> 4) & 0x80) | ((v >> 9) & 0x03));
+
+		setAnimParameter(i, kAnimParaTarget, READ_BE_UINT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaF1c, *s++);
+		setAnimParameter(i, kAnimParaTimeStamp, READ_BE_UINT32(s));
+		s += 4;
+		setAnimParameter(i, kAnimParaFrameSeqCounter, *s++);
+		setAnimParameter(i, kAnimParaFrame, READ_BE_UINT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaFrameDelay, READ_BE_UINT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaActionTimer, READ_BE_UINT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaAbsSpeedX, READ_BE_INT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaAbsSpeedY, READ_BE_INT16(s));
+		s += 2;
+	}
+
+	_animSaveLoadDataExt.reset();*/
+
+	_trs->postLoadProcess();
 }
 
 void GraphicsEngine::createMouseCursor() {
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 947c2739994..08e6f539512 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -26,6 +26,7 @@
 #include "common/platform.h"
 #include "snatcher/info.h"
 #include "snatcher/resource.h"
+#include "snatcher/saveflags.h"
 
 class OSystem;
 
@@ -107,7 +108,7 @@ public:
 		kAnimParaRelSpeedY,
 		kAnimParaPalette,
 		kAnimParaTarget,
-		kAnimParaF18,
+		kAnimParaOvrTile,
 		kAnimParaF1c,
 		kAnimParaTimeStamp,
 		kAnimParaPhase,
@@ -150,8 +151,8 @@ public:
 	bool busy(int type) const;
 	uint16 frameCount() const;
 
-	void loadState(Common::SeekableReadStream *in, bool onlyTempData);
-	void saveState(Common::SeekableWriteStream *out, bool onlyTempData);
+	void loadState(Common::SeekableReadStream *in, SaveFlags flags);
+	void saveState(Common::SeekableWriteStream *out, SaveFlags flags);
 	void postLoadProcess();
 
 	void createMouseCursor();
@@ -226,6 +227,8 @@ private:
 	uint8 _verbAreaType;
 
 	uint8 *_animSaveLoadData;
+	//Common::SharedPtr<const uint8> _animSaveLoadDataExt;
+	bool _animSaveLoadDataExt;
 
 	uint8 *_screen;
 	Animator *_animator;
diff --git a/engines/snatcher/saveflags.h b/engines/snatcher/saveflags.h
new file mode 100644
index 00000000000..0d9885c59cb
--- /dev/null
+++ b/engines/snatcher/saveflags.h
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#ifndef SNATCHER_SAVEFLAGS_H
+#define SNATCHER_SAVEFLAGS_H
+
+namespace Snatcher {
+
+enum SaveFlags : int {
+	kSaveFlagsNone			=	0,
+	kSaveFlagsTempData		=	1 << 0,
+	kSaveFlagsScriptedSave	=	1 << 1
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_SAVEFLAGS_H
diff --git a/engines/snatcher/saveload.cpp b/engines/snatcher/saveload.cpp
index b8c58c9a5b4..6279bb893e6 100644
--- a/engines/snatcher/saveload.cpp
+++ b/engines/snatcher/saveload.cpp
@@ -41,7 +41,7 @@
 
 namespace Snatcher {
 
-SaveLoadManager::SaveLoadManager(SnatcherEngine *vm) : _vm(vm), _pendingSaveLoad(0), _enableSaving(true), _tryLoadFromLauncher(true), _desc() {
+SaveLoadManager::SaveLoadManager(SnatcherEngine *vm) : _vm(vm), _pendingSaveLoad(0), _pendingSaveFlags(kSaveFlagsNone), _enableSaving(true), _tryLoadFromLauncher(true), _desc() {
 	ConfMan.registerDefault("controller_conf", 0);
 	ConfMan.registerDefault("disable_stereo", false);
 	ConfMan.registerDefault("lightgun_usage", false);
@@ -103,9 +103,11 @@ void SaveLoadManager::requestLoad(int slot) {
 	_pendingSaveLoad = slot + 1;
 }
 
-void SaveLoadManager::requestSave(int slot, const Common::String &desc) {
+void SaveLoadManager::requestSave(int slot, const Common::String &desc, bool scriptedSave) {
 	_pendingSaveLoad = -(slot + 1);
 	_desc = desc;
+	if (scriptedSave)
+		_pendingSaveFlags = kSaveFlagsScriptedSave;
 }
 
 void SaveLoadManager::handleSaveLoad(GameState &state) {
@@ -114,8 +116,9 @@ void SaveLoadManager::handleSaveLoad(GameState &state) {
 	else if (_pendingSaveLoad > 0)
 		loadState(_pendingSaveLoad - 1, state);
 	else if (_pendingSaveLoad < 0)
-		saveState(-_pendingSaveLoad - 1, state);
+		saveState(-_pendingSaveLoad - 1, state, _pendingSaveFlags);
 	state.pendingSaveLoad = _pendingSaveLoad = 0;
+	_pendingSaveFlags = kSaveFlagsNone;
 }
 
 bool SaveLoadManager::isSaveSlotUsed(int16 slot) const {
@@ -131,8 +134,8 @@ bool SaveLoadManager::isSaveSlotUsed(int16 slot) const {
 	return true;
 }
 
-bool SaveLoadManager::isSavingEnabled() const {
-	return _enableSaving;
+bool SaveLoadManager::canSaveHere() const {
+	return _enableSaving && _tempState == nullptr;
 }
 
 void SaveLoadManager::enableSaving(bool enable) {
@@ -141,10 +144,10 @@ void SaveLoadManager::enableSaving(bool enable) {
 
 void SaveLoadManager::saveTempState(Script &script) {
 	Common::MemoryWriteStreamDynamic out(DisposeAfterUse::NO);
-	_vm->_scriptEngine->saveState(&out, script, true);
-	_vm->gfx()->saveState(&out, true);
-	_vm->sound()->saveState(&out);
-	_vm->_ui->saveState(&out);
+	_vm->_scriptEngine->saveState(&out, script, kSaveFlagsTempData);
+	_vm->gfx()->saveState(&out, kSaveFlagsTempData);
+	_vm->sound()->saveState(&out, kSaveFlagsTempData);
+	_vm->_ui->saveState(&out, kSaveFlagsTempData);
 	_tempState = Common::SharedPtr<Common::MemoryReadStream>(new Common::MemoryReadStream(out.getData(), out.size(), DisposeAfterUse::YES));
 }
 
@@ -152,10 +155,11 @@ void SaveLoadManager::restoreTempState(Script &script) {
 	Common::MemoryReadStream *m = _tempState.get();
 	assert(m != nullptr);
 	m->seek(0);
-	_vm->_scriptEngine->loadState(m, script, true);
-	_vm->gfx()->loadState(m, true);
-	_vm->sound()->loadState(m);
-	_vm->_ui->loadState(m);
+	_vm->_scriptEngine->loadState(m, script, kSaveFlagsTempData);
+	_vm->gfx()->loadState(m, kSaveFlagsTempData);
+	_vm->sound()->loadState(m, kSaveFlagsTempData);
+	_vm->_ui->loadState(m, kSaveFlagsTempData);
+	_tempState.reset();
 }
 
 Common::String SaveLoadManager::getSavegameFilename(int slot, const Common::String target) {
@@ -188,8 +192,7 @@ bool SaveLoadManager::readSaveHeader(Common::SeekableReadStream *saveFile, SaveH
 	header.td.tm_wday = saveFile->readUint32BE();
 
 	header.totalPlayTime = saveFile->readUint32BE();
-	//
-	header.act = //saveFile->readSint16BE();
+	header.act = saveFile->readSint16BE();
 	header.saveCount = saveFile->readSint16BE();
 
 	return true;
@@ -213,19 +216,24 @@ void SaveLoadManager::loadState(int slot, GameState &state) {
 	state.modPhaseSub = in->readSint16BE();
 	state.modPhaseTop = in->readSint16BE();
 	state.prologue = in->readSint16BE();
-	//
-	uint16 tsize = 0;//in->readUint16BE();
+
+	SaveFlags flags = kSaveFlagsNone;
+	if (in->readByte())
+		flags = kSaveFlagsScriptedSave;
+
+	uint16 tsize = in->readUint16BE();
 	if (tsize) {
 		uint8 *tmp = new uint8[tsize];
 		in->read(tmp, tsize);
 		_tempState = Common::SharedPtr<Common::MemoryReadStream>(new Common::MemoryReadStream(tmp, tsize, DisposeAfterUse::YES));
 	}
 
-	_vm->_scriptEngine->loadState(in, state.script, false);
-	_vm->_cmdQueue->loadState(in);
-	_vm->gfx()->loadState(in, false);
-	_vm->sound()->loadState(in);
-	_vm->_ui->loadState(in);
+	_vm->_scriptEngine->loadState(in, state.script, flags);
+	//if (!(flags & kSaveFlagsScriptedSave))
+	//	_vm->_cmdQueue->loadState(in);
+	_vm->gfx()->loadState(in, flags);
+	_vm->sound()->loadState(in, flags);
+	_vm->_ui->loadState(in, flags);
 
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
@@ -234,12 +242,15 @@ void SaveLoadManager::loadState(int slot, GameState &state) {
 
 	if (state.prologue == -1) {
 		state.phase = 0;
-		state.updateFlags = 0;
+		if (flags & kSaveFlagsScriptedSave)
+			state.updateFlags = 0;
+		else
+			state.updateFlags &= ~0x80;
 		state.menuSelect = 1;
 	}
 }
 
-void SaveLoadManager::saveState(int slot, GameState &state) {
+void SaveLoadManager::saveState(int slot, GameState &state, SaveFlags flags) {
 	Common::OutSaveFile *out = openFileForSaving(slot, _desc, state);
 
 	out->writeByte(_vm->_keyRepeat);
@@ -257,6 +268,8 @@ void SaveLoadManager::saveState(int slot, GameState &state) {
 	out->writeSint16BE(state.modPhaseTop);
 	out->writeSint16BE(state.prologue);
 
+	out->writeByte((flags & kSaveFlagsScriptedSave) ? 1 : 0);
+
 	Common::MemoryReadStream *m = _tempState.get();
 	if (m) {
 		m->seek(0);
@@ -270,11 +283,12 @@ void SaveLoadManager::saveState(int slot, GameState &state) {
 		out->writeUint16BE(0);
 	}
 
-	_vm->_scriptEngine->saveState(out, state.script, false);
-	_vm->_cmdQueue->saveState(out);
-	_vm->gfx()->saveState(out, false);
-	_vm->sound()->saveState(out);
-	_vm->_ui->saveState(out);
+	_vm->_scriptEngine->saveState(out, state.script, flags);
+	//if (!(flags & kSaveFlagsScriptedSave))
+	//	_vm->_cmdQueue->saveState(out);
+	_vm->gfx()->saveState(out, flags);
+	_vm->sound()->saveState(out, flags);
+	_vm->_ui->saveState(out, flags);
 
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
 
@@ -282,6 +296,7 @@ void SaveLoadManager::saveState(int slot, GameState &state) {
 	delete out;
 
 	updateSaveSlotsStatus(state);
+	debug("Saved game state to slot %d", slot);
 }
 
 Common::SeekableReadStream *SaveLoadManager::openFileForLoading(int slot, GameState &state, SaveHeader &header) {
diff --git a/engines/snatcher/saveload.h b/engines/snatcher/saveload.h
index 70ac6f611e1..a965fa57023 100644
--- a/engines/snatcher/saveload.h
+++ b/engines/snatcher/saveload.h
@@ -26,6 +26,7 @@
 #include "common/ptr.h"
 #include "common/memstream.h"
 #include "common/system.h"
+#include "snatcher/saveflags.h"
 #include "snatcher/state.h"
 
 namespace Common {
@@ -50,12 +51,12 @@ public:
 	void updateSaveSlotsStatus(GameState &state);
 
 	void requestLoad(int slot);
-	void requestSave(int slot, const Common::String &desc);
+	void requestSave(int slot, const Common::String &desc, bool scriptedSave);
 
 	void handleSaveLoad(GameState &state);
 
 	bool isSaveSlotUsed(int16 slot) const;
-	bool isSavingEnabled() const;
+	bool canSaveHere() const;
 	void enableSaving(bool enable);
 
 	void saveTempState(Script &script);
@@ -82,7 +83,7 @@ public:
 
 private:
 	void loadState(int slot, GameState &state);
-	void saveState(int slot, GameState &state);
+	void saveState(int slot, GameState &state, SaveFlags flags);
 
 	Common::SeekableReadStream *openFileForLoading(int slot, GameState &state, SaveHeader &header);
 	Common::OutSaveFile *openFileForSaving(int slot, const Common::String &desc, GameState &state);
@@ -90,6 +91,7 @@ private:
 	SnatcherEngine *_vm;
 	Common::String _desc;
 	int _pendingSaveLoad;
+	SaveFlags _pendingSaveFlags;
 	bool _tryLoadFromLauncher;
 	bool _enableSaving;
 
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index 49a3dfedfee..37fd096a295 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -36,14 +36,15 @@
 
 namespace Snatcher {
 
-CmdQueue::CmdQueue(SnatcherEngine *vm) : _vm(vm), _data(nullptr), _readPos(0), _writePos(nullptr), _enable(false), _progress(-1), _currentOpcode(0),  _counter(0), _state(nullptr), _opcodes() {
+CmdQueue::CmdQueue(SnatcherEngine *vm) : _vm(vm), _data(nullptr), _readPos(nullptr), /* _lastReadPos(nullptr), */ _writePos(nullptr), _enable(false), _progress(-1), _currentOpcode(0), _counter(0), _state(nullptr), /* _restoreData(nullptr), _restoreDataSize(0),*/ _opcodes() {
 	_data = new uint16[256]();
 	makeFunctions();
 	reset();
 }
 
 CmdQueue::~CmdQueue() {
-	delete[] _data;
+	//delete[] _data;
+	//delete[] _restoreData;
 	for (Common::Array<CmdQueOpcode*>::iterator i = _opcodes.begin(); i != _opcodes.end(); ++ i)
 		delete *i;
 }
@@ -51,6 +52,7 @@ CmdQueue::~CmdQueue() {
 void CmdQueue::reset() {
 	memset(_data, 0, 256);
 	_readPos = _writePos = _data;
+	//_lastReadPos = nullptr;
 	_enable = false;
 	_progress = -1;
 }
@@ -72,6 +74,7 @@ void CmdQueue::run(GameState &state) {
 
 	do {
 		if (_progress == -1) {
+			//_lastReadPos = _readPos;
 			_currentOpcode = *_readPos++;
 			_progress = 0;
 		}
@@ -83,15 +86,50 @@ void CmdQueue::run(GameState &state) {
 	} while (_currentOpcode != 0 && _progress == -1);
 }
 
+/*
 void CmdQueue::loadState(Common::SeekableReadStream *in) {
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
+
+	_enable = in->readByte() != 0;
+	if (!_enable)
+		return;
+
+	delete[] _restoreData;
+	_restoreDataSize = in->readUint16BE();
+	_restoreData = new uint16[_restoreDataSize]();
+	assert(_restoreData);
+	for (int i = 0; i < _restoreDataSize; ++i)
+		_restoreData[i] = in->readUint16BE();
+
+	int s = in->readUint16BE();
+	for (int i = 0; i < s; ++i)
+		in->readUint16BE();
 }
 
 void CmdQueue::saveState(Common::SeekableWriteStream *out) {
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
 
+	out->writeByte(_enable ? 1 : 0);
+	if (!_enable)
+		return;
+
+	uint16 len = 0;
+	for (const uint16 *p = _data; p < _writePos; ++p)
+		++len;
+	out->writeUint16BE(len);
+	for (const uint16 *p = _data; p < _writePos; ++p)
+		out->writeUint16BE(*p);
+}
+
+void CmdQueue::appendRestoreData() {
+	for (int i = 0; i < _restoreDataSize; ++i)
+		*_writePos++ = _restoreData[i];
+	delete[] _restoreData;
+	_restoreData = nullptr;
+	_restoreDataSize = 0;
 }
+*/
 
 void CmdQueue::makeFunctions() {
 #define OP(x) &CmdQueue::m_##x
@@ -347,7 +385,6 @@ void CmdQueue::m_loadResource(const uint16 *&data) {
 			delete[] _state->script.data;
 			_state->script.data = _vm->_fio->fileData(index, &_state->script.dataSize);
 			assert(_state->script.data);
-			_state->script.curFileNo = index;
 			_vm->_ui->setScriptTextResource(_state->script.getTextResource());
 		} else if (dest == 0x28000) {
 			delete _vm->_module;
@@ -445,7 +482,7 @@ void CmdQueue::m_pcmBlock(const uint16 *&data) {
 void CmdQueue::m_saveGame(const uint16 *&data) {
 	int slot = *data++;
 	Common::String desc(Common::String::format("SNATCHER_%02d", slot));
-	_vm->saveGameState(slot, desc);
+	_vm->_saveMan->requestSave(slot, desc, true);
 	_progress = -1;
 }
 
@@ -478,7 +515,8 @@ void CmdQueue::m_clearTextInputLine(const uint16 *&data) {
 	_progress = -1;
 }
 
-ScriptEngine::ScriptEngine(CmdQueue *que, UI *ui, ActionSequenceHandler *aseq, MemAccessHandler *mem, ResourcePointer *scd) : _que(que), _ui(ui), _aseq(aseq), _mem(mem), _arrayData(nullptr), _pos1(0), _pos2(0), _result(0), _flagsTable(nullptr) {
+ScriptEngine::ScriptEngine(CmdQueue *que, UI *ui, ActionSequenceHandler *aseq, MemAccessHandler *mem, ResourcePointer *scd) :
+	_que(que), _ui(ui), _aseq(aseq), _mem(mem), _arrayData(nullptr), _pos1(0), _pos2(0), _result(0), _flagsTable(nullptr) {
 	_flagsTable = new uint8[352]();
 	_arrayData = new uint8[256]();
 	makeOpcodeTable(scd);
@@ -556,14 +594,29 @@ void ScriptEngine::processInput() {
 	ARR_POS(1) = 0;
 }
 
-void ScriptEngine::loadState(Common::SeekableReadStream *in, Script &script, bool onlyTempData) {
+void ScriptEngine::loadState(Common::SeekableReadStream *in, Script &script, SaveFlags flags) {
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
 
-	if (!onlyTempData) {
-		uint16 *d = reinterpret_cast<uint16*>(_arrayData);
-		for (int i = 0; i < 128; ++i)
-			d[i] = in->readUint16BE();
+	if (!(flags & kSaveFlagsTempData)) {
+		if (flags & kSaveFlagsScriptedSave) {
+			uint8 num = in->readByte();
+			ARR_POS(4) = 0;
+			for (int i = 0; i < num; ++i) {
+				if (!setArrayLastEntry(4, in->readUint16BE()))
+					error("%s(): Out of bounds", __FUNCTION__);
+			}
+			ARR_POS(0) = 0;
+			ARR_POS(1) = 0;
+			ARR_POS(2) = 0;
+			ARR_POS(3) = 0;
+			ARR_POS(5) = 0;
+
+		} else {
+			uint16 *d = reinterpret_cast<uint16*>(_arrayData);
+			for (int i = 0; i < 128; ++i)
+				d[i] = in->readUint16BE();
+		}
 		in->read(_flagsTable, 352);
 
 		script.sentenceDone = in->readByte();
@@ -573,36 +626,44 @@ void ScriptEngine::loadState(Common::SeekableReadStream *in, Script &script, boo
 	script.curFileNo = in->readByte();
 	script.curGfxScript = in->readSint16BE();
 
-	if (!onlyTempData) {
+	if (!(flags & kSaveFlagsTempData)) {
 		script.curPos = in->readUint16BE();
-		ARR_POS(0) = 0;
-		ARR_POS(1) = 0;
-		ARR_POS(2) = 0;
-		ARR_POS(3) = 0;
-		ARR_POS(5) = 0;
+		script.newPos = 0xFFFF;
+		in->readUint16BE();
 	}
 }
 
-void ScriptEngine::saveState(Common::SeekableWriteStream *out, Script &script, bool onlyTempData) {
+void ScriptEngine::saveState(Common::SeekableWriteStream *out, Script &script, SaveFlags flags) {
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
 
-	if (!onlyTempData) {
-		const uint16 *s = reinterpret_cast<const uint16*>(_arrayData);
-		for (int i = 0; i < 128; ++i)
-			out->writeUint16BE(s[i]);
+	if (!(flags & kSaveFlagsTempData)) {
+		if (flags & kSaveFlagsScriptedSave) {
+			uint8 num = script.temp.arr4[0] & 0xFF;
+			out->writeByte(num);
+			for (int i = 0; i < num; ++i)
+				out->writeUint16BE(script.temp.arr4[i + 1]);
+		} else {
+			const uint16 *s = reinterpret_cast<const uint16*>(_arrayData);
+			for (int i = 0; i < 128; ++i)
+				out->writeUint16BE(s[i]);
+		}
 		out->write(_flagsTable, 352);
 
 		out->writeByte(script.sentenceDone);
 		out->writeByte(script.sentencePos);
 	}
 
-	out->writeByte(script.curFileNo);
+	out->writeByte(flags & kSaveFlagsScriptedSave ? script.temp.curFileNo : script.curFileNo);
 	out->writeSint16BE(script.curGfxScript);
 
-	if (!onlyTempData) {
-		uint16 pos = script.curPos;
-		getArrayEntry(5, 0, pos);
-		out->writeUint16BE(pos);
+	if (!(flags & kSaveFlagsTempData)) {
+		if (flags & kSaveFlagsScriptedSave) {
+			out->writeUint16BE(script.temp.curPos);
+			out->writeUint16BE(0xFFFF);
+		} else {
+			out->writeUint16BE(script.curPos);
+			out->writeUint16BE(script.newPos);
+		}
 	}
 }
 
@@ -1229,6 +1290,7 @@ void ScriptEngine::o_evalGreaterOrEqual() {
 	runOpcodeOrReadVar(m2, _result);
 	_result = (_result >= f2) ? 0xFFFF : 0;
 }
+
 void ScriptEngine::o_break() {
 	if (!evalFinished())
 		return;
@@ -1364,6 +1426,7 @@ void ScriptEngine::o_returnFromSubScript() {
 	_que->writeUInt16(0x11);
 	_que->writeUInt32(0x1A800);
 	_que->writeUInt16(res);
+	_script->curFileNo = res;
 }
 
 void ScriptEngine::o_checkSubRecurseState() {
@@ -1460,6 +1523,14 @@ void ScriptEngine::o_sysOps() {
 		// Save game state
 		_que->writeUInt16(0x1E);
 		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 4));
+		if (!getArrayEntry(5, 0, _script->temp.curPos))
+			_script->temp.curPos = _script->curPos;
+		_script->temp.curFileNo = _script->curFileNo;
+		_script->temp.arr4[0] = ARR_POS(4);
+		for (int i = 0; i < ARR_POS(4); ++i) {
+			if (!getArrayEntry(4, i, _script->temp.arr4[i + 1]))
+				error("%s(): Out of bounds", __FUNCTION__);
+		}
 		break;
 	case 2:
 		_que->writeUInt16(0x21);
diff --git a/engines/snatcher/script.h b/engines/snatcher/script.h
index 68e47f22a3e..1d9aa8c3b8b 100644
--- a/engines/snatcher/script.h
+++ b/engines/snatcher/script.h
@@ -22,11 +22,12 @@
 #ifndef SNATCHER_SCRIPT_H
 #define SNATCHER_SCRIPT_H
 
+#include "snatcher/saveflags.h"
+#include "snatcher/state.h"
 #include "common/array.h"
 #include "common/func.h"
 #include "common/ptr.h"
 
-//#define		SNATCHER_SCRIPT_DEBUG
 
 namespace Common {
 class SeekableReadStream;
@@ -51,13 +52,17 @@ public:
 	bool enabled() const { return _enable; }
 	void run(GameState &state);
 
-	void loadState(Common::SeekableReadStream *in);
-	void saveState(Common::SeekableWriteStream *out);
+	//void loadState(Common::SeekableReadStream *in);
+	//void saveState(Common::SeekableWriteStream *out);
+	//void appendRestoreData();
 
 private:
 	const uint16 *_readPos;
+	//const uint16 *_lastReadPos;
 	uint16 *_data;
 	uint16 *_writePos;
+	//uint16 *_restoreData;
+	//uint16 _restoreDataSize;
 	uint16 _currentOpcode;
 	int16 _progress;
 	uint16 _counter;
@@ -144,8 +149,8 @@ public:
 	bool postProcess(Script &script);
 	void processInput();
 
-	void loadState(Common::SeekableReadStream *in, Script &script, bool onlyTempData);
-	void saveState(Common::SeekableWriteStream *out, Script &script, bool onlyTempData);
+	void loadState(Common::SeekableReadStream *in, Script &script, SaveFlags flags);
+	void saveState(Common::SeekableWriteStream *out, Script &script, SaveFlags flags);
 
 private:
 	CmdQueue *_que;
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index f8fb33c63e4..f653113036b 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -25,6 +25,7 @@
 #include "snatcher/mem_mapping.h"
 #include "snatcher/resource.h"
 #include "snatcher/saveload.h"
+#include "snatcher/saveflags.h"
 #include "snatcher/script.h"
 #include "snatcher/snatcher.h"
 #include "snatcher/sound.h"
@@ -222,7 +223,7 @@ void SnatcherEngine::playBootLogoAnimation(const GameState &state) {
 		delayUntil(nextFrame);
 	}
 }
-
+int g = 0;
 bool SnatcherEngine::start() {
 	Util::rngReset();
 	GameState state;
@@ -262,6 +263,7 @@ bool SnatcherEngine::start() {
 				bool blockedMod = _cmdQueue->enabled();
 				if (_cmdQueue->enabled()) {
 					_cmdQueue->run(state);
+					g = state.script.curPos;
 					blockedMod = _gfx->busy(0);
 				}
 				if (!blockedMod) {
@@ -473,14 +475,12 @@ void SnatcherEngine::updateMainState(GameState &state) {
 		// Init first scene or load savegame
 		_cmdQueue->writeUInt16(0x11);
 		_cmdQueue->writeUInt32(0x1A800);
-		if (state.menuSelect == 0) {
-			// Enter first scene
-			_cmdQueue->writeUInt16(0x3F);
-			_cmdQueue->writeUInt16(0x0F);
-		} else {
+		if (state.menuSelect == 0)
+			state.script.curFileNo = 0x3F; // First scene
+		_cmdQueue->writeUInt16(state.script.curFileNo);
+		_cmdQueue->writeUInt16(0x0F);
+		if (state.menuSelect != 0) {
 			// Restore saved state
-			_cmdQueue->writeUInt16(state.script.curFileNo);
-			_cmdQueue->writeUInt16(0x0F);
 			_cmdQueue->writeUInt16(0x11);
 			_cmdQueue->writeUInt32(0x28000);
 			_cmdQueue->writeUInt16(state.script.curGfxScript >> 8);
@@ -493,8 +493,10 @@ void SnatcherEngine::updateMainState(GameState &state) {
 			_cmdQueue->writeUInt16(state.script.curGfxScript & 0xFF);
 			_cmdQueue->writeUInt16(0x07);
 			_cmdQueue->writeUInt16(_snd->fmGetStatus().music);
+			//_cmdQueue->appendRestoreData();
 			_snd->pcmBlock(_snd->pcmGetStatus().blocked);
 			_snd->reduceVolume2(_snd->fmGetStatus().reduceVol2);
+			_snd->cdaRestore();
 		}
 
 		_ui->setControllerConfig(state.conf.controllerSetup);
@@ -794,7 +796,10 @@ bool SnatcherEngine::canLoadGameStateCurrently(Common::U32String*) {
 }
 
 bool SnatcherEngine::canSaveGameStateCurrently(Common::U32String *msg) {
-	return _saveMan->isSavingEnabled();
+	static const char txt[] = "Saving not possible right now.\nFor now, saving is mostly limited to situations where the original interpreter would allow it.";
+	*msg = Common::U32String(txt, strnlen(txt, ARRAYSIZE(txt)));
+
+	return _saveMan->canSaveHere() && _ui->canSaveHere() && _aseq->canSaveHere();
 }
 
 Common::Error SnatcherEngine::loadGameState(int slot) {
@@ -803,7 +808,7 @@ Common::Error SnatcherEngine::loadGameState(int slot) {
 }
 
 Common::Error SnatcherEngine::saveGameState(int slot, const Common::String &desc, bool isAutosave) {
-	_saveMan->requestSave(slot, desc);
+	_saveMan->requestSave(slot, desc, kSaveFlagsNone);
 	return Common::kNoError;
 }
 
diff --git a/engines/snatcher/sound.cpp b/engines/snatcher/sound.cpp
index 62f5d8f2494..c63aa7e8a9b 100644
--- a/engines/snatcher/sound.cpp
+++ b/engines/snatcher/sound.cpp
@@ -25,7 +25,7 @@
 
 namespace Snatcher {
 
-SoundEngine::SoundEngine(FIO *fio, Common::Platform platform, int soundOptions) : _dev(nullptr) {
+SoundEngine::SoundEngine(FIO *fio, Common::Platform platform, int soundOptions) : _dev(nullptr), _cdaRestoreTime(0), _cdaRestoreTrack(-1) {
 	_dev = SoundDevice::create(fio, platform, soundOptions);
 	assert(_dev);
 }
@@ -54,6 +54,16 @@ uint32 SoundEngine::cdaGetTime() const {
 	return _dev->cdaGetTime();
 }
 
+void SoundEngine::cdaRestore() {
+	if (_cdaRestoreTrack == -1)
+		return;
+
+	_dev->cdaStop();
+	_dev->cdaPlay(_cdaRestoreTrack, _cdaRestoreTime);
+
+	_cdaRestoreTrack = -1;
+}
+
 void SoundEngine::fmSendCommand(int cmd, int restoreVolume, int trackType) {
 	_dev->fmSendCommand(cmd, restoreVolume);
 
@@ -115,21 +125,37 @@ void SoundEngine::setSoundEffectVolume(int vol) {
 	_dev->setSoundEffectVolume(vol);
 }
 
-void SoundEngine::loadState(Common::SeekableReadStream *in) {
+void SoundEngine::loadState(Common::SeekableReadStream *in, SaveFlags flags) {
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
 	_pcmStatus.resourceId = _pcmStatus.resourceId2 = in->readSint16BE();
 	_pcmStatus.blocked = in->readByte();
 	_fmStatus.music = in->readByte();
 	_fmStatus.reduceVol2 = in->readByte();
+
+	if (flags & (kSaveFlagsScriptedSave | kSaveFlagsTempData)) {
+		_cdaRestoreTrack = -1;
+		return;
+	}
+
+	_cdaRestoreTrack = in->readSByte();
+	_cdaRestoreTime = (_cdaRestoreTrack != -1) ? in->readUint32BE() : 0;
 }
 
-void SoundEngine::saveState(Common::SeekableWriteStream *out) {
+void SoundEngine::saveState(Common::SeekableWriteStream *out, SaveFlags flags) {
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
 	out->writeSint16BE(_pcmStatus.resourceId);
 	out->writeByte(_pcmStatus.blocked);
 	out->writeByte(_fmStatus.music);
 	out->writeByte(_fmStatus.reduceVol2);
+
+	if (flags & (kSaveFlagsScriptedSave | kSaveFlagsTempData))
+		return;
+
+	int16 cdaTrack = _dev->cdaGetCurTrack();
+	out->writeSByte(cdaTrack);
+	if (cdaTrack != -1)
+		out->writeUint32BE(_dev->cdaGetTime());
 }
 
 SoundDevice *SoundDevice::create(FIO *fio, Common::Platform platform, int soundOptions) {
diff --git a/engines/snatcher/sound.h b/engines/snatcher/sound.h
index 568b12b11f5..2e33d663379 100644
--- a/engines/snatcher/sound.h
+++ b/engines/snatcher/sound.h
@@ -23,6 +23,7 @@
 #define SNATCHER_SOUND_H
 
 #include "common/platform.h"
+#include "snatcher/saveflags.h"
 
 namespace Audio {
 class Mixer;
@@ -49,6 +50,7 @@ public:
 	void cdaStop();
 	bool cdaIsPlaying() const;
 	uint32 cdaGetTime() const;
+	void cdaRestore();
 
 	struct FMStatus {
 		FMStatus() : music(0), sfx(0), sync(0), blocked(0), reduceVol2(0) {}
@@ -84,13 +86,16 @@ public:
 	void setMusicVolume(int vol);
 	void setSoundEffectVolume(int vol);
 
-	void loadState(Common::SeekableReadStream *in);
-	void saveState(Common::SeekableWriteStream *out);
+	void loadState(Common::SeekableReadStream *in, SaveFlags flags);
+	void saveState(Common::SeekableWriteStream *out, SaveFlags flags);
 
 private:
 	FMStatus _fmStatus;
 	PCMStatus _pcmStatus;
 	SoundDevice *_dev;
+
+	int16 _cdaRestoreTrack;
+	uint32 _cdaRestoreTime;
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/sound_device.h b/engines/snatcher/sound_device.h
index d930197ee13..7cd952b5f77 100644
--- a/engines/snatcher/sound_device.h
+++ b/engines/snatcher/sound_device.h
@@ -39,9 +39,10 @@ public:
 
 	virtual bool init(Audio::Mixer *mixer) = 0;
 
-	virtual void cdaPlay(int track) = 0;
+	virtual void cdaPlay(int track, uint32 bcdTime = 0) = 0;
 	virtual void cdaStop() = 0;
 	virtual bool cdaIsPlaying() const = 0;
+	virtual int cdaGetCurTrack() const = 0;
 	virtual uint32 cdaGetTime() const = 0;
 
 	virtual void fmSendCommand(int cmd, int arg) = 0;
diff --git a/engines/snatcher/sound_device_scd.cpp b/engines/snatcher/sound_device_scd.cpp
index 631fd31e85b..6d1ae08b8fe 100644
--- a/engines/snatcher/sound_device_scd.cpp
+++ b/engines/snatcher/sound_device_scd.cpp
@@ -82,9 +82,10 @@ public:
 
 	bool init(Audio::Mixer *mixer) override;
 
-	void cdaPlay(int track) override;
+	void cdaPlay(int track, uint32 bcdTime = 0) override;
 	void cdaStop() override;
 	bool cdaIsPlaying() const override;
+	int cdaGetCurTrack() const override;
 	uint32 cdaGetTime() const override;
 
 	void fmSendCommand(int cmd, int restoreVolume) override;
@@ -1781,9 +1782,14 @@ bool SegaSoundDevice::init(Audio::Mixer *mixer) {
 	return true;
 }
 
-void SegaSoundDevice::cdaPlay(int track) {
+void SegaSoundDevice::cdaPlay(int track, uint32 bcdTime) {
 	assert(track > 0);
-	g_system->getAudioCDManager()->play(track - 1, 1, 0, 0);
+
+	uint32 frm = 0;
+	if (bcdTime != 0)
+		frm = Util::decodeBCDTimeStamp(bcdTime, Util::kBCD_MMSSFR) / (1000 / 75);
+
+	g_system->getAudioCDManager()->play(track - 1, 1, frm, 0);
 	_lastTrack = track;
 	_musicStartTime = g_system->getMillis();
 }
@@ -1797,8 +1803,14 @@ bool SegaSoundDevice::cdaIsPlaying() const {
 	return g_system->getAudioCDManager()->isPlaying();
 }
 
+int SegaSoundDevice::cdaGetCurTrack() const {
+	return cdaIsPlaying() ? _lastTrack : -1;
+}
+
 uint32 SegaSoundDevice::cdaGetTime() const {
 	uint32 relTime = cdaIsPlaying() ? g_system->getMillis() - _musicStartTime : 0;
+	if (_pauseStartTime)
+		relTime -= (g_system->getMillis() - _pauseStartTime);
 	return Util::makeBCDTimeStamp(relTime, Util::kBCD_MMSSFR);
 }
 
diff --git a/engines/snatcher/state.h b/engines/snatcher/state.h
index af6ea2fadc2..5f526c6803c 100644
--- a/engines/snatcher/state.h
+++ b/engines/snatcher/state.h
@@ -78,6 +78,15 @@ struct Script {
 	uint16 newPos;
 	int16 &phase;
 	const uint32 textResOffset;
+
+	struct Temp {
+		Temp() : curFileNo(0), curPos(0) {
+			memset(arr4, 0, sizeof(arr4));
+		}
+		uint8 curFileNo;
+		uint16 curPos;
+		uint16 arr4[4];
+	} temp;
 };
 
 struct GameState {
diff --git a/engines/snatcher/transition.h b/engines/snatcher/transition.h
index 30e0c289f1e..91e228e9973 100644
--- a/engines/snatcher/transition.h
+++ b/engines/snatcher/transition.h
@@ -25,6 +25,11 @@
 #include "common/platform.h"
 #include "common/scummsys.h"
 
+namespace Common {
+	class SeekableWriteStream;
+	class SeekableReadStream;
+}
+
 namespace Snatcher {
 
 class TransitionManager {
@@ -65,6 +70,10 @@ public:
 	virtual void hINTCallback(void*) {}
 	const ScrollState &scroll_getState() const { return _result; }
 
+	virtual void saveState(Common::SeekableWriteStream *out) = 0;
+	virtual void loadState(Common::SeekableReadStream *in) = 0;
+	virtual void postLoadProcess() = 0;
+
 protected:
 	ScrollState _result;
 
diff --git a/engines/snatcher/transition_scd.cpp b/engines/snatcher/transition_scd.cpp
index bf5124a32ef..701f96efebe 100644
--- a/engines/snatcher/transition_scd.cpp
+++ b/engines/snatcher/transition_scd.cpp
@@ -22,7 +22,7 @@
 
 #include "snatcher/graphics.h"
 #include "snatcher/transition.h"
-#include "common/endian.h"
+#include "common/stream.h"
 #include "graphics/segagfx.h"
 
 namespace Snatcher {
@@ -111,6 +111,10 @@ public:
 
 	void hINTCallback(void *segaRenderer) override;
 
+	void saveState(Common::SeekableWriteStream *out) override;
+	void loadState(Common::SeekableReadStream *in) override;
+	void postLoadProcess() override;
+
 private:
 	void processCmdInternal();
 	void processTransition();
@@ -131,22 +135,23 @@ private:
 	uint8 _lineScrollOp;
 	uint8 _nextStepExt;
 	uint8 _lastStepExt;
-	int16 _restoreDlgTab;
-	int16 _transitionType;
+	uint8 _restoreDlgTab;
+	uint8 _transitionType;
+	uint8 _subPara;
 	int16 _transitionState;
 	int16 _transitionState2;
 	int16 _transitionStep;
 	int16 _tmpScrollOffset;
-	int16 _subPara;
 	int16 _lineScrollOpState;
 	int16 _lineScrollTimer1;
 	int16 _lineScrollTimer2;
 	int16 _lineScrollTimer3;
 	int16 _lineScrollTimer4;
 	int16 _lineScrollTimer5;
-	uint16 _trs__DB;
 	bool _useEngineScrollOffsets;
 
+	uint8 *_saveData;
+
 private:
 	typedef Common::Functor1Mem<int, void, TransitionManager_SCD> TrsFunc;
 	Common::Array<TrsFunc*> _trsProcs;
@@ -213,20 +218,23 @@ private:
 
 TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0),
 	_transitionStep(0), _trsCommandExt(0), _trsCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _lineScrollOpState(0), _lineScrollTimer1(0),
-		_lineScrollTimer2(0), _lineScrollTimer3(0), _lineScrollTimer4(0), _lineScrollTimer5(0), _trs__DB(0), _lineScrollOp(0), _restoreDlgTab(0), _transitionType(0), _transitionState(0),
-			_transitionState2(0), _tmpScrollOffset(0), _subPara(0), _useEngineScrollOffsets(false), _hINTHandler(nullptr), _hINTHandlerNext(nullptr) {
+		_lineScrollTimer2(0), _lineScrollTimer3(0), _lineScrollTimer4(0), _lineScrollTimer5(0), _lineScrollOp(0), _restoreDlgTab(0), _transitionType(0), _transitionState(0),
+			_transitionState2(0), _tmpScrollOffset(0), _subPara(0), _useEngineScrollOffsets(false), _hINTHandler(nullptr), _hINTHandlerNext(nullptr), _saveData(nullptr) {
 	_internalState = new ScrollInternalState[4];
 	assert(_internalState);
 	_internalState[kVertA].setFactor(-1);
 	_internalState[kVertB].setFactor(-1);
 	_hScrollTable = new int16[0x200]();
 	assert(_hScrollTable);
+	_saveData = new uint8[40]();
+	assert(_saveData);
 	makeFunctions();
 }
 
 TransitionManager_SCD::~TransitionManager_SCD() {
 	delete[] _internalState;
 	delete[] _hScrollTable;
+	delete[] _saveData;
 	_hINTHandler = _hINTHandlerNext = nullptr;
 	for (Common::Array<TrsFunc*>::const_iterator i = _trsProcs.begin(); i != _trsProcs.end(); ++i)
 		delete *i;
@@ -328,6 +336,111 @@ void TransitionManager_SCD::hINTCallback(void *segaRenderer) {
 		(*_hINTHandler)(static_cast<Graphics::SegaRenderer *>(segaRenderer));
 }
 
+void TransitionManager_SCD::saveState(Common::SeekableWriteStream *out) {
+	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
+
+	//out->writeByte(_scrollType);
+	//out->writeByte(_trsCommandExt);
+	//out->writeByte(_trsCommand);
+	//out->writeByte(_resetCommand);
+	//out->writeByte(_nextStep);
+	//out->writeByte(_lastStep);
+	out->writeByte(_lineScrollOp);
+	/* out->writeByte(_nextStepExt);
+	out->writeByte(_lastStepExt);
+	out->writeByte(_restoreDlgTab);
+	out->writeByte(_transitionType);
+	out->writeByte(_subPara);
+	out->writeSint16BE(_transitionState);
+	out->writeSint16BE(_transitionState2);
+	out->writeSint16BE(_transitionStep);
+	out->writeSint16BE(_tmpScrollOffset);
+	out->writeSint16BE(_lineScrollOpState);
+	for (int i = 0; i < 4; ++i) {
+		out->writeSint16BE(_result.realOffsets[i]);
+		out->writeSint16BE(_result.unmodifiedOffsets[i]);
+	}
+
+	uint8 v = _result.busy ? 1: 0;
+	v = (v << 1) | (_result.disableVScroll ? 1 : 0);
+	v = (v << 1) | (_result.verbsTabVisible ? 1 : 0);
+	v = (v << 1) | (_result.hInt.enable ? 1 : 0);
+	v = (v << 1) | (_result.hInt.needUpdate ? 1 : 0);
+	v = (v << 1) | (_useEngineScrollOffsets ? 1 : 0);
+	out->writeByte(v);
+	out->writeByte(_result.hInt.counter);*/
+}
+
+void TransitionManager_SCD::loadState(Common::SeekableReadStream *in) {
+	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
+		error("%s(): Save file invalid or corrupt", __FUNCTION__);
+	//in->read(_saveData, 40);
+	in->read(_saveData, 1);
+}
+
+void TransitionManager_SCD::postLoadProcess() {
+	const uint8 *s = _saveData;
+	_lineScrollOp = *s++;
+	if (_lineScrollOp == 4)
+		doCommand(_lineScrollOp);
+	/*
+	_scrollType = *s++;
+	_trsCommandExt = *s++;
+	_trsCommand = *s++;
+	_resetCommand = *s++;
+	_nextStep = *s++;
+	_lastStep = *s++;
+	_lineScrollOp = *s++;
+	/* _nextStepExt = *s++;
+	_lastStepExt = *s++;
+	_restoreDlgTab = *s++;
+	_transitionType = *s++;
+	_subPara = *s++;
+
+	_transitionState = READ_BE_INT16(s);
+	s += 2;
+	_transitionState2 = READ_BE_INT16(s);
+	s += 2;
+	_transitionStep = READ_BE_INT16(s);
+	s += 2;
+	_tmpScrollOffset = READ_BE_INT16(s);
+	s += 2;
+	_lineScrollOpState = READ_BE_INT16(s);
+	s += 2;
+	for (int i = 0; i < 4; ++i) {
+		_result.realOffsets[i] = READ_BE_INT16(s);
+		s += 2;
+		_result.unmodifiedOffsets[i] = READ_BE_INT16(s);
+		s += 2;
+	}
+
+	uint8 v = *s++;
+	_result.hInt.counter = *s;
+
+	_useEngineScrollOffsets = v & 1;
+	v >>= 1;
+	_result.hInt.needUpdate = v & 1;
+	v >>= 1;
+	_result.hInt.enable = v & 1;
+	v >>= 1;
+	_result.verbsTabVisible = v & 1;
+	v >>= 1;
+	_result.disableVScroll = v & 1;
+	v >>= 1;
+	_result.busy = v & 1;
+
+	if (_lineScrollOp) {
+		v = _nextStep;
+		_nextStep = _lineScrollOp;
+		lineScrollInit();
+		_nextStep = v;
+	}
+
+	int subPara = _subPara;
+	for (_subPara = 0; _subPara < subPara; )
+		processCmdInternal();*/
+}
+
 void TransitionManager_SCD::processCmdInternal() {
 	if ((_nextStep != _lastStep || _lastStep == 0) && _nextStep != 0) {
 		if (_nextStep == 0xFF || _nextStep == 0xFC) {
@@ -426,9 +539,9 @@ void TransitionManager_SCD::resetVars(int groupFlags) {
 	if (groupFlags & 0x02) {
 		_lineScrollOp = 0;
 		_lineScrollOpState = 0;
-		_trs__DB = 0;
 		_nextStepExt = _lastStepExt = 0;
-		_transitionType = _transitionState = _tmpScrollOffset = _subPara = 0;
+		_transitionType = _subPara = 0;
+		_transitionState = _tmpScrollOffset = 0;
 		_result.verbsTabVisible = false;
 		_restoreDlgTab = 0;
 	}
@@ -1005,7 +1118,7 @@ void TransitionManager_SCD::lineScrollInit() {
 	_nextStep = 0;
 	_hScrollTableLen = 128;
 	_useEngineScrollOffsets = false;
-	_lineScrollTimer1 = _lineScrollTimer3 = _lineScrollTimer5 = 0;
+	_lineScrollTimer1 = _lineScrollTimer2 = _lineScrollTimer3 = _lineScrollTimer4 = _lineScrollTimer5 = 0;
 	Common::fill<int16*>(_hScrollTable, &_hScrollTable[0x100], 0);
 	_result.lineScrollMode = true;
 }
diff --git a/engines/snatcher/ui.cpp b/engines/snatcher/ui.cpp
index fbd5ba06266..87d2ea1db14 100644
--- a/engines/snatcher/ui.cpp
+++ b/engines/snatcher/ui.cpp
@@ -148,8 +148,6 @@ bool UI::displayDialog(int sceneInfo, int sceneTextOffset, uint16 inputFlags) {
 
 		_sceneTextOffsCur = _sceneTextOffsStart;
 		_textLineEnd = 0;
-		//_gfxOps10_sub_974B = _gfxOps10_sub_974E = 0;
-		//_gfxOps10_subword_974C = 0;
 		_textColor = 1;
 
 		_gfx->transitionCommand(_gfx->getVerbAreaType() == 0 ? 15 : (_gfx->getVerbAreaType() == 1 ? 20 : 22));
@@ -490,18 +488,55 @@ void UI::setVerbInterfaceMode(uint16 mode) {
 		_flashLight.posX = _flashLight.posY = 0;
 }
 
-void UI::loadState(Common::SeekableReadStream *in) {
+void UI::loadState(Common::SeekableReadStream *in, SaveFlags flags) {
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
 	_verbInterfaceMode = in->readUint16BE();
 	_verbsInterpreterMode = in->readUint16BE();
 	_progress = _progress2 = -1;
+
+	if (flags & kSaveFlagsTempData)
+		return;
+
+	_videoPhoneMode = in->readSint16BE();
+	_textInputColumnMax = in->readSint16BE();
+	_prevSelectedVerb = in->readByte();
+	_selectedVerb = in->readByte();
+	_prevSelectedVerb = _selectedVerb;
+	if (flags & kSaveFlagsScriptedSave)
+		resetVerbSelection();
+	else
+		_prevSelectedVerb = _selectedVerb;
+	_vkeybVisible = in->readByte();
+
+	_flashLight.inputFlags= in->readByte();
+	_flashLight.posData= in->readByte();
+	_flashLight.posX = in->readSint32BE();
+	_flashLight.posY = in->readSint32BE();
 }
 
-void UI::saveState(Common::SeekableWriteStream *out) {
+void UI::saveState(Common::SeekableWriteStream *out, SaveFlags flags) {
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
 	out->writeUint16BE(_verbInterfaceMode);
 	out->writeUint16BE(_verbsInterpreterMode);
+
+	if (flags & kSaveFlagsTempData)
+		return;
+
+	out->writeSint16BE(_videoPhoneMode);
+	out->writeSint16BE(_textInputColumnMax);
+	out->writeByte(_prevSelectedVerb);
+	out->writeByte(_selectedVerb);
+	out->writeByte(_vkeybVisible ? 1 : 0);
+
+	out->writeByte(_flashLight.inputFlags);
+	out->writeByte(_flashLight.posData);
+	out->writeSint32BE(_flashLight.posX);
+	out->writeSint32BE(_flashLight.posY);
+}
+
+bool UI::canSaveHere() const {
+	return (_videoPhoneMode == false && _verbInterfaceMode < 2 && (_progress2 & 0xFF) == 103);
 }
 
 void UI::printDialogStringHead() {
diff --git a/engines/snatcher/ui.h b/engines/snatcher/ui.h
index bd151573e1d..ea70e4b6cca 100644
--- a/engines/snatcher/ui.h
+++ b/engines/snatcher/ui.h
@@ -25,6 +25,7 @@
 
 
 #include "common/scummsys.h"
+#include "snatcher/saveflags.h"
 
 namespace Common {
 class SeekableReadStream;
@@ -74,8 +75,9 @@ public:
 	void setInputStringLength(uint16 length) { _textInputColumnMax = length; }
 	void setHeadLineYOffset(int16 offs) { _headLineYOffset = offs; };
 
-	void loadState(Common::SeekableReadStream *in);
-	void saveState(Common::SeekableWriteStream *out);
+	void loadState(Common::SeekableReadStream *in, SaveFlags flags);
+	void saveState(Common::SeekableWriteStream *out, SaveFlags flags);
+	bool canSaveHere() const;
 
 private:
 	void printDialogStringHead();


Commit: 5f91396a397fadab5e7168bcdd7c612d7adbc6a9
    https://github.com/scummvm/scummvm/commit/5f91396a397fadab5e7168bcdd7c612d7adbc6a9
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: remove experimental code

Changed paths:
    engines/snatcher/graphics.cpp
    engines/snatcher/saveload.cpp
    engines/snatcher/script.cpp
    engines/snatcher/snatcher.cpp
    engines/snatcher/transition_scd.cpp


diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 598e3b9b80c..b773ddf27b5 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -279,14 +279,9 @@ void GraphicsEngine::loadState(Common::SeekableReadStream *in, SaveFlags flags)
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
 	in->read(_animSaveLoadData, 64);
 
-	if (flags & (kSaveFlagsTempData/* | kSaveFlagsScriptedSave*/))
+	if (flags & (kSaveFlagsTempData))
 		return;
 
-	//uint16 size = in->readSint16BE();
-	//uint8 *data = new uint8[size]();
-	//assert(data);
-	//in->read(data, size);
-	//_animSaveLoadDataExt = Common::SharedPtr<const uint8>(data, Common::ArrayDeleter<const uint8>());
 	_animSaveLoadDataExt = true;
 
 	for (int i = 0; i < 13; ++i)
@@ -317,79 +312,9 @@ void GraphicsEngine::saveState(Common::SeekableWriteStream *out, SaveFlags flags
 	}
 	out->write(_animSaveLoadData, 64);
 
-	if (flags & (kSaveFlagsTempData /* | kSaveFlagsScriptedSave*/))
+	if (flags & (kSaveFlagsTempData))
 		return;
 
-	/* int count = 0;
-	for (int i = 0; i < 64; ++i) {
-		if (_animSaveLoadData[i])
-			++count;
-	}
-	uint8 *data = new uint8[count * 29]();
-	uint8 *d = data;
-
-	for (int i = 0; i < 64; ++i) {
-		if (_animSaveLoadData[i] == 0)
-			continue;
-
-		uint8 v = (getAnimParameter(i, kAnimParaScriptComFlags) & 2) >> 1;
-		v |= getAnimParameter(i, kAnimParaDrawFlags) << 1;
-		v |= (getAnimParameter(i, kAnimFreezeFlag) ? 0x20 : 0);
-		*d++ = v;
-
-		uint16 b = getAnimParameter(i, kAnimParaPosX);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaPosY);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaRelSpeedX);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaRelSpeedY);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-
-		v = getAnimParameter(i, kAnimParaOvrTile) & 0xFC;
-		uint8 v2 = (getAnimParameter(i, kAnimParaPhase) & 0xF3);
-		b = ((v2 & 0xF0) << 8) | (v2 & 0x0F) | v;
-		v = getAnimParameter(i, kAnimParaPalette) & 0x83;
-		b |= (((v & 0x80) << 4) | ((v & 0x03) << 9));
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-
-		b = getAnimParameter(i, kAnimParaTarget);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		v = getAnimParameter(i, kAnimParaF1c);
-		*d++ = v;
-
-		uint32 t = getAnimParameter(i, kAnimParaTimeStamp);
-		WRITE_BE_UINT32(d, t);
-		d += 4;
-		v = getAnimParameter(i, kAnimParaFrameSeqCounter);
-		*d++ = v;
-		b = getAnimParameter(i, kAnimParaFrame);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaFrameDelay);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaActionTimer);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaAbsSpeedX);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaAbsSpeedY);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-	}
-
-	out->writeUint16BE(d - data);
-	out->write(data, d - data);
-	delete[] data;*/
-
 	for (int i = 0; i < 13; ++i)
 		out->writeByte(_state.getVar(i));
 
@@ -421,54 +346,6 @@ void GraphicsEngine::postLoadProcess() {
 	if (!(_animSaveLoadDataExt))
 		return;
 
-	/* if (_animSaveLoadDataExt == nullptr)
-		return;
-
-	 const uint8 *s = _animSaveLoadDataExt.get();
-	for (int i = 0; i < 64; ++i) {
-		if (_animSaveLoadData[i] == 0)
-			continue;
-
-		uint16 v = *s++;
-		setAnimParameter(i, kAnimParaScriptComFlags, getAnimParameter(i, kAnimParaScriptComFlags) | ((v & 1) << 1));
-		setAnimParameter(i, kAnimParaDrawFlags, (v & 0x1E) >> 1);
-		setAnimParameter(i, kAnimFreezeFlag, (v & 0x20) >> 5);
-
-		setAnimParameter(i, kAnimParaPosX, READ_BE_INT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaPosY, READ_BE_INT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaRelSpeedX, READ_BE_INT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaRelSpeedY, READ_BE_INT16(s));
-		s += 2;
-
-		v = READ_BE_INT16(s);
-		s += 2;
-		setAnimParameter(i, kAnimParaOvrTile, v & 0xFC);
-		setAnimParameter(i, kAnimParaPhase, ((v >> 8) & 0xF0) | (v & 3));
-		setAnimParameter(i, kAnimParaPalette, ((v >> 4) & 0x80) | ((v >> 9) & 0x03));
-
-		setAnimParameter(i, kAnimParaTarget, READ_BE_UINT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaF1c, *s++);
-		setAnimParameter(i, kAnimParaTimeStamp, READ_BE_UINT32(s));
-		s += 4;
-		setAnimParameter(i, kAnimParaFrameSeqCounter, *s++);
-		setAnimParameter(i, kAnimParaFrame, READ_BE_UINT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaFrameDelay, READ_BE_UINT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaActionTimer, READ_BE_UINT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaAbsSpeedX, READ_BE_INT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaAbsSpeedY, READ_BE_INT16(s));
-		s += 2;
-	}
-
-	_animSaveLoadDataExt.reset();*/
-
 	_trs->postLoadProcess();
 }
 
diff --git a/engines/snatcher/saveload.cpp b/engines/snatcher/saveload.cpp
index 6279bb893e6..3cc5515bb77 100644
--- a/engines/snatcher/saveload.cpp
+++ b/engines/snatcher/saveload.cpp
@@ -229,8 +229,6 @@ void SaveLoadManager::loadState(int slot, GameState &state) {
 	}
 
 	_vm->_scriptEngine->loadState(in, state.script, flags);
-	//if (!(flags & kSaveFlagsScriptedSave))
-	//	_vm->_cmdQueue->loadState(in);
 	_vm->gfx()->loadState(in, flags);
 	_vm->sound()->loadState(in, flags);
 	_vm->_ui->loadState(in, flags);
@@ -284,8 +282,6 @@ void SaveLoadManager::saveState(int slot, GameState &state, SaveFlags flags) {
 	}
 
 	_vm->_scriptEngine->saveState(out, state.script, flags);
-	//if (!(flags & kSaveFlagsScriptedSave))
-	//	_vm->_cmdQueue->saveState(out);
 	_vm->gfx()->saveState(out, flags);
 	_vm->sound()->saveState(out, flags);
 	_vm->_ui->saveState(out, flags);
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index 37fd096a295..1175903bc8a 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -36,15 +36,13 @@
 
 namespace Snatcher {
 
-CmdQueue::CmdQueue(SnatcherEngine *vm) : _vm(vm), _data(nullptr), _readPos(nullptr), /* _lastReadPos(nullptr), */ _writePos(nullptr), _enable(false), _progress(-1), _currentOpcode(0), _counter(0), _state(nullptr), /* _restoreData(nullptr), _restoreDataSize(0),*/ _opcodes() {
+CmdQueue::CmdQueue(SnatcherEngine *vm) : _vm(vm), _data(nullptr), _readPos(nullptr), _writePos(nullptr), _enable(false), _progress(-1), _currentOpcode(0), _counter(0), _state(nullptr), _opcodes() {
 	_data = new uint16[256]();
 	makeFunctions();
 	reset();
 }
 
 CmdQueue::~CmdQueue() {
-	//delete[] _data;
-	//delete[] _restoreData;
 	for (Common::Array<CmdQueOpcode*>::iterator i = _opcodes.begin(); i != _opcodes.end(); ++ i)
 		delete *i;
 }
@@ -52,7 +50,6 @@ CmdQueue::~CmdQueue() {
 void CmdQueue::reset() {
 	memset(_data, 0, 256);
 	_readPos = _writePos = _data;
-	//_lastReadPos = nullptr;
 	_enable = false;
 	_progress = -1;
 }
@@ -74,7 +71,6 @@ void CmdQueue::run(GameState &state) {
 
 	do {
 		if (_progress == -1) {
-			//_lastReadPos = _readPos;
 			_currentOpcode = *_readPos++;
 			_progress = 0;
 		}
@@ -86,51 +82,6 @@ void CmdQueue::run(GameState &state) {
 	} while (_currentOpcode != 0 && _progress == -1);
 }
 
-/*
-void CmdQueue::loadState(Common::SeekableReadStream *in) {
-	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
-		error("%s(): Save file invalid or corrupt", __FUNCTION__);
-
-	_enable = in->readByte() != 0;
-	if (!_enable)
-		return;
-
-	delete[] _restoreData;
-	_restoreDataSize = in->readUint16BE();
-	_restoreData = new uint16[_restoreDataSize]();
-	assert(_restoreData);
-	for (int i = 0; i < _restoreDataSize; ++i)
-		_restoreData[i] = in->readUint16BE();
-
-	int s = in->readUint16BE();
-	for (int i = 0; i < s; ++i)
-		in->readUint16BE();
-}
-
-void CmdQueue::saveState(Common::SeekableWriteStream *out) {
-	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
-
-	out->writeByte(_enable ? 1 : 0);
-	if (!_enable)
-		return;
-
-	uint16 len = 0;
-	for (const uint16 *p = _data; p < _writePos; ++p)
-		++len;
-	out->writeUint16BE(len);
-	for (const uint16 *p = _data; p < _writePos; ++p)
-		out->writeUint16BE(*p);
-}
-
-void CmdQueue::appendRestoreData() {
-	for (int i = 0; i < _restoreDataSize; ++i)
-		*_writePos++ = _restoreData[i];
-	delete[] _restoreData;
-	_restoreData = nullptr;
-	_restoreDataSize = 0;
-}
-*/
-
 void CmdQueue::makeFunctions() {
 #define OP(x) &CmdQueue::m_##x
 	typedef void (CmdQueue::*SFunc)(const uint16*&);
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index f653113036b..1cc72dfcc7a 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -493,7 +493,6 @@ void SnatcherEngine::updateMainState(GameState &state) {
 			_cmdQueue->writeUInt16(state.script.curGfxScript & 0xFF);
 			_cmdQueue->writeUInt16(0x07);
 			_cmdQueue->writeUInt16(_snd->fmGetStatus().music);
-			//_cmdQueue->appendRestoreData();
 			_snd->pcmBlock(_snd->pcmGetStatus().blocked);
 			_snd->reduceVolume2(_snd->fmGetStatus().reduceVol2);
 			_snd->cdaRestore();
diff --git a/engines/snatcher/transition_scd.cpp b/engines/snatcher/transition_scd.cpp
index 701f96efebe..cf678b85b99 100644
--- a/engines/snatcher/transition_scd.cpp
+++ b/engines/snatcher/transition_scd.cpp
@@ -226,7 +226,7 @@ TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) :
 	_internalState[kVertB].setFactor(-1);
 	_hScrollTable = new int16[0x200]();
 	assert(_hScrollTable);
-	_saveData = new uint8[40]();
+	_saveData = new uint8[2]();
 	assert(_saveData);
 	makeFunctions();
 }
@@ -338,43 +338,12 @@ void TransitionManager_SCD::hINTCallback(void *segaRenderer) {
 
 void TransitionManager_SCD::saveState(Common::SeekableWriteStream *out) {
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
-
-	//out->writeByte(_scrollType);
-	//out->writeByte(_trsCommandExt);
-	//out->writeByte(_trsCommand);
-	//out->writeByte(_resetCommand);
-	//out->writeByte(_nextStep);
-	//out->writeByte(_lastStep);
 	out->writeByte(_lineScrollOp);
-	/* out->writeByte(_nextStepExt);
-	out->writeByte(_lastStepExt);
-	out->writeByte(_restoreDlgTab);
-	out->writeByte(_transitionType);
-	out->writeByte(_subPara);
-	out->writeSint16BE(_transitionState);
-	out->writeSint16BE(_transitionState2);
-	out->writeSint16BE(_transitionStep);
-	out->writeSint16BE(_tmpScrollOffset);
-	out->writeSint16BE(_lineScrollOpState);
-	for (int i = 0; i < 4; ++i) {
-		out->writeSint16BE(_result.realOffsets[i]);
-		out->writeSint16BE(_result.unmodifiedOffsets[i]);
-	}
-
-	uint8 v = _result.busy ? 1: 0;
-	v = (v << 1) | (_result.disableVScroll ? 1 : 0);
-	v = (v << 1) | (_result.verbsTabVisible ? 1 : 0);
-	v = (v << 1) | (_result.hInt.enable ? 1 : 0);
-	v = (v << 1) | (_result.hInt.needUpdate ? 1 : 0);
-	v = (v << 1) | (_useEngineScrollOffsets ? 1 : 0);
-	out->writeByte(v);
-	out->writeByte(_result.hInt.counter);*/
 }
 
 void TransitionManager_SCD::loadState(Common::SeekableReadStream *in) {
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
-	//in->read(_saveData, 40);
 	in->read(_saveData, 1);
 }
 
@@ -383,62 +352,6 @@ void TransitionManager_SCD::postLoadProcess() {
 	_lineScrollOp = *s++;
 	if (_lineScrollOp == 4)
 		doCommand(_lineScrollOp);
-	/*
-	_scrollType = *s++;
-	_trsCommandExt = *s++;
-	_trsCommand = *s++;
-	_resetCommand = *s++;
-	_nextStep = *s++;
-	_lastStep = *s++;
-	_lineScrollOp = *s++;
-	/* _nextStepExt = *s++;
-	_lastStepExt = *s++;
-	_restoreDlgTab = *s++;
-	_transitionType = *s++;
-	_subPara = *s++;
-
-	_transitionState = READ_BE_INT16(s);
-	s += 2;
-	_transitionState2 = READ_BE_INT16(s);
-	s += 2;
-	_transitionStep = READ_BE_INT16(s);
-	s += 2;
-	_tmpScrollOffset = READ_BE_INT16(s);
-	s += 2;
-	_lineScrollOpState = READ_BE_INT16(s);
-	s += 2;
-	for (int i = 0; i < 4; ++i) {
-		_result.realOffsets[i] = READ_BE_INT16(s);
-		s += 2;
-		_result.unmodifiedOffsets[i] = READ_BE_INT16(s);
-		s += 2;
-	}
-
-	uint8 v = *s++;
-	_result.hInt.counter = *s;
-
-	_useEngineScrollOffsets = v & 1;
-	v >>= 1;
-	_result.hInt.needUpdate = v & 1;
-	v >>= 1;
-	_result.hInt.enable = v & 1;
-	v >>= 1;
-	_result.verbsTabVisible = v & 1;
-	v >>= 1;
-	_result.disableVScroll = v & 1;
-	v >>= 1;
-	_result.busy = v & 1;
-
-	if (_lineScrollOp) {
-		v = _nextStep;
-		_nextStep = _lineScrollOp;
-		lineScrollInit();
-		_nextStep = v;
-	}
-
-	int subPara = _subPara;
-	for (_subPara = 0; _subPara < subPara; )
-		processCmdInternal();*/
 }
 
 void TransitionManager_SCD::processCmdInternal() {


Commit: 273de1b1129529679d3eee489d369b42eb2f0df9
    https://github.com/scummvm/scummvm/commit/273de1b1129529679d3eee489d369b42eb2f0df9
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix warning

Changed paths:
    engines/snatcher/palette_scd.cpp


diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index f1229bd31d3..5b64afd7311 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -500,7 +500,7 @@ void SCDPalette::fadeStep(uint16 *modColor, uint16 toR, uint16 toG, uint16 toB)
 void SCDPalette::setHINTHandler(int8 num) {
 	if (num < 0)
 		_hINTHandler = nullptr;
-	else if (num < _hINTProcs.size())
+	else if (num < (int)_hINTProcs.size())
 		_hINTHandler = _hINTProcs[num];
 	else
 		error("%s(): Invalid HINT handler %d", __FUNCTION__, num);


Commit: 005a6303d7d60d062ff7284546e68fd1d95e8bb0
    https://github.com/scummvm/scummvm/commit/005a6303d7d60d062ff7284546e68fd1d95e8bb0
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix engine reset

(e. g. if it asks you if you want to contine playing and you say no)

Changed paths:
    engines/snatcher/snatcher.cpp


diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 1cc72dfcc7a..62f676c606f 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -306,6 +306,7 @@ bool SnatcherEngine::start() {
 				++state.totalPlayTime;
 			}
 		}
+
 		if (_reset)
 			--_reset;
 
@@ -540,9 +541,11 @@ void SnatcherEngine::updateMainState(GameState &state) {
 
 	case 4:
 		// Reset
-		_cmdQueue->writeUInt16(0x02);
-		_cmdQueue->start();
-		_reset = 100;
+		if (_reset == 0) {
+			_cmdQueue->writeUInt16(0x02);
+			_cmdQueue->start();
+			_reset = 100;
+		}
 		break;
 
 	default:


Commit: 6670af18fde6df2e82046c270904cb2af0fa47df
    https://github.com/scummvm/scummvm/commit/6670af18fde6df2e82046c270904cb2af0fa47df
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: remove debug artefacts

Changed paths:
    engines/snatcher/snatcher.cpp


diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 62f676c606f..d685502d997 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -223,7 +223,7 @@ void SnatcherEngine::playBootLogoAnimation(const GameState &state) {
 		delayUntil(nextFrame);
 	}
 }
-int g = 0;
+
 bool SnatcherEngine::start() {
 	Util::rngReset();
 	GameState state;
@@ -263,7 +263,6 @@ bool SnatcherEngine::start() {
 				bool blockedMod = _cmdQueue->enabled();
 				if (_cmdQueue->enabled()) {
 					_cmdQueue->run(state);
-					g = state.script.curPos;
 					blockedMod = _gfx->busy(0);
 				}
 				if (!blockedMod) {


Commit: ae3a3bbdddc6198c219c39309008532fbd2a2383
    https://github.com/scummvm/scummvm/commit/ae3a3bbdddc6198c219c39309008532fbd2a2383
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: remove unused code

Changed paths:
    engines/snatcher/palette_scd.cpp
    engines/snatcher/resource.cpp
    engines/snatcher/resource.h
    engines/snatcher/snatcher.cpp


diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index 5b64afd7311..625b6c06c3e 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -223,7 +223,7 @@ void SCDPalette::selectPalettes(uint32 sel) {
 		if (p == 0xFF)
 			continue;
 		assert(p < ARRAYSIZE(_presetColors));
-		Common::copy<const uint16 *, uint16 *>(_presetColors[p], _presetColors[p + 1], &_colors[i << 4]);
+		Common::copy<const uint16*, uint16*>(_presetColors[p], _presetColors[p + 1], &_colors[i << 4]);
 	}
 	_gfxState.setFlag(7, 0);
 }
diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index c40e2c8b276..a90d535e0b9 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -28,29 +28,7 @@
 
 namespace Snatcher {
 
-class EndianWrapper : public Common::SeekableReadStreamEndian {
-public:
-	EndianWrapper(Common::SeekableReadStream *stream, bool bigEndian, bool disposeAfterUse = true) : Common::SeekableReadStreamEndian(bigEndian), Common::ReadStreamEndian(bigEndian), _stream(stream), _dispose(disposeAfterUse) {}
-	~EndianWrapper() override { if (_dispose) delete _stream; }
-
-	// Common::Stream interface
-	bool err() const override { return _stream->err(); }
-
-	// Common::ReadStream interface
-	bool eos() const override { return _stream->eos(); }
-	uint32 read(void *dataPtr, uint32 dataSize) override { return _stream->read(dataPtr, dataSize); }
-
-	// Common::SeekableReadStream interface
-	int64 pos() const override { return _stream->pos(); }
-	int64 size() const override { return _stream->size(); }
-	bool seek(int64 offset, int whence = SEEK_SET) override { return _stream->seek(offset, whence); }
-
-private:
-	Common::SeekableReadStream *_stream;
-	bool _dispose;
-};
-
-FIO::FIO(SnatcherEngine *vm, bool isBigEndian) : _vm(vm), _bigEndianTarget(isBigEndian), _loadingTimer(0) {
+FIO::FIO(SnatcherEngine *vm) : _vm(vm), _loadingTimer(0) {
 	_files.add("global_search", &SearchMan, 0, false);
 }
 
@@ -105,15 +83,6 @@ Common::SeekableReadStream *FIO::readStream(const Common::Path &file) {
 	return _files.createReadStreamForMember(file);
 }
 
-Common::SeekableReadStreamEndian *FIO::readStreamEndian(int index, EndianMode em) {
-	return (index >= 0 && index < _resFileListSize) ? readStreamEndian(_resFileList[index], em) : nullptr;
-}
-
-Common::SeekableReadStreamEndian *FIO::readStreamEndian(const Common::Path &file, EndianMode em) {
-	Common::SeekableReadStream *stream = readStream(file);
-	return stream ? new EndianWrapper(stream, (em == kForceBE) ? true : (em == kForceLE ? false : _bigEndianTarget)) : nullptr;
-}
-
 const char *FIO::_resFileList[97] = {
 	"DATA_A0.BIN",	"DATA_B0.BIN",	"DATA_D0.BIN",	"DATA_D1.BIN",	"DATA_D2.BIN",	"DATA_F0.BIN",	"DATA_F4.BIN",	"DATA_G0.BIN",
 	"DATA_H00.BIN",	"DATA_H01.BIN",	"DATA_H02.BIN",	"DATA_H03.BIN",	"DATA_H04.BIN",	"DATA_H05.BIN",	"DATA_H06.BIN",	"DATA_H07.BIN",
@@ -165,7 +134,7 @@ const uint8 *ResourcePointer::operator++(int) {
 	return _dataStart + (_offset++);
 }
 
-const uint8 *ResourcePointer::ResourcePointer::operator++() {
+const uint8 *ResourcePointer::operator++() {
 	return _dataStart + (++_offset);
 }
 
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index 19174da5d0a..8a1830568bb 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -116,30 +116,20 @@ private:
 
 class FIO {
 public:
-	FIO(SnatcherEngine *vm, bool isBigEndian);
+	FIO(SnatcherEngine *vm);
 	~FIO();
 
-	enum EndianMode {
-		kPlatformEndianness = 0,
-		kForceLE,
-		kForceBE
-	};
-
 	SceneModule *loadModule(int index);
 	uint8 *fileData(int index, uint32 *fileSize);
 	uint8 *fileData(const Common::Path &file, uint32 *fileSize);
 	bool loadingCompleted();
 	Common::SeekableReadStream *readStream(int index);
 	Common::SeekableReadStream *readStream(const Common::Path &file);
-	Common::SeekableReadStreamEndian *readStreamEndian(int index, EndianMode em = kPlatformEndianness);
-	Common::SeekableReadStreamEndian *readStreamEndian(const Common::Path &file, EndianMode em = kPlatformEndianness);
-
 
 private:
 	Common::SearchSet _files;
 	SnatcherEngine *_vm;
 	uint32 _loadingTimer;
-	bool _bigEndianTarget;
 
 private:
 	static const char *_resFileList[97];
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index d685502d997..9129acfa2bb 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -96,7 +96,7 @@ Common::Error SnatcherEngine::run() {
 }
 
 bool SnatcherEngine::initResource() {
-	_fio = new FIO(this, _game.isBigEndian);
+	_fio = new FIO(this);
 	if (!_fio)
 		return false;
 


Commit: 797a27b6196e2a65252ceed415103b9fd8f51f3d
    https://github.com/scummvm/scummvm/commit/797a27b6196e2a65252ceed415103b9fd8f51f3d
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: add safety checks for script and resource reads

Changed paths:
    engines/snatcher/animator_scd.cpp
    engines/snatcher/resource.cpp
    engines/snatcher/resource.h
    engines/snatcher/script.cpp
    engines/snatcher/script.h
    engines/snatcher/snatcher.cpp


diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index a1257d43322..0eaaf03d3d2 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -1467,14 +1467,14 @@ int Animator_SCD::anim_36(AnimObject &a, const uint8 *data) {
 
 int Animator_SCD::anim_fadeOut(AnimObject &a, const uint8 *data) {
 	static const uint8 cmd[] = { 0x25, 0x00 };
-	ResourcePointer r(cmd, 0);
+	ResourcePointer r(cmd, sizeof(cmd), 0);
 	enqueueDrawCommands(r);
 	return 1;
 }
 
 int Animator_SCD::anim_fadeIn(AnimObject &a, const uint8 *data) {
 	static const uint8 cmd[] = { 0xA4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x20 };
-	ResourcePointer r(cmd, 0);
+	ResourcePointer r(cmd, sizeof(cmd), 0);
 	enqueueDrawCommands(r);
 	return 1;
 }
diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index a90d535e0b9..c8e345c6016 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -101,23 +101,26 @@ const char *FIO::_resFileList[97] = {
 
 const int FIO::_resFileListSize = ARRAYSIZE(_resFileList);
 
-ResourcePointer::ResourcePointer() : _dataStart(nullptr), _writeableDataStart(nullptr), _offset(0), _moduleLocation(0x28000), _ownBuffer(false) {}
+ResourcePointer::ResourcePointer() : _dataStart(nullptr), _dataSize(0), _writeableDataStart(nullptr), _offset(0), _moduleLocation(0x28000), _ownBuffer(false) {}
 
-ResourcePointer::ResourcePointer(const uint8 *data, uint32 offs, uint32 loc, bool assignBufferOwnership) : _dataStart(data), _writeableDataStart(nullptr), _offset(offs), _moduleLocation(loc), _ownBuffer(assignBufferOwnership) {
+ResourcePointer::ResourcePointer(const uint8 *data, uint32 dataSize, uint32 offs, uint32 loc, bool assignBufferOwnership) : _dataStart(data), _dataSize(dataSize), _writeableDataStart(nullptr), _offset(offs), _moduleLocation(loc), _ownBuffer(assignBufferOwnership) {
 	if (_offset >= _moduleLocation)
 		_offset -= _moduleLocation;
+	checkOffset(0, __FUNCTION__);
 }
 
-ResourcePointer::ResourcePointer(uint8 *data, uint32 offs, uint32 loc, bool assignBufferOwnership) : _dataStart(data), _writeableDataStart(data), _offset(offs), _moduleLocation(loc), _ownBuffer(assignBufferOwnership) {
+ResourcePointer::ResourcePointer(uint8 *data, uint32 dataSize, uint32 offs, uint32 loc, bool assignBufferOwnership) : _dataStart(data), _dataSize(dataSize), _writeableDataStart(data), _offset(offs), _moduleLocation(loc), _ownBuffer(assignBufferOwnership) {
 	if (_offset >= _moduleLocation)
 		_offset -= _moduleLocation;
+	checkOffset(0, __FUNCTION__);
+	checkOffset(0, __FUNCTION__);
 }
 
-ResourcePointer::ResourcePointer(const ResourcePointer &ptr) : _dataStart(ptr._dataStart), _offset(ptr._offset), _moduleLocation(ptr._moduleLocation), _writeableDataStart(ptr._writeableDataStart), _ownBuffer(false) {
+ResourcePointer::ResourcePointer(const ResourcePointer &ptr) : _dataStart(ptr._dataStart), _dataSize(ptr._dataSize), _offset(ptr._offset), _moduleLocation(ptr._moduleLocation), _writeableDataStart(ptr._writeableDataStart), _ownBuffer(false) {
 	assert(ptr._ownBuffer == false);
 }
 
-ResourcePointer::ResourcePointer(ResourcePointer &&ptr) noexcept : _dataStart(ptr._dataStart), _offset(ptr._offset), _moduleLocation(ptr._moduleLocation), _writeableDataStart(ptr._writeableDataStart), _ownBuffer(ptr._ownBuffer) {
+ResourcePointer::ResourcePointer(ResourcePointer &&ptr) noexcept : _dataStart(ptr._dataStart), _dataSize(ptr._dataSize), _offset(ptr._offset), _moduleLocation(ptr._moduleLocation), _writeableDataStart(ptr._writeableDataStart), _ownBuffer(ptr._ownBuffer) {
 	ptr._ownBuffer = false;
 }
 
@@ -131,48 +134,58 @@ const uint8 *ResourcePointer::operator()() const {
 }
 
 const uint8 *ResourcePointer::operator++(int) {
+	checkOffset(0, __FUNCTION__);
 	return _dataStart + (_offset++);
 }
 
 const uint8 *ResourcePointer::operator++() {
+	checkOffset(1, __FUNCTION__);
 	return _dataStart + (++_offset);
 }
 
 uint16 ResourcePointer::readUINT16() const {
+	checkOffset(1, __FUNCTION__);
 	return READ_BE_UINT16(_dataStart + _offset);
 }
 
 uint16 ResourcePointer::readSINT16() const {
+	checkOffset(1, __FUNCTION__);
 	return READ_BE_INT16(_dataStart + _offset);
 }
 
 uint32 ResourcePointer::readUINT32() const {
+	checkOffset(3, __FUNCTION__);
 	return READ_BE_UINT32(_dataStart + _offset);
 }
 
 uint32 ResourcePointer::readSINT32() const {
+	checkOffset(3, __FUNCTION__);
 	return READ_BE_INT32(_dataStart + _offset);
 }
 
 uint16 ResourcePointer::readIncrUINT16() {
+	checkOffset(1, __FUNCTION__);
 	uint16 r = READ_BE_UINT16(_dataStart + _offset);
 	_offset += 2;
 	return r;
 }
 
 uint16 ResourcePointer::readIncrSINT16() {
+	checkOffset(1, __FUNCTION__);
 	int16 r = READ_BE_INT16(_dataStart + _offset);
 	_offset += 2;
 	return r;
 }
 
 uint32 ResourcePointer::readIncrUINT32() {
+	checkOffset(3, __FUNCTION__);
 	uint32 r = READ_BE_UINT32(_dataStart + _offset);
 	_offset += 4;
 	return r;
 }
 
 uint32 ResourcePointer::readIncrSINT32() {
+	checkOffset(3, __FUNCTION__);
 	int32 r = READ_BE_INT32(_dataStart + _offset);
 	_offset += 4;
 	return r;
@@ -180,18 +193,20 @@ uint32 ResourcePointer::readIncrSINT32() {
 
 void ResourcePointer::writeUINT16(uint16 value) {
 	assert(_writeableDataStart);
+	checkOffset(1, __FUNCTION__);
 	WRITE_BE_UINT16(_writeableDataStart + _offset, value);
 }
 
 void ResourcePointer::writeUINT32(uint32 value) {
 	assert(_writeableDataStart);
+	checkOffset(3, __FUNCTION__);
 	WRITE_BE_UINT32(_writeableDataStart + _offset, value);
 }
 
 ResourcePointer ResourcePointer::operator+(int inc) const {
 	return _writeableDataStart ?
-		ResourcePointer(_writeableDataStart, _offset + _moduleLocation + inc, _moduleLocation) :
-			ResourcePointer(_dataStart, _offset + _moduleLocation + inc, _moduleLocation);
+		ResourcePointer(_writeableDataStart, _dataSize, _offset + _moduleLocation + inc, _moduleLocation) :
+			ResourcePointer(_dataStart, _dataSize, _offset + _moduleLocation + inc, _moduleLocation);
 }
 
 bool ResourcePointer::operator<(const ResourcePointer &ptr) const {
@@ -219,6 +234,7 @@ void ResourcePointer::operator=(const uint8 *ptr) {
 void ResourcePointer::operator=(const ResourcePointer &ptr) {
 	assert(ptr._ownBuffer == false);
 	_dataStart = ptr._dataStart;
+	_dataSize = ptr._dataSize;
 	_writeableDataStart = ptr._writeableDataStart;
 	_offset = ptr._offset;
 	_moduleLocation = ptr._moduleLocation;
@@ -226,6 +242,7 @@ void ResourcePointer::operator=(const ResourcePointer &ptr) {
 
 void ResourcePointer::operator=(ResourcePointer &&ptr) noexcept {
 	_dataStart = ptr._dataStart;
+	_dataSize = ptr._dataSize;
 	_writeableDataStart = ptr._writeableDataStart;
 	_offset = ptr._offset;
 	_moduleLocation = ptr._moduleLocation;
@@ -234,19 +251,25 @@ void ResourcePointer::operator=(ResourcePointer &&ptr) noexcept {
 }
 
 uint8 ResourcePointer::operator[](int index) const {
+	assert(_offset + index < _dataSize);
 	return _dataStart[_offset + index];
 }
 
 ResourcePointer ResourcePointer::getDataFromTable(int tableEntry) const {
 	return _writeableDataStart ?
-		ResourcePointer(_writeableDataStart, _offset + _moduleLocation + READ_BE_INT16(_dataStart + _offset + tableEntry * 2), _moduleLocation) :
-			ResourcePointer(_dataStart, _offset + _moduleLocation + READ_BE_INT16(_dataStart + _offset + tableEntry * 2), _moduleLocation);
+		ResourcePointer(_writeableDataStart, _dataSize, _offset + _moduleLocation + READ_BE_INT16(_dataStart + _offset + tableEntry * 2), _moduleLocation) :
+			ResourcePointer(_dataStart, _dataSize, _offset + _moduleLocation + READ_BE_INT16(_dataStart + _offset + tableEntry * 2), _moduleLocation);
 }
 
 ResourcePointer ResourcePointer::makePtr(uint32 offs) const {
 	return _writeableDataStart ?
-		ResourcePointer(_writeableDataStart, offs, _moduleLocation) :
-			ResourcePointer(_dataStart, offs, _moduleLocation);
+		ResourcePointer(_writeableDataStart, _dataSize, offs, _moduleLocation) :
+			ResourcePointer(_dataStart, _dataSize, offs, _moduleLocation);
+}
+
+void ResourcePointer::checkOffset(int extraBytes, const char *caller) const {
+	if (_offset + extraBytes >= _dataSize)
+		error("%s(): Offset %d is out of bounds (data size %d)", caller, _offset + extraBytes, _dataSize);
 }
 
 SceneModule::SceneModule(SnatcherEngine *vm, FIO *fio, const char *resFile, int index) : _vm(vm), _fio(fio), _resFile(resFile), _resIndex(index), _data(0), _dataSize(0), _updateHandler(0) {
@@ -261,7 +284,7 @@ SceneModule::~SceneModule() {
 }
 
 ResourcePointer SceneModule::getPtr(int offset) const {
-	return ResourcePointer(_data, offset);
+	return ResourcePointer(_data, _dataSize, offset);
 }
 
 ResourcePointer SceneModule::getGfxData() const {
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index 8a1830568bb..0882436f6d5 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -51,8 +51,8 @@ protected:
 class ResourcePointer {
 public:
 	ResourcePointer();
-	explicit ResourcePointer(const uint8 *data, uint32 offs, uint32 loc = 0x28000, bool assignBufferOwnership = false);
-	explicit ResourcePointer(uint8 *data, uint32 offs, uint32 loc = 0x28000, bool assignBufferOwnership = false);
+	explicit ResourcePointer(const uint8 *data, uint32 dataSize,uint32 offs, uint32 loc = 0x28000, bool assignBufferOwnership = false);
+	explicit ResourcePointer(uint8 *data, uint32 dataSize, uint32 offs, uint32 loc = 0x28000, bool assignBufferOwnership = false);
 	ResourcePointer(const ResourcePointer &ptr);
 	ResourcePointer(ResourcePointer &&ptr) noexcept;
 	~ResourcePointer();
@@ -82,7 +82,10 @@ public:
 	ResourcePointer getDataFromTable(int tableEntry) const;
 	ResourcePointer makePtr(uint32 offs) const;
 private:
+	void checkOffset(int extraBytes, const char *caller) const;
+
 	const uint8 *_dataStart;
+	uint32 _dataSize;
 	uint8 *_writeableDataStart;
 	uint32 _offset;
 	uint32 _moduleLocation;
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index 1175903bc8a..87b99aa14cc 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -644,10 +644,10 @@ void ScriptEngine::runOpcodeOrReadVar(uint16 mode, uint16 &result) {
 		_pos2 = cpos;
 		jump();
 	} else if (mode == 1) {
-		getFlags(READ_BE_UINT16(_script->data + _pos1), result);
+		getFlags(safeReadUINT16(_pos1, __FUNCTION__), result);
 		_pos2 = _pos1 + 2;
 	} else if (mode == 3 || mode == 5) {
-		result = READ_BE_UINT16(_script->data + _pos1);
+		result = safeReadUINT16(_pos1, __FUNCTION__);
 		_pos2 = _pos1 + 2;
 	} else {
 		error("%s(): Invalid opcode length %d", __FUNCTION__, mode);
@@ -705,7 +705,7 @@ uint8 ScriptEngine::countFunctionOps() {
 		if (r2 == 7)
 			break;
 		if (opcodeHasFlag8()) {
-			_pos2 = READ_BE_UINT16(_script->data + _pos2 + 1);
+			_pos2 = safeReadUINT16(_pos2 + 1, __FUNCTION__);
 		} else {
 			++_pos2;
 			jump();
@@ -731,7 +731,7 @@ void ScriptEngine::seekToFunctionOp(int num) {
 			break;
 		}
 		if (opcodeHasFlag8()) {
-			_pos2 = READ_BE_UINT16(_script->data + _pos2 + 1);
+			_pos2 = safeReadUINT16(_pos2 + 1, __FUNCTION__);
 		} else {
 			getOpcodeProperties(r1, r2, r3);
 			if (r1 == 4) {
@@ -761,7 +761,7 @@ bool ScriptEngine::stackOps_checkFor52(uint16 &result) {
 		skipOnFlag8();
 		uint8 op = getOpcode(_pos2);
 		if (op == 52 || op == 53) {
-			result = READ_BE_UINT16(_script->data + _pos2 + 1);
+			result = safeReadUINT16(_pos2 + 1, __FUNCTION__);
 			res = true;
 		}
 	}
@@ -796,7 +796,7 @@ void ScriptEngine::skipOnFlag8() {
 void ScriptEngine::jump() {
 	for (bool lp = true; lp; ) {
 		if (opcodeHasFlag8()) {
-			_pos2 = READ_BE_UINT16(_script->data + _pos2 + 1);
+			_pos2 = safeReadUINT16(_pos2 + 1, __FUNCTION__);
 			continue;
 		}
 		lp = false;
@@ -857,15 +857,21 @@ bool ScriptEngine::setArrayLastEntry(uint16 arrNo, uint16 val) {
 	return true;
 }
 
-uint8 ScriptEngine::getOpcode(int offset) {
-	if ((uint)offset >= _script->dataSize)
-		error("%s(): Offset %d is out of bounds", __FUNCTION__, offset);
+uint8 ScriptEngine::getOpcode(int offset) const {
+	if (offset >= _script->dataSize)
+		error("%s(): Offset %d is out of bounds (data size %d)", __FUNCTION__, offset, _script->dataSize);
 	uint8 op = _script->data[offset];
 	if (op >= _opcodes.size())
 		error("%s(): Opcode %d is out of bounds", __FUNCTION__, op);
 	return op;
 }
 
+uint16 ScriptEngine::safeReadUINT16(uint16 pos, const char *caller) const {
+	if (pos + 2 > _script->dataSize)
+		error("%s(): Offset %d is out of bounds (data size %d)", caller, pos, _script->dataSize);
+	return READ_BE_UINT16(_script->data + pos);
+}
+
 #ifdef SNATCHER_SCRIPT_DEBUG
 int ScriptEngine::ScriptEngineProc::_recursion = 0;
 #endif
@@ -979,8 +985,8 @@ void ScriptEngine::o_animOps() {
 	if (!evalFinished())
 		return;
 	_que->writeUInt16(0x09);
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 4));
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 2));
+	_que->writeUInt16(safeReadUINT16(_pos1 + 4, __FUNCTION__));
+	_que->writeUInt16(safeReadUINT16(_pos1 + 2, __FUNCTION__));
 }
 
 void ScriptEngine::o_evalAdd() {
@@ -1001,14 +1007,14 @@ void ScriptEngine::o_chatWithPortraitAnim() {
 	if (!evalFinished())
 		return;
 	_que->writeUInt16(0x0D);
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
+	_que->writeUInt16(safeReadUINT16(_pos1 + 1, __FUNCTION__));
 }
 
 void ScriptEngine::o_pcmSound() {
 	if (!evalFinished())
 		return;
 	_que->writeUInt16(0x0C);
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
+	_que->writeUInt16(safeReadUINT16(_pos1 + 1, __FUNCTION__));
 }
 
 void ScriptEngine::o_evalAnd() {
@@ -1029,7 +1035,7 @@ void ScriptEngine::o_fmMusicStart() {
 	if (!evalFinished())
 		return;
 	_que->writeUInt16(0x07);
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
+	_que->writeUInt16(safeReadUINT16(_pos1 + 1, __FUNCTION__));
 }
 
 void ScriptEngine::o_runSubScript() {
@@ -1046,7 +1052,7 @@ void ScriptEngine::o_runSubScript() {
 	++_pos2;
 
 	if (m != 5) {
-		uint16 no = READ_BE_UINT16(_script->data + _pos2 + 1);
+		uint16 no = safeReadUINT16(_pos2 + 1, __FUNCTION__);
 		_que->writeUInt16(0x11);
 		_que->writeUInt32(0x1A800);
 		_que->writeUInt16(no);
@@ -1058,13 +1064,13 @@ void ScriptEngine::o_runSubScript() {
 		u = _script->curPos;
 	setArrayLastEntry(3, u);
 
-	_script->newPos = READ_BE_UINT16(_script->data + _pos2);
+	_script->newPos = safeReadUINT16(_pos2, __FUNCTION__);
 }
 
 void ScriptEngine::o_callSubroutine() {
 	uint16 cp = _script->curPos;
 	setArrayLastEntry(5, cp);
-	_pos1 = _script->curPos = READ_BE_UINT16(_script->data + _pos1 + 1);
+	_pos1 = _script->curPos = safeReadUINT16(_pos1 + 1, __FUNCTION__);
 	runOpcode();
 	popArrayLastEntry(5, cp);
 	_script->curPos = cp;
@@ -1074,7 +1080,7 @@ void ScriptEngine::o_cdaPlay() {
 	if (!evalFinished())
 		return;
 	_que->writeUInt16(0x0E);
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
+	_que->writeUInt16(safeReadUINT16(_pos1 + 1, __FUNCTION__));
 
 }
 
@@ -1083,7 +1089,7 @@ void ScriptEngine::o_incrCounter() {
 		return;
 
 	uint16 r1 = 0;
-	uint16 sel = READ_BE_UINT16(_script->data + _pos1 + 1);
+	uint16 sel = safeReadUINT16(_pos1 + 1, __FUNCTION__);
 	getFlags(sel, r1);
 
 	uint16 r2 = (0xFFFFFFFF >> (15 - (sel & 0x0F))) & 0xFFFF;
@@ -1095,7 +1101,7 @@ void ScriptEngine::o_fmSoundEffect() {
 	if (!evalFinished())
 		return;
 	_que->writeUInt16(0x1C);
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
+	_que->writeUInt16(safeReadUINT16(_pos1 + 1, __FUNCTION__));
 }
 
 void ScriptEngine::o_evalEquals() {
@@ -1115,17 +1121,17 @@ void ScriptEngine::o_evalEquals() {
 void ScriptEngine::o_clearFlags() {
 	if (!evalFinished())
 		return;
-	setFlags(READ_BE_UINT16(_script->data + _pos1 + 1), 0);
+	setFlags(safeReadUINT16(_pos1 + 1, __FUNCTION__), 0);
 }
 
 void ScriptEngine::o_setFlags() {
 	if (!evalFinished())
 		return;
-	setFlags(READ_BE_UINT16(_script->data + _pos1 + 1), 0xFFFF);
+	setFlags(safeReadUINT16(_pos1 + 1, __FUNCTION__), 0xFFFF);
 }
 
 void ScriptEngine::o_getPrevPosition() {
-	uint16 n = READ_BE_UINT16(_script->data + _pos1 + 1);
+	uint16 n = safeReadUINT16(_pos1 + 1, __FUNCTION__);
 	if (!getArrayEntry(4, ARR_POS(4) - n, _result))
 		_result = 0xFFFF;
 }
@@ -1162,7 +1168,7 @@ void ScriptEngine::o_doEitherOr() {
 	uint16 f2 = 0;
 	_pos2 = _pos1;
 	getOpcodeProperties(mode, f1, f2);
-	uint16 np = READ_BE_UINT16(_script->data + _pos1 + 1);
+	uint16 np = safeReadUINT16(_pos1 + 1, __FUNCTION__);
 	_pos1 += 3;
 	runOpcodeOrReadVar(mode, _result);
 	_pos1 = _result ? _pos2 : np;
@@ -1191,7 +1197,7 @@ void ScriptEngine::o_setResult() {
 	uint16 f2 = 0;
 	_pos2 = _pos1;
 	getOpcodeProperties(len, mode, f2);
-	uint16 sel = READ_BE_UINT16(_script->data + _pos1 + 1);
+	uint16 sel = safeReadUINT16(_pos1 + 1, __FUNCTION__);
 	_pos1 += 3;
 	runOpcodeOrReadVar(mode, _result);
 	setFlags(sel, _result);
@@ -1254,7 +1260,7 @@ void ScriptEngine::o_break() {
 	getOpcodeProperties(m, f1, f2);
 	++_pos2;
 	if (m != 5) {
-		int num = READ_BE_UINT16(_script->data + _pos2 + 1);
+		int num = safeReadUINT16(_pos2 + 1, __FUNCTION__);
 		_pos2 += 3;
 		if (_script->curFileNo != num) {
 			_script->curFileNo = num;
@@ -1263,7 +1269,7 @@ void ScriptEngine::o_break() {
 			_que->writeUInt16(num);
 		}
 	}
-	_script->newPos = READ_BE_UINT16(_script->data + _pos2);
+	_script->newPos = safeReadUINT16(_pos2, __FUNCTION__);
 }
 
 void ScriptEngine::o_evalTrue() {
@@ -1335,7 +1341,7 @@ void ScriptEngine::o_verbOps() {
 	_pos2 = _pos1;
 
 	if (ARR_POS(2) == _script->sentencePos) {
-		uint16 val = READ_BE_UINT16(_script->data + _pos2 + 1);
+		uint16 val = safeReadUINT16(_pos2 + 1, __FUNCTION__);
 
 		if (!setArrayLastEntry(1, val))
 			debug("Verb array overflow");
@@ -1343,7 +1349,7 @@ void ScriptEngine::o_verbOps() {
 	} else {
 		uint16 val = 0;
 		getArrayEntry(2, _script->sentencePos, val);
-		if (READ_BE_UINT16(_script->data + _pos2 + 1) != val)
+		if (safeReadUINT16(_pos2 + 1, __FUNCTION__) != val)
 			return;
 
 		++_script->sentencePos;
@@ -1386,7 +1392,7 @@ void ScriptEngine::o_checkSubRecurseState() {
 	uint16 f2 = 0;
 	_pos2 = _pos1;
 	getOpcodeProperties(m, f1, f2);
-	uint16 val = READ_BE_UINT16(_script->data + _pos2 + 1);
+	uint16 val = safeReadUINT16(_pos2 + 1, __FUNCTION__);
 	if (m == 5) {
 		_result = 0;
 		for (int i = 0; i < ARR_POS(5) && !_result; ++i) {
@@ -1424,7 +1430,7 @@ void ScriptEngine::o_loadModuleAndStartGfx() {
 }
 
 void ScriptEngine::o_randomSwitch() {
-	uint16 sel = READ_BE_UINT16(_script->data + _pos1 + 1);
+	uint16 sel = safeReadUINT16(_pos1 + 1, __FUNCTION__);
 	_pos2 = _pos1 + 3;
 	uint16 f = Util::rngGetNumberFromRange(1, countFunctionOps()) & 0xFF;
 	_pos2 = _pos1 + 3;
@@ -1437,7 +1443,7 @@ void ScriptEngine::o_randomSwitch() {
 void ScriptEngine::o_sequentialSwitch() {
 	_pos2 = _pos1 + 3;
 	uint16 cnt = countFunctionOps();
-	uint16 sel = READ_BE_UINT16(_script->data + _pos1 + 1);
+	uint16 sel = safeReadUINT16(_pos1 + 1, __FUNCTION__);
 	uint16 val = 0;
 	getFlags(sel, val);
 	_pos2 = _pos1 + 3;
@@ -1461,7 +1467,7 @@ void ScriptEngine::o_sysOps() {
 	_pos2 = _pos1;
 	getOpcodeProperties(m, f1, f2);
 	_pos2 += (m == 4 ? 2 : 1);
-	uint16 sub = READ_BE_UINT16(_script->data + _pos2);
+	uint16 sub = safeReadUINT16(_pos2, __FUNCTION__);
 	uint16 addr = 0;
 	uint16 val = 0;
 
@@ -1473,7 +1479,7 @@ void ScriptEngine::o_sysOps() {
 	case 1:
 		// Save game state
 		_que->writeUInt16(0x1E);
-		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 4));
+		_que->writeUInt16(safeReadUINT16(_pos1 + 4, __FUNCTION__));
 		if (!getArrayEntry(5, 0, _script->temp.curPos))
 			_script->temp.curPos = _script->curPos;
 		_script->temp.curFileNo = _script->curFileNo;
@@ -1491,7 +1497,7 @@ void ScriptEngine::o_sysOps() {
 		break;
 	case 4:
 		// Start action sequence
-		_aseq->setup(READ_BE_UINT16(_script->data + _pos1 + 4));
+		_aseq->setup(safeReadUINT16(_pos1 + 4, __FUNCTION__));
 		_que->writeUInt16(0x18);
 		break;
 	case 5:
@@ -1499,41 +1505,41 @@ void ScriptEngine::o_sysOps() {
 		// the sub cpu memory. It is limited to 16bit addresses at least. I hope
 		// that in practice, this will only happen for some global variables. We
 		// will just have to catch every case whenever a new address comes up...
-		addr = READ_BE_UINT16(_script->data + _pos1 + 4);
+		addr = safeReadUINT16(_pos1 + 4, __FUNCTION__);
 		_result = _mem->readWord(addr);
 		break;
 	case 6:
 		// See case 5
-		addr = READ_BE_UINT16(_script->data + _pos1 + 5);
-		val = READ_BE_UINT16(_script->data + _pos1 + 7);
+		addr = safeReadUINT16(_pos1 + 5, __FUNCTION__);
+		val = safeReadUINT16(_pos1 + 7, __FUNCTION__);
 		_mem->writeWord(addr, val);
 		break;
 	case 7:
 		// Block pcm sounds
 		_que->writeUInt16(0x1D);
-		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 4) ? 1 : 0);
+		_que->writeUInt16(safeReadUINT16(_pos1 + 4, __FUNCTION__) ? 1 : 0);
 		break;
 	case 8:
-		if (READ_BE_UINT16(_script->data + _pos1 + 4) == 0) {
+		if (safeReadUINT16(_pos1 + 4, __FUNCTION__) == 0) {
 			_que->writeUInt16(0x09);
 			_que->writeUInt16(0x02);
 			_que->writeUInt16(0x01);
 		} else {
 			// Show inventory item close-up
 			_que->writeUInt16(0x15);
-			_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 8));
-			_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 10));
+			_que->writeUInt16(safeReadUINT16(_pos1 + 8, __FUNCTION__));
+			_que->writeUInt16(safeReadUINT16(_pos1 + 10, __FUNCTION__));
 		}
 		break;
 	case 9:
-		_script->phase = READ_BE_UINT16(_script->data + _pos1 + 4) + 2;
+		_script->phase = safeReadUINT16(_pos1 + 4, __FUNCTION__) + 2;
 		break;
 	case 10:
-		val = READ_BE_UINT16(_script->data + _pos1 + 4);
+		val = safeReadUINT16(_pos1 + 4, __FUNCTION__);
 		_ui->setVerbInterfaceMode(val);
 		break;
 	case 11:
-		if (READ_BE_UINT16(_script->data + _pos1 + 4)) {
+		if (safeReadUINT16(_pos1 + 4, __FUNCTION__)) {
 			_mem->restoreTempState();
 			_script->phase = 1;
 		} else {
@@ -1549,9 +1555,9 @@ void ScriptEngine::o_sysOps() {
 	case 13:
 		// CD-Audio sync
 		_que->writeUInt16(0x1B);
-		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 5));
-		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 8));
-		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 10));
+		_que->writeUInt16(safeReadUINT16(_pos1 + 5, __FUNCTION__));
+		_que->writeUInt16(safeReadUINT16(_pos1 + 8, __FUNCTION__));
+		_que->writeUInt16(safeReadUINT16(_pos1 + 10, __FUNCTION__));
 		break;
 	default:
 		break;
@@ -1572,12 +1578,12 @@ void ScriptEngine::o_displayDialog() {
 
 	_que->writeUInt16(0x08);
 	if (m == 4) {
-		_que->writeUInt16(READ_BE_UINT16(_script->data + _pos2 + 1));
+		_que->writeUInt16(safeReadUINT16(_pos2 + 1, __FUNCTION__));
 		_pos2 += 3;
 	} else {
 		_que->writeUInt16(0);
 	}
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos2));
+	_que->writeUInt16(safeReadUINT16(_pos2, __FUNCTION__));
 }
 
 void ScriptEngine::o_animWait() {
@@ -1585,7 +1591,7 @@ void ScriptEngine::o_animWait() {
 		return;
 	_que->writeUInt16(0x09);
 	_que->writeUInt16(0x03);
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
+	_que->writeUInt16(safeReadUINT16(_pos1 + 1, __FUNCTION__));
 }
 
 void ScriptEngine::o_pcmSoundWait() {
@@ -1612,7 +1618,7 @@ void ScriptEngine::o_waitFrames() {
 	if (!evalFinished())
 		return;
 	_que->writeUInt16(0x10);
-	_que->writeUInt16(READ_BE_UINT16(_script->data + _pos1 + 1));
+	_que->writeUInt16(safeReadUINT16(_pos1 + 1, __FUNCTION__));
 }
 
 #undef ARR_SIZE
diff --git a/engines/snatcher/script.h b/engines/snatcher/script.h
index 1d9aa8c3b8b..0eaf1313a67 100644
--- a/engines/snatcher/script.h
+++ b/engines/snatcher/script.h
@@ -187,7 +187,8 @@ private:
 	bool getArrayEntry(uint16 arrNo, uint8 pos, uint16 &result);
 	bool setArrayLastEntry(uint16 arrNo, uint16 val);
 
-	uint8 getOpcode(int offset);
+	uint8 getOpcode(int offset) const;
+	uint16 safeReadUINT16(uint16 pos, const char *caller) const;
 
 private:
 	void makeOpcodeTable(ResourcePointer *scd);
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 9129acfa2bb..d32f65fa2a2 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -104,7 +104,7 @@ bool SnatcherEngine::initResource() {
 	uint8 *data = _fio->fileData(96, &size);
 	if (!data)
 		return false;
-	_scd = new ResourcePointer(data, 0, 0xD400, true);
+	_scd = new ResourcePointer(data, size, 0, 0xD400, true);
 	if (!_scd)
 		return false;
 


Commit: 5815b8e102d917c8f41bed76353ec2d0fb3c203d
    https://github.com/scummvm/scummvm/commit/5815b8e102d917c8f41bed76353ec2d0fb3c203d
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix warnings

Changed paths:
    engines/snatcher/memory.h
    engines/snatcher/script.cpp


diff --git a/engines/snatcher/memory.h b/engines/snatcher/memory.h
index 83b8fa5bd4c..261667e57d3 100644
--- a/engines/snatcher/memory.h
+++ b/engines/snatcher/memory.h
@@ -41,7 +41,7 @@ struct GameState;
 
 class MemAccessHandler {
 public:
-	MemAccessHandler(SnatcherEngine *vm, UI *ui, ActionSequenceHandler *aseq, SaveLoadManager *saveMan) : _vm(vm), _ui(ui), _aseq(aseq), _saveMan(saveMan) {}
+	MemAccessHandler(SnatcherEngine *vm, UI *ui, ActionSequenceHandler *aseq, SaveLoadManager *saveMan) : _vm(vm), _ui(ui), _aseq(aseq), _saveMan(saveMan), _state(nullptr) {}
 	~MemAccessHandler() {}
 
 	uint16 readWord(uint16 addr);
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index 87b99aa14cc..b821deaeb68 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -482,13 +482,13 @@ ScriptEngine::~ScriptEngine() {
 }
 
 void ScriptEngine::resetArrays() {
-	static const uint8 arraySizes[] = { 0x08, 0x1F, 0x0F, 0x12, 0x03, 0x10 };
+	const int arraySizes[] = { 0x08, 0x1F, 0x0F, 0x12, 0x03, 0x10 };
 	memset(_arrayData, 0, 256);
 
 	uint8 *pos = _arrayData;
-	for (int i = 0; i < ARRAYSIZE(_arrays); ++i) {
-		_arrays[i] = ScriptArray(pos , arraySizes[i]);
-		pos += ((arraySizes[i] + 1) << 1);
+	for (uint i = 0; i < ARRAYSIZE(_arrays); ++i) {
+		_arrays[i] = ScriptArray(pos, arraySizes[i]);
+		pos += ((arraySizes[i] + 1) * 2);
 	}
 }
 


Commit: e68ee254c2290fb9fb64db5f7019640e3dc5e65f
    https://github.com/scummvm/scummvm/commit/e68ee254c2290fb9fb64db5f7019640e3dc5e65f
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: more cleanup

- add some names for mem locations
- fix new warnings

Changed paths:
    engines/snatcher/animator_scd.cpp
    engines/snatcher/mem_mapping.cpp
    engines/snatcher/mem_mapping.h
    engines/snatcher/resource.cpp
    engines/snatcher/resource.h
    engines/snatcher/script.cpp
    engines/snatcher/snatcher.cpp


diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index 0eaaf03d3d2..04f0d1ffc8c 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -1467,14 +1467,14 @@ int Animator_SCD::anim_36(AnimObject &a, const uint8 *data) {
 
 int Animator_SCD::anim_fadeOut(AnimObject &a, const uint8 *data) {
 	static const uint8 cmd[] = { 0x25, 0x00 };
-	ResourcePointer r(cmd, sizeof(cmd), 0);
+	ResourcePointer r(cmd, sizeof(cmd), 0, 0);
 	enqueueDrawCommands(r);
 	return 1;
 }
 
 int Animator_SCD::anim_fadeIn(AnimObject &a, const uint8 *data) {
 	static const uint8 cmd[] = { 0xA4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x20 };
-	ResourcePointer r(cmd, sizeof(cmd), 0);
+	ResourcePointer r(cmd, sizeof(cmd), 0, 0);
 	enqueueDrawCommands(r);
 	return 1;
 }
diff --git a/engines/snatcher/mem_mapping.cpp b/engines/snatcher/mem_mapping.cpp
index 2825d0a9417..36f84332e15 100644
--- a/engines/snatcher/mem_mapping.cpp
+++ b/engines/snatcher/mem_mapping.cpp
@@ -79,6 +79,10 @@ uint32 MEM_RAWDATA_04                	=	0;
 uint32 MEM_RAWDATA_05                	=	0;
 uint32 MEM_RAWDATA_06                	=	0;
 
+uint32 MEM_MODULE_LOCATION				=	0;
+uint32 MEM_SCRIPT_LOCATION				=	0;
+uint32 MEM_SUBCODE_LOCATION				=	0;
+
 void initMapping(int mappingNum) {
 	MEM_GFXDATA_00                	=	0x0ECB6;
 	MEM_RAWDATA_00                	=	0x100D8;
@@ -134,6 +138,10 @@ void initMapping(int mappingNum) {
 	MEM_RAWDATA_05                	=	0x14EAC;
 	MEM_RAWDATA_06                	=	0x16CDC;
 
+	MEM_MODULE_LOCATION				=	0x28000;
+	MEM_SCRIPT_LOCATION				=	0x1A800;
+	MEM_SUBCODE_LOCATION			=	0xD400;
+
 	if (mappingNum == 1)
 		MEM_RAWDATA_06              =	0x16CEC;
 }
diff --git a/engines/snatcher/mem_mapping.h b/engines/snatcher/mem_mapping.h
index 468bcef5671..7dea71aaaff 100644
--- a/engines/snatcher/mem_mapping.h
+++ b/engines/snatcher/mem_mapping.h
@@ -82,6 +82,10 @@ extern uint32 MEM_RAWDATA_04;
 extern uint32 MEM_RAWDATA_05;
 extern uint32 MEM_RAWDATA_06;
 
+extern uint32 MEM_MODULE_LOCATION;
+extern uint32 MEM_SCRIPT_LOCATION;
+extern uint32 MEM_SUBCODE_LOCATION;
+
 extern void initMapping(int mappingNum);
 
 } // End of namespace MemMapping
diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index c8e345c6016..58e08573e3e 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -19,6 +19,8 @@
 *
 */
 
+
+#include "snatcher/mem_mapping.h"
 #include "snatcher/resource.h"
 #include "snatcher/snatcher.h"
 #include "snatcher/scene.h"
@@ -101,7 +103,7 @@ const char *FIO::_resFileList[97] = {
 
 const int FIO::_resFileListSize = ARRAYSIZE(_resFileList);
 
-ResourcePointer::ResourcePointer() : _dataStart(nullptr), _dataSize(0), _writeableDataStart(nullptr), _offset(0), _moduleLocation(0x28000), _ownBuffer(false) {}
+ResourcePointer::ResourcePointer() : _dataStart(nullptr), _dataSize(0), _writeableDataStart(nullptr), _offset(0), _moduleLocation(MemMapping::MEM_MODULE_LOCATION), _ownBuffer(false) {}
 
 ResourcePointer::ResourcePointer(const uint8 *data, uint32 dataSize, uint32 offs, uint32 loc, bool assignBufferOwnership) : _dataStart(data), _dataSize(dataSize), _writeableDataStart(nullptr), _offset(offs), _moduleLocation(loc), _ownBuffer(assignBufferOwnership) {
 	if (_offset >= _moduleLocation)
@@ -251,7 +253,7 @@ void ResourcePointer::operator=(ResourcePointer &&ptr) noexcept {
 }
 
 uint8 ResourcePointer::operator[](int index) const {
-	assert(_offset + index < _dataSize);
+	checkOffset(index, __FUNCTION__);
 	return _dataStart[_offset + index];
 }
 
@@ -284,7 +286,7 @@ SceneModule::~SceneModule() {
 }
 
 ResourcePointer SceneModule::getPtr(int offset) const {
-	return ResourcePointer(_data, _dataSize, offset);
+	return ResourcePointer(_data, _dataSize, offset, MemMapping::MEM_MODULE_LOCATION);
 }
 
 ResourcePointer SceneModule::getGfxData() const {
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index 0882436f6d5..511b5362563 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -51,8 +51,8 @@ protected:
 class ResourcePointer {
 public:
 	ResourcePointer();
-	explicit ResourcePointer(const uint8 *data, uint32 dataSize,uint32 offs, uint32 loc = 0x28000, bool assignBufferOwnership = false);
-	explicit ResourcePointer(uint8 *data, uint32 dataSize, uint32 offs, uint32 loc = 0x28000, bool assignBufferOwnership = false);
+	explicit ResourcePointer(const uint8 *data, uint32 dataSize, uint32 offs, uint32 loc, bool assignBufferOwnership = false);
+	explicit ResourcePointer(uint8 *data, uint32 dataSize, uint32 offs, uint32 loc, bool assignBufferOwnership = false);
 	ResourcePointer(const ResourcePointer &ptr);
 	ResourcePointer(ResourcePointer &&ptr) noexcept;
 	~ResourcePointer();
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index b821deaeb68..43d73d0d285 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -136,7 +136,7 @@ void CmdQueue::m_end(const uint16 *&data) {
 void CmdQueue::m_initAnimations(const uint16 *&data) {
 	uint32 addr = *reinterpret_cast<const uint32*>(data);
 	data += 2;
-	ResourcePointer in = (addr >= 0x28000 ? _vm->_module->getPtr(addr) : _vm->_scd->makePtr(addr));
+	ResourcePointer in = (addr >= MemMapping::MEM_MODULE_LOCATION ? _vm->_module->getPtr(addr) : _vm->_scd->makePtr(addr));
 	uint16 len = 0;
 	const uint8 *s = in();
 	int dbgTimeout = 0;
@@ -172,7 +172,7 @@ void CmdQueue::m_animPauseAll(const uint16 *&data) {
 void CmdQueue::m_drawCommands(const uint16 *&data) {
 	uint32 addr = *reinterpret_cast<const uint32*>(data);
 	data += 2;
-	_vm->gfx()->enqueueDrawCommands(addr >= 0x28000 ? _vm->_module->getPtr(addr) : _vm->_scd->makePtr(addr));
+	_vm->gfx()->enqueueDrawCommands(addr >= MemMapping::MEM_MODULE_LOCATION ? _vm->_module->getPtr(addr) : _vm->_scd->makePtr(addr));
 	_progress = -1;
 }
 
@@ -186,7 +186,7 @@ void CmdQueue::m_printText(const uint16 *&data) {
 		return;
 	uint32 addr = *reinterpret_cast<const uint32*>(data);
 	data += 2;
-	_vm->gfx()->printText(addr >= 0x28000 ? _vm->_module->getPtr(addr)() : _vm->_scd->makePtr(addr)());
+	_vm->gfx()->printText(addr >= MemMapping::MEM_MODULE_LOCATION ? _vm->_module->getPtr(addr)() : _vm->_scd->makePtr(addr)());
 	_progress = -1;
 }
 
@@ -332,12 +332,12 @@ void CmdQueue::m_loadResource(const uint16 *&data) {
 		uint16 index = *data++;
 		++_progress;
 
-		if (dest == 0x1A800) {
+		if (dest == MemMapping::MEM_SCRIPT_LOCATION) {
 			delete[] _state->script.data;
 			_state->script.data = _vm->_fio->fileData(index, &_state->script.dataSize);
 			assert(_state->script.data);
 			_vm->_ui->setScriptTextResource(_state->script.getTextResource());
-		} else if (dest == 0x28000) {
+		} else if (dest == MemMapping::MEM_MODULE_LOCATION) {
 			delete _vm->_module;
 			_vm->_module = _vm->_fio->loadModule(index);
 			assert(_vm->_module);
@@ -456,7 +456,7 @@ void CmdQueue::m_waitForStartButton(const uint16 *&data) {
 
 void CmdQueue::m_palOps(const uint16 *&data) {
 	uint32 addr = *reinterpret_cast<const uint32*>(data);
-	_vm->gfx()->enqueuePaletteEvent(addr >= 0x28000 ? _vm->_module->getPtr(addr) : _vm->_scd->makePtr(addr));
+	_vm->gfx()->enqueuePaletteEvent(addr >= MemMapping::MEM_MODULE_LOCATION ? _vm->_module->getPtr(addr) : _vm->_scd->makePtr(addr));
 	data += 2;
 	_progress = -1;
 }
@@ -858,7 +858,7 @@ bool ScriptEngine::setArrayLastEntry(uint16 arrNo, uint16 val) {
 }
 
 uint8 ScriptEngine::getOpcode(int offset) const {
-	if (offset >= _script->dataSize)
+	if ((uint)offset >= _script->dataSize)
 		error("%s(): Offset %d is out of bounds (data size %d)", __FUNCTION__, offset, _script->dataSize);
 	uint8 op = _script->data[offset];
 	if (op >= _opcodes.size())
@@ -867,7 +867,7 @@ uint8 ScriptEngine::getOpcode(int offset) const {
 }
 
 uint16 ScriptEngine::safeReadUINT16(uint16 pos, const char *caller) const {
-	if (pos + 2 > _script->dataSize)
+	if ((uint)pos + 2 > _script->dataSize)
 		error("%s(): Offset %d is out of bounds (data size %d)", caller, pos, _script->dataSize);
 	return READ_BE_UINT16(_script->data + pos);
 }
@@ -1054,7 +1054,7 @@ void ScriptEngine::o_runSubScript() {
 	if (m != 5) {
 		uint16 no = safeReadUINT16(_pos2 + 1, __FUNCTION__);
 		_que->writeUInt16(0x11);
-		_que->writeUInt32(0x1A800);
+		_que->writeUInt32(MemMapping::MEM_SCRIPT_LOCATION);
 		_que->writeUInt16(no);
 		_script->curFileNo = no;
 		_pos2 += 3;
@@ -1265,7 +1265,7 @@ void ScriptEngine::o_break() {
 		if (_script->curFileNo != num) {
 			_script->curFileNo = num;
 			_que->writeUInt16(0x11);
-			_que->writeUInt32(0x1A800);
+			_que->writeUInt32(MemMapping::MEM_SCRIPT_LOCATION);
 			_que->writeUInt16(num);
 		}
 	}
@@ -1381,7 +1381,7 @@ void ScriptEngine::o_returnFromSubScript() {
 	if (_script->curFileNo == res)
 		return;
 	_que->writeUInt16(0x11);
-	_que->writeUInt32(0x1A800);
+	_que->writeUInt32(MemMapping::MEM_SCRIPT_LOCATION);
 	_que->writeUInt16(res);
 	_script->curFileNo = res;
 }
@@ -1419,7 +1419,7 @@ void ScriptEngine::o_loadModuleAndStartGfx() {
 
 	if ((_script->curGfxScript >> 8) != (num >> 8)) {
 		_que->writeUInt16(0x11);
-		_que->writeUInt32(0x28000);
+		_que->writeUInt32(MemMapping::MEM_MODULE_LOCATION);
 		_que->writeUInt16(num >> 8);
 	}
 
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index d32f65fa2a2..ebc1f4abc02 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -54,6 +54,7 @@ SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(s
 	_scriptEngine(nullptr), _cmdQueue(nullptr), _aseq(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _enableLightGun(false), _ui(nullptr), _gfxInfo(), _saveMan(nullptr), _reset(0),
 		_updateGameSettings(false), _memHandler(nullptr), _frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
 	assert(system);
+	MemMapping::initMapping(_game.usePALTiming ? 1 : 0);
 }
 
 SnatcherEngine::~SnatcherEngine() {
@@ -104,12 +105,10 @@ bool SnatcherEngine::initResource() {
 	uint8 *data = _fio->fileData(96, &size);
 	if (!data)
 		return false;
-	_scd = new ResourcePointer(data, size, 0, 0xD400, true);
+	_scd = new ResourcePointer(data, size, 0, MemMapping::MEM_SUBCODE_LOCATION, true);
 	if (!_scd)
 		return false;
 
-	MemMapping::initMapping(_game.usePALTiming ? 1 : 0);
-
 	return true;
 }
 
@@ -474,7 +473,7 @@ void SnatcherEngine::updateMainState(GameState &state) {
 	case 1:
 		// Init first scene or load savegame
 		_cmdQueue->writeUInt16(0x11);
-		_cmdQueue->writeUInt32(0x1A800);
+		_cmdQueue->writeUInt32(MemMapping::MEM_SCRIPT_LOCATION);
 		if (state.menuSelect == 0)
 			state.script.curFileNo = 0x3F; // First scene
 		_cmdQueue->writeUInt16(state.script.curFileNo);
@@ -482,7 +481,7 @@ void SnatcherEngine::updateMainState(GameState &state) {
 		if (state.menuSelect != 0) {
 			// Restore saved state
 			_cmdQueue->writeUInt16(0x11);
-			_cmdQueue->writeUInt32(0x28000);
+			_cmdQueue->writeUInt32(MemMapping::MEM_MODULE_LOCATION);
 			_cmdQueue->writeUInt16(state.script.curGfxScript >> 8);
 			if (_snd->pcmGetStatus().resourceId2 != -1) {
 				_cmdQueue->writeUInt16(0x0D);


Commit: 4fc7773964f0bbbb4a02517a33305ec431bf8173
    https://github.com/scummvm/scummvm/commit/4fc7773964f0bbbb4a02517a33305ec431bf8173
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix component deps

Changed paths:
    engines/snatcher/configure.engine


diff --git a/engines/snatcher/configure.engine b/engines/snatcher/configure.engine
index ad1b48f45de..14ef5629b8c 100644
--- a/engines/snatcher/configure.engine
+++ b/engines/snatcher/configure.engine
@@ -1,3 +1,3 @@
 # This file is included from the main "configure" script
 # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine snatcher "Snatcher" no
+add_engine snatcher "Snatcher" no "" "" "fmtowns_pc98_audio"


Commit: 400d6e6c0fa530595ac8343ddbcedf46b157bc1c
    https://github.com/scummvm/scummvm/commit/400d6e6c0fa530595ac8343ddbcedf46b157bc1c
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: add more mem address labels

Changed paths:
    engines/snatcher/action.cpp
    engines/snatcher/mem_mapping.cpp
    engines/snatcher/mem_mapping.h
    engines/snatcher/scene_d0.cpp
    engines/snatcher/scene_d1.cpp
    engines/snatcher/scene_d2.cpp
    engines/snatcher/scene_y16.cpp
    engines/snatcher/snatcher.cpp
    engines/snatcher/ui.cpp


diff --git a/engines/snatcher/action.cpp b/engines/snatcher/action.cpp
index 2e562d8d149..ccbb52c483f 100644
--- a/engines/snatcher/action.cpp
+++ b/engines/snatcher/action.cpp
@@ -73,10 +73,10 @@ bool ActionSequenceHandler::run(bool useLightGun) {
 			if (_stage == 0 || _stage == 11) {
 				_progressLSB += 2;
 			} else {
-				_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_02));
+				_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_05));
 				if (_stage != 5) {
-					_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_01));
-					_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_03));
+					_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_04));
+					_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_06));
 				}
 				++_progressLSB;
 			}
@@ -213,7 +213,7 @@ bool ActionSequenceHandler::run(bool useLightGun) {
 				if (++_counter1 < 2)
 					break;
 				_counter1 = 0;
-				_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_04));
+				_vm->gfx()->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_07));
 			}
 			++_progressLSB;
 			break;
diff --git a/engines/snatcher/mem_mapping.cpp b/engines/snatcher/mem_mapping.cpp
index 36f84332e15..dbfb4d9a31a 100644
--- a/engines/snatcher/mem_mapping.cpp
+++ b/engines/snatcher/mem_mapping.cpp
@@ -26,22 +26,30 @@ namespace Snatcher {
 namespace MemMapping {
 
 uint32 MEM_GFXDATA_00                	=	0;
+uint32 MEM_GFXDATA_01                	=	0;
+uint32 MEM_GFXDATA_02                	=	0;
 uint32 MEM_RAWDATA_00                	=	0;
 uint32 MEM_UIDATA_00                 	=	0;
+uint32 MEM_VERBDATA_00					=	0;
+uint32 MEM_VERBDATA_01					=	0;
+uint32 MEM_VERBDATA_02					=	0;
+uint32 MEM_VERBDATA_03					=	0;
 uint32 MEM_UIDATA_01                 	=	0;
 uint32 MEM_UIDATA_02                 	=	0;
 uint32 MEM_UIDATA_03                 	=	0;
 uint32 MEM_UIDATA_04                 	=	0;
+uint32 MEM_VERBDATA_04					=	0;
+uint32 MEM_VERBDATA_05					=	0;
 uint32 MEM_UIDATA_05                 	=	0;
 uint32 MEM_PALDATA_00                	=	0;
 uint32 MEM_PALDATA_01                	=	0;
 uint32 MEM_PALDATA_02                	=	0;
 uint32 MEM_PALDATA_03                	=	0;
 uint32 MEM_PALDATA_04                	=	0;
-uint32 MEM_GFXDATA_01                	=	0;
-uint32 MEM_GFXDATA_02                	=	0;
-uint32 MEM_GFXDATA_03                	=	0;
 uint32 MEM_GFXDATA_04                	=	0;
+uint32 MEM_GFXDATA_05                	=	0;
+uint32 MEM_GFXDATA_06                	=	0;
+uint32 MEM_GFXDATA_07                	=	0;
 uint32 MEM_ACTIONSEQDATA_00          	=	0;
 uint32 MEM_ACTIONSEQDATA_01          	=	0;
 uint32 MEM_ACTIONSEQDATA_02          	=	0;
@@ -70,14 +78,30 @@ uint32 MEM_UIDATA_07                 	=	0;
 uint32 MEM_UIDATA_08                 	=	0;
 uint32 MEM_UIDATA_09                 	=	0;
 uint32 MEM_UIDATA_10                 	=	0;
+uint32 MEM_PALDATA_06                	=	0;
 uint32 MEM_RAWDATA_01                	=	0;
 uint32 MEM_RAWDATA_02                	=	0;
 uint32 MEM_RAWDATA_03                	=	0;
-uint32 MEM_PALDATA_06                	=	0;
-uint32 MEM_GFXDATA_05                	=	0;
+uint32 MEM_PALDATA_07                	=	0;
+uint32 MEM_GFXDATA_10                	=	0;
 uint32 MEM_RAWDATA_04                	=	0;
 uint32 MEM_RAWDATA_05                	=	0;
 uint32 MEM_RAWDATA_06                	=	0;
+uint32 MEM_PALDATA_10                	=	0;
+uint32 MEM_PALDATA_11                	=	0;
+uint32 MEM_PALDATA_12                	=	0;
+uint32 MEM_TIMERDATA_00					=	0;
+uint32 MEM_TIMERDATA_01					=	0;
+uint32 MEM_PALDATA_20                	=	0;
+uint32 MEM_PALDATA_21                	=	0;
+uint32 MEM_PALDATA_22                	=	0;
+uint32 MEM_PALDATA_23                	=	0;
+uint32 MEM_PALDATA_30                	=	0;
+uint32 MEM_PALDATA_31                	=	0;
+uint32 MEM_TIMERDATA_02					=	0;
+uint32 MEM_PALDATA_40                	=	0;
+uint32 MEM_PALDATA_41                	=	0;
+uint32 MEM_PALDATA_42                	=	0;
 
 uint32 MEM_MODULE_LOCATION				=	0;
 uint32 MEM_SCRIPT_LOCATION				=	0;
@@ -85,22 +109,30 @@ uint32 MEM_SUBCODE_LOCATION				=	0;
 
 void initMapping(int mappingNum) {
 	MEM_GFXDATA_00                	=	0x0ECB6;
+	MEM_GFXDATA_01                	=	0x0ECC4;
+	MEM_GFXDATA_02                	=	0x0ED0E;
 	MEM_RAWDATA_00                	=	0x100D8;
 	MEM_UIDATA_00                 	=	0x109E8;
+	MEM_VERBDATA_00					=	0x10EFA;
+	MEM_VERBDATA_01					=	0x10F10;
+	MEM_VERBDATA_02					=	0x10F26;
+	MEM_VERBDATA_03					=	0x11454;
 	MEM_UIDATA_01                 	=	0x114DC;
 	MEM_UIDATA_02                 	=	0x11512;
 	MEM_UIDATA_03                 	=	0x115CA;
 	MEM_UIDATA_04                 	=	0x11938;
+	MEM_VERBDATA_04					=	0x11942;
+	MEM_VERBDATA_05					=	0x11946;
 	MEM_UIDATA_05                 	=	0x11D12;
 	MEM_PALDATA_00                	=	0x11E6A;
 	MEM_PALDATA_01                	=	0x11E74;
 	MEM_PALDATA_02                	=	0x11E7E;
 	MEM_PALDATA_03                	=	0x11E8C;
 	MEM_PALDATA_04                	=	0x11E92;
-	MEM_GFXDATA_01                	=	0x11ED8;
-	MEM_GFXDATA_02                	=	0x11EE6;
-	MEM_GFXDATA_03                	=	0x11EF4;
-	MEM_GFXDATA_04                	=	0x11F02;
+	MEM_GFXDATA_04                	=	0x11ED8;
+	MEM_GFXDATA_05                	=	0x11EE6;
+	MEM_GFXDATA_06                	=	0x11EF4;
+	MEM_GFXDATA_07                	=	0x11F02;
 	MEM_ACTIONSEQDATA_00          	=	0x11F10;
 	MEM_ACTIONSEQDATA_01          	=	0x11F20;
 	MEM_ACTIONSEQDATA_02          	=	0x11F30;
@@ -129,14 +161,30 @@ void initMapping(int mappingNum) {
 	MEM_UIDATA_08                 	=	0x13894;
 	MEM_UIDATA_09                 	=	0x138AC;
 	MEM_UIDATA_10                 	=	0x1391C;
+	MEM_PALDATA_06                	=	0x139D0;
 	MEM_RAWDATA_01                	=	0x13FEC;
 	MEM_RAWDATA_02                	=	0x144C6;
 	MEM_RAWDATA_03                	=	0x146CE;
-	MEM_PALDATA_06                	=	0x14B1C;
-	MEM_GFXDATA_05                	=	0x14B4E;
+	MEM_PALDATA_07                	=	0x14B1C;
+	MEM_GFXDATA_10                	=	0x14B4E;
 	MEM_RAWDATA_04                	=	0x14B7C;
 	MEM_RAWDATA_05                	=	0x14EAC;
 	MEM_RAWDATA_06                	=	0x16CDC;
+	MEM_PALDATA_10                	=	0x288E6;
+	MEM_PALDATA_11                	=	0x28944;
+	MEM_PALDATA_12                	=	0x290F2;
+	MEM_TIMERDATA_00                =	0x290FE;
+	MEM_TIMERDATA_01                =	0x2929A;
+	MEM_PALDATA_20                	=	0x292E2;
+	MEM_PALDATA_21                	=	0x292F0;
+	MEM_PALDATA_22                	=	0x292FE;
+	MEM_PALDATA_23                	=	0x2931A;
+	MEM_PALDATA_30                	=	0x2943A;
+	MEM_PALDATA_31                	=	0x2942C;
+	MEM_TIMERDATA_02                =	0x2A85C;
+	MEM_PALDATA_40                	=	0x2AA4A;
+	MEM_PALDATA_41                	=	0x2AA58;
+	MEM_PALDATA_42                	=	0x2AA66;
 
 	MEM_MODULE_LOCATION				=	0x28000;
 	MEM_SCRIPT_LOCATION				=	0x1A800;
diff --git a/engines/snatcher/mem_mapping.h b/engines/snatcher/mem_mapping.h
index 7dea71aaaff..64d8452e860 100644
--- a/engines/snatcher/mem_mapping.h
+++ b/engines/snatcher/mem_mapping.h
@@ -29,22 +29,30 @@ namespace Snatcher {
 namespace MemMapping {
 
 extern uint32 MEM_GFXDATA_00;
+extern uint32 MEM_GFXDATA_01;
+extern uint32 MEM_GFXDATA_02;
 extern uint32 MEM_RAWDATA_00;
 extern uint32 MEM_UIDATA_00;
+extern uint32 MEM_VERBDATA_00;
+extern uint32 MEM_VERBDATA_01;
+extern uint32 MEM_VERBDATA_02;
+extern uint32 MEM_VERBDATA_03;
 extern uint32 MEM_UIDATA_01;
 extern uint32 MEM_UIDATA_02;
 extern uint32 MEM_UIDATA_03;
 extern uint32 MEM_UIDATA_04;
+extern uint32 MEM_VERBDATA_04;
+extern uint32 MEM_VERBDATA_05;
 extern uint32 MEM_UIDATA_05;
 extern uint32 MEM_PALDATA_00;
 extern uint32 MEM_PALDATA_01;
 extern uint32 MEM_PALDATA_02;
 extern uint32 MEM_PALDATA_03;
 extern uint32 MEM_PALDATA_04;
-extern uint32 MEM_GFXDATA_01;
-extern uint32 MEM_GFXDATA_02;
-extern uint32 MEM_GFXDATA_03;
 extern uint32 MEM_GFXDATA_04;
+extern uint32 MEM_GFXDATA_05;
+extern uint32 MEM_GFXDATA_06;
+extern uint32 MEM_GFXDATA_07;
 extern uint32 MEM_ACTIONSEQDATA_00;
 extern uint32 MEM_ACTIONSEQDATA_01;
 extern uint32 MEM_ACTIONSEQDATA_02;
@@ -73,14 +81,30 @@ extern uint32 MEM_UIDATA_07;
 extern uint32 MEM_UIDATA_08;
 extern uint32 MEM_UIDATA_09;
 extern uint32 MEM_UIDATA_10;
+extern uint32 MEM_PALDATA_06;
 extern uint32 MEM_RAWDATA_01;
 extern uint32 MEM_RAWDATA_02;
 extern uint32 MEM_RAWDATA_03;
-extern uint32 MEM_PALDATA_06;
-extern uint32 MEM_GFXDATA_05;
+extern uint32 MEM_PALDATA_07;
+extern uint32 MEM_GFXDATA_10;
 extern uint32 MEM_RAWDATA_04;
 extern uint32 MEM_RAWDATA_05;
 extern uint32 MEM_RAWDATA_06;
+extern uint32 MEM_PALDATA_10;
+extern uint32 MEM_PALDATA_11;
+extern uint32 MEM_PALDATA_12;
+extern uint32 MEM_TIMERDATA_00;
+extern uint32 MEM_TIMERDATA_01;
+extern uint32 MEM_PALDATA_20;
+extern uint32 MEM_PALDATA_21;
+extern uint32 MEM_PALDATA_22;
+extern uint32 MEM_PALDATA_23;
+extern uint32 MEM_PALDATA_30;
+extern uint32 MEM_PALDATA_31;
+extern uint32 MEM_TIMERDATA_02;
+extern uint32 MEM_PALDATA_40;
+extern uint32 MEM_PALDATA_41;
+extern uint32 MEM_PALDATA_42;
 
 extern uint32 MEM_MODULE_LOCATION;
 extern uint32 MEM_SCRIPT_LOCATION;
diff --git a/engines/snatcher/scene_d0.cpp b/engines/snatcher/scene_d0.cpp
index f026ee132fa..1ead48f550d 100644
--- a/engines/snatcher/scene_d0.cpp
+++ b/engines/snatcher/scene_d0.cpp
@@ -22,6 +22,7 @@
 
 #include "snatcher/snatcher.h"
 #include "snatcher/graphics.h"
+#include "snatcher/mem_mapping.h"
 #include "snatcher/sound.h"
 #include "snatcher/resource.h"
 #include "snatcher/scene_imp.h"
@@ -102,7 +103,7 @@ SH_IMP_CTOR(D0) {
 	SH_CTOR_MAKEPROCS(D0);
 
 	uint32 *t = new uint32[35];
-	const uint8 *in = _module->getPtr(0x2A85C)();
+	const uint8 *in = _module->getPtr(MemMapping::MEM_TIMERDATA_02)();
 	for (int i = 0; i < 35; ++i) {
 		t[i] = READ_BE_UINT32(in);
 		in += 6;
@@ -144,7 +145,7 @@ SH_IMPL_FRM(D0, 00) {
 }
 
 SH_IMPL_FRM(D0, 01) {
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2AA4A));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_40));
 }
 
 SH_IMPL_FRM(D0, 02) {
@@ -174,7 +175,7 @@ SH_IMPL_FRM(D0, 07) {
 }
 
 SH_IMPL_FRM(D0, 08) {
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2AA66));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_42));
 }
 
 SH_IMPL_FRM(D0, 09) {
@@ -184,7 +185,7 @@ SH_IMPL_FRM(D0, 09) {
 }
 
 SH_IMPL_FRM(D0, 10) {
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2AA58));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_41));
 }
 
 SH_IMPL_FRM(D0, 11) {
diff --git a/engines/snatcher/scene_d1.cpp b/engines/snatcher/scene_d1.cpp
index 17897ac3155..963741b607c 100644
--- a/engines/snatcher/scene_d1.cpp
+++ b/engines/snatcher/scene_d1.cpp
@@ -22,6 +22,7 @@
 
 #include "snatcher/snatcher.h"
 #include "snatcher/graphics.h"
+#include "snatcher/mem_mapping.h"
 #include "snatcher/sound.h"
 #include "snatcher/resource.h"
 #include "snatcher/scene_imp.h"
@@ -92,7 +93,7 @@ SH_IMP_CTOR(D1) {
 	SH_CTOR_MAKEPROCS(D1);
 
 	uint32 *t = new uint32[29];
-	const uint8 *in = _module->getPtr(0x2929A)();
+	const uint8 *in = _module->getPtr(MemMapping::MEM_TIMERDATA_01)();
 	for (int i = 0; i < 29; ++i) {
 		t[i] = READ_BE_UINT32(in);
 		in += 6;
@@ -134,7 +135,7 @@ SH_IMPL_FRM(D1, 00) {
 }
 
 SH_IMPL_FRM(D1, 01) {
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2942C));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_31));
 }
 
 SH_IMPL_FRM(D1, 02) {
@@ -200,7 +201,7 @@ SH_IMPL_FRM(D1, 21) {
 }
 
 SH_IMPL_FRM(D1, 22) {
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2943A));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_30));
 }
 
 SH_IMPL_FRM(D1, 23) {
diff --git a/engines/snatcher/scene_d2.cpp b/engines/snatcher/scene_d2.cpp
index 4ca1d1b9a77..ab8fd3ad4a6 100644
--- a/engines/snatcher/scene_d2.cpp
+++ b/engines/snatcher/scene_d2.cpp
@@ -22,6 +22,7 @@
 
 #include "snatcher/snatcher.h"
 #include "snatcher/graphics.h"
+#include "snatcher/mem_mapping.h"
 #include "snatcher/sound.h"
 #include "snatcher/resource.h"
 #include "snatcher/scene_imp.h"
@@ -115,7 +116,7 @@ SH_IMPL_FRM(D2, 00) {
 		}
 		if (_vm->input().singleFrameControllerFlags & 0x80) {
 			state.counter = 10;
-			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x290F2));
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_12));
 			++state.frameState;
 		}
 		break;
@@ -162,7 +163,7 @@ SH_IMPL_FRM(D2, 03) {
 SH_IMPL_FRM(D2, 04) {
 	if (--state.counter)
 		return;
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x288E6));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_10));
 	state.counter = 86;
 	++state.frameNo;
 	state.frameState = 0;
@@ -182,7 +183,7 @@ SH_IMPL_FRM(D2, 06) {
 			++state.frameNo;
 			state.frameState = 0;
 		} else {
-			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x28944));
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_11));
 			++state.frameState;
 			state.counter = 17;
 		}
@@ -226,7 +227,7 @@ SH_IMPL_FRM(D2, 08) {
 			++state.frameNo;
 			state.frameState = 0;
 		} else {
-			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x28944));
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_11));
 			state.counter = 17;
 			++state.frameState;
 		}
@@ -412,7 +413,7 @@ SH_IMPL_FRM(D2, 11) {
 			fin = (_option == 4) ? 1 : (_option == 3 ? 3 : 0);
 		if (fin) {
 			_vm->sound()->pcmSendCommand(55 + fin, -1);
-			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x290F2));
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_12));
 			state.counter = 10;
 			if (fin == 1) {
 				state.frameState = 0;
@@ -445,7 +446,7 @@ SH_IMPL_FRM(D2, 11) {
 		break;
 	case 3:
 		if (_vm->input().singleFrameControllerFlags & 0x80) {
-			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x290F2));
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_12));
 			state.counter = 10;
 			++state.frameState;
 			_vm->allowLightGunInput(false);
@@ -500,7 +501,7 @@ SH_IMPL_FRM(D2, 11) {
 			if (++_counter2 < 180)
 				return;
 			state.counter = 10;
-			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x290F2));
+			_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_12));
 			++state.frameState;
 			break;
 		default:
diff --git a/engines/snatcher/scene_y16.cpp b/engines/snatcher/scene_y16.cpp
index 230b24067d3..eaab34039f7 100644
--- a/engines/snatcher/scene_y16.cpp
+++ b/engines/snatcher/scene_y16.cpp
@@ -22,6 +22,7 @@
 
 #include "snatcher/snatcher.h"
 #include "snatcher/graphics.h"
+#include "snatcher/mem_mapping.h"
 #include "snatcher/sound.h"
 #include "snatcher/resource.h"
 #include "snatcher/scene_imp.h"
@@ -93,7 +94,7 @@ SH_IMP_CTOR(Y16) {
 	SH_CTOR_MAKEPROCS(Y16);
 
 	uint32 *t = new uint32[28];
-	const uint8 *in = _module->getPtr(0x290FE)();
+	const uint8 *in = _module->getPtr(MemMapping::MEM_TIMERDATA_00)();
 	for (int i = 0; i < 28; ++i) {
 		t[i] = READ_BE_UINT32(in);
 		in += 6;
@@ -132,7 +133,7 @@ SH_IMPL_FRM(Y16, 00) {
 }
 
 SH_IMPL_FRM(Y16, 01) {
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x2931A));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_23));
 }
 
 SH_IMPL_FRM(Y16, 02) {
@@ -166,7 +167,7 @@ SH_IMPL_FRM(Y16, 12) {
 }
 
 SH_IMPL_FRM(Y16, 13) {
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x292F0));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_21));
 }
 
 SH_IMPL_FRM(Y16, 14) {
@@ -175,7 +176,7 @@ SH_IMPL_FRM(Y16, 14) {
 }
 
 SH_IMPL_FRM(Y16, 15) {
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x292FE));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_22));
 }
 
 SH_IMPL_FRM(Y16, 16) {
@@ -199,7 +200,7 @@ SH_IMPL_FRM(Y16, 18) {
 		return;
 	}
 	state.counter = 64;
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x292E2));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_20));
 }
 
 SH_IMPL_FRM(Y16, 19) {
@@ -239,7 +240,7 @@ SH_IMPL_FRM(Y16, 25) {
 		return;
 	}
 	state.counter = 64;
-	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(0x292E2));
+	_vm->gfx()->enqueuePaletteEvent(_module->getPtr(MemMapping::MEM_PALDATA_20));
 }
 
 SH_IMPL_FRM(Y16, 26) {
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index ebc1f4abc02..5f1864fbb9f 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -458,11 +458,11 @@ void SnatcherEngine::updateMainState(GameState &state) {
 		_cmdQueue->reset();
 		_cmdQueue->writeUInt16(0x16);
 		_cmdQueue->writeUInt16(0x03);
-		_cmdQueue->writeUInt32(0xECB6);
+		_cmdQueue->writeUInt32(MemMapping::MEM_GFXDATA_00);
 		_cmdQueue->writeUInt16(0x03);
-		_cmdQueue->writeUInt32(0xECC4);
+		_cmdQueue->writeUInt32(MemMapping::MEM_GFXDATA_01);
 		_cmdQueue->writeUInt16(0x01);
-		_cmdQueue->writeUInt32(0xED0E);
+		_cmdQueue->writeUInt32(MemMapping::MEM_GFXDATA_02);
 		_cmdQueue->start();
 
 		++state.phase;
@@ -511,7 +511,7 @@ void SnatcherEngine::updateMainState(GameState &state) {
 				for (int i = 5; i < 15; ++i)
 					_gfx->setAnimParameter(i, GraphicsEngine::kAnimParaEnable, 0);
 				_cmdQueue->writeUInt16(0x22);
-				_cmdQueue->writeUInt32(0x139D0);
+				_cmdQueue->writeUInt32(MemMapping::MEM_PALDATA_06);
 				_cmdQueue->start();
 				state.updateFlags |= 0xA0;
 			}
@@ -645,7 +645,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 				state.modFinish = 0;
 				state.counter = 10;
 				++state.modPhaseSub;
-				_gfx->enqueuePaletteEvent(_scd->makePtr(MemMapping::MEM_PALDATA_06));
+				_gfx->enqueuePaletteEvent(_scd->makePtr(MemMapping::MEM_PALDATA_07));
 			} else if (state.modFinish) {
 				if (state.modIndex == 0) {
 					++state.modIndex;
@@ -657,7 +657,7 @@ void SnatcherEngine::updateModuleState(GameState &state) {
 			break;
 		case 3:
 			if (--state.counter == 1) {
-				_gfx->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_05));
+				_gfx->enqueueDrawCommands(_scd->makePtr(MemMapping::MEM_GFXDATA_10));
 			} else if (state.counter == 0) {
 				state.modFinish = -1;
 				state.modPhaseSub = 0;
diff --git a/engines/snatcher/ui.cpp b/engines/snatcher/ui.cpp
index 87d2ea1db14..f0da771c147 100644
--- a/engines/snatcher/ui.cpp
+++ b/engines/snatcher/ui.cpp
@@ -281,7 +281,7 @@ bool UI::drawVerbs() {
 		if (_progress2 == 2) {
 			if (_verbInterfaceMode == 2) {
 				_que->writeUInt16(0x05);
-				_que->writeUInt32(0x11454);
+				_que->writeUInt32(MemMapping::MEM_VERBDATA_03);
 				_que->start();
 			}
 			++_progress2;
@@ -652,12 +652,12 @@ uint8 UI::drawVerb(uint8 id) {
 	uint8 cid = id;
 	if (_verbsTabCurPage == 1 && _lastVerbFirstPage == id) {
 		_que->writeUInt16(0x05);
-		_que->writeUInt32(_gfx->getVerbAreaType() ? 0x10F26 : 0x10F10);
+		_que->writeUInt32(_gfx->getVerbAreaType() ? MemMapping::MEM_VERBDATA_02 : MemMapping::MEM_VERBDATA_01);
 		return 0x80;
 	} else if (_verbsTabCurPage > 1) {
 		if (id == 0) {
 			_que->writeUInt16(0x05);
-			_que->writeUInt32(0x10EFA);
+			_que->writeUInt32(MemMapping::MEM_VERBDATA_00);
 			return 0x80;
 		} else {
 			id += _numVerbsFirstPage;
@@ -669,6 +669,7 @@ uint8 UI::drawVerb(uint8 id) {
 
 	uint16 offs = _scriptVerbsArray->read(id);
 	const uint8 *s = _scriptTextResource + offs;
+
 	uint8 *d = _verbTextBuffer + 9;
 	for (int i = 0; i < 33; ++i) {
 		*d = *s++;
@@ -1143,7 +1144,7 @@ void UI::virtKeybPrint() {
 		*d++ = 0xFF;
 
 		_que->writeUInt16(0x05);
-		_que->writeUInt32(0x11946);
+		_que->writeUInt32(MemMapping::MEM_VERBDATA_05);
 		_que->start();
 		++_progress2;
 		return;
@@ -1155,7 +1156,7 @@ void UI::virtKeybPrint() {
 	}
 	if (pr == 0x203) {
 		_que->writeUInt16(0x05);
-		_que->writeUInt32(0x11942);
+		_que->writeUInt32(MemMapping::MEM_VERBDATA_04);
 		_que->start();
 		++_progress2;
 			return;


Commit: e4015eb7c4bd42f663a9e973cb10caf6342a78d4
    https://github.com/scummvm/scummvm/commit/e4015eb7c4bd42f663a9e973cb10caf6342a78d4
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: add more data to savegames to avoid glitches

(concerns only the GMM saves, not the builtin scripted ones)

Changed paths:
    engines/snatcher/graphics.cpp
    engines/snatcher/graphics.h
    engines/snatcher/saveload.cpp


diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index b773ddf27b5..3476b82a399 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -35,7 +35,8 @@
 namespace Snatcher {
 
 GraphicsEngine::GraphicsEngine(const Graphics::PixelFormat *pxf, OSystem *system, Common::Platform platform, const VMInfo &vmstate, SoundEngine *snd, bool enableAspectRatioCorrection) :
-	_system(system), _state(vmstate), _animator(nullptr), _text(nullptr), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _verbAreaType(0), _animSaveLoadData(nullptr), _animSaveLoadDataExt() {
+	_system(system), _state(vmstate), _animator(nullptr), _text(nullptr), _dataMode(0), _screen(nullptr), _bpp(pxf ? pxf->bytesPerPixel : 1), _verbAreaType(0), _animSaveLoadData(nullptr),
+		_animSaveLoadDataExt(), _trsNeedsUpdate(false) {
 	assert(system);
 	_palette = Palette::create(pxf, _system->getPaletteManager(), platform, _state);
 	assert(_palette);
@@ -282,12 +283,20 @@ void GraphicsEngine::loadState(Common::SeekableReadStream *in, SaveFlags flags)
 	if (flags & (kSaveFlagsTempData))
 		return;
 
-	_animSaveLoadDataExt = true;
-
 	for (int i = 0; i < 13; ++i)
 		_state.setVar(i, in->readByte());
 
 	_trs->loadState(in);
+	_trsNeedsUpdate = true;
+
+	if (flags & (kSaveFlagsScriptedSave))
+		return;
+
+	uint16 size = in->readSint16BE();
+	uint8 *data = new uint8[size]();
+	assert(data);
+	in->read(data, size);
+	_animSaveLoadDataExt = Common::SharedPtr<const uint8>(data, Common::ArrayDeleter<const uint8>());
 }
 
 void GraphicsEngine::saveState(Common::SeekableWriteStream *out, SaveFlags flags) {
@@ -319,6 +328,79 @@ void GraphicsEngine::saveState(Common::SeekableWriteStream *out, SaveFlags flags
 		out->writeByte(_state.getVar(i));
 
 	_trs->saveState(out);
+
+	if (flags & (kSaveFlagsScriptedSave))
+		return;
+
+	int count = 0;
+	for (int i = 0; i < 64; ++i) {
+		if (_animSaveLoadData[i])
+			++count;
+	}
+	uint8 *data = new uint8[count * 29]();
+	uint8 *d = data;
+
+	for (int i = 0; i < 64; ++i) {
+		if (_animSaveLoadData[i] == 0)
+			continue;
+
+		uint8 v = (getAnimParameter(i, kAnimParaScriptComFlags) & 2) >> 1;
+		v |= getAnimParameter(i, kAnimParaDrawFlags) << 1;
+		v |= (getAnimParameter(i, kAnimFreezeFlag) ? 0x20 : 0);
+		*d++ = v;
+
+		uint16 b = getAnimParameter(i, kAnimParaPosX);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaPosY);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaRelSpeedX);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaRelSpeedY);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+
+		v = getAnimParameter(i, kAnimParaOvrTile) & 0xFC;
+		uint8 v2 = (getAnimParameter(i, kAnimParaPhase) & 0xF3);
+		b = ((v2 & 0xF0) << 8) | (v2 & 0x0F) | v;
+		v = getAnimParameter(i, kAnimParaPalette) & 0x83;
+		b |= (((v & 0x80) << 4) | ((v & 0x03) << 9));
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+
+		b = getAnimParameter(i, kAnimParaTarget);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		v = getAnimParameter(i, kAnimParaF1c);
+		*d++ = v;
+
+		uint32 t = getAnimParameter(i, kAnimParaTimeStamp);
+		WRITE_BE_UINT32(d, t);
+		d += 4;
+		v = getAnimParameter(i, kAnimParaFrameSeqCounter);
+		*d++ = v;
+		b = getAnimParameter(i, kAnimParaFrame);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaFrameDelay);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaActionTimer);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaAbsSpeedX);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+		b = getAnimParameter(i, kAnimParaAbsSpeedY);
+		WRITE_BE_UINT16(d, b);
+		d += 2;
+	}
+
+	out->writeUint16BE(d - data);
+	out->write(data, d - data);
+	delete[] data;
 }
 
 void GraphicsEngine::postLoadProcess() {
@@ -343,10 +425,57 @@ void GraphicsEngine::postLoadProcess() {
 		setAnimParameter(i, kAnimParaAllowFrameDrop, (v & 0x20) ? 1 : 0);
 	}
 
-	if (!(_animSaveLoadDataExt))
+	if (_trsNeedsUpdate)
+		_trs->postLoadProcess();
+	_trsNeedsUpdate = false;
+
+	if (_animSaveLoadDataExt == nullptr)
 		return;
 
-	_trs->postLoadProcess();
+	const uint8 *s = _animSaveLoadDataExt.get();
+	for (int i = 0; i < 64; ++i) {
+		if (_animSaveLoadData[i] == 0)
+			continue;
+
+		uint16 v = *s++;
+		setAnimParameter(i, kAnimParaScriptComFlags, getAnimParameter(i, kAnimParaScriptComFlags) | ((v & 1) << 1));
+		setAnimParameter(i, kAnimParaDrawFlags, (v & 0x1E) >> 1);
+		setAnimParameter(i, kAnimFreezeFlag, (v & 0x20) >> 5);
+
+		setAnimParameter(i, kAnimParaPosX, READ_BE_INT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaPosY, READ_BE_INT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaRelSpeedX, READ_BE_INT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaRelSpeedY, READ_BE_INT16(s));
+		s += 2;
+
+		v = READ_BE_INT16(s);
+		s += 2;
+		setAnimParameter(i, kAnimParaOvrTile, v & 0xFC);
+		setAnimParameter(i, kAnimParaPhase, ((v >> 8) & 0xF0) | (v & 3));
+		setAnimParameter(i, kAnimParaPalette, ((v >> 4) & 0x80) | ((v >> 9) & 0x03));
+
+		setAnimParameter(i, kAnimParaTarget, READ_BE_UINT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaF1c, *s++);
+		setAnimParameter(i, kAnimParaTimeStamp, READ_BE_UINT32(s));
+		s += 4;
+		setAnimParameter(i, kAnimParaFrameSeqCounter, *s++);
+		setAnimParameter(i, kAnimParaFrame, READ_BE_UINT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaFrameDelay, READ_BE_UINT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaActionTimer, READ_BE_UINT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaAbsSpeedX, READ_BE_INT16(s));
+		s += 2;
+		setAnimParameter(i, kAnimParaAbsSpeedY, READ_BE_INT16(s));
+		s += 2;
+	}
+
+	_animSaveLoadDataExt.reset();
 }
 
 void GraphicsEngine::createMouseCursor() {
diff --git a/engines/snatcher/graphics.h b/engines/snatcher/graphics.h
index 08e6f539512..2ca7c8977ed 100644
--- a/engines/snatcher/graphics.h
+++ b/engines/snatcher/graphics.h
@@ -227,8 +227,8 @@ private:
 	uint8 _verbAreaType;
 
 	uint8 *_animSaveLoadData;
-	//Common::SharedPtr<const uint8> _animSaveLoadDataExt;
-	bool _animSaveLoadDataExt;
+	Common::SharedPtr<const uint8> _animSaveLoadDataExt;
+	bool _trsNeedsUpdate;
 
 	uint8 *_screen;
 	Animator *_animator;
diff --git a/engines/snatcher/saveload.cpp b/engines/snatcher/saveload.cpp
index 3cc5515bb77..eb4b0f75363 100644
--- a/engines/snatcher/saveload.cpp
+++ b/engines/snatcher/saveload.cpp
@@ -292,7 +292,6 @@ void SaveLoadManager::saveState(int slot, GameState &state, SaveFlags flags) {
 	delete out;
 
 	updateSaveSlotsStatus(state);
-	debug("Saved game state to slot %d", slot);
 }
 
 Common::SeekableReadStream *SaveLoadManager::openFileForLoading(int slot, GameState &state, SaveHeader &header) {


Commit: d07e5b750bc59390c9f591fcba50293c7b5310cb
    https://github.com/scummvm/scummvm/commit/d07e5b750bc59390c9f591fcba50293c7b5310cb
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: (Save/Load) - restore hilite verb

Changed paths:
    engines/snatcher/ui.cpp
    engines/snatcher/ui.h


diff --git a/engines/snatcher/ui.cpp b/engines/snatcher/ui.cpp
index f0da771c147..b3c411ffca9 100644
--- a/engines/snatcher/ui.cpp
+++ b/engines/snatcher/ui.cpp
@@ -36,7 +36,7 @@ UI::UI(GraphicsEngine *gfx, CmdQueue *que, ResourcePointer *scd) : _gfx(gfx), _q
 	_scriptTextResource(nullptr),/*_makestrbt1(0),*/ _textY(0), _headLineYOffset(0), _sceneTextOffsCur(0), _textLineEnd(0), _sceneInfo(0), _sceneTextOffset(0), _flashLight(),
 		_sceneTextOffsStart(0), _waitCursorFrame(0), _waitCursorAnimDelay(0), _progress(-1), _progress2(-1), _controllerCfg(0), _verbInterfaceMode(0), _verbsInterpreterMode(0),
 			_lastVerbFirstPage(0), _numVerbsFirstPage(0), _numVerbsLastPage(0), _lastVerbLastPage(0), _numVerbsMax(0), _verbsTabCurPage(0), _lastVerbDrawn(0), _verbTextBuffer(nullptr), _scriptVerbsArray(nullptr),
-				_scriptSentenceArray(nullptr), _prevSelectedVerb(0), _selectedVerb(0), _lastHiliteVerb(0), _hiliteVerb(0), _textInputMarginLeft(0), _videoPhoneMode(0),
+				_scriptSentenceArray(nullptr), _prevSelectedVerb(0), _selectedVerb(0), _lastHiliteVerb(0), _hiliteVerb(0), _savedHiliteVerb(0), _textInputMarginLeft(0), _videoPhoneMode(0),
 					_textInputColumnCur(0), _textInputColumnMax(0), _textInputCursorState(0), _textInputCursorBlinkCnt(0), _underscoreStr(nullptr), _textInputStr(nullptr), _vkeybPosTotal(0),
 						_vkeybColumnWidth(0), _verbsTabLayoutMap(nullptr), _verbsTabOffsX(0), _verbsTabOffsY(0), _hilitePosX(0), _hilitePosY(0), _vkeybVisible(false) {
 
@@ -255,12 +255,16 @@ bool UI::drawVerbs() {
 				_lastVerbDrawn = _numVerbsMax;
 
 			_selectedVerb = 0;
-			uint8 v = 0;
-			if (_scriptSentenceArray->pos() == 0) {
-				if (_prevSelectedVerb <= _lastVerbDrawn - 1)
-					v = _prevSelectedVerb;
+			uint8 v = _savedHiliteVerb;
+			_savedHiliteVerb = 0;
+
+			if (v == 0) {
+				if (_scriptSentenceArray->pos() == 0) {
+					if (_prevSelectedVerb <= _lastVerbDrawn - 1)
+						v = _prevSelectedVerb;
+				}
 			}
-			_selectedVerb = 0;
+
 			_hiliteVerb = _lastHiliteVerb = v;
 			++_progress2;
 		}
@@ -501,12 +505,11 @@ void UI::loadState(Common::SeekableReadStream *in, SaveFlags flags) {
 	_videoPhoneMode = in->readSint16BE();
 	_textInputColumnMax = in->readSint16BE();
 	_prevSelectedVerb = in->readByte();
-	_selectedVerb = in->readByte();
-	_prevSelectedVerb = _selectedVerb;
-	if (flags & kSaveFlagsScriptedSave)
+	_savedHiliteVerb = in->readByte();
+	if (flags & kSaveFlagsScriptedSave) {
 		resetVerbSelection();
-	else
-		_prevSelectedVerb = _selectedVerb;
+		_savedHiliteVerb = 0;
+	}
 	_vkeybVisible = in->readByte();
 
 	_flashLight.inputFlags= in->readByte();
@@ -526,7 +529,7 @@ void UI::saveState(Common::SeekableWriteStream *out, SaveFlags flags) {
 	out->writeSint16BE(_videoPhoneMode);
 	out->writeSint16BE(_textInputColumnMax);
 	out->writeByte(_prevSelectedVerb);
-	out->writeByte(_selectedVerb);
+	out->writeByte(_lastHiliteVerb);
 	out->writeByte(_vkeybVisible ? 1 : 0);
 
 	out->writeByte(_flashLight.inputFlags);
diff --git a/engines/snatcher/ui.h b/engines/snatcher/ui.h
index ea70e4b6cca..15076770c5b 100644
--- a/engines/snatcher/ui.h
+++ b/engines/snatcher/ui.h
@@ -143,6 +143,7 @@ private:
 	uint8 _verbsTabOffsY;
 
 	int8 _lastHiliteVerb;
+	int8 _savedHiliteVerb;
 	int8 _hiliteVerb;
 	uint8 _lastVerbDrawn;
 	uint8 *_verbTextBuffer;


Commit: ef203bb72f2db1da864bf2bbce847ca8953e492d
    https://github.com/scummvm/scummvm/commit/ef203bb72f2db1da864bf2bbce847ca8953e492d
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: add basic support for fan translations

(there isn't any public translation template file yet)

Changed paths:
  A engines/snatcher/fantranslations.cpp
  A engines/snatcher/fantranslations.h
    engines/snatcher/detection.cpp
    engines/snatcher/detection.h
    engines/snatcher/detection_tables.h
    engines/snatcher/mem_mapping.cpp
    engines/snatcher/mem_mapping.h
    engines/snatcher/metaengine.cpp
    engines/snatcher/module.mk
    engines/snatcher/resource.h
    engines/snatcher/script.cpp
    engines/snatcher/snatcher.cpp
    engines/snatcher/snatcher.h
    engines/snatcher/sound.cpp
    engines/snatcher/state.h
    engines/snatcher/ui.cpp
    engines/snatcher/ui.h


diff --git a/engines/snatcher/detection.cpp b/engines/snatcher/detection.cpp
index f3e3710a89d..e103f42884a 100644
--- a/engines/snatcher/detection.cpp
+++ b/engines/snatcher/detection.cpp
@@ -19,6 +19,8 @@
 *
 */
 
+
+#include "common/config-manager.h"
 #include "common/translation.h"
 #include "engines/advancedDetector.h"
 #include "base/plugins.h"
@@ -26,6 +28,9 @@
 
 #include "snatcher/detection.h"
 #include "snatcher/detection_tables.h"
+#include "snatcher/fantranslations.h"
+
+namespace Snatcher {
 
 class SnatcherMetaEngineDetection : public AdvancedMetaEngineDetection<SnatcherGameDescription> {
 public:
@@ -46,6 +51,59 @@ public:
 	const char *getOriginalCopyright() const override {
 		return "Snatcher (C) Konami";
 	}
+
+	DetectedGames detectGames(const Common::FSList &fslist, uint32 skipADFlags, bool skipIncomplete) override;
+
+	Common::Error identifyGame(DetectedGame &game, const void **descriptor) override;
 };
 
-REGISTER_PLUGIN_STATIC(SNATCHER_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, SnatcherMetaEngineDetection);
+DetectedGames SnatcherMetaEngineDetection::detectGames(const Common::FSList &fslist, uint32 skipADFlags, bool skipIncomplete) {
+	DetectedGames games = AdvancedMetaEngineDetection::detectGames(fslist, skipADFlags, skipIncomplete);
+
+	for (DetectedGame &game : games) {
+		if (!game.gameId.equals("snatcher"))
+			continue;
+
+		Common::List<Common::Language> langList = FanTranslationHandler::listTranslations(game.platform);
+
+		if (!langList.empty()) {
+			langList.push_back(game.language);
+			game.appendGUIOptions(getGameGUIOptionsDescriptionLanguages(langList));
+		}
+	}
+
+	return games;
+}
+
+Common::Error SnatcherMetaEngineDetection::identifyGame(DetectedGame &game, const void **descriptor) {
+	Common::Language selectedlang = Common::UNK_LANG;
+	Common::Language defaultLang = Common::UNK_LANG;
+	bool supportedFanLang = false;
+
+	if (ConfMan.hasKey("gameid") && ConfMan.get("gameid") == "snatcher" && ConfMan.hasKey("language")) {
+		selectedlang = Common::parseLanguage(ConfMan.get("language"));
+		Common::Platform platform = Common::parsePlatform(ConfMan.get("platform"));
+
+		if (selectedlang != Common::UNK_LANG && platform != Common::kPlatformUnknown) {
+			Common::List<Common::Language> langList = FanTranslationHandler::listTranslations(platform, &defaultLang);
+			for (Common::List<Common::Language>::const_iterator i = langList.begin(); i != langList.end(); ++i) {
+				if (*i == selectedlang)
+					supportedFanLang = true;
+			}
+		}
+	}
+
+	if (supportedFanLang && defaultLang != Common::UNK_LANG)
+		ConfMan.set("language", Common::getLanguageCode(defaultLang));
+
+	Common::Error err = AdvancedMetaEngineDetection::identifyGame(game, descriptor);
+
+	if (supportedFanLang && defaultLang != Common::UNK_LANG && selectedlang != Common::UNK_LANG)
+		ConfMan.set("language", Common::getLanguageCode(selectedlang));
+
+	return err;
+}
+
+} // End of namespace Snatcher	
+
+REGISTER_PLUGIN_STATIC(SNATCHER_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, Snatcher::SnatcherMetaEngineDetection);
diff --git a/engines/snatcher/detection.h b/engines/snatcher/detection.h
index 5f5ada80cd1..6b38b830682 100644
--- a/engines/snatcher/detection.h
+++ b/engines/snatcher/detection.h
@@ -38,9 +38,7 @@ struct GameDescription {
 	bool isBigEndian;
 	bool usePALTiming;
 
-	// language overwrites of fan translations (only needed for multilingual games)
 	Common::Language fanLang;
-	Common::Language replacedLang;
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/detection_tables.h b/engines/snatcher/detection_tables.h
index 5639a457a9e..53e9643e150 100644
--- a/engines/snatcher/detection_tables.h
+++ b/engines/snatcher/detection_tables.h
@@ -21,8 +21,7 @@
 
 namespace {
 
-#define FLAGS(id, a, b, c) { id, a, Common::UNK_LANG, Common::kPlatformUnknown, b, c, Common::UNK_LANG, Common::UNK_LANG }
-#define FLAGS_FAN(id, a, b, c, fanLang, repLang) { id, a, Common::UNK_LANG, Common::kPlatformUnknown, b, c, fanLang, repLang }
+#define FLAGS(id, a, b, c) { id, a, Common::UNK_LANG, Common::kPlatformUnknown, b, c, Common::UNK_LANG }
 
 #define SNATCHER_FLAGS(a, b, c) FLAGS(Snatcher::GI_SNATCHER, a, b, c)
 
diff --git a/engines/snatcher/fantranslations.cpp b/engines/snatcher/fantranslations.cpp
new file mode 100644
index 00000000000..bf682b8f2ec
--- /dev/null
+++ b/engines/snatcher/fantranslations.cpp
@@ -0,0 +1,608 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#include "snatcher/fantranslations.h"
+#include "snatcher/mem_mapping.h"
+
+#include "common/algorithm.h"
+#include "common/config-manager.h"
+#include "common/debug.h"
+#include "common/file.h"
+
+namespace Snatcher {
+
+#define SNATCHER_FANTRANSLATIONS_CURRENT_VERSION		1
+
+
+FanTranslationHandler::FanTranslationHandler(Common::Platform platform, Common::Language defaultLang, Common::Language fanLang, TranslatorMode mode) : _mode(mode), _defaultLang(defaultLang), _platform(platform) {
+	if (mode == kDetect)
+		error("%s(): Unsupported mode 'kDetect' specified", __FUNCTION__);
+	if (mode == kCollect && fanLang != Common::UNK_LANG)
+		error("%s(): 'kCollect' mode works only with the default language, not with a fan translation", __FUNCTION__);
+	if (fanLang != Common::UNK_LANG || mode == kCollect)
+		_gameTranslateableData = new PerFileTranslateableData*[100]();
+	if (fanLang != Common::UNK_LANG)
+		_fileOffsetList = new uint32[100]();
+	_fontProperties = new FontProperties();
+
+	parseTranslations(platform, fanLang, _mode, -1, _gameTranslateableData, nullptr, nullptr, _fileOffsetList, _fontProperties);
+}
+
+FanTranslationHandler::~FanTranslationHandler() {
+	if (_mode == kCollect)
+		saveFile();
+	if (_gameTranslateableData) {
+		for (int i = 0; i < 100; ++i)
+			delete _gameTranslateableData[i];
+		delete[] _gameTranslateableData;
+		_gameTranslateableData = nullptr;
+	}
+	delete[] _fileOffsetList;
+	_fileOffsetList = nullptr;
+	delete _fontProperties;
+	_fontProperties = nullptr;
+}
+
+const uint8 *FanTranslationHandler::process(uint32 addr, const uint8 *data) {
+	if (_mode == kTranslate && _gameTranslateableData) {
+		for (int i = 0; i < 100; ++i) {
+			if (!_gameTranslateableData[i])
+				continue;
+
+			const PerFileTranslateableData &d = *_gameTranslateableData[i];
+			Common::List<Common::String>::const_iterator j = d.stringTable.begin();
+			for (Common::List<uint32>::const_iterator it = d.addressTable.begin(); it != d.addressTable.end(); ++it, ++j) {
+				if (*it == addr)
+					return reinterpret_cast<const uint8 *>(j->c_str());
+			}
+		}
+	} else if (_mode == kCollect) {
+		int fileNo = (addr < MemMapping::MEM_SCRIPT_LOCATION) ? _scdFileNo : (addr >= MemMapping::MEM_MODULE_LOCATION ? _gfxFileNo : _scriptFileNo);
+		updateDataTable(addr, data, _gameTranslateableData, _mode, 256, fileNo);
+	}
+	return data;
+}
+
+void FanTranslationHandler::loadFile(int number, ResourceType rtype) {
+	if (rtype == kInvalid)
+		return;
+
+	int &fileNo = (rtype == kScript) ? _scriptFileNo : (rtype == kSCD ? _scdFileNo : _gfxFileNo);
+	if (fileNo == number)
+		return;
+
+	fileNo = number;
+
+	if (_gameTranslateableData == nullptr || _fileOffsetList == nullptr || _mode == kCollect)
+		return;
+
+	if (fileNo != -1 && _gameTranslateableData[fileNo]) {
+		delete _gameTranslateableData[fileNo];
+		_gameTranslateableData[fileNo] = nullptr;
+	}
+	
+	if (_gameTranslateableData[number] != nullptr)
+		return;
+
+	parseTranslations(Common::kPlatformUnknown, Common::UNK_LANG, _mode, number, _gameTranslateableData, nullptr, nullptr, _fileOffsetList, nullptr);
+}
+
+Common::List<Common::Language> FanTranslationHandler::listTranslations(Common::Platform platform, Common::Language *defaultLang) {
+	Common::List<Common::Language> res;
+	parseTranslations(platform, Common::UNK_LANG, kDetect, -1, nullptr, &res, defaultLang, nullptr, nullptr);
+	return res;
+}
+
+const FanTranslationHandler::FontProperties &FanTranslationHandler::getFontProperties() const {
+	if (_fontProperties == nullptr)
+		error("%s(): Font properties not initialized", __FUNCTION__);
+	return *_fontProperties;
+}
+
+void FanTranslationHandler::updateDataTable(uint32 addr, const uint8 *data, PerFileTranslateableData **table, TranslatorMode mode, uint dataSize, int file) {
+	Common::String tmp(reinterpret_cast<const char *>(data), dataSize);
+	size_t tt = tmp.findFirstOf(-1);
+	tmp.chop(tmp.size() - tt - 1);
+
+	if (mode == kCollect) {
+		for (uint i = 0; i < tmp.size(); ++i) {
+			uint8 c = tmp[i];
+			if (c < 32 || c > 127) {
+				tmp.replace(i, 1, Common::String::format("\\x%02X", static_cast<uint8>(c)));
+				i += 3;
+			} else if (c == '\"') {
+				tmp.replace(i, 1, "\\\"");
+				i++;
+			}
+		}
+	}
+
+	assert(table);
+	if (!table[file])
+		table[file] = new PerFileTranslateableData();
+
+	PerFileTranslateableData &d = *table[file];
+
+	Common::List<Common::String>::iterator j = d.stringTable.begin();
+	for (Common::List<uint32>::iterator i = d.addressTable.begin(); i != d.addressTable.end(); ++i, ++j) {
+		if (addr == *i) {
+			addr = 0;
+			break;
+		}
+		if (addr < *i) {
+			d.addressTable.insert(i, addr);
+			d.stringTable.insert(j, tmp);
+			if (file == -1)
+				debug("0x%06x=\"%s\"", addr, tmp.c_str());
+			addr = 0;
+			break;
+		}
+	}
+
+	if (addr != 0) {
+		d.addressTable.push_back(addr);
+		d.stringTable.push_back(tmp);
+		if (file == -1)
+			debug("0x%06x=\"%s\"", addr, tmp.c_str());
+	}
+}
+
+const struct CPMapping {
+	Common::CodePage cp;
+	const char str[5];
+} cpMapping[] = {
+	{Common::kWindows1250, "1250"},
+	{Common::kWindows1251, "1251"},
+	{Common::kWindows1252, "1252"},
+	{Common::kWindows1253, "1253"},
+	{Common::kWindows1254, "1254"},
+	{Common::kWindows1255, "1255"},
+	{Common::kWindows1256, "1256"},
+	{Common::kWindows1257, "1257"},
+	{Common::kWindows932, "932"},
+	{Common::kWindows936, "936"},
+	{Common::kWindows949, "949"},
+	{Common::kWindows950, "950"},
+	{Common::kDos850, "850"},
+	{Common::kDos862, "862"},
+	{Common::kDos866, "866"},
+};
+
+void FanTranslationHandler::parseTranslations(Common::Platform platform, Common::Language lang, TranslatorMode mode, int fileNumber,
+	PerFileTranslateableData **table, Common::List<Common::Language> *langList, Common::Language *defaultLang, uint32 *fileOffsetList, FontProperties *fontProperties) {
+
+	Common::Path fileName = Common::Path("snatcher_translations.dat");
+	Common::File file;
+	if (!file.open(fileName)) {
+
+		// Some lower level magic for the detection/metaengine phase where the normal file search hasn't been initiated yet.
+		const char *keys[] = {"path", "extrapath"};
+		for (int i = 0; i < ARRAYSIZE(keys); ++i) {
+			if (ConfMan.hasKey(keys[i])) {
+				Common::Path filePath(ConfMan.getPath(keys[i]));
+				Common::FSList list;
+				Common::FSNode(filePath).getChildren(list, Common::FSNode::kListFilesOnly);
+				for (Common::FSList::const_iterator it = list.begin(); it != list.end(); ++it) {
+					if (it->getName().equalsIgnoreCase(fileName.toString())) {
+						file.open(*it);
+						break;
+					}
+				}
+				if (file.isOpen())
+					break;
+			}
+		}
+
+		if (!file.isOpen())
+			return;
+	}
+
+	if (platform == Common::Platform::kPlatformUnknown && !fileOffsetList)
+		error("%s(): Platform must be specified to load a translation", __FUNCTION__);
+
+	uint16 blockSize = 5000;
+	uint16 extraBytes = 5;
+	uint8 *buff = new uint8[blockSize + extraBytes]();
+
+	bool leftPos = true;
+	bool skipLine = false;
+	int parseTag = 0;
+	bool parseFile = false;
+	bool parseMapping = false;
+	bool parseText = false;
+	bool saveOffset = false;
+	bool isDefault = false;
+
+	Common::String tmp;
+	Common::String versionStr;
+	Common::String platformStr;
+	Common::String languageStr;
+	Common::String fileNoStr;
+	Common::String currentLine;
+	Common::String extraCp;
+	Common::String extraRTL;
+	Common::String extraFont;
+	Common::Language *defLang = nullptr;
+
+	int fileNo = -1;
+	uint32 addr = 0;
+	Common::String *dstr = &tmp;
+	uint16 bytesLeft = file.size();
+	uint16 readSize = 0;
+	int diff = 0;
+
+	if (fileNumber != -1 && fileOffsetList != nullptr && (uint)fileNumber < 100) {
+		uint32 offs = fileOffsetList[fileNumber];
+		if (offs == 0)	// Many module files do not actually contain any text.
+			return;
+		file.seek(offs);
+		bytesLeft -= offs;
+		fileNo = fileNumber;
+		parseMapping = true;
+		dstr = ¤tLine;
+	}
+
+	while (bytesLeft > 0) {
+		diff = MAX<int>(readSize + diff - blockSize, 0);
+		if (diff)
+			memmove(buff, buff + blockSize + extraBytes - diff, diff);
+		readSize = file.read(buff + diff, blockSize + extraBytes - diff);
+		bytesLeft -= readSize;
+		if (bytesLeft == 0)
+			extraBytes = 0;
+
+		const char *p = reinterpret_cast<const char *>(buff);
+		const char *last = nullptr;
+		const char *end = p + readSize - extraBytes + diff;
+
+		while (p < end) {
+			if (p == last) // avoid infinite loop on invalid data
+				error("%s(): Fan translation file '%s' is corrupt or invalid. Error at pos: 0x%04x", __FUNCTION__, fileName.toString().c_str(), static_cast<int>(file.pos()) - readSize - diff + static_cast<uint32>(reinterpret_cast<const uint8*>(p) - buff));
+			last = p;
+
+			if ((leftPos || parseTag || parseFile) && (*p == ' ' || *p == '*')) {
+				if (*p++ == '*') {
+					if (leftPos && !parseFile) {
+						fileNo = -1;
+						parseFile = true;
+					}
+					if (!fileNoStr.empty()) {
+						parseMapping = true;
+						fileNo = fileNoStr.asUint64();
+						fileNoStr.clear();
+						dstr = ¤tLine;
+						parseFile = false;
+						saveOffset = (platform != Common::kPlatformUnknown && lang != Common::UNK_LANG && mode == kTranslate && fileOffsetList != nullptr && fileNumber == -1);
+					}
+				}
+				continue;
+			}
+			if (*p == '\r' || *p == '\n') {
+				skipLine = false;
+				if (!fileNoStr.empty()) {
+					parseMapping = true;
+					fileNo = fileNoStr.asUint64();
+					fileNoStr.clear();
+					dstr = ¤tLine;
+					parseFile = false;
+					saveOffset = (platform != Common::kPlatformUnknown && lang != Common::UNK_LANG && mode == kTranslate && fileOffsetList != nullptr && fileNumber == -1);
+				}
+				if (parseText) {
+					if (currentLine.lastChar() != '\xFF')
+						currentLine += '\xFF';
+					if ((mode == kCollect || fileNumber != -1) && table != nullptr)
+						updateDataTable(addr, reinterpret_cast<const uint8*>(currentLine.c_str()), table, mode, currentLine.size(), fileNo);
+					addr = 0;
+					parseText = false;
+				}
+				currentLine.clear();
+				leftPos = true;
+				++p;
+				if (saveOffset)
+					fileOffsetList[fileNo] = file.pos() - readSize - diff + static_cast<uint32>(reinterpret_cast<const uint8*>(p) - buff);
+				saveOffset = false;
+				continue;
+			}
+			leftPos = false;
+			if (*p == ';') {
+				skipLine = true;
+				++p;
+				continue;
+			}
+			if (skipLine) {
+				++p;
+				continue;
+			}
+			if (*p == '[') {
+				if (++parseTag == 1) {
+					platformStr.clear();
+					languageStr.clear();
+					versionStr.clear();
+					extraCp.clear();
+					extraRTL.clear();
+					extraFont.clear();
+					tmp.clear();
+					fileNo = -1;
+					parseFile = false;
+					isDefault = false;
+					dstr = &tmp;
+					if (fileNumber != -1) {
+						bytesLeft = 0;
+						p = end;
+					}
+				}
+				if (parseTag == 3) {
+					tmp.clear();
+					dstr = &tmp;
+				}
+				++p;
+				continue;
+			}
+			if (*p == ']') {
+				if (--parseTag == 0) {
+					if (!versionStr.empty()) {
+						int version = versionStr.asUint64();
+						if (version < SNATCHER_FANTRANSLATIONS_CURRENT_VERSION)
+							warning("Translation file '%s' is outdated (version %d, expected %d)", fileName.toString().c_str(), version, SNATCHER_FANTRANSLATIONS_CURRENT_VERSION);
+						versionStr.clear();
+					}
+					if (Common::parsePlatform(platformStr) == platform) {
+						if ((mode == kCollect && lang == Common::UNK_LANG) || fileNumber != -1 || (lang != Common::UNK_LANG && (Common::parseLanguage(languageStr) == lang || Common::parseLanguage(languageStr.substr(0, 2)) == lang))) {
+							parseFile = true;
+						} else if (mode == kDetect && lang == Common::UNK_LANG) {
+							Common::Language l = Common::parseLanguage(languageStr);
+							if (l == Common::UNK_LANG)
+								l = Common::parseLanguage(languageStr.substr(0, 2));
+							if (l != Common::UNK_LANG) {
+								if (defLang != nullptr)
+									*defLang = l;
+								else if (langList != nullptr)
+									langList->push_back(l);
+							}
+						}
+						languageStr.clear();
+						defLang = nullptr;
+					}
+				}
+				if (parseTag == 2) {
+					if (isDefault)
+						defLang = defaultLang;
+					bool processResult = (defLang == nullptr && (Common::parseLanguage(languageStr) != Common::UNK_LANG || Common::parseLanguage(languageStr.substr(0, 2)) != Common::UNK_LANG) && fileOffsetList != nullptr);
+					if (!extraCp.empty()) {
+						if (processResult) {
+							for (uint i = 0; i < ARRAYSIZE(cpMapping); ++i) {
+								if (extraCp.equalsIgnoreCase(cpMapping[i].str)) {
+									fontProperties->codepage = cpMapping[i].cp;
+									break;
+								}
+							}
+						}
+						extraCp.clear();
+					}
+					if (!extraFont.empty()) {
+						if (processResult)
+							fontProperties->fontfile = extraFont;
+						extraFont.clear();
+					}
+					if (!extraRTL.empty()) {
+						if (processResult)
+							fontProperties->rtl = extraRTL.equalsIgnoreCase("TRUE") || extraRTL.equalsIgnoreCase("YES") || extraRTL.equalsIgnoreCase("1");
+						extraRTL.clear();
+					}
+				}
+				if (parseTag < 1)
+					parseTag = 0;
+				tmp.clear();
+				dstr = &tmp;
+				++p;
+				continue;
+			}
+			if (parseTag) {
+				*dstr += *p++;
+				if (dstr->equalsIgnoreCase("VERSION:"))
+					dstr = &versionStr;
+				else if (dstr->equalsIgnoreCase("PLATFORM:"))
+					dstr = &platformStr;
+				else if (dstr->equalsIgnoreCase("LANGUAGE:"))
+					dstr = &languageStr;
+				else if (dstr->equalsIgnoreCase("CODEPAGE:"))
+					dstr = &extraCp;
+				else if (dstr->equalsIgnoreCase("FONTFILE:"))
+					dstr = &extraFont;
+				else if (dstr->equalsIgnoreCase("RTL:"))
+					dstr = &extraRTL;
+				else if (dstr->equalsIgnoreCase("DEFAULT"))
+					isDefault = true;
+				continue;
+			}
+			if (parseFile) {
+				*dstr += *p++;
+				if (dstr->equalsIgnoreCase("FILE:"))
+					dstr = &fileNoStr;
+				continue;
+			}
+			if (parseMapping) {
+				if (!parseText && (*p == ' ' || *p == ':')) {
+					if (addr == 0) {
+						if (currentLine.substr(0, 2).equalsIgnoreCase("0x") == false)
+							currentLine = "0x" + currentLine;
+						addr = currentLine.asUint64Ext();
+					}
+					currentLine.clear();
+					++p;
+					continue;
+				}
+				if (parseText) {
+					if (*p == '\\') {
+						++p;
+						if (*p == 'x' || *p == 'X') {
+							*dstr += static_cast<char>(Common::String("0x" + Common::String(p + 1, 2)).asUint64Ext());
+							p += 3;
+						} else {
+							if (*p == '\"')
+								*dstr += '\"';
+							++p;
+						}
+						continue;
+					}
+				}
+				if (*p == '\"') {
+					if (parseText) {
+						if (currentLine.lastChar() != '\xFF')
+							currentLine += '\xFF';
+						if (((mode == kCollect && (lang == Common::UNK_LANG) == isDefault) || fileNumber != -1) && table != nullptr)
+							updateDataTable(addr, reinterpret_cast<const uint8*>(currentLine.c_str()), table, mode, currentLine.size(), fileNo);
+						currentLine.clear();
+						addr = 0;
+						parseText = false;
+					} else {
+						parseText = true;
+					}
+					++p;
+					continue;
+				}
+
+				*dstr += *p++;
+				continue;
+			}
+			++p;
+		}
+		diff -= (p - end);
+	}
+
+	delete[] buff;
+	file.close();
+}
+
+void FanTranslationHandler::saveFile() {
+	const char l1[] =	"; This file is used for Snatcher fan translations.\n\n"
+						"; It is grouped into platform and language tags [[ PLATFORM: <x> ][ LANGUAGE: <x> ]]. The first language\n"
+						"; tag for each platform [ LANGUAGE: <x> [DEFAULT] ] is the built in language for the platform. It serves\n"
+						"; as the template for the actual translations. Under the platform and language tags are tags for each file\n"
+						"; (*** FILE: ***) and underneath those are the text strings.\n\n"
+						"; The language tag may have subtags like [ CODEPAGE: <x> ] or [RTL: TRUE ] or [ FONTFILE: <x> ]]. So the\n"
+						"; whole tag would be : [[ PLATFORM: <x> ] [ LANGUAGE:<x> [ CODEPAGE:<x> ] [ RTL:TRUE ] [ FONTFILE:<x> ]]].\n"
+						"; These subtags are optional and currently only get parsed, but do not have any actual effect.\n\n"
+						"; To add a new translation, copy the whole block (starting with the platform and language tag), paste it\n"
+						"; underneath, change the language inside that newly inserted tag with the appropriate language descriptor\n"
+						"; in the same format as our Common::Language enum, e. g. FR_FRA, IT_ITA, etc. Remove the [ DEFAULT ] sub\n"
+						"; tag from the new language tag.\n\n"
+						"; For the actual translation, only replace the text strings inside the quotation marks on the right of\n"
+						"; the '<hex num>:'. If there is a leading number that apparently doesn't seem to be part of the displayed\n"
+						"; sentence (e. g. '2Mika'), leave it there: This is a text color setting. Also, leave the special control\n"
+						"; markers (like '\\xFx') and similar things unchanged. Stick to regular characters that can actually be\n"
+						"; drawn with the game font (no ç, ä, ü, ø, etc.). The '\\xF2' command is a line break marker, so try to\n"
+						"; format your translation to have a similar width and height. Put an end marker '\\xFF' at the end of\n"
+						"; each line (although we check that and add it if it's missing).\n\n";
+	const char l2[] = "[ VERSION: %04d ]\n";
+	const char l3[] = "\n[[ PLATFORM: %s ] [ LANGUAGE: %s ]]\n";
+	const char l4[] = "\n*** FILE: %02d ***\n";
+	const char l5[] = "[ DEFAULT ]";
+
+	Common::Path filePath = Common::Path("snatcher_translations_new.dat");
+	if (ConfMan.hasKey("extrapath"))
+		filePath = ConfMan.getPath("extrapath").toString() + filePath.toString();
+
+	Common::DumpFile outfile;
+	if (!outfile.open(filePath))
+		error("%s(): Could not open translation file '%s' for writing.", __FUNCTION__, filePath.toString().c_str());
+
+	outfile.write(l1, sizeof(l1) - 1);
+
+	Common::Platform platforms[] = {
+		Common::kPlatformSegaCD,
+		Common::kPlatformPCEngine,
+		Common::kPlatformPC98,
+		Common::kPlatformSaturn,
+		Common::kPlatformPSX
+	};
+
+	/* Common::Language languages[] = {
+		Common::EN_ANY,
+		Common::JA_JPN
+	};*/
+
+	assert(_gameTranslateableData);
+
+	PerFileTranslateableData **tempTranslateableData = new PerFileTranslateableData*[100]();
+
+	Common::String ostr = Common::String::format(l2, SNATCHER_FANTRANSLATIONS_CURRENT_VERSION);
+	outfile.write(ostr.c_str(), ostr.size());
+
+	for (int i = 0; i < ARRAYSIZE(platforms); ++i) {
+		Common::Language defaultLang = Common::UNK_LANG;
+		Common::List<Common::Language> langList = listTranslations(platforms[i], &defaultLang);
+		if (defaultLang != Common::UNK_LANG)
+			langList.push_front(defaultLang);
+
+		for (Common::List<Common::Language>::const_iterator lng = langList.begin(); lng != langList.end(); ++lng) {
+			PerFileTranslateableData **data = nullptr;
+			if (_platform == platforms[i] && _defaultLang == *lng) {
+				data = _gameTranslateableData;
+			} else {
+				data = tempTranslateableData;
+				for (int ii = 0; ii < 100; ++ii) {
+					delete data[ii];
+					data[ii] = nullptr;
+				}
+				parseTranslations(platforms[i], *lng, kCollect, -1, data, nullptr, nullptr, nullptr, nullptr);
+			}
+
+			Common::String langStr(Common::getLanguageCode(*lng));
+			if (_defaultLang == *lng)
+				langStr = langStr + " " + l5;
+			langStr.toUppercase();
+
+			Common::String platformStr(Common::getPlatformCode(platforms[i]));
+			platformStr.toUppercase();
+
+			ostr = Common::String::format(l3, platformStr.c_str(), langStr.c_str());
+			outfile.write(ostr.c_str(), ostr.size());
+
+			for (int iii = 0; iii < 100; ++iii) {
+				if (!data[iii])
+					continue;
+				ostr = Common::String::format(l4, iii);
+				outfile.write(ostr.c_str(), ostr.size());
+
+				PerFileTranslateableData &d = *data[iii];
+				Common::List<Common::String>::iterator j = d.stringTable.begin();
+				for (Common::List<uint32>::iterator it = d.addressTable.begin(); it != d.addressTable.end(); ++it, ++j) {
+					ostr = Common::String::format("%06X: \"%s\"\n", *it, j->c_str());
+					outfile.write(ostr.c_str(), ostr.size());
+				}
+			}
+		}
+	}
+
+	if (tempTranslateableData) {
+		for (int i = 0; i < 100; ++i)
+			delete tempTranslateableData[i];
+		delete[] tempTranslateableData;
+		tempTranslateableData = nullptr;
+	}
+
+	outfile.finalize();
+	outfile.close();
+}
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/fantranslations.h b/engines/snatcher/fantranslations.h
new file mode 100644
index 00000000000..623ff262a13
--- /dev/null
+++ b/engines/snatcher/fantranslations.h
@@ -0,0 +1,98 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#ifndef SNATCHER_FANTRANSLATIONS_H
+#define SNATCHER_FANTRANSLATIONS_H
+
+#include "common/language.h"
+#include "common/list.h"
+#include "common/platform.h"
+#include "common/scummsys.h"
+#include "common/str-enc.h"
+#include "common/str.h"
+
+namespace Snatcher {
+
+class FanTranslationHandler {
+public:
+	enum TranslatorMode {
+		kDetect = 0,
+		kTranslate = 1,
+		kCollect = 2
+	};
+
+	enum ResourceType {
+		kInvalid = -1,
+		kModule = 0,
+		kScript = 1,
+		kSCD = 2
+	};
+
+	FanTranslationHandler(Common::Platform platform, Common::Language defaultLang, Common::Language fanLang, TranslatorMode mode);
+	~FanTranslationHandler();
+
+	const uint8 *process(uint32 addr, const uint8 *data);
+	void loadFile(int number, ResourceType rtype);
+
+	struct FontProperties {
+		FontProperties() : codepage(Common::kCodePageInvalid), rtl(false) {}
+		Common::CodePage codepage;
+		Common::String fontfile;
+		bool rtl;
+	};
+
+	const FontProperties &getFontProperties() const;
+
+	static Common::List<Common::Language> listTranslations(Common::Platform platform, Common::Language *defaultLang = nullptr);
+
+private:
+	struct PerFileTranslateableData {
+		PerFileTranslateableData() {}
+		~PerFileTranslateableData() {
+			stringTable.clear();
+			addressTable.clear();
+		}
+
+		Common::List<Common::String> stringTable;
+		Common::List<uint32> addressTable;
+	};
+
+	static void updateDataTable(uint32 addr, const uint8 *data, PerFileTranslateableData **table, TranslatorMode mode, uint dataSize = 256, int file = -1);
+	static void parseTranslations(Common::Platform platform, Common::Language lang, TranslatorMode mode, int fileNumber = -1,
+		PerFileTranslateableData **table = nullptr, Common::List<Common::Language> *langList = nullptr, Common::Language *defaultLang = nullptr, uint32 *fileOffsetList = nullptr, FontProperties *fontProperties = nullptr);
+	void saveFile();
+
+	PerFileTranslateableData **_gameTranslateableData = nullptr;
+	uint32 *_fileOffsetList = nullptr;
+	FontProperties *_fontProperties = nullptr;
+
+	int _gfxFileNo = -1;
+	int _scriptFileNo = -1;
+	int _scdFileNo = -1;
+	const TranslatorMode _mode;
+	const Common::Language _defaultLang;
+	const Common::Platform _platform;
+};
+
+} // End of namespace Snatcher
+
+#endif // SNATCHER_FANTRANSLATIONS_H
diff --git a/engines/snatcher/mem_mapping.cpp b/engines/snatcher/mem_mapping.cpp
index dbfb4d9a31a..1d302e9d4d4 100644
--- a/engines/snatcher/mem_mapping.cpp
+++ b/engines/snatcher/mem_mapping.cpp
@@ -105,6 +105,7 @@ uint32 MEM_PALDATA_42                	=	0;
 
 uint32 MEM_MODULE_LOCATION				=	0;
 uint32 MEM_SCRIPT_LOCATION				=	0;
+uint32 MEM_SCRIPT_TEXT_LOCATION			=	0;
 uint32 MEM_SUBCODE_LOCATION				=	0;
 
 void initMapping(int mappingNum) {
@@ -188,6 +189,7 @@ void initMapping(int mappingNum) {
 
 	MEM_MODULE_LOCATION				=	0x28000;
 	MEM_SCRIPT_LOCATION				=	0x1A800;
+	MEM_SCRIPT_TEXT_LOCATION		=	0x1E000;
 	MEM_SUBCODE_LOCATION			=	0xD400;
 
 	if (mappingNum == 1)
diff --git a/engines/snatcher/mem_mapping.h b/engines/snatcher/mem_mapping.h
index 64d8452e860..78049be4b18 100644
--- a/engines/snatcher/mem_mapping.h
+++ b/engines/snatcher/mem_mapping.h
@@ -108,6 +108,7 @@ extern uint32 MEM_PALDATA_42;
 
 extern uint32 MEM_MODULE_LOCATION;
 extern uint32 MEM_SCRIPT_LOCATION;
+extern uint32 MEM_SCRIPT_TEXT_LOCATION;
 extern uint32 MEM_SUBCODE_LOCATION;
 
 extern void initMapping(int mappingNum);
diff --git a/engines/snatcher/metaengine.cpp b/engines/snatcher/metaengine.cpp
index 6d381007158..f4d42411006 100644
--- a/engines/snatcher/metaengine.cpp
+++ b/engines/snatcher/metaengine.cpp
@@ -20,6 +20,7 @@
 */
 
 #include "snatcher/detection.h"
+#include "snatcher/fantranslations.h"
 #include "snatcher/saveload.h"
 #include "snatcher/snatcher.h"
 #include "common/config-manager.h"
@@ -34,18 +35,19 @@
 #include "backends/keymapper/keymapper.h"
 #include "backends/keymapper/standard-actions.h"
 
+namespace Snatcher {
+
 const ADExtraGuiOptionsMap gameGuiOptions[] = {
-	AD_EXTRA_GUI_OPTIONS_TERMINATOR
-};
+	AD_EXTRA_GUI_OPTIONS_TERMINATOR};
 
 class SnatcherMetaEngine : public AdvancedMetaEngine<SnatcherGameDescription> {
 public:
-    const char *getName() const override {
+	const char *getName() const override {
 		return "snatcher";
 	}
 
 	const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
-    bool hasFeature(MetaEngineFeature f) const override;
+	bool hasFeature(MetaEngineFeature f) const override;
 	Common::Error createInstance(OSystem *syst, Engine **engine, const SnatcherGameDescription *desc) const override;
 
 	SaveStateList listSaves(const char *target) const override;
@@ -64,41 +66,42 @@ const ADExtraGuiOptionsMap *SnatcherMetaEngine::getAdvancedExtraGuiOptions() con
 }
 
 bool SnatcherMetaEngine::hasFeature(MetaEngineFeature f) const {
-	return
-	    (f == kSupportsListSaves) ||
-	    (f == kSupportsLoadingDuringStartup) ||
-	    (f == kSupportsDeleteSave) ||
-	    (f == kSavesSupportMetaInfo) ||
-	    (f == kSavesSupportThumbnail) ||
-		(f == kSavesSupportCreationDate) ||
-		(f == kSavesSupportPlayTime) ||
-		(f == kSimpleSavesNames);
+	return (f == kSupportsListSaves) ||
+		   (f == kSupportsLoadingDuringStartup) ||
+		   (f == kSupportsDeleteSave) ||
+		   (f == kSavesSupportMetaInfo) ||
+		   (f == kSavesSupportThumbnail) ||
+		   (f == kSavesSupportCreationDate) ||
+		   (f == kSavesSupportPlayTime) ||
+		   (f == kSimpleSavesNames);
 }
 
 bool Snatcher::SnatcherEngine::hasFeature(EngineFeature f) const {
-	return
-	    (f == kSupportsReturnToLauncher) ||
-	    (f == kSupportsLoadingDuringRuntime) ||
-	    (f == kSupportsSavingDuringRuntime) ||
-	    (f == kSupportsChangingOptionsDuringRuntime);
+	return (f == kSupportsReturnToLauncher) ||
+		   (f == kSupportsLoadingDuringRuntime) ||
+		   (f == kSupportsSavingDuringRuntime) ||
+		   (f == kSupportsChangingOptionsDuringRuntime);
 }
 
 Common::Error SnatcherMetaEngine::createInstance(OSystem *syst, Engine **engine, const SnatcherGameDescription *desc) const {
-	const SnatcherGameDescription *gd = (const SnatcherGameDescription*)desc;
+	const SnatcherGameDescription *gd = (const SnatcherGameDescription *)desc;
 	Snatcher::GameDescription dsc = gd->ex_desc;
 
-	Common::Platform platform = Common::parsePlatform(ConfMan.get("platform"));
-	if (platform != Common::kPlatformUnknown)
-		dsc.platform = platform;
+	dsc.platform = desc->ad_desc.platform;
+	dsc.lang = desc->ad_desc.language;
 
-	if (dsc.lang == Common::UNK_LANG) {
-		Common::Language lang = Common::parseLanguage(ConfMan.get("language"));
-		if (lang != Common::UNK_LANG)
-			dsc.lang = lang;
-		else
-			dsc.lang = Common::EN_ANY;
+	
+	Common::List<Common::Language> langList = FanTranslationHandler::listTranslations(dsc.platform);
+
+	if (!langList.empty()) {
+		langList.push_back(dsc.lang);
+		Common::updateGameGUIOptions(desc->ad_desc.guiOptions, getGameGUIOptionsDescriptionLanguages(langList), getGameGUIOptionsDescriptionPlatform(desc->ad_desc.platform));
 	}
 
+	dsc.fanLang = Common::parseLanguage(ConfMan.get("language"));
+	if (dsc.fanLang == dsc.lang)
+		dsc.fanLang = Common::UNK_LANG;
+
 	switch (dsc.gameID) {
 	case Snatcher::GI_SNATCHER:
 		*engine = new Snatcher::SnatcherEngine(syst, dsc);
@@ -175,6 +178,7 @@ public:
 	SnatcherOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain);
 	void load() override;
 	bool save() override;
+
 private:
 	void defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const override;
 
@@ -203,15 +207,13 @@ static const char *buttonConfStrings[6] = {
 	_s("A - Cancel, B - Draw Blaster, C - Select/Shoot"),
 	_s("A - Cancel, B - Select/Shoot, C - Draw Blaster"),
 	_s("A - Select/Shoot, B - Cancel, C - Draw Blaster"),
-	_s("A - Select/Shoot, B - Draw Blaster, C - Cancel")
-};	
+	_s("A - Select/Shoot, B - Draw Blaster, C - Cancel")};
 
-SnatcherOptionsWidget::SnatcherOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain) :
-	OptionsContainerWidget(boss, name, "SnatcherOptionsWidget", domain), _buttonConfPopup(nullptr), _enableLightgunBox(nullptr), _monoSoundBox(nullptr) {
+SnatcherOptionsWidget::SnatcherOptionsWidget(GuiObject *boss, const Common::String &name, const Common::String &domain) : OptionsContainerWidget(boss, name, "SnatcherOptionsWidget", domain), _buttonConfPopup(nullptr), _enableLightgunBox(nullptr), _monoSoundBox(nullptr) {
 	GUI::StaticTextWidget *text = new GUI::StaticTextWidget(widgetsBoss(), "SnatcherOptionsWidget.ButtonRemapLabel", _("Buttons Config:"));
 	text->setAlign(Graphics::TextAlign::kTextAlignEnd);
 
-	_buttonConfPopup = new GUI::PopUpWidget(widgetsBoss(), "SnatcherOptionsWidget.ButtonRemapPopup",_("Select Controller Buttons Config"));
+	_buttonConfPopup = new GUI::PopUpWidget(widgetsBoss(), "SnatcherOptionsWidget.ButtonRemapPopup", _("Select Controller Buttons Config"));
 	assert(_buttonConfPopup);
 	for (int i = 0; i < ARRAYSIZE(buttonConfStrings); ++i) {
 		Common::U32String entryLabel = Common::U32String(buttonConfStrings[i]);
@@ -241,19 +243,19 @@ bool SnatcherOptionsWidget::save() {
 void SnatcherOptionsWidget::defineLayout(GUI::ThemeEval &layouts, const Common::String &layoutName, const Common::String &overlayedLayout) const {
 	layouts.addDialog(layoutName, overlayedLayout)
 		.addLayout(GUI::ThemeLayout::kLayoutVertical)
-			.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
-				.addPadding(0, 30, 0, 0)
-				.addWidget("ButtonRemapLabel", "OptionsLabel")
-				.addPadding(10, 0, 0, 0)
-				.addSpace(10)
-				.addWidget("ButtonRemapPopup", "PopupWidget")
-			.closeLayout()
-			.addPadding(0, 0, 10, 0)
-			.addWidget("EnableLightgunBox", "Checkbox")	
-			.addPadding(0, 0, 10, 0)
-			.addWidget("MonoSoundBox", "Checkbox")
+		.addLayout(GUI::ThemeLayout::kLayoutHorizontal)
+		.addPadding(0, 30, 0, 0)
+		.addWidget("ButtonRemapLabel", "OptionsLabel")
+		.addPadding(10, 0, 0, 0)
+		.addSpace(10)
+		.addWidget("ButtonRemapPopup", "PopupWidget")
+		.closeLayout()
+		.addPadding(0, 0, 10, 0)
+		.addWidget("EnableLightgunBox", "Checkbox")
+		.addPadding(0, 0, 10, 0)
+		.addWidget("MonoSoundBox", "Checkbox")
 		.closeLayout()
-	.closeDialog();
+		.closeDialog();
 }
 
 const char *const kLightGunKeymapName = "snlightgun";
@@ -301,8 +303,10 @@ Common::KeymapArray SnatcherMetaEngine::initKeymaps(const char *target) const {
 	return res;
 }
 
+} // End of namespace Snatcher
+
 #if PLUGIN_ENABLED_DYNAMIC(SNATCHER)
-	REGISTER_PLUGIN_DYNAMIC(SNATCHER, PLUGIN_TYPE_ENGINE, SnatcherMetaEngine);
+	REGISTER_PLUGIN_DYNAMIC(SNATCHER, PLUGIN_TYPE_ENGINE, Snatcher::SnatcherMetaEngine);
 #else
-	REGISTER_PLUGIN_STATIC(SNATCHER, PLUGIN_TYPE_ENGINE, SnatcherMetaEngine);
+	REGISTER_PLUGIN_STATIC(SNATCHER, PLUGIN_TYPE_ENGINE, Snatcher::SnatcherMetaEngine);
 #endif
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index 18b3f97f176..5d65e1307f1 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/snatcher
 MODULE_OBJS := \
 	action.o \
 	animator_scd.o \
+	fantranslations.o \
 	graphics.o \
 	memory.o \
 	mem_mapping.o \
@@ -34,3 +35,10 @@ include $(srcdir)/rules.mk
 
 # Detection objects
 DETECT_OBJS += $(MODULE)/detection.o
+
+# Skip building the following objects if a static
+# module is enabled, because it already has the contents.
+ifneq ($(ENABLE_SNATCHER), STATIC_PLUGIN)
+# External dependencies for detection.
+DETECT_OBJS += $(MODULE)/fantranslations.o
+endif
diff --git a/engines/snatcher/resource.h b/engines/snatcher/resource.h
index 511b5362563..10aac80340e 100644
--- a/engines/snatcher/resource.h
+++ b/engines/snatcher/resource.h
@@ -35,6 +35,7 @@ namespace Snatcher {
 
 class SnatcherEngine;
 class SceneModule;
+class FanTranslationHandler;
 class FIO;
 
 class SceneHandler {
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index 43d73d0d285..245858194e3 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -21,6 +21,7 @@
 
 
 #include "snatcher/action.h"
+#include "snatcher/fantranslations.h"
 #include "snatcher/graphics.h"
 #include "snatcher/memory.h"
 #include "snatcher/mem_mapping.h"
@@ -186,7 +187,10 @@ void CmdQueue::m_printText(const uint16 *&data) {
 		return;
 	uint32 addr = *reinterpret_cast<const uint32*>(data);
 	data += 2;
-	_vm->gfx()->printText(addr >= MemMapping::MEM_MODULE_LOCATION ? _vm->_module->getPtr(addr)() : _vm->_scd->makePtr(addr)());
+
+	const uint8 *text = addr >= MemMapping::MEM_MODULE_LOCATION ? _vm->_module->getPtr(addr)() : _vm->_scd->makePtr(addr)();
+	_vm->gfx()->printText(_vm->_translator->process(addr, text));
+
 	_progress = -1;
 }
 
@@ -336,11 +340,13 @@ void CmdQueue::m_loadResource(const uint16 *&data) {
 			delete[] _state->script.data;
 			_state->script.data = _vm->_fio->fileData(index, &_state->script.dataSize);
 			assert(_state->script.data);
+			_vm->_translator->loadFile(index, FanTranslationHandler::kScript);
 			_vm->_ui->setScriptTextResource(_state->script.getTextResource());
 		} else if (dest == MemMapping::MEM_MODULE_LOCATION) {
 			delete _vm->_module;
 			_vm->_module = _vm->_fio->loadModule(index);
 			assert(_vm->_module);
+			_vm->_translator->loadFile(index, FanTranslationHandler::kModule);
 		} else {
 			error("%s(): Unexpected target address 0x%08x", __FUNCTION__, dest);
 		}
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index 5f1864fbb9f..fa3f6d5c4eb 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -20,6 +20,7 @@
 */
 
 #include "snatcher/action.h"
+#include "snatcher/fantranslations.h"
 #include "snatcher/graphics.h"
 #include "snatcher/memory.h"
 #include "snatcher/mem_mapping.h"
@@ -52,7 +53,7 @@ namespace Snatcher {
 
 SnatcherEngine::SnatcherEngine(OSystem *system, GameDescription &dsc) : Engine(system), _game(dsc), _fio(nullptr), _module(nullptr), _scd(nullptr), _gfx(nullptr), _snd(nullptr), _input(),
 	_scriptEngine(nullptr), _cmdQueue(nullptr), _aseq(nullptr), _lastKeys(0), _releaseKeys(0), _keyRepeat(false), _enableLightGun(false), _ui(nullptr), _gfxInfo(), _saveMan(nullptr), _reset(0),
-		_updateGameSettings(false), _memHandler(nullptr), _frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
+		_updateGameSettings(false), _memHandler(nullptr), _translator(nullptr), _frameLen((100000 << 14) / (6000000 / 1001)), _realLightGunPos() {
 	assert(system);
 	MemMapping::initMapping(_game.usePALTiming ? 1 : 0);
 }
@@ -69,6 +70,7 @@ SnatcherEngine::~SnatcherEngine() {
 	delete _scriptEngine;
 	delete _snd;
 	delete _ui;
+	delete _translator;
 }
 
 Common::Error SnatcherEngine::run() {
@@ -97,6 +99,10 @@ Common::Error SnatcherEngine::run() {
 }
 
 bool SnatcherEngine::initResource() {
+	_translator = new FanTranslationHandler(_game.platform, _game.lang, _game.fanLang, FanTranslationHandler::kTranslate);
+	if (!_translator)
+		return false;
+
 	_fio = new FIO(this);
 	if (!_fio)
 		return false;
@@ -109,6 +115,8 @@ bool SnatcherEngine::initResource() {
 	if (!_scd)
 		return false;
 
+	_translator->loadFile(96, FanTranslationHandler::kSCD);
+
 	return true;
 }
 
@@ -173,8 +181,9 @@ bool SnatcherEngine::initScriptEngine() {
 	if (!_cmdQueue)
 		return false;
 
+	assert(_translator);
 	assert(_scd);
-	_ui = new UI(_gfx, _cmdQueue, _scd);
+	_ui = new UI(_gfx, _cmdQueue, _scd, _translator);
 	if (!_ui)
 		return false;
 
@@ -788,7 +797,8 @@ void SnatcherEngine::applyGameSettings() {
 }
 
 void SnatcherEngine::pauseEngineIntern(bool pause) {
-	_snd->pause(pause);
+	if (_snd)
+		_snd->pause(pause);
 }
 
 bool SnatcherEngine::canLoadGameStateCurrently(Common::U32String*) {
diff --git a/engines/snatcher/snatcher.h b/engines/snatcher/snatcher.h
index 61d95557ecb..ac81e6a24a3 100644
--- a/engines/snatcher/snatcher.h
+++ b/engines/snatcher/snatcher.h
@@ -33,8 +33,9 @@ namespace Snatcher {
 
 class ActionSequenceHandler;
 class CmdQueue;
-class GraphicsEngine;
+class FanTranslationHandler;
 class FIO;
+class GraphicsEngine;
 class MemAccessHandler;
 class ResourcePointer;
 class SaveLoadManager;
@@ -117,6 +118,9 @@ private:
 	MemAccessHandler *_memHandler;
 	ScriptEngine *_scriptEngine;
 
+	// Fan Translations
+	FanTranslationHandler *_translator;
+
 public:
 	// Input
 	struct Input {
diff --git a/engines/snatcher/sound.cpp b/engines/snatcher/sound.cpp
index c63aa7e8a9b..37bf904b78a 100644
--- a/engines/snatcher/sound.cpp
+++ b/engines/snatcher/sound.cpp
@@ -92,10 +92,14 @@ const SoundEngine::PCMStatus &SoundEngine::pcmGetStatus() const {
 }
 
 void SoundEngine::pause(bool toggle) {
-	_dev->pause(toggle);
+	if (_dev)
+		_dev->pause(toggle);
 }
 
 void SoundEngine::update() {
+	if (!_dev)
+		return;
+
 	_dev->update();
 
 	_pcmStatus.statusBits = _dev->pcmGetStatus();
diff --git a/engines/snatcher/state.h b/engines/snatcher/state.h
index 5f526c6803c..5def1adc240 100644
--- a/engines/snatcher/state.h
+++ b/engines/snatcher/state.h
@@ -26,6 +26,8 @@
 #include "common/rect.h"
 #include "common/scummsys.h"
 
+#include "snatcher/mem_mapping.h"
+
 namespace Snatcher {
 
 class SnatcherEngine;
@@ -90,7 +92,8 @@ struct Script {
 };
 
 struct GameState {
-	GameState() : frameNo(0), frameState(0), modFinish(0), modPhaseTop(0), modPhaseSub(0), counter(0), modIndex(0), menuSelect(0), prologue(0), pendingSaveLoad(0), phase(0), updateFlags(0), saveInfo(), conf(), script(0x3800, phase), totalPlayTime(0) {}
+	GameState() : frameNo(0), frameState(0), modFinish(0), modPhaseTop(0), modPhaseSub(0), counter(0), modIndex(0), menuSelect(0), prologue(0),
+		pendingSaveLoad(0), phase(0), updateFlags(0), saveInfo(), conf(), script(MemMapping::MEM_SCRIPT_TEXT_LOCATION - MemMapping::MEM_SCRIPT_LOCATION, phase), totalPlayTime(0) {}
 	int16 frameNo;
 	int16 frameState;
 	int16 modFinish;
diff --git a/engines/snatcher/ui.cpp b/engines/snatcher/ui.cpp
index b3c411ffca9..4a65a2b6b04 100644
--- a/engines/snatcher/ui.cpp
+++ b/engines/snatcher/ui.cpp
@@ -20,6 +20,7 @@
 */
 
 
+#include "snatcher/fantranslations.h"
 #include "snatcher/graphics.h"
 #include "snatcher/mem_mapping.h"
 #include "snatcher/resource.h"
@@ -32,13 +33,13 @@
 
 namespace Snatcher {
 
-UI::UI(GraphicsEngine *gfx, CmdQueue *que, ResourcePointer *scd) : _gfx(gfx), _que(que), _scd(scd), _sceneId(0), _textLineBreak(0), _dialogTextBuffer(nullptr), _textColor(0),
-	_scriptTextResource(nullptr),/*_makestrbt1(0),*/ _textY(0), _headLineYOffset(0), _sceneTextOffsCur(0), _textLineEnd(0), _sceneInfo(0), _sceneTextOffset(0), _flashLight(),
-		_sceneTextOffsStart(0), _waitCursorFrame(0), _waitCursorAnimDelay(0), _progress(-1), _progress2(-1), _controllerCfg(0), _verbInterfaceMode(0), _verbsInterpreterMode(0),
-			_lastVerbFirstPage(0), _numVerbsFirstPage(0), _numVerbsLastPage(0), _lastVerbLastPage(0), _numVerbsMax(0), _verbsTabCurPage(0), _lastVerbDrawn(0), _verbTextBuffer(nullptr), _scriptVerbsArray(nullptr),
-				_scriptSentenceArray(nullptr), _prevSelectedVerb(0), _selectedVerb(0), _lastHiliteVerb(0), _hiliteVerb(0), _savedHiliteVerb(0), _textInputMarginLeft(0), _videoPhoneMode(0),
-					_textInputColumnCur(0), _textInputColumnMax(0), _textInputCursorState(0), _textInputCursorBlinkCnt(0), _underscoreStr(nullptr), _textInputStr(nullptr), _vkeybPosTotal(0),
-						_vkeybColumnWidth(0), _verbsTabLayoutMap(nullptr), _verbsTabOffsX(0), _verbsTabOffsY(0), _hilitePosX(0), _hilitePosY(0), _vkeybVisible(false) {
+UI::UI(GraphicsEngine *gfx, CmdQueue *que, ResourcePointer *scd, FanTranslationHandler *translator) : _gfx(gfx), _que(que), _scd(scd), _translator(translator), _sceneId(0), _textLineBreak(0),
+	_dialogTextBuffer(nullptr), _textColor(0), _scriptTextResource(nullptr), _scriptCurText(nullptr), _textY(0), _headLineYOffset(0), _sceneTextOffsCur(0), _textLineEnd(0), _sceneInfo(0),
+		_flashLight(), _sceneTextOffsStart(0), _waitCursorFrame(0), _waitCursorAnimDelay(0), _progress(-1), _progress2(-1), _controllerCfg(0), _verbInterfaceMode(0), _verbsInterpreterMode(0),
+			_lastVerbFirstPage(0), _numVerbsFirstPage(0), _numVerbsLastPage(0), _lastVerbLastPage(0), _numVerbsMax(0), _verbsTabCurPage(0), _lastVerbDrawn(0), _verbTextBuffer(nullptr), _sceneTextOffset(0),
+				_scriptVerbsArray(nullptr), _scriptSentenceArray(nullptr), _prevSelectedVerb(0), _selectedVerb(0), _lastHiliteVerb(0), _hiliteVerb(0), _savedHiliteVerb(0), _textInputMarginLeft(0),
+					_videoPhoneMode(0), _textInputColumnCur(0), _textInputColumnMax(0), _textInputCursorState(0), _textInputCursorBlinkCnt(0), _underscoreStr(nullptr), _textInputStr(nullptr),
+						_vkeybPosTotal(0), _vkeybColumnWidth(0), _verbsTabLayoutMap(nullptr), _verbsTabOffsX(0), _verbsTabOffsY(0), _hilitePosX(0), _hilitePosY(0), _vkeybVisible(false) {
 
 	_dialogTextBuffer = new uint8[256]();
 	_verbTextBuffer = new uint8[50]();
@@ -544,7 +545,7 @@ bool UI::canSaveHere() const {
 
 void UI::printDialogStringHead() {
 	static const uint8 strHead[] = { 0xFC, 0x00, 0xF9, 0x01, 0xFB, 0x10, 0x00, 0xFE };
-	const uint8 *s = _scd->makePtr(MemMapping::MEM_UIDATA_06).getDataFromTable(_sceneId)();
+	const uint8 *s = _translator->process(_scd->makePtr(MemMapping::MEM_UIDATA_06 + _sceneId * 2).readUINT16(), _scd->makePtr(MemMapping::MEM_UIDATA_06).getDataFromTable(_sceneId)());
 	memcpy(_dialogTextBuffer, strHead, sizeof(strHead));
 	_dialogTextBuffer[6] = _headLineYOffset;
 	_dialogTextBuffer[8] = (*s & 0x80) ? 3 : (*s++ & 7);
@@ -576,10 +577,15 @@ void UI::printDialogStringBody() {
 	//_makestrbt1 = 0xFF;
 	*d++ = _sceneId ? 24 : 40;
 	*d++ = _textY;
-
 	_textLineBreak = 0;
-	assert(_scriptTextResource);
-	const uint8 *s = _scriptTextResource + _sceneTextOffsCur;
+
+	if (_sceneTextOffsCur == _sceneTextOffsStart) {
+		assert(_scriptTextResource);
+		_scriptCurText = _translator->process(MemMapping::MEM_SCRIPT_TEXT_LOCATION + _sceneTextOffsStart, _scriptTextResource + _sceneTextOffsStart);
+	}
+
+	const uint8 *s = _scriptCurText + _sceneTextOffsCur - _sceneTextOffsStart;
+
 	for (int i = 0; i < 50;++i) {
 		uint8 in = *s++;
 		++_sceneTextOffsCur;
@@ -671,7 +677,7 @@ uint8 UI::drawVerb(uint8 id) {
 		return 0xFF;
 
 	uint16 offs = _scriptVerbsArray->read(id);
-	const uint8 *s = _scriptTextResource + offs;
+	const uint8 *s = _translator->process(MemMapping::MEM_SCRIPT_TEXT_LOCATION + offs, _scriptTextResource + offs);
 
 	uint8 *d = _verbTextBuffer + 9;
 	for (int i = 0; i < 33; ++i) {
diff --git a/engines/snatcher/ui.h b/engines/snatcher/ui.h
index 15076770c5b..ec35af7c0c0 100644
--- a/engines/snatcher/ui.h
+++ b/engines/snatcher/ui.h
@@ -35,12 +35,13 @@ class SeekableWriteStream;
 namespace Snatcher {
 
 class CmdQueue;
+class FanTranslationHandler;
 class GraphicsEngine;
 class ResourcePointer;
 class ScriptArray;
 class UI {
 public:
-	UI(GraphicsEngine *gfx, CmdQueue *que, ResourcePointer *scd);
+	UI(GraphicsEngine *gfx, CmdQueue *que, ResourcePointer *scd, FanTranslationHandler *translator);
 	~UI();
 
 	void setControllerConfig(uint8 cfg) { _controllerCfg = cfg; }
@@ -100,6 +101,7 @@ private:
 	uint8 *_dialogTextBuffer;
 
 	const uint8 *_scriptTextResource;
+	const uint8 *_scriptCurText;
 	uint8 _controllerCfg;
 	int16 _progress;
 
@@ -164,6 +166,7 @@ private:
 	GraphicsEngine *_gfx;
 	CmdQueue *_que;
 	ResourcePointer *_scd;
+	FanTranslationHandler *_translator;
 };
 
 } // End of namespace Snatcher


Commit: 44851d4c43a864139bc0b162f7591d2ca57bed8c
    https://github.com/scummvm/scummvm/commit/44851d4c43a864139bc0b162f7591d2ca57bed8c
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: minor cleanup and comment fixes

Changed paths:
    audio/softsynth/fmtowns_pc98/pcm_common.h
    audio/softsynth/fmtowns_pc98/sega_audio.cpp
    audio/softsynth/fmtowns_pc98/sega_audio.h
    graphics/segagfx.h


diff --git a/audio/softsynth/fmtowns_pc98/pcm_common.h b/audio/softsynth/fmtowns_pc98/pcm_common.h
index 626aa06b690..aa6522a8700 100644
--- a/audio/softsynth/fmtowns_pc98/pcm_common.h
+++ b/audio/softsynth/fmtowns_pc98/pcm_common.h
@@ -42,7 +42,6 @@ public:
 	bool isActive() const;
 	void activate();
 	void deactivate();
-	uint16 pos() const;
 
 protected:
 	void setData(const int8 *data, uint32 dataEnd, uint32 dataStart = 0);
diff --git a/audio/softsynth/fmtowns_pc98/sega_audio.cpp b/audio/softsynth/fmtowns_pc98/sega_audio.cpp
index 06a3ac6d15e..55d13cc4e74 100644
--- a/audio/softsynth/fmtowns_pc98/sega_audio.cpp
+++ b/audio/softsynth/fmtowns_pc98/sega_audio.cpp
@@ -24,7 +24,6 @@
 #include "audio/softsynth/fmtowns_pc98/pcm_common.h"
 #include "common/mutex.h"
 
-
 class SegaPCMChannel final : public PCMChannel_Base {
 public:
 	SegaPCMChannel(SegaAudioInterfaceInternal *sai) : PCMChannel_Base(), _sai(sai), _playing(false), _stream(), _streamSamplesLeft(0), _streamFeedLen(0), _streamStartAddr(0), _streamTempBuff(nullptr) {}
diff --git a/audio/softsynth/fmtowns_pc98/sega_audio.h b/audio/softsynth/fmtowns_pc98/sega_audio.h
index bb162a902dd..650db87a595 100644
--- a/audio/softsynth/fmtowns_pc98/sega_audio.h
+++ b/audio/softsynth/fmtowns_pc98/sega_audio.h
@@ -57,8 +57,8 @@ public:
 
 	// Convenience function, since it is so much easier to implement this on this level than having the samples buffer
 	// invoke a callback into the engine
-	// @ memstart: same 8-bit format as dataStart (in playPCMChannel), begin of the buffer in the PCM memory area
-	// @ memAreaSize: byte size of the buffer in the PCM memory area
+	// @param memstart: same 8-bit format as dataStart (in playPCMChannel), begin of the buffer in the PCM memory area
+	// @param memAreaSize: byte size of the buffer in the PCM memory area
 	void playPCMStream(Common::SharedPtr<Common::SeekableReadStream> &stream, uint8 memStart, uint16 memAreaSize, uint8 channel, uint16 rate, uint8 pan, uint8 vol);
 
 	// OPN registers
diff --git a/graphics/segagfx.h b/graphics/segagfx.h
index 386bb349f10..f33fb6b68e1 100644
--- a/graphics/segagfx.h
+++ b/graphics/segagfx.h
@@ -212,16 +212,6 @@ public:
 	 */
 	void clearPlanes();
 
-	/**
-	 * Render vram in its current state to the target buffer/surface.
-	 * @param surf/dest:		target surface or buffer
-	 * @param renderBlockX, renderBlockY, renderBlockWidth, renderBlockHeight:
-								block (8x8 pixels) coordinates of target render area. Values of -1 for maximum range / full screen rendering.
-	 * @param spritesOnly:		skip rendering of the planes and only render the sprites.
-	 */
-	//void render(Surface *surf, int renderBlockX = -1, int renderBlockY = -1, int renderBlockWidth = -1, int renderBlockHeight = -1, bool spritesOnly = false);
-	//void render(uint8 *dest, int renderBlockX = -1, int renderBlockY = -1, int renderBlockWidth = -1, int renderBlockHeight = -1, bool spritesOnly = false);
-
 	/**
 	 * Render vram in its current state to the target buffer/surface.
 	 * @param surf/dst:		Target surface or buffer.
@@ -261,13 +251,19 @@ public:
 	typedef Common::Functor1Mem<SegaRenderer*, void, HINTClient> HINTHandler;
 
 	/**
-	 * Horizontal Interrupt
-	 * @hINT_enable:			enable/disable
-	 * @hINT_setCounter			number of scan lines between hINT handler invocation
-	 * @hINT_setHandler			set hINT handler callback
+	 * Enable or disable horizontal interrupt emulation
+	 * @param enable:			enable / disable
 	 */
 	void hINT_enable(bool enable);
+	/**
+	 * Set the number of scan lines between horizontal interrupt handler invocation
+	 * @param counter:			number of scan lines
+	 */
 	void hINT_setCounter(uint8 counter);
+	/**
+	 * Set horizontal interrupt handler callback
+	 * @param hdl:				callback function
+	 */
 	void hINT_setHandler(const HINTHandler *hdl);
 
 protected:


Commit: 22fbf049144466906a79e2c569c0eee4795abf30
    https://github.com/scummvm/scummvm/commit/22fbf049144466906a79e2c569c0eee4795abf30
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix memory leaks

Changed paths:
    engines/snatcher/saveload.cpp
    graphics/segagfx.cpp


diff --git a/engines/snatcher/saveload.cpp b/engines/snatcher/saveload.cpp
index eb4b0f75363..253c6743416 100644
--- a/engines/snatcher/saveload.cpp
+++ b/engines/snatcher/saveload.cpp
@@ -325,6 +325,7 @@ Common::OutSaveFile *SaveLoadManager::openFileForSaving(int slot, const Common::
 		error("%s(): Unable to create thumbnail", __FUNCTION__);
 
 	Graphics::saveThumbnail(*out, tn);
+	tn.free();
 
 	TimeDate td;
 	_vm->_system->getTimeAndDate(td);
diff --git a/graphics/segagfx.cpp b/graphics/segagfx.cpp
index 5a59a12cc5a..ce707a29f8e 100644
--- a/graphics/segagfx.cpp
+++ b/graphics/segagfx.cpp
@@ -84,6 +84,7 @@ SegaRenderer::~SegaRenderer() {
 	delete[] _tempBufferSpritesPrio;
 	delete[] _tempBufferPlanes;
 	delete[] _tempBufferPlanesPrio;
+	delete[] _renderColorTable;
 }
 
 void SegaRenderer::setResolution(int w, int h) {


Commit: fcd6f6d4faf51f2fa26502fe50d3185a07429fd4
    https://github.com/scummvm/scummvm/commit/fcd6f6d4faf51f2fa26502fe50d3185a07429fd4
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
KYRA: (EOB/SegaCD) - fix for BE machines

Changed paths:
    engines/kyra/graphics/screen_eob_segacd.cpp


diff --git a/engines/kyra/graphics/screen_eob_segacd.cpp b/engines/kyra/graphics/screen_eob_segacd.cpp
index aa8bd6fe022..d2ce74e8cf8 100644
--- a/engines/kyra/graphics/screen_eob_segacd.cpp
+++ b/engines/kyra/graphics/screen_eob_segacd.cpp
@@ -539,8 +539,8 @@ void SegaAnimator::update() {
 		if (s->x == 0x4000)
 			continue;
 		*dst++ = TO_BE_16(s->y + 128);
-		uint16 a = (*dst & 0xFF00);
-		*dst++ = a | (s->hw & 0xFF);
+		uint16 a = (FROM_BE_16(*dst) & 0xFF);
+		*dst++ = TO_BE_16(((s->hw & 0xFF) << 8) | a);
 		*dst++ = TO_BE_16(s->nameTbl);
 		*dst++ = TO_BE_16(s->x + 128);
 	}


Commit: 6b7b3e65993e07684101ca1e3b26533b5070ef8e
    https://github.com/scummvm/scummvm/commit/6b7b3e65993e07684101ca1e3b26533b5070ef8e
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: clear temp buffer when loading savegames

Changed paths:
    engines/snatcher/saveload.cpp


diff --git a/engines/snatcher/saveload.cpp b/engines/snatcher/saveload.cpp
index 253c6743416..9c6c6aeaa14 100644
--- a/engines/snatcher/saveload.cpp
+++ b/engines/snatcher/saveload.cpp
@@ -226,6 +226,8 @@ void SaveLoadManager::loadState(int slot, GameState &state) {
 		uint8 *tmp = new uint8[tsize];
 		in->read(tmp, tsize);
 		_tempState = Common::SharedPtr<Common::MemoryReadStream>(new Common::MemoryReadStream(tmp, tsize, DisposeAfterUse::YES));
+	} else {
+		_tempState.reset();
 	}
 
 	_vm->_scriptEngine->loadState(in, state.script, flags);


Commit: e61201c2ba4cf08da90a3daf6a80729758a89d96
    https://github.com/scummvm/scummvm/commit/e61201c2ba4cf08da90a3daf6a80729758a89d96
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: (Sega Audio) - fix pcm audio regression

Changed paths:
    audio/softsynth/fmtowns_pc98/sega_audio.cpp


diff --git a/audio/softsynth/fmtowns_pc98/sega_audio.cpp b/audio/softsynth/fmtowns_pc98/sega_audio.cpp
index 55d13cc4e74..e2fc088aba6 100644
--- a/audio/softsynth/fmtowns_pc98/sega_audio.cpp
+++ b/audio/softsynth/fmtowns_pc98/sega_audio.cpp
@@ -377,8 +377,7 @@ SegaPCMChannel::~SegaPCMChannel() {
 
 void SegaPCMChannel::play(const int8 *data, uint16 dataSize, uint16 startAddress, uint16 loopStart, uint16 loopLen, uint16 rate, uint8 pan, uint8 vol) {
 	setData(data, (startAddress + dataSize) << 11, startAddress << 11);
-	if (_streamTempBuff != nullptr)
-		setupLoop(loopLen ? loopStart : (startAddress + dataSize), loopLen);
+	setupLoop(loopLen ? loopStart : (startAddress + dataSize), loopLen);
 	setRate(rate);
 	setPanPos(pan);
 	setVolume(vol);


Commit: c60c312adbcbb652b5b9b575f52470d4f3d39247
    https://github.com/scummvm/scummvm/commit/c60c312adbcbb652b5b9b575f52470d4f3d39247
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: (Sega Renderer) - add sanity check

Changed paths:
    graphics/segagfx.cpp


diff --git a/graphics/segagfx.cpp b/graphics/segagfx.cpp
index ce707a29f8e..aba6ef03532 100644
--- a/graphics/segagfx.cpp
+++ b/graphics/segagfx.cpp
@@ -165,7 +165,8 @@ void SegaRenderer::setupPlaneAB(int pixelWidth, int pixelHeigth) {
 		_planes[i].mod = _planes[i].h;
 		_planes[i].nameTableSize = _planes[i].w * _planes[i].h;
 	}
-	_pitch = pixelWidth >> 3;
+	if (pixelWidth != -1)
+		_pitch = pixelWidth >> 3;
 }
 
 void SegaRenderer::setupWindowPlane(int baseX, int baseY, int horizontalMode, int verticalMode) {


Commit: 88d92de84142b97ec4586c20653b53ed565216a5
    https://github.com/scummvm/scummvm/commit/88d92de84142b97ec4586c20653b53ed565216a5
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: fix regression

(the offset safety checking was too "agressive",
it doesn't need to check a pointer if nothing is
read from or written to it)

Changed paths:
    engines/snatcher/resource.cpp


diff --git a/engines/snatcher/resource.cpp b/engines/snatcher/resource.cpp
index 58e08573e3e..ad530d2f472 100644
--- a/engines/snatcher/resource.cpp
+++ b/engines/snatcher/resource.cpp
@@ -115,7 +115,6 @@ ResourcePointer::ResourcePointer(uint8 *data, uint32 dataSize, uint32 offs, uint
 	if (_offset >= _moduleLocation)
 		_offset -= _moduleLocation;
 	checkOffset(0, __FUNCTION__);
-	checkOffset(0, __FUNCTION__);
 }
 
 ResourcePointer::ResourcePointer(const ResourcePointer &ptr) : _dataStart(ptr._dataStart), _dataSize(ptr._dataSize), _offset(ptr._offset), _moduleLocation(ptr._moduleLocation), _writeableDataStart(ptr._writeableDataStart), _ownBuffer(false) {
@@ -136,12 +135,10 @@ const uint8 *ResourcePointer::operator()() const {
 }
 
 const uint8 *ResourcePointer::operator++(int) {
-	checkOffset(0, __FUNCTION__);
 	return _dataStart + (_offset++);
 }
 
 const uint8 *ResourcePointer::operator++() {
-	checkOffset(1, __FUNCTION__);
 	return _dataStart + (++_offset);
 }
 


Commit: 8fff148145b45fe8e7ae28919dd2d37e60cb463a
    https://github.com/scummvm/scummvm/commit/8fff148145b45fe8e7ae28919dd2d37e60cb463a
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
KYRA: rename sega renderer class

(making its purpose easier to understand)

Changed paths:
    engines/kyra/engine/eob.cpp
    engines/kyra/graphics/screen_eob.h
    engines/kyra/graphics/screen_eob_segacd.cpp
    engines/kyra/graphics/screen_eob_segacd.h
    engines/kyra/gui/gui_eob_segacd.cpp
    engines/kyra/sequence/seqplayer_eob_segacd.h
    engines/kyra/sequence/sequences_eob.cpp
    engines/kyra/text/text_eob_segacd.h


diff --git a/engines/kyra/engine/eob.cpp b/engines/kyra/engine/eob.cpp
index 5fcb602be5c..77d63b00f10 100644
--- a/engines/kyra/engine/eob.cpp
+++ b/engines/kyra/engine/eob.cpp
@@ -1046,7 +1046,7 @@ void EoBEngine::displayParchment(int id) {
 		gui_drawCharPortraitWithStats(i);
 	}
 
-	SCDRenderer *r = _screen->sega_getRenderer();
+	SegaCDRenderer *r = _screen->sega_getRenderer();
 	r->fillRectWithTiles(0, 0, 0, 40, 28, 0);
 	r->fillRectWithTiles(1, 0, 0, 40, 28, 0);
 	_screen->sega_getAnimator()->clearSprites();
@@ -1135,7 +1135,7 @@ bool EoBEngine::checkPartyStatusExtra() {
 		snd_stopSound();
 
 		Common::SeekableReadStreamEndian *in = _res->createEndianAwareReadStream("GO");
-		SCDRenderer *r = _screen->sega_getRenderer();
+		SegaCDRenderer *r = _screen->sega_getRenderer();
 		r->loadStreamToVRAM(in, 0x20);
 		delete in;
 
diff --git a/engines/kyra/graphics/screen_eob.h b/engines/kyra/graphics/screen_eob.h
index 895b8371933..5008129dd0d 100644
--- a/engines/kyra/graphics/screen_eob.h
+++ b/engines/kyra/graphics/screen_eob.h
@@ -31,10 +31,10 @@
 namespace Kyra {
 
 class EoBCoreEngine;
-class SCDRenderer;
+class SegaCDRenderer;
 class SegaAnimator;
 class Screen_EoB : public Screen {
-friend class SCDRenderer;
+friend class SegaCDRenderer;
 public:
 	// The purpose of this enum is to keep better track of which page is used
 	// when and for which purpose. We use the pages for more backup operations
@@ -159,7 +159,7 @@ public:
 	uint8 *sega_convertShape(const uint8 *src, int w, int h, int pal, int hOffs = 0);
 	void sega_encodeShapesFromSprites(const uint8 **dst, const uint8 *src, int numShapes, int w, int h, int pal, bool removeSprites = true);
 
-	SCDRenderer *sega_getRenderer() const { return _segaRenderer; }
+	SegaCDRenderer *sega_getRenderer() const { return _segaRenderer; }
 	SegaAnimator *sega_getAnimator() const { return _segaAnimator; }
 
 private:
@@ -223,7 +223,7 @@ private:
 
 	PaletteFader *_palFaders;
 	bool _specialColorReplace;
-	SCDRenderer *_segaRenderer;
+	SegaCDRenderer *_segaRenderer;
 	SegaAnimator *_segaAnimator;
 	uint16 _segaCurPalette[64];
 	uint16 *_segaCustomPalettes;
diff --git a/engines/kyra/graphics/screen_eob_segacd.cpp b/engines/kyra/graphics/screen_eob_segacd.cpp
index d2ce74e8cf8..8f8ade5bc3f 100644
--- a/engines/kyra/graphics/screen_eob_segacd.cpp
+++ b/engines/kyra/graphics/screen_eob_segacd.cpp
@@ -30,13 +30,13 @@
 namespace Kyra {
 
 void Screen_EoB::sega_initGraphics() {
-	_segaRenderer = new SCDRenderer(this);
+	_segaRenderer = new SegaCDRenderer(this);
 	_segaRenderer->setResolution(320, 224);
-	_segaRenderer->setPlaneTableLocation(SCDRenderer::kPlaneA, 0xC000);
-	_segaRenderer->setPlaneTableLocation(SCDRenderer::kPlaneB, 0xE000);
-	_segaRenderer->setPlaneTableLocation(SCDRenderer::kWindowPlane, 0xF000);
+	_segaRenderer->setPlaneTableLocation(SegaCDRenderer::kPlaneA, 0xC000);
+	_segaRenderer->setPlaneTableLocation(SegaCDRenderer::kPlaneB, 0xE000);
+	_segaRenderer->setPlaneTableLocation(SegaCDRenderer::kWindowPlane, 0xF000);
 	_segaRenderer->setupPlaneAB(512, 512);
-	_segaRenderer->setupWindowPlane(0, 0, SCDRenderer::kWinToLeft, SCDRenderer::kWinToTop);
+	_segaRenderer->setupWindowPlane(0, 0, SegaCDRenderer::kWinToLeft, SegaCDRenderer::kWinToTop);
 	_segaRenderer->setHScrollTableLocation(0xD800);
 	_segaRenderer->setSpriteTableLocation(0xDC00);
 	_segaAnimator = new SegaAnimator(_segaRenderer);
@@ -360,14 +360,14 @@ void Screen_EoB::sega_encodeShapesFromSprites(const uint8 **dst, const uint8 *sr
 	setCurPage(cp);
 }
 
-SCDRenderer::SCDRenderer(Screen_EoB *screen) : Graphics::SegaRenderer(), _screen(screen) {
+SegaCDRenderer::SegaCDRenderer(Screen_EoB *screen) : Graphics::SegaRenderer(), _screen(screen) {
 	setResolution(320, 224);
 }
 
-SCDRenderer::~SCDRenderer() {
+SegaCDRenderer::~SegaCDRenderer() {
 }
 
-void SCDRenderer::loadStreamToVRAM(Common::SeekableReadStream *in, uint16 addr, bool compressedData) {
+void SegaCDRenderer::loadStreamToVRAM(Common::SeekableReadStream *in, uint16 addr, bool compressedData) {
 	assert(in);
 	uint8 *dst = _vram + addr;
 
@@ -386,7 +386,7 @@ void SCDRenderer::loadStreamToVRAM(Common::SeekableReadStream *in, uint16 addr,
 	}
 }
 
-void SCDRenderer::fillRectWithTiles(int vramArea, int x, int y, int w, int h, uint16 nameTblEntry, bool incr, bool topToBottom, const uint16 *patternTable) {
+void SegaCDRenderer::fillRectWithTiles(int vramArea, int x, int y, int w, int h, uint16 nameTblEntry, bool incr, bool topToBottom, const uint16 *patternTable) {
 	uint16 addr = vramArea ? (vramArea == 1 ? 0xE000 : 0xF000) : 0xC000;
 	if (y & 0x8000) {
 		y &= ~0x8000;
@@ -444,7 +444,7 @@ void SCDRenderer::fillRectWithTiles(int vramArea, int x, int y, int w, int h, ui
 	}
 }
 
-void SCDRenderer::renderToPage(int destPageNum, int renderBlockX, int renderBlockY, int renderBlockWidth, int renderBlockHeight, bool spritesOnly) {
+void SegaCDRenderer::renderToPage(int destPageNum, int renderBlockX, int renderBlockY, int renderBlockWidth, int renderBlockHeight, bool spritesOnly) {
 	if (renderBlockX == -1)
 		renderBlockX = 0;
 	if (renderBlockY == -1)
@@ -463,7 +463,7 @@ void SCDRenderer::renderToPage(int destPageNum, int renderBlockX, int renderBloc
 	}
 }
 
-SegaAnimator::SegaAnimator(SCDRenderer *renderer) : _renderer(renderer), _needUpdate(false) {
+SegaAnimator::SegaAnimator(SegaCDRenderer *renderer) : _renderer(renderer), _needUpdate(false) {
 	_sprites = new Sprite[80];
 	assert(_sprites);
 	_tempBuffer = new uint16[320]();
@@ -727,7 +727,7 @@ const uint8 *SegaCDFont::getGlyphData(uint16 c, uint8 &charWidth, uint8 &charHei
 	return res;
 }
 
-ScrollManager::ScrollManager(SCDRenderer *renderer) : _renderer(renderer) {
+ScrollManager::ScrollManager(SegaCDRenderer *renderer) : _renderer(renderer) {
 	_vScrollTimers = new ScrollTimer[2];
 	assert(_vScrollTimers);
 	_hScrollTimers = new ScrollTimer[2];
diff --git a/engines/kyra/graphics/screen_eob_segacd.h b/engines/kyra/graphics/screen_eob_segacd.h
index 863f623c7d5..5998e5e48ed 100644
--- a/engines/kyra/graphics/screen_eob_segacd.h
+++ b/engines/kyra/graphics/screen_eob_segacd.h
@@ -29,10 +29,10 @@
 
 namespace Kyra {
 
-class SCDRenderer : public Graphics::SegaRenderer {
+class SegaCDRenderer : public Graphics::SegaRenderer {
 public:
-	SCDRenderer(Screen_EoB *screen);
-	~SCDRenderer();
+	SegaCDRenderer(Screen_EoB *screen);
+	~SegaCDRenderer();
 
 	void loadStreamToVRAM(Common::SeekableReadStream *in, uint16 addr, bool compressedData = false);
 	void fillRectWithTiles(int vramArea, int x, int y, int w, int h, uint16 nameTblEntry, bool incr = false, bool topToBottom = false, const uint16 *patternTable = 0);
@@ -45,7 +45,7 @@ private:
 
 class SegaAnimator {
 public:
-	SegaAnimator(SCDRenderer *renderer);
+	SegaAnimator(SegaCDRenderer *renderer);
 	~SegaAnimator();
 
 	void initSprite(int id, int16 x, int16 y, uint16 nameTbl, uint16 hw);
@@ -66,13 +66,13 @@ private:
 
 	uint16 *_tempBuffer;
 	Sprite *_sprites;
-	SCDRenderer *_renderer;
+	SegaCDRenderer *_renderer;
 	bool _needUpdate;
 };
 
 class ScrollManager {
 public:
-	ScrollManager(SCDRenderer *renderer);
+	ScrollManager(SegaCDRenderer *renderer);
 	~ScrollManager();
 
 	void setVScrollTimers(uint16 destA, int incrA, int delayA, uint16 destB, int incrB, int delayB);
@@ -92,7 +92,7 @@ private:
 
 	ScrollTimer *_vScrollTimers;
 	ScrollTimer *_hScrollTimers;
-	SCDRenderer *_renderer;
+	SegaCDRenderer *_renderer;
 };
 
 } // End of namespace Kyra
diff --git a/engines/kyra/gui/gui_eob_segacd.cpp b/engines/kyra/gui/gui_eob_segacd.cpp
index 372b0adecdb..48ecd61be81 100644
--- a/engines/kyra/gui/gui_eob_segacd.cpp
+++ b/engines/kyra/gui/gui_eob_segacd.cpp
@@ -63,7 +63,7 @@ void EoBEngine::gui_drawPlayField(bool refresh, bool screenUpdt) {
 	_txt->clearDim(0);
 	_screen->sega_getAnimator()->clearSprites();
 	_screen->sega_getAnimator()->update();
-	SCDRenderer *r = _screen->sega_getRenderer();
+	SegaCDRenderer *r = _screen->sega_getRenderer();
 	r->fillRectWithTiles(0, 0, 0, 40, 28, 0);
 	r->fillRectWithTiles(1, 0, 0, 40, 28, 0);
 
@@ -110,7 +110,7 @@ void EoBEngine::gui_drawPlayField(bool refresh, bool screenUpdt) {
 	_screen->copyRegionToBuffer(0, 173, 0, 6, 120, _shakeBackBuffer1);
 	_screen->copyRegionToBuffer(0, 0, 117, 179, 6, _shakeBackBuffer2);
 
-	// Since we're not going to draw the character portrait boxes with the SCDRenderer but rather with our "normal" code, we have to backup
+	// Since we're not going to draw the character portrait boxes with the SegaCDRenderer but rather with our "normal" code, we have to backup
 	// some parts of the background between the character portraits. Unlike in the other versions the red splat shapes overlaps with that space.
 	for (int i = 0; i < 6; ++i) {
 		delete[] _redSplatBG[i];
@@ -137,7 +137,7 @@ void EoBEngine::gui_setupPlayFieldHelperPages(bool keepText) {
 	if (!keepText)
 		_txt->clearDim(0);
 
-	SCDRenderer *r = _screen->sega_getRenderer();
+	SegaCDRenderer *r = _screen->sega_getRenderer();
 	r->loadToVRAM(_scrYellow, 4992, 0x3CE0);
 	r->fillRectWithTiles(0, 0, 0, 22, 21, 0);
 	r->fillRectWithTiles(0, 22, 0, 18, 21, 0);
@@ -187,7 +187,7 @@ void EoBEngine::gui_drawCharacterStatsPage() {
 		return;
 	}
 
-	SCDRenderer *r = _screen->sega_getRenderer();
+	SegaCDRenderer *r = _screen->sega_getRenderer();
 	EoBCharacter *c = &_characters[_updateCharNum];
 
 	memset(_tempPattern, 0, 792);
@@ -243,7 +243,7 @@ void EoBEngine::gui_displayMap() {
 		gui_drawCharPortraitWithStats(i);
 	}
 
-	SCDRenderer *r = _screen->sega_getRenderer();
+	SegaCDRenderer *r = _screen->sega_getRenderer();
 	r->fillRectWithTiles(0, 0, 0, 40, 28, 0);
 	r->fillRectWithTiles(1, 0, 0, 40, 28, 0);
 	_screen->sega_getAnimator()->clearSprites();
@@ -327,7 +327,7 @@ void EoBEngine::gui_drawSpellbook() {
 		return;
 	}
 
-	SCDRenderer *r = _screen->sega_getRenderer();
+	SegaCDRenderer *r = _screen->sega_getRenderer();
 	r->fillRectWithTiles(0, 10, 15, 12, 7, 0);
 	r->fillRectWithTiles(1, 10, 15, 12, 7, 0x6429);
 	memset(_tempPattern, 0, 168);
@@ -609,7 +609,7 @@ void EoBEngine::drawMapPage(int level) {
 	_txt->printShadedText(_mapStrings3[level - 1], 0, 0, 0xCC, 0, 48, 16, 0, false);
 	_screen->setFontStyles(_screen->_currentFont, cs);
 	_screen->sega_loadTextBufferToVRAM(0, 0x7920, 384);
-	SCDRenderer *r = _screen->sega_getRenderer();
+	SegaCDRenderer *r = _screen->sega_getRenderer();
 	r->fillRectWithTiles(0, 23, 8, 6, 2, 0x63C9, true);
 
 	Common::SeekableReadStreamEndian *in = _sres->resStreamEndian(hasLevelMap(level) ? 2 + level : 2);
@@ -943,7 +943,7 @@ void GUI_EoB_SegaCD::updateOptionsStrings() {
 	uint16 ntblInputMode[3] = { 0x34C, 0x360, 0x30C };
 	int speed = _vm->_configMouse ? _vm->_mouseSpeed : _vm->_padSpeed;
 
-	SCDRenderer *r = _screen->sega_getRenderer();
+	SegaCDRenderer *r = _screen->sega_getRenderer();
 	r->loadToVRAM(&_campMenu[(0x1CE + (_vm->_configMouse ? 0x240 : 0x24C)) << 5], 0x180, 0x42E0);
 	r->loadToVRAM(&_campMenu[(0x1CE + (_vm->_configMusic ? 0x258 : 0x264)) << 5], 0x180, 0x4460);
 	r->loadToVRAM(&_campMenu[(0x1CE + (_vm->_configSounds ? 0x258 : 0x264)) << 5], 0x180, 0x45E0);
@@ -958,7 +958,7 @@ void GUI_EoB_SegaCD::updateOptionsStrings() {
 }
 
 void GUI_EoB_SegaCD::restParty_updateRestTime(int hours, bool init) {
-	SCDRenderer *r = _screen->sega_getRenderer();
+	SegaCDRenderer *r = _screen->sega_getRenderer();
 	if (init)
 		r->fillRectWithTiles(0, 1, 4, 20, 17, 0);
 	_screen->sega_clearTextBuffer(0);
diff --git a/engines/kyra/sequence/seqplayer_eob_segacd.h b/engines/kyra/sequence/seqplayer_eob_segacd.h
index 907de8a74f8..bacb7ed0b2a 100644
--- a/engines/kyra/sequence/seqplayer_eob_segacd.h
+++ b/engines/kyra/sequence/seqplayer_eob_segacd.h
@@ -32,7 +32,7 @@ namespace Common {
 namespace Kyra {
 class EoBEngine;
 class Screen_EoB;
-class SCDRenderer;
+class SegaCDRenderer;
 class SegaCDResource;
 class SegaSequencePlayer {
 public:
@@ -92,7 +92,7 @@ private:
 
 	EoBEngine *_vm;
 	Screen_EoB *_screen;
-	SCDRenderer *_renderer;
+	SegaCDRenderer *_renderer;
 	SegaAnimator *_animator;
 	SegaCDResource *_res;
 	ScrollManager *_scrollManager;
diff --git a/engines/kyra/sequence/sequences_eob.cpp b/engines/kyra/sequence/sequences_eob.cpp
index 3161805fab3..b9fa9732536 100644
--- a/engines/kyra/sequence/sequences_eob.cpp
+++ b/engines/kyra/sequence/sequences_eob.cpp
@@ -2461,11 +2461,11 @@ void EoBEngine::seq_xdeath() {
 
 void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 	uint16 *scrollTable = new uint16[0x200]();
-	SCDRenderer *r = _screen->sega_getRenderer();
+	SegaCDRenderer *r = _screen->sega_getRenderer();
 
-	r->setPlaneTableLocation(SCDRenderer::kPlaneA, 0xE000);
+	r->setPlaneTableLocation(SegaCDRenderer::kPlaneA, 0xE000);
 	r->setupPlaneAB(1024, 256);
-	r->setHScrollMode(SCDRenderer::kHScroll1PixelRows);
+	r->setHScrollMode(SegaCDRenderer::kHScroll1PixelRows);
 
 	r->fillRectWithTiles(0, 0, 0, 40, 28, 0);
 	r->fillRectWithTiles(1, 0, 0, 128, 28, 1);
@@ -2535,9 +2535,9 @@ void EoBEngine::seq_segaOpeningCredits(bool jumpToTitle) {
 
 	delete[] scrollTable;
 	_screen->sega_fadeToBlack(0);
-	r->setPlaneTableLocation(SCDRenderer::kPlaneA, 0xC000);
+	r->setPlaneTableLocation(SegaCDRenderer::kPlaneA, 0xC000);
 	r->setupPlaneAB(512, 512);
-	r->setHScrollMode(SCDRenderer::kHScrollFullScreen);
+	r->setHScrollMode(SegaCDRenderer::kHScrollFullScreen);
 	r->memsetVRAM(0xD800, 0, 0x400);
 	_screen->sega_selectPalette(0, 0);
 	in = containerAlt ? new Common::SeekableReadStreamEndianWrapper(new Common::SeekableSubReadStream(containerAlt, last * 35840, (last + 1) * 35840), true, DisposeAfterUse::YES) : _sres->resStreamEndian(last);
@@ -2575,7 +2575,7 @@ void EoBEngine::seq_segaFinalCredits() {
 	int temp = 0;
 	const uint8 *grid = _staticres->loadRawData(kEoB1CreditsTileGrid, temp);
 	const char *const *strings = _staticres->loadStrings(kEoB1CreditsStrings2, temp);
-	SCDRenderer *r = _screen->sega_getRenderer();
+	SegaCDRenderer *r = _screen->sega_getRenderer();
 	_screen->sega_fadeToBlack(0);
 	_screen->sega_selectPalette(7, 3, true);
 	_txt->clearDim(4);
@@ -2685,7 +2685,7 @@ void EoBEngine::seq_segaShowStats() {
 	if (shouldQuit())
 		return;
 
-	SCDRenderer *r = _screen->sega_getRenderer();
+	SegaCDRenderer *r = _screen->sega_getRenderer();
 	_txt->clearDim(5);
 
 	int styles = Font::kStyleFullWidth;
@@ -2789,7 +2789,7 @@ void EoBEngine::seq_segaSetupSequence(int sequenceId) {
 	_screen->clearPage(0);
 
 	// transposeScreenOutputY(0);
-	_screen->sega_getRenderer()->setupWindowPlane(0, (sequenceId == 53 || sequenceId == 54) ? 23 : 18, SCDRenderer::kWinToLeft, SCDRenderer::kWinToBottom);
+	_screen->sega_getRenderer()->setupWindowPlane(0, (sequenceId == 53 || sequenceId == 54) ? 23 : 18, SegaCDRenderer::kWinToLeft, SegaCDRenderer::kWinToBottom);
 	_screen->sega_getRenderer()->memsetVRAM(0xD840, 0xEE, 512);
 	_screen->sega_getAnimator()->clearSprites();
 	_screen->setScreenDim(2);
@@ -2799,11 +2799,11 @@ void EoBEngine::seq_segaRestoreAfterSequence() {
 	if (_flags.platform != Common::kPlatformSegaCD)
 		return;
 
-	SCDRenderer *r = _screen->sega_getRenderer();
+	SegaCDRenderer *r = _screen->sega_getRenderer();
 	_screen->sega_fadeToBlack(1);
 	_screen->sega_getAnimator()->clearSprites();
 	_screen->sega_getAnimator()->update();
-	r->setupWindowPlane(0, 0, SCDRenderer::kWinToLeft, SCDRenderer::kWinToTop);
+	r->setupWindowPlane(0, 0, SegaCDRenderer::kWinToLeft, SegaCDRenderer::kWinToTop);
 	r->fillRectWithTiles(0, 0, 0, 40, 28, 0x2000);
 	r->fillRectWithTiles(1, 0, 0, 40, 28, 0x2000);
 	r->writeUint16VSRAM(0, 0);
diff --git a/engines/kyra/text/text_eob_segacd.h b/engines/kyra/text/text_eob_segacd.h
index 66bb8bcb364..9f2d49a9750 100644
--- a/engines/kyra/text/text_eob_segacd.h
+++ b/engines/kyra/text/text_eob_segacd.h
@@ -50,7 +50,7 @@ private:
 	void copyTextBufferLine(uint16 srcY, uint16 dstY, uint16 lineHeight, uint16 pitch);
 
 	Screen_EoB *_screen;
-	SCDRenderer *_renderer;
+	SegaCDRenderer *_renderer;
 	EoBEngine *_engine;
 	uint8 *_msgRenderBuffer;
 	uint32 _msgRenderBufferSize;


Commit: cf23a602b05bada92e5bae8064c0adfa80411c35
    https://github.com/scummvm/scummvm/commit/cf23a602b05bada92e5bae8064c0adfa80411c35
Author: athrxx (athrxx at scummvm.org)
Date: 2026-11-15T12:39:45+02:00

Commit Message:
SNATCHER: improve GMM saving/loading

This does not apply to the scripted saves which are done
via the verb interface.

For the GMM saves, in many scenes it is actually harmful
to restore extended animation state info (or rather: it would
require to save and restore even more data for correct
recovery). So I limit the saving of extended data to scenes
that are known to benefit of that.

I have tried all my over 70 savegames  with this change and
there is only one with minor glitches now...

Changed paths:
  A engines/snatcher/palette.cpp
    engines/snatcher/animator_scd.cpp
    engines/snatcher/graphics.cpp
    engines/snatcher/module.mk
    engines/snatcher/palette.h
    engines/snatcher/palette_scd.cpp
    engines/snatcher/saveflags.h
    engines/snatcher/saveload.cpp
    engines/snatcher/saveload.h
    engines/snatcher/script.cpp
    engines/snatcher/script.h
    engines/snatcher/snatcher.cpp
    engines/snatcher/sound.cpp
    engines/snatcher/transition.h
    engines/snatcher/transition_scd.cpp
    engines/snatcher/ui.cpp


diff --git a/engines/snatcher/animator_scd.cpp b/engines/snatcher/animator_scd.cpp
index 04f0d1ffc8c..74157a75652 100644
--- a/engines/snatcher/animator_scd.cpp
+++ b/engines/snatcher/animator_scd.cpp
@@ -37,12 +37,8 @@
 
 namespace Snatcher {
 
-//#define		ANIM_DEBUG
-
 struct AnimObject {
-	AnimObject(int num) : id(num), enable(0), blinkRate(0), drawFlags(0), posX(0), posY(0), relSpeedX(0), relSpeedY(0), palette(0), target(0), ovrTile(0), f1c(0),
-		timeStamp(0), phase(0), controlFlags(0), allowFrameDrop(0), frameSeqCounter(0), frame(0), frameDelay(0), actionTimer(0), spriteTableLocation(0),
-			res(), scriptData(), spriteData(nullptr), absSpeedX(0), absSpeedY(0), parent(0), children(0), next(0), scriptComFlags(0), freeze(0), blink(0), blinkCounter(0), blinkDuration(0) {}
+	AnimObject(int num) : id(num) {}
 
 	void clear() {
 		enable = blinkRate = drawFlags = 0;
@@ -67,39 +63,39 @@ struct AnimObject {
 		blink = blinkCounter = blinkDuration = 0;
 	}
 
-	uint16 enable;
-	uint16 blinkRate;
-	uint16 drawFlags;
-	int32 posX;
-	int32 posY;
-	int32 relSpeedX;
-	int32 relSpeedY;
-	uint8 palette;
-	uint16 target;
-	uint16 ovrTile;
-	uint8 f1c;
-	uint32 timeStamp;
-	uint8 phase;
-	uint8 controlFlags;
-	uint8 allowFrameDrop;
-	uint8 frameSeqCounter;
-	uint16 frame;
-	int16 frameDelay;
-	int16 actionTimer;
-	uint32 spriteTableLocation;
+	uint16 enable = 0;
+	uint16 blinkRate = 0;
+	uint16 drawFlags = 0;
+	int32 posX = 0;
+	int32 posY = 0;
+	int32 relSpeedX = 0;
+	int32 relSpeedY = 0;
+	uint8 palette = 0;
+	uint16 target = 0;
+	uint16 ovrTile = 0;
+	uint8 f1c = 0;
+	uint32 timeStamp = 0;
+	uint8 phase = 0;
+	uint8 controlFlags = 0;
+	uint8 allowFrameDrop = 0;
+	uint8 frameSeqCounter = 0;
+	uint16 frame = 0;
+	int16 frameDelay = 0;
+	int16 actionTimer = 0;
+	uint32 spriteTableLocation = 0;
 	ResourcePointer res;
 	ResourcePointer scriptData;
-	const uint16 *spriteData;
-	uint16 blink;
-	uint16 blinkCounter;
-	uint16 blinkDuration;
-	int32 absSpeedX;
-	int32 absSpeedY;
-	uint16 parent;
-	uint16 children;
-	uint16 next;
-	uint8 scriptComFlags;
-	uint8 freeze;
+	const uint16 *spriteData = nullptr;
+	uint16 blink = 0;
+	uint16 blinkCounter = 0;
+	uint16 blinkDuration = 0;
+	int32 absSpeedX = 0;
+	int32 absSpeedY = 0;
+	uint16 parent = 0;
+	uint16 children = 0;
+	uint16 next = 0;
+	uint8 scriptComFlags = 0;
+	uint8 freeze = 0;
 
 	const uint8 id;
 };
@@ -155,22 +151,22 @@ private:
 	bool reachedAudioTimeStamp(AnimObject &a) const;
 	void runAnimScript(AnimObject &a);
 
-	int _screenWidth, _screenHeight;
-	int _realScreenWidth, _realScreenHeight;
+	int _screenWidth = 256, _screenHeight = 224;
+	int _realScreenWidth = 0, _realScreenHeight = 0;
 
 	ResourcePointer _transferData;
-	uint8 *_tempBuffer;
-	uint16 *_spriteBuffer;
-	uint8 _transferMode;
-	uint16 _transferDelay;
-	uint16 _clearFlags;
-	uint8 _mode;
-	uint8 _modeChange;
-	uint16 _frameCountDown;
-	Graphics::SegaRenderer *_sr;
-	Palette *_pal;
-	TransitionManager *_trs;
-	SoundEngine *_snd;
+	uint8 *_tempBuffer = nullptr;
+	uint16 *_spriteBuffer = nullptr;
+	uint8 _transferMode = 0;
+	uint16 _transferDelay = 0;
+	uint16 _clearFlags = 0;
+	uint8 _mode = 1;
+	uint8 _modeChange = 0;
+	uint16 _frameCountDown = 0;
+	Graphics::SegaRenderer *_sr = nullptr;
+	Palette *_pal = nullptr;
+	TransitionManager *_trs = nullptr;
+	SoundEngine *_snd = nullptr;
 	const Graphics::SegaRenderer::HINTHandler _hINTClientProc;
 
 private:
@@ -263,15 +259,13 @@ public:
 	// boot logo animation
 	int drawBootLogoFrame(uint8 *screen, int frameNo) override;
 private:
-	int32 _bootsDelay, _bootsTotalFrames;
-	uint16 _bootsHScroll, _bootsVScroll, _bootsCol;
-	uint8 *_bootsSprTbl;
+	int32 _bootsDelay = 0, _bootsTotalFrames = 0;
+	uint16 _bootsHScroll = 0, _bootsVScroll = 0, _bootsCol = 0;
+	uint8 *_bootsSprTbl = nullptr;
 };
 
-Animator_SCD::Animator_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd, bool enableAspectRatioCorrection) : Animator(state), _pal(pal), _trs(scr), _snd(snd), _mode(1),
-	_modeChange(0), _screenWidth(256), _screenHeight(224), _transferData(), _transferMode(0), _transferDelay(0), _clearFlags(0), _tempBuffer(nullptr), _spriteBuffer(nullptr), _sr(nullptr), _frameCountDown(0),
-		_animations(nullptr), _drawCommands(nullptr), _hINTClientProc(Graphics::SegaRenderer::HINTHandler(this, &Graphics::SegaRenderer::HINTClient::hINTCallback)), _realScreenWidth(0), _realScreenHeight(0),
-			_bootsDelay(0), _bootsSprTbl(nullptr), _bootsTotalFrames(0), _bootsHScroll(0), _bootsVScroll(0), _bootsCol(0) {
+Animator_SCD::Animator_SCD(const Graphics::PixelFormat *pxf, GraphicsEngine::GfxState &state, Palette *pal, TransitionManager *scr, SoundEngine *snd, bool enableAspectRatioCorrection) :
+	Animator(state), _pal(pal), _trs(scr), _snd(snd),  _hINTClientProc(Graphics::SegaRenderer::HINTHandler(this, &Graphics::SegaRenderer::HINTClient::hINTCallback)) {
 
 	makeAnimFunctions();
 
@@ -1183,7 +1177,7 @@ void Animator_SCD::runAnimScript(AnimObject &a) {
 	while (incr != -1) {
 		a.frame += incr;
 		a.controlFlags &= ~GraphicsEngine::kAnimHide;
-		const uint8 *in = a.scriptData() + (a.frame << 2);
+		const uint8 *in = a.scriptData() + a.frame * 4;
 		uint8 opcode = *in++;
 		if (opcode & 0x80) {
 			opcode -= 0x80;
diff --git a/engines/snatcher/graphics.cpp b/engines/snatcher/graphics.cpp
index 3476b82a399..f8b545c4834 100644
--- a/engines/snatcher/graphics.cpp
+++ b/engines/snatcher/graphics.cpp
@@ -278,25 +278,39 @@ uint16 GraphicsEngine::frameCount() const {
 void GraphicsEngine::loadState(Common::SeekableReadStream *in, SaveFlags flags) {
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
+
+	// prevent ugly artifacts on screen during the phase until all postload processing is done.
+	_palette->block();
+
 	in->read(_animSaveLoadData, 64);
 
-	if (flags & (kSaveFlagsTempData))
+	if (flags & (kFlagTempData))
 		return;
 
 	for (int i = 0; i < 13; ++i)
 		_state.setVar(i, in->readByte());
 
-	_trs->loadState(in);
+	_trs->loadState(in, flags);
 	_trsNeedsUpdate = true;
 
-	if (flags & (kSaveFlagsScriptedSave))
+	if (flags & (kFlagScriptedSave))
 		return;
 
-	uint16 size = in->readSint16BE();
-	uint8 *data = new uint8[size]();
-	assert(data);
-	in->read(data, size);
-	_animSaveLoadDataExt = Common::SharedPtr<const uint8>(data, Common::ArrayDeleter<const uint8>());
+	_animSaveLoadDataExt.reset();
+	if (flags & kFlagNeedAnimExtData) {
+		uint16 size = in->readSint16BE();
+		if (size) {
+			uint8 *data = new uint8[size]();
+			assert(data);
+			in->read(data, size);
+			_animSaveLoadDataExt = Common::SharedPtr<const uint8>(data, Common::ArrayDeleter<const uint8>());
+		} else {
+			_animSaveLoadDataExt = nullptr;
+		}
+	}
+
+	if (flags & kFlagNeedPaletteData)
+		_palette->loadState(in);
 }
 
 void GraphicsEngine::saveState(Common::SeekableWriteStream *out, SaveFlags flags) {
@@ -321,86 +335,91 @@ void GraphicsEngine::saveState(Common::SeekableWriteStream *out, SaveFlags flags
 	}
 	out->write(_animSaveLoadData, 64);
 
-	if (flags & (kSaveFlagsTempData))
+	if (flags & (kFlagTempData))
 		return;
 
 	for (int i = 0; i < 13; ++i)
 		out->writeByte(_state.getVar(i));
 
-	_trs->saveState(out);
+	_trs->saveState(out, flags);
 
-	if (flags & (kSaveFlagsScriptedSave))
+	if (flags & (kFlagScriptedSave))
 		return;
 
-	int count = 0;
-	for (int i = 0; i < 64; ++i) {
-		if (_animSaveLoadData[i])
-			++count;
-	}
-	uint8 *data = new uint8[count * 29]();
-	uint8 *d = data;
-
-	for (int i = 0; i < 64; ++i) {
-		if (_animSaveLoadData[i] == 0)
-			continue;
+	if (flags & kFlagNeedAnimExtData) {
+		int count = 0;
+		for (int i = 0; i < 64; ++i) {
+			if (_animSaveLoadData[i])
+				++count;
+		}
+		uint8 *data = new uint8[count * 29]();
+		uint8 *d = data;
+
+		for (int i = 0; i < 64; ++i) {
+			if (_animSaveLoadData[i] == 0)
+				continue;
+
+			uint8 v = (getAnimParameter(i, kAnimParaScriptComFlags) & 2) >> 1;
+			v |= getAnimParameter(i, kAnimParaDrawFlags) << 1;
+			v |= (getAnimParameter(i, kAnimFreezeFlag) ? 0x20 : 0);
+			*d++ = v;
+
+			uint16 b = getAnimParameter(i, kAnimParaPosX);
+			WRITE_BE_UINT16(d, b);
+			d += 2;
+			b = getAnimParameter(i, kAnimParaPosY);
+			WRITE_BE_UINT16(d, b);
+			d += 2;
+			b = getAnimParameter(i, kAnimParaRelSpeedX);
+			WRITE_BE_UINT16(d, b);
+			d += 2;
+			b = getAnimParameter(i, kAnimParaRelSpeedY);
+			WRITE_BE_UINT16(d, b);
+			d += 2;
+
+			v = getAnimParameter(i, kAnimParaOvrTile) & 0xFC;
+			uint8 v2 = (getAnimParameter(i, kAnimParaPhase) & 0xF3);
+			b = ((v2 & 0xF0) << 8) | (v2 & 0x0F) | v;
+			v = getAnimParameter(i, kAnimParaPalette) & 0x83;
+			b |= (((v & 0x80) << 4) | ((v & 0x03) << 9));
+			WRITE_BE_UINT16(d, b);
+			d += 2;
+
+			b = getAnimParameter(i, kAnimParaTarget);
+			WRITE_BE_UINT16(d, b);
+			d += 2;
+			v = getAnimParameter(i, kAnimParaF1c);
+			*d++ = v;
+
+			uint32 t = getAnimParameter(i, kAnimParaTimeStamp);
+			WRITE_BE_UINT32(d, t);
+			d += 4;
+			v = getAnimParameter(i, kAnimParaFrameSeqCounter);
+			*d++ = v;
+			b = getAnimParameter(i, kAnimParaFrame);
+			WRITE_BE_UINT16(d, b);
+			d += 2;
+			b = getAnimParameter(i, kAnimParaFrameDelay);
+			WRITE_BE_UINT16(d, b);
+			d += 2;
+			b = getAnimParameter(i, kAnimParaActionTimer);
+			WRITE_BE_UINT16(d, b);
+			d += 2;
+			b = getAnimParameter(i, kAnimParaAbsSpeedX);
+			WRITE_BE_UINT16(d, b);
+			d += 2;
+			b = getAnimParameter(i, kAnimParaAbsSpeedY);
+			WRITE_BE_UINT16(d, b);
+			d += 2;
+		}
 
-		uint8 v = (getAnimParameter(i, kAnimParaScriptComFlags) & 2) >> 1;
-		v |= getAnimParameter(i, kAnimParaDrawFlags) << 1;
-		v |= (getAnimParameter(i, kAnimFreezeFlag) ? 0x20 : 0);
-		*d++ = v;
-
-		uint16 b = getAnimParameter(i, kAnimParaPosX);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaPosY);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaRelSpeedX);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaRelSpeedY);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-
-		v = getAnimParameter(i, kAnimParaOvrTile) & 0xFC;
-		uint8 v2 = (getAnimParameter(i, kAnimParaPhase) & 0xF3);
-		b = ((v2 & 0xF0) << 8) | (v2 & 0x0F) | v;
-		v = getAnimParameter(i, kAnimParaPalette) & 0x83;
-		b |= (((v & 0x80) << 4) | ((v & 0x03) << 9));
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-
-		b = getAnimParameter(i, kAnimParaTarget);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		v = getAnimParameter(i, kAnimParaF1c);
-		*d++ = v;
-
-		uint32 t = getAnimParameter(i, kAnimParaTimeStamp);
-		WRITE_BE_UINT32(d, t);
-		d += 4;
-		v = getAnimParameter(i, kAnimParaFrameSeqCounter);
-		*d++ = v;
-		b = getAnimParameter(i, kAnimParaFrame);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaFrameDelay);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaActionTimer);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaAbsSpeedX);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
-		b = getAnimParameter(i, kAnimParaAbsSpeedY);
-		WRITE_BE_UINT16(d, b);
-		d += 2;
+		out->writeUint16BE(d - data);
+		out->write(data, d - data);
+		delete[] data;
 	}
 
-	out->writeUint16BE(d - data);
-	out->write(data, d - data);
-	delete[] data;
+	if (flags & (kFlagNeedPaletteData))
+		_palette->saveState(out);
 }
 
 void GraphicsEngine::postLoadProcess() {
@@ -429,53 +448,56 @@ void GraphicsEngine::postLoadProcess() {
 		_trs->postLoadProcess();
 	_trsNeedsUpdate = false;
 
-	if (_animSaveLoadDataExt == nullptr)
-		return;
-
-	const uint8 *s = _animSaveLoadDataExt.get();
-	for (int i = 0; i < 64; ++i) {
-		if (_animSaveLoadData[i] == 0)
-			continue;
-
-		uint16 v = *s++;
-		setAnimParameter(i, kAnimParaScriptComFlags, getAnimParameter(i, kAnimParaScriptComFlags) | ((v & 1) << 1));
-		setAnimParameter(i, kAnimParaDrawFlags, (v & 0x1E) >> 1);
-		setAnimParameter(i, kAnimFreezeFlag, (v & 0x20) >> 5);
-
-		setAnimParameter(i, kAnimParaPosX, READ_BE_INT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaPosY, READ_BE_INT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaRelSpeedX, READ_BE_INT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaRelSpeedY, READ_BE_INT16(s));
-		s += 2;
-
-		v = READ_BE_INT16(s);
-		s += 2;
-		setAnimParameter(i, kAnimParaOvrTile, v & 0xFC);
-		setAnimParameter(i, kAnimParaPhase, ((v >> 8) & 0xF0) | (v & 3));
-		setAnimParameter(i, kAnimParaPalette, ((v >> 4) & 0x80) | ((v >> 9) & 0x03));
-
-		setAnimParameter(i, kAnimParaTarget, READ_BE_UINT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaF1c, *s++);
-		setAnimParameter(i, kAnimParaTimeStamp, READ_BE_UINT32(s));
-		s += 4;
-		setAnimParameter(i, kAnimParaFrameSeqCounter, *s++);
-		setAnimParameter(i, kAnimParaFrame, READ_BE_UINT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaFrameDelay, READ_BE_UINT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaActionTimer, READ_BE_UINT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaAbsSpeedX, READ_BE_INT16(s));
-		s += 2;
-		setAnimParameter(i, kAnimParaAbsSpeedY, READ_BE_INT16(s));
-		s += 2;
+	if (_animSaveLoadDataExt != nullptr) {
+		const uint8 *s = _animSaveLoadDataExt.get();
+		for (int i = 0; i < 64; ++i) {
+			if (_animSaveLoadData[i] == 0)
+				continue;
+
+			uint16 v = *s++;
+			setAnimParameter(i, kAnimParaScriptComFlags, getAnimParameter(i, kAnimParaScriptComFlags) | ((v & 1) << 1));
+			setAnimParameter(i, kAnimParaDrawFlags, (v & 0x1E) >> 1);
+			setAnimParameter(i, kAnimFreezeFlag, (v & 0x20) >> 5);
+
+			setAnimParameter(i, kAnimParaPosX, READ_BE_INT16(s));
+			s += 2;
+			setAnimParameter(i, kAnimParaPosY, READ_BE_INT16(s));
+			s += 2;
+			setAnimParameter(i, kAnimParaRelSpeedX, READ_BE_INT16(s));
+			s += 2;
+			setAnimParameter(i, kAnimParaRelSpeedY, READ_BE_INT16(s));
+			s += 2;
+
+			v = READ_BE_INT16(s);
+			s += 2;
+			setAnimParameter(i, kAnimParaOvrTile, v & 0xFC);
+			setAnimParameter(i, kAnimParaPhase, ((v >> 8) & 0xF0) | (v & 3));
+			setAnimParameter(i, kAnimParaPalette, ((v >> 4) & 0x80) | ((v >> 9) & 0x03));
+
+			setAnimParameter(i, kAnimParaTarget, READ_BE_UINT16(s));
+			s += 2;
+			setAnimParameter(i, kAnimParaF1c, *s++);
+			setAnimParameter(i, kAnimParaTimeStamp, READ_BE_UINT32(s));
+			s += 4;
+			setAnimParameter(i, kAnimParaFrameSeqCounter, *s);
+			s++;
+			setAnimParameter(i, kAnimParaFrame, READ_BE_UINT16(s));
+			s += 2;
+			setAnimParameter(i, kAnimParaFrameDelay, READ_BE_UINT16(s));
+			s += 2;
+			setAnimParameter(i, kAnimParaActionTimer, READ_BE_UINT16(s));
+			s += 2;
+			setAnimParameter(i, kAnimParaAbsSpeedX, READ_BE_INT16(s));
+			s += 2;
+			setAnimParameter(i, kAnimParaAbsSpeedY, READ_BE_INT16(s));
+			s += 2;
+		}
+		_animSaveLoadDataExt.reset();
 	}
 
-	_animSaveLoadDataExt.reset();
+	_palette->postLoadProcess();
+	// Remove the blocker we set in loadState()
+	_palette->unblock();
 }
 
 void GraphicsEngine::createMouseCursor() {
diff --git a/engines/snatcher/module.mk b/engines/snatcher/module.mk
index 5d65e1307f1..e3fb5eb5265 100644
--- a/engines/snatcher/module.mk
+++ b/engines/snatcher/module.mk
@@ -8,6 +8,7 @@ MODULE_OBJS := \
 	memory.o \
 	mem_mapping.o \
 	metaengine.o \
+	palette.o \
 	palette_scd.o \
 	resource.o \
 	saveload.o \
diff --git a/engines/snatcher/palette.cpp b/engines/snatcher/palette.cpp
new file mode 100644
index 00000000000..550b22e2f8e
--- /dev/null
+++ b/engines/snatcher/palette.cpp
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+
+
+#include "snatcher/palette.h"
+#include "graphics/paletteman.h"
+
+namespace Snatcher {
+
+Palette::Palette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state) : _pixelFormat(pxf ? *pxf : Graphics::PixelFormat::createFormatCLUT8()), _palMan(pm), _gfxState(state) {
+	assert(pm);
+	_sysPalette = new uint8[256]();
+}
+
+Palette::~Palette() {
+	delete[] _sysPalette;
+}
+
+void Palette::block() {
+	_blocked = true;
+	memset(_sysPalette, 0, 256);
+	if (_pixelFormat.bytesPerPixel == 1)
+		_palMan->setPalette(_sysPalette, 0, 256);
+}
+
+void Palette::unblock() {
+	_blocked = false;
+	if (_restoreAfterUnblock) {
+		updateSystemPalette();
+		_restoreAfterUnblock = false;
+	}
+}
+
+Palette *Palette::create(const Graphics::PixelFormat *pxf, PaletteManager *pm, Common::Platform platform, GraphicsEngine::GfxState &state) {
+	switch (platform) {
+	case Common::kPlatformSegaCD:
+		return createSegaPalette(pxf, pm, state);
+	default:
+		break;
+	};
+	return 0;
+}
+
+} // End of namespace Snatcher
diff --git a/engines/snatcher/palette.h b/engines/snatcher/palette.h
index 98170abae8c..fd655a135e2 100644
--- a/engines/snatcher/palette.h
+++ b/engines/snatcher/palette.h
@@ -28,18 +28,25 @@
 
 class PaletteManager;
 
+namespace Common {
+class SeekableWriteStream;
+class SeekableReadStream;
+}
+
 namespace Graphics {
-	struct PixelFormat;
+struct PixelFormat;
 }
 
 namespace Snatcher {
 
 class Palette {
 public:
-	Palette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state) : _pixelFormat(pxf ? *pxf : Graphics::PixelFormat::createFormatCLUT8()), _palMan(pm), _gfxState(state) {
-		assert(pm);
-	}
-	virtual ~Palette() {}
+	Palette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state);
+	virtual ~Palette();
+
+	const uint8 *getSystemPalette() const { return _sysPalette; }
+	void block();
+	void unblock();
 
 	virtual bool enqueueEvent(ResourcePointer &res) { return true; }
 	virtual void processEventQueue() {}
@@ -48,32 +55,31 @@ public:
 	virtual void update() {}
 	virtual void hINTCallback(void*) {}
 
-	virtual const uint8 *getSystemPalette() const { return nullptr; }
-
 	virtual void selectPalettes(uint32) {}
 	virtual void getPresetColor(int pal, int index, uint8 &r, uint8 &g, uint8 &b) const {}
 	virtual void setColor(int index, uint8 r, uint8 g, uint8 b) {}
 	virtual void getColor(int index, uint8 &r, uint8 &g, uint8 &b) const {}
 	virtual void adjustColor(int index, int8 r, int8 g, int8 b) {}
 
+	virtual void loadState(Common::SeekableReadStream *in) {}
+	virtual void saveState(Common::SeekableWriteStream *out) {};
+	virtual void postLoadProcess() {}
+
 protected:
-	const Graphics::PixelFormat _pixelFormat;
-	PaletteManager *_palMan;
+	virtual void updateSystemPalette() = 0;
+
+	uint8 *_sysPalette = nullptr;
+	bool _blocked = false;
+	bool _restoreAfterUnblock = false;
+	const Graphics::PixelFormat _pixelFormat = Graphics::PixelFormat();
+	PaletteManager *_palMan = nullptr;
 	GraphicsEngine::GfxState &_gfxState;
 
 private:
 	static Palette *createSegaPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state);
 
 public:
-	static Palette *create(const Graphics::PixelFormat *pxf, PaletteManager *pm, Common::Platform platform, GraphicsEngine::GfxState &state) {
-		switch (platform) {
-		case Common::kPlatformSegaCD:
-			return createSegaPalette(pxf, pm, state);
-		default:
-			break;
-		};
-		return 0;
-	}
+	static Palette *create(const Graphics::PixelFormat *pxf, PaletteManager *pm, Common::Platform platform, GraphicsEngine::GfxState &state);
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/palette_scd.cpp b/engines/snatcher/palette_scd.cpp
index 625b6c06c3e..b7ee961d79e 100644
--- a/engines/snatcher/palette_scd.cpp
+++ b/engines/snatcher/palette_scd.cpp
@@ -29,6 +29,7 @@
 #include "common/endian.h"
 #include "common/func.h"
 #include "common/textconsole.h"
+#include "common/stream.h"
 
 #include "graphics/paletteman.h"
 #include "graphics/pixelformat.h"
@@ -48,7 +49,6 @@ public:
 	void setDefaults(int mode) override;
 	void update() override;
 	void hINTCallback(void *segaRenderer) override;
-	const uint8 *getSystemPalette() const override { return _sysPalette; }
 
 	void selectPalettes(uint32) override;
 	void getPresetColor(int pal, int index, uint8 &r, uint8 &g, uint8 &b) const override;
@@ -56,8 +56,12 @@ public:
 	void getColor(int index, uint8 &r, uint8 &g, uint8 &b) const override;
 	void adjustColor(int index, int8 r, int8 g, int8 b) override;
 
+	void loadState(Common::SeekableReadStream *in) override;
+	void saveState(Common::SeekableWriteStream *out) override;
+	void postLoadProcess() override;
+
 private:
-	void updateSystemPalette();
+	void updateSystemPalette() override;
 
 	typedef Common::Functor1Mem<PalEventSCD*, void, SCDPalette> EventProc;
 	Common::Array<EventProc*> _eventProcs;
@@ -76,28 +80,27 @@ private:
 	bool updateDelay(PalEventSCD *evt);
 	void fadeStep(uint16 *modColor, uint16 toR, uint16 toG, uint16 toB);
 
-	PalEventSCD *_eventQueue;
-	PalEventSCD *_eventCurPos;
+	PalEventSCD *_eventQueue = nullptr;
+	PalEventSCD *_eventCurPos = nullptr;
 
-	uint16 *_colors;
-	uint16 *_colors2;
-	uint8 *_sysPalette;
+	uint16 *_colors = nullptr;
+	uint16 *_colors2 = nullptr;
+	uint16 *_restorePalette = nullptr;
 
 private:
 	typedef Common::Functor1Mem<Graphics::SegaRenderer*, void, SCDPalette> HINTFunc;
 	Common::Array<HINTFunc*> _hINTProcs;
-	const HINTFunc *_hINTHandler;
+	const HINTFunc *_hINTHandler = nullptr;
 
 	void setHINTHandler(int8 num);
 	bool isValidHINTHandler() const { return _hINTHandler != nullptr && _hINTHandler->isValid(); }
 
 	void hIntHandler_dummy(Graphics::SegaRenderer*) {}
 	void hIntHandler_characterChatPortraitPalette(Graphics::SegaRenderer *sr);
-	int _transitionStep;
+	int _transitionStep = 0;
 };
 
-SCDPalette::SCDPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state) : Palette(pxf, pm, state), _eventProcs(),
-	_eventQueue(nullptr), _eventCurPos(nullptr), _colors(nullptr), _colors2(nullptr), _sysPalette(nullptr), _hINTHandler(nullptr), _transitionStep(0) {
+SCDPalette::SCDPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, GraphicsEngine::GfxState &state) : Palette(pxf, pm, state), _eventProcs() {
 
 #define P_OP(a)	_eventProcs.push_back(new EventProc(this, &SCDPalette::event_##a));
 	_eventProcs.push_back(nullptr);
@@ -119,14 +122,13 @@ SCDPalette::SCDPalette(const Graphics::PixelFormat *pxf, PaletteManager *pm, Gra
 	_eventQueue = _eventCurPos = new PalEventSCD[12];
 	_colors = new uint16[128]();
 	_colors2 = new uint16[128]();
-	_sysPalette = new uint8[256]();
 }
 
 SCDPalette::~SCDPalette() {
 	delete[] _eventQueue;
 	delete[] _colors;
 	delete[] _colors2;
-	delete[] _sysPalette;
+	delete[] _restorePalette;
 
 	for (Common::Array<EventProc*>::const_iterator i = _eventProcs.begin(); i != _eventProcs.end(); ++i)
 		delete *i;
@@ -254,7 +256,120 @@ void SCDPalette::adjustColor(int index, int8 r, int8 g, int8 b) {
 	_gfxState.setFlag(7, 0);
 }
 
+void SCDPalette::loadState(Common::SeekableReadStream *in) {
+	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
+		error("%s(): Save file invalid or corrupt", __FUNCTION__);
+
+	if (_restorePalette == nullptr)
+		_restorePalette = new uint16[256];
+
+	memset(_restorePalette, 0, 256 * sizeof(uint16));
+
+	uint8 saveFlag = in->readByte();
+
+	for (int i = 0; i < 4; ++i) {
+		if (saveFlag & (1 << i)) {
+			for (int j = 0; j < 64; ++j)
+				_restorePalette[i * 64 + j] = in->readUint16BE();
+		}
+	}
+
+	if (saveFlag & 0x30) {
+		for (int i = 0; i < 2; ++i) {
+			if (saveFlag & (1 << (i + 4))) {
+				for (int j = 0; j < 64; ++j)
+					_restorePalette[128 + i * 64 + j] = _restorePalette[i * 64 + j] ^ in->readUint16BE();
+			}
+		}
+	}
+
+	if (saveFlag & 0xC0) {
+		for (int i = 0; i < 2; ++i) {
+			if (saveFlag & (1 << (i + 6)))
+				Common::copy<const uint16*, uint16*>(&_restorePalette[i * 64], &_restorePalette[i * 64 + 64], &_restorePalette[i * 64 + 128]);
+		}
+	}
+
+	_restoreAfterUnblock = true;
+}
+
+void SCDPalette::saveState(Common::SeekableWriteStream *out) {
+	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
+
+	const uint16 *palettes[] = { _colors2, &_colors2[64], _colors, &_colors[64] };
+
+	// We check several conditions trying to make the save file smaller
+	// instead of just dumping the whole palette data.
+	uint8 saveFlag = 0;
+	for (int i = 0; i < 64; ++i) {
+		for (int j = 0; j < 4; ++j) {
+			if (palettes[j][i] != 0)
+				saveFlag |= (1 << j);
+		}
+	}
+
+	for (int i = 0; i < 2; ++i) {
+		if (saveFlag & (1 << i) && saveFlag & (1 << (i + 2))) {
+			saveFlag &= ~(1 << (i + 2));
+			if (!memcmp (palettes[i], palettes[i + 2], sizeof(uint16) * 64))
+				saveFlag |= (1 << (i + 6));
+			else
+				saveFlag |= (1 << (i + 4));
+		}
+	}
+
+	out->writeByte(saveFlag);
+
+	for (int i = 0; i < 4; ++i) {
+		if (saveFlag & (1 << i)) {
+			for (int j = 0; j < 64; ++j)
+				out->writeUint16BE(palettes[i][j]);
+		}
+	}
+
+	if (saveFlag & 0x30) {
+		for (int i = 0; i < 2; ++i) {
+			if (saveFlag & (1 << (i + 4))) {
+				for (int j = 0; j < 64; ++j)
+					out->writeUint16BE(palettes[i][j] ^ palettes[i + 2][j]);
+			}
+		}
+	}
+}
+
+void SCDPalette::postLoadProcess() {
+	if (!_restorePalette)
+		return;
+
+	uint16 *palettes[] = { _colors2, &_colors2[64], _colors, &_colors[64] };
+
+	bool restorePal = true;
+
+	for (int ii = 0; ii < 12; ++ii) {
+		// If the postload script has enqueued setPal or fadeFromBlack events we should skip the
+		// restoration of the saved palette.
+		if (_eventQueue[ii].cmd == 1 || _eventQueue[ii].cmd == 2)
+			restorePal = false;
+	}
+
+	if (restorePal) {
+		for (int ii = 0; ii < 12; ++ii) {
+			// Throw out any clearPal events, otherwise our palette restoration attempt would be doomed.
+			if (_eventQueue[ii].cmd == 10)
+				_eventQueue[ii].cmd = 0;
+		}
+		for (int i = 0; i < 4; ++i)
+			Common::copy<const uint16 *, uint16 *>(&_restorePalette[i * 64], &_restorePalette[i * 64 + 64], palettes[i]);
+	}
+
+	_restoreAfterUnblock = restorePal;
+	delete[] _restorePalette;
+	_restorePalette = nullptr;	
+}
+
 void SCDPalette::update() {
+	Palette::update();
+
 	if (!_gfxState.getVar(7) && !_gfxState.getVar(11))
 		return;
 
@@ -301,6 +416,9 @@ void SCDPalette::hINTCallback(void *segaRenderer) {
 }
 
 void SCDPalette::updateSystemPalette() {
+	if (_blocked)
+		return;
+
 	const uint16 *src = _colors2;
 	uint8 *dst = _sysPalette;
 
diff --git a/engines/snatcher/saveflags.h b/engines/snatcher/saveflags.h
index 0d9885c59cb..0a74a73b858 100644
--- a/engines/snatcher/saveflags.h
+++ b/engines/snatcher/saveflags.h
@@ -26,9 +26,11 @@
 namespace Snatcher {
 
 enum SaveFlags : int {
-	kSaveFlagsNone			=	0,
-	kSaveFlagsTempData		=	1 << 0,
-	kSaveFlagsScriptedSave	=	1 << 1
+	kFlagNone				=	0,
+	kFlagTempData			=	1 << 0,
+	kFlagScriptedSave		=	1 << 1,
+	kFlagNeedAnimExtData	=	1 << 2,
+	kFlagNeedPaletteData	=	1 << 3
 };
 
 } // End of namespace Snatcher
diff --git a/engines/snatcher/saveload.cpp b/engines/snatcher/saveload.cpp
index 9c6c6aeaa14..2c432f14b18 100644
--- a/engines/snatcher/saveload.cpp
+++ b/engines/snatcher/saveload.cpp
@@ -41,7 +41,7 @@
 
 namespace Snatcher {
 
-SaveLoadManager::SaveLoadManager(SnatcherEngine *vm) : _vm(vm), _pendingSaveLoad(0), _pendingSaveFlags(kSaveFlagsNone), _enableSaving(true), _tryLoadFromLauncher(true), _desc() {
+SaveLoadManager::SaveLoadManager(SnatcherEngine *vm) : _vm(vm), _pendingSaveLoad(0), _pendingSaveFlags(kFlagNone), _enableSaving(true), _tryLoadFromLauncher(true), _desc() {
 	ConfMan.registerDefault("controller_conf", 0);
 	ConfMan.registerDefault("disable_stereo", false);
 	ConfMan.registerDefault("lightgun_usage", false);
@@ -107,7 +107,7 @@ void SaveLoadManager::requestSave(int slot, const Common::String &desc, bool scr
 	_pendingSaveLoad = -(slot + 1);
 	_desc = desc;
 	if (scriptedSave)
-		_pendingSaveFlags = kSaveFlagsScriptedSave;
+		_pendingSaveFlags = kFlagScriptedSave;
 }
 
 void SaveLoadManager::handleSaveLoad(GameState &state) {
@@ -118,7 +118,7 @@ void SaveLoadManager::handleSaveLoad(GameState &state) {
 	else if (_pendingSaveLoad < 0)
 		saveState(-_pendingSaveLoad - 1, state, _pendingSaveFlags);
 	state.pendingSaveLoad = _pendingSaveLoad = 0;
-	_pendingSaveFlags = kSaveFlagsNone;
+	_pendingSaveFlags = kFlagNone;
 }
 
 bool SaveLoadManager::isSaveSlotUsed(int16 slot) const {
@@ -144,10 +144,10 @@ void SaveLoadManager::enableSaving(bool enable) {
 
 void SaveLoadManager::saveTempState(Script &script) {
 	Common::MemoryWriteStreamDynamic out(DisposeAfterUse::NO);
-	_vm->_scriptEngine->saveState(&out, script, kSaveFlagsTempData);
-	_vm->gfx()->saveState(&out, kSaveFlagsTempData);
-	_vm->sound()->saveState(&out, kSaveFlagsTempData);
-	_vm->_ui->saveState(&out, kSaveFlagsTempData);
+	_vm->_scriptEngine->saveState(&out, script, kFlagTempData);
+	_vm->gfx()->saveState(&out, kFlagTempData);
+	_vm->sound()->saveState(&out, kFlagTempData);
+	_vm->_ui->saveState(&out, kFlagTempData);
 	_tempState = Common::SharedPtr<Common::MemoryReadStream>(new Common::MemoryReadStream(out.getData(), out.size(), DisposeAfterUse::YES));
 }
 
@@ -155,10 +155,10 @@ void SaveLoadManager::restoreTempState(Script &script) {
 	Common::MemoryReadStream *m = _tempState.get();
 	assert(m != nullptr);
 	m->seek(0);
-	_vm->_scriptEngine->loadState(m, script, kSaveFlagsTempData);
-	_vm->gfx()->loadState(m, kSaveFlagsTempData);
-	_vm->sound()->loadState(m, kSaveFlagsTempData);
-	_vm->_ui->loadState(m, kSaveFlagsTempData);
+	_vm->_scriptEngine->loadState(m, script, kFlagTempData);
+	_vm->gfx()->loadState(m, kFlagTempData);
+	_vm->sound()->loadState(m, kFlagTempData);
+	_vm->_ui->loadState(m, kFlagTempData);
 	_tempState.reset();
 }
 
@@ -217,9 +217,7 @@ void SaveLoadManager::loadState(int slot, GameState &state) {
 	state.modPhaseTop = in->readSint16BE();
 	state.prologue = in->readSint16BE();
 
-	SaveFlags flags = kSaveFlagsNone;
-	if (in->readByte())
-		flags = kSaveFlagsScriptedSave;
+	SaveFlags flags = static_cast<SaveFlags>(in->readUint16BE());
 
 	uint16 tsize = in->readUint16BE();
 	if (tsize) {
@@ -242,7 +240,7 @@ void SaveLoadManager::loadState(int slot, GameState &state) {
 
 	if (state.prologue == -1) {
 		state.phase = 0;
-		if (flags & kSaveFlagsScriptedSave)
+		if (flags & kFlagScriptedSave)
 			state.updateFlags = 0;
 		else
 			state.updateFlags &= ~0x80;
@@ -268,7 +266,8 @@ void SaveLoadManager::saveState(int slot, GameState &state, SaveFlags flags) {
 	out->writeSint16BE(state.modPhaseTop);
 	out->writeSint16BE(state.prologue);
 
-	out->writeByte((flags & kSaveFlagsScriptedSave) ? 1 : 0);
+	checkSceneSpecificSaveDataNeed(state, flags);
+	out->writeUint16BE(static_cast<uint16>(flags));
 
 	Common::MemoryReadStream *m = _tempState.get();
 	if (m) {
@@ -296,6 +295,13 @@ void SaveLoadManager::saveState(int slot, GameState &state, SaveFlags flags) {
 	updateSaveSlotsStatus(state);
 }
 
+void SaveLoadManager::checkSceneSpecificSaveDataNeed(const GameState &state, SaveFlags &flags) {
+	const uint16 extDataNeedScenes[] = { 0x0F02 };
+
+	if (Common::find(extDataNeedScenes, &extDataNeedScenes[ARRAYSIZE(extDataNeedScenes)], state.script.curGfxScript) != &extDataNeedScenes[ARRAYSIZE(extDataNeedScenes)])
+		flags = static_cast<SaveFlags>(flags | kFlagNeedAnimExtData);
+}
+
 Common::SeekableReadStream *SaveLoadManager::openFileForLoading(int slot, GameState &state, SaveHeader &header) {
 	Common::String fileName = getSavegameFilename(slot, _vm->_targetName);
 	Common::SeekableReadStream *in = _vm->_saveFileMan->openForLoading(fileName);
diff --git a/engines/snatcher/saveload.h b/engines/snatcher/saveload.h
index a965fa57023..a9f60914f34 100644
--- a/engines/snatcher/saveload.h
+++ b/engines/snatcher/saveload.h
@@ -84,6 +84,7 @@ public:
 private:
 	void loadState(int slot, GameState &state);
 	void saveState(int slot, GameState &state, SaveFlags flags);
+	void checkSceneSpecificSaveDataNeed(const GameState &state, SaveFlags &flags);
 
 	Common::SeekableReadStream *openFileForLoading(int slot, GameState &state, SaveHeader &header);
 	Common::OutSaveFile *openFileForSaving(int slot, const Common::String &desc, GameState &state);
diff --git a/engines/snatcher/script.cpp b/engines/snatcher/script.cpp
index 245858194e3..51c10bf626c 100644
--- a/engines/snatcher/script.cpp
+++ b/engines/snatcher/script.cpp
@@ -555,8 +555,8 @@ void ScriptEngine::loadState(Common::SeekableReadStream *in, Script &script, Sav
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
 
-	if (!(flags & kSaveFlagsTempData)) {
-		if (flags & kSaveFlagsScriptedSave) {
+	if (!(flags & kFlagTempData)) {
+		if (flags & kFlagScriptedSave) {
 			uint8 num = in->readByte();
 			ARR_POS(4) = 0;
 			for (int i = 0; i < num; ++i) {
@@ -583,7 +583,7 @@ void ScriptEngine::loadState(Common::SeekableReadStream *in, Script &script, Sav
 	script.curFileNo = in->readByte();
 	script.curGfxScript = in->readSint16BE();
 
-	if (!(flags & kSaveFlagsTempData)) {
+	if (!(flags & kFlagTempData)) {
 		script.curPos = in->readUint16BE();
 		script.newPos = 0xFFFF;
 		in->readUint16BE();
@@ -593,8 +593,8 @@ void ScriptEngine::loadState(Common::SeekableReadStream *in, Script &script, Sav
 void ScriptEngine::saveState(Common::SeekableWriteStream *out, Script &script, SaveFlags flags) {
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
 
-	if (!(flags & kSaveFlagsTempData)) {
-		if (flags & kSaveFlagsScriptedSave) {
+	if (!(flags & kFlagTempData)) {
+		if (flags & kFlagScriptedSave) {
 			uint8 num = script.temp.arr4[0] & 0xFF;
 			out->writeByte(num);
 			for (int i = 0; i < num; ++i)
@@ -610,11 +610,11 @@ void ScriptEngine::saveState(Common::SeekableWriteStream *out, Script &script, S
 		out->writeByte(script.sentencePos);
 	}
 
-	out->writeByte(flags & kSaveFlagsScriptedSave ? script.temp.curFileNo : script.curFileNo);
+	out->writeByte(flags & kFlagScriptedSave ? script.temp.curFileNo : script.curFileNo);
 	out->writeSint16BE(script.curGfxScript);
 
-	if (!(flags & kSaveFlagsTempData)) {
-		if (flags & kSaveFlagsScriptedSave) {
+	if (!(flags & kFlagTempData)) {
+		if (flags & kFlagScriptedSave) {
 			out->writeUint16BE(script.temp.curPos);
 			out->writeUint16BE(0xFFFF);
 		} else {
diff --git a/engines/snatcher/script.h b/engines/snatcher/script.h
index 0eaf1313a67..7ee6ec6d0de 100644
--- a/engines/snatcher/script.h
+++ b/engines/snatcher/script.h
@@ -52,17 +52,10 @@ public:
 	bool enabled() const { return _enable; }
 	void run(GameState &state);
 
-	//void loadState(Common::SeekableReadStream *in);
-	//void saveState(Common::SeekableWriteStream *out);
-	//void appendRestoreData();
-
 private:
 	const uint16 *_readPos;
-	//const uint16 *_lastReadPos;
 	uint16 *_data;
 	uint16 *_writePos;
-	//uint16 *_restoreData;
-	//uint16 _restoreDataSize;
 	uint16 _currentOpcode;
 	int16 _progress;
 	uint16 _counter;
diff --git a/engines/snatcher/snatcher.cpp b/engines/snatcher/snatcher.cpp
index fa3f6d5c4eb..010777a39bc 100644
--- a/engines/snatcher/snatcher.cpp
+++ b/engines/snatcher/snatcher.cpp
@@ -818,7 +818,7 @@ Common::Error SnatcherEngine::loadGameState(int slot) {
 }
 
 Common::Error SnatcherEngine::saveGameState(int slot, const Common::String &desc, bool isAutosave) {
-	_saveMan->requestSave(slot, desc, kSaveFlagsNone);
+	_saveMan->requestSave(slot, desc, kFlagNone);
 	return Common::kNoError;
 }
 
diff --git a/engines/snatcher/sound.cpp b/engines/snatcher/sound.cpp
index 37bf904b78a..03ae7f82a1b 100644
--- a/engines/snatcher/sound.cpp
+++ b/engines/snatcher/sound.cpp
@@ -137,7 +137,7 @@ void SoundEngine::loadState(Common::SeekableReadStream *in, SaveFlags flags) {
 	_fmStatus.music = in->readByte();
 	_fmStatus.reduceVol2 = in->readByte();
 
-	if (flags & (kSaveFlagsScriptedSave | kSaveFlagsTempData)) {
+	if (flags & (kFlagScriptedSave | kFlagTempData)) {
 		_cdaRestoreTrack = -1;
 		return;
 	}
@@ -153,7 +153,7 @@ void SoundEngine::saveState(Common::SeekableWriteStream *out, SaveFlags flags) {
 	out->writeByte(_fmStatus.music);
 	out->writeByte(_fmStatus.reduceVol2);
 
-	if (flags & (kSaveFlagsScriptedSave | kSaveFlagsTempData))
+	if (flags & (kFlagScriptedSave | kFlagTempData))
 		return;
 
 	int16 cdaTrack = _dev->cdaGetCurTrack();
diff --git a/engines/snatcher/transition.h b/engines/snatcher/transition.h
index 91e228e9973..c01ce2c3171 100644
--- a/engines/snatcher/transition.h
+++ b/engines/snatcher/transition.h
@@ -24,6 +24,7 @@
 
 #include "common/platform.h"
 #include "common/scummsys.h"
+#include "snatcher/saveflags.h"
 
 namespace Common {
 	class SeekableWriteStream;
@@ -70,8 +71,8 @@ public:
 	virtual void hINTCallback(void*) {}
 	const ScrollState &scroll_getState() const { return _result; }
 
-	virtual void saveState(Common::SeekableWriteStream *out) = 0;
-	virtual void loadState(Common::SeekableReadStream *in) = 0;
+	virtual void saveState(Common::SeekableWriteStream *out, SaveFlags flags) = 0;
+	virtual void loadState(Common::SeekableReadStream *in, SaveFlags flags) = 0;
 	virtual void postLoadProcess() = 0;
 
 protected:
diff --git a/engines/snatcher/transition_scd.cpp b/engines/snatcher/transition_scd.cpp
index cf678b85b99..c007809b86e 100644
--- a/engines/snatcher/transition_scd.cpp
+++ b/engines/snatcher/transition_scd.cpp
@@ -29,7 +29,7 @@ namespace Snatcher {
 
 class ScrollInternalState {
 public:
-	ScrollInternalState() : _offsSingle(0), _offsRep(0), _curPos(0), _curResult(0), _factor(1), _override(0) {}
+	ScrollInternalState() {}
 
 	void singleStep(int16 step) {
 		_offsSingle = step << 16;
@@ -73,13 +73,47 @@ public:
 		return _curResult;
 	}
 
+	void saveState(Common::SeekableWriteStream *out) {
+		out->writeSint32BE(_offsSingle);
+		out->writeSint32BE(_offsRep);
+		out->writeSint32BE(_curPos);
+		out->writeSint16BE(_curResult);
+		out->writeSint16BE(_factor);
+		out->writeSint16BE(_override);
+	}
+
+	void loadState(Common::SeekableReadStream *in) {
+		_s_offsSingle = in->readSint32BE();
+		_s_offsRep = in->readSint32BE();
+		_s_curPos = in->readSint32BE();
+		_s_curResult = in->readSint16BE();
+		_s_factor = in->readSint16BE();
+		_s_override = in->readSint16BE();
+	}
+
+	void postLoadProcess() {
+		_offsSingle = _s_offsSingle;
+		_offsRep = _s_offsRep;
+		_curPos = _s_curPos;
+		_curResult = _s_curResult;
+		_factor = _s_factor;
+		_override = _s_override;
+	}
+
 private:
-	int32 _offsSingle;
-	int32 _offsRep;
-	int32 _curPos;
-	int16 _curResult;
-	int16 _factor;
-	int16 _override;
+	int32 _offsSingle = 0;
+	int32 _offsRep = 0;
+	int32 _curPos = 0;
+	int16 _curResult = 0;
+	int16 _factor = 1;
+	int16 _override = 0;
+
+	int32 _s_offsSingle = 0;
+	int32 _s_offsRep = 0;
+	int32 _s_curPos = 0;
+	int16 _s_curResult = 0;
+	int16 _s_factor = 1;
+	int16 _s_override = 0;
 };
 
 class TransitionManager_SCD final : public TransitionManager {
@@ -111,8 +145,8 @@ public:
 
 	void hINTCallback(void *segaRenderer) override;
 
-	void saveState(Common::SeekableWriteStream *out) override;
-	void loadState(Common::SeekableReadStream *in) override;
+	void saveState(Common::SeekableWriteStream *out, SaveFlags flags) override;
+	void loadState(Common::SeekableReadStream *in, SaveFlags flags) override;
 	void postLoadProcess() override;
 
 private:
@@ -121,36 +155,37 @@ private:
 	void resetVars(int groupFlags);
 
 	GraphicsEngine::GfxState &_gfxState;
-	ScrollInternalState *_internalState;
-	int16 *_hScrollTable;
-	uint16 _hScrollTableLen;
-
-	uint8 _scrollType;
-	uint8 _trsCommandExt;
-	uint8 _trsCommand;
-	uint8 _resetCommand;
-
-	uint8 _nextStep;
-	uint8 _lastStep;
-	uint8 _lineScrollOp;
-	uint8 _nextStepExt;
-	uint8 _lastStepExt;
-	uint8 _restoreDlgTab;
-	uint8 _transitionType;
-	uint8 _subPara;
-	int16 _transitionState;
-	int16 _transitionState2;
-	int16 _transitionStep;
-	int16 _tmpScrollOffset;
-	int16 _lineScrollOpState;
-	int16 _lineScrollTimer1;
-	int16 _lineScrollTimer2;
-	int16 _lineScrollTimer3;
-	int16 _lineScrollTimer4;
-	int16 _lineScrollTimer5;
-	bool _useEngineScrollOffsets;
-
-	uint8 *_saveData;
+	ScrollInternalState *_internalState = nullptr;
+	int16 *_hScrollTable = nullptr;
+	uint16 _hScrollTableLen = 0;
+
+	uint8 _scrollType = 0;
+	uint8 _trsCommandExt = 0;
+	uint8 _trsCommand = 0;
+	uint8 _resetCommand = 0;
+
+	uint8 _nextStep = 0;
+	uint8 _lastStep = 0;
+	uint8 _lineScrollOp = 0;
+	uint8 _nextStepExt = 0;
+	uint8 _lastStepExt = 0;
+	uint8 _restoreDlgTab = 0;
+	uint8 _transitionType = 0;
+	uint8 _subPara = 0;
+	int16 _transitionState = 0;
+	int16 _transitionState2 = 0;
+	int16 _transitionStep = 0;
+	int16 _tmpScrollOffset = 0;
+	int16 _lineScrollOpState = 0;
+	int16 _lineScrollTimer1 = 0;
+	int16 _lineScrollTimer2 = 0;
+	int16 _lineScrollTimer3 = 0;
+	int16 _lineScrollTimer4 = 0;
+	int16 _lineScrollTimer5 = 0;
+	bool _useEngineScrollOffsets = false;
+
+	uint8 *_restoreData = nullptr;
+	bool _extendedRestore = false;
 
 private:
 	typedef Common::Functor1Mem<int, void, TransitionManager_SCD> TrsFunc;
@@ -193,8 +228,8 @@ private:
 
 	typedef Common::Functor1Mem<Graphics::SegaRenderer*, void, TransitionManager_SCD> HINTFunc;
 	Common::Array<HINTFunc*> _hINTProcs;
-	const HINTFunc *_hINTHandler;
-	const HINTFunc *_hINTHandlerNext;
+	const HINTFunc *_hINTHandler = nullptr;
+	const HINTFunc *_hINTHandlerNext = nullptr;
 
 	void setHINTHandler(uint8 num);
 
@@ -216,25 +251,22 @@ private:
 	void hIntHandler_videoPhoneCallEnd2(Graphics::SegaRenderer *sr);
 };
 
-TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state), _hScrollTable(nullptr), _hScrollTableLen(0), _internalState(nullptr), _scrollType(0),
-	_transitionStep(0), _trsCommandExt(0), _trsCommand(0), _resetCommand(0), _nextStepExt(0), _nextStep(0), _lastStepExt(0), _lastStep(0), _lineScrollOpState(0), _lineScrollTimer1(0),
-		_lineScrollTimer2(0), _lineScrollTimer3(0), _lineScrollTimer4(0), _lineScrollTimer5(0), _lineScrollOp(0), _restoreDlgTab(0), _transitionType(0), _transitionState(0),
-			_transitionState2(0), _tmpScrollOffset(0), _subPara(0), _useEngineScrollOffsets(false), _hINTHandler(nullptr), _hINTHandlerNext(nullptr), _saveData(nullptr) {
+TransitionManager_SCD::TransitionManager_SCD(GraphicsEngine::GfxState &state) : _gfxState(state) {
 	_internalState = new ScrollInternalState[4];
 	assert(_internalState);
 	_internalState[kVertA].setFactor(-1);
 	_internalState[kVertB].setFactor(-1);
 	_hScrollTable = new int16[0x200]();
 	assert(_hScrollTable);
-	_saveData = new uint8[2]();
-	assert(_saveData);
+	_restoreData = new uint8[3]();
+	assert(_restoreData);
 	makeFunctions();
 }
 
 TransitionManager_SCD::~TransitionManager_SCD() {
 	delete[] _internalState;
 	delete[] _hScrollTable;
-	delete[] _saveData;
+	delete[] _restoreData;
 	_hINTHandler = _hINTHandlerNext = nullptr;
 	for (Common::Array<TrsFunc*>::const_iterator i = _trsProcs.begin(); i != _trsProcs.end(); ++i)
 		delete *i;
@@ -336,22 +368,54 @@ void TransitionManager_SCD::hINTCallback(void *segaRenderer) {
 		(*_hINTHandler)(static_cast<Graphics::SegaRenderer *>(segaRenderer));
 }
 
-void TransitionManager_SCD::saveState(Common::SeekableWriteStream *out) {
+void TransitionManager_SCD::saveState(Common::SeekableWriteStream *out, SaveFlags flags) {
 	out->writeUint32BE(MKTAG('S', 'N', 'A', 'T'));
 	out->writeByte(_lineScrollOp);
+
+	if (flags & (kFlagScriptedSave))
+		return;
+
+	out->writeByte(_scrollType);
+	out->writeByte(_nextStep);
+
+	for (int i = 0; i < 4; ++i)
+		_internalState[i].saveState(out);
 }
 
-void TransitionManager_SCD::loadState(Common::SeekableReadStream *in) {
+void TransitionManager_SCD::loadState(Common::SeekableReadStream *in, SaveFlags flags) {
 	if (in->readUint32BE() != MKTAG('S', 'N', 'A', 'T'))
 		error("%s(): Save file invalid or corrupt", __FUNCTION__);
-	in->read(_saveData, 1);
+
+	_extendedRestore = false;
+	uint8 *s = _restoreData;
+	*s++ = in->readByte();
+
+	if (flags & (kFlagScriptedSave))
+		return;
+
+	*s++ = in->readByte();
+	*s++ = in->readByte();
+
+	for (int i = 0; i < 4; ++i)
+		_internalState[i].loadState(in);
+
+	_extendedRestore = true;
 }
 
 void TransitionManager_SCD::postLoadProcess() {
-	const uint8 *s = _saveData;
+	const uint8 *s = _restoreData;
 	_lineScrollOp = *s++;
 	if (_lineScrollOp == 4)
 		doCommand(_lineScrollOp);
+
+	if (!_extendedRestore)
+		return;
+
+	_scrollType = *s++;
+	_nextStep = *s++;
+
+	for (int i = 0; i < 4; ++i) 
+		_internalState[i].postLoadProcess();
 }
 
 void TransitionManager_SCD::processCmdInternal() {
diff --git a/engines/snatcher/ui.cpp b/engines/snatcher/ui.cpp
index 4a65a2b6b04..2c5f1459787 100644
--- a/engines/snatcher/ui.cpp
+++ b/engines/snatcher/ui.cpp
@@ -500,14 +500,14 @@ void UI::loadState(Common::SeekableReadStream *in, SaveFlags flags) {
 	_verbsInterpreterMode = in->readUint16BE();
 	_progress = _progress2 = -1;
 
-	if (flags & kSaveFlagsTempData)
+	if (flags & kFlagTempData)
 		return;
 
 	_videoPhoneMode = in->readSint16BE();
 	_textInputColumnMax = in->readSint16BE();
 	_prevSelectedVerb = in->readByte();
 	_savedHiliteVerb = in->readByte();
-	if (flags & kSaveFlagsScriptedSave) {
+	if (flags & kFlagScriptedSave) {
 		resetVerbSelection();
 		_savedHiliteVerb = 0;
 	}
@@ -524,7 +524,7 @@ void UI::saveState(Common::SeekableWriteStream *out, SaveFlags flags) {
 	out->writeUint16BE(_verbInterfaceMode);
 	out->writeUint16BE(_verbsInterpreterMode);
 
-	if (flags & kSaveFlagsTempData)
+	if (flags & kFlagTempData)
 		return;
 
 	out->writeSint16BE(_videoPhoneMode);
@@ -1192,7 +1192,6 @@ void UI::moveFlashLight(int32 offsX, int32 offsY) {
 		int32 nY = _flashLight.posY + offsY;
 		if (nY >= -0x270000 && nY < 0x250000)
 			_flashLight.posY = nY;
-
 	} else if (offsY == 0) {
 		assert(offsX != 0);
 		int32 nX = _flashLight.posX + offsX;




More information about the Scummvm-git-logs mailing list