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

Strangerke noreply at scummvm.org
Thu Mar 19 12:45:12 UTC 2026


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

Summary:
a4293edd47 WAYNESWORLD: Add skeleton engine class
c94f90c9f5 WAYNESWORLD: Add WWSurface and Screen classes; Image loading
a348a91559 WAYNESWORLD: Add various drawImage methods
c57c2bffc2 WAYNESWORLD: Add WaynesWorldEngine::drawInterface and related methods
80009378ea WAYNESWORLD: Add WaynesWorldEngine::drawVerbLine
d6588ec305 WAYNESWORLD: Add WaynesWorldEngine::drawInventory and related methods
60246d68fa WAYNESWORLD: Add text loading/drawing methods (actual text drawing to do)
056b2e8c86 WAYNESWORLD: Add header file with object IDs
5e6cf4d50b WAYNESWORLD: Add dialog methods and verb handlers
98ddddabb2 WAYNESWORLD: Add more room methods
15d52b45ca WAYNESWORLD: Add actor/room drawing
74aed6f8e4 WAYNESWORLD: Implement WWSurface::scaleSurface
267dad12f6 WAYNESWORLD: Add more actor animation methods
c153845321 WAYNESWORLD: Add room objects data and methods
b2991bcca7 WAYNESWORLD: Set mouse cursor
fd9bfe2786 WAYNESWORLD: Add mouse move/click methods
95ecef9e2b WAYNESWORLD: Implement pathfinding
8756bf6e98 WAYNESWORLD: Implement font loading and drawing
251813c5dd WAYNESWORLD: Implement loadString method
97191004f6 WAYNESWORLD: Implement wrapped text drawing
88228b94cc WAYNESWORLD: Rename borderSquara to fillSquare and adjust parameters
2769d45269 WAYNESWORLD: Implement game map
a7a0e6c710 WAYNESWORLD: Fix text wrapping
4261467442 WAYNESWORLD: Implement game logic
0f4c51b5fd WAYNESWORLD: Load and draw room animations
c752506d2d WAYNESWORLD: Implement palette fade in/out
97c2dc25a8 WAYNESWORLD: Add transparent drawing of room animations; Rename those methods
788fc741af WAYNESWORLD: Implement getActorScaleFromY
f9d5881943 WAYNESWORLD: Fix room 10 logic and rename variables
fe2462a747 WAYNESWORLD: Fix various logic bugs
f367b85cc4 WAYNESWORLD: Implement static room objects loading and drawing
0c9981c797 WAYNESWORLD: Add code for looking at the 'unused ticket'
db5f3cb82c WAYNESWORLD: Add 'extreme closeup' logic
1457ca3dc0 WAYNESWORLD: Add GameLogic::setPizzathonStatus
aa8ff8a809 WAYNESWORLD: Update background animations based on time (and not some counter like in the original)
3e2fa9eba5 WAYNESWORLD: Remove unneccessary parameter from WaynesWorldEngine::loadRoomBackground
64709f0689 WAYNESWORLD: Fix out of bounds write in pathfinding when no points were found
8825adb85b WAYNESWORLD: Implement room background scrolling
802ee049f6 WAYNESWORLD: Fix actor scaling in room 6
4c1f5cd75d WAYNESWORLD: Add screen effects
dfe0e27e21 WAYNESWORLD: Add Screen::beginUpdate/endUpdate and use it in the screen effects
de041bbbef WAYNESWORLD: Change Screen class to use lockScreen/unlockScreen; Improve ScreenEffects
7b709a67f8 WAYNESWORLD: Fix 'tongue trick' logic and rename variables in room 1
ef017c4955 WAYNESWORLD: Rename methods/variables in room 37
77dcc99861 WAYNESWORLD: Replace forgotten integers with object constants
090d18005b WAYNESWORLD: Replace access to _currentActorNum with convenience methods
b66e7ff169 WAYNESWORLD: Add helper functions for inventory access
6615e5ba33 WAYNESWORLD: Implement fillRoomMaskArea
27120cd17a WAYNESWORLD: Replace for-loops/playAnimation with playAnimationLoops
b3ce16bd70 WAYNESWORLD: Add comments to silence fall-through warnings
8ca2435d78 WAYNESWORLD: Fix setStaticRoomObjectPosition to include endIndex
2f5f559bab WAYNESWORLD: Process user input in room 31 ('Babeoff')
cc56d4edeb WAYNESWORLD: Implement r0_updatePizzathonDialogChoices
c648588bed WAYNESWORLD: Remove debug code
fd8ddd289b WAYNESWORLD: Fix compilation
630e919069 WAYNESWORLD: Introduce GxlArchive
c5e84406d4 WAYNESWORLD: Refactoring to use GxlArchive instead of extracted files
c1acd5af31 WAYNESWORLD: Fix a crash when picking the guitar (uninitialized _scrollWidth), initialize some more variables
6ab4c72573 WAYNESWORLD: Remove useless check before delete
cb38321473 WAYNESWORLD: Remove verbose warning in GlxArchive, remove dead code related to image loading, add a couple of stub warni
3456c969d4 WAYNESWORLD: Add sound and music, remove some TODOs to replace them by STUBs
2ceba7001c WAYNESWORLD: Fix MK file
58645e21d2 WAYNESWORLD: Fix animation loading in room 7 and loadAnimationSpriteRange()
4f1c9e9eec WAYNESWORLD: Small cleanup
d0cc8575f0 WAYNESWORLD: Fix crash in City Hall, add some comments
ae66ecb3fe WAYNESWORLD: mini cleanup in graphics
008b41695f WAYNESWORLD: clean includes in gxlarchive
c663b04746 WAYNESWORLD: First version of the game menu (without save/load)
7c92cf6a41 WAYNESWORLD: Add checks on isSoundEnabled and isMusicEnabled introduced by the menu
82d0978e2e WAYNESWORLD: Fix a couple of issues reported by Digitall
1bc9cd18bf WAYNESWORLD: In menu, avoid to refresh after menuExit() to avoid a crash
c1c00a277c WAYNESWORLD: Add safeguards in drawSurface and drawSurfaceTransparent
b49e4b31c8 WAYNESWORLD: delete midi and sound before leaving
54d76c81a9 WAYNESWORLD: reorder deletes
c889f2f014 WAYNESWORLD: Fix a memory leak (courtesy of Digitall)
fa6ff7a24d WAYNESWORLD: Fix 2 more valgrind issues
21ea3e3050 WAYNESWORLD: Add restart feature (which uses original savegames)
543b19f08d WAYNESWORLD: Add save and load, use synchronize to have common code
f1dc9114c3 WAYNESWORLD: Force a refresh in closeSaveLoadMenu
c55f000bcc WAYNESWORLD: Restrict mouse using boundaries (only used in menus, it seems)
c6ca9cd659 WAYNESWORLD: Clean up some switches
2e0ab5be8b WAYNESWORLD: Add some missing const
9f42a6c9ce WAYNESWORLD: Add a couple of stubs
0c81849c2e WAYNESWORLD: Add a GXL file to the detection
0bd5ccd9c8 WAYNESWORLD: Clean up more switches in gamelogic
b40d3b9126 WAYNESWORLD: start the implementation of the intro
d399053e9e WAYNESWORLD: Improve sound rate (empiric approach, using a timer, + confirmation by assembly)
79062f5b13 WAYNESWORLD: Add intro part 3
d37260f1bb WAYNESWORLD: Remove a delay in introPt1, move intro code to a separate source
726686d0f9 WAYNESWORLD: Reduce memory usage by moving the GXL handling directly in the scrolling background instead of using global
d1a2457811 WAYNESWORLD: Start the implementation of intro part 4
0d57bf2037 WAYNESWORLD: Add intro Pt4 sub 8, start working on intro Pt4 sub 2
fd500ebef2 WAYNESWORLD: fix fillRect in sub2FEFB, add some text display
53db889f68 WAYNESWORLD: finish the implementation of introPt4_sub2
9b1b4f350d WAYNESWORLD: Add introPt4 sub3 to sub5
6e52fff10d WAYNESWORLD: Add flag behavior in playSound
cefd863b74 WAYNESWORLD: Add introPt4 sub 6
8e834adbef WAYNESWORLD: Add introPt4 sub 7
0f335c8f3a WAYNESWORLD: Add introPt4 sub 9, some renaming
421690fd68 WAYNESWORLD: Fix an original bug (ab-use of freed memory)
aaf767a2a3 WAYNESWORLD: Remove useless variables used to store random indexes
5211e36426 WAYNESWORLD: Add a default PCX extension when missing in GLX handling
d76e47c9fd WAYNESWORLD: Add skip to intro
2440f944c8 WAYNESWORLD: Rework runIntro to have a better flow, fix dirty line ingame
e944af20aa WAYNESWORLD: Add safeguards and debug output in case of issue - Courtesy of digitall
08eff856ef WAYNESWORLD: Fix crash in studio 35
c8eb063092 WAYNESWORLD: Add last part to intro (credits)
bdad23d7ce WAYNESWORLD: Remove forgotten dump used during development
82154cf44f WAYNESWORLD: Extend savegames to add a header and a thumbnail, start displaying it from launcher
e54d2f7541 WAYNESWORLD: Add load from launcher
0a1fc4ece2 WAYNESWORLD: Plug ScummVM save/load screens and an option to use them by default
ae476694b9 WAYNESWORLD: Add credits
b7344be034 WAYNESWORLD: Add some more logic in the "Can save/load game state currently" functions to avoid a crash, allow autosave
a49d74c46a WAYNESWORLD: Fix credits section
d4feaa2051 WAYNESWORLD: Update license in some files


Commit: a4293edd47e6a4d2c2c3ebecbb08f1ac1be33e8d
    https://github.com/scummvm/scummvm/commit/a4293edd47e6a4d2c2c3ebecbb08f1ac1be33e8d
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:44+01:00

Commit Message:
WAYNESWORLD: Add skeleton engine class

Changed paths:
  A engines/waynesworld/configure.engine
  A engines/waynesworld/detection.cpp
  A engines/waynesworld/module.mk
  A engines/waynesworld/waynesworld.cpp
  A engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/configure.engine b/engines/waynesworld/configure.engine
new file mode 100644
index 00000000000..fd784dd2355
--- /dev/null
+++ b/engines/waynesworld/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 waynesworld "Wayne's World" no
diff --git a/engines/waynesworld/detection.cpp b/engines/waynesworld/detection.cpp
new file mode 100644
index 00000000000..83fe6d81fe5
--- /dev/null
+++ b/engines/waynesworld/detection.cpp
@@ -0,0 +1,174 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "waynesworld/waynesworld.h"
+
+#include "common/config-manager.h"
+#include "engines/advancedDetector.h"
+#include "common/savefile.h"
+#include "common/system.h"
+#include "base/plugins.h"
+#include "graphics/thumbnail.h"
+
+static const PlainGameDescriptor waynesworldGames[] = {
+	{ "waynesworld", "Wayne's World" },
+	{ 0, 0 }
+};
+
+namespace WaynesWorld {
+
+static const ADGameDescription gameDescriptions[] = {
+	{
+		"waynesworld",
+		0,
+		AD_ENTRY1s("e00.txt", "78769d60d48aea314ed6be2f725c8c2f", 1293),
+		Common::EN_ANY,
+		Common::kPlatformDOS,
+		ADGF_NO_FLAGS,
+		0
+	},
+
+	AD_TABLE_END_MARKER
+};
+
+} // End of namespace WaynesWorld
+
+static const char * const directoryGlobs[] = {
+	"vnm",
+	0
+};
+
+class WaynesWorldMetaEngine : public AdvancedMetaEngine {
+public:
+	WaynesWorldMetaEngine() : AdvancedMetaEngine(WaynesWorld::gameDescriptions, sizeof(ADGameDescription), waynesworldGames) {
+		_maxScanDepth = 3;
+		_directoryGlobs = directoryGlobs;
+	}
+
+	const char *getEngineId() const override {
+		return "waynesworld";
+	}
+
+	const char *getName() const override {
+		return "Wayne's World";
+	}
+
+	const char *getOriginalCopyright() const override {
+		return "(C) 1993 Capstone Software";
+	}
+
+	bool hasFeature(MetaEngineFeature f) const override;
+	bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
+	int getMaximumSaveSlot() const override;
+	SaveStateList listSaves(const char *target) const override;
+	SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
+	void removeSaveState(const char *target, int slot) const override;
+};
+
+bool WaynesWorldMetaEngine::hasFeature(MetaEngineFeature f) const {
+	return false;
+	/*
+	    (f == kSupportsListSaves) ||
+	    (f == kSupportsDeleteSave) ||
+	    (f == kSupportsLoadingDuringStartup) ||
+	    (f == kSavesSupportMetaInfo) ||
+	    (f == kSavesSupportThumbnail) ||
+	    (f == kSavesSupportCreationDate) ||
+		(f == kSimpleSavesNames);
+	*/
+}
+
+void WaynesWorldMetaEngine::removeSaveState(const char *target, int slot) const {
+	Common::String fileName = Common::String::format("%s.%03d", target, slot);
+	g_system->getSavefileManager()->removeSavefile(fileName);
+}
+
+int WaynesWorldMetaEngine::getMaximumSaveSlot() const {
+	return 999;
+}
+
+SaveStateList WaynesWorldMetaEngine::listSaves(const char *target) const {
+	return SaveStateList();
+	#if 0
+	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+	WaynesWorld::WaynesWorldEngine::SaveHeader header;
+	Common::String pattern = target;
+	pattern += ".###";
+	Common::StringArray filenames;
+	filenames = saveFileMan->listSavefiles(pattern.c_str());
+	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->c_str());
+			if (in) {
+				if (WaynesWorld::WaynesWorldEngine::readSaveHeader(in, header) == WaynesWorld::WaynesWorldEngine::kRSHENoError) {
+					saveList.push_back(SaveStateDescriptor(slotNum, header.description));
+				}
+				delete in;
+			}
+		}
+	}
+	// Sort saves based on slot number.
+	Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
+	return saveList;
+	#endif
+}
+
+SaveStateDescriptor WaynesWorldMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+	#if 0
+	Common::String filename = WaynesWorld::WaynesWorldEngine::getSavegameFilename(target, slot);
+	Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str());
+	if (in) {
+		WaynesWorld::WaynesWorldEngine::SaveHeader header;
+		WaynesWorld::WaynesWorldEngine::kReadSaveHeaderError error;
+		error = WaynesWorld::WaynesWorldEngine::readSaveHeader(in, header, false);
+		delete in;
+		if (error == WaynesWorld::WaynesWorldEngine::kRSHENoError) {
+			SaveStateDescriptor desc(slot, header.description);
+			// Slot 0 is used for the "Continue" save
+			desc.setDeletableFlag(slot != 0);
+			desc.setWriteProtectedFlag(slot == 0);
+			desc.setThumbnail(header.thumbnail);
+			desc.setSaveDate(header.saveDate & 0xFFFF, (header.saveDate >> 16) & 0xFF, (header.saveDate >> 24) & 0xFF);
+			desc.setSaveTime((header.saveTime >> 16) & 0xFF, (header.saveTime >> 8) & 0xFF);
+			desc.setPlayTime(header.playTime * 1000);
+			return desc;
+		}
+	}
+	#endif
+	return SaveStateDescriptor();
+}
+
+bool WaynesWorldMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+	if (desc) {
+		*engine = new WaynesWorld::WaynesWorldEngine(syst, desc);
+	}
+	return desc != 0;
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(WAYNESWORLD)
+	REGISTER_PLUGIN_DYNAMIC(WAYNESWORLD, PLUGIN_TYPE_ENGINE, WaynesWorldMetaEngine);
+#else
+	REGISTER_PLUGIN_STATIC(WAYNESWORLD, PLUGIN_TYPE_ENGINE, WaynesWorldMetaEngine);
+#endif
diff --git a/engines/waynesworld/module.mk b/engines/waynesworld/module.mk
new file mode 100644
index 00000000000..2365f728a24
--- /dev/null
+++ b/engines/waynesworld/module.mk
@@ -0,0 +1,13 @@
+MODULE := engines/waynesworld
+
+MODULE_OBJS := \
+	waynesworld.o \
+	detection.o
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_WAYNESWORLD), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
new file mode 100644
index 00000000000..1eea388ea69
--- /dev/null
+++ b/engines/waynesworld/waynesworld.cpp
@@ -0,0 +1,133 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "waynesworld/waynesworld.h"
+
+#include "audio/audiostream.h"
+#include "audio/decoders/aiff.h"
+#include "common/config-manager.h"
+#include "common/debug-channels.h"
+#include "common/error.h"
+#include "common/fs.h"
+#include "common/timer.h"
+#include "common/translation.h"
+#include "engines/advancedDetector.h"
+#include "engines/util.h"
+#include "graphics/cursorman.h"
+#include "graphics/font.h"
+#include "graphics/fontman.h"
+#include "graphics/palette.h"
+#include "graphics/surface.h"
+
+namespace WaynesWorld {
+
+WaynesWorldEngine::WaynesWorldEngine(OSystem *syst, const ADGameDescription *gd) :
+	Engine(syst), _gameDescription(gd) {
+
+	_random = new Common::RandomSource("waynesworld");
+	_isSaveAllowed = false;
+
+	Engine::syncSoundSettings();
+
+#ifdef USE_TRANSLATION
+	_oldGUILanguage	= TransMan.getCurrentLanguage();
+
+	if (gd->flags & GF_GUILANGSWITCH)
+		TransMan.setLanguage(getLanguageLocale(gd->language));
+#endif
+}
+
+WaynesWorldEngine::~WaynesWorldEngine() {
+#ifdef USE_TRANSLATION
+	if (TransMan.getCurrentLanguage() != _oldGUILanguage)
+		TransMan.setLanguage(_oldGUILanguage);
+#endif
+
+	delete _random;
+
+}
+
+Common::Error WaynesWorldEngine::run() {
+
+	_isSaveAllowed = false;
+
+	initGraphics(320, 240);
+
+	while (!shouldQuit()) {
+		updateEvents();
+	}
+
+	return Common::kNoError;
+}
+
+bool WaynesWorldEngine::hasFeature(EngineFeature f) const {
+	return false;
+	/*
+		(f == kSupportsReturnToLauncher) ||
+		(f == kSupportsLoadingDuringRuntime) ||
+		(f == kSupportsSavingDuringRuntime);
+	*/
+}
+
+void WaynesWorldEngine::updateEvents() {
+	Common::Event event;
+
+	while (_eventMan->pollEvent(event)) {
+		switch (event.type) {
+		case Common::EVENT_KEYDOWN:
+			_keyCode = event.kbd.keycode;
+			break;
+		case Common::EVENT_KEYUP:
+			_keyCode = Common::KEYCODE_INVALID;
+			break;
+		case Common::EVENT_MOUSEMOVE:
+  			_mouseX = event.mouse.x;
+  			_mouseY = event.mouse.y;
+  			break;
+		case Common::EVENT_LBUTTONDOWN:
+			//_mouseButtons |= kLeftButtonClicked;
+			//_mouseButtons |= kLeftButtonDown;
+  			break;
+		case Common::EVENT_LBUTTONUP:
+			//_mouseButtons &= ~kLeftButtonDown;
+  			break;
+		case Common::EVENT_RBUTTONDOWN:
+			//_mouseButtons |= kRightButtonClicked;
+			//_mouseButtons |= kRightButtonDown;
+  			break;
+		case Common::EVENT_RBUTTONUP:
+			//_mouseButtons &= ~kRightButtonDown;
+  			break;
+		case Common::EVENT_QUIT:
+			quitGame();
+			break;
+		default:
+			break;
+		}
+	}
+}
+
+int WaynesWorldEngine::getRandom(int max) {
+	return max == 0 ? 0 : _random->getRandomNumber(max - 1);
+}
+
+} // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
new file mode 100644
index 00000000000..fe90402b0cf
--- /dev/null
+++ b/engines/waynesworld/waynesworld.h
@@ -0,0 +1,111 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WAYNESWORLD_WAYNESWORLD_H
+#define WAYNESWORLD_WAYNESWORLD_H
+
+#include "audio/mixer.h"
+#include "common/array.h"
+#include "common/events.h"
+#include "common/file.h"
+#include "common/memstream.h"
+#include "common/random.h"
+#include "common/str.h"
+#include "common/substream.h"
+#include "common/system.h"
+#include "engines/engine.h"
+
+struct ADGameDescription;
+
+namespace WaynesWorld {
+
+#define WAYNESWORLD_SAVEGAME_VERSION 0
+
+enum {
+	GF_GUILANGSWITCH =    (1 << 0) // If GUI language switch is required for menus
+};
+
+class WaynesWorldEngine : public Engine {
+protected:
+	Common::Error run() override;
+	bool hasFeature(EngineFeature f) const override;
+public:
+	WaynesWorldEngine(OSystem *syst, const ADGameDescription *gd);
+	~WaynesWorldEngine() override;
+	const Common::String getTargetName() { return _targetName; }
+	const ADGameDescription *_gameDescription;
+
+private:
+	Graphics::PixelFormat _pixelFormat;
+
+#ifdef USE_TRANSLATION
+	Common::String _oldGUILanguage;
+#endif
+
+public:
+	Common::RandomSource *_random;
+
+	int _mouseX, _mouseY;
+	uint _mouseButtons;
+	Common::KeyCode _keyCode;
+
+	void updateEvents();
+	int getRandom(int max);
+
+	// Savegame API
+
+	enum kReadSaveHeaderError {
+		kRSHENoError = 0,
+		kRSHEInvalidType = 1,
+		kRSHEInvalidVersion = 2,
+		kRSHEIoError = 3
+	};
+
+	struct SaveHeader {
+		Common::String description;
+		uint32 version;
+		byte gameID;
+		uint32 flags;
+		uint32 saveDate;
+		uint32 saveTime;
+		uint32 playTime;
+		Graphics::Surface *thumbnail;
+	};
+
+	bool _isSaveAllowed;
+	/* TODO
+	bool canLoadGameStateCurrently() override { return _isSaveAllowed; }
+	bool canSaveGameStateCurrently() override { return _isSaveAllowed; }
+	Common::Error loadGameState(int slot) override;
+	Common::Error saveGameState(int slot, const Common::String &description, bool isAutosave = false) override;
+	void savegame(const char *filename, const char *description);
+	void loadgame(const char *filename);
+	bool existsSavegame(int num);
+	static Common::String getSavegameFilename(const Common::String &target, int num);
+	WARN_UNUSED_RESULT static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *in, SaveHeader &header, bool skipThumbnail = true);
+	*/
+
+};
+
+} // End of namespace WaynesWorld
+
+#endif // WAYNESWORLD_WAYNESWORLD_H


Commit: c94f90c9f5f55c0b14edb4446bde335dae574989
    https://github.com/scummvm/scummvm/commit/c94f90c9f5f55c0b14edb4446bde335dae574989
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:47+01:00

Commit Message:
WAYNESWORLD: Add WWSurface and Screen classes; Image loading

Changed paths:
  A engines/waynesworld/graphics.cpp
  A engines/waynesworld/graphics.h
    engines/waynesworld/module.mk
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
new file mode 100644
index 00000000000..d491c57016a
--- /dev/null
+++ b/engines/waynesworld/graphics.cpp
@@ -0,0 +1,168 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "waynesworld/graphics.h"
+#include "common/rect.h"
+#include "common/system.h"
+
+namespace WaynesWorld {
+
+// WWSurface
+
+WWSurface::WWSurface(int width, int height) {
+	create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+}
+
+WWSurface::WWSurface(const Graphics::Surface *sourceSurface) {
+	copyFrom(*sourceSurface);
+}
+
+WWSurface::~WWSurface() {
+	free();
+}
+
+void WWSurface::drawSurfaceIntern(const Graphics::Surface *surface, int x, int y, bool transparent) {
+	int width, height, skipX = 0, skipY = 0;
+
+	if (x >= w || y >= h)
+		return;
+
+	height = surface->h;
+	if (y < 0) {
+		height += y;
+		if (height <= 0)
+			return;
+		skipY = -y;
+		y = 0;
+	}
+	if (y + height > h)
+		height = h - y;
+
+	width = surface->w;
+	if (x < 0) {
+		width += x;
+		if (width <= 0)
+			return;
+		skipX = -x;
+		x = 0;
+	}
+	if (x + width >= w)
+		width = w - x;
+
+	// debug(6, "drawSurfaceIntern() (%d, %d, %d, %d); skipX: %d; skipY: %d", x, y, width, height, skipX, skipY);
+
+	if (transparent) {
+		for (int yc = 0; yc < height; ++yc) {
+			const byte *source = (const byte*)surface->getBasePtr(skipX, skipY + yc);
+			byte *dest = (byte*)getBasePtr(x, y + yc);
+			for (int xc = 0; xc < width; ++xc) {
+				byte value = *source++;
+				if (value != 0) {
+					*dest = value;
+				}
+				++dest;
+			}
+		}
+	} else {
+		for (int yc = 0; yc < height; ++yc) {
+			const byte *source = (const byte*)surface->getBasePtr(skipX, skipY + yc);
+			byte *dest = (byte*)getBasePtr(x, y + yc);
+			memcpy(dest, source, width);
+		}
+	}
+}
+
+void WWSurface::drawSurface(const Graphics::Surface *surface, int x, int y) {
+	drawSurfaceIntern(surface, x, y, false);
+}
+
+void WWSurface::drawSurfaceTransparent(const Graphics::Surface *surface, int x, int y) {
+	drawSurfaceIntern(surface, x, y, true);
+}
+
+void WWSurface::scaleSurface(const Graphics::Surface *surface) {
+	// TODO
+}
+
+void WWSurface::frameRect(int x1, int y1, int x2, int y2, byte color) {
+	// TODO
+}
+
+void WWSurface::borderSquare(int x, int y, int length, byte frameColor, byte fillColor) {
+	// TODO
+}
+
+void WWSurface::fillRect(int x1, int y1, int x2, int y2, byte color) {
+	// TODO
+}
+
+void WWSurface::clear(byte color) {
+	Graphics::Surface::fillRect(Common::Rect(w, h), color);
+}
+
+// Screen
+
+Screen::Screen() {
+	_surface = new WWSurface(320, 200);
+}
+
+Screen::~Screen() {
+	delete _surface;
+}
+
+void Screen::drawSurface(const Graphics::Surface *surface, int x, int y) {
+	_surface->drawSurface(surface, x, y);
+	updateScreen();
+}
+
+void Screen::drawSurfaceTransparent(const Graphics::Surface *surface, int x, int y) {
+	_surface->drawSurfaceTransparent(surface, x, y);
+	updateScreen();
+}
+
+void Screen::frameRect(int x1, int y1, int x2, int y2, byte color) {
+	_surface->frameRect(x1, y1, x2, y2, color);
+	updateScreen();
+}
+
+void Screen::borderSquare(int x, int y, int length, byte frameColor, byte fillColor) {
+	_surface->borderSquare(x, y, length, frameColor, fillColor);
+	updateScreen();
+}
+
+void Screen::fillRect(int x1, int y1, int x2, int y2, byte color) {
+	_surface->fillRect(x1, y1, x2, y2, color);
+	updateScreen();
+}
+
+void Screen::clear(byte color) {
+	_surface->clear(color);
+	updateScreen();
+}
+
+void Screen::updateScreen() {
+	// TODO Use dirty rectangles or similar
+	g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 0, 0, _surface->w, _surface->h);
+	g_system->updateScreen();
+}
+
+} // End of namespace WaynesWorld
diff --git a/engines/waynesworld/graphics.h b/engines/waynesworld/graphics.h
new file mode 100644
index 00000000000..5d1ea4e399e
--- /dev/null
+++ b/engines/waynesworld/graphics.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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WAYNESWORLD_GRAPHICS_H
+#define WAYNESWORLD_GRAPHICS_H
+
+#include "graphics/surface.h"
+
+namespace WaynesWorld {
+
+class WWSurface : public Graphics::Surface {
+public:
+	WWSurface(int width, int height);
+	WWSurface(const Graphics::Surface *sourceSurface);
+	~WWSurface();
+	void drawSurfaceIntern(const Graphics::Surface *surface, int x, int y, bool transparent);
+	void drawSurface(const Graphics::Surface *surface, int x, int y);
+	void drawSurfaceTransparent(const Graphics::Surface *surface, int x, int y);
+	void scaleSurface(const Graphics::Surface *surface);
+	void frameRect(int x1, int y1, int x2, int y2, byte color);
+	void borderSquare(int x, int y, int length, byte frameColor, byte fillColor);
+	void fillRect(int x1, int y1, int x2, int y2, byte color);
+	void clear(byte color);
+};
+
+class Screen {
+public:
+	Screen();
+	~Screen();
+	void drawSurface(const Graphics::Surface *surface, int x, int y);
+	void drawSurfaceTransparent(const Graphics::Surface *surface, int x, int y);
+	void frameRect(int x1, int y1, int x2, int y2, byte color);
+	void borderSquare(int x, int y, int length, byte frameColor, byte fillColor);
+	void fillRect(int x1, int y1, int x2, int y2, byte color);
+	void clear(byte color);
+protected:
+	WWSurface *_surface;
+	void updateScreen();
+};
+
+} // End of namespace WaynesWorld
+
+#endif // WAYNESWORLD_GRAPHICS_H
diff --git a/engines/waynesworld/module.mk b/engines/waynesworld/module.mk
index 2365f728a24..128cdd33589 100644
--- a/engines/waynesworld/module.mk
+++ b/engines/waynesworld/module.mk
@@ -2,7 +2,8 @@ MODULE := engines/waynesworld
 
 MODULE_OBJS := \
 	waynesworld.o \
-	detection.o
+	detection.o \
+	graphics.o
 
 # This module can be built as a plugin
 ifeq ($(ENABLE_WAYNESWORLD), DYNAMIC_PLUGIN)
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 1eea388ea69..7f623797630 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "waynesworld/waynesworld.h"
+#include "waynesworld/graphics.h"
 
 #include "audio/audiostream.h"
 #include "audio/decoders/aiff.h"
@@ -70,11 +71,39 @@ Common::Error WaynesWorldEngine::run() {
 
 	_isSaveAllowed = false;
 
-	initGraphics(320, 240);
+	initGraphics(320, 200);
+	_screen = new Screen();
+	_backgroundSurface = new WWSurface(320, 150);
 
+#if 0
 	while (!shouldQuit()) {
 		updateEvents();
 	}
+#endif
+
+#if 1
+	loadPalette("m01/wstand0");
+	g_system->getPaletteManager()->setPalette(_palette2, 0, 256);
+
+	WWSurface *wayne = loadSurface("m01/wstand0");
+
+	// Image::PCXDecoder *pcx = loadImage("m00/winter", false);
+	// g_system->copyRectToScreen(pcx->getSurface()->getPixels(), pcx->getSurface()->pitch, 0, 0, pcx->getSurface()->w, pcx->getSurface()->h);
+	// delete pcx;
+
+	while (!shouldQuit()) {
+		updateEvents();
+		_screen->clear(0);
+		_screen->drawSurface(wayne, _mouseX - 10, _mouseY - 10);
+		g_system->updateScreen();
+	}
+
+	delete wayne;
+
+#endif
+
+	delete _backgroundSurface;
+	delete _screen;
 
 	return Common::kNoError;
 }
@@ -130,4 +159,50 @@ int WaynesWorldEngine::getRandom(int max) {
 	return max == 0 ? 0 : _random->getRandomNumber(max - 1);
 }
 
+Image::PCXDecoder *WaynesWorldEngine::loadImage(const char *filename, bool appendRoomName) {
+	Common::String tempFilename = appendRoomName
+		? Common::String::format("%s/%s.pcx", _roomName.c_str(), filename)
+		: Common::String::format("%s.pcx", filename);
+
+	Common::File pcxFile;
+	if (!pcxFile.open(tempFilename)) {
+		warning("loadImage() Could not open '%s'", tempFilename.c_str());
+		return nullptr;
+	}
+
+	Image::PCXDecoder *pcx = new Image::PCXDecoder();
+	if (!pcx->loadStream(pcxFile)) {
+		warning("loadImage() Could not process '%s'", tempFilename.c_str());
+		delete pcx;
+		return nullptr;
+	}
+
+	return pcx;
+}
+
+WWSurface *WaynesWorldEngine::loadSurfaceIntern(const char *filename, bool appendRoomName) {
+    Image::PCXDecoder *imageDecoder = loadImage(filename, appendRoomName);
+	WWSurface *surface = new WWSurface(imageDecoder->getSurface());
+    delete imageDecoder;
+    return surface;
+}
+
+WWSurface *WaynesWorldEngine::loadSurface(const char *filename) {
+	return loadSurfaceIntern(filename, false);
+}
+
+WWSurface *WaynesWorldEngine::loadRoomSurface(const char *filename) {
+	return loadSurfaceIntern(filename, true);
+}
+
+void WaynesWorldEngine::loadPalette(const char *filename) {
+    Image::PCXDecoder *imageDecoder = loadImage(filename, false);
+	if (imageDecoder->getPaletteColorCount() != 256) {
+		warning("loadPalette() Could not load palette from '%s'", filename);
+	} else {
+		memcpy(_palette2, imageDecoder->getPalette(), imageDecoder->getPaletteColorCount() * 3);
+	}
+    delete imageDecoder;
+}
+
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index fe90402b0cf..6d329b40119 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -34,6 +34,8 @@
 #include "common/system.h"
 #include "engines/engine.h"
 
+#include "image/pcx.h"
+
 struct ADGameDescription;
 
 namespace WaynesWorld {
@@ -44,6 +46,9 @@ enum {
 	GF_GUILANGSWITCH =    (1 << 0) // If GUI language switch is required for menus
 };
 
+class Screen;
+class WWSurface;
+
 class WaynesWorldEngine : public Engine {
 protected:
 	Common::Error run() override;
@@ -71,6 +76,21 @@ public:
 	void updateEvents();
 	int getRandom(int max);
 
+	// Graphics
+	byte _palette2[768];
+	Screen *_screen;
+	WWSurface *_backgroundSurface;
+
+	// Room
+	Common::String _roomName;
+
+	// Image loading
+	Image::PCXDecoder *loadImage(const char *filename, bool appendRoomName);
+	WWSurface *loadSurfaceIntern(const char *filename, bool appendRoomName);
+	WWSurface *loadSurface(const char *filename);
+	WWSurface *loadRoomSurface(const char *filename);
+	void loadPalette(const char *filename);
+
 	// Savegame API
 
 	enum kReadSaveHeaderError {


Commit: a348a9155921418112c778793b3f31fa8ae13ce4
    https://github.com/scummvm/scummvm/commit/a348a9155921418112c778793b3f31fa8ae13ce4
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:48+01:00

Commit Message:
WAYNESWORLD: Add various drawImage methods

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 7f623797630..16bac3e6289 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -91,10 +91,13 @@ Common::Error WaynesWorldEngine::run() {
 	// g_system->copyRectToScreen(pcx->getSurface()->getPixels(), pcx->getSurface()->pitch, 0, 0, pcx->getSurface()->w, pcx->getSurface()->h);
 	// delete pcx;
 
+	drawImageToScreen("m00/winter", 0, 151);
+	drawImageToScreen("r00/backg", 0, 0);
+
 	while (!shouldQuit()) {
 		updateEvents();
-		_screen->clear(0);
-		_screen->drawSurface(wayne, _mouseX - 10, _mouseY - 10);
+		// _screen->clear(0);
+		_screen->drawSurfaceTransparent(wayne, _mouseX - 10, _mouseY - 10);
 		g_system->updateScreen();
 	}
 
@@ -205,4 +208,56 @@ void WaynesWorldEngine::loadPalette(const char *filename) {
     delete imageDecoder;
 }
 
+void WaynesWorldEngine::drawImageToSurfaceIntern(const char *filename, WWSurface *destSurface, int x, int y, bool transparent, bool appendRoomName) {
+    Image::PCXDecoder *imageDecoder = loadImage(filename, appendRoomName);
+	if (transparent) {
+		destSurface->drawSurface(imageDecoder->getSurface(), x, y);
+	} else {
+		destSurface->drawSurfaceTransparent(imageDecoder->getSurface(), x, y);
+	}
+    delete imageDecoder;
+}
+
+void WaynesWorldEngine::drawImageToScreenIntern(const char *filename, int x, int y, bool transparent, bool appendRoomName) {
+    Image::PCXDecoder *imageDecoder = loadImage(filename, appendRoomName);
+	if (transparent) {
+		_screen->drawSurface(imageDecoder->getSurface(), x, y);
+	} else {
+		_screen->drawSurfaceTransparent(imageDecoder->getSurface(), x, y);
+	}
+    delete imageDecoder;
+}
+
+void WaynesWorldEngine::drawImageToBackground(const char *filename, int x, int y) {
+    drawImageToSurfaceIntern(filename, _backgroundSurface, x, y, false, false);
+}
+
+void WaynesWorldEngine::drawImageToBackgroundTransparent(const char *filename, int x, int y) {
+    drawImageToSurfaceIntern(filename, _backgroundSurface, x, y, true, false);
+}
+
+void WaynesWorldEngine::drawImageToScreen(const char *filename, int x, int y) {
+    drawImageToScreenIntern(filename, x, y, false, false);
+}
+
+void WaynesWorldEngine::drawImageToSurface(const char *filename, WWSurface *destSurface, int x, int y) {
+    drawImageToSurfaceIntern(filename, destSurface, x, y, false, false);
+}
+
+void WaynesWorldEngine::drawRoomImageToBackground(const char *filename, int x, int y) {
+    drawImageToSurfaceIntern(filename, _backgroundSurface, x, y, false, true);
+}
+
+void WaynesWorldEngine::drawRoomImageToBackgroundTransparent(const char *filename, int x, int y) {
+    drawImageToSurfaceIntern(filename, _backgroundSurface, x, y, true, true);
+}
+
+void WaynesWorldEngine::drawRoomImageToScreen(const char *filename, int x, int y) {
+    drawImageToScreenIntern(filename, x, y, false, true);
+}
+
+void WaynesWorldEngine::drawRoomImageToSurface(const char *filename, WWSurface *destSurface, int x, int y) {
+    drawImageToSurfaceIntern(filename, destSurface, x, y, false, true);
+}
+
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 6d329b40119..13ad2f871a1 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -91,6 +91,18 @@ public:
 	WWSurface *loadRoomSurface(const char *filename);
 	void loadPalette(const char *filename);
 
+	// Image drawing
+	void drawImageToSurfaceIntern(const char *filename, WWSurface *destSurface, int x, int y, bool transparent, bool appendRoomName);
+	void drawImageToScreenIntern(const char *filename, int x, int y, bool transparent, bool appendRoomName);
+	void drawImageToBackground(const char *filename, int x, int y);
+	void drawImageToBackgroundTransparent(const char *filename, int x, int y);
+	void drawImageToScreen(const char *filename, int x, int y);
+	void drawImageToSurface(const char *filename, WWSurface *destSurface, int x, int y);
+	void drawRoomImageToBackground(const char *filename, int x, int y);
+	void drawRoomImageToBackgroundTransparent(const char *filename, int x, int y);
+	void drawRoomImageToScreen(const char *filename, int x, int y);
+	void drawRoomImageToSurface(const char *filename, WWSurface *destSurface, int x, int y);
+
 	// Savegame API
 
 	enum kReadSaveHeaderError {


Commit: c57c2bffc29069ca15a2bbc2f55f7394fd796e96
    https://github.com/scummvm/scummvm/commit/c57c2bffc29069ca15a2bbc2f55f7394fd796e96
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:48+01:00

Commit Message:
WAYNESWORLD: Add WaynesWorldEngine::drawInterface and related methods

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 16bac3e6289..160dc6f6577 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -91,7 +91,8 @@ Common::Error WaynesWorldEngine::run() {
 	// g_system->copyRectToScreen(pcx->getSurface()->getPixels(), pcx->getSurface()->pitch, 0, 0, pcx->getSurface()->w, pcx->getSurface()->h);
 	// delete pcx;
 
-	drawImageToScreen("m00/winter", 0, 151);
+	// drawImageToScreen("m00/winter", 0, 151);
+	drawInterface(4);
 	drawImageToScreen("r00/backg", 0, 0);
 
 	while (!shouldQuit()) {
@@ -260,4 +261,76 @@ void WaynesWorldEngine::drawRoomImageToSurface(const char *filename, WWSurface *
     drawImageToSurfaceIntern(filename, destSurface, x, y, false, true);
 }
 
+void WaynesWorldEngine::drawInterface(int verbNum) {
+    if (_currentActorNum != 0) {
+        drawImageToScreen("m00/winter", 0, 151);
+    } else {
+        drawImageToScreen("m00/ginter", 0, 151);
+    }
+    selectVerbNumber2(_verbNumber2 * 24 + 3);
+    _verbNumber = verbNum;
+    selectVerbNumber(_verbNumber * 24 + 3);
+}
+
+void WaynesWorldEngine::selectVerbNumber2(int x) {
+    // sysMouseDriver(2);
+    _screen->frameRect(_verbNumber2 * 24 + 3, 165, _verbNumber2 * 24 + 3 + 23, 198, 0);
+    _verbNumber2 = (x - 3) / 24;
+    _screen->frameRect(_verbNumber2 * 24 + 3, 165, _verbNumber2 * 24 + 3 + 23, 198, 10);
+    // sysMouseDriver(1);
+}
+
+void WaynesWorldEngine::selectVerbNumber(int x) {
+    int selectedButtonIndex = (x - 3) / 24;
+    _firstObjectNumber = -1;
+    if (selectedButtonIndex > 10) {
+        if (_mouseClickY > 182) {
+            if (x < 290) {
+                drawInventory();
+                refreshActors();
+            } else {
+                // TODO r0_handleRoomEvent1();
+            }
+        }
+    } else if (selectedButtonIndex == 0) {
+        changeActor();
+    } else {
+        _verbNumber = selectedButtonIndex;
+        drawVerbLine(_verbNumber, -4, 0);
+        if (_verbNumber == 8 && _inventoryItemsCount == 0) {
+            drawInventory();
+            refreshActors();
+        }
+    }
+}
+
+void WaynesWorldEngine::changeActor() {
+    if (_currentRoomNumber == 31)
+        return;
+    if (_currentActorNum != 0) {
+        _currentActorNum = 0;
+    } else {
+        _currentActorNum = 1;
+    }
+    drawInterface(_verbNumber);
+    _isTextVisible = false;
+    refreshInventory(true);
+}
+
+void WaynesWorldEngine::drawVerbLine(int verbNumber, int objectNumber, const char *objectName) {
+	// TODO
+}
+
+void WaynesWorldEngine::refreshInventory(bool doRefresh) {
+	// TODO
+}
+
+void WaynesWorldEngine::drawInventory() {
+	// TODO
+}
+
+void WaynesWorldEngine::refreshActors() {
+	// TODO
+}
+
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 13ad2f871a1..4c23152bd90 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -69,10 +69,6 @@ private:
 public:
 	Common::RandomSource *_random;
 
-	int _mouseX, _mouseY;
-	uint _mouseButtons;
-	Common::KeyCode _keyCode;
-
 	void updateEvents();
 	int getRandom(int max);
 
@@ -84,6 +80,35 @@ public:
 	// Room
 	Common::String _roomName;
 
+	// Input
+	int _mouseX, _mouseY;
+	int _mouseClickY, _mouseClickX;
+	// uint _mouseButtons;
+	uint _mouseClickButtons;
+	Common::KeyCode _keyCode;
+
+	// Text
+	int _currentTextX, _currentTextY;
+	bool _isTextVisible;
+
+	// Game
+	int _gameState;
+	int _currentActorNum;
+	int _currentRoomNumber;
+	int _verbNumber;
+	int _verbNumber2;
+	int _objectNumber;
+	int _hoverObjectNumber;
+	int _firstObjectNumber;
+	char _firstObjectName[50];
+	int _roomEventNum;
+
+	// Inventory
+	int _inventoryItemsCount;
+	int _inventoryItemsObjectMap[50];
+	int _wayneInventory[50];
+	int _garthInventory[50];
+
 	// Image loading
 	Image::PCXDecoder *loadImage(const char *filename, bool appendRoomName);
 	WWSurface *loadSurfaceIntern(const char *filename, bool appendRoomName);
@@ -103,6 +128,20 @@ public:
 	void drawRoomImageToScreen(const char *filename, int x, int y);
 	void drawRoomImageToSurface(const char *filename, WWSurface *destSurface, int x, int y);
 
+	// Interface
+	void drawInterface(int verbNum);
+	void selectVerbNumber2(int x);
+	void selectVerbNumber(int x);
+	void changeActor();
+	void drawVerbLine(int verbNumber, int objectNumber, const char *objectName);
+
+	// Inventory
+	void refreshInventory(bool doRefresh);
+	void drawInventory();
+
+	// Actors and animations
+	void refreshActors();
+
 	// Savegame API
 
 	enum kReadSaveHeaderError {


Commit: 80009378ea4ed8bdeb9bd609b4c7340b510f59a8
    https://github.com/scummvm/scummvm/commit/80009378ea4ed8bdeb9bd609b4c7340b510f59a8
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:48+01:00

Commit Message:
WAYNESWORLD: Add WaynesWorldEngine::drawVerbLine

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 160dc6f6577..71c5aed1d52 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -318,7 +318,60 @@ void WaynesWorldEngine::changeActor() {
 }
 
 void WaynesWorldEngine::drawVerbLine(int verbNumber, int objectNumber, const char *objectName) {
-	// TODO
+
+	// TODO Move to StaticData class/file
+	static const char *kVerbStrings[] = {
+		"",
+		"pick up"
+		"look at"
+		"use"
+		"talk to"
+		"push"
+		"pull"
+		"extreme closeup of"
+		"give"
+		"open"
+		"close"
+	};
+
+	if (_hoverObjectNumber == objectNumber || verbNumber == -1)
+		return;
+
+	_hoverObjectNumber = objectNumber;
+
+	Common::String verbLine;
+
+	if (objectName) {
+		if (verbNumber == 8) {
+			if (_firstObjectNumber == -1) {
+				verbLine = Common::String::format("give %s to", objectName);
+			} else {
+				verbLine = Common::String::format("give %s to %s", _firstObjectName.c_str(), objectName);
+			}
+		} else if (verbNumber == 3) {
+			if (_firstObjectNumber == -1) {
+				verbLine = Common::String::format("use %s", objectName);
+			} else {
+				verbLine = Common::String::format("use %s on %s", _firstObjectName.c_str(), objectName);
+			}
+		} else {
+			verbLine = Common::String::format("%s %s", kVerbStrings[verbNumber], objectName);
+		}
+	} else {
+		if (_firstObjectNumber == -1) {
+			verbLine = Common::String::format("%s", kVerbStrings[verbNumber]);
+		} else if (verbNumber == 8) {
+			verbLine = Common::String::format("give %s to", _firstObjectName.c_str());
+		} else if (verbNumber == 3) {
+			verbLine = Common::String::format("use %s", _firstObjectName.c_str());
+		}
+	}
+
+	_screen->fillRect(3, 162, 316, 153, 0);
+	// TODO Implement text drawing and draw it
+	// txSetColor(0, 6);
+	// txOutTextXY(154, 5, verbLine);
+	debug("verbLine: [%s]", verbLine.c_str());
 }
 
 void WaynesWorldEngine::refreshInventory(bool doRefresh) {
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 4c23152bd90..7bb571e17b6 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -100,7 +100,7 @@ public:
 	int _objectNumber;
 	int _hoverObjectNumber;
 	int _firstObjectNumber;
-	char _firstObjectName[50];
+	Common::String _firstObjectName;
 	int _roomEventNum;
 
 	// Inventory


Commit: d6588ec305b59a43aa06b9e768c39026ac3b3365
    https://github.com/scummvm/scummvm/commit/d6588ec305b59a43aa06b9e768c39026ac3b3365
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:48+01:00

Commit Message:
WAYNESWORLD: Add WaynesWorldEngine::drawInventory and related methods

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 71c5aed1d52..8724729c201 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -374,12 +374,47 @@ void WaynesWorldEngine::drawVerbLine(int verbNumber, int objectNumber, const cha
 	debug("verbLine: [%s]", verbLine.c_str());
 }
 
+void WaynesWorldEngine::redrawInventory() {
+    // NOTE This seems to hide the inventory
+    _inventoryItemsCount = 1;
+    drawInventory();
+    refreshActors();
+}
+
 void WaynesWorldEngine::refreshInventory(bool doRefresh) {
-	// TODO
+    // NOTE This seems to show the inventory
+    if (_inventoryItemsCount != 0) {
+        drawInventory();
+        drawInventory();
+    }
+    if (doRefresh) {
+        refreshActors();
+    }
 }
 
 void WaynesWorldEngine::drawInventory() {
-	// TODO
+    if (_inventoryItemsCount != 0) {
+        _inventoryItemsCount = 0;
+        return;
+    }
+    int iconX = 0;
+    int iconY = 0;
+    _inventorySprite->clear(0);
+    for (int inventoryItemIndex = 0; inventoryItemIndex < 50; inventoryItemIndex++) {
+        int objectRoomNumber = 0; // TODO getObjectRoom(inventoryItemIndex + 28);
+        if ((_currentActorNum != 0 && objectRoomNumber == 99 && _wayneInventory[inventoryItemIndex] > 0) ||
+            (_currentActorNum == 0 && objectRoomNumber == 99 && _garthInventory[inventoryItemIndex] > 0)) {
+            Common::String filename = Common::String::format("m03/icon%02d", inventoryItemIndex + 1);
+            drawImageToSurface(filename.c_str(), _inventorySprite, iconX, iconY);
+            iconX += 26;
+            if (iconX > 300) {
+                iconX = 0;
+                iconY += 20;
+            }
+            _inventoryItemsObjectMap[_inventoryItemsCount] = inventoryItemIndex + 28;
+            _inventoryItemsCount++;
+        }
+    }
 }
 
 void WaynesWorldEngine::refreshActors() {
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 7bb571e17b6..1d1fbca997d 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -104,6 +104,7 @@ public:
 	int _roomEventNum;
 
 	// Inventory
+	WWSurface *_inventorySprite;
 	int _inventoryItemsCount;
 	int _inventoryItemsObjectMap[50];
 	int _wayneInventory[50];
@@ -136,6 +137,7 @@ public:
 	void drawVerbLine(int verbNumber, int objectNumber, const char *objectName);
 
 	// Inventory
+	void redrawInventory();
 	void refreshInventory(bool doRefresh);
 	void drawInventory();
 


Commit: 60246d68faa86fbd5b0ce32a205c1522c1c5d07a
    https://github.com/scummvm/scummvm/commit/60246d68faa86fbd5b0ce32a205c1522c1c5d07a
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:48+01:00

Commit Message:
WAYNESWORLD: Add text loading/drawing methods (actual text drawing to do)

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 8724729c201..92e99fb09b9 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -163,6 +163,10 @@ int WaynesWorldEngine::getRandom(int max) {
 	return max == 0 ? 0 : _random->getRandomNumber(max - 1);
 }
 
+void WaynesWorldEngine::waitMillis(uint millis) {
+	// TODO
+}
+
 Image::PCXDecoder *WaynesWorldEngine::loadImage(const char *filename, bool appendRoomName) {
 	Common::String tempFilename = appendRoomName
 		? Common::String::format("%s/%s.pcx", _roomName.c_str(), filename)
@@ -261,6 +265,81 @@ void WaynesWorldEngine::drawRoomImageToSurface(const char *filename, WWSurface *
     drawImageToSurfaceIntern(filename, destSurface, x, y, false, true);
 }
 
+void WaynesWorldEngine::loadString(const char *filename, int index, int flag) {
+	// TODO Load the string
+}
+
+void WaynesWorldEngine::drawCurrentTextToSurface(WWSurface *destSurface, int x, int y) {
+    drawCurrentText(x, y, destSurface);
+}
+
+void WaynesWorldEngine::drawCurrentText(int x, int y, WWSurface *destSurface) {
+    int textWidth, textCenterX, textX, textY, textColor, actorY;
+    // WWSurface *textSurface = destSurface ? destSurface : _screen;
+    // txSetFont(font_wwinv);
+    // textWidth = txStrWidth(txtString);
+    if (x != -1) {
+        textCenterX = x;
+        textY = y;
+        textColor = 15;
+    } else if (_currentActorNum != 0) {
+        textCenterX = _wayneSpriteX;
+        actorY = _wayneSpriteY;
+        textColor = 4;
+    } else {
+        textCenterX = _garthSpriteX;
+        actorY = _garthSpriteY;
+        textColor = 119;
+    }
+    textX = textCenterX - 75;
+    if (textX < 0) {
+        textX = 5;
+    } else if (textX + 150 > 319) {
+        textX -= textX - 165;
+    }
+    if (x == -1) {
+        textY = (actorY - 48) - (textWidth / 150 + 1) * 15;
+        if (textY < 0) {
+            textY = actorY + 15;
+        }
+    }
+	// TODO Draw the text
+    // txSetViewPort(textX, 0, textX + 150, 199);
+    // tx_sub_2B2D2(32);
+    // txSetColor(0, 0);
+    // sysMouseDriver(2);
+    // txWrapText(txtString, textX, textY);
+    // txSetFont(font_ww);
+    // tx_sub_2B2D2(32);
+    // txSetColor(textColor, 0);
+    // txWrapText(txtString, clippedTextXCpy, textYCpy);
+    // sysMouseDriver(1);
+    // txSetViewPort(0, 0, 319, 199);
+    // txSetFont(font_bit5x7);
+    _isTextVisible = true;
+    _currentTextX = x;
+    _currentTextY = y;
+}
+
+void WaynesWorldEngine::displayText(const char *filename, int index, int flag, int x, int y, int drawToVirtual) {
+    loadString(filename, index, flag);
+    drawCurrentText(x, y, nullptr);
+}
+
+void WaynesWorldEngine::displayTextLines(const char *filename, int baseIndex, int x, int y, int count) {
+    int ticks = 3000;
+    if (count < 0) {
+        ticks = -count;
+        count = 1;
+    }
+    for (int textIndex = 0; textIndex < count; textIndex++) {
+        displayText(filename, baseIndex + textIndex, 0, x, y, 0);
+        _isTextVisible = false;
+        waitMillis(ticks);
+        refreshActors();
+    }
+}
+
 void WaynesWorldEngine::drawInterface(int verbNum) {
     if (_currentActorNum != 0) {
         drawImageToScreen("m00/winter", 0, 151);
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 1d1fbca997d..586cb89f108 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -70,7 +70,6 @@ public:
 	Common::RandomSource *_random;
 
 	void updateEvents();
-	int getRandom(int max);
 
 	// Graphics
 	byte _palette2[768];
@@ -103,6 +102,12 @@ public:
 	Common::String _firstObjectName;
 	int _roomEventNum;
 
+	// Actors
+	int _wayneSpriteX, _wayneSpriteY, _wayneKind, _wayneActorScale;
+	int _garthSpriteX, _garthSpriteY, _garthKind, _garthActorScale;
+	int _actorSpriteValue;
+	int _actorSpriteIndex;
+
 	// Inventory
 	WWSurface *_inventorySprite;
 	int _inventoryItemsCount;
@@ -110,6 +115,10 @@ public:
 	int _wayneInventory[50];
 	int _garthInventory[50];
 
+	// Utils
+	int getRandom(int max);
+	void waitMillis(uint millis);
+
 	// Image loading
 	Image::PCXDecoder *loadImage(const char *filename, bool appendRoomName);
 	WWSurface *loadSurfaceIntern(const char *filename, bool appendRoomName);
@@ -129,6 +138,13 @@ public:
 	void drawRoomImageToScreen(const char *filename, int x, int y);
 	void drawRoomImageToSurface(const char *filename, WWSurface *destSurface, int x, int y);
 
+	// Text
+	void loadString(const char *filename, int index, int flag);
+	void drawCurrentTextToSurface(WWSurface *destSurface, int x, int y);
+	void drawCurrentText(int x, int y, WWSurface *destSurface);
+	void displayText(const char *filename, int index, int flag, int x, int y, int drawToVirtual);
+	void displayTextLines(const char *filename, int baseIndex, int x, int y, int count);
+
 	// Interface
 	void drawInterface(int verbNum);
 	void selectVerbNumber2(int x);


Commit: 056b2e8c867a3390b2a81c16af4b8e7af9dcffe2
    https://github.com/scummvm/scummvm/commit/056b2e8c867a3390b2a81c16af4b8e7af9dcffe2
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:48+01:00

Commit Message:
WAYNESWORLD: Add header file with object IDs

Changed paths:
  A engines/waynesworld/objectids.h


diff --git a/engines/waynesworld/objectids.h b/engines/waynesworld/objectids.h
new file mode 100644
index 00000000000..6b26d553d1a
--- /dev/null
+++ b/engines/waynesworld/objectids.h
@@ -0,0 +1,437 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WAYNESWORLD_OBJECTIDS_H
+#define WAYNESWORLD_OBJECTIDS_H
+
+namespace WaynesWorld {
+
+enum {
+	kObjectIdNa = 0,
+	kObjectIdWa = 1,
+	kObjectIdBut = 2,
+	kObjectIdStn = 3,
+	kObjectIdDt = 4,
+	kObjectIdSea = 5,
+	kObjectIdReturn100 = 6,
+	kObjectIdCableStat = 7,
+	kObjectIdAdAgency = 8,
+	kObjectIdCassandra101 = 9,
+	kObjectIdInventor = 10,
+	kObjectIdWayne = 11,
+	kObjectIdDonutShop = 12,
+	kObjectIdCindi = 13,
+	kObjectIdChannel35 = 14,
+	kObjectIdMayor = 15,
+	kObjectIdEugene104 = 16,
+	kObjectIdJunkMart = 17,
+	kObjectIdCityHall105 = 18,
+	kObjectIdUnempOff = 19,
+	kObjectIdPepe106 = 20,
+	kObjectIdGilligan106 = 21,
+	kObjectIdReturn101 = 22,
+	kObjectIdReturn102 = 23,
+	kObjectIdReturn103 = 24,
+	kObjectIdReturn104 = 25,
+	kObjectIdReturn105 = 26,
+	kObjectIdReturn106 = 27,
+	kObjectIdInventoryDollar = 28,
+	kObjectIdInventoryUnusedTicket = 29,
+	kObjectIdInventoryLosingTicket = 30,
+	kObjectIdInventoryFreshDonut = 31,
+	kObjectIdInventoryDayOldDonut = 32,
+	kObjectIdInventoryHockeyStick = 33,
+	kObjectIdInventoryPotatoChip = 34,
+	kObjectIdInventoryEmptyPail = 35,
+	kObjectIdInventoryFinalContract = 36,
+	kObjectIdInventorySewerMap = 37,
+	kObjectIdInventoryDrumstick = 38,
+	kObjectIdInventoryLuckySausage = 39,
+	kObjectIdInventoryPailOfWater = 40,
+	kObjectIdInventoryOldDonuts = 41,
+	kObjectIdInventorySetOfKeys = 42,
+	kObjectIdInventoryTopHat = 43,
+	kObjectIdInventoryTicketToRome = 44,
+	kObjectIdInventoryPlungers = 45,
+	kObjectIdInventoryGuitar = 46,
+	kObjectIdInventoryPizzathonList = 47,
+	kObjectIdInventoryCape = 48,
+	kObjectIdInventoryTube = 49,
+	kObjectIdInventoryBeakerOfAcid = 50,
+	kObjectIdInventoryLaundryBasket = 51,
+	kObjectIdInventorySquirtGun = 52,
+	kObjectIdInventoryWinningTicket = 53,
+	kObjectIdInventoryChain = 54,
+	kObjectIdInventoryEmptyBeaker = 55,
+	kObjectIdInventoryClothes = 56,
+	kObjectIdInventoryWeapon = 57,
+	kObjectIdInventoryBoard = 58,
+	kObjectIdInventoryDrum = 59,
+	kObjectIdInventoryPassCard = 60,
+	kObjectIdInventoryMemo = 61,
+	kObjectIdInventorySuckCut = 62,
+	kObjectIdInventoryJawbreakers = 63,
+	kObjectIdInventoryDrumOGrease = 64,
+	kObjectIdInventoryLunchBox = 65,
+	kObjectIdInventoryCassContract = 66,
+	kObjectIdInventoryCandyBar = 67,
+	kObjectIdInventoryGum = 68,
+	kObjectIdInventorySinusPotion = 69,
+	kObjectIdInventoryExtensionCord = 70,
+	kObjectIdInventoryContract = 71,
+	kObjectIdInventoryManholeCover = 72,
+	kObjectIdInventoryRemoteControl = 73,
+	kObjectIdInventoryRope = 74,
+	kObjectIdInventory50000 = 75,
+	kObjectIdInventoryBusinessCards = 76,
+	kObjectIdInventoryCheesePizza = 77,
+	kObjectIdStairs0 = 78,
+	kObjectIdCouch = 79,
+	kObjectIdGuitar = 80,
+	kObjectIdChair = 81,
+	kObjectIdLaundryBasket0 = 82,
+	kObjectIdSchoolClothes = 83,
+	kObjectIdLaundryBasket = 84,
+	kObjectIdCueCards = 85,
+	kObjectIdCamera0 = 86,
+	kObjectIdLaundryRoom = 87,
+	kObjectIdHockeyStick = 88,
+	kObjectIdExit1 = 89,
+	kObjectIdDrGadget_0 = 90,
+	kObjectIdMachine = 91,
+	kObjectIdExtensionCord_0 = 92,
+	kObjectIdDrGadget_1 = 93,
+	kObjectIdRobot1 = 94,
+	kObjectIdLock_0 = 95,
+	kObjectIdLever = 96,
+	kObjectIdMice = 97,
+	kObjectIdUnknown = 98,
+	kObjectIdScreen = 99,
+	kObjectIdWindow1 = 100,
+	kObjectIdSuckCut1 = 101,
+	kObjectIdDisplay1 = 102,
+	kObjectIdCabinet1 = 103,
+	kObjectIdRemoteControl = 104,
+	kObjectIdSafe_0 = 105,
+	kObjectIdBoxes = 106,
+	kObjectIdFileCabinet = 107,
+	kObjectIdOutlet1 = 108,
+	kObjectIdExit2 = 109,
+	kObjectIdBooths = 110,
+	kObjectIdBikerGang = 111,
+	kObjectIdGirls = 112,
+	kObjectIdTables2_0 = 113,
+	kObjectIdTables2_1 = 114,
+	kObjectIdDonutCase = 115,
+	kObjectIdBoxOfDonuts = 116,
+	kObjectIdDonut = 117,
+	kObjectIdWaitress = 118,
+	kObjectIdCounter2_0 = 119,
+	kObjectIdCounter2_1 = 120,
+	kObjectIdKitchen = 121,
+	kObjectIdKitchenDoor = 122,
+	kObjectIdCar3 = 123,
+	kObjectIdProtesters3 = 124,
+	kObjectIdEntrance3 = 125,
+	kObjectIdStairs3 = 126,
+	kObjectIdSatdish = 127,
+	kObjectIdSpace = 128,
+	kObjectIdGrill = 129,
+	kObjectIdExit4 = 130,
+	kObjectIdDrumstick_0 = 131,
+	kObjectIdChain_0 = 132,
+	kObjectIdCheese = 133,
+	kObjectIdDrumstick_1 = 134,
+	kObjectIdChain_1 = 135,
+	kObjectIdCastleDoor = 136,
+	kObjectIdTheBoss = 137,
+	kObjectIdOffice4 = 138,
+	kObjectIdCastle = 139,
+	kObjectIdShade = 140,
+	kObjectIdSign4 = 141,
+	kObjectIdDesks = 142,
+	kObjectIdDesk4 = 143,
+	kObjectIdDraftingBoard = 144,
+	kObjectIdExit5 = 145,
+	kObjectIdDresser = 146,
+	kObjectIdFan = 147,
+	kObjectIdBed = 148,
+	kObjectIdMirror5 = 149,
+	kObjectIdMirthmobile = 150,
+	kObjectIdFrontDoor6 = 151,
+	kObjectIdGate6 = 152,
+	kObjectIdGarage = 153,
+	kObjectIdDog = 154,
+	kObjectIdRope_0 = 155,
+	kObjectIdBeam = 156,
+	kObjectIdRope_1 = 157,
+	kObjectIdSeat = 158,
+	kObjectIdWindow6 = 159,
+	kObjectIdFlowerBed6_0 = 160,
+	kObjectIdFlowerBed6_1 = 161,
+	kObjectIdFrontDoor7 = 162,
+	kObjectIdBillboard7 = 163,
+	kObjectIdBillboard_0 = 164,
+	kObjectIdCar7 = 165,
+	kObjectIdProtesters7 = 166,
+	kObjectIdSatelliteDish7 = 167,
+	kObjectIdWindow7_0 = 168,
+	kObjectIdWindow7_1 = 169,
+	kObjectIdWindow7_2 = 170,
+	kObjectIdDoor8 = 171,
+	kObjectIdHallway8 = 172,
+	kObjectIdBush = 173,
+	kObjectIdPainting8_0 = 174,
+	kObjectIdPainting8_1 = 175,
+	kObjectIdCloset = 176,
+	kObjectIdStaircase = 177,
+	kObjectIdFountain8 = 178,
+	kObjectIdPainting8_2 = 179,
+	kObjectIdDivan = 180,
+	kObjectIdSalesgirl = 181,
+	kObjectIdGum = 182,
+	kObjectIdJawbreakers = 183,
+	kObjectIdCigarettes = 184,
+	kObjectIdSign10 = 185,
+	kObjectIdHotDogs = 186,
+	kObjectIdNewspapers = 187,
+	kObjectIdMagazines10 = 188,
+	kObjectIdExit10 = 189,
+	kObjectIdTicket = 190,
+	kObjectIdCandyBar = 191,
+	kObjectIdExtensionCord_1 = 192,
+	kObjectIdSuckCut = 193,
+	kObjectIdCar11 = 194,
+	kObjectIdOutlet11 = 195,
+	kObjectIdLampPost = 196,
+	kObjectIdLampPosts11_0 = 197,
+	kObjectIdLampPosts11_1 = 198,
+	kObjectIdEntrance11 = 199,
+	kObjectIdManholeCover = 200,
+	kObjectIdManhole = 201,
+	kObjectIdFountain11_0 = 202,
+	kObjectIdFountain11_1 = 203,
+	kObjectIdCityHall11 = 204,
+	kObjectIdExit12 = 205,
+	kObjectIdCecil = 206,
+	kObjectIdMan_0 = 207,
+	kObjectIdSkeleton = 208,
+	kObjectIdMan12_0 = 209,
+	kObjectIdMan12_1 = 210,
+	kObjectIdWoman = 211,
+	kObjectIdFarmer = 212,
+	kObjectIdGate12 = 213,
+	kObjectIdDisplay12 = 214,
+	kObjectIdOffices = 215,
+	kObjectIdChairs12_0 = 216,
+	kObjectIdChairs12_1 = 217,
+	kObjectIdExit13 = 218,
+	kObjectIdPepe13 = 219,
+	kObjectIdFrontDesk13 = 220,
+	kObjectIdHallway13 = 221,
+	kObjectIdCandle13_0 = 222,
+	kObjectIdCandle13_1 = 223,
+	kObjectIdCandle13_2 = 224,
+	kObjectIdCandle13_3 = 225,
+	kObjectIdTable13_0 = 226,
+	kObjectIdTable13_1 = 227,
+	kObjectIdTable13_2 = 228,
+	kObjectIdStage13 = 229,
+	kObjectIdLoadingDock = 230,
+	kObjectIdCar14 = 231,
+	kObjectIdRobot = 232,
+	kObjectIdBillboard14 = 233,
+	kObjectIdBillboard_1 = 234,
+	kObjectIdBench = 235,
+	kObjectIdEntrance14 = 236,
+	kObjectIdReceptionist = 237,
+	kObjectIdFrontDesk15 = 238,
+	kObjectIdSign15_0 = 239,
+	kObjectIdDoor15_0 = 240,
+	kObjectIdSign15_1 = 241,
+	kObjectIdPictures15 = 242,
+	kObjectIdDoor15_1 = 243,
+	kObjectIdTV = 244,
+	kObjectIdMagazines15 = 245,
+	kObjectIdTrophies = 246,
+	kObjectIdFrontDoor15 = 247,
+	kObjectIdDoor16 = 248,
+	kObjectIdClothesRack16_0 = 249,
+	kObjectIdClothesRack16_1 = 250,
+	kObjectIdMagiciansCape = 251,
+	kObjectIdClothesRack16_2 = 252,
+	kObjectIdTopHat = 253,
+	kObjectIdWindow16 = 254,
+	kObjectIdExit9 = 255,
+	kObjectIdEugene9 = 256,
+	kObjectIdMan9 = 257,
+	kObjectIdCounter9 = 258,
+	kObjectIdHorrorSection = 259,
+	kObjectIdComedySection = 260,
+	kObjectIdNewReleases = 261,
+	kObjectIdDisplay9 = 262,
+	kObjectIdExit18 = 263,
+	kObjectIdLooseTube = 264,
+	kObjectIdPizzaMachine = 265,
+	kObjectIdOven = 266,
+	kObjectIdPieceOfPizza = 267,
+	kObjectIdRobot19 = 268,
+	kObjectIdGilligan = 269,
+	kObjectIdStore = 270,
+	kObjectIdBillboard19 = 271,
+	kObjectIdBillboard_2 = 272,
+	kObjectIdWarehouse = 273,
+	kObjectIdCar19 = 274,
+	kObjectIdMan_1 = 275,
+	kObjectIdExit20 = 276,
+	kObjectIdCrate = 277,
+	kObjectIdPotatoChip = 278,
+	kObjectIdRemains = 279,
+	kObjectIdLockers20 = 280,
+	kObjectIdClock = 281,
+	kObjectIdMunchies = 282,
+	kObjectIdFood = 283,
+	kObjectIdFoyer = 284,
+	kObjectIdOffice21 = 285,
+	kObjectIdMirror21_0 = 286,
+	kObjectIdMirror21_1 = 287,
+	kObjectIdTorch21_0 = 288,
+	kObjectIdTorch21_1 = 289,
+	kObjectIdPictures21 = 290,
+	kObjectIdHallway22 = 291,
+	kObjectIdMap = 292,
+	kObjectIdCabinet22_0 = 293,
+	kObjectIdCabinet22_1 = 294,
+	kObjectIdDesk22 = 295,
+	kObjectIdChairs22 = 296,
+	kObjectIdBookshelf = 297,
+	kObjectIdFireplace = 298,
+	kObjectIdPictures22 = 299,
+	kObjectIdWood = 300,
+	kObjectIdExit23 = 301,
+	kObjectIdMan23 = 302,
+	kObjectIdMonitors = 303,
+	kObjectIdAudioControls = 304,
+	kObjectIdDesk23 = 305,
+	kObjectIdOpening_0 = 306,
+	kObjectIdOpening_1 = 307,
+	kObjectIdOpening_2 = 308,
+	kObjectIdOpening_3 = 309,
+	kObjectIdOpening_4 = 310,
+	kObjectIdOpening_5 = 311,
+	kObjectIdOpening_6 = 312,
+	kObjectIdOpening25 = 313,
+	kObjectIdOpening_7 = 314,
+	kObjectIdOpening_8 = 315,
+	kObjectIdOpening26 = 316,
+	kObjectIdOpening_9 = 317,
+	kObjectIdOpening_10 = 318,
+	kObjectIdOpening27 = 319,
+	kObjectIdOpening_11 = 320,
+	kObjectIdOpening_12 = 321,
+	kObjectIdGiantLizard = 322,
+	kObjectIdThrone = 323,
+	kObjectIdExit28 = 324,
+	kObjectIdDisplayCase = 325,
+	kObjectIdShield28_0 = 326,
+	kObjectIdShield28_1 = 327,
+	kObjectIdExit29 = 328,
+	kObjectIdBeakerOfAcid = 329,
+	kObjectIdMadDoctor = 330,
+	kObjectIdMonster = 331,
+	kObjectIdCoveredBody = 332,
+	kObjectIdMachinery = 333,
+	kObjectIdDoor29 = 334,
+	kObjectIdBuzzer = 335,
+	kObjectIdGameBoard = 336,
+	kObjectIdBink = 337,
+	kObjectIdMerrill = 338,
+	kObjectIdDyanne = 339,
+	kObjectIdElevator = 340,
+	kObjectIdDoor32_0 = 341,
+	kObjectIdJanitor = 342,
+	kObjectIdPlungers = 343,
+	kObjectIdCart = 344,
+	kObjectIdPlaque = 345,
+	kObjectIdOffice = 346,
+	kObjectIdDoor32_1 = 347,
+	kObjectIdHallway33 = 348,
+	kObjectIdMemo = 349,
+	kObjectIdComputer = 350,
+	kObjectIdCharts = 351,
+	kObjectIdDesk33 = 352,
+	kObjectIdCabinet33 = 353,
+	kObjectIdExit34 = 354,
+	kObjectIdMan34 = 355,
+	kObjectIdPasscard = 356,
+	kObjectIdLunchBox = 357,
+	kObjectIdLocker = 358,
+	kObjectIdLockers34 = 359,
+	kObjectIdExit35 = 360,
+	kObjectIdCassandra35 = 361,
+	kObjectIdJailCells = 362,
+	kObjectIdDesk35 = 363,
+	kObjectIdKeyRack = 364,
+	kObjectIdTelevision35_0 = 365,
+	kObjectIdTelevision35_1 = 366,
+	kObjectIdTelevision35_2 = 367,
+	kObjectIdExit36 = 368,
+	kObjectIdLunchBox36 = 369,
+	kObjectIdSleepingGuard = 370,
+	kObjectIdSatelliteDish36_0 = 371,
+	kObjectIdSatelliteDish36_1 = 372,
+	kObjectIdLadder37_0 = 373,
+	kObjectIdLadder37_1 = 374,
+	kObjectIdMoney = 375,
+	kObjectIdKeys = 376,
+	kObjectIdMagazines = 377,
+	kObjectIdHandle = 378,
+	kObjectIdLock_1 = 379,
+	kObjectIdSafe_1 = 380,
+	kObjectIdLadder = 381,
+	kObjectIdExit30 = 382,
+	kObjectIdCamera30_0 = 383,
+	kObjectIdCamera30_1 = 384,
+	kObjectIdStage30 = 385,
+	kObjectIdExit17 = 386,
+	kObjectIdGuard17_0 = 387,
+	kObjectIdGuard17_1 = 388,
+	kObjectIdSymbol = 389,
+	kObjectIdExit38 = 390,
+	kObjectIdCassandra = 391,
+	kObjectIdRag = 392,
+	kObjectIdEquipment = 393,
+	kObjectIdSpeaker = 394,
+	kObjectIdGuard38_0 = 395,
+	kObjectIdGuard38_1 = 396,
+	kObjectIdPipes = 397,
+	kObjectIdHypnoBoard = 398,
+	kObjectIdExit39 = 399,
+	kObjectIdHinges = 400,
+	kObjectIdLocks = 401,
+	kObjectIdDoor39 = 402,
+	kObjectIdExit = 403
+};
+
+} // End of namespace WaynesWorld
+
+#endif // WAYNESWORLD_OBJECTIDS_H


Commit: 5e6cf4d50b7c901f01f0bf796ba462721574fc63
    https://github.com/scummvm/scummvm/commit/5e6cf4d50b7c901f01f0bf796ba462721574fc63
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:48+01:00

Commit Message:
WAYNESWORLD: Add dialog methods and verb handlers

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 92e99fb09b9..7027fb1dca6 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -22,6 +22,7 @@
 
 #include "waynesworld/waynesworld.h"
 #include "waynesworld/graphics.h"
+#include "waynesworld/objectids.h"
 
 #include "audio/audiostream.h"
 #include "audio/decoders/aiff.h"
@@ -167,6 +168,11 @@ void WaynesWorldEngine::waitMillis(uint millis) {
 	// TODO
 }
 
+void WaynesWorldEngine::waitSeconds(uint seconds) {
+	// TODO
+	// Replace calls with waitMillis
+}
+
 Image::PCXDecoder *WaynesWorldEngine::loadImage(const char *filename, bool appendRoomName) {
 	Common::String tempFilename = appendRoomName
 		? Common::String::format("%s/%s.pcx", _roomName.c_str(), filename)
@@ -340,6 +346,10 @@ void WaynesWorldEngine::displayTextLines(const char *filename, int baseIndex, in
     }
 }
 
+void WaynesWorldEngine::playSound(const char *filename, int flag) {
+	// TODO
+}
+
 void WaynesWorldEngine::drawInterface(int verbNum) {
     if (_currentActorNum != 0) {
         drawImageToScreen("m00/winter", 0, 151);
@@ -453,6 +463,29 @@ void WaynesWorldEngine::drawVerbLine(int verbNumber, int objectNumber, const cha
 	debug("verbLine: [%s]", verbLine.c_str());
 }
 
+void WaynesWorldEngine::rememberFirstObjectName(int objectId) {
+    if (objectId == -2) {
+        _firstObjectName = "Wayne";
+    } else if (objectId == -3) {
+        _firstObjectName = "Garth";
+    } else if (objectId <= 77) {
+        int inventoryIndex = objectId - 28;
+        int inventoryItemQuantity = 0;
+        if (_currentActorNum != 0) {
+            inventoryItemQuantity = _wayneInventory[inventoryIndex];
+        } else {
+            inventoryItemQuantity = _garthInventory[inventoryIndex];
+        }
+        if (inventoryItemQuantity == 1) {
+            _firstObjectName = "TODO";//getRoomObjectName(objectId);
+        } else {
+            _firstObjectName = "TODO";//Common::String::format("%d %s", inventoryItemQuantity, getRoomObjectName(objectId));
+        }
+    } else {
+        _firstObjectName = "TODO";//getRoomObjectName(objectId);
+    }
+}
+
 void WaynesWorldEngine::redrawInventory() {
     // NOTE This seems to hide the inventory
     _inventoryItemsCount = 1;
@@ -500,4 +533,544 @@ void WaynesWorldEngine::refreshActors() {
 	// TODO
 }
 
+void WaynesWorldEngine::changeRoomScrolling() {
+	// TODO
+}
+
+void WaynesWorldEngine::loadRoomBackground(int roomNum) {
+	// TODO
+}
+
+void WaynesWorldEngine::moveObjectToRoom(int objectId, int roomNum) {
+	// TODO
+}
+
+void WaynesWorldEngine::moveObjectToNowhere(int objectId) {
+	// TODO
+}
+
+void WaynesWorldEngine::startDialog() {
+    redrawInventory();
+    _gameState = 2;
+    drawDialogChoices(-9);
+}
+
+void WaynesWorldEngine::setDialogChoices(int choice1, int choice2, int choice3, int choice4, int choice5) {
+    _dialogChoices[0] = choice1;
+    _dialogChoices[1] = choice2;
+    _dialogChoices[2] = choice3;
+    _dialogChoices[3] = choice4;
+    _dialogChoices[4] = choice5;
+}
+
+void WaynesWorldEngine::drawDialogChoices(int choiceIndex) {
+    // sysMouseDriver(2);
+    if (choiceIndex == -9) {
+        // Redraw all and clear the background
+        _screen->fillRect(0, 151, 319, 199, 0);
+    }
+    byte choiceTextColor = _currentActorNum != 0 ? 11 : 10;
+    byte selectedTextColor = 13;
+    for (int index = 0; index < 5 && _dialogChoices[index] != -1; index++) {
+        byte textColor = index + choiceIndex + 11 == 0 ? selectedTextColor : choiceTextColor;
+        loadString("c04", _dialogChoices[index], 0);
+        // TODO Draw the text
+        // txOutTextXY(txtString, 3, 152 + index * 9);
+    }
+    // sysMouseDriver(1);
+    _selectedDialogChoice = choiceIndex;
+}
+
+void WaynesWorldEngine::handleDialogMouseClick() {
+    int continueDialog = 0;
+    int replyTextIndex1, replyTextIndex2, replyTextIndex3;
+    int replyTextX, replyTextY;
+
+    if (_selectedDialogChoice == -10)
+        return;
+
+    // _selectedDialogChoice goes from -11 (first entry) to -15 (fifth entry)
+    _selectedDialogChoice = _dialogChoices[-_selectedDialogChoice - 11];
+    if (_selectedDialogChoice == -1)
+        return;
+
+    _isTextVisible = false;
+    refreshActors();
+
+    continueDialog = logic_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+
+    if (replyTextIndex1 != -1) {
+        logic_handleDialogReply(replyTextIndex1, replyTextX, replyTextY);
+        if (replyTextIndex2 != -1) {
+            logic_handleDialogReply(replyTextIndex2, replyTextX, replyTextY);
+            if (replyTextIndex3 != -1) {
+                logic_handleDialogReply(replyTextIndex3, replyTextX, replyTextY);
+            }
+        }
+    }
+
+    if (_gameState == 0) {
+        drawInterface(_verbNumber);
+    } else if (continueDialog != 0) {
+        drawDialogChoices(-9);
+    }
+}
+
+void WaynesWorldEngine::handleVerb(int verbFlag) {
+    int verbNum = verbFlag == 1 ? _verbNumber : _verbNumber2;
+    switch (verbNum) {
+    case 1:
+        handleVerbPickUp();
+        break;
+    case 2:
+        handleVerbLookAt();
+        break;
+    case 3:
+        handleVerbUse();
+        break;
+    case 4:
+        handleVerbTalkTo();
+        break;
+    case 5:
+        handleVerbPush();
+        break;
+    case 6:
+        handleVerbPull();
+        break;
+    case 7:
+        // TODO handleVerbExtremeCloseupOf();
+        break;
+    case 8:
+        handleVerbGive();
+        break;
+    case 9:
+        handleVerbOpen();
+        break;
+    case 10:
+        handleVerbClose();
+        break;
+    }
+
+    if (_word_306DB != 0) {
+        changeRoomScrolling();
+    }
+
+}
+
+void WaynesWorldEngine::handleVerbPickUp() {
+    int actionTextIndex = -1;
+
+    _isTextVisible = false;
+    if (_objectNumber <= 77) {
+        refreshActors();
+    }
+
+    actionTextIndex = logic_handleVerbPickUp();
+
+    if (_objectNumber == -3) {
+        actionTextIndex = 29;
+    } else if (_objectNumber == -2) {
+        actionTextIndex = 30;
+    }
+
+    if (actionTextIndex != -1) {
+        displayText("c01", actionTextIndex, 0, -1, -1, 0);
+    }
+
+    switch (actionTextIndex) {
+    case 7:
+        playSound("sv18", 1);
+        playSound("sv28", 1);
+        break;
+    case 0:
+    case 10:
+    case 44:
+    case 54:
+        playSound("sv32", 1);
+        break;
+    case 13:
+        playSound("sv19", 1);
+        break;
+    case 50:
+        playSound("sv33", 1);
+        break;
+    case 51:
+    case 59:
+        playSound("sv31", 1);
+        break;
+    case 53:
+        playSound("ss07", 1);
+        break;
+    case 55:
+        playSound("sv29", 1);
+        break;
+    case 56:
+        playSound("sv38", 1);
+        break;
+    }
+
+}
+
+void WaynesWorldEngine::handleVerbLookAt() {
+    _isTextVisible = 0;
+    if (_objectNumber <= 77) {
+        refreshActors();
+    }
+    if (_objectNumber == kObjectIdComputer) {
+        moveObjectToRoom(kObjectIdCindi, 103);
+    }
+    if (_objectNumber == kObjectIdInventoryUnusedTicket) {
+        // TODO lookAtUnusedTicket();
+    } else {
+        if (_currentActorNum != 0) {
+            displayText("c02w", _objectNumber, 1, -1, -1, 1);
+        } else {
+            displayText("c02g", _objectNumber, 1, -1, -1, 1);
+        }
+    }
+}
+
+void WaynesWorldEngine::handleVerbUse() {
+    int actionTextIndex = -1;
+
+    _isTextVisible = false;
+    if (_objectNumber <= 77) {
+        refreshActors();
+    }
+
+    // See if the object has to be used with another object
+    if (_firstObjectNumber == -1 && (
+        _objectNumber == kObjectIdInventoryPlungers ||
+        _objectNumber == kObjectIdInventoryExtensionCord ||
+        _objectNumber == kObjectIdInventorySuckCut ||
+        _objectNumber == kObjectIdSuckCut ||
+        _objectNumber == kObjectIdInventoryRope ||
+        _objectNumber == kObjectIdInventoryHockeyStick ||
+        _objectNumber == kObjectIdInventoryDrumstick ||
+        _objectNumber == kObjectIdInventoryCheesePizza ||
+        _objectNumber == kObjectIdInventoryChain ||
+        _objectNumber == kObjectIdChain_1 ||
+        _objectNumber == kObjectIdInventoryTube ||
+        _objectNumber == kObjectIdInventoryLunchBox ||
+        _objectNumber == kObjectIdInventoryPassCard ||
+        _objectNumber == kObjectIdInventorySetOfKeys ||
+        _objectNumber == kObjectIdInventorySquirtGun ||
+        _objectNumber == kObjectIdInventoryBeakerOfAcid ||
+        _objectNumber == kObjectIdInventoryFreshDonut ||
+        _objectNumber == kObjectIdInventoryDayOldDonut)) {
+        _firstObjectNumber = _objectNumber;
+        rememberFirstObjectName(_objectNumber);
+        return;
+    }
+
+    if (_firstObjectNumber == kObjectIdInventoryBeakerOfAcid && _objectNumber == kObjectIdInventorySquirtGun) {
+        // TODO _byte_3070E |= 0x01;
+        moveObjectToNowhere(kObjectIdInventoryBeakerOfAcid);
+        refreshInventory(true);
+        return;
+    }
+
+    actionTextIndex = logic_handleVerbUse();
+
+    if (_firstObjectNumber == kObjectIdInventoryPlungers && _objectNumber != kObjectIdLampPost) {
+        actionTextIndex = 44;
+    } else if (_firstObjectNumber == kObjectIdInventoryExtensionCord && _objectNumber != kObjectIdOutlet11) {
+        actionTextIndex = 45;
+    } else if (_firstObjectNumber == kObjectIdInventorySuckCut && _objectNumber != kObjectIdExtensionCord_1) {
+        actionTextIndex = 48;
+    } else if (_firstObjectNumber == kObjectIdSuckCut && _objectNumber != kObjectIdFountain11_0 && _objectNumber != kObjectIdFountain11_1) {
+        actionTextIndex = 48;
+    }
+
+    if (_objectNumber == -3) {
+        actionTextIndex = 31;
+    } else if (_objectNumber == -2) {
+		/* TODO
+        if (_currentRoomNumber == 38 && (_byte_3070A & 0x01)) {
+            r38_atrap();
+            actionTextIndex = -1;
+        } else {
+            actionTextIndex = 32;
+        }
+		*/
+    }
+
+    _firstObjectNumber = -1;
+
+    if (actionTextIndex != -1) {
+        displayText("c03", actionTextIndex, 0, -1, -1, 0);
+    }
+
+    switch (actionTextIndex) {
+    case 0:
+        playSound("sv18", 1);
+        break;
+    case 67:
+        playSound("ss07", 1);
+        break;
+    case 68:
+        playSound("sv32", 1);
+        break;
+    case 69:
+        playSound("sv47", 1);
+        break;
+    case 70:
+        playSound("sv39", 1);
+        break;
+    case 71:
+        playSound("sv38", 1);
+        break;
+    }
+
+}
+
+void WaynesWorldEngine::handleVerbTalkTo() {
+    int actionTextIndex = -1;
+
+    _dialogChoices[0] = -1;
+
+    if (_objectNumber == -3 || _objectNumber == -2) {
+        bool room1Special = false; // TODO !(_byte_306FC & 0x10) && _currentActorNum != 0 && _currentRoomNumber == 1 && (_byte_306FD & 0x01);
+        if (room1Special) {
+            actionTextIndex = 14;
+        } else {
+            actionTextIndex = getRandom(5) + 16;
+            if (_objectNumber == -2)
+                actionTextIndex += 5;
+        }
+        displayText("c11", actionTextIndex, 0, -1, -1, 0);
+        waitSeconds(2);
+        if (room1Special) {
+            actionTextIndex = 15;
+        } else {
+            actionTextIndex += 10;
+        }
+        if (_currentActorNum != 0) {
+            _currentActorNum = 1;
+        } else {
+            _currentActorNum = 0;
+        }
+        loadRoomBackground(_currentRoomNumber);
+        displayText("c11", actionTextIndex, 0, -1, -1, 0);
+        if (_currentActorNum != 0) {
+            _currentActorNum = 1;
+        } else {
+            _currentActorNum = 0;
+        }
+        waitSeconds(2);
+        _isTextVisible = false;
+        loadRoomBackground(_currentRoomNumber);
+        if (room1Special) {
+            // TODO r1_handleRoomEvent(true);
+        }
+        return;
+    }
+
+	logic_handleVerbTalkTo();
+
+    if (_dialogChoices[0] != -1) {
+        startDialog();
+    }
+
+}
+
+void WaynesWorldEngine::handleVerbPush() {
+    int actionTextIndex = -1;
+
+    _isTextVisible = false;
+    if (_objectNumber <= 77) {
+        refreshActors();
+    }
+
+    actionTextIndex = logic_handleVerbPush();
+
+    if (actionTextIndex != -1) {
+        displayText("c05", actionTextIndex, 0, -1, -1, 0);
+    }
+
+    switch (actionTextIndex) {
+    case 0:
+        playSound("sv02", 1);
+        break;
+    case 4:
+        playSound("sv47", 1);
+        break;
+    }
+
+}
+
+void WaynesWorldEngine::handleVerbPull() {
+    int actionTextIndex = -1;
+
+    _isTextVisible = false;
+    if (_objectNumber <= 77) {
+        refreshActors();
+    }
+
+    actionTextIndex = logic_handleVerbPull();
+
+    if (actionTextIndex != -1) {
+        displayText("c06", actionTextIndex, 0, -1, -1, 0);
+    }
+
+    switch (actionTextIndex) {
+    case 0:
+        playSound("sv31", 1);
+        break;
+    }
+
+}
+
+void WaynesWorldEngine::handleVerbGive() {
+    int actionTextIndex = -1;
+
+    if (_firstObjectNumber == -1) {
+        _firstObjectNumber = _objectNumber;
+        rememberFirstObjectName(_objectNumber);
+        return;
+    }
+
+    if (_firstObjectNumber >= 28 && _firstObjectNumber <= 77 &&
+        (_objectNumber == -2 || _objectNumber == -3)) {
+        if (_firstObjectNumber == kObjectIdInventoryDrumstick || _firstObjectNumber == kObjectIdInventoryGuitar) {
+            displayText("c08", 2, 0, -1, -1, 0);
+        } else {
+            int inventoryIndex = _firstObjectNumber - 28;
+            if (_objectNumber == -3) {
+                _garthInventory[inventoryIndex] += _wayneInventory[inventoryIndex];
+                _wayneInventory[inventoryIndex] = 0;
+            } else {
+                _wayneInventory[inventoryIndex] += _garthInventory[inventoryIndex];
+                _garthInventory[inventoryIndex] = 0;
+            }
+            refreshInventory(true);
+            displayText("c08", 1, 0, -1, -1, 0);
+        }
+        _firstObjectNumber = -1;
+        return;
+    }
+
+    actionTextIndex = logic_handleVerbGive();
+
+    _firstObjectNumber = -1;
+
+    if (actionTextIndex != -1) {
+        displayText("c08", actionTextIndex, 0, -1, -1, 0);
+    }
+
+}
+
+void WaynesWorldEngine::handleVerbOpen() {
+    int actionTextIndex = -1;
+
+    _isTextVisible = false;
+    if (_objectNumber <= 77) {
+        refreshActors();
+    }
+
+    actionTextIndex = logic_handleVerbOpen();
+
+    if (actionTextIndex != -1) {
+        displayText("c09", actionTextIndex, 0, -1, -1, 0);
+    }
+
+    switch (actionTextIndex) {
+    case 5:
+        playSound("sv31", 1);
+        break;
+    case 7:
+        playSound("ss07", 1);
+        break;
+    case 8:
+        playSound("sv47", 1);
+        break;
+    case 0:
+        playSound("sv28", 1);
+        break;
+    case 1:
+        playSound("sv38", 1);
+        break;
+    case 10:
+        playSound("sv28", 1);
+        break;
+    case 11:
+        playSound("sv21", 1);
+        break;
+    }
+
+}
+
+void WaynesWorldEngine::handleVerbClose() {
+    int actionTextIndex = -1;
+
+    _isTextVisible = false;
+    if (_objectNumber <= 77) {
+        refreshActors();
+    }
+
+    actionTextIndex = logic_handleVerbClose();
+
+    if (actionTextIndex != -1) {
+        displayText("c10", actionTextIndex, 0, -1, -1, 0);
+    }
+
+    switch (actionTextIndex) {
+    case 0:
+        playSound("sv47", 1);
+        break;
+    case 1:
+        playSound("sv21", 1);
+        break;
+    }
+
+}
+
+int WaynesWorldEngine::logic_handleVerbPickUp() {
+	// TODO
+	return 0;
+}
+
+int WaynesWorldEngine::logic_handleVerbUse() {
+	// TODO
+	return 0;
+}
+
+void WaynesWorldEngine::logic_handleVerbTalkTo() {
+	// TODO
+}
+
+int WaynesWorldEngine::logic_handleVerbPush() {
+	// TODO
+	return 0;
+}
+
+int WaynesWorldEngine::logic_handleVerbPull() {
+	// TODO
+	return 0;
+}
+
+int WaynesWorldEngine::logic_handleVerbOpen() {
+	// TODO
+	return 0;
+}
+
+int WaynesWorldEngine::logic_handleVerbClose() {
+	// TODO
+	return 0;
+}
+
+int WaynesWorldEngine::logic_handleVerbGive() {
+	// TODO
+	return 0;
+}
+
+void WaynesWorldEngine::logic_handleDialogReply(int index, int x, int y) {
+	// TODO
+}
+
+int WaynesWorldEngine::logic_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	// TODO
+	return 0;
+}
+
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 586cb89f108..03b86994541 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -78,6 +78,7 @@ public:
 
 	// Room
 	Common::String _roomName;
+	int _word_306DB;
 
 	// Input
 	int _mouseX, _mouseY;
@@ -115,9 +116,14 @@ public:
 	int _wayneInventory[50];
 	int _garthInventory[50];
 
+	// Dialog
+	int _selectedDialogChoice;
+	int _dialogChoices[5];
+
 	// Utils
 	int getRandom(int max);
 	void waitMillis(uint millis);
+	void waitSeconds(uint seconds);
 
 	// Image loading
 	Image::PCXDecoder *loadImage(const char *filename, bool appendRoomName);
@@ -145,12 +151,16 @@ public:
 	void displayText(const char *filename, int index, int flag, int x, int y, int drawToVirtual);
 	void displayTextLines(const char *filename, int baseIndex, int x, int y, int count);
 
+	// Audio
+	void playSound(const char *filename, int flag);
+
 	// Interface
 	void drawInterface(int verbNum);
 	void selectVerbNumber2(int x);
 	void selectVerbNumber(int x);
 	void changeActor();
 	void drawVerbLine(int verbNumber, int objectNumber, const char *objectName);
+	void rememberFirstObjectName(int objectId);
 
 	// Inventory
 	void redrawInventory();
@@ -160,6 +170,45 @@ public:
 	// Actors and animations
 	void refreshActors();
 
+	// Room
+	void changeRoomScrolling();
+	void loadRoomBackground(int roomNum);
+
+	// Room objects
+	void moveObjectToRoom(int objectId, int roomNum);
+	void moveObjectToNowhere(int objectId);
+
+	// Dialog
+	void startDialog();
+	void setDialogChoices(int choice1, int choice2, int choice3, int choice4, int choice5);
+	void drawDialogChoices(int choiceIndex);
+	void handleDialogMouseClick();
+
+	// Verb handlers
+	void handleVerb(int verbFlag);
+	void handleVerbPickUp();
+	void handleVerbLookAt();
+	void handleVerbUse();
+	void handleVerbTalkTo();
+	void handleVerbPush();
+	void handleVerbPull();
+	void handleVerbExtremeCloseupOf();
+	void handleVerbGive();
+	void handleVerbOpen();
+	void handleVerbClose();
+
+	// Game logic
+	int logic_handleVerbPickUp();
+	int logic_handleVerbUse();
+	void logic_handleVerbTalkTo();
+	int logic_handleVerbPush();
+	int logic_handleVerbPull();
+	int logic_handleVerbOpen();
+	int logic_handleVerbClose();
+	int logic_handleVerbGive();
+	void logic_handleDialogReply(int index, int x, int y);
+	int logic_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+
 	// Savegame API
 
 	enum kReadSaveHeaderError {


Commit: 98ddddabb2a9cb2a837b0c01b108fec1db72ef08
    https://github.com/scummvm/scummvm/commit/98ddddabb2a9cb2a837b0c01b108fec1db72ef08
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:48+01:00

Commit Message:
WAYNESWORLD: Add more room methods

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 7027fb1dca6..5a2eea9d873 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -533,11 +533,53 @@ void WaynesWorldEngine::refreshActors() {
 	// TODO
 }
 
+void WaynesWorldEngine::openRoomLibrary(int roomNum) {
+    _roomName = Common::String::format("r%02d", roomNum);
+}
+
+void WaynesWorldEngine::loadRoomBackground(int roomNum) {
+    drawRoomImageToSurface("backg", _backgroundSurface, 0, 0);
+    refreshRoomBackground(roomNum);
+    refreshActors();
+}
+
+void WaynesWorldEngine::changeRoom(int roomNum) {
+    if (_currentRoomNumber != -1) {
+        // NOTE Not needed gxCloseLib(roomLib);
+        unloadStaticRoomObjects();
+    }
+    openRoomLibrary(roomNum);
+    if (_wayneSpriteX != -1) {
+        loadRoomMask(roomNum);
+        loadStaticRoomObjects(roomNum);
+    }
+    _actorSpriteValue = 0;
+    _currentRoomNumber = roomNum;
+    _byte_306E7++;
+    loadRoomBackground(roomNum);
+}
+
+void WaynesWorldEngine::refreshRoomBackground(int roomNum) {
+	logic_refreshRoomBackground(roomNum);
+}
+
 void WaynesWorldEngine::changeRoomScrolling() {
 	// TODO
 }
 
-void WaynesWorldEngine::loadRoomBackground(int roomNum) {
+void WaynesWorldEngine::loadRoomMask(int roomNum) {
+	// TODO
+}
+
+void WaynesWorldEngine::loadStaticRoomObjects(int roomNum) {
+	// TODO
+}
+
+void WaynesWorldEngine::unloadStaticRoomObjects() {
+	// TODO
+}
+
+void WaynesWorldEngine::drawStaticRoomObjects(int roomNumber, int x, int y, int actorHeight, int actorWidth, WWSurface *surface) {
 	// TODO
 }
 
@@ -1073,4 +1115,8 @@ int WaynesWorldEngine::logic_handleDialogSelect(int &replyTextX, int &replyTextY
 	return 0;
 }
 
+void WaynesWorldEngine::logic_refreshRoomBackground(int roomNum) {
+	// TODO
+}
+
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 03b86994541..3de93050fb1 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -79,6 +79,7 @@ public:
 	// Room
 	Common::String _roomName;
 	int _word_306DB;
+	int _byte_306E7;
 
 	// Input
 	int _mouseX, _mouseY;
@@ -171,8 +172,16 @@ public:
 	void refreshActors();
 
 	// Room
-	void changeRoomScrolling();
+	void openRoomLibrary(int roomNum);
 	void loadRoomBackground(int roomNum);
+	void changeRoom(int roomNum);
+	void refreshRoomBackground(int roomNum);
+	void changeRoomScrolling();
+	void loadRoomMask(int roomNum);
+
+	void loadStaticRoomObjects(int roomNum);
+	void unloadStaticRoomObjects();
+	void drawStaticRoomObjects(int roomNumber, int x, int y, int actorHeight, int actorWidth, WWSurface *surface);
 
 	// Room objects
 	void moveObjectToRoom(int objectId, int roomNum);
@@ -208,6 +217,7 @@ public:
 	int logic_handleVerbGive();
 	void logic_handleDialogReply(int index, int x, int y);
 	int logic_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void logic_refreshRoomBackground(int roomNum);
 
 	// Savegame API
 


Commit: 15d52b45caa66d9f55a9af1ae79794e95369d420
    https://github.com/scummvm/scummvm/commit/15d52b45caa66d9f55a9af1ae79794e95369d420
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:48+01:00

Commit Message:
WAYNESWORLD: Add actor/room drawing

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 5a2eea9d873..fc3f33b2445 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -529,6 +529,140 @@ void WaynesWorldEngine::drawInventory() {
     }
 }
 
+int WaynesWorldEngine::getActorScaleFromY(int actorY) {
+	// TODO
+    return 100;
+}
+
+void WaynesWorldEngine::drawActorReachObject(int objectId, int spriteIndex) {
+    int direction = getObjectDirection(objectId);
+    if (_currentActorNum != 0) {
+        drawActors(direction, 2, 1, spriteIndex, _wayneSpriteX, _wayneSpriteY, _garthSpriteX, _garthSpriteY);
+    } else {
+        drawActors(direction, 1, 2, spriteIndex, _wayneSpriteX, _wayneSpriteY, _garthSpriteX, _garthSpriteY);
+    }
+}
+
+int WaynesWorldEngine::drawActors(int direction, int wayneKind, int garthKind, int spriteIndex, int wayneX, int wayneY, int garthX, int garthY) {
+    updateRoomAnimations(true);
+
+    if (_wayneSpriteX == -1 && _garthSpriteX == -1) {
+        WWSurface *tempBackground = new WWSurface(320, 150);
+        tempBackground->drawSurface(_backgroundSurface, 0, 0);
+        if (_inventoryItemsCount > 0) {
+            tempBackground->drawSurfaceTransparent(_inventorySprite, 0, 0);
+        }
+        _screen->drawSurface(tempBackground, 0, 0);
+        delete tempBackground;
+        return 100;
+    }
+
+    int wayneHeight = 0, wayneWidth = 0;
+    int garthHeight = 0, garthWidth = 0;
+    WWSurface *wayneSprite = nullptr;
+    WWSurface *garthSprite = nullptr;
+
+    if (_wayneSpriteX != -1) {
+        _wayneActorScale = getActorScaleFromY(wayneY);
+        wayneHeight = (100 - _wayneActorScale) * 48 / 90;
+        wayneWidth = _wayneActorScale * 13 / 100;
+        int scaledWayneWidth = _wayneActorScale * 27 / 100;
+        int scaledWayneHeight = _wayneActorScale * 48 / 100;
+        wayneSprite = new WWSurface(scaledWayneWidth, scaledWayneHeight);
+        if (wayneKind == 0) {
+            wayneSprite->scaleSurface(_wayneWalkSprites[direction][spriteIndex]);
+        } else if (wayneKind == 1) {
+            wayneSprite->scaleSurface(_wayneSprites[direction]);
+        } else if (wayneKind == 2) {
+            if (direction < 5) {
+                wayneSprite->scaleSurface(_wayneReachRightSprite);
+            } else {
+                wayneSprite->scaleSurface(_wayneReachLeftSprite);
+            }
+        }
+        if (_from_x1 == 0) {
+            drawStaticRoomObjects(_currentRoomNumber, wayneX, wayneY, wayneHeight, wayneWidth, wayneSprite);
+        }
+    }
+
+    if (_garthSpriteX != -1) {
+        _garthActorScale = getActorScaleFromY(garthY);
+        garthHeight = (100 - _garthActorScale) * 48 / 100;
+        garthWidth = _garthActorScale * 13 / 100;
+        int scaledGarthWidth = _garthActorScale * 27 / 100;
+        int scaledGarthHeight = _garthActorScale * 48 / 100;
+        garthSprite = new WWSurface(scaledGarthWidth, scaledGarthHeight);
+        if (garthKind == 0) {
+            garthSprite->scaleSurface(_garthWalkSprites[direction][spriteIndex]);
+        } else if (garthKind == 1) {
+            garthSprite->scaleSurface(_garthSprites[direction]);
+        } else if (garthKind == 2) {
+            if (direction < 5) {
+                garthSprite->scaleSurface(_garthReachRightSprite);
+            } else {
+                garthSprite->scaleSurface(_garthReachLeftSprite);
+            }
+        }
+        if (_from_x1 == 0) {
+            drawStaticRoomObjects(_currentRoomNumber, garthX, garthY, garthHeight, garthWidth, garthSprite);
+        }
+    }
+
+    WWSurface *tempBackground = new WWSurface(320, 150);
+    tempBackground->drawSurface(_backgroundSurface, 0, 0);
+
+    if (wayneY <= garthY) {
+        if (_wayneSpriteX != -1) {
+            tempBackground->drawSurfaceTransparent(wayneSprite, wayneX - wayneWidth, wayneY + wayneHeight - 48);
+        }
+        if (_garthSpriteX != -1) {
+            tempBackground->drawSurfaceTransparent(garthSprite, garthX - garthWidth, garthY + garthHeight - 48);
+        }
+    } else {
+        if (_garthSpriteX != -1) {
+            tempBackground->drawSurfaceTransparent(garthSprite, garthX - garthWidth, garthY + garthHeight - 48);
+        }
+        if (_wayneSpriteX != -1) {
+            tempBackground->drawSurfaceTransparent(wayneSprite, wayneX - wayneWidth, wayneY + wayneHeight - 48);
+        }
+    }
+
+    if (_from_x1 != 0) {
+        // drawStaticRoomObjects2(tempBackground);
+    }
+
+    if (_inventoryItemsCount > 0) {
+        tempBackground->drawSurfaceTransparent(_inventorySprite, 0, 0);
+    }
+
+    if (_isTextVisible) {
+        drawCurrentTextToSurface(tempBackground, _currentTextX, _currentTextY);
+    }
+
+    _screen->drawSurface(tempBackground, 0, 0);
+
+    _wayneSpriteX = wayneX;
+    _wayneSpriteY = wayneY;
+    _garthSpriteX = garthX;
+    _garthSpriteY = garthY;
+    _actorSpriteValue = direction;
+    _wayneKind = wayneKind;
+    _garthKind = garthKind;
+    _actorSpriteIndex = spriteIndex;
+
+    if (_wayneSpriteX != -1) {
+        delete wayneSprite;
+    }
+
+    if (_garthSpriteX != -1) {
+        delete garthSprite;
+    }
+
+    delete tempBackground;
+
+    return _wayneActorScale;
+}
+
 void WaynesWorldEngine::refreshActors() {
 	// TODO
 }
@@ -571,6 +705,10 @@ void WaynesWorldEngine::loadRoomMask(int roomNum) {
 	// TODO
 }
 
+void WaynesWorldEngine::updateRoomAnimations(bool doUpdate) {
+	// TODO
+}
+
 void WaynesWorldEngine::loadStaticRoomObjects(int roomNum) {
 	// TODO
 }
@@ -591,6 +729,11 @@ void WaynesWorldEngine::moveObjectToNowhere(int objectId) {
 	// TODO
 }
 
+int WaynesWorldEngine::getObjectDirection(int objectId) {
+	// TODO
+	return 0;
+}
+
 void WaynesWorldEngine::startDialog() {
     redrawInventory();
     _gameState = 2;
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 3de93050fb1..a5deec2c862 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -80,6 +80,8 @@ public:
 	Common::String _roomName;
 	int _word_306DB;
 	int _byte_306E7;
+	int _from_x1;
+	bool _doScrollRight;
 
 	// Input
 	int _mouseX, _mouseY;
@@ -109,6 +111,8 @@ public:
 	int _garthSpriteX, _garthSpriteY, _garthKind, _garthActorScale;
 	int _actorSpriteValue;
 	int _actorSpriteIndex;
+	WWSurface *_wayneSprites[8], *_wayneWalkSprites[8][4], *_wayneReachRightSprite, *_wayneReachLeftSprite;
+	WWSurface *_garthSprites[8], *_garthWalkSprites[8][4], *_garthReachRightSprite, *_garthReachLeftSprite;
 
 	// Inventory
 	WWSurface *_inventorySprite;
@@ -169,6 +173,9 @@ public:
 	void drawInventory();
 
 	// Actors and animations
+	int getActorScaleFromY(int actorY);
+	void drawActorReachObject(int objectId, int spriteIndex);
+	int drawActors(int direction, int wayneKind, int garthKind, int spriteIndex, int wayneX, int wayneY, int garthX, int garthY);
 	void refreshActors();
 
 	// Room
@@ -179,6 +186,8 @@ public:
 	void changeRoomScrolling();
 	void loadRoomMask(int roomNum);
 
+	void updateRoomAnimations(bool doUpdate);
+
 	void loadStaticRoomObjects(int roomNum);
 	void unloadStaticRoomObjects();
 	void drawStaticRoomObjects(int roomNumber, int x, int y, int actorHeight, int actorWidth, WWSurface *surface);
@@ -186,6 +195,7 @@ public:
 	// Room objects
 	void moveObjectToRoom(int objectId, int roomNum);
 	void moveObjectToNowhere(int objectId);
+	int getObjectDirection(int objectId);
 
 	// Dialog
 	void startDialog();


Commit: 74aed6f8e4326007ea9e9fa8f485f7b9c91c789c
    https://github.com/scummvm/scummvm/commit/74aed6f8e4326007ea9e9fa8f485f7b9c91c789c
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:48+01:00

Commit Message:
WAYNESWORLD: Implement WWSurface::scaleSurface

Changed paths:
    engines/waynesworld/graphics.cpp
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
index d491c57016a..4e77fcdd8b1 100644
--- a/engines/waynesworld/graphics.cpp
+++ b/engines/waynesworld/graphics.cpp
@@ -100,7 +100,32 @@ void WWSurface::drawSurfaceTransparent(const Graphics::Surface *surface, int x,
 }
 
 void WWSurface::scaleSurface(const Graphics::Surface *surface) {
-	// TODO
+	const int xIncr = surface->w / w;
+	const int xIncrErr = surface->w % w;
+	const int yIncr = (surface->h / h) * surface->pitch;
+	const int yIncrErr = surface->h % h;
+	int errY = 0;
+	byte *source = (byte*)surface->getBasePtr(0, 0);
+	for (int yc = 0; yc < h; yc++) {
+		byte *sourceRow = source;
+		byte *destRow = (byte*)getBasePtr(0, yc);
+		int errX = 0;
+		for (int xc = 0; xc < w; xc++) {
+			*destRow++ = *sourceRow;
+			sourceRow += xIncr;
+			errX += xIncrErr;
+			if (errX >= w) {
+				errX -= w;
+				sourceRow++;
+			}
+		}
+		source += yIncr;
+		errY += yIncrErr;
+		if (errY >= h) {
+			errY -= h;
+			source += surface->pitch;
+		}
+	}
 }
 
 void WWSurface::frameRect(int x1, int y1, int x2, int y2, byte color) {
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index fc3f33b2445..41d0f26303a 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -87,6 +87,9 @@ Common::Error WaynesWorldEngine::run() {
 	g_system->getPaletteManager()->setPalette(_palette2, 0, 256);
 
 	WWSurface *wayne = loadSurface("m01/wstand0");
+	WWSurface *wayneS = new WWSurface(wayne->w * 0.75f, wayne->h * 0.75f);
+
+	wayneS->scaleSurface(wayne);
 
 	// Image::PCXDecoder *pcx = loadImage("m00/winter", false);
 	// g_system->copyRectToScreen(pcx->getSurface()->getPixels(), pcx->getSurface()->pitch, 0, 0, pcx->getSurface()->w, pcx->getSurface()->h);
@@ -99,10 +102,12 @@ Common::Error WaynesWorldEngine::run() {
 	while (!shouldQuit()) {
 		updateEvents();
 		// _screen->clear(0);
-		_screen->drawSurfaceTransparent(wayne, _mouseX - 10, _mouseY - 10);
+		// _screen->drawSurfaceTransparent(wayne, _mouseX - 10, _mouseY - 10);
+		_screen->drawSurfaceTransparent(wayneS, _mouseX - 10, _mouseY - 10);
 		g_system->updateScreen();
 	}
 
+	delete wayneS;
 	delete wayne;
 
 #endif


Commit: 267dad12f6c1c5972ad7870a9c81d2b08956c3c7
    https://github.com/scummvm/scummvm/commit/267dad12f6c1c5972ad7870a9c81d2b08956c3c7
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:49+01:00

Commit Message:
WAYNESWORLD: Add more actor animation methods

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 41d0f26303a..c4bf72eacf4 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -99,11 +99,14 @@ Common::Error WaynesWorldEngine::run() {
 	drawInterface(4);
 	drawImageToScreen("r00/backg", 0, 0);
 
+	openRoomLibrary(6);
+
 	while (!shouldQuit()) {
 		updateEvents();
 		// _screen->clear(0);
 		// _screen->drawSurfaceTransparent(wayne, _mouseX - 10, _mouseY - 10);
-		_screen->drawSurfaceTransparent(wayneS, _mouseX - 10, _mouseY - 10);
+		//_screen->drawSurfaceTransparent(wayneS, _mouseX - 10, _mouseY - 10);
+		// playAnimation("wdog", 0, 9, 64, 111, 0, 150);
 		g_system->updateScreen();
 	}
 
@@ -171,6 +174,7 @@ int WaynesWorldEngine::getRandom(int max) {
 
 void WaynesWorldEngine::waitMillis(uint millis) {
 	// TODO
+	_system->delayMillis(millis);
 }
 
 void WaynesWorldEngine::waitSeconds(uint seconds) {
@@ -669,7 +673,50 @@ int WaynesWorldEngine::drawActors(int direction, int wayneKind, int garthKind, i
 }
 
 void WaynesWorldEngine::refreshActors() {
-	// TODO
+	drawActors(_actorSpriteValue, _wayneKind, _garthKind, _actorSpriteIndex, _wayneSpriteX, _wayneSpriteY, _garthSpriteX, _garthSpriteY);
+}
+
+void WaynesWorldEngine::pickupObject(int objectId, byte &flags, byte flagsSet, int inventoryObjectId) {
+    drawActorReachObject(objectId, 0);
+    for (int index = 0; index < 20; index++) {
+        waitMillis(50);
+        updateRoomAnimations(true);
+    }
+    _garthKind = 1;
+    _wayneKind = 1;
+    moveObjectToNowhere(objectId);
+    flags |= flagsSet;
+    moveObjectToRoom(inventoryObjectId, 99);
+    refreshInventory(false);
+    loadRoomBackground(_currentRoomNumber);
+}
+
+void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int count, int x, int y, int flag, uint ticks) {
+    char filename[32];
+    // sysMouseDriver(2);
+    if (count > 0) {
+        for (int index = startIndex; index < startIndex + count; index++) {
+            updateRoomAnimations(true);
+            sprintf(filename, "%s%d", prefix, index);
+            drawRoomImageToScreen(filename, x, y);
+            drawRoomImageToBackground(filename, x, y);
+            waitMillis(ticks);
+        }
+    } else {
+        for (int index = startIndex; index > startIndex + count; index++) {
+            updateRoomAnimations(true);
+            sprintf(filename, "%s%d", prefix, index);
+            drawRoomImageToScreen(filename, x, y);
+            drawRoomImageToBackground(filename, x, y);
+            waitMillis(ticks);
+        }
+    }
+    if (flag) {
+        sprintf(filename, "%s%d", prefix, startIndex);
+        drawRoomImageToScreen(filename, x, y);
+        drawRoomImageToBackground(filename, x, y);
+    }
+    // sysMouseDriver(1)
 }
 
 void WaynesWorldEngine::openRoomLibrary(int roomNum) {
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index a5deec2c862..5a160ba7eaa 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -177,6 +177,8 @@ public:
 	void drawActorReachObject(int objectId, int spriteIndex);
 	int drawActors(int direction, int wayneKind, int garthKind, int spriteIndex, int wayneX, int wayneY, int garthX, int garthY);
 	void refreshActors();
+	void pickupObject(int objectId, byte &flags, byte flagsSet, int inventoryObjectId);
+	void playAnimation(const char *prefix, int startIndex, int count, int x, int y, int flag, uint ticks);
 
 	// Room
 	void openRoomLibrary(int roomNum);


Commit: c153845321aaa9f130443e3aabc28c1655ee7309
    https://github.com/scummvm/scummvm/commit/c153845321aaa9f130443e3aabc28c1655ee7309
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:49+01:00

Commit Message:
WAYNESWORLD: Add room objects data and methods

Changed paths:
  A engines/waynesworld/staticdata.cpp
    engines/waynesworld/module.mk
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/module.mk b/engines/waynesworld/module.mk
index 128cdd33589..de7860ec6aa 100644
--- a/engines/waynesworld/module.mk
+++ b/engines/waynesworld/module.mk
@@ -3,7 +3,8 @@ MODULE := engines/waynesworld
 MODULE_OBJS := \
 	waynesworld.o \
 	detection.o \
-	graphics.o
+	graphics.o \
+	staticdata.o
 
 # This module can be built as a plugin
 ifeq ($(ENABLE_WAYNESWORLD), DYNAMIC_PLUGIN)
diff --git a/engines/waynesworld/staticdata.cpp b/engines/waynesworld/staticdata.cpp
new file mode 100644
index 00000000000..c6cbbb5f4d4
--- /dev/null
+++ b/engines/waynesworld/staticdata.cpp
@@ -0,0 +1,434 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "waynesworld/waynesworld.h"
+
+namespace WaynesWorld {
+
+const RoomObject WaynesWorldEngine::kRoomObjects[kRoomObjectsCount] = {
+	{ 100, "na", 66, 21, 105, 48, 0, 0, 0 },
+	{ 100, "wa", 21, 82, 65, 113, 0, 0, 0 },
+	{ 100, "but", 219, 22, 256, 51, 0, 0, 0 },
+	{ 100, "stn", 210, 66, 247, 94, 0, 0, 0 },
+	{ 100, "dt", 104, 102, 144, 137, 0, 0, 0 },
+	{ 100, "sea", 245, 119, 283, 144, 0, 0, 0 },
+	{ 100, "return", 118, 181, 203, 193, 0, 0, 0 },
+	{ 101, "cable stat.", 80, 40, 90, 50, 0, 0, 0 },
+	{ 101, "ad agency", 150, 50, 160, 60, 0, 0, 0 },
+	{ 101, "Cassandra", 81, 68, 91, 78, 0, 0, 0 },
+	{ 102, "inventor", 65, 43, 75, 53, 0, 0, 0 },
+	{ 102, "Wayne", 108, 85, 118, 95, 0, 0, 0 },
+	{ 102, "donut shop", 153, 62, 163, 72, 0, 0, 0 },
+	{ -2, "Cindi", 184, 37, 194, 47, 0, 0, 0 },
+	{ 103, "Channel 35", 227, 60, 237, 70, 0, 0, 0 },
+	{ 104, "Mayor", 219, 66, 229, 76, 0, 0, 0 },
+	{ 104, "Eugene", 226, 93, 236, 103, 0, 0, 0 },
+	{ 105, "junk mart", 82, 76, 92, 86, 0, 0, 0 },
+	{ 105, "city hall", 122, 114, 132, 124, 0, 0, 0 },
+	{ 105, "unemp. off.", 176, 125, 186, 135, 0, 0, 0 },
+	{ 106, "Pepe", 173, 86, 183, 96, 0, 0, 0 },
+	{ 106, "Gilligan", 261, 94, 271, 104, 0, 0, 0 },
+	{ 101, "return", 118, 181, 203, 193, 0, 0, 0 },
+	{ 102, "return", 118, 181, 203, 193, 0, 0, 0 },
+	{ 103, "return", 118, 181, 203, 193, 0, 0, 0 },
+	{ 104, "return", 118, 181, 203, 193, 0, 0, 0 },
+	{ 105, "return", 118, 181, 203, 193, 0, 0, 0 },
+	{ 106, "return", 118, 181, 203, 193, 0, 0, 0 },
+	{ 99, "dollar", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "unused ticket", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "losing ticket", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "fresh donut", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "day-old donut", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "hockey stick", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "POTATO chip", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "empty pail", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "final contract", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "sewer map", 0, 0, 0, 0, 0, 0, 0 },
+	{ 99, "drumstick", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "lucky sausage", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "pail of water", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "old donuts", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "set of keys", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "top hat", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "ticket to Rome", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "plungers", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "guitar", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "pizzathon list", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "cape", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "tube", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "beaker of acid", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "laundry basket", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "squirt gun", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "winning ticket", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "chain", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "empty beaker", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "clothes", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "weapon", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "board", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "drum", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "pass card", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "memo", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "Suck Cut (tm)", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "jawbreakers", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "drum o' grease", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "lunch box", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "Cass' contract", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "candy bar", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "gum", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "sinus potion", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "extension cord", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "contract", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "manhole cover", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "remote control", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "rope", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "$50,000", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "business cards", 0, 0, 0, 0, 0, 0, 0 },
+	{ -2, "cheese pizza", 0, 0, 0, 0, 0, 0, 0 },
+	{ 0, "stairs", 76, 37, 175, 78, 5, 168, 92 },
+	{ 0, "couch", 89, 79, 160, 102, 6, 169, 102 },
+	{ 0, "guitar", 16, 84, 28, 113, 5, 34, 125 },
+	{ 0, "chair", 29, 85, 75, 115, 5, 78, 121 },
+	{ 0, "laundry basket", 215, 75, 225, 83, 4, 223, 88 },
+	{ -2, "school clothes", 181, 54, 193, 73, 4, 180, 91 },
+	{ -2, "laundry basket", 184, 74, 207, 85, 4, 187, 93 },
+	{ 0, "cue cards", 249, 40, 302, 85, 1, 214, 115 },
+	{ 0, "camera", 208, 86, 249, 115, 1, 193, 119 },
+	{ 0, "laundry room", 216, 44, 231, 83, 4, 217, 92 },
+	{ 0, "hockey stick", 232, 63, 245, 90, 3, 228, 90 },
+	{ 1, "exit", 3, 70, 24, 104, 4, 12, 105 },
+	{ -2, "Dr. Gadget", 127, 82, 144, 129, 1, 43, 113 },
+	{ -2, "machine", 82, 56, 142, 121, 2, 64, 118 },
+	{ -2, "extension cord", 143, 106, 166, 117, 4, 151, 124 },
+	{ -2, "Dr. Gadget", 90, 77, 111, 126, 7, 151, 127 },
+	{ 1, "robot", 64, 68, 88, 106, 5, 87, 112 },
+	{ -2, "lock", 225, 74, 231, 83, 5, 236, 107 },
+	{ 1, "lever", 225, 67, 234, 77, 5, 236, 107 },
+	{ 1, "mice", 180, 68, 231, 109, 4, 195, 122 },
+	{ 1, "?????", 48, 64, 66, 103, 3, 40, 111 },
+	{ 1, "screen", 118, 58, 158, 90, 3, 127, 115 },
+	{ 1, "window", 91, 70, 117, 90, 4, 98, 109 },
+	{ 1, "suck cut", 33, 80, 45, 87, 4, 43, 108 },
+	{ 1, "display", 268, 47, 319, 87, 2, 230, 112 },
+	{ 1, "cabinet", 28, 87, 50, 103, 4, 43, 108 },
+	{ -2, "remote control", 137, 76, 144, 81, 3, 132, 114 },
+	{ -2, "safe", 133, 70, 146, 87, 3, 132, 114 },
+	{ 1, "boxes", 183, 44, 209, 58, 4, 195, 128 },
+	{ 1, "file cabinet", 250, 67, 263, 102, 3, 242, 105 },
+	{ 1, "outlet", 163, 100, 168, 108, 5, 179, 125 },
+	{ 2, "exit", 117, 64, 130, 89, 5, 128, 89 },
+	{ 2, "booths", 0, 86, 66, 132, 7, 91, 116 },
+	{ 2, "biker gang", 2, 71, 109, 115, 6, 122, 112 },
+	{ 2, "girls", 134, 87, 162, 123, 7, 167, 112 },
+	{ 2, "tables", 99, 102, 176, 149, 7, 175, 115 },
+	{ 2, "tables", 155, 78, 189, 87, 3, 138, 89 },
+	{ 2, "donut case", 221, 85, 233, 94, 2, 187, 101 },
+	{ -2, "box of donuts", 226, 90, 245, 99, 2, 186, 109 },
+	{ -2, "donut", 230, 93, 239, 98, 2, 186, 109 },
+	{ 2, "waitress", 238, 68, 253, 95, 2, 186, 109 },
+	{ 2, "counter", 200, 81, 232, 132, 2, 185, 103 },
+	{ 2, "counter", 233, 95, 318, 149, 1, 186, 115 },
+	{ 2, "kitchen", 254, 57, 319, 88, 2, 187, 116 },
+	{ 2, "kitchen door", 233, 68, 245, 92, 2, 186, 99 },
+	{ 3, "car", 0, 51, 21, 93, 5, 44, 100 },
+	{ 3, "protesters", 4, 53, 101, 97, 5, 64, 109 },
+	{ 3, "entrance", 22, 45, 45, 84, 4, 43, 100 },
+	{ 3, "stairs", 140, 62, 177, 116, 3, 138, 113 },
+	{ 3, "satdish", 249, 54, 319, 122, 1, 137, 113 },
+	{ -2, "space", 249, 54, 319, 122, 1, 137, 113 },
+	{ 3, "grill", 178, 65, 319, 119, 1, 137, 113 },
+	{ 4, "exit", 28, 37, 45, 67, 4, 39, 68 },
+	{ -2, "drumstick", 242, 47, 257, 51, 3, 243, 85 },
+	{ -2, "chain", 247, 29, 253, 47, 3, 243, 85 },
+	{ -2, "cheese", 224, 60, 229, 64, 3, 200, 87 },
+	{ -2, "drumstick", 222, 56, 226, 64, 3, 200, 87 },
+	{ -2, "chain", 223, 64, 247, 70, 3, 200, 87 },
+	{ 4, "castle door", 223, 56, 229, 64, 3, 200, 87 },
+	{ 4, "the boss", 140, 45, 161, 90, 5, 184, 90 },
+	{ 4, "office", 130, 40, 146, 72, 4, 137, 72 },
+	{ 4, "castle", 216, 38, 245, 65, 4, 233, 87 },
+	{ 4, "shade", 240, 31, 267, 57, 1, 244, 86 },
+	{ 4, "sign", 198, 69, 233, 77, 4, 218, 98 },
+	{ 4, "desks", 0, 78, 149, 149, 0, 68, 79 },
+	{ 4, "desk", 58, 49, 109, 71, 3, 52, 74 },
+	{ 4, "drafting board", 257, 57, 306, 78, 1, 232, 86 },
+	{ 5, "exit", 282, 40, 319, 120, 1, 305, 104 },
+	{ 5, "dresser", 154, 60, 180, 76, 5, 180, 81 },
+	{ 5, "fan", 111, 30, 131, 50, 5, 151, 80 },
+	{ 5, "bed", 78, 55, 155, 82, 5, 142, 87 },
+	{ 5, "mirror", 142, 113, 156, 122, 0, 149, 106 },
+	{ 6, "Mirthmobile", 289, 111, 319, 149, 2, 303, 130 },
+	{ 6, "front door", 111, 78, 136, 93, 4, 119, 96 },
+	{ 6, "gate", 241, 75, 256, 91, 4, 248, 91 },
+	{ 6, "garage", 187, 76, 233, 93, 4, 221, 99 },
+	{ 6, "dog", 60, 111, 98, 124, 6, 130, 115 },
+	{ -2, "rope", 47, 110, 98, 125, 0, 68, 115 },
+	{ 6, "beam", 148, 40, 157, 49, 6, 167, 100 },
+	{ -2, "rope", 148, 71, 158, 100, 3, 147, 100 },
+	{ -2, "seat", 146, 87, 164, 95, 4, 155, 99 },
+	{ 6, "window", 140, 55, 160, 66, 4, 156, 109 },
+	{ 6, "flower bed", 129, 91, 177, 97, 4, 150, 104 },
+	{ 6, "flower bed", 63, 93, 101, 100, 4, 81, 104 },
+	{ 7, "front door", 153, 73, 172, 104, 3, 155, 105 },
+	{ 7, "billboard", 68, 39, 100, 53, 4, 94, 124 },
+	{ -2, "billboard", 68, 39, 100, 53, 4, 94, 124 },
+	{ 7, "car", 236, 102, 319, 140, 1, 215, 121 },
+	{ 7, "protesters", 204, 82, 319, 114, 3, 198, 121 },
+	{ 7, "satellite dish", 227, 8, 299, 45, 3, 174, 124 },
+	{ 7, "window", 80, 67, 96, 96, 4, 89, 103 },
+	{ 7, "window", 54, 67, 71, 96, 4, 64, 104 },
+	{ 7, "window", 104, 69, 121, 97, 4, 113, 104 },
+	{ 8, "door", 248, 46, 270, 95, 3, 251, 98 },
+	{ 8, "hallway", 0, 74, 20, 149, 6, -10, 134 },
+	{ 8, "bush", 131, 62, 158, 92, 6, 189, 94 },
+	{ 8, "painting", 296, 71, 318, 102, 3, 273, 130 },
+	{ 8, "painting", 211, 46, 228, 60, 3, 205, 72 },
+	{ 8, "closet", 176, 34, 198, 62, 4, 188, 66 },
+	{ 8, "staircase", 126, 45, 166, 74, 5, 189, 92 },
+	{ 8, "fountain", 62, 41, 114, 78, 4, 76, 127 },
+	{ 8, "painting", 21, 47, 50, 64, 5, 75, 127 },
+	{ 8, "divan", 18, 81, 64, 103, 4, 43, 128 },
+	{ 10, "salesgirl", 134, 14, 185, 86, 0, -1, -1 },
+	{ 10, "gum", 223, 78, 260, 97, 0, -1, -1 },
+	{ 10, "jawbreakers", 243, 66, 297, 91, 0, -1, -1 },
+	{ 10, "cigarettes", 100, 0, 218, 83, 0, -1, -1 },
+	{ 10, "sign", 226, 9, 319, 30, 0, -1, -1 },
+	{ 10, "hot dogs", 0, 38, 44, 71, 0, -1, -1 },
+	{ 10, "newspapers", 0, 93, 89, 124, 0, -1, -1 },
+	{ 10, "magazines", 0, 132, 92, 149, 0, -1, -1 },
+	{ 10, "exit", 281, 45, 319, 149, 0, -1, -1 },
+	{ -2, "ticket", 147, 101, 171, 107, 0, -1, -1 },
+	{ -2, "candy bar", 135, 100, 162, 106, 0, -1, -1 },
+	{ -2, "extension cord", 114, 140, 171, 149, 0, 135, 135 },
+	{ -2, "suck cut", 116, 125, 147, 149, 5, 136, 146 },
+	{ 11, "car", 107, 135, 221, 149, 0, 150, 149 },
+	{ 11, "outlet", 225, 77, 236, 86, 1, 195, 148 },
+	{ 11, "lamp post", 218, 53, 240, 149, 1, 205, 148 },
+	{ 11, "lamp posts", 165, 68, 201, 121, 2, 153, 127 },
+	{ 11, "lamp posts", 265, 38, 299, 149, 2, 153, 127 },
+	{ 11, "entrance", 131, 58, 162, 78, 4, 149, 80 },
+	{ -2, "manhole cover", 82, 118, 100, 124, 4, 90, 133 },
+	{ -2, "manhole", 82, 118, 100, 124, 4, 90, 133 },
+	{ 11, "fountain", 0, 105, 119, 149, 6, 136, 125 },
+	{ 11, "fountain", 65, 88, 140, 104, 6, 136, 125 },
+	{ 11, "City Hall", 45, 8, 253, 85, 4, 153, 112 },
+	{ 12, "exit", 275, 73, 297, 102, 4, 288, 105 },
+	{ -2, "Cecil", 198, 83, 215, 130, 1, 175, 126 },
+	{ -2, "man", 54, 84, 74, 130, 7, 106, 122 },
+	{ 12, "skeleton", 74, 85, 93, 118, 7, 113, 119 },
+	{ 12, "man", 104, 83, 121, 107, 5, 139, 115 },
+	{ 12, "man", 118, 85, 131, 106, 5, 147, 113 },
+	{ -2, "woman", 163, 84, 177, 111, 3, 150, 114 },
+	{ -2, "farmer", 183, 84, 200, 112, 5, 204, 120 },
+	{ 12, "gate", 46, 114, 130, 145, 0, 106, 126 },
+	{ 12, "display", 44, 55, 79, 72, 5, 100, 126 },
+	{ 12, "offices", 0, 54, 29, 130, 7, 86, 126 },
+	{ 12, "chairs", 57, 91, 131, 110, 5, 125, 121 },
+	{ 12, "chairs", 134, 84, 241, 107, 4, 181, 120 },
+	{ 13, "exit", 57, 57, 67, 73, 4, 65, 76 },
+	{ 13, "Pepe", 72, 55, 85, 83, 5, 98, 84 },
+	{ 13, "front desk", 73, 61, 95, 75, 4, 83, 79 },
+	{ 13, "hallway", 96, 53, 108, 75, 3, 99, 77 },
+	{ 13, "candle", 113, 70, 118, 74, 1, 97, 78 },
+	{ 13, "candle", 128, 81, 134, 87, 1, 108, 92 },
+	{ 13, "candle", 174, 102, 182, 110, 7, 187, 103 },
+	{ 13, "candle", 243, 93, 247, 99, 0, 246, 103 },
+	{ 13, "table", 102, 72, 154, 97, 2, 91, 88 },
+	{ 13, "table", 148, 101, 212, 116, 7, 192, 163 },
+	{ 13, "table", 218, 94, 275, 110, 0, 246, 103 },
+	{ 13, "stage", 150, 76, 299, 91, 4, 200, 102 },
+	{ 14, "loading dock", 290, 76, 319, 115, 4, 304, 109 },
+	{ 14, "car", 277, 116, 319, 149, 1, 306, 138 },
+	{ -2, "robot", 170, 72, 210, 121, 5, 254, 136 },
+	{ 14, "billboard", 144, 41, 224, 62, 5, 253, 135 },
+	{ -2, "billboard", 144, 41, 224, 62, 5, 253, 135 },
+	{ 14, "bench", 43, 78, 73, 90, 7, 101, 102 },
+	{ 14, "entrance", 99, 63, 120, 97, 3, 106, 101 },
+	{ 15, "receptionist", 125, 56, 140, 69, 5, 151, 84 },
+	{ 15, "front desk", 108, 57, 159, 76, 4, 131, 83 },
+	{ 15, "sign", 53, 62, 58, 66, 5, 61, 85 },
+	{ 15, "door", 49, 57, 60, 81, 4, 61, 85 },
+	{ 15, "sign", 172, 59, 183, 71, 4, 178, 84 },
+	{ 15, "pictures", 229, 46, 319, 72, 2, 194, 84 },
+	{ 15, "door", 210, 56, 216, 73, 3, 208, 75 },
+	{ 15, "T.V.", 261, 102, 303, 130, 1, 117, 90 },
+	{ 15, "magazines", 175, 89, 197, 106, 0, 188, 87 },
+	{ 15, "trophies", 0, 29, 36, 76, 4, 8, 109 },
+	{ 15, "front door", 0, 77, 24, 126, 6, 4, 108 },
+	{ 16, "door", 92, 46, 108, 70, 4, 101, 78 },
+	{ 16, "clothes rack", 110, 59, 128, 83, 4, 117, 89 },
+	{ 16, "clothes rack", 142, 59, 159, 82, 4, 152, 89 },
+	{ 16, "magician's cape", 178, 58, 190, 82, 4, 185, 89 },
+	{ 16, "clothes rack", 166, 58, 189, 80, 4, 185, 89 },
+	{ 16, "top hat", 198, 58, 203, 63, 4, 205, 79 },
+	{ 16, "window", 223, 34, 239, 72, 3, 222, 82 },
+	{ 9, "exit", 251, 57, 270, 92, 3, 240, 100 },
+	{ 9, "Eugene", 86, 55, 108, 72, 5, 130, 93 },
+	{ 9, "man", 209, 57, 227, 94, 1, 180, 89 },
+	{ 9, "counter", 69, 72, 132, 88, 4, 109, 96 },
+	{ 9, "horror section", 141, 60, 154, 87, 3, 141, 90 },
+	{ 9, "comedy section", 166, 61, 184, 82, 4, 177, 89 },
+	{ 9, "new releases", 274, 51, 319, 123, 1, 219, 105 },
+	{ 9, "display", 105, 95, 197, 120, 0, 138, 96 },
+	{ 18, "exit", 43, 64, 62, 101, 4, 54, 105 },
+	{ 18, "loose tube", 67, 63, 79, 70, 4, 68, 104 },
+	{ 18, "pizza machine", 112, 76, 246, 94, 4, 166, 104 },
+	{ 18, "oven", 286, 70, 319, 126, 2, 220, 111 },
+	{ 18, "piece of pizza", 17, 94, 28, 98, 6, 52, 109 },
+	{ 19, "robot", 58, 72, 98, 121, 5, 142, 136 },
+	{ -2, "Gilligan", 273, 84, 293, 130, 2, 260, 130 },
+	{ 19, "store", 0, 43, 24, 118, 5, 15, 113 },
+	{ 19, "billboard", 32, 41, 112, 62, 5, 162, 123 },
+	{ -2, "billboard", 32, 41, 112, 62, 5, 162, 123 },
+	{ 19, "warehouse", 247, 51, 271, 67, 4, 256, 83 },
+	{ 19, "car", 284, 73, 319, 149, 1, 259, 136 },
+	{ -2, "man", 181, 70, 201, 117, 2, 156, 113 },
+	{ 20, "exit", 169, 71, 191, 98, 3, 177, 101 },
+	{ -2, "crate", 103, 84, 134, 112, 6, 151, 108 },
+	{ -2, "POTATO chip", 137, 107, 145, 113, 0, 141, 100 },
+	{ -2, "remains", 38, 93, 158, 118, 0, 130, 90 },
+	{ 20, "lockers", 142, 75, 162, 92, 4, 154, 98 },
+	{ 20, "clock", 131, 75, 136, 80, 4, 135, 98 },
+	{ 20, "munchies", 0, 47, 67, 149, 6, 82, 112 },
+	{ 20, "food", 146, 110, 319, 149, 0, 175, 115 },
+	{ 21, "foyer", 299, 49, 319, 149, 1, 335, 134 },
+	{ 21, "office", 0, 55, 17, 149, 6, -5, 134 },
+	{ 21, "mirror", 276, 64, 295, 89, 4, 289, 138 },
+	{ 21, "mirror", 21, 64, 59, 89, 4, 31, 138 },
+	{ 21, "torch", 90, 67, 99, 90, 4, 96, 138 },
+	{ 21, "torch", 218, 67, 227, 90, 4, 222, 138 },
+	{ 21, "pictures", 152, 46, 164, 83, 4, 159, 138 },
+	{ 22, "hallway", 294, 65, 319, 149, 1, 325, 136 },
+	{ 22, "map", 207, 85, 221, 93, 5, 241, 117 },
+	{ 22, "cabinet", 268, 71, 293, 103, 3, 270, 118 },
+	{ 22, "cabinet", 213, 51, 227, 70, 3, 214, 78 },
+	{ 22, "desk", 186, 74, 223, 95, 1, 180, 94 },
+	{ 22, "chairs", 125, 66, 155, 111, 7, 163, 91 },
+	{ 22, "bookshelf", 87, 38, 208, 59, 4, 163, 77 },
+	{ 22, "fireplace", 35, 77, 62, 101, 5, 63, 107 },
+	{ 22, "pictures", 36, 46, 54, 65, 6, 86, 99 },
+	{ 22, "wood", 14, 104, 33, 117, 5, 45, 121 },
+	{ 23, "exit", 226, 46, 255, 96, 3, 234, 102 },
+	{ 23, "man", 65, 60, 93, 87, 6, 173, 103 },
+	{ 23, "monitors", 17, 47, 98, 65, 6, 164, 102 },
+	{ 23, "audio controls", 108, 57, 146, 74, 5, 162, 100 },
+	{ 23, "desk", 91, 76, 153, 113, 6, 173, 103 },
+	{ -2, "opening", 58, 16, 146, 30, 0, 76, 132 },
+	{ -2, "opening", 170, 16, 257, 30, 0, 190, 132 },
+	{ -2, "opening", 0, 49, 39, 131, 6, 48, 136 },
+	{ -2, "opening", 67, 47, 139, 114, 4, 102, 129 },
+	{ -2, "opening", 177, 47, 249, 114, 4, 214, 129 },
+	{ -2, "opening", 278, 49, 319, 131, 2, 272, 137 },
+	{ -2, "opening", 58, 128, 147, 146, 1, 51, 132 },
+	{ 25, "opening", 0, 140, 319, 149, 0, 160, 138 },
+	{ -2, "opening", 79, 48, 118, 83, 4, 93, 95 },
+	{ -2, "opening", 289, 37, 319, 96, 2, 270, 80 },
+	{ 26, "opening", 0, 140, 319, 149, 0, 160, 138 },
+	{ -2, "opening", 63, 52, 86, 91, 4, 93, 95 },
+	{ -2, "opening", 183, 59, 208, 80, 2, 190, 90 },
+	{ 27, "opening", 0, 140, 319, 149, 0, 160, 138 },
+	{ -2, "opening", 274, 50, 316, 102, 2, 260, 95 },
+	{ -2, "opening", 75, 64, 96, 83, 6, 85, 95 },
+	{ 28, "giant lizard", 9, 38, 56, 94, 6, 156, 118 },
+	{ 28, "throne", 0, 14, 51, 117, 6, 156, 118 },
+	{ 28, "exit", 290, 36, 318, 96, 3, 299, 106 },
+	{ 28, "display case", 132, 75, 181, 94, 4, 156, 99 },
+	{ 28, "shield", 89, 59, 105, 76, 5, 145, 100 },
+	{ 28, "shield", 211, 59, 227, 77, 4, 221, 96 },
+	{ 29, "exit", 66, 13, 93, 61, 4, 82, 63 },
+	{ 29, "beaker of acid", 95, 82, 105, 93, 1, 89, 98 },
+	{ 29, "mad doctor", 171, 71, 189, 118, 3, 131, 131 },
+	{ 29, "monster", 141, 75, 160, 120, 3, 131, 131 },
+	{ 29, "covered body", 111, 71, 174, 88, 4, 138, 110 },
+	{ 29, "machinery", 127, 0, 251, 84, 4, 188, 114 },
+	{ 29, "door", 9, 39, 50, 109, 5, 53, 118 },
+	{ 31, "buzzer", 131, 107, 179, 127, 0, -1, -1 },
+	{ 31, "game board", 40, 13, 145, 86, 0, -1, -1 },
+	{ 31, "Bink", 173, 31, 201, 72, 0, -1, -1 },
+	{ 31, "Merrill", 237, 34, 266, 77, 0, -1, -1 },
+	{ 31, "Dyanne", 288, 33, 319, 97, 0, -1, -1 },
+	{ 32, "elevator", 190, 59, 228, 113, 4, 204, 122 },
+	{ 32, "door", 12, 68, 29, 119, 6, 45, 119 },
+	{ -2, "janitor", 261, 83, 275, 120, 3, 243, 127 },
+	{ -2, "plungers", 293, 94, 306, 102, 5, 308, 120 },
+	{ -2, "cart", 270, 87, 305, 119, 3, 258, 128 },
+	{ 32, "plaque", 2, 87, 12, 93, 6, 25, 125 },
+	{ -2, "office", 0, 64, 29, 123, 6, 22, 119 },
+	{ 32, "door", 51, 73, 59, 95, 6, 63, 94 },
+	{ 33, "hallway", 134, 0, 319, 144, 0, 220, 120 },
+	{ 33, "memo", 60, 100, 70, 103, 0, 76, 115 },
+	{ 33, "computer", 30, 89, 46, 102, 7, 49, 113 },
+	{ 33, "charts", 64, 65, 110, 86, 4, 86, 114 },
+	{ 33, "desk", 23, 99, 103, 114, 0, 66, 112 },
+	{ 33, "cabinet", 18, 73, 41, 96, 4, 45, 113 },
+	{ 34, "exit", 138, 48, 178, 83, 4, 158, 90 },
+	{ 34, "man", 198, 67, 217, 115, 2, 169, 100 },
+	{ -2, "passcard", 96, 72, 101, 83, 6, 108, 107 },
+	{ -2, "lunch box", 94, 86, 100, 94, 6, 108, 107 },
+	{ -2, "locker", 94, 60, 102, 105, 6, 108, 107 },
+	{ 34, "lockers", 46, 58, 117, 104, 6, 138, 108 },
+	{ 35, "exit", 4, 48, 46, 100, 5, 35, 111 },
+	{ 35, "Cassandra", 178, 67, 198, 101, 5, 217, 112 },
+	{ 35, "jail cells", 154, 56, 319, 102, 4, 242, 121 },
+	{ 35, "desk", 91, 85, 132, 104, 4, 110, 119 },
+	{ 35, "key rack", 93, 72, 118, 82, 5, 124, 115 },
+	{ 35, "television", 281, 114, 318, 141, 1, 280, 112 },
+	{ 35, "television", 178, 114, 217, 143, 0, 197, 113 },
+	{ 35, "television", 58, 80, 73, 92, 5, 83, 111 },
+	{ 36, "exit", 291, 37, 319, 109, 2, 290, 115 },
+	{ 36, "lunch box", 266, 99, 277, 109, 3, 261, 112 },
+	{ 36, "sleeping guard", 255, 77, 274, 105, 3, 239, 108 },
+	{ 36, "satellite dish", 25, 38, 110, 122, 6, 126, 123 },
+	{ 36, "satellite dish", 173, 50, 209, 94, 3, 162, 102 },
+	{ 37, "ladder", 109, 0, 124, 67, 6, 129, 65 },
+	{ 37, "ladder", 191, 12, 206, 138, 2, 190, 65 },
+	{ -2, "money", 104, 103, 132, 121, 5, 135, 138 },
+	{ -2, "keys", 100, 94, 106, 100, 5, 135, 138 },
+	{ -2, "magazines", 109, 90, 132, 113, 5, 135, 138 },
+	{ -2, "handle", 127, 100, 132, 110, 5, 135, 138 },
+	{ -2, "lock", 108, 96, 125, 113, 5, 135, 138 },
+	{ -2, "safe", 94, 84, 138, 128, 4, 115, 138 },
+	{ -2, "ladder", 191, 12, 206, 138, 3, 185, 144 },
+	{ 30, "exit", 105, 137, 319, 149, 0, 221, 140 },
+	{ 30, "camera", 111, 60, 137, 85, 7, 145, 72 },
+	{ 30, "camera", 257, 68, 275, 91, 1, 248, 73 },
+	{ 30, "stage", 122, 47, 306, 86, 0, 214, 65 },
+	{ 17, "exit", 273, 50, 318, 102, 2, 267, 110 },
+	{ 17, "guard", 47, 77, 61, 106, 4, 85, 119 },
+	{ 17, "guard", 110, 78, 122, 107, 4, 85, 119 },
+	{ 17, "symbol", 26, 99, 136, 127, 6, 137, 114 },
+	{ 38, "exit", 289, 38, 319, 97, 3, 295, 107 },
+	{ -2, "Cassandra", 219, 97, 235, 144, 0, 227, 90 },
+	{ 38, "rag", 157, 9, 166, 21, 7, 221, 104 },
+	{ 38, "equipment", 101, 50, 180, 114, 5, 208, 122 },
+	{ 38, "speaker", 30, 65, 47, 100, 5, 66, 130 },
+	{ 38, "guard", 0, 67, 16, 107, 6, 74, 128 },
+	{ 38, "guard", 54, 62, 68, 93, 4, 61, 128 },
+	{ 38, "pipes", 62, 8, 290, 42, 4, 255, 123 },
+	{ 38, "hypno-board", 4, 36, 54, 84, 5, 111, 132 },
+	{ 39, "exit", 279, 50, 319, 131, 2, 273, 135 },
+	{ 39, "hinges", 125, 58, 137, 105, 3, 97, 135 },
+	{ 39, "locks", 169, 51, 200, 122, 5, 223, 137 },
+	{ 39, "door", 123, 46, 191, 121, 4, 158, 136 },
+	{ -2, "exit", 124, 47, 179, 118, 4, 154, 125 }
+};
+
+} // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index c4bf72eacf4..be2c8b65d79 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -486,12 +486,12 @@ void WaynesWorldEngine::rememberFirstObjectName(int objectId) {
             inventoryItemQuantity = _garthInventory[inventoryIndex];
         }
         if (inventoryItemQuantity == 1) {
-            _firstObjectName = "TODO";//getRoomObjectName(objectId);
+            _firstObjectName = getRoomObjectName(objectId);
         } else {
-            _firstObjectName = "TODO";//Common::String::format("%d %s", inventoryItemQuantity, getRoomObjectName(objectId));
+            _firstObjectName = Common::String::format("%d %s", inventoryItemQuantity, getRoomObjectName(objectId));
         }
     } else {
-        _firstObjectName = "TODO";//getRoomObjectName(objectId);
+        _firstObjectName = getRoomObjectName(objectId);
     }
 }
 
@@ -522,7 +522,7 @@ void WaynesWorldEngine::drawInventory() {
     int iconY = 0;
     _inventorySprite->clear(0);
     for (int inventoryItemIndex = 0; inventoryItemIndex < 50; inventoryItemIndex++) {
-        int objectRoomNumber = 0; // TODO getObjectRoom(inventoryItemIndex + 28);
+        int objectRoomNumber = getObjectRoom(inventoryItemIndex + 28);
         if ((_currentActorNum != 0 && objectRoomNumber == 99 && _wayneInventory[inventoryItemIndex] > 0) ||
             (_currentActorNum == 0 && objectRoomNumber == 99 && _garthInventory[inventoryItemIndex] > 0)) {
             Common::String filename = Common::String::format("m03/icon%02d", inventoryItemIndex + 1);
@@ -719,6 +719,10 @@ void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int co
     // sysMouseDriver(1)
 }
 
+bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction, int actor2_destX, int actor2_destY) {
+	// TODO
+}
+
 void WaynesWorldEngine::openRoomLibrary(int roomNum) {
     _roomName = Common::String::format("r%02d", roomNum);
 }
@@ -753,6 +757,10 @@ void WaynesWorldEngine::changeRoomScrolling() {
 	// TODO
 }
 
+void WaynesWorldEngine::loadScrollSprite() {
+	// TODO
+}
+
 void WaynesWorldEngine::loadRoomMask(int roomNum) {
 	// TODO
 }
@@ -774,16 +782,73 @@ void WaynesWorldEngine::drawStaticRoomObjects(int roomNumber, int x, int y, int
 }
 
 void WaynesWorldEngine::moveObjectToRoom(int objectId, int roomNum) {
-	// TODO
+    _roomObjects[objectId].roomNumber = roomNum;
+    if (objectId <= 77) {
+        int inventoryIndex = objectId - 28;
+        if (_currentActorNum != 0) {
+            _wayneInventory[inventoryIndex]++;
+        } else {
+            _garthInventory[inventoryIndex]++;
+        }
+    }
 }
 
 void WaynesWorldEngine::moveObjectToNowhere(int objectId) {
-	// TODO
+    if (objectId <= 77) {
+        int inventoryIndex = objectId - 28;
+        if (_currentActorNum != 0) {
+            _wayneInventory[inventoryIndex]--;
+        } else {
+            _garthInventory[inventoryIndex]--;
+        }
+        if (_wayneInventory[inventoryIndex] == 0 && _garthInventory[inventoryIndex] == 0) {
+            _roomObjects[objectId].roomNumber = -2;
+        }
+    } else {
+        _roomObjects[objectId].roomNumber = -2;
+    }
+}
+
+const RoomObject *WaynesWorldEngine::getRoomObject(int objectId) {
+    return &_roomObjects[objectId];
+}
+
+const char *WaynesWorldEngine::getRoomObjectName(int objectId) {
+    return _roomObjects[objectId].name;
+}
+
+int WaynesWorldEngine::getObjectRoom(int objectId) {
+    return _roomObjects[objectId].roomNumber;
 }
 
 int WaynesWorldEngine::getObjectDirection(int objectId) {
-	// TODO
-	return 0;
+    return _roomObjects[objectId].direction;
+}
+
+int WaynesWorldEngine::findRoomObjectIdAtPoint(int x, int y) {
+    for (uint index = 0; index < kRoomObjectsCount; index++) {
+        const RoomObject *roomObject = getRoomObject(_hoverObjectNumber);
+        if (roomObject->roomNumber == _currentRoomNumber &&
+            x >= roomObject->x1 && x <= roomObject->x2 &&
+            y >= roomObject->y1 && y <= roomObject->y2) {
+            return (int)index;
+        }
+    }
+    return -1;
+}
+
+void WaynesWorldEngine::walkToObject() {
+    loadScrollSprite();
+    if (_hoverObjectNumber == -2) {
+        walkTo(_garthSpriteX, _garthSpriteY, _actorSpriteValue, -1, -1);
+    } else if (_hoverObjectNumber == -3) {
+        walkTo(_wayneSpriteX, _wayneSpriteY, _actorSpriteValue, -1, -1);
+    } else if (_hoverObjectNumber > 77) {
+        const RoomObject *roomObject = getRoomObject(_hoverObjectNumber);
+        walkTo(roomObject->walkX, roomObject->walkY, roomObject->direction, -1, -1);
+    } else {
+        refreshActors();
+    }
 }
 
 void WaynesWorldEngine::startDialog() {
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 5a160ba7eaa..3012bfd3573 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -49,6 +49,16 @@ enum {
 class Screen;
 class WWSurface;
 
+struct RoomObject {
+    int roomNumber;
+    const char *name;
+    int x1, y1, x2, y2;
+    int direction;
+    int walkX, walkY;
+};
+
+const uint kRoomObjectsCount = 404;
+
 class WaynesWorldEngine : public Engine {
 protected:
 	Common::Error run() override;
@@ -125,6 +135,11 @@ public:
 	int _selectedDialogChoice;
 	int _dialogChoices[5];
 
+	// Room objects
+	static const RoomObject kRoomObjects[kRoomObjectsCount];
+	// _roomObjects is a writable copy of kRoomObjects
+	RoomObject _roomObjects[kRoomObjectsCount];
+
 	// Utils
 	int getRandom(int max);
 	void waitMillis(uint millis);
@@ -179,6 +194,7 @@ public:
 	void refreshActors();
 	void pickupObject(int objectId, byte &flags, byte flagsSet, int inventoryObjectId);
 	void playAnimation(const char *prefix, int startIndex, int count, int x, int y, int flag, uint ticks);
+	bool walkTo(int actor1_destX, int actor1_destY, int direction, int actor2_destX, int actor2_destY);
 
 	// Room
 	void openRoomLibrary(int roomNum);
@@ -186,6 +202,7 @@ public:
 	void changeRoom(int roomNum);
 	void refreshRoomBackground(int roomNum);
 	void changeRoomScrolling();
+	void loadScrollSprite();
 	void loadRoomMask(int roomNum);
 
 	void updateRoomAnimations(bool doUpdate);
@@ -197,7 +214,12 @@ public:
 	// Room objects
 	void moveObjectToRoom(int objectId, int roomNum);
 	void moveObjectToNowhere(int objectId);
+	const RoomObject *getRoomObject(int objectId);
+	const char *getRoomObjectName(int objectId);
+	int getObjectRoom(int objectId);
 	int getObjectDirection(int objectId);
+	int findRoomObjectIdAtPoint(int x, int y);
+	void walkToObject();
 
 	// Dialog
 	void startDialog();


Commit: b2991bcca780170ed9afe9f956183b8d691e0aee
    https://github.com/scummvm/scummvm/commit/b2991bcca780170ed9afe9f956183b8d691e0aee
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:49+01:00

Commit Message:
WAYNESWORLD: Set mouse cursor

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index be2c8b65d79..ea2506c7f9a 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -73,6 +73,7 @@ Common::Error WaynesWorldEngine::run() {
 	_isSaveAllowed = false;
 
 	initGraphics(320, 200);
+	initMouseCursor();
 	_screen = new Screen();
 	_backgroundSurface = new WWSurface(320, 150);
 
@@ -101,6 +102,8 @@ Common::Error WaynesWorldEngine::run() {
 
 	openRoomLibrary(6);
 
+	CursorMan.showMouse(true);
+
 	while (!shouldQuit()) {
 		updateEvents();
 		// _screen->clear(0);
@@ -182,6 +185,25 @@ void WaynesWorldEngine::waitSeconds(uint seconds) {
 	// Replace calls with waitMillis
 }
 
+void WaynesWorldEngine::initMouseCursor() {
+	const uint kCursorWidth = 9;
+	const uint kCursorHeight = 9;
+	const uint kCursorHotspotX = 4;
+	const uint kCursorHotspotY = 4;
+	static const byte kCursorData[kCursorWidth * kCursorHeight] = {
+		0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+		0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 
+		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 
+		0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
+	};
+	CursorMan.replaceCursor(kCursorData, kCursorWidth, kCursorHeight, kCursorHotspotX, kCursorHotspotY, 0);
+}
+
 Image::PCXDecoder *WaynesWorldEngine::loadImage(const char *filename, bool appendRoomName) {
 	Common::String tempFilename = appendRoomName
 		? Common::String::format("%s/%s.pcx", _roomName.c_str(), filename)
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 3012bfd3573..151a08f1390 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -145,6 +145,8 @@ public:
 	void waitMillis(uint millis);
 	void waitSeconds(uint seconds);
 
+	void initMouseCursor();
+
 	// Image loading
 	Image::PCXDecoder *loadImage(const char *filename, bool appendRoomName);
 	WWSurface *loadSurfaceIntern(const char *filename, bool appendRoomName);


Commit: fd9bfe27861ca505dd09d4ab68ac330f9c4e8099
    https://github.com/scummvm/scummvm/commit/fd9bfe27861ca505dd09d4ab68ac330f9c4e8099
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:49+01:00

Commit Message:
WAYNESWORLD: Add mouse move/click methods

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index ea2506c7f9a..1567f671be1 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -204,6 +204,172 @@ void WaynesWorldEngine::initMouseCursor() {
 	CursorMan.replaceCursor(kCursorData, kCursorWidth, kCursorHeight, kCursorHotspotX, kCursorHotspotY, 0);
 }
 
+bool WaynesWorldEngine::isPointAtWayne(int x, int y) {
+    int x1 = _wayneSpriteX - (_wayneActorScale * 13) / 100;
+    int x2 = _wayneSpriteX + (_wayneActorScale * 13) / 100;
+    int y1 = _wayneSpriteY - (_wayneActorScale * 48) / 100;
+    int y2 = _wayneSpriteY;
+    return x >= x1 && y >= y1 && x <= x2 && y <= y2;
+}
+
+bool WaynesWorldEngine::isPointAtGarth(int x, int y) {
+    int x1 = _garthSpriteX - (_garthActorScale * 13) / 100;
+    int x2 = _garthSpriteX + (_garthActorScale * 13) / 100;
+    int y1 = _garthSpriteY - (_garthActorScale * 48) / 100;
+    int y2 = _garthSpriteY;
+    return x >= x1 && y >= y1 && x <= x2 && y <= y2;
+}
+
+void WaynesWorldEngine::updateMouseMove() {
+
+    // Yet unknown
+    if (_gameState == 4)
+        return;
+
+    // Dialog
+    if (_gameState == 2) {
+        int newDialogChoiceIndex = -10;
+        if (_mouseY > 186) {
+            newDialogChoiceIndex = -15;
+        } else if (_mouseY > 177) {
+            newDialogChoiceIndex = -14;
+        } else if (_mouseY > 168) {
+            newDialogChoiceIndex = -13;
+        } else if (_mouseY > 159) {
+            newDialogChoiceIndex = -12;
+        } else if (_mouseY > 150) {
+            newDialogChoiceIndex = -11;
+        }
+        if (_selectedDialogChoice != newDialogChoiceIndex) {
+            drawDialogChoices(newDialogChoiceIndex);
+        }
+        return;
+    }
+
+    // Unused ticket
+    if (_gameState == 3) {
+        // TODO unusedTicketHandleMouseMove();
+        return;
+    }
+
+    // Inventory
+    if (_gameState == 0 && _inventoryItemsCount > 0 && _mouseX < 312) {
+        int inventorySlotIndex = _mouseY / 20 * 12 + _mouseX / 26;
+        if (inventorySlotIndex < _inventoryItemsCount) {
+            int inventoryObjectId = _inventoryItemsObjectMap[inventorySlotIndex];
+            int itemCount;
+            if (_currentActorNum != 0) {
+                itemCount = _wayneInventory[inventoryObjectId - 28];
+            } else {
+                itemCount = _garthInventory[inventoryObjectId - 28];
+            }
+            const char *roomObjectName = getRoomObjectName(inventoryObjectId);
+            char objectName[32];
+            if (itemCount == 1) {
+                sprintf(objectName, "%s", roomObjectName);
+            } else {
+                sprintf(objectName, "%d %ss", itemCount, roomObjectName);
+            }
+            drawVerbLine(_verbNumber, inventoryObjectId, objectName);
+            return;
+        }
+    }
+
+    // Wayne and Garth
+    if (_gameState == 0 && _currentActorNum != 0 && isPointAtGarth(_mouseX, _mouseY)) {
+        drawVerbLine(_verbNumber, -3, "Garth");
+    } else if (_gameState == 0 && _currentActorNum == 0 && isPointAtWayne(_mouseX, _mouseY)) {
+        drawVerbLine(_verbNumber, -2, "Wayne");
+    } else {
+        // Room objects
+        int objectIdAtPoint = findRoomObjectIdAtPoint(_mouseX, _mouseY);
+        if (_gameState == 0) {
+            if (objectIdAtPoint != -1) {
+                drawVerbLine(_verbNumber, objectIdAtPoint, getRoomObjectName(objectIdAtPoint));
+            } else {
+                drawVerbLine(_verbNumber, -1, 0);
+            }
+        } else if (_gameState == 1) {
+            // TODO gameMapHandleMouseMove(objectIdAtPoint);
+        }
+    }
+
+}
+
+void WaynesWorldEngine::handleMouseClick() {
+    if (_mouseClickButtons & 1) {
+        handleMouseLeftClick();
+    }
+    if (_mouseClickButtons & 2) {
+        handleMouseRightClick();
+    }
+    if (_mouseClickButtons & 4) {
+        // TODO handleKeyInput();
+    }
+}
+
+void WaynesWorldEngine::handleMouseLeftClick() {
+    switch (_gameState) {
+    case 0:
+        if (_mouseClickY < 150) {
+            _objectNumber = _hoverObjectNumber;
+            if (_objectNumber != -1) {
+                walkToObject();
+                handleVerb(1);
+            } else {
+                walkTo(_mouseClickX, _mouseClickY, -1, -1, -1);
+            }
+        } else if (_mouseClickX > 2 && _mouseClickX < 315 && _mouseClickY > 164) {
+            selectVerbNumber(_mouseClickX);
+        }
+        break;
+    case 1:
+        // TODO gameMapHandleMouseClick();
+        break;
+    case 2:
+        handleDialogMouseClick();
+        break;
+    case 3:
+        // TODO unusedTicketHandleMouseClick();
+        break;
+    case 4:
+        // TODO handleMouseClickState4();
+        break;
+    case 5:
+        // TODO handleMouseClickState5();
+        break;
+    }
+}
+
+void WaynesWorldEngine::handleMouseRightClick() {
+    switch (_gameState) {
+    case 0:
+        if (_mouseClickX > 2 && _mouseClickX < 268 && _mouseClickY > 164) {
+            selectVerbNumber2(_mouseClickX);
+        } else if (_hoverObjectNumber != -1) {
+            _objectNumber = _hoverObjectNumber;
+            walkToObject();
+            handleVerb(2);
+        }
+        break;
+    case 1:
+        // TODO gameMapHandleMouseClick();
+        break;
+    case 2:
+        handleDialogMouseClick();
+        break;
+    case 3:
+        // TODO unusedTicketHandleMouseClick();
+        break;
+    case 4:
+        // TODO handleMouseClickState4();
+        break;
+    case 5:
+        // TODO handleMouseClickState5();
+        break;
+    }
+}
+
 Image::PCXDecoder *WaynesWorldEngine::loadImage(const char *filename, bool appendRoomName) {
 	Common::String tempFilename = appendRoomName
 		? Common::String::format("%s/%s.pcx", _roomName.c_str(), filename)
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 151a08f1390..74a6b73ee5d 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -105,7 +105,7 @@ public:
 	bool _isTextVisible;
 
 	// Game
-	int _gameState;
+	int _gameState; // TODO Use enum
 	int _currentActorNum;
 	int _currentRoomNumber;
 	int _verbNumber;
@@ -145,7 +145,14 @@ public:
 	void waitMillis(uint millis);
 	void waitSeconds(uint seconds);
 
+	// Input handling
 	void initMouseCursor();
+	bool isPointAtWayne(int x, int y);
+	bool isPointAtGarth(int x, int y);
+	void updateMouseMove();
+	void handleMouseClick();
+	void handleMouseLeftClick();
+	void handleMouseRightClick();
 
 	// Image loading
 	Image::PCXDecoder *loadImage(const char *filename, bool appendRoomName);


Commit: 95ecef9e2b311b5a994e462f10cbd0a8d6edeb32
    https://github.com/scummvm/scummvm/commit/95ecef9e2b311b5a994e462f10cbd0a8d6edeb32
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:49+01:00

Commit Message:
WAYNESWORLD: Implement pathfinding

Changed paths:
  A engines/waynesworld/pathfinding.cpp
    engines/waynesworld/module.mk
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/module.mk b/engines/waynesworld/module.mk
index de7860ec6aa..ea93f456591 100644
--- a/engines/waynesworld/module.mk
+++ b/engines/waynesworld/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS := \
 	waynesworld.o \
 	detection.o \
 	graphics.o \
+	pathfinding.o \
 	staticdata.o
 
 # This module can be built as a plugin
diff --git a/engines/waynesworld/pathfinding.cpp b/engines/waynesworld/pathfinding.cpp
new file mode 100644
index 00000000000..32557b72681
--- /dev/null
+++ b/engines/waynesworld/pathfinding.cpp
@@ -0,0 +1,484 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "waynesworld/waynesworld.h"
+
+namespace WaynesWorld {
+
+bool WaynesWorldEngine::walkIsPixelWalkable(int x, int y) {
+	if (x < 0 || y < 0 || x >= 320 || y >= 150)
+		return false;
+	return (_walkMap[(y * 40) + (x / 8)] & (0x80 >> (x % 8))) != 0;
+}
+
+bool WaynesWorldEngine::walkAdjustDestPoint(int &x, int &y) {
+    if (walkIsPixelWalkable(x, y))
+        return true;
+    for (int incr = 1; incr < 200; incr++) {
+        for (int xc = 0; xc <= incr; xc++) {
+            if (y + incr < 150) {
+                if (walkIsPixelWalkable(x + xc, y + incr)) {
+                    x += xc;
+                    y += incr;
+                    return true;
+                }
+                if (walkIsPixelWalkable(x - xc, y + incr)) {
+                    x -= xc;
+                    y += incr;
+                    return true;
+                }
+            } else if (y - incr >= 0) {
+                if (walkIsPixelWalkable(x + xc, y - incr)) {
+                    x += xc;
+                    y -= incr;
+                    return true;
+                }
+                if (walkIsPixelWalkable(x - xc, y - incr)) {
+                    x -= xc;
+                    y -= incr;
+                    return true;
+                }
+            }
+        }
+        for (int yc = 0; yc <= incr - 1; yc++) {
+            if (x + incr < 320) {
+                if (walkIsPixelWalkable(x + incr, y + yc)) {
+                    x += incr;
+                    y += yc;
+                    return true;
+                }
+                if (walkIsPixelWalkable(x + incr, y - yc)) {
+                    x += incr;
+                    y -= yc;
+                    return true;
+                }
+            } else if (x + incr >= 0) {
+                if (walkIsPixelWalkable(x - incr, y + yc)) {
+                    x -= incr;
+                    y += yc;
+                    return true;
+                }
+                if (walkIsPixelWalkable(x - incr, y - yc)) {
+                    x -= incr;
+                    y -= yc;
+                    return true;
+                }
+            }
+        }
+    }
+    return false;
+}
+
+void WaynesWorldEngine::walkCalcOtherActorDest(int flag, int &x, int &y) {
+    int direction;
+    if (flag == 1) {
+        direction = walkCalcDirection(x - _garthSpriteX, y - _garthSpriteY);
+    } else {
+        direction = walkCalcDirection(x - _wayneSpriteX, y - _wayneSpriteY);
+    }
+    int actorScale = getActorScaleFromY(y);
+    int actorDistance = (actorScale * 20) / 100;
+    switch (direction) {
+    case 0:
+        y += actorDistance;
+    case 1:
+        x += actorDistance;
+        break;
+    case 2:
+        x += actorDistance;
+    case 3:
+        y -= actorDistance;
+        break;
+    case 4:
+        y -= actorDistance;
+    case 5:
+        x -= actorDistance;
+        break;
+    case 6:
+        x -= actorDistance;
+    case 7:
+        y += actorDistance;
+        break;
+    }
+    walkAdjustDestPoint(x, y);
+}
+
+int WaynesWorldEngine::walkCalcPath(int flag, int sourceX, int sourceY, int destX, int destY, int pointsCount) {
+    if (pointsCount >= 300)
+        return 299;
+
+    if (walkIsLineWalkable(sourceX, sourceY, destX, destY))
+        return walkAddWalkLine(flag, sourceX, sourceY, destX, destY, pointsCount);
+
+    int nextSourceX, nextSourceY;
+
+    walkGetNextPoint(sourceX, sourceY, destX, destY, nextSourceX, nextSourceY);
+
+    bool walkable = walkFindPoint(flag, sourceX, sourceY, nextSourceX, nextSourceY, destX, destY, pointsCount);
+    while (!walkable) {
+        walkGetNextPoint(sourceX, sourceY, nextSourceX, nextSourceY, nextSourceX, nextSourceY);
+        if (ABS(sourceX - nextSourceX) < 3 && ABS(sourceY - nextSourceY) < 3) {
+            return pointsCount;
+        }
+        walkable = walkFindPoint(flag, sourceX, sourceY, nextSourceX, nextSourceY, destX, destY, pointsCount);
+    }
+
+    pointsCount = walkAddWalkLine(flag, sourceX, sourceY, nextSourceX, nextSourceY, pointsCount);
+
+    sourceX = nextSourceX;
+    sourceY = nextSourceY;
+    pointsCount = walkCalcPath(flag, sourceX, sourceY, destX, destY, pointsCount);
+
+    return pointsCount;
+}
+
+bool WaynesWorldEngine::walkFindPoint(int flag, int &sourceX, int &sourceY, int &nextSourceX, int &nextSourceY, int destX, int destY, int pointsCount) {
+    bool walkable = false;
+
+    if (walkIsLineWalkable(sourceX, sourceY, nextSourceX, nextSourceY))
+        return true;
+
+    float slopeX;
+
+    if (sourceX == nextSourceX) {
+        slopeX = 0.0f;
+    } else if (sourceY == nextSourceY) {
+        slopeX = 100.0f;
+    } else {
+        slopeX = -(float(sourceX - nextSourceX) / float(sourceY - nextSourceY));
+    }
+
+    int scan1X = sourceX, scan1Y = sourceY;
+    int scan2X = nextSourceX, scan2Y = nextSourceY;
+    bool scan1Done = false;
+    int scan1Incr = 0;
+
+    while (!walkable && !scan1Done) {
+        scan1Done = true;
+        int scan1Sign = -1;
+        while (scan1Sign < 2 && !walkable) {
+            if (ABS(slopeX) >= 1.0f) {
+                float slopeY = 1.0f / slopeX;
+                scan1Y = sourceY + scan1Incr * scan1Sign;
+                scan1X = sourceX + (scan1Y - sourceY) * slopeY;
+            } else {
+                scan1X = sourceX + scan1Incr * scan1Sign;
+                scan1Y = sourceY + (scan1X - sourceX) * slopeX;
+            }
+            if (scan1X >= 0 && scan1X < 320 && scan1Y >= 0 && scan1Y < 150) {
+                scan1Done = false;
+                bool scan2Done = false;
+                int scan2Incr = 0;
+                while (!walkable && !scan2Done) {
+                    scan2Done = true;
+                    int scan2Sign = -1;
+                    while (scan2Sign < 2 && !walkable) {
+                        if (ABS(slopeX) >= 1.0f) {
+                            float slopeY = 1.0f / slopeX;
+                            scan2Y = nextSourceY + scan2Incr * scan2Sign;
+                            scan2X = nextSourceX + (scan2Y - nextSourceY) * slopeY;
+                        } else {
+                            scan2X = nextSourceX + scan2Incr * scan2Sign;
+                            scan2Y = nextSourceY + (scan2X - nextSourceX) * slopeX;
+                        }
+                        if (scan2X >= 0 && scan2X < 320 && scan2Y >= 0 && scan2Y < 150) {
+                            scan2Done = false;
+                            walkable = walkIsLineWalkable(scan1X, scan1Y, scan2X, scan2Y) && walkTestPoint(scan1X, scan1Y, scan2X, scan2Y, destX, destY);
+                        }
+                        scan2Sign += 2;
+                    }
+                    scan2Incr += 4;
+                }
+            }
+            scan1Sign += 2;
+        }
+        scan1Incr += 4;
+    }
+
+    if (scan1Done)
+        return false;
+
+    if (sourceX != scan1X || sourceY != scan1Y) {
+        if (!walkTestPoint(sourceX, sourceY, scan1X, scan1Y, destX, destY)) {
+            return false;
+		}
+        pointsCount = walkAddWalkLine(flag, sourceX, sourceY, scan1X, scan1Y, pointsCount);
+        sourceX = scan1X;
+        sourceY = scan1Y;
+    }
+
+    nextSourceX = scan2X;
+    nextSourceY = scan2Y;
+
+    return true;
+}
+
+bool WaynesWorldEngine::walkTestPoint(int sourceX, int sourceY, int nextSourceX, int nextSourceY, int destX, int destY) {
+    return ABS(destY - nextSourceY) < ABS(destY - sourceY) || ABS(destX - nextSourceX) < ABS(destX - sourceX);
+}
+
+bool WaynesWorldEngine::walkIsLineWalkable(int sourceX, int sourceY, int destX, int destY) {
+    bool walkable = true;
+    if (sourceX == destX) {
+        const int incr = sourceY > destY ? -4 : 4;
+        for (int yc = sourceY; yc * incr < destY * incr && walkable; yc += incr) {
+            if (!walkIsPixelWalkable(sourceX, yc)) {
+                walkable = false;
+            }
+        }
+    } else if (ABS(sourceY - destY) >= ABS(sourceX - destX)) {
+        const float slopeY = float(sourceX - destX) / float(sourceY - destY);
+        const int incr = sourceY > destY ? -4 : 4;
+        for (int yc = sourceY; yc * incr < destY * incr && walkable; yc += incr) {
+            if (!walkIsPixelWalkable(sourceX + (yc - sourceY) * slopeY, yc)) {
+                walkable = false;
+            }
+        }
+    } else {
+        const float slopeX = float(sourceY - destY) / float(sourceX - destX);
+        const int incr = sourceX > destX ? -4 : 4;
+        for (int xc = sourceX; xc * incr < destX * incr && walkable; xc += incr) {
+            if (!walkIsPixelWalkable(xc, sourceY + (xc - sourceX) * slopeX)) {
+                walkable = false;
+            }
+        }
+    }
+    if (!walkIsPixelWalkable(destX, destY)) {
+        walkable = false;
+    }
+    return walkable;
+}
+
+void WaynesWorldEngine::walkGetNextPoint(int sourceX, int sourceY, int destX, int destY, int &nextX, int &nextY) {
+    nextX = (sourceX + destX) / 2;
+    nextY = (sourceY + destY) / 2;
+}
+
+int WaynesWorldEngine::walkCalcDirection(int deltaX, int deltaY) {
+    int direction = 0;
+    if (deltaY < 0) {
+        if (deltaX < 0) {
+            if (deltaX * 2 > deltaY) {
+                direction = 0;
+            } else if (deltaY * 2 > deltaX) {
+                direction = 2;
+            } else {
+                direction = 1;
+            }
+        } else {
+            if (deltaX * -2 > deltaY) {
+                direction = 0;
+            } else if (deltaY * -2 < deltaX) {
+                direction = 6;
+            } else {
+                direction = 7;
+            }
+        }
+    } else {
+        if (deltaX < 0) {
+            if (deltaX * -2 < deltaY) {
+                direction = 4;
+            } else if (deltaY * -2 > deltaX) {
+                direction = 2;
+            } else {
+                direction = 3;
+            }
+        } else {
+            if (deltaX * 2 < deltaY) {
+                direction = 4;
+            } else if (deltaY * 2 < deltaX) {
+                direction = 6;
+            } else {
+                direction = 5;
+            }
+        }
+    }
+    return direction;
+}
+
+int WaynesWorldEngine::walkAddWalkLine(int flag, int x1, int y1, int x2, int y2, int pointsCount) {
+    WalkPoint *walkPoints = flag == 0 ? _wayneWalkPoints : _garthWalkPoints;
+    int newDirection = walkCalcDirection(x1 - x2, y1 - y2);
+	// debug("walkAddWalkLine() %d, %d, %d, %d", x1, y1, x2, y2);
+
+    if (pointsCount == 0 || walkPoints[pointsCount - 1].x != x1 || walkPoints[pointsCount - 1].y != y1) {
+        walkPoints[pointsCount].x = x1;
+        walkPoints[pointsCount].y = y1;
+        walkPoints[pointsCount].direction = newDirection;
+        pointsCount++;
+    }
+
+    if (x1 == x2) {
+        const int incr = y1 > y2 ? -4 : 4;
+        for (int yc = y1; yc * incr < y2 * incr; yc += incr) {
+            walkPoints[pointsCount].x = x1;
+            walkPoints[pointsCount].y = yc;
+            walkPoints[pointsCount].direction = newDirection;
+            pointsCount++;
+        }
+    } else if (ABS(y1 - y2) >= ABS(x1 - x2)) {
+        const float slopeY = float(x1 - x2) / float(y1 - y2);
+        const int incr = y1 > y2 ? -4 : 4;
+        for (int yc = y1; yc * incr < y2 * incr; yc += incr) {
+            walkPoints[pointsCount].x = x1 + (yc - y1) * slopeY;
+            walkPoints[pointsCount].y = yc;
+            walkPoints[pointsCount].direction = newDirection;
+            pointsCount++;
+        }
+    } else {
+        const float slopeX = float(y1 - y2) / float(x1 - x2);
+        const int incr = x1 > x2 ? -4 : 4;
+        for (int xc = x1; xc * incr < x2 * incr; xc += incr) {
+            walkPoints[pointsCount].x = xc;
+            walkPoints[pointsCount].y = y1 + (xc - x1) * slopeX;
+            walkPoints[pointsCount].direction = newDirection;
+            pointsCount++;
+        }
+    }
+
+    walkPoints[pointsCount].x = x2;
+    walkPoints[pointsCount].y = y2;
+    walkPoints[pointsCount].direction = newDirection;
+    pointsCount++;
+
+    return pointsCount;
+}
+
+bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction, int actor2_destX, int actor2_destY) {
+    WalkPoint *actor1Points = 0, *actor2Points = 0;
+    int flag1, flag2;
+    int actor1X, actor1Y, actor2X, actor2Y;
+    int actor2WalkDestX, actor2WalkDestY;
+
+	debug("walkTo(%d, %d, %d, %d, %d)", actor1_destX, actor1_destY, direction, actor2_destX, actor2_destY);
+
+    _isTextVisible = false;
+
+    if (_currentActorNum != 0) {
+        actor1Points = _wayneWalkPoints;
+        actor2Points = _garthWalkPoints;
+        flag1 = 0;
+        flag2 = 1;
+        actor1X = _wayneSpriteX;
+        actor1Y = _wayneSpriteY;
+        actor2X = _garthSpriteX;
+        actor2Y = _garthSpriteY;
+    } else {
+        actor1Points = _garthWalkPoints;
+        actor2Points = _wayneWalkPoints;
+        flag1 = 1;
+        flag2 = 0;
+        actor1X = _garthSpriteX;
+        actor1Y = _garthSpriteY;
+        actor2X = _wayneSpriteX;
+        actor2Y = _wayneSpriteY;
+    }
+
+    if (!walkAdjustDestPoint(actor1_destX, actor1_destY))
+        return false;
+
+    if ((actor1X == actor1_destX && actor1Y == actor1_destY) || actor1X == -1) {
+        refreshActors();
+        return true;
+    }
+
+    if (actor2X == -1) {
+        // Other actor is not visible
+        actor2WalkDestX = actor2X;
+        actor2WalkDestY = actor2Y;
+    } else if (actor2_destX == -1) {
+        // Other actor follows first actor
+        actor2WalkDestX = actor1_destX;
+        actor2WalkDestY = actor1_destY;
+        walkCalcOtherActorDest(flag2, actor2WalkDestX, actor2WalkDestY);
+    } else {
+        // Other actor has coordinates specified
+        actor2WalkDestX = actor2_destX;
+        actor2WalkDestY = actor2_destY;
+        walkAdjustDestPoint(actor2WalkDestX, actor2WalkDestY);
+    }
+
+    int actor1PointsCount, actor2PointsCount;
+
+    actor1PointsCount = walkCalcPath(flag1, actor1X, actor1Y, actor1_destX, actor1_destY, 0);
+
+    if (actor2X != actor2WalkDestX || actor2Y != actor2WalkDestY) {
+        actor2PointsCount = walkCalcPath(flag2, actor2X, actor2Y, actor2WalkDestX, actor2WalkDestY, 0);
+    } else {
+        actor2PointsCount = 0;
+    }
+
+    if (actor1PointsCount + 20 < actor2PointsCount) {
+        actor2PointsCount = actor1PointsCount + 20;
+    }
+
+    for (int pointIndex = 0, walkIncr = 0; pointIndex < actor1PointsCount || pointIndex < actor2PointsCount; pointIndex += 2, walkIncr += 2) {
+        int scale = 0;
+        if (_word_306DD > 0) {
+            // TODO scrollRoom(false);
+        }
+        if (pointIndex < actor2PointsCount && pointIndex < actor1PointsCount) {
+            scale = drawActors(actor1Points[pointIndex].direction, 0, 0, (walkIncr % 8) / 2, _wayneWalkPoints[pointIndex].x - _from_x1, _wayneWalkPoints[pointIndex].y, _garthWalkPoints[pointIndex].x - _from_x1, _garthWalkPoints[pointIndex].y);
+        } else if (pointIndex < actor1PointsCount) {
+            if (flag1 == 0) {
+                scale = drawActors(actor1Points[pointIndex].direction, 0, 1, (walkIncr % 8) / 2, _wayneWalkPoints[pointIndex].x - _from_x1, _wayneWalkPoints[pointIndex].y, _garthSpriteX, _garthSpriteY);
+            } else {
+                scale = drawActors(actor1Points[pointIndex].direction, 1, 0, (walkIncr % 8) / 2, _wayneSpriteX, _wayneSpriteY, _garthWalkPoints[pointIndex].x - _from_x1, _garthWalkPoints[pointIndex].y);            
+            }
+        } else {
+            if (flag2 == 0) {
+                scale = drawActors(actor2Points[pointIndex].direction, 0, 1, (walkIncr % 8) / 2, _wayneWalkPoints[pointIndex].x - _from_x1, _wayneWalkPoints[pointIndex].y, _garthSpriteX, _garthSpriteY);
+            } else {
+                scale = drawActors(actor2Points[pointIndex].direction, 1, 0, (walkIncr % 8) / 2, _wayneSpriteX, _wayneSpriteY, _garthWalkPoints[pointIndex].x - _from_x1, _garthWalkPoints[pointIndex].y);            
+            }
+        }
+        if (_inventoryItemsCount == 0 && _from_x1 == 0) {
+            waitMillis(10000 / (scale * scale) * 10);
+        }
+        if (_word_306DD == 0) {
+            // TOOD
+            // if (updateGame()) {
+            //     return true;
+            // }
+        }
+    }
+
+    if (direction != -1) {
+        actor1Points[actor1PointsCount - 1].direction = direction;
+    }
+
+    if (_currentActorNum != 0) {
+        drawActors(actor1Points[actor1PointsCount - 1].direction, 1, 1, 0, actor1_destX - _from_x1, actor1_destY, actor2WalkDestX - _from_x1, actor2WalkDestY);
+    } else {
+        drawActors(actor1Points[actor1PointsCount - 1].direction, 1, 1, 0, actor2WalkDestX - _from_x1, actor2WalkDestY, actor1_destX - _from_x1, actor1_destY);
+    }
+
+    // TODO
+    // Finish background scrolling
+    // while (_word_306DD > 0) {
+    //     scrollRoom(true);
+    // }
+
+    return true;
+}
+
+} // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 1567f671be1..e11ba3ef559 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -76,6 +76,42 @@ Common::Error WaynesWorldEngine::run() {
 	initMouseCursor();
 	_screen = new Screen();
 	_backgroundSurface = new WWSurface(320, 150);
+	_inventorySprite = new WWSurface(312, 52);
+	_walkMap = new byte[kWalkMapSize];
+
+	_wayneSpriteX = 94;
+	_wayneSpriteY = 112;
+	_garthSpriteX = 147;
+	_garthSpriteY = 111;
+	_wayneActorScale = 100;
+	_garthActorScale = 100;
+	_actorSpriteValue = 0;
+	_wayneKind = 1;
+	_garthKind = 1;
+	_actorSpriteIndex = 0;
+	_currentActorNum = 1;
+	_inventoryItemsCount = 0;
+	_currentRoomNumber = -1;
+	_hoverObjectNumber = -1;
+	_objectNumber = -1;
+	_verbNumber = -1;
+	_verbNumber2 = 2;
+	_firstObjectNumber = -1;
+	_isTextVisible = false;
+	_currentTextX = -1;
+	_currentTextY = -1;
+	_from_x1 = 0;
+	_selectedDialogChoice = 0;
+	_gameState = 7;
+
+	loadMainActorSprites();
+
+	initRoomObjects();
+	memset(_wayneInventory, 0, sizeof(_wayneInventory));
+	memset(_garthInventory, 0, sizeof(_garthInventory));
+
+    _wayneInventory[kObjectIdInventoryDollar - 28] = 5;
+    _garthInventory[kObjectIdInventoryDrumstick - 28] = 1;
 
 #if 0
 	while (!shouldQuit()) {
@@ -87,37 +123,41 @@ Common::Error WaynesWorldEngine::run() {
 	loadPalette("m01/wstand0");
 	g_system->getPaletteManager()->setPalette(_palette2, 0, 256);
 
-	WWSurface *wayne = loadSurface("m01/wstand0");
-	WWSurface *wayneS = new WWSurface(wayne->w * 0.75f, wayne->h * 0.75f);
-
-	wayneS->scaleSurface(wayne);
-
-	// Image::PCXDecoder *pcx = loadImage("m00/winter", false);
-	// g_system->copyRectToScreen(pcx->getSurface()->getPixels(), pcx->getSurface()->pitch, 0, 0, pcx->getSurface()->w, pcx->getSurface()->h);
-	// delete pcx;
+	CursorMan.showMouse(true);
 
-	// drawImageToScreen("m00/winter", 0, 151);
-	drawInterface(4);
 	drawImageToScreen("r00/backg", 0, 0);
 
-	openRoomLibrary(6);
+	drawInterface(2);
+	changeRoom(0);
 
-	CursorMan.showMouse(true);
+	_gameState = 0; // DEBUG Initial _gameState 0 is set by room event in room 0
 
 	while (!shouldQuit()) {
+		_mouseClickButtons = 0;
+		// _keyInput = 0;
 		updateEvents();
-		// _screen->clear(0);
-		// _screen->drawSurfaceTransparent(wayne, _mouseX - 10, _mouseY - 10);
-		//_screen->drawSurfaceTransparent(wayneS, _mouseX - 10, _mouseY - 10);
-		// playAnimation("wdog", 0, 9, 64, 111, 0, 150);
+		updateMouseMove();
+		if (_mouseClickButtons != 0) {
+			debug("_mouseClickButtons: %d", _mouseClickButtons);
+			handleMouseClick();
+		}
+		/* TODO
+		if (_roomEventNum != 0) {
+			handleRoomEvent();
+		}
+		*/
+		if (_gameState == 1 && _currentRoomNumber < 100) {
+			// TODO gameMapOpen();
+		}
 		g_system->updateScreen();
 	}
 
-	delete wayneS;
-	delete wayne;
-
 #endif
 
+	unloadMainActorSprites();
+
+	delete[] _walkMap;
+	delete _inventorySprite;
 	delete _backgroundSurface;
 	delete _screen;
 
@@ -149,18 +189,24 @@ void WaynesWorldEngine::updateEvents() {
   			_mouseY = event.mouse.y;
   			break;
 		case Common::EVENT_LBUTTONDOWN:
-			//_mouseButtons |= kLeftButtonClicked;
-			//_mouseButtons |= kLeftButtonDown;
+			debug("EVENT_LBUTTONDOWN");
+			_mouseClickButtons |= kLeftButtonClicked;
+			_mouseClickX = event.mouse.x;
+			_mouseClickY = event.mouse.y;
+			//_mouseClickButtons |= kLeftButtonDown;
   			break;
 		case Common::EVENT_LBUTTONUP:
-			//_mouseButtons &= ~kLeftButtonDown;
+			//_mouseClickButtons &= ~kLeftButtonDown;
   			break;
 		case Common::EVENT_RBUTTONDOWN:
-			//_mouseButtons |= kRightButtonClicked;
-			//_mouseButtons |= kRightButtonDown;
+			debug("EVENT_RBUTTONDOWN");
+			_mouseClickButtons |= kRightButtonClicked;
+			_mouseClickX = event.mouse.x;
+			_mouseClickY = event.mouse.y;
+			//_mouseClickButtons |= kRightButtonDown;
   			break;
 		case Common::EVENT_RBUTTONUP:
-			//_mouseButtons &= ~kRightButtonDown;
+			//_mouseClickButtons &= ~kRightButtonDown;
   			break;
 		case Common::EVENT_QUIT:
 			quitGame();
@@ -177,7 +223,13 @@ int WaynesWorldEngine::getRandom(int max) {
 
 void WaynesWorldEngine::waitMillis(uint millis) {
 	// TODO
-	_system->delayMillis(millis);
+	// _system->delayMillis(millis);
+	uint32 waitTime = _system->getMillis() + millis;
+	while (_system->getMillis() < waitTime && !shouldQuit()) {
+		updateEvents();
+		_system->updateScreen();
+		_system->delayMillis(10);
+	}
 }
 
 void WaynesWorldEngine::waitSeconds(uint seconds) {
@@ -297,13 +349,13 @@ void WaynesWorldEngine::updateMouseMove() {
 }
 
 void WaynesWorldEngine::handleMouseClick() {
-    if (_mouseClickButtons & 1) {
+    if (_mouseClickButtons & kLeftButtonClicked) {
         handleMouseLeftClick();
     }
-    if (_mouseClickButtons & 2) {
+    if (_mouseClickButtons & kRightButtonClicked) {
         handleMouseRightClick();
     }
-    if (_mouseClickButtons & 4) {
+    if (_mouseClickButtons & kKeyPressed) {
         // TODO handleKeyInput();
     }
 }
@@ -470,6 +522,7 @@ void WaynesWorldEngine::drawRoomImageToSurface(const char *filename, WWSurface *
 
 void WaynesWorldEngine::loadString(const char *filename, int index, int flag) {
 	// TODO Load the string
+	debug("loadString(%s, %d)", filename, index);
 }
 
 void WaynesWorldEngine::drawCurrentTextToSurface(WWSurface *destSurface, int x, int y) {
@@ -608,15 +661,15 @@ void WaynesWorldEngine::drawVerbLine(int verbNumber, int objectNumber, const cha
 	// TODO Move to StaticData class/file
 	static const char *kVerbStrings[] = {
 		"",
-		"pick up"
-		"look at"
-		"use"
-		"talk to"
-		"push"
-		"pull"
-		"extreme closeup of"
-		"give"
-		"open"
+		"pick up",
+		"look at",
+		"use",
+		"talk to",
+		"push",
+		"pull",
+		"extreme closeup of",
+		"give",
+		"open",
 		"close"
 	};
 
@@ -714,6 +767,7 @@ void WaynesWorldEngine::drawInventory() {
         if ((_currentActorNum != 0 && objectRoomNumber == 99 && _wayneInventory[inventoryItemIndex] > 0) ||
             (_currentActorNum == 0 && objectRoomNumber == 99 && _garthInventory[inventoryItemIndex] > 0)) {
             Common::String filename = Common::String::format("m03/icon%02d", inventoryItemIndex + 1);
+			debug("filename: [%s]", filename.c_str());
             drawImageToSurface(filename.c_str(), _inventorySprite, iconX, iconY);
             iconX += 26;
             if (iconX > 300) {
@@ -726,6 +780,37 @@ void WaynesWorldEngine::drawInventory() {
     }
 }
 
+void WaynesWorldEngine::loadMainActorSprites() {
+    // _inventorySprite = new WWSurface(312, 52);
+	_wayneReachRightSprite = loadSurface("m01/wreachr");
+	_wayneReachLeftSprite = loadSurface("m01/wreachl");
+	_garthReachRightSprite = loadSurface("m01/greachr");
+	_garthReachLeftSprite = loadSurface("m01/greachl");
+    for (int direction = 0; direction < 8; direction++) {
+		_wayneSprites[direction] = loadSurface(Common::String::format("m01/wstand%d", direction).c_str());
+		_garthSprites[direction] = loadSurface(Common::String::format("m01/gstand%d", direction).c_str());
+		for (int frameNum = 0; frameNum < 4; frameNum++) {			
+			_wayneWalkSprites[direction][frameNum] = loadSurface(Common::String::format("m01/wwalk%d%d", direction, frameNum).c_str());
+			_garthWalkSprites[direction][frameNum] = loadSurface(Common::String::format("m01/gwalk%d%d", direction, frameNum).c_str());
+		}
+    }
+}
+
+void WaynesWorldEngine::unloadMainActorSprites() {
+	delete _wayneReachRightSprite;
+	delete _wayneReachLeftSprite;
+	delete _garthReachRightSprite;
+	delete _garthReachLeftSprite;
+    for (int direction = 0; direction < 8; direction++) {
+		delete _wayneSprites[direction];
+		delete _garthSprites[direction];
+		for (int frameNum = 0; frameNum < 4; frameNum++) {
+			delete _wayneWalkSprites[direction][frameNum];
+			delete _garthWalkSprites[direction][frameNum];
+		}
+    }
+}
+
 int WaynesWorldEngine::getActorScaleFromY(int actorY) {
 	// TODO
     return 100;
@@ -808,6 +893,14 @@ int WaynesWorldEngine::drawActors(int direction, int wayneKind, int garthKind, i
     WWSurface *tempBackground = new WWSurface(320, 150);
     tempBackground->drawSurface(_backgroundSurface, 0, 0);
 
+#if 0 // DEBUG Draw room mask to background
+	for (int yc = 0; yc < 150; yc++) {
+		for (int xc = 0; xc < 320; xc++) {
+			 *(byte*)tempBackground->getBasePtr(xc, yc) = walkIsPixelWalkable(xc, yc) ? 15 : 0;
+		}
+	}
+#endif
+
     if (wayneY <= garthY) {
         if (_wayneSpriteX != -1) {
             tempBackground->drawSurfaceTransparent(wayneSprite, wayneX - wayneWidth, wayneY + wayneHeight - 48);
@@ -907,10 +1000,6 @@ void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int co
     // sysMouseDriver(1)
 }
 
-bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction, int actor2_destX, int actor2_destY) {
-	// TODO
-}
-
 void WaynesWorldEngine::openRoomLibrary(int roomNum) {
     _roomName = Common::String::format("r%02d", roomNum);
 }
@@ -950,7 +1039,13 @@ void WaynesWorldEngine::loadScrollSprite() {
 }
 
 void WaynesWorldEngine::loadRoomMask(int roomNum) {
-	// TODO
+	Common::String filename = Common::String::format("r%02d.msk", roomNum);
+	Common::File fd;
+	if (!fd.open(filename))
+		error("WaynesWorldEngine::loadRoomMask() Could not open %s", filename.c_str());
+	if (fd.size() != kWalkMapSize)
+		error("WaynesWorldEngine::loadRoomMask() Wrong file size in %s", filename.c_str());
+	fd.read(_walkMap, kWalkMapSize);
 }
 
 void WaynesWorldEngine::updateRoomAnimations(bool doUpdate) {
@@ -969,6 +1064,11 @@ void WaynesWorldEngine::drawStaticRoomObjects(int roomNumber, int x, int y, int
 	// TODO
 }
 
+void WaynesWorldEngine::initRoomObjects() {
+	for  (uint i = 0; i < kRoomObjectsCount; i++)
+		_roomObjects[i] = kRoomObjects[i];
+}
+
 void WaynesWorldEngine::moveObjectToRoom(int objectId, int roomNum) {
     _roomObjects[objectId].roomNumber = roomNum;
     if (objectId <= 77) {
@@ -1015,7 +1115,7 @@ int WaynesWorldEngine::getObjectDirection(int objectId) {
 
 int WaynesWorldEngine::findRoomObjectIdAtPoint(int x, int y) {
     for (uint index = 0; index < kRoomObjectsCount; index++) {
-        const RoomObject *roomObject = getRoomObject(_hoverObjectNumber);
+        const RoomObject *roomObject = getRoomObject(index);
         if (roomObject->roomNumber == _currentRoomNumber &&
             x >= roomObject->x1 && x <= roomObject->x2 &&
             y >= roomObject->y1 && y <= roomObject->y2) {
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 74a6b73ee5d..6b668c62fbe 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -57,7 +57,19 @@ struct RoomObject {
     int walkX, walkY;
 };
 
+struct WalkPoint {
+    int x, y, direction;
+};
+
+enum {
+	kLeftButtonClicked = 1 << 0,
+	kRightButtonClicked = 1 << 1,
+	kKeyPressed = 1 << 2
+};
+
 const uint kRoomObjectsCount = 404;
+const int kWalkPointsCount = 300;
+const uint kWalkMapSize = (320 * 150) / 8;
 
 class WaynesWorldEngine : public Engine {
 protected:
@@ -88,7 +100,9 @@ public:
 
 	// Room
 	Common::String _roomName;
+	byte *_walkMap;
 	int _word_306DB;
+	int _word_306DD;
 	int _byte_306E7;
 	int _from_x1;
 	bool _doScrollRight;
@@ -96,7 +110,6 @@ public:
 	// Input
 	int _mouseX, _mouseY;
 	int _mouseClickY, _mouseClickX;
-	// uint _mouseButtons;
 	uint _mouseClickButtons;
 	Common::KeyCode _keyCode;
 
@@ -123,6 +136,8 @@ public:
 	int _actorSpriteIndex;
 	WWSurface *_wayneSprites[8], *_wayneWalkSprites[8][4], *_wayneReachRightSprite, *_wayneReachLeftSprite;
 	WWSurface *_garthSprites[8], *_garthWalkSprites[8][4], *_garthReachRightSprite, *_garthReachLeftSprite;
+	WalkPoint _wayneWalkPoints[kWalkPointsCount];
+	WalkPoint _garthWalkPoints[kWalkPointsCount];
 
 	// Inventory
 	WWSurface *_inventorySprite;
@@ -197,12 +212,26 @@ public:
 	void drawInventory();
 
 	// Actors and animations
+	void loadMainActorSprites();
+	void unloadMainActorSprites();
 	int getActorScaleFromY(int actorY);
 	void drawActorReachObject(int objectId, int spriteIndex);
 	int drawActors(int direction, int wayneKind, int garthKind, int spriteIndex, int wayneX, int wayneY, int garthX, int garthY);
 	void refreshActors();
 	void pickupObject(int objectId, byte &flags, byte flagsSet, int inventoryObjectId);
 	void playAnimation(const char *prefix, int startIndex, int count, int x, int y, int flag, uint ticks);
+
+	// Pathfinding
+	bool walkIsPixelWalkable(int x, int y);
+	bool walkAdjustDestPoint(int &x, int &y);
+	void walkGetNextPoint(int sourceX, int sourceY, int destX, int destY, int &nextX, int &nextY);
+	void walkCalcOtherActorDest(int flag, int &x, int &y);
+	int walkCalcPath(int flag, int sourceX, int sourceY, int destX, int destY, int pointsCount);
+	bool walkFindPoint(int flag, int &sourceX, int &sourceY, int &nextSourceX, int &nextSourceY, int destX, int destY, int pointsCount);
+	int walkAddWalkLine(int flag, int x1, int y1, int x2, int y2, int pointsCount);
+	bool walkTestPoint(int sourceX, int sourceY, int nextSourceX, int nextSourceY, int destX, int destY);
+	bool walkIsLineWalkable(int sourceX, int sourceY, int destX, int destY);
+	int walkCalcDirection(int deltaX, int deltaY);
 	bool walkTo(int actor1_destX, int actor1_destY, int direction, int actor2_destX, int actor2_destY);
 
 	// Room
@@ -221,6 +250,7 @@ public:
 	void drawStaticRoomObjects(int roomNumber, int x, int y, int actorHeight, int actorWidth, WWSurface *surface);
 
 	// Room objects
+	void initRoomObjects();
 	void moveObjectToRoom(int objectId, int roomNum);
 	void moveObjectToNowhere(int objectId);
 	const RoomObject *getRoomObject(int objectId);


Commit: 8756bf6e98ef2832d525685bc4edac990b61db44
    https://github.com/scummvm/scummvm/commit/8756bf6e98ef2832d525685bc4edac990b61db44
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:49+01:00

Commit Message:
WAYNESWORLD: Implement font loading and drawing

Changed paths:
    engines/waynesworld/graphics.cpp
    engines/waynesworld/graphics.h
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
index 4e77fcdd8b1..bead33af6f2 100644
--- a/engines/waynesworld/graphics.cpp
+++ b/engines/waynesworld/graphics.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "waynesworld/graphics.h"
+#include "common/file.h"
 #include "common/rect.h"
 #include "common/system.h"
 
@@ -105,9 +106,9 @@ void WWSurface::scaleSurface(const Graphics::Surface *surface) {
 	const int yIncr = (surface->h / h) * surface->pitch;
 	const int yIncrErr = surface->h % h;
 	int errY = 0;
-	byte *source = (byte*)surface->getBasePtr(0, 0);
+	const byte *source = (const byte*)surface->getBasePtr(0, 0);
 	for (int yc = 0; yc < h; yc++) {
-		byte *sourceRow = source;
+		const byte *sourceRow = source;
 		byte *destRow = (byte*)getBasePtr(0, yc);
 		int errX = 0;
 		for (int xc = 0; xc < w; xc++) {
@@ -129,21 +130,102 @@ void WWSurface::scaleSurface(const Graphics::Surface *surface) {
 }
 
 void WWSurface::frameRect(int x1, int y1, int x2, int y2, byte color) {
-	// TODO
+	Graphics::Surface::frameRect(Common::Rect(x1, y1, x2, y2), color);
 }
 
 void WWSurface::borderSquare(int x, int y, int length, byte frameColor, byte fillColor) {
-	// TODO
+	Graphics::Surface::frameRect(Common::Rect(x, y, x + length, y + length), frameColor);
 }
 
 void WWSurface::fillRect(int x1, int y1, int x2, int y2, byte color) {
-	// TODO
+	Graphics::Surface::fillRect(Common::Rect(x1, y1, x2, y2), color);
 }
 
 void WWSurface::clear(byte color) {
 	Graphics::Surface::fillRect(Common::Rect(w, h), color);
 }
 
+// GFTFont
+
+GFTFont::GFTFont() : _charTable(nullptr), _fontData(nullptr) {
+}
+
+GFTFont::~GFTFont() {
+	delete[] _charTable;
+	delete[] _fontData;
+}
+
+void GFTFont::loadFromFile(const char *filename) {
+	Common::File fd;
+	if (!fd.open(filename))
+		error("GFTFont::loadFromFile() Could not open %s", filename);
+	fd.seek(0x24);
+	_firstChar = fd.readUint16LE();
+	_lastChar = fd.readUint16LE();
+	uint16 charCount = _lastChar - _firstChar + 2;
+	fd.seek(0x48);
+	uint32 charTableOfs = fd.readUint32LE();
+	uint32 charDataOfs = fd.readUint32LE();
+	_formWidth = fd.readSint16LE();
+	_formHeight = fd.readSint16LE();
+	fd.seek(charTableOfs);
+	_charTable = new uint16[charCount];
+	for (uint16 i = 0; i < charCount; i++)
+		_charTable[i] = fd.readUint16LE();
+	fd.seek(charDataOfs);
+	_fontData = new byte[_formWidth * 8 * _formHeight];
+    for (int y = 0; y < _formHeight; y++) {
+        int x = 0;
+        for (int formPos = 0; formPos < _formWidth; formPos++) {
+            byte charByte = fd.readByte();
+            for (int bitNum = 0; bitNum < 8; bitNum++) {
+                _fontData[x + y * _formWidth * 8] = ((charByte & (1 << (7 - bitNum))) != 0) ? 1 : 0;
+                x++;
+            }
+        }
+    }
+}
+
+void GFTFont::drawText(Graphics::Surface *surface, const char *text, int x, int y, byte color) {
+	while (*text) {
+		byte ch = (byte)*text++;
+		x += drawChar(surface, ch, x, y, color);
+	}
+}
+
+int GFTFont::drawChar(Graphics::Surface *surface, byte ch, int x, int y, byte color) {
+	if (ch < _firstChar || ch > _lastChar)
+		return 0;
+	const uint charIndex = ch - _firstChar;
+	byte *charData = _fontData + _charTable[charIndex];
+	int charWidth = getCharWidth(ch);
+	for (int yc = 0; yc < _formHeight; yc++) {
+		byte *destRow = (byte*)surface->getBasePtr(x, y + yc);
+		for (int xc = 0; xc < charWidth; xc++) {
+			if (charData[xc] != 0)
+				*destRow = color;
+			destRow++;
+		}
+		charData += _formWidth * 8;
+	}
+	return charWidth;
+}
+
+int GFTFont::getTextWidth(const char *text) const {
+	int textWidth = 0;
+	while (*text) {
+		textWidth += getCharWidth(*text++);
+	}
+	return textWidth;
+}
+
+int GFTFont::getCharWidth(byte ch) const {
+	if (ch < _firstChar || ch > _lastChar)
+		return 0;
+	const uint charIndex = ch - _firstChar;
+	return _charTable[charIndex + 1] - _charTable[charIndex];
+}
+
 // Screen
 
 Screen::Screen() {
@@ -184,6 +266,11 @@ void Screen::clear(byte color) {
 	updateScreen();
 }
 
+void Screen::drawText(GFTFont *font, const char *text, int x, int y, byte color) {
+	font->drawText(_surface, text, x, y, color);
+	updateScreen();
+}
+
 void Screen::updateScreen() {
 	// TODO Use dirty rectangles or similar
 	g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 0, 0, _surface->w, _surface->h);
diff --git a/engines/waynesworld/graphics.h b/engines/waynesworld/graphics.h
index 5d1ea4e399e..aaeb1c31d43 100644
--- a/engines/waynesworld/graphics.h
+++ b/engines/waynesworld/graphics.h
@@ -42,6 +42,23 @@ public:
 	void clear(byte color);
 };
 
+class GFTFont {
+public:
+	GFTFont();
+	~GFTFont();
+	void loadFromFile(const char *filename);
+	void drawText(Graphics::Surface *surface, const char *text, int x, int y, byte color);
+	int drawChar(Graphics::Surface *surface, byte ch, int x, int y, byte color);
+	int getTextWidth(const char *text) const;
+	int getCharWidth(byte ch) const;
+protected:
+	byte _firstChar;
+	byte _lastChar;
+	uint16 *_charTable;
+	byte *_fontData;
+	int16 _formWidth, _formHeight;
+};
+
 class Screen {
 public:
 	Screen();
@@ -52,6 +69,7 @@ public:
 	void borderSquare(int x, int y, int length, byte frameColor, byte fillColor);
 	void fillRect(int x1, int y1, int x2, int y2, byte color);
 	void clear(byte color);
+	void drawText(GFTFont *font, const char *text, int x, int y, byte color);
 protected:
 	WWSurface *_surface;
 	void updateScreen();
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index e11ba3ef559..a1abe0563e2 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -79,6 +79,13 @@ Common::Error WaynesWorldEngine::run() {
 	_inventorySprite = new WWSurface(312, 52);
 	_walkMap = new byte[kWalkMapSize];
 
+	_fontWW = new GFTFont();
+	_fontWWInv = new GFTFont();
+	_fontBit5x7 = new GFTFont();
+	_fontWW->loadFromFile("ww.gft");
+	_fontWWInv->loadFromFile("wwinv.gft");
+	_fontBit5x7->loadFromFile("bit5x7.gft");
+
 	_wayneSpriteX = 94;
 	_wayneSpriteY = 112;
 	_garthSpriteX = 147;
@@ -156,6 +163,10 @@ Common::Error WaynesWorldEngine::run() {
 
 	unloadMainActorSprites();
 
+	delete _fontWW;
+	delete _fontWWInv;
+	delete _fontBit5x7;
+
 	delete[] _walkMap;
 	delete _inventorySprite;
 	delete _backgroundSurface;
@@ -706,11 +717,8 @@ void WaynesWorldEngine::drawVerbLine(int verbNumber, int objectNumber, const cha
 		}
 	}
 
-	_screen->fillRect(3, 162, 316, 153, 0);
-	// TODO Implement text drawing and draw it
-	// txSetColor(0, 6);
-	// txOutTextXY(154, 5, verbLine);
-	debug("verbLine: [%s]", verbLine.c_str());
+	_screen->fillRect(0, 153, 316, 162, 0);
+	_screen->drawText(_fontBit5x7, verbLine.c_str(), 5, 154, 6);
 }
 
 void WaynesWorldEngine::rememberFirstObjectName(int objectId) {
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 6b668c62fbe..d8a15455c9a 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -48,6 +48,7 @@ enum {
 
 class Screen;
 class WWSurface;
+class GFTFont;
 
 struct RoomObject {
     int roomNumber;
@@ -97,6 +98,9 @@ public:
 	byte _palette2[768];
 	Screen *_screen;
 	WWSurface *_backgroundSurface;
+	GFTFont *_fontWW;
+	GFTFont *_fontWWInv;
+	GFTFont *_fontBit5x7;
 
 	// Room
 	Common::String _roomName;


Commit: 251813c5ddf9e55be88c6cfcce6e39e5631bebaf
    https://github.com/scummvm/scummvm/commit/251813c5ddf9e55be88c6cfcce6e39e5631bebaf
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:49+01:00

Commit Message:
WAYNESWORLD: Implement loadString method

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index a1abe0563e2..1e78ff2586e 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -531,9 +531,24 @@ void WaynesWorldEngine::drawRoomImageToSurface(const char *filename, WWSurface *
     drawImageToSurfaceIntern(filename, destSurface, x, y, false, true);
 }
 
-void WaynesWorldEngine::loadString(const char *filename, int index, int flag) {
-	// TODO Load the string
-	debug("loadString(%s, %d)", filename, index);
+Common::String WaynesWorldEngine::loadString(const char *filename, int index, int flag) {
+	const uint kMaxStringLen = 60;
+	char textBuffer[kMaxStringLen];
+	Common::File fd;
+	Common::String tempFilename = Common::String::format("%s.txt", filename);
+	if (!fd.open(tempFilename))
+		error("WaynesWorldEngine::loadString() Could not open %s", tempFilename.c_str());
+	fd.seek(index * kMaxStringLen);
+	fd.read(textBuffer, kMaxStringLen);
+	// Decrypt the string
+	uint i = 0;
+	for (; i < kMaxStringLen; i++) {
+		textBuffer[i] += 0x80;
+		if (textBuffer[i] == 0x2b)
+			break;
+	}
+	textBuffer[i] = 0;
+	return Common::String(textBuffer);
 }
 
 void WaynesWorldEngine::drawCurrentTextToSurface(WWSurface *destSurface, int x, int y) {
@@ -589,7 +604,7 @@ void WaynesWorldEngine::drawCurrentText(int x, int y, WWSurface *destSurface) {
 }
 
 void WaynesWorldEngine::displayText(const char *filename, int index, int flag, int x, int y, int drawToVirtual) {
-    loadString(filename, index, flag);
+    _currentText = loadString(filename, index, flag);
     drawCurrentText(x, y, nullptr);
 }
 
@@ -1171,9 +1186,8 @@ void WaynesWorldEngine::drawDialogChoices(int choiceIndex) {
     byte selectedTextColor = 13;
     for (int index = 0; index < 5 && _dialogChoices[index] != -1; index++) {
         byte textColor = index + choiceIndex + 11 == 0 ? selectedTextColor : choiceTextColor;
-        loadString("c04", _dialogChoices[index], 0);
-        // TODO Draw the text
-        // txOutTextXY(txtString, 3, 152 + index * 9);
+        Common::String dialogText = loadString("c04", _dialogChoices[index], 0);
+		_screen->drawText(_fontBit5x7, dialogText.c_str(), 3, 152 + index * 9, textColor);
     }
     // sysMouseDriver(1);
     _selectedDialogChoice = choiceIndex;
@@ -1320,10 +1334,16 @@ void WaynesWorldEngine::handleVerbLookAt() {
     if (_objectNumber == kObjectIdInventoryUnusedTicket) {
         // TODO lookAtUnusedTicket();
     } else {
+		int textIndex;
+		if (_objectNumber == -2 || _objectNumber == -3) {
+			textIndex = 0;
+		} else {
+			textIndex = _objectNumber - 27;
+		}
         if (_currentActorNum != 0) {
-            displayText("c02w", _objectNumber, 1, -1, -1, 1);
+            displayText("c02w", textIndex, 1, -1, -1, 1);
         } else {
-            displayText("c02g", _objectNumber, 1, -1, -1, 1);
+            displayText("c02g", textIndex, 1, -1, -1, 1);
         }
     }
 }
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index d8a15455c9a..7727e5d6a8b 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -118,6 +118,7 @@ public:
 	Common::KeyCode _keyCode;
 
 	// Text
+	Common::String _currentText;
 	int _currentTextX, _currentTextY;
 	bool _isTextVisible;
 
@@ -193,7 +194,7 @@ public:
 	void drawRoomImageToSurface(const char *filename, WWSurface *destSurface, int x, int y);
 
 	// Text
-	void loadString(const char *filename, int index, int flag);
+	Common::String loadString(const char *filename, int index, int flag);
 	void drawCurrentTextToSurface(WWSurface *destSurface, int x, int y);
 	void drawCurrentText(int x, int y, WWSurface *destSurface);
 	void displayText(const char *filename, int index, int flag, int x, int y, int drawToVirtual);


Commit: 97191004f6e827c8e02e51f4a41f56d0382f94ff
    https://github.com/scummvm/scummvm/commit/97191004f6e827c8e02e51f4a41f56d0382f94ff
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:49+01:00

Commit Message:
WAYNESWORLD: Implement wrapped text drawing

Changed paths:
    engines/waynesworld/graphics.cpp
    engines/waynesworld/graphics.h
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
index bead33af6f2..38513ddb502 100644
--- a/engines/waynesworld/graphics.cpp
+++ b/engines/waynesworld/graphics.cpp
@@ -193,6 +193,33 @@ void GFTFont::drawText(Graphics::Surface *surface, const char *text, int x, int
 	}
 }
 
+void GFTFont::drawWrappedText(Graphics::Surface *surface, const char *text, int x, int y, int maxWidth, byte color) {
+    const char *textP = text;
+    const char *lineP = text, *lastSpaceP = nullptr;
+	int textX = x;
+    int lineWidth = 0;
+    while (*textP) {
+        if (textP[1] == 32 || textP[1] == 0)
+            lastSpaceP = textP + 1;
+        int charWidth = getCharWidth(*textP);
+        if (lineWidth + charWidth > maxWidth || textP[1] == 0) {
+			for (const char *p = lineP; p < lastSpaceP; p++) {
+				x += drawChar(surface, (byte)*p, x, y, color);
+			}
+            if (textP[1] == 0)
+                break;
+            lineP = lastSpaceP + 1;
+            textP = lastSpaceP + 1;
+            lineWidth = 0;
+			x = textX;
+            y += _formHeight;
+        } else {
+            lineWidth += charWidth;
+            textP++;
+        }
+    }
+}
+
 int GFTFont::drawChar(Graphics::Surface *surface, byte ch, int x, int y, byte color) {
 	if (ch < _firstChar || ch > _lastChar)
 		return 0;
@@ -271,6 +298,11 @@ void Screen::drawText(GFTFont *font, const char *text, int x, int y, byte color)
 	updateScreen();
 }
 
+void Screen::drawWrappedText(GFTFont *font, const char *text, int x, int y, int maxWidth, byte color) {
+	font->drawWrappedText(_surface, text, x, y, maxWidth, color);
+	updateScreen();
+}
+
 void Screen::updateScreen() {
 	// TODO Use dirty rectangles or similar
 	g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 0, 0, _surface->w, _surface->h);
diff --git a/engines/waynesworld/graphics.h b/engines/waynesworld/graphics.h
index aaeb1c31d43..266e20f048a 100644
--- a/engines/waynesworld/graphics.h
+++ b/engines/waynesworld/graphics.h
@@ -48,6 +48,7 @@ public:
 	~GFTFont();
 	void loadFromFile(const char *filename);
 	void drawText(Graphics::Surface *surface, const char *text, int x, int y, byte color);
+	void drawWrappedText(Graphics::Surface *surface, const char *text, int x, int y, int maxWidth, byte color);
 	int drawChar(Graphics::Surface *surface, byte ch, int x, int y, byte color);
 	int getTextWidth(const char *text) const;
 	int getCharWidth(byte ch) const;
@@ -70,6 +71,7 @@ public:
 	void fillRect(int x1, int y1, int x2, int y2, byte color);
 	void clear(byte color);
 	void drawText(GFTFont *font, const char *text, int x, int y, byte color);
+	void drawWrappedText(GFTFont *font, const char *text, int x, int y, int maxWidth, byte color);
 protected:
 	WWSurface *_surface;
 	void updateScreen();
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 1e78ff2586e..e0a3546ad53 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -556,10 +556,8 @@ void WaynesWorldEngine::drawCurrentTextToSurface(WWSurface *destSurface, int x,
 }
 
 void WaynesWorldEngine::drawCurrentText(int x, int y, WWSurface *destSurface) {
-    int textWidth, textCenterX, textX, textY, textColor, actorY;
-    // WWSurface *textSurface = destSurface ? destSurface : _screen;
-    // txSetFont(font_wwinv);
-    // textWidth = txStrWidth(txtString);
+    int textCenterX, textX, textY, textColor, actorY;
+    int textWidth = _fontWWInv->getTextWidth(_currentText.c_str());
     if (x != -1) {
         textCenterX = x;
         textY = y;
@@ -585,19 +583,13 @@ void WaynesWorldEngine::drawCurrentText(int x, int y, WWSurface *destSurface) {
             textY = actorY + 15;
         }
     }
-	// TODO Draw the text
-    // txSetViewPort(textX, 0, textX + 150, 199);
-    // tx_sub_2B2D2(32);
-    // txSetColor(0, 0);
-    // sysMouseDriver(2);
-    // txWrapText(txtString, textX, textY);
-    // txSetFont(font_ww);
-    // tx_sub_2B2D2(32);
-    // txSetColor(textColor, 0);
-    // txWrapText(txtString, clippedTextXCpy, textYCpy);
-    // sysMouseDriver(1);
-    // txSetViewPort(0, 0, 319, 199);
-    // txSetFont(font_bit5x7);
+	if (destSurface) {
+		_fontWWInv->drawWrappedText(destSurface, _currentText.c_str(), textX, textY, 150, 0);
+		_fontWW->drawWrappedText(destSurface, _currentText.c_str(), textX, textY, 150, textColor);
+	} else {
+		_screen->drawWrappedText(_fontWWInv, _currentText.c_str(), textX, textY, 150, 0);
+		_screen->drawWrappedText(_fontWW, _currentText.c_str(), textX, textY, 150, textColor);
+	}
     _isTextVisible = true;
     _currentTextX = x;
     _currentTextY = y;


Commit: 88228b94cc554a6151754b164780246740f7767b
    https://github.com/scummvm/scummvm/commit/88228b94cc554a6151754b164780246740f7767b
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:49+01:00

Commit Message:
WAYNESWORLD: Rename borderSquara to fillSquare and adjust parameters

Changed paths:
    engines/waynesworld/graphics.cpp
    engines/waynesworld/graphics.h


diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
index 38513ddb502..91fc8ca724e 100644
--- a/engines/waynesworld/graphics.cpp
+++ b/engines/waynesworld/graphics.cpp
@@ -133,8 +133,8 @@ void WWSurface::frameRect(int x1, int y1, int x2, int y2, byte color) {
 	Graphics::Surface::frameRect(Common::Rect(x1, y1, x2, y2), color);
 }
 
-void WWSurface::borderSquare(int x, int y, int length, byte frameColor, byte fillColor) {
-	Graphics::Surface::frameRect(Common::Rect(x, y, x + length, y + length), frameColor);
+void WWSurface::fillSquare(int x, int y, int length, byte color) {
+	Graphics::Surface::fillRect(Common::Rect(x, y, x + length, y + length), color);
 }
 
 void WWSurface::fillRect(int x1, int y1, int x2, int y2, byte color) {
@@ -278,8 +278,8 @@ void Screen::frameRect(int x1, int y1, int x2, int y2, byte color) {
 	updateScreen();
 }
 
-void Screen::borderSquare(int x, int y, int length, byte frameColor, byte fillColor) {
-	_surface->borderSquare(x, y, length, frameColor, fillColor);
+void Screen::fillSquare(int x, int y, int length, byte color) {
+	_surface->fillSquare(x, y, length, color);
 	updateScreen();
 }
 
diff --git a/engines/waynesworld/graphics.h b/engines/waynesworld/graphics.h
index 266e20f048a..871f19297b0 100644
--- a/engines/waynesworld/graphics.h
+++ b/engines/waynesworld/graphics.h
@@ -37,7 +37,7 @@ public:
 	void drawSurfaceTransparent(const Graphics::Surface *surface, int x, int y);
 	void scaleSurface(const Graphics::Surface *surface);
 	void frameRect(int x1, int y1, int x2, int y2, byte color);
-	void borderSquare(int x, int y, int length, byte frameColor, byte fillColor);
+	void fillSquare(int x, int y, int length, byte color);
 	void fillRect(int x1, int y1, int x2, int y2, byte color);
 	void clear(byte color);
 };
@@ -67,7 +67,7 @@ public:
 	void drawSurface(const Graphics::Surface *surface, int x, int y);
 	void drawSurfaceTransparent(const Graphics::Surface *surface, int x, int y);
 	void frameRect(int x1, int y1, int x2, int y2, byte color);
-	void borderSquare(int x, int y, int length, byte frameColor, byte fillColor);
+	void fillSquare(int x, int y, int length, byte color);
 	void fillRect(int x1, int y1, int x2, int y2, byte color);
 	void clear(byte color);
 	void drawText(GFTFont *font, const char *text, int x, int y, byte color);


Commit: 2769d4526900cb855c219559b547e9cf711aac0d
    https://github.com/scummvm/scummvm/commit/2769d4526900cb855c219559b547e9cf711aac0d
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:49+01:00

Commit Message:
WAYNESWORLD: Implement game map

Changed paths:
  A engines/waynesworld/gamemap.cpp
    engines/waynesworld/module.mk
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamemap.cpp b/engines/waynesworld/gamemap.cpp
new file mode 100644
index 00000000000..fc0b06d7f49
--- /dev/null
+++ b/engines/waynesworld/gamemap.cpp
@@ -0,0 +1,245 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "waynesworld/waynesworld.h"
+#include "waynesworld/graphics.h"
+
+namespace WaynesWorld {
+
+struct MapItem9 {
+    int roomNumber;
+    int x0, y0;
+    int x1, y1;
+};
+
+struct MapItem13 {
+    int roomNumber;
+    const char *name;
+    int animX, animY;
+    int tagX, tagY;
+};
+
+struct MapItem17 {
+    const char *name;
+    int tagX, tagY;
+    int roomNumber;
+    int wayneX, wayneY;
+    int garthX, garthY;
+};
+
+static const MapItem9 kMapItem9s[] = {
+    { 102, 40, 94, 112, 89 },
+    { 102, 40, 94, 69, 47 },
+    { 102, 40, 94, 157, 66 },
+    { 101, 84, 28, 84, 44 },
+    { 101, 84, 28, 154, 54 },
+    { 101, 84, 28, 85, 72 },
+    { 103, 230, 35, 188, 41 },
+    { 103, 230, 35, 231, 64 },
+    { 104, 224, 80, 223, 70 },
+    { 104, 224, 80, 230, 97 },
+    { 105, 139, 113, 86, 80 },
+    { 105, 139, 113, 126, 118 },
+    { 105, 139, 113, 180, 129 },
+    { 106, 256, 130, 177, 90 },
+    { 106, 256, 130, 265, 98 }
+};
+
+static const MapItem13 kMapItem13s[] = {
+    { 101, "na", 53, 6, 84, 49 },
+    { 102, "wa", 34, 32, 56, 87 },
+    { 103, "but", 127, 11, 247, 38 },
+    { 104, "stn", 173, 13, 173, 90 },
+    { 105, "dt", 70, 69, 125, 135 },
+    { 106, "sea", 139, 57, 218, 142 }
+};
+
+static const MapItem17 kMapItem17s[] = {
+    { "cab", 61, 18, 3, 58, 108, 44, 102 },
+    { "ad", 141, 31, 4, 51, 70, 40, 67 },
+    { "cas", 69, 80, 5, 291, 105, 312, 102 },
+    { "inv", 49, 52, 1, 23, 111, 15, 102 },
+    { "way", 73, 86, 0, 168, 92, 184, 95 },
+    { "don", 120, 47, 2, 126, 90, 117, 88 },
+    { "cin", 147, 27, 6, 185, 137, 151, 139 },
+    { "c35", 208, 72, 7, 157, 122, 180, 122 },
+    { "may", 193, 40, 8, 243, 103, 239, 95 },
+    { "eug", 241, 82, 9, 250, 96, 263, 93 },
+    { "jun", 78, 87, 10, -1, -1, -1, -1 },
+    { "cih", 134, 102, 11, 130, 140, 160, 131 },
+    { "uno", 142, 137, 12, 289, 114, 294, 110 },
+    { "pep", 151, 101, 13, 61, 77, 65, 75 },
+    { "gil", 224, 106, 14, 195, 141, 229, 138 }
+};
+
+void WaynesWorldEngine::gameMapOpen() {
+    _gameMapRoomNumber = _currentRoomNumber;
+    _gameMapWayneSpriteX = _wayneSpriteX;
+    _gameMapGarthSpriteX = _garthSpriteX;
+    unloadStaticRoomObjects();
+    _currentRoomNumber = 100;
+    _wayneSpriteX = -1;
+    _garthSpriteX = -1;
+    _currentMapItemIndex = -1;
+    _isTextVisible = false;
+    /* TODO
+    if (_byte_3070D & 0x08) {
+        setWaynePosition(243, 103);
+        setGarthPosition(239, 95);
+        changeRoom(8);
+        return;
+    }
+    */
+    // sysMouseDriver(2);
+    paletteFadeOut(0, 256, 16);
+    /* TODO
+    if ((_byte_306F4 & 0x04) && !(_byte_306F4 & 0x08)) {
+        // TODO sub_305E0();
+        _gameState = 0;
+        // sysMouseDriver(1);
+        drawInterface(_verbNumber);
+        paletteFadeIn(0, 256, 4);
+        return;
+    }
+    */
+    _musicIndex = 2;
+    changeMusic();
+    _screen->clear(0);
+    drawImageToScreen("m02/main_map", 0, 0);
+    _screen->fillSquare(kMapItem9s[_gameMapRoomNumber].x0, kMapItem9s[_gameMapRoomNumber].y0, 3, 109);
+    paletteFadeIn(0, 256, 16);
+    // TODO gameMapPaletteHandlerStart();
+    // sysMouseDriver(1);
+}
+
+void WaynesWorldEngine::gameMapFinish() {
+    _gameState = 0;
+    // TODO gameMapPaletteHandlerStop();
+    paletteFadeOut(0, 256, 16);
+    _musicIndex = 0;
+    changeMusic();
+    _screen->clear(0);
+    drawInterface(_verbNumber);
+    changeRoom(_gameMapDestinationRoomNum);
+    paletteFadeIn(0, 256, 16);
+}
+
+void WaynesWorldEngine::gameMapHandleMouseMove(int objectNumber) {
+    if (_hoverObjectNumber == objectNumber)
+        return;
+    _hoverObjectNumber = objectNumber;
+
+    Common::String tagFilename;
+    int tagX = -1, tagY = -1;
+
+    if (_hoverObjectNumber == -1) {
+        if (_currentMapItemIndex == 6) {
+            // TODO gameMapPaletteHandlerStop();
+            // TODO paletteFadeColor(36, 4, 21, 2, 64);
+            // TODO gameMapPaletteHandlerStart();
+            _currentMapItemIndex = -1;
+        } else if (_currentMapItemIndex >= 0 && _currentMapItemIndex <= 5) {
+            const MapItem13 &item = kMapItem13s[_currentMapItemIndex];
+            tagFilename = Common::String::format("m02/%s_xtag", item.name);
+            tagX = item.tagX;
+            tagY = item.tagY;
+        } else if (_currentMapItemIndex >= 7 && _currentMapItemIndex <= 21) {
+            const MapItem17 &item = kMapItem17s[_currentMapItemIndex - 7];
+            tagFilename = Common::String::format("m02/%s_xtag", item.name);
+            tagX = item.tagX;
+            tagY = item.tagY;
+        }
+    } else if (_hoverObjectNumber >= 0 && _hoverObjectNumber <= 5) {
+        const MapItem13 &item = kMapItem13s[_hoverObjectNumber];
+        tagFilename = Common::String::format("m02/%s_tag", item.name);
+        tagX = item.tagX;
+        tagY = item.tagY;
+    } else if (_hoverObjectNumber >= 7 && _hoverObjectNumber <= 21) {
+        const MapItem17 &item = kMapItem17s[_hoverObjectNumber - 7];
+        tagFilename = Common::String::format("m02/%s_tag", item.name);
+        tagX = item.tagX;
+        tagY = item.tagY;
+    } else if (_hoverObjectNumber == 6 || (_hoverObjectNumber >= 22 && _hoverObjectNumber <= 27)) {
+        // TODO gameMapPaletteHandlerStop();
+        // TODO paletteFadeColor(36, 63, 0, 0, 64);
+        // TODO gameMapPaletteHandlerStart();
+        _currentMapItemIndex = 6;
+    }
+
+    if (tagX != -1 && tagY != -1) {
+        _currentMapItemIndex = _hoverObjectNumber;
+        drawImageToScreen(tagFilename.c_str(), tagX, tagY);
+    }
+
+}
+
+void WaynesWorldEngine::gameMapHandleMouseClick() {
+    bool isDone = false;
+
+    if (_hoverObjectNumber == 6) {
+        _gameMapDestinationRoomNum = _gameMapRoomNumber;
+        _wayneSpriteX = _gameMapWayneSpriteX;
+        _garthSpriteX = _gameMapGarthSpriteX;
+        isDone = true;
+    } else if (_hoverObjectNumber >= 22 && _hoverObjectNumber <= 27) {
+        _gameMapFlag = false;
+        _currentRoomNumber = 100;
+        drawImageToScreen("m02/main_map", 0, 0);
+        _screen->fillSquare(kMapItem9s[_gameMapRoomNumber].x0, kMapItem9s[_gameMapRoomNumber].y0, 3, 109);
+    } else if (_hoverObjectNumber >= 0 && _hoverObjectNumber <= 5) {
+        const MapItem13 &item = kMapItem13s[_hoverObjectNumber];
+        _currentRoomNumber = item.roomNumber;
+        _currentMapItemIndex = -1;
+        gameMapSelectItem(item.name, item.animX, item.animY);
+    } else if (_hoverObjectNumber >= 7 && _hoverObjectNumber <= 21) {
+        const MapItem17 &item = kMapItem17s[_hoverObjectNumber - 7];
+        _gameMapDestinationRoomNum = item.roomNumber;
+        _wayneSpriteX = item.wayneX;
+        _wayneSpriteY = item.wayneY;
+        _garthSpriteX = item.garthX;
+        _garthSpriteY = item.garthY;
+        isDone = true;
+    }
+
+    if (isDone) {
+        gameMapFinish();
+        loadPalette("m01/wstand0");
+    }
+
+}
+
+void WaynesWorldEngine::gameMapSelectItem(const char *prefix, int animX, int animY) {
+    // sysMouseDriver(2);
+    for (int frameNum = 0; frameNum < 12; frameNum++) {
+        Common::String filename = Common::String::format("m02/%s_zm%d", prefix, frameNum);
+        drawImageToScreen(filename.c_str(), animX, animY);
+        waitMillis(50);
+    }
+    drawImageToScreen("m02/zmbtn", 125, 188);
+    if (kMapItem9s[_gameMapRoomNumber].roomNumber == _currentRoomNumber) {
+        _screen->fillSquare(kMapItem9s[_gameMapRoomNumber].x1, kMapItem9s[_gameMapRoomNumber].y1, 3, 109);
+    }
+    // sysMouseDriver(1);
+    _gameMapFlag = true;
+}
+
+} // End of namespace WaynesWorld
diff --git a/engines/waynesworld/module.mk b/engines/waynesworld/module.mk
index ea93f456591..9dd72defca3 100644
--- a/engines/waynesworld/module.mk
+++ b/engines/waynesworld/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/waynesworld
 MODULE_OBJS := \
 	waynesworld.o \
 	detection.o \
+	gamemap.o \
 	graphics.o \
 	pathfinding.o \
 	staticdata.o
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index e0a3546ad53..d828b2cebff 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -110,6 +110,7 @@ Common::Error WaynesWorldEngine::run() {
 	_from_x1 = 0;
 	_selectedDialogChoice = 0;
 	_gameState = 7;
+	_currentMapItemIndex = -1;
 
 	loadMainActorSprites();
 
@@ -138,6 +139,7 @@ Common::Error WaynesWorldEngine::run() {
 	changeRoom(0);
 
 	_gameState = 0; // DEBUG Initial _gameState 0 is set by room event in room 0
+	// _gameState = 1; // DEBUG Open map
 
 	while (!shouldQuit()) {
 		_mouseClickButtons = 0;
@@ -154,7 +156,7 @@ Common::Error WaynesWorldEngine::run() {
 		}
 		*/
 		if (_gameState == 1 && _currentRoomNumber < 100) {
-			// TODO gameMapOpen();
+			gameMapOpen();
 		}
 		g_system->updateScreen();
 	}
@@ -353,7 +355,7 @@ void WaynesWorldEngine::updateMouseMove() {
                 drawVerbLine(_verbNumber, -1, 0);
             }
         } else if (_gameState == 1) {
-            // TODO gameMapHandleMouseMove(objectIdAtPoint);
+            gameMapHandleMouseMove(objectIdAtPoint);
         }
     }
 
@@ -387,7 +389,7 @@ void WaynesWorldEngine::handleMouseLeftClick() {
         }
         break;
     case 1:
-        // TODO gameMapHandleMouseClick();
+        gameMapHandleMouseClick();
         break;
     case 2:
         handleDialogMouseClick();
@@ -416,7 +418,7 @@ void WaynesWorldEngine::handleMouseRightClick() {
         }
         break;
     case 1:
-        // TODO gameMapHandleMouseClick();
+        gameMapHandleMouseClick();
         break;
     case 2:
         handleDialogMouseClick();
@@ -479,6 +481,14 @@ void WaynesWorldEngine::loadPalette(const char *filename) {
     delete imageDecoder;
 }
 
+void WaynesWorldEngine::paletteFadeIn(int index, int count, int stepsSize) {
+	// TODO
+}
+
+void WaynesWorldEngine::paletteFadeOut(int index, int count, int stepsSize) {
+	// TODO
+}
+
 void WaynesWorldEngine::drawImageToSurfaceIntern(const char *filename, WWSurface *destSurface, int x, int y, bool transparent, bool appendRoomName) {
     Image::PCXDecoder *imageDecoder = loadImage(filename, appendRoomName);
 	if (transparent) {
@@ -618,6 +628,10 @@ void WaynesWorldEngine::playSound(const char *filename, int flag) {
 	// TODO
 }
 
+void WaynesWorldEngine::changeMusic() {
+	// TODO
+}
+
 void WaynesWorldEngine::drawInterface(int verbNum) {
     if (_currentActorNum != 0) {
         drawImageToScreen("m00/winter", 0, 151);
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 7727e5d6a8b..7ee9fa48804 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -122,6 +122,9 @@ public:
 	int _currentTextX, _currentTextY;
 	bool _isTextVisible;
 
+	// Audio
+	int _musicIndex;
+
 	// Game
 	int _gameState; // TODO Use enum
 	int _currentActorNum;
@@ -160,6 +163,13 @@ public:
 	// _roomObjects is a writable copy of kRoomObjects
 	RoomObject _roomObjects[kRoomObjectsCount];
 
+	// Game map
+	int _gameMapRoomNumber;
+	int _gameMapWayneSpriteX, _gameMapGarthSpriteX;
+	int _currentMapItemIndex;
+	int _gameMapDestinationRoomNum;
+	bool _gameMapFlag;
+
 	// Utils
 	int getRandom(int max);
 	void waitMillis(uint millis);
@@ -181,6 +191,9 @@ public:
 	WWSurface *loadRoomSurface(const char *filename);
 	void loadPalette(const char *filename);
 
+	void paletteFadeIn(int index, int count, int stepsSize);
+	void paletteFadeOut(int index, int count, int stepsSize);
+
 	// Image drawing
 	void drawImageToSurfaceIntern(const char *filename, WWSurface *destSurface, int x, int y, bool transparent, bool appendRoomName);
 	void drawImageToScreenIntern(const char *filename, int x, int y, bool transparent, bool appendRoomName);
@@ -202,6 +215,7 @@ public:
 
 	// Audio
 	void playSound(const char *filename, int flag);
+	void changeMusic();
 
 	// Interface
 	void drawInterface(int verbNum);
@@ -284,6 +298,12 @@ public:
 	void handleVerbOpen();
 	void handleVerbClose();
 
+	void gameMapOpen();
+	void gameMapFinish();
+	void gameMapHandleMouseMove(int objectNumber);
+	void gameMapHandleMouseClick();
+	void gameMapSelectItem(const char *prefix, int animX, int animY);
+
 	// Game logic
 	int logic_handleVerbPickUp();
 	int logic_handleVerbUse();


Commit: a7a0e6c710c7d4c295044bc7a0fea3e4a101ef82
    https://github.com/scummvm/scummvm/commit/a7a0e6c710c7d4c295044bc7a0fea3e4a101ef82
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:49+01:00

Commit Message:
WAYNESWORLD: Fix text wrapping

Changed paths:
    engines/waynesworld/graphics.cpp


diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
index 91fc8ca724e..c2bb4a2e777 100644
--- a/engines/waynesworld/graphics.cpp
+++ b/engines/waynesworld/graphics.cpp
@@ -195,25 +195,30 @@ void GFTFont::drawText(Graphics::Surface *surface, const char *text, int x, int
 
 void GFTFont::drawWrappedText(Graphics::Surface *surface, const char *text, int x, int y, int maxWidth, byte color) {
     const char *textP = text;
-    const char *lineP = text, *lastSpaceP = nullptr;
+    const char *lineStartP = text, *lastSpaceP = nullptr;
 	int textX = x;
     int lineWidth = 0;
     while (*textP) {
-        if (textP[1] == 32 || textP[1] == 0)
-            lastSpaceP = textP + 1;
+        if (textP > text && textP[-1] == 32)
+            lastSpaceP = textP - 1;
         int charWidth = getCharWidth(*textP);
-        if (lineWidth + charWidth > maxWidth || textP[1] == 0) {
-			for (const char *p = lineP; p < lastSpaceP; p++) {
+        if (lineWidth + charWidth > maxWidth) {
+			const char *lineEndP = lastSpaceP ? lastSpaceP : textP + 1;
+			for (const char *p = lineStartP; p < lineEndP; p++) {
 				x += drawChar(surface, (byte)*p, x, y, color);
 			}
-            if (textP[1] == 0)
-                break;
-            lineP = lastSpaceP + 1;
+            lineStartP = lastSpaceP + 1;
             textP = lastSpaceP + 1;
             lineWidth = 0;
 			x = textX;
             y += _formHeight;
-        } else {
+        } else if (textP[1] == 0) {
+			const char *lineEndP = textP + 1;
+			for (const char *p = lineStartP; p < lineEndP; p++) {
+				x += drawChar(surface, (byte)*p, x, y, color);
+			}
+			break;
+		} else {
             lineWidth += charWidth;
             textP++;
         }


Commit: 42614674428dbc9f3d138c8b5a85dd677b4ecae2
    https://github.com/scummvm/scummvm/commit/42614674428dbc9f3d138c8b5a85dd677b4ecae2
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:50+01:00

Commit Message:
WAYNESWORLD: Implement game logic

Changed paths:
  A engines/waynesworld/gamelogic.cpp
  A engines/waynesworld/gamelogic.h
    engines/waynesworld/module.mk
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
new file mode 100644
index 00000000000..88ae2541876
--- /dev/null
+++ b/engines/waynesworld/gamelogic.cpp
@@ -0,0 +1,8282 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "waynesworld/gamelogic.h"
+#include "waynesworld/graphics.h"
+#include "waynesworld/objectids.h"
+#include "common/str.h"
+#include "graphics/cursorman.h"
+
+namespace WaynesWorld {
+
+static const int kMazeInfos[77][7] = {
+	{ -5, -1, 14, -1, 23, -1, -1 },
+	{ -1, -1, 37, 45, 2, 52, -1 },
+	{ -1, -1, 24, 4, 22, 64, -1 },
+	{ -1, -1, 12, -1, -1, -1, -1 },
+	{ -1, -1, -1, 73, 62, 13, 80 },
+	{ -1, -1, 15, 93, -1, 63, -1 },
+	{ -1, -1, 44, 55, 25, 108, -1 },
+	{ -1, -1, -1, 43, 119, 119, -1 },
+	{ 46, 126, 132, -1, -1, 133, -1 },
+	{ -1, -1, 142, 53, 153, -1, -1 },
+	{ -1, -1, -1, 65, -1, -1, -1 },
+	{ -1, -1, 75, -1, 74, -1, -1 },
+	{ -1, -1, -1, -1, -1, -1, 81 },
+	{ -1, -1, 82, 85, 165, -1, -1 },
+	{ -1, -1, 92, -1, 177, -1, 181 },
+	{ -1, -1, 177, 94, 192, 208, 211 },
+	{ -1, -1, 222, 237, 242, 134, -1 },
+	{ -1, -1, 144, -1, 152, -1, -1 },
+	{ -1, 146, -1, -1, -1, -1, -1 },
+	{ -1, -1, 154, 195, -1, 193, -1 },
+	{ -1, -1, -1, 155, -1, 253, -1 },
+	{ -1, 156, 263, -3, -1, 275, -1 },
+	{ -1, -1, 162, 285, 294, -1, -1 },
+	{ -1, -1, 282, -1, 163, -1, -1 },
+	{ -1, 306, 164, -1, -1, 319, -1 },
+	{ -1, -1, -1, 208, -1, -1, -1 },
+	{ -1, -1, 324, 212, 273, -1, -1 },
+	{ -1, -1, 332, 264, -1, 215, -1 },
+	{ -1, -1, 237, 293, 342, 223, -1 },
+	{ -1, -1, 345, 283, 224, -1, -1 },
+	{ -1, -1, 353, -1, 365, -1, 241 },
+	{ -1, -1, 245, -1, -1, -1, -1 },
+	{ -1, -1, -4, 333, 262, 382, -1 },
+	{ -1, -1, 272, 323, -1, 392, -1 },
+	{ -1, -1, 284, 409, -1, 292, -1 },
+	{ -1, -1, -2, 302, 363, -1, -1 },
+	{ -1, -1, 412, 354, -1, 304, -1 },
+	{ -1, -1, -1, -1, -1, -1, -1 },
+	{ -1, -1, 325, 434, 433, -1, -1 },
+	{ -1, -1, 335, 394, 393, -1, -1 },
+	{ -1, -1, 485, 343, -1, -1, -1 },
+	{ -1, -1, 362, 414, 413, 444, -1 },
+	{ -1, -1, 455, 435, 432, -1, -1 },
+	{ -1, -1, 424, 384, 383, 423, -1 },
+	{ -1, -1, -1, -1, 415, -1, -1 },
+	{ -1, -1, 463, -1, 478, 422, -1 },
+	{ -1, -1, -1, 452, -1, 478, -1 },
+	{ -1, -1, 454, 465, -1, -1, -1 },
+	{ -1, -1, -1, -1, -1, 409, -1 },
+	{ -1, -1, 583, 563, -4, 505, -1 },
+	{ -1, -1, 552, -6, 515, 495, -1 },
+	{ -1, -1, 542, 535, 524, 504, -1 },
+	{ -1, -1, -1, -1, 514, 534, -1 },
+	{ -1, -1, -1, -1, 525, 513, -1 },
+	{ -1, -1, 512, 544, 543, 555, -1 },
+	{ -1, -1, 502, -7, -1, 545, -1 },
+	{ -1, -1, 572, 493, -1, -1, -1 },
+	{ -1, -1, 562, -1, -1, -1, -1 },
+	{ -1, -1, -1, 492, -1, -1, 591 },
+	{ -1, 586, 605, -1, -1, 644, -1 },
+	{ -1, -1, 612, 615, 623, 592, -1 },
+	{ -1, -1, 602, 625, 622, 603, -1 },
+	{ -1, -1, 614, 604, 634, 613, -1 },
+	{ -1, -1, -1, -1, 624, -1, -1 },
+	{ -1, -1, -1, -1, 595, -8, 650 },
+	{ 646, -1, 663, -1, 655, 654, -1 },
+	{ -1, -1, 675, 652, 735, -1, -1 },
+	{ -1, -1, 685, 693, 715, 662, -1 },
+	{ -1, -1, 702, 712, 703, 672, -1 },
+	{ -1, -1, 695, 673, 713, 692, -1 },
+	{ -1, -1, 682, 684, 724, 714, -1 },
+	{ -1, -1, 683, 694, 705, 674, -1 },
+	{ -1, -1, 723, 722, 704, -10, -1 },
+	{ -1, -1, 745, -1, -1, 664, -1 },
+	{ -1, -1, 755, -1, -1, 732, -1 },
+	{ -1, -1, 765, -1, -1, 742, -1 },
+	{ -1, -1, -9, -1, -1, 752, -1 }
+};
+
+static const int kRoom24MazeHolePositionsX[] = { 58, 170, 0, 67, 177, 278, 58 };
+static const int kRoom24MazeHolePositionsY[] = { 16, 16, 49, 47, 47, 49, 128 };
+static const int kRoom24MazeWaynePositionsX[] = { -1, -1, 43, 91, 199, 279, 54 };
+static const int kRoom24MazeWaynePositionsY[] = { -1, -1, 139, 123, 124, 140, 128 };
+static const int kRoom24MazeGarthPositionsX[] = { -1, -1, 49, 110, 223, 267, 152 };
+static const int kRoom24MazeGarthPositionsY[] = { -1, -1, 129, 123, 124, 128, 128 };
+
+static const int kRoom25MazeHolePositionsX[] = { 79, 289, 63, 183, 274, 75 };
+static const int kRoom25MazeHolePositionsY[] = { 48, 37, 52, 59, 50, 64 };
+
+static const int kRoom31StarPositionsX[]  = { 45, 65, 87, 107, 129 };
+static const int kRoom31StarPositionsY[]  = { 27, 39, 50, 61, 74, 27, 39, 50, 62, 75, 26, 38, 50, 63, 76, 26, 38, 50, 63, 76, 25, 38, 51, 64, 77 };
+static const int kRoom31NumberPositionsX[]  = { 77, 215, 224 };
+static const int kRoom31NumberPositionsY[]  = { 130, 125, 135 };
+
+static const int kRoom37CorrectSafeCombination[] = { 3, 5, 4, 8, 1, 8 };
+
+// GameLogic
+
+GameLogic::GameLogic(WaynesWorldEngine *vm) : _vm(vm) {
+	initVariables();
+}
+
+GameLogic::~GameLogic() {
+
+}
+
+void GameLogic::initVariables() {
+	_word_34464 = 0;
+	_word_34466 = 0;
+	_r37_safeCombinationLockIndex = 0;
+	_r37_word_35CEC = 0;
+	_r37_safeCombinationIndex = 0;
+	_r37_safeCombinationCurrentNumber = 0;
+	_r12_talkObjectNumber = 0;
+	_pizzathonListFlags1 = 0;
+	_pizzathonListFlags2 = 0;
+	_r31_flags = 0;
+	_r0_flags = 0;
+	_r4_flags = 0;
+	_r5_flags = 0;
+	_r7_flags = 0;
+	_r11_flags = 0;
+	_r32_flags = 0;
+	_r1_flags1 = 0;
+	_r1_flags2 = 0;
+	_r2_flags = 0;
+	_r6_flags = 0;
+	_r10_flags = 0;
+	_r12_flags = 0;
+	_r19_flags = 0;
+	_r9_flags = 0;
+	_r8_flags = 0;
+	_r13_flags = 0;
+	_r20_flags = 0;
+	_r29_flags = 0;
+	_r30_flags = 0;
+	_r34_flags = 0;
+	_r35_flags = 0;
+	_r37_flags = 0;
+	_r36_flags = 0;
+	_r38_flags = 0;
+	_r39_flags = 0;
+	_r10_selectedDialogChoice = -1;
+	_r9_dialogFlag = 0;
+	_r1_eventFlag = 0;
+	_r1_eventCtr = 1;
+	_r17_dialogCtr = 0;
+	_r17_eventFlag = 0;
+	_r2_backgroundValue1 = 0;
+	_r2_backgroundValue2 = 0;
+	_r7_cloudsPositionX = 0;
+	_r19_wayneSpriteX = 0;
+	_r19_garthSpriteX = 0;
+	_r24_mazeRoomNumber = 0;
+	_r24_mazeHoleNumber = 2;
+	_r25_holeIndex = 0;
+	_r31_questionsAsked = 0;
+	_r31_correctAnswerChoice = 0;
+	_r31_categoryIndex = 0;
+	_r31_questionIndex = 0;
+	_r31_categorySelected = false;
+	_r31_currentPlayer = 1;
+	memset(_r31_scores, 0, sizeof(_r31_scores));
+	memset(_r31_askedQuestions, 0, sizeof(_r31_askedQuestions));
+}
+
+int GameLogic::handleVerbPickUp() {
+    switch (_vm->_currentRoomNumber) {
+    case 0:
+        return r0_handleVerbPickUp();
+    case 1:
+        return r1_handleVerbPickUp();
+    case 2:
+        return r2_handleVerbPickUp();
+    case 3:
+    case 23:
+        return r3_handleVerbPickUp();
+    case 4:
+        return r4_handleVerbPickUp();
+    case 5:
+        return r5_handleVerbPickUp();
+    case 6:
+        return r6_handleVerbPickUp();
+    case 7:
+    case 15:
+    case 16:
+        return r7_handleVerbPickUp();
+    case 8:
+    case 21:
+    case 22:
+        return r8_handleVerbPickUp();
+    case 9:
+        return r9_handleVerbPickUp();
+    case 10:
+        return r10_handleVerbPickUp();
+    case 11:
+        return r11_handleVerbPickUp();
+    case 12:
+        return r12_handleVerbPickUp();
+    case 13:
+    case 18:
+        return r13_handleVerbPickUp();
+    case 14:
+    case 19:
+    case 20:
+        return r14_handleVerbPickUp();
+    case 30:
+        return r30_handleVerbPickUp();
+    case 32:
+    case 33:
+        return r32_handleVerbPickUp();
+    case 29:
+        return r29_handleVerbPickUp();
+    case 34:
+        return r34_handleVerbPickUp();
+    case 36:
+        return r36_handleVerbPickUp();
+    case 37:
+        return r37_handleVerbPickUp();
+    }
+	return 0;
+}
+
+int GameLogic::handleVerbUse() {
+    switch (_vm->_currentRoomNumber) {
+    case 0:
+        return r0_handleVerbUse();
+    case 1:
+        return r1_handleVerbUse();
+    case 2:
+        return r2_handleVerbUse();
+    case 3:
+    case 23:
+        return r3_handleVerbUse();
+    case 4:
+        return r4_handleVerbUse();
+    case 5:
+        return r5_handleVerbUse();
+    case 6:
+        return r6_handleVerbUse();
+    case 7:
+    case 15:
+    case 16:
+        return r7_handleVerbUse();
+    case 8:
+    case 21:
+    case 22:
+        return r8_handleVerbUse();
+    case 10:
+        return r10_handleVerbUse();
+    case 11:
+        return r11_handleVerbUse();
+    case 12:
+        return r12_handleVerbUse();
+    case 9:
+        return r9_handleVerbUse();
+    case 13:
+    case 18:
+        return r13_handleVerbUse();
+    case 14:
+    case 19:
+    case 20:
+        return r14_handleVerbUse();
+    case 24:
+        return r24_handleVerbUse();
+    case 25:
+    case 26:
+    case 27:
+        return r25_handleVerbUse();
+    case 28:
+        return r28_handleVerbUse();
+    case 29:
+        return r29_handleVerbUse();
+    case 30:
+        return r30_handleVerbUse();
+    case 31:
+        return r31_handleVerbUse();
+    case 32:
+        return r32_handleVerbUse();
+    case 34:
+        return r34_handleVerbUse();
+    case 35:
+        return r35_handleVerbUse();
+    case 36:
+        return r36_handleVerbUse();
+    case 37:
+        return r37_handleVerbUse();
+    case 17:
+        return r17_handleVerbUse();
+    case 38:
+        return r38_handleVerbUse();
+    case 39:
+        return r39_handleVerbUse();
+    }
+	return 0;
+}
+
+void GameLogic::handleVerbTalkTo() {
+    switch (_vm->_currentRoomNumber) {
+    case 1:
+        r1_handleVerbTalkTo();
+        break;
+    case 2:
+        r2_handleVerbTalkTo();
+        break;
+    case 4:
+        r4_handleVerbTalkTo();
+        break;
+    case 13:
+        r13_handleVerbTalkTo();
+        break;
+    case 9:
+        r9_handleVerbTalkTo();
+        break;
+    case 19:
+    case 20:
+        r19_handleVerbTalkTo();
+        break;
+    case 12:
+        r12_handleVerbTalkTo();
+        break;
+    case 7:
+    case 15:
+        r7_handleVerbTalkTo();
+        break;
+    case 3:
+    case 23:
+        r3_handleVerbTalkTo();
+        break;
+    case 32:
+        r32_handleVerbTalkTo();
+        break;
+    case 34:
+        r34_handleVerbTalkTo();
+        break;
+    case 35:
+        r35_handleVerbTalkTo();
+        break;
+    case 17:
+        r17_handleVerbTalkTo();
+        break;
+    }
+}
+
+int GameLogic::handleVerbPush() {
+    switch (_vm->_currentRoomNumber) {
+    case 1:
+        return r1_handleVerbPush();
+    case 10:
+        return r10_handleVerbPush();
+    case 9:
+        return r9_handleVerbPush();
+    case 5:
+        return r5_handleVerbPush();
+    case 11:
+        return r11_handleVerbPush();
+    case 7:
+    case 15:
+    case 16:
+        return r7_handleVerbPush();
+    case 37:
+        return r37_handleVerbPush();
+    }
+	return 0;
+}
+
+int GameLogic::handleVerbPull() {
+    switch (_vm->_currentRoomNumber) {
+    case 1:
+        return r1_handleVerbPull();
+    case 6:
+        return r6_handleVerbPull();
+    case 37:
+        return r37_handleVerbPull();
+    case 38:
+        return r38_handleVerbPull();
+    }
+	return 0;
+}
+
+int GameLogic::handleVerbOpen() {
+    switch (_vm->_currentRoomNumber) {
+    case 0:
+        return r0_handleVerbOpen();
+    case 1:
+        return r1_handleVerbOpen();
+    case 5:
+        return r5_handleVerbOpen();
+    case 4:
+        return r4_handleVerbOpen();
+    case 10:
+        return r10_handleVerbOpen();
+    case 6:
+        return r6_handleVerbOpen();
+    case 7:
+    case 15:
+    case 16:
+        return r7_handleVerbOpen();
+    case 8:
+    case 22:
+        return r8_handleVerbOpen();
+    case 32:
+        return r32_handleVerbOpen();
+    case 34:
+        return r34_handleVerbOpen();
+    case 39:
+        return r39_handleVerbOpen();
+    }
+	return 0;
+}
+
+int GameLogic::handleVerbClose() {
+    switch (_vm->_currentRoomNumber) {
+    case 1:
+        return r1_handleVerbClose();
+    case 8:
+    case 22:
+        return r8_handleVerbClose();
+    case 34:
+        return r34_handleVerbClose();
+    }
+	return 0;
+}
+
+int GameLogic::handleVerbGive() {
+    switch (_vm->_currentRoomNumber) {
+    case 2:
+        return r2_handleVerbGive();
+    case 6:
+        return r6_handleVerbGive();
+    case 10:
+        return r10_handleVerbGive();
+    case 13:
+        return r13_handleVerbGive();
+    case 12:
+        return r12_handleVerbGive();
+    case 9:
+        return r9_handleVerbGive();
+    }
+	return 0;
+}
+
+void GameLogic::handleDialogReply(int index, int x, int y) {
+
+    if (index < 537) {
+        _vm->displayText("c04r", index, 0, x, y, 0);
+    } else {
+        _vm->displayText("c04r2", index, 0, x, y, 0);
+    }
+
+    switch (_vm->_currentRoomNumber) {
+    case 2:
+        if (index < 300) {
+            for (int i = 0; i < 4; i++) {
+                _vm->playAnimation("btalk", 0, 2, 95, 72, 0, 100);
+            }
+        } else {
+            for (int i = 0; i < 4; i++) {
+                _vm->playAnimation("wait", 0, 2, 237, 69, 0, 100);
+            }
+        }
+        break;
+    case 4:
+        for (int i = 0; i < 4; i++) {
+            _vm->playAnimation("btalk", 1, -2, 146, 45, 0, 100);
+        }
+        break;
+    case 6:
+        if (index < 154) {
+            for (int i = 0; i < 4; i++) {
+                _vm->playAnimation("cindi", 4, 2, 143, 55, 0, 100);
+            }
+        }
+        break;
+    case 13:
+        if (index > 400) {
+            for (int i = 0; i < 4; i++) {
+                _vm->playAnimation("ctalk", 0, 2, 85, 73, 0, 100);
+            }
+        } else {
+            for (int i = 0; i < 4; i++) {
+                _vm->playAnimation("ptalk", 0, 2, 72, 60, 0, 100);
+            }
+        }
+        break;
+    case 9:
+        if (index < 192) {
+            for (int i = 0; i < 4; i++) {
+                _vm->playAnimation("talk", 0, 2, 92, 60, 0, 100);
+            }
+        } else {
+            for (int i = 0; i < 4; i++) {
+                _vm->playAnimation("mtalk", 0, 2, 215, 60, 0, 100);
+            }
+        }
+        break;
+    case 10:
+        for (int i = 0; i < 4; i++) {
+            _vm->playAnimation("talk", 0, 8, 153, 30, 1, 100);
+        }
+        break;
+    case 23:
+        for (int i = 0; i < 4; i++) {
+            _vm->playAnimation("talk", 0, 2, 75, 63, 0, 100);
+        }
+        break;
+    case 19:
+        for (int i = 0; i < 4; i++) {
+            _vm->playAnimation("gill", 1, -2, 273, 84, 0, 100);
+        }
+        break;
+    case 20:
+        for (int i = 0; i < 4; i++) {
+            _vm->playAnimation("mtalk", 0, 2, 184, 68, 0, 100);
+        }
+        break;
+    case 12:
+        if (index < 236) {
+            for (int i = 0; i < 4; i++) {
+                _vm->playAnimation("lawyer", 6, -2, 55, 84, 0, 100);
+            }
+        } else if (index < 238) {
+            for (int i = 0; i < 4; i++) {
+                _vm->playAnimation("man1", 0, 2, 108, 83, 0, 100);
+            }
+        } else if (index < 240) {
+            for (int i = 0; i < 4; i++) {
+                _vm->playAnimation("man3", 0, 2, 168, 84, 0, 100);
+            }
+        } else if (index < 242) {
+            for (int i = 0; i < 4; i++) {
+                _vm->playAnimation("man4", 0, 2, 190, 84, 0, 100);
+            }
+        }
+        break;
+    case 8:
+        for (int i = 0; i < 4; i++) {
+            _vm->playAnimation("mtalk", 0, 2, 195, 69, 0, 100);
+        }
+        break;
+    case 32:
+        for (int i = 0; i < 4; i++) {
+            _vm->playAnimation("jtalk", 0, 2, 262, 84, 0, 100);
+        }
+        break;
+    case 30:
+        for (int i = 0; i < 4; i++) {
+            _vm->playAnimation("ctalk", 0, 2, 183, 107, 0, 100);
+        }
+        break;
+    case 28:
+        for (int i = 0; i < 4; i++) {
+            _vm->playAnimation("reptalk", 0, 6, 26, 51, 1, 100);
+        }
+        break;
+    case 34:
+        for (int i = 0; i < 4; i++) {
+            _vm->playAnimation("talk", 0, 2, 203, 73, 0, 100);
+        }
+        break;
+    case 35:
+        for (int i = 0; i < 4; i++) {
+            _vm->playAnimation("cass", 0, 2, 179, 68, 0, 100);
+        }
+        break;
+    case 17:
+        for (int i = 0; i < 4; i++) {
+            _vm->playAnimation("g1talk", 0, 2, 54, 81, 0, 100);
+        }
+        break;
+    default:
+        _vm->waitSeconds(2);
+        break;
+    }
+    _vm->waitSeconds(2);
+    _vm->_isTextVisible = false;
+    _vm->refreshActors();
+}
+
+bool GameLogic::handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+    switch (_vm->_currentRoomNumber) {
+    case 0:
+        return r0_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 1:
+        return r1_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 2:
+        return r2_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 4:
+        return r4_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 5:
+        return r5_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 6:
+        return r6_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 9:
+        return r9_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 10:
+        return r10_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 13:
+        return r13_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 8:
+        return r8_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 32:
+        return r32_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 19:
+    case 20:
+        return r19_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 12:
+        return r12_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 15:
+        return r15_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 23:
+        return r3_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 30:
+        return r30_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 28:
+        return r28_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 31:
+        return r31_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 34:
+        return r34_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 35:
+        return r35_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    case 17:
+        return r17_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    }
+	return 0;
+}
+
+void GameLogic::refreshRoomBackground(int roomNum) {
+    switch (roomNum) {
+    case 0:
+        r0_refreshRoomBackground();
+        break;
+    case 1:
+        r1_refreshRoomBackground();
+        break;
+    case 2:
+        r2_refreshRoomBackground();
+        break;
+    case 3:
+        r3_refreshRoomBackground();
+        break;
+    case 5:
+        r5_refreshRoomBackground();
+        break;
+    case 6:
+        r6_refreshRoomBackground();
+        break;
+    case 4:
+        r4_refreshRoomBackground();
+        break;
+    case 7:
+        r7_refreshRoomBackground();
+        break;
+    case 8:
+        r8_refreshRoomBackground();
+        break;
+    case 10:
+        r10_refreshRoomBackground();
+        break;
+    case 11:
+        r11_refreshRoomBackground();
+        break;
+    case 12:
+        r12_refreshRoomBackground();
+        break;
+    case 16:
+        r16_refreshRoomBackground();
+        break;
+    case 13:
+        r13_refreshRoomBackground();
+        break;
+    case 14:
+        r14_refreshRoomBackground();
+        break;
+    case 19:
+        r19_refreshRoomBackground();
+        break;
+    case 20:
+        r20_refreshRoomBackground();
+        break;
+    case 9:
+        r9_refreshRoomBackground();
+        break;
+    case 18:
+        r18_refreshRoomBackground();
+        break;
+    case 22:
+        r22_refreshRoomBackground();
+        break;
+    case 24:
+        r24_refreshRoomBackground();
+        break;
+    case 25:
+    case 26:
+    case 27:
+        r25_refreshRoomBackground();
+        break;
+    case 28:
+        r28_refreshRoomBackground();
+        break;
+    case 29:
+        r29_refreshRoomBackground();
+        break;
+    case 30:
+        r30_refreshRoomBackground();
+        break;
+    case 31:
+        r31_refreshRoomBackground();
+        break;
+    case 32:
+        r32_refreshRoomBackground();
+        break;
+    case 33:
+        r33_refreshRoomBackground();
+        break;
+    case 34:
+        r34_refreshRoomBackground();
+        break;
+    case 35:
+        r35_refreshRoomBackground();
+        break;
+    case 36:
+        r36_refreshRoomBackground();
+        break;
+    case 37:
+        r37_refreshRoomBackground();
+        break;
+    case 38:
+        r38_refreshRoomBackground();
+        break;
+    case 17:
+        r17_refreshRoomBackground();
+        break;
+    case 39:
+        r39_refreshRoomBackground();
+        break;
+    }
+}
+
+void GameLogic::updateRoomAnimations(bool doUpdate) {
+    switch (_vm->_currentRoomNumber) {
+	case 1:
+		r1_updateRoomAnimations(doUpdate);
+		break;
+	case 4:
+		r4_updateRoomAnimations(doUpdate);
+		break;
+	case 6:
+		r6_updateRoomAnimations(doUpdate);
+		break;
+	case 7:
+		r7_updateRoomAnimations(doUpdate);
+		break;
+	case 8:
+		r8_updateRoomAnimations(doUpdate);
+		break;
+	case 9:
+		r9_updateRoomAnimations(doUpdate);
+		break;
+	case 11:
+		r11_updateRoomAnimations(doUpdate);
+		break;
+	case 18:
+		r18_updateRoomAnimations(doUpdate);
+		break;
+	case 29:
+		r29_updateRoomAnimations(doUpdate);
+		break;
+	case 32:
+		r32_updateRoomAnimations(doUpdate);
+		break;
+	case 34:
+		r34_updateRoomAnimations(doUpdate);
+		break;
+	case 36:
+		r36_updateRoomAnimations(doUpdate);
+		break;
+	case 38:
+		r38_updateRoomAnimations(doUpdate);
+		break;
+	}
+}
+
+void GameLogic::handleRoomEvent(int eventNum) {
+    switch (_vm->_currentRoomNumber) {
+    case 0:
+        switch (eventNum) {
+        case 1:
+            // TODO r0_handleRoomEvent1();
+            break;
+        case 2:
+            r0_handleRoomEvent2();
+            break;
+        default:
+            r0_handleRoomEvent3();
+            break;
+        }
+        break;
+    case 1:
+        r1_handleRoomEvent(false);
+        break;
+    case 5:
+        r5_handleRoomEvent();
+        break;
+    case 6:
+        switch (eventNum) {
+        case 1:
+            r6_handleRoomEvent1();
+            break;
+        case 2:
+            r6_handleRoomEvent2();
+            break;
+        case 3:
+            r6_handleRoomEvent3();
+            break;
+        case 4:
+            r6_handleRoomEvent4();
+            break;
+        }
+        break;
+    case 4:
+        r4_handleRoomEvent();
+        break;
+    case 19:
+        r19_handleRoomEvent();
+        break;
+    case 20:
+        r20_handleRoomEvent();
+        break;
+    case 13:
+        r13_handleRoomEvent();
+        break;
+    case 8:
+        switch (eventNum) {
+        case 1:
+            r8_handleRoomEvent1();
+            break;
+        case 2:
+            r8_handleRoomEvent2();
+            break;
+        case 3:
+            r8_handleRoomEvent3();
+            break;
+        case 4:
+            r8_handleRoomEvent4();
+            break;
+        }
+        break;
+    case 32:
+        r32_handleRoomEvent();
+        break;
+    case 28:
+        switch (eventNum) {
+        case 1:
+            r28_handleRoomEvent1();
+            break;
+        default:
+            r28_handleRoomEvent2();
+            break;
+        }
+        break;
+    case 29:
+        r29_handleRoomEvent();
+        break;
+    case 24:
+        switch (eventNum) {
+        case 1:
+            r24_handleRoomEvent(92, 72, -43, 90, 38, 0);
+            _vm->drawActors(0, 1, 1, 0, 65, 136, 145, 136);
+            break;
+        default:
+            r24_handleRoomEvent(203, 183, -43, 90, 38, 1);
+            _vm->drawActors(0, 1, 1, 0, 167, 136, 250, 136);
+            break;
+        }
+        break;
+    case 30:
+        switch (eventNum) {
+        case 1:
+            r30_handleRoomEvent1();
+            break;
+        case 2:
+            r30_handleRoomEvent2();
+            break;
+        }
+        break;
+    case 31:
+        switch (eventNum) {
+        case 1:
+            r31_handleRoomEvent1();
+            break;
+        case 2:
+            r31_handleRoomEvent2();
+            break;
+        case 3:
+            r31_handleRoomEvent3();
+            break;
+        case 4:
+            r31_handleRoomEvent4();
+            break;
+        case 5:
+            r31_handleRoomEvent5();
+            break;
+        }
+        break;
+    case 35:
+        r35_talkToCassandra();
+        break;
+    case 37:
+        r37_handleRoomEvent();
+        break;
+    case 36:
+        r36_handleRoomEvent();
+        break;
+    case 17:
+        switch (eventNum) {
+        case 1:
+            r17_handleRoomEvent1();
+            break;
+        case 2:
+            r17_handleRoomEvent2();
+            break;
+        case 3:
+            r17_handleRoomEvent3();
+            break;
+        }
+        break;
+    }
+}
+
+int GameLogic::r0_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdGuitar:
+		if (_vm->_currentActorNum != 0) {
+			_vm->pickupObject(kObjectIdGuitar, _r0_flags, 1, kObjectIdInventoryGuitar);
+			actionTextIndex = 1;
+		} else {
+			actionTextIndex = 2;
+		}
+		break;
+	case kObjectIdHockeyStick:
+		_vm->pickupObject(kObjectIdHockeyStick, _r0_flags, 4, kObjectIdInventoryHockeyStick);
+		actionTextIndex = 50;
+		break;
+	case kObjectIdLaundryBasket0:
+		_vm->pickupObject(kObjectIdLaundryBasket0, _r0_flags, 8, kObjectIdInventoryLaundryBasket);
+		actionTextIndex = 50;
+		break;
+	case kObjectIdStairs0:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdLaundryRoom:
+		actionTextIndex = 8;
+		break;
+	case kObjectIdCueCards:
+		actionTextIndex = 9;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r0_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdStairs0:
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdCouch:
+	case kObjectIdChair:
+		actionTextIndex = 1;
+		break;
+	case kObjectIdCueCards:
+	case kObjectIdCamera0:
+		actionTextIndex = 66;
+		break;
+	case kObjectIdGuitar:
+	case kObjectIdSchoolClothes:
+	case kObjectIdLaundryBasket:
+		actionTextIndex = 3;
+		break;
+	case kObjectIdLaundryRoom:
+		actionTextIndex = 4;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r0_handleVerbOpen() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdStairs0:
+	case kObjectIdCouch:
+		actionTextIndex = 5;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r0_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = -1;
+	replyTextY = -1;
+	switch (_vm->_selectedDialogChoice) {
+	case 29: case 30: case 31:
+		continueDialog = true;
+		replyTextIndex1 = _vm->_selectedDialogChoice + 10;
+		break;
+	case 33:
+		continueDialog = true;
+		replyTextIndex1 = 44;
+		break;
+	case 32:
+		continueDialog = true;
+		_vm->setDialogChoices(34, 35, 36, -1, -1);
+		replyTextIndex1 = 42;
+		replyTextIndex2 = 43;
+		break;
+	case 34: case 35: case 36:
+		_vm->_roomEventNum = 2;
+		break;
+	case 37: case 38: case 39: case 40: case 41:
+	case 42: case 43: case 44: case 45: case 46:
+	case 47: case 48: case 49: case 50: case 51:
+		_word_34466 = _word_34466 + 1;
+		if (_vm->_selectedDialogChoice < 47) {
+			replyTextIndex1 = 45;
+			_word_34464 = _word_34464 + 1;
+		} else {
+			replyTextIndex1 = _vm->_selectedDialogChoice - 1;
+		}
+		if (_word_34464 == 10) {
+			_vm->_roomEventNum = 3;
+		} else {
+			continueDialog = true;
+			r0_buildRandomDialogChoices(_vm->_selectedDialogChoice);
+		}
+		break;
+	default:
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r0_refreshRoomBackground() {
+	if (!(_r0_flags & 0x01)) {
+		_vm->drawRoomImageToBackground("guitar", 18, 84);
+	}
+	if (!(_r0_flags & 0x04)) {
+		_vm->drawRoomImageToBackground("hockey", 235, 66);
+	}
+	if (!(_r0_flags & 0x08)) {
+		_vm->drawRoomImageToBackground("basket", 217, 76);
+	}
+	if (!(_r0_flags & 0x02)) {
+		_vm->_roomEventNum = 1;
+	}
+}
+
+void GameLogic::r0_handleRoomEvent2() {
+	_vm->displayTextLines("c11", 1, -1, -1, 2);
+	_vm->_currentActorNum = 0;
+	_vm->displayTextLines("c11", 3, -1, -1, 2);
+	_vm->_currentActorNum = 1;
+	_vm->displayTextLines("c11", 5, -1, -1, 5);
+	_vm->setDialogChoices(-1, -1, -1, -1, -1);
+	r0_buildRandomDialogChoices(-1);
+	_vm->startDialog();
+}
+
+void GameLogic::r0_handleRoomEvent3() {
+	for (int textIndex = 0; textIndex < 4; textIndex++) {
+		_vm->displayTextLines("c11", textIndex + 10, -1, -1, 1);
+		_vm->_currentActorNum = (_vm->_currentActorNum + 1) % 2;
+		_vm->waitSeconds(1);
+	}
+	_vm->moveObjectToRoom(kObjectIdInventoryPizzathonList, 99);
+	_vm->_gameState = 0;
+	_vm->drawInterface(_vm->_verbNumber);
+}
+
+void GameLogic::r0_buildRandomDialogChoices(int selectedDialogChoice) {
+	// TODO
+}
+
+int GameLogic::r1_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdRemoteControl:
+		_vm->pickupObject(kObjectIdRemoteControl, _r1_flags1, 4, kObjectIdInventoryRemoteControl);
+		break;
+	case kObjectIdSuckCut1:
+		_vm->pickupObject(kObjectIdSuckCut1, _r1_flags1, 8, kObjectIdInventorySuckCut);
+		break;
+	case kObjectIdExtensionCord_0:
+		_vm->pickupObject(kObjectIdExtensionCord_0, _r1_flags2, 4, kObjectIdInventoryExtensionCord);
+		break;
+	case kObjectIdWindow1:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdDisplay1:
+		actionTextIndex = 8;
+		break;
+	case kObjectIdUnknown:
+		actionTextIndex = 10;
+		break;
+	case kObjectIdBoxes:
+		actionTextIndex = 11;
+		break;
+	case kObjectIdScreen:
+		actionTextIndex = 12;
+		break;
+	case kObjectIdMice:
+		actionTextIndex = 44;
+		break;
+	case kObjectIdDrGadget_1:
+		actionTextIndex = 45;
+		break;
+	case kObjectIdLock_0:
+		actionTextIndex = 46;
+		break;
+	case kObjectIdOutlet1:
+		actionTextIndex = 12;
+		break;
+	case kObjectIdExit1:
+		actionTextIndex = 14;
+		break;
+	case kObjectIdLever:
+		actionTextIndex = 60;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r1_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit1:
+		r1_uninitRoomAnimations();
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdUnknown:
+		actionTextIndex = 5;
+		break;
+	case kObjectIdSuckCut1:
+	case kObjectIdRemoteControl:
+		actionTextIndex = 3;
+		break;
+	case kObjectIdOutlet1:
+		actionTextIndex = 6;
+		break;
+	case kObjectIdBoxes:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdScreen:
+		actionTextIndex = 78;
+		break;
+	case kObjectIdMachine:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryFreshDonut) {
+			actionTextIndex = 75;
+		} else if (_vm->_firstObjectNumber == kObjectIdInventoryDayOldDonut) {
+			r1_useDayOldDonutWithMachine();
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r1_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdDrGadget_0:
+		_vm->displayTextLines("c04r", 412, 200, 30, 3);
+		_vm->setDialogChoices(387, 388, 389, 386, -1);
+		break;
+	case kObjectIdDrGadget_1:
+		_vm->displayTextLines("c04r", 112, 200, 30, 2);
+		_vm->setDialogChoices(190, 191, 192, -1, -1);
+		break;
+	default:
+		break;
+	}
+}
+
+int GameLogic::r1_handleVerbPush() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdLever:
+		if (!(_r1_flags1 & 0x20)) {
+			actionTextIndex = 1;
+		} else {
+			_r1_flags1 &= ~0x20;
+			_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r1_handleVerbPull() {
+	int actionTextIndex = -1;
+	if (!(_r1_flags1 & 0x40) || _r1_eventFlag == 0) {
+		r1_checkDrGadget();
+	} else {
+		switch (_vm->_objectNumber) {
+		case kObjectIdScreen:
+			if (_r1_eventFlag != 0) {
+				actionTextIndex = 6;
+			} else {
+				r1_pullScreen();
+			}
+			break;
+		case kObjectIdLever:
+			if (_r1_flags1 & 0x20) {
+				actionTextIndex = 2;
+			} else {
+				r1_pullLever();
+			}
+			break;
+		default:
+			actionTextIndex = 0;
+			break;
+		}
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r1_handleVerbOpen() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdSafe_0:
+		r1_openSafe();
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r1_handleVerbClose() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdSafe_0:
+		r1_closeSafe();
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r1_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 200;
+	replyTextY = 30;
+	switch (_vm->_selectedDialogChoice) {
+	case 190: case 191:
+		_vm->displayTextLines("c04r", 114, 200, 30, 4);
+		_vm->_gameState = 0;
+		break;
+	case 192: case 386: case 394:
+		_vm->_gameState = 0;
+		break;
+	case 387:
+		_vm->displayTextLines("c04r", 415, 200, 30, 3);
+		_vm->displayTextLines("c04", 390, -1, -1, 1);
+		continueDialog = true;
+		break;
+	case 388:
+		replyTextIndex1 = 418;
+		replyTextIndex2 = 419;
+		replyTextIndex3 = 420;
+		continueDialog = true;
+		_vm->setDialogChoices(391, 392, 393, 394, -1);
+		break;
+	case 389:
+		replyTextIndex1 = 421;
+		replyTextIndex2 = 422;
+		replyTextIndex3 = 423;
+		continueDialog = true;
+		break;
+	case 391:
+		_vm->displayTextLines("c04r", 424, 200, 30, 1);
+		_vm->displayTextLines("c04", 395, -1, -1, 4);
+		_vm->displayTextLines("c04r", 425, 200, 30, 2);
+		continueDialog = true;
+		break;
+	case 392:
+		_vm->displayTextLines("c04r", 427, 200, 30, 4);
+		if (_vm->getObjectRoom(kObjectIdInventoryFreshDonut) == 99 || _vm->getObjectRoom(kObjectIdInventoryDayOldDonut) == 99) {
+			_vm->displayTextLines("c04r", 431, 200, 30, 1);
+			_vm->displayTextLines("c04", 399, -1, -1, 1);
+			if (_vm->getObjectRoom(kObjectIdInventoryFreshDonut) != 99) {
+				_vm->setDialogChoices(401, -1, -1, -1, -1);
+			} else if (_vm->getObjectRoom(kObjectIdInventoryDayOldDonut) != 99) {
+				_vm->setDialogChoices(400, -1, -1, -1, -1);
+			} else {
+				_vm->setDialogChoices(400, 401, -1, -1, -1);
+			}
+			replyTextIndex1 = 433;
+		} else {
+			replyTextIndex1 = 431;
+		}
+		continueDialog = true;
+		break;
+	case 393:
+		replyTextIndex1 = 432;
+		continueDialog = true;
+		break;
+	case 400:
+		replyTextIndex1 = 434;
+		_vm->_gameState = 0;
+		break;
+	case 401:
+		replyTextIndex1 = 435;
+		replyTextIndex2 = 436;
+		_vm->_gameState = 0;
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r1_initRoomAnimations() {
+	_vm->loadAnimationSpriteRange(0, "term", 10);
+	_vm->loadAnimationSpriteRange(10, "mice", 5);
+	_vm->startRoomAnimations();
+}
+
+void GameLogic::r1_uninitRoomAnimations() {
+	_vm->stopRoomAnimations();
+	_vm->loadPalette("m01/wstand0");
+}
+
+void GameLogic::r1_updateRoomAnimations(bool doUpdate) {
+	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 5000;
+	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
+		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 500, 270, 47);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+	if (!(_r1_flags1 & 0x10) && (_vm->_animationsCtr % 200 == 55 || doUpdate)) {
+		_vm->drawAnimationSpriteToBackground(10 + _vm->getRandom(5), 179, 67);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+	if (_r1_eventFlag != 0 && _vm->_animationsCtr % 3000 == 144) {
+		_vm->_roomEventNum = _r1_eventCtr;
+	}
+}
+
+void GameLogic::r1_refreshRoomBackground() {
+	if (_pizzathonListFlags2 & 0x08) {
+		_vm->loadRoomMask(97);
+		_vm->drawRoomImageToBackground("norobot", 64, 68);
+		_vm->drawRoomImageToBackground("machine", 82, 50);
+		if (_r1_flags2 & 0x02) {
+			_vm->drawRoomImageToBackground("donon", 86, 104);
+		}
+		if (!(_r1_flags2 & 0x04)) {
+			_vm->drawRoomImageToBackground("cord", 143, 106);
+		}
+		if (!(_r1_flags2 & 0x08)) {
+			_vm->moveObjectToRoom(kObjectIdDrGadget_0, 1);
+			_vm->drawRoomImageToBackground("gadget2", 127, 82);
+			_vm->fillRoomMaskArea(100, 0, 319, 149, 1);
+		} else {
+			_vm->moveObjectToNowhere(kObjectIdDrGadget_0);
+			if (!(_r1_flags2 & 0x04)) {
+				_vm->moveObjectToRoom(kObjectIdExtensionCord_0, 1);
+			} else {
+				_vm->fillRoomMaskArea(175, 0, 319, 149, 1);
+			}
+		}
+		if (!(_r1_flags1 & 0x08)) {
+			_vm->drawRoomImageToBackground("suckcut", 32, 80);
+		}
+		_vm->moveObjectToNowhere(kObjectIdLever);
+		_vm->moveObjectToNowhere(kObjectIdMice);
+		_vm->moveObjectToNowhere(kObjectIdWindow1);
+		_vm->moveObjectToNowhere(kObjectIdScreen);
+		_vm->moveObjectToNowhere(kObjectIdDisplay1);
+		_vm->moveObjectToNowhere(kObjectIdFileCabinet);
+		_vm->moveObjectToNowhere(kObjectIdBoxes);
+		_vm->moveObjectToNowhere(kObjectIdOutlet1);
+		_vm->moveObjectToNowhere(kObjectIdSafe_0);
+		_vm->moveObjectToNowhere(kObjectIdCabinet1);
+		_vm->moveObjectToNowhere(kObjectIdRobot1);
+		_vm->moveObjectToRoom(kObjectIdMachine, 1);
+		if (!_vm->_hasRoomAnimationCallback) {
+			r1_initRoomAnimations();
+		}
+	} else {
+		if (_r1_flags1 & 0x01) {
+			_vm->drawRoomImageToBackground("screenup", 118, 53);
+			if (_r1_flags1 & 0x02) {
+				_vm->drawRoomImageToBackground("safeopen", 131, 69);
+				if (!(_r1_flags1 & 0x04)) {
+					_vm->drawRoomImageToBackground("remote", 138, 78);
+				}
+			}
+		}
+		if (!(_r1_flags1 & 0x08)) {
+			_vm->drawRoomImageToBackground("suckcut", 32, 80);
+		}
+		if (_r1_flags1 & 0x20) {
+			_vm->drawRoomImageToBackground("emptycg", 180, 66);
+		} else if (_r1_flags1 & 0x10) {
+			_vm->drawRoomImageToBackground("emptycls", 179, 67);
+		}
+		if (_r1_flags2 & ((_r1_flags1 & 0x40) + 1) & 0x01) {
+			if (_r1_flags1 & 0x08) {
+				_vm->drawRoomImageToBackground("gadin10", 0, 78);
+			} else {
+				_vm->drawRoomImageToBackground("scin10", 0, 78);
+			}
+		}
+		if (_r1_flags1 & 0x80) {
+			_vm->drawRoomImageToBackground("norobot", 64, 68);
+		}
+		if (_r1_eventFlag != 0) {
+			switch (_r1_eventCtr) {
+			case 2: case 9:
+				_vm->drawRoomImageToBackground("tt011", 119, 81);
+				break;
+			case 3:
+				_vm->drawRoomImageToBackground("tt111", 119, 81);
+				break;
+			case 4:
+				_vm->drawRoomImageToBackground("tt211", 119, 81);
+				break;
+			case 5:
+				_vm->drawRoomImageToBackground("tt311", 119, 81);
+				break;
+			case 6:
+				_vm->drawRoomImageToBackground("tt46", 119, 81);
+				break;
+			case 7:
+				_vm->drawRoomImageToBackground("tt56", 119, 81);
+				break;
+			case 8:
+				_vm->drawRoomImageToBackground("tt66", 119, 81);
+			default:
+				break;
+			}
+		}
+		if (!_vm->_hasRoomAnimationCallback) {
+			r1_initRoomAnimations();
+		}
+	}
+}
+
+void GameLogic::r1_handleRoomEvent(bool arg6) {
+	if (arg6) {
+		_r1_eventCtr = -1;
+	}
+	switch (_r1_eventCtr) {
+	case 1:
+		_r1_eventFlag = 1;
+		_r1_eventCtr = 0;
+		break;
+	case 3:
+		_vm->walkTo(209, 120, 7, 151, 127);
+		_vm->fillRoomMaskArea(0, 0, 180, 149, 1);
+		_vm->_garthSpriteX = -1;
+		_vm->playAnimation("tt0", 0, 12, 119, 81, 0, 150);
+		break;
+	case 4:
+		_vm->playAnimation("tt1", 0, 12, 119, 81, 0, 150);
+		break;
+	case 5:
+		_vm->playAnimation("tt2", 0, 12, 119, 81, 0, 150);
+		break;
+	case 6:
+		_vm->playAnimation("tt3", 0, 12, 119, 81, 0, 150);
+		_vm->playAnimation("tt3", 8, 4, 119, 81, 0, 150);
+		break;
+	case 7:
+		_vm->playAnimation("tt4", 0, 7, 119, 81, 0, 150);
+		_vm->playAnimation("tt4", 3, 4, 119, 81, 0, 150);
+		break;
+	case 8:
+		_vm->playAnimation("tt5", 0, 7, 119, 81, 0, 150);
+		_vm->playAnimation("tt5", 3, 4, 119, 81, 0, 150);
+		break;
+	case 9:
+		_vm->playAnimation("tt6", 0, 19, 119, 81, 0, 150);
+		_vm->playAnimation("tt6", 7, 7, 119, 81, 0, 150);
+		_vm->playAnimation("tt6", 6, 1, 119, 81, 0, 150);
+		break;
+	case 10:
+		_vm->playAnimation("tt7", 0, 9, 119, 81, 0, 150);
+		_vm->playAnimation("tt7", 1, 6, 119, 81, 0, 150);
+		_vm->playAnimation("tt0", 11, 1, 119, 81, 0, 150);
+		break;
+	case 11:
+		_vm->playAnimation("tt0", 10, -11, 119, 81, 0, 150);
+		break;
+	default:
+		break;
+	}
+	if (_r1_eventCtr > 0) {
+		_vm->displayText("c04r", _r1_eventCtr + 124, 0, 170, 30, 0);
+		_vm->waitSeconds(2);
+		_vm->_isTextVisible = false;
+	}
+	if (_r1_eventCtr == 9) {
+		_vm->refreshActors();
+		_vm->_currentActorNum = 0;
+		_vm->displayTextLines("c04", 199, -1, -1, 3);
+		_vm->_currentActorNum = 1;
+		_r1_eventFlag = 0;
+		_r1_eventCtr = -1;
+		_vm->_garthSpriteX = 146;
+		_vm->loadRoomMask(_vm->_currentRoomNumber);
+		_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		if ((_r1_flags1 & 0x10) && !(_r1_flags1 & 0x40)) {
+			r1_drGadgetLeaves();
+		}
+	}
+	_r1_eventCtr = _r1_eventCtr + 1;
+}
+
+void GameLogic::r1_pullScreen() {
+	if (_vm->_currentActorNum != 0) {
+		_vm->walkTo(_vm->_wayneSpriteX - 1, _vm->_wayneSpriteY, _vm->_actorSpriteValue, 180, 115);
+		_vm->_wayneSpriteX = -1;
+		_vm->playAnimation("wscreen", 0, 7, 117, 53, 0, 100);
+		_vm->_wayneSpriteX = 121;
+	} else {
+		_vm->walkTo(_vm->_garthSpriteX - 1, _vm->_garthSpriteY, _vm->_actorSpriteValue, 180, 115);
+		_vm->_garthSpriteX = -1;
+		_vm->playAnimation("gscreen", 0, 7, 117, 53, 0, 100);
+		_vm->_garthSpriteX = 121;
+	}
+	_vm->moveObjectToNowhere(kObjectIdScreen);
+	_vm->moveObjectToRoom(kObjectIdSafe_0, 1);
+	_r1_flags1 |= 0x01;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r1_openSafe() {
+	_vm->drawActorReachObject(kObjectIdSafe_0, 0);
+	if (!(_r1_flags1 & 0x04)) {
+		_vm->moveObjectToRoom(kObjectIdRemoteControl, 1);
+	}
+	_r1_flags1 |= 0x02;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r1_closeSafe() {
+	_vm->drawActorReachObject(kObjectIdSafe_0, 0);
+	_vm->moveObjectToNowhere(kObjectIdRemoteControl);
+	_r1_flags1 &= ~0x02;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r1_pullLever() {
+	if (!(_r1_flags1 & 0x10)) {
+		_vm->_wayneSpriteX = -1;
+		_r1_flags1 |= 0x10;
+		_vm->playAnimation("freemc", 0, 2, 179, 67, 0, 100);
+		_vm->playAnimation("fleemc", 0, 4, 174, 92, 0, 100);
+		_vm->moveObjectToNowhere(kObjectIdMice);
+		_vm->_wayneSpriteX = 236;
+	}
+	_r1_flags1 |= 0x20;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r1_checkDrGadget() {
+	if (!(_r1_flags2 & 0x01)) {
+		_vm->walkTo(145, 123, 6, 165, 120);
+		if (_r1_flags1 & 0x08) {
+			_vm->playAnimation("gadin", 0, 11, 0, 78, 0, 150);
+		} else {
+			_vm->playAnimation("scin", 0, 11, 0, 78, 0, 150);
+		}
+		_r1_flags2 |= 0x01;
+		_vm->moveObjectToRoom(kObjectIdDrGadget_1, 1);
+		_vm->setStaticRoomObjectPosition(1, 1, 1, 91, 78);
+		_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	}
+	_vm->displayText("c04r", 137, 0, 170, 30, 0);
+}
+
+void GameLogic::r1_useDayOldDonutWithMachine() {
+	_vm->moveObjectToNowhere(kObjectIdInventoryDayOldDonut);
+	_vm->refreshInventory(true);
+	_r1_flags2 |= 0x02;
+	_vm->playAnimation("zap", 0, 32, 81, 47, 0, 30);
+	_r1_flags2 |= 0x08;
+	_vm->changeRoom(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r1_drGadgetLeaves() {
+	_vm->displayTextLines("c04r", 134, 170, 30, 3);
+	_vm->moveObjectToNowhere(kObjectIdDrGadget_1);
+	_vm->moveObjectToNowhere(kObjectIdRobot1);
+	_r1_flags1 |= 0x40;
+	_r1_flags2 &= ~0x01;
+	_r1_flags1 |= 0x80;
+	if (_r1_flags1 & 0x08) {
+		_vm->playAnimation("gadout", 0, 21, 3, 68, 0, 100);
+	} else {
+		_vm->playAnimation("scout", 0, 21, 3, 68, 0, 100);
+	}
+	_vm->setStaticRoomObjectPosition(1, 1, 1, -1, 78);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+int GameLogic::r2_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdKitchen:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdKitchenDoor:
+		actionTextIndex = 33;
+		break;
+	case kObjectIdCounter2_0:
+		actionTextIndex = 35;
+		break;
+	case kObjectIdCounter2_1:
+		actionTextIndex = 34;
+		break;
+	case kObjectIdDonutCase:
+		actionTextIndex = 36;
+		break;
+	case kObjectIdExit2:
+		actionTextIndex = 14;
+		break;
+	case kObjectIdDonut:
+		_vm->pickupObject(kObjectIdDonut, _r2_flags, 32, kObjectIdInventoryFreshDonut);
+		_r2_flags &= ~0x20;
+		_vm->changeRoom(_vm->_currentRoomNumber);
+		break;
+	case kObjectIdBoxOfDonuts:
+		_vm->moveObjectToRoom(kObjectIdInventoryDayOldDonut, 99);
+		_vm->pickupObject(kObjectIdBoxOfDonuts, _r2_flags, 64, kObjectIdInventoryOldDonuts);
+		_r2_flags &= ~0x40;
+		_vm->changeRoom(_vm->_currentRoomNumber);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r2_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit2:
+		_r2_flags &= ~0x80;
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdDonutCase:
+		actionTextIndex = 38;
+		break;
+	case kObjectIdCounter2_0:
+		actionTextIndex = 79;
+		break;
+	case kObjectIdCounter2_1:
+		actionTextIndex = 79;
+		break;
+	case kObjectIdTables2_0:
+	case kObjectIdTables2_1:
+		actionTextIndex = 39;
+		break;
+	case kObjectIdBooths:
+		actionTextIndex = 1;
+		break;
+	case kObjectIdKitchen:
+		actionTextIndex = 40;
+		break;
+	case kObjectIdKitchenDoor:
+		actionTextIndex = 41;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r2_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdBikerGang:
+		_vm->setDialogChoices(296, 297, 298, 187, -1);
+		break;
+	case kObjectIdGirls:
+		_vm->displayTextLines("c04", 299, -1, -1, 1);
+		break;
+	case kObjectIdWaitress:
+		if (!(_r2_flags & 0x02) || !(_r2_flags & 0x04)) {
+			_vm->displayTextLines("c04r", 391, 270, 20, 1);
+			if ((_r2_flags & 0x08) && (_r2_flags & 0x10)) {
+				if (_r2_flags & 0x02) {
+					_vm->setDialogChoices(385, 386, -1, -1, -1);
+				} else {
+					if (_r2_flags & 0x04) {
+						_vm->setDialogChoices(384, 386, -1, -1, -1);
+					} else {
+						_vm->setDialogChoices(384, 385, 386, -1, -1);
+					}
+				}
+			} else {
+				_vm->setDialogChoices(365, 366, 367, 368, -1);
+			}
+		} else {
+			_vm->displayTextLines("c04r", 409, 270, 20, 1);
+		}
+	default:
+		break;
+	}
+}
+
+int GameLogic::r2_handleVerbGive() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdBikerGang:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryCandyBar) {
+			r2_giveCandyBarToBikerGang();
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	if (_vm->_selectedDialogChoice < 300) {
+		replyTextX = 70;
+		replyTextY = 30;
+	} else {
+		replyTextX = 260;
+		replyTextY = 20;
+	}
+	switch (_vm->_selectedDialogChoice) {
+	case 296:
+		if (_r2_flags & 0x01) {
+			replyTextIndex1 = 292;
+		} else {
+			replyTextIndex1 = 284;
+			replyTextIndex2 = 296;
+		}
+		_vm->_gameState = 0;
+		break;
+	case 297:
+		if (_r2_flags & 0x01) {
+			replyTextIndex1 = 293;
+		} else {
+			replyTextIndex1 = 285;
+			replyTextIndex2 = 296;
+		}
+		_vm->_gameState = 0;
+		break;
+	case 298:
+		if (_r2_flags & 0x01) {
+			_vm->setGameFlag(3);
+			replyTextIndex1 = 294;
+		} else {
+			replyTextIndex1 = 286;
+			replyTextIndex2 = 296;
+		}
+		_vm->_gameState = 0;
+		break;
+	case 187:
+		if (_r2_flags & 0x01) {
+			replyTextIndex1 = 295;
+		} else {
+			replyTextIndex1 = 287;
+			replyTextIndex2 = 296;
+		}
+		_vm->_gameState = 0;
+		break;
+	case 369: case 384:
+		if (_vm->_currentActorNum != 0 && _vm->_wayneInventory[kObjectIdInventoryDollar] < 1) {
+			replyTextIndex1 = 579;
+			continueDialog = true;
+		} else if (_vm->_currentActorNum == 0 && _vm->_garthInventory[kObjectIdInventoryDollar] < 1) {
+			replyTextIndex1 = 579;
+			continueDialog = true;
+		} else {
+			r2_handleDialogSelect369();
+		}
+		_vm->_gameState = 0;
+		break;
+	case 385:
+		if (_vm->_currentActorNum != 0 && _vm->_wayneInventory[kObjectIdInventoryDollar] < 10) {
+			replyTextIndex1 = 579;
+			continueDialog = true;
+		} else if (_vm->_currentActorNum == 0 && _vm->_garthInventory[kObjectIdInventoryDollar] < 10) {
+			replyTextIndex1 = 579;
+			continueDialog = true;
+		} else {
+			r2_handleDialogSelect385();
+		}
+		_vm->_gameState = 0;
+		break;
+	case 366: case 386:
+		_vm->_gameState = 0;
+		break;
+	case 365:
+		replyTextIndex1 = 392;
+		continueDialog = true;
+		_r2_flags |= 0x08;
+		_vm->setDialogChoices(369, 370, 366, -1, -1);
+		break;
+	case 367:
+		replyTextIndex1 = 393;
+		replyTextIndex2 = 394;
+		continueDialog = true;
+		_vm->setDialogChoices(372, 373, 374, 375, -1);
+		break;
+	case 368:
+		replyTextIndex1 = 395;
+		_vm->_gameState = 0;
+		break;
+	case 370:
+		replyTextIndex1 = 398;
+		_vm->_gameState = 0;
+		break;
+	case 372: case 373:
+		replyTextIndex1 = _vm->_selectedDialogChoice + 27;
+		continueDialog = true;
+		break;
+	case 374:
+		replyTextIndex1 = 401;
+		continueDialog = true;
+		_vm->setDialogChoices(369, 370, 366, -1, -1);
+		break;
+	case 375:
+		replyTextIndex1 = 402;
+		continueDialog = true;
+		_vm->setDialogChoices(376, 377, 378, -1, -1);
+		break;
+	case 376:
+		replyTextIndex1 = 403;
+		continueDialog = true;
+		_vm->setDialogChoices(372, 373, 374, 375, -1);
+		break;
+	case 377:
+		replyTextIndex1 = 404;
+		replyTextIndex2 = 405;
+		continueDialog = true;
+		_r2_flags |= 0x10;
+		if (_vm->_currentActorNum == 0) {
+			if (_vm->_wayneInventory[kObjectIdInventoryDollar] >= 10) {
+				_vm->setDialogChoices(379, 366, -1, -1, -1);
+			} else {
+				_vm->setDialogChoices(380, 366, -1, -1, -1);
+			}
+		} else if (_vm->_currentActorNum != 0) {
+			if (_vm->_garthInventory[kObjectIdInventoryDollar] >= 10) {
+				_vm->setDialogChoices(379, 366, -1, -1, -1);
+			} else {
+				_vm->setDialogChoices(380, 366, -1, -1, -1);
+			}
+		}
+		break;
+	case 378:
+		replyTextIndex1 = 410;
+		continueDialog = true;
+		break;
+	case 379:
+		replyTextIndex1 = 406;
+		continueDialog = true;
+		_vm->setDialogChoices(381, 382, 383, -1, -1);
+		break;
+	case 380:
+		replyTextIndex1 = 407;
+		continueDialog = true;
+		_vm->setDialogChoices(369, 370, 366, -1, -1);
+		break;
+	case 381:
+		r2_handleDialogSelect385();
+		_vm->_gameState = 0;
+		break;
+	case 382:
+		replyTextIndex1 = 400;
+		continueDialog = true;
+		break;
+	case 383:
+		replyTextIndex1 = 408;
+		continueDialog = true;
+		_vm->setDialogChoices(369, 370, 366, -1, -1);
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r2_refreshRoomBackground() {
+	if (!(_r2_flags & 0x80)) {
+		if (!(_pizzathonListFlags2 & 0x08)) {
+			_r2_backgroundValue2 = 10;
+			_r2_backgroundValue1 = 10;
+		} else {
+			_r2_backgroundValue1 = _vm->getRandom(10);
+			_r2_backgroundValue2 = _vm->getRandom(10);
+		}
+		_r2_flags |= 0x80;
+	}
+	if (_r2_backgroundValue1 < 7) {
+		_vm->drawRoomImageToBackground("geeks", 152, 72);
+	}
+	if (!(_pizzathonListFlags2 & 0x08)) {
+		_vm->drawRoomImageToBackground("gang", 0, 68);
+	} else {
+		_vm->moveObjectToNowhere(kObjectIdBikerGang);
+	}
+	if (_r2_backgroundValue2 < 5) {
+		_vm->moveObjectToNowhere(kObjectIdGirls);
+		_vm->setStaticRoomObjectPosition(2, 1, 1, 92, 103);
+	} else {
+		_vm->setStaticRoomObjectPosition(2, 2, 2, 92, 88);
+		_vm->drawRoomImageToBackgroundTransparent("table2", 92, 88);
+		_vm->moveObjectToRoom(kObjectIdGirls, 2);
+	}
+	_vm->drawRoomImageToBackground("wait1", 237, 69);
+	if (!(_r2_flags & 0x04)) {
+		_vm->drawRoomImageToBackground("box", 265, 83);
+	} else if (_r2_flags & 0x40) {
+		_vm->drawRoomImageToBackground("cbox", 226, 91);
+	}
+	if (_r2_flags & 0x20) {
+		_vm->drawRoomImageToBackground("donut", 232, 95);
+	}
+}
+
+void GameLogic::r2_giveCandyBarToBikerGang() {
+	_vm->walkTo(128, 112, 6, 150, 100);
+	_vm->playAnimation("getcb", 0, 1, 102, 79, 0, 150);
+	_r2_flags |= 0x01;
+	_vm->moveObjectToNowhere(kObjectIdInventoryCandyBar);
+	_vm->refreshInventory(false);
+	_vm->changeRoom(_vm->_currentRoomNumber);
+	for (int textIndex = 288; textIndex < 291; textIndex++) {
+		for (int i = 0; i < 4; i++) {
+			_vm->playAnimation("btalk", 0, 2, 95, 72, 0, 100);
+		}
+		_vm->displayTextLines("c04r", textIndex, 70, 30, 1);
+	}
+	_vm->playAnimation("givech", 0, 2, 94, 70, 0, 150);
+	_vm->moveObjectToRoom(kObjectIdInventoryChain, 99);
+	_vm->refreshInventory(false);
+	_vm->changeRoom(_vm->_currentRoomNumber);
+	for (int i = 0; i < 4; i++) {
+		_vm->playAnimation("btalk", 0, 2, 95, 72, 0, 100);
+	}
+	_vm->displayTextLines("c04r", 291, 70, 30, 1);
+}
+
+void GameLogic::r2_handleDialogSelect369() {
+	_vm->displayTextLines("c04r", 396, 260, 20, 1);
+	_vm->displayTextLines("c04", 371, -1, -1, 1);
+	_vm->moveObjectToNowhere(kObjectIdInventoryDollar);
+	_vm->refreshInventory(true);
+	_vm->displayTextLines("c04r", 397, 260, 20, 1);
+	_vm->playAnimation("getdon", 0, 3, 222, 69, 0, 100);
+	_r2_flags |= 0x02;
+	_r2_flags |= 0x20;
+	_vm->moveObjectToRoom(kObjectIdDonut, 2);
+	_vm->changeRoom(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r2_handleDialogSelect385() {
+	for (int i = 0; i < 10; i++) {
+		_vm->moveObjectToNowhere(kObjectIdInventoryDollar);
+	}
+	_vm->refreshInventory(true);
+	_vm->playAnimation("getbox", 0, 3, 226, 68, 0, 100);
+	_r2_flags |= 0x04;
+	_r2_flags |= 0x40;
+	_vm->moveObjectToRoom(kObjectIdBoxOfDonuts, 2);
+	_vm->changeRoom(_vm->_currentRoomNumber);
+	_vm->displayTextLines("c04r", 411, 260, 20, 1);
+}
+
+void GameLogic::r3_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdMan23:
+		if (_pizzathonListFlags2 & 0x08) {
+			_vm->displayTextLines("c04r2", 43, 100, 20, 1);
+		} else {
+			_vm->setDialogChoices(227, 228, 229, 187, -1);
+		}
+		break;
+	case kObjectIdProtesters3:
+		_vm->displayTextLines("c04r", 256, 100, 20, 2);
+		break;
+	}
+}
+
+int GameLogic::r3_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdCar3:
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdEntrance3:
+		actionTextIndex = 42;
+		break;
+	case kObjectIdProtesters3:
+		actionTextIndex = 70;
+		break;
+	case kObjectIdStairs3:
+		_vm->walkTo(207, 147, 0, -1, -1);
+		_vm->setWaynePosition(230, 105);
+		_vm->setGarthPosition(242, 103);
+		_vm->changeRoom(23);
+		break;
+	case kObjectIdExit23:
+		_vm->setWaynePosition(205, 144);
+		_vm->setGarthPosition(207, 147);
+		_vm->changeRoom(3);
+		break;
+	case kObjectIdDesk23:
+		actionTextIndex = 27;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r3_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdCar3:
+		actionTextIndex = 35;
+		break;
+	case kObjectIdProtesters3:
+		actionTextIndex = 55;
+		break;
+	case kObjectIdEntrance3:
+	case kObjectIdExit23:
+		actionTextIndex = 34;
+		break;
+	case kObjectIdStairs3:
+		actionTextIndex = 14;
+		break;
+	case kObjectIdSatdish:
+	case kObjectIdMonitors:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdSpace:
+		actionTextIndex = 33;
+		break;
+	case kObjectIdGrill:
+	case kObjectIdDesk23:
+		actionTextIndex = 30;
+		break;
+	case kObjectIdAudioControls:
+		actionTextIndex = 20;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r3_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 50;
+	replyTextY = 35;
+	switch (_vm->_selectedDialogChoice) {
+	case 227:
+		replyTextIndex1 = 167;
+		continueDialog = true;
+		break;
+	case 228:
+		if (!(_r19_flags & 0x08)) {
+			_vm->displayTextLines("c04r", 168, 50, 35, 1);
+			replyTextIndex1 = 169;
+			replyTextIndex2 = 170;
+			replyTextIndex3 = 171;
+		} else {
+			_vm->displayTextLines("c04r", 168, 50, 35, 2);
+			_vm->displayTextLines("c04r", 173, 50, 35, 2);
+			_vm->displayTextLines("c04", 230, -1, -1, 1);
+			_vm->setGameFlag(4);
+			replyTextIndex1 = 175;
+		}
+		continueDialog = true;
+		break;
+	case 229:
+		if (!(_r19_flags & 0x08)) {
+			replyTextIndex1 = 172;
+		} else {
+			replyTextIndex1 = 176;
+		}
+		continueDialog = true;
+		break;
+	case 187:
+		_vm->_gameState = 0;
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r3_refreshRoomBackground() {
+	if (_pizzathonListFlags2 & 0x08) {
+		_vm->drawRoomImageToBackground("nosat", 232, 53);
+		_vm->moveObjectToNowhere(kObjectIdProtesters3);
+		_vm->moveObjectToNowhere(kObjectIdSatdish);
+	} else {
+		_vm->drawRoomImageToBackground("elvis", 0, 47);
+		_vm->moveObjectToRoom(kObjectIdProtesters3, 3);
+	}
+}
+
+int GameLogic::r4_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdOffice4:
+		actionTextIndex = 8;
+		break;
+	case kObjectIdSign4:
+		actionTextIndex = 22;
+		break;
+	case kObjectIdCastle:
+		actionTextIndex = 32;
+		break;
+	case kObjectIdExit4:
+		actionTextIndex = 33;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r4_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit4:
+		r4_uninitRoomAnimations();
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdSign4:
+		actionTextIndex = 24;
+		break;
+	case kObjectIdOffice4:
+		actionTextIndex = 35;
+		break;
+	case kObjectIdDesks:
+	case kObjectIdDesk4:
+	case kObjectIdDraftingBoard:
+		actionTextIndex = 36;
+		break;
+	case kObjectIdCastle:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryCheesePizza) {
+			actionTextIndex = r4_useCheesePizzaWithCastle();
+		} else {
+			actionTextIndex = 37;
+		}
+		break;
+	case kObjectIdCastleDoor:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryDrumstick) {
+			actionTextIndex = r4_useDrumstickWithCastleDoor();
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	case kObjectIdDrumstick_1:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryChain) {
+			r4_useChainWithObject(true, false);
+		} else if (_vm->_firstObjectNumber == kObjectIdChain_1) {
+			r4_useChainWithObject(true, true);
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	case kObjectIdShade:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryChain) {
+			r4_useChainWithObject(false, true);
+		} else if (_vm->_firstObjectNumber == kObjectIdChain_1) {
+			r4_useChainWithObject(true, true);
+		} else if (_vm->_firstObjectNumber == kObjectIdInventoryTube) {
+			actionTextIndex = r4_useTubeWithShade();
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r4_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdTheBoss:
+		if (_pizzathonListFlags2 & 0x08) {
+			_vm->displayTextLines("c04r2", 43, 200, 20, 1);
+		} else if (!(_pizzathonListFlags1 & 0x08)) {
+			_vm->setDialogChoices(285, 286, 287, 288, -1);
+		} else {
+			_vm->displayTextLines("c04r", 251, 200, 20, 1);
+			if (!(_r4_flags & 0x01)) {
+				_vm->displayTextLines("c04r", 246, 200, 20, 2);
+				_r4_flags |= 0x01;
+				_vm->moveObjectToRoom(kObjectIdInventoryBusinessCards, 99);
+				_vm->refreshInventory(true);
+			}
+		}
+		break;
+	}
+}
+
+int GameLogic::r4_handleVerbOpen() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdCastleDoor:
+		_vm->playAnimation("opencg", 0, 4, 223, 49, 0, 100);
+		actionTextIndex = 3;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r4_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 200;
+	replyTextY = 20;
+	switch (_vm->_selectedDialogChoice) {
+	case 288:
+		if (!(_r4_flags & 0x01)) {
+			_vm->displayTextLines("c04r", 246, 200, 20, 2);
+			_r4_flags |= 0x01;
+			_vm->moveObjectToRoom(kObjectIdInventoryBusinessCards, 99);
+			_vm->refreshInventory(true);
+		}
+		_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		_vm->_gameState = 0;
+		break;
+	case 285:
+		replyTextIndex1 = 242;
+		replyTextIndex2 = 243;
+		break;
+	case 286: case 287:
+		replyTextIndex1 = 244;
+		replyTextIndex2 = 245;
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r4_initRoomAnimations() {
+	_vm->loadAnimationSpriteRange(0, "bktalk", 2);
+	_vm->loadAnimationSpriteRange(2, "bkarm", 2);
+	_vm->startRoomAnimations();
+}
+
+void GameLogic::r4_uninitRoomAnimations() {
+	_vm->stopRoomAnimations();
+}
+
+void GameLogic::r4_updateRoomAnimations(bool doUpdate) {
+	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 1000;
+	if (doUpdate) {
+		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 1000;
+	}
+	if (_vm->_animationsCtr % 350 == 0 && _vm->getRandom(10) < 3) {
+		_vm->drawAnimationSpriteToBackground(1, 8, 48);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	} else if (_vm->_animationsCtr % 400 == 0 && _vm->getRandom(10) < 8) {
+		_vm->drawAnimationSpriteToBackground(0, 8, 48);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	} else if (_vm->_animationsCtr == 100 && _vm->getRandom(10) < 1) {
+		_vm->drawAnimationSpriteToBackground(3, 11, 67);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	} else if (_vm->_animationsCtr == 150 && _vm->getRandom(10) < 2) {
+		_vm->drawAnimationSpriteToBackground(2, 11, 67);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+}
+
+void GameLogic::r4_refreshRoomBackground() {
+	char chainCheeseIn = 'n', chainUpDown1 = 'u', chainUpDown2 = 'u';
+	bool chainVisible = false;
+	if (!_vm->_hasRoomAnimationCallback) {
+		r4_initRoomAnimations();
+	}
+	if (_r4_flags & 0x02) {
+		_vm->drawRoomImageToBackground("opengate", 223, 49);
+	}
+	if (_r4_flags & 0x04) {
+		_vm->drawRoomImageToBackground("cheesein", 226, 61);
+		chainCheeseIn = 'y';
+	}
+	if (_r4_flags & 0x08) {
+		chainUpDown1 = 'c';
+		chainVisible = true;
+	}
+	if (_r4_flags & 0x10) {
+		chainUpDown2 = 'c';
+		chainVisible = true;
+	}
+	if (chainVisible) {
+		Common::String filename = Common::String::format("%c%cchain%c", chainCheeseIn, chainUpDown1, chainUpDown2);
+		_vm->drawRoomImageToBackground(filename.c_str(), 224, 57);
+	}
+	if (_r4_flags & 0x20) {
+		_vm->drawRoomImageToBackground("wcrouch", 163, 53);
+	} else if (_r4_flags & 0x40) {
+		_vm->drawRoomImageToBackground("gcrouch", 163, 53);
+	}
+}
+
+void GameLogic::r4_handleRoomEvent() {
+	_vm->changeRoom(_vm->_currentRoomNumber);
+	_vm->displayTextLines("c04r", 248, 200, 20, 3);
+	_vm->displayTextLines("c04", 289, -1, -1, 1);
+	_vm->setGameFlag(1);
+}
+
+int GameLogic::r4_useDrumstickWithCastleDoor() {
+	_r4_flags |= 0x02;
+	_vm->moveObjectToNowhere(kObjectIdCastleDoor);
+	_vm->moveObjectToNowhere(kObjectIdInventoryDrumstick);
+	_vm->moveObjectToRoom(kObjectIdDrumstick_1, 4);
+	_vm->refreshInventory(false);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	return 57;
+}
+
+int GameLogic::r4_useCheesePizzaWithCastle() {
+	_r4_flags |= 0x04;
+	_vm->moveObjectToNowhere(kObjectIdInventoryCheesePizza);
+	_vm->moveObjectToRoom(kObjectIdCheese, 4);
+	_vm->refreshInventory(false);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	return 58;
+}
+
+void GameLogic::r4_useChainWithObject(bool arg6, bool arg8) {
+	if (arg6) {
+		_r4_flags |= 0x08;
+	}
+	if (arg8) {
+		_r4_flags |= 0x10;
+	}
+	_vm->moveObjectToNowhere(kObjectIdInventoryChain);
+	_vm->moveObjectToRoom(kObjectIdChain_1, 4);
+	_vm->refreshInventory(false);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+int GameLogic::r4_useTubeWithShade() {
+	int oldX;
+	if (_vm->getObjectRoom(kObjectIdInventoryJawbreakers) != 99) {
+		return 59;
+	}
+	if (!(_r4_flags & 0x04) || !(_r4_flags & 0x08) || !(_r4_flags & 0x10) || !(_r4_flags & 0x02)) {
+		return 61;
+	}
+	_vm->walkTo(162, 46, 1, -1, -1);
+	if (_vm->_currentActorNum != 0) {
+		_r4_flags |= 0x20;
+		oldX = _vm->_wayneSpriteX;
+		_vm->_wayneSpriteX = -1;
+	} else {
+		_r4_flags |= 0x40;
+		oldX = _vm->_garthSpriteX;
+		_vm->_garthSpriteX = -1;
+	}
+	_vm->displayTextLines("c03", 62, -1, -1, 1);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->waitSeconds(2);
+	_r4_flags &= ~0x20;
+	_r4_flags &= ~0x40;
+	_vm->playAnimation("mouse", 0, 7, 212, 61, 0, 100);
+	_vm->playAnimation("shoot", 0, 14, 187, 29, 0, 100);
+	if (_vm->_currentActorNum != 0) {
+		_vm->_wayneSpriteX = oldX;
+	} else {
+		_vm->_garthSpriteX = oldX;
+	}
+	_vm->moveObjectToNowhere(kObjectIdInventoryJawbreakers);
+	_vm->moveObjectToNowhere(kObjectIdChain_1);
+	_vm->moveObjectToNowhere(kObjectIdShade);
+	_vm->moveObjectToNowhere(kObjectIdDrumstick_1);
+	_vm->moveObjectToNowhere(kObjectIdCheese);
+	_vm->moveObjectToRoom(kObjectIdCastleDoor, 4);
+	_vm->moveObjectToRoom(kObjectIdDrumstick_0, 4);
+	_vm->moveObjectToRoom(kObjectIdChain_0, 4);
+	_r4_flags &= ~0x08;
+	_r4_flags &= ~0x10;
+	_r4_flags &= ~0x02;
+	_r4_flags &= ~0x04;
+	_vm->refreshInventory(false);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->_roomEventNum = 1;
+	return 60;
+}
+
+int GameLogic::r5_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdFan:
+		actionTextIndex = 51;
+		break;
+	case kObjectIdMirror5:
+		actionTextIndex = 13;
+		break;
+	case kObjectIdExit5:
+		actionTextIndex = 14;
+		break;
+	case kObjectIdDresser:
+		actionTextIndex = 52;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r5_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit5:
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdBed:
+		actionTextIndex = 8;
+		break;
+	case kObjectIdMirror5:
+		actionTextIndex = 9;
+		break;
+	case kObjectIdFan:
+		actionTextIndex = 10;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r5_handleVerbPush() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdBed:
+		actionTextIndex = 2;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r5_handleVerbOpen() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdDresser:
+		actionTextIndex = 6;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r5_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 200;
+	replyTextY = 30;
+	switch (_vm->_selectedDialogChoice) {
+	case 170:
+		replyTextIndex1 = 88;
+		continueDialog = true;
+		break;
+	case 172: case 173:
+		replyTextIndex1 = _vm->_selectedDialogChoice - 81;
+		continueDialog = true;
+		break;
+	case 171:
+		replyTextIndex1 = 89;
+		replyTextIndex2 = 90;
+		_vm->setDialogChoices(175, 176, 177, 178, -1);
+		continueDialog = true;
+		break;
+	case 174:
+		_vm->waitSeconds(1);
+		_r5_flags &= ~0x01;
+		_vm->_gameState = 1;
+		break;
+	case 177:
+		_vm->moveObjectToRoom(kObjectIdInventoryCassContract, 99);
+		_vm->refreshInventory(false);
+		replyTextIndex1 = 95;
+		_vm->_gameState = 1;
+		break;
+	case 175: case 176: case 178:
+		replyTextIndex1 = _vm->_selectedDialogChoice - 82;
+		_r5_flags &= ~0x01;
+		_vm->_gameState = 1;
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r5_refreshRoomBackground() {
+	if (!(_r5_flags & 0x01)) {
+		_vm->_roomEventNum = 1;
+	}
+}
+
+void GameLogic::r5_handleRoomEvent() {
+	_r5_flags |= 0x01;
+	_vm->walkTo(195, 102, -1, 209, 96);
+	// TODO sub_185C0("wcass2", 0, 4, 0, 104, 170, 104, 26, 46, 8, 1);
+	// TODO sub_185C0("scass", 2, 1, 170, 104, 171, 104, 15, 46, 2, 0);
+	_vm->displayTextLines("c04r", 87, 150, 30, 1);
+	_vm->setDialogChoices(170, 171, 172, 173, 174);
+	_vm->startDialog();
+}
+
+int GameLogic::r6_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdDog:
+		actionTextIndex = 53;
+		break;
+	case kObjectIdWindow6:
+		actionTextIndex = 56;
+		break;
+	case kObjectIdFrontDoor6:
+		actionTextIndex = 56;
+		break;
+	case kObjectIdFlowerBed6_0:
+		actionTextIndex = 29;
+		break;
+	case kObjectIdFlowerBed6_1:
+		actionTextIndex = 29;
+		break;
+	case kObjectIdRope_0:
+		_vm->pickupObject(kObjectIdRope_0, _r6_flags, 2, kObjectIdInventoryRope);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r6_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdDog:
+		actionTextIndex = 67;
+		break;
+	case kObjectIdWindow6:
+		actionTextIndex = 71;
+		break;
+	case kObjectIdMirthmobile:
+		r6_uninitRoomAnimations();
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdBeam:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryRope) {
+			r6_useRopeWithBeam();
+		} else {
+			actionTextIndex = 7;
+		}
+		break;
+	case kObjectIdRope_1:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryHockeyStick) {
+			r6_useHockeyStickWithRope();
+		} else {
+			actionTextIndex = 52;
+		}
+		break;
+	case kObjectIdSeat:
+		if (_vm->_currentActorNum != 0) {
+			actionTextIndex = 53;
+		} else {
+			r6_useSeat();
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r6_handleVerbPull() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdRope_1:
+		if (!(_r6_flags & 0x10)) {
+			actionTextIndex = 3;
+		} else if (_vm->_currentActorNum == 0) {
+			actionTextIndex = 4;
+		} else {
+			r6_pullRope();
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r6_handleVerbGive() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdDog:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryLuckySausage) {
+			r6_giveLuckySausageToDog();
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r6_handleVerbOpen() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdFlowerBed6_0:
+		actionTextIndex = 10;
+		break;
+	case kObjectIdFlowerBed6_1:
+		actionTextIndex = 11;
+		break;
+	case kObjectIdGarage:
+		actionTextIndex = 9;
+		break;
+	case kObjectIdDog:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdFrontDoor6:
+		actionTextIndex = 2;
+		_vm->_roomEventNum = 3;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r6_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	if (_vm->_selectedDialogChoice < 215) {
+		replyTextX = 160;
+		replyTextY = 10;
+	} else {
+		replyTextX = 100;
+		replyTextY = 60;
+	}
+	switch (_vm->_selectedDialogChoice) {
+	case 202:
+		_vm->setDialogChoices(205, 206, 207, -1, -1);
+		continueDialog = true;
+		replyTextIndex1 = 139;
+		replyTextIndex2 = 140;
+		break;
+	case 203:
+		_vm->setDialogChoices(211, 212, 213, 214, -1);
+		continueDialog = true;
+		replyTextIndex1 = 141;
+		break;
+	case 204:
+		replyTextIndex1 = 142;
+		continueDialog = true;
+		break;
+	case 205: case 206: case 207:
+		replyTextIndex1 = _vm->_selectedDialogChoice + -62;
+		_vm->_roomEventNum = 1;
+		break;
+	case 211: case 212: case 213: case 214:
+		replyTextIndex1 = 146;
+		_vm->_gameState = 0;
+		_vm->_roomEventNum = 2;
+		break;
+	case 218: case 219: case 220:
+		replyTextIndex1 = 155;
+		replyTextIndex2 = 156;
+		replyTextIndex3 = 157;
+		_vm->_roomEventNum = 4;
+		_vm->_gameState = 0;
+		break;
+	case 221:
+		replyTextIndex1 = 158;
+		continueDialog = true;
+		break;
+	case 222:
+		_vm->_roomEventNum = 4;
+		_vm->_gameState = 0;
+		break;
+	case 224: case 226:
+		_vm->displayTextLines("c04r", 160, 100, 60, 1);
+		replyTextIndex1 = 161;
+		replyTextIndex2 = 162;
+		replyTextIndex3 = 163;
+		_vm->_gameState = 0;
+		_vm->_roomEventNum = 4;
+		break;
+	case 223:
+		replyTextIndex1 = 164;
+		continueDialog = true;
+		break;
+	case 225:
+		replyTextIndex1 = 165;
+		continueDialog = true;
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r6_initRoomAnimations() {
+	_vm->loadAnimationSpriteRange(0, "sitdog", 3);
+	_vm->startRoomAnimations();
+}
+
+void GameLogic::r6_uninitRoomAnimations() {
+	_vm->stopRoomAnimations();
+}
+
+void GameLogic::r6_updateRoomAnimations(bool doUpdate) {
+	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 1200;
+	if (doUpdate) {
+		_vm->_animationsCtr = (_vm->_animationsCtr + 200) % 1200;
+	}
+	if (!(_r6_flags & 0x01) && (_vm->_animationsCtr % 400 == 0 || doUpdate)) {
+		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 400, 49, 111);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+}
+
+void GameLogic::r6_refreshRoomBackground() {
+	if (!(_r6_flags & 0x01)) {
+		_vm->drawRoomImageToBackground("sitdog0", 49, 111);
+		_vm->fillRoomMaskArea(65, 110, 106, 124, 0);
+		_vm->fillRoomMaskArea(96, 111, 125, 123, 1);
+	}
+	if (_r6_flags & 0x02) {
+		_vm->drawRoomImageToBackground("norope", 49, 111);
+	}
+	if (_r6_flags & 0x04) {
+		_vm->drawRoomImageToBackground("throw5", 142, 37);
+	}
+	if (_r6_flags & 0x08) {
+		_vm->drawRoomImageToBackground("seat", 148, 84);
+	}
+	if (_r6_flags & 0x10) {
+		_vm->drawRoomImageToBackground("sitgarth", 151, 83);
+	}
+	if (!_vm->_hasRoomAnimationCallback) {
+		r6_initRoomAnimations();
+	}
+}
+
+void GameLogic::r6_handleRoomEvent1() {
+	_vm->displayTextLines("c04", 208, -1, -1, 3);
+	for (int i = 0; i < 4; i++) {
+		_vm->playAnimation("cindi", 4, 2, 143, 55, 0, 100);
+	}
+	_vm->displayTextLines("c04r", 141, 160, 10, 1);
+	_vm->setDialogChoices(211, 212, 213, 214, -1);
+	_vm->startDialog();
+}
+
+void GameLogic::r6_handleRoomEvent2() {
+	_vm->displayTextLines("c04", 215, -1, -1, 1);
+	for (int i = 0; i < 4; i++) {
+	  _vm->playAnimation("cindi", 4, 2, 143, 55, 0, 100);
+	}
+	_vm->displayTextLines("c04r", 147, 160, 10, 1);
+	_vm->displayTextLines("c04", 216, -1, -1, 1);
+	for (int i = 0; i < 10; i++) {
+		_vm->playAnimation("cindi", 4, 2, 143, 55, 0, 100);
+	}
+	_vm->displayTextLines("c04r", 148, 160, 10, 4);
+	_vm->displayTextLines("c04", 217, -1, -1, 1);
+	for (int i = 0; i < 7; i++) {
+		_vm->playAnimation("cindi", 4, 2, 143, 55, 0, 100);
+	}
+	_vm->displayTextLines("c04r", 152, 160, 10, 2);
+	_vm->playAnimation("cindi", 4, -5, 143, 55, 0, 100);
+	_vm->playAnimation("raiseg", 12, -13, 133, 46, 0, 150);
+	_r6_flags &= ~0x10;
+	_vm->_garthSpriteX = 155;
+	_vm->_wayneSpriteX = 150;
+	_vm->_currentActorNum = 1;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_r6_flags &= ~0x08;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_r6_flags &= ~0x04;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->moveObjectToNowhere(kObjectIdRope_1);
+	_vm->moveObjectToRoom(kObjectIdInventoryRope, 99);
+	_vm->moveObjectToRoom(kObjectIdInventoryHockeyStick, 99);
+	_vm->refreshInventory(true);
+}
+
+void GameLogic::r6_handleRoomEvent3() {
+	_vm->waitSeconds(1);
+	_vm->playSound("ss10.snd", 1);
+	_vm->walkTo(110, 107, 4, 135, 107);
+	_vm->playAnimation("dad", 0, 3, 119, 79, 0, 100);
+	if ((_r6_flags & 0x40) && !(_r6_flags & 0x20)) {
+		_vm->displayTextLines("c04r", 159, 100, 60, 1);
+		r6_handleRoomEvent4();
+	} else {
+		if (_r6_flags & 0x20) {
+			_vm->displayTextLines("c04r", 166, 100, 60, 1);
+			_vm->setDialogChoices(226, 223, 224, 225, 222);
+		} else {
+			_r6_flags |= 0x40;
+			_vm->displayTextLines("c04r", 154, 100, 60, 1);
+			_vm->setDialogChoices(218, 219, 220, 222, -1);
+		}
+		_vm->startDialog();
+	}
+}
+
+void GameLogic::r6_handleRoomEvent4() {
+	_vm->playAnimation("dad", 3, 2, 119, 79, 0, 100);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r6_giveLuckySausageToDog() {
+	_r6_flags |= 0x01;
+	_vm->drawActorReachObject(kObjectIdDog, 0);
+	_vm->playAnimation("wdog", 0, 9, 64, 111, 0, 150);
+	_vm->moveObjectToNowhere(kObjectIdDog);
+	_vm->moveObjectToRoom(kObjectIdRope_0, 6);
+	_vm->moveObjectToNowhere(kObjectIdInventoryLuckySausage);
+	_vm->refreshInventory(true);
+	_vm->fillRoomMaskArea(65, 110, 106, 124, 0);
+	_vm->fillRoomMaskArea(96, 111, 125, 123, 1);
+}
+
+void GameLogic::r6_useRopeWithBeam() {
+	if (_vm->_currentActorNum != 0) {
+		_vm->walkTo(_vm->_wayneSpriteX, _vm->_wayneSpriteY, _vm->_actorSpriteValue, 165, 99);
+	} else {
+		_vm->walkTo(165, 99, _vm->_actorSpriteValue, _vm->_garthSpriteX, _vm->_garthSpriteY);
+	}
+	_r6_flags |= 0x04;
+	_vm->playAnimation("throw", 0, 6, 142, 37, 0, 100);
+	_vm->moveObjectToRoom(kObjectIdRope_1, 6);
+	_vm->moveObjectToNowhere(kObjectIdInventoryRope);
+	_vm->refreshInventory(true);
+}
+
+void GameLogic::r6_useHockeyStickWithRope() {
+	_r6_flags |= 0x08;
+	_vm->moveObjectToRoom(kObjectIdSeat, 6);
+	_vm->moveObjectToNowhere(kObjectIdRope_1);
+	_vm->moveObjectToNowhere(kObjectIdInventoryHockeyStick);
+	_vm->refreshInventory(false);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r6_useSeat() {
+	_r6_flags |= 0x10;
+	_vm->_garthSpriteX = -1;
+	_vm->moveObjectToNowhere(kObjectIdSeat);
+	_vm->moveObjectToRoom(kObjectIdRope_1, 6);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r6_pullRope() {
+	_vm->playAnimation("raiseg", 0, 13, 133, 46, 0, 150);
+	_vm->_wayneSpriteX = -1;
+	for (int i = 0; i < 5; i++) {
+		_vm->playAnimation("knock", 0, 2, 148, 61, 0, 100);
+	}
+	_vm->waitSeconds(1);
+	_vm->_currentActorNum = 0;
+	_vm->playAnimation("cindi", 0, 5, 143, 55, 0, 100);
+	_vm->displayText("c04r", 138, 0, 160, 10, 0);
+	for (int i = 0; i < 5; i++) {
+		_vm->playAnimation("cindi", 4, 2, 143, 55, 0, 100);
+	}
+	_vm->waitSeconds(2);
+	_vm->setDialogChoices(202, 203, 204, -1, -1);
+	_vm->startDialog();
+}
+
+void GameLogic::r7_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdReceptionist:
+		if (_pizzathonListFlags2 & 0x08) {
+			_vm->displayTextLines("c04r2", 43, 250, 20, 1);
+		} else if (_vm->getObjectRoom(kObjectIdInventoryPotatoChip) == -2) {
+			_vm->setDialogChoices(54, 55, -1, -1, -1);
+		} else {
+			_vm->setDialogChoices(54, 56, -1, -1, -1);
+		}
+		break;
+	case kObjectIdProtesters7:
+		_vm->displayTextLines("c04r", 258, 250, 20, 2);
+		break;
+	}
+}
+
+int GameLogic::r7_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdFrontDoor7:
+		r7_openCloseFrontDoor(true);
+		r7_uninitRoomAnimations();
+		_vm->setWaynePosition(16, 110);
+		_vm->setGarthPosition(0, 110);
+		_vm->changeRoom(15);
+		break;
+	case kObjectIdWindow7_0:
+		r7_uninitRoomAnimations();
+		_vm->setWaynePosition(206, 85);
+		_vm->setGarthPosition(227, 82);
+		_vm->changeRoom(16);
+		break;
+	case kObjectIdCar7:
+		r7_uninitRoomAnimations();
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdFrontDoor15:
+		_vm->setWaynePosition(155, 105);
+		_vm->setGarthPosition(142, 105);
+		_vm->changeRoom(7);
+		r7_openCloseFrontDoor(false);
+		break;
+	case kObjectIdWindow16:
+		_vm->setWaynePosition(89, 103);
+		_vm->setGarthPosition(100, 103);
+		_vm->changeRoom(7);
+		break;
+	case kObjectIdProtesters7:
+		actionTextIndex = 70;
+		break;
+	case kObjectIdDoor15_1:
+		if ((_r30_flags & 0x01) && !(_r30_flags & 0x08) && _vm->_roomChangeCtr < 21) {
+			actionTextIndex = 11;
+		} else {
+			_vm->setWaynePosition(230, 140);
+			_vm->setGarthPosition(207, 143);
+			_vm->changeRoom(30);
+		}
+		break;
+	case kObjectIdWindow7_1:
+	case kObjectIdWindow7_2:
+	case kObjectIdDoor15_0:
+	case kObjectIdDoor16:
+		actionTextIndex = 11;
+		break;
+	case kObjectIdTV:
+		actionTextIndex = 12;
+		break;
+	case kObjectIdMagazines15:
+		actionTextIndex = 13;
+		break;
+	case kObjectIdMagiciansCape:
+	case kObjectIdTopHat:
+		actionTextIndex = 3;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r7_handleVerbOpen() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdFrontDoor7:
+		r7_openCloseFrontDoor(true);
+		r7_uninitRoomAnimations();
+		_vm->setWaynePosition(16, 110);
+		_vm->setGarthPosition(0, 110);
+		_vm->changeRoom(15);
+		break;
+	case kObjectIdWindow7_0:
+		r7_uninitRoomAnimations();
+		_vm->setWaynePosition(206, 85);
+		_vm->setGarthPosition(227, 82);
+		_vm->changeRoom(16);
+		break;
+	case kObjectIdFrontDoor15:
+		_vm->setWaynePosition(155, 105);
+		_vm->setGarthPosition(142, 105);
+		_vm->changeRoom(7);
+		r7_openCloseFrontDoor(false);
+		break;
+	case kObjectIdWindow16:
+		_vm->setWaynePosition(89, 103);
+		_vm->setGarthPosition(100, 103);
+		_vm->changeRoom(7);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r7_handleVerbPush() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdCar7:
+		actionTextIndex = 7;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r7_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdMagiciansCape:
+		_vm->pickupObject(kObjectIdMagiciansCape, _r7_flags, 1, kObjectIdInventoryCape);
+		actionTextIndex = 3;
+		break;
+	case kObjectIdTopHat:
+		_vm->pickupObject(kObjectIdTopHat, _r7_flags, 2, kObjectIdInventoryTopHat);
+		actionTextIndex = 4;
+		break;
+	case kObjectIdBillboard7:
+	case kObjectIdBillboard_0:
+	case kObjectIdSatelliteDish7:
+		actionTextIndex = 16;
+		break;
+	case kObjectIdWindow7_1:
+	case kObjectIdWindow7_2:
+	case kObjectIdFrontDoor15:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdWindow7_0:
+	case kObjectIdFrontDesk15:
+	case kObjectIdWindow16:
+		actionTextIndex = 14;
+		break;
+	case kObjectIdProtesters7:
+		actionTextIndex = 55;
+		break;
+	case kObjectIdReceptionist:
+	case kObjectIdDoor15_1:
+	case kObjectIdDoor16:
+		actionTextIndex = 17;
+		break;
+	case kObjectIdFrontDoor7:
+	case kObjectIdDoor15_0:
+		actionTextIndex = 8;
+		break;
+	case kObjectIdTrophies:
+		actionTextIndex = 19;
+		break;
+	case kObjectIdTV:
+		actionTextIndex = 20;
+		break;
+	case kObjectIdPictures15:
+		actionTextIndex = 21;
+		break;
+	case kObjectIdSign15_1:
+		actionTextIndex = 22;
+		break;
+	case kObjectIdMagazines15:
+		actionTextIndex = 23;
+		break;
+	case kObjectIdSign15_0:
+		actionTextIndex = 24;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r7_initRoomAnimations() {
+	_r7_cloudsPositionX = _vm->getRandom(230);
+	_vm->loadAnimationSprite(0, "clouds");
+	_vm->loadAnimationSprite(1, "bldg");
+	_vm->loadAnimationSprite(2, "sky");
+	_vm->loadAnimationSprite(3, "elvis0");
+	_vm->loadAnimationSprite(4, "elvis1");
+	_vm->startRoomAnimations();
+}
+
+void GameLogic::r7_uninitRoomAnimations() {
+	_vm->stopRoomAnimations();
+}
+
+void GameLogic::r7_updateRoomAnimations(bool doUpdate) {
+	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 4000;
+	if (_vm->_animationsCtr % 500 == 0) {
+		_r7_cloudsPositionX = (_r7_cloudsPositionX + 1) % 230;
+		_vm->drawAnimationSpriteToBackground(2, 0, 0);
+		_vm->drawAnimationSpriteToBackground(0, _r7_cloudsPositionX - 125, 13);
+		_vm->drawAnimationSpriteToBackground(1, 0, 13);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+	if (_vm->_animationsCtr % 2000 == 0) {
+		_vm->drawAnimationSpriteToBackground(3 + (_vm->_animationsCtr / 2000), 197, 68);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+}
+
+void GameLogic::r7_refreshRoomBackground() {
+	if (_pizzathonListFlags1 & 0x08) {
+		_vm->drawRoomImageToBackground("bboard", 68, 39);
+		_vm->moveObjectToRoom(kObjectIdBillboard_0, 7);
+		_vm->moveObjectToNowhere(kObjectIdBillboard7);
+	}
+	if (_r7_flags & 0x04) {
+		_vm->drawRoomImageToBackground("opendoor", 155, 73);
+	}
+	if (!(_pizzathonListFlags2 & 0x08)) {
+		_vm->drawRoomImageToBackground("elvis0", 197, 68);
+		_vm->moveObjectToRoom(kObjectIdProtesters7, 7);
+		if (!_vm->_hasRoomAnimationCallback) {
+			r7_initRoomAnimations();
+		}
+	} else {
+		_vm->moveObjectToNowhere(kObjectIdProtesters7);
+	}
+}
+
+void GameLogic::r7_openCloseFrontDoor(bool isOpen) {
+	if (isOpen) {
+		_vm->drawActorReachObject(kObjectIdFrontDoor7, 0);
+		_r7_flags |= 0x04;
+		_vm->waitMillis(500);
+	} else {
+		_vm->waitMillis(500);
+		_r7_flags &= ~0x04;
+	}
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+int GameLogic::r8_handleVerbClose() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdDoor8:
+		if (_r8_flags & 0x01) {
+			actionTextIndex = 1;
+		} else {
+			r8_openCloseDoor(false);
+		}
+		break;
+	case kObjectIdCabinet22_0:
+		if (!(_r8_flags & 0x02)) {
+			actionTextIndex = 1;
+		} else {
+			r8_openCloseCabinetDoor1(false);
+		}
+		break;
+	case kObjectIdCabinet22_1:
+		if (!(_r8_flags & 0x04)) {
+			actionTextIndex = 1;
+		} else {
+			r8_openCloseCabinetDoor2(false);
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r8_handleVerbOpen() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdDoor8:
+		if (!(_r8_flags & 0x01)) {
+			actionTextIndex = 1;
+		} else {
+			r8_openCloseDoor(true);
+		}
+		break;
+	case kObjectIdCabinet22_0:
+		if (_r8_flags & 0x02) {
+			actionTextIndex = 1;
+		} else {
+			r8_openCloseCabinetDoor1(true);
+		}
+		break;
+	case kObjectIdCabinet22_1:
+		if (_r8_flags & 0x04) {
+			actionTextIndex = 1;
+		} else {
+			r8_openCloseCabinetDoor2(true);
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r8_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdDoor8:
+		if (_r8_flags & 0x01) {
+			r8_openCloseDoor(true);
+		}
+		_vm->stopRoomAnimations();
+		_r8_flags &= ~0x08;
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdHallway8:
+	case kObjectIdFoyer:
+	case kObjectIdOffice21:
+	case kObjectIdHallway22:
+		actionTextIndex = -1;
+		break;
+	case kObjectIdChairs22:
+		actionTextIndex = 1;
+		break;
+	case kObjectIdMirror21_0:
+	case kObjectIdMirror21_1:
+		actionTextIndex = 9;
+		break;
+	case kObjectIdCloset:
+		actionTextIndex = 14;
+		break;
+	case kObjectIdStaircase:
+		actionTextIndex = 15;
+		break;
+	case kObjectIdFountain8:
+		actionTextIndex = 16;
+		break;
+	case kObjectIdDivan:
+		actionTextIndex = 17;
+		break;
+	case kObjectIdTorch21_0:
+	case kObjectIdTorch21_1:
+		actionTextIndex = 18;
+		break;
+	case kObjectIdDesk22:
+		actionTextIndex = 19;
+		break;
+	case kObjectIdFireplace:
+	case kObjectIdWood:
+		actionTextIndex = 20;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r8_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdStaircase:
+	case kObjectIdFountain8:
+	case kObjectIdOffice21:
+	case kObjectIdHallway22:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdDoor8:
+	case kObjectIdHallway8:
+	case kObjectIdBookshelf:
+		actionTextIndex = 8;
+		break;
+	case kObjectIdFireplace:
+	case kObjectIdPictures22:
+		actionTextIndex = 16;
+		break;
+	case kObjectIdCloset:
+	case kObjectIdFoyer:
+		actionTextIndex = 14;
+		break;
+	case kObjectIdBush:
+		actionTextIndex = 25;
+		break;
+	case kObjectIdMirror21_0:
+	case kObjectIdMirror21_1:
+	case kObjectIdTorch21_0:
+	case kObjectIdTorch21_1:
+	case kObjectIdPictures21:
+		actionTextIndex = 12;
+		break;
+	case kObjectIdWood:
+		actionTextIndex = 26;
+		break;
+	case kObjectIdMap:
+		_vm->pickupObject(kObjectIdMap, _r29_flags, 2, kObjectIdInventorySewerMap);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r8_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 200;
+	replyTextY = 30;
+	switch (_vm->_selectedDialogChoice) {
+	case 9:
+		replyTextIndex1 = 12;
+		replyTextIndex2 = 13;
+		replyTextIndex3 = 14;
+		_r8_flags |= 0x10;
+		_vm->_roomEventNum = 2;
+		break;
+	case 10:
+		replyTextIndex1 = 15;
+		_r8_flags |= 0x10;
+		_vm->_roomEventNum = 2;
+		break;
+	case 11:
+		_vm->waitSeconds(1);
+		_r8_flags &= ~0x08;
+		_vm->stopRoomAnimations();
+		_vm->_gameState = 1;
+		break;
+	case 473:
+		_vm->displayTextLines("c04r2", 6, 200, 30, 2);
+		_vm->displayTextLines("c04r2", 14, 200, 30, 1);
+		_vm->playAnimation("spit", 0, 6, 179, 66, 0, 100);
+		replyTextIndex1 = 552;
+		replyTextIndex2 = 553;
+		_r8_flags &= ~0x08;
+		_vm->stopRoomAnimations();
+		_vm->_gameState = 1;
+		break;
+	case 474:
+		_vm->displayTextLines("c04r2", 8, 200, 30, 2);
+		_vm->displayTextLines("c04r2", 14, 200, 30, 1);
+		_vm->playAnimation("spit", 0, 6, 179, 66, 0, 100);
+		replyTextIndex1 = 552;
+		replyTextIndex2 = 553;
+		_r8_flags &= ~0x08;
+		_vm->stopRoomAnimations();
+		_vm->_gameState = 1;
+		break;
+	case 475:
+		_vm->displayTextLines("c04r2", 10, 200, 30, 2);
+		_vm->displayTextLines("c04r2", 14, 200, 30, 1);
+		_vm->playAnimation("spit", 0, 6, 179, 66, 0, 100);
+		replyTextIndex1 = 552;
+		replyTextIndex2 = 553;
+		_r8_flags &= ~0x08;
+		_vm->stopRoomAnimations();
+		_vm->_gameState = 1;
+		break;
+	case 476:
+		_vm->displayTextLines("c04r2", 12, 200, 30, 3);
+		_vm->playAnimation("spit", 0, 6, 179, 66, 0, 100);
+		replyTextIndex1 = 552;
+		replyTextIndex2 = 553;
+		_r8_flags &= ~0x08;
+		_vm->stopRoomAnimations();
+		_vm->_gameState = 1;
+		break;
+	case 478:
+		_r8_flags &= ~0x08;
+		_vm->stopRoomAnimations();
+		_vm->_gameState = 1;
+		break;
+	case 479:
+		replyTextIndex1 = 555;
+		continueDialog = true;
+		break;
+	case 480:
+		replyTextIndex1 = 556;
+		continueDialog = true;
+		break;
+	case 477: case 481:
+		_vm->_roomEventNum = 3;
+		replyTextIndex1 = 557;
+		break;
+	case 482:
+		replyTextIndex1 = 560;
+		continueDialog = true;
+		break;
+	case 483:
+		replyTextIndex1 = 561;
+		continueDialog = true;
+		break;
+	case 484:
+		replyTextIndex1 = 562;
+		continueDialog = true;
+		_vm->setDialogChoices(485, 486, 487, -1, -1);
+		break;
+	case 485: case 486: case 487:
+		_vm->displayTextLines("c04r2", 26, 200, 30, 1);
+		_vm->displayTextLines("c04", 488, -1, -1, 7);
+		_vm->displayTextLines("c04r2", 27, 200, 30, 1);
+		_vm->displayTextLines("c04", 495, -1, -1, 1);
+		_vm->displayTextLines("c04r2", 28, 200, 30, 1);
+		_vm->displayTextLines("c04", 496, -1, -1, 2);
+		_vm->displayTextLines("c04r2", 29, 200, 30, 5);
+		for (int i = 0; i < 15; i++) {
+			_vm->moveObjectToRoom(kObjectIdInventoryDollar, 99);
+		}
+		_vm->refreshInventory(true);
+		_vm->setDialogChoices(498, 499, 500, -1, -1);
+		continueDialog = true;
+		break;
+	case 498:
+		replyTextIndex1 = 571;
+		continueDialog = true;
+		_vm->_roomEventNum = 4;
+		_vm->_gameState = 0;
+		break;
+	case 499:
+		replyTextIndex1 = 572;
+		replyTextIndex2 = 573;
+		replyTextIndex3 = 574;
+		continueDialog = true;
+		_vm->_roomEventNum = 4;
+		_vm->_gameState = 0;
+		break;
+	case 500:
+		replyTextIndex1 = 575;
+		continueDialog = true;
+		_vm->_roomEventNum = 4;
+		_vm->_gameState = 0;
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r8_initRoomAnimations() {
+	_vm->loadAnimationSpriteRange(0, "fount", 9);
+	_vm->startRoomAnimations();
+}
+
+void GameLogic::r8_updateRoomAnimations(bool doUpdate) {
+	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 4500;
+	if (doUpdate) {
+		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 4500;
+	}
+	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
+		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 500, 85, 38);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+}
+
+void GameLogic::r8_refreshRoomBackground() {
+	if (!(_r8_flags & 0x01)) {
+		_vm->drawRoomImageToBackground("opendoor", 259, 51);
+	}
+	if (!(_r8_flags & 0x08) && ((_r8_flags & 0x80) || (_r38_flags & 0x08))) {
+		_vm->_roomEventNum = 1;
+	}
+	if (!_vm->_hasRoomAnimationCallback) {
+		r8_initRoomAnimations();
+	}
+}
+
+void GameLogic::r8_handleRoomEvent1() {
+	_r8_flags |= 0x08;
+	_vm->playAnimation("mwalk0", 0, 23, 0, 94, 0, 100);
+	_vm->playAnimation("mwalk1", 0, 10, 188, 66, 0, 100);
+	if (_r38_flags & 0x08) {
+		_vm->displayTextLines("c04r", 349, 200, 30, 9);
+		_r8_flags |= 0x20;
+		// TODO _quitGame = true;
+	} else {
+		if (_pizzathonListFlags2 & 0x08) {
+			if (_r8_flags & 0x40) {
+				_vm->displayTextLines("c04r2", 17, 200, 30, 1);
+				if (_vm->getObjectRoom(kObjectIdInventorySinusPotion) == 99) {
+					_vm->setDialogChoices(478, 479, 480, 481, -1);
+				} else {
+					_vm->setDialogChoices(478, 479, 480, -1, -1);
+				}
+				_vm->startDialog();
+			} else {
+				_r8_flags |= 0x40;
+				_vm->displayTextLines("c04r2", 0, 200, 30, 3);
+				_vm->playAnimation("spit", 0, 6, 179, 66, 0, 100);
+				_vm->displayTextLines("c04r2", 3, 200, 30, 3);
+				if (_vm->getObjectRoom(kObjectIdInventorySinusPotion) == 99) {
+					_vm->setDialogChoices(473, 474, 475, 476, 477);
+				} else {
+					_vm->setDialogChoices(473, 474, 475, 476, -1);
+				}
+				_vm->startDialog();
+			}
+		} else if (!(_r8_flags & 0x10)) {
+			_vm->displayTextLines("c04r", 10, 200, 30, 2);
+			_vm->setDialogChoices(9, 10, 11, -1, -1);
+			_vm->startDialog();
+		} else {
+			_vm->displayTextLines("c04r", 19, 200, 30, 2);
+			_vm->displayText("c04", 17, 0, -1, -1, 0);
+			_vm->waitSeconds(2);
+			_r8_flags &= ~0x08;
+			_vm->stopRoomAnimations();
+			_vm->_gameState = 1;
+		}
+	}
+}
+
+void GameLogic::r8_handleRoomEvent2() {
+	_vm->displayTextLines("c04", 12, -1, -1, 4);
+	_vm->displayTextLines("c04r", 16, 200, 30, 3);
+	_vm->displayText("c04", 16, 0, -1, -1, 0);
+	_vm->waitSeconds(1);
+	_r8_flags &= ~0x08;
+	_vm->stopRoomAnimations();
+	_vm->_gameState = 1;
+}
+
+void GameLogic::r8_handleRoomEvent3() {
+	_vm->moveObjectToNowhere(kObjectIdInventorySinusPotion);
+	_vm->refreshInventory(true);
+	_vm->playAnimation("drink", 0, 25, 188, 64, 0, 100);
+	_vm->displayTextLines("c04r2", 21, 200, 30, 2);
+	_vm->setDialogChoices(482, 483, 484, -1, -1);
+	_vm->startDialog();
+}
+
+void GameLogic::r8_handleRoomEvent4() {
+	_vm->displayTextLines("c04r2", 39, 200, 30, 3);
+	_r8_flags |= 0x80;
+	_vm->playAnimation("maygo", 0, 16, 178, 40, 0, 100);
+}
+
+void GameLogic::r8_openCloseDoor(bool isOpen) {
+	_vm->drawActorReachObject(kObjectIdDoor8, 0);
+	if (isOpen) {
+		_r8_flags &= ~0x01;
+	} else {
+		_r8_flags |= 0x01;
+	}
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r8_openCloseCabinetDoor1(bool isOpen) {
+	_vm->drawActorReachObject(kObjectIdDoor8, 0);
+	if (isOpen) {
+		_r8_flags |= 0x02;
+	} else {
+		_r8_flags &= ~0x02;
+	}
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r8_openCloseCabinetDoor2(bool isOpen) {
+	_vm->drawActorReachObject(kObjectIdDoor8, 0);
+	if (isOpen) {
+		_r8_flags |= 0x04;
+	} else {
+		_r8_flags &= ~0x04;
+	}
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+int GameLogic::r9_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdEugene9:
+		actionTextIndex = 29;
+		break;
+	case kObjectIdMan9:
+		actionTextIndex = 29;
+		break;
+	case kObjectIdExit9:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdCounter9:
+	case kObjectIdDisplay9:
+		actionTextIndex = 8;
+		break;
+	case kObjectIdHorrorSection:
+		actionTextIndex = 58;
+		break;
+	case kObjectIdComedySection:
+		actionTextIndex = 59;
+		break;
+	case kObjectIdNewReleases:
+		actionTextIndex = 57;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r9_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdEugene9:
+		actionTextIndex = 72;
+		break;
+	case kObjectIdMan9:
+		actionTextIndex = 68;
+		break;
+	case kObjectIdHorrorSection:
+		actionTextIndex = 73;
+		break;
+	case kObjectIdComedySection:
+		actionTextIndex = 74;
+		break;
+	case kObjectIdExit9:
+		r9_uninitRoomAnimations();
+		_vm->_gameState = 1;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r9_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdEugene9:
+		if (_pizzathonListFlags2 & 0x08) {
+			_vm->displayTextLines("c04r2", 43, 250, 25, 1);
+		} else if (_vm->getObjectRoom(kObjectIdInventoryCassContract) == 99) {
+			_r9_dialogFlag = 0;
+			_vm->setDialogChoices(231, 232, 233, 240, 235);
+		} else if (!(_pizzathonListFlags1 & 0x02)) {
+			_r9_dialogFlag = 1;
+			_vm->setDialogChoices(231, 232, 233, 234, 235);
+		} else {
+			_r9_dialogFlag = 2;
+			_vm->setDialogChoices(243, 232, 233, 244, 235);
+		}
+		break;
+	case kObjectIdMan9:
+		if (!(_r9_flags & 0x02)) {
+			_vm->displayTextLines("c04", 245, -1, -1, 1);
+			_vm->displayTextLines("c04r", 192, 250, 25, 1);
+			for (int i = 0; i < 8; i++) {
+				_vm->playAnimation("utrick", 0, 2, 206, 58, 0, 100);
+			}
+			_vm->loadRoomBackground(_vm->_currentRoomNumber);
+			_vm->displayTextLines("c04r", 193, 250, 25, 1);
+			_vm->setDialogChoices(246, 247, 248, 249, 250);
+		} else {
+			_vm->setDialogChoices(246, 253, 254, 249, 255);
+		}
+		break;
+	}
+}
+
+int GameLogic::r9_handleVerbPush() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdEugene9:
+		actionTextIndex = 5;
+		break;
+	case kObjectIdMan9:
+		actionTextIndex = 6;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r9_handleVerbGive() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdMan9:
+		if (_vm->_currentActorNum != 0) {
+			_vm->walkTo(_vm->_wayneSpriteX - 1, _vm->_wayneSpriteY, _vm->_actorSpriteValue, 173, 86);
+		} else {
+			_vm->walkTo(173, 86, _vm->_actorSpriteValue, _vm->_garthSpriteX - 1, _vm->_garthSpriteY);
+		}
+		if (_vm->_firstObjectNumber == kObjectIdInventoryCape || _vm->_firstObjectNumber == kObjectIdInventoryTopHat) {
+			r9_giveCoatOrTopHatToMan();
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r9_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	if (_vm->_selectedDialogChoice < 245) {
+		replyTextX = 150;
+		replyTextY = 15;
+	} else {
+		replyTextX = 250;
+		replyTextY = 25;
+	}
+	switch (_vm->_selectedDialogChoice) {
+	case 232: case 234:
+		replyTextIndex1 = 178;
+		continueDialog = true;
+		break;
+	case 231: case 240:
+		if (!(_pizzathonListFlags1 & 0x01)) {
+			_vm->setDialogChoices(236, 237, 238, 239, 187);
+			replyTextIndex1 = 177;
+			continueDialog = true;
+		} else {
+			_vm->displayTextLines("c04r", 184, 150, 15, 2);
+			replyTextIndex1 = 186;
+			replyTextIndex2 = 187;
+			replyTextIndex3 = 188;
+			_vm->setDialogChoices(241, 242, -1, -1, -1);
+			continueDialog = true;
+			_vm->moveObjectToRoom(kObjectIdInventoryContract, 99);
+		}
+		break;
+	case 233:
+		replyTextIndex1 = 179;
+		continueDialog = true;
+		break;
+	case 187: case 235: case 250: case 255:
+		_vm->_gameState = 0;
+		break;
+	case 236: case 237: case 238: case 239:
+		replyTextIndex1 = _vm->_selectedDialogChoice + -56;
+		if (_r9_dialogFlag == 0) {
+			_vm->setDialogChoices(231, 232, 233, 234, 235);
+		} else if (_r9_dialogFlag == 1) {
+			_vm->setDialogChoices(231, 232, 233, 240, 235);
+		} else {
+			continueDialog = true;
+		}
+		break;
+	case 241:
+		replyTextIndex1 = 189;
+		_vm->setGameFlag(6);
+	case 242:
+		_vm->_gameState = 0;
+		break;
+	case 243:
+		replyTextIndex1 = 190;
+		continueDialog = true;
+		break;
+	case 244:
+		replyTextIndex1 = 191;
+		continueDialog = true;
+		break;
+	case 246:
+		if (!(_r9_flags & 0x02)) {
+			replyTextIndex1 = 194;
+		} else if (_r9_flags & 0x04) {
+			replyTextIndex1 = 204;
+		} else {
+			_vm->setGameFlag(9);
+			_r9_flags |= 0x04;
+			replyTextIndex1 = 203;
+		}
+		continueDialog = true;
+		break;
+	case 247:
+		replyTextIndex1 = 195;
+		continueDialog = true;
+		break;
+	case 248:
+		_vm->displayTextLines("c04r", 196, 250, 25, 1);
+		_vm->displayTextLines("c04", 251, -1, -1, 1);
+		_vm->_currentActorNum = (_vm->_currentActorNum + 1) % 2;
+		_vm->displayTextLines("c04", 252, -1, -1, 1);
+		_vm->_currentActorNum = (_vm->_currentActorNum + 1) % 2;
+		replyTextIndex1 = 197;
+		continueDialog = true;
+		break;
+	case 249:
+		if (!(_r9_flags & 0x02)) {
+			replyTextIndex1 = 198;
+		} else {
+			replyTextIndex1 = 210;
+		}
+		continueDialog = true;
+		break;
+	case 253:
+		replyTextIndex1 = 205;
+		replyTextIndex2 = 206;
+		replyTextIndex3 = 207;
+		continueDialog = true;
+		break;
+	case 254:
+		replyTextIndex1 = 208;
+		replyTextIndex2 = 209;
+		continueDialog = true;
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r9_initRoomAnimations() {
+	_vm->loadAnimationSpriteRange(0, "sign", 3);
+	_vm->startRoomAnimations();
+}
+
+void GameLogic::r9_uninitRoomAnimations() {
+	_vm->stopRoomAnimations();
+}
+
+void GameLogic::r9_updateRoomAnimations(bool doUpdate) {
+	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 3000;
+	if (doUpdate) {
+		_vm->_animationsCtr = (_vm->_animationsCtr + 200) % 5000;
+	}
+	if (_vm->_animationsCtr % 1000 == 0 || doUpdate) {
+		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 1000, 124, 27);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+}
+
+void GameLogic::r9_refreshRoomBackground() {
+	if (!(_pizzathonListFlags1 & 0x01)) {
+		_vm->drawRoomImageToBackground("man", 211, 59);
+	}
+	if (!_vm->_hasRoomAnimationCallback) {
+		r9_initRoomAnimations();
+	}
+}
+
+void GameLogic::r9_giveCoatOrTopHatToMan() {
+	_vm->moveObjectToNowhere(_vm->_firstObjectNumber);
+	_vm->refreshInventory(true);
+	if (!(_r9_flags & 0x01)) {
+		_vm->displayTextLines("c04r", 199, 250, 25, 1);
+		_r9_flags |= 0x01;
+	} else {
+		_vm->displayTextLines("c04r", 200, 250, 25, 2);
+		_vm->playAnimation("strick", 0, 17, 191, 32, 0, 100);
+		for (int i = 0; i < 5; i++) {
+			_vm->playAnimation("strick", 16, -2, 191, 32, 0, 100);
+		}
+		_vm->playAnimation("strick", 14, -15, 191, 32, 0, 100);
+		_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		_vm->displayTextLines("c04r", 202, 250, 25, 1);
+		_vm->setDialogChoices(246, 253, 254, 249, 255);
+		_vm->startDialog();
+		_r9_flags |= 0x02;
+	}
+}
+
+int GameLogic::r10_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdTicket:
+		r10_handleVerbPickUpTicket();
+		break;
+	case kObjectIdCandyBar:
+		r10_handleVerbPickUpCandyBar();
+		break;
+	case kObjectIdGum:
+		if (!(_r10_flags & 0x04)) {
+			_vm->displayText("c04r", 6, 0, 320, 70, 0);
+		} else {
+			r10_handleVerbPickUpGum();
+		}
+		break;
+	case kObjectIdJawbreakers:
+		if (!(_r10_flags & 0x08)) {
+			_vm->displayText("c04r", 7, 0, 320, 70, 0);
+		} else {
+			r10_handleVerbPickUpJawbreakers();
+		}
+		break;
+	case kObjectIdNewspapers:
+	case kObjectIdMagazines10:
+		actionTextIndex = 15;
+		break;
+	case kObjectIdHotDogs:
+		actionTextIndex = 53;
+		break;
+	case kObjectIdSign10:
+		actionTextIndex = 16;
+		break;
+	case kObjectIdCigarettes:
+		actionTextIndex = 54;
+		break;
+	case kObjectIdExit10:
+		actionTextIndex = 8;
+		break;
+	case kObjectIdSalesgirl:
+		if (_vm->_currentActorNum != 0) {
+			actionTextIndex = 17;
+		} else {
+			actionTextIndex = 18;
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r10_handleVerbPickUpCandyBar() {
+	_r10_flags &= ~0x40;
+	_vm->moveObjectToNowhere(kObjectIdCandyBar);
+	_vm->moveObjectToRoom(kObjectIdInventoryCandyBar, 99);
+	_vm->refreshInventory(false);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r10_handleVerbPickUpTicket() {
+	_r10_flags &= ~0x02;
+	_vm->moveObjectToNowhere(kObjectIdTicket);
+	_vm->moveObjectToRoom(kObjectIdInventoryUnusedTicket, 99);
+	_vm->refreshInventory(false);
+	// TODO lookAtUnusedTicket();
+}
+
+void GameLogic::r10_handleVerbPickUpJawbreakers() {
+	_r10_flags |= 0x20;
+	_r10_flags &= ~0x08;
+	_vm->moveObjectToRoom(kObjectIdInventoryJawbreakers, 99);
+	_vm->refreshInventory(false);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r10_handleVerbPickUpGum() {
+	_r10_flags |= 0x10;
+	_r10_flags &= ~0x04;
+	_vm->moveObjectToRoom(kObjectIdInventoryGum, 99);
+	_vm->refreshInventory(false);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r10_handleVerbGiveWinningTicketToSalesgirl() {
+	_vm->redrawInventory();
+	r10_refreshObject(2);
+	_vm->waitSeconds(1);
+	_vm->playAnimation("puttick", 3, -4, 98, 7, 0, 100);
+	_vm->playAnimation("puttick", 0, 2, 98, 7, 0, 100);
+	_vm->playAnimation("getmon", 3, -2, 98, 7, 0, 100);
+	_r10_flags |= 0x40;
+	_vm->moveObjectToRoom(kObjectIdCandyBar, 10);
+	_vm->moveObjectToNowhere(kObjectIdInventoryWinningTicket);
+	_vm->refreshInventory(false);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->displayText("c04r", 9, 0, 320, 70, 0);
+}
+
+void GameLogic::r10_handleDialogSelect_6() {
+	r10_refreshObject(1);
+	_vm->waitSeconds(1);
+	if (_r10_selectedDialogChoice == 0) {
+		_vm->playAnimation("getmon", 0, 5, 98, 7, 0, 100);
+		_r10_flags |= 0x02;
+		_vm->moveObjectToRoom(kObjectIdTicket, 10);
+		_vm->playAnimation("puttick", 0, 4, 98, 7, 0, 100);
+	} else {
+		_vm->playAnimation("getmon", 0, 3, 98, 7, 0, 100);
+		_vm->displayText("c04r", 8, 0, 320, 115, 0);
+		_vm->playAnimation("gest", 0, 7, 127, 7, 0, 200);
+		_vm->playAnimation("getmon", 4, 2, 98, 7, 0, 100);
+		if (_r10_selectedDialogChoice == 1) {
+			_r10_flags |= 0x08;
+		} else {
+			_r10_flags |= 0x04;
+		}
+	}
+	_vm->moveObjectToNowhere(kObjectIdInventoryDollar);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_r10_selectedDialogChoice = 255;
+}
+
+int GameLogic::r10_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit10:
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdGum:
+	case kObjectIdJawbreakers:
+	case kObjectIdTicket:
+	case kObjectIdCandyBar:
+		actionTextIndex = 3;
+		break;
+	case kObjectIdSalesgirl:
+		if (_vm->_currentActorNum != 0) {
+			actionTextIndex = 21;
+		} else {
+			actionTextIndex = 22;
+		}
+		break;
+	case kObjectIdNewspapers:
+	case kObjectIdMagazines10:
+		actionTextIndex = 23;
+		break;
+	case kObjectIdSign10:
+		actionTextIndex = 69;
+		break;
+	case kObjectIdCigarettes:
+		actionTextIndex = 68;
+		break;
+	case kObjectIdHotDogs:
+		actionTextIndex = 67;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r10_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdSalesgirl:
+		if (_vm->_currentActorNum != 0) {
+			_vm->setDialogChoices(0, 5, 2, 3, 4);
+		} else {
+			_vm->setDialogChoices(0, 1, 2, 3, 4);
+		}
+		break;
+	}
+}
+
+int GameLogic::r10_handleVerbPush() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdCigarettes:
+		actionTextIndex = 3;
+		break;
+	case kObjectIdSign10:
+		actionTextIndex = 4;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r10_handleVerbGive() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdSalesgirl:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryWinningTicket) {
+			r10_handleVerbGiveWinningTicketToSalesgirl();
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r10_handleVerbOpen() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdHotDogs:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdSign10:
+		actionTextIndex = 8;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r10_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 320;
+	replyTextY = 70;
+	if (_vm->_objectNumber == kObjectIdSalesgirl) {
+		if (_r10_flags & 0x02) {
+			replyTextIndex1 = 5;
+			_vm->_gameState = 0;
+			continueDialog = false;
+		} else {
+			switch (_vm->_selectedDialogChoice) {
+			case 3:
+				replyTextIndex1 = 0;
+				break;
+			case 5:
+				replyTextIndex1 = 1;
+				replyTextIndex2 = 2;
+				break;
+			case 0: case 1: case 2:
+				_r10_selectedDialogChoice = _vm->_selectedDialogChoice;
+				if (_vm->_currentActorNum != 0 && _vm->_wayneInventory[kObjectIdInventoryDollar] == 0) {
+					_vm->setDialogChoices(8, -1, -1, -1, -1);
+				} else if (_vm->_currentActorNum == 0 && _vm->_garthInventory[kObjectIdInventoryDollar] == 0) {
+					_vm->setDialogChoices(8, -1, -1, -1, -1);
+				} else {
+					_vm->setDialogChoices(6, 7, -1, -1, -1);
+				}
+				replyTextIndex1 = 3;
+				continueDialog = true;
+				break;
+			case 6:
+				r10_handleDialogSelect_6();
+			case 4:
+				_vm->_gameState = 0;
+				break;
+			case 8:
+				replyTextIndex1 = 4;
+			case 7:
+				_r10_selectedDialogChoice = 255;
+				handleVerbTalkTo();
+				break;
+			}
+		}
+	}
+	return continueDialog;
+}
+
+void GameLogic::r10_refreshRoomBackground() {
+	if (_r10_flags & 0x02) {
+		_vm->drawRoomImageToBackground("cticket", 147, 100);
+	}
+	if (_r10_flags & 0x01) {
+		_vm->drawRoomImageToBackground("money", 136, 100);
+	}
+	if (_r10_flags & 0x40) {
+		_vm->drawRoomImageToBackground("candybar", 135, 100);
+	}
+	if (_r10_flags & 0x10) {
+		_vm->drawRoomImageToBackground("nogum", 248, 88);
+	}
+	if (_r10_flags & 0x20) {
+		_vm->drawRoomImageToBackground("nojawb", 271, 88);
+	}
+}
+
+void GameLogic::r10_refreshObject(int arg4) {
+	_r10_flags = _r10_flags + arg4;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_r10_flags &= (255 - arg4);
+}
+
+int GameLogic::r11_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdLampPosts11_0:
+	case kObjectIdFountain11_1:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdLampPosts11_1:
+		actionTextIndex = 8;
+		break;
+	case kObjectIdCar11:
+	case kObjectIdManhole:
+		actionTextIndex = 14;
+		break;
+	case kObjectIdLampPost:
+		actionTextIndex = 30;
+		break;
+	case kObjectIdOutlet11:
+		actionTextIndex = 16;
+		break;
+	case kObjectIdEntrance11:
+	case kObjectIdFountain11_0:
+		actionTextIndex = 33;
+		break;
+	case kObjectIdCityHall11:
+		actionTextIndex = 34;
+		break;
+	case kObjectIdManholeCover:
+		_vm->moveObjectToNowhere(kObjectIdManholeCover);
+		_vm->moveObjectToRoom(kObjectIdManhole, 11);
+		actionTextIndex = 37;
+		break;
+	case kObjectIdExtensionCord_1:
+		if (_r11_flags & 0x08) {
+			if (_vm->_currentActorNum != 0) {
+				actionTextIndex = 38;
+			} else {
+				actionTextIndex = 39;
+			}
+		} else {
+			r11_pickUpExtensionCord();
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r11_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdCar11:
+		if (_r11_flags & 0x01) {
+			r11_useCar1();
+		}
+		if (_r11_flags & 0x04) {
+			r11_useCar2();
+		}
+		r11_uninitRoomAnimations();
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdManhole:
+		r11_uninitRoomAnimations();
+		_vm->_musicIndex = 3;
+		_vm->changeMusic();
+		_vm->changeRoom(24);
+		break;
+	case kObjectIdLampPost:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryPlungers) {
+			if (_vm->_currentActorNum != 0) {
+				actionTextIndex = 43;
+			} else if (_r11_flags & 0x10) {
+				actionTextIndex = 80;
+			} else if (_r11_flags & 0x01) {
+				r11_useCar1();
+			} else {
+				r11_usePlungersWithLampPost();
+			}
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	case kObjectIdOutlet11:
+		if (!(_r11_flags & 0x01)) {
+			actionTextIndex = 7;
+		} else {
+			if (_vm->_firstObjectNumber == kObjectIdInventoryExtensionCord) {
+				if (_vm->_currentActorNum != 0) {
+					actionTextIndex = 46;
+				} else {
+					r11_useExtensionCordWithOutlet();
+				}
+			} else {
+				actionTextIndex = 0;
+			}
+		}
+		break;
+	case kObjectIdExtensionCord_1:
+		if (_vm->_firstObjectNumber == kObjectIdInventorySuckCut) {
+			if (_vm->_currentActorNum == 0) {
+				actionTextIndex = 47;
+			} else {
+				r11_useSuckCutWithExtensionCord();
+			}
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	case kObjectIdFountain11_0:
+	case kObjectIdFountain11_1:
+		if (_vm->_firstObjectNumber == kObjectIdSuckCut) {
+			if (_vm->_currentActorNum == 0) {
+				actionTextIndex = 47;
+			} else {
+				r11_useSuckCutWithFountain();
+			}
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	case kObjectIdEntrance11:
+		if (_r11_flags & 0x01) {
+			r11_useCar1();
+			_vm->walkToObject();
+		}
+		r11_uninitRoomAnimations();
+		_vm->setWaynePosition(201, 125);
+		_vm->setGarthPosition(226, 122);
+		_vm->changeRoom(32);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r11_handleVerbPush() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdCar11:
+		actionTextIndex = 7;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r11_initRoomAnimations() {
+	_vm->loadAnimationSpriteRange(0, "water", 4);
+	_vm->loadAnimationSprite(4, "suckcut");
+	_vm->startRoomAnimations();
+}
+
+void GameLogic::r11_uninitRoomAnimations() {
+	_vm->stopRoomAnimations();
+}
+
+void GameLogic::r11_updateRoomAnimations(bool doUpdate) {
+	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 2000;
+	if (doUpdate) {
+		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 2000;
+	}
+	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
+		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 500, 45, 92);
+		if (_r11_flags & 0x04) {
+			_vm->drawAnimationSpriteToBackground(4, 116, 125);
+		}
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+}
+
+void GameLogic::r11_refreshRoomBackground() {
+	if (!_vm->_hasRoomAnimationCallback && !(_r11_flags & 0x10)) {
+		r11_initRoomAnimations();
+	} else if (_r11_flags & 0x10) {
+		_vm->drawRoomImageToBackground("fillbag", 45, 92);
+	}
+	if (_r11_flags & 0x08) {
+		_vm->drawRoomImageToBackground("plugin5", 189, 60);
+	} else if (_r11_flags & 0x01) {
+		_vm->drawRoomImageToBackground("plunge15", 190, 62);
+	}
+	if (_r11_flags & 0x02) {
+		_vm->drawRoomImageToBackground("cord", 114, 140);
+	}
+	if (_r11_flags & 0x04) {
+		_vm->drawRoomImageToBackground("suckcut", 116, 125);
+	}
+}
+
+void GameLogic::r11_useCar1() {
+	if (_r11_flags & 0x08) {
+		_vm->playAnimation("plunge", 17, -18, 190, 62, 0, 150);
+		_r11_flags &= ~0x08;
+	} else {
+		_vm->playAnimation("plunge", 15, -16, 190, 62, 0, 150);
+	}
+	_r11_flags &= ~0x01;
+	_vm->setGarthPosition(205, 148);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r11_useCar2() {
+	_vm->walkTo(136, 146, 1, _vm->_garthSpriteX, _vm->_garthSpriteY);
+	_vm->_wayneSpriteX = -1;
+	_vm->_garthSpriteX = -1;
+	_vm->_hasRoomAnimationCallback = false;
+	_vm->playAnimation("usecord", 6, -7, 106, 102, 0, 150);
+	_vm->moveObjectToNowhere(kObjectIdSuckCut);
+	_vm->moveObjectToRoom(kObjectIdInventorySuckCut, 99);
+	_vm->refreshInventory(true);
+	_r11_flags &= ~0x04;
+	_vm->setWaynePosition(136, 146);
+	_vm->_hasRoomAnimationCallback = true;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r11_pickUpExtensionCord() {
+	if (_vm->_currentActorNum == 0 && (_r11_flags & 0x01)) {
+		r11_useCar1();
+	}
+	if (_r11_flags & 0x04) {
+		r11_useCar2();
+	}
+	_r11_flags &= ~0x02;
+	_vm->moveObjectToNowhere(kObjectIdExtensionCord_1);
+	_vm->moveObjectToRoom(kObjectIdInventoryExtensionCord, 99);
+	_vm->refreshInventory(true);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r11_useSuckCutWithFountain() {
+	r11_uninitRoomAnimations();
+	_vm->playAnimation("suckwt", 0, 5, 45, 92, 0, 200);
+	_vm->playSound("ss40.snd", 0);
+	for (int i = 5; i < 15; i++) {
+		_vm->playAnimation("elec", i - 5, 1, 176, 61, 0, 1);
+		_vm->playAnimation("suckwt", i, 1, 45, 92, 0, 150);
+	}
+	_vm->playAnimation("elec", 10, 5, 176, 61, 0, 200);
+	_vm->setWaynePosition(117, 135);
+	_r11_flags |= 0x10;
+	_vm->moveObjectToNowhere(kObjectIdSuckCut);
+	_vm->moveObjectToNowhere(kObjectIdExtensionCord_1);
+	_vm->moveObjectToRoom(kObjectIdManholeCover, 11);
+	_r11_flags &= ~0x04;
+	_vm->setStaticRoomObjectPosition(_vm->_currentRoomNumber, 0, 0, 97, 106);
+	_vm->fillRoomMaskArea(117, 110, 140, 130, 0);
+	_vm->fillRoomMaskArea(81, 131, 119, 148, 1);
+	r11_useCar1();
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r11_useSuckCutWithExtensionCord() {
+	_vm->walkTo(136, 146, 1, _vm->_garthSpriteX, _vm->_garthSpriteY);
+	_vm->_wayneSpriteX = -1;
+	_vm->_garthSpriteX = -1;
+	_vm->_hasRoomAnimationCallback = false;
+	_vm->playAnimation("usecord", 0, 7, 106, 102, 0, 150);
+	_vm->drawRoomImageToBackground("suckcut", 116, 125);
+	_vm->moveObjectToRoom(kObjectIdSuckCut, 11);
+	_vm->moveObjectToNowhere(kObjectIdInventorySuckCut);
+	_vm->refreshInventory(true);
+	_r11_flags |= 0x04;
+	_vm->setWaynePosition(136, 146);
+	_vm->_hasRoomAnimationCallback = true;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r11_useExtensionCordWithOutlet() {
+	_vm->_garthSpriteX = -1;
+	_vm->playAnimation("plugin", 0, 6, 189, 60, 0, 150);
+	_vm->drawRoomImageToBackground("cord", 114, 140);
+	_vm->moveObjectToRoom(kObjectIdExtensionCord_1, 11);
+	_vm->moveObjectToNowhere(kObjectIdInventoryExtensionCord);
+	_vm->refreshInventory(true);
+	_r11_flags |= 0x02;
+	_r11_flags |= 0x08;
+}
+
+void GameLogic::r11_usePlungersWithLampPost() {
+	_vm->displayText("c04", 166, 0, -1, -1, 0);
+	_vm->waitSeconds(1);
+	_vm->_isTextVisible = false;
+	_vm->_currentActorNum = 1;
+	_vm->walkTo(146, 146, 1, _vm->_garthSpriteX, _vm->_garthSpriteY);
+	_vm->_currentActorNum = 0;
+	_vm->_garthSpriteX = -1;
+	_vm->playAnimation("plunge", 0, 16, 190, 62, 0, 150);
+	_r11_flags |= 0x01;
+}
+
+int GameLogic::r12_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit12:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdOffices:
+		actionTextIndex = 14;
+		break;
+	case kObjectIdDisplay12:
+		actionTextIndex = 16;
+		break;
+	case kObjectIdChairs12_0:
+		actionTextIndex = 21;
+		break;
+	case kObjectIdChairs12_1:
+		actionTextIndex = 30;
+		break;
+	case kObjectIdGate12:
+		actionTextIndex = 31;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r12_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit12:
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdGate12:
+		actionTextIndex = 28;
+		break;
+	case kObjectIdChairs12_0:
+	case kObjectIdChairs12_1:
+		actionTextIndex = 33;
+		break;
+	case kObjectIdOffices:
+		actionTextIndex = 34;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r12_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	_r12_talkObjectNumber = _vm->_objectNumber;
+	switch (_vm->_objectNumber) {
+	case kObjectIdMan_0:
+		_vm->playAnimation("lawyer", 1, 5, 55, 84, 0, 100);
+		if (_r12_flags & 0x02) {
+			_vm->displayTextLines("c04r", 234, 50, 30, 1);
+			r12_talkToLawyer();
+		} else {
+			_vm->setDialogChoices(269, 270, 187, -1, -1);
+		}
+		break;
+	case kObjectIdMan12_0:
+	case kObjectIdWoman:
+	case kObjectIdFarmer:
+		_vm->setDialogChoices(269, 270, 187, -1, -1);
+		break;
+	case kObjectIdMan12_1:
+		_vm->displayTextLines("c04", 284, -1, -1, 1);
+		break;
+	case kObjectIdCecil:
+		for (int i = 0; i < 4; i++) {
+			_vm->playAnimation("ctalk", 0, 2, 203, 85, 0, 100);
+		}
+		_vm->displayTextLines("c04r", 358, 250, 20, 1);
+		if (_vm->getObjectRoom(kObjectIdInventoryPotatoChip) == 99) {
+			_vm->displayTextLines("c04", 52, -1, -1, 1);
+			for (int i = 0; i < 4; i++) {
+				_vm->playAnimation("ctalk", 0, 2, 203, 85, 0, 100);
+			}
+			_vm->displayTextLines("c04r", 359, 250, 20, 1);
+		} else {
+			_vm->displayTextLines("c04", 341, -1, -1, 1);
+			for (int i = 0; i < 4; i++) {
+				_vm->playAnimation("ctalk", 0, 2, 203, 85, 0, 100);
+			}
+			_vm->displayTextLines("c04r", 360, 250, 20, 1);
+		}
+		break;
+	}
+}
+
+int GameLogic::r12_handleVerbGive() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdCecil:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryPotatoChip) {
+			r12_givePotatoChipToCecil();
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r12_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 50;
+	replyTextY = 30;
+	switch (_vm->_selectedDialogChoice) {
+	case 269:
+		if (_r12_talkObjectNumber == 207) {
+			replyTextIndex1 = 224;
+			if (_vm->getObjectRoom(kObjectIdInventoryCassContract) == 99 && _vm->getObjectRoom(kObjectIdInventoryContract) == 99) {
+				_vm->setDialogChoices(271, 272, 274, -1, -1);
+			} else {
+				_vm->setDialogChoices(271, 272, 273, -1, -1);
+			}
+		} else if (_r12_talkObjectNumber == 209) {
+			replyTextIndex1 = 236;
+		} else if (_r12_talkObjectNumber == 211) {
+			replyTextIndex1 = 238;
+		} else {
+			replyTextIndex1 = 240;
+		}
+		continueDialog = true;
+		break;
+	case 270:
+		if (_r12_talkObjectNumber == 207) {
+			replyTextIndex1 = 225;
+		} else if (_r12_talkObjectNumber == 209) {
+			replyTextIndex1 = 237;
+		} else if (_r12_talkObjectNumber == 211) {
+			replyTextIndex1 = 239;
+		} else {
+			replyTextIndex1 = 241;
+		}
+		continueDialog = true;
+		break;
+	case 187: case 280:
+		if (_r12_talkObjectNumber == 207) {
+			_vm->playAnimation("lawyer", 4, -5, 55, 84, 0, 100);
+		}
+		_vm->_gameState = 0;
+		break;
+	case 271: case 272: case 273:
+		replyTextIndex1 = _vm->_selectedDialogChoice - 45;
+		_vm->setDialogChoices(269, 270, 187, -1, -1);
+		continueDialog = true;
+		break;
+	case 274:
+		_vm->displayTextLines("c04r", 235, 50, 30, 1);
+		_vm->displayTextLines("c04", 275, -1, -1, 4);
+		replyTextIndex1 = 229;
+		_vm->setDialogChoices(279, 280, -1, -1, -1);
+		continueDialog = true;
+		break;
+	case 279:
+		_vm->displayTextLines("c04r", 230, 50, 30, 1);
+		_vm->setGameFlag(10);
+		r12_talkToLawyer();
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r12_refreshRoomBackground() {
+	if ((_r30_flags & 0x08) && !(_pizzathonListFlags2 & 0x02)) {
+		_vm->drawRoomImageToBackground("people0", 73, 81);
+		_vm->moveObjectToRoom(kObjectIdWoman, 12);
+		_vm->moveObjectToRoom(kObjectIdFarmer, 12);
+		_vm->moveObjectToRoom(kObjectIdCecil, 12);
+		_vm->setStaticRoomObjectPosition(12, 0, 0, -1, 69);
+		_vm->setStaticRoomObjectPosition(12, 2, 2, 198, 69);
+	} else {
+		int peopleIndex = _vm->getRandom(10) % 2;
+		_vm->setStaticRoomObjectPosition(12, 0, 0, 214, 69);
+		_vm->setStaticRoomObjectPosition(12, 2, 2, -1, 69);
+		_vm->moveObjectToNowhere(kObjectIdCecil);
+		Common::String filename = Common::String::format("people%d", peopleIndex);
+		_vm->drawRoomImageToBackground(filename.c_str(), 73, 81);
+		if (peopleIndex == 0) {
+			_vm->moveObjectToRoom(kObjectIdWoman, 12);
+			_vm->moveObjectToRoom(kObjectIdFarmer, 12);
+		} else {
+			_vm->moveObjectToNowhere(kObjectIdWoman);
+			_vm->moveObjectToNowhere(kObjectIdFarmer);
+		}
+	}
+	if (!(_r12_flags & 0x01)) {
+		_vm->drawRoomImageToBackground("lawyer0", 55, 84);
+		_vm->moveObjectToRoom(kObjectIdMan_0, 12);
+	} else {
+		_vm->moveObjectToNowhere(kObjectIdMan_0);
+	}
+}
+
+void GameLogic::r12_talkToLawyer() {
+	if (_vm->getObjectRoom(kObjectIdInventoryBusinessCards) == 99) {
+		_vm->displayTextLines("c04", 281, -1, -1, 1);
+		_vm->moveObjectToNowhere(kObjectIdInventoryCassContract);
+		_vm->moveObjectToNowhere(kObjectIdInventoryContract);
+		_vm->moveObjectToNowhere(kObjectIdInventoryBusinessCards);
+		_vm->moveObjectToRoom(kObjectIdInventoryFinalContract, 99);
+		_vm->refreshInventory(true);
+		_r12_flags |= 0x01;
+		_vm->setGameFlag(8);
+	} else {
+		_vm->displayTextLines("c04", 282, -1, -1, 1);
+		_vm->displayTextLines("c04r", 231, 50, 30, 2);
+		_vm->displayTextLines("c04", 283, -1, -1, 1);
+		_vm->displayTextLines("c04r", 233, 50, 30, 1);
+		_r12_flags |= 0x02;
+	}
+	_vm->playAnimation("lawyer", 4, -5, 55, 84, 0, 100);
+	_vm->_gameState = 0;
+}
+
+void GameLogic::r12_givePotatoChipToCecil() {
+	_vm->moveObjectToNowhere(kObjectIdInventoryPotatoChip);
+	_vm->refreshInventory(true);
+	_vm->setGameFlag(5);
+	for (int textIndex = 361; textIndex < 363; textIndex++) {
+		for (int i = 0; i < 4; i++) {
+			_vm->playAnimation("ctalk", 0, 2, 203, 85, 0, 100);
+		}
+		_vm->displayTextLines("c04r", textIndex, 250, 20, 1);
+	}
+	_vm->displayTextLines("c04", 342, -1, -1, 1);
+	for (int textIndex = 363; textIndex < 365; textIndex++) {
+		for (int i = 0; i < 4; i++) {
+			_vm->playAnimation("ctalk", 0, 2, 203, 85, 0, 100);
+		}
+		_vm->displayTextLines("c04r", textIndex, 250, 20, 1);
+	}
+	_vm->playAnimation("cwalk", 0, 13, 198, 84, 0, 100);
+	_vm->setStaticRoomObjectPosition(12, 0, 0, 214, 69);
+	_vm->setStaticRoomObjectPosition(12, 2, 2, -1, 69);
+	_vm->moveObjectToNowhere(kObjectIdCecil);
+	_vm->drawRoomImageToBackground("cwalk12", 198, 84);
+}
+
+int GameLogic::r13_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit13:
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdHallway13:
+		if (_r13_flags & 0x04) {
+			_vm->setWaynePosition(67, 110);
+			_vm->setGarthPosition(56, 109);
+			_vm->changeRoom(18);
+		} else {
+			_vm->displayTextLines("c03", 49, 200, 30, 1);
+		}
+		break;
+	case kObjectIdExit18:
+		r18_uninitRoomAnimations();
+		_vm->setWaynePosition(93, 78);
+		_vm->setGarthPosition(102, 77);
+		_vm->changeRoom(13);
+		break;
+	case kObjectIdTable13_0:
+	case kObjectIdTable13_1:
+	case kObjectIdTable13_2:
+		actionTextIndex = 1;
+		break;
+	case kObjectIdLooseTube:
+	case kObjectIdPieceOfPizza:
+		actionTextIndex = 3;
+		break;
+	case kObjectIdCandle13_0:
+	case kObjectIdCandle13_1:
+	case kObjectIdCandle13_2:
+	case kObjectIdCandle13_3:
+		actionTextIndex = 24;
+		break;
+	case kObjectIdStage13:
+		actionTextIndex = 25;
+		break;
+	case kObjectIdPizzaMachine:
+		actionTextIndex = 26;
+		break;
+	case kObjectIdOven:
+		actionTextIndex = 27;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r13_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdPieceOfPizza:
+		_vm->pickupObject(kObjectIdPieceOfPizza, _r13_flags, 1, kObjectIdInventoryCheesePizza);
+		actionTextIndex = 5;
+		break;
+	case kObjectIdLooseTube:
+		_vm->pickupObject(kObjectIdLooseTube, _r13_flags, 2, kObjectIdInventoryTube);
+		actionTextIndex = 6;
+		break;
+	case kObjectIdExit13:
+	case kObjectIdExit18:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdHallway13:
+	case kObjectIdPizzaMachine:
+		actionTextIndex = 8;
+		break;
+	case kObjectIdStage13:
+	case kObjectIdOven:
+		actionTextIndex = 14;
+		break;
+	case kObjectIdCandle13_0:
+	case kObjectIdCandle13_1:
+	case kObjectIdCandle13_2:
+	case kObjectIdCandle13_3:
+		actionTextIndex = 27;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r13_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdPepe13:
+		_vm->walkTo(98, 84, 6, 101, 80);
+		_vm->setDialogChoices(183, 184, 185, 186, 187);
+		break;
+	}
+}
+
+int GameLogic::r13_handleVerbGive() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdPepe13:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryTicketToRome) {
+			r13_giveTicketToRomeToPepe();
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r13_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 200;
+	replyTextY = 30;
+	switch (_vm->_selectedDialogChoice) {
+	case 183:
+		if (_r13_flags & 0x08) {
+			replyTextIndex1 = 100;
+			replyTextIndex2 = 101;
+		} else {
+			r13_handleDialogSelect183();
+		}
+		continueDialog = true;
+		break;
+	case 184:
+		replyTextIndex1 = 102;
+		replyTextIndex2 = 103;
+		replyTextIndex3 = 104;
+		continueDialog = true;
+		break;
+	case 185:
+		replyTextIndex1 = 105;
+		replyTextIndex2 = 106;
+		continueDialog = true;
+		break;
+	case 186:
+		replyTextIndex1 = 107;
+		continueDialog = true;
+		break;
+	case 187:
+		_vm->_gameState = 0;
+		break;
+	case 422:
+		_vm->displayTextLines("c04r", 455, 160, 20, 2);
+		_vm->displayTextLines("c04", 425, -1, -1, 1);
+		_vm->displayTextLines("c04r", 457, 160, 20, 7);
+		_vm->displayTextLines("c04", 426, -1, -1, 2);
+		_vm->setDialogChoices(429, 430, 431, -1, -1);
+		continueDialog = true;
+		break;
+	case 423:
+		_vm->displayTextLines("c04r", 464, 160, 20, 5);
+		_vm->displayTextLines("c04", 428, -1, -1, 1);
+		_vm->setDialogChoices(435, 436, 437, -1, -1);
+		continueDialog = true;
+		break;
+	case 424:
+		replyTextIndex1 = 469;
+		continueDialog = true;
+		_vm->setDialogChoices(438, 439, 440, -1, -1);
+		break;
+	case 429:
+		_vm->displayTextLines("c04r", 470, 160, 20, 1);
+		_vm->displayTextLines("c04", 432, -1, -1, 2);
+		_vm->displayTextLines("c04r", 471, 160, 20, 1);
+		_vm->displayTextLines("c04", 434, -1, -1, 1);
+		replyTextIndex1 = 472;
+		continueDialog = true;
+		_vm->setDialogChoices(441, 442, 443, -1, -1);
+		break;
+	case 430: case 431:
+		replyTextIndex1 = _vm->_selectedDialogChoice + 43;
+		continueDialog = true;
+		break;
+	case 435: case 437:
+		replyTextIndex1 = 475;
+		continueDialog = true;
+		_vm->setDialogChoices(422, 423, 424, -1, -1);
+		break;
+	case 436:
+		replyTextIndex1 = 476;
+		continueDialog = true;
+		break;
+	case 438: case 439: case 440:
+		replyTextIndex1 = 477;
+		continueDialog = true;
+		_vm->setDialogChoices(422, 423, 424, -1, -1);
+		break;
+	case 441:
+		replyTextIndex1 = 478;
+		replyTextIndex2 = 479;
+		continueDialog = true;
+		break;
+	case 442:
+		replyTextIndex1 = 480;
+		replyTextIndex2 = 481;
+		continueDialog = true;
+		break;
+	case 443:
+		_vm->displayTextLines("c04r", 482, 160, 20, 3);
+		_vm->displayTextLines("c04", 444, -1, -1, 1);
+		_vm->displayTextLines("c04r", 485, 160, 20, 1);
+		_vm->setDialogChoices(445, 446, 447, -1, -1);
+		continueDialog = true;
+		break;
+	case 445: case 446: case 447:
+		_vm->displayTextLines("c04r", 486, 160, 20, 1);
+		_vm->displayTextLines("c04", 448, -1, -1, 1);
+		_vm->_gameState = 0;
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r13_refreshRoomBackground() {
+	if (!(_r13_flags & 0x04)) {
+		_vm->drawRoomImageToBackground("ptalk0", 72, 60);
+	}
+	if (_pizzathonListFlags2 & 0x08) {
+		_r13_flags |= 0x04;
+		_vm->drawRoomImageToBackground("newbackg", 0, 0);
+		_vm->setStaticRoomObjectPosition(13, 0, 3, -1, -1);
+		_vm->setStaticRoomObjectPosition(13, 4, 4, 96, 53);
+		_vm->setStaticRoomObjectPosition(13, 5, 5, 0, 94);
+		_vm->loadRoomMask(96);
+		if (!(_r13_flags & 0x10)) {
+			_vm->_roomEventNum = 1;
+		}
+	}
+}
+
+void GameLogic::r13_handleRoomEvent() {
+	_r13_flags |= 0x10;
+	_vm->playAnimation("crew", 0, 17, 76, 59, 0, 100);
+	_vm->displayTextLines("c04r", 453, 160, 20, 2);
+	_vm->displayTextLines("c04", 420, -1, -1, 2);
+	_vm->setDialogChoices(422, 423, 424, -1, -1);
+	_vm->startDialog();
+}
+
+void GameLogic::r13_giveTicketToRomeToPepe() {
+	_vm->moveObjectToNowhere(kObjectIdInventoryTicketToRome);
+	_vm->displayTextLines("c04r", 108, 200, 30, 2);
+	_vm->displayTextLines("c04", 188, -1, -1, 1);
+	_vm->displayTextLines("c04r", 110, 200, 30, 2);
+	_vm->displayTextLines("c04", 189, -1, -1, 1);
+	_vm->moveObjectToRoom(kObjectIdInventoryLuckySausage, 99);
+	_vm->refreshInventory(false);
+	_r13_flags |= 0x04;
+	_vm->playAnimation("pepego", 0, 10, 60, 58, 0, 100);
+	_vm->moveObjectToNowhere(kObjectIdPepe13);
+	_vm->setGameFlag(2);
+	_vm->refreshActors();
+}
+
+void GameLogic::r13_handleDialogSelect183() {
+	_vm->displayTextLines("c04r", 99, 200, 30, 1);
+	_vm->displayTextLines("c04", 12, -1, -1, 3);
+	_r13_flags |= 0x08;
+}
+
+int GameLogic::r14_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdCar14:
+	case kObjectIdCar19:
+		_vm->_currentRoomNumber = 14;
+		_vm->_gameState = 1;
+		break;
+	case kObjectIdWarehouse:
+		_vm->setWaynePosition(177, 101);
+		_vm->setGarthPosition(168, 98);
+		_vm->changeRoom(20);
+		break;
+	case kObjectIdExit20:
+		_vm->setWaynePosition(256, 83);
+		_vm->_garthSpriteX = 250;
+		_vm->_wayneSpriteY = 87;
+		_vm->changeRoom(19);
+		break;
+	case kObjectIdBench:
+		actionTextIndex = 1;
+		break;
+	case kObjectIdEntrance14:
+		actionTextIndex = 28;
+		break;
+	case kObjectIdLockers20:
+		actionTextIndex = 29;
+		break;
+	case kObjectIdMunchies:
+	case kObjectIdFood:
+		actionTextIndex = 30;
+		break;
+	case kObjectIdInventoryRemoteControl:
+		if (_r19_flags & 0x08) {
+			actionTextIndex = 56;
+		} else if (_r19_flags & 0x04) {
+			actionTextIndex = 54;
+			_vm->_roomEventNum = 1;
+		} else {
+			actionTextIndex = 55;
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r14_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdLoadingDock:
+	case kObjectIdWarehouse:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdBillboard14:
+	case kObjectIdBillboard_1:
+	case kObjectIdBillboard19:
+	case kObjectIdBillboard_2:
+		actionTextIndex = 8;
+		break;
+	case kObjectIdEntrance14:
+	case kObjectIdStore:
+	case kObjectIdExit20:
+		actionTextIndex = 14;
+		break;
+	case kObjectIdClock:
+		actionTextIndex = 12;
+		break;
+	case kObjectIdMunchies:
+	case kObjectIdFood:
+		actionTextIndex = 28;
+		break;
+	case kObjectIdRemains:
+		actionTextIndex = 49;
+		break;
+	case kObjectIdPotatoChip:
+		_vm->pickupObject(kObjectIdPotatoChip, _r19_flags, 16, kObjectIdInventoryPotatoChip);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r14_refreshRoomBackground() {
+	if (_pizzathonListFlags1 & 0x08) {
+		_vm->moveObjectToRoom(kObjectIdBillboard_1, 14);
+		_vm->moveObjectToNowhere(kObjectIdBillboard14);
+		_vm->moveObjectToRoom(kObjectIdBillboard_2, 19);
+		_vm->moveObjectToNowhere(kObjectIdBillboard19);
+		_vm->drawRoomImageToBackground("bboard", 144, 38);
+	}
+	if ((_r1_flags1 & 0x10) && !(_r19_flags & 0x08)) {
+		_vm->drawRoomImageToBackground("robot", 169, 76);
+		_vm->moveObjectToRoom(kObjectIdRobot, 14);
+		_vm->moveObjectToRoom(kObjectIdGilligan, 19);
+	} else {
+		_vm->moveObjectToNowhere(kObjectIdRobot);
+		_vm->moveObjectToNowhere(kObjectIdGilligan);
+	}
+}
+
+bool GameLogic::r15_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 20;
+	replyTextY = 10;
+	switch (_vm->_selectedDialogChoice) {
+	case 54:
+		replyTextIndex1 = 84;
+		break;
+	case 55:
+		replyTextIndex1 = 85;
+		break;
+	case 56:
+		replyTextIndex1 = 86;
+		break;
+	}
+	_vm->_gameState = 0;
+	return continueDialog;
+}
+
+void GameLogic::r16_refreshRoomBackground() {
+	if (_r7_flags & 0x01) {
+		_vm->drawRoomImageToBackground("nocape", 179, 58);
+	}
+	if (_r7_flags & 0x02) {
+		_vm->drawRoomImageToBackground("nohat", 201, 59);
+	}
+}
+
+int GameLogic::r17_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit17:
+		_vm->changeRoom(24);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r17_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdGuard17_0:
+	case kObjectIdGuard17_1:
+		_vm->setDialogChoices(300, 301, 302, 303, -1);
+		break;
+	}
+}
+
+bool GameLogic::r17_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 70;
+	replyTextY = 30;
+	switch (_vm->_selectedDialogChoice) {
+	case 300:
+		replyTextIndex1 = 298;
+		continueDialog = true;
+		break;
+	case 301:
+		_vm->displayTextLines("c04r", 300, 70, 30, 1);
+		if (_vm->getObjectRoom(kObjectIdInventoryPassCard) == 99) {
+			_vm->displayTextLines("c04", 305, -1, -1, 1);
+			_vm->setDialogChoices(306, 307, 308, 309, -1);
+			replyTextIndex1 = 301;
+			replyTextIndex2 = 302;
+			continueDialog = true;
+		} else {
+			_vm->displayTextLines("c04", 304, -1, -1, 1);
+			_vm->_gameState = 0;
+		}
+		break;
+	case 302:
+		replyTextIndex1 = 299;
+		continueDialog = true;
+		break;
+	case 303: case 311:
+		_vm->_gameState = 0;
+		break;
+	case 306: case 307: case 308: case 309:
+		_vm->setDialogChoices(310, 311, -1, -1, -1);
+		_r17_dialogCtr = 0;
+		replyTextIndex1 = 303;
+		replyTextIndex2 = 304;
+		continueDialog = true;
+		break;
+	case 310:
+		replyTextIndex1 = 305;
+		replyTextIndex2 = 306;
+		_vm->setDialogChoices(312, 313, 314, 315, -1);
+		continueDialog = true;
+		break;
+	case 315:
+		_r17_dialogCtr = _r17_dialogCtr + 1;
+	case 312: case 313: case 314:
+		replyTextIndex1 = 307;
+		replyTextIndex2 = 308;
+		replyTextIndex3 = 309;
+		_vm->setDialogChoices(316, 317, 318, 319, -1);
+		continueDialog = true;
+		break;
+	case 317:
+		_r17_dialogCtr = _r17_dialogCtr + 1;
+	case 316: case 318: case 319:
+		replyTextIndex1 = 310;
+		replyTextIndex2 = 311;
+		_vm->setDialogChoices(320, 321, 322, 323, -1);
+		continueDialog = true;
+		break;
+	case 322:
+		_r17_dialogCtr = _r17_dialogCtr + 1;
+	case 320: case 321: case 323:
+		replyTextIndex1 = 312;
+		replyTextIndex2 = 313;
+		_vm->setDialogChoices(324, 325, 326, 327, -1);
+		continueDialog = true;
+		break;
+	case 324:
+		_r17_dialogCtr = _r17_dialogCtr + 1;
+	case 325: case 326: case 327:
+		if (_r17_dialogCtr != 4) {
+			replyTextIndex1 = 314;
+			_vm->_gameState = 0;
+		} else {
+			replyTextIndex1 = 315;
+			replyTextIndex2 = 316;
+			_vm->_roomEventNum = 2;
+			_vm->_gameState = 0;
+		}
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r17_refreshRoomBackground() {
+	_vm->drawRoomImageToBackgroundTransparent("guard1", 49, 79);
+	_vm->drawRoomImageToBackgroundTransparent("guard2", 112, 79);
+	if (_r17_eventFlag == 0) {
+		if (_r37_flags & 0x20) {
+			_vm->_roomEventNum = 3;
+		} else {
+			_vm->_roomEventNum = 1;
+		}
+	}
+}
+
+void GameLogic::r17_handleRoomEvent1() {
+	_vm->displayTextLines("c04r", 297, 70, 30, 1);
+	_vm->walkTo(71, 118, 4, 90, 118);
+	_vm->setDialogChoices(300, 301, 302, 303, -1);
+	_vm->startDialog();
+}
+
+void GameLogic::r17_handleRoomEvent2() {
+	_vm->walkTo(71, 117, 0, 90, 117);
+	_vm->playSound("ss13.snd", 0);
+	_vm->playAnimation("beam", 0, 13, 62, 51, 0, 150);
+	_vm->changeRoom(37);
+}
+
+void GameLogic::r17_handleRoomEvent3() {
+	_vm->playSound("ss13.snd", 0);
+	_vm->playAnimation("beam", 12, -13, 62, 51, 0, 150);
+	_r37_flags &= ~0x20;
+	_vm->setWaynePosition(71, 117);
+	_vm->setGarthPosition(90, 117);
+	_r17_eventFlag = 1;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_r17_eventFlag = 0;
+}
+
+void GameLogic::r18_initRoomAnimations() {
+	_vm->startRoomAnimations();
+}
+
+void GameLogic::r18_uninitRoomAnimations() {
+	_vm->stopRoomAnimations();
+}
+
+void GameLogic::r18_updateRoomAnimations(bool doUpdate) {
+	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 4500;
+	if (doUpdate) {
+		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 4500;
+	}
+	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
+		Common::String machineFilename = Common::String::format("machine%d", _vm->_animationsCtr / 500);
+		_vm->drawRoomImageToBackground(machineFilename.c_str(), 115, 51);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+}
+
+void GameLogic::r18_refreshRoomBackground() {
+	if (!(_r13_flags & 0x01)) {
+		_vm->drawRoomImageToBackground("pizza", 18, 92);
+	}
+	if (_r13_flags & 0x02) {
+		_vm->drawRoomImageToBackground("notube", 71, 63);
+	}
+	if (!_vm->_hasRoomAnimationCallback) {
+		r18_initRoomAnimations();
+	}
+}
+
+bool GameLogic::r19_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 275;
+	replyTextY = 30;
+	switch (_vm->_selectedDialogChoice) {
+	case 256:
+		_r19_flags |= 0x04;
+		replyTextIndex1 = 211;
+		replyTextIndex2 = 212;
+		continueDialog = true;
+		break;
+	case 257:
+		replyTextIndex1 = 213;
+		continueDialog = true;
+		_vm->setDialogChoices(261, 262, 263, 264, -1);
+		break;
+	case 258:
+		replyTextIndex1 = 214;
+		continueDialog = true;
+		break;
+	case 259:
+		if (_r19_flags & 0x02) {
+			replyTextIndex1 = 218;
+		} else {
+			replyTextIndex1 = 215;
+			_vm->setDialogChoices(266, 268, -1, -1, -1);
+		}
+		continueDialog = true;
+		break;
+	case 260: case 264: case 268:
+		_vm->_gameState = 0;
+		break;
+	case 261:
+		_vm->displayTextLines("c04r", 216, 275, 30, 1);
+		_vm->displayTextLines("c04", 265, -1, -1, 1);
+		_vm->setDialogChoices(256, 257, 258, 259, 260);
+		continueDialog = true;
+		break;
+	case 262:
+		replyTextIndex1 = 217;
+		_vm->setDialogChoices(256, 257, 258, 259, 260);
+		continueDialog = true;
+		break;
+	case 263:
+		if (_r19_flags & 0x02) {
+			replyTextIndex1 = 218;
+			_vm->setDialogChoices(256, 257, 258, 259, 260);
+			continueDialog = true;
+		} else {
+			replyTextIndex1 = 215;
+			_vm->setDialogChoices(266, 268, -1, -1, -1);
+			continueDialog = true;
+		}
+		break;
+	case 266:
+		_vm->displayTextLines("c04r", 219, 275, 30, 1);
+		_vm->displayTextLines("c04", 267, -1, -1, 1);
+		replyTextIndex1 = 220;
+		_vm->setDialogChoices(256, 257, 258, 259, 260);
+		_r19_flags |= 0x02;
+		continueDialog = true;
+		break;
+	case 449: case 450: case 451:
+		replyTextIndex1 = _vm->_selectedDialogChoice + 40;
+		replyTextIndex2 = 492;
+		replyTextIndex3 = 493;
+		continueDialog = true;
+		_vm->setDialogChoices(453, 454, 455, 456, -1);
+		break;
+	case 452: case 460:
+		_vm->_gameState = 0;
+		break;
+	case 453: case 454: case 455: case 456:
+		_vm->displayTextLines("c04r", _vm->_selectedDialogChoice + 41, 300, 20, 1);
+		_vm->displayTextLines("c04r", 498, 300, 20, 4);
+		replyTextIndex1 = 502;
+		replyTextIndex2 = 503;
+		replyTextIndex3 = 504;
+		continueDialog = true;
+		_vm->setDialogChoices(457, 458, 459, 460, -1);
+		break;
+	case 457:
+		_vm->displayTextLines("c04r", 505, 300, 20, 2);
+		replyTextIndex1 = 507;
+		replyTextIndex2 = 508;
+		replyTextIndex3 = 509;
+		continueDialog = true;
+		_vm->setDialogChoices(461, 462, 463, -1, -1);
+		break;
+	case 458:
+		_vm->displayTextLines("c04r", 510, 300, 20, 1);
+		replyTextIndex1 = 511;
+		replyTextIndex2 = 512;
+		replyTextIndex3 = 513;
+		continueDialog = true;
+		break;
+	case 459:
+		replyTextIndex1 = 514;
+		replyTextIndex2 = 515;
+		continueDialog = true;
+		_vm->setDialogChoices(469, 470, 471, -1, -1);
+		break;
+	case 461:
+		_vm->displayTextLines("c04r", 516, 300, 20, 2);
+		_vm->displayTextLines("c04", 464, -1, -1, 4);
+		_vm->displayTextLines("c04r", 518, 300, 20, 1);
+		_vm->displayTextLines("c04", 468, -1, -1, 1);
+		continueDialog = true;
+		break;
+	case 462:
+		_vm->displayTextLines("c04r", 519, 300, 20, 2);
+		replyTextIndex1 = 521;
+		replyTextIndex2 = 522;
+		replyTextIndex3 = 523;
+		continueDialog = true;
+		break;
+	case 463:
+		if (_r19_flags & 0x20) {
+			replyTextIndex1 = 536;
+		} else {
+			_vm->moveObjectToRoom(kObjectIdInventorySinusPotion, 99);
+			_vm->refreshInventory(true);
+			_r19_flags |= 0x20;
+			replyTextIndex1 = 524;
+		}
+		_vm->setDialogChoices(457, 458, 459, 460, -1);
+		continueDialog = true;
+		break;
+	case 469:
+		_vm->displayTextLines("c04r", 525, 300, 20, 1);
+		_vm->displayTextLines("c04", 472, -1, -1, 1);
+		replyTextIndex1 = 526;
+		continueDialog = true;
+		break;
+	case 470:
+		_vm->displayTextLines("c04r", 527, 300, 20, 2);
+		replyTextIndex1 = 529;
+		replyTextIndex2 = 530;
+		replyTextIndex3 = 531;
+		continueDialog = true;
+		_vm->setDialogChoices(457, 458, 459, 460, -1);
+		break;
+	case 471:
+		replyTextIndex1 = 532;
+		replyTextIndex2 = 533;
+		replyTextIndex3 = 534;
+		continueDialog = true;
+		_vm->setDialogChoices(457, 458, 459, 460, -1);
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r19_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdGilligan:
+		_vm->setDialogChoices(256, 257, 258, 259, 260);
+		break;
+	case kObjectIdMan_1:
+		_vm->drawRoomImageToScreen("mtalk1", 184, 68);
+		_vm->displayTextLines("c04r", 487, 300, 20, 2);
+		_vm->setDialogChoices(449, 450, 451, 452, -1);
+		break;
+	}
+}
+
+void GameLogic::r19_refreshRoomBackground() {
+	if (_pizzathonListFlags1 & 0x08) {
+		_vm->moveObjectToRoom(kObjectIdBillboard_1, 14);
+		_vm->moveObjectToNowhere(kObjectIdBillboard14);
+		_vm->moveObjectToRoom(kObjectIdBillboard_2, 19);
+		_vm->moveObjectToNowhere(kObjectIdBillboard19);
+		_vm->drawRoomImageToBackground("bboard", 32, 38);
+	}
+	if ((_r1_flags1 & 0x10) && !(_r19_flags & 0x08)) {
+		_vm->drawRoomImageToBackground("robot", 57, 76);
+		_vm->moveObjectToRoom(kObjectIdRobot19, 19);
+	} else {
+		_vm->moveObjectToNowhere(kObjectIdRobot19);
+	}
+	if ((_r1_flags1 & 0x10) && !(_pizzathonListFlags1 & 0x04) && !(_pizzathonListFlags2 & 0x08)) {
+		_vm->drawRoomImageToBackground("gill0", 273, 84);
+		_vm->moveObjectToRoom(kObjectIdGilligan, 19);
+	} else {
+		_vm->moveObjectToNowhere(kObjectIdGilligan);
+	}
+}
+
+void GameLogic::r19_handleRoomEvent() {
+	_vm->waitSeconds(2);
+	_vm->_isTextVisible = false;
+	_vm->walkTo(259, 130, 5, 250, 120);
+	_vm->playAnimation("rob1", 0, 21, 27, 76, 0, 100);
+	_vm->playAnimation("rob2", 0, 18, 143, 52, 0, 100);
+	_vm->playAnimation("rob3", 0, 15, 198, 53, 0, 100);
+	_r19_wayneSpriteX = _vm->_wayneSpriteX;
+	_r19_garthSpriteX = _vm->_garthSpriteX;
+	_vm->_wayneSpriteX = -1;
+	_vm->_garthSpriteX = -1;
+	_r19_flags |= 0x01;
+	_vm->changeRoom(20);
+}
+
+void GameLogic::r20_refreshRoomBackground() {
+	if (_r19_flags & 0x01) {
+		_vm->drawRoomImageToBackground("expl0", 40, 32);
+		_vm->_roomEventNum = 1;
+	} else {
+		_vm->setStaticRoomObjectPosition(20, 0, 1, -1, -1);
+		if (_pizzathonListFlags2 & 0x08) {
+			_vm->drawRoomImageToBackground("newbackg", 0, 0);
+			_vm->setStaticRoomObjectPosition(20, 2, 2, 176, 64);
+			_vm->moveObjectToRoom(kObjectIdMan_1, 20);
+			_vm->moveObjectToNowhere(kObjectIdCrate);
+			_vm->moveObjectToNowhere(kObjectIdPotatoChip);
+			_vm->moveObjectToNowhere(kObjectIdRemains);
+			_vm->moveObjectToNowhere(kObjectIdMunchies);
+			_vm->moveObjectToNowhere(kObjectIdFood);
+		} else if (_r19_flags & 0x08) {
+			_vm->drawRoomImageToBackground("robjunk", 38, 93);
+			_vm->setStaticRoomObjectPosition(20, 1, 1, 72, 95);
+			if (_r19_flags & 0x10) {
+				_vm->drawRoomImageToBackground("nochip", 139, 108);
+				_vm->moveObjectToNowhere(kObjectIdPotatoChip);
+			} else {
+				_vm->moveObjectToRoom(kObjectIdPotatoChip, 20);
+			}
+			_vm->moveObjectToRoom(kObjectIdRemains, 20);
+			_vm->moveObjectToNowhere(kObjectIdCrate);
+		} else if (_r1_flags1 & 0x10) {
+			_vm->drawRoomImageToBackground("crate", 103, 84);
+			_vm->setStaticRoomObjectPosition(20, 0, 0, 103, 84);
+			_vm->moveObjectToRoom(kObjectIdCrate, 20);
+		}
+	}
+}
+
+void GameLogic::r20_handleRoomEvent() {
+	_vm->waitSeconds(1);
+	_vm->playAnimation("expl", 0, 36, 40, 32, 0, 150);
+	_vm->playSound("ss17.snd", 0);
+	_vm->playAnimation("expl", 37, 66, 40, 32, 0, 150);
+	_r19_flags &= ~0x01;
+	_r19_flags |= 0x08;
+	_vm->_wayneSpriteX = _r19_wayneSpriteX;
+	_vm->_garthSpriteX = _r19_garthSpriteX;
+	_vm->_isTextVisible = false;
+	_vm->changeRoom(19);
+	_vm->displayTextLines("c04r", 221, 275, 30, 3);
+	_vm->playAnimation("gillgo", 0, 9, 273, 79, 0, 100);
+	_vm->moveObjectToNowhere(kObjectIdGilligan);
+	_vm->setGameFlag(7);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r22_refreshRoomBackground() {
+	if (_r8_flags & 0x02) {
+		_vm->drawRoomImageToBackground("cab1open", 258, 69);
+	}
+	if (_r8_flags & 0x04) {
+		_vm->drawRoomImageToBackground("cab2open", 206, 52);
+	}
+	if (_r29_flags & 0x02) {
+		_vm->drawRoomImageToBackground("nomap", 209, 87);
+	}
+}
+
+int GameLogic::r24_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdOpening_0:
+	case kObjectIdOpening_1:
+		if (_vm->_objectNumber == kObjectIdOpening_0) {
+			r24_climbLadder(92, 72, 90, -50, 0);
+		} else {
+			r24_climbLadder(203, 183, 90, -50, 1);
+		}
+		// Fall-through
+	case kObjectIdOpening_2:
+	case kObjectIdOpening_3:
+	case kObjectIdOpening_4:
+	case kObjectIdOpening_5:
+	case kObjectIdOpening_6:
+		_vm->setStaticRoomObjectPosition(24, 0, 1, -1, 132);
+		_vm->setStaticRoomObjectPosition(24, 2, 2, -1, 144);
+		r24_useMazeHole(_vm->_objectNumber - 306);
+		if (_r24_mazeHoleNumber > 6) {
+			r25_updateMazeRoomHole(_r24_mazeRoomNumber);
+		}
+		switch (_r24_mazeHoleNumber) {
+		case 7:
+			_vm->changeRoom(25);
+			break;
+		case 8:
+			_vm->changeRoom(26);
+			break;
+		case 9:
+			_vm->changeRoom(27);
+			break;
+		case 10:
+			_vm->setWaynePosition(276, 104);
+			_vm->setGarthPosition(287, 105);
+			_r24_mazeHoleNumber = 5;
+			_vm->changeRoom(38);
+			break;
+		case 11:
+			_vm->setWaynePosition(273, 112);
+			_vm->setGarthPosition(264, 106);
+			_r24_mazeHoleNumber = 2;
+			_vm->changeRoom(17);
+			break;
+		case 12:
+			_vm->setWaynePosition(293, 118);
+			_vm->setGarthPosition(281, 110);
+			_r24_mazeHoleNumber = 5;
+			_vm->changeRoom(36);
+			break;
+		case 13:
+			_vm->setWaynePosition(43, 109);
+			_vm->setGarthPosition(25, 112);
+			_r24_mazeHoleNumber = 3;
+			_vm->changeRoom(35);
+			break;
+		case 14:
+			_vm->setWaynePosition(164, 91);
+			_vm->setGarthPosition(153, 90);
+			_r24_mazeHoleNumber = 3;
+			_vm->changeRoom(34);
+			break;
+		case 15:
+			_vm->setWaynePosition(124, 131);
+			_vm->setGarthPosition(135, 140);
+			_r24_mazeHoleNumber = 0;
+			_vm->changeRoom(11);
+			break;
+		case 16:
+			_vm->setWaynePosition(279, 140);
+			_vm->setGarthPosition(267, 128);
+			_r24_mazeHoleNumber = 2;
+			_vm->changeRoom(39);
+			break;
+		case 17:
+			_vm->setWaynePosition(307, 114);
+			_vm->setGarthPosition(310, 105);
+			_r24_mazeHoleNumber = 3;
+			_vm->changeRoom(28);
+			break;
+		case 18:
+			_vm->setWaynePosition(77, 59);
+			_vm->setGarthPosition(83, 51);
+			_r24_mazeHoleNumber = 2;
+			_vm->changeRoom(29);
+			break;
+		default:
+			_vm->changeRoom(24);
+			break;
+		}
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r24_refreshRoomBackground() {
+	if (_r24_mazeRoomNumber > 48 && _r24_mazeRoomNumber < 59) {
+		_vm->drawRoomImageToBackground("bbackg", 0, 0);
+	} else if (_r24_mazeRoomNumber > 58) {
+		_vm->drawRoomImageToBackground("rbackg", 0, 0);
+	}
+	for (int holeIndex = 0; holeIndex < 7; holeIndex++) {
+		if (kMazeInfos[_r24_mazeRoomNumber][holeIndex] != -1) {
+			Common::String holeFilename;
+			_vm->moveObjectToRoom(holeIndex + 306, 24);
+			if (_r24_mazeRoomNumber < 49) {
+				holeFilename = Common::String::format("hole%d", holeIndex);
+			} else if (_r24_mazeRoomNumber > 58) {
+				holeFilename = Common::String::format("rhole%d", holeIndex);
+			} else {
+				holeFilename = Common::String::format("bhole%d", holeIndex);
+			}
+			_vm->drawRoomImageToBackground(holeFilename.c_str(), kRoom24MazeHolePositionsX[holeIndex], kRoom24MazeHolePositionsY[holeIndex]);
+			if (holeIndex == 0) {
+				_vm->setStaticRoomObjectPosition(24, 0, 0, 95, 18);
+				_vm->fillRoomMaskArea(87, 128, 116, 136, 1);
+			} else if (holeIndex == 1) {
+				_vm->setStaticRoomObjectPosition(24, 1, 1, 206, 18);
+				_vm->fillRoomMaskArea(199, 128, 227, 136, 1);
+			} else if (holeIndex == 6) {
+				_vm->setStaticRoomObjectPosition(24, 2, 2, 95, 26);
+				_vm->fillRoomMaskArea(58, 128, 147, 146, 1);
+			}
+		} else {
+			_vm->moveObjectToNowhere(holeIndex + 306);
+		}
+	}
+	_vm->setWaynePosition(kRoom24MazeWaynePositionsX[_r24_mazeHoleNumber], kRoom24MazeWaynePositionsY[_r24_mazeHoleNumber]);
+	_vm->setGarthPosition(kRoom24MazeGarthPositionsX[_r24_mazeHoleNumber], kRoom24MazeGarthPositionsY[_r24_mazeHoleNumber]);
+	if (_r24_mazeHoleNumber == 0) {
+		_vm->_roomEventNum = 1;
+	} else if (_r24_mazeHoleNumber == 1) {
+		_vm->_roomEventNum = 2;
+	}
+}
+
+void GameLogic::r24_climbLadder(int wayneX, int wayneLadderX, int wayneLadderY, int ladderTopY, int ceilingIndex) {
+	int garthClimbX = wayneX;
+	int garthLadderX = wayneLadderX + 20;
+	int ceilingX = wayneX - 10;
+	Common::String tempFilename;
+	WWSurface *workBackground;
+	WWSurface *ceilingSprite;
+	WWSurface *wclimbSprites[4];
+	WWSurface *gclimbSprites[4];
+	WWSurface *getladSprites[3];
+
+	for (int index = 0; index < 4; index++) {
+		tempFilename = Common::String::format("wclimb%d", index);
+		wclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	for (int index = 0; index < 3; index++) {
+		tempFilename = Common::String::format("wgetlad%d", index);
+		getladSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	workBackground = new WWSurface(320, 150);
+
+	if (_r24_mazeRoomNumber < 49) {
+		tempFilename = Common::String::format("ceil%d", ceilingIndex);
+		ceilingSprite = _vm->loadRoomSurface(tempFilename.c_str());
+	} else {
+		tempFilename = Common::String::format("rceil%d", ceilingIndex);
+		ceilingSprite = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	for (int index = 0; index < 3; index++) {
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		workBackground->drawSurfaceTransparent(getladSprites[index], wayneLadderX, wayneLadderY);
+		workBackground->drawSurfaceTransparent(_vm->_garthSprites[0], garthLadderX + 20, wayneLadderY - 10);
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);
+	}
+
+	for (int index = 0; index < 3; index++) {
+		delete getladSprites[index];
+	}
+
+	for (int index = 0; index < 4; index++) {
+		tempFilename = Common::String::format("gclimb%d", index);
+		gclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	for (int index = 0; index < 3; index++) {
+		tempFilename = Common::String::format("ggetlad%d", index);
+		getladSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	int climbCtr = 0, garthLadderY = wayneLadderY;
+	while (wayneLadderY > ladderTopY) {
+		if (climbCtr % 2 == 1) {
+			wayneLadderY -= 7;
+			if (climbCtr > 12) {
+				garthLadderY -= 7;
+			}
+		}
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		workBackground->drawSurfaceTransparent(wclimbSprites[climbCtr % 4], wayneX, wayneLadderY);
+		if (climbCtr < 10) {
+			workBackground->drawSurfaceTransparent(_vm->_garthSprites[0], garthLadderX + 20, garthLadderY - 10);
+		} else if (climbCtr > 12) {
+			workBackground->drawSurfaceTransparent(gclimbSprites[climbCtr % 4], garthClimbX, garthLadderY);
+		} else {
+			workBackground->drawSurfaceTransparent(getladSprites[climbCtr - 10], garthLadderX, garthLadderY);
+		}
+		workBackground->drawSurface(ceilingSprite, ceilingX, 0);
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);
+		climbCtr++;
+	}
+
+	for (int index = 0; index < 4; index++) {
+		delete wclimbSprites[index];
+		delete gclimbSprites[index];
+	}
+
+	for (int index = 0; index < 3; index++) {
+		delete getladSprites[index];
+	}
+
+	delete workBackground;
+	delete ceilingSprite;
+}
+
+void GameLogic::r24_useMazeHole(int holeIndex) {
+	int nextMazeRoom = kMazeInfos[_r24_mazeRoomNumber][holeIndex];
+	if (nextMazeRoom < 0) {
+		_r24_mazeHoleNumber = nextMazeRoom + 20;
+	} else {
+		_r24_mazeHoleNumber = nextMazeRoom % 10;
+		_r24_mazeRoomNumber = nextMazeRoom / 10;
+	}
+}
+
+void GameLogic::r24_handleRoomEvent(int wayneLadderX, int wayneX, int wayneLadderY, int ladderBottomY, int climbCtrMax, int ceilingIndex) {
+	int garthX = wayneLadderX;
+	int ceilingX = wayneLadderX - 10;
+
+	Common::String tempFilename;
+	WWSurface *workBackground;
+	WWSurface *ceilingSprite;
+	WWSurface *wclimbSprites[4];
+	WWSurface *gclimbSprites[4];
+	WWSurface *getladSprites[3];
+
+	for (int index = 0; index < 4; index++) {
+		tempFilename = Common::String::format("wclimb%d", index);
+		wclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		tempFilename = Common::String::format("gclimb%d", index);
+		gclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	for (int index = 0; index < 3; index++) {
+		tempFilename = Common::String::format("wgetlad%d", index);
+		getladSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	workBackground = new WWSurface(320, 150);
+
+	if (_r24_mazeRoomNumber < 49) {
+		tempFilename = Common::String::format("ceil%d", ceilingIndex);
+		ceilingSprite = _vm->loadRoomSurface(tempFilename.c_str());
+	} else {
+		tempFilename = Common::String::format("rceil%d", ceilingIndex);
+		ceilingSprite = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	int climbCtr = 0, garthLadderY = wayneLadderY;
+	while (garthLadderY < ladderBottomY) {
+		if (climbCtr % 2 == 0) {
+			wayneLadderY += 7;
+			if (climbCtr > 12) {
+				garthLadderY += 7;
+			}
+		}
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		workBackground->drawSurfaceTransparent(gclimbSprites[climbCtr % 4], garthX, garthLadderY);
+		if (climbCtr < climbCtrMax) {
+			workBackground->drawSurfaceTransparent(wclimbSprites[climbCtr % 4], wayneLadderX, wayneLadderY);
+		} else if (climbCtrMax + 2 < climbCtr) {
+			workBackground->drawSurfaceTransparent(_vm->_wayneSprites[0], wayneX - 20, ladderBottomY - 2);
+		} else {
+			workBackground->drawSurfaceTransparent(getladSprites[40 - climbCtr], wayneX, ladderBottomY);
+		}
+		workBackground->drawSurfaceTransparent(ceilingSprite, ceilingX, 0);
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);
+		climbCtr++;
+	}
+
+	for (int index = 0; index < 3; index++) {
+		delete getladSprites[index];
+	}
+
+	for (int index = 0; index < 3; index++) {
+		tempFilename = Common::String::format("ggetlad%d", index);
+		getladSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	for (int index = 2; index >= 0; index--) {
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		workBackground->drawSurfaceTransparent(getladSprites[index], wayneX + 20, ladderBottomY);
+		workBackground->drawSurfaceTransparent(_vm->_wayneSprites[0], wayneX - 20, ladderBottomY - 2);
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);
+	}
+
+	for (int index = 0; index < 4; index++) {
+		delete wclimbSprites[index];
+		delete gclimbSprites[index];
+	}
+
+	delete workBackground;
+	delete ceilingSprite;
+	_vm->_wayneSpriteX = 0;
+	_vm->_garthSpriteX = 0;
+}
+
+int GameLogic::r25_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdOpening25:
+	case kObjectIdOpening_9:
+	case kObjectIdOpening27:
+		r24_useMazeHole(2);
+		break;
+	case kObjectIdOpening26:
+	case kObjectIdOpening_12:
+		r24_useMazeHole(3);
+		break;
+	case kObjectIdOpening_7:
+	case kObjectIdOpening_8:
+	case kObjectIdOpening_11:
+		r24_useMazeHole(4);
+		break;
+	case kObjectIdOpening_10:
+		r24_useMazeHole(5);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	if (actionTextIndex != 0) {
+		_vm->changeRoom(24);
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r25_refreshRoomBackground() {
+	if (_r25_holeIndex != -1) {
+		Common::String holeFilename = Common::String::format("hole%d", _r25_holeIndex % 2);
+		_vm->drawRoomImageToBackground(holeFilename.c_str(), kRoom25MazeHolePositionsX[_r25_holeIndex], kRoom25MazeHolePositionsY[_r25_holeIndex]);
+	}
+	_vm->setWaynePosition(150, 125);
+	_vm->setGarthPosition(180, 125);
+}
+
+void GameLogic::r25_updateMazeRoomHole(int mazeRoomNumber) {
+	_vm->moveObjectToNowhere(314);
+	_vm->moveObjectToNowhere(315);
+	_vm->moveObjectToNowhere(317);
+	_vm->moveObjectToNowhere(318);
+	_vm->moveObjectToNowhere(320);
+	_vm->moveObjectToNowhere(321);
+	switch (mazeRoomNumber) {
+	case 3:
+	case 10:
+	case 31:
+		_r25_holeIndex = -1;
+		break;
+	case 23:
+		_vm->moveObjectToRoom(314, 25);
+		_r25_holeIndex = 0;
+		break;
+	case 17:
+		_vm->moveObjectToRoom(315, 25);
+		_r25_holeIndex = 1;
+		break;
+	case 47:
+		_vm->moveObjectToRoom(317, 26);
+		_r25_holeIndex = 2;
+		break;
+	case 20:
+		_vm->moveObjectToRoom(318, 26);
+		_r25_holeIndex = 3;
+		break;
+	case 11:
+		_vm->moveObjectToRoom(320, 27);
+		_r25_holeIndex = 4;
+		break;
+	case 40:
+		_vm->moveObjectToRoom(321, 27);
+		_r25_holeIndex = 5;
+		break;
+	}
+}
+
+int GameLogic::r28_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit28:
+		_vm->changeRoom(24);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r28_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 150;
+	replyTextY = 10;
+	switch (_vm->_selectedDialogChoice) {
+	case 18: case 19: case 20: case 21:
+		replyTextIndex1 = 35;
+		_vm->setDialogChoices(22, 23, 24, 25, 26);
+		continueDialog = true;
+		break;
+	case 22: case 23: case 24: case 25: case 26:
+		replyTextIndex1 = 36;
+		replyTextIndex2 = 37;
+		_vm->_roomEventNum = 2;
+		_vm->_gameState = 0;
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r28_refreshRoomBackground() {
+	if (!(_r20_flags & 0x01)) {
+		_vm->_roomEventNum = 1;
+	}
+	if (_r20_flags & 0x02) {
+		_vm->drawRoomImageToBackground("repxit10", 0, 33);
+	}
+}
+
+void GameLogic::r28_handleRoomEvent1() {
+	_r20_flags |= 0x01;
+	if (_vm->_currentActorNum != 0) {
+		_vm->walkTo(172, 136, 7, 142, 136);
+	} else {
+		_vm->walkTo(142, 136, 7, 172, 136);
+	}
+	for (int textIndex = 21; textIndex < 30; textIndex++) {
+		_vm->displayText("c04r", textIndex, 0, 150, 10, 1);
+		_vm->playAnimation("reptalk", 0, 6, 26, 51, 0, 150);
+		_vm->playAnimation("reptalk", 0, 6, 26, 51, 1, 150);
+		_vm->waitSeconds(2);
+		_vm->_isTextVisible = false;
+		_vm->refreshActors();
+	}
+	_vm->playAnimation("scepter", 1, 4, 26, 42, 0, 150);
+	_vm->playSound("ss13.snd", 0);
+	_vm->playAnimation("zapwg", 0, 11, 107, 53, 0, 70);
+	_vm->playSound("sv08.snd", 1);
+	_vm->playAnimation("scepter", 3, -4, 26, 42, 0, 150);
+	_vm->displayText("c04r", 30, 0, 150, 10, 0);
+	_vm->playAnimation("reptalk", 0, 6, 26, 51, 0, 150);
+	_vm->playAnimation("reptalk", 0, 6, 26, 51, 1, 150);
+	_vm->waitSeconds(2);
+	_vm->_isTextVisible = false;
+	_vm->refreshActors();
+	_vm->playAnimation("crysgun", 0, 4, 0, 0, 0, 200);
+	_vm->playAnimation("crysgun", 2, -3, 0, 0, 0, 200);
+	_vm->moveObjectToRoom(kObjectIdInventorySquirtGun, 99);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	for (int textIndex = 31; textIndex < 35; textIndex++) {
+		_vm->displayText("c04r", textIndex, 0, 150, 10, 0);
+		_vm->playAnimation("reptalk", 0, 6, 26, 51, 0, 150);
+		_vm->playAnimation("reptalk", 0, 6, 26, 51, 1, 150);
+		_vm->waitSeconds(2);
+		_vm->_isTextVisible = false;
+		_vm->refreshActors();
+	}
+	_vm->setDialogChoices(18, 19, 20, 21, -1);
+	_vm->startDialog();
+}
+
+void GameLogic::r28_handleRoomEvent2() {
+	_vm->playSound("ss12.snd", 0);
+	_vm->playAnimation("scepter", 1, 4, 26, 42, 0, 150);
+	_vm->playAnimation("repxit", 0, 11, 0, 33, 0, 100);
+	_vm->waitSeconds(2);
+	_vm->playSound("ss12.snd", 0);
+	_vm->playAnimation("repxit", 10, -11, 0, 33, 0, 100);
+	_vm->playAnimation("scepter", 3, -4, 26, 42, 0, 150);
+	_vm->displayText("c04r", 38, 0, 150, 10, 0);
+	_vm->playAnimation("reptalk", 0, 6, 26, 51, 1, 150);
+	_vm->waitSeconds(2);
+	_vm->_isTextVisible = false;
+	_vm->refreshActors();
+	_vm->playSound("ss12.snd", 0);
+	_vm->playAnimation("scepter", 1, 4, 26, 42, 0, 150);
+	_vm->playAnimation("repxit", 0, 11, 0, 33, 0, 100);
+	_vm->waitSeconds(2);
+	_r20_flags |= 0x02;
+	_vm->moveObjectToNowhere(kObjectIdGiantLizard);
+	_vm->displayText("c04", 27, 0, -1, -1, 0);
+	if (_vm->_currentActorNum != 0) {
+		_vm->_currentActorNum = 0;
+	} else {
+		_vm->_currentActorNum = 1;
+	}
+	_vm->waitSeconds(2);
+	_vm->_isTextVisible = false;
+	_vm->refreshActors();
+	_vm->displayText("c04", 28, 0, -1, -1, 0);
+	if (_vm->_currentActorNum != 0) {
+		_vm->_currentActorNum = 0;
+	} else {
+		_vm->_currentActorNum = 1;
+	}
+	_vm->waitSeconds(1);
+	_vm->_isTextVisible = false;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+int GameLogic::r29_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdBeakerOfAcid:
+		_r29_flags |= 0x04;
+		_vm->pickupObject(kObjectIdBeakerOfAcid, _r29_flags, 1, kObjectIdInventoryBeakerOfAcid);
+		_r29_flags &= ~0x04;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r29_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit29:
+		r29_uninitRoomAnimations();
+		CursorMan.showMouse(false);
+		_vm->paletteFadeOut(0, 256, 8);
+		_vm->_screen->clear(0);
+		_vm->drawInterface(_vm->_verbNumber);
+		_vm->loadPalette("m01/wstand0");
+		_vm->changeRoom(24);
+		CursorMan.showMouse(true);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r29_initRoomAnimations() {
+	_vm->loadAnimationSpriteRange(0, "coil", 10);
+	_vm->loadAnimationSpriteRange(10, "torch", 4);
+	_vm->loadAnimationSpriteRange(14, "machine", 4);
+	_vm->startRoomAnimations();
+}
+
+void GameLogic::r29_uninitRoomAnimations() {
+	_vm->stopRoomAnimations();
+}
+
+void GameLogic::r29_updateRoomAnimations(bool doUpdate) {
+	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 5000;
+	if (doUpdate) {
+		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 5000;
+	}
+	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
+		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 500, 134, 0);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	} else if (_vm->_animationsCtr % 200 == 150 || doUpdate) {
+		_vm->drawAnimationSpriteToBackground(10 + _vm->getRandom(4), 0, 16);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	} else if (_vm->_animationsCtr % 500 == 350 || doUpdate) {
+		_vm->drawAnimationSpriteToBackground(14 + _vm->getRandom(4), 172, 46);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+}
+
+void GameLogic::r29_refreshRoomBackground() {
+	if (!(_r29_flags & 0x04)) {
+		_vm->paletteFadeOut(0, 256, 8);
+		_vm->_screen->clear(0);
+		_vm->drawInterface(_vm->_verbNumber);
+		_vm->loadPalette("r29/stool");
+		_vm->_roomEventNum = 1;
+	}
+	if (!_vm->_hasRoomAnimationCallback) {
+		r29_initRoomAnimations();
+	}
+	if (!(_r29_flags & 0x01)) {
+		_vm->drawRoomImageToBackground("acid", 90, 81);
+	}
+	_vm->drawRoomImageToBackground("doc1", 138, 69);
+}
+
+void GameLogic::r29_handleRoomEvent() {
+	for (int i = 0; i < 4; i++) {
+		_vm->playAnimation("doc", 0, 2, 138, 69, 0, 100);
+	}
+	_vm->displayTextLines("c04r", 365, 200, 30, 1);
+}
+
+int GameLogic::r30_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit30:
+	case kObjectIdStage30:
+		actionTextIndex = 14;
+		break;
+	case kObjectIdCamera30_0:
+	case kObjectIdCamera30_1:
+		actionTextIndex = 48;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r30_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit30:
+		_vm->setWaynePosition(208, 75);
+		_vm->setGarthPosition(203, 72);
+		_vm->changeRoom(15);
+		break;
+	case kObjectIdCamera30_0:
+	case kObjectIdCamera30_1:
+		actionTextIndex = 50;
+		break;
+	case kObjectIdStage30:
+		actionTextIndex = 51;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r30_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 150;
+	replyTextY = 40;
+	switch (_vm->_selectedDialogChoice) {
+	case 343:
+		replyTextIndex1 = 367;
+		_vm->setDialogChoices(347, 348, 349, -1, -1);
+		continueDialog = true;
+		break;
+	case 344:
+		replyTextIndex1 = 368;
+		_vm->setDialogChoices(350, 351, 352, 353, -1);
+		continueDialog = true;
+		break;
+	case 345:
+		replyTextIndex1 = 369;
+		replyTextIndex2 = 370;
+		_vm->setDialogChoices(354, 355, 356, 357, -1);
+		continueDialog = true;
+		break;
+	case 346:
+		replyTextIndex1 = 371;
+		continueDialog = true;
+		break;
+	case 347: case 348: case 349:
+		replyTextIndex1 = _vm->_selectedDialogChoice + 25;
+		_vm->setDialogChoices(343, 344, 345, 346, -1);
+		continueDialog = true;
+		break;
+	case 350: case 351: case 352: case 353:
+		replyTextIndex1 = 375;
+		_vm->setDialogChoices(343, 344, 345, 346, -1);
+		continueDialog = true;
+		break;
+	case 354:
+		replyTextIndex1 = 376;
+		replyTextIndex2 = 377;
+		continueDialog = true;
+		break;
+	case 355:
+		replyTextIndex1 = 378;
+		_vm->setDialogChoices(358, 359, 360, -1, -1);
+		continueDialog = true;
+		break;
+	case 356: case 357:
+		replyTextIndex1 = _vm->_selectedDialogChoice + 23;
+		continueDialog = true;
+		break;
+	case 358:
+		replyTextIndex1 = 381;
+		_vm->setDialogChoices(361, 362, 363, 52, -1);
+		continueDialog = true;
+		break;
+	case 359:
+		replyTextIndex1 = 382;
+		continueDialog = true;
+		break;
+	case 360:
+		replyTextIndex1 = 383;
+		replyTextIndex2 = 384;
+		continueDialog = true;
+		break;
+	case 52: case 361: case 362: case 363:
+		_vm->displayTextLines("c04r", 385, 160, 40, 6);
+		_vm->displayTextLines("c04", 364, -1, -1, 1);
+		_vm->_roomEventNum = 2;
+		_vm->_gameState = 0;
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r30_refreshRoomBackground() {
+	if (_r30_flags & 0x10) {
+		_vm->drawRoomImageToBackground("cbackg", 0, 0);
+		_vm->drawRoomImageToBackgroundTransparent("cecil", 177, 102);
+	} else if (!(_r30_flags & 0x02)) {
+		_vm->drawRoomImageToBackground("babeshow", 105, 12);
+		_vm->_roomEventNum = 1;
+	} else if (!(_r30_flags & 0x01)) {
+		_vm->drawRoomImageToBackground("babeshow", 105, 12);
+		if (!(_r30_flags & 0x04)) {
+			_vm->drawRoomImageToBackground("waynecon", 224, 30);
+		} else {
+			_vm->drawRoomImageToBackground("nobink", 160, 33);
+		}
+	} else if (!(_r30_flags & 0x08) && _vm->_roomChangeCtr > 20) {
+		r30_runLudwigCutscene();
+	}
+}
+
+void GameLogic::r30_handleRoomEvent1() {
+	_r30_flags |= 0x02;
+	_vm->displayTextLines("c04r", 51, 150, 10, 23);
+	if (_vm->_currentActorNum == 0) {
+		_vm->_currentActorNum = 1;
+		_vm->drawInterface(_vm->_verbNumber);
+	}
+	_vm->walkTo(237, 51, 6, _vm->_garthSpriteX, _vm->_garthSpriteY);
+	_vm->waitSeconds(1);
+	_vm->_garthSpriteY = -1;
+	_vm->_garthSpriteX = -1;
+	_vm->_wayneSpriteY = -1;
+	_vm->_wayneSpriteX = -1;
+	_vm->changeRoom(31);
+}
+
+void GameLogic::r30_handleRoomEvent2() {
+	_r30_flags |= 0x08;
+	_vm->setWaynePosition(208, 75);
+	_vm->setGarthPosition(203, 72);
+	_vm->drawInterface(_vm->_verbNumber);
+	_vm->changeRoom(15);
+}
+
+void GameLogic::r30_runLudwigCutscene() {
+	_vm->_garthSpriteY = -1;
+	_vm->_garthSpriteX = -1;
+	_vm->_wayneSpriteY = -1;
+	_vm->_wayneSpriteX = -1;
+	_vm->_roomName = "m06"; // Change the active gxl file
+	_vm->paletteFadeOut(0, 256, 64);
+	_vm->_screen->clear(0);
+	// TODO gxGetDisplayPalette(palette1);
+	// TODO pcxGetLibPalette(8, roomLib, "backg", palette2);
+	// TODO gxSetDisplayPalette(palette2);
+	_vm->paletteFadeOut(0, 256, 64);
+	_vm->_screen->clear(0);
+	_vm->drawRoomImageToBackground("backg", 0, 0);
+	_vm->_screen->drawSurface(_vm->_backgroundSurface, 0, 0);
+	_vm->_musicIndex = 1;
+	_vm->changeMusic();
+	_vm->paletteFadeIn(0, 256, 3);
+	_vm->displayTextLines("lws", 0, 50, 10, 1);
+	_vm->playAnimation("ludwig", 1, 2, 185, 34, 0, 150);
+	_vm->displayTextLines("lws", 1, 50, 10, 1);
+	_vm->playAnimation("ludwig", 3, 3, 185, 34, 0, 150);
+	_vm->displayTextLines("lws", 2, 50, 10, 1);
+	_vm->playAnimation("ludwig", 6, 3, 185, 34, 0, 150);
+	_vm->displayTextLines("lws", 3, 50, 10, 1);
+	_vm->playAnimation("ludwig", 9, 3, 185, 34, 0, 150);
+	_vm->displayTextLines("lws", 4, 50, 10, 3);
+	_vm->playAnimation("ludwig", 12, 1, 185, 34, 0, 150);
+	_vm->displayTextLines("lws", 7, 50, 10, 6);
+	_vm->playAnimation("ludwig", 13, 1, 185, 34, 0, 150);
+	_vm->displayTextLines("lws", 13, 50, 10, 4);
+	for (int animIndex = 14, textIndex = 17; animIndex < 42; animIndex++) {
+		_vm->playAnimation("ludwig", animIndex, 1, 185, 34, 0, 150);
+		if (animIndex % 3 == 0) {
+			_vm->displayTextLines("lws", textIndex++, 50, 10, 1);
+		}
+	}
+	_vm->displayTextLines("lws", 26, 50, 10, 1);
+	_vm->playAnimation("ludwig", 42, 20, 185, 34, 0, 150);
+	_vm->displayTextLines("lws", 27, 50, 10, 1);
+	_vm->playAnimation("ludwig", 62, 4, 185, 34, 0, 150);
+	_vm->playSound("ss17.snd", 0);
+	_vm->playAnimation("ludwig", 66, 4, 186, 22, 0, 150);
+	_vm->playAnimation("ludwig", 70, 3, 185, 34, 0, 150);
+	_vm->displayTextLines("lws", 28, 50, 10, 5);
+	_vm->playAnimation("ludwig", 73, 6, 185, 34, 0, 150);
+	_vm->displayTextLines("lws", 33, 50, 10, 4);
+	_vm->playAnimation("ludwig", 79, 2, 185, 34, 0, 150);
+	_vm->displayTextLines("lws", 37, 50, 10, 1);
+	_vm->playAnimation("ludwig", 81, 6, 185, 34, 0, 150);
+	_vm->playAnimation("ludwig", 87, 5, 174, 35, 0, 150);
+	_vm->waitSeconds(2);
+	_vm->_screen->clear(0);
+	_r30_flags |= 0x08;
+	r30_talkToCecil();
+}
+
+void GameLogic::r30_talkToCecil() {
+	_r30_flags |= 0x10;
+	_vm->setWaynePosition(210, 146);
+	_vm->setGarthPosition(238, 142);
+	_vm->_actorSpriteValue = 6;
+	_vm->changeRoom(30);
+	_r30_flags &= ~0x10;
+	_vm->displayTextLines("c04r", 366, 160, 40, 1);
+	_vm->setDialogChoices(343, 344, 345, 346, -1);
+	_vm->startDialog();
+	_r30_flags &= ~0x10;
+}
+
+int GameLogic::r31_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdBuzzer:
+		r31_useBuzzer();
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r31_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 150;
+	replyTextY = 10;
+	switch (_vm->_selectedDialogChoice) {
+	case 52:
+		_vm->_gameState = 0;
+		_vm->_roomEventNum = 2;
+		break;
+	case 53:
+		_vm->_roomEventNum = 3;
+		break;
+	case 133:
+		_vm->displayTextLines("gms", (_r31_categoryIndex * 5) + _r31_questionIndex, 50, 10, -6000);
+		break;
+	case 160: case 161: case 162: case 163:
+		_vm->_roomEventNum = 5;
+		_vm->_gameState = 0;
+		break;
+	default:
+		if (_vm->_selectedDialogChoice > 56 && _vm->_selectedDialogChoice < 133) {
+			if (_vm->_selectedDialogChoice == _r31_correctAnswerChoice) {
+				r31_correctAnswerSelected();
+			} else {
+				r31_wrongAnswerSelected();
+				_vm->_gameState = 0;
+			}
+			_vm->_roomEventNum = 4;
+		} else if (_vm->_selectedDialogChoice > 133 && _vm->_selectedDialogChoice < 159) {
+			_r31_questionIndex = (_vm->_selectedDialogChoice - 134) % 5;
+			_r31_categoryIndex = (_vm->_selectedDialogChoice - 134) / 5;
+			_vm->_roomEventNum = 4;
+			_vm->_gameState = 0;
+		}
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r31_refreshRoomBackground() {
+	if (!(_r31_flags & 0x02)) {
+		_vm->_roomEventNum = 1;
+	}
+}
+
+void GameLogic::r31_handleRoomEvent1() {
+	_r31_flags |= 0x02;
+	_vm->redrawInventory();
+	_vm->displayText("c04r", 74, 0, 50, 10, 0);
+	r31_playTalkAnim(3);
+	r31_drawMBuzzer();
+	r31_drawDBuzzer();
+}
+
+void GameLogic::r31_handleRoomEvent2() {
+	for (int textIndex = 81; textIndex < 83; textIndex++) {
+		_vm->displayText("c04r", textIndex, 0, 50, 10, 0);
+		r31_playTalkAnim(3);
+	}
+	r31_displayCategories();
+	_vm->displayText("c04r", 83, 0, 50, 10, 0);
+	r31_playTalkAnim(3);
+	r31_handleRoomEvent4();
+}
+
+void GameLogic::r31_handleRoomEvent3() {
+	for (int textIndex = 75; textIndex < 81; textIndex++) {
+		_vm->displayText("c04r", textIndex, 0, 50, 10, 0);
+		r31_playTalkAnim(3);
+	}
+	_vm->setDialogChoices(52, 53, -1, -1, -1);
+	_vm->startDialog();
+}
+
+void GameLogic::r31_handleRoomEvent4() {
+
+	while (_r31_questionsAsked < 25) {
+		if (_r31_currentPlayer != 0 && !_r31_categorySelected) {
+			_r31_questionIndex = 5;
+			while (_r31_questionIndex == 5) {
+				_r31_categoryIndex = _vm->getRandom(5);
+				for (int questionIndex = 0; questionIndex < 5; questionIndex++) {
+					if (!_r31_askedQuestions[_r31_categoryIndex * 5 + questionIndex]) {
+						_r31_questionIndex = questionIndex;
+						break;
+					}
+				}
+			}
+			_vm->displayText("c04", _r31_categoryIndex * 5 + _r31_questionIndex + 134, 0, 250, 10, 0);
+			r31_playTalkAnim(_r31_currentPlayer);
+		} else if (!_r31_categorySelected) {
+			int questionChoices[5];
+			for (int categoryIndex = 0; categoryIndex < 5; categoryIndex++) {
+				questionChoices[categoryIndex] = 159;
+				for (int questionIndex = 0; questionIndex < 5; questionIndex++) {
+					if (!_r31_askedQuestions[categoryIndex * 5 + questionIndex]) {
+						questionChoices[categoryIndex] = categoryIndex * 5 + questionIndex + 134;
+						break;
+					}
+				}
+			}
+			_vm->setDialogChoices(questionChoices[0], questionChoices[1], questionChoices[2], questionChoices[3], questionChoices[4]);
+			_vm->startDialog();
+			_vm->drawRoomImageToBackground("dnorm", 287, 30);
+			_vm->drawRoomImageToBackground("mtalk0", 240, 31);
+			_r31_categorySelected = true;
+			return;
+		}
+
+		_r31_categorySelected = false;
+		_r31_askedQuestions[_r31_categoryIndex * 5 + _r31_questionIndex] = true;
+		_vm->drawRoomImageToBackground("star", kRoom31StarPositionsX[_r31_categoryIndex], kRoom31StarPositionsY[_r31_categoryIndex * 5 + _r31_questionIndex]);
+
+        // Wait for mouse release
+		//sysMouseDriver(5, 1);
+		while (_vm->_mouseClickButtons != 0) {
+			_vm->_mouseClickButtons = 0;
+			//sysMouseDriver(5, 1);
+			//sysMouseDriver(5, 2);
+			//updateKeyInput();
+		}
+
+		_vm->displayText("gms", _r31_categoryIndex * 5 + _r31_questionIndex, 0, 50, 10, 0);
+		_vm->playAnimation("rdcard", 0, 6, 155, 30, 0, 300);
+		_vm->playAnimation("rdcard", 1, 6, 155, 30, 0, 300);
+		_vm->playAnimation("rdcard", 5, -6, 155, 30, 0, 300);
+		_r31_questionsAsked++;
+		_vm->_isTextVisible = false;
+		_vm->refreshActors();
+		_vm->waitMillis(_vm->getRandom(1300) + 200);
+		//sysMouseDriver(3);
+
+		//sysMouseDriver(5, 1);
+		if (_vm->_mouseClickButtons != 0 && _vm->_mouseX > 130 && _vm->_mouseX < 180 && _vm->_mouseY > 106 && _vm->_mouseY < 128) {
+			_r31_currentPlayer = 0;
+			r31_useBuzzer();
+			_vm->drawRoomImageToBackground("dlook", 287, 30);
+			_vm->drawRoomImageToBackground("mlook", 240, 31);
+			r31_buildQuestionDialogChoices(_r31_categoryIndex, _r31_questionIndex);
+			return;
+		} else {
+			_r31_currentPlayer = _vm->getRandom(2) + 1;
+			if (_r31_currentPlayer == 1) {
+				r31_drawMBuzzer();
+			} else {
+				r31_drawDBuzzer();
+			}
+			_vm->displayText("gms", _r31_categoryIndex * 5 + _r31_questionIndex + 25, 0, 250, 10, 0);
+			r31_playTalkAnim(_r31_currentPlayer);
+			r31_correctAnswerSelected();
+		}
+	}
+	
+	r31_runBabeoff();
+}
+
+void GameLogic::r31_handleRoomEvent5() {
+	for (int textIndex = 72; textIndex < 74; textIndex++) {
+		_vm->displayText("gms", textIndex, 0, 50, 10, 0);
+		r31_playTalkAnim(3);
+	}
+	_vm->_wayneSpriteX = -1;
+	_vm->setGarthPosition(207, 143);
+	_vm->changeRoom(30);
+	_vm->displayTextLines("gms", 74, 50, 10, 9);
+	_vm->playAnimation("wbink", 0, 16, 160, 21, 0, 100);
+	_vm->displayTextLines("gms", 83, 50, 10, 1);
+	_vm->playAnimation("lbink", 0, 6, 214, 21, 0, 120);
+	_vm->moveObjectToRoom(kObjectIdInventoryTicketToRome, 99);
+	_vm->refreshInventory(false);
+	_vm->setWaynePosition(237, 51);
+	_r30_flags |= 0x04;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->walkTo(230, 140, 0, _vm->_garthSpriteX, _vm->_garthSpriteY);
+	_vm->displayText("c04", 164, 0, -1, -1, 0);
+	_vm->waitSeconds(2);
+	_vm->_currentActorNum = 0;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->displayText("c04", 165, 0, -1, -1, 0);
+	_vm->_currentActorNum = 1;
+	_vm->waitSeconds(2);
+	_vm->_isTextVisible = false;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_r30_flags |= 0x01;
+	_vm->_roomChangeCtr = 0;
+	_vm->setWaynePosition(208, 75);
+	_vm->setGarthPosition(203, 72);
+	_vm->changeRoom(15);
+}
+
+void GameLogic::r31_drawDBuzzer() {
+	WWSurface *local128 = new WWSurface(48, 27);
+	// TODO copySpriteRect(_vm->_backgroundSurface, 247, 78, 294, 104, local128);
+	_vm->drawRoomImageToScreen("dbuzzer", 247, 78);
+	_vm->waitSeconds(2);
+	_vm->_screen->drawSurface(local128, 247, 78);
+	delete local128;
+}
+
+void GameLogic::r31_drawMBuzzer() {
+	WWSurface *local128 = new WWSurface(29, 18);
+	// TODO copySpriteRect(_vm->_backgroundSurface, 210, 61, 238, 78, local128);
+	_vm->drawRoomImageToScreen("mbuzzer", 210, 61);
+	_vm->waitSeconds(2);
+	_vm->_screen->drawSurface(local128, 210, 61);
+	delete local128;
+}
+
+void GameLogic::r31_playTalkAnim(int talkerIndex) {
+	if (talkerIndex == 1) {
+		_vm->playAnimation("mtalk", 1, 6, 240, 31, 0, 250);
+		_vm->playAnimation("mtalk", 5, -6, 240, 31, 0, 250);
+	} else if (talkerIndex == 2) {
+		_vm->playAnimation("dtalk", 1, 3, 286, 33, 0, 300);
+		_vm->playAnimation("dtalk", 2, -3, 286, 33, 0, 300);
+	} else if (talkerIndex == 3) {
+		_vm->playAnimation("btalk", 1, 5, 180, 30, 0, 250);
+		_vm->playAnimation("btalk", 4, -5, 180, 30, 0, 250);
+	}
+	_vm->_isTextVisible = false;
+	_vm->refreshActors();
+}
+
+void GameLogic::r31_useBuzzer() {
+	WWSurface *local128 = new WWSurface(48, 40);
+	// TODO copySpriteRect(_vm->_backgroundSurface, 131, 106, 178, 145, local128);
+	_vm->drawRoomImageToScreen("buzzer", 131, 106);
+	_vm->playSound("ss04.snd", 1);
+	_vm->_screen->drawSurface(local128, 131, 106);
+	delete local128;
+	if (!(_r31_flags & 0x01)) {
+		r31_handleRoomEvent3();
+		_r31_flags |= 0x01;
+	}
+}
+
+void GameLogic::r31_displayCategories() {
+	CursorMan.showMouse(false);
+	WWSurface *screenImage = _vm->loadRoomSurface("screen");
+	// TODO fxSetDelay(0);
+	// TODO fxSetGrain(4, 4, 1);
+	// TODO fxSetEffect(8); // Spiral Effect
+	// TODO fxVirtualDisplay(screenImage, 0, 0, 0, 0, 319, 199, 1);
+	delete screenImage;
+	for (int categoryIndex = 0; categoryIndex < 5; categoryIndex++) {
+		Common::String categoryFilename = Common::String::format("cat%d", categoryIndex);
+		WWSurface *categoryImage = _vm->loadRoomSurface(categoryFilename.c_str());
+		// TODO fxSetGrain(1, 1, 1);
+		// TODO fxSetEffect(5); // Random Effect
+		// TODO fxVirtualDisplay(categoryImage, 0, 0, 17, 61, 300, 140, 0);
+		delete categoryImage;
+		_vm->waitSeconds(3);
+	}
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->drawInterface(_vm->_verbNumber);
+	CursorMan.showMouse(true);
+}
+
+void GameLogic::r31_runBabeoff() {
+	_vm->_gameState = 0;
+	_vm->drawInterface(_vm->_verbNumber);
+	_vm->drawRoomImageToBackground("dnorm", 287, 30);
+	_vm->drawRoomImageToBackground("mtalk0", 240, 31);
+	for (int textIndex = 54; textIndex < 62; textIndex++) {
+		_vm->displayText("gms", textIndex, 0, 50, 10, 0);
+		r31_playTalkAnim(3);
+	}
+	_vm->displayText("gms", 62, 0, 250, 10, 0);
+	r31_playTalkAnim(1);
+	for (int textIndex = 63; textIndex < 67; textIndex++) {
+		_vm->displayText("gms", textIndex, 0, 50, 10, 0);
+		r31_playTalkAnim(3);
+	}
+	for (int textIndex = 67; textIndex < 69; textIndex++) {
+		_vm->displayText("gms", textIndex, 0, 250, 20, 0);
+		r31_playTalkAnim(2);
+	}
+	for (int textIndex = 69; textIndex < 72; textIndex++) {
+		_vm->displayText("gms", textIndex, 0, 50, 10, 0);
+		r31_playTalkAnim(3);
+	}
+	_vm->setDialogChoices(160, 161, 162, 163, -1);
+	_vm->startDialog();
+}
+
+void GameLogic::r31_drawCurrentPlayerScore() {
+	int numberX = kRoom31NumberPositionsX[_r31_currentPlayer];
+	int numberY = kRoom31NumberPositionsY[_r31_currentPlayer];
+	int score = _r31_scores[_r31_currentPlayer];
+	if (score > 99) {
+		Common::String numberFilename = Common::String::format("n%d", score / 100);
+		_vm->drawRoomImageToBackground(numberFilename.c_str(), numberX, numberY);
+	} else {
+		_vm->_backgroundSurface->fillRect(numberX, numberY, numberX + 3, numberY + 6, 2);
+	}
+	if (score > 9) {
+		Common::String numberFilename = Common::String::format("n%d", (score % 100) / 10);
+		_vm->drawRoomImageToBackground(numberFilename.c_str(), numberX + 5, numberY);
+	} else {
+		_vm->_backgroundSurface->fillRect(numberX + 5, numberY, numberX + 8, numberY + 6, 2);
+	}
+	Common::String numberFilename = Common::String::format("n%d", score % 10);
+	_vm->drawRoomImageToBackground(numberFilename.c_str(), numberX + 10, numberY);
+	_vm->refreshActors();
+}
+
+void GameLogic::r31_buildQuestionDialogChoices(int categoryIndex, int questionIndex) {
+	int answerShuffle[3];
+	int answerChoices[3];
+	answerShuffle[0] = _vm->getRandom(3);
+	answerShuffle[1] = (_vm->getRandom(4) + answerShuffle[0] + 1) % 3;
+	if (answerShuffle[0] + answerShuffle[1] == 1) {
+		answerShuffle[2] = 2;
+	} else if (answerShuffle[0] + answerShuffle[1] == 2) {
+		answerShuffle[2] = 1;
+	} else {
+		answerShuffle[2] = 0;
+	}
+	for (int answerIndex = 0; answerIndex < 3; answerIndex++) {
+		answerChoices[answerIndex] = answerShuffle[answerIndex] * 25 + categoryIndex * 5 + questionIndex + 57;
+		if (answerShuffle[answerIndex] == 0) {
+			_r31_correctAnswerChoice = answerChoices[answerIndex];
+		}
+	}
+	_vm->setDialogChoices(133, answerChoices[0], answerChoices[1], answerChoices[2], 132);
+}
+
+void GameLogic::r31_correctAnswerSelected() {
+	_vm->displayText("gms", _vm->getRandom(3) + 50, 3, 100, 10, 0);
+	r31_playTalkAnim(3);
+	_r31_scores[_r31_currentPlayer] += (_r31_questionIndex + 1) * 10;
+	r31_drawCurrentPlayerScore();
+}
+
+void GameLogic::r31_wrongAnswerSelected() {
+	_vm->drawRoomImageToBackground("dnorm", 287, 30);
+	_vm->drawRoomImageToBackground("mtalk0", 240, 31);
+	_vm->displayText("gms", 53, 0, 50, 10, 0);
+	r31_playTalkAnim(3);
+	_r31_scores[0] -= (_r31_questionIndex + 1) * 10;
+	if (_r31_scores[0] < 0) {
+		_r31_scores[0] = 0;
+	}
+	r31_drawCurrentPlayerScore();
+	_r31_currentPlayer = _vm->getRandom(2) + 1;
+	if (_r31_currentPlayer == 1) {
+		r31_drawMBuzzer();
+	} else {
+		r31_drawDBuzzer();
+	}
+	_vm->displayText("gms", (_r31_categoryIndex * 5) + _r31_questionIndex + 25, 0, 250, 10, 0);
+	r31_playTalkAnim(_r31_currentPlayer);
+	r31_correctAnswerSelected();
+}
+
+int GameLogic::r32_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdMemo:
+		r32_pickUpMemo();
+		break;
+	case kObjectIdPlungers:
+		_vm->pickupObject(kObjectIdPlungers, _r32_flags, 2, kObjectIdInventoryPlungers);
+		break;
+	case kObjectIdCharts:
+		actionTextIndex = 31;
+		break;
+	case kObjectIdComputer:
+		actionTextIndex = 36;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r32_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdElevator:
+		_vm->setWaynePosition(149, 80);
+		_vm->setGarthPosition(152, 87);
+		if (_vm->_hasRoomAnimationCallback) {
+			r32_uninitRoomAnimations();
+		}
+		_vm->changeRoom(11);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r32_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdJanitor:
+		if (_r32_flags & 0x04) {
+			_vm->displayTextLines("c04", 419, -1, -1, 1);
+		} else {
+			r32_uninitRoomAnimations();
+			_vm->drawRoomImageToBackground("jtalk1", 262, 84);
+			_vm->setDialogChoices(402, 403, 404, 405, 406);
+		}
+		break;
+	}
+}
+
+int GameLogic::r32_handleVerbOpen() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdDoor32_0:
+	case kObjectIdDoor32_1:
+		actionTextIndex = 12;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r32_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 200;
+	replyTextY = 30;
+	switch (_vm->_selectedDialogChoice) {
+	case 402: case 405:
+		replyTextIndex1 = _vm->_selectedDialogChoice + 35;
+		continueDialog = true;
+		break;
+	case 403:
+		replyTextIndex1 = 438;
+		continueDialog = true;
+		_vm->setDialogChoices(407, 408, 409, 410, -1);
+		break;
+	case 404:
+		replyTextIndex1 = 439;
+		continueDialog = true;
+		if (_vm->getObjectRoom(kObjectIdInventoryOldDonuts) == 99) {
+			_vm->setDialogChoices(411, 416, 417, 418, -1);
+		} else {
+			_vm->setDialogChoices(415, 416, 417, 418, -1);
+		}
+		break;
+	case 406:
+		r32_initRoomAnimations();
+		_vm->_gameState = 0;
+		break;
+	case 407: case 408: case 409: case 410: case 415:
+		replyTextIndex1 = _vm->_selectedDialogChoice + 34;
+		continueDialog = true;
+		_vm->setDialogChoices(402, 403, 404, 405, 406);
+		break;
+	case 417: case 418:
+		replyTextIndex1 = _vm->_selectedDialogChoice + 33;
+		continueDialog = true;
+		_vm->setDialogChoices(402, 403, 404, 405, 406);
+		break;
+	case 416:
+		replyTextIndex1 = 442;
+		continueDialog = true;
+		_vm->setDialogChoices(402, 403, 404, 405, 406);
+		break;
+	case 411:
+		replyTextIndex1 = 445;
+		continueDialog = true;
+		_vm->setDialogChoices(412, 413, 414, -1, -1);
+		break;
+	case 412:
+		replyTextIndex1 = 446;
+		continueDialog = true;
+		break;
+	case 413:
+		replyTextIndex1 = 447;
+		_vm->_roomEventNum = 1;
+		_vm->_gameState = 0;
+		break;
+	case 414:
+		replyTextIndex1 = 448;
+		continueDialog = true;
+		_vm->setDialogChoices(402, 403, 404, 405, 406);
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r32_initRoomAnimations() {
+	_vm->loadAnimationSpriteRange(0, "jan", 3);
+	_vm->loadAnimationSpriteRange(3, "jeat", 4);
+	_vm->startRoomAnimations();
+}
+
+void GameLogic::r32_uninitRoomAnimations() {
+	_vm->stopRoomAnimations();
+}
+
+void GameLogic::r32_updateRoomAnimations(bool doUpdate) {
+	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 3600;
+	if (_r32_flags & 0x04) {
+		if (_vm->_animationsCtr % 900 == 0 || doUpdate) {
+			_vm->drawAnimationSpriteToBackground(3 + (_vm->_animationsCtr / 900), 262, 83);
+			_vm->_hasRoomAnimationCallback = false;
+			_vm->refreshActors();
+			_vm->_hasRoomAnimationCallback = true;
+		}
+	} else {
+		if (_vm->_animationsCtr % 400 == 0 || doUpdate) {
+			_vm->drawAnimationSpriteToBackground(_vm->getRandom(3), 263, 84);
+			_vm->_hasRoomAnimationCallback = false;
+			_vm->refreshActors();
+			_vm->_hasRoomAnimationCallback = true;
+		}
+	}
+}
+
+void GameLogic::r32_refreshRoomBackground() {
+	if (!(_pizzathonListFlags2 & 0x08)) {
+		_vm->drawRoomImageToBackground("cdoor", 13, 65);
+		_vm->fillRoomMaskArea(0, 0, 33, 149, 1);
+	} else {
+		_vm->moveObjectToNowhere(kObjectIdDoor32_0);
+		_vm->moveObjectToRoom(kObjectIdOffice, 32);
+		_vm->moveObjectToRoom(kObjectIdJanitor, 32);
+		_vm->moveObjectToRoom(kObjectIdCart, 32);
+		_vm->drawRoomImageToBackground("cart", 269, 82);
+		if (_r32_flags & 0x02) {
+			_vm->drawRoomImageToBackground("noplunge", 293, 94);
+		}
+		r32_initRoomAnimations();
+	}
+}
+
+void GameLogic::r32_handleRoomEvent() {
+	_vm->moveObjectToNowhere(kObjectIdInventoryOldDonuts);
+	_vm->refreshInventory(true);
+	_vm->moveObjectToRoom(kObjectIdPlungers, 32);
+	_r32_flags |= 0x04;
+	r32_initRoomAnimations();
+}
+
+void GameLogic::r32_pickUpMemo() {
+	_vm->pickupObject(kObjectIdMemo, _r32_flags, 1, kObjectIdInventoryMemo);
+	_vm->displayText("c04", 167, 0, -1, -1, 0);
+	_vm->_isTextVisible = false;
+	_vm->waitSeconds(3);
+	_vm->refreshActors();
+	_vm->displayText("c04", 168, 0, -1, -1, 0);
+	_vm->_isTextVisible = false;
+	_vm->waitSeconds(3);
+	_vm->refreshActors();
+	_vm->_currentActorNum = (_vm->_currentActorNum + 1) % 2;
+	_vm->displayText("c04", 169, 0, -1, -1, 0);
+	_vm->_isTextVisible = false;
+	_vm->waitSeconds(3);
+	_vm->_currentActorNum = (_vm->_currentActorNum + 1) % 2;
+	_vm->refreshActors();
+}
+
+void GameLogic::r33_refreshRoomBackground() {
+	if (_r32_flags & 0x01) {
+		_vm->drawRoomImageToBackground("nomemo", 55, 100);
+	}
+}
+
+int GameLogic::r34_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdLunchBox:
+		_r34_flags &= ~0x08;
+		_vm->moveObjectToRoom(kObjectIdInventoryLunchBox, 99);
+		_vm->refreshInventory(false);
+		_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		break;
+	case kObjectIdPasscard:
+		_r34_flags |= 0x01;
+		_vm->moveObjectToRoom(kObjectIdInventoryPassCard, 99);
+		_vm->refreshInventory(false);
+		_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r34_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit34:
+		if (_vm->_hasRoomAnimationCallback) {
+			r34_uninitRoomAnimations();
+		}
+		_vm->changeRoom(24);
+		break;
+	case kObjectIdLocker:
+		if (_vm->_firstObjectNumber == kObjectIdInventoryLunchBox) {
+			_vm->moveObjectToNowhere(kObjectIdInventoryLunchBox);
+			_r34_flags |= 0x08;
+			_vm->refreshInventory(false);
+			_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		} else if (_vm->_firstObjectNumber == kObjectIdInventoryPassCard) {
+			_vm->moveObjectToNowhere(kObjectIdInventoryPassCard);
+			_r34_flags &= ~0x01;
+			_vm->refreshInventory(false);
+			_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r34_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdMan34:
+		_vm->playAnimation("mantalk", 0, 1, 198, 68, 0, 1);
+		r34_uninitRoomAnimations();
+		_vm->displayTextLines("c04r", 279, 275, 30, 1);
+		if (_vm->getObjectRoom(kObjectIdInventoryLunchBox) == 99) {
+			_vm->setDialogChoices(291, 292, 294, 295, -1);
+		} else {
+			_vm->setDialogChoices(291, 292, 293, 295, -1);
+		}
+		break;
+	}
+}
+
+int GameLogic::r34_handleVerbOpen() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdLocker:
+		if (_r34_flags & 0x02) {
+			actionTextIndex = 1;
+		} else {
+			_r34_flags |= 0x02;
+			_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r34_handleVerbClose() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdLocker:
+		if (!(_r34_flags & 0x02)) {
+			actionTextIndex = 1;
+		} else {
+			_r34_flags &= ~0x02;
+			_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+bool GameLogic::r34_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 275;
+	replyTextY = 30;
+	switch (_vm->_selectedDialogChoice) {
+	case 291:
+		replyTextIndex1 = 280;
+		continueDialog = true;
+		break;
+	case 292:
+		replyTextIndex1 = 281;
+		continueDialog = true;
+		break;
+	case 293:
+		replyTextIndex1 = 282;
+		continueDialog = true;
+		break;
+	case 294:
+		replyTextIndex1 = 283;
+		_vm->moveObjectToRoom(kObjectIdLocker, 34);
+		continueDialog = true;
+		break;
+	case 295:
+		_vm->playAnimation("towel", 0, 1, 198, 68, 0, 1);
+		r34_initRoomAnimations();
+		_vm->_gameState = 0;
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r34_initRoomAnimations() {
+	_vm->loadAnimationSpriteRange(0, "towel", 4);
+	_vm->startRoomAnimations();
+}
+
+void GameLogic::r34_uninitRoomAnimations() {
+	_vm->stopRoomAnimations();
+}
+
+void GameLogic::r34_updateRoomAnimations(bool doUpdate) {
+	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 3000;
+	if (_vm->_animationsCtr == 0 || doUpdate) {
+		_vm->drawAnimationSpriteToBackground(_vm->getRandom(4), 198, 68);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+}
+
+void GameLogic::r34_refreshRoomBackground() {
+	if (!(_r34_flags & 0x01) && !_vm->_hasRoomAnimationCallback) {
+		_vm->drawRoomImageToBackground("towel0", 198, 68);
+		r34_initRoomAnimations();
+	} else {
+		_vm->moveObjectToNowhere(kObjectIdMan34);
+		_vm->moveObjectToRoom(kObjectIdLocker, 34);
+	}
+	if (_r34_flags & 0x02) {
+		_vm->drawRoomImageToBackground("openlckr", 95, 60);
+		if (_r34_flags & 0x08) {
+			_vm->drawRoomImageToBackground("lunchbox", 96, 87);
+			_vm->moveObjectToRoom(kObjectIdLunchBox, 34);
+		} else {
+			_vm->moveObjectToNowhere(kObjectIdLunchBox);
+		}
+		if (!(_r34_flags & 0x01)) {
+			_vm->drawRoomImageToBackground("passcard", 98, 74);
+			_vm->moveObjectToRoom(kObjectIdPasscard, 34);
+		} else {
+			_vm->moveObjectToNowhere(kObjectIdPasscard);
+		}
+	}
+}
+
+int GameLogic::r35_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit35:
+		_vm->changeRoom(24);
+		break;
+	case kObjectIdJailCells:
+		if (_vm->_firstObjectNumber == kObjectIdInventorySetOfKeys) {
+			if (_r35_flags & 0x04) {
+				r35_useSetOfKeysWithJailCells();
+			} else {
+				_vm->displayTextLines("c04r", 329, 150, 20, 3);
+			}
+		}
+		actionTextIndex = 0;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}	
+	return actionTextIndex;
+}
+
+void GameLogic::r35_handleVerbTalkTo() {
+	_vm->_dialogChoices[0] = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdCassandra35:
+		r35_talkToCassandra();
+		break;
+	}
+}
+
+bool GameLogic::r35_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
+	bool continueDialog = false;
+	replyTextIndex3 = -1;
+	replyTextIndex2 = -1;
+	replyTextIndex1 = -1;
+	replyTextX = 150;
+	replyTextY = 20;
+	switch (_vm->_selectedDialogChoice) {
+	case 328: case 329: case 330:
+		for (int textIndex = 323; textIndex < 326; textIndex++) {
+			for (int i = 0; i < 4; i++) {
+				_vm->playAnimation("cass", 0, 2, 179, 68, 0, 100);
+			}
+			_vm->displayTextLines("c04r", textIndex, replyTextX, replyTextY, 1);
+		}
+		replyTextIndex1 = 326;
+		replyTextIndex2 = 327;
+		replyTextIndex3 = 328;
+		if (_vm->getObjectRoom(kObjectIdInventory50000) == 99) {
+			_vm->setDialogChoices(331, 333, 334, 335, 340);
+		} else {
+			_vm->setDialogChoices(331, 332, 334, 335, 340);
+		}
+		continueDialog = true;
+		break;
+	case 331:
+		replyTextIndex1 = 329;
+		replyTextIndex2 = 330;
+		replyTextIndex3 = 331;
+		continueDialog = true;
+		break;
+	case 332:
+		replyTextIndex1 = 332;
+		replyTextIndex2 = 333;
+		replyTextIndex3 = 334;
+		continueDialog = true;
+		break;
+	case 333:
+		replyTextIndex1 = 335;
+		replyTextIndex2 = 336;
+		if (_vm->getObjectRoom(kObjectIdInventorySetOfKeys) == 99 && (_r38_flags & 0x01)) {
+			_vm->setDialogChoices(336, 337, 338, -1, -1);
+		} else {
+			_vm->setDialogChoices(336, 337, -1, -1, -1);
+		}
+		continueDialog = true;
+		break;
+	case 334:
+		replyTextIndex1 = 337;
+		continueDialog = true;
+		break;
+	case 335:
+		replyTextIndex1 = 338;
+		continueDialog = true;
+		break;
+	case 336:
+		replyTextIndex1 = 339;
+		replyTextIndex2 = 340;
+		continueDialog = true;
+		break;
+	case 337:
+		replyTextIndex1 = 96;
+		_vm->_gameState = 0;
+		break;
+	case 338:
+		_r35_flags |= 0x04;
+		replyTextIndex1 = 341;
+		_vm->_gameState = 0;
+		break;
+	case 340:
+		_vm->_gameState = 0;
+		break;
+	}
+	return continueDialog;
+}
+
+void GameLogic::r35_refreshRoomBackground() {
+	if (!(_r35_flags & 0x01)) {
+		_vm->drawRoomImageToBackground("cass1", 179, 68);
+	}
+	_vm->_roomEventNum = 1;
+}
+
+void GameLogic::r35_talkToCassandra() {
+	_vm->_gameState = 7;
+	if (_r35_flags & 0x02) {
+		for (int i = 0; i < 4; i++) {
+			_vm->playAnimation("cass", 0, 2, 179, 68, 0, 100);
+		}
+		_vm->displayTextLines("c04r", 342, 150, 20, 1);
+		if (_vm->getObjectRoom(kObjectIdInventory50000) == 99) {
+			_vm->walkTo(217, 112, 5, 230, 115);
+			_vm->displayTextLines("c04", 339, -1, -1, 1);
+			for (int textIndex = 335; textIndex < 337; textIndex++) {
+				for (int i = 0; i < 4; i++) {
+					_vm->playAnimation("cass", 0, 2, 179, 68, 0, 100);
+				}
+				_vm->displayTextLines("c04r", textIndex, 150, 20, 1);
+			}
+			if (_vm->getObjectRoom(kObjectIdInventorySetOfKeys) == 99 && (_r38_flags & 0x01)) {
+				_vm->setDialogChoices(336, 337, 338, -1, -1);
+			} else {
+				_vm->setDialogChoices(336, 337, -1, -1, -1);
+			}
+			_vm->startDialog();
+		}
+	} else {
+		_r35_flags |= 0x02;
+		for (int textIndex = 317; textIndex < 323; textIndex++) {
+			for (int i = 0; i < 4; i++) {
+				_vm->playAnimation("cass", 0, 2, 179, 68, 0, 100);
+			}
+			_vm->displayTextLines("c04r", textIndex, 150, 20, 1);
+		}
+		_vm->walkTo(217, 112, 5, 230, 115);
+		_vm->setDialogChoices(328, 329, 330, -1, -1);
+		_vm->startDialog();
+	}
+	_vm->_gameState = 2;
+}
+
+void GameLogic::r35_useSetOfKeysWithJailCells() {
+	_vm->walkTo(179, 106, 4, _vm->_garthSpriteX, _vm->_garthSpriteY);
+	_vm->waitSeconds(1);
+	_vm->walkTo(217, 112, 5, 230, 115);
+	_vm->playAnimation("cassgo", 0, 5, 166, 68, 0, 150);
+	_r35_flags |= 0x01;
+	_vm->moveObjectToNowhere(kObjectIdCassandra35);
+	_vm->displayTextLines("c04r", 343, 150, 20, 1);
+	_r24_mazeRoomNumber = 72;
+	_r24_mazeHoleNumber = 5;
+	_vm->changeRoom(38);
+}
+
+int GameLogic::r36_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdLunchBox36:
+		_vm->pickupObject(kObjectIdLunchBox36, _r36_flags, 4, kObjectIdInventoryLunchBox);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r36_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit36:
+		r36_uninitRoomAnimations();
+		_vm->changeRoom(24);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r36_initRoomAnimations() {
+	_vm->loadAnimationSpriteRange(0, "sleep", 2);
+	_vm->startRoomAnimations();
+}
+
+void GameLogic::r36_uninitRoomAnimations() {
+	_vm->stopRoomAnimations();
+}
+
+void GameLogic::r36_updateRoomAnimations(bool doUpdate) {
+	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 4000;
+	if (_vm->_animationsCtr == 0 || doUpdate) {
+		_vm->drawAnimationSpriteToBackground(0, 263, 82);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	} else if (_vm->_animationsCtr == 2000 || doUpdate) {
+		_vm->drawAnimationSpriteToBackground(1, 263, 82);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+}
+
+void GameLogic::r36_refreshRoomBackground() {
+	if (_r36_flags & 0x04) {
+		_vm->drawRoomImageToBackground("nolunch", 268, 101);
+	}
+	if (!_vm->_hasRoomAnimationCallback) {
+		r36_initRoomAnimations();
+	}
+	_vm->_roomEventNum = 1;
+}
+
+void GameLogic::r36_handleRoomEvent() {
+	if (!(_r36_flags & 0x01)) {
+		_vm->displayTextLines("c04r", 260, 300, 30, 5);
+		_r36_flags |= 0x01;
+	} else if (!(_r36_flags & 0x02)) {
+		_vm->displayTextLines("c04r", 265, 300, 30, 1);
+		_r36_flags |= 0x02;
+	} else {
+		_vm->displayTextLines("c04r", 266, 300, 30, 13);
+	}
+}
+
+int GameLogic::r37_handleVerbPickUp() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdMoney:
+		_vm->pickupObject(kObjectIdMoney, _r37_flags, 16, kObjectIdInventory50000);
+		actionTextIndex = 42;
+		break;
+	case kObjectIdKeys:
+		_vm->pickupObject(kObjectIdKeys, _r37_flags, 8, kObjectIdInventorySetOfKeys);
+		actionTextIndex = 43;
+		break;
+	case kObjectIdMagazines:
+		if (_vm->_currentActorNum != 0) {
+			actionTextIndex = 40;
+		} else {
+			actionTextIndex = 41;
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r37_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdLadder37_0:
+		r37_useLadder1();
+		_r37_flags |= 0x20;
+		_vm->changeRoom(17);
+		break;
+	case kObjectIdLadder37_1:
+		r37_useLadder2();
+		break;
+	case kObjectIdLadder:
+		r37_useLadder3();
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r37_handleVerbPush() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdLock_1:
+		r37_pushPullLock(0);
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r37_handleVerbPull() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdLock_1:
+		r37_pushPullLock(1);
+		break;
+	case kObjectIdHandle:
+		if (!(_r37_flags & 0x02)) {
+			actionTextIndex = 1;
+		} else {
+			r37_pullHandle();
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r37_refreshRoomBackground() {
+	if (!(_r37_flags & 0x01)) {
+		_vm->_wayneSpriteX = -1;
+		_vm->_garthSpriteX = -1;
+		_vm->_roomEventNum = 1;
+	}
+	if (!(_r37_flags & 0x04)) {
+		Common::String lockFilename = Common::String::format("lock%d", _r37_safeCombinationLockIndex);
+		_vm->drawRoomImageToBackground(lockFilename.c_str(), 109, 97);
+	} else {
+		_vm->drawRoomImageToBackground("opensafe", 92, 84);
+		if (_r37_flags & 0x08) {
+			_vm->drawRoomImageToBackground("nokeys", 101, 95);
+		}
+		if (_r37_flags & 0x10) {
+			_vm->drawRoomImageToBackground("nomoney", 102, 102);
+		}
+	}
+}
+
+void GameLogic::r37_useLadder1() {
+	Common::String tempFilename;
+	WWSurface *workBackground;
+	WWSurface *wclimbSprites[4];
+	WWSurface *gclimbSprites[4];
+	WWSurface *getldrSprites[3];
+
+	for (int index = 0; index < 4; index++) {
+		tempFilename = Common::String::format("wclimb%d", index);
+		wclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+    for (int index = 0; index < 3; index++) {
+		tempFilename = Common::String::format("wgetldr%d", index);
+		getldrSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+	
+	workBackground = new WWSurface(320, 150);
+
+	for (int index = 0; index < 3; index++) {
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		workBackground->drawSurfaceTransparent(getldrSprites[index], 105, 24);
+		workBackground->drawSurfaceTransparent(_vm->_garthSprites[0], 125, 21);
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);
+	}
+
+	for (int index = 0; index < 3; index++) {
+		delete getldrSprites[index];
+	}
+	
+	for (int index = 0; index < 4; index++) {
+		tempFilename = Common::String::format("gclimb%d", index);
+		gclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	for (int index = 0; index < 3; index++) {
+		tempFilename = Common::String::format("ggetldr%d", index);
+		getldrSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	int wayneLadderY = 24;
+	int climbCtr = 0, garthLadderY = wayneLadderY;
+	while (wayneLadderY > -46) {
+		if (climbCtr % 2 == 1) {
+			wayneLadderY -= 7;
+			if (climbCtr > 12) {
+				garthLadderY -= 7;
+			}
+		}
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		workBackground->drawSurfaceTransparent(wclimbSprites[climbCtr % 4], 105, wayneLadderY);
+		if (climbCtr < 10) {
+			workBackground->drawSurfaceTransparent(_vm->_garthSprites[0], 145, garthLadderY - 3);
+		} else if (climbCtr > 12) {
+			workBackground->drawSurfaceTransparent(gclimbSprites[climbCtr % 4], 105, garthLadderY);
+		} else {
+			workBackground->drawSurfaceTransparent(gclimbSprites[climbCtr - 10], 105, garthLadderY);
+		}
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);
+		climbCtr++;
+	}
+
+	for (int index = 0; index < 4; index++) {
+		delete wclimbSprites[index];
+		delete gclimbSprites[index];
+	}
+
+	for (int index = 0; index < 3; index++) {
+		delete getldrSprites[index];
+	}
+
+	delete workBackground;
+}
+
+void GameLogic::r37_useLadder2() {
+	Common::String tempFilename;
+
+	WWSurface *workBackground;
+	WWSurface *wclimbSprites[4];
+	WWSurface *gclimbSprites[4];
+	WWSurface *wgetldlSprites[3];
+	WWSurface *ggetldlSprites[3];
+
+	for (int index = 0; index < 4; index++) {
+		tempFilename = Common::String::format("wclimb%d", index);
+		wclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		tempFilename = Common::String::format("gclimb%d", index);
+		gclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	for (int index = 0; index < 3; index++) {
+		tempFilename = Common::String::format("wgetldl%d", index);
+		wgetldlSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		tempFilename = Common::String::format("ggetldl%d", index);
+		ggetldlSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	workBackground = new WWSurface(320, 150);
+
+	for (int index = 0; index < 3; index++) {
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		workBackground->drawSurfaceTransparent(wgetldlSprites[index], 168, 26);
+		workBackground->drawSurfaceTransparent(_vm->_garthSprites[0], 140, 26);
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);
+	}
+
+	int wayneLadderY = 26;
+	int climbCtr = 0, garthLadderY = wayneLadderY;
+	
+	while (garthLadderY < 92) {
+		if (climbCtr % 2 == 0) {
+			wayneLadderY += 7;
+			if (climbCtr > 14) {
+				garthLadderY += 7;
+			}
+		}
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		if (climbCtr < 12) {
+			workBackground->drawSurfaceTransparent(_vm->_garthSprites[0], 135, garthLadderY);
+		} else if (climbCtr <= 14) {
+			workBackground->drawSurfaceTransparent(wgetldlSprites[14 - climbCtr], 168, 26);
+		} else {
+			workBackground->drawSurfaceTransparent(gclimbSprites[climbCtr % 4], 187, garthLadderY);
+		} 
+		if (climbCtr < 20) {
+			workBackground->drawSurfaceTransparent(wclimbSprites[climbCtr % 4], 187, wayneLadderY);
+		} else if (climbCtr <= 22) {
+			workBackground->drawSurfaceTransparent(wgetldlSprites[22 - climbCtr], 168, 92);
+		} else {
+			workBackground->drawSurfaceTransparent(_vm->_wayneSprites[0], 135, 94);
+		}
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);
+		climbCtr++;
+	}
+
+	for (int index = 2; index >= 0; index--) {
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		workBackground->drawSurfaceTransparent(ggetldlSprites[index], 168, 90);
+		workBackground->drawSurfaceTransparent(_vm->_wayneSprites[0], 135, 94);
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);
+	}
+
+	for (int index = 0; index < 4; index++) {
+		delete wclimbSprites[index];
+		delete gclimbSprites[index];
+	}
+
+	for (int index = 0; index < 3; index++) {
+		delete wgetldlSprites[index];
+		delete ggetldlSprites[index];
+	}
+
+	delete workBackground;
+
+	_vm->setWaynePosition(135, 141);
+	_vm->setGarthPosition(160, 137);
+	_vm->moveObjectToNowhere(kObjectIdLadder37_0);
+	_vm->moveObjectToNowhere(kObjectIdLadder37_1);
+	if (!(_r37_flags & 0x04)) {
+		_vm->moveObjectToRoom(kObjectIdSafe_1, 37);
+		_vm->moveObjectToRoom(kObjectIdLock_1, 37);
+		_vm->moveObjectToRoom(kObjectIdHandle, 37);
+	} else {
+		_vm->moveObjectToNowhere(kObjectIdSafe_1);
+		_vm->moveObjectToNowhere(kObjectIdLock_1);
+		_vm->moveObjectToNowhere(kObjectIdMagazines); // TODO CHECKME Another Turbo C++ compiler bug?
+		_vm->moveObjectToNowhere(kObjectIdHandle);
+		if (!(_r37_flags & 0x08)) {
+			_vm->moveObjectToRoom(kObjectIdKeys, 37);
+		}
+		if (!(_r37_flags & 0x10)) {
+			_vm->moveObjectToRoom(kObjectIdMoney, 37);
+		}
+	}
+	_vm->moveObjectToRoom(kObjectIdLadder, 37);
+	_vm->loadRoomMask(98);
+	_r37_flags |= 0x01;
+	_vm->refreshActors();
+}
+
+void GameLogic::r37_useLadder3() {
+	Common::String tempFilename;
+	WWSurface *workBackground;
+	WWSurface *wclimbSprites[4];
+	WWSurface *gclimbSprites[4];
+	WWSurface *wgetldlSprites[3];
+	WWSurface *ggetldlSprites[3];
+
+	for (int index = 0; index < 4; index++) {
+		tempFilename = Common::String::format("wclimb%d", index);
+		wclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		tempFilename = Common::String::format("gclimb%d", index);
+		gclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+    for (int index = 0; index < 3; index++) {
+		tempFilename = Common::String::format("wgetldl%d", index);
+		wgetldlSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		tempFilename = Common::String::format("ggetldl%d", index);
+		ggetldlSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	workBackground = new WWSurface(320, 150);
+
+	for (int index = 0; index < 3; index++) {
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		workBackground->drawSurfaceTransparent(wgetldlSprites[index], 168, 90);
+		workBackground->drawSurfaceTransparent(_vm->_garthSprites[0], 145, 89);
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);
+	}
+
+	int climbCtr = 0, wayneLadderY = 92, garthLadderY = 92;
+	while (garthLadderY > 26) {
+		if (climbCtr % 2 == 1) {
+			wayneLadderY -=7;
+			if (climbCtr > 12) {
+				garthLadderY -= 7;
+			}
+		}
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		if (climbCtr < 10) {
+			workBackground->drawSurfaceTransparent(wclimbSprites[climbCtr % 4], 187, wayneLadderY);
+		} else  if (climbCtr > 12) {
+			workBackground->drawSurfaceTransparent(_vm->_wayneSprites[0], 155, 26);
+		} else {
+			workBackground->drawSurfaceTransparent(wgetldlSprites[12 - climbCtr], 168, 26);
+		}
+		if (climbCtr < 10) {
+			workBackground->drawSurfaceTransparent(_vm->_garthSprites[0], 145, garthLadderY - 3);
+		} else if (climbCtr > 12) {
+			workBackground->drawSurfaceTransparent(gclimbSprites[climbCtr % 4], 187, garthLadderY);
+		} else {
+			workBackground->drawSurfaceTransparent(ggetldlSprites[climbCtr - 10], 168, 90);
+		}
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);
+		climbCtr++;
+	}
+
+	for (int index = 2; index >= 0; index--) {
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		workBackground->drawSurfaceTransparent(ggetldlSprites[index], 168, 28);
+		workBackground->drawSurfaceTransparent(_vm->_wayneSprites[0], 155, 26);
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);		
+	}
+
+	for (int index = 0; index < 4; index++) {
+		delete wclimbSprites[index];
+		delete gclimbSprites[index];
+	}
+
+	for (int index = 0; index < 3; index++) {
+		delete wgetldlSprites[index];
+		delete ggetldlSprites[index];
+	}
+
+	delete workBackground;
+
+	_vm->moveObjectToRoom(kObjectIdLadder37_0, 37);
+	_vm->moveObjectToRoom(kObjectIdLadder37_1, 37);
+	_vm->moveObjectToNowhere(kObjectIdSafe_1);
+	_vm->moveObjectToNowhere(kObjectIdLock_1);
+	_vm->moveObjectToNowhere(kObjectIdHandle);
+	_vm->moveObjectToNowhere(kObjectIdLadder);
+	_vm->moveObjectToNowhere(kObjectIdKeys);
+	_vm->moveObjectToNowhere(kObjectIdMoney);
+	_vm->moveObjectToNowhere(kObjectIdMagazines);
+	_r37_flags &= ~0x01;
+	_vm->loadRoomMask(_vm->_currentRoomNumber);
+	_vm->setWaynePosition(156, 75);
+	_vm->setGarthPosition(178, 75);
+	_vm->refreshActors();
+}
+
+void GameLogic::r37_pushPullLock(bool isPull) {
+	if (isPull) {
+		if (_r37_word_35CEC == 0 ||
+			(_r37_safeCombinationCurrentNumber == 0 && _r37_safeCombinationIndex == 0 && _r37_safeCombinationLockIndex != 0)) {
+			_r37_flags &= ~0x02;
+			_r37_safeCombinationIndex = 0;
+			_r37_safeCombinationCurrentNumber = 0;
+			_r37_word_35CEC = 0;
+		} else {
+			_r37_safeCombinationCurrentNumber = _r37_safeCombinationCurrentNumber + 1;
+			if (kRoom37CorrectSafeCombination[_r37_safeCombinationIndex] == _r37_safeCombinationCurrentNumber) {
+				_r37_safeCombinationIndex++;
+				_r37_safeCombinationCurrentNumber = 0;
+				_r37_word_35CEC = (_r37_word_35CEC + 1) % 2;
+			}
+		}
+		_r37_safeCombinationLockIndex = (_r37_safeCombinationLockIndex + 1) % 8;
+	} else {
+		if (_r37_word_35CEC != 0 ||
+			(_r37_safeCombinationCurrentNumber == 0 && _r37_safeCombinationIndex == 0 && _r37_safeCombinationLockIndex != 0)) {
+			_r37_flags &= ~0x02;
+			_r37_safeCombinationIndex = 0;
+			_r37_safeCombinationCurrentNumber = 0;
+			_r37_word_35CEC = 0;
+		} else {
+			_r37_safeCombinationCurrentNumber = _r37_safeCombinationCurrentNumber + 1;
+			if (kRoom37CorrectSafeCombination[_r37_safeCombinationIndex] == _r37_safeCombinationCurrentNumber) {
+				_r37_safeCombinationIndex++;
+				_r37_safeCombinationCurrentNumber = 0;
+				_r37_word_35CEC = (_r37_word_35CEC + 1) % 2;
+			}
+		}
+		_r37_safeCombinationLockIndex = (_r37_safeCombinationLockIndex + 7) % 8;
+	}
+	if (_r37_safeCombinationIndex == 6) {
+		_r37_safeCombinationCurrentNumber = 0;
+		_r37_safeCombinationIndex = 0;
+		_r37_flags |= 0x02;
+	}
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r37_pullHandle() {
+	_r37_flags |= 0x04;
+	_vm->moveObjectToNowhere(kObjectIdSafe_1);
+	_vm->moveObjectToNowhere(kObjectIdLock_1);
+	_vm->moveObjectToNowhere(kObjectIdHandle);
+	_vm->moveObjectToRoom(kObjectIdMagazines, 37);
+	_vm->moveObjectToRoom(kObjectIdKeys, 37);
+	_vm->moveObjectToRoom(kObjectIdMoney, 37);
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r37_handleRoomEvent() {
+	Common::String tempFilename;
+	WWSurface *workBackground;
+	WWSurface *wclimbSprites[4];
+	WWSurface *gclimbSprites[4];
+	WWSurface *getldrSprites[3];
+
+	for (int index = 0; index < 4; index++) {
+		tempFilename = Common::String::format("wclimb%d", index);
+		wclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		tempFilename = Common::String::format("gclimb%d", index);
+		gclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	for (int index = 0; index < 3; index++) {
+		tempFilename = Common::String::format("wgetldr%d", index);
+		getldrSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	workBackground = new WWSurface(320, 150);
+
+	int climbCtr = 0, wayneLadderY = -46, garthLadderY = -46;
+	while (climbCtr < 24) {
+		if (climbCtr % 2 == 0) {
+			wayneLadderY += 7;
+			if (climbCtr > 12) {
+				garthLadderY += 7;
+			}
+		}
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		workBackground->drawSurfaceTransparent(gclimbSprites[climbCtr % 4], 105, garthLadderY);
+		if (climbCtr < 20) {
+			workBackground->drawSurfaceTransparent(wclimbSprites[climbCtr % 4], 105, wayneLadderY);
+		} else if (climbCtr > 22) {
+			workBackground->drawSurfaceTransparent(_vm->_wayneSprites[0], 151, 22);
+		} else {
+			workBackground->drawSurfaceTransparent(getldrSprites[22 - climbCtr], 105, 26);
+		}
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);
+		climbCtr++;
+	}
+
+	for (int index = 0; index < 3; index++) {
+		delete getldrSprites[index];
+	}
+
+	for (int index = 0; index < 3; index++) {
+		tempFilename = Common::String::format("ggetldr%d", index);
+		getldrSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+	}
+
+	for (int index = 2; index >= 0; index--) {
+		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
+		workBackground->drawSurfaceTransparent(getldrSprites[index], 105, 26);
+		workBackground->drawSurfaceTransparent(_vm->_wayneSprites[0], 151, 22);
+		_vm->_screen->drawSurface(workBackground, 0, 0);
+		_vm->waitMillis(200);
+	}
+
+	for (int index = 0; index < 4; index++) {
+		delete wclimbSprites[index];
+		delete gclimbSprites[index];
+	}
+
+	for (int index = 0; index < 3; index++) {
+		delete getldrSprites[index];
+	}
+
+	delete workBackground;
+	
+	_vm->setWaynePosition(163, 70);
+	_vm->setGarthPosition(138, 75);
+	_vm->refreshActors();
+}
+
+int GameLogic::r38_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit38:
+		if (_vm->_hasRoomAnimationCallback) {
+			r38_uninitRoomAnimations();
+		}
+		_vm->changeRoom(24);
+		break;
+	case kObjectIdCassandra:
+		if (_r38_flags & 0x02) {
+			r38_useCassandra();
+			actionTextIndex = -1;
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	case kObjectIdEquipment:
+		actionTextIndex = 76;
+		break;
+	case kObjectIdHypnoBoard:
+		actionTextIndex = 77;
+		break;
+	case kObjectIdPipes:
+		actionTextIndex = 7;
+		break;
+	case kObjectIdRag:
+		actionTextIndex = 7;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r38_handleVerbPull() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdRag:
+		if (!(_r38_flags & 0x04)) {
+			actionTextIndex = 5;
+		} else {
+			r38_pullRag();
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r38_initRoomAnimations() {
+	_vm->loadAnimationSpriteRange(0, "hypno", 20);
+	_vm->startRoomAnimations();
+}
+
+void GameLogic::r38_uninitRoomAnimations() {
+	_vm->stopRoomAnimations();
+}
+
+void GameLogic::r38_updateRoomAnimations(bool doUpdate) {
+	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 8000;
+	if (doUpdate) {
+		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 8000;
+	}
+	if (_vm->_animationsCtr % 400 == 0 || doUpdate) {
+		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 400, 8, 38);
+		_vm->_hasRoomAnimationCallback = false;
+		_vm->refreshActors();
+		_vm->_hasRoomAnimationCallback = true;
+	}
+}
+
+void GameLogic::r38_refreshRoomBackground() {
+	_r38_flags |= 0x01;
+	if (!_vm->_hasRoomAnimationCallback != 0 || !(_r38_flags & 0x08)) {
+		r38_initRoomAnimations();
+	}
+	if ((_r38_flags & 0x08)) {
+		_vm->drawRoomImageToBackground("backg2", 0, 0);
+		_vm->setStaticRoomObjectPosition(38, 2, 2, 166, 94);
+	} else {
+		if (_r35_flags & 0x01) {
+			_vm->setStaticRoomObjectPosition(38, 1, 1, 220, 98);
+			_vm->moveObjectToRoom(kObjectIdCassandra, 38);
+		} else {
+			_vm->setStaticRoomObjectPosition(38, 1, 1, -1, 72);
+			_vm->moveObjectToNowhere(kObjectIdCassandra);
+		}
+	}
+}
+
+void GameLogic::r38_atrap() {
+	_vm->walkTo(153, 137, 0, 189, 137);
+	_vm->_wayneSpriteX = -1;
+	_vm->_garthSpriteX = -1;
+	_vm->playAnimation("atrap", 0, 12, 128, 56, 0, 100);
+	_r38_flags |= 0x02;
+}
+
+void GameLogic::r38_useCassandra() {
+	_vm->moveObjectToNowhere(kObjectIdCassandra);
+	_vm->setStaticRoomObjectPosition(38, 1, 1, -1, 72);
+	_vm->drawRoomImageToScreen("nocass", 168, 76);
+	_vm->drawRoomImageToBackground("nocass", 168, 76);
+	_vm->playAnimation("btrap", 0, 25, 124, 15, 0, 100);
+	_r38_flags |= 0x04;
+}
+
+void GameLogic::r38_pullRag() {
+	_vm->moveObjectToNowhere(kObjectIdRag);
+	_vm->playAnimation("apulrg", 0, 28, 106, 10, 0, 50);
+	r38_uninitRoomAnimations();
+	for (int i = 0; i < 21; i++) {
+		_vm->playAnimation("bpulrg", i, 1, 105, 10, 0, 1);
+		_vm->playAnimation("noo", i, 1, 8, 38, 0, 50);
+	}
+	_vm->playAnimation("aendit", 0, 10, 0, 16, 0, 50);
+	_vm->playAnimation("bendit", 0, 4, 0, 33, 0, 50);
+	_r38_flags |= 0x08;
+	_vm->setStaticRoomObjectPosition(38, 2, 2, 166, 94);
+	_vm->setWaynePosition(126, 137);
+	_vm->setGarthPosition(209, 132);
+	_vm->_actorSpriteValue = 5;
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->displayTextLines("c04r", 344, 180, 35, 5);
+}
+
+int GameLogic::r39_handleVerbUse() {
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdExit39:
+		r39_useExit39();
+		break;
+	case kObjectIdExit:
+		r39_useExit();
+		break;
+	case kObjectIdHinges:
+		if (_vm->_firstObjectNumber == kObjectIdInventorySquirtGun) {
+			if (_r39_flags & 0x01) {
+				r39_useSquirtGunWithHinges();
+			} else {
+				actionTextIndex = 64;
+			}
+		} else if (_vm->_firstObjectNumber == kObjectIdInventoryBeakerOfAcid) {
+			actionTextIndex = 65;
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	case kObjectIdLocks:
+		if (_vm->_firstObjectNumber == kObjectIdInventorySquirtGun) {
+			if (_r39_flags & 0x01) {
+				actionTextIndex = 63;
+			} else {
+				actionTextIndex = 64;
+			}
+		} else if (_vm->_firstObjectNumber == kObjectIdInventoryBeakerOfAcid) {
+			actionTextIndex = 63;
+		} else {
+			actionTextIndex = 0;
+		}
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+int GameLogic::r39_handleVerbOpen() {	
+	int actionTextIndex = -1;
+	switch (_vm->_objectNumber) {
+	case kObjectIdDoor39:
+		actionTextIndex = 4;
+		break;
+	default:
+		actionTextIndex = 0;
+		break;
+	}
+	return actionTextIndex;
+}
+
+void GameLogic::r39_refreshRoomBackground() {
+	if (_r39_flags & 0x02) {
+		_vm->drawRoomImageToBackground("shoot13", 108, 49);
+	}
+	if (_r39_flags & 0x04) {
+		_vm->drawRoomImageToBackground("wshoot", 87, 90);
+	} else  if (_r39_flags & 0x08) {
+		_vm->drawRoomImageToBackground("gshoot", 88, 90);
+	}
+}
+
+void GameLogic::r39_useSquirtGunWithHinges() {
+	int oldSpriteX;
+	if (_vm->_currentActorNum != 0) {
+		_vm->walkTo(_vm->_wayneSpriteX - 1, _vm->_wayneSpriteY, _vm->_actorSpriteValue, 60, 135);
+		oldSpriteX = _vm->_wayneSpriteX;
+		_vm->_wayneSpriteX = -1;
+		_r39_flags |= 0x04;
+	} else {
+		_vm->walkTo(_vm->_garthSpriteX - 1, _vm->_garthSpriteY, _vm->_actorSpriteValue, 60, 135);
+		oldSpriteX = _vm->_garthSpriteX;
+		_vm->_garthSpriteX = -1;
+		_r39_flags |= 0x08;
+	}
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->playAnimation("shoot", 0, 14, 108, 49, 0, 100);
+	_r39_flags |= 0x02;
+	_vm->moveObjectToNowhere(kObjectIdDoor39);
+	_vm->moveObjectToNowhere(kObjectIdHinges);
+	_vm->moveObjectToNowhere(kObjectIdLocks);
+	_vm->moveObjectToRoom(kObjectIdExit, 39);
+	_r39_flags &= ~0x04;
+	_r39_flags &= ~0x08;
+	if (_vm->_currentActorNum != 0) {
+		_vm->_wayneSpriteX = oldSpriteX;
+	} else {
+		_vm->_garthSpriteX = oldSpriteX;
+	}
+	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+}
+
+void GameLogic::r39_useExit39() {
+	_r24_mazeHoleNumber = 2;
+	_r24_mazeRoomNumber = 32;
+	_vm->changeRoom(24);
+}
+
+void GameLogic::r39_useExit() {
+	_r24_mazeHoleNumber = 4;
+	_r24_mazeRoomNumber = 49;
+	_vm->changeRoom(24);
+}
+
+} // End of namespace WaynesWorld
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
new file mode 100644
index 00000000000..2501afcdefd
--- /dev/null
+++ b/engines/waynesworld/gamelogic.h
@@ -0,0 +1,445 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WAYNESWORLD_GAMELOGIC_H
+#define WAYNESWORLD_GAMELOGIC_H
+
+#include "waynesworld/waynesworld.h"
+
+namespace WaynesWorld {
+
+class GameLogic {
+public:
+	GameLogic(WaynesWorldEngine *vm);
+	~GameLogic();
+	void initVariables();
+	int handleVerbPickUp();
+	int handleVerbUse();
+	void handleVerbTalkTo();
+	int handleVerbPush();
+	int handleVerbPull();
+	int handleVerbOpen();
+	int handleVerbClose();
+	int handleVerbGive();
+	void handleDialogReply(int index, int x, int y);
+	bool handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void refreshRoomBackground(int roomNum);
+	void updateRoomAnimations(bool doUpdate);
+	void handleRoomEvent(int eventNum);
+	void r38_atrap();
+public:
+	int _word_34464;
+	int _word_34466;
+	int _r37_safeCombinationLockIndex;
+	int _r37_word_35CEC;
+	int _r37_safeCombinationIndex;
+	int _r37_safeCombinationCurrentNumber;
+	int _r12_talkObjectNumber;
+	byte _pizzathonListFlags1;
+	byte _pizzathonListFlags2;
+	byte _r31_flags;
+	byte _r0_flags;
+	byte _r4_flags;
+	byte _r5_flags;
+	byte _r7_flags;
+	byte _r11_flags;
+	byte _r32_flags;
+	byte _r1_flags1;
+	byte _r1_flags2;
+	byte _r2_flags;
+	byte _r6_flags;
+	byte _r10_flags;
+	byte _r12_flags;
+	byte _r19_flags;
+	byte _r9_flags;
+	byte _r8_flags;
+	byte _r13_flags;
+	byte _r20_flags;
+	byte _r29_flags;
+	byte _r30_flags;
+	byte _r34_flags;
+	byte _r35_flags;
+	byte _r37_flags;
+	byte _r36_flags;
+	byte _r38_flags;
+	byte _r39_flags;
+	int _r10_selectedDialogChoice;
+	byte _r9_dialogFlag;
+	byte _r1_eventFlag;
+	byte _r1_eventCtr;
+	byte _r17_dialogCtr;
+	byte _r17_eventFlag;
+	byte _r2_backgroundValue1;
+	byte _r2_backgroundValue2;
+	int _r7_cloudsPositionX;
+	int _r19_wayneSpriteX;
+	int _r19_garthSpriteX;
+	int _r24_mazeRoomNumber;
+	int _r24_mazeHoleNumber;
+	int _r25_holeIndex;
+	int _r31_questionsAsked;
+	int _r31_correctAnswerChoice;
+	int _r31_categoryIndex;
+	int _r31_questionIndex;
+	bool _r31_categorySelected;
+	int _r31_currentPlayer;
+	int _r31_scores[3];
+	bool _r31_askedQuestions[25];
+// protected:
+public://DEBUG So logic functions can be called from the engine class for testing
+	WaynesWorldEngine *_vm;
+
+	int r0_handleVerbPickUp();
+	int r0_handleVerbUse();
+	int r0_handleVerbOpen();
+	bool r0_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r0_refreshRoomBackground();
+	void r0_handleRoomEvent1();
+	void r0_handleRoomEvent2();
+	void r0_handleRoomEvent3();
+	void r0_buildRandomDialogChoices(int selectedDialogChoice);
+
+	int r1_handleVerbPickUp();
+	int r1_handleVerbUse();
+	void r1_handleVerbTalkTo();
+	int r1_handleVerbPush();
+	int r1_handleVerbPull();
+	int r1_handleVerbOpen();
+	int r1_handleVerbClose();
+	bool r1_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r1_refreshRoomBackground();
+	void r1_handleRoomEvent(bool arg6);
+	void r1_initRoomAnimations();
+	void r1_uninitRoomAnimations();
+	void r1_updateRoomAnimations(bool doUpdate);
+	void r1_useDayOldDonutWithMachine();
+	void r1_checkDrGadget();
+	void r1_pullScreen();
+	void r1_pullLever();
+	void r1_openSafe();
+	void r1_closeSafe();
+	void r1_drGadgetLeaves();
+
+	int r2_handleVerbPickUp();
+	int r2_handleVerbUse();
+	void r2_handleVerbTalkTo();
+	int r2_handleVerbGive();
+	bool r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r2_refreshRoomBackground();
+	void r2_giveCandyBarToBikerGang();
+	void r2_handleDialogSelect369();
+	void r2_handleDialogSelect385();
+
+	int r3_handleVerbPickUp();
+	int r3_handleVerbUse();
+	void r3_handleVerbTalkTo();
+	bool r3_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r3_refreshRoomBackground();
+
+	int r4_handleVerbPickUp();
+	int r4_handleVerbUse();
+	void r4_handleVerbTalkTo();
+	int r4_handleVerbOpen();
+	bool r4_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r4_refreshRoomBackground();
+	void r4_handleRoomEvent();
+	void r4_initRoomAnimations();
+	void r4_uninitRoomAnimations();
+	void r4_updateRoomAnimations(bool doUpdate);
+	int r4_useCheesePizzaWithCastle();
+	int r4_useDrumstickWithCastleDoor();
+	void r4_useChainWithObject(bool arg6, bool arg8);
+	int r4_useTubeWithShade();
+
+	int r5_handleVerbPickUp();
+	int r5_handleVerbUse();
+	int r5_handleVerbPush();
+	int r5_handleVerbOpen();
+	bool r5_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r5_refreshRoomBackground();
+	void r5_handleRoomEvent();
+
+	int r6_handleVerbPickUp();
+	int r6_handleVerbUse();
+	int r6_handleVerbPull();
+	int r6_handleVerbOpen();
+	int r6_handleVerbGive();
+	bool r6_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r6_refreshRoomBackground();
+	void r6_handleRoomEvent1();
+	void r6_handleRoomEvent2();
+	void r6_handleRoomEvent3();
+	void r6_handleRoomEvent4();
+	void r6_initRoomAnimations();
+	void r6_uninitRoomAnimations();
+	void r6_updateRoomAnimations(bool doUpdate);
+	void r6_useRopeWithBeam();
+	void r6_useHockeyStickWithRope();
+	void r6_useSeat();
+	void r6_pullRope();
+	void r6_giveLuckySausageToDog();
+
+	int r7_handleVerbPickUp();
+	int r7_handleVerbUse();
+	void r7_handleVerbTalkTo();
+	int r7_handleVerbPush();
+	int r7_handleVerbOpen();
+	void r7_refreshRoomBackground();
+	void r7_initRoomAnimations();
+	void r7_uninitRoomAnimations();
+	void r7_updateRoomAnimations(bool doUpdate);
+	void r7_openCloseFrontDoor(bool isOpen);
+
+	int r8_handleVerbPickUp();
+	int r8_handleVerbUse();
+	int r8_handleVerbOpen();
+	int r8_handleVerbClose();
+	bool r8_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r8_refreshRoomBackground();
+	void r8_initRoomAnimations();
+	void r8_updateRoomAnimations(bool doUpdate);
+	void r8_handleRoomEvent1();
+	void r8_handleRoomEvent2();
+	void r8_handleRoomEvent3();
+	void r8_handleRoomEvent4();
+	void r8_openCloseDoor(bool isOpen);
+	void r8_openCloseCabinetDoor1(bool isOpen);
+	void r8_openCloseCabinetDoor2(bool isOpen);
+
+	int r9_handleVerbPickUp();
+	int r9_handleVerbUse();
+	void r9_handleVerbTalkTo();
+	int r9_handleVerbPush();
+	int r9_handleVerbGive();
+	bool r9_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r9_refreshRoomBackground();
+	void r9_initRoomAnimations();
+	void r9_uninitRoomAnimations();
+	void r9_updateRoomAnimations(bool doUpdate);
+	void r9_giveCoatOrTopHatToMan();
+
+	int r10_handleVerbPickUp();
+	int r10_handleVerbUse();
+	void r10_handleVerbTalkTo();
+	int r10_handleVerbPush();
+	int r10_handleVerbOpen();
+	int r10_handleVerbGive();
+	bool r10_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r10_refreshRoomBackground();
+	void r10_handleVerbPickUpCandyBar();
+	void r10_handleVerbPickUpTicket();
+	void r10_handleVerbPickUpGum();
+	void r10_handleVerbGiveWinningTicketToSalesgirl();
+	void r10_handleDialogSelect_6();
+	void r10_handleVerbPickUpJawbreakers();
+	void r10_refreshObject(int value);
+
+	int r11_handleVerbPickUp();
+	int r11_handleVerbUse();
+	int r11_handleVerbPush();
+	void r11_refreshRoomBackground();
+	void r11_initRoomAnimations();
+	void r11_uninitRoomAnimations();
+	void r11_updateRoomAnimations(bool doUpdate);
+	void r11_pickUpExtensionCord();
+	void r11_usePlungersWithLampPost();
+	void r11_useExtensionCordWithOutlet();
+	void r11_useSuckCutWithExtensionCord();
+	void r11_useSuckCutWithFountain();
+	void r11_useCar1();
+	void r11_useCar2();
+
+	int r12_handleVerbPickUp();
+	int r12_handleVerbUse();
+	void r12_handleVerbTalkTo();
+	int r12_handleVerbGive();
+	bool r12_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r12_refreshRoomBackground();
+	void r12_talkToLawyer();
+	void r12_givePotatoChipToCecil();
+
+	int r13_handleVerbPickUp();
+	int r13_handleVerbUse();
+	void r13_handleVerbTalkTo();
+	int r13_handleVerbGive();
+	bool r13_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r13_refreshRoomBackground();
+	void r13_giveTicketToRomeToPepe();
+	void r13_handleDialogSelect183();
+	void r13_handleRoomEvent();
+
+	int r14_handleVerbPickUp();
+	int r14_handleVerbUse();
+	void r14_refreshRoomBackground();
+
+	bool r15_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+
+	void r16_refreshRoomBackground();
+
+	int r17_handleVerbUse();
+	void r17_handleVerbTalkTo();
+	bool r17_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r17_refreshRoomBackground();
+	void r17_handleRoomEvent1();
+	void r17_handleRoomEvent2();
+	void r17_handleRoomEvent3();
+
+	void r18_refreshRoomBackground();
+	void r18_initRoomAnimations();
+	void r18_uninitRoomAnimations();
+	void r18_updateRoomAnimations(bool doUpdate);
+
+	void r19_handleVerbTalkTo();
+	bool r19_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r19_refreshRoomBackground();
+	void r19_handleRoomEvent();
+
+	void r20_refreshRoomBackground();
+	void r20_handleRoomEvent();
+
+	void r22_refreshRoomBackground();
+
+	int r24_handleVerbUse();
+	void r24_refreshRoomBackground();
+	void r24_handleRoomEvent(int wayneLadderX, int wayneX, int wayneLadderY, int ladderBottomY, int climbCtrMax, int ceilingIndex);
+	void r24_climbLadder(int wayneX, int wayneLadderX, int wayneLadderY, int ladderTopY, int ceilingIndex);
+	void r24_useMazeHole(int holeIndex);
+
+	int r25_handleVerbUse();
+	void r25_refreshRoomBackground();
+	void r25_updateMazeRoomHole(int mazeRoomNumber);
+
+	int r28_handleVerbUse();
+	bool r28_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r28_refreshRoomBackground();
+	void r28_handleRoomEvent1();
+	void r28_handleRoomEvent2();
+
+	int r29_handleVerbPickUp();
+	int r29_handleVerbUse();
+	void r29_refreshRoomBackground();
+	void r29_handleRoomEvent();
+	void r29_initRoomAnimations();
+	void r29_uninitRoomAnimations();
+	void r29_updateRoomAnimations(bool doUpdate);
+
+	int r30_handleVerbPickUp();
+	int r30_handleVerbUse();
+	bool r30_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r30_refreshRoomBackground();
+	void r30_handleRoomEvent1();
+	void r30_handleRoomEvent2();
+	void r30_runLudwigCutscene();
+	void r30_talkToCecil();
+
+	int r31_handleVerbUse();
+	bool r31_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r31_refreshRoomBackground();
+	void r31_handleRoomEvent1();
+	void r31_handleRoomEvent2();
+	void r31_handleRoomEvent3();
+	void r31_handleRoomEvent4();
+	void r31_handleRoomEvent5();
+	void r31_correctAnswerSelected();
+	void r31_wrongAnswerSelected();
+	void r31_useBuzzer();
+	void r31_playTalkAnim(int index);
+	void r31_drawMBuzzer();
+	void r31_drawDBuzzer();
+	void r31_displayCategories();
+	void r31_runBabeoff();
+	void r31_drawCurrentPlayerScore();
+	void r31_buildQuestionDialogChoices(int categoryIndex, int questionIndex);
+
+	int r32_handleVerbPickUp();
+	int r32_handleVerbUse();
+	void r32_handleVerbTalkTo();
+	int r32_handleVerbOpen();
+	bool r32_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r32_refreshRoomBackground();
+	void r32_handleRoomEvent();
+	void r32_initRoomAnimations();
+	void r32_uninitRoomAnimations();
+	void r32_updateRoomAnimations(bool doUpdate);
+	void r32_pickUpMemo();
+
+	void r33_refreshRoomBackground();
+
+	int r34_handleVerbPickUp();
+	int r34_handleVerbUse();
+	void r34_handleVerbTalkTo();
+	int r34_handleVerbOpen();
+	int r34_handleVerbClose();
+	bool r34_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r34_refreshRoomBackground();
+	void r34_initRoomAnimations();
+	void r34_uninitRoomAnimations();
+	void r34_updateRoomAnimations(bool doUpdate);
+
+	int r35_handleVerbUse();
+	void r35_handleVerbTalkTo();
+	bool r35_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
+	void r35_refreshRoomBackground();
+	void r35_useSetOfKeysWithJailCells();
+	void r35_talkToCassandra();
+
+	int r36_handleVerbPickUp();
+	int r36_handleVerbUse();
+	void r36_refreshRoomBackground();
+	void r36_handleRoomEvent();
+	void r36_initRoomAnimations();
+	void r36_uninitRoomAnimations();
+	void r36_updateRoomAnimations(bool doUpdate);
+
+	int r37_handleVerbPickUp();
+	int r37_handleVerbUse();
+	int r37_handleVerbPush();
+	int r37_handleVerbPull();
+	void r37_refreshRoomBackground();
+	void r37_handleRoomEvent();
+	void r37_useLadder1();
+	void r37_useLadder2();
+	void r37_useLadder3();
+	void r37_pushPullLock(bool isPull);
+	void r37_pullHandle();
+
+	int r38_handleVerbUse();
+	int r38_handleVerbPull();
+	void r38_refreshRoomBackground();
+	void r38_initRoomAnimations();
+	void r38_uninitRoomAnimations();
+	void r38_updateRoomAnimations(bool doUpdate);
+	void r38_useCassandra();
+	void r38_pullRag();
+
+	int r39_handleVerbUse();
+	int r39_handleVerbOpen();
+	void r39_refreshRoomBackground();
+	void r39_useSquirtGunWithHinges();
+	void r39_useExit39();
+	void r39_useExit();
+
+};
+
+} // End of namespace WaynesWorld
+
+#endif // WAYNESWORLD_GAMELOGIC_H
diff --git a/engines/waynesworld/module.mk b/engines/waynesworld/module.mk
index 9dd72defca3..d6e6df85f38 100644
--- a/engines/waynesworld/module.mk
+++ b/engines/waynesworld/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/waynesworld
 MODULE_OBJS := \
 	waynesworld.o \
 	detection.o \
+	gamelogic.o \
 	gamemap.o \
 	graphics.o \
 	pathfinding.o \
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index d828b2cebff..6296875cab7 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "waynesworld/waynesworld.h"
+#include "waynesworld/gamelogic.h"
 #include "waynesworld/graphics.h"
 #include "waynesworld/objectids.h"
 
@@ -86,6 +87,8 @@ Common::Error WaynesWorldEngine::run() {
 	_fontWWInv->loadFromFile("wwinv.gft");
 	_fontBit5x7->loadFromFile("bit5x7.gft");
 
+	_logic = new GameLogic(this);
+
 	_wayneSpriteX = 94;
 	_wayneSpriteY = 112;
 	_garthSpriteX = 147;
@@ -136,7 +139,8 @@ Common::Error WaynesWorldEngine::run() {
 	drawImageToScreen("r00/backg", 0, 0);
 
 	drawInterface(2);
-	changeRoom(0);
+	// changeRoom(0);
+	changeRoom(1); // DEBUG
 
 	_gameState = 0; // DEBUG Initial _gameState 0 is set by room event in room 0
 	// _gameState = 1; // DEBUG Open map
@@ -147,14 +151,12 @@ Common::Error WaynesWorldEngine::run() {
 		updateEvents();
 		updateMouseMove();
 		if (_mouseClickButtons != 0) {
-			debug("_mouseClickButtons: %d", _mouseClickButtons);
+			// debug("_mouseClickButtons: %d", _mouseClickButtons);
 			handleMouseClick();
 		}
-		/* TODO
 		if (_roomEventNum != 0) {
 			handleRoomEvent();
 		}
-		*/
 		if (_gameState == 1 && _currentRoomNumber < 100) {
 			gameMapOpen();
 		}
@@ -165,6 +167,8 @@ Common::Error WaynesWorldEngine::run() {
 
 	unloadMainActorSprites();
 
+	delete _logic;
+
 	delete _fontWW;
 	delete _fontWWInv;
 	delete _fontBit5x7;
@@ -202,7 +206,6 @@ void WaynesWorldEngine::updateEvents() {
   			_mouseY = event.mouse.y;
   			break;
 		case Common::EVENT_LBUTTONDOWN:
-			debug("EVENT_LBUTTONDOWN");
 			_mouseClickButtons |= kLeftButtonClicked;
 			_mouseClickX = event.mouse.x;
 			_mouseClickY = event.mouse.y;
@@ -212,7 +215,6 @@ void WaynesWorldEngine::updateEvents() {
 			//_mouseClickButtons &= ~kLeftButtonDown;
   			break;
 		case Common::EVENT_RBUTTONDOWN:
-			debug("EVENT_RBUTTONDOWN");
 			_mouseClickButtons |= kRightButtonClicked;
 			_mouseClickX = event.mouse.x;
 			_mouseClickY = event.mouse.y;
@@ -492,9 +494,9 @@ void WaynesWorldEngine::paletteFadeOut(int index, int count, int stepsSize) {
 void WaynesWorldEngine::drawImageToSurfaceIntern(const char *filename, WWSurface *destSurface, int x, int y, bool transparent, bool appendRoomName) {
     Image::PCXDecoder *imageDecoder = loadImage(filename, appendRoomName);
 	if (transparent) {
-		destSurface->drawSurface(imageDecoder->getSurface(), x, y);
-	} else {
 		destSurface->drawSurfaceTransparent(imageDecoder->getSurface(), x, y);
+	} else {
+		destSurface->drawSurface(imageDecoder->getSurface(), x, y);
 	}
     delete imageDecoder;
 }
@@ -502,9 +504,9 @@ void WaynesWorldEngine::drawImageToSurfaceIntern(const char *filename, WWSurface
 void WaynesWorldEngine::drawImageToScreenIntern(const char *filename, int x, int y, bool transparent, bool appendRoomName) {
     Image::PCXDecoder *imageDecoder = loadImage(filename, appendRoomName);
 	if (transparent) {
-		_screen->drawSurface(imageDecoder->getSurface(), x, y);
-	} else {
 		_screen->drawSurfaceTransparent(imageDecoder->getSurface(), x, y);
+	} else {
+		_screen->drawSurface(imageDecoder->getSurface(), x, y);
 	}
     delete imageDecoder;
 }
@@ -1013,7 +1015,7 @@ void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int co
             waitMillis(ticks);
         }
     } else {
-        for (int index = startIndex; index > startIndex + count; index++) {
+        for (int index = startIndex; index > startIndex + count; index--) {
             updateRoomAnimations(true);
             sprintf(filename, "%s%d", prefix, index);
             drawRoomImageToScreen(filename, x, y);
@@ -1029,6 +1031,16 @@ void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int co
     // sysMouseDriver(1)
 }
 
+void WaynesWorldEngine::setWaynePosition(int x, int y) {
+    _wayneSpriteX = x;
+    _wayneSpriteY = y;
+}
+
+void WaynesWorldEngine::setGarthPosition(int x, int y) {
+    _garthSpriteX = x;
+    _garthSpriteY = y;
+}
+
 void WaynesWorldEngine::openRoomLibrary(int roomNum) {
     _roomName = Common::String::format("r%02d", roomNum);
 }
@@ -1051,12 +1063,20 @@ void WaynesWorldEngine::changeRoom(int roomNum) {
     }
     _actorSpriteValue = 0;
     _currentRoomNumber = roomNum;
-    _byte_306E7++;
+    _roomChangeCtr++;
     loadRoomBackground(roomNum);
 }
 
 void WaynesWorldEngine::refreshRoomBackground(int roomNum) {
-	logic_refreshRoomBackground(roomNum);
+	_logic->refreshRoomBackground(roomNum);
+}
+
+void WaynesWorldEngine::handleRoomEvent() {
+    if (_roomEventNum != 0) {
+		int eventNum = _roomEventNum;
+		_roomEventNum = 0;
+		_logic->handleRoomEvent(eventNum);
+	}
 }
 
 void WaynesWorldEngine::changeRoomScrolling() {
@@ -1077,7 +1097,34 @@ void WaynesWorldEngine::loadRoomMask(int roomNum) {
 	fd.read(_walkMap, kWalkMapSize);
 }
 
+void WaynesWorldEngine::fillRoomMaskArea(int x1, int y1, int x2, int y2, int enabled) {
+	// TODO
+}
+
+void WaynesWorldEngine::loadAnimationSpriteRange(int baseIndex, const char *filename, int count) {
+	// TODO
+}
+
+void WaynesWorldEngine::loadAnimationSprite(int index, const char *filename) {
+	// TODO
+}
+
+void WaynesWorldEngine::drawAnimationSpriteToBackground(int index, int x, int y) {
+	// TODO
+}
+
 void WaynesWorldEngine::updateRoomAnimations(bool doUpdate) {
+	if (_hasRoomAnimationCallback) {
+		_logic->updateRoomAnimations(doUpdate);
+	}
+}
+
+void WaynesWorldEngine::startRoomAnimations() {
+	_animationsCtr = 0;
+	_hasRoomAnimationCallback = true;
+}
+
+void WaynesWorldEngine::stopRoomAnimations() {
 	// TODO
 }
 
@@ -1089,6 +1136,10 @@ void WaynesWorldEngine::unloadStaticRoomObjects() {
 	// TODO
 }
 
+void WaynesWorldEngine::setStaticRoomObjectPosition(int roomNum, int fromIndex, int toIndex, int x, int y) {
+	// TODO
+}
+
 void WaynesWorldEngine::drawStaticRoomObjects(int roomNumber, int x, int y, int actorHeight, int actorWidth, WWSurface *surface) {
 	// TODO
 }
@@ -1215,14 +1266,14 @@ void WaynesWorldEngine::handleDialogMouseClick() {
     _isTextVisible = false;
     refreshActors();
 
-    continueDialog = logic_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+    continueDialog = _logic->handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
 
     if (replyTextIndex1 != -1) {
-        logic_handleDialogReply(replyTextIndex1, replyTextX, replyTextY);
+        _logic->handleDialogReply(replyTextIndex1, replyTextX, replyTextY);
         if (replyTextIndex2 != -1) {
-            logic_handleDialogReply(replyTextIndex2, replyTextX, replyTextY);
+            _logic->handleDialogReply(replyTextIndex2, replyTextX, replyTextY);
             if (replyTextIndex3 != -1) {
-                logic_handleDialogReply(replyTextIndex3, replyTextX, replyTextY);
+                _logic->handleDialogReply(replyTextIndex3, replyTextX, replyTextY);
             }
         }
     }
@@ -1283,7 +1334,7 @@ void WaynesWorldEngine::handleVerbPickUp() {
         refreshActors();
     }
 
-    actionTextIndex = logic_handleVerbPickUp();
+    actionTextIndex = _logic->handleVerbPickUp();
 
     if (_objectNumber == -3) {
         actionTextIndex = 29;
@@ -1388,13 +1439,13 @@ void WaynesWorldEngine::handleVerbUse() {
     }
 
     if (_firstObjectNumber == kObjectIdInventoryBeakerOfAcid && _objectNumber == kObjectIdInventorySquirtGun) {
-        // TODO _byte_3070E |= 0x01;
+        _logic->_r39_flags |= 0x01;
         moveObjectToNowhere(kObjectIdInventoryBeakerOfAcid);
         refreshInventory(true);
         return;
     }
 
-    actionTextIndex = logic_handleVerbUse();
+    actionTextIndex = _logic->handleVerbUse();
 
     if (_firstObjectNumber == kObjectIdInventoryPlungers && _objectNumber != kObjectIdLampPost) {
         actionTextIndex = 44;
@@ -1409,14 +1460,12 @@ void WaynesWorldEngine::handleVerbUse() {
     if (_objectNumber == -3) {
         actionTextIndex = 31;
     } else if (_objectNumber == -2) {
-		/* TODO
-        if (_currentRoomNumber == 38 && (_byte_3070A & 0x01)) {
-            r38_atrap();
+        if (_currentRoomNumber == 38 && (_logic->_r35_flags & 0x01)) {
+            _logic->r38_atrap();
             actionTextIndex = -1;
         } else {
             actionTextIndex = 32;
         }
-		*/
     }
 
     _firstObjectNumber = -1;
@@ -1454,7 +1503,7 @@ void WaynesWorldEngine::handleVerbTalkTo() {
     _dialogChoices[0] = -1;
 
     if (_objectNumber == -3 || _objectNumber == -2) {
-        bool room1Special = false; // TODO !(_byte_306FC & 0x10) && _currentActorNum != 0 && _currentRoomNumber == 1 && (_byte_306FD & 0x01);
+        bool room1Special = !(_logic->_r1_flags1 & 0x10) && _currentActorNum != 0 && _currentRoomNumber == 1 && (_logic->_r1_flags2 & 0x01);
         if (room1Special) {
             actionTextIndex = 14;
         } else {
@@ -1490,7 +1539,7 @@ void WaynesWorldEngine::handleVerbTalkTo() {
         return;
     }
 
-	logic_handleVerbTalkTo();
+	_logic->handleVerbTalkTo();
 
     if (_dialogChoices[0] != -1) {
         startDialog();
@@ -1506,7 +1555,7 @@ void WaynesWorldEngine::handleVerbPush() {
         refreshActors();
     }
 
-    actionTextIndex = logic_handleVerbPush();
+    actionTextIndex = _logic->handleVerbPush();
 
     if (actionTextIndex != -1) {
         displayText("c05", actionTextIndex, 0, -1, -1, 0);
@@ -1531,7 +1580,7 @@ void WaynesWorldEngine::handleVerbPull() {
         refreshActors();
     }
 
-    actionTextIndex = logic_handleVerbPull();
+    actionTextIndex = _logic->handleVerbPull();
 
     if (actionTextIndex != -1) {
         displayText("c06", actionTextIndex, 0, -1, -1, 0);
@@ -1574,7 +1623,7 @@ void WaynesWorldEngine::handleVerbGive() {
         return;
     }
 
-    actionTextIndex = logic_handleVerbGive();
+    actionTextIndex = _logic->handleVerbGive();
 
     _firstObjectNumber = -1;
 
@@ -1592,7 +1641,7 @@ void WaynesWorldEngine::handleVerbOpen() {
         refreshActors();
     }
 
-    actionTextIndex = logic_handleVerbOpen();
+    actionTextIndex = _logic->handleVerbOpen();
 
     if (actionTextIndex != -1) {
         displayText("c09", actionTextIndex, 0, -1, -1, 0);
@@ -1632,7 +1681,7 @@ void WaynesWorldEngine::handleVerbClose() {
         refreshActors();
     }
 
-    actionTextIndex = logic_handleVerbClose();
+    actionTextIndex = _logic->handleVerbClose();
 
     if (actionTextIndex != -1) {
         displayText("c10", actionTextIndex, 0, -1, -1, 0);
@@ -1649,55 +1698,7 @@ void WaynesWorldEngine::handleVerbClose() {
 
 }
 
-int WaynesWorldEngine::logic_handleVerbPickUp() {
-	// TODO
-	return 0;
-}
-
-int WaynesWorldEngine::logic_handleVerbUse() {
-	// TODO
-	return 0;
-}
-
-void WaynesWorldEngine::logic_handleVerbTalkTo() {
-	// TODO
-}
-
-int WaynesWorldEngine::logic_handleVerbPush() {
-	// TODO
-	return 0;
-}
-
-int WaynesWorldEngine::logic_handleVerbPull() {
-	// TODO
-	return 0;
-}
-
-int WaynesWorldEngine::logic_handleVerbOpen() {
-	// TODO
-	return 0;
-}
-
-int WaynesWorldEngine::logic_handleVerbClose() {
-	// TODO
-	return 0;
-}
-
-int WaynesWorldEngine::logic_handleVerbGive() {
-	// TODO
-	return 0;
-}
-
-void WaynesWorldEngine::logic_handleDialogReply(int index, int x, int y) {
-	// TODO
-}
-
-int WaynesWorldEngine::logic_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
-	// TODO
-	return 0;
-}
-
-void WaynesWorldEngine::logic_refreshRoomBackground(int roomNum) {
+void WaynesWorldEngine::setGameFlag(int flagNum) {
 	// TODO
 }
 
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 7ee9fa48804..37e8145c52c 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -49,6 +49,7 @@ enum {
 class Screen;
 class WWSurface;
 class GFTFont;
+class GameLogic;
 
 struct RoomObject {
     int roomNumber;
@@ -91,6 +92,7 @@ private:
 
 public:
 	Common::RandomSource *_random;
+	GameLogic *_logic;
 
 	void updateEvents();
 
@@ -107,9 +109,10 @@ public:
 	byte *_walkMap;
 	int _word_306DB;
 	int _word_306DD;
-	int _byte_306E7;
+	int _roomChangeCtr;
 	int _from_x1;
 	bool _doScrollRight;
+	bool _hasRoomAnimationCallback;
 
 	// Input
 	int _mouseX, _mouseY;
@@ -136,6 +139,7 @@ public:
 	int _firstObjectNumber;
 	Common::String _firstObjectName;
 	int _roomEventNum;
+	int _animationsCtr;
 
 	// Actors
 	int _wayneSpriteX, _wayneSpriteY, _wayneKind, _wayneActorScale;
@@ -239,6 +243,8 @@ public:
 	void refreshActors();
 	void pickupObject(int objectId, byte &flags, byte flagsSet, int inventoryObjectId);
 	void playAnimation(const char *prefix, int startIndex, int count, int x, int y, int flag, uint ticks);
+	void setWaynePosition(int x, int y);
+	void setGarthPosition(int x, int y);
 
 	// Pathfinding
 	bool walkIsPixelWalkable(int x, int y);
@@ -258,14 +264,22 @@ public:
 	void loadRoomBackground(int roomNum);
 	void changeRoom(int roomNum);
 	void refreshRoomBackground(int roomNum);
+	void handleRoomEvent();
 	void changeRoomScrolling();
 	void loadScrollSprite();
 	void loadRoomMask(int roomNum);
+	void fillRoomMaskArea(int x1, int y1, int x2, int y2, int enabled);
 
+	void loadAnimationSpriteRange(int baseIndex, const char *filename, int count);
+	void loadAnimationSprite(int index, const char *filename);
+	void drawAnimationSpriteToBackground(int index, int x, int y);
 	void updateRoomAnimations(bool doUpdate);
+	void startRoomAnimations();
+	void stopRoomAnimations();
 
 	void loadStaticRoomObjects(int roomNum);
 	void unloadStaticRoomObjects();
+	void setStaticRoomObjectPosition(int roomNum, int fromIndex, int toIndex, int x, int y);
 	void drawStaticRoomObjects(int roomNumber, int x, int y, int actorHeight, int actorWidth, WWSurface *surface);
 
 	// Room objects
@@ -298,25 +312,14 @@ public:
 	void handleVerbOpen();
 	void handleVerbClose();
 
+	void setGameFlag(int flagNum);
+
 	void gameMapOpen();
 	void gameMapFinish();
 	void gameMapHandleMouseMove(int objectNumber);
 	void gameMapHandleMouseClick();
 	void gameMapSelectItem(const char *prefix, int animX, int animY);
 
-	// Game logic
-	int logic_handleVerbPickUp();
-	int logic_handleVerbUse();
-	void logic_handleVerbTalkTo();
-	int logic_handleVerbPush();
-	int logic_handleVerbPull();
-	int logic_handleVerbOpen();
-	int logic_handleVerbClose();
-	int logic_handleVerbGive();
-	void logic_handleDialogReply(int index, int x, int y);
-	int logic_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
-	void logic_refreshRoomBackground(int roomNum);
-
 	// Savegame API
 
 	enum kReadSaveHeaderError {


Commit: 0f4c51b5fd3cd3348b9ff784cab099b56181d8da
    https://github.com/scummvm/scummvm/commit/0f4c51b5fd3cd3348b9ff784cab099b56181d8da
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:50+01:00

Commit Message:
WAYNESWORLD: Load and draw room animations

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 6296875cab7..096b87d16d1 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -73,6 +73,9 @@ Common::Error WaynesWorldEngine::run() {
 
 	_isSaveAllowed = false;
 
+	for (uint i = 0; i < kRoomAnimationsCount; i++)
+		_roomAnimations[i] = nullptr;
+
 	initGraphics(320, 200);
 	initMouseCursor();
 	_screen = new Screen();
@@ -160,6 +163,7 @@ Common::Error WaynesWorldEngine::run() {
 		if (_gameState == 1 && _currentRoomNumber < 100) {
 			gameMapOpen();
 		}
+		updateRoomAnimations(false);
 		g_system->updateScreen();
 	}
 
@@ -1102,15 +1106,19 @@ void WaynesWorldEngine::fillRoomMaskArea(int x1, int y1, int x2, int y2, int ena
 }
 
 void WaynesWorldEngine::loadAnimationSpriteRange(int baseIndex, const char *filename, int count) {
-	// TODO
+	for (int index = 0; index < count; index++) {
+		Common::String tempFilename = Common::String::format("%s%d", filename, index);
+		loadAnimationSprite(baseIndex + index, tempFilename.c_str());
+	}
 }
 
 void WaynesWorldEngine::loadAnimationSprite(int index, const char *filename) {
-	// TODO
+	delete _roomAnimations[index];
+	_roomAnimations[index] = loadRoomSurface(filename);
 }
 
 void WaynesWorldEngine::drawAnimationSpriteToBackground(int index, int x, int y) {
-	// TODO
+	_backgroundSurface->drawSurface(_roomAnimations[index], x, y);
 }
 
 void WaynesWorldEngine::updateRoomAnimations(bool doUpdate) {
@@ -1125,7 +1133,11 @@ void WaynesWorldEngine::startRoomAnimations() {
 }
 
 void WaynesWorldEngine::stopRoomAnimations() {
-	// TODO
+	for (uint i = 0; i < kRoomAnimationsCount; i++) {
+		delete _roomAnimations[i];
+		_roomAnimations[i] = nullptr;
+	}
+	_hasRoomAnimationCallback = false;
 }
 
 void WaynesWorldEngine::loadStaticRoomObjects(int roomNum) {
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 37e8145c52c..7876691ebbe 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -72,6 +72,7 @@ enum {
 const uint kRoomObjectsCount = 404;
 const int kWalkPointsCount = 300;
 const uint kWalkMapSize = (320 * 150) / 8;
+const uint kRoomAnimationsCount = 20;
 
 class WaynesWorldEngine : public Engine {
 protected:
@@ -103,6 +104,7 @@ public:
 	GFTFont *_fontWW;
 	GFTFont *_fontWWInv;
 	GFTFont *_fontBit5x7;
+	WWSurface *_roomAnimations[kRoomAnimationsCount];
 
 	// Room
 	Common::String _roomName;


Commit: c752506d2d64f0399cf36bfb613c31664aa19259
    https://github.com/scummvm/scummvm/commit/c752506d2d64f0399cf36bfb613c31664aa19259
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:50+01:00

Commit Message:
WAYNESWORLD: Implement palette fade in/out

Changed paths:
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 096b87d16d1..bd3086e42f5 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -488,11 +488,45 @@ void WaynesWorldEngine::loadPalette(const char *filename) {
 }
 
 void WaynesWorldEngine::paletteFadeIn(int index, int count, int stepsSize) {
-	// TODO
+	byte fadePalette[768];
+	int fadeStartIndex = index * 3;
+	int fadeEndIndex = (index + count) * 3;
+	bool isDone = false;
+	// CHECKME Assume we're always fading in from black for now
+	memset(fadePalette, 0, 768);
+	while (!isDone) {
+		isDone = true;
+		for (int fadeIndex = fadeStartIndex; fadeIndex < fadeEndIndex; fadeIndex++) {
+			byte destValue = _palette2[fadeIndex];
+			if (fadePalette[fadeIndex] < destValue) {
+				fadePalette[fadeIndex] = MIN<int>(fadePalette[fadeIndex] + stepsSize, destValue);
+				isDone = false;
+			}
+		}
+		g_system->getPaletteManager()->setPalette(fadePalette, 0, 256);
+		g_system->updateScreen();
+		g_system->delayMillis(20);
+	}
 }
 
 void WaynesWorldEngine::paletteFadeOut(int index, int count, int stepsSize) {
-	// TODO
+	byte fadePalette[768];
+	int fadeStartIndex = index * 3;
+	int fadeEndIndex = (index + count) * 3;
+	bool isDone = false;
+	memcpy(fadePalette, _palette2, 768);
+	while (!isDone) {
+		isDone = true;
+		for (int fadeIndex = fadeStartIndex; fadeIndex < fadeEndIndex; fadeIndex++) {
+			if (fadePalette[fadeIndex] > 0) {
+				fadePalette[fadeIndex] = MAX<int>(fadePalette[fadeIndex] - stepsSize, 0);
+				isDone = false;
+			}
+		}
+		g_system->getPaletteManager()->setPalette(fadePalette, 0, 256);
+		g_system->updateScreen();
+		g_system->delayMillis(20);
+	}
 }
 
 void WaynesWorldEngine::drawImageToSurfaceIntern(const char *filename, WWSurface *destSurface, int x, int y, bool transparent, bool appendRoomName) {


Commit: 97c2dc25a8e989d546f3f74dbaeaf084c57e8b82
    https://github.com/scummvm/scummvm/commit/97c2dc25a8e989d546f3f74dbaeaf084c57e8b82
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:50+01:00

Commit Message:
WAYNESWORLD: Add transparent drawing of room animations; Rename those methods

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 88ae2541876..0b9439c1fe8 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -1392,13 +1392,13 @@ void GameLogic::r1_uninitRoomAnimations() {
 void GameLogic::r1_updateRoomAnimations(bool doUpdate) {
 	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 5000;
 	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
-		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 500, 270, 47);
+		_vm->drawAnimationSprite(_vm->_animationsCtr / 500, 270, 47);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
 	}
 	if (!(_r1_flags1 & 0x10) && (_vm->_animationsCtr % 200 == 55 || doUpdate)) {
-		_vm->drawAnimationSpriteToBackground(10 + _vm->getRandom(5), 179, 67);
+		_vm->drawAnimationSprite(10 + _vm->getRandom(5), 179, 67);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
@@ -2347,22 +2347,22 @@ void GameLogic::r4_updateRoomAnimations(bool doUpdate) {
 		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 1000;
 	}
 	if (_vm->_animationsCtr % 350 == 0 && _vm->getRandom(10) < 3) {
-		_vm->drawAnimationSpriteToBackground(1, 8, 48);
+		_vm->drawAnimationSprite(1, 8, 48);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
 	} else if (_vm->_animationsCtr % 400 == 0 && _vm->getRandom(10) < 8) {
-		_vm->drawAnimationSpriteToBackground(0, 8, 48);
+		_vm->drawAnimationSprite(0, 8, 48);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
 	} else if (_vm->_animationsCtr == 100 && _vm->getRandom(10) < 1) {
-		_vm->drawAnimationSpriteToBackground(3, 11, 67);
+		_vm->drawAnimationSprite(3, 11, 67);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
 	} else if (_vm->_animationsCtr == 150 && _vm->getRandom(10) < 2) {
-		_vm->drawAnimationSpriteToBackground(2, 11, 67);
+		_vm->drawAnimationSprite(2, 11, 67);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
@@ -2834,7 +2834,7 @@ void GameLogic::r6_updateRoomAnimations(bool doUpdate) {
 		_vm->_animationsCtr = (_vm->_animationsCtr + 200) % 1200;
 	}
 	if (!(_r6_flags & 0x01) && (_vm->_animationsCtr % 400 == 0 || doUpdate)) {
-		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 400, 49, 111);
+		_vm->drawAnimationSprite(_vm->_animationsCtr / 400, 49, 111);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
@@ -3205,15 +3205,15 @@ void GameLogic::r7_updateRoomAnimations(bool doUpdate) {
 	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 4000;
 	if (_vm->_animationsCtr % 500 == 0) {
 		_r7_cloudsPositionX = (_r7_cloudsPositionX + 1) % 230;
-		_vm->drawAnimationSpriteToBackground(2, 0, 0);
-		_vm->drawAnimationSpriteToBackground(0, _r7_cloudsPositionX - 125, 13);
-		_vm->drawAnimationSpriteToBackground(1, 0, 13);
+		_vm->drawAnimationSprite(2, 0, 0);
+		_vm->drawAnimationSpriteTransparent(0, _r7_cloudsPositionX - 125, 13);
+		_vm->drawAnimationSpriteTransparent(1, 0, 13);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
 	}
 	if (_vm->_animationsCtr % 2000 == 0) {
-		_vm->drawAnimationSpriteToBackground(3 + (_vm->_animationsCtr / 2000), 197, 68);
+		_vm->drawAnimationSprite(3 + (_vm->_animationsCtr / 2000), 197, 68);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
@@ -3558,7 +3558,7 @@ void GameLogic::r8_updateRoomAnimations(bool doUpdate) {
 		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 4500;
 	}
 	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
-		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 500, 85, 38);
+		_vm->drawAnimationSprite(_vm->_animationsCtr / 500, 85, 38);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
@@ -3933,7 +3933,7 @@ void GameLogic::r9_updateRoomAnimations(bool doUpdate) {
 		_vm->_animationsCtr = (_vm->_animationsCtr + 200) % 5000;
 	}
 	if (_vm->_animationsCtr % 1000 == 0 || doUpdate) {
-		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 1000, 124, 27);
+		_vm->drawAnimationSprite(_vm->_animationsCtr / 1000, 124, 27);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
@@ -4437,9 +4437,9 @@ void GameLogic::r11_updateRoomAnimations(bool doUpdate) {
 		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 2000;
 	}
 	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
-		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 500, 45, 92);
+		_vm->drawAnimationSprite(_vm->_animationsCtr / 500, 45, 92);
 		if (_r11_flags & 0x04) {
-			_vm->drawAnimationSpriteToBackground(4, 116, 125);
+			_vm->drawAnimationSprite(4, 116, 125);
 		}
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
@@ -6254,17 +6254,17 @@ void GameLogic::r29_updateRoomAnimations(bool doUpdate) {
 		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 5000;
 	}
 	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
-		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 500, 134, 0);
+		_vm->drawAnimationSprite(_vm->_animationsCtr / 500, 134, 0);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
 	} else if (_vm->_animationsCtr % 200 == 150 || doUpdate) {
-		_vm->drawAnimationSpriteToBackground(10 + _vm->getRandom(4), 0, 16);
+		_vm->drawAnimationSprite(10 + _vm->getRandom(4), 0, 16);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
 	} else if (_vm->_animationsCtr % 500 == 350 || doUpdate) {
-		_vm->drawAnimationSpriteToBackground(14 + _vm->getRandom(4), 172, 46);
+		_vm->drawAnimationSprite(14 + _vm->getRandom(4), 172, 46);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
@@ -7046,14 +7046,14 @@ void GameLogic::r32_updateRoomAnimations(bool doUpdate) {
 	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 3600;
 	if (_r32_flags & 0x04) {
 		if (_vm->_animationsCtr % 900 == 0 || doUpdate) {
-			_vm->drawAnimationSpriteToBackground(3 + (_vm->_animationsCtr / 900), 262, 83);
+			_vm->drawAnimationSprite(3 + (_vm->_animationsCtr / 900), 262, 83);
 			_vm->_hasRoomAnimationCallback = false;
 			_vm->refreshActors();
 			_vm->_hasRoomAnimationCallback = true;
 		}
 	} else {
 		if (_vm->_animationsCtr % 400 == 0 || doUpdate) {
-			_vm->drawAnimationSpriteToBackground(_vm->getRandom(3), 263, 84);
+			_vm->drawAnimationSprite(_vm->getRandom(3), 263, 84);
 			_vm->_hasRoomAnimationCallback = false;
 			_vm->refreshActors();
 			_vm->_hasRoomAnimationCallback = true;
@@ -7261,7 +7261,7 @@ void GameLogic::r34_uninitRoomAnimations() {
 void GameLogic::r34_updateRoomAnimations(bool doUpdate) {
 	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 3000;
 	if (_vm->_animationsCtr == 0 || doUpdate) {
-		_vm->drawAnimationSpriteToBackground(_vm->getRandom(4), 198, 68);
+		_vm->drawAnimationSprite(_vm->getRandom(4), 198, 68);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
@@ -7498,12 +7498,12 @@ void GameLogic::r36_uninitRoomAnimations() {
 void GameLogic::r36_updateRoomAnimations(bool doUpdate) {
 	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 4000;
 	if (_vm->_animationsCtr == 0 || doUpdate) {
-		_vm->drawAnimationSpriteToBackground(0, 263, 82);
+		_vm->drawAnimationSprite(0, 263, 82);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
 	} else if (_vm->_animationsCtr == 2000 || doUpdate) {
-		_vm->drawAnimationSpriteToBackground(1, 263, 82);
+		_vm->drawAnimationSprite(1, 263, 82);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
@@ -8109,7 +8109,7 @@ void GameLogic::r38_updateRoomAnimations(bool doUpdate) {
 		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 8000;
 	}
 	if (_vm->_animationsCtr % 400 == 0 || doUpdate) {
-		_vm->drawAnimationSpriteToBackground(_vm->_animationsCtr / 400, 8, 38);
+		_vm->drawAnimationSprite(_vm->_animationsCtr / 400, 8, 38);
 		_vm->_hasRoomAnimationCallback = false;
 		_vm->refreshActors();
 		_vm->_hasRoomAnimationCallback = true;
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index bd3086e42f5..0db40a09430 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -143,7 +143,7 @@ Common::Error WaynesWorldEngine::run() {
 
 	drawInterface(2);
 	// changeRoom(0);
-	changeRoom(1); // DEBUG
+	changeRoom(7); // DEBUG
 
 	_gameState = 0; // DEBUG Initial _gameState 0 is set by room event in room 0
 	// _gameState = 1; // DEBUG Open map
@@ -154,7 +154,6 @@ Common::Error WaynesWorldEngine::run() {
 		updateEvents();
 		updateMouseMove();
 		if (_mouseClickButtons != 0) {
-			// debug("_mouseClickButtons: %d", _mouseClickButtons);
 			handleMouseClick();
 		}
 		if (_roomEventNum != 0) {
@@ -165,6 +164,7 @@ Common::Error WaynesWorldEngine::run() {
 		}
 		updateRoomAnimations(false);
 		g_system->updateScreen();
+		// g_system->delayMillis(20);
 	}
 
 #endif
@@ -241,8 +241,6 @@ int WaynesWorldEngine::getRandom(int max) {
 }
 
 void WaynesWorldEngine::waitMillis(uint millis) {
-	// TODO
-	// _system->delayMillis(millis);
 	uint32 waitTime = _system->getMillis() + millis;
 	while (_system->getMillis() < waitTime && !shouldQuit()) {
 		updateEvents();
@@ -252,8 +250,8 @@ void WaynesWorldEngine::waitMillis(uint millis) {
 }
 
 void WaynesWorldEngine::waitSeconds(uint seconds) {
-	// TODO
-	// Replace calls with waitMillis
+	// TODO Replace calls with waitMillis
+	waitMillis(seconds * 1000);
 }
 
 void WaynesWorldEngine::initMouseCursor() {
@@ -1151,10 +1149,14 @@ void WaynesWorldEngine::loadAnimationSprite(int index, const char *filename) {
 	_roomAnimations[index] = loadRoomSurface(filename);
 }
 
-void WaynesWorldEngine::drawAnimationSpriteToBackground(int index, int x, int y) {
+void WaynesWorldEngine::drawAnimationSprite(int index, int x, int y) {
 	_backgroundSurface->drawSurface(_roomAnimations[index], x, y);
 }
 
+void WaynesWorldEngine::drawAnimationSpriteTransparent(int index, int x, int y) {
+	_backgroundSurface->drawSurfaceTransparent(_roomAnimations[index], x, y);
+}
+
 void WaynesWorldEngine::updateRoomAnimations(bool doUpdate) {
 	if (_hasRoomAnimationCallback) {
 		_logic->updateRoomAnimations(doUpdate);
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 7876691ebbe..150d2cd2f22 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -274,7 +274,8 @@ public:
 
 	void loadAnimationSpriteRange(int baseIndex, const char *filename, int count);
 	void loadAnimationSprite(int index, const char *filename);
-	void drawAnimationSpriteToBackground(int index, int x, int y);
+	void drawAnimationSprite(int index, int x, int y);
+	void drawAnimationSpriteTransparent(int index, int x, int y);
 	void updateRoomAnimations(bool doUpdate);
 	void startRoomAnimations();
 	void stopRoomAnimations();


Commit: 788fc741af7d6cce3f4bd68b7ce9fd8c4297a4ed
    https://github.com/scummvm/scummvm/commit/788fc741af7d6cce3f4bd68b7ce9fd8c4297a4ed
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:50+01:00

Commit Message:
WAYNESWORLD: Implement getActorScaleFromY

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 0b9439c1fe8..6ddb88330d5 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -960,6 +960,105 @@ void GameLogic::handleRoomEvent(int eventNum) {
     }
 }
 
+int GameLogic::getActorScaleFromY(int actorY) {
+	int scale = 100;
+	switch (_vm->_currentRoomNumber) {
+	case 0:
+		scale = actorY - 10;
+		break;
+	case 1:
+		scale = actorY - 27;
+		break;
+	case 2:
+		scale = actorY * 2 - 130;
+		break;
+	case 3:
+		scale = actorY * 2 - 124;
+		break;
+	case 4:
+		scale = actorY * 2 - 84;
+		break;
+	case 5:
+		scale = actorY;
+		break;
+	case 6:
+		scale = actorY / 3 - 91;
+		break;
+	case 7:
+		scale = actorY - 41;
+		break;
+	case 8:
+	case 22:
+		scale = actorY - 20;
+		break;
+	case 11:
+		scale = actorY - 60;
+		break;
+	case 12:
+		scale = actorY * 2 - 155;
+		break;
+	case 13:
+		scale = actorY * 2 - 116;
+		break;
+	case 14:
+	case 19:
+	case 25:
+		scale = actorY - 30;
+		break;
+	case 16:
+		scale = actorY * 2 - 100;
+		break;
+	case 9:
+	case 15:
+		scale = actorY * 2 - 115;
+		break;
+	case 18:
+		scale = actorY - 15;
+		break;
+	case 20:
+		scale = actorY * 3 - 242;
+		break;
+	case 26:
+		scale = actorY * 3 / 2 - 95;
+		break;
+	case 27:
+		scale = actorY * 3 / 2 - 100;
+		break;
+	case 28:
+		scale = actorY - 25;
+		break;
+	case 29:
+		scale = actorY - 20;
+		break;
+	case 30:
+		scale = actorY / 2 + 23;
+		break;
+	case 32:
+	case 33:
+		scale = actorY * 1.5 - 97;
+		break;
+	case 34:
+		scale = actorY * 2 - 127;
+		break;
+	case 35:
+		scale = actorY * 1.5 - 98;
+		break;
+	case 36:
+		scale = actorY * 1.4 - 83;
+		break;
+	case 37:
+		scale = actorY * 2 - 41;
+		break;
+	case 38:
+		scale = actorY - 31;
+		break;
+	case 17:
+		scale = actorY * 1.5 - 100;
+		break;
+	}
+    return CLIP(scale, 20, 100);
+}
+
 int GameLogic::r0_handleVerbPickUp() {
 	int actionTextIndex = -1;
 	switch (_vm->_objectNumber) {
@@ -3930,7 +4029,7 @@ void GameLogic::r9_uninitRoomAnimations() {
 void GameLogic::r9_updateRoomAnimations(bool doUpdate) {
 	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 3000;
 	if (doUpdate) {
-		_vm->_animationsCtr = (_vm->_animationsCtr + 200) % 5000;
+		_vm->_animationsCtr = (_vm->_animationsCtr + 200) % 3000;
 	}
 	if (_vm->_animationsCtr % 1000 == 0 || doUpdate) {
 		_vm->drawAnimationSprite(_vm->_animationsCtr / 1000, 124, 27);
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index 2501afcdefd..a1b355c5716 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -45,6 +45,7 @@ public:
 	void refreshRoomBackground(int roomNum);
 	void updateRoomAnimations(bool doUpdate);
 	void handleRoomEvent(int eventNum);
+	int getActorScaleFromY(int actorY);
 	void r38_atrap();
 public:
 	int _word_34464;
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 0db40a09430..80de175d948 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -143,7 +143,7 @@ Common::Error WaynesWorldEngine::run() {
 
 	drawInterface(2);
 	// changeRoom(0);
-	changeRoom(7); // DEBUG
+	changeRoom(9); // DEBUG
 
 	_gameState = 0; // DEBUG Initial _gameState 0 is set by room event in room 0
 	// _gameState = 1; // DEBUG Open map
@@ -879,8 +879,7 @@ void WaynesWorldEngine::unloadMainActorSprites() {
 }
 
 int WaynesWorldEngine::getActorScaleFromY(int actorY) {
-	// TODO
-    return 100;
+	return _logic->getActorScaleFromY(actorY);
 }
 
 void WaynesWorldEngine::drawActorReachObject(int objectId, int spriteIndex) {


Commit: f9d5881943e0e29e7ac67609f382ca3ee680de90
    https://github.com/scummvm/scummvm/commit/f9d5881943e0e29e7ac67609f382ca3ee680de90
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:50+01:00

Commit Message:
WAYNESWORLD: Fix room 10 logic and rename variables

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 6ddb88330d5..68d36ac616c 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -171,7 +171,7 @@ void GameLogic::initVariables() {
 	_r36_flags = 0;
 	_r38_flags = 0;
 	_r39_flags = 0;
-	_r10_selectedDialogChoice = -1;
+	_r10_selectedItemToBuy = -1;
 	_r9_dialogFlag = 0;
 	_r1_eventFlag = 0;
 	_r1_eventCtr = 1;
@@ -343,6 +343,9 @@ void GameLogic::handleVerbTalkTo() {
     case 9:
         r9_handleVerbTalkTo();
         break;
+	case 10:
+		r10_handleVerbTalkTo();
+        break;
     case 19:
     case 20:
         r19_handleVerbTalkTo();
@@ -4169,10 +4172,10 @@ void GameLogic::r10_handleVerbGiveWinningTicketToSalesgirl() {
 	_vm->displayText("c04r", 9, 0, 320, 70, 0);
 }
 
-void GameLogic::r10_handleDialogSelect_6() {
+void GameLogic::r10_buyItem() {
 	r10_refreshObject(1);
 	_vm->waitSeconds(1);
-	if (_r10_selectedDialogChoice == 0) {
+	if (_r10_selectedItemToBuy == 0) {
 		_vm->playAnimation("getmon", 0, 5, 98, 7, 0, 100);
 		_r10_flags |= 0x02;
 		_vm->moveObjectToRoom(kObjectIdTicket, 10);
@@ -4182,7 +4185,7 @@ void GameLogic::r10_handleDialogSelect_6() {
 		_vm->displayText("c04r", 8, 0, 320, 115, 0);
 		_vm->playAnimation("gest", 0, 7, 127, 7, 0, 200);
 		_vm->playAnimation("getmon", 4, 2, 98, 7, 0, 100);
-		if (_r10_selectedDialogChoice == 1) {
+		if (_r10_selectedItemToBuy == 1) {
 			_r10_flags |= 0x08;
 		} else {
 			_r10_flags |= 0x04;
@@ -4190,7 +4193,7 @@ void GameLogic::r10_handleDialogSelect_6() {
 	}
 	_vm->moveObjectToNowhere(kObjectIdInventoryDollar);
 	_vm->loadRoomBackground(_vm->_currentRoomNumber);
-	_r10_selectedDialogChoice = 255;
+	_r10_selectedItemToBuy = -1;
 }
 
 int GameLogic::r10_handleVerbUse() {
@@ -4316,10 +4319,10 @@ bool GameLogic::r10_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 				replyTextIndex2 = 2;
 				break;
 			case 0: case 1: case 2:
-				_r10_selectedDialogChoice = _vm->_selectedDialogChoice;
-				if (_vm->_currentActorNum != 0 && _vm->_wayneInventory[kObjectIdInventoryDollar] == 0) {
+				_r10_selectedItemToBuy = _vm->_selectedDialogChoice;
+				if (_vm->_currentActorNum != 0 && _vm->_wayneInventory[kObjectIdInventoryDollar - 28] == 0) {
 					_vm->setDialogChoices(8, -1, -1, -1, -1);
-				} else if (_vm->_currentActorNum == 0 && _vm->_garthInventory[kObjectIdInventoryDollar] == 0) {
+				} else if (_vm->_currentActorNum == 0 && _vm->_garthInventory[kObjectIdInventoryDollar - 28] == 0) {
 					_vm->setDialogChoices(8, -1, -1, -1, -1);
 				} else {
 					_vm->setDialogChoices(6, 7, -1, -1, -1);
@@ -4328,14 +4331,14 @@ bool GameLogic::r10_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 				continueDialog = true;
 				break;
 			case 6:
-				r10_handleDialogSelect_6();
+				r10_buyItem();
 			case 4:
 				_vm->_gameState = 0;
 				break;
 			case 8:
 				replyTextIndex1 = 4;
 			case 7:
-				_r10_selectedDialogChoice = 255;
+				_r10_selectedItemToBuy = -1;
 				handleVerbTalkTo();
 				break;
 			}
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index a1b355c5716..00eb7667811 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -83,7 +83,7 @@ public:
 	byte _r36_flags;
 	byte _r38_flags;
 	byte _r39_flags;
-	int _r10_selectedDialogChoice;
+	int _r10_selectedItemToBuy;
 	byte _r9_dialogFlag;
 	byte _r1_eventFlag;
 	byte _r1_eventCtr;
@@ -250,7 +250,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r10_handleVerbPickUpTicket();
 	void r10_handleVerbPickUpGum();
 	void r10_handleVerbGiveWinningTicketToSalesgirl();
-	void r10_handleDialogSelect_6();
+	void r10_buyItem();
 	void r10_handleVerbPickUpJawbreakers();
 	void r10_refreshObject(int value);
 


Commit: fe2462a747a83328f949e283644eb73b147d007c
    https://github.com/scummvm/scummvm/commit/fe2462a747a83328f949e283644eb73b147d007c
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:50+01:00

Commit Message:
WAYNESWORLD: Fix various logic bugs

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 68d36ac616c..93c88a49fdb 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -3011,7 +3011,7 @@ void GameLogic::r6_handleRoomEvent2() {
 
 void GameLogic::r6_handleRoomEvent3() {
 	_vm->waitSeconds(1);
-	_vm->playSound("ss10.snd", 1);
+	_vm->playSound("ss10", 1);
 	_vm->walkTo(110, 107, 4, 135, 107);
 	_vm->playAnimation("dad", 0, 3, 119, 79, 0, 100);
 	if ((_r6_flags & 0x40) && !(_r6_flags & 0x20)) {
@@ -4612,7 +4612,7 @@ void GameLogic::r11_pickUpExtensionCord() {
 void GameLogic::r11_useSuckCutWithFountain() {
 	r11_uninitRoomAnimations();
 	_vm->playAnimation("suckwt", 0, 5, 45, 92, 0, 200);
-	_vm->playSound("ss40.snd", 0);
+	_vm->playSound("ss40", 0);
 	for (int i = 5; i < 15; i++) {
 		_vm->playAnimation("elec", i - 5, 1, 176, 61, 0, 1);
 		_vm->playAnimation("suckwt", i, 1, 45, 92, 0, 150);
@@ -5457,13 +5457,13 @@ void GameLogic::r17_handleRoomEvent1() {
 
 void GameLogic::r17_handleRoomEvent2() {
 	_vm->walkTo(71, 117, 0, 90, 117);
-	_vm->playSound("ss13.snd", 0);
+	_vm->playSound("ss13", 0);
 	_vm->playAnimation("beam", 0, 13, 62, 51, 0, 150);
 	_vm->changeRoom(37);
 }
 
 void GameLogic::r17_handleRoomEvent3() {
-	_vm->playSound("ss13.snd", 0);
+	_vm->playSound("ss13", 0);
 	_vm->playAnimation("beam", 12, -13, 62, 51, 0, 150);
 	_r37_flags &= ~0x20;
 	_vm->setWaynePosition(71, 117);
@@ -5751,7 +5751,7 @@ void GameLogic::r20_refreshRoomBackground() {
 void GameLogic::r20_handleRoomEvent() {
 	_vm->waitSeconds(1);
 	_vm->playAnimation("expl", 0, 36, 40, 32, 0, 150);
-	_vm->playSound("ss17.snd", 0);
+	_vm->playSound("ss17", 0);
 	_vm->playAnimation("expl", 37, 66, 40, 32, 0, 150);
 	_r19_flags &= ~0x01;
 	_r19_flags |= 0x08;
@@ -5868,6 +5868,7 @@ int GameLogic::r24_handleVerbUse() {
 			_vm->changeRoom(24);
 			break;
 		}
+		break;
 	default:
 		actionTextIndex = 0;
 		break;
@@ -6239,9 +6240,9 @@ void GameLogic::r28_handleRoomEvent1() {
 		_vm->refreshActors();
 	}
 	_vm->playAnimation("scepter", 1, 4, 26, 42, 0, 150);
-	_vm->playSound("ss13.snd", 0);
+	_vm->playSound("ss13", 0);
 	_vm->playAnimation("zapwg", 0, 11, 107, 53, 0, 70);
-	_vm->playSound("sv08.snd", 1);
+	_vm->playSound("sv08", 1);
 	_vm->playAnimation("scepter", 3, -4, 26, 42, 0, 150);
 	_vm->displayText("c04r", 30, 0, 150, 10, 0);
 	_vm->playAnimation("reptalk", 0, 6, 26, 51, 0, 150);
@@ -6266,11 +6267,11 @@ void GameLogic::r28_handleRoomEvent1() {
 }
 
 void GameLogic::r28_handleRoomEvent2() {
-	_vm->playSound("ss12.snd", 0);
+	_vm->playSound("ss12", 0);
 	_vm->playAnimation("scepter", 1, 4, 26, 42, 0, 150);
 	_vm->playAnimation("repxit", 0, 11, 0, 33, 0, 100);
 	_vm->waitSeconds(2);
-	_vm->playSound("ss12.snd", 0);
+	_vm->playSound("ss12", 0);
 	_vm->playAnimation("repxit", 10, -11, 0, 33, 0, 100);
 	_vm->playAnimation("scepter", 3, -4, 26, 42, 0, 150);
 	_vm->displayText("c04r", 38, 0, 150, 10, 0);
@@ -6278,7 +6279,7 @@ void GameLogic::r28_handleRoomEvent2() {
 	_vm->waitSeconds(2);
 	_vm->_isTextVisible = false;
 	_vm->refreshActors();
-	_vm->playSound("ss12.snd", 0);
+	_vm->playSound("ss12", 0);
 	_vm->playAnimation("scepter", 1, 4, 26, 42, 0, 150);
 	_vm->playAnimation("repxit", 0, 11, 0, 33, 0, 100);
 	_vm->waitSeconds(2);
@@ -6597,7 +6598,7 @@ void GameLogic::r30_runLudwigCutscene() {
 	_vm->playAnimation("ludwig", 42, 20, 185, 34, 0, 150);
 	_vm->displayTextLines("lws", 27, 50, 10, 1);
 	_vm->playAnimation("ludwig", 62, 4, 185, 34, 0, 150);
-	_vm->playSound("ss17.snd", 0);
+	_vm->playSound("ss17", 0);
 	_vm->playAnimation("ludwig", 66, 4, 186, 22, 0, 150);
 	_vm->playAnimation("ludwig", 70, 3, 185, 34, 0, 150);
 	_vm->displayTextLines("lws", 28, 50, 10, 5);
@@ -6766,7 +6767,7 @@ void GameLogic::r31_handleRoomEvent4() {
 
 		_vm->displayText("gms", _r31_categoryIndex * 5 + _r31_questionIndex, 0, 50, 10, 0);
 		_vm->playAnimation("rdcard", 0, 6, 155, 30, 0, 300);
-		_vm->playAnimation("rdcard", 1, 6, 155, 30, 0, 300);
+		_vm->playAnimation("rdcard", 1, 5, 155, 30, 0, 300); // NOTE This had 6 as count in the original which is a bug
 		_vm->playAnimation("rdcard", 5, -6, 155, 30, 0, 300);
 		_r31_questionsAsked++;
 		_vm->_isTextVisible = false;
@@ -6833,21 +6834,15 @@ void GameLogic::r31_handleRoomEvent5() {
 }
 
 void GameLogic::r31_drawDBuzzer() {
-	WWSurface *local128 = new WWSurface(48, 27);
-	// TODO copySpriteRect(_vm->_backgroundSurface, 247, 78, 294, 104, local128);
 	_vm->drawRoomImageToScreen("dbuzzer", 247, 78);
 	_vm->waitSeconds(2);
-	_vm->_screen->drawSurface(local128, 247, 78);
-	delete local128;
+	_vm->_screen->drawSurface(_vm->_backgroundSurface, 0, 0);
 }
 
 void GameLogic::r31_drawMBuzzer() {
-	WWSurface *local128 = new WWSurface(29, 18);
-	// TODO copySpriteRect(_vm->_backgroundSurface, 210, 61, 238, 78, local128);
 	_vm->drawRoomImageToScreen("mbuzzer", 210, 61);
 	_vm->waitSeconds(2);
-	_vm->_screen->drawSurface(local128, 210, 61);
-	delete local128;
+	_vm->_screen->drawSurface(_vm->_backgroundSurface, 0, 0);
 }
 
 void GameLogic::r31_playTalkAnim(int talkerIndex) {
@@ -6866,12 +6861,9 @@ void GameLogic::r31_playTalkAnim(int talkerIndex) {
 }
 
 void GameLogic::r31_useBuzzer() {
-	WWSurface *local128 = new WWSurface(48, 40);
-	// TODO copySpriteRect(_vm->_backgroundSurface, 131, 106, 178, 145, local128);
 	_vm->drawRoomImageToScreen("buzzer", 131, 106);
-	_vm->playSound("ss04.snd", 1);
-	_vm->_screen->drawSurface(local128, 131, 106);
-	delete local128;
+	_vm->playSound("ss04", 1);
+	_vm->_screen->drawSurface(_vm->_backgroundSurface, 0, 0);
 	if (!(_r31_flags & 0x01)) {
 		r31_handleRoomEvent3();
 		_r31_flags |= 0x01;
@@ -6885,6 +6877,7 @@ void GameLogic::r31_displayCategories() {
 	// TODO fxSetGrain(4, 4, 1);
 	// TODO fxSetEffect(8); // Spiral Effect
 	// TODO fxVirtualDisplay(screenImage, 0, 0, 0, 0, 319, 199, 1);
+	_vm->_screen->drawSurface(screenImage, 0, 0); // TODO Until effects drawing is done
 	delete screenImage;
 	for (int categoryIndex = 0; categoryIndex < 5; categoryIndex++) {
 		Common::String categoryFilename = Common::String::format("cat%d", categoryIndex);
@@ -6892,6 +6885,7 @@ void GameLogic::r31_displayCategories() {
 		// TODO fxSetGrain(1, 1, 1);
 		// TODO fxSetEffect(5); // Random Effect
 		// TODO fxVirtualDisplay(categoryImage, 0, 0, 17, 61, 300, 140, 0);
+		_vm->_screen->drawSurface(categoryImage, 17, 61); // TODO Until effects drawing is done
 		delete categoryImage;
 		_vm->waitSeconds(3);
 	}
@@ -6935,13 +6929,13 @@ void GameLogic::r31_drawCurrentPlayerScore() {
 		Common::String numberFilename = Common::String::format("n%d", score / 100);
 		_vm->drawRoomImageToBackground(numberFilename.c_str(), numberX, numberY);
 	} else {
-		_vm->_backgroundSurface->fillRect(numberX, numberY, numberX + 3, numberY + 6, 2);
+		_vm->_backgroundSurface->fillRect(numberX, numberY, numberX + 3, numberY + 6, 0);
 	}
 	if (score > 9) {
 		Common::String numberFilename = Common::String::format("n%d", (score % 100) / 10);
 		_vm->drawRoomImageToBackground(numberFilename.c_str(), numberX + 5, numberY);
 	} else {
-		_vm->_backgroundSurface->fillRect(numberX + 5, numberY, numberX + 8, numberY + 6, 2);
+		_vm->_backgroundSurface->fillRect(numberX + 5, numberY, numberX + 8, numberY + 6, 0);
 	}
 	Common::String numberFilename = Common::String::format("n%d", score % 10);
 	_vm->drawRoomImageToBackground(numberFilename.c_str(), numberX + 10, numberY);
@@ -7856,7 +7850,7 @@ void GameLogic::r37_useLadder2() {
 		if (climbCtr < 12) {
 			workBackground->drawSurfaceTransparent(_vm->_garthSprites[0], 135, garthLadderY);
 		} else if (climbCtr <= 14) {
-			workBackground->drawSurfaceTransparent(wgetldlSprites[14 - climbCtr], 168, 26);
+			workBackground->drawSurfaceTransparent(ggetldlSprites[climbCtr - 12], 168, 26);
 		} else {
 			workBackground->drawSurfaceTransparent(gclimbSprites[climbCtr % 4], 187, garthLadderY);
 		} 
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 80de175d948..edd69a9a7ec 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -143,7 +143,8 @@ Common::Error WaynesWorldEngine::run() {
 
 	drawInterface(2);
 	// changeRoom(0);
-	changeRoom(9); // DEBUG
+	// _wayneSpriteX = -1; _garthSpriteX = -1;
+	changeRoom(39); // DEBUG
 
 	_gameState = 0; // DEBUG Initial _gameState 0 is set by room event in room 0
 	// _gameState = 1; // DEBUG Open map
@@ -481,6 +482,7 @@ void WaynesWorldEngine::loadPalette(const char *filename) {
 		warning("loadPalette() Could not load palette from '%s'", filename);
 	} else {
 		memcpy(_palette2, imageDecoder->getPalette(), imageDecoder->getPaletteColorCount() * 3);
+		g_system->getPaletteManager()->setPalette(_palette2, 0, 256);
 	}
     delete imageDecoder;
 }


Commit: f367b85cc4120c4a9adb43b91f248cb7ad9f465e
    https://github.com/scummvm/scummvm/commit/f367b85cc4120c4a9adb43b91f248cb7ad9f465e
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:50+01:00

Commit Message:
WAYNESWORLD: Implement static room objects loading and drawing

Changed paths:
    engines/waynesworld/staticdata.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/staticdata.cpp b/engines/waynesworld/staticdata.cpp
index c6cbbb5f4d4..68d8675ef69 100644
--- a/engines/waynesworld/staticdata.cpp
+++ b/engines/waynesworld/staticdata.cpp
@@ -431,4 +431,108 @@ const RoomObject WaynesWorldEngine::kRoomObjects[kRoomObjectsCount] = {
 	{ -2, "exit", 124, 47, 179, 118, 4, 154, 125 }
 };
 
+const StaticRoomObjectMapEntry WaynesWorldEngine::kStaticRoomObjectsMap[kStaticRoomObjectsMapCount] = {
+	{ 0, 3 },
+	{ 3, 2 },
+	{ 5, 3 },
+	{ 8, 1 },
+	{ 9, 2 },
+	{ 11, 1 },
+	{ 12, 1 },
+	{ 13, 2 },
+	{ 15, 0 },
+	{ 15, 3 },
+	{ 18, 0 },
+	{ 18, 1 },
+	{ 19, 3 },
+	{ 22, 6 },
+	{ 28, 0 },
+	{ 28, 3 },
+	{ 31, 4 },
+	{ 35, 2 },
+	{ 37, 0 },
+	{ 37, 0 },
+	{ 37, 3 },
+	{ 40, 0 },
+	{ 40, 1 },
+	{ 41, 2 },
+	{ 43, 3 },
+	{ 46, 0 },
+	{ 46, 0 },
+	{ 46, 0 },
+	{ 46, 0 },
+	{ 46, 2 },
+	{ 48, 1 },
+	{ 49, 0 },
+	{ 49, 2 },
+	{ 51, 1 },
+	{ 52, 0 },
+	{ 52, 1 },
+	{ 53, 0 },
+	{ 53, 2 },
+	{ 55, 3 },
+	{ 58, 0 }
+};
+
+const StaticRoomObject WaynesWorldEngine::kStaticRoomObjects[kStaticRoomObjectsCount] = {
+	{ "speaker", 39, 125, 81, 136 },
+	{ "camera", 176, 86, 248, 121 },
+	{ "cuecard", 214, 26, 290, 121 },
+	{ "terminal", 0, 87, 99, 149 },
+	{ "gadget", -1, 78, 109, 125 },
+	{ "entry", 110, 56, 119, 92 },
+	{ "table1", -1, 103, 161, 121 },
+	{ "table2", -1, 88, 163, 121 },
+	{ "grill", 151, 64, 231, 149 },
+	{ "piece1", 0, 30, 51, 84 },
+	{ "piece2", 74, 46, 159, 93 },
+	{ "dresser", 224, 50, 319, 113 },
+	{ "house", 235, 62, 246, 93 },
+	{ "trees", 79, 66, 180, 111 },
+	{ "car", 234, 102, 319, 139 },
+	{ "display", 60, 86, 228, 111 },
+	{ "entry", 258, 55, 271, 102 },
+	{ "counter", 122, 67, 133, 90 },
+	{ "bag", -1, 106, 138, 129 },
+	{ "bush", 214, 69, 286, 131 },
+	{ "fence", 72, 110, 168, 131 },
+	{ "cbush", -1, 69, 286, 131 },
+	{ "table_1", 101, 52, 118, 82 },
+	{ "table_2", 110, 82, 155, 101 },
+	{ "table_3", 218, 93, 276, 117 },
+	{ "rail", 0, 102, 212, 116 },
+	{ "newpc0", -1, 53, 112, 84 },
+	{ "newpc1", -1, 94, 212, 136 },
+	{ "counter", 40, 75, 51, 91 },
+	{ "table", 141, 74, 198, 193 },
+	{ "couch", 207, 73, 226, 89 },
+	{ "boxes1", 70, 83, 89, 116 },
+	{ "boxes2", 90, 93, 213, 116 },
+	{ "boxes3", 214, 60, 252, 116 },
+	{ "clothes", 142, 59, 159, 85 },
+	{ "guard1", 49, 79, 59, 106 },
+	{ "guard2", 112, 79, 121, 106 },
+	{ "crate", -1, 84, 134, 112 },
+	{ "robpc", -1, 95, 158, 121 },
+	{ "ssman", -1, 64, 224, 117 },
+	{ "chairs", 124, 66, 237, 91 },
+	{ "desk", 143, 71, 155, 118 },
+	{ "table", 236, 96, 258, 107 },
+	{ "laddup", -1, 18, 110, 132 },
+	{ "laddup", -1, 18, 221, 132 },
+	{ "ladddn", -1, 26, 110, 144 },
+	{ "stool", 91, 83, 114, 116 },
+	{ "wall", 92, 0, 112, 75 },
+	{ "camera", 260, 69, 274, 90 },
+	{ "wall", 0, 66, 13, 135 },
+	{ "wall2", 173, 65, 190, 113 },
+	{ "wall", 22, 61, 180, 135 },
+	{ "tvs", 170, 113, 319, 147 },
+	{ "ladder0", 109, 0, 124, 67 },
+	{ "ladder1", 191, 12, 206, 138 },
+	{ "equip", 83, 51, 118, 121 },
+	{ "scass5", -1, 98, 234, 144 },
+	{ "casspc2", -1, 94, 179, 139 }
+};
+
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index edd69a9a7ec..e811f702b77 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -76,6 +76,9 @@ Common::Error WaynesWorldEngine::run() {
 	for (uint i = 0; i < kRoomAnimationsCount; i++)
 		_roomAnimations[i] = nullptr;
 
+	for (uint i = 0; i < kStaticRoomObjectSpritesCount; i++)
+		_staticRoomObjectSprites[i] = nullptr;
+
 	initGraphics(320, 200);
 	initMouseCursor();
 	_screen = new Screen();
@@ -121,6 +124,7 @@ Common::Error WaynesWorldEngine::run() {
 	loadMainActorSprites();
 
 	initRoomObjects();
+	initStaticRoomObjects();
 	memset(_wayneInventory, 0, sizeof(_wayneInventory));
 	memset(_garthInventory, 0, sizeof(_garthInventory));
 
@@ -144,7 +148,7 @@ Common::Error WaynesWorldEngine::run() {
 	drawInterface(2);
 	// changeRoom(0);
 	// _wayneSpriteX = -1; _garthSpriteX = -1;
-	changeRoom(39); // DEBUG
+	changeRoom(9); // DEBUG
 
 	_gameState = 0; // DEBUG Initial _gameState 0 is set by room event in room 0
 	// _gameState = 1; // DEBUG Open map
@@ -170,6 +174,7 @@ Common::Error WaynesWorldEngine::run() {
 
 #endif
 
+	unloadStaticRoomObjects();
 	unloadMainActorSprites();
 
 	delete _logic;
@@ -1177,20 +1182,56 @@ void WaynesWorldEngine::stopRoomAnimations() {
 	_hasRoomAnimationCallback = false;
 }
 
+void WaynesWorldEngine::initStaticRoomObjects() {
+	for  (uint i = 0; i < kStaticRoomObjectsCount; i++)
+		_staticRoomObjects[i] = kStaticRoomObjects[i];
+}
+
 void WaynesWorldEngine::loadStaticRoomObjects(int roomNum) {
-	// TODO
+	int startIndex = kStaticRoomObjectsMap[roomNum].index;
+	int count = kStaticRoomObjectsMap[roomNum].count;
+	for (int index = 0; index < count; index++) {
+		const StaticRoomObject &roomObject = _staticRoomObjects[startIndex + index];
+		if (roomObject.x1 != -1) {
+			debug("%s", roomObject.name);
+			_staticRoomObjectSprites[index] = loadRoomSurface(roomObject.name);
+			_backgroundSurface->drawSurfaceTransparent(_staticRoomObjectSprites[index], roomObject.x1, roomObject.y1);
+		}
+	}
 }
 
 void WaynesWorldEngine::unloadStaticRoomObjects() {
-	// TODO
+	for (uint i = 0; i < kStaticRoomObjectSpritesCount; i++) {
+		delete _staticRoomObjectSprites[i];
+		_staticRoomObjectSprites[i] = nullptr;
+	}
 }
 
 void WaynesWorldEngine::setStaticRoomObjectPosition(int roomNum, int fromIndex, int toIndex, int x, int y) {
-	// TODO
+	int startIndex = kStaticRoomObjectsMap[roomNum].index + fromIndex;
+	int endIndex = kStaticRoomObjectsMap[roomNum].index + toIndex;
+	unloadStaticRoomObjects();
+	for (int index = startIndex; index < endIndex; index++) {
+		StaticRoomObject &roomObject = _staticRoomObjects[index];
+		roomObject.x1 = x;
+		roomObject.y1 = y;
+	}
+	loadStaticRoomObjects(roomNum);
 }
 
-void WaynesWorldEngine::drawStaticRoomObjects(int roomNumber, int x, int y, int actorHeight, int actorWidth, WWSurface *surface) {
-	// TODO
+void WaynesWorldEngine::drawStaticRoomObjects(int roomNum, int x, int y, int actorHeight, int actorWidth, WWSurface *surface) {
+	int x1 = x - actorWidth;
+	int x2 = x + actorWidth;
+	int y2 = y + actorHeight - 48;
+	int startIndex = kStaticRoomObjectsMap[roomNum].index;
+	int count = kStaticRoomObjectsMap[roomNum].count;
+	for (int index = 0; index < count; index++) {
+		const StaticRoomObject &roomObject = _staticRoomObjects[startIndex + index];
+		if (roomObject.x1 != -1 && roomObject.y2 > y &&
+			((roomObject.x1 <= x1 && roomObject.x2 >= x1) || (roomObject.x1 <= x2 && roomObject.x2 >= x2) || (roomObject.x1 >= x1 && roomObject.x2 <= x2))) {
+			surface->drawSurfaceTransparent(_staticRoomObjectSprites[index], roomObject.x1 - x1, roomObject.y1 - y2);
+		}
+	}
 }
 
 void WaynesWorldEngine::initRoomObjects() {
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 150d2cd2f22..d4e10456cd6 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -59,6 +59,15 @@ struct RoomObject {
     int walkX, walkY;
 };
 
+struct StaticRoomObjectMapEntry {
+	int index, count;
+};
+
+struct StaticRoomObject {
+	const char *name;
+	int x1, y1, x2, y2;
+};
+
 struct WalkPoint {
     int x, y, direction;
 };
@@ -73,6 +82,9 @@ const uint kRoomObjectsCount = 404;
 const int kWalkPointsCount = 300;
 const uint kWalkMapSize = (320 * 150) / 8;
 const uint kRoomAnimationsCount = 20;
+const uint kStaticRoomObjectsMapCount = 40;
+const uint kStaticRoomObjectsCount = 58;
+const uint kStaticRoomObjectSpritesCount = 4;
 
 class WaynesWorldEngine : public Engine {
 protected:
@@ -169,6 +181,13 @@ public:
 	// _roomObjects is a writable copy of kRoomObjects
 	RoomObject _roomObjects[kRoomObjectsCount];
 
+	// Static room objects
+	static const StaticRoomObjectMapEntry kStaticRoomObjectsMap[kStaticRoomObjectsMapCount];
+	static const StaticRoomObject kStaticRoomObjects[kStaticRoomObjectsCount];
+	// _staticRoomObjects is a writable copy of kStaticRoomObjects
+	StaticRoomObject _staticRoomObjects[kStaticRoomObjectsCount];
+	WWSurface *_staticRoomObjectSprites[kStaticRoomObjectSpritesCount];
+
 	// Game map
 	int _gameMapRoomNumber;
 	int _gameMapWayneSpriteX, _gameMapGarthSpriteX;
@@ -280,10 +299,12 @@ public:
 	void startRoomAnimations();
 	void stopRoomAnimations();
 
+	// Static room objects
+	void initStaticRoomObjects();
 	void loadStaticRoomObjects(int roomNum);
 	void unloadStaticRoomObjects();
 	void setStaticRoomObjectPosition(int roomNum, int fromIndex, int toIndex, int x, int y);
-	void drawStaticRoomObjects(int roomNumber, int x, int y, int actorHeight, int actorWidth, WWSurface *surface);
+	void drawStaticRoomObjects(int roomNum, int x, int y, int actorHeight, int actorWidth, WWSurface *surface);
 
 	// Room objects
 	void initRoomObjects();


Commit: 0c9981c797d09aae40ce9035b2b1c8dd6bbe0351
    https://github.com/scummvm/scummvm/commit/0c9981c797d09aae40ce9035b2b1c8dd6bbe0351
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:50+01:00

Commit Message:
WAYNESWORLD: Add code for looking at the 'unused ticket'

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 93c88a49fdb..a820d73a0bd 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -4138,7 +4138,7 @@ void GameLogic::r10_handleVerbPickUpTicket() {
 	_vm->moveObjectToNowhere(kObjectIdTicket);
 	_vm->moveObjectToRoom(kObjectIdInventoryUnusedTicket, 99);
 	_vm->refreshInventory(false);
-	// TODO lookAtUnusedTicket();
+	_vm->lookAtUnusedTicket();
 }
 
 void GameLogic::r10_handleVerbPickUpJawbreakers() {
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index 00eb7667811..6ea980bbd61 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -105,6 +105,7 @@ public:
 	int _r31_currentPlayer;
 	int _r31_scores[3];
 	bool _r31_askedQuestions[25];
+	bool _didScratchTicket;
 // protected:
 public://DEBUG So logic functions can be called from the engine class for testing
 	WaynesWorldEngine *_vm;
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index e811f702b77..c0fd9284c9d 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -153,6 +153,8 @@ Common::Error WaynesWorldEngine::run() {
 	_gameState = 0; // DEBUG Initial _gameState 0 is set by room event in room 0
 	// _gameState = 1; // DEBUG Open map
 
+	// lookAtUnusedTicket();
+
 	while (!shouldQuit()) {
 		_mouseClickButtons = 0;
 		// _keyInput = 0;
@@ -323,7 +325,7 @@ void WaynesWorldEngine::updateMouseMove() {
 
     // Unused ticket
     if (_gameState == 3) {
-        // TODO unusedTicketHandleMouseMove();
+        unusedTicketHandleMouseMove();
         return;
     }
 
@@ -405,7 +407,7 @@ void WaynesWorldEngine::handleMouseLeftClick() {
         handleDialogMouseClick();
         break;
     case 3:
-        // TODO unusedTicketHandleMouseClick();
+        unusedTicketHandleMouseClick();
         break;
     case 4:
         // TODO handleMouseClickState4();
@@ -434,7 +436,7 @@ void WaynesWorldEngine::handleMouseRightClick() {
         handleDialogMouseClick();
         break;
     case 3:
-        // TODO unusedTicketHandleMouseClick();
+        unusedTicketHandleMouseClick();
         break;
     case 4:
         // TODO handleMouseClickState4();
@@ -1479,7 +1481,7 @@ void WaynesWorldEngine::handleVerbLookAt() {
         moveObjectToRoom(kObjectIdCindi, 103);
     }
     if (_objectNumber == kObjectIdInventoryUnusedTicket) {
-        // TODO lookAtUnusedTicket();
+        lookAtUnusedTicket();
     } else {
 		int textIndex;
 		if (_objectNumber == -2 || _objectNumber == -3) {
@@ -1792,4 +1794,56 @@ void WaynesWorldEngine::setGameFlag(int flagNum) {
 	// TODO
 }
 
+void WaynesWorldEngine::lookAtUnusedTicket() {
+    // sysMouseDriver(2);
+    _gameState = 3;
+    _logic->_didScratchTicket = false;
+    stopRoomAnimations();    
+    if (!(_logic->_r10_flags & 0x80)) {
+        _roomAnimations[19] = loadSurface("r10/win");
+    } else {
+        _roomAnimations[19] = loadSurface("r10/nowin");
+    }
+    paletteFadeOut(0, 256, 64);
+    _screen->clear(0);
+    playSound("sv14", 0);
+    drawImageToScreen("r10/ticket", 0, 13);
+    paletteFadeIn(0, 256, 64);
+    // sysMouseDriver(1);
+}
+
+void WaynesWorldEngine::unusedTicketHandleMouseMove() {
+    if (_mouseX > 157 && _mouseY > 38 && _mouseX < 297 && _mouseY < 129) {
+        _logic->_didScratchTicket = true;
+        // Reveal partial image
+		int scratchX = _mouseX - 158;
+		int scratchY = _mouseY - 39;
+		Graphics::Surface scratchSurface = _roomAnimations[19]->getSubArea(Common::Rect(scratchX, scratchY, scratchX + 4, scratchY + 4));
+		_screen->drawSurface(&scratchSurface, _mouseX - 2, _mouseY - 2);
+    }
+}
+
+void WaynesWorldEngine::unusedTicketHandleMouseClick() {
+    int objectId = kObjectIdInventoryLosingTicket;
+    int textIndex = 1;
+    _gameState = 0;
+    delete _roomAnimations[19];
+	_roomAnimations[19] = nullptr;
+    if (!((_logic->_r10_flags & 0x80))) {
+        objectId = kObjectIdInventoryWinningTicket;
+        textIndex = 0;
+    }
+    if (_logic->_didScratchTicket) {
+        moveObjectToRoom(objectId, 99);
+        moveObjectToNowhere(29);
+        refreshInventory(false);
+        _logic->_r10_flags |= 0x80;
+    } else {
+        textIndex = 2;
+    }
+    changeRoom(_currentRoomNumber);
+    drawInterface(_verbNumber);
+    displayText("c00", textIndex, 0, -1, -1, 0);
+}
+
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index d4e10456cd6..7c0c2a91791 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -338,6 +338,10 @@ public:
 
 	void setGameFlag(int flagNum);
 
+	void lookAtUnusedTicket();
+	void unusedTicketHandleMouseMove();
+	void unusedTicketHandleMouseClick();
+
 	void gameMapOpen();
 	void gameMapFinish();
 	void gameMapHandleMouseMove(int objectNumber);


Commit: db5f3cb82c7671bd0dbb4c288d30aa1d91436339
    https://github.com/scummvm/scummvm/commit/db5f3cb82c7671bd0dbb4c288d30aa1d91436339
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:50+01:00

Commit Message:
WAYNESWORLD: Add 'extreme closeup' logic

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index a820d73a0bd..dd9847f8af1 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -456,6 +456,41 @@ int GameLogic::handleVerbClose() {
 	return 0;
 }
 
+void GameLogic::handleVerbExtremeCloseupOf() {
+    switch (_vm->_objectNumber) {
+    case kObjectIdInventoryPizzathonList:
+        displayExtremeCloseupOfPizzathonList();
+        break;
+    case kObjectIdSign15_1:
+        displayExtremeCloseupOfSign15();
+        break;
+    case kObjectIdInventorySewerMap:
+    case kObjectIdMap:
+        displayExtremeCloseupOfSewerMap();
+        break;
+    case kObjectIdPictures22:
+        displayExtremeCloseupOfObjectPictures22();
+        break;
+    case kObjectIdInventoryMemo:
+    case kObjectIdMemo:
+        displayExtremeCloseupOfMemo();
+        break;
+    case kObjectIdBillboard7:
+    case kObjectIdBillboard14:
+    case kObjectIdBillboard19:
+        displayExtremeCloseupOfBillboard1();
+        break;
+    case kObjectIdBillboard_0:
+    case kObjectIdBillboard_1:
+    case kObjectIdBillboard_2:
+        displayExtremeCloseupOfBillboard2();
+        break;
+    default:
+        _vm->displayText("c00", 3, 0, -1, -1, 0);
+        break;
+    }
+}
+
 int GameLogic::handleVerbGive() {
     switch (_vm->_currentRoomNumber) {
     case 2:
@@ -1062,6 +1097,115 @@ int GameLogic::getActorScaleFromY(int actorY) {
     return CLIP(scale, 20, 100);
 }
 
+void GameLogic::displayExtremeCloseupOfPizzathonList() {
+    _vm->stopRoomAnimations();
+    _vm->_gameState = 5;
+    _vm->paletteFadeOut(0, 256, 16);
+    // sysMouseDriver(2);
+    _vm->drawImageToScreen("m05/list", 0, 0);
+    _vm->playSound("sv14", 1);
+    if (_pizzathonListFlags1 & 0x08) {
+        _vm->drawImageToScreen("m05/adline", 72, 22);
+    }
+    if (_pizzathonListFlags1 & 0x40) {
+        _vm->drawImageToScreen("m05/locline", 72, 42);
+    }
+    if (_pizzathonListFlags1 & 0x80) {
+        _vm->drawImageToScreen("m05/volline", 74, 59);
+    }
+    if (_pizzathonListFlags2 & 0x01) {
+        _vm->drawImageToScreen("m05/timeline", 66, 76);
+    }
+    if (_pizzathonListFlags2 & 0x02) {
+        _vm->drawImageToScreen("m05/totline", 73, 94);
+    }
+    if (_pizzathonListFlags1 & 0x02) {
+        _vm->drawImageToScreen("m05/vidline", 80, 111);
+    }
+    if (_pizzathonListFlags1 & 0x04) {
+        _vm->drawImageToScreen("m05/ingline", 72, 129);
+    }
+    if (_pizzathonListFlags1 & 0x10) {
+        _vm->drawImageToScreen("m05/musline", 78, 148);
+    }
+    if (_pizzathonListFlags1 & 0x01) {
+        _vm->drawImageToScreen("m05/magline", 61, 164);
+    }
+    if (_pizzathonListFlags1 & 0x20) {
+        _vm->drawImageToScreen("m05/comline", 68, 100);
+    }
+    _vm->paletteFadeIn(0, 256, 16);
+    // sysMouseDriver(1);
+}
+
+void GameLogic::displayExtremeCloseupOfSign15() {
+    _vm->stopRoomAnimations();
+    _vm->_gameState = 5;
+    // sysMouseDriver(2);
+    _vm->paletteFadeOut(0, 256, 16);
+    _vm->playSound("sv14", 1);
+    _vm->drawRoomImageToScreen("sign", 0, 0);
+    _vm->paletteFadeIn(0, 256, 16);
+    // sysMouseDriver(1);
+}
+
+void GameLogic::displayExtremeCloseupOfObjectPictures22() {
+    _vm->stopRoomAnimations();
+    _vm->_gameState = 5;
+    // sysMouseDriver(2);
+    _vm->paletteFadeOut(0, 256, 16);
+    _vm->playSound("sv14", 1);
+    _vm->drawImageToScreen("m05/oldmap", 0, 0);
+    _vm->paletteFadeIn(0, 256, 16);
+    // sysMouseDriver(1);
+}
+
+void GameLogic::displayExtremeCloseupOfMemo() {
+    _vm->stopRoomAnimations();
+    _vm->_gameState = 5;
+    // sysMouseDriver(2);
+    _vm->paletteFadeOut(0, 256, 16);
+    _vm->playSound("sv14", 1);
+    _vm->drawImageToScreen("m05/memo", 0, 0);
+    _vm->paletteFadeIn(0, 256, 16);
+    // sysMouseDriver(1);
+}
+
+void GameLogic::displayExtremeCloseupOfSewerMap() {
+    _vm->stopRoomAnimations();
+    _vm->_gameState = 5;
+    // sysMouseDriver(2);
+    _vm->paletteFadeOut(0, 256, 16);
+    _vm->playSound("sv14", 1);
+    _vm->drawImageToScreen("m05/sewermap", 0, 0);
+    _vm->paletteFadeIn(0, 256, 16);
+    // sysMouseDriver(1);
+}
+
+void GameLogic::displayExtremeCloseupOfBillboard1() {
+    _vm->stopRoomAnimations();
+    _vm->_gameState = 5;
+    // sysMouseDriver(2);
+    _vm->paletteFadeOut(0, 256, 16);
+    _vm->playSound("sv14", 1);
+    _vm->_screen->clear(0);
+    _vm->drawImageToScreen("m05/fboard", 51, 18);
+    _vm->paletteFadeIn(0, 256, 16);
+    // sysMouseDriver(1);
+}
+
+void GameLogic::displayExtremeCloseupOfBillboard2() {
+    _vm->stopRoomAnimations();
+    _vm->_gameState = 5;
+    // sysMouseDriver(2);
+    _vm->paletteFadeOut(0, 256, 16);
+    _vm->playSound("sv14", 1);
+    _vm->_screen->clear(0);
+    _vm->drawImageToScreen("m05/pboard", 51, 18);
+    _vm->paletteFadeIn(0, 256, 16);
+    // sysMouseDriver(1);
+}
+
 int GameLogic::r0_handleVerbPickUp() {
 	int actionTextIndex = -1;
 	switch (_vm->_objectNumber) {
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index 6ea980bbd61..9d1ca765661 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -39,6 +39,7 @@ public:
 	int handleVerbPull();
 	int handleVerbOpen();
 	int handleVerbClose();
+	void handleVerbExtremeCloseupOf();
 	int handleVerbGive();
 	void handleDialogReply(int index, int x, int y);
 	bool handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
@@ -110,6 +111,14 @@ public:
 public://DEBUG So logic functions can be called from the engine class for testing
 	WaynesWorldEngine *_vm;
 
+	void displayExtremeCloseupOfPizzathonList();
+	void displayExtremeCloseupOfSign15();
+	void displayExtremeCloseupOfObjectPictures22();
+	void displayExtremeCloseupOfMemo();
+	void displayExtremeCloseupOfSewerMap();
+	void displayExtremeCloseupOfBillboard1();
+	void displayExtremeCloseupOfBillboard2();
+
 	int r0_handleVerbPickUp();
 	int r0_handleVerbUse();
 	int r0_handleVerbOpen();
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index c0fd9284c9d..20741e7437c 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -413,7 +413,7 @@ void WaynesWorldEngine::handleMouseLeftClick() {
         // TODO handleMouseClickState4();
         break;
     case 5:
-        // TODO handleMouseClickState5();
+        extremeCloseUpHandleMouseClick();
         break;
     }
 }
@@ -442,7 +442,7 @@ void WaynesWorldEngine::handleMouseRightClick() {
         // TODO handleMouseClickState4();
         break;
     case 5:
-        // TODO handleMouseClickState5();
+        extremeCloseUpHandleMouseClick();
         break;
     }
 }
@@ -1399,7 +1399,7 @@ void WaynesWorldEngine::handleVerb(int verbFlag) {
         handleVerbPull();
         break;
     case 7:
-        // TODO handleVerbExtremeCloseupOf();
+        handleVerbExtremeCloseupOf();
         break;
     case 8:
         handleVerbGive();
@@ -1686,6 +1686,10 @@ void WaynesWorldEngine::handleVerbPull() {
 
 }
 
+void WaynesWorldEngine::handleVerbExtremeCloseupOf() {
+	_logic->handleVerbExtremeCloseupOf();
+}
+
 void WaynesWorldEngine::handleVerbGive() {
     int actionTextIndex = -1;
 
@@ -1846,4 +1850,15 @@ void WaynesWorldEngine::unusedTicketHandleMouseClick() {
     displayText("c00", textIndex, 0, -1, -1, 0);
 }
 
+void WaynesWorldEngine::extremeCloseUpHandleMouseClick() {
+    _gameState = 0;
+    // sysMouseDriver(2);
+    paletteFadeOut(0, 256, 16);
+    _screen->clear(0);
+    paletteFadeIn(0, 256, 16);
+    drawInterface(_verbNumber);
+    loadRoomBackground(_currentRoomNumber);
+    // sysMouseDriver(1);
+}
+
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 7c0c2a91791..73c768a9508 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -342,6 +342,8 @@ public:
 	void unusedTicketHandleMouseMove();
 	void unusedTicketHandleMouseClick();
 
+	void extremeCloseUpHandleMouseClick();
+
 	void gameMapOpen();
 	void gameMapFinish();
 	void gameMapHandleMouseMove(int objectNumber);


Commit: 1457ca3dc0449acfa0d8782bec6fcacaff699e89
    https://github.com/scummvm/scummvm/commit/1457ca3dc0449acfa0d8782bec6fcacaff699e89
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:51+01:00

Commit Message:
WAYNESWORLD: Add GameLogic::setPizzathonStatus

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index dd9847f8af1..235f3213f08 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -1097,6 +1097,48 @@ int GameLogic::getActorScaleFromY(int actorY) {
     return CLIP(scale, 20, 100);
 }
 
+void GameLogic::setPizzathonStatus(int flagNum) {
+    switch (flagNum) {
+    case 1:
+        _pizzathonListFlags1 |= 0x08;
+        break;
+    case 2:
+        _pizzathonListFlags1 |= 0x40;
+        break;
+    case 3:
+        _pizzathonListFlags1 |= 0x80;
+        break;
+    case 4:
+        _pizzathonListFlags2 |= 0x01;
+        break;
+    case 5:
+        _pizzathonListFlags2 |= 0x02;
+        break;
+    case 6:
+        _pizzathonListFlags1 |= 0x02;
+        break;
+    case 7:
+        _pizzathonListFlags1 |= 0x04;
+        break;
+    case 8:
+        _pizzathonListFlags1 |= 0x10;
+        break;
+    case 9:
+        _pizzathonListFlags1 |= 0x01;
+        break;
+    case 10:
+        _pizzathonListFlags1 |= 0x20;
+        break;
+    }
+    // _byte_306C8++; Never used
+    if ((_pizzathonListFlags1 & 0x08) && (_pizzathonListFlags1 & 0x40) && (_pizzathonListFlags1 & 0x80) &&
+        (_pizzathonListFlags2 & 0x01) && (_pizzathonListFlags2 & 0x02) && (_pizzathonListFlags1 & 0x02) &&
+        (_pizzathonListFlags1 & 0x04) && (_pizzathonListFlags1 & 0x10) && (_pizzathonListFlags1 & 0x01) &&
+        (_pizzathonListFlags1 & 0x20)) {
+        _pizzathonListFlags2 |= 0x04;
+    }
+}
+
 void GameLogic::displayExtremeCloseupOfPizzathonList() {
     _vm->stopRoomAnimations();
     _vm->_gameState = 5;
@@ -2072,7 +2114,7 @@ bool GameLogic::r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		break;
 	case 298:
 		if (_r2_flags & 0x01) {
-			_vm->setGameFlag(3);
+			setPizzathonStatus(3);
 			replyTextIndex1 = 294;
 		} else {
 			replyTextIndex1 = 286;
@@ -2400,7 +2442,7 @@ bool GameLogic::r3_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 			_vm->displayTextLines("c04r", 168, 50, 35, 2);
 			_vm->displayTextLines("c04r", 173, 50, 35, 2);
 			_vm->displayTextLines("c04", 230, -1, -1, 1);
-			_vm->setGameFlag(4);
+			setPizzathonStatus(4);
 			replyTextIndex1 = 175;
 		}
 		continueDialog = true;
@@ -2651,7 +2693,7 @@ void GameLogic::r4_handleRoomEvent() {
 	_vm->changeRoom(_vm->_currentRoomNumber);
 	_vm->displayTextLines("c04r", 248, 200, 20, 3);
 	_vm->displayTextLines("c04", 289, -1, -1, 1);
-	_vm->setGameFlag(1);
+	setPizzathonStatus(1);
 }
 
 int GameLogic::r4_useDrumstickWithCastleDoor() {
@@ -4104,7 +4146,7 @@ bool GameLogic::r9_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		break;
 	case 241:
 		replyTextIndex1 = 189;
-		_vm->setGameFlag(6);
+		setPizzathonStatus(6);
 	case 242:
 		_vm->_gameState = 0;
 		break;
@@ -4122,7 +4164,7 @@ bool GameLogic::r9_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		} else if (_r9_flags & 0x04) {
 			replyTextIndex1 = 204;
 		} else {
-			_vm->setGameFlag(9);
+			setPizzathonStatus(9);
 			_r9_flags |= 0x04;
 			replyTextIndex1 = 203;
 		}
@@ -4982,7 +5024,7 @@ bool GameLogic::r12_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		break;
 	case 279:
 		_vm->displayTextLines("c04r", 230, 50, 30, 1);
-		_vm->setGameFlag(10);
+		setPizzathonStatus(10);
 		r12_talkToLawyer();
 		break;
 	}
@@ -5029,7 +5071,7 @@ void GameLogic::r12_talkToLawyer() {
 		_vm->moveObjectToRoom(kObjectIdInventoryFinalContract, 99);
 		_vm->refreshInventory(true);
 		_r12_flags |= 0x01;
-		_vm->setGameFlag(8);
+		setPizzathonStatus(8);
 	} else {
 		_vm->displayTextLines("c04", 282, -1, -1, 1);
 		_vm->displayTextLines("c04r", 231, 50, 30, 2);
@@ -5044,7 +5086,7 @@ void GameLogic::r12_talkToLawyer() {
 void GameLogic::r12_givePotatoChipToCecil() {
 	_vm->moveObjectToNowhere(kObjectIdInventoryPotatoChip);
 	_vm->refreshInventory(true);
-	_vm->setGameFlag(5);
+	setPizzathonStatus(5);
 	for (int textIndex = 361; textIndex < 363; textIndex++) {
 		for (int i = 0; i < 4; i++) {
 			_vm->playAnimation("ctalk", 0, 2, 203, 85, 0, 100);
@@ -5324,7 +5366,7 @@ void GameLogic::r13_giveTicketToRomeToPepe() {
 	_r13_flags |= 0x04;
 	_vm->playAnimation("pepego", 0, 10, 60, 58, 0, 100);
 	_vm->moveObjectToNowhere(kObjectIdPepe13);
-	_vm->setGameFlag(2);
+	setPizzathonStatus(2);
 	_vm->refreshActors();
 }
 
@@ -5906,7 +5948,7 @@ void GameLogic::r20_handleRoomEvent() {
 	_vm->displayTextLines("c04r", 221, 275, 30, 3);
 	_vm->playAnimation("gillgo", 0, 9, 273, 79, 0, 100);
 	_vm->moveObjectToNowhere(kObjectIdGilligan);
-	_vm->setGameFlag(7);
+	setPizzathonStatus(7);
 	_vm->loadRoomBackground(_vm->_currentRoomNumber);
 }
 
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index 9d1ca765661..3a45c985c6a 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -47,6 +47,7 @@ public:
 	void updateRoomAnimations(bool doUpdate);
 	void handleRoomEvent(int eventNum);
 	int getActorScaleFromY(int actorY);
+	void setPizzathonStatus(int flagNum);
 	void r38_atrap();
 public:
 	int _word_34464;
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 20741e7437c..e972b0a4fdf 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -1794,10 +1794,6 @@ void WaynesWorldEngine::handleVerbClose() {
 
 }
 
-void WaynesWorldEngine::setGameFlag(int flagNum) {
-	// TODO
-}
-
 void WaynesWorldEngine::lookAtUnusedTicket() {
     // sysMouseDriver(2);
     _gameState = 3;
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 73c768a9508..a23a0701c96 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -336,8 +336,6 @@ public:
 	void handleVerbOpen();
 	void handleVerbClose();
 
-	void setGameFlag(int flagNum);
-
 	void lookAtUnusedTicket();
 	void unusedTicketHandleMouseMove();
 	void unusedTicketHandleMouseClick();


Commit: aa8ff8a809577284ba49dbff7414a03f36bbfe00
    https://github.com/scummvm/scummvm/commit/aa8ff8a809577284ba49dbff7414a03f36bbfe00
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:51+01:00

Commit Message:
WAYNESWORLD: Update background animations based on time (and not some counter like in the original)

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 235f3213f08..af50ed8e7de 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -179,7 +179,6 @@ void GameLogic::initVariables() {
 	_r17_eventFlag = 0;
 	_r2_backgroundValue1 = 0;
 	_r2_backgroundValue2 = 0;
-	_r7_cloudsPositionX = 0;
 	_r19_wayneSpriteX = 0;
 	_r19_garthSpriteX = 0;
 	_r24_mazeRoomNumber = 0;
@@ -807,46 +806,46 @@ void GameLogic::refreshRoomBackground(int roomNum) {
     }
 }
 
-void GameLogic::updateRoomAnimations(bool doUpdate) {
+void GameLogic::updateRoomAnimations() {
     switch (_vm->_currentRoomNumber) {
 	case 1:
-		r1_updateRoomAnimations(doUpdate);
+		r1_updateRoomAnimations();
 		break;
 	case 4:
-		r4_updateRoomAnimations(doUpdate);
+		r4_updateRoomAnimations();
 		break;
 	case 6:
-		r6_updateRoomAnimations(doUpdate);
+		r6_updateRoomAnimations();
 		break;
 	case 7:
-		r7_updateRoomAnimations(doUpdate);
+		r7_updateRoomAnimations();
 		break;
 	case 8:
-		r8_updateRoomAnimations(doUpdate);
+		r8_updateRoomAnimations();
 		break;
 	case 9:
-		r9_updateRoomAnimations(doUpdate);
+		r9_updateRoomAnimations();
 		break;
 	case 11:
-		r11_updateRoomAnimations(doUpdate);
+		r11_updateRoomAnimations();
 		break;
 	case 18:
-		r18_updateRoomAnimations(doUpdate);
+		r18_updateRoomAnimations();
 		break;
 	case 29:
-		r29_updateRoomAnimations(doUpdate);
+		r29_updateRoomAnimations();
 		break;
 	case 32:
-		r32_updateRoomAnimations(doUpdate);
+		r32_updateRoomAnimations();
 		break;
 	case 34:
-		r34_updateRoomAnimations(doUpdate);
+		r34_updateRoomAnimations();
 		break;
 	case 36:
-		r36_updateRoomAnimations(doUpdate);
+		r36_updateRoomAnimations();
 		break;
 	case 38:
-		r38_updateRoomAnimations(doUpdate);
+		r38_updateRoomAnimations();
 		break;
 	}
 }
@@ -1669,6 +1668,9 @@ bool GameLogic::r1_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 void GameLogic::r1_initRoomAnimations() {
 	_vm->loadAnimationSpriteRange(0, "term", 10);
 	_vm->loadAnimationSpriteRange(10, "mice", 5);
+	_vm->setAnimationTimer(0, 1000);
+	_vm->setAnimationTimer(1, 400);
+	_vm->setAnimationTimer(2, 6000);
 	_vm->startRoomAnimations();
 }
 
@@ -1677,21 +1679,14 @@ void GameLogic::r1_uninitRoomAnimations() {
 	_vm->loadPalette("m01/wstand0");
 }
 
-void GameLogic::r1_updateRoomAnimations(bool doUpdate) {
-	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 5000;
-	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
-		_vm->drawAnimationSprite(_vm->_animationsCtr / 500, 270, 47);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
+void GameLogic::r1_updateRoomAnimations() {
+	if (_vm->isAnimationTimerExpired(0)) {
+		_vm->drawAnimationSprite(_vm->getAnimationTimerCounter(0) % 10, 270, 47);
 	}
-	if (!(_r1_flags1 & 0x10) && (_vm->_animationsCtr % 200 == 55 || doUpdate)) {
+	if (!(_r1_flags1 & 0x10) && _vm->isAnimationTimerExpired(1)) {
 		_vm->drawAnimationSprite(10 + _vm->getRandom(5), 179, 67);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
 	}
-	if (_r1_eventFlag != 0 && _vm->_animationsCtr % 3000 == 144) {
+	if (_r1_eventFlag != 0 && _vm->isAnimationTimerExpired(2)) {
 		_vm->_roomEventNum = _r1_eventCtr;
 	}
 }
@@ -2622,6 +2617,10 @@ bool GameLogic::r4_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 void GameLogic::r4_initRoomAnimations() {
 	_vm->loadAnimationSpriteRange(0, "bktalk", 2);
 	_vm->loadAnimationSpriteRange(2, "bkarm", 2);
+	_vm->setAnimationTimer(0, 700);
+	_vm->setAnimationTimer(1, 800);
+	_vm->setAnimationTimer(2, 200);
+	_vm->setAnimationTimer(3, 300);
 	_vm->startRoomAnimations();
 }
 
@@ -2629,31 +2628,15 @@ void GameLogic::r4_uninitRoomAnimations() {
 	_vm->stopRoomAnimations();
 }
 
-void GameLogic::r4_updateRoomAnimations(bool doUpdate) {
-	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 1000;
-	if (doUpdate) {
-		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 1000;
-	}
-	if (_vm->_animationsCtr % 350 == 0 && _vm->getRandom(10) < 3) {
+void GameLogic::r4_updateRoomAnimations() {
+	if (_vm->isAnimationTimerExpired(0) && _vm->getRandom(10) < 3) {
 		_vm->drawAnimationSprite(1, 8, 48);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
-	} else if (_vm->_animationsCtr % 400 == 0 && _vm->getRandom(10) < 8) {
+	} else if (_vm->isAnimationTimerExpired(1) && _vm->getRandom(10) < 8) {
 		_vm->drawAnimationSprite(0, 8, 48);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
-	} else if (_vm->_animationsCtr == 100 && _vm->getRandom(10) < 1) {
+	} else if (_vm->isAnimationTimerExpired(2) && _vm->getRandom(10) < 1) {
 		_vm->drawAnimationSprite(3, 11, 67);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
-	} else if (_vm->_animationsCtr == 150 && _vm->getRandom(10) < 2) {
+	} else if (_vm->isAnimationTimerExpired(3) && _vm->getRandom(10) < 2) {
 		_vm->drawAnimationSprite(2, 11, 67);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
 	}
 }
 
@@ -3109,6 +3092,7 @@ bool GameLogic::r6_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 
 void GameLogic::r6_initRoomAnimations() {
 	_vm->loadAnimationSpriteRange(0, "sitdog", 3);
+	_vm->setAnimationTimer(0, 500);
 	_vm->startRoomAnimations();
 }
 
@@ -3116,16 +3100,9 @@ void GameLogic::r6_uninitRoomAnimations() {
 	_vm->stopRoomAnimations();
 }
 
-void GameLogic::r6_updateRoomAnimations(bool doUpdate) {
-	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 1200;
-	if (doUpdate) {
-		_vm->_animationsCtr = (_vm->_animationsCtr + 200) % 1200;
-	}
-	if (!(_r6_flags & 0x01) && (_vm->_animationsCtr % 400 == 0 || doUpdate)) {
-		_vm->drawAnimationSprite(_vm->_animationsCtr / 400, 49, 111);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
+void GameLogic::r6_updateRoomAnimations() {
+	if (!(_r6_flags & 0x01) && _vm->isAnimationTimerExpired(0)) {
+		_vm->drawAnimationSprite(_vm->getAnimationTimerCounter(0) % 3, 49, 111);
 	}
 }
 
@@ -3476,12 +3453,13 @@ int GameLogic::r7_handleVerbPickUp() {
 }
 
 void GameLogic::r7_initRoomAnimations() {
-	_r7_cloudsPositionX = _vm->getRandom(230);
 	_vm->loadAnimationSprite(0, "clouds");
 	_vm->loadAnimationSprite(1, "bldg");
 	_vm->loadAnimationSprite(2, "sky");
 	_vm->loadAnimationSprite(3, "elvis0");
 	_vm->loadAnimationSprite(4, "elvis1");
+	_vm->setAnimationTimer(0, 1000, _vm->getRandom(230));
+	_vm->setAnimationTimer(1, 4000);
 	_vm->startRoomAnimations();
 }
 
@@ -3489,22 +3467,15 @@ void GameLogic::r7_uninitRoomAnimations() {
 	_vm->stopRoomAnimations();
 }
 
-void GameLogic::r7_updateRoomAnimations(bool doUpdate) {
-	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 4000;
-	if (_vm->_animationsCtr % 500 == 0) {
-		_r7_cloudsPositionX = (_r7_cloudsPositionX + 1) % 230;
+void GameLogic::r7_updateRoomAnimations() {
+	if (_vm->isAnimationTimerExpired(0)) {
+		int cloudsPositionX = _vm->getAnimationTimerCounter(0) % 230;
 		_vm->drawAnimationSprite(2, 0, 0);
-		_vm->drawAnimationSpriteTransparent(0, _r7_cloudsPositionX - 125, 13);
+		_vm->drawAnimationSpriteTransparent(0, cloudsPositionX - 125, 13);
 		_vm->drawAnimationSpriteTransparent(1, 0, 13);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
 	}
-	if (_vm->_animationsCtr % 2000 == 0) {
-		_vm->drawAnimationSprite(3 + (_vm->_animationsCtr / 2000), 197, 68);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
+	if (_vm->isAnimationTimerExpired(1)) {
+		_vm->drawAnimationSprite(3 + _vm->getAnimationTimerCounter(1) % 2, 197, 68);
 	}
 }
 
@@ -3837,19 +3808,13 @@ bool GameLogic::r8_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 
 void GameLogic::r8_initRoomAnimations() {
 	_vm->loadAnimationSpriteRange(0, "fount", 9);
+	_vm->setAnimationTimer(0, 300);
 	_vm->startRoomAnimations();
 }
 
-void GameLogic::r8_updateRoomAnimations(bool doUpdate) {
-	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 4500;
-	if (doUpdate) {
-		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 4500;
-	}
-	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
-		_vm->drawAnimationSprite(_vm->_animationsCtr / 500, 85, 38);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
+void GameLogic::r8_updateRoomAnimations() {
+	if (_vm->isAnimationTimerExpired(0)) {
+		_vm->drawAnimationSprite(_vm->getAnimationTimerCounter(0) % 9, 85, 38);
 	}
 }
 
@@ -4208,6 +4173,7 @@ bool GameLogic::r9_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 
 void GameLogic::r9_initRoomAnimations() {
 	_vm->loadAnimationSpriteRange(0, "sign", 3);
+	_vm->setAnimationTimer(0, 1000);
 	_vm->startRoomAnimations();
 }
 
@@ -4215,16 +4181,9 @@ void GameLogic::r9_uninitRoomAnimations() {
 	_vm->stopRoomAnimations();
 }
 
-void GameLogic::r9_updateRoomAnimations(bool doUpdate) {
-	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 3000;
-	if (doUpdate) {
-		_vm->_animationsCtr = (_vm->_animationsCtr + 200) % 3000;
-	}
-	if (_vm->_animationsCtr % 1000 == 0 || doUpdate) {
-		_vm->drawAnimationSprite(_vm->_animationsCtr / 1000, 124, 27);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
+void GameLogic::r9_updateRoomAnimations() {
+	if (_vm->isAnimationTimerExpired(0)) {
+		_vm->drawAnimationSprite(_vm->getAnimationTimerCounter(0) % 3, 124, 27);
 	}
 }
 
@@ -4712,6 +4671,7 @@ int GameLogic::r11_handleVerbPush() {
 void GameLogic::r11_initRoomAnimations() {
 	_vm->loadAnimationSpriteRange(0, "water", 4);
 	_vm->loadAnimationSprite(4, "suckcut");
+	_vm->setAnimationTimer(0, 800);
 	_vm->startRoomAnimations();
 }
 
@@ -4719,19 +4679,12 @@ void GameLogic::r11_uninitRoomAnimations() {
 	_vm->stopRoomAnimations();
 }
 
-void GameLogic::r11_updateRoomAnimations(bool doUpdate) {
-	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 2000;
-	if (doUpdate) {
-		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 2000;
-	}
-	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
-		_vm->drawAnimationSprite(_vm->_animationsCtr / 500, 45, 92);
+void GameLogic::r11_updateRoomAnimations() {
+	if (_vm->isAnimationTimerExpired(0)) {
+		_vm->drawAnimationSprite(_vm->getAnimationTimerCounter(0) % 4, 45, 92);
 		if (_r11_flags & 0x04) {
 			_vm->drawAnimationSprite(4, 116, 125);
 		}
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
 	}
 }
 
@@ -5660,6 +5613,8 @@ void GameLogic::r17_handleRoomEvent3() {
 }
 
 void GameLogic::r18_initRoomAnimations() {
+	_vm->loadAnimationSpriteRange(0, "machine", 9);
+	_vm->setAnimationTimer(0, 1000);
 	_vm->startRoomAnimations();
 }
 
@@ -5667,17 +5622,9 @@ void GameLogic::r18_uninitRoomAnimations() {
 	_vm->stopRoomAnimations();
 }
 
-void GameLogic::r18_updateRoomAnimations(bool doUpdate) {
-	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 4500;
-	if (doUpdate) {
-		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 4500;
-	}
-	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
-		Common::String machineFilename = Common::String::format("machine%d", _vm->_animationsCtr / 500);
-		_vm->drawRoomImageToBackground(machineFilename.c_str(), 115, 51);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
+void GameLogic::r18_updateRoomAnimations() {
+	if (_vm->isAnimationTimerExpired(0)) {
+		_vm->drawAnimationSprite(_vm->getAnimationTimerCounter(0) % 9, 115, 51);
 	}
 }
 
@@ -6530,6 +6477,9 @@ void GameLogic::r29_initRoomAnimations() {
 	_vm->loadAnimationSpriteRange(0, "coil", 10);
 	_vm->loadAnimationSpriteRange(10, "torch", 4);
 	_vm->loadAnimationSpriteRange(14, "machine", 4);
+	_vm->setAnimationTimer(0, 500);
+	_vm->setAnimationTimer(1, 300);
+	_vm->setAnimationTimer(2, 1500);
 	_vm->startRoomAnimations();
 }
 
@@ -6537,26 +6487,15 @@ void GameLogic::r29_uninitRoomAnimations() {
 	_vm->stopRoomAnimations();
 }
 
-void GameLogic::r29_updateRoomAnimations(bool doUpdate) {
-	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 5000;
-	if (doUpdate) {
-		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 5000;
+void GameLogic::r29_updateRoomAnimations() {
+	if (_vm->isAnimationTimerExpired(0)) {
+		_vm->drawAnimationSprite(_vm->getAnimationTimerCounter(0) % 10, 134, 0);
 	}
-	if (_vm->_animationsCtr % 500 == 0 || doUpdate) {
-		_vm->drawAnimationSprite(_vm->_animationsCtr / 500, 134, 0);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
-	} else if (_vm->_animationsCtr % 200 == 150 || doUpdate) {
+	if (_vm->isAnimationTimerExpired(1)) {
 		_vm->drawAnimationSprite(10 + _vm->getRandom(4), 0, 16);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
-	} else if (_vm->_animationsCtr % 500 == 350 || doUpdate) {
+	}
+	if (_vm->isAnimationTimerExpired(2)) {
 		_vm->drawAnimationSprite(14 + _vm->getRandom(4), 172, 46);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
 	}
 }
 
@@ -7317,6 +7256,8 @@ bool GameLogic::r32_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 void GameLogic::r32_initRoomAnimations() {
 	_vm->loadAnimationSpriteRange(0, "jan", 3);
 	_vm->loadAnimationSpriteRange(3, "jeat", 4);
+	_vm->setAnimationTimer(0, 1200);
+	_vm->setAnimationTimer(1, 800);
 	_vm->startRoomAnimations();
 }
 
@@ -7324,22 +7265,13 @@ void GameLogic::r32_uninitRoomAnimations() {
 	_vm->stopRoomAnimations();
 }
 
-void GameLogic::r32_updateRoomAnimations(bool doUpdate) {
-	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 3600;
+void GameLogic::r32_updateRoomAnimations() {
 	if (_r32_flags & 0x04) {
-		if (_vm->_animationsCtr % 900 == 0 || doUpdate) {
-			_vm->drawAnimationSprite(3 + (_vm->_animationsCtr / 900), 262, 83);
-			_vm->_hasRoomAnimationCallback = false;
-			_vm->refreshActors();
-			_vm->_hasRoomAnimationCallback = true;
-		}
-	} else {
-		if (_vm->_animationsCtr % 400 == 0 || doUpdate) {
-			_vm->drawAnimationSprite(_vm->getRandom(3), 263, 84);
-			_vm->_hasRoomAnimationCallback = false;
-			_vm->refreshActors();
-			_vm->_hasRoomAnimationCallback = true;
+		if (_vm->isAnimationTimerExpired(1)) {
+			_vm->drawAnimationSprite(3 + _vm->getAnimationTimerCounter(1) % 4, 262, 83);
 		}
+	} else if (_vm->isAnimationTimerExpired(0)) {
+		_vm->drawAnimationSprite(_vm->getRandom(3), 263, 84);
 	}
 }
 
@@ -7533,6 +7465,7 @@ bool GameLogic::r34_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 
 void GameLogic::r34_initRoomAnimations() {
 	_vm->loadAnimationSpriteRange(0, "towel", 4);
+	_vm->setAnimationTimer(0, 2500);
 	_vm->startRoomAnimations();
 }
 
@@ -7540,13 +7473,9 @@ void GameLogic::r34_uninitRoomAnimations() {
 	_vm->stopRoomAnimations();
 }
 
-void GameLogic::r34_updateRoomAnimations(bool doUpdate) {
-	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 3000;
-	if (_vm->_animationsCtr == 0 || doUpdate) {
+void GameLogic::r34_updateRoomAnimations() {
+	if (_vm->isAnimationTimerExpired(0)) {
 		_vm->drawAnimationSprite(_vm->getRandom(4), 198, 68);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
 	}
 }
 
@@ -7770,6 +7699,7 @@ int GameLogic::r36_handleVerbUse() {
 
 void GameLogic::r36_initRoomAnimations() {
 	_vm->loadAnimationSpriteRange(0, "sleep", 2);
+	_vm->setAnimationTimer(0, 2500);
 	_vm->startRoomAnimations();
 }
 
@@ -7777,18 +7707,9 @@ void GameLogic::r36_uninitRoomAnimations() {
 	_vm->stopRoomAnimations();
 }
 
-void GameLogic::r36_updateRoomAnimations(bool doUpdate) {
-	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 4000;
-	if (_vm->_animationsCtr == 0 || doUpdate) {
-		_vm->drawAnimationSprite(0, 263, 82);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
-	} else if (_vm->_animationsCtr == 2000 || doUpdate) {
-		_vm->drawAnimationSprite(1, 263, 82);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
+void GameLogic::r36_updateRoomAnimations() {
+	if (_vm->isAnimationTimerExpired(0)) {
+		_vm->drawAnimationSprite(_vm->getAnimationTimerCounter(0) % 2, 263, 82);
 	}
 }
 
@@ -8378,6 +8299,7 @@ int GameLogic::r38_handleVerbPull() {
 
 void GameLogic::r38_initRoomAnimations() {
 	_vm->loadAnimationSpriteRange(0, "hypno", 20);
+	_vm->setAnimationTimer(0, 650);
 	_vm->startRoomAnimations();
 }
 
@@ -8385,22 +8307,15 @@ void GameLogic::r38_uninitRoomAnimations() {
 	_vm->stopRoomAnimations();
 }
 
-void GameLogic::r38_updateRoomAnimations(bool doUpdate) {
-	_vm->_animationsCtr = (_vm->_animationsCtr + 1) % 8000;
-	if (doUpdate) {
-		_vm->_animationsCtr = (_vm->_animationsCtr + 125) % 8000;
-	}
-	if (_vm->_animationsCtr % 400 == 0 || doUpdate) {
-		_vm->drawAnimationSprite(_vm->_animationsCtr / 400, 8, 38);
-		_vm->_hasRoomAnimationCallback = false;
-		_vm->refreshActors();
-		_vm->_hasRoomAnimationCallback = true;
+void GameLogic::r38_updateRoomAnimations() {
+	if (_vm->isAnimationTimerExpired(0)) {
+		_vm->drawAnimationSprite(_vm->getAnimationTimerCounter(0) % 20, 8, 38);
 	}
 }
 
 void GameLogic::r38_refreshRoomBackground() {
 	_r38_flags |= 0x01;
-	if (!_vm->_hasRoomAnimationCallback != 0 || !(_r38_flags & 0x08)) {
+	if (!_vm->_hasRoomAnimationCallback || !(_r38_flags & 0x08)) {
 		r38_initRoomAnimations();
 	}
 	if ((_r38_flags & 0x08)) {
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index 3a45c985c6a..1fd2216409f 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -44,7 +44,7 @@ public:
 	void handleDialogReply(int index, int x, int y);
 	bool handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
 	void refreshRoomBackground(int roomNum);
-	void updateRoomAnimations(bool doUpdate);
+	void updateRoomAnimations();
 	void handleRoomEvent(int eventNum);
 	int getActorScaleFromY(int actorY);
 	void setPizzathonStatus(int flagNum);
@@ -93,7 +93,6 @@ public:
 	byte _r17_eventFlag;
 	byte _r2_backgroundValue1;
 	byte _r2_backgroundValue2;
-	int _r7_cloudsPositionX;
 	int _r19_wayneSpriteX;
 	int _r19_garthSpriteX;
 	int _r24_mazeRoomNumber;
@@ -142,7 +141,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r1_handleRoomEvent(bool arg6);
 	void r1_initRoomAnimations();
 	void r1_uninitRoomAnimations();
-	void r1_updateRoomAnimations(bool doUpdate);
+	void r1_updateRoomAnimations();
 	void r1_useDayOldDonutWithMachine();
 	void r1_checkDrGadget();
 	void r1_pullScreen();
@@ -176,7 +175,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r4_handleRoomEvent();
 	void r4_initRoomAnimations();
 	void r4_uninitRoomAnimations();
-	void r4_updateRoomAnimations(bool doUpdate);
+	void r4_updateRoomAnimations();
 	int r4_useCheesePizzaWithCastle();
 	int r4_useDrumstickWithCastleDoor();
 	void r4_useChainWithObject(bool arg6, bool arg8);
@@ -203,7 +202,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r6_handleRoomEvent4();
 	void r6_initRoomAnimations();
 	void r6_uninitRoomAnimations();
-	void r6_updateRoomAnimations(bool doUpdate);
+	void r6_updateRoomAnimations();
 	void r6_useRopeWithBeam();
 	void r6_useHockeyStickWithRope();
 	void r6_useSeat();
@@ -218,7 +217,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r7_refreshRoomBackground();
 	void r7_initRoomAnimations();
 	void r7_uninitRoomAnimations();
-	void r7_updateRoomAnimations(bool doUpdate);
+	void r7_updateRoomAnimations();
 	void r7_openCloseFrontDoor(bool isOpen);
 
 	int r8_handleVerbPickUp();
@@ -228,7 +227,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	bool r8_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
 	void r8_refreshRoomBackground();
 	void r8_initRoomAnimations();
-	void r8_updateRoomAnimations(bool doUpdate);
+	void r8_updateRoomAnimations();
 	void r8_handleRoomEvent1();
 	void r8_handleRoomEvent2();
 	void r8_handleRoomEvent3();
@@ -246,7 +245,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r9_refreshRoomBackground();
 	void r9_initRoomAnimations();
 	void r9_uninitRoomAnimations();
-	void r9_updateRoomAnimations(bool doUpdate);
+	void r9_updateRoomAnimations();
 	void r9_giveCoatOrTopHatToMan();
 
 	int r10_handleVerbPickUp();
@@ -271,7 +270,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r11_refreshRoomBackground();
 	void r11_initRoomAnimations();
 	void r11_uninitRoomAnimations();
-	void r11_updateRoomAnimations(bool doUpdate);
+	void r11_updateRoomAnimations();
 	void r11_pickUpExtensionCord();
 	void r11_usePlungersWithLampPost();
 	void r11_useExtensionCordWithOutlet();
@@ -318,7 +317,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r18_refreshRoomBackground();
 	void r18_initRoomAnimations();
 	void r18_uninitRoomAnimations();
-	void r18_updateRoomAnimations(bool doUpdate);
+	void r18_updateRoomAnimations();
 
 	void r19_handleVerbTalkTo();
 	bool r19_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
@@ -352,7 +351,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r29_handleRoomEvent();
 	void r29_initRoomAnimations();
 	void r29_uninitRoomAnimations();
-	void r29_updateRoomAnimations(bool doUpdate);
+	void r29_updateRoomAnimations();
 
 	int r30_handleVerbPickUp();
 	int r30_handleVerbUse();
@@ -391,7 +390,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r32_handleRoomEvent();
 	void r32_initRoomAnimations();
 	void r32_uninitRoomAnimations();
-	void r32_updateRoomAnimations(bool doUpdate);
+	void r32_updateRoomAnimations();
 	void r32_pickUpMemo();
 
 	void r33_refreshRoomBackground();
@@ -405,7 +404,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r34_refreshRoomBackground();
 	void r34_initRoomAnimations();
 	void r34_uninitRoomAnimations();
-	void r34_updateRoomAnimations(bool doUpdate);
+	void r34_updateRoomAnimations();
 
 	int r35_handleVerbUse();
 	void r35_handleVerbTalkTo();
@@ -420,7 +419,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r36_handleRoomEvent();
 	void r36_initRoomAnimations();
 	void r36_uninitRoomAnimations();
-	void r36_updateRoomAnimations(bool doUpdate);
+	void r36_updateRoomAnimations();
 
 	int r37_handleVerbPickUp();
 	int r37_handleVerbUse();
@@ -439,7 +438,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r38_refreshRoomBackground();
 	void r38_initRoomAnimations();
 	void r38_uninitRoomAnimations();
-	void r38_updateRoomAnimations(bool doUpdate);
+	void r38_updateRoomAnimations();
 	void r38_useCassandra();
 	void r38_pullRag();
 
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index e972b0a4fdf..da5d33c3831 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -148,7 +148,9 @@ Common::Error WaynesWorldEngine::run() {
 	drawInterface(2);
 	// changeRoom(0);
 	// _wayneSpriteX = -1; _garthSpriteX = -1;
-	changeRoom(9); // DEBUG
+	changeRoom(38); // DEBUG
+	// _logic->_r1_eventFlag = 1;
+	// _logic->_r1_eventCtr = 3;
 
 	_gameState = 0; // DEBUG Initial _gameState 0 is set by room event in room 0
 	// _gameState = 1; // DEBUG Open map
@@ -169,7 +171,7 @@ Common::Error WaynesWorldEngine::run() {
 		if (_gameState == 1 && _currentRoomNumber < 100) {
 			gameMapOpen();
 		}
-		updateRoomAnimations(false);
+		updateRoomAnimations();
 		g_system->updateScreen();
 		// g_system->delayMillis(20);
 	}
@@ -901,7 +903,7 @@ void WaynesWorldEngine::drawActorReachObject(int objectId, int spriteIndex) {
 }
 
 int WaynesWorldEngine::drawActors(int direction, int wayneKind, int garthKind, int spriteIndex, int wayneX, int wayneY, int garthX, int garthY) {
-    updateRoomAnimations(true);
+    updateRoomAnimations();
 
     if (_wayneSpriteX == -1 && _garthSpriteX == -1) {
         WWSurface *tempBackground = new WWSurface(320, 150);
@@ -1036,7 +1038,7 @@ void WaynesWorldEngine::pickupObject(int objectId, byte &flags, byte flagsSet, i
     drawActorReachObject(objectId, 0);
     for (int index = 0; index < 20; index++) {
         waitMillis(50);
-        updateRoomAnimations(true);
+        updateRoomAnimations();
     }
     _garthKind = 1;
     _wayneKind = 1;
@@ -1052,7 +1054,7 @@ void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int co
     // sysMouseDriver(2);
     if (count > 0) {
         for (int index = startIndex; index < startIndex + count; index++) {
-            updateRoomAnimations(true);
+            updateRoomAnimations();
             sprintf(filename, "%s%d", prefix, index);
             drawRoomImageToScreen(filename, x, y);
             drawRoomImageToBackground(filename, x, y);
@@ -1060,7 +1062,7 @@ void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int co
         }
     } else {
         for (int index = startIndex; index > startIndex + count; index--) {
-            updateRoomAnimations(true);
+            updateRoomAnimations();
             sprintf(filename, "%s%d", prefix, index);
             drawRoomImageToScreen(filename, x, y);
             drawRoomImageToBackground(filename, x, y);
@@ -1158,16 +1160,25 @@ void WaynesWorldEngine::loadAnimationSprite(int index, const char *filename) {
 }
 
 void WaynesWorldEngine::drawAnimationSprite(int index, int x, int y) {
+	_animationsRedrawBackground = true;
 	_backgroundSurface->drawSurface(_roomAnimations[index], x, y);
 }
 
 void WaynesWorldEngine::drawAnimationSpriteTransparent(int index, int x, int y) {
+	_animationsRedrawBackground = true;
 	_backgroundSurface->drawSurfaceTransparent(_roomAnimations[index], x, y);
 }
 
-void WaynesWorldEngine::updateRoomAnimations(bool doUpdate) {
+void WaynesWorldEngine::updateRoomAnimations() {
 	if (_hasRoomAnimationCallback) {
-		_logic->updateRoomAnimations(doUpdate);
+		_animationsRedrawBackground = false;
+		updateAnimationTimers();
+		_logic->updateRoomAnimations();
+		if (_animationsRedrawBackground) {
+			_hasRoomAnimationCallback = false;
+			refreshActors();
+			_hasRoomAnimationCallback = true;
+		}
 	}
 }
 
@@ -1184,6 +1195,36 @@ void WaynesWorldEngine::stopRoomAnimations() {
 	_hasRoomAnimationCallback = false;
 }
 
+void WaynesWorldEngine::updateAnimationTimers() {
+	uint32 currentTicks = _system->getMillis();
+	for (uint i = 0; i < kAnimationTimersCount; i++) {
+		AnimationTimer &animationTimer = _animationTimers[i];
+		animationTimer.expired = animationTimer.nextUpdateTicks == 0 || currentTicks >= animationTimer.nextUpdateTicks;
+		if (animationTimer.expired) {
+			if (animationTimer.nextUpdateTicks > 0) {
+				++animationTimer.counter;
+			}
+			animationTimer.nextUpdateTicks = currentTicks + animationTimer.delay;
+		}
+	}
+}
+
+void WaynesWorldEngine::setAnimationTimer(uint index, uint32 delay, int initialCounter) {
+	AnimationTimer &animationTimer = _animationTimers[index];
+	animationTimer.nextUpdateTicks = 0;
+	animationTimer.delay = delay;
+	animationTimer.counter = initialCounter;
+	animationTimer.expired = false;
+}
+
+bool WaynesWorldEngine::isAnimationTimerExpired(uint index) {
+	return _animationTimers[index].expired;
+}
+
+int WaynesWorldEngine::getAnimationTimerCounter(uint index) {
+	return _animationTimers[index].counter;
+}
+
 void WaynesWorldEngine::initStaticRoomObjects() {
 	for  (uint i = 0; i < kStaticRoomObjectsCount; i++)
 		_staticRoomObjects[i] = kStaticRoomObjects[i];
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index a23a0701c96..1d66b70a79d 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -72,6 +72,14 @@ struct WalkPoint {
     int x, y, direction;
 };
 
+struct AnimationTimer {
+	uint32 nextUpdateTicks;
+	uint32 delay;
+	int counter;
+	bool expired;
+	AnimationTimer() : nextUpdateTicks(0), delay(0), counter(0), expired(false) {}
+};
+
 enum {
 	kLeftButtonClicked = 1 << 0,
 	kRightButtonClicked = 1 << 1,
@@ -85,6 +93,7 @@ const uint kRoomAnimationsCount = 20;
 const uint kStaticRoomObjectsMapCount = 40;
 const uint kStaticRoomObjectsCount = 58;
 const uint kStaticRoomObjectSpritesCount = 4;
+const uint kAnimationTimersCount = 4;
 
 class WaynesWorldEngine : public Engine {
 protected:
@@ -128,6 +137,9 @@ public:
 	bool _doScrollRight;
 	bool _hasRoomAnimationCallback;
 
+	// Room animations
+	AnimationTimer _animationTimers[kAnimationTimersCount];
+
 	// Input
 	int _mouseX, _mouseY;
 	int _mouseClickY, _mouseClickX;
@@ -154,6 +166,7 @@ public:
 	Common::String _firstObjectName;
 	int _roomEventNum;
 	int _animationsCtr;
+	bool _animationsRedrawBackground;
 
 	// Actors
 	int _wayneSpriteX, _wayneSpriteY, _wayneKind, _wayneActorScale;
@@ -291,13 +304,18 @@ public:
 	void loadRoomMask(int roomNum);
 	void fillRoomMaskArea(int x1, int y1, int x2, int y2, int enabled);
 
+	// Room animations
 	void loadAnimationSpriteRange(int baseIndex, const char *filename, int count);
 	void loadAnimationSprite(int index, const char *filename);
 	void drawAnimationSprite(int index, int x, int y);
 	void drawAnimationSpriteTransparent(int index, int x, int y);
-	void updateRoomAnimations(bool doUpdate);
+	void updateRoomAnimations();
 	void startRoomAnimations();
 	void stopRoomAnimations();
+	void updateAnimationTimers();
+	void setAnimationTimer(uint index, uint32 delay, int initialCounter = 0);
+	bool isAnimationTimerExpired(uint index);
+	int getAnimationTimerCounter(uint index);
 
 	// Static room objects
 	void initStaticRoomObjects();


Commit: 3e2fa9eba59b231863b197c89d085ece6493b5f1
    https://github.com/scummvm/scummvm/commit/3e2fa9eba59b231863b197c89d085ece6493b5f1
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:51+01:00

Commit Message:
WAYNESWORLD: Remove unneccessary parameter from WaynesWorldEngine::loadRoomBackground

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index af50ed8e7de..58e432eabfb 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -1527,7 +1527,7 @@ int GameLogic::r1_handleVerbPush() {
 			actionTextIndex = 1;
 		} else {
 			_r1_flags1 &= ~0x20;
-			_vm->loadRoomBackground(_vm->_currentRoomNumber);
+			_vm->loadRoomBackground();
 		}
 		break;
 	default:
@@ -1855,7 +1855,7 @@ void GameLogic::r1_handleRoomEvent(bool arg6) {
 		_r1_eventCtr = -1;
 		_vm->_garthSpriteX = 146;
 		_vm->loadRoomMask(_vm->_currentRoomNumber);
-		_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		_vm->loadRoomBackground();
 		if ((_r1_flags1 & 0x10) && !(_r1_flags1 & 0x40)) {
 			r1_drGadgetLeaves();
 		}
@@ -1878,7 +1878,7 @@ void GameLogic::r1_pullScreen() {
 	_vm->moveObjectToNowhere(kObjectIdScreen);
 	_vm->moveObjectToRoom(kObjectIdSafe_0, 1);
 	_r1_flags1 |= 0x01;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r1_openSafe() {
@@ -1887,14 +1887,14 @@ void GameLogic::r1_openSafe() {
 		_vm->moveObjectToRoom(kObjectIdRemoteControl, 1);
 	}
 	_r1_flags1 |= 0x02;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r1_closeSafe() {
 	_vm->drawActorReachObject(kObjectIdSafe_0, 0);
 	_vm->moveObjectToNowhere(kObjectIdRemoteControl);
 	_r1_flags1 &= ~0x02;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r1_pullLever() {
@@ -1907,7 +1907,7 @@ void GameLogic::r1_pullLever() {
 		_vm->_wayneSpriteX = 236;
 	}
 	_r1_flags1 |= 0x20;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r1_checkDrGadget() {
@@ -1921,7 +1921,7 @@ void GameLogic::r1_checkDrGadget() {
 		_r1_flags2 |= 0x01;
 		_vm->moveObjectToRoom(kObjectIdDrGadget_1, 1);
 		_vm->setStaticRoomObjectPosition(1, 1, 1, 91, 78);
-		_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		_vm->loadRoomBackground();
 	}
 	_vm->displayText("c04r", 137, 0, 170, 30, 0);
 }
@@ -1948,7 +1948,7 @@ void GameLogic::r1_drGadgetLeaves() {
 		_vm->playAnimation("scout", 0, 21, 3, 68, 0, 100);
 	}
 	_vm->setStaticRoomObjectPosition(1, 1, 1, -1, 78);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 int GameLogic::r2_handleVerbPickUp() {
@@ -2599,7 +2599,7 @@ bool GameLogic::r4_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 			_vm->moveObjectToRoom(kObjectIdInventoryBusinessCards, 99);
 			_vm->refreshInventory(true);
 		}
-		_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		_vm->loadRoomBackground();
 		_vm->_gameState = 0;
 		break;
 	case 285:
@@ -2685,7 +2685,7 @@ int GameLogic::r4_useDrumstickWithCastleDoor() {
 	_vm->moveObjectToNowhere(kObjectIdInventoryDrumstick);
 	_vm->moveObjectToRoom(kObjectIdDrumstick_1, 4);
 	_vm->refreshInventory(false);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	return 57;
 }
 
@@ -2694,7 +2694,7 @@ int GameLogic::r4_useCheesePizzaWithCastle() {
 	_vm->moveObjectToNowhere(kObjectIdInventoryCheesePizza);
 	_vm->moveObjectToRoom(kObjectIdCheese, 4);
 	_vm->refreshInventory(false);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	return 58;
 }
 
@@ -2708,7 +2708,7 @@ void GameLogic::r4_useChainWithObject(bool arg6, bool arg8) {
 	_vm->moveObjectToNowhere(kObjectIdInventoryChain);
 	_vm->moveObjectToRoom(kObjectIdChain_1, 4);
 	_vm->refreshInventory(false);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 int GameLogic::r4_useTubeWithShade() {
@@ -2730,7 +2730,7 @@ int GameLogic::r4_useTubeWithShade() {
 		_vm->_garthSpriteX = -1;
 	}
 	_vm->displayTextLines("c03", 62, -1, -1, 1);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_vm->waitSeconds(2);
 	_r4_flags &= ~0x20;
 	_r4_flags &= ~0x40;
@@ -2754,7 +2754,7 @@ int GameLogic::r4_useTubeWithShade() {
 	_r4_flags &= ~0x02;
 	_r4_flags &= ~0x04;
 	_vm->refreshInventory(false);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_vm->_roomEventNum = 1;
 	return 60;
 }
@@ -3161,11 +3161,11 @@ void GameLogic::r6_handleRoomEvent2() {
 	_vm->_garthSpriteX = 155;
 	_vm->_wayneSpriteX = 150;
 	_vm->_currentActorNum = 1;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_r6_flags &= ~0x08;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_r6_flags &= ~0x04;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_vm->moveObjectToNowhere(kObjectIdRope_1);
 	_vm->moveObjectToRoom(kObjectIdInventoryRope, 99);
 	_vm->moveObjectToRoom(kObjectIdInventoryHockeyStick, 99);
@@ -3195,7 +3195,7 @@ void GameLogic::r6_handleRoomEvent3() {
 
 void GameLogic::r6_handleRoomEvent4() {
 	_vm->playAnimation("dad", 3, 2, 119, 79, 0, 100);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r6_giveLuckySausageToDog() {
@@ -3229,7 +3229,7 @@ void GameLogic::r6_useHockeyStickWithRope() {
 	_vm->moveObjectToNowhere(kObjectIdRope_1);
 	_vm->moveObjectToNowhere(kObjectIdInventoryHockeyStick);
 	_vm->refreshInventory(false);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r6_useSeat() {
@@ -3237,7 +3237,7 @@ void GameLogic::r6_useSeat() {
 	_vm->_garthSpriteX = -1;
 	_vm->moveObjectToNowhere(kObjectIdSeat);
 	_vm->moveObjectToRoom(kObjectIdRope_1, 6);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r6_pullRope() {
@@ -3508,7 +3508,7 @@ void GameLogic::r7_openCloseFrontDoor(bool isOpen) {
 		_vm->waitMillis(500);
 		_r7_flags &= ~0x04;
 	}
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 int GameLogic::r8_handleVerbClose() {
@@ -3907,7 +3907,7 @@ void GameLogic::r8_openCloseDoor(bool isOpen) {
 	} else {
 		_r8_flags |= 0x01;
 	}
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r8_openCloseCabinetDoor1(bool isOpen) {
@@ -3917,7 +3917,7 @@ void GameLogic::r8_openCloseCabinetDoor1(bool isOpen) {
 	} else {
 		_r8_flags &= ~0x02;
 	}
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r8_openCloseCabinetDoor2(bool isOpen) {
@@ -3927,7 +3927,7 @@ void GameLogic::r8_openCloseCabinetDoor2(bool isOpen) {
 	} else {
 		_r8_flags &= ~0x04;
 	}
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 int GameLogic::r9_handleVerbPickUp() {
@@ -4012,7 +4012,7 @@ void GameLogic::r9_handleVerbTalkTo() {
 			for (int i = 0; i < 8; i++) {
 				_vm->playAnimation("utrick", 0, 2, 206, 58, 0, 100);
 			}
-			_vm->loadRoomBackground(_vm->_currentRoomNumber);
+			_vm->loadRoomBackground();
 			_vm->displayTextLines("c04r", 193, 250, 25, 1);
 			_vm->setDialogChoices(246, 247, 248, 249, 250);
 		} else {
@@ -4209,7 +4209,7 @@ void GameLogic::r9_giveCoatOrTopHatToMan() {
 			_vm->playAnimation("strick", 16, -2, 191, 32, 0, 100);
 		}
 		_vm->playAnimation("strick", 14, -15, 191, 32, 0, 100);
-		_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		_vm->loadRoomBackground();
 		_vm->displayTextLines("c04r", 202, 250, 25, 1);
 		_vm->setDialogChoices(246, 253, 254, 249, 255);
 		_vm->startDialog();
@@ -4275,7 +4275,7 @@ void GameLogic::r10_handleVerbPickUpCandyBar() {
 	_vm->moveObjectToNowhere(kObjectIdCandyBar);
 	_vm->moveObjectToRoom(kObjectIdInventoryCandyBar, 99);
 	_vm->refreshInventory(false);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r10_handleVerbPickUpTicket() {
@@ -4291,7 +4291,7 @@ void GameLogic::r10_handleVerbPickUpJawbreakers() {
 	_r10_flags &= ~0x08;
 	_vm->moveObjectToRoom(kObjectIdInventoryJawbreakers, 99);
 	_vm->refreshInventory(false);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r10_handleVerbPickUpGum() {
@@ -4299,7 +4299,7 @@ void GameLogic::r10_handleVerbPickUpGum() {
 	_r10_flags &= ~0x04;
 	_vm->moveObjectToRoom(kObjectIdInventoryGum, 99);
 	_vm->refreshInventory(false);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r10_handleVerbGiveWinningTicketToSalesgirl() {
@@ -4313,7 +4313,7 @@ void GameLogic::r10_handleVerbGiveWinningTicketToSalesgirl() {
 	_vm->moveObjectToRoom(kObjectIdCandyBar, 10);
 	_vm->moveObjectToNowhere(kObjectIdInventoryWinningTicket);
 	_vm->refreshInventory(false);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_vm->displayText("c04r", 9, 0, 320, 70, 0);
 }
 
@@ -4337,7 +4337,7 @@ void GameLogic::r10_buyItem() {
 		}
 	}
 	_vm->moveObjectToNowhere(kObjectIdInventoryDollar);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_r10_selectedItemToBuy = -1;
 }
 
@@ -4512,7 +4512,7 @@ void GameLogic::r10_refreshRoomBackground() {
 
 void GameLogic::r10_refreshObject(int arg4) {
 	_r10_flags = _r10_flags + arg4;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_r10_flags &= (255 - arg4);
 }
 
@@ -4716,7 +4716,7 @@ void GameLogic::r11_useCar1() {
 	}
 	_r11_flags &= ~0x01;
 	_vm->setGarthPosition(205, 148);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r11_useCar2() {
@@ -4731,7 +4731,7 @@ void GameLogic::r11_useCar2() {
 	_r11_flags &= ~0x04;
 	_vm->setWaynePosition(136, 146);
 	_vm->_hasRoomAnimationCallback = true;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r11_pickUpExtensionCord() {
@@ -4745,7 +4745,7 @@ void GameLogic::r11_pickUpExtensionCord() {
 	_vm->moveObjectToNowhere(kObjectIdExtensionCord_1);
 	_vm->moveObjectToRoom(kObjectIdInventoryExtensionCord, 99);
 	_vm->refreshInventory(true);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r11_useSuckCutWithFountain() {
@@ -4767,7 +4767,7 @@ void GameLogic::r11_useSuckCutWithFountain() {
 	_vm->fillRoomMaskArea(117, 110, 140, 130, 0);
 	_vm->fillRoomMaskArea(81, 131, 119, 148, 1);
 	r11_useCar1();
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r11_useSuckCutWithExtensionCord() {
@@ -4783,7 +4783,7 @@ void GameLogic::r11_useSuckCutWithExtensionCord() {
 	_r11_flags |= 0x04;
 	_vm->setWaynePosition(136, 146);
 	_vm->_hasRoomAnimationCallback = true;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r11_useExtensionCordWithOutlet() {
@@ -5608,7 +5608,7 @@ void GameLogic::r17_handleRoomEvent3() {
 	_vm->setWaynePosition(71, 117);
 	_vm->setGarthPosition(90, 117);
 	_r17_eventFlag = 1;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_r17_eventFlag = 0;
 }
 
@@ -5896,7 +5896,7 @@ void GameLogic::r20_handleRoomEvent() {
 	_vm->playAnimation("gillgo", 0, 9, 273, 79, 0, 100);
 	_vm->moveObjectToNowhere(kObjectIdGilligan);
 	setPizzathonStatus(7);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r22_refreshRoomBackground() {
@@ -6386,7 +6386,7 @@ void GameLogic::r28_handleRoomEvent1() {
 	_vm->playAnimation("crysgun", 0, 4, 0, 0, 0, 200);
 	_vm->playAnimation("crysgun", 2, -3, 0, 0, 0, 200);
 	_vm->moveObjectToRoom(kObjectIdInventorySquirtGun, 99);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	for (int textIndex = 31; textIndex < 35; textIndex++) {
 		_vm->displayText("c04r", textIndex, 0, 150, 10, 0);
 		_vm->playAnimation("reptalk", 0, 6, 26, 51, 0, 150);
@@ -6435,7 +6435,7 @@ void GameLogic::r28_handleRoomEvent2() {
 	}
 	_vm->waitSeconds(1);
 	_vm->_isTextVisible = false;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 int GameLogic::r29_handleVerbPickUp() {
@@ -6940,17 +6940,17 @@ void GameLogic::r31_handleRoomEvent5() {
 	_vm->refreshInventory(false);
 	_vm->setWaynePosition(237, 51);
 	_r30_flags |= 0x04;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_vm->walkTo(230, 140, 0, _vm->_garthSpriteX, _vm->_garthSpriteY);
 	_vm->displayText("c04", 164, 0, -1, -1, 0);
 	_vm->waitSeconds(2);
 	_vm->_currentActorNum = 0;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_vm->displayText("c04", 165, 0, -1, -1, 0);
 	_vm->_currentActorNum = 1;
 	_vm->waitSeconds(2);
 	_vm->_isTextVisible = false;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_r30_flags |= 0x01;
 	_vm->_roomChangeCtr = 0;
 	_vm->setWaynePosition(208, 75);
@@ -7014,7 +7014,7 @@ void GameLogic::r31_displayCategories() {
 		delete categoryImage;
 		_vm->waitSeconds(3);
 	}
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_vm->drawInterface(_vm->_verbNumber);
 	CursorMan.showMouse(true);
 }
@@ -7331,13 +7331,13 @@ int GameLogic::r34_handleVerbPickUp() {
 		_r34_flags &= ~0x08;
 		_vm->moveObjectToRoom(kObjectIdInventoryLunchBox, 99);
 		_vm->refreshInventory(false);
-		_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		_vm->loadRoomBackground();
 		break;
 	case kObjectIdPasscard:
 		_r34_flags |= 0x01;
 		_vm->moveObjectToRoom(kObjectIdInventoryPassCard, 99);
 		_vm->refreshInventory(false);
-		_vm->loadRoomBackground(_vm->_currentRoomNumber);
+		_vm->loadRoomBackground();
 		break;
 	default:
 		actionTextIndex = 0;
@@ -7360,12 +7360,12 @@ int GameLogic::r34_handleVerbUse() {
 			_vm->moveObjectToNowhere(kObjectIdInventoryLunchBox);
 			_r34_flags |= 0x08;
 			_vm->refreshInventory(false);
-			_vm->loadRoomBackground(_vm->_currentRoomNumber);
+			_vm->loadRoomBackground();
 		} else if (_vm->_firstObjectNumber == kObjectIdInventoryPassCard) {
 			_vm->moveObjectToNowhere(kObjectIdInventoryPassCard);
 			_r34_flags &= ~0x01;
 			_vm->refreshInventory(false);
-			_vm->loadRoomBackground(_vm->_currentRoomNumber);
+			_vm->loadRoomBackground();
 		} else {
 			actionTextIndex = 0;
 		}
@@ -7401,7 +7401,7 @@ int GameLogic::r34_handleVerbOpen() {
 			actionTextIndex = 1;
 		} else {
 			_r34_flags |= 0x02;
-			_vm->loadRoomBackground(_vm->_currentRoomNumber);
+			_vm->loadRoomBackground();
 		}
 		break;
 	default:
@@ -7419,7 +7419,7 @@ int GameLogic::r34_handleVerbClose() {
 			actionTextIndex = 1;
 		} else {
 			_r34_flags &= ~0x02;
-			_vm->loadRoomBackground(_vm->_currentRoomNumber);
+			_vm->loadRoomBackground();
 		}
 		break;
 	default:
@@ -8154,7 +8154,7 @@ void GameLogic::r37_pushPullLock(bool isPull) {
 		_r37_safeCombinationIndex = 0;
 		_r37_flags |= 0x02;
 	}
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r37_pullHandle() {
@@ -8165,7 +8165,7 @@ void GameLogic::r37_pullHandle() {
 	_vm->moveObjectToRoom(kObjectIdMagazines, 37);
 	_vm->moveObjectToRoom(kObjectIdKeys, 37);
 	_vm->moveObjectToRoom(kObjectIdMoney, 37);
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r37_handleRoomEvent() {
@@ -8364,7 +8364,7 @@ void GameLogic::r38_pullRag() {
 	_vm->setWaynePosition(126, 137);
 	_vm->setGarthPosition(209, 132);
 	_vm->_actorSpriteValue = 5;
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_vm->displayTextLines("c04r", 344, 180, 35, 5);
 }
 
@@ -8447,7 +8447,7 @@ void GameLogic::r39_useSquirtGunWithHinges() {
 		_vm->_garthSpriteX = -1;
 		_r39_flags |= 0x08;
 	}
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 	_vm->playAnimation("shoot", 0, 14, 108, 49, 0, 100);
 	_r39_flags |= 0x02;
 	_vm->moveObjectToNowhere(kObjectIdDoor39);
@@ -8461,7 +8461,7 @@ void GameLogic::r39_useSquirtGunWithHinges() {
 	} else {
 		_vm->_garthSpriteX = oldSpriteX;
 	}
-	_vm->loadRoomBackground(_vm->_currentRoomNumber);
+	_vm->loadRoomBackground();
 }
 
 void GameLogic::r39_useExit39() {
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index da5d33c3831..f237fe627da 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -1046,7 +1046,7 @@ void WaynesWorldEngine::pickupObject(int objectId, byte &flags, byte flagsSet, i
     flags |= flagsSet;
     moveObjectToRoom(inventoryObjectId, 99);
     refreshInventory(false);
-    loadRoomBackground(_currentRoomNumber);
+    loadRoomBackground();
 }
 
 void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int count, int x, int y, int flag, uint ticks) {
@@ -1091,9 +1091,9 @@ void WaynesWorldEngine::openRoomLibrary(int roomNum) {
     _roomName = Common::String::format("r%02d", roomNum);
 }
 
-void WaynesWorldEngine::loadRoomBackground(int roomNum) {
+void WaynesWorldEngine::loadRoomBackground() {
     drawRoomImageToSurface("backg", _backgroundSurface, 0, 0);
-    refreshRoomBackground(roomNum);
+    refreshRoomBackground(_currentRoomNumber);
     refreshActors();
 }
 
@@ -1110,7 +1110,7 @@ void WaynesWorldEngine::changeRoom(int roomNum) {
     _actorSpriteValue = 0;
     _currentRoomNumber = roomNum;
     _roomChangeCtr++;
-    loadRoomBackground(roomNum);
+    loadRoomBackground();
 }
 
 void WaynesWorldEngine::refreshRoomBackground(int roomNum) {
@@ -1656,7 +1656,7 @@ void WaynesWorldEngine::handleVerbTalkTo() {
         } else {
             _currentActorNum = 0;
         }
-        loadRoomBackground(_currentRoomNumber);
+        loadRoomBackground();
         displayText("c11", actionTextIndex, 0, -1, -1, 0);
         if (_currentActorNum != 0) {
             _currentActorNum = 1;
@@ -1665,7 +1665,7 @@ void WaynesWorldEngine::handleVerbTalkTo() {
         }
         waitSeconds(2);
         _isTextVisible = false;
-        loadRoomBackground(_currentRoomNumber);
+        loadRoomBackground();
         if (room1Special) {
             // TODO r1_handleRoomEvent(true);
         }
@@ -1894,7 +1894,7 @@ void WaynesWorldEngine::extremeCloseUpHandleMouseClick() {
     _screen->clear(0);
     paletteFadeIn(0, 256, 16);
     drawInterface(_verbNumber);
-    loadRoomBackground(_currentRoomNumber);
+    loadRoomBackground();
     // sysMouseDriver(1);
 }
 
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 1d66b70a79d..adb442f725a 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -295,7 +295,7 @@ public:
 
 	// Room
 	void openRoomLibrary(int roomNum);
-	void loadRoomBackground(int roomNum);
+	void loadRoomBackground();
 	void changeRoom(int roomNum);
 	void refreshRoomBackground(int roomNum);
 	void handleRoomEvent();


Commit: 64709f0689c60f2723186d3d2aec9ed29489ea96
    https://github.com/scummvm/scummvm/commit/64709f0689c60f2723186d3d2aec9ed29489ea96
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:51+01:00

Commit Message:
WAYNESWORLD: Fix out of bounds write in pathfinding when no points were found

Changed paths:
    engines/waynesworld/pathfinding.cpp


diff --git a/engines/waynesworld/pathfinding.cpp b/engines/waynesworld/pathfinding.cpp
index 32557b72681..48970e423ea 100644
--- a/engines/waynesworld/pathfinding.cpp
+++ b/engines/waynesworld/pathfinding.cpp
@@ -462,14 +462,18 @@ bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction
         }
     }
 
-    if (direction != -1) {
-        actor1Points[actor1PointsCount - 1].direction = direction;
+    if (direction == -1) {
+        if (actor1PointsCount > 0) {
+            direction = actor1Points[actor1PointsCount - 1].direction;
+        } else {
+            direction = 0;
+        }
     }
 
     if (_currentActorNum != 0) {
-        drawActors(actor1Points[actor1PointsCount - 1].direction, 1, 1, 0, actor1_destX - _from_x1, actor1_destY, actor2WalkDestX - _from_x1, actor2WalkDestY);
+        drawActors(direction, 1, 1, 0, actor1_destX - _from_x1, actor1_destY, actor2WalkDestX - _from_x1, actor2WalkDestY);
     } else {
-        drawActors(actor1Points[actor1PointsCount - 1].direction, 1, 1, 0, actor2WalkDestX - _from_x1, actor2WalkDestY, actor1_destX - _from_x1, actor1_destY);
+        drawActors(direction, 1, 1, 0, actor2WalkDestX - _from_x1, actor2WalkDestY, actor1_destX - _from_x1, actor1_destY);
     }
 
     // TODO


Commit: 8825adb85b292a1a8ce7173274d948515515cf68
    https://github.com/scummvm/scummvm/commit/8825adb85b292a1a8ce7173274d948515515cf68
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:51+01:00

Commit Message:
WAYNESWORLD: Implement room background scrolling

Changed paths:
    engines/waynesworld/pathfinding.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/pathfinding.cpp b/engines/waynesworld/pathfinding.cpp
index 48970e423ea..54b6b1032eb 100644
--- a/engines/waynesworld/pathfinding.cpp
+++ b/engines/waynesworld/pathfinding.cpp
@@ -433,28 +433,29 @@ bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction
 
     for (int pointIndex = 0, walkIncr = 0; pointIndex < actor1PointsCount || pointIndex < actor2PointsCount; pointIndex += 2, walkIncr += 2) {
         int scale = 0;
-        if (_word_306DD > 0) {
-            // TODO scrollRoom(false);
+        if (_scrollRemaining > 0) {
+            scrollRoom();
         }
         if (pointIndex < actor2PointsCount && pointIndex < actor1PointsCount) {
-            scale = drawActors(actor1Points[pointIndex].direction, 0, 0, (walkIncr % 8) / 2, _wayneWalkPoints[pointIndex].x - _from_x1, _wayneWalkPoints[pointIndex].y, _garthWalkPoints[pointIndex].x - _from_x1, _garthWalkPoints[pointIndex].y);
+            scale = drawActors(actor1Points[pointIndex].direction, 0, 0, (walkIncr % 8) / 2, _wayneWalkPoints[pointIndex].x - _scrollPosition, _wayneWalkPoints[pointIndex].y, _garthWalkPoints[pointIndex].x - _scrollPosition, _garthWalkPoints[pointIndex].y);
         } else if (pointIndex < actor1PointsCount) {
             if (flag1 == 0) {
-                scale = drawActors(actor1Points[pointIndex].direction, 0, 1, (walkIncr % 8) / 2, _wayneWalkPoints[pointIndex].x - _from_x1, _wayneWalkPoints[pointIndex].y, _garthSpriteX, _garthSpriteY);
+                scale = drawActors(actor1Points[pointIndex].direction, 0, 1, (walkIncr % 8) / 2, _wayneWalkPoints[pointIndex].x - _scrollPosition, _wayneWalkPoints[pointIndex].y, _garthSpriteX, _garthSpriteY);
             } else {
-                scale = drawActors(actor1Points[pointIndex].direction, 1, 0, (walkIncr % 8) / 2, _wayneSpriteX, _wayneSpriteY, _garthWalkPoints[pointIndex].x - _from_x1, _garthWalkPoints[pointIndex].y);            
+                scale = drawActors(actor1Points[pointIndex].direction, 1, 0, (walkIncr % 8) / 2, _wayneSpriteX, _wayneSpriteY, _garthWalkPoints[pointIndex].x - _scrollPosition, _garthWalkPoints[pointIndex].y);            
             }
         } else {
             if (flag2 == 0) {
-                scale = drawActors(actor2Points[pointIndex].direction, 0, 1, (walkIncr % 8) / 2, _wayneWalkPoints[pointIndex].x - _from_x1, _wayneWalkPoints[pointIndex].y, _garthSpriteX, _garthSpriteY);
+                scale = drawActors(actor2Points[pointIndex].direction, 0, 1, (walkIncr % 8) / 2, _wayneWalkPoints[pointIndex].x - _scrollPosition, _wayneWalkPoints[pointIndex].y, _garthSpriteX, _garthSpriteY);
             } else {
-                scale = drawActors(actor2Points[pointIndex].direction, 1, 0, (walkIncr % 8) / 2, _wayneSpriteX, _wayneSpriteY, _garthWalkPoints[pointIndex].x - _from_x1, _garthWalkPoints[pointIndex].y);            
+                scale = drawActors(actor2Points[pointIndex].direction, 1, 0, (walkIncr % 8) / 2, _wayneSpriteX, _wayneSpriteY, _garthWalkPoints[pointIndex].x - _scrollPosition, _garthWalkPoints[pointIndex].y);
             }
         }
-        if (_inventoryItemsCount == 0 && _from_x1 == 0) {
-            waitMillis(10000 / (scale * scale) * 10);
-        }
-        if (_word_306DD == 0) {
+        // if (_inventoryItemsCount == 0 && _scrollPosition == 0) {
+        //     waitMillis(10000 / (scale * scale) * 10);
+        // }
+        waitMillis(100); // TODO Fix this
+        if (_scrollRemaining == 0) {
             // TOOD
             // if (updateGame()) {
             //     return true;
@@ -471,16 +472,17 @@ bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction
     }
 
     if (_currentActorNum != 0) {
-        drawActors(direction, 1, 1, 0, actor1_destX - _from_x1, actor1_destY, actor2WalkDestX - _from_x1, actor2WalkDestY);
+        drawActors(direction, 1, 1, 0, actor1_destX - _scrollPosition, actor1_destY, actor2WalkDestX - _scrollPosition, actor2WalkDestY);
     } else {
-        drawActors(direction, 1, 1, 0, actor2WalkDestX - _from_x1, actor2WalkDestY, actor1_destX - _from_x1, actor1_destY);
+        drawActors(direction, 1, 1, 0, actor2WalkDestX - _scrollPosition, actor2WalkDestY, actor1_destX - _scrollPosition, actor1_destY);
     }
 
-    // TODO
     // Finish background scrolling
-    // while (_word_306DD > 0) {
-    //     scrollRoom(true);
-    // }
+    while (_scrollRemaining > 0) {
+        scrollRoom();
+        drawActors(_actorSpriteValue, 1, 1, 0, _wayneSpriteX, _wayneSpriteY, _garthSpriteX, _garthSpriteY);
+        waitMillis(50);
+    }
 
     return true;
 }
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index f237fe627da..12d3fe24932 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -85,6 +85,7 @@ Common::Error WaynesWorldEngine::run() {
 	_backgroundSurface = new WWSurface(320, 150);
 	_inventorySprite = new WWSurface(312, 52);
 	_walkMap = new byte[kWalkMapSize];
+	_backgroundScrollSurface = nullptr;
 
 	_fontWW = new GFTFont();
 	_fontWWInv = new GFTFont();
@@ -116,7 +117,7 @@ Common::Error WaynesWorldEngine::run() {
 	_isTextVisible = false;
 	_currentTextX = -1;
 	_currentTextY = -1;
-	_from_x1 = 0;
+	_scrollPosition = 0;
 	_selectedDialogChoice = 0;
 	_gameState = 7;
 	_currentMapItemIndex = -1;
@@ -148,7 +149,7 @@ Common::Error WaynesWorldEngine::run() {
 	drawInterface(2);
 	// changeRoom(0);
 	// _wayneSpriteX = -1; _garthSpriteX = -1;
-	changeRoom(38); // DEBUG
+	changeRoom(32); // DEBUG
 	// _logic->_r1_eventFlag = 1;
 	// _logic->_r1_eventCtr = 3;
 
@@ -187,6 +188,7 @@ Common::Error WaynesWorldEngine::run() {
 	delete _fontWWInv;
 	delete _fontBit5x7;
 
+	delete _backgroundScrollSurface;
 	delete[] _walkMap;
 	delete _inventorySprite;
 	delete _backgroundSurface;
@@ -939,7 +941,7 @@ int WaynesWorldEngine::drawActors(int direction, int wayneKind, int garthKind, i
                 wayneSprite->scaleSurface(_wayneReachLeftSprite);
             }
         }
-        if (_from_x1 == 0) {
+        if (_scrollPosition == 0) {
             drawStaticRoomObjects(_currentRoomNumber, wayneX, wayneY, wayneHeight, wayneWidth, wayneSprite);
         }
     }
@@ -962,7 +964,7 @@ int WaynesWorldEngine::drawActors(int direction, int wayneKind, int garthKind, i
                 garthSprite->scaleSurface(_garthReachLeftSprite);
             }
         }
-        if (_from_x1 == 0) {
+        if (_scrollPosition == 0) {
             drawStaticRoomObjects(_currentRoomNumber, garthX, garthY, garthHeight, garthWidth, garthSprite);
         }
     }
@@ -994,7 +996,7 @@ int WaynesWorldEngine::drawActors(int direction, int wayneKind, int garthKind, i
         }
     }
 
-    if (_from_x1 != 0) {
+    if (_scrollPosition != 0) {
         // drawStaticRoomObjects2(tempBackground);
     }
 
@@ -1126,11 +1128,165 @@ void WaynesWorldEngine::handleRoomEvent() {
 }
 
 void WaynesWorldEngine::changeRoomScrolling() {
-	// TODO
+    int roomNumber = -1;
+    _scrollPosition = 0;
+    _scrollWidth = 0;
+    _scrollRemaining = 0;
+    switch (_currentRoomNumber) {
+    case 14:
+        roomNumber = 19;
+        break;
+    case 19:
+        roomNumber = 14;
+        break;
+    case 8:
+        if (_currentActorNum != 0) {
+            _garthSpriteX = 319;
+            _garthSpriteY = 131;
+        } else {
+            _wayneSpriteX = 319;
+            _wayneSpriteY = 131;
+        }
+        roomNumber = 21;
+        break;
+    case 22:
+        if (_currentActorNum != 0) {
+            _garthSpriteX = 2;
+            _garthSpriteY = 131;
+        } else {
+            _wayneSpriteX = 2;
+            _wayneSpriteY = 131;
+        }
+        roomNumber = 21;
+        break;
+    case 21:
+        if (_hoverObjectNumber == kObjectIdFoyer) {
+            if (_currentActorNum != 0) {
+                _garthSpriteX = 5;
+                _garthSpriteY = 130;
+            } else {
+                _wayneSpriteX = 5;
+                _wayneSpriteY = 130;
+            }
+            roomNumber = 8;
+        } else {
+            if (_currentActorNum != 0) {
+                _garthSpriteX = 319;
+                _garthSpriteY = 131;
+            } else {
+                _wayneSpriteX = 319;
+                _wayneSpriteY = 131;
+            }
+            roomNumber = 22;
+        }
+        break;
+    case 32:
+        roomNumber = 33;
+        break;
+    case 33:
+        roomNumber = 32;
+        break;
+    }
+    unloadStaticRoomObjects();
+    openRoomLibrary(roomNumber);
+    loadRoomMask(roomNumber);
+    loadStaticRoomObjects(roomNumber);
+    _currentRoomNumber = roomNumber;
 }
 
 void WaynesWorldEngine::loadScrollSprite() {
-	// TODO
+    if (_currentRoomNumber == 14 && _hoverObjectNumber == kObjectIdLoadingDock) {
+        _backgroundScrollSurface = new WWSurface(112, 150);
+        drawRoomImageToSurface("scroll", _backgroundScrollSurface, 0, 0);
+        if ((_logic->_r1_flags1 & 0x10) && !(_logic->_pizzathonListFlags1 & 0x04)) {
+            drawRoomImageToSurface("gill0", _backgroundScrollSurface, 65, 84);
+        }
+        _scrollRemaining = 112;
+        _scrollWidth = 112;
+        _doScrollRight = true;
+    } else if (_currentRoomNumber == 19 && _hoverObjectNumber == kObjectIdStore) {
+        _backgroundScrollSurface = new WWSurface(112, 150);
+        drawImageToSurface("r14/backg", _backgroundScrollSurface, 0, 0);
+        _scrollRemaining = 112;
+        _scrollWidth = 112;
+        _doScrollRight = false;
+    } else if (_currentRoomNumber == 8 && _hoverObjectNumber == kObjectIdHallway8) {
+        stopRoomAnimations();
+        _backgroundScrollSurface = new WWSurface(320, 150);
+        drawImageToSurface("r21/backg", _backgroundScrollSurface, 0, 0);
+        _scrollRemaining = 320;
+        _scrollWidth = 320;
+        _doScrollRight = false;
+    } else if (_currentRoomNumber == 21 && _hoverObjectNumber == kObjectIdFoyer) {
+        _backgroundScrollSurface = new WWSurface(320, 150);
+        drawImageToSurface("r08/backg", _backgroundScrollSurface, 0, 0);
+        _scrollRemaining = 320;
+        _scrollWidth = 320;
+        _doScrollRight = true;
+    } else if (_currentRoomNumber == 21 && _hoverObjectNumber == kObjectIdOffice21) {
+        _backgroundScrollSurface = new WWSurface(320, 150);
+        drawImageToSurface("r22/backg", _backgroundScrollSurface, 0, 0);
+        _scrollRemaining = 320;
+        _scrollWidth = 320;
+        _doScrollRight = false;
+    } else if (_currentRoomNumber == 22 && _hoverObjectNumber == kObjectIdHallway22) {
+        _backgroundScrollSurface = new WWSurface(320, 150);
+        drawImageToSurface("r21/backg", _backgroundScrollSurface, 0, 0);
+        _scrollRemaining = 320;
+        _scrollWidth = 320;
+        _doScrollRight = true;
+    } else if (_currentRoomNumber == 32 && _hoverObjectNumber == kObjectIdOffice) {
+        if (!(_logic->_r32_flags & 0x04)) {
+            displayTextLines("c04r", 452, 300, 20, 1);
+            _scrollPosition = 0;
+        } else {
+            walkTo(150, 140, 6, 160, 140);
+            stopRoomAnimations();
+            _backgroundScrollSurface = new WWSurface(168, 150);
+            drawImageToSurface("r33/backg", _backgroundScrollSurface, 0, 0);
+            _scrollRemaining = 168;
+            _scrollWidth = 168;
+            _doScrollRight = false;
+        }
+    } else if (_currentRoomNumber == 33 && _hoverObjectNumber == kObjectIdHallway33) {
+        _backgroundScrollSurface = new WWSurface(168, 150);
+        drawRoomImageToSurface("scroll", _backgroundScrollSurface, 0, 0);
+        if (_logic->_r32_flags & 0x02) {
+            drawRoomImageToSurface("noplunge", _backgroundScrollSurface, 141, 94);
+        }
+        _scrollRemaining = 168;
+        _scrollWidth = 168;
+        _doScrollRight = true;
+    } else {
+        _scrollPosition = 0;
+    }
+}
+
+void WaynesWorldEngine::scrollRoom() {
+	const int kScrollStripWidth = 8;
+	int stripSourceX, stripDestX;
+	if (_doScrollRight) {
+		_scrollPosition = _scrollWidth - _scrollRemaining;
+		_backgroundSurface->move(-kScrollStripWidth, 0, _backgroundSurface->h);
+		stripSourceX = _scrollPosition;
+		stripDestX = 320 - kScrollStripWidth;
+		_wayneSpriteX -= kScrollStripWidth;
+		_garthSpriteX -= kScrollStripWidth;
+	} else {
+		_scrollPosition = _scrollRemaining - _scrollWidth;
+		_backgroundSurface->move(kScrollStripWidth, 0, _backgroundSurface->h);
+		stripSourceX = _scrollWidth + _scrollPosition - kScrollStripWidth;
+		stripDestX = 0;
+		_wayneSpriteX += kScrollStripWidth;
+		_garthSpriteX += kScrollStripWidth;
+	}
+	Graphics::Surface scrollStripSurface = _backgroundScrollSurface->getSubArea(Common::Rect(stripSourceX, 0, stripSourceX + kScrollStripWidth, 150));
+	_backgroundSurface->drawSurface(&scrollStripSurface, stripDestX, 0);
+	_scrollRemaining -= kScrollStripWidth;
+	if (_scrollRemaining <= 0) {
+		delete _backgroundScrollSurface;
+		_backgroundScrollSurface = nullptr;
+	}
 }
 
 void WaynesWorldEngine::loadRoomMask(int roomNum) {
@@ -1453,7 +1609,7 @@ void WaynesWorldEngine::handleVerb(int verbFlag) {
         break;
     }
 
-    if (_word_306DB != 0) {
+    if (_scrollWidth != 0) {
         changeRoomScrolling();
     }
 
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index adb442f725a..79ff07f6847 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -122,6 +122,7 @@ public:
 	byte _palette2[768];
 	Screen *_screen;
 	WWSurface *_backgroundSurface;
+	WWSurface *_backgroundScrollSurface;
 	GFTFont *_fontWW;
 	GFTFont *_fontWWInv;
 	GFTFont *_fontBit5x7;
@@ -130,10 +131,10 @@ public:
 	// Room
 	Common::String _roomName;
 	byte *_walkMap;
-	int _word_306DB;
-	int _word_306DD;
+	int _scrollWidth;
+	int _scrollRemaining;
 	int _roomChangeCtr;
-	int _from_x1;
+	int _scrollPosition;
 	bool _doScrollRight;
 	bool _hasRoomAnimationCallback;
 
@@ -301,6 +302,7 @@ public:
 	void handleRoomEvent();
 	void changeRoomScrolling();
 	void loadScrollSprite();
+	void scrollRoom();
 	void loadRoomMask(int roomNum);
 	void fillRoomMaskArea(int x1, int y1, int x2, int y2, int enabled);
 


Commit: 802ee049f6f42adaef1f921e283d21ffdf772363
    https://github.com/scummvm/scummvm/commit/802ee049f6f42adaef1f921e283d21ffdf772363
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:51+01:00

Commit Message:
WAYNESWORLD: Fix actor scaling in room 6

Changed paths:
    engines/waynesworld/gamelogic.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 58e432eabfb..4bf9067f1d6 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -1019,7 +1019,7 @@ int GameLogic::getActorScaleFromY(int actorY) {
 		scale = actorY;
 		break;
 	case 6:
-		scale = actorY / 3 - 91;
+		scale = actorY + actorY / 3 - 91;
 		break;
 	case 7:
 		scale = actorY - 41;


Commit: 4c1f5cd75daab4f8f5e4d6747ce33a90db356c57
    https://github.com/scummvm/scummvm/commit/4c1f5cd75daab4f8f5e4d6747ce33a90db356c57
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:51+01:00

Commit Message:
WAYNESWORLD: Add screen effects

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/graphics.cpp
    engines/waynesworld/graphics.h
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 4bf9067f1d6..23b62009e33 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -6998,19 +6998,12 @@ void GameLogic::r31_useBuzzer() {
 void GameLogic::r31_displayCategories() {
 	CursorMan.showMouse(false);
 	WWSurface *screenImage = _vm->loadRoomSurface("screen");
-	// TODO fxSetDelay(0);
-	// TODO fxSetGrain(4, 4, 1);
-	// TODO fxSetEffect(8); // Spiral Effect
-	// TODO fxVirtualDisplay(screenImage, 0, 0, 0, 0, 319, 199, 1);
-	_vm->_screen->drawSurface(screenImage, 0, 0); // TODO Until effects drawing is done
+	_vm->drawSpiralEffect(screenImage, 0, 0, 4, 4);
 	delete screenImage;
 	for (int categoryIndex = 0; categoryIndex < 5; categoryIndex++) {
 		Common::String categoryFilename = Common::String::format("cat%d", categoryIndex);
 		WWSurface *categoryImage = _vm->loadRoomSurface(categoryFilename.c_str());
-		// TODO fxSetGrain(1, 1, 1);
-		// TODO fxSetEffect(5); // Random Effect
-		// TODO fxVirtualDisplay(categoryImage, 0, 0, 17, 61, 300, 140, 0);
-		_vm->_screen->drawSurface(categoryImage, 17, 61); // TODO Until effects drawing is done
+		_vm->drawRandomEffect(categoryImage, 17, 61, 1, 1);
 		delete categoryImage;
 		_vm->waitSeconds(3);
 	}
diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
index c2bb4a2e777..141a2ad07a7 100644
--- a/engines/waynesworld/graphics.cpp
+++ b/engines/waynesworld/graphics.cpp
@@ -314,4 +314,104 @@ void Screen::updateScreen() {
 	g_system->updateScreen();
 }
 
+// ScreenEffect
+
+// TODO Currently effects are quite slow because the screen is updated for each block.
+// Add beginUpdate/endUpdate to Screen class and only update each X blocks.
+
+ScreenEffect::ScreenEffect(WaynesWorldEngine *vm, Graphics::Surface *surface, int x, int y, int grainWidth, int grainHeight)
+	: _vm(vm), _surface(surface), _x(x), _y(y), _grainWidth(grainWidth), _grainHeight(grainHeight) {
+    _blockCountW = _surface->w / _grainWidth + (_surface->w % _grainWidth > 0 ? 1 : 0);
+	_blockCountH = _surface->h / _grainHeight + (_surface->h % _grainHeight > 0 ? 1 : 0);
+}
+
+void ScreenEffect::drawSpiralEffect() {
+	int middleBlockW = _blockCountW / 2 + (_blockCountW % 2 > 0 ? 1 : 0);
+	int middleBlockH = _blockCountH / 2 + (_blockCountH % 2 > 0 ? 1 : 0);
+	int startBlock = (middleBlockW < middleBlockH ? middleBlockW : middleBlockH) - 1;
+	int sideLenW = _blockCountW - startBlock;
+	int sideLenH = _blockCountH - startBlock;
+	while (startBlock >= 0 && !_vm->shouldQuit()) {
+		int blockX, blockY;
+		blockX = startBlock;
+		blockY = startBlock;
+		while (++blockX < sideLenW) {
+			drawBlock(blockX, blockY);
+		}
+		blockX = sideLenW - 1;
+		blockY = startBlock;
+		while (++blockY < sideLenH) {
+			drawBlock(blockX, blockY);
+		}
+		blockX = sideLenW - 1;
+		blockY = sideLenH - 1;
+		while (--blockX >= startBlock) {
+			drawBlock(blockX, blockY);
+		}
+		blockX = startBlock;
+		blockY = sideLenH;
+		while (--blockY >= startBlock) {
+			drawBlock(blockX, blockY);
+		}
+		sideLenW++;
+		sideLenH++;
+		startBlock--;
+	}
+}
+
+void ScreenEffect::drawRandomEffect() {
+	uint bitCountW = getBitCount(_blockCountW);
+	uint bitCountH = getBitCount(_blockCountH);
+	uint bitCount = bitCountW + bitCountH;
+	uint mask = (1 << bitCountW) - 1;
+	uint rvalue = getSeed(bitCount), value = 1;
+	do {
+		int blockX = value & mask;
+		int blockY = value >> bitCountW;
+		drawBlock(blockX, blockY);
+		if (value & 1) {
+			value >>= 1;
+			value ^= rvalue;
+		} else {
+			value >>= 1;
+		}
+	} while (value != 1 && !_vm->shouldQuit());
+	drawBlock(0, 0);
+}
+
+void ScreenEffect::drawBlock(int blockX, int blockY) {
+	if (blockX < _blockCountW && blockY < _blockCountH) {
+		int sourceLeft = blockX * _grainWidth, sourceTop = blockY * _grainHeight;
+		int sourceRight = sourceLeft + _grainWidth, sourceBottom = sourceTop + _grainHeight;
+		sourceRight = MIN<int>(_surface->w, sourceRight);
+		sourceBottom = MIN<int>(_surface->h, sourceBottom);
+		Common::Rect r(sourceLeft, sourceTop, sourceRight, sourceBottom);
+		Graphics::Surface blockSurface = _surface->getSubArea(r);
+		_vm->_screen->drawSurface(&blockSurface, _x + sourceLeft, _y + sourceTop);
+		_vm->updateEvents();
+	}
+}
+
+uint ScreenEffect::getBitCount(int value) const {
+	int bitCount = 0;
+	while ((value >> bitCount) != 0) {
+		bitCount++;
+	}
+	return bitCount;
+}
+
+uint ScreenEffect::getSeed(uint bitCount) const {
+	// Only used values are implemented
+	switch (bitCount) {
+	case 13:
+		return 0x3500;
+	case 15:
+		return 0xB400;
+	case 16:
+		return 0x12000;
+	default:
+		return 1;
+	}
+}
+
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/graphics.h b/engines/waynesworld/graphics.h
index 871f19297b0..27c9b0f4af1 100644
--- a/engines/waynesworld/graphics.h
+++ b/engines/waynesworld/graphics.h
@@ -23,6 +23,7 @@
 #ifndef WAYNESWORLD_GRAPHICS_H
 #define WAYNESWORLD_GRAPHICS_H
 
+#include "waynesworld/waynesworld.h"
 #include "graphics/surface.h"
 
 namespace WaynesWorld {
@@ -77,6 +78,22 @@ protected:
 	void updateScreen();
 };
 
+class ScreenEffect {
+public:
+	ScreenEffect(WaynesWorldEngine *vm, Graphics::Surface *surface, int x, int y, int grainWidth, int grainHeight);
+	void drawSpiralEffect();
+	void drawRandomEffect();
+protected:
+	WaynesWorldEngine *_vm;
+	Graphics::Surface *_surface;
+	int _x, _y;
+	int _grainWidth, _grainHeight;
+	int _blockCountW, _blockCountH;
+	void drawBlock(int blockX, int blockY);
+	uint getBitCount(int value) const;
+	uint getSeed(uint bitCount) const;
+};
+
 } // End of namespace WaynesWorld
 
 #endif // WAYNESWORLD_GRAPHICS_H
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 12d3fe24932..37e23a07fa7 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -148,8 +148,9 @@ Common::Error WaynesWorldEngine::run() {
 
 	drawInterface(2);
 	// changeRoom(0);
-	// _wayneSpriteX = -1; _garthSpriteX = -1;
-	changeRoom(32); // DEBUG
+	_wayneSpriteX = -1; _garthSpriteX = -1;
+	changeRoom(31); // DEBUG
+	_logic->r31_displayCategories();
 	// _logic->_r1_eventFlag = 1;
 	// _logic->_r1_eventCtr = 3;
 
@@ -592,6 +593,16 @@ void WaynesWorldEngine::drawRoomImageToSurface(const char *filename, WWSurface *
     drawImageToSurfaceIntern(filename, destSurface, x, y, false, true);
 }
 
+void WaynesWorldEngine::drawSpiralEffect(Graphics::Surface *surface, int x, int y, int grainWidth, int grainHeight) {
+	ScreenEffect screenEffect(this, surface, x, y, grainWidth, grainHeight);
+	screenEffect.drawSpiralEffect();
+}
+
+void WaynesWorldEngine::drawRandomEffect(Graphics::Surface *surface, int x, int y, int grainWidth, int grainHeight) {
+	ScreenEffect screenEffect(this, surface, x, y, grainWidth, grainHeight);
+	screenEffect.drawRandomEffect();
+}
+
 Common::String WaynesWorldEngine::loadString(const char *filename, int index, int flag) {
 	const uint kMaxStringLen = 60;
 	char textBuffer[kMaxStringLen];
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 79ff07f6847..46d2d8fe645 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -245,6 +245,9 @@ public:
 	void drawRoomImageToScreen(const char *filename, int x, int y);
 	void drawRoomImageToSurface(const char *filename, WWSurface *destSurface, int x, int y);
 
+	void drawSpiralEffect(Graphics::Surface *surface, int x, int y, int grainWidth, int grainHeight);
+	void drawRandomEffect(Graphics::Surface *surface, int x, int y, int grainWidth, int grainHeight);
+
 	// Text
 	Common::String loadString(const char *filename, int index, int flag);
 	void drawCurrentTextToSurface(WWSurface *destSurface, int x, int y);


Commit: dfe0e27e21e7cd0ae58bcf34725ccedfb3766d61
    https://github.com/scummvm/scummvm/commit/dfe0e27e21e7cd0ae58bcf34725ccedfb3766d61
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:51+01:00

Commit Message:
WAYNESWORLD: Add Screen::beginUpdate/endUpdate and use it in the screen effects

Changed paths:
    engines/waynesworld/graphics.cpp
    engines/waynesworld/graphics.h


diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
index 141a2ad07a7..57f2dfb94f5 100644
--- a/engines/waynesworld/graphics.cpp
+++ b/engines/waynesworld/graphics.cpp
@@ -260,7 +260,7 @@ int GFTFont::getCharWidth(byte ch) const {
 
 // Screen
 
-Screen::Screen() {
+Screen::Screen() : _lockCtr(0) {
 	_surface = new WWSurface(320, 200);
 }
 
@@ -268,6 +268,19 @@ Screen::~Screen() {
 	delete _surface;
 }
 
+void Screen::beginUpdate() {
+	_lockCtr++;
+}
+
+void Screen::endUpdate() {
+	if (_lockCtr > 0) {
+		--_lockCtr;
+		if (_lockCtr == 0) {
+			updateScreen();
+		}
+	}
+}
+
 void Screen::drawSurface(const Graphics::Surface *surface, int x, int y) {
 	_surface->drawSurface(surface, x, y);
 	updateScreen();
@@ -310,19 +323,19 @@ void Screen::drawWrappedText(GFTFont *font, const char *text, int x, int y, int
 
 void Screen::updateScreen() {
 	// TODO Use dirty rectangles or similar
-	g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 0, 0, _surface->w, _surface->h);
-	g_system->updateScreen();
+	if (_lockCtr == 0) {
+		g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 0, 0, _surface->w, _surface->h);
+		g_system->updateScreen();
+	}
 }
 
 // ScreenEffect
 
-// TODO Currently effects are quite slow because the screen is updated for each block.
-// Add beginUpdate/endUpdate to Screen class and only update each X blocks.
-
 ScreenEffect::ScreenEffect(WaynesWorldEngine *vm, Graphics::Surface *surface, int x, int y, int grainWidth, int grainHeight)
-	: _vm(vm), _surface(surface), _x(x), _y(y), _grainWidth(grainWidth), _grainHeight(grainHeight) {
+	: _vm(vm), _surface(surface), _x(x), _y(y), _grainWidth(grainWidth), _grainHeight(grainHeight), _blockCtr(0) {
     _blockCountW = _surface->w / _grainWidth + (_surface->w % _grainWidth > 0 ? 1 : 0);
 	_blockCountH = _surface->h / _grainHeight + (_surface->h % _grainHeight > 0 ? 1 : 0);
+	_blockUpdateCtr = _blockCountW * _blockCountH / 1000;
 }
 
 void ScreenEffect::drawSpiralEffect() {
@@ -331,6 +344,7 @@ void ScreenEffect::drawSpiralEffect() {
 	int startBlock = (middleBlockW < middleBlockH ? middleBlockW : middleBlockH) - 1;
 	int sideLenW = _blockCountW - startBlock;
 	int sideLenH = _blockCountH - startBlock;
+	_vm->_screen->beginUpdate();
 	while (startBlock >= 0 && !_vm->shouldQuit()) {
 		int blockX, blockY;
 		blockX = startBlock;
@@ -357,6 +371,7 @@ void ScreenEffect::drawSpiralEffect() {
 		sideLenH++;
 		startBlock--;
 	}
+	_vm->_screen->endUpdate();
 }
 
 void ScreenEffect::drawRandomEffect() {
@@ -365,6 +380,7 @@ void ScreenEffect::drawRandomEffect() {
 	uint bitCount = bitCountW + bitCountH;
 	uint mask = (1 << bitCountW) - 1;
 	uint rvalue = getSeed(bitCount), value = 1;
+	_vm->_screen->beginUpdate();
 	do {
 		int blockX = value & mask;
 		int blockY = value >> bitCountW;
@@ -377,6 +393,7 @@ void ScreenEffect::drawRandomEffect() {
 		}
 	} while (value != 1 && !_vm->shouldQuit());
 	drawBlock(0, 0);
+	_vm->_screen->endUpdate();
 }
 
 void ScreenEffect::drawBlock(int blockX, int blockY) {
@@ -389,6 +406,11 @@ void ScreenEffect::drawBlock(int blockX, int blockY) {
 		Graphics::Surface blockSurface = _surface->getSubArea(r);
 		_vm->_screen->drawSurface(&blockSurface, _x + sourceLeft, _y + sourceTop);
 		_vm->updateEvents();
+		// Update the screen only each _blockUpdateCtr blocks
+		if (++_blockCtr % _blockUpdateCtr == 0) {
+			_vm->_screen->endUpdate();
+			_vm->_screen->beginUpdate();
+		}
 	}
 }
 
diff --git a/engines/waynesworld/graphics.h b/engines/waynesworld/graphics.h
index 27c9b0f4af1..d1b11112a2f 100644
--- a/engines/waynesworld/graphics.h
+++ b/engines/waynesworld/graphics.h
@@ -65,6 +65,8 @@ class Screen {
 public:
 	Screen();
 	~Screen();
+	void beginUpdate();
+	void endUpdate();
 	void drawSurface(const Graphics::Surface *surface, int x, int y);
 	void drawSurfaceTransparent(const Graphics::Surface *surface, int x, int y);
 	void frameRect(int x1, int y1, int x2, int y2, byte color);
@@ -75,6 +77,7 @@ public:
 	void drawWrappedText(GFTFont *font, const char *text, int x, int y, int maxWidth, byte color);
 protected:
 	WWSurface *_surface;
+	int _lockCtr;
 	void updateScreen();
 };
 
@@ -89,6 +92,7 @@ protected:
 	int _x, _y;
 	int _grainWidth, _grainHeight;
 	int _blockCountW, _blockCountH;
+	int _blockCtr, _blockUpdateCtr;
 	void drawBlock(int blockX, int blockY);
 	uint getBitCount(int value) const;
 	uint getSeed(uint bitCount) const;


Commit: de041bbbef64044d4e937e9fd1293fab7da675cf
    https://github.com/scummvm/scummvm/commit/de041bbbef64044d4e937e9fd1293fab7da675cf
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:51+01:00

Commit Message:
WAYNESWORLD: Change Screen class to use lockScreen/unlockScreen; Improve ScreenEffects

Changed paths:
    engines/waynesworld/graphics.cpp
    engines/waynesworld/graphics.h


diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
index 57f2dfb94f5..bf059e37fe4 100644
--- a/engines/waynesworld/graphics.cpp
+++ b/engines/waynesworld/graphics.cpp
@@ -27,24 +27,10 @@
 
 namespace WaynesWorld {
 
-// WWSurface
-
-WWSurface::WWSurface(int width, int height) {
-	create(width, height, Graphics::PixelFormat::createFormatCLUT8());
-}
-
-WWSurface::WWSurface(const Graphics::Surface *sourceSurface) {
-	copyFrom(*sourceSurface);
-}
-
-WWSurface::~WWSurface() {
-	free();
-}
-
-void WWSurface::drawSurfaceIntern(const Graphics::Surface *surface, int x, int y, bool transparent) {
+void drawSurfaceIntern(Graphics::Surface *destSurface, const Graphics::Surface *surface, int x, int y, bool transparent) {
 	int width, height, skipX = 0, skipY = 0;
 
-	if (x >= w || y >= h)
+	if (x >= destSurface->w || y >= destSurface->h)
 		return;
 
 	height = surface->h;
@@ -55,8 +41,8 @@ void WWSurface::drawSurfaceIntern(const Graphics::Surface *surface, int x, int y
 		skipY = -y;
 		y = 0;
 	}
-	if (y + height > h)
-		height = h - y;
+	if (y + height > destSurface->h)
+		height = destSurface->h - y;
 
 	width = surface->w;
 	if (x < 0) {
@@ -66,15 +52,15 @@ void WWSurface::drawSurfaceIntern(const Graphics::Surface *surface, int x, int y
 		skipX = -x;
 		x = 0;
 	}
-	if (x + width >= w)
-		width = w - x;
+	if (x + width >= destSurface->w)
+		width = destSurface->w - x;
 
 	// debug(6, "drawSurfaceIntern() (%d, %d, %d, %d); skipX: %d; skipY: %d", x, y, width, height, skipX, skipY);
 
 	if (transparent) {
 		for (int yc = 0; yc < height; ++yc) {
 			const byte *source = (const byte*)surface->getBasePtr(skipX, skipY + yc);
-			byte *dest = (byte*)getBasePtr(x, y + yc);
+			byte *dest = (byte*)destSurface->getBasePtr(x, y + yc);
 			for (int xc = 0; xc < width; ++xc) {
 				byte value = *source++;
 				if (value != 0) {
@@ -86,18 +72,32 @@ void WWSurface::drawSurfaceIntern(const Graphics::Surface *surface, int x, int y
 	} else {
 		for (int yc = 0; yc < height; ++yc) {
 			const byte *source = (const byte*)surface->getBasePtr(skipX, skipY + yc);
-			byte *dest = (byte*)getBasePtr(x, y + yc);
+			byte *dest = (byte*)destSurface->getBasePtr(x, y + yc);
 			memcpy(dest, source, width);
 		}
 	}
 }
 
+// WWSurface
+
+WWSurface::WWSurface(int width, int height) {
+	create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+}
+
+WWSurface::WWSurface(const Graphics::Surface *sourceSurface) {
+	copyFrom(*sourceSurface);
+}
+
+WWSurface::~WWSurface() {
+	free();
+}
+
 void WWSurface::drawSurface(const Graphics::Surface *surface, int x, int y) {
-	drawSurfaceIntern(surface, x, y, false);
+	drawSurfaceIntern(this, surface, x, y, false);
 }
 
 void WWSurface::drawSurfaceTransparent(const Graphics::Surface *surface, int x, int y) {
-	drawSurfaceIntern(surface, x, y, true);
+	drawSurfaceIntern(this, surface, x, y, true);
 }
 
 void WWSurface::scaleSurface(const Graphics::Surface *surface) {
@@ -260,15 +260,16 @@ int GFTFont::getCharWidth(byte ch) const {
 
 // Screen
 
-Screen::Screen() : _lockCtr(0) {
-	_surface = new WWSurface(320, 200);
+Screen::Screen() : _lockCtr(0), _vgaSurface(nullptr) {
 }
 
 Screen::~Screen() {
-	delete _surface;
 }
 
 void Screen::beginUpdate() {
+	if (_lockCtr == 0) {
+		_vgaSurface = g_system->lockScreen();
+	}
 	_lockCtr++;
 }
 
@@ -276,57 +277,59 @@ void Screen::endUpdate() {
 	if (_lockCtr > 0) {
 		--_lockCtr;
 		if (_lockCtr == 0) {
-			updateScreen();
+			g_system->unlockScreen();
+			_vgaSurface = nullptr;
+			g_system->updateScreen();
 		}
 	}
 }
 
 void Screen::drawSurface(const Graphics::Surface *surface, int x, int y) {
-	_surface->drawSurface(surface, x, y);
-	updateScreen();
+	beginUpdate();
+	drawSurfaceIntern(_vgaSurface, surface, x, y, false);
+	endUpdate();
 }
 
 void Screen::drawSurfaceTransparent(const Graphics::Surface *surface, int x, int y) {
-	_surface->drawSurfaceTransparent(surface, x, y);
-	updateScreen();
+	beginUpdate();
+	drawSurfaceIntern(_vgaSurface, surface, x, y, true);
+	endUpdate();
 }
 
 void Screen::frameRect(int x1, int y1, int x2, int y2, byte color) {
-	_surface->frameRect(x1, y1, x2, y2, color);
-	updateScreen();
+	beginUpdate();
+	_vgaSurface->frameRect(Common::Rect(x1, y1, x2, y2), color);
+	endUpdate();
 }
 
 void Screen::fillSquare(int x, int y, int length, byte color) {
-	_surface->fillSquare(x, y, length, color);
-	updateScreen();
+	beginUpdate();
+	_vgaSurface->fillRect(Common::Rect(x, y, x + length, y + length), color);
+	endUpdate();
 }
 
 void Screen::fillRect(int x1, int y1, int x2, int y2, byte color) {
-	_surface->fillRect(x1, y1, x2, y2, color);
-	updateScreen();
+	beginUpdate();
+	_vgaSurface->fillRect(Common::Rect(x1, y1, x2, y2), color);
+	endUpdate();
 }
 
 void Screen::clear(byte color) {
-	_surface->clear(color);
-	updateScreen();
+	beginUpdate();
+	_vgaSurface->fillRect(Common::Rect(_vgaSurface->w, _vgaSurface->h), color);
+	endUpdate();
 }
 
 void Screen::drawText(GFTFont *font, const char *text, int x, int y, byte color) {
-	font->drawText(_surface, text, x, y, color);
-	updateScreen();
+	beginUpdate();
+	font->drawText(_vgaSurface, text, x, y, color);
+	endUpdate();
 }
 
 void Screen::drawWrappedText(GFTFont *font, const char *text, int x, int y, int maxWidth, byte color) {
-	font->drawWrappedText(_surface, text, x, y, maxWidth, color);
-	updateScreen();
-}
-
-void Screen::updateScreen() {
-	// TODO Use dirty rectangles or similar
-	if (_lockCtr == 0) {
-		g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 0, 0, _surface->w, _surface->h);
-		g_system->updateScreen();
-	}
+	beginUpdate();
+	font->drawWrappedText(_vgaSurface, text, x, y, maxWidth, color);
+	endUpdate();
 }
 
 // ScreenEffect
@@ -335,7 +338,10 @@ ScreenEffect::ScreenEffect(WaynesWorldEngine *vm, Graphics::Surface *surface, in
 	: _vm(vm), _surface(surface), _x(x), _y(y), _grainWidth(grainWidth), _grainHeight(grainHeight), _blockCtr(0) {
     _blockCountW = _surface->w / _grainWidth + (_surface->w % _grainWidth > 0 ? 1 : 0);
 	_blockCountH = _surface->h / _grainHeight + (_surface->h % _grainHeight > 0 ? 1 : 0);
-	_blockUpdateCtr = _blockCountW * _blockCountH / 1000;
+	int blockCount = _blockCountW * _blockCountH;
+	int duration = blockCount / 5; // Approximate time this effect should take in ms
+	_timePerSlice = 50; // Time after which the screen should be updated
+	_blocksPerSlice = blockCount / (duration / _timePerSlice);
 }
 
 void ScreenEffect::drawSpiralEffect() {
@@ -344,6 +350,7 @@ void ScreenEffect::drawSpiralEffect() {
 	int startBlock = (middleBlockW < middleBlockH ? middleBlockW : middleBlockH) - 1;
 	int sideLenW = _blockCountW - startBlock;
 	int sideLenH = _blockCountH - startBlock;
+	_totalSliceTicks = g_system->getMillis();
 	_vm->_screen->beginUpdate();
 	while (startBlock >= 0 && !_vm->shouldQuit()) {
 		int blockX, blockY;
@@ -380,6 +387,7 @@ void ScreenEffect::drawRandomEffect() {
 	uint bitCount = bitCountW + bitCountH;
 	uint mask = (1 << bitCountW) - 1;
 	uint rvalue = getSeed(bitCount), value = 1;
+	_totalSliceTicks = g_system->getMillis();
 	_vm->_screen->beginUpdate();
 	do {
 		int blockX = value & mask;
@@ -405,10 +413,19 @@ void ScreenEffect::drawBlock(int blockX, int blockY) {
 		Common::Rect r(sourceLeft, sourceTop, sourceRight, sourceBottom);
 		Graphics::Surface blockSurface = _surface->getSubArea(r);
 		_vm->_screen->drawSurface(&blockSurface, _x + sourceLeft, _y + sourceTop);
-		_vm->updateEvents();
-		// Update the screen only each _blockUpdateCtr blocks
-		if (++_blockCtr % _blockUpdateCtr == 0) {
+		if (++_blockCtr == _blocksPerSlice) {
 			_vm->_screen->endUpdate();
+			uint32 currTicks = g_system->getMillis();
+			_blockCtr = 0;
+			_totalSliceTicks += _timePerSlice;
+			// Check if the system is faster than the current slice ticks
+			// and wait for the difference.
+			if (currTicks < _totalSliceTicks) {
+				uint32 waitTicks = _totalSliceTicks - currTicks;
+				_vm->waitMillis(waitTicks);
+			} else {
+				_vm->updateEvents();
+			}
 			_vm->_screen->beginUpdate();
 		}
 	}
diff --git a/engines/waynesworld/graphics.h b/engines/waynesworld/graphics.h
index d1b11112a2f..75fb0d2f429 100644
--- a/engines/waynesworld/graphics.h
+++ b/engines/waynesworld/graphics.h
@@ -33,7 +33,6 @@ public:
 	WWSurface(int width, int height);
 	WWSurface(const Graphics::Surface *sourceSurface);
 	~WWSurface();
-	void drawSurfaceIntern(const Graphics::Surface *surface, int x, int y, bool transparent);
 	void drawSurface(const Graphics::Surface *surface, int x, int y);
 	void drawSurfaceTransparent(const Graphics::Surface *surface, int x, int y);
 	void scaleSurface(const Graphics::Surface *surface);
@@ -76,9 +75,8 @@ public:
 	void drawText(GFTFont *font, const char *text, int x, int y, byte color);
 	void drawWrappedText(GFTFont *font, const char *text, int x, int y, int maxWidth, byte color);
 protected:
-	WWSurface *_surface;
+	Graphics::Surface *_vgaSurface;
 	int _lockCtr;
-	void updateScreen();
 };
 
 class ScreenEffect {
@@ -92,7 +90,10 @@ protected:
 	int _x, _y;
 	int _grainWidth, _grainHeight;
 	int _blockCountW, _blockCountH;
-	int _blockCtr, _blockUpdateCtr;
+	int _blockCtr;
+	uint32 _timePerSlice;
+	uint32 _totalSliceTicks;
+	int _blocksPerSlice;
 	void drawBlock(int blockX, int blockY);
 	uint getBitCount(int value) const;
 	uint getSeed(uint bitCount) const;


Commit: 7b709a67f88733d7845f5c2488b8478d101de8cf
    https://github.com/scummvm/scummvm/commit/7b709a67f88733d7845f5c2488b8478d101de8cf
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:51+01:00

Commit Message:
WAYNESWORLD: Fix 'tongue trick' logic and rename variables in room 1

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 23b62009e33..24aac09495c 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -173,8 +173,8 @@ void GameLogic::initVariables() {
 	_r39_flags = 0;
 	_r10_selectedItemToBuy = -1;
 	_r9_dialogFlag = 0;
-	_r1_eventFlag = 0;
-	_r1_eventCtr = 1;
+	_r1_tongueTrickActive = false;
+	_r1_tongueTrickCtr = 1;
 	_r17_dialogCtr = 0;
 	_r17_eventFlag = 0;
 	_r2_backgroundValue1 = 0;
@@ -1539,12 +1539,12 @@ int GameLogic::r1_handleVerbPush() {
 
 int GameLogic::r1_handleVerbPull() {
 	int actionTextIndex = -1;
-	if (!(_r1_flags1 & 0x40) || _r1_eventFlag == 0) {
+	if (!(_r1_flags1 & 0x40) && !_r1_tongueTrickActive) {
 		r1_checkDrGadget();
 	} else {
 		switch (_vm->_objectNumber) {
 		case kObjectIdScreen:
-			if (_r1_eventFlag != 0) {
+			if (_r1_tongueTrickActive) {
 				actionTextIndex = 6;
 			} else {
 				r1_pullScreen();
@@ -1670,7 +1670,7 @@ void GameLogic::r1_initRoomAnimations() {
 	_vm->loadAnimationSpriteRange(10, "mice", 5);
 	_vm->setAnimationTimer(0, 1000);
 	_vm->setAnimationTimer(1, 400);
-	_vm->setAnimationTimer(2, 6000);
+	_vm->setAnimationTimer(2, 5000);
 	_vm->startRoomAnimations();
 }
 
@@ -1686,8 +1686,8 @@ void GameLogic::r1_updateRoomAnimations() {
 	if (!(_r1_flags1 & 0x10) && _vm->isAnimationTimerExpired(1)) {
 		_vm->drawAnimationSprite(10 + _vm->getRandom(5), 179, 67);
 	}
-	if (_r1_eventFlag != 0 && _vm->isAnimationTimerExpired(2)) {
-		_vm->_roomEventNum = _r1_eventCtr;
+	if (_r1_tongueTrickActive && _vm->isAnimationTimerExpired(2)) {
+		_vm->_roomEventNum = _r1_tongueTrickCtr;
 	}
 }
 
@@ -1760,8 +1760,8 @@ void GameLogic::r1_refreshRoomBackground() {
 		if (_r1_flags1 & 0x80) {
 			_vm->drawRoomImageToBackground("norobot", 64, 68);
 		}
-		if (_r1_eventFlag != 0) {
-			switch (_r1_eventCtr) {
+		if (_r1_tongueTrickActive) {
+			switch (_r1_tongueTrickCtr) {
 			case 2: case 9:
 				_vm->drawRoomImageToBackground("tt011", 119, 81);
 				break;
@@ -1792,67 +1792,67 @@ void GameLogic::r1_refreshRoomBackground() {
 	}
 }
 
-void GameLogic::r1_handleRoomEvent(bool arg6) {
-	if (arg6) {
-		_r1_eventCtr = -1;
+void GameLogic::r1_handleRoomEvent(bool startTongueTrick) {
+	if (startTongueTrick) {
+		_r1_tongueTrickCtr = -1;
 	}
-	switch (_r1_eventCtr) {
-	case 1:
-		_r1_eventFlag = 1;
-		_r1_eventCtr = 0;
+	switch (_r1_tongueTrickCtr) {
+	case -1:
+		_r1_tongueTrickActive = true;
+		_r1_tongueTrickCtr = 0;
 		break;
-	case 3:
+	case 1:
 		_vm->walkTo(209, 120, 7, 151, 127);
 		_vm->fillRoomMaskArea(0, 0, 180, 149, 1);
 		_vm->_garthSpriteX = -1;
 		_vm->playAnimation("tt0", 0, 12, 119, 81, 0, 150);
 		break;
-	case 4:
+	case 2:
 		_vm->playAnimation("tt1", 0, 12, 119, 81, 0, 150);
 		break;
-	case 5:
+	case 3:
 		_vm->playAnimation("tt2", 0, 12, 119, 81, 0, 150);
 		break;
-	case 6:
+	case 4:
 		_vm->playAnimation("tt3", 0, 12, 119, 81, 0, 150);
 		_vm->playAnimation("tt3", 8, 4, 119, 81, 0, 150);
 		break;
-	case 7:
+	case 5:
 		_vm->playAnimation("tt4", 0, 7, 119, 81, 0, 150);
 		_vm->playAnimation("tt4", 3, 4, 119, 81, 0, 150);
 		break;
-	case 8:
+	case 6:
 		_vm->playAnimation("tt5", 0, 7, 119, 81, 0, 150);
 		_vm->playAnimation("tt5", 3, 4, 119, 81, 0, 150);
 		break;
-	case 9:
+	case 7:
 		_vm->playAnimation("tt6", 0, 19, 119, 81, 0, 150);
 		_vm->playAnimation("tt6", 7, 7, 119, 81, 0, 150);
 		_vm->playAnimation("tt6", 6, 1, 119, 81, 0, 150);
 		break;
-	case 10:
+	case 8:
 		_vm->playAnimation("tt7", 0, 9, 119, 81, 0, 150);
 		_vm->playAnimation("tt7", 1, 6, 119, 81, 0, 150);
 		_vm->playAnimation("tt0", 11, 1, 119, 81, 0, 150);
 		break;
-	case 11:
+	case 9:
 		_vm->playAnimation("tt0", 10, -11, 119, 81, 0, 150);
 		break;
 	default:
 		break;
 	}
-	if (_r1_eventCtr > 0) {
-		_vm->displayText("c04r", _r1_eventCtr + 124, 0, 170, 30, 0);
+	if (_r1_tongueTrickCtr > 0) {
+		_vm->displayText("c04r", _r1_tongueTrickCtr + 124, 0, 170, 30, 0);
 		_vm->waitSeconds(2);
 		_vm->_isTextVisible = false;
 	}
-	if (_r1_eventCtr == 9) {
+	if (_r1_tongueTrickCtr == 9) {
 		_vm->refreshActors();
 		_vm->_currentActorNum = 0;
 		_vm->displayTextLines("c04", 199, -1, -1, 3);
 		_vm->_currentActorNum = 1;
-		_r1_eventFlag = 0;
-		_r1_eventCtr = -1;
+		_r1_tongueTrickActive = false;
+		_r1_tongueTrickCtr = -1;
 		_vm->_garthSpriteX = 146;
 		_vm->loadRoomMask(_vm->_currentRoomNumber);
 		_vm->loadRoomBackground();
@@ -1860,7 +1860,7 @@ void GameLogic::r1_handleRoomEvent(bool arg6) {
 			r1_drGadgetLeaves();
 		}
 	}
-	_r1_eventCtr = _r1_eventCtr + 1;
+	_r1_tongueTrickCtr++;
 }
 
 void GameLogic::r1_pullScreen() {
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index 1fd2216409f..a67321fae9f 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -87,8 +87,8 @@ public:
 	byte _r39_flags;
 	int _r10_selectedItemToBuy;
 	byte _r9_dialogFlag;
-	byte _r1_eventFlag;
-	byte _r1_eventCtr;
+	bool _r1_tongueTrickActive;
+	int _r1_tongueTrickCtr;
 	byte _r17_dialogCtr;
 	byte _r17_eventFlag;
 	byte _r2_backgroundValue1;
@@ -138,7 +138,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	int r1_handleVerbClose();
 	bool r1_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3);
 	void r1_refreshRoomBackground();
-	void r1_handleRoomEvent(bool arg6);
+	void r1_handleRoomEvent(bool startTongueTrick);
 	void r1_initRoomAnimations();
 	void r1_uninitRoomAnimations();
 	void r1_updateRoomAnimations();
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 37e23a07fa7..e72ca64d77c 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -147,10 +147,10 @@ Common::Error WaynesWorldEngine::run() {
 	drawImageToScreen("r00/backg", 0, 0);
 
 	drawInterface(2);
-	// changeRoom(0);
-	_wayneSpriteX = -1; _garthSpriteX = -1;
-	changeRoom(31); // DEBUG
-	_logic->r31_displayCategories();
+	changeRoom(1);
+	// _wayneSpriteX = -1; _garthSpriteX = -1;
+	// changeRoom(31); // DEBUG
+	// _logic->r31_displayCategories();
 	// _logic->_r1_eventFlag = 1;
 	// _logic->_r1_eventCtr = 3;
 
@@ -1813,28 +1813,30 @@ void WaynesWorldEngine::handleVerbTalkTo() {
         }
         displayText("c11", actionTextIndex, 0, -1, -1, 0);
         waitSeconds(2);
+		// Not in the original but without it the old text will be drawn as well
+		_isTextVisible = false;
         if (room1Special) {
             actionTextIndex = 15;
         } else {
             actionTextIndex += 10;
         }
         if (_currentActorNum != 0) {
-            _currentActorNum = 1;
-        } else {
             _currentActorNum = 0;
+        } else {
+            _currentActorNum = 1;
         }
         loadRoomBackground();
         displayText("c11", actionTextIndex, 0, -1, -1, 0);
         if (_currentActorNum != 0) {
-            _currentActorNum = 1;
-        } else {
             _currentActorNum = 0;
+        } else {
+            _currentActorNum = 1;
         }
         waitSeconds(2);
         _isTextVisible = false;
         loadRoomBackground();
         if (room1Special) {
-            // TODO r1_handleRoomEvent(true);
+            _logic->r1_handleRoomEvent(true);
         }
         return;
     }


Commit: ef017c49550f81a3b7d8b680c4aa354a08cd4680
    https://github.com/scummvm/scummvm/commit/ef017c49550f81a3b7d8b680c4aa354a08cd4680
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:52+01:00

Commit Message:
WAYNESWORLD: Rename methods/variables in room 37

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 24aac09495c..bf14e83798d 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -139,7 +139,7 @@ void GameLogic::initVariables() {
 	_word_34464 = 0;
 	_word_34466 = 0;
 	_r37_safeCombinationLockIndex = 0;
-	_r37_word_35CEC = 0;
+	_r37_safeCombinationDirection = 0;
 	_r37_safeCombinationIndex = 0;
 	_r37_safeCombinationCurrentNumber = 0;
 	_r12_talkObjectNumber = 0;
@@ -976,7 +976,7 @@ void GameLogic::handleRoomEvent(int eventNum) {
         r35_talkToCassandra();
         break;
     case 37:
-        r37_handleRoomEvent();
+        r37_climbEnterLadderDown();
         break;
     case 36:
         r36_handleRoomEvent();
@@ -7757,15 +7757,15 @@ int GameLogic::r37_handleVerbUse() {
 	int actionTextIndex = -1;
 	switch (_vm->_objectNumber) {
 	case kObjectIdLadder37_0:
-		r37_useLadder1();
+		r37_climbExitLadderUp();
 		_r37_flags |= 0x20;
 		_vm->changeRoom(17);
 		break;
 	case kObjectIdLadder37_1:
-		r37_useLadder2();
+		r37_climbLadderDown();
 		break;
 	case kObjectIdLadder:
-		r37_useLadder3();
+		r37_climbLadderUp();
 		break;
 	default:
 		actionTextIndex = 0;
@@ -7778,7 +7778,7 @@ int GameLogic::r37_handleVerbPush() {
 	int actionTextIndex = -1;
 	switch (_vm->_objectNumber) {
 	case kObjectIdLock_1:
-		r37_pushPullLock(0);
+		r37_pushPullSafeLock(false);
 		break;
 	default:
 		actionTextIndex = 0;
@@ -7791,7 +7791,7 @@ int GameLogic::r37_handleVerbPull() {
 	int actionTextIndex = -1;
 	switch (_vm->_objectNumber) {
 	case kObjectIdLock_1:
-		r37_pushPullLock(1);
+		r37_pushPullSafeLock(true);
 		break;
 	case kObjectIdHandle:
 		if (!(_r37_flags & 0x02)) {
@@ -7827,7 +7827,7 @@ void GameLogic::r37_refreshRoomBackground() {
 	}
 }
 
-void GameLogic::r37_useLadder1() {
+void GameLogic::r37_climbExitLadderUp() {
 	Common::String tempFilename;
 	WWSurface *workBackground;
 	WWSurface *wclimbSprites[4];
@@ -7903,7 +7903,7 @@ void GameLogic::r37_useLadder1() {
 	delete workBackground;
 }
 
-void GameLogic::r37_useLadder2() {
+void GameLogic::r37_climbLadderDown() {
 	Common::String tempFilename;
 
 	WWSurface *workBackground;
@@ -7997,8 +7997,8 @@ void GameLogic::r37_useLadder2() {
 	} else {
 		_vm->moveObjectToNowhere(kObjectIdSafe_1);
 		_vm->moveObjectToNowhere(kObjectIdLock_1);
-		_vm->moveObjectToNowhere(kObjectIdMagazines); // TODO CHECKME Another Turbo C++ compiler bug?
 		_vm->moveObjectToNowhere(kObjectIdHandle);
+		_vm->moveObjectToRoom(kObjectIdMagazines, 37); // TODO CHECKME Another Turbo C++ compiler bug?
 		if (!(_r37_flags & 0x08)) {
 			_vm->moveObjectToRoom(kObjectIdKeys, 37);
 		}
@@ -8012,7 +8012,7 @@ void GameLogic::r37_useLadder2() {
 	_vm->refreshActors();
 }
 
-void GameLogic::r37_useLadder3() {
+void GameLogic::r37_climbLadderUp() {
 	Common::String tempFilename;
 	WWSurface *workBackground;
 	WWSurface *wclimbSprites[4];
@@ -8108,36 +8108,36 @@ void GameLogic::r37_useLadder3() {
 	_vm->refreshActors();
 }
 
-void GameLogic::r37_pushPullLock(bool isPull) {
+void GameLogic::r37_pushPullSafeLock(bool isPull) {
 	if (isPull) {
-		if (_r37_word_35CEC == 0 ||
+		if (_r37_safeCombinationDirection == 0 ||
 			(_r37_safeCombinationCurrentNumber == 0 && _r37_safeCombinationIndex == 0 && _r37_safeCombinationLockIndex != 0)) {
 			_r37_flags &= ~0x02;
 			_r37_safeCombinationIndex = 0;
 			_r37_safeCombinationCurrentNumber = 0;
-			_r37_word_35CEC = 0;
+			_r37_safeCombinationDirection = 0;
 		} else {
 			_r37_safeCombinationCurrentNumber = _r37_safeCombinationCurrentNumber + 1;
 			if (kRoom37CorrectSafeCombination[_r37_safeCombinationIndex] == _r37_safeCombinationCurrentNumber) {
 				_r37_safeCombinationIndex++;
 				_r37_safeCombinationCurrentNumber = 0;
-				_r37_word_35CEC = (_r37_word_35CEC + 1) % 2;
+				_r37_safeCombinationDirection = (_r37_safeCombinationDirection + 1) % 2;
 			}
 		}
 		_r37_safeCombinationLockIndex = (_r37_safeCombinationLockIndex + 1) % 8;
 	} else {
-		if (_r37_word_35CEC != 0 ||
+		if (_r37_safeCombinationDirection != 0 ||
 			(_r37_safeCombinationCurrentNumber == 0 && _r37_safeCombinationIndex == 0 && _r37_safeCombinationLockIndex != 0)) {
 			_r37_flags &= ~0x02;
 			_r37_safeCombinationIndex = 0;
 			_r37_safeCombinationCurrentNumber = 0;
-			_r37_word_35CEC = 0;
+			_r37_safeCombinationDirection = 0;
 		} else {
 			_r37_safeCombinationCurrentNumber = _r37_safeCombinationCurrentNumber + 1;
 			if (kRoom37CorrectSafeCombination[_r37_safeCombinationIndex] == _r37_safeCombinationCurrentNumber) {
 				_r37_safeCombinationIndex++;
 				_r37_safeCombinationCurrentNumber = 0;
-				_r37_word_35CEC = (_r37_word_35CEC + 1) % 2;
+				_r37_safeCombinationDirection = (_r37_safeCombinationDirection + 1) % 2;
 			}
 		}
 		_r37_safeCombinationLockIndex = (_r37_safeCombinationLockIndex + 7) % 8;
@@ -8161,7 +8161,7 @@ void GameLogic::r37_pullHandle() {
 	_vm->loadRoomBackground();
 }
 
-void GameLogic::r37_handleRoomEvent() {
+void GameLogic::r37_climbEnterLadderDown() {
 	Common::String tempFilename;
 	WWSurface *workBackground;
 	WWSurface *wclimbSprites[4];
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index a67321fae9f..7b32cbb7bc1 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -53,7 +53,7 @@ public:
 	int _word_34464;
 	int _word_34466;
 	int _r37_safeCombinationLockIndex;
-	int _r37_word_35CEC;
+	int _r37_safeCombinationDirection;
 	int _r37_safeCombinationIndex;
 	int _r37_safeCombinationCurrentNumber;
 	int _r12_talkObjectNumber;
@@ -426,11 +426,11 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	int r37_handleVerbPush();
 	int r37_handleVerbPull();
 	void r37_refreshRoomBackground();
-	void r37_handleRoomEvent();
-	void r37_useLadder1();
-	void r37_useLadder2();
-	void r37_useLadder3();
-	void r37_pushPullLock(bool isPull);
+	void r37_climbEnterLadderDown();
+	void r37_climbExitLadderUp();
+	void r37_climbLadderDown();
+	void r37_climbLadderUp();
+	void r37_pushPullSafeLock(bool isPull);
 	void r37_pullHandle();
 
 	int r38_handleVerbUse();


Commit: 77dcc99861d3b1357c1a5e32b5eb5ae7fe496158
    https://github.com/scummvm/scummvm/commit/77dcc99861d3b1357c1a5e32b5eb5ae7fe496158
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:52+01:00

Commit Message:
WAYNESWORLD: Replace forgotten integers with object constants

Changed paths:
    engines/waynesworld/gamelogic.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index bf14e83798d..c96296c862b 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -6038,7 +6038,7 @@ void GameLogic::r24_refreshRoomBackground() {
 				_vm->fillRoomMaskArea(58, 128, 147, 146, 1);
 			}
 		} else {
-			_vm->moveObjectToNowhere(holeIndex + 306);
+			_vm->moveObjectToNowhere(kObjectIdOpening_0 + holeIndex);
 		}
 	}
 	_vm->setWaynePosition(kRoom24MazeWaynePositionsX[_r24_mazeHoleNumber], kRoom24MazeWaynePositionsY[_r24_mazeHoleNumber]);
@@ -6273,12 +6273,12 @@ void GameLogic::r25_refreshRoomBackground() {
 }
 
 void GameLogic::r25_updateMazeRoomHole(int mazeRoomNumber) {
-	_vm->moveObjectToNowhere(314);
-	_vm->moveObjectToNowhere(315);
-	_vm->moveObjectToNowhere(317);
-	_vm->moveObjectToNowhere(318);
-	_vm->moveObjectToNowhere(320);
-	_vm->moveObjectToNowhere(321);
+	_vm->moveObjectToNowhere(kObjectIdOpening_7);
+	_vm->moveObjectToNowhere(kObjectIdOpening_8);
+	_vm->moveObjectToNowhere(kObjectIdOpening_9);
+	_vm->moveObjectToNowhere(kObjectIdOpening_10);
+	_vm->moveObjectToNowhere(kObjectIdOpening_11);
+	_vm->moveObjectToNowhere(kObjectIdOpening_12);
 	switch (mazeRoomNumber) {
 	case 3:
 	case 10:
@@ -6286,27 +6286,27 @@ void GameLogic::r25_updateMazeRoomHole(int mazeRoomNumber) {
 		_r25_holeIndex = -1;
 		break;
 	case 23:
-		_vm->moveObjectToRoom(314, 25);
+		_vm->moveObjectToRoom(kObjectIdOpening_7, 25);
 		_r25_holeIndex = 0;
 		break;
 	case 17:
-		_vm->moveObjectToRoom(315, 25);
+		_vm->moveObjectToRoom(kObjectIdOpening_8, 25);
 		_r25_holeIndex = 1;
 		break;
 	case 47:
-		_vm->moveObjectToRoom(317, 26);
+		_vm->moveObjectToRoom(kObjectIdOpening_9, 26);
 		_r25_holeIndex = 2;
 		break;
 	case 20:
-		_vm->moveObjectToRoom(318, 26);
+		_vm->moveObjectToRoom(kObjectIdOpening_10, 26);
 		_r25_holeIndex = 3;
 		break;
 	case 11:
-		_vm->moveObjectToRoom(320, 27);
+		_vm->moveObjectToRoom(kObjectIdOpening_11, 27);
 		_r25_holeIndex = 4;
 		break;
 	case 40:
-		_vm->moveObjectToRoom(321, 27);
+		_vm->moveObjectToRoom(kObjectIdOpening_12, 27);
 		_r25_holeIndex = 5;
 		break;
 	}


Commit: 090d18005b960a84bda82b371be380c9c5a42213
    https://github.com/scummvm/scummvm/commit/090d18005b960a84bda82b371be380c9c5a42213
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:52+01:00

Commit Message:
WAYNESWORLD: Replace access to _currentActorNum with convenience methods

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/pathfinding.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index c96296c862b..8b84ef364ee 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -1251,7 +1251,7 @@ int GameLogic::r0_handleVerbPickUp() {
 	int actionTextIndex = -1;
 	switch (_vm->_objectNumber) {
 	case kObjectIdGuitar:
-		if (_vm->_currentActorNum != 0) {
+		if (_vm->isActorWayne()) {
 			_vm->pickupObject(kObjectIdGuitar, _r0_flags, 1, kObjectIdInventoryGuitar);
 			actionTextIndex = 1;
 		} else {
@@ -1390,9 +1390,9 @@ void GameLogic::r0_refreshRoomBackground() {
 
 void GameLogic::r0_handleRoomEvent2() {
 	_vm->displayTextLines("c11", 1, -1, -1, 2);
-	_vm->_currentActorNum = 0;
+	_vm->selectActorGarth();
 	_vm->displayTextLines("c11", 3, -1, -1, 2);
-	_vm->_currentActorNum = 1;
+	_vm->selectActorWayne();
 	_vm->displayTextLines("c11", 5, -1, -1, 5);
 	_vm->setDialogChoices(-1, -1, -1, -1, -1);
 	r0_buildRandomDialogChoices(-1);
@@ -1402,7 +1402,7 @@ void GameLogic::r0_handleRoomEvent2() {
 void GameLogic::r0_handleRoomEvent3() {
 	for (int textIndex = 0; textIndex < 4; textIndex++) {
 		_vm->displayTextLines("c11", textIndex + 10, -1, -1, 1);
-		_vm->_currentActorNum = (_vm->_currentActorNum + 1) % 2;
+		_vm->toggleActor();
 		_vm->waitSeconds(1);
 	}
 	_vm->moveObjectToRoom(kObjectIdInventoryPizzathonList, 99);
@@ -1848,9 +1848,9 @@ void GameLogic::r1_handleRoomEvent(bool startTongueTrick) {
 	}
 	if (_r1_tongueTrickCtr == 9) {
 		_vm->refreshActors();
-		_vm->_currentActorNum = 0;
+		_vm->selectActorGarth();
 		_vm->displayTextLines("c04", 199, -1, -1, 3);
-		_vm->_currentActorNum = 1;
+		_vm->selectActorWayne();
 		_r1_tongueTrickActive = false;
 		_r1_tongueTrickCtr = -1;
 		_vm->_garthSpriteX = 146;
@@ -1864,7 +1864,7 @@ void GameLogic::r1_handleRoomEvent(bool startTongueTrick) {
 }
 
 void GameLogic::r1_pullScreen() {
-	if (_vm->_currentActorNum != 0) {
+	if (_vm->isActorWayne()) {
 		_vm->walkTo(_vm->_wayneSpriteX - 1, _vm->_wayneSpriteY, _vm->_actorSpriteValue, 180, 115);
 		_vm->_wayneSpriteX = -1;
 		_vm->playAnimation("wscreen", 0, 7, 117, 53, 0, 100);
@@ -2127,10 +2127,10 @@ bool GameLogic::r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		_vm->_gameState = 0;
 		break;
 	case 369: case 384:
-		if (_vm->_currentActorNum != 0 && _vm->_wayneInventory[kObjectIdInventoryDollar] < 1) {
+		if (_vm->isActorWayne() && _vm->_wayneInventory[kObjectIdInventoryDollar] < 1) {
 			replyTextIndex1 = 579;
 			continueDialog = true;
-		} else if (_vm->_currentActorNum == 0 && _vm->_garthInventory[kObjectIdInventoryDollar] < 1) {
+		} else if (_vm->isActorGarth() && _vm->_garthInventory[kObjectIdInventoryDollar] < 1) {
 			replyTextIndex1 = 579;
 			continueDialog = true;
 		} else {
@@ -2139,10 +2139,10 @@ bool GameLogic::r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		_vm->_gameState = 0;
 		break;
 	case 385:
-		if (_vm->_currentActorNum != 0 && _vm->_wayneInventory[kObjectIdInventoryDollar] < 10) {
+		if (_vm->isActorWayne() && _vm->_wayneInventory[kObjectIdInventoryDollar] < 10) {
 			replyTextIndex1 = 579;
 			continueDialog = true;
-		} else if (_vm->_currentActorNum == 0 && _vm->_garthInventory[kObjectIdInventoryDollar] < 10) {
+		} else if (_vm->isActorGarth() && _vm->_garthInventory[kObjectIdInventoryDollar] < 10) {
 			replyTextIndex1 = 579;
 			continueDialog = true;
 		} else {
@@ -2197,13 +2197,13 @@ bool GameLogic::r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		replyTextIndex2 = 405;
 		continueDialog = true;
 		_r2_flags |= 0x10;
-		if (_vm->_currentActorNum == 0) {
+		if (_vm->isActorWayne()) {
 			if (_vm->_wayneInventory[kObjectIdInventoryDollar] >= 10) {
 				_vm->setDialogChoices(379, 366, -1, -1, -1);
 			} else {
 				_vm->setDialogChoices(380, 366, -1, -1, -1);
 			}
-		} else if (_vm->_currentActorNum != 0) {
+		} else if (_vm->isActorGarth()) {
 			if (_vm->_garthInventory[kObjectIdInventoryDollar] >= 10) {
 				_vm->setDialogChoices(379, 366, -1, -1, -1);
 			} else {
@@ -2720,7 +2720,7 @@ int GameLogic::r4_useTubeWithShade() {
 		return 61;
 	}
 	_vm->walkTo(162, 46, 1, -1, -1);
-	if (_vm->_currentActorNum != 0) {
+	if (_vm->isActorWayne()) {
 		_r4_flags |= 0x20;
 		oldX = _vm->_wayneSpriteX;
 		_vm->_wayneSpriteX = -1;
@@ -2736,7 +2736,7 @@ int GameLogic::r4_useTubeWithShade() {
 	_r4_flags &= ~0x40;
 	_vm->playAnimation("mouse", 0, 7, 212, 61, 0, 100);
 	_vm->playAnimation("shoot", 0, 14, 187, 29, 0, 100);
-	if (_vm->_currentActorNum != 0) {
+	if (_vm->isActorWayne()) {
 		_vm->_wayneSpriteX = oldX;
 	} else {
 		_vm->_garthSpriteX = oldX;
@@ -2943,7 +2943,7 @@ int GameLogic::r6_handleVerbUse() {
 		}
 		break;
 	case kObjectIdSeat:
-		if (_vm->_currentActorNum != 0) {
+		if (_vm->isActorWayne()) {
 			actionTextIndex = 53;
 		} else {
 			r6_useSeat();
@@ -2962,7 +2962,7 @@ int GameLogic::r6_handleVerbPull() {
 	case kObjectIdRope_1:
 		if (!(_r6_flags & 0x10)) {
 			actionTextIndex = 3;
-		} else if (_vm->_currentActorNum == 0) {
+		} else if (_vm->isActorGarth()) {
 			actionTextIndex = 4;
 		} else {
 			r6_pullRope();
@@ -3160,7 +3160,7 @@ void GameLogic::r6_handleRoomEvent2() {
 	_r6_flags &= ~0x10;
 	_vm->_garthSpriteX = 155;
 	_vm->_wayneSpriteX = 150;
-	_vm->_currentActorNum = 1;
+	_vm->selectActorWayne();
 	_vm->loadRoomBackground();
 	_r6_flags &= ~0x08;
 	_vm->loadRoomBackground();
@@ -3211,7 +3211,7 @@ void GameLogic::r6_giveLuckySausageToDog() {
 }
 
 void GameLogic::r6_useRopeWithBeam() {
-	if (_vm->_currentActorNum != 0) {
+	if (_vm->isActorWayne()) {
 		_vm->walkTo(_vm->_wayneSpriteX, _vm->_wayneSpriteY, _vm->_actorSpriteValue, 165, 99);
 	} else {
 		_vm->walkTo(165, 99, _vm->_actorSpriteValue, _vm->_garthSpriteX, _vm->_garthSpriteY);
@@ -3247,7 +3247,7 @@ void GameLogic::r6_pullRope() {
 		_vm->playAnimation("knock", 0, 2, 148, 61, 0, 100);
 	}
 	_vm->waitSeconds(1);
-	_vm->_currentActorNum = 0;
+	_vm->selectActorGarth();
 	_vm->playAnimation("cindi", 0, 5, 143, 55, 0, 100);
 	_vm->displayText("c04r", 138, 0, 160, 10, 0);
 	for (int i = 0; i < 5; i++) {
@@ -4042,7 +4042,7 @@ int GameLogic::r9_handleVerbGive() {
 	int actionTextIndex = -1;
 	switch (_vm->_objectNumber) {
 	case kObjectIdMan9:
-		if (_vm->_currentActorNum != 0) {
+		if (_vm->isActorWayne()) {
 			_vm->walkTo(_vm->_wayneSpriteX - 1, _vm->_wayneSpriteY, _vm->_actorSpriteValue, 173, 86);
 		} else {
 			_vm->walkTo(173, 86, _vm->_actorSpriteValue, _vm->_garthSpriteX - 1, _vm->_garthSpriteY);
@@ -4142,9 +4142,9 @@ bool GameLogic::r9_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 	case 248:
 		_vm->displayTextLines("c04r", 196, 250, 25, 1);
 		_vm->displayTextLines("c04", 251, -1, -1, 1);
-		_vm->_currentActorNum = (_vm->_currentActorNum + 1) % 2;
+		_vm->toggleActor();
 		_vm->displayTextLines("c04", 252, -1, -1, 1);
-		_vm->_currentActorNum = (_vm->_currentActorNum + 1) % 2;
+		_vm->toggleActor();
 		replyTextIndex1 = 197;
 		continueDialog = true;
 		break;
@@ -4257,7 +4257,7 @@ int GameLogic::r10_handleVerbPickUp() {
 		actionTextIndex = 8;
 		break;
 	case kObjectIdSalesgirl:
-		if (_vm->_currentActorNum != 0) {
+		if (_vm->isActorWayne()) {
 			actionTextIndex = 17;
 		} else {
 			actionTextIndex = 18;
@@ -4354,7 +4354,7 @@ int GameLogic::r10_handleVerbUse() {
 		actionTextIndex = 3;
 		break;
 	case kObjectIdSalesgirl:
-		if (_vm->_currentActorNum != 0) {
+		if (_vm->isActorWayne()) {
 			actionTextIndex = 21;
 		} else {
 			actionTextIndex = 22;
@@ -4384,7 +4384,7 @@ void GameLogic::r10_handleVerbTalkTo() {
 	_vm->_dialogChoices[0] = -1;
 	switch (_vm->_objectNumber) {
 	case kObjectIdSalesgirl:
-		if (_vm->_currentActorNum != 0) {
+		if (_vm->isActorWayne()) {
 			_vm->setDialogChoices(0, 5, 2, 3, 4);
 		} else {
 			_vm->setDialogChoices(0, 1, 2, 3, 4);
@@ -4465,9 +4465,9 @@ bool GameLogic::r10_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 				break;
 			case 0: case 1: case 2:
 				_r10_selectedItemToBuy = _vm->_selectedDialogChoice;
-				if (_vm->_currentActorNum != 0 && _vm->_wayneInventory[kObjectIdInventoryDollar - 28] == 0) {
+				if (_vm->isActorWayne() && _vm->_wayneInventory[kObjectIdInventoryDollar - 28] == 0) {
 					_vm->setDialogChoices(8, -1, -1, -1, -1);
-				} else if (_vm->_currentActorNum == 0 && _vm->_garthInventory[kObjectIdInventoryDollar - 28] == 0) {
+				} else if (_vm->isActorGarth() && _vm->_garthInventory[kObjectIdInventoryDollar - 28] == 0) {
 					_vm->setDialogChoices(8, -1, -1, -1, -1);
 				} else {
 					_vm->setDialogChoices(6, 7, -1, -1, -1);
@@ -4550,7 +4550,7 @@ int GameLogic::r11_handleVerbPickUp() {
 		break;
 	case kObjectIdExtensionCord_1:
 		if (_r11_flags & 0x08) {
-			if (_vm->_currentActorNum != 0) {
+			if (_vm->isActorWayne()) {
 				actionTextIndex = 38;
 			} else {
 				actionTextIndex = 39;
@@ -4587,7 +4587,7 @@ int GameLogic::r11_handleVerbUse() {
 		break;
 	case kObjectIdLampPost:
 		if (_vm->_firstObjectNumber == kObjectIdInventoryPlungers) {
-			if (_vm->_currentActorNum != 0) {
+			if (_vm->isActorWayne()) {
 				actionTextIndex = 43;
 			} else if (_r11_flags & 0x10) {
 				actionTextIndex = 80;
@@ -4605,7 +4605,7 @@ int GameLogic::r11_handleVerbUse() {
 			actionTextIndex = 7;
 		} else {
 			if (_vm->_firstObjectNumber == kObjectIdInventoryExtensionCord) {
-				if (_vm->_currentActorNum != 0) {
+				if (_vm->isActorWayne()) {
 					actionTextIndex = 46;
 				} else {
 					r11_useExtensionCordWithOutlet();
@@ -4617,7 +4617,7 @@ int GameLogic::r11_handleVerbUse() {
 		break;
 	case kObjectIdExtensionCord_1:
 		if (_vm->_firstObjectNumber == kObjectIdInventorySuckCut) {
-			if (_vm->_currentActorNum == 0) {
+			if (_vm->isActorGarth()) {
 				actionTextIndex = 47;
 			} else {
 				r11_useSuckCutWithExtensionCord();
@@ -4629,7 +4629,7 @@ int GameLogic::r11_handleVerbUse() {
 	case kObjectIdFountain11_0:
 	case kObjectIdFountain11_1:
 		if (_vm->_firstObjectNumber == kObjectIdSuckCut) {
-			if (_vm->_currentActorNum == 0) {
+			if (_vm->isActorGarth()) {
 				actionTextIndex = 47;
 			} else {
 				r11_useSuckCutWithFountain();
@@ -4735,7 +4735,7 @@ void GameLogic::r11_useCar2() {
 }
 
 void GameLogic::r11_pickUpExtensionCord() {
-	if (_vm->_currentActorNum == 0 && (_r11_flags & 0x01)) {
+	if (_vm->isActorGarth() && (_r11_flags & 0x01)) {
 		r11_useCar1();
 	}
 	if (_r11_flags & 0x04) {
@@ -4801,9 +4801,9 @@ void GameLogic::r11_usePlungersWithLampPost() {
 	_vm->displayText("c04", 166, 0, -1, -1, 0);
 	_vm->waitSeconds(1);
 	_vm->_isTextVisible = false;
-	_vm->_currentActorNum = 1;
+	_vm->selectActorWayne();
 	_vm->walkTo(146, 146, 1, _vm->_garthSpriteX, _vm->_garthSpriteY);
-	_vm->_currentActorNum = 0;
+	_vm->selectActorGarth();
 	_vm->_garthSpriteX = -1;
 	_vm->playAnimation("plunge", 0, 16, 190, 62, 0, 150);
 	_r11_flags |= 0x01;
@@ -6359,7 +6359,7 @@ void GameLogic::r28_refreshRoomBackground() {
 
 void GameLogic::r28_handleRoomEvent1() {
 	_r20_flags |= 0x01;
-	if (_vm->_currentActorNum != 0) {
+	if (_vm->isActorWayne()) {
 		_vm->walkTo(172, 136, 7, 142, 136);
 	} else {
 		_vm->walkTo(142, 136, 7, 172, 136);
@@ -6419,20 +6419,12 @@ void GameLogic::r28_handleRoomEvent2() {
 	_r20_flags |= 0x02;
 	_vm->moveObjectToNowhere(kObjectIdGiantLizard);
 	_vm->displayText("c04", 27, 0, -1, -1, 0);
-	if (_vm->_currentActorNum != 0) {
-		_vm->_currentActorNum = 0;
-	} else {
-		_vm->_currentActorNum = 1;
-	}
+	_vm->toggleActor();
 	_vm->waitSeconds(2);
 	_vm->_isTextVisible = false;
 	_vm->refreshActors();
 	_vm->displayText("c04", 28, 0, -1, -1, 0);
-	if (_vm->_currentActorNum != 0) {
-		_vm->_currentActorNum = 0;
-	} else {
-		_vm->_currentActorNum = 1;
-	}
+	_vm->toggleActor();
 	_vm->waitSeconds(1);
 	_vm->_isTextVisible = false;
 	_vm->loadRoomBackground();
@@ -6661,8 +6653,8 @@ void GameLogic::r30_refreshRoomBackground() {
 void GameLogic::r30_handleRoomEvent1() {
 	_r30_flags |= 0x02;
 	_vm->displayTextLines("c04r", 51, 150, 10, 23);
-	if (_vm->_currentActorNum == 0) {
-		_vm->_currentActorNum = 1;
+	if (_vm->isActorGarth()) {
+		_vm->selectActorWayne();
 		_vm->drawInterface(_vm->_verbNumber);
 	}
 	_vm->walkTo(237, 51, 6, _vm->_garthSpriteX, _vm->_garthSpriteY);
@@ -6944,10 +6936,10 @@ void GameLogic::r31_handleRoomEvent5() {
 	_vm->walkTo(230, 140, 0, _vm->_garthSpriteX, _vm->_garthSpriteY);
 	_vm->displayText("c04", 164, 0, -1, -1, 0);
 	_vm->waitSeconds(2);
-	_vm->_currentActorNum = 0;
+	_vm->selectActorGarth();
 	_vm->loadRoomBackground();
 	_vm->displayText("c04", 165, 0, -1, -1, 0);
-	_vm->_currentActorNum = 1;
+	_vm->selectActorWayne();
 	_vm->waitSeconds(2);
 	_vm->_isTextVisible = false;
 	_vm->loadRoomBackground();
@@ -7303,11 +7295,11 @@ void GameLogic::r32_pickUpMemo() {
 	_vm->_isTextVisible = false;
 	_vm->waitSeconds(3);
 	_vm->refreshActors();
-	_vm->_currentActorNum = (_vm->_currentActorNum + 1) % 2;
+	_vm->toggleActor();
 	_vm->displayText("c04", 169, 0, -1, -1, 0);
 	_vm->_isTextVisible = false;
 	_vm->waitSeconds(3);
-	_vm->_currentActorNum = (_vm->_currentActorNum + 1) % 2;
+	_vm->toggleActor();
 	_vm->refreshActors();
 }
 
@@ -7740,7 +7732,7 @@ int GameLogic::r37_handleVerbPickUp() {
 		actionTextIndex = 43;
 		break;
 	case kObjectIdMagazines:
-		if (_vm->_currentActorNum != 0) {
+		if (_vm->isActorWayne()) {
 			actionTextIndex = 40;
 		} else {
 			actionTextIndex = 41;
@@ -8429,7 +8421,7 @@ void GameLogic::r39_refreshRoomBackground() {
 
 void GameLogic::r39_useSquirtGunWithHinges() {
 	int oldSpriteX;
-	if (_vm->_currentActorNum != 0) {
+	if (_vm->isActorWayne()) {
 		_vm->walkTo(_vm->_wayneSpriteX - 1, _vm->_wayneSpriteY, _vm->_actorSpriteValue, 60, 135);
 		oldSpriteX = _vm->_wayneSpriteX;
 		_vm->_wayneSpriteX = -1;
@@ -8449,7 +8441,7 @@ void GameLogic::r39_useSquirtGunWithHinges() {
 	_vm->moveObjectToRoom(kObjectIdExit, 39);
 	_r39_flags &= ~0x04;
 	_r39_flags &= ~0x08;
-	if (_vm->_currentActorNum != 0) {
+	if (_vm->isActorWayne()) {
 		_vm->_wayneSpriteX = oldSpriteX;
 	} else {
 		_vm->_garthSpriteX = oldSpriteX;
diff --git a/engines/waynesworld/pathfinding.cpp b/engines/waynesworld/pathfinding.cpp
index 54b6b1032eb..0371b591e8f 100644
--- a/engines/waynesworld/pathfinding.cpp
+++ b/engines/waynesworld/pathfinding.cpp
@@ -373,7 +373,7 @@ bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction
 
     _isTextVisible = false;
 
-    if (_currentActorNum != 0) {
+    if (isActorWayne()) {
         actor1Points = _wayneWalkPoints;
         actor2Points = _garthWalkPoints;
         flag1 = 0;
@@ -471,7 +471,7 @@ bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction
         }
     }
 
-    if (_currentActorNum != 0) {
+    if (isActorWayne()) {
         drawActors(direction, 1, 1, 0, actor1_destX - _scrollPosition, actor1_destY, actor2WalkDestX - _scrollPosition, actor2WalkDestY);
     } else {
         drawActors(direction, 1, 1, 0, actor2WalkDestX - _scrollPosition, actor2WalkDestY, actor1_destX - _scrollPosition, actor1_destY);
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index e72ca64d77c..e60ed9437e3 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -147,9 +147,9 @@ Common::Error WaynesWorldEngine::run() {
 	drawImageToScreen("r00/backg", 0, 0);
 
 	drawInterface(2);
-	changeRoom(1);
+	// changeRoom(0);
 	// _wayneSpriteX = -1; _garthSpriteX = -1;
-	// changeRoom(31); // DEBUG
+	changeRoom(37); // DEBUG
 	// _logic->r31_displayCategories();
 	// _logic->_r1_eventFlag = 1;
 	// _logic->_r1_eventCtr = 3;
@@ -340,7 +340,7 @@ void WaynesWorldEngine::updateMouseMove() {
         if (inventorySlotIndex < _inventoryItemsCount) {
             int inventoryObjectId = _inventoryItemsObjectMap[inventorySlotIndex];
             int itemCount;
-            if (_currentActorNum != 0) {
+            if (isActorWayne()) {
                 itemCount = _wayneInventory[inventoryObjectId - 28];
             } else {
                 itemCount = _garthInventory[inventoryObjectId - 28];
@@ -358,9 +358,9 @@ void WaynesWorldEngine::updateMouseMove() {
     }
 
     // Wayne and Garth
-    if (_gameState == 0 && _currentActorNum != 0 && isPointAtGarth(_mouseX, _mouseY)) {
+    if (_gameState == 0 && isActorWayne() && isPointAtGarth(_mouseX, _mouseY)) {
         drawVerbLine(_verbNumber, -3, "Garth");
-    } else if (_gameState == 0 && _currentActorNum == 0 && isPointAtWayne(_mouseX, _mouseY)) {
+    } else if (_gameState == 0 && isActorGarth() && isPointAtWayne(_mouseX, _mouseY)) {
         drawVerbLine(_verbNumber, -2, "Wayne");
     } else {
         // Room objects
@@ -634,7 +634,7 @@ void WaynesWorldEngine::drawCurrentText(int x, int y, WWSurface *destSurface) {
         textCenterX = x;
         textY = y;
         textColor = 15;
-    } else if (_currentActorNum != 0) {
+    } else if (isActorWayne()) {
         textCenterX = _wayneSpriteX;
         actorY = _wayneSpriteY;
         textColor = 4;
@@ -695,7 +695,7 @@ void WaynesWorldEngine::changeMusic() {
 }
 
 void WaynesWorldEngine::drawInterface(int verbNum) {
-    if (_currentActorNum != 0) {
+    if (isActorWayne()) {
         drawImageToScreen("m00/winter", 0, 151);
     } else {
         drawImageToScreen("m00/ginter", 0, 151);
@@ -740,11 +740,7 @@ void WaynesWorldEngine::selectVerbNumber(int x) {
 void WaynesWorldEngine::changeActor() {
     if (_currentRoomNumber == 31)
         return;
-    if (_currentActorNum != 0) {
-        _currentActorNum = 0;
-    } else {
-        _currentActorNum = 1;
-    }
+	toggleActor();
     drawInterface(_verbNumber);
     _isTextVisible = false;
     refreshInventory(true);
@@ -812,7 +808,7 @@ void WaynesWorldEngine::rememberFirstObjectName(int objectId) {
     } else if (objectId <= 77) {
         int inventoryIndex = objectId - 28;
         int inventoryItemQuantity = 0;
-        if (_currentActorNum != 0) {
+        if (isActorWayne()) {
             inventoryItemQuantity = _wayneInventory[inventoryIndex];
         } else {
             inventoryItemQuantity = _garthInventory[inventoryIndex];
@@ -855,8 +851,8 @@ void WaynesWorldEngine::drawInventory() {
     _inventorySprite->clear(0);
     for (int inventoryItemIndex = 0; inventoryItemIndex < 50; inventoryItemIndex++) {
         int objectRoomNumber = getObjectRoom(inventoryItemIndex + 28);
-        if ((_currentActorNum != 0 && objectRoomNumber == 99 && _wayneInventory[inventoryItemIndex] > 0) ||
-            (_currentActorNum == 0 && objectRoomNumber == 99 && _garthInventory[inventoryItemIndex] > 0)) {
+        if ((isActorWayne() && objectRoomNumber == 99 && _wayneInventory[inventoryItemIndex] > 0) ||
+            (isActorGarth() && objectRoomNumber == 99 && _garthInventory[inventoryItemIndex] > 0)) {
             Common::String filename = Common::String::format("m03/icon%02d", inventoryItemIndex + 1);
 			debug("filename: [%s]", filename.c_str());
             drawImageToSurface(filename.c_str(), _inventorySprite, iconX, iconY);
@@ -908,7 +904,7 @@ int WaynesWorldEngine::getActorScaleFromY(int actorY) {
 
 void WaynesWorldEngine::drawActorReachObject(int objectId, int spriteIndex) {
     int direction = getObjectDirection(objectId);
-    if (_currentActorNum != 0) {
+    if (isActorWayne()) {
         drawActors(direction, 2, 1, spriteIndex, _wayneSpriteX, _wayneSpriteY, _garthSpriteX, _garthSpriteY);
     } else {
         drawActors(direction, 1, 2, spriteIndex, _wayneSpriteX, _wayneSpriteY, _garthSpriteX, _garthSpriteY);
@@ -1100,6 +1096,30 @@ void WaynesWorldEngine::setGarthPosition(int x, int y) {
     _garthSpriteY = y;
 }
 
+bool WaynesWorldEngine::isActorWayne() {
+	return _currentActorNum != 0;
+}
+
+bool WaynesWorldEngine::isActorGarth() {
+	return _currentActorNum == 0;
+}
+
+void WaynesWorldEngine::selectActorWayne() {
+	_currentActorNum = 1;
+}
+
+void WaynesWorldEngine::selectActorGarth() {
+	_currentActorNum = 0;
+}
+
+void WaynesWorldEngine::toggleActor() {
+	if (isActorWayne()) {
+		selectActorGarth();
+	} else {
+		selectActorWayne();
+	}
+}
+
 void WaynesWorldEngine::openRoomLibrary(int roomNum) {
     _roomName = Common::String::format("r%02d", roomNum);
 }
@@ -1151,7 +1171,7 @@ void WaynesWorldEngine::changeRoomScrolling() {
         roomNumber = 14;
         break;
     case 8:
-        if (_currentActorNum != 0) {
+        if (isActorWayne()) {
             _garthSpriteX = 319;
             _garthSpriteY = 131;
         } else {
@@ -1161,7 +1181,7 @@ void WaynesWorldEngine::changeRoomScrolling() {
         roomNumber = 21;
         break;
     case 22:
-        if (_currentActorNum != 0) {
+        if (isActorWayne()) {
             _garthSpriteX = 2;
             _garthSpriteY = 131;
         } else {
@@ -1172,7 +1192,7 @@ void WaynesWorldEngine::changeRoomScrolling() {
         break;
     case 21:
         if (_hoverObjectNumber == kObjectIdFoyer) {
-            if (_currentActorNum != 0) {
+            if (isActorWayne()) {
                 _garthSpriteX = 5;
                 _garthSpriteY = 130;
             } else {
@@ -1181,7 +1201,7 @@ void WaynesWorldEngine::changeRoomScrolling() {
             }
             roomNumber = 8;
         } else {
-            if (_currentActorNum != 0) {
+            if (isActorWayne()) {
                 _garthSpriteX = 319;
                 _garthSpriteY = 131;
             } else {
@@ -1453,7 +1473,7 @@ void WaynesWorldEngine::moveObjectToRoom(int objectId, int roomNum) {
     _roomObjects[objectId].roomNumber = roomNum;
     if (objectId <= 77) {
         int inventoryIndex = objectId - 28;
-        if (_currentActorNum != 0) {
+        if (isActorWayne()) {
             _wayneInventory[inventoryIndex]++;
         } else {
             _garthInventory[inventoryIndex]++;
@@ -1464,7 +1484,7 @@ void WaynesWorldEngine::moveObjectToRoom(int objectId, int roomNum) {
 void WaynesWorldEngine::moveObjectToNowhere(int objectId) {
     if (objectId <= 77) {
         int inventoryIndex = objectId - 28;
-        if (_currentActorNum != 0) {
+        if (isActorWayne()) {
             _wayneInventory[inventoryIndex]--;
         } else {
             _garthInventory[inventoryIndex]--;
@@ -1539,7 +1559,7 @@ void WaynesWorldEngine::drawDialogChoices(int choiceIndex) {
         // Redraw all and clear the background
         _screen->fillRect(0, 151, 319, 199, 0);
     }
-    byte choiceTextColor = _currentActorNum != 0 ? 11 : 10;
+    byte choiceTextColor = isActorWayne() ? 11 : 10;
     byte selectedTextColor = 13;
     for (int index = 0; index < 5 && _dialogChoices[index] != -1; index++) {
         byte textColor = index + choiceIndex + 11 == 0 ? selectedTextColor : choiceTextColor;
@@ -1697,7 +1717,7 @@ void WaynesWorldEngine::handleVerbLookAt() {
 		} else {
 			textIndex = _objectNumber - 27;
 		}
-        if (_currentActorNum != 0) {
+        if (isActorWayne()) {
             displayText("c02w", textIndex, 1, -1, -1, 1);
         } else {
             displayText("c02g", textIndex, 1, -1, -1, 1);
@@ -1803,7 +1823,7 @@ void WaynesWorldEngine::handleVerbTalkTo() {
     _dialogChoices[0] = -1;
 
     if (_objectNumber == -3 || _objectNumber == -2) {
-        bool room1Special = !(_logic->_r1_flags1 & 0x10) && _currentActorNum != 0 && _currentRoomNumber == 1 && (_logic->_r1_flags2 & 0x01);
+        bool room1Special = !(_logic->_r1_flags1 & 0x10) && isActorWayne() && _currentRoomNumber == 1 && (_logic->_r1_flags2 & 0x01);
         if (room1Special) {
             actionTextIndex = 14;
         } else {
@@ -1820,18 +1840,10 @@ void WaynesWorldEngine::handleVerbTalkTo() {
         } else {
             actionTextIndex += 10;
         }
-        if (_currentActorNum != 0) {
-            _currentActorNum = 0;
-        } else {
-            _currentActorNum = 1;
-        }
+		toggleActor();
         loadRoomBackground();
         displayText("c11", actionTextIndex, 0, -1, -1, 0);
-        if (_currentActorNum != 0) {
-            _currentActorNum = 0;
-        } else {
-            _currentActorNum = 1;
-        }
+		toggleActor();
         waitSeconds(2);
         _isTextVisible = false;
         loadRoomBackground();
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 46d2d8fe645..910f1627bd6 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -283,6 +283,11 @@ public:
 	void playAnimation(const char *prefix, int startIndex, int count, int x, int y, int flag, uint ticks);
 	void setWaynePosition(int x, int y);
 	void setGarthPosition(int x, int y);
+	bool isActorWayne();
+	bool isActorGarth();
+	void selectActorWayne();
+	void selectActorGarth();
+	void toggleActor();
 
 	// Pathfinding
 	bool walkIsPixelWalkable(int x, int y);


Commit: b66e7ff1699cc7a149d9df22ebbba75862036fe1
    https://github.com/scummvm/scummvm/commit/b66e7ff1699cc7a149d9df22ebbba75862036fe1
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:52+01:00

Commit Message:
WAYNESWORLD: Add helper functions for inventory access

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 8b84ef364ee..9580c0cfd54 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -2127,10 +2127,10 @@ bool GameLogic::r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		_vm->_gameState = 0;
 		break;
 	case 369: case 384:
-		if (_vm->isActorWayne() && _vm->_wayneInventory[kObjectIdInventoryDollar] < 1) {
+		if (_vm->isActorWayne() && _vm->getWayneInventoryItemQuantity(kObjectIdInventoryDollar) < 1) {
 			replyTextIndex1 = 579;
 			continueDialog = true;
-		} else if (_vm->isActorGarth() && _vm->_garthInventory[kObjectIdInventoryDollar] < 1) {
+		} else if (_vm->isActorGarth() && _vm->getGarthInventoryItemQuantity(kObjectIdInventoryDollar) < 1) {
 			replyTextIndex1 = 579;
 			continueDialog = true;
 		} else {
@@ -2139,10 +2139,10 @@ bool GameLogic::r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		_vm->_gameState = 0;
 		break;
 	case 385:
-		if (_vm->isActorWayne() && _vm->_wayneInventory[kObjectIdInventoryDollar] < 10) {
+		if (_vm->isActorWayne() && _vm->getWayneInventoryItemQuantity(kObjectIdInventoryDollar) < 10) {
 			replyTextIndex1 = 579;
 			continueDialog = true;
-		} else if (_vm->isActorGarth() && _vm->_garthInventory[kObjectIdInventoryDollar] < 10) {
+		} else if (_vm->isActorGarth() && _vm->getGarthInventoryItemQuantity(kObjectIdInventoryDollar) < 10) {
 			replyTextIndex1 = 579;
 			continueDialog = true;
 		} else {
@@ -2198,13 +2198,13 @@ bool GameLogic::r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		continueDialog = true;
 		_r2_flags |= 0x10;
 		if (_vm->isActorWayne()) {
-			if (_vm->_wayneInventory[kObjectIdInventoryDollar] >= 10) {
+			if (_vm->getWayneInventoryItemQuantity(kObjectIdInventoryDollar) >= 10) {
 				_vm->setDialogChoices(379, 366, -1, -1, -1);
 			} else {
 				_vm->setDialogChoices(380, 366, -1, -1, -1);
 			}
 		} else if (_vm->isActorGarth()) {
-			if (_vm->_garthInventory[kObjectIdInventoryDollar] >= 10) {
+			if (_vm->getGarthInventoryItemQuantity(kObjectIdInventoryDollar) >= 10) {
 				_vm->setDialogChoices(379, 366, -1, -1, -1);
 			} else {
 				_vm->setDialogChoices(380, 366, -1, -1, -1);
@@ -4465,9 +4465,9 @@ bool GameLogic::r10_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 				break;
 			case 0: case 1: case 2:
 				_r10_selectedItemToBuy = _vm->_selectedDialogChoice;
-				if (_vm->isActorWayne() && _vm->_wayneInventory[kObjectIdInventoryDollar - 28] == 0) {
+				if (_vm->isActorWayne() && _vm->getWayneInventoryItemQuantity(kObjectIdInventoryDollar) == 0) {
 					_vm->setDialogChoices(8, -1, -1, -1, -1);
-				} else if (_vm->isActorGarth() && _vm->_garthInventory[kObjectIdInventoryDollar - 28] == 0) {
+				} else if (_vm->isActorGarth() && _vm->getGarthInventoryItemQuantity(kObjectIdInventoryDollar) == 0) {
 					_vm->setDialogChoices(8, -1, -1, -1, -1);
 				} else {
 					_vm->setDialogChoices(6, 7, -1, -1, -1);
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index e60ed9437e3..b3aa6130d38 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -129,8 +129,8 @@ Common::Error WaynesWorldEngine::run() {
 	memset(_wayneInventory, 0, sizeof(_wayneInventory));
 	memset(_garthInventory, 0, sizeof(_garthInventory));
 
-    _wayneInventory[kObjectIdInventoryDollar - 28] = 5;
-    _garthInventory[kObjectIdInventoryDrumstick - 28] = 1;
+	setWayneInventoryItemQuantity(kObjectIdInventoryDollar, 5);
+	setGarthInventoryItemQuantity(kObjectIdInventoryDrumstick, 1);
 
 #if 0
 	while (!shouldQuit()) {
@@ -339,18 +339,18 @@ void WaynesWorldEngine::updateMouseMove() {
         int inventorySlotIndex = _mouseY / 20 * 12 + _mouseX / 26;
         if (inventorySlotIndex < _inventoryItemsCount) {
             int inventoryObjectId = _inventoryItemsObjectMap[inventorySlotIndex];
-            int itemCount;
+            int inventoryItemQuantity;
             if (isActorWayne()) {
-                itemCount = _wayneInventory[inventoryObjectId - 28];
+                inventoryItemQuantity = getWayneInventoryItemQuantity(inventoryObjectId);
             } else {
-                itemCount = _garthInventory[inventoryObjectId - 28];
+                inventoryItemQuantity = getGarthInventoryItemQuantity(inventoryObjectId);
             }
             const char *roomObjectName = getRoomObjectName(inventoryObjectId);
             char objectName[32];
-            if (itemCount == 1) {
+            if (inventoryItemQuantity == 1) {
                 sprintf(objectName, "%s", roomObjectName);
             } else {
-                sprintf(objectName, "%d %ss", itemCount, roomObjectName);
+                sprintf(objectName, "%d %ss", inventoryItemQuantity, roomObjectName);
             }
             drawVerbLine(_verbNumber, inventoryObjectId, objectName);
             return;
@@ -738,8 +738,8 @@ void WaynesWorldEngine::selectVerbNumber(int x) {
 }
 
 void WaynesWorldEngine::changeActor() {
-    if (_currentRoomNumber == 31)
-        return;
+	if (_currentRoomNumber == 31)
+		return;
 	toggleActor();
     drawInterface(_verbNumber);
     _isTextVisible = false;
@@ -805,13 +805,12 @@ void WaynesWorldEngine::rememberFirstObjectName(int objectId) {
         _firstObjectName = "Wayne";
     } else if (objectId == -3) {
         _firstObjectName = "Garth";
-    } else if (objectId <= 77) {
-        int inventoryIndex = objectId - 28;
+    } else if (objectId <= kLastInventoryObjectId) {
         int inventoryItemQuantity = 0;
         if (isActorWayne()) {
-            inventoryItemQuantity = _wayneInventory[inventoryIndex];
+            inventoryItemQuantity = getWayneInventoryItemQuantity(objectId);
         } else {
-            inventoryItemQuantity = _garthInventory[inventoryIndex];
+            inventoryItemQuantity = getGarthInventoryItemQuantity(objectId);
         }
         if (inventoryItemQuantity == 1) {
             _firstObjectName = getRoomObjectName(objectId);
@@ -849,8 +848,8 @@ void WaynesWorldEngine::drawInventory() {
     int iconX = 0;
     int iconY = 0;
     _inventorySprite->clear(0);
-    for (int inventoryItemIndex = 0; inventoryItemIndex < 50; inventoryItemIndex++) {
-        int objectRoomNumber = getObjectRoom(inventoryItemIndex + 28);
+    for (int inventoryItemIndex = 0; inventoryItemIndex < kInventorySize; inventoryItemIndex++) {
+        int objectRoomNumber = getObjectRoom(inventoryItemIndex + kFirstInventoryObjectId);
         if ((isActorWayne() && objectRoomNumber == 99 && _wayneInventory[inventoryItemIndex] > 0) ||
             (isActorGarth() && objectRoomNumber == 99 && _garthInventory[inventoryItemIndex] > 0)) {
             Common::String filename = Common::String::format("m03/icon%02d", inventoryItemIndex + 1);
@@ -861,12 +860,28 @@ void WaynesWorldEngine::drawInventory() {
                 iconX = 0;
                 iconY += 20;
             }
-            _inventoryItemsObjectMap[_inventoryItemsCount] = inventoryItemIndex + 28;
+            _inventoryItemsObjectMap[_inventoryItemsCount] = inventoryItemIndex + kFirstInventoryObjectId;
             _inventoryItemsCount++;
         }
     }
 }
 
+void WaynesWorldEngine::setWayneInventoryItemQuantity(int objectId, int quantity) {
+	_wayneInventory[objectId - kFirstInventoryObjectId] = quantity;
+}
+
+void WaynesWorldEngine::setGarthInventoryItemQuantity(int objectId, int quantity) {
+	_garthInventory[objectId - kFirstInventoryObjectId] = quantity;
+}
+
+int WaynesWorldEngine::getWayneInventoryItemQuantity(int objectId) {
+	return _wayneInventory[objectId - kFirstInventoryObjectId];
+}
+
+int WaynesWorldEngine::getGarthInventoryItemQuantity(int objectId) {
+	return _garthInventory[objectId - kFirstInventoryObjectId];
+}
+
 void WaynesWorldEngine::loadMainActorSprites() {
     // _inventorySprite = new WWSurface(312, 52);
 	_wayneReachRightSprite = loadSurface("m01/wreachr");
@@ -1471,8 +1486,8 @@ void WaynesWorldEngine::initRoomObjects() {
 
 void WaynesWorldEngine::moveObjectToRoom(int objectId, int roomNum) {
     _roomObjects[objectId].roomNumber = roomNum;
-    if (objectId <= 77) {
-        int inventoryIndex = objectId - 28;
+    if (objectId <= kLastInventoryObjectId) {
+        int inventoryIndex = objectId - kFirstInventoryObjectId;
         if (isActorWayne()) {
             _wayneInventory[inventoryIndex]++;
         } else {
@@ -1482,8 +1497,8 @@ void WaynesWorldEngine::moveObjectToRoom(int objectId, int roomNum) {
 }
 
 void WaynesWorldEngine::moveObjectToNowhere(int objectId) {
-    if (objectId <= 77) {
-        int inventoryIndex = objectId - 28;
+    if (objectId <= kLastInventoryObjectId) {
+        int inventoryIndex = objectId - kFirstInventoryObjectId;
         if (isActorWayne()) {
             _wayneInventory[inventoryIndex]--;
         } else {
@@ -1531,7 +1546,7 @@ void WaynesWorldEngine::walkToObject() {
         walkTo(_garthSpriteX, _garthSpriteY, _actorSpriteValue, -1, -1);
     } else if (_hoverObjectNumber == -3) {
         walkTo(_wayneSpriteX, _wayneSpriteY, _actorSpriteValue, -1, -1);
-    } else if (_hoverObjectNumber > 77) {
+    } else if (_hoverObjectNumber > kLastInventoryObjectId) {
         const RoomObject *roomObject = getRoomObject(_hoverObjectNumber);
         walkTo(roomObject->walkX, roomObject->walkY, roomObject->direction, -1, -1);
     } else {
@@ -1650,7 +1665,7 @@ void WaynesWorldEngine::handleVerbPickUp() {
     int actionTextIndex = -1;
 
     _isTextVisible = false;
-    if (_objectNumber <= 77) {
+    if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
 
@@ -1702,7 +1717,7 @@ void WaynesWorldEngine::handleVerbPickUp() {
 
 void WaynesWorldEngine::handleVerbLookAt() {
     _isTextVisible = 0;
-    if (_objectNumber <= 77) {
+    if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
     if (_objectNumber == kObjectIdComputer) {
@@ -1729,7 +1744,7 @@ void WaynesWorldEngine::handleVerbUse() {
     int actionTextIndex = -1;
 
     _isTextVisible = false;
-    if (_objectNumber <= 77) {
+    if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
 
@@ -1865,7 +1880,7 @@ void WaynesWorldEngine::handleVerbPush() {
     int actionTextIndex = -1;
 
     _isTextVisible = false;
-    if (_objectNumber <= 77) {
+    if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
 
@@ -1890,7 +1905,7 @@ void WaynesWorldEngine::handleVerbPull() {
     int actionTextIndex = -1;
 
     _isTextVisible = false;
-    if (_objectNumber <= 77) {
+    if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
 
@@ -1921,12 +1936,12 @@ void WaynesWorldEngine::handleVerbGive() {
         return;
     }
 
-    if (_firstObjectNumber >= 28 && _firstObjectNumber <= 77 &&
+    if (_firstObjectNumber >= kFirstInventoryObjectId && _firstObjectNumber <= kLastInventoryObjectId &&
         (_objectNumber == -2 || _objectNumber == -3)) {
         if (_firstObjectNumber == kObjectIdInventoryDrumstick || _firstObjectNumber == kObjectIdInventoryGuitar) {
             displayText("c08", 2, 0, -1, -1, 0);
         } else {
-            int inventoryIndex = _firstObjectNumber - 28;
+            int inventoryIndex = _firstObjectNumber - kFirstInventoryObjectId;
             if (_objectNumber == -3) {
                 _garthInventory[inventoryIndex] += _wayneInventory[inventoryIndex];
                 _wayneInventory[inventoryIndex] = 0;
@@ -1955,7 +1970,7 @@ void WaynesWorldEngine::handleVerbOpen() {
     int actionTextIndex = -1;
 
     _isTextVisible = false;
-    if (_objectNumber <= 77) {
+    if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
 
@@ -1995,7 +2010,7 @@ void WaynesWorldEngine::handleVerbClose() {
     int actionTextIndex = -1;
 
     _isTextVisible = false;
-    if (_objectNumber <= 77) {
+    if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
 
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 910f1627bd6..7d1e2fc2eed 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -94,6 +94,9 @@ const uint kStaticRoomObjectsMapCount = 40;
 const uint kStaticRoomObjectsCount = 58;
 const uint kStaticRoomObjectSpritesCount = 4;
 const uint kAnimationTimersCount = 4;
+const int kInventorySize = 50;
+const int kFirstInventoryObjectId = 28;
+const int kLastInventoryObjectId = 77;
 
 class WaynesWorldEngine : public Engine {
 protected:
@@ -182,9 +185,9 @@ public:
 	// Inventory
 	WWSurface *_inventorySprite;
 	int _inventoryItemsCount;
-	int _inventoryItemsObjectMap[50];
-	int _wayneInventory[50];
-	int _garthInventory[50];
+	int _inventoryItemsObjectMap[kInventorySize];
+	int _wayneInventory[kInventorySize];
+	int _garthInventory[kInventorySize];
 
 	// Dialog
 	int _selectedDialogChoice;
@@ -271,6 +274,10 @@ public:
 	void redrawInventory();
 	void refreshInventory(bool doRefresh);
 	void drawInventory();
+	void setWayneInventoryItemQuantity(int objectId, int quantity);
+	void setGarthInventoryItemQuantity(int objectId, int quantity);
+	int getWayneInventoryItemQuantity(int objectId);
+	int getGarthInventoryItemQuantity(int objectId);
 
 	// Actors and animations
 	void loadMainActorSprites();


Commit: 6615e5ba33c0a7a116f864a94f690999dcb42fed
    https://github.com/scummvm/scummvm/commit/6615e5ba33c0a7a116f864a94f690999dcb42fed
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:52+01:00

Commit Message:
WAYNESWORLD: Implement fillRoomMaskArea

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 9580c0cfd54..f16491acaee 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -1705,13 +1705,13 @@ void GameLogic::r1_refreshRoomBackground() {
 		if (!(_r1_flags2 & 0x08)) {
 			_vm->moveObjectToRoom(kObjectIdDrGadget_0, 1);
 			_vm->drawRoomImageToBackground("gadget2", 127, 82);
-			_vm->fillRoomMaskArea(100, 0, 319, 149, 1);
+			_vm->fillRoomMaskArea(100, 0, 319, 149, true);
 		} else {
 			_vm->moveObjectToNowhere(kObjectIdDrGadget_0);
 			if (!(_r1_flags2 & 0x04)) {
 				_vm->moveObjectToRoom(kObjectIdExtensionCord_0, 1);
 			} else {
-				_vm->fillRoomMaskArea(175, 0, 319, 149, 1);
+				_vm->fillRoomMaskArea(175, 0, 319, 149, true);
 			}
 		}
 		if (!(_r1_flags1 & 0x08)) {
@@ -1803,7 +1803,7 @@ void GameLogic::r1_handleRoomEvent(bool startTongueTrick) {
 		break;
 	case 1:
 		_vm->walkTo(209, 120, 7, 151, 127);
-		_vm->fillRoomMaskArea(0, 0, 180, 149, 1);
+		_vm->fillRoomMaskArea(0, 0, 180, 149, true);
 		_vm->_garthSpriteX = -1;
 		_vm->playAnimation("tt0", 0, 12, 119, 81, 0, 150);
 		break;
@@ -3109,8 +3109,8 @@ void GameLogic::r6_updateRoomAnimations() {
 void GameLogic::r6_refreshRoomBackground() {
 	if (!(_r6_flags & 0x01)) {
 		_vm->drawRoomImageToBackground("sitdog0", 49, 111);
-		_vm->fillRoomMaskArea(65, 110, 106, 124, 0);
-		_vm->fillRoomMaskArea(96, 111, 125, 123, 1);
+		_vm->fillRoomMaskArea(65, 110, 106, 124, false);
+		_vm->fillRoomMaskArea(96, 111, 125, 123, true);
 	}
 	if (_r6_flags & 0x02) {
 		_vm->drawRoomImageToBackground("norope", 49, 111);
@@ -3206,8 +3206,8 @@ void GameLogic::r6_giveLuckySausageToDog() {
 	_vm->moveObjectToRoom(kObjectIdRope_0, 6);
 	_vm->moveObjectToNowhere(kObjectIdInventoryLuckySausage);
 	_vm->refreshInventory(true);
-	_vm->fillRoomMaskArea(65, 110, 106, 124, 0);
-	_vm->fillRoomMaskArea(96, 111, 125, 123, 1);
+	_vm->fillRoomMaskArea(65, 110, 106, 124, false);
+	_vm->fillRoomMaskArea(96, 111, 125, 123, true);
 }
 
 void GameLogic::r6_useRopeWithBeam() {
@@ -4764,8 +4764,8 @@ void GameLogic::r11_useSuckCutWithFountain() {
 	_vm->moveObjectToRoom(kObjectIdManholeCover, 11);
 	_r11_flags &= ~0x04;
 	_vm->setStaticRoomObjectPosition(_vm->_currentRoomNumber, 0, 0, 97, 106);
-	_vm->fillRoomMaskArea(117, 110, 140, 130, 0);
-	_vm->fillRoomMaskArea(81, 131, 119, 148, 1);
+	_vm->fillRoomMaskArea(117, 110, 140, 130, false);
+	_vm->fillRoomMaskArea(81, 131, 119, 148, true);
 	r11_useCar1();
 	_vm->loadRoomBackground();
 }
@@ -6029,13 +6029,13 @@ void GameLogic::r24_refreshRoomBackground() {
 			_vm->drawRoomImageToBackground(holeFilename.c_str(), kRoom24MazeHolePositionsX[holeIndex], kRoom24MazeHolePositionsY[holeIndex]);
 			if (holeIndex == 0) {
 				_vm->setStaticRoomObjectPosition(24, 0, 0, 95, 18);
-				_vm->fillRoomMaskArea(87, 128, 116, 136, 1);
+				_vm->fillRoomMaskArea(87, 128, 116, 136, true);
 			} else if (holeIndex == 1) {
 				_vm->setStaticRoomObjectPosition(24, 1, 1, 206, 18);
-				_vm->fillRoomMaskArea(199, 128, 227, 136, 1);
+				_vm->fillRoomMaskArea(199, 128, 227, 136, true);
 			} else if (holeIndex == 6) {
 				_vm->setStaticRoomObjectPosition(24, 2, 2, 95, 26);
-				_vm->fillRoomMaskArea(58, 128, 147, 146, 1);
+				_vm->fillRoomMaskArea(58, 128, 147, 146, true);
 			}
 		} else {
 			_vm->moveObjectToNowhere(kObjectIdOpening_0 + holeIndex);
@@ -7263,7 +7263,7 @@ void GameLogic::r32_updateRoomAnimations() {
 void GameLogic::r32_refreshRoomBackground() {
 	if (!(_pizzathonListFlags2 & 0x08)) {
 		_vm->drawRoomImageToBackground("cdoor", 13, 65);
-		_vm->fillRoomMaskArea(0, 0, 33, 149, 1);
+		_vm->fillRoomMaskArea(0, 0, 33, 149, true);
 	} else {
 		_vm->moveObjectToNowhere(kObjectIdDoor32_0);
 		_vm->moveObjectToRoom(kObjectIdOffice, 32);
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index b3aa6130d38..e856ffb5a18 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -149,7 +149,7 @@ Common::Error WaynesWorldEngine::run() {
 	drawInterface(2);
 	// changeRoom(0);
 	// _wayneSpriteX = -1; _garthSpriteX = -1;
-	changeRoom(37); // DEBUG
+	changeRoom(1); // DEBUG
 	// _logic->r31_displayCategories();
 	// _logic->_r1_eventFlag = 1;
 	// _logic->_r1_eventCtr = 3;
@@ -1345,8 +1345,18 @@ void WaynesWorldEngine::loadRoomMask(int roomNum) {
 	fd.read(_walkMap, kWalkMapSize);
 }
 
-void WaynesWorldEngine::fillRoomMaskArea(int x1, int y1, int x2, int y2, int enabled) {
-	// TODO
+void WaynesWorldEngine::fillRoomMaskArea(int x1, int y1, int x2, int y2, bool blocked) {
+	for (int y = y1; y <= y2; y++) {
+		for (int x = x1; x <= x2; x++) {
+			int offset = (y * 40) + (x / 8);
+			byte value = 0x80 >> (x % 8);
+			if (blocked) {
+				_walkMap[offset] &= ~value;
+			} else {
+				_walkMap[offset] |= value;
+			}
+		}
+	}
 }
 
 void WaynesWorldEngine::loadAnimationSpriteRange(int baseIndex, const char *filename, int count) {
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 7d1e2fc2eed..86202eb5fd7 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -319,7 +319,7 @@ public:
 	void loadScrollSprite();
 	void scrollRoom();
 	void loadRoomMask(int roomNum);
-	void fillRoomMaskArea(int x1, int y1, int x2, int y2, int enabled);
+	void fillRoomMaskArea(int x1, int y1, int x2, int y2, bool blocked);
 
 	// Room animations
 	void loadAnimationSpriteRange(int baseIndex, const char *filename, int count);


Commit: 27120cd17a7223f119db27060e9b8be5940b8c20
    https://github.com/scummvm/scummvm/commit/27120cd17a7223f119db27060e9b8be5940b8c20
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:52+01:00

Commit Message:
WAYNESWORLD: Replace for-loops/playAnimation with playAnimationLoops

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index f16491acaee..9e92a7dcb68 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -519,122 +519,76 @@ void GameLogic::handleDialogReply(int index, int x, int y) {
     switch (_vm->_currentRoomNumber) {
     case 2:
         if (index < 300) {
-            for (int i = 0; i < 4; i++) {
-                _vm->playAnimation("btalk", 0, 2, 95, 72, 0, 100);
-            }
+            _vm->playAnimationLoops("btalk", 0, 2, 95, 72, 0, 100, 4);
         } else {
-            for (int i = 0; i < 4; i++) {
-                _vm->playAnimation("wait", 0, 2, 237, 69, 0, 100);
-            }
+            _vm->playAnimationLoops("wait", 0, 2, 237, 69, 0, 100, 4);
         }
         break;
     case 4:
-        for (int i = 0; i < 4; i++) {
-            _vm->playAnimation("btalk", 1, -2, 146, 45, 0, 100);
-        }
+        _vm->playAnimationLoops("btalk", 1, -2, 146, 45, 0, 100, 4);
         break;
     case 6:
         if (index < 154) {
-            for (int i = 0; i < 4; i++) {
-                _vm->playAnimation("cindi", 4, 2, 143, 55, 0, 100);
-            }
+            _vm->playAnimationLoops("cindi", 4, 2, 143, 55, 0, 100, 4);
         }
         break;
     case 13:
         if (index > 400) {
-            for (int i = 0; i < 4; i++) {
-                _vm->playAnimation("ctalk", 0, 2, 85, 73, 0, 100);
-            }
+            _vm->playAnimationLoops("ctalk", 0, 2, 85, 73, 0, 100, 4);
         } else {
-            for (int i = 0; i < 4; i++) {
-                _vm->playAnimation("ptalk", 0, 2, 72, 60, 0, 100);
-            }
+            _vm->playAnimationLoops("ptalk", 0, 2, 72, 60, 0, 100, 4);
         }
         break;
     case 9:
         if (index < 192) {
-            for (int i = 0; i < 4; i++) {
-                _vm->playAnimation("talk", 0, 2, 92, 60, 0, 100);
-            }
+            _vm->playAnimationLoops("talk", 0, 2, 92, 60, 0, 100, 4);
         } else {
-            for (int i = 0; i < 4; i++) {
-                _vm->playAnimation("mtalk", 0, 2, 215, 60, 0, 100);
-            }
+            _vm->playAnimationLoops("mtalk", 0, 2, 215, 60, 0, 100, 4);
         }
         break;
     case 10:
-        for (int i = 0; i < 4; i++) {
-            _vm->playAnimation("talk", 0, 8, 153, 30, 1, 100);
-        }
+        _vm->playAnimationLoops("talk", 0, 8, 153, 30, 1, 100, 4);
         break;
     case 23:
-        for (int i = 0; i < 4; i++) {
-            _vm->playAnimation("talk", 0, 2, 75, 63, 0, 100);
-        }
+        _vm->playAnimationLoops("talk", 0, 2, 75, 63, 0, 100, 4);
         break;
     case 19:
-        for (int i = 0; i < 4; i++) {
-            _vm->playAnimation("gill", 1, -2, 273, 84, 0, 100);
-        }
+        _vm->playAnimationLoops("gill", 1, -2, 273, 84, 0, 100, 4);
         break;
     case 20:
-        for (int i = 0; i < 4; i++) {
-            _vm->playAnimation("mtalk", 0, 2, 184, 68, 0, 100);
-        }
+        _vm->playAnimationLoops("mtalk", 0, 2, 184, 68, 0, 100, 4);
         break;
     case 12:
         if (index < 236) {
-            for (int i = 0; i < 4; i++) {
-                _vm->playAnimation("lawyer", 6, -2, 55, 84, 0, 100);
-            }
+            _vm->playAnimationLoops("lawyer", 6, -2, 55, 84, 0, 100, 4);
         } else if (index < 238) {
-            for (int i = 0; i < 4; i++) {
-                _vm->playAnimation("man1", 0, 2, 108, 83, 0, 100);
-            }
+            _vm->playAnimationLoops("man1", 0, 2, 108, 83, 0, 100, 4);
         } else if (index < 240) {
-            for (int i = 0; i < 4; i++) {
-                _vm->playAnimation("man3", 0, 2, 168, 84, 0, 100);
-            }
+            _vm->playAnimationLoops("man3", 0, 2, 168, 84, 0, 100, 4);
         } else if (index < 242) {
-            for (int i = 0; i < 4; i++) {
-                _vm->playAnimation("man4", 0, 2, 190, 84, 0, 100);
-            }
+            _vm->playAnimationLoops("man4", 0, 2, 190, 84, 0, 100, 4);
         }
         break;
     case 8:
-        for (int i = 0; i < 4; i++) {
-            _vm->playAnimation("mtalk", 0, 2, 195, 69, 0, 100);
-        }
+        _vm->playAnimationLoops("mtalk", 0, 2, 195, 69, 0, 100, 4);
         break;
     case 32:
-        for (int i = 0; i < 4; i++) {
-            _vm->playAnimation("jtalk", 0, 2, 262, 84, 0, 100);
-        }
+        _vm->playAnimationLoops("jtalk", 0, 2, 262, 84, 0, 100, 4);
         break;
     case 30:
-        for (int i = 0; i < 4; i++) {
-            _vm->playAnimation("ctalk", 0, 2, 183, 107, 0, 100);
-        }
+        _vm->playAnimationLoops("ctalk", 0, 2, 183, 107, 0, 100, 4);
         break;
     case 28:
-        for (int i = 0; i < 4; i++) {
-            _vm->playAnimation("reptalk", 0, 6, 26, 51, 1, 100);
-        }
+        _vm->playAnimationLoops("reptalk", 0, 6, 26, 51, 1, 100, 4);
         break;
     case 34:
-        for (int i = 0; i < 4; i++) {
-            _vm->playAnimation("talk", 0, 2, 203, 73, 0, 100);
-        }
+        _vm->playAnimationLoops("talk", 0, 2, 203, 73, 0, 100, 4);
         break;
     case 35:
-        for (int i = 0; i < 4; i++) {
-            _vm->playAnimation("cass", 0, 2, 179, 68, 0, 100);
-        }
+        _vm->playAnimationLoops("cass", 0, 2, 179, 68, 0, 100, 4);
         break;
     case 17:
-        for (int i = 0; i < 4; i++) {
-            _vm->playAnimation("g1talk", 0, 2, 54, 81, 0, 100);
-        }
+		_vm->playAnimationLoops("g1talk", 0, 2, 54, 81, 0, 100, 4);
         break;
     default:
         _vm->waitSeconds(2);
@@ -2288,18 +2242,14 @@ void GameLogic::r2_giveCandyBarToBikerGang() {
 	_vm->refreshInventory(false);
 	_vm->changeRoom(_vm->_currentRoomNumber);
 	for (int textIndex = 288; textIndex < 291; textIndex++) {
-		for (int i = 0; i < 4; i++) {
-			_vm->playAnimation("btalk", 0, 2, 95, 72, 0, 100);
-		}
+		_vm->playAnimationLoops("btalk", 0, 2, 95, 72, 0, 100, 4);
 		_vm->displayTextLines("c04r", textIndex, 70, 30, 1);
 	}
 	_vm->playAnimation("givech", 0, 2, 94, 70, 0, 150);
 	_vm->moveObjectToRoom(kObjectIdInventoryChain, 99);
 	_vm->refreshInventory(false);
 	_vm->changeRoom(_vm->_currentRoomNumber);
-	for (int i = 0; i < 4; i++) {
-		_vm->playAnimation("btalk", 0, 2, 95, 72, 0, 100);
-	}
+	_vm->playAnimationLoops("btalk", 0, 2, 95, 72, 0, 100, 4);
 	_vm->displayTextLines("c04r", 291, 70, 30, 1);
 }
 
@@ -3131,9 +3081,7 @@ void GameLogic::r6_refreshRoomBackground() {
 
 void GameLogic::r6_handleRoomEvent1() {
 	_vm->displayTextLines("c04", 208, -1, -1, 3);
-	for (int i = 0; i < 4; i++) {
-		_vm->playAnimation("cindi", 4, 2, 143, 55, 0, 100);
-	}
+	_vm->playAnimationLoops("cindi", 4, 2, 143, 55, 0, 100, 4);
 	_vm->displayTextLines("c04r", 141, 160, 10, 1);
 	_vm->setDialogChoices(211, 212, 213, 214, -1);
 	_vm->startDialog();
@@ -3141,19 +3089,13 @@ void GameLogic::r6_handleRoomEvent1() {
 
 void GameLogic::r6_handleRoomEvent2() {
 	_vm->displayTextLines("c04", 215, -1, -1, 1);
-	for (int i = 0; i < 4; i++) {
-	  _vm->playAnimation("cindi", 4, 2, 143, 55, 0, 100);
-	}
+	_vm->playAnimationLoops("cindi", 4, 2, 143, 55, 0, 100, 4);
 	_vm->displayTextLines("c04r", 147, 160, 10, 1);
 	_vm->displayTextLines("c04", 216, -1, -1, 1);
-	for (int i = 0; i < 10; i++) {
-		_vm->playAnimation("cindi", 4, 2, 143, 55, 0, 100);
-	}
+	_vm->playAnimationLoops("cindi", 4, 2, 143, 55, 0, 100, 10);
 	_vm->displayTextLines("c04r", 148, 160, 10, 4);
 	_vm->displayTextLines("c04", 217, -1, -1, 1);
-	for (int i = 0; i < 7; i++) {
-		_vm->playAnimation("cindi", 4, 2, 143, 55, 0, 100);
-	}
+	_vm->playAnimationLoops("cindi", 4, 2, 143, 55, 0, 100, 7);
 	_vm->displayTextLines("c04r", 152, 160, 10, 2);
 	_vm->playAnimation("cindi", 4, -5, 143, 55, 0, 100);
 	_vm->playAnimation("raiseg", 12, -13, 133, 46, 0, 150);
@@ -3243,16 +3185,12 @@ void GameLogic::r6_useSeat() {
 void GameLogic::r6_pullRope() {
 	_vm->playAnimation("raiseg", 0, 13, 133, 46, 0, 150);
 	_vm->_wayneSpriteX = -1;
-	for (int i = 0; i < 5; i++) {
-		_vm->playAnimation("knock", 0, 2, 148, 61, 0, 100);
-	}
+	_vm->playAnimationLoops("knock", 0, 2, 148, 61, 0, 100, 5);
 	_vm->waitSeconds(1);
 	_vm->selectActorGarth();
 	_vm->playAnimation("cindi", 0, 5, 143, 55, 0, 100);
 	_vm->displayText("c04r", 138, 0, 160, 10, 0);
-	for (int i = 0; i < 5; i++) {
-		_vm->playAnimation("cindi", 4, 2, 143, 55, 0, 100);
-	}
+	_vm->playAnimationLoops("cindi", 4, 2, 143, 55, 0, 100, 5);
 	_vm->waitSeconds(2);
 	_vm->setDialogChoices(202, 203, 204, -1, -1);
 	_vm->startDialog();
@@ -4009,9 +3947,7 @@ void GameLogic::r9_handleVerbTalkTo() {
 		if (!(_r9_flags & 0x02)) {
 			_vm->displayTextLines("c04", 245, -1, -1, 1);
 			_vm->displayTextLines("c04r", 192, 250, 25, 1);
-			for (int i = 0; i < 8; i++) {
-				_vm->playAnimation("utrick", 0, 2, 206, 58, 0, 100);
-			}
+			_vm->playAnimationLoops("utrick", 0, 2, 206, 58, 0, 100, 8);
 			_vm->loadRoomBackground();
 			_vm->displayTextLines("c04r", 193, 250, 25, 1);
 			_vm->setDialogChoices(246, 247, 248, 249, 250);
@@ -4205,9 +4141,7 @@ void GameLogic::r9_giveCoatOrTopHatToMan() {
 	} else {
 		_vm->displayTextLines("c04r", 200, 250, 25, 2);
 		_vm->playAnimation("strick", 0, 17, 191, 32, 0, 100);
-		for (int i = 0; i < 5; i++) {
-			_vm->playAnimation("strick", 16, -2, 191, 32, 0, 100);
-		}
+		_vm->playAnimationLoops("strick", 16, -2, 191, 32, 0, 100, 5);
 		_vm->playAnimation("strick", 14, -15, 191, 32, 0, 100);
 		_vm->loadRoomBackground();
 		_vm->displayTextLines("c04r", 202, 250, 25, 1);
@@ -4882,21 +4816,15 @@ void GameLogic::r12_handleVerbTalkTo() {
 		_vm->displayTextLines("c04", 284, -1, -1, 1);
 		break;
 	case kObjectIdCecil:
-		for (int i = 0; i < 4; i++) {
-			_vm->playAnimation("ctalk", 0, 2, 203, 85, 0, 100);
-		}
+		_vm->playAnimationLoops("ctalk", 0, 2, 203, 85, 0, 100, 4);
 		_vm->displayTextLines("c04r", 358, 250, 20, 1);
 		if (_vm->getObjectRoom(kObjectIdInventoryPotatoChip) == 99) {
 			_vm->displayTextLines("c04", 52, -1, -1, 1);
-			for (int i = 0; i < 4; i++) {
-				_vm->playAnimation("ctalk", 0, 2, 203, 85, 0, 100);
-			}
+			_vm->playAnimationLoops("ctalk", 0, 2, 203, 85, 0, 100, 4);
 			_vm->displayTextLines("c04r", 359, 250, 20, 1);
 		} else {
 			_vm->displayTextLines("c04", 341, -1, -1, 1);
-			for (int i = 0; i < 4; i++) {
-				_vm->playAnimation("ctalk", 0, 2, 203, 85, 0, 100);
-			}
+			_vm->playAnimationLoops("ctalk", 0, 2, 203, 85, 0, 100, 4);
 			_vm->displayTextLines("c04r", 360, 250, 20, 1);
 		}
 		break;
@@ -5041,16 +4969,12 @@ void GameLogic::r12_givePotatoChipToCecil() {
 	_vm->refreshInventory(true);
 	setPizzathonStatus(5);
 	for (int textIndex = 361; textIndex < 363; textIndex++) {
-		for (int i = 0; i < 4; i++) {
-			_vm->playAnimation("ctalk", 0, 2, 203, 85, 0, 100);
-		}
+		_vm->playAnimationLoops("ctalk", 0, 2, 203, 85, 0, 100, 4);
 		_vm->displayTextLines("c04r", textIndex, 250, 20, 1);
 	}
 	_vm->displayTextLines("c04", 342, -1, -1, 1);
 	for (int textIndex = 363; textIndex < 365; textIndex++) {
-		for (int i = 0; i < 4; i++) {
-			_vm->playAnimation("ctalk", 0, 2, 203, 85, 0, 100);
-		}
+		_vm->playAnimationLoops("ctalk", 0, 2, 203, 85, 0, 100, 4);
 		_vm->displayTextLines("c04r", textIndex, 250, 20, 1);
 	}
 	_vm->playAnimation("cwalk", 0, 13, 198, 84, 0, 100);
@@ -6509,9 +6433,7 @@ void GameLogic::r29_refreshRoomBackground() {
 }
 
 void GameLogic::r29_handleRoomEvent() {
-	for (int i = 0; i < 4; i++) {
-		_vm->playAnimation("doc", 0, 2, 138, 69, 0, 100);
-	}
+	_vm->playAnimationLoops("doc", 0, 2, 138, 69, 0, 100, 4);
 	_vm->displayTextLines("c04r", 365, 200, 30, 1);
 }
 
@@ -7531,9 +7453,7 @@ bool GameLogic::r35_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 	switch (_vm->_selectedDialogChoice) {
 	case 328: case 329: case 330:
 		for (int textIndex = 323; textIndex < 326; textIndex++) {
-			for (int i = 0; i < 4; i++) {
-				_vm->playAnimation("cass", 0, 2, 179, 68, 0, 100);
-			}
+			_vm->playAnimationLoops("cass", 0, 2, 179, 68, 0, 100, 4);
 			_vm->displayTextLines("c04r", textIndex, replyTextX, replyTextY, 1);
 		}
 		replyTextIndex1 = 326;
@@ -7607,17 +7527,13 @@ void GameLogic::r35_refreshRoomBackground() {
 void GameLogic::r35_talkToCassandra() {
 	_vm->_gameState = 7;
 	if (_r35_flags & 0x02) {
-		for (int i = 0; i < 4; i++) {
-			_vm->playAnimation("cass", 0, 2, 179, 68, 0, 100);
-		}
+		_vm->playAnimationLoops("cass", 0, 2, 179, 68, 0, 100, 4);
 		_vm->displayTextLines("c04r", 342, 150, 20, 1);
 		if (_vm->getObjectRoom(kObjectIdInventory50000) == 99) {
 			_vm->walkTo(217, 112, 5, 230, 115);
 			_vm->displayTextLines("c04", 339, -1, -1, 1);
 			for (int textIndex = 335; textIndex < 337; textIndex++) {
-				for (int i = 0; i < 4; i++) {
-					_vm->playAnimation("cass", 0, 2, 179, 68, 0, 100);
-				}
+				_vm->playAnimationLoops("cass", 0, 2, 179, 68, 0, 100, 4);
 				_vm->displayTextLines("c04r", textIndex, 150, 20, 1);
 			}
 			if (_vm->getObjectRoom(kObjectIdInventorySetOfKeys) == 99 && (_r38_flags & 0x01)) {
@@ -7630,9 +7546,7 @@ void GameLogic::r35_talkToCassandra() {
 	} else {
 		_r35_flags |= 0x02;
 		for (int textIndex = 317; textIndex < 323; textIndex++) {
-			for (int i = 0; i < 4; i++) {
-				_vm->playAnimation("cass", 0, 2, 179, 68, 0, 100);
-			}
+			_vm->playAnimationLoops("cass", 0, 2, 179, 68, 0, 100, 4);
 			_vm->displayTextLines("c04r", textIndex, 150, 20, 1);
 		}
 		_vm->walkTo(217, 112, 5, 230, 115);
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index e856ffb5a18..bb098d1e7c2 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -1076,23 +1076,23 @@ void WaynesWorldEngine::pickupObject(int objectId, byte &flags, byte flagsSet, i
 void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int count, int x, int y, int flag, uint ticks) {
     char filename[32];
     // sysMouseDriver(2);
-    if (count > 0) {
-        for (int index = startIndex; index < startIndex + count; index++) {
-            updateRoomAnimations();
-            sprintf(filename, "%s%d", prefix, index);
-            drawRoomImageToScreen(filename, x, y);
-            drawRoomImageToBackground(filename, x, y);
-            waitMillis(ticks);
-        }
-    } else {
-        for (int index = startIndex; index > startIndex + count; index--) {
-            updateRoomAnimations();
-            sprintf(filename, "%s%d", prefix, index);
-            drawRoomImageToScreen(filename, x, y);
-            drawRoomImageToBackground(filename, x, y);
-            waitMillis(ticks);
-        }
-    }
+	if (count > 0) {
+		for (int index = startIndex; index < startIndex + count; index++) {
+			updateRoomAnimations();
+			sprintf(filename, "%s%d", prefix, index);
+			drawRoomImageToScreen(filename, x, y);
+			drawRoomImageToBackground(filename, x, y);
+			waitMillis(ticks);
+		}
+	} else {
+		for (int index = startIndex; index > startIndex + count; index--) {
+			updateRoomAnimations();
+			sprintf(filename, "%s%d", prefix, index);
+			drawRoomImageToScreen(filename, x, y);
+			drawRoomImageToBackground(filename, x, y);
+			waitMillis(ticks);
+		}
+	}
     if (flag) {
         sprintf(filename, "%s%d", prefix, startIndex);
         drawRoomImageToScreen(filename, x, y);
@@ -1101,6 +1101,12 @@ void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int co
     // sysMouseDriver(1)
 }
 
+void WaynesWorldEngine::playAnimationLoops(const char *prefix, int startIndex, int count, int x, int y, int flag, uint ticks, int loopCount) {
+	for (int loop = 0; loop < loopCount; loop++) {
+		playAnimation(prefix, startIndex, count, x, y, flag, ticks);
+	}
+}
+
 void WaynesWorldEngine::setWaynePosition(int x, int y) {
     _wayneSpriteX = x;
     _wayneSpriteY = y;
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 86202eb5fd7..d78c2653411 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -288,6 +288,7 @@ public:
 	void refreshActors();
 	void pickupObject(int objectId, byte &flags, byte flagsSet, int inventoryObjectId);
 	void playAnimation(const char *prefix, int startIndex, int count, int x, int y, int flag, uint ticks);
+	void playAnimationLoops(const char *prefix, int startIndex, int count, int x, int y, int flag, uint ticks, int loopCount);
 	void setWaynePosition(int x, int y);
 	void setGarthPosition(int x, int y);
 	bool isActorWayne();


Commit: b3ce16bd70aba38c085178a9ccb90091d25fe3f3
    https://github.com/scummvm/scummvm/commit/b3ce16bd70aba38c085178a9ccb90091d25fe3f3
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:52+01:00

Commit Message:
WAYNESWORLD: Add comments to silence fall-through warnings

Changed paths:
    engines/waynesworld/gamelogic.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 9e92a7dcb68..86696761292 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -4048,6 +4048,7 @@ bool GameLogic::r9_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 	case 241:
 		replyTextIndex1 = 189;
 		setPizzathonStatus(6);
+		// Fall-through
 	case 242:
 		_vm->_gameState = 0;
 		break;
@@ -4411,11 +4412,13 @@ bool GameLogic::r10_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 				break;
 			case 6:
 				r10_buyItem();
+				// Fall-through
 			case 4:
 				_vm->_gameState = 0;
 				break;
 			case 8:
 				replyTextIndex1 = 4;
+				// Fall-through
 			case 7:
 				_r10_selectedItemToBuy = -1;
 				handleVerbTalkTo();
@@ -5459,6 +5462,7 @@ bool GameLogic::r17_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		break;
 	case 315:
 		_r17_dialogCtr = _r17_dialogCtr + 1;
+		// Fall-through
 	case 312: case 313: case 314:
 		replyTextIndex1 = 307;
 		replyTextIndex2 = 308;
@@ -5468,6 +5472,7 @@ bool GameLogic::r17_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		break;
 	case 317:
 		_r17_dialogCtr = _r17_dialogCtr + 1;
+		// Fall-through
 	case 316: case 318: case 319:
 		replyTextIndex1 = 310;
 		replyTextIndex2 = 311;
@@ -5476,6 +5481,7 @@ bool GameLogic::r17_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		break;
 	case 322:
 		_r17_dialogCtr = _r17_dialogCtr + 1;
+		// Fall-through
 	case 320: case 321: case 323:
 		replyTextIndex1 = 312;
 		replyTextIndex2 = 313;
@@ -5484,6 +5490,7 @@ bool GameLogic::r17_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		break;
 	case 324:
 		_r17_dialogCtr = _r17_dialogCtr + 1;
+		// Fall-through
 	case 325: case 326: case 327:
 		if (_r17_dialogCtr != 4) {
 			replyTextIndex1 = 314;


Commit: 8ca2435d78c322faf1124ddb947d195fdb62dc27
    https://github.com/scummvm/scummvm/commit/8ca2435d78c322faf1124ddb947d195fdb62dc27
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:52+01:00

Commit Message:
WAYNESWORLD: Fix setStaticRoomObjectPosition to include endIndex

Changed paths:
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index bb098d1e7c2..99b49436ff1 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -1472,7 +1472,7 @@ void WaynesWorldEngine::setStaticRoomObjectPosition(int roomNum, int fromIndex,
 	int startIndex = kStaticRoomObjectsMap[roomNum].index + fromIndex;
 	int endIndex = kStaticRoomObjectsMap[roomNum].index + toIndex;
 	unloadStaticRoomObjects();
-	for (int index = startIndex; index < endIndex; index++) {
+	for (int index = startIndex; index <= endIndex; index++) {
 		StaticRoomObject &roomObject = _staticRoomObjects[index];
 		roomObject.x1 = x;
 		roomObject.y1 = y;


Commit: 2f5f559babb234fbc5e50b99b3ec9406394a9933
    https://github.com/scummvm/scummvm/commit/2f5f559babb234fbc5e50b99b3ec9406394a9933
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:52+01:00

Commit Message:
WAYNESWORLD: Process user input in room 31 ('Babeoff')

Changed paths:
    engines/waynesworld/gamelogic.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 86696761292..70a1f7bd6b6 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -6802,14 +6802,7 @@ void GameLogic::r31_handleRoomEvent4() {
 		_r31_askedQuestions[_r31_categoryIndex * 5 + _r31_questionIndex] = true;
 		_vm->drawRoomImageToBackground("star", kRoom31StarPositionsX[_r31_categoryIndex], kRoom31StarPositionsY[_r31_categoryIndex * 5 + _r31_questionIndex]);
 
-        // Wait for mouse release
-		//sysMouseDriver(5, 1);
-		while (_vm->_mouseClickButtons != 0) {
-			_vm->_mouseClickButtons = 0;
-			//sysMouseDriver(5, 1);
-			//sysMouseDriver(5, 2);
-			//updateKeyInput();
-		}
+		_vm->_mouseClickButtons = 0;
 
 		_vm->displayText("gms", _r31_categoryIndex * 5 + _r31_questionIndex, 0, 50, 10, 0);
 		_vm->playAnimation("rdcard", 0, 6, 155, 30, 0, 300);
@@ -6818,11 +6811,16 @@ void GameLogic::r31_handleRoomEvent4() {
 		_r31_questionsAsked++;
 		_vm->_isTextVisible = false;
 		_vm->refreshActors();
-		_vm->waitMillis(_vm->getRandom(1300) + 200);
-		//sysMouseDriver(3);
 
-		//sysMouseDriver(5, 1);
-		if (_vm->_mouseClickButtons != 0 && _vm->_mouseX > 130 && _vm->_mouseX < 180 && _vm->_mouseY > 106 && _vm->_mouseY < 128) {
+		// Give the player some time to press the buzzer by clicking the mouse
+		uint32 timeOutTicks = _vm->_system->getMillis() + (uint32)_vm->getRandom(1300) + 200;
+		while (_vm->_system->getMillis() < timeOutTicks && _vm->_mouseClickButtons == 0 && !_vm->shouldQuit()) {
+			_vm->updateEvents();
+			_vm->_system->updateScreen();
+			_vm->_system->delayMillis(50);
+		}
+
+		if (_vm->_mouseClickButtons != 0 && _vm->_mouseClickX > 130 && _vm->_mouseClickX < 180 && _vm->_mouseClickY > 106 && _vm->_mouseClickY < 128) {
 			_r31_currentPlayer = 0;
 			r31_useBuzzer();
 			_vm->drawRoomImageToBackground("dlook", 287, 30);
@@ -7000,6 +6998,7 @@ void GameLogic::r31_buildQuestionDialogChoices(int categoryIndex, int questionIn
 		}
 	}
 	_vm->setDialogChoices(133, answerChoices[0], answerChoices[1], answerChoices[2], 132);
+	_vm->startDialog();
 }
 
 void GameLogic::r31_correctAnswerSelected() {


Commit: cc56d4edeb941a0521e380b910868849324fc266
    https://github.com/scummvm/scummvm/commit/cc56d4edeb941a0521e380b910868849324fc266
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:52+01:00

Commit Message:
WAYNESWORLD: Implement r0_updatePizzathonDialogChoices

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 70a1f7bd6b6..8255de7f650 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -136,8 +136,9 @@ GameLogic::~GameLogic() {
 }
 
 void GameLogic::initVariables() {
-	_word_34464 = 0;
-	_word_34466 = 0;
+	_r0_pizzathonIdeasCtr = 0;
+	_r0_pizzathonChoiceCtr = 0;
+	memset(_r0_pizzathonChoicesUsed, 0, sizeof(_r0_pizzathonChoicesUsed));
 	_r37_safeCombinationLockIndex = 0;
 	_r37_safeCombinationDirection = 0;
 	_r37_safeCombinationIndex = 0;
@@ -809,7 +810,7 @@ void GameLogic::handleRoomEvent(int eventNum) {
     case 0:
         switch (eventNum) {
         case 1:
-            // TODO r0_handleRoomEvent1();
+            r0_handleRoomEvent1();
             break;
         case 2:
             r0_handleRoomEvent2();
@@ -1307,18 +1308,18 @@ bool GameLogic::r0_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 	case 37: case 38: case 39: case 40: case 41:
 	case 42: case 43: case 44: case 45: case 46:
 	case 47: case 48: case 49: case 50: case 51:
-		_word_34466 = _word_34466 + 1;
+		_r0_pizzathonChoiceCtr++;
 		if (_vm->_selectedDialogChoice < 47) {
 			replyTextIndex1 = 45;
-			_word_34464 = _word_34464 + 1;
+			_r0_pizzathonIdeasCtr++;
 		} else {
 			replyTextIndex1 = _vm->_selectedDialogChoice - 1;
 		}
-		if (_word_34464 == 10) {
+		if (_r0_pizzathonIdeasCtr == 10) {
 			_vm->_roomEventNum = 3;
 		} else {
 			continueDialog = true;
-			r0_buildRandomDialogChoices(_vm->_selectedDialogChoice);
+			r0_updatePizzathonDialogChoices(_vm->_selectedDialogChoice);
 		}
 		break;
 	default:
@@ -1342,6 +1343,18 @@ void GameLogic::r0_refreshRoomBackground() {
 	}
 }
 
+void GameLogic::r0_handleRoomEvent1() {
+	// TODO Call the main menu
+	// When 'Exit' is selected in the menu it starts this dialog
+	if (!(_r0_flags & 0x02)) {
+		_r0_flags |= 0x02;
+		_vm->displayText("c11", 0, 0, -1, -1, 0);
+		_vm->setDialogChoices(29, 30, 31, 32, 33);
+		_vm->waitSeconds(2);
+		_vm->startDialog();
+	}
+}
+
 void GameLogic::r0_handleRoomEvent2() {
 	_vm->displayTextLines("c11", 1, -1, -1, 2);
 	_vm->selectActorGarth();
@@ -1349,7 +1362,7 @@ void GameLogic::r0_handleRoomEvent2() {
 	_vm->selectActorWayne();
 	_vm->displayTextLines("c11", 5, -1, -1, 5);
 	_vm->setDialogChoices(-1, -1, -1, -1, -1);
-	r0_buildRandomDialogChoices(-1);
+	r0_updatePizzathonDialogChoices(-1);
 	_vm->startDialog();
 }
 
@@ -1364,8 +1377,33 @@ void GameLogic::r0_handleRoomEvent3() {
 	_vm->drawInterface(_vm->_verbNumber);
 }
 
-void GameLogic::r0_buildRandomDialogChoices(int selectedDialogChoice) {
-	// TODO
+void GameLogic::r0_updatePizzathonDialogChoices(int selectedDialogChoice) {
+	if (_r0_pizzathonChoiceCtr >= 10) {
+		for (int index = 10; index < 15; index++) {
+			_r0_pizzathonChoicesUsed[index] = false;
+		}
+		for (int index = 0; index < 5; index++) {
+			int choiceIndex = _vm->_dialogChoices[index];
+			if (choiceIndex >= 47) {
+				_r0_pizzathonChoicesUsed[choiceIndex - 47 + 10] = true;
+			}
+		}
+	}
+	int newDialogChoices[5];
+	for (int index = 0; index < 5; index++) {
+		if (_vm->_dialogChoices[index] != selectedDialogChoice) {
+			newDialogChoices[index] = _vm->_dialogChoices[index];
+		} else {
+			int choiceIndex;
+			do {
+				choiceIndex = _vm->getRandom(15);
+			} while (_r0_pizzathonChoicesUsed[choiceIndex]);
+			_r0_pizzathonChoicesUsed[choiceIndex] = true;
+			newDialogChoices[index] = choiceIndex + 37;
+		}
+	}
+	_vm->setDialogChoices(newDialogChoices[0], newDialogChoices[1],
+		newDialogChoices[2], newDialogChoices[3], newDialogChoices[4]);
 }
 
 int GameLogic::r1_handleVerbPickUp() {
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index 7b32cbb7bc1..7661ea49277 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -50,8 +50,9 @@ public:
 	void setPizzathonStatus(int flagNum);
 	void r38_atrap();
 public:
-	int _word_34464;
-	int _word_34466;
+	int _r0_pizzathonIdeasCtr;
+	int _r0_pizzathonChoiceCtr;
+	bool _r0_pizzathonChoicesUsed[15];
 	int _r37_safeCombinationLockIndex;
 	int _r37_safeCombinationDirection;
 	int _r37_safeCombinationIndex;
@@ -127,7 +128,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r0_handleRoomEvent1();
 	void r0_handleRoomEvent2();
 	void r0_handleRoomEvent3();
-	void r0_buildRandomDialogChoices(int selectedDialogChoice);
+	void r0_updatePizzathonDialogChoices(int selectedDialogChoice);
 
 	int r1_handleVerbPickUp();
 	int r1_handleVerbUse();


Commit: c648588bed090b73797e7a580745ca4d5ac1e6d4
    https://github.com/scummvm/scummvm/commit/c648588bed090b73797e7a580745ca4d5ac1e6d4
Author: johndoe123 (john_doe at techie.com)
Date: 2026-03-19T12:05:53+01:00

Commit Message:
WAYNESWORLD: Remove debug code

Changed paths:
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 99b49436ff1..6f90bf0bc0e 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -147,9 +147,9 @@ Common::Error WaynesWorldEngine::run() {
 	drawImageToScreen("r00/backg", 0, 0);
 
 	drawInterface(2);
-	// changeRoom(0);
+	changeRoom(0);
 	// _wayneSpriteX = -1; _garthSpriteX = -1;
-	changeRoom(1); // DEBUG
+	// changeRoom(31); // DEBUG
 	// _logic->r31_displayCategories();
 	// _logic->_r1_eventFlag = 1;
 	// _logic->_r1_eventCtr = 3;


Commit: fd8ddd289b4dc8e82f6a137f284224004bfad2ab
    https://github.com/scummvm/scummvm/commit/fd8ddd289b4dc8e82f6a137f284224004bfad2ab
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:53+01:00

Commit Message:
WAYNESWORLD: Fix compilation

Changed paths:
  A engines/waynesworld/detection.h
  A engines/waynesworld/detection_tables.h
  A engines/waynesworld/metaengine.cpp
    engines/waynesworld/detection.cpp
    engines/waynesworld/module.mk
    engines/waynesworld/pathfinding.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/detection.cpp b/engines/waynesworld/detection.cpp
index 83fe6d81fe5..e4fa45d52e9 100644
--- a/engines/waynesworld/detection.cpp
+++ b/engines/waynesworld/detection.cpp
@@ -20,155 +20,56 @@
  *
  */
 
-#include "waynesworld/waynesworld.h"
+#include "base/plugins.h"
 
-#include "common/config-manager.h"
+//#include "common/config-manager.h"
+//#include "common/file.h"
+//#include "common/md5.h"
+//#include "common/str-array.h"
+//#include "common/util.h"
 #include "engines/advancedDetector.h"
-#include "common/savefile.h"
-#include "common/system.h"
-#include "base/plugins.h"
-#include "graphics/thumbnail.h"
 
 static const PlainGameDescriptor waynesworldGames[] = {
 	{ "waynesworld", "Wayne's World" },
-	{ 0, 0 }
+	{ nullptr, nullptr }
 };
 
-namespace WaynesWorld {
-
-static const ADGameDescription gameDescriptions[] = {
-	{
-		"waynesworld",
-		0,
-		AD_ENTRY1s("e00.txt", "78769d60d48aea314ed6be2f725c8c2f", 1293),
-		Common::EN_ANY,
-		Common::kPlatformDOS,
-		ADGF_NO_FLAGS,
-		0
-	},
-
-	AD_TABLE_END_MARKER
-};
+#include "waynesworld/detection_tables.h"
+#include "waynesworld/detection.h"
 
-} // End of namespace WaynesWorld
+static const DebugChannelDef debugFlagList[] = {
+	{WaynesWorld::kDebugScripts, "scripts", "Script debug level"},
+	{WaynesWorld::kDebugMessages, "messages", "Messages debug level"},
+	{WaynesWorld::kDebugCore, "core", "Core debug level"},
+	DEBUG_CHANNEL_END};
 
-static const char * const directoryGlobs[] = {
-	"vnm",
-	0
-};
+static const char *const DIRECTORY_GLOBS[] = { "vnm", "m01", nullptr };
 
-class WaynesWorldMetaEngine : public AdvancedMetaEngine {
+class WaynesWorldMetaEngineDetection : public AdvancedMetaEngineDetection<ADGameDescription> {
 public:
-	WaynesWorldMetaEngine() : AdvancedMetaEngine(WaynesWorld::gameDescriptions, sizeof(ADGameDescription), waynesworldGames) {
+	WaynesWorldMetaEngineDetection() : AdvancedMetaEngineDetection(WaynesWorld::gameDescriptions, waynesworldGames) {
 		_maxScanDepth = 3;
-		_directoryGlobs = directoryGlobs;
+		_directoryGlobs = DIRECTORY_GLOBS;
+		_flags = kADFlagMatchFullPaths;
 	}
 
-	const char *getEngineId() const override {
-		return "waynesworld";
-	}
+	~WaynesWorldMetaEngineDetection() override {}
 
 	const char *getName() const override {
-		return "Wayne's World";
-	}
-
-	const char *getOriginalCopyright() const override {
-		return "(C) 1993 Capstone Software";
+		return "waynesworld";
 	}
 
-	bool hasFeature(MetaEngineFeature f) const override;
-	bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
-	int getMaximumSaveSlot() const override;
-	SaveStateList listSaves(const char *target) const override;
-	SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
-	void removeSaveState(const char *target, int slot) const override;
-};
-
-bool WaynesWorldMetaEngine::hasFeature(MetaEngineFeature f) const {
-	return false;
-	/*
-	    (f == kSupportsListSaves) ||
-	    (f == kSupportsDeleteSave) ||
-	    (f == kSupportsLoadingDuringStartup) ||
-	    (f == kSavesSupportMetaInfo) ||
-	    (f == kSavesSupportThumbnail) ||
-	    (f == kSavesSupportCreationDate) ||
-		(f == kSimpleSavesNames);
-	*/
-}
-
-void WaynesWorldMetaEngine::removeSaveState(const char *target, int slot) const {
-	Common::String fileName = Common::String::format("%s.%03d", target, slot);
-	g_system->getSavefileManager()->removeSavefile(fileName);
-}
-
-int WaynesWorldMetaEngine::getMaximumSaveSlot() const {
-	return 999;
-}
-
-SaveStateList WaynesWorldMetaEngine::listSaves(const char *target) const {
-	return SaveStateList();
-	#if 0
-	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
-	WaynesWorld::WaynesWorldEngine::SaveHeader header;
-	Common::String pattern = target;
-	pattern += ".###";
-	Common::StringArray filenames;
-	filenames = saveFileMan->listSavefiles(pattern.c_str());
-	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->c_str());
-			if (in) {
-				if (WaynesWorld::WaynesWorldEngine::readSaveHeader(in, header) == WaynesWorld::WaynesWorldEngine::kRSHENoError) {
-					saveList.push_back(SaveStateDescriptor(slotNum, header.description));
-				}
-				delete in;
-			}
-		}
+	const char *getEngineName() const override {
+		return "WaynesWorld";
 	}
-	// Sort saves based on slot number.
-	Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
-	return saveList;
-	#endif
-}
 
-SaveStateDescriptor WaynesWorldMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
-	#if 0
-	Common::String filename = WaynesWorld::WaynesWorldEngine::getSavegameFilename(target, slot);
-	Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str());
-	if (in) {
-		WaynesWorld::WaynesWorldEngine::SaveHeader header;
-		WaynesWorld::WaynesWorldEngine::kReadSaveHeaderError error;
-		error = WaynesWorld::WaynesWorldEngine::readSaveHeader(in, header, false);
-		delete in;
-		if (error == WaynesWorld::WaynesWorldEngine::kRSHENoError) {
-			SaveStateDescriptor desc(slot, header.description);
-			// Slot 0 is used for the "Continue" save
-			desc.setDeletableFlag(slot != 0);
-			desc.setWriteProtectedFlag(slot == 0);
-			desc.setThumbnail(header.thumbnail);
-			desc.setSaveDate(header.saveDate & 0xFFFF, (header.saveDate >> 16) & 0xFF, (header.saveDate >> 24) & 0xFF);
-			desc.setSaveTime((header.saveTime >> 16) & 0xFF, (header.saveTime >> 8) & 0xFF);
-			desc.setPlayTime(header.playTime * 1000);
-			return desc;
-		}
+	const char *getOriginalCopyright() const override {
+		return "Wayne's World (C)";
 	}
-	#endif
-	return SaveStateDescriptor();
-}
 
-bool WaynesWorldMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
-	if (desc) {
-		*engine = new WaynesWorld::WaynesWorldEngine(syst, desc);
+	const DebugChannelDef *getDebugChannels() const override {
+		return debugFlagList;
 	}
-	return desc != 0;
-}
+};
 
-#if PLUGIN_ENABLED_DYNAMIC(WAYNESWORLD)
-	REGISTER_PLUGIN_DYNAMIC(WAYNESWORLD, PLUGIN_TYPE_ENGINE, WaynesWorldMetaEngine);
-#else
-	REGISTER_PLUGIN_STATIC(WAYNESWORLD, PLUGIN_TYPE_ENGINE, WaynesWorldMetaEngine);
-#endif
+REGISTER_PLUGIN_STATIC(WAYNESWORLD_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, WaynesWorldMetaEngineDetection);
diff --git a/engines/waynesworld/detection.h b/engines/waynesworld/detection.h
new file mode 100644
index 00000000000..af7f9efea84
--- /dev/null
+++ b/engines/waynesworld/detection.h
@@ -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/>.
+ *
+ */
+
+#ifndef WAYNESWORLD_DETECTION_H
+#define WAYNESWORLD_DETECTION_H
+
+namespace WaynesWorld {
+
+enum WaynesWorldDebugChannels {
+	kDebugScripts = 1 << 0,
+	kDebugMessages,
+	kDebugCore
+};
+
+#define GAMEOPTION_ORIGINAL_SAVELOAD GUIO_GAMEOPTIONS1
+
+} // End of namespace WaynesWorld
+
+#endif // WAYNESWORLD_DETECTION_H
diff --git a/engines/waynesworld/detection_tables.h b/engines/waynesworld/detection_tables.h
new file mode 100644
index 00000000000..db2160f0cd7
--- /dev/null
+++ b/engines/waynesworld/detection_tables.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/>.
+ *
+ */
+
+namespace WaynesWorld {
+
+static const ADGameDescription gameDescriptions[] = {
+	{
+		"waynesworld",
+		nullptr,
+		AD_ENTRY1s("e00.txt", "78769d60d48aea314ed6be2f725c8c2f", 1293),
+		Common::EN_ANY,
+		Common::kPlatformDOS,
+		ADGF_NO_FLAGS,
+		GUIO1(GUIO_NOASPECT)
+	},
+
+	AD_TABLE_END_MARKER
+};
+
+} // End of namespace WaynesWorld
diff --git a/engines/waynesworld/metaengine.cpp b/engines/waynesworld/metaengine.cpp
new file mode 100644
index 00000000000..775062d8d20
--- /dev/null
+++ b/engines/waynesworld/metaengine.cpp
@@ -0,0 +1,50 @@
+/* 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 "waynesworld/waynesworld.h"
+
+#include "engines/advancedDetector.h"
+
+#include "common/savefile.h"
+#include "common/system.h"
+#include "common/translation.h"
+
+#include "waynesworld/detection.h"
+
+class WaynesWorldMetaEngine : public AdvancedMetaEngine<ADGameDescription> {
+public:
+	const char *getName() const override {
+		return "waynesworld";
+	}
+
+	Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
+};
+
+Common::Error WaynesWorldMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+	*engine = new WaynesWorld::WaynesWorldEngine(syst,desc);
+	return Common::kNoError;
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(WAYNESWORLD)
+	REGISTER_PLUGIN_DYNAMIC(WAYNESWORLD, PLUGIN_TYPE_ENGINE, WaynesWorldMetaEngine);
+#else
+	REGISTER_PLUGIN_STATIC(WAYNESWORLD, PLUGIN_TYPE_ENGINE, WaynesWorldMetaEngine);
+#endif
diff --git a/engines/waynesworld/module.mk b/engines/waynesworld/module.mk
index d6e6df85f38..6821a6974f1 100644
--- a/engines/waynesworld/module.mk
+++ b/engines/waynesworld/module.mk
@@ -6,6 +6,7 @@ MODULE_OBJS := \
 	gamelogic.o \
 	gamemap.o \
 	graphics.o \
+	metaengine.o \
 	pathfinding.o \
 	staticdata.o
 
diff --git a/engines/waynesworld/pathfinding.cpp b/engines/waynesworld/pathfinding.cpp
index 0371b591e8f..34801004d7e 100644
--- a/engines/waynesworld/pathfinding.cpp
+++ b/engines/waynesworld/pathfinding.cpp
@@ -100,21 +100,25 @@ void WaynesWorldEngine::walkCalcOtherActorDest(int flag, int &x, int &y) {
     switch (direction) {
     case 0:
         y += actorDistance;
+        // fallthrough
     case 1:
         x += actorDistance;
         break;
     case 2:
         x += actorDistance;
+        // fallthrough
     case 3:
         y -= actorDistance;
         break;
     case 4:
         y -= actorDistance;
+        // fallthrough
     case 5:
         x -= actorDistance;
         break;
     case 6:
         x -= actorDistance;
+        // fallthrough
     case 7:
         y += actorDistance;
         break;
@@ -451,6 +455,7 @@ bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction
                 scale = drawActors(actor2Points[pointIndex].direction, 1, 0, (walkIncr % 8) / 2, _wayneSpriteX, _wayneSpriteY, _garthWalkPoints[pointIndex].x - _scrollPosition, _garthWalkPoints[pointIndex].y);
             }
         }
+        debug(5, "scale:%d", scale);
         // if (_inventoryItemsCount == 0 && _scrollPosition == 0) {
         //     waitMillis(10000 / (scale * scale) * 10);
         // }
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 6f90bf0bc0e..a9b878ec5da 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -40,6 +40,7 @@
 #include "graphics/fontman.h"
 #include "graphics/palette.h"
 #include "graphics/surface.h"
+#include "graphics/paletteman.h"
 
 namespace WaynesWorld {
 
@@ -139,12 +140,12 @@ Common::Error WaynesWorldEngine::run() {
 #endif
 
 #if 1
-	loadPalette("m01/wstand0");
-	g_system->getPaletteManager()->setPalette(_palette2, 0, 256);
+//	loadPalette("m01/wstand0");
+//	g_system->getPaletteManager()->setPalette(_palette2, 0, 256);
 
 	CursorMan.showMouse(true);
 
-	drawImageToScreen("r00/backg", 0, 0);
+//	drawImageToScreen("r00/backg", 0, 0);
 
 	drawInterface(2);
 	changeRoom(0);
@@ -346,13 +347,15 @@ void WaynesWorldEngine::updateMouseMove() {
                 inventoryItemQuantity = getGarthInventoryItemQuantity(inventoryObjectId);
             }
             const char *roomObjectName = getRoomObjectName(inventoryObjectId);
-            char objectName[32];
+			Common::String objectName;
             if (inventoryItemQuantity == 1) {
-                sprintf(objectName, "%s", roomObjectName);
+//                sprintf(objectName, "%s", roomObjectName);
+				objectName = roomObjectName;
             } else {
-                sprintf(objectName, "%d %ss", inventoryItemQuantity, roomObjectName);
+//                sprintf(objectName, "%d %ss", inventoryItemQuantity, roomObjectName);
+				objectName = Common::String::format("%d %ss", inventoryItemQuantity, roomObjectName);
             }
-            drawVerbLine(_verbNumber, inventoryObjectId, objectName);
+            drawVerbLine(_verbNumber, inventoryObjectId, objectName.c_str());
             return;
         }
     }
@@ -453,19 +456,23 @@ void WaynesWorldEngine::handleMouseRightClick() {
 }
 
 Image::PCXDecoder *WaynesWorldEngine::loadImage(const char *filename, bool appendRoomName) {
-	Common::String tempFilename = appendRoomName
+//	Common::String tempFilename = appendRoomName
+//		? Common::String::format("%s/%s.pcx", _roomName.c_str(), filename)
+//		: Common::String::format("%s.pcx", filename);
+
+	Common::Path tempFilename(appendRoomName
 		? Common::String::format("%s/%s.pcx", _roomName.c_str(), filename)
-		: Common::String::format("%s.pcx", filename);
+		: Common::String::format("%s.pcx", filename));
 
 	Common::File pcxFile;
 	if (!pcxFile.open(tempFilename)) {
-		warning("loadImage() Could not open '%s'", tempFilename.c_str());
+		warning("loadImage() Could not open '%s'", tempFilename.baseName().c_str());
 		return nullptr;
 	}
 
 	Image::PCXDecoder *pcx = new Image::PCXDecoder();
 	if (!pcx->loadStream(pcxFile)) {
-		warning("loadImage() Could not process '%s'", tempFilename.c_str());
+		warning("loadImage() Could not process '%s'", tempFilename.baseName().c_str());
 		delete pcx;
 		return nullptr;
 	}
@@ -490,10 +497,10 @@ WWSurface *WaynesWorldEngine::loadRoomSurface(const char *filename) {
 
 void WaynesWorldEngine::loadPalette(const char *filename) {
     Image::PCXDecoder *imageDecoder = loadImage(filename, false);
-	if (imageDecoder->getPaletteColorCount() != 256) {
+	if (imageDecoder->getPalette().empty()) {
 		warning("loadPalette() Could not load palette from '%s'", filename);
 	} else {
-		memcpy(_palette2, imageDecoder->getPalette(), imageDecoder->getPaletteColorCount() * 3);
+		memcpy(_palette2, imageDecoder->getPalette().data(), Graphics::PALETTE_SIZE);
 		g_system->getPaletteManager()->setPalette(_palette2, 0, 256);
 	}
     delete imageDecoder;
@@ -607,9 +614,9 @@ Common::String WaynesWorldEngine::loadString(const char *filename, int index, in
 	const uint kMaxStringLen = 60;
 	char textBuffer[kMaxStringLen];
 	Common::File fd;
-	Common::String tempFilename = Common::String::format("%s.txt", filename);
+	Common::Path tempFilename(Common::String::format("%s.txt", filename));
 	if (!fd.open(tempFilename))
-		error("WaynesWorldEngine::loadString() Could not open %s", tempFilename.c_str());
+		error("WaynesWorldEngine::loadString() Could not open %s", tempFilename.baseName().c_str());
 	fd.seek(index * kMaxStringLen);
 	fd.read(textBuffer, kMaxStringLen);
 	// Decrypt the string
@@ -628,7 +635,7 @@ void WaynesWorldEngine::drawCurrentTextToSurface(WWSurface *destSurface, int x,
 }
 
 void WaynesWorldEngine::drawCurrentText(int x, int y, WWSurface *destSurface) {
-    int textCenterX, textX, textY, textColor, actorY;
+    int textCenterX, textX, textY = 0, textColor, actorY = 0;
     int textWidth = _fontWWInv->getTextWidth(_currentText.c_str());
     if (x != -1) {
         textCenterX = x;
@@ -1074,29 +1081,30 @@ void WaynesWorldEngine::pickupObject(int objectId, byte &flags, byte flagsSet, i
 }
 
 void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int count, int x, int y, int flag, uint ticks) {
-    char filename[32];
+//    char filename[32];
+	Common::String filename;
     // sysMouseDriver(2);
 	if (count > 0) {
 		for (int index = startIndex; index < startIndex + count; index++) {
 			updateRoomAnimations();
-			sprintf(filename, "%s%d", prefix, index);
-			drawRoomImageToScreen(filename, x, y);
-			drawRoomImageToBackground(filename, x, y);
+			filename = Common::String::format("%s%d", prefix, index);
+			drawRoomImageToScreen(filename.c_str(), x, y);
+			drawRoomImageToBackground(filename.c_str(), x, y);
 			waitMillis(ticks);
 		}
 	} else {
 		for (int index = startIndex; index > startIndex + count; index--) {
 			updateRoomAnimations();
-			sprintf(filename, "%s%d", prefix, index);
-			drawRoomImageToScreen(filename, x, y);
-			drawRoomImageToBackground(filename, x, y);
+			filename = Common::String::format("%s%d", prefix, index);
+			drawRoomImageToScreen(filename.c_str(), x, y);
+			drawRoomImageToBackground(filename.c_str(), x, y);
 			waitMillis(ticks);
 		}
 	}
     if (flag) {
-        sprintf(filename, "%s%d", prefix, startIndex);
-        drawRoomImageToScreen(filename, x, y);
-        drawRoomImageToBackground(filename, x, y);
+		filename = Common::String::format("%s%d", prefix, startIndex);
+        drawRoomImageToScreen(filename.c_str(), x, y);
+        drawRoomImageToBackground(filename.c_str(), x, y);
     }
     // sysMouseDriver(1)
 }
@@ -1146,6 +1154,9 @@ void WaynesWorldEngine::openRoomLibrary(int roomNum) {
 }
 
 void WaynesWorldEngine::loadRoomBackground() {
+	loadPalette(Common::String(_roomName + "/backg").c_str());
+	g_system->getPaletteManager()->setPalette(_palette2, 0, 256);
+	
     drawRoomImageToSurface("backg", _backgroundSurface, 0, 0);
     refreshRoomBackground(_currentRoomNumber);
     refreshActors();
@@ -1342,12 +1353,12 @@ void WaynesWorldEngine::scrollRoom() {
 }
 
 void WaynesWorldEngine::loadRoomMask(int roomNum) {
-	Common::String filename = Common::String::format("r%02d.msk", roomNum);
+	Common::Path filename(Common::String::format("r%02d.msk", roomNum));
 	Common::File fd;
 	if (!fd.open(filename))
-		error("WaynesWorldEngine::loadRoomMask() Could not open %s", filename.c_str());
+		error("WaynesWorldEngine::loadRoomMask() Could not open %s", filename.baseName().c_str());
 	if (fd.size() != kWalkMapSize)
-		error("WaynesWorldEngine::loadRoomMask() Wrong file size in %s", filename.c_str());
+		error("WaynesWorldEngine::loadRoomMask() Wrong file size in %s", filename.baseName().c_str());
 	fd.read(_walkMap, kWalkMapSize);
 }
 
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index d78c2653411..e5fcbd41f1d 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -33,10 +33,11 @@
 #include "common/substream.h"
 #include "common/system.h"
 #include "engines/engine.h"
+#include "engines/advancedDetector.h"
 
 #include "image/pcx.h"
 
-struct ADGameDescription;
+#include "waynesworld/detection.h"
 
 namespace WaynesWorld {
 


Commit: 630e91906963cbb6c5b5b92d1f3839d78bbb6dd1
    https://github.com/scummvm/scummvm/commit/630e91906963cbb6c5b5b92d1f3839d78bbb6dd1
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:53+01:00

Commit Message:
WAYNESWORLD: Introduce GxlArchive

Changed paths:
  A engines/waynesworld/gxlarchive.cpp
  A engines/waynesworld/gxlarchive.h
    engines/waynesworld/module.mk
    engines/waynesworld/pathfinding.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gxlarchive.cpp b/engines/waynesworld/gxlarchive.cpp
new file mode 100644
index 00000000000..8e121f35b55
--- /dev/null
+++ b/engines/waynesworld/gxlarchive.cpp
@@ -0,0 +1,125 @@
+/* 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/archive.h"
+
+#include "common/file.h"
+#include "common/hash-str.h"
+#include "common/memstream.h"
+#include "common/bufferedstream.h"
+#include "common/textconsole.h"
+
+#include "waynesworld/gxlarchive.h"
+
+namespace WaynesWorld {
+
+GxlArchive::GxlArchive(const Common::String name) : _gxlFile(new Common::File()) {
+	Common::Path filename = Common::Path(name + ".GXL");
+	if (!_gxlFile->open(filename)) {
+		warning("GlxArchive::GlxArchive(): Could not find the archive file %s", filename.baseName().c_str());
+		delete _gxlFile;
+		_gxlFile = nullptr;
+		return;
+	}
+
+	uint16 sign = _gxlFile->readUint16BE();
+	if (sign != 0x01CA) {
+		error("Invalid GXL signature");
+	}
+
+	// signature (2) + copyright (50) + version (2) + garbage(40)
+	_gxlFile->seek(94);
+	uint16 count = _gxlFile->readUint16LE();
+	
+	GxlHeader header;
+	_gxlFile->seek(128);
+	
+	for (uint i = 0; i < count; i++) {
+		_gxlFile->readByte(); // Packing Type
+		char baseName[9] = {0};
+		char extension[5] = {0};
+		_gxlFile->read(baseName, 8);
+		_gxlFile->read(extension, 5);
+		Common::String fullName = Common::String(baseName);
+		fullName.trim();
+		fullName += Common::String(extension);
+		fullName.trim();
+		
+		strncpy(header.filename, fullName.c_str(), 12);
+		header.filename[12] = 0;
+		
+		header.offset = _gxlFile->readUint32LE();
+		header.size = _gxlFile->readUint32LE();
+
+		_gxlFile->readUint32LE(); // date and time of the file
+
+		warning("file: %s offset: %d  size: %d", header.filename, header.offset, header.size);
+
+		_headers[header.filename].reset(new GxlHeader(header));
+	}
+}
+
+GxlArchive::~GxlArchive() {
+	delete _gxlFile;
+}
+
+bool GxlArchive::hasFile(const Common::Path &path) const {
+	return _headers.contains(path);
+}
+
+int GxlArchive::listMembers(Common::ArchiveMemberList &list) const {
+	int matches = 0;
+
+	GxlHeadersMap::const_iterator it = _headers.begin();
+	for ( ; it != _headers.end(); ++it) {
+		list.push_back(Common::ArchiveMemberList::value_type(new Common::GenericArchiveMember(Common::Path(it->_value->filename), *this)));
+		matches++;
+	}
+
+	return matches;
+}
+
+const Common::ArchiveMemberPtr GxlArchive::getMember(const Common::Path &path) const {
+	if (!hasFile(path))
+		return Common::ArchiveMemberPtr();
+
+	return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(path, *this));
+}
+
+Common::SeekableReadStream *GxlArchive::createReadStreamForMember(const Common::Path &path) const {
+	if (!_gxlFile || !_headers.contains(path)) {
+		return nullptr;
+	}
+
+	GxlHeader *hdr = _headers[path].get();
+
+	_gxlFile->seek(hdr->offset, SEEK_SET);
+
+	byte *data = (byte *)malloc(hdr->size);
+	assert(data);
+
+	int32 len = _gxlFile->read(data, hdr->size);
+	assert(len == hdr->size);
+
+	return new Common::MemoryReadStream(data, hdr->size, DisposeAfterUse::YES);
+}
+
+} // End of namespace WaynesWorld
diff --git a/engines/waynesworld/gxlarchive.h b/engines/waynesworld/gxlarchive.h
new file mode 100644
index 00000000000..5aa5a543342
--- /dev/null
+++ b/engines/waynesworld/gxlarchive.h
@@ -0,0 +1,60 @@
+/* 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 WAYNESWORLD_GXLARCHIVE
+#define WAYNESWORLD_GXLARCHIVE
+
+#include "common/archive.h"
+
+namespace Common {
+class File;
+}
+
+namespace WaynesWorld {
+
+#define GXL_FILENAME_MAX 13
+
+struct GxlHeader {
+	int32 offset;
+	int32 size;
+	char  filename[GXL_FILENAME_MAX];
+};
+
+typedef Common::HashMap<Common::Path, Common::ScopedPtr<GxlHeader>, Common::Path::IgnoreCase_Hash, Common::Path::IgnoreCase_EqualTo> GxlHeadersMap;
+
+class GxlArchive : public Common::Archive {
+	GxlHeadersMap _headers;
+	Common::File *_gxlFile;
+
+public:
+	GxlArchive(const Common::String name);
+	~GxlArchive() override;
+
+	// Archive implementation
+	bool hasFile(const Common::Path &path) const override;
+	int listMembers(Common::ArchiveMemberList &list) const override;
+	const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
+	Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
+};
+
+} // End of namespace WaynesWorld
+
+#endif
diff --git a/engines/waynesworld/module.mk b/engines/waynesworld/module.mk
index 6821a6974f1..f3bd2dfe635 100644
--- a/engines/waynesworld/module.mk
+++ b/engines/waynesworld/module.mk
@@ -5,6 +5,7 @@ MODULE_OBJS := \
 	detection.o \
 	gamelogic.o \
 	gamemap.o \
+	glxarchive.o \
 	graphics.o \
 	metaengine.o \
 	pathfinding.o \
diff --git a/engines/waynesworld/pathfinding.cpp b/engines/waynesworld/pathfinding.cpp
index 34801004d7e..ab1e11e734a 100644
--- a/engines/waynesworld/pathfinding.cpp
+++ b/engines/waynesworld/pathfinding.cpp
@@ -491,5 +491,4 @@ bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction
 
     return true;
 }
-
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index a9b878ec5da..de98fe773bc 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -23,6 +23,7 @@
 #include "waynesworld/waynesworld.h"
 #include "waynesworld/gamelogic.h"
 #include "waynesworld/graphics.h"
+#include "waynesworld/gxlarchive.h"
 #include "waynesworld/objectids.h"
 
 #include "audio/audiostream.h"
@@ -349,10 +350,8 @@ void WaynesWorldEngine::updateMouseMove() {
             const char *roomObjectName = getRoomObjectName(inventoryObjectId);
 			Common::String objectName;
             if (inventoryItemQuantity == 1) {
-//                sprintf(objectName, "%s", roomObjectName);
 				objectName = roomObjectName;
             } else {
-//                sprintf(objectName, "%d %ss", inventoryItemQuantity, roomObjectName);
 				objectName = Common::String::format("%d %ss", inventoryItemQuantity, roomObjectName);
             }
             drawVerbLine(_verbNumber, inventoryObjectId, objectName.c_str());
@@ -456,10 +455,6 @@ void WaynesWorldEngine::handleMouseRightClick() {
 }
 
 Image::PCXDecoder *WaynesWorldEngine::loadImage(const char *filename, bool appendRoomName) {
-//	Common::String tempFilename = appendRoomName
-//		? Common::String::format("%s/%s.pcx", _roomName.c_str(), filename)
-//		: Common::String::format("%s.pcx", filename);
-
 	Common::Path tempFilename(appendRoomName
 		? Common::String::format("%s/%s.pcx", _roomName.c_str(), filename)
 		: Common::String::format("%s.pcx", filename));
@@ -1151,6 +1146,10 @@ void WaynesWorldEngine::toggleActor() {
 
 void WaynesWorldEngine::openRoomLibrary(int roomNum) {
     _roomName = Common::String::format("r%02d", roomNum);
+	if (_roomGxl)
+		delete _roomGxl;
+
+	_roomGxl = new GxlArchive(_roomName);
 }
 
 void WaynesWorldEngine::loadRoomBackground() {
@@ -1164,8 +1163,8 @@ void WaynesWorldEngine::loadRoomBackground() {
 
 void WaynesWorldEngine::changeRoom(int roomNum) {
     if (_currentRoomNumber != -1) {
-        // NOTE Not needed gxCloseLib(roomLib);
-        unloadStaticRoomObjects();
+    	// GxlCloseLib is included in openRoomLibrary, no need to call it here
+    	unloadStaticRoomObjects();
     }
     openRoomLibrary(roomNum);
     if (_wayneSpriteX != -1) {
@@ -2121,4 +2120,9 @@ void WaynesWorldEngine::extremeCloseUpHandleMouseClick() {
     // sysMouseDriver(1);
 }
 
+void WaynesWorldEngine::gxCloseLib(GxlArchive *lib) {
+	delete lib;
+	lib = nullptr;
+}
+
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index e5fcbd41f1d..7fda3f29b13 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -38,6 +38,7 @@
 #include "image/pcx.h"
 
 #include "waynesworld/detection.h"
+#include "waynesworld/gxlarchive.h"
 
 namespace WaynesWorld {
 
@@ -134,6 +135,7 @@ public:
 
 	// Room
 	Common::String _roomName;
+	GxlArchive *_roomGxl = nullptr;
 	byte *_walkMap;
 	int _scrollWidth;
 	int _scrollRemaining;
@@ -311,6 +313,7 @@ public:
 	int walkCalcDirection(int deltaX, int deltaY);
 	bool walkTo(int actor1_destX, int actor1_destY, int direction, int actor2_destX, int actor2_destY);
 
+	void gxCloseLib(GxlArchive *lib);
 	// Room
 	void openRoomLibrary(int roomNum);
 	void loadRoomBackground();


Commit: c5e84406d4caf3a08deb07990cdca33b932ee42b
    https://github.com/scummvm/scummvm/commit/c5e84406d4caf3a08deb07990cdca33b932ee42b
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:53+01:00

Commit Message:
WAYNESWORLD: Refactoring to use GxlArchive instead of extracted files

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamemap.cpp
    engines/waynesworld/gxlarchive.cpp
    engines/waynesworld/gxlarchive.h
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 8255de7f650..eb7b0d3744e 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -22,6 +22,7 @@
 
 #include "waynesworld/gamelogic.h"
 #include "waynesworld/graphics.h"
+#include "waynesworld/gxlarchive.h"
 #include "waynesworld/objectids.h"
 #include "common/str.h"
 #include "graphics/cursorman.h"
@@ -1094,41 +1095,43 @@ void GameLogic::setPizzathonStatus(int flagNum) {
 }
 
 void GameLogic::displayExtremeCloseupOfPizzathonList() {
-    _vm->stopRoomAnimations();
+	GxlArchive *lib = _vm->_m05Gxl;
+
+	_vm->stopRoomAnimations();
     _vm->_gameState = 5;
     _vm->paletteFadeOut(0, 256, 16);
     // sysMouseDriver(2);
-    _vm->drawImageToScreen("m05/list", 0, 0);
+	_vm->drawImageToScreen(lib, "list.pcx", 0, 0);
     _vm->playSound("sv14", 1);
     if (_pizzathonListFlags1 & 0x08) {
-        _vm->drawImageToScreen("m05/adline", 72, 22);
+		_vm->drawImageToScreen(lib, "adline.pcx", 72, 22);
     }
     if (_pizzathonListFlags1 & 0x40) {
-        _vm->drawImageToScreen("m05/locline", 72, 42);
+		_vm->drawImageToScreen(lib, "locline.pcx", 72, 42);
     }
     if (_pizzathonListFlags1 & 0x80) {
-        _vm->drawImageToScreen("m05/volline", 74, 59);
+		_vm->drawImageToScreen(lib, "volline.pcx", 74, 59);
     }
     if (_pizzathonListFlags2 & 0x01) {
-        _vm->drawImageToScreen("m05/timeline", 66, 76);
+		_vm->drawImageToScreen(lib, "timeline.pcx", 66, 76);
     }
     if (_pizzathonListFlags2 & 0x02) {
-        _vm->drawImageToScreen("m05/totline", 73, 94);
+		_vm->drawImageToScreen(lib, "totline.pcx", 73, 94);
     }
     if (_pizzathonListFlags1 & 0x02) {
-        _vm->drawImageToScreen("m05/vidline", 80, 111);
+		_vm->drawImageToScreen(lib, "vidline.pcx", 80, 111);
     }
     if (_pizzathonListFlags1 & 0x04) {
-        _vm->drawImageToScreen("m05/ingline", 72, 129);
+		_vm->drawImageToScreen(lib, "ingline.pcx", 72, 129);
     }
     if (_pizzathonListFlags1 & 0x10) {
-        _vm->drawImageToScreen("m05/musline", 78, 148);
+		_vm->drawImageToScreen(lib, "musline.pcx", 78, 148);
     }
     if (_pizzathonListFlags1 & 0x01) {
-        _vm->drawImageToScreen("m05/magline", 61, 164);
+		_vm->drawImageToScreen(lib, "magline.pcx", 61, 164);
     }
     if (_pizzathonListFlags1 & 0x20) {
-        _vm->drawImageToScreen("m05/comline", 68, 100);
+		_vm->drawImageToScreen(lib, "comline.pcx", 68, 100);
     }
     _vm->paletteFadeIn(0, 256, 16);
     // sysMouseDriver(1);
@@ -1140,7 +1143,7 @@ void GameLogic::displayExtremeCloseupOfSign15() {
     // sysMouseDriver(2);
     _vm->paletteFadeOut(0, 256, 16);
     _vm->playSound("sv14", 1);
-    _vm->drawRoomImageToScreen("sign", 0, 0);
+    _vm->drawRoomImageToScreen("sign.pcx", 0, 0);
     _vm->paletteFadeIn(0, 256, 16);
     // sysMouseDriver(1);
 }
@@ -1151,53 +1154,53 @@ void GameLogic::displayExtremeCloseupOfObjectPictures22() {
     // sysMouseDriver(2);
     _vm->paletteFadeOut(0, 256, 16);
     _vm->playSound("sv14", 1);
-    _vm->drawImageToScreen("m05/oldmap", 0, 0);
+	_vm->drawImageToScreen(_vm->_m05Gxl, "oldmap.pcx", 0, 0);
     _vm->paletteFadeIn(0, 256, 16);
     // sysMouseDriver(1);
 }
 
 void GameLogic::displayExtremeCloseupOfMemo() {
-    _vm->stopRoomAnimations();
+	_vm->stopRoomAnimations();
     _vm->_gameState = 5;
     // sysMouseDriver(2);
     _vm->paletteFadeOut(0, 256, 16);
     _vm->playSound("sv14", 1);
-    _vm->drawImageToScreen("m05/memo", 0, 0);
+	_vm->drawImageToScreen(_vm->_m05Gxl, "memo.pcx", 0, 0);
     _vm->paletteFadeIn(0, 256, 16);
     // sysMouseDriver(1);
 }
 
 void GameLogic::displayExtremeCloseupOfSewerMap() {
-    _vm->stopRoomAnimations();
+	_vm->stopRoomAnimations();
     _vm->_gameState = 5;
     // sysMouseDriver(2);
     _vm->paletteFadeOut(0, 256, 16);
     _vm->playSound("sv14", 1);
-    _vm->drawImageToScreen("m05/sewermap", 0, 0);
+	_vm->drawImageToScreen(_vm->_m05Gxl, "sewermap.pcx", 0, 0);
     _vm->paletteFadeIn(0, 256, 16);
     // sysMouseDriver(1);
 }
 
 void GameLogic::displayExtremeCloseupOfBillboard1() {
-    _vm->stopRoomAnimations();
+	_vm->stopRoomAnimations();
     _vm->_gameState = 5;
     // sysMouseDriver(2);
     _vm->paletteFadeOut(0, 256, 16);
     _vm->playSound("sv14", 1);
     _vm->_screen->clear(0);
-    _vm->drawImageToScreen("m05/fboard", 51, 18);
+	_vm->drawImageToScreen(_vm->_m05Gxl, "fboard.pcx", 51, 18);
     _vm->paletteFadeIn(0, 256, 16);
     // sysMouseDriver(1);
 }
 
 void GameLogic::displayExtremeCloseupOfBillboard2() {
-    _vm->stopRoomAnimations();
+	_vm->stopRoomAnimations();
     _vm->_gameState = 5;
     // sysMouseDriver(2);
     _vm->paletteFadeOut(0, 256, 16);
     _vm->playSound("sv14", 1);
     _vm->_screen->clear(0);
-    _vm->drawImageToScreen("m05/pboard", 51, 18);
+	_vm->drawImageToScreen(_vm->_m05Gxl, "pboard.pcx", 51, 18);
     _vm->paletteFadeIn(0, 256, 16);
     // sysMouseDriver(1);
 }
@@ -1330,13 +1333,13 @@ bool GameLogic::r0_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 
 void GameLogic::r0_refreshRoomBackground() {
 	if (!(_r0_flags & 0x01)) {
-		_vm->drawRoomImageToBackground("guitar", 18, 84);
+		_vm->drawRoomImageToBackground("guitar.pcx", 18, 84);
 	}
 	if (!(_r0_flags & 0x04)) {
-		_vm->drawRoomImageToBackground("hockey", 235, 66);
+		_vm->drawRoomImageToBackground("hockey.pcx", 235, 66);
 	}
 	if (!(_r0_flags & 0x08)) {
-		_vm->drawRoomImageToBackground("basket", 217, 76);
+		_vm->drawRoomImageToBackground("basket.pcx", 217, 76);
 	}
 	if (!(_r0_flags & 0x02)) {
 		_vm->_roomEventNum = 1;
@@ -1668,7 +1671,7 @@ void GameLogic::r1_initRoomAnimations() {
 
 void GameLogic::r1_uninitRoomAnimations() {
 	_vm->stopRoomAnimations();
-	_vm->loadPalette("m01/wstand0");
+	_vm->loadPalette(_vm->_m01Gxl, "wstand0.pcx");
 }
 
 void GameLogic::r1_updateRoomAnimations() {
@@ -1686,17 +1689,17 @@ void GameLogic::r1_updateRoomAnimations() {
 void GameLogic::r1_refreshRoomBackground() {
 	if (_pizzathonListFlags2 & 0x08) {
 		_vm->loadRoomMask(97);
-		_vm->drawRoomImageToBackground("norobot", 64, 68);
-		_vm->drawRoomImageToBackground("machine", 82, 50);
+		_vm->drawRoomImageToBackground("norobot.pcx", 64, 68);
+		_vm->drawRoomImageToBackground("machine.pcx", 82, 50);
 		if (_r1_flags2 & 0x02) {
-			_vm->drawRoomImageToBackground("donon", 86, 104);
+			_vm->drawRoomImageToBackground("donon.pcx", 86, 104);
 		}
 		if (!(_r1_flags2 & 0x04)) {
-			_vm->drawRoomImageToBackground("cord", 143, 106);
+			_vm->drawRoomImageToBackground("cord.pcx", 143, 106);
 		}
 		if (!(_r1_flags2 & 0x08)) {
 			_vm->moveObjectToRoom(kObjectIdDrGadget_0, 1);
-			_vm->drawRoomImageToBackground("gadget2", 127, 82);
+			_vm->drawRoomImageToBackground("gadget2.pcx", 127, 82);
 			_vm->fillRoomMaskArea(100, 0, 319, 149, true);
 		} else {
 			_vm->moveObjectToNowhere(kObjectIdDrGadget_0);
@@ -1707,7 +1710,7 @@ void GameLogic::r1_refreshRoomBackground() {
 			}
 		}
 		if (!(_r1_flags1 & 0x08)) {
-			_vm->drawRoomImageToBackground("suckcut", 32, 80);
+			_vm->drawRoomImageToBackground("suckcut.pcx", 32, 80);
 		}
 		_vm->moveObjectToNowhere(kObjectIdLever);
 		_vm->moveObjectToNowhere(kObjectIdMice);
@@ -1726,54 +1729,54 @@ void GameLogic::r1_refreshRoomBackground() {
 		}
 	} else {
 		if (_r1_flags1 & 0x01) {
-			_vm->drawRoomImageToBackground("screenup", 118, 53);
+			_vm->drawRoomImageToBackground("screenup.pcx", 118, 53);
 			if (_r1_flags1 & 0x02) {
-				_vm->drawRoomImageToBackground("safeopen", 131, 69);
+				_vm->drawRoomImageToBackground("safeopen.pcx", 131, 69);
 				if (!(_r1_flags1 & 0x04)) {
-					_vm->drawRoomImageToBackground("remote", 138, 78);
+					_vm->drawRoomImageToBackground("remote.pcx", 138, 78);
 				}
 			}
 		}
 		if (!(_r1_flags1 & 0x08)) {
-			_vm->drawRoomImageToBackground("suckcut", 32, 80);
+			_vm->drawRoomImageToBackground("suckcut.pcx", 32, 80);
 		}
 		if (_r1_flags1 & 0x20) {
-			_vm->drawRoomImageToBackground("emptycg", 180, 66);
+			_vm->drawRoomImageToBackground("emptycg.pcx", 180, 66);
 		} else if (_r1_flags1 & 0x10) {
-			_vm->drawRoomImageToBackground("emptycls", 179, 67);
+			_vm->drawRoomImageToBackground("emptycls.pcx", 179, 67);
 		}
 		if (_r1_flags2 & ((_r1_flags1 & 0x40) + 1) & 0x01) {
 			if (_r1_flags1 & 0x08) {
-				_vm->drawRoomImageToBackground("gadin10", 0, 78);
+				_vm->drawRoomImageToBackground("gadin10.pcx", 0, 78);
 			} else {
-				_vm->drawRoomImageToBackground("scin10", 0, 78);
+				_vm->drawRoomImageToBackground("scin10.pcx", 0, 78);
 			}
 		}
 		if (_r1_flags1 & 0x80) {
-			_vm->drawRoomImageToBackground("norobot", 64, 68);
+			_vm->drawRoomImageToBackground("norobot.pcx", 64, 68);
 		}
 		if (_r1_tongueTrickActive) {
 			switch (_r1_tongueTrickCtr) {
 			case 2: case 9:
-				_vm->drawRoomImageToBackground("tt011", 119, 81);
+				_vm->drawRoomImageToBackground("tt011.pcx", 119, 81);
 				break;
 			case 3:
-				_vm->drawRoomImageToBackground("tt111", 119, 81);
+				_vm->drawRoomImageToBackground("tt111.pcx", 119, 81);
 				break;
 			case 4:
-				_vm->drawRoomImageToBackground("tt211", 119, 81);
+				_vm->drawRoomImageToBackground("tt211.pcx", 119, 81);
 				break;
 			case 5:
-				_vm->drawRoomImageToBackground("tt311", 119, 81);
+				_vm->drawRoomImageToBackground("tt311.pcx", 119, 81);
 				break;
 			case 6:
-				_vm->drawRoomImageToBackground("tt46", 119, 81);
+				_vm->drawRoomImageToBackground("tt46.pcx", 119, 81);
 				break;
 			case 7:
-				_vm->drawRoomImageToBackground("tt56", 119, 81);
+				_vm->drawRoomImageToBackground("tt56.pcx", 119, 81);
 				break;
 			case 8:
-				_vm->drawRoomImageToBackground("tt66", 119, 81);
+				_vm->drawRoomImageToBackground("tt66.pcx", 119, 81);
 			default:
 				break;
 			}
@@ -2246,10 +2249,10 @@ void GameLogic::r2_refreshRoomBackground() {
 		_r2_flags |= 0x80;
 	}
 	if (_r2_backgroundValue1 < 7) {
-		_vm->drawRoomImageToBackground("geeks", 152, 72);
+		_vm->drawRoomImageToBackground("geeks.pcx", 152, 72);
 	}
 	if (!(_pizzathonListFlags2 & 0x08)) {
-		_vm->drawRoomImageToBackground("gang", 0, 68);
+		_vm->drawRoomImageToBackground("gang.pcx", 0, 68);
 	} else {
 		_vm->moveObjectToNowhere(kObjectIdBikerGang);
 	}
@@ -2258,17 +2261,17 @@ void GameLogic::r2_refreshRoomBackground() {
 		_vm->setStaticRoomObjectPosition(2, 1, 1, 92, 103);
 	} else {
 		_vm->setStaticRoomObjectPosition(2, 2, 2, 92, 88);
-		_vm->drawRoomImageToBackgroundTransparent("table2", 92, 88);
+		_vm->drawRoomImageToBackgroundTransparent("table2.pcx", 92, 88);
 		_vm->moveObjectToRoom(kObjectIdGirls, 2);
 	}
-	_vm->drawRoomImageToBackground("wait1", 237, 69);
+	_vm->drawRoomImageToBackground("wait1.pcx", 237, 69);
 	if (!(_r2_flags & 0x04)) {
-		_vm->drawRoomImageToBackground("box", 265, 83);
+		_vm->drawRoomImageToBackground("box.pcx", 265, 83);
 	} else if (_r2_flags & 0x40) {
-		_vm->drawRoomImageToBackground("cbox", 226, 91);
+		_vm->drawRoomImageToBackground("cbox.pcx", 226, 91);
 	}
 	if (_r2_flags & 0x20) {
-		_vm->drawRoomImageToBackground("donut", 232, 95);
+		_vm->drawRoomImageToBackground("donut.pcx", 232, 95);
 	}
 }
 
@@ -2447,11 +2450,11 @@ bool GameLogic::r3_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 
 void GameLogic::r3_refreshRoomBackground() {
 	if (_pizzathonListFlags2 & 0x08) {
-		_vm->drawRoomImageToBackground("nosat", 232, 53);
+		_vm->drawRoomImageToBackground("nosat.pcx", 232, 53);
 		_vm->moveObjectToNowhere(kObjectIdProtesters3);
 		_vm->moveObjectToNowhere(kObjectIdSatdish);
 	} else {
-		_vm->drawRoomImageToBackground("elvis", 0, 47);
+		_vm->drawRoomImageToBackground("elvis.pcx", 0, 47);
 		_vm->moveObjectToRoom(kObjectIdProtesters3, 3);
 	}
 }
@@ -2635,10 +2638,10 @@ void GameLogic::r4_refreshRoomBackground() {
 		r4_initRoomAnimations();
 	}
 	if (_r4_flags & 0x02) {
-		_vm->drawRoomImageToBackground("opengate", 223, 49);
+		_vm->drawRoomImageToBackground("opengate.pcx", 223, 49);
 	}
 	if (_r4_flags & 0x04) {
-		_vm->drawRoomImageToBackground("cheesein", 226, 61);
+		_vm->drawRoomImageToBackground("cheesein.pcx", 226, 61);
 		chainCheeseIn = 'y';
 	}
 	if (_r4_flags & 0x08) {
@@ -2650,13 +2653,13 @@ void GameLogic::r4_refreshRoomBackground() {
 		chainVisible = true;
 	}
 	if (chainVisible) {
-		Common::String filename = Common::String::format("%c%cchain%c", chainCheeseIn, chainUpDown1, chainUpDown2);
+		Common::String filename = Common::String::format("%c%cchain%c.pcx", chainCheeseIn, chainUpDown1, chainUpDown2);
 		_vm->drawRoomImageToBackground(filename.c_str(), 224, 57);
 	}
 	if (_r4_flags & 0x20) {
-		_vm->drawRoomImageToBackground("wcrouch", 163, 53);
+		_vm->drawRoomImageToBackground("wcrouch.pcx", 163, 53);
 	} else if (_r4_flags & 0x40) {
-		_vm->drawRoomImageToBackground("gcrouch", 163, 53);
+		_vm->drawRoomImageToBackground("gcrouch.pcx", 163, 53);
 	}
 }
 
@@ -3096,21 +3099,21 @@ void GameLogic::r6_updateRoomAnimations() {
 
 void GameLogic::r6_refreshRoomBackground() {
 	if (!(_r6_flags & 0x01)) {
-		_vm->drawRoomImageToBackground("sitdog0", 49, 111);
+		_vm->drawRoomImageToBackground("sitdog0.pcx", 49, 111);
 		_vm->fillRoomMaskArea(65, 110, 106, 124, false);
 		_vm->fillRoomMaskArea(96, 111, 125, 123, true);
 	}
 	if (_r6_flags & 0x02) {
-		_vm->drawRoomImageToBackground("norope", 49, 111);
+		_vm->drawRoomImageToBackground("norope.pcx", 49, 111);
 	}
 	if (_r6_flags & 0x04) {
-		_vm->drawRoomImageToBackground("throw5", 142, 37);
+		_vm->drawRoomImageToBackground("throw5.pcx", 142, 37);
 	}
 	if (_r6_flags & 0x08) {
-		_vm->drawRoomImageToBackground("seat", 148, 84);
+		_vm->drawRoomImageToBackground("seat.pcx", 148, 84);
 	}
 	if (_r6_flags & 0x10) {
-		_vm->drawRoomImageToBackground("sitgarth", 151, 83);
+		_vm->drawRoomImageToBackground("sitgarth.pcx", 151, 83);
 	}
 	if (!_vm->_hasRoomAnimationCallback) {
 		r6_initRoomAnimations();
@@ -3457,15 +3460,15 @@ void GameLogic::r7_updateRoomAnimations() {
 
 void GameLogic::r7_refreshRoomBackground() {
 	if (_pizzathonListFlags1 & 0x08) {
-		_vm->drawRoomImageToBackground("bboard", 68, 39);
+		_vm->drawRoomImageToBackground("bboard.pcx", 68, 39);
 		_vm->moveObjectToRoom(kObjectIdBillboard_0, 7);
 		_vm->moveObjectToNowhere(kObjectIdBillboard7);
 	}
 	if (_r7_flags & 0x04) {
-		_vm->drawRoomImageToBackground("opendoor", 155, 73);
+		_vm->drawRoomImageToBackground("opendoor.pcx", 155, 73);
 	}
 	if (!(_pizzathonListFlags2 & 0x08)) {
-		_vm->drawRoomImageToBackground("elvis0", 197, 68);
+		_vm->drawRoomImageToBackground("elvis0.pcx", 197, 68);
 		_vm->moveObjectToRoom(kObjectIdProtesters7, 7);
 		if (!_vm->_hasRoomAnimationCallback) {
 			r7_initRoomAnimations();
@@ -3796,7 +3799,7 @@ void GameLogic::r8_updateRoomAnimations() {
 
 void GameLogic::r8_refreshRoomBackground() {
 	if (!(_r8_flags & 0x01)) {
-		_vm->drawRoomImageToBackground("opendoor", 259, 51);
+		_vm->drawRoomImageToBackground("opendoor.pcx", 259, 51);
 	}
 	if (!(_r8_flags & 0x08) && ((_r8_flags & 0x80) || (_r38_flags & 0x08))) {
 		_vm->_roomEventNum = 1;
@@ -4164,7 +4167,7 @@ void GameLogic::r9_updateRoomAnimations() {
 
 void GameLogic::r9_refreshRoomBackground() {
 	if (!(_pizzathonListFlags1 & 0x01)) {
-		_vm->drawRoomImageToBackground("man", 211, 59);
+		_vm->drawRoomImageToBackground("man.pcx", 211, 59);
 	}
 	if (!_vm->_hasRoomAnimationCallback) {
 		r9_initRoomAnimations();
@@ -4469,19 +4472,19 @@ bool GameLogic::r10_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 
 void GameLogic::r10_refreshRoomBackground() {
 	if (_r10_flags & 0x02) {
-		_vm->drawRoomImageToBackground("cticket", 147, 100);
+		_vm->drawRoomImageToBackground("cticket.pcx", 147, 100);
 	}
 	if (_r10_flags & 0x01) {
-		_vm->drawRoomImageToBackground("money", 136, 100);
+		_vm->drawRoomImageToBackground("money.pcx", 136, 100);
 	}
 	if (_r10_flags & 0x40) {
-		_vm->drawRoomImageToBackground("candybar", 135, 100);
+		_vm->drawRoomImageToBackground("candybar.pcx", 135, 100);
 	}
 	if (_r10_flags & 0x10) {
-		_vm->drawRoomImageToBackground("nogum", 248, 88);
+		_vm->drawRoomImageToBackground("nogum.pcx", 248, 88);
 	}
 	if (_r10_flags & 0x20) {
-		_vm->drawRoomImageToBackground("nojawb", 271, 88);
+		_vm->drawRoomImageToBackground("nojawb.pcx", 271, 88);
 	}
 }
 
@@ -4667,18 +4670,18 @@ void GameLogic::r11_refreshRoomBackground() {
 	if (!_vm->_hasRoomAnimationCallback && !(_r11_flags & 0x10)) {
 		r11_initRoomAnimations();
 	} else if (_r11_flags & 0x10) {
-		_vm->drawRoomImageToBackground("fillbag", 45, 92);
+		_vm->drawRoomImageToBackground("fillbag.pcx", 45, 92);
 	}
 	if (_r11_flags & 0x08) {
-		_vm->drawRoomImageToBackground("plugin5", 189, 60);
+		_vm->drawRoomImageToBackground("plugin5.pcx", 189, 60);
 	} else if (_r11_flags & 0x01) {
-		_vm->drawRoomImageToBackground("plunge15", 190, 62);
+		_vm->drawRoomImageToBackground("plunge15.pcx", 190, 62);
 	}
 	if (_r11_flags & 0x02) {
-		_vm->drawRoomImageToBackground("cord", 114, 140);
+		_vm->drawRoomImageToBackground("cord.pcx", 114, 140);
 	}
 	if (_r11_flags & 0x04) {
-		_vm->drawRoomImageToBackground("suckcut", 116, 125);
+		_vm->drawRoomImageToBackground("suckcut.pcx", 116, 125);
 	}
 }
 
@@ -4751,7 +4754,7 @@ void GameLogic::r11_useSuckCutWithExtensionCord() {
 	_vm->_garthSpriteX = -1;
 	_vm->_hasRoomAnimationCallback = false;
 	_vm->playAnimation("usecord", 0, 7, 106, 102, 0, 150);
-	_vm->drawRoomImageToBackground("suckcut", 116, 125);
+	_vm->drawRoomImageToBackground("suckcut.pcx", 116, 125);
 	_vm->moveObjectToRoom(kObjectIdSuckCut, 11);
 	_vm->moveObjectToNowhere(kObjectIdInventorySuckCut);
 	_vm->refreshInventory(true);
@@ -4764,7 +4767,7 @@ void GameLogic::r11_useSuckCutWithExtensionCord() {
 void GameLogic::r11_useExtensionCordWithOutlet() {
 	_vm->_garthSpriteX = -1;
 	_vm->playAnimation("plugin", 0, 6, 189, 60, 0, 150);
-	_vm->drawRoomImageToBackground("cord", 114, 140);
+	_vm->drawRoomImageToBackground("cord.pcx", 114, 140);
 	_vm->moveObjectToRoom(kObjectIdExtensionCord_1, 11);
 	_vm->moveObjectToNowhere(kObjectIdInventoryExtensionCord);
 	_vm->refreshInventory(true);
@@ -4955,7 +4958,7 @@ bool GameLogic::r12_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 
 void GameLogic::r12_refreshRoomBackground() {
 	if ((_r30_flags & 0x08) && !(_pizzathonListFlags2 & 0x02)) {
-		_vm->drawRoomImageToBackground("people0", 73, 81);
+		_vm->drawRoomImageToBackground("people0.pcx", 73, 81);
 		_vm->moveObjectToRoom(kObjectIdWoman, 12);
 		_vm->moveObjectToRoom(kObjectIdFarmer, 12);
 		_vm->moveObjectToRoom(kObjectIdCecil, 12);
@@ -4966,7 +4969,7 @@ void GameLogic::r12_refreshRoomBackground() {
 		_vm->setStaticRoomObjectPosition(12, 0, 0, 214, 69);
 		_vm->setStaticRoomObjectPosition(12, 2, 2, -1, 69);
 		_vm->moveObjectToNowhere(kObjectIdCecil);
-		Common::String filename = Common::String::format("people%d", peopleIndex);
+		Common::String filename = Common::String::format("people%d.pcx", peopleIndex);
 		_vm->drawRoomImageToBackground(filename.c_str(), 73, 81);
 		if (peopleIndex == 0) {
 			_vm->moveObjectToRoom(kObjectIdWoman, 12);
@@ -4977,7 +4980,7 @@ void GameLogic::r12_refreshRoomBackground() {
 		}
 	}
 	if (!(_r12_flags & 0x01)) {
-		_vm->drawRoomImageToBackground("lawyer0", 55, 84);
+		_vm->drawRoomImageToBackground("lawyer0.pcx", 55, 84);
 		_vm->moveObjectToRoom(kObjectIdMan_0, 12);
 	} else {
 		_vm->moveObjectToNowhere(kObjectIdMan_0);
@@ -5022,7 +5025,7 @@ void GameLogic::r12_givePotatoChipToCecil() {
 	_vm->setStaticRoomObjectPosition(12, 0, 0, 214, 69);
 	_vm->setStaticRoomObjectPosition(12, 2, 2, -1, 69);
 	_vm->moveObjectToNowhere(kObjectIdCecil);
-	_vm->drawRoomImageToBackground("cwalk12", 198, 84);
+	_vm->drawRoomImageToBackground("cwalk12.pcx", 198, 84);
 }
 
 int GameLogic::r13_handleVerbUse() {
@@ -5249,11 +5252,11 @@ bool GameLogic::r13_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 
 void GameLogic::r13_refreshRoomBackground() {
 	if (!(_r13_flags & 0x04)) {
-		_vm->drawRoomImageToBackground("ptalk0", 72, 60);
+		_vm->drawRoomImageToBackground("ptalk0.pcx", 72, 60);
 	}
 	if (_pizzathonListFlags2 & 0x08) {
 		_r13_flags |= 0x04;
-		_vm->drawRoomImageToBackground("newbackg", 0, 0);
+		_vm->drawRoomImageToBackground("newbackg.pcx", 0, 0);
 		_vm->setStaticRoomObjectPosition(13, 0, 3, -1, -1);
 		_vm->setStaticRoomObjectPosition(13, 4, 4, 96, 53);
 		_vm->setStaticRoomObjectPosition(13, 5, 5, 0, 94);
@@ -5387,10 +5390,10 @@ void GameLogic::r14_refreshRoomBackground() {
 		_vm->moveObjectToNowhere(kObjectIdBillboard14);
 		_vm->moveObjectToRoom(kObjectIdBillboard_2, 19);
 		_vm->moveObjectToNowhere(kObjectIdBillboard19);
-		_vm->drawRoomImageToBackground("bboard", 144, 38);
+		_vm->drawRoomImageToBackground("bboard.pcx", 144, 38);
 	}
 	if ((_r1_flags1 & 0x10) && !(_r19_flags & 0x08)) {
-		_vm->drawRoomImageToBackground("robot", 169, 76);
+		_vm->drawRoomImageToBackground("robot.pcx", 169, 76);
 		_vm->moveObjectToRoom(kObjectIdRobot, 14);
 		_vm->moveObjectToRoom(kObjectIdGilligan, 19);
 	} else {
@@ -5423,10 +5426,10 @@ bool GameLogic::r15_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 
 void GameLogic::r16_refreshRoomBackground() {
 	if (_r7_flags & 0x01) {
-		_vm->drawRoomImageToBackground("nocape", 179, 58);
+		_vm->drawRoomImageToBackground("nocape.pcx", 179, 58);
 	}
 	if (_r7_flags & 0x02) {
-		_vm->drawRoomImageToBackground("nohat", 201, 59);
+		_vm->drawRoomImageToBackground("nohat.pcx", 201, 59);
 	}
 }
 
@@ -5599,10 +5602,10 @@ void GameLogic::r18_updateRoomAnimations() {
 
 void GameLogic::r18_refreshRoomBackground() {
 	if (!(_r13_flags & 0x01)) {
-		_vm->drawRoomImageToBackground("pizza", 18, 92);
+		_vm->drawRoomImageToBackground("pizza.pcx", 18, 92);
 	}
 	if (_r13_flags & 0x02) {
-		_vm->drawRoomImageToBackground("notube", 71, 63);
+		_vm->drawRoomImageToBackground("notube.pcx", 71, 63);
 	}
 	if (!_vm->_hasRoomAnimationCallback) {
 		r18_initRoomAnimations();
@@ -5772,7 +5775,7 @@ void GameLogic::r19_handleVerbTalkTo() {
 		_vm->setDialogChoices(256, 257, 258, 259, 260);
 		break;
 	case kObjectIdMan_1:
-		_vm->drawRoomImageToScreen("mtalk1", 184, 68);
+		_vm->drawRoomImageToScreen("mtalk1.pcx", 184, 68);
 		_vm->displayTextLines("c04r", 487, 300, 20, 2);
 		_vm->setDialogChoices(449, 450, 451, 452, -1);
 		break;
@@ -5785,16 +5788,16 @@ void GameLogic::r19_refreshRoomBackground() {
 		_vm->moveObjectToNowhere(kObjectIdBillboard14);
 		_vm->moveObjectToRoom(kObjectIdBillboard_2, 19);
 		_vm->moveObjectToNowhere(kObjectIdBillboard19);
-		_vm->drawRoomImageToBackground("bboard", 32, 38);
+		_vm->drawRoomImageToBackground("bboard.pcx", 32, 38);
 	}
 	if ((_r1_flags1 & 0x10) && !(_r19_flags & 0x08)) {
-		_vm->drawRoomImageToBackground("robot", 57, 76);
+		_vm->drawRoomImageToBackground("robot.pcx", 57, 76);
 		_vm->moveObjectToRoom(kObjectIdRobot19, 19);
 	} else {
 		_vm->moveObjectToNowhere(kObjectIdRobot19);
 	}
 	if ((_r1_flags1 & 0x10) && !(_pizzathonListFlags1 & 0x04) && !(_pizzathonListFlags2 & 0x08)) {
-		_vm->drawRoomImageToBackground("gill0", 273, 84);
+		_vm->drawRoomImageToBackground("gill0.pcx", 273, 84);
 		_vm->moveObjectToRoom(kObjectIdGilligan, 19);
 	} else {
 		_vm->moveObjectToNowhere(kObjectIdGilligan);
@@ -5818,12 +5821,12 @@ void GameLogic::r19_handleRoomEvent() {
 
 void GameLogic::r20_refreshRoomBackground() {
 	if (_r19_flags & 0x01) {
-		_vm->drawRoomImageToBackground("expl0", 40, 32);
+		_vm->drawRoomImageToBackground("expl0.pcx", 40, 32);
 		_vm->_roomEventNum = 1;
 	} else {
 		_vm->setStaticRoomObjectPosition(20, 0, 1, -1, -1);
 		if (_pizzathonListFlags2 & 0x08) {
-			_vm->drawRoomImageToBackground("newbackg", 0, 0);
+			_vm->drawRoomImageToBackground("newbackg.pcx", 0, 0);
 			_vm->setStaticRoomObjectPosition(20, 2, 2, 176, 64);
 			_vm->moveObjectToRoom(kObjectIdMan_1, 20);
 			_vm->moveObjectToNowhere(kObjectIdCrate);
@@ -5832,10 +5835,10 @@ void GameLogic::r20_refreshRoomBackground() {
 			_vm->moveObjectToNowhere(kObjectIdMunchies);
 			_vm->moveObjectToNowhere(kObjectIdFood);
 		} else if (_r19_flags & 0x08) {
-			_vm->drawRoomImageToBackground("robjunk", 38, 93);
+			_vm->drawRoomImageToBackground("robjunk.pcx", 38, 93);
 			_vm->setStaticRoomObjectPosition(20, 1, 1, 72, 95);
 			if (_r19_flags & 0x10) {
-				_vm->drawRoomImageToBackground("nochip", 139, 108);
+				_vm->drawRoomImageToBackground("nochip.pcx", 139, 108);
 				_vm->moveObjectToNowhere(kObjectIdPotatoChip);
 			} else {
 				_vm->moveObjectToRoom(kObjectIdPotatoChip, 20);
@@ -5843,7 +5846,7 @@ void GameLogic::r20_refreshRoomBackground() {
 			_vm->moveObjectToRoom(kObjectIdRemains, 20);
 			_vm->moveObjectToNowhere(kObjectIdCrate);
 		} else if (_r1_flags1 & 0x10) {
-			_vm->drawRoomImageToBackground("crate", 103, 84);
+			_vm->drawRoomImageToBackground("crate.pcx", 103, 84);
 			_vm->setStaticRoomObjectPosition(20, 0, 0, 103, 84);
 			_vm->moveObjectToRoom(kObjectIdCrate, 20);
 		}
@@ -5870,13 +5873,13 @@ void GameLogic::r20_handleRoomEvent() {
 
 void GameLogic::r22_refreshRoomBackground() {
 	if (_r8_flags & 0x02) {
-		_vm->drawRoomImageToBackground("cab1open", 258, 69);
+		_vm->drawRoomImageToBackground("cab1open.pcx", 258, 69);
 	}
 	if (_r8_flags & 0x04) {
-		_vm->drawRoomImageToBackground("cab2open", 206, 52);
+		_vm->drawRoomImageToBackground("cab2open.pcx", 206, 52);
 	}
 	if (_r29_flags & 0x02) {
-		_vm->drawRoomImageToBackground("nomap", 209, 87);
+		_vm->drawRoomImageToBackground("nomap.pcx", 209, 87);
 	}
 }
 
@@ -5980,20 +5983,20 @@ int GameLogic::r24_handleVerbUse() {
 
 void GameLogic::r24_refreshRoomBackground() {
 	if (_r24_mazeRoomNumber > 48 && _r24_mazeRoomNumber < 59) {
-		_vm->drawRoomImageToBackground("bbackg", 0, 0);
+		_vm->drawRoomImageToBackground("bbackg.pcx", 0, 0);
 	} else if (_r24_mazeRoomNumber > 58) {
-		_vm->drawRoomImageToBackground("rbackg", 0, 0);
+		_vm->drawRoomImageToBackground("rbackg.pcx", 0, 0);
 	}
 	for (int holeIndex = 0; holeIndex < 7; holeIndex++) {
 		if (kMazeInfos[_r24_mazeRoomNumber][holeIndex] != -1) {
 			Common::String holeFilename;
 			_vm->moveObjectToRoom(holeIndex + 306, 24);
 			if (_r24_mazeRoomNumber < 49) {
-				holeFilename = Common::String::format("hole%d", holeIndex);
+				holeFilename = Common::String::format("hole%d.pcx", holeIndex);
 			} else if (_r24_mazeRoomNumber > 58) {
-				holeFilename = Common::String::format("rhole%d", holeIndex);
+				holeFilename = Common::String::format("rhole%d.pcx", holeIndex);
 			} else {
-				holeFilename = Common::String::format("bhole%d", holeIndex);
+				holeFilename = Common::String::format("bhole%d.pcx", holeIndex);
 			}
 			_vm->drawRoomImageToBackground(holeFilename.c_str(), kRoom24MazeHolePositionsX[holeIndex], kRoom24MazeHolePositionsY[holeIndex]);
 			if (holeIndex == 0) {
@@ -6029,25 +6032,26 @@ void GameLogic::r24_climbLadder(int wayneX, int wayneLadderX, int wayneLadderY,
 	WWSurface *wclimbSprites[4];
 	WWSurface *gclimbSprites[4];
 	WWSurface *getladSprites[3];
-
+	GxlArchive *roomLib = _vm->_roomGxl;
+	
 	for (int index = 0; index < 4; index++) {
 		tempFilename = Common::String::format("wclimb%d", index);
-		wclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		wclimbSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	for (int index = 0; index < 3; index++) {
 		tempFilename = Common::String::format("wgetlad%d", index);
-		getladSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		getladSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	workBackground = new WWSurface(320, 150);
 
 	if (_r24_mazeRoomNumber < 49) {
 		tempFilename = Common::String::format("ceil%d", ceilingIndex);
-		ceilingSprite = _vm->loadRoomSurface(tempFilename.c_str());
+		ceilingSprite = roomLib->loadRoomSurface(tempFilename.c_str());
 	} else {
 		tempFilename = Common::String::format("rceil%d", ceilingIndex);
-		ceilingSprite = _vm->loadRoomSurface(tempFilename.c_str());
+		ceilingSprite = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	for (int index = 0; index < 3; index++) {
@@ -6064,12 +6068,12 @@ void GameLogic::r24_climbLadder(int wayneX, int wayneLadderX, int wayneLadderY,
 
 	for (int index = 0; index < 4; index++) {
 		tempFilename = Common::String::format("gclimb%d", index);
-		gclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		gclimbSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	for (int index = 0; index < 3; index++) {
 		tempFilename = Common::String::format("ggetlad%d", index);
-		getladSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		getladSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	int climbCtr = 0, garthLadderY = wayneLadderY;
@@ -6128,27 +6132,28 @@ void GameLogic::r24_handleRoomEvent(int wayneLadderX, int wayneX, int wayneLadde
 	WWSurface *wclimbSprites[4];
 	WWSurface *gclimbSprites[4];
 	WWSurface *getladSprites[3];
-
+	GxlArchive *roomLib = _vm->_roomGxl;
+	
 	for (int index = 0; index < 4; index++) {
 		tempFilename = Common::String::format("wclimb%d", index);
-		wclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		wclimbSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 		tempFilename = Common::String::format("gclimb%d", index);
-		gclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		gclimbSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	for (int index = 0; index < 3; index++) {
 		tempFilename = Common::String::format("wgetlad%d", index);
-		getladSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		getladSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	workBackground = new WWSurface(320, 150);
 
 	if (_r24_mazeRoomNumber < 49) {
 		tempFilename = Common::String::format("ceil%d", ceilingIndex);
-		ceilingSprite = _vm->loadRoomSurface(tempFilename.c_str());
+		ceilingSprite = roomLib->loadRoomSurface(tempFilename.c_str());
 	} else {
 		tempFilename = Common::String::format("rceil%d", ceilingIndex);
-		ceilingSprite = _vm->loadRoomSurface(tempFilename.c_str());
+		ceilingSprite = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	int climbCtr = 0, garthLadderY = wayneLadderY;
@@ -6180,7 +6185,7 @@ void GameLogic::r24_handleRoomEvent(int wayneLadderX, int wayneX, int wayneLadde
 
 	for (int index = 0; index < 3; index++) {
 		tempFilename = Common::String::format("ggetlad%d", index);
-		getladSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		getladSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	for (int index = 2; index >= 0; index--) {
@@ -6234,7 +6239,7 @@ int GameLogic::r25_handleVerbUse() {
 
 void GameLogic::r25_refreshRoomBackground() {
 	if (_r25_holeIndex != -1) {
-		Common::String holeFilename = Common::String::format("hole%d", _r25_holeIndex % 2);
+		Common::String holeFilename = Common::String::format("hole%d.pcx", _r25_holeIndex % 2);
 		_vm->drawRoomImageToBackground(holeFilename.c_str(), kRoom25MazeHolePositionsX[_r25_holeIndex], kRoom25MazeHolePositionsY[_r25_holeIndex]);
 	}
 	_vm->setWaynePosition(150, 125);
@@ -6322,7 +6327,7 @@ void GameLogic::r28_refreshRoomBackground() {
 		_vm->_roomEventNum = 1;
 	}
 	if (_r20_flags & 0x02) {
-		_vm->drawRoomImageToBackground("repxit10", 0, 33);
+		_vm->drawRoomImageToBackground("repxit10.pcx", 0, 33);
 	}
 }
 
@@ -6423,7 +6428,7 @@ int GameLogic::r29_handleVerbUse() {
 		_vm->paletteFadeOut(0, 256, 8);
 		_vm->_screen->clear(0);
 		_vm->drawInterface(_vm->_verbNumber);
-		_vm->loadPalette("m01/wstand0");
+		_vm->loadPalette(_vm->_m01Gxl, "wstand0.pcx");
 		_vm->changeRoom(24);
 		CursorMan.showMouse(true);
 		break;
@@ -6465,16 +6470,16 @@ void GameLogic::r29_refreshRoomBackground() {
 		_vm->paletteFadeOut(0, 256, 8);
 		_vm->_screen->clear(0);
 		_vm->drawInterface(_vm->_verbNumber);
-		_vm->loadPalette("r29/stool");
+		_vm->loadPalette(_vm->_roomGxl, "stool.pcx");
 		_vm->_roomEventNum = 1;
 	}
 	if (!_vm->_hasRoomAnimationCallback) {
 		r29_initRoomAnimations();
 	}
 	if (!(_r29_flags & 0x01)) {
-		_vm->drawRoomImageToBackground("acid", 90, 81);
+		_vm->drawRoomImageToBackground("acid.pcx", 90, 81);
 	}
-	_vm->drawRoomImageToBackground("doc1", 138, 69);
+	_vm->drawRoomImageToBackground("doc1.pcx", 138, 69);
 }
 
 void GameLogic::r29_handleRoomEvent() {
@@ -6600,17 +6605,17 @@ bool GameLogic::r30_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 
 void GameLogic::r30_refreshRoomBackground() {
 	if (_r30_flags & 0x10) {
-		_vm->drawRoomImageToBackground("cbackg", 0, 0);
-		_vm->drawRoomImageToBackgroundTransparent("cecil", 177, 102);
+		_vm->drawRoomImageToBackground("cbackg.pcx", 0, 0);
+		_vm->drawRoomImageToBackgroundTransparent("cecil.pcx", 177, 102);
 	} else if (!(_r30_flags & 0x02)) {
-		_vm->drawRoomImageToBackground("babeshow", 105, 12);
+		_vm->drawRoomImageToBackground("babeshow.pcx", 105, 12);
 		_vm->_roomEventNum = 1;
 	} else if (!(_r30_flags & 0x01)) {
-		_vm->drawRoomImageToBackground("babeshow", 105, 12);
+		_vm->drawRoomImageToBackground("babeshow.pcx", 105, 12);
 		if (!(_r30_flags & 0x04)) {
-			_vm->drawRoomImageToBackground("waynecon", 224, 30);
+			_vm->drawRoomImageToBackground("waynecon.pcx", 224, 30);
 		} else {
-			_vm->drawRoomImageToBackground("nobink", 160, 33);
+			_vm->drawRoomImageToBackground("nobink.pcx", 160, 33);
 		}
 	} else if (!(_r30_flags & 0x08) && _vm->_roomChangeCtr > 20) {
 		r30_runLudwigCutscene();
@@ -6654,7 +6659,7 @@ void GameLogic::r30_runLudwigCutscene() {
 	// TODO gxSetDisplayPalette(palette2);
 	_vm->paletteFadeOut(0, 256, 64);
 	_vm->_screen->clear(0);
-	_vm->drawRoomImageToBackground("backg", 0, 0);
+	_vm->drawRoomImageToBackground("backg.pcx", 0, 0);
 	_vm->_screen->drawSurface(_vm->_backgroundSurface, 0, 0);
 	_vm->_musicIndex = 1;
 	_vm->changeMusic();
@@ -6830,15 +6835,15 @@ void GameLogic::r31_handleRoomEvent4() {
 			}
 			_vm->setDialogChoices(questionChoices[0], questionChoices[1], questionChoices[2], questionChoices[3], questionChoices[4]);
 			_vm->startDialog();
-			_vm->drawRoomImageToBackground("dnorm", 287, 30);
-			_vm->drawRoomImageToBackground("mtalk0", 240, 31);
+			_vm->drawRoomImageToBackground("dnorm.pcx", 287, 30);
+			_vm->drawRoomImageToBackground("mtalk0.pcx", 240, 31);
 			_r31_categorySelected = true;
 			return;
 		}
 
 		_r31_categorySelected = false;
 		_r31_askedQuestions[_r31_categoryIndex * 5 + _r31_questionIndex] = true;
-		_vm->drawRoomImageToBackground("star", kRoom31StarPositionsX[_r31_categoryIndex], kRoom31StarPositionsY[_r31_categoryIndex * 5 + _r31_questionIndex]);
+		_vm->drawRoomImageToBackground("star.pcx", kRoom31StarPositionsX[_r31_categoryIndex], kRoom31StarPositionsY[_r31_categoryIndex * 5 + _r31_questionIndex]);
 
 		_vm->_mouseClickButtons = 0;
 
@@ -6861,8 +6866,8 @@ void GameLogic::r31_handleRoomEvent4() {
 		if (_vm->_mouseClickButtons != 0 && _vm->_mouseClickX > 130 && _vm->_mouseClickX < 180 && _vm->_mouseClickY > 106 && _vm->_mouseClickY < 128) {
 			_r31_currentPlayer = 0;
 			r31_useBuzzer();
-			_vm->drawRoomImageToBackground("dlook", 287, 30);
-			_vm->drawRoomImageToBackground("mlook", 240, 31);
+			_vm->drawRoomImageToBackground("dlook.pcx", 287, 30);
+			_vm->drawRoomImageToBackground("mlook.pcx", 240, 31);
 			r31_buildQuestionDialogChoices(_r31_categoryIndex, _r31_questionIndex);
 			return;
 		} else {
@@ -6916,13 +6921,13 @@ void GameLogic::r31_handleRoomEvent5() {
 }
 
 void GameLogic::r31_drawDBuzzer() {
-	_vm->drawRoomImageToScreen("dbuzzer", 247, 78);
+	_vm->drawRoomImageToScreen("dbuzzer.pcx", 247, 78);
 	_vm->waitSeconds(2);
 	_vm->_screen->drawSurface(_vm->_backgroundSurface, 0, 0);
 }
 
 void GameLogic::r31_drawMBuzzer() {
-	_vm->drawRoomImageToScreen("mbuzzer", 210, 61);
+	_vm->drawRoomImageToScreen("mbuzzer.pcx", 210, 61);
 	_vm->waitSeconds(2);
 	_vm->_screen->drawSurface(_vm->_backgroundSurface, 0, 0);
 }
@@ -6943,7 +6948,7 @@ void GameLogic::r31_playTalkAnim(int talkerIndex) {
 }
 
 void GameLogic::r31_useBuzzer() {
-	_vm->drawRoomImageToScreen("buzzer", 131, 106);
+	_vm->drawRoomImageToScreen("buzzer.pcx", 131, 106);
 	_vm->playSound("ss04", 1);
 	_vm->_screen->drawSurface(_vm->_backgroundSurface, 0, 0);
 	if (!(_r31_flags & 0x01)) {
@@ -6954,12 +6959,14 @@ void GameLogic::r31_useBuzzer() {
 
 void GameLogic::r31_displayCategories() {
 	CursorMan.showMouse(false);
-	WWSurface *screenImage = _vm->loadRoomSurface("screen");
+	GxlArchive *roomLib = _vm->_roomGxl;
+
+	WWSurface *screenImage = roomLib->loadRoomSurface("screen");
 	_vm->drawSpiralEffect(screenImage, 0, 0, 4, 4);
 	delete screenImage;
 	for (int categoryIndex = 0; categoryIndex < 5; categoryIndex++) {
 		Common::String categoryFilename = Common::String::format("cat%d", categoryIndex);
-		WWSurface *categoryImage = _vm->loadRoomSurface(categoryFilename.c_str());
+		WWSurface *categoryImage = roomLib->loadRoomSurface(categoryFilename.c_str());
 		_vm->drawRandomEffect(categoryImage, 17, 61, 1, 1);
 		delete categoryImage;
 		_vm->waitSeconds(3);
@@ -6972,8 +6979,8 @@ void GameLogic::r31_displayCategories() {
 void GameLogic::r31_runBabeoff() {
 	_vm->_gameState = 0;
 	_vm->drawInterface(_vm->_verbNumber);
-	_vm->drawRoomImageToBackground("dnorm", 287, 30);
-	_vm->drawRoomImageToBackground("mtalk0", 240, 31);
+	_vm->drawRoomImageToBackground("dnorm.pcx", 287, 30);
+	_vm->drawRoomImageToBackground("mtalk0.pcx", 240, 31);
 	for (int textIndex = 54; textIndex < 62; textIndex++) {
 		_vm->displayText("gms", textIndex, 0, 50, 10, 0);
 		r31_playTalkAnim(3);
@@ -7001,18 +7008,18 @@ void GameLogic::r31_drawCurrentPlayerScore() {
 	int numberY = kRoom31NumberPositionsY[_r31_currentPlayer];
 	int score = _r31_scores[_r31_currentPlayer];
 	if (score > 99) {
-		Common::String numberFilename = Common::String::format("n%d", score / 100);
+		Common::String numberFilename = Common::String::format("n%d.pcx", score / 100);
 		_vm->drawRoomImageToBackground(numberFilename.c_str(), numberX, numberY);
 	} else {
 		_vm->_backgroundSurface->fillRect(numberX, numberY, numberX + 3, numberY + 6, 0);
 	}
 	if (score > 9) {
-		Common::String numberFilename = Common::String::format("n%d", (score % 100) / 10);
+		Common::String numberFilename = Common::String::format("n%d.pcx", (score % 100) / 10);
 		_vm->drawRoomImageToBackground(numberFilename.c_str(), numberX + 5, numberY);
 	} else {
 		_vm->_backgroundSurface->fillRect(numberX + 5, numberY, numberX + 8, numberY + 6, 0);
 	}
-	Common::String numberFilename = Common::String::format("n%d", score % 10);
+	Common::String numberFilename = Common::String::format("n%d.pcx", score % 10);
 	_vm->drawRoomImageToBackground(numberFilename.c_str(), numberX + 10, numberY);
 	_vm->refreshActors();
 }
@@ -7047,8 +7054,8 @@ void GameLogic::r31_correctAnswerSelected() {
 }
 
 void GameLogic::r31_wrongAnswerSelected() {
-	_vm->drawRoomImageToBackground("dnorm", 287, 30);
-	_vm->drawRoomImageToBackground("mtalk0", 240, 31);
+	_vm->drawRoomImageToBackground("dnorm.pcx", 287, 30);
+	_vm->drawRoomImageToBackground("mtalk0.pcx", 240, 31);
 	_vm->displayText("gms", 53, 0, 50, 10, 0);
 	r31_playTalkAnim(3);
 	_r31_scores[0] -= (_r31_questionIndex + 1) * 10;
@@ -7115,7 +7122,7 @@ void GameLogic::r32_handleVerbTalkTo() {
 			_vm->displayTextLines("c04", 419, -1, -1, 1);
 		} else {
 			r32_uninitRoomAnimations();
-			_vm->drawRoomImageToBackground("jtalk1", 262, 84);
+			_vm->drawRoomImageToBackground("jtalk1.pcx", 262, 84);
 			_vm->setDialogChoices(402, 403, 404, 405, 406);
 		}
 		break;
@@ -7228,16 +7235,16 @@ void GameLogic::r32_updateRoomAnimations() {
 
 void GameLogic::r32_refreshRoomBackground() {
 	if (!(_pizzathonListFlags2 & 0x08)) {
-		_vm->drawRoomImageToBackground("cdoor", 13, 65);
+		_vm->drawRoomImageToBackground("cdoor.pcx", 13, 65);
 		_vm->fillRoomMaskArea(0, 0, 33, 149, true);
 	} else {
 		_vm->moveObjectToNowhere(kObjectIdDoor32_0);
 		_vm->moveObjectToRoom(kObjectIdOffice, 32);
 		_vm->moveObjectToRoom(kObjectIdJanitor, 32);
 		_vm->moveObjectToRoom(kObjectIdCart, 32);
-		_vm->drawRoomImageToBackground("cart", 269, 82);
+		_vm->drawRoomImageToBackground("cart.pcx", 269, 82);
 		if (_r32_flags & 0x02) {
-			_vm->drawRoomImageToBackground("noplunge", 293, 94);
+			_vm->drawRoomImageToBackground("noplunge.pcx", 293, 94);
 		}
 		r32_initRoomAnimations();
 	}
@@ -7271,7 +7278,7 @@ void GameLogic::r32_pickUpMemo() {
 
 void GameLogic::r33_refreshRoomBackground() {
 	if (_r32_flags & 0x01) {
-		_vm->drawRoomImageToBackground("nomemo", 55, 100);
+		_vm->drawRoomImageToBackground("nomemo.pcx", 55, 100);
 	}
 }
 
@@ -7432,22 +7439,22 @@ void GameLogic::r34_updateRoomAnimations() {
 
 void GameLogic::r34_refreshRoomBackground() {
 	if (!(_r34_flags & 0x01) && !_vm->_hasRoomAnimationCallback) {
-		_vm->drawRoomImageToBackground("towel0", 198, 68);
+		_vm->drawRoomImageToBackground("towel0.pcx", 198, 68);
 		r34_initRoomAnimations();
 	} else {
 		_vm->moveObjectToNowhere(kObjectIdMan34);
 		_vm->moveObjectToRoom(kObjectIdLocker, 34);
 	}
 	if (_r34_flags & 0x02) {
-		_vm->drawRoomImageToBackground("openlckr", 95, 60);
+		_vm->drawRoomImageToBackground("openlckr.pcx", 95, 60);
 		if (_r34_flags & 0x08) {
-			_vm->drawRoomImageToBackground("lunchbox", 96, 87);
+			_vm->drawRoomImageToBackground("lunchbox.pcx", 96, 87);
 			_vm->moveObjectToRoom(kObjectIdLunchBox, 34);
 		} else {
 			_vm->moveObjectToNowhere(kObjectIdLunchBox);
 		}
 		if (!(_r34_flags & 0x01)) {
-			_vm->drawRoomImageToBackground("passcard", 98, 74);
+			_vm->drawRoomImageToBackground("passcard.pcx", 98, 74);
 			_vm->moveObjectToRoom(kObjectIdPasscard, 34);
 		} else {
 			_vm->moveObjectToNowhere(kObjectIdPasscard);
@@ -7563,7 +7570,7 @@ bool GameLogic::r35_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 
 void GameLogic::r35_refreshRoomBackground() {
 	if (!(_r35_flags & 0x01)) {
-		_vm->drawRoomImageToBackground("cass1", 179, 68);
+		_vm->drawRoomImageToBackground("cass1.pcx", 179, 68);
 	}
 	_vm->_roomEventNum = 1;
 }
@@ -7658,7 +7665,7 @@ void GameLogic::r36_updateRoomAnimations() {
 
 void GameLogic::r36_refreshRoomBackground() {
 	if (_r36_flags & 0x04) {
-		_vm->drawRoomImageToBackground("nolunch", 268, 101);
+		_vm->drawRoomImageToBackground("nolunch.pcx", 268, 101);
 	}
 	if (!_vm->_hasRoomAnimationCallback) {
 		r36_initRoomAnimations();
@@ -7764,15 +7771,15 @@ void GameLogic::r37_refreshRoomBackground() {
 		_vm->_roomEventNum = 1;
 	}
 	if (!(_r37_flags & 0x04)) {
-		Common::String lockFilename = Common::String::format("lock%d", _r37_safeCombinationLockIndex);
+		Common::String lockFilename = Common::String::format("lock%d.pcx", _r37_safeCombinationLockIndex);
 		_vm->drawRoomImageToBackground(lockFilename.c_str(), 109, 97);
 	} else {
-		_vm->drawRoomImageToBackground("opensafe", 92, 84);
+		_vm->drawRoomImageToBackground("opensafe.pcx", 92, 84);
 		if (_r37_flags & 0x08) {
-			_vm->drawRoomImageToBackground("nokeys", 101, 95);
+			_vm->drawRoomImageToBackground("nokeys.pcx", 101, 95);
 		}
 		if (_r37_flags & 0x10) {
-			_vm->drawRoomImageToBackground("nomoney", 102, 102);
+			_vm->drawRoomImageToBackground("nomoney.pcx", 102, 102);
 		}
 	}
 }
@@ -7783,15 +7790,16 @@ void GameLogic::r37_climbExitLadderUp() {
 	WWSurface *wclimbSprites[4];
 	WWSurface *gclimbSprites[4];
 	WWSurface *getldrSprites[3];
+	GxlArchive *roomLib = _vm->_roomGxl;
 
 	for (int index = 0; index < 4; index++) {
 		tempFilename = Common::String::format("wclimb%d", index);
-		wclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		wclimbSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
     for (int index = 0; index < 3; index++) {
 		tempFilename = Common::String::format("wgetldr%d", index);
-		getldrSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		getldrSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 	
 	workBackground = new WWSurface(320, 150);
@@ -7810,12 +7818,12 @@ void GameLogic::r37_climbExitLadderUp() {
 	
 	for (int index = 0; index < 4; index++) {
 		tempFilename = Common::String::format("gclimb%d", index);
-		gclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		gclimbSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	for (int index = 0; index < 3; index++) {
 		tempFilename = Common::String::format("ggetldr%d", index);
-		getldrSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		getldrSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	int wayneLadderY = 24;
@@ -7861,19 +7869,20 @@ void GameLogic::r37_climbLadderDown() {
 	WWSurface *gclimbSprites[4];
 	WWSurface *wgetldlSprites[3];
 	WWSurface *ggetldlSprites[3];
+	GxlArchive *roomLib = _vm->_roomGxl;
 
 	for (int index = 0; index < 4; index++) {
 		tempFilename = Common::String::format("wclimb%d", index);
-		wclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		wclimbSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 		tempFilename = Common::String::format("gclimb%d", index);
-		gclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		gclimbSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	for (int index = 0; index < 3; index++) {
 		tempFilename = Common::String::format("wgetldl%d", index);
-		wgetldlSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		wgetldlSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 		tempFilename = Common::String::format("ggetldl%d", index);
-		ggetldlSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		ggetldlSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	workBackground = new WWSurface(320, 150);
@@ -7969,19 +7978,20 @@ void GameLogic::r37_climbLadderUp() {
 	WWSurface *gclimbSprites[4];
 	WWSurface *wgetldlSprites[3];
 	WWSurface *ggetldlSprites[3];
+	GxlArchive *roomLib = _vm->_roomGxl;
 
 	for (int index = 0; index < 4; index++) {
 		tempFilename = Common::String::format("wclimb%d", index);
-		wclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		wclimbSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 		tempFilename = Common::String::format("gclimb%d", index);
-		gclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		gclimbSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
     for (int index = 0; index < 3; index++) {
 		tempFilename = Common::String::format("wgetldl%d", index);
-		wgetldlSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		wgetldlSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 		tempFilename = Common::String::format("ggetldl%d", index);
-		ggetldlSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		ggetldlSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	workBackground = new WWSurface(320, 150);
@@ -8117,17 +8127,18 @@ void GameLogic::r37_climbEnterLadderDown() {
 	WWSurface *wclimbSprites[4];
 	WWSurface *gclimbSprites[4];
 	WWSurface *getldrSprites[3];
+	GxlArchive *roomLib = _vm->_roomGxl;
 
 	for (int index = 0; index < 4; index++) {
 		tempFilename = Common::String::format("wclimb%d", index);
-		wclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		wclimbSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 		tempFilename = Common::String::format("gclimb%d", index);
-		gclimbSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		gclimbSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	for (int index = 0; index < 3; index++) {
 		tempFilename = Common::String::format("wgetldr%d", index);
-		getldrSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		getldrSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	workBackground = new WWSurface(320, 150);
@@ -8160,7 +8171,7 @@ void GameLogic::r37_climbEnterLadderDown() {
 
 	for (int index = 0; index < 3; index++) {
 		tempFilename = Common::String::format("ggetldr%d", index);
-		getldrSprites[index] = _vm->loadRoomSurface(tempFilename.c_str());
+		getldrSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
 	for (int index = 2; index >= 0; index--) {
@@ -8262,7 +8273,7 @@ void GameLogic::r38_refreshRoomBackground() {
 		r38_initRoomAnimations();
 	}
 	if ((_r38_flags & 0x08)) {
-		_vm->drawRoomImageToBackground("backg2", 0, 0);
+		_vm->drawRoomImageToBackground("backg2.pcx", 0, 0);
 		_vm->setStaticRoomObjectPosition(38, 2, 2, 166, 94);
 	} else {
 		if (_r35_flags & 0x01) {
@@ -8286,8 +8297,8 @@ void GameLogic::r38_atrap() {
 void GameLogic::r38_useCassandra() {
 	_vm->moveObjectToNowhere(kObjectIdCassandra);
 	_vm->setStaticRoomObjectPosition(38, 1, 1, -1, 72);
-	_vm->drawRoomImageToScreen("nocass", 168, 76);
-	_vm->drawRoomImageToBackground("nocass", 168, 76);
+	_vm->drawRoomImageToScreen("nocass.pcx", 168, 76);
+	_vm->drawRoomImageToBackground("nocass.pcx", 168, 76);
 	_vm->playAnimation("btrap", 0, 25, 124, 15, 0, 100);
 	_r38_flags |= 0x04;
 }
@@ -8368,12 +8379,12 @@ int GameLogic::r39_handleVerbOpen() {
 
 void GameLogic::r39_refreshRoomBackground() {
 	if (_r39_flags & 0x02) {
-		_vm->drawRoomImageToBackground("shoot13", 108, 49);
+		_vm->drawRoomImageToBackground("shoot13.pcx", 108, 49);
 	}
 	if (_r39_flags & 0x04) {
-		_vm->drawRoomImageToBackground("wshoot", 87, 90);
+		_vm->drawRoomImageToBackground("wshoot.pcx", 87, 90);
 	} else  if (_r39_flags & 0x08) {
-		_vm->drawRoomImageToBackground("gshoot", 88, 90);
+		_vm->drawRoomImageToBackground("gshoot.pcx", 88, 90);
 	}
 }
 
diff --git a/engines/waynesworld/gamemap.cpp b/engines/waynesworld/gamemap.cpp
index fc0b06d7f49..e5b34ff5292 100644
--- a/engines/waynesworld/gamemap.cpp
+++ b/engines/waynesworld/gamemap.cpp
@@ -124,7 +124,7 @@ void WaynesWorldEngine::gameMapOpen() {
     _musicIndex = 2;
     changeMusic();
     _screen->clear(0);
-    drawImageToScreen("m02/main_map", 0, 0);
+    drawImageToScreen(_m02Gxl, "main_map.pcx", 0, 0);
     _screen->fillSquare(kMapItem9s[_gameMapRoomNumber].x0, kMapItem9s[_gameMapRoomNumber].y0, 3, 109);
     paletteFadeIn(0, 256, 16);
     // TODO gameMapPaletteHandlerStart();
@@ -147,7 +147,7 @@ void WaynesWorldEngine::gameMapHandleMouseMove(int objectNumber) {
     if (_hoverObjectNumber == objectNumber)
         return;
     _hoverObjectNumber = objectNumber;
-
+	GxlArchive *lib = _m02Gxl;
     Common::String tagFilename;
     int tagX = -1, tagY = -1;
 
@@ -159,23 +159,23 @@ void WaynesWorldEngine::gameMapHandleMouseMove(int objectNumber) {
             _currentMapItemIndex = -1;
         } else if (_currentMapItemIndex >= 0 && _currentMapItemIndex <= 5) {
             const MapItem13 &item = kMapItem13s[_currentMapItemIndex];
-            tagFilename = Common::String::format("m02/%s_xtag", item.name);
+            tagFilename = Common::String::format("%s_xtag.pcx", item.name);
             tagX = item.tagX;
             tagY = item.tagY;
         } else if (_currentMapItemIndex >= 7 && _currentMapItemIndex <= 21) {
             const MapItem17 &item = kMapItem17s[_currentMapItemIndex - 7];
-            tagFilename = Common::String::format("m02/%s_xtag", item.name);
+            tagFilename = Common::String::format("%s_xtag.pcx", item.name);
             tagX = item.tagX;
             tagY = item.tagY;
         }
     } else if (_hoverObjectNumber >= 0 && _hoverObjectNumber <= 5) {
         const MapItem13 &item = kMapItem13s[_hoverObjectNumber];
-        tagFilename = Common::String::format("m02/%s_tag", item.name);
+        tagFilename = Common::String::format("%s_tag.pcx", item.name);
         tagX = item.tagX;
         tagY = item.tagY;
     } else if (_hoverObjectNumber >= 7 && _hoverObjectNumber <= 21) {
         const MapItem17 &item = kMapItem17s[_hoverObjectNumber - 7];
-        tagFilename = Common::String::format("m02/%s_tag", item.name);
+        tagFilename = Common::String::format("%s_tag.pcx", item.name);
         tagX = item.tagX;
         tagY = item.tagY;
     } else if (_hoverObjectNumber == 6 || (_hoverObjectNumber >= 22 && _hoverObjectNumber <= 27)) {
@@ -187,7 +187,7 @@ void WaynesWorldEngine::gameMapHandleMouseMove(int objectNumber) {
 
     if (tagX != -1 && tagY != -1) {
         _currentMapItemIndex = _hoverObjectNumber;
-        drawImageToScreen(tagFilename.c_str(), tagX, tagY);
+        drawImageToScreen(lib, tagFilename.c_str(), tagX, tagY);
     }
 
 }
@@ -203,7 +203,7 @@ void WaynesWorldEngine::gameMapHandleMouseClick() {
     } else if (_hoverObjectNumber >= 22 && _hoverObjectNumber <= 27) {
         _gameMapFlag = false;
         _currentRoomNumber = 100;
-        drawImageToScreen("m02/main_map", 0, 0);
+        drawImageToScreen(_m02Gxl, "main_map.pcx", 0, 0);
         _screen->fillSquare(kMapItem9s[_gameMapRoomNumber].x0, kMapItem9s[_gameMapRoomNumber].y0, 3, 109);
     } else if (_hoverObjectNumber >= 0 && _hoverObjectNumber <= 5) {
         const MapItem13 &item = kMapItem13s[_hoverObjectNumber];
@@ -222,7 +222,7 @@ void WaynesWorldEngine::gameMapHandleMouseClick() {
 
     if (isDone) {
         gameMapFinish();
-        loadPalette("m01/wstand0");
+        loadPalette(_m01Gxl, "wstand0.pcx");
     }
 
 }
@@ -230,11 +230,11 @@ void WaynesWorldEngine::gameMapHandleMouseClick() {
 void WaynesWorldEngine::gameMapSelectItem(const char *prefix, int animX, int animY) {
     // sysMouseDriver(2);
     for (int frameNum = 0; frameNum < 12; frameNum++) {
-        Common::String filename = Common::String::format("m02/%s_zm%d", prefix, frameNum);
-        drawImageToScreen(filename.c_str(), animX, animY);
+        Common::String filename = Common::String::format("%s_zm%d.pcx", prefix, frameNum);
+        drawImageToScreen(_m02Gxl, filename.c_str(), animX, animY);
         waitMillis(50);
     }
-    drawImageToScreen("m02/zmbtn", 125, 188);
+	drawImageToScreen(_m02Gxl, "zmbtn.pcx", 125, 188);
     if (kMapItem9s[_gameMapRoomNumber].roomNumber == _currentRoomNumber) {
         _screen->fillSquare(kMapItem9s[_gameMapRoomNumber].x1, kMapItem9s[_gameMapRoomNumber].y1, 3, 109);
     }
diff --git a/engines/waynesworld/gxlarchive.cpp b/engines/waynesworld/gxlarchive.cpp
index 8e121f35b55..8fd558607d3 100644
--- a/engines/waynesworld/gxlarchive.cpp
+++ b/engines/waynesworld/gxlarchive.cpp
@@ -28,6 +28,7 @@
 #include "common/textconsole.h"
 
 #include "waynesworld/gxlarchive.h"
+#include "waynesworld/graphics.h"
 
 namespace WaynesWorld {
 
@@ -122,4 +123,29 @@ Common::SeekableReadStream *GxlArchive::createReadStreamForMember(const Common::
 	return new Common::MemoryReadStream(data, hdr->size, DisposeAfterUse::YES);
 }
 
+Image::PCXDecoder *GxlArchive::loadImage(const char *filename) {
+	if (!hasFile(Common::Path(filename)))
+		error("loadImage() Could not find '%s'", filename);
+
+	Image::PCXDecoder *pcx = new Image::PCXDecoder();
+	if (!pcx->loadStream(*createReadStreamForMember(Common::Path(filename))))
+		error("loadImage() Could not process '%s'", filename);
+	
+	return pcx;
+}
+
+WWSurface *GxlArchive::loadSurfaceIntern(const char *filename) {
+	Image::PCXDecoder *imageDecoder = loadImage(filename);
+	WWSurface *surface = new WWSurface(imageDecoder->getSurface());
+	delete imageDecoder;
+	return surface;
+}
+
+WWSurface *GxlArchive::loadRoomSurface(const char *filename) {
+	return loadSurfaceIntern(filename);
+}
+
+WWSurface *GxlArchive::loadSurface(const char *filename) {
+	return loadSurfaceIntern(filename);
+}
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/gxlarchive.h b/engines/waynesworld/gxlarchive.h
index 5aa5a543342..3d08cda268f 100644
--- a/engines/waynesworld/gxlarchive.h
+++ b/engines/waynesworld/gxlarchive.h
@@ -23,6 +23,7 @@
 #define WAYNESWORLD_GXLARCHIVE
 
 #include "common/archive.h"
+#include "gamelogic.h"
 
 namespace Common {
 class File;
@@ -44,6 +45,8 @@ class GxlArchive : public Common::Archive {
 	GxlHeadersMap _headers;
 	Common::File *_gxlFile;
 
+	WWSurface *loadSurfaceIntern(const char *filename);
+
 public:
 	GxlArchive(const Common::String name);
 	~GxlArchive() override;
@@ -53,6 +56,10 @@ public:
 	int listMembers(Common::ArchiveMemberList &list) const override;
 	const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
 	Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
+
+	Image::PCXDecoder *loadImage(const char *filename);
+	WWSurface *loadRoomSurface(const char *filename);
+	WWSurface *loadSurface(const char *filename);
 };
 
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index de98fe773bc..37d7407f4a9 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -96,6 +96,19 @@ Common::Error WaynesWorldEngine::run() {
 	_fontWWInv->loadFromFile("wwinv.gft");
 	_fontBit5x7->loadFromFile("bit5x7.gft");
 
+	_m00Gxl = new GxlArchive("m00");
+	_m01Gxl = new GxlArchive("m01");
+	_m02Gxl = new GxlArchive("m02");
+	_m03Gxl = new GxlArchive("m03");
+	_m05Gxl = new GxlArchive("m05");
+
+	_r08Gxl = new GxlArchive("r08");
+	_r10Gxl = new GxlArchive("r10");
+	_r14Gxl = new GxlArchive("r14");
+	_r21Gxl = new GxlArchive("r21");
+	_r22Gxl = new GxlArchive("r22");
+	_r33Gxl = new GxlArchive("r33");
+
 	_logic = new GameLogic(this);
 
 	_wayneSpriteX = 94;
@@ -187,6 +200,19 @@ Common::Error WaynesWorldEngine::run() {
 
 	delete _logic;
 
+	delete _m00Gxl;
+	delete _m01Gxl;
+	delete _m02Gxl;
+	delete _m03Gxl;
+	delete _m05Gxl;
+
+	delete _r08Gxl;
+	delete _r10Gxl;
+	delete _r14Gxl;
+	delete _r21Gxl;
+	delete _r22Gxl;
+	delete _r33Gxl;
+	
 	delete _fontWW;
 	delete _fontWWInv;
 	delete _fontBit5x7;
@@ -486,12 +512,8 @@ WWSurface *WaynesWorldEngine::loadSurface(const char *filename) {
 	return loadSurfaceIntern(filename, false);
 }
 
-WWSurface *WaynesWorldEngine::loadRoomSurface(const char *filename) {
-	return loadSurfaceIntern(filename, true);
-}
-
-void WaynesWorldEngine::loadPalette(const char *filename) {
-    Image::PCXDecoder *imageDecoder = loadImage(filename, false);
+void WaynesWorldEngine::loadPalette(GxlArchive* lib, const char *filename) {
+    Image::PCXDecoder *imageDecoder = lib->loadImage(filename);
 	if (imageDecoder->getPalette().empty()) {
 		warning("loadPalette() Could not load palette from '%s'", filename);
 	} else {
@@ -543,8 +565,8 @@ void WaynesWorldEngine::paletteFadeOut(int index, int count, int stepsSize) {
 	}
 }
 
-void WaynesWorldEngine::drawImageToSurfaceIntern(const char *filename, WWSurface *destSurface, int x, int y, bool transparent, bool appendRoomName) {
-    Image::PCXDecoder *imageDecoder = loadImage(filename, appendRoomName);
+void WaynesWorldEngine::drawImageToSurfaceIntern(GxlArchive *lib, const char *filename, WWSurface *destSurface, int x, int y, bool transparent) {
+    Image::PCXDecoder *imageDecoder = lib->loadImage(filename);
 	if (transparent) {
 		destSurface->drawSurfaceTransparent(imageDecoder->getSurface(), x, y);
 	} else {
@@ -553,8 +575,8 @@ void WaynesWorldEngine::drawImageToSurfaceIntern(const char *filename, WWSurface
     delete imageDecoder;
 }
 
-void WaynesWorldEngine::drawImageToScreenIntern(const char *filename, int x, int y, bool transparent, bool appendRoomName) {
-    Image::PCXDecoder *imageDecoder = loadImage(filename, appendRoomName);
+void WaynesWorldEngine::drawImageToScreenIntern(GxlArchive *lib, const char *filename, int x, int y, bool transparent) {
+    Image::PCXDecoder *imageDecoder = lib->loadImage(filename);
 	if (transparent) {
 		_screen->drawSurfaceTransparent(imageDecoder->getSurface(), x, y);
 	} else {
@@ -563,36 +585,28 @@ void WaynesWorldEngine::drawImageToScreenIntern(const char *filename, int x, int
     delete imageDecoder;
 }
 
-void WaynesWorldEngine::drawImageToBackground(const char *filename, int x, int y) {
-    drawImageToSurfaceIntern(filename, _backgroundSurface, x, y, false, false);
-}
-
-void WaynesWorldEngine::drawImageToBackgroundTransparent(const char *filename, int x, int y) {
-    drawImageToSurfaceIntern(filename, _backgroundSurface, x, y, true, false);
-}
-
-void WaynesWorldEngine::drawImageToScreen(const char *filename, int x, int y) {
-    drawImageToScreenIntern(filename, x, y, false, false);
+void WaynesWorldEngine::drawImageToScreen(GxlArchive* lib, const char *filename, int x, int y) {
+	drawImageToScreenIntern(lib, filename, x, y, false);
 }
 
-void WaynesWorldEngine::drawImageToSurface(const char *filename, WWSurface *destSurface, int x, int y) {
-    drawImageToSurfaceIntern(filename, destSurface, x, y, false, false);
+void WaynesWorldEngine::drawImageToSurface(GxlArchive *lib, const char *filename, WWSurface *destSurface, int x, int y) {
+    drawImageToSurfaceIntern(lib, filename, destSurface, x, y, false);
 }
 
 void WaynesWorldEngine::drawRoomImageToBackground(const char *filename, int x, int y) {
-    drawImageToSurfaceIntern(filename, _backgroundSurface, x, y, false, true);
+	drawImageToSurfaceIntern(_roomGxl, filename, _backgroundSurface, x, y, false);
 }
 
 void WaynesWorldEngine::drawRoomImageToBackgroundTransparent(const char *filename, int x, int y) {
-    drawImageToSurfaceIntern(filename, _backgroundSurface, x, y, true, true);
+	drawImageToSurfaceIntern(_roomGxl, filename, _backgroundSurface, x, y, true);
 }
 
 void WaynesWorldEngine::drawRoomImageToScreen(const char *filename, int x, int y) {
-    drawImageToScreenIntern(filename, x, y, false, true);
+    drawImageToScreenIntern(_roomGxl, filename, x, y, false);
 }
 
 void WaynesWorldEngine::drawRoomImageToSurface(const char *filename, WWSurface *destSurface, int x, int y) {
-    drawImageToSurfaceIntern(filename, destSurface, x, y, false, true);
+    drawImageToSurfaceIntern(_roomGxl, filename, destSurface, x, y, false);
 }
 
 void WaynesWorldEngine::drawSpiralEffect(Graphics::Surface *surface, int x, int y, int grainWidth, int grainHeight) {
@@ -698,9 +712,9 @@ void WaynesWorldEngine::changeMusic() {
 
 void WaynesWorldEngine::drawInterface(int verbNum) {
     if (isActorWayne()) {
-        drawImageToScreen("m00/winter", 0, 151);
+        drawImageToScreen(_m00Gxl, "winter.pcx", 0, 151);
     } else {
-        drawImageToScreen("m00/ginter", 0, 151);
+        drawImageToScreen(_m00Gxl, "ginter.pcx", 0, 151);
     }
     selectVerbNumber2(_verbNumber2 * 24 + 3);
     _verbNumber = verbNum;
@@ -854,9 +868,9 @@ void WaynesWorldEngine::drawInventory() {
         int objectRoomNumber = getObjectRoom(inventoryItemIndex + kFirstInventoryObjectId);
         if ((isActorWayne() && objectRoomNumber == 99 && _wayneInventory[inventoryItemIndex] > 0) ||
             (isActorGarth() && objectRoomNumber == 99 && _garthInventory[inventoryItemIndex] > 0)) {
-            Common::String filename = Common::String::format("m03/icon%02d", inventoryItemIndex + 1);
+            Common::String filename = Common::String::format("icon%02d.pcx", inventoryItemIndex + 1);
 			debug("filename: [%s]", filename.c_str());
-            drawImageToSurface(filename.c_str(), _inventorySprite, iconX, iconY);
+            drawImageToSurface(_m03Gxl, filename.c_str(), _inventorySprite, iconX, iconY);
             iconX += 26;
             if (iconX > 300) {
                 iconX = 0;
@@ -886,16 +900,16 @@ int WaynesWorldEngine::getGarthInventoryItemQuantity(int objectId) {
 
 void WaynesWorldEngine::loadMainActorSprites() {
     // _inventorySprite = new WWSurface(312, 52);
-	_wayneReachRightSprite = loadSurface("m01/wreachr");
-	_wayneReachLeftSprite = loadSurface("m01/wreachl");
-	_garthReachRightSprite = loadSurface("m01/greachr");
-	_garthReachLeftSprite = loadSurface("m01/greachl");
+	_wayneReachRightSprite = _m01Gxl->loadSurface("wreachr.pcx");
+	_wayneReachLeftSprite = _m01Gxl->loadSurface("wreachl.pcx");
+	_garthReachRightSprite = _m01Gxl->loadSurface("greachr.pcx");
+	_garthReachLeftSprite = _m01Gxl->loadSurface("greachl.pcx");
     for (int direction = 0; direction < 8; direction++) {
-		_wayneSprites[direction] = loadSurface(Common::String::format("m01/wstand%d", direction).c_str());
-		_garthSprites[direction] = loadSurface(Common::String::format("m01/gstand%d", direction).c_str());
+		_wayneSprites[direction] = _m01Gxl->loadSurface(Common::String::format("wstand%d.pcx", direction).c_str());
+		_garthSprites[direction] = _m01Gxl->loadSurface(Common::String::format("gstand%d.pcx", direction).c_str());
 		for (int frameNum = 0; frameNum < 4; frameNum++) {			
-			_wayneWalkSprites[direction][frameNum] = loadSurface(Common::String::format("m01/wwalk%d%d", direction, frameNum).c_str());
-			_garthWalkSprites[direction][frameNum] = loadSurface(Common::String::format("m01/gwalk%d%d", direction, frameNum).c_str());
+			_wayneWalkSprites[direction][frameNum] = _m01Gxl->loadSurface(Common::String::format("wwalk%d%d.pcx", direction, frameNum).c_str());
+			_garthWalkSprites[direction][frameNum] = _m01Gxl->loadSurface(Common::String::format("gwalk%d%d.pcx", direction, frameNum).c_str());
 		}
     }
 }
@@ -1082,7 +1096,7 @@ void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int co
 	if (count > 0) {
 		for (int index = startIndex; index < startIndex + count; index++) {
 			updateRoomAnimations();
-			filename = Common::String::format("%s%d", prefix, index);
+			filename = Common::String::format("%s%d.pcx", prefix, index);
 			drawRoomImageToScreen(filename.c_str(), x, y);
 			drawRoomImageToBackground(filename.c_str(), x, y);
 			waitMillis(ticks);
@@ -1090,14 +1104,14 @@ void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int co
 	} else {
 		for (int index = startIndex; index > startIndex + count; index--) {
 			updateRoomAnimations();
-			filename = Common::String::format("%s%d", prefix, index);
+			filename = Common::String::format("%s%d.pcx", prefix, index);
 			drawRoomImageToScreen(filename.c_str(), x, y);
 			drawRoomImageToBackground(filename.c_str(), x, y);
 			waitMillis(ticks);
 		}
 	}
     if (flag) {
-		filename = Common::String::format("%s%d", prefix, startIndex);
+		filename = Common::String::format("%s%d.pcx", prefix, startIndex);
         drawRoomImageToScreen(filename.c_str(), x, y);
         drawRoomImageToBackground(filename.c_str(), x, y);
     }
@@ -1153,10 +1167,10 @@ void WaynesWorldEngine::openRoomLibrary(int roomNum) {
 }
 
 void WaynesWorldEngine::loadRoomBackground() {
-	loadPalette(Common::String(_roomName + "/backg").c_str());
+	loadPalette(_roomGxl, "backg.pcx");
 	g_system->getPaletteManager()->setPalette(_palette2, 0, 256);
 	
-    drawRoomImageToSurface("backg", _backgroundSurface, 0, 0);
+    drawRoomImageToSurface("backg.pcx", _backgroundSurface, 0, 0);
     refreshRoomBackground(_currentRoomNumber);
     refreshActors();
 }
@@ -1259,41 +1273,41 @@ void WaynesWorldEngine::changeRoomScrolling() {
 void WaynesWorldEngine::loadScrollSprite() {
     if (_currentRoomNumber == 14 && _hoverObjectNumber == kObjectIdLoadingDock) {
         _backgroundScrollSurface = new WWSurface(112, 150);
-        drawRoomImageToSurface("scroll", _backgroundScrollSurface, 0, 0);
+        drawRoomImageToSurface("scroll.pcx", _backgroundScrollSurface, 0, 0);
         if ((_logic->_r1_flags1 & 0x10) && !(_logic->_pizzathonListFlags1 & 0x04)) {
-            drawRoomImageToSurface("gill0", _backgroundScrollSurface, 65, 84);
+            drawRoomImageToSurface("gill0.pcx", _backgroundScrollSurface, 65, 84);
         }
         _scrollRemaining = 112;
         _scrollWidth = 112;
         _doScrollRight = true;
     } else if (_currentRoomNumber == 19 && _hoverObjectNumber == kObjectIdStore) {
         _backgroundScrollSurface = new WWSurface(112, 150);
-        drawImageToSurface("r14/backg", _backgroundScrollSurface, 0, 0);
+        drawImageToSurface(_r14Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
         _scrollRemaining = 112;
         _scrollWidth = 112;
         _doScrollRight = false;
     } else if (_currentRoomNumber == 8 && _hoverObjectNumber == kObjectIdHallway8) {
         stopRoomAnimations();
         _backgroundScrollSurface = new WWSurface(320, 150);
-        drawImageToSurface("r21/backg", _backgroundScrollSurface, 0, 0);
+        drawImageToSurface(_r21Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
         _scrollRemaining = 320;
         _scrollWidth = 320;
         _doScrollRight = false;
     } else if (_currentRoomNumber == 21 && _hoverObjectNumber == kObjectIdFoyer) {
         _backgroundScrollSurface = new WWSurface(320, 150);
-        drawImageToSurface("r08/backg", _backgroundScrollSurface, 0, 0);
+        drawImageToSurface(_r08Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
         _scrollRemaining = 320;
         _scrollWidth = 320;
         _doScrollRight = true;
     } else if (_currentRoomNumber == 21 && _hoverObjectNumber == kObjectIdOffice21) {
         _backgroundScrollSurface = new WWSurface(320, 150);
-        drawImageToSurface("r22/backg", _backgroundScrollSurface, 0, 0);
+        drawImageToSurface(_r22Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
         _scrollRemaining = 320;
         _scrollWidth = 320;
         _doScrollRight = false;
     } else if (_currentRoomNumber == 22 && _hoverObjectNumber == kObjectIdHallway22) {
         _backgroundScrollSurface = new WWSurface(320, 150);
-        drawImageToSurface("r21/backg", _backgroundScrollSurface, 0, 0);
+		drawImageToSurface(_r21Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
         _scrollRemaining = 320;
         _scrollWidth = 320;
         _doScrollRight = true;
@@ -1305,16 +1319,16 @@ void WaynesWorldEngine::loadScrollSprite() {
             walkTo(150, 140, 6, 160, 140);
             stopRoomAnimations();
             _backgroundScrollSurface = new WWSurface(168, 150);
-            drawImageToSurface("r33/backg", _backgroundScrollSurface, 0, 0);
+            drawImageToSurface(_r33Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
             _scrollRemaining = 168;
             _scrollWidth = 168;
             _doScrollRight = false;
         }
     } else if (_currentRoomNumber == 33 && _hoverObjectNumber == kObjectIdHallway33) {
         _backgroundScrollSurface = new WWSurface(168, 150);
-        drawRoomImageToSurface("scroll", _backgroundScrollSurface, 0, 0);
+        drawRoomImageToSurface("scroll.pcx", _backgroundScrollSurface, 0, 0);
         if (_logic->_r32_flags & 0x02) {
-            drawRoomImageToSurface("noplunge", _backgroundScrollSurface, 141, 94);
+            drawRoomImageToSurface("noplunge.pcx", _backgroundScrollSurface, 141, 94);
         }
         _scrollRemaining = 168;
         _scrollWidth = 168;
@@ -1384,7 +1398,7 @@ void WaynesWorldEngine::loadAnimationSpriteRange(int baseIndex, const char *file
 
 void WaynesWorldEngine::loadAnimationSprite(int index, const char *filename) {
 	delete _roomAnimations[index];
-	_roomAnimations[index] = loadRoomSurface(filename);
+	_roomAnimations[index] = _roomGxl->loadRoomSurface(filename);
 }
 
 void WaynesWorldEngine::drawAnimationSprite(int index, int x, int y) {
@@ -1465,7 +1479,8 @@ void WaynesWorldEngine::loadStaticRoomObjects(int roomNum) {
 		const StaticRoomObject &roomObject = _staticRoomObjects[startIndex + index];
 		if (roomObject.x1 != -1) {
 			debug("%s", roomObject.name);
-			_staticRoomObjectSprites[index] = loadRoomSurface(roomObject.name);
+			Common::String objectName = Common::String::format("%s.pcx", roomObject.name);
+			_staticRoomObjectSprites[index] = _roomGxl->loadRoomSurface(objectName.c_str());
 			_backgroundSurface->drawSurfaceTransparent(_staticRoomObjectSprites[index], roomObject.x1, roomObject.y1);
 		}
 	}
@@ -2063,14 +2078,14 @@ void WaynesWorldEngine::lookAtUnusedTicket() {
     _logic->_didScratchTicket = false;
     stopRoomAnimations();    
     if (!(_logic->_r10_flags & 0x80)) {
-        _roomAnimations[19] = loadSurface("r10/win");
+        _roomAnimations[19] = _r10Gxl->loadSurface("win.pcx");
     } else {
-        _roomAnimations[19] = loadSurface("r10/nowin");
+		_roomAnimations[19] = _r10Gxl->loadSurface("nowin.pcx");
     }
     paletteFadeOut(0, 256, 64);
     _screen->clear(0);
     playSound("sv14", 0);
-    drawImageToScreen("r10/ticket", 0, 13);
+    drawImageToScreen(_r10Gxl, "ticket.pcx", 0, 13);
     paletteFadeIn(0, 256, 64);
     // sysMouseDriver(1);
 }
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 7fda3f29b13..f009a2051ab 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -38,9 +38,9 @@
 #include "image/pcx.h"
 
 #include "waynesworld/detection.h"
-#include "waynesworld/gxlarchive.h"
 
 namespace WaynesWorld {
+class GxlArchive;
 
 #define WAYNESWORLD_SAVEGAME_VERSION 0
 
@@ -132,6 +132,18 @@ public:
 	GFTFont *_fontWWInv;
 	GFTFont *_fontBit5x7;
 	WWSurface *_roomAnimations[kRoomAnimationsCount];
+	GxlArchive *_m00Gxl = nullptr;
+	GxlArchive *_m01Gxl = nullptr;
+	GxlArchive *_m02Gxl = nullptr;
+	GxlArchive *_m03Gxl = nullptr;
+	GxlArchive *_m05Gxl = nullptr;
+
+	GxlArchive *_r08Gxl = nullptr;
+	GxlArchive *_r10Gxl = nullptr;
+	GxlArchive *_r14Gxl = nullptr;
+	GxlArchive *_r21Gxl = nullptr;
+	GxlArchive *_r22Gxl = nullptr;
+	GxlArchive *_r33Gxl = nullptr;
 
 	// Room
 	Common::String _roomName;
@@ -233,19 +245,16 @@ public:
 	Image::PCXDecoder *loadImage(const char *filename, bool appendRoomName);
 	WWSurface *loadSurfaceIntern(const char *filename, bool appendRoomName);
 	WWSurface *loadSurface(const char *filename);
-	WWSurface *loadRoomSurface(const char *filename);
-	void loadPalette(const char *filename);
+	void loadPalette(GxlArchive *lib, const char *filename);
 
 	void paletteFadeIn(int index, int count, int stepsSize);
 	void paletteFadeOut(int index, int count, int stepsSize);
 
 	// Image drawing
-	void drawImageToSurfaceIntern(const char *filename, WWSurface *destSurface, int x, int y, bool transparent, bool appendRoomName);
-	void drawImageToScreenIntern(const char *filename, int x, int y, bool transparent, bool appendRoomName);
-	void drawImageToBackground(const char *filename, int x, int y);
-	void drawImageToBackgroundTransparent(const char *filename, int x, int y);
-	void drawImageToScreen(const char *filename, int x, int y);
-	void drawImageToSurface(const char *filename, WWSurface *destSurface, int x, int y);
+	void drawImageToSurfaceIntern(GxlArchive *lib, const char *filename, WWSurface *destSurface, int x, int y, bool transparent);
+	void drawImageToScreenIntern(GxlArchive *lib, const char *filename, int x, int y, bool transparent);
+	void drawImageToScreen(GxlArchive *lib, const char *filename, int x, int y);
+	void drawImageToSurface(GxlArchive *lib, const char *filename, WWSurface *destSurface, int x, int y);
 	void drawRoomImageToBackground(const char *filename, int x, int y);
 	void drawRoomImageToBackgroundTransparent(const char *filename, int x, int y);
 	void drawRoomImageToScreen(const char *filename, int x, int y);


Commit: c1acd5af3135a963f303203843b59e872981f38e
    https://github.com/scummvm/scummvm/commit/c1acd5af3135a963f303203843b59e872981f38e
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:53+01:00

Commit Message:
WAYNESWORLD: Fix a crash when picking the guitar (uninitialized _scrollWidth), initialize some more variables

Changed paths:
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index f009a2051ab..57e0b35df7d 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -124,14 +124,14 @@ public:
 	void updateEvents();
 
 	// Graphics
-	byte _palette2[768];
-	Screen *_screen;
-	WWSurface *_backgroundSurface;
-	WWSurface *_backgroundScrollSurface;
-	GFTFont *_fontWW;
-	GFTFont *_fontWWInv;
-	GFTFont *_fontBit5x7;
-	WWSurface *_roomAnimations[kRoomAnimationsCount];
+	byte _palette2[768] = {0};
+	Screen *_screen = nullptr;
+	WWSurface *_backgroundSurface = nullptr;
+	WWSurface *_backgroundScrollSurface = nullptr;
+	GFTFont *_fontWW = nullptr;
+	GFTFont *_fontWWInv = nullptr;
+	GFTFont *_fontBit5x7 = nullptr;
+	WWSurface *_roomAnimations[kRoomAnimationsCount] = {nullptr};
 	GxlArchive *_m00Gxl = nullptr;
 	GxlArchive *_m01Gxl = nullptr;
 	GxlArchive *_m02Gxl = nullptr;
@@ -148,13 +148,13 @@ public:
 	// Room
 	Common::String _roomName;
 	GxlArchive *_roomGxl = nullptr;
-	byte *_walkMap;
-	int _scrollWidth;
-	int _scrollRemaining;
-	int _roomChangeCtr;
-	int _scrollPosition;
-	bool _doScrollRight;
-	bool _hasRoomAnimationCallback;
+	byte *_walkMap = nullptr;
+	int _scrollWidth = 0;
+	int _scrollRemaining = 0;
+	int _roomChangeCtr = 0;
+	int _scrollPosition = 0;
+	bool _doScrollRight = false;
+	bool _hasRoomAnimationCallback = false;
 
 	// Room animations
 	AnimationTimer _animationTimers[kAnimationTimersCount];


Commit: 6ab4c725730bc22356b421c0804e8025d5076aaf
    https://github.com/scummvm/scummvm/commit/6ab4c725730bc22356b421c0804e8025d5076aaf
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:53+01:00

Commit Message:
WAYNESWORLD: Remove useless check before delete

Changed paths:
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 37d7407f4a9..aed6b3f5875 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -1160,8 +1160,7 @@ void WaynesWorldEngine::toggleActor() {
 
 void WaynesWorldEngine::openRoomLibrary(int roomNum) {
     _roomName = Common::String::format("r%02d", roomNum);
-	if (_roomGxl)
-		delete _roomGxl;
+	delete _roomGxl;
 
 	_roomGxl = new GxlArchive(_roomName);
 }


Commit: cb383214739a6f79016d07992d5ffb846b84f888
    https://github.com/scummvm/scummvm/commit/cb383214739a6f79016d07992d5ffb846b84f888
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:53+01:00

Commit Message:
WAYNESWORLD: Remove verbose warning in GlxArchive, remove dead code related to image loading, add a couple of stub warnings

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gxlarchive.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index eb7b0d3744e..aa64ffa76e4 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -6657,6 +6657,7 @@ void GameLogic::r30_runLudwigCutscene() {
 	// TODO gxGetDisplayPalette(palette1);
 	// TODO pcxGetLibPalette(8, roomLib, "backg", palette2);
 	// TODO gxSetDisplayPalette(palette2);
+	warning("r30_runLudwigCutscene - STUB some initialization");
 	_vm->paletteFadeOut(0, 256, 64);
 	_vm->_screen->clear(0);
 	_vm->drawRoomImageToBackground("backg.pcx", 0, 0);
diff --git a/engines/waynesworld/gxlarchive.cpp b/engines/waynesworld/gxlarchive.cpp
index 8fd558607d3..4a18cc64244 100644
--- a/engines/waynesworld/gxlarchive.cpp
+++ b/engines/waynesworld/gxlarchive.cpp
@@ -56,7 +56,7 @@ GxlArchive::GxlArchive(const Common::String name) : _gxlFile(new Common::File())
 	for (uint i = 0; i < count; i++) {
 		_gxlFile->readByte(); // Packing Type
 		char baseName[9] = {0};
-		char extension[5] = {0};
+		char extension[6] = {0};
 		_gxlFile->read(baseName, 8);
 		_gxlFile->read(extension, 5);
 		Common::String fullName = Common::String(baseName);
@@ -72,7 +72,7 @@ GxlArchive::GxlArchive(const Common::String name) : _gxlFile(new Common::File())
 
 		_gxlFile->readUint32LE(); // date and time of the file
 
-		warning("file: %s offset: %d  size: %d", header.filename, header.offset, header.size);
+		// warning("file: %s offset: %d  size: %d", header.filename, header.offset, header.size);
 
 		_headers[header.filename].reset(new GxlHeader(header));
 	}
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index aed6b3f5875..ded37b71fb1 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -415,6 +415,7 @@ void WaynesWorldEngine::handleMouseClick() {
     }
     if (_mouseClickButtons & kKeyPressed) {
         // TODO handleKeyInput();
+		warning("handleMouseClick - STUB handleKeyInput");
     }
 }
 
@@ -444,11 +445,16 @@ void WaynesWorldEngine::handleMouseLeftClick() {
         break;
     case 4:
         // TODO handleMouseClickState4();
-        break;
+		warning("STUB - handleMouseClickState4");
+		break;
     case 5:
         extremeCloseUpHandleMouseClick();
         break;
-    }
+  
+	default:
+		warning("handleMouseLeftClick - Unhandled game state %d", _gameState);
+		break;
+	}
 }
 
 void WaynesWorldEngine::handleMouseRightClick() {
@@ -473,43 +479,16 @@ void WaynesWorldEngine::handleMouseRightClick() {
         break;
     case 4:
         // TODO handleMouseClickState4();
+		warning("STUB - handleMouseClickState4");
         break;
     case 5:
         extremeCloseUpHandleMouseClick();
         break;
-    }
-}
-
-Image::PCXDecoder *WaynesWorldEngine::loadImage(const char *filename, bool appendRoomName) {
-	Common::Path tempFilename(appendRoomName
-		? Common::String::format("%s/%s.pcx", _roomName.c_str(), filename)
-		: Common::String::format("%s.pcx", filename));
-
-	Common::File pcxFile;
-	if (!pcxFile.open(tempFilename)) {
-		warning("loadImage() Could not open '%s'", tempFilename.baseName().c_str());
-		return nullptr;
-	}
 
-	Image::PCXDecoder *pcx = new Image::PCXDecoder();
-	if (!pcx->loadStream(pcxFile)) {
-		warning("loadImage() Could not process '%s'", tempFilename.baseName().c_str());
-		delete pcx;
-		return nullptr;
-	}
-
-	return pcx;
-}
-
-WWSurface *WaynesWorldEngine::loadSurfaceIntern(const char *filename, bool appendRoomName) {
-    Image::PCXDecoder *imageDecoder = loadImage(filename, appendRoomName);
-	WWSurface *surface = new WWSurface(imageDecoder->getSurface());
-    delete imageDecoder;
-    return surface;
-}
-
-WWSurface *WaynesWorldEngine::loadSurface(const char *filename) {
-	return loadSurfaceIntern(filename, false);
+    default:
+		warning("handleMouseRightClick - Unhandled game state %d", _gameState);
+		break;
+    }
 }
 
 void WaynesWorldEngine::loadPalette(GxlArchive* lib, const char *filename) {
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 57e0b35df7d..8bd8325be9f 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -241,10 +241,7 @@ public:
 	void handleMouseLeftClick();
 	void handleMouseRightClick();
 
-	// Image loading
-	Image::PCXDecoder *loadImage(const char *filename, bool appendRoomName);
-	WWSurface *loadSurfaceIntern(const char *filename, bool appendRoomName);
-	WWSurface *loadSurface(const char *filename);
+	// Palette loading
 	void loadPalette(GxlArchive *lib, const char *filename);
 
 	void paletteFadeIn(int index, int count, int stepsSize);


Commit: 3456c969d4e5aaacf0addd5bded3d47d90a77fed
    https://github.com/scummvm/scummvm/commit/3456c969d4e5aaacf0addd5bded3d47d90a77fed
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:53+01:00

Commit Message:
WAYNESWORLD: Add sound and music, remove some TODOs to replace them by STUBs

Changed paths:
  A engines/waynesworld/sound.cpp
  A engines/waynesworld/sound.h
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/module.mk
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index aa64ffa76e4..e761cc17c5f 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -593,7 +593,7 @@ void GameLogic::handleDialogReply(int index, int x, int y) {
 		_vm->playAnimationLoops("g1talk", 0, 2, 54, 81, 0, 100, 4);
         break;
     default:
-        _vm->waitSeconds(2);
+ //       _vm->waitSeconds(2);
         break;
     }
     _vm->waitSeconds(2);
@@ -1102,7 +1102,7 @@ void GameLogic::displayExtremeCloseupOfPizzathonList() {
     _vm->paletteFadeOut(0, 256, 16);
     // sysMouseDriver(2);
 	_vm->drawImageToScreen(lib, "list.pcx", 0, 0);
-    _vm->playSound("sv14", 1);
+    _vm->playSound("sv14.snd", 1);
     if (_pizzathonListFlags1 & 0x08) {
 		_vm->drawImageToScreen(lib, "adline.pcx", 72, 22);
     }
@@ -1142,7 +1142,7 @@ void GameLogic::displayExtremeCloseupOfSign15() {
     _vm->_gameState = 5;
     // sysMouseDriver(2);
     _vm->paletteFadeOut(0, 256, 16);
-    _vm->playSound("sv14", 1);
+    _vm->playSound("sv14.snd", 1);
     _vm->drawRoomImageToScreen("sign.pcx", 0, 0);
     _vm->paletteFadeIn(0, 256, 16);
     // sysMouseDriver(1);
@@ -1153,7 +1153,7 @@ void GameLogic::displayExtremeCloseupOfObjectPictures22() {
     _vm->_gameState = 5;
     // sysMouseDriver(2);
     _vm->paletteFadeOut(0, 256, 16);
-    _vm->playSound("sv14", 1);
+    _vm->playSound("sv14.snd", 1);
 	_vm->drawImageToScreen(_vm->_m05Gxl, "oldmap.pcx", 0, 0);
     _vm->paletteFadeIn(0, 256, 16);
     // sysMouseDriver(1);
@@ -1164,7 +1164,7 @@ void GameLogic::displayExtremeCloseupOfMemo() {
     _vm->_gameState = 5;
     // sysMouseDriver(2);
     _vm->paletteFadeOut(0, 256, 16);
-    _vm->playSound("sv14", 1);
+    _vm->playSound("sv14.snd", 1);
 	_vm->drawImageToScreen(_vm->_m05Gxl, "memo.pcx", 0, 0);
     _vm->paletteFadeIn(0, 256, 16);
     // sysMouseDriver(1);
@@ -1175,7 +1175,7 @@ void GameLogic::displayExtremeCloseupOfSewerMap() {
     _vm->_gameState = 5;
     // sysMouseDriver(2);
     _vm->paletteFadeOut(0, 256, 16);
-    _vm->playSound("sv14", 1);
+    _vm->playSound("sv14.snd", 1);
 	_vm->drawImageToScreen(_vm->_m05Gxl, "sewermap.pcx", 0, 0);
     _vm->paletteFadeIn(0, 256, 16);
     // sysMouseDriver(1);
@@ -1186,7 +1186,7 @@ void GameLogic::displayExtremeCloseupOfBillboard1() {
     _vm->_gameState = 5;
     // sysMouseDriver(2);
     _vm->paletteFadeOut(0, 256, 16);
-    _vm->playSound("sv14", 1);
+    _vm->playSound("sv14.snd", 1);
     _vm->_screen->clear(0);
 	_vm->drawImageToScreen(_vm->_m05Gxl, "fboard.pcx", 51, 18);
     _vm->paletteFadeIn(0, 256, 16);
@@ -1198,7 +1198,7 @@ void GameLogic::displayExtremeCloseupOfBillboard2() {
     _vm->_gameState = 5;
     // sysMouseDriver(2);
     _vm->paletteFadeOut(0, 256, 16);
-    _vm->playSound("sv14", 1);
+    _vm->playSound("sv14.snd", 1);
     _vm->_screen->clear(0);
 	_vm->drawImageToScreen(_vm->_m05Gxl, "pboard.pcx", 51, 18);
     _vm->paletteFadeIn(0, 256, 16);
@@ -3157,7 +3157,7 @@ void GameLogic::r6_handleRoomEvent2() {
 
 void GameLogic::r6_handleRoomEvent3() {
 	_vm->waitSeconds(1);
-	_vm->playSound("ss10", 1);
+	_vm->playSound("ss10.snd", 1);
 	_vm->walkTo(110, 107, 4, 135, 107);
 	_vm->playAnimation("dad", 0, 3, 119, 79, 0, 100);
 	if ((_r6_flags & 0x40) && !(_r6_flags & 0x20)) {
@@ -4729,7 +4729,7 @@ void GameLogic::r11_pickUpExtensionCord() {
 void GameLogic::r11_useSuckCutWithFountain() {
 	r11_uninitRoomAnimations();
 	_vm->playAnimation("suckwt", 0, 5, 45, 92, 0, 200);
-	_vm->playSound("ss40", 0);
+	_vm->playSound("ss40.snd", 0);
 	for (int i = 5; i < 15; i++) {
 		_vm->playAnimation("elec", i - 5, 1, 176, 61, 0, 1);
 		_vm->playAnimation("suckwt", i, 1, 45, 92, 0, 150);
@@ -5568,13 +5568,13 @@ void GameLogic::r17_handleRoomEvent1() {
 
 void GameLogic::r17_handleRoomEvent2() {
 	_vm->walkTo(71, 117, 0, 90, 117);
-	_vm->playSound("ss13", 0);
+	_vm->playSound("ss13.snd", 0);
 	_vm->playAnimation("beam", 0, 13, 62, 51, 0, 150);
 	_vm->changeRoom(37);
 }
 
 void GameLogic::r17_handleRoomEvent3() {
-	_vm->playSound("ss13", 0);
+	_vm->playSound("ss13.snd", 0);
 	_vm->playAnimation("beam", 12, -13, 62, 51, 0, 150);
 	_r37_flags &= ~0x20;
 	_vm->setWaynePosition(71, 117);
@@ -5856,7 +5856,7 @@ void GameLogic::r20_refreshRoomBackground() {
 void GameLogic::r20_handleRoomEvent() {
 	_vm->waitSeconds(1);
 	_vm->playAnimation("expl", 0, 36, 40, 32, 0, 150);
-	_vm->playSound("ss17", 0);
+	_vm->playSound("ss17.snd", 0);
 	_vm->playAnimation("expl", 37, 66, 40, 32, 0, 150);
 	_r19_flags &= ~0x01;
 	_r19_flags |= 0x08;
@@ -6347,9 +6347,9 @@ void GameLogic::r28_handleRoomEvent1() {
 		_vm->refreshActors();
 	}
 	_vm->playAnimation("scepter", 1, 4, 26, 42, 0, 150);
-	_vm->playSound("ss13", 0);
+	_vm->playSound("ss13.snd", 0);
 	_vm->playAnimation("zapwg", 0, 11, 107, 53, 0, 70);
-	_vm->playSound("sv08", 1);
+	_vm->playSound("sv08.snd", 1);
 	_vm->playAnimation("scepter", 3, -4, 26, 42, 0, 150);
 	_vm->displayText("c04r", 30, 0, 150, 10, 0);
 	_vm->playAnimation("reptalk", 0, 6, 26, 51, 0, 150);
@@ -6374,11 +6374,11 @@ void GameLogic::r28_handleRoomEvent1() {
 }
 
 void GameLogic::r28_handleRoomEvent2() {
-	_vm->playSound("ss12", 0);
+	_vm->playSound("ss12.snd", 0);
 	_vm->playAnimation("scepter", 1, 4, 26, 42, 0, 150);
 	_vm->playAnimation("repxit", 0, 11, 0, 33, 0, 100);
 	_vm->waitSeconds(2);
-	_vm->playSound("ss12", 0);
+	_vm->playSound("ss12.snd", 0);
 	_vm->playAnimation("repxit", 10, -11, 0, 33, 0, 100);
 	_vm->playAnimation("scepter", 3, -4, 26, 42, 0, 150);
 	_vm->displayText("c04r", 38, 0, 150, 10, 0);
@@ -6386,7 +6386,7 @@ void GameLogic::r28_handleRoomEvent2() {
 	_vm->waitSeconds(2);
 	_vm->_isTextVisible = false;
 	_vm->refreshActors();
-	_vm->playSound("ss12", 0);
+	_vm->playSound("ss12.snd", 0);
 	_vm->playAnimation("scepter", 1, 4, 26, 42, 0, 150);
 	_vm->playAnimation("repxit", 0, 11, 0, 33, 0, 100);
 	_vm->waitSeconds(2);
@@ -6688,7 +6688,7 @@ void GameLogic::r30_runLudwigCutscene() {
 	_vm->playAnimation("ludwig", 42, 20, 185, 34, 0, 150);
 	_vm->displayTextLines("lws", 27, 50, 10, 1);
 	_vm->playAnimation("ludwig", 62, 4, 185, 34, 0, 150);
-	_vm->playSound("ss17", 0);
+	_vm->playSound("ss17.snd", 0);
 	_vm->playAnimation("ludwig", 66, 4, 186, 22, 0, 150);
 	_vm->playAnimation("ludwig", 70, 3, 185, 34, 0, 150);
 	_vm->displayTextLines("lws", 28, 50, 10, 5);
@@ -6950,7 +6950,7 @@ void GameLogic::r31_playTalkAnim(int talkerIndex) {
 
 void GameLogic::r31_useBuzzer() {
 	_vm->drawRoomImageToScreen("buzzer.pcx", 131, 106);
-	_vm->playSound("ss04", 1);
+	_vm->playSound("ss04.snd", 1);
 	_vm->_screen->drawSurface(_vm->_backgroundSurface, 0, 0);
 	if (!(_r31_flags & 0x01)) {
 		r31_handleRoomEvent3();
diff --git a/engines/waynesworld/module.mk b/engines/waynesworld/module.mk
index f3bd2dfe635..e0fbcd44aa3 100644
--- a/engines/waynesworld/module.mk
+++ b/engines/waynesworld/module.mk
@@ -9,6 +9,7 @@ MODULE_OBJS := \
 	graphics.o \
 	metaengine.o \
 	pathfinding.o \
+	sound.o \
 	staticdata.o
 
 # This module can be built as a plugin
diff --git a/engines/waynesworld/sound.cpp b/engines/waynesworld/sound.cpp
new file mode 100644
index 00000000000..1bcfc2b7a51
--- /dev/null
+++ b/engines/waynesworld/sound.cpp
@@ -0,0 +1,205 @@
+/* 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/config-manager.h"
+#include "audio/mixer.h"
+#include "audio/audiostream.h"
+#include "audio/mididrv.h"
+#include "audio/midiparser.h"
+#include "audio/decoders/raw.h"
+
+// Miles Audio
+#include "audio/miles.h"
+#include "waynesworld/waynesworld.h"
+#include "waynesworld/sound.h"
+
+
+namespace WaynesWorld {
+
+SoundManager::SoundManager(WaynesWorldEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
+	_effectsHandle = new Audio::SoundHandle();
+	_stream = nullptr;
+}
+
+SoundManager::~SoundManager() {
+	delete _effectsHandle;
+}
+
+void SoundManager::playSound(const char *filename, int flag) {
+	_filename = Common::String(filename);
+	
+	Common::File fd;
+	if (!fd.open(Common::Path(filename))) {
+		error("playSound : Enable to open %s", filename);
+	}
+
+	const int size = fd.size();
+	byte *buffer = new byte[size];
+	fd.read(buffer, size);
+
+	Common::SeekableReadStream *rawStream = new Common::MemoryReadStream(buffer, size, DisposeAfterUse::YES);
+	Audio::RewindableAudioStream *audioStream = Audio::makeRawStream(rawStream, 8000, Audio::FLAG_UNSIGNED);
+
+/*	
+	if (loop)
+		Audio::LoopingAudioStream *loopingStream = new Audio::LoopingAudioStream(audioStream, 0, DisposeAfterUse::NO));
+*/
+	if (!_mixer->isSoundHandleActive(*_effectsHandle)) {
+		_mixer->playStream(Audio::Mixer::kSFXSoundType, _effectsHandle, audioStream, -1, _mixer->kMaxChannelVolume, 0, DisposeAfterUse::NO);
+	}
+}
+
+bool SoundManager::isSFXPlaying() {
+	return _mixer->isSoundHandleActive(*_effectsHandle);
+}
+
+void SoundManager::syncVolume() {
+	const int sfxVol = CLIP(ConfMan.getInt("sfx_volume"), 0, 255);
+	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, sfxVol);
+}
+
+
+void SoundManager::stopSound() {
+	_mixer->stopHandle(*_effectsHandle);
+}
+
+/******************************************************************************************/
+
+MusicManager::MusicManager(WaynesWorldEngine *vm) : _vm(vm) {
+	_music = nullptr;
+	_isLooping = false;
+	_driver = nullptr;
+
+	MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MT32);
+	MusicType musicType = MidiDriver::getMusicType(dev);
+
+	switch (musicType) {
+	case MT_ADLIB: {
+		MidiPlayer::createDriver();
+		break;
+	}
+	case MT_MT32:
+		_driver = Audio::MidiDriver_Miles_MT32_create("");
+		_nativeMT32 = true;
+		break;
+	case MT_GM:
+		if (ConfMan.getBool("native_mt32")) {
+			_driver = Audio::MidiDriver_Miles_MT32_create("");
+			_nativeMT32 = true;
+		}
+		break;
+
+	default:
+		break;
+	}
+
+	if (_driver) {
+		const int retValue = _driver->open();
+		if (retValue == 0) {
+			if (_nativeMT32)
+				_driver->sendMT32Reset();
+			else
+				_driver->sendGMReset();
+
+			_driver->setTimerCallback(this, &timerCallback);
+		}
+	}
+}
+
+MusicManager::~MusicManager() {
+	delete _music;
+}
+
+void MusicManager::send(uint32 b) {
+	// Pass data directly to driver
+	_driver->send(b);
+}
+
+bool MusicManager::checkMidiDone() {
+	return (!_isPlaying);
+}
+
+void MusicManager::midiRepeat() {
+	if (!_driver)
+		return;
+	if (!_parser)
+		return;
+
+	_isLooping = true;
+	_parser->property(MidiParser::mpAutoLoop, _isLooping);
+	if (!_isPlaying)
+		_parser->setTrack(0);
+}
+
+void MusicManager::stopSong() {
+	if (!_driver)
+		return;
+
+	stop();
+}
+
+void MusicManager::playMusic(const char *filename, bool loop) {
+	if (!_driver)
+		return;
+
+	Common::File fd;
+	if (!fd.open(Common::Path(filename)))
+		error("playMusic : Unable to open %s", filename);
+
+	const int size = fd.size();
+	if (size < 4)
+		error("playMusic() wrong music resource size");
+
+	delete _music;
+	_music = new byte[size];
+	fd.read(_music, size);
+
+	stop();
+
+	const uint32 magic = READ_BE_UINT32(_music);
+	if (magic == MKTAG('F', 'O', 'R', 'M')) {
+		_parser = MidiParser::createParser_XMIDI();
+
+		if (!_parser->loadMusic(_music, size))
+			error("midiPlay() wrong music resource");
+
+		_parser->setTrack(0);
+		_parser->setMidiDriver(this);
+		_parser->setTimerRate(_driver->getBaseTempo());
+		_parser->property(MidiParser::mpCenterPitchWheelOnUnload, 1);
+		_parser->property(MidiParser::mpSendSustainOffOnNotesOff, 1);
+
+		// Handle music looping
+		_parser->property(MidiParser::mpAutoLoop, loop);
+		syncVolume();
+		_isPlaying = true;
+	} else {
+		warning("playMusic() Unexpected signature 0x%08x, expected 'FORM'", magic);
+		_isPlaying = false;
+	}
+}
+
+void MusicManager::setLoop(bool loop) {
+	_isLooping = loop;
+	if (_parser)
+		_parser->property(MidiParser::mpAutoLoop, _isLooping);
+}
+} // End of namespace WaynesWorld
diff --git a/engines/waynesworld/sound.h b/engines/waynesworld/sound.h
new file mode 100644
index 00000000000..fb06a0cff81
--- /dev/null
+++ b/engines/waynesworld/sound.h
@@ -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/>.
+ *
+ */
+
+#ifndef WAYNESWORLD_SOUND_H
+#define WAYNESWORLD_SOUND_H
+
+#include "common/scummsys.h"
+#include "audio/midiplayer.h"
+
+#define MAX_SOUNDS 20
+
+namespace Audio {
+class AudioStream;
+class SoundHandle;
+}
+
+namespace WaynesWorld {
+
+class WaynesWorldEngine;
+
+class SoundManager {
+	Audio::AudioStream *_stream;
+	Common::String _filename;
+
+private:
+	WaynesWorldEngine *_vm;
+	Audio::Mixer *_mixer;
+	Audio::SoundHandle *_effectsHandle;
+
+public:
+	SoundManager(WaynesWorldEngine *vm, Audio::Mixer *mixer);
+	~SoundManager();
+
+	void playSound(const char *filename, int flag);
+	bool isSFXPlaying();
+
+	void syncVolume();
+
+	void stopSound();
+};
+
+class MusicManager : public Audio::MidiPlayer {
+private:
+	WaynesWorldEngine *_vm;
+	byte *_music;
+
+	// MidiDriver_BASE interface implementation
+	void send(uint32 b) override;
+
+public:
+	MusicManager(WaynesWorldEngine *vm);
+	~MusicManager() override;
+
+	bool checkMidiDone();
+
+	void midiRepeat();
+	void stopSong();
+
+	void playMusic(const char *filename, bool loop = false);
+
+	void setLoop(bool loop);
+};
+} // End of namespace WaynesWorld
+
+#endif /* WAYNESWORLD_SOUND_H*/
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index ded37b71fb1..090d258cf61 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -136,6 +136,12 @@ Common::Error WaynesWorldEngine::run() {
 	_selectedDialogChoice = 0;
 	_gameState = 7;
 	_currentMapItemIndex = -1;
+	_musicIndex = 0;
+	
+	_sound = new SoundManager(this, _mixer);
+	_midi = new MusicManager(this);
+
+	syncSoundSettings();
 
 	loadMainActorSprites();
 
@@ -163,6 +169,8 @@ Common::Error WaynesWorldEngine::run() {
 
 	drawInterface(2);
 	changeRoom(0);
+	changeMusic();
+	
 	// _wayneSpriteX = -1; _garthSpriteX = -1;
 	// changeRoom(31); // DEBUG
 	// _logic->r31_displayCategories();
@@ -291,7 +299,6 @@ void WaynesWorldEngine::waitMillis(uint millis) {
 }
 
 void WaynesWorldEngine::waitSeconds(uint seconds) {
-	// TODO Replace calls with waitMillis
 	waitMillis(seconds * 1000);
 }
 
@@ -414,7 +421,6 @@ void WaynesWorldEngine::handleMouseClick() {
         handleMouseRightClick();
     }
     if (_mouseClickButtons & kKeyPressed) {
-        // TODO handleKeyInput();
 		warning("handleMouseClick - STUB handleKeyInput");
     }
 }
@@ -444,7 +450,6 @@ void WaynesWorldEngine::handleMouseLeftClick() {
         unusedTicketHandleMouseClick();
         break;
     case 4:
-        // TODO handleMouseClickState4();
 		warning("STUB - handleMouseClickState4");
 		break;
     case 5:
@@ -478,7 +483,6 @@ void WaynesWorldEngine::handleMouseRightClick() {
         unusedTicketHandleMouseClick();
         break;
     case 4:
-        // TODO handleMouseClickState4();
 		warning("STUB - handleMouseClickState4");
         break;
     case 5:
@@ -682,11 +686,24 @@ void WaynesWorldEngine::displayTextLines(const char *filename, int baseIndex, in
 }
 
 void WaynesWorldEngine::playSound(const char *filename, int flag) {
-	// TODO
+	_sound->playSound(filename, flag);
 }
 
 void WaynesWorldEngine::changeMusic() {
-	// TODO
+	switch (_musicIndex) {
+	case 0:
+		_midi->playMusic("pop-a.xmi");
+		break;
+	case 1:
+		_midi->playMusic("metal1.xmi");
+		break;
+	case 2:
+		_midi->playMusic("metal2.xmi");
+		break;
+	default:
+		_midi->playMusic("metal3.xmi");
+		break;
+	}
 }
 
 void WaynesWorldEngine::drawInterface(int verbNum) {
@@ -742,8 +759,6 @@ void WaynesWorldEngine::changeActor() {
 }
 
 void WaynesWorldEngine::drawVerbLine(int verbNumber, int objectNumber, const char *objectName) {
-
-	// TODO Move to StaticData class/file
 	static const char *kVerbStrings[] = {
 		"",
 		"pick up",
@@ -1702,33 +1717,33 @@ void WaynesWorldEngine::handleVerbPickUp() {
 
     switch (actionTextIndex) {
     case 7:
-        playSound("sv18", 1);
-        playSound("sv28", 1);
+        playSound("sv18.snd", 1);
+        playSound("sv28.snd", 1);
         break;
     case 0:
     case 10:
     case 44:
     case 54:
-        playSound("sv32", 1);
+        playSound("sv32.snd", 1);
         break;
     case 13:
-        playSound("sv19", 1);
+        playSound("sv19.snd", 1);
         break;
     case 50:
-        playSound("sv33", 1);
+        playSound("sv33.snd", 1);
         break;
     case 51:
     case 59:
-        playSound("sv31", 1);
+        playSound("sv31.snd", 1);
         break;
     case 53:
-        playSound("ss07", 1);
+        playSound("ss07.snd", 1);
         break;
     case 55:
-        playSound("sv29", 1);
+        playSound("sv29.snd", 1);
         break;
     case 56:
-        playSound("sv38", 1);
+        playSound("sv38.snd", 1);
         break;
     }
 
@@ -1830,22 +1845,22 @@ void WaynesWorldEngine::handleVerbUse() {
 
     switch (actionTextIndex) {
     case 0:
-        playSound("sv18", 1);
+        playSound("sv18.snd", 1);
         break;
     case 67:
-        playSound("ss07", 1);
+        playSound("ss07.snd", 1);
         break;
     case 68:
-        playSound("sv32", 1);
+        playSound("sv32.snd", 1);
         break;
     case 69:
-        playSound("sv47", 1);
+        playSound("sv47.snd", 1);
         break;
     case 70:
-        playSound("sv39", 1);
+        playSound("sv39.snd", 1);
         break;
     case 71:
-        playSound("sv38", 1);
+        playSound("sv38.snd", 1);
         break;
     }
 
@@ -1911,10 +1926,10 @@ void WaynesWorldEngine::handleVerbPush() {
 
     switch (actionTextIndex) {
     case 0:
-        playSound("sv02", 1);
+        playSound("sv02.snd", 1);
         break;
     case 4:
-        playSound("sv47", 1);
+        playSound("sv47.snd", 1);
         break;
     }
 
@@ -1936,7 +1951,7 @@ void WaynesWorldEngine::handleVerbPull() {
 
     switch (actionTextIndex) {
     case 0:
-        playSound("sv31", 1);
+        playSound("sv31.snd", 1);
         break;
     }
 
@@ -2001,25 +2016,25 @@ void WaynesWorldEngine::handleVerbOpen() {
 
     switch (actionTextIndex) {
     case 5:
-        playSound("sv31", 1);
+        playSound("sv31.snd", 1);
         break;
     case 7:
-        playSound("ss07", 1);
+        playSound("ss07.snd", 1);
         break;
     case 8:
-        playSound("sv47", 1);
+        playSound("sv47.snd", 1);
         break;
     case 0:
-        playSound("sv28", 1);
+        playSound("sv28.snd", 1);
         break;
     case 1:
-        playSound("sv38", 1);
+        playSound("sv38.snd", 1);
         break;
     case 10:
-        playSound("sv28", 1);
+        playSound("sv28.snd", 1);
         break;
     case 11:
-        playSound("sv21", 1);
+        playSound("sv21.snd", 1);
         break;
     }
 
@@ -2041,10 +2056,10 @@ void WaynesWorldEngine::handleVerbClose() {
 
     switch (actionTextIndex) {
     case 0:
-        playSound("sv47", 1);
+        playSound("sv47.snd", 1);
         break;
     case 1:
-        playSound("sv21", 1);
+        playSound("sv21.snd", 1);
         break;
     }
 
@@ -2062,7 +2077,7 @@ void WaynesWorldEngine::lookAtUnusedTicket() {
     }
     paletteFadeOut(0, 256, 64);
     _screen->clear(0);
-    playSound("sv14", 0);
+    playSound("sv14.snd", 0);
     drawImageToScreen(_r10Gxl, "ticket.pcx", 0, 13);
     paletteFadeIn(0, 256, 64);
     // sysMouseDriver(1);
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 8bd8325be9f..18745843384 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -38,6 +38,8 @@
 #include "image/pcx.h"
 
 #include "waynesworld/detection.h"
+#include "waynesworld/sound.h"
+
 
 namespace WaynesWorld {
 class GxlArchive;
@@ -145,6 +147,10 @@ public:
 	GxlArchive *_r22Gxl = nullptr;
 	GxlArchive *_r33Gxl = nullptr;
 
+	// Sound and Music
+	SoundManager *_sound;
+	MusicManager *_midi;
+
 	// Room
 	Common::String _roomName;
 	GxlArchive *_roomGxl = nullptr;


Commit: 2ceba7001cb48a6f74e7622b9ccc0a4ed8ff83a4
    https://github.com/scummvm/scummvm/commit/2ceba7001cb48a6f74e7622b9ccc0a4ed8ff83a4
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:53+01:00

Commit Message:
WAYNESWORLD: Fix MK file

Changed paths:
    engines/waynesworld/module.mk


diff --git a/engines/waynesworld/module.mk b/engines/waynesworld/module.mk
index e0fbcd44aa3..3aedc1e478b 100644
--- a/engines/waynesworld/module.mk
+++ b/engines/waynesworld/module.mk
@@ -5,7 +5,7 @@ MODULE_OBJS := \
 	detection.o \
 	gamelogic.o \
 	gamemap.o \
-	glxarchive.o \
+	gxlarchive.o \
 	graphics.o \
 	metaengine.o \
 	pathfinding.o \


Commit: 58645e21d27c8a9bc31578bf6d749217b765b037
    https://github.com/scummvm/scummvm/commit/58645e21d27c8a9bc31578bf6d749217b765b037
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:53+01:00

Commit Message:
WAYNESWORLD: Fix animation loading in room 7 and loadAnimationSpriteRange()

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index e761cc17c5f..19ef3d085e1 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -3432,11 +3432,11 @@ int GameLogic::r7_handleVerbPickUp() {
 }
 
 void GameLogic::r7_initRoomAnimations() {
-	_vm->loadAnimationSprite(0, "clouds");
-	_vm->loadAnimationSprite(1, "bldg");
-	_vm->loadAnimationSprite(2, "sky");
-	_vm->loadAnimationSprite(3, "elvis0");
-	_vm->loadAnimationSprite(4, "elvis1");
+	_vm->loadAnimationSprite(0, "clouds.pcx");
+	_vm->loadAnimationSprite(1, "bldg.pcx");
+	_vm->loadAnimationSprite(2, "sky.pcx");
+	_vm->loadAnimationSprite(3, "elvis0.pcx");
+	_vm->loadAnimationSprite(4, "elvis1.pcx");
 	_vm->setAnimationTimer(0, 1000, _vm->getRandom(230));
 	_vm->setAnimationTimer(1, 4000);
 	_vm->startRoomAnimations();
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 090d258cf61..08dd73377bf 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -1384,7 +1384,7 @@ void WaynesWorldEngine::fillRoomMaskArea(int x1, int y1, int x2, int y2, bool bl
 
 void WaynesWorldEngine::loadAnimationSpriteRange(int baseIndex, const char *filename, int count) {
 	for (int index = 0; index < count; index++) {
-		Common::String tempFilename = Common::String::format("%s%d", filename, index);
+		Common::String tempFilename = Common::String::format("%s%d.pcx", filename, index);
 		loadAnimationSprite(baseIndex + index, tempFilename.c_str());
 	}
 }


Commit: 4f1c9e9eec70a3ff4664e04142b25e8df9c04bdb
    https://github.com/scummvm/scummvm/commit/4f1c9e9eec70a3ff4664e04142b25e8df9c04bdb
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:54+01:00

Commit Message:
WAYNESWORLD: Small cleanup

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 19ef3d085e1..e30c33d87f6 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -395,6 +395,8 @@ int GameLogic::handleVerbPush() {
         return r7_handleVerbPush();
     case 37:
         return r37_handleVerbPush();
+    default:
+		break;
     }
 	return 0;
 }
@@ -409,6 +411,8 @@ int GameLogic::handleVerbPull() {
         return r37_handleVerbPull();
     case 38:
         return r38_handleVerbPull();
+    default:
+		break;
     }
 	return 0;
 }
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 08dd73377bf..fc043a51ac0 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -290,7 +290,7 @@ int WaynesWorldEngine::getRandom(int max) {
 }
 
 void WaynesWorldEngine::waitMillis(uint millis) {
-	uint32 waitTime = _system->getMillis() + millis;
+	const uint32 waitTime = _system->getMillis() + millis;
 	while (_system->getMillis() < waitTime && !shouldQuit()) {
 		updateEvents();
 		_system->updateScreen();
@@ -322,23 +322,22 @@ void WaynesWorldEngine::initMouseCursor() {
 }
 
 bool WaynesWorldEngine::isPointAtWayne(int x, int y) {
-    int x1 = _wayneSpriteX - (_wayneActorScale * 13) / 100;
-    int x2 = _wayneSpriteX + (_wayneActorScale * 13) / 100;
-    int y1 = _wayneSpriteY - (_wayneActorScale * 48) / 100;
-    int y2 = _wayneSpriteY;
+	const int x1 = _wayneSpriteX - (_wayneActorScale * 13) / 100;
+	const int x2 = _wayneSpriteX + (_wayneActorScale * 13) / 100;
+	const int y1 = _wayneSpriteY - (_wayneActorScale * 48) / 100;
+	const int y2 = _wayneSpriteY;
     return x >= x1 && y >= y1 && x <= x2 && y <= y2;
 }
 
 bool WaynesWorldEngine::isPointAtGarth(int x, int y) {
-    int x1 = _garthSpriteX - (_garthActorScale * 13) / 100;
-    int x2 = _garthSpriteX + (_garthActorScale * 13) / 100;
-    int y1 = _garthSpriteY - (_garthActorScale * 48) / 100;
-    int y2 = _garthSpriteY;
+	const int x1 = _garthSpriteX - (_garthActorScale * 13) / 100;
+	const int x2 = _garthSpriteX + (_garthActorScale * 13) / 100;
+	const int y1 = _garthSpriteY - (_garthActorScale * 48) / 100;
+	const int y2 = _garthSpriteY;
     return x >= x1 && y >= y1 && x <= x2 && y <= y2;
 }
 
 void WaynesWorldEngine::updateMouseMove() {
-
     // Yet unknown
     if (_gameState == 4)
         return;
@@ -371,9 +370,9 @@ void WaynesWorldEngine::updateMouseMove() {
 
     // Inventory
     if (_gameState == 0 && _inventoryItemsCount > 0 && _mouseX < 312) {
-        int inventorySlotIndex = _mouseY / 20 * 12 + _mouseX / 26;
+	    const int inventorySlotIndex = _mouseY / 20 * 12 + _mouseX / 26;
         if (inventorySlotIndex < _inventoryItemsCount) {
-            int inventoryObjectId = _inventoryItemsObjectMap[inventorySlotIndex];
+	        const int inventoryObjectId = _inventoryItemsObjectMap[inventorySlotIndex];
             int inventoryItemQuantity;
             if (isActorWayne()) {
                 inventoryItemQuantity = getWayneInventoryItemQuantity(inventoryObjectId);
@@ -399,7 +398,7 @@ void WaynesWorldEngine::updateMouseMove() {
         drawVerbLine(_verbNumber, -2, "Wayne");
     } else {
         // Room objects
-        int objectIdAtPoint = findRoomObjectIdAtPoint(_mouseX, _mouseY);
+        const int objectIdAtPoint = findRoomObjectIdAtPoint(_mouseX, _mouseY);
         if (_gameState == 0) {
             if (objectIdAtPoint != -1) {
                 drawVerbLine(_verbNumber, objectIdAtPoint, getRoomObjectName(objectIdAtPoint));
@@ -508,8 +507,8 @@ void WaynesWorldEngine::loadPalette(GxlArchive* lib, const char *filename) {
 
 void WaynesWorldEngine::paletteFadeIn(int index, int count, int stepsSize) {
 	byte fadePalette[768];
-	int fadeStartIndex = index * 3;
-	int fadeEndIndex = (index + count) * 3;
+	const int fadeStartIndex = index * 3;
+	const int fadeEndIndex = (index + count) * 3;
 	bool isDone = false;
 	// CHECKME Assume we're always fading in from black for now
 	memset(fadePalette, 0, 768);
@@ -530,8 +529,8 @@ void WaynesWorldEngine::paletteFadeIn(int index, int count, int stepsSize) {
 
 void WaynesWorldEngine::paletteFadeOut(int index, int count, int stepsSize) {
 	byte fadePalette[768];
-	int fadeStartIndex = index * 3;
-	int fadeEndIndex = (index + count) * 3;
+	const int fadeStartIndex = index * 3;
+	const int fadeEndIndex = (index + count) * 3;
 	bool isDone = false;
 	memcpy(fadePalette, _palette2, 768);
 	while (!isDone) {
@@ -606,7 +605,7 @@ Common::String WaynesWorldEngine::loadString(const char *filename, int index, in
 	const uint kMaxStringLen = 60;
 	char textBuffer[kMaxStringLen];
 	Common::File fd;
-	Common::Path tempFilename(Common::String::format("%s.txt", filename));
+	const Common::Path tempFilename(Common::String::format("%s.txt", filename));
 	if (!fd.open(tempFilename))
 		error("WaynesWorldEngine::loadString() Could not open %s", tempFilename.baseName().c_str());
 	fd.seek(index * kMaxStringLen);
@@ -627,8 +626,8 @@ void WaynesWorldEngine::drawCurrentTextToSurface(WWSurface *destSurface, int x,
 }
 
 void WaynesWorldEngine::drawCurrentText(int x, int y, WWSurface *destSurface) {
-    int textCenterX, textX, textY = 0, textColor, actorY = 0;
-    int textWidth = _fontWWInv->getTextWidth(_currentText.c_str());
+    int textCenterX, textY = 0, textColor, actorY = 0;
+    const int textWidth = _fontWWInv->getTextWidth(_currentText.c_str());
     if (x != -1) {
         textCenterX = x;
         textY = y;
@@ -642,7 +641,7 @@ void WaynesWorldEngine::drawCurrentText(int x, int y, WWSurface *destSurface) {
         actorY = _garthSpriteY;
         textColor = 119;
     }
-    textX = textCenterX - 75;
+    int textX = textCenterX - 75;
     if (textX < 0) {
         textX = 5;
     } else if (textX + 150 > 319) {
@@ -726,7 +725,7 @@ void WaynesWorldEngine::selectVerbNumber2(int x) {
 }
 
 void WaynesWorldEngine::selectVerbNumber(int x) {
-    int selectedButtonIndex = (x - 3) / 24;
+	const int selectedButtonIndex = (x - 3) / 24;
     _firstObjectNumber = -1;
     if (selectedButtonIndex > 10) {
         if (_mouseClickY > 182) {
@@ -859,7 +858,7 @@ void WaynesWorldEngine::drawInventory() {
     int iconY = 0;
     _inventorySprite->clear(0);
     for (int inventoryItemIndex = 0; inventoryItemIndex < kInventorySize; inventoryItemIndex++) {
-        int objectRoomNumber = getObjectRoom(inventoryItemIndex + kFirstInventoryObjectId);
+	    const int objectRoomNumber = getObjectRoom(inventoryItemIndex + kFirstInventoryObjectId);
         if ((isActorWayne() && objectRoomNumber == 99 && _wayneInventory[inventoryItemIndex] > 0) ||
             (isActorGarth() && objectRoomNumber == 99 && _garthInventory[inventoryItemIndex] > 0)) {
             Common::String filename = Common::String::format("icon%02d.pcx", inventoryItemIndex + 1);
@@ -928,7 +927,7 @@ int WaynesWorldEngine::getActorScaleFromY(int actorY) {
 }
 
 void WaynesWorldEngine::drawActorReachObject(int objectId, int spriteIndex) {
-    int direction = getObjectDirection(objectId);
+	const int direction = getObjectDirection(objectId);
     if (isActorWayne()) {
         drawActors(direction, 2, 1, spriteIndex, _wayneSpriteX, _wayneSpriteY, _garthSpriteX, _garthSpriteY);
     } else {
@@ -959,8 +958,8 @@ int WaynesWorldEngine::drawActors(int direction, int wayneKind, int garthKind, i
         _wayneActorScale = getActorScaleFromY(wayneY);
         wayneHeight = (100 - _wayneActorScale) * 48 / 90;
         wayneWidth = _wayneActorScale * 13 / 100;
-        int scaledWayneWidth = _wayneActorScale * 27 / 100;
-        int scaledWayneHeight = _wayneActorScale * 48 / 100;
+        const int scaledWayneWidth = _wayneActorScale * 27 / 100;
+        const int scaledWayneHeight = _wayneActorScale * 48 / 100;
         wayneSprite = new WWSurface(scaledWayneWidth, scaledWayneHeight);
         if (wayneKind == 0) {
             wayneSprite->scaleSurface(_wayneWalkSprites[direction][spriteIndex]);
@@ -982,8 +981,8 @@ int WaynesWorldEngine::drawActors(int direction, int wayneKind, int garthKind, i
         _garthActorScale = getActorScaleFromY(garthY);
         garthHeight = (100 - _garthActorScale) * 48 / 100;
         garthWidth = _garthActorScale * 13 / 100;
-        int scaledGarthWidth = _garthActorScale * 27 / 100;
-        int scaledGarthHeight = _garthActorScale * 48 / 100;
+        const int scaledGarthWidth = _garthActorScale * 27 / 100;
+        const int scaledGarthHeight = _garthActorScale * 48 / 100;
         garthSprite = new WWSurface(scaledGarthWidth, scaledGarthHeight);
         if (garthKind == 0) {
             garthSprite->scaleSurface(_garthWalkSprites[direction][spriteIndex]);
@@ -1190,7 +1189,7 @@ void WaynesWorldEngine::refreshRoomBackground(int roomNum) {
 
 void WaynesWorldEngine::handleRoomEvent() {
     if (_roomEventNum != 0) {
-		int eventNum = _roomEventNum;
+	    const int eventNum = _roomEventNum;
 		_roomEventNum = 0;
 		_logic->handleRoomEvent(eventNum);
 	}
@@ -1359,7 +1358,7 @@ void WaynesWorldEngine::scrollRoom() {
 }
 
 void WaynesWorldEngine::loadRoomMask(int roomNum) {
-	Common::Path filename(Common::String::format("r%02d.msk", roomNum));
+	const Common::Path filename(Common::String::format("r%02d.msk", roomNum));
 	Common::File fd;
 	if (!fd.open(filename))
 		error("WaynesWorldEngine::loadRoomMask() Could not open %s", filename.baseName().c_str());
@@ -1371,8 +1370,8 @@ void WaynesWorldEngine::loadRoomMask(int roomNum) {
 void WaynesWorldEngine::fillRoomMaskArea(int x1, int y1, int x2, int y2, bool blocked) {
 	for (int y = y1; y <= y2; y++) {
 		for (int x = x1; x <= x2; x++) {
-			int offset = (y * 40) + (x / 8);
-			byte value = 0x80 >> (x % 8);
+			const int offset = (y * 40) + (x / 8);
+			const byte value = 0x80 >> (x % 8);
 			if (blocked) {
 				_walkMap[offset] &= ~value;
 			} else {
@@ -1431,7 +1430,7 @@ void WaynesWorldEngine::stopRoomAnimations() {
 }
 
 void WaynesWorldEngine::updateAnimationTimers() {
-	uint32 currentTicks = _system->getMillis();
+	const uint32 currentTicks = _system->getMillis();
 	for (uint i = 0; i < kAnimationTimersCount; i++) {
 		AnimationTimer &animationTimer = _animationTimers[i];
 		animationTimer.expired = animationTimer.nextUpdateTicks == 0 || currentTicks >= animationTimer.nextUpdateTicks;
@@ -1466,8 +1465,8 @@ void WaynesWorldEngine::initStaticRoomObjects() {
 }
 
 void WaynesWorldEngine::loadStaticRoomObjects(int roomNum) {
-	int startIndex = kStaticRoomObjectsMap[roomNum].index;
-	int count = kStaticRoomObjectsMap[roomNum].count;
+	const int startIndex = kStaticRoomObjectsMap[roomNum].index;
+	const int count = kStaticRoomObjectsMap[roomNum].count;
 	for (int index = 0; index < count; index++) {
 		const StaticRoomObject &roomObject = _staticRoomObjects[startIndex + index];
 		if (roomObject.x1 != -1) {
@@ -1487,8 +1486,8 @@ void WaynesWorldEngine::unloadStaticRoomObjects() {
 }
 
 void WaynesWorldEngine::setStaticRoomObjectPosition(int roomNum, int fromIndex, int toIndex, int x, int y) {
-	int startIndex = kStaticRoomObjectsMap[roomNum].index + fromIndex;
-	int endIndex = kStaticRoomObjectsMap[roomNum].index + toIndex;
+	const int startIndex = kStaticRoomObjectsMap[roomNum].index + fromIndex;
+	const int endIndex = kStaticRoomObjectsMap[roomNum].index + toIndex;
 	unloadStaticRoomObjects();
 	for (int index = startIndex; index <= endIndex; index++) {
 		StaticRoomObject &roomObject = _staticRoomObjects[index];
@@ -1499,11 +1498,11 @@ void WaynesWorldEngine::setStaticRoomObjectPosition(int roomNum, int fromIndex,
 }
 
 void WaynesWorldEngine::drawStaticRoomObjects(int roomNum, int x, int y, int actorHeight, int actorWidth, WWSurface *surface) {
-	int x1 = x - actorWidth;
-	int x2 = x + actorWidth;
-	int y2 = y + actorHeight - 48;
-	int startIndex = kStaticRoomObjectsMap[roomNum].index;
-	int count = kStaticRoomObjectsMap[roomNum].count;
+	const int x1 = x - actorWidth;
+	const int x2 = x + actorWidth;
+	const int y2 = y + actorHeight - 48;
+	const int startIndex = kStaticRoomObjectsMap[roomNum].index;
+	const int count = kStaticRoomObjectsMap[roomNum].count;
 	for (int index = 0; index < count; index++) {
 		const StaticRoomObject &roomObject = _staticRoomObjects[startIndex + index];
 		if (roomObject.x1 != -1 && roomObject.y2 > y &&
@@ -1514,14 +1513,14 @@ void WaynesWorldEngine::drawStaticRoomObjects(int roomNum, int x, int y, int act
 }
 
 void WaynesWorldEngine::initRoomObjects() {
-	for  (uint i = 0; i < kRoomObjectsCount; i++)
+	for  (int i = 0; i < kRoomObjectsCount; i++)
 		_roomObjects[i] = kRoomObjects[i];
 }
 
 void WaynesWorldEngine::moveObjectToRoom(int objectId, int roomNum) {
     _roomObjects[objectId].roomNumber = roomNum;
     if (objectId <= kLastInventoryObjectId) {
-        int inventoryIndex = objectId - kFirstInventoryObjectId;
+	    const int inventoryIndex = objectId - kFirstInventoryObjectId;
         if (isActorWayne()) {
             _wayneInventory[inventoryIndex]++;
         } else {
@@ -1532,7 +1531,7 @@ void WaynesWorldEngine::moveObjectToRoom(int objectId, int roomNum) {
 
 void WaynesWorldEngine::moveObjectToNowhere(int objectId) {
     if (objectId <= kLastInventoryObjectId) {
-        int inventoryIndex = objectId - kFirstInventoryObjectId;
+	    const int inventoryIndex = objectId - kFirstInventoryObjectId;
         if (isActorWayne()) {
             _wayneInventory[inventoryIndex]--;
         } else {
@@ -1563,12 +1562,12 @@ int WaynesWorldEngine::getObjectDirection(int objectId) {
 }
 
 int WaynesWorldEngine::findRoomObjectIdAtPoint(int x, int y) {
-    for (uint index = 0; index < kRoomObjectsCount; index++) {
+    for (int index = 0; index < kRoomObjectsCount; index++) {
         const RoomObject *roomObject = getRoomObject(index);
         if (roomObject->roomNumber == _currentRoomNumber &&
             x >= roomObject->x1 && x <= roomObject->x2 &&
             y >= roomObject->y1 && y <= roomObject->y2) {
-            return (int)index;
+            return index;
         }
     }
     return -1;
@@ -1611,7 +1610,7 @@ void WaynesWorldEngine::drawDialogChoices(int choiceIndex) {
     byte choiceTextColor = isActorWayne() ? 11 : 10;
     byte selectedTextColor = 13;
     for (int index = 0; index < 5 && _dialogChoices[index] != -1; index++) {
-        byte textColor = index + choiceIndex + 11 == 0 ? selectedTextColor : choiceTextColor;
+	    const byte textColor = index + choiceIndex + 11 == 0 ? selectedTextColor : choiceTextColor;
         Common::String dialogText = loadString("c04", _dialogChoices[index], 0);
 		_screen->drawText(_fontBit5x7, dialogText.c_str(), 3, 152 + index * 9, textColor);
     }
@@ -1620,8 +1619,7 @@ void WaynesWorldEngine::drawDialogChoices(int choiceIndex) {
 }
 
 void WaynesWorldEngine::handleDialogMouseClick() {
-    int continueDialog = 0;
-    int replyTextIndex1, replyTextIndex2, replyTextIndex3;
+	int replyTextIndex1, replyTextIndex2, replyTextIndex3;
     int replyTextX, replyTextY;
 
     if (_selectedDialogChoice == -10)
@@ -1635,7 +1633,7 @@ void WaynesWorldEngine::handleDialogMouseClick() {
     _isTextVisible = false;
     refreshActors();
 
-    continueDialog = _logic->handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+	const int continueDialog = _logic->handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
 
     if (replyTextIndex1 != -1) {
         _logic->handleDialogReply(replyTextIndex1, replyTextX, replyTextY);
@@ -1655,7 +1653,7 @@ void WaynesWorldEngine::handleDialogMouseClick() {
 }
 
 void WaynesWorldEngine::handleVerb(int verbFlag) {
-    int verbNum = verbFlag == 1 ? _verbNumber : _verbNumber2;
+	const int verbNum = verbFlag == 1 ? _verbNumber : _verbNumber2;
     switch (verbNum) {
     case 1:
         handleVerbPickUp();
@@ -1696,14 +1694,12 @@ void WaynesWorldEngine::handleVerb(int verbFlag) {
 }
 
 void WaynesWorldEngine::handleVerbPickUp() {
-    int actionTextIndex = -1;
-
-    _isTextVisible = false;
+	_isTextVisible = false;
     if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
 
-    actionTextIndex = _logic->handleVerbPickUp();
+    int actionTextIndex = _logic->handleVerbPickUp();
 
     if (_objectNumber == -3) {
         actionTextIndex = 29;
@@ -1750,7 +1746,7 @@ void WaynesWorldEngine::handleVerbPickUp() {
 }
 
 void WaynesWorldEngine::handleVerbLookAt() {
-    _isTextVisible = 0;
+    _isTextVisible = false;
     if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
@@ -1775,9 +1771,7 @@ void WaynesWorldEngine::handleVerbLookAt() {
 }
 
 void WaynesWorldEngine::handleVerbUse() {
-    int actionTextIndex = -1;
-
-    _isTextVisible = false;
+	_isTextVisible = false;
     if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
@@ -1814,7 +1808,7 @@ void WaynesWorldEngine::handleVerbUse() {
         return;
     }
 
-    actionTextIndex = _logic->handleVerbUse();
+    int actionTextIndex = _logic->handleVerbUse();
 
     if (_firstObjectNumber == kObjectIdInventoryPlungers && _objectNumber != kObjectIdLampPost) {
         actionTextIndex = 44;
@@ -1862,17 +1856,17 @@ void WaynesWorldEngine::handleVerbUse() {
     case 71:
         playSound("sv38.snd", 1);
         break;
+	default:
+		break;
     }
-
 }
 
 void WaynesWorldEngine::handleVerbTalkTo() {
-    int actionTextIndex = -1;
-
+    int actionTextIndex;
     _dialogChoices[0] = -1;
 
     if (_objectNumber == -3 || _objectNumber == -2) {
-        bool room1Special = !(_logic->_r1_flags1 & 0x10) && isActorWayne() && _currentRoomNumber == 1 && (_logic->_r1_flags2 & 0x01);
+	    const bool room1Special = !(_logic->_r1_flags1 & 0x10) && isActorWayne() && _currentRoomNumber == 1 && (_logic->_r1_flags2 & 0x01);
         if (room1Special) {
             actionTextIndex = 14;
         } else {
@@ -1911,14 +1905,12 @@ void WaynesWorldEngine::handleVerbTalkTo() {
 }
 
 void WaynesWorldEngine::handleVerbPush() {
-    int actionTextIndex = -1;
-
-    _isTextVisible = false;
+	_isTextVisible = false;
     if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
 
-    actionTextIndex = _logic->handleVerbPush();
+	const int actionTextIndex = _logic->handleVerbPush();
 
     if (actionTextIndex != -1) {
         displayText("c05", actionTextIndex, 0, -1, -1, 0);
@@ -1931,29 +1923,26 @@ void WaynesWorldEngine::handleVerbPush() {
     case 4:
         playSound("sv47.snd", 1);
         break;
+	default:
+		break;
     }
 
 }
 
 void WaynesWorldEngine::handleVerbPull() {
-    int actionTextIndex = -1;
-
-    _isTextVisible = false;
+	_isTextVisible = false;
     if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
 
-    actionTextIndex = _logic->handleVerbPull();
+	const int actionTextIndex = _logic->handleVerbPull();
 
     if (actionTextIndex != -1) {
         displayText("c06", actionTextIndex, 0, -1, -1, 0);
     }
 
-    switch (actionTextIndex) {
-    case 0:
+	if (actionTextIndex == 0)
         playSound("sv31.snd", 1);
-        break;
-    }
 
 }
 
@@ -1962,9 +1951,7 @@ void WaynesWorldEngine::handleVerbExtremeCloseupOf() {
 }
 
 void WaynesWorldEngine::handleVerbGive() {
-    int actionTextIndex = -1;
-
-    if (_firstObjectNumber == -1) {
+	if (_firstObjectNumber == -1) {
         _firstObjectNumber = _objectNumber;
         rememberFirstObjectName(_objectNumber);
         return;
@@ -1975,7 +1962,7 @@ void WaynesWorldEngine::handleVerbGive() {
         if (_firstObjectNumber == kObjectIdInventoryDrumstick || _firstObjectNumber == kObjectIdInventoryGuitar) {
             displayText("c08", 2, 0, -1, -1, 0);
         } else {
-            int inventoryIndex = _firstObjectNumber - kFirstInventoryObjectId;
+	        const int inventoryIndex = _firstObjectNumber - kFirstInventoryObjectId;
             if (_objectNumber == -3) {
                 _garthInventory[inventoryIndex] += _wayneInventory[inventoryIndex];
                 _wayneInventory[inventoryIndex] = 0;
@@ -1990,7 +1977,7 @@ void WaynesWorldEngine::handleVerbGive() {
         return;
     }
 
-    actionTextIndex = _logic->handleVerbGive();
+	const int actionTextIndex = _logic->handleVerbGive();
 
     _firstObjectNumber = -1;
 
@@ -2001,14 +1988,12 @@ void WaynesWorldEngine::handleVerbGive() {
 }
 
 void WaynesWorldEngine::handleVerbOpen() {
-    int actionTextIndex = -1;
-
-    _isTextVisible = false;
+	_isTextVisible = false;
     if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
 
-    actionTextIndex = _logic->handleVerbOpen();
+	const int actionTextIndex = _logic->handleVerbOpen();
 
     if (actionTextIndex != -1) {
         displayText("c09", actionTextIndex, 0, -1, -1, 0);
@@ -2041,14 +2026,12 @@ void WaynesWorldEngine::handleVerbOpen() {
 }
 
 void WaynesWorldEngine::handleVerbClose() {
-    int actionTextIndex = -1;
-
-    _isTextVisible = false;
+	_isTextVisible = false;
     if (_objectNumber <= kLastInventoryObjectId) {
         refreshActors();
     }
 
-    actionTextIndex = _logic->handleVerbClose();
+	const int actionTextIndex = _logic->handleVerbClose();
 
     if (actionTextIndex != -1) {
         displayText("c10", actionTextIndex, 0, -1, -1, 0);
@@ -2087,8 +2070,8 @@ void WaynesWorldEngine::unusedTicketHandleMouseMove() {
     if (_mouseX > 157 && _mouseY > 38 && _mouseX < 297 && _mouseY < 129) {
         _logic->_didScratchTicket = true;
         // Reveal partial image
-		int scratchX = _mouseX - 158;
-		int scratchY = _mouseY - 39;
+        const int scratchX = _mouseX - 158;
+        const int scratchY = _mouseY - 39;
 		Graphics::Surface scratchSurface = _roomAnimations[19]->getSubArea(Common::Rect(scratchX, scratchY, scratchX + 4, scratchY + 4));
 		_screen->drawSurface(&scratchSurface, _mouseX - 2, _mouseY - 2);
     }
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 18745843384..6afb9682395 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -90,7 +90,7 @@ enum {
 	kKeyPressed = 1 << 2
 };
 
-const uint kRoomObjectsCount = 404;
+const int kRoomObjectsCount = 404;
 const int kWalkPointsCount = 300;
 const uint kWalkMapSize = (320 * 150) / 8;
 const uint kRoomAnimationsCount = 20;


Commit: d0cc8575f0ee693e6dfb06ce74bf11222c9e9b87
    https://github.com/scummvm/scummvm/commit/d0cc8575f0ee693e6dfb06ce74bf11222c9e9b87
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:54+01:00

Commit Message:
WAYNESWORLD: Fix crash in City Hall, add some comments

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index e30c33d87f6..839fde2d0d5 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -4652,7 +4652,7 @@ int GameLogic::r11_handleVerbPush() {
 
 void GameLogic::r11_initRoomAnimations() {
 	_vm->loadAnimationSpriteRange(0, "water", 4);
-	_vm->loadAnimationSprite(4, "suckcut");
+	_vm->loadAnimationSprite(4, "suckcut.pcx");
 	_vm->setAnimationTimer(0, 800);
 	_vm->startRoomAnimations();
 }
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index fc043a51ac0..9b9ee9212c0 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -426,7 +426,7 @@ void WaynesWorldEngine::handleMouseClick() {
 
 void WaynesWorldEngine::handleMouseLeftClick() {
     switch (_gameState) {
-    case 0:
+    case 0: // Normal Game mode
         if (_mouseClickY < 150) {
             _objectNumber = _hoverObjectNumber;
             if (_objectNumber != -1) {
@@ -442,7 +442,7 @@ void WaynesWorldEngine::handleMouseLeftClick() {
     case 1:
         gameMapHandleMouseClick();
         break;
-    case 2:
+    case 2: // Dialog Mode
         handleDialogMouseClick();
         break;
     case 3:
@@ -733,14 +733,14 @@ void WaynesWorldEngine::selectVerbNumber(int x) {
                 drawInventory();
                 refreshActors();
             } else {
-                // TODO r0_handleRoomEvent1();
+				warning("STUB r0_handleRoomEvent1()");
             }
         }
     } else if (selectedButtonIndex == 0) {
         changeActor();
     } else {
         _verbNumber = selectedButtonIndex;
-        drawVerbLine(_verbNumber, -4, 0);
+        drawVerbLine(_verbNumber, -4, nullptr);
         if (_verbNumber == 8 && _inventoryItemsCount == 0) {
             drawInventory();
             refreshActors();


Commit: ae66ecb3fe911c66741dd4468ebd27bf854f6321
    https://github.com/scummvm/scummvm/commit/ae66ecb3fe911c66741dd4468ebd27bf854f6321
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:54+01:00

Commit Message:
WAYNESWORLD: mini cleanup in graphics

Changed paths:
    engines/waynesworld/graphics.cpp


diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
index bf059e37fe4..a770ebbca2b 100644
--- a/engines/waynesworld/graphics.cpp
+++ b/engines/waynesworld/graphics.cpp
@@ -28,12 +28,12 @@
 namespace WaynesWorld {
 
 void drawSurfaceIntern(Graphics::Surface *destSurface, const Graphics::Surface *surface, int x, int y, bool transparent) {
-	int width, height, skipX = 0, skipY = 0;
+	int skipX = 0, skipY = 0;
 
 	if (x >= destSurface->w || y >= destSurface->h)
 		return;
 
-	height = surface->h;
+	int height = surface->h;
 	if (y < 0) {
 		height += y;
 		if (height <= 0)
@@ -44,7 +44,7 @@ void drawSurfaceIntern(Graphics::Surface *destSurface, const Graphics::Surface *
 	if (y + height > destSurface->h)
 		height = destSurface->h - y;
 
-	width = surface->w;
+	int width = surface->w;
 	if (x < 0) {
 		width += x;
 		if (width <= 0)


Commit: 008b41695f43ebd06a921022b59abd908c663484
    https://github.com/scummvm/scummvm/commit/008b41695f43ebd06a921022b59abd908c663484
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:54+01:00

Commit Message:
WAYNESWORLD: clean includes in gxlarchive

Changed paths:
    engines/waynesworld/gxlarchive.cpp
    engines/waynesworld/gxlarchive.h


diff --git a/engines/waynesworld/gxlarchive.cpp b/engines/waynesworld/gxlarchive.cpp
index 4a18cc64244..eada240550c 100644
--- a/engines/waynesworld/gxlarchive.cpp
+++ b/engines/waynesworld/gxlarchive.cpp
@@ -24,7 +24,6 @@
 #include "common/file.h"
 #include "common/hash-str.h"
 #include "common/memstream.h"
-#include "common/bufferedstream.h"
 #include "common/textconsole.h"
 
 #include "waynesworld/gxlarchive.h"
diff --git a/engines/waynesworld/gxlarchive.h b/engines/waynesworld/gxlarchive.h
index 3d08cda268f..0a7c71cdeec 100644
--- a/engines/waynesworld/gxlarchive.h
+++ b/engines/waynesworld/gxlarchive.h
@@ -23,7 +23,7 @@
 #define WAYNESWORLD_GXLARCHIVE
 
 #include "common/archive.h"
-#include "gamelogic.h"
+#include "waynesworld/gamelogic.h"
 
 namespace Common {
 class File;


Commit: c663b04746a04b81784cce1b76d3c5c011296f32
    https://github.com/scummvm/scummvm/commit/c663b04746a04b81784cce1b76d3c5c011296f32
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:54+01:00

Commit Message:
WAYNESWORLD: First version of the game menu (without save/load)

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h
    engines/waynesworld/sound.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 839fde2d0d5..8dd79557fc6 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -1351,15 +1351,26 @@ void GameLogic::r0_refreshRoomBackground() {
 }
 
 void GameLogic::r0_handleRoomEvent1() {
-	// TODO Call the main menu
-	// When 'Exit' is selected in the menu it starts this dialog
-	if (!(_r0_flags & 0x02)) {
-		_r0_flags |= 0x02;
-		_vm->displayText("c11", 0, 0, -1, -1, 0);
-		_vm->setDialogChoices(29, 30, 31, 32, 33);
-		_vm->waitSeconds(2);
-		_vm->startDialog();
-	}
+	_menuGameState = _vm->_gameState;
+	_vm->_gameState = 4;
+
+	if (_vm->_hasRoomAnimationCallback)
+		_vm->stopRoomAnimations();
+
+	GxlArchive *m04Gxl = new GxlArchive("m04");
+	// sysMouseDriver(2);
+	// _menuSurface = new WWSurface(178, 122);
+	_menuSurface = new WWSurface(310, 180);
+	_vm->drawImageToSurface(m04Gxl, "menu.pcx", _menuSurface, 113, 20);
+	_menuOffSprite = m04Gxl->loadSurface("ff.pcx");
+	_menuOnSprite = m04Gxl->loadSurface("n.pcx");
+	
+	menuDrawSoundEnabled();
+	menuDrawMusicEnabled();
+	// sysMouseDriver(1);
+	delete m04Gxl;
+
+	_vm->_screen->drawSurfaceTransparent(_menuSurface, 0, 0);
 }
 
 void GameLogic::r0_handleRoomEvent2() {
@@ -3820,7 +3831,7 @@ void GameLogic::r8_handleRoomEvent1() {
 	if (_r38_flags & 0x08) {
 		_vm->displayTextLines("c04r", 349, 200, 30, 9);
 		_r8_flags |= 0x20;
-		// TODO _quitGame = true;
+		_vm->quitGame();
 	} else {
 		if (_pizzathonListFlags2 & 0x08) {
 			if (_r8_flags & 0x40) {
@@ -8435,4 +8446,157 @@ void GameLogic::r39_useExit() {
 	_vm->changeRoom(24);
 }
 
+void GameLogic::menuDrawSoundEnabled() {
+	// sysMouseDriver(2);
+	if (_vm->_isSoundEnabled) {
+		Graphics::Surface buttonSurface = _menuOnSprite->getSubArea(Common::Rect(0, 0, 10, 4));
+		_menuSurface->drawSurface(&buttonSurface, 176, 44);
+	} else {
+		Graphics::Surface buttonSurface = _menuOffSprite->getSubArea(Common::Rect(0, 0, 10, 4));
+		_menuSurface->drawSurface(&buttonSurface, 176, 44);
+	}
+	// sysMouseDriver(1);
+}
+
+void GameLogic::menuDrawMusicEnabled() {
+	// sysMouseDriver(2);
+	if (_vm->_isMusicEnabled) {
+		Graphics::Surface buttonSurface = _menuOnSprite->getSubArea(Common::Rect(0, 0, 10, 4));
+		_menuSurface->drawSurface(&buttonSurface, 176, 28);
+	} else {
+		Graphics::Surface buttonSurface = _menuOffSprite->getSubArea(Common::Rect(0, 0, 10, 4));
+		_menuSurface->drawSurface(&buttonSurface, 176, 28);
+	}
+	// sysMouseDriver(1);
+}
+
+void GameLogic::sub_3F906() {
+	GxlArchive *m04Gxl = new GxlArchive("m04");
+	// sysMouseDriver(2);
+	// TODO: Set mouse zone 113, 205, 20, 135
+	_vm->drawImageToSurface(m04Gxl, "menu.pcx", _menuSurface, 113, 20);
+	menuDrawSoundEnabled();
+	menuDrawMusicEnabled();
+	// sysMouseDriver(1);
+	_menuQuitVisible = false;
+	delete m04Gxl;
+
+	_vm->_screen->drawSurfaceTransparent(_menuSurface, 0, 0);
+}
+
+void GameLogic::toggleSoundEnabled() {
+	_vm->_isSoundEnabled = !_vm->_isSoundEnabled;
+}
+
+void GameLogic::toggleMusicEnabled() {
+	_vm->_isMusicEnabled = !_vm->_isMusicEnabled;
+
+	if (_vm->_isMusicEnabled) {
+		_vm->changeMusic();
+	} else {
+		_vm->stopMusic();
+	}
+}
+
+void GameLogic::menuExit() {
+	delete _menuSurface;
+	_menuSurface = nullptr;
+	delete _menuOffSprite;
+	_menuOffSprite = nullptr;
+	delete _menuOnSprite;
+	_menuOnSprite = nullptr;
+
+	_vm->_gameState = _menuGameState;
+	_menuIsSaveLoad = 0;
+	// TODO: Set mouse zone 0, 319, 0, 199
+	_vm->changeRoom(_vm->_currentRoomNumber);
+}
+
+void GameLogic::handleGameMenu() {
+	if (_menuQuitVisible) {
+		if (_vm->_mouseClickX >= 159) {
+			closeQuitMenu();
+		} else {
+			menuExit();
+			_vm->quitGame();
+		}
+	} else if (_menuIsSaveLoad) {
+		int si = 1 + ((_vm->_mouseClickY - 35) / 15);
+		if (si >= 7) {
+			sub_3F906();
+		} else {
+			if (_vm->_mouseClickX > 157)
+				si += 6;
+
+			if (_menuIsSaveLoad == 1)
+				warning("STUB: saveSavegame()");
+			else
+				warning("if (!loadSavegame()) return;");
+
+			menuExit();
+		}
+	} else {
+		switch ((_vm->_mouseClickY - 24) / 16) {
+		case 0:
+			toggleMusicEnabled();
+			menuDrawMusicEnabled();
+			break;
+		case 1:
+			toggleSoundEnabled();
+			menuDrawSoundEnabled();
+			break;
+		case 2:
+			warning("STUB: menuSaveLoadMenu(1)");
+			break;
+		case 3:
+			warning("STUB: menuSaveLoadMenu(0)");
+			break;
+		case 4:
+			warning("STUB: loadSaveGame(0)");
+			menuExit();
+			break;
+		case 5:
+			menuQuitGame();
+			break;
+		case 6:
+			if (!(_r0_flags & 0x02)) {
+				_r0_flags |= 0x02;
+				// menuExit() must absolutely called after r0_flags is set otherwise it reset the menu mode.
+				menuExit();
+
+				// in the original this code is in a separate function r0_startPizzathonDialog 
+				_vm->displayText("c11", 0, 0, -1, -1, 0);
+				_vm->setDialogChoices(29, 30, 31, 32, 33);
+				_vm->waitSeconds(2);
+				_vm->startDialog();
+			} else {
+				menuExit();
+			}
+			return;
+		default:
+			break;
+		}
+	}
+	_vm->_screen->drawSurfaceTransparent(_menuSurface, 0, 0);
+}
+
+void GameLogic::menuQuitGame() {
+	_menuQuitVisible = true;
+	// sysMouseDriver(2);
+	// TODO: Set mouse zone 116, 202, 118, 133
+	GxlArchive *m04Gxl = new GxlArchive("m04");
+	_vm->drawImageToSurface(m04Gxl, "sure.pcx", _menuSurface, 116, 103);
+	delete m04Gxl;
+}
+
+void GameLogic::closeQuitMenu() {
+	GxlArchive *m04Gxl = new GxlArchive("m04");
+	// sysMouseDriver(2);
+	// TODO: Set mouse zone 113, 205, 20, 135
+	_vm->drawImageToSurface(m04Gxl, "menu.pcx", _menuSurface, 113, 20);
+	// sysMouseDriver(1);
+	_menuQuitVisible = false;
+	delete m04Gxl;
+}
+
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index 7661ea49277..6484d6dadb3 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -108,7 +108,15 @@ public:
 	int _r31_scores[3];
 	bool _r31_askedQuestions[25];
 	bool _didScratchTicket;
-// protected:
+
+	int _menuGameState = 0;
+	WWSurface *_menuOffSprite = nullptr;
+	WWSurface *_menuOnSprite = nullptr;
+	WWSurface *_menuSurface = nullptr;
+	bool _menuQuitVisible = false;
+	int _menuIsSaveLoad = 0;
+
+	// protected:
 public://DEBUG So logic functions can be called from the engine class for testing
 	WaynesWorldEngine *_vm;
 
@@ -450,6 +458,15 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void r39_useExit39();
 	void r39_useExit();
 
+	void menuDrawSoundEnabled();
+	void menuDrawMusicEnabled();
+	void sub_3F906();
+	void toggleSoundEnabled();
+	void toggleMusicEnabled();
+	void handleGameMenu();
+	void menuQuitGame();
+	void menuExit();
+	void closeQuitMenu();
 };
 
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/sound.cpp b/engines/waynesworld/sound.cpp
index 1bcfc2b7a51..14cf920b7a8 100644
--- a/engines/waynesworld/sound.cpp
+++ b/engines/waynesworld/sound.cpp
@@ -20,6 +20,7 @@
  */
 
 #include "common/config-manager.h"
+#include "common/memstream.h"
 #include "audio/mixer.h"
 #include "audio/audiostream.h"
 #include "audio/mididrv.h"
@@ -31,7 +32,6 @@
 #include "waynesworld/waynesworld.h"
 #include "waynesworld/sound.h"
 
-
 namespace WaynesWorld {
 
 SoundManager::SoundManager(WaynesWorldEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 9b9ee9212c0..b8478fa60dd 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -27,18 +27,14 @@
 #include "waynesworld/objectids.h"
 
 #include "audio/audiostream.h"
-#include "audio/decoders/aiff.h"
 #include "common/config-manager.h"
-#include "common/debug-channels.h"
 #include "common/error.h"
 #include "common/fs.h"
-#include "common/timer.h"
 #include "common/translation.h"
 #include "engines/advancedDetector.h"
 #include "engines/util.h"
 #include "graphics/cursorman.h"
 #include "graphics/font.h"
-#include "graphics/fontman.h"
 #include "graphics/palette.h"
 #include "graphics/surface.h"
 #include "graphics/paletteman.h"
@@ -338,7 +334,7 @@ bool WaynesWorldEngine::isPointAtGarth(int x, int y) {
 }
 
 void WaynesWorldEngine::updateMouseMove() {
-    // Yet unknown
+    // Game Menu
     if (_gameState == 4)
         return;
 
@@ -449,7 +445,7 @@ void WaynesWorldEngine::handleMouseLeftClick() {
         unusedTicketHandleMouseClick();
         break;
     case 4:
-		warning("STUB - handleMouseClickState4");
+		_logic->handleGameMenu();
 		break;
     case 5:
         extremeCloseUpHandleMouseClick();
@@ -482,7 +478,7 @@ void WaynesWorldEngine::handleMouseRightClick() {
         unusedTicketHandleMouseClick();
         break;
     case 4:
-		warning("STUB - handleMouseClickState4");
+		_logic->handleGameMenu();
         break;
     case 5:
         extremeCloseUpHandleMouseClick();
@@ -705,6 +701,10 @@ void WaynesWorldEngine::changeMusic() {
 	}
 }
 
+void WaynesWorldEngine::stopMusic() {
+	_midi->stopSong();
+}
+
 void WaynesWorldEngine::drawInterface(int verbNum) {
     if (isActorWayne()) {
         drawImageToScreen(_m00Gxl, "winter.pcx", 0, 151);
@@ -733,7 +733,7 @@ void WaynesWorldEngine::selectVerbNumber(int x) {
                 drawInventory();
                 refreshActors();
             } else {
-				warning("STUB r0_handleRoomEvent1()");
+				_logic->r0_handleRoomEvent1();
             }
         }
     } else if (selectedButtonIndex == 0) {
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 6afb9682395..4b766bcc07e 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -23,21 +23,16 @@
 #ifndef WAYNESWORLD_WAYNESWORLD_H
 #define WAYNESWORLD_WAYNESWORLD_H
 
-#include "audio/mixer.h"
-#include "common/array.h"
 #include "common/events.h"
 #include "common/file.h"
-#include "common/memstream.h"
 #include "common/random.h"
 #include "common/str.h"
-#include "common/substream.h"
 #include "common/system.h"
 #include "engines/engine.h"
 #include "engines/advancedDetector.h"
 
 #include "image/pcx.h"
 
-#include "waynesworld/detection.h"
 #include "waynesworld/sound.h"
 
 
@@ -111,6 +106,8 @@ public:
 	~WaynesWorldEngine() override;
 	const Common::String getTargetName() { return _targetName; }
 	const ADGameDescription *_gameDescription;
+	bool _isSoundEnabled = true;
+	bool _isMusicEnabled = true;
 
 private:
 	Graphics::PixelFormat _pixelFormat;
@@ -276,6 +273,7 @@ public:
 	// Audio
 	void playSound(const char *filename, int flag);
 	void changeMusic();
+	void stopMusic();
 
 	// Interface
 	void drawInterface(int verbNum);


Commit: 7c92cf6a4146bce3e1c683837977c14e4300afa4
    https://github.com/scummvm/scummvm/commit/7c92cf6a4146bce3e1c683837977c14e4300afa4
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:54+01:00

Commit Message:
WAYNESWORLD: Add checks on isSoundEnabled and isMusicEnabled introduced by the menu

Changed paths:
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index b8478fa60dd..0357d7d0736 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -681,10 +681,14 @@ void WaynesWorldEngine::displayTextLines(const char *filename, int baseIndex, in
 }
 
 void WaynesWorldEngine::playSound(const char *filename, int flag) {
-	_sound->playSound(filename, flag);
+	if (_isSoundEnabled)
+		_sound->playSound(filename, flag);
 }
 
 void WaynesWorldEngine::changeMusic() {
+	if (!_isMusicEnabled)
+		return;
+	
 	switch (_musicIndex) {
 	case 0:
 		_midi->playMusic("pop-a.xmi");


Commit: 82d0978e2ee67af518db8c7db027486e027dadb7
    https://github.com/scummvm/scummvm/commit/82d0978e2ee67af518db8c7db027486e027dadb7
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:54+01:00

Commit Message:
WAYNESWORLD: Fix a couple of issues reported by Digitall

Changed paths:
    engines/waynesworld/sound.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/sound.cpp b/engines/waynesworld/sound.cpp
index 14cf920b7a8..5b4850c75cd 100644
--- a/engines/waynesworld/sound.cpp
+++ b/engines/waynesworld/sound.cpp
@@ -168,7 +168,7 @@ void MusicManager::playMusic(const char *filename, bool loop) {
 	if (size < 4)
 		error("playMusic() wrong music resource size");
 
-	delete _music;
+	delete[] _music;
 	_music = new byte[size];
 	fd.read(_music, size);
 
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 4b766bcc07e..2a682973062 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -163,7 +163,7 @@ public:
 	AnimationTimer _animationTimers[kAnimationTimersCount];
 
 	// Input
-	int _mouseX, _mouseY;
+	int _mouseX = 0, _mouseY = 0;
 	int _mouseClickY, _mouseClickX;
 	uint _mouseClickButtons;
 	Common::KeyCode _keyCode;


Commit: 1bc9cd18bf4cef8139132f6ceb8bc17c0088f742
    https://github.com/scummvm/scummvm/commit/1bc9cd18bf4cef8139132f6ceb8bc17c0088f742
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:54+01:00

Commit Message:
WAYNESWORLD: In menu, avoid to refresh after menuExit() to avoid a crash

Changed paths:
    engines/waynesworld/gamelogic.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 8dd79557fc6..7c59adf9110 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -8513,12 +8513,14 @@ void GameLogic::menuExit() {
 }
 
 void GameLogic::handleGameMenu() {
+	bool refresh = true;
 	if (_menuQuitVisible) {
 		if (_vm->_mouseClickX >= 159) {
 			closeQuitMenu();
 		} else {
 			menuExit();
 			_vm->quitGame();
+			refresh = false;
 		}
 	} else if (_menuIsSaveLoad) {
 		int si = 1 + ((_vm->_mouseClickY - 35) / 15);
@@ -8534,8 +8536,9 @@ void GameLogic::handleGameMenu() {
 				warning("if (!loadSavegame()) return;");
 
 			menuExit();
+			refresh = false;
 		}
-	} else {
+	} else {		
 		switch ((_vm->_mouseClickY - 24) / 16) {
 		case 0:
 			toggleMusicEnabled();
@@ -8554,6 +8557,7 @@ void GameLogic::handleGameMenu() {
 		case 4:
 			warning("STUB: loadSaveGame(0)");
 			menuExit();
+			refresh = false;
 			break;
 		case 5:
 			menuQuitGame();
@@ -8572,12 +8576,16 @@ void GameLogic::handleGameMenu() {
 			} else {
 				menuExit();
 			}
-			return;
+
+			refresh = false;
+			break;
 		default:
 			break;
 		}
 	}
-	_vm->_screen->drawSurfaceTransparent(_menuSurface, 0, 0);
+
+	if (refresh)
+		_vm->_screen->drawSurfaceTransparent(_menuSurface, 0, 0);
 }
 
 void GameLogic::menuQuitGame() {


Commit: c1c00a277c76ff82a32ef296e30be9364184c0fb
    https://github.com/scummvm/scummvm/commit/c1c00a277c76ff82a32ef296e30be9364184c0fb
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:54+01:00

Commit Message:
WAYNESWORLD: Add safeguards in drawSurface and drawSurfaceTransparent

Changed paths:
    engines/waynesworld/graphics.cpp


diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
index a770ebbca2b..dc01dceba68 100644
--- a/engines/waynesworld/graphics.cpp
+++ b/engines/waynesworld/graphics.cpp
@@ -285,12 +285,22 @@ void Screen::endUpdate() {
 }
 
 void Screen::drawSurface(const Graphics::Surface *surface, int x, int y) {
+	if (!surface) {
+		warning("drawSurface - Trying to draw on a null surface!");
+		return;
+	}
+	
 	beginUpdate();
 	drawSurfaceIntern(_vgaSurface, surface, x, y, false);
 	endUpdate();
 }
 
 void Screen::drawSurfaceTransparent(const Graphics::Surface *surface, int x, int y) {
+	if (!surface) {
+		warning("drawSurfaceTransparent - Trying to draw on a null surface!");
+		return;
+	}
+
 	beginUpdate();
 	drawSurfaceIntern(_vgaSurface, surface, x, y, true);
 	endUpdate();


Commit: b49e4b31c88eb343072b89915f67b438eb75cf80
    https://github.com/scummvm/scummvm/commit/b49e4b31c88eb343072b89915f67b438eb75cf80
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:54+01:00

Commit Message:
WAYNESWORLD: delete midi and sound before leaving

Changed paths:
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 0357d7d0736..7069ac8aeb9 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -227,6 +227,9 @@ Common::Error WaynesWorldEngine::run() {
 	delete _backgroundSurface;
 	delete _screen;
 
+	delete _sound;
+	delete _midi;
+
 	return Common::kNoError;
 }
 


Commit: 54d76c81a9bdf3905f365160a7a57703f8aa4d4d
    https://github.com/scummvm/scummvm/commit/54d76c81a9bdf3905f365160a7a57703f8aa4d4d
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:54+01:00

Commit Message:
WAYNESWORLD: reorder deletes

Changed paths:
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 7069ac8aeb9..906029678d6 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -202,20 +202,22 @@ Common::Error WaynesWorldEngine::run() {
 	unloadStaticRoomObjects();
 	unloadMainActorSprites();
 
+	delete _midi;
+	delete _sound;
 	delete _logic;
 
-	delete _m00Gxl;
-	delete _m01Gxl;
-	delete _m02Gxl;
-	delete _m03Gxl;
-	delete _m05Gxl;
-
-	delete _r08Gxl;
-	delete _r10Gxl;
-	delete _r14Gxl;
-	delete _r21Gxl;
-	delete _r22Gxl;
 	delete _r33Gxl;
+	delete _r22Gxl;
+	delete _r21Gxl;
+	delete _r14Gxl;
+	delete _r10Gxl;
+	delete _r08Gxl;
+
+	delete _m05Gxl;
+	delete _m03Gxl;
+	delete _m02Gxl;
+	delete _m01Gxl;
+	delete _m00Gxl;
 	
 	delete _fontWW;
 	delete _fontWWInv;
@@ -227,9 +229,6 @@ Common::Error WaynesWorldEngine::run() {
 	delete _backgroundSurface;
 	delete _screen;
 
-	delete _sound;
-	delete _midi;
-
 	return Common::kNoError;
 }
 


Commit: c889f2f014f471da2beaf7d64b1f8d1582f399a0
    https://github.com/scummvm/scummvm/commit/c889f2f014f471da2beaf7d64b1f8d1582f399a0
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:55+01:00

Commit Message:
WAYNESWORLD: Fix a memory leak (courtesy of Digitall)

Changed paths:
    engines/waynesworld/gxlarchive.cpp


diff --git a/engines/waynesworld/gxlarchive.cpp b/engines/waynesworld/gxlarchive.cpp
index eada240550c..9f91e016d60 100644
--- a/engines/waynesworld/gxlarchive.cpp
+++ b/engines/waynesworld/gxlarchive.cpp
@@ -127,8 +127,11 @@ Image::PCXDecoder *GxlArchive::loadImage(const char *filename) {
 		error("loadImage() Could not find '%s'", filename);
 
 	Image::PCXDecoder *pcx = new Image::PCXDecoder();
-	if (!pcx->loadStream(*createReadStreamForMember(Common::Path(filename))))
+	Common::SeekableReadStream *pcxStr = createReadStreamForMember(Common::Path(filename));
+	if (!pcx->loadStream(*pcxStr))
 		error("loadImage() Could not process '%s'", filename);
+
+	delete pcxStr;
 	
 	return pcx;
 }


Commit: fa6ff7a24d1dddb82d9185c79d975b0e840bbc3a
    https://github.com/scummvm/scummvm/commit/fa6ff7a24d1dddb82d9185c79d975b0e840bbc3a
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:55+01:00

Commit Message:
WAYNESWORLD: Fix 2 more valgrind issues

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/sound.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 7c59adf9110..bef536b5320 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -1359,6 +1359,7 @@ void GameLogic::r0_handleRoomEvent1() {
 
 	GxlArchive *m04Gxl = new GxlArchive("m04");
 	// sysMouseDriver(2);
+	delete _menuSurface;
 	// _menuSurface = new WWSurface(178, 122);
 	_menuSurface = new WWSurface(310, 180);
 	_vm->drawImageToSurface(m04Gxl, "menu.pcx", _menuSurface, 113, 20);
diff --git a/engines/waynesworld/sound.cpp b/engines/waynesworld/sound.cpp
index 5b4850c75cd..2bbf528d90b 100644
--- a/engines/waynesworld/sound.cpp
+++ b/engines/waynesworld/sound.cpp
@@ -125,7 +125,7 @@ MusicManager::MusicManager(WaynesWorldEngine *vm) : _vm(vm) {
 }
 
 MusicManager::~MusicManager() {
-	delete _music;
+	delete[] _music;
 }
 
 void MusicManager::send(uint32 b) {


Commit: 21ea3e30505bda46e4d14319172ad76ffc375667
    https://github.com/scummvm/scummvm/commit/21ea3e30505bda46e4d14319172ad76ffc375667
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:55+01:00

Commit Message:
WAYNESWORLD: Add restart feature (which uses original savegames)

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index bef536b5320..29b90deacd1 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -1089,7 +1089,7 @@ void GameLogic::setPizzathonStatus(int flagNum) {
         _pizzathonListFlags1 |= 0x20;
         break;
     }
-    // _byte_306C8++; Never used
+    // _byte_306C8++; Never used but present in savegames
     if ((_pizzathonListFlags1 & 0x08) && (_pizzathonListFlags1 & 0x40) && (_pizzathonListFlags1 & 0x80) &&
         (_pizzathonListFlags2 & 0x01) && (_pizzathonListFlags2 & 0x02) && (_pizzathonListFlags1 & 0x02) &&
         (_pizzathonListFlags1 & 0x04) && (_pizzathonListFlags1 & 0x10) && (_pizzathonListFlags1 & 0x01) &&
@@ -8485,6 +8485,111 @@ void GameLogic::sub_3F906() {
 	_vm->_screen->drawSurfaceTransparent(_menuSurface, 0, 0);
 }
 
+void GameLogic::menuSaveLoadMenu(bool isLoad) {
+	_menuIsSaveLoad = isLoad ? 2 : 1;
+	
+	GxlArchive *m04Gxl = new GxlArchive("m04");
+	// sysMouseDriver(2);
+	// TODO: Set mouse zone 71, 248, 20, 71
+	_vm->drawImageToSurface(m04Gxl, "savegm.pcx", _menuSurface, 71, 20);
+	if (isLoad)
+		_vm->drawImageToSurface(m04Gxl, "load.pcx", _menuSurface, 71 + 43, 20 + 4);
+
+	// sysMouseDriver(1);
+	delete m04Gxl;
+
+	_vm->_screen->drawSurfaceTransparent(_menuSurface, 0, 0);
+}
+
+bool GameLogic::loadSavegame(int slot) {
+	if (slot != 0) {
+		warning("STUB - loadSavegame %d", slot);
+		return false;
+	}
+
+	Common::File fp;
+	if (!fp.open(Common::Path("ww.rst"))) {
+		error("Couldn't find 'ww.rst'.");
+	}
+
+	_vm->stopRoomAnimations();
+	if (_vm->_isMusicEnabled)
+		toggleMusicEnabled();
+
+	_vm->redrawInventory();
+	_vm->_wayneSpriteX = fp.readSint16LE();
+	_vm->_wayneSpriteY = fp.readSint16LE();
+	_vm->_garthSpriteX = fp.readSint16LE();
+	_vm->_garthSpriteY = fp.readSint16LE();
+	_vm->_wayneActorScale = fp.readSint16LE();
+	_vm->_garthActorScale = fp.readSint16LE();
+	_vm->_actorSpriteValue = fp.readSint16LE();
+	_vm->_inventoryItemsCount = fp.readByte();
+	_vm->_currentActorNum = fp.readByte();
+	_vm->_currentRoomNumber = fp.readByte();
+	_vm->_hoverObjectNumber = fp.readSint16LE();
+	_vm->_objectNumber = fp.readSint16LE();
+	_vm->_verbNumber = fp.readByte();
+	_vm->_verbNumber2 = fp.readByte();
+	_vm->_firstObjectNumber = fp.readSint16LE();
+	_vm->_isMusicEnabled = fp.readSint16LE();
+	_vm->_isSoundEnabled = fp.readSint16LE();
+	_vm->_musicIndex = fp.readByte();
+	_vm->_selectedDialogChoice = fp.readSint16LE();
+	_vm->_roomChangeCtr = fp.readByte();
+	_menuGameState = fp.readByte();
+	_r24_mazeRoomNumber = fp.readSint16LE();
+	_r24_mazeHoleNumber = fp.readSint16LE();
+	byte byte_306C8 = fp.readSint16LE(); // set but not used in pizzathon
+
+	for (int i = 0; i < 5; ++i)
+		_vm->_dialogChoices[i] = fp.readSint16LE();
+
+	for (int i = 0; i < 50; ++i) {
+		_vm->_inventoryItemsObjectMap[i] = fp.readByte();
+		_vm->_wayneInventory[i] = fp.readSint16LE();
+		_vm->_garthInventory[i] = fp.readSint16LE();
+	}
+
+	for (int i = 0; i < 404; ++i)
+		_vm->_roomObjects[i].roomNumber = fp.readSint16LE();
+
+	_pizzathonListFlags1 = fp.readByte();
+	_pizzathonListFlags2 = fp.readByte();
+	_r31_flags = fp.readByte();
+	_r0_flags = fp.readByte();
+	_r4_flags = fp.readByte();
+	_r5_flags = fp.readByte();
+	_r7_flags = fp.readByte();
+	_r11_flags = fp.readByte();
+	_r32_flags = fp.readByte();
+	_r1_flags1 = fp.readByte();
+	_r1_flags2 = fp.readByte();
+	_r2_flags = fp.readByte();
+	_r10_flags = fp.readByte();
+	_r12_flags = fp.readByte();
+	_r19_flags = fp.readByte();
+	_r9_flags = fp.readByte();
+	_r6_flags = fp.readByte();
+	_r8_flags = fp.readByte();
+	_r13_flags = fp.readByte();
+	_r20_flags = fp.readByte();
+	_r29_flags = fp.readByte();
+	_r30_flags = fp.readByte();
+	_r34_flags = fp.readByte();
+	_r35_flags = fp.readByte();
+	_r37_flags = fp.readByte();
+	_r36_flags = fp.readByte();
+	_r38_flags = fp.readByte();
+	_r39_flags = fp.readByte();	
+
+	if (_vm->_isMusicEnabled)
+		_vm->changeMusic();
+
+	fp.close();	
+	return true;
+}
+
 void GameLogic::toggleSoundEnabled() {
 	_vm->_isSoundEnabled = !_vm->_isSoundEnabled;
 }
@@ -8524,17 +8629,18 @@ void GameLogic::handleGameMenu() {
 			refresh = false;
 		}
 	} else if (_menuIsSaveLoad) {
-		int si = 1 + ((_vm->_mouseClickY - 35) / 15);
-		if (si >= 7) {
+		int slot = 1 + ((_vm->_mouseClickY - 35) / 15);
+		if (slot >= 7) {
 			sub_3F906();
 		} else {
 			if (_vm->_mouseClickX > 157)
-				si += 6;
+				slot += 6;
 
 			if (_menuIsSaveLoad == 1)
 				warning("STUB: saveSavegame()");
 			else
-				warning("if (!loadSavegame()) return;");
+				if (!loadSavegame(slot))
+					return;
 
 			menuExit();
 			refresh = false;
@@ -8550,13 +8656,13 @@ void GameLogic::handleGameMenu() {
 			menuDrawSoundEnabled();
 			break;
 		case 2:
-			warning("STUB: menuSaveLoadMenu(1)");
+			menuSaveLoadMenu(true);
 			break;
 		case 3:
-			warning("STUB: menuSaveLoadMenu(0)");
+			menuSaveLoadMenu(false);
 			break;
 		case 4:
-			warning("STUB: loadSaveGame(0)");
+			loadSavegame(0);
 			menuExit();
 			refresh = false;
 			break;
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index 6484d6dadb3..3840a3e9a52 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -463,6 +463,8 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void sub_3F906();
 	void toggleSoundEnabled();
 	void toggleMusicEnabled();
+	void menuSaveLoadMenu(bool isLoad);
+	bool loadSavegame(int slot);
 	void handleGameMenu();
 	void menuQuitGame();
 	void menuExit();


Commit: 543b19f08dce7e48485f27e3bc8cdc2d4be9355d
    https://github.com/scummvm/scummvm/commit/543b19f08dce7e48485f27e3bc8cdc2d4be9355d
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:55+01:00

Commit Message:
WAYNESWORLD: Add save and load, use synchronize to have common code

Changed paths:
    engines/waynesworld/gamelogic.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 29b90deacd1..c8649e89a31 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -21,9 +21,12 @@
  */
 
 #include "waynesworld/gamelogic.h"
+
+#include "common/memstream.h"
 #include "waynesworld/graphics.h"
 #include "waynesworld/gxlarchive.h"
 #include "waynesworld/objectids.h"
+#include "common/savefile.h"
 #include "common/str.h"
 #include "graphics/cursorman.h"
 
@@ -8501,92 +8504,133 @@ void GameLogic::menuSaveLoadMenu(bool isLoad) {
 	_vm->_screen->drawSurfaceTransparent(_menuSurface, 0, 0);
 }
 
-bool GameLogic::loadSavegame(int slot) {
-	if (slot != 0) {
-		warning("STUB - loadSavegame %d", slot);
+void GameLogic::synchronize(Common::Serializer &s) {
+	s.syncAsSint16LE(_vm->_wayneSpriteX);
+	s.syncAsSint16LE(_vm->_wayneSpriteY);
+	s.syncAsSint16LE(_vm->_garthSpriteX);
+	s.syncAsSint16LE(_vm->_garthSpriteY);
+	s.syncAsSint16LE(_vm->_wayneActorScale);
+	s.syncAsSint16LE(_vm->_garthActorScale);
+	s.syncAsSint16LE(_vm->_actorSpriteValue);
+	s.syncAsByte(_vm->_inventoryItemsCount);
+	s.syncAsByte(_vm->_currentActorNum);
+	s.syncAsByte(_vm->_currentRoomNumber);
+	s.syncAsSint16LE(_vm->_hoverObjectNumber);
+	s.syncAsSint16LE(_vm->_objectNumber);
+	s.syncAsByte(_vm->_verbNumber);
+	s.syncAsByte(_vm->_verbNumber2);
+	s.syncAsSint16LE(_vm->_firstObjectNumber);
+	s.syncAsSint16LE(_vm->_isMusicEnabled);
+	s.syncAsSint16LE(_vm->_isSoundEnabled);
+	s.syncAsByte(_vm->_musicIndex);
+	s.syncAsSint16LE(_vm->_selectedDialogChoice);
+	s.syncAsByte(_vm->_roomChangeCtr);
+	s.syncAsByte(_menuGameState);
+	s.syncAsSint16LE(_r24_mazeRoomNumber);
+	s.syncAsSint16LE(_r24_mazeHoleNumber);
+	byte byte_306C8 = 0;
+	s.syncAsByte(byte_306C8); // set but not used in pizzathon
+
+	for (int i = 0; i < 5; ++i)
+		s.syncAsSint16LE(_vm->_dialogChoices[i]);
+
+	for (int i = 0; i < 50; ++i) {
+		s.syncAsByte(_vm->_inventoryItemsObjectMap[i]);
+		s.syncAsSint16LE(_vm->_wayneInventory[i]);
+		s.syncAsSint16LE(_vm->_garthInventory[i]);
+	}
+
+	for (int i = 0; i < 404; ++i)
+		s.syncAsSint16LE(_vm->_roomObjects[i].roomNumber);
+
+	s.syncAsByte(_pizzathonListFlags1);
+	s.syncAsByte(_pizzathonListFlags2);
+	s.syncAsByte(_r31_flags);
+	s.syncAsByte(_r0_flags);
+	s.syncAsByte(_r4_flags);
+	s.syncAsByte(_r5_flags);
+	s.syncAsByte(_r7_flags);
+	s.syncAsByte(_r11_flags);
+	s.syncAsByte(_r32_flags);
+	s.syncAsByte(_r1_flags1);
+	s.syncAsByte(_r1_flags2);
+	s.syncAsByte(_r2_flags);
+	s.syncAsByte(_r10_flags);
+	s.syncAsByte(_r12_flags);
+	s.syncAsByte(_r19_flags);
+	s.syncAsByte(_r9_flags);
+	s.syncAsByte(_r6_flags);
+	s.syncAsByte(_r8_flags);
+	s.syncAsByte(_r13_flags);
+	s.syncAsByte(_r20_flags);
+	s.syncAsByte(_r29_flags);
+	s.syncAsByte(_r30_flags);
+	s.syncAsByte(_r34_flags);
+	s.syncAsByte(_r35_flags);
+	s.syncAsByte(_r37_flags);
+	s.syncAsByte(_r36_flags);
+	s.syncAsByte(_r38_flags);
+	s.syncAsByte(_r39_flags);
+}
+
+bool GameLogic::saveSavegame(int slot) {
+	if (slot == 0)
+		error("Can't save on slot 0 - RST file");
+
+	// TODO: we could put the extra ScummVM info after the 1135 bytes of a standard savegame or modify loadSavegame to skip it when it's not a RST file
+	Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(Common::String::format("ww%02d.sav", slot), true);
+
+	if (saveFile == nullptr) {
+		warning("Can't create savegame slot %d", slot);
 		return false;
 	}
 
-	Common::File fp;
-	if (!fp.open(Common::Path("ww.rst"))) {
-		error("Couldn't find 'ww.rst'.");
+	_vm->redrawInventory();
+
+	Common::Serializer s(nullptr, saveFile);
+	synchronize(s);
+
+	delete saveFile;
+
+	return true;
+}
+
+bool GameLogic::loadSavegame(int slot) {
+	Common::InSaveFile *saveFile;
+	byte *buffer = nullptr;
+	
+	if (slot == 0) {
+		Common::File fd;
+		if (!fd.open(Common::Path("ww.rst")))
+			error("WaynesWorldEngine::loadSavegame() Could not open ww.rst");
+		const int size = fd.size();
+		buffer = new byte[size];
+		fd.read(buffer, size);
+		saveFile = new Common::MemoryReadStream(buffer, size, DisposeAfterUse::NO);
+		fd.close();
+	} else {
+		saveFile = g_system->getSavefileManager()->openForLoading(Common::String::format("ww%02d.sav", slot));
+
+		if (saveFile == nullptr) {
+			warning("Can't read savegame slot %d", slot);
+			return false;
+		}
 	}
 
 	_vm->stopRoomAnimations();
 	if (_vm->_isMusicEnabled)
 		toggleMusicEnabled();
-
 	_vm->redrawInventory();
-	_vm->_wayneSpriteX = fp.readSint16LE();
-	_vm->_wayneSpriteY = fp.readSint16LE();
-	_vm->_garthSpriteX = fp.readSint16LE();
-	_vm->_garthSpriteY = fp.readSint16LE();
-	_vm->_wayneActorScale = fp.readSint16LE();
-	_vm->_garthActorScale = fp.readSint16LE();
-	_vm->_actorSpriteValue = fp.readSint16LE();
-	_vm->_inventoryItemsCount = fp.readByte();
-	_vm->_currentActorNum = fp.readByte();
-	_vm->_currentRoomNumber = fp.readByte();
-	_vm->_hoverObjectNumber = fp.readSint16LE();
-	_vm->_objectNumber = fp.readSint16LE();
-	_vm->_verbNumber = fp.readByte();
-	_vm->_verbNumber2 = fp.readByte();
-	_vm->_firstObjectNumber = fp.readSint16LE();
-	_vm->_isMusicEnabled = fp.readSint16LE();
-	_vm->_isSoundEnabled = fp.readSint16LE();
-	_vm->_musicIndex = fp.readByte();
-	_vm->_selectedDialogChoice = fp.readSint16LE();
-	_vm->_roomChangeCtr = fp.readByte();
-	_menuGameState = fp.readByte();
-	_r24_mazeRoomNumber = fp.readSint16LE();
-	_r24_mazeHoleNumber = fp.readSint16LE();
-	byte byte_306C8 = fp.readSint16LE(); // set but not used in pizzathon
-
-	for (int i = 0; i < 5; ++i)
-		_vm->_dialogChoices[i] = fp.readSint16LE();
 
-	for (int i = 0; i < 50; ++i) {
-		_vm->_inventoryItemsObjectMap[i] = fp.readByte();
-		_vm->_wayneInventory[i] = fp.readSint16LE();
-		_vm->_garthInventory[i] = fp.readSint16LE();
-	}
+	Common::Serializer s(saveFile, nullptr);
+	synchronize(s);
 
-	for (int i = 0; i < 404; ++i)
-		_vm->_roomObjects[i].roomNumber = fp.readSint16LE();
-
-	_pizzathonListFlags1 = fp.readByte();
-	_pizzathonListFlags2 = fp.readByte();
-	_r31_flags = fp.readByte();
-	_r0_flags = fp.readByte();
-	_r4_flags = fp.readByte();
-	_r5_flags = fp.readByte();
-	_r7_flags = fp.readByte();
-	_r11_flags = fp.readByte();
-	_r32_flags = fp.readByte();
-	_r1_flags1 = fp.readByte();
-	_r1_flags2 = fp.readByte();
-	_r2_flags = fp.readByte();
-	_r10_flags = fp.readByte();
-	_r12_flags = fp.readByte();
-	_r19_flags = fp.readByte();
-	_r9_flags = fp.readByte();
-	_r6_flags = fp.readByte();
-	_r8_flags = fp.readByte();
-	_r13_flags = fp.readByte();
-	_r20_flags = fp.readByte();
-	_r29_flags = fp.readByte();
-	_r30_flags = fp.readByte();
-	_r34_flags = fp.readByte();
-	_r35_flags = fp.readByte();
-	_r37_flags = fp.readByte();
-	_r36_flags = fp.readByte();
-	_r38_flags = fp.readByte();
-	_r39_flags = fp.readByte();	
+	delete saveFile;
+	delete[] buffer;
 
 	if (_vm->_isMusicEnabled)
 		_vm->changeMusic();
 
-	fp.close();	
 	return true;
 }
 
@@ -8637,7 +8681,7 @@ void GameLogic::handleGameMenu() {
 				slot += 6;
 
 			if (_menuIsSaveLoad == 1)
-				warning("STUB: saveSavegame()");
+				saveSavegame(slot);
 			else
 				if (!loadSavegame(slot))
 					return;


Commit: f1dc9114c3e567981d2aa17607725b62fe3ffe39
    https://github.com/scummvm/scummvm/commit/f1dc9114c3e567981d2aa17607725b62fe3ffe39
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:55+01:00

Commit Message:
WAYNESWORLD: Force a refresh in closeSaveLoadMenu

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index c8649e89a31..8ea722f05bf 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -8474,15 +8474,18 @@ void GameLogic::menuDrawMusicEnabled() {
 	// sysMouseDriver(1);
 }
 
-void GameLogic::sub_3F906() {
+void GameLogic::closeSaveLoadMenu() {
 	GxlArchive *m04Gxl = new GxlArchive("m04");
+	_menuSurface->clear(0);
+	_menuIsSaveLoad = false;
+	_vm->redrawInventory();
+
 	// sysMouseDriver(2);
 	// TODO: Set mouse zone 113, 205, 20, 135
 	_vm->drawImageToSurface(m04Gxl, "menu.pcx", _menuSurface, 113, 20);
 	menuDrawSoundEnabled();
 	menuDrawMusicEnabled();
 	// sysMouseDriver(1);
-	_menuQuitVisible = false;
 	delete m04Gxl;
 
 	_vm->_screen->drawSurfaceTransparent(_menuSurface, 0, 0);
@@ -8675,7 +8678,7 @@ void GameLogic::handleGameMenu() {
 	} else if (_menuIsSaveLoad) {
 		int slot = 1 + ((_vm->_mouseClickY - 35) / 15);
 		if (slot >= 7) {
-			sub_3F906();
+			closeSaveLoadMenu();
 		} else {
 			if (_vm->_mouseClickX > 157)
 				slot += 6;
@@ -8687,8 +8690,8 @@ void GameLogic::handleGameMenu() {
 					return;
 
 			menuExit();
-			refresh = false;
 		}
+		refresh = false;
 	} else {		
 		switch ((_vm->_mouseClickY - 24) / 16) {
 		case 0:
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index 3840a3e9a52..59c406e0d5b 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -23,6 +23,7 @@
 #ifndef WAYNESWORLD_GAMELOGIC_H
 #define WAYNESWORLD_GAMELOGIC_H
 
+#include "common/serializer.h"
 #include "waynesworld/waynesworld.h"
 
 namespace WaynesWorld {
@@ -460,10 +461,12 @@ public://DEBUG So logic functions can be called from the engine class for testin
 
 	void menuDrawSoundEnabled();
 	void menuDrawMusicEnabled();
-	void sub_3F906();
+	void closeSaveLoadMenu();
 	void toggleSoundEnabled();
 	void toggleMusicEnabled();
 	void menuSaveLoadMenu(bool isLoad);
+	void synchronize(Common::Serializer &s);
+	bool saveSavegame(int slot);
 	bool loadSavegame(int slot);
 	void handleGameMenu();
 	void menuQuitGame();


Commit: c55f000bcc6158ab6d257a637160b88913069a5e
    https://github.com/scummvm/scummvm/commit/c55f000bcc6158ab6d257a637160b88913069a5e
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:55+01:00

Commit Message:
WAYNESWORLD: Restrict mouse using boundaries (only used in menus, it seems)

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 8ea722f05bf..71381e73ad6 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -1365,6 +1365,7 @@ void GameLogic::r0_handleRoomEvent1() {
 	delete _menuSurface;
 	// _menuSurface = new WWSurface(178, 122);
 	_menuSurface = new WWSurface(310, 180);
+	_vm->setMouseBounds(113, 205, 20, 135);
 	_vm->drawImageToSurface(m04Gxl, "menu.pcx", _menuSurface, 113, 20);
 	_menuOffSprite = m04Gxl->loadSurface("ff.pcx");
 	_menuOnSprite = m04Gxl->loadSurface("n.pcx");
@@ -8478,10 +8479,11 @@ void GameLogic::closeSaveLoadMenu() {
 	GxlArchive *m04Gxl = new GxlArchive("m04");
 	_menuSurface->clear(0);
 	_menuIsSaveLoad = false;
+	// force a refresh of the screen
 	_vm->redrawInventory();
 
 	// sysMouseDriver(2);
-	// TODO: Set mouse zone 113, 205, 20, 135
+	_vm->setMouseBounds(113, 205, 20, 135);
 	_vm->drawImageToSurface(m04Gxl, "menu.pcx", _menuSurface, 113, 20);
 	menuDrawSoundEnabled();
 	menuDrawMusicEnabled();
@@ -8496,7 +8498,7 @@ void GameLogic::menuSaveLoadMenu(bool isLoad) {
 	
 	GxlArchive *m04Gxl = new GxlArchive("m04");
 	// sysMouseDriver(2);
-	// TODO: Set mouse zone 71, 248, 20, 71
+	_vm->setMouseBounds(71, 248, 35, 141);
 	_vm->drawImageToSurface(m04Gxl, "savegm.pcx", _menuSurface, 71, 20);
 	if (isLoad)
 		_vm->drawImageToSurface(m04Gxl, "load.pcx", _menuSurface, 71 + 43, 20 + 4);
@@ -8661,7 +8663,7 @@ void GameLogic::menuExit() {
 
 	_vm->_gameState = _menuGameState;
 	_menuIsSaveLoad = 0;
-	// TODO: Set mouse zone 0, 319, 0, 199
+	_vm->setMouseBounds(0, 319, 0, 199);
 	_vm->changeRoom(_vm->_currentRoomNumber);
 }
 
@@ -8745,7 +8747,7 @@ void GameLogic::handleGameMenu() {
 void GameLogic::menuQuitGame() {
 	_menuQuitVisible = true;
 	// sysMouseDriver(2);
-	// TODO: Set mouse zone 116, 202, 118, 133
+	_vm->setMouseBounds(116, 202, 118, 133);
 	GxlArchive *m04Gxl = new GxlArchive("m04");
 	_vm->drawImageToSurface(m04Gxl, "sure.pcx", _menuSurface, 116, 103);
 	delete m04Gxl;
@@ -8754,7 +8756,7 @@ void GameLogic::menuQuitGame() {
 void GameLogic::closeQuitMenu() {
 	GxlArchive *m04Gxl = new GxlArchive("m04");
 	// sysMouseDriver(2);
-	// TODO: Set mouse zone 113, 205, 20, 135
+	_vm->setMouseBounds(113, 205, 20, 135);
 	_vm->drawImageToSurface(m04Gxl, "menu.pcx", _menuSurface, 113, 20);
 	// sysMouseDriver(1);
 	_menuQuitVisible = false;
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 906029678d6..59aad87737d 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -243,7 +243,8 @@ bool WaynesWorldEngine::hasFeature(EngineFeature f) const {
 
 void WaynesWorldEngine::updateEvents() {
 	Common::Event event;
-
+	Common::Point clickPt;
+	
 	while (_eventMan->pollEvent(event)) {
 		switch (event.type) {
 		case Common::EVENT_KEYDOWN:
@@ -253,23 +254,33 @@ void WaynesWorldEngine::updateEvents() {
 			_keyCode = Common::KEYCODE_INVALID;
 			break;
 		case Common::EVENT_MOUSEMOVE:
-  			_mouseX = event.mouse.x;
-  			_mouseY = event.mouse.y;
+			// Restrict mouse move to the mouse allowed zone
+  			_mouseX = CLIP<int>(event.mouse.x, _mouseZone.left, _mouseZone.right - 1);
+  			_mouseY = CLIP<int>(event.mouse.y, _mouseZone.top, _mouseZone.bottom - 1);
+			g_system->warpMouse(_mouseX, _mouseY);
   			break;
 		case Common::EVENT_LBUTTONDOWN:
-			_mouseClickButtons |= kLeftButtonClicked;
-			_mouseClickX = event.mouse.x;
-			_mouseClickY = event.mouse.y;
-			//_mouseClickButtons |= kLeftButtonDown;
+			// Only consider the event if the mouse is in the mouse zone
+			clickPt = event.mouse;
+			if (_mouseZone.contains(clickPt)) {
+				_mouseClickButtons |= kLeftButtonClicked;
+				_mouseClickX = clickPt.x;
+				_mouseClickY = clickPt.y;
+				//_mouseClickButtons |= kLeftButtonDown;
+			}
   			break;
 		case Common::EVENT_LBUTTONUP:
 			//_mouseClickButtons &= ~kLeftButtonDown;
   			break;
 		case Common::EVENT_RBUTTONDOWN:
-			_mouseClickButtons |= kRightButtonClicked;
-			_mouseClickX = event.mouse.x;
-			_mouseClickY = event.mouse.y;
-			//_mouseClickButtons |= kRightButtonDown;
+			// Only consider the event if the mouse is in the mouse zone
+			clickPt = event.mouse;
+			if(_mouseZone.contains(clickPt)) {
+				_mouseClickButtons |= kRightButtonClicked;
+				_mouseClickX = event.mouse.x;
+				_mouseClickY = event.mouse.y;
+				//_mouseClickButtons |= kRightButtonDown;
+			}
   			break;
 		case Common::EVENT_RBUTTONUP:
 			//_mouseClickButtons &= ~kRightButtonDown;
@@ -2122,4 +2133,8 @@ void WaynesWorldEngine::gxCloseLib(GxlArchive *lib) {
 	lib = nullptr;
 }
 
+void WaynesWorldEngine::setMouseBounds(int x1, int x2, int y1, int y2) {
+	// Add one as rect.contains() use a strict < comparison for x2 and y2
+	_mouseZone = Common::Rect(x1, y1, x2 + 1, y2 + 1);
+}
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 2a682973062..6a370028766 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -165,6 +165,7 @@ public:
 	// Input
 	int _mouseX = 0, _mouseY = 0;
 	int _mouseClickY, _mouseClickX;
+	Common::Rect _mouseZone = {0, 0, 319, 199};
 	uint _mouseClickButtons;
 	Common::KeyCode _keyCode;
 
@@ -324,6 +325,7 @@ public:
 	bool walkTo(int actor1_destX, int actor1_destY, int direction, int actor2_destX, int actor2_destY);
 
 	void gxCloseLib(GxlArchive *lib);
+	void setMouseBounds(int x1, int x2, int y1, int y2);
 	// Room
 	void openRoomLibrary(int roomNum);
 	void loadRoomBackground();
@@ -419,6 +421,7 @@ public:
 	};
 
 	bool _isSaveAllowed;
+
 	/* TODO
 	bool canLoadGameStateCurrently() override { return _isSaveAllowed; }
 	bool canSaveGameStateCurrently() override { return _isSaveAllowed; }


Commit: c6ca9cd659b09c61e0c9b895b1493937de53908f
    https://github.com/scummvm/scummvm/commit/c6ca9cd659b09c61e0c9b895b1493937de53908f
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:55+01:00

Commit Message:
WAYNESWORLD: Clean up some switches

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 71381e73ad6..a36c90356f4 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -252,6 +252,8 @@ int GameLogic::handleVerbPickUp() {
         return r36_handleVerbPickUp();
     case 37:
         return r37_handleVerbPickUp();
+	default:
+		break;
     }
 	return 0;
 }
@@ -326,6 +328,8 @@ int GameLogic::handleVerbUse() {
         return r38_handleVerbUse();
     case 39:
         return r39_handleVerbUse();
+	default:
+		break;
     }
 	return 0;
 }
@@ -377,6 +381,8 @@ void GameLogic::handleVerbTalkTo() {
     case 17:
         r17_handleVerbTalkTo();
         break;
+	default:
+		break;
     }
 }
 
@@ -447,6 +453,8 @@ int GameLogic::handleVerbOpen() {
         return r34_handleVerbOpen();
     case 39:
         return r39_handleVerbOpen();
+	default:
+		break;
     }
 	return 0;
 }
@@ -460,6 +468,8 @@ int GameLogic::handleVerbClose() {
         return r8_handleVerbClose();
     case 34:
         return r34_handleVerbClose();
+	default:
+		break;
     }
 	return 0;
 }
@@ -505,14 +515,16 @@ int GameLogic::handleVerbGive() {
         return r2_handleVerbGive();
     case 6:
         return r6_handleVerbGive();
-    case 10:
+	case 9:
+		return r9_handleVerbGive();
+	case 10:
         return r10_handleVerbGive();
     case 13:
         return r13_handleVerbGive();
     case 12:
         return r12_handleVerbGive();
-    case 9:
-        return r9_handleVerbGive();
+	default:
+		break;
     }
 	return 0;
 }
@@ -622,39 +634,41 @@ bool GameLogic::handleDialogSelect(int &replyTextX, int &replyTextY, int &replyT
         return r5_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
     case 6:
         return r6_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
-    case 9:
+	case 8:
+		return r8_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+	case 9:
         return r9_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
     case 10:
         return r10_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
     case 13:
         return r13_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
-    case 8:
-        return r8_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
-    case 32:
-        return r32_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
-    case 19:
-    case 20:
-        return r19_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
     case 12:
         return r12_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
     case 15:
         return r15_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
-    case 23:
+	case 17:
+		return r17_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+	case 19:
+	case 20:
+		return r19_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+	case 23:
         return r3_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
-    case 30:
+	case 28:
+		return r28_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+	case 30:
         return r30_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
-    case 28:
-        return r28_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
     case 31:
         return r31_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
-    case 34:
+	case 32:
+		return r32_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+	case 34:
         return r34_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
     case 35:
         return r35_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
-    case 17:
-        return r17_handleDialogSelect(replyTextX, replyTextY, replyTextIndex1, replyTextIndex2, replyTextIndex3);
+	default:
+		break;
     }
-	return 0;
+	return false;
 }
 
 void GameLogic::refreshRoomBackground(int roomNum) {
@@ -686,7 +700,10 @@ void GameLogic::refreshRoomBackground(int roomNum) {
     case 8:
         r8_refreshRoomBackground();
         break;
-    case 10:
+	case 9:
+		r9_refreshRoomBackground();
+		break;
+	case 10:
         r10_refreshRoomBackground();
         break;
     case 11:
@@ -695,27 +712,27 @@ void GameLogic::refreshRoomBackground(int roomNum) {
     case 12:
         r12_refreshRoomBackground();
         break;
-    case 16:
+	case 13:
+		r13_refreshRoomBackground();
+		break;
+	case 14:
+		r14_refreshRoomBackground();
+		break;
+	case 16:
         r16_refreshRoomBackground();
         break;
-    case 13:
-        r13_refreshRoomBackground();
-        break;
-    case 14:
-        r14_refreshRoomBackground();
-        break;
-    case 19:
+	case 17:
+		r17_refreshRoomBackground();
+		break;
+	case 18:
+		r18_refreshRoomBackground();
+		break;
+	case 19:
         r19_refreshRoomBackground();
         break;
     case 20:
         r20_refreshRoomBackground();
         break;
-    case 9:
-        r9_refreshRoomBackground();
-        break;
-    case 18:
-        r18_refreshRoomBackground();
-        break;
     case 22:
         r22_refreshRoomBackground();
         break;
@@ -760,12 +777,11 @@ void GameLogic::refreshRoomBackground(int roomNum) {
     case 38:
         r38_refreshRoomBackground();
         break;
-    case 17:
-        r17_refreshRoomBackground();
-        break;
     case 39:
         r39_refreshRoomBackground();
         break;
+	default:
+		break;
     }
 }
 
@@ -810,6 +826,8 @@ void GameLogic::updateRoomAnimations() {
 	case 38:
 		r38_updateRoomAnimations();
 		break;
+	default:
+		break;
 	}
 }
 
@@ -831,7 +849,10 @@ void GameLogic::handleRoomEvent(int eventNum) {
     case 1:
         r1_handleRoomEvent(false);
         break;
-    case 5:
+	case 4:
+		r4_handleRoomEvent();
+		break;
+	case 5:
         r5_handleRoomEvent();
         break;
     case 6:
@@ -848,40 +869,65 @@ void GameLogic::handleRoomEvent(int eventNum) {
         case 4:
             r6_handleRoomEvent4();
             break;
+        default:
+			break;
         }
         break;
-    case 4:
-        r4_handleRoomEvent();
-        break;
-    case 19:
+	case 8:
+		switch (eventNum) {
+		case 1:
+			r8_handleRoomEvent1();
+			break;
+		case 2:
+			r8_handleRoomEvent2();
+			break;
+		case 3:
+			r8_handleRoomEvent3();
+			break;
+		case 4:
+			r8_handleRoomEvent4();
+			break;
+		default:
+			break;
+		}
+		break;
+	case 13:
+		r13_handleRoomEvent();
+		break;
+	case 17:
+		switch (eventNum) {
+		case 1:
+			r17_handleRoomEvent1();
+			break;
+		case 2:
+			r17_handleRoomEvent2();
+			break;
+		case 3:
+			r17_handleRoomEvent3();
+			break;
+		default:
+			break;
+		}
+		break;
+	case 19:
         r19_handleRoomEvent();
         break;
     case 20:
         r20_handleRoomEvent();
         break;
-    case 13:
-        r13_handleRoomEvent();
-        break;
-    case 8:
-        switch (eventNum) {
-        case 1:
-            r8_handleRoomEvent1();
-            break;
-        case 2:
-            r8_handleRoomEvent2();
-            break;
-        case 3:
-            r8_handleRoomEvent3();
-            break;
-        case 4:
-            r8_handleRoomEvent4();
-            break;
-        }
-        break;
-    case 32:
-        r32_handleRoomEvent();
-        break;
-    case 28:
+	case 24:
+		switch (eventNum) {
+		case 1:
+			r24_handleRoomEvent(92, 72, -43, 90, 38, 0);
+			_vm->drawActors(0, 1, 1, 0, 65, 136, 145, 136);
+			break;
+		default:
+			r24_handleRoomEvent(203, 183, -43, 90, 38, 1);
+			_vm->drawActors(0, 1, 1, 0, 167, 136, 250, 136);
+			break;
+		}
+		break;
+	case 28:
         switch (eventNum) {
         case 1:
             r28_handleRoomEvent1();
@@ -894,18 +940,6 @@ void GameLogic::handleRoomEvent(int eventNum) {
     case 29:
         r29_handleRoomEvent();
         break;
-    case 24:
-        switch (eventNum) {
-        case 1:
-            r24_handleRoomEvent(92, 72, -43, 90, 38, 0);
-            _vm->drawActors(0, 1, 1, 0, 65, 136, 145, 136);
-            break;
-        default:
-            r24_handleRoomEvent(203, 183, -43, 90, 38, 1);
-            _vm->drawActors(0, 1, 1, 0, 167, 136, 250, 136);
-            break;
-        }
-        break;
     case 30:
         switch (eventNum) {
         case 1:
@@ -933,30 +967,24 @@ void GameLogic::handleRoomEvent(int eventNum) {
         case 5:
             r31_handleRoomEvent5();
             break;
+		default:
+			break;
         }
         break;
-    case 35:
+	case 32:
+		r32_handleRoomEvent();
+		break;
+	case 35:
         r35_talkToCassandra();
         break;
-    case 37:
+	case 36:
+		r36_handleRoomEvent();
+		break;
+	case 37:
         r37_climbEnterLadderDown();
         break;
-    case 36:
-        r36_handleRoomEvent();
-        break;
-    case 17:
-        switch (eventNum) {
-        case 1:
-            r17_handleRoomEvent1();
-            break;
-        case 2:
-            r17_handleRoomEvent2();
-            break;
-        case 3:
-            r17_handleRoomEvent3();
-            break;
-        }
-        break;
+	default:
+		break;
     }
 }
 
@@ -991,6 +1019,10 @@ int GameLogic::getActorScaleFromY(int actorY) {
 	case 22:
 		scale = actorY - 20;
 		break;
+	case 9:
+	case 15:
+		scale = actorY * 2 - 115;
+		break;
 	case 11:
 		scale = actorY - 60;
 		break;
@@ -1008,9 +1040,8 @@ int GameLogic::getActorScaleFromY(int actorY) {
 	case 16:
 		scale = actorY * 2 - 100;
 		break;
-	case 9:
-	case 15:
-		scale = actorY * 2 - 115;
+	case 17:
+		scale = actorY * 1.5 - 100;
 		break;
 	case 18:
 		scale = actorY - 15;
@@ -1052,8 +1083,7 @@ int GameLogic::getActorScaleFromY(int actorY) {
 	case 38:
 		scale = actorY - 31;
 		break;
-	case 17:
-		scale = actorY * 1.5 - 100;
+	default:
 		break;
 	}
     return CLIP(scale, 20, 100);
@@ -1091,6 +1121,8 @@ void GameLogic::setPizzathonStatus(int flagNum) {
     case 10:
         _pizzathonListFlags1 |= 0x20;
         break;
+	default:
+		break;
     }
     // _byte_306C8++; Never used but present in savegames
     if ((_pizzathonListFlags1 & 0x08) && (_pizzathonListFlags1 & 0x40) && (_pizzathonListFlags1 & 0x80) &&
@@ -1406,7 +1438,7 @@ void GameLogic::r0_updatePizzathonDialogChoices(int selectedDialogChoice) {
 			_r0_pizzathonChoicesUsed[index] = false;
 		}
 		for (int index = 0; index < 5; index++) {
-			int choiceIndex = _vm->_dialogChoices[index];
+			const int choiceIndex = _vm->_dialogChoices[index];
 			if (choiceIndex >= 47) {
 				_r0_pizzathonChoicesUsed[choiceIndex - 47 + 10] = true;
 			}
@@ -1676,6 +1708,8 @@ bool GameLogic::r1_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		replyTextIndex2 = 436;
 		_vm->_gameState = 0;
 		break;
+	default:
+		break;
 	}
 	return continueDialog;
 }
@@ -2016,8 +2050,6 @@ int GameLogic::r2_handleVerbUse() {
 		actionTextIndex = 38;
 		break;
 	case kObjectIdCounter2_0:
-		actionTextIndex = 79;
-		break;
 	case kObjectIdCounter2_1:
 		actionTextIndex = 79;
 		break;
@@ -2103,7 +2135,17 @@ bool GameLogic::r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		replyTextX = 260;
 		replyTextY = 20;
 	}
+
 	switch (_vm->_selectedDialogChoice) {
+	case 187:
+		if (_r2_flags & 0x01) {
+			replyTextIndex1 = 295;
+		} else {
+			replyTextIndex1 = 287;
+			replyTextIndex2 = 296;
+		}
+		_vm->_gameState = 0;
+		break;
 	case 296:
 		if (_r2_flags & 0x01) {
 			replyTextIndex1 = 292;
@@ -2132,48 +2174,16 @@ bool GameLogic::r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		}
 		_vm->_gameState = 0;
 		break;
-	case 187:
-		if (_r2_flags & 0x01) {
-			replyTextIndex1 = 295;
-		} else {
-			replyTextIndex1 = 287;
-			replyTextIndex2 = 296;
-		}
-		_vm->_gameState = 0;
-		break;
-	case 369: case 384:
-		if (_vm->isActorWayne() && _vm->getWayneInventoryItemQuantity(kObjectIdInventoryDollar) < 1) {
-			replyTextIndex1 = 579;
-			continueDialog = true;
-		} else if (_vm->isActorGarth() && _vm->getGarthInventoryItemQuantity(kObjectIdInventoryDollar) < 1) {
-			replyTextIndex1 = 579;
-			continueDialog = true;
-		} else {
-			r2_handleDialogSelect369();
-		}
-		_vm->_gameState = 0;
-		break;
-	case 385:
-		if (_vm->isActorWayne() && _vm->getWayneInventoryItemQuantity(kObjectIdInventoryDollar) < 10) {
-			replyTextIndex1 = 579;
-			continueDialog = true;
-		} else if (_vm->isActorGarth() && _vm->getGarthInventoryItemQuantity(kObjectIdInventoryDollar) < 10) {
-			replyTextIndex1 = 579;
-			continueDialog = true;
-		} else {
-			r2_handleDialogSelect385();
-		}
-		_vm->_gameState = 0;
-		break;
-	case 366: case 386:
-		_vm->_gameState = 0;
-		break;
 	case 365:
 		replyTextIndex1 = 392;
 		continueDialog = true;
 		_r2_flags |= 0x08;
 		_vm->setDialogChoices(369, 370, 366, -1, -1);
 		break;
+	case 366:
+	case 386:
+		_vm->_gameState = 0;
+		break;
 	case 367:
 		replyTextIndex1 = 393;
 		replyTextIndex2 = 394;
@@ -2184,11 +2194,25 @@ bool GameLogic::r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		replyTextIndex1 = 395;
 		_vm->_gameState = 0;
 		break;
+	case 369:
+	case 384:
+		if (_vm->isActorWayne() && _vm->getWayneInventoryItemQuantity(kObjectIdInventoryDollar) < 1) {
+			replyTextIndex1 = 579;
+			continueDialog = true;
+		} else if (_vm->isActorGarth() && _vm->getGarthInventoryItemQuantity(kObjectIdInventoryDollar) < 1) {
+			replyTextIndex1 = 579;
+			continueDialog = true;
+		} else {
+			r2_handleDialogSelect369();
+		}
+		_vm->_gameState = 0;
+		break;
 	case 370:
 		replyTextIndex1 = 398;
 		_vm->_gameState = 0;
 		break;
-	case 372: case 373:
+	case 372:
+	case 373:
 		replyTextIndex1 = _vm->_selectedDialogChoice + 27;
 		continueDialog = true;
 		break;
@@ -2253,6 +2277,20 @@ bool GameLogic::r2_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		continueDialog = true;
 		_vm->setDialogChoices(369, 370, 366, -1, -1);
 		break;
+	case 385:
+		if (_vm->isActorWayne() && _vm->getWayneInventoryItemQuantity(kObjectIdInventoryDollar) < 10) {
+			replyTextIndex1 = 579;
+			continueDialog = true;
+		} else if (_vm->isActorGarth() && _vm->getGarthInventoryItemQuantity(kObjectIdInventoryDollar) < 10) {
+			replyTextIndex1 = 579;
+			continueDialog = true;
+		} else {
+			r2_handleDialogSelect385();
+		}
+		_vm->_gameState = 0;
+		break;
+	default:
+		break;
 	}
 	return continueDialog;
 }
@@ -2353,6 +2391,8 @@ void GameLogic::r3_handleVerbTalkTo() {
 	case kObjectIdProtesters3:
 		_vm->displayTextLines("c04r", 256, 100, 20, 2);
 		break;
+	default:
+		break;
 	}
 }
 
@@ -2434,6 +2474,9 @@ bool GameLogic::r3_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 	replyTextX = 50;
 	replyTextY = 35;
 	switch (_vm->_selectedDialogChoice) {
+	case 187:
+		_vm->_gameState = 0;
+		break;
 	case 227:
 		replyTextIndex1 = 167;
 		continueDialog = true;
@@ -2461,8 +2504,7 @@ bool GameLogic::r3_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		}
 		continueDialog = true;
 		break;
-	case 187:
-		_vm->_gameState = 0;
+	default:
 		break;
 	}
 	return continueDialog;
@@ -2578,6 +2620,8 @@ void GameLogic::r4_handleVerbTalkTo() {
 			}
 		}
 		break;
+	default:
+		break;
 	}
 }
 
@@ -2596,13 +2640,22 @@ int GameLogic::r4_handleVerbOpen() {
 }
 
 bool GameLogic::r4_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
-	bool continueDialog = false;
+	const bool continueDialog = false;
 	replyTextIndex3 = -1;
 	replyTextIndex2 = -1;
 	replyTextIndex1 = -1;
 	replyTextX = 200;
 	replyTextY = 20;
 	switch (_vm->_selectedDialogChoice) {
+	case 285:
+		replyTextIndex1 = 242;
+		replyTextIndex2 = 243;
+		break;
+	case 286:
+	case 287:
+		replyTextIndex1 = 244;
+		replyTextIndex2 = 245;
+		break;
 	case 288:
 		if (!(_r4_flags & 0x01)) {
 			_vm->displayTextLines("c04r", 246, 200, 20, 2);
@@ -2613,13 +2666,7 @@ bool GameLogic::r4_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		_vm->loadRoomBackground();
 		_vm->_gameState = 0;
 		break;
-	case 285:
-		replyTextIndex1 = 242;
-		replyTextIndex2 = 243;
-		break;
-	case 286: case 287:
-		replyTextIndex1 = 244;
-		replyTextIndex2 = 245;
+	default:
 		break;
 	}
 	return continueDialog;
@@ -2673,7 +2720,7 @@ void GameLogic::r4_refreshRoomBackground() {
 		chainVisible = true;
 	}
 	if (chainVisible) {
-		Common::String filename = Common::String::format("%c%cchain%c.pcx", chainCheeseIn, chainUpDown1, chainUpDown2);
+		const Common::String filename = Common::String::format("%c%cchain%c.pcx", chainCheeseIn, chainUpDown1, chainUpDown2);
 		_vm->drawRoomImageToBackground(filename.c_str(), 224, 57);
 	}
 	if (_r4_flags & 0x20) {
@@ -2852,16 +2899,17 @@ bool GameLogic::r5_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		replyTextIndex1 = 88;
 		continueDialog = true;
 		break;
-	case 172: case 173:
-		replyTextIndex1 = _vm->_selectedDialogChoice - 81;
-		continueDialog = true;
-		break;
 	case 171:
 		replyTextIndex1 = 89;
 		replyTextIndex2 = 90;
 		_vm->setDialogChoices(175, 176, 177, 178, -1);
 		continueDialog = true;
 		break;
+	case 172:
+	case 173:
+		replyTextIndex1 = _vm->_selectedDialogChoice - 81;
+		continueDialog = true;
+		break;
 	case 174:
 		_vm->waitSeconds(1);
 		_r5_flags &= ~0x01;
@@ -2873,11 +2921,15 @@ bool GameLogic::r5_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		replyTextIndex1 = 95;
 		_vm->_gameState = 1;
 		break;
-	case 175: case 176: case 178:
+	case 175:
+	case 176:
+	case 178:
 		replyTextIndex1 = _vm->_selectedDialogChoice - 82;
 		_r5_flags &= ~0x01;
 		_vm->_gameState = 1;
 		break;
+	default:
+		break;
 	}
 	return continueDialog;
 }
@@ -2893,6 +2945,7 @@ void GameLogic::r5_handleRoomEvent() {
 	_vm->walkTo(195, 102, -1, 209, 96);
 	// TODO sub_185C0("wcass2", 0, 4, 0, 104, 170, 104, 26, 46, 8, 1);
 	// TODO sub_185C0("scass", 2, 1, 170, 104, 171, 104, 15, 46, 2, 0);
+	warning("STUB - r5_handleRoomEvent - sub_185C0?");
 	_vm->displayTextLines("c04r", 87, 150, 30, 1);
 	_vm->setDialogChoices(170, 171, 172, 173, 174);
 	_vm->startDialog();
@@ -2905,14 +2958,10 @@ int GameLogic::r6_handleVerbPickUp() {
 		actionTextIndex = 53;
 		break;
 	case kObjectIdWindow6:
-		actionTextIndex = 56;
-		break;
 	case kObjectIdFrontDoor6:
 		actionTextIndex = 56;
 		break;
 	case kObjectIdFlowerBed6_0:
-		actionTextIndex = 29;
-		break;
 	case kObjectIdFlowerBed6_1:
 		actionTextIndex = 29;
 		break;
@@ -3081,7 +3130,12 @@ bool GameLogic::r6_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		_vm->_roomEventNum = 4;
 		_vm->_gameState = 0;
 		break;
-	case 224: case 226:
+	case 223:
+		replyTextIndex1 = 164;
+		continueDialog = true;
+		break;
+	case 224:
+	case 226:
 		_vm->displayTextLines("c04r", 160, 100, 60, 1);
 		replyTextIndex1 = 161;
 		replyTextIndex2 = 162;
@@ -3089,14 +3143,12 @@ bool GameLogic::r6_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		_vm->_gameState = 0;
 		_vm->_roomEventNum = 4;
 		break;
-	case 223:
-		replyTextIndex1 = 164;
-		continueDialog = true;
-		break;
 	case 225:
 		replyTextIndex1 = 165;
 		continueDialog = true;
 		break;
+	default:
+		break;
 	}
 	return continueDialog;
 }
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 59aad87737d..f51dd022eb9 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -149,34 +149,13 @@ Common::Error WaynesWorldEngine::run() {
 	setWayneInventoryItemQuantity(kObjectIdInventoryDollar, 5);
 	setGarthInventoryItemQuantity(kObjectIdInventoryDrumstick, 1);
 
-#if 0
-	while (!shouldQuit()) {
-		updateEvents();
-	}
-#endif
-
-#if 1
-//	loadPalette("m01/wstand0");
-//	g_system->getPaletteManager()->setPalette(_palette2, 0, 256);
-
 	CursorMan.showMouse(true);
 
-//	drawImageToScreen("r00/backg", 0, 0);
-
 	drawInterface(2);
 	changeRoom(0);
 	changeMusic();
 	
-	// _wayneSpriteX = -1; _garthSpriteX = -1;
-	// changeRoom(31); // DEBUG
-	// _logic->r31_displayCategories();
-	// _logic->_r1_eventFlag = 1;
-	// _logic->_r1_eventCtr = 3;
-
 	_gameState = 0; // DEBUG Initial _gameState 0 is set by room event in room 0
-	// _gameState = 1; // DEBUG Open map
-
-	// lookAtUnusedTicket();
 
 	while (!shouldQuit()) {
 		_mouseClickButtons = 0;
@@ -194,11 +173,8 @@ Common::Error WaynesWorldEngine::run() {
 		}
 		updateRoomAnimations();
 		g_system->updateScreen();
-		// g_system->delayMillis(20);
 	}
 
-#endif
-
 	unloadStaticRoomObjects();
 	unloadMainActorSprites();
 
@@ -295,7 +271,7 @@ void WaynesWorldEngine::updateEvents() {
 }
 
 int WaynesWorldEngine::getRandom(int max) {
-	return max == 0 ? 0 : _random->getRandomNumber(max - 1);
+	return max <= 1 ? 0 : _random->getRandomNumber(max - 1);
 }
 
 void WaynesWorldEngine::waitMillis(uint millis) {
@@ -524,7 +500,7 @@ void WaynesWorldEngine::paletteFadeIn(int index, int count, int stepsSize) {
 	while (!isDone) {
 		isDone = true;
 		for (int fadeIndex = fadeStartIndex; fadeIndex < fadeEndIndex; fadeIndex++) {
-			byte destValue = _palette2[fadeIndex];
+			const byte destValue = _palette2[fadeIndex];
 			if (fadePalette[fadeIndex] < destValue) {
 				fadePalette[fadeIndex] = MIN<int>(fadePalette[fadeIndex] + stepsSize, destValue);
 				isDone = false;
@@ -1046,6 +1022,7 @@ int WaynesWorldEngine::drawActors(int direction, int wayneKind, int garthKind, i
 
     if (_scrollPosition != 0) {
         // drawStaticRoomObjects2(tempBackground);
+		warning("CHECKME - drawActors - drawStaticRoomObjects2(tempBackground);");
     }
 
     if (_inventoryItemsCount > 0) {
@@ -1100,7 +1077,6 @@ void WaynesWorldEngine::pickupObject(int objectId, byte &flags, byte flagsSet, i
 }
 
 void WaynesWorldEngine::playAnimation(const char *prefix, int startIndex, int count, int x, int y, int flag, uint ticks) {
-//    char filename[32];
 	Common::String filename;
     // sysMouseDriver(2);
 	if (count > 0) {
@@ -1218,32 +1194,22 @@ void WaynesWorldEngine::changeRoomScrolling() {
     _scrollWidth = 0;
     _scrollRemaining = 0;
     switch (_currentRoomNumber) {
-    case 14:
+	case 8:
+		if (isActorWayne()) {
+			_garthSpriteX = 319;
+			_garthSpriteY = 131;
+		} else {
+			_wayneSpriteX = 319;
+			_wayneSpriteY = 131;
+		}
+		roomNumber = 21;
+		break;
+	case 14:
         roomNumber = 19;
         break;
     case 19:
         roomNumber = 14;
         break;
-    case 8:
-        if (isActorWayne()) {
-            _garthSpriteX = 319;
-            _garthSpriteY = 131;
-        } else {
-            _wayneSpriteX = 319;
-            _wayneSpriteY = 131;
-        }
-        roomNumber = 21;
-        break;
-    case 22:
-        if (isActorWayne()) {
-            _garthSpriteX = 2;
-            _garthSpriteY = 131;
-        } else {
-            _wayneSpriteX = 2;
-            _wayneSpriteY = 131;
-        }
-        roomNumber = 21;
-        break;
     case 21:
         if (_hoverObjectNumber == kObjectIdFoyer) {
             if (isActorWayne()) {
@@ -1265,12 +1231,25 @@ void WaynesWorldEngine::changeRoomScrolling() {
             roomNumber = 22;
         }
         break;
-    case 32:
+	case 22:
+		if (isActorWayne()) {
+			_garthSpriteX = 2;
+			_garthSpriteY = 131;
+		} else {
+			_wayneSpriteX = 2;
+			_wayneSpriteY = 131;
+		}
+		roomNumber = 21;
+		break;
+	case 32:
         roomNumber = 33;
         break;
     case 33:
         roomNumber = 32;
         break;
+
+    default:
+		break;
     }
     unloadStaticRoomObjects();
     openRoomLibrary(roomNumber);
@@ -1702,6 +1681,8 @@ void WaynesWorldEngine::handleVerb(int verbFlag) {
     case 10:
         handleVerbClose();
         break;
+	default:
+		break;
     }
 
     if (_scrollWidth != 0) {
@@ -1729,17 +1710,17 @@ void WaynesWorldEngine::handleVerbPickUp() {
     }
 
     switch (actionTextIndex) {
-    case 7:
-        playSound("sv18.snd", 1);
-        playSound("sv28.snd", 1);
-        break;
     case 0:
     case 10:
     case 44:
     case 54:
         playSound("sv32.snd", 1);
         break;
-    case 13:
+	case 7:
+		playSound("sv18.snd", 1);
+		playSound("sv28.snd", 1);
+		break;
+	case 13:
         playSound("sv19.snd", 1);
         break;
     case 50:
@@ -1758,6 +1739,8 @@ void WaynesWorldEngine::handleVerbPickUp() {
     case 56:
         playSound("sv38.snd", 1);
         break;
+	default:
+		break;
     }
 
 }
@@ -2017,29 +2000,30 @@ void WaynesWorldEngine::handleVerbOpen() {
     }
 
     switch (actionTextIndex) {
-    case 5:
-        playSound("sv31.snd", 1);
-        break;
-    case 7:
-        playSound("ss07.snd", 1);
-        break;
-    case 8:
-        playSound("sv47.snd", 1);
-        break;
     case 0:
         playSound("sv28.snd", 1);
         break;
     case 1:
         playSound("sv38.snd", 1);
         break;
-    case 10:
+	case 5:
+		playSound("sv31.snd", 1);
+		break;
+	case 7:
+		playSound("ss07.snd", 1);
+		break;
+	case 8:
+		playSound("sv47.snd", 1);
+		break;
+	case 10:
         playSound("sv28.snd", 1);
         break;
     case 11:
         playSound("sv21.snd", 1);
         break;
+	default:
+		break;
     }
-
 }
 
 void WaynesWorldEngine::handleVerbClose() {
@@ -2061,6 +2045,8 @@ void WaynesWorldEngine::handleVerbClose() {
     case 1:
         playSound("sv21.snd", 1);
         break;
+    default:
+		break;
     }
 
 }


Commit: 2e0ab5be8bb515730e6dc9b7306d13be59b259dc
    https://github.com/scummvm/scummvm/commit/2e0ab5be8bb515730e6dc9b7306d13be59b259dc
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:55+01:00

Commit Message:
WAYNESWORLD: Add some missing const

Changed paths:
    engines/waynesworld/graphics.cpp
    engines/waynesworld/gxlarchive.cpp
    engines/waynesworld/pathfinding.cpp
    engines/waynesworld/sound.cpp


diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
index dc01dceba68..c71e27be459 100644
--- a/engines/waynesworld/graphics.cpp
+++ b/engines/waynesworld/graphics.cpp
@@ -162,10 +162,10 @@ void GFTFont::loadFromFile(const char *filename) {
 	fd.seek(0x24);
 	_firstChar = fd.readUint16LE();
 	_lastChar = fd.readUint16LE();
-	uint16 charCount = _lastChar - _firstChar + 2;
+	const uint16 charCount = _lastChar - _firstChar + 2;
 	fd.seek(0x48);
-	uint32 charTableOfs = fd.readUint32LE();
-	uint32 charDataOfs = fd.readUint32LE();
+	const uint32 charTableOfs = fd.readUint32LE();
+	const uint32 charDataOfs = fd.readUint32LE();
 	_formWidth = fd.readSint16LE();
 	_formHeight = fd.readSint16LE();
 	fd.seek(charTableOfs);
@@ -177,7 +177,7 @@ void GFTFont::loadFromFile(const char *filename) {
     for (int y = 0; y < _formHeight; y++) {
         int x = 0;
         for (int formPos = 0; formPos < _formWidth; formPos++) {
-            byte charByte = fd.readByte();
+	        const byte charByte = fd.readByte();
             for (int bitNum = 0; bitNum < 8; bitNum++) {
                 _fontData[x + y * _formWidth * 8] = ((charByte & (1 << (7 - bitNum))) != 0) ? 1 : 0;
                 x++;
@@ -196,12 +196,12 @@ void GFTFont::drawText(Graphics::Surface *surface, const char *text, int x, int
 void GFTFont::drawWrappedText(Graphics::Surface *surface, const char *text, int x, int y, int maxWidth, byte color) {
     const char *textP = text;
     const char *lineStartP = text, *lastSpaceP = nullptr;
-	int textX = x;
+    const int textX = x;
     int lineWidth = 0;
     while (*textP) {
         if (textP > text && textP[-1] == 32)
             lastSpaceP = textP - 1;
-        int charWidth = getCharWidth(*textP);
+        const int charWidth = getCharWidth(*textP);
         if (lineWidth + charWidth > maxWidth) {
 			const char *lineEndP = lastSpaceP ? lastSpaceP : textP + 1;
 			for (const char *p = lineStartP; p < lineEndP; p++) {
@@ -230,7 +230,7 @@ int GFTFont::drawChar(Graphics::Surface *surface, byte ch, int x, int y, byte co
 		return 0;
 	const uint charIndex = ch - _firstChar;
 	byte *charData = _fontData + _charTable[charIndex];
-	int charWidth = getCharWidth(ch);
+	const int charWidth = getCharWidth(ch);
 	for (int yc = 0; yc < _formHeight; yc++) {
 		byte *destRow = (byte*)surface->getBasePtr(x, y + yc);
 		for (int xc = 0; xc < charWidth; xc++) {
@@ -348,8 +348,8 @@ ScreenEffect::ScreenEffect(WaynesWorldEngine *vm, Graphics::Surface *surface, in
 	: _vm(vm), _surface(surface), _x(x), _y(y), _grainWidth(grainWidth), _grainHeight(grainHeight), _blockCtr(0) {
     _blockCountW = _surface->w / _grainWidth + (_surface->w % _grainWidth > 0 ? 1 : 0);
 	_blockCountH = _surface->h / _grainHeight + (_surface->h % _grainHeight > 0 ? 1 : 0);
-	int blockCount = _blockCountW * _blockCountH;
-	int duration = blockCount / 5; // Approximate time this effect should take in ms
+    const int blockCount = _blockCountW * _blockCountH;
+    const int duration = blockCount / 5; // Approximate time this effect should take in ms
 	_timePerSlice = 50; // Time after which the screen should be updated
 	_blocksPerSlice = blockCount / (duration / _timePerSlice);
 }
@@ -363,9 +363,8 @@ void ScreenEffect::drawSpiralEffect() {
 	_totalSliceTicks = g_system->getMillis();
 	_vm->_screen->beginUpdate();
 	while (startBlock >= 0 && !_vm->shouldQuit()) {
-		int blockX, blockY;
-		blockX = startBlock;
-		blockY = startBlock;
+		int blockX = startBlock;
+		int blockY = startBlock;
 		while (++blockX < sideLenW) {
 			drawBlock(blockX, blockY);
 		}
@@ -392,16 +391,17 @@ void ScreenEffect::drawSpiralEffect() {
 }
 
 void ScreenEffect::drawRandomEffect() {
-	uint bitCountW = getBitCount(_blockCountW);
-	uint bitCountH = getBitCount(_blockCountH);
-	uint bitCount = bitCountW + bitCountH;
-	uint mask = (1 << bitCountW) - 1;
-	uint rvalue = getSeed(bitCount), value = 1;
+	const uint bitCountW = getBitCount(_blockCountW);
+	const uint bitCountH = getBitCount(_blockCountH);
+	const uint bitCount = bitCountW + bitCountH;
+	const uint mask = (1 << bitCountW) - 1;
+	const uint rvalue = getSeed(bitCount);
+	uint value = 1;
 	_totalSliceTicks = g_system->getMillis();
 	_vm->_screen->beginUpdate();
 	do {
-		int blockX = value & mask;
-		int blockY = value >> bitCountW;
+		const int blockX = value & mask;
+		const int blockY = value >> bitCountW;
 		drawBlock(blockX, blockY);
 		if (value & 1) {
 			value >>= 1;
@@ -416,7 +416,8 @@ void ScreenEffect::drawRandomEffect() {
 
 void ScreenEffect::drawBlock(int blockX, int blockY) {
 	if (blockX < _blockCountW && blockY < _blockCountH) {
-		int sourceLeft = blockX * _grainWidth, sourceTop = blockY * _grainHeight;
+		const int sourceLeft = blockX * _grainWidth;
+		const int sourceTop = blockY * _grainHeight;
 		int sourceRight = sourceLeft + _grainWidth, sourceBottom = sourceTop + _grainHeight;
 		sourceRight = MIN<int>(_surface->w, sourceRight);
 		sourceBottom = MIN<int>(_surface->h, sourceBottom);
@@ -425,13 +426,13 @@ void ScreenEffect::drawBlock(int blockX, int blockY) {
 		_vm->_screen->drawSurface(&blockSurface, _x + sourceLeft, _y + sourceTop);
 		if (++_blockCtr == _blocksPerSlice) {
 			_vm->_screen->endUpdate();
-			uint32 currTicks = g_system->getMillis();
+			const uint32 currTicks = g_system->getMillis();
 			_blockCtr = 0;
 			_totalSliceTicks += _timePerSlice;
 			// Check if the system is faster than the current slice ticks
 			// and wait for the difference.
 			if (currTicks < _totalSliceTicks) {
-				uint32 waitTicks = _totalSliceTicks - currTicks;
+				const uint32 waitTicks = _totalSliceTicks - currTicks;
 				_vm->waitMillis(waitTicks);
 			} else {
 				_vm->updateEvents();
diff --git a/engines/waynesworld/gxlarchive.cpp b/engines/waynesworld/gxlarchive.cpp
index 9f91e016d60..c05f66fa615 100644
--- a/engines/waynesworld/gxlarchive.cpp
+++ b/engines/waynesworld/gxlarchive.cpp
@@ -32,7 +32,7 @@
 namespace WaynesWorld {
 
 GxlArchive::GxlArchive(const Common::String name) : _gxlFile(new Common::File()) {
-	Common::Path filename = Common::Path(name + ".GXL");
+	const Common::Path filename = Common::Path(name + ".GXL");
 	if (!_gxlFile->open(filename)) {
 		warning("GlxArchive::GlxArchive(): Could not find the archive file %s", filename.baseName().c_str());
 		delete _gxlFile;
@@ -40,14 +40,14 @@ GxlArchive::GxlArchive(const Common::String name) : _gxlFile(new Common::File())
 		return;
 	}
 
-	uint16 sign = _gxlFile->readUint16BE();
+	const uint16 sign = _gxlFile->readUint16BE();
 	if (sign != 0x01CA) {
 		error("Invalid GXL signature");
 	}
 
 	// signature (2) + copyright (50) + version (2) + garbage(40)
 	_gxlFile->seek(94);
-	uint16 count = _gxlFile->readUint16LE();
+	const uint16 count = _gxlFile->readUint16LE();
 	
 	GxlHeader header;
 	_gxlFile->seek(128);
diff --git a/engines/waynesworld/pathfinding.cpp b/engines/waynesworld/pathfinding.cpp
index ab1e11e734a..07e81a91ae8 100644
--- a/engines/waynesworld/pathfinding.cpp
+++ b/engines/waynesworld/pathfinding.cpp
@@ -95,8 +95,9 @@ void WaynesWorldEngine::walkCalcOtherActorDest(int flag, int &x, int &y) {
     } else {
         direction = walkCalcDirection(x - _wayneSpriteX, y - _wayneSpriteY);
     }
-    int actorScale = getActorScaleFromY(y);
-    int actorDistance = (actorScale * 20) / 100;
+
+    const int actorScale = getActorScaleFromY(y);
+    const int actorDistance = (actorScale * 20) / 100;
     switch (direction) {
     case 0:
         y += actorDistance;
@@ -104,24 +105,30 @@ void WaynesWorldEngine::walkCalcOtherActorDest(int flag, int &x, int &y) {
     case 1:
         x += actorDistance;
         break;
+
     case 2:
         x += actorDistance;
         // fallthrough
     case 3:
         y -= actorDistance;
         break;
+
     case 4:
         y -= actorDistance;
         // fallthrough
     case 5:
         x -= actorDistance;
         break;
+
     case 6:
         x -= actorDistance;
         // fallthrough
     case 7:
         y += actorDistance;
         break;
+  
+    default:
+    	break;
     }
     walkAdjustDestPoint(x, y);
 }
@@ -321,7 +328,7 @@ int WaynesWorldEngine::walkCalcDirection(int deltaX, int deltaY) {
 
 int WaynesWorldEngine::walkAddWalkLine(int flag, int x1, int y1, int x2, int y2, int pointsCount) {
     WalkPoint *walkPoints = flag == 0 ? _wayneWalkPoints : _garthWalkPoints;
-    int newDirection = walkCalcDirection(x1 - x2, y1 - y2);
+    const int newDirection = walkCalcDirection(x1 - x2, y1 - y2);
 	// debug("walkAddWalkLine() %d, %d, %d, %d", x1, y1, x2, y2);
 
     if (pointsCount == 0 || walkPoints[pointsCount - 1].x != x1 || walkPoints[pointsCount - 1].y != y1) {
@@ -421,14 +428,11 @@ bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction
         walkAdjustDestPoint(actor2WalkDestX, actor2WalkDestY);
     }
 
-    int actor1PointsCount, actor2PointsCount;
-
-    actor1PointsCount = walkCalcPath(flag1, actor1X, actor1Y, actor1_destX, actor1_destY, 0);
+    const int actor1PointsCount = walkCalcPath(flag1, actor1X, actor1Y, actor1_destX, actor1_destY, 0);
+	int actor2PointsCount = 0;
 
     if (actor2X != actor2WalkDestX || actor2Y != actor2WalkDestY) {
         actor2PointsCount = walkCalcPath(flag2, actor2X, actor2Y, actor2WalkDestX, actor2WalkDestY, 0);
-    } else {
-        actor2PointsCount = 0;
     }
 
     if (actor1PointsCount + 20 < actor2PointsCount) {
@@ -461,6 +465,7 @@ bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction
         // }
         waitMillis(100); // TODO Fix this
         if (_scrollRemaining == 0) {
+			warning("STUB - Missing scrolling in WalkTo");
             // TOOD
             // if (updateGame()) {
             //     return true;
diff --git a/engines/waynesworld/sound.cpp b/engines/waynesworld/sound.cpp
index 2bbf528d90b..c7db9899038 100644
--- a/engines/waynesworld/sound.cpp
+++ b/engines/waynesworld/sound.cpp
@@ -88,7 +88,7 @@ MusicManager::MusicManager(WaynesWorldEngine *vm) : _vm(vm) {
 	_isLooping = false;
 	_driver = nullptr;
 
-	MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MT32);
+	const MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MT32);
 	MusicType musicType = MidiDriver::getMusicType(dev);
 
 	switch (musicType) {


Commit: 9f42a6c9ce61ef80637f947640a81a5956a73f28
    https://github.com/scummvm/scummvm/commit/9f42a6c9ce61ef80637f947640a81a5956a73f28
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:55+01:00

Commit Message:
WAYNESWORLD: Add a couple of stubs

Changed paths:
    engines/waynesworld/gamemap.cpp


diff --git a/engines/waynesworld/gamemap.cpp b/engines/waynesworld/gamemap.cpp
index e5b34ff5292..a4586ebc493 100644
--- a/engines/waynesworld/gamemap.cpp
+++ b/engines/waynesworld/gamemap.cpp
@@ -153,6 +153,7 @@ void WaynesWorldEngine::gameMapHandleMouseMove(int objectNumber) {
 
     if (_hoverObjectNumber == -1) {
         if (_currentMapItemIndex == 6) {
+			warning("STUB gameMapHandleMouseMove - _currentMapItemIndex == 6");
             // TODO gameMapPaletteHandlerStop();
             // TODO paletteFadeColor(36, 4, 21, 2, 64);
             // TODO gameMapPaletteHandlerStart();
@@ -179,7 +180,8 @@ void WaynesWorldEngine::gameMapHandleMouseMove(int objectNumber) {
         tagX = item.tagX;
         tagY = item.tagY;
     } else if (_hoverObjectNumber == 6 || (_hoverObjectNumber >= 22 && _hoverObjectNumber <= 27)) {
-        // TODO gameMapPaletteHandlerStop();
+		warning("STUB gameMapHandleMouseMove - _hoverObjectNumber == 6");
+		// TODO gameMapPaletteHandlerStop();
         // TODO paletteFadeColor(36, 63, 0, 0, 64);
         // TODO gameMapPaletteHandlerStart();
         _currentMapItemIndex = 6;


Commit: 0c81849c2efc3d26b2f004e69a8ac9014af6ecb5
    https://github.com/scummvm/scummvm/commit/0c81849c2efc3d26b2f004e69a8ac9014af6ecb5
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:55+01:00

Commit Message:
WAYNESWORLD: Add a GXL file to the detection

Changed paths:
    engines/waynesworld/detection_tables.h


diff --git a/engines/waynesworld/detection_tables.h b/engines/waynesworld/detection_tables.h
index db2160f0cd7..a6357fe6537 100644
--- a/engines/waynesworld/detection_tables.h
+++ b/engines/waynesworld/detection_tables.h
@@ -25,7 +25,8 @@ static const ADGameDescription gameDescriptions[] = {
 	{
 		"waynesworld",
 		nullptr,
-		AD_ENTRY1s("e00.txt", "78769d60d48aea314ed6be2f725c8c2f", 1293),
+		AD_ENTRY2s("R00.GXL", "197ae9fb74a79a6dad4e3336f94c7545", 36272,
+				"e00.txt", "78769d60d48aea314ed6be2f725c8c2f", 1293),
 		Common::EN_ANY,
 		Common::kPlatformDOS,
 		ADGF_NO_FLAGS,


Commit: 0bd5ccd9c8a216d0f1cf9363281bf24de9f53486
    https://github.com/scummvm/scummvm/commit/0bd5ccd9c8a216d0f1cf9363281bf24de9f53486
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:56+01:00

Commit Message:
WAYNESWORLD: Clean up more switches in gamelogic

Changed paths:
    engines/waynesworld/gamelogic.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index a36c90356f4..5ad3e407984 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -916,26 +916,19 @@ void GameLogic::handleRoomEvent(int eventNum) {
         r20_handleRoomEvent();
         break;
 	case 24:
-		switch (eventNum) {
-		case 1:
+		if (eventNum == 1) {
 			r24_handleRoomEvent(92, 72, -43, 90, 38, 0);
 			_vm->drawActors(0, 1, 1, 0, 65, 136, 145, 136);
-			break;
-		default:
+		} else {
 			r24_handleRoomEvent(203, 183, -43, 90, 38, 1);
 			_vm->drawActors(0, 1, 1, 0, 167, 136, 250, 136);
-			break;
 		}
 		break;
 	case 28:
-        switch (eventNum) {
-        case 1:
+		if (eventNum == 1)
             r28_handleRoomEvent1();
-            break;
-        default:
-            r28_handleRoomEvent2();
-            break;
-        }
+		else
+    		r28_handleRoomEvent2();
         break;
     case 29:
         r29_handleRoomEvent();
@@ -948,6 +941,8 @@ void GameLogic::handleRoomEvent(int eventNum) {
         case 2:
             r30_handleRoomEvent2();
             break;
+        default:
+			break;
         }
         break;
     case 31:
@@ -1309,7 +1304,7 @@ int GameLogic::r0_handleVerbUse() {
 }
 
 int GameLogic::r0_handleVerbOpen() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdStairs0:
 	case kObjectIdCouch:
@@ -1395,7 +1390,6 @@ void GameLogic::r0_handleRoomEvent1() {
 	GxlArchive *m04Gxl = new GxlArchive("m04");
 	// sysMouseDriver(2);
 	delete _menuSurface;
-	// _menuSurface = new WWSurface(178, 122);
 	_menuSurface = new WWSurface(310, 180);
 	_vm->setMouseBounds(113, 205, 20, 135);
 	_vm->drawImageToSurface(m04Gxl, "menu.pcx", _menuSurface, 113, 20);
@@ -2430,7 +2424,7 @@ int GameLogic::r3_handleVerbUse() {
 }
 
 int GameLogic::r3_handleVerbPickUp() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdCar3:
 		actionTextIndex = 35;
@@ -2522,7 +2516,7 @@ void GameLogic::r3_refreshRoomBackground() {
 }
 
 int GameLogic::r4_handleVerbPickUp() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdOffice4:
 		actionTextIndex = 8;
@@ -2626,7 +2620,7 @@ void GameLogic::r4_handleVerbTalkTo() {
 }
 
 int GameLogic::r4_handleVerbOpen() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdCastleDoor:
 		_vm->playAnimation("opencg", 0, 4, 223, 49, 0, 100);
@@ -2818,7 +2812,7 @@ int GameLogic::r4_useTubeWithShade() {
 }
 
 int GameLogic::r5_handleVerbPickUp() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdFan:
 		actionTextIndex = 51;
@@ -2862,7 +2856,7 @@ int GameLogic::r5_handleVerbUse() {
 }
 
 int GameLogic::r5_handleVerbPush() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdBed:
 		actionTextIndex = 2;
@@ -2875,7 +2869,7 @@ int GameLogic::r5_handleVerbPush() {
 }
 
 int GameLogic::r5_handleVerbOpen() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdDresser:
 		actionTextIndex = 6;
@@ -2915,12 +2909,6 @@ bool GameLogic::r5_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		_r5_flags &= ~0x01;
 		_vm->_gameState = 1;
 		break;
-	case 177:
-		_vm->moveObjectToRoom(kObjectIdInventoryCassContract, 99);
-		_vm->refreshInventory(false);
-		replyTextIndex1 = 95;
-		_vm->_gameState = 1;
-		break;
 	case 175:
 	case 176:
 	case 178:
@@ -2928,6 +2916,12 @@ bool GameLogic::r5_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		_r5_flags &= ~0x01;
 		_vm->_gameState = 1;
 		break;
+	case 177:
+		_vm->moveObjectToRoom(kObjectIdInventoryCassContract, 99);
+		_vm->refreshInventory(false);
+		replyTextIndex1 = 95;
+		_vm->_gameState = 1;
+		break;
 	default:
 		break;
 	}
@@ -3053,7 +3047,7 @@ int GameLogic::r6_handleVerbGive() {
 }
 
 int GameLogic::r6_handleVerbOpen() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdFlowerBed6_0:
 		actionTextIndex = 10;
@@ -3106,16 +3100,23 @@ bool GameLogic::r6_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		replyTextIndex1 = 142;
 		continueDialog = true;
 		break;
-	case 205: case 206: case 207:
+	case 205:
+	case 206:
+	case 207:
 		replyTextIndex1 = _vm->_selectedDialogChoice + -62;
 		_vm->_roomEventNum = 1;
 		break;
-	case 211: case 212: case 213: case 214:
+	case 211:
+	case 212:
+	case 213:
+	case 214:
 		replyTextIndex1 = 146;
 		_vm->_gameState = 0;
 		_vm->_roomEventNum = 2;
 		break;
-	case 218: case 219: case 220:
+	case 218:
+	case 219:
+	case 220:
 		replyTextIndex1 = 155;
 		replyTextIndex2 = 156;
 		replyTextIndex3 = 157;
@@ -3324,6 +3325,8 @@ void GameLogic::r7_handleVerbTalkTo() {
 	case kObjectIdProtesters7:
 		_vm->displayTextLines("c04r", 258, 250, 20, 2);
 		break;
+	default:
+		break;
 	}
 }
 
@@ -3428,7 +3431,7 @@ int GameLogic::r7_handleVerbOpen() {
 }
 
 int GameLogic::r7_handleVerbPush() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdCar7:
 		actionTextIndex = 7;
@@ -3441,7 +3444,7 @@ int GameLogic::r7_handleVerbPush() {
 }
 
 int GameLogic::r7_handleVerbPickUp() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdMagiciansCape:
 		_vm->pickupObject(kObjectIdMagiciansCape, _r7_flags, 1, kObjectIdInventoryCape);
@@ -3520,7 +3523,7 @@ void GameLogic::r7_uninitRoomAnimations() {
 
 void GameLogic::r7_updateRoomAnimations() {
 	if (_vm->isAnimationTimerExpired(0)) {
-		int cloudsPositionX = _vm->getAnimationTimerCounter(0) % 230;
+		const int cloudsPositionX = _vm->getAnimationTimerCounter(0) % 230;
 		_vm->drawAnimationSprite(2, 0, 0);
 		_vm->drawAnimationSpriteTransparent(0, cloudsPositionX - 125, 13);
 		_vm->drawAnimationSpriteTransparent(1, 0, 13);
@@ -3788,6 +3791,11 @@ bool GameLogic::r8_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		_vm->stopRoomAnimations();
 		_vm->_gameState = 1;
 		break;
+	case 477:
+	case 481:
+		_vm->_roomEventNum = 3;
+		replyTextIndex1 = 557;
+		break;
 	case 478:
 		_r8_flags &= ~0x08;
 		_vm->stopRoomAnimations();
@@ -3801,10 +3809,6 @@ bool GameLogic::r8_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		replyTextIndex1 = 556;
 		continueDialog = true;
 		break;
-	case 477: case 481:
-		_vm->_roomEventNum = 3;
-		replyTextIndex1 = 557;
-		break;
 	case 482:
 		replyTextIndex1 = 560;
 		continueDialog = true;
@@ -3818,7 +3822,9 @@ bool GameLogic::r8_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		continueDialog = true;
 		_vm->setDialogChoices(485, 486, 487, -1, -1);
 		break;
-	case 485: case 486: case 487:
+	case 485:
+	case 486:
+	case 487:
 		_vm->displayTextLines("c04r2", 26, 200, 30, 1);
 		_vm->displayTextLines("c04", 488, -1, -1, 7);
 		_vm->displayTextLines("c04r2", 27, 200, 30, 1);
@@ -3982,11 +3988,9 @@ void GameLogic::r8_openCloseCabinetDoor2(bool isOpen) {
 }
 
 int GameLogic::r9_handleVerbPickUp() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdEugene9:
-		actionTextIndex = 29;
-		break;
 	case kObjectIdMan9:
 		actionTextIndex = 29;
 		break;
@@ -4068,11 +4072,13 @@ void GameLogic::r9_handleVerbTalkTo() {
 			_vm->setDialogChoices(246, 253, 254, 249, 255);
 		}
 		break;
+	default:
+		break;
 	}
 }
 
 int GameLogic::r9_handleVerbPush() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdEugene9:
 		actionTextIndex = 5;
@@ -4122,11 +4128,14 @@ bool GameLogic::r9_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		replyTextY = 25;
 	}
 	switch (_vm->_selectedDialogChoice) {
-	case 232: case 234:
-		replyTextIndex1 = 178;
-		continueDialog = true;
+	case 187:
+	case 235:
+	case 250:
+	case 255:
+		_vm->_gameState = 0;
 		break;
-	case 231: case 240:
+	case 231:
+	case 240:
 		if (!(_pizzathonListFlags1 & 0x01)) {
 			_vm->setDialogChoices(236, 237, 238, 239, 187);
 			replyTextIndex1 = 177;
@@ -4141,14 +4150,19 @@ bool GameLogic::r9_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 			_vm->moveObjectToRoom(kObjectIdInventoryContract, 99);
 		}
 		break;
+	case 232:
+	case 234:
+		replyTextIndex1 = 178;
+		continueDialog = true;
+		break;
 	case 233:
 		replyTextIndex1 = 179;
 		continueDialog = true;
 		break;
-	case 187: case 235: case 250: case 255:
-		_vm->_gameState = 0;
-		break;
-	case 236: case 237: case 238: case 239:
+	case 236:
+	case 237:
+	case 238:
+	case 239:
 		replyTextIndex1 = _vm->_selectedDialogChoice + -56;
 		if (_r9_dialogFlag == 0) {
 			_vm->setDialogChoices(231, 232, 233, 234, 235);
@@ -4217,6 +4231,8 @@ bool GameLogic::r9_handleDialogSelect(int &replyTextX, int &replyTextY, int &rep
 		replyTextIndex2 = 209;
 		continueDialog = true;
 		break;
+	default:
+		break;
 	}
 	return continueDialog;
 }
@@ -4430,19 +4446,17 @@ int GameLogic::r10_handleVerbUse() {
 
 void GameLogic::r10_handleVerbTalkTo() {
 	_vm->_dialogChoices[0] = -1;
-	switch (_vm->_objectNumber) {
-	case kObjectIdSalesgirl:
+	if (_vm->_objectNumber == kObjectIdSalesgirl) {
 		if (_vm->isActorWayne()) {
 			_vm->setDialogChoices(0, 5, 2, 3, 4);
 		} else {
 			_vm->setDialogChoices(0, 1, 2, 3, 4);
 		}
-		break;
 	}
 }
 
 int GameLogic::r10_handleVerbPush() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdCigarettes:
 		actionTextIndex = 3;
@@ -4475,7 +4489,7 @@ int GameLogic::r10_handleVerbGive() {
 }
 
 int GameLogic::r10_handleVerbOpen() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdHotDogs:
 		actionTextIndex = 7;
@@ -4504,14 +4518,9 @@ bool GameLogic::r10_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 			continueDialog = false;
 		} else {
 			switch (_vm->_selectedDialogChoice) {
-			case 3:
-				replyTextIndex1 = 0;
-				break;
-			case 5:
-				replyTextIndex1 = 1;
-				replyTextIndex2 = 2;
-				break;
-			case 0: case 1: case 2:
+			case 0:
+			case 1:
+			case 2:
 				_r10_selectedItemToBuy = _vm->_selectedDialogChoice;
 				if (_vm->isActorWayne() && _vm->getWayneInventoryItemQuantity(kObjectIdInventoryDollar) == 0) {
 					_vm->setDialogChoices(8, -1, -1, -1, -1);
@@ -4523,10 +4532,18 @@ bool GameLogic::r10_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 				replyTextIndex1 = 3;
 				continueDialog = true;
 				break;
+			case 3:
+				replyTextIndex1 = 0;
+				break;
+			case 4:
+				_vm->_gameState = 0;
+				break;
+			case 5:
+				replyTextIndex1 = 1;
+				replyTextIndex2 = 2;
+				break;
 			case 6:
 				r10_buyItem();
-				// Fall-through
-			case 4:
 				_vm->_gameState = 0;
 				break;
 			case 8:
@@ -4706,7 +4723,7 @@ int GameLogic::r11_handleVerbUse() {
 }
 
 int GameLogic::r11_handleVerbPush() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdCar11:
 		actionTextIndex = 7;
@@ -4860,7 +4877,7 @@ void GameLogic::r11_usePlungersWithLampPost() {
 }
 
 int GameLogic::r12_handleVerbPickUp() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdExit12:
 		actionTextIndex = 7;
@@ -4944,6 +4961,8 @@ void GameLogic::r12_handleVerbTalkTo() {
 			_vm->displayTextLines("c04r", 360, 250, 20, 1);
 		}
 		break;
+	default:
+		break;
 	}
 }
 
@@ -4972,6 +4991,13 @@ bool GameLogic::r12_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 	replyTextX = 50;
 	replyTextY = 30;
 	switch (_vm->_selectedDialogChoice) {
+	case 187:
+	case 280:
+		if (_r12_talkObjectNumber == 207) {
+			_vm->playAnimation("lawyer", 4, -5, 55, 84, 0, 100);
+		}
+		_vm->_gameState = 0;
+		break;
 	case 269:
 		if (_r12_talkObjectNumber == 207) {
 			replyTextIndex1 = 224;
@@ -5001,13 +5027,9 @@ bool GameLogic::r12_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		}
 		continueDialog = true;
 		break;
-	case 187: case 280:
-		if (_r12_talkObjectNumber == 207) {
-			_vm->playAnimation("lawyer", 4, -5, 55, 84, 0, 100);
-		}
-		_vm->_gameState = 0;
-		break;
-	case 271: case 272: case 273:
+	case 271:
+	case 272:
+	case 273:
 		replyTextIndex1 = _vm->_selectedDialogChoice - 45;
 		_vm->setDialogChoices(269, 270, 187, -1, -1);
 		continueDialog = true;
@@ -5024,6 +5046,8 @@ bool GameLogic::r12_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		setPizzathonStatus(10);
 		r12_talkToLawyer();
 		break;
+	default:
+		break;
 	}
 	return continueDialog;
 }
@@ -5037,11 +5061,11 @@ void GameLogic::r12_refreshRoomBackground() {
 		_vm->setStaticRoomObjectPosition(12, 0, 0, -1, 69);
 		_vm->setStaticRoomObjectPosition(12, 2, 2, 198, 69);
 	} else {
-		int peopleIndex = _vm->getRandom(10) % 2;
+		const int peopleIndex = _vm->getRandom(10) % 2;
 		_vm->setStaticRoomObjectPosition(12, 0, 0, 214, 69);
 		_vm->setStaticRoomObjectPosition(12, 2, 2, -1, 69);
 		_vm->moveObjectToNowhere(kObjectIdCecil);
-		Common::String filename = Common::String::format("people%d.pcx", peopleIndex);
+		const Common::String filename = Common::String::format("people%d.pcx", peopleIndex);
 		_vm->drawRoomImageToBackground(filename.c_str(), 73, 81);
 		if (peopleIndex == 0) {
 			_vm->moveObjectToRoom(kObjectIdWoman, 12);
@@ -5153,7 +5177,7 @@ int GameLogic::r13_handleVerbUse() {
 }
 
 int GameLogic::r13_handleVerbPickUp() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdPieceOfPizza:
 		_vm->pickupObject(kObjectIdPieceOfPizza, _r13_flags, 1, kObjectIdInventoryCheesePizza);
@@ -5190,11 +5214,9 @@ int GameLogic::r13_handleVerbPickUp() {
 
 void GameLogic::r13_handleVerbTalkTo() {
 	_vm->_dialogChoices[0] = -1;
-	switch (_vm->_objectNumber) {
-	case kObjectIdPepe13:
+	if (_vm->_objectNumber == kObjectIdPepe13) {
 		_vm->walkTo(98, 84, 6, 101, 80);
 		_vm->setDialogChoices(183, 184, 185, 186, 187);
-		break;
 	}
 }
 
@@ -5278,11 +5300,13 @@ bool GameLogic::r13_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		continueDialog = true;
 		_vm->setDialogChoices(441, 442, 443, -1, -1);
 		break;
-	case 430: case 431:
+	case 430:
+	case 431:
 		replyTextIndex1 = _vm->_selectedDialogChoice + 43;
 		continueDialog = true;
 		break;
-	case 435: case 437:
+	case 435:
+	case 437:
 		replyTextIndex1 = 475;
 		continueDialog = true;
 		_vm->setDialogChoices(422, 423, 424, -1, -1);
@@ -5291,7 +5315,9 @@ bool GameLogic::r13_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		replyTextIndex1 = 476;
 		continueDialog = true;
 		break;
-	case 438: case 439: case 440:
+	case 438:
+	case 439:
+	case 440:
 		replyTextIndex1 = 477;
 		continueDialog = true;
 		_vm->setDialogChoices(422, 423, 424, -1, -1);
@@ -5313,11 +5339,15 @@ bool GameLogic::r13_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		_vm->setDialogChoices(445, 446, 447, -1, -1);
 		continueDialog = true;
 		break;
-	case 445: case 446: case 447:
+	case 445:
+	case 446:
+	case 447:
 		_vm->displayTextLines("c04r", 486, 160, 20, 1);
 		_vm->displayTextLines("c04", 448, -1, -1, 1);
 		_vm->_gameState = 0;
 		break;
+	default:
+		break;
 	}
 	return continueDialog;
 }
@@ -5475,7 +5505,7 @@ void GameLogic::r14_refreshRoomBackground() {
 }
 
 bool GameLogic::r15_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
-	bool continueDialog = false;
+	const bool continueDialog = false;
 	replyTextIndex3 = -1;
 	replyTextIndex2 = -1;
 	replyTextIndex1 = -1;
@@ -5491,6 +5521,8 @@ bool GameLogic::r15_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 	case 56:
 		replyTextIndex1 = 86;
 		break;
+	default:
+		break;
 	}
 	_vm->_gameState = 0;
 	return continueDialog;
@@ -5525,6 +5557,8 @@ void GameLogic::r17_handleVerbTalkTo() {
 	case kObjectIdGuard17_1:
 		_vm->setDialogChoices(300, 301, 302, 303, -1);
 		break;
+	default:
+		break;
 	}
 }
 
@@ -5576,7 +5610,9 @@ bool GameLogic::r17_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 	case 315:
 		_r17_dialogCtr = _r17_dialogCtr + 1;
 		// Fall-through
-	case 312: case 313: case 314:
+	case 312:
+	case 313:
+	case 314:
 		replyTextIndex1 = 307;
 		replyTextIndex2 = 308;
 		replyTextIndex3 = 309;
@@ -5586,7 +5622,9 @@ bool GameLogic::r17_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 	case 317:
 		_r17_dialogCtr = _r17_dialogCtr + 1;
 		// Fall-through
-	case 316: case 318: case 319:
+	case 316:
+	case 318:
+	case 319:
 		replyTextIndex1 = 310;
 		replyTextIndex2 = 311;
 		_vm->setDialogChoices(320, 321, 322, 323, -1);
@@ -5595,7 +5633,9 @@ bool GameLogic::r17_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 	case 322:
 		_r17_dialogCtr = _r17_dialogCtr + 1;
 		// Fall-through
-	case 320: case 321: case 323:
+	case 320:
+	case 321:
+	case 323:
 		replyTextIndex1 = 312;
 		replyTextIndex2 = 313;
 		_vm->setDialogChoices(324, 325, 326, 327, -1);
@@ -5604,7 +5644,9 @@ bool GameLogic::r17_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 	case 324:
 		_r17_dialogCtr = _r17_dialogCtr + 1;
 		// Fall-through
-	case 325: case 326: case 327:
+	case 325:
+	case 326:
+	case 327:
 		if (_r17_dialogCtr != 4) {
 			replyTextIndex1 = 314;
 			_vm->_gameState = 0;
@@ -5615,6 +5657,8 @@ bool GameLogic::r17_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 			_vm->_gameState = 0;
 		}
 		break;
+	default:
+		break;
 	}
 	return continueDialog;
 }
@@ -5716,7 +5760,9 @@ bool GameLogic::r19_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		}
 		continueDialog = true;
 		break;
-	case 260: case 264: case 268:
+	case 260:
+	case 264:
+	case 268:
 		_vm->_gameState = 0;
 		break;
 	case 261:
@@ -5749,17 +5795,23 @@ bool GameLogic::r19_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		_r19_flags |= 0x02;
 		continueDialog = true;
 		break;
-	case 449: case 450: case 451:
+	case 449:
+	case 450:
+	case 451:
 		replyTextIndex1 = _vm->_selectedDialogChoice + 40;
 		replyTextIndex2 = 492;
 		replyTextIndex3 = 493;
 		continueDialog = true;
 		_vm->setDialogChoices(453, 454, 455, 456, -1);
 		break;
-	case 452: case 460:
+	case 452:
+	case 460:
 		_vm->_gameState = 0;
 		break;
-	case 453: case 454: case 455: case 456:
+	case 453:
+	case 454:
+	case 455:
+	case 456:
 		_vm->displayTextLines("c04r", _vm->_selectedDialogChoice + 41, 300, 20, 1);
 		_vm->displayTextLines("c04r", 498, 300, 20, 4);
 		replyTextIndex1 = 502;
@@ -5836,6 +5888,8 @@ bool GameLogic::r19_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		continueDialog = true;
 		_vm->setDialogChoices(457, 458, 459, 460, -1);
 		break;
+	default:
+		break;
 	}
 	return continueDialog;
 }
@@ -5851,6 +5905,8 @@ void GameLogic::r19_handleVerbTalkTo() {
 		_vm->displayTextLines("c04r", 487, 300, 20, 2);
 		_vm->setDialogChoices(449, 450, 451, 452, -1);
 		break;
+	default:
+		break;
 	}
 }
 
@@ -6095,11 +6151,10 @@ void GameLogic::r24_refreshRoomBackground() {
 }
 
 void GameLogic::r24_climbLadder(int wayneX, int wayneLadderX, int wayneLadderY, int ladderTopY, int ceilingIndex) {
-	int garthClimbX = wayneX;
-	int garthLadderX = wayneLadderX + 20;
-	int ceilingX = wayneX - 10;
+	const int garthClimbX = wayneX;
+	const int garthLadderX = wayneLadderX + 20;
+	const int ceilingX = wayneX - 10;
 	Common::String tempFilename;
-	WWSurface *workBackground;
 	WWSurface *ceilingSprite;
 	WWSurface *wclimbSprites[4];
 	WWSurface *gclimbSprites[4];
@@ -6116,7 +6171,7 @@ void GameLogic::r24_climbLadder(int wayneX, int wayneLadderX, int wayneLadderY,
 		getladSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
-	workBackground = new WWSurface(320, 150);
+	WWSurface *workBackground = new WWSurface(320, 150);
 
 	if (_r24_mazeRoomNumber < 49) {
 		tempFilename = Common::String::format("ceil%d", ceilingIndex);
@@ -6185,7 +6240,7 @@ void GameLogic::r24_climbLadder(int wayneX, int wayneLadderX, int wayneLadderY,
 }
 
 void GameLogic::r24_useMazeHole(int holeIndex) {
-	int nextMazeRoom = kMazeInfos[_r24_mazeRoomNumber][holeIndex];
+	const int nextMazeRoom = kMazeInfos[_r24_mazeRoomNumber][holeIndex];
 	if (nextMazeRoom < 0) {
 		_r24_mazeHoleNumber = nextMazeRoom + 20;
 	} else {
@@ -6195,11 +6250,10 @@ void GameLogic::r24_useMazeHole(int holeIndex) {
 }
 
 void GameLogic::r24_handleRoomEvent(int wayneLadderX, int wayneX, int wayneLadderY, int ladderBottomY, int climbCtrMax, int ceilingIndex) {
-	int garthX = wayneLadderX;
-	int ceilingX = wayneLadderX - 10;
+	const int garthX = wayneLadderX;
+	const int ceilingX = wayneLadderX - 10;
 
 	Common::String tempFilename;
-	WWSurface *workBackground;
 	WWSurface *ceilingSprite;
 	WWSurface *wclimbSprites[4];
 	WWSurface *gclimbSprites[4];
@@ -6218,7 +6272,7 @@ void GameLogic::r24_handleRoomEvent(int wayneLadderX, int wayneX, int wayneLadde
 		getladSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
-	workBackground = new WWSurface(320, 150);
+	WWSurface *workBackground = new WWSurface(320, 150);
 
 	if (_r24_mazeRoomNumber < 49) {
 		tempFilename = Common::String::format("ceil%d", ceilingIndex);
@@ -6311,7 +6365,7 @@ int GameLogic::r25_handleVerbUse() {
 
 void GameLogic::r25_refreshRoomBackground() {
 	if (_r25_holeIndex != -1) {
-		Common::String holeFilename = Common::String::format("hole%d.pcx", _r25_holeIndex % 2);
+		const Common::String holeFilename = Common::String::format("hole%d.pcx", _r25_holeIndex % 2);
 		_vm->drawRoomImageToBackground(holeFilename.c_str(), kRoom25MazeHolePositionsX[_r25_holeIndex], kRoom25MazeHolePositionsY[_r25_holeIndex]);
 	}
 	_vm->setWaynePosition(150, 125);
@@ -6331,30 +6385,32 @@ void GameLogic::r25_updateMazeRoomHole(int mazeRoomNumber) {
 	case 31:
 		_r25_holeIndex = -1;
 		break;
-	case 23:
-		_vm->moveObjectToRoom(kObjectIdOpening_7, 25);
-		_r25_holeIndex = 0;
+	case 11:
+		_vm->moveObjectToRoom(kObjectIdOpening_11, 27);
+		_r25_holeIndex = 4;
 		break;
 	case 17:
 		_vm->moveObjectToRoom(kObjectIdOpening_8, 25);
 		_r25_holeIndex = 1;
 		break;
-	case 47:
-		_vm->moveObjectToRoom(kObjectIdOpening_9, 26);
-		_r25_holeIndex = 2;
-		break;
 	case 20:
 		_vm->moveObjectToRoom(kObjectIdOpening_10, 26);
 		_r25_holeIndex = 3;
 		break;
-	case 11:
-		_vm->moveObjectToRoom(kObjectIdOpening_11, 27);
-		_r25_holeIndex = 4;
+	case 23:
+		_vm->moveObjectToRoom(kObjectIdOpening_7, 25);
+		_r25_holeIndex = 0;
 		break;
 	case 40:
 		_vm->moveObjectToRoom(kObjectIdOpening_12, 27);
 		_r25_holeIndex = 5;
 		break;
+	case 47:
+		_vm->moveObjectToRoom(kObjectIdOpening_9, 26);
+		_r25_holeIndex = 2;
+		break;
+	default:
+		break;
 	}
 }
 
@@ -6379,17 +6435,26 @@ bool GameLogic::r28_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 	replyTextX = 150;
 	replyTextY = 10;
 	switch (_vm->_selectedDialogChoice) {
-	case 18: case 19: case 20: case 21:
+	case 18:
+	case 19:
+	case 20:
+	case 21:
 		replyTextIndex1 = 35;
 		_vm->setDialogChoices(22, 23, 24, 25, 26);
 		continueDialog = true;
 		break;
-	case 22: case 23: case 24: case 25: case 26:
+	case 22:
+	case 23:
+	case 24:
+	case 25:
+	case 26:
 		replyTextIndex1 = 36;
 		replyTextIndex2 = 37;
 		_vm->_roomEventNum = 2;
 		_vm->_gameState = 0;
 		break;
+	default:
+		break;
 	}
 	return continueDialog;
 }
@@ -6607,6 +6672,15 @@ bool GameLogic::r30_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 	replyTextX = 150;
 	replyTextY = 40;
 	switch (_vm->_selectedDialogChoice) {
+	case 52:
+	case 361:
+	case 362:
+	case 363:
+		_vm->displayTextLines("c04r", 385, 160, 40, 6);
+		_vm->displayTextLines("c04", 364, -1, -1, 1);
+		_vm->_roomEventNum = 2;
+		_vm->_gameState = 0;
+		break;
 	case 343:
 		replyTextIndex1 = 367;
 		_vm->setDialogChoices(347, 348, 349, -1, -1);
@@ -6647,7 +6721,8 @@ bool GameLogic::r30_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		_vm->setDialogChoices(358, 359, 360, -1, -1);
 		continueDialog = true;
 		break;
-	case 356: case 357:
+	case 356:
+	case 357:
 		replyTextIndex1 = _vm->_selectedDialogChoice + 23;
 		continueDialog = true;
 		break;
@@ -6665,11 +6740,7 @@ bool GameLogic::r30_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		replyTextIndex2 = 384;
 		continueDialog = true;
 		break;
-	case 52: case 361: case 362: case 363:
-		_vm->displayTextLines("c04r", 385, 160, 40, 6);
-		_vm->displayTextLines("c04", 364, -1, -1, 1);
-		_vm->_roomEventNum = 2;
-		_vm->_gameState = 0;
+	default:
 		break;
 	}
 	return continueDialog;
@@ -6803,7 +6874,7 @@ int GameLogic::r31_handleVerbUse() {
 }
 
 bool GameLogic::r31_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
-	bool continueDialog = false;
+	const bool continueDialog = false;
 	replyTextIndex3 = -1;
 	replyTextIndex2 = -1;
 	replyTextIndex1 = -1;
@@ -6929,7 +7000,7 @@ void GameLogic::r31_handleRoomEvent4() {
 		_vm->refreshActors();
 
 		// Give the player some time to press the buzzer by clicking the mouse
-		uint32 timeOutTicks = _vm->_system->getMillis() + (uint32)_vm->getRandom(1300) + 200;
+		const uint32 timeOutTicks = _vm->_system->getMillis() + (uint32)_vm->getRandom(1300) + 200;
 		while (_vm->_system->getMillis() < timeOutTicks && _vm->_mouseClickButtons == 0 && !_vm->shouldQuit()) {
 			_vm->updateEvents();
 			_vm->_system->updateScreen();
@@ -7077,22 +7148,22 @@ void GameLogic::r31_runBabeoff() {
 }
 
 void GameLogic::r31_drawCurrentPlayerScore() {
-	int numberX = kRoom31NumberPositionsX[_r31_currentPlayer];
-	int numberY = kRoom31NumberPositionsY[_r31_currentPlayer];
-	int score = _r31_scores[_r31_currentPlayer];
+	const int numberX = kRoom31NumberPositionsX[_r31_currentPlayer];
+	const int numberY = kRoom31NumberPositionsY[_r31_currentPlayer];
+	const int score = _r31_scores[_r31_currentPlayer];
 	if (score > 99) {
-		Common::String numberFilename = Common::String::format("n%d.pcx", score / 100);
+		const Common::String numberFilename = Common::String::format("n%d.pcx", score / 100);
 		_vm->drawRoomImageToBackground(numberFilename.c_str(), numberX, numberY);
 	} else {
 		_vm->_backgroundSurface->fillRect(numberX, numberY, numberX + 3, numberY + 6, 0);
 	}
 	if (score > 9) {
-		Common::String numberFilename = Common::String::format("n%d.pcx", (score % 100) / 10);
+		const Common::String numberFilename = Common::String::format("n%d.pcx", (score % 100) / 10);
 		_vm->drawRoomImageToBackground(numberFilename.c_str(), numberX + 5, numberY);
 	} else {
 		_vm->_backgroundSurface->fillRect(numberX + 5, numberY, numberX + 8, numberY + 6, 0);
 	}
-	Common::String numberFilename = Common::String::format("n%d.pcx", score % 10);
+	const Common::String numberFilename = Common::String::format("n%d.pcx", score % 10);
 	_vm->drawRoomImageToBackground(numberFilename.c_str(), numberX + 10, numberY);
 	_vm->refreshActors();
 }
@@ -7189,8 +7260,7 @@ int GameLogic::r32_handleVerbUse() {
 
 void GameLogic::r32_handleVerbTalkTo() {
 	_vm->_dialogChoices[0] = -1;
-	switch (_vm->_objectNumber) {
-	case kObjectIdJanitor:
+	if (_vm->_objectNumber == kObjectIdJanitor) {
 		if (_r32_flags & 0x04) {
 			_vm->displayTextLines("c04", 419, -1, -1, 1);
 		} else {
@@ -7198,12 +7268,11 @@ void GameLogic::r32_handleVerbTalkTo() {
 			_vm->drawRoomImageToBackground("jtalk1.pcx", 262, 84);
 			_vm->setDialogChoices(402, 403, 404, 405, 406);
 		}
-		break;
 	}
 }
 
 int GameLogic::r32_handleVerbOpen() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdDoor32_0:
 	case kObjectIdDoor32_1:
@@ -7224,7 +7293,8 @@ bool GameLogic::r32_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 	replyTextX = 200;
 	replyTextY = 30;
 	switch (_vm->_selectedDialogChoice) {
-	case 402: case 405:
+	case 402:
+	case 405:
 		replyTextIndex1 = _vm->_selectedDialogChoice + 35;
 		continueDialog = true;
 		break;
@@ -7246,21 +7316,15 @@ bool GameLogic::r32_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		r32_initRoomAnimations();
 		_vm->_gameState = 0;
 		break;
-	case 407: case 408: case 409: case 410: case 415:
+	case 407:
+	case 408:
+	case 409:
+	case 410:
+	case 415:
 		replyTextIndex1 = _vm->_selectedDialogChoice + 34;
 		continueDialog = true;
 		_vm->setDialogChoices(402, 403, 404, 405, 406);
 		break;
-	case 417: case 418:
-		replyTextIndex1 = _vm->_selectedDialogChoice + 33;
-		continueDialog = true;
-		_vm->setDialogChoices(402, 403, 404, 405, 406);
-		break;
-	case 416:
-		replyTextIndex1 = 442;
-		continueDialog = true;
-		_vm->setDialogChoices(402, 403, 404, 405, 406);
-		break;
 	case 411:
 		replyTextIndex1 = 445;
 		continueDialog = true;
@@ -7280,6 +7344,19 @@ bool GameLogic::r32_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		continueDialog = true;
 		_vm->setDialogChoices(402, 403, 404, 405, 406);
 		break;
+	case 416:
+		replyTextIndex1 = 442;
+		continueDialog = true;
+		_vm->setDialogChoices(402, 403, 404, 405, 406);
+		break;
+	case 417:
+	case 418:
+		replyTextIndex1 = _vm->_selectedDialogChoice + 33;
+		continueDialog = true;
+		_vm->setDialogChoices(402, 403, 404, 405, 406);
+		break;
+	default:
+		break;
 	}
 	return continueDialog;
 }
@@ -7410,8 +7487,7 @@ int GameLogic::r34_handleVerbUse() {
 
 void GameLogic::r34_handleVerbTalkTo() {
 	_vm->_dialogChoices[0] = -1;
-	switch (_vm->_objectNumber) {
-	case kObjectIdMan34:
+	if (_vm->_objectNumber == kObjectIdMan34) {
 		_vm->playAnimation("mantalk", 0, 1, 198, 68, 0, 1);
 		r34_uninitRoomAnimations();
 		_vm->displayTextLines("c04r", 279, 275, 30, 1);
@@ -7420,7 +7496,6 @@ void GameLogic::r34_handleVerbTalkTo() {
 		} else {
 			_vm->setDialogChoices(291, 292, 293, 295, -1);
 		}
-		break;
 	}
 }
 
@@ -7490,6 +7565,8 @@ bool GameLogic::r34_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 		r34_initRoomAnimations();
 		_vm->_gameState = 0;
 		break;
+	default:
+		break;
 	}
 	return continueDialog;
 }
@@ -7560,11 +7637,8 @@ int GameLogic::r35_handleVerbUse() {
 
 void GameLogic::r35_handleVerbTalkTo() {
 	_vm->_dialogChoices[0] = -1;
-	switch (_vm->_objectNumber) {
-	case kObjectIdCassandra35:
+	if (_vm->_objectNumber == kObjectIdCassandra35)
 		r35_talkToCassandra();
-		break;
-	}
 }
 
 bool GameLogic::r35_handleDialogSelect(int &replyTextX, int &replyTextY, int &replyTextIndex1, int &replyTextIndex2, int &replyTextIndex3) {
@@ -7575,7 +7649,9 @@ bool GameLogic::r35_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 	replyTextX = 150;
 	replyTextY = 20;
 	switch (_vm->_selectedDialogChoice) {
-	case 328: case 329: case 330:
+	case 328:
+	case 329:
+	case 330:
 		for (int textIndex = 323; textIndex < 326; textIndex++) {
 			_vm->playAnimationLoops("cass", 0, 2, 179, 68, 0, 100, 4);
 			_vm->displayTextLines("c04r", textIndex, replyTextX, replyTextY, 1);
@@ -7637,6 +7713,8 @@ bool GameLogic::r35_handleDialogSelect(int &replyTextX, int &replyTextY, int &re
 	case 340:
 		_vm->_gameState = 0;
 		break;
+	default:
+		break;
 	}
 	return continueDialog;
 }
@@ -7759,7 +7837,7 @@ void GameLogic::r36_handleRoomEvent() {
 }
 
 int GameLogic::r37_handleVerbPickUp() {
-	int actionTextIndex = -1;
+	int actionTextIndex;
 	switch (_vm->_objectNumber) {
 	case kObjectIdMoney:
 		_vm->pickupObject(kObjectIdMoney, _r37_flags, 16, kObjectIdInventory50000);
@@ -7844,7 +7922,7 @@ void GameLogic::r37_refreshRoomBackground() {
 		_vm->_roomEventNum = 1;
 	}
 	if (!(_r37_flags & 0x04)) {
-		Common::String lockFilename = Common::String::format("lock%d.pcx", _r37_safeCombinationLockIndex);
+		const Common::String lockFilename = Common::String::format("lock%d.pcx", _r37_safeCombinationLockIndex);
 		_vm->drawRoomImageToBackground(lockFilename.c_str(), 109, 97);
 	} else {
 		_vm->drawRoomImageToBackground("opensafe.pcx", 92, 84);
@@ -7859,7 +7937,6 @@ void GameLogic::r37_refreshRoomBackground() {
 
 void GameLogic::r37_climbExitLadderUp() {
 	Common::String tempFilename;
-	WWSurface *workBackground;
 	WWSurface *wclimbSprites[4];
 	WWSurface *gclimbSprites[4];
 	WWSurface *getldrSprites[3];
@@ -7875,7 +7952,7 @@ void GameLogic::r37_climbExitLadderUp() {
 		getldrSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 	
-	workBackground = new WWSurface(320, 150);
+	WWSurface *workBackground = new WWSurface(320, 150);
 
 	for (int index = 0; index < 3; index++) {
 		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
@@ -7937,7 +8014,6 @@ void GameLogic::r37_climbExitLadderUp() {
 void GameLogic::r37_climbLadderDown() {
 	Common::String tempFilename;
 
-	WWSurface *workBackground;
 	WWSurface *wclimbSprites[4];
 	WWSurface *gclimbSprites[4];
 	WWSurface *wgetldlSprites[3];
@@ -7958,7 +8034,7 @@ void GameLogic::r37_climbLadderDown() {
 		ggetldlSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
-	workBackground = new WWSurface(320, 150);
+	WWSurface *workBackground = new WWSurface(320, 150);
 
 	for (int index = 0; index < 3; index++) {
 		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
@@ -8046,7 +8122,6 @@ void GameLogic::r37_climbLadderDown() {
 
 void GameLogic::r37_climbLadderUp() {
 	Common::String tempFilename;
-	WWSurface *workBackground;
 	WWSurface *wclimbSprites[4];
 	WWSurface *gclimbSprites[4];
 	WWSurface *wgetldlSprites[3];
@@ -8067,7 +8142,7 @@ void GameLogic::r37_climbLadderUp() {
 		ggetldlSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
-	workBackground = new WWSurface(320, 150);
+	WWSurface *workBackground = new WWSurface(320, 150);
 
 	for (int index = 0; index < 3; index++) {
 		workBackground->drawSurface(_vm->_backgroundSurface, 0, 0);
@@ -8196,7 +8271,6 @@ void GameLogic::r37_pullHandle() {
 
 void GameLogic::r37_climbEnterLadderDown() {
 	Common::String tempFilename;
-	WWSurface *workBackground;
 	WWSurface *wclimbSprites[4];
 	WWSurface *gclimbSprites[4];
 	WWSurface *getldrSprites[3];
@@ -8214,7 +8288,7 @@ void GameLogic::r37_climbEnterLadderDown() {
 		getldrSprites[index] = roomLib->loadRoomSurface(tempFilename.c_str());
 	}
 
-	workBackground = new WWSurface(320, 150);
+	WWSurface *workBackground = new WWSurface(320, 150);
 
 	int climbCtr = 0, wayneLadderY = -46, garthLadderY = -46;
 	while (climbCtr < 24) {
@@ -8295,8 +8369,6 @@ int GameLogic::r38_handleVerbUse() {
 		actionTextIndex = 77;
 		break;
 	case kObjectIdPipes:
-		actionTextIndex = 7;
-		break;
 	case kObjectIdRag:
 		actionTextIndex = 7;
 		break;


Commit: b40d3b91264f71c4a3c4b8f0998e1f16f07fe1f1
    https://github.com/scummvm/scummvm/commit/b40d3b91264f71c4a3c4b8f0998e1f16f07fe1f1
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:56+01:00

Commit Message:
WAYNESWORLD: start the implementation of the intro

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index f51dd022eb9..a8d4de3a7e7 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -67,10 +67,129 @@ WaynesWorldEngine::~WaynesWorldEngine() {
 
 }
 
-Common::Error WaynesWorldEngine::run() {
+bool WaynesWorldEngine::introPt1() {
+	static int16 array1[] = {179, 179, 181, 183, 186, 189, 192, 198, 208, 212, 217, 223, 234, 233, 236, 240, 241, 238, 238, 238, 225, 218, 218, 192, 164, 133, 103, 87};
+	static int16 array2[] = {97, 97, 98, 98, 97, 96, 94, 91, 88, 85, 84, 82, 81, 78, 76, 76, 75, 74, 72, 72, 71, 69, 68, 68, 67, 67, 66, 68};
+	static int16 array3[] = {80, 80, 69, 37, 0, 0, 0, 0};
+	static int16 array4[] = {67, 67, 64, 54, 41, 27, 27, 27};
 
-	_isSaveAllowed = false;
+	GxlArchive *oa2Gxl = new GxlArchive("oa2");
+	loadPalette(oa2Gxl, "paramnt.pcx");
+
+	_musicIndex = 0;
+	changeMusic();
+
+	// "Paramount" background
+	drawImageToScreen(oa2Gxl, "paramnt.pcx", 0, 0);
+	waitSeconds(1);
+
+	WWSurface *paramaSprite = new WWSurface(190, 112);
+	// "And" animation
+	drawImageToSurface(oa2Gxl, "parama.pcx", paramaSprite, 0, 0);
+	drawRandomEffect(paramaSprite, 66, 30, 2, 2);
+	delete paramaSprite;
+
+	waitSeconds(2);
+
+	paletteFadeOut(0, 256, 6);
+
+	loadPalette(oa2Gxl, "backg.pcx");
+	drawImageToScreen(oa2Gxl, "backg.pcx", 0, 0);
+
+	// "Capstone logo" animation
+	for (int i = 1; i < 29; ++i) {
+		Common::String filename = Common::String::format("cap%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), array1[i - 1], array2[i - 1]);
+		waitMillis(30);
+	}
+	waitSeconds(1);
+
+	// "The pinnacle of entertainment software" animation
+	for (int i = 1; i < 10; ++i) {
+		Common::String filename = Common::String::format("txt%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), 0, 138);
+		waitMillis(30);
+	}
+	waitSeconds(1);
+
+	// Shining "Capstone" animation
+	for (int i = 1; i < 12; ++i) {
+		Common::String filename = Common::String::format("captxt%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), 113, 89);
+		waitMillis(30);
+	}
+	waitSeconds(1);
+
+	// Removing "The pinnacle of entertainment software" animation
+	for (int i = 9; i > 0; --i) {
+		Common::String filename = Common::String::format("txt%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), 0, 138);
+		waitMillis(30);
+	}
+	waitSeconds(1);
+
+	drawImageToScreen(oa2Gxl, "txtbkg.pcx", 0, 138);
+	waitMillis(30);
+	waitSeconds(1);
+
+	for (int i = 1; i < 7; ++i) {
+		Common::String filename = Common::String::format("capsp%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), 76, 66);
+		waitMillis(30);
+	}
+
+	for (int i = 1; i < 12; ++i) {
+		Common::String filename = Common::String::format("presnt%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), 117, 112);
+		waitMillis(60);
+	}
+
+	for (int i = 1; i < 9; ++i) {
+		Common::String filename = Common::String::format("capawy%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), array3[i - 1], array4[i - 1]);
+		waitMillis(30);
+	}
+
+	delete oa2Gxl;
+
+	// TODO add a check at each step to return false if ESC is pressed
+	return true;
+}
+
+bool WaynesWorldEngine::introPt2() {
+	paletteFadeOut(0, 256, 64);
 
+	GxlArchive *oanGxl = new GxlArchive("oa2");
+	loadPalette(oanGxl, "backg2.pcx");
+	_demoPt2Surface = new WWSurface(320, 200);
+	_midi->stopSong();
+
+	// TODO add a check at each step to return false if ESC is pressed
+	return true;
+}
+
+bool WaynesWorldEngine::introPt3(bool flag) {
+	// sub1
+	
+	
+	// TODO add a check at each step to return false if ESC is pressed
+	return true;
+}
+
+void WaynesWorldEngine::runIntro() {
+	if (!introPt1())
+		return;
+
+	if (!introPt2())
+		return;
+
+	if (!introPt3(false))
+		return;
+}
+
+Common::Error WaynesWorldEngine::run() {
+	_isSaveAllowed = false;	
+	
 	for (uint i = 0; i < kRoomAnimationsCount; i++)
 		_roomAnimations[i] = nullptr;
 
@@ -84,6 +203,12 @@ Common::Error WaynesWorldEngine::run() {
 	_inventorySprite = new WWSurface(312, 52);
 	_walkMap = new byte[kWalkMapSize];
 	_backgroundScrollSurface = nullptr;
+	_sound = new SoundManager(this, _mixer);
+	_midi = new MusicManager(this);
+
+	syncSoundSettings();
+
+	runIntro();
 
 	_fontWW = new GFTFont();
 	_fontWWInv = new GFTFont();
@@ -134,11 +259,6 @@ Common::Error WaynesWorldEngine::run() {
 	_currentMapItemIndex = -1;
 	_musicIndex = 0;
 	
-	_sound = new SoundManager(this, _mixer);
-	_midi = new MusicManager(this);
-
-	syncSoundSettings();
-
 	loadMainActorSprites();
 
 	initRoomObjects();
@@ -677,6 +797,8 @@ void WaynesWorldEngine::playSound(const char *filename, int flag) {
 void WaynesWorldEngine::changeMusic() {
 	if (!_isMusicEnabled)
 		return;
+
+	_midi->stopSong();
 	
 	switch (_musicIndex) {
 	case 0:
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 6a370028766..4c905e94b5c 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -115,6 +115,11 @@ private:
 #ifdef USE_TRANSLATION
 	Common::String _oldGUILanguage;
 #endif
+	bool introPt1();
+	bool introPt2();
+	bool introPt3(bool flag);
+	
+	WWSurface *_demoPt2Surface = nullptr;
 
 public:
 	Common::RandomSource *_random;
@@ -231,6 +236,8 @@ public:
 	int _gameMapDestinationRoomNum;
 	bool _gameMapFlag;
 
+	void runIntro();
+
 	// Utils
 	int getRandom(int max);
 	void waitMillis(uint millis);


Commit: d399053e9e44948f3b7b84c4cbc5c35b83afcbca
    https://github.com/scummvm/scummvm/commit/d399053e9e44948f3b7b84c4cbc5c35b83afcbca
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:56+01:00

Commit Message:
WAYNESWORLD: Improve sound rate (empiric approach, using a timer, + confirmation by assembly)

Changed paths:
    engines/waynesworld/sound.cpp


diff --git a/engines/waynesworld/sound.cpp b/engines/waynesworld/sound.cpp
index c7db9899038..ba11febc87a 100644
--- a/engines/waynesworld/sound.cpp
+++ b/engines/waynesworld/sound.cpp
@@ -56,7 +56,7 @@ void SoundManager::playSound(const char *filename, int flag) {
 	fd.read(buffer, size);
 
 	Common::SeekableReadStream *rawStream = new Common::MemoryReadStream(buffer, size, DisposeAfterUse::YES);
-	Audio::RewindableAudioStream *audioStream = Audio::makeRawStream(rawStream, 8000, Audio::FLAG_UNSIGNED);
+	Audio::RewindableAudioStream *audioStream = Audio::makeRawStream(rawStream, 9000, Audio::FLAG_UNSIGNED);
 
 /*	
 	if (loop)


Commit: 79062f5b1325930eb6db54dcfb6de58052c5bf9c
    https://github.com/scummvm/scummvm/commit/79062f5b1325930eb6db54dcfb6de58052c5bf9c
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:56+01:00

Commit Message:
WAYNESWORLD: Add intro part 3

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index a8d4de3a7e7..a21eeda223c 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -159,8 +159,8 @@ bool WaynesWorldEngine::introPt1() {
 bool WaynesWorldEngine::introPt2() {
 	paletteFadeOut(0, 256, 64);
 
-	GxlArchive *oanGxl = new GxlArchive("oa2");
-	loadPalette(oanGxl, "backg2.pcx");
+	_oanGxl = new GxlArchive("oan");
+	loadPalette(_oanGxl, "backg2.pcx");
 	_demoPt2Surface = new WWSurface(320, 200);
 	_midi->stopSong();
 
@@ -168,10 +168,120 @@ bool WaynesWorldEngine::introPt2() {
 	return true;
 }
 
+void WaynesWorldEngine::wwEffect(int arg0, int arg1, bool flag) {
+	int xmult = 0;
+	int ymult = 0;
+
+	switch (arg0) {
+	case 1:
+		xmult = 10;
+		ymult = 7;
+		break;
+	case 2:
+		xmult = 0;
+		ymult = 7;
+		break;
+	case 3:
+		xmult = -10;
+		ymult = 7;
+		break;
+	case 4:
+		xmult = -10;
+		ymult = 0;
+		break;
+	case 5:
+		xmult = -10;
+		ymult = -7;
+		break;
+	case 6:
+		xmult = 0;
+		ymult = -7;
+		break;
+	case 7:
+		xmult = 10;
+		ymult = -7;
+		break;
+	case 8:
+		xmult = 10;
+		ymult = 0;
+		break;
+	default:
+		break;
+	}
+
+	_demoPt2Surface->clear(0);
+	if (flag) {
+		_demoPt2Surface->drawSurface(_backg2Surface, 0, 15);
+	}
+
+	for (int i = 4; i > 0; --i) {
+		if (i <= arg1) {
+			_demoPt2Surface->drawSurfaceTransparent(_outlineSurface, (i * xmult) + 47, (i * ymult) + 25);
+		}
+	}
+
+	_demoPt2Surface->drawSurfaceTransparent(_logoSurface, 47, 25);
+	_screen->drawSurface(_demoPt2Surface, 0, 0);
+
+	// Added for better results
+	waitMillis(200);
+}
+
 bool WaynesWorldEngine::introPt3(bool flag) {
 	// sub1
-	
-	
+	_backg2Surface = new WWSurface(320, 170);
+	_logoSurface = new WWSurface(226, 134);
+	_outlineSurface = new WWSurface(226, 134);
+
+	drawImageToSurface(_oanGxl, "backg2.pcx", _backg2Surface, 0, 0);
+	drawImageToSurface(_oanGxl, "logo.pcx", _logoSurface, 0, 0);
+	drawImageToSurface(_oanGxl, "outline.pcx", _outlineSurface, 0, 0);
+	// End of sub1
+
+	wwEffect(1, 0, flag);
+
+	if (flag)
+		waitSeconds(1);
+
+	_sound->playSound("sv42.snd", false);
+	wwEffect(1, 1, flag);
+	wwEffect(1, 2, flag);
+	wwEffect(1, 3, flag);
+
+	byte newColor[3] = {0, 0, 0};
+	static byte rArr[] = { 9,  9,  9,  9, 43, 43, 53, 63, 63, 63, 63, 63, 63, 63, 45, 28,  9,  9,  9};
+	static byte gArr[] = {33, 33, 40, 47, 47, 47, 47, 47, 35, 23,  0,  0,  0,  0,  0,  0,  0, 33, 33};
+	static byte bArr[] = {29, 20, 20, 20, 20,  0,  0,  0,  0,  0,  0, 23, 37, 50, 50, 50, 50, 50, 40};
+
+	for (int i = 0; i < 32; ++i) {
+		const int index = (i % 19);
+		newColor[0] = rArr[index] * 4;
+		newColor[1] = gArr[index] * 4;
+		newColor[2] = bArr[index] * 4;
+
+		g_system->getPaletteManager()->setPalette((const byte *)&newColor, 236, 1);
+		wwEffect((i % 8) + 1, 4, flag);
+	}
+
+	wwEffect(1, 3, flag);
+	wwEffect(1, 2, flag);
+	wwEffect(1, 1, flag);
+	wwEffect(1, 0, flag);
+
+	while (_sound->isSFXPlaying())
+		waitMillis(30);
+
+	_sound->playSound("sv16.snd", false);
+
+	while (_sound->isSFXPlaying())
+		waitMillis(30);
+
+	waitSeconds(1);
+
+	delete _outlineSurface;
+	delete _logoSurface;
+	delete _backg2Surface;
+
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
@@ -179,10 +289,8 @@ bool WaynesWorldEngine::introPt3(bool flag) {
 void WaynesWorldEngine::runIntro() {
 	if (!introPt1())
 		return;
-
 	if (!introPt2())
 		return;
-
 	if (!introPt3(false))
 		return;
 }
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 4c905e94b5c..55e9e2cf5f8 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -115,11 +115,18 @@ private:
 #ifdef USE_TRANSLATION
 	Common::String _oldGUILanguage;
 #endif
+	void wwEffect(int arg0, int arg1, bool flag);
+	
 	bool introPt1();
 	bool introPt2();
 	bool introPt3(bool flag);
 	
 	WWSurface *_demoPt2Surface = nullptr;
+	WWSurface *_backg2Surface = nullptr;
+	WWSurface *_logoSurface = nullptr;
+	WWSurface *_outlineSurface = nullptr;
+
+	GxlArchive *_oanGxl = nullptr;
 
 public:
 	Common::RandomSource *_random;


Commit: d37260f1bb57f803fb9dd9668abdd354fb2fc6c2
    https://github.com/scummvm/scummvm/commit/d37260f1bb57f803fb9dd9668abdd354fb2fc6c2
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:56+01:00

Commit Message:
WAYNESWORLD: Remove a delay in introPt1, move intro code to a separate source

Changed paths:
  A engines/waynesworld/intro.cpp
    engines/waynesworld/module.mk
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
new file mode 100644
index 00000000000..a34d2d5440d
--- /dev/null
+++ b/engines/waynesworld/intro.cpp
@@ -0,0 +1,260 @@
+/* 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "waynesworld/waynesworld.h"
+#include "waynesworld/graphics.h"
+#include "waynesworld/gxlarchive.h"
+
+#include "audio/audiostream.h"
+#include "graphics/paletteman.h"
+
+namespace WaynesWorld {
+
+void WaynesWorldEngine::runIntro() {
+	if (!introPt1())
+		return;
+	if (!introPt2())
+		return;
+	if (!introPt3(false))
+		return;
+}
+
+bool WaynesWorldEngine::introPt1() {
+	static int16 array1[] = {179, 179, 181, 183, 186, 189, 192, 198, 208, 212, 217, 223, 234, 233, 236, 240, 241, 238, 238, 238, 225, 218, 218, 192, 164, 133, 103, 87};
+	static int16 array2[] = {97, 97, 98, 98, 97, 96, 94, 91, 88, 85, 84, 82, 81, 78, 76, 76, 75, 74, 72, 72, 71, 69, 68, 68, 67, 67, 66, 68};
+	static int16 array3[] = {80, 80, 69, 37, 0, 0, 0, 0};
+	static int16 array4[] = {67, 67, 64, 54, 41, 27, 27, 27};
+
+	GxlArchive *oa2Gxl = new GxlArchive("oa2");
+	loadPalette(oa2Gxl, "paramnt.pcx");
+
+	_musicIndex = 0;
+	changeMusic();
+
+	// "Paramount" background
+	drawImageToScreen(oa2Gxl, "paramnt.pcx", 0, 0);
+	waitSeconds(1);
+
+	WWSurface *paramaSprite = new WWSurface(190, 112);
+	// "And" animation
+	drawImageToSurface(oa2Gxl, "parama.pcx", paramaSprite, 0, 0);
+	drawRandomEffect(paramaSprite, 66, 30, 2, 2);
+	delete paramaSprite;
+
+	waitSeconds(2);
+
+	paletteFadeOut(0, 256, 6);
+
+	loadPalette(oa2Gxl, "backg.pcx");
+	drawImageToScreen(oa2Gxl, "backg.pcx", 0, 0);
+
+	// "Capstone logo" animation
+	for (int i = 1; i < 29; ++i) {
+		Common::String filename = Common::String::format("cap%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), array1[i - 1], array2[i - 1]);
+		waitMillis(30);
+	}
+	waitSeconds(1);
+
+	// "The pinnacle of entertainment software" animation
+	for (int i = 1; i < 10; ++i) {
+		Common::String filename = Common::String::format("txt%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), 0, 138);
+		waitMillis(30);
+	}
+	waitSeconds(1);
+
+	// Shining "Capstone" animation
+	for (int i = 1; i < 12; ++i) {
+		Common::String filename = Common::String::format("captxt%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), 113, 89);
+		waitMillis(30);
+	}
+	waitSeconds(1);
+
+	// Removing "The pinnacle of entertainment software" animation
+	for (int i = 9; i > 0; --i) {
+		Common::String filename = Common::String::format("txt%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), 0, 138);
+		waitMillis(30);
+	}
+
+	drawImageToScreen(oa2Gxl, "txtbkg.pcx", 0, 138);
+	waitMillis(30);
+	waitSeconds(1);
+
+	for (int i = 1; i < 7; ++i) {
+		Common::String filename = Common::String::format("capsp%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), 76, 66);
+		waitMillis(30);
+	}
+
+	for (int i = 1; i < 12; ++i) {
+		Common::String filename = Common::String::format("presnt%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), 117, 112);
+		waitMillis(60);
+	}
+
+	for (int i = 1; i < 9; ++i) {
+		Common::String filename = Common::String::format("capawy%02d.pcx", i);
+		drawImageToScreen(oa2Gxl, filename.c_str(), array3[i - 1], array4[i - 1]);
+		waitMillis(30);
+	}
+
+	delete oa2Gxl;
+
+	// TODO add a check at each step to return false if ESC is pressed
+	return true;
+}
+
+bool WaynesWorldEngine::introPt2() {
+	paletteFadeOut(0, 256, 64);
+
+	_oanGxl = new GxlArchive("oan");
+	loadPalette(_oanGxl, "backg2.pcx");
+	_demoPt2Surface = new WWSurface(320, 200);
+	_midi->stopSong();
+
+	// TODO add a check at each step to return false if ESC is pressed
+	return true;
+}
+
+void WaynesWorldEngine::wwEffect(int arg0, int arg1, bool flag) {
+	int xmult = 0;
+	int ymult = 0;
+
+	switch (arg0) {
+	case 1:
+		xmult = 10;
+		ymult = 7;
+		break;
+	case 2:
+		xmult = 0;
+		ymult = 7;
+		break;
+	case 3:
+		xmult = -10;
+		ymult = 7;
+		break;
+	case 4:
+		xmult = -10;
+		ymult = 0;
+		break;
+	case 5:
+		xmult = -10;
+		ymult = -7;
+		break;
+	case 6:
+		xmult = 0;
+		ymult = -7;
+		break;
+	case 7:
+		xmult = 10;
+		ymult = -7;
+		break;
+	case 8:
+		xmult = 10;
+		ymult = 0;
+		break;
+	default:
+		break;
+	}
+
+	_demoPt2Surface->clear(0);
+	if (flag) {
+		_demoPt2Surface->drawSurface(_backg2Surface, 0, 15);
+	}
+
+	for (int i = 4; i > 0; --i) {
+		if (i <= arg1) {
+			_demoPt2Surface->drawSurfaceTransparent(_outlineSurface, (i * xmult) + 47, (i * ymult) + 25);
+		}
+	}
+
+	_demoPt2Surface->drawSurfaceTransparent(_logoSurface, 47, 25);
+	_screen->drawSurface(_demoPt2Surface, 0, 0);
+
+	// Added for better results
+	waitMillis(200);
+}
+
+bool WaynesWorldEngine::introPt3(bool flag) {
+	// sub1
+	_backg2Surface = new WWSurface(320, 170);
+	_logoSurface = new WWSurface(226, 134);
+	_outlineSurface = new WWSurface(226, 134);
+
+	drawImageToSurface(_oanGxl, "backg2.pcx", _backg2Surface, 0, 0);
+	drawImageToSurface(_oanGxl, "logo.pcx", _logoSurface, 0, 0);
+	drawImageToSurface(_oanGxl, "outline.pcx", _outlineSurface, 0, 0);
+	// End of sub1
+
+	wwEffect(1, 0, flag);
+
+	if (flag)
+		waitSeconds(1);
+
+	_sound->playSound("sv42.snd", false);
+	wwEffect(1, 1, flag);
+	wwEffect(1, 2, flag);
+	wwEffect(1, 3, flag);
+
+	byte newColor[3] = {0, 0, 0};
+	static byte rArr[] = { 9,  9,  9,  9, 43, 43, 53, 63, 63, 63, 63, 63, 63, 63, 45, 28,  9,  9,  9};
+	static byte gArr[] = {33, 33, 40, 47, 47, 47, 47, 47, 35, 23,  0,  0,  0,  0,  0,  0,  0, 33, 33};
+	static byte bArr[] = {29, 20, 20, 20, 20,  0,  0,  0,  0,  0,  0, 23, 37, 50, 50, 50, 50, 50, 40};
+
+	for (int i = 0; i < 32; ++i) {
+		const int index = (i % 19);
+		newColor[0] = rArr[index] * 4;
+		newColor[1] = gArr[index] * 4;
+		newColor[2] = bArr[index] * 4;
+
+		g_system->getPaletteManager()->setPalette((const byte *)&newColor, 236, 1);
+		wwEffect((i % 8) + 1, 4, flag);
+	}
+
+	wwEffect(1, 3, flag);
+	wwEffect(1, 2, flag);
+	wwEffect(1, 1, flag);
+	wwEffect(1, 0, flag);
+
+	while (_sound->isSFXPlaying())
+		waitMillis(30);
+
+	_sound->playSound("sv16.snd", false);
+
+	while (_sound->isSFXPlaying())
+		waitMillis(30);
+
+	waitSeconds(1);
+
+	delete _outlineSurface;
+	delete _logoSurface;
+	delete _backg2Surface;
+
+	// TODO add a check at each step to return false if ESC is pressed
+	return true;
+}
+
+
+} // End of namespace WaynesWorld
diff --git a/engines/waynesworld/module.mk b/engines/waynesworld/module.mk
index 3aedc1e478b..707c5a5090d 100644
--- a/engines/waynesworld/module.mk
+++ b/engines/waynesworld/module.mk
@@ -7,6 +7,7 @@ MODULE_OBJS := \
 	gamemap.o \
 	gxlarchive.o \
 	graphics.o \
+	intro.o \
 	metaengine.o \
 	pathfinding.o \
 	sound.o \
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index a21eeda223c..58b2295a621 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -67,234 +67,6 @@ WaynesWorldEngine::~WaynesWorldEngine() {
 
 }
 
-bool WaynesWorldEngine::introPt1() {
-	static int16 array1[] = {179, 179, 181, 183, 186, 189, 192, 198, 208, 212, 217, 223, 234, 233, 236, 240, 241, 238, 238, 238, 225, 218, 218, 192, 164, 133, 103, 87};
-	static int16 array2[] = {97, 97, 98, 98, 97, 96, 94, 91, 88, 85, 84, 82, 81, 78, 76, 76, 75, 74, 72, 72, 71, 69, 68, 68, 67, 67, 66, 68};
-	static int16 array3[] = {80, 80, 69, 37, 0, 0, 0, 0};
-	static int16 array4[] = {67, 67, 64, 54, 41, 27, 27, 27};
-
-	GxlArchive *oa2Gxl = new GxlArchive("oa2");
-	loadPalette(oa2Gxl, "paramnt.pcx");
-
-	_musicIndex = 0;
-	changeMusic();
-
-	// "Paramount" background
-	drawImageToScreen(oa2Gxl, "paramnt.pcx", 0, 0);
-	waitSeconds(1);
-
-	WWSurface *paramaSprite = new WWSurface(190, 112);
-	// "And" animation
-	drawImageToSurface(oa2Gxl, "parama.pcx", paramaSprite, 0, 0);
-	drawRandomEffect(paramaSprite, 66, 30, 2, 2);
-	delete paramaSprite;
-
-	waitSeconds(2);
-
-	paletteFadeOut(0, 256, 6);
-
-	loadPalette(oa2Gxl, "backg.pcx");
-	drawImageToScreen(oa2Gxl, "backg.pcx", 0, 0);
-
-	// "Capstone logo" animation
-	for (int i = 1; i < 29; ++i) {
-		Common::String filename = Common::String::format("cap%02d.pcx", i);
-		drawImageToScreen(oa2Gxl, filename.c_str(), array1[i - 1], array2[i - 1]);
-		waitMillis(30);
-	}
-	waitSeconds(1);
-
-	// "The pinnacle of entertainment software" animation
-	for (int i = 1; i < 10; ++i) {
-		Common::String filename = Common::String::format("txt%02d.pcx", i);
-		drawImageToScreen(oa2Gxl, filename.c_str(), 0, 138);
-		waitMillis(30);
-	}
-	waitSeconds(1);
-
-	// Shining "Capstone" animation
-	for (int i = 1; i < 12; ++i) {
-		Common::String filename = Common::String::format("captxt%02d.pcx", i);
-		drawImageToScreen(oa2Gxl, filename.c_str(), 113, 89);
-		waitMillis(30);
-	}
-	waitSeconds(1);
-
-	// Removing "The pinnacle of entertainment software" animation
-	for (int i = 9; i > 0; --i) {
-		Common::String filename = Common::String::format("txt%02d.pcx", i);
-		drawImageToScreen(oa2Gxl, filename.c_str(), 0, 138);
-		waitMillis(30);
-	}
-	waitSeconds(1);
-
-	drawImageToScreen(oa2Gxl, "txtbkg.pcx", 0, 138);
-	waitMillis(30);
-	waitSeconds(1);
-
-	for (int i = 1; i < 7; ++i) {
-		Common::String filename = Common::String::format("capsp%02d.pcx", i);
-		drawImageToScreen(oa2Gxl, filename.c_str(), 76, 66);
-		waitMillis(30);
-	}
-
-	for (int i = 1; i < 12; ++i) {
-		Common::String filename = Common::String::format("presnt%02d.pcx", i);
-		drawImageToScreen(oa2Gxl, filename.c_str(), 117, 112);
-		waitMillis(60);
-	}
-
-	for (int i = 1; i < 9; ++i) {
-		Common::String filename = Common::String::format("capawy%02d.pcx", i);
-		drawImageToScreen(oa2Gxl, filename.c_str(), array3[i - 1], array4[i - 1]);
-		waitMillis(30);
-	}
-
-	delete oa2Gxl;
-
-	// TODO add a check at each step to return false if ESC is pressed
-	return true;
-}
-
-bool WaynesWorldEngine::introPt2() {
-	paletteFadeOut(0, 256, 64);
-
-	_oanGxl = new GxlArchive("oan");
-	loadPalette(_oanGxl, "backg2.pcx");
-	_demoPt2Surface = new WWSurface(320, 200);
-	_midi->stopSong();
-
-	// TODO add a check at each step to return false if ESC is pressed
-	return true;
-}
-
-void WaynesWorldEngine::wwEffect(int arg0, int arg1, bool flag) {
-	int xmult = 0;
-	int ymult = 0;
-
-	switch (arg0) {
-	case 1:
-		xmult = 10;
-		ymult = 7;
-		break;
-	case 2:
-		xmult = 0;
-		ymult = 7;
-		break;
-	case 3:
-		xmult = -10;
-		ymult = 7;
-		break;
-	case 4:
-		xmult = -10;
-		ymult = 0;
-		break;
-	case 5:
-		xmult = -10;
-		ymult = -7;
-		break;
-	case 6:
-		xmult = 0;
-		ymult = -7;
-		break;
-	case 7:
-		xmult = 10;
-		ymult = -7;
-		break;
-	case 8:
-		xmult = 10;
-		ymult = 0;
-		break;
-	default:
-		break;
-	}
-
-	_demoPt2Surface->clear(0);
-	if (flag) {
-		_demoPt2Surface->drawSurface(_backg2Surface, 0, 15);
-	}
-
-	for (int i = 4; i > 0; --i) {
-		if (i <= arg1) {
-			_demoPt2Surface->drawSurfaceTransparent(_outlineSurface, (i * xmult) + 47, (i * ymult) + 25);
-		}
-	}
-
-	_demoPt2Surface->drawSurfaceTransparent(_logoSurface, 47, 25);
-	_screen->drawSurface(_demoPt2Surface, 0, 0);
-
-	// Added for better results
-	waitMillis(200);
-}
-
-bool WaynesWorldEngine::introPt3(bool flag) {
-	// sub1
-	_backg2Surface = new WWSurface(320, 170);
-	_logoSurface = new WWSurface(226, 134);
-	_outlineSurface = new WWSurface(226, 134);
-
-	drawImageToSurface(_oanGxl, "backg2.pcx", _backg2Surface, 0, 0);
-	drawImageToSurface(_oanGxl, "logo.pcx", _logoSurface, 0, 0);
-	drawImageToSurface(_oanGxl, "outline.pcx", _outlineSurface, 0, 0);
-	// End of sub1
-
-	wwEffect(1, 0, flag);
-
-	if (flag)
-		waitSeconds(1);
-
-	_sound->playSound("sv42.snd", false);
-	wwEffect(1, 1, flag);
-	wwEffect(1, 2, flag);
-	wwEffect(1, 3, flag);
-
-	byte newColor[3] = {0, 0, 0};
-	static byte rArr[] = { 9,  9,  9,  9, 43, 43, 53, 63, 63, 63, 63, 63, 63, 63, 45, 28,  9,  9,  9};
-	static byte gArr[] = {33, 33, 40, 47, 47, 47, 47, 47, 35, 23,  0,  0,  0,  0,  0,  0,  0, 33, 33};
-	static byte bArr[] = {29, 20, 20, 20, 20,  0,  0,  0,  0,  0,  0, 23, 37, 50, 50, 50, 50, 50, 40};
-
-	for (int i = 0; i < 32; ++i) {
-		const int index = (i % 19);
-		newColor[0] = rArr[index] * 4;
-		newColor[1] = gArr[index] * 4;
-		newColor[2] = bArr[index] * 4;
-
-		g_system->getPaletteManager()->setPalette((const byte *)&newColor, 236, 1);
-		wwEffect((i % 8) + 1, 4, flag);
-	}
-
-	wwEffect(1, 3, flag);
-	wwEffect(1, 2, flag);
-	wwEffect(1, 1, flag);
-	wwEffect(1, 0, flag);
-
-	while (_sound->isSFXPlaying())
-		waitMillis(30);
-
-	_sound->playSound("sv16.snd", false);
-
-	while (_sound->isSFXPlaying())
-		waitMillis(30);
-
-	waitSeconds(1);
-
-	delete _outlineSurface;
-	delete _logoSurface;
-	delete _backg2Surface;
-
-	// TODO add a check at each step to return false if ESC is pressed
-	return true;
-}
-
-void WaynesWorldEngine::runIntro() {
-	if (!introPt1())
-		return;
-	if (!introPt2())
-		return;
-	if (!introPt3(false))
-		return;
-}
-
 Common::Error WaynesWorldEngine::run() {
 	_isSaveAllowed = false;	
 	


Commit: 726686d0f979bb8ae95eab673df7c54e7772787f
    https://github.com/scummvm/scummvm/commit/726686d0f979bb8ae95eab673df7c54e7772787f
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:56+01:00

Commit Message:
WAYNESWORLD: Reduce memory usage by moving the GXL handling directly in the scrolling background instead of using globals

Changed paths:
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 58b2295a621..795b356caef 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -103,12 +103,7 @@ Common::Error WaynesWorldEngine::run() {
 	_m03Gxl = new GxlArchive("m03");
 	_m05Gxl = new GxlArchive("m05");
 
-	_r08Gxl = new GxlArchive("r08");
 	_r10Gxl = new GxlArchive("r10");
-	_r14Gxl = new GxlArchive("r14");
-	_r21Gxl = new GxlArchive("r21");
-	_r22Gxl = new GxlArchive("r22");
-	_r33Gxl = new GxlArchive("r33");
 
 	_logic = new GameLogic(this);
 
@@ -182,12 +177,7 @@ Common::Error WaynesWorldEngine::run() {
 	delete _sound;
 	delete _logic;
 
-	delete _r33Gxl;
-	delete _r22Gxl;
-	delete _r21Gxl;
-	delete _r14Gxl;
 	delete _r10Gxl;
-	delete _r08Gxl;
 
 	delete _m05Gxl;
 	delete _m03Gxl;
@@ -1272,33 +1262,43 @@ void WaynesWorldEngine::loadScrollSprite() {
         _doScrollRight = true;
     } else if (_currentRoomNumber == 19 && _hoverObjectNumber == kObjectIdStore) {
         _backgroundScrollSurface = new WWSurface(112, 150);
-        drawImageToSurface(_r14Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
-        _scrollRemaining = 112;
+		GxlArchive *r14Gxl = new GxlArchive("r14");
+		drawImageToSurface(r14Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
+		delete r14Gxl;
+		_scrollRemaining = 112;
         _scrollWidth = 112;
         _doScrollRight = false;
     } else if (_currentRoomNumber == 8 && _hoverObjectNumber == kObjectIdHallway8) {
         stopRoomAnimations();
         _backgroundScrollSurface = new WWSurface(320, 150);
-        drawImageToSurface(_r21Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
-        _scrollRemaining = 320;
+		GxlArchive *r21Gxl = new GxlArchive("r21");
+		drawImageToSurface(r21Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
+		delete r21Gxl;
+		_scrollRemaining = 320;
         _scrollWidth = 320;
         _doScrollRight = false;
     } else if (_currentRoomNumber == 21 && _hoverObjectNumber == kObjectIdFoyer) {
         _backgroundScrollSurface = new WWSurface(320, 150);
-        drawImageToSurface(_r08Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
-        _scrollRemaining = 320;
+		GxlArchive *r08Gxl = new GxlArchive("r08");
+		drawImageToSurface(r08Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
+		delete r08Gxl;
+		_scrollRemaining = 320;
         _scrollWidth = 320;
         _doScrollRight = true;
     } else if (_currentRoomNumber == 21 && _hoverObjectNumber == kObjectIdOffice21) {
         _backgroundScrollSurface = new WWSurface(320, 150);
-        drawImageToSurface(_r22Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
-        _scrollRemaining = 320;
+		GxlArchive *r22Gxl = new GxlArchive("r22");
+		drawImageToSurface(r22Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
+		delete r22Gxl;
+		_scrollRemaining = 320;
         _scrollWidth = 320;
         _doScrollRight = false;
     } else if (_currentRoomNumber == 22 && _hoverObjectNumber == kObjectIdHallway22) {
         _backgroundScrollSurface = new WWSurface(320, 150);
-		drawImageToSurface(_r21Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
-        _scrollRemaining = 320;
+		GxlArchive *r21Gxl = new GxlArchive("r21");
+		drawImageToSurface(r21Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
+		delete r21Gxl;
+		_scrollRemaining = 320;
         _scrollWidth = 320;
         _doScrollRight = true;
     } else if (_currentRoomNumber == 32 && _hoverObjectNumber == kObjectIdOffice) {
@@ -1309,8 +1309,10 @@ void WaynesWorldEngine::loadScrollSprite() {
             walkTo(150, 140, 6, 160, 140);
             stopRoomAnimations();
             _backgroundScrollSurface = new WWSurface(168, 150);
-            drawImageToSurface(_r33Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
-            _scrollRemaining = 168;
+			GxlArchive *r33Gxl = new GxlArchive("r33");
+			drawImageToSurface(r33Gxl, "backg.pcx", _backgroundScrollSurface, 0, 0);
+			delete r33Gxl;
+			_scrollRemaining = 168;
             _scrollWidth = 168;
             _doScrollRight = false;
         }
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 55e9e2cf5f8..f9036e9506e 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -149,12 +149,7 @@ public:
 	GxlArchive *_m03Gxl = nullptr;
 	GxlArchive *_m05Gxl = nullptr;
 
-	GxlArchive *_r08Gxl = nullptr;
 	GxlArchive *_r10Gxl = nullptr;
-	GxlArchive *_r14Gxl = nullptr;
-	GxlArchive *_r21Gxl = nullptr;
-	GxlArchive *_r22Gxl = nullptr;
-	GxlArchive *_r33Gxl = nullptr;
 
 	// Sound and Music
 	SoundManager *_sound;


Commit: d1a24578114780ce80b55419645cfe4730d78788
    https://github.com/scummvm/scummvm/commit/d1a24578114780ce80b55419645cfe4730d78788
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:56+01:00

Commit Message:
WAYNESWORLD: Start the implementation of intro part 4

Changed paths:
    engines/waynesworld/intro.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index a34d2d5440d..84de8b78008 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -36,6 +36,10 @@ void WaynesWorldEngine::runIntro() {
 		return;
 	if (!introPt3(false))
 		return;
+	if (!introPt4())
+		return;
+	if (!introPt3(true))
+		return;
 }
 
 bool WaynesWorldEngine::introPt1() {
@@ -247,7 +251,9 @@ bool WaynesWorldEngine::introPt3(bool flag) {
 		waitMillis(30);
 
 	waitSeconds(1);
-
+	
+	paletteFadeOut(0, 256, 4); 
+	
 	delete _outlineSurface;
 	delete _logoSurface;
 	delete _backg2Surface;
@@ -256,5 +262,91 @@ bool WaynesWorldEngine::introPt3(bool flag) {
 	return true;
 }
 
+bool WaynesWorldEngine::introPt4() {
+	bool retVal = true;
+	introPt4_sub1();
+
+	if (!introPt4_sub2()) {
+		retVal = false;
+	} else if (!introPt4_sub3()) {
+		retVal = false;
+	} else if (!introPt4_sub4()) {
+		retVal = false;
+	} else if (!introPt4_sub5()) {
+		retVal = false;
+	} else if (!introPt4_sub6()) {
+		retVal = false;
+	} else if (!introPt4_sub7()) {
+		retVal = false;
+	}
+	
+	introPt4_sub8();
+
+	if (retVal)
+		retVal = introPt4_sub9();
+	
+	return retVal;
+}
+
+void WaynesWorldEngine::introPt4_sub1() {
+	_fontWW = new GFTFont();
+	_fontWW->loadFromFile("ww.gft");
+	
+	_musicIndex = 2;
+	changeMusic();
+
+	_introBackg1Image = new WWSurface(320, 170);
+	drawImageToSurface(_oanGxl, "backg1.pcx", _introBackg1Image, 0, 0);
+	_introWbodyImage = new WWSurface(145, 118);
+	drawImageToSurface(_oanGxl, "wbody0.pcx", _introWbodyImage, 0, 0);
+	_introGbodyImage = new WWSurface(160, 149);
+	drawImageToSurface(_oanGxl, "gbody0.pcx", _introGbodyImage, 0, 0);
+
+	for (int i = 0; i < 8; ++i) {
+		_introWhead1[i] = new WWSurface(98, 71);
+		Common::String filename = Common::String::format("whead1%d.pcx", i);
+		drawImageToSurface(_oanGxl, filename.c_str(), _introWhead1[i], 0, 0);
+	}
+
+	for (int i = 0; i < 11; ++i) {
+		_introGhead1[i] = new WWSurface(138, 80);
+		Common::String filename = Common::String::format("ghead1%d.pcx", i);
+		drawImageToSurface(_oanGxl, filename.c_str(), _introGhead1[i], 0, 0);
+	}
+
+	drawImageToScreen(_oanGxl, "backg1.pcx", 0, 15);
+	paletteFadeIn(0, 256, 2);
+}
+
+bool WaynesWorldEngine::introPt4_sub2() {
+	// TODO add a check at each step to return false if ESC is pressed
+	return true;
+}
+bool WaynesWorldEngine::introPt4_sub3() {
+	// TODO add a check at each step to return false if ESC is pressed
+	return true;
+}
+bool WaynesWorldEngine::introPt4_sub4() {
+	// TODO add a check at each step to return false if ESC is pressed
+	return true;
+}
+bool WaynesWorldEngine::introPt4_sub5() {
+	// TODO add a check at each step to return false if ESC is pressed
+	return true;
+}
+bool WaynesWorldEngine::introPt4_sub6() {
+	// TODO add a check at each step to return false if ESC is pressed
+	return true;
+}
+bool WaynesWorldEngine::introPt4_sub7() {
+	// TODO add a check at each step to return false if ESC is pressed
+	return true;
+}
+void WaynesWorldEngine::introPt4_sub8() {
+}
+bool WaynesWorldEngine::introPt4_sub9() {
+	// TODO add a check at each step to return false if ESC is pressed
+	return true;
+}
 
 } // End of namespace WaynesWorld
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index f9036e9506e..779855d8af8 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -120,7 +120,24 @@ private:
 	bool introPt1();
 	bool introPt2();
 	bool introPt3(bool flag);
-	
+	bool introPt4();
+
+	WWSurface *_introBackg1Image = nullptr;
+	WWSurface *_introWbodyImage = nullptr;
+	WWSurface *_introGbodyImage = nullptr;
+	WWSurface *_introWhead1[8] = {nullptr};
+	WWSurface *_introGhead1[11] = {nullptr};
+
+	void introPt4_sub1();
+	bool introPt4_sub2();
+	bool introPt4_sub3();
+	bool introPt4_sub4();
+	bool introPt4_sub5();
+	bool introPt4_sub6();
+	bool introPt4_sub7();
+	void introPt4_sub8();
+	bool introPt4_sub9();
+
 	WWSurface *_demoPt2Surface = nullptr;
 	WWSurface *_backg2Surface = nullptr;
 	WWSurface *_logoSurface = nullptr;


Commit: 0d57bf2037d0bc0563b2e04272f6c639a56d9d07
    https://github.com/scummvm/scummvm/commit/0d57bf2037d0bc0563b2e04272f6c639a56d9d07
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:56+01:00

Commit Message:
WAYNESWORLD: Add intro Pt4 sub 8, start working on intro Pt4 sub 2

Changed paths:
    engines/waynesworld/intro.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index 84de8b78008..cd56f8d2c3e 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -30,8 +30,10 @@
 namespace WaynesWorld {
 
 void WaynesWorldEngine::runIntro() {
+#if 0
 	if (!introPt1())
 		return;
+#endif
 	if (!introPt2())
 		return;
 	if (!introPt3(false))
@@ -288,6 +290,45 @@ bool WaynesWorldEngine::introPt4() {
 	return retVal;
 }
 
+void WaynesWorldEngine::sub2FEFB(int arg_refreshBackgFl, int arg_wBodyIndex, int arg_gBodyIndex, int arg_wHead1Index, int arg_gHead1Index, int arg_TextId) {
+	_screen->fillRect(0, 0, 319, 14, 0);
+	_screen->fillRect(0, 185, 319, 199, 0);
+
+	if (arg_refreshBackgFl != _old_arg_refreshBackgFl) {
+		_demoPt2Surface->clear(0);
+		_demoPt2Surface->drawSurface(_introBackg1Image, 0, 15);
+		_old_arg_refreshBackgFl = arg_refreshBackgFl;
+	}
+
+	if (arg_wBodyIndex != _old_arg_wBodyIndex) {
+		if (arg_wBodyIndex)
+			error("Unexpected value %d", arg_wBodyIndex);
+		_demoPt2Surface->drawSurface(_introWbodyImage, 0, 21);
+		_old_arg_wBodyIndex = arg_wBodyIndex;
+	}
+
+	if (arg_gBodyIndex != _old_arg_gBodyIndex) {
+		_demoPt2Surface->drawSurface(_introGbodyImage, 160, 25);
+		_old_arg_gBodyIndex = arg_gBodyIndex;
+	}
+
+	if (arg_wHead1Index != _old_argWHead1Index) {
+		_demoPt2Surface->drawSurface(_introWhead1[arg_wHead1Index], 12, 22);
+		_old_argWHead1Index = arg_wHead1Index;
+	}
+
+	if (arg_gHead1Index != _old_argGHead1Index) {
+		_demoPt2Surface->drawSurface(_introGhead1[arg_gHead1Index], 182, 21);
+		_old_argGHead1Index = arg_gHead1Index;
+	}
+
+	if (arg_TextId != -1) {
+		warning("STUB - sub_3009A(arg_TextId);");
+	}
+	
+	_screen->drawSurface(_demoPt2Surface, 0, 0);
+}
+
 void WaynesWorldEngine::introPt4_sub1() {
 	_fontWW = new GFTFont();
 	_fontWW->loadFromFile("ww.gft");
@@ -319,6 +360,13 @@ void WaynesWorldEngine::introPt4_sub1() {
 }
 
 bool WaynesWorldEngine::introPt4_sub2() {
+	_sound->playSound("sv27.snd", false);
+
+	for (int i = 0; i < 12; ++i) {
+		int index = getRandom(3);
+		sub2FEFB(1, 0, 1, index, 9, 0);
+	}
+	
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
@@ -343,8 +391,28 @@ bool WaynesWorldEngine::introPt4_sub7() {
 	return true;
 }
 void WaynesWorldEngine::introPt4_sub8() {
+	delete _fontWW;
+	_fontWW = nullptr;
+	delete _introBackg1Image;
+	_introBackg1Image = nullptr;
+	delete _introWbodyImage;
+	_introWbodyImage = nullptr;
+	delete _introGbodyImage;
+	_introGbodyImage = nullptr;
+	for (int i = 0; i < 7; ++i) {
+		delete _introWhead1[i];
+		_introWhead1[i] = nullptr;
+	}
+	for (int i = 0; i < 11; ++i) {
+		delete _introGhead1[i];
+		_introGhead1[i] = nullptr;
+	}
 }
+
 bool WaynesWorldEngine::introPt4_sub9() {
+	warning("STUB - intro 4 pt 9");
+	
+	_midi->stopSong();
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 779855d8af8..e95da414a27 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -128,6 +128,14 @@ private:
 	WWSurface *_introWhead1[8] = {nullptr};
 	WWSurface *_introGhead1[11] = {nullptr};
 
+	int _old_arg_refreshBackgFl = -1;
+	int _old_arg_wBodyIndex = -1;
+	int _old_arg_gBodyIndex = -1;
+	int _old_argWHead1Index = -1;
+	int _old_argGHead1Index = -1;
+	
+	void sub2FEFB(int arg_refreshBackgFl, int arg_wBodyIndex, int arg_gBodyIndex, int arg_wHead1Index, int arg_gHead1Index, int arg_TextId);
+
 	void introPt4_sub1();
 	bool introPt4_sub2();
 	bool introPt4_sub3();


Commit: fd500ebef28735eaa1e2295b6db9adc053879e47
    https://github.com/scummvm/scummvm/commit/fd500ebef28735eaa1e2295b6db9adc053879e47
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:56+01:00

Commit Message:
WAYNESWORLD: fix fillRect in sub2FEFB, add some text display

Changed paths:
    engines/waynesworld/intro.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index cd56f8d2c3e..22a8a6059a2 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -249,9 +249,6 @@ bool WaynesWorldEngine::introPt3(bool flag) {
 
 	_sound->playSound("sv16.snd", false);
 
-	while (_sound->isSFXPlaying())
-		waitMillis(30);
-
 	waitSeconds(1);
 	
 	paletteFadeOut(0, 256, 4); 
@@ -290,9 +287,43 @@ bool WaynesWorldEngine::introPt4() {
 	return retVal;
 }
 
+void WaynesWorldEngine::sub3009A(int textId) {
+	int startPos;
+	int textColor;
+	int textType = 0;
+	Common::String filename;
+	
+	switch (textId) {
+	case 0:
+		filename = "oaw";
+		startPos = _startOawPos;
+		textColor = 147;
+		break;
+	case 1:
+		filename = "oag";
+		startPos = _startOagPos;
+		textColor = 41;
+		break;
+	default:
+		filename = "oao";
+		startPos = _startOaoPos;
+		++_startOaoPos;
+		textColor = 11;
+		textType = 1;
+		break;
+	}
+
+	Common::String displayTxt = loadString(filename.c_str(), startPos, 0);
+
+	if (textType)
+		_fontWW->drawText(_demoPt2Surface, displayTxt.c_str(), 0, 187, textColor);
+	else
+		_fontWW->drawText(_demoPt2Surface, displayTxt.c_str(), 0, 2, textColor);
+}
+
 void WaynesWorldEngine::sub2FEFB(int arg_refreshBackgFl, int arg_wBodyIndex, int arg_gBodyIndex, int arg_wHead1Index, int arg_gHead1Index, int arg_TextId) {
-	_screen->fillRect(0, 0, 319, 14, 0);
-	_screen->fillRect(0, 185, 319, 199, 0);
+	_demoPt2Surface->fillRect(0, 0, 319, 14, 0);
+	_demoPt2Surface->fillRect(0, 185, 319, 199, 0);
 
 	if (arg_refreshBackgFl != _old_arg_refreshBackgFl) {
 		_demoPt2Surface->clear(0);
@@ -323,15 +354,19 @@ void WaynesWorldEngine::sub2FEFB(int arg_refreshBackgFl, int arg_wBodyIndex, int
 	}
 
 	if (arg_TextId != -1) {
-		warning("STUB - sub_3009A(arg_TextId);");
+		sub3009A(arg_TextId);
 	}
 	
 	_screen->drawSurface(_demoPt2Surface, 0, 0);
+	waitMillis(170);
 }
 
 void WaynesWorldEngine::introPt4_sub1() {
 	_fontWW = new GFTFont();
 	_fontWW->loadFromFile("ww.gft");
+
+	while(_sound->isSFXPlaying())
+		waitMillis(30);;
 	
 	_musicIndex = 2;
 	changeMusic();
@@ -366,7 +401,23 @@ bool WaynesWorldEngine::introPt4_sub2() {
 		int index = getRandom(3);
 		sub2FEFB(1, 0, 1, index, 9, 0);
 	}
+
+	++_startOawPos;
+	while (_sound->isSFXPlaying())
+		waitMillis(30);
+	
+	_sound->playSound("sv25.snd", false);
+
+	for (int i = 0; i < 8; ++i) {
+		int index = getRandom(3);
+		sub2FEFB(1, 0, 1, index, 9, 0);
+	}
 	
+	while (_sound->isSFXPlaying())
+		waitMillis(30);
+
+	_sound->playSound("sv20.snd", false);
+
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index e95da414a27..3c92a700a73 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -133,7 +133,11 @@ private:
 	int _old_arg_gBodyIndex = -1;
 	int _old_argWHead1Index = -1;
 	int _old_argGHead1Index = -1;
+	int _startOawPos = 0;
+	int _startOagPos = 0;
+	int _startOaoPos = 0;
 	
+	void sub3009A(int textId);
 	void sub2FEFB(int arg_refreshBackgFl, int arg_wBodyIndex, int arg_gBodyIndex, int arg_wHead1Index, int arg_gHead1Index, int arg_TextId);
 
 	void introPt4_sub1();


Commit: 53db889f687e12c66999f2ad41753d4396151b89
    https://github.com/scummvm/scummvm/commit/53db889f687e12c66999f2ad41753d4396151b89
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:56+01:00

Commit Message:
WAYNESWORLD: finish the implementation of introPt4_sub2

Changed paths:
    engines/waynesworld/intro.cpp


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index 22a8a6059a2..cf2ea2efa42 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -30,10 +30,8 @@
 namespace WaynesWorld {
 
 void WaynesWorldEngine::runIntro() {
-#if 0
 	if (!introPt1())
 		return;
-#endif
 	if (!introPt2())
 		return;
 	if (!introPt3(false))
@@ -334,6 +332,7 @@ void WaynesWorldEngine::sub2FEFB(int arg_refreshBackgFl, int arg_wBodyIndex, int
 	if (arg_wBodyIndex != _old_arg_wBodyIndex) {
 		if (arg_wBodyIndex)
 			error("Unexpected value %d", arg_wBodyIndex);
+
 		_demoPt2Surface->drawSurface(_introWbodyImage, 0, 21);
 		_old_arg_wBodyIndex = arg_wBodyIndex;
 	}
@@ -412,12 +411,27 @@ bool WaynesWorldEngine::introPt4_sub2() {
 		int index = getRandom(3);
 		sub2FEFB(1, 0, 1, index, 9, 0);
 	}
-	
+
+	++_startOawPos;
 	while (_sound->isSFXPlaying())
 		waitMillis(30);
 
 	_sound->playSound("sv20.snd", false);
 
+	for (int i = 0; i < 5; ++i) {
+		int index = getRandom(11);
+		sub2FEFB(1, 0, 1, 0, index, 1);
+	}
+	
+	++_startOagPos;
+
+	for (int i = 0; i < 15; ++i) {
+		int index = getRandom(3);
+		sub2FEFB(1, 0, 1, index, 9, 0);
+	}
+
+	++_startOawPos;
+	
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }


Commit: 9b1b4f350dc5575677aff031684d587f9d277c07
    https://github.com/scummvm/scummvm/commit/9b1b4f350dc5575677aff031684d587f9d277c07
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:57+01:00

Commit Message:
WAYNESWORLD: Add introPt4 sub3 to sub5

Changed paths:
    engines/waynesworld/intro.cpp
    engines/waynesworld/sound.cpp


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index cf2ea2efa42..0251944aad1 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -436,14 +436,202 @@ bool WaynesWorldEngine::introPt4_sub2() {
 	return true;
 }
 bool WaynesWorldEngine::introPt4_sub3() {
+	WWSurface *pt4Sub3Surface1 = new WWSurface(178, 21);
+	WWSurface *pt4Sub3Surface2 = new WWSurface(178, 21);
+	pt4Sub3Surface2->clear(0);
+	drawImageToSurface(_oanGxl, "callin.pcx", pt4Sub3Surface1, 0, 0);
+
+	for (int i = 0; i < 5; ++i) {
+		drawImageToScreen(_oanGxl, "backg1.pcx", 0, 15);
+		waitMillis(500);
+		_screen->drawSurfaceTransparent(pt4Sub3Surface1, 66, 157);
+		waitMillis(500);
+	}
+
+	delete pt4Sub3Surface1;
+	delete pt4Sub3Surface2;
+
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
 bool WaynesWorldEngine::introPt4_sub4() {
+	for (int i = 0; i < 3; ++i) {
+		for (int j = 0; j < 15; ++j) {
+			int index = getRandom(3);
+			sub2FEFB(1, 0, 1, index, 9, 0);
+		}
+		++_startOawPos;
+	}
+
+	for (int i = 0; i < 3; ++i) {
+		for (int j = 0; j < 5; ++j) {
+			int index = getRandom(11);
+			sub2FEFB(1, 0, 1, 0, index, 1);
+		}
+		++_startOagPos;
+		for (int j = 0; j < 10; ++j) {
+			int index = getRandom(3);
+			sub2FEFB(1, 0, 1, index, 9, 0);
+		}
+		++_startOawPos;
+	}
+
+	_sound->playSound("sv33.snd", 0);
+	for (int j = 0; j < 10; ++j) {
+		int index = getRandom(3);
+		sub2FEFB(1, 0, 1, index, 9, 0);
+	}
+	++_startOawPos;
+
+	for (int i = 0; i < 2; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(2);
+	}
+
+	_sound->playSound("sv38.snd", 0);
+
+	for (int j = 0; j < 10; ++j) {
+		int index = getRandom(3);
+		sub2FEFB(1, 0, 1, index, 9, 0);
+	}
+	++_startOawPos;
+
+	for (int i = 0; i < 3; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(2);
+	}
+
+	for (int j = 0; j < 15; ++j) {
+		int index = getRandom(11);
+		sub2FEFB(1, 0, 1, 0, index, 1);
+	}
+	++_startOagPos;
+	_sound->playSound("sv31.snd", 0);
+
+	for (int i = 0; i < 3; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(2);
+	}
+
+	for (int i = 0; i < 2; ++i) {
+		for (int j = 0; j < 10; ++j) {
+			int index = getRandom(3);
+			sub2FEFB(1, 0, 1, index, 9, 0);
+		}
+		++_startOawPos;
+	}
+	_sound->playSound("sv28.snd", 0);
+
+	for (int j = 0; j < 5; ++j) {
+		int index = getRandom(3);
+		sub2FEFB(1, 0, 1, index, 9, 0);
+	}
+	++_startOawPos;
+	_sound->playSound("sv21.snd", 0);
+
+	for (int i = 0; i < 3; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(2);
+	}
+
+	for (int i = 0; i < 3; ++i) {
+		for (int j = 0; j < 15; ++j) {
+			int index = getRandom(3);
+			sub2FEFB(1, 0, 1, index, 9, 0);
+		}
+		++_startOawPos;
+	}
+
+	for (int i = 0; i < 5; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(2);
+	}
+	_sound->playSound("sv29.snd", false);
+
+	for (int i = 0; i < 3; ++i) {
+		for (int j = 0; j < 10; ++j) {
+			int index = getRandom(3);
+			sub2FEFB(1, 0, 1, index, 9, 0);
+		}
+		++_startOawPos;
+	}
+
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
 bool WaynesWorldEngine::introPt4_sub5() {
+	for (int i = 0; i < 4; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(2);
+		if (i == 2)
+			_sound->playSound("sv19.snd", false);
+	}
+
+	for (int i = 0; i < 4; ++i) {
+		for (int j = 0; j < 10; ++j) {
+			int index = getRandom(11);
+			sub2FEFB(1, 0, 1, 0, index, 1);
+		}
+		++_startOagPos;
+	}
+	
+	for (int i = 0; i < 4; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(2);
+	}
+
+	for (int j = 0; j < 10; ++j) {
+		int index = getRandom(3);
+		sub2FEFB(1, 0, 1, index, 9, 0);
+	}
+	++_startOawPos;
+	sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+	waitSeconds(2);
+
+	for (int i = 0; i < 3; ++i) {
+		for (int j = 0; j < 10; ++j) {
+			int index = getRandom(11);
+			sub2FEFB(1, 0, 1, 0, index, 1);
+		}
+		++_startOagPos;
+	}
+	_sound->playSound("sv21.snd", false);
+
+	for (int i = 0; i < 2; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(2);
+	}
+	_sound->playSound("sv15.snd", false);
+
+	for (int j = 0; j < 10; ++j) {
+		int index = getRandom(3);
+		sub2FEFB(1, 0, 1, index, 9, 0);
+	}
+	++_startOawPos;
+
+	for (int i = 0; i < 4; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(2);
+	}
+	_sound->playSound("sv30.snd", false);
+
+	for (int i = 0; i < 3; ++i) {
+		for (int j = 0; j < 10; ++j) {
+			int index = getRandom(11);
+			sub2FEFB(1, 0, 1, 0, index, 1);
+		}
+		++_startOagPos;
+	}
+	_sound->playSound("sv22.snd", false);
+
+	for (int i = 0; i < 2; ++i) {
+		for (int j = 0; j < 10; ++j) {
+			int index = getRandom(3);
+			sub2FEFB(1, 0, 1, index, 9, 0);
+		}
+		++_startOawPos;
+	}
+	
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
diff --git a/engines/waynesworld/sound.cpp b/engines/waynesworld/sound.cpp
index ba11febc87a..d88a1ac8532 100644
--- a/engines/waynesworld/sound.cpp
+++ b/engines/waynesworld/sound.cpp
@@ -44,6 +44,9 @@ SoundManager::~SoundManager() {
 }
 
 void SoundManager::playSound(const char *filename, int flag) {
+	while (isSFXPlaying())
+		_vm->waitMillis(10);
+
 	_filename = Common::String(filename);
 	
 	Common::File fd;


Commit: 6e52fff10de500df6b84044207d3ccf0c9f67c3f
    https://github.com/scummvm/scummvm/commit/6e52fff10de500df6b84044207d3ccf0c9f67c3f
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:57+01:00

Commit Message:
WAYNESWORLD: Add flag behavior in playSound

Changed paths:
    engines/waynesworld/sound.cpp


diff --git a/engines/waynesworld/sound.cpp b/engines/waynesworld/sound.cpp
index d88a1ac8532..674f1775b69 100644
--- a/engines/waynesworld/sound.cpp
+++ b/engines/waynesworld/sound.cpp
@@ -68,6 +68,11 @@ void SoundManager::playSound(const char *filename, int flag) {
 	if (!_mixer->isSoundHandleActive(*_effectsHandle)) {
 		_mixer->playStream(Audio::Mixer::kSFXSoundType, _effectsHandle, audioStream, -1, _mixer->kMaxChannelVolume, 0, DisposeAfterUse::NO);
 	}
+
+	if (flag) {
+		while (isSFXPlaying())
+			_vm->waitMillis(10);
+	}
 }
 
 bool SoundManager::isSFXPlaying() {


Commit: cefd863b74b16c2ccd29da66028378bd14560062
    https://github.com/scummvm/scummvm/commit/cefd863b74b16c2ccd29da66028378bd14560062
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:57+01:00

Commit Message:
WAYNESWORLD: Add introPt4 sub 6

Changed paths:
    engines/waynesworld/intro.cpp


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index 0251944aad1..92ae7e599f3 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -636,6 +636,61 @@ bool WaynesWorldEngine::introPt4_sub5() {
 	return true;
 }
 bool WaynesWorldEngine::introPt4_sub6() {
+	for (int i = 0; i < 5; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(3);
+	}
+
+	for (int i = 0; i < 10; ++i) {
+		int index = getRandom(3);
+		sub2FEFB(1, 0, 1, index, 9, 0);
+	}
+	++_startOawPos;
+
+	for (int i = 0; i < 5; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 0);
+	}
+	++_startOawPos;
+	++_startOagPos;
+	_sound->playSound("sv46.snd", true);
+
+	for (int j = 0; j < 2; ++j) {
+		for (int i = 0; i < 15; ++i) {
+			int index = getRandom(3);
+			sub2FEFB(1, 0, 1, index, 9, 0);
+		}
+		++_startOawPos;
+	}
+
+	_sound->playSound("sv31.snd", false);
+
+	for (int i = 0; i < 5; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 0);
+	}
+
+	++_startOawPos;
+	++_startOagPos;
+
+	for (int i = 0; i < 2; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(2);
+	}
+
+	for (int j = 0; j < 4; ++j) {
+		for (int i = 0; i < 15; ++i) {
+			int index = getRandom(3);
+			sub2FEFB(1, 0, 1, index, 9, 0);
+		}
+		++_startOawPos;
+	}
+	_sound->playSound("sv39.snd", false);
+
+	for (int i = 0; i < 8; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 0);
+	}
+	++_startOawPos;
+	++_startOagPos;
+
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }


Commit: 8e834adbefe6fc6f1d16650afad0c837ff70ebea
    https://github.com/scummvm/scummvm/commit/8e834adbefe6fc6f1d16650afad0c837ff70ebea
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:57+01:00

Commit Message:
WAYNESWORLD: Add introPt4 sub 7

Changed paths:
    engines/waynesworld/intro.cpp


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index 92ae7e599f3..5b1731b842e 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -694,10 +694,116 @@ bool WaynesWorldEngine::introPt4_sub6() {
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
+
 bool WaynesWorldEngine::introPt4_sub7() {
+	for (int j = 0; j < 2; ++j) {
+		for (int i = 0; i < 15; ++i) {
+			int index = getRandom(3);
+			sub2FEFB(1, 0, 1, index, 9, 0);
+		}
+		++_startOawPos;
+	}
+
+	sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+	waitSeconds(2);
+
+	for (int i = 0; i < 15; ++i) {
+		int index = getRandom(3);
+		sub2FEFB(1, 0, 1, index, 9, 0);
+	}
+	++_startOawPos;
+	
+	for (int j = 0; j < 2; ++j) {
+		for (int i = 0; i < 15; ++i) {
+			int index = getRandom(11);
+			sub2FEFB(1, 0, 1, 0, index, 1);
+		}
+		++_startOagPos;
+	}
+
+	_sound->playSound("sv37.snd", true);
+	_sound->playSound("sv24.snd", true);
+
+	for (int i = 0; i < 15; ++i) {
+		int index = getRandom(3);
+		sub2FEFB(1, 0, 1, index, 9, 0);
+	}
+	++_startOawPos;
+
+	sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+	waitSeconds(2);
+
+	_sound->playSound("sv06.snd", false);
+
+	for (int i = 0; i < 3; ++i) {
+		int index = getRandom(3);
+		sub2FEFB(1, 0, 1, index, 9, 0);
+	}
+	++_startOawPos;
+
+	for (int i = 0; i < 2; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(2);
+	}
+	_sound->playSound("sv32.snd", false);
+
+	for (int i = 0; i < 5; ++i) {
+		int index = getRandom(11);
+		sub2FEFB(1, 0, 1, 0, index, 1);
+	}
+	++_startOagPos;
+
+	sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+	waitSeconds(1);
+
+	for (int j = 0; j < 3; ++j) {
+		for (int i = 0; i < 8; ++i) {
+			int index = getRandom(3);
+			sub2FEFB(1, 0, 1, index, 9, 0);
+		}
+		++_startOawPos;	
+	}
+
+	for (int i = 0; i < 8; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(2);
+	}
+
+	_sound->playSound("sv18.snd", false);
+
+	for (int i = 0; i < 8; ++i) {
+		int index = getRandom(3);
+		sub2FEFB(1, 0, 1, index, 9, 0);
+	}
+	++_startOawPos;
+
+	for (int i = 0; i < 6; ++i) {
+		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
+		waitSeconds(2);
+	}
+
+	_sound->playSound("sv45.snd", true);
+	
+	for (int j = 0; j < 3; ++j) {
+		for (int i = 0; i < 8; ++i) {
+			int index = getRandom(3);
+			sub2FEFB(1, 0, 1, index, 9, 0);
+		}
+		++_startOawPos;
+	}
+
+	_sound->playSound("sv34.snd", false);
+
+	for (int i = 0; i < 5; ++i) {
+		int index = getRandom(11);
+		sub2FEFB(1, 0, 1, 0, index, 1);
+	}
+	++_startOagPos;
+
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
+
 void WaynesWorldEngine::introPt4_sub8() {
 	delete _fontWW;
 	_fontWW = nullptr;


Commit: 0f335c8f3aeedd04234d8210de9d6d2a11a7849f
    https://github.com/scummvm/scummvm/commit/0f335c8f3aeedd04234d8210de9d6d2a11a7849f
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:57+01:00

Commit Message:
WAYNESWORLD: Add introPt4 sub 9, some renaming

Changed paths:
    engines/waynesworld/intro.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index 5b1731b842e..183aae72ba4 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -261,26 +261,26 @@ bool WaynesWorldEngine::introPt3(bool flag) {
 
 bool WaynesWorldEngine::introPt4() {
 	bool retVal = true;
-	introPt4_sub1();
+	introPt4_init();
 
-	if (!introPt4_sub2()) {
+	if (!introPt4_intro()) {
 		retVal = false;
-	} else if (!introPt4_sub3()) {
+	} else if (!introPt4_displayCallInTime()) {
 		retVal = false;
-	} else if (!introPt4_sub4()) {
+	} else if (!introPt4_caller1()) {
 		retVal = false;
-	} else if (!introPt4_sub5()) {
+	} else if (!introPt4_caller2()) {
 		retVal = false;
-	} else if (!introPt4_sub6()) {
+	} else if (!introPt4_caller3()) {
 		retVal = false;
-	} else if (!introPt4_sub7()) {
+	} else if (!introPt4_caller4()) {
 		retVal = false;
 	}
 	
-	introPt4_sub8();
+	introPt4_cleanup();
 
 	if (retVal)
-		retVal = introPt4_sub9();
+		retVal = introPt4_playGuitar();
 	
 	return retVal;
 }
@@ -330,10 +330,7 @@ void WaynesWorldEngine::sub2FEFB(int arg_refreshBackgFl, int arg_wBodyIndex, int
 	}
 
 	if (arg_wBodyIndex != _old_arg_wBodyIndex) {
-		if (arg_wBodyIndex)
-			error("Unexpected value %d", arg_wBodyIndex);
-
-		_demoPt2Surface->drawSurface(_introWbodyImage, 0, 21);
+		_demoPt2Surface->drawSurface(_introWbodyImage[arg_wBodyIndex], 0, 21);
 		_old_arg_wBodyIndex = arg_wBodyIndex;
 	}
 
@@ -360,7 +357,7 @@ void WaynesWorldEngine::sub2FEFB(int arg_refreshBackgFl, int arg_wBodyIndex, int
 	waitMillis(170);
 }
 
-void WaynesWorldEngine::introPt4_sub1() {
+void WaynesWorldEngine::introPt4_init() {
 	_fontWW = new GFTFont();
 	_fontWW->loadFromFile("ww.gft");
 
@@ -372,8 +369,8 @@ void WaynesWorldEngine::introPt4_sub1() {
 
 	_introBackg1Image = new WWSurface(320, 170);
 	drawImageToSurface(_oanGxl, "backg1.pcx", _introBackg1Image, 0, 0);
-	_introWbodyImage = new WWSurface(145, 118);
-	drawImageToSurface(_oanGxl, "wbody0.pcx", _introWbodyImage, 0, 0);
+	_introWbodyImage[0] = new WWSurface(145, 118);
+	drawImageToSurface(_oanGxl, "wbody0.pcx", _introWbodyImage[0], 0, 0);
 	_introGbodyImage = new WWSurface(160, 149);
 	drawImageToSurface(_oanGxl, "gbody0.pcx", _introGbodyImage, 0, 0);
 
@@ -393,7 +390,7 @@ void WaynesWorldEngine::introPt4_sub1() {
 	paletteFadeIn(0, 256, 2);
 }
 
-bool WaynesWorldEngine::introPt4_sub2() {
+bool WaynesWorldEngine::introPt4_intro() {
 	_sound->playSound("sv27.snd", false);
 
 	for (int i = 0; i < 12; ++i) {
@@ -435,7 +432,7 @@ bool WaynesWorldEngine::introPt4_sub2() {
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
-bool WaynesWorldEngine::introPt4_sub3() {
+bool WaynesWorldEngine::introPt4_displayCallInTime() {
 	WWSurface *pt4Sub3Surface1 = new WWSurface(178, 21);
 	WWSurface *pt4Sub3Surface2 = new WWSurface(178, 21);
 	pt4Sub3Surface2->clear(0);
@@ -454,7 +451,7 @@ bool WaynesWorldEngine::introPt4_sub3() {
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
-bool WaynesWorldEngine::introPt4_sub4() {
+bool WaynesWorldEngine::introPt4_caller1() {
 	for (int i = 0; i < 3; ++i) {
 		for (int j = 0; j < 15; ++j) {
 			int index = getRandom(3);
@@ -559,7 +556,7 @@ bool WaynesWorldEngine::introPt4_sub4() {
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
-bool WaynesWorldEngine::introPt4_sub5() {
+bool WaynesWorldEngine::introPt4_caller2() {
 	for (int i = 0; i < 4; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(2);
@@ -635,7 +632,7 @@ bool WaynesWorldEngine::introPt4_sub5() {
 	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
-bool WaynesWorldEngine::introPt4_sub6() {
+bool WaynesWorldEngine::introPt4_caller3() {
 	for (int i = 0; i < 5; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(3);
@@ -695,7 +692,7 @@ bool WaynesWorldEngine::introPt4_sub6() {
 	return true;
 }
 
-bool WaynesWorldEngine::introPt4_sub7() {
+bool WaynesWorldEngine::introPt4_caller4() {
 	for (int j = 0; j < 2; ++j) {
 		for (int i = 0; i < 15; ++i) {
 			int index = getRandom(3);
@@ -804,13 +801,13 @@ bool WaynesWorldEngine::introPt4_sub7() {
 	return true;
 }
 
-void WaynesWorldEngine::introPt4_sub8() {
+void WaynesWorldEngine::introPt4_cleanup() {
 	delete _fontWW;
 	_fontWW = nullptr;
 	delete _introBackg1Image;
 	_introBackg1Image = nullptr;
-	delete _introWbodyImage;
-	_introWbodyImage = nullptr;
+	delete _introWbodyImage[0];
+	_introWbodyImage[0] = nullptr;
 	delete _introGbodyImage;
 	_introGbodyImage = nullptr;
 	for (int i = 0; i < 7; ++i) {
@@ -823,8 +820,22 @@ void WaynesWorldEngine::introPt4_sub8() {
 	}
 }
 
-bool WaynesWorldEngine::introPt4_sub9() {
-	warning("STUB - intro 4 pt 9");
+bool WaynesWorldEngine::introPt4_playGuitar() {
+	for (int i = 1; i < 5; ++i) {
+		_introWbodyImage[i] = new WWSurface(145, 118);
+		Common::String filename = Common::String::format("wbody%d.pcx", i);
+		drawImageToSurface(_oanGxl, filename.c_str(), _introWbodyImage[i], 0, 0);
+	}
+
+	sub2FEFB(1, 1, 1, 0, 9, -1);
+	sub2FEFB(1, 2, 1, 0, 9, -1);
+	sub2FEFB(1, 3, 1, 0, 9, -1);
+	sub2FEFB(1, 4, 1, 0, 9, -1);
+
+	for (int i = 1; i < 5; ++i) {
+		delete _introWbodyImage[i];
+		_introWbodyImage[i] = nullptr;
+	}
 	
 	_midi->stopSong();
 	// TODO add a check at each step to return false if ESC is pressed
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 3c92a700a73..28a9ca21417 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -123,7 +123,7 @@ private:
 	bool introPt4();
 
 	WWSurface *_introBackg1Image = nullptr;
-	WWSurface *_introWbodyImage = nullptr;
+	WWSurface *_introWbodyImage[5] = {nullptr};
 	WWSurface *_introGbodyImage = nullptr;
 	WWSurface *_introWhead1[8] = {nullptr};
 	WWSurface *_introGhead1[11] = {nullptr};
@@ -140,15 +140,15 @@ private:
 	void sub3009A(int textId);
 	void sub2FEFB(int arg_refreshBackgFl, int arg_wBodyIndex, int arg_gBodyIndex, int arg_wHead1Index, int arg_gHead1Index, int arg_TextId);
 
-	void introPt4_sub1();
-	bool introPt4_sub2();
-	bool introPt4_sub3();
-	bool introPt4_sub4();
-	bool introPt4_sub5();
-	bool introPt4_sub6();
-	bool introPt4_sub7();
-	void introPt4_sub8();
-	bool introPt4_sub9();
+	void introPt4_init();
+	bool introPt4_intro();
+	bool introPt4_displayCallInTime();
+	bool introPt4_caller1();
+	bool introPt4_caller2();
+	bool introPt4_caller3();
+	bool introPt4_caller4();
+	void introPt4_cleanup();
+	bool introPt4_playGuitar();
 
 	WWSurface *_demoPt2Surface = nullptr;
 	WWSurface *_backg2Surface = nullptr;


Commit: 421690fd6866bac1a4774cd7d0902b28a9d3f050
    https://github.com/scummvm/scummvm/commit/421690fd6866bac1a4774cd7d0902b28a9d3f050
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:57+01:00

Commit Message:
WAYNESWORLD: Fix an original bug (ab-use of freed memory)

Changed paths:
    engines/waynesworld/intro.cpp


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index 183aae72ba4..e2d4b03d98e 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -275,12 +275,10 @@ bool WaynesWorldEngine::introPt4() {
 		retVal = false;
 	} else if (!introPt4_caller4()) {
 		retVal = false;
-	}
-	
-	introPt4_cleanup();
-
-	if (retVal)
+	} else
 		retVal = introPt4_playGuitar();
+
+	introPt4_cleanup();
 	
 	return retVal;
 }
@@ -369,8 +367,11 @@ void WaynesWorldEngine::introPt4_init() {
 
 	_introBackg1Image = new WWSurface(320, 170);
 	drawImageToSurface(_oanGxl, "backg1.pcx", _introBackg1Image, 0, 0);
-	_introWbodyImage[0] = new WWSurface(145, 118);
-	drawImageToSurface(_oanGxl, "wbody0.pcx", _introWbodyImage[0], 0, 0);
+	for (int i = 0; i < 5; ++i) {
+		_introWbodyImage[i] = new WWSurface(145, 118);
+		Common::String filename = Common::String::format("wbody%d.pcx", i == 0 ? 0 : i + 8);
+		drawImageToSurface(_oanGxl, filename.c_str(), _introWbodyImage[i], 0, 0);
+	}
 	_introGbodyImage = new WWSurface(160, 149);
 	drawImageToSurface(_oanGxl, "gbody0.pcx", _introGbodyImage, 0, 0);
 
@@ -806,8 +807,10 @@ void WaynesWorldEngine::introPt4_cleanup() {
 	_fontWW = nullptr;
 	delete _introBackg1Image;
 	_introBackg1Image = nullptr;
-	delete _introWbodyImage[0];
-	_introWbodyImage[0] = nullptr;
+	for (int i = 0; i < 5; ++i) {
+		delete _introWbodyImage[i];
+		_introWbodyImage[i] = nullptr;
+	}
 	delete _introGbodyImage;
 	_introGbodyImage = nullptr;
 	for (int i = 0; i < 7; ++i) {
@@ -821,21 +824,10 @@ void WaynesWorldEngine::introPt4_cleanup() {
 }
 
 bool WaynesWorldEngine::introPt4_playGuitar() {
-	for (int i = 1; i < 5; ++i) {
-		_introWbodyImage[i] = new WWSurface(145, 118);
-		Common::String filename = Common::String::format("wbody%d.pcx", i);
-		drawImageToSurface(_oanGxl, filename.c_str(), _introWbodyImage[i], 0, 0);
-	}
-
 	sub2FEFB(1, 1, 1, 0, 9, -1);
 	sub2FEFB(1, 2, 1, 0, 9, -1);
 	sub2FEFB(1, 3, 1, 0, 9, -1);
 	sub2FEFB(1, 4, 1, 0, 9, -1);
-
-	for (int i = 1; i < 5; ++i) {
-		delete _introWbodyImage[i];
-		_introWbodyImage[i] = nullptr;
-	}
 	
 	_midi->stopSong();
 	// TODO add a check at each step to return false if ESC is pressed


Commit: aaf767a2a36a9d0ecb13e88ce63a2de00b0d16d2
    https://github.com/scummvm/scummvm/commit/aaf767a2a36a9d0ecb13e88ce63a2de00b0d16d2
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:57+01:00

Commit Message:
WAYNESWORLD: Remove useless variables used to store random indexes

Changed paths:
    engines/waynesworld/intro.cpp


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index e2d4b03d98e..81c5d4a9851 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -395,8 +395,7 @@ bool WaynesWorldEngine::introPt4_intro() {
 	_sound->playSound("sv27.snd", false);
 
 	for (int i = 0; i < 12; ++i) {
-		int index = getRandom(3);
-		sub2FEFB(1, 0, 1, index, 9, 0);
+		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 
 	++_startOawPos;
@@ -406,8 +405,7 @@ bool WaynesWorldEngine::introPt4_intro() {
 	_sound->playSound("sv25.snd", false);
 
 	for (int i = 0; i < 8; ++i) {
-		int index = getRandom(3);
-		sub2FEFB(1, 0, 1, index, 9, 0);
+		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 
 	++_startOawPos;
@@ -417,15 +415,13 @@ bool WaynesWorldEngine::introPt4_intro() {
 	_sound->playSound("sv20.snd", false);
 
 	for (int i = 0; i < 5; ++i) {
-		int index = getRandom(11);
-		sub2FEFB(1, 0, 1, 0, index, 1);
+		sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
 	}
 	
 	++_startOagPos;
 
 	for (int i = 0; i < 15; ++i) {
-		int index = getRandom(3);
-		sub2FEFB(1, 0, 1, index, 9, 0);
+		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 
 	++_startOawPos;
@@ -455,29 +451,25 @@ bool WaynesWorldEngine::introPt4_displayCallInTime() {
 bool WaynesWorldEngine::introPt4_caller1() {
 	for (int i = 0; i < 3; ++i) {
 		for (int j = 0; j < 15; ++j) {
-			int index = getRandom(3);
-			sub2FEFB(1, 0, 1, index, 9, 0);
+			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 		}
 		++_startOawPos;
 	}
 
 	for (int i = 0; i < 3; ++i) {
 		for (int j = 0; j < 5; ++j) {
-			int index = getRandom(11);
-			sub2FEFB(1, 0, 1, 0, index, 1);
+			sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
 		}
 		++_startOagPos;
 		for (int j = 0; j < 10; ++j) {
-			int index = getRandom(3);
-			sub2FEFB(1, 0, 1, index, 9, 0);
+			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 		}
 		++_startOawPos;
 	}
 
 	_sound->playSound("sv33.snd", 0);
 	for (int j = 0; j < 10; ++j) {
-		int index = getRandom(3);
-		sub2FEFB(1, 0, 1, index, 9, 0);
+		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 	++_startOawPos;
 
@@ -489,8 +481,7 @@ bool WaynesWorldEngine::introPt4_caller1() {
 	_sound->playSound("sv38.snd", 0);
 
 	for (int j = 0; j < 10; ++j) {
-		int index = getRandom(3);
-		sub2FEFB(1, 0, 1, index, 9, 0);
+		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 	++_startOawPos;
 
@@ -500,8 +491,7 @@ bool WaynesWorldEngine::introPt4_caller1() {
 	}
 
 	for (int j = 0; j < 15; ++j) {
-		int index = getRandom(11);
-		sub2FEFB(1, 0, 1, 0, index, 1);
+		sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
 	}
 	++_startOagPos;
 	_sound->playSound("sv31.snd", 0);
@@ -513,16 +503,14 @@ bool WaynesWorldEngine::introPt4_caller1() {
 
 	for (int i = 0; i < 2; ++i) {
 		for (int j = 0; j < 10; ++j) {
-			int index = getRandom(3);
-			sub2FEFB(1, 0, 1, index, 9, 0);
+			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 		}
 		++_startOawPos;
 	}
 	_sound->playSound("sv28.snd", 0);
 
 	for (int j = 0; j < 5; ++j) {
-		int index = getRandom(3);
-		sub2FEFB(1, 0, 1, index, 9, 0);
+		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 	++_startOawPos;
 	_sound->playSound("sv21.snd", 0);
@@ -534,8 +522,7 @@ bool WaynesWorldEngine::introPt4_caller1() {
 
 	for (int i = 0; i < 3; ++i) {
 		for (int j = 0; j < 15; ++j) {
-			int index = getRandom(3);
-			sub2FEFB(1, 0, 1, index, 9, 0);
+			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 		}
 		++_startOawPos;
 	}
@@ -548,8 +535,7 @@ bool WaynesWorldEngine::introPt4_caller1() {
 
 	for (int i = 0; i < 3; ++i) {
 		for (int j = 0; j < 10; ++j) {
-			int index = getRandom(3);
-			sub2FEFB(1, 0, 1, index, 9, 0);
+			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 		}
 		++_startOawPos;
 	}
@@ -567,8 +553,7 @@ bool WaynesWorldEngine::introPt4_caller2() {
 
 	for (int i = 0; i < 4; ++i) {
 		for (int j = 0; j < 10; ++j) {
-			int index = getRandom(11);
-			sub2FEFB(1, 0, 1, 0, index, 1);
+			sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
 		}
 		++_startOagPos;
 	}
@@ -579,8 +564,7 @@ bool WaynesWorldEngine::introPt4_caller2() {
 	}
 
 	for (int j = 0; j < 10; ++j) {
-		int index = getRandom(3);
-		sub2FEFB(1, 0, 1, index, 9, 0);
+		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 	++_startOawPos;
 	sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
@@ -588,8 +572,7 @@ bool WaynesWorldEngine::introPt4_caller2() {
 
 	for (int i = 0; i < 3; ++i) {
 		for (int j = 0; j < 10; ++j) {
-			int index = getRandom(11);
-			sub2FEFB(1, 0, 1, 0, index, 1);
+			sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
 		}
 		++_startOagPos;
 	}
@@ -602,8 +585,7 @@ bool WaynesWorldEngine::introPt4_caller2() {
 	_sound->playSound("sv15.snd", false);
 
 	for (int j = 0; j < 10; ++j) {
-		int index = getRandom(3);
-		sub2FEFB(1, 0, 1, index, 9, 0);
+		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 	++_startOawPos;
 
@@ -615,8 +597,7 @@ bool WaynesWorldEngine::introPt4_caller2() {
 
 	for (int i = 0; i < 3; ++i) {
 		for (int j = 0; j < 10; ++j) {
-			int index = getRandom(11);
-			sub2FEFB(1, 0, 1, 0, index, 1);
+			sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
 		}
 		++_startOagPos;
 	}
@@ -624,8 +605,7 @@ bool WaynesWorldEngine::introPt4_caller2() {
 
 	for (int i = 0; i < 2; ++i) {
 		for (int j = 0; j < 10; ++j) {
-			int index = getRandom(3);
-			sub2FEFB(1, 0, 1, index, 9, 0);
+			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 		}
 		++_startOawPos;
 	}
@@ -640,8 +620,7 @@ bool WaynesWorldEngine::introPt4_caller3() {
 	}
 
 	for (int i = 0; i < 10; ++i) {
-		int index = getRandom(3);
-		sub2FEFB(1, 0, 1, index, 9, 0);
+		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 	++_startOawPos;
 
@@ -654,8 +633,7 @@ bool WaynesWorldEngine::introPt4_caller3() {
 
 	for (int j = 0; j < 2; ++j) {
 		for (int i = 0; i < 15; ++i) {
-			int index = getRandom(3);
-			sub2FEFB(1, 0, 1, index, 9, 0);
+			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 		}
 		++_startOawPos;
 	}
@@ -676,8 +654,7 @@ bool WaynesWorldEngine::introPt4_caller3() {
 
 	for (int j = 0; j < 4; ++j) {
 		for (int i = 0; i < 15; ++i) {
-			int index = getRandom(3);
-			sub2FEFB(1, 0, 1, index, 9, 0);
+			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 		}
 		++_startOawPos;
 	}
@@ -696,8 +673,7 @@ bool WaynesWorldEngine::introPt4_caller3() {
 bool WaynesWorldEngine::introPt4_caller4() {
 	for (int j = 0; j < 2; ++j) {
 		for (int i = 0; i < 15; ++i) {
-			int index = getRandom(3);
-			sub2FEFB(1, 0, 1, index, 9, 0);
+			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 		}
 		++_startOawPos;
 	}
@@ -706,15 +682,13 @@ bool WaynesWorldEngine::introPt4_caller4() {
 	waitSeconds(2);
 
 	for (int i = 0; i < 15; ++i) {
-		int index = getRandom(3);
-		sub2FEFB(1, 0, 1, index, 9, 0);
+		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 	++_startOawPos;
 	
 	for (int j = 0; j < 2; ++j) {
 		for (int i = 0; i < 15; ++i) {
-			int index = getRandom(11);
-			sub2FEFB(1, 0, 1, 0, index, 1);
+			sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
 		}
 		++_startOagPos;
 	}
@@ -723,8 +697,7 @@ bool WaynesWorldEngine::introPt4_caller4() {
 	_sound->playSound("sv24.snd", true);
 
 	for (int i = 0; i < 15; ++i) {
-		int index = getRandom(3);
-		sub2FEFB(1, 0, 1, index, 9, 0);
+		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 	++_startOawPos;
 
@@ -734,8 +707,7 @@ bool WaynesWorldEngine::introPt4_caller4() {
 	_sound->playSound("sv06.snd", false);
 
 	for (int i = 0; i < 3; ++i) {
-		int index = getRandom(3);
-		sub2FEFB(1, 0, 1, index, 9, 0);
+		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 	++_startOawPos;
 
@@ -746,8 +718,7 @@ bool WaynesWorldEngine::introPt4_caller4() {
 	_sound->playSound("sv32.snd", false);
 
 	for (int i = 0; i < 5; ++i) {
-		int index = getRandom(11);
-		sub2FEFB(1, 0, 1, 0, index, 1);
+		sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
 	}
 	++_startOagPos;
 
@@ -756,8 +727,7 @@ bool WaynesWorldEngine::introPt4_caller4() {
 
 	for (int j = 0; j < 3; ++j) {
 		for (int i = 0; i < 8; ++i) {
-			int index = getRandom(3);
-			sub2FEFB(1, 0, 1, index, 9, 0);
+			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 		}
 		++_startOawPos;	
 	}
@@ -770,8 +740,7 @@ bool WaynesWorldEngine::introPt4_caller4() {
 	_sound->playSound("sv18.snd", false);
 
 	for (int i = 0; i < 8; ++i) {
-		int index = getRandom(3);
-		sub2FEFB(1, 0, 1, index, 9, 0);
+		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 	++_startOawPos;
 
@@ -784,8 +753,7 @@ bool WaynesWorldEngine::introPt4_caller4() {
 	
 	for (int j = 0; j < 3; ++j) {
 		for (int i = 0; i < 8; ++i) {
-			int index = getRandom(3);
-			sub2FEFB(1, 0, 1, index, 9, 0);
+			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 		}
 		++_startOawPos;
 	}
@@ -793,8 +761,7 @@ bool WaynesWorldEngine::introPt4_caller4() {
 	_sound->playSound("sv34.snd", false);
 
 	for (int i = 0; i < 5; ++i) {
-		int index = getRandom(11);
-		sub2FEFB(1, 0, 1, 0, index, 1);
+		sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
 	}
 	++_startOagPos;
 


Commit: 5211e364269b09720398569a152352156694b9ad
    https://github.com/scummvm/scummvm/commit/5211e364269b09720398569a152352156694b9ad
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:57+01:00

Commit Message:
WAYNESWORLD: Add a default PCX extension when missing in GLX handling

Changed paths:
    engines/waynesworld/gxlarchive.cpp


diff --git a/engines/waynesworld/gxlarchive.cpp b/engines/waynesworld/gxlarchive.cpp
index c05f66fa615..fb4c2adb729 100644
--- a/engines/waynesworld/gxlarchive.cpp
+++ b/engines/waynesworld/gxlarchive.cpp
@@ -123,8 +123,17 @@ Common::SeekableReadStream *GxlArchive::createReadStreamForMember(const Common::
 }
 
 Image::PCXDecoder *GxlArchive::loadImage(const char *filename) {
-	if (!hasFile(Common::Path(filename)))
+	const char *posDot = strrchr(filename, '.');
+	Common::String searchName;
+	if (!posDot)
+		searchName = Common::String::format("%s.PCX", filename);
+	else
+		searchName = Common::String(filename);
+	
+	Common::Path pathName = Common::Path(searchName);
+	if (!hasFile(pathName)) {
 		error("loadImage() Could not find '%s'", filename);
+	}
 
 	Image::PCXDecoder *pcx = new Image::PCXDecoder();
 	Common::SeekableReadStream *pcxStr = createReadStreamForMember(Common::Path(filename));


Commit: d76e47c9fd7d5a3d9911a21a62db5e53503b44ef
    https://github.com/scummvm/scummvm/commit/d76e47c9fd7d5a3d9911a21a62db5e53503b44ef
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:57+01:00

Commit Message:
WAYNESWORLD: Add skip to intro

Changed paths:
    engines/waynesworld/gxlarchive.cpp
    engines/waynesworld/intro.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gxlarchive.cpp b/engines/waynesworld/gxlarchive.cpp
index fb4c2adb729..62159452f05 100644
--- a/engines/waynesworld/gxlarchive.cpp
+++ b/engines/waynesworld/gxlarchive.cpp
@@ -131,9 +131,9 @@ Image::PCXDecoder *GxlArchive::loadImage(const char *filename) {
 		searchName = Common::String(filename);
 	
 	Common::Path pathName = Common::Path(searchName);
-	if (!hasFile(pathName)) {
+	if (!hasFile(pathName))
 		error("loadImage() Could not find '%s'", filename);
-	}
+
 
 	Image::PCXDecoder *pcx = new Image::PCXDecoder();
 	Common::SeekableReadStream *pcxStr = createReadStreamForMember(Common::Path(filename));
diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index 81c5d4a9851..a9e34d0b2e9 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -57,7 +57,11 @@ bool WaynesWorldEngine::introPt1() {
 	// "Paramount" background
 	drawImageToScreen(oa2Gxl, "paramnt.pcx", 0, 0);
 	waitSeconds(1);
-
+	if (_escPressed) {
+		delete oa2Gxl;
+		return false;
+	}
+	
 	WWSurface *paramaSprite = new WWSurface(190, 112);
 	// "And" animation
 	drawImageToSurface(oa2Gxl, "parama.pcx", paramaSprite, 0, 0);
@@ -65,12 +69,21 @@ bool WaynesWorldEngine::introPt1() {
 	delete paramaSprite;
 
 	waitSeconds(2);
+	if (_escPressed) {
+		delete oa2Gxl;
+		return false;
+	}
 
 	paletteFadeOut(0, 256, 6);
 
 	loadPalette(oa2Gxl, "backg.pcx");
 	drawImageToScreen(oa2Gxl, "backg.pcx", 0, 0);
 
+	if (_escPressed) {
+		delete oa2Gxl;
+		return false;
+	}
+
 	// "Capstone logo" animation
 	for (int i = 1; i < 29; ++i) {
 		Common::String filename = Common::String::format("cap%02d.pcx", i);
@@ -78,6 +91,10 @@ bool WaynesWorldEngine::introPt1() {
 		waitMillis(30);
 	}
 	waitSeconds(1);
+	if (_escPressed) {
+		delete oa2Gxl;
+		return false;
+	}
 
 	// "The pinnacle of entertainment software" animation
 	for (int i = 1; i < 10; ++i) {
@@ -86,6 +103,10 @@ bool WaynesWorldEngine::introPt1() {
 		waitMillis(30);
 	}
 	waitSeconds(1);
+	if (_escPressed) {
+		delete oa2Gxl;
+		return false;
+	}
 
 	// Shining "Capstone" animation
 	for (int i = 1; i < 12; ++i) {
@@ -94,6 +115,10 @@ bool WaynesWorldEngine::introPt1() {
 		waitMillis(30);
 	}
 	waitSeconds(1);
+	if (_escPressed) {
+		delete oa2Gxl;
+		return false;
+	}
 
 	// Removing "The pinnacle of entertainment software" animation
 	for (int i = 9; i > 0; --i) {
@@ -101,22 +126,38 @@ bool WaynesWorldEngine::introPt1() {
 		drawImageToScreen(oa2Gxl, filename.c_str(), 0, 138);
 		waitMillis(30);
 	}
+	if (_escPressed) {
+		delete oa2Gxl;
+		return false;
+	}
 
 	drawImageToScreen(oa2Gxl, "txtbkg.pcx", 0, 138);
 	waitMillis(30);
 	waitSeconds(1);
+	if (_escPressed) {
+		delete oa2Gxl;
+		return false;
+	}
 
 	for (int i = 1; i < 7; ++i) {
 		Common::String filename = Common::String::format("capsp%02d.pcx", i);
 		drawImageToScreen(oa2Gxl, filename.c_str(), 76, 66);
 		waitMillis(30);
 	}
+	if (_escPressed) {
+		delete oa2Gxl;
+		return false;
+	}
 
 	for (int i = 1; i < 12; ++i) {
 		Common::String filename = Common::String::format("presnt%02d.pcx", i);
 		drawImageToScreen(oa2Gxl, filename.c_str(), 117, 112);
 		waitMillis(60);
 	}
+	if (_escPressed) {
+		delete oa2Gxl;
+		return false;
+	}
 
 	for (int i = 1; i < 9; ++i) {
 		Common::String filename = Common::String::format("capawy%02d.pcx", i);
@@ -125,8 +166,10 @@ bool WaynesWorldEngine::introPt1() {
 	}
 
 	delete oa2Gxl;
+	if (_escPressed) {
+		return false;
+	}
 
-	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
 
@@ -201,6 +244,12 @@ void WaynesWorldEngine::wwEffect(int arg0, int arg1, bool flag) {
 	waitMillis(200);
 }
 
+void WaynesWorldEngine::cleanPt3() {
+	delete _outlineSurface;
+	delete _logoSurface;
+	delete _backg2Surface;
+}
+
 bool WaynesWorldEngine::introPt3(bool flag) {
 	// sub1
 	_backg2Surface = new WWSurface(320, 170);
@@ -217,10 +266,19 @@ bool WaynesWorldEngine::introPt3(bool flag) {
 	if (flag)
 		waitSeconds(1);
 
+	if (_escPressed) {
+		cleanPt3();
+		return false;
+	}
+
 	_sound->playSound("sv42.snd", false);
 	wwEffect(1, 1, flag);
 	wwEffect(1, 2, flag);
 	wwEffect(1, 3, flag);
+	if (_escPressed) {
+		cleanPt3();
+		return false;
+	}
 
 	byte newColor[3] = {0, 0, 0};
 	static byte rArr[] = { 9,  9,  9,  9, 43, 43, 53, 63, 63, 63, 63, 63, 63, 63, 45, 28,  9,  9,  9};
@@ -235,12 +293,21 @@ bool WaynesWorldEngine::introPt3(bool flag) {
 
 		g_system->getPaletteManager()->setPalette((const byte *)&newColor, 236, 1);
 		wwEffect((i % 8) + 1, 4, flag);
+
+		if (_escPressed) {
+			cleanPt3();
+			return false;
+		}
 	}
 
 	wwEffect(1, 3, flag);
 	wwEffect(1, 2, flag);
 	wwEffect(1, 1, flag);
 	wwEffect(1, 0, flag);
+	if (_escPressed) {
+		cleanPt3();
+		return false;
+	}
 
 	while (_sound->isSFXPlaying())
 		waitMillis(30);
@@ -248,14 +315,14 @@ bool WaynesWorldEngine::introPt3(bool flag) {
 	_sound->playSound("sv16.snd", false);
 
 	waitSeconds(1);
-	
 	paletteFadeOut(0, 256, 4); 
 	
-	delete _outlineSurface;
-	delete _logoSurface;
-	delete _backg2Surface;
+	cleanPt3();
+
+	if (_escPressed) {
+		return false;
+	}
 
-	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
 
@@ -398,7 +465,11 @@ bool WaynesWorldEngine::introPt4_intro() {
 		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
 
+	if (_escPressed) {
+		return false;
+	}
 	++_startOawPos;
+
 	while (_sound->isSFXPlaying())
 		waitMillis(30);
 	
@@ -407,8 +478,12 @@ bool WaynesWorldEngine::introPt4_intro() {
 	for (int i = 0; i < 8; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
-
 	++_startOawPos;
+
+	if (_escPressed) {
+		return false;
+	}
+
 	while (_sound->isSFXPlaying())
 		waitMillis(30);
 
@@ -417,16 +492,21 @@ bool WaynesWorldEngine::introPt4_intro() {
 	for (int i = 0; i < 5; ++i) {
 		sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
 	}
-	
 	++_startOagPos;
 
+	if (_escPressed) {
+		return false;
+	}
+
 	for (int i = 0; i < 15; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
 	}
-
 	++_startOawPos;
+
+	if (_escPressed) {
+		return false;
+	}
 	
-	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
 bool WaynesWorldEngine::introPt4_displayCallInTime() {
@@ -438,20 +518,32 @@ bool WaynesWorldEngine::introPt4_displayCallInTime() {
 	for (int i = 0; i < 5; ++i) {
 		drawImageToScreen(_oanGxl, "backg1.pcx", 0, 15);
 		waitMillis(500);
+		if (_escPressed) {
+			break;
+		}
 		_screen->drawSurfaceTransparent(pt4Sub3Surface1, 66, 157);
 		waitMillis(500);
+		if (_escPressed) {
+			break;
+		}
 	}
 
 	delete pt4Sub3Surface1;
 	delete pt4Sub3Surface2;
 
-	// TODO add a check at each step to return false if ESC is pressed
+	if (_escPressed) {
+		return false;
+	}
+
 	return true;
 }
 bool WaynesWorldEngine::introPt4_caller1() {
 	for (int i = 0; i < 3; ++i) {
 		for (int j = 0; j < 15; ++j) {
 			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOawPos;
 	}
@@ -459,10 +551,16 @@ bool WaynesWorldEngine::introPt4_caller1() {
 	for (int i = 0; i < 3; ++i) {
 		for (int j = 0; j < 5; ++j) {
 			sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOagPos;
 		for (int j = 0; j < 10; ++j) {
 			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOawPos;
 	}
@@ -470,28 +568,43 @@ bool WaynesWorldEngine::introPt4_caller1() {
 	_sound->playSound("sv33.snd", 0);
 	for (int j = 0; j < 10; ++j) {
 		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOawPos;
 
 	for (int i = 0; i < 2; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(2);
+		if (_escPressed) {
+			return false;
+		}
 	}
 
 	_sound->playSound("sv38.snd", 0);
 
 	for (int j = 0; j < 10; ++j) {
 		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOawPos;
 
 	for (int i = 0; i < 3; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(2);
+		if (_escPressed) {
+			return false;
+		}
 	}
 
 	for (int j = 0; j < 15; ++j) {
 		sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOagPos;
 	_sound->playSound("sv31.snd", 0);
@@ -499,11 +612,17 @@ bool WaynesWorldEngine::introPt4_caller1() {
 	for (int i = 0; i < 3; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(2);
+		if (_escPressed) {
+			return false;
+		}
 	}
 
 	for (int i = 0; i < 2; ++i) {
 		for (int j = 0; j < 10; ++j) {
 			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOawPos;
 	}
@@ -511,6 +630,9 @@ bool WaynesWorldEngine::introPt4_caller1() {
 
 	for (int j = 0; j < 5; ++j) {
 		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOawPos;
 	_sound->playSound("sv21.snd", 0);
@@ -518,11 +640,17 @@ bool WaynesWorldEngine::introPt4_caller1() {
 	for (int i = 0; i < 3; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(2);
+		if (_escPressed) {
+			return false;
+		}
 	}
 
 	for (int i = 0; i < 3; ++i) {
 		for (int j = 0; j < 15; ++j) {
 			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOawPos;
 	}
@@ -536,17 +664,25 @@ bool WaynesWorldEngine::introPt4_caller1() {
 	for (int i = 0; i < 3; ++i) {
 		for (int j = 0; j < 10; ++j) {
 			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOawPos;
 	}
 
-	// TODO add a check at each step to return false if ESC is pressed
+	if (_escPressed) {
+		return false;
+	}
 	return true;
 }
 bool WaynesWorldEngine::introPt4_caller2() {
 	for (int i = 0; i < 4; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(2);
+		if (_escPressed) {
+			return false;
+		}
 		if (i == 2)
 			_sound->playSound("sv19.snd", false);
 	}
@@ -554,6 +690,9 @@ bool WaynesWorldEngine::introPt4_caller2() {
 	for (int i = 0; i < 4; ++i) {
 		for (int j = 0; j < 10; ++j) {
 			sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOagPos;
 	}
@@ -561,18 +700,31 @@ bool WaynesWorldEngine::introPt4_caller2() {
 	for (int i = 0; i < 4; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(2);
+		if (_escPressed) {
+			return false;
+		}
 	}
 
 	for (int j = 0; j < 10; ++j) {
 		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOawPos;
+
 	sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 	waitSeconds(2);
+	if (_escPressed) {
+		return false;
+	}
 
 	for (int i = 0; i < 3; ++i) {
 		for (int j = 0; j < 10; ++j) {
 			sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOagPos;
 	}
@@ -581,23 +733,35 @@ bool WaynesWorldEngine::introPt4_caller2() {
 	for (int i = 0; i < 2; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(2);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	_sound->playSound("sv15.snd", false);
 
 	for (int j = 0; j < 10; ++j) {
 		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOawPos;
 
 	for (int i = 0; i < 4; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(2);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	_sound->playSound("sv30.snd", false);
 
 	for (int i = 0; i < 3; ++i) {
 		for (int j = 0; j < 10; ++j) {
 			sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOagPos;
 	}
@@ -606,26 +770,40 @@ bool WaynesWorldEngine::introPt4_caller2() {
 	for (int i = 0; i < 2; ++i) {
 		for (int j = 0; j < 10; ++j) {
 			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOawPos;
 	}
 	
-	// TODO add a check at each step to return false if ESC is pressed
+	if (_escPressed) {
+		return false;
+	}
 	return true;
 }
 bool WaynesWorldEngine::introPt4_caller3() {
 	for (int i = 0; i < 5; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(3);
+		if (_escPressed) {
+			return false;
+		}
 	}
 
 	for (int i = 0; i < 10; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOawPos;
 
 	for (int i = 0; i < 5; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 0);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOawPos;
 	++_startOagPos;
@@ -634,6 +812,9 @@ bool WaynesWorldEngine::introPt4_caller3() {
 	for (int j = 0; j < 2; ++j) {
 		for (int i = 0; i < 15; ++i) {
 			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOawPos;
 	}
@@ -642,6 +823,9 @@ bool WaynesWorldEngine::introPt4_caller3() {
 
 	for (int i = 0; i < 5; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 0);
+		if (_escPressed) {
+			return false;
+		}
 	}
 
 	++_startOawPos;
@@ -650,11 +834,17 @@ bool WaynesWorldEngine::introPt4_caller3() {
 	for (int i = 0; i < 2; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(2);
+		if (_escPressed) {
+			return false;
+		}
 	}
 
 	for (int j = 0; j < 4; ++j) {
 		for (int i = 0; i < 15; ++i) {
 			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOawPos;
 	}
@@ -662,11 +852,13 @@ bool WaynesWorldEngine::introPt4_caller3() {
 
 	for (int i = 0; i < 8; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 0);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOawPos;
 	++_startOagPos;
 
-	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
 
@@ -674,21 +866,33 @@ bool WaynesWorldEngine::introPt4_caller4() {
 	for (int j = 0; j < 2; ++j) {
 		for (int i = 0; i < 15; ++i) {
 			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOawPos;
 	}
 
 	sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 	waitSeconds(2);
+	if (_escPressed) {
+		return false;
+	}
 
 	for (int i = 0; i < 15; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOawPos;
 	
 	for (int j = 0; j < 2; ++j) {
 		for (int i = 0; i < 15; ++i) {
 			sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOagPos;
 	}
@@ -698,36 +902,57 @@ bool WaynesWorldEngine::introPt4_caller4() {
 
 	for (int i = 0; i < 15; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOawPos;
 
 	sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 	waitSeconds(2);
+	if (_escPressed) {
+		return false;
+	}
 
 	_sound->playSound("sv06.snd", false);
 
 	for (int i = 0; i < 3; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOawPos;
 
 	for (int i = 0; i < 2; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(2);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	_sound->playSound("sv32.snd", false);
 
 	for (int i = 0; i < 5; ++i) {
 		sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOagPos;
 
 	sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 	waitSeconds(1);
+	if (_escPressed) {
+		return false;
+	}
 
 	for (int j = 0; j < 3; ++j) {
 		for (int i = 0; i < 8; ++i) {
 			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOawPos;	
 	}
@@ -735,18 +960,27 @@ bool WaynesWorldEngine::introPt4_caller4() {
 	for (int i = 0; i < 8; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(2);
+		if (_escPressed) {
+			return false;
+		}
 	}
 
 	_sound->playSound("sv18.snd", false);
 
 	for (int i = 0; i < 8; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOawPos;
 
 	for (int i = 0; i < 6; ++i) {
 		sub2FEFB(1, 0, 1, getRandom(3), getRandom(11), 2);
 		waitSeconds(2);
+		if (_escPressed) {
+			return false;
+		}
 	}
 
 	_sound->playSound("sv45.snd", true);
@@ -754,6 +988,9 @@ bool WaynesWorldEngine::introPt4_caller4() {
 	for (int j = 0; j < 3; ++j) {
 		for (int i = 0; i < 8; ++i) {
 			sub2FEFB(1, 0, 1, getRandom(3), 9, 0);
+			if (_escPressed) {
+				return false;
+			}
 		}
 		++_startOawPos;
 	}
@@ -762,10 +999,12 @@ bool WaynesWorldEngine::introPt4_caller4() {
 
 	for (int i = 0; i < 5; ++i) {
 		sub2FEFB(1, 0, 1, 0, getRandom(11), 1);
+		if (_escPressed) {
+			return false;
+		}
 	}
 	++_startOagPos;
 
-	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
 
@@ -797,7 +1036,11 @@ bool WaynesWorldEngine::introPt4_playGuitar() {
 	sub2FEFB(1, 4, 1, 0, 9, -1);
 	
 	_midi->stopSong();
-	// TODO add a check at each step to return false if ESC is pressed
+
+	if (_escPressed) {
+		return false;
+	}
+
 	return true;
 }
 
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 795b356caef..a98753c23e4 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -89,7 +89,7 @@ Common::Error WaynesWorldEngine::run() {
 	syncSoundSettings();
 
 	runIntro();
-
+	_introOngoing = false;
 	_fontWW = new GFTFont();
 	_fontWWInv = new GFTFont();
 	_fontBit5x7 = new GFTFont();
@@ -215,6 +215,9 @@ void WaynesWorldEngine::updateEvents() {
 		switch (event.type) {
 		case Common::EVENT_KEYDOWN:
 			_keyCode = event.kbd.keycode;
+			if (_keyCode == Common::KEYCODE_ESCAPE && _introOngoing) {
+				_escPressed = true;
+			}
 			break;
 		case Common::EVENT_KEYUP:
 			_keyCode = Common::KEYCODE_INVALID;
@@ -266,7 +269,7 @@ int WaynesWorldEngine::getRandom(int max) {
 
 void WaynesWorldEngine::waitMillis(uint millis) {
 	const uint32 waitTime = _system->getMillis() + millis;
-	while (_system->getMillis() < waitTime && !shouldQuit()) {
+	while (_system->getMillis() < waitTime && !shouldQuit() && !(_introOngoing && _escPressed)) {
 		updateEvents();
 		_system->updateScreen();
 		_system->delayMillis(10);
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 28a9ca21417..f5e6743eabe 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -109,6 +109,9 @@ public:
 	bool _isSoundEnabled = true;
 	bool _isMusicEnabled = true;
 
+	bool _introOngoing = true;
+	bool _escPressed = false;
+
 private:
 	Graphics::PixelFormat _pixelFormat;
 
@@ -116,7 +119,8 @@ private:
 	Common::String _oldGUILanguage;
 #endif
 	void wwEffect(int arg0, int arg1, bool flag);
-	
+	void cleanPt3();
+
 	bool introPt1();
 	bool introPt2();
 	bool introPt3(bool flag);


Commit: 2440f944c8b2456ddf6e12ed775853468d31158a
    https://github.com/scummvm/scummvm/commit/2440f944c8b2456ddf6e12ed775853468d31158a
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:57+01:00

Commit Message:
WAYNESWORLD: Rework runIntro to have a better flow, fix dirty line ingame

Changed paths:
    engines/waynesworld/intro.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index a9e34d0b2e9..7182a61cbe4 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -30,16 +30,26 @@
 namespace WaynesWorld {
 
 void WaynesWorldEngine::runIntro() {
-	if (!introPt1())
-		return;
-	if (!introPt2())
-		return;
-	if (!introPt3(false))
-		return;
-	if (!introPt4())
-		return;
-	if (!introPt3(true))
-		return;
+	bool continueFl = introPt1();
+
+	if (continueFl)
+		continueFl = introPt2();
+	
+	if (continueFl)
+		continueFl = introPt3(false);
+	
+	if (continueFl)
+		continueFl = introPt4();
+
+	if (continueFl)
+		continueFl = introPt3(false);
+
+	introPt5();
+
+	if (continueFl)
+		introPt6();
+
+	introPt7();
 }
 
 bool WaynesWorldEngine::introPt1() {
@@ -350,6 +360,21 @@ bool WaynesWorldEngine::introPt4() {
 	return retVal;
 }
 
+void WaynesWorldEngine::introPt5() {
+	delete _oanGxl;
+	_oanGxl = nullptr;
+}
+
+void WaynesWorldEngine::introPt6() {
+	warning("STUB - Intro pt 6");
+}
+
+void WaynesWorldEngine::introPt7() {
+	_midi->stopSong();
+	paletteFadeOut(0, 256, 4);
+	_screen->clear(0);
+}
+
 void WaynesWorldEngine::sub3009A(int textId) {
 	int startPos;
 	int textColor;
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index f5e6743eabe..d6285f45fc7 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -125,6 +125,9 @@ private:
 	bool introPt2();
 	bool introPt3(bool flag);
 	bool introPt4();
+	void introPt5();
+	void introPt6();
+	void introPt7();
 
 	WWSurface *_introBackg1Image = nullptr;
 	WWSurface *_introWbodyImage[5] = {nullptr};


Commit: e944af20aa6e62f8c738b758f67d2e57ea912822
    https://github.com/scummvm/scummvm/commit/e944af20aa6e62f8c738b758f67d2e57ea912822
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:58+01:00

Commit Message:
WAYNESWORLD: Add safeguards and debug output in case of issue - Courtesy of digitall

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gxlarchive.cpp
    engines/waynesworld/waynesworld.cpp


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 5ad3e407984..938edc07caa 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -7106,7 +7106,8 @@ void GameLogic::r31_displayCategories() {
 	GxlArchive *roomLib = _vm->_roomGxl;
 
 	WWSurface *screenImage = roomLib->loadRoomSurface("screen");
-	_vm->drawSpiralEffect(screenImage, 0, 0, 4, 4);
+	if (screenImage)
+		_vm->drawSpiralEffect(screenImage, 0, 0, 4, 4);
 	delete screenImage;
 	for (int categoryIndex = 0; categoryIndex < 5; categoryIndex++) {
 		Common::String categoryFilename = Common::String::format("cat%d", categoryIndex);
diff --git a/engines/waynesworld/gxlarchive.cpp b/engines/waynesworld/gxlarchive.cpp
index 62159452f05..deb0e419fca 100644
--- a/engines/waynesworld/gxlarchive.cpp
+++ b/engines/waynesworld/gxlarchive.cpp
@@ -129,24 +129,46 @@ Image::PCXDecoder *GxlArchive::loadImage(const char *filename) {
 		searchName = Common::String::format("%s.PCX", filename);
 	else
 		searchName = Common::String(filename);
-	
+
 	Common::Path pathName = Common::Path(searchName);
 	if (!hasFile(pathName))
 		error("loadImage() Could not find '%s'", filename);
 
-
 	Image::PCXDecoder *pcx = new Image::PCXDecoder();
-	Common::SeekableReadStream *pcxStr = createReadStreamForMember(Common::Path(filename));
-	if (!pcx->loadStream(*pcxStr))
-		error("loadImage() Could not process '%s'", filename);
+	if (pcx)
+	{
+		Common::SeekableReadStream *pcxStr = createReadStreamForMember(Common::Path(filename));
+		if (pcxStr)
+		{
+			if (!pcx->loadStream(*pcxStr))
+				error("loadImage() Could not process '%s'", filename);
+		}
+		else
+		{
+			warning("loadImage() failed to create read stream for \"%s\"", filename);
+		}
+		delete pcxStr;
+	}
+	else
+	{
+		error("loadImage() failed to allocate PCX decoder!");
+	}
 
-	delete pcxStr;
-	
 	return pcx;
 }
 
 WWSurface *GxlArchive::loadSurfaceIntern(const char *filename) {
 	Image::PCXDecoder *imageDecoder = loadImage(filename);
+	if (imageDecoder == nullptr)
+	{
+		warning("%s() failed to load \"%s\"", __func__, filename);
+		return nullptr;
+	}
+	if (imageDecoder->getSurface() == nullptr)
+	{
+		warning("%s() failed to get surface data for \"%s\"", __func__, filename);
+		return nullptr;
+	}
 	WWSurface *surface = new WWSurface(imageDecoder->getSurface());
 	delete imageDecoder;
 	return surface;
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index a98753c23e4..0f873269a6e 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -575,8 +575,15 @@ void WaynesWorldEngine::drawSpiralEffect(Graphics::Surface *surface, int x, int
 }
 
 void WaynesWorldEngine::drawRandomEffect(Graphics::Surface *surface, int x, int y, int grainWidth, int grainHeight) {
-	ScreenEffect screenEffect(this, surface, x, y, grainWidth, grainHeight);
-	screenEffect.drawRandomEffect();
+	if (surface)
+	{
+		ScreenEffect screenEffect(this, surface, x, y, grainWidth, grainHeight);
+		screenEffect.drawRandomEffect();
+	}
+	else
+	{
+		warning("%s() x:%d y:%d missing surface!", __func__, x, y);
+	}
 }
 
 Common::String WaynesWorldEngine::loadString(const char *filename, int index, int flag) {


Commit: 08eff856ef6fc56a71be494549932d27e4151b22
    https://github.com/scummvm/scummvm/commit/08eff856ef6fc56a71be494549932d27e4151b22
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:58+01:00

Commit Message:
WAYNESWORLD: Fix crash in studio 35

Changed paths:
    engines/waynesworld/gxlarchive.cpp


diff --git a/engines/waynesworld/gxlarchive.cpp b/engines/waynesworld/gxlarchive.cpp
index deb0e419fca..e3bba910f05 100644
--- a/engines/waynesworld/gxlarchive.cpp
+++ b/engines/waynesworld/gxlarchive.cpp
@@ -132,20 +132,20 @@ Image::PCXDecoder *GxlArchive::loadImage(const char *filename) {
 
 	Common::Path pathName = Common::Path(searchName);
 	if (!hasFile(pathName))
-		error("loadImage() Could not find '%s'", filename);
+		error("loadImage() Could not find '%s'", searchName.c_str());
 
 	Image::PCXDecoder *pcx = new Image::PCXDecoder();
 	if (pcx)
 	{
-		Common::SeekableReadStream *pcxStr = createReadStreamForMember(Common::Path(filename));
+		Common::SeekableReadStream *pcxStr = createReadStreamForMember(pathName);
 		if (pcxStr)
 		{
 			if (!pcx->loadStream(*pcxStr))
-				error("loadImage() Could not process '%s'", filename);
+				error("loadImage() Could not process '%s'", searchName.c_str());
 		}
 		else
 		{
-			warning("loadImage() failed to create read stream for \"%s\"", filename);
+			warning("loadImage() failed to create read stream for \"%s\"", searchName.c_str());
 		}
 		delete pcxStr;
 	}


Commit: c8eb0630926cde4dc2b20a8d33ff4d8faa1697dc
    https://github.com/scummvm/scummvm/commit/c8eb0630926cde4dc2b20a8d33ff4d8faa1697dc
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:58+01:00

Commit Message:
WAYNESWORLD: Add last part to intro (credits)

Changed paths:
    engines/waynesworld/intro.cpp


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index 7182a61cbe4..4a8bfdca270 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -191,7 +191,6 @@ bool WaynesWorldEngine::introPt2() {
 	_demoPt2Surface = new WWSurface(320, 200);
 	_midi->stopSong();
 
-	// TODO add a check at each step to return false if ESC is pressed
 	return true;
 }
 
@@ -366,7 +365,65 @@ void WaynesWorldEngine::introPt5() {
 }
 
 void WaynesWorldEngine::introPt6() {
-	warning("STUB - Intro pt 6");
+	WWSurface *introPt6Surface[5] = {nullptr};
+	WWSurface *signBottomSurface = nullptr;
+	WWSurface *scrollSurface = nullptr;
+	
+	_escPressed = false;
+	
+	while (_sound->isSFXPlaying())
+		waitMillis(10);
+
+	if (_escPressed)
+		return;
+
+	GxlArchive *oa3Gxl = new GxlArchive("oa3");
+	oa3Gxl->dumpArchive(Common::Path("."));
+	for (int i = 0; i < 5; ++i) {
+		introPt6Surface[i] = new WWSurface(320, 200);
+		Common::String filename = Common::String::format("sign%d.pcx",  i);
+		drawImageToSurface(oa3Gxl, filename.c_str(), introPt6Surface[i], 0, 0);
+	}
+
+	_sound->playSound("sv14.snd", false);
+
+	for (int i = 0; i < 5; ++i) {
+		_screen->drawSurface(introPt6Surface[i], 0, 0);
+		waitMillis(100);
+		if (_escPressed) {
+			break;
+		}
+	}
+
+	if (!_escPressed) {
+		signBottomSurface = new WWSurface(320, 94);
+		drawImageToSurface(oa3Gxl, "signbot.pcx", signBottomSurface, 0, 0);
+	}
+
+	if (!_escPressed) {
+		_musicIndex = 1;
+		changeMusic();
+		waitSeconds(4);
+	}
+
+	if (!_escPressed) {
+		scrollSurface = new WWSurface(320, 200);
+
+		for (int i = 199; i > 106; --i) {
+			scrollSurface->copyRectToSurface((Graphics::Surface)*introPt6Surface[4], 0, 0, Common::Rect(0, 200 - i, 319, 200));
+			scrollSurface->copyRectToSurface((Graphics::Surface)*signBottomSurface, 0, i, Common::Rect(0, 0, 319, 200 - i));
+			_screen->drawSurface(scrollSurface, 0, 0);
+			if (_escPressed) {
+				break;
+			}
+		}
+	}
+
+	delete scrollSurface;
+	delete oa3Gxl;
+	delete signBottomSurface;
+	for (int i = 0; i < 5; ++i)
+		delete introPt6Surface[i];
 }
 
 void WaynesWorldEngine::introPt7() {
@@ -452,7 +509,7 @@ void WaynesWorldEngine::introPt4_init() {
 	_fontWW->loadFromFile("ww.gft");
 
 	while(_sound->isSFXPlaying())
-		waitMillis(30);;
+		waitMillis(30);
 	
 	_musicIndex = 2;
 	changeMusic();


Commit: bdad23d7ce0b2eda1fedce31b6cc322f1ee90fa8
    https://github.com/scummvm/scummvm/commit/bdad23d7ce0b2eda1fedce31b6cc322f1ee90fa8
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:58+01:00

Commit Message:
WAYNESWORLD: Remove forgotten dump used during development

Changed paths:
    engines/waynesworld/intro.cpp


diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index 4a8bfdca270..c191fd68f39 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -378,7 +378,6 @@ void WaynesWorldEngine::introPt6() {
 		return;
 
 	GxlArchive *oa3Gxl = new GxlArchive("oa3");
-	oa3Gxl->dumpArchive(Common::Path("."));
 	for (int i = 0; i < 5; ++i) {
 		introPt6Surface[i] = new WWSurface(320, 200);
 		Common::String filename = Common::String::format("sign%d.pcx",  i);


Commit: 82154cf44f033b1318cd89e7eca13a69b00aa332
    https://github.com/scummvm/scummvm/commit/82154cf44f033b1318cd89e7eca13a69b00aa332
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:58+01:00

Commit Message:
WAYNESWORLD: Extend savegames to add a header and a thumbnail, start displaying it from launcher

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h
    engines/waynesworld/graphics.cpp
    engines/waynesworld/graphics.h
    engines/waynesworld/metaengine.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 938edc07caa..731900618a8 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -8703,7 +8703,7 @@ void GameLogic::synchronize(Common::Serializer &s) {
 	s.syncAsByte(_r39_flags);
 }
 
-bool GameLogic::saveSavegame(int slot) {
+bool GameLogic::saveSavegame(int slot, const Common::String *desc) {
 	if (slot == 0)
 		error("Can't save on slot 0 - RST file");
 
@@ -8720,6 +8720,15 @@ bool GameLogic::saveSavegame(int slot) {
 	Common::Serializer s(nullptr, saveFile);
 	synchronize(s);
 
+	// Write out the ScummVM savegame header
+	SavegameHeader header;
+	if (desc)
+		header.saveName = *desc;
+	else
+		header.saveName = Common::String::format("Unnamed savegame %2d", slot);
+	
+	header.version = kWWSavegameVersion;
+	_vm->writeSavegameHeader(saveFile, header);
 	delete saveFile;
 
 	return true;
@@ -8811,7 +8820,7 @@ void GameLogic::handleGameMenu() {
 				slot += 6;
 
 			if (_menuIsSaveLoad == 1)
-				saveSavegame(slot);
+				saveSavegame(slot, nullptr);
 			else
 				if (!loadSavegame(slot))
 					return;
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index 59c406e0d5b..7319c87d07a 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -466,7 +466,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void toggleMusicEnabled();
 	void menuSaveLoadMenu(bool isLoad);
 	void synchronize(Common::Serializer &s);
-	bool saveSavegame(int slot);
+	bool saveSavegame(int slot, const Common::String *desc);
 	bool loadSavegame(int slot);
 	void handleGameMenu();
 	void menuQuitGame();
diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
index c71e27be459..dd61652b27c 100644
--- a/engines/waynesworld/graphics.cpp
+++ b/engines/waynesworld/graphics.cpp
@@ -260,10 +260,11 @@ int GFTFont::getCharWidth(byte ch) const {
 
 // Screen
 
-Screen::Screen() : _lockCtr(0), _vgaSurface(nullptr) {
+Screen::Screen() {
 }
 
 Screen::~Screen() {
+	delete _screenCopy;
 }
 
 void Screen::beginUpdate() {
@@ -342,6 +343,14 @@ void Screen::drawWrappedText(GFTFont *font, const char *text, int x, int y, int
 	endUpdate();
 }
 
+void Screen::saveScreenshot() {
+	beginUpdate();
+	delete _screenCopy;
+	_screenCopy = new Graphics::Surface();
+	_screenCopy->copyFrom(*_vgaSurface);
+	endUpdate();
+}
+
 // ScreenEffect
 
 ScreenEffect::ScreenEffect(WaynesWorldEngine *vm, Graphics::Surface *surface, int x, int y, int grainWidth, int grainHeight)
diff --git a/engines/waynesworld/graphics.h b/engines/waynesworld/graphics.h
index 75fb0d2f429..aff6b95f0f6 100644
--- a/engines/waynesworld/graphics.h
+++ b/engines/waynesworld/graphics.h
@@ -62,6 +62,8 @@ protected:
 
 class Screen {
 public:
+	Graphics::Surface *_screenCopy = nullptr;
+
 	Screen();
 	~Screen();
 	void beginUpdate();
@@ -74,9 +76,11 @@ public:
 	void clear(byte color);
 	void drawText(GFTFont *font, const char *text, int x, int y, byte color);
 	void drawWrappedText(GFTFont *font, const char *text, int x, int y, int maxWidth, byte color);
+	void saveScreenshot();
+	
 protected:
-	Graphics::Surface *_vgaSurface;
-	int _lockCtr;
+	Graphics::Surface *_vgaSurface = nullptr;
+	int _lockCtr = 0;
 };
 
 class ScreenEffect {
diff --git a/engines/waynesworld/metaengine.cpp b/engines/waynesworld/metaengine.cpp
index 775062d8d20..7af90ac73f0 100644
--- a/engines/waynesworld/metaengine.cpp
+++ b/engines/waynesworld/metaengine.cpp
@@ -29,20 +29,135 @@
 
 #include "waynesworld/detection.h"
 
+namespace WaynesWorld {
+static const ADExtraGuiOptionsMap optionsList[] = {
+	{GAMEOPTION_ORIGINAL_SAVELOAD,
+	 {
+	 		_s("Use original save/load screens"),
+			_s("Use the original save/load screens instead of the ScummVM ones"),
+	 	"originalsaveload",
+	 	true,
+	 	0,
+	 	0
+			}
+	},
+
+	AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
+} // namespace WaynesWorld
+
 class WaynesWorldMetaEngine : public AdvancedMetaEngine<ADGameDescription> {
 public:
 	const char *getName() const override {
 		return "waynesworld";
 	}
+	const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override {
+		return WaynesWorld::optionsList;
+	}
 
 	Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
+	bool hasFeature(MetaEngineFeature f) const override;
+	SaveStateList listSaves(const char *target) const override;
+	SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override;
 };
 
+bool WaynesWorldMetaEngine::hasFeature(MetaEngineFeature f) const {
+	return (f == kSupportsLoadingDuringStartup) ||
+		   checkExtendedSaves(f);
+}
+
 Common::Error WaynesWorldMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
 	*engine = new WaynesWorld::WaynesWorldEngine(syst,desc);
 	return Common::kNoError;
 }
 
+SaveStateList WaynesWorldMetaEngine::listSaves(const char *target) const {
+	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
+	const Common::String pattern = "ww##.sav";
+	Common::StringArray filenames = saveFileMan->listSavefiles(pattern);
+
+	SaveStateList saveList;
+	for (const auto &filename : filenames) {
+		// Obtain the last 3 digits of the filename, since they correspond to the save slot
+		Common::String numb = filename.substr(2, 2);
+		const int slotNum = atoi(numb.c_str());
+
+		if (slotNum > 0 && slotNum <= 99) {
+
+			Common::InSaveFile *file = saveFileMan->openForLoading(filename);
+			if (file) {
+				WaynesWorld::SavegameHeader header;
+
+				// Check to see if it's a ScummVM savegame or an original format savegame
+				char buffer[kWWSavegameStrSize + 1];
+				if (file->size() < 1140) {
+					saveList.push_back(SaveStateDescriptor(this, slotNum, "Unknown"));
+				} else {
+					file->seek(1135);
+					file->read(buffer, kWWSavegameStrSize + 1);
+
+					if (!strncmp(buffer, WaynesWorld::savegameStr, kWWSavegameStrSize + 1)) {
+						// Valid savegame
+						if (WaynesWorld::WaynesWorldEngine::readSavegameHeader(file, header)) {
+							saveList.push_back(SaveStateDescriptor(this, slotNum, header.saveName));
+						}
+					} else {
+						// Unexpected savegame format? 
+					}
+				}
+				delete file;
+			}
+		}
+	}
+
+	// Sort saves based on slot number.
+	Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
+	return saveList;
+}
+
+SaveStateDescriptor WaynesWorldMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
+	Common::String fileName = Common::String::format("ww%02d.sav", slot);
+	Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(fileName);
+
+	if (f) {
+		WaynesWorld::SavegameHeader header;
+
+		// Check to see if it's a ScummVM savegame or not
+		char buffer[kWWSavegameStrSize + 1];
+		if (f->size() < 1140)
+			buffer[0] = 0;
+		else {
+			f->seek(1135);
+			f->read(buffer, kWWSavegameStrSize + 1);
+		}
+
+		bool hasHeader = !strncmp(buffer, WaynesWorld::savegameStr, kWWSavegameStrSize + 1) &&
+						 WaynesWorld::WaynesWorldEngine::readSavegameHeader(f, header, false);
+		delete f;
+
+		if (!hasHeader) {
+			// Original savegame perhaps?
+			SaveStateDescriptor desc(this, slot, "Unknown");
+			return desc;
+		}
+
+		// Create the return descriptor
+		SaveStateDescriptor desc(this, slot, header.saveName);
+		desc.setThumbnail(header.thumbnail);
+		desc.setSaveDate(header.saveYear, header.saveMonth, header.saveDay);
+		desc.setSaveTime(header.saveHour, header.saveMinutes);
+
+		if (header.playTime) {
+			desc.setPlayTime(header.playTime * 1000);
+		}
+
+		return desc;
+	}
+
+	return SaveStateDescriptor();
+}
+
 #if PLUGIN_ENABLED_DYNAMIC(WAYNESWORLD)
 	REGISTER_PLUGIN_DYNAMIC(WAYNESWORLD, PLUGIN_TYPE_ENGINE, WaynesWorldMetaEngine);
 #else
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 0f873269a6e..e10d2c70a57 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -30,17 +30,22 @@
 #include "common/config-manager.h"
 #include "common/error.h"
 #include "common/fs.h"
+#include "common/savefile.h"
 #include "common/translation.h"
 #include "engines/advancedDetector.h"
 #include "engines/util.h"
 #include "graphics/cursorman.h"
 #include "graphics/font.h"
 #include "graphics/palette.h"
-#include "graphics/surface.h"
 #include "graphics/paletteman.h"
+#include "graphics/surface.h"
+#include "graphics/thumbnail.h"
+#include "graphics/scaler.h"
 
 namespace WaynesWorld {
 
+const char *savegameStr = "SCUMMVM_WAYNES";
+
 WaynesWorldEngine::WaynesWorldEngine(OSystem *syst, const ADGameDescription *gd) :
 	Engine(syst), _gameDescription(gd) {
 
@@ -64,7 +69,80 @@ WaynesWorldEngine::~WaynesWorldEngine() {
 #endif
 
 	delete _random;
+}
+
+bool WaynesWorldEngine::readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header, bool skipThumbnail) {
+	header.version = 0;
+	header.saveName.clear();
+	header.thumbnail = nullptr;
+	header.saveYear = 0;
+	header.saveMonth = 0;
+	header.saveDay = 0;
+	header.saveHour = 0;
+	header.saveMinutes = 0;
+	header.playTime = 0;
+
+	// Get the savegame version
+	header.version = in->readByte();
+	if (header.version > kWWSavegameVersion)
+		return false;
+
+	// Read in the string
+	char ch;
+	while ((ch = (char)in->readByte()) != '\0')
+		header.saveName += ch;
+
+	// Get the thumbnail
+	if (!Graphics::loadThumbnail(*in, header.thumbnail, skipThumbnail)) {
+		return false;
+	}
+
+	// Read in save date/time
+	header.saveYear = in->readSint16LE();
+	header.saveMonth = in->readSint16LE();
+	header.saveDay = in->readSint16LE();
+	header.saveHour = in->readSint16LE();
+	header.saveMinutes = in->readSint16LE();
+
+	if (header.version >= 3) {
+		header.playTime = in->readUint32LE();
+	}
+
+	return true;
+}
+
+void WaynesWorldEngine::writeSavegameHeader(Common::OutSaveFile *out, SavegameHeader &header) {
+	// Write out a savegame header
+	out->write(savegameStr, kWWSavegameStrSize + 1);
+
+	out->writeByte(kWWSavegameVersion);
+
+	// Write savegame name
+	out->write(header.saveName.c_str(), header.saveName.size() + 1);
+
+	// Get the active palette
+	uint8 thumbPalette[256 * 3];
+	g_system->getPaletteManager()->grabPalette(thumbPalette, 0, 256);
+
+	// Create a thumbnail and save it
+	Graphics::Surface *thumb = new Graphics::Surface();
+	_screen->saveScreenshot();
+
+	::createThumbnail(thumb, (const byte *)_screen->_screenCopy->getPixels(), 320, 200, thumbPalette);
+	Graphics::saveThumbnail(*out, *thumb);
+	thumb->free();
+	delete thumb;
+
+	// Write out the save date/time
+	TimeDate td;
+	g_system->getTimeAndDate(td);
+	out->writeSint16LE(td.tm_year + 1900);
+	out->writeSint16LE(td.tm_mon + 1);
+	out->writeSint16LE(td.tm_mday);
+	out->writeSint16LE(td.tm_hour);
+	out->writeSint16LE(td.tm_min);
 
+	out->writeUint32LE(g_engine->getTotalPlayTime() / 1000);
 }
 
 Common::Error WaynesWorldEngine::run() {
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index d6285f45fc7..b9e90d30488 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -35,12 +35,13 @@
 
 #include "waynesworld/sound.h"
 
+#define kWWSavegameVersion 1
+#define kWWSavegameStrSize 14
+#define kWWSavegameStr "SCUMMVM_WAYNES"
 
 namespace WaynesWorld {
 class GxlArchive;
 
-#define WAYNESWORLD_SAVEGAME_VERSION 0
-
 enum {
 	GF_GUILANGSWITCH =    (1 << 0) // If GUI language switch is required for menus
 };
@@ -50,6 +51,15 @@ class WWSurface;
 class GFTFont;
 class GameLogic;
 
+struct SavegameHeader {
+	uint8 version;
+	Common::String saveName;
+	Graphics::Surface *thumbnail;
+	int16 saveYear, saveMonth, saveDay;
+	int16 saveHour, saveMinutes;
+	uint32 playTime;
+};
+
 struct RoomObject {
     int roomNumber;
     const char *name;
@@ -97,14 +107,19 @@ const int kInventorySize = 50;
 const int kFirstInventoryObjectId = 28;
 const int kLastInventoryObjectId = 77;
 
+extern const char *savegameStr;
+
 class WaynesWorldEngine : public Engine {
 protected:
 	Common::Error run() override;
 	bool hasFeature(EngineFeature f) const override;
+
 public:
 	WaynesWorldEngine(OSystem *syst, const ADGameDescription *gd);
 	~WaynesWorldEngine() override;
 	const Common::String getTargetName() { return _targetName; }
+	static bool readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header, bool skipThumbnail = true);
+
 	const ADGameDescription *_gameDescription;
 	bool _isSoundEnabled = true;
 	bool _isMusicEnabled = true;
@@ -464,6 +479,7 @@ public:
 		uint32 playTime;
 		Graphics::Surface *thumbnail;
 	};
+	void writeSavegameHeader(Common::OutSaveFile *out, SavegameHeader &header);
 
 	bool _isSaveAllowed;
 


Commit: e54d2f75410a687ab474c4f02463366ade36d9e2
    https://github.com/scummvm/scummvm/commit/e54d2f75410a687ab474c4f02463366ade36d9e2
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:58+01:00

Commit Message:
WAYNESWORLD: Add load from launcher

Changed paths:
    engines/waynesworld/metaengine.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/metaengine.cpp b/engines/waynesworld/metaengine.cpp
index 7af90ac73f0..bfed9422e86 100644
--- a/engines/waynesworld/metaengine.cpp
+++ b/engines/waynesworld/metaengine.cpp
@@ -79,7 +79,7 @@ SaveStateList WaynesWorldMetaEngine::listSaves(const char *target) const {
 
 	SaveStateList saveList;
 	for (const auto &filename : filenames) {
-		// Obtain the last 3 digits of the filename, since they correspond to the save slot
+		// Obtain the 2 digits from the filename, since they correspond to the save slot
 		Common::String numb = filename.substr(2, 2);
 		const int slotNum = atoi(numb.c_str());
 
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index e10d2c70a57..8f130e81f05 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -166,7 +166,15 @@ Common::Error WaynesWorldEngine::run() {
 
 	syncSoundSettings();
 
-	runIntro();
+	if (ConfMan.hasKey("save_slot")) {
+		int saveSlot = ConfMan.getInt("save_slot");
+		if (saveSlot > 0 && saveSlot <= 99)
+			_loadSaveSlot = saveSlot;
+	}
+
+	if (_loadSaveSlot < 0) {
+		runIntro();
+	}
 	_introOngoing = false;
 	_fontWW = new GFTFont();
 	_fontWWInv = new GFTFont();
@@ -211,7 +219,7 @@ Common::Error WaynesWorldEngine::run() {
 	_gameState = 7;
 	_currentMapItemIndex = -1;
 	_musicIndex = 0;
-	
+
 	loadMainActorSprites();
 
 	initRoomObjects();
@@ -225,11 +233,15 @@ Common::Error WaynesWorldEngine::run() {
 	CursorMan.showMouse(true);
 
 	drawInterface(2);
-	changeRoom(0);
-	changeMusic();
 	
 	_gameState = 0; // DEBUG Initial _gameState 0 is set by room event in room 0
-
+	_currentRoomNumber = 0;
+	if (_loadSaveSlot > 0) {
+		_logic->loadSavegame(_loadSaveSlot);
+	}
+	changeRoom(_currentRoomNumber);
+	changeMusic();
+	
 	while (!shouldQuit()) {
 		_mouseClickButtons = 0;
 		// _keyInput = 0;
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index b9e90d30488..0e940446ed1 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -158,6 +158,7 @@ private:
 	int _startOawPos = 0;
 	int _startOagPos = 0;
 	int _startOaoPos = 0;
+	int _loadSaveSlot = -1;
 	
 	void sub3009A(int textId);
 	void sub2FEFB(int arg_refreshBackgFl, int arg_wBodyIndex, int arg_gBodyIndex, int arg_wHead1Index, int arg_gHead1Index, int arg_TextId);


Commit: 0a1fc4ece2a36e9247d4cf6277bce579c77b9d04
    https://github.com/scummvm/scummvm/commit/0a1fc4ece2a36e9247d4cf6277bce579c77b9d04
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:58+01:00

Commit Message:
WAYNESWORLD: Plug ScummVM save/load screens and an option to use them by default

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/metaengine.cpp
    engines/waynesworld/pathfinding.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index 731900618a8..a81e235cca9 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -8839,10 +8839,18 @@ void GameLogic::handleGameMenu() {
 			menuDrawSoundEnabled();
 			break;
 		case 2:
-			menuSaveLoadMenu(true);
+			if (!_vm->_useOriginalSaveLoad) {
+				_vm->loadGameDialog();
+				menuExit();
+			} else {
+				menuSaveLoadMenu(true);
+			}
 			break;
 		case 3:
-			menuSaveLoadMenu(false);
+			if (!_vm->_useOriginalSaveLoad)
+				_vm->saveGameDialog();
+			else
+				menuSaveLoadMenu(false);
 			break;
 		case 4:
 			loadSavegame(0);
diff --git a/engines/waynesworld/metaengine.cpp b/engines/waynesworld/metaengine.cpp
index bfed9422e86..670ab92d171 100644
--- a/engines/waynesworld/metaengine.cpp
+++ b/engines/waynesworld/metaengine.cpp
@@ -36,7 +36,7 @@ static const ADExtraGuiOptionsMap optionsList[] = {
 	 		_s("Use original save/load screens"),
 			_s("Use the original save/load screens instead of the ScummVM ones"),
 	 	"originalsaveload",
-	 	true,
+	 	false,
 	 	0,
 	 	0
 			}
@@ -63,8 +63,12 @@ public:
 };
 
 bool WaynesWorldMetaEngine::hasFeature(MetaEngineFeature f) const {
-	return (f == kSupportsLoadingDuringStartup) ||
-		   checkExtendedSaves(f);
+	return (f == kSupportsListSaves) ||
+		   (f == kSupportsLoadingDuringStartup) ||
+		   (f == kSavesSupportMetaInfo) ||
+		   (f == kSavesSupportThumbnail) ||
+		   (f == kSavesSupportCreationDate) ||
+		   (f == kSavesSupportPlayTime);
 }
 
 Common::Error WaynesWorldMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
diff --git a/engines/waynesworld/pathfinding.cpp b/engines/waynesworld/pathfinding.cpp
index 07e81a91ae8..ceba03e5e3f 100644
--- a/engines/waynesworld/pathfinding.cpp
+++ b/engines/waynesworld/pathfinding.cpp
@@ -375,13 +375,11 @@ int WaynesWorldEngine::walkAddWalkLine(int flag, int x1, int y1, int x2, int y2,
 }
 
 bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction, int actor2_destX, int actor2_destY) {
-    WalkPoint *actor1Points = 0, *actor2Points = 0;
+    WalkPoint *actor1Points, *actor2Points;
     int flag1, flag2;
     int actor1X, actor1Y, actor2X, actor2Y;
     int actor2WalkDestX, actor2WalkDestY;
 
-	debug("walkTo(%d, %d, %d, %d, %d)", actor1_destX, actor1_destY, direction, actor2_destX, actor2_destY);
-
     _isTextVisible = false;
 
     if (isActorWayne()) {
@@ -440,7 +438,7 @@ bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction
     }
 
     for (int pointIndex = 0, walkIncr = 0; pointIndex < actor1PointsCount || pointIndex < actor2PointsCount; pointIndex += 2, walkIncr += 2) {
-        int scale = 0;
+        int scale;
         if (_scrollRemaining > 0) {
             scrollRoom();
         }
@@ -464,7 +462,7 @@ bool WaynesWorldEngine::walkTo(int actor1_destX, int actor1_destY, int direction
         //     waitMillis(10000 / (scale * scale) * 10);
         // }
         waitMillis(100); // TODO Fix this
-        if (_scrollRemaining == 0) {
+        if (_scrollRemaining > 0) {
 			warning("STUB - Missing scrolling in WalkTo");
             // TOOD
             // if (updateGame()) {
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 8f130e81f05..a68efedaab4 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -111,6 +111,22 @@ bool WaynesWorldEngine::readSavegameHeader(Common::InSaveFile *in, SavegameHeade
 	return true;
 }
 
+Common::Error WaynesWorldEngine::saveGameState(int slot, const Common::String &desc, bool isAutosave) {
+	Common::Error result = Common::kNoError;
+	if (!_logic->saveSavegame(slot, &desc))
+		result = Common::kUnknownError;
+
+	return result;
+}
+
+Common::Error WaynesWorldEngine::loadGameState(int slot) {
+	Common::Error result = Common::kNoError;
+	if (!_logic->loadSavegame(slot))
+		result = Common::kUnknownError;
+
+	return result;
+}
+
 void WaynesWorldEngine::writeSavegameHeader(Common::OutSaveFile *out, SavegameHeader &header) {
 	// Write out a savegame header
 	out->write(savegameStr, kWWSavegameStrSize + 1);
@@ -166,8 +182,9 @@ Common::Error WaynesWorldEngine::run() {
 
 	syncSoundSettings();
 
+	_useOriginalSaveLoad = ConfMan.getBool("originalsaveload");
 	if (ConfMan.hasKey("save_slot")) {
-		int saveSlot = ConfMan.getInt("save_slot");
+		const int saveSlot = ConfMan.getInt("save_slot");
 		if (saveSlot > 0 && saveSlot <= 99)
 			_loadSaveSlot = saveSlot;
 	}
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 0e940446ed1..7b1a620da1d 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -120,12 +120,19 @@ public:
 	const Common::String getTargetName() { return _targetName; }
 	static bool readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header, bool skipThumbnail = true);
 
+	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override { return true; }
+	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override { return true; }
+
+	Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
+	Common::Error loadGameState(int slot) override;
+
 	const ADGameDescription *_gameDescription;
 	bool _isSoundEnabled = true;
 	bool _isMusicEnabled = true;
 
 	bool _introOngoing = true;
 	bool _escPressed = false;
+	bool _useOriginalSaveLoad = true;
 
 private:
 	Graphics::PixelFormat _pixelFormat;


Commit: ae476694b96075a91a39d006f3503833ab1eb0fe
    https://github.com/scummvm/scummvm/commit/ae476694b96075a91a39d006f3503833ab1eb0fe
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:58+01:00

Commit Message:
WAYNESWORLD: Add credits

Changed paths:
  A engines/waynesworld/credits.pl


diff --git a/engines/waynesworld/credits.pl b/engines/waynesworld/credits.pl
new file mode 100644
index 00000000000..e86a0cb2fba
--- /dev/null
+++ b/engines/waynesworld/credits.pl
@@ -0,0 +1,4 @@
+begin_section("Gnap");
+	add_person("Arnaud Boutonné", "Strangerke", "");
+	add_person("Benjamin Haisch", "john_doe", "");
+end_section();


Commit: b7344be034740b2cb8b82585a910d356fac30140
    https://github.com/scummvm/scummvm/commit/b7344be034740b2cb8b82585a910d356fac30140
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:05:58+01:00

Commit Message:
WAYNESWORLD: Add some more logic in the "Can save/load game state currently" functions to avoid a crash, allow autosave

Changed paths:
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h
    engines/waynesworld/metaengine.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index a81e235cca9..ae0506f0e29 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -8704,9 +8704,6 @@ void GameLogic::synchronize(Common::Serializer &s) {
 }
 
 bool GameLogic::saveSavegame(int slot, const Common::String *desc) {
-	if (slot == 0)
-		error("Can't save on slot 0 - RST file");
-
 	// TODO: we could put the extra ScummVM info after the 1135 bytes of a standard savegame or modify loadSavegame to skip it when it's not a RST file
 	Common::OutSaveFile *saveFile = g_system->getSavefileManager()->openForSaving(Common::String::format("ww%02d.sav", slot), true);
 
@@ -8734,11 +8731,11 @@ bool GameLogic::saveSavegame(int slot, const Common::String *desc) {
 	return true;
 }
 
-bool GameLogic::loadSavegame(int slot) {
+bool GameLogic::loadSavegame(int slot, bool rstSave) {
 	Common::InSaveFile *saveFile;
 	byte *buffer = nullptr;
 	
-	if (slot == 0) {
+	if (rstSave) {
 		Common::File fd;
 		if (!fd.open(Common::Path("ww.rst")))
 			error("WaynesWorldEngine::loadSavegame() Could not open ww.rst");
@@ -8853,7 +8850,7 @@ void GameLogic::handleGameMenu() {
 				menuSaveLoadMenu(false);
 			break;
 		case 4:
-			loadSavegame(0);
+			loadSavegame(0, true);
 			menuExit();
 			refresh = false;
 			break;
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index 7319c87d07a..10551a0cd74 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -467,7 +467,7 @@ public://DEBUG So logic functions can be called from the engine class for testin
 	void menuSaveLoadMenu(bool isLoad);
 	void synchronize(Common::Serializer &s);
 	bool saveSavegame(int slot, const Common::String *desc);
-	bool loadSavegame(int slot);
+	bool loadSavegame(int slot, bool rstSave = false);
 	void handleGameMenu();
 	void menuQuitGame();
 	void menuExit();
diff --git a/engines/waynesworld/metaengine.cpp b/engines/waynesworld/metaengine.cpp
index 670ab92d171..74b5d195b1c 100644
--- a/engines/waynesworld/metaengine.cpp
+++ b/engines/waynesworld/metaengine.cpp
@@ -87,7 +87,7 @@ SaveStateList WaynesWorldMetaEngine::listSaves(const char *target) const {
 		Common::String numb = filename.substr(2, 2);
 		const int slotNum = atoi(numb.c_str());
 
-		if (slotNum > 0 && slotNum <= 99) {
+		if (slotNum >= 0 && slotNum <= 99) {
 
 			Common::InSaveFile *file = saveFileMan->openForLoading(filename);
 			if (file) {
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index a68efedaab4..1698e65e006 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -115,7 +115,7 @@ Common::Error WaynesWorldEngine::saveGameState(int slot, const Common::String &d
 	Common::Error result = Common::kNoError;
 	if (!_logic->saveSavegame(slot, &desc))
 		result = Common::kUnknownError;
-
+	
 	return result;
 }
 
@@ -185,7 +185,7 @@ Common::Error WaynesWorldEngine::run() {
 	_useOriginalSaveLoad = ConfMan.getBool("originalsaveload");
 	if (ConfMan.hasKey("save_slot")) {
 		const int saveSlot = ConfMan.getInt("save_slot");
-		if (saveSlot > 0 && saveSlot <= 99)
+		if (saveSlot >= 0 && saveSlot <= 99)
 			_loadSaveSlot = saveSlot;
 	}
 
@@ -253,11 +253,12 @@ Common::Error WaynesWorldEngine::run() {
 	
 	_gameState = 0; // DEBUG Initial _gameState 0 is set by room event in room 0
 	_currentRoomNumber = 0;
-	if (_loadSaveSlot > 0) {
+	if (_loadSaveSlot >= 0) {
 		_logic->loadSavegame(_loadSaveSlot);
 	}
 	changeRoom(_currentRoomNumber);
 	changeMusic();
+	_isSaveAllowed = true;
 	
 	while (!shouldQuit()) {
 		_mouseClickButtons = 0;
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 7b1a620da1d..89fff695e66 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -120,8 +120,13 @@ public:
 	const Common::String getTargetName() { return _targetName; }
 	static bool readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header, bool skipThumbnail = true);
 
-	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override { return true; }
-	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override { return true; }
+	// _gameState 0 = game, 4 = menu
+	bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
+		return _isSaveAllowed && (_gameState == 0 || _gameState == 4);
+	}
+	bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override {
+		return _isSaveAllowed && (_gameState == 0 || _gameState == 4);
+	}
 
 	Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
 	Common::Error loadGameState(int slot) override;
@@ -489,19 +494,7 @@ public:
 	};
 	void writeSavegameHeader(Common::OutSaveFile *out, SavegameHeader &header);
 
-	bool _isSaveAllowed;
-
-	/* TODO
-	bool canLoadGameStateCurrently() override { return _isSaveAllowed; }
-	bool canSaveGameStateCurrently() override { return _isSaveAllowed; }
-	Common::Error loadGameState(int slot) override;
-	Common::Error saveGameState(int slot, const Common::String &description, bool isAutosave = false) override;
-	void savegame(const char *filename, const char *description);
-	void loadgame(const char *filename);
-	bool existsSavegame(int num);
-	static Common::String getSavegameFilename(const Common::String &target, int num);
-	WARN_UNUSED_RESULT static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *in, SaveHeader &header, bool skipThumbnail = true);
-	*/
+	bool _isSaveAllowed; // not properly handled yet
 
 };
 


Commit: a49d74c46ab7176d42ccb3ad12b880444b0db2c5
    https://github.com/scummvm/scummvm/commit/a49d74c46ab7176d42ccb3ad12b880444b0db2c5
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:25:33+01:00

Commit Message:
WAYNESWORLD: Fix credits section

Changed paths:
    engines/waynesworld/credits.pl


diff --git a/engines/waynesworld/credits.pl b/engines/waynesworld/credits.pl
index e86a0cb2fba..6af8f66ca75 100644
--- a/engines/waynesworld/credits.pl
+++ b/engines/waynesworld/credits.pl
@@ -1,4 +1,4 @@
-begin_section("Gnap");
+begin_section("WaynesWorld");
 	add_person("Arnaud Boutonné", "Strangerke", "");
 	add_person("Benjamin Haisch", "john_doe", "");
 end_section();


Commit: d4feaa20515bf1e2f0bdcc9bbd3442eb6dfb53ee
    https://github.com/scummvm/scummvm/commit/d4feaa20515bf1e2f0bdcc9bbd3442eb6dfb53ee
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-03-19T12:53:11+01:00

Commit Message:
WAYNESWORLD: Update license in some files

Changed paths:
    engines/waynesworld/detection.cpp
    engines/waynesworld/gamelogic.cpp
    engines/waynesworld/gamelogic.h
    engines/waynesworld/gamemap.cpp
    engines/waynesworld/graphics.cpp
    engines/waynesworld/graphics.h
    engines/waynesworld/intro.cpp
    engines/waynesworld/objectids.h
    engines/waynesworld/pathfinding.cpp
    engines/waynesworld/staticdata.cpp
    engines/waynesworld/waynesworld.cpp
    engines/waynesworld/waynesworld.h


diff --git a/engines/waynesworld/detection.cpp b/engines/waynesworld/detection.cpp
index e4fa45d52e9..cbe1fca1517 100644
--- a/engines/waynesworld/detection.cpp
+++ b/engines/waynesworld/detection.cpp
@@ -4,10 +4,10 @@
  * 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 2
- * of the License, or (at your option) any later version.
+ * 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
@@ -15,18 +15,12 @@
  * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
 #include "base/plugins.h"
 
-//#include "common/config-manager.h"
-//#include "common/file.h"
-//#include "common/md5.h"
-//#include "common/str-array.h"
-//#include "common/util.h"
 #include "engines/advancedDetector.h"
 
 static const PlainGameDescriptor waynesworldGames[] = {
diff --git a/engines/waynesworld/gamelogic.cpp b/engines/waynesworld/gamelogic.cpp
index ae0506f0e29..0844eb295cf 100644
--- a/engines/waynesworld/gamelogic.cpp
+++ b/engines/waynesworld/gamelogic.cpp
@@ -4,10 +4,10 @@
  * 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 2
- * of the License, or (at your option) any later version.
+ * 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
@@ -15,8 +15,7 @@
  * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/engines/waynesworld/gamelogic.h b/engines/waynesworld/gamelogic.h
index 10551a0cd74..7c8594e4fd8 100644
--- a/engines/waynesworld/gamelogic.h
+++ b/engines/waynesworld/gamelogic.h
@@ -4,10 +4,10 @@
  * 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 2
- * of the License, or (at your option) any later version.
+ * 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
@@ -15,8 +15,7 @@
  * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/engines/waynesworld/gamemap.cpp b/engines/waynesworld/gamemap.cpp
index a4586ebc493..3a6e93363d7 100644
--- a/engines/waynesworld/gamemap.cpp
+++ b/engines/waynesworld/gamemap.cpp
@@ -4,10 +4,10 @@
  * 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 2
- * of the License, or (at your option) any later version.
+ * 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
@@ -15,8 +15,7 @@
  * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/engines/waynesworld/graphics.cpp b/engines/waynesworld/graphics.cpp
index dd61652b27c..be0be409261 100644
--- a/engines/waynesworld/graphics.cpp
+++ b/engines/waynesworld/graphics.cpp
@@ -4,10 +4,10 @@
  * 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 2
- * of the License, or (at your option) any later version.
+ * 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
@@ -15,8 +15,7 @@
  * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/engines/waynesworld/graphics.h b/engines/waynesworld/graphics.h
index aff6b95f0f6..91d6ba3a739 100644
--- a/engines/waynesworld/graphics.h
+++ b/engines/waynesworld/graphics.h
@@ -4,10 +4,10 @@
  * 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 2
- * of the License, or (at your option) any later version.
+ * 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
@@ -15,8 +15,7 @@
  * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/engines/waynesworld/intro.cpp b/engines/waynesworld/intro.cpp
index c191fd68f39..cc1e99e7786 100644
--- a/engines/waynesworld/intro.cpp
+++ b/engines/waynesworld/intro.cpp
@@ -4,10 +4,10 @@
  * 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 2
- * of the License, or (at your option) any later version.
+ * 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
@@ -15,8 +15,7 @@
  * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/engines/waynesworld/objectids.h b/engines/waynesworld/objectids.h
index 6b26d553d1a..47ea91167c7 100644
--- a/engines/waynesworld/objectids.h
+++ b/engines/waynesworld/objectids.h
@@ -4,10 +4,10 @@
  * 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 2
- * of the License, or (at your option) any later version.
+ * 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
@@ -15,8 +15,7 @@
  * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/engines/waynesworld/pathfinding.cpp b/engines/waynesworld/pathfinding.cpp
index ceba03e5e3f..a290ee8c322 100644
--- a/engines/waynesworld/pathfinding.cpp
+++ b/engines/waynesworld/pathfinding.cpp
@@ -4,10 +4,10 @@
  * 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 2
- * of the License, or (at your option) any later version.
+ * 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
@@ -15,8 +15,7 @@
  * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/engines/waynesworld/staticdata.cpp b/engines/waynesworld/staticdata.cpp
index 68d8675ef69..f824b61919d 100644
--- a/engines/waynesworld/staticdata.cpp
+++ b/engines/waynesworld/staticdata.cpp
@@ -4,10 +4,10 @@
  * 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 2
- * of the License, or (at your option) any later version.
+ * 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
@@ -15,8 +15,7 @@
  * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/engines/waynesworld/waynesworld.cpp b/engines/waynesworld/waynesworld.cpp
index 1698e65e006..e0c8020ba4d 100644
--- a/engines/waynesworld/waynesworld.cpp
+++ b/engines/waynesworld/waynesworld.cpp
@@ -4,10 +4,10 @@
  * 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 2
- * of the License, or (at your option) any later version.
+ * 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
@@ -15,8 +15,7 @@
  * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 
diff --git a/engines/waynesworld/waynesworld.h b/engines/waynesworld/waynesworld.h
index 89fff695e66..ccdcf4ca0c0 100644
--- a/engines/waynesworld/waynesworld.h
+++ b/engines/waynesworld/waynesworld.h
@@ -4,10 +4,10 @@
  * 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 2
- * of the License, or (at your option) any later version.
+ * 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
@@ -15,8 +15,7 @@
  * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  */
 




More information about the Scummvm-git-logs mailing list