[Scummvm-git-logs] scummvm master -> 55dd27e3d066761f2c96fc57af34cc8c7bdc3931

npjg noreply at scummvm.org
Tue Mar 4 01:43:52 UTC 2025


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

Summary:
11c350a82d MEDIASTATION: Delimit end of event handler code in debug output
f9d1c4ad45 MEDIASTATION: Don't error when script variable already exists
225b002cc0 MEDIASTATION: Combine ContextParameters with Context
e168ba0f84 MEDIASTATION: Fix returning values from scripts
1d091a3a68 MEDIASTATION: More consistently debug-print script types
ee7386c5eb MEDIASTATION: JANITORIAL: Clean up some comments
4211ca99ca MEDIASTATION: Clean up defaulted constructors
964830b570 MEDIASTATION: Remove unused declaration and assignment
0194a33717 MEDIASTATION: Rename variable
55dd27e3d0 MEDIASTATION: Support integer-double comparisons in scripts


Commit: 11c350a82d9acac004d76f0deef301e82c8a5869
    https://github.com/scummvm/scummvm/commit/11c350a82d9acac004d76f0deef301e82c8a5869
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-03-03T20:10:12-05:00

Commit Message:
MEDIASTATION: Delimit end of event handler code in debug output

Changed paths:
    engines/mediastation/mediascript/eventhandler.cpp
    engines/mediastation/mediascript/eventhandler.h


diff --git a/engines/mediastation/mediascript/eventhandler.cpp b/engines/mediastation/mediascript/eventhandler.cpp
index edde1caebab..afb6692df0f 100644
--- a/engines/mediastation/mediascript/eventhandler.cpp
+++ b/engines/mediastation/mediascript/eventhandler.cpp
@@ -45,41 +45,43 @@ EventHandler::EventHandler(Chunk &chunk) {
 Operand EventHandler::execute(uint assetId) {
 	// TODO: The assetId is only passed in for debug visibility, there should be
 	// a better way to handle that.
+	debugC(5, kDebugScript, "\n********** EVENT HANDLER %s **********", getDebugHeader(assetId).c_str());
+
+	// The only argument that can be provided to an
+	// event handler is the _argumentValue.
+	Operand returnValue = _code->execute();
+
+	debugC(5, kDebugScript, "********** END EVENT HANDLER %s **********", getDebugHeader(assetId).c_str());
+	return returnValue;
+}
+
+EventHandler::~EventHandler() {
+	delete _code;
+	_code = nullptr;
+}
+
+Common::String EventHandler::getDebugHeader(uint assetId) {
 	switch (_argumentType) {
-	case kNullEventHandlerArgument: {
-		debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %s) (no argument) **********", assetId, eventTypeToStr(_type));
-		break;
-	}
+	case kNullEventHandlerArgument:
+		return Common::String::format("(asset %d) (type = %s) (no argument)", assetId, eventTypeToStr(_type));
 
 	case kAsciiCodeEventHandlerArgument: {
 		// Not sure why the ASCII code isn't just stored as an integer, but it's not.
 		uint asciiCode = static_cast<uint>(_argumentValue.u.f);
-		debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %s) (ASCII code = %d) **********", assetId, eventTypeToStr(_type), asciiCode);
-		break;
+		return Common::String::format("(asset %d) (type = %s) (ASCII code = %d)", assetId, eventTypeToStr(_type), asciiCode);
 	}
 
-	case kContextEventHandlerArgument: {
-		debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %s) (context = %d) **********", assetId, eventTypeToStr(_type), _argumentValue.u.i);
-		break;
-	}
+	case kContextEventHandlerArgument:
+		return Common::String::format("(asset %d) (type = %s) (context = %d)", assetId, eventTypeToStr(_type), _argumentValue.u.i);
 
 	case kTimeEventHandlerArgument:
-	case kUnk1EventHandlerArgument: {
-		debugC(5, kDebugScript, "\n********** EVENT HANDLER (asset %d) (type = %s) (time = %f) **********", assetId, eventTypeToStr(_type), _argumentValue.u.f);
-		break;
-	}
-	}
+	case kUnk1EventHandlerArgument:
+		return Common::String::format("(asset %d) (type = %s) (time = %f)", assetId, eventTypeToStr(_type), _argumentValue.u.f);
 
-	// The only argument that can be provided to an event handler is the
-	// _argumentValue.
-	Operand returnValue = _code->execute();
-	debugC(5, kDebugScript, "********** END EVENT HANDLER **********");
-	return returnValue;
-}
-
-EventHandler::~EventHandler() {
-	delete _code;
-	_code = nullptr;
+	default:
+		error("EventHandler::getDebugHeader(): Unimplemented argument type %s (%d)",
+			eventHandlerArgumentTypeToStr(_argumentType), static_cast<uint>(_argumentType));
+	}
 }
 
 } // End of namespace MediaStation
diff --git a/engines/mediastation/mediascript/eventhandler.h b/engines/mediastation/mediascript/eventhandler.h
index cbabe23f3d5..288ea417d34 100644
--- a/engines/mediastation/mediascript/eventhandler.h
+++ b/engines/mediastation/mediascript/eventhandler.h
@@ -22,6 +22,8 @@
 #ifndef MEDIASTATION_MEDIASCRIPT_EVENTHANDLER_H
 #define MEDIASTATION_MEDIASCRIPT_EVENTHANDLER_H
 
+#include "common/str.h"
+
 #include "mediastation/datafile.h"
 #include "mediastation/datum.h"
 #include "mediastation/mediascript/codechunk.h"
@@ -40,6 +42,8 @@ public:
 	Datum _argumentValue;
 
 private:
+	Common::String getDebugHeader(uint assetId);
+
 	CodeChunk *_code = nullptr;
 };
 


Commit: f9d1c4ad45f0623fe3a27c097e5f42aac771805b
    https://github.com/scummvm/scummvm/commit/f9d1c4ad45f0623fe3a27c097e5f42aac771805b
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-03-03T20:18:29-05:00

Commit Message:
MEDIASTATION: Don't error when script variable already exists

Changed paths:
    engines/mediastation/contextparameters.cpp


diff --git a/engines/mediastation/contextparameters.cpp b/engines/mediastation/contextparameters.cpp
index 5b0a122e413..6deac80095b 100644
--- a/engines/mediastation/contextparameters.cpp
+++ b/engines/mediastation/contextparameters.cpp
@@ -58,9 +58,11 @@ ContextParameters::ContextParameters(Chunk &chunk) : _contextName(nullptr) {
 				warning("ContextParameters::ContextParameters(): Repeated file number didn't match: %d != %d", repeatedFileNumber, _fileNumber);
 			}
 			Variable *variable = new Variable(chunk);
