[Scummvm-git-logs] scummvm master -> 246219053d6108bb9617d69a1f323649b8be4994

aquadran noreply at scummvm.org
Sat Sep 13 14:16:27 UTC 2025


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

Summary:
246219053d WINTERMUTE: Sync with original code


Commit: 246219053d6108bb9617d69a1f323649b8be4994
    https://github.com/scummvm/scummvm/commit/246219053d6108bb9617d69a1f323649b8be4994
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2025-09-13T16:16:23+02:00

Commit Message:
WINTERMUTE: Sync with original code

Changed paths:
    engines/wintermute/ad/ad_actor.cpp
    engines/wintermute/ad/ad_actor.h
    engines/wintermute/ad/ad_game.cpp
    engines/wintermute/ad/ad_game.h
    engines/wintermute/ad/ad_response_box.cpp
    engines/wintermute/ad/ad_response_box.h
    engines/wintermute/base/base.cpp
    engines/wintermute/base/base_active_rect.cpp
    engines/wintermute/base/base_dynamic_buffer.cpp
    engines/wintermute/base/base_dynamic_buffer.h
    engines/wintermute/base/base_fader.cpp
    engines/wintermute/base/base_fader.h
    engines/wintermute/base/base_frame.cpp
    engines/wintermute/base/base_game.cpp
    engines/wintermute/base/base_game.h
    engines/wintermute/base/base_parser.cpp
    engines/wintermute/base/base_parser.h
    engines/wintermute/base/base_quick_msg.cpp
    engines/wintermute/base/base_quick_msg.h
    engines/wintermute/base/base_region.cpp
    engines/wintermute/base/base_script_holder.cpp
    engines/wintermute/base/base_script_holder.h
    engines/wintermute/base/base_scriptable.cpp
    engines/wintermute/base/base_scriptable.h
    engines/wintermute/base/base_sprite.cpp
    engines/wintermute/base/base_string_table.cpp
    engines/wintermute/base/base_string_table.h
    engines/wintermute/base/base_sub_frame.cpp
    engines/wintermute/base/base_surface_storage.cpp
    engines/wintermute/base/base_transition_manager.cpp
    engines/wintermute/base/base_transition_manager.h
    engines/wintermute/base/base_viewport.cpp
    engines/wintermute/base/base_viewport.h
    engines/wintermute/base/gfx/base_renderer.h
    engines/wintermute/base/gfx/base_renderer3d.cpp
    engines/wintermute/base/gfx/base_renderer3d.h
    engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
    engines/wintermute/base/gfx/opengl/base_render_opengl3d.h
    engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
    engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.h
    engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
    engines/wintermute/base/gfx/osystem/base_render_osystem.h
    engines/wintermute/base/particles/part_emitter.cpp
    engines/wintermute/base/scriptables/script.cpp
    engines/wintermute/base/scriptables/script.h
    engines/wintermute/base/scriptables/script_engine.h
    engines/wintermute/base/scriptables/script_value.h
    engines/wintermute/base/sound/base_sound.cpp
    engines/wintermute/base/sound/base_sound_buffer.h
    engines/wintermute/debugger.cpp
    engines/wintermute/debugger.h
    engines/wintermute/debugger/debugger_controller.cpp
    engines/wintermute/debugger/debugger_controller.h
    engines/wintermute/wintermute.cpp


diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp
index fe9ad476641..08fa891c31c 100644
--- a/engines/wintermute/ad/ad_actor.cpp
+++ b/engines/wintermute/ad/ad_actor.cpp
@@ -957,7 +957,7 @@ void AdActor::getNextStep() {
 
 
 //////////////////////////////////////////////////////////////////////////
-void AdActor::initLine(const BasePoint &startPt, const BasePoint &endPt) {
+void AdActor::initLine(BasePoint startPt, BasePoint endPt) {
 	_pFCount = MAX((ABS(endPt.x - startPt.x)), (ABS(endPt.y - startPt.y)));
 
 	_pFStepX = (double)(endPt.x - startPt.x) / _pFCount;
diff --git a/engines/wintermute/ad/ad_actor.h b/engines/wintermute/ad/ad_actor.h
index f97d2b954c0..b7071d37d80 100644
--- a/engines/wintermute/ad/ad_actor.h
+++ b/engines/wintermute/ad/ad_actor.h
@@ -84,12 +84,13 @@ public:
 	bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override;
 	const char *scToString() override;
 
+private:
 	bool setDefaultAnimNames();
 	BaseSprite *getTalkStanceOld(const char *stance);
 	bool mergeAnims(const char *animsFilename);
 	BaseSprite *_animSprite2;
 
-	void initLine(const BasePoint &startPt, const BasePoint &endPt);
+	void initLine(BasePoint startPt, BasePoint endPt);
 	void getNextStep();
 	void followPath();
 	double _pFStepX{};
diff --git a/engines/wintermute/ad/ad_game.cpp b/engines/wintermute/ad/ad_game.cpp
index aa916107d95..fca100aa371 100644
--- a/engines/wintermute/ad/ad_game.cpp
+++ b/engines/wintermute/ad/ad_game.cpp
@@ -1596,7 +1596,7 @@ bool AdGame::scheduleChangeScene(const char *filename, bool fadeIn) {
 
 
 //////////////////////////////////////////////////////////////////////////
-bool AdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) const {
+bool AdGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) {
 	BaseGame::getVersion(verMajor, verMinor, nullptr, nullptr);
 
 	if (extMajor) {
@@ -1900,7 +1900,7 @@ bool AdGame::addGameResponse(int id) {
 bool AdGame::gameResponseUsed(int id) const {
 	char *context = _dlgPendingBranches.getSize() > 0 ? _dlgPendingBranches[_dlgPendingBranches.getSize() - 1] : nullptr;
 	for (int32 i = 0; i < _responsesGame.getSize(); i++) {
-		const AdResponseContext *respContext = _responsesGame[i];
+		AdResponseContext *respContext = _responsesGame[i];
 		if (respContext->_id == id) {
 			// make sure context != nullptr	
 			if ((context == nullptr && respContext->_context == nullptr) || ((context != nullptr && respContext->_context != nullptr) && (context != nullptr && scumm_stricmp(context, respContext->_context) == 0))) {
@@ -1998,13 +1998,14 @@ bool AdGame::displayContent(bool doUpdate, bool displayAll) {
 		if (_stateEx == GAME_WAITING_RESPONSE) {
 			_responseBox->display();
 		}
+		if (_indicatorDisplay) {
 #ifdef ENABLE_FOXTAIL
 		if (BaseEngine::instance().isFoxTail())
 			displayIndicatorFoxTail();
 		else
 #endif
-		displayIndicator();
-
+			displayIndicator();
+		}
 
 		if (doUpdate || displayAll) {
 			//m_AccessMgr->DisplayBeforeGUI();
@@ -2334,6 +2335,7 @@ bool AdGame::onMouseLeftUp() {
 		_activeObject->handleMouse(MOUSE_RELEASE, MOUSE_BUTTON_LEFT);
 	}
 
+	//BasePlatform::releaseCapture();
 	_capturedObject = nullptr;
 	_mouseLeftDown = false;
 
diff --git a/engines/wintermute/ad/ad_game.h b/engines/wintermute/ad/ad_game.h
index 8d1fdcbf13c..7b65eed12b7 100644
--- a/engines/wintermute/ad/ad_game.h
+++ b/engines/wintermute/ad/ad_game.h
@@ -112,7 +112,7 @@ public:
 	TTalkSkipButton _talkSkipButton;
 	TVideoSkipButton _videoSkipButton;
 
-	bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) const override;
+	bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) override;
 	bool scheduleChangeScene(const char *filename, bool fadeIn);
 	char *_scheduledScene;
 	bool _scheduledFadeIn;
@@ -144,8 +144,8 @@ public:
 	BaseArray<AdSceneState *> _sceneStates;
 	BaseArray<char *> _dlgPendingBranches;
 
-	BaseArray<const AdResponseContext *> _responsesBranch;
-	BaseArray<const AdResponseContext *> _responsesGame;
+	BaseArray<AdResponseContext *> _responsesBranch;
+	BaseArray<AdResponseContext *> _responsesGame;
 
 	bool loadFile(const char *filename) override;
 	bool loadBuffer(char *buffer, bool complete = true) override;
diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp
index 0d79f7ad109..de4c0d11c4c 100644
--- a/engines/wintermute/ad/ad_response_box.cpp
+++ b/engines/wintermute/ad/ad_response_box.cpp
@@ -642,7 +642,7 @@ void AdResponseBox::setLastResponseText(const char *text, const char *textOrig)
 }
 
 //////////////////////////////////////////////////////////////////////////
-bool AdResponseBox::handleResponse(const AdResponse *response) {
+bool AdResponseBox::handleResponse(AdResponse *response) {
 	setLastResponseText(response->_text, response->_textOrig);
 
 	AdGame *adGame = (AdGame *)_game;
diff --git a/engines/wintermute/ad/ad_response_box.h b/engines/wintermute/ad/ad_response_box.h
index b92e10dcecd..7a31a839a87 100644
--- a/engines/wintermute/ad/ad_response_box.h
+++ b/engines/wintermute/ad/ad_response_box.h
@@ -43,7 +43,7 @@ public:
 	BaseObject *getPrevAccessObject(BaseObject *CurrObject);
 	bool getObjects(BaseArray<UIObject *> &objects, bool interactiveOnly);
 
-	bool handleResponse(const AdResponse *response);
+	bool handleResponse(AdResponse *response);
 	void setLastResponseText(const char *text, const char *textOrig);
 	char *_lastResponseText;
 	char *_lastResponseTextOrig;
@@ -68,7 +68,7 @@ public:
 	void clearResponses();
 	AdResponseBox(BaseGame *inGame);
 	~AdResponseBox() override;
-	BaseArray<const AdResponse *> _responses;
+	BaseArray<AdResponse *> _responses;
 	BaseArray<UIButton *> _respButtons;
 	UIWindow *_window;
 	UIWindow *_shieldWindow;
diff --git a/engines/wintermute/base/base.cpp b/engines/wintermute/base/base.cpp
index a0b0b5aec6a..f908b0ee59c 100644
--- a/engines/wintermute/base/base.cpp
+++ b/engines/wintermute/base/base.cpp
@@ -106,7 +106,7 @@ bool BaseClass::parseEditorProperty(char *buffer, bool complete) {
 
 	if (complete) {
 		if (parser.getCommand(&buffer, commands, &params) != TOKEN_EDITOR_PROPERTY) {
-			BaseEngine::LOG(0, "'EDITOR_PROPERTY' keyword expected.");
+			_game->LOG(0, "'EDITOR_PROPERTY' keyword expected.");
 			return STATUS_FAILED;
 		}
 		buffer = params;
@@ -139,13 +139,13 @@ bool BaseClass::parseEditorProperty(char *buffer, bool complete) {
 	if (cmd == PARSERR_TOKENNOTFOUND) {
 		SAFE_DELETE_ARRAY(propName);
 		SAFE_DELETE_ARRAY(propValue);
-		BaseEngine::LOG(0, "Syntax error in EDITOR_PROPERTY definition");
+		_game->LOG(0, "Syntax error in EDITOR_PROPERTY definition");
 		return STATUS_FAILED;
 	}
 	if (cmd == PARSERR_GENERIC || propName == nullptr || propValue == nullptr) {
 		SAFE_DELETE_ARRAY(propName);
 		SAFE_DELETE_ARRAY(propValue);
-		BaseEngine::LOG(0, "Error loading EDITOR_PROPERTY definition");
+		_game->LOG(0, "Error loading EDITOR_PROPERTY definition");
 		return STATUS_FAILED;
 	}
 
diff --git a/engines/wintermute/base/base_active_rect.cpp b/engines/wintermute/base/base_active_rect.cpp
index 41282389737..80e27b1a0a7 100644
--- a/engines/wintermute/base/base_active_rect.cpp
+++ b/engines/wintermute/base/base_active_rect.cpp
@@ -116,7 +116,7 @@ void BaseActiveRect::clipRect() {
 	Common::Rect32 rc;
 	bool customViewport;
 	_game->getCurrentViewportRect(&rc, &customViewport);
-	BaseRenderer *rend = BaseEngine::getRenderer();
+	BaseRenderer *rend = _game->_renderer;
 
 	if (!customViewport) {
 		rc.left -= rend->_drawOffsetX;
diff --git a/engines/wintermute/base/base_dynamic_buffer.cpp b/engines/wintermute/base/base_dynamic_buffer.cpp
index 3c2d013576d..7b2c221c119 100644
--- a/engines/wintermute/base/base_dynamic_buffer.cpp
+++ b/engines/wintermute/base/base_dynamic_buffer.cpp
@@ -27,11 +27,12 @@
 
 #include "engines/wintermute/base/base_engine.h"
 #include "engines/wintermute/base/base_dynamic_buffer.h"
+#include "engines/wintermute/base/base_game.h"
 
 namespace Wintermute {
 
 //////////////////////////////////////////////////////////////////////////
-BaseDynamicBuffer::BaseDynamicBuffer(BaseGame *inGame, uint32 initSize, uint32 growBy) {
+BaseDynamicBuffer::BaseDynamicBuffer(BaseGame *inGame, uint32 initSize, uint32 growBy) : BaseClass(inGame) {
 	_buffer = nullptr;
 	_size = 0;
 	_realSize = 0;
@@ -64,7 +65,7 @@ void BaseDynamicBuffer::cleanup() {
 
 
 //////////////////////////////////////////////////////////////////////////
-uint32 BaseDynamicBuffer::getSize() const {
+uint32 BaseDynamicBuffer::getSize() {
 	return _size;
 }
 
@@ -79,7 +80,7 @@ bool BaseDynamicBuffer::init(uint32 initSize) {
 
 	_buffer = (byte *)malloc(initSize);
 	if (!_buffer) {
-		BaseEngine::LOG(0, "BaseDynamicBuffer::Init - Error allocating %d bytes", initSize);
+		_game->LOG(0, "BaseDynamicBuffer::init - Error allocating %d bytes", initSize);
 		return STATUS_FAILED;
 	}
 
@@ -100,7 +101,7 @@ bool BaseDynamicBuffer::putBytes(const byte *buffer, uint32 size) {
 		_realSize += _growBy;
 		_buffer = (byte *)realloc(_buffer, _realSize);
 		if (!_buffer) {
-			BaseEngine::LOG(0, "BaseDynamicBuffer::PutBytes - Error reallocating buffer to %d bytes", _realSize);
+			_game->LOG(0, "BaseDynamicBuffer::putBytes - Error reallocating buffer to %d bytes", _realSize);
 			return STATUS_FAILED;
 		}
 	}
@@ -120,7 +121,7 @@ bool BaseDynamicBuffer::getBytes(byte *buffer, uint32 size) {
 	}
 
 	if (_offset + size > _size) {
-		BaseEngine::LOG(0, "BaseDynamicBuffer::GetBytes - Buffer underflow");
+		_game->LOG(0, "BaseDynamicBuffer::getBytes - Buffer underflow");
 		return STATUS_FAILED;
 	}
 
diff --git a/engines/wintermute/base/base_dynamic_buffer.h b/engines/wintermute/base/base_dynamic_buffer.h
index c08d9017481..ad37de7256a 100644
--- a/engines/wintermute/base/base_dynamic_buffer.h
+++ b/engines/wintermute/base/base_dynamic_buffer.h
@@ -32,7 +32,7 @@
 
 namespace Wintermute {
 
-class BaseDynamicBuffer {
+class BaseDynamicBuffer : public BaseClass {
 public:
 	bool _initialized;
 	void putText(const char *fmt, ...);
@@ -43,7 +43,7 @@ public:
 	void putString(const char *val);
 	bool getBytes(byte *buffer, uint32 size);
 	bool putBytes(const byte *buffer, uint32 size);
-	uint32 getSize() const;
+	uint32 getSize();
 	bool init(uint32 initSize = 0);
 	void cleanup();
 	uint32 _size;
diff --git a/engines/wintermute/base/base_fader.cpp b/engines/wintermute/base/base_fader.cpp
index bd45180b7aa..604beae43e6 100644
--- a/engines/wintermute/base/base_fader.cpp
+++ b/engines/wintermute/base/base_fader.cpp
@@ -97,7 +97,7 @@ bool BaseFader::display() {
 	}
 
 	if (_currentAlpha > 0x00) {
-		BaseEngine::getRenderer()->fadeToColor(_red, _green, _blue, _currentAlpha);
+		return _game->_renderer->fadeToColor(_red, _green, _blue, _currentAlpha);
 	}
 	return STATUS_OK;
 }
@@ -163,7 +163,7 @@ bool BaseFader::fadeOut(uint32 targetColor, uint32 duration, bool system) {
 
 
 //////////////////////////////////////////////////////////////////////////
-uint32 BaseFader::getCurrentColor() const {
+uint32 BaseFader::getCurrentColor() {
 	return BYTETORGBA(_red, _green, _blue, _currentAlpha);
 }
 
diff --git a/engines/wintermute/base/base_fader.h b/engines/wintermute/base/base_fader.h
index 2e79b57825f..3c2abf34a1b 100644
--- a/engines/wintermute/base/base_fader.h
+++ b/engines/wintermute/base/base_fader.h
@@ -36,7 +36,7 @@ namespace Wintermute {
 class BaseFader : public BaseObject {
 public:
 	bool _system;
-	uint32 getCurrentColor() const;
+	uint32 getCurrentColor();
 	bool fadeOut(uint32 targetColor, uint32 duration, bool system = false);
 	bool fadeIn(uint32 sourceColor, uint32 duration, bool system = false);
 	bool deactivate();
diff --git a/engines/wintermute/base/base_frame.cpp b/engines/wintermute/base/base_frame.cpp
index 6ca392faa3b..0eee160ead3 100644
--- a/engines/wintermute/base/base_frame.cpp
+++ b/engines/wintermute/base/base_frame.cpp
@@ -263,7 +263,7 @@ bool BaseFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
 			_sound = new BaseSound(_game);
 			if (!_sound || DID_FAIL(_sound->setSound(params, Audio::Mixer::kSFXSoundType, false))) {
 				if (BaseEngine::instance().getSoundMgr()->_soundAvailable) {
-					BaseEngine::LOG(0, "Error loading sound '%s'.", params);
+					_game->LOG(0, "Error loading sound '%s'.", params);
 				}
 				SAFE_DELETE(_sound);
 			}
@@ -295,12 +295,12 @@ bool BaseFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
 		}
 	}
 	if (cmd == PARSERR_TOKENNOTFOUND) {
-		BaseEngine::LOG(0, "Syntax error in FRAME definition");
+		_game->LOG(0, "Syntax error in FRAME definition");
 		return STATUS_FAILED;
 	}
 
 	if (cmd == PARSERR_GENERIC) {
-		BaseEngine::LOG(0, "Error loading FRAME definition");
+		_game->LOG(0, "Error loading FRAME definition");
 		return STATUS_FAILED;
 	}
 
@@ -315,7 +315,7 @@ bool BaseFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
 
 		if (!sub->_surface) {
 			delete sub;
-			BaseEngine::LOG(0, "Error loading SUBFRAME");
+			_game->LOG(0, "Error loading SUBFRAME");
 			return STATUS_FAILED;
 		}
 
diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp
index 8068a7f216c..8a464f4269b 100644
--- a/engines/wintermute/base/base_game.cpp
+++ b/engines/wintermute/base/base_game.cpp
@@ -1253,7 +1253,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
 			registerObject(win);
 			stack->pushNative(win, true);
 		} else {
-			delete win;
+			SAFE_DELETE(win);
 			stack->pushNULL();
 		}
 		return STATUS_OK;
@@ -1277,7 +1277,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
 	//////////////////////////////////////////////////////////////////////////
 	// PlayMusic / PlayMusicChannel
 	//////////////////////////////////////////////////////////////////////////
-	if (strcmp(name, "PlayMusic") == 0 || strcmp(name, "PlayMusicChannel") == 0) {
+	else if (strcmp(name, "PlayMusic") == 0 || strcmp(name, "PlayMusicChannel") == 0) {
 		int channel = 0;
 		if (strcmp(name, "PlayMusic") == 0) {
 			stack->correctParams(3);
@@ -1693,6 +1693,7 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
 			type = (int)VID_PLAY_STRETCH;
 		}
 
+		bool videoLoaded = false;
 		SAFE_DELETE(_theoraPlayer);
 		_theoraPlayer = new VideoTheoraPlayer(this);
 		if (_theoraPlayer && DID_SUCCEED(_theoraPlayer->initialize(filename, subtitleFile))) {
@@ -1700,11 +1701,15 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
 			if (DID_SUCCEED(_theoraPlayer->play((TVideoPlayback)type, xVal, yVal, true, freezeMusic))) {
 				stack->pushBool(true);
 				script->sleep(0);
+				videoLoaded = true;
 			} else {
 				stack->pushBool(false);
 			}
 		} else {
 			stack->pushBool(false);
+		}
+
+		if (!videoLoaded) {
 			SAFE_DELETE(_theoraPlayer);
 		}
 
@@ -3641,7 +3646,7 @@ void BaseGame::quickMessage(const char *text) {
 		delete _quickMessages[0];
 		_quickMessages.removeAt(0);
 	}
-	_quickMessages.add(new BaseQuickMsg(_currentTime,  text));
+	_quickMessages.add(new BaseQuickMsg(_game, text));
 }
 
 //////////////////////////////////////////////////////////////////////////
@@ -4365,7 +4370,7 @@ bool BaseGame::displayWindows(bool inGame) {
 //////////////////////////////////////////////////////////////////////////
 bool BaseGame::playMusic(int channel, const char *filename, bool looping, uint32 loopStart) {
 	if (channel >= NUM_MUSIC_CHANNELS) {
-		BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
+		_game->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
 		return STATUS_FAILED;
 	}
 
@@ -4390,7 +4395,7 @@ bool BaseGame::playMusic(int channel, const char *filename, bool looping, uint32
 //////////////////////////////////////////////////////////////////////////
 bool BaseGame::stopMusic(int channel) {
 	if (channel >= NUM_MUSIC_CHANNELS) {
-		BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
+		_game->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
 		return STATUS_FAILED;
 	}
 
@@ -4406,7 +4411,7 @@ bool BaseGame::stopMusic(int channel) {
 //////////////////////////////////////////////////////////////////////////
 bool BaseGame::pauseMusic(int channel) {
 	if (channel >= NUM_MUSIC_CHANNELS) {
-		BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
+		_game->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
 		return STATUS_FAILED;
 	}
 
@@ -4420,7 +4425,7 @@ bool BaseGame::pauseMusic(int channel) {
 //////////////////////////////////////////////////////////////////////////
 bool BaseGame::resumeMusic(int channel) {
 	if (channel >= NUM_MUSIC_CHANNELS) {
-		BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
+		_game->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
 		return STATUS_FAILED;
 	}
 
@@ -4434,7 +4439,7 @@ bool BaseGame::resumeMusic(int channel) {
 //////////////////////////////////////////////////////////////////////////
 bool BaseGame::setMusicStartTime(int channel, uint32 time) {
 	if (channel >= NUM_MUSIC_CHANNELS) {
-		BaseEngine::LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
+		_game->LOG(0, "**Error** Attempting to use music channel %d (max num channels: %d)", channel, NUM_MUSIC_CHANNELS);
 		return STATUS_FAILED;
 	}
 
@@ -4469,7 +4474,7 @@ bool BaseGame::loadSettings(const char *filename) {
 
 	char *origBuffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
 	if (origBuffer == nullptr) {
-		BaseEngine::LOG(0, "BaseGame::loadSettings failed for file '%s'", filename);
+		_game->LOG(0, "BaseGame::loadSettings failed for file '%s'", filename);
 		return STATUS_FAILED;
 	}
 
@@ -4481,7 +4486,7 @@ bool BaseGame::loadSettings(const char *filename) {
 	BaseParser parser(_game);
 
 	if (parser.getCommand(&buffer, commands, &params) != TOKEN_SETTINGS) {
-		BaseEngine::LOG(0, "'SETTINGS' keyword expected in game settings file.");
+		_game->LOG(0, "'SETTINGS' keyword expected in game settings file.");
 		return STATUS_FAILED;
 	}
 	buffer = params;
@@ -4557,11 +4562,11 @@ bool BaseGame::loadSettings(const char *filename) {
 		}
 	}
 	if (cmd == PARSERR_TOKENNOTFOUND) {
-		BaseEngine::LOG(0, "Syntax error in game settings '%s'", filename);
+		_game->LOG(0, "Syntax error in game settings '%s'", filename);
 		ret = STATUS_FAILED;
 	}
 	if (cmd == PARSERR_GENERIC) {
-		BaseEngine::LOG(0, "Error loading game settings '%s'", filename);
+		_game->LOG(0, "Error loading game settings '%s'", filename);
 		ret = STATUS_FAILED;
 	}
 
@@ -4883,7 +4888,7 @@ bool BaseGame::handleMouseWheel(int32 delta) {
 }
 
 //////////////////////////////////////////////////////////////////////////
-bool BaseGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) const {
+bool BaseGame::getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) {
 	if (verMajor) {
 		*verMajor = DCGF_VER_MAJOR;
 	}
@@ -5033,7 +5038,7 @@ bool BaseGame::popViewport() {
 }
 
 //////////////////////////////////////////////////////////////////////////
-bool BaseGame::getCurrentViewportRect(Common::Rect32 *rect, bool *custom) const {
+bool BaseGame::getCurrentViewportRect(Common::Rect32 *rect, bool *custom) {
 	if (rect == nullptr) {
 		return STATUS_FAILED;
 	} else {
@@ -5058,7 +5063,7 @@ bool BaseGame::getCurrentViewportRect(Common::Rect32 *rect, bool *custom) const
 }
 
 //////////////////////////////////////////////////////////////////////////
-bool BaseGame::getCurrentViewportOffset(int *offsetX, int *offsetY) const {
+bool BaseGame::getCurrentViewportOffset(int *offsetX, int *offsetY) {
 	if (_viewportSP >= 0) {
 		if (offsetX)
 			*offsetX = _viewportStack[_viewportSP]->_offsetX;
diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h
index bd988dcf85a..8f4a8ac6f62 100644
--- a/engines/wintermute/base/base_game.h
+++ b/engines/wintermute/base/base_game.h
@@ -102,6 +102,9 @@ public:
 	virtual bool onPaint();
 	virtual bool onWindowClose();
 
+	bool isLeftDoubleClick();
+	bool isRightDoubleClick();
+
 	bool _autorunDisabled;
 	uint32 _lastMiniUpdate;
 	bool _miniUpdateEnabled;
@@ -289,7 +292,7 @@ public:
 	void setWindowTitle();
 	bool handleMouseWheel(int32 delta) override;
 	bool _quitting;
-	virtual bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor) const;
+	virtual bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor);
 	bool handleKeypress(Common::Event *event, bool printable = false) override;
 	virtual void handleKeyRelease(Common::Event *event);
 	//bool HandleAccessKey(bool Printable, DWORD CharCode, DWORD KeyData);
@@ -392,8 +395,8 @@ public:
 	void setInteractive(bool state);
 	virtual bool windowLoadHook(UIWindow *win, char **buf, char **params);
 	virtual bool windowScriptMethodHook(UIWindow *win, ScScript *script, ScStack *stack, const char *name);
-	bool getCurrentViewportOffset(int *offsetX = nullptr, int *offsetY = nullptr) const;
-	bool getCurrentViewportRect(Common::Rect32 *rect, bool *custom = nullptr) const;
+	bool getCurrentViewportOffset(int *offsetX = nullptr, int *offsetY = nullptr);
+	bool getCurrentViewportRect(Common::Rect32 *rect, bool *custom = nullptr);
 	bool popViewport();
 	bool pushViewport(BaseViewport *viewport);
 	bool setActiveObject(BaseObject *obj);
@@ -410,19 +413,10 @@ private:
 
 
 
-protected:
-	// WME Lite specific
-	bool _autoSaveOnExit;
-	uint32 _autoSaveSlot;
-	bool _cursorHidden;
-
 public:
 	BaseGameMusic *_musicSystem;
 	Common::String _targetName;
 
-	bool isLeftDoubleClick();
-	bool isRightDoubleClick();
-
 	void setIndicatorVal(int value);
 	bool getBilinearFiltering() { return _bilinearFiltering; }
 	void addMem(int32 bytes);
@@ -449,6 +443,13 @@ public:
 	bool isDoubleClick(int32 buttonIndex);
 	uint32 _usedMem;
 
+protected:
+	// WME Lite specific
+	bool _autoSaveOnExit;
+	uint32 _autoSaveSlot;
+	bool _cursorHidden;
+
+public:
 	void autoSaveOnExit();
 	PluginEvent &pluginEvents() { return _pluginEvents; }
 
diff --git a/engines/wintermute/base/base_parser.cpp b/engines/wintermute/base/base_parser.cpp
index b62998eb80e..5641be30032 100644
--- a/engines/wintermute/base/base_parser.cpp
+++ b/engines/wintermute/base/base_parser.cpp
@@ -158,7 +158,7 @@ char *BaseParser::getSubText(char **buf, char open, char close) {
 
 	// now find the closing delimiter
 	char theChar;
-	long skip = 1;
+	int32 skip = 1;
 
 	if (open == close) { // we cant nest identical delimiters
 		open = 0;
diff --git a/engines/wintermute/base/base_parser.h b/engines/wintermute/base/base_parser.h
index 16366ba5029..99c810b22df 100644
--- a/engines/wintermute/base/base_parser.h
+++ b/engines/wintermute/base/base_parser.h
@@ -76,7 +76,7 @@ public:
 	int32 getObject(char **buf, const TokenDesc *tokens, char **name, char **data);
 	int32 _parserLine = 0;
 	char _lastOffender[255];
-	BaseParser(BaseGame *inGame);
+	BaseParser(BaseGame *inGame = nullptr);
 	virtual ~BaseParser();
 	char *_whiteSpace;
 };
diff --git a/engines/wintermute/base/base_quick_msg.cpp b/engines/wintermute/base/base_quick_msg.cpp
index b6a7545d22e..8717f228edb 100644
--- a/engines/wintermute/base/base_quick_msg.cpp
+++ b/engines/wintermute/base/base_quick_msg.cpp
@@ -25,16 +25,18 @@
  * Copyright (c) 2011 Jan Nedoma
  */
 
+#include "engines/wintermute/base/base.h"
 #include "engines/wintermute/base/base_quick_msg.h"
+#include "engines/wintermute/base/base_game.h"
 
 namespace Wintermute {
 
 //////////////////////////////////////////////////////////////////////////
-BaseQuickMsg::BaseQuickMsg(uint32 startTime, const char *text) {
+BaseQuickMsg::BaseQuickMsg(BaseGame *inGame, const char *text) : BaseClass(inGame) {
 	size_t textSize = strlen(text) + 1;
 	_text = new char[textSize];
 	Common::strcpy_s(_text, textSize, text);
-	_startTime = startTime;
+	_startTime = _game->_currentTime;
 }
 
 
@@ -45,7 +47,7 @@ BaseQuickMsg::~BaseQuickMsg() {
 
 
 //////////////////////////////////////////////////////////////////////////
-const char *BaseQuickMsg::getText() const {
+const char *BaseQuickMsg::getText() {
 	return _text;
 }
 
diff --git a/engines/wintermute/base/base_quick_msg.h b/engines/wintermute/base/base_quick_msg.h
index c9a64013ac8..ab3bf1ac794 100644
--- a/engines/wintermute/base/base_quick_msg.h
+++ b/engines/wintermute/base/base_quick_msg.h
@@ -32,12 +32,12 @@
 
 namespace Wintermute {
 
-class BaseQuickMsg {
+class BaseQuickMsg : public BaseClass {
 public:
-	const char *getText() const;
+	const char *getText();
 	uint32 _startTime;
 	char *_text;
-	BaseQuickMsg(uint32 startTime, const char *text);
+	BaseQuickMsg(BaseGame *inGame, const char *text);
 	virtual ~BaseQuickMsg();
 };
 
diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp
index 7d68468f51e..d3196e425a5 100644
--- a/engines/wintermute/base/base_region.cpp
+++ b/engines/wintermute/base/base_region.cpp
@@ -30,6 +30,7 @@
 #include "engines/wintermute/base/base_parser.h"
 #include "engines/wintermute/base/base_dynamic_buffer.h"
 #include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/base/base_game.h"
 #include "engines/wintermute/base/scriptables/script.h"
 #include "engines/wintermute/base/scriptables/script_stack.h"
 #include "engines/wintermute/base/scriptables/script_value.h"
@@ -104,7 +105,7 @@ bool BaseRegion::pointInRegion(int x, int y) {
 bool BaseRegion::loadFile(const char *filename) {
 	char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
 	if (buffer == nullptr) {
-		BaseEngine::LOG(0, "BaseRegion::loadFile failed for file '%s'", filename);
+		_game->LOG(0, "BaseRegion::loadFile failed for file '%s'", filename);
 		return STATUS_FAILED;
 	}
 
@@ -113,7 +114,7 @@ bool BaseRegion::loadFile(const char *filename) {
 	setFilename(filename);
 
 	if (DID_FAIL(ret = loadBuffer(buffer, true))) {
-		BaseEngine::LOG(0, "Error parsing REGION file '%s'", filename);
+		_game->LOG(0, "Error parsing REGION file '%s'", filename);
 	}
 
 
@@ -154,7 +155,7 @@ bool BaseRegion::loadBuffer(char *buffer, bool complete) {
 
 	if (complete) {
 		if (parser.getCommand(&buffer, commands, &params) != TOKEN_REGION) {
-			BaseEngine::LOG(0, "'REGION' keyword expected.");
+			_game->LOG(0, "'REGION' keyword expected.");
 			return STATUS_FAILED;
 		}
 		buffer = params;
@@ -209,7 +210,7 @@ bool BaseRegion::loadBuffer(char *buffer, bool complete) {
 		}
 	}
 	if (cmd == PARSERR_TOKENNOTFOUND) {
-		BaseEngine::LOG(0, "Syntax error in REGION definition");
+		_game->LOG(0, "Syntax error in REGION definition");
 		return STATUS_FAILED;
 	}
 
diff --git a/engines/wintermute/base/base_script_holder.cpp b/engines/wintermute/base/base_script_holder.cpp
index 56664ded0fc..9acc792df14 100644
--- a/engines/wintermute/base/base_script_holder.cpp
+++ b/engines/wintermute/base/base_script_holder.cpp
@@ -300,7 +300,7 @@ bool BaseScriptHolder::addScript(const char *filename) {
 	for (int32 i = 0; i < _scripts.getSize(); i++) {
 		if (scumm_stricmp(_scripts[i]->_filename, filename) == 0) {
 			if (_scripts[i]->_state != SCRIPT_FINISHED) {
-				BaseEngine::LOG(0, "BaseScriptHolder::addScript - trying to add script '%s' multiple times (obj: '%s')", filename, _name);
+				_game->LOG(0, "BaseScriptHolder::addScript - trying to add script '%s' mutiple times (obj: '%s')", filename, _name);
 				return STATUS_OK;
 			}
 		}
@@ -346,9 +346,9 @@ bool BaseScriptHolder::removeScript(ScScript *script) {
 }
 
 //////////////////////////////////////////////////////////////////////////
-bool BaseScriptHolder::canHandleEvent(const char *EventName) const {
+bool BaseScriptHolder::canHandleEvent(const char *eventName) {
 	for (int32 i = 0; i < _scripts.getSize(); i++) {
-		if (!_scripts[i]->_thread && _scripts[i]->canHandleEvent(EventName)) {
+		if (!_scripts[i]->_thread && _scripts[i]->canHandleEvent(eventName)) {
 			return true;
 		}
 	}
@@ -357,9 +357,9 @@ bool BaseScriptHolder::canHandleEvent(const char *EventName) const {
 
 
 //////////////////////////////////////////////////////////////////////////
-bool BaseScriptHolder::canHandleMethod(const char *MethodName) const {
+bool BaseScriptHolder::canHandleMethod(const char *methodName) {
 	for (int32 i = 0; i < _scripts.getSize(); i++) {
-		if (!_scripts[i]->_thread && _scripts[i]->canHandleMethod(MethodName)) {
+		if (!_scripts[i]->_thread && _scripts[i]->canHandleMethod(methodName)) {
 			return true;
 		}
 	}
@@ -386,7 +386,7 @@ bool BaseScriptHolder::parseProperty(char *buffer, bool complete) {
 
 	if (complete) {
 		if (parser.getCommand(&buffer, commands, &params) != TOKEN_PROPERTY) {
-			BaseEngine::LOG(0, "'PROPERTY' keyword expected.");
+			_game->LOG(0, "'PROPERTY' keyword expected.");
 			return STATUS_FAILED;
 		}
 		buffer = params;
@@ -419,13 +419,13 @@ bool BaseScriptHolder::parseProperty(char *buffer, bool complete) {
 	if (cmd == PARSERR_TOKENNOTFOUND) {
 		SAFE_DELETE_ARRAY(propName);
 		SAFE_DELETE_ARRAY(propValue);
-		BaseEngine::LOG(0, "Syntax error in PROPERTY definition");
+		_game->LOG(0, "Syntax error in PROPERTY definition");
 		return STATUS_FAILED;
 	}
 	if (cmd == PARSERR_GENERIC || propName == nullptr || propValue == nullptr) {
 		SAFE_DELETE_ARRAY(propName);
 		SAFE_DELETE_ARRAY(propValue);
-		BaseEngine::LOG(0, "Error loading PROPERTY definition");
+		_game->LOG(0, "Error loading PROPERTY definition");
 		return STATUS_FAILED;
 	}
 
diff --git a/engines/wintermute/base/base_script_holder.h b/engines/wintermute/base/base_script_holder.h
index dfe004d6ddd..1390315c15e 100644
--- a/engines/wintermute/base/base_script_holder.h
+++ b/engines/wintermute/base/base_script_holder.h
@@ -43,8 +43,8 @@ public:
 
 	ScScript *invokeMethodThread(const char *methodName) override;
 	virtual void makeFreezable(bool freezable);
-	bool canHandleEvent(const char *eventName) const;
-	bool canHandleMethod(const char *eventMethod) const override;
+	bool canHandleEvent(const char *eventName);
+	bool canHandleMethod(const char *eventMethod) override;
 	bool cleanup();
 	bool removeScript(ScScript *script);
 	bool addScript(const char *filename);
diff --git a/engines/wintermute/base/base_scriptable.cpp b/engines/wintermute/base/base_scriptable.cpp
index 2fbc8e082e1..b10e48884ff 100644
--- a/engines/wintermute/base/base_scriptable.cpp
+++ b/engines/wintermute/base/base_scriptable.cpp
@@ -176,7 +176,7 @@ void BaseScriptable::scDebuggerDesc(char *buf, int bufSize) {
 }
 
 //////////////////////////////////////////////////////////////////////////
-bool BaseScriptable::canHandleMethod(const char *eventMethod) const {
+bool BaseScriptable::canHandleMethod(const char *eventMethod) {
 	return false;
 }
 
diff --git a/engines/wintermute/base/base_scriptable.h b/engines/wintermute/base/base_scriptable.h
index 6a3a08259e7..7a4f9df1615 100644
--- a/engines/wintermute/base/base_scriptable.h
+++ b/engines/wintermute/base/base_scriptable.h
@@ -47,7 +47,7 @@ public:
 	~BaseScriptable() override;
 
 	// high level scripting interface
-	virtual bool canHandleMethod(const char *eventMethod) const;
+	virtual bool canHandleMethod(const char *eventMethod);
 	virtual bool scSetProperty(const char *name, ScValue *value);
 	virtual ScValue *scGetProperty(const char *name);
 	virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp
index 343eeeefb25..3a72ef4417c 100644
--- a/engines/wintermute/base/base_sprite.cpp
+++ b/engines/wintermute/base/base_sprite.cpp
@@ -125,7 +125,7 @@ bool BaseSprite::draw(int x, int y, BaseObject *registerOwner, float zoomX, floa
 //////////////////////////////////////////////////////////////////////
 bool BaseSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType cacheType) {
 	if (!BaseFileManager::getEngineInstance()->hasFile(filename)) {
-		BaseEngine::LOG(0, "BaseSprite::LoadFile failed for file '%s'", filename);
+		_game->LOG(0, "BaseSprite::loadFile failed for file '%s'", filename);
 		if (_game->_debugMode) {
 			return loadFile("invalid_debug.bmp", lifeTime, cacheType);
 		} else {
@@ -144,7 +144,7 @@ bool BaseSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType c
 		BaseSubFrame *subframe = new BaseSubFrame(_game);
 		subframe->setSurface(filename, true, 0, 0, 0, lifeTime, true);
 		if (subframe->_surface == nullptr) {
-			BaseEngine::LOG(0, "Error loading simple sprite '%s'", filename);
+			_game->LOG(0, "Error loading simple sprite '%s'", filename);
 			ret = STATUS_FAILED;
 			delete frame;
 			delete subframe;
@@ -159,7 +159,7 @@ bool BaseSprite::loadFile(const char *filename, int lifeTime, TSpriteCacheType c
 		char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename);
 		if (buffer) {
 			if (DID_FAIL(ret = loadBuffer(buffer, true, lifeTime, cacheType))) {
-				BaseEngine::LOG(0, "Error parsing SPRITE file '%s'", filename);
+				_game->LOG(0, "Error parsing SPRITE file '%s'", filename);
 			} else {
 				ret = STATUS_OK;
 			}
@@ -220,7 +220,7 @@ bool BaseSprite::loadBuffer(char *buffer, bool complete, int lifeTime, TSpriteCa
 
 	if (complete) {
 		if (parser.getCommand(&buffer, commands, &params) != TOKEN_SPRITE) {
-			BaseEngine::LOG(0, "'SPRITE' keyword expected.");
+			_game->LOG(0, "'SPRITE' keyword expected.");
 			return STATUS_FAILED;
 		}
 		buffer = params;
@@ -299,7 +299,7 @@ bool BaseSprite::loadBuffer(char *buffer, bool complete, int lifeTime, TSpriteCa
 
 			if (DID_FAIL(frame->loadBuffer(params, frameLifeTime, _streamedKeepLoaded))) {
 				delete frame;
-				BaseEngine::LOG(0, "Error parsing frame %d", frameCount);
+				_game->LOG(0, "Error parsing frame %d", frameCount);
 				return STATUS_FAILED;
 			}
 
@@ -321,7 +321,7 @@ bool BaseSprite::loadBuffer(char *buffer, bool complete, int lifeTime, TSpriteCa
 	}
 
 	if (cmd == PARSERR_TOKENNOTFOUND) {
-		BaseEngine::LOG(0, "Syntax error in SPRITE definition");
+		_game->LOG(0, "Syntax error in SPRITE definition");
 		return STATUS_FAILED;
 	}
 	_canBreak = !_continuous;
diff --git a/engines/wintermute/base/base_string_table.cpp b/engines/wintermute/base/base_string_table.cpp
index 9e03cd1c61c..43275d1df35 100644
--- a/engines/wintermute/base/base_string_table.cpp
+++ b/engines/wintermute/base/base_string_table.cpp
@@ -62,7 +62,7 @@ bool BaseStringTable::addString(const char *key, const char *val, bool reportDup
 
 	StringsIter it = _strings.find(finalKey);
 	if (it != _strings.end() && reportDuplicities) {
-		BaseEngine::LOG(0, "  Warning: Duplicate definition of string '%s'.", finalKey.c_str());
+		_game->LOG(0, "  Warning: Duplicate definition of string '%s'.", finalKey.c_str());
 	}
 
 	_strings[finalKey] = val;
@@ -71,7 +71,7 @@ bool BaseStringTable::addString(const char *key, const char *val, bool reportDup
 }
 
 //////////////////////////////////////////////////////////////////////////
-char *BaseStringTable::getKey(const char *str) const {
+char *BaseStringTable::getKey(const char *str) {
 	if (str == nullptr || str[0] != '/') {
 		return nullptr;
 	}
@@ -107,7 +107,7 @@ char *BaseStringTable::getKey(const char *str) const {
 	}
 }
 
-void BaseStringTable::replaceExpand(char *key, char *newStr, size_t newStrSize) const {
+void BaseStringTable::replaceExpand(char *key, char *newStr, size_t newStrSize) {
 	// W/A: Remove accented chars like input text in Polish version of Alpha Polaris
 	if (BaseEngine::instance().getGameId() == "alphapolaris" &&
 	    BaseEngine::instance().getLanguage() == Common::PL_POL) {
@@ -133,7 +133,7 @@ void BaseStringTable::replaceExpand(char *key, char *newStr, size_t newStrSize)
 }
 
 //////////////////////////////////////////////////////////////////////////
-void BaseStringTable::expand(char **str) const {
+void BaseStringTable::expand(char **str) {
 	if (str == nullptr || *str == nullptr || *str[0] != '/') {
 		return;
 	}
@@ -174,7 +174,7 @@ void BaseStringTable::expand(char **str) const {
 }
 
 //////////////////////////////////////////////////////////////////////////
-void BaseStringTable::expand(Common::String &str) const {
+void BaseStringTable::expand(Common::String &str) {
 	size_t tmpSize = str.size() + 1;
 	char *tmp = new char[tmpSize];
 	Common::strcpy_s(tmp, tmpSize, str.c_str());
@@ -185,7 +185,7 @@ void BaseStringTable::expand(Common::String &str) const {
 
 
 //////////////////////////////////////////////////////////////////////////
-const char *BaseStringTable::expandStatic(const char *string) const {
+const char *BaseStringTable::expandStatic(const char *string) {
 	if (string == nullptr || string[0] == '\0' || string[0] != '/') {
 		return string;
 	}
@@ -233,7 +233,7 @@ bool BaseStringTable::loadFile(const char *filename, bool clearOld) {
 	uint32 size;
 	char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename, &size);
 	if (buffer == nullptr) {
-		BaseEngine::LOG(0, "BaseStringTable::LoadFile failed for file '%s'", filename);
+		_game->LOG(0, "BaseStringTable::loadFile failed for file '%s'", filename);
 		return STATUS_FAILED;
 	}
 
@@ -244,7 +244,7 @@ bool BaseStringTable::loadFile(const char *filename, bool clearOld) {
 		if (_game->_textEncoding != TEXT_UTF8) {
 			_game->_textEncoding = TEXT_UTF8;
 			//_game->_textEncoding = TEXT_ANSI;
-			BaseEngine::LOG(0, "  UTF8 file detected, switching to UTF8 text encoding");
+			_game->LOG(0, "  UTF8 file detected, switching to UTF8 text encoding");
 		}
 	} else {
 		_game->_textEncoding = TEXT_ANSI;
@@ -286,7 +286,7 @@ bool BaseStringTable::loadFile(const char *filename, bool clearOld) {
 
 	delete[] buffer;
 
-	BaseEngine::LOG(0, "  %d strings loaded", _strings.size());
+	_game->LOG(0, "  %d strings loaded", _strings.size());
 
 	return STATUS_OK;
 }
diff --git a/engines/wintermute/base/base_string_table.h b/engines/wintermute/base/base_string_table.h
index ffe1c3b600a..14fb5c3aeda 100644
--- a/engines/wintermute/base/base_string_table.h
+++ b/engines/wintermute/base/base_string_table.h
@@ -38,21 +38,21 @@ class BasePersistenceManager;
 
 class BaseStringTable : public BaseClass {
 public:
-	const char *expandStatic(const char *string) const;
+	const char *expandStatic(const char *string);
 	bool loadFile(const char *filename, bool deleteAll = true);
-	void expand(char **str) const;
-	void expand(Common::String &str) const;
+	void expand(char **str);
+	void expand(Common::String &str);
 	bool addString(const char *key, const char *val, bool reportDuplicities = true);
 	BaseStringTable(BaseGame *inGame);
 	~BaseStringTable() override;
 	Common::HashMap<Common::String, Common::String> _strings;
-	char *getKey(const char *str) const;
+	char *getKey(const char *str);
 	bool persist(BasePersistenceManager *persistMgr) override;
 private:
 	Common::Array<Common::String> _filenames;
 	typedef Common::HashMap<Common::String, Common::String>::const_iterator StringsIter;
 
-	void replaceExpand(char *key, char *newStr, size_t newStrSize) const;
+	void replaceExpand(char *key, char *newStr, size_t newStrSize);
 };
 
 } // End of namespace Wintermute
diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp
index bd4c68decc2..364aa4037b5 100644
--- a/engines/wintermute/base/base_sub_frame.cpp
+++ b/engines/wintermute/base/base_sub_frame.cpp
@@ -183,7 +183,7 @@ bool BaseSubFrame::loadBuffer(char *buffer, int lifeTime, bool keepLoaded) {
 		}
 	}
 	if (cmd == PARSERR_TOKENNOTFOUND) {
-		BaseEngine::LOG(0, "Syntax error in SUBFRAME definition");
+		_game->LOG(0, "Syntax error in SUBFRAME definition");
 		return STATUS_FAILED;
 	}
 
diff --git a/engines/wintermute/base/base_surface_storage.cpp b/engines/wintermute/base/base_surface_storage.cpp
index 69aa5a87ae6..425afbc05f8 100644
--- a/engines/wintermute/base/base_surface_storage.cpp
+++ b/engines/wintermute/base/base_surface_storage.cpp
@@ -55,7 +55,7 @@ BaseSurfaceStorage::~BaseSurfaceStorage() {
 bool BaseSurfaceStorage::cleanup(bool warn) {
 	for (int32 i = 0; i < _surfaces.getSize(); i++) {
 		if (warn) {
-			BaseEngine::LOG(0, "BaseSurfaceStorage warning: purging surface '%s', usage:%d", _surfaces[i]->_filename.c_str(), _surfaces[i]->_referenceCount);
+			_game->LOG(0, "BaseSurfaceStorage warning: purging surface '%s', usage:%d", _surfaces[i]->_filename.c_str(), _surfaces[i]->_referenceCount);
 		}
 		delete _surfaces[i];
 	}
@@ -112,7 +112,7 @@ BaseSurface *BaseSurfaceStorage::addSurface(const char *filename, bool defaultCK
 
 	if (!BaseFileManager::getEngineInstance()->hasFile(filename)) {
 		if (filename) {
-			BaseEngine::LOG(0, "Missing image: '%s'", filename);
+			_game->LOG(0, "Missing image: '%s'", filename);
 		}
 		if (_game->_debugMode) {
 			return addSurface("invalid_debug.bmp", defaultCK, ckRed, ckGreen, ckBlue, lifeTime, keepLoaded);
@@ -145,7 +145,7 @@ bool BaseSurfaceStorage::restoreAll() {
 	for (int32 i = 0; i < _surfaces.getSize(); i++) {
 		ret = _surfaces[i]->restore();
 		if (ret != STATUS_OK) {
-			BaseEngine::LOG(0, "BaseSurfaceStorage::RestoreAll failed");
+			_game->LOG(0, "BaseSurfaceStorage::restoreAll failed");
 			return ret;
 		}
 	}
diff --git a/engines/wintermute/base/base_transition_manager.cpp b/engines/wintermute/base/base_transition_manager.cpp
index 4fc35839fb5..b86df66c481 100644
--- a/engines/wintermute/base/base_transition_manager.cpp
+++ b/engines/wintermute/base/base_transition_manager.cpp
@@ -51,7 +51,7 @@ BaseTransitionMgr::~BaseTransitionMgr() {
 
 
 //////////////////////////////////////////////////////////////////////////
-bool BaseTransitionMgr::isReady() const {
+bool BaseTransitionMgr::isReady() {
 	return (_state == TRANS_MGR_READY);
 }
 
@@ -72,7 +72,7 @@ bool BaseTransitionMgr::start(TTransitionType type, bool nonInteractive) {
 		_origInteractive = _game->_interactive;
 		_game->_interactive = false;
 	} else {
-		//_preserveInteractive;
+		_preserveInteractive = false;
 	}
 
 	_type = type;
@@ -104,7 +104,7 @@ bool BaseTransitionMgr::update() {
 		uint32 time = g_system->getMillis() - _lastTime;
 		int alpha = (int)(255 - (float)time / (float)FADE_DURATION * 255);
 		alpha = MIN(255, MAX(alpha, 0));
-		BaseEngine::getRenderer()->fade((uint16)alpha);
+		_game->_renderer->fade((uint16)alpha);
 
 		if (time > FADE_DURATION) {
 			_state = TRANS_MGR_READY;
@@ -116,7 +116,7 @@ bool BaseTransitionMgr::update() {
 		uint32 time = g_system->getMillis() - _lastTime;
 		int alpha = (int)((float)time / (float)FADE_DURATION * 255);
 		alpha = MIN(255, MAX(alpha, 0));
-		BaseEngine::getRenderer()->fade((uint16)alpha);
+		_game->_renderer->fade((uint16)alpha);
 
 		if (time > FADE_DURATION) {
 			_state = TRANS_MGR_READY;
diff --git a/engines/wintermute/base/base_transition_manager.h b/engines/wintermute/base/base_transition_manager.h
index 196e577698d..19d4db0337c 100644
--- a/engines/wintermute/base/base_transition_manager.h
+++ b/engines/wintermute/base/base_transition_manager.h
@@ -40,7 +40,7 @@ public:
 	bool _preserveInteractive;
 	bool update();
 	bool start(TTransitionType type, bool nonInteractive = false);
-	bool isReady() const;
+	bool isReady();
 	TTransMgrState _state;
 	BaseTransitionMgr(BaseGame *inGame);
 	~BaseTransitionMgr() override;
diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp
index 61da3e1352a..4a0d78ad6b9 100644
--- a/engines/wintermute/base/base_viewport.cpp
+++ b/engines/wintermute/base/base_viewport.cpp
@@ -27,6 +27,7 @@
 
 #include "engines/wintermute/base/base_viewport.h"
 #include "engines/wintermute/base/base_engine.h"
+#include "engines/wintermute/base/base_game.h"
 #include "engines/wintermute/base/base_persistence_manager.h"
 #include "engines/wintermute/base/gfx/base_renderer.h"
 #include "engines/wintermute/platform_osystem.h"
@@ -68,8 +69,8 @@ bool BaseViewport::setRect(int32 left, int32 top, int32 right, int32 bottom, boo
 	if (!noCheck) {
 		left = MAX<int32>(left, 0);
 		top = MAX<int32>(top, 0);
-		right = MIN(right, BaseEngine::instance().getRenderer()->getWidth());
-		bottom = MIN(bottom, BaseEngine::instance().getRenderer()->getHeight());
+		right = MIN(right, _game->_renderer->getWidth());
+		bottom = MIN(bottom, _game->_renderer->getHeight());
 	}
 
 	BasePlatform::setRect(&_rect, left, top, right, bottom);
@@ -86,13 +87,13 @@ Common::Rect32 *BaseViewport::getRect() {
 
 
 //////////////////////////////////////////////////////////////////////////
-int BaseViewport::getWidth() const {
+int BaseViewport::getWidth() {
 	return _rect.right - _rect.left;
 }
 
 
 //////////////////////////////////////////////////////////////////////////
-int BaseViewport::getHeight() const {
+int BaseViewport::getHeight() {
 	return _rect.bottom - _rect.top;
 }
 
diff --git a/engines/wintermute/base/base_viewport.h b/engines/wintermute/base/base_viewport.h
index 5c1989f49f8..e5ba3aeed77 100644
--- a/engines/wintermute/base/base_viewport.h
+++ b/engines/wintermute/base/base_viewport.h
@@ -36,8 +36,8 @@ namespace Wintermute {
 class BaseObject;
 class BaseViewport : public BaseClass {
 public:
-	int getHeight() const;
-	int getWidth() const;
+	int getHeight();
+	int getWidth();
 	Common::Rect32 *getRect();
 	bool setRect(int32 left, int32 top, int32 right, int32 bottom, bool noCheck = false);
 	DECLARE_PERSISTENT(BaseViewport, BaseClass)
diff --git a/engines/wintermute/base/gfx/base_renderer.h b/engines/wintermute/base/gfx/base_renderer.h
index 496a53501ac..572cb99eded 100644
--- a/engines/wintermute/base/gfx/base_renderer.h
+++ b/engines/wintermute/base/gfx/base_renderer.h
@@ -75,7 +75,7 @@ public:
 	 *
 	 * @param alpha amount to fade by (alpha value of black)
 	 */
-	virtual void fade(uint16 alpha) = 0;
+	virtual bool fade(uint16 alpha) = 0;
 	/**
 	 * Fade a portion of the screen to a specific color
 	 *
@@ -85,7 +85,7 @@ public:
 	 * @param a the alpha component to fade too.
 	 * @param rect the portion of the screen to fade (if nullptr, the entire screen will be faded).
 	 */
-	virtual void fadeToColor(byte r, byte g, byte b, byte a) = 0;
+	virtual bool fadeToColor(byte r, byte g, byte b, byte a) = 0;
 
 	virtual bool fillRect(int x, int y, int w, int h, uint32 color); // Unused outside indicator-display
 	BaseRenderer(BaseGame *inGame = nullptr);
diff --git a/engines/wintermute/base/gfx/base_renderer3d.cpp b/engines/wintermute/base/gfx/base_renderer3d.cpp
index 98b7a0bf6f7..4cb33cae53f 100644
--- a/engines/wintermute/base/gfx/base_renderer3d.cpp
+++ b/engines/wintermute/base/gfx/base_renderer3d.cpp
@@ -21,6 +21,7 @@
 
 #include "engines/wintermute/base/gfx/base_renderer3d.h"
 #include "engines/wintermute/base/base_game.h"
+#include "engines/wintermute/base/gfx/3dutils.h"
 
 #include "common/config-manager.h"
 
@@ -30,7 +31,7 @@ BaseRenderer3D::BaseRenderer3D(Wintermute::BaseGame *inGame) : BaseRenderer(inGa
 	_camera = nullptr;
 
 	_state = RSTATE_NONE;
-	_fov = (float)M_PI / 4;
+	_fov = (float)DX_PI / 4;
 
 	_nearClipPlane = DEFAULT_NEAR_PLANE;
 	_farClipPlane = DEFAULT_FAR_PLANE;
@@ -96,8 +97,8 @@ bool BaseRenderer3D::getProjectionParams(float *resWidth, float *resHeight, floa
 	return true;
 }
 
-void BaseRenderer3D::fade(uint16 alpha) {
-	fadeToColor(0, 0, 0, (byte)(255 - alpha));
+bool BaseRenderer3D::fade(uint16 alpha) {
+	return fadeToColor(0, 0, 0, (byte)(255 - alpha));
 }
 
 bool BaseRenderer3D::setAmbientLightColor(uint32 color) {
diff --git a/engines/wintermute/base/gfx/base_renderer3d.h b/engines/wintermute/base/gfx/base_renderer3d.h
index 757942a16e2..a01ea7ca0ac 100644
--- a/engines/wintermute/base/gfx/base_renderer3d.h
+++ b/engines/wintermute/base/gfx/base_renderer3d.h
@@ -84,7 +84,7 @@ public:
 	virtual bool invalidateDeviceObjects() = 0;
 	virtual bool restoreDeviceObjects() = 0;
 	BaseSurfaceOpenGL3D *_lastTexture;
-	void fade(uint16 alpha) override;
+	bool fade(uint16 alpha) override;
 	bool drawSprite(BaseSurface *texture, const Common::Rect32 &rect, float zoomX, float zoomY, const DXVector2 &pos,
 	                uint32 color, bool alphaDisable, Graphics::TSpriteBlendMode blendMode, bool mirrorX, bool mirrorY);
 	virtual bool drawSpriteEx(BaseSurface *texture, const Common::Rect32 &rect, const DXVector2 &pos, const DXVector2 &rot, const DXVector2 &scale,
diff --git a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
index 81f992366d5..f16468e0150 100644
--- a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
@@ -582,7 +582,7 @@ bool BaseRenderOpenGL3D::fillRect(int x, int y, int w, int h, uint32 color) {
 	return true;
 }
 
-void BaseRenderOpenGL3D::fadeToColor(byte r, byte g, byte b, byte a) {
+bool BaseRenderOpenGL3D::fadeToColor(byte r, byte g, byte b, byte a) {
 	float left, right, bottom, top;
 
 	left = _viewportRect.left;
@@ -628,6 +628,8 @@ void BaseRenderOpenGL3D::fadeToColor(byte r, byte g, byte b, byte a) {
 	glDisableClientState(GL_VERTEX_ARRAY);
 
 	setup2D(true);
+
+	return true;
 }
 
 BaseImage *BaseRenderOpenGL3D::takeScreenshot(int newWidth, int newHeight) {
diff --git a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.h b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.h
index 5bd426658a0..b2f12a31352 100644
--- a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.h
+++ b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.h
@@ -97,7 +97,7 @@ public:
 	bool stencilSupported() override;
 
 	BaseImage *takeScreenshot(int newWidth = 0, int newHeight = 0) override;
-	void fadeToColor(byte r, byte g, byte b, byte a) override;
+	bool fadeToColor(byte r, byte g, byte b, byte a) override;
 
 	bool flip() override;
 	bool clear() override;
diff --git a/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp b/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
index 2fac81a812d..5c2f9a58188 100644
--- a/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.cpp
@@ -675,7 +675,7 @@ bool BaseRenderOpenGL3DShader::fillRect(int x, int y, int w, int h, uint32 color
 	return true;
 }
 
-void BaseRenderOpenGL3DShader::fadeToColor(byte r, byte g, byte b, byte a) {
+bool BaseRenderOpenGL3DShader::fadeToColor(byte r, byte g, byte b, byte a) {
 	float left, right, bottom, top;
 
 	left = _viewportRect.left;
@@ -726,6 +726,8 @@ void BaseRenderOpenGL3DShader::fadeToColor(byte r, byte g, byte b, byte a) {
 	glBindBuffer(GL_ARRAY_BUFFER, 0);
 	
 	setup2D(true);
+
+	return true;
 }
 
 BaseImage *BaseRenderOpenGL3DShader::takeScreenshot(int newWidth, int newHeight) {
diff --git a/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.h b/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.h
index 8600cea8d66..20aed511443 100644
--- a/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.h
+++ b/engines/wintermute/base/gfx/opengl/base_render_opengl3d_shader.h
@@ -99,7 +99,7 @@ public:
 	bool stencilSupported() override;
 
 	BaseImage *takeScreenshot(int newWidth = 0, int newHeight = 0) override;
-	void fadeToColor(byte r, byte g, byte b, byte a) override;
+	bool fadeToColor(byte r, byte g, byte b, byte a) override;
 	bool flip() override;
 	bool clear() override;
 
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
index 143717ff615..c2f2c896053 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
@@ -224,13 +224,13 @@ bool BaseRenderOSystem::clear() {
 }
 
 //////////////////////////////////////////////////////////////////////////
-void BaseRenderOSystem::fade(uint16 alpha) {
+bool BaseRenderOSystem::fade(uint16 alpha) {
 	byte dwAlpha = (byte)(255 - alpha);
 	return fadeToColor(0, 0, 0, dwAlpha);
 }
 
 //////////////////////////////////////////////////////////////////////////
-void BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a) {
+bool BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a) {
 	Common::Rect fillRect;
 
 	Common::Rect32 rc;
@@ -247,6 +247,8 @@ void BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a) {
 	temp._rgbaMod = MS_ARGB(a, r, g, b);
 	temp._alphaDisable = (a == 0xff);
 	drawSurface(nullptr, nullptr, &sizeRect, &fillRect, temp);
+
+	return true;
 }
 
 Graphics::PixelFormat BaseRenderOSystem::getPixelFormat() const {
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h
index 168db6a2458..406e4684c67 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h
@@ -73,8 +73,8 @@ public:
 	bool forcedFlip() override;
 	bool clear() override;
 	Graphics::PixelFormat getPixelFormat() const override;
-	void fade(uint16 alpha) override;
-	void fadeToColor(byte r, byte g, byte b, byte a) override;
+	bool fade(uint16 alpha) override;
+	bool fadeToColor(byte r, byte g, byte b, byte a) override;
 
 	bool fillRect(int x, int y, int w, int h, uint32 color) override;
 
diff --git a/engines/wintermute/base/particles/part_emitter.cpp b/engines/wintermute/base/particles/part_emitter.cpp
index 2f61e86b740..1cd350a2321 100644
--- a/engines/wintermute/base/particles/part_emitter.cpp
+++ b/engines/wintermute/base/particles/part_emitter.cpp
@@ -130,7 +130,7 @@ bool PartEmitter::addSprite(const char *filename) {
 
 	// check if file exists
 	if (!BaseFileManager::getEngineInstance()->hasFile(filename)) {
-		BaseEngine::LOG(0, "Sprite '%s' not found", filename);
+		_game->LOG(0, "Sprite '%s' not found", filename);
 		return STATUS_FAILED;
 	}
 
@@ -319,7 +319,7 @@ bool PartEmitter::updateInternal(uint32 currentTime, uint32 timerDelta) {
 //////////////////////////////////////////////////////////////////////////
 bool PartEmitter::display(BaseRegion *region) {
 	if (_sprites.getSize() <= 1) {
-		BaseEngine::getRenderer()->startSpriteBatch();
+		_game->_renderer->startSpriteBatch();
 	}
 
 	for (int32 i = 0; i < _particles.getSize(); i++) {
@@ -333,7 +333,7 @@ bool PartEmitter::display(BaseRegion *region) {
 	}
 
 	if (_sprites.getSize() <= 1) {
-		BaseEngine::getRenderer()->endSpriteBatch();
+		_game->_renderer->endSpriteBatch();
 	}
 
 	return STATUS_OK;
diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp
index fa06107ef7e..ca258c8e09f 100644
--- a/engines/wintermute/base/scriptables/script.cpp
+++ b/engines/wintermute/base/scriptables/script.cpp
@@ -1162,7 +1162,7 @@ uint32 ScScript::getFuncPos(const char *name) {
 
 
 //////////////////////////////////////////////////////////////////////////
-uint32 ScScript::getMethodPos(const char *name) const {
+uint32 ScScript::getMethodPos(const char *name) {
 	for (uint32 i = 0; i < _numMethods; i++) {
 		if (strcmp(name, _methods[i].name) == 0) {
 			return _methods[i].pos;
@@ -1366,28 +1366,6 @@ bool ScScript::persist(BasePersistenceManager *persistMgr) {
 	return STATUS_OK;
 }
 
-
-//////////////////////////////////////////////////////////////////////////
-void ScScript::afterLoad() {
-	if (_buffer == nullptr) {
-		byte *buffer = _engine->getCompiledScript(_filename, &_bufferSize);
-		if (!buffer) {
-			_game->LOG(0, "Error reinitializing script '%s' after load. Script will be terminated.", _filename);
-			_state = SCRIPT_ERROR;
-			return;
-		}
-
-		_buffer = new byte[_bufferSize];
-		memcpy(_buffer, buffer, _bufferSize);
-
-		delete _scriptStream;
-		_scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize);
-
-		initTables();
-	}
-}
-
-
 //////////////////////////////////////////////////////////////////////////
 ScScript *ScScript::invokeEventHandler(const char *eventName, bool unbreakable) {
 	//if (_state!=SCRIPT_PERSISTENT) return nullptr;
@@ -1423,7 +1401,7 @@ ScScript *ScScript::invokeEventHandler(const char *eventName, bool unbreakable)
 
 
 //////////////////////////////////////////////////////////////////////////
-uint32 ScScript::getEventPos(const char *name) const {
+uint32 ScScript::getEventPos(const char *name) {
 	for (int i = _numEvents - 1; i >= 0; i--) {
 		if (scumm_stricmp(name, _events[i].name) == 0) {
 			return _events[i].pos;
@@ -1434,13 +1412,13 @@ uint32 ScScript::getEventPos(const char *name) const {
 
 
 //////////////////////////////////////////////////////////////////////////
-bool ScScript::canHandleEvent(const char *eventName) const {
+bool ScScript::canHandleEvent(const char *eventName) {
 	return getEventPos(eventName) != 0;
 }
 
 
 //////////////////////////////////////////////////////////////////////////
-bool ScScript::canHandleMethod(const char *methodName) const {
+bool ScScript::canHandleMethod(const char *methodName) {
 	return getMethodPos(methodName) != 0;
 }
 
@@ -1529,6 +1507,26 @@ bool ScScript::finishThreads() {
 }
 
 
+//////////////////////////////////////////////////////////////////////////
+void ScScript::afterLoad() {
+	if (_buffer == nullptr) {
+		byte *buffer = _engine->getCompiledScript(_filename, &_bufferSize);
+		if (!buffer) {
+			_game->LOG(0, "Error reinitializing script '%s' after load. Script will be terminated.", _filename);
+			_state = SCRIPT_ERROR;
+			return;
+		}
+
+		_buffer = new byte[_bufferSize];
+		memcpy(_buffer, buffer, _bufferSize);
+
+		delete _scriptStream;
+		_scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize);
+
+		initTables();
+	}
+}
+
 void ScScript::preInstHook(uint32 inst) {}
 
 void ScScript::postInstHook(uint32 inst) {}
diff --git a/engines/wintermute/base/scriptables/script.h b/engines/wintermute/base/scriptables/script.h
index fa90419c41a..e553addc23e 100644
--- a/engines/wintermute/base/scriptables/script.h
+++ b/engines/wintermute/base/scriptables/script.h
@@ -56,8 +56,8 @@ public:
 	bool _freezable;
 	bool resume();
 	bool pause();
-	bool canHandleEvent(const char *eventName) const;
-	bool canHandleMethod(const char *methodName) const;
+	bool canHandleEvent(const char *eventName);
+	bool canHandleMethod(const char *methodName);
 	bool createThread(ScScript *original, uint32 initIP, const char *eventName);
 	bool createMethodThread(ScScript *original, const char *methodName);
 	ScScript *invokeEventHandler(const char *eventName, bool unbreakable = false);
@@ -78,8 +78,8 @@ public:
 	TScriptState _origState;
 	ScValue *getVar(char *name);
 	uint32 getFuncPos(const char *name);
-	uint32 getEventPos(const char *name) const;
-	uint32 getMethodPos(const char *name) const;
+	uint32 getEventPos(const char *name);
+	uint32 getMethodPos(const char *name);
 	typedef struct {
 		uint32 magic;
 		uint32 version;
diff --git a/engines/wintermute/base/scriptables/script_engine.h b/engines/wintermute/base/scriptables/script_engine.h
index e057dd0e99f..9ef43b407ee 100644
--- a/engines/wintermute/base/scriptables/script_engine.h
+++ b/engines/wintermute/base/scriptables/script_engine.h
@@ -102,7 +102,7 @@ public:
 
 	void enableProfiling();
 	void disableProfiling();
-	bool getIsProfiling() {
+	bool isProfiling() {
 		return _isProfiling;
 	}
 
diff --git a/engines/wintermute/base/scriptables/script_value.h b/engines/wintermute/base/scriptables/script_value.h
index e663ce3d860..fb203b76e19 100644
--- a/engines/wintermute/base/scriptables/script_value.h
+++ b/engines/wintermute/base/scriptables/script_value.h
@@ -84,12 +84,10 @@ public:
 	ScValue *getProp(const char *name);
 	BaseScriptable *_valNative;
 	ScValue *_valRef;
-private:
 	bool _valBool;
 	int32 _valInt;
 	double _valFloat;
 	char *_valString;
-public:
 	TValType _type;
 	ScValue(BaseGame *inGame);
 	ScValue(BaseGame *inGame, bool val);
diff --git a/engines/wintermute/base/sound/base_sound.cpp b/engines/wintermute/base/sound/base_sound.cpp
index 356a26cd51c..b3bae382afb 100644
--- a/engines/wintermute/base/sound/base_sound.cpp
+++ b/engines/wintermute/base/sound/base_sound.cpp
@@ -97,7 +97,7 @@ bool BaseSound::setSoundSimple() {
 		_sound->setLooping(_soundLooping);
 		_sound->setPrivateVolume(_soundPrivateVolume);
 		_sound->setLoopStart(_soundLoopStart);
-		_sound->setFreezePaused(_soundFreezePaused);
+		_sound->_freezePaused = _soundFreezePaused;
 		if (_soundPlaying) {
 			return _sound->resume();
 		} else {
@@ -142,7 +142,7 @@ bool BaseSound::pause(bool freezePaused) {
 	if (_sound) {
 		_soundPaused = true;
 		if (freezePaused) {
-			_sound->setFreezePaused(true);
+			_sound->_freezePaused = true;
 		}
 		return _sound->pause();
 	} else {
@@ -231,20 +231,21 @@ uint32 BaseSound::getPositionTime() {
 }
 
 //////////////////////////////////////////////////////////////////////////
-bool BaseSound::setVolumePercent(int percent) {
+bool BaseSound::setVolume(int volume) {
 	if (!_sound) {
 		return STATUS_FAILED;
 	} else {
-		return _sound->setPrivateVolume(percent * 255 / 100);
+		return _sound->setPrivateVolume(volume);
 	}
 }
 
 //////////////////////////////////////////////////////////////////////////
-bool BaseSound::setVolume(int volume) {
+bool BaseSound::setPrivateVolume(int volume) {
 	if (!_sound) {
 		return STATUS_FAILED;
 	} else {
-		return _sound->setPrivateVolume(volume);
+		_sound->setPrivateVolume(volume);
+		return STATUS_OK;
 	}
 }
 
@@ -268,21 +269,20 @@ bool BaseSound::setLoopStart(uint32 pos) {
 }
 
 //////////////////////////////////////////////////////////////////////////
-bool BaseSound::setPrivateVolume(int volume) {
+int BaseSound::getVolumePercent() {
 	if (!_sound) {
-		return STATUS_FAILED;
+		return 0;
 	} else {
-		_sound->setPrivateVolume(volume);
-		return STATUS_OK;
+		return _sound->getPrivateVolume() * 100 / 255;
 	}
 }
 
 //////////////////////////////////////////////////////////////////////////
-int BaseSound::getVolumePercent() {
+bool BaseSound::setVolumePercent(int percent) {
 	if (!_sound) {
-		return 0;
+		return STATUS_FAILED;
 	} else {
-		return _sound->getPrivateVolume() * 100 / 255;
+		return _sound->setPrivateVolume(percent * 255 / 100);
 	}
 }
 
diff --git a/engines/wintermute/base/sound/base_sound_buffer.h b/engines/wintermute/base/sound/base_sound_buffer.h
index 979c1b6525e..fee1a4cc346 100644
--- a/engines/wintermute/base/sound/base_sound_buffer.h
+++ b/engines/wintermute/base/sound/base_sound_buffer.h
@@ -81,7 +81,6 @@ public:
 	//HSTREAM _stream;
 	//HSYNC _sync;
 
-private:
 	Audio::Mixer::SoundType _type;
 	Audio::SeekableAudioStream *_stream;
 	Audio::SoundHandle *_handle;
diff --git a/engines/wintermute/debugger.cpp b/engines/wintermute/debugger.cpp
index d9d140dc5e7..44ec447e241 100644
--- a/engines/wintermute/debugger.cpp
+++ b/engines/wintermute/debugger.cpp
@@ -31,10 +31,10 @@
 namespace Wintermute {
 
 Console::Console(WintermuteEngine *vm) : GUI::Debugger(), _engineRef(vm) {
-	registerCmd("show_fps", WRAP_METHOD(Console, Cmd_ShowFps));
-	registerCmd("dump_file", WRAP_METHOD(Console, Cmd_DumpFile));
 	registerCmd("dump_file", WRAP_METHOD(Console, Cmd_DumpFile));
+#if EXTENDED_DEBUGGER_ENABLED
 	registerCmd("help", WRAP_METHOD(Console, Cmd_Help));
+	registerCmd("show_fps", WRAP_METHOD(Console, Cmd_ShowFps));
 	// Actual (script) debugger commands
 	registerCmd(STEP_CMD, WRAP_METHOD(Console, Cmd_Step));
 	registerCmd(CONTINUE_CMD, WRAP_METHOD(Console, Cmd_Continue));
@@ -53,11 +53,14 @@ Console::Console(WintermuteEngine *vm) : GUI::Debugger(), _engineRef(vm) {
 	registerCmd(INFO_CMD, WRAP_METHOD(Console, Cmd_Info));
 	registerCmd(SET_PATH_CMD, WRAP_METHOD(Console, Cmd_SourcePath));
 	registerCmd(TOP_CMD, WRAP_METHOD(Console, Cmd_Top));
+#endif
 }
 
 Console::~Console() {
 }
 
+#if EXTENDED_DEBUGGER_ENABLED
+
 bool Console::Cmd_Help(int argc, const char **argv) {
 	if (argc == 1) {
 		// Debugger::Cmd_Help(argc, argv);
@@ -306,6 +309,8 @@ bool Console::Cmd_ShowFps(int argc, const char **argv) {
 	return true;
 }
 
+#endif
+
 bool Console::Cmd_DumpFile(int argc, const char **argv) {
 	if (argc != 3) {
 		debugPrintf("Usage: %s <file path> <output file name>\n", argv[0]);
@@ -336,6 +341,8 @@ bool Console::Cmd_DumpFile(int argc, const char **argv) {
 	return true;
 }
 
+#if EXTENDED_DEBUGGER_ENABLED
+
 bool Console::Cmd_SourcePath(int argc, const char **argv) {
 	if (argc != 2) {
 		debugPrintf("Usage: %s <source path>\n", argv[0]);
@@ -411,4 +418,6 @@ void Console::printError(const Common::String &command, Error error) {
 	debugPrintf("%s: %s\n", command.c_str(), error.getErrorDisplayStr().c_str());
 }
 
+#endif
+
 } // End of namespace Wintermute
diff --git a/engines/wintermute/debugger.h b/engines/wintermute/debugger.h
index 8f555fab865..c9a8d9e2a08 100644
--- a/engines/wintermute/debugger.h
+++ b/engines/wintermute/debugger.h
@@ -22,7 +22,7 @@
 #ifndef WINTERMUTE_DEBUGGER_H
 #define WINTERMUTE_DEBUGGER_H
 
-#define EXTENDED_DEBUGGER_ENABLED 1
+#define EXTENDED_DEBUGGER_ENABLED 0
 
 #include "gui/debugger.h"
 
diff --git a/engines/wintermute/debugger/debugger_controller.cpp b/engines/wintermute/debugger/debugger_controller.cpp
index 00d474f3201..32be6612d98 100644
--- a/engines/wintermute/debugger/debugger_controller.cpp
+++ b/engines/wintermute/debugger/debugger_controller.cpp
@@ -40,6 +40,8 @@
 
 namespace Wintermute {
 
+#if EXTENDED_DEBUGGER_ENABLED
+
 DebuggerController::~DebuggerController() {
 	delete _sourceListingProvider;
 }
@@ -324,4 +326,6 @@ Common::Array<TopEntry> DebuggerController::getTop() const {
 	return res;
 }
 
+#endif
+
 } // end of namespace Wintermute
diff --git a/engines/wintermute/debugger/debugger_controller.h b/engines/wintermute/debugger/debugger_controller.h
index 9029100b5fc..5eedaaf52d6 100644
--- a/engines/wintermute/debugger/debugger_controller.h
+++ b/engines/wintermute/debugger/debugger_controller.h
@@ -56,6 +56,8 @@ struct TopEntry {
 	int breakpointInfo;
 };
 
+#if EXTENDED_DEBUGGER_ENABLED
+
 class DebuggerController : public ScriptMonitor {
 	SourceListingProvider *_sourceListingProvider;
 	const WintermuteEngine *_engine;
@@ -112,6 +114,9 @@ public:
 	void onWatch(const Watch *watch, DebuggableScript *script) override;
 	void notifyStep(DebuggableScript *script) override;
 };
+
+#endif
+
 }
 
 #endif // WINTERMUTE_DEBUGGER_H
diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp
index 7d56752fc7d..51cb4a4d3ee 100644
--- a/engines/wintermute/wintermute.cpp
+++ b/engines/wintermute/wintermute.cpp
@@ -94,8 +94,10 @@ bool WintermuteEngine::hasFeature(EngineFeature f) const {
 }
 
 Common::Error WintermuteEngine::run() {
+#if EXTENDED_DEBUGGER_ENABLED
 	// Create debugger console. It requires GFX to be initialized
 	_dbgController = new DebuggerController(this);
+#endif
 	_debugger = new Console(this);
 	setDebugger(_debugger);
 
@@ -266,8 +268,10 @@ int WintermuteEngine::init() {
 		}
 	}
 
+#if EXTENDED_DEBUGGER_ENABLED
 	_game->_scEngine->attachMonitor(_dbgController);
-
+#endif
+	
 	// all set, ready to go
 	return 0;
 }




More information about the Scummvm-git-logs mailing list