[Scummvm-git-logs] scummvm master -> 11b617e0b16d7c3bd22110f449faaae7a9bb5750

npjg noreply at scummvm.org
Fri Jan 24 01:35:25 UTC 2025


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

Summary:
3b21896aa7 MEDIASTATION: Implement getting integer from variable
ec6db62222 MEDIASTATION: Stub out transition handler based on types
356005f98d MEDIASTATION: Implement releaseContext script method
e7315a2546 MEDIASTATION: Make sure script function calls pass args by reference
04dc801b6c MEDIASTATION: Clarify comment about function IDs
11f9bc5954 MEDIASTATION: Remove useless includes
290bddddea MEDIASTATION: Pass args to child code chunks
e4add0c625 MEDIASTATION: Ensure consistent use of static_cast
c833eb272d MEDIASTATION: Properly load palette when loading context
89bf2e9a11 MEDIASTATION: JANITORIAL: Fix formatting issues
5827b1ddca MEDIASTATION: Get rid of unnecessary intermediate variable
19d44f8a4a MEDIASTATION: Properly set movie frame footers
cdcf77cc30 MEDIASTATION: Add space in human-readable engine name
11b617e0b1 MEDIASTATION: Add highres dependency


Commit: 3b21896aa7cd6450856daf4d90f1f073838c3a31
    https://github.com/scummvm/scummvm/commit/3b21896aa7cd6450856daf4d90f1f073838c3a31
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-23T20:23:39-05:00

Commit Message:
MEDIASTATION: Implement getting integer from variable

Changed paths:
    engines/mediastation/mediascript/scriptconstants.cpp
    engines/mediastation/mediascript/variable.cpp


diff --git a/engines/mediastation/mediascript/scriptconstants.cpp b/engines/mediastation/mediascript/scriptconstants.cpp
index 83ea7ff8593..ce97956daeb 100644
--- a/engines/mediastation/mediascript/scriptconstants.cpp
+++ b/engines/mediastation/mediascript/scriptconstants.cpp
@@ -334,7 +334,7 @@ const char *variableTypeToStr(VariableType type) {
     case kVariableTypeAssetId:
         return "AssetId";
     case kVariableTypeInt:
-        return "Unknown1";
+        return "Int";
     case kVariableTypeUnk2:
         return "Unknown2";
     case kVariableTypeBoolean:
diff --git a/engines/mediastation/mediascript/variable.cpp b/engines/mediastation/mediascript/variable.cpp
index f1b647464d5..2633bf002c0 100644
--- a/engines/mediastation/mediascript/variable.cpp
+++ b/engines/mediastation/mediascript/variable.cpp
@@ -147,6 +147,14 @@ Operand Variable::getValue() {
 		return returnValue;
 	}
 
+	case kVariableTypeInt: {
+		// TODO: Is this value type correct?
+		// Shouldn't matter too much, though, since it's still an integer type.
+		Operand returnValue(kOperandTypeLiteral1);
+		returnValue.putInteger(_value.i);
+		return returnValue;
+	}
+
 	case kVariableTypeFloat: {
 		// TODO: Is this value type correct?
 		// Shouldn't matter too much, though, since it's still a floating-point type.


Commit: ec6db62222d9f4413af67a8bf065541d9061cf67
    https://github.com/scummvm/scummvm/commit/ec6db62222d9f4413af67a8bf065541d9061cf67
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-23T20:23:39-05:00

Commit Message:
MEDIASTATION: Stub out transition handler based on types

Not the argument count heuristics I was relying on before.
The transition handler is also broken out into its own file.

Changed paths:
  A engines/mediastation/transitions.cpp
    engines/mediastation/mediascript/codechunk.cpp
    engines/mediastation/mediascript/codechunk.h
    engines/mediastation/mediascript/scriptconstants.cpp
    engines/mediastation/mediascript/scriptconstants.h
    engines/mediastation/mediastation.cpp
    engines/mediastation/mediastation.h
    engines/mediastation/module.mk


diff --git a/engines/mediastation/mediascript/codechunk.cpp b/engines/mediastation/mediascript/codechunk.cpp
index 38f5382374c..1f996610eb5 100644
--- a/engines/mediastation/mediascript/codechunk.cpp
+++ b/engines/mediastation/mediascript/codechunk.cpp
@@ -96,9 +96,10 @@ Operand CodeChunk::executeNextStatement() {
 				// This is a title-defined function.
 				returnValue = function->execute(args);
 			} else {
+				// This is a function built in (and global to) the engine.
 				BuiltInFunction builtInFunctionId = static_cast<BuiltInFunction>(functionId);
 				debugC(5, kDebugScript, "  Function Name: %s ", builtInFunctionToStr(builtInFunctionId));
-				returnValue = callBuiltInFunction(builtInFunctionId, args);
+				returnValue = g_engine->callBuiltInFunction(builtInFunctionId, args);
 			}
 			return returnValue;
 		}
@@ -341,51 +342,6 @@ void CodeChunk::putVariable(uint32 id, VariableScope scope, Operand value) {
 	}
 }
 