-			Operand operand;
 			if (g_engine->_variables.contains(variable->_id)) {
-				error("ContextParameters::ContextParameters(): Variable with ID 0x%x already exists", variable->_id);
+				// Don't overwrite the variable if it already exists. This can happen if we have
+				// unloaded a screen but are returning to it later.
+				debugC(5, kDebugScript, "ContextParameters::ContextParameters(): Skipping re-creation of existing global variable %d (type: %s)", variable->_id, variableTypeToStr(variable->_type));
+				delete variable;
 			} else {
 				g_engine->_variables.setVal(variable->_id, variable);
 				debugC(5, kDebugScript, "ContextParameters::ContextParameters(): Created global variable %d (type: %s)", variable->_id, variableTypeToStr(variable->_type));


Commit: 225b002cc015c995b541c43171b7009e08827d3b
    https://github.com/scummvm/scummvm/commit/225b002cc015c995b541c43171b7009e08827d3b
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-03-03T20:19:00-05:00

Commit Message:
MEDIASTATION: Combine ContextParameters with Context

Changed paths:
  R engines/mediastation/contextparameters.cpp
  R engines/mediastation/contextparameters.h
    engines/mediastation/context.cpp
    engines/mediastation/context.h
    engines/mediastation/module.mk


diff --git a/engines/mediastation/context.cpp b/engines/mediastation/context.cpp
index b8aed67d268..c5596f59057 100644
--- a/engines/mediastation/context.cpp
+++ b/engines/mediastation/context.cpp
@@ -114,8 +114,8 @@ Context::~Context() {
 	delete _palette;
 	_palette = nullptr;
 
-	delete _parameters;
-	_parameters = nullptr;
+	delete _contextName;
+	_contextName = nullptr;
 
 	for (auto it = _assets.begin(); it != _assets.end(); ++it) {
 		delete it->_value;
@@ -151,6 +151,64 @@ void Context::registerActiveAssets() {
 	}
 }
 
+void Context::readParametersSection(Chunk &chunk) {
+	_fileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
+
+	ContextParametersSectionType sectionType = static_cast<ContextParametersSectionType>(Datum(chunk, kDatumTypeUint16_1).u.i);
+	while (sectionType != kContextParametersEmptySection) {
+		debugC(5, kDebugLoading, "ContextParameters::ContextParameters: sectionType = 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
+		switch (sectionType) {
+		case kContextParametersName: {
+			uint repeatedFileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
+			if (repeatedFileNumber != _fileNumber) {
+				warning("ContextParameters::ContextParameters(): Repeated file number didn't match: %d != %d", repeatedFileNumber, _fileNumber);
+			}
+			_contextName = Datum(chunk, kDatumTypeString).u.string;
+
+			uint endingFlag = Datum(chunk, kDatumTypeUint16_1).u.i;
+			if (endingFlag != 0) {
+				warning("ContextParameters::ContextParameters(): Got non-zero ending flag 0x%x", endingFlag);
+			}
+			break;
+		}
+
+		case kContextParametersFileNumber: {
+			error("ContextParameters::ContextParameters(): Section type FILE_NUMBER not implemented yet");
+			break;
+		}
+
+		case kContextParametersVariable: {
+			uint repeatedFileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
+			if (repeatedFileNumber != _fileNumber) {
+				warning("ContextParameters::ContextParameters(): Repeated file number didn't match: %d != %d", repeatedFileNumber, _fileNumber);
+			}
+			Variable *variable = new Variable(chunk);
+			if (g_engine->_variables.contains(variable->_id)) {
+				// Don't overwrite the variable if it already exists. This can happen if we have
+				// unloaded a screen but are returning to it later.
+				debugC(5, kDebugScript, "ContextParameters::ContextParameters(): Skipping re-creation of existing global variable %d (type: %s)", variable->_id, variableTypeToStr(variable->_type));
+				delete variable;
+			} else {
+				g_engine->_variables.setVal(variable->_id, variable);
+				debugC(5, kDebugScript, "ContextParameters::ContextParameters(): Created global variable %d (type: %s)", variable->_id, variableTypeToStr(variable->_type));
+			}
+			break;
+		}
+
+		case kContextParametersBytecode: {
+			Function *function = new Function(chunk);
+			_functions.setVal(function->_id, function);
+			break;
+		}
+
+		default:
+			error("ContextParameters::ContextParameters(): Unknown section type 0x%x", static_cast<uint>(sectionType));
+		}
+
+		sectionType = static_cast<ContextParametersSectionType>(Datum(chunk, kDatumTypeUint16_1).u.i);
+	}
+}
+
 void Context::readOldStyleHeaderSections(Subfile &subfile, Chunk &chunk) {
 	error("Context::readOldStyleHeaderSections(): Not implemented yet");
 }
@@ -225,10 +283,7 @@ bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
 	debugC(5, kDebugLoading, "Context::readHeaderSection(): sectionType = 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
 	switch (sectionType) {
 	case kContextParametersSection: {
-		if (_parameters != nullptr) {
-			error("Context::readHeaderSection(): Got multiple parameters (@0x%llx)", static_cast<long long int>(chunk.pos()));
-		}
-		_parameters = new ContextParameters(chunk);
+		readParametersSection(chunk);
 		break;
 	}
 
diff --git a/engines/mediastation/context.h b/engines/mediastation/context.h
index 329d4a24366..4558de2fcf0 100644
--- a/engines/mediastation/context.h
+++ b/engines/mediastation/context.h
@@ -22,17 +22,26 @@
 #ifndef MEDIASTATION_CONTEXT_H
 #define MEDIASTATION_CONTEXT_H
 
+#include "common/str.h"
 #include "common/path.h"
 #include "common/hashmap.h"
 #include "graphics/palette.h"
 
 #include "mediastation/datafile.h"
-#include "mediastation/contextparameters.h"
 #include "mediastation/assetheader.h"
 #include "mediastation/mediascript/function.h"
+#include "mediastation/mediascript/variable.h"
 
 namespace MediaStation {
 
+enum ContextParametersSectionType {
+	kContextParametersEmptySection = 0x0000,
+	kContextParametersVariable = 0x0014,
+	kContextParametersName = 0x0bb9,
+	kContextParametersFileNumber = 0x0011,
+	kContextParametersBytecode = 0x0017
+};
+
 enum ContextSectionType {
 	kContextEmptySection = 0x0000,
 	kContextOldStyleSection = 0x000d,
@@ -54,7 +63,6 @@ public:
 	uint32 _subfileCount;
 	uint32 _fileSize;
 	Graphics::Palette *_palette = nullptr;
-	ContextParameters *_parameters = nullptr;
 	// TODO: Eliminate this screenAsset because the screen that this context
 	// represents is now an asset in itself.
 	AssetHeader *_screenAsset = nullptr;
@@ -65,10 +73,17 @@ public:
 	void registerActiveAssets();
 
 private:
+	// This is not an internal file ID, but the number of the file
+	// as it appears in the filename. For instance, the context in
+	// "100.cxt" would have file number 100.
+	uint _fileNumber = 0;
+	Common::String *_contextName = nullptr;
+
 	Common::HashMap<uint, Asset *> _assets;
 	Common::HashMap<uint, Function *> _functions;
 	Common::HashMap<uint, Asset *> _assetsByChunkReference;
 
+	void readParametersSection(Chunk &chunk);
 	void readOldStyleHeaderSections(Subfile &subfile, Chunk &chunk);
 	void readNewStyleHeaderSections(Subfile &subfile, Chunk &chunk);
 	bool readHeaderSection(Subfile &subfile, Chunk &chunk);
diff --git a/engines/mediastation/contextparameters.cpp b/engines/mediastation/contextparameters.cpp
deleted file mode 100644
index 6deac80095b..00000000000
--- a/engines/mediastation/contextparameters.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#include "mediastation/mediastation.h"
-#include "mediastation/datum.h"
-#include "mediastation/contextparameters.h"
-#include "mediastation/mediascript/variable.h"
-#include "mediastation/debugchannels.h"
-
-namespace MediaStation {
-
-ContextParameters::ContextParameters(Chunk &chunk) : _contextName(nullptr) {
-	_fileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
-	uint sectionType = static_cast<ContextParametersSectionType>(Datum(chunk, kDatumTypeUint16_1).u.i);
-	while (sectionType != kContextParametersEmptySection) {
-		debugC(5, kDebugLoading, "ContextParameters::ContextParameters: sectionType = 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
-		switch (sectionType) {
-		case kContextParametersName: {
-			uint repeatedFileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
-			if (repeatedFileNumber != _fileNumber) {
-				warning("ContextParameters::ContextParameters(): Repeated file number didn't match: %d != %d", repeatedFileNumber, _fileNumber);
-			}
-			_contextName = Datum(chunk, kDatumTypeString).u.string;
-			// TODO: This is likely just an end flag.
-			uint endingFlag = Datum(chunk, kDatumTypeUint16_1).u.i;
-			if (endingFlag != 0) {
-				warning("ContextParameters::ContextParameters(): Got non-zero ending flag 0x%x", endingFlag);
-			}
-			break;
-		}
-
-		case kContextParametersFileNumber: {
-			error("ContextParameters::ContextParameters(): Section type FILE_NUMBER not implemented yet");
-			break;
-		}
-
-		case kContextParametersVariable: {
-			uint repeatedFileNumber = Datum(chunk, kDatumTypeUint16_1).u.i;
-			if (repeatedFileNumber != _fileNumber) {
-				warning("ContextParameters::ContextParameters(): Repeated file number didn't match: %d != %d", repeatedFileNumber, _fileNumber);
-			}
-			Variable *variable = new Variable(chunk);
-			if (g_engine->_variables.contains(variable->_id)) {
-				// Don't overwrite the variable if it already exists. This can happen if we have
-				// unloaded a screen but are returning to it later.
-				debugC(5, kDebugScript, "ContextParameters::ContextParameters(): Skipping re-creation of existing global variable %d (type: %s)", variable->_id, variableTypeToStr(variable->_type));
-				delete variable;
-			} else {
-				g_engine->_variables.setVal(variable->_id, variable);
-				debugC(5, kDebugScript, "ContextParameters::ContextParameters(): Created global variable %d (type: %s)", variable->_id, variableTypeToStr(variable->_type));
-			}
-			break;
-		}
-
-		case kContextParametersBytecode: {
-			Function *function = new Function(chunk);
-			_functions.setVal(function->_id, function);
-			break;
-		}
-
-		default: {
-			error("ContextParameters::ContextParameters(): Unknown section type 0x%x", static_cast<uint>(sectionType));
-		}
-		}
-		sectionType = Datum(chunk, kDatumTypeUint16_1).u.i;
-	}
-}
-
-ContextParameters::~ContextParameters() {
-	delete _contextName;
-	_contextName = nullptr;
-
-	for (auto it = _functions.begin(); it != _functions.end(); ++it) {
-		delete it->_value;
-	}
-	_functions.clear();
-}
-
-} // End of namespace MediaStation
diff --git a/engines/mediastation/contextparameters.h b/engines/mediastation/contextparameters.h
deleted file mode 100644
index 6e1c8f9606d..00000000000
--- a/engines/mediastation/contextparameters.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#ifndef MEDIASTATION_CONTEXTPARAMETERS_H
-#define MEDIASTATION_CONTEXTPARAMETERS_H
-
-#include "common/str.h"
-#include "common/hashmap.h"
-
-#include "mediastation/datafile.h"
-#include "mediastation/mediascript/variable.h"
-#include "mediastation/mediascript/function.h"
-
-namespace MediaStation {
-
-enum ContextParametersSectionType {
-	kContextParametersEmptySection = 0x0000,
-	kContextParametersVariable = 0x0014,
-	kContextParametersName = 0x0bb9,
-	kContextParametersFileNumber = 0x0011,
-	kContextParametersBytecode = 0x0017
-};
-
-class ContextParameters {
-public:
-	ContextParameters(Chunk &chunk);
-	~ContextParameters();
-
-	// This is not an internal file ID, but the number of the file
-	// as it appears in the filename. For instance, the context in
-	// "100.cxt" would have file number 100.
-	uint _fileNumber;
-	Common::String *_contextName;
-	Common::HashMap<uint32, Function *> _functions;
-};
-
-} // End of namespace MediaStation
-
-#endif
\ No newline at end of file
diff --git a/engines/mediastation/module.mk b/engines/mediastation/module.mk
index 02f9ea68478..070ef331544 100644
--- a/engines/mediastation/module.mk
+++ b/engines/mediastation/module.mk
@@ -18,7 +18,6 @@ MODULE_OBJS = \
 	bitmap.o \
 	boot.o \
 	context.o \
-	contextparameters.o \
 	cursors.o \
 	datafile.o \
 	datum.o \


Commit: e168ba0f845770195a3854fe689faecfda5798e7
    https://github.com/scummvm/scummvm/commit/e168ba0f845770195a3854fe689faecfda5798e7
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-03-03T20:19:00-05:00

Commit Message:
MEDIASTATION: Fix returning values from scripts

Changed paths:
    engines/mediastation/mediascript/codechunk.cpp


diff --git a/engines/mediastation/mediascript/codechunk.cpp b/engines/mediastation/mediascript/codechunk.cpp
index d00bc999220..bbbffe622e2 100644
--- a/engines/mediastation/mediascript/codechunk.cpp
+++ b/engines/mediastation/mediascript/codechunk.cpp
@@ -39,7 +39,10 @@ Operand CodeChunk::execute(Common::Array<Operand> *args) {
 	_args = args;
 	Operand returnValue;
 	while (_bytecode->pos() < _bytecode->size()) {
-		returnValue = executeNextStatement();
+		Operand instructionResult = executeNextStatement();
+		if (instructionResult.getType() != kOperandTypeEmpty) {
+			returnValue = instructionResult;
+		}
 	}
 
 	// Rewind the stream once we're finished, in case we need to execute
@@ -319,6 +322,13 @@ Operand CodeChunk::executeNextStatement() {
 			return -value;
 		}
 
+		case kOpcodeReturn: {
+			debugCN(5, kDebugScript, "    return: ");
+			Operand value = executeNextStatement();
+
+			return value;
+		}
+
 		default: {
 			error("CodeChunk::getNextStatement(): Got unknown opcode %s (%d)", opcodeToStr(opcode), static_cast<uint>(opcode));
 		}


Commit: 1d091a3a687513509d0df6f2f7aa3b387617621e
    https://github.com/scummvm/scummvm/commit/1d091a3a687513509d0df6f2f7aa3b387617621e
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-03-03T20:19:00-05:00

Commit Message:
MEDIASTATION: More consistently debug-print script types

Changed paths:
    engines/mediastation/asset.cpp
    engines/mediastation/assetheader.cpp
    engines/mediastation/assets/canvas.cpp
    engines/mediastation/assets/hotspot.cpp
    engines/mediastation/assets/image.cpp
    engines/mediastation/assets/movie.cpp
    engines/mediastation/assets/palette.cpp
    engines/mediastation/assets/path.cpp
    engines/mediastation/assets/screen.cpp
    engines/mediastation/assets/sound.cpp
    engines/mediastation/assets/sprite.cpp
    engines/mediastation/assets/text.cpp
    engines/mediastation/assets/timer.cpp
    engines/mediastation/boot.cpp
    engines/mediastation/context.cpp
    engines/mediastation/mediascript/codechunk.cpp
    engines/mediastation/mediascript/operand.cpp
    engines/mediastation/mediascript/variable.cpp
    engines/mediastation/mediastation.cpp
    engines/mediastation/transitions.cpp


diff --git a/engines/mediastation/asset.cpp b/engines/mediastation/asset.cpp
index 74f2670a2a4..18b10222d63 100644
--- a/engines/mediastation/asset.cpp
+++ b/engines/mediastation/asset.cpp
@@ -21,6 +21,7 @@
 
 #include "mediastation/debugchannels.h"
 #include "mediastation/asset.h"
+#include "mediastation/mediascript/scriptconstants.h"
 
 namespace MediaStation {
 
@@ -86,10 +87,10 @@ void Asset::processTimeEventHandlers() {
 void Asset::runEventHandlerIfExists(EventType eventType) {
 	EventHandler *eventHandler = _header->_eventHandlers.getValOrDefault(eventType);
 	if (eventHandler != nullptr) {
-		debugC(5, kDebugScript, "Executing handler for event type %d on asset %d", static_cast<uint>(eventType), _header->_id);
+		debugC(5, kDebugScript, "Executing handler for event type %s on asset %d", eventTypeToStr(eventType), _header->_id);
 		eventHandler->execute(_header->_id);
 	} else {
-		debugC(5, kDebugScript, "No event handler for event type %d on asset %d", static_cast<uint>(eventType), _header->_id);
+		debugC(5, kDebugScript, "No event handler for event type %s on asset %d", eventTypeToStr(eventType), _header->_id);
 	}
 }
 
diff --git a/engines/mediastation/assetheader.cpp b/engines/mediastation/assetheader.cpp
index 1a1510b41db..ce6be09a3ce 100644
--- a/engines/mediastation/assetheader.cpp
+++ b/engines/mediastation/assetheader.cpp
@@ -133,11 +133,12 @@ void AssetHeader::readSection(AssetHeaderSectionType sectionType, Chunk& chunk)
 		default: {
 			if (eventHandler->_argumentType != kNullEventHandlerArgument && \
 				eventHandler->_argumentType != kUnk1EventHandlerArgument) {
-				error("AssetHeader::readSection(): Event handler of type %d has a non-null argument type %d", eventHandler->_type, eventHandler->_argumentType);
+				error("AssetHeader::readSection(): Event handler of type %s has a non-null argument type %s",
+					eventTypeToStr(eventHandler->_type), eventHandlerArgumentTypeToStr(eventHandler->_argumentType));
 			}
 
 			if (_eventHandlers.contains(eventHandler->_type)) {
-				error("AssetHeader::readSection(): Event handler type %d already exists", eventHandler->_type);
+				error("AssetHeader::readSection(): Event handler type %s already exists", eventTypeToStr(eventHandler->_type));
 			} else {
 				_eventHandlers.setVal(eventHandler->_type, eventHandler);
 			}
@@ -353,10 +354,8 @@ void AssetHeader::readSection(AssetHeaderSectionType sectionType, Chunk& chunk)
 		break;
 	}
 
-	default: {
+	default:
 		error("AssetHeader::readSection(): Unknown section type 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
-		break;
-	}
 	}
 }
 
diff --git a/engines/mediastation/assets/canvas.cpp b/engines/mediastation/assets/canvas.cpp
index eda5da541a4..1856be6f665 100644
--- a/engines/mediastation/assets/canvas.cpp
+++ b/engines/mediastation/assets/canvas.cpp
@@ -29,9 +29,8 @@ Operand Canvas::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args)
 		error("Canvas::callMethod(): BuiltInFunction::clearToPalette is not implemented yet");
 	}
 
-	default: {
-		error("Got unimplemented method ID %d", methodId);
-	}
+	default:
+		error("Canvas::callMethod(): Got unimplemented method ID %s (%d)", builtInMethodToStr(methodId), static_cast<uint>(methodId));
 	}
 }
 
diff --git a/engines/mediastation/assets/hotspot.cpp b/engines/mediastation/assets/hotspot.cpp
index 69debeaec0f..87b66f3c4f5 100644
--- a/engines/mediastation/assets/hotspot.cpp
+++ b/engines/mediastation/assets/hotspot.cpp
@@ -92,10 +92,8 @@ Operand Hotspot::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args
 		return returnValue;
 	}
 
-
-	default: {
-		error("Hotspot::callMethod(): Got unimplemented method ID %d", methodId);
-	}
+	default:
+		error("Hotspot::callMethod(): Got unimplemented method ID %s (%d)", builtInMethodToStr(methodId), static_cast<uint>(methodId));
 	}
 }
 
diff --git a/engines/mediastation/assets/image.cpp b/engines/mediastation/assets/image.cpp
index cc92233bfc9..c5fc1e302d9 100644
--- a/engines/mediastation/assets/image.cpp
+++ b/engines/mediastation/assets/image.cpp
@@ -46,14 +46,12 @@ Operand Image::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args)
 		assert(args.empty());
 		spatialShow();
 		return Operand();
-		break;
 	}
 
 	case kSpatialHideMethod: {
 		assert(args.empty());
 		spatialHide();
 		return Operand();
-		break;
 	}
 
 	case kSetDissolveFactorMethod: {
@@ -62,10 +60,8 @@ Operand Image::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args)
 		return Operand();
 	}
 
-
-	default: {
-		error("Image::callMethod(): Got unimplemented method ID %d", methodId);
-	}
+	default:
+		error("Image::callMethod(): Got unimplemented method ID %s (%d)", builtInMethodToStr(methodId), static_cast<uint>(methodId));
 	}
 }
 
diff --git a/engines/mediastation/assets/movie.cpp b/engines/mediastation/assets/movie.cpp
index ddf327ed8ee..3bf832c9876 100644
--- a/engines/mediastation/assets/movie.cpp
+++ b/engines/mediastation/assets/movie.cpp
@@ -219,9 +219,8 @@ Operand Movie::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args)
 		return returnValue;
 	}
 
-	default: {
-		error("Movie::callMethod(): Got unimplemented method ID %d", methodId);
-	}
+	default:
+		error("Movie::callMethod(): Got unimplemented method ID %s (%d)", builtInMethodToStr(methodId), static_cast<uint>(methodId));
 	}
 }
 
@@ -463,10 +462,9 @@ void Movie::readChunk(Chunk &chunk) {
 		break;
 	}
 
-	default: {
+	default:
 		error("Unknown movie still section type");
 	}
-	}
 }
 
 void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
@@ -517,10 +515,9 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
 				break;
 			}
 
-			default: {
+			default:
 				error("Movie::readSubfile(): Unknown movie animation section type 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
 			}
-			}
 
 			// READ THE NEXT CHUNK.
 			chunk = subfile.nextChunk();
diff --git a/engines/mediastation/assets/palette.cpp b/engines/mediastation/assets/palette.cpp
index 37a417a6950..f9fa8ee09cc 100644
--- a/engines/mediastation/assets/palette.cpp
+++ b/engines/mediastation/assets/palette.cpp
@@ -27,9 +27,8 @@ namespace MediaStation {
 
 Operand Palette::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
 	switch (methodId) {
-	default: {
-		error("Got unimplemented method ID %d", methodId);
-	}
+	default:
+		error("Palette::callMethod(): Got unimplemented method ID %s (%d)", builtInMethodToStr(methodId), static_cast<uint>(methodId));
 	}
 }
 
diff --git a/engines/mediastation/assets/path.cpp b/engines/mediastation/assets/path.cpp
index 9a8dae48747..cab72ba4dbc 100644
--- a/engines/mediastation/assets/path.cpp
+++ b/engines/mediastation/assets/path.cpp
@@ -56,9 +56,8 @@ Operand Path::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
 		return Operand();
 	}
 
-	default: {
-		error("Got unimplemented method ID %d", methodId);
-	}
+	default:
+		error("Path::callMethod(): Got unimplemented method ID %s (%d)", builtInMethodToStr(methodId), static_cast<uint>(methodId));
 	}
 }
 
diff --git a/engines/mediastation/assets/screen.cpp b/engines/mediastation/assets/screen.cpp
index fa55bc04ffd..40fe2f6ee4e 100644
--- a/engines/mediastation/assets/screen.cpp
+++ b/engines/mediastation/assets/screen.cpp
@@ -26,9 +26,8 @@ namespace MediaStation {
 
 Operand Screen::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
 	switch (methodId) {
-	default: {
-		error("Screen::callMethod(): Got unimplemented method ID %d", methodId);
-	}
+	default:
+		error("Screen::callMethod(): Got unimplemented method ID %s (%d)", builtInMethodToStr(methodId), static_cast<uint>(methodId));
 	}
 }
 
diff --git a/engines/mediastation/assets/sound.cpp b/engines/mediastation/assets/sound.cpp
index e2a34fecdd5..0d6b9edb1ec 100644
--- a/engines/mediastation/assets/sound.cpp
+++ b/engines/mediastation/assets/sound.cpp
@@ -69,9 +69,8 @@ Operand Sound::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args)
 		return Operand();
 	}
 
-	default: {
-		error("Sound::callMethod(): Got unimplemented method %s (%d)", builtInMethodToStr(methodId), methodId);
-	}
+	default:
+		error("Sound::callMethod(): Got unimplemented method %s (%d)", builtInMethodToStr(methodId), static_cast<uint>(methodId));
 	}
 }
 
diff --git a/engines/mediastation/assets/sprite.cpp b/engines/mediastation/assets/sprite.cpp
index c924b257f61..533ef3011be 100644
--- a/engines/mediastation/assets/sprite.cpp
+++ b/engines/mediastation/assets/sprite.cpp
@@ -128,9 +128,8 @@ Operand Sprite::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args)
 		return returnValue;
 	}
 
-	default: {
-		error("Sprite::callMethod(): Got unimplemented method ID %d", methodId);
-	}
+	default:
+		error("Sprite::callMethod(): Got unimplemented method ID %s (%d)", builtInMethodToStr(methodId), static_cast<uint>(methodId));
 	}
 }
 
diff --git a/engines/mediastation/assets/text.cpp b/engines/mediastation/assets/text.cpp
index 86c29863760..40f4d68240e 100644
--- a/engines/mediastation/assets/text.cpp
+++ b/engines/mediastation/assets/text.cpp
@@ -49,9 +49,8 @@ Operand Text::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
 		return Operand();
 	}
 
-	default: {
-		error("Got unimplemented method ID %d", methodId);
-	}
+	default:
+		error("Text::callMethod(): Got unimplemented method ID %s (%d)", builtInMethodToStr(methodId), static_cast<uint>(methodId));
 	}
 }
 
diff --git a/engines/mediastation/assets/timer.cpp b/engines/mediastation/assets/timer.cpp
index 6948e7c2c49..3a9a10ff2ac 100644
--- a/engines/mediastation/assets/timer.cpp
+++ b/engines/mediastation/assets/timer.cpp
@@ -47,9 +47,8 @@ Operand Timer::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args)
 		return returnValue;
 	}
 
-	default: {
-		error("Got unimplemented method ID %d", methodId);
-	}
+	default:
+		error("Timer::callMethod(): Got unimplemented method ID %s (%d)", builtInMethodToStr(methodId), static_cast<uint>(methodId));
 	}
 }
 
diff --git a/engines/mediastation/boot.cpp b/engines/mediastation/boot.cpp
index 26058fb09c3..3f1e5afa8b9 100644
--- a/engines/mediastation/boot.cpp
+++ b/engines/mediastation/boot.cpp
@@ -414,10 +414,8 @@ Boot::Boot(const Common::Path &path) : Datafile(path){
 			break;
 		}
 