-Operand CodeChunk::callBuiltInFunction(BuiltInFunction id, Common::Array<Operand> &args) {
-	switch (id) {
-	case kEffectTransitionFunction: {
-		switch (args.size()) {
-		// TODO: Discover and handle the different ways
-		// effectTransition can be called.
-		case 1: {
-			//uint dollarSignVariable = args[0].getInteger();
-			break;
-		}
-
-		case 3: {
-			//uint dollarSignVariable = args[0].getInteger();
-			//double percentComplete = args[1].getDouble();
-
-			// TODO: Verify that this is a palette!
-			Asset *asset = args[2].getAsset();
-			g_engine->setPalette(asset);
-			break;
-		}
-
-		default: {
-			error("CodeChunk::callBuiltInFunction(): (BuiltInFunction::effectTransition) Got %d args, which is unexpected", args.size());
-		}
-		}
-
-		warning("CodeChunk::callBuiltInFunction(): effectTransition is not implemented");
-		return Operand();
-		break;
-	}
-
-	case kDrawingFunction: {
-		// Not entirely sure what this function does, but it seems like a way to
-		// call into some drawing functions built into the IBM/Crayola executable.
-		warning("CodeChunk::callBuiltInFunction(): Built-in drawing function not implemented");
-		return Operand();
-		break;
-	}
-
-	default: {
-		error("CodeChunk::callBuiltInFunction(): Got unknown built-in function ID %d", id);
-	}
-	}
-}
-
 Operand CodeChunk::callBuiltInMethod(BuiltInMethod method, Operand self, Common::Array<Operand> &args) {
 	Operand literalSelf = self.getLiteralValue();
 	OperandType literalType = literalSelf.getType();
diff --git a/engines/mediastation/mediascript/codechunk.h b/engines/mediastation/mediascript/codechunk.h
index b87865b76b4..6a4c4be5256 100644
--- a/engines/mediastation/mediascript/codechunk.h
+++ b/engines/mediastation/mediascript/codechunk.h
@@ -40,7 +40,6 @@ public:
 
 private:
 	Operand executeNextStatement();
-	Operand callBuiltInFunction(BuiltInFunction id, Common::Array<Operand> &args);
 	Operand callBuiltInMethod(BuiltInMethod method, Operand self, Common::Array<Operand> &args);
 	Operand getVariable(uint32 id, VariableScope scope);
 	void putVariable(uint32 id, VariableScope scope, Operand value);
diff --git a/engines/mediastation/mediascript/scriptconstants.cpp b/engines/mediastation/mediascript/scriptconstants.cpp
index ce97956daeb..0c2579c4855 100644
--- a/engines/mediastation/mediascript/scriptconstants.cpp
+++ b/engines/mediastation/mediascript/scriptconstants.cpp
@@ -106,6 +106,8 @@ const char *builtInFunctionToStr(BuiltInFunction function) {
     switch (function) {
     case kEffectTransitionFunction:
         return "EffectTransition";
+    case kEffectTransitionOnSyncFunction:
+        return "EffectTransitionOnSync";
     case kDrawingFunction:
         return "Drawing";
     case kDebugPrintFunction:
diff --git a/engines/mediastation/mediascript/scriptconstants.h b/engines/mediastation/mediascript/scriptconstants.h
index 2e690f3e3c8..afaebcecf5b 100644
--- a/engines/mediastation/mediascript/scriptconstants.h
+++ b/engines/mediastation/mediascript/scriptconstants.h
@@ -73,6 +73,7 @@ const char *variableScopeToStr(VariableScope scope);
 enum BuiltInFunction {
 	// TODO: Figure out if effectTransitionOnSync = 13 is consistent across titles?
 	kEffectTransitionFunction = 12, // PARAMS: 1
+	kEffectTransitionOnSyncFunction = 13,
 	kDrawingFunction = 37, // PARAMS: 5
 	// TODO: Figure out if TimeOfDay = 101 is consistent across titles.
 	kDebugPrintFunction = 180, // PARAMS: 1+
diff --git a/engines/mediastation/mediastation.cpp b/engines/mediastation/mediastation.cpp
index d94c75bd0f5..782a9fa440d 100644
--- a/engines/mediastation/mediastation.cpp
+++ b/engines/mediastation/mediastation.cpp
@@ -364,4 +364,26 @@ Asset *MediaStationEngine::findAssetToAcceptMouseEvents(Common::Point point) {
 	return intersectingAsset;
 }
 
+Operand MediaStationEngine::callBuiltInFunction(BuiltInFunction function, Common::Array<Operand> &args) {
+	switch (function) {
+	case kEffectTransitionFunction:
+	case kEffectTransitionOnSyncFunction: {
+		// TODO: effectTransitionOnSync should be split out into its own function.
+		effectTransition(args);
+		return Operand();
+	}
+
+	case kDrawingFunction: {
+		// Not entirely sure what this function does, but it seems like a way to
+		// call into some drawing functions built into the IBM/Crayola executable.
+		warning("MediaStationEngine::callBuiltInFunction(): Built-in drawing function not implemented");
+		return Operand();
+	}
+
+	default: {
+		error("MediaStationEngine::callBuiltInFunction(): Got unknown built-in function %s (%d)", builtInFunctionToStr(function), function);
+	}
+	}
+}
+
 } // End of namespace MediaStation
diff --git a/engines/mediastation/mediastation.h b/engines/mediastation/mediastation.h
index ffda09b0b01..93a2e8846b4 100644
--- a/engines/mediastation/mediastation.h
+++ b/engines/mediastation/mediastation.h
@@ -81,6 +81,7 @@ public:
 	Function *getFunctionById(uint functionId);
 
     Operand callMethod(BuiltInMethod methodId, Common::Array<Operand> &args);
+	Operand callBuiltInFunction(BuiltInFunction function, Common::Array<Operand> &args);
 	Common::HashMap<uint32, Variable *> _variables;
 
 	Graphics::Screen *_screen = nullptr;
@@ -106,6 +107,8 @@ private:
 	void setPaletteFromHeader(AssetHeader *header);
 	void branchToScreen(uint32 contextId);
 	Asset *findAssetToAcceptMouseEvents(Common::Point point);
+
+	void effectTransition(Common::Array<Operand> &args);
 };
 
 extern MediaStationEngine *g_engine;
diff --git a/engines/mediastation/module.mk b/engines/mediastation/module.mk
index 5bc2df1b8bb..de5b968da16 100644
--- a/engines/mediastation/module.mk
+++ b/engines/mediastation/module.mk
@@ -30,7 +30,8 @@ MODULE_OBJS = \
 	mediascript/variable.o \
 	mediastation.o \
 	metaengine.o \
-	subfile.o
+	subfile.o \
+	transitions.o
 
 # This module can be built as a plugin
 ifeq ($(ENABLE_MEDIASTATION), DYNAMIC_PLUGIN)
diff --git a/engines/mediastation/transitions.cpp b/engines/mediastation/transitions.cpp
new file mode 100644
index 00000000000..5f90c97dc50
--- /dev/null
+++ b/engines/mediastation/transitions.cpp
@@ -0,0 +1,93 @@
+/* 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"
+
+namespace MediaStation {
+
+enum TransitionType {
+	kTransitionFadeToBlack = 300,
+	kTransitionFadeToPalette = 301,
+	kTransitionSetToPalette = 302,
+	kTransitionSetToBlack = 303,
+	kTransitionFadeToColor = 304,
+	kTransitionSetToColor = 305,
+	kTransitionSetToPercentOfPalette = 306,
+	kTransitionFadeToPaletteObject = 307,
+	kTransitionSetToPaletteObject = 308,
+	kTransitionSetToPercentOfPaletteObject = 309
+};
+
+void MediaStationEngine::effectTransition(Common::Array<Operand> &args) {
+	TransitionType transitionType = static_cast<TransitionType>(args[0].getInteger());
+	switch (transitionType) {
+	case kTransitionFadeToBlack:
+	case kTransitionSetToBlack: {
+		// TODO: Implement transition.
+		warning("MediaStationEngine::effectTransition(): Fading/setting to black not implemented");
+		break;
+	}
+
+	case kTransitionFadeToPalette:
+	case kTransitionSetToPalette: {
+		// TODO: Implement transition by getting palette out of current context.
+		warning("MediaStationEngine::effectTransition(): Fading/setting to palette not implemented, changing palette immediately");
+		break;
+	}
+
+	case kTransitionFadeToColor:
+	case kTransitionSetToColor: {
+		// TODO: Implement transitions.
+		warning("MediaStationEngine::effectTransition(): Fading/setting to color not implemented");
+		break;
+	}
+
+	case kTransitionFadeToPaletteObject: {
+		// TODO: Implement transition.
+		warning("MediaStationEngine::effectTransition(): Fading to palette object not implemented, changing palette immediately");
+		Asset *asset = args[1].getAsset();
+		g_engine->setPalette(asset);
+		break;
+	}
+
+	case kTransitionSetToPaletteObject: {
+		Asset *asset = args[1].getAsset();
+		g_engine->setPalette(asset);
+		break;
+	}
+
+	case kTransitionSetToPercentOfPaletteObject: {
+		double percentComplete = args[1].getDouble();
+
+		// TODO: Implement percent of palette transition.
+		warning("MediaStationEngine::effectTransition(): Setting to %f%% of palette not implemented, changing palette immediately", percentComplete);
+		Asset *asset = args[2].getAsset();
+		g_engine->setPalette(asset);
+		break;
+	}
+
+	default: {
+		error("MediaStationEngine::effectTransition(): Got unknown transition type %d", static_cast<uint>(transitionType));
+	}
+	}
+}
+
+} // End of namespace MediaStation
\ No newline at end of file


Commit: 356005f98dfa87c5285484f3878ea3676bddc8fe
    https://github.com/scummvm/scummvm/commit/356005f98dfa87c5285484f3878ea3676bddc8fe
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-23T20:23:39-05:00

Commit Message:
MEDIASTATION: Implement releaseContext script method

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


diff --git a/engines/mediastation/mediastation.cpp b/engines/mediastation/mediastation.cpp
index 782a9fa440d..fb9f0bbb802 100644
--- a/engines/mediastation/mediastation.cpp
+++ b/engines/mediastation/mediastation.cpp
@@ -311,6 +311,13 @@ Operand MediaStationEngine::callMethod(BuiltInMethod methodId, Common::Array<Ope
 			return Operand();
 		}
 
+		case kReleaseContextMethod: {
+			assert(args.size() == 1);
+			uint32 contextId = args[0].getAssetId();
+			releaseContext(contextId);
+			return Operand();
+		}
+
 		default: {
 			error("MediaStationEngine::callMethod(): Got unimplemented method ID %d", static_cast<uint>(methodId));
 		}
@@ -334,6 +341,29 @@ void MediaStationEngine::branchToScreen(uint32 contextId) {
 	}
 }
 
+void MediaStationEngine::releaseContext(uint32 contextId) {
+	debugC(5, kDebugScript, "MediaStationEngine::releaseContext(): Releasing context %d", contextId);
+	Context *context = _loadedContexts.getValOrDefault(contextId);
+	if (context == nullptr) {
+		error("MediaStationEngine::releaseContext(): Attempted to unload context %d that is not currently loaded", contextId);
+	}
+
+	// Unload any assets currently playing from this context. They should have
+	// already been stopped by scripts, but this is a last check.
+	for (auto it = _assetsPlaying.begin(); it != _assetsPlaying.end();) {
+		uint assetId = (*it)->getHeader()->_id;
+		Asset *asset = context->getAssetById(assetId);
+		if (asset != nullptr) {
+			it = _assetsPlaying.erase(it);
+		} else {
+			++it;
+		}
+	}
+
+	delete context;
+	_loadedContexts.erase(contextId);
+}
+
 Asset *MediaStationEngine::findAssetToAcceptMouseEvents(Common::Point point) {
 	Asset *intersectingAsset = nullptr;
 	// The z-indices seem to be reversed, so the highest z-index number is
diff --git a/engines/mediastation/mediastation.h b/engines/mediastation/mediastation.h
index 93a2e8846b4..184617ccc4e 100644
--- a/engines/mediastation/mediastation.h
+++ b/engines/mediastation/mediastation.h
@@ -106,6 +106,7 @@ private:
 	Context *loadContext(uint32 contextId);
 	void setPaletteFromHeader(AssetHeader *header);
 	void branchToScreen(uint32 contextId);
+	void releaseContext(uint32 contextId);
 	Asset *findAssetToAcceptMouseEvents(Common::Point point);
 
 	void effectTransition(Common::Array<Operand> &args);


Commit: e7315a2546c6977faefe6a16f10a85cdcd3ad686
    https://github.com/scummvm/scummvm/commit/e7315a2546c6977faefe6a16f10a85cdcd3ad686
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-23T20:23:39-05:00

Commit Message:
MEDIASTATION: Make sure script function calls pass args by reference

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


diff --git a/engines/mediastation/mediascript/function.cpp b/engines/mediastation/mediascript/function.cpp
index 3dc5dd8a868..fef3915850a 100644
--- a/engines/mediastation/mediascript/function.cpp
+++ b/engines/mediastation/mediascript/function.cpp
@@ -38,7 +38,7 @@ Function::~Function() {
 	_code = nullptr;
 }
 
-Operand Function::execute(Common::Array<Operand> args) {
+Operand Function::execute(Common::Array<Operand> &args) {
 	debugC(5, kDebugScript, "\n********** FUNCTION %d **********", _id);
 	Operand returnValue = _code->execute(&args);
 	debugC(5, kDebugScript, "********** END FUNCTION **********");
diff --git a/engines/mediastation/mediascript/function.h b/engines/mediastation/mediascript/function.h
index 70bdeab49fc..f91ddd5390b 100644
--- a/engines/mediastation/mediascript/function.h
+++ b/engines/mediastation/mediascript/function.h
@@ -34,7 +34,7 @@ public:
 	Function(Chunk &chunk);
 	~Function();
 
-	Operand execute(Common::Array<Operand> args);
+	Operand execute(Common::Array<Operand> &args);
 
 	uint _fileId;
 	uint _id;


Commit: 04dc801b6c4963b1b97a90026c552187b667d189
    https://github.com/scummvm/scummvm/commit/04dc801b6c4963b1b97a90026c552187b667d189
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-23T20:23:39-05:00

Commit Message:
MEDIASTATION: Clarify comment about function IDs

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


diff --git a/engines/mediastation/mediascript/function.cpp b/engines/mediastation/mediascript/function.cpp
index fef3915850a..1d77892c0a8 100644
--- a/engines/mediastation/mediascript/function.cpp
+++ b/engines/mediastation/mediascript/function.cpp
@@ -27,7 +27,10 @@ namespace MediaStation {
 
 Function::Function(Chunk &chunk) {
 	_fileId = Datum(chunk).u.i;
-	_id = Datum(chunk).u.i; // + 19900;
+	// In PROFILE._ST (only present in some titles), the function ID is reported
+	// with 19900 added, so function 100 would be reported as 20000. But in
+	// bytecode, the zero-based ID is used, so that's what we'll store here.
+	_id = Datum(chunk).u.i;
 	uint lengthInBytes = Datum(chunk, kDatumTypeUint32_1).u.i;
 	debugC(5, kDebugLoading, "Function::Function(): id = 0x%x, size = 0x%x bytes", _id, lengthInBytes);
 	_code = new CodeChunk(chunk);


Commit: 11f9bc5954586edaeeaeedfb0ba7d207b769697e
    https://github.com/scummvm/scummvm/commit/11f9bc5954586edaeeaeedfb0ba7d207b769697e
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-23T20:23:39-05:00

Commit Message:
MEDIASTATION: Remove useless includes

These were likely left over from the engine
skeleton. And they either aren't used here,
or they are included from `mediastation.h`.
 So they can be removed here.

Changed paths:
    engines/mediastation/mediastation.cpp


diff --git a/engines/mediastation/mediastation.cpp b/engines/mediastation/mediastation.cpp
index fb9f0bbb802..9265d6b0636 100644
--- a/engines/mediastation/mediastation.cpp
+++ b/engines/mediastation/mediastation.cpp
@@ -19,14 +19,8 @@
  *
  */
 
-#include "graphics/framelimiter.h"
-#include "common/scummsys.h"
 #include "common/config-manager.h"
-#include "common/debug-channels.h"
-#include "common/events.h"
-#include "common/system.h"
 #include "engines/util.h"
-#include "graphics/paletteman.h"
 
 #include "mediastation/mediastation.h"
 #include "mediastation/debugchannels.h"


Commit: 290bddddea2187369fef270641e09a3c772d24ac
    https://github.com/scummvm/scummvm/commit/290bddddea2187369fef270641e09a3c772d24ac
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-23T20:23:39-05:00

Commit Message:
MEDIASTATION: Pass args to child code chunks

And fix typo in error that helped discover this
needed to be done.

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


diff --git a/engines/mediastation/mediascript/codechunk.cpp b/engines/mediastation/mediascript/codechunk.cpp
index 1f996610eb5..7de830e1fd1 100644
--- a/engines/mediastation/mediascript/codechunk.cpp
+++ b/engines/mediastation/mediascript/codechunk.cpp
@@ -171,9 +171,9 @@ Operand CodeChunk::executeNextStatement() {
 			if (condition.getInteger()) {
 				// TODO: If locals are modified in here, they won't be
 				// propagated up since it's its own code chunk.
-				ifBlock.execute();
+				ifBlock.execute(_args);
 			} else {
-				elseBlock.execute();
+				elseBlock.execute(_args);
 			}
 
 			// If blocks themselves shouldn't return anything.
@@ -302,7 +302,7 @@ Operand CodeChunk::getVariable(uint32 id, VariableScope scope) {
 	case kVariableScopeParameter: {
 		uint32 index = id - 1;
 		if (_args == nullptr) {
-			error("CodeChunk::getVariable(): Requested a parameter in a code chunk that has no parameters.");
+			error("CodeChunk::getVariable(): Requested a parameter in a code chunk that has no parameters");
 		}
 		return _args->operator[](index);
 		break;


Commit: e4add0c62561f775c30c7c9ee1459c307ff81fa5
    https://github.com/scummvm/scummvm/commit/e4add0c62561f775c30c7c9ee1459c307ff81fa5
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-23T20:23:39-05:00

Commit Message:
MEDIASTATION: Ensure consistent use of static_cast

Changed paths:
    engines/mediastation/assetheader.cpp
    engines/mediastation/assets/movie.cpp
    engines/mediastation/assets/path.cpp
    engines/mediastation/assets/sound.cpp
    engines/mediastation/bitmap.cpp
    engines/mediastation/mediascript/codechunk.cpp
    engines/mediastation/mediascript/variable.cpp


diff --git a/engines/mediastation/assetheader.cpp b/engines/mediastation/assetheader.cpp
index 6c7ac8a1b6a..ad739adaa6b 100644
--- a/engines/mediastation/assetheader.cpp
+++ b/engines/mediastation/assetheader.cpp
@@ -30,7 +30,7 @@ AssetHeader::AssetHeader(Chunk &chunk) {
 	// but they are all pointers so it doesn't matter.
 	_fileNumber = Datum(chunk).u.i;
 	// TODO: Cast to an asset type.
-	_type = AssetType(Datum(chunk).u.i);
+	_type = static_cast<AssetType>(Datum(chunk).u.i);
 	_id = Datum(chunk).u.i;
 	debugC(4, kDebugLoading, "AssetHeader::AssetHeader(): _type = 0x%x, _id = 0x%x (@0x%llx)", static_cast<uint>(_type), _id, static_cast<long long int>(chunk.pos()));
 
@@ -271,7 +271,7 @@ void AssetHeader::readSection(AssetHeaderSectionType sectionType, Chunk& chunk)
 
 	case kAssetHeaderSoundEncoding1:
 	case kAssetHeaderSoundEncoding2: {
-		_soundEncoding = SoundEncoding(Datum(chunk).u.i);
+		_soundEncoding = static_cast<SoundEncoding>(Datum(chunk).u.i);
 		break;
 	}
 
@@ -291,7 +291,10 @@ void AssetHeader::readSection(AssetHeaderSectionType sectionType, Chunk& chunk)
 	}
 
 	case kAssetHeaderStepRate: {
-		_stepRate = (uint32)(Datum(chunk, kDatumTypeFloat64_2).u.f);
+		double _stepRateFloat = Datum(chunk, kDatumTypeFloat64_2).u.f;
+		// This should always be an integer anyway,
+		// so we'll cast away any fractional part.
+		_stepRate = static_cast<uint32>(_stepRateFloat);
 		break;
 	}
 
diff --git a/engines/mediastation/assets/movie.cpp b/engines/mediastation/assets/movie.cpp
index 4000c3a567b..e81f949b7e9 100644
--- a/engines/mediastation/assets/movie.cpp
+++ b/engines/mediastation/assets/movie.cpp
@@ -428,7 +428,7 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
 				break;
 
 			default:
-				error("Sound::readChunk(): Unknown audio encoding 0x%x", (uint)_header->_soundEncoding);
+				error("Movie::readSubfile(): Unknown audio encoding 0x%x", static_cast<uint>(_header->_soundEncoding));
 			}
 			_audioStreams.push_back(stream);
 			chunk = subfile.nextChunk();
diff --git a/engines/mediastation/assets/path.cpp b/engines/mediastation/assets/path.cpp
index 5b8e7c8ad2d..e03f472a7ff 100644
--- a/engines/mediastation/assets/path.cpp
+++ b/engines/mediastation/assets/path.cpp
@@ -38,7 +38,7 @@ Operand Path::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
 
 	case kSetDurationMethod: {
 		assert(args.size() == 1);
-		uint durationInMilliseconds = (uint)(args[0].getDouble() * 1000);
+		uint durationInMilliseconds = static_cast<uint>(args[0].getDouble() * 1000);
 		setDuration(durationInMilliseconds);
 		return Operand();
 	}
diff --git a/engines/mediastation/assets/sound.cpp b/engines/mediastation/assets/sound.cpp
index 32bcb026260..43037a6e1d9 100644
--- a/engines/mediastation/assets/sound.cpp
+++ b/engines/mediastation/assets/sound.cpp
@@ -73,7 +73,7 @@ void Sound::readChunk(Chunk &chunk) {
 	}
 
 	default: {
-		error("Sound::readChunk(): Unknown audio encoding 0x%x", (uint)_encoding);
+		error("Sound::readChunk(): Unknown audio encoding 0x%x", static_cast<uint>(_encoding));
 		break;
 	}
 	}
diff --git a/engines/mediastation/bitmap.cpp b/engines/mediastation/bitmap.cpp
index 66d1836c9b7..dd5ec9e044f 100644
--- a/engines/mediastation/bitmap.cpp
+++ b/engines/mediastation/bitmap.cpp
@@ -29,7 +29,7 @@ BitmapHeader::BitmapHeader(Chunk &chunk) {
 	uint headerSizeInBytes = Datum(chunk, kDatumTypeUint16_1).u.i;
 	debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): headerSize = 0x%x", headerSizeInBytes);
 	_dimensions = Datum(chunk).u.point;
-	_compressionType = BitmapCompressionType(Datum(chunk, kDatumTypeUint16_1).u.i);
+	_compressionType = static_cast<BitmapCompressionType>(Datum(chunk, kDatumTypeUint16_1).u.i);
 	debugC(5, kDebugLoading, "BitmapHeader::BitmapHeader(): _compressionType = 0x%x", static_cast<uint>(_compressionType));
 	// TODO: Figure out what this is.
 	// This has something to do with the width of the bitmap but is always
diff --git a/engines/mediastation/mediascript/codechunk.cpp b/engines/mediastation/mediascript/codechunk.cpp
index 7de830e1fd1..aa1ebd401e8 100644
--- a/engines/mediastation/mediascript/codechunk.cpp
+++ b/engines/mediastation/mediascript/codechunk.cpp
@@ -57,7 +57,7 @@ Operand CodeChunk::executeNextStatement() {
 		error("CodeChunk::executeNextStatement(): Attempt to read past end of bytecode chunk");
 	}
 
-	InstructionType instructionType = InstructionType(Datum(*_bytecode).u.i);
+	InstructionType instructionType = static_cast<InstructionType>(Datum(*_bytecode).u.i);
 	debugCN(5, kDebugScript, "(%s) ", instructionTypeToStr(instructionType));
 	switch (instructionType) {
 	case kInstructionTypeEmpty: {
@@ -65,12 +65,12 @@ Operand CodeChunk::executeNextStatement() {
 	}
 
 	case kInstructionTypeFunctionCall: {
-		Opcode opcode = Opcode(Datum(*_bytecode).u.i);
+		Opcode opcode = static_cast<Opcode>(Datum(*_bytecode).u.i);
 		debugCN(5, kDebugScript, "%s ", opcodeToStr(opcode));
 		switch (opcode) {
 		case kOpcodeAssignVariable: {
 			uint32 id = Datum(*_bytecode).u.i;
-			VariableScope scope = VariableScope(Datum(*_bytecode).u.i);
+			VariableScope scope = static_cast<VariableScope>(Datum(*_bytecode).u.i);
 			debugC(5, kDebugScript, "%d (%s) ", id, variableScopeToStr(scope));
 			debugCN(5, kDebugScript, "  Value: ");
 			Operand newValue = executeNextStatement();
@@ -272,7 +272,7 @@ Operand CodeChunk::executeNextStatement() {
 
 	case kInstructionTypeVariableRef: {
 		uint32 id = Datum(*_bytecode).u.i;
-		VariableScope scope = VariableScope(Datum(*_bytecode).u.i);
+		VariableScope scope = static_cast<VariableScope>(Datum(*_bytecode).u.i);
 		debugC(5, kDebugScript, "Variable %d (%s)", id, variableScopeToStr(scope));
 		Operand variable = getVariable(id, scope);
 		return variable;
diff --git a/engines/mediastation/mediascript/variable.cpp b/engines/mediastation/mediascript/variable.cpp
index 2633bf002c0..afc375eb59f 100644
--- a/engines/mediastation/mediascript/variable.cpp
+++ b/engines/mediastation/mediascript/variable.cpp
@@ -32,7 +32,7 @@ Variable::Variable(Chunk &chunk, bool readId) {
 	if (readId) {
 		_id = Datum(chunk).u.i;
 	}
-	_type = VariableType(Datum(chunk).u.i);
+	_type = static_cast<VariableType>(Datum(chunk).u.i);
 	debugC(5, kDebugLoading, "Variable::Variable(): id = 0x%x, type %s (%d) (@0x%llx)", 
 		_id, variableTypeToStr(_type), static_cast<uint>(_type), static_cast<long long int>(chunk.pos()));
 	switch ((VariableType)_type) {


Commit: c833eb272d82d10b562b6333f0032fc5f74bde6a
    https://github.com/scummvm/scummvm/commit/c833eb272d82d10b562b6333f0032fc5f74bde6a
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-23T20:23:39-05:00

Commit Message:
MEDIASTATION: Properly load palette when loading context

Changed paths:
    engines/mediastation/mediastation.cpp


diff --git a/engines/mediastation/mediastation.cpp b/engines/mediastation/mediastation.cpp
index 9265d6b0636..e2226ab24ac 100644
--- a/engines/mediastation/mediastation.cpp
+++ b/engines/mediastation/mediastation.cpp
@@ -267,6 +267,14 @@ Context *MediaStationEngine::loadContext(uint32 contextId) {
 	// LOAD THE CONTEXT.
 	Common::Path entryCxtFilepath = Common::Path(*fileName);
 	Context *context = new Context(entryCxtFilepath);
+
+	// Some contexts have a built-in palette that becomes active when the
+	// context is loaded, and some rely on scripts to set
+	// the palette later.
+	if (context->_palette != nullptr) {
+		_screen->setPalette(*context->_palette);
+	}
+
 	_loadedContexts.setVal(contextId, context);
 	return context;
 }
@@ -321,8 +329,6 @@ Operand MediaStationEngine::callMethod(BuiltInMethod methodId, Common::Array<Ope
 void MediaStationEngine::branchToScreen(uint32 contextId) {
 	Context *context = loadContext(contextId);
 	if (context->_screenAsset != nullptr) {
-		setPaletteFromHeader(context->_screenAsset);
-		
 		// TODO: Make the screen an asset just like everything else so we can
 		// run event handlers with runEventHandlerIfExists.
 		EventHandler *entryEvent = context->_screenAsset->_eventHandlers.getValOrDefault(MediaStation::kEntryEvent);


Commit: 89bf2e9a117ffca64b9cd3be054307d6af36375c
    https://github.com/scummvm/scummvm/commit/89bf2e9a117ffca64b9cd3be054307d6af36375c
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-23T20:23:39-05:00

Commit Message:
MEDIASTATION: JANITORIAL: Fix formatting issues

These seem to have crept into new files where the
editor was not correctly configured :(

Changed paths:
    engines/mediastation/assetheader.h
    engines/mediastation/assets/font.cpp
    engines/mediastation/assets/font.h
    engines/mediastation/assets/movie.cpp
    engines/mediastation/assets/text.cpp
    engines/mediastation/assets/text.h
    engines/mediastation/boot.cpp
    engines/mediastation/boot.h
    engines/mediastation/context.cpp
    engines/mediastation/mediascript/scriptconstants.cpp
    engines/mediastation/mediascript/scriptconstants.h
    engines/mediastation/mediastation.cpp
    engines/mediastation/mediastation.h


diff --git a/engines/mediastation/assetheader.h b/engines/mediastation/assetheader.h
index 4f0b2713840..f3fb3f652bd 100644
--- a/engines/mediastation/assetheader.h
+++ b/engines/mediastation/assetheader.h
@@ -64,7 +64,7 @@ enum AssetType {
 	kAssetTypeCanvas = 0x001e, // CVS
 	// TODO: Discover how the XSND differs from regular sounds.
 	// Only appears in Ariel.
-	kAssetTypeXsnd= 0x001f,
+	kAssetTypeXsnd = 0x001f,
 	kAssetTypeXsndMidi = 0x0020,
 	// TODO: Figure out what this is. Only appears in Ariel.
 	kAssetTypeRecorder = 0x0021,
@@ -135,20 +135,20 @@ enum AssetHeaderSectionType {
 };
 
 enum TextJustification {
-    kTextJustificationLeft = 0x25c,
-    kTextJustificationRight = 0x25d,
-    kTextJustificationCenter = 0x25e
+	kTextJustificationLeft = 0x25c,
+	kTextJustificationRight = 0x25d,
+	kTextJustificationCenter = 0x25e
 };
 
 enum TextPosition {
-    kTextPositionMiddle = 0x25e,
-    kTextPositionTop = 0x260,
-    kTextPositionBotom = 0x261
+	kTextPositionMiddle = 0x25e,
+	kTextPositionTop = 0x260,
+	kTextPositionBotom = 0x261
 };
 
 struct CharacterClass {
-    uint firstAsciiCode = 0;
-    uint lastAsciiCode = 0;
+	uint firstAsciiCode = 0;
+	uint lastAsciiCode = 0;
 };
 
 enum SoundEncoding {
@@ -205,12 +205,12 @@ public:
 	Common::Array<EventHandler *> _loadCompleteHandlers;
 
 	// TEXT FIELDS.
-    Common::String *_text = nullptr;
-    uint _maxTextLength = 0;
-    uint _fontAssetId = 0;
-    TextJustification _justification;
-    TextPosition _position;
-    Common::Array<CharacterClass> _acceptedInput;
+	Common::String *_text = nullptr;
+	uint _maxTextLength = 0;
+	uint _fontAssetId = 0;
+	TextJustification _justification;
+	TextPosition _position;
+	Common::Array<CharacterClass> _acceptedInput;
 
 private:
 	void readSection(AssetHeaderSectionType sectionType, Chunk &chunk);
diff --git a/engines/mediastation/assets/font.cpp b/engines/mediastation/assets/font.cpp
index b4ebc531ce2..e14caf6f8aa 100644
--- a/engines/mediastation/assets/font.cpp
+++ b/engines/mediastation/assets/font.cpp
@@ -25,32 +25,32 @@
 namespace MediaStation {
 
 FontGlyph::FontGlyph(Chunk &chunk, uint asciiCode, uint unk1, uint unk2, BitmapHeader *header) : Bitmap(chunk, header) {
-    _asciiCode = asciiCode;
-    _unk1 = unk1;
-    _unk2 = unk2;
+	_asciiCode = asciiCode;
+	_unk1 = unk1;
+	_unk2 = unk2;
 }
 
 Font::~Font() {
-    for (auto it = _glyphs.begin(); it != _glyphs.end(); ++it) {
-        delete it->_value;
-    }
-    _glyphs.clear();
+	for (auto it = _glyphs.begin(); it != _glyphs.end(); ++it) {
+		delete it->_value;
+	}
+	_glyphs.clear();
 }
 
 Operand Font::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
-    error("Font::callMethod(): Font does not have any callable methods");
+	error("Font::callMethod(): Font does not have any callable methods");
 }
 
 void Font::readChunk(Chunk &chunk) {
 	debugC(5, kDebugLoading, "Font::readChunk(): Reading font glyph (@0x%llx)", static_cast<long long int>(chunk.pos()));
-    uint asciiCode = Datum(chunk).u.i;
-    int unk1 = Datum(chunk).u.i;
-    int unk2 = Datum(chunk).u.i;
+	uint asciiCode = Datum(chunk).u.i;
+	int unk1 = Datum(chunk).u.i;
+	int unk2 = Datum(chunk).u.i;
 	BitmapHeader *header = new BitmapHeader(chunk);
 	FontGlyph *glyph = new FontGlyph(chunk, asciiCode, unk1, unk2, header);
-    if (_glyphs.getValOrDefault(asciiCode) != nullptr) {
-        error("Font::readChunk(): Glyph for ASCII code 0x%x already exists", asciiCode);
-    }
+	if (_glyphs.getValOrDefault(asciiCode) != nullptr) {
+		error("Font::readChunk(): Glyph for ASCII code 0x%x already exists", asciiCode);
+	}
 	_glyphs.setVal(asciiCode, glyph);
 }
 
diff --git a/engines/mediastation/assets/font.h b/engines/mediastation/assets/font.h
index 246be1b7484..2b084fd0bff 100644
--- a/engines/mediastation/assets/font.h
+++ b/engines/mediastation/assets/font.h
@@ -34,11 +34,11 @@ namespace MediaStation {
 class FontGlyph : public Bitmap {
 public:
 	FontGlyph(Chunk &chunk, uint asciiCode, uint unk1, uint unk2, BitmapHeader *header);
-    uint _asciiCode = 0;
+	uint _asciiCode = 0;
 
 private:
-    int _unk1 = 0;
-    int _unk2 = 0;
+	int _unk1 = 0;
+	int _unk2 = 0;
 };
 
 class Font : public Asset {
@@ -54,7 +54,7 @@ private:
 	Common::HashMap<uint, FontGlyph *> _glyphs;
 
 	// Method implementations.
-    // No methods are implemented as of now.
+	// No methods are implemented as of now.
 };
 
 } // End of namespace MediaStation
diff --git a/engines/mediastation/assets/movie.cpp b/engines/mediastation/assets/movie.cpp
index e81f949b7e9..71d48d2174f 100644
--- a/engines/mediastation/assets/movie.cpp
+++ b/engines/mediastation/assets/movie.cpp
@@ -154,7 +154,7 @@ uint32 MovieFrame::keyframeEndInMilliseconds() {
 }
 
 MovieFrame::~MovieFrame() {
-	// The base class destructor takes care of deleting the bitmap header, so 
+	// The base class destructor takes care of deleting the bitmap header, so
 	// we don't need to delete that here.
 	delete _footer;
 	_footer = nullptr;
@@ -272,7 +272,7 @@ bool Movie::drawNextFrame() {
 	// TODO: We'll need to support persistent frames in movies too. Do movies
 	// have the same distinction between spatialShow and timePlay that sprites
 	// do?
-	
+
 	uint currentTime = g_system->getMillis();
 	uint movieTime = currentTime - _startTime;
 	debugC(5, kDebugGraphics, "GRAPHICS (Movie %d): Starting blitting (movie time: %d)", _header->_id, movieTime);
diff --git a/engines/mediastation/assets/text.cpp b/engines/mediastation/assets/text.cpp
index bfdc51b1855..86c29863760 100644
--- a/engines/mediastation/assets/text.cpp
+++ b/engines/mediastation/assets/text.cpp
@@ -24,43 +24,43 @@
 namespace MediaStation {
 
 Operand Text::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
-    switch (methodId) {
-    case kTextMethod: {
-        assert(args.empty());
-        error("Text::callMethod(): Text() method not implemented yet");
-    }
+	switch (methodId) {
+	case kTextMethod: {
+		assert(args.empty());
+		error("Text::callMethod(): Text() method not implemented yet");
+	}
 
-    case kSetTextMethod: {
-        assert(args.size() == 1);
-        error("Text::callMethod(): getText() method not implemented yet");
-    }
+	case kSetTextMethod: {
+		assert(args.size() == 1);
+		error("Text::callMethod(): getText() method not implemented yet");
+	}
 
-    case kSpatialShowMethod: {
-        assert(args.empty());
-        _isActive = true;
-        warning("Text::callMethod(): spatialShow method not implemented yet");
-        return Operand();
-    }
+	case kSpatialShowMethod: {
+		assert(args.empty());
+		_isActive = true;
+		warning("Text::callMethod(): spatialShow method not implemented yet");
+		return Operand();
+	}
 
-    case kSpatialHideMethod: {
-        assert(args.empty());
-        _isActive = false;
-        warning("Text::callMethod(): spatialHide method not implemented yet");
-        return Operand();
-    }
+	case kSpatialHideMethod: {
+		assert(args.empty());
+		_isActive = false;
+		warning("Text::callMethod(): spatialHide method not implemented yet");
+		return Operand();
+	}
 
-    default: {
-        error("Got unimplemented method ID %d", methodId);
-    }
-    }
+	default: {
+		error("Got unimplemented method ID %d", methodId);
+	}
+	}
 }
 
 Common::String *Text::text() const {
-    return _header->_text;
+	return _header->_text;
 }
 
 void Text::setText(Common::String *text) {
-    error("Text::setText(): Setting text not implemented yet");
+	error("Text::setText(): Setting text not implemented yet");
 }
 
 } // End of namespace MediaStation
diff --git a/engines/mediastation/assets/text.h b/engines/mediastation/assets/text.h
index 4a96b13aad1..3eabe279fc1 100644
--- a/engines/mediastation/assets/text.h
+++ b/engines/mediastation/assets/text.h
@@ -39,8 +39,8 @@ public:
 
 private:
 	// Method implementations.
-    Common::String *text() const;
-    void setText(Common::String *text);
+	Common::String *text() const;
+	void setText(Common::String *text);
 };
 
 } // End of namespace MediaStation
diff --git a/engines/mediastation/boot.cpp b/engines/mediastation/boot.cpp
index 1301ba77c7f..2a08337e7ce 100644
--- a/engines/mediastation/boot.cpp
+++ b/engines/mediastation/boot.cpp
@@ -75,7 +75,7 @@ ContextDeclaration::ContextDeclaration(Chunk &chunk) {
 			uint32 repeatedFileNumber = Datum(chunk).u.i;
 			if (repeatedFileNumber != _fileNumber) {
 				warning("ContextDeclaration(): Expected file numbers to match, but 0x%d != 0x%d", _fileNumber, repeatedFileNumber);
-			} 	
+			}
 		} else {
 			error("ContextDeclaration(): Expected section type FILE_NUMBER_2, got 0x%x", static_cast<uint>(sectionType));
 		}
diff --git a/engines/mediastation/boot.h b/engines/mediastation/boot.h
index b74fe001226..afec01c6b8f 100644
--- a/engines/mediastation/boot.h
+++ b/engines/mediastation/boot.h
@@ -105,13 +105,13 @@ enum FileDeclarationSectionType {
 // Indicates where a file is intended to be stored.
 // NOTE: This might not be correct and this might be a more general "file type".
 enum IntendedFileLocation {
-    // Usually all files that have numbers remain on the CD-ROM.
-    kFileIntendedOnCdRom = 0x0007,
-    // These UNKs only appear in George Shrinks.
-    kFileIntendedForUnk1 = 0x0008,
-    kFileIntendedForUnk2 = 0x0009,
-    // Usually only INSTALL.CXT is copied to the hard disk.
-    kFileIntendedOnHardDisk = 0x000b
+	// Usually all files that have numbers remain on the CD-ROM.
+	kFileIntendedOnCdRom = 0x0007,
+	// These UNKs only appear in George Shrinks.
+	kFileIntendedForUnk1 = 0x0008,
+	kFileIntendedForUnk2 = 0x0009,
+	// Usually only INSTALL.CXT is copied to the hard disk.
+	kFileIntendedOnHardDisk = 0x000b
 };
 
 class FileDeclaration {
diff --git a/engines/mediastation/context.cpp b/engines/mediastation/context.cpp
index c36f2e6bc71..845b9baf531 100644
--- a/engines/mediastation/context.cpp
+++ b/engines/mediastation/context.cpp
@@ -275,7 +275,7 @@ bool Context::readHeaderSection(Subfile &subfile, Chunk &chunk) {
 			_screenAsset = header;
 			break;
 
-		case kAssetTypeFont: 
+		case kAssetTypeFont:
 			asset = new Font(header);
 			break;
 
diff --git a/engines/mediastation/mediascript/scriptconstants.cpp b/engines/mediastation/mediascript/scriptconstants.cpp
index 0c2579c4855..3a88cf20ce7 100644
--- a/engines/mediastation/mediascript/scriptconstants.cpp
+++ b/engines/mediastation/mediascript/scriptconstants.cpp
@@ -24,328 +24,328 @@
 namespace MediaStation {
 
 const char *instructionTypeToStr(InstructionType type) {
-    switch (type) {
-    case kInstructionTypeEmpty:
-        return "Empty";
-    case kInstructionTypeFunctionCall:
-        return "FunctionCall";
-    case kInstructionTypeOperand:
-        return "Operand";
-    case kInstructionTypeVariableRef:
-        return "VariableReference";
-    default:
-        return "UNKNOWN";
-    }
+	switch (type) {
+	case kInstructionTypeEmpty:
+		return "Empty";
+	case kInstructionTypeFunctionCall:
+		return "FunctionCall";
+	case kInstructionTypeOperand:
+		return "Operand";
+	case kInstructionTypeVariableRef:
+		return "VariableReference";
+	default:
+		return "UNKNOWN";
+	}
 }
 
 const char *opcodeToStr(Opcode opcode) {
-    switch (opcode) {
-    case kOpcodeIfElse:
-        return "IfElse";
-    case kOpcodeAssignVariable:
-        return "AssignVariable";
-    case kOpcodeOr:
-        return "Or";
-    case kOpcodeAnd:
-        return "And";
-    case kOpcodeEquals:
-        return "==";
-    case kOpcodeNotEquals:
-        return "!=";
-    case kOpcodeLessThan:
-        return "<";
-    case kOpcodeGreaterThan:
-        return ">";
-    case kOpcodeLessThanOrEqualTo:
-        return "<=";
-    case kOpcodeGreaterThanOrEqualTo:
-        return ">=";
-    case kOpcodeAdd:
-        return "+";
-    case kOpcodeSubtract:
-        return "-";
-    case kOpcodeMultiply:
-        return "*";
-    case kOpcodeDivide:
-        return "/";
-    case kOpcodeModulo:
-        return "%";
-    case kOpcodeNegate:
-        return "-";
-    case kOpcodeCallRoutine:
-        return "CallRoutine";
-    case kOpcodeCallMethod:
-        return "CallMethod";
-    case kOpcodeDeclareVariables:
-        return "DeclareVariables";
-    case kOpcodeReturn:
-        return "Return";
-    case kOpcodeUnk1:
-        return "UNKNOWN (Unk1)";
-    case kOpcodeWhile:
-        return "While";
-    default:
-        return "UNKNOWN";
-    }
+	switch (opcode) {
+	case kOpcodeIfElse:
+		return "IfElse";
+	case kOpcodeAssignVariable:
+		return "AssignVariable";
+	case kOpcodeOr:
+		return "Or";
+	case kOpcodeAnd:
+		return "And";
+	case kOpcodeEquals:
+		return "==";
+	case kOpcodeNotEquals:
+		return "!=";
+	case kOpcodeLessThan:
+		return "<";
+	case kOpcodeGreaterThan:
+		return ">";
+	case kOpcodeLessThanOrEqualTo:
+		return "<=";
+	case kOpcodeGreaterThanOrEqualTo:
+		return ">=";
+	case kOpcodeAdd:
+		return "+";
+	case kOpcodeSubtract:
+		return "-";
+	case kOpcodeMultiply:
+		return "*";
+	case kOpcodeDivide:
+		return "/";
+	case kOpcodeModulo:
+		return "%";
+	case kOpcodeNegate:
+		return "-";
+	case kOpcodeCallRoutine:
+		return "CallRoutine";
+	case kOpcodeCallMethod:
+		return "CallMethod";
+	case kOpcodeDeclareVariables:
+		return "DeclareVariables";
+	case kOpcodeReturn:
+		return "Return";
+	case kOpcodeUnk1:
+		return "UNKNOWN (Unk1)";
+	case kOpcodeWhile:
+		return "While";
+	default:
+		return "UNKNOWN";
+	}
 }
 
 const char *variableScopeToStr(VariableScope scope) {
-    switch (scope) {
-    case kVariableScopeLocal:
-        return "Local";
-    case kVariableScopeParameter:
-        return "Parameter";
-    case kVariableScopeGlobal:
-        return "Global";
-    default:
-        return "UNKNOWN";
-    }
+	switch (scope) {
+	case kVariableScopeLocal:
+		return "Local";
+	case kVariableScopeParameter:
+		return "Parameter";
+	case kVariableScopeGlobal:
+		return "Global";
+	default:
+		return "UNKNOWN";
+	}
 }
 
 const char *builtInFunctionToStr(BuiltInFunction function) {
-    switch (function) {
-    case kEffectTransitionFunction:
-        return "EffectTransition";
-    case kEffectTransitionOnSyncFunction:
-        return "EffectTransitionOnSync";
-    case kDrawingFunction:
-        return "Drawing";
-    case kDebugPrintFunction:
-        return "DebugPrint";
-    default:
-        return "UNKNOWN";
-    }
+	switch (function) {
+	case kEffectTransitionFunction:
+		return "EffectTransition";
+	case kEffectTransitionOnSyncFunction:
+		return "EffectTransitionOnSync";
+	case kDrawingFunction:
+		return "Drawing";
+	case kDebugPrintFunction:
+		return "DebugPrint";
+	default:
+		return "UNKNOWN";
+	}
 }
 
 const char *builtInMethodToStr(BuiltInMethod method) {
-    switch (method) {
-    case kCursorSetMethod:
-        return "CursorSet";
-    case kSpatialHideMethod:
-        return "SpatialHide";
-    case kSpatialMoveToMethod:
-        return "SpatialMoveTo";
-    case kSpatialZMoveToMethod:
-        return "SpatialZMoveTo";
-    case kSpatialShowMethod:
-        return "SpatialShow";
-    case kTimePlayMethod:
-        return "TimePlay";
-    case kTimeStopMethod:
-        return "TimeStop";
-    case kIsPlayingMethod:
-        return "IsPlaying";
-    case kSetDissolveFactorMethod:
-        return "SetDissolveFactor";
-    case kMouseActivateMethod:
-        return "MouseActivate";
-    case kMouseDeactivateMethod:
-        return "MouseDeactivate";
-    case kXPositionMethod:
-        return "XPosition";
-    case kYPositionMethod:
-        return "YPosition";
-    case kTriggerAbsXPositionMethod:
-        return "TriggerAbsXPosition";
-    case kTriggerAbsYPositionMethod:
-        return "TriggerAbsYPosition";
-    case kIsActiveMethod:
-        return "IsActive";
-    case kWidthMethod:
-        return "Width";
-    case kHeightMethod:
-        return "Height";
-    case kIsVisibleMethod:
-        return "IsVisible";
-    case kMovieResetMethod:
-        return "MovieReset";
-    case kSetWorldSpaceExtentMethod:
-        return "SetWorldSpaceExtent";
-    case kSetBoundsMethod:
-        return "SetBounds";
-    case kStopPanMethod:
-        return "StopPan";
-    case kViewportMoveToMethod:
-        return "ViewportMoveTo";
-    case kYViewportPositionMethod:
-        return "YViewportPosition";
-    case kPanToMethod:
-        return "PanTo";
-    case kClearToPaletteMethod:
-        return "ClearToPalette";
-    case kLoadContextMethod:
-        return "LoadContext";
-    case kReleaseContextMethod:
-        return "ReleaseContext";
-    case kBranchToScreenMethod:
-        return "BranchToScreen";
-    case kIsLoadedMethod:
-        return "IsLoaded";
-    case kSetDurationMethod:
-        return "SetDuration";
-    case kPercentCompleteMethod:
-        return "PercentComplete";
-    case kTextMethod:
-        return "Text";
-    case kSetTextMethod:
-        return "SetText";
-    case kSetMaximumTextLengthMethod:
-        return "SetMaximumTextLength";
-    case kIsEmptyMethod:
-        return "IsEmpty";
-    case kEmptyMethod:
-        return "Empty";
-    case kAppendMethod:
-        return "Append";
-    case kGetAtMethod:
-        return "GetAt";
-    case kCountMethod:
-        return "Count";
-    case kSendMethod:
-        return "Send";
-    case kSeekMethod:
-        return "Seek";
-    case kSortMethod:
-        return "Sort";
-    case kDeleteAtMethod:
-        return "DeleteAt";
-    case kOpenLensMethod:
-        return "OpenLens";
-    case kCloseLensMethod:
-        return "CloseLens";
-    default:
-        return "UNKNOWN";
-    }
+	switch (method) {
+	case kCursorSetMethod:
+		return "CursorSet";
+	case kSpatialHideMethod:
+		return "SpatialHide";
+	case kSpatialMoveToMethod:
+		return "SpatialMoveTo";
+	case kSpatialZMoveToMethod:
+		return "SpatialZMoveTo";
+	case kSpatialShowMethod:
+		return "SpatialShow";
+	case kTimePlayMethod:
+		return "TimePlay";
+	case kTimeStopMethod:
+		return "TimeStop";
+	case kIsPlayingMethod:
+		return "IsPlaying";
+	case kSetDissolveFactorMethod:
+		return "SetDissolveFactor";
+	case kMouseActivateMethod:
+		return "MouseActivate";
+	case kMouseDeactivateMethod:
+		return "MouseDeactivate";
+	case kXPositionMethod:
+		return "XPosition";
+	case kYPositionMethod:
+		return "YPosition";
+	case kTriggerAbsXPositionMethod:
+		return "TriggerAbsXPosition";
+	case kTriggerAbsYPositionMethod:
+		return "TriggerAbsYPosition";
+	case kIsActiveMethod:
+		return "IsActive";
+	case kWidthMethod:
+		return "Width";
+	case kHeightMethod:
+		return "Height";
+	case kIsVisibleMethod:
+		return "IsVisible";
+	case kMovieResetMethod:
+		return "MovieReset";
+	case kSetWorldSpaceExtentMethod:
+		return "SetWorldSpaceExtent";
+	case kSetBoundsMethod:
+		return "SetBounds";
+	case kStopPanMethod:
+		return "StopPan";
+	case kViewportMoveToMethod:
+		return "ViewportMoveTo";
+	case kYViewportPositionMethod:
+		return "YViewportPosition";
+	case kPanToMethod:
+		return "PanTo";
+	case kClearToPaletteMethod:
+		return "ClearToPalette";
+	case kLoadContextMethod:
+		return "LoadContext";
+	case kReleaseContextMethod:
+		return "ReleaseContext";
+	case kBranchToScreenMethod:
+		return "BranchToScreen";
+	case kIsLoadedMethod:
+		return "IsLoaded";
+	case kSetDurationMethod:
+		return "SetDuration";
+	case kPercentCompleteMethod:
+		return "PercentComplete";
+	case kTextMethod:
+		return "Text";
+	case kSetTextMethod:
+		return "SetText";
+	case kSetMaximumTextLengthMethod:
+		return "SetMaximumTextLength";
+	case kIsEmptyMethod:
+		return "IsEmpty";
+	case kEmptyMethod:
+		return "Empty";
+	case kAppendMethod:
+		return "Append";
+	case kGetAtMethod:
+		return "GetAt";
+	case kCountMethod:
+		return "Count";
+	case kSendMethod:
+		return "Send";
+	case kSeekMethod:
+		return "Seek";
+	case kSortMethod:
+		return "Sort";
+	case kDeleteAtMethod:
+		return "DeleteAt";
+	case kOpenLensMethod:
+		return "OpenLens";
+	case kCloseLensMethod:
+		return "CloseLens";
+	default:
+		return "UNKNOWN";
+	}
 }
 
 const char *eventTypeToStr(EventType type) {
-    switch (type) {
-    case kTimerEvent:
-        return "Timer";
-    case kMouseDownEvent:
-        return "MouseDown";
-    case kMouseUpEvent:
-        return "MouseUp";
-    case kMouseMovedEvent:
-        return "MouseMoved";
-    case kMouseEnteredEvent:
-        return "MouseEntered";
-    case kMouseExitedEvent:
-        return "MouseExited";
-    case kKeyDownEvent:
-        return "KeyDown";
-    case kSoundEndEvent:
-        return "SoundEnd";
-    case kSoundAbortEvent:
-        return "SoundAbort";
-    case kSoundFailureEvent:
-        return "SoundFailure";
-    case kSoundStoppedEvent:
-        return "SoundStopped";
-    case kSoundBeginEvent:
-        return "SoundBegin";
-    case kMovieEndEvent:
-        return "MovieEnd";
-    case kMovieAbortEvent:
-        return "MovieAbort";
-    case kMovieFailureEvent:
-        return "MovieFailure";
-    case kMovieStoppedEvent:
-        return "MovieStopped";
-    case kMovieBeginEvent:
-        return "MovieBegin";
-    case kSpriteMovieEndEvent:
-        return "SpriteMovieEnd";
-    case kEntryEvent:
-        return "EntryEvent";
-    case kExitEvent:
-        return "ExitEvent";
-    case kLoadCompleteEvent:
-        return "LoadComplete";
-    case kInputEvent:
-        return "Input";
-    case kErrorEvent:
-        return "Error";
-    case kPanAbortEvent:
-        return "PanAbort";
-    case kPanEndEvent:
-        return "PanEnd";
-    case kStepEvent:
-        return "StepEvent";
-    case kPathStoppedEvent:
-        return "PathStopped";
-    case kPathEndEvent:
-        return "PathEnd";
-    default:
-        return "UNKNOWN";
-    }
+	switch (type) {
+	case kTimerEvent:
+		return "Timer";
+	case kMouseDownEvent:
+		return "MouseDown";
+	case kMouseUpEvent:
+		return "MouseUp";
+	case kMouseMovedEvent:
+		return "MouseMoved";
+	case kMouseEnteredEvent:
+		return "MouseEntered";
+	case kMouseExitedEvent:
+		return "MouseExited";
+	case kKeyDownEvent:
+		return "KeyDown";
+	case kSoundEndEvent:
+		return "SoundEnd";
+	case kSoundAbortEvent:
+		return "SoundAbort";
+	case kSoundFailureEvent:
+		return "SoundFailure";
+	case kSoundStoppedEvent:
+		return "SoundStopped";
+	case kSoundBeginEvent:
+		return "SoundBegin";
+	case kMovieEndEvent:
+		return "MovieEnd";
+	case kMovieAbortEvent:
+		return "MovieAbort";
+	case kMovieFailureEvent:
+		return "MovieFailure";
+	case kMovieStoppedEvent:
+		return "MovieStopped";
+	case kMovieBeginEvent:
+		return "MovieBegin";
+	case kSpriteMovieEndEvent:
+		return "SpriteMovieEnd";
+	case kEntryEvent:
+		return "EntryEvent";
+	case kExitEvent:
+		return "ExitEvent";
+	case kLoadCompleteEvent:
+		return "LoadComplete";
+	case kInputEvent:
+		return "Input";
+	case kErrorEvent:
+		return "Error";
+	case kPanAbortEvent:
+		return "PanAbort";
+	case kPanEndEvent:
+		return "PanEnd";
+	case kStepEvent:
+		return "StepEvent";
+	case kPathStoppedEvent:
+		return "PathStopped";
+	case kPathEndEvent:
+		return "PathEnd";
+	default:
+		return "UNKNOWN";
+	}
 }
 
 const char *eventHandlerArgumentTypeToStr(EventHandlerArgumentType type) {
-    switch (type) {
-    case kNullEventHandlerArgument:
-        return "Null";
-    case kAsciiCodeEventHandlerArgument:
-        return "AsciiCode";
-    case kTimeEventHandlerArgument:
-        return "Time";
-    case kUnk1EventHandlerArgument:
-        return "Unk1";
-    case kContextEventHandlerArgument:
-        return "Context";
-    default: 
-        return "UNKNOWN";
-    }
+	switch (type) {
+	case kNullEventHandlerArgument:
+		return "Null";
+	case kAsciiCodeEventHandlerArgument:
+		return "AsciiCode";
+	case kTimeEventHandlerArgument:
+		return "Time";
+	case kUnk1EventHandlerArgument:
+		return "Unk1";
+	case kContextEventHandlerArgument:
+		return "Context";
+	default:
+		return "UNKNOWN";
+	}
 }
 
 const char *operandTypeToStr(OperandType type) {
-    switch (type) {
-    case kOperandTypeEmpty:
-        return "Empty";
-    case kOperandTypeLiteral1:
-        return "Literal1";
-    case kOperandTypeLiteral2:
-        return "Literal2";
-    case kOperandTypeFloat1:
-        return "Float1";
-    case kOperandTypeFloat2:
-        return "Float2";
-    case kOperandTypeString:
-        return "String";
-    case kOperandTypeDollarSignVariable:
-        return "DollarSignVariable";
-    case kOperandTypeAssetId:
-        return "AssetId";
-    case kOperandTypeVariableDeclaration:
-        return "VariableDeclaration";
-    case kOperandTypeFunction:
-        return "Function";
-    default:
-        return "UNKNOWN";
-    }
+	switch (type) {
+	case kOperandTypeEmpty:
+		return "Empty";
+	case kOperandTypeLiteral1:
+		return "Literal1";
+	case kOperandTypeLiteral2:
+		return "Literal2";
+	case kOperandTypeFloat1:
+		return "Float1";
+	case kOperandTypeFloat2:
+		return "Float2";
+	case kOperandTypeString:
+		return "String";
+	case kOperandTypeDollarSignVariable:
+		return "DollarSignVariable";
+	case kOperandTypeAssetId:
+		return "AssetId";
+	case kOperandTypeVariableDeclaration:
+		return "VariableDeclaration";
+	case kOperandTypeFunction:
+		return "Function";
+	default:
+		return "UNKNOWN";
+	}
 }
 
 const char *variableTypeToStr(VariableType type) {
-    switch (type) {
-    case kVariableTypeEmpty:
-        return "Empty";
-    case kVariableTypeCollection:
-        return "Collection";
-    case kVariableTypeString:
-        return "String";
-    case kVariableTypeAssetId:
-        return "AssetId";
-    case kVariableTypeInt:
-        return "Int";
-    case kVariableTypeUnk2:
-        return "Unknown2";
-    case kVariableTypeBoolean:
-        return "Boolean";
-    case kVariableTypeFloat:
-        return "Literal";
-    default:
-        return "UNKNOWN";
-    }
+	switch (type) {
+	case kVariableTypeEmpty:
+		return "Empty";
+	case kVariableTypeCollection:
+		return "Collection";
+	case kVariableTypeString:
+		return "String";
+	case kVariableTypeAssetId:
+		return "AssetId";
+	case kVariableTypeInt:
+		return "Int";
+	case kVariableTypeUnk2:
+		return "Unknown2";
+	case kVariableTypeBoolean:
+		return "Boolean";
+	case kVariableTypeFloat:
+		return "Literal";
+	default:
+		return "UNKNOWN";
+	}
 }
 
 } // End of namespace MediaStation
diff --git a/engines/mediastation/mediascript/scriptconstants.h b/engines/mediastation/mediascript/scriptconstants.h
index afaebcecf5b..afe0c5ffd39 100644
--- a/engines/mediastation/mediascript/scriptconstants.h
+++ b/engines/mediastation/mediascript/scriptconstants.h
@@ -164,66 +164,66 @@ enum BuiltInMethod {
 const char *builtInMethodToStr(BuiltInMethod method);
 
 enum EventType {
-    // TIMER EVENTS.
-    kTimerEvent = 5,
-
-    // HOTSPOT EVENTS.
-    kMouseDownEvent = 6,
-    kMouseUpEvent = 7,
-    kMouseMovedEvent = 8,
-    kMouseEnteredEvent = 9,
-    kMouseExitedEvent = 10,
-    kKeyDownEvent = 13, // PARAMS: 1 - ASCII code.
-
-    // SOUND EVENTS.
-    kSoundEndEvent = 14,
-    kSoundAbortEvent = 19,
-    kSoundFailureEvent = 20,
-    kSoundStoppedEvent = 29,
-    kSoundBeginEvent = 30,
-
-    // MOVIE EVENTS.
-    kMovieEndEvent = 15,
-    kMovieAbortEvent = 21,
-    kMovieFailureEvent = 22,
-    kMovieStoppedEvent = 31,
-    kMovieBeginEvent = 32,
-
-    //SPRITE EVENTS.
-    // Just "MovieEnd" in source.
-    kSpriteMovieEndEvent = 23,
-
-    // SCREEN EVENTS.
-    kEntryEvent = 17,
-    kExitEvent = 27,
-
-    // CONTEXT EVENTS.
-    kLoadCompleteEvent = 44, // PARAMS: 1 - Context ID
-
-    // TEXT EVENTS.
-    kInputEvent = 37,
-    kErrorEvent = 38,
-
-    // CAMERA EVENTS.
-    kPanAbortEvent = 43,
-    kPanEndEvent = 42,
-
-    // PATH EVENTS.
-    kStepEvent = 28,
-    kPathStoppedEvent = 33,
-    kPathEndEvent = 16
+	// TIMER EVENTS.
+	kTimerEvent = 5,
+
+	// HOTSPOT EVENTS.
+	kMouseDownEvent = 6,
+	kMouseUpEvent = 7,
+	kMouseMovedEvent = 8,
+	kMouseEnteredEvent = 9,
+	kMouseExitedEvent = 10,
+	kKeyDownEvent = 13, // PARAMS: 1 - ASCII code.
+
+	// SOUND EVENTS.
+	kSoundEndEvent = 14,
+	kSoundAbortEvent = 19,
+	kSoundFailureEvent = 20,
+	kSoundStoppedEvent = 29,
+	kSoundBeginEvent = 30,
+
+	// MOVIE EVENTS.
+	kMovieEndEvent = 15,
+	kMovieAbortEvent = 21,
+	kMovieFailureEvent = 22,
+	kMovieStoppedEvent = 31,
+	kMovieBeginEvent = 32,
+
+	//SPRITE EVENTS.
+	// Just "MovieEnd" in source.
+	kSpriteMovieEndEvent = 23,
+
+	// SCREEN EVENTS.
+	kEntryEvent = 17,
+	kExitEvent = 27,
+
+	// CONTEXT EVENTS.
+	kLoadCompleteEvent = 44, // PARAMS: 1 - Context ID
+
+	// TEXT EVENTS.
+	kInputEvent = 37,
+	kErrorEvent = 38,
+
+	// CAMERA EVENTS.
+	kPanAbortEvent = 43,
+	kPanEndEvent = 42,
+
+	// PATH EVENTS.
+	kStepEvent = 28,
+	kPathStoppedEvent = 33,
+	kPathEndEvent = 16
 };
 const char *eventTypeToStr(EventType type);
 
 enum EventHandlerArgumentType {
-    kNullEventHandlerArgument = 0,
-    kAsciiCodeEventHandlerArgument = 1,
-    kTimeEventHandlerArgument = 3,
+	kNullEventHandlerArgument = 0,
+	kAsciiCodeEventHandlerArgument = 1,
+	kTimeEventHandlerArgument = 3,
 	// TODO: This argument type Appears to happen with MovieStart
 	// and nowhere else. However, this event handler shouldn't even need an
 	// argument...
-    kUnk1EventHandlerArgument = 4, 
-    kContextEventHandlerArgument = 5
+	kUnk1EventHandlerArgument = 4,
+	kContextEventHandlerArgument = 5
 };
 const char *eventHandlerArgumentTypeToStr(EventHandlerArgumentType type);
 
diff --git a/engines/mediastation/mediastation.cpp b/engines/mediastation/mediastation.cpp
index e2226ab24ac..791c3b37ce0 100644
--- a/engines/mediastation/mediastation.cpp
+++ b/engines/mediastation/mediastation.cpp
@@ -306,23 +306,23 @@ void MediaStationEngine::addPlayingAsset(Asset *assetToAdd) {
 
 Operand MediaStationEngine::callMethod(BuiltInMethod methodId, Common::Array<Operand> &args) {
 	switch (methodId) {
-		case kBranchToScreenMethod: {
-			assert(args.size() == 1);
-			uint32 contextId = args[0].getAssetId();
-			branchToScreen(contextId);
-			return Operand();
-		}
+	case kBranchToScreenMethod: {
+		assert(args.size() == 1);
+		uint32 contextId = args[0].getAssetId();
+		branchToScreen(contextId);
+		return Operand();
+	}
 
-		case kReleaseContextMethod: {
-			assert(args.size() == 1);
-			uint32 contextId = args[0].getAssetId();
-			releaseContext(contextId);
-			return Operand();
-		}
+	case kReleaseContextMethod: {
+		assert(args.size() == 1);
+		uint32 contextId = args[0].getAssetId();
+		releaseContext(contextId);
+		return Operand();
+	}
 
-		default: {
-			error("MediaStationEngine::callMethod(): Got unimplemented method ID %d", static_cast<uint>(methodId));
-		}
+	default: {
+		error("MediaStationEngine::callMethod(): Got unimplemented method ID %d", static_cast<uint>(methodId));
+	}
 	}
 }
 
diff --git a/engines/mediastation/mediastation.h b/engines/mediastation/mediastation.h
index 184617ccc4e..a086d70b7c6 100644
--- a/engines/mediastation/mediastation.h
+++ b/engines/mediastation/mediastation.h
@@ -80,7 +80,7 @@ public:
 	Asset *getAssetByChunkReference(uint chunkReference);
 	Function *getFunctionById(uint functionId);
 
-    Operand callMethod(BuiltInMethod methodId, Common::Array<Operand> &args);
+	Operand callMethod(BuiltInMethod methodId, Common::Array<Operand> &args);
 	Operand callBuiltInFunction(BuiltInFunction function, Common::Array<Operand> &args);
 	Common::HashMap<uint32, Variable *> _variables;
 


Commit: 5827b1ddcabe76ce1419c2c93d54c3dd76dbce59
    https://github.com/scummvm/scummvm/commit/5827b1ddcabe76ce1419c2c93d54c3dd76dbce59
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-23T20:23:40-05:00

Commit Message:
MEDIASTATION: Get rid of unnecessary intermediate variable

Changed paths:
    engines/mediastation/mediastation.cpp


diff --git a/engines/mediastation/mediastation.cpp b/engines/mediastation/mediastation.cpp
index 791c3b37ce0..b64b3693041 100644
--- a/engines/mediastation/mediastation.cpp
+++ b/engines/mediastation/mediastation.cpp
@@ -250,7 +250,7 @@ Context *MediaStationEngine::loadContext(uint32 contextId) {
 		warning("MediaStationEngine::loadContext(): Couldn't find file declaration with ID 0x%x", fileId);
 		return nullptr;
 	}
-	Common::String *fileName = fileDeclaration->_name;
+	Common::Path entryCxtFilepath(*fileDeclaration->_name);
 
 	// Load any child contexts before we actually load this one. The child
 	// contexts must be unloaded explicitly later.
@@ -263,9 +263,6 @@ Context *MediaStationEngine::loadContext(uint32 contextId) {
 			loadContext(childContextId);
 		}
 	}
-
-	// LOAD THE CONTEXT.
-	Common::Path entryCxtFilepath = Common::Path(*fileName);
 	Context *context = new Context(entryCxtFilepath);
 
 	// Some contexts have a built-in palette that becomes active when the


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

Commit Message:
MEDIASTATION: Properly set movie frame footers

Changed paths:
    engines/mediastation/assets/movie.cpp


diff --git a/engines/mediastation/assets/movie.cpp b/engines/mediastation/assets/movie.cpp
index 71d48d2174f..d8f7729992e 100644
--- a/engines/mediastation/assets/movie.cpp
+++ b/engines/mediastation/assets/movie.cpp
@@ -118,11 +118,7 @@ Common::Rect MovieFrame::boundingBox() {
 }
 
 uint32 MovieFrame::index() {
-	if (_footer != nullptr) {
-		return _footer->_index;
-	} else {
-		error("MovieFrame::index(): Cannot get the index of a keyframe");
-	}
+	return _bitmapHeader->_index;
 }
 
 uint32 MovieFrame::startInMilliseconds() {
@@ -156,7 +152,7 @@ uint32 MovieFrame::keyframeEndInMilliseconds() {
 MovieFrame::~MovieFrame() {
 	// The base class destructor takes care of deleting the bitmap header, so
 	// we don't need to delete that here.
-	delete _footer;
+	// The movie will delete the footer.
 	_footer = nullptr;
 }
 
@@ -366,33 +362,20 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
 		if (!isAnimationChunk) {
 			warning("Movie::readSubfile(): (Frameset %d of %d) No animation chunks found (@0x%llx)", i, chunkCount, static_cast<long long int>(chunk.pos()));
 		}
-		MovieFrameHeader *header = nullptr;
-		MovieFrame *frame = nullptr;
 		while (isAnimationChunk) {
 			uint sectionType = Datum(chunk).u.i;
 			debugC(5, kDebugLoading, "Movie::readSubfile(): sectionType = 0x%x (@0x%llx)", static_cast<uint>(sectionType), static_cast<long long int>(chunk.pos()));
 			switch (MovieSectionType(sectionType)) {
 			case kMovieFrameSection: {
-				header = new MovieFrameHeader(chunk);
-				frame = new MovieFrame(chunk, header);
+				MovieFrameHeader *header = new MovieFrameHeader(chunk);
+				MovieFrame *frame = new MovieFrame(chunk, header);
 				_frames.push_back(frame);
 				break;
 			}
 
 			case kMovieFooterSection: {
 				MovieFrameFooter *footer = new MovieFrameFooter(chunk);
-				// _footers.push_back(footer);
-				// TODO: This does NOT handle the case where there are
-				// keyframes. We need to match the footer to an arbitrary
-				// frame, since some keyframes don't have footers, sigh.
-				if (header == nullptr) {
-					error("Movie::readSubfile(): No frame to match footer to");
-				}
-				if (header->_index == footer->_index) {
-					frame->setFooter(footer);
-				} else {
-					error("Movie::readSubfile(): Footer index does not match frame index: %d != %d", header->_index, footer->_index);
-				}
+				_footers.push_back(footer);
 				break;
 			}
 
@@ -450,7 +433,13 @@ void Movie::readSubfile(Subfile &subfile, Chunk &chunk) {
 	}
 
 	// SET THE MOVIE FRAME FOOTERS.
-	// TODO: We donʻt do anything with this yet!
+	for (MovieFrame *frame : _frames) {
+		for (MovieFrameFooter *footer : _footers) {
+			if (frame->index() == footer->_index) {
+				frame->setFooter(footer);
+			}
+		}
+	}
 }
 
 } // End of namespace MediaStation


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

Commit Message:
MEDIASTATION: Add space in human-readable engine name

Changed paths:
    engines/mediastation/configure.engine


diff --git a/engines/mediastation/configure.engine b/engines/mediastation/configure.engine
index c8c45c48b07..6c66de41e37 100644
--- a/engines/mediastation/configure.engine
+++ b/engines/mediastation/configure.engine
@@ -1,3 +1,3 @@
 # This file is included from the main "configure" script
 # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine mediastation "MediaStation" no "" "" ""
+add_engine mediastation "Media Station" no "" "" ""


Commit: 11b617e0b16d7c3bd22110f449faaae7a9bb5750
    https://github.com/scummvm/scummvm/commit/11b617e0b16d7c3bd22110f449faaae7a9bb5750
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2025-01-23T20:23:40-05:00

Commit Message:
MEDIASTATION: Add highres dependency

Since all known Media Station titles run at 640x480.

Changed paths:
    engines/mediastation/configure.engine


diff --git a/engines/mediastation/configure.engine b/engines/mediastation/configure.engine
index 6c66de41e37..923828913d5 100644
--- a/engines/mediastation/configure.engine
+++ b/engines/mediastation/configure.engine
@@ -1,3 +1,3 @@
 # This file is included from the main "configure" script
 # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine mediastation "Media Station" no "" "" ""
+add_engine mediastation "Media Station" no "" "" "highres"




More information about the Scummvm-git-logs mailing list