-		default: {
-			warning("Boot::Boot(): Unknown section type 0x%x", static_cast<uint>(sectionType));
-			break;
-		}
+		default:
+			warning("Boot::Boot(): Unknown section type %d", static_cast<uint>(sectionType));
 		}
 
 		sectionType = getSectionType(chunk);
diff --git a/engines/mediastation/context.cpp b/engines/mediastation/context.cpp
index c5596f59057..84a8e9ac5df 100644
--- a/engines/mediastation/context.cpp
+++ b/engines/mediastation/context.cpp
@@ -102,10 +102,9 @@ Context::Context(const Common::Path &path) : Datafile(path) {
 				break;
 			}
 
-			default: {
+			default:
 				error("Context::Context(): Asset type %d referenced, but reference not implemented yet", asset->getHeader()->_type);
 			}
-			}
 		}
 	}
 }
@@ -420,10 +419,9 @@ bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
 		break;
 	}
 
-	default: {
+	default:
 		error("Context::readHeaderSection(): Unknown section type 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
 	}
-	}
 
 	return true;
 }
diff --git a/engines/mediastation/mediascript/codechunk.cpp b/engines/mediastation/mediascript/codechunk.cpp
index bbbffe622e2..cc853b295ed 100644
--- a/engines/mediastation/mediascript/codechunk.cpp
+++ b/engines/mediastation/mediascript/codechunk.cpp
@@ -329,9 +329,8 @@ Operand CodeChunk::executeNextStatement() {
 			return value;
 		}
 
-		default: {
-			error("CodeChunk::getNextStatement(): Got unknown opcode %s (%d)", opcodeToStr(opcode), static_cast<uint>(opcode));
-		}
+		default:
+			error("CodeChunk::getNextStatement(): Got unimplemented opcode %s (%d)", opcodeToStr(opcode), static_cast<uint>(opcode));
 		}
 		break;
 	}
@@ -386,9 +385,8 @@ Operand CodeChunk::executeNextStatement() {
 			return operand;
 		}
 
-		default: {
-			error("CodeChunk::getNextStatement(): Got unknown operand type %s (%d)", operandTypeToStr(operandType), static_cast<uint>(operandType));
-		}
+		default:
+			error("CodeChunk::getNextStatement(): Got unimplemented operand type %s (%d)", operandTypeToStr(operandType), static_cast<uint>(operandType));
 		}
 		break;
 	}
@@ -401,9 +399,8 @@ Operand CodeChunk::executeNextStatement() {
 		return variable;
 	}
 
-	default: {
-		error("CodeChunk::getNextStatement(): Got unknown instruction type %s (%d)", instructionTypeToStr(instructionType), static_cast<uint>(instructionType));
-	}
+	default:
+		error("CodeChunk::getNextStatement(): Got unimplemented instruction type %s (%d)", instructionTypeToStr(instructionType), static_cast<uint>(instructionType));
 	}
 }
 
@@ -419,7 +416,6 @@ Operand CodeChunk::getVariable(uint32 id, VariableScope scope) {
 	case kVariableScopeLocal: {
 		uint index = id - 1;
 		return _locals.operator[](index);
-		break;
 	}
 
 	case kVariableScopeParameter: {
@@ -428,12 +424,10 @@ Operand CodeChunk::getVariable(uint32 id, VariableScope scope) {
 			error("CodeChunk::getVariable(): Requested a parameter in a code chunk that has no parameters");
 		}
 		return _args->operator[](index);
-		break;
 	}
 
-	default: {
-		error("CodeChunk::getVariable(): Got unknown variable scope %s (%d)", variableScopeToStr(scope), static_cast<uint>(scope));
-	}
+	default:
+		error("CodeChunk::getVariable(): Got unimplemented variable scope %s (%d)", variableScopeToStr(scope), static_cast<uint>(scope));
 	}
 }
 
@@ -459,9 +453,8 @@ void CodeChunk::putVariable(uint32 id, VariableScope scope, Operand value) {
 		break;
 	}
 
-	default: {
-		error("CodeChunk::getVariable(): Got unknown variable scope %s (%d)", variableScopeToStr(scope), static_cast<uint>(scope));
-	}
+	default:
+		error("CodeChunk::getVariable(): Got unimplemented variable scope %s (%d)", variableScopeToStr(scope), static_cast<uint>(scope));
 	}
 }
 
@@ -483,7 +476,6 @@ Operand CodeChunk::callBuiltInMethod(BuiltInMethod method, Operand self, Common:
 			// which case nothing happens. Still issue warning for traceability.
 			warning("CodeChunk::callBuiltInMethod(): Attempt to call method on a null asset ID");
 			return Operand();
-			break;
 		} else {
 			// This is a regular asset that we can process directly.
 			Asset *selfAsset = self.getAsset();
@@ -502,7 +494,7 @@ Operand CodeChunk::callBuiltInMethod(BuiltInMethod method, Operand self, Common:
 	}
 
 	default:
-		error("CodeChunk::callBuiltInMethod(): Attempt to call method on unsupported operand type %s (%d)",
+		error("CodeChunk::callBuiltInMethod(): Attempt to call method on unimplemented operand type %s (%d)",
 			operandTypeToStr(literalType), static_cast<uint>(literalType));
 	}
 }
diff --git a/engines/mediastation/mediascript/operand.cpp b/engines/mediastation/mediascript/operand.cpp
index 24e8eeb4573..af07120cf1a 100644
--- a/engines/mediastation/mediascript/operand.cpp
+++ b/engines/mediastation/mediascript/operand.cpp
@@ -39,11 +39,10 @@ void Operand::putInteger(int i) {
 		break;
 	}
 
-	default: {
+	default:
 		error("Operand::putInteger(): Attempt to put integer into operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 int Operand::getInteger() {
@@ -58,11 +57,10 @@ int Operand::getInteger() {
 		return _u.variable->_value.i;
 	}
 
-	default: {
+	default:
 		error("Operand::getInteger(): Attempt to get integer from operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 void Operand::putDouble(double d) {
@@ -79,11 +77,10 @@ void Operand::putDouble(double d) {
 		break;
 	}
 
-	default: {
+	default:
 		error("Operand::putDouble(): Attempt to put double into operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 double Operand::getDouble() {
@@ -98,11 +95,10 @@ double Operand::getDouble() {
 		return _u.variable->_value.d;
 	}
 
-	default: {
+	default:
 		error("Operand::getDouble(): Attempt to get double from operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 void Operand::putString(Common::String *string) {
@@ -118,11 +114,10 @@ void Operand::putString(Common::String *string) {
 		break;
 	}
 
-	default: {
+	default:
 		error("Operand::putString(): Attempt to put string into operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 Common::String *Operand::getString() {
@@ -136,11 +131,10 @@ Common::String *Operand::getString() {
 		return _u.variable->_value.string;
 	}
 
-	default: {
+	default:
 		error("Operand::getString(): Attempt to get string from operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 void Operand::putVariable(Variable *variable) {
@@ -150,11 +144,10 @@ void Operand::putVariable(Variable *variable) {
 		break;
 	}
 
-	default: {
+	default:
 		error("Operand::putVariable(): Attempt to put variable into operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 Variable *Operand::getVariable() {
@@ -163,11 +156,10 @@ Variable *Operand::getVariable() {
 		return _u.variable;
 	}
 
-	default: {
+	default:
 		error("Operand::getVariable(): Attempt to get variable from operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 void Operand::putFunction(uint functionId) {
@@ -177,11 +169,10 @@ void Operand::putFunction(uint functionId) {
 		break;
 	}
 
-	default: {
+	default:
 		error("Operand::putFunction(): Attempt to put function ID into operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 uint Operand::getFunctionId() {
@@ -190,11 +181,10 @@ uint Operand::getFunctionId() {
 		return _u.functionId;
 	}
 
-	default: {
+	default:
 		error("Operand::getFunction(): Attempt to get function ID from operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 void Operand::putAsset(uint32 assetId) {
@@ -210,11 +200,10 @@ void Operand::putAsset(uint32 assetId) {
 		break;
 	}
 
-	default: {
+	default:
 		error("Operand::putAsset(): Attempt to put asset ID into operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 Asset *Operand::getAsset() {
@@ -232,11 +221,10 @@ Asset *Operand::getAsset() {
 		return g_engine->getAssetById(_u.variable->_value.assetId);
 	}
 
-	default: {
+	default:
 		error("Operand::getAsset(): Attempt to get asset from operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 uint32 Operand::getAssetId() {
@@ -250,11 +238,10 @@ uint32 Operand::getAssetId() {
 		return _u.variable->_value.assetId;
 	}
 
-	default: {
+	default:
 		error("Operand::getAssetId(): Attempt to get asset ID from operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 void Operand::putCollection(Collection *collection) {
@@ -270,11 +257,10 @@ void Operand::putCollection(Collection *collection) {
 		break;
 	}
 
-	default: {
+	default:
 		error("Operand::putCollection(): Attempt to put collection into operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 Collection *Operand::getCollection() {
@@ -286,14 +272,12 @@ Collection *Operand::getCollection() {
 	case kOperandTypeVariableDeclaration: {
 		assert(_u.variable->_type == kVariableTypeCollection);
 		return _u.variable->_value.collection;
-		break;
 	}
 
-	default: {
+	default:
 		error("Operand::getCollection(): Attempt to get collection from operand type %s (%d)",
 			operandTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 Operand Operand::getLiteralValue() const {
diff --git a/engines/mediastation/mediascript/variable.cpp b/engines/mediastation/mediascript/variable.cpp
index d9f31503aa9..1778105a702 100644
--- a/engines/mediastation/mediascript/variable.cpp
+++ b/engines/mediastation/mediascript/variable.cpp
@@ -48,9 +48,8 @@ Operand Collection::callMethod(BuiltInMethod method, Common::Array<Operand> &arg
 		return returnValue;
 	}
 
-	default: {
-		error("Collection::callMethod(): Attempt to call unimplemented method %s (%d)", builtInMethodToStr(method), method);
-	}
+	default:
+		error("Collection::callMethod(): Attempt to call unimplemented method %s (%d)", builtInMethodToStr(method), static_cast<uint>(method));
 	}
 }
 
@@ -114,10 +113,9 @@ Variable::Variable(Chunk &chunk, bool readId) {
 		break;
 	}
 
-	default: {
+	default:
 		error("Variable::Variable(): Got unknown variable value type %s (%d)", variableTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 Variable::~Variable() {
@@ -133,10 +131,9 @@ Variable::~Variable() {
 		break;
 	}
 
-	default: {
+	default:
 		break;
 	}
-	}
 }
 
 Operand Variable::getValue() {
@@ -187,10 +184,9 @@ Operand Variable::getValue() {
 		return returnValue;
 	}
 
-	default: {
+	default:
 		error("Variable::getValue(): Attempt to get value from unknown variable type %s (%d)", variableTypeToStr(_type), static_cast<uint>(_type));
 	}
-	}
 }
 
 void Variable::putValue(Operand value) {
@@ -231,11 +227,10 @@ void Variable::putValue(Operand value) {
 		break;
 	}
 
-	default: {
+	default:
 		error("Variable::putValue(): Assigning an unknown operand type %s (%d) to a variable not supported",
 			operandTypeToStr(value.getType()), static_cast<uint>(value.getType()));
 	}
-	}
 }
 
 } // End of namespace MediaStation
diff --git a/engines/mediastation/mediastation.cpp b/engines/mediastation/mediastation.cpp
index 5de93447457..739186db39d 100644
--- a/engines/mediastation/mediastation.cpp
+++ b/engines/mediastation/mediastation.cpp
@@ -234,12 +234,12 @@ void MediaStationEngine::processEvents() {
 			// Station engine doesn't seem to use the right button itself.
 			warning("EVENT_RBUTTONDOWN: Quitting for development purposes");
 			quitGame();
+			break;
 		}
 
-		default: {
+		default:
 			break;
 		}
-		}
 	}
 }
 
@@ -407,9 +407,8 @@ Operand MediaStationEngine::callMethod(BuiltInMethod methodId, Common::Array<Ope
 		return Operand();
 	}
 
-	default: {
-		error("MediaStationEngine::callMethod(): Got unimplemented method ID %d", static_cast<uint>(methodId));
-	}
+	default:
+		error("MediaStationEngine::callMethod(): Got unimplemented method ID %s (%d)", builtInMethodToStr(methodId), static_cast<uint>(methodId));
 	}
 }
 
@@ -504,9 +503,8 @@ Operand MediaStationEngine::callBuiltInFunction(BuiltInFunction function, Common
 		return Operand();
 	}
 
-	default: {
-		error("MediaStationEngine::callBuiltInFunction(): Got unknown built-in function %s (%d)", builtInFunctionToStr(function), function);
-	}
+	default:
+		error("MediaStationEngine::callBuiltInFunction(): Got unknown built-in function %s (%d)", builtInFunctionToStr(function), static_cast<uint>(function));
 	}
 }
 
diff --git a/engines/mediastation/transitions.cpp b/engines/mediastation/transitions.cpp
index 5f90c97dc50..afa2381774f 100644
--- a/engines/mediastation/transitions.cpp
+++ b/engines/mediastation/transitions.cpp
@@ -84,10 +84,9 @@ void MediaStationEngine::effectTransition(Common::Array<Operand> &args) {
 		break;
 	}
 
-	default: {
+	default:
 		error("MediaStationEngine::effectTransition(): Got unknown transition type %d", static_cast<uint>(transitionType));
 	}
-	}
 }
 
 } // End of namespace MediaStation
\ No newline at end of file


Commit: ee7386c5eb0f7c876a7c48a60b48b70703f100e1
    https://github.com/scummvm/scummvm/commit/ee7386c5eb0f7c876a7c48a60b48b70703f100e1
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-03-03T20:19:00-05:00

Commit Message:
MEDIASTATION: JANITORIAL: Clean up some comments

Changed paths:
    engines/mediastation/assets/path.cpp
    engines/mediastation/assets/timer.cpp
    engines/mediastation/boot.cpp
    engines/mediastation/context.cpp
    engines/mediastation/datafile.cpp
    engines/mediastation/debugchannels.h
    engines/mediastation/mediastation.cpp


diff --git a/engines/mediastation/assets/path.cpp b/engines/mediastation/assets/path.cpp
index cab72ba4dbc..1b3ca6205d8 100644
--- a/engines/mediastation/assets/path.cpp
+++ b/engines/mediastation/assets/path.cpp
@@ -77,7 +77,7 @@ void Path::timePlay() {
 	// TODO: Run the path start event. Haven't seen one the wild yet, don't know its ID.
 	debugC(5, kDebugScript, "Path::timePlay(): No PathStart event handler");
 
-	// STEP THE PATH.
+	// Step the path.
 	for (uint i = 0; i < totalSteps; i++) {
 		_percentComplete = (double)(i + 1) / totalSteps;
 		debugC(5, kDebugScript, "Path::timePlay(): Step %d of %d", i, totalSteps);
diff --git a/engines/mediastation/assets/timer.cpp b/engines/mediastation/assets/timer.cpp
index 3a9a10ff2ac..bd5b53afd05 100644
--- a/engines/mediastation/assets/timer.cpp
+++ b/engines/mediastation/assets/timer.cpp
@@ -58,13 +58,12 @@ void Timer::timePlay() {
 		//return;
 	}
 
-	// SET TIMER VARIABLES.
 	_isActive = true;
 	_startTime = g_system->getMillis();
 	_lastProcessedTime = 0;
 	g_engine->addPlayingAsset(this);
 
-	// GET THE DURATION OF THE TIMER.
+	// Get the duration of the timer.
 	// TODO: Is there a better way to find out what the max time is? Do we have to look
 	// through each of the timer event handlers to figure it out?
 	_duration = 0;
diff --git a/engines/mediastation/boot.cpp b/engines/mediastation/boot.cpp
index 3f1e5afa8b9..8e7aa9c16d0 100644
--- a/engines/mediastation/boot.cpp
+++ b/engines/mediastation/boot.cpp
@@ -42,7 +42,7 @@ VersionInfo::~VersionInfo() {
 
 #pragma region ContextDeclaration
 ContextDeclaration::ContextDeclaration(Chunk &chunk) {
-	// ENSURE WE HAVEN'T REACHED THE END OF THE DECLARATIONS.
+	// Make sure this declaration isn't empty.
 	ContextDeclarationSectionType sectionType = getSectionType(chunk);
 	if (kContextDeclarationEmptySection == sectionType) {
 		_isLast = true;
@@ -52,9 +52,8 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
 		_isLast = false;
 	}
 
-	// READ THE OTHER CONTEXT METADATA.
 	if (kContextDeclarationPlaceholder == sectionType) {
-		// READ THE FILE NUMBER.
+		// Read the file number.
 		sectionType = getSectionType(chunk);
 		if (kContextDeclarationFileNumber1 == sectionType) {
 			_fileNumber = Datum(chunk).u.i;
@@ -73,7 +72,7 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
 			error("ContextDeclaration(): Expected section type FILE_NUMBER_2, got 0x%x", static_cast<uint>(sectionType));
 		}
 
-		// READ THE CONTEXT NAME.
+		// Read the context name.
 		// Only some titles have context names, and unfortunately we can't
 		// determine which just by relying on the title compiler version
 		// number.
@@ -84,7 +83,7 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
 		if (kContextDeclarationName == sectionType) {
 			_contextName = Datum(chunk, kDatumTypeString).u.string;
 		} else {
-			// THERE IS NO CONTEXT NAME.
+			// There is no context name.
 			// We have instead read into the next declaration, so let's undo that.
 			chunk.seek(rewindOffset);
 		}
@@ -94,7 +93,7 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
 		error("ContextDeclaration::ContextDeclaration(): Unknown section type 0x%x", static_cast<uint>(sectionType));
 	}
 
-	// READ THE FILE REFERENCES.
+	// Read the file references.
 	// We don't know how many file references there are beforehand, so we'll
 	// just read until we get something else.
 	int rewindOffset = 0;
@@ -122,7 +121,7 @@ ContextDeclaration::~ContextDeclaration() {
 
 #pragma region UnknownDeclaration
 UnknownDeclaration::UnknownDeclaration(Chunk &chunk) {
-	// ENSURE THIS DECLARATION IS NOT EMPTY.
+	// Make sure this declaration isn't empty.
 	UnknownDeclarationSectionType sectionType = getSectionType(chunk);
 	if (kUnknownDeclarationEmptySection == sectionType) {
 		_isLast = true;
@@ -132,7 +131,6 @@ UnknownDeclaration::UnknownDeclaration(Chunk &chunk) {
 		_isLast = false;
 	}
 
-	// READ THE UNKNOWN VALUE.
 	sectionType = getSectionType(chunk);
 	if (kUnknownDeclarationUnk1 == sectionType) {
 		_unk = Datum(chunk, kDatumTypeUint16_1).u.i;
@@ -159,7 +157,7 @@ UnknownDeclarationSectionType UnknownDeclaration::getSectionType(Chunk &chunk) {
 
 #pragma region FileDeclaration
 FileDeclaration::FileDeclaration(Chunk &chunk) {
-	// ENSURE THIS DECLARATION IS NOT EMPTY.
+	// Make sure this declaration isn't empty.
 	FileDeclarationSectionType sectionType = getSectionType(chunk);
 	if (kFileDeclarationEmptySection == sectionType) {
 		_isLast = true;
@@ -169,7 +167,7 @@ FileDeclaration::FileDeclaration(Chunk &chunk) {
 		_isLast = false;
 	}
 
-	// READ THE FILE ID.
+	// Read the file ID.
 	sectionType = getSectionType(chunk);
 	if (kFileDeclarationFileId == sectionType) {
 		_id = Datum(chunk, kDatumTypeUint16_1).u.i;
@@ -177,7 +175,7 @@ FileDeclaration::FileDeclaration(Chunk &chunk) {
 		error("FileDeclaration(): Expected section type FILE_ID, got 0x%x", static_cast<uint>(sectionType));
 	}
 
-	// READ THE INTENDED LOCATION OF THE FILE.
+	// Read the intended file location.
 	sectionType = getSectionType(chunk);
 	if (kFileDeclarationFileNameAndType == sectionType) {
 		Datum datum = Datum(chunk, kDatumTypeUint16_1);
@@ -187,7 +185,6 @@ FileDeclaration::FileDeclaration(Chunk &chunk) {
 		error("FileDeclaration(): Expected section type FILE_NAME_AND_TYPE, got 0x%x", static_cast<uint>(sectionType));
 	}
 
-	// READ THE CASE-INSENSITIVE FILENAME.
 	// Since the platforms that Media Station originally targeted were case-insensitive,
 	// the case of these filenames might not match the case of the files actually in
 	// the directory. All files should be matched case-insensitively.
@@ -208,7 +205,7 @@ FileDeclaration::~FileDeclaration() {
 
 #pragma region SubfileDeclaration
 SubfileDeclaration::SubfileDeclaration(Chunk &chunk) {
-	// ENSURE THIS DECLARATION IS NOT EMPTY.
+	// Make sure this declaration isn't empty.
 	SubfileDeclarationSectionType sectionType = getSectionType(chunk);
 	if (kSubfileDeclarationEmptySection == sectionType) {
 		_isLast = true;
@@ -218,7 +215,7 @@ SubfileDeclaration::SubfileDeclaration(Chunk &chunk) {
 		_isLast = false;
 	}
 
-	// READ THE ASSET ID.
+	// Read the asset ID.
 	sectionType = getSectionType(chunk);
 	if (kSubfileDeclarationAssetId == sectionType) {
 		_assetId = Datum(chunk, kDatumTypeUint16_1).u.i;
@@ -226,7 +223,7 @@ SubfileDeclaration::SubfileDeclaration(Chunk &chunk) {
 		error("SubfileDeclaration(): Expected section type ASSET_ID, got 0x%x", static_cast<uint>(sectionType));
 	}
 
-	// READ THE FILE ID.
+	// Read the file ID.
 	sectionType = getSectionType(chunk);
 	if (kSubfileDeclarationFileId == sectionType) {
 		_fileId = Datum(chunk, kDatumTypeUint16_1).u.i;
@@ -234,8 +231,7 @@ SubfileDeclaration::SubfileDeclaration(Chunk &chunk) {
 		error("SubfileDeclaration(): Expected section type FILE_ID, got 0x%x", static_cast<uint>(sectionType));
 	}
 
-	// READ THE START OFFSET IN THE GIVEN FILE.
-	// This is from the absolute start of the given file.
+	// Read the start offset from the absolute start of the file.
 	sectionType = getSectionType(chunk);
 	if (kSubfileDeclarationStartOffset == sectionType) {
 		_startOffsetInFile = Datum(chunk, kDatumTypeUint32_1).u.i;
@@ -253,7 +249,6 @@ SubfileDeclarationSectionType SubfileDeclaration::getSectionType(Chunk &chunk) {
 
 #pragma region CursorDeclaration
 CursorDeclaration::CursorDeclaration(Chunk& chunk) {
-	// READ THE CURSOR RESOURCE.
 	uint16 unk1 = Datum(chunk, kDatumTypeUint16_1).u.i; // Always 0x0001
 	_id = Datum(chunk, kDatumTypeUint16_1).u.i;
 	_unk = Datum(chunk, kDatumTypeUint16_1).u.i;
diff --git a/engines/mediastation/context.cpp b/engines/mediastation/context.cpp
index 84a8e9ac5df..98633884844 100644
--- a/engines/mediastation/context.cpp
+++ b/engines/mediastation/context.cpp
@@ -219,7 +219,7 @@ void Context::readNewStyleHeaderSections(Subfile &subfile, Chunk &chunk) {
 	}
 
 	while (moreSectionsToRead) {
-		// VERIFY THIS CHUNK IS A HEADER.
+		// Verify this chunk is a header.
 		// TODO: What are the situations when it's not?
 		uint16 sectionType = Datum(chunk, kDatumTypeUint16_1).u.i;
 		debugC(5, kDebugLoading, "Context::readNewStyleHeaderSections(): sectionType = 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
@@ -228,7 +228,7 @@ void Context::readNewStyleHeaderSections(Subfile &subfile, Chunk &chunk) {
 			error("Context::readNewStyleHeaderSections(): Expected header chunk, got %s (@0x%llx)", tag2str(chunk._id), static_cast<long long int>(chunk.pos()));
 		}
 
-		// READ THIS HEADER SECTION.
+		// Read this header section.
 		moreSectionsToRead = readHeaderSection(subfile, chunk);
 		if (subfile.atEnd()) {
 			break;
diff --git a/engines/mediastation/datafile.cpp b/engines/mediastation/datafile.cpp
index 79c35db5fec..5e739126c0b 100644
--- a/engines/mediastation/datafile.cpp
+++ b/engines/mediastation/datafile.cpp
@@ -63,14 +63,14 @@ bool Chunk::seek(int64 offset, int whence) {
 }
 
 Subfile::Subfile(Common::SeekableReadStream *stream) : _stream(stream) {
-	// VERIFY FILE SIGNATURE.
+	// Verify file signature.
 	debugC(5, kDebugLoading, "\n*** Subfile::Subfile(): Got new subfile (@0x%llx) ***", static_cast<long long int>(_stream->pos()));
 	_rootChunk = nextChunk();
 	if (_rootChunk._id != MKTAG('R', 'I', 'F', 'F'))
 		error("Subfile::Subfile(): Expected \"RIFF\" chunk, got %s (@0x%llx)", tag2str(_rootChunk._id), static_cast<long long int>(_stream->pos()));
 	_stream->skip(4); // IMTS
 
-	// READ RATE CHUNK.
+	// Read the RATE chunk.
 	// This chunk should  always contain just one piece of data,
 	// the "rate" (whatever that is). Usually it is zero.
 	// TODO: Figure out what this actually is.
@@ -79,10 +79,9 @@ Subfile::Subfile(Common::SeekableReadStream *stream) : _stream(stream) {
 		error("Subfile::Subfile(): Expected \"rate\" chunk, got %s (@0x%llx)", tag2str(_rootChunk._id), static_cast<long long int>(_stream->pos()));
 	_rate = _stream->readUint32LE();
 
-	// READ PAST LIST CHUNK.
+	// Queue up the first data chunk.
+	// First, we need to read past the LIST chunk.
 	nextChunk();
-
-	// QUEUE UP THE FIRST DATA CHUNK.
 	if (_stream->readUint32BE() != MKTAG('d', 'a', 't', 'a'))
 		error("Subfile::Subfile(): Expected \"data\" as first bytes of subfile, got %s @0x%llx)", tag2str(rateChunk._id), static_cast<long long int>(_stream->pos()));
 }
diff --git a/engines/mediastation/debugchannels.h b/engines/mediastation/debugchannels.h
index 7f26b04dfbb..4c77531dd95 100644
--- a/engines/mediastation/debugchannels.h
+++ b/engines/mediastation/debugchannels.h
@@ -29,18 +29,13 @@
 
 namespace MediaStation {
 
-// TODO: Finish comments that describe the various debug levels
+// TODO: Finish comments that describe the various debug levels.
 enum DebugChannels {
 	kDebugGraphics = 1,
 	kDebugPath,
 	kDebugScan,
-
-	// Level 5: Decompiled Script Lines
-	// Level 7: Instruction Types & Opcodes
 	kDebugScript,
 	kDebugEvents,
-
-	// Level 9: Individual Datums
 	kDebugLoading
 };
 
diff --git a/engines/mediastation/mediastation.cpp b/engines/mediastation/mediastation.cpp
index 739186db39d..1ca1117a839 100644
--- a/engines/mediastation/mediastation.cpp
+++ b/engines/mediastation/mediastation.cpp
@@ -126,14 +126,11 @@ bool MediaStationEngine::isFirstGenerationEngine() {
 }
 
 Common::Error MediaStationEngine::run() {
-	// INITIALIZE SUBSYSTEMS.
-	// All Media Station games run at 640x480.
 	initGraphics(SCREEN_WIDTH, SCREEN_HEIGHT);
 	_screen = new Graphics::Screen();
 	// TODO: Determine if all titles blank the screen to 0xff.
 	_screen->fillRect(Common::Rect(SCREEN_WIDTH, SCREEN_HEIGHT), 0xff);
 
-	// LOAD BOOT.STM.
 	Common::Path bootStmFilepath = Common::Path("BOOT.STM");
 	_boot = new Boot(bootStmFilepath);
 
@@ -188,7 +185,6 @@ Common::Error MediaStationEngine::run() {
 		g_system->delayMillis(10);
 	}
 
-	// CLEAN UP.
 	return Common::kNoError;
 }
 
@@ -315,7 +311,7 @@ Context *MediaStationEngine::loadContext(uint32 contextId) {
 		return _loadedContexts.getVal(contextId);
 	}
 
-	// GET THE FILE ID.
+	// Get the file ID.
 	SubfileDeclaration *subfileDeclaration = _boot->_subfileDeclarations.getValOrDefault(contextId);
 	if (subfileDeclaration == nullptr) {
 		error("MediaStationEngine::loadContext(): Couldn't find subfile declaration with ID %d", contextId);
@@ -329,7 +325,7 @@ Context *MediaStationEngine::loadContext(uint32 contextId) {
 	}
 	uint32 fileId = subfileDeclaration->_fileId;
 
-	// GET THE FILENAME.
+	// Get the filename.
 	FileDeclaration *fileDeclaration = _boot->_fileDeclarations.getValOrDefault(fileId);
 	if (fileDeclaration == nullptr) {
 		warning("MediaStationEngine::loadContext(): Couldn't find file declaration with ID 0x%x", fileId);


Commit: 4211ca99ca9d5fcee0df2c3b0147ffd5ffe82982
    https://github.com/scummvm/scummvm/commit/4211ca99ca9d5fcee0df2c3b0147ffd5ffe82982
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-03-03T20:24:07-05:00

Commit Message:
MEDIASTATION: Clean up defaulted constructors

Changed paths:
  A engines/mediastation/assets/stage.h
    engines/mediastation/assets/canvas.h
    engines/mediastation/assets/hotspot.h
    engines/mediastation/assets/palette.h
    engines/mediastation/assets/screen.h
    engines/mediastation/assets/timer.h


diff --git a/engines/mediastation/assets/canvas.h b/engines/mediastation/assets/canvas.h
index 514c7844fc4..17f9e3e65bb 100644
--- a/engines/mediastation/assets/canvas.h
+++ b/engines/mediastation/assets/canvas.h
@@ -32,7 +32,6 @@ namespace MediaStation {
 class Canvas : public Asset {
 public:
 	Canvas(AssetHeader *header) : Asset(header) {};
-	virtual ~Canvas() override = default;
 
 	virtual Operand callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) override;
 };
diff --git a/engines/mediastation/assets/hotspot.h b/engines/mediastation/assets/hotspot.h
index d72b0237555..ae5a5728596 100644
--- a/engines/mediastation/assets/hotspot.h
+++ b/engines/mediastation/assets/hotspot.h
@@ -32,7 +32,6 @@ namespace MediaStation {
 class Hotspot : public Asset {
 public:
 	Hotspot(AssetHeader *header);
-	virtual ~Hotspot() override = default;
 
 	bool isInside(const Common::Point &pointToCheck);
 
diff --git a/engines/mediastation/assets/palette.h b/engines/mediastation/assets/palette.h
index 2c3d44ce20f..478a34a26a6 100644
--- a/engines/mediastation/assets/palette.h
+++ b/engines/mediastation/assets/palette.h
@@ -32,7 +32,6 @@ namespace MediaStation {
 class Palette : public Asset {
 public:
 	Palette(AssetHeader *header) : Asset(header) {};
-	~Palette() = default;
 
 	virtual Operand callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) override;
 };
diff --git a/engines/mediastation/assets/screen.h b/engines/mediastation/assets/screen.h
index e51fd5c5cf3..463e68553e2 100644
--- a/engines/mediastation/assets/screen.h
+++ b/engines/mediastation/assets/screen.h
@@ -35,7 +35,6 @@ namespace MediaStation {
 class Screen : public Asset {
 public:
 	Screen(AssetHeader *header) : Asset(header) {};
-	~Screen() = default;
 
 	virtual Operand callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) override;
 };
diff --git a/engines/mediastation/assets/stage.h b/engines/mediastation/assets/stage.h
new file mode 100644
index 00000000000..bbbdd89ae02
--- /dev/null
+++ b/engines/mediastation/assets/stage.h
@@ -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/>.
+ *
+ */
+
+#ifndef MEDIASTATION_STAGE_H
+#define MEDIASTATION_STAGE_H
+
+#include "mediastation/asset.h"
+
+namespace MediaStation {
+
+class Camera : public Asset {
+public:
+	Camera(AssetHeader *header) : Asset(header) {};
+
+	virtual Operand callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) override { error("CallMethod not implemented"); };
+	virtual void process() override {};
+};
+
+class Stage : public Asset {
+public:
+	Stage(AssetHeader *header) : Asset(header) {};
+
+	virtual Operand callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) override { error("CallMethod not implemented"); };
+	virtual void process() override {};
+
+private:
+	Common::Array<Asset *> _children;
+};
+
+}
+
+#endif
\ No newline at end of file
diff --git a/engines/mediastation/assets/timer.h b/engines/mediastation/assets/timer.h
index 6ee247c5a78..b9b7ee84491 100644
--- a/engines/mediastation/assets/timer.h
+++ b/engines/mediastation/assets/timer.h
@@ -32,7 +32,6 @@ namespace MediaStation {
 class Timer : public Asset {
 public:
 	Timer(AssetHeader *header) : Asset(header) {};
-	virtual ~Timer() override = default;
 
 	virtual Operand callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) override;
 	virtual void process() override;


Commit: 964830b570553fbc66e6b49e4e72fdb7ce0d4ab8
    https://github.com/scummvm/scummvm/commit/964830b570553fbc66e6b49e4e72fdb7ce0d4ab8
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-03-03T20:39:20-05:00

Commit Message:
MEDIASTATION: Remove unused declaration and assignment

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


diff --git a/engines/mediastation/mediastation.cpp b/engines/mediastation/mediastation.cpp
index 1ca1117a839..93b72d43d26 100644
--- a/engines/mediastation/mediastation.cpp
+++ b/engines/mediastation/mediastation.cpp
@@ -40,7 +40,6 @@ MediaStationEngine::MediaStationEngine(OSystem *syst, const ADGameDescription *g
 	_gameDescription(gameDesc),
 	_randomSource("MediaStation") {
 	g_engine = this;
-	_mixer = g_system->getMixer();
 
 	_gameDataDir = Common::FSNode(ConfMan.getPath("path"));
 	SearchMan.addDirectory(_gameDataDir, 0, 3);
diff --git a/engines/mediastation/mediastation.h b/engines/mediastation/mediastation.h
index efe93a361f7..8216da2cc7e 100644
--- a/engines/mediastation/mediastation.h
+++ b/engines/mediastation/mediastation.h
@@ -123,7 +123,6 @@ private:
 
 	Context *loadContext(uint32 contextId);
 	void setPaletteFromHeader(AssetHeader *header);
-	void branchToScreen(uint32 contextId);
 	void releaseContext(uint32 contextId);
 	Asset *findAssetToAcceptMouseEvents(Common::Point point);
 


Commit: 0194a33717c3e4af6962854d453d64094e696367
    https://github.com/scummvm/scummvm/commit/0194a33717c3e4af6962854d453d64094e696367
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-03-03T20:40:03-05:00

Commit Message:
MEDIASTATION: Rename variable

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


diff --git a/engines/mediastation/mediastation.cpp b/engines/mediastation/mediastation.cpp
index 93b72d43d26..35b5289efd1 100644
--- a/engines/mediastation/mediastation.cpp
+++ b/engines/mediastation/mediastation.cpp
@@ -188,12 +188,12 @@ Common::Error MediaStationEngine::run() {
 }
 
 void MediaStationEngine::processEvents() {
-	while (g_system->getEventManager()->pollEvent(e)) {
+	while (g_system->getEventManager()->pollEvent(_event)) {
 		debugC(9, kDebugEvents, "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
 		debugC(9, kDebugEvents, "@@@@   Processing events");
 		debugC(9, kDebugEvents, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
 
-		switch (e.type) {
+		switch (_event.type) {
 		case Common::EVENT_QUIT: {
 			// TODO: Do any necessary clean-up.
 			return;
@@ -209,16 +209,16 @@ void MediaStationEngine::processEvents() {
 			Common::Point mousePos = g_system->getEventManager()->getMousePos();
 			Asset *hotspot = findAssetToAcceptMouseEvents(mousePos);
 			if (hotspot != nullptr) {
-				debugC(1, kDebugEvents, "EVENT_KEYDOWN (%d): Sent to hotspot %d", e.kbd.ascii, hotspot->getHeader()->_id);
-				hotspot->runKeyDownEventHandlerIfExists(e.kbd);
+				debugC(1, kDebugEvents, "EVENT_KEYDOWN (%d): Sent to hotspot %d", _event.kbd.ascii, hotspot->getHeader()->_id);
+				hotspot->runKeyDownEventHandlerIfExists(_event.kbd);
 			}
 			break;
 		}
 
 		case Common::EVENT_LBUTTONDOWN: {
-			Asset *hotspot = findAssetToAcceptMouseEvents(e.mouse);
+			Asset *hotspot = findAssetToAcceptMouseEvents(_event.mouse);
 			if (hotspot != nullptr) {
-				debugC(1, kDebugEvents, "EVENT_LBUTTONDOWN (%d, %d): Sent to hotspot %d", e.mouse.x, e.mouse.y, hotspot->getHeader()->_id);
+				debugC(1, kDebugEvents, "EVENT_LBUTTONDOWN (%d, %d): Sent to hotspot %d", _event.mouse.x, _event.mouse.y, hotspot->getHeader()->_id);
 				hotspot->runEventHandlerIfExists(kMouseDownEvent);
 			}
 			break;
@@ -256,11 +256,11 @@ void MediaStationEngine::refreshActiveHotspot() {
 	if (hotspot != _currentHotspot) {
 		if (_currentHotspot != nullptr) {
 			_currentHotspot->runEventHandlerIfExists(kMouseExitedEvent);
-			debugC(5, kDebugEvents, "EVENT_MOUSEMOVE (%d, %d): Exited hotspot %d", e.mouse.x, e.mouse.y, _currentHotspot->getHeader()->_id);
+			debugC(5, kDebugEvents, "EVENT_MOUSEMOVE (%d, %d): Exited hotspot %d", _event.mouse.x, _event.mouse.y, _currentHotspot->getHeader()->_id);
 		}
 		_currentHotspot = hotspot;
 		if (hotspot != nullptr) {
-			debugC(5, kDebugEvents, "EVENT_MOUSEMOVE (%d, %d): Entered hotspot %d", e.mouse.x, e.mouse.y, hotspot->getHeader()->_id);
+			debugC(5, kDebugEvents, "EVENT_MOUSEMOVE (%d, %d): Entered hotspot %d", _event.mouse.x, _event.mouse.y, hotspot->getHeader()->_id);
 			setCursor(hotspot->getHeader()->_cursorResourceId);
 			hotspot->runEventHandlerIfExists(kMouseEnteredEvent);
 		} else {
@@ -270,7 +270,7 @@ void MediaStationEngine::refreshActiveHotspot() {
 	}
 
 	if (hotspot != nullptr) {
-		debugC(5, kDebugEvents, "EVENT_MOUSEMOVE (%d, %d): Sent to hotspot %d", e.mouse.x, e.mouse.y, hotspot->getHeader()->_id);
+		debugC(5, kDebugEvents, "EVENT_MOUSEMOVE (%d, %d): Sent to hotspot %d", _event.mouse.x, _event.mouse.y, hotspot->getHeader()->_id);
 		hotspot->runEventHandlerIfExists(kMouseMovedEvent);
 	}
 }
diff --git a/engines/mediastation/mediastation.h b/engines/mediastation/mediastation.h
index 8216da2cc7e..563f11d7b16 100644
--- a/engines/mediastation/mediastation.h
+++ b/engines/mediastation/mediastation.h
@@ -103,7 +103,7 @@ protected:
 	Common::Error run() override;
 
 private:
-	Common::Event e;
+	Common::Event _event;
 	Common::FSNode _gameDataDir;
 	const ADGameDescription *_gameDescription;
 	Common::RandomSource _randomSource;


Commit: 55dd27e3d066761f2c96fc57af34cc8c7bdc3931
    https://github.com/scummvm/scummvm/commit/55dd27e3d066761f2c96fc57af34cc8c7bdc3931
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-03-03T20:40:03-05:00

Commit Message:
MEDIASTATION: Support integer-double comparisons in scripts

Changed paths:
    engines/mediastation/mediascript/operand.cpp
    engines/mediastation/mediascript/operand.h


diff --git a/engines/mediastation/mediascript/operand.cpp b/engines/mediastation/mediascript/operand.cpp
index af07120cf1a..1f65dcf33b1 100644
--- a/engines/mediastation/mediascript/operand.cpp
+++ b/engines/mediastation/mediascript/operand.cpp
@@ -293,71 +293,69 @@ Operand Operand::getLiteralValue() const {
 bool Operand::operator==(const Operand &other) const {
 	Operand lhs = getLiteralValue();
 	Operand rhs = other.getLiteralValue();
-	// TODO: Maybe some better type checking here. If the types being compared
-	// end up being incompatible, the respective get method on the rhs will
-	// raise the error. But better might be checking both before we try getting
-	// values to report a more descriptive error.
-	switch (lhs.getType()) {
-	case kOperandTypeLiteral1:
-	case kOperandTypeLiteral2:
-		return lhs.getInteger() == rhs.getInteger();
 
-	case kOperandTypeFloat1:
-	case kOperandTypeFloat2:
-		return lhs.getDouble() == rhs.getDouble();
-
-	case kOperandTypeString:
-		return *lhs.getString() == *rhs.getString();
+	if (lhs.isDouble() || rhs.isDouble()) {
+		// If either operand is a double, perform double comparison.
+		double lhsValue = lhs.isDouble() ? lhs.getDouble() : static_cast<double>(lhs.getInteger());
+		double rhsValue = rhs.isDouble() ? rhs.getDouble() : static_cast<double>(rhs.getInteger());
+		return lhsValue == rhsValue;
+	} else {
+		switch (lhs.getType()) {
+		case kOperandTypeLiteral1:
+		case kOperandTypeLiteral2:
+			return lhs.getInteger() == rhs.getInteger();
 
-	case kOperandTypeAssetId:
-		return lhs.getAssetId() == rhs.getAssetId();
+		case kOperandTypeAssetId:
+			return lhs.getAssetId() == rhs.getAssetId();
 
-	default:
-		error("Operand::operator==(): Unsupported operand types %d and %d", static_cast<uint>(lhs.getType()), static_cast<uint>(rhs.getType()));
+		default:
+			error("Operand::operator==(): Unimplemented operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+		}
 	}
 }
 
 bool Operand::operator<(const Operand &other) const {
 	Operand lhs = getLiteralValue();
 	Operand rhs = other.getLiteralValue();
-	// If the types being compared end up being incompatible, the respective get
-	// method on the rhs will raise the error.
-	switch (lhs.getType()) {
-	case kOperandTypeLiteral1:
-	case kOperandTypeLiteral2:
-		return lhs.getInteger() < rhs.getInteger();
 
-	case kOperandTypeFloat1:
-	case kOperandTypeFloat2:
-		return lhs.getDouble() < rhs.getDouble();
+	if (!lhs.isNumber() || !rhs.isNumber()) {
+		error("Operand::operator<(): Unimplemented operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+	}
 
-	default:
-		error("Operand::operator<(): Unsupported operand types %d and %d", static_cast<uint>(lhs.getType()), static_cast<uint>(rhs.getType()));
+	if (lhs.isDouble() || rhs.isDouble()) {
+		// If either operand is a double, perform double comparison.
+		double lhsValue = lhs.isDouble() ? lhs.getDouble() : static_cast<double>(lhs.getInteger());
+		double rhsValue = rhs.isDouble() ? rhs.getDouble() : static_cast<double>(rhs.getInteger());
+		return lhsValue < rhsValue;
+	} else {
+		// Otherwise, perform integer comparison.
+		return lhs.getInteger() < rhs.getInteger();
 	}
 }
 
 bool Operand::operator>(const Operand &other) const {
 	Operand lhs = getLiteralValue();
 	Operand rhs = other.getLiteralValue();
-	// If the types being compared end up being incompatible, the respective get
-	// method on the rhs will raise the error.
-	switch (lhs.getType()) {
-	case kOperandTypeLiteral1:
-	case kOperandTypeLiteral2:
-		return lhs.getInteger() > rhs.getInteger();
 
-	case kOperandTypeFloat1:
-	case kOperandTypeFloat2:
-		return lhs.getDouble() > rhs.getDouble();
+	if (!lhs.isNumber() || !rhs.isNumber()) {
+		error("Operand::operator>(): Unimplemented operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+	}
 
-	default:
-		error("Operand::operator>(): Unsupported operand types %d and %d", static_cast<uint>(lhs.getType()), static_cast<uint>(rhs.getType()));
+	if (lhs.isDouble() || rhs.isDouble()) {
+		// If either operand is a double, perform double comparison.
+		double lhsValue = lhs.isDouble() ? lhs.getDouble() : static_cast<double>(lhs.getInteger());
+		double rhsValue = rhs.isDouble() ? rhs.getDouble() : static_cast<double>(rhs.getInteger());
+		return lhsValue > rhsValue;
+	} else {
+		// Otherwise, perform integer comparison.
+		return lhs.getInteger() > rhs.getInteger();
 	}
 }
 
 bool Operand::operator||(const Operand &other) const {
 	Operand lhs = getLiteralValue();
 	Operand rhs = other.getLiteralValue();
+
 	// If the types being compared end up being incompatible, the respective get
 	// method on the rhs will raise the error.
 	switch (lhs.getType()) {
@@ -366,36 +364,38 @@ bool Operand::operator||(const Operand &other) const {
 		return lhs.getInteger() || rhs.getInteger();
 
 	default:
-		error("Operand::operator||(): Unsupported operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+		error("Operand::operator||(): Unimplemented operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
 	}
 }
 
 bool Operand::operator!() const {
 	Operand literalValue = getLiteralValue();
+
 	// If the types being compared end up being incompatible, the respective get
-	// method on the rhs will raise the error.
+	// method will raise the error.
 	switch (literalValue.getType()) {
 	case kOperandTypeLiteral1:
 	case kOperandTypeLiteral2:
 		return !literalValue.getInteger();
 
 	default:
-		error("Operand::operator!(): Unsupported operand type %d", static_cast<uint>(literalValue.getType()));
+		error("Operand::operator!(): Unimplemented operand type %s", operandTypeToStr(literalValue.getType()));
 	}
 }
 
 bool Operand::operator&&(const Operand &other) const {
 	Operand lhs = getLiteralValue();
 	Operand rhs = other.getLiteralValue();
+
 	// If the types being compared end up being incompatible, the respective get
-	// method on the rhs will raise the error.
+	// method will raise the error.
 	switch (lhs.getType()) {
 	case kOperandTypeLiteral1:
 	case kOperandTypeLiteral2:
 		return lhs.getInteger() && rhs.getInteger();
 
 	default:
-		error("Operand::operator&&(): Unsupported operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+		error("Operand::operator&&(): Unimplemented operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
 	}
 }
 
@@ -403,101 +403,96 @@ Operand Operand::operator+(const Operand &other) const {
 	Operand lhs = getLiteralValue();
 	Operand rhs = other.getLiteralValue();
 	Operand returnValue(lhs.getType());
-	// If the types being compared end up being incompatible, the respective get
-	// method on the rhs will raise the error.
-	switch (lhs.getType()) {
-	case kOperandTypeLiteral1:
-	case kOperandTypeLiteral2:
-		returnValue.putInteger(lhs.getInteger() + rhs.getInteger());
-		return returnValue;
 
-	case kOperandTypeFloat1:
-	case kOperandTypeFloat2:
-		returnValue.putDouble(lhs.getDouble() + rhs.getDouble());
-		return returnValue;
+	if (!lhs.isNumber() || !rhs.isNumber()) {
+		error("Operand::operator+(): Unimplemented operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+	}
 
-	default:
-		error("Operand::operator+(): Unsupported operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+	if (lhs.isDouble() || rhs.isDouble()) {
+		// If either operand is a double, perform double addition.
+		double lhsValue = lhs.isDouble() ? lhs.getDouble() : static_cast<double>(lhs.getInteger());
+		double rhsValue = rhs.isDouble() ? rhs.getDouble() : static_cast<double>(rhs.getInteger());
+		returnValue.putDouble(lhsValue + rhsValue);
+	} else {
+		// Otherwise, perform integer addition.
+		returnValue.putInteger(lhs.getInteger() + rhs.getInteger());
 	}
+
+	return returnValue;
 }
 
 Operand Operand::operator-(const Operand &other) const {
 	Operand lhs = getLiteralValue();
 	Operand rhs = other.getLiteralValue();
 	Operand returnValue(lhs.getType());
-	// If the types being compared end up being incompatible, the respective get
-	// method on the rhs will raise the error.
-	switch (lhs.getType()) {
-	case kOperandTypeLiteral1:
-	case kOperandTypeLiteral2:
-		returnValue.putInteger(lhs.getInteger() - rhs.getInteger());
-		return returnValue;
 
-	case kOperandTypeFloat1:
-	case kOperandTypeFloat2:
-		returnValue.putDouble(lhs.getDouble() - rhs.getDouble());
-		return returnValue;
+	if (!lhs.isNumber() || !rhs.isNumber()) {
+		error("Operand::operator-(): Unimplemented operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+	}
 
-	default:
-		error("Operand::operator-(): Unsupported operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+	if (lhs.isDouble() || rhs.isDouble()) {
+		// If either operand is a double, perform double subtraction.
+		double lhsValue = lhs.isDouble() ? lhs.getDouble() : static_cast<double>(lhs.getInteger());
+		double rhsValue = rhs.isDouble() ? rhs.getDouble() : static_cast<double>(rhs.getInteger());
+		returnValue.putDouble(lhsValue - rhsValue);
+	} else {
+		// Otherwise, perform integer subtraction.
+		returnValue.putInteger(lhs.getInteger() - rhs.getInteger());
 	}
+
+	return returnValue;
 }
 
 Operand Operand::operator*(const Operand &other) const {
 	Operand lhs = getLiteralValue();
 	Operand rhs = other.getLiteralValue();
 	Operand returnValue(lhs.getType());
-	// If the types being compared end up being incompatible, the respective get
-	// method on the rhs will raise the error.
-	switch (lhs.getType()) {
-	case kOperandTypeLiteral1:
-	case kOperandTypeLiteral2:
-		returnValue.putInteger(lhs.getInteger() * rhs.getInteger());
-		return returnValue;
 
-	case kOperandTypeFloat1:
-	case kOperandTypeFloat2:
-		returnValue.putDouble(lhs.getDouble() * rhs.getDouble());
-		return returnValue;
+	if (!lhs.isNumber() || !rhs.isNumber()) {
+		error("Operand::operator*(): Unimplemented operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+	}
 
-	default:
-		error("Operand::operator*(): Unsupported operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+	if (lhs.isDouble() || rhs.isDouble()) {
+		// If either operand is a double, perform double multiplication.
+		double lhsValue = lhs.isDouble() ? lhs.getDouble() : static_cast<double>(lhs.getInteger());
+		double rhsValue = rhs.isDouble() ? rhs.getDouble() : static_cast<double>(rhs.getInteger());
+		returnValue.putDouble(lhsValue * rhsValue);
+	} else {
+		// Otherwise, perform integer subtraction.
+		returnValue.putInteger(lhs.getInteger() * rhs.getInteger());
 	}
+
+	return returnValue;
 }
 
 Operand Operand::operator/(const Operand &other) const {
 	Operand lhs = getLiteralValue();
 	Operand rhs = other.getLiteralValue();
 	Operand returnValue(lhs.getType());
-	// If the types being compared end up being incompatible, the respective get
-	// method on the rhs will raise the error.
-	switch (lhs.getType()) {
-	case kOperandTypeLiteral1:
-	case kOperandTypeLiteral2:
-		if (rhs.getInteger() == 0) {
-			error("Operand::operator/(): Attempted divide by zero");
-		}
-		// Standard integer divison here.
-		returnValue.putInteger(lhs.getInteger() / rhs.getInteger());
-		return returnValue;
 
-	case kOperandTypeFloat1:
-	case kOperandTypeFloat2:
-		if (rhs.getDouble() == 0) {
-			error("Operand::operator/(): Attempted divide by zero");
-		}
-		returnValue.putDouble(lhs.getDouble() / rhs.getDouble());
-		return returnValue;
+	if (!lhs.isNumber() || !rhs.isNumber()) {
+		error("Operand::operator/(): Unimplemented operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+	}
 
-	default:
-		error("Operand::operator/(): Unsupported operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+	if (lhs.isDouble() || rhs.isDouble()) {
+		// If either operand is a double, perform double division.
+		double lhsValue = lhs.isDouble() ? lhs.getDouble() : static_cast<double>(lhs.getInteger());
+		double rhsValue = rhs.isDouble() ? rhs.getDouble() : static_cast<double>(rhs.getInteger());
+		returnValue.putDouble(lhsValue / rhsValue);
+	} else {
+		// Otherwise, perform integer division.
+		returnValue.putInteger(lhs.getInteger() / rhs.getInteger());
 	}
+
+	return returnValue;
+
 }
 
 Operand Operand::operator%(const Operand &other) const {
 	Operand lhs = getLiteralValue();
 	Operand rhs = other.getLiteralValue();
 	Operand returnValue(lhs.getType());
+
 	// If the types being compared end up being incompatible, the respective get
 	// method on the rhs will raise the error.
 	switch (lhs.getType()) {
@@ -510,13 +505,14 @@ Operand Operand::operator%(const Operand &other) const {
 		return returnValue;
 
 	default:
-		error("Operand::operator/(): Unsupported operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
+		error("Operand::operator/(): Unimplemented operand types %s and %s", operandTypeToStr(lhs.getType()), operandTypeToStr(rhs.getType()));
 	}
 }
 
 Operand Operand::operator-() const {
 	Operand literalValue = getLiteralValue();
 	Operand returnValue(literalValue.getType());
+
 	// If the types being compared end up being incompatible, the respective get
 	// method on the rhs will raise the error.
 	switch (literalValue.getType()) {
@@ -531,7 +527,7 @@ Operand Operand::operator-() const {
 		return returnValue;
 
 	default:
-		error("Operand::operator-(): Unsupported operand type %d", static_cast<uint>(literalValue.getType()));
+		error("Operand::operator-(): Unimplemented operand type %s", operandTypeToStr(literalValue.getType()));
 	}
 }
 
diff --git a/engines/mediastation/mediascript/operand.h b/engines/mediastation/mediascript/operand.h
index f66b49d1916..a9bc9387897 100644
--- a/engines/mediastation/mediascript/operand.h
+++ b/engines/mediastation/mediascript/operand.h
@@ -80,6 +80,10 @@ public:
 	Operand operator-() const;
 
 private:
+	bool isInteger() { return getType() == kOperandTypeLiteral1 || getType() == kOperandTypeLiteral2; };
+	bool isDouble() { return getType() == kOperandTypeFloat1 || getType() == kOperandTypeFloat2; };
+	bool isNumber() { return isInteger() || isDouble(); };
+
 	OperandType _type = kOperandTypeEmpty;
 	union {
 		uint assetId = 0;




More information about the Scummvm-git-logs mailing list